Built files from Bizgaze WebServer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ej2-documenteditor.min.js 2.0MB

12345678910
  1. /*!
  2. * filename: ej2-documenteditor.min.js
  3. * version : 19.1.57
  4. * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved.
  5. * Use of this code is subject to the terms of our license.
  6. * A copy of the current license can be obtained at any time by e-mailing
  7. * licensing@syncfusion.com. Any infringement will be prosecuted under
  8. * applicable laws.
  9. */
  10. this.ej=this.ej||{},this.ej.documenteditor=function(e,t,i,n,r,o,s,a,l,d,h,c,p,u){"use strict";var g=function(){function e(){this.keysInternal=[],this.valuesInternal=[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.keysInternal.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"keys",{get:function(){return this.keysInternal},enumerable:!0,configurable:!0}),e.prototype.add=function(e,i){if(t.isNullOrUndefined(e))throw new ReferenceError("Provided key or value is not valid.");return this.keysInternal.indexOf(e)<0&&(this.keysInternal.push(e),this.valuesInternal.push(i)),1},e.prototype.get=function(e){if(t.isNullOrUndefined(e))throw new ReferenceError("Provided key is not valid.");var i=this.keysInternal.indexOf(e);return i<0||i>this.keysInternal.length-1?void 0:this.valuesInternal[i]},e.prototype.set=function(e,i){if(t.isNullOrUndefined(e))throw new ReferenceError("Provided key is not valid.");var n=this.keysInternal.indexOf(e);if(n<0||n>this.keysInternal.length-1)throw new RangeError("No item with the specified key has been added.");this.valuesInternal[n]=i},e.prototype.remove=function(e){if(t.isNullOrUndefined(e))throw new ReferenceError("Provided key is not valid.");var i=this.keysInternal.indexOf(e);if(i<0||i>this.keysInternal.length-1)throw new RangeError("No item with the specified key has been added.");return this.keysInternal.splice(i,1),this.valuesInternal.splice(i,1),!0},e.prototype.containsKey=function(e){if(t.isNullOrUndefined(e))throw new ReferenceError("Provided key is not valid.");var i=this.keysInternal.indexOf(e);return!(i<0||i>this.keysInternal.length-1)},e.prototype.clear=function(){this.keysInternal=[],this.valuesInternal=[]},e.prototype.destroy=function(){this.clear(),this.keysInternal=void 0,this.valuesInternal=void 0},e}(),m=function(){function e(e){this.referenceCount=0,this.uniqueFormatType=e,this.propertiesHash=new g}return e.prototype.isEqual=function(e,t,i){var n=!1;switch(this.uniqueFormatType){case 1:n=this.isBorderEqual(e,t,i);break;case 2:n=this.isCharacterFormatEqual(e,t,i);break;case 3:n=this.isParagraphFormatEqual(e,t,i);break;case 4:n=this.isCellFormatEqual(e,t,i);break;case 5:n=this.isShadingEqual(e,t,i);break;case 6:n=this.isRowFormatEqual(e,t,i);break;case 7:n=this.isListFormatEqual(e,t,i);break;case 8:n=this.isTableFormatEqual(e,t,i);break;case 9:n=this.isListLevelEqual(e,t,i);break;case 10:n=this.isSectionFormatEqual(e,t,i)}return n},e.prototype.isNotEqual=function(i,n,r,o,s){var a=void 0,l=e.getPropertyType(s,i);this.propertiesHash.containsKey(l)&&(a=this.propertiesHash.get(l));var d=void 0;return i===r?d=o:n.containsKey(l)&&(d=n.get(l)),!(a===d||!t.isNullOrUndefined(a)&&!t.isNullOrUndefined(d)&&a===d)},e.getPropertyType=function(e,t){var i=0;switch(e){case 1:i=this.getBorderPropertyType(t);break;case 2:i=this.getCharacterFormatPropertyType(t);break;case 3:i=this.getParaFormatPropertyType(t);break;case 4:i=this.getCellFormatPropertyType(t);break;case 5:i=this.getShadingPropertyType(t);break;case 6:i=this.getRowFormatType(t);break;case 7:i=this.getListFormatType(t);break;case 8:i=this.getTableFormatType(t);break;case 9:i=this.getListLevelType(t);break;case 10:i=this.getSectionFormatType(t)}return i},e.getRowFormatType=function(e){return"allowBreakAcrossPages"===e?1:"isHeader"===e?2:"height"===e?3:"heightType"===e?4:"gridBefore"===e?5:"gridBeforeWidth"===e?6:"gridBeforeWidthType"===e?7:"gridAfter"===e?8:"gridAfterWidth"===e?9:"gridAfterWidthType"===e?10:"leftMargin"===e?11:"topMargin"===e?12:"bottomMargin"===e?13:"rightMargin"===e?14:"leftIndent"===e?15:0},e.getListFormatType=function(e){return"listId"===e?1:"listLevelNumber"===e?2:0},e.getTableFormatType=function(e){return"leftMargin"===e?1:"rightMargin"===e?2:"topMargin"===e?3:"bottomMargin"===e?4:"cellSpacing"===e?5:"leftIndent"===e?6:"tableAlignment"===e?7:"preferredWidth"===e?8:"preferredWidthType"===e?9:"bidi"===e?10:"allowAutoFit"===e?11:"horizontalPositionAbs"===e?12:"horizontalPosition"===e?13:0},e.getListLevelType=function(e){return"listLevelPattern"===e?1:"startAt"===e?2:"followCharacter"===e?3:"numberFormat"===e?4:"restartLevel"===e?5:0},e.getShadingPropertyType=function(e){return"backgroundColor"===e?1:"foregroundColor"===e?2:"textureStyle"===e?3:0},e.getCellFormatPropertyType=function(e){return"leftMargin"===e?1:"rightMargin"===e?2:"topMargin"===e?3:"bottomMargin"===e?4:"columnSpan"===e?5:"rowSpan"===e?6:"verticalAlignment"===e?7:"preferredWidthType"===e?8:"preferredWidth"===e?9:"cellWidth"===e?10:0},e.getBorderPropertyType=function(e){return"color"===e?1:"lineStyle"===e?2:"lineWidth"===e?3:"shadow"===e?4:"space"===e?5:"hasNoneStyle"===e?6:0},e.getCharacterFormatPropertyType=function(e){return"fontColor"===e?1:"fontFamily"===e?2:"fontSize"===e?3:"bold"===e?4:"italic"===e?5:"underline"===e?6:"strikethrough"===e?7:"baselineAlignment"===e?8:"highlightColor"===e?9:"bidi"===e?10:"bdo"===e?11:"boldBidi"===e?12:"italicBidi"===e?13:"fontFamilyBidi"===e?14:"fontSizeBidi"===e?15:"allCaps"===e?16:0},e.getParaFormatPropertyType=function(e){return"leftIndent"===e?1:"rightIndent"===e?2:"firstLineIndent"===e?3:"textAlignment"===e?4:"beforeSpacing"===e?5:"afterSpacing"===e?6:"lineSpacing"===e?7:"lineSpacingType"===e?8:"outlineLevel"===e?9:"bidi"===e?10:"contextualSpacing"===e?11:0},e.getSectionFormatType=function(e){return"headerDistance"===e?1:"footerDistance"===e?2:"differentFirstPage"===e?3:"differentOddAndEvenPages"===e?4:"pageWidth"===e?5:"pageHeight"===e?6:"leftMargin"===e?7:"topMargin"===e?8:"rightMargin"===e?9:"bottomMargin"===e?10:"bidi"===e?11:"restartPageNumbering"===e?12:"pageStartingNumber"===e?13:"endnoteNumberFormat"===e?14:"endnotePosition"===e?15:"footNoteNumberFormat"===e?16:"footnotePosition"===e?17:"restartIndexForEndnotes"===e?18:"restartIndexForFootnotes"===e?19:"initialFootNoteNumber"===e?20:"initialEndNoteNumber"===e?21:0},e.prototype.isBorderEqual=function(e,t,i){return!this.isNotEqual("color",e,t,i,1)&&(!this.isNotEqual("lineStyle",e,t,i,1)&&(!this.isNotEqual("lineWidth",e,t,i,1)&&(!this.isNotEqual("shadow",e,t,i,1)&&(!this.isNotEqual("space",e,t,i,1)&&!this.isNotEqual("hasNoneStyle",e,t,i,1)))))},e.prototype.isCharacterFormatEqual=function(e,t,i){return!this.isNotEqual("fontColor",e,t,i,2)&&(!this.isNotEqual("fontFamily",e,t,i,2)&&(!this.isNotEqual("fontSize",e,t,i,2)&&(!this.isNotEqual("bold",e,t,i,2)&&(!this.isNotEqual("italic",e,t,i,2)&&(!this.isNotEqual("underline",e,t,i,2)&&(!this.isNotEqual("strikethrough",e,t,i,2)&&(!this.isNotEqual("baselineAlignment",e,t,i,2)&&(!this.isNotEqual("highlightColor",e,t,i,2)&&(!this.isNotEqual("bidi",e,t,i,2)&&(!this.isNotEqual("bdo",e,t,i,2)&&(!this.isNotEqual("fontColor",e,t,i,2)&&(!this.isNotEqual("fontFamilyBidi",e,t,i,2)&&(!this.isNotEqual("fontSizeBidi",e,t,i,2)&&(!this.isNotEqual("boldBidi",e,t,i,2)&&(!this.isNotEqual("italicBidi",e,t,i,2)&&!this.isNotEqual("allCaps",e,t,i,2))))))))))))))))},e.prototype.isParagraphFormatEqual=function(e,t,i){return!this.isNotEqual("leftIndent",e,t,i,3)&&(!this.isNotEqual("rightIndent",e,t,i,3)&&(!this.isNotEqual("firstLineIndent",e,t,i,3)&&(!this.isNotEqual("textAlignment",e,t,i,3)&&(!this.isNotEqual("beforeSpacing",e,t,i,3)&&(!this.isNotEqual("afterSpacing",e,t,i,3)&&(!this.isNotEqual("lineSpacing",e,t,i,3)&&(!this.isNotEqual("lineSpacingType",e,t,i,3)&&(!this.isNotEqual("outlineLevel",e,t,i,3)&&(!this.isNotEqual("bidi",e,t,i,3)&&!this.isNotEqual("contextualSpacing",e,t,i,3))))))))))},e.prototype.isCellFormatEqual=function(e,t,i){return!this.isNotEqual("leftMargin",e,t,i,4)&&(!this.isNotEqual("rightMargin",e,t,i,4)&&(!this.isNotEqual("topMargin",e,t,i,4)&&(!this.isNotEqual("bottomMargin",e,t,i,4)&&(!this.isNotEqual("columnSpan",e,t,i,4)&&(!this.isNotEqual("rowSpan",e,t,i,4)&&(!this.isNotEqual("verticalAlignment",e,t,i,4)&&(!this.isNotEqual("preferredWidthType",e,t,i,4)&&(!this.isNotEqual("preferredWidth",e,t,i,4)&&!this.isNotEqual("cellWidth",e,t,i,4)))))))))},e.prototype.isShadingEqual=function(e,t,i){return!this.isNotEqual("backgroundColor",e,t,i,5)&&(!this.isNotEqual("foregroundColor",e,t,i,5)&&!this.isNotEqual("textureStyle",e,t,i,5))},e.prototype.isRowFormatEqual=function(e,t,i){return!this.isNotEqual("allowBreakAcrossPages",e,t,i,6)&&(!this.isNotEqual("isHeader",e,t,i,6)&&(!this.isNotEqual("height",e,t,i,6)&&(!this.isNotEqual("heightType",e,t,i,6)&&(!this.isNotEqual("gridBefore",e,t,i,6)&&(!this.isNotEqual("gridBeforeWidth",e,t,i,6)&&(!this.isNotEqual("gridBeforeWidthType",e,t,i,6)&&(!this.isNotEqual("gridAfter",e,t,i,6)&&(!this.isNotEqual("gridAfterWidth",e,t,i,6)&&(!this.isNotEqual("gridAfterWidthType",e,t,i,6)&&(!this.isNotEqual("leftMargin",e,t,i,6)&&(!this.isNotEqual("topMargin",e,t,i,6)&&(!this.isNotEqual("bottomMargin",e,t,i,6)&&(!this.isNotEqual("rightMargin",e,t,i,6)&&!this.isNotEqual("leftIndent",e,t,i,6))))))))))))))},e.prototype.isListFormatEqual=function(e,t,i){return!this.isNotEqual("listId",e,t,i,7)&&!this.isNotEqual("listLevelNumber",e,t,i,7)},e.prototype.isTableFormatEqual=function(e,t,i){return!this.isNotEqual("leftMargin",e,t,i,8)&&(!this.isNotEqual("rightMargin",e,t,i,8)&&(!this.isNotEqual("topMargin",e,t,i,8)&&(!this.isNotEqual("bottomMargin",e,t,i,8)&&(!this.isNotEqual("cellSpacing",e,t,i,8)&&(!this.isNotEqual("leftIndent",e,t,i,8)&&(!this.isNotEqual("tableAlignment",e,t,i,8)&&(!this.isNotEqual("preferredWidth",e,t,i,8)&&(!this.isNotEqual("preferredWidthType",e,t,i,8)&&(!this.isNotEqual("bidi",e,t,i,8)&&(!this.isNotEqual("allowAutoFit",e,t,i,8)&&(!this.isNotEqual("horizontalPositionAbs",e,t,i,8)&&!this.isNotEqual("horizontalPosition",e,t,i,8))))))))))))},e.prototype.isListLevelEqual=function(e,t,i){return!this.isNotEqual("listLevelPattern",e,t,i,9)&&(!this.isNotEqual("startAt",e,t,i,9)&&(!this.isNotEqual("followCharacter",e,t,i,9)&&(!this.isNotEqual("numberFormat",e,t,i,9)&&!this.isNotEqual("restartLevel",e,t,i,9))))},e.prototype.isSectionFormatEqual=function(e,t,i){return!this.isNotEqual("headerDistance",e,t,i,10)&&(!this.isNotEqual("footerDistance",e,t,i,10)&&(!this.isNotEqual("differentFirstPage",e,t,i,10)&&(!this.isNotEqual("differentOddAndEvenPages",e,t,i,10)&&(!this.isNotEqual("pageWidth",e,t,i,10)&&(!this.isNotEqual("pageHeight",e,t,i,10)&&(!this.isNotEqual("leftMargin",e,t,i,10)&&(!this.isNotEqual("topMargin",e,t,i,10)&&(!this.isNotEqual("rightMargin",e,t,i,10)&&(!this.isNotEqual("bottomMargin",e,t,i,10)&&(!this.isNotEqual("bidi",e,t,i,10)&&(!this.isNotEqual("restartPageNumbering",e,t,i,10)&&(!this.isNotEqual("pageStartingNumber",e,t,i,10)&&(!this.isNotEqual("endnoteNumberFormat",e,t,i,10)&&(!this.isNotEqual("endnotePosition",e,t,i,10)&&(!this.isNotEqual("footNoteNumberFormat",e,t,i,10)&&(!this.isNotEqual("footnotePosition",e,t,i,10)&&(!this.isNotEqual("restartIndexForEndnotes",e,t,i,10)&&(!this.isNotEqual("restartIndexForFootnotes",e,t,i,10)&&(!this.isNotEqual("initialFootNoteNumber",e,t,i,10)&&!this.isNotEqual("initialEndNoteNumber",e,t,i,10))))))))))))))))))))},e.prototype.cloneItems=function(t,i,n,r){for(var o=e.getPropertyType(r,i),s=t.propertiesHash.keys,a=0;a<s.length;a++)s[a]===o?this.propertiesHash.add(o,n):this.propertiesHash.add(s[a],t.propertiesHash.get(s[a]));t.propertiesHash.containsKey(o)||this.propertiesHash.add(o,n)},e.prototype.mergeProperties=function(e){for(var t=e.cloneProperties(),i=this.propertiesHash.keys,n=0;n<i.length;n++)t.containsKey(i[n])||t.add(i[n],this.propertiesHash.get(i[n]));return t},e.prototype.cloneProperties=function(){for(var e=new g,t=this.propertiesHash.keys,i=0;i<t.length;i++)e.add(t[i],this.propertiesHash.get(t[i]));return e},e.prototype.destroy=function(){t.isNullOrUndefined(this.propertiesHash)||this.propertiesHash.destroy(),this.propertiesHash=void 0,this.referenceCount=void 0,this.uniqueFormatType=void 0},e}(),f=function(){function e(){this.items=[]}return e.prototype.addUniqueFormat=function(e,i){for(var n=void 0,r=0;r<this.items.length;r++)if(this.items[r].isEqual(e,void 0,void 0)){n=this.items[r];break}return t.isNullOrUndefined(n)?((n=new m(i)).propertiesHash=e,n.referenceCount=1,this.items.push(n)):n.referenceCount++,n},e.prototype.updateUniqueFormat=function(e,i,n){for(var r=void 0,o=0;o<this.items.length;o++)if(this.items[o].isEqual(e.propertiesHash,i,n)){r=this.items[o];break}return t.isNullOrUndefined(r)?((r=new m(e.uniqueFormatType)).cloneItems(e,i,n,e.uniqueFormatType),r.referenceCount=1,this.items.push(r)):r.referenceCount++,this.remove(e),e=void 0,r},e.prototype.remove=function(e){--e.referenceCount<=0&&(this.items.splice(this.items.indexOf(e),1),e.destroy(),e=void 0)},e.prototype.clear=function(){if(t.isNullOrUndefined(this.items))for(var e=0;e<this.items.length;e++)this.items[e].destroy();this.items=[]},e.prototype.destroy=function(){this.clear(),this.items=void 0},e}(),v=function(){function e(){this.mode=!0}return e.prototype.send=function(e){var t=this;this.xmlHttpRequest=new XMLHttpRequest,this.xmlHttpRequest.onreadystatechange=function(){t.stateChange(t)},this.xmlHttpRequest.onerror=function(){t.error(t)},this.mode?this.sendRequest(e):setTimeout(function(){t.sendRequest(e)})},e.prototype.sendRequest=function(e){this.xmlHttpRequest.open("POST",this.url,!0),this.contentType&&this.xmlHttpRequest.setRequestHeader("Content-Type",this.contentType),this.setCustomAjaxHeaders(),this.responseType&&(this.xmlHttpRequest.responseType=this.responseType);var t=e instanceof FormData?e:JSON.stringify(e);this.xmlHttpRequest.send(t)},e.prototype.stateChange=function(e){if(4===e.xmlHttpRequest.readyState&&200===e.xmlHttpRequest.status){var t=void 0,i={name:"onSuccess",data:t=this.responseType?e.xmlHttpRequest.response:e.xmlHttpRequest.responseText,readyState:e.xmlHttpRequest.readyState,status:e.xmlHttpRequest.status};e.successHandler(i)}else if(4===e.xmlHttpRequest.readyState&&200!==e.xmlHttpRequest.status){i={name:"onFailure",status:e.xmlHttpRequest.status,statusText:e.xmlHttpRequest.statusText,url:e.url};e.failureHandler(i)}},e.prototype.error=function(e){var t={name:"onError",status:this.xmlHttpRequest.status,statusText:this.xmlHttpRequest.statusText};e.errorHandler(t)},e.prototype.successHandler=function(e){return this.onSuccess&&this.onSuccess(e),e},e.prototype.failureHandler=function(e){return this.onFailure&&this.onFailure(e),e},e.prototype.errorHandler=function(e){return this.onError&&this.onError(e),e},e.prototype.setCustomAjaxHeaders=function(){for(var e=0;e<this.customHeaders.length;e++)for(var t=this.customHeaders[e],i=0,n=Object.keys(t);i<n.length;i++){var r=n[i];this.xmlHttpRequest.setRequestHeader(r,t[r])}},e}(),y=function(){function e(){}return e.prototype.getModuleName=function(){return"Print"},e.prototype.print=function(e,t){this.printWindow(e,navigator.userAgent,t)},e.prototype.printWindow=function(e,i,n){var r=this.getPageHeight(e.pages),o=this.getPageWidth(e.pages),s=document.createElement("div");s.style.width="100%",s.style.height="100%",s.style.overflow="scroll",this.generatePrintContent(e,s),t.isNullOrUndefined(n)&&(n=window.open("","print","height=452,width=1024,tabbar=no")),-1!==i.indexOf("Chrome")||-1!==i.indexOf("Firefox")?(n.document.write("<!DOCTYPE html>"),n.document.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:"+o.toString()+"px "+r.toString()+"px; }@media print{ body { margin: 0cm; }</style></head> <body><center>")):n.document.write("<html><head><style>@page{margin:0;size:"+o.toString()+"px "+r.toString()+"px;}</style></head><body><center>"),n.document.write(s.innerHTML+"</center><script> (function() { window.ready = true; })(); <\/script></body></html>"),s=void 0,n.document.close(),n.focus();var a=setInterval(function(){n.ready&&(n.print(),n.close(),clearInterval(a))},500)},e.prototype.generateDoumentImages=function(e,i){var n;if(!t.isNullOrUndefined(i)&&i<=e.pages.length&&i>=1){var r=e.pages[i-1],o=r.boundingRectangle.height,s=r.boundingRectangle.width;e.render.isPrinting=!0,e.render.renderWidgets(r,0,0,0,0);var a=e.render.pageCanvas.toDataURL();e.render.isPrinting=!1,(n=new Image).src=a,n.setAttribute("style","margin:0px;display:block;width:"+s.toString()+"px;height:"+o.toString()+"px;")}return n},e.prototype.generatePrintContent=function(e,t){for(var i="",n=0;n<e.pages.length;n++){var r=e.pages[n],o=r.boundingRectangle.height,s=r.boundingRectangle.width;e.render.isPrinting=!0,e.render.renderWidgets(r,0,0,0,0);var a=e.render.pageCanvas.toDataURL();e.render.isPrinting=!1,i+="<div><img src="+a+' style="margin:0px;display:block;width: '+s.toString()+"px; height:"+o.toString()+'px; "/></div><br/>'}t.innerHTML=i},e.prototype.getPageWidth=function(e){for(var t=0,i=0;i<e.length;i++)t<e[i].boundingRectangle.width&&(t=e[i].boundingRectangle.width);return t},e.prototype.getPageHeight=function(e){for(var t=0,i=0;i<e.length;i++)t<e[i].boundingRectangle.height&&(t=e[i].boundingRectangle.height);return t},e.prototype.destroy=function(){},e}(),b=function(){function e(e){this.uniqueSectionFormat=void 0,this.ownerBase=e}return Object.defineProperty(e.prototype,"headerDistance",{get:function(){return this.getPropertyValue("headerDistance")},set:function(e){this.setPropertyValue("headerDistance",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"footerDistance",{get:function(){return this.getPropertyValue("footerDistance")},set:function(e){this.setPropertyValue("footerDistance",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"differentFirstPage",{get:function(){return this.getPropertyValue("differentFirstPage")},set:function(e){this.setPropertyValue("differentFirstPage",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"differentOddAndEvenPages",{get:function(){return this.getPropertyValue("differentOddAndEvenPages")},set:function(e){this.setPropertyValue("differentOddAndEvenPages",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageHeight",{get:function(){return this.getPropertyValue("pageHeight")},set:function(e){this.setPropertyValue("pageHeight",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightMargin",{get:function(){return this.getPropertyValue("rightMargin")},set:function(e){this.setPropertyValue("rightMargin",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageWidth",{get:function(){return this.getPropertyValue("pageWidth")},set:function(e){this.setPropertyValue("pageWidth",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leftMargin",{get:function(){return this.getPropertyValue("leftMargin")},set:function(e){this.setPropertyValue("leftMargin",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bottomMargin",{get:function(){return this.getPropertyValue("bottomMargin")},set:function(e){this.setPropertyValue("bottomMargin",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"topMargin",{get:function(){return this.getPropertyValue("topMargin")},set:function(e){this.setPropertyValue("topMargin",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bidi",{get:function(){return this.getPropertyValue("bidi")},set:function(e){this.setPropertyValue("bidi",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"restartPageNumbering",{get:function(){return this.getPropertyValue("restartPageNumbering")},set:function(e){this.setPropertyValue("restartPageNumbering",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageStartingNumber",{get:function(){return this.getPropertyValue("pageStartingNumber")},set:function(e){this.setPropertyValue("pageStartingNumber",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endnoteNumberFormat",{get:function(){return this.getPropertyValue("endnoteNumberFormat")},set:function(e){this.setPropertyValue("endnoteNumberFormat",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"restartIndexForEndnotes",{get:function(){return this.getPropertyValue("restartIndexForEndnotes")},set:function(e){this.setPropertyValue("restartIndexForEndnotes",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"restartIndexForFootnotes",{get:function(){return this.getPropertyValue("restartIndexForFootnotes")},set:function(e){this.setPropertyValue("restartIndexForFootnotes",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"footNoteNumberFormat",{get:function(){return this.getPropertyValue("footNoteNumberFormat")},set:function(e){this.setPropertyValue("footNoteNumberFormat",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"initialFootNoteNumber",{get:function(){return this.getPropertyValue("initialFootNoteNumber")},set:function(e){this.setPropertyValue("initialFootNoteNumber",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"initialEndNoteNumber",{get:function(){return this.getPropertyValue("initialEndNoteNumber")},set:function(e){this.setPropertyValue("initialEndNoteNumber",e)},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){t.isNullOrUndefined(this.uniqueSectionFormat)||e.uniqueSectionFormats.remove(this.uniqueSectionFormat),this.uniqueSectionFormat=void 0},e.prototype.hasValue=function(e){if(!t.isNullOrUndefined(this.uniqueSectionFormat)){var i=m.getPropertyType(this.uniqueSectionFormat.uniqueFormatType,e);return this.uniqueSectionFormat.propertiesHash.containsKey(i)}return!1},e.getPropertyDefaultValue=function(e){var t=void 0;switch(e){case"headerDistance":case"footerDistance":t=36;break;case"differentFirstPage":case"differentOddAndEvenPages":t=!1;break;case"pageWidth":t=612;break;case"pageHeight":t=792;break;case"leftMargin":case"topMargin":case"rightMargin":case"bottomMargin":t=72;break;case"bidi":case"restartPageNumbering":t=!1;break;case"pageStartingNumber":t=1;break;case"footnotePosition":t="PrintAtBottomOfPage";break;case"endnoteNumberFormat":t="LowerCaseRoman";break;case"endnotePosition":t="DisplayEndOfDocument";break;case"restartIndexForEndnotes":case"restartIndexForFootnotes":t="DoNotRestart";break;case"footNoteNumberFormat":t="Arabic";break;case"initialFootNoteNumber":case"initialEndNoteNumber":t=1}return t},e.prototype.getPropertyValue=function(i){if(this.hasValue(i)){var n=m.getPropertyType(e.uniqueFormatType,i);if(!t.isNullOrUndefined(this.uniqueSectionFormat)&&this.uniqueSectionFormat.propertiesHash.containsKey(n))return this.uniqueSectionFormat.propertiesHash.get(n)}return e.getPropertyDefaultValue(i)},e.prototype.setPropertyValue=function(i,n){if((t.isNullOrUndefined(n)||""===n)&&(n=e.getPropertyDefaultValue(i)),t.isNullOrUndefined(this.uniqueSectionFormat))this.initializeUniqueSectionFormat(i,n);else{var r=m.getPropertyType(this.uniqueSectionFormat.uniqueFormatType,i);if(this.uniqueSectionFormat.propertiesHash.containsKey(r)&&this.uniqueSectionFormat.propertiesHash.get(r)===n)return;this.uniqueSectionFormat=e.uniqueSectionFormats.updateUniqueFormat(this.uniqueSectionFormat,i,n)}},e.prototype.initializeUniqueSectionFormat=function(t,i){var n=new g;this.addUniqueSectionFormat("headerDistance",t,i,n),this.addUniqueSectionFormat("footerDistance",t,i,n),this.addUniqueSectionFormat("differentFirstPage",t,i,n),this.addUniqueSectionFormat("differentOddAndEvenPages",t,i,n),this.addUniqueSectionFormat("pageWidth",t,i,n),this.addUniqueSectionFormat("pageHeight",t,i,n),this.addUniqueSectionFormat("leftMargin",t,i,n),this.addUniqueSectionFormat("topMargin",t,i,n),this.addUniqueSectionFormat("rightMargin",t,i,n),this.addUniqueSectionFormat("bottomMargin",t,i,n),this.addUniqueSectionFormat("bidi",t,i,n),this.addUniqueSectionFormat("restartPageNumbering",t,i,n),this.addUniqueSectionFormat("pageStartingNumber",t,i,n),this.addUniqueSectionFormat("endnoteNumberFormat",t,i,n),this.addUniqueSectionFormat("endnotePosition",t,i,n),this.addUniqueSectionFormat("footNoteNumberFormat",t,i,n),this.addUniqueSectionFormat("footnotePosition",t,i,n),this.addUniqueSectionFormat("restartIndexForEndnotes",t,i,n),this.addUniqueSectionFormat("restartIndexForFootnotes",t,i,n),this.addUniqueSectionFormat("initialFootNoteNumber",t,i,n),this.addUniqueSectionFormat("initialEndNoteNumber",t,i,n),this.uniqueSectionFormat=e.uniqueSectionFormats.addUniqueFormat(n,e.uniqueFormatType)},e.prototype.addUniqueSectionFormat=function(t,i,n,r){var o=m.getPropertyType(e.uniqueFormatType,t);t===i?r.add(o,n):r.add(o,e.getPropertyDefaultValue(t))},e.prototype.copyFormat=function(e,i){i&&(i.isUndoing||i.isRedoing)?this.uniqueSectionFormat=e.uniqueSectionFormat:t.isNullOrUndefined(e)||!t.isNullOrUndefined(e.uniqueSectionFormat)&&e.uniqueSectionFormat.propertiesHash&&this.updateUniqueSectionFormat(e)},e.prototype.updateUniqueSectionFormat=function(i){var n=void 0;this.uniqueSectionFormat&&(n=this.uniqueSectionFormat.mergeProperties(i.uniqueSectionFormat),0===this.uniqueSectionFormat.referenceCount&&(e.uniqueSectionFormats.remove(this.uniqueSectionFormat),this.uniqueSectionFormat=void 0)),this.uniqueSectionFormat=new m(e.uniqueFormatType),t.isNullOrUndefined(n)&&(n=this.uniqueSectionFormat.mergeProperties(i.uniqueSectionFormat)),this.uniqueSectionFormat=e.uniqueSectionFormats.addUniqueFormat(n,e.uniqueFormatType)},e.prototype.cloneFormat=function(){var t=new e;return t.uniqueSectionFormat=this.uniqueSectionFormat,t},e.clear=function(){this.uniqueSectionFormats.clear()},e.uniqueSectionFormats=new f,e.uniqueFormatType=10,e}(),w=function(){function e(){}return e.prototype.destroy=function(){t.isNullOrUndefined(this.overrideListLevel)||this.overrideListLevel.destroy(),this.levelNumber=void 0,this.startAt=void 0,this.overrideListLevel=void 0},e.prototype.clone=function(){var i=new e;return i.startAt=this.startAt,i.levelNumber=this.levelNumber,t.isNullOrUndefined(this.overrideListLevel)||(i.overrideListLevel=this.overrideListLevel.clone(i)),i},e}(),C=function(){function e(){this.listId=-1,this.sourceListId=-1,this.abstractListId=-1,this.abstractList=void 0,this.levelOverrides=[]}return e.prototype.getListLevel=function(e){var i=this.getLevelOverride(e);return t.isNullOrUndefined(i)||t.isNullOrUndefined(i.overrideListLevel)?this.abstractList.levels[e]:i.overrideListLevel},e.prototype.getLevelOverride=function(e){for(var t=0;t<this.levelOverrides.length;t++)if(this.levelOverrides[t]instanceof w){var i=this.levelOverrides[t];if(i.levelNumber===e)return i}},e.prototype.destroy=function(){t.isNullOrUndefined(this.levelOverrides)||(this.levelOverrides=[]),this.abstractListId=void 0,this.listId=void 0,this.sourceListId=void 0,this.levelOverrides=void 0},e.prototype.mergeList=function(e){t.isNullOrUndefined(this.abstractListId)||-1===this.abstractListId||(this.abstractListId=e.abstractListId),t.isNullOrUndefined(this.listId)||-1===this.listId||(this.listId=e.listId),t.isNullOrUndefined(this.sourceListId)||-1===this.sourceListId||(this.sourceListId=e.sourceListId),t.isNullOrUndefined(this.levelOverrides)||0===this.levelOverrides.length||(this.levelOverrides=e.levelOverrides)},e.prototype.clone=function(){for(var t=new e,i=0;i<this.levelOverrides.length;i++)t.levelOverrides.push(this.levelOverrides[i].clone());return t},e}(),x=function(){function e(e){this.uniqueListFormat=void 0,this.ownerBase=void 0,this.baseStyle=void 0,this.list=void 0,this.ownerBase=e}return Object.defineProperty(e.prototype,"listId",{get:function(){return this.getPropertyValue("listId")},set:function(e){this.setPropertyValue("listId",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"listLevelNumber",{get:function(){return this.getPropertyValue("listLevelNumber")},set:function(e){this.setPropertyValue("listLevelNumber",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"listLevel",{get:function(){var e=void 0;if(t.isNullOrUndefined(this.list))for(var i=this.baseStyle;!t.isNullOrUndefined(i);){if(i.paragraphFormat.listFormat.list){e=i.paragraphFormat.listFormat.list;break}i=i.basedOn}else e=this.list;return t.isNullOrUndefined(e)?void 0:e.getListLevel(this.listLevelNumber)},enumerable:!0,configurable:!0}),e.prototype.getPropertyValue=function(i){if(this.hasValue(i)){r=m.getPropertyType(e.uniqueFormatType,i);if(!t.isNullOrUndefined(this.uniqueListFormat)&&this.uniqueListFormat.propertiesHash.containsKey(r))return this.uniqueListFormat.propertiesHash.get(r)}else if(this.baseStyle instanceof R){for(var n=this.baseStyle;!t.isNullOrUndefined(n)&&!n.paragraphFormat.listFormat.hasValue(i);)n=n.basedOn;if(!t.isNullOrUndefined(n)){var r=m.getPropertyType(e.uniqueFormatType,i);return n.paragraphFormat.listFormat.uniqueListFormat.propertiesHash.get(r)}}return e.getPropertyDefaultValue(i)},e.prototype.setPropertyValue=function(i,n){if((t.isNullOrUndefined(n)||""===n)&&(n=e.getPropertyDefaultValue(i)),t.isNullOrUndefined(this.uniqueListFormat))this.initializeUniqueListFormat(i,n);else{var r=m.getPropertyType(this.uniqueListFormat.uniqueFormatType,i);if(this.uniqueListFormat.propertiesHash.containsKey(r)&&this.uniqueListFormat.propertiesHash.get(r)===n)return;this.uniqueListFormat=e.uniqueListFormats.updateUniqueFormat(this.uniqueListFormat,i,n)}},e.prototype.initializeUniqueListFormat=function(t,i){var n=new g;this.addUniqueListFormat("listId",t,i,n),this.addUniqueListFormat("listLevelNumber",t,i,n),this.uniqueListFormat=e.uniqueListFormats.addUniqueFormat(n,e.uniqueFormatType)},e.prototype.addUniqueListFormat=function(t,i,n,r){var o=m.getPropertyType(e.uniqueFormatType,t);t===i&&r.add(o,n)},e.getPropertyDefaultValue=function(e){var t=void 0;switch(e){case"listId":t=-1;break;case"listLevelNumber":t=0}return t},e.prototype.copyFormat=function(e){t.isNullOrUndefined(e)||(t.isNullOrUndefined(e.uniqueListFormat)||(this.listId=e.listId,this.listLevelNumber=e.listLevelNumber),t.isNullOrUndefined(e.baseStyle)||(this.baseStyle=e.baseStyle),t.isNullOrUndefined(e.list)||(this.list=e.list))},e.prototype.hasValue=function(e){if(!t.isNullOrUndefined(this.uniqueListFormat)){var i=m.getPropertyType(this.uniqueListFormat.uniqueFormatType,e);return this.uniqueListFormat.propertiesHash.containsKey(i)}return!1},e.prototype.clearFormat=function(){t.isNullOrUndefined(this.uniqueListFormat)||0!==this.uniqueListFormat.referenceCount||e.uniqueListFormats.remove(this.uniqueListFormat),this.uniqueListFormat=void 0,this.list=void 0},e.prototype.destroy=function(){this.clearFormat()},e.clear=function(){this.uniqueListFormats.clear()},e.prototype.applyStyle=function(e){this.baseStyle=e},e.prototype.getValue=function(e){return this.hasValue(e)?this.getPropertyValue(e):void 0},e.prototype.mergeFormat=function(e){t.isNullOrUndefined(this.getValue("listId"))&&(this.listId=e.getValue("listId")),t.isNullOrUndefined(this.getValue("listLevelNumber"))&&(this.listLevelNumber=e.getValue("listLevelNumber")),t.isNullOrUndefined(e.list)||(t.isNullOrUndefined(this.list)&&(this.list=new C),this.list.mergeList(e.list))},e.prototype.cloneListFormat=function(){var t=new e(void 0);return t.list=this.list,t.listId=this.listId,t.baseStyle=this.baseStyle,t.listLevelNumber=this.listLevelNumber,t.uniqueListFormat=this.uniqueListFormat,t},e.uniqueListFormats=new f,e.uniqueFormatType=7,e}(),F=function(){function e(){}return Object.defineProperty(e.prototype,"position",{get:function(){return this.positionIn},set:function(e){this.positionIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"deletePosition",{get:function(){return this.deletePositionIn},set:function(e){this.deletePositionIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabJustification",{get:function(){return this.justification},set:function(e){this.justification=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tabLeader",{get:function(){return this.leader},set:function(e){this.leader=e},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){this.position=void 0,this.deletePosition=void 0,this.tabJustification=void 0,this.leader=void 0},e}(),P=function(){function e(e){this.uniqueParagraphFormat=void 0,this.ownerBase=void 0,this.baseStyle=void 0,this.tabs=void 0,this.ownerBase=e,this.listFormat=new x(this),this.tabs=[]}return e.prototype.getUpdatedTabs=function(){var e=[];if(!t.isNullOrUndefined(this.baseStyle)){for(var i=this.baseStyle,n=new g;!t.isNullOrUndefined(i);){for(var r=0,o=i.paragraphFormat.tabs;r<o.length;r++){var s=o[r];n.containsKey(s.position)||n.add(s.position,s)}i=i.basedOn}for(var a=0,l=n.keys;a<l.length;a++){var d=l[a];this.hasTabStop(parseFloat(d.toFixed(4)))||e.push(n.get(d))}e=(e=e.concat(this.tabs.filter(function(e){return 0!==e.position&&0===e.deletePosition}))).sort(function(e,t){return e.position-t.position})}return e},e.prototype.hasTabStop=function(e){for(var t=0;t<this.tabs.length;t++)if(parseFloat(this.tabs[t].position.toFixed(4))===e||parseFloat(this.tabs[t].deletePosition.toFixed(4))===e)return!0;return!1},Object.defineProperty(e.prototype,"leftIndent",{get:function(){return this.getPropertyValue("leftIndent")},set:function(e){this.setPropertyValue("leftIndent",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightIndent",{get:function(){return this.getPropertyValue("rightIndent")},set:function(e){this.setPropertyValue("rightIndent",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstLineIndent",{get:function(){return this.getPropertyValue("firstLineIndent")},set:function(e){this.setPropertyValue("firstLineIndent",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"beforeSpacing",{get:function(){return this.getPropertyValue("beforeSpacing")},set:function(e){this.setPropertyValue("beforeSpacing",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"afterSpacing",{get:function(){return this.getPropertyValue("afterSpacing")},set:function(e){this.setPropertyValue("afterSpacing",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineSpacing",{get:function(){return this.getPropertyValue("lineSpacing")},set:function(e){this.setPropertyValue("lineSpacing",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineSpacingType",{get:function(){return this.getPropertyValue("lineSpacingType")},set:function(e){this.setPropertyValue("lineSpacingType",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textAlignment",{get:function(){return this.getPropertyValue("textAlignment")},set:function(e){this.setPropertyValue("textAlignment",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outlineLevel",{get:function(){return this.getPropertyValue("outlineLevel")},set:function(e){this.setPropertyValue("outlineLevel",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bidi",{get:function(){return this.getPropertyValue("bidi")},set:function(e){this.bidi!==e&&("Left"===this.textAlignment?this.textAlignment="Right":"Right"===this.textAlignment&&(this.textAlignment="Left")),this.setPropertyValue("bidi",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contextualSpacing",{get:function(){return this.getPropertyValue("contextualSpacing")},set:function(e){this.setPropertyValue("contextualSpacing",e)},enumerable:!0,configurable:!0}),e.prototype.getListFormatParagraphFormat=function(i){var n=this.getListPargaraphFormat(i);if(!t.isNullOrUndefined(n))return n.uniqueParagraphFormat.propertiesHash.get(m.getPropertyType(e.uniqueFormatType,i))},e.prototype.getListPargaraphFormat=function(i){if(this.listFormat.listId>-1&&this.listFormat.listLevelNumber>-1){var n=this.listFormat.listLevel,r=m.getPropertyType(e.uniqueFormatType,i);return t.isNullOrUndefined(n)||t.isNullOrUndefined(n.paragraphFormat.uniqueParagraphFormat)||!n.paragraphFormat.uniqueParagraphFormat.propertiesHash.containsKey(r)?void 0:n.paragraphFormat}},e.prototype.getPropertyValue=function(i){if(this.hasValue(i)){a=m.getPropertyType(e.uniqueFormatType,i);if(!t.isNullOrUndefined(this.uniqueParagraphFormat)&&this.uniqueParagraphFormat.propertiesHash.containsKey(a))return this.uniqueParagraphFormat.propertiesHash.get(a)}else{var n=this.getListFormatParagraphFormat(i);if(this.baseStyle instanceof R){for(var r=this,o=this.baseStyle;!t.isNullOrUndefined(o);){var s=void 0;if(this.listFormat.hasValue("listId")||(s=o.paragraphFormat.getListPargaraphFormat(i)),o.paragraphFormat.hasValue(i)){r=o.paragraphFormat;break}if(!t.isNullOrUndefined(s)&&s.hasValue(i)){r=s;break}o=o.basedOn}if(!t.isNullOrUndefined(o)){if(!t.isNullOrUndefined(n)&&-1!==this.listFormat.listId&&-1===r.listFormat.listId||!t.isNullOrUndefined(n)&&this.listFormat.listId!==r.listFormat.listId)return n;var a=m.getPropertyType(e.uniqueFormatType,i);return r.uniqueParagraphFormat.propertiesHash.get(a)}}if(!t.isNullOrUndefined(n))return n}return this.getDefaultValue(i)},e.prototype.getDefaultValue=function(i){var n=m.getPropertyType(e.uniqueFormatType,i),r=this.documentParagraphFormat(),o=!0;if(this.ownerBase&&this.ownerBase instanceof fe&&(o=this.ownerBase.containerWidget instanceof pe||this.ownerBase.containerWidget instanceof be),o&&!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(r.uniqueParagraphFormat)){var s=r.uniqueParagraphFormat.propertiesHash.get(n);if(!t.isNullOrUndefined(s))return s}return e.getPropertyDefaultValue(i)},e.prototype.documentParagraphFormat=function(){var e;if(!t.isNullOrUndefined(this.ownerBase)){var i=this.ownerBase.bodyWidget;t.isNullOrUndefined(i)||t.isNullOrUndefined(i.page)||(e=i.page.documentHelper.paragraphFormat)}return e},e.prototype.setPropertyValue=function(i,n){if((t.isNullOrUndefined(n)||""===n)&&(n=e.getPropertyDefaultValue(i)),t.isNullOrUndefined(this.uniqueParagraphFormat))this.initializeUniqueParagraphFormat(i,n);else{var r=m.getPropertyType(this.uniqueParagraphFormat.uniqueFormatType,i);if(this.uniqueParagraphFormat.propertiesHash.containsKey(r)&&this.uniqueParagraphFormat.propertiesHash.get(r)===n)return;this.uniqueParagraphFormat=e.uniqueParagraphFormats.updateUniqueFormat(this.uniqueParagraphFormat,i,n)}},e.prototype.initializeUniqueParagraphFormat=function(t,i){var n=new g;this.addUniqueParaFormat("leftIndent",t,i,n),this.addUniqueParaFormat("rightIndent",t,i,n),this.addUniqueParaFormat("firstLineIndent",t,i,n),this.addUniqueParaFormat("textAlignment",t,i,n),this.addUniqueParaFormat("beforeSpacing",t,i,n),this.addUniqueParaFormat("afterSpacing",t,i,n),this.addUniqueParaFormat("lineSpacing",t,i,n),this.addUniqueParaFormat("lineSpacingType",t,i,n),this.addUniqueParaFormat("outlineLevel",t,i,n),this.addUniqueParaFormat("bidi",t,i,n),this.addUniqueParaFormat("contextualSpacing",t,i,n),this.uniqueParagraphFormat=e.uniqueParagraphFormats.addUniqueFormat(n,e.uniqueFormatType)},e.prototype.addUniqueParaFormat=function(t,i,n,r){var o=m.getPropertyType(e.uniqueFormatType,t);t===i&&r.add(o,n)},e.getPropertyDefaultValue=function(e){var t=void 0;switch(e){case"leftIndent":case"rightIndent":case"firstLineIndent":t=0;break;case"textAlignment":t="Left";break;case"beforeSpacing":case"afterSpacing":t=0;break;case"lineSpacing":t=1;break;case"lineSpacingType":t="Multiple";break;case"styleName":t="Normal";break;case"outlineLevel":t="BodyText";break;case"bidi":case"contextualSpacing":t=!1}return t},e.prototype.clearFormat=function(){t.isNullOrUndefined(this.listFormat)||this.listFormat.clearFormat(),t.isNullOrUndefined(this.uniqueParagraphFormat)||0!==this.uniqueParagraphFormat.referenceCount||e.uniqueParagraphFormats.remove(this.uniqueParagraphFormat),this.uniqueParagraphFormat=void 0,this.baseStyle=void 0},e.prototype.destroy=function(){if(this.clearFormat(),t.isNullOrUndefined(this.listFormat)||this.listFormat.destroy(),this.listFormat=void 0,void 0!==this.tabs){for(var e=0;e<this.tabs.length;e++)this.tabs[e].destroy();this.tabs=void 0}},e.prototype.copyFormat=function(e){if(!t.isNullOrUndefined(e)&&(t.isNullOrUndefined(e.uniqueParagraphFormat)||this.updateUniqueParagraphFormat(e),t.isNullOrUndefined(e.listFormat)||this.listFormat.copyFormat(e.listFormat),t.isNullOrUndefined(e.baseStyle)||(this.baseStyle=e.baseStyle),!t.isNullOrUndefined(e.tabs)))for(var i=0;i<e.tabs.length;i++)this.tabs[i]=e.tabs[i]},e.prototype.updateUniqueParagraphFormat=function(i){var n=void 0;this.uniqueParagraphFormat&&(n=this.uniqueParagraphFormat.mergeProperties(i.uniqueParagraphFormat),0===this.uniqueParagraphFormat.referenceCount&&(e.uniqueParagraphFormats.remove(this.uniqueParagraphFormat),this.uniqueParagraphFormat=void 0)),this.uniqueParagraphFormat=new m(e.uniqueFormatType),t.isNullOrUndefined(n)&&(n=this.uniqueParagraphFormat.mergeProperties(i.uniqueParagraphFormat)),this.uniqueParagraphFormat=e.uniqueParagraphFormats.addUniqueFormat(n,e.uniqueFormatType)},e.prototype.cloneFormat=function(){var i=new e(void 0);return i.uniqueParagraphFormat=this.uniqueParagraphFormat,i.baseStyle=this.baseStyle,t.isNullOrUndefined(this.listFormat)?i.listFormat=void 0:i.listFormat=this.listFormat.cloneListFormat(),i},e.prototype.hasValue=function(e){if(!t.isNullOrUndefined(this.uniqueParagraphFormat)&&!t.isNullOrUndefined(this.uniqueParagraphFormat.propertiesHash)){var i=m.getPropertyType(this.uniqueParagraphFormat.uniqueFormatType,e);return this.uniqueParagraphFormat.propertiesHash.containsKey(i)}return!1},e.clear=function(){this.uniqueParagraphFormats.clear()},e.prototype.applyStyle=function(e){this.baseStyle=e,this.listFormat.applyStyle(this.baseStyle)},e.prototype.getValue=function(e){return this.hasValue(e)?this.getPropertyValue(e):void 0},e.prototype.mergeFormat=function(e,i){i=!t.isNullOrUndefined(i)&&i,t.isNullOrUndefined(this.getValue("leftIndent"))&&(this.leftIndent=e.getValue("leftIndent")),t.isNullOrUndefined(this.getValue("rightIndent"))&&(this.rightIndent=e.getValue("rightIndent")),t.isNullOrUndefined(this.getValue("firstLineIndent"))&&(this.firstLineIndent=e.getValue("firstLineIndent")),t.isNullOrUndefined(this.getValue("beforeSpacing"))&&(this.beforeSpacing=e.getValue("beforeSpacing")),t.isNullOrUndefined(this.getValue("afterSpacing"))&&(this.afterSpacing=e.getValue("afterSpacing")),t.isNullOrUndefined(this.getValue("lineSpacing"))&&(this.lineSpacing=e.getValue("lineSpacing")),t.isNullOrUndefined(this.getValue("lineSpacingType"))&&(this.lineSpacingType=e.getValue("lineSpacingType")),t.isNullOrUndefined(this.getValue("textAlignment"))&&(this.textAlignment=e.getValue("textAlignment")),t.isNullOrUndefined(this.getValue("outlineLevel"))&&(this.outlineLevel=e.getValue("outlineLevel")),!i&&t.isNullOrUndefined(this.getValue("bidi"))&&(this.bidi=e.getValue("bidi")),t.isNullOrUndefined(this.getValue("contextualSpacing"))&&(this.contextualSpacing=e.getValue("contextualSpacing")),t.isNullOrUndefined(this.listFormat)&&this.listFormat.mergeFormat(e.listFormat)},e.uniqueParagraphFormats=new f,e.uniqueFormatType=3,e}(),T=function(){function e(e){this.uniqueBorderFormat=void 0,this.ownerBase=void 0,this.ownerBase=e}return Object.defineProperty(e.prototype,"color",{get:function(){return this.getPropertyValue("color")},set:function(e){this.setPropertyValue("color",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineStyle",{get:function(){return this.getPropertyValue("lineStyle")},set:function(e){this.setPropertyValue("lineStyle",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this.getPropertyValue("lineWidth")},set:function(e){this.setPropertyValue("lineWidth",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shadow",{get:function(){return this.getPropertyValue("shadow")},set:function(e){this.setPropertyValue("shadow",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"space",{get:function(){return this.getPropertyValue("space")},set:function(e){this.setPropertyValue("space",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasNoneStyle",{get:function(){return this.getPropertyValue("hasNoneStyle")},set:function(e){this.setPropertyValue("hasNoneStyle",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isBorderDefined",{get:function(){return"None"!==this.lineStyle||this.hasNoneStyle&&this.hasValue("hasNoneStyle")},enumerable:!0,configurable:!0}),e.prototype.getPropertyValue=function(i){if(this.hasValue(i)){var n=m.getPropertyType(e.uniqueFormatType,i);if(!t.isNullOrUndefined(this.uniqueBorderFormat)){var r=this.uniqueBorderFormat.propertiesHash.get(n);if(!t.isNullOrUndefined(r))return r}}return e.getPropertyDefaultValue(i)},e.prototype.setPropertyValue=function(i,n){if((t.isNullOrUndefined(n)||""===n)&&(n=e.getPropertyDefaultValue(i)),t.isNullOrUndefined(this.uniqueBorderFormat))this.initializeUniqueBorder(i,n);else{var r=m.getPropertyType(this.uniqueBorderFormat.uniqueFormatType,i);if(this.uniqueBorderFormat.propertiesHash.containsKey(r)&&this.uniqueBorderFormat.propertiesHash.get(r)===n)return;this.uniqueBorderFormat=e.uniqueBorderFormats.updateUniqueFormat(this.uniqueBorderFormat,i,n)}},e.prototype.initializeUniqueBorder=function(t,i){var n=new g;this.addUniqueBorderFormat("color",t,i,n),this.addUniqueBorderFormat("lineStyle",t,i,n),this.addUniqueBorderFormat("lineWidth",t,i,n),this.addUniqueBorderFormat("shadow",t,i,n),this.addUniqueBorderFormat("space",t,i,n),this.addUniqueBorderFormat("hasNoneStyle",t,i,n),this.uniqueBorderFormat=e.uniqueBorderFormats.addUniqueFormat(n,e.uniqueFormatType)},e.prototype.addUniqueBorderFormat=function(t,i,n,r){var o=m.getPropertyType(e.uniqueFormatType,t);t===i&&r.add(o,n)},e.getPropertyDefaultValue=function(e){var t=void 0;switch(e){case"color":t="#000000";break;case"lineStyle":t="None";break;case"lineWidth":t=0;break;case"shadow":t=!1;break;case"space":t=0;break;case"hasNoneStyle":t=!1}return t},e.prototype.getLineWidth=function(){switch(this.lineStyle){case"None":case"Cleared":return 0;case"Triple":case"Double":case"ThinThickSmallGap":case"ThickThinSmallGap":case"ThinThickThinSmallGap":case"ThinThickMediumGap":case"ThickThinMediumGap":case"ThinThickThinMediumGap":case"ThinThickLargeGap":case"ThickThinLargeGap":case"ThinThickThinLargeGap":case"Emboss3D":case"Engrave3D":for(var e=this.getBorderLineWidthArray(this.lineStyle,this.lineWidth),t=0,i=0;i<e.length;i++)t+=e[i];return t;case"Single":case"DashLargeGap":case"DashSmallGap":case"Dot":case"DashDot":case"DashDotDot":case"Thick":return this.lineWidth;case"SingleWavy":return 1.5===this.lineWidth?3:2.5;case"DoubleWavy":return 6.75;case"DashDotStroked":case"Outset":return this.lineWidth}return this.lineWidth},e.prototype.getBorderLineWidthArray=function(e,t){var i=[t];switch(e){case"Double":i=[1,1,1];break;case"ThinThickSmallGap":i=[1,-.75,-.75];break;case"ThickThinSmallGap":i=[-.75,-.75,1];break;case"ThinThickMediumGap":i=[1,.5,.5];break;case"ThickThinMediumGap":i=[.5,.5,1];break;case"ThinThickLargeGap":i=[-1.5,1,-.75];break;case"ThickThinLargeGap":i=[-.75,1,-1.5];break;case"Triple":i=[1,1,1,1,1];break;case"ThinThickThinSmallGap":i=[-.75,-.75,1,-.75,-.75];break;case"ThinThickThinMediumGap":i=[.5,.5,1,.5,.5];break;case"ThinThickThinLargeGap":i=[-.75,1,-1.5,1,-.75];break;case"Emboss3D":case"Engrave3D":i=[.25,0,1,0,.25]}if(1===i.length)return[t];for(var n=0;n<i.length;n++)i[n]>=0?i[n]=i[n]*t:i[n]=Math.abs(i[n]);return i},e.prototype.getBorderWeight=function(){var e=0,t=this.getNumberOfLines(),i=this.getBorderNumber();switch(this.lineStyle){case"Single":case"DashSmallGap":case"DashDot":case"DashDotDot":case"Double":case"Triple":case"ThinThickSmallGap":case"ThickThinSmallGap":case"ThinThickThinSmallGap":case"ThinThickMediumGap":case"ThickThinMediumGap":case"ThinThickThinMediumGap":case"ThinThickLargeGap":case"ThickThinLargeGap":case"ThinThickThinLargeGap":case"SingleWavy":case"DoubleWavy":case"DashDotStroked":case"Emboss3D":case"Engrave3D":case"Outset":case"Inset":case"Thick":e=t*i;break;case"Dot":case"DashLargeGap":e=1}return e},e.prototype.getBorderNumber=function(){var e=0;switch(this.lineStyle){case"Single":e=1;break;case"Thick":e=2;break;case"Double":e=3;break;case"Dot":e=4;break;case"DashLargeGap":e=5;break;case"DashDot":e=6;break;case"DashDotDot":e=7;break;case"Triple":e=8;break;case"ThinThickSmallGap":e=9;break;case"ThickThinSmallGap":e=10;break;case"ThinThickThinSmallGap":e=11;break;case"ThinThickMediumGap":e=12;break;case"ThickThinMediumGap":e=13;break;case"ThinThickThinMediumGap":e=14;break;case"ThinThickLargeGap":e=15;break;case"ThickThinLargeGap":e=16;break;case"ThinThickThinLargeGap":e=17;break;case"SingleWavy":e=18;break;case"DoubleWavy":e=19;break;case"DashSmallGap":e=20;break;case"DashDotStroked":e=21;break;case"Emboss3D":e=22;break;case"Engrave3D":e=23;break;case"Outset":e=24;break;case"Inset":e=25}return e},e.prototype.getNumberOfLines=function(){var e=0;switch(this.lineStyle){case"Single":case"Dot":case"DashSmallGap":case"DashLargeGap":case"DashDot":case"DashDotDot":e=1;break;case"Double":e=3;break;case"Triple":e=5;break;case"ThinThickSmallGap":case"ThickThinSmallGap":e=3;break;case"ThinThickThinSmallGap":e=5;break;case"ThinThickMediumGap":case"ThickThinMediumGap":e=3;break;case"ThinThickThinMediumGap":e=5;break;case"ThinThickLargeGap":case"ThickThinLargeGap":e=3;break;case"ThinThickThinLargeGap":e=5;break;case"SingleWavy":e=1;break;case"DoubleWavy":e=2;break;case"DashDotStroked":e=1;break;case"Emboss3D":case"Engrave3D":e=3;break;case"Outset":case"Inset":case"Thick":e=1}return e},e.prototype.getPrecedence=function(){var e=0;switch(this.lineStyle){case"Single":e=1;break;case"Thick":e=2;break;case"Double":e=3;break;case"Dot":e=4;break;case"DashLargeGap":e=5;break;case"DashDot":e=6;break;case"DashDotDot":e=7;break;case"Triple":e=8;break;case"ThinThickSmallGap":e=9;break;case"ThickThinSmallGap":e=10;break;case"ThinThickThinSmallGap":e=11;break;case"ThinThickMediumGap":e=12;break;case"ThickThinMediumGap":e=13;break;case"ThinThickThinMediumGap":e=14;break;case"ThinThickLargeGap":e=15;break;case"ThickThinLargeGap":e=16;break;case"ThinThickThinLargeGap":e=17;break;case"SingleWavy":e=18;break;case"DoubleWavy":e=19;break;case"DashSmallGap":e=20;break;case"DashDotStroked":e=21;break;case"Emboss3D":e=22;break;case"Engrave3D":e=23;break;case"Outset":e=24;break;case"Inset":e=25}return e},e.prototype.hasValue=function(e){if(!t.isNullOrUndefined(this.uniqueBorderFormat)){var i=m.getPropertyType(this.uniqueBorderFormat.uniqueFormatType,e);return this.uniqueBorderFormat.propertiesHash.containsKey(i)}return!1},e.prototype.cloneFormat=function(){var t=new e(void 0);return t.color=this.color,t.lineStyle=this.lineStyle,t.lineWidth=this.lineWidth,t.shadow=this.shadow,t.space=this.space,t},e.prototype.destroy=function(){t.isNullOrUndefined(this.uniqueBorderFormat)||e.uniqueBorderFormats.remove(this.uniqueBorderFormat),this.uniqueBorderFormat=void 0},e.prototype.copyFormat=function(e){t.isNullOrUndefined(e)||t.isNullOrUndefined(e.uniqueBorderFormat)||(e.hasValue("color")&&(this.color=e.color),e.hasValue("lineStyle")&&(this.lineStyle=e.lineStyle),e.hasValue("lineWidth")&&(this.lineWidth=e.lineWidth),e.hasValue("shadow")&&(this.shadow=e.shadow),e.hasValue("space")&&(this.space=e.space))},e.clear=function(){this.uniqueBorderFormats.clear()},e.uniqueBorderFormats=new f,e.uniqueFormatType=1,e}(),S=function(){function e(e){this.leftIn=new T(this),this.rightIn=new T(this),this.topIn=new T(this),this.bottomIn=new T(this),this.horizontalIn=new T(this),this.verticalIn=new T(this),this.diagonalUpIn=new T(this),this.diagonalDownIn=new T(this),this.lineWidthIn=0,this.ownerBase=e}return Object.defineProperty(e.prototype,"left",{get:function(){return this.leftIn},set:function(e){this.leftIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"right",{get:function(){return this.rightIn},set:function(e){this.rightIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"top",{get:function(){return this.topIn},set:function(e){this.topIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bottom",{get:function(){return this.bottomIn},set:function(e){this.bottomIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"horizontal",{get:function(){return this.horizontalIn},set:function(e){this.horizontalIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vertical",{get:function(){return this.verticalIn},set:function(e){this.verticalIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"diagonalUp",{get:function(){return this.diagonalUpIn},set:function(e){this.diagonalUpIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"diagonalDown",{get:function(){return this.diagonalDownIn},set:function(e){this.diagonalDownIn=e},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){t.isNullOrUndefined(this.left)||this.left.destroy(),t.isNullOrUndefined(this.top)||this.top.destroy(),t.isNullOrUndefined(this.bottom)||this.bottom.destroy(),t.isNullOrUndefined(this.right)||this.right.destroy(),t.isNullOrUndefined(this.horizontal)||this.horizontal.destroy(),t.isNullOrUndefined(this.vertical)||this.vertical.destroy(),t.isNullOrUndefined(this.diagonalDown)||this.diagonalDown.destroy(),t.isNullOrUndefined(this.diagonalUp)||this.diagonalUp.destroy(),this.topIn=void 0,this.bottomIn=void 0,this.leftIn=void 0,this.rightIn=void 0,this.horizontalIn=void 0,this.verticalIn=void 0,this.diagonalDownIn=void 0,this.diagonalUpIn=void 0,this.lineWidthIn=void 0,this.valueIn=void 0},e.prototype.cloneFormat=function(){var i=new e(void 0);return i.top=t.isNullOrUndefined(this.top)?void 0:this.top.cloneFormat(),i.bottom=t.isNullOrUndefined(this.bottom)?void 0:this.bottom.cloneFormat(),i.left=t.isNullOrUndefined(this.left)?void 0:this.left.cloneFormat(),i.right=t.isNullOrUndefined(this.right)?void 0:this.right.cloneFormat(),i.horizontal=t.isNullOrUndefined(this.horizontal)?void 0:this.horizontal.cloneFormat(),i.vertical=t.isNullOrUndefined(this.vertical)?void 0:this.vertical.cloneFormat(),i.diagonalUp=t.isNullOrUndefined(this.diagonalUp)?void 0:this.diagonalUp.cloneFormat(),i.diagonalDown=t.isNullOrUndefined(this.diagonalDown)?void 0:this.diagonalDown.cloneFormat(),i},e.prototype.copyFormat=function(e){!t.isNullOrUndefined(e.left)&&e.left instanceof T&&(this.left=new T(this),this.left.copyFormat(e.left)),!t.isNullOrUndefined(e.right)&&e.right instanceof T&&(this.right=new T(this),this.right.copyFormat(e.right)),!t.isNullOrUndefined(e.top)&&e.top instanceof T&&(this.top=new T(this),this.top.copyFormat(e.top)),!t.isNullOrUndefined(e.bottom)&&e.bottom instanceof T&&(this.bottom=new T(this),this.bottom.copyFormat(e.bottom)),!t.isNullOrUndefined(e.horizontal)&&e.horizontal instanceof T&&(this.horizontal=new T(this),this.horizontal.copyFormat(e.horizontal)),!t.isNullOrUndefined(e.vertical)&&e.vertical instanceof T&&(this.vertical=new T(this),this.vertical.copyFormat(e.vertical)),!t.isNullOrUndefined(e.diagonalDown)&&e.diagonalDown instanceof T&&(this.diagonalDown=new T(this),this.diagonalDown.copyFormat(e.diagonalDown)),!t.isNullOrUndefined(e.diagonalUp)&&e.diagonalUp instanceof T&&(this.diagonalUp=new T(this),this.diagonalUp.copyFormat(e.diagonalUp))},e}(),I=function(){function e(e){this.uniqueRowFormat=void 0,this.borders=new S(this),this.ownerBase=void 0,this.beforeWidth=0,this.afterWidth=0,this.revisions=[],this.removedIds=[],this.ownerBase=e}return Object.defineProperty(e.prototype,"gridBefore",{get:function(){return this.getPropertyValue("gridBefore")},set:function(e){this.setPropertyValue("gridBefore",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"gridBeforeWidth",{get:function(){return this.getPropertyValue("gridBeforeWidth")},set:function(e){this.setPropertyValue("gridBeforeWidth",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"gridBeforeWidthType",{get:function(){return this.getPropertyValue("gridBeforeWidthType")},set:function(e){this.setPropertyValue("gridBeforeWidthType",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"gridAfter",{get:function(){return this.getPropertyValue("gridAfter")},set:function(e){this.setPropertyValue("gridAfter",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"gridAfterWidth",{get:function(){return this.getPropertyValue("gridAfterWidth")},set:function(e){this.setPropertyValue("gridAfterWidth",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"gridAfterWidthType",{get:function(){return this.getPropertyValue("gridAfterWidthType")},set:function(e){this.setPropertyValue("gridAfterWidthType",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"allowBreakAcrossPages",{get:function(){return this.getPropertyValue("allowBreakAcrossPages")},set:function(e){this.setPropertyValue("allowBreakAcrossPages",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isHeader",{get:function(){return this.getPropertyValue("isHeader")},set:function(e){this.setPropertyValue("isHeader",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightMargin",{get:function(){return this.getPropertyValue("rightMargin")},set:function(e){this.setPropertyValue("rightMargin",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.getPropertyValue("height")},set:function(e){0!==e||"AtLeast"!==this.heightType&&"Exactly"!==this.heightType?"Auto"===this.heightType&&(e=0):e=1,this.setPropertyValue("height",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"heightType",{get:function(){return this.getPropertyValue("heightType")},set:function(e){this.height="AtLeast"===e||"Exactly"===e?1:0,this.setPropertyValue("heightType",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bottomMargin",{get:function(){return this.getPropertyValue("bottomMargin")},set:function(e){this.setPropertyValue("bottomMargin",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leftIndent",{get:function(){return this.getPropertyValue("leftIndent")},set:function(e){this.setPropertyValue("leftIndent",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"topMargin",{get:function(){return this.getPropertyValue("topMargin")},set:function(e){this.setPropertyValue("topMargin",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leftMargin",{get:function(){return this.getPropertyValue("leftMargin")},set:function(e){this.setPropertyValue("leftMargin",e)},enumerable:!0,configurable:!0}),e.prototype.getPropertyValue=function(i){if(this.hasValue(i)){var n=m.getPropertyType(e.uniqueFormatType,i);if(!t.isNullOrUndefined(this.uniqueRowFormat)&&this.uniqueRowFormat.propertiesHash.containsKey(n))return this.uniqueRowFormat.propertiesHash.get(n)}return e.getPropertyDefaultValue(i)},e.prototype.setPropertyValue=function(i,n){if((t.isNullOrUndefined(n)||""===n)&&(n=e.getPropertyDefaultValue(i)),t.isNullOrUndefined(this.uniqueRowFormat))this.initializeUniqueRowFormat(i,n);else{var r=m.getPropertyType(this.uniqueRowFormat.uniqueFormatType,i);if(this.uniqueRowFormat.propertiesHash.containsKey(r)&&this.uniqueRowFormat.propertiesHash.get(r)===n)return;this.uniqueRowFormat=e.uniqueRowFormats.updateUniqueFormat(this.uniqueRowFormat,i,n)}},e.prototype.initializeUniqueRowFormat=function(t,i){var n=new g;this.addUniqueRowFormat("allowBreakAcrossPages",t,i,n),this.addUniqueRowFormat("isHeader",t,i,n),this.addUniqueRowFormat("height",t,i,n),this.addUniqueRowFormat("heightType",t,i,n),this.addUniqueRowFormat("gridBefore",t,i,n),this.addUniqueRowFormat("gridBeforeWidth",t,i,n),this.addUniqueRowFormat("gridBeforeWidthType",t,i,n),this.addUniqueRowFormat("gridAfter",t,i,n),this.addUniqueRowFormat("gridAfterWidth",t,i,n),this.addUniqueRowFormat("gridgridAfterWidth",t,i,n),this.addUniqueRowFormat("gridBeforeWidthType",t,i,n),this.addUniqueRowFormat("leftMargin",t,i,n),this.addUniqueRowFormat("rightMargin",t,i,n),this.addUniqueRowFormat("topMargin",t,i,n),this.addUniqueRowFormat("bottomMargin",t,i,n),this.addUniqueRowFormat("leftIndent",t,i,n),this.uniqueRowFormat=e.uniqueRowFormats.addUniqueFormat(n,e.uniqueFormatType)},e.prototype.addUniqueRowFormat=function(t,i,n,r){var o=m.getPropertyType(e.uniqueFormatType,t);t===i&&r.add(o,n)},e.getPropertyDefaultValue=function(e){var t=void 0;switch(e){case"allowBreakAcrossPages":t=!0;break;case"isHeader":t=!1;break;case"height":t=0;break;case"heightType":t="Auto";break;case"gridBefore":case"gridBeforeWidth":t=0;break;case"gridBeforeWidthType":t="Point";break;case"gridAfter":case"gridAfterWidth":t=0;break;case"gridAfterWidthType":t="Point";break;case"leftMargin":case"topMargin":case"bottomMargin":case"rightMargin":t=void 0;break;case"leftIndent":t=0}return t},e.prototype.containsMargins=function(){return!(t.isNullOrUndefined(this.leftMargin)&&t.isNullOrUndefined(this.rightMargin)&&t.isNullOrUndefined(this.bottomMargin)&&t.isNullOrUndefined(this.topMargin))},e.prototype.cloneFormat=function(){var t=new e;return t.allowBreakAcrossPages=this.allowBreakAcrossPages,t.heightType=this.heightType,t.height=this.height,t.isHeader=this.isHeader,t.gridBefore=this.gridBefore,t.gridBeforeWidth=this.gridBeforeWidth,t.gridBeforeWidthType=this.gridBeforeWidthType,t.gridAfter=this.gridAfter,t.gridAfterWidth=this.gridAfterWidth,t.gridAfterWidthType=this.gridAfterWidthType,t.leftMargin=this.leftMargin,t.rightMargin=this.rightMargin,t.topMargin=this.topMargin,t.bottomMargin=this.bottomMargin,t.leftIndent=this.leftIndent,this.revisions.length>0?t.removedIds=N.cloneRevisions(this.revisions):t.removedIds=this.removedIds.slice(),t},e.prototype.hasValue=function(e){if(!t.isNullOrUndefined(this.uniqueRowFormat)){var i=m.getPropertyType(this.uniqueRowFormat.uniqueFormatType,e);return this.uniqueRowFormat.propertiesHash.containsKey(i)}return!1},e.prototype.copyFormat=function(e){t.isNullOrUndefined(e)||(t.isNullOrUndefined(e.uniqueRowFormat)||(this.allowBreakAcrossPages=e.allowBreakAcrossPages,this.isHeader=e.isHeader,this.heightType=e.heightType,this.height=e.height,this.gridBefore=e.gridBefore,this.gridBeforeWidth=e.gridBeforeWidth,this.gridBeforeWidthType=e.gridBeforeWidthType,this.gridAfter=e.gridAfter,this.gridAfterWidth=e.gridAfterWidth,this.gridAfterWidthType=e.gridAfterWidthType,this.leftMargin=e.leftMargin,this.topMargin=e.topMargin,this.rightMargin=e.rightMargin,this.bottomMargin=e.bottomMargin,this.leftIndent=e.leftIndent),t.isNullOrUndefined(e.borders)||(this.borders=new S(this),this.borders.ownerBase=e,this.borders.copyFormat(e.borders)),e.revisions.length>0?this.removedIds=N.cloneRevisions(e.revisions):this.removedIds=e.removedIds.slice())},e.prototype.destroy=function(){t.isNullOrUndefined(this.borders)||this.borders.destroy(),t.isNullOrUndefined(this.uniqueRowFormat)||e.uniqueRowFormats.remove(this.uniqueRowFormat),this.beforeWidth=void 0,this.afterWidth=void 0,this.borders=void 0,this.uniqueRowFormat=void 0},e.clear=function(){this.uniqueRowFormats.clear()},e.uniqueRowFormats=new f,e.uniqueFormatType=6,e}(),N=function(){function e(e,t,i){this.author=null,this.date=null,this.range=[],this.revisionID="",this.isContentRemoved=!1,this.isTableRevision=!1,this.canSkipTableItems=!1,this.skipUnLinkElement=!1,this.author=t,this.date=i,this.owner=e}return e.prototype.handleAcceptReject=function(e){this.owner.selection.selectRevision(this);var t=this.owner.selection,i=t.start,n=t.end;t.start.isExistBefore(t.end)||(i=t.end,n=t.start);var r=t.getParagraphInfo(i);if(this.owner.editor.initHistory(e?"Accept Change":"Reject Change"),"Deletion"===this.revisionType?(r=t.getParagraphInfo(this.owner.selection.start),t.editPosition=this.owner.selection.getHierarchicalIndex(r.paragraph,r.offset.toString())):t.editPosition=this.owner.selection.getHierarchicalIndex(r.paragraph,r.offset.toString()),this.owner.editor.updateInsertPosition(),this.isContentRemoved=!1,this.canSkipTableItems=!1,this.skipUnLinkElement=!1,"Insertion"===this.revisionType||"Deletion"===this.revisionType||"MoveFrom"===this.revisionType||"MoveTo"===this.revisionType)for(var o=0;this.range.length>0&&(this.range[o]instanceof Ce||this.range[o]instanceof H||this.range[o]instanceof I);)this.unlinkRangeItem(this.range[o],this,e)?o++:o=0;if(this.isTableRevision=!1,this.isContentRemoved){var s=t.getTextPosBasedOnLogicalIndex(t.editPosition);this.owner.selection.selectContent(s,!0),this.owner.editor.updateEndPosition()}else t.selectRange(i,n),this.owner.editor.updateHistoryPosition(n,!1);if(this.owner.editorHistory&&"BackSpace"!==this.owner.editorHistory.currentBaseHistoryInfo.action&&this.owner.editorHistory.currentBaseHistoryInfo.removedNodes.reverse(),this.owner.editorHistory){this.owner.trackChangesPane.isTrackingPageBreak&&(this.owner.editorHistory.currentBaseHistoryInfo.action="TrackingPageBreak");var a=this.owner.editorHistory;!a.currentHistoryInfo||"Accept All"!==a.currentHistoryInfo.action&&"Reject All"!==a.currentHistoryInfo.action||this.owner.documentHelper.blockToShift&&this.owner.documentHelper.layout.shiftLayoutedItems(!1),a.updateHistory()}this.owner.editor.reLayout(this.owner.selection)},e.prototype.accept=function(){this.handleAcceptReject(!0)},e.prototype.reject=function(){this.handleAcceptReject(!1)},e.prototype.unlinkRangeItem=function(e,i,n){if(this.isTableRevision)return this.removeRangeRevisionForItem(e),0===i.range.length&&this.owner.revisions.remove(i),!1;var r=!t.isNullOrUndefined(n)&&("MoveFrom"===i.revisionType||"Deletion"===i.revisionType)&&n||("Insertion"===i.revisionType||"MoveTo"===i.revisionType)&&!n;if(this.owner.selection.isTOC()){if(r)this.owner.editor.deleteSelectedContents(this.owner.selection,!0),0===i.range.length&&this.owner.revisions.remove(i),this.isContentRemoved=!0,this.owner.editorHistory.currentBaseHistoryInfo.action="BackSpace";else{for(;this.range.length>0;){var o=this.range[0];this.removeRangeRevisionForItem(o),0===i.range.length&&this.owner.revisions.remove(i)}this.owner.editor.addRemovedNodes(this.revisionID),this.owner.editorHistory.currentBaseHistoryInfo.action="AcceptTOC"}return!1}if(e instanceof Ce&&!this.canSkipTableItems)if(r){if(this.skipeElementRemoval(e))return this.skipUnLinkElement=!0,!0;this.owner.editor.addRemovedNodes(e.clone())}else this.owner.editorHistory.currentBaseHistoryInfo.action="ClearRevisions",this.updateRevisionID();else if(!this.canSkipTableItems&&e instanceof H&&!r)this.owner.editorHistory.currentBaseHistoryInfo.action="ClearRevisions",this.updateRevisionID();else if(e instanceof I&&!r){this.isTableRevision=!0;var s=e.ownerBase.ownerTable,a=e.ownerBase;this.owner.editorHistory.currentBaseHistoryInfo.action="RemoveRowTrack",this.owner.editor.cloneTableToHistoryInfo(s)}if(r=r&&!this.canSkipTableItems,e instanceof Ce&&r){var l=e.line.paragraph;this.removeRevisionItemsFromRange(e),this.removeItem(e),this.isContentRemoved=!0,this.owner.documentHelper.layout.reLayoutParagraph(l,0,0)}else if(e instanceof H&&r){if(this.isContentRemoved=!0,this.skipUnLinkElement=!1,this.removeRevisionItemsFromRange(e),1===i.range.length)this.owner.editor.deleteSelectedContents(this.owner.selection,!0);else{this.owner.editor.deleteSelectedContents(this.owner.selection,!0);var d=i.range.indexOf(e);for(i.range.splice(d,1);this.range.length>0;)this.removeRangeRevisionForItem(this.range[0])}this.owner.editorHistory.currentBaseHistoryInfo.action="BackSpace"}else if(e instanceof I&&r){var s=e.ownerBase.ownerTable,a=e.ownerBase;this.removeRevisionItemsFromRange(e),this.owner.editorHistory.currentBaseHistoryInfo.action="DeleteCells",this.owner.editor.cloneTableToHistoryInfo(s),this.owner.editor.removeDeletedCellRevision(a),this.isContentRemoved=!0,s.removeChild(s.childWidgets.indexOf(a)),this.canSkipTableItems=!0,a.destroy(),0===s.childWidgets.length?(this.owner.selection.editPosition=this.owner.selection.getHierarchicalIndex(s,"0"),this.owner.editor.removeBlock(s),s.destroy()):this.owner.editor.updateTable(s)}return e instanceof I&&r||this.skipUnLinkElement||this.removeRangeRevisionForItem(e),0===i.range.length&&this.owner.revisions.remove(i),!1},e.prototype.updateRevisionID=function(){for(this.owner.editor.addRemovedNodes(this.revisionID);this.range.length>0;)this.removeRangeRevisionForItem(this.range[0])},e.prototype.removeRevisionItemsFromRange=function(e){if(e.revisions.length>0)for(var t=0;t<e.revisions.length;t++){var i=e.revisions[t];if(this.revisionID!==i.revisionID){var n=i.range.indexOf(e);e.revisions[t].range.splice(n,1)}0===i.range.length&&this.owner.revisions.remove(i)}},e.prototype.removeRangeRevisionForItem=function(e){var t=e.revisions.indexOf(this);if(t>=0){e.revisions.splice(t,1);var i=this.range.indexOf(e);this.range.splice(i,1)}},e.prototype.skipeElementRemoval=function(e){var t=e.paragraph;if(t.characterFormat.revisions.length>0)for(var i=0;i<t.characterFormat.revisions.length;i++)if(t.characterFormat.revisions[i].range.indexOf(e)>=0)return!0;return!1},e.prototype.removeRevisionFromRow=function(e){this.owner.editor.unlinkRangeFromRevision(e.rowFormat);for(var t=0;t<e.childWidgets.length;t++){var i=e.childWidgets[t];this.owner.editor.removeRevisionForCell(i,!1)}},e.prototype.removeItem=function(e){var t=e.line.paragraph;this.owner.editor.unLinkFieldCharacter(e);var i=e.line.children.indexOf(e);e.line.children.splice(i,1),this.owner.editor.removeEmptyLine(t)},e.prototype.canSkipCloning=function(){return!(t.isNullOrUndefined(this.owner)||!this.owner.editorHistory||!this.owner.editorHistory.currentBaseHistoryInfo||"DeleteCells"!==this.owner.editorHistory.currentBaseHistoryInfo.action)},e.prototype.clone=function(){if(this.canSkipCloning())return this;var t=new e(void 0,this.author,this.date);return t.revisionID=this.revisionID,t.revisionType=this.revisionType,t},e.cloneRevisions=function(e){for(var t=[],i=0;i<e.length;i++)t.push(e[i].revisionID);return t},e}(),E=function(){function e(e){this.changes=[],this.owner=e}return e.prototype.get=function(e){if(e>=this.changes.length||e<0)throw new ReferenceError("Provided index is not within the range");return this.changes[e]},Object.defineProperty(e.prototype,"length",{get:function(){return this.changes.length},enumerable:!0,configurable:!0}),e.prototype.remove=function(e){t.isNullOrUndefined(e)||this.changes.indexOf(e)<0||this.changes.splice(this.changes.indexOf(e),1)},e.prototype.acceptAll=function(){this.handleRevisionCollection(!0)},e.prototype.rejectAll=function(){this.handleRevisionCollection(!1)},e.prototype.handleRevisionCollection=function(e,t){var i=this.owner.selection,n=i.start,r=i.end;i.start.isExistBefore(i.end)||(n=i.end,r=i.start),n=n.clone(),r=r.clone(),e?this.owner.editor.initComplexHistory("Accept All"):this.owner.editor.initComplexHistory("Reject All");for(var o=t||this.changes;o.length>0;)e?o[0].accept():o[0].reject(),t&&o.splice(0,1);var s=i.getTextPosBasedOnLogicalIndex(i.editPosition);this.owner.selection.selectContent(s,!0),this.owner.editorHistory&&this.owner.editorHistory.updateComplexHistory(),this.owner.editor.reLayout(this.owner.selection,!1)},e.prototype.destroy=function(){this.changes=[]},e}(),H=function(){function e(e){this.uniqueCharacterFormat=void 0,this.ownerBase=void 0,this.baseCharStyle=void 0,this.removedIds=[],this.revisions=[],this.ownerBase=e}return Object.defineProperty(e.prototype,"bold",{get:function(){return this.getPropertyValue("bold")},set:function(e){this.setPropertyValue("bold",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"italic",{get:function(){return this.getPropertyValue("italic")},set:function(e){this.setPropertyValue("italic",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontSize",{get:function(){return this.getPropertyValue("fontSize")},set:function(e){this.setPropertyValue("fontSize",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontFamily",{get:function(){return this.getPropertyValue("fontFamily")},set:function(e){this.setPropertyValue("fontFamily",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"underline",{get:function(){return this.getPropertyValue("underline")},set:function(e){this.setPropertyValue("underline",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"strikethrough",{get:function(){return this.getPropertyValue("strikethrough")},set:function(e){this.setPropertyValue("strikethrough",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"baselineAlignment",{get:function(){return this.getPropertyValue("baselineAlignment")},set:function(e){this.setPropertyValue("baselineAlignment",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"highlightColor",{get:function(){return this.getPropertyValue("highlightColor")},set:function(e){this.setPropertyValue("highlightColor",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontColor",{get:function(){return this.getPropertyValue("fontColor")},set:function(e){this.setPropertyValue("fontColor",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bidi",{get:function(){return this.getPropertyValue("bidi")},set:function(e){this.setPropertyValue("bidi",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bdo",{get:function(){return this.getPropertyValue("bdo")},set:function(e){this.setPropertyValue("bdo",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"boldBidi",{get:function(){return this.getPropertyValue("boldBidi")},set:function(e){this.setPropertyValue("boldBidi",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"italicBidi",{get:function(){return this.getPropertyValue("italicBidi")},set:function(e){this.setPropertyValue("italicBidi",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontSizeBidi",{get:function(){return this.getPropertyValue("fontSizeBidi")},set:function(e){this.setPropertyValue("fontSizeBidi",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontFamilyBidi",{get:function(){return this.getPropertyValue("fontFamilyBidi")},set:function(e){this.setPropertyValue("fontFamilyBidi",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"allCaps",{get:function(){return this.getPropertyValue("allCaps")},set:function(e){this.setPropertyValue("allCaps",e)},enumerable:!0,configurable:!0}),e.prototype.getPropertyValue=function(i){if(this.hasValue(i)){var n=m.getPropertyType(e.uniqueFormatType,i);if(!t.isNullOrUndefined(this.uniqueCharacterFormat)&&this.uniqueCharacterFormat.propertiesHash.containsKey(n))return this.uniqueCharacterFormat.propertiesHash.get(n)}else{var r=this.checkCharacterStyle(i);if(!t.isNullOrUndefined(r))return r;if(!t.isNullOrUndefined(this.baseCharStyle)){var o=this.ownerBase.paragraph,s=this.ownerBase.line;if(!t.isNullOrUndefined(o)&&!t.isNullOrUndefined(s))for(var a=s.children.length,l=0;l<a;l++){var d=this.ownerBase.line.children[l];if(d instanceof Ie){var h=d.text;h.startsWith("HYPERLINK")&&-1!==h.indexOf("_Toc")&&(this.baseCharStyle=this.ownerBase.paragraph.paragraphFormat.baseStyle)}}}var c=this.checkBaseStyle(i);if(!t.isNullOrUndefined(c))return c}return this.getDefaultValue(i)},e.prototype.getDefaultValue=function(i){var n=m.getPropertyType(e.uniqueFormatType,i),r=this.documentCharacterFormat();return t.isNullOrUndefined(r)||t.isNullOrUndefined(r.uniqueCharacterFormat)||!r.uniqueCharacterFormat.propertiesHash.containsKey(n)?e.getPropertyDefaultValue(i):r.uniqueCharacterFormat.propertiesHash.get(n)},e.prototype.documentCharacterFormat=function(){var e;return t.isNullOrUndefined(this.ownerBase)||(t.isNullOrUndefined(this.ownerBase.paragraph)||t.isNullOrUndefined(this.ownerBase.paragraph.bodyWidget)?t.isNullOrUndefined(this.ownerBase.bodyWidget)||(e=this.ownerBase.bodyWidget.page.documentHelper.characterFormat):e=this.ownerBase.paragraph.bodyWidget.page.documentHelper.characterFormat),e},e.prototype.checkBaseStyle=function(i){var n;for(t.isNullOrUndefined(this.ownerBase)||(t.isNullOrUndefined(this.ownerBase.paragraph)?this.ownerBase instanceof fe&&!t.isNullOrUndefined(this.ownerBase.paragraphFormat)?n=this.ownerBase.paragraphFormat.baseStyle:t.isNullOrUndefined(this.ownerBase instanceof R)||(n=this.ownerBase.basedOn):n=this.ownerBase.paragraph.paragraphFormat.baseStyle);!t.isNullOrUndefined(n)&&!n.characterFormat.hasValue(i);)n=n.basedOn;if(!t.isNullOrUndefined(n)){var r=m.getPropertyType(e.uniqueFormatType,i);return n.characterFormat.uniqueCharacterFormat.propertiesHash.get(r)}},e.prototype.checkCharacterStyle=function(i){var n=this.baseCharStyle;if(!t.isNullOrUndefined(n))for(;!t.isNullOrUndefined(n)&&"Default Paragraph Font"!==n.name;){if(n.characterFormat.hasValue(i)){var r=m.getPropertyType(e.uniqueFormatType,i);return n.characterFormat.uniqueCharacterFormat.propertiesHash.get(r)}n=n.basedOn}},e.prototype.setPropertyValue=function(i,n){if((t.isNullOrUndefined(n)||""===n)&&(n=e.getPropertyDefaultValue(i)),t.isNullOrUndefined(this.uniqueCharacterFormat))this.initializeUniqueCharacterFormat(i,n);else{var r=m.getPropertyType(this.uniqueCharacterFormat.uniqueFormatType,i);if(this.uniqueCharacterFormat.propertiesHash.containsKey(r)&&this.uniqueCharacterFormat.propertiesHash.get(r)===n)return;this.uniqueCharacterFormat=e.uniqueCharacterFormats.updateUniqueFormat(this.uniqueCharacterFormat,i,n)}},e.prototype.initializeUniqueCharacterFormat=function(t,i){var n=new g;this.addUniqueCharacterFormat("fontColor",t,i,n),this.addUniqueCharacterFormat("fontFamily",t,i,n),this.addUniqueCharacterFormat("fontSize",t,i,n),this.addUniqueCharacterFormat("bold",t,i,n),this.addUniqueCharacterFormat("italic",t,i,n),this.addUniqueCharacterFormat("underline",t,i,n),this.addUniqueCharacterFormat("strikethrough",t,i,n),this.addUniqueCharacterFormat("baselineAlignment",t,i,n),this.addUniqueCharacterFormat("highlightColor",t,i,n),this.addUniqueCharacterFormat("styleName",t,i,n),this.addUniqueCharacterFormat("bidi",t,i,n),this.addUniqueCharacterFormat("bdo",t,i,n),this.addUniqueCharacterFormat("fontFamilyBidi",t,i,n),this.addUniqueCharacterFormat("fontSizeBidi",t,i,n),this.addUniqueCharacterFormat("boldBidi",t,i,n),this.addUniqueCharacterFormat("italicBidi",t,i,n),this.addUniqueCharacterFormat("allCaps",t,i,n),this.uniqueCharacterFormat=e.uniqueCharacterFormats.addUniqueFormat(n,e.uniqueFormatType)},e.prototype.addUniqueCharacterFormat=function(t,i,n,r){var o=m.getPropertyType(e.uniqueFormatType,t);t===i&&r.add(o,n)},e.getPropertyDefaultValue=function(e){var t=void 0;switch(e){case"bold":case"italic":t=!1;break;case"fontSize":t=11;break;case"underline":case"strikethrough":t="None";break;case"baselineAlignment":t="Normal";break;case"highlightColor":t="NoColor";break;case"fontColor":t="empty";break;case"fontFamily":t="Calibri";break;case"styleName":t="Default Paragraph Font";break;case"bidi":t=!1;break;case"bdo":t="None";break;case"boldBidi":case"italicBidi":t=!1;break;case"fontSizeBidi":t=11;break;case"fontFamilyBidi":t="Calibri";break;case"allCaps":t=!1}return t},e.prototype.isEqualFormat=function(e){return this.fontSize===e.fontSize&&this.fontFamily===e.fontFamily&&this.bold===e.bold&&this.italic===e.italic&&this.baselineAlignment===e.baselineAlignment&&this.underline===e.underline&&this.fontColor===e.fontColor&&this.strikethrough===e.strikethrough&&this.highlightColor===e.highlightColor&&this.bidi===e.bidi&&this.bdo===e.bdo&&this.allCaps===e.allCaps},e.prototype.isSameFormat=function(e){return this.baseCharStyle===e.baseCharStyle&&this.uniqueCharacterFormat===e.uniqueCharacterFormat},e.prototype.cloneFormat=function(){var t=new e(void 0);return t.uniqueCharacterFormat=this.uniqueCharacterFormat,t.baseCharStyle=this.baseCharStyle,this.revisions.length>0?t.removedIds=N.cloneRevisions(this.revisions):t.removedIds=this.removedIds.slice(),t},e.prototype.hasValue=function(e){if(!t.isNullOrUndefined(this.uniqueCharacterFormat)&&!t.isNullOrUndefined(this.uniqueCharacterFormat.propertiesHash)){var i=m.getPropertyType(this.uniqueCharacterFormat.uniqueFormatType,e);return this.uniqueCharacterFormat.propertiesHash.containsKey(i)}return!1},e.prototype.clearFormat=function(){t.isNullOrUndefined(this.uniqueCharacterFormat)||0!==this.uniqueCharacterFormat.referenceCount||e.uniqueCharacterFormats.remove(this.uniqueCharacterFormat),this.uniqueCharacterFormat=void 0,this.baseCharStyle=void 0},e.prototype.destroy=function(){this.clearFormat()},e.prototype.copyFormat=function(e){t.isNullOrUndefined(e)||(!t.isNullOrUndefined(e.uniqueCharacterFormat)&&e.uniqueCharacterFormat.propertiesHash&&this.updateUniqueCharacterFormat(e),t.isNullOrUndefined(e.baseCharStyle)||(this.baseCharStyle=e.baseCharStyle),e.revisions.length>0?this.removedIds=N.cloneRevisions(e.revisions):this.removedIds=e.removedIds.slice())},e.prototype.updateUniqueCharacterFormat=function(i){var n=void 0;this.uniqueCharacterFormat&&(n=this.uniqueCharacterFormat.mergeProperties(i.uniqueCharacterFormat),0===this.uniqueCharacterFormat.referenceCount&&(e.uniqueCharacterFormats.remove(this.uniqueCharacterFormat),this.uniqueCharacterFormat=void 0)),this.uniqueCharacterFormat=new m(e.uniqueFormatType),t.isNullOrUndefined(n)&&(n=this.uniqueCharacterFormat.mergeProperties(i.uniqueCharacterFormat)),this.uniqueCharacterFormat=e.uniqueCharacterFormats.addUniqueFormat(n,e.uniqueFormatType)},e.clear=function(){this.uniqueCharacterFormats.clear()},e.prototype.applyStyle=function(e){this.baseCharStyle=e},e.prototype.getValue=function(e){return this.hasValue(e)?this.getPropertyValue(e):void 0},e.prototype.mergeFormat=function(e){t.isNullOrUndefined(this.getValue("bold"))&&(this.bold=e.getValue("bold")),t.isNullOrUndefined(this.getValue("italic"))&&(this.italic=e.getValue("italic")),t.isNullOrUndefined(this.getValue("fontSize"))&&(this.fontSize=e.getValue("fontSize")),t.isNullOrUndefined(this.getValue("fontFamily"))&&(this.fontFamily=e.getValue("fontFamily")),t.isNullOrUndefined(this.getValue("underline"))&&(this.underline=e.getValue("underline")),t.isNullOrUndefined(this.getValue("strikethrough"))&&(this.strikethrough=e.getValue("strikethrough")),t.isNullOrUndefined(this.getValue("baselineAlignment"))&&(this.baselineAlignment=e.getValue("baselineAlignment")),t.isNullOrUndefined(this.getValue("highlightColor"))&&(this.highlightColor=e.getValue("highlightColor")),t.isNullOrUndefined(this.getValue("fontColor"))&&(this.fontColor=e.getValue("fontColor")),t.isNullOrUndefined(this.getValue("bidi"))&&(this.bidi=e.getValue("bidi")),t.isNullOrUndefined(this.getValue("bdo"))&&(this.bdo=e.getValue("bdo")),t.isNullOrUndefined(this.getValue("allCaps"))&&(this.allCaps=e.getValue("allCaps"))},e.uniqueCharacterFormats=new f,e.uniqueFormatType=2,e}(),W=function(){function e(){}return e.insert=function(e,t,i){return t>=0?[e.slice(0,t)+i+e.slice(t)].join(""):i+this},e.remove=function(e,t){return 0===t?e.substring(t+1,e.length):e.substring(0,t)+e.substring(t+1,e.length)},e.indexOfAny=function(e,i){for(var n=void 0,r=0;r<i.length;r++){var o=e.indexOf(i[r]);-1!==o&&t.isNullOrUndefined(n)?n=o:-1!==o&&o<n&&(n=o)}return t.isNullOrUndefined(n)?-1:n},e.lastIndexOfAny=function(e,t){for(var i=e.length-1;i>=0;i--)for(var n=0;n<=t.length-1;n++)if(e[i]===t[n])return i;return-1},e.addCssStyle=function(e){var t=document.createElement("style");t.style.cssText?t.style.cssText=e:t.appendChild(document.createTextNode(e)),document.getElementsByTagName("head")[0].appendChild(t)},e.getHighlightColorCode=function(e){var t="#ffffff";switch(e){case"Yellow":t="#ffff00";break;case"BrightGreen":t="#00ff00";break;case"Turquoise":t="#00ffff";break;case"Pink":t="#ff00ff";break;case"Blue":t="#0000ff";break;case"Red":t="#ff0000";break;case"DarkBlue":t="#000080";break;case"Teal":t="#008080";break;case"Green":t="#008000";break;case"Violet":t="#800080";break;case"DarkRed":t="#800000";break;case"DarkYellow":t="#808000";break;case"Gray50":t="#808080";break;case"Gray25":t="#c0c0c0";break;case"Black":t="#000000"}return t},e.isVeryDark=function(e){var t=e.substring(1);return(299*parseInt(t.substr(0,2),16)+587*parseInt(t.substr(2,2),16)+114*parseInt(t.substr(4,2),16))/1e3<=60},e.getColor=function(e){return e.length>0&&"#"===e[0]&&e.length>7?e.substr(0,7):e},e.convertPointToPixel=function(t){return e.round(96*t/72,5)},e.convertPixelToPoint=function(t){return e.round(72*t/96,5)},e.isLinkedFieldCharacter=function(e){return e instanceof xe&&0===e.fieldType?!t.isNullOrUndefined(e.fieldEnd):e instanceof xe&&2===e.fieldType?!t.isNullOrUndefined(e.fieldBegin)&&!t.isNullOrUndefined(e.fieldEnd):!t.isNullOrUndefined(e.fieldBegin)},e.removeSpace=function(e){if(!t.isNullOrUndefined(e)&&0!==e.length)for(var i=0;i<e.length;i++)" "===e.charAt(i)&&(e=e.replace(" ",""));return e},e.trimStart=function(e){var t=0;for(t;t<e.length&&" "===e[t];t++);return e.substring(t,e.length)},e.trimEnd=function(e){var t=e.length-1;for(t;t>=0&&" "===e[t];t--);return e.substring(0,t+1)},e.endsWith=function(e){return!t.isNullOrUndefined(e)&&0!==e.length&&" "===e[e.length-1]},e.addSpace=function(e){var t="";if(e>0)for(var i=0;i<e;i++)t+=" ";return t},e.writeCharacterFormat=function(e,i,n){e.bold=i?n.bold:n.getValue("bold"),e.italic=i?n.italic:n.getValue("italic"),e.fontSize=i?this.toWriteInline(n,"fontSize"):n.getValue("fontSize"),e.fontFamily=i?this.toWriteInline(n,"fontFamily"):n.getValue("fontFamily"),e.underline=i?n.underline:n.getValue("underline"),e.strikethrough=i?n.strikethrough:n.getValue("strikethrough"),e.baselineAlignment=i?n.baselineAlignment:n.getValue("baselineAlignment"),e.highlightColor=i?n.highlightColor:n.getValue("highlightColor"),e.fontColor=i?this.toWriteInline(n,"fontColor"):n.getValue("fontColor"),e.styleName=t.isNullOrUndefined(n.baseCharStyle)?void 0:n.baseCharStyle.name,e.bidi=i?n.bidi:n.getValue("bidi"),e.bdo=i?n.bdo:n.getValue("bdo"),e.boldBidi=i?n.boldBidi:n.getValue("boldBidi"),e.italicBidi=i?n.italicBidi:n.getValue("italicBidi"),e.fontSizeBidi=i?n.fontSizeBidi:n.getValue("fontSizeBidi"),e.fontFamilyBidi=i?n.fontFamilyBidi:n.getValue("fontFamilyBidi"),e.allCaps=i?n.allCaps:n.getValue("allCaps")},e.toWriteInline=function(e,i){return!t.isNullOrUndefined(e.ownerBase)&&e.ownerBase instanceof Ce?e.hasValue(i)?e[i]:e.getValue(i):e[i]},e.round=function(e,t){for(var i=e,n=0;n<t;n++)i*=10;i=Math.round(i);for(n=0;n<t;n++)i/=10;return i},e.reverseString=function(e){return t.isNullOrUndefined(e)||""===e||(e=e.split("").reverse().join("")),e},e.formatClippedString=function(e){var t="",i="";return this.startsWith(e,"data:image/bmp;base64,")?(t=".bmp",i=e.replace("data:image/bmp;base64,","")):this.startsWith(e,"data:image/x-emf;base64,")?(t=".emf",i=e.replace("data:image/x-emf;base64,","")):this.startsWith(e,"data:image/exif;base64,")?(t=".exif",i=e.replace("data:image/exif;base64,","")):this.startsWith(e,"data:image/gif;base64,")?(t=".gif",i=e.replace("data:image/gif;base64,","")):this.startsWith(e,"data:image/icon;base64,")?(t=".ico",i=e.replace("data:image/icon;base64,","")):this.startsWith(e,"data:image/jpeg;base64,")?(t=".jpeg",i=e.replace("data:image/jpeg;base64,","")):this.startsWith(e,"data:image/jpg;base64,")?(t=".jpg",i=e.replace("data:image/jpg;base64,","")):this.startsWith(e,"data:image/png;base64,")?(t=".png",i=e.replace("data:image/png;base64,","")):this.startsWith(e,"data:image/tiff;base64,")?(t=".tif",i=e.replace("data:image/tiff;base64,","")):this.startsWith(e,"data:image/x-wmf;base64,")?(t=".wmf",i=e.replace("data:image/x-wmf;base64,","")):t=".jpeg",{extension:t,formatClippedString:i}},e.startsWith=function(e,t){return t.length>0&&e.substring(0,t.length)===t},e.formatText=function(e,t){var i=t;switch(e.toLowerCase()){case"uppercase":i=t.toUpperCase();break;case"lowercase":i=t.toLowerCase();break;case"firstcapital":i=this.capitaliseFirst(t,"FirstCapital");break;case"titlecase":i=this.capitaliseFirst(t,"Titlecase")}return i},e.formatNumber=function(e,i){var n=new t.Internationalization;i=i.split(".")[0];var r=n.parseNumber(i);if("NaN"===i.toString())return"";""===e&&(e="0");var o={format:e};return n.formatNumber(r,o)},e.formatDate=function(e,i){var n=new t.Internationalization,r=new Date(i);if(isNaN(r.getDate()))return"";if(""===e)return i;-1!==e.indexOf("am/pm")&&(e=e.replace(/am\/pm/gi,"a"));var o={format:e};return n.formatDate(r,o)},e.capitaliseFirst=function(e,t,i){var n="";if("Titlecase"===t){for(var r=i?e.split(i):e.split(" "),o=0;o<r.length;o++)n+=i?r[o].charAt(0).toUpperCase()+r[o].slice(1,r[o].length):this.capitaliseFirstInternal(r[o]),r.length>=0&&!i&&(n+=" ");i||(n=this.capitaliseFirst(n,"Titlecase","\r"))}else"FirstCapital"===t&&(n=this.capitaliseFirstInternal(e));return n},e.capitaliseFirstInternal=function(e){return e.charAt(0).toUpperCase()+e.slice(1,e.length).toLowerCase()},e.getModifiedDate=function(e){var t=new Date(e);return t.toLocaleDateString([],{year:"numeric",month:"long",day:"numeric"})+" "+t.toLocaleTimeString([],{hour:"numeric",minute:"numeric"})},e.wordBefore="\\b",e.wordAfter="\\b",e.wordSplitCharacters=[" ",",",".",":",";","<",">","=","+","-","_","{","}","[","]","`","~","!","@","#","$","%","^","&","*","(",")",'"',"?","/","|","\\","”"," ","،","؟","؛","’","‘"],e}(),O=function(){function e(e,t){this.xIn=0,this.yIn=0,this.xIn=e,this.yIn=t}return Object.defineProperty(e.prototype,"x",{get:function(){return this.xIn},set:function(e){this.xIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y",{get:function(){return this.yIn},set:function(e){this.yIn=e},enumerable:!0,configurable:!0}),e.prototype.copy=function(e){this.xIn=e.xIn,this.yIn=e.yIn},e.prototype.destroy=function(){this.xIn=void 0,this.yIn=void 0},e}(),k=function(){function e(){this.keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}return e.prototype.encodeString=function(e){var t,i,n,r,o,s,a,l="",d=0;for(e=this.unicodeEncode(e);d<e.length;)r=(t=e.charCodeAt(d++))>>2,o=(3&t)<<4|(i=e.charCodeAt(d++))>>4,s=(15&i)<<2|(n=e.charCodeAt(d++))>>6,a=63&n,isNaN(i)?s=a=64:isNaN(n)&&(a=64),l=l+this.keyStr.charAt(r)+this.keyStr.charAt(o)+this.keyStr.charAt(s)+this.keyStr.charAt(a);return l},e.prototype.unicodeEncode=function(e){for(var t=e.replace(/\r\n/g,"\n"),i="",n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?i+=String.fromCharCode(r):r>127&&r<2048?(i+=String.fromCharCode(r>>6|192),i+=String.fromCharCode(63&r|128)):(i+=String.fromCharCode(r>>12|224),i+=String.fromCharCode(r>>6&63|128),i+=String.fromCharCode(63&r|128))}return i},e.prototype.decodeString=function(e){var t,i,n,r,o,s,a=0,l=0,d=3*(e=e.replace(/[^A-Za-z0-9+\/=]/g,"")).length/4;if(e.charAt(e.length-1)===this.keyStr.charAt(64)&&d--,e.charAt(e.length-2)===this.keyStr.charAt(64)&&d--,d%1!=0)throw new Error("Invalid base64 input, bad content length.");for(var h=new Uint8Array(0|d);a<e.length;)t=this.keyStr.indexOf(e.charAt(a++))<<2|(r=this.keyStr.indexOf(e.charAt(a++)))>>4,i=(15&r)<<4|(o=this.keyStr.indexOf(e.charAt(a++)))>>2,n=(3&o)<<6|(s=this.keyStr.indexOf(e.charAt(a++))),h[l++]=t,64!==o&&(h[l++]=i),64!==s&&(h[l++]=n);return h},e}(),L=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),B=function(){function e(){}return e}(),R=function(e){function t(t){var i=e.call(this)||this;return i.ownerBase=t,i.paragraphFormat=new P(i),i.characterFormat=new H(i),i}return L(t,e),t.prototype.destroy=function(){this.characterFormat.destroy(),this.paragraphFormat.destroy()},t.prototype.copyStyle=function(e){this.name=e.name,this.ownerBase=e.ownerBase,this.type=e.type,this.next=e.next,this.basedOn=e.basedOn,this.link=e.link,this.characterFormat.copyFormat(e.characterFormat),this.paragraphFormat.copyFormat(e.paragraphFormat)},t}(B),D=function(e){function t(t){var i=e.call(this)||this;return i.ownerBase=t,i.characterFormat=new H(i),i}return L(t,e),t.prototype.destroy=function(){this.characterFormat.destroy()},t.prototype.copyStyle=function(e){this.name=e.name,this.ownerBase=e.ownerBase,this.type=e.type,this.next=e.next,this.basedOn=e.basedOn,this.characterFormat.copyFormat(e.characterFormat)},t}(B),M=function(){function e(){this.collection=[]}return Object.defineProperty(e.prototype,"length",{get:function(){return this.collection.length},enumerable:!0,configurable:!0}),e.prototype.remove=function(e){this.collection=this.collection.filter(function(t){return t.name!==e.name})},e.prototype.push=function(e){return null!=e&&void 0!==e&&this.collection.push(e),1},e.prototype.getItem=function(e){return this.collection.length>e?this.collection[e]:null},e.prototype.indexOf=function(e){return this.collection.indexOf(e)},e.prototype.contains=function(e){var t=this.collection.indexOf(e);return t>-1&&t<this.collection.length},e.prototype.clear=function(){for(;this.collection.length>0;)this.collection.pop()},e.prototype.findByName=function(e,i){for(var n,r=0,o=this.collection;r<o.length;r++){var s=o[r];s.name===e&&(n=s,t.isNullOrUndefined(i)||s.type!==i||(n=s))}return n},e.prototype.getStyleNames=function(e){return this.collection.filter(function(t){return t.type===e}).map(function(e){return e.name})},e.prototype.getStyles=function(e){for(var t=[],i=0,n=this.collection.filter(function(t){return t.type===e}).map(function(e){return e});i<n.length;i++){var r=n[i],o={},s={};s.characterFormat={},W.writeCharacterFormat(s.characterFormat,!0,r.characterFormat),o.name=r.name,o.style=JSON.stringify(s),t.push(o)}return t},e}(),A=function(){function e(e){this.uniqueShadingFormat=void 0,this.ownerBase=void 0,this.ownerBase=e}return Object.defineProperty(e.prototype,"backgroundColor",{get:function(){return this.getPropertyValue("backgroundColor")},set:function(e){this.setPropertyValue("backgroundColor",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"foregroundColor",{get:function(){return this.getPropertyValue("foregroundColor")},set:function(e){this.setPropertyValue("foregroundColor",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textureStyle",{get:function(){return this.getPropertyValue("textureStyle")},set:function(e){this.setPropertyValue("textureStyle",e)},enumerable:!0,configurable:!0}),e.prototype.getPropertyValue=function(i){if(this.hasValue(i)){var n=m.getPropertyType(e.uniqueFormatType,i);if(!t.isNullOrUndefined(this.uniqueShadingFormat)&&this.uniqueShadingFormat.propertiesHash.containsKey(n))return this.uniqueShadingFormat.propertiesHash.get(n)}return e.getPropertyDefaultValue(i)},e.prototype.setPropertyValue=function(i,n){if((t.isNullOrUndefined(n)||""===n)&&(n=e.getPropertyDefaultValue(i)),t.isNullOrUndefined(this.uniqueShadingFormat))this.initializeUniqueShading(i,n);else{var r=m.getPropertyType(this.uniqueShadingFormat.uniqueFormatType,i);if(this.uniqueShadingFormat.propertiesHash.containsKey(r)&&this.uniqueShadingFormat.propertiesHash.get(r)===n)return;this.uniqueShadingFormat=e.uniqueShadingFormats.updateUniqueFormat(this.uniqueShadingFormat,i,n)}},e.getPropertyDefaultValue=function(e){var t=void 0;switch(e){case"backgroundColor":case"foregroundColor":t="empty";break;case"textureStyle":t="TextureNone"}return t},e.prototype.initializeUniqueShading=function(t,i){var n=new g;this.addUniqueShading("backgroundColor",t,i,n),this.addUniqueShading("foregroundColor",t,i,n),this.addUniqueShading("textureStyle",t,i,n),this.uniqueShadingFormat=e.uniqueShadingFormats.addUniqueFormat(n,e.uniqueFormatType)},e.prototype.addUniqueShading=function(t,i,n,r){var o=m.getPropertyType(e.uniqueFormatType,t);t===i?r.add(o,n):r.add(o,e.getPropertyDefaultValue(t))},e.prototype.destroy=function(){t.isNullOrUndefined(this.uniqueShadingFormat)||e.uniqueShadingFormats.remove(this.uniqueShadingFormat),this.uniqueShadingFormat=void 0},e.prototype.cloneFormat=function(){var t=new e(void 0);return t.backgroundColor=this.backgroundColor,t.foregroundColor=this.foregroundColor,t.textureStyle=this.textureStyle,t},e.prototype.copyFormat=function(e){t.isNullOrUndefined(e)||t.isNullOrUndefined(e.uniqueShadingFormat)||(this.backgroundColor=e.backgroundColor,this.foregroundColor=e.foregroundColor,this.textureStyle=e.textureStyle)},e.prototype.hasValue=function(e){if(!t.isNullOrUndefined(this.uniqueShadingFormat)){var i=m.getPropertyType(this.uniqueShadingFormat.uniqueFormatType,e);return this.uniqueShadingFormat.propertiesHash.containsKey(i)}return!1},e.clear=function(){this.uniqueShadingFormats.clear()},e.uniqueShadingFormats=new f,e.uniqueFormatType=5,e}(),U=function(){function e(e){this.uniqueTableFormat=void 0,this.borders=new S(this),this.shading=new A(this),this.ownerBase=void 0,this.ownerBase=e,this.assignTableMarginValue(5.4,0,5.4,0)}return Object.defineProperty(e.prototype,"allowAutoFit",{get:function(){return this.getPropertyValue("allowAutoFit")},set:function(e){this.setPropertyValue("allowAutoFit",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cellSpacing",{get:function(){return this.getPropertyValue("cellSpacing")},set:function(e){if(e<0||e>264.6)throw new RangeError("The measurement must be between 0 px and 264.6 px.");this.setPropertyValue("cellSpacing",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bottomMargin",{get:function(){return this.getPropertyValue("bottomMargin")},set:function(e){this.setPropertyValue("bottomMargin",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tableAlignment",{get:function(){return this.getPropertyValue("tableAlignment")},set:function(e){this.setPropertyValue("tableAlignment",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leftMargin",{get:function(){return this.getPropertyValue("leftMargin")},set:function(e){this.setPropertyValue("leftMargin",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"topMargin",{get:function(){return this.getPropertyValue("topMargin")},set:function(e){this.setPropertyValue("topMargin",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightMargin",{get:function(){return this.getPropertyValue("rightMargin")},set:function(e){this.setPropertyValue("rightMargin",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leftIndent",{get:function(){return this.getPropertyValue("leftIndent")},set:function(e){if(e<-1440||e>1440)throw new RangeError("The measurement must be between -1440 px and 1440 px.");this.setPropertyValue("leftIndent",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"preferredWidth",{get:function(){return this.getPropertyValue("preferredWidth")},set:function(e){this.setPropertyValue("preferredWidth",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"preferredWidthType",{get:function(){return this.getPropertyValue("preferredWidthType")},set:function(e){this.setPropertyValue("preferredWidthType",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bidi",{get:function(){return this.getPropertyValue("bidi")},set:function(e){this.setPropertyValue("bidi",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"horizontalPositionAbs",{get:function(){return this.getPropertyValue("horizontalPositionAbs")},set:function(e){this.setPropertyValue("horizontalPositionAbs",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"horizontalPosition",{get:function(){return this.getPropertyValue("horizontalPosition")},set:function(e){this.setPropertyValue("horizontalPosition",e)},enumerable:!0,configurable:!0}),e.prototype.getPropertyValue=function(i){if(this.hasValue(i)){var n=m.getPropertyType(e.uniqueFormatType,i);if(!t.isNullOrUndefined(this.uniqueTableFormat)&&this.uniqueTableFormat.propertiesHash.containsKey(n))return this.uniqueTableFormat.propertiesHash.get(n)}return e.getPropertyDefaultValue(i)},e.prototype.setPropertyValue=function(i,n){if((t.isNullOrUndefined(n)||""===n)&&(n=e.getPropertyDefaultValue(i)),t.isNullOrUndefined(this.uniqueTableFormat))this.initializeUniqueTableFormat(i,n);else{var r=m.getPropertyType(this.uniqueTableFormat.uniqueFormatType,i);if(this.uniqueTableFormat.propertiesHash.containsKey(r)&&this.uniqueTableFormat.propertiesHash.get(r)===n)return;this.uniqueTableFormat=e.uniqueTableFormats.updateUniqueFormat(this.uniqueTableFormat,i,n)}},e.prototype.initializeUniqueTableFormat=function(t,i){var n=new g;this.addUniqueTableFormat("allowAutoFit",t,i,n),this.addUniqueTableFormat("cellSpacing",t,i,n),this.addUniqueTableFormat("leftMargin",t,i,n),this.addUniqueTableFormat("topMargin",t,i,n),this.addUniqueTableFormat("bottomMargin",t,i,n),this.addUniqueTableFormat("rightMargin",t,i,n),this.addUniqueTableFormat("leftIndent",t,i,n),this.addUniqueTableFormat("tableAlignment",t,i,n),this.addUniqueTableFormat("preferredWidth",t,i,n),this.addUniqueTableFormat("preferredWidthType",t,i,n),this.addUniqueTableFormat("bidi",t,i,n),this.addUniqueTableFormat("horizontalPositionAbs",t,i,n),this.addUniqueTableFormat("horizontalPosition",t,i,n),this.uniqueTableFormat=e.uniqueTableFormats.addUniqueFormat(n,e.uniqueFormatType)},e.prototype.addUniqueTableFormat=function(t,i,n,r){var o;o=m.getPropertyType(e.uniqueFormatType,t),t===i&&r.add(o,n)},e.getPropertyDefaultValue=function(e){var t=void 0;switch(e){case"allowAutoFit":t=!1;break;case"cellSpacing":t=0;break;case"leftMargin":t=5.4;break;case"topMargin":case"bottomMargin":t=0;break;case"rightMargin":t=5.4;break;case"leftIndent":t=0;break;case"tableAlignment":t="Left";break;case"preferredWidth":t=0;break;case"preferredWidthType":t="Point";break;case"bidi":t=!1;break;case"horizontalPositionAbs":t=null;break;case"horizontalPosition":t=0}return t},e.prototype.assignTableMarginValue=function(e,t,i,n){this.leftMargin=e,this.topMargin=t,this.rightMargin=i,this.bottomMargin=n},e.prototype.initializeTableBorders=function(){this.borders.left.lineStyle="Single",this.borders.left.lineWidth=.5,this.borders.right.lineStyle="Single",this.borders.right.lineWidth=.5,this.borders.top.lineStyle="Single",this.borders.top.lineWidth=.5,this.borders.bottom.lineStyle="Single",this.borders.bottom.lineWidth=.5,this.borders.horizontal.lineStyle="Single",this.borders.horizontal.lineWidth=.5,this.borders.vertical.lineStyle="Single",this.borders.vertical.lineWidth=.5},e.prototype.destroy=function(){t.isNullOrUndefined(this.borders)||this.borders.destroy(),t.isNullOrUndefined(this.shading)||this.shading.destroy(),t.isNullOrUndefined(this.uniqueTableFormat)||e.uniqueTableFormats.remove(this.uniqueTableFormat),this.uniqueTableFormat=void 0,this.borders=void 0,this.shading=void 0},e.prototype.cloneFormat=function(){var i=new e(void 0);return i.leftIndent=this.leftIndent,i.tableAlignment=this.tableAlignment,i.cellSpacing=this.cellSpacing,i.leftMargin=this.leftMargin,i.rightMargin=this.rightMargin,i.topMargin=this.topMargin,i.bottomMargin=this.bottomMargin,i.preferredWidth=this.preferredWidth,i.preferredWidthType=this.preferredWidthType,i.horizontalPositionAbs=this.horizontalPositionAbs,i.horizontalPosition=this.horizontalPosition,i.borders=t.isNullOrUndefined(this.borders)?void 0:this.borders.cloneFormat(),i.shading=t.isNullOrUndefined(this.shading)?void 0:this.shading.cloneFormat(),i.bidi=this.bidi,i.allowAutoFit=this.allowAutoFit,i},e.prototype.hasValue=function(e){if(!t.isNullOrUndefined(this.uniqueTableFormat)){var i=m.getPropertyType(this.uniqueTableFormat.uniqueFormatType,e);return this.uniqueTableFormat.propertiesHash.containsKey(i)}return!1},e.prototype.copyFormat=function(e){t.isNullOrUndefined(e)||(t.isNullOrUndefined(e.uniqueTableFormat)||(this.cellSpacing=e.cellSpacing,this.leftMargin=e.leftMargin,this.topMargin=e.topMargin,this.rightMargin=e.rightMargin,this.bottomMargin=e.bottomMargin,this.leftIndent=e.leftIndent,this.tableAlignment=e.tableAlignment,this.preferredWidth=e.preferredWidth,this.preferredWidthType=e.preferredWidthType,this.bidi=e.bidi,this.allowAutoFit=e.allowAutoFit,this.horizontalPosition=e.horizontalPosition,this.horizontalPositionAbs=e.horizontalPositionAbs),t.isNullOrUndefined(e.borders)||(this.borders=new S(this),this.borders.copyFormat(e.borders)),t.isNullOrUndefined(e.shading)||(this.shading=new A(this),this.shading.copyFormat(e.shading)))},e.clear=function(){this.uniqueTableFormats.clear()},e.uniqueTableFormats=new f,e.uniqueFormatType=8,e}(),z=function(){function e(e){this.uniqueCellFormat=void 0,this.borders=new S(this),this.shading=new A(this),this.ownerBase=e,this.borders=new S(this),this.shading=new A(this)}return Object.defineProperty(e.prototype,"leftMargin",{get:function(){return this.getPropertyValue("leftMargin")},set:function(e){this.setPropertyValue("leftMargin",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightMargin",{get:function(){return this.getPropertyValue("rightMargin")},set:function(e){this.setPropertyValue("rightMargin",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"topMargin",{get:function(){return this.getPropertyValue("topMargin")},set:function(e){this.setPropertyValue("topMargin",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bottomMargin",{get:function(){return this.getPropertyValue("bottomMargin")},set:function(e){this.setPropertyValue("bottomMargin",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cellWidth",{get:function(){return this.getPropertyValue("cellWidth")},set:function(e){this.setPropertyValue("cellWidth",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columnSpan",{get:function(){return this.getPropertyValue("columnSpan")},set:function(e){this.setPropertyValue("columnSpan",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowSpan",{get:function(){return this.getPropertyValue("rowSpan")},set:function(e){this.setPropertyValue("rowSpan",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"preferredWidth",{get:function(){return this.getPropertyValue("preferredWidth")},set:function(e){this.setPropertyValue("preferredWidth",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"verticalAlignment",{get:function(){return this.getPropertyValue("verticalAlignment")},set:function(e){this.setPropertyValue("verticalAlignment",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"preferredWidthType",{get:function(){return this.getPropertyValue("preferredWidthType")},set:function(e){this.setPropertyValue("preferredWidthType",e)},enumerable:!0,configurable:!0}),e.prototype.getPropertyValue=function(i){if(this.hasValue(i)){var n=m.getPropertyType(e.uniqueFormatType,i);if(!t.isNullOrUndefined(this.uniqueCellFormat)&&this.uniqueCellFormat.propertiesHash.containsKey(n))return this.uniqueCellFormat.propertiesHash.get(n)}return e.getPropertyDefaultValue(i)},e.prototype.setPropertyValue=function(i,n){if((t.isNullOrUndefined(n)||""===n)&&(n=e.getPropertyDefaultValue(i)),t.isNullOrUndefined(this.uniqueCellFormat))this.initializeUniqueCellFormat(i,n);else{var r=m.getPropertyType(this.uniqueCellFormat.uniqueFormatType,i);if(this.uniqueCellFormat.propertiesHash.containsKey(r)&&this.uniqueCellFormat.propertiesHash.get(r)===n)return;this.uniqueCellFormat=e.uniqueCellFormats.updateUniqueFormat(this.uniqueCellFormat,i,n)}},e.prototype.initializeUniqueCellFormat=function(t,i){var n=new g;this.addUniqueCellFormat("leftMargin",t,i,n),this.addUniqueCellFormat("topMargin",t,i,n),this.addUniqueCellFormat("bottomMargin",t,i,n),this.addUniqueCellFormat("rightMargin",t,i,n),this.addUniqueCellFormat("cellWidth",t,i,n),this.addUniqueCellFormat("columnSpan",t,i,n),this.addUniqueCellFormat("rowSpan",t,i,n),this.addUniqueCellFormat("preferredWidth",t,i,n),this.addUniqueCellFormat("verticalAlignment",t,i,n),this.addUniqueCellFormat("preferredWidthType",t,i,n),this.uniqueCellFormat=e.uniqueCellFormats.addUniqueFormat(n,e.uniqueFormatType)},e.prototype.addUniqueCellFormat=function(t,i,n,r){var o=m.getPropertyType(e.uniqueFormatType,t);t===i&&r.add(o,n)},e.getPropertyDefaultValue=function(e){var t=void 0;switch(e){case"leftMargin":case"topMargin":case"bottomMargin":case"rightMargin":t=void 0;break;case"cellWidth":t=0;break;case"columnSpan":case"rowSpan":t=1;break;case"preferredWidth":t=0;break;case"verticalAlignment":t="Top";break;case"preferredWidthType":t="Point"}return t},e.prototype.containsMargins=function(){return!(t.isNullOrUndefined(this.leftMargin)&&t.isNullOrUndefined(this.rightMargin)&&t.isNullOrUndefined(this.bottomMargin)&&t.isNullOrUndefined(this.topMargin))},e.prototype.destroy=function(){t.isNullOrUndefined(this.borders)||this.borders.destroy(),t.isNullOrUndefined(this.shading)||this.shading.destroy(),t.isNullOrUndefined(this.uniqueCellFormat)||e.uniqueCellFormats.remove(this.uniqueCellFormat),this.uniqueCellFormat=void 0,this.borders=void 0,this.shading=void 0},e.prototype.cloneFormat=function(){var i=new e(void 0);return i.verticalAlignment=this.verticalAlignment,i.leftMargin=this.leftMargin,i.rightMargin=this.rightMargin,i.topMargin=this.topMargin,i.bottomMargin=this.bottomMargin,i.preferredWidth=this.preferredWidth,i.preferredWidthType=this.preferredWidthType,i.cellWidth=this.cellWidth,i.borders=t.isNullOrUndefined(this.borders)?void 0:this.borders.cloneFormat(),i.shading=t.isNullOrUndefined(this.shading)?void 0:this.shading.cloneFormat(),i},e.prototype.hasValue=function(e){if(!t.isNullOrUndefined(this.uniqueCellFormat)){var i=m.getPropertyType(this.uniqueCellFormat.uniqueFormatType,e);return this.uniqueCellFormat.propertiesHash.containsKey(i)}return!1},e.prototype.copyFormat=function(e){t.isNullOrUndefined(e)||(t.isNullOrUndefined(e.uniqueCellFormat)||(this.cellWidth=e.cellWidth,this.leftMargin=e.leftMargin,this.topMargin=e.topMargin,this.rightMargin=e.rightMargin,this.bottomMargin=e.bottomMargin,this.preferredWidth=e.preferredWidth,this.columnSpan=e.columnSpan,this.rowSpan=e.rowSpan,this.preferredWidthType=e.preferredWidthType,this.verticalAlignment=e.verticalAlignment),t.isNullOrUndefined(e.shading)||(this.shading=new A(this),this.shading.copyFormat(e.shading)),t.isNullOrUndefined(e.borders)||(this.borders=new S(this),this.borders.copyFormat(e.borders)))},e.clear=function(){this.uniqueCellFormats.clear()},e.uniqueCellFormats=new f,e.uniqueFormatType=4,e}(),V=function(){function e(){this.abstractListIdIn=-1,this.levels=[]}return Object.defineProperty(e.prototype,"abstractListId",{get:function(){return this.abstractListIdIn},set:function(e){this.abstractListIdIn=e},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){if(!t.isNullOrUndefined(this.levels)){for(var e=0;e<this.levels.length;e++){var i=this.levels[e];i.destroy(),this.levels.splice(this.levels.indexOf(i),1),e--}this.levels=[]}this.levels=void 0},e.prototype.clone=function(){for(var t=new e,i=0;i<this.levels.length;i++)t.levels.push(this.levels[i].clone(t));return t},e}(),_=function(){function e(e){this.uniqueListLevel=void 0,this.paragraphFormat=void 0,this.characterFormat=void 0,this.ownerBase=e,this.characterFormat=new H(void 0),this.paragraphFormat=new P(void 0)}return Object.defineProperty(e.prototype,"listLevelPattern",{get:function(){return this.getPropertyValue("listLevelPattern")},set:function(e){this.setPropertyValue("listLevelPattern",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"followCharacter",{get:function(){return this.getPropertyValue("followCharacter")},set:function(e){this.setPropertyValue("followCharacter",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startAt",{get:function(){return this.getPropertyValue("startAt")},set:function(e){this.setPropertyValue("startAt",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numberFormat",{get:function(){return this.getPropertyValue("numberFormat")},set:function(e){this.setPropertyValue("numberFormat",e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"restartLevel",{get:function(){return this.getPropertyValue("restartLevel")},set:function(e){this.setPropertyValue("restartLevel",e)},enumerable:!0,configurable:!0}),e.prototype.getPropertyValue=function(i){var n=m.getPropertyType(e.uniqueFormatType,i);return!t.isNullOrUndefined(this.uniqueListLevel)&&this.uniqueListLevel.propertiesHash.containsKey(n)?this.uniqueListLevel.propertiesHash.get(n):e.getPropertyDefaultValue(i)},e.prototype.setPropertyValue=function(i,n){if((t.isNullOrUndefined(n)||""===n)&&(n=e.getPropertyDefaultValue(i)),t.isNullOrUndefined(this.uniqueListLevel))this.initializeUniqueWListLevel(i,n);else{var r=m.getPropertyType(this.uniqueListLevel.uniqueFormatType,i);if(this.uniqueListLevel.propertiesHash.containsKey(r)&&this.uniqueListLevel.propertiesHash.get(r)===n)return;this.uniqueListLevel=e.uniqueListLevels.updateUniqueFormat(this.uniqueListLevel,i,n)}},e.prototype.initializeUniqueWListLevel=function(t,i){var n=new g;this.addUniqueWListLevel("listLevelPattern",t,i,n),this.addUniqueWListLevel("startAt",t,i,n),this.addUniqueWListLevel("followCharacter",t,i,n),this.addUniqueWListLevel("numberFormat",t,i,n),this.addUniqueWListLevel("restartLevel",t,i,n),this.uniqueListLevel=e.uniqueListLevels.addUniqueFormat(n,e.uniqueFormatType)},e.prototype.addUniqueWListLevel=function(t,i,n,r){var o;o=m.getPropertyType(e.uniqueFormatType,t),t===i?r.add(o,n):r.add(o,e.getPropertyDefaultValue(t))},e.getPropertyDefaultValue=function(e){var t=void 0;switch(e){case"listLevelPattern":t="Arabic";break;case"startAt":t=0;break;case"followCharacter":t="Tab";break;case"numberFormat":t="";break;case"restartLevel":t=0}return t},e.prototype.destroy=function(){t.isNullOrUndefined(this.characterFormat)||this.characterFormat.destroy(),t.isNullOrUndefined(this.paragraphFormat)||this.paragraphFormat.destroy(),t.isNullOrUndefined(this.uniqueListLevel)||e.uniqueListLevels.remove(this.uniqueListLevel),this.uniqueListLevel=void 0,this.characterFormat=void 0,this.paragraphFormat=void 0},e.clear=function(){this.uniqueListLevels.clear()},e.prototype.clone=function(t){var i=new e(t);return i.paragraphFormat=this.paragraphFormat.cloneFormat(),i.characterFormat=this.characterFormat.cloneFormat(),this.uniqueListLevel&&(i.uniqueListLevel=this.uniqueListLevel,i.uniqueListLevel.referenceCount++),i},e.dotBullet="",e.squareBullet="",e.arrowBullet="➤",e.circleBullet=" ",e.uniqueListLevels=new f,e.uniqueFormatType=9,e}(),j=function(){function e(e){this.islayoutFootnote=!1,this.allowLayout=!0,this.footHeight=0,this.footnoteHeight=0,this.isTableFootNote=!1,this.isRelayout=!1,this.isInitialLoad=!0,this.fieldBegin=void 0,this.maxTextHeight=0,this.maxBaseline=0,this.maxTextBaseline=0,this.isFieldCode=!1,this.isRtlFieldCode=!1,this.isRTLLayout=!1,this.currentCell=void 0,this.isFootnoteContentChanged=!1,this.isEndnoteContentChanged=!1,this.isLayoutWhole=!1,this.isBidiReLayout=!1,this.defaultTabWidthPixel=48,this.isRelayoutFootnote=!1,this.isRelayoutOverlap=!1,this.isWrapText=!1,this.isYPositionUpdated=!1,this.isXPositionUpdated=!1,this.hasFloatingElement=!1,this.documentHelper=e}return e.prototype.isSameStyle=function(e,i){var n=void 0;return i?e.nextWidget instanceof fe&&(n=e.nextWidget):e.previousWidget instanceof fe&&(n=e.previousWidget),!t.isNullOrUndefined(n)&&(e.paragraphFormat.baseStyle===n.paragraphFormat.baseStyle&&e.paragraphFormat.contextualSpacing)},Object.defineProperty(e.prototype,"viewer",{get:function(){return this.documentHelper.owner.viewer},enumerable:!0,configurable:!0}),e.prototype.layout=function(){},e.prototype.destroy=function(){this.documentHelper=void 0,this.value=void 0,this.allowLayout=void 0,this.isInitialLoad=void 0,this.fieldBegin=void 0,this.maxTextHeight=void 0,this.maxBaseline=void 0,this.maxTextBaseline=void 0,this.isFieldCode=void 0,this.footnoteHeight=void 0},e.prototype.layoutItems=function(e,t){for(var i,n=this,r=0;r<e.length;r++){var o=e[r],s=this.documentHelper.pages[this.documentHelper.pages.length-1];if(r>0&&e[r-1].lastChild.isEndsWithPageBreak&&0===s.bodyWidgets[0].childWidgets.length&&this.documentHelper.pages.splice(this.documentHelper.pages.length-1,1),i=this.viewer.createNewPage(o),this.addBodyWidget(this.viewer.clientActiveArea,o),this.documentHelper.pages.length>1){for(var a=0,l=0;l<this.documentHelper.pages.length;l++){var d=this.documentHelper.pages[l];if(d.sectionIndex>o.index||d===i)break;a++}a<this.documentHelper.pages.length-1&&this.documentHelper.insertPage(a,i)}this.layoutSection(o,0)}t||this.layoutComments(this.documentHelper.comments),this.updateFieldElements(),"Pages"===this.documentHelper.owner.layoutType&&this.layoutEndNoteElement(),setTimeout(function(){n.documentHelper&&(n.documentHelper.isScrollHandler=!0,n.documentHelper.owner.isSpellCheck&&n.documentHelper.owner.spellChecker.enableOptimizedSpellCheck&&(n.documentHelper.triggerElementsOnLoading=!0),n.documentHelper.clearContent(),n.viewer.updateScrollBars(),n.documentHelper.isScrollHandler=!1,n.isInitialLoad=!1)},50)},e.prototype.layoutComments=function(e){t.isNullOrUndefined(e)||this.viewer.owner.commentReviewPane.layoutComments()},e.prototype.layoutSection=function(e,i){var n,r,o=e.firstChild;do{o instanceof ve&&"Auto"===o.tableFormat.preferredWidthType&&!o.tableFormat.allowAutoFit&&o.calculateGrid(),this.viewer.updateClientAreaForBlock(o,!0),n=this.layoutBlock(o,i),i=0,this.viewer.updateClientAreaForBlock(o,!1),r=o,o=n,(t.isNullOrUndefined(o)||(o.bodyWidget&&o.bodyWidget.page)!==(r.bodyWidget&&r.bodyWidget.page))&&r.bodyWidget.page.footnoteWidget&&this.layoutfootNote(r.bodyWidget.page.footnoteWidget)}while(o)},e.prototype.layoutHeaderFooter=function(e,t,i){var n=t.getCurrentPageHeaderFooter(e,!0);if(n){var r=n.clone();r.page=i,this.updateRevisionsToHeaderFooter(r,i),t.updateHFClientArea(e.sectionFormat,!0),i.headerWidget=this.layoutHeaderFooterItems(t,r),this.updateHeaderFooterToParent(r)}if(n=t.getCurrentPageHeaderFooter(e,!1)){var o=n.clone();o.page=i,t.updateHFClientArea(e.sectionFormat,!1),this.updateRevisionsToHeaderFooter(o,i),i.footerWidget=this.layoutHeaderFooterItems(t,o),this.updateHeaderFooterToParent(o)}},e.prototype.updateHeaderFooterToParent=function(e){var t=e.page.sectionIndex,i=this.viewer.getHeaderFooter(e.headerFooterType),n=e.clone();this.documentHelper.headersFooters[t][i]=n;for(var r=0;r<n.childWidgets.length;r++){var o=n.childWidgets[r];o instanceof ve&&this.clearTableWidget(o,!1,!0)}return n},e.prototype.updateRevisionsToHeaderFooter=function(e,t){var i=e.childWidgets;if(e instanceof ue&&i.length>0)for(var n=0;n<i.length;n++)if(i[n].childWidgets.length>0)for(var r=i[n].childWidgets,o=0;o<r.length;o++){var s=r[o].children;if(s)for(var a=0;a<s.length;a++)if(s[a].removedIds.length>0)for(var l=s[a].removedIds,d=0;d<l.length;d++){var h=this.documentHelper.revisionsInternal.get(l[d]);s[a].revisions[d]=h,this.updateRevisionRange(h,t)}}},e.prototype.updateRevisionRange=function(e,t){for(var i=0;i<e.range.length;i++){var n=e.range[i];n.line.paragraph.bodyWidget.page||(n.line.paragraph.bodyWidget.page=t)}},e.prototype.linkFieldInHeaderFooter=function(e){var t=e.firstChild;do{t instanceof fe?this.linkFieldInParagraph(t):this.linkFieldInTable(t)}while(t=t.nextWidget)},e.prototype.linkFieldInParagraph=function(e){for(var t=0;t<e.childWidgets.length;t++)for(var i=e.childWidgets[t],n=0;n<i.children.length;n++){var r=i.children[n];r instanceof xe&&(0!==r.fieldType||0===r.fieldType&&-1===this.documentHelper.fields.indexOf(r))&&r.linkFieldCharacter(this.documentHelper),r instanceof We&&r.fieldBegin!==r.previousElement.fieldBegin&&(r.fieldBegin=r.previousElement.fieldBegin)}},e.prototype.linkFieldInTable=function(e){for(var t=0;t<e.childWidgets.length;t++)for(var i=e.childWidgets[t],n=0;n<i.childWidgets.length;n++)for(var r=i.childWidgets[n],o=0;o<r.childWidgets.length;o++){var s=r.childWidgets[o];s instanceof fe?this.linkFieldInParagraph(s):this.linkFieldInTable(s)}},e.prototype.layoutHeaderFooterItems=function(e,t){if(this.viewer.updateClientAreaLocation(t,e.clientActiveArea),0===t.childWidgets.length){var i=new fe,n=new we(i);i.childWidgets.push(n),t.childWidgets.push(i),i.containerWidget=t}this.linkFieldInHeaderFooter(t);for(var r=0;r<t.childWidgets.length;r++){var o=t.childWidgets[r];o instanceof ve&&"Auto"===o.tableFormat.preferredWidthType&&!o.tableFormat.allowAutoFit&&!o.isGridUpdated&&o.calculateGrid(),e.updateClientAreaForBlock(o,!0),this.layoutBlock(o,0),e.updateClientAreaForBlock(o,!1)}var s=t.headerFooterType;return"OddFooter"!==s&&"EvenFooter"!==s&&"FirstPageFooter"!==s||this.shiftChildLocation(e.clientArea.y-e.clientActiveArea.y,t),t},e.prototype.shiftChildLocation=function(e,t){var i=t.y+e,n=t.page.boundingRectangle.height-t.page.boundingRectangle.height/100*40;e=(i=Math.max(i,n))-t.y;for(var r=t.y=i,o=0;o<t.childWidgets.length;o++){var s=t.childWidgets[o];s instanceof fe?(s.x=s.x,s.y=0===o?s.y+e:r,r+=s.height):(this.shiftChildLocationForTableWidget(s,e),r+=s.height)}},e.prototype.shiftChildLocationForTableWidget=function(e,t){e.y=e.y+t;for(var i=0;i<e.childWidgets.length;i++){var n=e.childWidgets[i];n instanceof ye&&this.shiftChildLocationForTableRowWidget(n,t)}},e.prototype.shiftChildLocationForTableRowWidget=function(e,t){e.y=e.y+t;for(var i=0;i<e.childWidgets.length;i++)this.shiftChildLocationForTableCellWidget(e.childWidgets[i],t)},e.prototype.shiftChildLocationForTableCellWidget=function(e,t){e.y=e.y+t;for(var i=0;i<e.childWidgets.length;i++)e.childWidgets[i]instanceof fe?(e.childWidgets[i].x=e.childWidgets[i].x,e.childWidgets[i].y=e.childWidgets[i].y+t):this.shiftChildLocationForTableWidget(e.childWidgets[i],t)},e.prototype.layoutBlock=function(e,t){var i;if(e instanceof fe){i=this.layoutParagraph(e,t);var n=this.checkPreviousParaShapeOverlap(e);n&&(i=n)}else e.calculateGrid(),e.isGridUpdated=!1,e.buildTableColumns(),e.isGridUpdated=!0,i=this.layoutTable(e,t),this.updateTableYPositionBasedonTextWrap(i);return i.nextRenderedWidget},e.prototype.updateTableYPositionBasedonTextWrap=function(e){var t=this,i=e.y,n=new ae(e.x,e.y,e.width,e.height);e.bodyWidget.floatingElements.forEach(function(r){if(!r.paragraph.isInsideTable){var o=new ae(r.x,r.y,r.width,r.height);if(("TopAndBottom"===r.textWrappingStyle||"Square"===r.textWrappingStyle)&&n.isIntersecting(o)){e.y=r.y+r.height+r.distanceBottom,t.updateChildLocationForTable(e.y,e);var s=e.y-i;t.viewer.cutFromTop(t.viewer.clientActiveArea.y+s)}}})},e.prototype.checkPreviousParaShapeOverlap=function(e){if(!(e.containerWidget instanceof _e)&&!this.isRelayoutOverlap&&e.floatingElements.length>0){for(var t=e.previousWidget,i=0;i<e.floatingElements.length;i++){var n=e.floatingElements[i];if("InFrontOfText"!==n.textWrappingStyle&&"Behind"!==n.textWrappingStyle){for(var r=new ae(n.x,n.y,n.width,n.height);t;){if(t instanceof fe){var o=new ae(t.x,t.y,t.width,t.height);r.isIntersecting(o)&&this.startOverlapWidget!==t&&(this.startOverlapWidget=t,this.endOverlapWidget=e)}t=t.previousWidget}t=e.previousWidget}}return this.startOverlapWidget&&(this.isRelayoutOverlap=!0,this.layoutStartEndBlocks(this.startOverlapWidget,e),this.isRelayoutOverlap=!1),this.startOverlapWidget=void 0,this.endOverlapWidget=void 0,e}},e.prototype.addParagraphWidget=function(e,i){if(!i.isEmpty()||t.isNullOrUndefined(i.paragraphFormat)||"Center"!==i.paragraphFormat.textAlignment&&"Right"!==i.paragraphFormat.textAlignment||-1!==i.paragraphFormat.listFormat.listId)i.width=e.width,i.x=e.x,i.y=e.y;else{var n=this.documentHelper.textHelper.getParagraphMarkWidth(i.characterFormat),r=e.x;"Center"===i.paragraphFormat.textAlignment?r+=(e.width-n)/2:r+=e.width-n,i.width=n,i.x=r,i.y=e.y}return i},e.prototype.addLineWidget=function(e){var t=void 0;return t=new we(e),t.width=e.width,e.childWidgets.push(t),t.paragraph=e,t},e.prototype.isFirstElementWithPageBreak=function(e){var t=!1;if(this.viewer instanceof re){var i=e.childWidgets[0];if(i)for(var n=i.children[0];n;){if(!(n instanceof ke&&n.name.indexOf("_")>=0)){n instanceof Ie&&"\f"===n.text&&(t=!0);break}n=n.nextElement}}return t},e.prototype.layoutfootNote=function(e){if("Pages"===this.documentHelper.owner.layoutType){var t=this.viewer.clientActiveArea,i=this.viewer.clientArea;"Footnote"===e.footNoteType&&this.viewer.updateFootnoteClientArea(e.sectionFormat,e);var n=void 0;this.isRelayoutFootnote=!1,this.viewer.clientActiveArea.y=this.viewer.clientActiveArea.y-e.page.footerWidget.height+e.page.bodyWidgets[0].sectionFormat.footerDistance;for(var r=0;r<e.childWidgets.length;r++)(n=e.childWidgets[r]).index=r,n.containerWidget=e,this.viewer.updateClientAreaForBlock(n,!0),this.layoutBlock(n,0),0===r&&(e.y=n.y),this.viewer.updateClientAreaForBlock(n,!1);this.viewer.clientActiveArea=t,this.viewer.clientArea=i,e.page.bodyWidgets[0].lastChild instanceof ve&&e.page.bodyWidgets[0].lastChild.y+e.page.bodyWidgets[0].lastChild.height>e.y&&this.reLayoutTable(e.page.bodyWidgets[0].lastChild)}return e},e.prototype.layoutParagraph=function(e,i){this.addParagraphWidget(this.viewer.clientActiveArea,e);var n=!0;if(this.isFirstElementWithPageBreak(e)||(this.layoutListItems(e),n=!1),e.isEmpty())this.layoutEmptyLineWidget(e,!0);else{var r=i<e.childWidgets.length?e.childWidgets[i]:void 0;for(this.isRelayoutOverlap||e.containerWidget instanceof _e||this.layoutFloatElements(e);r instanceof we;){if(e!==r.paragraph&&0===r.indexInOwner&&n&&this.layoutListItems(r.paragraph),r.isFirstLine()&&t.isNullOrUndefined(this.fieldBegin)&&!t.isNullOrUndefined(e.paragraphFormat)){var o=-W.convertPointToPixel(e.paragraphFormat.firstLineIndent);this.viewer.updateClientWidth(o)}r.marginTop=0,e=(r=this.layoutLine(r,0)).paragraph,r=r.nextLine,e.isContainsShapeAlone()&&0===e.height&&this.layoutEmptyLineWidget(e,!1,e.childWidgets[0])}}return this.updateWidgetToPage(this.viewer,e),e},e.prototype.clearLineMeasures=function(){this.maxBaseline=0,this.maxTextBaseline=0,this.maxTextHeight=0},e.prototype.layoutFloatElements=function(e){var t=this;e.floatingElements.forEach(function(e){e instanceof ze&&(t.isRelayoutOverlap||t.layoutShape(e))})},e.prototype.layoutShape=function(e){if("Inline"!==e.textWrappingStyle){var t=this.getFloatingItemPoints(e);e.x=t.x,e.y=t.y;var i=e.paragraph.bodyWidget;-1===i.floatingElements.indexOf(e)&&(i.floatingElements.push(e),i.floatingElements.sort(function(e,t){return e.y-t.y})),-1===e.paragraph.floatingElements.indexOf(e)&&e.paragraph.floatingElements.push(e)}var n=this.viewer.clientArea,r=this.viewer.clientActiveArea;if(e instanceof Ve){var o=e.textFrame.childWidgets;this.viewer.updateClientAreaForTextBoxShape(e,!0);for(var s=0;s<o.length;s++){var a=o[s];this.viewer.updateClientAreaForBlock(a,!0),a instanceof ve&&this.clearTableWidget(a,!0,!0),this.layoutBlock(a,0),this.viewer.updateClientAreaForBlock(a,!1)}}this.viewer.clientActiveArea=r,this.viewer.clientArea=n},e.prototype.moveElementFromNextLine=function(e){for(var t=e.nextLine;t instanceof we;){if(t.children.length>0){var i=t.children.splice(0,1)[0];e.children.push(i),i.line=e;break}1===t.paragraph.childWidgets.length?t.paragraph.destroy():t.destroy(),t=e.nextLine}},e.prototype.layoutLine=function(e,i){var n=e.paragraph;0===e.children.length&&this.moveElementFromNextLine(e);var r=e.children[i];for(this.clearLineMeasures(),e.marginTop=0;r instanceof Ce;){if(r.padding.left=0,this.layoutElement(r,n),e=r.line,r instanceof Ie){var o=r;!t.isNullOrUndefined(o.errorCollection)&&o.errorCollection.length>0&&(o.ischangeDetected=!0)}this.isRTLLayout?(r=void 0,this.isRTLLayout=!1):this.hasFloatingElement?this.hasFloatingElement=!1:r=r.nextElement}return e},e.prototype.layoutElement=function(e,i){if(!(e instanceof ze&&"Inline"!==e.textWrappingStyle)){var n=e.line,r="",o=e.indexInOwner;if(e instanceof xe)return 0===e.fieldType&&(-1===this.documentHelper.fields.indexOf(e)&&this.documentHelper.fields.push(e),t.isNullOrUndefined(e.formFieldData)||-1!==this.documentHelper.formFields.indexOf(e)||this.documentHelper.formFields.push(e)),this.layoutFieldCharacters(e),void(e.line.isLastLine()&&t.isNullOrUndefined(e.nextNode)&&!this.isFieldCode?(2!==e.fieldType&&t.isNullOrUndefined(e.fieldSeparator)&&this.layoutEmptyLineWidget(i,!1,e.line),this.moveToNextLine(n)):t.isNullOrUndefined(e.nextElement)&&this.viewer.clientActiveArea.width>0&&!e.line.isLastLine()?(this.moveElementFromNextLine(n),e.line.isLastLine()&&t.isNullOrUndefined(e.nextNode)&&!this.isFieldCode&&(2!==e.fieldType&&t.isNullOrUndefined(e.fieldSeparator)&&this.layoutEmptyLineWidget(i,!1,e.line),this.moveToNextLine(n))):t.isNullOrUndefined(e.nextElement)&&0===this.viewer.clientActiveArea.width&&(this.moveToNextLine(n),n.paragraph.lastChild===n&&!t.isNullOrUndefined(n.nextLine)&&this.viewer.clientActiveArea.height>=0&&this.moveFromNextPage(n)));if(e instanceof Ke||this.isFieldCode||e instanceof ke||e instanceof Xe||e instanceof Ye||e instanceof Le){if(e instanceof ke)if(0!==e.bookmarkType||this.documentHelper.bookmarks.containsKey(e.name))if(1===e.bookmarkType&&this.documentHelper.bookmarks.containsKey(e.name)){var s=this.documentHelper.bookmarks.get(e.name);t.isNullOrUndefined(s.reference)&&(s.reference=e,e.reference=s)}else 0===e.bookmarkType&&this.documentHelper.bookmarks.containsKey(e.name)&&t.isNullOrUndefined(e.reference)&&this.documentHelper.bookmarks.remove(e.name);else this.documentHelper.bookmarks.add(e.name,e);if(e instanceof Le&&-1===this.documentHelper.contentControlCollection.indexOf(e))if(0===e.type)this.documentHelper.contentControlCollection.push(e);else if(1===e.type)for(var a=e.paragraph.bodyWidget.page,l=0;l<this.documentHelper.contentControlCollection.length;l++){var d=this.documentHelper.contentControlCollection[l],h=d.line.paragraph.isInHeaderFooter;h&&e.contentControlProperties===d.contentControlProperties&&a===d.line.paragraph.bodyWidget.page?(e.reference=d,d.reference=e):h||e.contentControlProperties!==d.contentControlProperties||(e.reference=d,d.reference=e)}return t.isNullOrUndefined(e.nextElement)&&this.viewer.clientActiveArea.width>0&&!e.line.isLastLine()&&this.moveElementFromNextLine(n),void(e.line.isLastLine()&&t.isNullOrUndefined(e.nextElement)&&(this.hasValidElement(n.paragraph)?this.moveToNextLine(n):this.layoutEmptyLineWidget(n.paragraph,!1,n,!1)))}var c=e.width;if(e instanceof We&&!this.isTocField(e.fieldBegin))""!==(r=this.documentHelper.getFieldResult(e.fieldBegin,e.paragraph.bodyWidget.page))?e.text=r:r=e.text;else if(e instanceof Ee)""!==(r=this.startAt(e,r))&&(e.text=r);else if(e instanceof Ie){if(this.checkAndSplitTabOrLineBreakCharacter(e.text,e),e.text.length>1&&e.line.paragraph.bidi){var p=this.splitTextByConsecutiveLtrAndRtl(e);this.updateSplittedText(e,p)}r=e.text}if(e instanceof Ie&&(c=this.documentHelper.textHelper.getTextSize(e,e.characterFormat),"\t"===e.text&&(e.width=this.getTabWidth(i,this.viewer,o,n,e))),t.isNullOrUndefined(i.containerWidget)||!(i.bodyWidget.floatingElements.length>0)||e instanceof Ve||i.containerWidget instanceof _e||this.adjustPosition(e,e.line.paragraph.bodyWidget),this.viewer instanceof re&&(e instanceof Ve&&"Inline"===e.textWrappingStyle||!(e instanceof Ve))&&this.viewer.clientActiveArea.height<e.height&&this.viewer.clientActiveArea.y!==this.viewer.clientArea.y&&(!(e instanceof Ie&&"\f"!==e.text)&&e instanceof Ie||this.moveToNextPage(this.viewer,n),e instanceof We&&this.updateFieldText(e),!e.previousElement||!(e.previousElement instanceof Ve&&"Inline"===e.previousElement.textWrappingStyle)&&e.previousElement instanceof Ve||this.cutClientWidth(e.previousElement)),e instanceof Ve&&"Inline"===e.textWrappingStyle&&this.layoutShape(e),e instanceof Ee&&(!e.isLayout||this.isLayoutWhole)&&"Pages"===this.documentHelper.owner.layoutType&&this.layoutFootEndNoteElement(e),e instanceof Ge&&(0!==e.top&&!t.isNullOrUndefined(e.top)||0!==e.bottom&&!t.isNullOrUndefined(e.bottom)||0!==e.left&&!t.isNullOrUndefined(e.left)||0!==e.right&&!t.isNullOrUndefined(e.right))&&this.cropPosition(e),parseFloat(c.toFixed(4))<=parseFloat(this.viewer.clientActiveArea.width.toFixed(4))||!this.viewer.textWrap)this.addElementToLine(i,e),t.isNullOrUndefined(e.nextElement)&&this.viewer.clientActiveArea.width>0&&!e.line.isLastLine()?this.moveElementFromNextLine(n):!e.line.isLastLine()&&t.isNullOrUndefined(e.nextElement)&&0===this.viewer.clientActiveArea.width&&(this.moveToNextLine(n),n.paragraph.lastChild===n&&this.viewer.clientActiveArea.height>=0&&this.moveFromNextPage(n));else if(e instanceof Ie)if("\t"===e.text){var u=e.line;this.addSplittedLineWidget(u,u.children.indexOf(e)-1),this.moveToNextLine(u),e.width=this.getTabWidth(i,this.viewer,o,e.line,e),this.addElementToLine(i,e)}else do{n=e.line,this.splitTextForClientArea(n,e,e.text,e.width,e.characterFormat),this.checkLineWidgetWithClientArea(n,e),e instanceof We&&this.updateFieldText(e)}while(e.line!==n&&this.cutClientWidth(e));else do{n=e.line,this.splitElementForClientArea(i,e),this.checkLineWidgetWithClientArea(n,e),e instanceof We&&this.updateFieldText(e)}while(e.line!==n&&this.cutClientWidth(e));if("\v"===r||"\f"===r){var g=n.children.indexOf(e);g>-1&&this.addSplittedLineWidget(n,g)}if(e.line.isLastLine()&&t.isNullOrUndefined(e.nextElement)||"\v"===r||"\f"===r){if(this.isXPositionUpdated)return void(this.isXPositionUpdated=!1);this.moveToNextLine(e.line),"\v"===r&&t.isNullOrUndefined(e.nextNode)?this.layoutEmptyLineWidget(i,!0,n,!0):"\f"===r&&this.viewer instanceof re&&(t.isNullOrUndefined(e.nextNode)?this.moveToNextPage(this.viewer,e.line,!0):t.isNullOrUndefined(e.line.nextLine)||this.moveToNextPage(this.viewer,e.line.nextLine,!1))}this.isXPositionUpdated=!1}},e.prototype.adjustPosition=function(e,t){var i=this.viewer.clientActiveArea,n=this.viewer.clientActiveArea.x,r=this.adjustClientAreaBasedOnTextWrap(e,new ae(i.x,i.y,i.width,i.height));this.viewer.clientActiveArea.width=r.width;var o=this.viewer.clientActiveArea.x-n;e.padding.left=o,0===this.viewer.clientActiveArea.width&&(this.isWrapText=!1)},e.prototype.isFirstitemInPage=function(e,t){return!e.line.paragraph.isInHeaderFooter&&Math.round(t)==this.viewer.clientArea.y},e.prototype.isTextFitBelow=function(e,t,i){return!1},e.prototype.isNeedToWrapForSquareTightAndThrough=function(e,t,i,n,r,o,s,a,l,d,h,c,p){return e.floatingElements.length>0&&i!==a&&n!==a&&"Inline"!==r&&"Behind"!==r&&"InFrontOfText"!==r&&(Math.round(h.y+p)>Math.round(o.y)||this.isTextFitBelow(o,h.y+p,l))&&Math.round(h.y)<Math.round(o.y+o.height)&&!(s&&(d||t instanceof Ge&&"Inline"!==t.textWrappingStyle&&t.allowOverlap))},e.prototype.isNeedToWrapLeafWidget=function(e,t){return e.bodyWidget.floatingElements.length>0&&!0&&(!e.isInHeaderFooter||e.associatedCell)&&!(t instanceof Ge)},e.prototype.getMinWidth=function(e,t,i,n){var r=e.text,o=r.split(" ");""!=r&&""==r.trim()&&e&&e.line.paragraph&&e.previousNode&&e.nextNode&&e.line.paragraph.isEmpty&&(o=[""]);var s=this.documentHelper.textHelper.measureText(o[0],e.characterFormat).Width,a=this.getNextSibling(e);if(1==o.length&&a){var l=a.text;s+=this.getNextTextRangeWidth(a,l,t,i,n)}return s},e.prototype.getNextTextRangeWidth=function(e,t,i,n,r){for(var o=e,s=new ae(0,0,0,0),a=this.isNextSibligSizeNeedToBeMeasure(s,e,r,i,n);a&&this.isLeafWidgetNextSiblingIsTextRange(o)&&i+s.width<r.width&&(o=this.getNextSibling(o),this.isNextSibligSizeNeedToBeMeasure(s,o,r,i,n));)t+=o.text;return s.width},e.prototype.isLeafWidgetNextSiblingIsTextRange=function(e){var t=this.getNextSibling(e);return!!(t&&t instanceof Ie)},e.prototype.isNextSibligSizeNeedToBeMeasure=function(e,t,i,n,r){var o=null,s=t;if(s){if(-1!=(o=s.text).indexOf(" ")||-1!=o.indexOf("-")||-1!=o.indexOf("_")&&n+e.width+this.documentHelper.textHelper.measureText(o.split("-")[0],s.characterFormat).Width<i.width||"\t"==s.text){var a=s.width;return o!=o.split(" ")[0]&&(a=this.documentHelper.textHelper.measureText(o.split(" ")[0],s.characterFormat).Width),n+e.width+a>i.width&&o.indexOf("-")&&o!=o.split("-")[0]+"-"&&(a=this.documentHelper.textHelper.measureText(o.split("-")[0]+"-",s.characterFormat).Width),e.width+=a,!1}if(s.text.length>0){var l=this.documentHelper.textHelper.measureText(s.text,s.characterFormat);e.height+=l.Height,e.width+=l.Width}}return!0},e.prototype.isNeedDoIntermediateWrapping=function(e,t,i,n,r,o,s,a,l){return e>l&&((Math.round(i.width)<=Math.round(a)||i.width<n&&s.paragraph.isInsideTable)&&"Left"!=t&&"Largest"!=t||"Right"==t||i.width<e&&"Largest"==t)||(Math.round(o.x-r.x+r.leftIndent)<l||s instanceof Ie&&this.isFloatingItemOnLeft(i,a,o))&&("Left"!==t||e<l)},e.prototype.isFloatingItemOnLeft=function(e,t,i){return!1},e.prototype.getNextSibling=function(e){e.line.paragraph;for(var t=e.nextNode,i=!1;t;){if(t instanceof xe||t instanceof ke||i||t instanceof Ke)t instanceof xe&&(0===t.fieldType?i=!0:2===t.fieldType&&(i=!1));else if(t instanceof Ie)break;t=t.nextNode}return t},e.prototype.adjustClientAreaBasedOnTextWrap=function(e,i){var n=e.line.paragraph,r=n.bodyWidget,o=this.viewer,s=i.y;this.isFirstitemInPage(e,s);if(t.isNullOrUndefined(n.previousWidget),this.isNeedToWrapLeafWidget(n,e)){var a=o.clientArea;r.floatingElements.sort(function(e,t){return e.y-t.y}),r.floatingElements.sort(function(e,t){return e.x-t.x});for(var l=0;l<r.floatingElements.length;l++){var d=r.floatingElements[l],h=d.allowOverlap,c=(d.x,new ae(d.x-d.distanceLeft,d.y-d.distanceTop,d.width+d.distanceLeft+d.distanceRight,d.height+d.distanceTop+d.distanceBottom)),p=d.textWrappingStyle,u=d.textWrappingType;o.clientArea.y,d.height;if(!(a.x>c.right+18||a.right<c.x-18)&&this.isNeedToWrapForSquareTightAndThrough(r,e,-1,-1,p,c,h,1,d,!1,i,e.width,e.height)){var g=0,m=0,f=0,v=W.convertPointToPixel(e.paragraph.paragraphFormat.firstLineIndent),y=W.convertPointToPixel(n.paragraphFormat.leftIndent);v=0===e.indexInOwner&&e.line.isFirstLine()&&v>0?v:0;var b=e,w=!1;if(e.line.paragraph){i.x>=c.x&&"Left"!==u&&(g=n.paragraphFormat.rightIndent),i.x<c.x&&"Right"!==u&&(m=y);var C=n.paragraphFormat.listFormat,x=this.getListLevel(C.list,C.listLevelNumber);i.x==a.x+y&&C&&C.baseStyle&&x&&0!=x.paragraphFormat.leftIndent&&(f=y,w=!0)}if(i.x>=c.x&&i.x<c.right&&"Left"!==u){i.width=i.width-(c.right-i.x)-g,this.isWrapText=!0;if(Math.round(i.width)<18||i.width<e.width&&"\t"===e.text||c.x<n.x+y){i.width=this.viewer.clientArea.right-c.right-(w?f:0);S=0;if(S=b?this.getMinWidth(e,e.width,e.height,i):e.width,Math.round(i.width)<18||i.width<S){if(c.x-(n.x+n.leftIndent)>18&&this.viewer.clientArea.right-c.right>18)i.width=0;else{P=0;this.isYPositionUpdated=!0,i.width=this.viewer.clientArea.width,i.height-=c.bottom+P-i.y,i.y=c.bottom+P}this.viewer.updateClientAreaForTextWrap(i),this.isWrapText=!1}else{F=i.x;if(i.x=c.right+(w?f:0)+v,i.width-=v,"Square"==p&&i.width<0&&e.width>0){P=0;this.isYPositionUpdated=!0,i.width=this.viewer.clientArea.width,i.height-=c.bottom+P-i.y,i.y=c.bottom+P,i.x=F}this.viewer.updateClientAreaForTextWrap(i)}}else{var F=i.x;if(i.x=c.right+(w?f:0)+v,i.width=this.viewer.clientArea.right-c.right-(w?f:0)-v,"Square"==p&&i.width<0&&e.width>0){var P=0;this.isYPositionUpdated=!0,i.width=this.viewer.clientArea.width,i.height-=c.bottom+P-i.y,i.y=c.bottom+P,i.x=F}else this.isWrapText=!0;this.viewer.updateClientAreaForTextWrap(i)}}else if(c.x>=i.x&&i.right>c.x){i.width=c.x-i.x-g;var T=this.viewer.clientArea.right-c.right;T=T>0?T:0,this.isWrapText=!0;var S=0;S=b?this.getMinWidth(b,e.width,e.height,i):e.width,this.isNeedDoIntermediateWrapping(T,u,i,e.width,e.paragraph,c,e,S,18)?(i.width=T,this.isWrapText=!0,(i.x+S>c.x||"Right"==u)&&(i.x=c.right,(i.width>S||"Right"==u)&&this.viewer.updateClientAreaForTextWrap(i))):(e.line.isFirstLine()&&0===e.indexInOwner&&"Square"===p&&Math.round(i.width)<=Math.round(S)&&n.containerWidget===d.line.paragraph.containerWidget?(i.x=a.x,i.y=c.bottom,i.width=a.width,i.height-=c.bottom-i.y):Math.round(i.width)<=Math.round(S)&&Math.round(i.x-m)!==Math.round(this.viewer.clientArea.x)&&(i.width=0),this.viewer.updateClientAreaForTextWrap(i))}"Both"!=u&&(this.isWrapText=!1)}}}return i},e.prototype.startAt=function(e,t){return"Footnote"===e.footnoteType?(this.startat=e.paragraph.bodyWidget.sectionFormat.initialFootNoteNumber,t=this.getFootEndNote(e.paragraph.bodyWidget.sectionFormat.footNoteNumberFormat,this.documentHelper.footnoteCollection.indexOf(e)+this.startat)):(this.startat=e.paragraph.bodyWidget.sectionFormat.initialEndNoteNumber,t=this.getFootEndNote(e.paragraph.bodyWidget.sectionFormat.endnoteNumberFormat,this.documentHelper.endnoteCollection.indexOf(e)+this.startat)),t},e.prototype.layoutFootEndNoteElement=function(e){this.isFootnoteContentChanged=!0;this.documentHelper.footnoteCollection.length;var t,i=this.documentHelper.footnoteCollection.indexOf(e),n=1;this.islayoutFootnote=!0;var r,o=new ae(this.viewer.clientArea.x,this.viewer.clientArea.y,this.viewer.clientArea.width,this.viewer.clientArea.height),s=new ae(this.viewer.clientActiveArea.x,this.viewer.clientActiveArea.y,this.viewer.clientActiveArea.width,this.viewer.clientActiveArea.height),a=e.paragraph.bodyWidget,l=!1,d=0;if(a.page.footnoteWidget)for(var h=0;h<a.page.footnoteWidget.childWidgets.length;h++){n=a.page.footnoteWidget.childWidgets.length;var c=this.documentHelper.footnoteCollection.indexOf(a.page.footnoteWidget.childWidgets[h].footNoteReference);if(c>i&&c-i==1){n=h;break}}if(e.isLayout=!0,"Footnote"===e.footnoteType){if(a.page.footnoteWidget&&a.page.footnoteWidget instanceof me)t=a.page.footnoteWidget;else{l=!0,(t=new me).footNoteType="Footnote",t.page=a.page;var p=new fe;p.characterFormat=new H,p.paragraphFormat=new P,p.index=0;var u=new we(p);p.childWidgets.push(u),t.childWidgets.push(p),d=this.documentHelper.textHelper.getParagraphMarkSize(p.characterFormat).Height}for(var g=0;g<e.blocks.length;g++){var m=e.blocks[g];this.isLayoutWhole&&(m.containerWidget=void 0),this.viewer.updateClientAreaForBlock(m,!0),m instanceof ve&&this.clearTableWidget(m,!0,!0),this.layoutBlock(m,0),d+=m.height,m.y=0,this.viewer.updateClientAreaForBlock(m,!1)}r=!1,d<=s.height&&(t.childWidgets.splice(n,0,e.blocks[0]),n++,l&&(a.page.footnoteWidget=t),t.height+=d,r=!0),this.viewer.clientActiveArea=s,r&&(this.viewer.clientActiveArea.height-=d,this.footnoteHeight+=d),this.viewer.clientArea=o}return r},e.prototype.layoutEndNoteElement=function(){var e=this.documentHelper.pages.length;if(this.documentHelper.endnoteCollection.length>0){for(var t=void 0,i=void 0,n=void 0,r=this.documentHelper.pages[e-1].bodyWidgets[0],o=0;o<this.documentHelper.endnoteCollection.length;o++){if(t=this.documentHelper.endnoteCollection[o],r.page.endnoteWidget instanceof me&&"Endnote"===r.page.endnoteWidget.footNoteType)i=r.page.endnoteWidget;else{n=!0,(i=new me).footNoteType="Endnote",i.page=r.page;var s=new fe;s.characterFormat=new H,s.paragraphFormat=new P,s.index=0;var a=new we(s);s.childWidgets.push(a),i.childWidgets.push(s)}for(var l=0;l<t.blocks.length;l++){var d=t.blocks[l];i.childWidgets.push(d)}n&&(r.page.endnoteWidget=i),i.height+=0}this.layoutfootNote(i)}},e.prototype.hasValidElement=function(e){var i=e.firstChild;if(i&&!t.isNullOrUndefined(this.documentHelper.selection))for(var n=i.children[0];n;){if(n instanceof xe&&(n=this.documentHelper.selection.getNextValidElementForField(n),!t.isNullOrUndefined(n)&&!n.line.paragraph.equals(e)))return!1;if(n instanceof Ie||n instanceof Ge)return!0;t.isNullOrUndefined(n)||(n=n.nextNode)}return!1},e.prototype.updateFieldText=function(e){var t=this.documentHelper.getFieldResult(e.fieldBegin,e.paragraph.bodyWidget.page);""!==t&&(e.text=t,this.documentHelper.textHelper.getTextSize(e,e.characterFormat))},e.prototype.checkLineWidgetWithClientArea=function(e,i){(e!==i.line||i.line===e&&t.isNullOrUndefined(i.nextElement)&&!i.line.isLastLine())&&(this.moveToNextLine(e),e!==i.line&&(this.isRTLLayout=!1)),i.line!==e&&this.viewer instanceof re&&this.viewer.clientActiveArea.height<i.height&&this.viewer.clientActiveArea.y!==this.viewer.clientArea.y?this.moveToNextPage(this.viewer,i.line):i.line===e&&t.isNullOrUndefined(i.nextElement)&&e.paragraph.lastChild===e&&!e.isLastLine()&&this.viewer.clientActiveArea.height>=0&&this.moveFromNextPage(e)},e.prototype.checkAndSplitTabOrLineBreakCharacter=function(e,t){var i=["\t","\v","\f"],n=W.indexOfAny(e,i);if(n>-1){var r=e[n];("\t"===r&&"\t"!==e||"\v"===r&&"\v"!==e||"\f"===r&&"\f"!==e)&&this.splitByLineBreakOrTab(this.viewer,t,n,r)}},e.prototype.splitTextByConsecutiveLtrAndRtl=function(e){for(var t=e.text,i=[],n=!1,r=[],o=-1,s="",a="",l="",d="",h=e.characterFormat.bidi,c=0;c<t.length;c++){var p=0,u=!1;h&&/^[0-9]+$/.test(t[c])?(d+=t[c],p=4):this.documentHelper.textHelper.containsSpecialCharAlone(t.charAt(c))?(p=2,(u=h||" "===t.charAt(c)&&""===l)&&(l+=t[c])):this.documentHelper.textHelper.isRTLText(t.charAt(c))?(n=!0,a+=t[c],p=1):s+=t[c],""!==d&&4!==p&&(i.push(d),r.push("Number"),d=""),""!==a&&1!==p&&(i.push(a),r.push("RTL"),a=""),""!==s&&0!==p&&(i.push(s),o=i.length-1,r.push("LTR"),s=""),""===l||2===p&&!u||(i.push(l),r.push("WordSplit"),l="")}if(""!==d?(i.push(d),r.push("Number")):""!==a?(i.push(a),r.push("RTL")):""!==s?(i.push(s),o=i.length-1,r.push("LTR")):""!==l&&(i.push(l),r.push("WordSplit")),n)for(c=1;c<i.length;c++)"WordSplit"===(g=r[c+0])&&1===i[c].length&&c+0+1<r.length&&"WordSplit"!==r[c+0-1]&&("Number"!==r[c+0-1]||this.isNumberNonReversingCharacter(i[c],h))&&r[c+0-1]===r[c+0+1]&&(i[c-1]=i[c-1]+i[c]+i[c+1],i.splice(c,1),i.splice(c,1),r.splice(c+0,1),r.splice(c+0,1),c--);else if(-1!==o)if(h)for(c=1;c<o;c++){var g=r[c+0];if("WordSplit"===g&&c<o&&"LTR"===r[c+0-1]){s="";for(m=c+1;m<=o;m++)s+=i[m],i.splice(m,1),r.splice(m+0),m--,o--;i[c-1]=i[c-1]+i[c]+s,i.splice(c,1),r.splice(c+0),c--,o--}}else(i=[]).push(t);else h||(i=[]).push(t);if(h)for(var m=1;m<i.length;m++){var f=r[m+0];"WordSplit"===f&&1===i[m].length&&m+0+1<r.length&&"WordSplit"!==r[m+0-1]&&("Number"!==r[m+0-1]||this.isNumberNonReversingCharacter(i[m],h))&&r[m+0-1]===r[m+0+1]?(i[m-1]=i[m-1]+i[m]+i[m+1],i.splice(m,1),i.splice(m,1),r.splice(m+0,1),r.splice(m+0),m--):"LTR"!==f||"Number"!==r[m+0-1]&&"LTR"!==r[m+0-1]||(i[m-1]=i[m-1]+i[m],r[m+0-1]="LTR",i.splice(m,1),r.splice(m+0,1),m--)}return i},e.prototype.isNumberNonReversingCharacter=function(e,t){return!(-1===",.:".indexOf(e[0])||"."===e[0]&&t)},e.prototype.updateSplittedText=function(e,t){var i="",n=e.line.children.indexOf(e);if(t.length>1)for(var r=0;r<t.length;r++)if(i=t[r],r>0){var o=new Ie;o.line=e.line,o.characterFormat.copyFormat(e.characterFormat),e.line.children.splice(n+r,0,o),e.revisions.length>0&&(this.updateRevisionForSpittedElement(e,o,!0),o.isMarkedForRevision=e.isMarkedForRevision),o.text=i}else e.text=i},e.prototype.moveFromNextPage=function(e){var t=e.nextLine;t&&-1===e.paragraph.childWidgets.indexOf(t)&&(t.paragraph.childWidgets.splice(t.indexInOwner,1),e.paragraph.childWidgets.push(t),t.paragraph=e.paragraph)},e.prototype.cutClientWidth=function(e){this.clearLineMeasures();var i=e.line;i.marginTop=0;for(var n=0,r=0;r<i.children.length;r++){var o=i.children[r];if(n+=o.width,e===o)break}var s=this.viewer.clientActiveArea.width-n<0;return e.line.paragraph.bodyWidget.floatingElements.length>0?(this.hasFloatingElement=!0,this.isXPositionUpdated=!0,!1):(s?e.previousElement&&this.cutClientWidth(e.previousElement):(this.viewer.cutFromLeft(this.viewer.clientActiveArea.x+n),"Justify"===e.line.paragraph.paragraphFormat.textAlignment&&e instanceof Ie&&this.splitTextElementWordByWord(e),t.isNullOrUndefined(e.nextElement)&&this.viewer.clientActiveArea.width>0&&!e.line.isLastLine()&&this.moveElementFromNextLine(i)),s)},e.prototype.layoutFieldCharacters=function(e){if(0===e.fieldType)!t.isNullOrUndefined(e.formFieldData)&&this.isInitialLoad&&this.checkAndUpdateFieldData(e),this.isFieldCode||t.isNullOrUndefined(e.fieldEnd)&&!e.hasFieldEnd||(this.documentHelper.fieldStacks.push(e),this.isFieldCode=!0,e.hasFieldEnd=!0);else if(this.documentHelper.fieldStacks.length>0)if(2===e.fieldType)(i=this.documentHelper.fieldStacks[this.documentHelper.fieldStacks.length-1]).fieldSeparator!==e||t.isNullOrUndefined(i.fieldEnd)&&!i.hasFieldEnd||(this.isFieldCode=!1);else{var i=this.documentHelper.fieldStacks[this.documentHelper.fieldStacks.length-1];e===i.fieldEnd&&(this.documentHelper.fieldStacks.pop(),this.isFieldCode=!1)}},e.prototype.checkAndUpdateFieldData=function(e){if(e.hasFieldEnd&&!t.isNullOrUndefined(e.fieldEnd)){if(t.isNullOrUndefined(e.fieldSeparator)){var i=new xe(2);i.fieldBegin=e,i.fieldEnd=e.fieldEnd,i.line=e.line,e.line.children.splice(e.fieldEnd.indexInOwner,0,i),e.fieldSeparator=i,e.fieldEnd.fieldSeparator=i}var n=e.fieldEnd.previousNode;if(n instanceof xe&&2===n.fieldType){var r=e.formFieldData;if(r instanceof Te){var o=new Ie;o.characterFormat=e.characterFormat.cloneFormat(),r.checked?o.text=String.fromCharCode(9745):o.text=String.fromCharCode(9744),"Auto"!==r.sizeType?o.characterFormat.fontSize=1.2*r.size:o.characterFormat.fontSize=1.2*o.characterFormat.fontSize,o.line=e.line;a=e.line.children.indexOf(e.fieldEnd);e.line.children.splice(a,0,o)}else if(r instanceof Se){var s=new Ie;s.characterFormat=e.characterFormat.cloneFormat(),s.line=e.line,r.dropdownItems.length>0?s.text=r.dropdownItems[r.selectedIndex]:s.text=this.documentHelper.textHelper.repeatChar(this.documentHelper.textHelper.getEnSpaceCharacter(),5);var a=e.line.children.indexOf(e.fieldEnd);e.line.children.splice(a,0,s)}}}},e.prototype.layoutEmptyLineWidget=function(e,i,n,r){var o=e.paragraphFormat,s=0,a=0;r=!t.isNullOrUndefined(r)&&r;var l,d=this.documentHelper.textHelper.getParagraphMarkSize(e.characterFormat).Height,h=this.getBeforeSpacing(e);if(e.childWidgets.length>0&&!r){if((l=e.childWidgets[0]).children.length>0){this.isBidiReLayout||!o.bidi&&!this.isContainsRtl(l)||this.reArrangeElementsForRtl(l,o.bidi);var c=l.isFirstLine(),p=l.isLastLine(),u=0;if(c&&(h=this.getBeforeSpacing(e),u=W.convertPointToPixel(o.firstLineIndent)),"Left"!==(F=o.textAlignment)&&this.viewer.textWrap&&("Justify"!==F||!p||"Justify"===F&&o.bidi)){var g=this.getSubWidth(l,"Justify"===F,a,u,p);s=g.subWidth,a=g.spaceCount}}}else l=i?this.addLineWidget(e):n;this.viewer instanceof re&&this.viewer.clientActiveArea.height<h+d&&this.viewer.clientActiveArea.y!==this.viewer.clientArea.y&&this.moveToNextPage(this.viewer,l);var m=this.getLineSpacing(e,d);!isNaN(this.maxTextHeight)&&d<this.maxTextHeight&&(d=this.maxTextHeight);var f=0,v=0,y=0,b=d,w=e.paragraphFormat.lineSpacingType;"Multiple"===w?m>d?v+=m-d:f+=m-d:"Exactly"===w?f+=m-(f+b+v):m>f+b+v&&(f+=m-(f+b+v)),f+=h,v+=W.convertPointToPixel(this.getAfterSpacing(e));for(var C=0;C<l.children.length;C++){var x=l.children[C];if(0===C&&x instanceof Ke){var F=e.paragraphFormat.textAlignment;"Right"===F?y=s:"Center"===F&&(y=s/2),x.margin=new de(y,f,0,v),x.line=l,l.height=f+b+v}}l.height=f+b+v,this.viewer.cutFromTop(this.viewer.clientActiveArea.y+l.height)},e.prototype.layoutListItems=function(e){this.isFieldCode||(!t.isNullOrUndefined(e.paragraphFormat)&&!t.isNullOrUndefined(e.paragraphFormat.listFormat)&&!t.isNullOrUndefined(this.documentHelper.getListById(e.paragraphFormat.listFormat.listId))&&e.paragraphFormat.listFormat.listLevelNumber>=0&&e.paragraphFormat.listFormat.listLevelNumber<9?(this.clearListElementBox(e),this.layoutList(e,this.documentHelper)):e.paragraphFormat.listFormat&&-1===e.paragraphFormat.listFormat.listId&&this.clearListElementBox(e))},e.prototype.layoutList=function(e,i){var n=i.getListById(e.paragraphFormat.listFormat.listId);this.viewer.updateClientWidth(-W.convertPointToPixel(e.paragraphFormat.firstLineIndent));var r=this.getListLevel(n,e.paragraphFormat.listFormat.listLevelNumber),o=e.childWidgets[0];t.isNullOrUndefined(o)&&(o=new we(e),e.childWidgets.push(o));var s=new Ke(r,!1);if(s.line=o,"Bullet"===r.listLevelPattern?s.text=r.numberFormat:s.text=this.getListNumber(e.paragraphFormat.listFormat),this.documentHelper.isIosDevice){var a=s.text;(a=""===a?"●":" "===a?"○":a)!==s.text&&(s.text=a)}i.textHelper.updateTextSize(s,e);var l;if(this.viewer instanceof re&&this.viewer.clientActiveArea.height<s.height&&this.viewer.clientActiveArea.y!==this.viewer.clientArea.y&&(l=!0),this.viewer.cutFromLeft(this.viewer.clientActiveArea.x+s.width),o.children.splice(0,0,s),"None"!==r.followCharacter){if(s=new Ke(r,!0),"Tab"===r.followCharacter){s.text="\t";var d=o.children.indexOf(s);s.width=this.getTabWidth(e,this.viewer,d,o,s)}else s.text=" ",i.textHelper.updateTextSize(s,e);this.viewer.cutFromLeft(this.viewer.clientActiveArea.x+s.width),o.children.splice(1,0,s),s.line=o}if(l)return this.moveToNextPage(this.viewer,o),void this.cutClientWidth(s);"None"!==r.followCharacter&&this.viewer.updateClientWidth(W.convertPointToPixel(e.paragraphFormat.firstLineIndent))},e.prototype.addBodyWidget=function(e,t){var i;return i=t||new pe,i.width=e.width,i.x=e.x,i.y=e.y,i},e.prototype.addListLevels=function(e){for(var t=e.levels.length;t<9;t++){var i=new _(e),n=t%3;"Bullet"===e.levels[0].listLevelPattern?(i.listLevelPattern="Bullet",i.numberFormat=0===n?"":1===n?" ":"",i.characterFormat.fontFamily=""===i.numberFormat?"Wingdings":"Symbol"):(i.listLevelPattern=this.getListLevelPattern(n),i.numberFormat="%"+(t+1).toString()+".",i.startAt=1,i.restartLevel=t),i.paragraphFormat=new P(void 0),i.paragraphFormat.leftIndent=48*(t+1),i.paragraphFormat.firstLineIndent=-24,e.levels.push(i)}},e.prototype.addSplittedLineWidget=function(e,i,n){if(this.isWrapText)return void(t.isNullOrUndefined(n)||(e.children.splice(i+1,0,n),n.line=e));var r=e.paragraph,o=[],s=r.childWidgets.indexOf(e);t.isNullOrUndefined(n)||o.push(n);for(var a=void 0,l=i+1;l<e.children.length;l++)o.push(e.children[l]);if(o.length>0){a=s===r.childWidgets.length-1?new we(r):r.childWidgets[s+1];for(var d=0;d<o.length;d++)o[d].line=a;e.children.splice(i+1,e.children.length-1),a.children=o.concat(a.children),-1===r.childWidgets.indexOf(a)&&r.childWidgets.splice(s+1,0,a)}},e.prototype.addElementToLine=function(e,t){t instanceof ze&&"Inline"!==t.textWrappingStyle||(this.isWrapText&&(this.isWrapText=!1,this.viewer.clientActiveArea.width=this.viewer.clientArea.right-this.viewer.clientActiveArea.x),this.viewer.cutFromLeft(this.viewer.clientActiveArea.x+t.width)),"Justify"===e.paragraphFormat.textAlignment&&t instanceof Ie&&this.splitTextElementWordByWord(t)},e.prototype.splitElementForClientArea=function(e,t){if(t.line.children.length>0){var i=t.previousElement,n=t.indexInOwner;t.line.children.length>1&&i&&this.viewer.clientActiveArea.x!==this.viewer.clientArea.x&&(n-=1),this.addSplittedLineWidget(t.line,n)}},e.prototype.splitByWord=function(e,t,i,n,r,o){var s=this.getSplitIndexByWord(this.viewer.clientActiveArea.width,n,r,o);if(s>0&&s<i.length){var a=e.children.indexOf(i),l=new Ie;n=n.substring(s),l.text=n," "===n[0]&&(s+=n.length-(n=W.trimStart(n)).length),l.characterFormat.copyFormat(i.characterFormat),l.width=this.documentHelper.textHelper.getWidth(l.text,o),l.trimEndWidth=l.width,i.text=i.text.substr(0,s),i.width-=l.width,i.trimEndWidth=i.width,i.revisions.length>0&&(this.updateRevisionForSpittedElement(i,l,!0),l.isMarkedForRevision=i.isMarkedForRevision),l.height=i.height,l.baselineOffset=i.baselineOffset,this.splitErrorCollection(i,l),this.addSplittedLineWidget(e,a,l),this.addElementToLine(t,i),0===i.width&&e.children.splice(a,1)}},e.prototype.splitErrorCollection=function(e,t){if(e.errorCollection.length>0){for(var i=[],n=e.ignoreOnceItems,r=0;r<e.errorCollection.length;r++)i.push(e.errorCollection[r]);for(var o=0;o<e.errorCollection.length;o++){var s=e.text.indexOf(e.errorCollection[o].text),a=e.errorCollection[o];s<0?(i.splice(0,1),t.errorCollection.push(a)):t.text.indexOf(a.text)>0&&t.errorCollection.push(a)}t.ignoreOnceItems=n,e.ignoreOnceItems=[],e.errorCollection=i}},e.prototype.splitByCharacter=function(e,t,i,n,r){var o=e.paragraph,s=this.getTextSplitIndexByCharacter(this.viewer.clientArea.width,this.viewer.clientActiveArea.width,i,n,r),a=0;if(s<t.length&&(a=this.documentHelper.textHelper.measureTextExcludingSpaceAtEnd(i.substring(0,s),r),i=i.substring(s)),a>this.viewer.clientActiveArea.width&&t.indexInOwner>0)return void this.addSplittedLineWidget(e,t.indexInOwner-1);var l=e.children.indexOf(t);if(s<t.length){var d=new Ie;d.text=i,d.errorCollection=t.errorCollection,t.text=t.text.substr(0,s),d.characterFormat.copyFormat(t.characterFormat),d.width=this.documentHelper.textHelper.getWidth(d.text,r),d.trimEndWidth=d.width,t.width-=d.width,t.trimEndWidth=t.width,d.height=t.height,d.baselineOffset=t.baselineOffset,e.children.splice(t.indexInOwner+1,0,d),t.revisions.length>0&&(this.updateRevisionForSpittedElement(t,d,s>0),d.isMarkedForRevision=t.isMarkedForRevision),this.addSplittedLineWidget(e,l),this.addElementToLine(o,t),0===t.width&&e.children.splice(l,1)}else this.addSplittedLineWidget(e,l),this.addElementToLine(o,t)},e.prototype.updateRevisionForSpittedElement=function(e,t,i,n){if(e.revisions.length>0)for(var r=0;r<e.revisions.length;r++){var o=e.revisions[r];if(i){t.revisions.push(o);var s=o.range.length-1;o.range[s]instanceof H?o.range.splice(s-1,0,t):(s=o.range.indexOf(e))<0?o.range.push(t):n?o.range.splice(s,0,t):o.range.splice(s+1,0,t)}else o.range.splice(o.range.length-1,1),o.range.push(t),t.revisions.push(o)}},e.prototype.splitTextElementWordByWord=function(e){var t=e.line,i=t.children.indexOf(e),n=i,r=e.padding.left;e.padding.left=0;var o,s=e.text;if(s.trim().indexOf(" ")>=0){t.children.splice(i,1),o=e.characterFormat;for(var a=e.length-W.trimStart(s).length;a<e.length&&0!==(a=this.getTextIndexAfterSpace(s,a))&&a!==e.length;)if(a<e.length){var l=new Ie,d=s.substring(0,a);" "===(s=s.substring(a)).substring(0,1)&&(a+=s.length-W.trimStart(s).length),l.text=d,l.characterFormat.copyFormat(e.characterFormat),l.line=t,l.width=this.documentHelper.textHelper.getWidth(l.text,o),l.trimEndWidth=l.width,l.height=e.height,l.baselineOffset=e.baselineOffset,t.children.splice(i,0,l),e.revisions.length>0&&(this.updateRevisionForSpittedElement(e,l,a>0,!0),l.isMarkedForRevision=e.isMarkedForRevision),e.text=s,e.width-=l.width,e.trimEndWidth=e.width,0===e.width&&-1!==t.children.indexOf(e)&&t.children.splice(t.children.indexOf(e),1),a=0,i++}e.text=s,t.children.splice(i,0,e)}t.children[n].padding.left=r},e.prototype.splitTextForClientArea=function(e,t,i,n,r){var o=e.paragraph,s=!0,a=-1;if(" "!==i.substring(0,1)){var l=n,d=0;if(d=W.trimEnd(i).indexOf(" ")+1,(a=d)>0&&(l=this.documentHelper.textHelper.measureTextExcludingSpaceAtEnd(i.slice(0,a),r)),this.viewer.clientActiveArea.width<l&&(s=this.checkPreviousElement(e,e.children.indexOf(t),r)))return}else a=1;n<=this.viewer.clientActiveArea.width?this.addElementToLine(o,t):s&&(a>0||-1!==i.indexOf(" "))?this.splitByWord(e,o,t,i,n,r):this.splitByCharacter(e,t,i,n,r)},e.prototype.splitByLineBreakOrTab=function(e,t,i,n){var r=t.line.children.indexOf(t),o=t.text,s=o.substring(i),a="\t"===n?new Oe:new Ie;if(a.line=t.line,a.characterFormat.copyFormat(t.characterFormat),t.line.children.splice(r+1,0,a),i>0&&1===s.length)a.text=o.substring(i),t.text=o.substring(0,i);else if(i>0){a.text=n;var l=new Ie;l.line=t.line,l.text=o.substring(i+1),l.characterFormat.copyFormat(t.characterFormat),t.line.children.splice(r+2,0,l),t.text=o.substring(0,i)}else""!==s&&(a.text=o.substring(i+1),t.text=n)},e.prototype.moveToNextLine=function(e){var t=e.paragraph,i=t.paragraphFormat,n=e.isFirstLine(),r=e.isLastLine(),o=0,s=0,a=0,l=0,d=0,h=0;if(this.updateLineWidget(e),o=this.maxTextHeight,s=o-this.maxTextBaseline,n&&(l=this.getBeforeSpacing(t),h=W.convertPointToPixel(i.firstLineIndent)),r&&(a=W.convertPointToPixel(this.getAfterSpacing(t))),this.isBidiReLayout||!i.bidi&&!this.isContainsRtl(e)||(this.reArrangeElementsForRtl(e,i.bidi),this.isRTLLayout=!0),isNaN(this.maxTextHeight)){var c=this.documentHelper.textHelper.measureText("a",t.characterFormat);s=(o=c.Height)-c.BaselineOffset}else s=(o=this.maxTextHeight)-this.maxTextBaseline;d=this.getLineSpacing(t,o),"Exactly"===i.lineSpacingType&&d<s+this.maxBaseline&&(d=s+this.maxBaseline);var p=0,u=0,g=i.textAlignment;if("Left"!==g&&this.viewer.textWrap&&("Justify"!==g||!r||"Justify"===g&&i.bidi)){var m=this.getSubWidth(e,"Justify"===g,u,h,r);p=m.subWidth,u=m.spaceCount}for(var f=!1,v=i.lineSpacingType,y=0;y<e.children.length;y++){var b=0,w=0,C=0,x=e.children[y];if(!(x instanceof ze&&"Inline"!==x.textWrappingStyle)){var F=this.alignLineElements(x,b,w,s,f,p,g,u,y===e.children.length-1);b=F.topMargin,w=F.bottomMargin,f=F.addSubWidth,u=F.whiteSpaceCount,"Multiple"===v?d>o?w+=d-o:b+=d-o:"Exactly"===v?b+=d-(b+x.height+w):d>b+x.height+w&&(b+=d-(b+x.height+w)),b+=l,w+=a,(0===y||!(x instanceof ze&&"Inline"!==x.textWrappingStyle)&&x.previousElement instanceof ze&&"Inline"!==x.previousElement.textWrappingStyle)&&(e.height=b+x.height+w,"Right"===g||"Justify"===g&&i.bidi&&r?C=p:"Center"===g&&(C=p/2)),x.margin=new de(C,b,0,w),x.line=e}}this.checkInbetweenShapeOverlap(e),this.viewer.cutFromTop(this.viewer.clientActiveArea.y+e.height)},e.prototype.checkInbetweenShapeOverlap=function(e){var t=this;if(!(e.paragraph.containerWidget instanceof _e)&&e.paragraph.bodyWidget){var i,n=this.getLineY(e),r=e.paragraph.isInsideTable;e.paragraph.bodyWidget.floatingElements.sort(function(e,t){return e.y-t.y}),e.paragraph.bodyWidget.floatingElements.forEach(function(o){if(!r||o.line.paragraph.isInsideTable){var s=new ae(e.paragraph.x,t.viewer.clientActiveArea.y,e.paragraph.width,e.height),a=new ae(o.x,o.y-o.distanceTop,o.width,o.height);if(!(t.isRelayout&&!t.isRelayoutOverlap&&t.viewer.documentHelper.selection.isExistAfter(o.line.paragraph,e.paragraph)||t.isRelayout&&t.isRelayoutOverlap&&t.viewer.documentHelper.selection.isExistAfter(o.line.paragraph,t.endOverlapWidget))){var l="TopAndBottom"===o.textWrappingStyle;i&&l&&i.y+i.height+i.distanceBottom+e.height>o.y-o.distanceTop&&i.y-i.distanceTop<o.y-o.distanceTop&&o.y+o.height+o.distanceBottom>i.y+i.height+i.distanceBottom?(i=o,e.marginTop=o.y+o.height+o.distanceBottom-n):l&&!i&&s.isIntersecting(a)&&(i=o,e.marginTop=o.y+o.height+o.distanceBottom-n)}}}),i?this.viewer.cutFromTop(i.y+i.height+i.distanceBottom):this.isRelayoutOverlap&&(e.marginTop=0)}},e.prototype.getLineY=function(e){var t=e.paragraph,i=t.y;if(!t.isEmpty())for(var n=t.firstChild;n!==e;)i=i+n.height+n.marginTop,n=n.nextLine;return i},e.prototype.updateLineWidget=function(e){for(var t=0;t<e.children.length;t++){var i=e.children[t];i instanceof ze&&"Inline"!==i.textWrappingStyle||(i instanceof Ie||i instanceof Ke?(this.maxTextHeight<i.height&&(this.maxTextHeight=i.height,this.maxTextBaseline=i.baselineOffset),this.maxBaseline<this.maxTextBaseline&&(this.maxBaseline=this.maxTextBaseline)):this.maxBaseline<i.height&&(this.maxBaseline=i.height))}},e.prototype.moveToNextPage=function(e,i,n){this.isRelayoutOverlap&&this.endOverlapWidget!==i.paragraph&&(i=this.endOverlapWidget.childWidgets[0]);var r=i.paragraph;if(r&&!(r.containerWidget instanceof me)){var o=0;if(r instanceof me)return;t.isNullOrUndefined(i)||((o=r.childWidgets.indexOf(i))>0||n)&&(r.height=e.clientActiveArea.y-r.y),r.bodyWidget instanceof me||void 0===r.bodyWidget.page.footnoteWidget||this.layoutfootNote(r.bodyWidget.page.footnoteWidget);var s=this.moveBlocksToNextPage(r);if(this.viewer.updateClientArea(s.sectionFormat,s.page),this.viewer.updateClientAreaForBlock(r,!0),o>0){if(i.isLastLine()&&n)return;var a=void 0;a=s.firstChild instanceof fe&&s.firstChild.equals(r)?s.firstChild:new fe,(a=this.addParagraphWidget(this.viewer.clientActiveArea,a)).index=r.index;for(var l=0,d=o;d<r.childWidgets.length;d++){var h=r.childWidgets[d];h.paragraph=a,a.childWidgets.splice(l,0,h),h.paragraph=a,l++}a.paragraphFormat=r.paragraphFormat,a.characterFormat=r.characterFormat,r.childWidgets.splice(o),r=a}else n||r.containerWidget.removeChild(r.indexInOwner);if(!(n||(-1===s.childWidgets.indexOf(r)&&s.childWidgets.splice(0,0,r),r.containerWidget=s,this.viewer.updateClientAreaLocation(r,this.viewer.clientActiveArea),0!==o||i.children[0]instanceof Ke))){var c=-W.convertPointToPixel(r.paragraphFormat.firstLineIndent);this.viewer.updateClientWidth(c)}}if(this.isRelayoutOverlap&&this.endOverlapWidget){for(var p=this.endOverlapWidget.previousRenderedWidget,u=i.paragraph;u;)u.floatingElements.forEach(function(e){-1!==p.bodyWidget.floatingElements.indexOf(e)&&(p.bodyWidget.floatingElements.splice(p.bodyWidget.floatingElements.indexOf(e),1),i.paragraph.bodyWidget.floatingElements.push(e))}),u=u!==this.endOverlapWidget?u.nextWidget:void 0;this.layoutStartEndBlocks(this.startOverlapWidget,this.endOverlapWidget),this.startOverlapWidget=void 0,this.viewer.clientActiveArea.height=this.viewer.clientActiveArea.bottom-this.endOverlapWidget.y,this.viewer.clientActiveArea.y=this.endOverlapWidget.y}},e.prototype.layoutStartEndBlocks=function(e,t){var i=e;for(this.viewer.clientActiveArea.height=this.viewer.clientActiveArea.bottom-e.y,this.viewer.clientActiveArea.y=e.y;i;)i instanceof fe?this.layoutParagraph(i,0):this.layoutTable(i,0),i=i!==t?i.nextWidget:void 0},e.prototype.alignLineElements=function(e,i,n,r,o,s,a,l,d){if(e.width>0&&(e instanceof Ie||e instanceof Ke)){var h=e instanceof Ie?e:void 0,c=e instanceof Ie?h.baselineOffset:e.baselineOffset;if(i+=this.maxBaseline-c,n+=r-(e.height-c),!t.isNullOrUndefined(h)&&"Justify"===a&&l>0){var p=h.width,u=h.text;if(o||(o=(u=W.trimStart(u)).length>0),o){var g=u.length-W.removeSpace(u).length;d&&(g-=u.length-W.trimEnd(u).length),l<g&&(p=this.documentHelper.textHelper.measureTextExcludingSpaceAtEnd(u,h.characterFormat),g=l),g>0&&(h.width=p+s*g,l-=g)}}}else o=!0,i+=this.maxBaseline-e.height,n+=r;return{topMargin:i,bottomMargin:n,addSubWidth:o,whiteSpaceCount:l}},e.prototype.updateWidgetToPage=function(e,i){if(i.isInsideTable){var n=i.associatedCell;if(i.height=e.clientActiveArea.y-i.y,t.isNullOrUndefined(i.associatedCell)||t.isNullOrUndefined(i.associatedCell.ownerRow)||t.isNullOrUndefined(i.associatedCell.ownerRow.rowFormat))return;"Exactly"===i.associatedCell.ownerRow.rowFormat.heightType?n.height=W.convertPointToPixel(i.associatedCell.ownerRow.rowFormat.height):[n].length<=1&&"AtLeast"===i.associatedCell.ownerRow.rowFormat.heightType?n.height=Math.max(W.convertPointToPixel(i.associatedCell.ownerRow.rowFormat.height),this.getCellContentHeight(n)):n.height=n.height+i.height,i.containerWidget=n}else(!i.isEndsWithPageBreak||e instanceof oe)&&(i.height=e.clientActiveArea.y-i.y);this.isRelayoutFootnote&&i.bodyWidget instanceof me&&(i.isInsideTable||(i.containerWidget.height+=i.height),this.shiftFootnoteChildLocation(i.bodyWidget,this.viewer)),i.bodyWidget instanceof ue&&(i.isInsideTable||(i.containerWidget.height+=i.height),this.viewer.owner.enableHeaderAndFooter&&-1!==i.bodyWidget.headerFooterType.indexOf("Footer")&&this.shiftFooterChildLocation(i.bodyWidget,this.viewer)),e instanceof oe&&i.containerWidget instanceof pe&&(i.containerWidget.height+=i.height)},e.prototype.shiftFooterChildLocation=function(e,i){var n=e.page.bodyWidgets[0].sectionFormat.pageHeight;if(-1!==e.headerFooterType.indexOf("Footer")){var r,o=e.page.bodyWidgets[0].sectionFormat.footerDistance,s=W.convertPointToPixel(n-o);e.y+e.height>s?r=s-(e.y+e.height):e.y+e.height<s&&(r=e.y+e.height-s),t.isNullOrUndefined(r)||(r=s-(e.y+e.height),this.shiftChildLocation(r,e),i.clientActiveArea.y+=r)}},e.prototype.shiftFootnoteChildLocation=function(e,i){var n,r=e.page.bodyWidgets[0].sectionFormat.pageHeight,o=(e.page.bodyWidgets[0].sectionFormat.footerDistance,e.page.bodyWidgets[0].sectionFormat.bottomMargin),s=W.convertPointToPixel(r-o);e.y+e.height>s?n=s-(e.y+e.height):e.y+e.height<s&&(n=e.y+e.height-s),t.isNullOrUndefined(n)||(n=s-(e.y+e.height),this.shiftChildLocation(n,e),i.clientActiveArea.y+=n)},e.prototype.checkPreviousElement=function(e,t,i){e.paragraph;for(var n=!1,r=0,o=t-1;o>=0;o--){var s=e.children[o];if(s instanceof Ie&&s.width>0){var a=s.text;if(r=o,a.length>0&&" "===a[a.length-1]){if(o===t-1)return this.addSplittedLineWidget(e,t-1),!0;n=!0;break}if("\t"===a)return!1;if(a.indexOf(" ")>=0){n=!0;var l=a.lastIndexOf(" ")+1,d=new Ie;d.text=a.substr(l),d.characterFormat.copyFormat(s.characterFormat),s.revisions.length>0&&(this.updateRevisionForSpittedElement(s,d,l>0),d.isMarkedForRevision=s.isMarkedForRevision),s.text=a.substr(0,l),this.documentHelper.textHelper.getTextSize(d,i),s.width-=d.width,s.height=d.height,0===s.width&&e.children.splice(o,1),e.children.splice(o+1,0,d);break}}else if(!(s instanceof Ke||s instanceof xe||s instanceof Ie&&0===s.width)){r=o,n=!0;break}}if(n&&++r<e.children.length){for(var h=0,o=r;o<e.children.length;o++)h+=e.children[o].width,this.addSplittedLineWidget(e,o-1),o--;this.viewer.updateClientWidth(h)}return n},e.prototype.clearListElementBox=function(e){if(0!==e.childWidgets.length){var i=e.childWidgets[0];if(!t.isNullOrUndefined(i.children)){for(n=i.children.length-1;n>0&&i.children[n]instanceof Ke;n--)i.children.splice(n,1);for(var n=0;n<i.children.length&&i.children[n]instanceof Ke;n++)i.children.splice(n,1),n--}}},e.prototype.getListNumber=function(e,i){var n=this.documentHelper.getListById(e.listId),r=e.listLevelNumber,o=this.getListLevel(n,e.listLevelNumber),s=t.isNullOrUndefined(n.levelOverrides)?void 0:n.levelOverrides[r];if(!t.isNullOrUndefined(s)&&-1===this.documentHelper.renderedLevelOverrides.indexOf(s)&&t.isNullOrUndefined(s.overrideListLevel)&&(this.documentHelper.renderedLevelOverrides.push(s),this.documentHelper.renderedLists.containsKey(this.documentHelper.getAbstractListById(n.abstractListId)))){var a=this.documentHelper.renderedLists.get(this.documentHelper.getAbstractListById(n.abstractListId));a.containsKey(r)&&a.remove(r)}return t.isNullOrUndefined(i)&&this.updateListValues(n,r),this.getListText(n,r,o)},e.prototype.getListStartValue=function(e,i){var n=t.isNullOrUndefined(i.levelOverrides)?void 0:i.levelOverrides[e];if(!t.isNullOrUndefined(n)&&t.isNullOrUndefined(n.overrideListLevel))return n.startAt;var r=this.getListLevel(i,e);return t.isNullOrUndefined(r)?0:r.startAt},e.prototype.updateListValues=function(e,t){if(this.documentHelper.renderedLists.containsKey(this.documentHelper.getAbstractListById(e.abstractListId))){var i=this.documentHelper.renderedLists.get(this.documentHelper.getAbstractListById(e.abstractListId));if(i.containsKey(t)){r=i.get(t);i.set(t,r+1);for(n=t+1;n<this.documentHelper.getAbstractListById(e.abstractListId).levels.length;){s=this.getListLevel(e,n);i.containsKey(n)&&s.restartLevel>t&&i.remove(n),n++}}else{for(var n=t;!i.containsKey(n-1)&&n>0;){s=this.getListLevel(e,n-1);i.add(n-1,this.getListStartValue(n-1,e)),n--}var r=this.getListStartValue(t,e);i.add(t,r)}}else{var o=new g;this.documentHelper.renderedLists.add(this.documentHelper.getAbstractListById(e.abstractListId),o);for(var s=this.getListLevel(e,t),a=0;a<=t;a++)o.add(a,this.getListStartValue(a,e))}},e.prototype.getListText=function(e,i,n){var r=n.numberFormat;if(this.documentHelper.renderedLists.containsKey(this.documentHelper.getAbstractListById(e.abstractListId)))for(var o=this.documentHelper.renderedLists.get(this.documentHelper.getAbstractListById(e.abstractListId)),s=o.keys,a=0;a<s.length;a++){var l=s[a],d="%"+(l+1).toString(),h=this.getListLevel(e,l);if(r.match(d)&&r.match((i+1).toString())){if(l>i)return"";r=o.containsKey(l)&&!t.isNullOrUndefined(h)?r.replace(d,this.getListTextListLevel(h,o.get(l))):r.replace(d,"0")}else if(r.match(d)&&i>0)return h=this.getListLevel(e,s[i]),this.getListTextListLevel(h,o.get(i))+"."}return r},e.prototype.getAsLetter=function(e){var t=e/26,i=e%26;0===i&&(i=26,t--);for(var n=String.fromCharCode(64+i),r="";t>=0;)r+=n.toString(),t--;return r},e.prototype.getListTextListLevel=function(e,t){switch(e.listLevelPattern){case"UpRoman":return this.getAsRoman(t).toUpperCase();case"LowRoman":return this.getAsRoman(t).toLowerCase();case"UpLetter":return this.getAsLetter(t).toUpperCase();case"LowLetter":return this.getAsLetter(t).toLowerCase();case"Arabic":return t.toString();case"LeadingZero":return this.getAsLeadingZero(t);case"Number":case"OrdinalText":case"Ordinal":case"FarEast":case"Special":return t.toString();default:return""}},e.prototype.getFootEndNote=function(e,t){switch(e){case"UpperCaseRoman":return this.getAsRoman(t).toUpperCase();case"LowerCaseRoman":return this.getAsRoman(t).toLowerCase();case"UpperCaseLetter":return this.getAsLetter(t).toUpperCase();case"LowerCaseLetter":return this.getAsLetter(t).toLowerCase();default:return t.toString()}},e.prototype.generateNumber=function(e,t,i){for(var n="";e>=t;)e-=t,n+=i,this.value=e;return n.toString()},e.prototype.getAsLeadingZero=function(e){return e<10?"0"+e.toString():e.toString()},e.prototype.getAsRoman=function(e){var t="";return this.value=e,t+=this.generateNumber(this.value,1e3,"M"),t+=this.generateNumber(this.value,900,"CM"),t+=this.generateNumber(this.value,500,"D"),t+=this.generateNumber(this.value,400,"CD"),t+=this.generateNumber(this.value,100,"C"),t+=this.generateNumber(this.value,90,"XC"),t+=this.generateNumber(this.value,50,"L"),t+=this.generateNumber(this.value,40,"XL"),t+=this.generateNumber(this.value,10,"X"),t+=this.generateNumber(this.value,9,"IX"),t+=this.generateNumber(this.value,5,"V"),t+=this.generateNumber(this.value,4,"IV"),(t+=this.generateNumber(this.value,1,"I")).toString()},e.prototype.getListLevel=function(e,i){if(!t.isNullOrUndefined(e)){var n=this.documentHelper.getAbstractListById(e.abstractListId);!t.isNullOrUndefined(e)&&n.levels.length<=i&&i>=0&&i<9&&this.addListLevels(n);var r=void 0;if(!t.isNullOrUndefined(e.levelOverrides)&&!t.isNullOrUndefined(r=e.levelOverrides[i])&&!t.isNullOrUndefined(r.overrideListLevel))return r.overrideListLevel;if(!t.isNullOrUndefined(n)&&i>=0&&i<n.levels.length)return n.levels[i]}},e.prototype.getTabWidth=function(e,i,n,r,o){var s=o?this.documentHelper.textHelper.getTextSize(o,o.characterFormat):0,a=0,l=!1,d=e.paragraphFormat.getUpdatedTabs(),h=!1,c=e.bodyWidget.sectionFormat,p=W.convertPointToPixel(c.leftMargin);if(!t.isNullOrUndefined(e.paragraphFormat.listFormat.listLevel)&&!t.isNullOrUndefined(e.paragraphFormat.listFormat.listLevel.paragraphFormat)){var u=e.paragraphFormat.listFormat.listLevel.paragraphFormat;e.paragraphFormat.leftIndent!==u.leftIndent&&(h=!0)}var g=0,m=i.clientActiveArea.x,f=W.convertPointToPixel(e.paragraphFormat.firstLineIndent),v=W.convertPointToPixel(e.paragraphFormat.leftIndent);if(!t.isNullOrUndefined(o)&&r.isFirstLine()?(g=this.viewer.clientArea.x+f,h&&(m+=f)):g=this.viewer.clientArea.x,m<g||o instanceof Ke&&r.isFirstLine()&&v>0&&f<0)return i.clientArea.x-i.clientActiveArea.x;var y=i.clientActiveArea.x-(i.clientArea.x-W.convertPointToPixel(e.paragraphFormat.leftIndent)),b=W.convertPointToPixel(this.documentHelper.defaultTabWidth),w=!1;if(0===d.length&&(y>0&&b>y&&h||b===this.defaultTabWidthPixel&&b>y))return b-y;if(d.length>0)for(var C=0;C<d.length;C++){var x=d[C],F=W.convertPointToPixel(d[C].position);if(w=p+F+s>i.clientArea.x,Math.floor(y+s)<=F){if(l=!0,"Left"===x.tabJustification||"List"===x.tabJustification){a=F,o instanceof Oe&&(o.tabLeader=d[C].tabLeader,o.tabText="");break}var P=F-y,T=this.getRightTabWidth(o.indexInOwner+1,r,e);if(T<P)if("Right"===x.tabJustification){b=P-T;var S=W.convertPointToPixel(e.rightIndent),I=this.viewer.clientActiveArea.width+S-b;this.viewer.clientActiveArea.width+=S,I<0?b+=I-T:T>I&&(b-=T-I)}else b=P-T/2;else b="Center"===x.tabJustification&&T/2<P?P-T/2:"Right"===x.tabJustification?0:s;a=y,o instanceof Oe&&(o.tabLeader=d[C].tabLeader,o.tabText="");break}}if(!l){var N=100*Math.round(y)%(100*Math.round(b))/100;a=((Math.round(y)-N)/Math.round(b)+1)*b}return w&&v>0&&i.clientArea.x>m?i.clientArea.x-m:a-y>0?a-y:b},e.prototype.getRightTabWidth=function(e,t,i){for(var n=0,r=!1,o=t.children[e];o;){if(o instanceof xe||o instanceof ke||r?(o instanceof xe&&(0===o.fieldType?r=!0:2===o.fieldType&&(r=!1)),o.width=0):o instanceof Ie&&this.documentHelper.textHelper.getTextSize(o,o.characterFormat),o instanceof Ie&&"\t"===o.text)return n;n+=o.width,o=o.nextNode}return n},e.prototype.getSplitIndexByWord=function(e,t,i,n){for(var r=0,o=t.length;r<o;){var s=this.getTextIndexAfterSpace(t,r);0!==s&&s!==o||(s=o-1);var a=i;if((s<o-1||s===o-1&&" "===t[s-1])&&r!==s&&(a=this.documentHelper.textHelper.measureTextExcludingSpaceAtEnd(t.slice(0,s),n)),!(a<=e)){0===r&&" "===t[0]&&(r=this.getTextIndexAfterSpace(t,0));break}r=s}return r},e.prototype.getTextSplitIndexByCharacter=function(e,t,i,n,r){for(var o=i.length,s=0;s<o;s++){var a=n;if(s+1<o&&(a=this.documentHelper.textHelper.measureTextExcludingSpaceAtEnd(i.substring(0,s+1),r)),a>t)return 0===s&&a>e?o>1&&" "===i[1]?this.getTextIndexAfterSpace(i,1):1:s}return 0},e.prototype.getSubWidth=function(e,t,i,n,r){for(var o=0,s=!0,a="",l=!1,d=e.children.length-1;d>=0;d--){var h=e.children[d];if(h.width>0&&h instanceof Ie){var c=h.text;a=c+a,!s||""===c.trim()&&"\t"!==c?s||(o+=h.width):(W.endsWith(c)?o+=this.documentHelper.textHelper.measureTextExcludingSpaceAtEnd(c,h.characterFormat):o+=h.width,s=!1)}else{if(a="a"+a,s=!1,h instanceof ze&&"Inline"!==h.textWrappingStyle)continue;o+=h.width}t?o+=h.padding.left:o=Math.round(o+h.padding.left),h.padding.left>0&&(l=!0)}i=(a=a.trim()).length-W.removeSpace(a).length;var p=this.viewer.clientArea.width-n-o;return p<=0||0===i&&t&&!e.paragraph.paragraphFormat.bidi?(i=0,p=0):t&&(!r&&i>0?p/=i:i=0),l&&(p=0),{subWidth:p,spaceCount:i}},e.prototype.getBeforeSpacing=function(e){var t=0;if(e.previousWidget instanceof fe&&!this.documentHelper.dontUseHtmlParagraphAutoSpacing){var i=this.getAfterSpacing(e.previousWidget);i<e.paragraphFormat.beforeSpacing&&(t=e.paragraphFormat.beforeSpacing-i)}else t=e.paragraphFormat.beforeSpacing;return this.isSameStyle(e,!1)?0:W.convertPointToPixel(t)},e.prototype.getAfterSpacing=function(e){var t=e.paragraphFormat.afterSpacing;return this.isSameStyle(e,!0)?0:t},e.prototype.getLineSpacing=function(e,i){if(t.isNullOrUndefined(e.paragraphFormat))return 0;var n=0;switch(e.paragraphFormat.lineSpacingType){case"AtLeast":case"Exactly":n=e.paragraphFormat.lineSpacing;break;default:n=e.paragraphFormat.lineSpacing*i}return n},e.prototype.isParagraphFirstLine=function(e,i){var n=e;return!(!t.isNullOrUndefined(n.childWidgets)&&0!==n.childWidgets.indexOf(i))&&(!(i.children.length>0&&!t.isNullOrUndefined(e.previousWidget)&&e.previousWidget instanceof fe)||i.paragraph.index!==e.previousWidget.index)},e.prototype.isParagraphLastLine=function(e){var t=e.line.paragraph,i=t.childWidgets[t.childWidgets.length-1],n=i.children[i.children.length-1];return e===n&&(n instanceof xe||!(n instanceof Ie&&"\v"===n.text))},e.prototype.getTextIndexAfterSpace=function(e,t){var i=e.length,n=0,r=n=e.indexOf(" ",t)+1;if(0===r||r===i)return r;for(;" "===e[r]&&++r!==i;);return r},e.prototype.moveNextWidgetsToTable=function(e,t,i){var n=i?t[t.length-2]:t[t.length-1],r=n.indexInOwner,o=e[e.length-1];i&&(r+=1);for(var s=n.containerWidget.childWidgets.splice(r),a=0;a<s.length;a++)o.childWidgets.push(s[a]),s[a].containerWidget=o},e.prototype.addTableCellWidget=function(e,i,n,r){var o=0,s=0,a=0,l=n,d=0,h=r;t.isNullOrUndefined(e.cellFormat)||(e.cellFormat.containsMargins()?(a=t.isNullOrUndefined(e.cellFormat.leftMargin)?W.convertPointToPixel(e.ownerTable.tableFormat.leftMargin):W.convertPointToPixel(e.cellFormat.leftMargin),d=t.isNullOrUndefined(e.cellFormat.rightMargin)?W.convertPointToPixel(e.ownerTable.tableFormat.rightMargin):W.convertPointToPixel(e.cellFormat.rightMargin)):(a=0===e.columnIndex&&e.ownerRow.rowFormat.hasValue("leftMargin")?W.convertPointToPixel(e.ownerRow.rowFormat.leftMargin):W.convertPointToPixel(e.ownerTable.tableFormat.leftMargin),d=e.columnIndex===e.ownerTable.tableHolder.columns.length-1&&e.ownerRow.rowFormat.hasValue("rightMargin")?W.convertPointToPixel(e.ownerRow.rowFormat.rightMargin):W.convertPointToPixel(e.ownerTable.tableFormat.rightMargin))),e.margin=new de(a,l,d,h);var c=e.cellFormat.cellWidth;c>e.cellFormat.preferredWidth&&0!==e.cellFormat.preferredWidth&&"Percent"!==e.cellFormat.preferredWidthType&&(c=e.cellFormat.preferredWidth),e.width=W.convertPointToPixel(c),t.isNullOrUndefined(e.previousWidget)||(o=e.previousWidget.columnIndex+e.previousWidget.cellFormat.columnSpan),s=t.isNullOrUndefined(e.ownerTable)||t.isNullOrUndefined(e.ownerTable.tableFormat)?0:W.convertPointToPixel(e.ownerTable.tableFormat.cellSpacing);var p=0;o<e.columnIndex&&(p=W.convertPointToPixel(e.ownerTable.tableHolder.getPreviousSpannedCellWidth(o,e.columnIndex)),0===o&&(p-=s/2)),e.x=i.x+p+e.margin.left,e.y=i.y+e.margin.top+s,e.width=e.width-e.margin.left-e.margin.right,s>0&&(e.x+=s,1===e.ownerTable.tableHolder.columns.length?e.width-=2*s:0===e.columnIndex||e.columnIndex===e.ownerTable.tableHolder.columns.length-1?e.width-=2*s-s/2:e.width-=s);var u=W.convertPointToPixel(be.getCellLeftBorder(e).getLineWidth()),g=W.convertPointToPixel(be.getCellRightBorder(e).getLineWidth());e.leftBorderWidth=e.ownerTable.isBidiTable?g:u;var m="None"===e.cellFormat.borders.left.lineStyle,f="None"===e.cellFormat.borders.right.lineStyle;e.x+=m?e.leftBorderWidth>0?0:e.leftBorderWidth:0,e.width-=m?e.leftBorderWidth>0?0:e.leftBorderWidth:0;e.ownerTable.isBidiTable?e.cellIndex:(e.cellIndex,e.ownerRow.childWidgets.length);return(s>0||e.columnIndex===e.ownerTable.tableHolder.columns.length-1||e.columnIndex===e.containerWidget.childWidgets.length-1&&e.cellFormat.columnSpan>1)&&(e.rightBorderWidth=e.ownerTable.isBidiTable?u:g,e.ownerTable.tableFormat.allowAutoFit||(e.width-=e.rightBorderWidth)),e.margin.right+=f?0:e.rightBorderWidth,e},e.prototype.addWidgetToTable=function(e,i,n,r,o,s){var a=i[0],l=a.childWidgets.length,d=void 0,h=n.indexOf(r);if(h>0?d=n[h-1]:r.previousRenderedWidget instanceof ye&&r.previousRenderedWidget.ownerTable.equals(r.ownerTable)&&(d=r.previousRenderedWidget),!t.isNullOrUndefined(d)){if(a=d.containerWidget,l=a.childWidgets.indexOf(d)+1,Math.round(r.y)!==Math.round(d.y+d.height)){var c=i.indexOf(a);c+1>=i.length&&this.addTableWidget(e.clientActiveArea,i,!0),l=(a=i[c+1]).childWidgets.length}h>0&&(l=0)}this.updateRowHeightBySpannedCell(a,r,l),this.updateRowHeightByCellSpacing(i,r,e),r.containerWidget&&r.containerWidget!==a&&-1!==r.containerWidget.childWidgets.indexOf(r)&&r.containerWidget.childWidgets.splice(r.containerWidget.childWidgets.indexOf(r),1),-1===a.childWidgets.indexOf(r)&&a.childWidgets.splice(l,0,r),r.containerWidget=a,a.height=a.height+r.height,a.isBidiTable&&r.shiftWidgetForRtlTable(this.viewer.clientArea,a,r),this.viewer instanceof re&&(t.isNullOrUndefined(a.containerWidget)||!(a.containerWidget.childWidgets.indexOf(a)>=0)||a.containerWidget instanceof ue||(a.containerWidget.height+=r.height)),this.updateHeightForRowWidget(e,!1,i,n,r,!1,o,s),e.cutFromTop(r.y+r.height)},e.prototype.updateRowHeightBySpannedCell=function(e,i,n){var r=1;if(0===e.childWidgets.length||0===n)return void this.updateRowHeight(i,i);for(s=0;s<i.childWidgets.length;s++){var o=i.childWidgets[s];r=t.isNullOrUndefined(o)||t.isNullOrUndefined(o.cellFormat)?r:o.cellFormat.rowSpan,this.updateSpannedRowCollection(r,i,o)}if(!t.isNullOrUndefined(i.ownerTable))for(var s=0;s<i.ownerTable.spannedRowCollection.length;s++)if(i.ownerTable.spannedRowCollection.keys[s]===i.index){for(var a=0;a<n;a++){var l=e.childWidgets[a];this.updateRowHeight(l,i)}i.ownerTable.spannedRowCollection.remove(i.ownerTable.spannedRowCollection.keys[s]);break}},e.prototype.updateRowHeight=function(e,i){for(var n=i.index,r=1,o=0;o<e.childWidgets.length;o++){var s=e.childWidgets[o];if(r=t.isNullOrUndefined(s)||t.isNullOrUndefined(s.cellFormat)?r:s.cellFormat.rowSpan,this.updateSpannedRowCollection(r,i,s),n-s.rowIndex==r-1){var a=s.y+s.height+s.margin.bottom-i.y;i.height<a&&(i.height=a)}}},e.prototype.updateSpannedRowCollection=function(e,i,n){e>1&&!t.isNullOrUndefined(i.ownerTable)&&(i.ownerTable.spannedRowCollection.containsKey(i.index+e-1)||i.ownerTable.spannedRowCollection.add(i.index+e-1,i.index))},e.prototype.updateRowHeightByCellSpacing=function(e,t,i){t.ownerTable.tableFormat.cellSpacing>0&&e.length>1&&t.y===i.clientArea.y&&i instanceof re&&(t.height=t.height-W.convertPointToPixel(t.ownerTable.tableFormat.cellSpacing)/2)},e.prototype.isRowSpanEnd=function(e,i){for(var n=e.index,r=1,o=0;o<this.documentHelper.splittedCellWidgets.length;o++){var s=this.documentHelper.splittedCellWidgets[o];if(r=t.isNullOrUndefined(s)||t.isNullOrUndefined(s.cellFormat)?r:s.cellFormat.rowSpan,n-s.rowIndex==r-1)return!0}return!1},e.prototype.isVerticalMergedCellContinue=function(e){for(var t=0,i=0;i<e.childWidgets.length;i++){var n=e.childWidgets[i];if(t<n.columnIndex)return!0;t+=n.cellFormat.columnSpan}return t<e.ownerTable.tableHolder.columns.length},e.prototype.splitWidgets=function(e,t,i,n,r,o){if(this.isFirstLineFitForRow(t.clientArea.bottom,e)&&e.childWidgets.length>0){if(r=this.getSplittedWidgetForRow(t.clientArea.bottom,i,n,e),this.documentHelper.splittedCellWidgets.length>0||r!==e){if(o)for(var s=0;s<r.childWidgets.length;s++)r.childWidgets[s].rowIndex!==r.index&&(r.childWidgets.splice(s,1),s--);this.insertSplittedCellWidgets(t,i,r,e.index-1)}}else this.insertSplittedCellWidgets(t,i,r,e.index-1);return r},e.prototype.getSplittedWidgetForRow=function(e,i,n,r){for(var o=void 0,s=r.index,a=0;a<r.childWidgets.length;a++){var l=r.childWidgets[a],d=this.getSplittedWidget(e,!0,i,n,l);if(!t.isNullOrUndefined(d)){if(d===l)return r;-1!==r.childWidgets.indexOf(d)&&r.childWidgets.splice(r.childWidgets.indexOf(d),1),(0===a||r.height<l.height+l.margin.top+l.margin.bottom)&&(r.height=l.height+l.margin.top+l.margin.bottom),t.isNullOrUndefined(o)&&((o=new ye).containerWidget=r.containerWidget,o.index=r.index,o.rowFormat=r.rowFormat,this.updateWidgetLocation(r,o),n.push(o));var h=1;h=t.isNullOrUndefined(d)||t.isNullOrUndefined(d.cellFormat)?h:d.cellFormat.rowSpan,s-d.rowIndex==h-1&&o.height<d.height+d.margin.top+d.margin.bottom?o.height=d.height+d.margin.top+d.margin.bottom:("Exactly"===r.rowFormat.heightType||"AtLeast"===r.rowFormat.heightType&&o.height<r.rowFormat.height)&&(o.height=r.rowFormat.height),o.childWidgets.push(d),d.containerWidget=o}}return o},e.prototype.updateWidgetsToTable=function(e,i,n){var r=this.getRowHeight(n,[n]),o=this.viewer,s=n.rowFormat.isHeader,a=void 0,l=n.rowFormat.allowBreakAcrossPages,d=n.rowFormat.heightType,h=0,c=0,p=n,u=!1;this.isTableFootNote?(this.footHeight=p.bodyWidget.page.footnoteWidget.height,this.isTableFootNote=!1):this.footHeight=0,n.ownerTable.continueHeader&&!s&&(n.ownerTable.continueHeader=!1);var g=n.ownerTable.isInsideTable,m=!1;for(h=t.isNullOrUndefined(n.ownerTable)||t.isNullOrUndefined(n.ownerTable.tableFormat)?0:W.convertPointToPixel(n.ownerTable.tableFormat.cellSpacing);c<i.length;){if(c=i.length,n.ownerTable.isInsideTable||0===this.documentHelper.splittedCellWidgets.length&&p.y+p.height+h<=o.clientArea.bottom)!this.isVerticalMergedCellContinue(n)||p.y!==o.clientArea.y&&p.y!==this.viewer.clientArea.y+p.ownerTable.headerHeight||this.insertSplittedCellWidgets(o,e,p,p.index-1),this.addWidgetToTable(o,e,i,p,void 0,g),this.documentHelper.splittedCellWidgets.length>0&&t.isNullOrUndefined(i[i.length-1].nextRow)&&(c--,m=!0),g=!1;else{if(g=!1,this.documentHelper.splittedCellWidgets.length>0&&p.y+p.height+this.footHeight<=o.clientArea.bottom&&!this.isRowSpanEnd(n,o)){!this.isVerticalMergedCellContinue(n)||p.y!==o.clientArea.y&&p.y!==this.viewer.clientArea.y+p.ownerTable.headerHeight||this.insertSplittedCellWidgets(o,e,p,p.indexInOwner-1),this.addWidgetToTable(o,e,i,p);continue}var f=p,v=e[e.length-1];if(r+p.y+this.footHeight>o.clientArea.bottom)if(!l||s&&n.ownerTable.continueHeader||"AtLeast"===d&&W.convertPointToPixel(n.rowFormat.height)<o.clientArea.bottom){if(("AtLeast"===d&&W.convertPointToPixel(n.rowFormat.height)<o.clientActiveArea.height&&l||"Exactly"!==d&&p.y===o.clientArea.y||"Auto"===d&&l)&&(f=this.splitWidgets(p,o,e,i,f,m)),"Exactly"===d&&p.y===o.clientArea.y&&(this.addWidgetToTable(o,e,i,p),c++),s&&n.ownerTable.continueHeader){n.ownerTable.header=!1,n.ownerTable.continueHeader=!1,n.ownerTable.headerHeight=0;S=void 0;if(o instanceof re&&(S=this.documentHelper.pages),!t.isNullOrUndefined(S))for(I=0;I<S.length;I++)S[I].repeatHeaderRowTableWidget&&(S[I].repeatHeaderRowTableWidget=!1)}}else"Auto"!==d&&"AtLeast"!==d||!l?"Exactly"===d&&p.y===o.clientArea.y&&(this.addWidgetToTable(o,e,i,p),c++):W.convertPointToPixel(n.rowFormat.height)>o.clientArea.bottom&&p.y!==o.clientArea.y||(f=this.splitWidgets(p,o,e,i,f,m));else{var y=!1;this.isVerticalMergedCellContinue(n)&&(l||(y=p.y===o.clientArea.y||p.y===this.viewer.clientArea.y+p.ownerTable.headerHeight))?y?this.insertSplittedCellWidgets(o,e,f,p.indexInOwner-1):f=this.splitWidgets(p,o,e,i,f,m):m&&!l&&(f=this.splitWidgets(p,o,e,i,f,m))}if(!t.isNullOrUndefined(f)){if(f!==p)this.addWidgetToTable(o,e,i,p,p.nextRow),this.updateWidgetsToPage(e,i,n.ownerTable,p.nextRow),e.indexOf(p.containerWidget)+1>=e.length&&this.addTableWidget(o.clientActiveArea,e,!0),p=f;else{if(n.index>0)if(this.updateWidgetsToPage(e,i,n.ownerTable,n),n.previousRenderedWidget instanceof ye){var b=n.previousRenderedWidget;W.round(p.y,2)===W.round(b.y+b.height,2)?e.indexOf(b.containerWidget)+1>=e.length&&this.addTableWidget(o.clientActiveArea,e,!0):this.addTableWidget(o.clientActiveArea,e,!0)}else this.addTableWidget(o.clientActiveArea,e,!0);u=!0,c--}v=e[e.length-1];var w=void 0;w=e.length>1?e[e.length-2].containerWidget:n.ownerTable.previousRenderedWidget.containerWidget;t.isNullOrUndefined(w)||this.documentHelper.pages.indexOf(w.page);n.ownerTable.containerWidget.index;var C=void 0,x=void 0;x=u&&1===e.length?e[e.length-1]:e[e.length-2],C=this.moveBlocksToNextPage(x);var F=e[e.length-1];if(u&&0===n.index&&F.containerWidget&&-1!==F.containerWidget.childWidgets.indexOf(F)&&F.containerWidget.childWidgets.splice(F.containerWidget.childWidgets.indexOf(F),1),-1!==C.childWidgets.indexOf(F)&&C.childWidgets.splice(C.childWidgets.indexOf(F),1),C.childWidgets.unshift(F),F.containerWidget=C,(u&&n.index>0||i.length>1)&&this.moveNextWidgetsToTable(e,i,!u),u=!1,n.ownerTable.header&&p.height<o.clientArea.bottom){o instanceof re&&(o.documentHelper.currentRenderingPage.repeatHeaderRowTableWidget=!0),o.updateClientAreaForBlock(n.ownerTable,!0,e),f.x=f.x,f.y=v.y+n.ownerTable.headerHeight;P=h/2;this.updateChildLocationForRow(v.y+n.ownerTable.headerHeight-P,f)}else{o.updateClientAreaForBlock(n.ownerTable,!0,e),f.x=f.x,f.y=v.y;var P=h/2;this.updateChildLocationForRow(v.y-P,f)}}m=!1}if(s&&(n.ownerTable.continueHeader&&(n.ownerTable.header=!0,n.ownerTable.headerHeight=r+n.ownerTable.headerHeight),a=this.getHeader(n.ownerTable),!t.isNullOrUndefined(a)&&n.index===a.index)){var T=this.getHeaderHeight(n.ownerTable,n,i);if((T>n.ownerTable.headerHeight||T>n.ownerTable.headerHeight)&&(n.ownerTable.headerHeight=T),n.ownerTable.headerHeight>o.clientArea.height){n.ownerTable.header=!1,n.ownerTable.continueHeader=!1,n.ownerTable.headerHeight=0;for(var S=this.documentHelper.pages,I=0;I<S.length;I++)S[I].repeatHeaderRowTableWidget&&(S[I].repeatHeaderRowTableWidget=!1)}}e.length>2&&n.ownerTable.header&&p.height<o.clientActiveArea.bottom&&!o.documentHelper.currentRenderingPage.repeatHeaderRowTableWidget&&(o.documentHelper.currentRenderingPage.repeatHeaderRowTableWidget=!0)}},e.prototype.getHeader=function(e){var t=void 0,i=!0;e=e.getSplitWidgets()[0];for(var n=0;n<e.childWidgets.length;n++){var r=e.childWidgets[n];if(r.rowFormat.isHeader?t=r:i=!1,!i)break}return t},e.prototype.getHeaderHeight=function(e,t,i){var n=0;if(t.ownerTable.childWidgets.length>0&&e.childWidgets[0].rowFormat.isHeader)for(var r=0;r<e.childWidgets.length;r++){var o=e.childWidgets[r];if(!o.rowFormat.isHeader)break;n+=this.getRowHeight(o,i)}return n},e.prototype.updateWidgetToRow=function(e){var i=e.ownerRow;if(e.containerWidget=i,!t.isNullOrUndefined(e.ownerRow)&&"Exactly"!==e.ownerRow.rowFormat.heightType&&W.convertPointToPixel(e.ownerRow.rowFormat.height)>0&&0===e.cellIndex&&(i.height=i.height+W.convertPointToPixel(e.ownerRow.rowFormat.height)),1===e.cellFormat.rowSpan){var n=e.height+e.margin.top+e.margin.bottom;i.height-W.convertPointToPixel(e.ownerTable.tableFormat.cellSpacing)<n&&(i.height=n+W.convertPointToPixel(e.ownerTable.tableFormat.cellSpacing))}},e.prototype.updateHeightForRowWidget=function(e,t,i,n,r,o,s,a){for(var l=0;l<r.childWidgets.length;l++){var d=0,h=void 0,c=1;if(c=(h=r.childWidgets[l]).cellFormat.rowSpan,d=W.convertPointToPixel(h.ownerTable.tableFormat.cellSpacing),c>1){var p=r.containerWidget.childWidgets.indexOf(r),u=p+c-1-(r.index-h.rowIndex);!a&&(e.clientArea.bottom<h.y+h.height+h.margin.bottom||u>=p+1)&&(1===n.length||n.length>=1&&r===n[n.length-1])&&this.splitSpannedCellWidget(h,i,n,e);var g=r;if(u>0)if(u<r.containerWidget.childWidgets.length){var m=r.containerWidget.childWidgets[u];m instanceof ye&&(g=m)===s&&(g=r)}else g=r.containerWidget.childWidgets[r.containerWidget.childWidgets.length-1];h.y+h.height+h.margin.bottom<g.y+g.height?h.height=g.y+g.height-h.y-h.margin.bottom:o&&g&&0!==g.y&&0!==g.height&&h.y+h.height+h.margin.bottom>g.y+g.height&&(g.height=h.y+h.height+h.margin.bottom-g.y)}else d>0&&i.length>1&&r.y===e.clientArea.y&&e instanceof re&&(d/=2),h.height=r.height-h.margin.top-h.margin.bottom-d;this.updateHeightForCellWidget(e,i,n,h);for(var f=r.containerWidget;f.containerWidget instanceof he;)f=f.containerWidget;var v=void 0;f instanceof pe&&(v=f.page),(e instanceof re&&-1!==e.visiblePages.indexOf(v)||t)&&this.updateCellVerticalPosition(h,!1,h.ownerTable.isInsideTable)}},e.prototype.updateHeightForCellWidget=function(e,t,i,n){for(var r=0;r<n.childWidgets.length;r++)n.childWidgets[r]instanceof ve&&this.updateHeightForTableWidget(t,i,n.childWidgets[r])},e.prototype.getRowHeight=function(e,t){var i=0;if("Exactly"===e.rowFormat.heightType)i=e.rowFormat.height;else{for(var n=0;n<t.length;n++)t[n]instanceof ye&&(i=t[n].height+i);i=Math.max(i,e.rowFormat.height)}return i},e.prototype.splitSpannedCellWidget=function(e,i,n,r){var o=this.getSplittedWidget(r.clientArea.bottom,!1,i,n,e);t.isNullOrUndefined(o)||this.documentHelper.splittedCellWidgets.push(o)},e.prototype.insertSplittedCellWidgets=function(e,i,n,r){var o=n.x,s=0;s=W.convertPointToPixel(n.ownerTable.tableHolder.tableWidth);for(var a=0;a<n.childWidgets.length;a++){var l=n.childWidgets[a];if(Math.round(o)<Math.round(l.x-l.margin.left)){if(this.insertRowSpannedWidget(n,e,o,a)){a--;continue}var d=n.childWidgets.length;if(this.insertEmptySplittedCellWidget(n,i,o,a,r),d<n.childWidgets.length){a--;continue}}if(o+=l.margin.left+l.width+l.margin.right,a===n.childWidgets.length-1&&Math.round(o)<Math.round(n.x+s)){if(this.insertRowSpannedWidget(n,e,o,a+1))continue;this.insertEmptySplittedCellWidget(n,i,o,a+1,r)}else;}if((t.isNullOrUndefined(n.childWidgets)||0===n.childWidgets.length)&&this.documentHelper.splittedCellWidgets.length>0)for(var h=0;h<this.documentHelper.splittedCellWidgets.length;h++){var c=this.documentHelper.splittedCellWidgets[h];if(Math.round(o)<=Math.round(c.x-c.margin.left)){if(this.insertRowSpannedWidget(n,e,o,h)){h--;continue}var p=n.childWidgets.length;if(this.insertEmptySplittedCellWidget(n,i,o,h,r),p<n.childWidgets.length){h--;continue}}if(o+=c.margin.left+c.width+c.margin.right,h===n.childWidgets.length-1&&Math.round(o)<Math.round(n.x+s)){if(this.insertRowSpannedWidget(n,e,o,h+1))continue;this.insertEmptySplittedCellWidget(n,i,o,h+1,r)}else;}this.documentHelper.splittedCellWidgets.length>0&&(this.documentHelper.splittedCellWidgets=[])},e.prototype.insertRowSpannedWidget=function(e,t,i,n){var r=0;e.ownerTable.tableFormat.cellSpacing>0&&(r=W.convertPointToPixel(e.ownerTable.tableFormat.cellSpacing));for(var o=0;o<this.documentHelper.splittedCellWidgets.length;o++){var s=this.documentHelper.splittedCellWidgets[o];if(Math.round(i)===Math.round(s.x-s.margin.left))return e.childWidgets.splice(n,0,s),s.containerWidget=e,s.y!==e.y+s.margin.top+r&&this.updateChildLocationForRow(e.y,e),this.documentHelper.splittedCellWidgets.splice(o,1),!0}return!1},e.prototype.insertEmptySplittedCellWidget=function(e,i,n,r,o){for(var s,a=i[i.length-1],l=i.length-1;l>=0;l--)for(var d=i[l],h=d.childWidgets.length-1;h>=0;h--){var c=d.childWidgets[h];if(c.index===o){s=c;break}}s&&(a=s.ownerTable,o=s.indexInOwner);for(var p=o;p>=0;p--)for(var u=a.childWidgets[p],g=u.x,l=0;l<u.childWidgets.length;l++){var m=1,f=u.childWidgets[l];if(Math.round(n)===Math.round(g)&&(m=t.isNullOrUndefined(f)||t.isNullOrUndefined(f.cellFormat)?m:f.cellFormat.rowSpan)>1&&!t.isNullOrUndefined(e.childWidgets[r])){var v=this.createCellWidget(f);if(v.x<e.childWidgets[r].x)return e.childWidgets.splice(r,0,v),v.containerWidget=e,void this.updateChildLocationForRow(e.y,e)}g+=f.margin.left+f.width+f.margin.right}},e.prototype.getSplittedWidget=function(e,i,n,r,o){var s=void 0;if(o.y+o.height>e-o.margin.bottom)for(var a=0;a<o.childWidgets.length;a++)if(o.childWidgets[a]instanceof fe){var l=o.childWidgets[a],d=this.getSplittedWidgetForPara(e-o.margin.bottom,l);if(!t.isNullOrUndefined(d)){if(0===a&&d===l)return o;-1!==o.childWidgets.indexOf(d)&&(o.childWidgets.splice(o.childWidgets.indexOf(d),1),a--),o.height-=d.height,t.isNullOrUndefined(s)&&(s=this.createCellWidget(o)),s.height+=d.height,s.childWidgets.push(d),d.containerWidget=s}}else{var h=o.childWidgets[a],c=[h];if(e-o.margin.bottom<h.y+h.height){var p=h.height,u=this.getSplittedWidgetForTable(e-o.margin.bottom,c,h);if(t.isNullOrUndefined(u)&&!h.childWidgets[0].rowFormat.allowBreakAcrossPages&&(u=h),!t.isNullOrUndefined(u)){if(0===a&&u===h)return o;-1!==o.childWidgets.indexOf(u)?(o.childWidgets.splice(o.childWidgets.indexOf(u),1),a--,o.height-=u.height):o.height-=p-h.height,t.isNullOrUndefined(s)&&(s=this.createCellWidget(o)),s.height+=u.height,s.childWidgets.push(u),u.containerWidget=s}}}return t.isNullOrUndefined(s)&&i&&(s=this.createCellWidget(o)),s},e.prototype.getListLevelPattern=function(e){switch(e){case 0:return"Arabic";case 1:return"LowLetter";case 2:return"LowRoman";case 3:return"UpLetter";case 4:return"UpRoman";case 5:return"Ordinal";case 6:return"Number";case 7:return"OrdinalText";case 8:return"LeadingZero";case 9:return"Bullet";case 10:return"FarEast";case 11:return"Special";default:return"None"}},e.prototype.createCellWidget=function(e){var t=new be;return t.cellFormat=e.cellFormat,t.index=e.index,t.rowIndex=e.rowIndex,t.columnIndex=e.columnIndex,t.containerWidget=e.containerWidget,this.updateWidgetLocation(e,t),t.margin=e.margin,t.leftBorderWidth=e.leftBorderWidth,t.rightBorderWidth=e.rightBorderWidth,t},e.prototype.createTableWidget=function(e){var t=new ve;return e.header&&(t.header=e.header,t.headerHeight=e.headerHeight),t.index=e.index,t.tableFormat=e.tableFormat,t.tableHolder=e.tableHolder,t.isGridUpdated=e.isGridUpdated,t},e.prototype.getSplittedWidgetForPara=function(e,i){for(var n=i.y,r=void 0,o=0;o<i.childWidgets.length;o++){var s=i.childWidgets[o];if(e<n+this.footHeight+s.height){if(0===o){if(s.paragraph.containerWidget instanceof be&&s.paragraph.containerWidget.y===i.y){n+=s.height;continue}r=i;break}-1!==i.childWidgets.indexOf(s)&&(i.childWidgets.splice(i.childWidgets.indexOf(s),1),o--),i.height-=s.height,t.isNullOrUndefined(r)?((r=new fe).characterFormat=i.characterFormat,r.paragraphFormat=i.paragraphFormat,r.index=i.index,this.updateWidgetLocation(i,r),r.height=s.height):r.height+=s.height,r.childWidgets.push(s),s.paragraph=r}n+=s.height}return r},e.prototype.getSplittedWidgetForTable=function(e,i,n){for(var r=n.y,o=void 0,s=0;s<n.childWidgets.length;s++){var a=void 0,l=(a=n.childWidgets[s]).height;if(e<r+l||!t.isNullOrUndefined(o)){var d=void 0,h=!0;if(t.isNullOrUndefined(a)||t.isNullOrUndefined(a.rowFormat)||(h=a.rowFormat.allowBreakAcrossPages),h&&(d=t.isNullOrUndefined(o)&&this.isFirstLineFitForRow(e,a)?this.getSplittedWidgetForRow(e,i,[a],a):a),!t.isNullOrUndefined(d)){if(0===s&&d===a)return n;-1!==n.childWidgets.indexOf(d)?(n.childWidgets.splice(n.childWidgets.indexOf(d),1),s--,n.height-=d.height):n.height-=l-a.height,t.isNullOrUndefined(o)?(o=this.createTableWidget(n),this.updateWidgetLocation(n,o),o.height=d.height):o.height+=d.height,o.childWidgets.push(d),d.containerWidget=o}}r+=a.height}return o},e.prototype.isFirstLineFitForPara=function(e,i){var n=i.childWidgets[0],r=n.paragraph.containerWidget;if(this.documentHelper.isFirstLineFitInShiftWidgets){if(this.viewer.clientActiveArea.y===this.viewer.clientArea.y&&i.y+n.height+this.footHeight>=e)return!0}else if(r.ownerTable.isInsideTable){var o=void 0;if(r.containerWidget instanceof ye&&r.containerWidget.containerWidget instanceof ve&&r.containerWidget.containerWidget.containerWidget instanceof be&&(o=r.containerWidget.containerWidget.containerWidget),!t.isNullOrUndefined(o)&&r.containerWidget.y===o.y&&i.y+n.height+this.footHeight>=e)return!0}else if(r.containerWidget.y===this.viewer.clientArea.y&&i.y+n.height+this.footHeight>=e)return!0;return i.y+n.height+this.footHeight<=e},e.prototype.isFirstLineFitForTable=function(e,i){var n=void 0,r=!1;return n=i.childWidgets[0],t.isNullOrUndefined(n)||(r=this.isFirstLineFitForRow(e,n)),r},e.prototype.isFirstLineFitForRow=function(e,t){for(var i=0;i<t.childWidgets.length;i++){var n=t.childWidgets[i];if(!this.isFirstLineFitForCell(e,n))return!1}return!0},e.prototype.isFirstLineFitForCell=function(e,t){if(0===t.childWidgets.length)return!0;if(t.childWidgets[0]instanceof fe){var i=t.childWidgets[0];return this.isFirstLineFitForPara(e-t.margin.bottom,i)}var n=t.childWidgets[0];return this.isFirstLineFitForTable(e-t.margin.bottom,n)},e.prototype.updateWidgetLocation=function(e,t){t.x=e.x,t.y=e.y,t.width=e.width},e.prototype.updateChildLocationForTable=function(e,t){for(var i=0;i<t.childWidgets.length;i++){var n=t.childWidgets[i];n.y=e,this.updateChildLocationForRow(e,n),e+=n.height}},e.prototype.updateChildLocationForRow=function(e,t){var i=0;t.ownerTable.tableFormat.cellSpacing>0&&(i=W.convertPointToPixel(t.ownerTable.tableFormat.cellSpacing));for(var n=0;n<t.childWidgets.length;n++){var r=t.childWidgets[n];r.y=e+r.margin.top+i,this.updateChildLocationForCell(r.y,r)}},e.prototype.updateChildLocationForCell=function(e,t){for(var i=0;i<t.childWidgets.length;i++)t.childWidgets[i].x=t.childWidgets[i].x,t.childWidgets[i].y=e,t.childWidgets[i]instanceof ve&&this.updateChildLocationForTable(e,t.childWidgets[i]),e+=t.childWidgets[i].height},e.prototype.updateCellVerticalPosition=function(e,t,i){var n=e.ownerTable.containerWidget;if(n instanceof ce||n instanceof _e||i){var r=this.getDisplacement(e,t);this.updateCellContentVerticalPosition(e,r,t)}},e.prototype.updateCellContentVerticalPosition=function(e,t,i){if(0!==t)for(var n=e.y+t,r=0;r<e.childWidgets.length;r++)e.childWidgets[r]instanceof fe?e.childWidgets[r].y=n:n=this.updateTableWidgetLocation(e.childWidgets[r],n,i),n+=e.childWidgets[r].height},e.prototype.updateTableWidgetLocation=function(e,t,i){e.y=t+=e.topBorderWidth;for(var n=0;n<e.childWidgets.length;n++){var r=e.childWidgets[n];r.y=t;for(var o=0;o<r.childWidgets.length;o++){var s=r.childWidgets[o];s.y=t+s.margin.top+0,this.updateCellVerticalPosition(s,i,!0)}t+=r.height}return t},e.prototype.getDisplacement=function(e,i){var n=0,r=e.containerWidget,o=e.margin.top+e.margin.bottom;n=!t.isNullOrUndefined(e.cellFormat)&&e.cellFormat.rowSpan>1?e.height:(t.isNullOrUndefined(r)?0:r.height)-o;var s=this.getCellContentHeight(e),a=0;return n>s&&(a=n-s,"Center"===e.cellFormat.verticalAlignment?a/=2:("Top"===e.cellFormat.verticalAlignment||i)&&(a=0)),a},e.prototype.getCellContentHeight=function(e){if(t.isNullOrUndefined(e.childWidgets))return 0;for(var i=0,n=0;n<e.childWidgets.length;n++)e.childWidgets[n],i+=e.childWidgets[n].height;return i},e.prototype.getTableLeftBorder=function(e){if(t.isNullOrUndefined(e.left)){var i=new T(e);return i.lineStyle="Single",i.lineWidth=.66,i}return e.left},e.prototype.getTableRightBorder=function(e){if(t.isNullOrUndefined(e.right)){var i=new T(e);return i.lineStyle="Single",i.lineWidth=.66,i}return e.right},e.prototype.getTableTopBorder=function(e){if(t.isNullOrUndefined(e.top)){var i=new T(e);return i.lineStyle="Single",i.lineWidth=.66,i}return e.top},e.prototype.getTableBottomBorder=function(e){if(t.isNullOrUndefined(e.bottom)){var i=new T(e);return i.lineStyle="Single",i.lineWidth=.66,i}return e.bottom},e.prototype.getCellDiagonalUpBorder=function(e){var t=void 0;return t=e.cellFormat.borders,t.diagonalUp},e.prototype.getCellDiagonalDownBorder=function(e){var t=void 0;return t=e.cellFormat.borders,t.diagonalDown},e.prototype.getTableWidth=function(e){for(var t=0,i=0;i<e.childWidgets.length;i++){for(var n=e.childWidgets[i],r=0,o=0;o<n.childWidgets.length;o++){var s=n.childWidgets[o];r+=W.convertPointToPixel(s.cellFormat.cellWidth)}t<r&&(t=r)}return t},e.prototype.layoutNextItemsBlock=function(e,i){var n=e.bodyWidget.sectionIndex,r=e,o=r.getSplitWidgets(),s=o[o.length-1].nextRenderedWidget;(t.isNullOrUndefined(s)||this.documentHelper.blockToShift===r)&&(this.documentHelper.blockToShift=void 0);for(var a=!0;s instanceof ge&&s.bodyWidget.sectionIndex===n;){var l=void 0,d=r.getSplitWidgets();l=d[d.length-1],r=s,this.documentHelper.blockToShift===r&&(this.documentHelper.blockToShift=void 0),a=!1;var h=void 0;if(h=r.getSplitWidgets()[0],0===this.documentHelper.fieldStacks.length&&!t.isNullOrUndefined(h)&&l.containerWidget===h.containerWidget&&W.round(h.y,2)===W.round(l.y+l.height,2)){t.isNullOrUndefined(this.documentHelper.blockToShift)||(this.documentHelper.blockToShift=r);break}if(a=!0,i.owner.isShiftingEnabled&&0===this.documentHelper.fieldStacks.length){this.documentHelper.blockToShift=r;break}!t.isNullOrUndefined(this.viewer.owner.editorModule)&&this.viewer.owner.editorModule.isInsertingTOC||(r=r.combineWidget(this.viewer),l.containerWidget!==r.containerWidget&&(!(l instanceof fe)||l instanceof fe&&!l.isEndsWithPageBreak)&&this.updateContainerWidget(r,l.containerWidget,l.indexInOwner+1,!1),r instanceof ve&&(this.clearTableWidget(r,!0,!0),r.isGridUpdated=!1),i.updateClientAreaForBlock(r,!0),this.viewer instanceof oe&&(r.containerWidget.height-=r.height),this.documentHelper.layout.layoutBlock(r,0),i.updateClientAreaForBlock(r,!1)),s=(o=s.getSplitWidgets())[o.length-1].nextRenderedWidget}i.owner.isShiftingEnabled&&this.documentHelper.blockToShift===r||this.viewer.owner.editorModule.updateListItemsTillEnd(r,a)},e.prototype.updateClientAreaForLine=function(e){e.marginTop=0;var t=this.documentHelper.selection.getTop(e),i=this.viewer.clientArea.x;this.viewer.cutFromTop(t),this.viewer.cutFromLeft(i)},e.prototype.getParentTable=function(e){for(var t=e;t.containerWidget;){if(t.containerWidget instanceof ce||t.containerWidget instanceof _e)return t;t=t.containerWidget}},e.prototype.reLayoutParagraph=function(e,i,n,r,o){if(this.isRelayout=!0,r=!t.isNullOrUndefined(r)&&r,this.isRelayout=!0,this.documentHelper.blockToShift===e?(this.layoutBodyWidgetCollection(e.index,e.containerWidget,e,!1),this.isBidiReLayout=!0):this.isBidiReLayout&&(this.isBidiReLayout=!1),e.isInsideTable){if(this.isBidiReLayout=!0,this.reLayoutTable(e),this.isFootnoteContentChanged&&!t.isNullOrUndefined(e.bodyWidget)&&!t.isNullOrUndefined(e.bodyWidget.page.footnoteWidget)){var s=e.bodyWidget.page.footnoteWidget;this.layoutfootNote(s)}this.isBidiReLayout=!1}else this.reLayoutLine(e,i,r,o);e.bodyWidget instanceof ue&&-1!==e.bodyWidget.headerFooterType.indexOf("Footer")&&this.shiftFooterChildLocation(e.bodyWidget,this.viewer)},e.prototype.getParentRow=function(e){for(var t=e;null!=t.ownerTable&&t.ownerTable.isInsideTable;)t=t.ownerTable.associatedCell;return t.ownerRow},e.prototype.reLayoutRow=function(e){e instanceof fe&&(e=e.associatedCell);var i=this.getParentRow(e).getSplitWidgets()[0];if(t.isNullOrUndefined(i)||i.ownerTable.tableFormat.allowAutoFit)this.currentCell=e,this.reLayoutTable(e),this.currentCell=void 0;else{for(var n=i.ownerTable.getSplitWidgets()[0].combineWidget(this.viewer),r=i;this.isVerticalMergedCellContinue(r);){var o=r.previousWidget;if(t.isNullOrUndefined(o))break;r=o}var s=n.containerWidget;this.viewer instanceof oe&&(s.height-=n.height),!this.viewer.owner.enableHeaderAndFooter&&!e.isInHeaderFooter||s instanceof _e?s instanceof _e?this.viewer.updateClientAreaForTextBoxShape(s.containerShape,!0):this.viewer.updateClientArea(s.sectionFormat,s.page):(e.bodyWidget.isEmpty=!1,s.height-=n.height,this.viewer.updateHeaderFooterClientAreaWithTop(n.bodyWidget.sectionFormat,this.documentHelper.isBlockInHeader(n),s.page));var a=new ae(this.viewer.clientArea.x,this.viewer.clientArea.y,this.viewer.clientArea.width,this.viewer.clientArea.height),l=new ae(a.x,a.y,a.width,a.height);if(this.viewer.owner.isDocumentLoaded&&this.viewer.owner.editorModule){var d=this.documentHelper.selection.getFirstParagraphInFirstCell(n);this.viewer.owner.editorModule.updateWholeListItems(d)}this.viewer.updateClientAreaForBlock(n,!0),this.viewer.cutFromTop(r.y),this.viewer.clientActiveArea.height=Number.POSITIVE_INFINITY,n.height=0;do{if(this.clearRowWidget(i,!0,!0,!0),this.layoutRow([n],i,!0),r===i)break;r=r.nextRow}while(r&&r!==i);this.updateChildLocationForTable(n.y,n),this.viewer.clientArea=l,this.viewer.clientActiveArea=new ae(l.x,l.y,l.width,l.height),this.viewer.updateClientAreaForBlock(n,!0),n.x-=n.leftBorderWidth,n.y-=n.topBorderWidth,this.viewer.cutFromTop(n.y),this.shiftTableWidget(n,this.viewer,!0),this.layoutNextItemsBlock(n,this.viewer)}},e.prototype.reLayoutTable=function(e){var t=this.getParentTable(e),i=t.combineWidget(this.viewer),n=i.containerWidget;if(this.viewer instanceof oe&&(n.height-=i.height),!this.viewer.owner.enableHeaderAndFooter&&!e.isInHeaderFooter||n instanceof _e?n instanceof _e?this.viewer.updateClientAreaForTextBoxShape(n.containerShape,!0):this.viewer.updateClientArea(n.sectionFormat,n.page):(e.bodyWidget.isEmpty=!1,n.height-=i.height,this.viewer.updateHeaderFooterClientAreaWithTop(t.bodyWidget.sectionFormat,this.documentHelper.isBlockInHeader(t),n.page)),this.viewer.owner.isDocumentLoaded&&this.viewer.owner.editorModule){var r=this.documentHelper.selection.getFirstParagraphInFirstCell(i);this.viewer.owner.editorModule.updateWholeListItems(r)}this.viewer.updateClientAreaForBlock(i,!0),i.x-=i.leftBorderWidth,i.y-=i.topBorderWidth,this.viewer.cutFromTop(i.y),this.clearTableWidget(i,!0,!0,!0),this.isBidiReLayout=!0,this.layoutBlock(i,0),this.viewer.updateClientAreaForBlock(i,!1),this.layoutNextItemsBlock(i,this.viewer)},e.prototype.clearTableWidget=function(e,t,i,n){e.height=0,n&&(e.isGridUpdated=!1),t&&(e.y=0,e.x=0);for(var r=0;r<e.childWidgets.length;r++){var o=e.childWidgets[r];this.clearRowWidget(o,t,i,n)}},e.prototype.clearRowWidget=function(e,t,i,n){e.height=0,t&&(e.y=0,e.x=0);for(var r=0;r<e.childWidgets.length;r++){var o=e.childWidgets[r];this.clearCellWidget(o,t,i,n)}},e.prototype.clearCellWidget=function(e,t,i,n){e.height=0,t&&(e.y=0,e.x=0);for(var r=0;r<e.childWidgets.length;r++){var o=e.childWidgets[r];o instanceof fe?i&&(o.height=0):this.clearTableWidget(o,t,i,n)}},e.prototype.layoutBodyWidgetCollection=function(e,i,n,r,o){if(!t.isNullOrUndefined(this.documentHelper.owner)&&this.documentHelper.owner.isLayoutEnabled)if(i instanceof ce||i instanceof _e){var s=this.checkAndGetBlock(i,e);if(t.isNullOrUndefined(s))return;if(this.viewer instanceof oe&&(s.containerWidget.height-=s.height),i instanceof ue?(i.isEmpty=!1,this.viewer.updateHeaderFooterClientAreaWithTop(i.sectionFormat,-1!==i.headerFooterType.indexOf("Header"),i.page),s.containerWidget.height-=s.height):i instanceof _e?this.viewer.updateClientAreaForTextBoxShape(i.containerShape,!0):i instanceof me?"Footnote"===i.footNoteType&&(this.isRelayoutFootnote=!0,this.viewer.updateClientArea(i.sectionFormat,i.page,!0),this.viewer.clientArea.height=Number.POSITIVE_INFINITY,this.viewer.clientActiveArea.height=Number.POSITIVE_INFINITY,s.containerWidget.height-=s.height,this.viewer.clientActiveArea.y=s.containerWidget.y):t.isNullOrUndefined(i.page.footnoteWidget)?this.viewer.updateClientArea(i.sectionFormat,i.page,!0):(i.page.footnoteWidget.footNoteType,this.viewer.updateClientArea(i.sectionFormat,i.page,!0)),e>0){var a=s.getSplitWidgets()[0].previousRenderedWidget;!(a instanceof fe)||a instanceof fe&&!a.isEndsWithPageBreak?(this.viewer.cutFromTop(a.y+a.height),t.isNullOrUndefined(o)&&s.containerWidget!==a.containerWidget&&this.updateContainerWidget(s,a.containerWidget,a.indexInOwner+1,!1)):a instanceof fe&&a.isEndsWithPageBreak&&a.containerWidget===s.containerWidget&&this.moveBlocksToNextPage(a)}var l=void 0;(s=s.combineWidget(this.viewer))instanceof ve?(this.clearTableWidget(s,!0,!0),s.isGridUpdated=!1,l=this.documentHelper.selection.getFirstParagraphInFirstCell(s)):l=s,this.viewer.owner.isDocumentLoaded&&this.viewer.owner.editorModule&&this.viewer.owner.editorModule.updateWholeListItems(l),this.viewer.updateClientAreaForBlock(s,!0),this.documentHelper.layout.layoutBlock(s,0),this.viewer.updateClientAreaForBlock(s,!1),r?this.shiftNextWidgets(s):this.layoutNextItemsBlock(s,this.viewer)}else if(i instanceof be){var d=this.documentHelper.layout.getParentTable(i.ownerTable).getSplitWidgets()[0];this.reLayoutTable(i.ownerTable),this.layoutNextItemsBlock(d,this.viewer)}this.isRelayoutFootnote=!1},e.prototype.checkAndGetBlock=function(e,t){if(e instanceof _e)return e.childWidgets[t];for(var i=e.index;e&&e.index===i;){if(e.childWidgets.length>0&&e.firstChild.index<=t&&e.lastChild.index>=t)for(var n=0;n<e.childWidgets.length;n++){var r=e.childWidgets[n];if(r.index===t)return r}if(!(e instanceof pe))break;e=e.nextRenderedWidget}},e.prototype.layoutTable=function(e,t){e.isBidiTable=e.bidi,e.isGridUpdated||(e.buildTableColumns(),e.isGridUpdated=!0);var i=[e];this.addTableWidget(this.viewer.clientActiveArea,i),this.viewer.updateClientAreaTopOrLeft(e,!0);var n=e.childWidgets[0].rowFormat.isHeader;e.childWidgets.length>0&&(e.header=n,e.continueHeader=n,e.headerHeight=0);for(var r=e.childWidgets[t];r;)r=(r=this.layoutRow(i,r)).nextRow;return this.updateWidgetsToPage(i,[],e),i[i.length-1]},e.prototype.addTableWidget=function(e,t,i){var n=t[t.length-1];return i&&(n=this.createTableWidget(n),t.push(n)),n.width=e.width,n.x=e.x,n.y=e.y,n.tableFormat.cellSpacing>0&&(n.height=n.height+W.convertPointToPixel(n.tableFormat.cellSpacing),n.isBidiTable?(n.leftBorderWidth=W.convertPointToPixel(this.getTableRightBorder(n.tableFormat.borders).getLineWidth()),n.rightBorderWidth=W.convertPointToPixel(this.getTableLeftBorder(n.tableFormat.borders).getLineWidth())):(n.leftBorderWidth=W.convertPointToPixel(this.getTableLeftBorder(n.tableFormat.borders).getLineWidth()),n.rightBorderWidth=W.convertPointToPixel(this.getTableRightBorder(n.tableFormat.borders).getLineWidth())),n.topBorderWidth=W.convertPointToPixel(this.getTableTopBorder(n.tableFormat.borders).getLineWidth()),n.bottomBorderWidth=W.convertPointToPixel(this.getTableBottomBorder(n.tableFormat.borders).getLineWidth()),n.x+=n.leftBorderWidth,n.y+=n.topBorderWidth,n.width-=n.leftBorderWidth,n.width-=n.rightBorderWidth,n.height+=n.bottomBorderWidth),n},e.prototype.updateWidgetsToPage=function(e,t,i,n){var r=this.viewer,o=e[e.length-1];if(!i.isInsideTable){for(var s=0;s<e.length;s++)this.updateHeightForTableWidget(e,t,e[s],n);o.childWidgets.length>0&&o.y!==o.childWidgets[0].y&&(o.y=o.childWidgets[0].y)}i.tableFormat.cellSpacing>0&&(o.y+o.height+W.convertPointToPixel(i.tableFormat.cellSpacing)>r.clientArea.bottom&&r instanceof oe&&(o.height=o.height-W.convertPointToPixel(i.tableFormat.cellSpacing)/2),r.cutFromTop(o.y+o.height)),this.viewer instanceof oe&&(i.containerWidget.height+=i.height),i.bodyWidget instanceof ue&&(i.containerWidget.height+=i.height,this.viewer.owner.enableHeaderAndFooter&&-1!==i.bodyWidget.headerFooterType.indexOf("Footer")&&this.shiftFooterChildLocation(i.bodyWidget,this.viewer))},e.prototype.updateHeightForTableWidget=function(e,t,i,n){for(var r=0;r<i.childWidgets.length;r++){var o=i.childWidgets[r];if(o===n)break;this.updateHeightForRowWidget(this.viewer,!0,e,t,o,!0,n)}},e.prototype.layoutRow=function(e,t,i){var n=this.viewer,r=[t];this.addTableRowWidget(n.clientActiveArea,r),n.updateClientAreaForRow(t,!0);for(var o=this.getMaxTopCellMargin(t),s=this.getMaxBottomCellMargin(t),a=0;a<t.childWidgets.length;a++){var l=t.childWidgets[a];this.layoutCell(l,o+t.topBorderWidth,s+t.bottomBorderWidth)}n.updateClientAreaForRow(t,!1);var d=[t];return i||this.updateWidgetsToTable(e,d,t),d[d.length-1]},e.prototype.getAdjacentRowCell=function(e,t,i,n){var r=[],o=e.ownerRow.ownerTable.childWidgets[n],s=!1;if(o){o.childWidgets[0].x>e.x&&0!==n&&(o=e.ownerRow.ownerTable.childWidgets[n-1],s=!0);for(var a=0;a<o.childWidgets.length;a++){var l=o.childWidgets[a],d=l.x-l.margin.left,h=l.x+l.width+l.margin.right;if((W.round(h,2)>W.round(t,2)&&W.round(h,2)<=W.round(i,2)||W.round(d,2)>=W.round(t,2)&&W.round(d,2)<W.round(i,2)||W.round(d,2)<=W.round(t,2)&&W.round(h,2)>=W.round(i,2))&&-1===r.indexOf(l)&&r.push(l),W.round(h,2)>=W.round(i,2)){if(!s)break;o=e.ownerRow.ownerTable.childWidgets[n],s=!1}a===o.childWidgets.length-1&&s&&(o=e.ownerRow.ownerTable.childWidgets[n],s=!1)}}return r},e.prototype.addTableRowWidget=function(e,i){var n=i[i.length-1];0===n.rowFormat.beforeWidth&&0===n.rowFormat.gridBeforeWidth||this.documentHelper.alignTablesRowByRow&&"Left"!==n.ownerTable.tableFormat.tableAlignment?n.x=e.x:n.x+=0!==n.rowFormat.beforeWidth?n.rowFormat.beforeWidth:n.rowFormat.gridBeforeWidth,n.y=e.y,n.width=e.width;var r=0;if(!t.isNullOrUndefined(n.ownerTable)&&!t.isNullOrUndefined(n.ownerTable.tableFormat)&&n.ownerTable.tableFormat.cellSpacing>0){n.height=n.height+W.convertPointToPixel(n.ownerTable.tableFormat.cellSpacing);for(var o=0;o<n.childWidgets.length;o++)if(!t.isNullOrUndefined(n.childWidgets[o].cellFormat)&&!t.isNullOrUndefined(n.childWidgets[o].cellFormat.borders)){var s=be.getCellBottomBorder(n.childWidgets[o]).getLineWidth();s>r&&(r=s)}if(n.bottomBorderWidth=W.convertPointToPixel(r),n.index>0&&!t.isNullOrUndefined(n.previousWidget)){var a=n.previousWidget;r=0;for(h=0;h<a.childWidgets.length;h++)if(!t.isNullOrUndefined(a.childWidgets[h].cellFormat)&&!t.isNullOrUndefined(a.childWidgets[h].cellFormat.borders)){var l=be.getCellBottomBorder(a.childWidgets[h]).getLineWidth();l>r&&(r=l)}n.topBorderWidth=W.convertPointToPixel(r)}}if(!t.isNullOrUndefined(n.childWidgets))for(h=0;h<n.childWidgets.length;h++)if(!t.isNullOrUndefined(n.childWidgets[h].cellFormat)&&!t.isNullOrUndefined(n.childWidgets[h].cellFormat.borders)){var d=be.getCellTopBorder(n.childWidgets[h]).getLineWidth();d>r&&(r=d)}if(n.topBorderWidth=W.convertPointToPixel(r),!t.isNullOrUndefined(n.ownerTable)&&!t.isNullOrUndefined(n.ownerTable.tableFormat)&&n.ownerTable.tableFormat.cellSpacing<=0&&n.rowIndex===n.ownerTable.childWidgets.length-1){for(var h=0;h<n.childWidgets.length;h++)if(!t.isNullOrUndefined(n.childWidgets[h].cellFormat)&&!t.isNullOrUndefined(n.childWidgets[h].cellFormat.borders)){var c=be.getCellBottomBorder(n.childWidgets[h]).getLineWidth();c>r&&(r=c)}n.bottomBorderWidth=W.convertPointToPixel(r)}return n},e.prototype.getMaxTopCellMargin=function(e){if(t.isNullOrUndefined(e.childWidgets))return 0;for(var i=0,n=0;n<e.childWidgets.length;n++){var r=e.childWidgets[n],o=0;(o=r.cellFormat.hasValue("topMargin")?W.convertPointToPixel(r.cellFormat.topMargin):e.rowFormat.hasValue("topMargin")?W.convertPointToPixel(e.rowFormat.topMargin):W.convertPointToPixel(e.ownerTable.tableFormat.topMargin))>i&&(i=o)}return i},e.prototype.getMaxBottomCellMargin=function(e){if(t.isNullOrUndefined(e.childWidgets))return 0;for(var i=0,n=0;n<e.childWidgets.length;n++){var r=e.childWidgets[n],o=0;(o=r.cellFormat.hasValue("bottomMargin")?W.convertPointToPixel(r.cellFormat.bottomMargin):e.rowFormat.hasValue("bottomMargin")?W.convertPointToPixel(e.rowFormat.bottomMargin):W.convertPointToPixel(e.ownerTable.tableFormat.bottomMargin))>i&&(i=o)}return i},e.prototype.layoutCell=function(e,t,i){var n=this.viewer;if(this.addTableCellWidget(e,n.clientActiveArea,t,i),this.updateTopBorders(e),n.updateClientAreaForCell(e,!0),0===e.childWidgets.length){var r=new fe;r.characterFormat=new H,r.paragraphFormat=new P,r.index=0;var o=new we(r);r.childWidgets.push(o),e.childWidgets.push(r)}for(var s=0;s<e.childWidgets.length;s++){var a=e.childWidgets[s];n.updateClientAreaForBlock(a,!0),a.containerWidget=e,this.layoutBlock(a,0),n.updateClientAreaForBlock(a,!1);for(var l=0;l<a.childWidgets.length;l++)if(a.childWidgets[l]instanceof we)for(var d=a.childWidgets[l],h=0;h<d.children.length;h++){if(d.children[h]instanceof Ee){this.footHeight=e.bodyWidget.page.footnoteWidget.height,this.isTableFootNote=!0;break}this.footHeight=0}}this.updateWidgetToRow(e),n.updateClientAreaForCell(e,!1)},e.prototype.updateTopBorders=function(e){if(e.updatedTopBorders=[],0===e.ownerTable.tableFormat.cellSpacing)for(var t=e.cellFormat.borders.top,i=e.x-e.margin.left,n=e.x+e.width+e.margin.right,r=this.getAdjacentRowCell(e,i,n,e.ownerRow.indexInOwner-1),o=0;o<r.length;o++){var s=r[o],a=s.cellFormat.borders.bottom;(!a.isBorderDefined||a.isBorderDefined&&"None"===a.lineStyle&&0===a.lineWidth&&a.hasValue("color"))&&(a=s.ownerRow.rowFormat.borders.horizontal),a.isBorderDefined||(a=s.ownerRow.ownerTable.tableFormat.borders.horizontal);var l=void 0;if(l="None"===t.lineStyle||"Cleared"===t.lineStyle?a:"Cleared"===a.lineStyle||"None"===a.lineStyle?t:e.getBorderBasedOnPriority(t,a)){var d=s.x-s.margin.left,h=s.x+s.width+s.margin.right,c=0;(c=W.round(h,2)===W.round(n,2)&&W.round(d,2)===W.round(i,2)?n-i:W.round(d,2)>=W.round(i,2)&&W.round(h,2)>=W.round(n,2)?n-d:W.round(d,2)>=W.round(i,2)&&W.round(h,2)<=W.round(n,2)?h-d:W.round(d,2)<=W.round(i,2)&&W.round(h,2)<=W.round(n,2)?h-i:(W.round(d,2)<=W.round(i,2)&&(W.round(h,2),W.round(n,2)),n-i))<0&&(c=0),e.updatedTopBorders.push({border:l,width:c})}}},e.prototype.shiftLayoutedItems=function(e){if(t.isNullOrUndefined(this.documentHelper.blockToShift)||t.isNullOrUndefined(this.documentHelper.blockToShift.containerWidget))return void(this.documentHelper.blockToShift=void 0);var i=this.documentHelper.blockToShift,n=i.bodyWidget.index;this.reLayoutOrShiftWidgets(i,this.viewer);for(var r=!0,o=i.getSplitWidgets(),s=o[o.length-1].nextRenderedWidget;s instanceof ge&&s.bodyWidget.index===n;){var a=void 0,l=i.getSplitWidgets();a=l[l.length-1],r=!1;var d=void 0;if(l=(i=s).getSplitWidgets(),i instanceof fe?d=l[0]:i instanceof ve&&(d=l[0]),a.containerWidget===d.containerWidget&&W.round(d.y,2)===W.round(this.viewer.clientActiveArea.y,2)&&t.isNullOrUndefined(d.nextWidget))break;t.isNullOrUndefined(a.floatingElements),r=!0,this.reLayoutOrShiftWidgets(i,this.viewer),s=(o=i.getSplitWidgets())[o.length-1].nextRenderedWidget}this.viewer.owner.editorModule&&this.viewer.owner.editorModule.updateListItemsTillEnd(i,r),this.documentHelper.blockToShift=void 0;var h=this.viewer;this.documentHelper.removeEmptyPages(),this.updateFieldElements(),this.documentHelper.owner.enableLockAndEdit&&e||h.updateScrollBars()},e.prototype.updateFieldElements=function(){for(var e=0;e<this.documentHelper.fields.length;e++){var i=this.documentHelper.fields[e];if(!t.isNullOrUndefined(this.documentHelper.selection)){var n=this.documentHelper.selection.getFieldCode(i);if(!t.isNullOrUndefined(n)&&(n.toLowerCase().match("numpages")||n.toLowerCase().match("sectionpages"))&&!t.isNullOrUndefined(i.fieldSeparator)){var r=i.fieldSeparator.nextNode;if(!t.isNullOrUndefined(r)){var o=r.text;r.text=this.documentHelper.pages.length.toString();var s=i.line.paragraph;if(!t.isNullOrUndefined(s.bodyWidget)&&!t.isNullOrUndefined(s.bodyWidget.page)&&o!==r.text){var a=s.childWidgets.indexOf(i.line),l=i.line.children.indexOf(r);this.reLayoutParagraph(s,a,l)}}}}}},e.prototype.reLayoutOrShiftWidgets=function(e,t){var i=e;e.bodyWidget.floatingElements.length>0?(t.updateClientAreaForBlock(i,!0),this.layoutBlock(i,0),t.updateClientAreaForBlock(i,!1)):this.shiftWidgetsBlock(i,t),this.viewer.owner.editorModule&&this.viewer.owner.editorModule.updateRenderedListItems(i),!this.isRelayoutFootnote&&i.bodyWidget.page.footnoteWidget&&this.layoutfootNote(i.bodyWidget.page.footnoteWidget),i.bodyWidget instanceof me||this.isRelayoutFootnote||!i.bodyWidget.page.endnoteWidget||this.layoutfootNote(i.bodyWidget.page.endnoteWidget)},e.prototype.shiftWidgetsBlock=function(e,t){e instanceof fe?this.shiftWidgetsForPara(e,t):e instanceof ve&&this.shiftWidgetsForTable(e,t)},e.prototype.shiftWidgetsForPara=function(e,i){if(!(e.height>i.clientArea.height+i.clientArea.y))for(var n=this.getBodyWidgetOfPreviousBlock(e,0),r=n.bodyWidget,o=n.index,s=void 0,a=0;a<e.getSplitWidgets().length;a++){var l=e.getSplitWidgets()[a];if(!t.isNullOrUndefined(s)){m=!!s.lastChild&&s.lastChild.isEndsWithPageBreak;if(this.shiftToPreviousWidget(l,i,s,m),(t.isNullOrUndefined(l.childWidgets)||0===l.childWidgets.length)&&!m){a--;continue}s=void 0,r!==l.containerWidget&&(r=l.containerWidget,m&&i.updateClientAreaByWidget(l))}var d=[],h=[];if(l.childWidgets.length>0)for(c=0;c<this.documentHelper.footnoteCollection.length;c++)this.documentHelper.footnoteCollection[c].line.paragraph===l&&d.push(this.documentHelper.footnoteCollection[c]);if(d.length>0&&l.bodyWidget.page.footnoteWidget)for(var c=0;c<l.bodyWidget.page.footnoteWidget.childWidgets.length;c++)l.bodyWidget.page.footnoteWidget.childWidgets[c].footNoteReference===d[0]&&h.push(l.bodyWidget.page.footnoteWidget.childWidgets[c]);if(this.isFitInClientArea(l,i,h)){if(s=l,l.y=i.clientActiveArea.y,i.cutFromTop(i.clientActiveArea.y+l.height),!t.isNullOrUndefined(r)&&r!==l.containerWidget&&(o++,r.lastChild.isEndsWithPageBreak||this.updateContainerWidget(l,r,o,!0),h.length>0&&r.page.footnoteWidget))for(var p=0;p<h.length;p++)r.page.footnoteWidget.childWidgets.push(h[p]),r.page.footnoteWidget.height+=h[p].height;if(l.isEndsWithPageBreak&&this.viewer instanceof re){var u=this.createOrGetNextBodyWidget(r,this.viewer);u=this.moveBlocksToNextPage(l),i.updateClientArea(u.sectionFormat,u.page)}}else{var g=l.previousRenderedWidget,m=!1;g instanceof fe&&g.isEndsWithPageBreak&&this.viewer instanceof re&&(m=!0);var f=this.splitWidget(l,i,r,o+1,m,h);s=void 0,r!==l.containerWidget&&(r=l.containerWidget,a--),o=r.childWidgets.indexOf(l),f&&(r=e.getSplitWidgets()[a+1].containerWidget)}}},e.prototype.shiftTableWidget=function(e,t,i){void 0===i&&(i=!1);var n=[e];this.addTableWidget(this.viewer.clientActiveArea,n),this.viewer.updateClientAreaTopOrLeft(e,!0);for(var r=e.childWidgets[0];r;)r=(r=this.shiftRowWidget(n,r,i)).nextRow;return this.updateWidgetsToPage(n,[],e),n[n.length-1]},e.prototype.shiftRowWidget=function(e,t,i){void 0===i&&(i=!1);var n=this.viewer;i&&(t.height=0);var r=[t];this.addTableRowWidget(n.clientActiveArea,r),n.updateClientAreaForRow(t,!0);for(var o=0;o<t.childWidgets.length;o++){var s=t.childWidgets[o];i&&(s.height=0),this.shiftCellWidget(s,this.getMaxTopCellMargin(t)+t.topBorderWidth,this.getMaxBottomCellMargin(t)+t.bottomBorderWidth,i)}return n.updateClientAreaForRow(t,!1),this.updateWidgetsToTable(e,r,t),r[r.length-1]},e.prototype.shiftCellWidget=function(e,i,n,r){t.isNullOrUndefined(r)&&(r=!1);var o=this.viewer;this.addTableCellWidget(e,o.clientActiveArea,i,n),o.updateClientAreaForCell(e,!0);for(var s=0;s<e.childWidgets.length;s++){var a=e.childWidgets[s];o.updateClientAreaForBlock(a,!0),a instanceof fe?this.shiftParagraphWidget(a):this.shiftTableWidget(a,o,r),o.updateClientAreaForBlock(a,!1)}this.updateWidgetToRow(e),o.updateClientAreaForCell(e,!1)},e.prototype.shiftParagraphWidget=function(e){this.addParagraphWidget(this.viewer.clientActiveArea,e),this.viewer.cutFromTop(this.viewer.clientActiveArea.y+e.height),t.isNullOrUndefined(e.floatingElements),this.updateWidgetToPage(this.viewer,e)},e.prototype.shiftWidgetsForTable=function(e,t){var i=this.getBodyWidgetOfPreviousBlock(e,0),n=i.bodyWidget,r=i.index,o=n.lastChild.lastChild.isEndsWithPageBreak;n!==e.containerWidget&&(o?t.updateClientArea(e.bodyWidget.sectionFormat,e.bodyWidget.page):this.updateContainerWidget(e,n,r+1,!0)),(e.isInHeaderFooter||this.viewer instanceof oe)&&(e.containerWidget.height-=e.height),this.viewer.updateClientAreaForBlock(e,!0),this.updateVerticalPositionToTop(e,!0);var s=e.combineWidget(this.viewer);this.documentHelper.layout.updateChildLocationForTable(s.y,s),this.clearTableWidget(s,!0,!1),this.shiftTableWidget(s,this.viewer),this.updateVerticalPositionToTop(e,!1),this.viewer.updateClientAreaForBlock(e,!1)},e.prototype.updateVerticalPositionToTop=function(e,t){for(var i=0;i<e.getSplitWidgets().length;i++)for(var n=e.getSplitWidgets()[i],r=0;r<n.childWidgets.length;r++)for(var o=n.childWidgets[r],s=0;s<o.childWidgets.length;s++){var a=o.childWidgets[s];this.documentHelper.layout.updateCellVerticalPosition(a,t,!1)}},e.prototype.splitWidget=function(e,i,n,r,o,s){var a=e.childWidgets[0],l=this.getMaxElementHeight(a),d=e.getSplitWidgets(),h=e.containerWidget;if(i.clientActiveArea.height>=l&&!o){var c=void 0,p=d.indexOf(e);p<d.length-1?h=(c=d[p+1]).containerWidget:((c=new fe).index=e.index,c.characterFormat=e.characterFormat,c.paragraphFormat=e.paragraphFormat,c.width=e.width,c.x=e.x,c.y=e.y,d.push(c)),n!==e.containerWidget&&this.updateContainerWidget(e,n,r,!0);for(var u=e.childWidgets.length-1;u>0&&!this.isFitInClientArea(e,i,void 0);u--){var g=e.childWidgets[u];this.updateParagraphWidgetInternal(g,c,0)}if(t.isNullOrUndefined(c.containerWidget)&&c.childWidgets.length>0){var m=i.clientActiveArea.y,f=new ae(i.clientArea.x,i.clientArea.y,i.clientArea.width,i.clientArea.height),v=new ae(i.clientActiveArea.x,i.clientActiveArea.y,i.clientActiveArea.width,i.clientActiveArea.height);if((h=this.moveBlocksToNextPage(e)).childWidgets.splice(0,0,c),h.height+=c.height,c.containerWidget=h,1===h.childWidgets.length&&h.firstChild instanceof fe&&h.firstChild.equals(e))return e.y=m,!0;i.clientArea=f,i.clientActiveArea=v}}else if(h=this.createOrGetNextBodyWidget(n,this.viewer),e.containerWidget!==h&&(h=this.moveBlocksToNextPage(e),this.updateContainerWidget(e,h,0,!0),s.length>0)){if(void 0===h.page.footnoteWidget){var y=new me;y.footNoteType="Footnote",y.page=h.page;var b=new fe;b.characterFormat=new H,b.paragraphFormat=new P,b.index=0;var w=new we(b);b.childWidgets.push(w),y.childWidgets.push(b),y.height=this.documentHelper.textHelper.getParagraphMarkSize(b.characterFormat).Height,h.page.footnoteWidget=y}if(h.page.footnoteWidget)for(var C=0;C<s.length;C++)n.page.footnoteWidget.childWidgets.splice(n.page.footnoteWidget.childWidgets.indexOf(s[C]),1),h.page.footnoteWidget.childWidgets.push(s[C]),h.page.footnoteWidget.height+=s[C].height}return n===e.containerWidget?(e.y=i.clientActiveArea.y,i.cutFromTop(i.clientActiveArea.y+e.height)):i.updateClientArea(h.sectionFormat,h.page),!1},e.prototype.getMaxElementHeight=function(e){var t=0;if(0===e.children.length||1===e.children.length&&e.children[0]instanceof Ke||2===e.children.length&&e.children[0]instanceof Ke&&e.children[1]instanceof Ke){t=this.documentHelper.selection.getParagraphMarkSize(e.paragraph,0,0).height,t+=0,e.children.length>0&&t<(n=e.children[0]).margin.top+n.height&&(t=n.margin.top+n.height)}else for(var i=0;i<e.children.length;i++){var n=e.children[i];t<n.margin.top+n.height&&(t=n.margin.top+n.height)}return t},e.prototype.createOrGetNextBodyWidget=function(e,t){var i=void 0,n=0;n=this.documentHelper.pages.indexOf(e.page);var r=void 0,o=void 0;if(o=e.index,n===this.documentHelper.pages.length-1||this.documentHelper.pages[n+1].sectionIndex!==o){var s=new pe;s.sectionFormat=e.sectionFormat,s.index=e.index,r=t.createNewPage(s),this.documentHelper.pages[n+1].sectionIndex!==o&&this.documentHelper.insertPage(n+1,r),i=r.bodyWidgets[0]}else i=(r=this.documentHelper.pages[n+1]).bodyWidgets[0];return i},e.prototype.isFitInClientArea=function(e,i,n){var r=e.childWidgets[e.childWidgets.length-1],o=e.height,s=this.getMaxElementHeight(r);r.height>s&&(o-=r.height-s);var a=0;if(!t.isNullOrUndefined(n)&&n.length>0)for(var l=0;l<n.length;l++)a+=n[l].height;return i.clientActiveArea.height>=o+a},e.prototype.shiftToPreviousWidget=function(e,i,n,r){for(var o=0;o<e.childWidgets.length;o++){var s=e.childWidgets[o],a=this.getMaxElementHeight(s);if(!(i.clientActiveArea.height>=a)||r){var l=n.containerWidget,d=this.createOrGetNextBodyWidget(l,i);e.containerWidget!==d&&(d=this.moveBlocksToNextPage(e)),l!==d&&this.updateContainerWidget(e,d,0,!0),i.updateClientArea(d.sectionFormat,d.page);break}if(this.updateParagraphWidgetInternal(s,n,n.childWidgets.length),o--,i.cutFromTop(i.clientActiveArea.y+s.height),t.isNullOrUndefined(e.childWidgets))break}},e.prototype.updateParagraphWidgetInternal=function(e,i,n){t.isNullOrUndefined(e.paragraph)||(e.paragraph.childWidgets.splice(e.paragraph.childWidgets.indexOf(e),1),e.paragraph.height-=e.height,t.isNullOrUndefined(e.paragraph.containerWidget)||(e.paragraph.containerWidget.height-=e.height),(t.isNullOrUndefined(e.paragraph.childWidgets)||0===e.paragraph.childWidgets.length)&&e.paragraph.destroyInternal(this.viewer)),i.childWidgets.splice(n,0,e),e.paragraph=i,i.height+=e.height,t.isNullOrUndefined(i.containerWidget)||(i.containerWidget.height+=e.height)},e.prototype.shiftNextWidgets=function(e){for(var t=e;t.nextWidget instanceof ge;)t=t.nextWidget,this.reLayoutOrShiftWidgets(t,this.viewer)},e.prototype.updateContainerWidget=function(e,i,n,r){if(!t.isNullOrUndefined(e.containerWidget)&&(e.containerWidget.childWidgets.splice(e.containerWidget.childWidgets.indexOf(e),1),e.containerWidget.height-=i.height,(t.isNullOrUndefined(e.containerWidget.childWidgets)||0===e.containerWidget.childWidgets.length)&&e.containerWidget instanceof pe&&e.containerWidget!==i&&r)){var o=e.containerWidget.page;this.documentHelper.pages[this.documentHelper.pages.length-1]===o&&-1!==this.viewer.visiblePages.indexOf(o)&&this.documentHelper.scrollToBottom(),(t.isNullOrUndefined(o.nextPage)||o.nextPage.bodyWidgets[0].index!==e.containerWidget.index)&&e.containerWidget.destroyInternal(this.viewer)}if(i.childWidgets.splice(n,0,e),e instanceof fe&&!t.isNullOrUndefined(e.floatingElements))for(var s=0;s<e.floatingElements.length;s++){var a=e.floatingElements[s];"Inline"!==a.textWrappingStyle&&(i.floatingElements.push(a),e.bodyWidget.floatingElements.splice(e.bodyWidget.floatingElements.indexOf(a),1),i.floatingElements.sort(function(e,t){return e.y-t.y}))}i.height+=i.height,e.containerWidget=i},e.prototype.getBodyWidgetOfPreviousBlock=function(e,t){t=0;var i=void 0,n=e.previousRenderedWidget;return i=n&&n.containerWidget.equals(e.containerWidget)?n.containerWidget:e.containerWidget,t=n&&n.containerWidget.equals(e.containerWidget)?i.childWidgets.indexOf(n):e.containerWidget.childWidgets.indexOf(e),{bodyWidget:i,index:t}},e.prototype.moveBlocksToNextPage=function(e){var i=e.bodyWidget,n=i.page.index+1,r=void 0,o=void 0,s=!1;for(this.documentHelper.pages.length>n&&(0!==(r=this.documentHelper.pages[n]).bodyWidgets.length&&i.equals(r.bodyWidgets[0])?(o=r.bodyWidgets[0],this.viewer.updateClientArea(o.sectionFormat,o.page)):(r=void 0,s=!0)),t.isNullOrUndefined(r)&&(o=this.createSplitBody(i),r=this.viewer.createNewPage(o,n),s&&this.documentHelper.insertPage(n,r));;){var a=void 0;if(a=i.lastChild instanceof me?i.lastChild.previousWidget:i.lastChild,e===a)break;var l=[],d=[];if(a.childWidgets.length>0)for(h=0;h<this.documentHelper.footnoteCollection.length;h++)this.documentHelper.footnoteCollection[h].line.paragraph===a&&l.push(this.documentHelper.footnoteCollection[h]);if(l.length>0&&a.bodyWidget.page.footnoteWidget)for(h=0;h<a.bodyWidget.page.footnoteWidget.childWidgets.length;h++)a.bodyWidget.page.footnoteWidget.childWidgets[h].footNoteReference===l[0]&&d.push(a.bodyWidget.page.footnoteWidget.childWidgets[h]);i.childWidgets.splice(i.childWidgets.indexOf(a),1),o.childWidgets.splice(0,0,a);for(var h=0;h<d.length;h++)if(i.page.footnoteWidget){if(i.page.footnoteWidget.childWidgets.splice(i.page.footnoteWidget.childWidgets.indexOf(d[h]),1),void 0===o.page.footnoteWidget){var c=new me;c.footNoteType="Footnote",c.page=o.page;var p=new fe;p.characterFormat=new H,p.paragraphFormat=new P,p.index=0;var u=new we(p);p.childWidgets.push(u),c.childWidgets.push(p),c.height=this.documentHelper.textHelper.getParagraphMarkSize(p.characterFormat).Height,o.page.footnoteWidget=c}o.page.footnoteWidget.childWidgets.splice(1,0,d[h])}a.containerWidget=o,o.height+=a.height}return o},e.prototype.createSplitBody=function(e){var t=this.addBodyWidget(this.viewer.clientActiveArea);return t.sectionFormat=e.sectionFormat,t.index=e.index,t},e.prototype.reLayoutLine=function(e,i,n,r){this.isFootnoteContentChanged=!1,this.viewer.owner.isDocumentLoaded&&this.viewer.owner.editorModule&&this.viewer.owner.editorModule.updateWholeListItems(e);var o;if(o=e.paragraphFormat.listFormat&&-1!==e.paragraphFormat.listFormat.listId?e.getSplitWidgets()[0].firstChild:e.childWidgets[i],!this.isBidiReLayout&&(e.paragraphFormat.bidi||this.isContainsRtl(o)))for(var s=i<=0?0:i-1;s<e.childWidgets.length;s++)(!n&&(e.paragraphFormat.bidi&&this.isContainsRtl(o)||r)||s!==i)&&this.reArrangeElementsForRtl(e.childWidgets[s],e.paragraphFormat.bidi);var a=o.previousLine;t.isNullOrUndefined(a)&&(a=o);a.paragraph;var l=e.containerWidget;if(l.height-=e.height,!this.viewer.owner.enableHeaderAndFooter&&!e.isInHeaderFooter||l instanceof _e?l instanceof _e?this.viewer.updateClientAreaForTextBoxShape(l.containerShape,!0):this.viewer.updateClientArea(l.sectionFormat,l.page,!0):(e.bodyWidget.isEmpty=!1,this.viewer.updateHeaderFooterClientAreaWithTop(e.bodyWidget.sectionFormat,this.documentHelper.isBlockInHeader(e),l.page)),this.viewer.updateClientAreaForBlock(e,!0),e.containerWidget instanceof me){this.isRelayoutFootnote=!1;var d=e.y;return this.layoutParagraph(e,0),this.viewer.updateClientAreaForBlock(e,!1),e.containerWidget.height+=e.height,e.y=0,"Footnote"===e.containerWidget.footNoteType&&this.viewer.updateFootnoteClientArea(e.containerWidget.sectionFormat,e.containerWidget),this.viewer.cutFromTop(d),void this.layoutParagraph(e,0)}if(a.paragraph.isEmpty())this.viewer.cutFromTop(e.y),this.layoutParagraph(e,0);else{if(this.updateClientAreaForLine(a),this.layoutListItems(a.paragraph),a.isFirstLine()&&!t.isNullOrUndefined(e.paragraphFormat)){var h=-W.convertPointToPixel(e.paragraphFormat.firstLineIndent);this.viewer.updateClientWidth(h)}do{e=(a=this.layoutLine(a,0)).paragraph,a=a.nextLine}while(a);this.updateWidgetToPage(this.viewer,e),this.viewer.updateClientAreaForBlock(e,!1)}this.layoutNextItemsBlock(e,this.viewer);var c,p=this.documentHelper.pages.length,u=this.documentHelper.pages[p-1].bodyWidgets[0];this.isFootnoteContentChanged&&!t.isNullOrUndefined(e.bodyWidget.page.footnoteWidget)&&(c=e.bodyWidget.page.footnoteWidget,this.layoutfootNote(c)),this.isEndnoteContentChanged&&!t.isNullOrUndefined(u.page.endnoteWidget)&&(c=u.page.endnoteWidget,this.viewer.cutFromTop(u.childWidgets[u.childWidgets.length-1].y+u.childWidgets[u.childWidgets.length-1].height),this.layoutfootNote(c))},e.prototype.isContainsRtl=function(e){for(var t=!1,i=0;i<e.children.length&&!(e.children[i]instanceof Ie&&(t=e.children[i].characterFormat.bidi||"RTL"===e.children[i].characterFormat.bdo||this.documentHelper.textHelper.isRTLText(e.children[i].text)));i++);return t},e.prototype.reArrangeElementsForRtl=function(e,i){if(0!==e.children.length){for(var n=!1,r=-1,o=[],s=0;s<e.children.length;s++){var a=e.children[s],l=void 0;a.characterFormat&&(l=a.characterFormat);var d=!1,h="",c=!1;if(a instanceof ke)i?(n||0===a.bookmarkType&&a.nextElement&&a.nextElement.nextElement instanceof Ie&&this.documentHelper.textHelper.isRTLText(a.nextElement.nextElement.text)||1===a.bookmarkType&&a.nextElement instanceof Ie&&this.documentHelper.textHelper.isRTLText(a.nextElement.text)?o.splice(0,0,a):o.splice(n?r:r+1,0,a),r=o.indexOf(a)):o.push(a);else{if(a instanceof Ie){if(h=a.text,(c=this.documentHelper.textHelper.containsSpecialCharAlone(h.trim()))&&l.bidi&&i){h=W.reverseString(h);for(var p=0;p<h.length;p++){var u=this.documentHelper.textHelper.inverseCharacter(h.charAt(p));h=h.replace(h.charAt(p),u)}a.text=h}var g=a.nextElement;if(a instanceof Ie&&this.documentHelper.textHelper.containsNumberAlone(a.text.trim())){for(;g instanceof Ie&&""!==g.text.trim()&&(this.documentHelper.textHelper.containsNumberAlone(g.text.trim())||this.documentHelper.textHelper.containsSpecialCharAlone(g.text.trim()));)a.text=a.text+g.text,a.line.children.splice(a.line.children.indexOf(g),1),g=a.nextElement;a.width=this.documentHelper.textHelper.getTextSize(a,a.characterFormat)}}if(d=a instanceof Ke?i:this.documentHelper.textHelper.isRTLText(h)||l.bidi||"RTL"===l.bdo,(a instanceof xe||this.isRtlFieldCode)&&(0===a.fieldType?this.isRtlFieldCode=!0:1===a.fieldType&&(this.isRtlFieldCode=!1),d=!1),!d&&!t.isNullOrUndefined(h)&&""!==h&&(""!==h&&""===h.trim()||c)){var m=e.children;l.bidi?n?d=!0:s+1<e.children.length&&e.children[s+1]instanceof Ie&&(h=m[s+1].text,d=this.documentHelper.textHelper.isRTLText(h)||m[s+1].characterFormat.bidi||"RTL"===m[s+1].characterFormat.bdo):n&&(d=!0)}a.isRightToLeft=d,d&&"LTR"!==l.bdo?n?o.splice(r,0,a):(i?o.splice(0,0,a):o.push(a),n=!0,r=o.indexOf(a)):n&&a instanceof Ge?l.bidi?o.splice(r+1,0,a):o.splice(r,0,a):(i?(n?o.splice(0,0,a):o.splice(r+1,0,a),r=o.indexOf(a)):o.push(a),n=!1)}}e.children=[],e.children=o}},e.prototype.shiftLayoutFloatingItems=function(e){for(var t=0;t<e.floatingElements.length;t++){var i=e.floatingElements[t],n=this.getFloatingItemPoints(i),r=n.y-i.y;if(i.x=n.x,i.y=n.y,i instanceof Ve)for(var o=0;o<i.textFrame.childWidgets.length;o++){var s=i.textFrame.childWidgets[o];s instanceof fe?s.y=s.y+r:s instanceof ve&&this.shiftChildLocationForTableWidget(s,r)}}},e.prototype.getFloatingItemPoints=function(e){var t=e.line.paragraph,i=t.bodyWidget.sectionFormat,n=0,r=0;if(t){var o=W.convertPointToPixel(i.leftMargin),s=W.convertPointToPixel(i.rightMargin),a=W.convertPointToPixel(i.topMargin),l=i.bottomMargin>0?W.convertPointToPixel(i.bottomMargin):48,d=W.convertPointToPixel(i.headerDistance),h=W.convertPointToPixel(i.footerDistance),c=W.convertPointToPixel(i.pageWidth),p=W.convertPointToPixel(i.pageHeight),u=c-(o+s),g=p-a-l;a=t.isInHeaderFooter&&i.topMargin<=0?Math.abs(a)>0?Math.abs(a):W.convertPointToPixel(i.headerDistance)+t.height:a>0?a:48,!t.isInHeaderFooter&&a<this.viewer.clientArea.y&&(a=this.viewer.clientArea.y);var m="InFrontOfText",f=!1,v=e.verticalOrigin,y=e.horizontalOrigin,b=e.horizontalAlignment,w=e.verticalAlignment,C=e.height,x=e.width,F=e.verticalPosition,P=e.horizontalPosition,T=e.layoutInCell,S=void 0;if(e instanceof Ve&&(S=e.autoShapeType),t.isInsideTable&&T)f=!0,r=this.getVerticalPosition(e,F,v,m),n=this.getHorizontalPosition(e.width,e,b,y,P,m,t.associatedCell.cellFormat.cellWidth);else{switch(v){case"Page":case"TopMargin":switch(r=F,w){case"Top":r=F;break;case"Center":r="TopMargin"===v?(a-C)/2:(p-C)/2;break;case"Outside":case"Bottom":r="Page"===v&&"Bottom"===w?p-C:"TopMargin"===v?a-C:(t.bodyWidget.page.index+1)%2!=0?p-C-h/2:d/2;break;case"Inside":"Page"===v?r=(t.bodyWidget.page.index+1)%2==0?p-C-h/2:d/2:(t.bodyWidget.page.index+1)%2==0&&(r=(a-C)/2-d)}break;case"Line":switch(r=F,w){case"Inside":case"Top":r=this.viewer.clientActiveArea.y;break;case"Center":r=this.viewer.clientActiveArea.y-C/2;break;case"Outside":case"Bottom":r=this.viewer.clientActiveArea.y-C;break;case"None":r=Math.round(t.y)+F}break;case"BottomMargin":switch(r=F,w){case"Inside":case"Top":r=p-l;break;case"Center":r=p-l+(l-C)/2;break;case"Outside":case"Bottom":r=t.bodyWidget.page.index+1!==0&&"Outside"===w?p-l:p-C;break;case"None":r=p-l+F}break;case"InsideMargin":case"OutsideMargin":switch(r=F,w){case"Inside":r="InsideMargin"===v?"InsideMargin"===v&&t.bodyWidget.page.index+1===0?p-C:0:(t.bodyWidget.page.index+1)%2!=0?p-l:a-C;break;case"Top":r="InsideMargin"===v?(t.bodyWidget.page.index+1)%2==0?p-l:0:(t.bodyWidget.page.index+1)%2!=0?p-l:0;break;case"Center":r="OutsideMargin"===v?(t.bodyWidget.page.index+1)%2!=0?p-l+(l-C)/2:(a-C)/2:(t.bodyWidget.page.index+1)%2==0?p-l+(l-C)/2:(a-C)/2;break;case"Outside":r="InsideMargin"===v?(t.bodyWidget.page.index+1)%2==0?p-l:a-C:(t.bodyWidget.page.index+1)%2!=0?a-C:p-l;break;case"Bottom":r="OutsideMargin"===v?t.bodyWidget.page.index+1!==0?p-C:a-C:(t.bodyWidget.page.index+1)%2==0?p-C:a-C}break;case"Paragraph":r=Math.round(t.y)+0+F;break;case"Margin":switch(r=t.isInHeaderFooter&&d>a?d+t.height+F:a+F,w){case"Top":r=a;break;case"Center":r=a+(g-C)/2;break;case"Outside":case"Bottom":r=(t.bodyWidget.page.index+1)%2!=0?a+g-C:a;break;case"Inside":r=(t.bodyWidget.page.index+1)%2==0?a+g-C:a}break;default:r=this.viewer.clientArea.y-F}switch(y){case"Page":switch(n=P,b){case"Center":n=f?(t.associatedCell.cellFormat.cellWidth-x)/2:(c-x)/2;break;case"Left":n=0;break;case"Outside":case"Right":n=f?t.associatedCell.cellFormat.cellWidth-x:c-x;break;case"None":n=f?t.associatedCell.x+P:P}n<0&&f&&(n=t.associatedCell.x);break;case"Column":switch(n=this.viewer.clientActiveArea.x<t.x?t.x+P:"StraightConnector"===S?P+W.convertPointToPixel(i.leftMargin):t.x+P,b){case"Center":n=this.viewer.clientActiveArea.x+(this.viewer.clientActiveArea.width-x)/2;break;case"Left":n=this.viewer.clientActiveArea.x;break;case"Right":n=this.viewer.clientActiveArea.x+this.viewer.clientActiveArea.width-x}break;case"Margin":if(t.bodyWidget)switch(n=o+P,b){case"Center":n=o+(u-x)/2;break;case"Left":n=o;break;case"Outside":(t.bodyWidget.page.index+1)%2!=0&&(n=o+u-x);break;case"Right":n=o+u-x;break;case"Inside":(t.bodyWidget.page.index+1)%2==0&&(n=o+u-x)}else n=this.viewer.clientArea.x+P;break;case"Character":n="Right"===b||"Center"===b?this.getLeftMarginHorizPosition(o,b,P,x,m):this.viewer.clientArea.x+P;break;case"LeftMargin":n=this.getLeftMarginHorizPosition(o,b,P,x,m);break;case"RightMargin":n=this.getRightMarginHorizPosition(c,s,b,P,x,m);break;case"InsideMargin":n=(t.bodyWidget.page.index+1)%2==0?this.getRightMarginHorizPosition(c,s,b,P,x,m):this.getLeftMarginHorizPosition(o,b,P,x,m);break;case"OutsideMargin":n=(t.bodyWidget.page.index+1)%2==0?this.getLeftMarginHorizPosition(o,b,P,x,m):this.getRightMarginHorizPosition(c,s,b,P,x,m);break;default:n=this.viewer.clientArea.x+P}}}return new O(n,r)},e.prototype.getLeftMarginHorizPosition=function(e,t,i,n,r){var o=i;switch(t){case"Center":o=(e-n)/2;break;case"Left":o=0;break;case"Right":o=e-n}return o<0&&"InFrontOfText"!==r&&"Behind"!==r&&(o=0),o},e.prototype.getRightMarginHorizPosition=function(e,t,i,n,r,o){var s=e-t,a=s+n;switch(i){case"Center":a=s+(t-r)/2;break;case"Left":a=s;break;case"Right":a=e-r}return(a<0||a+r>e)&&"InFrontOfText"!==o&&"Behind"!==o&&(a=e-r),a},e.prototype.getVerticalPosition=function(e,t,i,n){var r=e.line.paragraph,o=e,s=0,a=r.associatedCell.y;switch(i){case"Page":case"Margin":case"TopMargin":case"InsideMargin":case"BottomMargin":case"OutsideMargin":s=a+t;break;case"Line":case"Paragraph":var l=0;o&&(l=r.paragraphFormat.afterSpacing),s=r.y+t+l;break;default:s=this.viewer.clientActiveArea.y+t}return s},e.prototype.getHorizontalPosition=function(e,t,i,n,r,o,s){var a=0,l=t.line.paragraph.associatedCell,d=s-l.leftMargin-l.rightMargin,h=l.cellFormat.cellWidth,c=l.x,p=c-l.leftMargin;switch(n){case"Page":switch(a=r,i){case"Center":a=p+(d-e)/2;break;case"Left":a=p;break;case"Right":a=p+(d-e);break;case"None":a=p+r}break;case"Column":case"Margin":switch(i){case"Center":a=c+(h-e)/2;break;case"Left":a=c;break;case"Right":a=c+(h-e);break;case"None":a=c+r}break;default:a=c+r}return a},e.prototype.cropPosition=function(e){var t=0,i=0,n=e;n.isCrop=!0,0!==n.left&&(n.x=n.left*n.cropWidthScale/100),0!==n.top&&(n.y=n.top*n.cropHeightScale/100),0!==n.right&&(t=n.right*n.cropWidthScale/100),0!==n.bottom&&(i=n.bottom*n.cropHeightScale/100),n.cropWidth=n.cropWidthScale-(n.x+t),n.cropHeight=n.cropHeightScale-(n.y+i)},e.prototype.isTocField=function(e){if(e instanceof xe){var t=e.nextNode;if(e instanceof xe&&0===e.fieldType&&t instanceof Ie&&-1!==t.text.trim().toLowerCase().indexOf("toc"))return!0}return!1},e}(),q=function(){function e(e){this.isPrinting=!1,this.pageLeft=0,this.pageTop=0,this.pageIndex=-1,this.isFieldCode=!1,this.leftPosition=0,this.topPosition=0,this.height=0,this.documentHelper=e}return Object.defineProperty(e.prototype,"pageCanvas",{get:function(){return this.isPrinting?(t.isNullOrUndefined(this.pageCanvasIn)&&(this.pageCanvasIn=document.createElement("canvas"),this.pageCanvasIn.getContext("2d").save()),this.pageCanvasIn):t.isNullOrUndefined(this.viewer)?void 0:this.documentHelper.containerCanvas},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spellChecker",{get:function(){return this.documentHelper.owner.spellChecker},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectionCanvas",{get:function(){return t.isNullOrUndefined(this.viewer)?void 0:this.documentHelper.selectionCanvas},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageContext",{get:function(){return this.pageCanvas.getContext("2d")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectionContext",{get:function(){return this.selectionCanvas.getContext("2d")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewer",{get:function(){return this.documentHelper.owner.viewer},enumerable:!0,configurable:!0}),e.prototype.renderWidgets=function(e,i,n,r,o){if(!t.isNullOrUndefined(this.pageCanvas)&&!t.isNullOrUndefined(e)){if(this.pageContext.fillStyle=W.getColor(this.documentHelper.backgroundColor),this.pageContext.beginPath(),this.viewer instanceof oe){o=o>this.documentHelper.visibleBounds.height?o:this.documentHelper.visibleBounds.height;var s=n;0===e.index&&(s=n-this.viewer.padding.top),this.pageContext.fillRect(i-this.viewer.padding.left,s,r+this.viewer.padding.left,o+this.viewer.padding.top)}else this.pageContext.fillRect(i,n,r,o);this.pageContext.closePath(),this.viewer instanceof re&&(this.pageContext.strokeStyle=this.documentHelper.owner.pageOutline,this.pageContext.strokeRect(i,n,r,o)),this.pageLeft=i,this.pageTop=n,this.pageIndex=e.index,this.isPrinting?this.setPageSize(e):(this.pageContext.beginPath(),this.pageContext.save(),this.pageContext.rect(i,n,r,o),this.pageContext.clip()),this.height=o,e.headerWidget&&this.renderHFWidgets(e,e.headerWidget,r,!0),e.footerWidget&&this.renderHFWidgets(e,e.footerWidget,r,!1);for(var a=0;a<e.bodyWidgets.length;a++)this.render(e,e.bodyWidgets[a]),e.footnoteWidget&&"Pages"===this.documentHelper.owner.layoutType&&this.renderfootNoteWidget(e,e.footnoteWidget);e.endnoteWidget&&"Pages"===this.documentHelper.owner.layoutType&&this.renderfootNoteWidget(e,e.endnoteWidget),this.documentHelper.owner.enableHeaderAndFooter&&!this.isPrinting&&this.renderHeaderSeparator(e,this.pageLeft,this.pageTop,e.headerWidget),this.pageLeft=0,this.pageTop=0,this.pageContext.restore()}},e.prototype.setPageSize=function(e){this.pageContext.clearRect(0,0,this.pageCanvas.width,this.pageCanvas.height),this.selectionContext.clearRect(0,0,this.selectionCanvas.width,this.selectionCanvas.height),this.pageContext.restore(),this.selectionContext.restore();var t=e.boundingRectangle.width,i=e.boundingRectangle.height,n=Math.max(1,window.devicePixelRatio||1);this.pageCanvas.width===t*n&&this.pageCanvas.height===i*n||(this.pageCanvas.height=i*n,this.pageCanvas.width=t*n,this.pageCanvas.style.height=i+"px",this.pageCanvas.style.width=t+"px",this.pageContext.globalAlpha=1,this.pageContext.scale(n,n))},e.prototype.renderHFWidgets=function(e,t,i,n){this.isPrinting||(this.pageContext.globalAlpha=this.documentHelper.owner.enableHeaderAndFooter?1:.65);var r=!1,o=0,s=0,a=e.boundingRectangle.height/100*40;if(n){var l=W.convertPointToPixel(e.bodyWidgets[0].sectionFormat.topMargin);Math.max(t.y+t.height,l)>a&&(r=!0,this.pageContext.beginPath(),this.pageContext.save(),this.pageContext.rect(this.pageLeft,this.pageTop,i,this.getScaledValue(a)),this.pageContext.clip())}else{var d=W.convertPointToPixel(e.bodyWidgets[0].sectionFormat.footerDistance),h=e.boundingRectangle.height-Math.max(e.footerWidget.height+d,W.convertPointToPixel(e.footerWidget.sectionFormat.bottomMargin));o=Math.max(e.boundingRectangle.height-a,h),s=e.boundingRectangle.height-d}this.renderFloatingItems(e,t.floatingElements,"Behind");for(var c=0;c<t.childWidgets.length;c++){var p=t.childWidgets[c];n||(o+=p.height),(n||!n&&this.getScaledValue(o)<=this.getScaledValue(s))&&this.renderWidget(e,p)}this.renderFloatingItems(e,t.floatingElements,"InFrontOfText"),r&&this.pageContext.restore(),this.isPrinting||(this.pageContext.globalAlpha=this.documentHelper.owner.enableHeaderAndFooter?.65:1)},e.prototype.renderHeaderSeparator=function(e,t,i,n){var r=W.convertPointToPixel(e.bodyWidgets[0].sectionFormat.topMargin),o=this.getScaledValue(Math.max(n.y+n.height,r)),s=this.getScaledValue(e.boundingRectangle.width),a=this.pageContext;a.save(),a.globalAlpha=.65;var l=this.getScaledValue(e.boundingRectangle.height)/100*40;o=Math.min(o,l),this.renderDashLine(a,t,i+o,s,"#000000",!1);var d=this.getHeaderFooterType(e,!0);a.font="9pt Arial";var h=a.measureText(d).width;if(this.renderHeaderFooterMark(a,t+5,i+o,h+10,20),this.renderHeaderFooterMarkText(a,d,t+10,o+i+15),e.footerWidget){var c=W.convertPointToPixel(e.bodyWidgets[0].sectionFormat.footerDistance),p=this.getScaledValue(e.boundingRectangle.height)-this.getScaledValue(Math.max(e.footerWidget.height+c,W.convertPointToPixel(e.footerWidget.sectionFormat.bottomMargin)));p=Math.max(this.getScaledValue(e.boundingRectangle.height)-l,p),this.renderDashLine(a,t,i+p,s,"#000000",!1),d=this.getHeaderFooterType(e,!1),h=a.measureText(d).width,this.renderHeaderFooterMark(a,t+5,i+p-20,h+10,20),this.renderHeaderFooterMarkText(a,d,t+10,i+p-5),a.restore()}},e.prototype.getHeaderFooterType=function(e,i){var n;return n=i?"Header":"Footer",e.bodyWidgets[0].sectionFormat.differentFirstPage&&(t.isNullOrUndefined(e.previousPage)||e.sectionIndex!==e.previousPage.sectionIndex)?n=i?"First Page Header":"First Page Footer":e.bodyWidgets[0].sectionFormat.differentOddAndEvenPages&&(n=(this.documentHelper.pages.indexOf(e)+1)%2==0?i?"Even Page Header":"Even Page Footer":i?"Odd Page Header":"Odd Page Footer"),n},e.prototype.renderDashLine=function(e,t,i,n,r,o){e.beginPath(),e.strokeStyle=r,e.lineWidth=1,o?e.setLineDash([3,2]):e.setLineDash([6,4]),e.moveTo(t,i),e.lineTo(t+n,i),e.stroke(),e.setLineDash([]),e.closePath()},e.prototype.renderSolidLine=function(e,t,i,n,r){e.beginPath(),e.strokeStyle=r,e.lineWidth=.5,e.moveTo(t,i),e.lineTo(t+n,i),e.stroke(),e.closePath()},e.prototype.renderHeaderFooterMark=function(e,t,i,n,r){e.beginPath(),e.fillStyle="lightgray",e.fillRect(t,i,n,r),e.strokeStyle="black",e.strokeRect(t,i,n,r),e.closePath()},e.prototype.renderHeaderFooterMarkText=function(e,t,i,n){e.beginPath(),e.fillStyle="#000000",e.textBaseline="alphabetic",e.fillText(t,i,n),e.closePath()},e.prototype.render=function(e,t){this.isFieldCode&&(this.isFieldCode=!1),this.renderFloatingItems(e,e.bodyWidgets[0].floatingElements,"Behind");for(var i=0;i<t.childWidgets.length;i++){var n=t.childWidgets[i];0===i&&t.childWidgets[0]instanceof ve&&(t.childWidgets[0].childWidgets[0].rowFormat.isHeader||e.repeatHeaderRowTableWidget)&&this.renderHeader(e,n,this.documentHelper.layout.getHeader(t.childWidgets[0])),this.renderWidget(e,n)}this.renderFloatingItems(e,e.bodyWidgets[0].floatingElements,"InFrontOfText")},e.prototype.renderFloatingItems=function(e,i,n){if(!t.isNullOrUndefined(i)&&i.length>0){i.sort(function(e,t){return e.zOrderPosition-t.zOrderPosition});for(var r=0;r<i.length;r++){var o=i[r];if(!("Behind"===n&&"Behind"!==o.textWrappingStyle||"Behind"!==n&&"Behind"===o.textWrappingStyle))if(o instanceof Ge)this.renderImageElementBox(o,o.x,o.y,0);else if(o instanceof Ve){var s=0===o.height,a=o.autoShapeType,l=o.textFrame.childWidgets,d=this.getScaledValue(o.x,1),h=this.getScaledValue(o.y,2);this.pageContext.beginPath(),o.fillFormat&&o.fillFormat.fill&&(this.pageContext.fillStyle=o.fillFormat.color,this.pageContext.fillRect(d,h,this.getScaledValue(o.width),this.getScaledValue(o.height))),("StraightConnector"===a&&o.lineFormat.line&&"None"!==o.lineFormat.lineFormatType||!t.isNullOrUndefined(o.lineFormat.lineFormatType)&&"None"!==o.lineFormat.lineFormatType)&&(this.pageContext.strokeStyle=W.getColor(o.lineFormat.color),this.pageContext.strokeRect(d,h,this.getScaledValue(o.width),this.getScaledValue(o.height))),this.pageContext.closePath();var c=!1;0!=o.width&&0!=o.height&&(c=!0,this.clipRect(o.x,o.y,this.getScaledValue(o.width),this.getScaledValue(o.height)));for(var p=0;p<l.length;p++)this.renderWidget(e,l[p]),s&&"StraightConnector"!==a&&(o.height+=l[p].height);s&&(s=!1),c&&this.pageContext.restore()}}}},e.prototype.renderWidget=function(e,t){this.documentHelper.owner.enableLockAndEdit&&this.renderLockRegionBorder(e,t),t instanceof fe?this.renderParagraphWidget(e,t):this.renderTableWidget(e,t)},e.prototype.renderLockRegionBorder=function(e,i){if(!i.isInsideTable&&i instanceof ge&&i.locked){var n=this.documentHelper.owner.documentEditorSettings.collaborativeEditingSettings,r=e.bodyWidgets[0].sectionFormat,o=W.convertPointToPixel(r.leftMargin)-5,s=r.pageWidth-r.leftMargin-r.rightMargin;s=W.convertPointToPixel(s)+10,this.viewer instanceof oe&&(o=i.x-5,s=(this.documentHelper.visibleBounds.width-5*this.viewer.padding.right)/this.documentHelper.zoomFactor);var a=i.previousRenderedWidget,l=i.nextRenderedWidget,d=i.lockedBy===this.documentHelper.owner.currentUser?n.editableRegionColor:n.lockedRegionColor,h=i.y,c=i.y+i.height;this.renderSingleBorder(d,o,h,o,c,1),!t.isNullOrUndefined(a)&&a.locked&&i.lockedBy===a.lockedBy||this.renderSingleBorder(d,o,h,o+s,h,1),this.renderSingleBorder(d,o+s,h,o+s,c,1),!t.isNullOrUndefined(l)&&l.locked&&i.lockedBy===l.lockedBy||this.renderSingleBorder(d,o,c,o+s,c,1)}},e.prototype.renderHeader=function(e,i,n){if(!t.isNullOrUndefined(n)){e.viewer.updateClientArea(e.bodyWidgets[0].sectionFormat,e);for(var r=e.viewer.clientArea.y,o=n.ownerTable.getSplitWidgets()[0],s=0;s<=n.rowIndex;s++){if(0===o.childWidgets.length)return;var a=o.childWidgets[s],l=a.clone();l.containerWidget=a.containerWidget,e.viewer.updateClientAreaLocation(l,new ae(e.viewer.clientArea.x,r,l.width,l.height)),e.documentHelper.layout.updateChildLocationForRow(r,l);for(var d=void 0,h=0;h<l.childWidgets.length;h++)d=l.childWidgets[h],this.renderTableCellWidget(e,d);r+=l.height}i.y!==r&&e.documentHelper.layout.updateChildLocationForTable(r,i)}},e.prototype.renderParagraphWidget=function(e,t){for(var i=t.y,n=t.x,r=0;r<t.childWidgets.length;r++){var o=t.childWidgets[r];i+=o.marginTop,this.renderLine(o,e,n,i),i+=o.height}},e.prototype.renderfootNoteWidget=function(e,i){for(var n=0;n<i.childWidgets.length;n++){var r=i.childWidgets[n];if(0!==n)!t.isNullOrUndefined(r.footNoteReference)&&r.childWidgets[0].children[0]instanceof Ie&&(n<2||n>1&&r.footNoteReference!==i.childWidgets[n-1].footNoteReference)&&(r.childWidgets[0].children[0].text=r.childWidgets[0].children[0].text.replace(r.childWidgets[0].children[0].text,r.footNoteReference.text)),this.renderWidget(e,r);else{var o=this.pageContext;this.renderSolidLine(o,this.getScaledValue(r.x,1),this.getScaledValue(r.y+r.height/2,2),300*this.documentHelper.zoomFactor,"#000000")}}},e.prototype.renderTableWidget=function(e,t){if(!this.isFieldCode)for(var i=0;i<t.childWidgets.length;i++){var n=t.childWidgets[i];this.renderTableRowWidget(e,n),t.tableFormat.cellSpacing>0&&this.renderTableOutline(t)}},e.prototype.renderTableRowWidget=function(e,t){for(var i=0;i<t.childWidgets.length;i++){var n=t.childWidgets[i];this.renderTableCellWidget(e,n)}},e.prototype.renderTableCellWidget=function(e,t){if(this.isPrinting||!(this.getScaledValue(t.y,2)+t.height*this.documentHelper.zoomFactor<0||this.getScaledValue(t.y,2)>this.documentHelper.visibleBounds.height)){!this.isPrinting&&e.documentHelper.owner.selection&&e.documentHelper.owner.selection.selectedWidgets.length>0&&e.documentHelper.owner.selection.addSelectionHighlightTable(this.selectionContext,t),this.renderTableCellOutline(e.documentHelper,t);for(var i=0;i<t.childWidgets.length;i++){var n=t.childWidgets[i],r=t.width+t.margin.left+t.margin.right-t.leftBorderWidth;this.isPrinting||this.clipRect(t.x-t.margin.left,t.y,this.getScaledValue(r),this.getScaledValue(this.height)),this.renderWidget(e,n),this.pageContext.restore()}}},e.prototype.renderLine=function(e,i,n,r){!this.isPrinting&&i.documentHelper.owner.selection&&!this.documentHelper.isScrollToSpellCheck&&i.documentHelper.owner.selection.selectedWidgets.length>0&&i.documentHelper.owner.selection.addSelectionHighlight(this.selectionContext,e,r);var o=e.paragraph.paragraphFormat;if(e.isFirstLine()&&!o.bidi&&(n+=W.convertPointToPixel(o.firstLineIndent)),this.documentHelper&&this.documentHelper.selection&&!t.isNullOrUndefined(this.documentHelper.selection.formFieldHighlighters)&&this.documentHelper.selection.formFieldHighlighters.containsKey(e)&&this.documentHelper.owner.documentEditorSettings&&this.documentHelper.owner.documentEditorSettings.formFieldSettings.applyShading)for(var s=i.documentHelper.selection.formFieldHighlighters.get(e),a=0;a<s.length;a++){this.pageContext.fillStyle=this.documentHelper.owner.documentEditorSettings.formFieldSettings.shadingColor;var l=e.height;e.isLastLine()&&(l-=W.convertPointToPixel(this.documentHelper.layout.getAfterSpacing(e.paragraph))),this.pageContext.fillRect(this.getScaledValue(s[a].left,1),this.getScaledValue(r,2),this.getScaledValue(s[a].width),this.getScaledValue(l))}if(this.documentHelper.owner.searchModule&&!t.isNullOrUndefined(i.documentHelper.owner.searchModule.searchHighlighters)&&i.documentHelper.owner.searchModule.searchHighlighters.containsKey(e))for(var s=i.documentHelper.owner.searchModule.searchHighlighters.get(e),a=0;a<s.length;a++)this.pageContext.fillStyle=this.viewer.owner.documentEditorSettings.searchHighlightColor,this.pageContext.fillRect(this.getScaledValue(s[a].left,1),this.getScaledValue(r,2),this.getScaledValue(s[a].width),this.getScaledValue(e.height));if(i.documentHelper.selection&&!t.isNullOrUndefined(i.documentHelper.selection.editRegionHighlighters)&&i.documentHelper.selection.editRegionHighlighters.containsKey(e))for(var s=i.documentHelper.selection.editRegionHighlighters.get(e),a=0;a<s.length;a++)this.pageContext.fillStyle=""!==s[a].color?s[a].color:"#add8e6",this.pageContext.fillRect(this.getScaledValue(s[a].left,1),this.getScaledValue(r,2),this.getScaledValue(s[a].width),this.getScaledValue(e.height));for(var d=!1,a=0;a<e.children.length;a++){var h=e.children[a];if(!(h instanceof Ve||h instanceof Ge&&"Inline"!==h.textWrappingStyle)){if(h instanceof pt||h instanceof Ye){var c=0;this.viewer instanceof re&&(c=this.viewer.pageGap);var p="display:block;position:absolute;",u=this.getScaledValue(r-10+(i.boundingRectangle.y-c*(i.index+1)))+c*(i.index+1)+"px;";if(h instanceof Ye)if(this.documentHelper.owner.enableLockAndEdit){var g=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);g.setLocale(this.documentHelper.owner.locale),h.renderLockMark(this.documentHelper.owner.currentUser,g);var m=this.documentHelper.owner.documentEditorSettings.collaborativeEditingSettings;p+="color:"+(h.user===this.documentHelper.owner.currentUser?m.editableRegionColor:m.lockedRegionColor)+";";var f=W.convertPointToPixel(i.bodyWidgets[0].sectionFormat.leftMargin),v=i.boundingRectangle.x+this.getScaledValue(f-20)+"px;";this.viewer instanceof oe&&(v=e.paragraph.x-5+"px;"),p=p+"left:"+v+"top:"+u,h.editRangeMark.setAttribute("style",p)}else h.editRangeMark&&h.editRangeMark.setAttribute("style","display:none");else if(h instanceof pt&&0===h.commentType&&this.documentHelper.owner.selectionModule)if(this.documentHelper.owner.enableComment&&!d){d=!0,h.renderCommentMark();var y=W.convertPointToPixel(i.bodyWidgets[0].sectionFormat.rightMargin),b=W.convertPointToPixel(i.bodyWidgets[0].sectionFormat.pageWidth),v=i.boundingRectangle.x+this.getScaledValue(b-y+y/4)+"px;";this.viewer instanceof oe&&(v=i.boundingRectangle.width-2*this.viewer.padding.right-2*this.viewer.padding.left+"px;"),p=p+"left:"+v+"top:"+u,h.commentMark.setAttribute("style",p)}else h.commentMark&&h.commentMark.setAttribute("style","display:none")}if(h instanceof xe||this.isFieldCode||0===h.width&&0===h.height)this.isFieldCode&&(h.width=0),n+=h.width+h.margin.left,this.toSkipFieldCode(h);else{var w=this.getUnderlineYPosition(e);this.isPrinting||!(this.getScaledValue(r+h.margin.top,2)+h.height*this.documentHelper.zoomFactor<0||this.getScaledValue(r+h.margin.top,2)>this.documentHelper.visibleBounds.height)?(h instanceof Ke?this.renderListTextElementBox(h,n,r,w):h instanceof Ge?this.renderImageElementBox(h,n,r,w):(h.isVisible=!0,n+=h.padding.left,this.renderTextElementBox(h,n,r,w)),n+=h.width+h.margin.left):(n+=h.width+h.margin.left,h instanceof Ie&&(h.canTrigger=!0,h.isVisible=!1,h.isSpellChecked&&!h.line.paragraph.isChangeDetected||(h.ischangeDetected=!0)))}}}},e.prototype.toSkipFieldCode=function(e){e instanceof xe&&(0===e.fieldType?t.isNullOrUndefined(e.fieldEnd)&&!e.hasFieldEnd||(this.isFieldCode=!0):2!==e.fieldType&&1!==e.fieldType||(this.isFieldCode=!1))},e.prototype.getUnderlineYPosition=function(e){for(var t=0,i=0,n=0;n<e.children.length;n++)e.children[n]instanceof xe||0===e.children[n].width&&0===e.children[n].height||e.children[n]instanceof Ve||t<e.children[n].height+e.children[n].margin.top&&(t=e.children[n].margin.top+e.children[n].height,i=e.children[n]instanceof Ge?.9:e.children[n].height/20);return t-2*i},e.prototype.renderListTextElementBox=function(e,i,n,r){var o=e.margin.top,s=e.margin.left,a=e.listLevel.characterFormat,l=e.line.paragraph.characterFormat,d="empty"===a.fontColor?l.fontColor:a.fontColor;this.pageContext.textBaseline="alphabetic";var h="",c="",p=a.hasValue("fontFamily")?a.fontFamily:l.fontFamily;!this.documentHelper.isIosDevice||"●"!==e.text&&"○"!==e.text||(p="");var u=11===a.fontSize?l.fontSize:a.fontSize,g="Normal"===a.baselineAlignment?l.baselineAlignment:a.baselineAlignment;h=a.hasValue("bold")?a.bold?"bold":"":l.bold?"bold":"",c=a.hasValue("italic")?a.italic?"italic":"":l.italic?"italic":"",u=0===u?.5:u/("Normal"===g?1:1.5),u=this.isPrinting?u:u*this.documentHelper.zoomFactor;var m="None"===a.strikethrough?l.strikethrough:a.strikethrough,f="NoColor"===a.highlightColor?l.highlightColor:a.highlightColor;"NoColor"!==f&&("#"!==f.substring(0,1)?this.pageContext.fillStyle=W.getHighlightColorCode(f):this.pageContext.fillStyle=W.getColor(f),this.pageContext.fillRect(this.getScaledValue(i+s,1),this.getScaledValue(n+o,2),this.getScaledValue(e.width),this.getScaledValue(e.height))),this.pageContext.font=h+" "+c+" "+u+"pt "+p,"Subscript"===g&&(o+=e.height-e.height/1.5);var v=e.baselineOffset;o="Normal"===a.baselineAlignment?o+v:o+v/1.5;var y=e.text;if(!("\t"===y||" "===y)&&(a.bidi||e.line.paragraph.paragraphFormat.bidi)){var b=y.indexOf(".");y=y.substr(b)+y.substring(0,b)}if("empty"===d){var w=this.documentHelper.backgroundColor;this.pageContext.fillStyle=this.getDefaultFontColor(w)}else this.pageContext.fillStyle=W.getColor(d);this.pageContext.fillText(y,this.getScaledValue(i+s,1),this.getScaledValue(n+o,2),this.getScaledValue(e.width)),"None"===a.underline||t.isNullOrUndefined(a.underline)||this.renderUnderline(e,i,n,r,d,a.underline,g),"None"!==m&&this.renderStrikeThrough(e,i,n,a.strikethrough,d,g)},e.prototype.getDefaultFontColor=function(e){return W.isVeryDark(e)?"#FFFFFF":"#000000"},e.prototype.renderTextElementBox=function(e,i,n,r){var o=!1,s=e.line.paragraph.containerWidget;s instanceof be&&(o="Exactly"===s.ownerRow.rowFormat.heightType);var a=e.margin.top,l=e.margin.left;o&&this.clipRect(s.x,s.y,this.getScaledValue(s.width),this.getScaledValue(s.height));var d=e.characterFormat;"NoColor"!==d.highlightColor&&("#"!==d.highlightColor.substring(0,1)?this.pageContext.fillStyle=W.getHighlightColorCode(d.highlightColor):this.pageContext.fillStyle=W.getColor(d.highlightColor),this.pageContext.fillRect(this.getScaledValue(i+l,1),this.getScaledValue(n+a,2),this.getScaledValue(e.width),this.getScaledValue(e.height)));var h=this.checkRevisionType(e),c=h.length>0?this.getRevisionColor(h):d.fontColor;this.pageContext.textBaseline="alphabetic";var p="",u="",g=11;p=d.bold?"bold":"",u=d.italic?"italic":"",g=0===d.fontSize?.5:d.fontSize/("Normal"===d.baselineAlignment?1:1.5),g=this.isPrinting?g:g*this.documentHelper.zoomFactor,this.pageContext.font=p+" "+u+" "+g+"pt "+d.fontFamily,"Subscript"===d.baselineAlignment&&(a+=e.height-e.height/1.5);var m=e.baselineOffset;if(a="Normal"===d.baselineAlignment?a+m:a+m/1.5,"empty"===c){var f=this.documentHelper.backgroundColor;this.pageContext.fillStyle=this.getDefaultFontColor(f)}else this.pageContext.fillStyle=W.getColor(c);var v=this.getScaledValue(e.width),y=e.text;if(e instanceof Oe){var b=e;""!==b.tabText||t.isNullOrUndefined(b.tabLeader)||"None"===b.tabLeader?""!==b.tabText&&(y=b.tabText):(y=this.getTabLeader(e),b.tabText=y)}var w=d.bidi||this.documentHelper.textHelper.isRTLText(e.text);if(y=this.documentHelper.textHelper.setText(y,w,d.bdo,!0),d.allCaps&&(y=y.toUpperCase()),this.pageContext.fillText(y,this.getScaledValue(i+l,1),this.getScaledValue(n+a,2),v),this.documentHelper.owner.isSpellCheck&&!this.spellChecker.removeUnderline&&(this.documentHelper.triggerSpellCheck||e.canTrigger)&&" "!==e.text&&!this.documentHelper.isScrollHandler&&(t.isNullOrUndefined(e.previousNode)||!(e.previousNode instanceof xe))){e.canTrigger=!0,this.leftPosition=this.pageLeft,this.topPosition=this.pageTop;var C=this.spellChecker.checktextElementHasErrors(e.text,e,i);if(C.errorFound){c="#FF0000";for(var x=0;x<C.elements.length;x++){var F=C.elements[x];if(-1===e.ignoreOnceItems.indexOf(this.spellChecker.manageSpecialCharacters(F.text,void 0,!0))){var P=s instanceof be?s.cellFormat.shading.backgroundColor:this.documentHelper.backgroundColor;this.renderWavyLine(F,t.isNullOrUndefined(F.start)?i:F.start.location.x,t.isNullOrUndefined(F.start)?n:F.start.location.y-e.margin.top,r,c,"Single",d.baselineAlignment,P)}}}else(e.ischangeDetected||this.documentHelper.triggerElementsOnLoading)&&(e.ischangeDetected=!1,this.handleChangeDetectedElements(e,r,i,n,d.baselineAlignment))}var T=this.getRevisionType(h,!0);("None"===d.underline||t.isNullOrUndefined(d.underline))&&(t.isNullOrUndefined(T)||"Insertion"!==T.type&&"MoveTo"!==T.type)||this.renderUnderline(e,i,n,r,c,d.underline,d.baselineAlignment,T),T=this.getRevisionType(h,!1),("None"===d.strikethrough||t.isNullOrUndefined(d.strikethrough))&&(t.isNullOrUndefined(T)||"Deletion"!==T.type&&"MoveFrom"!==T.type)||this.renderStrikeThrough(e,i,n,d.strikethrough,c,d.baselineAlignment,T),o&&this.pageContext.restore()},e.prototype.handleChangeDetectedElements=function(e,t,i,n,r){var o=this,s=e.text.trim(),a=this.pageIndex;if("\v"!==e.text&&!this.spellChecker.checkElementCanBeCombined(e,t,a,!0)){var l=s.split(/[\s]+/),d=e.line.getOffset(e,0);if(l.length>1)for(var h=0;h<l.length;h++){var c=l[h],p=this.spellChecker.manageSpecialCharacters(c,void 0,!0);-1===this.spellChecker.ignoreAllItems.indexOf(p)&&-1===e.ignoreOnceItems.indexOf(p)&&(this.handleUnorderedElements(p,e,t,h,d,h===l.length-1,a),d+=c.length+1)}else{p=this.spellChecker.manageSpecialCharacters(s,void 0,!0);if(s.length>0&&-1===this.spellChecker.ignoreAllItems.indexOf(p)&&-1===e.ignoreOnceItems.indexOf(p)){var u=e.indexInOwner,g=e.line.paragraph.indexInOwner,m=this.spellChecker.checkSpellingInPageInfo(p);if(m.isElementPresent&&this.spellChecker.enableOptimizedSpellCheck){var f=JSON.parse('{"HasSpellingError":'+m.hasSpellError+"}");this.spellChecker.handleWordByWordSpellCheck(f,e,i,n,t,r,!0)}else this.spellChecker.callSpellChecker(this.spellChecker.languageID,s,!0,this.spellChecker.allowSpellCheckAndSuggestion).then(function(s){var l=JSON.parse(s),d=(a===o.pageIndex||e.isVisible)&&u===e.indexInOwner&&g===e.line.paragraph.indexInOwner;o.spellChecker.handleWordByWordSpellCheck(l,e,i,n,t,r,d)})}}}},e.prototype.handleUnorderedElements=function(e,t,i,n,r,o,s){var a=this,l=t.indexInOwner,d=t.line.paragraph.indexInOwner;if(e.length>0){var h=this.spellChecker.checkSpellingInPageInfo(e);if(h.isElementPresent&&this.spellChecker.enableOptimizedSpellCheck){var c=JSON.parse('{"HasSpellingError":'+h.hasSpellError+"}");this.spellChecker.handleSplitWordSpellCheck(c,e,t,!0,i,n,r,o)}else this.spellChecker.callSpellChecker(this.spellChecker.languageID,e,!0,this.spellChecker.allowSpellCheckAndSuggestion).then(function(s){var h=JSON.parse(s),c=t.isVisible&&l===t.indexInOwner&&d===t.line.paragraph.indexInOwner;a.spellChecker.handleSplitWordSpellCheck(h,e,t,c,i,n,r,o)})}},e.prototype.renderWavyLine=function(e,t,i,n,r,o,s,a){if(e.text.length>1){var l=e.height/("Normal"===s?1:1.5),d=e.margin.top,h=l/20,c=0;"Subscript"===s||e instanceof Ke?(c=l-2*h+i,c+=(d+=e.height-l)>0?d:0):c=n+i;var p=this.spellChecker.getSpecialCharactersInfo(e.text,e.characterFormat),u=this.spellChecker.getWhiteSpaceCharacterInfo(e.text,e.characterFormat),g=(t+p.beginningWidth+(u.isBeginning?u.width:0)+e.margin.left)*this.documentHelper.zoomFactor+this.leftPosition,m=c*this.documentHelper.zoomFactor+this.topPosition,f=g+this.getScaledValue(e.width-(p.beginningWidth+p.endWidth)-u.width),v=new O(g,m),y=new O(f,m);this.drawWavy(v,y,.5*(f-g),1,.7,r,e.height,a)}},e.prototype.drawWavy=function(e,i,n,r,o,s,a,l,d){this.pageContext.save(),this.pageContext.fillStyle=t.isNullOrUndefined(l)?this.documentHelper.backgroundColor:l,this.pageContext.fillRect(e.x,e.y-r,i.x-e.x,3*r),this.pageContext.restore(),this.pageContext.lineWidth=1,this.pageContext.lineCap="round",this.pageContext.strokeStyle=s,this.pageContext.beginPath();var h=0,c=0,p=e.x,u=e.y,g=i.x,m=i.y,f=0,v=0,y=Math.atan2(m-u,g-p),b=Math.sqrt((p-g)*(p-g)+(u-m)*(u-m)),w=1*r,C=Math.PI*n;for(f;f<=b;f+=o)v=Math.sin(f/b*C)*w,h=e.x+Math.cos(y)*f+Math.cos(y-Math.PI/2)*v,c=e.y+Math.sin(y)*f+Math.sin(y-Math.PI/2)*v,f>0?this.pageContext.lineTo(h,c):this.pageContext.moveTo(h,c);this.pageContext.stroke(),this.pageContext.restore()},e.prototype.getTabLeader=function(e){var t=0,i=this.getTabLeaderString(e.tabLeader),n=i;t=this.documentHelper.textHelper.getWidth(n,e.characterFormat);for(var r=Math.floor(e.width/t),o=0;o<=r;o++)n+=i;return n.slice(0,-1)},e.prototype.getTabLeaderString=function(e){var t="";switch(e){case"Dot":t=".";break;case"Hyphen":t="-";break;case"Underscore":t="_"}return t},e.prototype.clipRect=function(e,t,i,n){this.pageContext.beginPath(),this.pageContext.save(),this.pageContext.rect(this.getScaledValue(e,1),this.getScaledValue(t,2),i,n),this.pageContext.clip()},e.prototype.renderUnderline=function(e,i,n,r,o,s,a,l){var d=e.height/("Normal"===a?1:1.5),h=e.margin.top,c=d/20,p=0,u=d/20;"Subscript"===a||e instanceof Ke?(p=d-2*c+n,p+=(h+=e.height-d)>0?h:0):p=r+n;var g=0;for(t.isNullOrUndefined(l)||(s="MoveTo"===l.type?"Double":"Single"),"Double"===s&&(p-=u),e instanceof Ge&&(c=.9);g<("Double"===s?2:1);){g++;var m=e.width;e instanceof Ie&&t.isNullOrUndefined(e.nextNode)&&(m=this.documentHelper.textHelper.getWidth(W.trimEnd(e.text),e.characterFormat)),this.pageContext.fillRect(this.getScaledValue(i+e.margin.left,1),this.getScaledValue(p,2),this.getScaledValue(m),this.getScaledValue(c)),p+=2*u}},e.prototype.renderStrikeThrough=function(e,i,n,r,o,s,a){var l=e.height/("Normal"===s?1:1.5),d=e.margin.top;"Subscript"===s&&(d+=e.height-l),n+=d>0?d:0;var h=l/20,c=l/2+.5*h,p=0;for(t.isNullOrUndefined(a)||(r="Deletion"===a.type?"SingleStrike":"DoubleStrike"),e instanceof Ge&&(h=.9),"DoubleStrike"===r&&(c-=h);p<("DoubleStrike"===r?2:1);)p++,this.pageContext.fillRect(this.getScaledValue(i+e.margin.left,1),this.getScaledValue(c+n,2),this.getScaledValue(e.width),this.getScaledValue(h)),c+=2*h},e.prototype.renderImageElementBox=function(e,i,n,r){var o=e.margin.top,s=e.margin.left,a=this.checkRevisionType(e),l=a.length>0?this.getRevisionColor(a):"black";this.pageContext.textBaseline="top";var d=0,h=!1,c=e.line.paragraph.containerWidget,p=!1;if(c instanceof be&&(p="Exactly"===c.ownerRow.rowFormat.heightType),"Inline"===e.textWrappingStyle)if(o<0||e.line.paragraph.width<e.width){if(c instanceof be){var u=0;c.childWidgets[0]instanceof fe&&(u=c.childWidgets[0].paragraphFormat.leftIndent),d=c.width+c.margin.left-c.leftBorderWidth-u,h=!0,this.clipRect(i+s,n+o,this.getScaledValue(d),this.getScaledValue(c.height))}}else if(p){var g=c.width+c.margin.left-c.leftBorderWidth;h=!0,this.clipRect(c.x,c.y,this.getScaledValue(g),this.getScaledValue(c.height))}if(e.isMetaFile&&!t.isNullOrUndefined(e.metaFileImageString))this.pageContext.drawImage(e.element,this.getScaledValue(i+s,1),this.getScaledValue(n+o,2),this.getScaledValue(e.width),this.getScaledValue(e.height));else try{e.isCrop?this.pageContext.drawImage(e.element,this.getScaledValue(e.x),this.getScaledValue(e.y),e.cropWidth,e.cropHeight,this.getScaledValue(i+s,1),this.getScaledValue(n+o,2),e.width,e.height):this.pageContext.drawImage(e.element,this.getScaledValue(i+s,1),this.getScaledValue(n+o,2),this.getScaledValue(e.width),this.getScaledValue(e.height))}catch(t){e.imageString="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAgVBMVEX///8AAADgAADY2Njl5eVcXFxjY2NZWVl/f3+wsLCmpqb4+PiioqKpqam7u7vV1dX2uLj2wsLhFRXzpKT3vb30sbHhCwv74+P40dH+9vbkIyO2trbBwcHLy8tsbGycnJz529v4zMzrbGzlLS3qZmblNzfrdXXoRkbvi4vvgYHlHh7CZsBOAAADpUlEQVR4nO3da1faQBSF4ekAUQlUEFs14AXxVv7/D6yaQiZx5mSEYXF2ut+PNKzyyK5diYDmR9czx34AB49C/CjE759w3jvvWr15Tdgz3atXE54f++EcIArxoxA/CvGjED8K8aMQPwrxoxA/CvGLEeZ9jPJdhfk4GyCUjb3ECGE/Q6m/q3DwfudjP0ERZYN9hKdn2hvd3+0jHJz5/kBVuTk96bbQUEjhYR9ckiikUH8UUqg/CinUH4UU6o9CCvVHIYX6o5BC/VFIof4opFB/FFKoPwop1B+FFOqPQgrjyxfjVC38Lxk9tnAxGqZqdKtSOE4GHA5/fuNJpDCtcNHbv4VqYYqPLjgfUViPQgrjozA2CptRSGF8/59w+Wrt+rr1btNna1cPzg0wwuXavncxabnX7PfHYYXzlYARvlobQZyUR9mXm+1NMEK7SSLONgcVV9vb8IQXv4J3KSeKKlxXxNCzONkeYp8AV3p9UT1+P3FWHVAsq5thhGZSEb1DrSZq7dS5HUdoLiuBZ6jORG3tCwAkNJfCUJ2Jrqe1P0ESCkMNTdSACYNDDU7UoAkDQw1P1MAJvUMVJmrwhJ6hShM1gMIvQxUnahCFjaHKEzWQQneoxR95ogZTWBuqPFEDKnSHKk/UoArdoYoTNbDC5lBDEzW4QjMpYiZqgIXG/S76JhwHK5zVVipcnkIVuv/RW/HyFKhwYhuFr6NiCmdNoDBUSGFjovJQEYXuRN9ahwoorJ8uSZenPsMTNk+X2q6jwgm/ntHL11HhhL4zenmoYEL/Gb04VCxh6KKTNFQoYfiikzBUJKF00Sk8VCChfF00OFQcYdt10dBQYYRT5xn0n9G7Q0X8GfCzNNEyZ6iPgD/HlydaVg11DfhajJaJlm2HugIUrlomWrYZKuJKHz6vHhbSM/hROdRnxNe1meuXYvW0DB6+aflYrB7dlzDiCM3N1dVN6GDhMCDhjlHYjEIK46MwNgqbUUhhfJ/vA07wO8N1vw94ONo/3e/lTpVOYfc/UyG//ZmqW52fi/FuTNW3/lZ+eguF+qOQQv1RSKH+KKRQfxRSqD8KKdQfhRTqj0IK9UchhfqjkEL9UUih/iikUH8UUqg/CmXh6Hsv3jlK+wnvD/vgkrSHMMuyu1P9ZdmuwnycDQYn+svG3n9KEUKT9zHyf6+IEWJHIX4U4kchfhTiRyF+FOJHIX4U4kchfnVhijeZa6sunCf4ZdPamteEHY5C/CjEr/vCv0ec0g+AtS1QAAAAAElFTkSuQmCC",this.pageContext.drawImage(e.element,this.getScaledValue(i+s,1),this.getScaledValue(n+o,2),this.getScaledValue(e.width),this.getScaledValue(e.height))}this.pageContext.fillStyle=W.getColor(l);var m=this.getRevisionType(a,!1);if(t.isNullOrUndefined(m)||"Deletion"!==m.type&&"MoveFrom"!==m.type||this.renderStrikeThrough(e,i,n,"SingleStrike",l,"Normal",m),m=this.getRevisionType(a,!0),!t.isNullOrUndefined(m)&&("Insertion"===m.type||"MoveTo"===m.type)){var f=this.getUnderlineYPosition(e.line);this.renderUnderline(e,i,n,f,l,"Single","Normal")}h&&this.pageContext.restore()},e.prototype.renderTableOutline=function(e){var t=new j(this.documentHelper),i=e;e.width=this.documentHelper.layout.getTableWidth(i);var n=i.isBidiTable?t.getTableRightBorder(i.tableFormat.borders):t.getTableLeftBorder(i.tableFormat.borders),r=0;r=W.convertPointToPixel(n.getLineWidth()),this.renderSingleBorder(n.color,e.x-e.margin.left-r/2,e.y,e.x-e.margin.left-r/2,e.y+e.height,r),n=t.getTableTopBorder(i.tableFormat.borders),r=0,r=W.convertPointToPixel(n.getLineWidth()),this.renderSingleBorder(n.color,e.x-e.margin.left-r,e.y-r/2,e.x+e.width+r+e.margin.right,e.y-r/2,r),n=i.isBidiTable?t.getTableLeftBorder(i.tableFormat.borders):t.getTableRightBorder(i.tableFormat.borders),r=0,r=W.convertPointToPixel(n.getLineWidth()),this.renderSingleBorder(n.color,e.x+e.width+e.margin.right+r/2,e.y,e.x+e.width+e.margin.right+r/2,e.y+e.height,r),n=t.getTableBottomBorder(i.tableFormat.borders),r=0,r=W.convertPointToPixel(n.getLineWidth()),this.renderSingleBorder(n.color,e.x-e.margin.left-r,e.y+e.height-r/2,e.x+e.width+r+e.margin.right,e.y+e.height-r/2,r)},e.prototype.renderTableCellOutline=function(e,i){var n=e.layout,r=i,o=0,s=0,a=0,l=0,d=0,h=i.ownerTable.isBidiTable;r.cellFormat.borders,i.containerWidget instanceof ye&&(s=i.margin.bottom-i.containerWidget.bottomBorderWidth,o=i.margin.top-i.containerWidget.topBorderWidth),a=i.margin.left-i.leftBorderWidth,l=i.margin.right-i.rightBorderWidth,d=t.isNullOrUndefined(r.ownerRow)||"Exactly"!==r.ownerRow.rowFormat.heightType?!t.isNullOrUndefined(r.ownerRow)&&[r.ownerRow].length<=1?Math.max(W.convertPointToPixel(r.ownerRow.rowFormat.height),i.height)+o+s:i.height+o+s:W.convertPointToPixel(r.ownerRow.rowFormat.height)+o+s;var c=h?be.getCellRightBorder(r):be.getCellLeftBorder(r),p=0;p=W.convertPointToPixel(c.getLineWidth()),this.renderCellBackground(d,i,a,p);var u=p;if(0===r.index||1===r.cellFormat.rowSpan||r.cellFormat.rowSpan>1&&0===r.columnIndex)this.renderSingleBorder(c.color,i.x-a-p,i.y-o,i.x-a-p,i.y+i.height+s,p);else for(var g=0;g<r.ownerTable.childWidgets.length;g++){for(var m=r.ownerTable.childWidgets[g],f=void 0,v=0;v<m.childWidgets.length;v++){var y=m.childWidgets[v];if(y.columnIndex+y.cellFormat.columnSpan-1==r.columnIndex-1){f=y;break}if(m.childWidgets[v].columnIndex>=r.columnIndex&&m.childWidgets[v].previousWidget){f=m.childWidgets[v].previousWidget;break}}if(f&&f.columnIndex+f.cellFormat.columnSpan-1==r.columnIndex-1){var b=h?be.getCellLeftBorder(f):be.getCellRightBorder(f),w=b.lineWidth;if(f.y+f.height<r.y)continue;if(f.y<r.y&&f.y+f.height>r.y)this.renderSingleBorder(b.color,r.x-a-w,r.y-o,r.x-a-w,f.y+f.height+f.margin.bottom,w);else if(f.y===r.y||f.y>r.y&&f.y+f.height<r.y+r.height)this.renderSingleBorder(b.color,r.x-a-w,f.y-f.margin.top,r.x-a-w,f.y+f.height+f.margin.bottom,w);else if(f.y<r.y+r.height&&f.y+f.height>=r.y+r.height)this.renderSingleBorder(b.color,r.x-a-w,f.y-f.margin.top,r.x-a-w,f.y+r.height+s,w);else if(f.y>r.y+r.height)break}}if(r.updatedTopBorders&&r.updatedTopBorders.length>1)for(var C=i.x-i.margin.left-u/2,x=i.y-i.margin.top,F=0;F<r.updatedTopBorders.length;F++){var P=r.updatedTopBorders[F];"None"!==(c=P.border).lineStyle&&c.lineWidth<be.getCellTopBorder(r).lineWidth&&(c.lineWidth=be.getCellTopBorder(r).lineWidth),t.isNullOrUndefined(c)||(p=W.convertPointToPixel(c.getLineWidth()),this.renderSingleBorder(c.color,C,x+p/2,C+P.width,x+p/2,p),C+=P.width)}else{c=be.getCellTopBorder(r),p=W.convertPointToPixel(c.getLineWidth());this.renderSingleBorder(c.color,i.x-i.margin.left-u/2,i.y-i.margin.top+p/2,i.x+i.width+i.margin.right+0,i.y-i.margin.top+p/2,p)}var T=!1;T=h?0===r.cellIndex:r.cellIndex===r.ownerRow.childWidgets.length-1,(r.ownerTable.tableFormat.cellSpacing>0||T)&&r.columnIndex+r.cellFormat.columnSpan===r.ownerTable.tableHolder.columns.length&&(c=h?be.getCellLeftBorder(r):be.getCellRightBorder(r),p=W.convertPointToPixel(c.getLineWidth()),this.renderSingleBorder(c.color,i.x+i.width+i.margin.right-p/2,i.y-o,i.x+i.width+i.margin.right-p/2,i.y+i.height+s,p));var S=r.ownerRow.nextWidget,I=!1,N=void 0;if(!t.isNullOrUndefined(S)){if(S.lastChild){var E=S.lastChild;N=E.columnIndex+E.cellFormat.columnSpan}var H=void 0;(H=S)instanceof ye&&i.containerWidget instanceof ye&&i.containerWidget.containerWidget instanceof ve&&(I=-1!==i.containerWidget.containerWidget.childWidgets.indexOf(H))}(r.ownerTable.tableFormat.cellSpacing>0||r.ownerRow.rowIndex===r.ownerTable.childWidgets.length-1||r.cellFormat.rowSpan>1&&r.ownerRow.rowIndex+r.cellFormat.rowSpan>=r.ownerTable.childWidgets.length||!I||N&&S.childWidgets.length<r.ownerRow.childWidgets.length&&N<r.columnIndex+r.cellFormat.columnSpan)&&(c=r.cellFormat.rowSpan>1&&r.ownerRow.rowIndex+r.cellFormat.rowSpan===r.ownerTable.childWidgets.length?r.getBorderBasedOnPriority(r.getBorderBasedOnPriority(r.cellFormat.borders.bottom,r.ownerRow.rowFormat.borders.bottom),r.ownerTable.tableFormat.borders.bottom):be.getCellBottomBorder(r),"Cleared"!==r.cellFormat.borders.top.lineStyle||"None"!==r.cellFormat.borders.bottom.lineStyle||t.isNullOrUndefined(r.nextWidget)||(c=r.cellFormat.borders.bottom),p=W.convertPointToPixel(c.getLineWidth()),this.renderSingleBorder(c.color,i.x-i.margin.left-u/2,i.y+i.height+s+p/2,i.x+i.width+i.margin.right,i.y+i.height+s+p/2,p)),c=n.getCellDiagonalUpBorder(r),(p=W.convertPointToPixel(c.getLineWidth()))>0&&this.renderSingleBorder(c.color,i.x-a,i.y+i.height+s,i.x+i.width+l,i.y-o,p),c=n.getCellDiagonalDownBorder(r),(p=W.convertPointToPixel(c.getLineWidth()))>0&&this.renderSingleBorder(c.color,i.x-a,i.y-o,i.x+i.width+l,i.y+i.height+s,p)},e.prototype.renderCellBackground=function(e,t,i,n){var r=t.cellFormat,o="#ffffff"===r.shading.backgroundColor?t.ownerTable.tableFormat.shading.backgroundColor:r.shading.backgroundColor,s=t.x-i-n,a=t.topMargin?W.convertPointToPixel(t.topMargin):0,l=t.y-a,d=t.width+i+t.margin.right-n;t.ownerRow.rowFormat.revisions.length>0&&(o="Insertion"===t.ownerRow.rowFormat.revisions[t.ownerRow.rowFormat.revisions.length-1].revisionType?"#e1f2fa":"#fce6f4"),this.pageContext.beginPath(),"empty"!==o&&(this.pageContext.fillStyle=W.getColor(o),this.pageContext.fillRect(this.getScaledValue(s,1),this.getScaledValue(l,2),this.getScaledValue(d),this.getScaledValue(e)),this.pageContext.closePath()),r.shading.hasValue("foregroundColor")&&"TextureNone"!==r.shading.textureStyle&&(this.pageContext.beginPath(),"empty"!==r.shading.foregroundColor&&(this.pageContext.fillStyle=W.getColor(r.shading.foregroundColor),this.pageContext.fillRect(this.getScaledValue(s,1),this.getScaledValue(l,2),this.getScaledValue(d),this.getScaledValue(e)),this.pageContext.closePath()))},e.prototype.renderSingleBorder=function(e,t,i,n,r,o){this.pageContext.beginPath(),this.pageContext.moveTo(this.getScaledValue(t,1),this.getScaledValue(i,2)),this.pageContext.lineTo(this.getScaledValue(n,1),this.getScaledValue(r,2)),this.pageContext.lineWidth=this.getScaledValue(o),this.pageContext.strokeStyle=W.getColor(e),o>0&&this.pageContext.stroke(),this.pageContext.closePath()},e.prototype.getScaledValue=function(e,i){return this.isPrinting?e:(t.isNullOrUndefined(i)&&(i=0),e*this.documentHelper.zoomFactor+(1===i?this.pageLeft:2===i?this.pageTop:0))},e.prototype.checkRevisionType=function(e){for(var t=[],i=e.revisions.length,n=0;n<i;n++){var r=e.revisions[n],o=this.documentHelper.authors.get(r.author);t.push({type:r.revisionType,color:o})}return t},e.prototype.getRevisionColor=function(e){if(1===e.length)return e[0].color;for(var t=0;t<e.length;t++)if("Deletion"===e[t].type||"MoveFrom"===e[t].type)return e[t].color},e.prototype.getRevisionType=function(e,t){if(0!==e.length)for(var i=0;i<e.length;i++){var n=void 0;if(t&&("Insertion"===e[i].type||"MoveTo"===e[i].type))return n=e[i],this.pageContext.fillStyle=W.getColor(n.color),e.splice(i,1),n;if(!t&&("Deletion"===e[i].type||"MoveFrom"===e[i].type))return n=e[i],this.pageContext.fillStyle=W.getColor(n.color),e.splice(i,1),n}},e.prototype.destroy=function(){this.documentHelper=void 0,t.isNullOrUndefined(this.pageCanvasIn)||(this.pageCanvasIn.innerHTML=""),this.pageCanvasIn=void 0},e}(),G=function(){function e(e){this.paragraphMarkInfo={},this.documentHelper=e,t.isNullOrUndefined(e)||(this.context=e.containerContext)}return Object.defineProperty(e.prototype,"paragraphMark",{get:function(){return"¶"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineBreakMark",{get:function(){return"↲"},enumerable:!0,configurable:!0}),e.prototype.getEnSpaceCharacter=function(){return String.fromCharCode(8194)},e.prototype.repeatChar=function(e,t){for(var i="",n=0;n<t;n++)i+=e;return i},e.prototype.getParagraphMarkWidth=function(e){return this.getParagraphMarkSize(e).Width},e.prototype.getParagraphMarkSize=function(e){var t=this.getFormatText(e);if(this.paragraphMarkInfo[t])return this.paragraphMarkInfo[t];var i=this.getWidth(this.paragraphMark,e),n=this.getHeight(e),r={Width:i,Height:n.Height,BaselineOffset:n.BaselineOffset};return this.paragraphMarkInfo[t]=r},e.prototype.getTextSize=function(e,t){var i=0,n=t.bidi||this.isRTLText(e.text),r=this.setText(e.text,n,t.bdo);i=this.getWidth(r,t),e.width=i;var o=this.getHeight(t);return e.height=o.Height,e.baselineOffset=o.BaselineOffset," "===e.text[e.text.length-1]&&(i=this.getWidth(W.trimEnd(e.text),t)),e.trimEndWidth=i,i},e.prototype.getHeight=function(e){var i=this.getFormatText(e);if(!t.isNullOrUndefined(this.documentHelper.heightInfoCollection[i]))return this.documentHelper.heightInfoCollection[i];var n=this.getHeightInternal(e);return this.documentHelper.heightInfoCollection[i]=n,n},e.prototype.getFormatText=function(e){var t=e.fontFamily.toLocaleLowerCase();return t+=";"+e.fontSize,e.bold&&(t+=";bold"),e.italic&&(t+=";italic"),t},e.prototype.getHeightInternal=function(e){var t=0,i=0,n=document.createElement("span");n.innerText="m",this.applyStyle(n,e);var r=document.createElement("div");r.setAttribute("style","display:inline-block;position:absolute;");var o=document.createElement("div");o.setAttribute("style","display:inline-block;width: 1px; height: 0px;vertical-align: baseline;"),r.appendChild(n),r.appendChild(o),document.body.appendChild(r),t=n.offsetHeight;var s=n.offsetTop;return i=o.offsetTop-s,document.body.removeChild(r),{Height:t,BaselineOffset:i}},e.prototype.measureTextExcludingSpaceAtEnd=function(e,t){return this.getWidth(W.trimEnd(e),t)},e.prototype.getWidth=function(e,t){e.match("\v")&&e.replace("\v",this.lineBreakMark);var i="",n="",r="",o=t.fontSize;return i=t.bold?"bold":"",n=t.italic?"italic":"",r=t.fontFamily,o=0===o?.5:o/("Normal"===t.baselineAlignment?1:1.5),this.context.font=i+" "+n+" "+o+"pt "+r,t.allCaps&&(e=e.toUpperCase()),this.context.measureText(e).width},e.prototype.setText=function(e,i,n,r){if(t.isNullOrUndefined(r)&&(r=!1),0===e.length)return"";var o=i;if(!o&&"RTL"===n||o&&"LTR"===n)e=W.reverseString(e);else if(r&&o&&W.endsWith(e)){var s=e.length-W.trimEnd(e).length;e=W.addSpace(s)+W.trimEnd(e)}return e},e.prototype.applyStyle=function(e,i){if(!t.isNullOrUndefined(e)&&!t.isNullOrUndefined(i)){var n="white-space:nowrap;";""!==i.fontFamily&&(n+="font-family:"+i.fontFamily+";");var r=i.fontSize;r<=.5&&(r=.5),n+="font-size:"+r.toString()+"pt;",i.bold&&(n+="font-weight:bold;"),i.italic&&(n+="font-style:italic;"),e.setAttribute("style",n)}},e.prototype.measureText=function(e,t){var i=this.getWidth(e,t),n=this.getHeight(t);return{Width:i,Height:n.Height,BaselineOffset:n.BaselineOffset}},e.prototype.updateTextSize=function(e,t){var i=new H(void 0),n=e.listLevel.characterFormat,r=t.characterFormat;i.fontSize=11===n.fontSize?r.fontSize:n.fontSize,i.fontFamily="Verdana"===n.fontFamily?r.fontFamily:n.fontFamily;var o="",s="",a="Normal"===n.baselineAlignment?r.baselineAlignment:n.baselineAlignment;o=n.hasValue("bold")?n.bold?"bold":"":r.bold?"bold":"",s=n.hasValue("italic")?n.italic?"italic":"":r.italic?"italic":"",i.baselineAlignment=a,o&&(i.bold=!0),s&&(i.italic=!0);var l=i.bidi||this.isRTLText(e.text),d=this.setText(e.text,l,i.bdo);e.width=this.getWidth(d,i);var h=this.getHeight(i);e.height=h.Height,e.baselineOffset=h.BaselineOffset},e.prototype.containsSpecialCharAlone=function(e){for(var t="*|.:[]{}-`;()@&$#%!~? '",i=0;i<e.length;i++)if(-1===t.indexOf(e.charAt(i)))return!1;return!0},e.prototype.containsNumberAlone=function(e){if(""===e)return!1;for(var t=0;t<e.length;t++)if(-1==="0123456789".indexOf(e.charAt(t)))return!1;return!0},e.prototype.inverseCharacter=function(e){switch(e){case"(":return")";case")":return"(";case"<":return">";case">":return"<";case"{":return"}";case"}":return"{";case"[":return"]";case"]":return"[";default:return e}},e.prototype.containsSpecialChar=function(e){for(var t="*|.:[]{}-`;()@&$#%!~? ",i=0;i<e.length;i++)if(-1!==t.indexOf(e.charAt(i)))return!0;return!1},e.prototype.isRTLText=function(e){var i=!1;if(!t.isNullOrUndefined(e))for(var n=0;n<e.length;n++){var r=e[n];if(r>="֐"&&r<="׿"||r>="؀"&&r<="ۿ"||r>="ݐ"&&r<="ݿ"||r>="ࢠ"&&r<="ࣿ"||r>="ﭐ"&&r<="﷿"||r>="ﹰ"&&r<="\ufeff"||r>="ꦀ"&&r<="꧟"||r>="܀"&&r<="ݏ"||r>="ހ"&&r<="޿"||r>="ࡀ"&&r<="࡟"||r>="߀"&&r<="߿"||r>="ࠀ"&&r<="࠿"||r>="ⴰ"&&r<="⵿"){i=!0;break}}return i},e.prototype.getRtlLanguage=function(e){return t.isNullOrUndefined(e)||""===e?{isRtl:!1,id:0}:e>="֐"&&e<="׿"?{isRtl:!0,id:1}:e>="؀"&&e<="ۿ"||e>="ݐ"&&e<="ݿ"||e>="ࢠ"&&e<="ࣿ"||e>="ﭐ"&&e<="﷿"||e>="ﹰ"&&e<="\ufeff"?{isRtl:!0,id:2}:e>="ꦀ"&&e<="꧟"?{isRtl:!0,id:3}:e>="܀"&&e<="ݏ"?{isRtl:!0,id:4}:e>="ހ"&&e<="޿"?{isRtl:!0,id:5}:e>="ࡀ"&&e<="࡟"?{isRtl:!0,id:6}:e>="߀"&&e<="߿"?{isRtl:!0,id:7}:e>="ࠀ"&&e<="࠿"?{isRtl:!0,id:8}:e>="ⴰ"&&e<="⵿"?{isRtl:!0,id:9}:{isRtl:!1,id:0}},e.prototype.destroy=function(){this.documentHelper=void 0,this.context=void 0,this.paragraphMarkInfo={},this.paragraphMarkInfo=void 0},e}(),K=function(){function e(e){var i=this;this.onMouseWheelInternal=function(e){if(!0===e.ctrlKey&&(e.preventDefault(),e.pageX-i.documentHelper.viewerContainer.offsetLeft<i.documentHelper.pageContainer.offsetWidth)){var n=navigator.userAgent.match("Firefox")?e.detail<0:t.Browser.isIE?e.wheelDelta>0:e.deltaY<0,r=i.documentHelper.zoomFactor;n?r<=4.9?r+=.1:r=5:r>=.2?r-=.1:r=.1,i.documentHelper.zoomFactor=r}},this.documentHelper=e}return e.prototype.setZoomFactor=function(){this.onZoomFactorChanged(),t.isNullOrUndefined(this.documentHelper.selection)||this.documentHelper.selection.updateCaretPosition(),this.documentHelper.updateTouchMarkPosition(),t.isNullOrUndefined(this.documentHelper.owner.imageResizerModule)||this.documentHelper.owner.imageResizerModule.updateImageResizerPosition(),this.documentHelper.owner.fireZoomFactorChange()},Object.defineProperty(e.prototype,"viewer",{get:function(){return this.documentHelper.owner.viewer},enumerable:!0,configurable:!0}),e.prototype.onZoomFactorChanged=function(){this.documentHelper.zoomFactor>5?this.documentHelper.zoomFactor=5:this.documentHelper.zoomFactor<.1&&(this.documentHelper.zoomFactor=.1),this.zoom()},e.prototype.zoom=function(){var e=this.viewer;this.documentHelper.clearContent(),e.handleZoom(),this.documentHelper.updateFocus()},e}(),X=function(){function e(e){var i=this;this.show=function(){var e=new t.L10n("documenteditor",i.documentHelper.owner.defaultLocale);e.setLocale(i.documentHelper.owner.locale),i.target||i.initUserDialog(e,i.documentHelper.owner.enableRtl),i.documentHelper.dialog.header=e.getConstant("Add Users"),i.documentHelper.dialog.height="auto",i.documentHelper.dialog.width="auto",i.documentHelper.dialog.content=i.target,i.documentHelper.dialog.beforeOpen=i.loadUserDetails,i.documentHelper.dialog.close=i.documentHelper.updateFocus,i.documentHelper.dialog.buttons=[{click:i.okButtonClick,buttonModel:{content:e.getConstant("Ok"),cssClass:"e-flat",isPrimary:!0}},{click:i.hideDialog,buttonModel:{content:e.getConstant("Cancel"),cssClass:"e-flat"}},{click:i.deleteButtonClick,buttonModel:{content:e.getConstant("Delete"),cssClass:"e-flat e-user-delete"}}],i.documentHelper.dialog.dataBind(),i.documentHelper.dialog.show()},this.loadUserDetails=function(){i.documentHelper.restrictEditingPane.addedUser.dataSource=i.documentHelper.userCollection.slice(),i.documentHelper.restrictEditingPane.addedUser.dataBind()},this.okButtonClick=function(){i.documentHelper.restrictEditingPane.isAddUser=!0,i.documentHelper.restrictEditingPane.showStopProtectionPane(!1),i.documentHelper.restrictEditingPane.loadPaneValue(),i.documentHelper.restrictEditingPane.isAddUser=!1,i.documentHelper.dialog.hide()},this.hideDialog=function(){i.textBoxInput.value="",i.documentHelper.dialog.hide()},this.onKeyUpOnDisplayBox=function(){i.addButton.disabled=""===i.textBoxInput.value},this.addButtonClick=function(){i.validateUserName(i.textBoxInput.value)?(-1===i.documentHelper.userCollection.indexOf(i.textBoxInput.value)&&i.documentHelper.userCollection.push(i.textBoxInput.value),i.userList.dataSource=i.documentHelper.userCollection.slice(),i.userList.dataBind(),i.textBoxInput.value=""):n.DialogUtility.alert("Invalid user name")},this.deleteButtonClick=function(){var e=i.documentHelper.userCollection.indexOf(i.userList.getSelectedItems().text);e>-1&&(i.documentHelper.userCollection.splice(e,1),i.userList.dataSource=i.documentHelper.userCollection.slice(),i.userList.dataBind())},this.documentHelper=e}return e.prototype.initUserDialog=function(e,i){var n=this.documentHelper.owner.containerId+"_addUser";this.target=t.createElement("div",{id:n,className:"e-de-user-dlg"});var s=e.getConstant("Enter User"),a=t.createElement("div",{innerHTML:s,className:"e-bookmark-dlgfields"});this.target.appendChild(a);var l=t.createElement("div",{className:"e-de-user-dlg-common"});this.target.appendChild(l);var d=t.createElement("div",{className:"e-de-user-dlg-list",styles:"display:inline-flex"});l.appendChild(d),i&&d.classList.add("e-de-rtl");var h=t.createElement("div",{className:"e-de-user-dlg-textboxdiv"});d.appendChild(h),this.textBoxInput=t.createElement("input",{className:"e-input e-de-user-dlg-textbox-input",id:"bookmark_text_box",attrs:{autofocus:"true"}}),this.textBoxInput.setAttribute("type","text"),h.appendChild(this.textBoxInput),this.textBoxInput.addEventListener("keyup",this.onKeyUpOnDisplayBox);var c=t.createElement("button",{innerHTML:e.getConstant("Add"),id:"add",attrs:{type:"button"}});d.appendChild(c),c.addEventListener("click",this.addButtonClick),this.addButton=new r.Button({cssClass:"e-de-user-add-btn"}),this.addButton.disabled=!0,this.addButton.appendTo(c),this.addButton.addEventListener("click",this.addButtonClick);var p=t.createElement("div");l.appendChild(p);var u=t.createElement("div",{innerHTML:e.getConstant("Users"),className:"e-de-user-dlg-user"});p.appendChild(u);var g=t.createElement("div",{id:"user_listView"});p.appendChild(g),this.userList=new o.ListView({cssClass:"e-de-user-listview"}),this.userList.appendTo(g)},e.prototype.validateUserName=function(e){if(-1===e.indexOf("@"))return!1;var t=e.split("@")[1];if(-1===t.indexOf("."))return!1;var i=t.split("."),n=i[1];return!(i.length>2)&&!(n.length>4||n.length<2)},e}(),Y=function(){function e(e,i){var r=this;this.show=function(){r.localeValue=new t.L10n("documenteditor",r.viewer.owner.defaultLocale),r.localeValue.setLocale(r.viewer.owner.locale),r.target||r.initDialog(r.localeValue),r.documentHelper.dialog.header=r.localeValue.getConstant("Start Enforcing Protection"),r.documentHelper.dialog.height="auto",r.documentHelper.dialog.content=r.target,r.documentHelper.dialog.width="auto",r.documentHelper.dialog.buttons=[{click:r.okButtonClick,buttonModel:{content:r.localeValue.getConstant("Ok"),cssClass:"e-flat",isPrimary:!0}},{click:r.hideDialog,buttonModel:{content:r.localeValue.getConstant("Cancel"),cssClass:"e-flat"}}],r.passwordTextBox.value="",r.confirmPasswordTextBox.value="",r.documentHelper.dialog.show()},this.hideDialog=function(){r.passwordTextBox.value="",r.confirmPasswordTextBox.value="",r.documentHelper.dialog.hide()},this.okButtonClick=function(){r.passwordTextBox.value!==r.confirmPasswordTextBox.value?n.DialogUtility.alert(r.localeValue.getConstant("Password Mismatch")):(r.password=r.passwordTextBox.value,r.viewer.owner.editor.addProtection(r.password,r.owner.protectionType))},this.documentHelper=e,this.owner=i}return Object.defineProperty(e.prototype,"viewer",{get:function(){return this.owner.viewer},enumerable:!0,configurable:!0}),e.prototype.initDialog=function(e){var i=this.viewer.owner.containerId+"_enforce_protection";this.target=t.createElement("div",{id:i,className:"e-de-enforce"});var n=t.createElement("div"),r=t.createElement("div",{className:"e-de-enforce-dlg-title",innerHTML:e.getConstant("Enter new password")});this.passwordTextBox=t.createElement("input",{attrs:{type:"password",autofocus:"true"},id:this.viewer.owner.containerId+"_display_text",className:"e-input e-de-enforce-dlg-input"}),n.appendChild(r),n.appendChild(this.passwordTextBox);var o=t.createElement("div",{className:"e-de-enforce-dlg-title",innerHTML:e.getConstant("Reenter new password to confirm")});this.confirmPasswordTextBox=t.createElement("input",{attrs:{type:"password"},id:this.viewer.owner.containerId+"_url_text",className:"e-input e-de-enforce-dlg-input"}),n.appendChild(o),n.appendChild(this.confirmPasswordTextBox),this.target.appendChild(n)},e}(),J=function(){function e(e,i){var n=this;this.show=function(){n.localObj=new t.L10n("documenteditor",n.viewer.owner.defaultLocale),n.localObj.setLocale(n.viewer.owner.locale),n.target||n.initDialog(n.localObj),n.documentHelper.dialog.header="Unprotect Document",n.documentHelper.dialog.height="auto",n.documentHelper.dialog.width="auto",n.documentHelper.dialog.content=n.target,n.documentHelper.dialog.buttons=[{click:n.okButtonClick,buttonModel:{content:n.localObj.getConstant("Ok"),cssClass:"e-flat",isPrimary:!0}},{click:n.hideDialog,buttonModel:{content:n.localObj.getConstant("Cancel"),cssClass:"e-flat"}}],n.documentHelper.dialog.dataBind(),n.passwordTextBox.value="",n.documentHelper.dialog.show()},this.okButtonClick=function(){var e=n.passwordTextBox.value;""!==e&&n.viewer.owner.editor.stopProtection(e)},this.hideDialog=function(){n.passwordTextBox.value="",n.documentHelper.dialog.hide()},this.documentHelper=e,this.owner=i}return Object.defineProperty(e.prototype,"viewer",{get:function(){return this.owner.viewer},enumerable:!0,configurable:!0}),e.prototype.initDialog=function(e){var i=this.viewer.owner.containerId+"_enforce_protection";this.target=t.createElement("div",{id:i,className:"e-de-enforce"});var n=t.createElement("div"),r=t.createElement("div",{className:"e-de-unprotect-dlg-title",innerHTML:e.getConstant("Password")});this.passwordTextBox=t.createElement("input",{attrs:{type:"password"},id:this.viewer.owner.containerId+"_display_text",className:"e-input e-de-enforce-dlg-input"}),n.appendChild(r),n.appendChild(this.passwordTextBox),this.target.appendChild(n)},e}(),Z=function(){function e(e){var t=this;this.addRemove=!0,this.protectionType="ReadOnly",this.restrictFormatting=!1,this.isShowRestrictPane=!1,this.isAddUser=!1,this.usersCollection=["Everyone"],this.closePane=function(){t.restrictPane.style.display="none",t.documentHelper.updateViewerSize()},this.showAllRegion=function(){t.documentHelper.selection.showAllEditingRegion()},this.documentHelper=e,this.addUserDialog=new X(e),this.enforceProtectionDialog=new Y(e,this),this.unProtectDialog=new J(e,this),this.base64=new k}return Object.defineProperty(e.prototype,"viewer",{get:function(){return this.documentHelper.owner.viewer},enumerable:!0,configurable:!0}),e.prototype.showHideRestrictPane=function(e){e?(this.localObj=new t.L10n("documenteditor",this.viewer.owner.defaultLocale),this.localObj.setLocale(this.viewer.owner.locale),this.restrictPane||this.initPane(this.localObj),this.restrictPane.style.display="block",this.isShowRestrictPane=!0,this.documentHelper.selection.isHighlightEditRegion=!0,this.wireEvents(),this.documentHelper.updateViewerSize(),this.loadPaneValue()):(this.closePane(),this.documentHelper.updateFocus())},e.prototype.initPane=function(e){this.restrictPane=t.createElement("div",{className:"e-de-restrict-pane",styles:"display:none"});var i=t.createElement("div",{className:"e-de-rp-whole-header"}),n=t.createElement("div",{styles:"width:75%",innerHTML:e.getConstant("Restrict Editing"),className:"e-de-rp-header"});this.closeButton=t.createElement("button",{className:"e-de-rp-close-icon e-de-close-icon e-btn e-flat e-icon-btn",id:"close",attrs:{type:"button"}}),i.appendChild(this.closeButton),i.appendChild(n);var r=t.createElement("span",{className:"e-de-op-close-icon e-de-close-icon e-btn-icon e-icons"});this.closeButton.appendChild(r),this.restrictPane.appendChild(i),this.initRestrictEditingPane(e),this.documentHelper.optionsPaneContainer.setAttribute("style","display:inline-flex;"),this.documentHelper.optionsPaneContainer.insertBefore(this.restrictPane,this.documentHelper.viewerContainer)},e.prototype.initRestrictEditingPane=function(e){this.restrictPaneWholeDiv=t.createElement("div");var i=t.createElement("div",{className:"e-de-rp-sub-div"}),n=t.createElement("div",{innerHTML:e.getConstant("Formatting restrictions"),className:"e-de-rp-format"});i.appendChild(n);var a=t.createElement("input",{attrs:{type:"checkbox"},id:this.viewer.owner.containerId+"_allowFormat"});i.appendChild(a),this.allowFormat=this.createCheckBox(e.getConstant("Allow formatting"),a),this.restrictPaneWholeDiv.appendChild(i);var l=t.createElement("div",{className:"e-de-rp-sub-div"}),d=t.createElement("div",{innerHTML:e.getConstant("Editing restrictions"),className:"e-de-rp-format"});l.appendChild(d);t.createElement("input",{attrs:{type:"checkbox"},id:this.viewer.owner.containerId+"_readOnly"});var h=t.createElement("input",{id:this.viewer.owner.containerId+"_readOnly",className:"e-prop-font-style"});l.appendChild(h);var c=["Read only","Filling in forms"];this.protectionTypeDrop=new s.DropDownList({dataSource:c,cssClass:"e-de-prop-dropdown"}),this.protectionTypeDrop.value="Read only",this.protectionTypeDrop.appendTo(h),this.restrictPaneWholeDiv.appendChild(l),this.userWholeDiv=t.createElement("div",{className:"e-de-rp-sub-div"});var p=t.createElement("div",{innerHTML:e.getConstant("Exceptions Optional"),className:"e-de-rp-format"});this.userWholeDiv.appendChild(p);var u=t.createElement("div",{innerHTML:e.getConstant("Select Part Of Document And User"),styles:"margin-bottom:8px;"});this.userWholeDiv.appendChild(u);var g=t.createElement("div",{className:"e-de-rp-user"});this.userWholeDiv.appendChild(g),this.addedUser=new o.ListView({cssClass:"e-de-user-listView",dataSource:[{text:"Everyone"}],showCheckBox:!0,select:this.selectHandler.bind(this)}),this.addedUser.appendTo(g),this.addUser=t.createElement("button",{id:this.viewer.owner.containerId+"_addUser",className:"e-btn e-primary e-flat",innerHTML:e.getConstant("More users")+"...",styles:"margin-top: 3px",attrs:{type:"button"}}),this.userWholeDiv.appendChild(this.addUser),this.restrictPaneWholeDiv.appendChild(this.userWholeDiv);var m=t.createElement("div",{className:"e-de-rp-enforce"});this.restrictPaneWholeDiv.appendChild(m),this.enforceProtection=t.createElement("button",{id:this.viewer.owner.containerId+"_addUser",innerHTML:e.getConstant("Enforcing Protection"),className:"e-btn e-de-rp-btn-enforce",attrs:{type:"button"}}),m.appendChild(this.enforceProtection),this.restrictPane.appendChild(this.restrictPaneWholeDiv),this.stopProtectionDiv=t.createElement("div",{styles:"display:none"});var f=t.createElement("div",{innerHTML:e.getConstant("Your permissions"),className:"e-de-rp-stop-div1"});this.stopProtectionDiv.appendChild(f);var v=e.getConstant("Protected Document");this.contentDiv1=t.createElement("div",{innerHTML:v,className:"e-de-rp-stop-div2"}),this.stopProtectionDiv.appendChild(this.contentDiv1);var y=t.createElement("div",{innerHTML:e.getConstant("You may format text only with certain styles"),className:"e-de-rp-stop-div3"});this.stopProtectionDiv.appendChild(y),this.stopReadOnlyOptions=t.createElement("div"),this.stopProtectionDiv.appendChild(this.stopReadOnlyOptions);var b=t.createElement("div",{className:"e-de-rp-enforce-nav"}),w=t.createElement("button",{innerHTML:e.getConstant("Find Next Region I Can Edit"),className:"e-btn e-de-rp-nav-btn",attrs:{type:"button"}});b.appendChild(w),w.addEventListener("click",this.navigateNextRegion.bind(this)),this.stopReadOnlyOptions.appendChild(b);var C=t.createElement("div",{className:"e-de-rp-enforce-nav"}),x=t.createElement("button",{innerHTML:e.getConstant("Show All Regions I Can Edit"),className:"e-btn e-de-rp-nav-btn",attrs:{type:"button"}});C.appendChild(x),x.addEventListener("click",this.showAllRegion),this.stopReadOnlyOptions.appendChild(C);var F=t.createElement("div",{className:"e-de-rp-enforce-nav e-de-rp-nav-lbl"}),P=t.createElement("input",{attrs:{type:"checkbox"},className:"e-btn e-de-rp-nav-btn"});F.appendChild(P),this.stopReadOnlyOptions.appendChild(F),this.highlightCheckBox=new r.CheckBox({label:e.getConstant("Highlight the regions I can edit")},P);var T=t.createElement("div",{className:"e-de-rp-enforce"});this.stopProtection=t.createElement("button",{innerHTML:e.getConstant("Stop Protection"),className:"e-btn e-de-rp-btn-stop-enforce",attrs:{type:"button"}}),T.appendChild(this.stopProtection),this.stopProtectionDiv.appendChild(T),this.restrictPane.appendChild(this.stopProtectionDiv)},e.prototype.showStopProtectionPane=function(e){e?(this.stopProtectionDiv.style.display="block",this.restrictPaneWholeDiv.style.display="none"):(this.stopProtectionDiv.style.display="none",this.restrictPaneWholeDiv.style.display="block"),"ReadOnly"===this.documentHelper.protectionType?this.stopReadOnlyOptions.style.display="block":this.stopReadOnlyOptions.style.display="none"},e.prototype.wireEvents=function(){this.addUser.addEventListener("click",this.addUserDialog.show),this.enforceProtection.addEventListener("click",this.protectDocument.bind(this)),this.stopProtection.addEventListener("click",this.stopProtectionTriggered.bind(this)),this.closeButton.addEventListener("click",this.closePane),this.allowFormat.addEventListener("change",this.enableFormatting.bind(this)),this.protectionTypeDrop.addEventListener("change",this.protectionTypeDropChanges.bind(this)),this.highlightCheckBox.addEventListener("change",this.highlightClicked.bind(this))},e.prototype.enableFormatting=function(e){this.restrictFormatting=!e.checked},e.prototype.stopProtectionTriggered=function(e){if((t.isNullOrUndefined(this.documentHelper.saltValue)||""===this.documentHelper.saltValue)&&(t.isNullOrUndefined(this.documentHelper.hashValue)||""===this.documentHelper.hashValue))return void this.documentHelper.owner.editor.unProtectDocument();this.unProtectDialog.show()},e.prototype.protectionTypeDropChanges=function(e){"Read only"===e.value?(this.protectionType="ReadOnly",this.userWholeDiv.style.display="block",this.enforceProtection.style.marginLeft="0px"):"Filling in forms"===e.value?(this.protectionType="FormFieldsOnly",this.userWholeDiv.style.display="none",this.enforceProtection.style.marginLeft="8px"):(this.protectionType="NoProtection",this.addedUser.uncheckAllItems(),this.viewer.owner.editor.removeAllEditRestrictions()),"Filling in forms"===e.value?this.contentDiv1.innerHTML=this.localObj.getConstant("FormFieldsOnly"):this.contentDiv1.innerHTML=this.localObj.getConstant("Protected Document")},e.prototype.selectHandler=function(e){e.isChecked?(this.viewer.owner.editor.insertEditRangeElement(e.text),e.event.target.classList.add("e-check")):this.viewer.owner.editor.removeUserRestrictions(e.text)},e.prototype.highlightClicked=function(e){this.documentHelper.selection.isHighlightEditRegion=e.checked},e.prototype.protectDocument=function(){this.enforceProtectionDialog.show()},e.prototype.createCheckBox=function(e,t){var i=new r.CheckBox({label:e});return i.appendTo(t),i},e.prototype.loadPaneValue=function(){this.allowFormat.checked=!this.documentHelper.restrictFormatting,"ReadOnly"===this.documentHelper.protectionType?this.protectionTypeDrop.value="Read only":"FormFieldsOnly"===this.documentHelper.protectionType&&(this.protectionTypeDrop.value="Filling in forms"),this.highlightCheckBox.checked=!0,this.addedUser.enablePersistence=!0,this.addedUser.dataSource=this.usersCollection.slice(),this.addedUser.dataBind(),this.showStopProtectionPane(this.documentHelper.isDocumentProtected)},e.prototype.navigateNextRegion=function(){this.documentHelper.selection.navigateToNextEditingRegion()},e.prototype.addUserCollection=function(){if(this.documentHelper.selection&&this.documentHelper.selection.editRangeCollection.length>0)for(var e=0;e<this.documentHelper.selection.editRangeCollection.length;e++){var t=this.documentHelper.selection.editRangeCollection[e];""!==t.user&&-1===this.usersCollection.indexOf(t.user)&&this.usersCollection.push(t.user),""!==t.group&&-1===this.usersCollection.indexOf(t.group)&&this.usersCollection.push(t.group)}this.addedUser.dataSource=this.documentHelper.userCollection.slice(),this.addedUser.dataBind()},e.prototype.updateUserInformation=function(){if(this.addedUser.uncheckAllItems(),this.documentHelper.selection.checkSelectionIsAtEditRegion){var e=this.documentHelper.selection.getEditRangeStartElement();if(e){var t=this.addedUser.dataSource.indexOf(e.user);if(t>-1&&(i=this.addedUser.element.querySelectorAll("li")[t]).querySelector(".e-icons").classList.add("e-check"),(t=this.addedUser.dataSource.indexOf(e.group))>-1){var i=this.addedUser.element.querySelectorAll("li")[t];i.querySelector(".e-icons").classList.add("e-check")}}}},e}(),Q=function(){function e(e){var i=this;this.applyTextFormFieldValue=function(){i.owner.editor.updateFormField(i.formField,i.textBoxInstance.value),i.owner.trigger("afterFormFieldFill",{fieldName:i.formField.formFieldData.name,value:i.formField.resultText,isCanceled:!1}),i.hidePopup()},this.applyNumberFormFieldValue=function(){i.owner.editor.updateFormField(i.formField,i.numberInput.value.toString()),i.owner.trigger("afterFormFieldFill",{fieldName:i.formField.formFieldData.name,value:i.formField.resultText,isCanceled:!1}),i.hidePopup()},this.applyDateFormFieldValue=function(){t.isNullOrUndefined(i.datePickerInstance.value)||(i.owner.editor.updateFormField(i.formField,i.dateInput.value),i.owner.trigger("afterFormFieldFill",{fieldName:i.formField.formFieldData.name,value:i.formField.resultText,isCanceled:!1}),i.hidePopup())},this.applyDropDownFormFieldValue=function(){i.owner.editor.updateFormField(i.formField,i.ddlInstance.index),i.owner.trigger("afterFormFieldFill",{fieldName:i.formField.formFieldData.name,value:i.formField.formFieldData.selectedIndex,isCanceled:!1}),i.hidePopup()},this.enableDisableDatePickerOkButton=function(e){e.isInteracted&&(i.dataPickerOkButton.disabled=!1)},this.closeButton=function(){var e=i.formField;i.hidePopup();var t={fieldName:e.formFieldData.name};e.formFieldData instanceof Pe?t.value=e.resultText:e.formFieldData instanceof Te?t.value=e.formFieldData.checked:t.value=e.formFieldData.selectedIndex,t.isCanceled=!0,i.owner.trigger("afterFormFieldFill",t)},this.hidePopup=function(){i.owner.documentHelper.isFormFilling=!1,i.formField=void 0,i.target&&(i.target.style.display="none"),i.popupObject&&(i.popupObject.hide(),i.popupObject.destroy(),i.popupObject=void 0)},this.owner=e}return e.prototype.initPopup=function(){var e=t.createElement("div",{className:"e-de-form-popup"});this.textBoxContainer=this.initTextBoxInput(),e.appendChild(this.textBoxContainer),e.appendChild(this.initNumericTextBox()),e.appendChild(this.initDatePicker()),e.appendChild(this.initDropDownList()),this.target=e,this.owner.documentHelper.viewerContainer.appendChild(e)},e.prototype.initTextBoxInput=function(){var e=t.createElement("div",{className:"e-de-txt-field"}),i=t.createElement("input",{className:"e-de-txt-form"}),n=new a.TextBox;this.textBoxInput=i;var o=t.createElement("div",{className:"e-de-cmt-action-button"}),s=t.createElement("button"),l=t.createElement("button");return s.addEventListener("click",this.applyTextFormFieldValue),l.addEventListener("click",this.closeButton),e.appendChild(i),o.appendChild(s),o.appendChild(l),e.appendChild(o),n.appendTo(i),new r.Button({cssClass:"e-de-save",iconCss:"e-de-save-icon"},s),new r.Button({cssClass:"e-de-cancel",iconCss:"e-de-cancel-icon"},l),this.textBoxInstance=n,e},e.prototype.initNumericTextBox=function(){var e=t.createElement("div",{className:"e-de-num-field"}),i=t.createElement("input",{className:"e-de-txt-form"}),n=new a.NumericTextBox;this.numberInput=i;var o=t.createElement("div",{className:"e-de-cmt-action-button"}),s=t.createElement("button"),l=t.createElement("button");return s.addEventListener("click",this.applyNumberFormFieldValue),l.addEventListener("click",this.closeButton),e.appendChild(i),o.appendChild(s),o.appendChild(l),e.appendChild(o),n.appendTo(i),new r.Button({cssClass:"e-de-save",iconCss:"e-de-save-icon"},s),new r.Button({cssClass:"e-de-cancel",iconCss:"e-de-cancel-icon"},l),this.numericTextBoxInstance=n,e},e.prototype.initDatePicker=function(){var e=t.createElement("div",{className:"e-de-date-field"}),i=t.createElement("input",{className:"e-de-txt-form"}),n=new l.DateTimePicker({allowEdit:!1,strictMode:!0,change:this.enableDisableDatePickerOkButton});this.dateInput=i;var o=t.createElement("div",{className:"e-de-cmt-action-button"}),s=t.createElement("button"),a=t.createElement("button");return s.addEventListener("click",this.applyDateFormFieldValue),a.addEventListener("click",this.closeButton),e.appendChild(i),o.appendChild(s),o.appendChild(a),e.appendChild(o),n.appendTo(i),this.dataPickerOkButton=new r.Button({cssClass:"e-de-save",iconCss:"e-de-save-icon"},s),new r.Button({cssClass:"e-de-cancel",iconCss:"e-de-cancel-icon"},a),this.datePickerInstance=n,e},e.prototype.initDropDownList=function(){var e=t.createElement("div",{className:"e-de-ddl-field"}),i=t.createElement("input",{className:"e-de-txt-form"}),n=new s.DropDownList;this.dropDownInput=i;var o=t.createElement("div",{className:"e-de-cmt-action-button"}),a=t.createElement("button"),l=t.createElement("button");return a.addEventListener("click",this.applyDropDownFormFieldValue),l.addEventListener("click",this.closeButton),e.appendChild(i),o.appendChild(a),o.appendChild(l),e.appendChild(o),n.appendTo(i),new r.Button({cssClass:"e-de-save",iconCss:"e-de-save-icon"},a),new r.Button({cssClass:"e-de-cancel",iconCss:"e-de-cancel-icon"},l),this.ddlInstance=n,e},e.prototype.showPopUp=function(e){var i=this;if(e){this.formField=e,this.owner.selection.selectField(),t.isNullOrUndefined(this.target)&&this.initPopup(),t.classList(this.target,[],["e-de-txt-form","e-de-num-form","e-de-date-form","e-de-ddl-form"]);var r=e.formFieldData;if(r){if(r instanceof Pe){var o=e.resultText,s=new RegExp(this.owner.documentHelper.textHelper.getEnSpaceCharacter(),"gi");""===o.replace(s,"")&&(o="");var a,l=r.maxLength,d=r.type;if(o=o||"","Text"===d)t.classList(this.target,["e-de-txt-form"],[]),a=this.textBoxInput,this.textBoxInstance.value=o;else if("Number"===r.type)t.classList(this.target,["e-de-num-form"],[]),a=this.numberInput,this.numericTextBoxInstance.format=r.format,this.numericTextBoxInstance.value=parseFloat(o.replace(/,/gi,""));else if("Date"===d){t.classList(this.target,["e-de-date-form"],[]),a=this.dateInput;var h=r.format;-1!==h.indexOf("am/pm")&&(h=h.replace(/am\/pm/gi,"a")),this.datePickerInstance.format=h,this.datePickerInstance.value=new Date(o),this.dataPickerOkButton.disabled=!0}a&&(l>0?a.maxLength=l:a.removeAttribute("maxlength"),setTimeout(function(){a.focus()}))}else r instanceof Se&&(t.classList(this.target,["e-de-ddl-form"],[]),this.ddlInstance.dataSource=r.dropdownItems,this.ddlInstance.index=r.selectedIndex,setTimeout(function(){i.ddlInstance.showPopup()}));var c=this.owner.selection.getLeftInternal(e.line,e,0),p=e.line.height*this.owner.documentHelper.zoomFactor,u=this.owner.selection.getTooltipPosition(e.line,c,this.target,!0);this.popupObject||(this.popupObject=new n.Popup(this.target,{height:"auto",width:"auto",relateTo:this.owner.documentHelper.viewerContainer.parentElement,position:{X:u.x,Y:u.y+p}})),this.target.style.display="block",this.popupObject.show()}this.owner.documentHelper.isFormFilling=!0}},e}(),$=function(){function e(e,i){this.users=[],this.enableButtons=!0,this.viewTypeitems=[],this.sortedRevisions=[],this.noChangesVisibleInternal=!0,this.isTrackingPageBreak=!1,this.owner=e,this.commentReviewPane=i,this.locale=new t.L10n("documenteditor",this.owner.defaultLocale),this.locale.setLocale(this.owner.locale),this.selectedUser=this.locale.getConstant("All"),this.selectedType=this.locale.getConstant("All"),this.initTrackChangePane(),this.commentReviewPane.reviewTab.items[1].content=this.trackChangeDiv}return Object.defineProperty(e.prototype,"setNoChangesVisibility",{get:function(){return this.noChangesVisibleInternal},set:function(e){this.noChangeDivElement.style.display=e?"block":"none",this.noChangesVisibleInternal=e,this.enableDisableToolbarItem(!e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentSelectedRevision",{get:function(){return this.currentSelectedRevisionInternal},set:function(e){var i=t.select(".e-de-trckchanges-inner-select",this.changesInfoDiv);t.isNullOrUndefined(e)?t.isNullOrUndefined(i)||i.classList.remove("e-de-trckchanges-inner-select"):(e!==this.currentSelectedRevisionInternal||t.isNullOrUndefined(i))&&(i&&i.classList.remove("e-de-trckchanges-inner-select"),this.changes.length>0&&this.changes.containsKey(e)&&this.changes.get(e).singleInnerDiv.classList.add("e-de-trckchanges-inner-select")),this.currentSelectedRevisionInternal=e,i=t.select(".e-de-trckchanges-inner-select",this.changesInfoDiv),t.isNullOrUndefined(i)||i.parentElement.scrollIntoView({block:"nearest"})},enumerable:!0,configurable:!0}),e.prototype.initTrackChangePane=function(){this.changes=new g,this.trackChangeDiv=t.createElement("div",{className:"e-de-tc-pane"}),this.trackChangeDiv.appendChild(this.initPaneHeader()),this.changesInfoDiv=t.createElement("div",{id:"e-de-tc-pane-revision",styles:"overflow:auto"}),this.trackChangeDiv.appendChild(this.changesInfoDiv),this.noChangeDivElement=t.createElement("div",{styles:"display:none;",className:"e-de-tc-no-chng"}),this.noChangeDivElement.textContent=this.locale.getConstant("No changes"),this.changesInfoDiv.appendChild(this.noChangeDivElement),this.updateTrackChanges()},e.prototype.initPaneHeader=function(){var e=this;this.toolbarElement=t.createElement("div",{className:"e-de-track-toolbar"}),this.toolbar=new i.Toolbar({enableRtl:this.owner.enableRtl,items:[{template:this.locale.getConstant("User")+":",cssClass:"e-de-track-toolbar-overlay",disabled:!0},{template:t.createElement("div",{id:"e-de-user-list"})},{type:"Separator"},{template:this.locale.getConstant("View")+":",cssClass:"e-de-track-toolbar-overlay",disabled:!0},{template:t.createElement("div",{id:"e-de-revision-list"})},{prefixIcon:"e-de-nav-left-arrow e-de-tc-tbr",align:"Right",cssClass:"e-de-nvgte-left",tooltipText:this.locale.getConstant("Previous Changes"),click:this.navigatePreviousChanges.bind(this)},{prefixIcon:"e-de-nav-right-arrow e-de-tc-tbr",align:"Right",cssClass:"e-de-nvgte-right",tooltipText:this.locale.getConstant("Next Changes"),click:this.navigateNextChanges.bind(this)},{template:t.createElement("div",{id:"e-de-menu-option"}),align:"Right",cssClass:"e-de-tc-tbr",tooltipText:this.locale.getConstant("More Options")+"..."}]}),this.toolbar.appendTo(this.toolbarElement),t.select(".e-de-nvgte-left",this.toolbarElement).firstChild.classList.add("e-tc-nvgte"),t.select(".e-de-nvgte-right",this.toolbarElement).firstChild.classList.add("e-tc-nvgte");var n=t.select("#e-de-user-list",this.toolbarElement);this.userDropDownitems=[{text:this.locale.getConstant("All")}],this.userDropDown={items:this.userDropDownitems,cssClass:"e-de-track-pane-drop-btn e-tc-btn-bg-clr",select:this.onUserSelect.bind(this),beforeOpen:this.onUserOpen.bind(this),beforeItemRender:function(t){e.beforeDropDownItemRender(t,e.selectedUser)}},this.userDropDownButton=new d.DropDownButton(this.userDropDown),this.userDropDownButton.appendTo(n),this.userDropDownButton.content=this.getSpanView(this.userDropDown.items[0].text,0);var r=t.select("#e-de-revision-list",this.toolbarElement);this.viewTypeitems=[{text:this.locale.getConstant("All")},{text:this.locale.getConstant("Inserted")},{text:this.locale.getConstant("Deleted")}],this.viewTypeDropDownButton=new d.DropDownButton({items:this.viewTypeitems,cssClass:"e-de-track-pane-drop-btn e-tc-btn-bg-clr",select:this.onTypeSelect.bind(this),beforeItemRender:function(t){e.beforeDropDownItemRender(t,e.selectedType)}}),this.viewTypeDropDownButton.content=this.getSpanView(this.viewTypeitems[0].text,1),this.viewTypeDropDownButton.appendTo(r),this.menuoptionEle=t.select("#e-de-menu-option",this.toolbarElement);var o={items:[{text:this.locale.getConstant("Accept all")},{text:this.locale.getConstant("Reject all")}],select:this.onMenuSelect.bind(this),iconCss:"e-de-menu-icon",cssClass:"e-caret-hide e-tc-btn-bg-clr"};return this.menuDropDownButton=new d.DropDownButton(o),this.menuDropDownButton.appendTo(this.menuoptionEle),this.toolbarElement},e.prototype.beforeDropDownItemRender=function(e,t){e.element.innerHTML="<span></span>"+e.item.text;var i=e.element.children[0];e.item.text===t?(i.style.marginRight="10px",i.style.alignSelf="center",i.setAttribute("class","e-de-selected-item e-icons")):(e.element.children[0].style.marginRight="25px",e.element.children[0].classList.remove("e-de-selected-item"))},e.prototype.onUserOpen=function(e){var t=e.element;t.style.maxHeight="200px",t.style.overflowY="auto"},e.prototype.enableDisableToolbarItem=function(e){var t=this.toolbar.element.querySelectorAll(".e-de-tc-tbr");this.owner&&this.owner.viewer&&(this.toolbar.enableItems(t[0].parentElement.parentElement,e),this.toolbar.enableItems(t[1].parentElement.parentElement,e),this.toolbar.enableItems(t[2],e))},e.prototype.getSpanView=function(e,t){return(0===t?'<span class="e-de-track-span-user">':'<span class="e-de-track-span-view">')+e+"</span>"},e.prototype.onMenuSelect=function(e){var t=this,i=e.item.text;i.match(this.locale.getConstant("Accept all"))?setTimeout(function(){t.owner.revisionsInternal.handleRevisionCollection(!0,t.sortedRevisions)},0):i.match(this.locale.getConstant("Reject all"))&&setTimeout(function(){t.owner.revisionsInternal.handleRevisionCollection(!1,t.sortedRevisions)},0),this.updateUsers()},e.prototype.onSelection=function(e){this.currentSelectedRevision=e},e.prototype.onUserSelect=function(e){var t=e.item.text;this.selectedUser=t,this.userDropDownButton.content=this.getSpanView(t,0),this.sortCollectionToDisplay()},e.prototype.onTypeSelect=function(e){var t=e.item.text;this.selectedType=t,this.viewTypeDropDownButton.content=this.getSpanView(t,1),this.sortCollectionToDisplay()},e.prototype.updateMenuOptions=function(){var e;this.selectedType!==this.locale.getConstant("All")&&(e=this.selectedType===this.locale.getConstant("Inserted")?this.locale.getConstant("Insertion"):this.locale.getConstant("Deletion")),this.selectedUser===this.locale.getConstant("All")&&this.selectedType===this.locale.getConstant("All")?(this.menuDropDownButton.items[0].text=this.locale.getConstant("Accept all")+" "+this.locale.getConstant("Changes"),this.menuDropDownButton.items[1].text=this.locale.getConstant("Reject all")+" "+this.locale.getConstant("Changes")):this.selectedUser===this.locale.getConstant("All")&&this.selectedType!==this.locale.getConstant("All")?(this.menuDropDownButton.items[0].text=this.locale.getConstant("Accept all")+" "+e,this.menuDropDownButton.items[1].text=this.locale.getConstant("Reject all")+" "+e):this.selectedUser!==this.locale.getConstant("All")&&this.selectedType===this.locale.getConstant("All")?(this.menuDropDownButton.items[0].text=this.locale.getConstant("Accept all")+" "+this.locale.getConstant("Changes")+" "+this.locale.getConstant("By").toLowerCase()+" "+this.selectedUser,this.menuDropDownButton.items[1].text=this.locale.getConstant("Reject all")+" "+this.locale.getConstant("Changes")+" "+this.locale.getConstant("By").toLowerCase()+" "+this.selectedUser):(this.menuDropDownButton.items[0].text=this.locale.getConstant("Accept all")+" "+e+" "+this.locale.getConstant("By").toLowerCase()+" "+this.selectedUser,this.menuDropDownButton.items[1].text=this.locale.getConstant("Reject all")+" "+e+" "+this.locale.getConstant("By").toLowerCase()+" "+this.selectedUser)},e.prototype.sortCollectionToDisplay=function(){var e=!1;this.sortedRevisions=[],this.updateMenuOptions();for(var t=0;t<this.changes.length;t++){var i=this.changes.get(this.revisions[t]),n=i.outerSingleDiv;this.selectedUser===this.locale.getConstant("All")&&this.selectedType===this.locale.getConstant("All")?(n.style.display="block",e=!0):this.selectedUser===this.locale.getConstant("All")&&this.selectedType!==this.locale.getConstant("All")?i.revisionType===this.selectedType?(n.style.display="block",e=!0):n.style.display="none":this.selectedUser!==this.locale.getConstant("All")&&this.selectedType===this.locale.getConstant("All")?i.user===this.selectedUser?(n.style.display="block",e=!0):n.style.display="none":i.user===this.selectedUser&&i.revisionType===this.selectedType?(n.style.display="block",e=!0):n.style.display="none","block"===n.style.display&&this.sortedRevisions.push(this.revisions[t])}this.setNoChangesVisibility=!e},e.prototype.enableDisableButton=function(e){this.enableButtons=e,this.updateTrackChanges()},e.prototype.updateTrackChanges=function(e){if(e||t.isNullOrUndefined(e)){this.removeAllChanges(),this.enableButtons||this.menuoptionEle.classList.contains("e-de-overlay")?this.menuoptionEle.classList.contains("e-de-overlay")&&this.menuoptionEle.classList.remove("e-de-overlay"):this.menuoptionEle.classList.add("e-de-overlay");for(var i=0;i<this.owner.revisions.changes.length;i++){var n=this.owner.revisions.changes[i];this.addChanges(n)}this.sortCollectionToDisplay(),this.updateUsers(),e&&(this.currentSelectedRevision=this.currentSelectedRevisionInternal,this.updateHeight(),this.owner.resize())}else this.currentSelectedRevision=void 0},e.prototype.updateUsers=function(){this.users.length>0&&(this.userDropDownButton.removeItems(this.users),this.users=[]);for(var e=0;e<this.revisions.length;e++)-1===this.users.indexOf(this.revisions[e].author)&&(this.users.push(this.revisions[e].author),this.userDropDownButton.items.push({text:this.revisions[e].author}))},e.prototype.updateHeight=function(){var e=this.commentReviewPane.reviewTab.getRootElement().getElementsByClassName("e-tab-header")[0].getBoundingClientRect().height;this.changesInfoDiv.style.height=this.commentReviewPane.parentPaneElement.clientHeight-this.toolbarElement.clientHeight-e-2+"px"},e.prototype.removeAllChanges=function(){for(;this.changesInfoDiv.childNodes.length>1;)this.changesInfoDiv.removeChild(this.changesInfoDiv.lastChild);this.revisions=[],this.changes.clear()},e.prototype.clear=function(){this.removeAllChanges(),this.selectedUser=this.locale.getConstant("All"),this.userDropDownButton.content=this.getSpanView(this.selectedUser,0),this.selectedType=this.locale.getConstant("All"),this.viewTypeDropDownButton.content=this.getSpanView(this.selectedType,1),this.currentSelectedRevision=void 0},e.prototype.destroy=function(){this.removeAllChanges(),this.toolbar&&this.toolbar.destroy(),this.userDropDownButton&&this.userDropDownButton.destroy(),this.menuDropDownButton&&(this.menuDropDownButton.destroy(),this.menuDropDownButton=void 0),this.viewTypeDropDownButton&&this.viewTypeDropDownButton.destroy(),this.menuDropDownButton&&(this.menuDropDownButton.destroy(),this.menuDropDownButton=void 0),this.userDropDown&&(this.userDropDown=void 0),this.users.length>0&&(this.users=[]),this.trackChangeDiv&&(this.trackChangeDiv=void 0)},e.prototype.addChanges=function(e){var t=new ee(this.owner,this);this.changesInfoDiv.appendChild(t.createSingleChangesDiv(e)),this.enableButtons?t.acceptButtonElement.classList.contains("e-de-overlay")&&(t.acceptButtonElement.classList.remove("e-de-overlay"),t.rejectButtonElement.classList.remove("e-de-overlay")):t.acceptButtonElement.classList.contains("e-de-overlay")||(t.acceptButtonElement.classList.add("e-de-overlay"),t.rejectButtonElement.classList.add("e-de-overlay")),this.revisions.push(e),this.changes.add(e,t)},e.prototype.navigatePreviousChanges=function(){this.owner.selection.navigatePreviousRevision()},e.prototype.navigateNextChanges=function(){this.owner.selection.navigateNextRevision()},e}(),ee=function(){function e(e,i){this.owner=e,this.locale=new t.L10n("documenteditor",this.owner.defaultLocale),this.locale.setLocale(this.owner.locale),this.trackChangesPane=i}return e.prototype.createSingleChangesDiv=function(e){this.revision=e,this.user=e.author,this.outerSingleDiv=t.createElement("div",{className:"e-de-tc-outer"}),this.singleInnerDiv=t.createElement("div",{className:"e-de-trckchanges-inner"}),this.singleInnerDiv.addEventListener("click",this.selectRevision.bind(this)),this.outerSingleDiv.appendChild(this.singleInnerDiv);var i=t.createElement("div",{className:"e-de-track-usernme-div"}),n=t.createElement("div",{innerHTML:e.author,className:"e-de-track-user-nme"});t.isNullOrUndefined(e.author)||(i.style.display="flex",this.owner.documentHelper.getAvatar(i,n,void 0,e));var o=t.createElement("div");"Insertion"===e.revisionType?(this.revisionType="Inserted",o.innerHTML=this.locale.getConstant("Inserted").toUpperCase(),o.classList.add("e-de-track-insert")):"Deletion"===e.revisionType?(this.revisionType="Deleted",o.innerHTML=this.locale.getConstant("Deleted").toUpperCase(),o.classList.add("e-de-track-delete")):"MoveFrom"===e.revisionType?(this.revisionType="MoveFrom",o.innerHTML=this.locale.getConstant("Move From").toUpperCase(),o.classList.add("e-de-track-delete"),o.style.whiteSpace="nowrap"):"MoveTo"===e.revisionType&&(this.revisionType="MoveTo",o.innerHTML=this.locale.getConstant("Move To").toUpperCase(),o.classList.add("e-de-track-insert"),o.style.whiteSpace="nowrap"),i.appendChild(o),this.singleInnerDiv.appendChild(i);var s=t.createElement("div",{className:"e-de-track-date",innerHTML:W.getModifiedDate(e.date)});this.singleInnerDiv.appendChild(s);var a=t.createElement("div",{className:"e-de-track-chngs-text"});this.layoutElementText(e.range,a),this.singleInnerDiv.appendChild(a);var l=t.createElement("div",{styles:"display:inline-block;width:100%"});this.singleInnerDiv.appendChild(l);var d=t.createElement("div",{styles:"float:left;"});this.acceptButtonElement=t.createElement("button",{className:"e-de-track-accept-button"});var h=new r.Button({cssClass:"e-outline",content:this.locale.getConstant("Accept")});d.appendChild(this.acceptButtonElement),l.appendChild(d),h.appendTo(this.acceptButtonElement),this.acceptButtonElement.addEventListener("click",this.acceptButtonClick.bind(this)),d=t.createElement("div",{styles:"float:left;"}),this.rejectButtonElement=t.createElement("button",{className:"e-de-track-reject-button"});var c=new r.Button({cssClass:"e-outline",content:this.locale.getConstant("Reject")});d.appendChild(this.rejectButtonElement),l.appendChild(d),c.appendTo(this.rejectButtonElement),this.rejectButtonElement.addEventListener("click",this.rejectButtonClick.bind(this));var p=t.createElement("div",{className:"e-de-track-chngs-count",styles:"float:right;"}),u=this.owner.revisions.changes.indexOf(e)+1,g=this.owner.revisions.changes.length;return p.innerHTML=this.locale.getConstant("Changes")+" "+u.toString()+" "+this.locale.getConstant("of")+" "+g.toString(),l.appendChild(p),this.outerSingleDiv},e.prototype.selectRevision=function(){this.owner.selection.selectRevision(this.revision),this.trackChangesPane.onSelection(this.revision)},e.prototype.layoutElementText=function(e,i){i.style.width="100%";for(var n="",r=!1,o=0;o<e.length;o++){var s=e[o];if(s instanceof xe&&1===s.fieldType)r=!1;else if(!r)if(s instanceof xe&&0===s.fieldType&&(r=!0),s instanceof Ie)n+=s.text;else if(s instanceof xe&&0===s.fieldType){var a=this.owner.selection.getFieldCode(s);if(a.match("TOC ")||a.match("Toc"))return n+="<Table of Content>",void i.appendChild(this.addSpan(n));if(a.match("HYPERLINK ")||a.match("MERGEFIELD")||a.match("FORMTEXT")||a.match("PAGE "))n+=this.owner.editor.retrieveFieldResultantText(s.fieldEnd);else if(s.formFieldData){var l=this.owner.documentHelper.textHelper.repeatChar(this.owner.documentHelper.textHelper.getEnSpaceCharacter(),5);""!==n&&(i.appendChild(this.addSpan(n)),n=""),s.formFieldData instanceof Pe?i.appendChild(this.addSpan(""===s.formFieldData.defaultValue?l:s.formFieldData.defaultValue,"e-de-tc-field")):s.formFieldData instanceof Se?i.appendChild(this.addSpan(s.formFieldData.dropdownItems.length>0?s.formFieldData.dropdownItems[0]:l,"e-de-tc-field")):i.appendChild(this.addSpan(s.formFieldData.checked?String.fromCharCode(9745):String.fromCharCode(9744),"e-de-tc-field"))}}else if(s instanceof Ge){""!==n&&(i.appendChild(this.addSpan(n)),n="");var d=t.createElement("img");d.setAttribute("src",s.imageString),d.classList.add("e-de-tc-shrink-img"),i.appendChild(d)}else{if(s instanceof I){var h=t.createElement("table");h.classList.add("e-de-track-chng-table"),h.insertRow();for(var c=0;c<s.ownerBase.childWidgets.length;c++)h.rows[0].insertCell(),h.rows[0].cells[c].classList.add("e-de-tc-tble-cell");return void i.appendChild(h)}if(s instanceof H){""!==n&&(i.appendChild(this.addSpan(n)),n="");var p="¶";s.ownerBase instanceof fe&&s.ownerBase.isEndsWithPageBreak&&(p="............Page Break............"+p),i.appendChild(this.addSpan(p,"e-de-tc-pmark")),i.appendChild(t.createElement("br"))}}}i.appendChild(this.addSpan(n))},e.prototype.addSpan=function(e,i){var n=t.createElement("span");return n.textContent=e,i&&n.classList.add(i),n},e.prototype.acceptButtonClick=function(){this.trackChangesPane.changesInfoDiv.removeChild(this.outerSingleDiv),this.removeFromParentCollec(),this.revision.accept()},e.prototype.rejectButtonClick=function(){this.trackChangesPane.changesInfoDiv.removeChild(this.outerSingleDiv),this.removeFromParentCollec(),this.revision.reject()},e.prototype.removeFromParentCollec=function(){this.trackChangesPane.changes.remove(this.revision),this.trackChangesPane.revisions.splice(this.trackChangesPane.revisions.indexOf(this.revision),1),0===this.trackChangesPane.changes.length&&(this.trackChangesPane.setNoChangesVisibility=!0),this.trackChangesPane.updateUsers()},e}(),te=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ie=function(){function e(e){var i=this;this.scrollbarWidth=0,this.isWebPrinting=!1,this.isHeaderFooter=!1,this.currentPage=void 0,this.selectionStartPageIn=void 0,this.selectionEndPageIn=void 0,this.fieldStacks=[],this.showRevision=!1,this.splittedCellWidgets=[],this.tableLefts=[],this.tapCount=0,this.timer=-1,this.isTimerStarted=!1,this.isFirstLineFitInShiftWidgets=!1,this.preZoomFactor=0,this.preDifference=-1,this.fieldEndParagraph=void 0,this.fieldToLayout=void 0,this.backgroundColor="#FFFFFF",this.isMouseDown=!1,this.isMouseEntered=!1,this.scrollMoveTimer=0,this.isSelectionChangedOnMouseMoved=!1,this.isControlPressed=!1,this.isTouchInput=!1,this.isTouchMoved=!1,this.useTouchSelectionMark=!1,this.touchDownOnSelectionMark=0,this.isComposingIME=!1,this.lastComposedText="",this.isCompositionStart=!1,this.isCompositionUpdated=!1,this.isCompositionCanceled=!1,this.isCompositionEnd=!1,this.prefix="",this.suffix="",this.fields=[],this.heightInfoCollection={},this.defaultTabWidth=36,this.dontUseHtmlParagraphAutoSpacing=!1,this.alignTablesRowByRow=!1,this.lists=[],this.comments=[],this.authors=new g,this.revisionsInternal=new g,this.commentUserOptionId=1,this.abstractLists=[],this.styles=new M,this.preDefinedStyles=void 0,this.isRowOrCellResizing=!1,this.formFields=[],this.isMouseDownInFooterRegion=!1,this.pageFitTypeIn="None",this.fieldCollection=[],this.isPageField=!1,this.mouseDownOffset=new O(0,0),this.zoomFactorInternal=1,this.moveCaretPosition=0,this.isTextInput=!1,this.isScrollHandler=!1,this.triggerElementsOnLoading=!1,this.triggerSpellCheck=!1,this.restrictFormatting=!1,this.protectionType="NoProtection",this.isDocumentProtected=!1,this.hashValue="",this.saltValue="",this.userCollection=[],this.cachedPages=[],this.skipScrollToPosition=!1,this.isIosDevice=!1,this.isMobileDevice=!1,this.isFormFilling=!1,this.footnotes=new Ne,this.endnotes=new Ne,this.isFootnoteWidget=!1,this.onTextInput=function(e){if(!i.isComposingIME){e.preventDefault();var t=e.data;i.owner.editor.handleTextInput(t)}},this.compositionStart=function(){t.Browser.isDevice||i.owner.isReadOnlyMode||(i.isComposingIME=!0,i.positionEditableTarget(),i.owner.editorHistory&&i.owner.editor.initComplexHistory("IMEInput")),i.isCompositionStart=!0},this.compositionUpdated=function(){i.isComposingIME&&!i.owner.isReadOnlyMode&&setTimeout(function(){i.owner.editor.insertIMEText(i.getEditableDivTextContent(),!0)},0),i.isCompositionUpdated=!0},this.compositionEnd=function(e){if(i.isComposingIME&&!i.owner.isReadOnlyMode){var t=i.getEditableDivTextContent();""!==t&&i.owner.editor.insertIMEText(t,!1),i.isComposingIME=!1,i.lastComposedText="",i.iframe.setAttribute("style","pointer-events:none;position:absolute;left:"+i.owner.viewer.containerLeft+"px;top:"+i.owner.viewer.containerTop+"px;outline:none;background-color:transparent;width:0px;height:0px;overflow:hidden"),i.editableDiv.innerHTML="",i.owner.editorHistory&&(i.owner.editorHistory.updateComplexHistory(),""===t&&(i.owner.editorHistory.undo(),i.owner.editorHistory.redoStack.pop()))}e.preventDefault(),i.isCompositionUpdated=!1,i.isCompositionEnd=!0},this.onKeyPressInternal=function(e){var n=e.which||e.keyCode;i.triggerElementsOnLoading=!1;var r=!(!e.ctrlKey&&!e.metaKey)||17===n,o=e.altKey?e.altKey:18===n;if(t.Browser.isIE&&o&&r&&(r=!1),r&&"v"===e.key||r&&"a"===e.key||(r||i.isControlPressed&&t.Browser.isIE)&&"p"===e.key)return void(t.Browser.isIE&&(i.isControlPressed=!1));if(!i.owner.isReadOnlyMode||i.selection&&i.selection.isInlineFormFillMode()){var s=e.keyCode||e.charCode,a="";s?a=String.fromCharCode(s):e.key&&(a=e.key)," "===a||"\r"===a||"\b"===a||""===a||r?" "===a&&(i.triggerSpellCheck=!0,i.owner.editorModule.handleTextInput(" "),i.triggerSpellCheck=!1):i.owner.editorModule.handleTextInput(a),e.preventDefault()}},this.onTextInputInternal=function(e){i.owner.isReadOnlyMode?i.editableDiv.innerText="":i.owner.editorModule.onTextInputInternal()},this.onPaste=function(e){(!i.owner.isReadOnlyMode&&i.owner.editor.canEditContentControl||i.selection.isInlineFormFillMode())&&i.owner.editorModule.pasteInternal(e),i.editableDiv.innerText="",e.preventDefault()},this.onFocusOut=function(){if(!t.isNullOrUndefined(i.selection)){if(i.owner.contextMenuModule&&i.owner.contextMenuModule.contextMenuInstance&&"block"===i.owner.contextMenuModule.contextMenuInstance.element.style.display)return;i.selection.hideCaret()}},this.updateFocus=function(){!i.selection||i.isMobileDevice&&i.owner.isReadOnly||(t.Browser.isDevice||t.Browser.isIE||navigator.userAgent.match("Edge")||i.iframe.focus(),i.editableDiv.focus(),i.selection.showCaret())},this.scrollHandler=function(){i.scrollTimer&&clearTimeout(i.scrollTimer),i.clearContent(),i.isScrollHandler=!0,t.Browser.isDevice||i.isComposingIME||(i.iframe.style.top=i.owner.viewer.containerTop+"px",i.iframe.style.left=i.owner.viewer.containerLeft+"px"),i.owner.viewer.updateScrollBars();var e=i.owner.viewer.containerTop+i.visibleBounds.height-(i.owner.viewer.padding.top+i.owner.viewer.padding.bottom);e>i.pageContainer.offsetHeight&&(i.viewerContainer.scrollTop=i.owner.viewer.containerTop-(e-i.pageContainer.offsetHeight)),i.owner.viewer instanceof re&&!t.isNullOrUndefined(i.owner)&&i.owner.fireViewChange(),i.isScrollHandler=!1,i.scrollTimer=setTimeout(function(){i.isScrollHandler||t.isNullOrUndefined(i.owner)||!i.owner.isSpellCheck||(i.isScrollToSpellCheck=!0,i.owner.viewer.updateScrollBars())},200)},this.onWindowResize=function(){i.resizeTimer&&clearTimeout(i.resizeTimer),i.resizeTimer=setTimeout(function(){t.isNullOrUndefined(i.owner)||t.isNullOrUndefined(i.owner.element)||(i.updateViewerSize(),i.clearContent(),i.owner.viewer.updateScrollBars(),t.isNullOrUndefined(i.selection)||i.selection.updateCaretPosition(),i.updateTouchMarkPosition(),i.owner.contextMenuModule&&i.owner.contextMenuModule.contextMenuInstance&&i.owner.contextMenuModule.contextMenuInstance.close(),i.resizeTimer&&clearTimeout(i.resizeTimer))},200)},this.onContextMenu=function(e){i.owner.contextMenuModule&&(i.isMouseDown&&(i.isMouseDown=!1),i.owner.contextMenuModule.onContextMenuInternal(e))},this.onMouseDownInternal=function(e){var n=e.target;if(!(!t.isNullOrUndefined(n)&&n!==i.viewerContainer||i.isTouchInput||e.offsetX>i.visibleBounds.width-(i.visibleBounds.width-i.viewerContainer.clientWidth)||e.offsetY>i.visibleBounds.height-(i.visibleBounds.height-i.viewerContainer.clientHeight)||(i.isFootnoteWidget=!1,t.isNullOrUndefined(i.selection)))){if(i.updateCursor(e),i.formFillPopup&&i.formFillPopup.hidePopup(),i.isLeftButtonPressed(e)&&!i.owner.isReadOnlyMode&&i.owner.enableImageResizerMode&&!t.isNullOrUndefined(i.owner.imageResizerModule.selectedResizeElement)){if(i.selection.isInShape){var r=i.owner.selection.getCurrentTextFrame().containerShape;i.selection.selectShape(r)}i.owner.imageResizerModule.isImageResizing=!0}e.preventDefault(),i.isTouchInput||i.selection.hideCaret();var o=new O(e.offsetX,e.offsetY),s=i.owner.viewer.findFocusedPage(o,!0);if(i.mouseDownOffset.x=s.x,i.mouseDownOffset.y=s.y,i.isMouseDownInFooterRegion=i.selection.isCursorInsidePageRect(o,i.currentPage)&&i.selection.isCursorInFooterRegion(o,i.currentPage),i.isSelectionChangedOnMouseMoved=!1,!i.owner.isReadOnlyMode&&(i.owner.editorModule.tableResize.isInCellResizerArea(s)||i.owner.editorModule.tableResize.isInRowResizerArea(s)))return i.selection.hideCaret(),i.isMouseDown=!0,i.isSelectionChangedOnMouseMoved=!1,void(i.isLeftButtonPressed(e)&&(i.owner.editorModule.tableResize.startingPoint.x=s.x,i.owner.editorModule.tableResize.startingPoint.y=s.y,i.owner.editorModule.tableResize.handleResize(s)));if(e.ctrlKey&&(i.isControlPressed=!0),i.owner.selection.isEmpty&&(i.useTouchSelectionMark=!1),3===e.which&&!i.owner.selection.isEmpty&&i.selection.checkCursorIsInSelection(i.getLineWidget(s),s))return void e.preventDefault();i.isTouchInput=!1,i.isMouseDown=!0,i.updateFocus(),i.timer=setTimeout(function(){++i.tapCount>1&&(i.tapCount=1)},100)}},this.onMouseMoveInternal=function(e){if((t.isNullOrUndefined(e.target)||e.target===i.viewerContainer)&&(e.preventDefault(),!t.isNullOrUndefined(i.selection))){if(!i.owner.isReadOnlyMode&&i.owner.enableImageResizerMode&&i.owner.imageResizerModule.isImageResizing)return void(i.owner.imageResizerModule.isImageMoveToNextPage||i.owner.imageResizerModule.handleImageResizingOnMouse(e));var n=new O(e.offsetX,e.offsetY),r=i.owner.viewer.findFocusedPage(n,!i.owner.enableHeaderAndFooter);if(i.isMouseDown){if(!t.isNullOrUndefined(i.currentPage)){var o=r.x,s=r.y;if(!i.owner.isReadOnlyMode&&i.isRowOrCellResizing){var a=i.owner.editorModule.tableResize.currentResizingTable,l=i.selection.setPositionForBlock(a,!0),d=i.selection.setPositionForBlock(a,!1);i.owner.documentHelper.isDocumentProtected&&!i.selection.checkSelectionIsAtEditRegion(l,d)||i.owner.editorModule.tableResize.handleResizing(r)}else if(i.isTouchInput||i.isSelectionChangedOnMouseMoved||i.touchDownOnSelectionMark>0||i.updateTextPositionForSelection(r,1),i.isLeftButtonPressed(e)){e.preventDefault();var h=s,c=i.owner.selection.end,p=new O(o,h);i.owner.enableImageResizerMode&&i.owner.imageResizerModule.isImageResizerVisible&&!i.owner.imageResizerModule.isShapeResize||i.owner.selection.moveTextPosition(p,c),i.isSelectionChangedOnMouseMoved=!0}}i.selection.checkForCursorVisibility()}i.isRowOrCellResizing||i.isSelectionChangedOnMouseMoved||i.updateCursor(e),i.isRowOrCellResizing&&i.selection.hideCaret()}},this.onMouseLeaveInternal=function(e){if(e.preventDefault(),i.isMouseDown){var t=i.viewerContainer.scrollTop;e.offsetY+t>t?i.scrollMoveTimer=setInterval(function(){i.scrollForwardOnSelection()},500):i.scrollMoveTimer=setInterval(function(){i.scrollBackwardOnSelection()},500),i.isMouseEntered&&(i.isMouseEntered=!1)}},this.onMouseEnterInternal=function(){i.isMouseEntered||i.owner.viewer.updateScrollBars(),i.isMouseEntered=!0,i.scrollMoveTimer&&clearInterval(i.scrollMoveTimer)},this.onDoubleTap=function(e){if((t.isNullOrUndefined(e.target)||e.target===i.viewerContainer)&&!t.isNullOrUndefined(i.selection)){i.isTouchInput=!1;var n=new O(e.offsetX,e.offsetY),r=i.owner.viewer.findFocusedPage(n,!0);if(i.selection.checkAndEnableHeaderFooter(n,i.owner.viewer.findFocusedPage(n,!0)))return;var o=i.getLineWidget(r),s=i.selection.getHyperLinkFieldInCurrentSelection(o,r,!0);if(t.isNullOrUndefined(s)&&(s=i.selection.getCurrentFormField()),!i.isDocumentProtected&&i.owner.enableFormField){var a=i.selection.getFormFieldType(s);if(a)switch(""!==a.toString()&&i.selection.selectField(s),a){case"Text":i.owner.textFormFieldDialogModule.show();break;case"CheckBox":i.owner.checkBoxFormFieldDialogModule.show();break;case"DropDown":i.owner.dropDownFormFieldDialogModule.show()}}else{if(!(i.isDocumentProtected&&s&&s.formFieldData instanceof Pe&&"Text"===s.formFieldData.type))return void(i.tapCount=2);i.selection.selectField()}var l=i.selection.start.clone(),d=i.selection.end.clone(),h=l.currentWidget.getInline(l.offset,0).element;if(h instanceof Ee)if("Footnote"===h.footnoteType){var c=i.currentPage.footnoteWidget,p=void 0;for(p=1;p<=c.childWidgets.length;p++){var u=c.childWidgets[p].footNoteReference;if(h.text===u.text)break}l.setPositionParagraph(c.childWidgets[p].childWidgets[0],0),d.setPositionParagraph(c.childWidgets[p].childWidgets[0],0),i.selection.selectRange(l,d)}else{var g=i.pages[i.pages.length-1].endnoteWidget,p=void 0;if(!t.isNullOrUndefined(g))for(p=1;p<=g.childWidgets.length;p++){var m=g.childWidgets[p].footNoteReference;if(h.text===m.text)break}l.setPositionParagraph(g.childWidgets[p].childWidgets[0],0),d.setPositionParagraph(g.childWidgets[p].childWidgets[0],0),i.selection.selectRange(l,d)}else h instanceof Ie&&(i.selection.isinEndnote||i.selection.isinFootnote)&&i.selection.footnoteReferenceElement(l,d,h);!i.selection.isEmpty||t.isNullOrUndefined(i.currentPage)||t.isNullOrUndefined(i.owner.selection.start)||(i.owner.selection.selectCurrentWord(),i.selection.checkForCursorVisibility(),i.tapCount=2)}},this.onMouseUpInternal=function(e){if(t.isNullOrUndefined(e.target)||e.target===i.viewerContainer){e.preventDefault(),i.isListTextSelected=!1;var n=new O(e.offsetX,e.offsetY),r=i.owner.viewer.findFocusedPage(n,!0);if(!t.isNullOrUndefined(i.selection)){var o=1;t.Browser.isIE?o=i.tapCount:e.detail>2&&(o=e.detail),i.isRowOrCellResizing&&i.owner.editorModule.tableResize.updateResizingHistory(r),!i.isMouseDown||i.isSelectionChangedOnMouseMoved||t.isNullOrUndefined(i.currentPage)||t.isNullOrUndefined(i.owner.selection.start)||i.owner.enableImageResizerMode&&i.owner.imageResizerModule.isImageResizing||(0!==i.touchDownOnSelectionMark||i.isRowOrCellResizing||(i.updateTextPositionForSelection(r,o),t.Browser.isIE&&2===o&&i.selection.checkAndEnableHeaderFooter(n,r)),i.selection.checkForCursorVisibility(),t.isNullOrUndefined(i.currentSelectedComment)||!i.owner.commentReviewPane||i.owner.commentReviewPane.commentPane.isEditMode||(i.currentSelectedComment=void 0));var s=i.isIosDevice?e.metaKey:e.ctrlKey;if(t.isNullOrUndefined(i.currentPage)||t.isNullOrUndefined(i.owner.selection.start)||!i.owner.selection.isEmpty&&!i.owner.selection.isImageSelected||!(s&&i.owner.useCtrlClickToFollowHyperlink||!i.owner.useCtrlClickToFollowHyperlink)||!0!==i.isLeftButtonPressed(e)||i.selection.navigateHyperLinkOnEvent(r,!1),i.isMouseDown&&i.isLeftButtonPressed(e)&&i.isDocumentProtected&&"FormFieldsOnly"===i.protectionType&&i.selection){var a=i.getLineWidget(r),l=i.selection.getHyperLinkFieldInCurrentSelection(a,r,!0);if(t.isNullOrUndefined(l)&&(l=i.selection.getCurrentFormField(!0)),l&&l.formFieldData&&l.formFieldData.enabled&&!i.selection.isInlineFormFillMode(l)){var d={fieldName:l.formFieldData.name};l.formFieldData instanceof Pe?d.value=l.resultText:l.formFieldData instanceof Te?d.value=l.formFieldData.checked:d.value=l.formFieldData.selectedIndex,i.owner.trigger("beforeFormFieldFill",d),"Popup"===i.owner.documentEditorSettings.formFieldSettings.formFillingMode&&!(l.formFieldData instanceof Te)||l.formFieldData instanceof Pe&&"Text"!==l.formFieldData.type||l.formFieldData instanceof Se?i.formFillPopup.showPopUp(l):(i.owner.editor.toggleCheckBoxFormField(l),d.value=l.formFieldData.checked,d.isCanceled=!1,i.owner.trigger("afterFormFieldFill",d))}!l&&i.isFormFillProtectedMode&&i.selection.navigateToNextFormField()}else if(i.isMouseDown&&i.formFields.length>0)if((l=i.selection.getCurrentFormField(!0))&&l.formFieldData instanceof Pe)i.selection.selectField();else if(i.isLeftButtonPressed(e)&&l&&l.formFieldData instanceof Se){var h=l.line.getOffset(l,0),c=i.selection.getPhysicalPositionInternal(l.line,h,!1);i.selection.selectInternal(l.line,l,0,c)}if(!i.owner.isReadOnlyMode&&i.isSelectionInListText(r)&&i.selection.selectListText(),!i.owner.isReadOnlyMode&&i.owner.enableImageResizerMode&&i.owner.imageResizerModule.isImageResizing&&(i.owner.imageResizerModule.mouseUpInternal(),i.scrollToPosition(i.owner.selection.start,i.owner.selection.end),i.owner.imageResizerModule.isImageResizing=!1),i.owner.enableImageResizerMode&&i.owner.imageResizerModule.isImageResizerVisible&&!t.isNullOrUndefined(i.selection.caret)&&(i.selection.caret.style.display="none"),i.isMouseDown=!1,i.isFootnoteWidget=!1,i.isSelectionChangedOnMouseMoved=!1,i.isTouchInput=!1,i.useTouchSelectionMark=!0,i.isControlPressed=!1,i.updateFocus(),i.isListTextSelected&&i.selection.hideCaret(),i.owner.enableImageResizerMode){var p=i.owner.imageResizerModule;p.isImageResizing=!1,p.isImageMoveToNextPage=!1,p.leftValue=void 0,p.topValue=void 0}i.isMouseDownInFooterRegion=!1}}},this.onTouchStartInternal=function(e){if(i.selection){if(i.isTouchMoved=!1,i.isCompositionStart=!1,i.isCompositionEnd=!1,i.isCompositionUpdated=!1,i.isCompositionCanceled=!0,i.isTouchInput=!0,i.isTimerStarted?1===i.tapCount?i.tapCount=2:(i.tapCount=3,i.isTimerStarted=!1):(i.isTimerStarted=!0,i.tapCount=1),1===e.touches.length){i.zoomX=e.touches[0].clientX,i.zoomY=e.touches[0].clientY,i.owner.selection.isEmpty&&(i.useTouchSelectionMark=!1),i.isMouseDown=!0,i.isSelectionChangedOnMouseMoved=!1;var n=void 0;if(i.isMouseDown&&(n=i.getTouchOffsetValue(e)),n=i.owner.viewer.findFocusedPage(n,!0),i.owner.enableImageResizerMode){var r=i.owner.imageResizerModule.getImagePointOnTouch(n);i.owner.imageResizerModule.selectedResizeElement=r.selectedElement}i.owner.enableImageResizerMode&&!t.isNullOrUndefined(i.owner.imageResizerModule.selectedResizeElement)&&(i.owner.imageResizerModule.isImageResizing=!0);var o=i.owner.selection.end.location.x,s=i.selection.getCaretBottom(i.owner.selection.end,i.owner.selection.isEmpty)+9;i.touchDownOnSelectionMark=(n.y<=s&&n.y>=s-20||n.y>=s&&n.y<=s+20)&&(n.x<=o&&n.x>=o-20||n.x>=o&&n.x<=o+20)?1:0,i.owner.selection.isEmpty||0!==i.touchDownOnSelectionMark||(o=i.owner.selection.start.location.x,s=i.selection.getCaretBottom(i.owner.selection.start,!1)+9,i.touchDownOnSelectionMark=(n.y<=s&&n.y>=s-20||n.y>=s&&n.y<=s+20)&&(n.x<=o&&n.x>=o-20||n.x>=o&&n.x<=o+20)?2:0)}!t.isNullOrUndefined(i.owner.contextMenuModule)&&i.owner.contextMenuModule.contextMenuInstance&&i.owner.contextMenuModule.contextMenuInstance.close(),(i.touchDownOnSelectionMark||e.touches.length>1)&&e.preventDefault(),i.longTouchTimer=setTimeout(i.onLongTouch,500,e),i.timer=setTimeout(function(){i.isTimerStarted=!1},200)}},this.onLongTouch=function(e){if(!(t.isNullOrUndefined(i.owner)||t.isNullOrUndefined(i.viewerContainer)||i.isTouchMoved||1!==e.touches.length)){var n=i.getTouchOffsetValue(e),r=i.owner.viewer.findFocusedPage(n,!0),o=i.selection.start,s=i.selection.end,a=!1;i.selection.isForward||(o=i.selection.end,s=i.selection.start);var l=o.location,d=s.location;a=o.currentWidget!==s.currentWidget?!(r.x>=l.x&&r.x<=d.x||r.y>=l.y&&r.y<=d.y):!(r.x>=l.x&&r.x<=d.x&&r.y>=l.y&&r.y<=d.y),1===e.changedTouches.length&&a&&(i.updateSelectionOnTouch(n,r),i.isMouseDown=!1,i.touchDownOnSelectionMark=0,i.useTouchSelectionMark=!0,i.isSelectionChangedOnMouseMoved=!1),i.selection.isEmpty&&i.selection.selectCurrentWord(),!t.isNullOrUndefined(i.owner.contextMenuModule)&&i.owner.contextMenuModule.contextMenuInstance&&i.owner.contextMenuModule.onContextMenuInternal(e)}},this.onTouchMoveInternal=function(e){i.isTouchMoved=!0;var n,r=e.touches;if(!t.isNullOrUndefined(i.selection)){if(i.owner.editorModule&&i.owner.enableImageResizerMode&&i.owner.imageResizerModule.isImageResizing)return e.preventDefault(),void(i.owner.imageResizerModule.isImageMoveToNextPage||(i.owner.imageResizerModule.handleImageResizingOnTouch(e),i.selection.caret.style.display="none"));if(i.isMouseDown){n=i.getTouchOffsetValue(e);var o=i.owner.viewer.findFocusedPage(n,!0);if(i.touchDownOnSelectionMark>0){e.preventDefault();var s=o.y,a=i.owner.selection.end;o.y<=26?s-=o.y<0?0:o.y+.5:s-=36.5,a=2===i.touchDownOnSelectionMark?i.selection.start:i.selection.end,o=new O(o.x,s),i.owner.selection.moveTextPosition(o,a),i.isSelectionChangedOnMouseMoved=!0}i.selection.checkForCursorVisibility(),i.updateTouchMarkPosition()}}if(r.length>1){e.preventDefault(),i.isMouseDown=!1,i.zoomX=(r[0].clientX+r[1].clientX)/2,i.zoomY=(r[0].clientY+r[1].clientY)/2;var l=Math.sqrt(Math.pow(r[0].clientX-r[1].clientX,2)+Math.pow(r[0].clientY-r[1].clientY,2));i.preDifference>-1?l>i.preDifference?i.onPinchOutInternal(e):l<i.preDifference&&i.onPinchInInternal(e):i.zoomFactor<2?-1!==i.preDifference&&l>i.preDifference&&i.onPinchInInternal(e):-1===i.preDifference&&i.zoomFactor>2&&l>i.preDifference&&i.onPinchInInternal(e),i.preDifference=l}i.longTouchTimer&&(clearTimeout(i.longTouchTimer),i.longTouchTimer=void 0)},this.onTouchUpInternal=function(e){if(!t.isNullOrUndefined(i.selection)){var n=i.getTouchOffsetValue(e),r=i.owner.viewer.findFocusedPage(n,!0);1===e.changedTouches.length&&((!i.isTouchMoved||i.owner.enableImageResizerMode&&i.owner.imageResizerModule.isImageResizing)&&(i.updateSelectionOnTouch(n,r),t.isNullOrUndefined(i.currentPage)||t.isNullOrUndefined(i.selection.start)||i.isSelectionChangedOnMouseMoved||!(i.selection.isEmpty||i.selection.isImageField()&&(!i.owner.enableImageResizerMode||i.owner.enableImageResizerMode&&!i.owner.imageResizerModule.isImageResizing))||i.selection.navigateHyperLinkOnEvent(r,!0)),i.isMouseDown=!1,i.touchDownOnSelectionMark=0,i.useTouchSelectionMark=!0,i.isSelectionChangedOnMouseMoved=!1),i.owner.enableImageResizerMode&&i.owner.imageResizerModule.isImageResizing&&(i.owner.imageResizerModule.mouseUpInternal(),i.owner.imageResizerModule.isImageResizing=!1,i.owner.imageResizerModule.isImageMoveToNextPage=!1,i.scrollToPosition(i.owner.selection.start,i.owner.selection.end)),i.owner.enableImageResizerMode&&i.owner.imageResizerModule.isImageResizerVisible&&i.isTouchInput&&(i.touchStart.style.display="none",i.touchEnd.style.display="none"),e.preventDefault()}i.preDifference=-1,i.isTouchInput=!1,i.longTouchTimer&&(clearTimeout(i.longTouchTimer),i.longTouchTimer=void 0),i.isTimerStarted||(i.tapCount=1),i.isListTextSelected&&i.selection.hideCaret()},this.onKeyUpInternal=function(e){t.Browser.isDevice&&e.target===i.editableDiv&&window.getSelection().anchorOffset!==i.prefix.length&&i.selection.setEditableDivCaretPosition(i.editableDiv.innerText.length),(e.ctrlKey||17===e.keyCode||17===e.which)&&(i.isControlPressed=!1)},this.onKeyDownInternal=function(e){if(t.isNullOrUndefined(e.target)||e.target===i.editableDiv){var n=!1,r={event:e,isHandled:!1,source:i.owner};if(i.owner.trigger("keyDown",r),!r.isHandled){var o=e.which||e.keyCode,s=!(!e.ctrlKey&&!e.metaKey)||17===o,a=e.shiftKey?e.shiftKey:16===o,l=e.altKey?e.altKey:18===o;if(s&&!a&&!l)switch(o){case 80:e.preventDefault(),i.owner.print(),n=!0;break;case 83:e.preventDefault(),i.owner.save(""===i.owner.documentName?"sample":i.owner.documentName,"Sfdt"),n=!0}n||t.isNullOrUndefined(i.selection)||i.selection.onKeyDownInternal(e,s,a,l),n&&e.preventDefault()}}},this.owner=e,this.pages=[],this.lists=[],this.abstractLists=[],this.render=new q(this),this.characterFormat=new H(this),this.paragraphFormat=new P(this),this.renderedLists=new g,this.renderedLevelOverrides=[],this.headersFooters=[],this.styles=new M,this.preDefinedStyles=new g,this.initalizeStyles(),this.bookmarks=new g,this.editRanges=new g,this.isIosDevice=/Mac|iPad|iPod/i.test(navigator.userAgent),this.isMobileDevice=/Android|Windows Phone|webOS/i.test(navigator.userAgent),this.formFillPopup=new Q(this.owner),this.customXmlData=new g,this.contentControlCollection=[],this.footnoteCollection=[],this.endnoteCollection=[]}return Object.defineProperty(e.prototype,"visibleBounds",{get:function(){return this.visibleBoundsIn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewer",{get:function(){return this.owner.viewer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"containerCanvas",{get:function(){return t.isNullOrUndefined(this.containerCanvasIn)&&(this.containerCanvasIn=document.createElement("canvas"),this.containerCanvasIn.getContext("2d").save()),t.isNullOrUndefined(this.pageContainer)||this.containerCanvasIn.parentElement===this.pageContainer||this.pageContainer.appendChild(this.containerCanvasIn),this.containerCanvasIn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectionCanvas",{get:function(){return t.isNullOrUndefined(this.selectionCanvasIn)&&(this.selectionCanvasIn=document.createElement("canvas"),this.selectionCanvas.getContext("2d").save()),t.isNullOrUndefined(this.pageContainer)||this.selectionCanvasIn.parentElement===this.pageContainer||this.pageContainer.appendChild(this.selectionCanvasIn),this.selectionCanvasIn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"containerContext",{get:function(){return this.containerCanvas.getContext("2d")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectionContext",{get:function(){return this.selectionCanvas.getContext("2d")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentRenderingPage",{get:function(){if(0!==this.pages.length)return this.pages[this.pages.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"zoomFactor",{get:function(){return this.zoomFactorInternal},set:function(e){this.zoomFactorInternal!==e&&(this.preZoomFactor=this.zoomFactor,this.zoomFactorInternal=e,this.zoomModule.setZoomFactor(),this.owner.zoomFactor=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selection",{get:function(){return this.owner.selection},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectionStartPage",{get:function(){return this.selectionStartPageIn},set:function(e){this.selectionStartPageIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectionEndPage",{get:function(){return this.selectionEndPageIn},set:function(e){this.selectionEndPageIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dialog",{get:function(){return this.dialogInternal||this.initDialog(this.owner.enableRtl),this.dialogInternal},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dialog2",{get:function(){return this.dialogInternal2||this.initDialog2(this.owner.enableRtl),this.dialogInternal2},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dialog3",{get:function(){return this.dialogInternal3||this.initDialog3(this.owner.enableRtl),this.dialogInternal3},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentSelectedComment",{get:function(){return this.currentSelectedCommentInternal},set:function(e){this.owner&&this.owner.commentReviewPane&&(this.owner.commentReviewPane.previousSelectedComment=this.currentSelectedCommentInternal),this.currentSelectedCommentInternal=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentSelectedRevision",{get:function(){return this.currentSelectedRevisionInternal},set:function(e){this.currentSelectedRevisionInternal=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isInlineFormFillProtectedMode",{get:function(){return this.isFormFillProtectedMode&&"Inline"===this.owner.documentEditorSettings.formFieldSettings.formFillingMode},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isFormFillProtectedMode",{get:function(){return this.isDocumentProtected&&"FormFieldsOnly"===this.protectionType},enumerable:!0,configurable:!0}),e.prototype.initalizeStyles=function(){this.preDefinedStyles.add("Normal",'{"type":"Paragraph","name":"Normal","next":"Normal"}'),this.preDefinedStyles.add("Heading 1",'{"type":"Paragraph","name":"Heading 1","basedOn":"Normal","next":"Normal","link":"Heading 1 Char","characterFormat":{"fontSize":16.0,"fontFamily":"Calibri Light","fontColor":"#2F5496"},"paragraphFormat":{"leftIndent":0.0,"rightIndent":0.0,"firstLineIndent":0.0,"beforeSpacing":12.0,"afterSpacing":0.0,"lineSpacing":1.0791666507720947,"lineSpacingType":"Multiple","textAlignment":"Left","outlineLevel":"Level1"}}'),this.preDefinedStyles.add("Heading 2",'{"type":"Paragraph","name":"Heading 2","basedOn":"Normal","next":"Normal","link":"Heading 2 Char","characterFormat":{"fontSize":13.0,"fontFamily":"Calibri Light","fontColor":"#2F5496"},"paragraphFormat":{"leftIndent":0.0,"rightIndent":0.0,"firstLineIndent":0.0,"beforeSpacing":2.0,"afterSpacing":0.0,"lineSpacing":1.0791666507720947,"lineSpacingType":"Multiple","textAlignment":"Left","outlineLevel":"Level2"}}'),this.preDefinedStyles.add("Heading 3",'{"type":"Paragraph","name":"Heading 3","basedOn":"Normal","next":"Normal","link":"Heading 3 Char","characterFormat":{"fontSize":12.0,"fontFamily":"Calibri Light","fontColor":"#1F3763"},"paragraphFormat":{"leftIndent":0.0,"rightIndent":0.0,"firstLineIndent":0.0,"beforeSpacing":2.0,"afterSpacing":0.0,"lineSpacing":1.0791666507720947,"lineSpacingType":"Multiple","textAlignment":"Left","outlineLevel":"Level3"}}'),this.preDefinedStyles.add("Heading 4",'{"type":"Paragraph","name":"Heading 4","basedOn":"Normal","next":"Normal","link":"Heading 4 Char","characterFormat":{"italic":true,"fontFamily":"Calibri Light","fontColor":"#2F5496"},"paragraphFormat":{"leftIndent":0.0,"rightIndent":0.0,"firstLineIndent":0.0,"beforeSpacing":2.0,"afterSpacing":0.0,"lineSpacing":1.0791666507720947,"lineSpacingType":"Multiple","textAlignment":"Left","outlineLevel":"Level4"}}'),this.preDefinedStyles.add("Heading 5",'{"type":"Paragraph","name":"Heading 5","basedOn":"Normal","next":"Normal","link":"Heading 5 Char","characterFormat":{"fontFamily":"Calibri Light","fontColor":"#2F5496"},"paragraphFormat":{"leftIndent":0.0,"rightIndent":0.0,"firstLineIndent":0.0,"beforeSpacing":2.0,"afterSpacing":0.0,"lineSpacing":1.0791666507720947,"lineSpacingType":"Multiple","textAlignment":"Left","outlineLevel":"Level5"}}'),this.preDefinedStyles.add("Heading 6",'{"type":"Paragraph","name":"Heading 6","basedOn":"Normal","next":"Normal","link":"Heading 6 Char","characterFormat":{"fontFamily":"Calibri Light","fontColor":"#1F3763"},"paragraphFormat":{"leftIndent":0.0,"rightIndent":0.0,"firstLineIndent":0.0,"beforeSpacing":2.0,"afterSpacing":0.0,"lineSpacing":1.0791666507720947,"lineSpacingType":"Multiple","textAlignment":"Left","outlineLevel":"Level6"}}'),this.preDefinedStyles.add("Default Paragraph Font",'{"type":"Character","name":"Default Paragraph Font"}'),this.preDefinedStyles.add("Heading 1 Char",'{"type":"Character","name":"Heading 1 Char","basedOn":"Default Paragraph Font","characterFormat":{"fontSize":16.0,"fontFamily":"Calibri Light","fontColor":"#2F5496"}}'),this.preDefinedStyles.add("Heading 2 Char",'{"type":"Character","name":"Heading 2 Char","basedOn":"Default Paragraph Font","characterFormat":{"fontSize":13.0,"fontFamily":"Calibri Light","fontColor":"#2F5496"}}'),this.preDefinedStyles.add("Heading 3 Char",'{"type":"Character","name":"Heading 3 Char","basedOn":"Default Paragraph Font","characterFormat":{"fontSize":12.0,"fontFamily":"Calibri Light","fontColor": "#1F3763"}}'),this.preDefinedStyles.add("Heading 4 Char",'{"type":"Character","name":"Heading 4 Char","basedOn":"Default Paragraph Font","characterFormat":{"italic":true,"fontFamily":"Calibri Light","fontColor":"#2F5496"}}'),this.preDefinedStyles.add("Heading 5 Char",'{"type":"Character","name":"Heading 5 Char","basedOn":"Default Paragraph Font","characterFormat":{"fontFamily":"Calibri Light","fontColor":"#2F5496"}}'),this.preDefinedStyles.add("Heading 6 Char",'{"type":"Character","name":"Heading 6 Char","basedOn":"Default Paragraph Font","characterFormat":{"fontFamily":"Calibri Light","fontColor":"#1F3763"}}'),this.preDefinedStyles.add("Hyperlink",'{"type":"Character","name":"Hyperlink","basedOn":"Default Paragraph Font","next":"Normal","characterFormat":{"fontColor":"#0563C1","underline": "Single"}}'),this.preDefinedStyles.add("Toc1",'{"type":"Paragraph","name":"Toc1","basedOn":"Normal","next":"Normal","paragraphFormat":{"afterSpacing":5.0}}'),this.preDefinedStyles.add("Toc2",'{"type":"Paragraph","name":"Toc2","basedOn":"Normal","next":"Normal","paragraphFormat":{"leftIndent" :11.0,"afterSpacing":5.0}}'),this.preDefinedStyles.add("Toc3",'{"type":"Paragraph","name":"Toc3","basedOn":"Normal","next":"Normal","paragraphFormat":{"leftIndent" :22.0,"afterSpacing":5.0}}'),this.preDefinedStyles.add("Toc4",'{"type":"Paragraph","name":"Toc4","basedOn":"Normal","next":"Normal","paragraphFormat":{"leftIndent" :33.0,"afterSpacing":5.0}}'),this.preDefinedStyles.add("Toc5",'{"type":"Paragraph","name":"Toc5","basedOn":"Normal","next":"Normal","paragraphFormat":{"leftIndent" :44.0,"afterSpacing":5.0}}'),this.preDefinedStyles.add("Toc6",'{"type":"Paragraph","name":"Toc6","basedOn":"Normal","next":"Normal","paragraphFormat":{"leftIndent" :55.0,"afterSpacing":5.0}}'),this.preDefinedStyles.add("Toc7",'{"type":"Paragraph","name":"Toc7","basedOn":"Normal","next":"Normal","paragraphFormat":{"leftIndent" :66.0,"afterSpacing":5.0}}'),this.preDefinedStyles.add("Toc8",'{"type":"Paragraph","name":"Toc8","basedOn":"Normal","next":"Normal","paragraphFormat":{"leftIndent" :77.0,"afterSpacing":5.0}}'),this.preDefinedStyles.add("Toc9",'{"type":"Paragraph","name":"Toc9","basedOn":"Normal","next":"Normal","paragraphFormat":{"leftIndent" :88.0,"afterSpacing":5.0}}')},e.prototype.clearDocumentItems=function(){this.editRanges.clear(),this.headersFooters=[],this.fields=[],this.formFields=[],this.currentSelectedComment=void 0,this.currentSelectedRevision=void 0;for(var e=0;e<this.comments.length;e++){var t=this.comments[e].commentStart;t&&t.destroy()}this.comments=[],this.bookmarks.clear(),this.styles.clear(),this.authors.clear(),this.revisionsInternal.clear(),this.owner.revisions.destroy(),this.characterFormat.clearFormat(),this.paragraphFormat.clearFormat(),this.owner.trackChangesPane&&this.owner.trackChangesPane.clear(),this.setDefaultCharacterValue(this.characterFormat),this.setDefaultParagraphValue(this.paragraphFormat),this.owner.commentReviewPane&&this.owner.commentReviewPane.clear(),this.isHeaderFooter=!1,this.defaultTabWidth=36,this.isDocumentProtected=!1,this.protectionType="NoProtection",this.restrictFormatting=!1,this.hashValue="",this.saltValue="",this.userCollection=[],this.formFillPopup&&this.formFillPopup.hidePopup(),this.customXmlData.clear(),this.contentControlCollection=[],this.endnotes.clear(),this.footnotes.clear(),this.footnoteCollection=[],this.endnoteCollection=[]},e.prototype.setDefaultDocumentFormat=function(){this.owner.parser.parseCharacterFormat(this.owner.characterFormat,this.characterFormat),this.owner.parser.parseParagraphFormat(this.owner.paragraphFormat,this.paragraphFormat)},e.prototype.setDefaultCharacterValue=function(e){e.bold=!1,e.italic=!1,e.fontFamily="Calibri",e.fontSize=11,e.underline="None",e.strikethrough="None",e.fontSizeBidi=11,e.fontFamilyBidi="Calibri",e.baselineAlignment="Normal",e.highlightColor="NoColor",e.fontColor="empty",e.allCaps=!1},e.prototype.setDefaultParagraphValue=function(e){e.leftIndent=0,e.rightIndent=0,e.firstLineIndent=0,e.textAlignment="Left",e.beforeSpacing=0,e.afterSpacing=0,e.lineSpacing=1,e.lineSpacingType="Multiple",e.bidi=!1},e.prototype.getAbstractListById=function(e){if(!t.isNullOrUndefined(this.abstractLists))for(var i=0;i<this.abstractLists.length;i++){var n=this.abstractLists[i];if(n instanceof V&&n.abstractListId===e)return n}},e.prototype.getListById=function(e){if(!t.isNullOrUndefined(this.lists))for(var i=0;i<this.lists.length;i++)if(!t.isNullOrUndefined(this.lists[i])&&this.lists[i].listId===e)return this.lists[i]},e.getListLevelNumber=function(e){return e.ownerBase instanceof w?e.ownerBase.levelNumber:e.ownerBase instanceof V&&!t.isNullOrUndefined(e.ownerBase.levels)?e.ownerBase.levels.indexOf(e):-1},e.prototype.getBookmarks=function(e){for(var t=[],i=0;i<this.bookmarks.keys.length;i++){var n=this.bookmarks.keys[i];(e||0!==n.indexOf("_"))&&t.push(n)}return t},e.prototype.selectComment=function(e){var t=this;this.owner.selection&&this.owner.commentReviewPane&&(this.owner.showComments=!0,setTimeout(function(){t.owner&&t.owner.selection&&t.owner.selection.selectComment(e)}))},e.prototype.showComments=function(e){if(this.owner&&e&&this.owner.enableComment){var t={type:"Comment"};this.owner.trigger("beforePaneSwitch",t)}this.owner.commentReviewPane.reviewTab.hideTab(0,!1),this.owner.commentReviewPane.reviewTab.hideTab(1,!1),this.owner.commentReviewPane.showHidePane(e&&this.owner.enableComment,"Comments")},e.prototype.showRevisions=function(e){var t=!1;if(this.owner&&e){var i={type:"comment"};this.owner.trigger("beforePaneSwitch",i)}!e&&this.owner.showComments?(this.owner.commentReviewPane.reviewTab.hideTab(0,!1),this.owner.commentReviewPane.showHidePane(!0,"Comments")):this.showRevision||this.owner.enableTrackChanges||!this.owner.showRevisions?(this.owner.commentReviewPane.showHidePane(e,"Changes"),this.owner.enableComment||(t=!0),this.owner.commentReviewPane.reviewTab.hideTab(0,t),this.showRevision=!1):(this.owner.commentReviewPane.showHidePane(!e,"Changes"),this.owner.showRevisions=!1),e&&this.owner.trackChangesPane.enableDisableButton(!this.owner.isReadOnly)},e.prototype.initializeComponents=function(){var e=this.owner.element;if(!t.isNullOrUndefined(e)){this.optionsPaneContainer=t.createElement("div",{className:"e-documenteditor-optionspane"}),e.appendChild(this.optionsPaneContainer);var i;this.owner.enableRtl&&(i="direction:ltr;"),this.viewerContainer=t.createElement("div",{id:this.owner.containerId+"_viewerContainer"}),this.viewerContainer.style.cssText="position:relative;backgroundColor:#FBFBFB;overflow:auto;"+i,this.optionsPaneContainer.appendChild(this.viewerContainer),this.viewerContainer.tabIndex=0,this.viewerContainer.style.outline="none",this.pageContainer=t.createElement("div",{id:this.owner.containerId+"_pageContainer",className:"e-de-background"}),this.viewerContainer.appendChild(this.pageContainer),this.pageContainer.style.top="0px",this.pageContainer.style.left="0px",this.pageContainer.style.position="relative",this.pageContainer.style.pointerEvents="none",t.Browser.isDevice?this.createEditableDiv(e):this.createEditableIFrame(),this.owner.enableImageResizerMode&&this.owner.imageResizerModule.initializeImageResizer(),this.updateViewerSizeInternal(e),this.layout=new j(this),this.textHelper=new G(this),this.zoomModule=new K(this),this.initTouchEllipse(),this.wireEvent(),this.restrictEditingPane=new Z(this),this.owner.commentReviewPane=new Ni(this.owner),this.owner.trackChangesPane=new $(this.owner,this.owner.commentReviewPane),n.createSpinner({target:this.owner.element,cssClass:"e-spin-overlay"})}},e.prototype.measureScrollbarWidth=function(e){var t=document.createElement("div");t.setAttribute("style","visibility:hidden;overflow:scroll"),e.appendChild(t);var i=document.createElement("div");t.appendChild(i),this.scrollbarWidth=t.getBoundingClientRect().width-i.getBoundingClientRect().width,t.parentNode.removeChild(t)},e.prototype.createEditableDiv=function(e){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=e.id+"_editableDiv",document.body.appendChild(this.editableDiv)},e.prototype.createEditableIFrame=function(){this.iframe=t.createElement("iframe",{attrs:{scrolling:"no",style:"pointer-events:none;position:absolute;left:0px;top:0px;outline:none;background-color:transparent;width:0px;height:0px;overflow:hidden"},className:"e-de-text-target"}),this.viewerContainer.appendChild(this.iframe),this.initIframeContent()},e.prototype.initIframeContent=function(){this.iframe.contentDocument.open(),this.iframe.contentDocument.write('<!DOCTYPE html><html><head></head><body spellcheck="false" style=background-color:transparent;width:100%;height:100%;padding: 0px; margin: 0px; ><div contenteditable="true" style=background-color:transparent;width:100%;height:100%;padding: 0px; margin: 0px;></div></body></html>'),this.iframe.contentDocument.close(),this.editableDiv=this.iframe.contentDocument.body.children[0]},e.prototype.wireEvent=function(){t.isNullOrUndefined(this.selection)||this.selection.initCaret(),this.wireInputEvents(),t.isNullOrUndefined(this.iframe)||this.iframe.addEventListener("load",this.onIframeLoad.bind(this)),this.viewerContainer.addEventListener("scroll",this.scrollHandler),this.viewerContainer.addEventListener("mousedown",this.onMouseDownInternal),this.viewerContainer.addEventListener("keydown",this.onKeyDownInternal),this.viewerContainer.addEventListener("mousemove",this.onMouseMoveInternal),this.viewerContainer.addEventListener("mouseleave",this.onMouseLeaveInternal),this.viewerContainer.addEventListener("mouseenter",this.onMouseEnterInternal),this.viewerContainer.addEventListener("contextmenu",this.onContextMenu),this.viewerContainer.addEventListener("dblclick",this.onDoubleTap),this.viewerContainer.addEventListener("mouseup",this.onMouseUpInternal),window.addEventListener("resize",this.onWindowResize),window.addEventListener("keyup",this.onKeyUpInternal),window.addEventListener("mouseup",this.onImageResizer.bind(this)),window.addEventListener("touchend",this.onImageResizer.bind(this)),this.viewerContainer.addEventListener("touchstart",this.onTouchStartInternal),this.viewerContainer.addEventListener("touchmove",this.onTouchMoveInternal),this.viewerContainer.addEventListener("touchend",this.onTouchUpInternal),navigator.userAgent.match("Firefox")&&this.viewerContainer.addEventListener("DOMMouseScroll",this.zoomModule.onMouseWheelInternal.bind(this)),this.viewerContainer.addEventListener("mousewheel",this.zoomModule.onMouseWheelInternal.bind(this))},e.prototype.wireInputEvents=function(){t.isNullOrUndefined(this.editableDiv)||(this.editableDiv.addEventListener("paste",this.onPaste),t.Browser.isDevice?this.editableDiv.addEventListener("input",this.onTextInputInternal):(this.editableDiv.addEventListener("keypress",this.onKeyPressInternal),"chrome"===t.Browser.info.name&&this.editableDiv.addEventListener("textInput",this.onTextInput)),this.editableDiv.addEventListener("blur",this.onFocusOut),this.editableDiv.addEventListener("keydown",this.onKeyDownInternal),this.editableDiv.addEventListener("compositionstart",this.compositionStart),this.editableDiv.addEventListener("compositionupdate",this.compositionUpdated),this.editableDiv.addEventListener("compositionend",this.compositionEnd))},e.prototype.onIframeLoad=function(){t.isNullOrUndefined(this.iframe)||0!==this.iframe.contentDocument.body.children.length||(this.initIframeContent(),this.wireInputEvents())},e.prototype.getEditableDivTextContent=function(){return this.editableDiv.textContent},e.prototype.updateAuthorIdentity=function(){for(var e=this.owner.revisions.changes,t=0;t<e.length;t++)this.getAuthorColor(e[t].author)},e.prototype.getAvatar=function(e,i,n,r){var o,s;if(t.isNullOrUndefined(n)?o=r.author:(o=n.author,s=n.initial),!t.isNullOrUndefined(o)){var a=t.createElement("div",{className:"e-de-cmt-avatar"}),l=t.createElement("div",{className:"e-de-ff-cmt-avatar"});if(l.style.backgroundColor=this.owner.documentHelper.getAuthorColor(o),""===s||t.isNullOrUndefined(s)){var d=o.split(" "),h=d[0].charAt(0);d.length>1&&(h+=d[d.length-1][0]),l.innerText=h.toUpperCase()}else s.length>2?l.innerText=s.substring(0,2):l.innerText=s;a.appendChild(l),a.appendChild(i),e.appendChild(a)}},e.prototype.getAuthorColor=function(e){if(this.authors.containsKey(e))return this.authors.get(e);var t=this.owner.userColor;return e!==this.owner.currentUser&&(t=0===this.authors.length&&"#b5082e"!==t?"#b5082e":this.generateRandomColor()),this.authors.add(e,t),t},e.prototype.generateRandomColor=function(){return["#b5082e","#2e97d3","#bb00ff","#f37e43","#03a60b","#881824","#e09a2b","#50565e"][this.authors.length%8]},e.prototype.positionEditableTarget=function(){var e=this.selection.getRect(this.selection.start),t=this.selection.getSelectionPage(this.selection.start),i=t.bodyWidgets[0].sectionFormat,n=t.boundingRectangle.x+W.convertPointToPixel(i.leftMargin)*this.zoomFactor,r=e.y,o=i.pageWidth-i.leftMargin-i.rightMargin,s="left:"+n+"px;";s+="top:"+r+"px;",s+="width:"+W.convertPointToPixel(o)*this.zoomFactor+"px;",s+="height:250px;outline-style:none;position:absolute",this.iframe.setAttribute("style",s);var a="background-color:transparent;width:100%;height:250px;padding: 0px; margin: 0px;";a+="text-indent:"+(e.x-n)+"px;",a+="color:transparent;pointer-events:none;outline-style:none;",a+="font-size:"+W.convertPointToPixel(this.selection.characterFormat.fontSize)*this.zoomFactor+"px;",a+="font-family"+this.selection.characterFormat.fontFamily+";",a+="overflow:hidden;text-decoration:none;white-space:normal;",this.editableDiv.setAttribute("style",a)},e.prototype.onImageResizer=function(e){!t.isNullOrUndefined(this.owner)&&!t.isNullOrUndefined(this.owner.imageResizerModule)&&this.owner.imageResizerModule.isImageResizerVisible&&this.owner.imageResizerModule.isImageResizing&&(e instanceof MouseEvent?this.onMouseUpInternal(e):e instanceof TouchEvent&&this.onTouchUpInternal(e)),this.scrollMoveTimer&&(this.isMouseEntered=!0,clearInterval(this.scrollMoveTimer))},e.prototype.initDialog=function(e){this.dialogInternal||(this.dialogTarget1=t.createElement("div",{className:"e-de-dlg-target"}),document.body.appendChild(this.dialogTarget1),e&&this.dialogTarget1.classList.add("e-de-rtl"),this.dialogInternal=new n.Dialog({target:document.body,showCloseIcon:!0,allowDragging:!0,enableRtl:e,visible:!1,width:"1px",isModal:!0,position:{X:"center",Y:"center"},zIndex:this.owner.zIndex+20,animationSettings:{effect:"None"}}),this.dialogInternal.isStringTemplate=!0,this.dialogInternal.open=this.selection.hideCaret,this.dialogInternal.beforeClose=this.updateFocus,this.dialogInternal.appendTo(this.dialogTarget1))},e.prototype.initDialog3=function(e){this.dialogInternal3||(this.dialogTarget3=t.createElement("div",{className:"e-de-dlg-target"}),document.body.appendChild(this.dialogTarget3),e&&this.dialogTarget3.classList.add("e-de-rtl"),this.dialogInternal3=new n.Dialog({target:document.body,showCloseIcon:!0,allowDragging:!0,enableRtl:e,visible:!1,width:"1px",isModal:!0,position:{X:"center",Y:"center"},zIndex:this.owner.zIndex,animationSettings:{effect:"None"}}),this.dialogInternal3.isStringTemplate=!0,this.dialogInternal3.open=this.selection.hideCaret,this.dialogInternal3.beforeClose=this.updateFocus,this.dialogInternal3.appendTo(this.dialogTarget3))},e.prototype.hideDialog=function(){this.dialog.hide(),this.updateFocus()},e.prototype.initDialog2=function(e){this.dialogInternal2||(this.dialogTarget2=t.createElement("div",{className:"e-de-dlg-target"}),document.body.appendChild(this.dialogTarget2),e&&this.dialogTarget2.classList.add("e-de-rtl"),this.dialogInternal2=new n.Dialog({target:document.body,showCloseIcon:!0,allowDragging:!0,enableRtl:e,visible:!1,width:"1px",isModal:!0,position:{X:"center",Y:"Top"},zIndex:this.owner.zIndex+10}),this.dialogInternal2.isStringTemplate=!0,this.dialogInternal2.appendTo(this.dialogTarget2))},e.prototype.clearContent=function(){if(this.containerContext.clearRect(0,0,this.containerCanvas.width,this.containerCanvas.height),this.selectionContext.clearRect(0,0,this.selectionCanvas.width,this.selectionCanvas.height),this.pageContainer)for(var e=this.pageContainer.getElementsByClassName("e-de-cmt-mark"),t=0;t<e.length;t++)e[t].style.display="none";if(this.pageContainer)for(var i=this.pageContainer.getElementsByClassName("e-de-lock-mark"),t=0;t<i.length;t++)i[t].style.display="none"},e.prototype.onDocumentChanged=function(e){this.clearContent(),this.owner.editorModule&&(this.owner.editorModule.tocStyles={},this.owner.editorModule.tocBookmarkId=0),this.heightInfoCollection={},this.owner.isDocumentLoaded=!1,this.updateAuthorIdentity();for(var i=0;i<this.pages.length;i++)this.pages[i].bodyWidgets[0].destroy();this.pages=[],t.isNullOrUndefined(this.renderedLists)||this.renderedLists.clear(),t.isNullOrUndefined(this.renderedLevelOverrides)||(this.renderedLevelOverrides=[]),t.isNullOrUndefined(this.owner.editorHistory)||this.owner.editorHistory.destroy(),this.owner.isDocumentLoaded=!0,this.layout.isInitialLoad=!0,this.layout.footHeight=0,this.layout.footnoteHeight=0,this.layout.layoutItems(e,!1),this.owner.selection&&(this.selection.previousSelectedFormField=void 0,this.formFields.length>0&&this.owner.selection.highlightFormFields(),this.owner.selection.editRangeCollection=[],this.owner.selection.selectRange(this.owner.documentStart,this.owner.documentStart),this.isDocumentProtected&&this.restrictEditingPane.showHideRestrictPane(!0)),this.owner.optionsPaneModule&&this.owner.optionsPaneModule.showHideOptionsPane(!1),this.restrictEditingPane.restrictPane&&!this.isDocumentProtected&&this.restrictEditingPane.showHideRestrictPane(!1),!t.isNullOrUndefined(this.owner.selection)&&this.owner.selection.isViewPasteOptions&&(this.owner.selection.isViewPasteOptions=!1,this.owner.selection.showHidePasteOptions(void 0,void 0)),this.owner.fireDocumentChange()},e.prototype.initTouchEllipse=function(){var e="height: 30px;width: 30px;position: absolute;background-color: transparent;margin: 0px;padding: 0px;z-index:5",i=" height: 12px;width: 12px;border-radius: 50%;background-color: white;position: absolute;margin: 0px 6px 0px 6px;border-width: 2px;border-style: solid;border-color: #000000;box-sizing: unset;";this.touchStart=t.createElement("div",{className:"e-touch-ellipse",styles:e});var n=t.createElement("div",{styles:i});this.touchEnd=t.createElement("div",{className:"e-touch-ellipse",styles:e}),this.touchStart.style.display="none";var r=t.createElement("div",{styles:i});this.touchStart.appendChild(n),this.touchEnd.appendChild(r),this.touchEnd.style.display="none",this.viewerContainer.appendChild(this.touchStart),this.viewerContainer.appendChild(this.touchEnd)},e.prototype.updateTouchMarkPosition=function(){if("none"!==this.touchStart.style.display&&!t.isNullOrUndefined(this.selection))if(this.selection.isEmpty)this.selection.updateCaretPosition();else{var e=this.selection.getCaretBottom(this.selection.start,!1),i=this.selection.getPage(this.selection.start.paragraph),n=i.boundingRectangle.y-this.owner.viewer.pageGap*(this.pages.indexOf(i)+1)*this.zoomFactor+this.owner.viewer.pageGap*(this.pages.indexOf(i)+1);this.touchStart.style.left=i.boundingRectangle.x+(Math.round(this.selection.start.location.x)*this.zoomFactor-14)+"px",this.touchStart.style.top=n+e*this.zoomFactor+"px",this.selection.isEmpty||(e=this.selection.getCaretBottom(this.selection.end,!1),i=this.selection.getPage(this.selection.end.paragraph)),this.touchEnd.style.left=i.boundingRectangle.x+(Math.round(this.selection.end.location.x)*this.zoomFactor-14)+"px",this.touchEnd.style.top=n+e*this.zoomFactor+"px"}},e.prototype.scrollForwardOnSelection=function(){this.viewerContainer&&(this.viewerContainer.scrollTop=this.viewerContainer.scrollTop+200)},e.prototype.scrollBackwardOnSelection=function(){this.viewerContainer.scrollTop=this.viewerContainer.scrollTop-200},e.prototype.isSelectionInListText=function(e){var i=this.getLineWidget(e);if(!t.isNullOrUndefined(i)&&i.children[0]instanceof Ke){var n=this.getLeftValue(i),r=i.children[0].width,o=i.children[0].height;if(this.isInsideRect(n,i.paragraph.y,r,o,e))return this.selectionLineWidget=i,!0}return!1},e.prototype.isInShapeBorder=function(e,i){if(!t.isNullOrUndefined(e)){var n=e.width,r=e.height;if(this.isInsideRect(e.x-e.margin.left,e.y-e.margin.top,n,r,i)){if(e instanceof Ge)return!0;if(e instanceof Ve){var o=e.lineFormat.weight;if(!this.isInsideRect(e.x+o,e.y+o+e.textFrame.marginTop,n-2*o,r-(2*o+e.textFrame.marginTop+e.textFrame.marginBottom),i))return!0}}}return!1},e.prototype.isInsideRect=function(e,t,i,n,r){return r.x>e&&r.x<=e+i&&r.y>t&&r.y<=t+n},e.prototype.getLeftValue=function(e){var t=e.paragraph.x,i=e.paragraph.paragraphFormat;this.selection.isParagraphFirstLine(e)&&("Right"===i.textAlignment?(t-=W.convertPointToPixel(i.firstLineIndent),t-=W.convertPointToPixel(i.leftIndent)):t+=W.convertPointToPixel(i.firstLineIndent));var n=e.children[0];return n instanceof Ke&&(t+=n.margin.left),t},e.prototype.isLeftButtonPressed=function(e){return this.isTouchInput=!1,1===(e.which||e.button)},e.prototype.updateSelectionOnTouch=function(e,i){this.zoomX=void 0,this.zoomY=void 0,!this.isMouseDown||this.isSelectionChangedOnMouseMoved||t.isNullOrUndefined(this.currentPage)||t.isNullOrUndefined(this.owner.selection.start)||(0===this.touchDownOnSelectionMark&&(this.updateTextPositionForSelection(new O(i.x,i.y),this.tapCount),2===this.tapCount&&this.selection.checkAndEnableHeaderFooter(e,i)),this.owner.selection.isEmpty&&this.selection.updateCaretPosition(),this.selection.checkForCursorVisibility(),t.isNullOrUndefined(this.currentSelectedComment)||!this.owner.commentReviewPane||this.owner.commentReviewPane.commentPane.isEditMode||(this.currentSelectedComment=void 0))},e.prototype.getTouchOffsetValue=function(e){var i=this.viewerContainer.getBoundingClientRect(),n=e.touches[0];t.isNullOrUndefined(n)&&(n=e.changedTouches[0]);var r=n.pageX-i.left,o=n.pageY-i.top;return new O(r,o)},e.prototype.onPinchInInternal=function(e){this.preZoomFactor=this.zoomFactor;var t=this.zoomFactor-.01;t<5&&t>2&&(t-=.01),t<.1&&(t=.1),this.zoomFactor=t},e.prototype.onPinchOutInternal=function(e){this.preZoomFactor=this.zoomFactor;var t=this.zoomFactor+.01;t>2&&(t+=.01),t>5&&(t=5),this.zoomFactor=t},e.prototype.getPageWidth=function(e){return e.boundingRectangle.width},e.prototype.removePage=function(e){this.currentPage===e&&(this.currentPage=void 0);var i=this.pages.indexOf(e);if(this.pages.splice(i,1),!t.isNullOrUndefined(this.owner.viewer.visiblePages)&&this.owner.viewer.visiblePages.indexOf(e)>-1){var n=this.owner.viewer.visiblePages.indexOf(e);this.owner.viewer.visiblePages.splice(n,1)}for(var r=0,o=0;o<this.pages.length;o++)r+=this.pages[o].boundingRectangle.height;r-=e.boundingRectangle.height+20;var s=20;if(i>0&&(s+=this.pages[i-1].boundingRectangle.bottom),-1!==i)for(o=i;o<this.pages.length;o++)(e=this.pages[o]).boundingRectangle=new ae(e.boundingRectangle.x,s,e.boundingRectangle.width,e.boundingRectangle.height),s=e.boundingRectangle.bottom+20,e.repeatHeaderRowTableWidget=!1},e.prototype.updateViewerSize=function(){var e=this,i=this.owner.getDocumentEditorElement();this.updateViewerSizeInternal(i),this.owner.viewer.updateScrollBars(),this.owner.viewer instanceof oe&&!t.isNullOrUndefined(this.owner)&&!t.isNullOrUndefined(i)&&(this.resizerTimer&&clearTimeout(this.resizerTimer),this.resizerTimer=setTimeout(function(){if(!t.isNullOrUndefined(e.owner)){var i=void 0;i=t.isNullOrUndefined(e.visibleBounds)?0:e.visibleBounds.width,t.isNullOrUndefined(e.owner.viewer.preVisibleWidth)&&(e.owner.viewer.preVisibleWidth=0),t.isNullOrUndefined(e.visibleBounds)||i===e.owner.viewer.preVisibleWidth||(e.owner.editorModule.layoutWholeDocument(),e.owner.viewer.preVisibleWidth=i),e.resizerTimer&&clearTimeout(e.resizerTimer)}},50)),t.isNullOrUndefined(this.selection)||this.selection.updateCaretPosition()},e.prototype.updateViewerSizeInternal=function(e){if(!t.isNullOrUndefined(e)){var i=e.getBoundingClientRect(),n=0,r=0;r=i.height>0?i.height:200;var o=this.restrictEditingPane&&this.restrictEditingPane.isShowRestrictPane?this.restrictEditingPane.restrictPane.getBoundingClientRect():void 0,s=this.owner.optionsPaneModule&&this.owner.optionsPaneModule.isOptionsPaneShow?this.owner.optionsPaneModule.optionsPane.getBoundingClientRect():void 0,a=this.owner.commentReviewPane&&this.owner.commentReviewPane.parentPaneElement?this.owner.commentReviewPane.parentPaneElement.getBoundingClientRect():void 0;if(o||s||a){var l=o?o.width:0;l+=s?s.width:0,l+=a?a.width:0,n=i.width-l>0?i.width-l:200}else n=i.width>0?i.width:200;this.viewerContainer.style.height=r.toString()+"px",this.viewerContainer.style.width=Math.ceil(n)+"px",this.visibleBoundsIn=new ae(0,0,n,r),this.containerCanvas.width=n,this.containerCanvas.height=r,this.selectionCanvas.width=n,this.selectionCanvas.height=r,this.measureScrollbarWidth(e)}},e.prototype.insertPage=function(e,t){this.pages.indexOf(t)>-1&&this.pages.splice(this.pages.indexOf(t),1),this.pages.splice(e,0,t);var i=20;e>0&&(i+=this.pages[e-1].boundingRectangle.bottom);for(var n=e;n<this.pages.length;n++)(t=this.pages[n]).boundingRectangle=new ae(t.boundingRectangle.x,i,t.boundingRectangle.width,t.boundingRectangle.height),i=t.boundingRectangle.bottom+20},e.prototype.updateTextPositionForSelection=function(e,i){var n=this.getLineWidget(e);if(t.isNullOrUndefined(n)||this.selection.updateTextPosition(n,e),i>1){if(this.isMouseDown=!1,this.useTouchSelectionMark=!1,0===this.pages.length)return;t.isNullOrUndefined(this.currentPage)||t.isNullOrUndefined(this.owner.selection.start)||(i%2==0?this.owner.selection.selectCurrentWord():this.owner.selection.selectParagraph())}},e.prototype.scrollToPosition=function(e,i,n){if(this.skipScrollToPosition||this.isWebPrinting)return void(this.skipScrollToPosition=!1);if(!(this.owner.enableImageResizerMode&&this.owner.imageResizerModule.isImageResizing||this.isMouseDownInFooterRegion||this.isRowOrCellResizing)){var r=this.selection.getLineWidgetInternal(i.currentWidget,i.offset,!0);if(!t.isNullOrUndefined(r)){this.selection.getTop(r);if(this.isMouseDown){var o=this.selection.getLineWidgetInternal(i.currentWidget,i.offset,!1),s=this.selection.getTop(o);o!==r&&i.location.y>=s&&(r=o)}r.height;var a=this.selection.getPage(r.paragraph);this.currentPage=a;var l=0,d=0;this.owner.viewer,this.owner.viewer;if(!t.isNullOrUndefined(a)){var h=a.boundingRectangle.width;(l=(this.visibleBounds.width-h*this.zoomFactor)/2)<30&&(l=30),d=a.boundingRectangle.y*this.zoomFactor+(this.pages.indexOf(a)+1)*this.owner.viewer.pageGap*(1-this.zoomFactor);var c=this.owner.viewer.containerTop,p=this.owner.viewer.containerLeft,u=this.visibleBounds.height,g=this.selection.updateCaretSize(this.owner.selection.end,!0),m=g.topMargin,f=g.height;l+=i.location.x*this.zoomFactor,c+20>(d+=(i.location.y+m)*this.zoomFactor)?this.viewerContainer.scrollTop=d-10:c+u<d+f&&(this.viewerContainer.scrollTop=d+f-u+10),n||this.selection.updateCaretToPage(e,a);var v=this.viewerContainer.offsetWidth-this.viewerContainer.clientWidth;p>l?this.viewerContainer.scrollLeft=l-this.pageContainer.offsetWidth/100*20:p+this.visibleBounds.width<l+v&&(this.viewerContainer.scrollLeft=p+this.pageContainer.offsetWidth/100*15+v)}}}},e.prototype.getLineWidget=function(e){return this.getLineWidgetInternal(e,!1)},e.prototype.getLineWidgetInternal=function(e,i){var n=void 0;if(!t.isNullOrUndefined(this.currentPage)){var r=void 0;if(this.owner.enableHeaderAndFooter){var o=this.currentPage,s=o.boundingRectangle.height,a=Math.max(o.headerWidget.y+o.headerWidget.height,W.convertPointToPixel(o.bodyWidgets[0].sectionFormat.topMargin))*this.zoomFactor,l=W.convertPointToPixel(o.bodyWidgets[0].sectionFormat.footerDistance),d=o.boundingRectangle.height-Math.max(o.footerWidget.height+l,2*l);if(i?r=this.isBlockInHeader(this.selection.start.paragraph)?this.currentPage.headerWidget:this.currentPage.footerWidget:e.y<=s&&e.y>=d?r=this.currentPage.footerWidget:e.y>=0&&e.y<=a&&(r=this.currentPage.headerWidget),t.isNullOrUndefined(r))return;var h=this.checkFloatingItems(r,e,i);return h.isShapeSelected?h.isInShapeBorder?h.element.line:this.selection.getLineWidgetBodyWidget(h.element.textFrame,e):this.selection.getLineWidgetBodyWidget(r,e)}var c=this.checkFloatingItems(this.currentPage.bodyWidgets[0],e,i);if(c.isShapeSelected){if(c.isInShapeBorder)return c.element.line;c.element instanceof Ve&&(n=this.selection.getLineWidgetBodyWidget(c.element.textFrame,e))}else if(i&&this.isFootnoteWidget){if(void 0!==this.selection.start.paragraph.footNoteReference&&this.selection.start.paragraph.containerWidget instanceof me&&"Footnote"===this.selection.start.paragraph.containerWidget.footNoteType)return this.selection.getLineWidgetBodyWidget(this.currentPage.footnoteWidget,e);if(void 0!==this.selection.start.paragraph.footNoteReference&&this.selection.start.paragraph.containerWidget instanceof me&&"Endnote"===this.selection.start.paragraph.containerWidget.footNoteType)return this.selection.getLineWidgetBodyWidget(this.currentPage.endnoteWidget,e)}else if(!i&&this.currentPage.footnoteWidget&&this.isInFootnoteWidget(this.currentPage.footnoteWidget,e))(n=this.selection.getLineWidgetBodyWidget(this.currentPage.footnoteWidget,e))&&(this.isFootnoteWidget=!0);else if(!i&&this.currentPage.endnoteWidget&&this.isInFootnoteWidget(this.currentPage.endnoteWidget,e))(n=this.selection.getLineWidgetBodyWidget(this.currentPage.endnoteWidget,e))&&(this.isFootnoteWidget=!0);else for(var p=0;p<this.currentPage.bodyWidgets.length;p++){var u=this.currentPage.bodyWidgets[p];if(n=this.selection.getLineWidgetBodyWidget(u,e),!t.isNullOrUndefined(n)){this.isFootnoteWidget=!1;break}}}return n},e.prototype.isInFootnoteWidget=function(e,t){for(var i=0;i<e.childWidgets.length;i++){var n=e.childWidgets[i];if(n instanceof he&&n.y<=t.y&&n.y+n.height>=t.y)return!0}return!1},e.prototype.checkFloatingItems=function(e,t,i){var n,r=!1,o=!1,s=this.selection.isInShape,a=i&&s;if(e.floatingElements.length>0){this.currentPage;if(e.floatingElements.sort(function(e,t){return t.zOrderPosition-e.zOrderPosition}),a){var l=this.owner.selection.getCurrentTextFrame();l&&(n=l.containerShape,r=!0)}else{for(var d=0;d<e.floatingElements.length;d++)if(n=e.floatingElements[d],t.x<n.x+n.margin.left+n.width&&t.x>n.x&&t.y<n.y+n.margin.top+n.height&&t.y>n.y){r=!0,this.isInShapeBorder(n,t)&&(o=!0);break}i&&!s&&(r=!1)}}return{element:n,caretPosition:t,isShapeSelected:r,isInShapeBorder:o}},e.prototype.isBlockInHeader=function(e){for(;!(e.containerWidget instanceof ue);){if(!e.containerWidget)return!1;(e=e.containerWidget)instanceof _e&&(e=e.containerShape.paragraph)}return-1!==e.containerWidget.headerFooterType.indexOf("Header")},e.prototype.clearSelectionHighlight=function(){!this.isControlPressed||this.isMouseDown,this.owner.selection.clearSelectionHighlightInSelectedWidgets()&&this.selectionContext.clearRect(0,0,this.selectionCanvas.width,this.selectionCanvas.height)},e.prototype.removeEmptyPages=function(){for(var e=!1,t=0;t<this.pages.length;t++){var i=this.pages[t];0!==i.bodyWidgets.length&&0!==i.bodyWidgets[0].childWidgets.length||(t===this.pages.length-1&&this.owner.viewer instanceof re&&-1!==this.owner.viewer.visiblePages.indexOf(this.pages[t])&&(e=!0),this.removePage(this.pages[t]),t--)}e&&this.scrollToBottom()},e.prototype.scrollToBottom=function(){if(this.selection.start.paragraph&&this.selection.start.paragraph.bodyWidget){var e=this.selection.start.paragraph.bodyWidget.page,t=this.visibleBounds.height;this.viewerContainer.scrollTop=e.boundingRectangle.bottom-t}},e.prototype.getFieldResult=function(e,i){if(!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(this.selection)){var n=this.selection.getFieldCode(e).split("*"),r=n[0].replace(/[^\w\s]/gi,"").trim().toLowerCase(),o="";switch(n.length>1&&(o=n[1].replace(/[^\w\s]/gi,"").trim()),r=r.match("numpages")||r.match("sectionpages")||!r.match("page")?r:"page"){case"page":if(i.bodyWidgets[0].sectionFormat.restartPageNumbering&&0!==i.sectionIndex){var s=i.sectionIndex,a=i.previousPage;return s!==a.sectionIndex?(i.currentPageNum=i.bodyWidgets[0].sectionFormat.pageStartingNumber,this.getFieldText(o,i.currentPageNum)):(1===a.currentPageNum&&(a.currentPageNum=i.bodyWidgets[0].sectionFormat.pageStartingNumber),i.currentPageNum=a.currentPageNum+1,this.getFieldText(o,i.currentPageNum))}return i.bodyWidgets[0].sectionFormat.restartPageNumbering&&0===i.sectionIndex?(i.currentPageNum=i.bodyWidgets[0].sectionFormat.pageStartingNumber+i.index,this.getFieldText(o,i.currentPageNum)):(i.currentPageNum=t.isNullOrUndefined(i.previousPage)?i.index+1:i.previousPage.currentPageNum+1,i.currentPageNum=i.index+1,this.getFieldText(o,i.currentPageNum));case"numpages":return this.getFieldText(o,i.documentHelper.pages.length);case"sectionpages":for(var l=i.sectionIndex,d=0,h=0;h<i.documentHelper.pages.length;h++)if(i.documentHelper.pages[h].sectionIndex===l)d++;else if(0!==d)break;return this.getFieldText(o,d)}}return""},e.prototype.getFieldText=function(e,t){switch(e){case"ALPHABETIC":return this.layout.getAsLetter(t).toUpperCase();case"alphabetic":return this.layout.getAsLetter(t).toLowerCase();case"roman":return this.layout.getAsRoman(t).toLowerCase();case"ROMAN":return this.layout.getAsRoman(t).toUpperCase();default:return t.toString()}},e.prototype.destroy=function(){t.isNullOrUndefined(this.owner)||this.unWireEvent(),this.pages=[],this.pages=void 0,this.fieldStacks=[],this.fieldStacks=void 0,this.splittedCellWidgets=[],this.splittedCellWidgets=void 0,this.fields=[],this.fields=void 0,this.layout&&this.layout.destroy(),this.layout=void 0,t.isNullOrUndefined(this.render)||this.render.destroy(),this.render=void 0,this.dialogInternal&&this.dialogInternal.destroy(),this.dialogInternal=void 0,this.dialogInternal2&&(this.dialogInternal2.destroy(),this.dialogInternal2=void 0),this.dialogInternal3&&(this.dialogInternal3.destroy(),this.dialogInternal3=void 0),this.dialogTarget1&&this.dialogTarget1.parentElement&&this.dialogTarget1.parentElement.removeChild(this.dialogTarget1),this.dialogTarget1=void 0,this.dialogTarget2&&this.dialogTarget2.parentElement&&this.dialogTarget2.parentElement.removeChild(this.dialogTarget2),this.dialogTarget2=void 0,this.dialogTarget3&&this.dialogTarget3.parentElement&&this.dialogTarget3.parentElement.removeChild(this.dialogTarget3),this.dialogTarget3=void 0,t.isNullOrUndefined(this.touchStart)||(this.touchStart.innerHTML=""),this.textHelper&&this.textHelper.destroy(),this.textHelper=void 0,this.touchStart=void 0,t.isNullOrUndefined(this.touchEnd)||(this.touchEnd.innerHTML=""),this.touchEnd=void 0,t.isNullOrUndefined(this.containerCanvasIn)||(this.containerCanvasIn.innerHTML=""),this.containerCanvasIn=void 0,t.isNullOrUndefined(this.selectionCanvasIn)||(this.selectionCanvasIn.innerHTML=""),this.selectionCanvasIn=void 0,t.isNullOrUndefined(this.editableDiv)||(this.editableDiv.innerHTML="",this.editableDiv.parentElement.removeChild(this.editableDiv)),this.editableDiv=void 0,t.isNullOrUndefined(this.pageContainer)||(this.pageContainer.innerHTML=""),this.pageContainer=void 0,t.isNullOrUndefined(this.viewerContainer)||(this.viewerContainer.innerHTML=""),this.viewerContainer=void 0,this.owner=void 0,this.heightInfoCollection=void 0},e.prototype.unWireEvent=function(){this.viewerContainer.removeEventListener("scroll",this.scrollHandler),this.viewerContainer.removeEventListener("mousedown",this.onMouseDownInternal),this.viewerContainer.removeEventListener("mousemove",this.onMouseMoveInternal),t.Browser.isDevice?this.editableDiv.removeEventListener("input",this.onTextInputInternal):(this.editableDiv.removeEventListener("keypress",this.onKeyPressInternal),"chrome"===t.Browser.info.name&&this.editableDiv.removeEventListener("textInput",this.onTextInput)),this.editableDiv.removeEventListener("paste",this.onPaste),this.viewerContainer.removeEventListener("contextmenu",this.onContextMenu),this.editableDiv.removeEventListener("blur",this.onFocusOut),this.editableDiv.removeEventListener("keydown",this.onKeyDownInternal),this.editableDiv.removeEventListener("compositionstart",this.compositionStart),this.editableDiv.removeEventListener("compositionupdate",this.compositionUpdated),this.editableDiv.removeEventListener("compositionend",this.compositionEnd),this.viewerContainer.removeEventListener("mouseup",this.onMouseUpInternal),t.isNullOrUndefined(this.iframe)||this.iframe.removeEventListener("load",this.onIframeLoad),this.viewerContainer.removeEventListener("dblclick",this.onDoubleTap),window.removeEventListener("resize",this.onWindowResize),window.removeEventListener("keyup",this.onKeyUpInternal),window.removeEventListener("mouseup",this.onImageResizer.bind(this)),window.removeEventListener("touchend",this.onImageResizer.bind(this))},e.prototype.updateCursor=function(e){var i,n,r,o=void 0,s=void 0,a=this.viewerContainer,l=new O(e.offsetX,e.offsetY),d=this.owner.viewer.findFocusedPage(l,!0),h=this.getLineWidget(d),c=this.owner.isReadOnlyMode?void 0:this.owner.editorModule,p=!!c&&c.tableResize.isInRowResizerArea(d),u=!!c&&c.tableResize.isInCellResizerArea(d),g=this.selection.checkAllFloatingElements(h,d),m="";if(this.owner.enableImageResizerMode){var f=this.owner.imageResizerModule.getImagePoint(d);this.owner.imageResizerModule.selectedResizeElement=f.selectedElement,m=f.resizePosition}var v=0,y=void 0;if(!t.isNullOrUndefined(h)){if(v=this.selection.getLineStartLeft(h),o=this.selection.getHyperLinkFieldInCurrentSelection(h,d),t.isNullOrUndefined(o)&&(y=this.selection.getHyperLinkFieldInCurrentSelection(h,d,!0)),!t.isNullOrUndefined(o)){var b=this.selection.getFieldCode(o);0!==b.toLowerCase().indexOf("ref ")||b.match("\\h")||(o=void 0)}if(i=this.selection.updateTextPositionIn(h,void 0,0,d,!0),n=this.selection.getLeft(h),r=this.selection.getTop(h),t.isNullOrUndefined(o)&&!t.isNullOrUndefined(y)&&this.isDocumentProtected&&"FormFieldsOnly"===this.protectionType&&!this.isFormFilling?this.selection.setHyperlinkContentToToolTip(y,h,d.x,!0):this.selection.setHyperlinkContentToToolTip(o,h,d.x,!1),y){var w=y.formFieldData instanceof Pe&&"Text"===y.formFieldData.type;"Inline"===this.owner.documentEditorSettings.formFieldSettings.formFillingMode&&w&&(y=void 0)}if(this.owner.enableLockAndEdit){var C=!1,x=h.paragraph;x.isInsideTable&&(x=this.layout.getParentTable(x)),x.locked&&x.lockedBy!==this.owner.currentUser&&(C=!0);var F=h.paragraph.bodyWidget.sectionFormat,P=F.pageWidth-F.rightMargin-F.leftMargin;P=W.convertPointToPixel(P)*this.zoomFactor,this.viewer instanceof oe&&(P=(this.visibleBounds.width-5*this.viewer.padding.right)/this.zoomFactor),C&&d.x>=v&&d.x<v+P?this.selection.setLockInfoTooptip(h,d.x,x.lockedBy):this.selection.setLockInfoTooptip(void 0,d.x,"")}}t.isNullOrUndefined(h)||t.isNullOrUndefined(s)&&(s=this.selection.getFootNoteElementInCurrentSelection(h,d))instanceof Ee&&this.selection.setFootnoteContentToToolTip(s,h,d.x);var T=this.isIosDevice?e.metaKey:e.ctrlKey;if(!t.isNullOrUndefined(o)&&(T&&this.owner.useCtrlClickToFollowHyperlink||!this.owner.useCtrlClickToFollowHyperlink)||y)return void(t.isNullOrUndefined(y)?a.style.cursor="pointer":this.isFormFillProtectedMode&&(a.style.cursor="default"));d.x>=v&&e.offsetX<this.visibleBounds.width-(this.visibleBounds.width-this.viewerContainer.clientWidth)&&e.offsetY<this.visibleBounds.height-(this.visibleBounds.height-this.viewerContainer.clientHeight)?this.selection.isEmpty?a.style.cursor="text":a.style.cursor=this.selection.checkCursorIsInSelection(h,d)?"default":"text":a.style.cursor="default",t.isNullOrUndefined(m)||""===m?!t.isNullOrUndefined(i)&&i.isImageSelected&&n<d.x&&r<d.y&&n+h.width>d.x&&r+h.height>d.y&&(a.style.cursor="move"):(!this.owner.imageResizerModule.isShapeResize||this.owner.imageResizerModule.isShapeResize&&"move"!==m)&&(a.style.cursor=m),p?a.style.cursor="row-resize":u&&(a.style.cursor="col-resize"),g.isInShapeBorder&&(a.style.cursor="all-scroll")},e}(),ne=function(){function e(e){this.visiblePages=[],this.padding=new le(10,10,10,10),this.textWrap=!0,this.pageFitTypeIn="None",this.containerTop=0,this.containerLeft=0,this.owner=e}return Object.defineProperty(e.prototype,"documentHelper",{get:function(){return this.owner.documentHelper},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageFitType",{get:function(){return this.pageFitTypeIn},set:function(e){this.pageFitTypeIn=e,this.onPageFitTypeChanged(this.pageFitTypeIn)},enumerable:!0,configurable:!0}),e.prototype.updateClientArea=function(e,i,n){var r=0,o=0;if(this instanceof oe){(r=(this.documentHelper.visibleBounds.width-4*this.padding.right-2*this.padding.left)/this.documentHelper.zoomFactor)<0&&(r=0),o=Number.POSITIVE_INFINITY,this.clientArea=new ae(this.padding.left/this.documentHelper.zoomFactor,0,r,o),this.clientActiveArea=new ae(this.clientArea.x,this.clientArea.y,this.clientArea.width,this.clientArea.height)}else{var s=0,a=48,l=48,d=W.convertPointToPixel(e.pageHeight),h=W.convertPointToPixel(e.bottomMargin);t.isNullOrUndefined(e)||(s=W.convertPointToPixel(e.topMargin),a=W.convertPointToPixel(e.headerDistance),l=W.convertPointToPixel(e.footerDistance));var c=!1;t.isNullOrUndefined(i.headerWidget)||(!(c=i.headerWidget.isEmpty)||c&&this.owner.enableHeaderAndFooter)&&(s=Math.min(Math.max(a+i.headerWidget.height,s),d/100*40));var p=.667+h;if(!t.isNullOrUndefined(i.footerWidget)){c=i.footerWidget.isEmpty;var u=t.isNullOrUndefined(i.footnoteWidget)?0:i.footnoteWidget.height;(!c||c&&this.owner.enableHeaderAndFooter)&&(p=.667+Math.min(d/100*40,Math.max(l+i.footerWidget.height+u,h)))}t.isNullOrUndefined(e)||(r=W.convertPointToPixel(e.pageWidth-e.leftMargin-e.rightMargin),o=d-s-p),r<0&&(r=0),this.clientArea=new ae(W.convertPointToPixel(e.leftMargin),s,r,d-s-p),n&&i.footnoteWidget&&(this.clientArea.height-=i.footnoteWidget.height),this.clientActiveArea=new ae(this.clientArea.x,this.clientArea.y,this.clientArea.width,this.clientArea.height)}},e.prototype.updateClientAreaTopOrLeft=function(e,t){t&&(this.clientActiveArea.y=this.clientActiveArea.y+e.topBorderWidth,this.clientActiveArea.x=this.clientActiveArea.x+e.leftBorderWidth)},e.prototype.updateClientAreaForTable=function(e){this.clientActiveArea.x=this.clientArea.x=e.x,this.clientActiveArea.width=this.clientArea.width=e.width},e.prototype.updateClientAreaForRow=function(e,t){var i=e.ownerTable;t||(this.clientActiveArea.x=this.clientArea.x=i.x,this.clientActiveArea.width=this.clientArea.width=i.width,this.clientArea=new ae(this.clientArea.x,this.clientArea.y,this.clientArea.width,this.clientArea.height),this.clientActiveArea=new ae(this.clientActiveArea.x,this.clientActiveArea.y,this.clientActiveArea.width,this.clientActiveArea.height-this.documentHelper.layout.footnoteHeight))},e.prototype.updateClientAreaForCell=function(e,t){var i=e.ownerRow,n=e;t?(this.clientActiveArea.x=this.clientArea.x=n.x,this.clientActiveArea.y=n.y,this.clientActiveArea.width=this.clientArea.width=n.width>0?n.width:0,this instanceof re&&(this.clientActiveArea.height=Number.POSITIVE_INFINITY),this.clientArea=new ae(this.clientArea.x,this.clientArea.y,this.clientArea.width,this.clientArea.height),this.clientActiveArea=new ae(this.clientActiveArea.x,this.clientActiveArea.y,this.clientActiveArea.width,this.clientActiveArea.height)):(this.clientActiveArea.x=this.clientArea.x=n.x+n.width+n.margin.right,i.x+i.width-this.clientArea.x<0?this.clientActiveArea.width=this.clientArea.width=0:this.clientActiveArea.width=this.clientArea.width=i.x+i.width-this.clientArea.x,this.clientActiveArea.y=n.y-n.margin.top-W.convertPointToPixel(e.ownerTable.tableFormat.cellSpacing),e.ownerTable.isInsideTable||(this.clientActiveArea.height=this.clientArea.bottom-i.y>0?this.clientArea.bottom-i.y:0),this.clientArea=new ae(this.clientArea.x,this.clientArea.y,this.clientArea.width,this.clientArea.height),this.clientActiveArea=new ae(this.clientActiveArea.x,this.clientActiveArea.y,this.clientActiveArea.width,this.clientActiveArea.height))},e.prototype.updateClientAreaForTextBoxShape=function(e,t){if(t){var i=W.convertPointToPixel(e.textFrame.marginLeft),n=W.convertPointToPixel(e.textFrame.marginRight),r=W.convertPointToPixel(e.textFrame.marginTop),o=W.convertPointToPixel(e.textFrame.marginBottom),s=e.width,a=Number.POSITIVE_INFINITY;this.clientArea=new ae(e.x+i,e.y+r,s-i-n,a-r-o),this.clientActiveArea=new ae(this.clientArea.x,this.clientArea.y,this.clientArea.width,this.clientArea.height)}},e.prototype.updateClientAreaByWidgetFootNote=function(e){this.clientArea.x=e.x,this.clientArea.y=e.y,this.clientActiveArea.x=e.x,this.clientActiveArea.y=e.y},e.prototype.updateClientAreaForTextWrap=function(e){this.clientActiveArea=new ae(e.x,e.y,e.width,e.height)},e.prototype.updateClientAreaByWidget=function(e){this.clientArea.x=e.x,this.clientArea.y=e.y,this.clientActiveArea.x=e.x,this.clientActiveArea.y=e.y},e.prototype.updateClientAreaLocation=function(e,t){e.x=t.x,e.y=t.y,e.width=t.width},e.prototype.updateClientAreaForBlock=function(e,i,n){var r=W.convertPointToPixel(e.leftIndent),o=W.convertPointToPixel(e.rightIndent),s=e.bidi,a=0;if(i)if(e instanceof ve&&n){var l=n[0];this.clientActiveArea.x=this.clientArea.x=l.x,this.clientActiveArea.width=this.clientArea.width=l.width,(l=n[n.length-1]).x=this.clientActiveArea.x,l.y=this.clientActiveArea.y}else{if(e instanceof ve&&!t.isNullOrUndefined(e.tableFormat)&&(e.isGridUpdated||(e.buildTableColumns(),e.isGridUpdated=!0),"Left"!==(h=this.tableAlignmentForBidi(e,s)))){var d=0;d=0===(d=W.convertPointToPixel(e.tableHolder.getTotalWidth(0)))?0===e.tableHolder.tableWidth?e.getTableClientWidth(e.getOwnerWidth(!1)):e.tableHolder.tableWidth:d,this.owner.editor&&this.owner.editor.tableResize.currentResizingTable===e&&0===this.owner.editor.tableResize.resizerPosition&&(d=W.convertPointToPixel(e.tableHolder.tableWidth)),r="Center"===h?(this.clientArea.width-d)/2:this.clientArea.width-d,s&&(o=r-=W.convertPointToPixel(e.leftIndent)),e.isInsideTable,this.documentHelper.tableLefts.push(r)}a=this.clientArea.width-(r+W.convertPointToPixel(e.rightIndent)),this.clientActiveArea.x=this.clientArea.x=this.clientArea.x+(s?o:r),this.clientActiveArea.width=this.clientArea.width=a>0?a:0}else{if(e instanceof ve&&!t.isNullOrUndefined(e.tableFormat)){var h=this.tableAlignmentForBidi(e,s);e.isGridUpdated||(e.buildTableColumns(),e.isGridUpdated=!0),"Left"!==h&&this.documentHelper.tableLefts.length>0&&(r=this.documentHelper.tableLefts.pop(),s&&(o=r))}a=this.clientArea.width+r+W.convertPointToPixel(e.rightIndent),this.clientActiveArea.width=this.clientArea.width=a>0?a:0,this.clientActiveArea.x=this.clientArea.x=this.clientArea.x-(s?o:r)}this.clientArea=new ae(this.clientArea.x,this.clientArea.y,this.clientArea.width,this.clientArea.height),this.clientActiveArea=new ae(this.clientActiveArea.x,this.clientActiveArea.y,this.clientActiveArea.width,this.clientActiveArea.height)},e.prototype.tableAlignmentForBidi=function(e,t){var i=e.tableFormat.tableAlignment;return t&&("Left"===i?i="Right":"Right"===i&&(i="Left")),i},e.prototype.cutFromLeft=function(e){e<this.clientActiveArea.x&&(e=this.clientActiveArea.x),e>this.clientActiveArea.right&&this.textWrap&&(e=this.clientActiveArea.right),this.clientActiveArea.width=this.clientActiveArea.right>e?this.clientActiveArea.right-e:0,this.clientActiveArea.x=e},e.prototype.cutFromTop=function(e){e<this.clientActiveArea.y&&(e=this.clientActiveArea.y),e>this.clientActiveArea.bottom&&(e=this.clientActiveArea.bottom),this.clientActiveArea.height=this.clientActiveArea.bottom-e,this.clientActiveArea.x=this.clientArea.x,this.clientActiveArea.width=this.clientArea.width,this.clientActiveArea.y=e},e.prototype.updateClientWidth=function(e){this.clientActiveArea.x-=e,this.clientActiveArea.width+e>0?this.clientActiveArea.width+=e:this.clientActiveArea.width=0},e.prototype.findFocusedPage=function(e,t){var i=new O(e.x,e.y);i.x+=this.documentHelper.viewerContainer.scrollLeft,i.y+=this.documentHelper.viewerContainer.scrollTop;for(var n=0;n<this.documentHelper.pages.length;n++){var r=this.documentHelper.pages[n],o=(r.boundingRectangle.y-this.pageGap*(n+1))*this.documentHelper.zoomFactor+this.pageGap*(n+1),s=r.boundingRectangle.height*this.documentHelper.zoomFactor+this.pageGap,a=r.boundingRectangle.x,l=void 0;if(l=this instanceof re?(r.boundingRectangle.right-a)*this.documentHelper.zoomFactor+a:r.boundingRectangle.right+a,o<=i.y&&o+s>=i.y)return t&&(this.documentHelper.currentPage=r),i.y=(i.y-o)/this.documentHelper.zoomFactor,i.x>l?i.x=r.boundingRectangle.right:i.x<a?i.x=0:i.x=(i.x-a)/this.documentHelper.zoomFactor,i}return i},e.prototype.getPageHeightAndWidth=function(e,t,i,n){e=0;for(r=0;r<this.documentHelper.pages.length;r++)e+=this.documentHelper.pages[r].boundingRectangle.height;t=0;for(var r=0;r<this.documentHelper.pages.length;r++)t<this.documentHelper.pages[r].boundingRectangle.width&&(t=this.documentHelper.pages[r].boundingRectangle.width);return i=this.documentHelper.visibleBounds.width,n=this.documentHelper.visibleBounds.height,{height:e,width:t,viewerWidth:i,viewerHeight:n}},e.prototype.renderVisiblePages=function(){if(!(t.isNullOrUndefined(this.visiblePages)||this.visiblePages.length<1)){this.documentHelper.clearContent();for(var e=0;e<this.visiblePages.length;e++){var i=this.visiblePages[e],n=i.boundingRectangle.width*this.documentHelper.zoomFactor,r=i.boundingRectangle.height*this.documentHelper.zoomFactor,o=i.boundingRectangle.x,s=(i.boundingRectangle.y-this.pageGap*(e+1))*this.documentHelper.zoomFactor+this.pageGap*(e+1);this.owner.viewer.renderPage(i,o,s,n,r)}}},e.prototype.handleZoom=function(){var e=this.documentHelper.preZoomFactor,i=null,n=0,r=!1;if(this.documentHelper.selection&&t.isNullOrUndefined(this.documentHelper.zoomX&&t.isNullOrUndefined(this.documentHelper.zoomY))){var o=0,s=0,a=this.documentHelper.selection.getPage(this.documentHelper.selection.end.currentWidget.paragraph);(o=(this.documentHelper.visibleBounds.width-a.boundingRectangle.width*e)/2)<30&&(o=30),s=a.boundingRectangle.y*e+(this.documentHelper.pages.indexOf(a)+1)*this.pageGap*(1-e);var l=this.documentHelper.selection.updateCaretSize(this.owner.selection.end,!0),d=l.topMargin;l.height;o+=this.documentHelper.selection.end.location.x*e,s+=(this.documentHelper.selection.end.location.y+d)*e,o>=this.containerLeft&&o<=this.documentHelper.visibleBounds.width&&s>=this.containerTop&&s<=this.containerTop+this.documentHelper.visibleBounds.height&&(r=!0)}for(c=0;c<this.documentHelper.pages.length;c++)n+=this.documentHelper.pages[c].boundingRectangle.height;for(var h=0,c=0;c<this.documentHelper.pages.length;c++)h<this.documentHelper.pages[c].boundingRectangle.width&&(h=this.documentHelper.pages[c].boundingRectangle.width);var p=n*this.documentHelper.zoomFactor+(this.documentHelper.pages.length+1)*this.pageGap*(1-this.documentHelper.zoomFactor)-this.documentHelper.visibleBounds.height,u=h*this.documentHelper.zoomFactor-this.documentHelper.visibleBounds.width;if(this.documentHelper.visibleBounds.width-h*this.documentHelper.zoomFactor<60&&(u+=60),p>0){y=this.containerTop;if(this.visiblePages.length>0){var g=((i=this.visiblePages[0]).boundingRectangle.y-(i.index+1)*this.pageGap)*e+(i.index+1)*this.pageGap,m=this.documentHelper.zoomY;t.isNullOrUndefined&&(m=this.documentHelper.visibleBounds.height/2);for(var f=y+m;f>g+i.boundingRectangle.height*e;){var v=i.index+1;if(v===this.documentHelper.pages.length)break;g=((i=this.documentHelper.pages[v]).boundingRectangle.y-(i.index+1)*this.pageGap)*e+(i.index+1)*this.pageGap}y=(i.boundingRectangle.y-(i.index+1)*this.pageGap)*this.documentHelper.zoomFactor+(i.index+1)*this.pageGap+(f-g<0?f-g:(f-g)*(this.documentHelper.zoomFactor/e))-m,m=this.documentHelper.visibleBounds.height/2}this.documentHelper.viewerContainer.scrollTop=y}else this.documentHelper.viewerContainer.scrollTop=0;if(u>0){var y=this.containerLeft;if(this.visiblePages.length>0){null===i&&(i=this.visiblePages[0]);var b=this.documentHelper.zoomX;t.isNullOrUndefined(b)&&(b=this.documentHelper.visibleBounds.width/2);var w=i.boundingRectangle.width*e/i.boundingRectangle.width,C=y+b;y=i.boundingRectangle.x+(C-i.boundingRectangle.x<0?C-i.boundingRectangle.x:(C-i.boundingRectangle.x)*(this.documentHelper.zoomFactor/w))-b,b=this.documentHelper.visibleBounds.width/2}this.documentHelper.viewerContainer.scrollLeft=y}else this.documentHelper.viewerContainer.scrollLeft=0;this.updateScrollBars(),r&&this.documentHelper.scrollToPosition(this.documentHelper.selection.start,this.documentHelper.selection.end),this instanceof oe&&this.owner.editorModule.layoutWholeDocument()},e.prototype.updateCanvasWidthAndHeight=function(e,t,i,n,r,o){this instanceof re?this.documentHelper.visibleBounds.width!==this.documentHelper.viewerContainer.clientWidth?e-=this.documentHelper.visibleBounds.width-this.documentHelper.viewerContainer.clientWidth:i>t&&(e-=this.documentHelper.viewerContainer.offsetWidth-this.documentHelper.viewerContainer.clientWidth):i>t&&(e-=this.documentHelper.scrollbarWidth,n-=this.documentHelper.scrollbarWidth),n>e&&(t-=this.documentHelper.scrollbarWidth),r=n>e?n:e,o=i>t?i:t,parseInt(this.documentHelper.pageContainer.style.width.replace("px",""),10)===r&&parseInt(this.documentHelper.pageContainer.style.height.replace("px",""),10)===r||(this.documentHelper.pageContainer.style.width=r.toString()+"px",this.documentHelper.pageContainer.style.height=o.toString()+"px");var s=Math.max(1,window.devicePixelRatio||1);return this.documentHelper.containerCanvas.width===Math.floor(e*s)&&this.documentHelper.containerCanvas.height===Math.floor(t*s)||(this.documentHelper.containerCanvas.width=e*s,this.documentHelper.containerCanvas.height=t*s,this.documentHelper.containerCanvas.style.width=e+"px",this.documentHelper.containerCanvas.style.height=t+"px",this.documentHelper.containerContext.scale(s,s),this.documentHelper.selectionCanvas.width=e*s,this.documentHelper.selectionCanvas.height=t*s,this.documentHelper.selectionCanvas.style.width=e+"px",this.documentHelper.selectionCanvas.style.height=t+"px",this.documentHelper.selectionContext.scale(s,s)),{height:o,width:r,viewerWidth:e,viewerHeight:t,containerHeight:i,containerWidth:n}},e.prototype.updateScrollBarPosition=function(e,t,i,n,r,o){this.owner.viewer.containerTop=this.documentHelper.viewerContainer.scrollTop,this.documentHelper.containerCanvas.style.position="absolute",this.documentHelper.containerCanvas.style.top=this.owner.viewer.containerTop.toString()+"px",this.documentHelper.selectionCanvas.style.position="absolute",this.documentHelper.selectionCanvas.style.top=this.owner.viewer.containerTop.toString()+"px",this.owner.viewer.containerLeft=this.documentHelper.viewerContainer.scrollLeft,this.documentHelper.containerCanvas.style.left=this.owner.viewer.containerLeft+"px",this.documentHelper.selectionCanvas.style.left=this.owner.viewer.containerLeft+"px"},e.prototype.destroy=function(){this.clientArea=void 0,this.clientActiveArea=void 0},e}(),re=function(e){function i(t){var i=e.call(this,t)||this;return i.pageLeft=30,i.owner=t,i}return te(i,e),Object.defineProperty(i.prototype,"pageGap",{get:function(){return this.owner.pageGap},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"documentHelper",{get:function(){return this.owner.documentHelper},enumerable:!0,configurable:!0}),i.prototype.createNewPage=function(e,i){var n=this,r=this.pageGap;this.documentHelper.pages.length>0&&(r=this.documentHelper.pages[this.documentHelper.pages.length-1].boundingRectangle.bottom+this.pageGap);var o=new gt(this.documentHelper);return this.updatePageBoundingRectangle(e,o,r),t.isNullOrUndefined(i)?this.documentHelper.pages.push(o):this.documentHelper.pages.splice(i,0,o),this.updateClientArea(e.sectionFormat,o),o.bodyWidgets.push(e),o.bodyWidgets[o.bodyWidgets.length-1].page=o,this.documentHelper.layout.layoutHeaderFooter(e,n,o),this.updateClientArea(e.sectionFormat,o),o},i.prototype.updatePageBoundingRectangle=function(e,i,n){var r=t.isNullOrUndefined(e.sectionFormat)?816:W.convertPointToPixel(e.sectionFormat.pageWidth),o=t.isNullOrUndefined(e.sectionFormat)?1056:W.convertPointToPixel(e.sectionFormat.pageHeight),s=(this.documentHelper.visibleBounds.width-r*this.documentHelper.zoomFactor)/2;s<this.pageLeft&&(s=this.pageLeft),i.boundingRectangle=new ae(s,n,r,o)},i.prototype.onPageFitTypeChanged=function(e){var i=this.documentHelper.visibleBounds.width,n=this.documentHelper.visibleBounds.height,r=this.visiblePages[0].bodyWidgets[0],o=W.convertPointToPixel(r.sectionFormat.pageWidth),s=W.convertPointToPixel(r.sectionFormat.pageHeight);switch(e){case"FitOnePage":if(n>0&&s>0){var a=(this.documentHelper.visibleBounds.height-2*this.pageGap-(this.pageGap-2))/s;a===this.documentHelper.zoomFactor?t.isNullOrUndefined(this.owner.selection)||t.isNullOrUndefined(this.owner.selection.start)||t.isNullOrUndefined(this.owner.selection.end)||this.documentHelper.scrollToPosition(this.owner.selection.start,this.owner.selection.end):this.documentHelper.zoomFactor=a}break;case"FitPageWidth":i>0&&o>0&&(this.documentHelper.zoomFactor=(this.documentHelper.visibleBounds.width-80)/o);break;default:this.documentHelper.zoomFactor=1}},i.prototype.getCurrentPageHeaderFooter=function(e,t){return this.getCurrentHeaderFooter(this.getHeaderFooterType(e,t),e.index)},i.prototype.getHeaderFooterType=function(e,i){var n;n=i?"OddHeader":"OddFooter";var r=e.page;return e.sectionFormat.differentFirstPage&&(t.isNullOrUndefined(r.previousPage)||r.sectionIndex!==r.previousPage.sectionIndex)?n=i?"FirstPageHeader":"FirstPageFooter":e.sectionFormat.differentOddAndEvenPages&&this.documentHelper.pages.length%2==0&&(n=i?"EvenHeader":"EvenFooter"),n},i.prototype.getCurrentHeaderFooter=function(e,t){if(this.documentHelper.headersFooters[t]){var i=this.getHeaderFooter(e),n=this.documentHelper.headersFooters[t][i];if(!n){for(var r=t>0?t-1:t;!n&&-1!==r&&this.documentHelper.headersFooters[r][i];)n=this.documentHelper.headersFooters[r][i],r--;n||((n=this.createHeaderFooterWidget(e)).isEmpty=!0),this.documentHelper.headersFooters[t][i]=n}return n}if(t>0)return this.getCurrentHeaderFooter(e,t-1)},i.prototype.createHeaderFooterWidget=function(e){var t=new ue(e),i=new fe;return i.childWidgets.push(new we(i)),t},i.prototype.getHeaderFooter=function(e){switch(e){case"OddHeader":return 0;case"OddFooter":return 1;case"EvenHeader":return 2;case"EvenFooter":return 3;case"FirstPageHeader":return 4;case"FirstPageFooter":return 5}},i.prototype.updateHFClientArea=function(e,t){var i=W.convertPointToPixel(e.pageWidth-e.leftMargin-e.rightMargin);i<0&&(i=0),this.clientArea=t?new ae(W.convertPointToPixel(e.leftMargin),W.convertPointToPixel(e.headerDistance),i,Number.POSITIVE_INFINITY):new ae(W.convertPointToPixel(e.leftMargin),W.convertPointToPixel(e.pageHeight-e.footerDistance),i,Number.POSITIVE_INFINITY),this.clientActiveArea=new ae(this.clientArea.x,this.clientArea.y,this.clientArea.width,this.clientArea.height)},i.prototype.updateHeaderFooterClientAreaWithTop=function(e,t,i){this.updateHFClientArea(e,t),t||i.footerWidget.y<this.clientActiveArea.y&&(this.clientActiveArea.y=i.footerWidget.y,this.clientActiveArea.height=Number.POSITIVE_INFINITY)},i.prototype.updateFootnoteClientArea=function(e,t,i,n){var r=W.convertPointToPixel(e.pageWidth-e.leftMargin-e.rightMargin);this.clientArea=new ae(W.convertPointToPixel(e.leftMargin),W.convertPointToPixel(e.pageHeight-e.bottomMargin)-t.height,r,t.height),this.clientActiveArea=new ae(this.clientArea.x,this.clientArea.y,this.clientArea.width,t.height)},i.prototype.scrollToPage=function(e){for(var t=0,i=0;i<this.documentHelper.pages.length&&(t=this.documentHelper.pages[i].boundingRectangle.y-this.pageGap/2,i!==e);i++);this.documentHelper.viewerContainer.scrollTop=t,this.updateScrollBars()},i.prototype.updateScrollBars=function(){var e,t,i=(e=this.getPageHeightAndWidth(0,0,0,0)).width*this.documentHelper.zoomFactor+2*this.pageLeft,n=e.height*this.documentHelper.zoomFactor+(this.documentHelper.pages.length+1)*this.pageGap;n=(t=this.updateCanvasWidthAndHeight(e.viewerWidth,e.viewerHeight,n,i,e.width,e.height)).containerHeight,i=t.containerWidth,this.documentHelper.containerContext.globalAlpha=1,this.documentHelper.selectionContext.globalAlpha=.4;for(var r=0;r<this.documentHelper.pages.length;r++){var o=(t.width-this.documentHelper.pages[r].boundingRectangle.width*this.documentHelper.zoomFactor)/2;o>this.pageLeft?this.documentHelper.pages[r].boundingRectangle=new ae(o,this.documentHelper.pages[r].boundingRectangle.y,this.documentHelper.pages[r].boundingRectangle.width,this.documentHelper.pages[r].boundingRectangle.height):this.documentHelper.pages[r].boundingRectangle=new ae(this.pageLeft,this.documentHelper.pages[r].boundingRectangle.y,this.documentHelper.pages[r].boundingRectangle.width,this.documentHelper.pages[r].boundingRectangle.height)}this.updateScrollBarPosition(i,n,t.viewerWidth,t.viewerHeight,t.width,t.height),this.updateVisiblePages(),this.documentHelper.isScrollToSpellCheck=!1},i.prototype.updateVisiblePages=function(){this.visiblePages=[];for(var e=this.documentHelper.visibleBounds.height,t=this.documentHelper.viewerContainer.scrollTop,i=0;i<this.documentHelper.pages.length;i++){var n=this.documentHelper.pages[i],r=(n.boundingRectangle.y-this.pageGap*(i+1))*this.documentHelper.zoomFactor+this.pageGap*(i+1),o=n.boundingRectangle.height*this.documentHelper.zoomFactor,s=n.boundingRectangle.x,a=r>=t&&r<=t+e,l=r+o>=t&&r+o<=t+e,d=r<=t&&r+o>=t+e;(a||l||d)&&this.addVisiblePage(n,s,r)}},i.prototype.addVisiblePage=function(e,t,i){var n=this,r=e.boundingRectangle.width*this.documentHelper.zoomFactor,o=e.boundingRectangle.height*this.documentHelper.zoomFactor;if(this.owner.enableImageResizerMode&&void 0!==this.owner.imageResizerModule.currentPage&&this.owner.imageResizerModule.currentPage===e&&this.owner.imageResizerModule.isImageResizerVisible&&this.owner.imageResizerModule.setImageResizerPositions(t,i,r,o),this.visiblePages.push(e),this.owner.isSpellCheck&&this.owner.spellChecker.enableOptimizedSpellCheck&&(this.documentHelper.triggerElementsOnLoading||this.documentHelper.isScrollHandler)&&this.documentHelper.cachedPages.indexOf(e.index)<0){e.allowNextPageRendering=!1,this.documentHelper.cachedPages.push(e.index);var s=this.owner.spellChecker.getPageContent(e);s.trim().length>0?this.owner.spellChecker.callSpellChecker(this.owner.spellChecker.languageID,s,!0,!1,!1,!0).then(function(s){var a=JSON.parse(s);n.owner.spellChecker.updateUniqueWords(a.SpellCollection),e.allowNextPageRendering=!0,n.documentHelper.triggerSpellCheck=!0,n.renderPage(e,t,i,r,o),n.documentHelper.triggerSpellCheck=!1,n.documentHelper.triggerElementsOnLoading=!1}):this.renderPage(e,t,i,r,o)}else this.renderPage(e,t,i,r,o)},i.prototype.renderPage=function(e,t,i,n,r){this.documentHelper.render.renderWidgets(e,t-this.owner.viewer.containerLeft,i-this.owner.viewer.containerTop,n,r)},i}(ne),oe=function(e){function t(t){var i=e.call(this,t)||this;return i.visiblePages=[],i.owner=t,i}return te(t,e),Object.defineProperty(t.prototype,"documentHelper",{get:function(){return this.owner.documentHelper},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"pageGap",{get:function(){return 0},enumerable:!0,configurable:!0}),t.prototype.createNewPage=function(e,t){var i,n=0;return this.documentHelper.pages.length>0&&(n=this.documentHelper.pages[this.documentHelper.pages.length-1].boundingRectangle.bottom),i=new gt(this.documentHelper),0===this.documentHelper.pages.length?i.boundingRectangle=new ae(10,n,this.documentHelper.visibleBounds.width,this.documentHelper.visibleBounds.height):i.boundingRectangle=new ae(10,n-20,this.documentHelper.visibleBounds.width,this.documentHelper.visibleBounds.height),this.documentHelper.pages.push(i),this.updateClientArea(void 0,i),i.bodyWidgets.push(e),i.bodyWidgets[i.bodyWidgets.length-1].page=i,i},t.prototype.onPageFitTypeChanged=function(e){this.documentHelper.zoomFactor=1},t.prototype.scrollToPage=function(e){this.updateScrollBars()},t.prototype.getContentHeight=function(){for(var e=0,t=0;t<this.documentHelper.pages.length;t++){var i=this.documentHelper.pages[t];0===t?(e+=this.padding.top,i.boundingRectangle.y=this.padding.top):i.boundingRectangle.y=this.documentHelper.pages[t-1].boundingRectangle.bottom,i.boundingRectangle.height=i.bodyWidgets[0].height,e+=i.bodyWidgets[0].height,t===this.documentHelper.pages.length-1&&(e+=this.padding.bottom)}return e},t.prototype.getContentWidth=function(){for(var e=this.documentHelper.visibleBounds.width,t=e,i=0;i<this.documentHelper.pages.length;i++){for(var n=this.documentHelper.pages[i],r=0;r<n.bodyWidgets[0].childWidgets.length;r++)if(n.bodyWidgets[0].childWidgets[r]instanceof ve){var o=n.bodyWidgets[0].childWidgets[r],s=W.convertPointToPixel(o.getTableWidth())*this.documentHelper.zoomFactor+4*this.padding.left+4*this.padding.right+n.boundingRectangle.x;t<s&&(e=s,t=s)}n.boundingRectangle.width=e}return e},t.prototype.updateScrollBars=function(){var e;e=this.getPageHeightAndWidth(0,0,0,0);var t,i=this.getContentWidth()*this.documentHelper.zoomFactor+this.padding.left+this.padding.right,n=this.getContentHeight()*this.documentHelper.zoomFactor+this.padding.top+this.padding.bottom;t=this.updateCanvasWidthAndHeight(e.viewerWidth,e.viewerHeight,n,i,e.width,e.height),this.documentHelper.containerContext.globalAlpha=1,this.documentHelper.selectionContext.globalAlpha=.4,this.updateScrollBarPosition(i,n,t.viewerWidth,t.viewerHeight,t.width,t.height),this.updateVisiblePages(),this.documentHelper.isScrollToSpellCheck=!1},t.prototype.updateVisiblePages=function(){this.visiblePages=[];for(var e,t,i=this.documentHelper.visibleBounds.height,n=this.documentHelper.viewerContainer.scrollTop,r=0;r<this.documentHelper.pages.length;r++){t=(e=this.documentHelper.pages[r]).boundingRectangle.y*this.documentHelper.zoomFactor;var o=e.boundingRectangle.height*this.documentHelper.zoomFactor,s=t>=n&&t<=n+i,a=t+o>=n&&t+o<=n+i,l=t<=n&&t+o>=n+i;(s||a||l)&&this.addVisiblePage(e,this.padding.left,t)}},t.prototype.addVisiblePage=function(e,t,i){var n=this,r=this.getContentWidth(),o=this.getContentHeight()*this.documentHelper.zoomFactor+this.padding.top+this.padding.bottom;if(this.owner.enableImageResizerMode&&void 0!==this.owner.imageResizerModule.currentPage&&this.owner.imageResizerModule.currentPage===e&&this.owner.imageResizerModule.isImageResizerVisible&&this.owner.imageResizerModule.setImageResizerPositions(t,i,r,o),this.visiblePages.push(e),this.documentHelper.owner.isSpellCheck&&this.documentHelper.owner.spellChecker.enableOptimizedSpellCheck&&(this.owner.documentHelper.triggerElementsOnLoading||this.owner.documentHelper.isScrollHandler)&&this.documentHelper.cachedPages.indexOf(e.index)<0){e.allowNextPageRendering=!1,this.owner.documentHelper.cachedPages.push(e.index);var s=this.documentHelper.owner.spellChecker.getPageContent(e);s.trim().length>0?this.owner.spellChecker.callSpellChecker(this.owner.spellChecker.languageID,s,!0,!1,!1,!0).then(function(s){var a=JSON.parse(s);n.owner.spellChecker.updateUniqueWords(a.SpellCollection),e.allowNextPageRendering=!0,n.owner.documentHelper.triggerSpellCheck=!0,n.renderPage(e,t,i,r,o),n.owner.documentHelper.triggerSpellCheck=!1,n.owner.documentHelper.triggerElementsOnLoading=!1}):this.renderPage(e,t,i,r,o)}else this.renderPage(e,t,i,r,o)},t.prototype.renderPage=function(e,t,i,n,r){this.documentHelper.render.renderWidgets(e,t-this.owner.viewer.containerLeft,i-this.owner.viewer.containerTop,n,r)},t}(ne),se=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ae=function(){function e(e,t,i,n){this.x=e,this.y=t,this.width=i,this.height=n}return Object.defineProperty(e.prototype,"right",{get:function(){return this.x+this.width},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bottom",{get:function(){return this.y+this.height},enumerable:!0,configurable:!0}),e.prototype.isIntersecting=function(e){return!(e.y>this.bottom||this.y>e.bottom||e.x>this.right||this.x>e.right)},e}(),le=function(){function e(e,t,i,n){this.right=10,this.left=10,this.top=10,this.bottom=10,this.right=e,this.left=t,this.top=i,this.bottom=n}return e}(),de=function(){function e(e,t,i,n){this.left=e,this.top=t,this.right=i,this.bottom=n}return e.prototype.clone=function(){return new e(this.left,this.top,this.right,this.bottom)},e.prototype.destroy=function(){this.left=void 0,this.right=void 0,this.top=void 0,this.bottom=void 0},e}(),he=function(){function e(){this.childWidgets=[],this.x=0,this.y=0,this.width=0,this.height=0,this.index=0}return Object.defineProperty(e.prototype,"indexInOwner",{get:function(){return this instanceof pe&&this.page?this.page.bodyWidgets.indexOf(this):this.containerWidget&&this.containerWidget.childWidgets?this.containerWidget.childWidgets.indexOf(this):this instanceof me?0:-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstChild",{get:function(){return this.childWidgets.length>0?this.childWidgets[0]:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lastChild",{get:function(){if(this.childWidgets)return this.childWidgets.length>0?this.childWidgets[this.childWidgets.length-1]:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousWidget",{get:function(){var e=this,t=this.indexInOwner;return e=e instanceof pe?t>0?e.page.bodyWidgets[t-1]:void 0:t>0?e.containerWidget.childWidgets[t-1]:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextWidget",{get:function(){var e=this,t=this.indexInOwner;if(-1!==t)return e=e instanceof pe?t<e.page.bodyWidgets.length-1?e.page.bodyWidgets[t+1]:void 0:t<e.containerWidget.childWidgets.length-1?e.containerWidget.childWidgets[t+1]:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousRenderedWidget",{get:function(){var e=this,i=this.indexInOwner;if(!(i<0)){if(e instanceof pe)e=i>0?e.page.bodyWidgets[i-1]:(n=e.page.previousPage)&&n.bodyWidgets.length>0?n.bodyWidgets[n.bodyWidgets.length-1]:void 0;else if(e instanceof me)for(var n=e.page;n.previousPage&&(n=n.previousPage,e=n.footnoteWidget,t.isNullOrUndefined(e)););else if(i>0)e=e.containerWidget.childWidgets[i-1];else{var r=void 0;for(e.containerWidget instanceof be?r=e.containerWidget.getPreviousSplitWidget():e.containerWidget instanceof ye||e.containerWidget instanceof ue||(r=e.containerWidget.previousRenderedWidget);r&&0===r.childWidgets.length&&(r=r.previousRenderedWidget,!t.isNullOrUndefined(r)););e=r&&r.constructor===e.containerWidget.constructor?r.lastChild:void 0}return e}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextRenderedWidget",{get:function(){var e=this,i=this.indexInOwner;if(!(i<0)){if(e instanceof pe)e=i<e.page.bodyWidgets.length-1?e.page.bodyWidgets[i+1]:e.page.allowNextPageRendering&&(n=e.page.nextPage)&&n.bodyWidgets.length>0?n.bodyWidgets[0]:void 0;else if(e instanceof me)for(var n=e.page;n.allowNextPageRendering&&n.nextPage&&(n=n.nextPage,e=n.footnoteWidget,t.isNullOrUndefined(e)););else if(i<e.containerWidget.childWidgets.length-1)e=e.containerWidget.childWidgets[i+1];else{var r=void 0;for(e.containerWidget instanceof be?r=e.containerWidget.getNextSplitWidget():e.containerWidget instanceof ye||e.containerWidget instanceof ue||e.containerWidget instanceof me||(r=e.containerWidget.nextRenderedWidget);r&&0===r.childWidgets.length&&!(r instanceof be)&&(r=r.nextRenderedWidget,!t.isNullOrUndefined(r)););e=r&&r.constructor===e.containerWidget.constructor?r.firstChild:void 0}return e}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousSplitWidget",{get:function(){var e=this;if(e instanceof be)return e.getPreviousSplitWidget();var t=e.previousRenderedWidget;return e instanceof pe&&t instanceof pe&&e.equals(t)?t:t instanceof ge&&e.index===t.index&&e.equals(t)?t:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextSplitWidget",{get:function(){var e=this;if(e instanceof be)return e.getNextSplitWidget();var t=e.nextRenderedWidget;return e instanceof pe&&t instanceof pe&&e.equals(t)?t:t instanceof ge&&e.index===t.index&&e.equals(t)?t:void 0},enumerable:!0,configurable:!0}),e.prototype.getPreviousSplitWidgets=function(){for(var e=[],t=this.previousSplitWidget;t;)e.unshift(t),t=t.previousSplitWidget;return e},e.prototype.getSplitWidgets=function(){for(var e=this.getPreviousSplitWidgets(),t=this;t;)e.push(t),t=t.nextSplitWidget;return e},e.prototype.combineWidget=function(e){var t=this,i=this.getSplitWidgets();if(i.length>1)for(t=i.shift();i.length>0;){var n=i.shift();t.combine(n,e)}return t instanceof ve&&t.combineRows(e),t},e.prototype.combine=function(t,i){if(t.childWidgets.length>0){var n=this.lastChild;if(n instanceof ve)n.combineWidget(i);else{var r=t.firstChild;!(t instanceof ve)&&n instanceof e&&r instanceof e&&n.index===r.index&&n.combine(t.childWidgets.shift(),i)}this.addWidgets(t.childWidgets),t.childWidgets=[]}t.destroyInternal(i)},e.prototype.addWidgets=function(t){for(;t.length>0;){var i=t.shift();if(i instanceof we&&this instanceof fe)i.paragraph=this,this.height+=i.height;else if(i instanceof e){var n=this.lastChild;i.containerWidget=this,i.y=n instanceof e?n.y+n.height:this.y,this.height+=i.height}this.childWidgets.push(i)}},e.prototype.removeChild=function(e){e>-1&&e<this.childWidgets.length&&this.childWidgets.splice(e,1)},e.prototype.destroy=function(){if(this.childWidgets)for(;this.childWidgets.length>0;){var t=this.childWidgets.pop();(t instanceof we||t instanceof e)&&t.destroy()}this.childWidgets=void 0,this.containerWidget&&this.containerWidget.removeChild(this.indexInOwner),this.containerWidget=void 0,this.margin=void 0,this.x=void 0,this.y=void 0,this.width=void 0,this.height=void 0,this.index=void 0},e}(),ce=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.floatingElements=[],t.sectionFormatIn=void 0,t}return se(i,e),Object.defineProperty(i.prototype,"sectionFormat",{get:function(){var e=this;return e instanceof pe?e.sectionFormatIn:e.page?e.page.bodyWidgets[0].sectionFormat:void 0},set:function(e){this instanceof pe&&(this.sectionFormatIn=e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"sectionIndex",{get:function(){var e=this,t=0;return e instanceof pe?t=e.index:e.page&&(t=e.page.bodyWidgets[0].index),t},enumerable:!0,configurable:!0}),i.prototype.getHierarchicalIndex=function(e){var i=this;return e=i instanceof pe?i.index+";"+e:i instanceof me?"Footnote"===i.footNoteType?"FN;"+e:"EN;"+e:-1!==i.headerFooterType.indexOf("Header")?"H;"+e:"F;"+e,t.isNullOrUndefined(i.page)?e:this.page.documentHelper.pages.indexOf(this.page)+";"+e},i}(he),pe=function(e){function i(){return e.call(this)||this}return se(i,e),i.prototype.equals=function(e){return e instanceof i&&e.sectionFormat===this.sectionFormat},i.prototype.getHierarchicalIndex=function(e){var i=this;return e=i.index+";"+e,t.isNullOrUndefined(i.page)?e:this.page.documentHelper.pages.indexOf(this.page)+";"+e},i.prototype.getTableCellWidget=function(e){for(var t=0;t<this.childWidgets.length;t++)if(this.childWidgets[t].y<=e.y&&this.childWidgets[t].y+this.childWidgets[t].height>=e.y)return this.childWidgets[t].getTableCellWidget(e);var i=void 0;return this.childWidgets.length>0&&(i=this.childWidgets[0].y<=e.y?this.childWidgets[this.childWidgets.length-1].getTableCellWidget(e):this.childWidgets[0].getTableCellWidget(e)),i},i.prototype.destroyInternal=function(e){this.height;if(!t.isNullOrUndefined(this.childWidgets)){for(var i=0;i<this.childWidgets.length;i++){var n=this.childWidgets[i];if(n.destroyInternal(e),t.isNullOrUndefined(this.childWidgets))break;i--}this.childWidgets=void 0}if(!t.isNullOrUndefined(this.page)){var r=this.indexInOwner;this.indexInOwner>-1&&(this.page.bodyWidgets.splice(r,1),0===this.page.bodyWidgets.length?this.page.destroy():this instanceof ue&&this.page.headerWidget===this?this.page.headerWidget=void 0:this instanceof ue&&this.page.footerWidget===this&&(this.page.footerWidget=void 0),this.page=void 0)}this.destroy()},i.prototype.destroy=function(){this.sectionFormat=void 0,this.page=void 0,e.prototype.destroy.call(this)},i}(ce),ue=function(e){function t(t){var i=e.call(this)||this;return i.isEmpty=!1,i.headerFooterType=t,i}return se(t,e),t.prototype.getTableCellWidget=function(e){},t.prototype.equals=function(e){return e instanceof t&&e.containerWidget===this.containerWidget},t.prototype.clone=function(){for(var e=new t(this.headerFooterType),i=0;i<this.childWidgets.length;i++){var n=this.childWidgets[i].clone();e.childWidgets.push(n),n.index=i,n.containerWidget=e}return e.isEmpty=this.isEmpty,e.x=this.x,e.y=this.y,e.height=0,e.width=0,e},t.prototype.destroyInternal=function(t){this.page=void 0,e.prototype.destroy.call(this)},t}(ce),ge=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.locked=!1,t.lockedBy="",t.footNoteReference=void 0,t}return se(i,e),Object.defineProperty(i.prototype,"bodyWidget",{get:function(){for(var e=this;e.containerWidget;){if(e.containerWidget instanceof _e){var t=e.containerWidget.containerShape.line.paragraph;if(t)return t.bodyWidget}else if(e.containerWidget instanceof ce)return e.containerWidget;e=e.containerWidget}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"leftIndent",{get:function(){var e=this;return e instanceof fe&&e.paragraphFormat instanceof P?e.paragraphFormat.leftIndent:e instanceof ve&&e.tableFormat instanceof U?e.tableFormat.leftIndent:0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rightIndent",{get:function(){var e=this;return e instanceof fe&&e.paragraphFormat instanceof P?e.paragraphFormat.rightIndent:0},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isInsideTable",{get:function(){return this.containerWidget instanceof be},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isInHeaderFooter",{get:function(){return this.bodyWidget instanceof ue},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"associatedCell",{get:function(){if(this.containerWidget instanceof be)return this.containerWidget},enumerable:!0,configurable:!0}),i.prototype.isPageBreak=function(){var e=!1;if(this instanceof fe){var t=this;null!=t&&1===t.childWidgets.length&&1===t.firstChild.children.length&&(e=t.firstChild.children[0].isPageBreak)}return e},i.prototype.getHierarchicalIndex=function(e){var n=this;if(e=n.containerWidget.childWidgets.indexOf(n)+";"+e,!t.isNullOrUndefined(n.containerWidget)){if(n.containerWidget instanceof _e)return n.containerWidget.getHierarchicalIndex(e);if(n.containerWidget instanceof i)return n.containerWidget.getHierarchicalIndex(e);n.containerWidget instanceof ce&&(e=n.containerWidget.getHierarchicalIndex(e))}return e},i.prototype.getIndex=function(){return this instanceof fe||this instanceof ve?this.containerWidget.childWidgets.indexOf(this):this instanceof ye?this.ownerTable.childWidgets.indexOf(this):this instanceof be?this.ownerRow.childWidgets.indexOf(this):0},i.prototype.getContainerWidth=function(){if(this.isInsideTable)return this.associatedCell.getCellWidth();if(this.containerWidget instanceof _e){var e=this.containerWidget.containerShape;return W.convertPixelToPoint(e.width)-W.convertPixelToPoint(e.textFrame.marginLeft)-W.convertPixelToPoint(e.textFrame.marginRight)}var t=this.bodyWidget.sectionFormat;return t.pageWidth-(t.leftMargin+t.rightMargin)},Object.defineProperty(i.prototype,"bidi",{get:function(){return this instanceof fe&&this.paragraphFormat instanceof P?this.paragraphFormat.bidi:this instanceof ve&&this.tableFormat instanceof U&&this.tableFormat.bidi},enumerable:!0,configurable:!0}),i}(he),me=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return se(t,e),t.prototype.getMinimumAndMaximumWordWidth=function(e,t){throw new Error("Method not implemented.")},t.prototype.getTableCellWidget=function(e){},t.prototype.equals=function(e){return e instanceof t&&e.containerWidget===this.containerWidget},t.prototype.clone=function(){for(var e=new t,i=0;i<this.childWidgets.length;i++){var n=this.childWidgets[i].clone();e.childWidgets.push(n),n.index=i,n.containerWidget=e}return e.block=this.block,e},t.prototype.destroyInternal=function(t){this.block=void 0,e.prototype.destroy.call(this)},t}(ce),fe=function(e){function i(){var t=e.call(this)||this;return t.isChangeDetected=!1,t.floatingElements=[],t.paragraphFormat=new P(t),t.characterFormat=new H(t),t}return se(i,e),Object.defineProperty(i.prototype,"isEndsWithPageBreak",{get:function(){return this.childWidgets.length>0&&this.lastChild.isEndsWithPageBreak},enumerable:!0,configurable:!0}),i.prototype.equals=function(e){return e instanceof i&&e.paragraphFormat===this.paragraphFormat},i.prototype.isContainsShapeAlone=function(){for(var e=!1,t=0;t<this.childWidgets.length;t++)for(var i=this.childWidgets[t],n=0;n<i.children.length;n++){if(!(i.children[n]instanceof Ve))return!1;e=!0}return!!e},i.prototype.isEmpty=function(){if(t.isNullOrUndefined(this.childWidgets)||0===this.childWidgets.length)return!0;for(var e=0;e<this.childWidgets.length;e++)for(var i=this.childWidgets[e],n=0;n<i.children.length;n++){var r=i.children[n];if(0!==r.length&&(r instanceof Ie||r instanceof Ge||r instanceof ke||r instanceof Xe||r instanceof Ye||r instanceof Je||r instanceof Ve||r instanceof Le||r instanceof xe&&W.isLinkedFieldCharacter(r)))return!1}return!0},i.prototype.getInline=function(e,i){for(var n=void 0,r=0,o=!1,s=this.getSplitWidgets(),a=0;a<s.length;a++)for(var l=s[a],d=0;d<l.childWidgets.length;d++)for(var h=l.childWidgets[d],c=0;c<h.children.length;c++)if(!((n=h.children[c])instanceof Ke)){if((!o&&(n instanceof Ie||n instanceof Ge||n instanceof Ve||n instanceof ke||n instanceof xe&&W.isLinkedFieldCharacter(n))||n instanceof Je)&&(o=!0),o&&e<=r+n.length)return i=e-r,{element:n,index:i};r+=n.length}return e>r&&(i=t.isNullOrUndefined(n)?e:n.length),{element:n,index:i}},i.prototype.getLength=function(){for(var e=0,t=0;t<this.childWidgets.length;t++)for(var i=this.childWidgets[t],n=0;n<i.children.length;n++){var r=i.children[n];r instanceof Ke||(e+=r.length)}return e},i.prototype.getTableCellWidget=function(e){},i.prototype.getMinimumAndMaximumWordWidth=function(e,i){if(e=W.convertPointToPixel(e),i=W.convertPointToPixel(i),this.childWidgets.length>0){for(var n=this.childWidgets[0].children[0],r="",o=new g,s=[];;){if(n instanceof Ie&&""!==n.text)o.add(n,r.length),r+=n.text;else if(n instanceof xe&&0===n.fieldType){var a=n;t.isNullOrUndefined(a.fieldEnd)||(n=t.isNullOrUndefined(a.fieldSeparator)?a.fieldEnd:a.fieldSeparator)}else n instanceof Ge&&s.push(n.width);if(t.isNullOrUndefined(n)||t.isNullOrUndefined(n.nextNode))break;n=n.nextNode}for(var l=new RegExp("\\b\\w+\\b","g"),d=[],h=void 0;!t.isNullOrUndefined(h=l.exec(r));)d.push(h);for(var c=0;c<d.length;c++){var p=d[c],u=0;r="";for(var m="",f=0,v=p.index,y=p.index,b=0;b<o.keys.length;b++){var w=o.keys[b],C=o.get(w),x=w.length;if(y<=C+x&&(f=y-C,p.index+p[0].length<=C+x?v=p.index+p[0].length-(C+f):y+=v=x-f,m+=r=w.text.substring(f,f+v)),""!==r&&(u+=this.bodyWidget.page.documentHelper.textHelper.getWidth(r,w.characterFormat)),m===p[0])break}0!==u&&(0===e||u>e)&&(e=u)}var F=0;s.length>0&&(F=Math.max.apply(null,s)),(0===e||F>e)&&(e=F);var P=this.measureParagraph();(0===i||P>i)&&(i=P)}return{maximumWordWidth:W.convertPixelToPoint(i),minimumWordWidth:W.convertPixelToPoint(e)}},i.prototype.measureParagraph=function(){for(var e=0,i=this.childWidgets[0].children[0];;){if(i instanceof Ie&&""!==i.text)e+=this.bodyWidget.page.documentHelper.textHelper.getWidth(i.text,i.characterFormat);else if(i instanceof xe&&0===i.fieldType){var n=i;null!=n.fieldEnd&&(i=t.isNullOrUndefined(n.fieldSeparator)?n.fieldEnd:n.fieldSeparator)}else i instanceof Ge&&(e+=i.width);if(t.isNullOrUndefined(i)||t.isNullOrUndefined(i.nextNode))break;i=i.nextNode}return this.leftIndent>0&&(e+=this.leftIndent),this.rightIndent>0&&(e+=this.rightIndent),e},i.prototype.clone=function(){var e=new i;e.paragraphFormat.copyFormat(this.paragraphFormat),e.characterFormat.copyFormat(this.characterFormat);for(var t=0;t<this.childWidgets.length;t++){var n=this.childWidgets[t].clone();e.childWidgets.push(n);for(var r=0;r<n.children.length;r++){var o=n.children[r];o instanceof ze&&"Inline"!==o.textWrappingStyle&&e.floatingElements.push(o)}n.paragraph=e}return e.x=this.x,e.y=this.y,e.height=this.height,e.width=this.width,this.contentControlProperties&&(e.contentControlProperties=this.contentControlProperties),e},i.prototype.destroyInternal=function(e){var i=this.height;if(!t.isNullOrUndefined(this.childWidgets)){for(var n=0;n<this.childWidgets.length&&(this.childWidgets[n].destroy(),1===this.childWidgets.length&&t.isNullOrUndefined(this.childWidgets[0].children)&&(this.childWidgets=void 0),!t.isNullOrUndefined(this.childWidgets));n++)n--;this.childWidgets=void 0}t.isNullOrUndefined(this.containerWidget)||t.isNullOrUndefined(this.containerWidget.childWidgets)||-1===this.containerWidget.childWidgets.indexOf(this)||(this.containerWidget.childWidgets.splice(this.containerWidget.childWidgets.indexOf(this),1),this.containerWidget.height-=i,this.containerWidget=void 0),this.destroy()},i.prototype.destroy=function(){this.paragraphFormat=void 0,this.characterFormat=void 0,e.prototype.destroy.call(this)},i}(ge),ve=function(e){function i(){var t=e.call(this)||this;return t.flags=0,t.leftMargin=0,t.topMargin=0,t.rightMargin=0,t.bottomMargin=0,t.isDefaultFormatUpdated=!1,t.margin=new de(t.leftMargin,t.topMargin,t.rightMargin,t.bottomMargin),t.leftBorderWidth=0,t.rightBorderWidth=0,t.topBorderWidth=0,t.bottomBorderWidth=0,t.tableFormat=new U(t),t.tableHolder=new mt,t.spannedRowCollection=new g,t}return se(i,e),Object.defineProperty(i.prototype,"isGridUpdated",{get:function(){return(4&this.flags)>>2!=0},set:function(e){this.flags=251&this.flags|(e?1:0)<<2},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"continueHeader",{get:function(){return(2&this.flags)>>1!=0},set:function(e){this.flags=253&this.flags|(e?1:0)<<1},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"header",{get:function(){return 0!=(1&this.flags)},set:function(e){this.flags=254&this.flags|(e?1:0)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isBidiTable",{get:function(){return(16&this.flags)>>4!=0},set:function(e){this.flags=239&this.flags|(e?1:0)<<4},enumerable:!0,configurable:!0}),i.prototype.equals=function(e){return e instanceof i&&e.tableFormat===this.tableFormat},i.prototype.combineRows=function(e){for(var t=0;t<this.childWidgets.length;t++){var i=this.childWidgets[t];0===i.childWidgets.length?(i.destroy(),t--):i.combineCells(e)}},i.prototype.contains=function(e){if(this.equals(e.ownerTable))return!0;for(;e.ownerTable.isInsideTable;){if(this.equals(e.ownerTable))return!0;e=e.ownerTable.associatedCell}return this.equals(e.ownerTable)},i.prototype.getOwnerWidth=function(e){var t=this.getContainerWidth();return t=t-this.leftIndent-this.rightIndent,t>=0?t:0},i.prototype.getTableWidth=function(){for(var e=0,t=0;t<this.childWidgets.length;t++){for(var i=0,n=this.childWidgets[t],r=0;r<n.childWidgets.length;r++)i+=n.childWidgets[r].cellFormat.cellWidth;e<i&&(e=i)}return e},i.prototype.getTableClientWidth=function(e){var t=e;return"Point"===this.tableFormat.preferredWidthType&&this.tableFormat.preferredWidth>0?t=this.tableFormat.preferredWidth:"Percent"===this.tableFormat.preferredWidthType&&this.tableFormat.preferredWidth>0&&(t=t*this.tableFormat.preferredWidth/100),t},i.prototype.getCellWidth=function(e,i,n,r){var o=e;return"Percent"===i?o=e*n/100:"Point"===i?o=e:t.isNullOrUndefined(r)||(o=r.getMinimumPreferredWidth()),o},i.prototype.fitCellsToClientArea=function(e){for(var t=e/this.getTableWidth(),i=0;i<this.childWidgets.length;i++){var n=this.childWidgets[i];n.rowFormat.gridAfterWidth*=t,n.rowFormat.gridBeforeWidth*=t;for(var r=0;r<n.childWidgets.length;r++)n.childWidgets[r].cellFormat.cellWidth*=t,n.childWidgets[r].cellFormat.preferredWidth*=t}},i.prototype.getTableCellWidget=function(e){for(var t=void 0,i=0;i<this.childWidgets.length;i++)if(this.childWidgets[i].y<=e.y&&this.childWidgets[i].y+this.childWidgets[i].height>=e.y){t=this.childWidgets[i].getTableCellWidget(e);break}return t},i.prototype.calculateGrid=function(){var e=[],t=[],i=this.getOwnerWidth(!0),n=this.getTableClientWidth(i);this.tableCellInfo=new g;for(var r=0;r<this.childWidgets.length;r++){var o=this.childWidgets[r],s=new g,a=o.rowFormat,l=o.rowFormat.gridBefore,d=0;e.indexOf(d)<0&&e.push(d),d+=this.getCellWidth(a.gridBeforeWidth,a.gridBeforeWidthType,n,null);var h=parseFloat(d.toFixed(2));e.indexOf(h)<0&&e.push(h);for(var c=0;c<o.childWidgets.length;c++){for(var p=o.childWidgets[c],u=0;u<t.length;u++)if(!(t[u].columnIndex<l)){var m=t[u].cellFormat.rowSpan,f=!0;t[u].columnIndex>l?(f=!1,c===o.childWidgets.length-1&&o.rowFormat.gridAfter>0&&(d+=this.getCellWidth(t[u].cellFormat.preferredWidth,t[u].cellFormat.preferredWidthType,n,null))):(d+=this.getCellWidth(t[u].cellFormat.preferredWidth,t[u].cellFormat.preferredWidthType,n,null),l=t[u].columnIndex+t[u].cellFormat.columnSpan),f||c!==o.childWidgets.length-1||(f=!0),f&&r-t[u].ownerRow.rowIndex==m-1&&(t.splice(u,1),u--)}if(p.cellFormat.rowSpan>1)if(0===t.length||t[t.length-1].columnIndex<=l)t.push(p);else for(var v=t.length;v>0;v--)t[v-1].columnIndex>l&&t.splice(v-1,0,p);s.containsKey(p.cellIndex)||s.add(p.cellIndex,parseFloat((d-h).toFixed(2))),l+=p.cellFormat.columnSpan,d+=this.getCellWidth(p.cellFormat.preferredWidth,p.cellFormat.preferredWidthType,n,null);var y=parseFloat(d.toFixed(2));e.indexOf(y)<0&&e.push(y),c===o.childWidgets.length-1&&a.gridAfter>0&&(d+=this.getCellWidth(a.gridAfterWidth,"Point",n,null),e.indexOf(parseFloat(d.toFixed(2)))<0&&e.push(parseFloat(d.toFixed(2))),l+=a.gridAfter),this.tableCellInfo.containsKey(o.rowIndex)||this.tableCellInfo.add(o.rowIndex,s)}}e.sort(function(e,t){return e-t}),this.tableHolder.columns.length>0&&e.length-1!==this.tableHolder.columns.length&&this.updateColumnSpans(e,n),this.tableCellInfo.clear(),this.tableCellInfo=void 0},i.prototype.updateColumnSpans=function(e,t){for(var i=0;i<this.childWidgets.length;i++){var n=this.childWidgets[i];n.rowFormat.gridBeforeWidth>=0&&(n.rowFormat.gridBefore=n.getGridCount(e,void 0,-1,t));for(var r=0;r<n.childWidgets.length;r++){var o=n.childWidgets[r],s=n.getGridCount(e,o,o.getIndex(),t);s>0&&o.cellFormat.columnSpan!==s&&(o.cellFormat.columnSpan=s)}n.rowFormat.gridAfterWidth>=0&&(n.rowFormat.gridAfter=n.getGridCount(e,void 0,n.childWidgets.length,t))}},i.prototype.getMinimumAndMaximumWordWidth=function(e,t){this.checkTableColumns();var i=this.tableHolder.getTotalWidth(0);return i>e&&(e=i),i>t&&(t=i),{minimumWordWidth:e,maximumWordWidth:t}},i.prototype.checkTableColumns=function(){this.isGridUpdated||((this.isAutoFit()||0===this.tableHolder.columns.length)&&this.buildTableColumns(),this.isGridUpdated=!0)},i.prototype.isAutoFit=function(){var e=this.bodyWidget;return!t.isNullOrUndefined(e)&&!t.isNullOrUndefined(e.page)&&e.page.documentHelper.layout.getParentTable(this).tableFormat.allowAutoFit},i.prototype.buildTableColumns=function(){if(!this.isGridUpdated){this.tableHolder.resetColumns();var e=0,i=0,n=[],r="Auto"===this.tableFormat.preferredWidthType,o=this.tableFormat.allowAutoFit;e=!(!t.isNullOrUndefined(this.bodyWidget.page)&&this.bodyWidget.page.viewer instanceof oe&&o)||this.isInsideTable||this.containerWidget instanceof _e?this.getOwnerWidth(!0):W.convertPixelToPoint(this.bodyWidget.page.viewer.clientArea.width-3*this.bodyWidget.page.viewer.padding.right),e=this.tableFormat.preferredWidth>e?this.tableFormat.preferredWidth:e;var s=r&&0===this.tableFormat.preferredWidth&&!o;i=this.getTableClientWidth(e),s&&!this.isDefaultFormatUpdated&&this.splitWidthToTableCells(i,s);for(var a=0;a<this.childWidgets.length;a++){var l=this.childWidgets[a],d=l.rowFormat,h=0,c=0,p=new vt,u=0;!(d.gridBefore>0)||0===l.rowFormat.beforeWidth&&0===l.rowFormat.gridBeforeWidth||this.bodyWidget.page.documentHelper.alignTablesRowByRow&&"Left"!==l.ownerTable.tableFormat.tableAlignment||(c=this.getCellWidth(d.gridBeforeWidth,l.rowFormat.gridAfterWidthType,i,null),p.minimumWidth=c,this.tableHolder.addColumns(h,h=d.gridBefore,c,p,u=c));for(var g=0;g<l.childWidgets.length;g++){var m=l.childWidgets[g];0===n.length&&(m.columnIndex=h);for(var f=0;f<n.length;f++){var v=n[f];if(v.columnIndex<h)m.columnIndex=h;else{var y=1,b=!0;y=v.cellFormat.rowSpan,v.columnIndex>h?(m.columnIndex=h,b=!1):(p=v.getCellSizeInfo(o),c=this.getCellWidth(v.cellFormat.preferredWidth,v.cellFormat.preferredWidthType,i,v),this.tableHolder.columns.length>0?(this.tableHolder.addColumns(h,h=this.tableHolder.columns.indexOf(v.ownerColumn)+v.cellFormat.columnSpan,c,p,u+=c),m.columnIndex=h):(this.tableHolder.addColumns(h,h=v.columnIndex+v.cellFormat.columnSpan,c,p,u+=c),m.columnIndex=h)),b||g!==l.childWidgets.length-1||(b=!0),b&&a-v.ownerRow.rowIndex==y-1&&(n.splice(f,1),f--)}}if(m.cellFormat.rowSpan>1)if(0===n.length||n[n.length-1].columnIndex<=h)n.push(m);else{for(var w=0,C=n.length;C>0;C--)n[C-1].columnIndex>h&&(w=C-1);n.splice(w,0,m)}p=m.getCellSizeInfo(o),c=this.getCellWidth(m.cellFormat.preferredWidth,m.cellFormat.preferredWidthType,i,m),this.tableHolder.addColumns(h,h+=m.cellFormat.columnSpan,c,p,u+=c),g===l.childWidgets.length-1&&d.gridAfterWidth>0&&(c=this.getCellWidth(d.gridAfterWidth,"Point",i,null),this.tableHolder.addColumns(h,h+=d.gridAfter,c,p,u+=c))}}s&&!this.isDefaultFormatUpdated&&(this.isDefaultFormatUpdated=!0),this.tableHolder.validateColumnWidths(),o?this.tableHolder.autoFitColumn(e,i,r,this.isInsideTable):this.tableHolder.fitColumns(e,i,r,this.leftIndent+this.rightIndent),this.setWidthToCells(i,r)}},i.prototype.setWidthToCells=function(e,t){for(var i=0;i<this.childWidgets.length;i++){var n=this.childWidgets[i],r=n.rowFormat;r.gridBefore>0&&(r.beforeWidth=this.tableHolder.getCellWidth(0,r.gridBefore,e));for(var o=0;o<n.childWidgets.length;o++){var s=n.childWidgets[o];s.cellFormat.cellWidth=this.tableHolder.getCellWidth(s.columnIndex,s.cellFormat.columnSpan,e)}r.gridAfter>0&&(r.afterWidth=this.tableHolder.getCellWidth(0,r.gridAfter,e))}},i.prototype.updateProperties=function(e,t,i){if(e&&(this.tableFormat.allowAutoFit="FixedColumnWidth"!==i),this!==t)return void t.updateProperties(!1,t,i);if("FixedColumnWidth"===i){this.tableFormat.preferredWidth=0,this.tableFormat.preferredWidthType="Auto";for(d=0;d<this.childWidgets.length;d++)for(var n=this.childWidgets[d],r=0;r<n.childWidgets.length;r++){var o=n.childWidgets[r];o.cellFormat.preferredWidthType="Point",o.cellFormat.preferredWidth=o.cellFormat.cellWidth}}else if("FitToWindow"===i){var s=this.tableHolder.getTotalWidth(0);this.tableFormat.leftIndent=0,this.tableFormat.preferredWidth=100,this.tableFormat.preferredWidthType="Percent";for(d=0;d<this.childWidgets.length;d++)for(var a=this.childWidgets[d],l=0;l<a.childWidgets.length;l++)"Percent"!==(h=a.childWidgets[l]).cellFormat.preferredWidthType&&(h.cellFormat.preferredWidthType="Percent",h.cellFormat.preferredWidth=h.cellFormat.cellWidth/s*100)}else{this.tableFormat.preferredWidth=0,this.tableFormat.preferredWidthType="Auto";for(var d=0;d<this.childWidgets.length;d++){(a=this.childWidgets[d]).rowFormat.beforeWidth=0,a.rowFormat.gridBefore=0,a.rowFormat.gridBeforeWidth=0,a.rowFormat.gridBeforeWidthType="Auto",a.rowFormat.afterWidth=0,a.rowFormat.gridAfter=0,a.rowFormat.gridAfterWidth=0,a.rowFormat.gridAfterWidthType="Auto";for(r=0;r<a.childWidgets.length;r++){var h=a.childWidgets[r];h.cellFormat.preferredWidth=0,h.cellFormat.preferredWidthType="Auto"}}}},i.prototype.getMaxRowWidth=function(e){for(var t=0,i=0;i<this.childWidgets.length;i++){for(var n=this.childWidgets[i],r=0,o=0;o<n.childWidgets.length;o++){var s=n.childWidgets[o];r+=this.getCellWidth(s.cellFormat.preferredWidth,s.cellFormat.preferredWidthType,e,s)}t<r&&(t=r)}return t},i.prototype.updateWidth=function(e){var t=this.tableHolder.getTotalWidth(0),i=this.getOwnerWidth(!0),n=this.getTableClientWidth(i);if(n<=t&&"Auto"===this.tableFormat.preferredWidthType&&(this.tableFormat.preferredWidthType="Point"),"Auto"!==this.tableFormat.preferredWidthType)if("Point"===this.tableFormat.preferredWidthType)this.tableFormat.preferredWidth=this.getMaxRowWidth(n);else{var r=t/i*100;this.tableFormat.preferredWidth=r}},i.prototype.convertPointToPercent=function(e,t){var i=0;return i=e/t*100,i=Math.round(i),i<100?i:100},i.prototype.updateChildWidgetLeft=function(e){for(var t=0;t<this.childWidgets.length;t++){var i=this.childWidgets[t];i.x=e,i.updateChildWidgetLeft(e)}},i.prototype.shiftWidgetsForRtlTable=function(e,t){var i=t.x,n=e.right,r=0;t.tableFormat&&t.tableFormat.cellSpacing>0&&(r=t.tableFormat.cellSpacing);for(var o=0;o<t.childWidgets.length;o++)for(var s=t.childWidgets[o],a=n-(s.x-i),l=0;l<s.childWidgets.length;l++){var d=s.childWidgets[l];a-=d.width+d.margin.left+d.margin.right-d.rightBorderWidth+r,d.updateWidgetLeft(a+d.margin.left)}},i.prototype.clone=function(){var e=new i;e.tableHolder=this.tableHolder.clone(),e.tableFormat.copyFormat(this.tableFormat);for(var t=0;t<this.childWidgets.length;t++){var n=this.childWidgets[t].clone();e.childWidgets.push(n),n.containerWidget=e,n.index=t}return e.x=this.x,e.y=this.y,e.height=this.height,e.width=this.width,e.containerWidget=this.containerWidget,this.contentControlProperties&&(e.contentControlProperties=this.contentControlProperties),e},i.getTableOf=function(e){if(e instanceof S){var n=ye.getRowOf(e);return t.isNullOrUndefined(n)?e.ownerBase instanceof U&&e.ownerBase.ownerBase instanceof i?e.ownerBase.ownerBase:void 0:n.ownerTable}},i.prototype.fitChildToClientArea=function(){var e=this.getContainerWidth();Math.round(e)<Math.round(this.getTableWidth())&&this.fitCellsToClientArea(e);for(var t=0;t<this.childWidgets.length;t++)for(var n=this.childWidgets[t],r=0;r<n.childWidgets.length;r++)for(var o=n.childWidgets[r],s=0;s<o.childWidgets.length;s++)o.childWidgets[s]instanceof i&&o.childWidgets[s].fitChildToClientArea()},i.prototype.getColumnCellsForSelection=function(e,t){for(var i=[],n=e.columnIndex,r=t.columnIndex+t.cellFormat.columnSpan,o=0;o<this.childWidgets.length;o++)for(var s=this.childWidgets[o],a=0;a<s.childWidgets.length;a++){var l=s.childWidgets[a],d=l.columnIndex,h=l.cellFormat.columnSpan;d+h>n&&d+h<r||d>n&&d<r?i.indexOf(l)<0&&i.push(l):d>n&&d<r&&d+h<r||d<n&&d+h>r?i.indexOf(l)<0&&i.push(l):d!==n&&d+h!==r||i.indexOf(l)<0&&i.push(l)}return i},i.prototype.splitWidthToTableCells=function(e,t){for(var i=0;i<this.childWidgets.length;i++)this.childWidgets[i].splitWidthToRowCells(e,t)},i.prototype.insertTableRowsInternal=function(e,t){for(var i=e.length-1;i>=0;i--){var n=e.splice(i,1)[0];n.containerWidget=this,this.childWidgets.splice(t,0,n)}this.updateRowIndex(t),this.isGridUpdated=!1,this.buildTableColumns(),this.isGridUpdated=!0},i.prototype.updateRowIndex=function(e){for(var t=e;t<this.childWidgets.length;t++){var i=this.childWidgets[t];i.index=t;for(var n=0;n<i.childWidgets.length;n++)i.childWidgets[n].index=n,i.childWidgets[n].rowIndex=i.rowIndex;e++}},i.prototype.getCellStartOffset=function(e){var t=0;if(e&&this.tableCellInfo&&this.tableCellInfo.containsKey(e.ownerRow.rowIndex)){var i=this.tableCellInfo.get(e.ownerRow.rowIndex);i.containsKey(e.cellIndex)&&(t=i.get(e.cellIndex))}return t},i.prototype.destroyInternal=function(e){var i=this.height;if(!t.isNullOrUndefined(this.childWidgets)){for(var n=0;n<this.childWidgets.length;n++){var r=void 0;if(r=this.childWidgets[n],t.isNullOrUndefined(r)||r.destroyInternal(e),t.isNullOrUndefined(this.childWidgets))break;n--}this.childWidgets=void 0}t.isNullOrUndefined(this.containerWidget)||(t.isNullOrUndefined(this.containerWidget.childWidgets)||(-1!==this.containerWidget.childWidgets.indexOf(this)&&this.containerWidget.childWidgets.splice(this.containerWidget.childWidgets.indexOf(this),1),this.containerWidget.height-=i),this.containerWidget=void 0),this.destroy()},i.prototype.destroy=function(){this.tableFormat=void 0,this.spannedRowCollection&&this.spannedRowCollection.destroy(),this.spannedRowCollection=void 0,this.tableHolder=void 0,this.flags=void 0,this.leftMargin=void 0,this.topMargin=void 0,this.rightMargin=void 0,this.bottomMargin=void 0,this.headerHeight=void 0,this.description=void 0,this.title=void 0,this.isDefaultFormatUpdated=void 0,e.prototype.destroy.call(this)},i}(ge),ye=function(e){function i(){var t=e.call(this)||this;return t.topBorderWidth=0,t.bottomBorderWidth=0,t.rowFormat=new I(t),t}return se(i,e),Object.defineProperty(i.prototype,"rowIndex",{get:function(){return this.containerWidget?this.containerWidget.childWidgets.indexOf(this):-1},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"ownerTable",{get:function(){if(this.containerWidget instanceof ve)return this.containerWidget},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"nextRow",{get:function(){var e=this.indexInOwner;if(e>-1&&e<this.ownerTable.childWidgets.length-1)return this.ownerTable.childWidgets[e+1]},enumerable:!0,configurable:!0}),i.prototype.equals=function(e){return e instanceof i&&e.rowFormat===this.rowFormat},i.prototype.combineCells=function(e){for(var t=0;t<this.childWidgets.length;t++){var i=this.childWidgets[t];if(i.combineWidget(e),1===i.cellFormat.rowSpan){i.height,i.margin.top,i.margin.bottom;this.height-this.ownerTable.tableFormat.cellSpacing<i.height&&(this.height=this.ownerTable.tableFormat.cellSpacing+i.height)}}},i.getRowOf=function(e){if(e instanceof S){var n=be.getCellOf(e);return t.isNullOrUndefined(n)?e.ownerBase instanceof I&&e.ownerBase.ownerBase instanceof i?e.ownerBase.ownerBase:void 0:n.ownerRow}},i.prototype.getCell=function(e,t){for(var i=0;i<this.childWidgets.length;i++){var n=this.childWidgets[i];if(n.rowIndex===e&&n.index===t)return n}},i.prototype.splitWidthToRowCells=function(e,t){for(var i=this.childWidgets,n=e/i.length,r=0;r<i.length;r++)if(t&&0===i[r].cellFormat.preferredWidth)i[r].cellFormat.preferredWidth=n,this.ownerTable.isDefaultFormatUpdated=!1;else{if(t){this.ownerTable.isDefaultFormatUpdated=!0;break}i[r].cellFormat.preferredWidth=n}},i.prototype.getGridCount=function(e,t,i,n){var r=0,o=0,s=this.ownerTable,a=this.rowFormat;-1===i?o=s.getCellWidth(a.gridBeforeWidth,a.gridBeforeWidthType,n,null):(r+=s.getCellWidth(a.gridBeforeWidth,a.gridBeforeWidthType,n,null),i>=0&&(r+=s.getCellStartOffset(t)),o=i<this.childWidgets.length?s.getCellWidth(t.cellFormat.preferredWidth,t.cellFormat.preferredWidthType,n,null):s.getCellWidth(a.gridAfterWidth,a.gridAfterWidthType,n,null));var l=this.getOffsetIndex(e,r);return this.getOffsetIndex(e,r+o)-l},i.prototype.getOffsetIndex=function(e,t){t=parseFloat(t.toFixed(2));var i=0;if(e.indexOf(t)>=0)i=e.indexOf(t);else{for(var n=0;n<e.length;n++)if(e[n]>t)return n;i=e.length-1}return i},i.prototype.getCellOffset=function(e,t){for(var i=0,n=this.ownerTable,r=0;r<this.childWidgets.length;r++){var o=this.childWidgets[r].cellFormat;if(r===e)break;i+=n.getCellWidth(o.preferredWidth,o.preferredWidthType,t,null)}return i},i.prototype.updateRowBySpannedCells=function(){for(var e=this.getPreviousRowSpannedCells(),t=this.rowIndex,i=0;i<e.length;i++){var n=e[i];n.ownerRow.rowIndex+n.cellFormat.rowSpan-1>=t&&(n.cellFormat.rowSpan-=1)}},i.prototype.getPreviousRowSpannedCells=function(e){for(var i=[],n=e?this:this.previousWidget;!t.isNullOrUndefined(n);){for(var r=0;r<n.childWidgets.length;r++){var o=n.childWidgets[r];o.cellFormat.rowSpan>1&&i.splice(0,0,o)}n=n.previousWidget}return i},i.prototype.getTableCellWidget=function(e){for(var t=0;t<this.childWidgets.length;t++){var i=Math.round(this.childWidgets[t].x);if(i-this.childWidgets[t].margin.left-1<=e.x&&i+this.childWidgets[t].width>=e.x)return this.childWidgets[t];if(t===this.childWidgets.length-1&&this.childWidgets[t].x+this.childWidgets[t].width+1<=e.x)return this.childWidgets[t]}var n=void 0;return this.childWidgets.length>0&&(n=this.childWidgets[0].x<=e.x?this.childWidgets[this.childWidgets.length-1].getTableCellWidget(e):this.childWidgets[0].getTableCellWidget(e)),n},i.prototype.getMinimumAndMaximumWordWidth=function(e,t){return{minimumWordWidth:e,maximumWordWidth:t}},i.prototype.destroyInternal=function(e){var i=this.height;if(!t.isNullOrUndefined(this.childWidgets)){for(var n=0;n<this.childWidgets.length&&(this.childWidgets[n].destroyInternal(e),!t.isNullOrUndefined(this.childWidgets));n++)n--;this.childWidgets=void 0}t.isNullOrUndefined(this.containerWidget)||t.isNullOrUndefined(this.containerWidget.childWidgets)||(this.containerWidget.childWidgets.splice(this.containerWidget.childWidgets.indexOf(this),1),(t.isNullOrUndefined(this.containerWidget.childWidgets)||0===this.containerWidget.childWidgets.length)&&this.containerWidget instanceof ve?this.containerWidget.destroyInternal(e):this.containerWidget.containerWidget instanceof pe&&(this.containerWidget.containerWidget.height-=i),this.containerWidget.height-=i),this.destroy()},i.prototype.clone=function(){var e=new i;e.rowFormat.copyFormat(this.rowFormat),e.topBorderWidth=this.topBorderWidth,e.bottomBorderWidth=this.bottomBorderWidth;for(var t=0;t<this.childWidgets.length;t++){var n=this.childWidgets[t].clone();e.childWidgets.push(n),n.containerWidget=e,n.index=t,n.rowIndex=this.rowIndex}return e.x=this.x,e.y=this.y,e.height=this.height,e.width=this.width,this.contentControlProperties&&(e.contentControlProperties=this.contentControlProperties),e},i.prototype.updateChildWidgetLeft=function(e){var t=0;this.ownerTable.tableFormat.cellSpacing>0&&(t=this.ownerTable.tableFormat.cellSpacing);for(var i=0;i<this.childWidgets.length;i++){var n=this.childWidgets[i];e+=t+n.margin.left,n.x=e,n.updateChildWidgetLeft(n.x),e+=n.width+n.margin.right}},i.prototype.shiftWidgetForRtlTable=function(e,t,i){var n=t.x,r=0,o=0;null!=t.tableFormat&&t.tableFormat.cellSpacing>0&&(r=t.tableFormat.cellSpacing);for(var s=n+(o=W.convertPointToPixel(t.getTableWidth()))-(i.x-n),a=0;a<i.childWidgets.length;a++){var l=i.childWidgets[a];s-=l.width+l.margin.left+l.margin.right-l.rightBorderWidth+r,l.updateWidgetLeft(s+l.margin.left)}},i.prototype.destroy=function(){this.rowFormat=void 0,this.rowFormat=void 0,this.topBorderWidth=void 0,this.bottomBorderWidth=void 0,e.prototype.destroy.call(this)},i}(ge),be=function(e){function i(){var t=e.call(this)||this;return t.rowIndex=-1,t.sizeInfoInternal=new vt,t.updatedTopBorders=[],t.margin=new de(t.leftMargin,t.topMargin,t.rightMargin,t.bottomMargin),t.leftBorderWidth=0,t.rightBorderWidth=0,t.cellFormat=new z(t),t}return se(i,e),Object.defineProperty(i.prototype,"ownerColumn",{get:function(){return this.ownerTable.tableHolder.columns[this.columnIndex]},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"leftMargin",{get:function(){return this.cellFormat&&this.cellFormat.containsMargins()?this.cellFormat.leftMargin:!t.isNullOrUndefined(this.ownerRow)&&this.ownerRow.rowFormat.hasValue("leftMargin")?this.ownerRow.rowFormat.leftMargin:t.isNullOrUndefined(this.ownerTable)||t.isNullOrUndefined(this.ownerTable.tableFormat)?0:this.ownerTable.tableFormat.leftMargin},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"topMargin",{get:function(){return this.cellFormat&&this.cellFormat.containsMargins()?this.cellFormat.topMargin:!t.isNullOrUndefined(this.ownerRow)&&this.ownerRow.rowFormat.hasValue("topMargin")?this.ownerRow.rowFormat.topMargin:t.isNullOrUndefined(this.ownerTable)||t.isNullOrUndefined(this.ownerTable.tableFormat)?0:this.ownerTable.tableFormat.topMargin},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"rightMargin",{get:function(){return this.cellFormat&&this.cellFormat.containsMargins()?this.cellFormat.rightMargin:!t.isNullOrUndefined(this.ownerRow)&&this.ownerRow.rowFormat.hasValue("rightMargin")?this.ownerRow.rowFormat.rightMargin:t.isNullOrUndefined(this.ownerTable)||t.isNullOrUndefined(this.ownerTable.tableFormat)?0:this.ownerTable.tableFormat.rightMargin},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"bottomMargin",{get:function(){return this.cellFormat&&this.cellFormat.containsMargins()?this.cellFormat.bottomMargin:!t.isNullOrUndefined(this.ownerRow)&&this.ownerRow.rowFormat.hasValue("bottomMargin")?this.ownerRow.rowFormat.bottomMargin:t.isNullOrUndefined(this.ownerTable)||t.isNullOrUndefined(this.ownerTable.tableFormat)?0:this.ownerTable.tableFormat.bottomMargin},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"cellIndex",{get:function(){return this.ownerRow?this.ownerRow.childWidgets.indexOf(this):-1},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"ownerTable",{get:function(){if(this.containerWidget instanceof ye)return this.containerWidget.ownerTable},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"ownerRow",{get:function(){return this.containerWidget},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"sizeInfo",{get:function(){return this.sizeInfoInternal},enumerable:!0,configurable:!0}),i.prototype.equals=function(e){return e instanceof i&&e.cellFormat===this.cellFormat},i.prototype.getContainerTable=function(){for(var e=this.ownerTable;e instanceof ve&&e.associatedCell instanceof i;)e=e.associatedCell.getContainerTable();return e},i.prototype.getPreviousSplitWidget=function(){if(this.containerWidget instanceof ye){var e=this.containerWidget;do{if(e=e.previousRenderedWidget,t.isNullOrUndefined(e)||e.index<this.rowIndex)break;var i=e.getCell(this.rowIndex,this.index);if(i&&this.equals(i))return i}while(e)}},i.prototype.getNextSplitWidget=function(){var e=this.cellFormat.rowSpan;if(this.containerWidget instanceof ye){var i=this.containerWidget;do{if(i=i.nextRenderedWidget,t.isNullOrUndefined(i)||i.index>this.rowIndex+e)break;var n=i.getCell(this.rowIndex,this.index);if(n&&this.equals(n))return n}while(i)}},i.prototype.getTableCellWidget=function(e){for(var t=0;t<this.childWidgets.length;t++)if(this.childWidgets[t].y<=e.y&&this.childWidgets[t].y+this.childWidgets[t].height>=e.y)return this.childWidgets[t].getTableCellWidget(e);var i=void 0;return this.childWidgets.length>0&&(i=this.childWidgets[0].y<=e.y?this.childWidgets[this.childWidgets.length-1].getTableCellWidget(e):this.childWidgets[0].getTableCellWidget(e)),i},i.prototype.updateWidth=function(e){"Point"===this.cellFormat.preferredWidthType?this.cellFormat.preferredWidth=e:"Percent"===this.cellFormat.preferredWidthType&&(this.cellFormat.preferredWidth=this.convertPointToPercent(e)),this.cellFormat.cellWidth=e},i.prototype.getCellWidth=function(){var e=this.ownerTable,i=e?e.getTableClientWidth(e.getOwnerWidth(!0)):0,n=i,r=t.isNullOrUndefined(this.leftMargin)?0:this.leftMargin,o=t.isNullOrUndefined(this.rightMargin)?0:this.rightMargin;return e&&"Auto"===e.tableFormat.preferredWidthType&&e.tableFormat.allowAutoFit?n=0===this.cellFormat.preferredWidth?i:this.cellFormat.preferredWidth:"Percent"===this.cellFormat.preferredWidthType?n=this.cellFormat.preferredWidth*i/100-r-o:"Point"===this.cellFormat.preferredWidthType&&(n=this.cellFormat.preferredWidth-r-o),n},i.prototype.convertPointToPercent=function(e){var t=0,i=this.ownerTable.getOwnerWidth(!0);return t=e/this.ownerTable.getTableClientWidth(i)*100,t=Math.round(t),t<100?t:100},i.getCellLeftBorder=function(e){var i=void 0,n=e.cellFormat.borders,r=t.isNullOrUndefined(e.ownerRow)?void 0:e.ownerRow.rowFormat.borders,o=t.isNullOrUndefined(e.ownerTable)?void 0:e.ownerTable.tableFormat.borders;if(t.isNullOrUndefined(n.left)||(i=n.left),t.isNullOrUndefined(i)&&(i=e.getLeftBorderToRenderByHierarchy(i,r,o)),e.ownerTable.tableFormat.cellSpacing>0)i=e.getLeftBorderToRenderByHierarchy(i,r,o);else{var s=void 0;if(t.isNullOrUndefined(e.previousWidget)){if((e.cellFormat.columnSpan>1||e.columnIndex>1)&&e.ownerRow.rowIndex>0)for(var a=e.ownerRow.previousWidget;!t.isNullOrUndefined(a)&&a.childWidgets.length>0;){for(var l=0;l<a.childWidgets.length;l++){var d=a.childWidgets[l];if(d.columnIndex+d.cellFormat.columnSpan===e.columnIndex){s=a.childWidgets[l];break}}if(!t.isNullOrUndefined(s))break;a=a.previousWidget}}else s=e.previousWidget;i=e.getPreviousCellLeftBorder(i,s)}return t.isNullOrUndefined(i)&&(i=new T(e.cellFormat.borders)),i},i.prototype.getLeftBorderWidth=function(){var e=0;return null!==this.cellFormat&&null!==this.cellFormat.borders&&(e=i.getCellLeftBorder(this).getLineWidth()),e},i.prototype.getRightBorderWidth=function(){var e=0;this.ownerTable;return null!==this.cellFormat&&null!==this.cellFormat.borders&&(e=i.getCellRightBorder(this).getLineWidth()),e},i.prototype.getCellSpacing=function(){var e=this.ownerTable&&this.ownerTable.tableFormat?this.ownerTable.tableFormat.cellSpacing:0;return 1===this.ownerRow.childWidgets.length?2*e:0===this.cellIndex||this.cellIndex===this.ownerRow.childWidgets.length-1?e+e/2:e},i.prototype.getCellSizeInfo=function(e){var i=!0,n=void 0;if(t.isNullOrUndefined(this.bodyWidget)||t.isNullOrUndefined(this.bodyWidget.page)||t.isNullOrUndefined(this.bodyWidget.page.documentHelper)||(n=this.bodyWidget.page.documentHelper.layout),t.isNullOrUndefined(n)||t.isNullOrUndefined(n.currentCell)||(i=!1,this===n.currentCell&&(i=!0)),i&&!this.sizeInfo.hasMinimumWidth&&(this.sizeInfo.minimumWidth=this.getMinimumPreferredWidth()),e&&i&&!this.sizeInfo.hasMinimumWordWidth){var r=this.getMinimumAndMaximumWordWidth(0,0);this.sizeInfo.minimumWordWidth=r.minimumWordWidth+this.sizeInfo.minimumWidth,this.sizeInfo.maximumWordWidth=r.maximumWordWidth+this.sizeInfo.minimumWidth}var o=new vt;return o.minimumWidth=this.sizeInfo.minimumWidth,o.minimumWordWidth=this.sizeInfo.minimumWordWidth,o.maximumWordWidth=this.sizeInfo.maximumWordWidth,o},i.prototype.getMinimumPreferredWidth=function(){return this.cellFormat.preferredWidth>0&&!this.ownerTable.tableFormat.allowAutoFit||this.cellFormat.preferredWidth>0&&"Auto"!==this.cellFormat.preferredWidthType?this.cellFormat.preferredWidth:0===this.cellFormat.preferredWidth&&"Auto"===this.cellFormat.preferredWidthType&&0!==this.cellFormat.cellWidth?this.cellFormat.cellWidth:0===this.cellFormat.preferredWidth&&"Auto"===this.cellFormat.preferredWidthType&&0===this.cellFormat.cellWidth&&this.previousWidget&&this.previousWidget.cellFormat.preferredWidth>0?this.previousWidget.cellFormat.preferredWidth:this.leftMargin+this.rightMargin+this.getLeftBorderWidth()+this.getRightBorderWidth()+this.getCellSpacing()},i.prototype.getPreviousCellLeftBorder=function(e,i){if((t.isNullOrUndefined(i)||!t.isNullOrUndefined(e)&&"None"===e.lineStyle&&!e.hasNoneStyle)&&(t.isNullOrUndefined(e)||e.ownerBase.ownerBase instanceof U||(e=this.getLeftBorderToRenderByHierarchy(e,ye.getRowOf(e.ownerBase).rowFormat.borders,ve.getTableOf(e.ownerBase).tableFormat.borders))),t.isNullOrUndefined(i))return e;var n=void 0;return t.isNullOrUndefined(i.cellFormat.borders)||t.isNullOrUndefined(i.cellFormat.borders.right)||"None"===i.cellFormat.borders.right.lineStyle||(n=i.cellFormat.borders.right),t.isNullOrUndefined(n)||"None"===n.lineStyle?t.isNullOrUndefined(e)||e.ownerBase.ownerBase instanceof U?e:this.getLeftBorderToRenderByHierarchy(e,ye.getRowOf(e.ownerBase).rowFormat.borders,ve.getTableOf(e.ownerBase).tableFormat.borders):this.getBorderBasedOnPriority(n,e)},i.prototype.getBorderBasedOnPriority=function(e,i){if(t.isNullOrUndefined(e))return i;if(t.isNullOrUndefined(i))return e;var n=e.getBorderWeight(),r=i.getBorderWeight();if(n===r){var o=e.getPrecedence(),s=i.getPrecedence();if(o===s){var a=this.convertHexToRGB(e.color),l=a.r,d=a.g,h=a.b,c=this.convertHexToRGB(i.color),p=c.r,u=c.g,g=c.b,m=l+h+2*d,f=p+g+2*u;return m===f?(m=h+2*d,f=g+2*u,m===f?d===u?e:d>u?i:e:m>f?i:e):m>f?i:e}return o>s?e:i}return n>r?e:i},i.prototype.getLeftBorderToRenderByHierarchy=function(e,n,r){return t.isNullOrUndefined(e)||"None"===e.lineStyle&&(!e.hasNoneStyle||"None"===e.lineStyle&&0===e.lineWidth&&"#000000"===e.color)?!t.isNullOrUndefined(e)&&e.ownerBase instanceof S&&0===i.getCellOf(e.ownerBase).cellIndex?0!==i.getCellOf(e.ownerBase).columnIndex&&i.getCellOf(e.ownerBase).ownerRow.rowFormat.gridBefore<1&&!t.isNullOrUndefined(n)&&!t.isNullOrUndefined(n.vertical)&&"None"!==n.vertical.lineStyle?e=n.vertical:(t.isNullOrUndefined(r)||t.isNullOrUndefined(r.left)||(e=r.left),e):t.isNullOrUndefined(n)||t.isNullOrUndefined(n.vertical)||"None"===n.vertical.lineStyle?t.isNullOrUndefined(r)||t.isNullOrUndefined(r.vertical)||"None"===r.vertical.lineStyle?e:e=r.vertical:e=n.vertical:e},i.getCellRightBorder=function(e){var i=void 0,n=e.cellFormat.borders,r=t.isNullOrUndefined(e.ownerRow)?void 0:e.ownerRow.rowFormat.borders,o=t.isNullOrUndefined(e.ownerTable)?void 0:e.ownerTable.tableFormat.borders;if(t.isNullOrUndefined(n.right)||(i=n.right),t.isNullOrUndefined(i)&&(i=e.getRightBorderToRenderByHierarchy(i,r,o)),e.ownerTable.tableFormat.cellSpacing>0)i=e.getRightBorderToRenderByHierarchy(i,r,o);else{var s=void 0;t.isNullOrUndefined(e.nextWidget)||(s=e.nextWidget),i=e.getAdjacentCellRightBorder(i,s)}return t.isNullOrUndefined(i)&&(i=new T(e.cellFormat.borders)),i},i.prototype.getAdjacentCellRightBorder=function(e,i){if((t.isNullOrUndefined(i)||!t.isNullOrUndefined(e)&&"None"===e.lineStyle&&!e.hasNoneStyle)&&(t.isNullOrUndefined(e)||e.ownerBase.ownerBase instanceof U||(e=this.getRightBorderToRenderByHierarchy(e,ye.getRowOf(e.ownerBase).rowFormat.borders,ve.getTableOf(e.ownerBase).tableFormat.borders))),t.isNullOrUndefined(i))return e;var n=void 0;return t.isNullOrUndefined(i.cellFormat.borders)||t.isNullOrUndefined(i.cellFormat.borders.left)||"None"===i.cellFormat.borders.left.lineStyle||(n=i.cellFormat.borders.left),t.isNullOrUndefined(n)||"None"===n.lineStyle?t.isNullOrUndefined(e)||e.ownerBase.ownerBase instanceof U?e:this.getRightBorderToRenderByHierarchy(e,ye.getRowOf(e.ownerBase).rowFormat.borders,ve.getTableOf(e.ownerBase).tableFormat.borders):this.getBorderBasedOnPriority(e,n)},i.prototype.getRightBorderToRenderByHierarchy=function(e,n,r){return t.isNullOrUndefined(e)||"None"===e.lineStyle&&(!e.hasNoneStyle||"None"===e.lineStyle&&0===e.lineWidth&&"#000000"===e.color)?!t.isNullOrUndefined(e)&&e.ownerBase instanceof S&&i.getCellOf(e.ownerBase).cellIndex===i.getCellOf(e.ownerBase).ownerRow.childWidgets.length-1?(t.isNullOrUndefined(r)||t.isNullOrUndefined(r.right)||(e=r.right),e):t.isNullOrUndefined(n)||t.isNullOrUndefined(n.vertical)||"None"===n.vertical.lineStyle?t.isNullOrUndefined(r)||t.isNullOrUndefined(r.vertical)||"None"===r.vertical.lineStyle?e:e=r.vertical:e=n.vertical:e},i.getCellTopBorder=function(e){var i=void 0,n=e.cellFormat.borders,r=t.isNullOrUndefined(e.ownerRow)?void 0:e.ownerRow.rowFormat.borders,o=t.isNullOrUndefined(e.ownerTable)?void 0:e.ownerTable.tableFormat.borders;if(t.isNullOrUndefined(n.top)||(i=n.top),t.isNullOrUndefined(i)&&(i=e.getTopBorderToRenderByHierarchy(i,r,o)),e.ownerTable.tableFormat.cellSpacing>0)i=e.getTopBorderToRenderByHierarchy(i,r,o);else{for(var s=void 0,a=e.ownerRow.previousWidget;!t.isNullOrUndefined(a)&&a.childWidgets.length>0;){for(l=0;l<a.childWidgets.length;l++)if((d=a.childWidgets[l]).columnIndex+d.cellFormat.columnSpan-1>=e.columnIndex){s=a.childWidgets[l];break}if(!t.isNullOrUndefined(s))break;if(a=a.previousWidget,t.isNullOrUndefined(a)&&t.isNullOrUndefined(s))if(a=e.ownerRow.previousWidget,e.columnIndex<a.childWidgets.length)for(var l=0;l<a.childWidgets.length;l++){var d=a.childWidgets[l];if(d.columnIndex===e.columnIndex){s=a.childWidgets[l];break}}else s=e.ownerRow.previousWidget.childWidgets[e.ownerRow.previousWidget.childWidgets.length-1]}i=e.getPreviousCellTopBorder(i,s)}return t.isNullOrUndefined(i)&&(i=new T(e.cellFormat.borders)),i},i.prototype.getPreviousCellTopBorder=function(e,i){if((t.isNullOrUndefined(i)||!t.isNullOrUndefined(e)&&"None"===e.lineStyle&&!e.hasNoneStyle)&&(t.isNullOrUndefined(e)||e.ownerBase.ownerBase instanceof U||(e=this.getTopBorderToRenderByHierarchy(e,ye.getRowOf(e.ownerBase).rowFormat.borders,ve.getTableOf(e.ownerBase).tableFormat.borders))),t.isNullOrUndefined(i))return e;var n=void 0;return t.isNullOrUndefined(i.cellFormat.borders)||t.isNullOrUndefined(i.cellFormat.borders.bottom)||"None"===i.cellFormat.borders.bottom.lineStyle||(n=i.cellFormat.borders.bottom),t.isNullOrUndefined(n)||"None"===n.lineStyle?t.isNullOrUndefined(e)||e.ownerBase.ownerBase instanceof U?e:this.getTopBorderToRenderByHierarchy(e,ye.getRowOf(e.ownerBase).rowFormat.borders,ve.getTableOf(e.ownerBase).tableFormat.borders):this.getBorderBasedOnPriority(e,n)},i.prototype.getTopBorderToRenderByHierarchy=function(e,n,r){return t.isNullOrUndefined(e)||"None"===e.lineStyle&&(!e.hasNoneStyle||"None"===e.lineStyle&&0===e.lineWidth&&"#000000"===e.color)?!t.isNullOrUndefined(e)&&e.ownerBase instanceof S&&0===i.getCellOf(e.ownerBase).ownerRow.rowIndex?(t.isNullOrUndefined(r)||t.isNullOrUndefined(r.top)||(e=r.top),e):t.isNullOrUndefined(n)||t.isNullOrUndefined(n.horizontal)||"None"===n.horizontal.lineStyle?t.isNullOrUndefined(r)||t.isNullOrUndefined(r.horizontal)||"None"===r.horizontal.lineStyle?e:e=r.horizontal:e=n.horizontal:e},i.getCellBottomBorder=function(e){var i=void 0,n=e.cellFormat.borders,r=t.isNullOrUndefined(e.ownerRow)?void 0:e.ownerRow.rowFormat.borders,o=t.isNullOrUndefined(e.ownerTable)?void 0:e.ownerTable.tableFormat.borders;if(t.isNullOrUndefined(n.bottom)||(i=n.bottom),t.isNullOrUndefined(i)&&(i=e.getBottomBorderToRenderByHierarchy(i,r,o)),e.ownerTable.tableFormat.cellSpacing>0)i=e.getBottomBorderToRenderByHierarchy(i,r,o);else{var s=void 0,a=e.ownerRow.nextWidget;!t.isNullOrUndefined(a)&&e.columnIndex<a.childWidgets.length&&(s=a.childWidgets[e.columnIndex]),i=e.getAdjacentCellBottomBorder(i,s)}return t.isNullOrUndefined(i)&&(i=new T(e.cellFormat.borders)),i},i.prototype.getAdjacentCellBottomBorder=function(e,i){if((t.isNullOrUndefined(i)||!t.isNullOrUndefined(e)&&"None"===e.lineStyle&&!e.hasNoneStyle)&&(t.isNullOrUndefined(e)||e.ownerBase.ownerBase instanceof U||(e=this.getBottomBorderToRenderByHierarchy(e,ye.getRowOf(e.ownerBase).rowFormat.borders,ve.getTableOf(e.ownerBase).tableFormat.borders))),t.isNullOrUndefined(i))return e;var n=void 0;return t.isNullOrUndefined(i.cellFormat.borders)||t.isNullOrUndefined(i.cellFormat.borders.top)||"None"===i.cellFormat.borders.top.lineStyle||(n=i.cellFormat.borders.top),t.isNullOrUndefined(n)||"None"===n.lineStyle?t.isNullOrUndefined(e)||e.ownerBase.ownerBase instanceof U?e:this.getBottomBorderToRenderByHierarchy(e,ye.getRowOf(e.ownerBase).rowFormat.borders,ve.getTableOf(e.ownerBase).tableFormat.borders):this.getBorderBasedOnPriority(e,n)},i.prototype.getBottomBorderToRenderByHierarchy=function(e,n,r){return t.isNullOrUndefined(e)||"None"===e.lineStyle&&(!e.hasNoneStyle||"None"===e.lineStyle&&0===e.lineWidth&&"#000000"===e.color)?!t.isNullOrUndefined(e)&&e.ownerBase instanceof S&&i.getCellOf(e.ownerBase).ownerRow.rowIndex+i.getCellOf(e.ownerBase).cellFormat.rowSpan===i.getCellOf(e.ownerBase).ownerTable.childWidgets.length?(t.isNullOrUndefined(r)||t.isNullOrUndefined(r.bottom)||(e=r.bottom),e):t.isNullOrUndefined(n)||t.isNullOrUndefined(n.horizontal)||"None"===n.horizontal.lineStyle?t.isNullOrUndefined(r)||t.isNullOrUndefined(r.horizontal)||"None"===r.horizontal.lineStyle?e:e=r.horizontal:e=n.horizontal:e},i.prototype.convertHexToRGB=function(e){if(e){e=e.replace(/[^0-9A-‌​F]/gi,"");var t=parseInt(e,16);return{r:t>>16&255,g:t>>8&255,b:255&t}}},i.getCellOf=function(e){if(e instanceof S)return e.ownerBase instanceof z&&e.ownerBase.ownerBase instanceof i?e.ownerBase.ownerBase:void 0},i.prototype.updateWidgetLeft=function(e){this.x=e,this.updateChildWidgetLeft(e)},i.prototype.updateChildWidgetLeft=function(e){for(var t=0;t<this.childWidgets.length;t++)if(this.childWidgets[t].x=e,this.childWidgets[t]instanceof ve){var i=this.childWidgets[t];if(i.updateChildWidgetLeft(e),i.isBidiTable){var n=new ae(i.x,i.y,i.width,i.height);i.shiftWidgetsForRtlTable(n,i)}}},i.prototype.getMinimumAndMaximumWordWidth=function(e,t){for(var i=0;i<this.childWidgets.length;i++){var n=this.childWidgets[i].getMinimumAndMaximumWordWidth(e,t);e=n.minimumWordWidth,t=n.maximumWordWidth}return{minimumWordWidth:e,maximumWordWidth:t}},i.prototype.destroyInternal=function(e){if(!t.isNullOrUndefined(this.childWidgets)){for(var i=0;i<this.childWidgets.length;i++){var n=this.childWidgets[i];n.destroyInternal(e),i--}this.childWidgets=void 0}this.destroy()},i.prototype.clone=function(){var e=new i;e.cellFormat.copyFormat(this.cellFormat);for(var t=0;t<this.childWidgets.length;t++){var n=this.childWidgets[t].clone();e.childWidgets.push(n),n.containerWidget=e,n.index=t}return e.leftBorderWidth=this.leftBorderWidth,e.rightBorderWidth=this.rightBorderWidth,this.margin&&(e.margin=this.margin.clone()),e.columnIndex=this.columnIndex,e.x=this.x,e.y=this.y,e.height=this.height,e.width=this.width,this.contentControlProperties&&(e.contentControlProperties=this.contentControlProperties),e},i.prototype.destroy=function(){this.cellFormat=void 0,this.rowIndex=void 0,this.columnIndex=void 0,e.prototype.destroy.call(this)},i}(ge),we=function(){function e(e){this.children=[],this.x=0,this.y=0,this.width=0,this.height=0,this.marginTop=0,this.paragraph=e}return Object.defineProperty(e.prototype,"indexInOwner",{get:function(){return this.paragraph&&this.paragraph.childWidgets?this.paragraph.childWidgets.indexOf(this):-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextLine",{get:function(){var t=this.paragraph,i=this.indexInOwner;if(i<=t.childWidgets.length-2)return t.childWidgets[i+1];if(t.nextSplitWidget){var n=t.nextSplitWidget.firstChild;if(n instanceof e&&n.paragraph.equals(this.paragraph))return n}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousLine",{get:function(){var t=this.paragraph,i=this.indexInOwner,n=t.previousSplitWidget;if(i>0)return t.childWidgets[i-1];if(n instanceof fe){var r=n.lastChild;if(r instanceof e&&r.paragraph.equals(this.paragraph))return r}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEndsWithPageBreak",{get:function(){if(this.children.length>0){var e=this.children[this.children.length-1];if(e instanceof Ie)return e.isPageBreak}return!1},enumerable:!0,configurable:!0}),e.prototype.isFirstLine=function(){var e=this.indexInOwner;return!!(e>-1&&(void 0===this.paragraph.previousSplitWidget||this.paragraph.previousSplitWidget instanceof fe&&this.paragraph.previousSplitWidget.isEndsWithPageBreak))&&0===e},e.prototype.isLastLine=function(){var e=this.indexInOwner;return e>-1&&void 0===this.paragraph.nextSplitWidget&&e===this.paragraph.childWidgets.length-1},e.prototype.getOffset=function(e,i){if(t.isNullOrUndefined(e))return i;var n=i,r=e.line,o=(e.line.paragraph.childWidgets.indexOf(e.line),r.paragraph.bidi),s=this.paragraph.bodyWidget.page.documentHelper.layout.isContainsRtl(this);if(o||s)if(o)n=(a=this.getInlineForOffset(n,!0,e)).index;else{var a=this.getInlineForRtlLine(n,!0,e);n=a.index}else for(var l=0;l<r.children.length;l++){var d=r.children[l];if(e===d)break;d instanceof Ke||(n+=d.length)}return n},e.prototype.getEndOffset=function(){var e=0,t=0;if(this.paragraph.bidi||this.paragraph.bodyWidget.page.documentHelper.layout.isContainsRtl(this))e=this.getInlineForOffset(e,!1,this.children[0],!0).index;else for(var i=0;i<this.children.length;i++){var n=this.children[i];0!==n.length&&(n instanceof Ke||((n instanceof Ie||n instanceof Ye||n instanceof Ge||n instanceof Xe||n instanceof ke||n instanceof Le||n instanceof xe&&W.isLinkedFieldCharacter(n))&&(e=t+n.length),t+=n.length))}return e},e.prototype.getInlineForOffset=function(e,i,n,r,o,s){for(var a,l=this.children[this.children.length-1],d=l,h=this.paragraph.bodyWidget.page.documentHelper,c=h.textHelper,p=!1,u=0,g=h.selection.getLineLength(this),m=0;d;){if(!(a||d instanceof Oe&&"\t"===d.text||(!(d instanceof Ie)||c.isRTLText(d.text)||(c.containsSpecialCharAlone(d.text)||/^[0-9]+$/.test(d.text))&&d.characterFormat.bidi)&&d instanceof Ie)){for(;d.previousElement&&(d.previousElement instanceof Ie&&!c.isRTLText(d.previousElement.text)&&(!c.containsSpecialCharAlone(d.previousElement.text)&&!/^[0-9]+$/.test(d.previousElement.text)||!d.previousElement.characterFormat.bidi)||d.previousElement instanceof xe||d.previousElement instanceof ke&&!t.isNullOrUndefined(d.previousElement.previousElement)&&!(d.previousElement.previousElement instanceof ke)||d.previousElement instanceof ke&&d.previousElement.previousElement instanceof ke&&!t.isNullOrUndefined(d.previousElement.previousElement.previousElement)||d instanceof ke&&d.previousElement instanceof ke&&!t.isNullOrUndefined(d.previousElement.previousElement)||d.previousElement instanceof Ke||d.previousElement instanceof Xe||d.previousElement instanceof Ye||d.previousElement instanceof Ge);)p=!0,d=d.previousElement;if(d.previousElement&&(p||d.previousElement instanceof Ie&&(c.isRTLText(d.previousElement.text)||(c.containsSpecialCharAlone(d.previousElement.text)||/^[0-9]+$/.test(d.previousElement.text))&&d.previousElement.characterFormat.bidi)))a=d.previousElement;else if(!d.previousElement){if(d instanceof Ke)break;a=d}d instanceof Ke&&a&&(d=a,a=void 0)}if(i&&!t.isNullOrUndefined(n)){if(n===d)return{element:d,index:e};e+=d.length}else if(r){if((e+=d.length)===g)return{element:d,index:e};if(e>g)return{element:d,index:g}}else if(s){if(e<u+d.length&&(d instanceof Ie||d instanceof Ge||d instanceof xe&&W.isLinkedFieldCharacter(d)))return{element:d,index:(e>u?e:u)+1};u+=d.length}else{if(e<=u+d.length)return{element:d,index:o?e-1===u?m:e-1:e-u};o&&(d instanceof Ie||d instanceof Ge||d instanceof xe&&W.isLinkedFieldCharacter(d))&&(m=u+d.length),u+=d.length}if(d.previousElement&&(d instanceof Ie&&(c.isRTLText(d.text)||(c.containsSpecialCharAlone(d.text)||/^[0-9]+$/.test(d.text))&&d.characterFormat.bidi)||d instanceof Oe&&"\t"===d.text||d instanceof ke&&(d instanceof ke&&d.previousElement instanceof ke&&!d.previousElement.previousElement||1===d.bookmarkType&&!d.previousElement))){if((e===u+1||e>u+1)&&u===g&&!d.previousElement)break;d=d.previousElement}else if(a&&(!d.nextElement||d===l||d.nextElement instanceof Ie&&(c.isRTLText(d.nextElement.text)||(c.containsSpecialCharAlone(d.nextElement.text)||/^[0-9]+$/.test(d.nextElement.text))&&d.nextElement.characterFormat.bidi)||d.nextElement instanceof Ke)){if(e===u+1&&u===g)break;d=a,a=void 0,p=!1}else{if((a===d||e===u+1)&&!d.previousElement&&u===g)break;d=d.nextElement}}return s?{element:d,index:e}:o?{element:d,index:-1}:{element:d,index:r?e:0}},e.prototype.getInlineForRtlLine=function(e,i,n){for(var r,o=this.children[0],s=this.paragraph.bodyWidget.page.documentHelper,a=s.textHelper,l=!1,d=0,h=(s.selection.getLineLength(this),-1),c=-1,p=!1;o;)if(o instanceof Ke)o=o.nextElement;else{if(!p&&(o instanceof Ie||o instanceof Ge||o instanceof ke||o instanceof Xe||o instanceof Ye||o instanceof xe&&W.isLinkedFieldCharacter(o))&&(p=!0),!r)for(;o&&o instanceof Ie&&(a.isRTLText(o.text)||a.containsSpecialCharAlone(o.text));)r||(r=o),h=this.children.indexOf(o),o=o.nextElement,l=!0;if(-1!==h&&l&&(o=this.children[h]),i&&!t.isNullOrUndefined(n)){if(n===o)return{element:o,index:e};e+=o.length}else{if(p&&e<=d+o.length)return c=e-d,{element:o,index:c};d+=o.length}if(r===o&&(r=void 0,-1!==h&&(o=this.children[h]),h=-1),r&&o.previousElement)o=o.previousElement;else{if(!o.nextElement)return e>d&&(c=t.isNullOrUndefined(o)?e:o.length),{element:o,index:c};o=o.nextElement}l=!1}return{element:o,index:c}},e.prototype.getInline=function(e,i,n,r){n=t.isNullOrUndefined(n)?this.paragraph.bidi:n;var o=void 0,s=0,a=!1;if(0===this.children.length&&this.previousLine){var l=this.previousLine.children[this.previousLine.children.length-1];if(l instanceof Ie&&"\v"===l.text)return o=this.previousLine.children[this.previousLine.children.length-1],i=1,{element:o,index:i}}var d=this.paragraph.bodyWidget.page.documentHelper.layout.isContainsRtl(this);if(n||d)if(n)o=(h=this.getInlineForOffset(e)).element,i=h.index;else{var h=this.getInlineForRtlLine(e);o=h.element,i=h.index}else{for(var c=0;c<this.children.length;c++)if(!((o=this.children[c])instanceof Ke)){if(!a&&(o instanceof Ie||o instanceof Ge||o instanceof Ve||o instanceof Le||o instanceof ke||o instanceof Xe||o instanceof Ye||o instanceof pt||o instanceof xe&&W.isLinkedFieldCharacter(o))&&(a=!0),a&&e<=s+o.length){if(o instanceof Ie&&" "===o.text&&0===o.revisions.length&&r){var p=this.getNextTextElement(this,c+1);return o=t.isNullOrUndefined(p)?o:p,i=t.isNullOrUndefined(p)?e-s:0,{element:o,index:i}}return e===o.length&&this.children[c+1]instanceof Ee?{element:this.children[c+1],index:i}:(i=e-s,{element:o,index:i})}s+=o.length}e>s&&(i=t.isNullOrUndefined(o)?e:o.length)}return{element:o,index:i}},e.prototype.getNextTextElement=function(e,t){return t<e.children.length-1&&e.children[t]?e.children[t]:null},e.prototype.getHierarchicalIndex=function(e){var t=this;return e=t.paragraph.childWidgets.indexOf(t)+";"+e,t.paragraph instanceof ge?t.paragraph.getHierarchicalIndex(e):e},e.prototype.clone=function(){for(var t=new e(void 0),i=0;i<this.children.length;i++){var n=this.children[i].clone();t.children.push(n),n.line=t}return t.width=this.width,t.height=this.height,t},e.prototype.destroy=function(){if(!t.isNullOrUndefined(this.children)){for(var e=0;e<this.children.length;e++)this.children[e].destroy();this.children=[]}this.children=void 0,this.paragraph&&this.paragraph.removeChild(this.indexInOwner),this.paragraph=void 0,this.x=void 0,this.y=void 0,this.width=void 0,this.height=void 0},e}(),Ce=function(){function e(){this.x=0,this.y=0,this.width=0,this.height=0,this.margin=new de(0,0,0,0),this.padding=new de(0,0,0,0),this.characterFormat=void 0,this.isRightToLeft=!1,this.canTrigger=!1,this.ischangeDetected=!1,this.isVisible=!1,this.isSpellChecked=!1,this.revisions=[],this.canTrack=!1,this.removedIds=[],this.isMarkedForRevision=!1,this.characterFormat=new H(this),this.margin=new de(0,0,0,0)}return Object.defineProperty(e.prototype,"isPageBreak",{get:function(){return this instanceof Ie&&"\f"===this.text},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isValidNodeForTracking",{get:function(){return!(this instanceof ke||this instanceof pt||this instanceof Ye||this instanceof Xe||this instanceof Le)},enumerable:!0,configurable:!0}),e.prototype.linkFieldCharacter=function(e){if(this instanceof xe)if(0===this.fieldType){var i=this;t.isNullOrUndefined(i.fieldEnd)&&(this.linkFieldTraversingForward(this.line,i,i),-1===e.fields.indexOf(i)&&e.fields.push(i),t.isNullOrUndefined(i.formFieldData)||-1!==e.formFields.indexOf(i)||e.formFields.push(i))}else if(2===this.fieldType){var n=this;if(t.isNullOrUndefined(n.fieldBegin)&&this.linkFieldTraversingBackwardSeparator(this.line,n,n),!t.isNullOrUndefined(n.fieldBegin)){n.fieldBegin.fieldSeparator=n;var r=this.linkFieldTraversingForward(this.line,n.fieldBegin,n);t.isNullOrUndefined(n.fieldEnd)&&r&&(n.fieldEnd=n.fieldBegin.fieldEnd),n.fieldEnd&&(n.fieldEnd.fieldSeparator=n)}}else{var o=this;t.isNullOrUndefined(o.fieldBegin)&&this.linkFieldTraversingBackward(this.line,o,o)}},e.prototype.linkFieldTraversingBackward=function(e,i,n){var r=e.children.length-1;e.children.indexOf(n)>-1&&(r=e.children.indexOf(n)-1);for(var o=r;o>=0;o--){var s=e.children[o];if(s instanceof xe){if(0===s.fieldType)return t.isNullOrUndefined(s.fieldEnd)&&(i.fieldBegin=s,t.isNullOrUndefined(s.fieldEnd)&&(s.fieldEnd=i),i.fieldSeparator&&t.isNullOrUndefined(i.fieldSeparator.fieldBegin)&&(i.fieldSeparator.fieldBegin=s,t.isNullOrUndefined(s.fieldSeparator)&&(s.fieldSeparator=i.fieldSeparator))),!t.isNullOrUndefined(i.fieldBegin);2===s.fieldType&&t.isNullOrUndefined(s.fieldEnd)&&(i.fieldSeparator=s,s.fieldEnd=i,t.isNullOrUndefined(s.fieldBegin)||(i.fieldBegin=s.fieldBegin))}}if(e.previousLine)this.linkFieldTraversingBackward(e.previousLine,i,this);else if(e.paragraph.previousRenderedWidget instanceof fe&&e.paragraph.previousRenderedWidget.childWidgets.length>0){var a=e.paragraph.previousRenderedWidget;this.linkFieldTraversingBackward(a.childWidgets[a.childWidgets.length-1],i,this)}return!0},e.prototype.linkFieldTraversingForward=function(e,i,n){var r=0;e.children.indexOf(n)>-1&&(r=e.children.indexOf(n)+1);for(var o=r;o<e.children.length;o++){var s=e.children[o];if(s instanceof xe){if(1===s.fieldType)return t.isNullOrUndefined(s.fieldBegin)&&(i.fieldEnd=s),i.fieldEnd&&t.isNullOrUndefined(i.fieldEnd.fieldBegin)&&(i.fieldEnd.fieldBegin=i),!0;if(t.isNullOrUndefined(i.fieldSeparator)){if(2!==s.fieldType||!t.isNullOrUndefined(s.fieldBegin))return!1;if(i.fieldSeparator=s,i.fieldSeparator&&t.isNullOrUndefined(i.fieldSeparator.fieldBegin)&&(i.fieldSeparator.fieldBegin=i),!t.isNullOrUndefined(s.fieldEnd))return i.fieldEnd=s.fieldEnd,i.fieldSeparator.fieldEnd=i.fieldEnd,!0}}}return e.nextLine?this.linkFieldTraversingForward(e.nextLine,i,this):e.paragraph.nextRenderedWidget instanceof fe&&e.paragraph.nextRenderedWidget.childWidgets.length>0&&this.linkFieldTraversingForward(e.paragraph.nextRenderedWidget.childWidgets[0],i,this),!0},e.prototype.linkFieldTraversingBackwardSeparator=function(e,i,n){var r=e.children.length-1;e.children.indexOf(n)>-1&&(r=e.children.indexOf(n)-1);for(var o=r;o>=0;o--){var s=e.children[o];if(s instanceof xe&&s instanceof xe&&0===s.fieldType)return t.isNullOrUndefined(s.fieldSeparator)&&(i.fieldBegin=s),!t.isNullOrUndefined(i.fieldBegin)}if(e.previousLine)this.linkFieldTraversingBackwardSeparator(e.previousLine,i,this);else{if(!(e.paragraph.previousRenderedWidget instanceof fe&&e.paragraph.previousRenderedWidget.childWidgets.length>0))return!0;e=e.paragraph.previousRenderedWidget.childWidgets[e.paragraph.previousRenderedWidget.childWidgets.length-1],this.linkFieldTraversingBackwardSeparator(e,i,this)}return!0},Object.defineProperty(e.prototype,"length",{get:function(){return this.getLength()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"indexInOwner",{get:function(){return this.line instanceof we&&this.line.children?this.line.children.indexOf(this):-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousElement",{get:function(){var e=this.indexInOwner;if(e>0&&e<this.line.children.length)return this.line.children[e-1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextElement",{get:function(){var e=this.indexInOwner;if(e>-1&&e<this.line.children.length-1)return this.line.children[e+1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextNode",{get:function(){var e=this.line.children.indexOf(this),t=this.line.paragraph.childWidgets.indexOf(this.line);return e<this.line.children.length-1?this.line.children[e+1]:t<this.line.paragraph.childWidgets.length-1?this.line.paragraph.childWidgets[t+1].children[0]:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextValidNodeForTracking",{get:function(){for(var e=this;!t.isNullOrUndefined(e)&&(e instanceof ke||e instanceof pt||e instanceof Ye||e instanceof Xe||e instanceof Le);)e=e.nextNode;return e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousValidNodeForTracking",{get:function(){for(var e=this;!t.isNullOrUndefined(e)&&(e instanceof ke||e instanceof pt||e instanceof Ye||e instanceof Xe||e instanceof Le);)e=e.previousNode;return e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousNode",{get:function(){var e=this.line.children.indexOf(this),t=this.line.paragraph.childWidgets.indexOf(this.line);if(e>0)return this.line.children[e-1];if(t>0){var i=this.line.paragraph.childWidgets[t-1];return i.children[i.children.length-1]}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"paragraph",{get:function(){if(this.line)return this.line.paragraph},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){if(!t.isNullOrUndefined(this.line)&&this.line.children&&this.line.children.indexOf(this)>-1){var e=this.line.children.indexOf(this);this.line.children.splice(e,1)}this.line=void 0,this.characterFormat&&this.characterFormat.destroy(),this.characterFormat=void 0,this.margin&&this.margin.destroy(),this.margin=void 0,this.x=void 0,this.y=void 0,this.width=void 0,this.height=void 0},e.objectCharacter=String.fromCharCode(65532),e}(),xe=function(e){function i(t){var i=e.call(this)||this;return i.fieldType=0,i.fieldCodeType="",i.hasFieldEnd=!1,i.fieldBeginInternal=void 0,i.fieldSeparatorInternal=void 0,i.fieldEndInternal=void 0,i.fieldType=t,i}return se(i,e),Object.defineProperty(i.prototype,"fieldBegin",{get:function(){return this.fieldBeginInternal},set:function(e){this.fieldBeginInternal=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fieldSeparator",{get:function(){return this.fieldSeparatorInternal},set:function(e){this.fieldSeparatorInternal=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"fieldEnd",{get:function(){return this.fieldEndInternal},set:function(e){this.fieldEndInternal=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"resultText",{get:function(){if(!t.isNullOrUndefined(this.formFieldData)&&0===this.fieldType&&!t.isNullOrUndefined(this.fieldSeparator)&&!t.isNullOrUndefined(this.fieldEnd)){var e=this.fieldSeparator.nextElement,i="";do{if(e instanceof Ie&&(i+=e.text),(e=e.nextNode)===this.fieldEnd)break}while(e);return i}},enumerable:!0,configurable:!0}),i.prototype.getLength=function(){return 1},i.prototype.clone=function(){var e=new i(this.fieldType);return 0!==this.fieldType||t.isNullOrUndefined(this.formFieldData)||(e.formFieldData=this.formFieldData.clone()),e.characterFormat.copyFormat(this.characterFormat),this.margin&&(e.margin=this.margin.clone()),e.width=this.width,e.height=this.height,this.revisions.length>0?e.removedIds=N.cloneRevisions(this.revisions):e.removedIds=this.removedIds.slice(),e.fieldCodeType=this.fieldCodeType,e},i.prototype.destroy=function(){this.fieldType=void 0,this.hasFieldEnd=void 0,this.fieldBeginInternal=void 0,this.fieldEndInternal=void 0,this.fieldSeparatorInternal=void 0,e.prototype.destroy.call(this)},i}(Ce),Fe=function(){function e(){this.name="",this.enabled=!0,this.helpText="",this.statusText=""}return e}(),Pe=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="Text",t.maxLength=0,t.defaultValue="",t.format="",t}return se(i,e),i.prototype.clone=function(){var e=new i;return e.type=this.type,e.name=this.name,e.enabled=this.enabled,e.helpText=this.helpText,e.statusText=this.statusText,e.maxLength=this.maxLength,e.defaultValue=this.defaultValue,e.format=this.format,e},i.prototype.getFormFieldInfo=function(){return{defaultValue:this.defaultValue,enabled:this.enabled,format:this.format,helpText:this.helpText,maxLength:this.maxLength,type:this.type}},i.prototype.copyFieldInfo=function(e){t.isNullOrUndefined(e.defaultValue)||(this.defaultValue=e.defaultValue),t.isNullOrUndefined(e.enabled)||(this.enabled=e.enabled),t.isNullOrUndefined(e.format)||(this.format=e.format),t.isNullOrUndefined(e.helpText)||(this.helpText=e.helpText),t.isNullOrUndefined(e.maxLength)||(this.maxLength=e.maxLength),t.isNullOrUndefined(e.type)||(this.type=e.type)},i}(Fe),Te=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.sizeType="Auto",t.size=11,t.defaultValue=!1,t.checked=!1,t}return se(i,e),i.prototype.clone=function(){var e=new i;return e.name=this.name,e.enabled=this.enabled,e.helpText=this.helpText,e.statusText=this.statusText,e.sizeType=this.sizeType,e.size=this.size,e.defaultValue=this.defaultValue,e.checked=this.checked,e},i.prototype.getFormFieldInfo=function(){return{defaultValue:this.defaultValue,enabled:this.enabled,helpText:this.helpText,size:this.size,sizeType:this.sizeType}},i.prototype.copyFieldInfo=function(e){t.isNullOrUndefined(e.defaultValue)||(this.defaultValue=e.defaultValue,this.checked=e.defaultValue),t.isNullOrUndefined(e.enabled)||(this.enabled=e.enabled),t.isNullOrUndefined(e.size)||(this.size=e.size),t.isNullOrUndefined(e.helpText)||(this.helpText=e.helpText),t.isNullOrUndefined(e.sizeType)||(this.sizeType=e.sizeType)},i}(Fe),Se=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.dropdownItems=[],t.selectedIndex=0,t}return se(i,e),i.prototype.clone=function(){var e=new i;return e.name=this.name,e.enabled=this.enabled,e.helpText=this.helpText,e.statusText=this.statusText,e.dropdownItems=this.dropdownItems.slice(),e.selectedIndex=this.selectedIndex,e},i.prototype.getFormFieldInfo=function(){return{dropdownItems:this.dropdownItems.slice(),enabled:this.enabled,helpText:this.helpText}},i.prototype.copyFieldInfo=function(e){t.isNullOrUndefined(e.dropdownItems)||(this.dropdownItems=e.dropdownItems),t.isNullOrUndefined(e.enabled)||(this.enabled=e.enabled),t.isNullOrUndefined(e.helpText)||(this.helpText=e.helpText)},i}(Fe),Ie=function(e){function t(){var t=e.call(this)||this;return t.baselineOffset=0,t.text="",t.trimEndWidth=0,t.ignoreOnceItems=[],t.istextCombined=!1,t.errorCollection=[],t}return se(t,e),t.prototype.getLength=function(){return this.text?this.text.length:0},t.prototype.clone=function(){var e=new t;return e.characterFormat.copyFormat(this.characterFormat),e.text=this.text,this.margin&&(e.margin=this.margin.clone()),e.baselineOffset=this.baselineOffset,this.revisions.length>0?e.removedIds=N.cloneRevisions(this.revisions):e.removedIds=this.removedIds.slice(),e.width=this.width,e.height=this.height,this.contentControlProperties&&(e.contentControlProperties=this.contentControlProperties),e},t.prototype.destroy=function(){this.text=void 0,e.prototype.destroy.call(this)},t}(Ce),Ne=function(){function e(){this.separator=[],this.continuationNotice=[],this.continuationSeparator=[]}return e.prototype.clear=function(){this.separator=[],this.continuationSeparator=[],this.continuationNotice=[]},e.prototype.destroy=function(){this.separator=[],this.continuationSeparator=[],this.continuationNotice=[]},e}(),Ee=function(e){function t(){var t=e.call(this)||this;return t.isLayout=!1,t.blocks=[],t}return se(t,e),t.prototype.clone=function(){var e=new t;return e.text=this.text,e.characterFormat.copyFormat(this.characterFormat),e.height=this.height,e.footnoteType=this.footnoteType,e.width=this.width,e.symbolCode=this.symbolCode,e.blocks=this.blocks,this.margin&&(e.margin=this.margin.clone()),e},t.prototype.getLength=function(){return 1},t.prototype.destroy=function(){this.symbolCode="",this.symbolFontName="",this.customMarker=""},t}(Ie),He=function(e){function t(){var t=e.call(this)||this;return t.startIn=void 0,t.endIn=void 0,t}return se(t,e),Object.defineProperty(t.prototype,"start",{get:function(){return this.startIn},set:function(e){this.startIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"end",{get:function(){return this.endIn},set:function(e){this.endIn=e},enumerable:!0,configurable:!0}),t.prototype.destroy=function(){this.start=void 0,this.end=void 0},t}(Ie),We=function(e){function t(){var t=e.call(this)||this;return t.fieldText="",t}return se(t,e),Object.defineProperty(t.prototype,"text",{get:function(){return this.fieldText},set:function(e){this.fieldText=e},enumerable:!0,configurable:!0}),t.prototype.clone=function(){var e=new t;return e.characterFormat.copyFormat(this.characterFormat),e.fieldBegin=this.fieldBegin,e.text=this.text,this.margin&&(e.margin=this.margin.clone()),this.revisions.length>0?e.removedIds=N.cloneRevisions(this.revisions):e.removedIds=this.removedIds.slice(),e.width=this.width,e.height=this.height,e},t}(Ie),Oe=function(e){function t(){var t=e.call(this)||this;return t.tabText="",t.tabLeader="None",t}return se(t,e),t.prototype.destroy=function(){this.tabText=void 0,this.tabLeader=void 0},t.prototype.clone=function(){var e=new t;return e.characterFormat.copyFormat(this.characterFormat),e.tabText=this.tabText,e.tabLeader=this.tabLeader,e.text=this.text,this.margin&&(e.margin=this.margin.clone()),e.width=this.width,e.height=this.height,this.revisions.length>0?e.removedIds=N.cloneRevisions(this.revisions):e.removedIds=this.removedIds.slice(),e},t}(Ie),ke=function(e){function t(t){var i=e.call(this)||this;return i.bookmarkTypeIn=0,i.refereneceIn=void 0,i.nameIn="",i.bookmarkTypeIn=t,i}return se(t,e),Object.defineProperty(t.prototype,"bookmarkType",{get:function(){return this.bookmarkTypeIn},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this.nameIn},set:function(e){this.nameIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"reference",{get:function(){return this.refereneceIn},set:function(e){this.refereneceIn=e},enumerable:!0,configurable:!0}),t.prototype.getLength=function(){return 1},t.prototype.destroy=function(){this.name=void 0,this.reference=void 0,this.bookmarkTypeIn=void 0},t.prototype.clone=function(){var e=new t(this.bookmarkType);return e.name=this.name,e.reference=this.reference,this.margin&&(e.margin=this.margin.clone()),e.width=this.width,e.height=this.height,this.contentControlProperties&&(e.contentControlProperties=this.contentControlProperties),e},t}(Ce),Le=function(e){function t(t){var i=e.call(this)||this;return i.contentControlWidgetType=t,i.contentControlProperties=new Be(t),i}return se(t,e),t.prototype.getLength=function(){return 1},t.prototype.clone=function(){var e=new t(this.contentControlWidgetType);return e.characterFormat.copyFormat(this.characterFormat),e.contentControlProperties=this.contentControlProperties,e.contentControlWidgetType=this.contentControlWidgetType,this.margin&&(e.margin=this.margin.clone()),this.revisions.length>0?e.removedIds=N.cloneRevisions(this.revisions):e.removedIds=this.removedIds.slice(),e.type=this.type,e.width=this.width,e.height=this.height,e.reference=this.reference,e},t.prototype.destroy=function(){this.contentControlProperties=void 0,this.contentControlWidgetType=void 0,e.prototype.destroy.call(this)},t}(Ce),Be=function(){function e(e){this.contentControlListItems=[],this.contentControlWidgetType=e,this.characterFormat=new H}return e.prototype.destroy=function(){this.lockContentControl=void 0,this.lockContents=void 0,this.tag=void 0,this.color=void 0,this.title=void 0,this.appearance=void 0,this.type=void 0,this.hasPlaceHolderText=void 0,this.multiline=void 0,this.isTemporary=void 0,this.isChecked=void 0,this.dateCalendarType=void 0,this.dateStorageFormat=void 0,this.dateDisplayLocale=void 0,this.dateDisplayFormat=void 0},e.prototype.clone=function(){var t=new e(this.contentControlWidgetType);if(t.lockContentControl=this.lockContentControl,t.lockContents=this.lockContents,t.tag=this.tag,t.color=this.color,t.title=this.title,t.appearance=this.appearance,t.type=this.type,t.hasPlaceHolderText=this.hasPlaceHolderText,t.multiline=this.multiline,t.isTemporary=this.isTemporary,t.isChecked=this.isChecked,t.dateCalendarType=this.dateCalendarType,t.dateStorageFormat=this.dateStorageFormat,t.dateDisplayLocale=this.dateDisplayLocale,t.dateDisplayFormat=this.dateDisplayFormat,this.contentControlListItems.length>0)for(var i=0;i<this.contentControlListItems.length;i++)t.contentControlListItems.push(this.contentControlListItems[i].clone());return this.checkedState&&(t.checkedState=this.checkedState.clone()),this.uncheckedState&&(t.uncheckedState=this.uncheckedState.clone()),this.xmlMapping&&(t.xmlMapping=this.xmlMapping.clone()),t},e}(),Re=function(){function e(){}return e.prototype.destroy=function(){this.displayText=void 0,this.value=void 0},e.prototype.clone=function(){var t=new e;return t.displayText=this.displayText,t.value=this.value,t},e}(),De=function(){function e(){}return e.prototype.destroy=function(){this.font=void 0,this.value=void 0},e.prototype.clone=function(){var t=new e;return t.font=this.font,t.value=this.value,t},e}(),Me=function(){function e(){}return e.prototype.destroy=function(){this.isMapped=void 0,this.isWordMl=void 0,this.prefixMapping=void 0,this.xPath=void 0,this.storeItemId=void 0,this.customXmlPart=void 0},e.prototype.clone=function(){var t=new e;return t.isMapped=this.isMapped,t.isWordMl=this.isWordMl,t.prefixMapping=this.prefixMapping,t.xPath=this.xPath,t.storeItemId=this.storeItemId,this.customXmlPart&&(t.customXmlPart=this.customXmlPart.clone()),t},e}(),Ae=function(){function e(){}return e.prototype.destroy=function(){this.id=void 0,this.xml=void 0},e.prototype.clone=function(){var t=new e;return t.id=this.id,t.xml=this.xml,t},e}(),Ue=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.name="",t.alternativeText="",t.title="",t}return se(t,e),t.prototype.getLength=function(){return 1},t.prototype.clone=function(){return new Ve},t}(Ce),ze=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.verticalPosition=0,t.horizontalPosition=0,t.textWrappingStyle="Inline",t.distanceBottom=0,t.distanceLeft=0,t.distanceRight=0,t.distanceTop=0,t}return se(t,e),t}(Ue),Ve=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return se(t,e),t.prototype.clone=function(){var e=new t;return e.characterFormat.copyFormat(this.characterFormat),e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e.shapeId=this.shapeId,e.name=this.name,e.alternativeText=this.alternativeText,e.title=this.title,e.widthScale=this.widthScale,e.heightScale=this.heightScale,e.visible=this.visible,e.verticalPosition=this.verticalPosition,e.verticalAlignment=this.verticalAlignment,e.verticalOrigin=this.verticalOrigin,e.horizontalPosition=this.horizontalPosition,e.horizontalAlignment=this.horizontalAlignment,e.horizontalOrigin=this.horizontalOrigin,e.zOrderPosition=this.zOrderPosition,e.allowOverlap=this.allowOverlap,e.textWrappingStyle=this.textWrappingStyle,e.textWrappingType=this.textWrappingType,e.distanceBottom=this.distanceBottom,e.distanceLeft=this.distanceLeft,e.distanceRight=this.distanceRight,e.distanceTop=this.distanceTop,e.layoutInCell=this.layoutInCell,e.lockAnchor=this.lockAnchor,e.autoShapeType=this.autoShapeType,this.lineFormat&&(e.lineFormat=this.lineFormat.clone()),this.fillFormat&&(e.fillFormat=this.fillFormat.clone()),this.textFrame&&(e.textFrame=this.textFrame.clone(),e.textFrame.containerShape=e),this.margin&&(e.margin=this.margin.clone()),e},t}(ze),_e=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.marginLeft=0,t.marginRight=0,t.marginTop=0,t.marginBottom=0,t}return se(t,e),t.prototype.equals=function(){return!1},t.prototype.destroyInternal=function(){},t.prototype.getHierarchicalIndex=function(e){var t=this.containerShape.line,i=t.getOffset(this.containerShape,0).toString();return t.getHierarchicalIndex(i)},t.prototype.getTableCellWidget=function(){},t.prototype.clone=function(){var e=new t;e.textVerticalAlignment=this.textVerticalAlignment,e.marginBottom=this.marginBottom,e.marginLeft=this.marginLeft,e.marginRight=this.marginRight,e.marginTop=this.marginTop;for(var i=0;i<this.childWidgets.length;i++){var n=this.childWidgets[i].clone();e.childWidgets.push(n),n.index=i,n.containerWidget=e}return e},t}(he),je=function(){function e(){}return e.prototype.clone=function(){var t=new e;return t.lineFormatType=this.lineFormatType,t.color=this.color,t.weight=this.weight,t.dashStyle=this.dashStyle,t.line=this.line,t},e}(),qe=function(){function e(){}return e.prototype.clone=function(){var t=new e;return t.color=this.color,t.fill=this.fill,t},e}(),Ge=function(e){function i(t){var i=e.call(this)||this;return i.imageStr="",i.imgElement=void 0,i.isInlineImageIn=!0,i.isCrop=!1,i.left=0,i.top=0,i.right=0,i.bottom=0,i.isMetaFile=!1,i.isCompressed=!1,i.isInlineImageIn=t,i}return se(i,e),Object.defineProperty(i.prototype,"isInlineImage",{get:function(){return this.isInlineImageIn},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"element",{get:function(){return t.isNullOrUndefined(this.imgElement)&&(this.imgElement=document.createElement("img")),this.imgElement},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"length",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"imageString",{get:function(){return this.imageStr},set:function(e){this.imageStr=e,t.isNullOrUndefined(e)||(this.element.src=this.imageStr)},enumerable:!0,configurable:!0}),i.prototype.getLength=function(){return 1},i.prototype.clone=function(){var e=new i(this.isInlineImage);return e.characterFormat.copyFormat(this.characterFormat),e.imageString=this.imageString,e.isMetaFile=this.isMetaFile,e.isCompressed=this.isCompressed,e.metaFileImageString=this.metaFileImageString,e.width=this.width,e.height=this.height,this.isCrop&&(e.top=this.top,e.left=this.left,e.bottom=this.bottom,e.right=this.right,e.isCrop=this.isCrop,e.cropHeightScale=this.cropHeightScale,e.cropWidthScale=this.cropWidthScale),this.margin&&(e.margin=this.margin.clone()),this.revisions.length>0?e.removedIds=N.cloneRevisions(this.revisions):e.removedIds=this.removedIds.slice(),e.name=this.name,e.alternativeText=this.alternativeText,e.title=this.title,e.visible=this.visible,e.widthScale=this.widthScale,e.heightScale=this.heightScale,e.verticalPosition=this.verticalPosition,e.verticalOrigin=this.verticalOrigin,e.verticalAlignment=this.verticalAlignment,e.horizontalPosition=this.horizontalPosition,e.horizontalOrigin=this.horizontalOrigin,e.horizontalAlignment=this.horizontalAlignment,e.allowOverlap=this.allowOverlap,e.textWrappingStyle=this.textWrappingStyle,e.textWrappingType=this.textWrappingType,e.layoutInCell=this.layoutInCell,e},i.prototype.destroy=function(){this.imgElement=void 0,this.imageString=void 0,this.isInlineImageIn=void 0,e.prototype.destroy.call(this)},i}(ze),Ke=function(e){function t(t,i){var n=e.call(this)||this;return n.baselineOffset=0,n.trimEndWidth=0,n.isFollowCharacter=!1,n.listLevel=t,n.isFollowCharacter=i,n}return se(t,e),t.prototype.getLength=function(){return this.text?this.text.length:0},t.prototype.clone=function(){var e=new t(this.listLevel,this.isFollowCharacter);return e.text=this.text,e.baselineOffset=this.baselineOffset,this.margin&&(e.margin=this.margin.clone()),e.width=this.width,e.height=this.height,e},t.prototype.destroy=function(){this.text=void 0,e.prototype.destroy.call(this)},t}(Ce),Xe=function(e){function t(){var t=e.call(this)||this;return t.editRangeStart=void 0,t.editRangeId=-1,t}return se(t,e),t.prototype.getLength=function(){return 1},t.prototype.destroy=function(){this.editRangeStart=void 0},t.prototype.clone=function(){var e=new t;return e.editRangeStart=this.editRangeStart,e.editRangeId=this.editRangeId,e},t}(Ce),Ye=function(e){function i(){var t=e.call(this)||this;return t.columnFirst=-1,t.columnLast=-1,t.user="",t.group="",t.editRangeId=-1,t}return se(i,e),i.prototype.getLength=function(){return 1},i.prototype.renderLockMark=function(e,i){if(t.isNullOrUndefined(this.editRangeMark)){var n=e===this.user?"you":this.user;this.editRangeMark=document.createElement("div"),this.editRangeMark.style.display="none",this.editRangeMark.classList.add("e-de-lock-mark");var r=document.createElement("span");r.className="e-icons e-de-ctnr-lock",this.editRangeMark.appendChild(r),this.editRangeMark.title=i.getConstant("This region is locked by")+" "+n}this.line&&t.isNullOrUndefined(this.editRangeMark.parentElement)&&this.line.paragraph.bodyWidget.page.documentHelper.pageContainer.appendChild(this.editRangeMark)},i.prototype.removeEditRangeMark=function(){this.editRangeMark&&(this.editRangeMark.parentElement.removeChild(this.editRangeMark),this.editRangeMark=void 0)},i.prototype.destroy=function(){this.user=void 0,this.columnFirst=void 0,this.columnLast=void 0},i.prototype.clone=function(){var e=new i;return e.columnFirst=this.columnFirst,e.columnLast=this.columnLast,e.user=this.user,e.group=this.group,e.editRangeEnd=this.editRangeEnd,e.editRangeId=this.editRangeId,e},i}(Ce),Je=function(e){function i(){var t=e.call(this)||this;return t.chartTitle="",t.chartType="",t.chartElement=void 0,t.chartCategory=[],t.chartSeries=[],t.chartArea=new Ze,t.chartPlotArea=new Ze,t.chartTitleArea=new st,t.chartLegend=new et,t.chartPrimaryCategoryAxis=new ht,t.chartPrimaryValueAxis=new ht,t.chartDataTable=new ct,t}return se(i,e),i.prototype.getLength=function(){return 1},Object.defineProperty(i.prototype,"title",{get:function(){return this.chartTitle},set:function(e){this.chartTitle=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"type",{get:function(){return this.chartType},set:function(e){this.chartType=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"chartGapWidth",{get:function(){return this.gapWidth},set:function(e){this.gapWidth=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"chartOverlap",{get:function(){return this.overlap},set:function(e){this.overlap=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"targetElement",{get:function(){return t.isNullOrUndefined(this.div)&&(this.div=t.createElement("div")),this.div},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"officeChart",{get:function(){return this.officeChartInternal},set:function(e){e&&(this.officeChartInternal=e,this.officeChartInternal.chart.loaded=this.onChartLoaded.bind(this))},enumerable:!0,configurable:!0}),i.prototype.onChartLoaded=function(){var e=this;this.officeChart.convertChartToImage(this.officeChart.chart,this.width,this.height).then(function(t){e.imageString=t})},i.prototype.clone=function(){var e=new i;e.chartTitle=this.chartTitle,e.chartType=this.chartType,e.height=this.height,e.width=this.width,e.gapWidth=this.gapWidth,e.overlap=this.overlap;for(n=0;n<this.chartCategory.length;n++){var t=this.chartCategory[n].clone();e.chartCategory.push(t)}for(var n=0;n<this.chartSeries.length;n++){var r=this.chartSeries[n].clone();e.chartSeries.push(r)}return e.chartArea=this.chartArea.clone(),e.chartPlotArea=this.chartPlotArea.clone(),e.chartLegend=this.chartLegend.clone(),e.chartTitleArea=this.chartTitleArea.clone(),e.chartPrimaryCategoryAxis=this.chartPrimaryCategoryAxis.clone(),e.chartPrimaryValueAxis=this.chartPrimaryValueAxis.clone(),e.chartDataTable=this.chartDataTable.clone(),e},i.prototype.destroy=function(){e.prototype.destroy.call(this),this.officeChartInternal&&(this.officeChartInternal.chart.loaded=void 0,this.officeChartInternal.destroy(),this.officeChartInternal=void 0),this.div&&(this.div=void 0),this.chartTitle=void 0,this.chartType=void 0,this.chartArea=void 0,this.chartPlotArea=void 0,this.chartCategory=[],this.chartSeries=[],this.chartTitleArea=void 0,this.chartLegend=void 0,this.chartPrimaryCategoryAxis=void 0,this.chartPrimaryValueAxis=void 0,this.chartDataTable=void 0,this.chartElement=void 0},i}(Ge),Ze=function(){function e(){}return Object.defineProperty(e.prototype,"chartForeColor",{get:function(){return this.foreColor},set:function(e){this.foreColor=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){var t=new e;return t.foreColor=this.foreColor,t},e.prototype.destroy=function(){this.foreColor=void 0},e}(),Qe=function(){function e(){this.categoryXName="",this.chartData=[]}return Object.defineProperty(e.prototype,"xName",{get:function(){return this.categoryXName},set:function(e){this.categoryXName=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){var t=new e;t.categoryXName=this.categoryXName;for(var i=0;i<this.chartData.length;i++){var n=this.chartData[i].clone();t.chartData.push(n)}return t},e.prototype.destroy=function(){this.categoryXName=void 0,this.chartData=[]},e}(),$e=function(){function e(){}return Object.defineProperty(e.prototype,"yAxisValue",{get:function(){return this.yValue},set:function(e){this.yValue=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"xAxisValue",{get:function(){return this.xValue},set:function(e){this.xValue=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bubbleSize",{get:function(){return this.size},set:function(e){this.size=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){var t=new e;return t.yValue=this.yValue,t.xValue=this.xValue,t.size=this.size,t},e.prototype.destroy=function(){this.xValue=void 0,this.yValue=void 0,this.size=void 0},e}(),et=function(){function e(){this.chartTitleArea=new st}return Object.defineProperty(e.prototype,"chartLegendPostion",{get:function(){return this.legendPostion},set:function(e){this.legendPostion=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){var t=new e;return t.legendPostion=this.legendPostion,t.chartTitleArea=this.chartTitleArea.clone(),t},e.prototype.destroy=function(){this.legendPostion=void 0,this.chartTitleArea=void 0},e}(),tt=function(){function e(){this.chartDataFormat=[],this.trendLines=[],this.errorBar=new it,this.dataLabels=new rt,this.seriesFormat=new nt}return Object.defineProperty(e.prototype,"seriesName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstSliceAngle",{get:function(){return this.sliceAngle},set:function(e){this.sliceAngle=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"doughnutHoleSize",{get:function(){return this.holeSize},set:function(e){this.holeSize=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){var t=new e;t.name=this.name,t.sliceAngle=this.sliceAngle,t.holeSize=this.holeSize,t.errorBar=this.errorBar.clone(),t.dataLabels=this.dataLabels.clone(),t.seriesFormat=this.seriesFormat.clone();for(n=0;n<this.chartDataFormat.length;n++){var i=this.chartDataFormat[n].clone();t.chartDataFormat.push(i)}for(var n=0;n<this.trendLines.length;n++){var r=this.trendLines[n].clone();t.trendLines.push(r)}return t},e.prototype.destroy=function(){this.name=void 0,this.errorBar=void 0,this.trendLines=void 0,this.chartDataFormat=[]},e}(),it=function(){function e(){}return Object.defineProperty(e.prototype,"errorType",{get:function(){return this.type},set:function(e){this.type=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errorDirection",{get:function(){return this.direction},set:function(e){this.direction=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errorEndStyle",{get:function(){return this.endStyle},set:function(e){this.endStyle=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numberValue",{get:function(){return this.errorValue},set:function(e){this.errorValue=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){var t=new e;return t.type=this.type,t.errorDirection=this.errorDirection,t.endStyle=this.endStyle,t.errorValue=this.errorValue,t},e.prototype.destroy=function(){this.type=void 0,this.errorDirection=void 0,this.endStyle=void 0},e}(),nt=function(){function e(){}return Object.defineProperty(e.prototype,"markerStyle",{get:function(){return this.style},set:function(e){this.style=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"markerColor",{get:function(){return this.color},set:function(e){this.color=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"numberValue",{get:function(){return this.size},set:function(e){this.size=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){var t=new e;return t.style=this.style,t.color=this.color,t.size=this.size,t},e.prototype.destroy=function(){this.style=void 0,this.color=void 0,this.size=void 0},e}(),rt=function(){function e(){}return Object.defineProperty(e.prototype,"labelPosition",{get:function(){return this.position},set:function(e){this.position=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontColor",{get:function(){return this.color},set:function(e){this.color=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontSize",{get:function(){return this.size},set:function(e){this.size=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isLegendKey",{get:function(){return this.isLegend},set:function(e){this.isLegend=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isBubbleSize",{get:function(){return this.isBubble},set:function(e){this.isBubble=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isCategoryName",{get:function(){return this.isCategory},set:function(e){this.isCategory=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isSeriesName",{get:function(){return this.isSeries},set:function(e){this.isSeries=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isValue",{get:function(){return this.isValueEnabled},set:function(e){this.isValueEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isPercentage",{get:function(){return this.isPercentageEnabled},set:function(e){this.isPercentageEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isLeaderLines",{get:function(){return this.showLeaderLines},set:function(e){this.showLeaderLines=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){var t=new e;return t.position=this.position,t.name=this.name,t.color=this.color,t.size=this.size,t.isBubble=this.isBubble,t.isLegend=this.isLegend,t.isCategory=this.isCategory,t.isSeries=this.isSeries,t.isValueEnabled=this.isValueEnabled,t.isPercentageEnabled=this.isPercentageEnabled,t.showLeaderLines=this.showLeaderLines,t},e.prototype.destroy=function(){this.position=void 0},e}(),ot=function(){function e(){}return Object.defineProperty(e.prototype,"trendLineType",{get:function(){return this.type},set:function(e){this.type=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"trendLineName",{get:function(){return this.name},set:function(e){this.name=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"interceptValue",{get:function(){return this.intercept},set:function(e){this.intercept=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"forwardValue",{get:function(){return this.forward},set:function(e){this.forward=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"backwardValue",{get:function(){return this.backward},set:function(e){this.backward=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDisplayRSquared",{get:function(){return this.displayRSquared},set:function(e){this.displayRSquared=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isDisplayEquation",{get:function(){return this.displayEquation},set:function(e){this.displayEquation=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){var t=new e;return t.type=this.type,t.name=this.name,t.forward=this.forward,t.backward=this.backward,t.intercept=this.intercept,t.displayEquation=this.displayEquation,t.displayRSquared=this.displayRSquared,t},e.prototype.destroy=function(){this.type=void 0,this.name=void 0,this.forward=void 0,this.backward=void 0},e}(),st=function(){function e(){this.dataFormat=new at,this.layout=new dt}return Object.defineProperty(e.prototype,"chartfontName",{get:function(){return this.fontName},set:function(e){this.fontName=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"chartFontSize",{get:function(){return this.fontSize},set:function(e){this.fontSize=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){var t=new e;return t.fontName=this.fontName,t.fontSize=this.fontSize,t.dataFormat=this.dataFormat.clone(),t.layout=this.layout.clone(),t},e.prototype.destroy=function(){this.fontName=void 0,this.fontSize=void 0,this.dataFormat=void 0,this.layout=void 0},e}(),at=function(){function e(){this.fill=new lt,this.line=new lt}return e.prototype.clone=function(){var t=new e;return t.fill=this.fill.clone(),t.line=this.line.clone(),t},e.prototype.destroy=function(){this.fill=void 0,this.line=void 0},e}(),lt=function(){function e(){}return Object.defineProperty(e.prototype,"color",{get:function(){return this.fillColor},set:function(e){this.fillColor=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rgb",{get:function(){return this.fillRGB},set:function(e){this.fillRGB=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){var t=new e;return t.fillColor=this.fillColor,t.fillRGB=this.fillRGB,t},e.prototype.destroy=function(){this.fillColor=void 0,this.fillRGB=void 0},e}(),dt=function(){function e(){}return Object.defineProperty(e.prototype,"chartLayoutLeft",{get:function(){return this.layoutX},set:function(e){this.layoutX=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"chartLayoutTop",{get:function(){return this.layoutY},set:function(e){this.layoutY=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){var t=new e;return t.layoutX=this.layoutX,t.layoutY=this.layoutY,t},e.prototype.destroy=function(){this.layoutX=void 0,this.layoutY=void 0},e}(),ht=function(){function e(){this.chartTitleArea=new st}return Object.defineProperty(e.prototype,"majorTick",{get:function(){return this.majorTickMark},set:function(e){this.majorTickMark=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minorTick",{get:function(){return this.minorTickMark},set:function(e){this.minorTickMark=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tickPosition",{get:function(){return this.tickLabelPostion},set:function(e){this.tickLabelPostion=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minorGridLines",{get:function(){return this.hasMinorGridLines},set:function(e){this.hasMinorGridLines=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"majorGridLines",{get:function(){return this.hasMajorGridLines},set:function(e){this.hasMajorGridLines=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"interval",{get:function(){return this.majorUnit},set:function(e){this.majorUnit=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"max",{get:function(){return this.maximumValue},set:function(e){this.maximumValue=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"min",{get:function(){return this.minimumValue},set:function(e){this.minimumValue=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"categoryAxisTitle",{get:function(){return this.title},set:function(e){this.title=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"categoryAxisType",{get:function(){return this.categoryType},set:function(e){this.categoryType=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"categoryNumberFormat",{get:function(){return this.numberFormat},set:function(e){this.numberFormat=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"axisFontSize",{get:function(){return this.fontSize},set:function(e){this.fontSize=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"axisFontName",{get:function(){return this.fontName},set:function(e){this.fontName=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){var t=new e;return t.title=this.title,t.categoryType=this.categoryType,t.numberFormat=this.numberFormat,t.fontSize=this.fontSize,t.fontName=this.fontName,t.hasMajorGridLines=this.hasMajorGridLines,t.hasMinorGridLines=this.hasMinorGridLines,t.minimumValue=this.minimumValue,t.maximumValue=this.maximumValue,t.majorUnit=this.majorUnit,t.majorTickMark=this.majorTickMark,t.minorTickMark=this.minorTickMark,t.tickLabelPostion=this.tickLabelPostion,t.chartTitleArea=this.chartTitleArea.clone(),t},e.prototype.destroy=function(){this.title=void 0,this.categoryType=void 0,this.numberFormat=void 0,this.chartTitleArea=void 0,this.minimumValue=void 0,this.maximumValue=void 0,this.fontSize=void 0,this.fontName=void 0,this.majorUnit=void 0,this.majorTickMark=void 0,this.minorTickMark=void 0,this.tickLabelPostion=void 0},e}(),ct=function(){function e(){}return Object.defineProperty(e.prototype,"showSeriesKeys",{get:function(){return this.isSeriesKeys},set:function(e){this.isSeriesKeys=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasHorzBorder",{get:function(){return this.isHorzBorder},set:function(e){this.isHorzBorder=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasVertBorder",{get:function(){return this.isVertBorder},set:function(e){this.isVertBorder=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasBorders",{get:function(){return this.isBorders},set:function(e){this.isBorders=e},enumerable:!0,configurable:!0}),e.prototype.clone=function(){var t=new e;return t.isSeriesKeys=this.isSeriesKeys,t.isHorzBorder=this.isHorzBorder,t.isVertBorder=this.isVertBorder,t.isBorders=this.isBorders,t},e.prototype.destroy=function(){this.isSeriesKeys=void 0,this.isHorzBorder=void 0,this.isVertBorder=void 0,this.isBorders=void 0},e}(),pt=function(e){function i(t){var i=e.call(this)||this;return i.commentType=0,i.commentId="",i.commentType=t,i}return se(i,e),Object.defineProperty(i.prototype,"comment",{get:function(){return this.commentInternal},set:function(e){this.commentInternal=e},enumerable:!0,configurable:!0}),i.prototype.getLength=function(){return 1},i.prototype.clone=function(){var e=new i(this.commentType);return e.commentId=this.commentId,e.commentType=this.commentType,e},i.prototype.renderCommentMark=function(){if(0===this.commentType&&t.isNullOrUndefined(this.commentMark)){this.commentMark=document.createElement("div"),this.commentMark.style.display="none",this.commentMark.classList.add("e-de-cmt-mark");var e=document.createElement("span");e.classList.add("e-icons"),e.classList.add("e-de-cmt-mark-icon"),this.commentMark.appendChild(e)}this.line&&t.isNullOrUndefined(this.commentMark.parentElement)&&(this.line.paragraph.bodyWidget.page.documentHelper.pageContainer.appendChild(this.commentMark),this.commentMark.addEventListener("click",this.selectComment.bind(this)))},i.prototype.selectComment=function(){var e=this.line.paragraph.bodyWidget.page.documentHelper;e.owner&&(e.owner.commentReviewPane.commentPane.isEditMode?e.owner.showComments=!0:e.selectComment(this.comment))},i.prototype.removeCommentMark=function(){this.commentMark&&this.commentMark.parentElement&&(this.commentMark.removeEventListener("click",this.selectComment.bind(this)),this.commentMark.parentElement.removeChild(this.commentMark))},i.prototype.destroy=function(){this.commentMark&&this.removeCommentMark()},i}(Ce),ut=function(e){function t(t){var i=e.call(this,0)||this;return i.authorIn="",i.initialIn="",i.done=!1,i.textIn="",i.isReply=!1,i.ownerComment=void 0,i.createdDate=t,i.replyComments=[],i}return se(t,e),Object.defineProperty(t.prototype,"commentStart",{get:function(){return this.commentStartIn},set:function(e){this.commentStartIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"commentEnd",{get:function(){return this.commentEndIn},set:function(e){this.commentEndIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"author",{get:function(){return this.authorIn},set:function(e){this.authorIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"initial",{get:function(){return this.initialIn},set:function(e){this.initialIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isResolved",{get:function(){return this.done},set:function(e){this.done=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"date",{get:function(){return this.createdDate},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"text",{get:function(){return this.textIn},set:function(e){this.textIn=e},enumerable:!0,configurable:!0}),t.prototype.getLength=function(){return 1},t.prototype.clone=function(){var e=new t(this.date);return e.author=this.author,e.initial=this.initial,e.commentId=this.commentId,e.replyComments=this.replyComments,e.isResolved=this.isResolved,e.text=this.text,e},t.prototype.destroy=function(){this.ownerComment=void 0},t}(pt),gt=function(){function e(e){this.boundingRectangle=new ae(96,96,816,1056),this.repeatHeaderRowTableWidget=!1,this.bodyWidgets=[],this.headerWidget=void 0,this.footerWidget=void 0,this.footnoteWidget=void 0,this.endnoteWidget=void 0,this.currentPageNum=1,this.allowNextPageRendering=!0,this.documentHelper=e}return Object.defineProperty(e.prototype,"index",{get:function(){return this.documentHelper?this.documentHelper.pages.indexOf(this):-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"previousPage",{get:function(){var e=this.index;if(e>0)return this.documentHelper.pages[e-1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"nextPage",{get:function(){var e=this.index;if(e<this.documentHelper.pages.length-1)return this.documentHelper.pages[e+1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sectionIndex",{get:function(){return this.bodyWidgets.length>0?this.bodyWidgets[0].index:-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewer",{get:function(){return this.documentHelper.owner.viewer},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){this.headerWidget&&(this.viewer&&this.documentHelper.owner.editor&&(this.documentHelper.owner.editor.removeFieldInWidget(this.headerWidget),this.documentHelper.owner.editor.removeFieldInWidget(this.headerWidget,!1,!0)),this.headerWidget.destroy()),this.headerWidget=void 0,this.footerWidget&&(this.viewer&&this.documentHelper.owner.editor&&(this.documentHelper.owner.editor.removeFieldInWidget(this.footerWidget),this.documentHelper.owner.editor.removeFieldInWidget(this.footerWidget,!1,!0)),this.footerWidget.destroy()),this.footerWidget=void 0,this.bodyWidgets=[],this.bodyWidgets=void 0,t.isNullOrUndefined(this.documentHelper)||t.isNullOrUndefined(this.documentHelper.pages)||this.documentHelper.removePage(this),this.documentHelper=void 0},e}(),mt=function(){function e(){this.tableColumns=[],this.tableWidth=0}return Object.defineProperty(e.prototype,"columns",{get:function(){return this.tableColumns},enumerable:!0,configurable:!0}),e.prototype.resetColumns=function(){for(var e=0;e<this.tableColumns.length;e++)this.tableColumns[e].destroy();this.tableColumns=[]},e.prototype.getPreviousSpannedCellWidth=function(e,t){for(var i=0,n=e;n<t;n++)i+=this.tableColumns[n].preferredWidth;return i},e.prototype.addColumns=function(e,t,i,n,r){for(var o=this.columns.length;o<t;o++)this.columns.push(new ft);for(var s=0,a=e;a<t;a++)s+=this.columns[a].preferredWidth;!(t-e>1)&&s<i&&(this.columns[t-1].preferredWidth+=i-s),n.minimumWordWidth>this.columns[t-1].minimumWordWidth&&(this.columns[t-1].minimumWordWidth=n.minimumWordWidth),n.maximumWordWidth>this.columns[t-1].maximumWordWidth&&(this.columns[t-1].maximumWordWidth=n.maximumWordWidth),n.minimumWidth>this.columns[t-1].minimumWidth&&(this.columns[t-1].minimumWidth=n.minimumWidth),r>this.columns[t-1].endOffset&&(this.columns[t-1].endOffset=r)},e.prototype.getTotalWidth=function(e){for(var t=0,i=0;i<this.columns.length;i++){var n=this.columns[i];t+=0===e?n.preferredWidth:1===e?n.minimumWordWidth:2===e?n.maximumWordWidth:n.minimumWidth}return t},e.prototype.isFitColumns=function(e,t,i){var n=this.getTotalWidth(0);if(this.tableWidth=i&&t>n?n:t,n!==this.tableWidth){var r=this.tableWidth/n;r=isNaN(r)||r===1/0?1:r;for(var o=0;o<this.columns.length;o++){var s=this.columns[o];if(r*s.preferredWidth<s.minWidth)return!1}return!0}return!0},e.prototype.autoFitColumn=function(e,t,i,n){for(var r=0,o=0,s=0,a=0;a<this.columns.length;a++){0===(f=this.columns[a]).minimumWordWidth&&0===f.maximumWordWidth&&0===f.minWidth&&(f.minimumWordWidth=f.preferredWidth,f.maximumWordWidth=f.preferredWidth,f.minWidth=f.preferredWidth),r+=f.preferredWidth>f.maximumWordWidth?f.preferredWidth:f.maximumWordWidth,o+=f.preferredWidth>f.minimumWordWidth?f.preferredWidth:f.minimumWordWidth;var l=0===f.preferredWidth?f.minimumWordWidth:f.preferredWidth>f.minimumWordWidth?f.preferredWidth:f.minimumWordWidth;s+=(d=f.maximumWordWidth-l)>0?d:0}if(r<=t){for(a=0;a<this.columns.length;a++)(f=this.columns[a]).preferredWidth<f.maximumWordWidth&&(f.preferredWidth=n?f.minimumWidth+f.minimumWordWidth:f.maximumWordWidth);i||this.fitColumns(e,t,i)}else{if(!i)return void this.fitColumns(e,t,i);if(o<=t||o<=e){m=e>t?e:t;m-=o;for(a=0;a<this.columns.length;a++)if(0===(f=this.columns[a]).preferredWidth)f.preferredWidth=f.minimumWordWidth;else if(f.preferredWidth<f.minimumWordWidth&&(f.preferredWidth=f.minimumWordWidth),!n){var d=f.maximumWordWidth-f.preferredWidth,h=m*((d=d>0?d:0)/s);f.preferredWidth+=isNaN(h)?0:h}}else{var c=this.getTotalWidth(1),p=this.getTotalWidth(3),u=this.getTotalWidth(0);if(p>2112)for(var g=2112/this.columns.length,a=0;a<this.columns.length;a++)this.columns[a].preferredWidth=g;else{var m=0;if(p<e){m=e-p;for(a=0;a<this.columns.length;a++){h=m*(f=this.columns[a]).minimumWordWidth/c;h=isNaN(h)?0:h,f.preferredWidth<=f.minimumWidth||(f.preferredWidth=f.minimumWidth+h)}}else if(u>e)for(var h=e/u,a=0;a<this.columns.length;a++){var f=this.columns[a];f.preferredWidth=f.preferredWidth*h}}}}this.tableWidth=this.getTotalWidth(0)},e.prototype.fitColumns=function(e,i,n,r){t.isNullOrUndefined(r)&&(r=0);var o=this.getTotalWidth(0);if(n&&(o-=r),this.tableWidth=n?o:i,o!==this.tableWidth){var s=this.tableWidth/o;s=isNaN(s)||s===1/0?1:s;for(var a=0;a<this.columns.length;a++){var l=this.columns[a];l.preferredWidth=s*l.preferredWidth}}},e.prototype.getCellWidth=function(e,t,i){for(var n=0,r=0;r<t;r++)n+=this.tableColumns[r+e].preferredWidth;return n},e.prototype.validateColumnWidths=function(){for(var e=0;e<this.columns.length;e++)0===e?this.columns[e].preferredWidth!==this.columns[e].endOffset&&(this.columns[e].preferredWidth=this.columns[e].endOffset):this.columns[e-1].endOffset+this.columns[e].preferredWidth<this.columns[e].endOffset&&(this.columns[e].preferredWidth=this.columns[e].endOffset-this.columns[e-1].endOffset)},e.prototype.clone=function(){var t=new e;t.tableWidth=this.tableWidth;for(var i=0;i<this.columns.length;i++)t.columns.push(this.columns[i].clone());return t},e.prototype.destroy=function(){if(!t.isNullOrUndefined(this.tableColumns))for(var e=0;e<this.tableColumns.length;e++)this.tableColumns[e].destroy();this.tableColumns=[],this.tableColumns=void 0,this.tableWidth=void 0},e}(),ft=function(){function e(){this.preferredWidth=0,this.minWidth=0,this.maxWidth=0,this.endOffset=0,this.minimumWordWidth=0,this.maximumWordWidth=0,this.minimumWidth=0}return e.prototype.clone=function(){var t=new e;return t.preferredWidth=this.preferredWidth,t.minWidth=this.minWidth,t.maxWidth=this.maxWidth,t},e.prototype.destroy=function(){this.preferredWidth=void 0,this.minWidth=void 0,this.maxWidth=void 0},e}(),vt=function(){function e(){this.minimumWordWidth=0,this.maximumWordWidth=0,this.minimumWidth=0,this.hasMinimumWidth=!1,this.hasMinimumWordWidth=!1,this.hasMaximumWordWidth=!1}return e}(),yt=function(){function e(e){var i=this;this.contextMenuInstance=void 0,this.menuItems=[],this.customMenuItems=[],this.ids=[],this.spellContextItems=[],this.customItems=[],this.onContextMenuInternal=function(e){MouseEvent;if(i.documentHelper.owner.isSpellCheck&&i.spellChecker.allowSpellCheckAndSuggestion){e.preventDefault(),i.currentContextInfo=i.spellChecker.findCurretText();var n,r,o=i.spellChecker.manageSpecialCharacters(i.currentContextInfo.text,void 0,!0);!t.isNullOrUndefined(o)&&i.spellChecker.errorWordCollection.containsKey(o)?(i.spellChecker.currentContextInfo=i.currentContextInfo,i.spellChecker.errorSuggestions.containsKey(o)?(r=i.spellChecker.errorSuggestions.get(o).slice(),n=i.spellChecker.handleSuggestions(r),i.processSuggestions(r,n,e)):i.spellChecker.enableOptimizedSpellCheck?i.spellChecker.callSpellChecker(i.spellChecker.languageID,o,!1,!0,!1,!1).then(function(s){var a=JSON.parse(s);r=a.Suggestions,t.isNullOrUndefined(r)||(i.spellChecker.errorSuggestions.add(o,r.slice()),n=i.spellChecker.handleSuggestions(r)),i.processSuggestions(r,n,e)}):i.processSuggestions(r,n,e)):(i.hideSpellContextItems(),i.showContextMenuOnSel(e))}else i.hideSpellContextItems(),i.showContextMenuOnSel(e)},this.documentHelper=e,this.locale=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale),this.locale.setLocale(this.documentHelper.owner.locale),this.initContextMenu(this.locale,this.documentHelper.owner.enableRtl)}return Object.defineProperty(e.prototype,"viewer",{get:function(){return this.documentHelper.owner.viewer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spellChecker",{get:function(){return this.documentHelper.owner.spellChecker},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"ContextMenu"},e.prototype.initContextMenu=function(e,n){var r=this,o=this.documentHelper.owner.element.id;this.contextMenu=document.createElement("div"),this.contextMenu.id=this.documentHelper.owner.containerId+"e-de-contextmenu",document.body.appendChild(this.contextMenu);var s=document.createElement("ul");s.style.width="auto",s.id=this.documentHelper.owner.containerId+"e-de-contextmenu-list",s.style.listStyle="none",s.style.margin="0px",s.style.maxHeight="auto",s.oncontextmenu=this.disableBrowserContextmenu,this.contextMenu.appendChild(s),this.menuItems=[{text:e.getConstant("Lock"),iconCss:"e-icons e-de-ctnr-lock",id:o+"_contextmenu_lock"},{text:e.getConstant("Unlock"),iconCss:"e-icons",id:o+"_contextmenu_unlock"},{text:e.getConstant("Cut"),iconCss:"e-icons e-de-cut",id:o+"_contextmenu_cut"},{text:e.getConstant("Copy"),iconCss:"e-icons e-de-copy",id:o+"_contextmenu_copy"},{text:e.getConstant("Paste"),iconCss:"e-icons e-de-paste",id:o+"_contextmenu_paste"},{separator:!0},{text:e.getConstant("New Comment"),iconCss:"e-icons e-de-cmt-add",id:o+"_add_comment"},{separator:!0},{text:e.getConstant("Accept Changes"),iconCss:"e-icons e-de-acceptchange",id:o+"_contextmenu_accept_changes"},{text:e.getConstant("Reject Changes"),iconCss:"e-icons e-de-rejectchange",id:o+"_contextmenu_reject_changes"},{text:e.getConstant("Update Field"),iconCss:"e-icons e-de-update-field",id:o+"_contextmenu_update_field"},{text:e.getConstant("Edit Field")+"...",iconCss:"e-icons e-de-edit_field",id:o+"_contextmenu_edit_field"},{text:e.getConstant("Continue Numbering"),iconCss:"e-icons e-de-continue-numbering",id:o+"_contextmenu_continue_numbering"},{text:e.getConstant("Restart At")+" 1",iconCss:"e-icons e-de-restart-at",id:o+"_contextmenu_restart_at"},{separator:!0},{text:e.getConstant("Hyperlink")+"...",iconCss:"e-icons e-de-insertlink",id:o+"_contextmenu_hyperlink"},{text:e.getConstant("Edit Hyperlink")+"...",iconCss:"e-icons e-de-edit-hyperlink",id:o+"_contextmenu_edit_hyperlink"},{text:e.getConstant("Open Hyperlink"),iconCss:"e-icons e-de-open-hyperlink",id:o+"_contextmenu_open_hyperlink"},{text:e.getConstant("Copy Hyperlink"),iconCss:"e-icons e-de-copy-hyperlink",id:o+"_contextmenu_copy_hyperlink"},{text:e.getConstant("Remove Hyperlink"),iconCss:"e-icons e-de-remove-hyperlink",id:o+"_contextmenu_remove_hyperlink"},{text:e.getConstant("Properties"),iconCss:"e-icons e-de-formproperties",id:o+"_properties"},{separator:!0},{text:e.getConstant("Font")+"...",iconCss:"e-icons e-de-fonts",id:o+"_contextmenu_font_dialog"},{text:e.getConstant("Paragraph")+"...",iconCss:"e-icons e-de-paragraph",id:o+"_contextmenu_paragraph_dialog"},{text:e.getConstant("Notes Options")+"...",id:o+"_contextmenu_note_options"},{separator:!0},{text:e.getConstant("Table Properties")+"...",id:o+"_contextmenu_table_dialog",iconCss:"e-icons e-de-table"},{text:e.getConstant("Merge Cells"),id:o+"_contextmenu_merge_cell",iconCss:"e-icons e-de-ctnr-mergecell"},{text:e.getConstant("AutoFit"),id:o+"_contextmenu_auto_fit",iconCss:"e-icons",items:[{text:e.getConstant("AutoFit to Contents"),id:o+"_contextmenu_auto_fit_contents",iconCss:"e-icons e-de-icon-autofit e-de-autofit-contents"},{text:e.getConstant("AutoFit to Window"),id:o+"_contextmenu_auto_fit_window",iconCss:"e-icons e-de-icon-auto-fitwindow e-de-autofit-window"},{text:e.getConstant("Fixed Column Width"),id:o+"_contextmenu_fixed_column_width",iconCss:"e-icons e-de-icon-fixed-columnwidth e-de-fixed-column"}]},{text:e.getConstant("Insert"),id:o+"_contextmenu_insert_table",iconCss:"e-icons",items:[{text:e.getConstant("Insert Above"),id:o+"_contextmenu_insert_above",iconCss:"e-icons e-de-insertabove"},{text:e.getConstant("Insert Below"),id:o+"_contextmenu_insert_below",iconCss:"e-icons e-de-insertbelow"},{text:e.getConstant("Insert Left"),id:o+"_contextmenu_insert_left",iconCss:"e-icons e-de-insertleft"},{text:e.getConstant("Insert Right"),id:o+"_contextmenu_insert_right",iconCss:"e-icons e-de-insertright"}]},{text:e.getConstant("Delete"),id:o+"_contextmenu_delete_table",iconCss:"e-icons",items:[{text:e.getConstant("Delete Table"),id:o+"_contextmenu_complete_table_delete",iconCss:"e-icons e-de-delete-table"},{text:e.getConstant("Delete Row"),id:o+"_contextmenu_delete_row",iconCss:"e-icons e-de-deleterow"},{text:e.getConstant("Delete Column"),id:o+"_contextmenu_delete_column",iconCss:"e-icons e-de-deletecolumn"}]}];var a={target:"#"+this.documentHelper.owner.containerId+"e-de-contextmenu",enableRtl:n,items:this.addMenuItems(this.menuItems),select:function(e){var t=e.element.id;r.handleContextMenuItem(t)}};this.contextMenuInstance=new i.ContextMenu(a,"#"+this.documentHelper.owner.containerId+"e-de-contextmenu-list"),this.contextMenuInstance.beforeOpen=function(){for(e=0;e<r.customMenuItems.length;e++)void 0!==r.customMenuItems[e].id?r.ids[e]=r.customMenuItems[e].id:r.ids[e]=r.customMenuItems[e+1].id;if(r.documentHelper.owner.fireCustomContextMenuBeforeOpen(r.ids),r.enableCustomContextMenu)for(var e=0;e<r.menuItems.length;e++)void 0!==r.menuItems[e].id?document.getElementById(r.menuItems[e].id).style.display="none":document.getElementById(r.menuItems[e-1].id).nextSibling.style.display="none";r.viewer&&r.documentHelper.selection&&(t.classList(r.documentHelper.selection.caret,[],["e-de-cursor-animation"]),r.documentHelper.selection.showCaret())},this.contextMenuInstance.onClose=function(){r.viewer&&r.documentHelper.selection&&(t.classList(r.documentHelper.selection.caret,["e-de-cursor-animation"],[]),r.documentHelper.updateFocus())}},e.prototype.disableBrowserContextmenu=function(){return!1},e.prototype.handleContextMenuItem=function(e){var t=this.documentHelper.owner.element.id;switch(e){case t+"_contextmenu_lock":this.documentHelper.owner.collaborativeEditingModule&&this.documentHelper.owner.collaborativeEditingModule.lockContent(this.documentHelper.owner.currentUser);break;case t+"_contextmenu_unlock":this.documentHelper.owner.collaborativeEditingModule&&this.documentHelper.owner.collaborativeEditingModule.unlockContent(this.documentHelper.owner.currentUser);break;case t+"_contextmenu_copy":this.documentHelper.selection.copy();break;case t+"_contextmenu_cut":this.documentHelper.owner.editor.cut();break;case t+"_contextmenu_paste":this.documentHelper.owner.isReadOnlyMode||this.documentHelper.owner.editorModule.pasteInternal(void 0);break;case t+"_add_comment":this.documentHelper.owner.isReadOnlyMode||this.documentHelper.owner.editorModule.insertComment();break;case t+"_contextmenu_update_field":var i=this.documentHelper.owner.isReadOnlyMode;this.documentHelper.selection.isReferenceField()&&(!i||i&&"FormFieldsOnly"===this.documentHelper.protectionType)?this.documentHelper.selection.updateRefField():this.documentHelper.owner.isReadOnlyMode||this.documentHelper.owner.editorModule.updateToc();break;case t+"_contextmenu_edit_field":this.documentHelper.owner.isReadOnlyMode||this.documentHelper.owner.tableOfContentsDialogModule.show();break;case t+"_contextmenu_font_dialog":this.documentHelper.owner.fontDialogModule&&this.documentHelper.owner.fontDialogModule.showFontDialog();break;case t+"_contextmenu_open_hyperlink":this.documentHelper.selection.navigateHyperlink();break;case t+"_contextmenu_copy_hyperlink":this.documentHelper.selection.copyHyperlink();break;case t+"_contextmenu_edit_hyperlink":case t+"_contextmenu_hyperlink":this.documentHelper.owner.hyperlinkDialogModule&&this.documentHelper.owner.hyperlinkDialogModule.show();break;case t+"_contextmenu_remove_hyperlink":this.documentHelper.owner.editor.removeHyperlink();break;case t+"_contextmenu_paragraph_dialog":this.documentHelper.owner.paragraphDialogModule&&this.documentHelper.owner.paragraphDialogModule.show();break;case t+"_contextmenu_table_dialog":this.documentHelper.owner.tablePropertiesDialogModule.show();break;case t+"_contextmenu_merge_cell":this.documentHelper.owner.editor.mergeCells();break;case t+"_contextmenu_insert_above":this.documentHelper.owner.editor.insertRow(!0);break;case t+"_contextmenu_insert_below":this.documentHelper.owner.editor.insertRow(!1);break;case t+"_contextmenu_insert_left":this.documentHelper.owner.editor.insertColumn(!0);break;case t+"_contextmenu_insert_right":this.documentHelper.owner.editor.insertColumn(!1);break;case t+"_contextmenu_complete_table_delete":this.documentHelper.owner.editor.deleteTable();break;case t+"_contextmenu_delete_row":this.documentHelper.owner.editor.deleteRow();break;case t+"_contextmenu_delete_column":this.documentHelper.owner.editor.deleteColumn();break;case t+"_contextmenu_continue_numbering":this.documentHelper.owner.editorModule.applyContinueNumbering();break;case t+"_contextmenu_restart_at":this.documentHelper.owner.editorModule.applyRestartNumbering(this.documentHelper.selection);break;case t+"_contextmenu_auto_fit_contents":this.documentHelper.owner.editor.autoFitTable("FitToContents");break;case t+"_contextmenu_auto_fit_window":this.documentHelper.owner.editor.autoFitTable("FitToWindow");break;case t+"_contextmenu_fixed_column_width":this.documentHelper.owner.editor.autoFitTable("FixedColumnWidth");break;case t+"_contextmenu_spelling_dialog":var n=this.spellChecker.retriveText();this.currentContextInfo=null,this.documentHelper.owner.spellCheckDialog.show(n.text,n.element);break;case t+"_contextmenu_accept_changes":this.documentHelper.selection.handleAcceptReject(!0);break;case t+"_contextmenu_reject_changes":this.documentHelper.selection.handleAcceptReject(!1);break;case t+"_properties":var r=this.documentHelper.selection.getCurrentFormField();r instanceof xe&&(r.formFieldData instanceof Pe?this.documentHelper.owner.textFormFieldDialogModule.show():r.formFieldData instanceof Te?this.documentHelper.owner.checkBoxFormFieldDialogModule.show():r.formFieldData instanceof Se&&this.documentHelper.owner.dropDownFormFieldDialogModule.show());break;case t+"_contextmenu_note_options":this.documentHelper.owner.showFootNotesDialog();break;default:var o=this.documentHelper.owner.element.id+"_contextmenu_otherSuggestions_spellcheck_";if(e.substring(0,o.length)===o){var s=e.substring(e.lastIndexOf("_")+1);this.callSelectedOption(s);break}this.documentHelper.owner.fireCustomContextMenuSelect(e)}},e.prototype.callSelectedOption=function(e){"Add To Dictionary"===e?this.spellChecker.handleAddToDictionary():"Ignore All"===e?this.spellChecker.handleIgnoreAllItems():this.spellChecker.manageReplace(e)},e.prototype.addCustomMenu=function(e,t,i){var n=JSON.parse(JSON.stringify(e));this.destroy(),0===this.spellContextItems.length&&(this.customItems=e);for(var r=0;r<n.length;r++)this.customMenuItems.push(n[r]),this.customMenuItems[r].id=this.documentHelper.owner.element.id+this.customMenuItems[r].id;this.enableCustomContextMenu=t,this.enableCustomContextMenuBottom=i,this.initContextMenu(this.locale)},e.prototype.addMenuItems=function(e){return this.enableCustomContextMenuBottom?e.concat(this.customMenuItems):this.customMenuItems.concat(e)},e.prototype.showContextMenuOnSel=function(e){var i=!(e instanceof MouseEvent),n=0,r=0;if(i){var o=this.documentHelper.getTouchOffsetValue(e);n=o.x,r=o.y}else r=(t.Browser.isIE?e.clientY:e.y)+document.body.scrollTop+document.documentElement.scrollTop,n=(t.Browser.isIE?e.clientX:e.x)+document.body.scrollLeft+document.documentElement.scrollLeft;this.showHideElements(this.documentHelper.selection)&&(i&&(this.documentHelper.isMouseDown=!1),this.contextMenuInstance.open(r,n),e.preventDefault())},e.prototype.hideSpellContextItems=function(){if(this.spellContextItems.length>0)for(var e=0;e<this.spellContextItems.length;e++){var i=document.getElementById(this.documentHelper.owner.element.id+this.spellContextItems[e].id);t.isNullOrUndefined(i)||(i.style.display="none")}},e.prototype.processSuggestions=function(e,i,n){this.spellContextItems=this.constructContextmenu(e,i),this.addCustomMenu(this.spellContextItems),this.noSuggestion=document.getElementById(this.documentHelper.owner.element.id+"_contextmenu_no_suggestion"),t.isNullOrUndefined(this.noSuggestion)||(this.noSuggestion.style.display="block",t.classList(this.noSuggestion,["e-disabled"],["e-focused"])),this.showContextMenuOnSel(n)},e.prototype.constructContextmenu=function(e,i){var n=this.customItems.length>0?this.customItems.slice():[];if(t.isNullOrUndefined(e)||0===e.length)n.push({text:"no suggestions",id:"_contextmenu_no_suggestion",classList:["e-focused"],iconCss:""});else for(var r=0;r<e.length;r++)n.push({text:e[r],id:"_contextmenu_otherSuggestions_spellcheck_"+e[r],iconCss:""});return n.push({separator:!0,id:"_contextmenu_suggestion_separator"}),!t.isNullOrUndefined(i)&&i.length>1?(n.push({text:"More Suggestion",items:i}),n.push({separator:!0,id:"_contextmenu_moreSuggestion_separator"})):n.push({text:"Add To Dictionary ",id:"_contextmenu_otherSuggestions_spellcheck_Add To Dictionary",iconCss:""}),n.push({text:"Ignore Once",id:"_contextmenu_otherSuggestions_spellcheck_Ignore Once",iconCss:""}),n.push({text:"Ignore All",id:"_contextmenu_otherSuggestions_spellcheck_Ignore All",iconCss:""}),n.push({separator:!0,id:"_contextmenu_change_separator"}),n.push({text:this.locale.getConstant("Spelling"),id:"_contextmenu_spelling_dialog",iconCss:"e-icons e-de-spellcheck",items:[]}),n.push({separator:!0,id:"_contextmenu_spelling_separator"}),n},e.prototype.showHideElements=function(e){if(t.isNullOrUndefined(e))return!1;e.hideToolTip();var i=this.documentHelper.owner,n=i.element.id,r=document.getElementById(n+"_contextmenu_lock"),o=document.getElementById(n+"_contextmenu_unlock"),s=document.getElementById(n+"_contextmenu_copy"),a=document.getElementById(n+"_contextmenu_cut"),l=document.getElementById(n+"_contextmenu_paste"),d=document.getElementById(n+"_contextmenu_update_field"),h=document.getElementById(n+"_contextmenu_edit_field"),c=document.getElementById(n+"_contextmenu_font_dialog"),p=document.getElementById(n+"_contextmenu_paragraph_dialog"),u=document.getElementById(n+"_contextmenu_table_dialog"),g=document.getElementById(n+"_contextmenu_insert_table"),m=document.getElementById(n+"_contextmenu_delete_table"),f=document.getElementById(n+"_contextmenu_merge_cell"),v=document.getElementById(n+"_contextmenu_hyperlink"),y=document.getElementById(n+"_contextmenu_open_hyperlink"),b=document.getElementById(n+"_contextmenu_edit_hyperlink"),w=document.getElementById(n+"_contextmenu_copy_hyperlink"),C=document.getElementById(n+"_contextmenu_remove_hyperlink"),x=document.getElementById(n+"_properties"),F=document.getElementById(n+"_contextmenu_continue_numbering"),P=document.getElementById(n+"_contextmenu_restart_at"),T=document.getElementById(n+"_contextmenu_auto_fit"),S=document.getElementById(n+"_add_comment"),I=document.getElementById(n+"_contextmenu_note_options");this.documentHelper.owner.enableLockAndEdit?this.documentHelper.editRanges.containsKey(this.documentHelper.owner.currentUser)?(r.style.display="none",o.style.display="block",this.documentHelper.selection.isSelectionInEditRegion()?t.classList(o,["e-blankicon"],["e-disabled"]):t.classList(o,["e-disabled","e-blankicon"],[])):(r.style.display="block",this.documentHelper.owner.collaborativeEditingModule&&this.documentHelper.owner.collaborativeEditingModule.canLock()?t.classList(o,["e-disabled"],[]):t.classList(o,[],["e-disabled"]),o.style.display="none"):(r.style.display="none",o.style.display="none");var N=!1;a.style.display="none",l.style.display="none",l.nextSibling.style.display="none";var E=document.getElementById(n+"_contextmenu_accept_changes"),H=document.getElementById(n+"_contextmenu_reject_changes");v.style.display="none",I.style.display="none",I.nextSibling.style.display="none",c.previousSibling.style.display="none",y.style.display="none",w.style.display="none",b.style.display="none",C.style.display="none",C.nextSibling.style.display="none",x.style.display="none",f.style.display="none",T.style.display="none",c.style.display="none",p.style.display="none",g.style.display="none",m.style.display="none",u.style.display="none",d.style.display="none";var W=e.getHyperlinkField(),O=!1;E.style.display="none",H.style.display="none",W instanceof xe&&e.isReferenceField(W)&&(O=!0),W instanceof xe&&O&&("FormFieldsOnly"===this.documentHelper.protectionType||!this.documentHelper.owner.isReadOnlyMode)&&(d.style.display="block"),h.style.display="none",F.style.display="none",P.style.display="none",P.nextSibling.style.display="none";var k=e.isEmpty;t.classList(a,k?["e-disabled"]:[],k?[]:["e-disabled"]),t.classList(s,k?["e-disabled"]:[],k?[]:["e-disabled"]);var L=this.documentHelper.owner.isReadOnlyMode||this.documentHelper.owner.enableHeaderAndFooter||!this.documentHelper.owner.enableComment;if(S.style.display=L?"none":"block",S.previousSibling.style.display=L?"none":"block",S.nextSibling.style.display=L?"none":"block",i.isReadOnlyMode)return!0;this.viewer&&this.documentHelper.owner&&this.documentHelper.owner.commentReviewPane&&this.documentHelper.owner.commentReviewPane.commentPane.isEditMode?t.classList(S,["e-disabled"],[]):t.classList(S,[],["e-disabled"]),E.previousSibling.style.display="none",a.style.display="block",l.style.display="block",l.nextSibling.style.display="block",t.classList(g,["e-blankicon"],[]),t.classList(m,["e-blankicon"],[]),t.classList(h,["e-blankicon"],[]),t.classList(T,["e-blankicon"],[]);var B=i.enableLocalPaste&&!t.isNullOrUndefined(i.editor.copiedData);if(t.classList(l,B?[]:["e-disabled"],B?["e-disabled"]:[]),"TableOfContents"===e.contextType)d.style.display="block",h.style.display="block";else{var R=e.start,D=e.end;"List"===e.contextType&&"Bullet"!==i.selection.getListLevel(R.paragraph).listLevelPattern&&(F.style.display="block",P.style.display="block",P.nextSibling.style.display="block"),R.paragraph.isInsideTable&&(!D.paragraph.isInsideTable||R.paragraph.associatedCell!==D.paragraph.associatedCell||e.isCellSelected(R.paragraph.associatedCell,R,D))?v.classList.add("e-disabled"):v.classList.contains("e-disabled")&&v.classList.remove("e-disabled"),W instanceof xe&&!e.isImageField()&&!O?(y.style.display="block",w.style.display="block",i.hyperlinkDialogModule&&(b.style.display="block"),C.style.display="block",C.nextSibling.style.display="block",N=!0,x.style.display="none"):i.hyperlinkDialogModule&&(v.style.display="block",c.previousSibling.style.display="block",N=!0),e.isFormField()&&this.documentHelper.owner.enableFormField&&(v.style.display="none",x.style.display="block"),W instanceof xe&&O&&(v.style.display="none",d.style.display="block")}return this.documentHelper.owner.selection.start.paragraph.isInsideTable&&this.documentHelper.owner.selection.end.paragraph.isInsideTable?(i.tablePropertiesDialogModule&&(u.style.display="block"),g.style.display="block",m.style.display="block",this.documentHelper.owner.editor.canMergeCells()&&(f.style.display="block"),T.style.display=this.documentHelper.selection.isTableSelected()?"block":"none"):(this.documentHelper.owner.fontDialogModule&&(c.style.display="block"),this.documentHelper.owner.paragraphDialogModule?p.style.display="block":N||this.documentHelper.owner.fontDialogModule||L||(S.nextSibling.style.display="none")),"Image"===e.contextType&&(c.style.display="none",p.style.display="none",C.nextSibling.style.display="none"),this.documentHelper.selection.hasRevisions()&&(E.previousSibling.style.display=this.documentHelper.owner.enableHeaderAndFooter?"none":"block",E.style.display="block",H.style.display="block"),(this.documentHelper.selection.isinFootnote||this.documentHelper.selection.isinEndnote)&&(I.style.display="block"),!0},e.prototype.destroy=function(){this.contextMenuInstance&&this.contextMenuInstance.destroy(),this.contextMenu&&this.contextMenu.parentElement&&(this.contextMenu.parentElement.removeChild(this.contextMenu),this.contextMenu.innerHTML=""),this.contextMenu=void 0,this.contextMenuInstance=void 0,this.menuItems=[],this.customMenuItems=[],this.ids=[]},e}(),bt=function(){function e(e){this.documentHelper=void 0,this.commentStarts=void 0,this.commentEnds=void 0,this.commentsCollection=void 0,this.revisionCollection=void 0,this.isPageBreakInsideTable=!1,this.isParseHeader=!1,this.footnotes=void 0,this.endnotes=void 0,this.isCutPerformed=!1,this.isPaste=!1,this.documentHelper=e,this.editableRanges=new g}return Object.defineProperty(e.prototype,"isPasting",{get:function(){return this.viewer&&this.viewer.owner.isPastingContent},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewer",{get:function(){return this.documentHelper.owner.viewer},enumerable:!0,configurable:!0}),e.prototype.convertJsonToDocument=function(e){this.commentStarts=new g,this.commentEnds=new g,this.commentsCollection=new g,this.revisionCollection=new g,this.footnotes=new Ne,this.endnotes=new Ne;var i=[],n=e;n=n instanceof Object?n:JSON.parse(n);var r=t.isNullOrUndefined(n.characterFormat)?this.viewer.owner.characterFormat:n.characterFormat;this.parseCharacterFormat(r,this.documentHelper.characterFormat);var o=t.isNullOrUndefined(n.paragraphFormat)?this.viewer.owner.paragraphFormat:n.paragraphFormat;return this.parseParagraphFormat(o,this.documentHelper.paragraphFormat),this.parseDocumentProtection(n),t.isNullOrUndefined(n.defaultTabWidth)||(this.documentHelper.defaultTabWidth=n.defaultTabWidth),t.isNullOrUndefined(n.trackChanges)||(this.documentHelper.owner.showRevisions=n.trackChanges,this.documentHelper.owner.enableTrackChanges=n.trackChanges),t.isNullOrUndefined(n.dontUseHTMLParagraphAutoSpacing)||(this.documentHelper.dontUseHtmlParagraphAutoSpacing=n.dontUseHTMLParagraphAutoSpacing),t.isNullOrUndefined(n.alignTablesRowByRow)||(this.documentHelper.alignTablesRowByRow=n.alignTablesRowByRow),t.isNullOrUndefined(n.background)||(this.documentHelper.backgroundColor=this.getColor(n.background.color)),t.isNullOrUndefined(n.abstractLists)||this.parseAbstractList(n,this.documentHelper.abstractLists),t.isNullOrUndefined(n.lists)||this.parseList(n,this.documentHelper.lists),t.isNullOrUndefined(n.styles)||this.parseStyles(n,this.documentHelper.styles),t.isNullOrUndefined(n.comments)||this.parseComments(n,this.documentHelper.comments),t.isNullOrUndefined(n.revisions)||this.parseRevisions(n,this.viewer.owner.revisionsInternal.changes),t.isNullOrUndefined(n.sections)||this.parseSections(n.sections,i),t.isNullOrUndefined(n.customXml)||this.parseCustomXml(n),t.isNullOrUndefined(n.formFieldShading)||(this.documentHelper.owner.documentEditorSettings.formFieldSettings.applyShading=n.formFieldShading),t.isNullOrUndefined(n.footnotes)||this.parseFootnotes(n.footnotes,this.documentHelper.footnotes),t.isNullOrUndefined(n.endnotes)||this.parseEndtnotes(n.endnotes,this.documentHelper.endnotes),i},e.prototype.parseFootnotes=function(e,i){t.isNullOrUndefined(e.separator)||this.parseBody(e.separator,i.separator),t.isNullOrUndefined(e.continuationNotice)||this.parseBody(e.continuationNotice,i.continuationNotice),t.isNullOrUndefined(e.continuationSeparator)||this.parseBody(e.continuationSeparator,i.continuationSeparator)},e.prototype.parseEndtnotes=function(e,i){t.isNullOrUndefined(e.separator)||this.parseBody(e.separator,i.separator),t.isNullOrUndefined(e.continuationNotice)||this.parseBody(e.continuationNotice,i.continuationNotice),t.isNullOrUndefined(e.continuationSeparator)||this.parseBody(e.continuationSeparator,i.continuationSeparator)},e.prototype.parseCustomXml=function(e){for(var t=0;t<e.customXml.length;t++){var i=e.customXml[t];this.revisionCollection.containsKey(i.itemID)||this.documentHelper.customXmlData.add(i.itemID,i.xml)}},e.prototype.parseDocumentProtection=function(e){t.isNullOrUndefined(e.formatting)||(this.documentHelper.restrictFormatting=e.formatting),t.isNullOrUndefined(e.enforcement)||(this.documentHelper.isDocumentProtected=e.enforcement),t.isNullOrUndefined(e.protectionType)||(this.documentHelper.protectionType=e.protectionType),t.isNullOrUndefined(e.hashValue)||(this.documentHelper.hashValue=e.hashValue),t.isNullOrUndefined(e.saltValue)||(this.documentHelper.saltValue=e.saltValue)},e.prototype.parseStyles=function(e,i){for(var n=0;n<e.styles.length;n++)t.isNullOrUndefined(this.documentHelper.styles.findByName(e.styles[n].name))&&this.parseStyle(e,e.styles[n],i)},e.prototype.parseRevisions=function(e,i){for(var n=0;n<e.revisions.length;n++){var r=e.revisions[n];if(!t.isNullOrUndefined(r.revisionId)){var o=this.parseRevision(r),s=!0;if(!this.documentHelper.owner.sfdtExportModule.copyWithTrackChange&&this.isPaste){if("Insertion"===r.revisionType&&this.isPaste&&this.documentHelper.owner.enableTrackChanges)continue;this.revisionCollection.containsKey(r.revisionId)||this.revisionCollection.add(r.revisionId,o)}else this.revisionCollection.add(r.revisionId,o);for(var a=0;a<i.length;a++)i[a].revisionID===o.revisionID&&(s=!1);s&&i.push(o)}}this.documentHelper.revisionsInternal=this.revisionCollection,this.documentHelper.owner.sfdtExportModule&&(this.documentHelper.owner.sfdtExportModule.copyWithTrackChange=!1)},e.prototype.parseRevision=function(e){if(!t.isNullOrUndefined(e)){var i=new N(this.viewer.owner,e.author,e.date);return i.revisionID=e.revisionId,i.revisionType=e.revisionType,i}},e.prototype.checkAndApplyRevision=function(e,i){if(!t.isNullOrUndefined(e.revisionIds)&&e.revisionIds.length>0)for(var n=0;n<e.revisionIds.length;n++){var r=e.revisionIds[n];if(this.revisionCollection.containsKey(r)){var o=this.revisionCollection.get(r);i instanceof P||o.range.push(i),i.revisions.push(o)}}},e.prototype.parseComments=function(e,t){for(var i=0,n=0;n<e.comments.length;n++){var r=e.comments[n],o=void 0;for(o=this.parseComment(r,o);i<r.replyComments.length;){var s=void 0;(s=this.parseComment(r.replyComments[i],s)).ownerComment=o,s.isReply=!0,o.replyComments.push(s),this.commentsCollection.add(s.commentId,s),i++}this.commentsCollection.add(o.commentId,o),t.push(o),i=0}},e.prototype.parseComment=function(e,t){return t=new ut(e.date),t.author=e.author,t.initial=e.initial,t.commentId=e.commentId,t.isResolved=e.done,t.text=this.parseCommentText(e.blocks),t},e.prototype.parseCommentText=function(e){for(var t="",i=0;i<e.length;i++){0!==i&&(t+="\n");for(var n=0;n<e[i].inlines.length;n++)t+=e[i].inlines[n].text}return t},e.prototype.parseStyle=function(e,i,n){var r;if(!t.isNullOrUndefined(i.type)){if("Paragraph"===i.type&&((r=new R).type="Paragraph"),"Character"===i.type&&((r=new D).type="Character"),t.isNullOrUndefined(i.name)||(r.name=i.name),n.push(r),!t.isNullOrUndefined(i.basedOn)){var o=n.findByName(i.basedOn);if(t.isNullOrUndefined(o)){var s=this.getStyle(i.basedOn,e),a=void 0;a=t.isNullOrUndefined(s)||s.type!==r.type?"Paragraph"===r.type?JSON.parse('{"type":"Paragraph","name":"Normal","next":"Normal"}'):JSON.parse('{"type": "Character","name": "Default Paragraph Font"}'):s,this.parseStyle(e,a,n),r.basedOn=n.findByName(a.name)}else o.type===r.type&&(r.basedOn=o)}if(!t.isNullOrUndefined(i.link)){var l=n.findByName(i.link),d=this.getStyle(i.link,e),a=void 0;if(t.isNullOrUndefined(l)){if(t.isNullOrUndefined(d)){var h={};h.characterFormat=i.characterFormat,h.name=i.name+" Char",h.type="Character",h.basedOn="Normal"===i.basedOn?"Default Paragraph Font":i.basedOn+" Char",a=h}else a=d;this.parseStyle(e,a,n),r.link=t.isNullOrUndefined(n.findByName(a.name))?i.link:n.findByName(a.name)}else r.link=l}if(t.isNullOrUndefined(i.characterFormat)||this.parseCharacterFormat(i.characterFormat,r.characterFormat),t.isNullOrUndefined(i.paragraphFormat)||this.parseParagraphFormat(i.paragraphFormat,r.paragraphFormat),!t.isNullOrUndefined(i.next))if(i.next===i.name)r.next=r;else{var c=n.findByName(i.next);if(t.isNullOrUndefined(c)||c.type!==r.type){var p=this.getStyle(i.next,e);t.isNullOrUndefined(p)?r.next=r:(this.parseStyle(e,p,n),r.next=n.findByName(p.name))}else r.next=c}}},e.prototype.getStyle=function(e,t){for(var i=0;i<t.styles.length;i++)if(t.styles[i].name===e)return t.styles[i]},e.prototype.parseAbstractList=function(e,i){for(var n=0;n<e.abstractLists.length;n++){var r=new V,o=e.abstractLists[n];if(i.push(r),!t.isNullOrUndefined(o)&&(t.isNullOrUndefined(o.abstractListId)||(r.abstractListId=o.abstractListId),!t.isNullOrUndefined(o.levels)))for(var s=0;s<o.levels.length;s++){var a=o.levels[s];if(!t.isNullOrUndefined(a)){var l=this.parseListLevel(a,r);r.levels.push(l)}}}},e.prototype.parseListLevel=function(e,i){var n=new _(i);return"Bullet"===e.listLevelPattern?(n.listLevelPattern="Bullet",n.numberFormat=t.isNullOrUndefined(e.numberFormat)?"":e.numberFormat):(n.listLevelPattern=e.listLevelPattern,n.startAt=e.startAt,n.numberFormat=t.isNullOrUndefined(e.numberFormat)?"":e.numberFormat,e.restartLevel>=0?n.restartLevel=e.restartLevel:n.restartLevel=e.levelNumber),n.followCharacter=e.followCharacter,this.parseCharacterFormat(e.characterFormat,n.characterFormat),this.parseParagraphFormat(e.paragraphFormat,n.paragraphFormat),n},e.prototype.parseList=function(e,i){for(var n=0;n<e.lists.length;n++){var r=new C,o=e.lists[n];t.isNullOrUndefined(o.abstractListId)||(r.abstractListId=o.abstractListId,r.abstractList=this.documentHelper.getAbstractListById(o.abstractListId)),i.push(r),t.isNullOrUndefined(o.listId)||(r.listId=o.listId),o.hasOwnProperty("levelOverrides")&&this.parseLevelOverride(o.levelOverrides,r)}},e.prototype.parseLevelOverride=function(e,i){if(!t.isNullOrUndefined(e))for(var n=0;n<e.length;n++){var r=new w,o=e[n];r.startAt=o.startAt,r.levelNumber=o.levelNumber,t.isNullOrUndefined(o.overrideListLevel)||(r.overrideListLevel=this.parseListLevel(o.overrideListLevel,r)),i.levelOverrides.push(r)}},e.prototype.parseSections=function(e,i){for(var n=0;n<e.length;n++){var r=new pe;r.sectionFormat=new b(r),r.index=n;var o=e[n];t.isNullOrUndefined(o.sectionFormat)||this.parseSectionFormat(o.sectionFormat,r.sectionFormat),t.isNullOrUndefined(o.headersFooters)&&(o.headersFooters={}),this.documentHelper.headersFooters.push(this.parseHeaderFooter(o.headersFooters,this.documentHelper.headersFooters)),this.isParseHeader=!1,this.parseTextBody(o.blocks,r,n+1<e.length);for(var s=0;s<r.childWidgets.length;s++)r.childWidgets[s].containerWidget=r;i.push(r)}},e.prototype.parseHeaderFooter=function(e,i){this.isParseHeader=!0;var n={};if(!t.isNullOrUndefined(e.header)){var r=new ue("OddHeader");n[0]=r,this.parseTextBody(e.header.blocks,r)}if(!t.isNullOrUndefined(e.footer)){var o=new ue("OddFooter");n[1]=o,this.parseTextBody(e.footer.blocks,o)}if(!t.isNullOrUndefined(e.evenHeader)){var s=new ue("EvenHeader");n[2]=s,this.parseTextBody(e.evenHeader.blocks,s)}if(!t.isNullOrUndefined(e.evenFooter)){var a=new ue("EvenFooter");n[3]=a,this.parseTextBody(e.evenFooter.blocks,a)}if(!t.isNullOrUndefined(e.firstPageHeader)){var l=new ue("FirstPageHeader");n[4]=l,this.parseTextBody(e.firstPageHeader.blocks,l)}if(!t.isNullOrUndefined(e.firstPageFooter)){var d=new ue("FirstPageFooter");n[5]=d,this.parseTextBody(e.firstPageFooter.blocks,d)}return n},e.prototype.parseTextBody=function(e,t,i){this.parseBody(e,t.childWidgets,t,i)},e.prototype.addCustomStyles=function(e){for(var t=0;t<e.styles.length;t++)void 0===this.documentHelper.styles.findByName(e.styles[t].name)&&this.parseStyle(e,e.styles[t],this.documentHelper.styles)},e.prototype.parseBody=function(e,i,n,r,o){if(!t.isNullOrUndefined(e))for(var s=0;s<e.length;s++){var a=e[s],l=!1;if(a.hasOwnProperty("inlines")){var d=new fe;if(d.characterFormat=new H(d),d.paragraphFormat=new P(d),a.inlines.length>0&&(l=this.parseParagraph(a.inlines,d,!1)),!r||a!==e[e.length-1]||l){this.parseCharacterFormat(a.characterFormat,d.characterFormat),this.parseParagraphFormat(a.paragraphFormat,d.paragraphFormat);var h=void 0;t.isNullOrUndefined(a.paragraphFormat)||t.isNullOrUndefined(a.paragraphFormat.styleName)||(h=this.documentHelper.styles.findByName(a.paragraphFormat.styleName,"Paragraph"),t.isNullOrUndefined(h)||d.paragraphFormat.applyStyle(h)),i.push(d)}else r&&1===e.length&&i.push(d);d.index=i.length-1,d.containerWidget=n}else if(a.hasOwnProperty("rows"))this.parseTable(a,i,i.length,n);else if(a.hasOwnProperty("contentControlProperties")){var c=new Le("Block"),p=new Le("Block");this.parseContentControlProperties(a.contentControlProperties,c.contentControlProperties),p.contentControlProperties=c.contentControlProperties,c.type=0,p.type=1,this.parseBody(a.blocks,i,n,r,c.contentControlProperties);for(var u=0;u<2;u++){var g=i.length<a.blocks.length?i[0]:0===u?i[i.length-a.blocks.length]:i[i.length-1],m=void 0;if(g instanceof fe?m=g:g instanceof ve&&(m=0===u?g.firstChild.firstChild.firstChild:g.lastChild.lastChild.lastChild),!t.isNullOrUndefined(m)&&0===m.childWidgets.length){var f=new we(m);m.childWidgets.push(f)}0===u?(m.firstChild.children.splice(0,0,c),c.line=m.firstChild):(m.lastChild.children.push(p),p.line=m.lastChild)}}t.isNullOrUndefined(o)||(i[i.length-1].contentControlProperties=o)}},e.prototype.parseTable=function(e,i,n,r){var o=new ve;o.index=n,o.tableFormat=new U(o),t.isNullOrUndefined(e.tableFormat)||this.parseTableFormat(e.tableFormat,o.tableFormat),o.title=e.title,o.description=e.description;for(var s=0;s<e.rows.length;s++){var a=new ye;a.rowFormat=new I(a);var l=e.rows[s];if(t.isNullOrUndefined(l.contentControlProperties)||(a.contentControlProperties=new Be("Row"),this.parseContentControlProperties(l.contentControlProperties,a.contentControlProperties)),l.hasOwnProperty("rowFormat")){this.parseRowFormat(l.rowFormat,a.rowFormat),this.parseRowGridValues(l,a.rowFormat),this.parseRowGridValues(l.rowFormat,a.rowFormat),a.index=s;for(var d=0;d<e.rows[s].cells.length;d++){var h=new be;if(h.cellFormat=new z(h),t.isNullOrUndefined(e.rows[s].cells[d].contentControlProperties)||(h.contentControlProperties=new Be("Cell"),this.parseContentControlProperties(e.rows[s].cells[d].contentControlProperties,h.contentControlProperties)),a.childWidgets.push(h),h.containerWidget=a,h.index=d,h.rowIndex=s,h.columnIndex=d,e.rows[s].cells[d].hasOwnProperty("cellFormat")&&this.parseCellFormat(e.rows[s].cells[d].cellFormat,h.cellFormat),this.isPageBreakInsideTable=!0,this.parseTextBody(e.rows[s].cells[d].blocks,h,!1),!t.isNullOrUndefined(h.contentControlProperties)){var c=new Le("Cell"),p=new Le("Cell");if(c.contentControlProperties=h.contentControlProperties,p.contentControlProperties=h.contentControlProperties,c.type=0,p.type=1,0===h.firstChild.childWidgets.length){m=new we(h.firstChild);h.firstChild.childWidgets.push(m)}c.line=h.firstChild.firstChild,h.firstChild.firstChild.children.splice(0,0,c),p.line=h.lastChild.lastChild,h.lastChild.lastChild.children.push(p)}if(!t.isNullOrUndefined(a.contentControlProperties))if(a.firstChild===h){var u=new Le("Row");if(u.contentControlProperties=a.contentControlProperties,u.type=0,0===h.firstChild.childWidgets.length){m=new we(h.firstChild);h.firstChild.childWidgets.push(m)}u.line=h.firstChild.firstChild,h.firstChild.firstChild.children.splice(0,0,u)}else if(a.lastChild===h){var g=new Le("Row");if(g.contentControlProperties=a.contentControlProperties,g.type=1,0===h.lastChild.childWidgets.length){var m=new we(h.lastChild);h.lastChild.childWidgets.push(m)}g.line=h.lastChild.lastChild,h.lastChild.lastChild.children.push(g)}this.isPageBreakInsideTable=!1}}o.childWidgets.push(a),a.containerWidget=o}o.containerWidget=r,i.push(o),o.isGridUpdated=!1},e.prototype.parseRowGridValues=function(e,i){t.isNullOrUndefined(e.gridBefore)||(i.gridBefore=e.gridBefore),t.isNullOrUndefined(e.gridBeforeWidth)||(i.gridBeforeWidth=e.gridBeforeWidth),t.isNullOrUndefined(e.gridBeforeWidthType)||(i.gridBeforeWidthType=e.gridBeforeWidthType),t.isNullOrUndefined(e.gridAfter)||(i.gridAfter=e.gridAfter),t.isNullOrUndefined(e.gridAfterWidth)||(i.gridAfterWidth=e.gridAfterWidth),t.isNullOrUndefined(e.gridAfterWidthType)||(i.gridAfterWidthType=e.gridAfterWidthType)},e.prototype.parseContentControlProperties=function(e,i){if(t.isNullOrUndefined(e.lockContentControl)||(i.lockContentControl=e.lockContentControl),t.isNullOrUndefined(e.lockContents)||(i.lockContents=e.lockContents),t.isNullOrUndefined(e.tag)||(i.tag=e.tag),t.isNullOrUndefined(e.color)||(i.color=e.color),t.isNullOrUndefined(e.title)||(i.title=e.title),t.isNullOrUndefined(e.appearance)||(i.appearance=e.appearance),t.isNullOrUndefined(e.type)||(i.type=e.type),t.isNullOrUndefined(e.hasPlaceHolderText)||(i.hasPlaceHolderText=e.hasPlaceHolderText),t.isNullOrUndefined(e.multiline)||(i.multiline=e.multiline),t.isNullOrUndefined(e.isTemporary)||(i.isTemporary=e.isTemporary),t.isNullOrUndefined(e.characterFormat)||this.parseCharacterFormat(e.characterFormat,i.characterFormat),"CheckBox"===i.type)t.isNullOrUndefined(e.isChecked)||(i.isChecked=e.isChecked),t.isNullOrUndefined(e.uncheckedState)||(i.uncheckedState=new De,i.uncheckedState.font=e.uncheckedState.font,i.uncheckedState.value=e.uncheckedState.value),t.isNullOrUndefined(e.checkedState)||(i.checkedState=new De,i.checkedState.font=e.checkedState.font,i.checkedState.value=e.checkedState.value);else if("Date"===i.type)t.isNullOrUndefined(e.dateCalendarType)||(i.dateCalendarType=e.dateCalendarType),t.isNullOrUndefined(e.dateStorageFormat)||(i.dateStorageFormat=e.dateStorageFormat),t.isNullOrUndefined(e.dateDisplayLocale)||(i.dateDisplayLocale=e.dateDisplayLocale),t.isNullOrUndefined(e.dateDisplayFormat)||(i.dateDisplayFormat=e.dateDisplayFormat);else if(("ComboBox"===i.type||"DropDownList"===i.type)&&!t.isNullOrUndefined(e.contentControlListItems))for(var n=0;n<e.contentControlListItems.length;n++){var r=new Re;r.displayText=e.contentControlListItems[n].displayText,r.value=e.contentControlListItems[n].value,i.contentControlListItems.push(r)}t.isNullOrUndefined(e.xmlMapping)||(i.xmlMapping=new Me,i.xmlMapping.isMapped=e.xmlMapping.isMapped,i.xmlMapping.isWordMl=e.xmlMapping.isWordMl,t.isNullOrUndefined(e.xmlMapping.prefixMapping)||(i.xmlMapping.prefixMapping=e.xmlMapping.prefixMapping),i.xmlMapping.xPath=e.xmlMapping.xPath,i.xmlMapping.storeItemId=e.xmlMapping.storeItemId,t.isNullOrUndefined(e.xmlMapping.customXmlPart)||(i.xmlMapping.customXmlPart=new Ae,i.xmlMapping.customXmlPart.id=e.xmlMapping.customXmlPart.id,i.xmlMapping.customXmlPart.xml=e.xmlMapping.customXmlPart.xml))},e.prototype.parseParagraph=function(e,i,n,r){var o=!1;t.isNullOrUndefined(r)?r=new we(i):o=!0;for(var s,a=!1,l=this.viewer.owner.enableTrackChanges,d=0;d<e.length;d++){var c=e[d];if(c.hasOwnProperty("text")){var p=void 0;if(this.documentHelper.isPageField)(p=new We).fieldBegin=this.documentHelper.fieldStacks[this.documentHelper.fieldStacks.length-1];else if("\t"===c.text)p=new Oe;else{if("\f"===c.text&&this.isPageBreakInsideTable)continue;p=new Ie}if(p.characterFormat=new H(p),this.parseCharacterFormat(c.characterFormat,p.characterFormat,n),this.applyCharacterStyle(c,p),p.text=c.text,this.documentHelper.owner.parser.isPaste&&!this.isCutPerformed){if(!t.isNullOrUndefined(c.revisionIds))for(g=0;g<c.revisionIds.length;g++)if(this.revisionCollection.containsKey(c.revisionIds[g])){if(l&&(s=this.revisionCollection.get(c.revisionIds[g])),!t.isNullOrUndefined(s)&&!t.isNullOrUndefined(r.children[d-1].revisions[g])&&(!l||l&&"Deletion"===s.revisionType)&&s.revisionID===c.revisionIds[g]){c.revisionIds[g]=r.children[d-1].revisions[g].revisionID,this.checkAndApplyRevision(c,p);continue}l||(s=this.documentHelper.revisionsInternal.get(c.revisionIds[g])),this.documentHelper.owner.editorModule.insertRevision(p,s.revisionType,s.author),c.revisionIds[g]=p.revisions[g].revisionID}}else this.checkAndApplyRevision(c,p);p.line=r,r.children.push(p),a=!0}else if(c.hasOwnProperty("footnoteType")){var u=new Ee;u.line=r,u.footnoteType=c.footnoteType,"Footnote"===u.footnoteType?this.documentHelper.footnoteCollection.push(u):this.documentHelper.endnoteCollection.push(u),u.symbolCode=c.symbolCode,u.symbolFontName=c.symbolFontName,u.customMarker=c.customMarker,u.characterFormat=new H(u),this.parseCharacterFormat(c.characterFormat,u.characterFormat,n),this.applyCharacterStyle(c,u),this.parseBody(c.blocks,u.blocks,void 0,!1),r.children.push(u);for(var g=0;g<u.blocks.length;g++)u.blocks[g].footNoteReference=u;a=!0}else if(c.hasOwnProperty("chartType")){this.documentHelper.owner.editor&&(this.documentHelper.owner.editor.chartType=!0);var m=new Je;m.title=c.chartTitle,m.type=c.chartType,m.chartGapWidth=c.gapWidth,m.chartOverlap=c.overlap,this.parseChartTitleArea(c.chartTitleArea,m.chartTitleArea),this.parseChartArea(c.chartArea,m.chartArea),this.parseChartArea(c.plotArea,m.chartPlotArea),this.parseChartLegend(c.chartLegend,m.chartLegend),this.parseChartData(c,m),this.parseChartCategoryAxis(c.chartPrimaryCategoryAxis,m.chartPrimaryCategoryAxis),this.parseChartCategoryAxis(c.chartPrimaryValueAxis,m.chartPrimaryValueAxis),null!=c.chartDataTable&&this.parseChartDataTable(c.chartDataTable,m.chartDataTable),m.line=r,r.children.push(m),m.height=W.convertPointToPixel(c.height),m.width=W.convertPointToPixel(c.width);var f=new h.ChartComponent;f.chartRender(c),m.officeChart=f,f.chart.appendTo(m.targetElement),a=!0}else if(c.hasOwnProperty("imageString")){var v=new Ge(e[d].isInlineImage);v.isMetaFile=e[d].isMetaFile,v.isCompressed=e[d].isCompressed,v.metaFileImageString=e[d].metaFileImageString,v.characterFormat=new H(v),v.line=r,this.checkAndApplyRevision(c,v),r.children.push(v);var y=W.formatClippedString(c.imageString).formatClippedString,b=this.validateImageUrl(y);v.imageString=b?c.imageString:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAOEAAADhCAMAAAAJbSJIAAAAgVBMVEX///8AAADgAADY2Njl5eVcXFxjY2NZWVl/f3+wsLCmpqb4+PiioqKpqam7u7vV1dX2uLj2wsLhFRXzpKT3vb30sbHhCwv74+P40dH+9vbkIyO2trbBwcHLy8tsbGycnJz529v4zMzrbGzlLS3qZmblNzfrdXXoRkbvi4vvgYHlHh7CZsBOAAADpUlEQVR4nO3da1faQBSF4ekAUQlUEFs14AXxVv7/D6yaQiZx5mSEYXF2ut+PNKzyyK5diYDmR9czx34AB49C/CjE759w3jvvWr15Tdgz3atXE54f++EcIArxoxA/CvGjED8K8aMQPwrxoxA/CvGLEeZ9jPJdhfk4GyCUjb3ECGE/Q6m/q3DwfudjP0ERZYN9hKdn2hvd3+0jHJz5/kBVuTk96bbQUEjhYR9ckiikUH8UUqg/CinUH4UU6o9CCvVHIYX6o5BC/VFIof4opFB/FFKoPwop1B+FFOqPQgrjyxfjVC38Lxk9tnAxGqZqdKtSOE4GHA5/fuNJpDCtcNHbv4VqYYqPLjgfUViPQgrjozA2CptRSGF8/59w+Wrt+rr1btNna1cPzg0wwuXavncxabnX7PfHYYXzlYARvlobQZyUR9mXm+1NMEK7SSLONgcVV9vb8IQXv4J3KSeKKlxXxNCzONkeYp8AV3p9UT1+P3FWHVAsq5thhGZSEb1DrSZq7dS5HUdoLiuBZ6jORG3tCwAkNJfCUJ2Jrqe1P0ESCkMNTdSACYNDDU7UoAkDQw1P1MAJvUMVJmrwhJ6hShM1gMIvQxUnahCFjaHKEzWQQneoxR95ogZTWBuqPFEDKnSHKk/UoArdoYoTNbDC5lBDEzW4QjMpYiZqgIXG/S76JhwHK5zVVipcnkIVuv/RW/HyFKhwYhuFr6NiCmdNoDBUSGFjovJQEYXuRN9ahwoorJ8uSZenPsMTNk+X2q6jwgm/ntHL11HhhL4zenmoYEL/Gb04VCxh6KKTNFQoYfiikzBUJKF00Sk8VCChfF00OFQcYdt10dBQYYRT5xn0n9G7Q0X8GfCzNNEyZ6iPgD/HlydaVg11DfhajJaJlm2HugIUrlomWrYZKuJKHz6vHhbSM/hROdRnxNe1meuXYvW0DB6+aflYrB7dlzDiCM3N1dVN6GDhMCDhjlHYjEIK46MwNgqbUUhhfJ/vA07wO8N1vw94ONo/3e/lTpVOYfc/UyG//ZmqW52fi/FuTNW3/lZ+eguF+qOQQv1RSKH+KKRQfxRSqD8KKdQfhRTqj0IK9UchhfqjkEL9UUih/iikUH8UUqg/CmXh6Hsv3jlK+wnvD/vgkrSHMMuyu1P9ZdmuwnycDQYn+svG3n9KEUKT9zHyf6+IEWJHIX4U4kchfhTiRyF+FOJHIX4U4kchfnVhijeZa6sunCf4ZdPamteEHY5C/CjEr/vCv0ec0g+AtS1QAAAAAElFTkSuQmCC",v.width=W.convertPointToPixel(c.width),v.height=W.convertPointToPixel(c.height),v.top=c.top,v.left=c.left,v.bottom=c.bottom,v.right=c.right,v.cropHeightScale=c.getimageheight,v.cropWidthScale=c.getimagewidth,v.name=c.name,v.alternativeText=c.alternativeText,v.title=c.title,v.visible=c.visible,v.widthScale=c.widthScale,v.heightScale=c.heightScale,v.verticalPosition=W.convertPointToPixel(c.verticalPosition),v.verticalOrigin=c.verticalOrigin,v.verticalAlignment=c.verticalAlignment,v.horizontalPosition=W.convertPointToPixel(c.horizontalPosition),v.horizontalOrigin=c.horizontalOrigin,v.horizontalAlignment=c.horizontalAlignment,v.allowOverlap=c.allowOverlap,v.textWrappingStyle=t.isNullOrUndefined(c.textWrappingStyle)?"Inline":c.textWrappingStyle,v.textWrappingType=c.textWrappingType,v.layoutInCell=c.layoutInCell,"Inline"!==v.textWrappingStyle&&i.floatingElements.push(v),this.parseCharacterFormat(c.characterFormat,v.characterFormat),a=!0}else if(c.hasOwnProperty("hasFieldEnd")||c.hasOwnProperty("fieldType")&&0===c.fieldType){var w=new xe(0);if(this.parseCharacterFormat(c.characterFormat,w.characterFormat,n),this.applyCharacterStyle(c,w),w.fieldCodeType=c.fieldCodeType,w.hasFieldEnd=c.hasFieldEnd,c.hasOwnProperty("formFieldData")){var C=void 0;c.formFieldData.hasOwnProperty("textInput")?((C=new Pe).type=c.formFieldData.textInput.type,C.maxLength=c.formFieldData.textInput.maxLength,C.defaultValue=c.formFieldData.textInput.defaultValue,C.format=c.formFieldData.textInput.format):c.formFieldData.hasOwnProperty("checkBox")?((C=new Te).sizeType=c.formFieldData.checkBox.sizeType,C.size=c.formFieldData.checkBox.size,C.defaultValue=c.formFieldData.checkBox.defaultValue,C.checked=c.formFieldData.checkBox.checked):((C=new Se).dropdownItems=c.formFieldData.dropDownList.dropDownItems,C.selectedIndex=c.formFieldData.dropDownList.selectedIndex),C.name=c.formFieldData.name,C.enabled=c.formFieldData.enabled,C.helpText=c.formFieldData.helpText,C.statusText=c.formFieldData.statusText,w.formFieldData=C,this.documentHelper.formFields.push(w)}this.documentHelper.fieldStacks.push(w),this.checkAndApplyRevision(c,w),w.line=r,this.documentHelper.fields.push(w),r.children.push(w)}else if(c.hasOwnProperty("fieldType")){var x=void 0;if(2===c.fieldType){if(x=new xe(2),this.fieldSeparator=x,this.documentHelper.fieldStacks.length>0){x.fieldBegin=this.documentHelper.fieldStacks[this.documentHelper.fieldStacks.length-1],x.fieldBegin.fieldSeparator=x;var F=r.children.length;F>=2&&r.children[F-2]instanceof xe&&r.children[F-2].hasFieldEnd&&r.children[F-1]instanceof Ie&&r.children[F-1].text.match("PAGE")&&(this.documentHelper.isPageField=!0)}}else 1===c.fieldType&&(x=new xe(1),this.parseCharacterFormat(c.characterFormat,x.characterFormat,n),this.applyCharacterStyle(c,x),this.checkAndApplyRevision(c,x),this.documentHelper.fieldStacks.length>0&&(x.fieldBegin=this.documentHelper.fieldStacks[this.documentHelper.fieldStacks.length-1],x.fieldBegin.fieldEnd=x),!t.isNullOrUndefined(x.fieldBegin)&&x.fieldBegin.fieldSeparator&&(x.fieldSeparator=x.fieldBegin.fieldSeparator,x.fieldBegin.fieldSeparator.fieldEnd=x,a=!0),this.documentHelper.fieldStacks.splice(this.documentHelper.fieldStacks.length-1,1),this.fieldSeparator=void 0,this.documentHelper.isPageField=!1,this.documentHelper.fieldCollection.push(x.fieldBegin));x.line=r,r.children.push(x)}else if(c.hasOwnProperty("bookmarkType")){var P=void 0;if(P=new ke(c.bookmarkType),P.name=c.name,r.children.push(P),P.line=r,!this.isParseHeader||this.isPaste)if(0===c.bookmarkType){var T=this.isPaste&&!this.documentHelper.bookmarks.containsKey(P.name);!this.isPaste||T?this.documentHelper.bookmarks.add(P.name,P):T||r.children.splice(r.children.indexOf(P),1)}else if(1===c.bookmarkType&&this.documentHelper.bookmarks.containsKey(P.name)){var S=this.documentHelper.bookmarks.get(P.name),I=this.isPaste&&t.isNullOrUndefined(S.reference);!this.isPaste||I?(S.reference=P,P.reference=S):I||r.children.splice(r.children.indexOf(P),1)}0!==P.name.indexOf("_")&&(a=!0)}else if(c.hasOwnProperty("editRangeId")){if(c.hasOwnProperty("editableRangeStart")){var N=new Xe;if(this.editableRanges.containsKey(c.editRangeId)){var E=this.editableRanges.get(c.editRangeId);N.editRangeStart=E,E.editRangeEnd=N,this.editableRanges.remove(c.editRangeId)}r.children.push(N),N.line=r}else{var O=this.parseEditableRangeStart(c);r.children.push(O),O.line=r,this.editableRanges.containsKey(c.editRangeId)||this.editableRanges.add(c.editRangeId,O)}a=!0}else if(c.hasOwnProperty("commentId")){var k=c.commentId;this.commentStarts.containsKey(k)&&this.commentStarts.get(k);if(this.commentEnds.containsKey(k)&&this.commentEnds.get(k),c.hasOwnProperty("commentCharacterType"))if(0===c.commentCharacterType){var L=new pt(0);L.commentId=k,this.commentStarts.containsKey(k)||this.commentStarts.add(k,L),L.line=r,r.children.push(L);R=this.commentsCollection.get(k);t.isNullOrUndefined(R)||(R.commentStart=L,L.comment=R)}else{var B=new pt(1);B.commentId=k,this.commentEnds.containsKey(k)||this.commentEnds.add(k,B),B.line=r,r.children.push(B);var R=this.commentsCollection.get(k);t.isNullOrUndefined(R)||(R.commentEnd=B,B.comment=R)}}else if(c.hasOwnProperty("shapeId")){var D=new Ve;if(D.shapeId=c.shapeId,D.name=c.name,D.alternativeText=c.alternativeText,D.title=c.title,D.visible=c.visible,D.width=W.convertPointToPixel(c.width),D.height=W.convertPointToPixel(c.height),D.widthScale=c.widthScale,D.heightScale=c.heightScale,D.verticalPosition=W.convertPointToPixel(c.verticalPosition),D.verticalOrigin=c.verticalOrigin,D.verticalAlignment=c.verticalAlignment,D.horizontalPosition=W.convertPointToPixel(c.horizontalPosition),D.horizontalOrigin=c.horizontalOrigin,D.horizontalAlignment=c.horizontalAlignment,D.zOrderPosition=c.zOrderPosition,D.allowOverlap=c.allowOverlap,D.textWrappingStyle=t.isNullOrUndefined(c.textWrappingStyle)?"InFrontOfText":c.textWrappingStyle,D.textWrappingType=c.textWrappingType,D.distanceBottom=W.convertPointToPixel(c.distanceBottom),D.distanceLeft=W.convertPointToPixel(c.distanceLeft),D.distanceRight=W.convertPointToPixel(c.distanceRight),D.distanceTop=W.convertPointToPixel(c.distanceTop),D.layoutInCell=c.layoutInCell,D.lockAnchor=c.lockAnchor,D.autoShapeType=c.autoShapeType,c.hasOwnProperty("lineFormat")){var M=new je;M.line=c.lineFormat.line,M.lineFormatType=c.lineFormat.lineFormatType,M.color=c.lineFormat.color,M.weight=c.lineFormat.weight,M.dashStyle=c.lineFormat.lineStyle,D.lineFormat=M}if(c.hasOwnProperty("fillFormat")){var A=new qe;A.color=c.fillFormat.color,A.fill=c.fillFormat.weight,D.fillFormat=A}if(c.hasOwnProperty("textFrame")){var U=new _e;U.textVerticalAlignment=c.textFrame.textVerticalAlignment,U.marginLeft=c.textFrame.leftMargin,U.marginRight=c.textFrame.rightMargin,U.marginTop=c.textFrame.topMargin,U.marginBottom=c.textFrame.bottomMargin,this.parseBody(c.textFrame.blocks,U.childWidgets,U),D.textFrame=U,U.containerShape=D}D.line=r,r.children.push(D),"Inline"!==D.textWrappingStyle&&i.floatingElements.push(D)}else if(c.hasOwnProperty("contentControlProperties")){var z=new Le("Inline"),V=new Le("Inline");this.parseContentControlProperties(c.contentControlProperties,z.contentControlProperties),V.contentControlProperties=z.contentControlProperties,z.line=r,V.line=r,z.type=0,V.type=1,r.children.push(z),this.parseParagraph(c.inlines,i,n,r);for(var _=r.children[r.children.length-1];!(_ instanceof Le);)_.contentControlProperties=z.contentControlProperties,_=_.previousElement;r.children.push(V),a=!0}}return this.isCutPerformed=!1,o||i.childWidgets.push(r),a},e.prototype.applyCharacterStyle=function(e,i){if(!t.isNullOrUndefined(e.characterFormat)&&!t.isNullOrUndefined(e.characterFormat.styleName)){var n=this.documentHelper.styles.findByName(e.characterFormat.styleName,"Character");i.characterFormat.applyStyle(n)}},e.prototype.parseEditableRangeStart=function(e){var i=new Ye;return t.isNullOrUndefined(e.columnFirst)||(i.columnFirst=e.columnFirst),t.isNullOrUndefined(e.columnLast)||(i.columnLast=e.columnLast),t.isNullOrUndefined(e.user)||(i.user=e.user,-1===this.documentHelper.userCollection.indexOf(i.user)&&this.documentHelper.userCollection.push(i.user),this.addEditRangeCollection(i.user,i)),t.isNullOrUndefined(e.group)||""===e.group||(i.group=e.group,i.group="everyone"===i.group?"Everyone":i.group,-1===this.documentHelper.userCollection.indexOf(i.group)&&this.documentHelper.userCollection.push(i.group),this.addEditRangeCollection(i.group,i)),i},e.prototype.addEditRangeCollection=function(e,t){if(this.documentHelper.editRanges.containsKey(e))this.documentHelper.editRanges.get(e).push(t);else{var i=[];i.push(t),this.documentHelper.editRanges.add(e,i)}},e.prototype.parseChartTitleArea=function(e,t){t.chartfontName=e.fontName,t.chartFontSize=e.fontSize,this.parseChartDataFormat(e.dataFormat,t.dataFormat),this.parseChartLayout(e.layout,t.layout)},e.prototype.parseChartDataFormat=function(e,t){t.fill.color=e.fill.foreColor,t.fill.rgb=e.fill.rgb,t.line.color=e.line.color,t.line.rgb=e.line.rgb},e.prototype.parseChartLayout=function(e,t){t.chartLayoutLeft=e.layoutX,t.chartLayoutTop=e.layoutY},e.prototype.parseChartLegend=function(e,t){t.chartLegendPostion=e.position,this.parseChartTitleArea(e.chartTitleArea,t.chartTitleArea)},e.prototype.parseChartCategoryAxis=function(e,t){t.categoryAxisType=e.categoryType,t.categoryNumberFormat=e.numberFormat,t.interval=e.majorUnit,t.axisFontSize=e.fontSize,t.axisFontName=e.fontName,t.max=e.maximumValue,t.min=e.minimumValue,t.majorGridLines=e.hasMajorGridLines,t.minorGridLines=e.hasMinorGridLines,t.majorTick=e.majorTickMark,t.minorTick=e.minorTickMark,t.tickPosition=e.tickLabelPosition,t.categoryAxisTitle=e.chartTitle,null!=e.chartTitle&&this.parseChartTitleArea(e.chartTitleArea,t.chartTitleArea)},e.prototype.parseChartDataTable=function(e,t){t.showSeriesKeys=e.showSeriesKeys,t.hasHorzBorder=e.hasHorzBorder,t.hasVertBorder=e.hasVertBorder,t.hasBorders=e.hasBorders},e.prototype.parseChartArea=function(e,t){t.chartForeColor=e.foreColor},e.prototype.parseChartData=function(e,t){for(var i=0;i<e.chartCategory.length;i++){var n=new Qe,r=e.chartCategory[i];r.hasOwnProperty("categoryXName")&&(n.xName=r.categoryXName);for(var o=0;o<r.chartData.length;o++){var s=new $e,a=r.chartData[o];s.yAxisValue=a.yValue,"Bubble"===e.chartType&&(s.bubbleSize=a.size),n.chartData.push(s)}t.chartCategory.push(n)}this.parseChartSeries(e,t)},e.prototype.parseChartSeries=function(e,t){for(var i=e.chartType,n="Pie"===i||"Doughnut"===i,r=0;r<e.chartSeries.length;r++){var o=new tt,s=e.chartSeries[r];if(s.hasOwnProperty("seriesName")){if(o.seriesName=s.seriesName,n&&(s.hasOwnProperty("firstSliceAngle")&&(o.firstSliceAngle=s.firstSliceAngle),"Doughnut"===i&&(o.doughnutHoleSize=s.holeSize)),s.hasOwnProperty("dataLabel")&&this.parseChartDataLabels(s.dataLabel,o),s.hasOwnProperty("seriesFormat")){var a=new nt,l=s.seriesFormat;a.markerStyle=l.markerStyle,a.markerColor=l.markerColor,a.numberValue=l.markerSize,o.seriesFormat=a}if(s.hasOwnProperty("errorBar")){var d=o.errorBar;d.errorType=s.errorBar.type,d.errorDirection=s.errorBar.direction,d.errorEndStyle=s.errorBar.endStyle,d.numberValue=s.errorBar.numberValue}s.hasOwnProperty("trendLines")&&this.parseChartTrendLines(s.trendLines,o),this.parseChartSeriesDataPoints(s.dataPoints,o)}t.chartSeries.push(o)}},e.prototype.parseChartDataLabels=function(e,t){var i=new rt;i.labelPosition=e.position,i.fontName=e.fontName,i.fontColor=e.fontColor,i.fontSize=e.fontSize,i.isLegendKey=e.isLegendKey,i.isBubbleSize=e.isBubbleSize,i.isCategoryName=e.isCategoryName,i.isSeriesName=e.isSeriesName,i.isValue=e.isValue,i.isPercentage=e.isPercentage,i.isLeaderLines=e.isLeaderLines,t.dataLabels=i},e.prototype.parseChartSeriesDataPoints=function(e,t){for(var i=0;i<e.length;i++){var n=new at;this.parseChartDataFormat(e[i],n),t.chartDataFormat.push(n)}},e.prototype.parseChartTrendLines=function(e,t){for(var i=0;i<e.length;i++){var n=e[i],r=new ot;r.trendLineName=n.name,r.trendLineType=n.type,r.forwardValue=n.forward,r.backwardValue=n.backward,r.interceptValue=n.intercept,r.isDisplayEquation=n.isDisplayEquation,r.isDisplayRSquared=n.isDisplayRSquared,t.trendLines.push(r)}},e.prototype.parseTableFormat=function(e,i){this.parseBorders(e.borders,i.borders),t.isNullOrUndefined(e.allowAutoFit)||(i.allowAutoFit=e.allowAutoFit),t.isNullOrUndefined(e.cellSpacing)||(i.cellSpacing=e.cellSpacing),t.isNullOrUndefined(e.leftMargin)||(i.leftMargin=e.leftMargin),t.isNullOrUndefined(e.topMargin)||(i.topMargin=e.topMargin),t.isNullOrUndefined(e.rightMargin)||(i.rightMargin=e.rightMargin),t.isNullOrUndefined(e.bottomMargin)||(i.bottomMargin=e.bottomMargin),t.isNullOrUndefined(e.leftIndent)||(i.leftIndent=e.leftIndent),this.parseShading(e.shading,i.shading),t.isNullOrUndefined(e.tableAlignment)||(i.tableAlignment=e.tableAlignment),t.isNullOrUndefined(e.preferredWidth)||(i.preferredWidth=e.preferredWidth),t.isNullOrUndefined(e.preferredWidthType)||(i.preferredWidthType=e.preferredWidthType),t.isNullOrUndefined(e.bidi)||(i.bidi=e.bidi),t.isNullOrUndefined(e.horizontalPositionAbs)||(i.horizontalPositionAbs=e.horizontalPositionAbs),t.isNullOrUndefined(e.horizontalPosition)||(i.horizontalPosition=e.horizontalPosition)},e.prototype.parseCellFormat=function(e,i){t.isNullOrUndefined(e)||(this.parseBorders(e.borders,i.borders),e.isSamePaddingAsTable||this.parseCellMargin(e,i),t.isNullOrUndefined(e.cellWidth)||(i.cellWidth=e.cellWidth),t.isNullOrUndefined(e.columnSpan)||(i.columnSpan=e.columnSpan),t.isNullOrUndefined(e.rowSpan)||(i.rowSpan=e.rowSpan),this.parseShading(e.shading,i.shading),t.isNullOrUndefined(e.verticalAlignment)||(i.verticalAlignment=e.verticalAlignment),t.isNullOrUndefined(e.preferredWidthType)||(i.preferredWidthType=e.preferredWidthType),t.isNullOrUndefined(e.preferredWidth)||(i.preferredWidth=e.preferredWidth))},e.prototype.parseCellMargin=function(e,i){t.isNullOrUndefined(e.leftMargin)||(i.leftMargin=e.leftMargin),t.isNullOrUndefined(e.rightMargin)||(i.rightMargin=e.rightMargin),t.isNullOrUndefined(e.topMargin)||(i.topMargin=e.topMargin),t.isNullOrUndefined(e.bottomMargin)||(i.bottomMargin=e.bottomMargin)},e.prototype.parseRowFormat=function(e,i){t.isNullOrUndefined(e)||(t.isNullOrUndefined(e.allowBreakAcrossPages)||(i.allowBreakAcrossPages=e.allowBreakAcrossPages),t.isNullOrUndefined(e.isHeader)||(i.isHeader=e.isHeader),t.isNullOrUndefined(e.heightType)||(i.heightType=e.heightType),t.isNullOrUndefined(e.height)||(i.height=e.height),t.isNullOrUndefined(e.leftMargin)||(i.leftMargin=e.leftMargin),t.isNullOrUndefined(e.topMargin)||(i.topMargin=e.topMargin),t.isNullOrUndefined(e.rightMargin)||(i.rightMargin=e.rightMargin),t.isNullOrUndefined(e.bottomMargin)||(i.bottomMargin=e.bottomMargin),t.isNullOrUndefined(e.leftIndent)||(i.leftIndent=e.leftIndent),!t.isNullOrUndefined(e.revisionIds)&&e.revisionIds.length>0&&this.checkAndApplyRevision(e,i),this.parseBorders(e.borders,i.borders))},e.prototype.parseBorders=function(e,i){t.isNullOrUndefined(e)||(this.parseBorder(e.left,i.left),this.parseBorder(e.right,i.right),this.parseBorder(e.top,i.top),this.parseBorder(e.bottom,i.bottom),this.parseBorder(e.vertical,i.vertical),this.parseBorder(e.horizontal,i.horizontal),this.parseBorder(e.diagonalDown,i.diagonalDown),this.parseBorder(e.diagonalUp,i.diagonalUp))},e.prototype.parseBorder=function(e,i){t.isNullOrUndefined(e)||(t.isNullOrUndefined(e.color)||(i.color=this.getColor(e.color)),t.isNullOrUndefined(e.lineStyle)||(i.lineStyle=e.lineStyle),t.isNullOrUndefined(e.lineWidth)||(i.lineWidth=e.lineWidth),t.isNullOrUndefined(e.hasNoneStyle)||(i.hasNoneStyle=e.hasNoneStyle))},e.prototype.parseShading=function(e,i){t.isNullOrUndefined(e)||(t.isNullOrUndefined(e.backgroundColor)||(i.backgroundColor=this.getColor(e.backgroundColor)),t.isNullOrUndefined(e.foregroundColor)||(i.foregroundColor=this.getColor(e.foregroundColor)),t.isNullOrUndefined(e.texture)&&t.isNullOrUndefined(e.textureStyle)||(i.textureStyle=t.isNullOrUndefined(e.texture)?e.textureStyle:e.texture))},e.prototype.parseCharacterFormat=function(e,i,n){if(!t.isNullOrUndefined(e)){if(n&&e.hasOwnProperty("inlineFormat"))return void this.parseCharacterFormat(e.inlineFormat,i);t.isNullOrUndefined(e.baselineAlignment)||(i.baselineAlignment=e.baselineAlignment),t.isNullOrUndefined(e.underline)||(i.underline=e.underline),t.isNullOrUndefined(e.strikethrough)||(i.strikethrough=e.strikethrough),t.isNullOrUndefined(e.fontSize)||(i.fontSize=e.fontSize),t.isNullOrUndefined(e.fontFamily)||(-1!==e.fontFamily.indexOf('"')&&(e.fontFamily=e.fontFamily.replace('"',"")),i.fontFamily=e.fontFamily),t.isNullOrUndefined(e.bold)||(i.bold=e.bold),t.isNullOrUndefined(e.italic)||(i.italic=e.italic),t.isNullOrUndefined(e.highlightColor)||(i.highlightColor=e.highlightColor),t.isNullOrUndefined(e.fontColor)||(i.fontColor=this.getColor(e.fontColor)),t.isNullOrUndefined(e.bidi)||(i.bidi=e.bidi),t.isNullOrUndefined(e.bdo)||(i.bdo=e.bdo),t.isNullOrUndefined(e.fontSizeBidi)||(i.fontSizeBidi=e.fontSizeBidi),t.isNullOrUndefined(e.fontFamilyBidi)||(i.fontFamilyBidi=e.fontFamilyBidi),t.isNullOrUndefined(e.boldBidi)||(i.boldBidi=e.boldBidi),t.isNullOrUndefined(e.italicBidi)||(i.italicBidi=e.italicBidi),!t.isNullOrUndefined(e.revisionIds)&&e.revisionIds.length>0&&this.checkAndApplyRevision(e,i),t.isNullOrUndefined(e.allCaps)||(i.allCaps=e.allCaps)}},e.prototype.getColor=function(e){return e||"#ffffff"},e.prototype.parseParagraphFormat=function(e,i){t.isNullOrUndefined(e)||(t.isNullOrUndefined(e.bidi)||(i.bidi=e.bidi),t.isNullOrUndefined(e.leftIndent)||(i.leftIndent=e.leftIndent),t.isNullOrUndefined(e.rightIndent)||(i.rightIndent=e.rightIndent),t.isNullOrUndefined(e.firstLineIndent)||(i.firstLineIndent=e.firstLineIndent),t.isNullOrUndefined(e.afterSpacing)||(i.afterSpacing=e.afterSpacing),t.isNullOrUndefined(e.beforeSpacing)||(i.beforeSpacing=e.beforeSpacing),t.isNullOrUndefined(e.lineSpacing)||(i.lineSpacing=e.lineSpacing),t.isNullOrUndefined(e.lineSpacingType)?t.isNullOrUndefined(e.lineSpacing)||(i.lineSpacingType="Multiple"):i.lineSpacingType=e.lineSpacingType,t.isNullOrUndefined(e.textAlignment)||(i.textAlignment=e.textAlignment),t.isNullOrUndefined(e.outlineLevel)||(i.outlineLevel=e.outlineLevel),t.isNullOrUndefined(e.contextualSpacing)||(i.contextualSpacing=e.contextualSpacing),i.listFormat=new x,e.hasOwnProperty("listFormat")&&this.parseListFormat(e,i.listFormat),e.hasOwnProperty("tabs")&&this.parseTabStop(e.tabs,i.tabs))},e.prototype.parseListFormat=function(e,i){t.isNullOrUndefined(e.listFormat)||(t.isNullOrUndefined(e.listFormat.listId)||(i.listId=e.listFormat.listId,i.list=this.documentHelper.getListById(e.listFormat.listId)),t.isNullOrUndefined(e.listFormat.listLevelNumber)||(i.listLevelNumber=e.listFormat.listLevelNumber))},e.prototype.parseSectionFormat=function(e,i){t.isNullOrUndefined(e.pageWidth)||(i.pageWidth=e.pageWidth),t.isNullOrUndefined(e.pageHeight)||(i.pageHeight=e.pageHeight),t.isNullOrUndefined(e.leftMargin)||(i.leftMargin=e.leftMargin),t.isNullOrUndefined(e.topMargin)||(i.topMargin=e.topMargin),t.isNullOrUndefined(e.rightMargin)||(i.rightMargin=e.rightMargin),t.isNullOrUndefined(e.bottomMargin)||(i.bottomMargin=e.bottomMargin),t.isNullOrUndefined(e.headerDistance)||(i.headerDistance=e.headerDistance),t.isNullOrUndefined(e.footerDistance)||(i.footerDistance=e.footerDistance),t.isNullOrUndefined(e.differentFirstPage)||(i.differentFirstPage=e.differentFirstPage),t.isNullOrUndefined(e.differentOddAndEvenPages)||(i.differentOddAndEvenPages=e.differentOddAndEvenPages),t.isNullOrUndefined(e.bidi)||(i.bidi=e.bidi),t.isNullOrUndefined(e.restartPageNumbering)||(i.restartPageNumbering=e.restartPageNumbering),t.isNullOrUndefined(e.pageStartingNumber)||(i.pageStartingNumber=e.pageStartingNumber),t.isNullOrUndefined(e.endnoteNumberFormat)||(i.endnoteNumberFormat=e.endnoteNumberFormat),t.isNullOrUndefined(e.footNoteNumberFormat)||(i.footNoteNumberFormat=e.footNoteNumberFormat),t.isNullOrUndefined(e.restartIndexForFootnotes)||(i.restartIndexForFootnotes=e.restartIndexForFootnotes),t.isNullOrUndefined(e.pageStartingNumber)||(i.restartIndexForEndnotes=e.restartIndexForEndnotes),t.isNullOrUndefined(e.initialFootNoteNumber)||(i.initialFootNoteNumber=e.initialFootNoteNumber),t.isNullOrUndefined(e.initialEndNoteNumber)||(i.initialEndNoteNumber=e.initialEndNoteNumber)},e.prototype.parseTabStop=function(e,t){if(e)for(var i=0;i<e.length;i++){var n=new F;n.position=e[i].position,n.tabLeader=e[i].tabLeader,n.deletePosition=e[i].deletePosition,n.tabJustification=e[i].tabJustification,t.push(n)}},e.prototype.validateImageUrl=function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i=3*(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;return e.charAt(e.length-1)===t.charAt(64)&&i--,e.charAt(e.length-2)===t.charAt(64)&&i--,i%1==0},e}(),wt=function(){function e(e){this.boldIn=void 0,this.italicIn=void 0,this.underlineIn=void 0,this.strikeThroughIn=void 0,this.baselineAlignmentIn=void 0,this.highlightColorIn=void 0,this.fontSizeIn=0,this.fontColorIn=void 0,this.allCapsIn=void 0,this.boldBidi=void 0,this.italicBidi=void 0,this.fontSizeBidi=0,this.bidi=void 0,this.bdo=void 0,this.selection=e}return Object.defineProperty(e.prototype,"fontSize",{get:function(){return this.fontSizeIn},set:function(e){e!==this.fontSizeIn&&(this.fontSizeIn=e,this.notifyPropertyChanged("fontSize"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontFamily",{get:function(){return this.fontFamilyIn},set:function(e){e!==this.fontFamilyIn&&(this.fontFamilyIn=e,this.notifyPropertyChanged("fontFamily"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fontColor",{get:function(){return this.fontColorIn},set:function(e){e!==this.fontColorIn&&(this.fontColorIn=e,this.notifyPropertyChanged("fontColor"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bold",{get:function(){return this.boldIn},set:function(e){e!==this.boldIn&&(this.boldIn=e,this.notifyPropertyChanged("bold"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"italic",{get:function(){return this.italicIn},set:function(e){e!==this.italic&&(this.italicIn=e,this.notifyPropertyChanged("italic"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"strikethrough",{get:function(){return this.strikeThroughIn},set:function(e){e!==this.strikeThroughIn&&(this.strikeThroughIn=e,this.notifyPropertyChanged("strikethrough"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"baselineAlignment",{get:function(){return this.baselineAlignmentIn},set:function(e){e!==this.baselineAlignmentIn&&(this.baselineAlignmentIn=e,this.notifyPropertyChanged("baselineAlignment"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"underline",{get:function(){return this.underlineIn},set:function(e){e!==this.underlineIn&&(this.underlineIn=e,this.notifyPropertyChanged("underline"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"highlightColor",{get:function(){return this.highlightColorIn},set:function(e){e===this.highlightColorIn&&"NoColor"!==e||(this.highlightColorIn=e,this.notifyPropertyChanged("highlightColor"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"allCaps",{get:function(){return this.allCapsIn},set:function(e){e!==this.allCapsIn&&(this.allCapsIn=e,this.notifyPropertyChanged("allCaps"))},enumerable:!0,configurable:!0}),e.prototype.getPropertyValue=function(e){switch(e){case"bold":return this.bold;case"italic":return this.italic;case"fontSize":if(this.fontSize>=1)return this.fontSize;return;case"fontFamily":return this.fontFamily;case"strikethrough":return this.strikethrough;case"baselineAlignment":return this.baselineAlignment;case"highlightColor":return this.highlightColor;case"underline":return this.underline;case"fontColor":return this.fontColor;case"allCaps":return this.allCaps;default:return}},e.prototype.notifyPropertyChanged=function(e){if((t.isNullOrUndefined(this.selection)||!(this.selection.isCleared||this.selection.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||!this.selection.owner.isDocumentLoaded||this.selection.owner.isPastingContent)||this.selection.isRetrieveFormatting)&&!t.isNullOrUndefined(this.selection)&&!t.isNullOrUndefined(this.selection.start)&&!this.selection.isRetrieveFormatting){var i=this.getPropertyValue(e);t.isNullOrUndefined(i)||this.selection.owner.editorModule.onApplyCharacterFormat(e,i)}},e.prototype.copyFormat=function(e){this.styleName=t.isNullOrUndefined(e.baseCharStyle)?"Default Paragraph Font":e.baseCharStyle.name,this.fontSize=e.fontSize,this.fontFamily=e.fontFamily,this.bold=e.bold,this.italic=e.italic,this.baselineAlignment=e.baselineAlignment,this.underline=e.underline,this.fontColor=e.fontColor,this.highlightColor=e.highlightColor,this.strikethrough=e.strikethrough,this.bidi=e.bidi,this.bdo=e.bdo,this.boldBidi=e.boldBidi,this.italicBidi=e.italicBidi,this.fontFamilyBidi=e.fontFamilyBidi,this.fontSizeBidi=e.fontSizeBidi,this.allCaps=e.allCaps},e.prototype.combineFormat=function(e){t.isNullOrUndefined(this.bold)||this.bold===e.bold||(this.bold=void 0),t.isNullOrUndefined(this.italic)||this.italic===e.italic||(this.italic=void 0),0!==this.fontSize&&this.fontSize!==e.fontSize&&(this.fontSize=0),t.isNullOrUndefined(this.fontFamily)||this.fontFamily===e.fontFamily||(this.fontFamily=void 0),t.isNullOrUndefined(this.highlightColor)||this.highlightColor===e.highlightColor||(this.highlightColor=void 0),t.isNullOrUndefined(this.baselineAlignment)||this.baselineAlignment===e.baselineAlignment||(this.baselineAlignment=void 0),t.isNullOrUndefined(this.fontColor)||this.fontColor===e.fontColor||(this.fontColor=void 0),t.isNullOrUndefined(this.underline)||this.underline===e.underline||(this.underline=void 0),t.isNullOrUndefined(this.strikethrough)||this.strikethrough===e.strikethrough||(this.strikethrough=void 0),t.isNullOrUndefined(this.boldBidi)||this.boldBidi===e.boldBidi||(this.boldBidi=void 0),t.isNullOrUndefined(this.italicBidi)||this.italicBidi===e.italicBidi||(this.italicBidi=void 0),0!==this.fontSizeBidi&&this.fontSizeBidi!==e.fontSizeBidi&&(this.fontSizeBidi=0),t.isNullOrUndefined(this.fontFamilyBidi)||this.fontFamilyBidi===e.fontFamilyBidi||(this.fontFamilyBidi=void 0),t.isNullOrUndefined(this.bidi)||this.bidi===e.bidi||(this.bidi=void 0),t.isNullOrUndefined(this.bdo)||this.bdo===e.bdo||(this.bdo=void 0),t.isNullOrUndefined(this.allCaps)||this.allCaps===e.allCaps||(this.allCaps=void 0)},e.prototype.cloneFormat=function(e){this.bold=e.bold,this.italic=e.italic,this.underline=e.underline,this.strikethrough=e.strikethrough,this.baselineAlignment=e.baselineAlignment,this.highlightColor=e.highlightColor,this.fontSize=e.fontSize,this.fontFamily=e.fontFamily,this.fontColor=e.fontColor,this.styleName=e.styleName,this.bidi=e.bidi,this.bdo=e.bdo,this.boldBidi=e.boldBidi,this.italicBidi=e.italicBidi,this.fontSizeBidi=e.fontSizeBidi,this.fontFamilyBidi=e.fontFamilyBidi,this.allCaps=e.allCaps},e.prototype.isEqualFormat=function(e){return this.fontSize===e.fontSize&&this.strikethrough===e.strikethrough&&this.bold===e.bold&&this.fontFamily===e.fontFamily&&this.underline===e.underline&&this.highlightColor===e.highlightColor&&this.italic===e.italic&&this.baselineAlignment===e.baselineAlignment&&this.fontColor===e.fontColor&&this.allCaps===e.allCaps},e.prototype.clearFormat=function(){this.fontSizeIn=0,this.boldIn=void 0,this.italicIn=void 0,this.fontFamilyIn=void 0,this.fontColorIn=void 0,this.underlineIn=void 0,this.strikeThroughIn=void 0,this.highlightColorIn=void 0,this.baselineAlignmentIn=void 0,this.styleName=void 0,this.bidi=void 0,this.bdo=void 0,this.boldBidi=void 0,this.italicBidi=void 0,this.fontFamilyBidi=void 0,this.fontSizeBidi=void 0,this.allCapsIn=void 0},e.prototype.destroy=function(){this.fontSizeIn=void 0,this.boldIn=void 0,this.italicIn=void 0,this.fontFamilyIn=void 0,this.fontColorIn=void 0,this.underlineIn=void 0,this.strikeThroughIn=void 0,this.baselineAlignmentIn=void 0,this.highlightColorIn=void 0,this.selection=void 0,this.styleName=void 0,this.bidi=void 0,this.bdo=void 0,this.boldBidi=void 0,this.italicBidi=void 0,this.fontFamilyBidi=void 0,this.fontSizeBidi=void 0,this.allCapsIn=void 0},e}(),Ct=function(){function e(e,t){this.leftIndentIn=0,this.rightIndentIn=0,this.beforeSpacingIn=0,this.afterSpacingIn=0,this.textAlignmentIn=void 0,this.firstLineIndentIn=0,this.lineSpacingIn=1,this.lineSpacingTypeIn=void 0,this.bidiIn=void 0,this.contextualSpacingIn=void 0,this.listLevelNumberIn=-1,this.selection=e,this.documentHelper=t}return Object.defineProperty(e.prototype,"leftIndent",{get:function(){return this.leftIndentIn},set:function(e){e!==this.leftIndentIn&&(this.leftIndentIn=e,this.notifyPropertyChanged("leftIndent"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightIndent",{get:function(){return this.rightIndentIn},set:function(e){e!==this.rightIndentIn&&(this.rightIndentIn=e,this.notifyPropertyChanged("rightIndent"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"firstLineIndent",{get:function(){return this.firstLineIndentIn},set:function(e){e!==this.firstLineIndentIn&&(this.firstLineIndentIn=e,this.notifyPropertyChanged("firstLineIndent"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textAlignment",{get:function(){return this.textAlignmentIn},set:function(e){e!==this.textAlignmentIn&&(this.textAlignmentIn=e,this.notifyPropertyChanged("textAlignment"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"afterSpacing",{get:function(){return this.afterSpacingIn},set:function(e){e!==this.afterSpacingIn&&(this.afterSpacingIn=e,this.notifyPropertyChanged("afterSpacing"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"beforeSpacing",{get:function(){return this.beforeSpacingIn},set:function(e){e!==this.beforeSpacingIn&&(this.beforeSpacingIn=e,this.notifyPropertyChanged("beforeSpacing"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineSpacing",{get:function(){return this.lineSpacingIn},set:function(e){e!==this.lineSpacingIn&&(this.lineSpacingIn=e,this.notifyPropertyChanged("lineSpacing"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineSpacingType",{get:function(){return this.lineSpacingTypeIn},set:function(e){e!==this.lineSpacingTypeIn&&(this.lineSpacingTypeIn=e,this.notifyPropertyChanged("lineSpacingType"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"listLevelNumber",{get:function(){return this.listLevelNumberIn},set:function(e){e!==this.listLevelNumberIn&&(this.listLevelNumberIn=e,this.notifyPropertyChanged("listLevelNumber"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bidi",{get:function(){return this.bidiIn},set:function(e){this.bidiIn=e,this.notifyPropertyChanged("bidi")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contextualSpacing",{get:function(){return this.contextualSpacingIn},set:function(e){this.contextualSpacingIn=e,this.notifyPropertyChanged("contextualSpacing")},enumerable:!0,configurable:!0}),e.prototype.validateLineSpacing=function(){return"Multiple"!==this.lineSpacingType&&this.lineSpacingIn<12},Object.defineProperty(e.prototype,"listText",{get:function(){var e=void 0,t=this.documentHelper.getListById(this.listId);if(t instanceof C&&this.listLevelNumberIn>-1&&this.listLevelNumberIn<9){var i=t.getListLevel(this.listLevelNumber);if(i instanceof _)if("Bullet"===i.listLevelPattern)e=i.numberFormat;else{e=i.numberFormat;for(var n=0;n<9;n++){var r="%"+(n+1);if(e.indexOf(r)>-1){n===this.listLevelNumberIn||t.getListLevel(n);var o=this.selection.getListTextElementBox(this.selection.start.paragraph);e=o?o.text:""}}}}return e},enumerable:!0,configurable:!0}),e.prototype.getPropertyValue=function(e){switch(e){case"leftIndent":return this.leftIndent;case"rightIndent":return this.rightIndent;case"firstLineIndent":return this.firstLineIndent;case"beforeSpacing":return this.beforeSpacing;case"afterSpacing":return this.afterSpacing;case"textAlignment":return this.textAlignment;case"lineSpacing":return this.lineSpacing;case"lineSpacingType":return this.lineSpacingType;case"bidi":return this.bidi;case"contextualSpacing":return this.contextualSpacing;default:return}},e.prototype.notifyPropertyChanged=function(e){if((t.isNullOrUndefined(this.selection)||(!this.selection.owner.isReadOnlyMode||this.selection.isInlineFormFillMode())&&this.selection.owner.isDocumentLoaded||this.selection.isRetrieveFormatting)&&!t.isNullOrUndefined(this.selection)&&!t.isNullOrUndefined(this.selection.start)&&!this.selection.isRetrieveFormatting){var i=this.selection.owner.editorModule;if("lineSpacing"===e||"lineSpacingType"===e){var n=this.selection.owner.editorHistory;if((!n||!n.isUndoing&&!n.isRedoing)&&this.validateLineSpacing()){if(this.selection.owner.editorHistory.initComplexHistory(this.selection,"LineSpacing"),"lineSpacing"===e){this.lineSpacingTypeIn="Multiple";var r=this.getPropertyValue("lineSpacingType");i.onApplyParagraphFormat("lineSpacingType",r,!1,!1),i.onApplyParagraphFormat(e,this.getPropertyValue(e),!1,!1)}else i.onApplyParagraphFormat(e,this.getPropertyValue(e),!1,!1),this.lineSpacingIn=12,i.onApplyParagraphFormat("lineSpacing",this.getPropertyValue("lineSpacing"),!1,!1);return void this.selection.owner.editorHistory.updateComplexHistory()}}var o=this.getPropertyValue(e);if(!("leftIndent"!==e&&"rightIndent"!==e&&"firstLineIndent"!==e||o>=-1056&&o<1056))return;"listLevelNumber"===e?i.onApplyListInternal(this.documentHelper.getListById(this.listId),this.listLevelNumber):i.onApplyParagraphFormat(e,o,"textAlignment"===e,!1)}},e.prototype.copyFormat=function(e){this.styleName=t.isNullOrUndefined(e.baseStyle)?"Normal":e.baseStyle.name,this.leftIndent=e.leftIndent,this.rightIndent=e.rightIndent,this.firstLineIndent=e.firstLineIndent,this.afterSpacing=e.afterSpacing,this.beforeSpacing=e.beforeSpacing,this.lineSpacing=e.lineSpacing,this.lineSpacingType=e.lineSpacingType,this.textAlignment=e.textAlignment,this.bidi=e.bidi,this.contextualSpacing=e.contextualSpacing,t.isNullOrUndefined(e.listFormat)||t.isNullOrUndefined(e.listFormat.listId)?(this.listId=void 0,this.listLevelNumber=0):(this.listId=e.listFormat.listId,this.listLevelNumber=e.listFormat.listLevelNumber)},e.prototype.copyToFormat=function(e){t.isNullOrUndefined(e)||(t.isNullOrUndefined(this.afterSpacing)||(e.afterSpacing=this.afterSpacing),t.isNullOrUndefined(this.beforeSpacing)||(e.beforeSpacing=this.beforeSpacing),t.isNullOrUndefined(this.leftIndent)||(e.leftIndent=this.leftIndent),t.isNullOrUndefined(this.rightIndent)||(e.rightIndent=this.rightIndent),t.isNullOrUndefined(this.textAlignment)||(e.textAlignment=this.textAlignment),t.isNullOrUndefined(this.lineSpacing)||(e.lineSpacing=this.lineSpacing),t.isNullOrUndefined(this.lineSpacingType)||(e.lineSpacingType=this.lineSpacingType),t.isNullOrUndefined(this.firstLineIndent)||(e.firstLineIndent=this.firstLineIndent),t.isNullOrUndefined(this.bidi)||(e.bidi=this.bidi),t.isNullOrUndefined(this.contextualSpacing)||(e.contextualSpacing=this.contextualSpacing))},e.prototype.combineFormat=function(e){t.isNullOrUndefined(this.leftIndent)||this.leftIndent===e.leftIndent||(this.leftIndent=void 0),t.isNullOrUndefined(this.rightIndent)||this.rightIndent===e.rightIndent||(this.rightIndent=void 0),t.isNullOrUndefined(this.firstLineIndent)||this.firstLineIndent===e.firstLineIndent||(this.firstLineIndent=void 0),0!==this.lineSpacing&&this.lineSpacing!==e.lineSpacing&&(this.lineSpacing=0),-1!==this.beforeSpacing&&this.beforeSpacing!==e.beforeSpacing&&(this.beforeSpacing=-1),-1!==this.afterSpacing&&this.afterSpacing!==e.afterSpacing&&(this.afterSpacing=-1),t.isNullOrUndefined(this.lineSpacingType)||this.lineSpacingType===e.lineSpacingType||(this.lineSpacingType=void 0),t.isNullOrUndefined(this.textAlignment)||this.textAlignment===e.textAlignment||(this.textAlignment=void 0),this.listLevelNumber>=0&&!t.isNullOrUndefined(this.listId)&&(t.isNullOrUndefined(e.listFormat)||e.listFormat.listLevelNumber!==this.listLevelNumber)&&(this.listLevelNumber=-1),(t.isNullOrUndefined(e.listFormat)||t.isNullOrUndefined(e.listFormat.listId)||!t.isNullOrUndefined(this.listId)&&this.listId!==e.listFormat.listId)&&(this.listId=void 0),t.isNullOrUndefined(this.bidi)||this.bidi===e.bidi||(this.bidi=void 0),t.isNullOrUndefined(this.contextualSpacing)||this.contextualSpacing===e.contextualSpacing||(this.contextualSpacing=void 0),!t.isNullOrUndefined(this.styleName)&&e.baseStyle&&this.styleName!==e.baseStyle.name&&(this.styleName=void 0)},e.prototype.clearFormat=function(){this.leftIndent=0,this.rightIndent=0,this.beforeSpacing=0,this.afterSpacing=0,this.firstLineIndent=0,this.lineSpacing=1,this.textAlignment=void 0,this.lineSpacingType=void 0,this.listId=void 0,this.listLevelNumber=-1,this.styleName=void 0,this.bidi=void 0,this.contextualSpacing=void 0},e.prototype.getList=function(){var e=this.documentHelper.getListById(this.listId);if(!t.isNullOrUndefined(e)){var i=new C,n=new V,r=this.documentHelper.getAbstractListById(e.abstractListId),o=this.selection.owner.editorModule;if(t.isNullOrUndefined(r))n.levels.push(new _(n));else for(a=0;a<r.levels.length;a++){var s=o.cloneListLevel(r.levels[a]);n.levels.push(s),s.ownerBase=n}if(!t.isNullOrUndefined(e.levelOverrides))for(var a=0;a<e.levelOverrides.length;a++){var l=o.cloneLevelOverride(e.levelOverrides[a]);i.levelOverrides.push(l)}return i.abstractList=n,i.abstractListId=n.abstractListId,i.sourceListId=e.listId,i}},e.prototype.setList=function(e){if((!this.documentHelper.owner.isReadOnlyMode||this.selection.isInlineFormFillMode())&&this.documentHelper.owner.isDocumentLoaded){var i=this.documentHelper.getListById(this.listId),n=void 0,r=e?this.documentHelper.getAbstractListById(e.abstractListId):void 0;if(t.isNullOrUndefined(i)||t.isNullOrUndefined(e)||t.isNullOrUndefined(r)||e.sourceListId!==i.listId)t.isNullOrUndefined(e)?this.selection.owner.editorModule.onApplyList(void 0):(this.selection.owner.isLayoutEnabled=!1,t.isNullOrUndefined(r)||-1!==this.documentHelper.abstractLists.indexOf(r)||this.documentHelper.abstractLists.push(r),-1===this.documentHelper.lists.indexOf(e)&&this.documentHelper.lists.push(e),this.selection.owner.isLayoutEnabled=!0,this.selection.owner.editorModule.onApplyList(e));else{var o=this.documentHelper.owner.editorHistory;this.documentHelper.layout.getListLevel(i,1);this.selection.owner.isLayoutEnabled=!1,this.documentHelper.owner.editorModule.setOffsetValue(this.selection),o&&(n=o.updateListChangesInHistory(r,i)),this.documentHelper.owner.editorModule.updateListParagraphs(),o&&o.applyListChanges(this.selection,n),this.selection.owner.isLayoutEnabled=!0,this.documentHelper.renderedLists.clear(),this.documentHelper.renderedLevelOverrides=[],this.documentHelper.owner.editorModule.layoutWholeDocument(),this.documentHelper.owner.editorModule.updateSelectionTextPosition(!1),o&&o.currentBaseHistoryInfo&&(o.currentBaseHistoryInfo.modifiedProperties.length>0&&o.currentBaseHistoryInfo.updateSelection(),o.updateHistory()),this.documentHelper.owner.editorModule.fireContentChange()}}},e.prototype.destroy=function(){this.leftIndentIn=void 0,this.rightIndentIn=void 0,this.beforeSpacingIn=void 0,this.afterSpacingIn=void 0,this.firstLineIndentIn=void 0,this.lineSpacingIn=void 0,this.textAlignmentIn=void 0,this.lineSpacingTypeIn=void 0,this.listId=void 0,this.listLevelNumberIn=void 0,this.documentHelper=void 0,this.selection=void 0,this.styleName=void 0,this.bidi=void 0,this.contextualSpacing=void 0},e}(),xt=function(){function e(e){this.differentFirstPageIn=void 0,this.differentOddAndEvenPagesIn=void 0,this.bidi=void 0,this.selection=e}return Object.defineProperty(e.prototype,"pageHeight",{get:function(){return this.pageHeightIn},set:function(e){this.pageHeightIn=e,this.notifyPropertyChanged("pageHeight")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageWidth",{get:function(){return this.pageWidthIn},set:function(e){this.pageWidthIn=e,this.notifyPropertyChanged("pageWidth")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leftMargin",{get:function(){return this.leftMarginIn},set:function(e){this.leftMarginIn=e,this.notifyPropertyChanged("leftMargin")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bottomMargin",{get:function(){return this.bottomMarginIn},set:function(e){this.bottomMarginIn=e,this.notifyPropertyChanged("bottomMargin")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"topMargin",{get:function(){return this.topMarginIn},set:function(e){this.topMarginIn=e,this.notifyPropertyChanged("topMargin")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightMargin",{get:function(){return this.rightMarginIn},set:function(e){this.rightMarginIn=e,this.notifyPropertyChanged("rightMargin")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"headerDistance",{get:function(){return this.headerDistanceIn},set:function(e){this.headerDistanceIn=e,this.notifyPropertyChanged("headerDistance")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"pageStartingNumber",{get:function(){return this.pageStartingNumberIn},set:function(e){this.pageStartingNumberIn=e,this.notifyPropertyChanged("pageStartingNumber")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"restartPageNumbering",{get:function(){return this.restartPageNumberingIn},set:function(e){this.restartPageNumberingIn=e,this.notifyPropertyChanged("restartPageNumbering")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"footerDistance",{get:function(){return this.footerDistanceIn},set:function(e){this.footerDistanceIn=e,this.notifyPropertyChanged("footerDistance")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"differentFirstPage",{get:function(){return this.differentFirstPageIn},set:function(e){this.differentFirstPageIn=e,this.notifyPropertyChanged("differentFirstPage")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"differentOddAndEvenPages",{get:function(){return this.differentOddAndEvenPagesIn},set:function(e){this.differentOddAndEvenPagesIn=e,this.notifyPropertyChanged("differentOddAndEvenPages")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endnoteNumberFormat",{get:function(){return this.endnoteNumberFormatIn},set:function(e){this.endnoteNumberFormatIn=e,this.notifyPropertyChanged("endnoteNumberFormat")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"footNoteNumberFormat",{get:function(){return this.footNoteNumberFormatIn},set:function(e){this.footNoteNumberFormatIn=e,this.notifyPropertyChanged("footNoteNumberFormat")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"initialFootNoteNumber",{get:function(){return this.initialFootNoteNumberIn},set:function(e){this.initialFootNoteNumberIn=e,this.notifyPropertyChanged("initialFootNoteNumber")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"initialEndNoteNumber",{get:function(){return this.initialEndNoteNumberIn},set:function(e){this.initialEndNoteNumberIn=e,this.notifyPropertyChanged("initialEndNoteNumber")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"restartIndexForFootnotes",{get:function(){return this.restartIndexForFootnotesIn},set:function(e){this.restartIndexForFootnotesIn=e,this.notifyPropertyChanged("restartIndexForFootnotes")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"restartIndexForEndnotes",{get:function(){return this.restartIndexForEndnotesIn},set:function(e){this.restartIndexForEndnotesIn=e,this.notifyPropertyChanged("restartIndexForEndnotes")},enumerable:!0,configurable:!0}),e.prototype.copyFormat=function(e){this.pageHeight=e.pageHeight,this.pageWidth=e.pageWidth,this.leftMargin=e.leftMargin,this.topMargin=e.topMargin,this.rightMargin=e.rightMargin,this.bottomMargin=e.bottomMargin,this.headerDistance=e.headerDistance,this.footerDistance=e.footerDistance,this.differentFirstPage=e.differentFirstPage,this.differentOddAndEvenPages=e.differentOddAndEvenPages,this.bidi=e.bidi,this.pageStartingNumber=e.pageStartingNumber,this.restartPageNumbering=e.restartPageNumbering,this.endnoteNumberFormat=e.endnoteNumberFormat,this.footNoteNumberFormat=e.footNoteNumberFormat,this.restartIndexForEndnotes=e.restartIndexForEndnotes,this.restartIndexForFootnotes=e.restartIndexForFootnotes,this.initialEndNoteNumber=e.initialEndNoteNumber,this.initialFootNoteNumber=e.initialFootNoteNumber},e.prototype.notifyPropertyChanged=function(e){var i=this.selection;if((t.isNullOrUndefined(i)||!(i.isCleared||i.owner.isPastingContent||i.owner.isReadOnlyMode)&&i.owner.isDocumentLoaded||i.isRetrieveFormatting)&&!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(i.start)&&!i.isRetrieveFormatting){var n=this.getPropertyvalue(e);t.isNullOrUndefined(n)||i.owner.editorModule.onApplySectionFormat(e,n)}},e.prototype.getPropertyvalue=function(e){switch(e){case"pageHeight":if(this.pageHeight>0)return this.pageHeight;return;case"pageWidth":if(this.pageWidth>0)return this.pageWidth;return;case"leftMargin":if(this.leftMargin>=0)return this.leftMargin;return;case"rightMargin":if(this.rightMargin>=0)return this.rightMargin;return;case"topMargin":if(this.topMargin>=0)return this.topMargin;return;case"bottomMargin":if(this.bottomMargin>=0)return this.bottomMargin;return;case"differentFirstPage":if(!t.isNullOrUndefined(this.differentFirstPage))return this.differentFirstPage;return;case"differentOddAndEvenPages":if(!t.isNullOrUndefined(this.differentOddAndEvenPages))return this.differentOddAndEvenPages;return;case"headerDistance":return this.headerDistanceIn;case"footerDistance":return this.footerDistance;case"pageStartingNumber":if(!t.isNullOrUndefined(this.pageStartingNumber))return this.pageStartingNumber;return;case"restartPageNumbering":if(!t.isNullOrUndefined(this.restartPageNumbering))return this.restartPageNumbering;return;case"endnoteNumberFormat":return this.endnoteNumberFormatIn;case"restartIndexForEndnotes":return this.restartIndexForEndnotesIn;case"restartIndexForFootnotes":return this.restartIndexForFootnotesIn;case"footNoteNumberFormat":return this.footNoteNumberFormatIn;case"initialFootNoteNumber":return this.initialFootNoteNumber;case"initialEndNoteNumber":return this.initialEndNoteNumber;default:return}},e.prototype.combineFormat=function(e){this.pageHeight>0&&this.pageHeight!==e.pageHeight&&(this.pageHeight=0),this.pageWidth>0&&this.pageWidth!==e.pageWidth&&(this.pageWidth=0),this.leftMargin>-1&&this.leftMargin!==e.leftMargin&&(this.leftMargin=-1),this.topMargin>-1&&this.topMargin!==e.topMargin&&(this.topMargin=-1),this.rightMargin>-1&&this.rightMargin!==e.rightMargin&&(this.rightMargin=-1),this.bottomMargin>-1&&this.bottomMargin!==e.bottomMargin&&(this.bottomMargin=-1),0!==this.headerDistance&&this.headerDistance!==e.headerDistance&&(this.headerDistance=0),0!==this.footerDistance&&this.footerDistance!==e.footerDistance&&(this.footerDistance=0),t.isNullOrUndefined(this.differentFirstPage)||this.differentFirstPage===e.differentFirstPage||(this.differentFirstPage=void 0),t.isNullOrUndefined(this.pageStartingNumber)||this.pageStartingNumber===e.pageStartingNumber||(this.pageStartingNumber=void 0),t.isNullOrUndefined(this.restartPageNumbering)||this.restartPageNumbering===e.restartPageNumbering||(this.restartPageNumbering=void 0),t.isNullOrUndefined(this.differentOddAndEvenPages)||this.differentOddAndEvenPages===e.differentOddAndEvenPages||(this.differentOddAndEvenPages=void 0),t.isNullOrUndefined(this.bidi)||this.bidi===e.bidi||(this.bidi=void 0),t.isNullOrUndefined(this.endnoteNumberFormat)||this.endnoteNumberFormat===e.endnoteNumberFormat||(this.endnoteNumberFormat=void 0),t.isNullOrUndefined(this.restartIndexForEndnotes)||this.restartIndexForEndnotes===e.restartIndexForEndnotes||(this.restartIndexForEndnotes=void 0),t.isNullOrUndefined(this.restartIndexForFootnotes)||this.restartIndexForFootnotes===e.restartIndexForFootnotes||(this.restartIndexForFootnotes=void 0),t.isNullOrUndefined(this.footNoteNumberFormat)||this.footNoteNumberFormat===e.footNoteNumberFormat||(this.footNoteNumberFormat=void 0),t.isNullOrUndefined(this.initialFootNoteNumber)||this.initialFootNoteNumber===e.initialFootNoteNumber||(this.initialFootNoteNumber=void 0),t.isNullOrUndefined(this.initialEndNoteNumber)||this.initialEndNoteNumber===e.initialEndNoteNumber||(this.initialEndNoteNumber=void 0)},e.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=void 0,this.differentOddAndEvenPages=void 0,this.bidi=void 0,this.pageStartingNumber=void 0,this.restartPageNumbering=void 0,this.endnoteNumberFormat=void 0,this.footNoteNumberFormat=void 0,this.restartIndexForFootnotes=void 0,this.restartIndexForEndnotes=void 0,this.initialFootNoteNumber=1,this.initialEndNoteNumber=1},e.prototype.destroy=function(){this.headerDistanceIn=void 0,this.footerDistanceIn=void 0,this.pageHeightIn=void 0,this.pageWidthIn=void 0,this.leftMarginIn=void 0,this.rightMarginIn=void 0,this.topMarginIn=void 0,this.bottomMarginIn=void 0,this.differentFirstPageIn=void 0,this.differentOddAndEvenPagesIn=void 0,this.selection=void 0,this.bidi=void 0,this.pageStartingNumberIn=void 0,this.restartPageNumberingIn=void 0,this.endnoteNumberFormatIn=void 0,this.footNoteNumberFormatIn=void 0,this.restartIndexForFootnotesIn=void 0,this.restartIndexForEndnotesIn=void 0,this.initialEndNoteNumber=void 0,this.initialFootNoteNumber=void 0},e}(),Ft=function(){function e(e){this.leftIndentIn=0,this.backgroundIn=void 0,this.tableAlignmentIn=void 0,this.cellSpacingIn=0,this.leftMarginIn=0,this.rightMarginIn=0,this.topMarginIn=0,this.bottomMarginIn=0,this.preferredWidthIn=0,this.bidiIn=void 0,this.selection=e}return Object.defineProperty(e.prototype,"table",{get:function(){return this.tableIn},set:function(e){this.tableIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leftIndent",{get:function(){return this.leftIndentIn},set:function(e){e!==this.leftIndentIn&&(this.leftIndentIn=e,this.notifyPropertyChanged("leftIndent"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"topMargin",{get:function(){return this.topMarginIn},set:function(e){e!==this.topMarginIn&&(this.topMarginIn=e,this.notifyPropertyChanged("topMargin"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this.backgroundIn},set:function(e){e!==this.backgroundIn&&(this.backgroundIn=e,this.notifyPropertyChanged("background"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tableAlignment",{get:function(){return this.tableAlignmentIn},set:function(e){e!==this.tableAlignmentIn&&(this.tableAlignmentIn=e,this.notifyPropertyChanged("tableAlignment"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leftMargin",{get:function(){return this.leftMarginIn},set:function(e){e!==this.leftMarginIn&&(this.leftMarginIn=e,this.notifyPropertyChanged("leftMargin"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bottomMargin",{get:function(){return this.bottomMarginIn},set:function(e){e!==this.bottomMarginIn&&(this.bottomMarginIn=e,this.notifyPropertyChanged("bottomMargin"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cellSpacing",{get:function(){return this.cellSpacingIn},set:function(e){e!==this.cellSpacingIn&&(this.cellSpacingIn=e,this.notifyPropertyChanged("cellSpacing"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightMargin",{get:function(){return this.rightMarginIn},set:function(e){e!==this.rightMarginIn&&(this.rightMarginIn=e,this.notifyPropertyChanged("rightMargin"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"preferredWidth",{get:function(){return this.preferredWidthIn},set:function(e){e!==this.preferredWidthIn&&(this.preferredWidthIn=e,this.notifyPropertyChanged("preferredWidth"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"preferredWidthType",{get:function(){return this.preferredWidthTypeIn},set:function(e){e!==this.preferredWidthTypeIn&&(this.preferredWidthTypeIn=e,this.notifyPropertyChanged("preferredWidthType"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bidi",{get:function(){return this.bidiIn},set:function(e){this.bidiIn=e,this.notifyPropertyChanged("bidi")},enumerable:!0,configurable:!0}),e.prototype.getPropertyValue=function(e){switch(e){case"tableAlignment":return this.tableAlignment;case"leftIndent":return this.leftIndent;case"cellSpacing":return this.cellSpacing;case"leftMargin":return this.leftMargin;case"rightMargin":return this.rightMargin;case"topMargin":return this.topMargin;case"bottomMargin":return this.bottomMargin;case"background":var t=new A;return t.backgroundColor=this.background,t;case"preferredWidth":return this.preferredWidth;case"preferredWidthType":return this.preferredWidthType;case"bidi":return this.bidi;default:return}},e.prototype.notifyPropertyChanged=function(e){if((t.isNullOrUndefined(this.selection)||!this.selection.isCleared&&this.selection.owner.isDocumentLoaded&&!this.selection.owner.isReadOnlyMode&&!this.selection.owner.isPastingContent||this.selection.isRetrieveFormatting)&&!t.isNullOrUndefined(this.selection)&&!t.isNullOrUndefined(this.selection.start)&&!this.selection.isRetrieveFormatting){var i=this.getPropertyValue(e);"background"===e&&(e="shading"),t.isNullOrUndefined(i)||this.selection.owner.editorModule.onApplyTableFormat(e,i)}},e.prototype.copyFormat=function(e){this.leftIndent=e.leftIndent,this.background=e.shading.backgroundColor,this.tableAlignment=e.tableAlignment,this.leftMargin=e.leftMargin,this.rightMargin=e.rightMargin,this.topMargin=e.topMargin,this.bottomMargin=e.bottomMargin,this.cellSpacing=e.cellSpacing,this.preferredWidth=e.preferredWidth,this.preferredWidthType=e.preferredWidthType,this.bidi=e.bidi},e.prototype.clearFormat=function(){this.table=void 0,this.leftIndent=0,this.background=void 0,this.leftIndent=0,this.leftMargin=0,this.rightMargin=0,this.topMargin=0,this.bottomMargin=0,this.cellSpacing=0,this.tableAlignment=void 0,this.bidi=void 0},e.prototype.destroy=function(){this.leftIndentIn=void 0,this.backgroundIn=void 0,this.leftIndentIn=void 0,this.leftMarginIn=void 0,this.rightMarginIn=void 0,this.topMarginIn=void 0,this.bottomMarginIn=void 0,this.cellSpacingIn=void 0,this.tableAlignmentIn=void 0,this.tableIn=void 0,this.selection=void 0,this.bidi=void 0},e}(),Pt=function(){function e(e){this.verticalAlignmentIn=void 0,this.leftMarginIn=0,this.rightMarginIn=0,this.topMarginIn=0,this.bottomMarginIn=0,this.backgroundIn=void 0,this.preferredWidthTypeIn=void 0,this.selection=e}return Object.defineProperty(e.prototype,"verticalAlignment",{get:function(){return this.verticalAlignmentIn},set:function(e){e!==this.verticalAlignmentIn&&(this.verticalAlignmentIn=e,this.notifyPropertyChanged("verticalAlignment"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leftMargin",{get:function(){return this.leftMarginIn},set:function(e){e!==this.leftMarginIn&&(this.leftMarginIn=e,this.notifyPropertyChanged("leftMargin"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightMargin",{get:function(){return this.rightMarginIn},set:function(e){e!==this.rightMarginIn&&(this.rightMarginIn=e,this.notifyPropertyChanged("rightMargin"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"topMargin",{get:function(){return this.topMarginIn},set:function(e){e!==this.topMarginIn&&(this.topMarginIn=e,this.notifyPropertyChanged("topMargin"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bottomMargin",{get:function(){return this.bottomMarginIn},set:function(e){e!==this.bottomMarginIn&&(this.bottomMarginIn=e,this.notifyPropertyChanged("bottomMargin"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this.backgroundIn},set:function(e){e!==this.backgroundIn&&(this.backgroundIn=e,this.notifyPropertyChanged("background"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"preferredWidthType",{get:function(){return this.preferredWidthTypeIn},set:function(e){e!==this.preferredWidthTypeIn&&(this.preferredWidthTypeIn=e,this.notifyPropertyChanged("preferredWidthType"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"preferredWidth",{get:function(){return this.preferredWidthIn},set:function(e){e!==this.preferredWidthIn&&(this.preferredWidthIn=e,this.notifyPropertyChanged("preferredWidth"))},enumerable:!0,configurable:!0}),e.prototype.notifyPropertyChanged=function(e){var i=this.selection;if(!t.isNullOrUndefined(i)){if((i.isCleared||!i.owner.isDocumentLoaded||i.owner.isReadOnlyMode||i.owner.isPastingContent)&&!i.isRetrieveFormatting)return;if(!t.isNullOrUndefined(this.selection.start)&&!this.selection.isRetrieveFormatting){var n=this.getPropertyValue(e);"background"===e&&(e="shading"),t.isNullOrUndefined(n)||this.selection.owner.editorModule.onApplyTableCellFormat(e,n)}}},e.prototype.getPropertyValue=function(e){switch(e){case"verticalAlignment":return this.verticalAlignment;case"leftMargin":return this.leftMargin;case"rightMargin":return this.rightMargin;case"topMargin":return this.topMargin;case"bottomMargin":return this.bottomMargin;case"preferredWidth":return this.preferredWidth;case"preferredWidthType":return this.preferredWidthType;case"background":var t=new A;return t.backgroundColor=this.background,t;default:return}},e.prototype.copyFormat=function(e){this.leftMargin=e.leftMargin,this.rightMargin=e.rightMargin,this.topMargin=e.topMargin,this.bottomMargin=e.bottomMargin,this.background=e.shading.backgroundColor,this.verticalAlignment=e.verticalAlignment,this.preferredWidth=e.preferredWidth,this.preferredWidthType=e.preferredWidthType},e.prototype.clearCellFormat=function(){this.leftMargin=void 0,this.rightMargin=void 0,this.topMargin=void 0,this.bottomMargin=void 0,this.background=void 0,this.verticalAlignment=void 0},e.prototype.combineFormat=function(e){t.isNullOrUndefined(this.leftMargin)||this.leftMargin===e.leftMargin||(this.leftMargin=void 0),t.isNullOrUndefined(this.topMargin)||this.topMargin===e.topMargin||(this.topMargin=void 0),t.isNullOrUndefined(this.rightMargin)||this.rightMargin===e.rightMargin||(this.rightMargin=void 0),t.isNullOrUndefined(this.bottomMargin)||this.bottomMargin===e.bottomMargin||(this.bottomMargin=void 0),t.isNullOrUndefined(this.background)||this.background===e.shading.backgroundColor||(this.background=void 0),t.isNullOrUndefined(this.verticalAlignment)||this.verticalAlignment===e.verticalAlignment||(this.verticalAlignment=void 0),t.isNullOrUndefined(this.preferredWidth)||this.preferredWidth===e.preferredWidth||(this.preferredWidth=void 0),t.isNullOrUndefined(this.preferredWidthType)||this.preferredWidthType===e.preferredWidthType||(this.preferredWidthType=void 0)},e.prototype.clearFormat=function(){this.background=void 0,this.bottomMargin=0,this.leftMargin=0,this.rightMargin=0,this.topMargin=0,this.verticalAlignment=void 0},e.prototype.destroy=function(){this.backgroundIn=void 0,this.verticalAlignmentIn=void 0,this.bottomMarginIn=void 0,this.leftMarginIn=void 0,this.rightMarginIn=void 0,this.topMarginIn=void 0,this.selection=void 0},e}(),Tt=function(){function e(e){this.heightIn=void 0,this.heightTypeIn=void 0,this.isHeaderIn=void 0,this.allowRowBreakAcrossPagesIn=void 0,this.selection=e}return Object.defineProperty(e.prototype,"height",{get:function(){return this.heightIn},set:function(e){e!==this.heightIn&&(this.heightIn=e,this.notifyPropertyChanged("height"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"heightType",{get:function(){return this.heightTypeIn},set:function(e){e!==this.heightTypeIn&&(this.heightTypeIn=e,this.notifyPropertyChanged("heightType"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isHeader",{get:function(){return this.isHeaderIn},set:function(e){e!==this.isHeaderIn&&(this.isHeaderIn=e,this.notifyPropertyChanged("isHeader"))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"allowBreakAcrossPages",{get:function(){return this.allowRowBreakAcrossPagesIn},set:function(e){e!==this.allowRowBreakAcrossPagesIn&&(this.allowRowBreakAcrossPagesIn=e,this.notifyPropertyChanged("allowBreakAcrossPages"))},enumerable:!0,configurable:!0}),e.prototype.notifyPropertyChanged=function(e){var i=this.selection;if((t.isNullOrUndefined(i)||!i.isCleared&&!i.owner.isReadOnlyMode&&i.owner.isDocumentLoaded&&!i.owner.isPastingContent||i.isRetrieveFormatting)&&!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(i.start)&&!i.isRetrieveFormatting){var n=this.getPropertyValue(e);t.isNullOrUndefined(n)||i.owner.editorModule.onApplyTableRowFormat(e,n)}},e.prototype.getPropertyValue=function(e){switch(e){case"height":return this.height;case"heightType":return this.heightType;case"isHeader":return this.isHeader;case"allowBreakAcrossPages":return this.allowBreakAcrossPages;default:return}},e.prototype.copyFormat=function(e){this.height=e.height,this.heightType=e.heightType,this.allowBreakAcrossPages=e.allowBreakAcrossPages,this.isHeader=e.isHeader},e.prototype.combineFormat=function(e){t.isNullOrUndefined(this.height)||this.height===e.height||(this.height=void 0),t.isNullOrUndefined(this.heightType)||this.heightType===e.heightType||(this.heightType=void 0),t.isNullOrUndefined(this.allowBreakAcrossPages)||this.allowBreakAcrossPages===e.allowBreakAcrossPages||(this.allowBreakAcrossPages=void 0),t.isNullOrUndefined(this.isHeader)||this.isHeader===e.isHeader||(this.isHeader=void 0)},e.prototype.clearRowFormat=function(){this.height=void 0,this.heightType=void 0,this.allowBreakAcrossPages=void 0,this.isHeader=void 0},e.prototype.clearFormat=function(){this.height=0,this.heightType=void 0,this.allowBreakAcrossPages=void 0,this.isHeader=void 0},e.prototype.destroy=function(){this.heightIn=void 0,this.heightTypeIn=void 0,this.allowRowBreakAcrossPagesIn=void 0,this.isHeaderIn=void 0,this.selection=void 0},e}(),St=function(){function e(e){this.selection=e}return Object.defineProperty(e.prototype,"width",{get:function(){return this.image?this.image.width:0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.image?this.image.height:0},enumerable:!0,configurable:!0}),e.prototype.resize=function(e,t){this.updateImageFormat(e,t)},e.prototype.updateImageFormat=function(e,t){this.image&&this.selection.owner.editorModule&&this.selection.owner.editorModule.onImageFormat(this.image,e,t)},e.prototype.copyImageFormat=function(e){this.image=e},e.prototype.clearImageFormat=function(){this.image=void 0},e}(),It=function(){function e(){this.document=void 0,this.prevListLevel=void 0,this.isOrdered=void 0,this.fieldCheck=0,this.isMergeField=!1}return e.prototype.writeHtml=function(e){this.document=e;for(var t="",i=0;i<e.sections.length;i++)t+=this.serializeSection(e.sections[i]);return t},e.prototype.serializeSection=function(e){for(var t="",i=0;i<e.blocks.length;i++){var n=e.blocks[i];n.hasOwnProperty("inlines")?t+=this.serializeParagraph(n):n.hasOwnProperty("blocks")?t+=this.serializeSection(n):(t+=this.closeList(),t+=this.serializeTable(n))}return t+=this.closeList(),this.prevListLevel=void 0,this.isOrdered=void 0,t},e.prototype.serializeParagraph=function(e){var i="",n=!1,r=!1;t.isNullOrUndefined(this.prevListLevel)||(r=!0);var o=[],s=void 0;return t.isNullOrUndefined(e.paragraphFormat.listFormat)||(s=this.getListLevel(e),r||(this.prevListLevel=s),this.prevListLevel!==s&&(r=!1),this.prevListLevel=s),r||(i+=this.closeList()),t.isNullOrUndefined(s)||(n=!0),n&&!r&&(i+=this.getHtmlList(s,e.paragraphFormat.listFormat.listLevelNumber)),o.push('style="'+this.serializeParagraphStyle(e,"",n)+';white-space:pre"'),n?i+=this.createAttributesTag("li",o):(this.prevListLevel=void 0,this.isOrdered=void 0,i+=this.createAttributesTag(this.getStyleName(e.paragraphFormat.styleName),o)),0===e.inlines.length?i+="&nbsp":i=this.serializeInlines(e,i),n?(i+=this.endTag("li")).indexOf("<ul")>-1?this.isOrdered=!1:i.indexOf("<ol")>-1&&(this.isOrdered=!0):i+=this.endTag(this.getStyleName(e.paragraphFormat.styleName)),i},e.prototype.closeList=function(){var e="";return t.isNullOrUndefined(this.isOrdered)||(e=this.isOrdered?this.endTag("ol"):this.endTag("ul"),this.isOrdered=void 0),e},e.prototype.getListLevel=function(e){for(var t=void 0,i=void 0,n=0;n<this.document.lists.length;n++)if(this.document.lists[n].listId===e.paragraphFormat.listFormat.listId){i=this.document.lists[n];break}if(i)for(var r=0;r<this.document.abstractLists.length;r++)if(this.document.abstractLists[r].abstractListId===i.abstractListId){t=this.document.abstractLists[r].levels[e.paragraphFormat.listFormat.listLevelNumber];break}return t},e.prototype.getHtmlList=function(e,t){var i="";if("Bullet"===e.listLevelPattern){switch(i+='<ul type="',t){case 0:i+="disc",e.characterFormat.fontFamily="Symbol";break;case 1:i+="circle",e.characterFormat.fontFamily="Symbol";break;case 2:i+="square",e.characterFormat.fontFamily="Wingdings";break;default:i+="disc",e.characterFormat.fontFamily="Symbol"}i+='">'}else{switch(i+='<ol type="',e.listLevelPattern){case"LowLetter":i+="a";break;case"UpLetter":i+="A";break;case"LowRoman":i+="i";break;case"UpRoman":i+="I";break;default:i+="1"}i+='" start="'+e.startAt.toString()+'">'}return i},e.prototype.serializeInlines=function(e,i){for(var n=void 0,r=0,o=[];e.inlines.length>r;)if((n=e.inlines[r]).hasOwnProperty("inlines"))i+=this.serializeContentInlines(n,i),r++;else{if(n.hasOwnProperty("imageString"))i+=this.serializeImageContainer(n);else if(n.hasOwnProperty("fieldType"))if(0===n.fieldType){var s=e.inlines[r+1];t.isNullOrUndefined(s)||t.isNullOrUndefined(s.text)||!(s.text.indexOf("TOC")>=0||s.text.indexOf("HYPERLINK")>=0)?s.text.toLowerCase().indexOf("mergefield")>=0?(this.isMergeField=!0,(o=[]).push('style="mso-element:field-begin"'),i+="\x3c!--[if supportFields]>",i+=this.createAttributesTag("span",o),i+=this.endTag("span"),o=[]):this.fieldCheck=void 0:(this.fieldCheck=1,(o=[]).push('style="'+this.serializeInlineStyle(n.characterFormat)+'"'),i+=this.createAttributesTag("a",o))}else 2===n.fieldType?(this.isMergeField&&((o=[]).push('style="mso-element:field-separator"'),i+=this.createAttributesTag("span",o),i+=this.endTag("span"),i+="<![endif]--\x3e"),t.isNullOrUndefined(this.fieldCheck)?this.fieldCheck=0:this.fieldCheck=2):(this.isMergeField?(i+="\x3c!--[if supportFields]>",(o=[]).push('style="mso-element:field-end"'),i+=this.createAttributesTag("span",o),i+=this.endTag("span"),i+="<![endif]--\x3e"):t.isNullOrUndefined(this.fieldCheck)||0===this.fieldCheck||(i+=this.endTag("a")),this.fieldCheck=0);else{var a=t.isNullOrUndefined(n.text)?"":n.text;0===this.fieldCheck&&(a.indexOf("MERGEFIELD")>=0&&this.isMergeField?((o=[]).push('style="'+this.serializeInlineStyle(n.characterFormat)+'"'),i+=this.createAttributesTag("span",o),i+=a,i+=this.endTag("span")):i+=this.serializeSpan(a,n.characterFormat)),1===this.fieldCheck&&-1===a.indexOf("MERGEFIELD")&&(i+=' href= "'+a.replace(/"/g,"").replace("HYPERLINK","").trim(),i+='"',i+=">"),2===this.fieldCheck&&(this.isMergeField?((o=[]).push('style="'+this.serializeInlineStyle(n.characterFormat)+'"'),i+=this.createAttributesTag("span",o),i+=a,i+=this.endTag("span")):(i+=this.createAttributesTag("span",[]),i+=this.endTag("span"),i+=a))}r++}return i},e.prototype.serializeContentInlines=function(e,t){return t+=this.serializeInlines(e,t)},e.prototype.serializeSpan=function(e,t){var i="";if(-1!==e.indexOf("\v"))return(i+="<br>").toString();if(-1!==e.indexOf("\f"))return(i+='<br style = "page-break-after:always;"/>').toString();var n=[];this.serializeInlineStyle(t),n.push('style="'+this.serializeInlineStyle(t)+'"'),i+=this.createAttributesTag("span",n);var r=this.decodeHtmlNames(e.toString());return 0===r.length&&(r="&nbsp"),i+=r,(i+=this.endTag("span")).toString()},e.prototype.getStyleName=function(e){switch(e){case"Heading 1":return"h1";case"Heading 2":return"h2";case"Heading 3":return"h3";case"Heading 4":return"h4";case"Heading 5":return"h5";default:return"div"}},e.prototype.serializeImageContainer=function(e){var i="",n=[];this.serializeInlineStyle(e.characterFormat);var r="";t.isNullOrUndefined(e.imageString)||(r=e.imageString);var o=W.convertPointToPixel(e.width),s=W.convertPointToPixel(e.height);return n.push('width="'+o.toString()+'"'),n.push('height="'+s.toString()+'"'),n.push('src="'+r+'"'),i+=this.createAttributesTag("img",n),(i+=this.endTag("img")).toString()},e.prototype.serializeCell=function(e){var i="",n=[],r="";if(n=[],!t.isNullOrUndefined(e.cellFormat)){if(t.isNullOrUndefined(e.cellFormat.shading.backgroundColor)||n.push('bgcolor="'+W.getColor(e.cellFormat.shading.backgroundColor)+'"'),!t.isNullOrUndefined(e.cellFormat.columnSpan)&&e.cellFormat.columnSpan>1&&n.push('colspan="'+e.cellFormat.columnSpan.toString()+'"'),!t.isNullOrUndefined(e.cellFormat.rowSpan)&&e.cellFormat.rowSpan>1&&n.push('rowspan="'+e.cellFormat.rowSpan.toString()+'"'),!t.isNullOrUndefined(e.cellFormat.cellWidth)&&0!==e.cellFormat.cellWidth){var o=W.convertPointToPixel(e.cellFormat.cellWidth);n.push('width="'+o.toString()+'"')}var s=t.isNullOrUndefined(e.cellFormat.verticalAlignment)?"top":e.cellFormat.verticalAlignment.toString().toLowerCase();n.push('valign="'+s+'"'),t.isNullOrUndefined(e.cellFormat.leftMargin)||0===e.cellFormat.leftMargin||(r+="padding-left:"+e.cellFormat.leftMargin.toString()+"pt;"),t.isNullOrUndefined(e.cellFormat.rightMargin)||0===e.cellFormat.rightMargin||(r+="padding-right:"+e.cellFormat.rightMargin.toString()+"pt;"),t.isNullOrUndefined(e.cellFormat.topMargin)||0===e.cellFormat.topMargin||(r+="padding-top:"+e.cellFormat.topMargin.toString()+"pt;"),t.isNullOrUndefined(e.cellFormat.bottomMargin)||0===e.cellFormat.bottomMargin||(r+="padding-bottom:"+e.cellFormat.bottomMargin.toString()+"pt;"),t.isNullOrUndefined(e.cellFormat.borders)||(r+=this.serializeCellBordersStyle())}0!==r.length&&n.push('style="'+r+'"'),i+=this.createAttributesTag("td",n);for(var a=0;a<e.blocks.length;a++){var l=e.blocks[a];l.hasOwnProperty("rows")?i+=this.serializeTable(l):i+=this.serializeParagraph(l)}return i+=this.endTag("td")},e.prototype.serializeTable=function(e){var t="";t+=this.createTableStartTag(e);for(var i=0;i<e.rows.length;i++)t+=this.serializeRow(e.rows[i]);return t+=this.createTableEndTag()},e.prototype.serializeRow=function(e){var t="";t+=this.createRowStartTag(e);for(var i=0;i<e.cells.length;i++)t+=this.serializeCell(e.cells[i]);return t},e.prototype.serializeParagraphStyle=function(e,t,i){var n="";return n+=this.serializeCharacterFormat(e.characterFormat),n+=this.serializeParagraphFormat(e.paragraphFormat,i)},e.prototype.serializeInlineStyle=function(e){return this.serializeCharacterFormat(e)},e.prototype.serializeTableBorderStyle=function(e){var i="";return t.isNullOrUndefined(e.left.lineStyle)||(i+="border-left-style:"+this.convertBorderLineStyle(e.left.lineStyle),i+=";"),e.left.lineWidth&&(i+="border-left-width:"+e.left.lineWidth.toString()+"pt",i+=";"),t.isNullOrUndefined(e.left.color)||(i+="border-left-color:"+W.getColor(e.left.color),i+=";"),t.isNullOrUndefined(e.right.lineStyle)||(i+="border-right-style:"+this.convertBorderLineStyle(e.right.lineStyle),i+=";"),t.isNullOrUndefined(e.right.lineWidth)||(i+="border-right-width:"+e.right.lineWidth.toString()+"pt",i+=";"),t.isNullOrUndefined(e.right.color)||(i+="border-right-color:"+W.getColor(e.right.color),i+=";"),t.isNullOrUndefined(e.top.lineStyle)||(i+="border-top-style:"+this.convertBorderLineStyle(e.top.lineStyle),i+=";"),t.isNullOrUndefined(e.top.lineWidth)||(i+="border-top-width:"+e.top.lineWidth.toString()+"pt",i+=";"),t.isNullOrUndefined(e.top.color)||(i+="border-top-color:"+W.getColor(e.bottom.color),i+=";"),t.isNullOrUndefined(e.bottom.lineStyle)||(i+="border-bottom-style:"+this.convertBorderLineStyle(e.bottom.lineStyle),i+=";"),t.isNullOrUndefined(e.bottom.lineWidth)||(i+="border-bottom-width:"+e.bottom.lineWidth.toString()+"pt",i+=";"),t.isNullOrUndefined(e.bottom.color)||(i+="border-bottom-color:"+W.getColor(e.bottom.color),i+=";"),i},e.prototype.serializeCellBordersStyle=function(){return"border:solid 1px;","border:solid 1px;"},e.prototype.serializeBorderStyle=function(e,i){var n="";return n+="border-"+i+"-style:"+this.convertBorderLineStyle(e.lineStyle),n+=";",e.lineWidth>0&&(n+="border-"+i+"-width:"+e.lineWidth.toString()+"pt;"),t.isNullOrUndefined(e.color)||(n+="border-"+i+"-color:"+W.getColor(e.color)+";"),n},e.prototype.convertBorderLineStyle=function(e){switch(e){case"None":return"none";case"Single":return"solid";case"Dot":return"dotted";case"DashSmallGap":case"DashLargeGap":case"DashDot":case"DashDotDot":return"dashed";case"Double":case"Triple":case"ThinThickSmallGap":case"ThickThinSmallGap":case"ThinThickThinSmallGap":case"ThinThickMediumGap":case"ThickThinMediumGap":case"ThinThickThinMediumGap":case"ThinThickLargeGap":case"ThickThinLargeGap":case"ThinThickThinLargeGap":return"double";case"SingleWavy":return"solid";case"DoubleWavy":return"double";case"DashDotStroked":return"solid";case"Emboss3D":return"ridge";case"Engrave3D":return"groove";case"Outset":return"outset";case"Inset":return"inset";default:return"solid"}},e.prototype.serializeCharacterFormat=function(e){if(!t.isNullOrUndefined(e.inlineFormat))return this.serializeCharacterFormat(e.inlineFormat);var i,n="";return n+="font-weight",n+=":",n+=e.bold?"bold":"normal",n+=";",n+="font-style",n+=":",e.italic?n+="italic":n+="normal",n+=";",n+=this.serializeTextDecoration(e),"Superscript"!==e.baselineAlignment&&"Subscript"!==e.baselineAlignment||(n+="vertical-align",n+=":",n+="Superscript"===e.baselineAlignment?"super":"sub",n+=";"),t.isNullOrUndefined(e.highlightColor)||"NoColor"===e.highlightColor||(n+="background-color",n+=":",n+=W.getColor(e.highlightColor.toString()),n+=";"),i=e.fontColor,t.isNullOrUndefined(i)||(n+="color",n+=":",n+=W.getColor(i),n+=";"),!t.isNullOrUndefined(e.allCaps)&&e.allCaps&&(n+="text-transform",n+=":",n+="uppercase",n+=";"),i=e.fontSize,t.isNullOrUndefined(i)||(n+="font-size",n+=":",n+=i.toString(),n+="pt",n+=";"),i=e.fontFamily,t.isNullOrUndefined(i)||(n+="font-family",n+=":",n+=i.toString(),n+=";"),n.toString()},e.prototype.serializeTextDecoration=function(e){var i="";return"SingleStrike"!==e.strikethrough&&"DoubleStrike"!==e.strikethrough||(i+="line-through "),t.isNullOrUndefined(e.underline)||"None"===e.underline||(i+="underline"),i.length>1&&(i="text-decoration:"+i+";"),i},e.prototype.serializeParagraphFormat=function(e,i){if(!t.isNullOrUndefined(e.inlineFormat))return this.serializeParagraphFormat(e.inlineFormat,i);var n,r="";return n=e.textAlignment,t.isNullOrUndefined(n)||(r+="text-align:"+n.toLowerCase()+";"),n=e.beforeSpacing,t.isNullOrUndefined(n)||(r+="margin-top:"+n.toString()+"pt; "),n=e.rightIndent,t.isNullOrUndefined(n)||(r+="margin-right:"+n.toString()+"pt; "),n=e.afterSpacing,t.isNullOrUndefined(n)||(r+="margin-bottom:"+n.toString()+"pt; "),n=e.leftIndent,i&&(n=0),t.isNullOrUndefined(n)||(r+="margin-left:"+n.toString()+"pt; "),n=e.firstLineIndent,i&&(n=0),t.isNullOrUndefined(n)||0===n||(r+="text-indent:"+n.toString()+"pt;"),n=e.lineSpacing,t.isNullOrUndefined(n)||(r+="line-height:"+(n="Multiple"===e.lineSpacingType?Math.round(10*n)/10:n.toString()+"pt;")),r.toString()},e.prototype.createAttributesTag=function(e,t){var i="";i+="<",i+=e;for(var n=0;n<t.length;n++)i+=" ",i+=t[n];return"a"!==e&&(i+=">"),i},e.prototype.createTag=function(e){var t="";return t+="<",t+=e,t+=">"},e.prototype.endTag=function(e){var t="";return t+="<",t+="/",t+=e,t+=">"},e.prototype.createTableStartTag=function(e){var i="",n="",r=[];return r.push('border="1"'),t.isNullOrUndefined(e.tableFormat)||(t.isNullOrUndefined(e.tableFormat.shading)||t.isNullOrUndefined(e.tableFormat.shading.backgroundColor)||r.push('bgcolor="'+W.getColor(e.tableFormat.shading.backgroundColor)+'"'),t.isNullOrUndefined(e.tableFormat.leftIndent)||0===e.tableFormat.leftIndent||r.push('left-indent="'+e.tableFormat.leftIndent.toString()+'pt;"'),!t.isNullOrUndefined(e.tableFormat.cellSpacing)&&e.tableFormat.cellSpacing>0?r.push('cellspacing="'+(72*e.tableFormat.cellSpacing/96*2).toString()+'"'):n+="border-collapse:collapse;",r.push('cellpadding="0"'),t.isNullOrUndefined(e.tableFormat.borders)||(n+=this.serializeTableBorderStyle(e.tableFormat.borders))),0!==n.length&&r.push('style="',n.toString()+'"'),i+=this.createAttributesTag("table",r)},e.prototype.createTableEndTag=function(){var e="";return e+=this.endTag("table")},e.prototype.createRowStartTag=function(e){var i="",n=[];if(e.rowFormat.isHeader&&(i+=this.createTag("thead")),!t.isNullOrUndefined(e.rowFormat.height)&&e.rowFormat.height>0){var r=W.convertPointToPixel(e.rowFormat.height);n.push('height="'+r+'"')}return i+this.createAttributesTag("tr",n)},e.prototype.createRowEndTag=function(e){var t="";return t+=this.endTag("tr"),e.rowFormat.isHeader&&(t+=this.endTag("thead")),t},e.prototype.decodeHtmlNames=function(e){if("\t"===e)return"&emsp;";var t=(e=e.replace(/</g,"&lt;").replace(/>/g,"&gt;")).split(" "),i="";if(t.length>0){i=t[0];for(var n=0;n<t.length-1;n++)i+=" "+t[n+1]}return i},e}(),Nt=function(){function e(e){this.location=new O(0,0),this.isUpdateLocation=!0,this.owner=e,this.documentHelper=this.owner.documentHelper}return Object.defineProperty(e.prototype,"paragraph",{get:function(){return this.currentWidget.paragraph},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isAtParagraphStart",{get:function(){return this.offset===this.owner.selection.getStartOffset(this.paragraph)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isAtParagraphEnd",{get:function(){return this.owner.selection.isParagraphLastLine(this.currentWidget)&&this.offset===this.owner.selection.getLineLength(this.currentWidget)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isCurrentParaBidi",{get:function(){return!t.isNullOrUndefined(this.currentWidget.paragraph)&&this.currentWidget.paragraph.paragraphFormat.bidi},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selection",{get:function(){return this.owner.selection},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hierarchicalPosition",{get:function(){return this.getHierarchicalIndexInternal()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewer",{get:function(){return this.owner.viewer},enumerable:!0,configurable:!0}),e.prototype.clone=function(){var t=new e(this.owner);return t.currentWidget=this.currentWidget,t.offset=this.offset,t.location=this.location,t},e.prototype.containsRtlText=function(e){for(var t=0;t<e.children.length;t++)if(e.children[t].isRightToLeft)return!0;return!1},e.prototype.setPositionForSelection=function(e,i,n,r){var o=!1;t.isNullOrUndefined(i)?this.currentWidget=e:(this.currentWidget=i.line,i.nextNode instanceof xe&&n>i.length&&(o=this.selection.isLastRenderedInline(i,i.length))),this.location=r,this.offset=o?this.selection.getParagraphLength(this.currentWidget.paragraph)+1:this.currentWidget.getOffset(i,n)},e.prototype.setPositionFromLine=function(e,t,i){this.currentWidget=e,this.offset=t,i instanceof O&&this.location.copy(i)},e.prototype.setPosition=function(e,t){this.currentWidget=e,this.offset=t?this.selection.getStartOffset(e.paragraph):e.paragraph.lastChild.getEndOffset()+1,this.updatePhysicalPosition(!0)},e.prototype.setPositionInternal=function(e){this.currentWidget=e.currentWidget,this.offset=e.offset,this.location=e.location},e.prototype.setPositionForCurrentIndex=function(e){var t={index:e},i=this.getParagraphWidget(t);this.offset=parseFloat(t.index),this.setPositionParagraph(i,this.offset)},e.prototype.getPage=function(e){var t=e.index.indexOf(";"),i="0";return t>=0&&(i=e.index.substring(0,t),e.index=e.index.substring(t).replace(";","")),t=parseInt(i,10),this.documentHelper.pages[t]},e.prototype.getParagraphWidget=function(e){if(!t.isNullOrUndefined(e.index)){var i=this.getPage(e);return this.getLineWidget(void 0,e,i)}},e.prototype.getLineWidget=function(e,i,n){if(!t.isNullOrUndefined(i.index)){var r=i.index.indexOf(";"),o="0";if(r>=0&&(o=i.index.substring(0,r),i.index=i.index.substring(r).replace(";","")),"H"===o||"F"===o?e="H"===o?n.headerWidget:n.footerWidget:"FN"===o||"EN"===o?e="FN"===o?n.footnoteWidget:n.endnoteWidget:t.isNullOrUndefined(n)||(e=n.bodyWidgets[0]),r=parseInt(o,10),e instanceof ce&&(r=i.index.indexOf(";"),o="0",o=i.index.substring(0,r),i.index=i.index.substring(r).replace(";",""),r=parseInt(o,10)),e instanceof ye&&r>=e.childWidgets.length&&(i.index="0;0",r=e.childWidgets.length-1),r>=0&&r<e.childWidgets.length){var s=e.childWidgets[r];if(s instanceof we)return i.index.indexOf(";")>0&&(i.index="0"),s;if(s instanceof he){if(i.index.indexOf(";")>0)return this.getLineWidget(s,i);if(s instanceof ve)return this.getLineWidget(this.selection.getFirstParagraphInFirstCell(s),i);if(s instanceof ye&&-1===i.index.indexOf(";"))return this.selection.getFirstParagraphInFirstCell(s.ownerTable).childWidgets[0];return}}else if(e.nextRenderedWidget instanceof he)return i.index="0",e.nextRenderedWidget instanceof ve?this.selection.getFirstParagraphInFirstCell(e.nextRenderedWidget).firstChild:this.getLineWidget(e.nextRenderedWidget,i)}},e.prototype.updatePhysicalPosition=function(e){this.currentWidget&&this.owner.isLayoutEnabled&&this.isUpdateLocation&&(this.location=this.selection.getPhysicalPositionInternal(this.currentWidget,this.offset,e))},e.prototype.isAtSamePosition=function(e){return this.currentWidget===e.currentWidget&&this.offset===e.offset},e.prototype.isInSameParagraphIndex=function(e){if(t.isNullOrUndefined(e))throw new Error("textPosition is undefined.");return this.paragraph.index===e.paragraph.index},e.prototype.isInSameParagraph=function(e){if(t.isNullOrUndefined(e))throw new Error("textPosition is undefined.");return this.paragraph===e.paragraph},e.prototype.isExistBefore=function(e){if(t.isNullOrUndefined(e))throw new Error("textPosition is undefined.");if(this.currentWidget===e.currentWidget)return this.offset<e.offset;var i=this.currentWidget.paragraph,n=e.currentWidget.paragraph;return i===n?i.childWidgets.indexOf(this.currentWidget)<n.childWidgets.indexOf(e.currentWidget):i.containerWidget===n.containerWidget?i.isInsideTable?i.associatedCell.childWidgets.indexOf(i)<n.associatedCell.childWidgets.indexOf(n):i.containerWidget.childWidgets.indexOf(i)<n.containerWidget.childWidgets.indexOf(n):this.owner.selection.isExistBefore(i,n)},e.prototype.isExistAfter=function(e){if(t.isNullOrUndefined(e))throw new Error("textPosition is undefined.");if(this.currentWidget===e.currentWidget)return this.offset>e.offset;if(this.currentWidget.paragraph===e.currentWidget.paragraph)return this.currentWidget.paragraph.childWidgets.indexOf(this.currentWidget)>e.currentWidget.paragraph.childWidgets.indexOf(e.currentWidget);var i=this.currentWidget.paragraph,n=e.currentWidget.paragraph;return i.containerWidget instanceof pe&&n.containerWidget instanceof pe&&i.containerWidget===n.containerWidget?i.isInsideTable&&n.isInsideTable?i.associatedCell.childWidgets.indexOf(i)>n.associatedCell.childWidgets.indexOf(n):i.containerWidget.childWidgets.indexOf(i)>n.containerWidget.childWidgets.indexOf(n):this.owner.selection.isExistAfter(i,n)},e.prototype.getHierarchicalIndexInternal=function(){return this.getHierarchicalIndex(this.currentWidget,this.offset.toString())},e.prototype.getHierarchicalIndex=function(e,t){var i=e;return i?i.getHierarchicalIndex(t):t},e.prototype.setPositionParagraph=function(e,t){this.currentWidget=e,this.offset=t,this.updatePhysicalPosition(!0)},e.prototype.setPositionForLineWidget=function(e,i){var n=this.selection.getLineLength(e),r=e.paragraph.childWidgets.indexOf(e);if(e.isLastLine()&&(t.isNullOrUndefined(e.paragraph.footNoteReference)?n+=1:n+=e.paragraph.footNoteReference.text.length),i>n){var o=void 0;if(r>=e.paragraph.childWidgets.length-1){var s=this.selection.getNextRenderedBlock(e.paragraph);s&&s.index===e.paragraph.index&&(o=s.firstChild)}else o=e.paragraph.childWidgets[r+1];return void this.setPositionForLineWidget(o,i-n)}if(i<0){var a=e.paragraph.childWidgets[r-1],l=this.selection.getLineLength(a)+i;return void this.setPositionForLineWidget(a,l)}this.currentWidget=e,this.offset=i,this.updatePhysicalPosition(!0)},e.prototype.moveNextPosition=function(i){t.isNullOrUndefined(i)&&(i=!0);var n=this.selection.getNextStartInline(this.currentWidget,this.offset);if(n instanceof xe&&0===n.fieldType&&!t.isNullOrUndefined(n.fieldEnd)){if(i)return this.moveNextPositionInternal(n),void this.moveNextPosition();var r=n.fieldEnd.line,o=n.fieldEnd,s=r.getOffset(o,1),a=this.getHierarchicalIndex(r,s.toString());if(e.isForwardSelection(this.selection.end.getHierarchicalIndexInternal(),a))return void this.selection.end.moveToInline(n.fieldEnd,1);this.moveToInline(n.fieldEnd,1)}var l=this.selection.getNextValidOffset(this.currentWidget,this.offset),d=this.paragraph.childWidgets.indexOf(this.currentWidget),h=0;if(l>this.offset){this.offset=l;var c=this.currentWidget.getInline(this.offset,h);if(n=c.element,h=c.index,!t.isNullOrUndefined(n)&&h===n.length&&(n.nextNode instanceof xe||n.nextNode instanceof ke)){var p=this.selection.getNextValidElement(n.nextNode);(p instanceof xe&&1===p.fieldType||p instanceof ke&&1===p.bookmarkType)&&(n=p,this.currentWidget=n.line,this.offset=this.currentWidget.getOffset(n,this.documentHelper.isFormFillProtectedMode?0:1))}}else if(d+1<this.paragraph.childWidgets.length){var u=this.paragraph.childWidgets[d+1];u&&(this.currentWidget=u,this.offset=this.selection.getStartLineOffset(this.currentWidget));var g=this.currentWidget.getInline(this.offset,h);n=g.element,h=g.index,n instanceof xe&&0===n.fieldType&&this.offset++}else this.updateOffsetToNextParagraph(h,!1);this.updatePhysicalPosition(!0)},e.prototype.moveToPreviousParagraphInTable=function(e){var i,n=this.currentWidget.paragraph;i=n.isInsideTable?e.getPreviousSelectionCell(n.associatedCell):e.getPreviousParagraphBlock(n),t.isNullOrUndefined(i)||(this.currentWidget=i.childWidgets[i.childWidgets.length-1],this.offset=this.currentWidget.getEndOffset()+1)},e.prototype.updateOffsetToNextParagraph=function(e,i){var n,r=!1,o=void 0,s=this.paragraph.childWidgets.indexOf(this.currentWidget);if(i)if(s+1<this.paragraph.childWidgets.length){var a=this.paragraph.childWidgets[s+1];a&&(this.currentWidget=a,this.offset=1)}else o=this.selection.getNextSelectionBlock(this.paragraph),t.isNullOrUndefined(o)||o.containerWidget instanceof be&&(r=!this.selection.start.paragraph.isInsideTable||!this.selection.getContainerCellOf(this.selection.start.paragraph.associatedCell,o.associatedCell).ownerTable.contains(o.associatedCell));else o=this.selection.getNextParagraphBlock(this.paragraph);!t.isNullOrUndefined(o)&&o.childWidgets.length>0&&(r?(this.currentWidget=o.childWidgets[o.childWidgets.length-1],this.offset=this.selection.getLineLength(this.currentWidget)+1):(this.currentWidget=o.firstChild,this.offset=i?1:this.selection.getStartLineOffset(this.currentWidget)));var l=this.currentWidget.getInline(this.offset,e);n=l.element,e=l.index,n instanceof xe&&0===n.fieldType&&this.offset++},e.prototype.updateOffsetToPrevPosition=function(e,i){var n,r,o=this.paragraph.childWidgets.indexOf(this.currentWidget),s=this.selection.getPreviousValidOffset(this.currentWidget.paragraph,this.offset);if(this.offset>s)this.offset=s;else if(o>0){var a=this.paragraph.childWidgets[o-1];if(a){this.currentWidget=a;var l=this.currentWidget.getEndOffset();this.offset=l>0?l-1:l}}else{var d=void 0,h=!1;i?(d=this.selection.getPreviousSelectionBlock(this.paragraph),t.isNullOrUndefined(d)||d.containerWidget instanceof be&&(h=!this.selection.start.paragraph.isInsideTable||!this.selection.getContainerCellOf(this.selection.start.paragraph.associatedCell,d.associatedCell).ownerTable.contains(d.associatedCell))):d=this.selection.getPreviousParagraphBlock(this.paragraph),t.isNullOrUndefined(d)||(h?(this.currentWidget=d.firstChild,this.offset=this.selection.getStartLineOffset(this.currentWidget)):(this.currentWidget=d.childWidgets[d.childWidgets.length-1],this.offset=this.currentWidget.isEndsWithPageBreak?this.currentWidget.getEndOffset()-1:this.currentWidget.getEndOffset()))}if(e=0,n=this.currentWidget.getInline(this.offset,e),r=n.element,e=n.index,r instanceof xe&&0===r.fieldType&&this.offset++,r instanceof xe){var c=this.selection.getPreviousValidElement(r);t.isNullOrUndefined(c)||(r=c,this.currentWidget=r.line,this.offset=this.currentWidget.getOffset(r,r.length),r instanceof xe&&0===r.fieldType&&this.offset--)}this.updatePhysicalPosition(!0)},e.prototype.moveToNextParagraphStartInternal=function(){var e=this.currentWidget.paragraph;t.isNullOrUndefined(this.selection.getNextParagraphBlock(e))||(this.currentWidget=this.selection.getNextParagraphBlock(e).firstChild,this.offset=this.selection.getStartOffset(e),this.updatePhysicalPosition(!0))},e.prototype.movePreviousPosition=function(){var e=0,i=this.currentWidget.getInline(this.offset,e),n=i.element;e=i.index;this.paragraph.childWidgets.indexOf(this.currentWidget);(n instanceof xe&&1===n.fieldType&&!t.isNullOrUndefined(n.fieldBegin)||n instanceof ke&&1===n.bookmarkType)&&this.movePreviousPositionInternal(n),this.updateOffsetToPrevPosition(e,!1)},e.prototype.moveNextPositionInternal=function(e){var i;t.isNullOrUndefined(e.fieldSeparator)?i=e.fieldEnd:(i=e.fieldSeparator,this.currentWidget=i.line,this.currentWidget!==e.fieldEnd.line||this.selection.hasValidInline(this.paragraph,i,e.fieldEnd)||(i=e.fieldEnd)),this.currentWidget=i.line,this.offset=this.currentWidget.getOffset(i,1)},e.prototype.moveBackward=function(){var i=0,n=this.currentWidget.getInline(this.offset,i),r=n.element;if(i=n.index,!this.owner.selection.isEmpty&&!t.isNullOrUndefined(r)){var o=this.selection.getNextRenderedElementBox(r,i);if(o instanceof xe&&0===o.fieldType){var s=this.owner.selection.start.getHierarchicalIndexInternal(),a=o.fieldEnd.line.getOffset(o.fieldEnd,1),l=this.getHierarchicalIndex(o.fieldEnd.line,a.toString());if(!e.isForwardSelection(l,s))return void this.owner.selection.start.setPositionParagraph(o.fieldEnd.line,a)}}if(r instanceof xe&&1===r.fieldType&&!t.isNullOrUndefined(r.fieldBegin)){var s=this.owner.selection.start.getHierarchicalIndexInternal(),a=r.line.getOffset(r,1),l=this.getHierarchicalIndex(r.line,a.toString());if(!e.isForwardSelection(s,l)){var d=r.fieldBegin.line.getOffset(r.fieldBegin,0);return this.currentWidget=r.fieldBegin.line,this.offset=d,void this.updatePhysicalPosition(!0)}this.movePreviousPositionInternal(r)}this.updateOffsetToPrevPosition(i,!0)},e.prototype.moveForward=function(){var i=0,n=this.currentWidget.getInline(this.offset,i),r=n.element;if(i=n.index,!t.isNullOrUndefined(r)){if(!this.owner.selection.isEmpty&&i===r.length&&r instanceof xe&&1===r.fieldType){var o=this.owner.selection.start.getHierarchicalIndexInternal(),s=r.fieldBegin.line.getOffset(r.fieldBegin,0),a=this.getHierarchicalIndex(r.fieldBegin.line,s.toString());if(!e.isForwardSelection(o,a))return void this.owner.selection.start.setPositionParagraph(r.fieldBegin.line,s)}r=this.selection.getNextRenderedElementBox(r,i)}if(r instanceof xe&&!t.isNullOrUndefined(r.fieldEnd)){var l=0,d=this.owner.selection.start.paragraph.getInline(this.owner.selection.start.offset,l),h=d.element;if(l=d.index,this.selection.getNextRenderedElementBox(h,l)!==r)return r=r.fieldEnd,this.currentWidget=r.line,this.offset=this.currentWidget.getOffset(r,1),void this.updatePhysicalPosition(!0);this.moveNextPositionInternal(r)}else r instanceof xe&&(0===r.fieldType||1===r.fieldType)&&(this.currentWidget=r.line,this.offset=this.currentWidget.getOffset(r,1));i=0;var c=this.selection.getNextValidOffset(this.currentWidget,this.offset),p=this.selection.getLineLength(this.currentWidget),u=this.selection.isParagraphLastLine(this.currentWidget);if(this.offset<c){this.offset=c;var g=this.currentWidget.getInline(this.offset,i);if(r=g.element,i=g.index,!t.isNullOrUndefined(r)&&i===r.length&&r.nextNode instanceof xe){var m=this.selection.getNextValidElement(r.nextNode);m instanceof xe&&1===m.fieldType&&(r=m,this.offset=this.currentWidget.getOffset(r,1))}}else this.offset===c&&r instanceof xe&&1===r.fieldType&&r.previousNode instanceof Ge?this.offset=c:this.offset===c&&this.offset<p+1&&u?this.offset=p+1:this.updateOffsetToNextParagraph(i,!0);this.updatePhysicalPosition(!0)},e.prototype.moveToInline=function(e,t){this.currentWidget=e.line,this.offset=this.currentWidget.getOffset(e,t),this.updatePhysicalPosition(!0)},e.isForwardSelection=function(e,t){if(e===t)return!0;e=e.replace(/C;/g,""),t=t.replace(/C;/g,""),e=e.replace(/H;/g,""),t=t.replace(/H;/g,""),e=e.replace(/F;/g,""),t=t.replace(/F;/g,"");var i=e.split(";"),n=t.split(";"),r=i.length;r>n.length&&(r=n.length-1);for(var o=0;o<r;o++){var s=parseFloat(i[o]),a=parseFloat(n[o]);if(s!==a)return s<a}return!1},e.prototype.movePreviousPositionInternal=function(e){var i;i=e instanceof xe&&t.isNullOrUndefined(e.fieldSeparator)?this.selection.getPreviousValidElement(e.fieldBegin):this.selection.getPreviousValidElement(e),this.currentWidget=i.line;var n=i instanceof xe||i instanceof ke&&1===i.bookmarkType?0:i.length;this.offset=this.currentWidget.getOffset(i,n)},e.prototype.moveToWordStartInternal=function(e){var i=this.currentWidget.getEndOffset(),n=this.currentWidget.paragraph,r=this.selection;if(2!==e||this.offset!==i&&this.offset!==i+1){if(this.offset===i+1)this.offset=i;else if(this.offset===r.getStartOffset(n)&&this.currentWidget===n.childWidgets[0]){var o=r.getPreviousParagraphBlock(n);if(t.isNullOrUndefined(o))return;this.currentWidget=o.childWidgets[o.childWidgets.length-1],this.offset=this.currentWidget.getEndOffset()}else{if(this.offset===r.getStartLineOffset(this.currentWidget)){var s=n.childWidgets.indexOf(this.currentWidget);s-1>=0&&(this.currentWidget=n.childWidgets[s-1],this.offset=this.currentWidget.getEndOffset())}var a=0,l=this.currentWidget.getInline(this.offset,a),d=l.element;a=l.index,this.getPreviousWordOffset(d,r,a,e,d instanceof xe&&1===d.fieldType,!1,!1,this)}1===e&&this.calculateOffset(),this.updatePhysicalPosition(!0)}},e.prototype.getNextWordOffset=function(e,t,i,n,r,o,s){e instanceof Ie?this.getNextWordOffsetSpan(e,t,i,n,r,o,s):e instanceof Ge?this.getNextWordOffsetImage(e,t,i,n,r,o,s):e instanceof xe&&0===e.fieldType?this.getNextWordOffsetFieldBegin(e,t,i,n,r,o,s):e instanceof xe&&2===e.fieldType||e instanceof ke?this.getNextWordOffsetFieldSeparator(e,t,i,n,r,o,s):e instanceof xe&&1===e.fieldType?this.getNextWordOffsetFieldEnd(e,t,i,n,r,o,s):e instanceof pt&&this.getNextWordOffsetComment(e,t,i,n,r,o,s)},e.prototype.getNextWordOffsetFieldBegin=function(e,i,n,r,o,s,a){var l=e.line.getOffset(e,0);e.length;if(t.isNullOrUndefined(e.fieldSeparator))this.getNextWordOffsetFieldEnd(e.fieldEnd,0,n,r,o,s,a);else if(0===n)this.getNextWordOffsetFieldSeparator(e.fieldSeparator,0,n,r,o,s,a);else if(!t.isNullOrUndefined(e.fieldEnd)){var d=e.fieldSeparator;if(d.line.paragraph!==e.fieldEnd.line.paragraph||this.selection.hasValidInline(d.line.paragraph,d,e.fieldEnd)||(d=e.fieldEnd),this.getNextWordOffset(d,0,n,!(s.paragraph===e.line.paragraph&&s.offset===l),o,s,a),o&&!t.isNullOrUndefined(e.fieldSeparator)&&s.paragraph===e.line.paragraph&&s.offset===e.fieldSeparator.line.getOffset(e.fieldSeparator,e.fieldSeparator.length))return void s.setPositionParagraph(e.line,l);o||s.setPositionParagraph(e.fieldEnd.line,e.fieldEnd.line.getOffset(e.fieldEnd,e.fieldEnd.length))}},e.prototype.getNextWordOffsetImage=function(e,i,n,r,o,s,a){if(r)return s.setPositionParagraph(e.line,e.line.getOffset(e,i)),void(o=!1);if(0===i){var l=e.line.getOffset(e,0);o=!0,s.offset===l?t.isNullOrUndefined(e.nextNode)?s.setPositionParagraph(e.line,l+e.length):this.getNextWordOffset(e.nextNode,0,n,r,o,s,a):s.setPositionParagraph(e.line,l)}else t.isNullOrUndefined(e.nextNode)||this.getNextWordOffset(e.nextNode,0,n,r,o,s,a)},e.prototype.getNextWordOffsetSpan=function(e,i,n,r,o,s,a){if("\t"===e.text||"\v"===e.text){if(r)return s.setPositionParagraph(e.line,e.line.getOffset(e,i)),void(o=!1);if(0===i){o=!0;var l=e.line.getOffset(e,0);s.offset===l?s.setPositionParagraph(e.line,l+e.length):s.setPositionParagraph(e.line,l)}else t.isNullOrUndefined(e.nextNode)||this.getNextWordOffset(e.nextNode,0,n,r,o,s,a)}else{var d=0;if(0===i&&o&&-1===W.wordSplitCharacters.indexOf(e.text[0])){if(s.setPositionParagraph(e.line,e.line.getOffset(e,i)),r)return}else if(i<e.length){var h=i>0&&e.text.length-1>=i?e.text.slice(i,e.length):e.text;if(-1===(d=W.indexOfAny(h,W.wordSplitCharacters))&&e.nextNode instanceof pt&&t.isNullOrUndefined(e.nextNode.nextNode)&&(d=e.length),-1!==d){if(r)return void(o=!1);var c=e.line.getOffset(e,d+i);if((a||" "!==h[d])&&!o&&e.line.paragraph===s.paragraph&&c!==s.offset)return o=!0,void s.setPositionParagraph(e.line,c);for(d++;d<h.length&&-1!==W.wordSplitCharacters.indexOf(h[d])&&(" "===h[d]||" "===h[d]);)d++;o=!0,d<h.length?s.setPositionParagraph(e.line,e.line.getOffset(e,d+i)):t.isNullOrUndefined(e.nextNode)?s.setPositionParagraph(e.line,e.line.getOffset(e,d+i)):this.getNextWordOffset(e.nextNode,0,n,r,o,s,a)}else t.isNullOrUndefined(e.nextNode)?s.setPositionParagraph(e.line,e.line.getEndOffset()):this.getNextWordOffset(e.nextNode,0,n,r,o,s,a)}else t.isNullOrUndefined(e.nextNode)||this.getNextWordOffset(e.nextNode,0,n,r,o,s,a)}},e.prototype.getNextWordOffsetFieldSeparator=function(e,i,n,r,o,s,a){t.isNullOrUndefined(e.nextNode)||this.getNextWordOffset(e.nextNode,0,n,r,o,s,a)},e.prototype.getNextWordOffsetComment=function(e,i,n,r,o,s,a){t.isNullOrUndefined(e.nextNode)||this.getNextWordOffset(e.nextNode,0,n,r,o,s,a)},e.prototype.getNextWordOffsetFieldEnd=function(e,i,n,r,o,s,a){var l=e.line.getOffset(e,0),d=l+e.length;s.offset===l&&(s.setPositionParagraph(e.line,d),t.isNullOrUndefined(e.nextNode))||(t.isNullOrUndefined(e.nextNode)?s.setPositionParagraph(e.line,l):(this.getNextWordOffset(e.nextNode,0,n,!1,o,s,a),s.offset===d&&s.setPositionParagraph(e.line,l)),o=!0)},e.prototype.getPreviousWordOffset=function(e,t,i,n,r,o,s,a){e instanceof Ie?this.getPreviousWordOffsetSpan(e,t,i,n,r,o,s,a):e instanceof Ge?this.getPreviousWordOffsetImage(e,t,i,n,r,o,s,a):e instanceof xe&&0===e.fieldType?this.getPreviousWordOffsetFieldBegin(e,t,i,n,r,o,s,a):e instanceof xe&&2===e.fieldType?this.getPreviousWordOffsetFieldSeparator(e,t,i,n,r,o,s,a):e instanceof xe&&1===e.fieldType?this.getPreviousWordOffsetFieldEnd(e,t,i,n,r,o,s,a):e instanceof ke?this.getPreviousWordOffsetBookMark(e,t,i,n,r,o,s,a):e instanceof Ke&&e.previousNode?this.getPreviousWordOffsetSpan(e.previousNode,t,i,n,r,o,s,a):e instanceof pt&&this.getPreviousWordOffsetComment(e,t,i,n,r,o,s,a)},e.prototype.getPreviousWordOffsetBookMark=function(e,t,i,n,r,o,s,a){if(e.previousNode){if(e.previousNode instanceof Ie){var l=e.previousNode;W.lastIndexOfAny(l.text,W.wordSplitCharacters)!==l.text.length-1?this.getPreviousWordOffset(l,t,i,n,r,o,s,a):a.setPositionParagraph(e.line,e.line.getOffset(e,0))}}else a.setPositionParagraph(e.line,t.getStartLineOffset(e.line))},e.prototype.getPreviousWordOffsetFieldEnd=function(e,i,n,r,o,s,a,l){var d=e.line.getOffset(e,0),h=d+e.length;if(t.isNullOrUndefined(e.fieldSeparator))this.getPreviousWordOffsetFieldBegin(e.fieldBegin,i,0,r,o,s,a,l);else if(0!==r||t.isNullOrUndefined(e.previousNode)){if(!t.isNullOrUndefined(e.fieldBegin)&&0!==r){c=e.previousNode;if((t.isNullOrUndefined(c)||c.line.paragraph===e.fieldBegin.line.paragraph&&!i.hasValidInline(c.line.paragraph,c,e.fieldBegin))&&(c=e.fieldBegin),this.getPreviousWordOffset(c,i,c.length,r,!(l.paragraph===e.line.paragraph&&l.offset===h),s,a,l),a&&l.paragraph===e.line.paragraph&&l.offset===d)return void l.setPositionParagraph(e.line,h);a||l.setPositionParagraph(e.fieldBegin.line,e.fieldBegin.line.getOffset(e.fieldBegin,0))}}else{var c=e.previousNode;this.getPreviousWordOffset(c,i,c.length,r,c instanceof xe&&1===c.fieldType,s,a,l)}},e.prototype.getPreviousWordOffsetFieldSeparator=function(e,t,i,n,r,o,s,a){this.getPreviousWordOffsetFieldBegin(e.fieldBegin,t,e.fieldBegin.length,n,r,o,s,a)},e.prototype.getPreviousWordOffsetComment=function(e,t,i,n,r,o,s,a){if(e.previousNode){var l=e.previousNode;e.previousNode instanceof Ie&&W.lastIndexOfAny(l.text,W.wordSplitCharacters)!==l.text.length-1?this.getPreviousWordOffset(l,t,i,n,r,o,s,a):this.getPreviousWordOffset(e.previousNode,t,e.previousNode.length,n,r,o,s,a)}else a.setPositionParagraph(e.line,t.getStartLineOffset(e.line))},e.prototype.getPreviousWordOffsetFieldBegin=function(e,i,n,r,o,s,a,l){var d=e.line.getOffset(e,0),h=d+e.length;l.offset===h&&l.setPositionParagraph(e.line,d),t.isNullOrUndefined(e.previousNode)?e.fieldSeparator?l.setPositionParagraph(e.line,e.fieldSeparator.line.getOffset(e.fieldSeparator,e.fieldSeparator.length)):l.setPositionParagraph(e.line,i.getStartLineOffset(e.line)):(this.getPreviousWordOffset(e.previousNode,i,e.previousNode.length,r,!1,s,a,l),l.offset===d&&(0===r||t.isNullOrUndefined(e.fieldSeparator)||l.setPositionParagraph(e.line,e.fieldSeparator.line.getOffset(e.fieldSeparator,e.fieldSeparator.length))))},e.prototype.getPreviousWordOffsetImage=function(e,i,n,r,o,s,a,l){if(o)return l.setPositionParagraph(e.line,e.line.getOffset(e,n)),void(a=!1);if(n===e.length){var d=e.line.getOffset(e,e.length);d===l.offset?l.setPositionParagraph(e.line,d-e.length):l.setPositionParagraph(e.line,d)}else t.isNullOrUndefined(e.previousNode)||this.getPreviousWordOffset(e.previousNode,i,e.previousNode.length,r,o,s,a,l)},e.prototype.getPreviousWordOffsetSpan=function(e,i,n,r,o,s,a,l){if("\t"===e.text||"\v"===e.text){if(o)return void(a=!1);if(n===e.length){a=!0;var d=e.line.getOffset(e,e.length);d===l.offset?l.setPositionParagraph(e.line,d-e.length):l.setPositionParagraph(e.line,d)}else t.isNullOrUndefined(e.previousNode)||this.getPreviousWordOffset(e.previousNode,i,e.previousNode.length,r,o,s,a,l)}else{var h=0;if(!s){for(;n>0&&" "===e.text[n-1];)n--;l.setPositionParagraph(e.line,e.line.getOffset(e,n))}if(n>0){if(s=!0,0===n&&a&&-1===W.wordSplitCharacters.indexOf(e.text[0]))return l.setPositionParagraph(e.line,e.line.getOffset(e,n)),void(a=!0);var c=e.text.length>n?e.text.slice(0,n):e.text;if(-1===(h=W.lastIndexOfAny(c,W.wordSplitCharacters))&&e.previousElement instanceof pt&&t.isNullOrUndefined(e.previousNode.previousNode)&&(h=e.length),-1!==h){if(o)return void(a=!1);for(;h>0&&a&&" "!==c[h]&&-1!==W.wordSplitCharacters.indexOf(c[h-1]);)h--;if(" "!==c[h]&&" "!==c[h]&&a||h++,a=!0,h>0){var p=e.line.getOffset(e,h);e.line.paragraph===l.paragraph&&p===l.offset?this.getPreviousWordOffsetSpan(e,i,n,r,o,s,a,l):l.setPositionParagraph(e.line,p)}else e.previousNode instanceof Ie?this.getPreviousWordOffset(e.previousNode,i,e.previousNode.length,r,o,s,a,l):l.setPositionParagraph(e.line,e.line.getOffset(e,0))}else this.setPreviousWordOffset(e,i,n,r,o,s,a,l)}else this.setPreviousWordOffset(e,i,n,r,o,s,a,l)}},e.prototype.setPreviousWordOffset=function(e,t,i,n,r,o,s,a){e.previousNode instanceof Ce&&e.line===e.previousNode.line?this.getPreviousWordOffset(e.previousNode,t,e.previousNode.length,n,r,o,s,a):a.setPositionParagraph(e.line,t.getStartLineOffset(e.line))},e.prototype.validateForwardFieldSelection=function(i,n){var r=new e(this.owner);r.setPositionForCurrentIndex(i),r.isUpdateLocation=!1;var o=!1;for(this.selection.start.paragraph===this.selection.end.paragraph&&this.selection.start.offset!==this.selection.getStartOffset(this.selection.start.paragraph)||this.selection.end.offset===this.selection.end.currentWidget.getEndOffset()&&this.selection.isParagraphLastLine(this.selection.end.currentWidget)&&this.selection.end.setPositionParagraph(this.selection.end.currentWidget,this.selection.end.offset+1);i!==n&&e.isForwardSelection(i,n)&&(o||(r.moveNextPosition(!1),i!==r.getHierarchicalIndexInternal()));){var s=0,a=r.currentWidget.getInline(r.offset,s),l=a.element;if(s=a.index,!t.isNullOrUndefined(l)){var d=this.selection.start.getHierarchicalIndexInternal();if(s===l.length&&l instanceof xe&&1===l.fieldType){if(l.line.getOffset(l,0)===this.offset)return;var h=l.fieldBegin.line,c=h.getOffset(l.fieldBegin,0),p=this.getHierarchicalIndex(h,c.toString());e.isForwardSelection(d,p)||this.selection.start.setPositionParagraph(h,c)}var u=this.selection.getNextRenderedElementBox(l,s);!t.isNullOrUndefined(u)&&u instanceof Ce&&(l=u)}if(o=l instanceof xe&&0===l.fieldType&&!t.isNullOrUndefined(l.fieldEnd)){if(l.line.getOffset(l,0)===this.offset)return;var g=l.fieldEnd,m=(g.line.paragraph,g.line.getOffset(g,1)),f=this.getHierarchicalIndex(g.line,m.toString());if(!e.isForwardSelection(f,n))return void this.moveToInline(l.fieldEnd,1);r.moveToInline(l.fieldEnd,1)}i=r.getHierarchicalIndexInternal()}},e.prototype.validateBackwardFieldSelection=function(i,n){var r=new e(this.owner);r.setPositionForCurrentIndex(i),r.isUpdateLocation=!1;var o=!1;(this.selection.start.paragraph!==this.selection.end.paragraph&&this.selection.end.offset!==this.selection.getStartOffset(this.selection.start.paragraph)||this.documentHelper.isSelectionChangedOnMouseMoved&&this.selection.isParagraphFirstLine(this.selection.end.currentWidget)&&this.selection.end.offset===this.selection.getStartOffset(this.selection.start.paragraph))&&(o=!0),o&&this.selection.start.offset===this.selection.start.currentWidget.getEndOffset()&&this.selection.isParagraphLastLine(this.selection.start.currentWidget)&&this.selection.start.setPositionParagraph(this.selection.start.currentWidget,this.selection.start.offset+1);for(var s=this.selection.start.getHierarchicalIndexInternal();i!==n&&e.isForwardSelection(n,i);){var a=0,l=r.currentWidget.getInline(r.offset,a),d=l.element;if(a=l.index,!t.isNullOrUndefined(d)){var h=this.selection.getNextRenderedElementBox(d,a);if(h instanceof xe&&0===h.fieldType){var c=h.fieldEnd.line,p=c.getOffset(h.fieldEnd,1),u=this.getHierarchicalIndex(c,p.toString());e.isForwardSelection(u,s)||(this.selection.start.setPositionParagraph(c,p),s=u)}}if(d instanceof xe&&1===d.fieldType&&!t.isNullOrUndefined(d.fieldBegin)){var g=d.fieldBegin.line,m=d.fieldBegin,f=g.getOffset(m,0),v=this.getHierarchicalIndex(g,f.toString());if(!e.isForwardSelection(n,v))return void this.moveToInline(d.fieldBegin,0);r.moveToInline(d.fieldBegin,0)}else r.movePreviousPosition();i=r.getHierarchicalIndexInternal()}},e.prototype.paragraphStartInternal=function(e,i){var n=e.getStartLineOffset(this.currentWidget);if(this.offset===n&&i){if(this.moveToNextParagraphInTableCheck())this.moveToPreviousParagraphInTable(e);else if(!t.isNullOrUndefined(e.getPreviousParagraphBlock(this.currentWidget.paragraph))){var r=e.getPreviousParagraphBlock(this.currentWidget.paragraph);this.currentWidget=r.childWidgets[0],this.offset=e.getStartLineOffset(this.currentWidget)}}else this.currentWidget=this.currentWidget.paragraph.getSplitWidgets()[0].childWidgets[0],this.offset=n;this.calculateOffset()},e.prototype.calculateOffset=function(){var e=this.owner.selection.start.getHierarchicalIndexInternal(),t=this.getHierarchicalIndexInternal();e!==t&&this.validateBackwardFieldSelection(e,t),this.updatePhysicalPosition(!0)},e.prototype.moveToParagraphStartInternal=function(e,i){for(var n=this.currentWidget.paragraph;n.previousSplitWidget;)n=n.previousSplitWidget;var r=e.getStartOffset(n);this.offset===r&&i?this.moveToNextParagraphInTableCheck()?this.moveToPreviousParagraphInTable(e):t.isNullOrUndefined(e.getPreviousParagraphBlock(this.paragraph))||(this.currentWidget=e.getPreviousParagraphBlock(this.paragraph).firstChild,this.offset=e.getStartOffset(this.paragraph)):(this.currentWidget=n.firstChild,this.offset=e.getStartLineOffset(this.currentWidget));var o=this.owner.selection.start.getHierarchicalIndexInternal(),s=this.getHierarchicalIndexInternal();o!==s&&this.validateBackwardFieldSelection(o,s),this.updatePhysicalPosition(!1)},e.prototype.moveToParagraphEndInternal=function(e,i){for(var n=this.currentWidget.paragraph;n.nextSplitWidget;)n=n.nextSplitWidget;this.currentWidget=n.childWidgets[n.childWidgets.length-1];var r=this.currentWidget.getEndOffset()+1;if(this.offset===r&&i){if(this.moveToNextParagraphInTableCheck())this.moveToNextParagraphInTable();else if(!t.isNullOrUndefined(e.getNextParagraphBlock(this.currentWidget.paragraph))){var o=e.getNextParagraphBlock(this.currentWidget.paragraph);this.currentWidget=o.childWidgets[o.childWidgets.length-1],this.offset=this.currentWidget.getEndOffset()+1}}else this.offset=r;this.calculateOffset()},e.prototype.moveUp=function(e,i){var n=this.currentWidget.paragraph;this.moveToLineStartInternal(e,!0),this.movePreviousPosition();var r=void 0,o=this.currentWidget.paragraph;if(n.isInsideTable&&n!==o&&n.associatedCell!==o.associatedCell&&!t.isNullOrUndefined(o.associatedCell)&&n.associatedCell.ownerRow===o.associatedCell.ownerRow){var s=o.associatedCell.ownerRow;if(s.previousRenderedWidget instanceof ye){var a=e.getFirstCellInRegion(s.previousRenderedWidget,o.associatedCell,i,!0),l=e.getLastParagraph(a);this.setPosition(l.childWidgets[l.childWidgets.length-1],!1)}else{var d=s.ownerTable.previousRenderedWidget;do{d instanceof ve&&(d=e.getLastBlockInLastCell(d))}while(d instanceof ve);d instanceof fe&&this.setPosition(d.childWidgets[d.childWidgets.length-1],!1)}r=e.getLineWidgetParagraph(this.offset,this.currentWidget)}else{if(!n.isInsideTable&&this.currentWidget.paragraph.isInsideTable){var a=e.getFirstCellInRegion(this.currentWidget.paragraph.associatedCell.ownerRow,this.currentWidget.paragraph.associatedCell,this.owner.selection.upDownSelectionLength,!0),l=e.getLastParagraph(a);this.setPosition(l.childWidgets[l.childWidgets.length-1],!1)}else if(n.isInsideTable&&!t.isNullOrUndefined(this.currentWidget.paragraph.associatedCell)&&n.associatedCell.ownerRow.previousRenderedWidget!==n.associatedCell.ownerRow.previousSplitWidget&&n.associatedCell.ownerRow.previousRenderedWidget===this.currentWidget.paragraph.associatedCell.ownerRow){var a=e.getLastCellInRegion(this.currentWidget.paragraph.associatedCell.ownerRow,this.currentWidget.paragraph.associatedCell,this.owner.selection.upDownSelectionLength,!0),l=e.getLastParagraph(a);this.setPosition(l.childWidgets[l.childWidgets.length-1],!1)}r=e.getLineWidgetParagraph(this.offset,this.currentWidget)}var h=e.getTop(r);this.currentWidget.isEndsWithPageBreak&&this.offset===this.currentWidget.getEndOffset()-1&&(i=this.location.x),e.updateTextPositionWidget(r,new O(i,h),this,!1)},e.prototype.moveDown=function(e,i){var n=this.currentWidget.paragraph,r=this.currentWidget;this.moveToLineEndInternal(e,!0);var o=this.selection.getParagraphLength(this.currentWidget.paragraph);this.offset>o&&(this.offset=o),this.moveNextPosition();var s=void 0;if(n.isInsideTable&&n!==this.currentWidget.paragraph&&n.associatedCell!==this.currentWidget.paragraph.associatedCell&&!t.isNullOrUndefined(this.currentWidget.paragraph.associatedCell)&&n.associatedCell.ownerRow===this.currentWidget.paragraph.associatedCell.ownerRow){var a=this.currentWidget.paragraph.associatedCell.ownerRow;if(n.isInsideTable&&this.currentWidget.paragraph.isInsideTable&&n.associatedCell.cellFormat.rowSpan>1&&n.associatedCell.cellFormat.rowSpan+n.associatedCell.ownerRow.rowIndex===n.associatedCell.ownerTable.childWidgets.length&&(a=this.currentWidget.paragraph.associatedCell.ownerTable.childWidgets[this.currentWidget.paragraph.associatedCell.ownerTable.childWidgets.length-1]),a.nextRenderedWidget instanceof ye){d=this.selection.getLastCellInRegion(a.nextRenderedWidget,this.currentWidget.paragraph.associatedCell,i,!1);this.setPosition(this.selection.getFirstParagraph(d).childWidgets[0],!0)}else{var l=this.selection.getNextRenderedBlock(a.ownerTable);do{l instanceof ve&&(l=this.selection.getFirstBlockInFirstCell(l))}while(l instanceof ve);l instanceof fe&&this.setPosition(l.childWidgets[0],!0)}s=e.getLineWidgetParagraph(this.offset,this.currentWidget)}else{if(!n.isInsideTable&&this.currentWidget.paragraph.isInsideTable){d=this.selection.getLastCellInRegion(this.currentWidget.paragraph.associatedCell.ownerRow,this.currentWidget.paragraph.associatedCell,this.owner.selection.upDownSelectionLength,!1);this.setPosition(this.selection.getFirstParagraph(d).childWidgets[0],!0)}else if(n.isInsideTable&&!t.isNullOrUndefined(this.currentWidget.paragraph.associatedCell)&&n.associatedCell.ownerRow.nextRenderedWidget!==n.associatedCell.ownerRow.nextSplitWidget&&n.associatedCell.ownerRow.nextRenderedWidget===this.currentWidget.paragraph.associatedCell.ownerRow){var d=e.getLastCellInRegion(this.currentWidget.paragraph.associatedCell.ownerRow,this.currentWidget.paragraph.associatedCell,this.owner.selection.upDownSelectionLength,!0);this.setPosition(e.getFirstParagraph(d).childWidgets[0],!1)}s=e.getLineWidgetParagraph(this.offset,this.currentWidget)}var h=this.selection.getTop(s);s!==r&&this.selection.updateTextPositionWidget(s,new O(i,h),this,!1)},e.prototype.moveToLineStartInternal=function(e,i){this.location.x>this.viewer.clientActiveArea.right&&(this.offset=this.offset-1);var n,r=e.getLineWidgetInternal(this.currentWidget,this.offset,i);this.currentWidget.paragraph.paragraphFormat.bidi&&r.children.length>0&&this.containsRtlText(r)?(n=r.children[r.children.length-1])instanceof Ke&&(n=void 0):n=e.getFirstElementInternal(r),this.documentHelper.moveCaretPosition=1;var o=e.getStartOffset(this.currentWidget.paragraph);if(t.isNullOrUndefined(n)&&this.offset>o){var s=0,a=(d=this.currentWidget.getInline(this.offset,s)).element;s=d.index,a instanceof Ie&&"\v"!==a.text&&(this.offset=o)}else if(!t.isNullOrUndefined(n)){var l=0;this.currentWidget=n.line,this.offset=this.currentWidget.getOffset(n,l),l=0;var d=this.currentWidget.getInline(this.offset,l),a=d.element;if(l=d.index,a instanceof xe){var h=e.getPreviousValidElement(a);t.isNullOrUndefined(h)||(a=h,this.currentWidget=a.line,this.offset=this.currentWidget.getOffset(a,a.length),a instanceof xe&&this.offset--)}}this.updatePhysicalPosition(!0)},e.prototype.moveToNextParagraphInTableCheck=function(){return!(!this.selection.start.paragraph.isInsideTable&&!this.paragraph.isInsideTable||this.selection.start.paragraph.associatedCell===this.paragraph.associatedCell&&!this.selection.isCellSelected(this.selection.start.paragraph.associatedCell,this.selection.start,this))},e.prototype.moveToWordEndInternal=function(e,i){var n=0,r=this.currentWidget.getEndOffset();if(this.selection.isParagraphFirstLine(this.currentWidget)&&(this.currentWidget.children[0]instanceof Ke&&(n=1),this.currentWidget.children[1]instanceof Ke&&(n=2)),this.offset+n===r||this.offset===r+1)if(this.offset===r&&0!==e)this.setPositionParagraph(this.currentWidget,r+1);else{var o=this.selection.getNextParagraphBlock(this.currentWidget.paragraph);if(t.isNullOrUndefined(o))return;this.currentWidget=o.childWidgets[0],this.offset=this.selection.getStartLineOffset(this.currentWidget),1===e&&(this.moveToNextParagraphInTableCheck()?this.moveToNextParagraphInTable():this.moveToWordEndInternal(e,i))}else{var s=0,a=this.currentWidget.getInline(this.offset,s),l=a.element;s=a.index,this.getNextWordOffset(l,s,e,!1,!1,this,i)}if(0!==e){var d=this.owner.selection.start.getHierarchicalIndexInternal(),h=this.getHierarchicalIndexInternal();d!==h&&this.validateForwardFieldSelection(d,h)}this.updatePhysicalPosition(!0)},e.prototype.moveToNextParagraphInTable=function(){var e=this.currentWidget.paragraph,i=e.isInsideTable?this.selection.getNextSelectionCell(e.associatedCell):this.selection.getNextParagraphBlock(e);t.isNullOrUndefined(i)||(this.currentWidget=i.childWidgets[i.childWidgets.length-1],this.offset=this.currentWidget.getEndOffset()+1)},e.prototype.moveToPreviousParagraph=function(e){var i=e.getStartOffset(this.currentWidget.paragraph);if(this.offset!==i||t.isNullOrUndefined(e.getPreviousParagraphBlock(this.currentWidget.paragraph)))this.offset=e.getStartOffset(this.currentWidget.paragraph);else{var n=e.getPreviousParagraphBlock(this.currentWidget.paragraph);this.currentWidget=n.childWidgets[0],this.offset=e.getStartOffset(this.currentWidget.paragraph)}this.updatePhysicalPosition(!0)},e.prototype.moveToPreviousLine=function(e,t){var i=this.getHierarchicalIndexInternal(),n=e.getLineWidgetParagraph(this.offset,this.currentWidget);this.moveToLineStartInternal(e,!0),this.currentWidget.paragraph.isInsideTable?this.moveUpInTable(e):this.moveBackward();var r=e.getLineWidgetParagraph(this.offset,this.currentWidget),o=e.getLeft(r);if(e.getWidth(r,!0)+o>=t&&n!==r){var s=e.getTop(r),a=new O(t,s);e.updateTextPositionWidget(r,a,this,!0)}var l=this.getHierarchicalIndexInternal();this.validateBackwardFieldSelection(i,l)},e.prototype.moveToLineEndInternal=function(e,i){this.location.x>this.viewer.clientActiveArea.right&&(this.offset=this.offset-1);var n=e.getLineWidgetParagraph(this.offset,this.currentWidget),r=e.getFirstElementInternal(n),o=this.currentWidget.paragraph.paragraphFormat.bidi;if(this.documentHelper.moveCaretPosition=2,t.isNullOrUndefined(r)&&this.offset===e.getStartLineOffset(this.currentWidget))this.offset=e.getParagraphLength(this.paragraph)+1,this.updatePhysicalPosition(!0);else if(!t.isNullOrUndefined(r)){var s=void 0;if(o&&this.containsRtlText(n)){var a=n.getEndOffset();s=n.getInline(a,0).element}else(s=n.children[n.children.length-1])instanceof Ke&&n.children.length>2&&(s=n.children[n.children.length-3]);var l=0;if(l+=s instanceof Ie?s.length:1,this.currentWidget=s.line,l===s.length&&t.isNullOrUndefined(s.nextNode)&&e.isParagraphLastLine(this.currentWidget)){var d=e.getLineLength(this.currentWidget);this.offset=i?d+1:d}else{for(var h=s;!t.isNullOrUndefined(h)&&h.length===l&&h.nextNode instanceof xe;){var c=e.getNextValidElement(h.nextNode);if(h!==c&&(h=c,l=0),h instanceof xe&&0===h.fieldType&&!t.isNullOrUndefined(h.fieldEnd)){var p=h;t.isNullOrUndefined(p.fieldSeparator)?h=p.fieldEnd:(h=p.fieldSeparator,this.currentWidget=h.line,this.currentWidget!==p.fieldEnd.line||e.hasValidInline(this.currentWidget.paragraph,h,p.fieldEnd)||(h=p.fieldEnd)),this.currentWidget=h.line}h instanceof xe&&(l=1)}l===h.length&&t.isNullOrUndefined(h.nextNode)&&l++,!i&&h instanceof Ce&&"\v"===h.text&&l--,this.offset=this.currentWidget.getOffset(h,l)}this.updatePhysicalPosition(i)}},e.prototype.moveToNextLine=function(i){var n=this.selection,r=new e(this.owner);r.setPositionInternal(this);var o=this.getHierarchicalIndexInternal();n.getLineWidgetParagraph(this.offset,this.currentWidget),this.offset;this.moveToLineEndInternal(n,!0);var s=!r.isAtSamePosition(this);r.setPositionInternal(this),this.currentWidget.paragraph.isInsideTable?this.moveDownInTable(n):(this.moveNextPosition(),this.moveForward());var a=n.getLineWidgetParagraph(this.offset,this.currentWidget),l=n.getLeft(a),d=n.getFirstElementInternal(a),h=t.isNullOrUndefined(d)?n.getWidth(a,!0):n.getLeftInternal(a,d,1)-l;if(l<i&&h/2<i-l){var c=n.getTop(a),p=new O(i,c);n.updateTextPositionWidget(a,p,this,!0),n.getWidth(a,!0)<i-l&&this.moveToLineEndInternal(n,!0)}else s&&this.currentWidget.paragraph.isInsideTable&&this.currentWidget===this.owner.selection.start.currentWidget?this.setPositionInternal(r):s||this.moveToLineEndInternal(n,!0);var u=this.getHierarchicalIndexInternal();this.validateForwardFieldSelection(o,u)},e.prototype.moveUpInTable=function(e){var i=!1,n=this.owner.selection.end,r=!this.owner.selection.isEmpty;if(i=n.paragraph.isInsideTable){var o=this.currentWidget.paragraph.associatedCell,s=n.paragraph.associatedCell,a=e.getContainerCellOf(s,o);if(i=a.ownerTable.contains(o)){s=e.getSelectedCell(s,a),o=e.getSelectedCell(o,a);var l=e.containsCell(a,this.currentWidget.paragraph.associatedCell),d=e.isCellSelected(a,this,n);if(d||(d=this.currentWidget.paragraph===e.getFirstParagraph(a)&&this.isAtParagraphStart),(l&&d||!l)&&!t.isNullOrUndefined(o.ownerRow.previousRenderedWidget)){var h=o.ownerRow.previousRenderedWidget,c=e.getFirstCellInRegion(h,a,this.owner.selection.upDownSelectionLength,!0),p=e.getLastParagraph(c);return void this.setPosition(p.childWidgets[0],!0)}if(l&&d&&t.isNullOrUndefined(o.ownerRow.previousRenderedWidget)||!l)if(r){o=o.ownerRow.childWidgets[0];p=e.getFirstParagraph(o);this.setPosition(p.childWidgets[0],!0)}else{o=o.ownerRow.childWidgets[o.ownerRow.childWidgets.length-1];p=e.getLastParagraph(o);this.setPosition(p.childWidgets[0],!1)}}}if(!i){c=e.getContainerCell(this.currentWidget.paragraph.associatedCell);if(r){c=c.ownerRow.childWidgets[0];p=e.getFirstParagraph(c);this.setPosition(p.childWidgets[0],!0)}else{c=c.ownerRow.childWidgets[c.ownerRow.childWidgets.length-1];p=e.getLastParagraph(c);this.setPosition(p.childWidgets[0],!1)}}this.moveBackward()},e.prototype.moveDownInTable=function(e){var i=!1,n=this.owner.selection.isEmpty||this.owner.selection.isForward;if(i=this.owner.selection.start.paragraph.isInsideTable){var r=this.owner.selection.start.paragraph.associatedCell,o=this.currentWidget.paragraph.associatedCell,s=e.getContainerCellOf(r,o);if(i=s.ownerTable.contains(o)){r=e.getSelectedCell(r,s),o=e.getSelectedCell(o,s);var a=e.containsCell(s,this.currentWidget.paragraph.associatedCell),l=e.isCellSelected(s,this.owner.selection.start,this);if((a&&l||!a)&&!t.isNullOrUndefined(o.ownerRow.nextRenderedWidget)){var d=o.ownerRow.nextRenderedWidget,h=e.getLastCellInRegion(d,s,this.owner.selection.upDownSelectionLength,!1),c=e.getLastParagraph(h);return void this.setPosition(c.childWidgets[c.childWidgets.length-1],!1)}if(a&&l&&t.isNullOrUndefined(o.ownerRow.nextRenderedWidget)||!a)if(n){o=o.ownerRow.childWidgets[o.ownerRow.childWidgets.length-1];c=e.getLastParagraph(o);this.setPosition(c.childWidgets[c.childWidgets.length-1],!1)}else{o=o.ownerRow.childWidgets[0];c=e.getFirstParagraph(o);this.setPosition(c.childWidgets[c.childWidgets.length-1],!0)}}}if(!i){h=e.getContainerCell(this.currentWidget.paragraph.associatedCell);if(n){h=h.ownerRow.childWidgets[h.ownerRow.childWidgets.length-1];c=e.getLastParagraph(h);this.setPosition(c.childWidgets[c.childWidgets.length-1],!1)}else if(h.ownerRow.nextRenderedWidget){h=h.ownerRow.nextRenderedWidget.childWidgets[0];c=e.getFirstParagraph(h);this.setPosition(c.childWidgets[c.childWidgets.length-1],!0)}}this.moveForward()},e.prototype.destroy=function(){this.offset=void 0,this.isUpdateLocation=void 0,t.isNullOrUndefined(this.location)||this.location.destroy(),this.location=void 0,this.currentWidget=void 0,this.owner=void 0,this.documentHelper=void 0},e}(),Et=function(){function e(e,t){this.leftIn=0,this.widthIn=0,this.color="",this.leftIn=e,this.widthIn=t}return Object.defineProperty(e.prototype,"left",{get:function(){return this.leftIn},set:function(e){this.leftIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.widthIn},set:function(e){this.widthIn=e},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){this.widthIn=void 0,this.leftIn=void 0,this.floatingItems=[],this.floatingItems=void 0},e}(),Ht=function(){function e(e,t){this.linkInternal="",this.localRef="",this.opensNewWindow=!1,this.isCrossRefField=!1;var i=t.getFieldCode(e),n=i.toLowerCase();"hyperlink"===n.substring(0,9)?this.parseFieldValues(i.substring(9).trim(),!0):0===n.indexOf("ref ")&&n.match("\\h")&&(this.parseFieldValues(i.substring(4).trim(),!1),this.isCrossRefField=!0)}return Object.defineProperty(e.prototype,"navigationLink",{get:function(){return this.linkInternal},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"localReference",{get:function(){return this.localRef},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"linkType",{get:function(){return this.typeInternal},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isCrossRef",{get:function(){return this.isCrossRefField},enumerable:!0,configurable:!0}),e.prototype.parseFieldValues=function(e,t){var i=e.split(" "),n=!1;if(t)for(var r=0;r<i.length;r++){var o=i[r];o.length<1||("\\t"===o||"\\l"===o?n=!0:"\\n"===o?this.opensNewWindow=!0:(o=this.parseFieldValue(o,'"'===o[0]?'"':void 0,t),n?(this.localRef=o,n=!1):this.linkInternal=o))}else this.localRef=i[0];this.setLinkType()},e.prototype.parseFieldValue=function(e,t,i){e=i?e.substring(1):e.substring(0);var n=t?e.indexOf(t):-1;return n<0&&(n=e.length),e.substring(0,n).trim()},e.prototype.setLinkType=function(){if(t.isNullOrUndefined(this.linkInternal)||this.linkInternal.length<1)return void(this.typeInternal="Bookmark");"www."===this.linkInternal.substring(0,4)?this.linkInternal="http://"+this.navigationLink:"@"===this.linkInternal[0]&&(this.linkInternal="mailto:"+this.navigationLink),"http://"===this.linkInternal.substring(0,7)||"https://"===this.linkInternal.substring(0,8)?this.typeInternal="WebPage":"mailto:"===this.linkInternal.substring(0,7)?this.typeInternal="Email":this.typeInternal="File"},e.prototype.destroy=function(){this.linkInternal=void 0,this.localRef=void 0,this.typeInternal=void 0,this.opensNewWindow=void 0},e}(),Wt=function(){function e(e){this.width=0,this.height=0,this.width=e.width,this.height=e.height}return e.prototype.destroy=function(){this.width=void 0,this.height=void 0},e}(),Ot=function(){function e(e){var i=this;this.upDownSelectionLength=0,this.isSkipLayouting=!1,this.isImageSelected=!1,this.contextTypeInternal=void 0,this.caret=void 0,this.isRetrieveFormatting=!1,this.skipFormatRetrieval=!1,this.isMoveDownOrMoveUp=!1,this.isViewPasteOptions=!1,this.skipEditRangeRetrieval=!1,this.selectedWidgets=void 0,this.isHighlightEditRegionIn=!1,this.isHighlightFormFields=!1,this.isHightlightEditRegionInternal=!1,this.isCurrentUser=!1,this.isHighlightNext=!1,this.isWebLayout=!1,this.editRegionHighlighters=void 0,this.formFieldHighlighters=void 0,this.isSelectList=!1,this.previousSelectedFormField=void 0,this.isFormatUpdated=!1,this.pasteOptions=function(e){"Keep source formatting"===e.item.text?i.owner.editor.applyPasteOptions("KeepSourceFormatting"):"Match destination formatting"===e.item.text?i.owner.editor.applyPasteOptions("MergeWithExistingFormatting"):i.owner.editor.applyPasteOptions("KeepTextOnly")},this.hideCaret=function(){t.isNullOrUndefined(i.caret)||(i.caret.style.display="none")},this.owner=e,this.documentHelper=this.owner.documentHelper,this.start=new Nt(this.owner),this.end=new Nt(this.owner),this.selectedWidgets=new g,this.characterFormatIn=new wt(this),this.paragraphFormatIn=new Ct(this,this.documentHelper),this.sectionFormatIn=new xt(this),this.rowFormatIn=new Tt(this),this.cellFormatIn=new Pt(this),this.tableFormatIn=new Ft(this),this.imageFormatInternal=new St(this),this.editRangeCollection=[],this.editRegionHighlighters=new g,this.formFieldHighlighters=new g}return Object.defineProperty(e.prototype,"isHighlightEditRegion",{get:function(){return this.isHighlightEditRegionIn},set:function(e){this.isHighlightEditRegionIn=e,this.onHighlight()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"htmlWriter",{get:function(){return t.isNullOrUndefined(this.htmlWriterIn)&&(this.htmlWriterIn=new It),this.htmlWriterIn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"start",{get:function(){if(!t.isNullOrUndefined(this.owner)&&!t.isNullOrUndefined(this.viewer))return t.isNullOrUndefined(this.startInternal)&&(this.startInternal=this.owner.documentStart),this.startInternal},set:function(e){this.startInternal=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"characterFormat",{get:function(){return this.characterFormatIn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"paragraphFormat",{get:function(){return this.paragraphFormatIn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sectionFormat",{get:function(){return this.sectionFormatIn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tableFormat",{get:function(){return this.tableFormatIn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cellFormat",{get:function(){return this.cellFormatIn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowFormat",{get:function(){return this.rowFormatIn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"imageFormat",{get:function(){return this.imageFormatInternal},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.endInternal},set:function(e){this.endInternal=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startPage",{get:function(){return!this.owner.isDocumentLoaded||t.isNullOrUndefined(this.viewer)||this.viewer instanceof oe||t.isNullOrUndefined(this.documentHelper.selectionStartPage)?1:this.documentHelper.pages.indexOf(this.documentHelper.selectionStartPage)+1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endPage",{get:function(){return!this.owner.isDocumentLoaded||t.isNullOrUndefined(this.viewer)||this.viewer instanceof oe||t.isNullOrUndefined(this.documentHelper.selectionEndPage)?1:this.documentHelper.pages.indexOf(this.documentHelper.selectionEndPage)+1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isForward",{get:function(){return this.start.isExistBefore(this.end)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isinFootnote",{get:function(){var e=this.getContainerWidget(this.start.paragraph);return e instanceof me&&"Footnote"===e.footNoteType},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isinEndnote",{get:function(){var e=this.getContainerWidget(this.start.paragraph);return e instanceof me&&"Endnote"===e.footNoteType},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return!!t.isNullOrUndefined(this.start)||this.start.isAtSamePosition(this.end)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"startOffset",{get:function(){return this.getHierarchicalIndexByPosition(this.start)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endOffset",{get:function(){return this.getHierarchicalIndexByPosition(this.end)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isInShape",{get:function(){var e=this.start.paragraph.containerWidget;do{if(e instanceof _e)return!0;e&&(e=e.containerWidget)}while(e);return!1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this.getText(!1)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contextType",{get:function(){return this.contextTypeInternal},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"bookmarks",{get:function(){return this.getSelBookmarks(!1)},enumerable:!0,configurable:!0}),e.prototype.getBookmarks=function(e){return this.getSelBookmarks(e)},Object.defineProperty(e.prototype,"isCleared",{get:function(){return t.isNullOrUndefined(this.end)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isInField",{get:function(){return!t.isNullOrUndefined(this.getHyperlinkField(!0))},enumerable:!0,configurable:!0}),e.prototype.getSelBookmarks=function(e){var i=[],n=this.documentHelper.bookmarks,r=this.start,o=this.end;this.isForward||(r=this.end,o=this.start);for(var s,a,l=!1,d=this.getSelectedCells(),h=0;h<n.length;h++)if(e||!e&&0!==n.keys[h].indexOf("_")){if(s=n.get(n.keys[h]),a=s.reference,t.isNullOrUndefined(a))continue;var c=this.getElementPosition(s).startPosition,p=this.getElementPosition(a,!0).startPosition;if(c.paragraph.isInsideTable||p.paragraph.isInsideTable)if(d.length>0){if(d.indexOf(c.paragraph.associatedCell)>=0||d.indexOf(p.paragraph.associatedCell)>=0)l=!0;else if(l=!1,d.indexOf(c.paragraph.associatedCell)<0||d.indexOf(p.paragraph.associatedCell)<0){var u=o.paragraph.isInsideTable&&o.paragraph.associatedCell,g=p.paragraph.associatedCell;if(u&&g&&u.ownerTable.equals(g.ownerTable)&&!(u.ownerTable&&d.indexOf(this.getCellInTable(u.ownerTable,g))>=0))continue}}else l=!1;else l=!1;((r.isExistAfter(c)||r.isAtSamePosition(c))&&(o.isExistBefore(p)||o.isAtSamePosition(p))||(c.isExistAfter(r)||c.isAtSamePosition(r))&&(p.isExistBefore(o)||p.isAtSamePosition(o))||c.isExistAfter(r)&&c.isExistBefore(o)&&(o.isExistAfter(p)||o.isExistBefore(p))||p.isExistBefore(o)&&p.isExistAfter(r)&&(r.isExistBefore(c)||r.isExistAfter(c))||l)&&i.push(s.name)}return i},Object.defineProperty(e.prototype,"viewer",{get:function(){return this.owner.viewer},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"Selection"},e.prototype.checkLayout=function(){"Continuous"===this.owner.layoutType&&(this.isWebLayout=!0,this.documentHelper.isHeaderFooter=!0,this.owner.layoutType="Pages",this.owner.viewer.destroy(),this.owner.viewer=new re(this.owner),this.owner.editor.layoutWholeDocument())},e.prototype.goToHeader=function(){this.checkLayout(),this.owner.enableHeaderAndFooter=!0,this.enableHeadersFootersRegion(this.start.paragraph.bodyWidget.page.headerWidget),this.isWebLayout=!1},e.prototype.goToFooter=function(){this.checkLayout(),this.owner.enableHeaderAndFooter=!0,this.enableHeadersFootersRegion(this.start.paragraph.bodyWidget.page.footerWidget),this.isWebLayout=!1},e.prototype.closeHeaderFooter=function(){this.disableHeaderFooter(),this.documentHelper.isHeaderFooter&&"Pages"===this.owner.layoutType&&(this.owner.layoutType="Continuous",this.documentHelper.isHeaderFooter=!1)},e.prototype.goToPage=function(e){if(e>=1&&e<=this.owner.documentHelper.pages.length){var t=this.owner.documentHelper.pages[e-1];this.updateTextPositionForBlockContainer(t.bodyWidgets[0])}},e.prototype.selectTable=function(){this.owner.enableSelection&&this.selectTableInternal()},e.prototype.selectRow=function(){this.owner.enableSelection&&this.selectTableRow()},e.prototype.selectColumn=function(){this.owner.enableSelection&&this.selectColumnInternal()},e.prototype.selectCell=function(){this.owner.enableSelection&&this.selectTableCell()},e.prototype.select=function(e,t){if("string"==typeof e){var i=this.getTextPosBasedOnLogicalIndex(e),n=this.getTextPosBasedOnLogicalIndex(t);this.selectPosition(i,n)}else{var r=new O(e.x,e.y),o=this.viewer.findFocusedPage(r,!0);e.extend?this.moveTextPosition(o,this.end):this.documentHelper.updateTextPositionForSelection(o,1)}},e.prototype.selectByHierarchicalIndex=function(e,t){var i=this.getTextPosBasedOnLogicalIndex(e),n=this.getTextPosBasedOnLogicalIndex(t);this.selectPosition(i,n)},e.prototype.selectField=function(e){!this.isInField&&t.isNullOrUndefined(e)||(t.isNullOrUndefined(e)&&(e=this.getHyperlinkField(!0)),this.selectFieldInternal(e))},e.prototype.selectFieldInternal=function(e){if(e){var t=this.documentHelper.isFormFillProtectedMode,i=e.fieldEnd;t&&(e=e.fieldSeparator);var n=e.line.getOffset(e,t?1:0),r=new Nt(this.owner);r.setPositionParagraph(e.line,n),e.nextNode instanceof ke&&!t&&(i=e.nextElement.reference);var o=i.line.getOffset(i,t?0:1),s=new Nt(this.owner);s.setPositionParagraph(i.line,o),this.documentHelper.selection.selectRange(r,s)}},e.prototype.selectShape=function(e){if(e){var t=e.line.getOffset(e,0),i=new Nt(this.owner);i.setPositionParagraph(e.line,t);var n=e.line.getOffset(e,1),r=new Nt(this.owner);r.setPositionParagraph(e.line,n),this.documentHelper.selection.selectRange(i,r)}},e.prototype.toggleBold=function(){this.owner.editorModule&&this.owner.editorModule.toggleBold()},e.prototype.toggleItalic=function(){this.owner.editorModule&&this.owner.editorModule.toggleItalic()},e.prototype.toggleAllCaps=function(){this.owner.editorModule&&this.owner.editorModule.toggleAllCaps()},e.prototype.toggleUnderline=function(e){this.owner.editor&&this.owner.editor.toggleUnderline(e)},e.prototype.toggleStrikethrough=function(e){this.owner.editor&&this.owner.editor.toggleStrikethrough(e)},e.prototype.toggleHighlightColor=function(e){this.owner.editor&&this.owner.editor.toggleHighlightColor(e)},e.prototype.toggleSubscript=function(){this.owner.editor&&this.owner.editor.toggleSubscript()},e.prototype.toggleSuperscript=function(){this.owner.editor&&this.owner.editor.toggleSuperscript()},e.prototype.toggleTextAlignment=function(e){this.owner.editor&&this.owner.editor.toggleTextAlignment(e)},e.prototype.increaseIndent=function(){this.owner.editor&&this.owner.editor.increaseIndent()},e.prototype.decreaseIndent=function(){this.owner.editor&&this.owner.editor.decreaseIndent()},e.prototype.navigateHyperlink=function(){var e=this.getHyperlinkField();e&&this.fireRequestNavigate(e)},e.prototype.fireRequestNavigate=function(e){var t=this.getFieldCode(e);if(0!==t.toLowerCase().indexOf("ref ")||t.match("\\h")){var i=new Ht(e,this),n={isHandled:!1,navigationLink:i.navigationLink,linkType:i.linkType,localReference:i.localReference,source:this.owner};this.owner.trigger("requestNavigate",n),n.isHandled||this.documentHelper.selection.navigateBookmark(i.localReference,!0)}},e.prototype.copyHyperlink=function(){var e=this.getHyperlinkField(),t=this.getLinkText(e);this.copyToClipboard(t)},e.prototype.isHideSelection=function(e){var t=e.bodyWidget,i=t.sectionFormat,n=i.pageHeight-i.footerDistance,r=t.page.boundingRectangle.height/100*40;return this.contextType.indexOf("Footer")>=0&&e.y+e.height>W.convertPointToPixel(n)||this.contextType.indexOf("Header")>=0&&e.y+e.height>r},e.prototype.highlightSelection=function(e){if(this.owner.enableImageResizerMode&&this.owner.imageResizerModule.hideImageResizer(),this.isEmpty){if(!this.isInShape&&this.isHideSelection(this.start.paragraph))return void this.hideCaret();this.isInShape&&this.showResizerForShape(),this.updateCaretPosition()}else this.isForward?this.highlightSelectedContent(this.start,this.end):this.highlightSelectedContent(this.end,this.start),this.documentHelper.isComposingIME&&this.updateCaretPosition();this.documentHelper.updateTouchMarkPosition(),e&&this.documentHelper.scrollToPosition(this.start,this.end)},e.prototype.createHighlightBorder=function(e,t,i,n,r){t<0&&(t=0);var o=e.paragraph,s=[];if(o.floatingElements.length>0)for(var a=0;a<o.floatingElements.length;a++){var l=o.floatingElements[a];if(l.line===e){var d=this.start,h=this.end;this.isForward||(d=this.end,h=this.start);var c=l.line.getOffset(l,0);(d.currentWidget!==e&&h.currentWidget!==e||d.currentWidget===e&&d.offset<=c&&(h.currentWidget===e&&h.offset>=c+1||h.currentWidget!==e)||d.currentWidget!==e&&h.currentWidget===e&&h.offset>=c)&&s.push(l)}}var p=this.getPage(e.paragraph),u=e.height,g=this.selectedWidgets,m=void 0,f=void 0;if(this.isHightlightEditRegionInternal)return void this.addEditRegionHighlight(e,i,t);if(this.isHighlightFormFields)return void this.addFormFieldHighlight(e,i,t);g.containsKey(e)?g.get(e)instanceof Et?(m=g.get(e),r&&(g.remove(e),f=[],g.add(e,f))):f=g.get(e):r?(f=[],g.add(e,f)):((m=new Et(i,t)).floatingItems=s,g.add(e,m)),void 0===m&&((m=new Et(i,t)).floatingItems=s,g.add(e,m));var v=this.owner.documentHelper,y=this.getPageTop(p),b=p.boundingRectangle.x;if(this.viewer.containerTop<=y||y<this.viewer.containerTop+v.selectionCanvas.height){var w=v.zoomFactor;if(this.clipSelection(p,y),this.documentHelper.isComposingIME)this.renderDashLine(v.selectionContext,p,e,b+i*w-this.viewer.containerLeft,n,t*w,u);else if(this.documentHelper.selectionContext.fillStyle="gray",v.selectionContext.globalAlpha=.4,v.selectionContext.fillRect(b+i*w-this.viewer.containerLeft,y+n*w-this.viewer.containerTop,t*w,u*w),s.length>0)for(var C=0;C<s.length;C++)i=s[C].x,n=s[C].y,t=s[C].width,u=s[C].height,v.selectionContext.fillRect(b+i*w-this.viewer.containerLeft,y+n*w-this.viewer.containerTop,t*w,u*w);v.selectionContext.restore()}r&&f.push(m)},e.prototype.addEditRegionHighlight=function(e,t,i){var n=void 0,r=this.editRegionHighlighters;r.containsKey(e)?n=r.get(e):(n=[],r.add(e,n));var o=new Et(t,i);return this.isCurrentUser&&(o.color=""!==this.owner.userColor?this.owner.userColor:"#FFFF00"),n.push(o),o},e.prototype.addFormFieldHighlight=function(e,t,i){var n=void 0,r=this.formFieldHighlighters;r.containsKey(e)?n=r.get(e):(n=[],r.add(e,n));var o=new Et(t,i);n.push(o)},e.prototype.createHighlightBorderInsideTable=function(e){var t=this.getPage(e),i=void 0,n=e.x-e.margin.left+e.leftBorderWidth,r=e.width+e.margin.left+e.margin.right-e.leftBorderWidth-e.rightBorderWidth,o=e.y,s=e.height,a=this.getPageTop(t),l=t.boundingRectangle.x,d=this.viewer.containerTop<=a||a<this.viewer.containerTop+this.documentHelper.selectionCanvas.height,h=this.selectedWidgets;if(this.isHightlightEditRegionInternal||this.isHighlightFormFields||(h.containsKey(e)&&h.get(e)instanceof Et?(i=h.get(e),d&&this.documentHelper.selectionContext.clearRect(l+i.left*this.documentHelper.zoomFactor-this.viewer.containerLeft,a+o*this.documentHelper.zoomFactor-this.viewer.containerTop,i.width*this.documentHelper.zoomFactor,s*this.documentHelper.zoomFactor)):(i=new Et(n,r),h.containsKey(e)&&h.remove(h.get(e)),h.add(e,i))),d){this.documentHelper.selectionContext.fillStyle="gray",this.documentHelper.selectionContext.globalAlpha=.4;var c=this.documentHelper.zoomFactor;this.clipSelection(t,a),this.documentHelper.selectionContext.fillRect(l+n*c-this.viewer.containerLeft,a+o*c-this.viewer.containerTop,r*c,s*c),this.documentHelper.selectionContext.restore()}},e.prototype.clipSelection=function(e,t){var i,n,r=this.owner.documentHelper;this.viewer instanceof oe&&this.documentHelper.zoomFactor<1?(i=e.boundingRectangle.width/this.documentHelper.zoomFactor,n=e.boundingRectangle.height/this.documentHelper.zoomFactor):(i=e.boundingRectangle.width*this.documentHelper.zoomFactor,n=e.boundingRectangle.height*this.documentHelper.zoomFactor);var o=e.boundingRectangle.x;r.selectionContext.beginPath(),r.selectionContext.save(),r.selectionContext.rect(o-this.viewer.containerLeft,t-this.viewer.containerTop,i,n),r.selectionContext.clip()},e.prototype.addSelectionHighlight=function(e,i,n){if(this.selectedWidgets.containsKey(i)){var r=i.height,o=this.selectedWidgets.get(i),s=void 0;if(o instanceof Et?(s=[]).push(o):s=o,!t.isNullOrUndefined(s))for(var a=0;a<s.length;a++){var l=s[a],d=this.documentHelper.render.getScaledValue(s[a].width),h=this.documentHelper.render.getScaledValue(s[a].left,1),c=this.owner.selection.getPage(i.paragraph);if(this.owner.selection.clipSelection(c,this.owner.selection.getPageTop(c)),this.documentHelper.isComposingIME)this.renderDashLine(e,c,i,h,n,d,r);else if(r=this.documentHelper.render.getScaledValue(r),e.globalAlpha=.4,e.fillStyle="gray",e.fillRect(h,this.documentHelper.render.getScaledValue(n,2),d,r),l.floatingItems&&l.floatingItems.length>0)for(var p=0;p<l.floatingItems.length;p++){var u=l.floatingItems[p];d=this.documentHelper.render.getScaledValue(u.width),h=this.documentHelper.render.getScaledValue(u.x,1),n=this.documentHelper.render.getScaledValue(u.y,2),r=this.documentHelper.render.getScaledValue(u.height),e.fillRect(h,n,d,r)}e.restore()}}},e.prototype.renderDashLine=function(e,t,i,n,r,o,s){var a=this.characterFormat.fontColor,l=a?W.getColor(a):"#000000";e.globalAlpha=1;var d=this.owner.editor.copyInsertFormat(new H,!1),h=this.documentHelper.textHelper.getHeight(d),c=this.getPageTop(t),p=h.Height-h.BaselineOffset;r=this.documentHelper.render.getUnderlineYPosition(i)+r+4-p,this.documentHelper.render.renderDashLine(e,n,c-this.viewer.containerTop+r*this.documentHelper.zoomFactor,o,l,!0)},e.prototype.addSelectionHighlightTable=function(e,i){if(this.selectedWidgets.containsKey(i)){var n=this.selectedWidgets.get(i),r=void 0;if(n instanceof Et?(r=[]).push(n):r=n,!t.isNullOrUndefined(r))for(var o=0;o<r.length;o++){var s=this.documentHelper.render.getScaledValue(r[o].left,1),a=this.documentHelper.render.getScaledValue(i.y,2),l=this.documentHelper.render.getScaledValue(r[o].width),d=this.documentHelper.render.getScaledValue(i.height);e.fillStyle="gray";var h=this.owner.selection.getPage(i);this.owner.selection.clipSelection(h,this.owner.selection.getPageTop(h)),e.fillRect(s,a,l,d),e.restore()}}},e.prototype.removeSelectionHighlight=function(e){var i=0,n=0,r=0,o=0,s=void 0;if(e instanceof we){var a=e,l=a.paragraph;if(s=t.isNullOrUndefined(l)?void 0:this.getPage(a.paragraph),t.isNullOrUndefined(s))return;n=this.getTop(a),o=a.height}else if(e instanceof be){if(s=t.isNullOrUndefined(e)?void 0:this.getPage(e),t.isNullOrUndefined(s))return;n=e.y,o=e.height}if(!t.isNullOrUndefined(s)){var d=this.selectedWidgets.get(e),h=void 0;if(d instanceof Et?(h=[]).push(d):h=d,!t.isNullOrUndefined(h))for(var c=0;c<h.length;c++){r=h[c].width,i=h[c].left;var p=s.boundingRectangle,u=this.documentHelper.pages.indexOf(s),g=this.viewer.pageGap,m=(p.y-g*(u+1))*this.documentHelper.zoomFactor+g*(u+1),f=p.x,v=this.documentHelper.zoomFactor;(this.viewer.containerTop<=m||m<this.viewer.containerTop+this.documentHelper.selectionCanvas.height)&&this.documentHelper.selectionContext.clearRect(f+i*v-this.viewer.containerLeft-.5,m+n*v-this.viewer.containerTop-.5,r*v+.5,o*v+.5)}}},e.prototype.selectCurrentWord=function(e){var t=this.start.clone(),i=this.end.clone();this.selectCurrentWordRange(t,i,e||!1),this.selectRange(t,i)},e.prototype.selectParagraph=function(){t.isNullOrUndefined(this.start)||(this.start.paragraphStartInternal(this,!1),this.end.moveToParagraphEndInternal(this,!1),this.upDownSelectionLength=this.end.location.x,this.fireSelectionChanged(!0))},e.prototype.selectLine=function(){t.isNullOrUndefined(this.start)||(this.moveToLineStart(),this.handleShiftEndKey())},e.prototype.moveToDocumentStart=function(){this.handleControlHomeKey()},e.prototype.moveToDocumentEnd=function(){this.handleControlEndKey()},e.prototype.moveToParagraphStart=function(){this.isForward?(this.start.paragraphStartInternal(this,!1),this.end.setPositionInternal(this.start),this.upDownSelectionLength=this.end.location.x):(this.end.paragraphStartInternal(this,!1),this.start.setPositionInternal(this.end),this.upDownSelectionLength=this.start.location.x),this.fireSelectionChanged(!0)},e.prototype.moveToParagraphEnd=function(){this.isForward?(this.start.moveToParagraphEndInternal(this,!1),this.end.setPositionInternal(this.start),this.upDownSelectionLength=this.end.location.x):(this.end.moveToParagraphEndInternal(this,!1),this.start.setPositionInternal(this.end),this.upDownSelectionLength=this.start.location.x),this.fireSelectionChanged(!0)},e.prototype.moveToNextLine=function(){this.moveDown()},e.prototype.moveToPreviousLine=function(){this.moveUp()},e.prototype.moveToNextCharacter=function(){this.handleRightKey()},e.prototype.moveToPreviousCharacter=function(){this.handleLeftKey()},e.prototype.selectCurrentWordRange=function(e,i,n){if(!t.isNullOrUndefined(e)){if(e.offset>0){var r=e.clone(),o=0,s=e.currentWidget.getInline(e.offset,o),a=s.element;o=s.index,!t.isNullOrUndefined(a)&&a instanceof xe&&1===a.fieldType?e.offset>2&&(!t.isNullOrUndefined(a.fieldSeparator)||t.isNullOrUndefined(a.fieldBegin))?(r.setPositionParagraph(r.currentWidget,e.offset-2),r.moveToWordEndInternal(0,!1),r.paragraph===e.paragraph&&r.offset===e.offset-1||e.moveToWordStartInternal(2)):e.offset>3&&t.isNullOrUndefined(a.fieldSeparator)&&(r.setPositionParagraph(r.currentWidget,e.offset-3),r.moveToWordEndInternal(0,!1),r.paragraph===e.paragraph&&r.offset===e.offset||e.moveToWordStartInternal(2)):(r.setPositionParagraph(r.currentWidget,e.offset-1),r.moveToWordEndInternal(0,!1),r.paragraph===e.paragraph&&r.offset===e.offset||e.moveToWordStartInternal(2))}i.moveToWordEndInternal(2,n)}},e.prototype.extendToParagraphStart=function(){t.isNullOrUndefined(this.start)||(this.end.paragraphStartInternal(this,!0),this.upDownSelectionLength=this.end.location.x,this.fireSelectionChanged(!0))},e.prototype.extendToParagraphEnd=function(){t.isNullOrUndefined(this.start)||(this.end.moveToParagraphEndInternal(this,!0),this.upDownSelectionLength=this.end.location.x,this.fireSelectionChanged(!0))},e.prototype.moveNextPosition=function(){if(!t.isNullOrUndefined(this.start)&&(this.isEmpty&&(this.start.moveNextPosition(),this.end.setPositionInternal(this.start)),this.updateForwardSelection(),this.upDownSelectionLength=this.start.location.x,this.fireSelectionChanged(!0),this.documentHelper.isFormFillProtectedMode)){var e=this.getCurrentFormField();e||(e=this.getFormFieldInFormFillMode(),this.selectPrevNextFormField(!0,e))}},e.prototype.moveToNextParagraph=function(){t.isNullOrUndefined(this.start)||(this.end.moveToNextParagraphStartInternal(),this.start.setPositionInternal(this.end),this.upDownSelectionLength=this.end.location.x,this.fireSelectionChanged(!0))},e.prototype.nextFootnote=function(){if(this.isinFootnote){var e=this.start.paragraph.footNoteReference,i=(this.documentHelper.footnoteCollection.length,this.documentHelper.footnoteCollection.indexOf(e)),n=this.documentHelper.footnoteCollection[i+1];t.isNullOrUndefined(n)&&(n=e);for(var r=this.start.clone(),o=this.end.clone(),s=0;s<this.documentHelper.pages.length;s++)for(var a=this.documentHelper.pages[s].footnoteWidget,l=1;l<a.childWidgets.length;l++)a.childWidgets[l].footNoteReference===n&&(r.setPositionParagraph(a.childWidgets[l].childWidgets[0],0),o.setPositionInternal(r),this.selectRange(r,o))}},e.prototype.previousFootnote=function(){if(this.isinFootnote){var e=this.start.paragraph.footNoteReference,i=(this.documentHelper.footnoteCollection.length,this.documentHelper.footnoteCollection.indexOf(e)),n=this.documentHelper.footnoteCollection[i-1];t.isNullOrUndefined(n)&&(n=e);for(var r=this.start.clone(),o=this.end.clone(),s=0;s<this.documentHelper.pages.length;s++)for(var a=this.documentHelper.pages[s].footnoteWidget,l=1;l<a.childWidgets.length;l++)a.childWidgets[l].footNoteReference===n&&(r.setPositionParagraph(a.childWidgets[l].childWidgets[0],0),o.setPositionInternal(r),this.selectRange(r,o))}},e.prototype.nextEndnote=function(){if(this.isinEndnote){var e=this.start.paragraph.footNoteReference,i=(this.documentHelper.endnoteCollection.length,this.documentHelper.endnoteCollection.indexOf(e)),n=this.documentHelper.endnoteCollection[i+1];t.isNullOrUndefined(n)&&(n=e);for(var r=this.start.clone(),o=this.end.clone(),s=this.documentHelper.pages[this.endPage-1].endnoteWidget,a=0;a<s.childWidgets.length;a++)s.childWidgets[a].footNoteReference===n&&(r.setPositionParagraph(s.childWidgets[a].childWidgets[0],0),o.setPositionInternal(r),this.selectRange(r,o))}},e.prototype.previousEndnote=function(){if(this.isinEndnote){var e=this.start.paragraph.footNoteReference,i=(this.documentHelper.endnoteCollection.length,this.documentHelper.endnoteCollection.indexOf(e)),n=this.documentHelper.endnoteCollection[i-1];t.isNullOrUndefined(n)&&(n=e);for(var r=this.start.clone(),o=this.end.clone(),s=this.documentHelper.pages[this.endPage-1].endnoteWidget,a=0;a<s.childWidgets.length;a++)s.childWidgets[a].footNoteReference===n&&(r.setPositionParagraph(s.childWidgets[a].childWidgets[0],0),o.setPositionInternal(r),this.selectRange(r,o))}},e.prototype.movePreviousPosition=function(){if(!t.isNullOrUndefined(this.start)&&(this.isEmpty&&(this.start.movePreviousPosition(),this.end.setPositionInternal(this.start)),this.updateBackwardSelection(),this.upDownSelectionLength=this.start.location.x,this.fireSelectionChanged(!0),this.documentHelper.isFormFillProtectedMode)){var e=this.getCurrentFormField();e||(e=this.getFormFieldInFormFillMode(),this.selectPrevNextFormField(!1,e))}},e.prototype.moveToPreviousParagraph=function(){t.isNullOrUndefined(this.start)||(this.end.moveToPreviousParagraph(this),this.start.setPositionInternal(this.end),this.upDownSelectionLength=this.end.location.x,this.fireSelectionChanged(!0))},e.prototype.extendToPreviousLine=function(){t.isNullOrUndefined(this.start)||(this.end.moveToPreviousLine(this,this.upDownSelectionLength),this.fireSelectionChanged(!0))},e.prototype.extendToLineEnd=function(){t.isNullOrUndefined(this.start)||(this.end.moveToLineEndInternal(this,!0),this.upDownSelectionLength=this.end.location.x,this.fireSelectionChanged(!0))},e.prototype.extendToLineStart=function(){t.isNullOrUndefined(this.start)||(this.end.moveToLineStartInternal(this,!0),this.upDownSelectionLength=this.end.location.x,this.start.paragraph===this.end.paragraph&&this.start.offset===this.start.currentWidget.getEndOffset()&&this.isParagraphLastLine(this.start.currentWidget)&&this.isParagraphFirstLine(this.end.currentWidget)&&this.start.setPositionParagraph(this.start.currentWidget,this.start.offset+1),this.fireSelectionChanged(!0))},e.prototype.moveUp=function(){if(this.documentHelper.isFormFillProtectedMode)return void this.selectPrevNextFormField(!1);t.isNullOrUndefined(this.start)||(this.isEmpty||(this.isForward?this.end.setPositionInternal(this.start):this.start.setPositionInternal(this.end),this.upDownSelectionLength=this.start.location.x),this.upDownSelectionLength=this.start.location.x,this.start.moveUp(this,this.upDownSelectionLength),this.end.setPositionInternal(this.start),this.fireSelectionChanged(!0))},e.prototype.moveDown=function(){if(this.documentHelper.isFormFillProtectedMode)return void this.selectPrevNextFormField(!0);t.isNullOrUndefined(this.start)||(this.isEmpty||(this.isForward?this.start.setPositionInternal(this.end):this.end.setPositionInternal(this.start),this.upDownSelectionLength=this.start.location.x),this.start.moveDown(this,this.upDownSelectionLength),this.end.setPositionInternal(this.start),this.fireSelectionChanged(!0))},e.prototype.updateForwardSelection=function(){this.isEmpty||(this.isForward?this.start.setPositionInternal(this.end):this.end.setPositionInternal(this.start))},e.prototype.updateBackwardSelection=function(){this.isEmpty||(this.isForward?this.end.setPositionInternal(this.start):this.start.setPositionInternal(this.end))},e.prototype.getFirstBlockInFirstCell=function(e){if(e.childWidgets.length>0){var t=e.childWidgets[0];if(t.childWidgets.length>0){var i=t.childWidgets[0];if(0===i.childWidgets.length)return;return i.childWidgets[0]}}},e.prototype.getFirstCellInRegion=function(e,i,n,r){var o=this.getCellLeft(e,i),s=o+i.cellFormat.cellWidth,a=!0;if(o<=n&&n<s)for(var l=0;l<e.childWidgets.length;l++){var d=this.getCellLeft(e,e.childWidgets[l]);if(W.round(o,2)<=W.round(d,2)&&W.round(d,2)<W.round(s,2))return a=!1,e.childWidgets[l]}else for(var h=0;h<e.childWidgets.length;h++){var c=this.getCellLeft(e,e.childWidgets[h]);if(c<=n&&c+e.childWidgets[h].cellFormat.cellWidth>n)return a=!1,e.childWidgets[h]}if(a){if(!t.isNullOrUndefined(e.previousRenderedWidget)&&r){var p=e.previousRenderedWidget;return this.getFirstCellInRegion(p,i,n,r)}if(!t.isNullOrUndefined(e.nextRenderedWidget)&&!r)return this.getFirstCellInRegion(e.nextRenderedWidget,i,n,r)}return e.childWidgets[0]},e.prototype.getFirstParagraph=function(e){for(;e.previousSplitWidget;)e=e.previousSplitWidget;var t=e.firstChild;return this.getFirstParagraphBlock(t)},e.prototype.getLastBlockInLastCell=function(e){if(e.childWidgets.length>0){for(var i=e.childWidgets[e.childWidgets.length-1],n=i.childWidgets[i.childWidgets.length-1];0===n.childWidgets.length&&!t.isNullOrUndefined(n.previousSplitWidget);)n=n.previousSplitWidget;return n.childWidgets[n.childWidgets.length-1]}},e.prototype.moveToLineStart=function(){t.isNullOrUndefined(this.start)||(this.updateBackwardSelection(),this.start.moveToLineStartInternal(this,!1),this.end.setPositionInternal(this.start),this.upDownSelectionLength=this.start.location.x,this.fireSelectionChanged(!0))},e.prototype.moveToLineEnd=function(){t.isNullOrUndefined(this.start)||(this.updateForwardSelection(),this.start.moveToLineEndInternal(this,!1),this.end.setPositionInternal(this.start),this.upDownSelectionLength=this.start.location.x,this.fireSelectionChanged(!0))},e.prototype.getPageTop=function(e){return(e.boundingRectangle.y-this.viewer.pageGap*(this.documentHelper.pages.indexOf(e)+1))*this.documentHelper.zoomFactor+this.viewer.pageGap*(this.documentHelper.pages.indexOf(e)+1)},e.prototype.moveTextPosition=function(e,i){if(!t.isNullOrUndefined(this.start)){var n=this.documentHelper.getLineWidgetInternal(e,!0);t.isNullOrUndefined(n)||this.updateTextPositionWidget(n,e,i,!0),this.upDownSelectionLength=i.location.x;var r=this.start.getHierarchicalIndexInternal(),o=this.end.getHierarchicalIndexInternal();r!==o&&(Nt.isForwardSelection(r,o)?i.validateForwardFieldSelection(r,o):i.validateBackwardFieldSelection(r,o)),this.fireSelectionChanged(!0)}},e.prototype.getDocumentStart=function(){var e=this.documentHelper.pages[0].bodyWidgets[0].childWidgets[0];return this.setPositionForBlock(e,!0)},e.prototype.getDocumentEnd=function(){var e=void 0,i=this.owner.documentStart,n=this.documentHelper.pages[this.documentHelper.pages.length-1];if(!t.isNullOrUndefined(i)&&n.bodyWidgets[0].childWidgets.length>0){var r=void 0,o=n.bodyWidgets[0].childWidgets,s=o[o.length-1];s instanceof ge&&(r=s),e=this.setPositionForBlock(r,!1)}return e},e.prototype.handleControlEndKey=function(){var e=void 0;t.isNullOrUndefined(this.owner.documentEnd)||(e=this.owner.documentEnd),t.isNullOrUndefined(e)||this.owner.selection.selectContent(e,!0),this.checkForCursorVisibility()},e.prototype.handleControlHomeKey=function(){var e=void 0;t.isNullOrUndefined(this.owner.documentStart)||(e=this.owner.documentStart),t.isNullOrUndefined(e)||this.owner.selection.selectContent(e,!0),this.checkForCursorVisibility()},e.prototype.handleControlLeftKey=function(){this.extendToWordStartInternal(!0),this.checkForCursorVisibility()},e.prototype.handleControlRightKey=function(){this.extendToWordEndInternal(!0),this.checkForCursorVisibility()},e.prototype.handleControlDownKey=function(){this.moveToNextParagraph(),this.checkForCursorVisibility()},e.prototype.handleControlUpKey=function(){this.moveToPreviousParagraph(),this.checkForCursorVisibility()},e.prototype.handleShiftLeftKey=function(){this.extendBackward(),this.checkForCursorVisibility()},e.prototype.handleShiftUpKey=function(){this.extendToPreviousLine(),this.checkForCursorVisibility()},e.prototype.handleShiftRightKey=function(){this.extendForward(),this.checkForCursorVisibility()},e.prototype.handleShiftDownKey=function(){this.extendToNextLine(),this.checkForCursorVisibility()},e.prototype.handleControlShiftLeftKey=function(){(this.isForward?this.start.isCurrentParaBidi:this.end.isCurrentParaBidi)?this.extendToWordEndInternal(!1):this.extendToWordStartInternal(!1),this.checkForCursorVisibility()},e.prototype.handleControlShiftUpKey=function(){this.extendToParagraphStart(),this.checkForCursorVisibility()},e.prototype.handleControlShiftRightKey=function(){(this.isForward?this.start.isCurrentParaBidi:this.end.isCurrentParaBidi)?this.extendToWordStartInternal(!1):this.extendToWordEndInternal(!1),this.checkForCursorVisibility()},e.prototype.handleControlShiftDownKey=function(){this.extendToParagraphEnd(),this.checkForCursorVisibility()},e.prototype.handleLeftKey=function(){this.end.isCurrentParaBidi?this.moveNextPosition():this.movePreviousPosition(),this.checkForCursorVisibility()},e.prototype.handleUpKey=function(){this.isMoveDownOrMoveUp=!0,this.moveUp(),this.isMoveDownOrMoveUp=!1,this.checkForCursorVisibility()},e.prototype.handleRightKey=function(){this.end.isCurrentParaBidi?this.movePreviousPosition():this.moveNextPosition(),this.checkForCursorVisibility()},e.prototype.handleEndKey=function(){this.moveToLineEnd(),this.checkForCursorVisibility()},e.prototype.handleHomeKey=function(){this.moveToLineStart(),this.checkForCursorVisibility()},e.prototype.handleDownKey=function(){this.isMoveDownOrMoveUp=!0,this.moveDown(),this.isMoveDownOrMoveUp=!1,this.checkForCursorVisibility()},e.prototype.handleShiftEndKey=function(){this.extendToLineEnd(),this.checkForCursorVisibility()},e.prototype.handleShiftHomeKey=function(){this.extendToLineStart(),this.checkForCursorVisibility()},e.prototype.handleControlShiftEndKey=function(){var e=void 0;t.isNullOrUndefined(this.owner.documentEnd)||(e=this.owner.documentEnd),t.isNullOrUndefined(e)||(this.end.setPosition(e.currentWidget,!1),this.fireSelectionChanged(!0)),this.checkForCursorVisibility()},e.prototype.handleControlShiftHomeKey=function(){var e=void 0;t.isNullOrUndefined(this.owner.documentStart)||(e=this.owner.documentStart),t.isNullOrUndefined(e)||(this.end.setPositionInternal(e),this.fireSelectionChanged(!0)),this.checkForCursorVisibility()},e.prototype.handleSpaceBarKey=function(){this.owner.documentHelper.isDocumentProtected&&"FormFieldsOnly"===this.owner.documentHelper.protectionType&&"CheckBox"===this.getFormFieldType()&&this.owner.editor.toggleCheckBoxFormField(this.getCurrentFormField())},e.prototype.handleTabKey=function(e,i){var n=this.start;t.isNullOrUndefined(n)||(n.paragraph.isInsideTable&&this.end.paragraph.isInsideTable&&(e||i)?this.owner.documentHelper.isDocumentProtected||"FormFieldsOnly"===this.documentHelper.protectionType||(i?this.selectPreviousCell():this.selectNextCell()):!e&&!i||t.isNullOrUndefined(n)||n.offset!==this.getStartOffset(n.paragraph)||t.isNullOrUndefined(n.paragraph.paragraphFormat)||t.isNullOrUndefined(n.paragraph.paragraphFormat.listFormat)||-1===n.paragraph.paragraphFormat.listFormat.listId||this.owner.isReadOnlyMode?this.owner.isReadOnlyMode||this.documentHelper.isFormFillProtectedMode||this.owner.editorModule.handleTextInput("\t"):this.owner.editorModule.updateListLevel(!i),"FormFieldsOnly"===this.documentHelper.protectionType&&this.documentHelper.formFields.length>0&&this.selectPrevNextFormField(!i),this.checkForCursorVisibility())},e.prototype.getFormFieldInFormFillMode=function(){for(var e,t=this.owner.selection.start,i=this.documentHelper.formFields.length-1;i>=0;i--)if(this.documentHelper.formFields[i].formFieldData.enabled){if(this.getElementPosition(this.documentHelper.formFields[i]).startPosition.isExistBefore(t)){e=this.documentHelper.formFields[i];break}0===i&&(e=this.documentHelper.formFields[this.documentHelper.formFields.length-1])}return e},e.prototype.selectPrevNextFormField=function(e,t){if(this.documentHelper.isFormFillProtectedMode){t||(t=this.getCurrentFormField());var i=this.documentHelper.formFields.indexOf(t);if(e)for(n=i;;n++){n===this.documentHelper.formFields.length-1?n=0:n+=1;if(this.documentHelper.formFields[n].formFieldData.enabled){this.selectFieldInternal(this.documentHelper.formFields[n]);break}n-=1}else for(var n=i;;n--){0===n?n=this.documentHelper.formFields.length-1:n-=1;if(this.documentHelper.formFields[n].formFieldData.enabled){this.selectFieldInternal(this.documentHelper.formFields[n]);break}n+=1}}},e.prototype.navigateToNextFormField=function(){for(var e,t=this.owner.selection.end,i=0;i<this.documentHelper.formFields.length;i++)if(e=this.documentHelper.formFields[i],this.documentHelper.formFields[i].formFieldData.enabled){if(this.getElementPosition(this.documentHelper.formFields[i]).startPosition.isExistAfter(t)){e.formFieldData instanceof Pe&&"Text"===e.formFieldData.type&&this.documentHelper.isInlineFormFillProtectedMode?this.selectTextElementStartOfField(this.documentHelper.formFields[i]):this.selectFieldInternal(this.documentHelper.formFields[i]);break}i===this.documentHelper.formFields.length-1&&((e=this.documentHelper.formFields[0]).formFieldData instanceof Pe&&"Text"===e.formFieldData.type&&this.documentHelper.isInlineFormFillProtectedMode?this.selectTextElementStartOfField(this.documentHelper.formFields[0]):this.selectFieldInternal(this.documentHelper.formFields[0]))}},e.prototype.selectTextElementStartOfField=function(e){var t=e.fieldSeparator.nextElement;if(t){for(;!(t instanceof Ie);)t=t.nextElement;var i=e.line.getOffset(t,0),n=this.getPhysicalPositionInternal(e.line,i,!1);this.selectInternal(e.line,t,0,n)}},e.prototype.triggerFormFillEvent=function(){var e,t,i=this.previousSelectedFormField,n=this.getCurrentFormField();n!==i&&i&&i.formFieldData instanceof Pe&&"Text"===i.formFieldData.type&&(""===i.formFieldData.format||this.isFormatUpdated||this.owner.editor.applyFormTextFormat(i),e={fieldName:i.formFieldData.name,value:this.owner.editorModule.getFormFieldText(i)},this.owner.trigger("afterFormFieldFill",e)),n!==i&&n&&n.formFieldData instanceof Pe&&"Text"===n.formFieldData.type&&(t={fieldName:n.formFieldData.name,value:this.owner.editorModule.getFormFieldText(n)},this.owner.trigger("beforeFormFieldFill",t))},e.prototype.selectPreviousCell=function(){var e=this.start.paragraph.associatedCell,i=e.ownerRow;i.ownerTable;if(t.isNullOrUndefined(e.previousWidget)){if(!t.isNullOrUndefined(i.previousRenderedWidget)){var n=void 0;i.previousRenderedWidget instanceof ye&&(n=i.previousRenderedWidget),this.selectTableCellInternal(n.childWidgets[n.childWidgets.length-1],!0)}}else{var r=void 0;e.previousWidget instanceof be&&(r=e.previousWidget),this.selectTableCellInternal(r,!0)}},e.prototype.selectNextCell=function(){var e=this.start.paragraph.associatedCell,i=e.ownerRow;i.ownerTable;if(t.isNullOrUndefined(e.nextWidget))if(t.isNullOrUndefined(i.nextRenderedWidget)&&!this.owner.isReadOnlyMode)this.owner.editorModule.insertRow(!1);else{var n=void 0;i.nextRenderedWidget instanceof ye&&(n=i.nextRenderedWidget),this.selectTableCellInternal(n.childWidgets[0],!0)}else{var r=void 0;e.nextRenderedWidget instanceof be&&(r=e.nextRenderedWidget),this.selectTableCellInternal(r,!0)}},e.prototype.selectTableCellInternal=function(e,t){var i=this.getFirstParagraph(e),n=this.getLastParagraph(e);if(i===n&&n.isEmpty())this.selectParagraphInternal(n,!0);else{var r=n.childWidgets[0];this.start.setPosition(i.childWidgets[0],!0),this.end.setPositionParagraph(r,r.getEndOffset()),this.fireSelectionChanged(!0)}},e.prototype.selectTableInternal=function(){var e=this.start,i=this.end;if(this.isForward||(e=this.end,i=this.start),!t.isNullOrUndefined(e)&&!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(this.getTable(e,i))){var n=this.getContainerCellOf(e.paragraph.associatedCell,i.paragraph.associatedCell).ownerTable,r=this.getFirstParagraphBlock(n),o=this.getLastParagraphBlock(n),s=o.lastChild.getEndOffset();this.start.setPosition(r.childWidgets[0],!0),this.end.setPositionParagraph(o.lastChild,s+1)}this.selectPosition(this.start,this.end)},e.prototype.selectColumnInternal=function(){var e=this.start,i=this.end;if(this.isForward||(e=this.end,i=this.start),!t.isNullOrUndefined(e)&&!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(this.getTable(e,i))){var n=this.getContainerCellOf(e.paragraph.associatedCell,i.paragraph.associatedCell);if(n.ownerTable.contains(i.paragraph.associatedCell)){var r=this.getSelectedCell(e.paragraph.associatedCell,n),o=this.getSelectedCell(i.paragraph.associatedCell,n);if(this.containsCell(n,i.paragraph.associatedCell)){r.ownerRow;var s=n.ownerTable.getColumnCellsForSelection(n,n);if(s.length>0){var a=this.getFirstParagraph(s[0]),l=this.getLastParagraph(s[s.length-1]);this.start.setPosition(a.firstChild,!0);c=l.lastChild;this.end.setPositionParagraph(c,c.getEndOffset()+1)}}else{var d=n.ownerTable.getColumnCellsForSelection(r,r),h=n.ownerTable.getColumnCellsForSelection(o,o);if(d.length>0&&h.length>0){var a=this.getFirstParagraph(d[0]),l=this.getLastParagraph(h[h.length-1]);this.start.setPosition(a.firstChild,!0);var c=l.lastChild;this.end.setPositionParagraph(c,c.getEndOffset()+1)}}}}this.selectPosition(this.start,this.end)},e.prototype.selectTableRow=function(){var e=this.start,i=this.end;if(this.isForward||(e=this.end,i=this.start),!t.isNullOrUndefined(e)&&!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(this.getTable(e,i))){var n=void 0;if((n=this.getContainerCellOf(e.paragraph.associatedCell,i.paragraph.associatedCell)).ownerTable.contains(i.paragraph.associatedCell)){var r=this.getSelectedCell(e.paragraph.associatedCell,n),o=this.getSelectedCell(i.paragraph.associatedCell,n);if(this.containsCell(n,i.paragraph.associatedCell)){var s=r.ownerRow,a=this.getFirstParagraph(s.childWidgets[0]),l=this.getLastParagraph(s.childWidgets[s.childWidgets.length-1]);this.start.setPosition(a.firstChild,!0),this.end.setPositionParagraph(l.lastChild,l.lastChild.getEndOffset()+1)}else{var a=this.getFirstParagraph(r.ownerRow.childWidgets[0]),l=void 0;l=this.getLastParagraph(o.ownerRow.childWidgets[o.ownerRow.childWidgets.length-1]),this.start.setPosition(a.firstChild,!0),this.end.setPositionParagraph(l.lastChild,l.lastChild.getEndOffset()+1)}}}this.selectPosition(this.start,this.end)},e.prototype.selectTableCell=function(){var e=this.start,i=this.end;if(this.isForward||(e=this.end,i=this.start),!t.isNullOrUndefined(this.getTable(e,i))){if(this.isEmpty)e.paragraph.isInsideTable&&!t.isNullOrUndefined(e.paragraph.associatedCell)&&((r=this.getFirstParagraph(e.paragraph.associatedCell))===(o=this.getLastParagraph(i.paragraph.associatedCell))?(this.start.setPosition(o.firstChild,!0),this.end.setPositionParagraph(o.lastChild,o.lastChild.getEndOffset()+1)):(this.start.setPosition(r.firstChild,!0),this.end.setPositionParagraph(o.lastChild,o.lastChild.getEndOffset()+1)));else{var n=this.getContainerCell(e.paragraph.associatedCell);if(this.containsCell(n,e.paragraph.associatedCell)&&this.containsCell(n,i.paragraph.associatedCell)){var r=this.getFirstParagraph(n),o=this.getLastParagraph(n);t.isNullOrUndefined(r)||t.isNullOrUndefined(o)||(this.start.setPosition(r.firstChild,!0),this.end.setPositionParagraph(o.lastChild,o.lastChild.getEndOffset()+1))}}this.selectPosition(this.start,this.end)}},e.prototype.selectAll=function(){var e,i,n=this.getContainerWidget(this.start.paragraph);if(this.owner.enableHeaderAndFooter){var r=this.getContainerWidget(this.start.paragraph);e=this.setPositionForBlock(r.firstChild,!0),i=this.setPositionForBlock(r.lastChild,!1)}else if(this.isInShape){var o=this.getCurrentTextFrame();e=this.setPositionForBlock(o.firstChild,!0),i=this.setPositionForBlock(o.lastChild,!1)}else if(n instanceof me&&"Footnote"===n.footNoteType){var s=void 0,a=void 0,l=this.documentHelper.pages.length;for(s=0;s<=l-1;s++)if(!t.isNullOrUndefined(this.documentHelper.pages[s].footnoteWidget)){e=this.setPositionForBlock(this.documentHelper.pages[s].footnoteWidget.firstChild,!0);break}for(a=l-1;a>=0;a--)if(!t.isNullOrUndefined(this.documentHelper.pages[a].footnoteWidget)){var d=this.documentHelper.pages[a].footnoteWidget.childWidgets.length;i=this.setPositionForBlock(this.documentHelper.pages[a].footnoteWidget.childWidgets[d-1],!1);break}}else if(n instanceof me&&"Endnote"===n.footNoteType){var h=this.getContainerWidget(this.start.paragraph);e=this.setPositionForBlock(h.firstChild,!0),i=this.setPositionForBlock(h.lastChild,!1)}else e=this.owner.documentStart,i=this.owner.documentEnd;t.isNullOrUndefined(e)||(this.start.setPositionInternal(e),this.end.setPositionParagraph(i.currentWidget,i.offset+1),this.upDownSelectionLength=this.end.location.x,this.fireSelectionChanged(!0))},e.prototype.extendBackward=function(){t.isNullOrUndefined(this.start)||((this.isForward?this.start.isCurrentParaBidi:this.end.isCurrentParaBidi)?this.end.moveForward():this.end.moveBackward(),this.upDownSelectionLength=this.end.location.x,this.fireSelectionChanged(!0))},e.prototype.extendForward=function(){t.isNullOrUndefined(this.start)||((this.isForward?this.start.isCurrentParaBidi:this.end.isCurrentParaBidi)?this.end.moveBackward():this.end.moveForward(),this.upDownSelectionLength=this.end.location.x,this.fireSelectionChanged(!0))},e.prototype.extendToWordStartEnd=function(){return!(!this.start.paragraph.isInsideTable&&!this.end.paragraph.isInsideTable||this.start.paragraph.associatedCell===this.end.paragraph.associatedCell&&!this.isCellSelected(this.start.paragraph.associatedCell,this.start,this.end))},e.prototype.extendToWordStart=function(){this.extendToWordStartInternal(!1)},e.prototype.extendToWordEnd=function(){this.extendToWordEndInternal(!1)},e.prototype.extendToWordStartInternal=function(e){t.isNullOrUndefined(this.start)||(this.extendToWordStartEnd()?this.end.moveToPreviousParagraphInTable(this):e&&this.end.isCurrentParaBidi?this.end.moveToWordEndInternal(e?0:1,!1):this.end.moveToWordStartInternal(e?0:1),e&&this.start.setPositionInternal(this.end),this.upDownSelectionLength=this.end.location.x,this.fireSelectionChanged(!0))},e.prototype.extendToWordEndInternal=function(e){t.isNullOrUndefined(this.start)||(this.extendToWordStartEnd()?this.end.moveToNextParagraphInTable():e&&this.end.isCurrentParaBidi?this.end.moveToWordStartInternal(e?0:1):this.end.moveToWordEndInternal(e?0:1,!1),e&&this.start.setPositionInternal(this.end),this.upDownSelectionLength=this.end.location.x,this.fireSelectionChanged(!0))},e.prototype.extendToNextLine=function(){t.isNullOrUndefined(this.start)||(this.end.moveToNextLine(this.upDownSelectionLength),this.fireSelectionChanged(!0))},e.prototype.getTextPosition=function(e){var t=new Nt(this.owner);return t.setPositionForCurrentIndex(e),t},e.prototype.getText=function(e){if(!(t.isNullOrUndefined(this.start)||t.isNullOrUndefined(this.end)||t.isNullOrUndefined(this.start.paragraph)||t.isNullOrUndefined(this.end.paragraph))){var i=this.start,n=this.end;return i.isAtSamePosition(n)?"":this.getTextInternal(i,n,e)}},e.prototype.getTextInternal=function(e,i,n){if(e.isExistAfter(i)){var r=i;i=e,e=r}var o=e,s=i;if(!(t.isNullOrUndefined(e)||t.isNullOrUndefined(i)||t.isNullOrUndefined(e.paragraph)||t.isNullOrUndefined(i.paragraph))){var a=0,l=0,d=e.offset,h=i.offset,c=e.currentWidget.getInline(d,a);a=c.index;var p=c.element;if(p instanceof xe&&!t.isNullOrUndefined(p.fieldEnd)){var u=this.getRenderedInline(p,a);p=u.element,a=u.index}var g=i.currentWidget.getInline(h,l),m=g.element;l=g.index;var f="";if(p instanceof Ge&&n&&0===a?f=Ce.objectCharacter:p instanceof Ie&&(f=t.isNullOrUndefined(p.text)||""===p.text||p.text.length<a?f:p.text.substring(a)),o.paragraph===s.paragraph)p instanceof Ce&&(p===m&&p instanceof Ie?f=f.length<l-a?f:f.substring(0,l-a):p.nextNode instanceof Ce&&(f+=this.getTextInline(p.nextNode,s.paragraph,m,l,n)));else if(p instanceof Ce&&p.nextNode instanceof Ce)f+=this.getTextInline(p.nextNode,s.paragraph,void 0,0,n);else{var v=this.documentHelper.selection.getNextParagraphBlock(o.paragraph);for(f+="\r";!t.isNullOrUndefined(v)&&v.isEmpty();){if(f+="\r",v===s.paragraph)return f;v=this.documentHelper.selection.getNextParagraphBlock(v)}t.isNullOrUndefined(v)||v.isEmpty()||(f+=this.getTextInline(v.childWidgets[0].children[0],s.paragraph,m,l,n))}return h===s.currentWidget.getEndOffset()+1&&(f+="\r"),f}},e.prototype.getHierarchicalIndex=function(e,t){var i;if(e){if(e instanceof ue){var n=-1!==e.headerFooterType.indexOf("Header")?"H":"F",r=e.page.index.toString();i=(o=e.page.sectionIndex)+";"+n+";"+r+";"+t}else i=e.index+";"+t;if(e instanceof _e)return i="S;"+e.containerShape.indexInOwner.toString()+";"+t,this.getHierarchicalIndex(e.containerShape.paragraph,i);if(e instanceof me){var n="Footnote"===e.footNoteType?"FN":"EN",r=e.page.index.toString(),o=e.page.sectionIndex;i=o+";"+n+";"+r+";"+t}if(e.containerWidget)return e instanceof be&&e.rowIndex!==e.containerWidget.index&&(i=e.rowIndex+";"+i,e=e.containerWidget),this.getHierarchicalIndex(e.containerWidget,i)}return i},e.prototype.getHierarchicalIndexByPosition=function(e){var t=this.getParagraphInfo(e);return this.getHierarchicalIndex(t.paragraph,t.offset.toString())},e.prototype.getTextPosBasedOnLogicalIndex=function(e){var t=new Nt(this.owner),i=this.getParagraph({index:e}),n=this.getLineInfoBasedOnParagraph(i.paragraph,i.offset);return t.setPositionForLineWidget(n.line,n.offset),t},e.prototype.getLineInfoBasedOnParagraph=function(e,i){var n=this.getParagraphLength(e),r=e.nextSplitWidget;for(i>n+1&&t.isNullOrUndefined(r)&&(i=n);i>n&&r instanceof fe;)i-=n,e=r,n=this.getParagraphLength(e),r=e.nextSplitWidget;return this.getLineInfo(e,i)},e.prototype.getParagraph=function(e){return{paragraph:this.getParagraphInternal(this.getBodyWidget(e),e),offset:parseInt(e.index,10)}},e.prototype.getBodyWidget=function(e){var t=e.index.indexOf(";"),i=e.index.substring(0,t);e.index=e.index.substring(t).replace(";","");var n=parseInt(i,10);return t=parseInt(i,10),t=e.index.indexOf(";"),"H"===(i=e.index.substring(0,t))||"F"===i?this.getHeaderFooterWidget(e):"FN"===i||"EN"===i?this.getFootNoteWidget(e):(t=parseInt(i,10),this.getBodyWidgetInternal(n,t))},e.prototype.getFootNoteWidget=function(e){var t=e.index.indexOf(";"),i=e.index.substring(0,t);e.index=e.index.substring(t).replace(";","");var n="FN"===i;t=e.index.indexOf(";"),i=e.index.substring(0,t),e.index=e.index.substring(t).replace(";",""),t=parseInt(i,10);var r=this.documentHelper.pages[t];return n?r.footnoteWidget:r.endnoteWidget},e.prototype.getHeaderFooterWidget=function(e){var t=e.index.indexOf(";"),i=e.index.substring(0,t);e.index=e.index.substring(t).replace(";","");var n="H"===i;t=e.index.indexOf(";"),i=e.index.substring(0,t),e.index=e.index.substring(t).replace(";",""),t=parseInt(i,10);var r=this.documentHelper.pages[t];return n?r.headerWidget:r.footerWidget},e.prototype.getBodyWidgetInternal=function(e,t){for(var i=0;i<this.documentHelper.pages.length;i++){var n=this.documentHelper.pages[i].bodyWidgets[0];if(n.index===e&&1===n.childWidgets.length)return n;if(n.index===e&&n.childWidgets.length>0&&n.firstChild.index<=t&&n.lastChild.index>=t)return n;if(n.index>e)break}},e.prototype.getParagraphInternal=function(e,i){if(!t.isNullOrUndefined(i.index)){var n=i.index.indexOf(";"),r="0";n>=0&&(r=i.index.substring(0,n),i.index=i.index.substring(n).replace(";","")),n=parseInt(r,10),e instanceof ye&&n>=e.childWidgets.length&&(i.index="0;0",n=e.childWidgets.length-1);var o=this.getBlockByIndex(e,n);if(o){if("S"===(r=i.index.substring(0,1))){i.index=i.index.substring(1).replace(";","");var s=i.index.substring(0,1);i.index=i.index.substring(1).replace(";","");var a=i.index.substring(0,1);i.index=i.index.substring(1).replace(";",""),o=o.floatingElements[s].textFrame.childWidgets[a]}var l=o;if(l instanceof fe)return i.index.indexOf(";")>0&&(i.index="0"),l;if(l instanceof he){if(i.index.indexOf(";")>0)return this.getParagraphInternal(l,i);if(l instanceof ve)return this.documentHelper.selection.getFirstParagraphInFirstCell(l);return}}else if(e){var d=e.getSplitWidgets().pop().nextRenderedWidget;if(d instanceof he)return i.index="0",d instanceof ve?this.documentHelper.selection.getFirstParagraphInFirstCell(d):d}}},e.prototype.getBlockByIndex=function(e,t){var i;if(e){if(e instanceof pe&&1===e.childWidgets.length)return e.childWidgets[0];for(var n=0;n<e.childWidgets.length;n++)if(e.childWidgets[n].index===t){i=e.childWidgets[n];break}if(!(i||e instanceof ue))return this.getBlockByIndex(e.nextSplitWidget,t)}return i},e.prototype.getParagraphInfo=function(e){return this.getParagraphInfoInternal(e.currentWidget,e.offset)},e.prototype.getParagraphInfoInternal=function(e,t){for(var i=e.paragraph,n=this.getParagraphLength(i,e)+t,r=i.previousSplitWidget;r instanceof fe;)i=r,n+=this.documentHelper.selection.getParagraphLength(i),r=i.previousSplitWidget;return{paragraph:i,offset:n}},e.prototype.getListTextElementBox=function(e){if(!t.isNullOrUndefined(e)){var i;if(!e.isEmpty()){var n=e.childWidgets[0];n.children.length>1&&n.children[0]instanceof Ke&&(i=n.children[0])}return i}},e.prototype.getListLevel=function(e){var i=void 0,n=0;if(t.isNullOrUndefined(e.paragraphFormat)||t.isNullOrUndefined(e.paragraphFormat.listFormat)||(i=this.documentHelper.getListById(e.paragraphFormat.listFormat.listId),n=e.paragraphFormat.listFormat.listLevelNumber),!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(this.documentHelper.getAbstractListById(i.abstractListId))&&!t.isNullOrUndefined(this.documentHelper.getAbstractListById(i.abstractListId).levels))return this.documentHelper.layout.getListLevel(i,n)},e.prototype.getTextInline=function(e,i,n,r,o){var s="";do{if(e===n){if(e instanceof Ie){var a=e;t.isNullOrUndefined(a.text)||""===a.text||(a.text.length<r?s+=a.text:s+=a.text.substring(0,r))}else e instanceof Ge&&o&&r===e.length&&(s+=Ce.objectCharacter);return s}if(e instanceof Ie?s+=e.text:e instanceof Ge&&o?s+=Ce.objectCharacter:e instanceof xe&&!t.isNullOrUndefined(e.fieldEnd)&&(e=t.isNullOrUndefined(e.fieldSeparator)?e.fieldEnd:e.fieldSeparator),t.isNullOrUndefined(e.nextNode))break;e=e.nextNode}while(!t.isNullOrUndefined(e));if(i===e.line.paragraph)return s;for(var l=this.documentHelper.selection.getNextParagraphBlock(e.line.paragraph);!t.isNullOrUndefined(l)&&l.isEmpty();){if(s+="\r",l===i)return s;l=this.documentHelper.selection.getNextParagraphBlock(l)}if(!t.isNullOrUndefined(l)&&!l.isEmpty()){var d=l.childWidgets[0];s=s+"\r"+this.getTextInline(d.children[0],i,n,r,o)}return s},e.prototype.getFieldCode=function(e){var t="";if(!(e.fieldEnd instanceof xe))return t;var i=e.paragraph,n=e.fieldEnd.paragraph;e.fieldSeparator instanceof xe&&(n=e.fieldSeparator.paragraph);var r=e.line.indexInOwner,o=e.indexInOwner;do{if(t+=this.getFieldCodeInternal(i,r,o),i===n)break;i=this.getNextParagraphBlock(i),r=0,o=0}while(i instanceof fe);return t.trim()},e.prototype.getFieldCodeInternal=function(e,t,i){for(var n="",r=t;r<e.childWidgets.length;r++){for(var o=e.childWidgets[r],s=i;s<o.children.length;s++){var a=o.children[s];if(a instanceof Ie&&(n+=a.text),a instanceof xe&&(2===a.fieldType||1===a.fieldType))return n}i=0}return n},e.prototype.getTocFieldInternal=function(){var e=this.start.paragraph;for(this.isEmpty||this.isForward||(e=this.end.paragraph);e instanceof fe&&e.childWidgets.length>0;){var t=e.firstChild;if(t.children.length>0){var i=t.children[0],n=i.nextNode;if(i instanceof xe&&0===i.fieldType&&n instanceof Ie&&0===n.text.trim().toLowerCase().indexOf("toc"))return i}e=e.previousRenderedWidget}},e.prototype.getNextParagraph=function(e){if(e.nextRenderedWidget instanceof pe){var t=e.nextRenderedWidget.childWidgets[0];return this.getFirstParagraphBlock(t)}},e.prototype.getPreviousParagraph=function(e){if(e.previousRenderedWidget instanceof pe){var t=e.previousRenderedWidget,i=t.childWidgets[t.childWidgets.length-1];return this.getLastParagraphBlock(i)}},e.prototype.getFirstParagraphInCell=function(e){var t=e.childWidgets[0];return t instanceof fe?t:this.getFirstParagraphInFirstCell(t)},e.prototype.getFirstParagraphInFirstCell=function(e){if(e.childWidgets.length>0){var t=e.childWidgets[0].childWidgets[0].childWidgets[0];return this.getFirstParagraphBlock(t)}},e.prototype.getLastParagraphInLastCell=function(e){if(e.childWidgets.length>0){var t=e.lastChild.lastChild.lastChild;return this.getLastParagraphBlock(t)}},e.prototype.getLastParagraphInFirstRow=function(e){if(e.childWidgets.length>0){var t=e.firstChild.lastChild.lastChild;return this.getLastParagraphBlock(t)}},e.prototype.getNextStartInline=function(e,i){var n=0,r=e.getInline(i,n),o=r.element;if(n=r.index,!t.isNullOrUndefined(o)&&n===o.length&&o.nextNode instanceof xe||o instanceof Ve){var s=this.getNextValidElement(o.nextNode);s instanceof xe&&0===s.fieldType&&(o=s)}return o},e.prototype.getPreviousTextInline=function(e){return e.previousNode instanceof Ie?e.previousNode:e.previousNode instanceof xe&&W.isLinkedFieldCharacter(e.previousNode)?0===e.previousNode.fieldType||1===e.previousNode.fieldType?e.previousNode:e.previousNode.fieldBegin:t.isNullOrUndefined(e.previousNode)?void 0:this.getPreviousTextInline(e.previousNode)},e.prototype.getNextTextInline=function(e){return e.nextNode instanceof Ie?e.nextNode:e.nextNode instanceof xe&&W.isLinkedFieldCharacter(e.nextNode)?1===e.nextNode.fieldType||0===e.nextNode.fieldType?e.nextNode:e.nextNode.fieldEnd:t.isNullOrUndefined(e.nextNode)?void 0:this.getNextTextInline(e.nextNode)},e.prototype.getContainerTable=function(e){if(e.isInsideTable&&(e=e.associatedCell.ownerTable.isInsideTable?this.getContainerTable(e.associatedCell.ownerTable):e.associatedCell.ownerTable),e instanceof ve)return e},e.prototype.isExistBefore=function(e,t){if(e.isInsideTable){var i=e.associatedCell;if(t.isInsideTable){var n=t.associatedCell;if(i===n)return i.childWidgets.indexOf(e)<i.childWidgets.indexOf(t);if(i.ownerRow===n.ownerRow)return i.cellIndex<n.cellIndex;if(i.ownerTable===n.ownerTable)return i.ownerRow.rowIndex<n.ownerRow.rowIndex;var r=this.getContainerCellOf(i,n);return r.ownerTable.contains(n)?(i=this.getSelectedCell(i,r),n=this.getSelectedCell(n,r),i===r?this.isExistBefore(e,n.ownerTable):n===r?this.isExistBefore(i.ownerTable,t):r.ownerRow===n.ownerRow?r.cellIndex<n.cellIndex:r.ownerTable===n.ownerTable?r.ownerRow.rowIndex<n.ownerRow.rowIndex:this.isExistBefore(i.ownerTable,n.ownerTable)):this.isExistBefore(r.ownerTable,this.getContainerTable(n.ownerTable))}o=this.getContainerTable(e);return this.isExistBefore(o,t)}if(t.isInsideTable){var o=this.getContainerTable(t);return this.isExistBefore(e,o)}return e.containerWidget===t.containerWidget?e.index<t.index:(e.containerWidget instanceof pe&&t.containerWidget instanceof pe||e.containerWidget instanceof me&&t.containerWidget instanceof me)&&this.documentHelper.pages.indexOf(e.containerWidget.page)<this.documentHelper.pages.indexOf(t.containerWidget.page)},e.prototype.isExistAfter=function(e,t){if(e.isInsideTable){var i=e.associatedCell;if(t.isInsideTable){var n=t.associatedCell;if(i===n)return i.childWidgets.indexOf(e)>i.childWidgets.indexOf(t);if(i.ownerRow===n.ownerRow)return i.cellIndex>n.cellIndex;if(i.ownerTable===n.ownerTable)return i.ownerRow.rowIndex>n.ownerRow.rowIndex;var r=this.getContainerCellOf(i,n);return r.ownerTable.contains(n)?(i=this.getSelectedCell(i,r),n=this.getSelectedCell(n,r),i===r?this.isExistAfter(e,n.ownerTable):n===r?this.isExistAfter(i.ownerTable,t):r.ownerRow===n.ownerRow?r.cellIndex>n.cellIndex:r.ownerTable===n.ownerTable?r.ownerRow.rowIndex>n.ownerRow.rowIndex:this.isExistAfter(i.ownerTable,n.ownerTable)):this.isExistAfter(r.ownerTable,this.getContainerTable(n.ownerTable))}o=this.getContainerTable(e);return this.isExistAfter(o,t)}if(t.isInsideTable){var o=this.getContainerTable(t);return this.isExistAfter(e,o)}return e.containerWidget===t.containerWidget?e.index>t.index:(e.containerWidget instanceof pe&&t.containerWidget instanceof pe||e.containerWidget instanceof me&&t.containerWidget instanceof me)&&this.documentHelper.pages.indexOf(e.containerWidget.page)>this.documentHelper.pages.indexOf(t.containerWidget.page)},e.prototype.isExistBeforeInline=function(e,t){if(e.line===t.line)return e.line.children.indexOf(e)<=t.line.children.indexOf(t);if(e.line.paragraph===t.line.paragraph)return e.line.paragraph.childWidgets.indexOf(e.line)<t.line.paragraph.childWidgets.indexOf(t.line);var i=e.line.paragraph,n=t.line.paragraph;if(i.containerWidget===n.containerWidget){if(i.isInsideTable)return i.associatedCell.childWidgets.indexOf(i)<n.associatedCell.childWidgets.indexOf(n);if(!(i.containerWidget instanceof ue))return i.containerWidget.childWidgets.indexOf(i)<n.containerWidget.childWidgets.indexOf(n)}return this.isExistBefore(i,n)},e.prototype.isExistAfterInline=function(e,t,i){if(e.line===t.line)return i?e.line.children.indexOf(e)>=t.line.children.indexOf(t):e.line.children.indexOf(e)>t.line.children.indexOf(t);if(e.line.paragraph===t.line.paragraph)return e.line.paragraph.childWidgets.indexOf(e.line)>t.line.paragraph.childWidgets.indexOf(t.line);var n=e.line.paragraph,r=t.line.paragraph;if(n.containerWidget===r.containerWidget){if(n.isInsideTable)return n.associatedCell.childWidgets.indexOf(n)>r.associatedCell.childWidgets.indexOf(r);if(!(n.containerWidget instanceof ue))return n.containerWidget.childWidgets.indexOf(n)>r.containerWidget.childWidgets.indexOf(r)}return this.isExistAfter(n,r)},e.prototype.getNextRenderedBlock=function(e){return t.isNullOrUndefined(e.nextWidget)?e.nextRenderedWidget:e.nextWidget},e.prototype.getPreviousRenderedBlock=function(e){return t.isNullOrUndefined(e.previousWidget)?e.previousRenderedWidget:e.previousWidget},e.prototype.getNextParagraphBlock=function(e){if(e.nextRenderedWidget instanceof fe)return e.nextRenderedWidget;if(e.nextRenderedWidget instanceof ve)return this.getFirstParagraphInFirstCell(e.nextRenderedWidget);if(e.containerWidget instanceof be)return this.getNextParagraphCell(e.containerWidget);if(e.containerWidget instanceof pe){e.containerWidget;return this.getNextParagraph(e.containerWidget)}return e.containerWidget instanceof ue&&this.isMoveDownOrMoveUp?this.getFirstBlockInNextHeaderFooter(e):void 0},e.prototype.getFirstBlockInNextHeaderFooter=function(e){var t,i=e.containerWidget;if(-1!==i.headerFooterType.indexOf("Header"))t=i.page.footerWidget.firstChild;else{if(!i.page.nextPage)return;t=i.page.nextPage.headerWidget.firstChild}return t instanceof fe?t:this.getFirstBlockInFirstCell(t)},e.prototype.getLastBlockInPreviousHeaderFooter=function(e){var t,i=e.containerWidget;if(-1!==i.headerFooterType.indexOf("Footer"))t=i.page.headerWidget.lastChild;else{if(!i.page.previousPage)return;t=i.page.previousPage.footerWidget.lastChild}return t instanceof fe?t:this.getFirstBlockInFirstCell(t)},e.prototype.getPreviousParagraphBlock=function(e){return e.previousRenderedWidget instanceof fe?e.previousRenderedWidget:e.previousRenderedWidget instanceof ve?this.getLastParagraphInLastCell(e.previousRenderedWidget):e.containerWidget instanceof be?this.getPreviousParagraphCell(e.containerWidget):e.containerWidget instanceof pe?this.getPreviousParagraph(e.containerWidget):e.containerWidget instanceof ue&&this.isMoveDownOrMoveUp?this.getLastBlockInPreviousHeaderFooter(e):void 0},e.prototype.getFirstParagraphBlock=function(e){return e instanceof fe?e:e instanceof ve?this.getFirstParagraphInFirstCell(e):void 0},e.prototype.getLastParagraphBlock=function(e){return e instanceof fe?e:e instanceof ve?this.getLastParagraphInLastCell(e):void 0},e.prototype.hasValidInline=function(e,t,i){for(var n=e.childWidgets.indexOf(t.line);n<e.childWidgets.length;n++)for(var r=0;r<e.childWidgets[n].children.length;r++){var o=e.childWidgets[n].children[r];if(0!==o.length){if(o===i)return!1;if(o instanceof Ie||o instanceof Ge||o instanceof xe&&W.isLinkedFieldCharacter(o))return!0}}return!1},e.prototype.getParagraphLength=function(e,t,i){for(var n=0,r=0;r<e.childWidgets.length;r++){var o=e.childWidgets[r];if(t instanceof we&&t===o){i&&(n+=this.getLineLength(o,i));break}n+=this.getLineLength(o)}return n},e.prototype.getLineLength=function(e,t){for(var i=0,n=e.paragraph.bidi,r=n?e.children.length-1:0;n?r>-1:r<e.children.length;n?r--:r++){var o=e.children[r];if(!(o instanceof Ke)){if(t&&t.element instanceof Ce&&t.element===o){i+=t.index;break}i+=o.length}}return i},e.prototype.getLineInfo=function(e,t){for(var i=void 0,n=0,r=e.childWidgets.length,o=0;o<r&&(i=e.childWidgets[o],n=this.getLineLength(i),!(t<=n||o===r-1));o++)t-=n;return{line:i,offset:t}},e.prototype.getElementInfo=function(e,i){for(var n=void 0,r=0;r<e.children.length;r++)if(!((n=e.children[r])instanceof Ke)){if(!(i>n.length)||i===n.length+1&&t.isNullOrUndefined(n.nextNode))break;i-=n.length}return{element:n,index:i}},e.prototype.getStartOffset=function(e){if(e.childWidgets.length>0){var t=e.childWidgets[0];return this.getStartLineOffset(t)}return 0},e.prototype.getStartLineOffset=function(e){for(var t=0,i=0;i<e.children.length;i++){var n=e.children[i];if(0!==n.length){if(n instanceof Ie||n instanceof Ge||n instanceof ke||n instanceof Ve||n instanceof Ye||n instanceof Xe||n instanceof pt||n instanceof xe&&W.isLinkedFieldCharacter(n)||n instanceof Le)return t;n instanceof Ke||(t+=n.length)}}return t},e.prototype.getPreviousSelectionCell=function(e){if(!t.isNullOrUndefined(e.previousRenderedWidget)){if(this.isForward){var i=e.previousRenderedWidget.childWidgets,n=i[i.length-1];return n instanceof fe?n:this.getPreviousParagraphSelection(n.childWidgets[n.childWidgets.length-1])}return(n=e.previousRenderedWidget.childWidgets[0])instanceof fe?n:this.getFirstParagraphInLastRow(n)}return this.getPreviousSelectionRow(e.ownerRow)},e.prototype.getPreviousSelectionRow=function(e){if(!t.isNullOrUndefined(e.previousRenderedWidget)){if(this.isForward)return this.getPreviousParagraphSelection(e.previousRenderedWidget);var i=e.previousRenderedWidget.childWidgets[0].childWidgets[0];return this.getFirstParagraphBlock(i)}return this.getPreviousSelectionBlock(e.ownerTable)},e.prototype.getNextSelectionBlock=function(e){return e.nextRenderedWidget instanceof fe?e.nextRenderedWidget:e.nextRenderedWidget instanceof ve?this.isEmpty||this.isForward?this.getLastParagraphInFirstRow(e.nextRenderedWidget):this.getNextParagraphSelection(e.nextRenderedWidget.childWidgets[0]):e.containerWidget instanceof be?this.getNextSelectionCell(e.containerWidget):e.containerWidget instanceof pe?this.getNextSelection(e.containerWidget):void 0},e.prototype.getNextSelectionCell=function(e){if(!t.isNullOrUndefined(e.nextRenderedWidget)){if(this.isEmpty||this.isForward){var i=e.nextRenderedWidget.childWidgets[e.nextRenderedWidget.childWidgets.length-1];return this.getLastParagraphBlock(i)}return(i=e.nextRenderedWidget.childWidgets[0])instanceof fe?i:this.getNextParagraphSelection(i.childWidgets[0])}return this.getNextSelectionRow(e.ownerRow)},e.prototype.getNextSelectionRow=function(e){if(!t.isNullOrUndefined(e.nextRenderedWidget)){if(this.isEmpty||this.isForward){var i=e.nextRenderedWidget.childWidgets[e.nextRenderedWidget.childWidgets.length-1],n=i.childWidgets[i.childWidgets.length-1];return this.getLastParagraphBlock(n)}return this.getNextParagraphSelection(e.nextRenderedWidget)}return this.getNextSelectionBlock(e.ownerTable)},e.prototype.getNextSelection=function(e){if(e.nextRenderedWidget instanceof pe){var t=e.nextRenderedWidget.childWidgets[0];return t instanceof fe?t:this.isEmpty||this.isForward?this.getLastParagraphInFirstRow(t):this.getNextParagraphSelection(t.childWidgets[0])}},e.prototype.getNextParagraphSelection=function(e){var t=e.childWidgets[0];if(this.start.paragraph.isInsideTable&&e.ownerTable.contains(this.start.paragraph.associatedCell)){var i=this.getCellInTable(e.ownerTable,this.start.paragraph.associatedCell);t=this.getFirstCellInRegion(e,i,this.upDownSelectionLength,!1)}var n=t.childWidgets[0];return this.getFirstParagraphBlock(n)},e.prototype.getPreviousSelectionBlock=function(e){return e.previousRenderedWidget instanceof fe?e.previousRenderedWidget:e.previousRenderedWidget instanceof ve?this.isForward?this.getPreviousParagraphSelection(e.previousRenderedWidget.childWidgets[e.previousRenderedWidget.childWidgets.length-1]):this.getFirstParagraphInLastRow(e.previousRenderedWidget):e.containerWidget instanceof be?this.getPreviousSelectionCell(e.containerWidget):e.containerWidget instanceof pe?this.getPreviousSelection(e.containerWidget):void 0},e.prototype.getPreviousSelection=function(e){if(e.previousRenderedWidget instanceof pe){var t=e.previousRenderedWidget,i=t.childWidgets[t.childWidgets.length-1];if(i instanceof fe)return i;if(this.isForward){var n=i;return this.getPreviousParagraphSelection(n.childWidgets[n.childWidgets.length-1])}return this.getFirstParagraphInLastRow(i)}},e.prototype.getPreviousParagraphSelection=function(e){var t=e.childWidgets[e.childWidgets.length-1];if(this.start.paragraph.isInsideTable&&e.ownerTable.contains(this.start.paragraph.associatedCell)){var i=this.getCellInTable(e.ownerTable,this.start.paragraph.associatedCell);t=this.getLastCellInRegion(e,i,this.upDownSelectionLength,!0)}var n=t.childWidgets[t.childWidgets.length-1];return this.getLastParagraphBlock(n)},e.prototype.getLastCellInRegion=function(e,i,n,r){var o=this.getCellLeft(e,i),s=o+i.cellFormat.cellWidth,a=!0;if(o<=n&&n<s)for(d=e.childWidgets.length-1;d>=0;d--){var l=this.getCellLeft(e,e.childWidgets[d]);if(W.round(o,2)<=W.round(l,2)&&W.round(l,2)<W.round(s,2))return a=!1,e.childWidgets[d]}else for(var d=e.childWidgets.length-1;d>=0;d--)if((l=this.getCellLeft(e,e.childWidgets[d]))<=n&&l+e.childWidgets[d].cellFormat.cellWidth>n)return a=!1,e.childWidgets[d];if(a){if(!t.isNullOrUndefined(e.previousRenderedWidget)&&r)return this.getLastCellInRegion(e.previousRenderedWidget,i,n,r);if(!t.isNullOrUndefined(e.nextRenderedWidget)&&!r)return this.getLastCellInRegion(e.nextRenderedWidget,i,n,r)}return e.childWidgets[e.childWidgets.length-1]},e.prototype.getCellInTable=function(e,t){for(;t.ownerTable.isInsideTable;){if(e.equals(t.ownerTable))return t;t=t.ownerTable.associatedCell}return t},e.prototype.getFirstParagraphInLastRow=function(e){if(e.childWidgets.length>0){var t=e.childWidgets[e.childWidgets.length-1].childWidgets[0].childWidgets[0];return this.getFirstParagraphBlock(t)}},e.prototype.getPreviousValidOffset=function(e,t){if(0===t)return 0;for(var i=0,n=0,r=0,o=e.paragraphFormat.bidi,s=0;s<e.childWidgets.length;s++){var a=e.childWidgets[s];if(o){if((r=a.getInlineForOffset(t,!1,void 0,!1,!0,!1).index)>=0)return r}else for(var l=0;l<a.children.length;l++){var d=a.children[l];if(!(0===d.length||d instanceof Ke)){if(t<=n+d.length)return t-1===n?i:t-1;(d instanceof Ie||d instanceof Ge||d instanceof ke||d instanceof xe&&W.isLinkedFieldCharacter(d))&&(i=n+d.length),n+=d.length}}}return t-1===n?i:t-1},e.prototype.getNextValidOffset=function(e,t){var i=0;if(e.paragraph.paragraphFormat.bidi)t!==this.getLineLength(e)&&(t=e.getInlineForOffset(t,!1,void 0,!1,!1,!0).index);else for(var n=0;n<e.children.length;n++){var r=e.children[n];if(!(0===r.length||r instanceof Ke)){if(t<i+r.length&&(r instanceof Ie||r instanceof Ge||r instanceof xe&&W.isLinkedFieldCharacter(r)))return(t>i?t:i)+1;if(t===i+r.length&&r instanceof xe&&1===r.fieldType&&r.previousNode instanceof Ge)return t;i+=r.length}}return t},e.prototype.getParagraphMarkSize=function(e,t,i){var n=this.documentHelper.textHelper.getParagraphMarkSize(e.characterFormat),r=n.BaselineOffset,o=n.Height,s=r;if(e instanceof fe){if(e.childWidgets.length>0)e.childWidgets[0];var a=this.documentHelper.layout.getLineSpacing(e,o),l=this.documentHelper.layout.getBeforeSpacing(e);t=s-r,i=o-s-(n.Height-r);var d=e.paragraphFormat.lineSpacingType;"Multiple"===d?a>o?i+=a-o:t+=a-o:"Exactly"===d?t+=a-(t+n.Height+i):a>t+n.Height+i&&(t+=a-(t+n.Height+i)),t+=l,i+=this.documentHelper.layout.getAfterSpacing(e)}return{width:n.Width,height:n.Height,topMargin:t,bottomMargin:i}},e.prototype.getPhysicalPositionInternal=function(e,t,i){if(e.paragraph.isEmpty()){var n=e.paragraph,r=n.x;if(n.childWidgets.length>0){var o=n.childWidgets[0];r=this.getLeft(o)}var s=this.getParagraphMarkSize(e.paragraph,0,0);return t>0&&(r+=s.width),new O(r,n.y+0)}var a=0,l=e.getInline(t,a,e.paragraph.bidi),d=l.element;return a=l.index,this.getPhysicalPositionInline(d,a,i)},e.prototype.highlightSelectedContent=function(e,i){if(!e.paragraph.isInsideTable||i.paragraph.isInsideTable&&e.paragraph.associatedCell.equals(i.paragraph.associatedCell)&&!this.isCellSelected(e.paragraph.associatedCell,e,i)){var n=void 0,r=0;if(!this.owner.isReadOnlyMode&&e.paragraph===i.paragraph)if(e.offset+1===i.offset){var o=i.currentWidget.getInline(i.offset,r);n=o.element,r=o.index,(n instanceof Ge||n instanceof Ve)&&e.currentWidget.getOffset(n,0)!==e.offset&&(n=void 0)}else{var s=0,a=e.currentWidget.getInline(e.offset,s),l=a.element;(s=a.index)===l.length&&(l=this.getNextRenderedElementBox(l,s));var d=i.currentWidget.getInline(i.offset,s),h=d.element;if(s=d.index,l instanceof xe&&h instanceof xe&&!t.isNullOrUndefined(l.fieldSeparator)){var c=l.fieldSeparator.nextNode;c instanceof Ge&&c.nextNode===h&&(n=c)}}if(!this.owner.isReadOnlyMode&&this.owner.isDocumentLoaded&&(n instanceof Ge||n instanceof Ve)){var p=this.getElementBoxInternal(n,r),u=p.element;r=p.index,this.owner.enableImageResizerMode&&(this.owner.imageResizerModule.positionImageResizer(u),this.owner.imageResizerModule.showImageResizer()),this.documentHelper.isTouchInput&&(this.documentHelper.touchStart.style.display="none",this.documentHelper.touchEnd.style.display="none")}else this.highlight(e.paragraph,e,i),this.isHighlightNext&&(this.highlightNextBlock(this.hightLightNextParagraph,e,i),this.isHighlightNext=!1,this.hightLightNextParagraph=void 0);this.isInShape&&this.showResizerForShape()}else this.highlightCell(e.paragraph.associatedCell,this,e,i)},e.prototype.showResizerForShape=function(){var e=this.getCurrentTextFrame().containerShape;this.owner.imageResizerModule.positionImageResizer(e),this.owner.imageResizerModule.showImageResizer()},e.prototype.highlight=function(e,i,n){var r=0,o=0,s=void 0,a=void 0,l=void 0,d=void 0,h=this.getStartLineWidget(e,i,s,r);s=h.element,l=t.isNullOrUndefined(s)?e.childWidgets[0]:s.line,r=h.index;var c=this.getEndLineWidget(n,a,o);d=(a=c.element)?a.line:n.paragraph.childWidgets[n.paragraph.childWidgets.length-1],o=c.index;var p=0,u=0;if(t.isNullOrUndefined(l)||(p=this.getTop(l),u=this.getLeftInternal(l,s,r)),t.isNullOrUndefined(l)||l!==d){if(!t.isNullOrUndefined(l)){l.paragraph.x;e!==l.paragraph&&(e=l.paragraph);x=this.getWidth(l,!0)-(u-l.paragraph.x);if(e.bidi||s instanceof Ie&&s.isRightToLeft){var g=0,m=this.getElementsForward(l,s,a,e.bidi);if(m){for(var f=!1,v=0;v<m.length;v++){var y=m[v];f=!1,u=y===s?this.getLeftInternal(l,y,r):this.getLeftInternal(l,y,0);T=y instanceof Ie?y.length:1;g=this.getLeftInternal(l,y,T),y instanceof Ie&&(f=y.isRightToLeft),x=Math.abs(g-u),this.createHighlightBorder(l,x,f?g:u,p,!0)}if(l.isLastLine()){var b=m[m.length-1].line.paragraph.characterFormat,w=this.documentHelper.textHelper.getParagraphMarkSize(b).Width;u=e.bidi?this.getLineStartLeft(l)-w:f?l.paragraph.x+this.getWidth(l,!1):g,this.createHighlightBorder(l,w,u,p,!0)}}else this.createHighlightBorder(l,x,u,p,!1)}else this.createHighlightBorder(l,x,u,p,!1);var C=l.paragraph.childWidgets.indexOf(l);if(this.highlightParagraph(e,C+1,d,a,o),-1!==e.childWidgets.indexOf(n.currentWidget))return}if(this.isHideSelection(e))return void(this.isHighlightNext=!1);this.isHighlightNext=!0,this.hightLightNextParagraph=e}else{var g=this.getLeftInternal(d,a,o),x=0,F=!1;if(a instanceof Ie&&(F=a.isRightToLeft),!F&&s instanceof Ie&&(F=s.isRightToLeft),x=Math.abs(g-u),F||e.bidi){var P=this.getElementsForward(l,s,a,e.bidi);if(P&&P.length>1)for(v=0;v<P.length;v++){var f=!1,T=(y=P[v])instanceof Ie?y.length:1;if(y===s?(u=this.getLeftInternal(l,y,r),g=this.getLeftInternal(l,y,T)):y===a?(u=this.getLeftInternal(l,y,0),g=this.getLeftInternal(l,y,o)):(u=this.getLeftInternal(l,y,0),g=this.getLeftInternal(l,y,T)),y instanceof Ie&&(f=y.isRightToLeft),x=Math.abs(g-u),y===a&&y instanceof Ie&&o>y.length){var b=y.line.paragraph.characterFormat,w=this.documentHelper.textHelper.getParagraphMarkSize(b).Width;if(e.bidi&&!f){x-=w,this.createHighlightBorder(l,x,u,p,!0),u=this.getLineStartLeft(l)-w,this.createHighlightBorder(l,w,u,p,!0);continue}}this.createHighlightBorder(l,x,f?g:u,p,!0)}else if(a instanceof Ie&&o>a.length){var b=a.line.paragraph.characterFormat,w=this.documentHelper.textHelper.getParagraphMarkSize(b).Width;!e.bidi&&F?(g+=w,x-=w,this.createHighlightBorder(l,x,g,p,!0),g+=a.width,this.createHighlightBorder(l,w,g,p,!0)):e.bidi&&!F?(x-=w,this.createHighlightBorder(l,x,u,p,!0),u=this.getLineStartLeft(l)-w,this.createHighlightBorder(l,w,u,p,!0)):this.createHighlightBorder(l,x,F?g:u,p,!1)}else this.createHighlightBorder(l,x,F?g:u,p,!1)}else this.createHighlightBorder(l,x,e.bidi?g:u,p,!1)}},e.prototype.highlightNextBlock=function(e,i,n){var r=e.nextRenderedWidget;t.isNullOrUndefined(r)||(r instanceof fe?(this.isHighlightNext=!1,this.highlight(r,i,n),this.isHighlightNext&&(this.highlightNextBlock(this.hightLightNextParagraph,i,n),this.isHighlightNext=!1,this.hightLightNextParagraph=void 0)):this.highlightTable(r,i,n))},e.prototype.getStartLineWidget=function(e,t,i,n){var r=e===t.paragraph?t.offset:this.getStartOffset(e),o=void 0;if(o=e===t.paragraph?t.currentWidget.getInline(r,n):e.firstChild.getInline(r,n),i=o.element,n=o.index,i instanceof xe){var s=this.getRenderedInline(i,n);i=s.element,n=s.index}return r===this.getParagraphLength(t.paragraph)+1&&n++,{index:n,element:i}},e.prototype.getEndLineWidget=function(e,t,i){var n=e.currentWidget.getInline(e.offset,i);if(t=n.element,i=n.index,t instanceof xe){var r=this.getRenderedInline(t,i);t=r.element,i=r.index}return e.paragraph.childWidgets.indexOf(e.currentWidget)===e.paragraph.childWidgets.length-1&&e.offset===this.getLineLength(e.currentWidget)+1&&(i=t?t.length+1:1),{index:i,element:t}},e.prototype.getLineWidgetInternal=function(e,t,i){var n=void 0;if(0===e.children.length&&e instanceof we)n=e;else{var r=0,o=e.getInline(t,r),s=o.element;r=o.index,n=s instanceof Ce?s.line:this.getLineWidgetInternalInline(s,r,i)}return n},e.prototype.getLineWidgetParagraph=function(e,t){var i=void 0;if(0===t.children.length)i=t;else{var n=0,r=t.getInline(e,n),o=r.element;n=r.index,i=this.getLineWidget(o,n)}return i},e.prototype.highlightCells=function(e,t,i){var n=this.getCellLeft(t.ownerRow,t),r=n+t.cellFormat.cellWidth,o=this.getCellLeft(i.ownerRow,i),s=o+i.cellFormat.cellWidth;n>o&&(n=o),r<s&&(r=s),n>this.upDownSelectionLength&&(n=this.upDownSelectionLength),r<this.upDownSelectionLength&&(r=this.upDownSelectionLength);var a=e.getSplitWidgets(),l=a.indexOf(t.ownerRow.ownerTable),d=a.indexOf(i.ownerRow.ownerTable);if(l===d)for(var h=e.childWidgets.indexOf(i.ownerRow),c=e.childWidgets.indexOf(t.ownerRow);c<=h;c++)this.highlightRow(e.childWidgets[c],n,r);else for(var p=0,u=0,c=l;c<=d;c++){e=a[c],p=c===l?e.childWidgets.indexOf(t.ownerRow):0,u=c===d?e.childWidgets.indexOf(i.ownerRow):e.childWidgets.length-1;for(var g=p;g<=u;g++)this.highlightRow(e.childWidgets[g],n,r)}},e.prototype.highlightTable=function(e,t,i){this.highlightInternal(e.childWidgets[0],t,i),i.paragraph.isInsideTable&&e.contains(i.paragraph.associatedCell)||this.highlightNextBlock(e,t,i)},e.prototype.getCellLeft=function(e,t){var i=0;return i+=t.x-t.margin.left},e.prototype.getNextParagraphRow=function(e){if(!t.isNullOrUndefined(e.nextRenderedWidget)){var i=e.nextRenderedWidget.childWidgets[0].childWidgets[0];return this.getFirstParagraphBlock(i)}return this.getNextParagraphBlock(e.ownerTable)},e.prototype.getPreviousParagraphRow=function(e){if(!t.isNullOrUndefined(e.previousRenderedWidget)){var i=e.previousRenderedWidget.lastChild,n=i.lastChild?i.lastChild:i.previousSplitWidget.lastChild;return this.getLastParagraphBlock(n)}return this.getPreviousParagraphBlock(e.ownerTable)},e.prototype.containsRow=function(e,t){if(-1!==e.childWidgets.indexOf(t))return!0;for(;t.ownerTable.isInsideTable;){if(-1!==e.childWidgets.indexOf(t))return!0;t=t.ownerTable.associatedCell}return-1!==e.childWidgets.indexOf(t)},e.prototype.highlightRow=function(e,t,i){for(var n=0;n<e.childWidgets.length;n++){var r=this.getCellLeft(e,e.childWidgets[n]);W.round(t,2)<=W.round(r,2)&&W.round(r,2)<W.round(i,2)&&this.highlightCellWidget(e.childWidgets[n])}},e.prototype.highlightInternal=function(e,t,i){for(var n=0;n<e.childWidgets.length;n++)this.highlightCellWidget(e.childWidgets[n]);i.paragraph.isInsideTable&&this.containsRow(e,i.paragraph.associatedCell)||e.nextRenderedWidget instanceof ye&&this.highlightInternal(e.nextRenderedWidget,t,i)},e.prototype.getLastParagraph=function(e){for(;e.nextSplitWidget&&e.nextSplitWidget.childWidgets.length>0;)e=e.nextSplitWidget;var t;return t=e.childWidgets.length>0?e.lastChild:e.previousSplitWidget.lastChild,this.getLastParagraphBlock(t)},e.prototype.containsCell=function(e,t){if(e.equals(t))return!0;for(;t.ownerTable.isInsideTable;){if(e.equals(t.ownerTable.associatedCell))return!0;t=t.ownerTable.associatedCell}return!1},e.prototype.isCellSelected=function(e,t,i){var n=this.getLastParagraph(e);return n===i.paragraph&&i.offset===this.getParagraphLength(n)+1||!this.containsCell(e,t.paragraph.associatedCell)||!this.containsCell(e,i.paragraph.associatedCell)},e.prototype.getContainerCellOf=function(e,t){for(;e.ownerTable.isInsideTable;){if(e.ownerTable.contains(t))return e;e=e.ownerTable.associatedCell}return e},e.prototype.getSelectedCell=function(e,t){if(e.ownerTable.equals(t.ownerTable))return e;for(;e.ownerTable.isInsideTable;){if(e.ownerTable.associatedCell.equals(t))return e;e=e.ownerTable.associatedCell}return e},e.prototype.getSelectedCells=function(){for(var e=[],t=0;t<this.selectedWidgets.keys.length;t++){var i=this.selectedWidgets.keys[t];i instanceof be&&e.push(i)}return e},e.prototype.getNextParagraphCell=function(e){if(e.nextRenderedWidget&&e.nextRenderedWidget instanceof be){var t=(e=e.nextRenderedWidget).firstChild;return t?this.getFirstParagraphBlock(t):this.getNextParagraphCell(e)}return this.getNextParagraphRow(e.containerWidget)},e.prototype.getPreviousParagraphCell=function(e){if(!t.isNullOrUndefined(e.previousRenderedWidget)&&e.previousRenderedWidget instanceof be){var i=(e=e.previousRenderedWidget).lastChild;return this.getLastParagraphBlock(i)}return this.getPreviousParagraphRow(e.ownerRow)},e.prototype.getContainerCell=function(e){for(;!t.isNullOrUndefined(e.ownerTable)&&e.ownerTable.isInsideTable;)e=e.ownerTable.associatedCell;return e},e.prototype.highlightCell=function(e,i,n,r){if(r.paragraph.isInsideTable){var o=this.getContainerCellOf(e,r.paragraph.associatedCell);if(o.ownerTable.contains(r.paragraph.associatedCell)){var s=this.getSelectedCell(e,o),a=this.getSelectedCell(r.paragraph.associatedCell,o);if(this.containsCell(o,r.paragraph.associatedCell))this.isCellSelected(o,n,r)?this.highlightCellWidget(o):s===o?(this.highlight(n.paragraph,n,r),this.isHighlightNext&&(this.highlightNextBlock(this.hightLightNextParagraph,n,r),this.isHighlightNext=!1,this.hightLightNextParagraph=void 0)):this.highlightContainer(s,n,r);else if(this.highlightCellWidget(o),o.ownerRow.equals(a.ownerRow))for(s=o;!t.isNullOrUndefined(s.nextRenderedWidget)&&(s=s.nextRenderedWidget,this.highlightCellWidget(s),s!==a););else this.highlightCells(o.ownerTable,o,a)}else this.highlightContainer(o,n,r)}else{var l=this.getContainerCell(e);this.highlightContainer(l,n,r)}},e.prototype.highlightContainer=function(e,t,i){this.highlightInternal(e.containerWidget,t,i),this.highlightNextBlock(e.ownerTable,t,i)},e.prototype.getPreviousValidElement=function(e){var i=void 0;if(this.documentHelper.isFormFillProtectedMode&&2===e.fieldType)return e;for(;e instanceof xe;)W.isLinkedFieldCharacter(e)&&(e instanceof xe&&0===e.fieldType?i=e:e instanceof xe&&1===e.fieldType?(i=e,t.isNullOrUndefined(e.fieldSeparator)&&(i=e=e.fieldBegin)):i=e=e.fieldBegin),e=e.previousNode;return t.isNullOrUndefined(i)?e:i},e.prototype.getNextValidElement=function(e){var i=void 0;if(e instanceof ke&&1===e.bookmarkType)return e;for(;e instanceof xe;){if(0===e.fieldType&&!t.isNullOrUndefined(e.fieldEnd))return t.isNullOrUndefined(i)?e:i;1!==e.fieldType||t.isNullOrUndefined(e.fieldBegin)||(i=e),e=e.nextNode}return t.isNullOrUndefined(i)?e:i},e.prototype.validateTextPosition=function(e,t){if(e.length===t&&(e.nextNode instanceof xe||!(e instanceof Ge)&&e.nextNode instanceof ke)){var i=this.getNextValidElement(e.nextNode);(i instanceof xe&&1===i.fieldType||i instanceof ke&&1===i.bookmarkType)&&(e=i,t=this.documentHelper.isFormFillProtectedMode?0:1)}else 0===t&&e.previousNode instanceof xe&&(t=(e=this.getPreviousValidElement(e.previousNode))instanceof xe?0:e.length,e instanceof xe&&1===e.fieldType&&t++);return{element:e,index:t}},e.prototype.getPhysicalPositionInline=function(e,i,n){var r=void 0;r=this.getElementBox(e,i,n).element;var o=void 0;if(t.isNullOrUndefined(r)||t.isNullOrUndefined(r.line)){if(!(e instanceof xe&&1===e.fieldType))return e instanceof xe||e instanceof ke?this.getFieldCharacterPosition(e):new O(0,0);r=e}var s=r.margin,a=0,l=0;if(r instanceof Ie&&"\v"===r.text&&t.isNullOrUndefined(e.nextNode)?(o=this.getNextLineWidget(r.line.paragraph,r),i=0):o=r.line,a=this.getTop(o),r instanceof Ge&&"Inline"===r.textWrappingStyle){var d=r.line.paragraph.characterFormat,h=this.getPreviousTextElement(e);if(t.isNullOrUndefined(h)){var c=this.getNextTextElement(e);t.isNullOrUndefined(c)||(d=c.characterFormat)}else d=h.characterFormat;var p=this.documentHelper.textHelper.getHeight(d);r.margin.top+r.height-p.BaselineOffset>0&&(a+=r.margin.top+r.height-p.BaselineOffset)}else r instanceof xe||(a+=s.top>0?s.top:0);return l=t.isNullOrUndefined(r)||t.isNullOrUndefined(o)?0:this.getLeftInternal(o,r,i),new O(l,a)},e.prototype.getFieldCharacterPosition=function(e){var i=this.getNextValidElementForField(e);if(t.isNullOrUndefined(i)){var n=e.line.paragraph;return this.getEndPosition(n)}return this.getPhysicalPositionInline(i,0,!0)},e.prototype.getNextValidElementForField=function(e){if(e instanceof xe&&0===e.fieldType&&W.isLinkedFieldCharacter(e)){var i=e;e=t.isNullOrUndefined(i.fieldSeparator)?i.fieldEnd:i.fieldSeparator}var n=void 0;return t.isNullOrUndefined(e.nextNode)||(n=this.getNextValidElement(e.nextNode)),n},e.prototype.getEndPosition=function(e){var i=e.x,n=e.y,r=void 0;e.childWidgets.length>0&&(r=e.childWidgets[e.childWidgets.length-1],i+=this.getWidth(r,!1)),t.isNullOrUndefined(r)||(n=this.getTop(r));var o=this.getParagraphMarkSize(e,0,0);return new O(i,n+o.topMargin)},e.prototype.getElementBox=function(e,t,i){var n=void 0;return e instanceof xe||e instanceof ke||(n=e),{element:n,index:t}},e.prototype.getPreviousTextElement=function(e){return e.previousNode instanceof Ie?e.previousNode:t.isNullOrUndefined(e.previousNode)?void 0:this.getPreviousTextElement(e.previousNode)},e.prototype.getNextTextElement=function(e){return e.nextNode instanceof Ie?e.nextNode:t.isNullOrUndefined(e.nextNode)?void 0:this.getNextTextElement(e.nextNode)},e.prototype.getNextRenderedElementBox=function(e,i){if(e instanceof xe){if(0===(r=e).fieldType&&(e=this.getRenderedField(r),r===e))return r;i=1}for(;!t.isNullOrUndefined(e)&&i===e.length&&e.nextNode instanceof xe;){var n=this.getNextValidElement(e.nextNode);if(n instanceof xe&&0===n.fieldType){var r=n;if(e=this.getRenderedField(r),!t.isNullOrUndefined(e)&&r===e)return r;i=1}else e=n}return e},e.prototype.getElementBoxInternal=function(e,t){var i=void 0;return i=e,{element:i,index:t}},e.prototype.getLineWidget=function(e,t){return this.getLineWidgetInternalInline(e,t,!0)},e.prototype.getLineWidgetInternalInline=function(e,i,n){var r=this.getElementBox(e,i,n),o=r.element;if(i=r.index,!t.isNullOrUndefined(o))return n&&o instanceof Ie&&"\v"===o.text&&1===i?this.getNextLineWidget(o.line.paragraph,o):o.line;var s=e,a=this.getNextValidElementForField(s);if(t.isNullOrUndefined(a)){var l=void 0,d=s.line.paragraph;return d.childWidgets.length>0&&(l=d.childWidgets[d.childWidgets.length-1]),l}return this.getLineWidget(a,0)},e.prototype.getNextLineWidget=function(e,t){var i=void 0,n=e;if(n.childWidgets.length>0){var r=n.childWidgets.indexOf(t.line);r===n.childWidgets.length-1?(n=e,r=-1):r>n.childWidgets.length-1?(n=this.getNextParagraphBlock(e),r=-1):r<0&&(r=(n=e).childWidgets.indexOf(t.line)),i=n.childWidgets[r+1]}return i},e.prototype.getCaretHeight=function(e,i,n,r,o,s){var a=this.getElementBox(e,i,!1).element,l=e;if(t.isNullOrUndefined(a))return l instanceof xe?this.getFieldCharacterHeight(l,n,r,o,s):{height:this.documentHelper.textHelper.getHeight(n).Height,topMargin:o,isItalic:s};var d=a.margin,h=a.height,c=0;if(a instanceof Ge){var p=this.getPreviousTextElement(e),u=this.getNextTextElement(e);if(t.isNullOrUndefined(p)&&t.isNullOrUndefined(u)){var g=0,m=0,f=e.line.paragraph,v=this.getParagraphMarkSize(f,g,m);g=v.topMargin,m=v.bottomMargin,c=v.height,s=f.characterFormat.italic,r||(c+=this.documentHelper.layout.getAfterSpacing(f))}else{if(t.isNullOrUndefined(p))return s=u.characterFormat.italic,this.getCaretHeight(u,0,u.characterFormat,r,o,s);if(t.isNullOrUndefined(u)||!(a instanceof Ge))return s=p.characterFormat.italic,this.getCaretHeight(p,p.length,p.characterFormat,r,o,s);var y=this.documentHelper.textHelper.getHeight(a.characterFormat),b=y.Height,w=y.BaselineOffset;c=a.margin.top<0&&w>a.margin.top+a.height?a.margin.top+a.height+b-w:b,r||(c+=a.margin.bottom)}}else{var C=n.baselineAlignment,x=h;"Normal"!==C&&r&&(x/=1.5,"Subscript"===C&&(o=h-x)),c=(d.top<0?d.top:0)+x,r||(c+=d.bottom)}if(!r)return{height:c,topMargin:o,isItalic:s};var F=this.documentHelper.textHelper.getHeight(n).Height;return F>c&&(F=c),{height:F,topMargin:o,isItalic:s}},e.prototype.getFieldCharacterHeight=function(e,i,n,r,o){var s=this.getNextValidElementForField(e);if(t.isNullOrUndefined(s)){var a=e.line.paragraph,l=this.documentHelper.textHelper.getParagraphMarkSize(i).Height,d=0,h=0,c=this.getParagraphMarkSize(a,d,h),p=c.height;return d=c.topMargin,h=c.bottomMargin,n?(l>p&&(l=p),{height:l,topMargin:r,isItalic:o}):(p+=h,{height:p,topMargin:r,isItalic:o})}return this.getCaretHeight(s,0,i,n,r,o)},e.prototype.getRenderedInline=function(e,i){for(var n=this.getPreviousValidElement(e);n instanceof xe;)(n=this.getPreviousTextElement(n))instanceof xe&&(n=n.previousNode);if(!t.isNullOrUndefined(n))return i=n.length,{element:n,index:i};i=0;var r=this.getNextRenderedElementBox(e,0);if(r instanceof xe&&0===r.fieldType)for(r=(r=r.fieldSeparator).nextNode;r instanceof xe;)r instanceof xe&&0===r.fieldType&&W.isLinkedFieldCharacter(r)&&(r=t.isNullOrUndefined(r.fieldSeparator)?r.fieldEnd:r.fieldSeparator),r=r.nextNode;return{element:r,index:i}},e.prototype.getRenderedField=function(e){var i=e;if(t.isNullOrUndefined(e.fieldSeparator))i=e.fieldEnd;else{var n=(i=e.fieldSeparator).line.paragraph;if(n!==e.fieldEnd.line.paragraph||this.hasValidInline(n,i,e.fieldEnd))return i;i=e.fieldEnd}return i},e.prototype.isLastRenderedInline=function(e,i){for(;i===e.length&&e.nextNode instanceof xe;){var n=this.getNextValidElement(e.nextNode);if(i=0,n instanceof xe&&0===n.fieldType&&(e=n),e instanceof xe&&0===e.fieldType&&!t.isNullOrUndefined(e.fieldEnd)){var r=e;if(t.isNullOrUndefined(r.fieldSeparator))e=r.fieldEnd,i=1;else{var o=(e=r.fieldSeparator).line.paragraph;if(i=1,o!==r.fieldEnd.line.paragraph||this.hasValidInline(o,e,r.fieldEnd))break;e=r.fieldEnd}}}return i===e.length&&t.isNullOrUndefined(e.nextNode)},e.prototype.getPage=function(e){var i=void 0;if(e.containerWidget instanceof _e){var n=e.containerWidget.containerShape;n.line&&(i=this.getPage(n.line.paragraph))}else if(e.containerWidget instanceof ce){e.containerWidget;i=e.containerWidget.page}else t.isNullOrUndefined(e.containerWidget)||(i=this.getPage(e.containerWidget));return i},e.prototype.clearSelectionHighlightInSelectedWidgets=function(){for(var e=!1,t=this.selectedWidgets.keys,i=0;i<t.length;i++)this.removeSelectionHighlight(t[i]),e=!0;return this.selectedWidgets.clear(),e},e.prototype.clearChildSelectionHighlight=function(e){for(var t=0;t<e.childWidgets.length;t++)e.childWidgets[t]instanceof we?this.clearSelectionHighlightLineWidget(e.childWidgets[t]):e.childWidgets[t]instanceof be?this.clearSelectionHighlight(e.childWidgets[t]):e.childWidgets[t]instanceof he&&this.clearChildSelectionHighlight(e.childWidgets[t])},e.prototype.getLineWidgetBodyWidget=function(e,i){for(var n=0;n<e.childWidgets.length;n++)if((l=e.childWidgets[n])instanceof me)for(var r=0;r<l.childWidgets.length;r++){var o=l.childWidgets[r];if(o instanceof he&&o.y<=i.y&&o.y+o.height>=i.y)return o instanceof fe?this.getLineWidgetParaWidget(o,i):this.getLineWidgetTableWidget(o,i)}else if(l instanceof he&&l.y<=i.y&&l.y+l.height>=i.y)return l instanceof fe?this.getLineWidgetParaWidget(l,i):this.getLineWidgetTableWidget(l,i);var s=void 0;if(e.childWidgets.length>0){var a=e.childWidgets[0];if(a instanceof he&&a.y<=i.y)s=e.childWidgets[e.childWidgets.length-1]instanceof fe?this.getLineWidgetParaWidget(e.childWidgets[e.childWidgets.length-1],i):this.getLineWidgetTableWidget(e.childWidgets[e.childWidgets.length-1],i);else{var l=void 0;a instanceof he&&(l=a),t.isNullOrUndefined(l)||(s=l instanceof fe?this.getLineWidgetParaWidget(a,i):this.getLineWidgetTableWidget(a,i))}}return s},e.prototype.getLineWidgetParaWidget=function(e,t){for(var i=e.childWidgets,n=e.y,r=0;r<i.length;r++){var o=i[r];n+=o.marginTop;var s=o.height;if(o.nextLine&&o.nextLine.marginTop>0&&(s+=o.nextLine.marginTop),n<=t.y&&n+s>=t.y)return o;n+=o.height}var a=void 0;return i.length>0&&(a=e.y<=t.y?i[i.length-1]:i[0]),a},e.prototype.highlightParagraph=function(e,t,i,n,r){var o=0,s=0,a=!1;e.paragraphFormat.bidi&&i.children.indexOf(n)>0&&(n=i.children[0]);for(var l=t;l<e.childWidgets.length;l++){var d=e.childWidgets[l];l===t?o=this.getTop(d):o+=d.marginTop,n instanceof Ie&&(a=n.isRightToLeft);var h=this.getLeft(d);if(d===i){var c=0;if(a||e.bidi){for(var p=this.getElementsBackward(d,n,n,e.bidi),u=0;u<p.length;u++){var g=p[u],m=!1;if(g===n)c=this.getLeftInternal(d,g,r);else{var f=g instanceof Ie?g.length:1;c=this.getLeftInternal(d,g,f)}if(h=this.getLeftInternal(d,g,0),g instanceof Ie&&(m=g.isRightToLeft),s=Math.abs(c-h),g===n&&g instanceof Ie&&r>g.length){var v=this.documentHelper.textHelper.getParagraphMarkSize(g.line.paragraph.characterFormat).Width;if(!e.bidi&&m)c+=v;else if(e.bidi&&!m){s-=v,this.createHighlightBorder(d,s,h,o,!0),h=this.getLineStartLeft(d)-v,this.createHighlightBorder(d,v,h,o,!0);continue}}this.createHighlightBorder(d,s,m?c:h,o,!0)}return}return c=this.getLeftInternal(i,n,r),s=Math.abs(c-h),void this.createHighlightBorder(d,s,a?c:h,o,!1)}s=this.getWidth(d,!0)-(h-e.x),e.bidi&&d.isLastLine()&&(h-=this.documentHelper.textHelper.getParagraphMarkSize(e.characterFormat).Width),this.createHighlightBorder(d,s,h,o,!1),o+=d.height}},e.prototype.getLineWidgetTableWidget=function(e,i){for(var n=void 0,r=0;r<e.childWidgets.length;r++){var o=e.childWidgets[r];if(o instanceof ye&&o.y<=i.y){if("Exactly"===o.rowFormat.heightType&&o.y+W.convertPointToPixel(o.rowFormat.height)<i.y)continue;n=this.getLineWidgetRowWidget(o,i);var s=void 0;!t.isNullOrUndefined(n)&&n.paragraph.containerWidget instanceof be&&(s=n.paragraph.containerWidget);var a=0,l=0;if(!t.isNullOrUndefined(s)){g=s.ownerRow.containerWidget;a=W.convertPointToPixel(g.tableFormat.cellSpacing),l=s.cellFormat.rowSpan}var d=0,h=0,c=0,p=0;if(a>0){d=0===s.cellIndex?a:a/2,h=s.cellIndex===s.ownerRow.childWidgets.length-1?a:a/2;var u=void 0;s.containerWidget instanceof ye&&(u=s.containerWidget);var g=void 0;s.containerWidget.containerWidget instanceof ve&&(g=s.containerWidget.containerWidget),t.isNullOrUndefined(u)||t.isNullOrUndefined(g)||(c=0===s.ownerRow.rowIndex?a:a/2,p=s.ownerRow.rowIndex+l===s.ownerTable.childWidgets.length?a:a/2)}if(!t.isNullOrUndefined(n)&&n.paragraph.x<=i.x&&n.paragraph.x+n.width>=i.x&&n.paragraph.y<=i.y&&this.getTop(n)+n.height>=i.y||!t.isNullOrUndefined(s)&&s.x-s.margin.left-d<=i.x&&s.x+s.width+s.margin.right+h>=i.x&&s.y-s.margin.top-c<=i.y&&s.y+s.height+s.margin.bottom+p>=i.y)break}}return n},e.prototype.getLineWidgetRowWidget=function(e,t){for(var i=0;i<e.childWidgets.length;i++){var n=0,r=0,o=0;if((n=W.convertPointToPixel(e.ownerTable.tableFormat.cellSpacing))>0&&(r=0===e.childWidgets[i].columnIndex?n:n/2,o=e.childWidgets[i].cellIndex===e.childWidgets[i].ownerRow.childWidgets.length-1?n:n/2),e.childWidgets[i].x-e.childWidgets[i].margin.left-r<=t.x&&e.childWidgets[i].x+e.childWidgets[i].width+e.childWidgets[i].margin.right+o>=t.x)return this.getLineWidgetCellWidget(e.childWidgets[i],t)}var s=void 0;return e.childWidgets.length>0&&(s=e.childWidgets[0].x<=t.x?this.getLineWidgetCellWidget(e.childWidgets[e.childWidgets.length-1],t):this.getLineWidgetCellWidget(e.childWidgets[0],t)),s},e.prototype.getFirstBlock=function(e){if(e.childWidgets.length>0)return e.childWidgets[0]},e.prototype.highlightCellWidget=function(e){var t=[];e.previousSplitWidget||e.nextSplitWidget?t=e.getSplitWidgets():t.push(e);for(var i=0;i<t.length;i++)e=t[i],this.clearChildSelectionHighlight(e),this.createHighlightBorderInsideTable(e)},e.prototype.clearSelectionHighlight=function(e){this.selectedWidgets.containsKey(e)&&(this.removeSelectionHighlight(e),this.selectedWidgets.remove(e))},e.prototype.getLineWidgetCellWidget=function(e,t){for(var i=0;i<e.childWidgets.length;i++)if(e.childWidgets[i].y<=t.y&&e.childWidgets[i].y+e.childWidgets[i].height>=t.y)return e.childWidgets[i]instanceof fe?this.getLineWidgetParaWidget(e.childWidgets[i],t):this.getLineWidgetTableWidget(e.childWidgets[i],t);var n=void 0;return e.childWidgets.length>0&&e.childWidgets[0].y<=t.y&&(n=e.childWidgets[e.childWidgets.length-1]instanceof fe?this.getLineWidgetParaWidget(e.childWidgets[e.childWidgets.length-1],t):this.getLineWidgetTableWidget(e.childWidgets[0],t)),n},e.prototype.updateTextPosition=function(e,i){var n=i,r=void 0,o=0,s=!1,a=this.updateTextPositionIn(e,r,o,i,!1);t.isNullOrUndefined(a)||(r=a.element,o=a.index,n=a.caretPosition,s=a.isImageSelected,this.isImageSelected=s),s?(this.selectInternal(e,r,o,n),0===o?this.extendForward():this.extendBackward()):this.selectInternal(e,r,o,n)},e.prototype.updateTextPositionIn=function(e,i,n,r,o){var s=!1,a=this.getTop(e),l=e.paragraph.x,d=this.getFirstElement(e,l),h=d.element,c=!1,p=!1;if(l=d.left,t.isNullOrUndefined(h)){var u=0,g=0,m=this.getParagraphMarkSize(e.paragraph,u,g);u=m.topMargin,g=m.bottomMargin,(N=!(this.documentHelper.mouseDownOffset.y>=a&&this.documentHelper.mouseDownOffset.y<a+e.height)||this.documentHelper.mouseDownOffset.x<l+m.width)&&o&&r.x>l+m.width/2&&(l+=m.width,e.children.length>0&&(n=(i=e.children[e.children.length-1]).length),n++),r=new O(l,u>0?a+u:a)}else if(!t.isNullOrUndefined(h)){if(r.x>l+h.margin.left||h instanceof ze&&"Inline"!==h.textWrappingStyle){for(w=e.children.indexOf(h);w<e.children.length;w++)if((h=e.children[w])instanceof ze&&"Inline"!==h.textWrappingStyle){if(this.documentHelper.isInShapeBorder(h,r)&&!this.documentHelper.isSelectionChangedOnMouseMoved){l=h.x,a=h.y;break}}else{var f=!1;if((h instanceof Ke||h instanceof Ie)&&(f=h.line.paragraph.paragraphFormat.bidi),r.x<l+h.margin.left+h.width+h.padding.left||w===e.children.length-1||e.children[w+1]instanceof Ke&&f)break;l+=h.margin.left+h.width+h.padding.left}if(h instanceof Ie&&(c=h.isRightToLeft,p=h.line.paragraph.paragraphFormat.bidi),r.x>l+h.margin.left+h.width+h.padding.left)n=h instanceof Ie?h.length:1,c&&p&&(n=0),(h instanceof Ie&&("\v"!==h.text||"\f"!==h.text)||o)&&(l+=h.margin.left+h.width+h.padding.left);else if(h instanceof Ie){h instanceof Ie&&c&&(l+=h.width+h.padding.left);var v=0;v=c?l+h.margin.left-r.x:r.x-l-h.margin.left-h.padding.left,l+=h.margin.left+h.padding.left;for(var y=0,b=0,w=1;w<=h.length;w++){I=0;if(w===h.length?I=h.width+h.padding.left:(I=this.documentHelper.textHelper.getWidth(h.text.substr(0,w),h.characterFormat),h.trimEndWidth=I),v<I||w===h.length){if(v-y>(I-y)/2)c?l-=I:l+=I,b=w;else if(c?l-=y:l+=y,b=w-1,1===w&&h!==e.children[0]&&!(e.children[0]instanceof ze&&"Inline"!==e.children[0].textWrappingStyle)){C=e.children.indexOf(h);e.children[C-1]instanceof Ke||c||(b=(h=e.children[C-1])instanceof Ie?h.length:1)}break}y=I}n=b}else if(s=h instanceof Ge||h instanceof Ve,r.x-l-h.margin.left>h.width/2)n=1,l+=h.margin.left+h.width+h.padding.left;else if(h!==e.children[0]&&!s){var C=e.children.indexOf(h);e.children[C-1]instanceof Ke||(n=(h=e.children[C-1])instanceof Ie?h.length:1)}h instanceof Ie&&("\v"===h.text||"\f"===h.text)&&(n=0)}else c=h.isRightToLeft,p=h.line.paragraph.paragraphFormat.bidi,n=h instanceof Ie&&(p||c)&&r.x<l+h.margin.left+h.width+h.padding.left?this.getTextLength(h.line,h)+h.length:this.getTextLength(h.line,h),l+=h.margin.left;if(h instanceof Ie)a+=h.margin.top>0?h.margin.top:0;else{var x=this.documentHelper.textHelper.getHeight(h.characterFormat),F=h.height;h instanceof ke&&!this.documentHelper.layout.hasValidElement(h.line.paragraph)&&(F=x.Height),a+=h.margin.top+F-x.BaselineOffset}(i=h)instanceof xe&&2===i.fieldType&&!t.isNullOrUndefined(i.fieldBegin)&&(i=i.fieldBegin,n=0),i instanceof Xe&&(n=0);var P=this.validateTextPosition(i,n);i=P.element,n=P.index;var T=t.isNullOrUndefined(i.nextNode)&&n===i.length,S=t.isNullOrUndefined(i.nextNode)&&i instanceof Ie&&"\v"===i.text;if(o&&i.nextNode instanceof xe&&n===i.length&&(T=this.isLastRenderedInline(i,n)),o&&T||S){var I=0;if(T){I=this.documentHelper.textHelper.getParagraphMarkWidth(e.paragraph.characterFormat);var N=!(this.documentHelper.mouseDownOffset.y>=a&&this.documentHelper.mouseDownOffset.y<a+e.height)||this.documentHelper.mouseDownOffset.x<l+I;N&&r.x>l+I/2&&(l+=I,n=i.length+1)}else S&&(l+=I=h.width+h.padding.left,n=i.length)}r=new O(l,a)}return{element:i,index:n,caretPosition:r,isImageSelected:s}},e.prototype.checkAllFloatingElements=function(e,i){var n,r,o=!1,s=!1;if(!t.isNullOrUndefined(e)){n=e.paragraph.bodyWidget,o=!1,s=!1;for(var a=0;a<n.floatingElements.length;a++)if(r=n.floatingElements[a],i.x<r.x+r.margin.left+r.width&&i.x>r.x&&i.y<r.y+r.margin.top+r.height&&i.y>r.y){o=!0,this.documentHelper.isInShapeBorder(r,i)&&(s=!0);break}}return{element:r,caretPosition:i,isShapeSelected:o,isInShapeBorder:s}},e.prototype.getTextLength=function(e,t){var i=0,n=e.children.indexOf(t);e.children.length>0&&e.children[0]instanceof Ke&&(e.children[1]instanceof Ke?n-=2:n-=1);for(var r=1;r<n;r++)i+=e.children[r].length;return i},e.prototype.getLeft=function(e){var t=e.paragraph.x,i=e.paragraph.paragraphFormat;this.isParagraphFirstLine(e)&&!i.bidi&&"Right"!==i.textAlignment&&(t+=W.convertPointToPixel(i.firstLineIndent));for(var n=0;n<e.children.length;n++){var r=e.children[n];if(!(r instanceof Ke)||i.bidi){t+=r.margin.left;break}t+=0===n?r.margin.left+r.width:r.width}return t},e.prototype.getTop=function(e){for(var t=e.paragraph.y,i=e.paragraph.childWidgets.indexOf(e),n=0;n<i;n++){var r=e.paragraph.childWidgets[n];t=t+r.height+r.marginTop}return t+=e.marginTop},e.prototype.getFirstElement=function(e,t){var i=0;this.isParagraphFirstLine(e)&&!e.paragraph.paragraphFormat.bidi&&(i=W.convertPointToPixel(e.paragraph.paragraphFormat.firstLineIndent)),t+=i;for(var n=void 0,r=0;r<e.children.length&&((n=e.children[r])instanceof Ke||n instanceof pt);r++){if(e.paragraph.paragraphFormat.bidi){t+=n.margin.left,n=void 0;break}t+=n.margin.left+n.width,n=void 0}return{element:n,left:t}},e.prototype.getIndexInInline=function(e){var t=0;if(e instanceof Ie)for(var i=e.line.children.indexOf(e),n=0;n<i;n++){var r=e.line.children[n];r instanceof xe||r instanceof Ke||(t+=r.length)}return t},e.prototype.isParagraphFirstLine=function(e){return!(!t.isNullOrUndefined(e.paragraph.previousSplitWidget)||e!==e.paragraph.firstChild)},e.prototype.isParagraphLastLine=function(e){return!(!t.isNullOrUndefined(e.paragraph.nextSplitWidget)||e!==e.paragraph.lastChild)},e.prototype.getWidth=function(e,i){var n=0,r=e.paragraph.paragraphFormat;this.isParagraphFirstLine(e)&&!r.bidi&&(n+=W.convertPointToPixel(r.firstLineIndent));for(var o=0;o<e.children.length;o++){var s=e.children[o];s instanceof ze&&"Inline"!==s.textWrappingStyle||(n+=s.margin.left+s.width+s.padding.left)}return i&&e.paragraph.childWidgets.indexOf(e)===e.paragraph.childWidgets.length-1&&t.isNullOrUndefined(e.paragraph.nextSplitWidget)&&(n+=this.documentHelper.textHelper.getParagraphMarkWidth(e.paragraph.characterFormat)),n},e.prototype.getLeftInternal=function(e,i,n){var r=e.paragraph.x,o=e.paragraph.paragraphFormat;this.isParagraphFirstLine(e)&&!o.bidi&&(r+=W.convertPointToPixel(e.paragraph.paragraphFormat.firstLineIndent));var s=!1,a=!1;i instanceof Ie&&(s=i.isRightToLeft,a=i.line.paragraph.paragraphFormat.bidi),a&&(s||(1===this.documentHelper.moveCaretPosition&&e.children.length>0?i=e.children[e.children.length-1]:2===this.documentHelper.moveCaretPosition&&(i=e.children[0]),i instanceof Ke&&e.children.length>2&&(i=e.children[e.children.length-3])));var l=e.children.indexOf(i);(1===e.children.length&&e.children[0]instanceof Ke||2===e.children.length&&e.children[0]instanceof Ke&&e.children[1]instanceof Ke)&&(l=e.children.length);for(var d=0;d<l;d++){var h=e.children[d];h instanceof ze&&"Inline"!==h.textWrappingStyle||(1===d&&e.children[d]instanceof Ke?r+=e.children[d].width:e.children[d]instanceof Oe&&i===h?r+=e.children[d].margin.left:r+=e.children[d].margin.left+e.children[d].width+e.children[d].padding.left)}t.isNullOrUndefined(i)||(r+=i.margin.left+i.padding.left,i instanceof ze&&!t.isNullOrUndefined(i.nextElement)&&(r+=i.nextElement.margin.left+i.nextElement.padding.left),(s&&!a||1===this.documentHelper.moveCaretPosition&&!s&&a)&&(r+=i.width));var c=0;if(i instanceof Ie){if(0!==this.documentHelper.moveCaretPosition&&(a||s))return(s&&a&&2===this.documentHelper.moveCaretPosition||s&&!a&&1===this.documentHelper.moveCaretPosition)&&(r-=i.width),this.documentHelper.moveCaretPosition=0,r;n!==i.length||s?n>i.length?(c=this.documentHelper.textHelper.getParagraphMarkWidth(i.line.paragraph.characterFormat),s&&a?r=r:s?r-=i.width+c:r+=i.width+c):(c=this.documentHelper.textHelper.getWidth(i.text.substr(0,n),i.characterFormat),i.trimEndWidth=c,s&&a?r=r:s?r-=c:r+=c):r+=i.width,this.documentHelper.moveCaretPosition=0}else if(n>0)if(t.isNullOrUndefined(i)||i instanceof Ke)r+=this.documentHelper.textHelper.getParagraphMarkWidth(e.paragraph.characterFormat);else if(i instanceof ze&&"Inline"!==i.textWrappingStyle||(r+=i.width),2===n){var p=i.line.paragraph;r+=this.documentHelper.textHelper.getParagraphMarkWidth(p.characterFormat)}return r},e.prototype.getLineStartLeft=function(e){var t=e.paragraph.x,i=e.paragraph.paragraphFormat;return this.isParagraphFirstLine(e)&&!i.bidi&&(t+=W.convertPointToPixel(i.firstLineIndent)),e.children.length>0&&(t+=e.children[0].margin.left),t},e.prototype.updateTextPositionWidget=function(e,t,i,n){var r,o=t,s=void 0,a=0;s=(r=this.updateTextPositionIn(e,s,a,o,n)).element,a=r.index,o=r.caretPosition,i.setPositionForSelection(e,s,a,o)},e.prototype.clearSelectionHighlightLineWidget=function(e){!t.isNullOrUndefined(this.owner)&&this.selectedWidgets.length>0&&this.clearSelectionHighlight(this)},e.prototype.getFirstElementInternal=function(e){for(var t=void 0,i=e.paragraph.paragraphFormat.bidi,n=e.children.length,r=i?n-1:0;(i?r>=0:r<n)&&(t=e.children[r])instanceof Ke;i?r--:r++)t=void 0;return t},e.prototype.selectRange=function(e,t){this.start.setPositionInternal(e),this.end.setPositionInternal(t),this.upDownSelectionLength=this.end.location.x,this.fireSelectionChanged(!0)},e.prototype.selectParagraphInternal=function(e,i){var n;if(!t.isNullOrUndefined(e)&&!t.isNullOrUndefined(e.firstChild))if(n=e.firstChild,i)this.start.setPosition(n,i);else{var r=n.getEndOffset();this.start.setPositionParagraph(n,r)}this.end.setPositionInternal(this.start),this.upDownSelectionLength=this.start.location.x,this.fireSelectionChanged(!0)},e.prototype.setPositionForBlock=function(e,t){var i;if(e instanceof ve&&(e=t?this.getFirstParagraphInFirstCell(e):this.getLastParagraphInLastCell(e)),e instanceof fe)if(i=new Nt(this.owner),t)i.setPosition(e.firstChild,!0);else{var n=e.lastChild;i.setPositionParagraph(n,n.getEndOffset())}return i},e.prototype.selectContent=function(e,i){if(t.isNullOrUndefined(e))throw new Error("textPosition is undefined.");this.start.setPositionInternal(e),this.end.setPositionInternal(e),this.upDownSelectionLength=this.end.location.x,this.fireSelectionChanged(!0)},e.prototype.selectInternal=function(e,t,i,n){this.start.setPositionForSelection(e,t,i,n),this.end.setPositionInternal(this.start),this.upDownSelectionLength=n.x,this.fireSelectionChanged(!0)},e.prototype.selects=function(e,t,i){this.documentHelper.clearSelectionHighlight(),this.start.setPositionForLineWidget(e,t),this.end.setPositionInternal(this.start),i||this.fireSelectionChanged(!0)},e.prototype.selectPosition=function(e,i){if(t.isNullOrUndefined(e)||t.isNullOrUndefined(i))throw new Error("TextPosition cannot be undefined");if(t.isNullOrUndefined(e.paragraph)||e.offset>this.getParagraphLength(e.paragraph)+1)throw new Error("Start TextPosition is not valid.");if(t.isNullOrUndefined(i.paragraph)||i.offset>this.getParagraphLength(i.paragraph)+1)throw new Error("End TextPosition is not valid.");e.isAtSamePosition(i)?this.selectRange(e,e):(e.isExistBefore(i)?i.validateForwardFieldSelection(e.getHierarchicalIndexInternal(),i.getHierarchicalIndexInternal()):e.validateForwardFieldSelection(i.getHierarchicalIndexInternal(),e.getHierarchicalIndexInternal()),this.selectRange(e,i))},e.prototype.fireSelectionChanged=function(e){this.isEmpty||(this.isForward?(this.start.updatePhysicalPosition(!0),this.end.updatePhysicalPosition(!1)):(this.start.updatePhysicalPosition(!1),this.end.updatePhysicalPosition(!0))),this.skipFormatRetrieval||this.retrieveCurrentFormatProperties(),this.documentHelper.clearSelectionHighlight(),this.hideToolTip(),this.owner.isLayoutEnabled&&!this.owner.isShiftingEnabled&&this.highlightSelection(!0),this.documentHelper.restrictEditingPane.isShowRestrictPane&&!this.skipEditRangeRetrieval&&this.documentHelper.restrictEditingPane.updateUserInformation(),e&&(this.start.paragraph.isInHeaderFooter&&!this.owner.enableHeaderAndFooter?this.owner.enableHeaderAndFooter=!0:!this.start.paragraph.isInHeaderFooter&&this.owner.enableHeaderAndFooter&&(this.owner.enableHeaderAndFooter=!1),this.owner.fireSelectionChange()),this.documentHelper.updateFocus(),this.documentHelper.isInlineFormFillProtectedMode&&e&&(this.triggerFormFillEvent(),this.previousSelectedFormField=this.getCurrentFormField())},e.prototype.retrieveCurrentFormatProperties=function(){this.isRetrieveFormatting=!0;var e=this.start,t=this.end;this.isForward||(e=this.end,t=this.start),this.retrieveImageFormat(e,t),this.retrieveCharacterFormat(e,t),this.retrieveParagraphFormat(e,t),this.retrieveSectionFormat(e,t),this.retrieveTableFormat(e,t),this.isImageSelected||this.imageFormat.clearImageFormat(),this.isRetrieveFormatting=!1,this.setCurrentContextType()},e.prototype.retrieveImageFormat=function(e,t){var i;if(e.currentWidget===t.currentWidget&&e.offset+1===t.offset){var n=t.currentWidget.getInline(t.offset,0);i=n.element;n.index;i instanceof Ge&&e.currentWidget.getOffset(i,0)!==e.offset&&(i=void 0)}i instanceof Ge?this.imageFormat.copyImageFormat(i):this.imageFormat.clearImageFormat()},e.prototype.getPreviousContextType=function(e){var t=this.start;if(t.offset>0){var i=t.currentWidget.getInline(t.offset,0).element;return i=e?i.previousElement:t.currentWidget.getInline(t.offset-1,0).element,this.getContextElement(i)}},e.prototype.getNextContextType=function(e){var t=this.start,i=t.currentWidget.getInline(t.offset,0).element;return i=e&&i.nextElement?i.nextElement:t.currentWidget.getInline(t.offset+1,0).element,this.getContextElement(i)},e.prototype.getContextElement=function(e){return e instanceof Ie?"Text":e instanceof xe||e instanceof We?"Field":e instanceof ke?"Bookmark":e instanceof Ge?"Image":e instanceof Ve?"Shape":e instanceof ut||e instanceof pt?"Comment":e instanceof Ke?"List":e instanceof Ye||e instanceof Xe?"EditRange":void 0},e.prototype.setCurrentContextType=function(){var e=!!this.imageFormat.image,i=!t.isNullOrUndefined(this.tableFormat)&&!t.isNullOrUndefined(this.tableFormat.table),n=this.start.paragraph.paragraphFormat.baseStyle;if(n instanceof R&&0===n.name.toLowerCase().indexOf("toc")){var r=this.getTocFieldInternal();if(!t.isNullOrUndefined(r))return void(this.contextTypeInternal="TableOfContents")}var o=this.getCurrentRevision();if(o?(this.owner.showRevisions=!0,this.owner.trackChangesPane.currentSelectedRevision=o[0]):t.isNullOrUndefined(this.owner.trackChangesPane.currentSelectedRevision)||(this.owner.trackChangesPane.currentSelectedRevision=void 0),this.start.paragraph.isInHeaderFooter){var s=-1!==this.start.paragraph.bodyWidget.headerFooterType.indexOf("Header");this.contextTypeInternal=i?e?s?"HeaderTableImage":"FooterTableImage":s?"HeaderTableText":"FooterTableText":e?s?"HeaderImage":"FooterImage":s?"HeaderText":"FooterText"}else this.contextTypeInternal=i?e?"TableImage":"TableText":e?"Image":"Text"},e.prototype.addItemRevisions=function(e,t){for(var i=0;i<e.revisions.length;i++){var n=e.revisions[i];this.selectRevision(n),t?n.accept():n.reject()}},e.prototype.hasRevisions=function(){return!!this.getCurrentRevision()},e.prototype.getCurrentRevision=function(){var e=this.start,i=this.end;this.isForward||(e=this.end,i=this.start);var n,r=e.currentWidget.getInline(e.offset,0).element,o=e.paragraph,s=e.currentWidget.getInline(e.offset+1,0).element;if(r&&r===s){var a=r.line.getOffset(r,r.length);if((n=new Nt(this.owner)).setPositionParagraph(r.line,a),i.offset===n.offset)return}if(s!==r&&(r=s),!t.isNullOrUndefined(r)&&r.revisions.length>0)return r.revisions;if(o.isInsideTable){var l=o.associatedCell;if(!t.isNullOrUndefined(l.ownerRow)&&l.ownerRow.rowFormat.revisions.length>0)return l.ownerRow.rowFormat.revisions}return i.offset>i.paragraph.getLength()&&i.paragraph.characterFormat.revisions.length>0?i.paragraph.characterFormat.revisions:void 0},e.prototype.processLineRevisions=function(e,t){for(var i=0;i<e.children.length;i++){var n=e.children[i];n.revisions.length>0&&this.addItemRevisions(n,t)}},e.prototype.handleAcceptReject=function(e){if(this.isEmpty){var i=this.start.currentWidget.getInline(this.start.offset+1,0).element,n=this.start.paragraph;if(!t.isNullOrUndefined(i)&&i.revisions.length>0&&this.addItemRevisions(i,e),n.isInsideTable){var r=n.associatedCell;if(t.isNullOrUndefined(r)){if(!n.isEmpty())for(d=0;d<r.childWidgets.length;d++)for(var o=r.childWidgets[d],s=void 0;s<o.childWidgets.length;s++){var a=o.childWidgets[s];this.processLineRevisions(a,e)}}else r.ownerRow.rowFormat.revisions.length>0&&this.addItemRevisions(r.ownerRow.rowFormat,e)}}else for(var l=this.getselectedRevisionElements(),d=0;d<l.length;d++)this.acceptReject(l[d],e)},e.prototype.acceptReject=function(e,t){this.selectRevision(e),t?e.accept():e.reject()},e.prototype.getselectedRevisionElements=function(){var e=[],t=this.start,i=this.end;this.isForward||(t=this.end,i=this.start);for(var n=0;n<this.selectedWidgets.length;n++){var r=this.selectedWidgets.keys[n];if(r instanceof we)e=this.getSelectedLineRevisions(r,t,i,e);else if(r instanceof be){r.ownerRow.rowFormat.revisions.length>0&&(e=this.addRevisionsCollec(r.ownerRow.rowFormat.revisions,e));for(var o=0;o<r.childWidgets.length;o++)for(var s=r.childWidgets[o],a=0;a<s.childWidgets.length;a++){var l=s.childWidgets[a];e=this.getSelectedLineRevisions(l,t,i,e)}}}return e},e.prototype.getSelectedLineRevisions=function(e,t,i,n){e.paragraph.characterFormat.revisions.length>0&&(n=this.addRevisionsCollec(e.paragraph.characterFormat.revisions,n));for(var r=0;r<e.children.length;r++){var o=e.children[r],s=o.line.getOffset(o,0),a=new Nt(this.owner);a.setPositionParagraph(o.line,s),s=o.line.getOffset(o,o.length);var l=new Nt(this.owner);l.setPositionParagraph(o.line,s),(l.isExistAfter(t)&&l.isExistBefore(i)||a.isExistAfter(t)&&a.isExistBefore(i)||a.isAtSamePosition(t)||t.isExistAfter(a)&&i.isExistBefore(l))&&o.revisions.length>0&&(n=this.addRevisionsCollec(o.revisions,n))}return n},e.prototype.addRevisionsCollec=function(e,t){for(var i=0;i<e.length;i++)-1===t.indexOf(e[i])&&t.push(e[i]);return t},e.prototype.retrieveTableFormat=function(e,i){var n=this.getTable(e,i);t.isNullOrUndefined(n)?this.tableFormat.clearFormat():(this.tableFormat.copyFormat(n.tableFormat),this.tableFormat.table=n,this.retrieveCellFormat(e,i),this.retrieveRowFormat(e,i))},e.prototype.retrieveCellFormat=function(e,t){e.paragraph.isInsideTable&&t.paragraph.isInsideTable?(this.cellFormat.copyFormat(e.paragraph.associatedCell.cellFormat),this.getCellFormat(e.paragraph.associatedCell.ownerTable,e,t)):this.cellFormat.clearCellFormat()},e.prototype.retrieveRowFormat=function(e,t){e.paragraph.isInsideTable&&t.paragraph.isInsideTable?(this.rowFormat.copyFormat(e.paragraph.associatedCell.ownerRow.rowFormat),this.getRowFormat(e.paragraph.associatedCell.ownerTable,e,t)):this.rowFormat.clearRowFormat()},e.prototype.getCellFormat=function(e,t,i){if(!t.paragraph.associatedCell.equals(i.paragraph.associatedCell))for(var n=!1,r=0;r<e.childWidgets.length;r++){var o=e.childWidgets[r];if(o===t.paragraph.associatedCell.ownerRow&&(n=!0),n)for(var s=0;s<o.childWidgets.length;s++){var a=o.childWidgets[s];if(this.isCellSelected(a,t,i)&&this.cellFormat.combineFormat(a.cellFormat),a===i.paragraph.associatedCell)return void this.cellFormat.combineFormat(a.cellFormat)}}},e.prototype.getRowFormat=function(e,t,i){var n=t.paragraph.associatedCell.ownerRow;if(n!==i.paragraph.associatedCell.ownerRow)for(var r=e.childWidgets.indexOf(n)+1;r<e.childWidgets.length;r++){var o=e.childWidgets[r];if(this.rowFormat.combineFormat(o.rowFormat),o===i.paragraph.associatedCell.ownerRow)return}},e.prototype.getTable=function(e,i){if(!t.isNullOrUndefined(e.paragraph.associatedCell)&&!t.isNullOrUndefined(i.paragraph.associatedCell)){var n=e.paragraph.associatedCell.ownerTable,r=e.paragraph.associatedCell.ownerTable;if(n===r)return n;if(n.contains(e.paragraph.associatedCell))return n;if(r.contains(e.paragraph.associatedCell))return r;if(!n.isInsideTable||!r.isInsideTable)return;do{if((n=n.associatedCell.ownerTable)===r||n.contains(r.associatedCell))return n;if(r.contains(n.associatedCell))return r}while(!t.isNullOrUndefined(n.associatedCell))}},e.prototype.getContainerWidget=function(e){var t;if(e.containerWidget instanceof _e)t=e.containerWidget.containerShape.line.paragraph.bodyWidget;else if(e.containerWidget instanceof ce)t=e.containerWidget;else for(t=e.containerWidget;!(t instanceof ce);)t instanceof _e&&(t=t.containerShape.line.paragraph),t=t.containerWidget;return t},e.prototype.retrieveSectionFormat=function(e,i){var n=this.getContainerWidget(e.paragraph),r=this.getContainerWidget(i.paragraph);if(!t.isNullOrUndefined(n)){this.sectionFormat.copyFormat(n.sectionFormat);for(var o=this.documentHelper.pages.indexOf(n.page),s=this.documentHelper.pages.indexOf(r.page),a=o+1;a<=s;a++)this.sectionFormat.combineFormat(this.documentHelper.pages[a].bodyWidgets[0].sectionFormat)}},e.prototype.retrieveParagraphFormat=function(e,t){this.getParagraphFormatForSelection(e.paragraph,this,e,t)},e.prototype.getParagraphFormatForSelection=function(e,t,i,n){!i.paragraph.isInsideTable||n.paragraph.isInsideTable&&i.paragraph.associatedCell===n.paragraph.associatedCell&&!this.isCellSelected(i.paragraph.associatedCell,i,n)?this.getParagraphFormatInternalInParagraph(e,i,n):this.getParagraphFormatInternalInCell(i.paragraph.associatedCell,i,n)},e.prototype.getParagraphFormatInternalInParagraph=function(e,i,n){if(i.paragraph===e?this.paragraphFormat.copyFormat(e.paragraphFormat):this.paragraphFormat.combineFormat(e.paragraphFormat),n.paragraph!==e){var r=this.getNextRenderedBlock(e);t.isNullOrUndefined(r)||this.getParagraphFormatInternalInBlock(r,i,n)}},e.prototype.getParagraphFormatInternalInBlock=function(e,t,i){e instanceof fe?this.getParagraphFormatInternalInParagraph(e,t,i):this.getParagraphFormatInternalInTable(e,t,i)},e.prototype.getParagraphFormatInternalInTable=function(e,t,i){for(var n=0;n<e.childWidgets.length;n++){for(var r=e.childWidgets[n],o=0;o<r.childWidgets.length;o++)this.getParagraphFormatInCell(r.childWidgets[o]);if(i.paragraph.isInsideTable&&this.containsRow(r,i.paragraph.associatedCell))return}var s=this.getNextRenderedBlock(e);this.getParagraphFormatInternalInBlock(s,t,i)},e.prototype.getParagraphFormatInCell=function(e){for(var t=0;t<e.childWidgets.length;t++)this.getParagraphFormatInBlock(e.childWidgets[t])},e.prototype.getParagraphFormatInBlock=function(e){e instanceof fe?this.getParagraphFormatInParagraph(e):this.getParagraphFormatInTable(e)},e.prototype.getParagraphFormatInTable=function(e){for(var t=0;t<e.childWidgets.length;t++)for(var i=e.childWidgets[t],n=0;n<i.childWidgets.length;n++)this.getParagraphFormatInCell(i.childWidgets[n])},e.prototype.getParagraphFormatInParagraph=function(e){this.paragraphFormat.combineFormat(e.paragraphFormat)},e.prototype.getParagraphFormatInternalInCell=function(e,t,i){if(i.paragraph.isInsideTable){var n=this.getContainerCellOf(e,i.paragraph.associatedCell);if(n.ownerTable.contains(i.paragraph.associatedCell)){var r=this.getSelectedCell(e,n),o=this.getSelectedCell(i.paragraph.associatedCell,n);this.containsCell(n,i.paragraph.associatedCell)?this.isCellSelected(n,t,i)?this.getParagraphFormatInCell(n):r===n?this.getParagraphFormatInternalInParagraph(t.paragraph,t,i):this.getParagraphFormatInRow(r.ownerRow,t,i):this.getParaFormatForCell(n.ownerTable,n,o)}else this.getParagraphFormatInRow(n.ownerRow,t,i)}else{var s=this.getContainerCell(e);this.getParagraphFormatInRow(s.ownerRow,t,i)}},e.prototype.getParaFormatForCell=function(e,t,i){var n=this.getCellLeft(t.ownerRow,t),r=n+t.cellFormat.cellWidth,o=this.getCellLeft(i.ownerRow,i),s=o+i.cellFormat.cellWidth;n>o&&(n=o),r<s&&(r=s),n>this.upDownSelectionLength&&(n=this.upDownSelectionLength),n<this.upDownSelectionLength&&(n=this.upDownSelectionLength);for(var a=e.childWidgets.indexOf(i.ownerRow),l=e.childWidgets.indexOf(t.ownerRow);l<=a;l++)for(var d=e.childWidgets[l],h=0;h<d.childWidgets.length;h++){var c=d.childWidgets[h],p=this.getCellLeft(d,c);W.round(n,2)<=W.round(p,2)&&W.round(p,2)<W.round(r,2)&&this.getParagraphFormatInCell(c)}},e.prototype.getParagraphFormatInRow=function(e,t,i){for(var n=e.rowIndex;n<e.ownerTable.childWidgets.length;n++){for(var r=e.ownerTable.childWidgets[n],o=0;o<r.childWidgets.length;o++)this.getParagraphFormatInCell(r.childWidgets[o]);if(i.paragraph.isInsideTable&&this.containsRow(r,i.paragraph.associatedCell))return}var s=this.getNextRenderedBlock(e.ownerTable);this.getParagraphFormatInternalInBlock(s,t,i)},e.prototype.retrieveCharacterFormat=function(e,i){if(this.characterFormat.copyFormat(e.paragraph.characterFormat),e.paragraph!==i.paragraph||!e.currentWidget.isLastLine()||e.offset!==this.getLineLength(e.currentWidget)||e.offset+1!==i.offset){var n=e.paragraph;if(e.paragraph===i.paragraph&&this.isSelectList){var r=this.getListLevel(e.paragraph);return void(r&&r.characterFormat.uniqueCharacterFormat&&this.characterFormat.copyFormat(r.characterFormat))}for(e.offset!==this.getParagraphLength(n)||this.isEmpty||(n=this.getNextParagraphBlock(n));!t.isNullOrUndefined(n)&&n!==i.paragraph&&n.isEmpty();)n=this.getNextParagraphBlock(n);var o=n===e.paragraph?e.offset:0;if(!t.isNullOrUndefined(n)&&!n.isEmpty()){var s=new Nt(this.owner),a=e.currentWidget.getInline(o,0),l=this.getPhysicalPositionInternal(e.currentWidget,o,!0);s.setPositionForSelection(e.currentWidget,a.element,a.index,l),this.getCharacterFormatForSelection(n,this,s,i)}}},e.prototype.getCharacterFormatForSelection=function(e,t,i,n){i.paragraph instanceof fe&&i.paragraph.isInsideTable&&(!n.paragraph.isInsideTable||i.paragraph.associatedCell!==n.paragraph.associatedCell||this.isCellSelected(i.paragraph.associatedCell,i,n))?this.getCharacterFormatInTableCell(i.paragraph.associatedCell,t,i,n):this.getCharacterFormat(e,i,n)},e.prototype.getCharacterFormatForTableRow=function(e,t,i){for(var n=e.rowIndex;n<e.ownerTable.childWidgets.length;n++){for(var r=e.ownerTable.childWidgets[n],o=0;o<r.childWidgets.length;o++)this.getCharacterFormatForSelectionCell(r.childWidgets[o],t,i);if(i.paragraph.isInsideTable&&this.containsRow(r,i.paragraph.associatedCell))return}var s=this.getNextRenderedBlock(e.ownerTable);this.getCharacterFormatForBlock(s,t,i)},e.prototype.getCharacterFormatInTableCell=function(e,t,i,n){if(n.paragraph.isInsideTable){var r=this.getContainerCellOf(e,n.paragraph.associatedCell);if(r.ownerTable.contains(n.paragraph.associatedCell)){var o=this.getSelectedCell(e,r),s=this.getSelectedCell(n.paragraph.associatedCell,r);this.containsCell(r,n.paragraph.associatedCell)?this.isCellSelected(r,i,n)?this.getCharacterFormatForSelectionCell(r,i,n):o===r?this.getCharacterFormat(i.paragraph,i,n):this.getCharacterFormatForTableRow(o.ownerRow,i,n):this.getCharacterFormatInternalInTable(r.ownerTable,r,s,i,n)}else this.getCharacterFormatForTableRow(r.ownerRow,i,n)}else{var a=this.getContainerCell(e);this.getCharacterFormatForTableRow(a.ownerRow,i,n)}},e.prototype.getCharacterFormatInternalInTable=function(e,t,i,n,r){var o=this.getCellLeft(t.ownerRow,t),s=o+t.cellFormat.cellWidth,a=this.getCellLeft(i.ownerRow,i),l=a+i.cellFormat.cellWidth;o>a&&(o=a),s<l&&(s=l),o>this.upDownSelectionLength&&(o=this.upDownSelectionLength),s<this.upDownSelectionLength&&(s=this.upDownSelectionLength);for(var d=e.childWidgets.indexOf(i.ownerRow),h=e.childWidgets.indexOf(t.ownerRow);h<=d;h++)for(var c=e.childWidgets[h],p=0;p<c.childWidgets.length;p++){var u=c.childWidgets[p],g=this.getCellLeft(c,u);W.round(o,2)<=W.round(g,2)&&W.round(g,2)<W.round(s,2)&&this.getCharacterFormatForSelectionCell(u,n,r)}},e.prototype.getCharacterFormat=function(e,i,n){if(e!==i.paragraph&&e!==n.paragraph&&!e.isEmpty())return void this.getCharacterFormatInternal(e,this);if(n.paragraph!==e||i.paragraph===e||0!==n.offset){var r=0,o=this.getParagraphLength(e);if(e!==i.paragraph||(r=i.offset,!this.setCharacterFormat(e,i,n,o))){var s=-1!==e.childWidgets.indexOf(i.currentWidget)?e.childWidgets.indexOf(i.currentWidget):0,a=-1!==e.childWidgets.indexOf(n.currentWidget)?e.childWidgets.indexOf(n.currentWidget):e.childWidgets.length-1,l=n.offset;e!==n.paragraph&&(l=o);for(var d=!1,h=s;h<=a;h++){var c=e.childWidgets[h];h!==s&&(r=this.getStartLineOffset(c)),l=c===n.currentWidget?n.offset:this.getLineLength(c);for(var p=0,u=0;u<c.children.length;u++){var g=c.children[u];if(!(g instanceof Ke))if(r>=p+g.length)p+=g.length;else{if(g instanceof xe&&0===g.fieldType&&W.isLinkedFieldCharacter(g)){var m=t.isNullOrUndefined(g.fieldSeparator)?g.fieldEnd:g.fieldSeparator;do{p+=g.length,g=g.nextNode,h++}while(!t.isNullOrUndefined(g)&&g!==m);d=!0}if(g instanceof xe&&1===g.fieldType&&W.isLinkedFieldCharacter(g)&&d){var f=g.fieldBegin;do{this.characterFormat.combineFormat(f.characterFormat),f=f.nextNode}while(!(f instanceof xe))}if(g instanceof Ie&&this.characterFormat.combineFormat(g.characterFormat),t.isNullOrUndefined(g)||l<=p+g.length)break;p+=g.length}}}if(n.paragraph!==e){var v=this.getNextRenderedBlock(e);t.isNullOrUndefined(v)||this.getCharacterFormatForBlock(v,i,n)}}}},e.prototype.setCharacterFormat=function(e,i,n,r){var o=0,s=i.offset,a=i.currentWidget.getInline(s,o);o=a.index;var l=a.element;if(t.isNullOrUndefined(l)){i.paragraph.childWidgets.indexOf(i.currentWidget);if(i.currentWidget.previousLine)return l=i.currentWidget.previousLine.children[i.currentWidget.previousLine.children.length-1],this.characterFormat.copyFormat(l.characterFormat),!0}if(s<r){if(this.isEmpty){if(l instanceof Ie||l instanceof xe&&(0===l.fieldType||1===l.fieldType)){var d=this.getPreviousTextElement(l);0===s&&d&&(l=d),this.characterFormat.copyFormat(l.characterFormat)}else t.isNullOrUndefined(this.getPreviousTextElement(l))?t.isNullOrUndefined(this.getNextTextElement(l))?this.characterFormat.copyFormat(e.characterFormat):this.characterFormat.copyFormat(this.getNextTextElement(l).characterFormat):this.characterFormat.copyFormat(this.getPreviousTextElement(l).characterFormat);return!0}o!==l.length||t.isNullOrUndefined(l.nextNode)?l instanceof Ie?this.characterFormat.copyFormat(l.characterFormat):l instanceof xe&&this.characterFormat.copyFormat(this.getNextValidCharacterFormatOfField(l)):this.characterFormat.copyFormat(this.getNextValidCharacterFormat(l))}else if(r===n.offset)return l instanceof Ie||l instanceof xe?this.characterFormat.copyFormat(l.characterFormat):t.isNullOrUndefined(l)?this.characterFormat.copyFormat(e.characterFormat):(l=this.getPreviousTextElement(l),t.isNullOrUndefined(l)||this.characterFormat.copyFormat(l.characterFormat)),!0;return!1},e.prototype.getCharacterFormatForBlock=function(e,t,i){e instanceof fe?this.getCharacterFormat(e,t,i):this.getCharacterFormatInTable(e,t,i)},e.prototype.getCharacterFormatInTable=function(e,t,i){for(var n=0;n<e.childWidgets.length;n++){for(var r=e.childWidgets[n],o=0;o<r.childWidgets.length;o++)this.getCharacterFormatForSelectionCell(r.childWidgets[o],t,i);if(i.paragraph.isInsideTable&&this.containsRow(r,i.paragraph.associatedCell))return}var s=this.getNextRenderedBlock(e);this.getCharacterFormatForBlock(s,t,i)},e.prototype.getCharacterFormatForSelectionCell=function(e,t,i){for(var n=0;n<e.childWidgets.length;n++)this.getCharacterFormatForBlock(e.childWidgets[n],t,i)},e.prototype.getCharacterFormatInternal=function(e,t){for(var i=0;i<e.childWidgets.length;i++)for(var n=e.childWidgets[i],r=0;r<n.children.length;r++){var o=n.children[r];o instanceof Ge||o instanceof xe||t.characterFormat.combineFormat(o.characterFormat)}},e.prototype.getNextValidCharacterFormat=function(e){var i=this.getNextTextElement(e);if(t.isNullOrUndefined(i))return e.characterFormat;var n=void 0;return i instanceof xe&&0===n.fieldType&&(n=i),t.isNullOrUndefined(n)?i.characterFormat:this.getNextValidCharacterFormatOfField(n)},e.prototype.getNextValidCharacterFormatOfField=function(e){var i=e;W.isLinkedFieldCharacter(e)&&(i=t.isNullOrUndefined(e.fieldSeparator)?e.fieldEnd:e.fieldSeparator);var n=void 0;return t.isNullOrUndefined(i.nextNode)||(n=this.getNextValidElement(i.nextNode)),t.isNullOrUndefined(n)?i.characterFormat:n.characterFormat},e.prototype.checkCursorIsInSelection=function(e,i){if(t.isNullOrUndefined(this.start)||this.isEmpty||t.isNullOrUndefined(e))return!1;var n=!1;do{if(this.selectedWidgets.containsKey(e)){var r=void 0;e instanceof we?(r=this.owner.selection.getTop(e),this.owner.selection.getLeft(e)):(r=e.y,e.x);var o=this.selectedWidgets.get(e);n=o.left<=i.x&&r<=i.y&&r+e.height>=i.y&&o.left+o.width>=i.x}e=e instanceof we?e.paragraph:e.containerWidget}while(!t.isNullOrUndefined(e)&&!n);return n},e.prototype.copySelectionParagraphFormat=function(){var e=new P;return this.paragraphFormat.copyToFormat(e),e},e.prototype.getHyperlinkDisplayText=function(e,i,n,r,o){var s=e;if(s!==n.line.paragraph)return r=!0,{displayText:"<<Selection in Document>>",isNestedField:r,format:o};for(var a="",l=s.childWidgets.indexOf(i.line),d=s.childWidgets[l].children.indexOf(i),h=l;h<s.childWidgets.length;h++){var c=s.childWidgets[h];h!==l&&(d=-1);for(var p=d+1;p<c.children.length;p++){var u=c.children[p];if(u===n)return{displayText:a,isNestedField:r,format:o};if(u instanceof Ie)a+=u.text,o=u.characterFormat;else{if(!(u instanceof xe))return r=!0,{displayText:"<<Selection in Document>>",isNestedField:r,format:o};u instanceof xe&&0===u.fieldType&&!t.isNullOrUndefined(u.fieldEnd)&&(d=t.isNullOrUndefined(u.fieldSeparator)?c.children.indexOf(u.fieldEnd):c.children.indexOf(u.fieldSeparator))}}}return{displayText:a,isNestedField:r,format:o}},e.prototype.navigateHyperLinkOnEvent=function(e,i){var n=this,r=this.documentHelper.getLineWidget(e);if(!t.isNullOrUndefined(r)){var o=this.getHyperLinkFieldInCurrentSelection(r,e);t.isNullOrUndefined(o)||(this.documentHelper.updateTextPositionForSelection(e,1),this.fireRequestNavigate(o),setTimeout(function(){n.viewer&&(n.documentHelper.isTouchInput=i,n.documentHelper.updateFocus(),n.documentHelper.isTouchInput=!1)}))}},e.prototype.getLinkText=function(e){var i=new Ht(e,this),n=i.navigationLink;return i.localReference.length>0&&("_"!==i.localReference[0]||!t.isNullOrUndefined(n)&&0!==n.length?i.isCrossRef?n+=i.localReference:n+="#"+i.localReference:n="Current Document"),i.destroy(),n},e.prototype.setHyperlinkContentToToolTip=function(e,i,n,r){if(e){if(this.owner.contextMenuModule&&"block"===this.owner.contextMenuModule.contextMenuInstance.element.style.display)return;this.toolTipElement||(this.toolTipElement=t.createElement("div",{className:"e-de-tooltip"}),this.documentHelper.viewerContainer.appendChild(this.toolTipElement)),this.toolTipElement.style.display="block";var o=new t.L10n("documenteditor",this.owner.defaultLocale);o.setLocale(this.owner.locale);var s=o.getConstant("Click to follow link");this.owner.useCtrlClickToFollowHyperlink&&(s="Ctrl+"+s);var a=this.getLinkText(e);if(r){var l=e.formFieldData.helpText;if(t.isNullOrUndefined(l)||""===l)return;this.toolTipElement.innerHTML=l}else this.toolTipElement.innerHTML=a+"</br><b>"+s+"</b>";var d=this.getTooltipPosition(e.line,n,this.toolTipElement,!1);this.showToolTip(d.x,d.y),t.isNullOrUndefined(this.toolTipField)||e===this.toolTipField||(this.toolTipObject.position={X:d.x,Y:d.y}),this.toolTipObject.show(),this.toolTipField=e}else this.hideToolTip()},e.prototype.setFootnoteContentToToolTip=function(e,i,n){if(e){if("block"===this.owner.contextMenuModule.contextMenuInstance.element.style.display&&this.owner.contextMenuModule)return;this.toolTipElement||(this.toolTipElement=t.createElement("div",{className:"e-de-tooltip"}),this.documentHelper.viewerContainer.appendChild(this.toolTipElement)),this.toolTipElement.style.display="block";var r=new t.L10n("documenteditor",this.owner.defaultLocale);r.setLocale(this.owner.locale);var o=void 0;"Endnote"===e.footnoteType?o=r.getConstant("Click to View/Edit Endnote"):"Footnote"===e.footnoteType&&(o=r.getConstant("Click to View/Edit Footnote")),this.toolTipElement.innerHTML="<b>"+o+"</b>";var s=this.getTooltipPosition(e.line,n,this.toolTipElement,!1);this.showToolTip(s.x,s.y),t.isNullOrUndefined(this.toolTipField)||(this.toolTipObject.position={X:s.x,Y:s.y}),this.toolTipObject.show()}else this.hideToolTip()},e.prototype.setLockInfoTooptip=function(e,i,n){if(e){if(this.owner.contextMenuModule&&"block"===this.owner.contextMenuModule.contextMenuInstance.element.style.display)return;var r=this.toolTipElement;this.toolTipElement||(r=t.createElement("div",{className:"e-de-tooltip"}),this.documentHelper.viewerContainer.appendChild(r),this.toolTipElement=r),r.style.display="block";var o=new t.L10n("documenteditor",this.owner.defaultLocale);o.setLocale(this.owner.locale);var s=o.getConstant("This region is locked by");r.innerHTML=s+" <b>"+n+"</b>";var a=this.getTooltipPosition(e,i,r,!1);this.showToolTip(a.x,a.y),t.isNullOrUndefined(this.toolTipField)||n===this.toolTipField||(this.toolTipObject.position={X:a.x,Y:a.y}),this.toolTipObject.show(),this.toolTipField=n}else this.hideToolTip()},e.prototype.getTooltipPosition=function(e,t,i,n){var r=this.getTop(e)*this.documentHelper.zoomFactor,o=this.getPage(e.paragraph),s=this.documentHelper.viewerContainer.getBoundingClientRect().width+this.documentHelper.viewerContainer.scrollLeft,a=o.boundingRectangle.x+t*this.documentHelper.zoomFactor;a+i.clientWidth+10>s&&(a-=i.clientWidth-(s-a)+15);var l=n?0:i.offsetHeight,d=this.getPageTop(o)+(r-l);return d=d>this.documentHelper.viewerContainer.scrollTop?d:d+e.height+l,new O(a,d)},e.prototype.createPasteElement=function(e,i){var n=new t.L10n("documenteditor",this.owner.defaultLocale);n.setLocale(this.owner.locale);var r=[{text:n.getConstant("Keep source formatting"),iconCss:"e-icons e-de-paste-source"},{text:n.getConstant("Match destination formatting"),iconCss:"e-icons e-de-paste-merge"},{text:n.getConstant("Text only"),iconCss:"e-icons e-de-paste-text"}];if(!this.pasteElement){this.pasteElement=t.createElement("div",{className:"e-de-tooltip"}),this.documentHelper.viewerContainer.appendChild(this.pasteElement);var o=t.createElement("button",{id:this.owner.containerId+"_iconsplitbtn"});this.pasteElement.appendChild(o),this.pasteDropDwn=new d.DropDownButton({items:r,iconCss:"e-icons e-de-paste",select:this.pasteOptions}),this.pasteDropDwn.appendTo(o)}this.pasteElement.style.display="block",this.pasteElement.style.position="absolute",this.pasteElement.style.left=i,this.pasteElement.style.top=e},e.prototype.showToolTip=function(e,t){this.toolTipObject||(this.toolTipObject=new n.Popup(this.toolTipElement,{height:"auto",width:"auto",relateTo:this.documentHelper.viewerContainer.parentElement,position:{X:e,Y:t}}))},e.prototype.hideToolTip=function(){this.toolTipField=void 0,this.toolTipObject&&(this.toolTipElement.style.display="none",this.toolTipObject.hide(),this.toolTipObject.destroy(),this.toolTipObject=void 0)},e.prototype.getHyperLinkFieldInCurrentSelection=function(e,i,n){var r=void 0,o=this.getTop(e),s=this.getLineStartLeft(e);if(!(i.y<o||i.y>o+e.height||i.x<s||i.x>s+e.paragraph.width)){var a=e.paragraph.x,l=this.getFirstElement(e,a);a=l.left;var d=l.element;if(t.isNullOrUndefined(d)){u=this.documentHelper.textHelper.getParagraphMarkWidth(e.paragraph.characterFormat);if(i.x<=s+u||i.x>=s+u){var h=[],c=this.getHyperLinkFields(e.paragraph,h,!1,n);return h=[],h=void 0,c}}else{if(i.x>a+d.margin.left)for(var p=e.children.indexOf(d);p<e.children.length&&(d=e.children[p],!(i.x<a+d.margin.left+d.width||p===e.children.length-1));p++)a+=d.margin.left+d.width;r=d;var u=d.margin.left+d.width;if(t.isNullOrUndefined(r.nextNode)&&(u+=this.documentHelper.textHelper.getParagraphMarkWidth(r.line.paragraph.characterFormat)),i.x<=a+u){var h=[],c=this.getHyperLinkFieldInternal(r.line.paragraph,r,h,!1,n);return h=[],h=void 0,c}}}},e.prototype.getFootNoteElementInCurrentSelection=function(e,i){var n=void 0,r=this.getTop(e),o=this.getLineStartLeft(e);if(!(i.y<r||i.y>r+e.height||i.x<o||i.x>o+e.paragraph.width)){var s=e.paragraph.x,a=this.getFirstElement(e,s);s=a.left;var l=a.element;if(t.isNullOrUndefined(l)){c=this.documentHelper.textHelper.getParagraphMarkWidth(e.paragraph.characterFormat);if(i.x<=o+c||i.x>=o+c){var d=this.documentHelper.selection.start.currentWidget.getInline(this.documentHelper.selection.start.offset,0).element;return d instanceof Ee?d:void 0}}else{if(i.x>s+l.margin.left)for(var h=e.children.indexOf(l);h<e.children.length&&(l=e.children[h],!(i.x<s+l.margin.left+l.width||h===e.children.length-1));h++)s+=l.margin.left+l.width;l instanceof Ee&&(n=l);var c=l.margin.left+l.width;if(t.isNullOrUndefined(l.nextNode)&&(c+=this.documentHelper.textHelper.getParagraphMarkWidth(l.line.paragraph.characterFormat)),i.x<=s+c)return n}}},e.prototype.getHyperlinkField=function(e){if(!t.isNullOrUndefined(this.end)){var i=0,n=this.end.currentWidget.getInline(this.end.offset,i);i=n.index;var r=n.element,o=[],s=void 0;if(t.isNullOrUndefined(r))s=this.getHyperLinkFields(this.end.paragraph,o,e);else if(this.documentHelper.isFormFillProtectedMode&&r instanceof ke&&r.previousNode instanceof xe&&1===r.previousNode.fieldType)s=void 0;else{var a=r.line.paragraph;s=this.getHyperLinkFieldInternal(a,r,o,e,!1)}return o=[],s}},e.prototype.getHyperLinkFields=function(e,i,n,r){for(var o=0;o<this.documentHelper.fields.length;o++)if(-1===i.indexOf(this.documentHelper.fields[o])&&!t.isNullOrUndefined(this.documentHelper.fields[o].fieldSeparator)){i.push(this.documentHelper.fields[o]);var s=this.getFieldCode(this.documentHelper.fields[o]);s=s.trim().toLowerCase();var a=this.paragraphIsInFieldResult(this.documentHelper.fields[o],e);if((n||!n&&s.match("hyperlink "))&&a)return this.documentHelper.fields[o];if(a&&r&&this.documentHelper.fields[o].formFieldData)return this.documentHelper.fields[o];if((n||!n&&s.match("ref "))&&a)return this.documentHelper.fields[o]}},e.prototype.getHyperLinkFieldInternal=function(e,i,n,r,o){for(var s=0;s<this.documentHelper.fields.length;s++)if(-1===n.indexOf(this.documentHelper.fields[s])&&!t.isNullOrUndefined(this.documentHelper.fields[s].fieldSeparator)){n.push(this.documentHelper.fields[s]);var a=this.getFieldCode(this.documentHelper.fields[s]);a=a.trim().toLowerCase();var l=this.documentHelper.fields[s],d=l.fieldEnd;r&&l.nextNode instanceof ke&&(d=l.nextNode.reference);var h=this.inlineIsInFieldResult(l,d,l.fieldSeparator,i,r)||this.isImageField();if((r||!r&&a.match("hyperlink "))&&h)return this.documentHelper.fields[s];if(h&&o&&this.documentHelper.fields[s].formFieldData)return this.documentHelper.fields[s];if((r||!r&&a.match("ref "))&&h)return this.documentHelper.fields[s]}if(e.containerWidget instanceof pe&&!(e instanceof ue))return this.getHyperLinkFieldInternal(e.containerWidget,i,n,r,o)},e.prototype.getBlock=function(e){if(""!==e&&!t.isNullOrUndefined(e)){var i={index:e},n=this.start.getPage(i),r=i.index.indexOf(";"),o=i.index.substring(0,r);i.index=i.index.substring(r).replace(";","");var s=n.bodyWidgets[parseInt(o,10)];return this.getBlockInternal(s,i.index)}},e.prototype.getBlockInternal=function(e,i){if(""!==i&&!t.isNullOrUndefined(i)){var n=i.indexOf(";"),r=i.substring(0,n);i=i.substring(n).replace(";","");var o=e;if(!((n=parseInt(r,10))>=0&&n<e.childWidgets.length))return o;var s=e.childWidgets[n];return i.indexOf(";")>=0?s instanceof fe?(i.indexOf(";")>=0&&(i="0"),s):s instanceof ge?this.getBlockInternal(s,i):o:s}},e.prototype.inlineIsInFieldResult=function(e,i,n,r,o){return!(t.isNullOrUndefined(i)||t.isNullOrUndefined(n)||!this.isExistBeforeInline(n,r))&&this.isExistAfterInline(i,r,o)},e.prototype.paragraphIsInFieldResult=function(e,i){if(!t.isNullOrUndefined(e.fieldEnd)&&!t.isNullOrUndefined(e.fieldSeparator)){var n=e.fieldSeparator.line.paragraph;if(e.fieldSeparator.line.paragraph===i||this.isExistBefore(n,i))return e.fieldEnd.line.paragraph!==i&&this.isExistAfter(n,i)}return!1},e.prototype.isImageField=function(){if(this.start.paragraph.isEmpty()||this.end.paragraph.isEmpty())return!1;var e=this.start,t=this.end;this.isForward||(e=this.end,t=this.start);var i=0,n=e.paragraph.getInline(e.offset,i),r=n.element;(i=n.index)===r.length&&(r=this.getNextRenderedElementBox(r,i));var o=(n=t.paragraph.getInline(t.offset,i)).element;if(i=n.index,r instanceof xe&&0===r.fieldType&&o instanceof xe&&1===o.fieldType&&r.fieldSeparator){var s=r.fieldSeparator.nextNode;if(s instanceof Ge&&s.nextNode===o)return!0}return!1},e.prototype.isFormField=function(){var e=this.getCurrentFormField();return!!(e instanceof xe&&e.formFieldData)},e.prototype.isReferenceField=function(e){if(t.isNullOrUndefined(e)&&(e=this.getHyperlinkField(!0)),e){var i=this.getFieldCode(e);if(i=i.toLowerCase(),e instanceof xe&&i.match("ref "))return!0}return!1},e.prototype.isInlineFormFillMode=function(e){return!!(this.documentHelper.isInlineFormFillProtectedMode&&(t.isNullOrUndefined(e)&&(e=this.getCurrentFormField()),e&&e.formFieldData instanceof Pe&&"Text"===e.formFieldData.type))},e.prototype.getFormFieldType=function(e){if(t.isNullOrUndefined(e)&&(e=this.getCurrentFormField()),e instanceof xe){if(e.formFieldData instanceof Pe)return"Text";if(e.formFieldData instanceof Te)return"CheckBox";if(e.formFieldData instanceof Se)return"DropDown"}},e.prototype.getCurrentFormField=function(e){var i;if(e||this.documentHelper.isFormFillProtectedMode&&this.owner.documentEditorSettings.formFieldSettings&&"Inline"===this.owner.documentEditorSettings.formFieldSettings.formFillingMode)for(var n=0;n<this.documentHelper.formFields.length;n++){var r=this.documentHelper.formFields[n];if(W.isLinkedFieldCharacter(r)){var o=r.fieldSeparator.line.getOffset(r.fieldSeparator,1),s=new Nt(this.owner);s.setPositionParagraph(r.fieldSeparator.line,o);var a=r.fieldEnd;o=a.line.getOffset(a,0);var l=new Nt(this.owner);l.setPositionParagraph(a.line,o);var d=this.start,h=this.end;if(this.isForward||(d=this.end,h=this.start),(d.isExistAfter(s)||d.isAtSamePosition(s))&&(h.isExistBefore(l)||h.isAtSamePosition(l))){i=r;break}}}else i=this.getHyperlinkField(!0);if(i instanceof xe&&0===i.fieldType&&!t.isNullOrUndefined(i.formFieldData))return i},e.prototype.getCurrentTextFrame=function(){var e=this.start.paragraph.containerWidget;do{if(e instanceof _e)return e;e&&(e=e.containerWidget)}while(e);return null},e.prototype.isTableSelected=function(){var e=this.start,i=this.end;if(this.isForward||(e=this.end,i=this.start),t.isNullOrUndefined(e.paragraph.associatedCell)||t.isNullOrUndefined(i.paragraph.associatedCell))return!1;var n=e.paragraph.associatedCell.ownerTable.getSplitWidgets(),r=this.getFirstBlockInFirstCell(n[0]),o=this.getLastBlockInLastCell(n[n.length-1]);return e.paragraph.associatedCell.equals(r.associatedCell)&&i.paragraph.associatedCell.equals(o.associatedCell)&&(!r.associatedCell.equals(o.associatedCell)||0===e.offset&&i.offset===this.getLineLength(o.lastChild)+1)},e.prototype.selectListText=function(){var e=this.documentHelper.selectionLineWidget.getHierarchicalIndex("0"),t=this.getTextPosition(e),i=this.getTextPosition(e);this.isSelectList=!0,this.selectRange(t,i),this.isSelectList=!1,this.highlightListText(this.documentHelper.selectionLineWidget),this.contextTypeInternal="List"},e.prototype.highlightListText=function(e){var t=e.children[0].width,i=this.documentHelper.getLeftValue(e),n=e.paragraph.y;this.createHighlightBorder(e,t,i,n,!1),this.documentHelper.isListTextSelected=!0},e.prototype.updateImageSize=function(e){this.owner.isShiftingEnabled=!0;var t=this.start,i=this.end;this.isForward||(t=this.end,i=this.start);var n=null,r=0,o=t.paragraph;if(o===i.paragraph&&t.offset+1===i.offset){var s=o.getInline(i.offset,r);n=s.element,r=s.index}if(n instanceof Ge||n instanceof Ve){var a=n.width,l=n.height;if(n.width=e.width,n.height=e.height,e.width=a,e.height=l,null!==o&&null!==o.containerWidget&&this.owner.editorModule){var d=o.childWidgets.indexOf(n.line),h=n.line.children.indexOf(n);this.documentHelper.layout.reLayoutParagraph(o,d,h),this.highlightSelection(!1)}}},e.prototype.getSelectedCellsInTable=function(e,t,i){for(var n=t.columnIndex,r=i.columnIndex+i.cellFormat.columnSpan-1,o=t.ownerRow.index,s=i.ownerRow.index,a=[],l=0;l<e.childWidgets.length;l++){var d=e.childWidgets[l];if(d.index>=o&&d.index<=s)for(var h=0;h<d.childWidgets.length;h++){var c=d.childWidgets[h];c.columnIndex>=n&&c.columnIndex<=r&&a.push(c)}if(d.index>s)break}return a},e.prototype.copy=function(){this.isEmpty||this.copySelectedContent(!1)},e.prototype.copySelectedContent=function(e){t.isNullOrUndefined(this.owner.sfdtExportModule)||(this.copyToClipboard(this.getHtmlContent()),e&&this.owner.editorModule&&this.owner.editorModule.handleCut(this),this.documentHelper.updateFocus())},e.prototype.getHtmlContent=function(){var e=this.start,t=this.end;this.isForward||(e=this.end,t=this.start);var i=this.owner.sfdtExportModule.write(e.currentWidget,e.offset,t.currentWidget,t.offset,!0);return this.owner.editorModule&&(this.owner.editorModule.copiedData=JSON.stringify(i)),this.htmlWriter.writeHtml(i)},e.prototype.copyToClipboard=function(e){window.getSelection().removeAllRanges();var t=document.createElement("div");t.style.left="-10000px",t.style.top="-10000px",t.style.position="relative",t.innerHTML=e,this.htmlWriter.isMergeField&&(t.innerText="",this.htmlWriter.isMergeField=!1),document.body.appendChild(t),-1!==navigator.userAgent.indexOf("Firefox")&&(t.tabIndex=0,t.focus());var i=document.createRange();i.selectNodeContents(t),window.getSelection().addRange(i);var n=!1;try{n=document.execCommand("copy")}catch(e){}finally{window.getSelection().removeAllRanges(),t.parentNode.removeChild(t)}return n},e.prototype.showCaret=function(){var e=t.isNullOrUndefined(this.documentHelper.currentPage)?this.documentHelper.currentRenderingPage:this.documentHelper.currentPage;if(!(t.isNullOrUndefined(e)||this.documentHelper.isRowOrCellResizing||this.owner.enableImageResizerMode&&this.owner.imageResizerModule.isImageResizerVisible&&!this.owner.imageResizerModule.isShapeResize)){var i,n=e.boundingRectangle.x;if(i=this.viewer instanceof re?e.boundingRectangle.width*this.documentHelper.zoomFactor+n:e.boundingRectangle.width-this.owner.viewer.padding.right-this.documentHelper.scrollbarWidth,!this.owner.enableImageResizerMode||!this.owner.imageResizerModule.isImageResizerVisible||this.owner.imageResizerModule.isShapeResize)if(this.isHideSelection(this.start.paragraph))this.caret.style.display="none";else if(this.isEmpty&&(!this.owner.isReadOnlyMode||this.owner.enableCursorOnReadOnly||this.isInlineFormFillMode())){var r=parseInt(this.caret.style.left.replace("px",""),10);this.caret.style.display=r<n||r>i?"none":"block"}else this.isImageSelected&&!this.owner.enableImageResizerMode?this.caret.style.display="block":("block"===this.caret.style.display||t.isNullOrUndefined(this))&&(this.documentHelper.isComposingIME||(this.caret.style.display="none"));if(t.isNullOrUndefined(this)||!this.documentHelper.isTouchInput||this.owner.isReadOnlyMode)this.documentHelper.touchStart.style.display="none",this.documentHelper.touchEnd.style.display="none";else{var o=parseInt(this.documentHelper.touchStart.style.left.replace("px",""),10)+14,s=parseInt(this.documentHelper.touchEnd.style.left.replace("px",""),10)+14,a=this.getSelectionPage(this.start);a&&(this.documentHelper.touchEnd.style.display=s<n||s>i?"none":"block",this.isEmpty||(n=a.boundingRectangle.x,i=a.boundingRectangle.width*this.documentHelper.zoomFactor+n),this.documentHelper.touchStart.style.display=o<n||o>i?"none":"block")}}},e.prototype.setEditableDivCaretPosition=function(e){this.documentHelper.editableDiv.focus();var t=this.documentHelper.editableDiv.childNodes[this.documentHelper.editableDiv.childNodes.length-1];if(t){var i=document.createRange();i.setStart(t,e),i.collapse(!0),window.getSelection().removeAllRanges(),window.getSelection().addRange(i)}},e.prototype.initCaret=function(){this.caret=t.createElement("div",{styles:"position:absolute",className:"e-de-blink-cursor e-de-cursor-animation"}),this.owner.documentHelper.viewerContainer.appendChild(this.caret)},e.prototype.updateCaretPosition=function(){var e=this.end.location,i=this.getSelectionPage(this.end);if(i&&!t.isNullOrUndefined(this.caret)){this.caret.style.left=i.boundingRectangle.x+Math.round(e.x)*this.documentHelper.zoomFactor+"px";var n=this.updateCaretSize(this.owner.selection.end),r=n.topMargin,o=this.viewer,s=(i.boundingRectangle.y-o.pageGap*(this.documentHelper.pages.indexOf(i)+1))*this.documentHelper.zoomFactor+o.pageGap*(this.documentHelper.pages.indexOf(i)+1);this.caret.style.top=s+Math.round(e.y+r)*this.documentHelper.zoomFactor+"px","Subscript"===this.owner.selection.characterFormat.baselineAlignment&&(this.caret.style.top=parseFloat(this.caret.style.top)+parseFloat(this.caret.style.height)/2+"px"),(this.documentHelper.isTouchInput||"none"!==this.documentHelper.touchStart.style.display)&&(this.documentHelper.touchStart.style.left=i.boundingRectangle.x+(Math.round(e.x)*this.documentHelper.zoomFactor-14)+"px",this.documentHelper.touchStart.style.top=s+(e.y+n.height)*this.documentHelper.zoomFactor+"px",this.documentHelper.touchEnd.style.left=i.boundingRectangle.x+(Math.round(e.x)*this.documentHelper.zoomFactor-14)+"px",this.documentHelper.touchEnd.style.top=s+(e.y+n.height)*this.documentHelper.zoomFactor+"px")}this.showHidePasteOptions(this.caret.style.top,this.caret.style.left)},e.prototype.showHidePasteOptions=function(e,i){if(!t.Browser.isIE)if(this.isViewPasteOptions){if(this.pasteElement&&"block"===this.pasteElement.style.display)return;this.createPasteElement(e,i)}else this.pasteElement&&(this.pasteElement.style.display="none")},e.prototype.getRect=function(e){var t=e.location,i=this.getSelectionPage(e);if(i){var n=this.owner.documentHelper,r=i.boundingRectangle.x+Math.round(t.x)*n.zoomFactor,o=this.viewer.pageGap,s=(i.boundingRectangle.y-o*(i.index+1))*n.zoomFactor+o*(i.index+1)+Math.round(t.y)*n.zoomFactor;return new O(r,s)}return new O(0,0)},e.prototype.getSelectionPage=function(e){var t=this.getLineWidgetInternal(e.currentWidget,e.offset,!0);if(t)return this.getPage(t.paragraph)},e.prototype.updateCaretSize=function(e,i){var n,r=0,o=!1,s=0,a=0;if(this.characterFormat.italic&&(o=this.characterFormat.italic),e.paragraph.isEmpty()){var l=e.paragraph,d=0,h=this.getParagraphMarkSize(l,r,d);r=h.topMargin,d=h.bottomMargin;var c=h.height;a=r<0?r+c:c,i||(this.caret.style.height=a*this.documentHelper.zoomFactor+"px"),r=0}else{var p=e.currentWidget.getInline(e.offset,s);s=p.index;var u=p.element;t.isNullOrUndefined(u)||(a=(n=this.getCaretHeight(u,s,u.characterFormat,!0,r,o)).height,i||(this.caret.style.height=n.height*this.documentHelper.zoomFactor+"px"))}return i||(this.caret.style.transform=o?"rotate(13deg)":""),{topMargin:r,height:a}},e.prototype.updateCaretToPage=function(e,i){if(!t.isNullOrUndefined(i))if(this.documentHelper.selectionEndPage=i,this.owner.selection.isEmpty)this.documentHelper.selectionStartPage=i;else{var n=this.getLineWidgetParagraph(e.offset,e.paragraph.childWidgets[0]),r=this.getPage(n.paragraph);t.isNullOrUndefined(r)||(this.documentHelper.selectionStartPage=r)}this.checkForCursorVisibility()},e.prototype.getCaretBottom=function(e,t){var i=e.location.y;if(e.paragraph.isEmpty()){var n=e.paragraph,r=0,o=0,s=this.getParagraphMarkSize(n,r,o);r=s.topMargin,o=s.bottomMargin,i+=s.height,i+=r,t||(i+=o)}else{var a=0,l=e.paragraph.getInline(e.offset,a),d=l.element;a=l.index;var r=0,h=!1,c=this.getCaretHeight(d,a,d.characterFormat,!1,r,h);r=c.topMargin,h=c.isItalic,i+=c.height,t&&(i-=W.convertPointToPixel(this.documentHelper.layout.getAfterSpacing(e.paragraph)))}return i},e.prototype.checkForCursorVisibility=function(){this.showCaret()},e.prototype.onKeyDownInternal=function(e,i,n,r){var o=e.which||e.keyCode;if(!i||n||r)if(!n||i||r)if(n&&i&&!r)switch(o){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()}else switch(o){case 33:e.preventDefault(),this.documentHelper.viewerContainer.scrollTop-=this.documentHelper.visibleBounds.height;break;case 34:e.preventDefault(),this.documentHelper.viewerContainer.scrollTop+=this.documentHelper.visibleBounds.height;break;case 35:this.handleEndKey(),e.preventDefault();break;case 36:this.handleHomeKey(),e.preventDefault();break;case 37:this.handleLeftKey(),e.preventDefault();break;case 38:this.handleUpKey(),e.preventDefault();break;case 39:this.handleRightKey(),e.preventDefault();break;case 40:this.handleDownKey(),e.preventDefault()}else switch(o){case 35:this.handleShiftEndKey(),e.preventDefault();break;case 36:this.handleShiftHomeKey(),e.preventDefault();break;case 37:this.handleShiftLeftKey(),e.preventDefault();break;case 38:this.handleShiftUpKey(),e.preventDefault();break;case 39:this.handleShiftRightKey(),e.preventDefault();break;case 40:this.handleShiftDownKey(),e.preventDefault()}else switch(this.documentHelper.isControlPressed=!0,o){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.owner.selection.selectAll();break;case 67:e.preventDefault(),this.copy();break;case 70:e.preventDefault(),t.isNullOrUndefined(this.owner.optionsPaneModule)||this.owner.optionsPaneModule.showHideOptionsPane(!0)}if(this.isFormField()&&!this.documentHelper.isDocumentProtected){var s=this.getCurrentFormField(!0);if(s&&s.formFieldData instanceof Se){s=37===e.keyCode||38===e.keyCode||40===e.keyCode?s:s.nextElement instanceof ke?s.nextElement.reference:s.fieldEnd;var a=39===e.keyCode?1:0,l=s.line.getOffset(s,a),d=this.getPhysicalPositionInternal(s.line,l,!1);this.selectInternal(s.line,s,a,d)}}!this.owner.isReadOnlyMode||this.isInlineFormFillMode()?this.owner.editorModule.onKeyDownInternal(e,i,n,r):this.documentHelper.isDocumentProtected&&"FormFieldsOnly"===this.documentHelper.protectionType&&(9!==e.keyCode&&32!==e.keyCode||this.owner.editorModule.onKeyDownInternal(e,i,n,r)),this.owner.searchModule&&!t.isNullOrUndefined(this.owner.searchModule.searchHighlighters)&&this.owner.searchModule.searchHighlighters.length>0&&this.owner.searchModule.searchResults.clear(),27!==e.keyCode&&27!==e.which||(t.isNullOrUndefined(this.owner.optionsPaneModule)||this.owner.optionsPaneModule.showHideOptionsPane(!1),this.owner.enableHeaderAndFooter&&this.disableHeaderFooter())},e.prototype.checkAndEnableHeaderFooter=function(e,t){var i=this.documentHelper.currentPage;if(this.isCursorInsidePageRect(e,i)){if(this.isCursorInHeaderRegion(e,i))return!this.owner.enableHeaderAndFooter&&this.enableHeadersFootersRegion(i.headerWidget);if(this.isCursorInFooterRegion(e,i))return!this.owner.enableHeaderAndFooter&&this.enableHeadersFootersRegion(i.footerWidget)}return!!this.owner.enableHeaderAndFooter&&(this.owner.enableHeaderAndFooter=!1,this.documentHelper.updateTextPositionForSelection(t,1),!0)},e.prototype.isCursorInsidePageRect=function(e,t){return this.viewer.containerLeft+e.x>=t.boundingRectangle.x&&this.viewer.containerLeft+e.x<=t.boundingRectangle.x+t.boundingRectangle.width*this.documentHelper.zoomFactor&&this.viewer instanceof re||this.viewer.containerLeft+e.x>=t.boundingRectangle.x&&this.viewer.containerLeft+e.x<=t.boundingRectangle.x+t.boundingRectangle.width},e.prototype.isCursorInHeaderRegion=function(e,t){if(this.viewer instanceof re){var i=this.getPageTop(t),n=0,r=t.headerWidget;r&&(n=r.y+r.height);var o=r.isEmpty&&!this.owner.enableHeaderAndFooter,s=W.convertPointToPixel(t.bodyWidgets[0].sectionFormat.topMargin),a=W.convertPointToPixel(t.bodyWidgets[0].sectionFormat.pageHeight),l=o?s:Math.min(Math.max(n,s),a/100*40);if(l*=this.documentHelper.zoomFactor,this.viewer.containerTop+e.y>=i&&this.viewer.containerTop+e.y<=i+l)return!0}return!1},e.prototype.isCursorInFooterRegion=function(e,t){if(this.viewer instanceof re){var i=t.boundingRectangle,n=this.getPageTop(t),r=n+i.height*this.documentHelper.zoomFactor,o=W.convertPointToPixel(t.bodyWidgets[0].sectionFormat.footerDistance),s=0;t.footerWidget&&(s=t.footerWidget.height);var a=W.convertPointToPixel(t.bodyWidgets[0].sectionFormat.bottomMargin),l=t.footerWidget.isEmpty&&!this.owner.enableHeaderAndFooter,d=i.height;if(d=l?(d-a)*this.documentHelper.zoomFactor:(d-Math.min(i.height/100*40,Math.max(s+o,a)))*this.documentHelper.zoomFactor,this.viewer.containerTop+e.y<=r&&this.viewer.containerTop+e.y>=n+d)return!0}return!1},e.prototype.enableHeadersFootersRegion=function(e){return this.viewer instanceof re&&(this.owner.enableHeaderAndFooter=!0,this.updateTextPositionForBlockContainer(e),this.shiftBlockOnHeaderFooterEnableDisable(),!0)},e.prototype.shiftBlockOnHeaderFooterEnableDisable=function(){for(var e=0;e<this.documentHelper.headersFooters.length;e++)for(var t=this.documentHelper.headersFooters[e],i=this.getBodyWidgetInternal(e,0).sectionFormat,n=0,r=Object.keys(t);n<r.length;n++){var o=t[r[n]];o.isEmpty&&this.owner.editor.shiftPageContent(o.headerFooterType,i)}},e.prototype.updateTextPositionForBlockContainer=function(e){var t=e.firstChild;t instanceof ve&&(t=this.getFirstBlockInFirstCell(t))instanceof ve&&(t=this.getFirstBlockInFirstCell(t)),this.selectParagraphInternal(t,!0)},e.prototype.disableHeaderFooter=function(){var e=this.getPage(this.start.paragraph);this.updateTextPositionForBlockContainer(e.bodyWidgets[0]),this.owner.enableHeaderAndFooter=!1,this.shiftBlockOnHeaderFooterEnableDisable()},e.prototype.destroy=function(){t.isNullOrUndefined(this.contextTypeInternal)||(this.contextTypeInternal=void 0),this.pasteDropDwn&&(this.pasteDropDwn.destroy(),this.pasteDropDwn=void 0),this.caret=void 0,this.contextTypeInternal=void 0,this.upDownSelectionLength=void 0,this.owner=void 0},e.prototype.navigateBookmark=function(e,t){var i=this.documentHelper.bookmarks;if(i.containsKey(e)){var n=i.get(e),r=n.line.getOffset(n,0),o=new Nt(this.owner);if(o.setPositionParagraph(n.line,r),t)this.documentHelper.selection.selectRange(o,o);else{var s=n.reference,a=s.line.getOffset(s,1),l=new Nt(this.owner);l.setPositionParagraph(s.line,a),this.documentHelper.selection.selectRange(o,l)}}},e.prototype.selectBookmark=function(e){this.navigateBookmark(e)},e.prototype.getTocField=function(){for(var e=this.start.paragraph,t=void 0;void 0!==e&&this.isTocStyle(e);)t=e,e=e.previousRenderedWidget;if(void 0!==t){var i=t.childWidgets[0];if(void 0!==i)return i.children[0]}},e.prototype.isTocStyle=function(e){var t=e.paragraphFormat.baseStyle;return void 0!==t&&-1!==t.name.toLowerCase().indexOf("toc")},e.prototype.isTOC=function(){for(var e=this.getParagraphInfo(this.start).paragraph,t=0;t<e.childWidgets[0].children.length;t++){var i=e.childWidgets[0].children[t];if(i instanceof xe){var n=this.owner.selection.getFieldCode(i);if(n.match("TOC ")||n.match("Toc"))return!0}}return!1},e.prototype.getElementsForward=function(e,i,n,r){if(!t.isNullOrUndefined(i)){for(var o=[];r&&i&&i!==n&&i.nextElement&&!i.isRightToLeft;)i=i.nextElement;for(;r&&n&&i!==n&&n.previousElement&&!n.isRightToLeft;)n=n.previousElement;for(var s=e.children.indexOf(i);s>=0;){for(var a=s;a>-1&&a<e.children.length;r?a--:a++){var l=e.children[a];if(l.line!==e){s=-1;break}if(l===n){o.push(l),s=-1;break}o.push(l)}s=-1}return 0===o.length?void 0:o}},e.prototype.getElementsBackward=function(e,t,i,n){for(var r=[];n&&t&&t.previousElement&&(!t.isRightToLeft||t instanceof Ie&&this.documentHelper.textHelper.isRTLText(t.text));)t=t.previousElement;for(var o=e.children.indexOf(t);o>=0;){for(var s=o;s>-1&&s<e.children.length;n?s++:s--){var a=e.children[s];if(a.line!==e){o=-1;break}r.push(a)}o=-1}return r},e.prototype.navigatePreviousComment=function(){this.commentNavigateInternal(!1)},e.prototype.navigateNextComment=function(){this.commentNavigateInternal(!0)},e.prototype.commentNavigateInternal=function(e){if(!this.documentHelper.currentSelectedComment){if(0===this.documentHelper.comments.length)return;this.documentHelper.currentSelectedComment=this.documentHelper.comments[0]}if(this.documentHelper.currentSelectedComment){var t=this.documentHelper.comments,i=this.documentHelper.currentSelectedComment,n=t.indexOf(i);i=e?n===t.length-1?t[0]:t[n+1]:0===n?t[t.length-1]:t[n-1],this.documentHelper.currentSelectedComment=i,this.selectComment(i)}},e.prototype.navigatePreviousRevision=function(){this.revisionNavigateInternal(!1)},e.prototype.navigateNextRevision=function(){this.revisionNavigateInternal(!0)},e.prototype.revisionNavigateInternal=function(e){if(!this.documentHelper.currentSelectedRevisionInternal){if(0===this.documentHelper.owner.revisions.length)return;this.documentHelper.currentSelectedRevision=this.documentHelper.owner.revisions.get(0)}if(this.documentHelper.currentSelectedRevision){var t=this.documentHelper.owner.revisions.changes,i=this.documentHelper.currentSelectedRevision,n=t.indexOf(i);i=e?n===t.length-1?t[0]:t[n+1]:0===n?t[t.length-1]:t[n-1],this.documentHelper.currentSelectedRevision=i,this.selectRevision(i)}this.owner.trackChangesPane.currentSelectedRevision=this.documentHelper.currentSelectedRevision},e.prototype.selectComment=function(e){if(!t.isNullOrUndefined(e)){var i=this.getElementPosition(e.commentStart).startPosition,n=this.getElementPosition(e.commentEnd).startPosition;this.selectPosition(i,n),this.owner.commentReviewPane&&this.owner.commentReviewPane.selectComment(e)}},e.prototype.selectRevision=function(e){if(!t.isNullOrUndefined(e)&&e.range.length>0){var i=e.range[0],n=e.range[e.range.length-1];if(i instanceof I){var r=i.ownerBase,o=r.childWidgets[0],s=r.childWidgets[r.childWidgets.length-1],a=this.getFirstParagraph(o),l=this.getLastParagraph(s);this.start.setPosition(a.firstChild,!0),this.end.setPositionParagraph(l.lastChild,l.lastChild.getEndOffset()+1),this.selectPosition(this.start,this.end)}else if(i&&n){var d=new Nt(this.owner),h=0;i instanceof H?(h=(p=i.ownerBase).getLength(),d.setPositionParagraph(p.lastChild,h)):(h=i.line.getOffset(i,0),d.setPositionForLineWidget(i.line,h));var c=new Nt(this.owner);if(n instanceof H){var p=n.ownerBase;p.isEndsWithPageBreak?(this.owner.trackChangesPane.isTrackingPageBreak=!0,c.setPositionParagraph(p.nextRenderedWidget.childWidgets[0],0)):(h=p.getLength(),c.setPositionParagraph(p.lastChild,h+1))}else h=n.line.getOffset(n,0)+n.length,this.isTOC()&&(h+=1),c.setPositionForLineWidget(n.line,h);var u=d.clone();d.isExistBefore(c)||(d=c,c=u),this.selectPosition(d,c)}}},e.prototype.updateEditRangeCollection=function(){this.editRangeCollection.length>0&&(this.editRangeCollection=[]);var e,t;if(this.documentHelper.isDocumentProtected){if(this.documentHelper.editRanges.containsKey(this.owner.currentUser)){e=this.documentHelper.editRanges.get(this.owner.currentUser);for(r=0;r<e.length;r++)this.editRangeCollection.push(e[r])}if(this.documentHelper.editRanges.containsKey("Everyone")){n="Everyone";t=this.documentHelper.editRanges.get(n);for(r=0;r<t.length;r++)this.editRangeCollection.push(t[r])}}else for(var i=0;i<this.documentHelper.editRanges.length;i++){var n=this.documentHelper.editRanges.keys[i];e=this.documentHelper.editRanges.get(n);for(var r=0;r<e.length;r++)this.editRangeCollection.push(e[r])}},e.prototype.onHighlight=function(){this.isHighlightEditRegion?this.highlightEditRegion():this.unHighlightEditRegion(),this.viewer.renderVisiblePages()},e.prototype.highlightEditRegion=function(){if(this.updateEditRangeCollection(),!this.owner.enableLockAndEdit){if(!this.isHighlightEditRegion)return void this.unHighlightEditRegion();this.isHightlightEditRegionInternal=!0,t.isNullOrUndefined(this.editRegionHighlighters)&&(this.editRegionHighlighters=new g),this.editRegionHighlighters.clear();for(var e=0;e<this.editRangeCollection.length;e++)this.highlightEditRegionInternal(this.editRangeCollection[e]);this.isHightlightEditRegionInternal=!1,this.viewer.updateScrollBars()}},e.prototype.highlightFormFields=function(){t.isNullOrUndefined(this.formFieldHighlighters)&&(this.formFieldHighlighters=new g),this.formFieldHighlighters.clear();var e=this.documentHelper.formFields;if(!t.isNullOrUndefined(e)&&e.length>0){for(var i=0;i<e.length;i++){var n=e[i];if(W.isLinkedFieldCharacter(n)){var r=n.line.getOffset(n,0),o=new Nt(this.owner);o.setPositionParagraph(n.line,r);var s=n.fieldEnd;r=s.line.getOffset(s,1);var a=new Nt(this.owner);a.setPositionParagraph(s.line,r),this.isHighlightFormFields=!0,this.highlight(o.paragraph,o,a),this.isHighlightNext&&(this.highlightNextBlock(this.hightLightNextParagraph,o,a),this.isHighlightNext=!1,this.hightLightNextParagraph=void 0)}}this.isHighlightFormFields=!1,this.viewer.updateScrollBars()}},e.prototype.unHighlightEditRegion=function(){t.isNullOrUndefined(this.editRegionHighlighters)||(this.editRegionHighlighters.clear(),this.editRegionHighlighters=void 0),this.isHightlightEditRegionInternal=!1},e.prototype.highlightEditRegionInternal=function(e){var t=this.getPosition(e),i=t.startPosition,n=t.endPosition;this.isCurrentUser=!0,this.highlightEditRegions(e,i,n),this.isCurrentUser=!1},e.prototype.showAllEditingRegion=function(){0===this.editRangeCollection.length&&this.updateEditRangeCollection(),this.documentHelper.clearSelectionHighlight();for(var e=0;e<this.editRangeCollection.length;e++){var t=this.editRangeCollection[e],i=this.getPosition(t),n=i.startPosition,r=i.endPosition;this.highlightEditRegions(t,n,r)}},e.prototype.highlightEditRegions=function(e,t,i){if(!e.line.paragraph.isInsideTable||e.line.paragraph.isInsideTable&&!e.editRangeEnd.line.paragraph.isInsideTable)this.highlight(e.line.paragraph,t,i),this.isHighlightNext&&(this.highlightNextBlock(this.hightLightNextParagraph,t,i),this.isHighlightNext=!1,this.hightLightNextParagraph=void 0);else{var n=e.line.paragraph.associatedCell.ownerRow.childWidgets[e.columnFirst];if(n)for(var r=0;r<n.childWidgets.length;r++)n.childWidgets[r]instanceof fe&&(this.highlight(n.childWidgets[r],t,i),this.isHighlightNext&&(this.highlightNextBlock(this.hightLightNextParagraph,t,i),this.isHighlightNext=!1,this.hightLightNextParagraph=void 0))}},e.prototype.navigateToNextEditingRegion=function(){for(var e=this.getEditRangeStartElement(),t=this.editRangeCollection.length-1;t>=0;t--)for(var i=1;i<=t;i++){var n=this.getPosition(this.editRangeCollection[i-1]).startPosition,r=this.getPosition(this.editRangeCollection[i]).startPosition;if(n.isExistAfter(r)){var o=this.editRangeCollection[i-1];this.editRangeCollection[i-1]=this.editRangeCollection[i],this.editRangeCollection[i]=o}}var s=this.editRangeCollection.indexOf(e),a=s<this.editRangeCollection.length-1?this.editRangeCollection[s+1]:this.editRangeCollection[0],l=this.getPosition(a),d=l.startPosition,h=l.endPosition;this.selectRange(d,h)},e.prototype.toggleEditingRegionHighlight=function(){this.isHighlightEditRegion=!this.isHighlightEditRegion},e.prototype.getEditRangeStartElement=function(){for(var e=0;e<this.editRangeCollection.length;e++){var t=this.editRangeCollection[e],i=this.getPosition(t),n=i.startPosition,r=i.endPosition;if((this.start.isExistAfter(n)||this.start.isAtSamePosition(n))&&(this.end.isExistBefore(r)||this.end.isAtSamePosition(r)))return t}},e.prototype.isSelectionInEditRegion=function(){return!!this.documentHelper.isDocumentProtected&&this.checkSelectionIsAtEditRegion()},e.prototype.checkSelectionIsAtEditRegion=function(e,i){for(var n=0;n<this.editRangeCollection.length;n++){var r=this.editRangeCollection[n],o=this.getPosition(r),s=o.startPosition,a=o.endPosition;if(t.isNullOrUndefined(e)&&t.isNullOrUndefined(i)&&(e=this.start,i=this.end,this.isForward||(e=this.end,i=this.start)),(e.isExistAfter(s)||e.isAtSamePosition(s))&&(i.isExistBefore(a)||i.isAtSamePosition(a)))return!0}return!1},e.prototype.getPosition=function(e){var t=e.line.getOffset(e,1),i=new Nt(this.owner);i.setPositionParagraph(e.line,t);var n;e instanceof Ye?n=e.editRangeEnd:e instanceof Le?n=e.reference:e instanceof ke&&(n=e.reference),t=n.line.getOffset(n,1);var r=new Nt(this.owner);return r.setPositionParagraph(n.line,t),{startPosition:i,endPosition:r}},e.prototype.checkContentControlLocked=function(e){this.owner.editorModule.isXmlMapped=!1;for(var i=0;i<this.documentHelper.contentControlCollection.length;i++){var n=this.documentHelper.contentControlCollection[i],r=this.getPosition(n),o=r.startPosition,s=r.endPosition,a=this.start,l=this.end;if(this.isForward||(a=this.end,l=this.start),t.isNullOrUndefined(e)){var d=(o.isExistAfter(a)||o.isAtSamePosition(a))&&(o.isExistBefore(l)||o.isAtSamePosition(l)),h=(s.isExistAfter(a)||s.isAtSamePosition(a))&&(s.isExistBefore(l)||s.isAtSamePosition(l));if(d&&h)return!!n.contentControlProperties.lockContentControl&&(this.owner.trigger("contentControl"),!0);if((d||h)&&!o.isAtSamePosition(a)&&!s.isAtSamePosition(a))return!0}if((a.isExistAfter(o)||a.isAtSamePosition(o))&&(l.isExistBefore(s)||l.isAtSamePosition(s))){if(n.contentControlProperties.xmlMapping&&n.contentControlProperties.xmlMapping.isMapped&&(this.owner.editorModule.isXmlMapped=!0),n.contentControlProperties.lockContents)return this.owner.trigger("contentControl"),!0;if(t.isNullOrUndefined(e)&&("CheckBox"===n.contentControlProperties.type||"ComboBox"===n.contentControlProperties.type||"DropDownList"===n.contentControlProperties.type||"Date"===n.contentControlProperties.type))return this.owner.trigger("contentControl"),!0}}return!1},e.prototype.getElementPosition=function(e,t){var i=e.line.getOffset(e,t?0:1),n=new Nt(this.owner);return n.setPositionParagraph(e.line,i),{startPosition:n,endPosition:void 0}},e.prototype.updateRefField=function(e){if(t.isNullOrUndefined(e)&&(e=this.getHyperlinkField(!0)),!t.isNullOrUndefined(e)){if(!this.isReferenceField(e))return;var i=this.getFieldCode(e);if(0===(i=i.trim()).toLowerCase().indexOf("ref")){var n=i.split(" ");if(n.length>1){var r=n[1];if(this.documentHelper.bookmarks.containsKey(r)){var o=this.start,s=this.end;this.isForward||(o=this.end,s=this.start);var a=this.documentHelper.bookmarks.get(r),l=a.reference,d=a.previousNode;d instanceof xe&&0===d.fieldType&&!t.isNullOrUndefined(d.formFieldData)&&(a=d.fieldSeparator,l=d.fieldEnd);var h=a.line.getOffset(a,1);o.setPositionParagraph(a.line,h),s.setPositionParagraph(l.line,l.line.getOffset(l,0));var c=this.owner.sfdtExportModule.write(o.currentWidget,o.offset,s.currentWidget,s.offset,!1,!0),p=e.fieldSeparator,u=e.fieldEnd;o.setPositionParagraph(p.line,p.line.getOffset(p,1)),s.setPositionParagraph(u.line,u.line.getOffset(u,0)),this.owner.editor.pasteContents(c)}}}}},e.prototype.footnoteReferenceElement=function(e,i,n){var r=0;if(this.getContainerWidget(e.paragraph)instanceof me)for(var o=this.start.paragraph.footNoteReference,s=0;s<this.documentHelper.pages.length;s++){r=0;for(var a=this.documentHelper.pages[s],l=0;l<a.bodyWidgets.length;l++)for(var d=a.bodyWidgets[l],h=0;h<d.childWidgets.length;h++)for(var c=d.childWidgets[h],p=0;p<c.childWidgets.length;p++){var u=c.childWidgets[p];if(r=0,!t.isNullOrUndefined(u.children))for(var g=0;g<u.children.length;g++){var m=u.children[g];r+=m.length,m instanceof Ee&&m===o&&(e.setPositionParagraph(u,r-1),i.setPositionParagraph(u,r),this.selectRange(e,i))}}}},e}(),kt=function(){function e(e){this.wordBefore="\\b",this.wordAfter="\\b",this.isHeader=!1,this.isFooter=!1,this.owner=e,this.documentHelper=this.owner.documentHelper}return e.prototype.find=function(e,t){return this.findNext(e,t,"0;0;0")},e.prototype.findNext=function(e,t,i){"string"==typeof e&&(e=this.stringToRegex(e,t)),void 0===i&&(i="0;0;0"),this.owner.searchModule.textSearchResults.clearResults();var n=this.owner.searchModule.textSearchResults;return this.findDocument(n,e,!0,t,i),n.length,n.currentSearchResult},e.prototype.stringToRegex=function(e,t){if(e.indexOf("\\")>-1&&(e=e.split("\\").join("\\\\")),e.indexOf("(")>-1||e.indexOf(")")>-1||e.indexOf(".")>-1||e.indexOf("[")>-1||e.indexOf("]")>-1||e.indexOf("$")>-1||e.indexOf("{")>-1||e.indexOf("}")>-1||e.indexOf("*")>-1||e.indexOf("|")>-1||e.indexOf("^")>-1||e.indexOf("?")>-1){for(var i="",n=0;n<e.length;n++)"("===e[n]||")"===e[n]||"."===e[n]||"["===e[n]||"]"===e[n]||"$"===e[n]||"{"===e[n]||"}"===e[n]||"*"===e[n]||"|"===e[n]||"^"===e[n]||"?"===e[n]?i+="\\"+e[n]:i+=e[n];e=i}return"WholeWord"!==t&&"CaseSensitiveWholeWord"!==t||(e=this.wordBefore+e+this.wordAfter),new RegExp(e,"CaseSensitive"===t||"CaseSensitiveWholeWord"===t?"g":"ig")},e.prototype.isPatternEmpty=function(e){var t=this.wordBefore+this.wordAfter,i=e.toString();return 0===i.length||i===t},e.prototype.findAll=function(e,i,n){"string"==typeof e&&(e=this.stringToRegex(e,i)),void 0===n&&(n="0;0;0"),this.owner.searchModule.textSearchResults.clearResults();var r=this.owner.searchModule.textSearchResults;if(this.findDocument(r,e,!1,i,n),r.length>0&&r.currentIndex<0&&(r.currentIndex=0),!t.isNullOrUndefined(r.currentSearchResult)){var o={source:this.documentHelper.owner};return this.documentHelper.owner.trigger("searchResultsChange",o),r}},e.prototype.getElementInfo=function(e,i,n){for(var r=e,o="",s=new g;;){if(e instanceof Ie&&!t.isNullOrUndefined(e.text)&&""!==e.text)s.add(e,o.length),o+=e===r?e.text.substring(i):e.text;else if(e instanceof xe){var a=e;t.isNullOrUndefined(a.fieldEnd)||(e=t.isNullOrUndefined(a.fieldSeparator)?a.fieldEnd:a.fieldSeparator)}if(!t.isNullOrUndefined(e)&&t.isNullOrUndefined(e.nextNode))break;if(!t.isNullOrUndefined(e))if(t.isNullOrUndefined(n)||n)e=e.nextNode;else{var l=e.line.children,d=e.line.children.length;if(!(l.indexOf(e)<d-1)){e=void 0;break}e=e.nextNode}}return{elementsWithOffset:s,fullText:o.toString()}},e.prototype.updateMatchedTextLocation=function(e,i,n,r,o,s,a,l){for(var d=0;d<e.length;d++){var h=e[d],c=void 0;if(t.isNullOrUndefined(l)||!(h.index<l)){for(var p=i.addResult(),u=n.keys,g=0;g<u.length;g++){var m=u[g],f=n.get(m),v=m.length;if(m===o&&(v-=r),t.isNullOrUndefined(p.start)&&h.index<f+v){y=h.index-f;m===o&&(y+=r);b=m.line.getOffset(m,y);p.start=this.getTextPosition(m.line,b.toString()),p.start.location=this.owner.selection.getPhysicalPositionInternal(m.line,b,!0),p.start.setPositionParagraph(m.line,b)}if(h.index+h[0].length<=f+v){var y=h.index+h[0].length-f;m===o&&(y+=r);var b=m.line.getOffset(m,y);p.end=this.getTextPosition(m.line,b.toString()),p.end.location=this.owner.selection.getPhysicalPositionInternal(m.line,b,!0),p.end.setPositionParagraph(m.line,b),c=!0;break}}if(p.isHeader=this.isHeader,p.isFooter=this.isFooter,s){i.currentIndex=0;break}if(i.currentIndex<0&&!t.isNullOrUndefined(a)&&(a.isExistBefore(p.start)||a.isAtSamePosition(p.start))&&(i.currentIndex=i.indexOf(p)),!t.isNullOrUndefined(l)&&c)break}}},e.prototype.findDocument=function(e,i,n,r,o){if(!this.isPatternEmpty(i)){void 0===r&&(r="None");var s=void 0,a=void 0;if(void 0!==o&&(a=this.owner.selection.end),void 0!==o&&n&&void 0!==a&&void 0!==a.paragraph&&a.paragraph instanceof fe){var l=0,d=a.currentWidget.getInline(this.owner.selection.start.offset,l);if(s=d.element,l=d.index,!t.isNullOrUndefined(s)){var h=void 0;for(h=this.findInline(s,i,r,l,n,e,a);0===e.length&&!t.isNullOrUndefined(h);){for(;!t.isNullOrUndefined(h)&&0===h.childWidgets.length;)h=this.owner.selection.getNextParagraph(h.containerWidget);if(t.isNullOrUndefined(h))break;var c=h.childWidgets[0];if(s=c.children[0]instanceof Ke?c.children[2]instanceof Ie?c.children[2]:void 0:c.children[0],t.isNullOrUndefined(s))break;h=this.findInline(s,i,r,0,n,e,a)}if(e.length>0)return}}var p;for(p=this.documentHelper.pages[0].bodyWidgets[0];!t.isNullOrUndefined(p)&&0===p.childWidgets.length;)p=p.nextWidget;if(!t.isNullOrUndefined(p)&&0!==p.childWidgets.length){this.isHeader=!1,this.isFooter=!1,this.findInlineText(p,i,r,n,e,a);for(g=0;g<this.documentHelper.pages.length;g++){var u=this.documentHelper.pages[g].headerWidget;t.isNullOrUndefined(u)||(this.isHeader=!0,this.isFooter=!1,this.findInlineText(u,i,r,n,e,a))}for(var g=0;g<this.documentHelper.pages.length;g++){var m=this.documentHelper.pages[g].footerWidget;t.isNullOrUndefined(m)||(this.isHeader=!1,this.isFooter=!0,this.findInlineText(m,i,r,n,e,a))}n&&!t.isNullOrUndefined(e)&&e.length}}},e.prototype.findInlineText=function(e,i,n,r,o,s){for(var a=this.owner.selection.getFirstParagraphBlock(e.childWidgets[0]);!t.isNullOrUndefined(a)&&1===a.childWidgets.length&&0===a.childWidgets[0].children.length;)a=this.owner.selection.getNextParagraphBlock(a);for(;!t.isNullOrUndefined(a)&&a.childWidgets.length>0;){var l=a.childWidgets[0].children[0];if(t.isNullOrUndefined(l))break;for(this.findInline(l,i,n,0,r,o,s),a=this.owner.selection.getNextParagraphBlock(a);!t.isNullOrUndefined(a)&&1===a.childWidgets.length&&0===a.childWidgets[0].children.length;)a=this.owner.selection.getNextParagraphBlock(a)}r&&!t.isNullOrUndefined(o)&&o.length},e.prototype.findInline=function(e,i,n,r,o,s,a){for(var l,d=e,h=this.getElementInfo(e,r),c=h.fullText,p=[],u=h.elementsWithOffset;!t.isNullOrUndefined(l=i.exec(c));)p.push(l);if(this.updateMatchedTextLocation(p,s,u,r,d,o,a),!o)return this.owner.selection.getNextParagraphBlock(e.line.paragraph)},e.prototype.getTextPosition=function(e,t){var i=new Nt(this.owner),n=i.getHierarchicalIndex(e,t);return i.setPositionForCurrentIndex(n),i},e}(),Lt=function(){function e(e,t){this.leftInternal=0,this.widthInternal=0,this.leftInternal=e,this.widthInternal=t}return Object.defineProperty(e.prototype,"left",{get:function(){return this.leftInternal},set:function(e){this.leftInternal=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.widthInternal},set:function(e){this.widthInternal=e},enumerable:!0,configurable:!0}),e}(),Bt=function(){function e(e){this.startIn=void 0,this.endIn=void 0,this.owner=e,this.documentHelper=this.owner.documentHelper}return Object.defineProperty(e.prototype,"start",{get:function(){return this.startIn},set:function(e){this.startIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"end",{get:function(){return this.endIn},set:function(e){this.endIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this.documentHelper.selection.getTextInternal(this.start,this.end,!1)},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){this.start=void 0,this.end=void 0},e}(),Rt=function(){function e(e){this.currentIndex=-1,this.owner=e}return Object.defineProperty(e.prototype,"length",{get:function(){return void 0===this.innerList?0:this.innerList.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentSearchResult",{get:function(){if(!(void 0===this.innerList||this.currentIndex<0||this.currentIndex>=this.length))return this.innerList[this.currentIndex]},enumerable:!0,configurable:!0}),e.prototype.addResult=function(){var e=new Bt(this.owner);return t.isNullOrUndefined(this.innerList)&&(this.innerList=[]),this.innerList.push(e),e},e.prototype.clearResults=function(){if(this.currentIndex=-1,!t.isNullOrUndefined(this.innerList))for(var e=this.innerList.length-1;e>=0;e--)this.innerList[e].destroy(),this.innerList.splice(e,1)},e.prototype.indexOf=function(e){return t.isNullOrUndefined(this.innerList)?-1:this.innerList.indexOf(e)},e.prototype.destroy=function(){t.isNullOrUndefined(this.innerList)||this.clearResults(),this.innerList=void 0},e}(),Dt=function(){function e(e){this.searchModule=e}return Object.defineProperty(e.prototype,"length",{get:function(){return this.searchModule.textSearchResults.length},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"index",{get:function(){return this.searchModule.textSearchResults.currentIndex},set:function(e){0===this.length||e<0||e>this.searchModule.textSearchResults.length-1||(this.searchModule.textSearchResults.currentIndex=e,this.navigate())},enumerable:!0,configurable:!0}),e.prototype.getTextSearchResultsOffset=function(){for(var e,t=[],i=0;i<this.searchModule.textSearchResults.innerList.length;i++)e=this.getOffset(this.searchModule.textSearchResults.innerList[i]),t.push(e);return t},e.prototype.getOffset=function(e){var t=e.start,i=e.end,n=this.searchModule.documentHelper.owner.selection.getParagraphInfo(t),r=this.searchModule.documentHelper.owner.selection.getHierarchicalIndex(n.paragraph,n.offset.toString());return n=this.searchModule.documentHelper.owner.selection.getParagraphInfo(i),{startOffset:r,endOffset:this.searchModule.documentHelper.owner.selection.getHierarchicalIndex(n.paragraph,n.offset.toString())}},e.prototype.getModuleName=function(){return"SearchResults"},e.prototype.replace=function(e){-1!==this.index&&this.searchModule.replaceInternal(e)},e.prototype.replaceAll=function(e){-1!==this.index&&this.searchModule.replaceAllInternal(e)},e.prototype.navigate=function(){this.searchModule.navigate(this.searchModule.textSearchResults.currentSearchResult),this.searchModule.highlight(this.searchModule.textSearchResults)},e.prototype.clear=function(){this.searchModule.textSearchResults.clearResults(),this.searchModule.clearSearchHighlight(),this.searchModule.viewer.renderVisiblePages()},e}(),Mt=function(){function e(e){this.searchHighlighters=void 0,this.isHandledOddPageHeader=void 0,this.isHandledEvenPageHeader=void 0,this.isHandledOddPageFooter=void 0,this.isHandledEvenPageFooter=void 0,this.owner=e,this.searchHighlighters=new g,this.textSearch=new kt(this.owner),this.textSearchResults=new Rt(this.owner),this.searchResultsInternal=new Dt(this)}return Object.defineProperty(e.prototype,"viewer",{get:function(){return this.owner.viewer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"searchResults",{get:function(){return this.searchResultsInternal},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"documentHelper",{get:function(){return this.owner.documentHelper},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"Search"},e.prototype.find=function(e,i){t.isNullOrUndefined(i)&&(i="None");var n=this.textSearch.find(e,i);t.isNullOrUndefined(n)||this.navigate(n)},e.prototype.findAll=function(e,i){if(!t.isNullOrUndefined(e||""===e)){t.isNullOrUndefined(i)&&(i="None");var n=this.textSearch.findAll(e,i);!t.isNullOrUndefined(n)&&n.length>0&&(this.navigate(n.innerList[n.currentIndex]),this.highlight(n))}},e.prototype.replace=function(e,i,n){if(t.isNullOrUndefined(this.viewer.owner)||this.viewer.owner.isReadOnlyMode||t.isNullOrUndefined(n))return 0;t.isNullOrUndefined(this.viewer)||this.clearSearchHighlight(),this.navigate(i);var r=this.documentHelper.selection.start;if(this.owner.enableTrackChanges&&this.documentHelper.selection.start.currentWidget){this.documentHelper.selection.end.currentWidget.getInline(this.owner.selection.start.offset,0).element.revisions.length>0&&(this.isRepalceTracking=!0)}if(n.indexOf(i)<0)return 0;this.owner.editorModule.insertTextInternal(e,!0);var o=i.end,s=new Nt(this.viewer.owner);s.setPositionParagraph(o.currentWidget,r.offset-e.length),this.documentHelper.selection.selectRange(r,s);var a={source:this.viewer.owner};return this.viewer.owner.trigger("searchResultsChange",a),1},e.prototype.replaceInternal=function(e,i){if(""!==e&&!t.isNullOrUndefined(e)){t.isNullOrUndefined(i)&&(i="None");var n=this.textSearchResults.currentSearchResult.text,r=this.viewer.owner.searchModule.textSearch.stringToRegex(n,i),o=this.owner.selection.end.getHierarchicalIndexInternal(),s=this.viewer.owner.searchModule.textSearch.findNext(r,i,o);t.isNullOrUndefined(s)||(this.navigate(s),this.textSearchResults.addResult(),this.textSearchResults.innerList[0]=s,this.replace(e,s,this.textSearchResults),o=this.owner.selection.end.getHierarchicalIndexInternal(),(s=this.textSearch.findNext(n,i,o))&&(this.textSearchResults.addResult(),this.textSearchResults.innerList[0]=s,this.navigate(s)))}},e.prototype.replaceAll=function(e,i){if(t.isNullOrUndefined(this.viewer.owner)||this.viewer.owner.isReadOnlyMode||t.isNullOrUndefined(i))return 0;this.owner.editorHistory&&this.owner.editorHistory.initComplexHistory(this.owner.selection,"ReplaceAll");var n=i.length;this.viewer.owner.isLayoutEnabled=!1;for(var r=n-1;r>=0;r--){var o=i.innerList[r];this.navigate(i.innerList[r]),this.owner.editorModule.insertTextInternal(e,!0),(o.isHeader||o.isFooter)&&this.documentHelper.layout.updateHeaderFooterToParent(this.documentHelper.selection.start.paragraph.bodyWidget),i.innerList[r].destroy()}return this.owner.editorHistory&&!t.isNullOrUndefined(this.owner.editorHistory.currentHistoryInfo)?this.owner.editorHistory.updateComplexHistory():this.owner.editorModule.updateComplexWithoutHistory(2),this.searchResults.clear(),n},e.prototype.replaceAllInternal=function(e,i){t.isNullOrUndefined(e)||(t.isNullOrUndefined(i)&&(i="None"),this.textSearchResults.length>0&&(this.navigate(this.textSearchResults.innerList[this.textSearchResults.currentIndex]),this.highlight(this.textSearchResults),this.replaceAll(e,this.textSearchResults)))},e.prototype.navigate=function(e){if(e){var i=e.start,n=e.end;t.isNullOrUndefined(this.owner)||t.isNullOrUndefined(this.owner.selection)||t.isNullOrUndefined(i)||t.isNullOrUndefined(n)||t.isNullOrUndefined(i.paragraph)||t.isNullOrUndefined(n.paragraph)||this.owner.selection.selectRange(i,n)}},e.prototype.highlight=function(e){this.searchHighlighters=new g;for(var t=0;t<e.innerList.length;t++){var i=e.innerList[t];this.highlightResult(i)}this.viewer.renderVisiblePages()},e.prototype.highlightResult=function(e){this.highlightSearchResult(e.start.paragraph,e.start,e.end)},e.prototype.highlightSearchResult=function(e,i,n){var r=0,o=0,s=null,a=null,l=this.documentHelper.selection.getStartLineWidget(e,i,s,r);r=l.index;var d=(s=l.element)?s.line:e.childWidgets[0],h=this.documentHelper.selection.getEndLineWidget(n,a,o);o=h.index;var c=(a=h.element)?a.line:n.paragraph.childWidgets[n.paragraph.childWidgets.length-1],p=this.documentHelper.selection.getTop(d),u=this.documentHelper.selection.getLeftInternal(d,s,r);if(t.isNullOrUndefined(d)||d!==c){if(!t.isNullOrUndefined(d)){e!==d.paragraph&&(e=d.paragraph);x=this.documentHelper.selection.getWidth(d,!0)-(u-d.paragraph.x);if(e.bidi||s instanceof Ie&&s.isRightToLeft){var g=0,m=this.documentHelper.selection.getElementsForward(d,s,a,e.bidi);if(m)for(var f=!1,v=0;v<m.length;v++){var y=m[v],b=y instanceof Ie?y.length:1;g=this.documentHelper.selection.getLeftInternal(d,y,b),f=!1,u=y===s?this.documentHelper.selection.getLeftInternal(d,y,r):this.documentHelper.selection.getLeftInternal(d,y,0),y instanceof Ie&&(f=y.isRightToLeft),x=Math.abs(g-u),this.createHighlightBorder(d,x,f?g:u,p)}}else this.createHighlightBorder(d,x,u,p);for(var w=d.paragraph.childWidgets.indexOf(d),v=0;v<e.childWidgets.length;v++){if(e===d.paragraph&&(w+=1),this.highlightSearchResultParaWidget(e,w,c,a,o),e===c.paragraph)return;w=0}}}else{var g=this.documentHelper.selection.getLeftInternal(c,a,o),C=!1;a instanceof Ie&&(C=a.isRightToLeft);var x=0;if(x=Math.abs(g-u),!C&&s instanceof Ie&&(C=s.isRightToLeft),C||e.bidi){var F=this.documentHelper.selection.getElementsForward(d,s,a,e.bidi);if(F&&F.length>1)for(v=0;v<F.length;v++){var f=!1,b=(y=F[v])instanceof Ie?y.length:1;y===s?(u=this.documentHelper.selection.getLeftInternal(d,y,r),g=this.documentHelper.selection.getLeftInternal(d,y,b)):y===a?(u=this.documentHelper.selection.getLeftInternal(d,y,0),g=this.documentHelper.selection.getLeftInternal(d,y,o)):(u=this.documentHelper.selection.getLeftInternal(d,y,0),g=this.documentHelper.selection.getLeftInternal(d,y,b)),y instanceof Ie&&(f=y.isRightToLeft),x=Math.abs(g-u),this.createHighlightBorder(d,x,f?g:u,p)}else this.createHighlightBorder(d,x,C?g:u,p)}else this.createHighlightBorder(d,x,u,p)}},e.prototype.createHighlightBorder=function(e,t,i,n){var r=this.addSearchHighlightBorder(e),o=this.viewer.owner.selection.getPage(e.paragraph);o.boundingRectangle.y,o.boundingRectangle.x;r.left=Math.ceil(i),n=Math.ceil(n),r.width=Math.floor(t);Math.floor(e.height),this.documentHelper.containerContext},e.prototype.addSearchHighlightBorder=function(e){var t=void 0,i=this.searchHighlighters;i.containsKey(e)?t=i.get(e):(t=[],i.add(e,t));var n=new Lt(0,0);return t.push(n),n},e.prototype.highlightSearchResultParaWidget=function(e,t,i,n,r){for(var o=0,s=0,a=!1,l=t;l<e.childWidgets.length;l++){var d=e.childWidgets[l];l===t&&(o=this.documentHelper.selection.getTop(d));var h=this.documentHelper.selection.getLeft(d);if(n instanceof Ie&&(a=n.isRightToLeft),d===i){var c=0;if(a||e.bidi){for(var p=this.documentHelper.selection.getElementsBackward(d,n,n,e.bidi),u=0;u<p.length;u++){var g=p[u],m=!1;if(h=this.documentHelper.selection.getLeftInternal(d,g,0),g===n)c=this.documentHelper.selection.getLeftInternal(d,g,r);else{var f=g instanceof Ie?g.length:1;c=this.documentHelper.selection.getLeftInternal(d,g,f)}g instanceof Ie&&(m=g.isRightToLeft),s=Math.abs(c-h),this.createHighlightBorder(d,s,m?c:h,o)}return}return c=this.documentHelper.selection.getLeftInternal(i,n,r),s=Math.abs(c-h),void this.createHighlightBorder(d,s,a?c:h,o)}s=this.documentHelper.selection.getWidth(d,!0)-(h-e.x),this.createHighlightBorder(d,s,h,o),o+=d.height}},e.prototype.addSearchResultItems=function(e){t.isNullOrUndefined(e)||""===e||(t.isNullOrUndefined(this.owner.findResultsList)&&(this.owner.findResultsList=[]),this.owner.findResultsList.push(e))},e.prototype.addFindResultView=function(e){for(var t=0;t<e.innerList.length;t++){var i=e.innerList[t];this.addFindResultViewForSearch(i)}this.isHandledOddPageHeader=!0,this.isHandledOddPageFooter=!0,this.isHandledEvenPageHeader=!0,this.isHandledEvenPageFooter=!0},e.prototype.addFindResultViewForSearch=function(e){if(null!=e.start&&null!=e.end&&null!=e.start.paragraph&&null!=e.end.paragraph){var i=void 0,n=0,r=e.start.currentWidget.getInline(e.start.offset,n),o=r.element;n=r.index;var s="",a=0;if(o instanceof xe){var l=this.owner.selection.getRenderedInline(o,n);l.element.nextNode instanceof Ie?(o=l.element.nextNode,n=l.index):(o=l.element,n=l.index)}var d=this.owner.selection.getElementBoxInternal(o,n),h=d.element;if(n=d.index,null!=h){h instanceof Ie&&n>0&&(s=h.text.substring(0,n));m=h.line.children.indexOf(h);for(a=s.lastIndexOf(" ");a<0&&m>0&&h.line.children[m-1]instanceof Ie;)s=h.line.children[m-1].text+s,m--,a=s.lastIndexOf(" ")}var c=s.lastIndexOf("\v");c>0?s=s.substring(0,c):(a=s.lastIndexOf(" "))<0?s:s.substring(a+1),e.text;var p=0,u=e.end.currentWidget.getInline(e.end.offset,p),g=u.element;if(p=u.index,i="",null!=d&&(h=(d=this.owner.selection.getElementBoxInternal(g,p)).element,p=d.index),null!=h){h instanceof Ie&&p<h.length&&(i=h.text.substring(p));for(var m=h.line.children.indexOf(h);m+1<h.line.children.length&&h.line.children[m+1]instanceof Ie||h.line.children[m+1]instanceof xe;)h.line.children[m+1]instanceof xe?m+=2:(i+=h.line.children[m+1].text,m+=1)}a=i.lastIndexOf(" "),i="\v"===i?i="":i;var f="";e.isHeader?f='<span class="e-de-header-footer-list">Header: </span>':e.isFooter?f='<span class="e-de-header-footer-list">Footer: </span>':(f="",f="",this.isHandledOddPageHeader=!0,this.isHandledEvenPageHeader=!0,this.isHandledOddPageFooter=!0,this.isHandledEvenPageFooter=!0);var v="",y=e.documentHelper.selection.getPage(e.start.paragraph);t.isNullOrUndefined(this.isHandledEvenPageHeader)&&t.isNullOrUndefined(this.isHandledEvenPageFooter)?(this.isHandledEvenPageHeader=!0,this.isHandledEvenPageFooter=!0):t.isNullOrUndefined(this.isHandledOddPageHeader)&&t.isNullOrUndefined(this.isHandledOddPageFooter)&&(this.isHandledOddPageHeader=!0,this.isHandledOddPageFooter=!0),e.isHeader?"FirstPageHeader"===y.headerWidget.headerFooterType&&y.bodyWidgets[0].sectionFormat.differentFirstPage?v='<li tabindex=0 class="e-de-search-result-item e-de-op-search-txt">'+f+s+'<span class="e-de-op-search-word" style="pointer-events:none">'+e.text+"</span>"+i+"</li>":"EvenHeader"===y.headerWidget.headerFooterType&&this.isHandledEvenPageHeader?(v='<li tabindex=0 class="e-de-search-result-item e-de-op-search-txt">'+f+s+'<span class="e-de-op-search-word" style="pointer-events:none">'+e.text+"</span>"+i+"</li>",this.isHandledEvenPageHeader=!1):"OddHeader"===y.headerWidget.headerFooterType&&this.isHandledOddPageHeader&&(v='<li tabindex=0 class="e-de-search-result-item e-de-op-search-txt">'+f+s+'<span class="e-de-op-search-word" style="pointer-events:none">'+e.text+"</span>"+i+"</li>",this.isHandledOddPageHeader=!1):e.isFooter?"FirstPageFooter"===y.footerWidget.headerFooterType&&y.bodyWidgets[0].sectionFormat.differentFirstPage?v='<li tabindex=0 class="e-de-search-result-item e-de-op-search-txt">'+f+s+'<span class="e-de-op-search-word" style="pointer-events:none">'+e.text+"</span>"+i+"</li>":"EvenFooter"===y.footerWidget.headerFooterType&&this.isHandledEvenPageFooter?(v='<li tabindex=0 class="e-de-search-result-item e-de-op-search-txt">'+f+s+'<span class="e-de-op-search-word" style="pointer-events:none">'+e.text+"</span>"+i+"</li>",this.isHandledEvenPageFooter=!1):"OddFooter"===y.footerWidget.headerFooterType&&this.isHandledOddPageFooter&&(v='<li tabindex=0 class="e-de-search-result-item e-de-op-search-txt">'+f+s+'<span class="e-de-op-search-word" style="pointer-events:none">'+e.text+"</span>"+i+"</li>",this.isHandledOddPageFooter=!1):e.isHeader||e.isFooter||(v='<li tabindex=0 class="e-de-search-result-item e-de-op-search-txt">'+f+s+'<span class="e-de-op-search-word" style="pointer-events:none">'+e.text+"</span>"+i+"</li>"),this.addSearchResultItems(v)}},e.prototype.clearSearchHighlight=function(){t.isNullOrUndefined(this.searchHighlighters)||(this.searchHighlighters.clear(),this.searchHighlighters=void 0);var e={source:this.viewer.owner};this.viewer.owner.trigger("searchResultsChange",e)},e.prototype.destroy=function(){this.textSearchResults&&this.textSearchResults.destroy()},e}(),At=function(){function e(e){var i=this;this.isOptionsPaneShow=!1,this.findOption="None",this.matchCase=void 0,this.wholeWord=void 0,this.searchText="Navigation",this.resultsText="Results",this.messageDivText="No matches",this.replaceButtonText="Replace",this.replaceAllButtonText="Replace All",this.focusedIndex=-1,this.focusedElement=[],this.isOptionsPane=!0,this.replacePaneText="Replace",this.findPaneText="Find",this.matchDivReplaceText="No matches",this.tabInstance=void 0,this.isReplace=!1,this.searchOptionChange=function(){i.clearSearchResultItems(),i.documentHelper.owner.searchModule.clearSearchHighlight();var e=i.searchInput.value;if(""!==e){var t=i.documentHelper.owner.searchModule.textSearch.stringToRegex(e,i.findOption),n=i.documentHelper.selection.end.getHierarchicalIndexInternal();i.results=i.documentHelper.owner.searchModule.textSearch.findAll(t,i.findOption,n),null!=i.results&&i.results.length>0?i.navigateSearchResult(!1):(i.viewer.renderVisiblePages(),i.messageDiv.innerHTML=i.localeValue.getConstant("No matches"),i.resultContainer.style.display="block",i.resultsListBlock.style.display="none",i.clearFocusElement(),i.resultsListBlock.innerHTML="")}},this.onEnableDisableReplaceButton=function(){0!==i.searchInput.value.length?(i.replaceButton.disabled=!1,i.replaceAllButton.disabled=!1):(i.replaceButton.disabled=!0,i.replaceAllButton.disabled=!0)},this.onKeyDownOnOptionPane=function(e){if(9===e.keyCode){e.preventDefault();var n=void 0;n=e.shiftKey?0===i.focusedIndex||t.isNullOrUndefined(i.focusedIndex)?i.focusedElement.length-1:i.focusedIndex-1:i.focusedElement.length-1===i.focusedIndex||t.isNullOrUndefined(i.focusedIndex)?0:i.focusedIndex+1,(s=i.focusedElement[n]).focus(),s instanceof HTMLInputElement&&s.select(),i.focusedIndex=n,s instanceof HTMLLIElement&&i.scrollToPosition(s)}else if(13===e.keyCode){if(e.target!==i.searchInput&&e.target!==i.closeButton&&(e.preventDefault(),-1!==(o=i.focusedElement.indexOf(e.target)))){var r=i.focusedElement[o];r.click(),r.focus(),i.focusedIndex=o}}else if((40===e.keyCode||38===e.keyCode)&&"none"!==i.resultsListBlock.style.display){var o=void 0,s=void 0;40===e.keyCode?i.focusedIndex>7?i.focusedIndex+1<i.focusedElement.length&&((s=i.focusedElement[i.focusedIndex+1]).focus(),i.focusedIndex=i.focusedIndex+1):(o=i.focusedElement.length-i.resultsListBlock.children.length+i.results.currentIndex+1)<i.focusedElement.length&&((s=i.focusedElement[o]).focus(),i.focusedIndex=o):i.focusedIndex>6&&(o=i.focusedIndex-1,(s=i.focusedElement[o]).focus(),i.focusedIndex=o)}},this.onReplaceButtonClick=function(){i.optionsPane;var e=i.searchInput.value,n=i.replaceWith.value,r=i.documentHelper.owner.searchModule.textSearchResults;if(""!==e&&!t.isNullOrUndefined(e)&&null!=i.documentHelper.owner.selection){var o=i.documentHelper.owner.selection.text;if(i.documentHelper.owner.selection.isEmpty||(i.documentHelper.owner.selection.isForward?i.documentHelper.owner.selection.selectContent(i.documentHelper.owner.selection.start,!0):i.documentHelper.owner.selection.selectContent(i.documentHelper.owner.selection.end,!0)),t.isNullOrUndefined(r)||t.isNullOrUndefined(r.currentSearchResult))i.documentHelper.owner.search.findAll(e,i.findOption),i.messageDiv.style.display="block",i.messageDiv.innerHTML=i.localeValue.getConstant(i.matchDivReplaceText);else{var s=r.currentSearchResult;if(i.documentHelper.owner.searchModule.navigate(s),s.text===o){var a=t.isNullOrUndefined(n)?"":n;i.documentHelper.owner.searchModule.replace(a,s,r);var l=i.documentHelper.owner.searchModule.textSearch.stringToRegex(e,i.findOption),d=i.documentHelper.selection.end.getHierarchicalIndexInternal();i.results=i.documentHelper.owner.searchModule.textSearch.findAll(l,i.findOption,d),t.isNullOrUndefined(i.results)||t.isNullOrUndefined(i.results.currentSearchResult)?(i.messageDiv.style.display="block",i.messageDiv.innerHTML=i.localeValue.getConstant(i.matchDivReplaceText)):i.documentHelper.owner.searchModule.navigate(i.results.currentSearchResult),i.documentHelper.owner.findResultsList=[],!t.isNullOrUndefined(i.results)&&i.results.innerList.length>0?i.navigateSearchResult(!0):i.resultsListBlock.innerHTML=""}else i.documentHelper.owner.search.findAll(e,i.findOption)}}},this.onReplaceAllButtonClick=function(){i.replaceAll(),i.resultsListBlock.style.display="none",i.messageDiv.innerHTML=""},this.searchIconClickInternal=function(){var e=document.getElementById(i.documentHelper.owner.containerId+"_option_search_text_box"),t=e.value;if(""!==t){if(i.searchIcon.classList.contains("e-de-op-search-close-icon"))return i.searchIcon.classList.add("e-de-op-search-icon"),i.searchIcon.classList.remove("e-de-op-search-close-icon"),e.value="",i.messageDiv.innerHTML=i.localeValue.getConstant("No matches"),i.resultContainer.style.display="block",i.resultsListBlock.style.display="none",i.matchDiv.style.display="none",i.occurrenceDiv.style.display="none",i.onEnableDisableReplaceButton(),i.clearFocusElement(),i.resultsListBlock.innerHTML="",i.clearSearchResultItems(),i.documentHelper.owner.searchModule.clearSearchHighlight(),void i.viewer.renderVisiblePages();i.searchIcon.classList.contains("e-de-op-search-icon")&&t.length>=1&&(i.searchIcon.classList.add("e-de-op-search-close-icon"),i.searchIcon.classList.remove("e-de-op-search-icon"),i.onEnableDisableReplaceButton()),i.clearSearchResultItems(),i.documentHelper.owner.searchModule.clearSearchHighlight();var n=i.documentHelper.owner.searchModule.textSearch.stringToRegex(t,i.findOption),r=i.documentHelper.selection.end.getHierarchicalIndexInternal();if(i.results=i.documentHelper.owner.searchModule.textSearch.findAll(n,i.findOption,r),null!=i.results&&i.results.length>0){var o=i.results.innerList[i.results.currentIndex].start,s=i.results.innerList[i.results.currentIndex].end;i.documentHelper.scrollToPosition(o,s,!0),i.navigateSearchResult(!1),i.getMessageDivHeight();var a=i.isOptionsPane?215:292,l=i.documentHelper.owner.getDocumentEditorElement().offsetHeight-a;i.resultsListBlock.style.height=l+"px"}else i.messageDiv.innerHTML=i.localeValue.getConstant("No matches"),i.resultContainer.style.display="block",i.resultsListBlock.style.display="none",i.clearFocusElement(),i.resultsListBlock.innerHTML=""}},this.navigateNextResultButtonClick=function(){if(null!=document.getElementById(i.documentHelper.owner.containerId+"_list_box_container")&&"none"!==document.getElementById(i.documentHelper.owner.containerId+"_list_box_container").style.display){var e=i.documentHelper.owner.selection.end,n=void 0,r=0;e.isExistAfter(i.results.currentSearchResult.start)&&(r=i.results.currentIndex);for(var o=r;o<i.results.length;o++){var s=i.results.innerList[o];if(e.isExistBefore(s.start)||e.isAtSamePosition(s.start)){n=s,i.results.currentIndex=o;break}}t.isNullOrUndefined(n)&&(i.results.currentIndex=0,n=i.results.innerList[0]),i.messageDiv.innerHTML=i.localeValue.getConstant("Result")+" "+(i.results.currentIndex+1)+" "+i.localeValue.getConstant("of")+" "+i.resultsListBlock.children.length,i.updateListItems(n),i.focusedIndex=i.focusedElement.indexOf(i.navigateToNextResult)}},this.navigatePreviousResultButtonClick=function(){if(null!=document.getElementById(i.documentHelper.owner.containerId+"_list_box_container")&&"none"!==document.getElementById(i.documentHelper.owner.containerId+"_list_box_container").style.display){var e=void 0,n=i.documentHelper.owner.selection.start,r=i.results.currentIndex;n.isExistAfter(i.results.currentSearchResult.start)&&(r=i.results.length-1);for(var o=r;o>=0;o--){var s=i.results.innerList[o];if(n.isExistAfter(s.start)||i.documentHelper.owner.selection.end.isAtSamePosition(s.start)){e=s,i.results.currentIndex=o;break}}t.isNullOrUndefined(e)&&(i.results.currentIndex=i.results.length-1,e=i.results.innerList[i.results.currentIndex]),i.messageDiv.innerHTML=i.localeValue.getConstant("Result")+" "+(i.results.currentIndex+1)+" "+i.localeValue.getConstant("of")+" "+i.resultsListBlock.children.length,i.updateListItems(e),i.focusedIndex=i.focusedElement.indexOf(i.navigateToPreviousResult)}},this.onKeyDown=function(e){var t=e.which||e.keyCode;13===t&&9!==e.keyCode&&40!==e.keyCode?(e.preventDefault(),i.findDiv.style.height="",i.onKeyDownInternal()):8===t&&0===i.searchInput.value.length?i.resultContainer.style.display="block":9!==e.keyCode&&40!==e.keyCode&&27!==e.keyCode?(i.documentHelper.owner.searchModule.clearSearchHighlight(),i.clearSearchResultItems(),i.viewer.renderVisiblePages(),i.resultsListBlock.style.display="none",i.messageDiv.innerHTML=i.localeValue.getConstant("No matches"),i.resultContainer.style.display="none",i.clearFocusElement(),i.resultsListBlock.innerHTML="",i.searchIcon.classList.contains("e-de-op-search-close-icon")&&(i.searchIcon.classList.add("e-de-op-search-icon"),i.searchIcon.classList.remove("e-de-op-search-close-icon"))):27===t&&27===e.keyCode&&i.showHideOptionsPane(!1)},this.close=function(){i.clearFocusElement(),i.showHideOptionsPane(!1),i.resultsListBlock.innerHTML="",i.focusedIndex=1,i.isOptionsPane=!0},this.resultListBlockClick=function(e){for(var t=e.target,n=i.resultsListBlock.children,r=0,o=0;o<n.length;o++){var s=n[o];s.classList.contains("e-de-search-result-hglt")&&(s.classList.remove("e-de-search-result-hglt"),s.children[0].classList.remove("e-de-op-search-word-text"),s.classList.add("e-de-search-result-item"))}for(var a,o=0;o<n.length;o++)t===n[o]&&(r=o,(a=n[o]).classList.contains("e-de-search-result-item")&&(a.classList.remove("e-de-search-result-item"),a.classList.add("e-de-search-result-hglt"),a.children[0].classList.add("e-de-op-search-word-text"),i.focusedIndex=i.focusedElement.indexOf(a)));var l=i.results.innerList[r];i.results.currentIndex=r,i.messageDiv.innerHTML=i.localeValue.getConstant("Result")+" "+(r+1)+" "+i.localeValue.getConstant("of")+" "+i.resultsListBlock.children.length,i.documentHelper.owner.searchModule.navigate(l),i.documentHelper.owner.searchModule.highlight(i.results),a&&a.focus()},this.documentHelper=e}return Object.defineProperty(e.prototype,"viewer",{get:function(){return this.documentHelper.owner.viewer},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"OptionsPane"},e.prototype.initOptionsPane=function(e,n){this.viewer;this.localeValue=e,this.optionsPane=t.createElement("div",{className:"e-de-op",styles:"display:none;"}),this.optionsPane.addEventListener("keydown",this.onKeyDownOnOptionPane),this.searchDiv=t.createElement("div",{className:this.documentHelper.owner.containerId+"_searchDiv e-de-op-header",innerHTML:e.getConstant(this.searchText)}),this.optionsPane.appendChild(this.searchDiv),this.closeButton=t.createElement("button",{className:"e-de-op-close-button e-de-close-icon e-de-op-icon-btn e-btn e-flat e-icon-btn",id:"close",attrs:{type:"button"}}),this.optionsPane.appendChild(this.closeButton);var o=t.createElement("span",{className:"e-de-op-close-icon e-de-close-icon e-btn-icon e-icons"});this.closeButton.appendChild(o),this.focusedElement.push(this.closeButton),this.findTab=t.createElement("div",{id:this.documentHelper.owner.containerId+"_findTabDiv",className:"e-de-op-tab"}),this.optionsPane.appendChild(this.findTab),this.findTabButton=t.createElement("div",{innerHTML:e.getConstant(this.findPaneText)}),this.replaceTabButton=t.createElement("div",{innerHTML:e.getConstant(this.replacePaneText)});var s=t.createElement("div");this.findTabContentDiv=t.createElement("div",{className:"e-de-search-tab-content"}),this.searchTextBoxContainer=t.createElement("div",{className:"e-input-group e-de-op-input-group"}),this.findTabContentDiv.appendChild(this.searchTextBoxContainer),this.searchInput=t.createElement("input",{className:"e-input e-de-search-input",id:this.documentHelper.owner.containerId+"_option_search_text_box",attrs:{placeholder:e.getConstant("Search for")}}),this.searchTextBoxContainer.appendChild(this.searchInput),this.searchIcon=t.createElement("span",{className:"e-de-op-icon e-de-op-search-icon e-input-group-icon e-icon",id:this.documentHelper.owner.containerId+"_search-icon"}),this.searchIcon.tabIndex=0,this.searchTextBoxContainer.appendChild(this.searchIcon),this.focusedElement.push(this.searchIcon),this.navigateToPreviousResult=t.createElement("span",{className:"e-de-op-icon e-de-op-nav-btn e-arrow-up e-spin-up e-btn-icon e-icon e-input-group-icon"}),this.navigateToPreviousResult.tabIndex=0,this.searchTextBoxContainer.appendChild(this.navigateToPreviousResult),this.focusedElement.push(this.navigateToPreviousResult),this.navigateToNextResult=t.createElement("span",{className:"e-de-op-icon e-de-op-nav-btn e-arrow-down e-spin-down e-btn-icon e-icon e-input-group-icon"}),this.navigateToNextResult.tabIndex=0,this.searchTextBoxContainer.appendChild(this.navigateToNextResult),this.focusedElement.push(this.navigateToNextResult);var a=t.createElement("div",{className:"e-de-op-more-less"});this.matchInput=t.createElement("input",{attrs:{type:"checkbox"},id:this.documentHelper.owner.containerId+"_matchCase"}),a.appendChild(this.matchInput),this.matchCase=new r.CheckBox({label:e.getConstant("Match case"),enableRtl:n,checked:!1,change:this.matchChange.bind(this)}),this.matchCase.appendTo(this.matchInput),this.focusedElement.push(this.matchInput),this.matchInput.tabIndex=0;var l;l=n?"_e-de-rtl":"_e-de-ltr",this.wholeInput=t.createElement("input",{attrs:{type:"checkbox"},id:this.documentHelper.owner.containerId+"_wholeWord"+l}),a.appendChild(this.wholeInput),this.wholeWord=new r.CheckBox({label:e.getConstant("Whole words"),enableRtl:n,checked:!1,change:this.wholeWordsChange.bind(this)}),this.wholeWord.appendTo(this.wholeInput),this.focusedElement.push(this.wholeInput),this.wholeInput.tabIndex=0,this.findTabContentDiv.appendChild(a);var d=t.createElement("div");this.replaceTabContentDiv=t.createElement("div",{className:"e-de-op-replacetabcontentdiv",styles:"display:none;"}),this.findTabContentDiv.appendChild(this.replaceTabContentDiv),this.createReplacePane(n),this.findDiv=t.createElement("div",{className:"findDiv",styles:"display:block;"}),s.appendChild(this.findTabContentDiv),this.resultContainer=t.createElement("div",{styles:"width:85%;display:block;",className:"e-de-op-result-container"}),this.findDiv.appendChild(this.resultContainer),this.messageDiv=t.createElement("div",{className:this.documentHelper.owner.containerId+"_messageDiv e-de-op-msg",innerHTML:this.localeValue.getConstant(this.messageDivText),id:this.documentHelper.owner.containerId+"_search_status"}),this.resultContainer.appendChild(this.messageDiv),this.resultsListBlock=t.createElement("div",{id:this.documentHelper.owner.containerId+"_list_box_container",styles:"display:none;width:270px;list-style:none;padding-right:5px;overflow:auto;",className:"e-de-result-list-block"}),this.findDiv.appendChild(this.resultsListBlock),this.findTabContentDiv.appendChild(this.findDiv);var h=[{header:{text:this.findTabButton},content:s},{header:{text:this.replaceTabButton},content:d}];this.tabInstance=new i.Tab({items:h,enableRtl:n,selected:this.selectedTabItem.bind(this)}),this.tabInstance.isStringTemplate=!0,this.tabInstance.appendTo(this.findTab),this.onWireEvents(),n&&(this.optionsPane.classList.add("e-de-rtl"),this.closeButton.classList.add("e-de-rtl"),this.searchDiv.classList.add("e-de-rtl"))},e.prototype.createReplacePane=function(e){this.replaceDiv=t.createElement("div"),this.replaceTabContentDiv.appendChild(this.replaceDiv),this.replaceWith=t.createElement("input",{className:"e-de-op-replacewith e-input",attrs:{placeholder:this.localeValue.getConstant("Replace with")}}),this.replaceDiv.appendChild(this.replaceWith);var i,n;e?(i="text-align:left",n="margin-left:10px"):(i="text-align:right",n="margin-right:10px");var r=t.createElement("div",{styles:i,className:"e-de-op-dlg-footer"});this.replaceDiv.appendChild(r),this.replaceButton=t.createElement("button",{className:"e-control e-btn e-flat e-replace",styles:n,innerHTML:this.localeValue.getConstant(this.replaceButtonText),attrs:{type:"button"}}),r.appendChild(this.replaceButton),this.replaceAllButton=t.createElement("button",{className:"e-control e-btn e-flat e-replaceall",innerHTML:this.localeValue.getConstant(this.replaceAllButtonText),attrs:{type:"button"}}),r.appendChild(this.replaceAllButton),this.matchDiv=t.createElement("div",{styles:"display:none;padding-top:10px;"}),this.replaceDiv.appendChild(this.matchDiv);var o=t.createElement("div",{className:"e-de-op-search-replacediv"});this.replaceDiv.appendChild(o),this.occurrenceDiv=t.createElement("div",{styles:"display:none;"}),this.replaceDiv.appendChild(this.occurrenceDiv)},e.prototype.selectedTabItem=function(e){var i=this.findTab.getElementsByClassName("e-content").item(0);if(e.previousIndex!==e.selectedIndex){var n=i.children[0],r=i.children[1],o=n.firstElementChild;o&&(o.parentElement&&o.parentElement.removeChild(o),r.appendChild(o))}var s=i.children[0];t.isNullOrUndefined(s)||(0===e.selectedIndex?(this.isOptionsPane=!0,this.onFindPane()):(this.isOptionsPane=!1,this.onReplacePane()))},e.prototype.navigateSearchResult=function(e){e&&this.documentHelper.owner.searchModule.navigate(this.results.innerList[this.results.currentIndex]),this.documentHelper.owner.searchModule.highlight(this.results),this.documentHelper.owner.searchModule.addFindResultView(this.results),this.resultsListBlock.style.display="block",this.resultContainer.style.display="block";for(var t=this.documentHelper.owner.findResultsList,i="",n=0;n<t.length;n++)i+=t[n];this.clearFocusElement(),this.resultsListBlock.innerHTML=i;for(n=0;n<this.resultsListBlock.children.length;n++)this.focusedElement.push(this.resultsListBlock.children[n]);var r=this.results.currentIndex;this.messageDiv.innerHTML=this.localeValue.getConstant("Result")+" "+(r+1)+" "+this.localeValue.getConstant("of")+" "+this.resultsListBlock.children.length;var o=this.resultsListBlock.children[r];o.classList.contains("e-de-search-result-item")&&(o.classList.remove("e-de-search-result-item"),o.classList.add("e-de-search-result-hglt"),o.children[0].classList.add("e-de-op-search-word-text"),this.scrollToPosition(o))},e.prototype.wholeWordsChange=function(){this.matchInput.checked&&this.wholeInput.checked?this.findOption="CaseSensitiveWholeWord":this.matchInput.checked&&!this.wholeInput.checked?this.findOption="CaseSensitive":!this.matchInput.checked&&this.wholeInput.checked?this.findOption="WholeWord":this.findOption="None",this.searchOptionChange()},e.prototype.matchChange=function(){this.matchInput.checked&&this.wholeInput.checked?this.findOption="CaseSensitiveWholeWord":!this.matchInput.checked&&this.wholeInput.checked?this.findOption="WholeWord":this.matchInput.checked&&!this.wholeInput.checked?this.findOption="CaseSensitive":this.findOption="None",this.searchOptionChange()},e.prototype.onWireEvents=function(){this.searchIcon.addEventListener("click",this.searchIconClickInternal),this.navigateToNextResult.addEventListener("click",this.navigateNextResultButtonClick),this.navigateToPreviousResult.addEventListener("click",this.navigatePreviousResultButtonClick),this.searchInput.addEventListener("keydown",this.onKeyDown),this.searchInput.addEventListener("keyup",this.onEnableDisableReplaceButton),this.resultsListBlock.addEventListener("click",this.resultListBlockClick),this.closeButton.addEventListener("click",this.close),this.replaceButton.addEventListener("click",this.onReplaceButtonClick),this.replaceAllButton.addEventListener("click",this.onReplaceAllButtonClick)},e.prototype.onKeyDownInternal=function(){var e=document.getElementById(this.documentHelper.owner.containerId+"_option_search_text_box");e.blur();var i=e.value;if(""!==i){i.length>=1&&this.searchIcon.classList.contains("e-de-op-search-icon")&&(this.searchIcon.classList.add("e-de-op-search-close-icon"),this.searchIcon.classList.remove("e-de-op-search-icon"));var n=this.isOptionsPane?215:292,r=this.documentHelper.owner.getDocumentEditorElement().offsetHeight-n;this.clearSearchResultItems(),this.documentHelper.owner.searchModule.clearSearchHighlight();var o=this.documentHelper.owner.searchModule.textSearch.stringToRegex(i,this.findOption),s=this.documentHelper.selection.end.getHierarchicalIndexInternal();this.results=this.documentHelper.owner.searchModule.textSearch.findAll(o,this.findOption,s);var a=this.results;if(t.isNullOrUndefined(a)&&this.viewer.renderVisiblePages(),null!=a&&a.length>0){-1===this.focusedElement.indexOf(this.navigateToPreviousResult)&&this.isOptionsPane&&this.focusedElement.push(this.navigateToPreviousResult),-1===this.focusedElement.indexOf(this.navigateToNextResult)&&this.isOptionsPane&&this.focusedElement.push(this.navigateToNextResult),this.documentHelper.owner.searchModule.navigate(this.results.innerList[this.results.currentIndex]),this.documentHelper.owner.searchModule.highlight(a),this.documentHelper.owner.searchModule.addFindResultView(a),this.resultsListBlock.style.display="block",this.resultsListBlock.style.height=r+"px",this.resultContainer.style.display="block";var l=this.documentHelper.owner.findResultsList,d="";this.clearFocusElement(),this.resultsListBlock.innerHTML="";for(h=0;h<l.length;h++)d+=l[h];this.resultsListBlock.innerHTML=d;for(var h=0;h<this.resultsListBlock.children.length;h++)this.focusedElement.push(this.resultsListBlock.children[h]);this.resultsListBlock.children;var c=this.results.currentIndex;this.messageDiv.innerHTML=this.localeValue.getConstant("Result")+" "+(c+1)+" "+this.localeValue.getConstant("of")+" "+this.resultsListBlock.children.length;var p=this.resultsListBlock.children[c];p.classList.contains("e-de-search-result-item")&&(p.classList.remove("e-de-search-result-item"),p.classList.add("e-de-search-result-hglt"),p.children[0].classList.add("e-de-op-search-word-text")),this.navigateToNextResult.focus(),this.focusedIndex=this.focusedElement.indexOf(this.navigateToNextResult),this.getMessageDivHeight()}else this.messageDiv.innerHTML=this.localeValue.getConstant("No matches"),this.resultContainer.style.display="block",this.resultsListBlock.style.display="none",this.clearFocusElement(),this.resultsListBlock.innerHTML=""}},e.prototype.onFindPane=function(){this.replaceDiv.style.display="none",this.occurrenceDiv.style.display="none",t.isNullOrUndefined(this.results)||0!==this.results.length||(this.resultsListBlock.innerHTML="",this.resultsListBlock.style.display="none",this.messageDiv.innerHTML=this.localeValue.getConstant("No matches"));var e=this.isOptionsPane?215:292,i=this.documentHelper.owner.getDocumentEditorElement().offsetHeight-e;this.resultsListBlock.style.height=i+"px",this.replaceTabContentDiv.style.display="none",this.findDiv.style.display="block",this.messageDiv.style.display="block",this.focusedElement=[],this.focusedElement.push(this.closeButton,this.searchInput,this.searchIcon,this.navigateToPreviousResult,this.navigateToNextResult,this.matchInput,this.wholeInput),this.focusedIndex=1,this.searchInput.select(),this.getMessageDivHeight()},e.prototype.getMessageDivHeight=function(){!this.isOptionsPane&&this.messageDiv.classList.contains("e-de-op-msg")?(this.messageDiv.classList.add("e-de-op-replace-messagediv"),this.messageDiv.classList.remove("e-de-op-msg")):this.isOptionsPane&&this.messageDiv.classList.contains("e-de-op-replace-messagediv")&&(this.messageDiv.classList.add("e-de-op-msg"),this.messageDiv.classList.remove("e-de-op-replace-messagediv"))},e.prototype.onReplacePane=function(){this.findDiv.style.display="block",this.replaceDiv.style.display="block",this.replaceTabContentDiv.style.display="block";var e=this.isOptionsPane?215:292,t=this.documentHelper.owner.getDocumentEditorElement().offsetHeight-e;this.resultsListBlock.style.height=t+"px",this.isOptionsPane=!1,0!==this.searchInput.value.length?(this.replaceButton.disabled=!1,this.replaceAllButton.disabled=!1):(this.replaceButton.disabled=!0,this.replaceAllButton.disabled=!0),this.focusedElement=[],this.focusedElement.push(this.closeButton,this.searchInput,this.searchIcon,this.navigateToPreviousResult,this.navigateToNextResult,this.matchInput,this.wholeInput,this.replaceWith,this.replaceButton,this.replaceAllButton),this.focusedIndex=1,""===this.searchInput.value?this.searchInput.select():this.replaceWith.select(),this.getMessageDivHeight()},e.prototype.replaceAll=function(){this.optionsPane;var e=this.searchInput.value,i=this.replaceWith.value;if(""!==e&&!t.isNullOrUndefined(e)){var n=this.documentHelper.owner.searchModule.textSearch.stringToRegex(e,this.findOption),r=this.documentHelper.selection.end.getHierarchicalIndexInternal(),o=this.documentHelper.owner.searchModule.textSearch.findAll(n,this.findOption,r),s=t.isNullOrUndefined(i)?"":i,a=t.isNullOrUndefined(o)?0:o.length;this.documentHelper.owner.searchModule.replaceAll(s,o),this.matchDiv.style.display="block",this.matchDiv.innerHTML=this.localeValue.getConstant("All Done")+"!",this.occurrenceDiv.style.display="block",this.occurrenceDiv.innerHTML=this.localeValue.getConstant("We replaced all")+" "+a+" "+this.localeValue.getConstant("instances")+" "+this.localeValue.getConstant("of")+' "'+e+'" '+this.localeValue.getConstant("with")+' "'+i+'" '}},e.prototype.updateListItems=function(e){for(var i=this.resultsListBlock.getElementsByClassName("e-de-search-result-hglt"),n=0;n<i.length;n++){var r=i[n];t.classList(r,["e-de-search-result-item"],["e-de-search-result-hglt"]),t.classList(r.children[0],[],["e-de-op-search-word-text"])}var o=this.resultsListBlock.children[this.results.currentIndex];t.classList(o,["e-de-search-result-hglt"],["e-de-search-result-item"]),t.classList(o.children[0],["e-de-op-search-word-text"],[]),this.scrollToPosition(o),this.documentHelper.owner.searchModule.navigate(e),this.documentHelper.owner.searchModule.highlight(this.results)},e.prototype.scrollToPosition=function(e){var t,i=e.getBoundingClientRect();i.top>0?(t=i.top-e.parentElement.getBoundingClientRect().top,e.parentElement.offsetHeight-t<=e.offsetHeight?(Math.ceil(t+e.offsetHeight)===e.parentElement.scrollHeight&&(e.parentElement.scrollTop=t),e.parentElement.scrollTop=e.parentElement.scrollTop+e.parentElement.offsetHeight/100*30):t<0&&(e.parentElement.scrollTop=e.parentElement.scrollTop-e.parentElement.offsetHeight/100*30)):e.parentElement.scrollTop=0},e.prototype.clearFocusElement=function(){for(var e=0;e<this.resultsListBlock.children.length;e++){var t=this.focusedElement.indexOf(this.resultsListBlock.children[e]);-1!==t&&this.focusedElement.splice(t,1)}this.focusedIndex=1},e.prototype.showHideOptionsPane=function(e){if(!t.isNullOrUndefined(this.documentHelper.owner.selectionModule))if(e){if(this.localeValue=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale),this.localeValue.setLocale(this.documentHelper.owner.locale),t.isNullOrUndefined(this.optionsPane)){this.initOptionsPane(this.localeValue,this.documentHelper.owner.enableRtl);var i=void 0;i=this.documentHelper.owner.enableRtl?"display:inline-flex;direction:rtl;":"display:inline-flex;",this.documentHelper.optionsPaneContainer.setAttribute("style",i),this.documentHelper.optionsPaneContainer.insertBefore(this.documentHelper.owner.optionsPaneModule.optionsPane,this.documentHelper.viewerContainer)}this.optionsPane.style.display="block",this.documentHelper.owner.isReadOnlyMode?this.tabInstance.hideTab(1):this.tabInstance.hideTab(1,!1),this.isReplace&&!this.documentHelper.owner.isReadOnlyMode?(this.tabInstance.select(1),this.isReplace=!1,this.isOptionsPane=!1):this.tabInstance.select(0),this.searchDiv.innerHTML=this.localeValue.getConstant(this.searchText),this.isOptionsPaneShow=!0;var n=document.getElementById(this.documentHelper.owner.getDocumentEditorElement().id+"_option_search_text_box"),r=this.documentHelper.owner.selection.text;if(!t.isNullOrUndefined(r)){var o=["\v","\r"],s=W.indexOfAny(r,o);r=s<0?r:r.substring(0,s)}n.value=r,n.select(),this.messageDiv.innerHTML="",this.searchIcon.classList.contains("e-de-op-search-close-icon")&&(this.searchIcon.classList.add("e-de-op-search-icon"),this.searchIcon.classList.remove("e-de-op-search-close-icon")),this.documentHelper.selection.caret.style.display="none",this.focusedIndex=1,this.focusedElement=[],this.isOptionsPane?this.focusedElement.push(this.closeButton,this.searchInput,this.searchIcon,this.navigateToPreviousResult,this.navigateToNextResult,this.matchInput,this.wholeInput):this.focusedElement.push(this.closeButton,this.searchInput,this.searchIcon,this.navigateToPreviousResult,this.navigateToNextResult,this.matchInput,this.wholeInput,this.replaceWith,this.replaceButton,this.replaceAllButton),this.documentHelper.updateViewerSize()}else{if(!t.isNullOrUndefined(this.optionsPane)){this.clearSearchResultItems(),this.documentHelper.owner.searchModule.clearSearchHighlight(),this.isOptionsPaneShow=!1;var a=document.getElementById(this.documentHelper.owner.containerId+"_list_box_container"),l=document.getElementById(this.documentHelper.owner.containerId+"_search_status");t.isNullOrUndefined(a)||t.isNullOrUndefined(l)||(a.style.display="none",this.clearFocusElement(),a.innerHTML="",l.innerHTML=this.localeValue.getConstant("No matches"))}this.documentHelper.updateViewerSize(),t.isNullOrUndefined(this.optionsPane)||"none"!==this.optionsPane.style.display&&(this.documentHelper.selection.updateCaretPosition(),this.optionsPane.style.display="none"),this.documentHelper.updateFocus(),this.documentHelper.selection.caret.style.display="block"}},e.prototype.clearSearchResultItems=function(){t.isNullOrUndefined(this.documentHelper.owner.findResultsList)||(this.documentHelper.owner.findResultsList=[])},e.prototype.destroy=function(){this.optionsPane&&(this.optionsPane.innerHTML="",this.optionsPane=void 0),this.resultsListBlock&&(this.resultsListBlock.innerHTML="",this.resultsListBlock=void 0),this.messageDiv&&(this.messageDiv.innerHTML="",this.messageDiv=void 0),this.resultContainer&&(this.resultContainer.innerHTML=""),this.resultContainer=void 0,this.searchInput&&(this.searchInput.value="",this.searchInput=void 0),this.searchDiv&&(this.searchDiv.innerHTML="",this.searchDiv=void 0),this.searchTextBoxContainer&&(this.searchTextBoxContainer.innerHTML="",this.searchTextBoxContainer=void 0),this.replaceWith&&(this.replaceWith.innerHTML="",this.replaceWith=void 0),this.findDiv&&(this.findDiv.innerHTML="",this.findDiv=void 0),this.replaceButton&&(this.replaceButton.innerHTML="",this.replaceButton=void 0),this.replaceAllButton&&(this.replaceAllButton.innerHTML="",this.replaceAllButton=void 0),this.matchInput&&(this.matchInput.innerHTML="",this.matchCase=void 0),this.wholeInput&&(this.wholeInput.innerHTML="",this.wholeWord=void 0),t.isNullOrUndefined(this.results)||this.results.destroy(),this.focusedElement&&(this.focusedElement=[]),this.focusedElement=void 0,this.destroyInternal()},e.prototype.destroyInternal=function(){this.searchText&&(this.searchText=void 0),this.resultsText&&(this.resultsText=void 0),this.messageDivText&&(this.messageDivText=void 0),this.replaceButtonText&&(this.replaceButtonText=void 0),this.replaceAllButtonText&&(this.replaceAllButtonText=void 0)},e}(),Ut=function(){function e(e){this.resizeNode=0,this.resizerPosition=-1,this.currentResizingTable=void 0,this.owner=e,this.documentHelper=this.owner.documentHelper,this.startingPoint=new O(0,0)}return Object.defineProperty(e.prototype,"viewer",{get:function(){return this.owner.viewer},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"TableResizer"},e.prototype.updateResizingHistory=function(e){this.owner.editorHistory&&this.owner.editorHistory.updateResizingHistory(e,this),this.documentHelper.isRowOrCellResizing=!1,this.resizerPosition=-1},e.prototype.handleResize=function(e){this.owner.documentHelper.isRowOrCellResizing=!0,this.startingPoint.x=e.x,this.startingPoint.y=e.y,this.owner.editorHistory.initResizingHistory(e,this)},e.prototype.isInRowResizerArea=function(e){var t=this.getRowReSizerPosition(void 0,e);return-1!==t&&(this.resizeNode=1,this.resizerPosition=t,!0)},e.prototype.isInCellResizerArea=function(e){var t=this.getCellReSizerPosition(e);return-1!==t&&(this.resizeNode=0,this.resizerPosition=t,!0)},e.prototype.getCellReSizerPosition=function(e){var i=-1,n=this.getTableWidget(e),r=this.getTableCellWidget(e),o=t.isNullOrUndefined(n)?0:n.tableFormat.cellSpacing;if(n&&o>0){if(this.currentResizingTable=n,this.documentHelper.isInsideRect(n.x-W.convertPointToPixel(n.leftBorderWidth)-.25,n.y,W.convertPointToPixel(n.leftBorderWidth)+.5,n.height,e))return i=0;for(var s=n.x,a=0;a<n.tableHolder.columns.length;a++){var l=W.convertPointToPixel(n.tableHolder.columns[a].preferredWidth);if(this.documentHelper.isInsideRect(s-1,n.y,n.leftBorderWidth+2,n.height,e))return i=a>0?a:0;if(a>0&&this.documentHelper.isInsideRect(s+l-1,n.y,2,n.height,e))return i=a+1;s+=l}}else if(!t.isNullOrUndefined(r)){if(this.currentResizingTable=r.ownerTable,this.documentHelper.isInsideRect(r.x-r.margin.left-1,r.y-r.margin.top,2,r.height+r.margin.top+r.margin.bottom,e))return i=r.columnIndex;if(t.isNullOrUndefined(r.nextRenderedWidget)&&this.documentHelper.isInsideRect(r.x+r.margin.right+r.width-1,r.y-r.margin.top,2,r.height+r.margin.top+r.margin.bottom,e))return i=r.columnIndex+r.cellFormat.columnSpan;if(r.childWidgets.length>0)return this.getCellReSizerPositionInternal(r,e)}return i},e.prototype.getCellReSizerPositionInternal=function(e,i){var n=-1,r=this.getTableWidgetFromWidget(i,e),o=void 0;if(!t.isNullOrUndefined(r)&&r.tableFormat.cellSpacing>0){if(this.currentResizingTable=r,this.documentHelper.isInsideRect(r.x-r.leftBorderWidth-.25,r.y,r.leftBorderWidth+.5,r.height,i))return n=0;for(var s=r.x,a=0;a<r.tableHolder.columns.length;a++){var l=W.convertPointToPixel(r.tableHolder.columns[a].preferredWidth);if(this.documentHelper.isInsideRect(s-1,r.y,r.leftBorderWidth+2,r.height,i))return n=a>0?a:0;if(a>0&&this.documentHelper.isInsideRect(s+l-1,r.y,2,r.height,i))return n=a+1;s+=l}}else if(t.isNullOrUndefined(r)||(o=r.getTableCellWidget(i)),!t.isNullOrUndefined(o)){if(this.currentResizingTable=o.ownerTable,this.documentHelper.isInsideRect(o.x-o.margin.left-1,o.y-o.margin.top,2,o.height,i))return n=o.columnIndex;if(t.isNullOrUndefined(o.nextRenderedWidget)&&this.documentHelper.isInsideRect(o.x+o.margin.right+o.width-1,o.y-o.margin.top,2,o.height,i))return n=o.columnIndex+o.cellFormat.columnSpan;if(o.childWidgets.length>0)return this.getCellReSizerPositionInternal(o,i)}return n},e.prototype.getRowReSizerPosition=function(e,i){var n=void 0,r=void 0;t.isNullOrUndefined(e)?(n=this.getTableWidget(i),r=this.getTableCellWidget(i)):n=this.getTableWidgetFromWidget(i,e);var o=t.isNullOrUndefined(n)?0:n.tableFormat.cellSpacing;if(n&&o>0){if(this.currentResizingTable=n,this.owner.documentHelper.isInsideRect(n.x,n.y+n.height-o,this.getActualWidth(n.lastChild),t.isNullOrUndefined(n.nextSplitWidget)?n.bottomBorderWidth+o:0,i))return n.lastChild.rowIndex;for(var s=0;s<n.childWidgets.length;s++){var a=n.childWidgets[s];if(n.childWidgets.indexOf(a)>-1&&this.owner.documentHelper.isInsideRect(a.x,a.y+a.height+o/2,this.getActualWidth(a),o/2,i))return a.rowIndex}}else if(n&&r&&(r=this.getTableCellWidget(i)),r){var l=0;if(l=(a=r.containerWidget).rowIndex===a.ownerTable.childWidgets.length-1?a.bottomBorderWidth+2:a.nextRenderedWidget.topBorderWidth+2,this.owner.documentHelper.isInsideRect(a.x,a.y+a.height-l,a.width,2*l,i))return this.currentResizingTable=a.ownerTable,a.rowIndex;if(r.childWidgets.length>0)return this.getRowReSizerPosition(r,i)}return-1},e.prototype.handleResizing=function(e){var t=0;0===this.resizeNode?(t=e.x-this.startingPoint.x,this.resizeTableCellColumn(t)):(t=e.y-this.startingPoint.y,this.resizeTableRow(t))},e.prototype.resizeTableRow=function(e){var i=this.currentResizingTable;if(!t.isNullOrUndefined(i)&&0!==e&&-1!==this.resizerPosition){var n=this.owner.selection;i.isInsideTable&&(this.owner.isLayoutEnabled=!1);var r=void 0;if(this.resizerPosition>-1&&((r=i.childWidgets[this.resizerPosition])&&this.updateRowHeight(r,e),n.selectPosition(n.start,n.end)),i.isInsideTable){var o=this.owner.documentHelper.layout.getParentTable(i);this.owner.isLayoutEnabled=!0,i=o}this.startingPoint.y+=W.convertPointToPixel(e),this.owner.documentHelper.layout.reLayoutTable(i),this.owner.editorModule.reLayout(this.owner.selection),r&&this.getRowReSizerPosition(void 0,this.startingPoint),!this.currentResizingTable||void 0!==this.currentResizingTable.childWidgets&&void 0!==this.currentResizingTable.childWidgets[this.resizerPosition]||(this.resizerPosition=-1)}},e.prototype.getTableWidget=function(e){var i=void 0,n=this.owner.documentHelper.currentPage;if(!t.isNullOrUndefined(n))for(var r=0;r<n.bodyWidgets.length;r++){var o=n.bodyWidgets[r];if(i=this.getTableWidgetFromWidget(e,o),!t.isNullOrUndefined(i))break}return i},e.prototype.getTableWidgetFromWidget=function(e,t){for(var i=0;i<t.childWidgets.length;i++)if(t.childWidgets[i]instanceof ve){var n=t.childWidgets[i];if(n.y<=e.y&&n.y+n.height>=e.y)return n}},e.prototype.getTableCellWidget=function(e){var i=void 0,n=this.owner.documentHelper.currentPage;if(!t.isNullOrUndefined(n))for(var r=0;r<n.bodyWidgets.length&&(i=n.bodyWidgets[r].getTableCellWidget(e),t.isNullOrUndefined(i));r++);return i},e.prototype.updateRowHeight=function(e,t){var i=e.rowFormat;if("Auto"===i.heightType){i.heightType="AtLeast";var n=i.ownerBase,r=this.owner.documentHelper.layout.getRowHeight(n,[n]);r+t>=2.7&&i.height!==r+t&&(i.height=r+t)}else i.height+t>=2.7&&i.height!==i.height+t&&(i.height=i.height+t)},e.prototype.resizeTableCellColumn=function(e){var i=this.currentResizingTable;if(!(t.isNullOrUndefined(i)||0===e||t.isNullOrUndefined(i.childWidgets)||this.resizerPosition<0)){var n=!0,r=this.owner.selection;this.owner.editor.setOffsetValue(r),i=i.combineWidget(this.viewer),this.owner.isLayoutEnabled=!1,this.setPreferredWidth(i);var o=i.getOwnerWidth(!0),s=i.leftIndent,a=i.tableFormat.tableAlignment;if(r.isEmpty||(n=this.resizeColumnWithSelection(r,i,e)),!n)return void(this.owner.isLayoutEnabled=!0);if(0===this.resizerPosition){var l=this.resizerPosition,d=i.tableHolder.columns[l],h=d.preferredWidth;if(e>0){c=e;do{if((p=W.round(d.preferredWidth-e,1))>=d.minWidth){d.preferredWidth=p,s=(s=i.leftIndent+e)>=-1440?s<=1440?s:1440:-1440;break}c=e,e+=p-d.minWidth}while(e!==c)}else{var c=e;do{var p=W.round(d.preferredWidth-e,1);if(p<=2112){d.preferredWidth=p,s=(s=i.leftIndent+e)>=-1440?s<=1440?s:1440:-1440;break}c=e,e-=p-2112}while(e!==c)}var u=e;"Left"!==a&&i.tableHolder.getTotalWidth(0)>o&&"Auto"===i.tableFormat.preferredWidthType&&(i.tableHolder.isFitColumns(o,i.tableHolder.tableWidth,"Auto"===i.tableFormat.preferredWidthType)?i.tableHolder.fitColumns(o,i.tableHolder.tableWidth,"Auto"===i.tableFormat.preferredWidthType):d.preferredWidth=h,u=0),"Center"===a&&(i.tableHolder.getTotalWidth(0)<o||"Auto"!==i.tableFormat.preferredWidthType)&&(u/=2),i.tableFormat.leftIndent="Left"===a?s:0,i.tableHolder.tableWidth=i.tableHolder.getTotalWidth(0),this.updateCellPreferredWidths(i),this.updateGridValue(i,!0,u)}else if(null!==i&&this.resizerPosition===i.tableHolder.columns.length)this.resizeColumnAtLastColumnIndex(i,e,o);else{if(-1===this.resizerPosition)return void(this.owner.isLayoutEnabled=!0);this.resizeCellAtMiddle(i,e)}this.owner.isLayoutEnabled=!0,r.selectPosition(r.start,r.end)}},e.prototype.resizeColumnWithSelection=function(e,t,i){var n=this.getTableCellWidget(this.startingPoint);if(n&&(e.selectedWidgets.containsKey(n)||n.previousWidget&&e.selectedWidgets.containsKey(n.previousWidget))){var r=e.getSelectedCells();if(0===this.resizerPosition)this.resizeColumnAtStart(t,i,r);else if(null!==t&&this.resizerPosition===t.tableHolder.columns.length){for(var o=this.getColumnCells(t,this.resizerPosition,!0),s=0;s<o.length;s++){var a=o[s];-1!==r.indexOf(a)&&this.increaseOrDecreaseWidth(a,i,!0)}this.updateRowsGridAfterWidth(t),t.updateWidth(i),t.tableFormat.allowAutoFit=!1,this.updateGridValue(t,!0,i)}else{if(-1===this.resizerPosition)return!1;var l=this.resizerPosition,o=this.getColumnCells(t,l,!0),d=this.getColumnCells(t,l,!1),h=this.isColumnSelected(t,l);if(o.length>0&&!h)for(s=0;s<o.length;s++)-1===r.indexOf(o[s])&&(o.splice(s,1),s--);if(d.length>0&&!h)for(s=0;s<d.length;s++)-1===r.indexOf(d[s])&&(d.splice(s,1),s--);if(0===o.length&&d.length>0)for(s=0;s<d.length;s++)(a=d[s]).previousWidget&&o.push(a.previousWidget);else if(0===d.length&&o.length>0)for(s=0;s<o.length;s++)(a=o[s]).nextWidget&&d.push(a.nextWidget);this.changeWidthOfCells(t,o,d,i),t.tableFormat.allowAutoFit&&t.updateWidth(i),t.tableFormat.allowAutoFit=!1,this.updateGridValue(t,!0,i)}e.selectPosition(e.start,e.end)}return!1},e.prototype.resizeColumnAtStart=function(e,t,i){var n=e.leftIndent,r=i[0].ownerRow,o=r.rowFormat;if(o.beforeWidth>0){var s=o.beforeWidth+t;if(s>0)this.updateGridBefore(r,t);else if(s<(a=this.getLeastGridBefore(e,r))&&0!==s){n=e.leftIndent+s,e.tableFormat.leftIndent=n>=-1440?n<=1440?n:1440:-1440;for(l=0;l<e.childWidgets.length;l++)r!==(d=e.childWidgets[l])&&this.updateGridBefore(d,-s)}}else if(t<0)n=e.leftIndent+t,e.tableFormat.leftIndent=n>=-1440?n<=1440?n:1440:-1440,this.updateWidthForCells(e,i,t);else{var a=this.getLeastGridBefore(e,r);if(0===e.tableFormat.leftIndent)for(l=0;l<e.childWidgets.length;l++){d=e.childWidgets[l];-1!==i.indexOf(d.childWidgets[0])&&(this.updateGridBefore(d,t),this.increaseOrDecreaseWidth(d.childWidgets[0],t,!1))}else if(a-t>0)n=e.leftIndent+t,e.tableFormat.leftIndent=n>=-1440?n<=1440?n:1440:-1440,this.updateWidthForCells(e,i,t);else{n=e.leftIndent+a,e.tableFormat.leftIndent=n>=-1440?n<=1440?n:1440:-1440;for(var l=0;l<e.childWidgets.length;l++){var d=e.childWidgets[l];-1!==i.indexOf(d.childWidgets[0])?(this.increaseOrDecreaseWidth(d.childWidgets[0],t,!1),this.updateGridBefore(d,t-a)):this.updateGridBefore(d,-a)}}}e.tableFormat.allowAutoFit=!1,this.updateGridValue(e,!0,t)},e.prototype.updateWidthForCells=function(e,t,i){for(var n=0;n<e.childWidgets.length;n++){var r=e.childWidgets[n];-1!==t.indexOf(r.childWidgets[0])?this.increaseOrDecreaseWidth(r.childWidgets[0],i,!1):this.updateGridBefore(r,-i)}},e.prototype.resizeColumnAtLastColumnIndex=function(e,t,i){for(var n=e.tableFormat.tableAlignment,r=e.tableFormat.preferredWidth,o=this.resizerPosition,s=e.tableHolder.columns[o-1],a=0;t!==a;){var l=W.round(s.preferredWidth+t,1);l>=s.minWidth?(s.preferredWidth=l,a=t):(a=t,t-=l-s.minWidth)}this.updateCellPreferredWidths(e),(r||e.tableHolder.getTotalWidth(0)>i)&&(e.tableFormat.allowAutoFit=!1,e.updateWidth(t),e.tableHolder.tableWidth=e.tableHolder.getTotalWidth(0));var d=t;"Right"===n?d=0:"Center"===n&&(d/=2),this.updateGridValue(e,!0,d)},e.prototype.resizeCellAtMiddle=function(e,t){var i=this.resizerPosition,n=e.tableHolder.columns[i-1],r=e.tableHolder.columns[i];if(t>0)for(o=!0;o;)(s=W.round(r.preferredWidth-t,1))>=r.minWidth?(r.preferredWidth=s,n.preferredWidth=n.preferredWidth+t,o=!1):t+=s-r.minWidth;else for(var o=!0;o;){var s=W.round(n.preferredWidth+t,1);s>=n.minWidth?(n.preferredWidth=s,r.preferredWidth=r.preferredWidth-t,o=!1):t-=s-n.minWidth}this.updateCellPreferredWidths(e),e.tableFormat.allowAutoFit&&e.updateWidth(t),e.tableFormat.allowAutoFit=!1,e.tableHolder.tableWidth=e.tableHolder.getTotalWidth(0),this.updateGridValue(e,!1,t)},e.prototype.updateGridValue=function(e,t,i){if(t&&(e.calculateGrid(),e.isGridUpdated=!1),e.buildTableColumns(),e.isGridUpdated=!0,this.viewer.owner.isLayoutEnabled=!0,e.isInsideTable){var n=this.documentHelper.layout.getParentTable(e);this.documentHelper.layout.reLayoutTable(n)}else this.documentHelper.layout.reLayoutTable(e);this.owner.editor.getOffsetValue(this.documentHelper.selection),this.owner.editorModule.reLayout(this.owner.selection),i&&(this.startingPoint.x+=W.convertPointToPixel(i),this.resizerPosition=this.getCellReSizerPosition(this.startingPoint))},e.prototype.getColumnCells=function(e,t,i){for(var n=[],r=0;r<e.childWidgets.length;r++)for(var o=e.childWidgets[r],s=0;s<o.childWidgets.length;s++){var a=o.childWidgets[s];i?a.columnIndex+a.cellFormat.columnSpan===t&&n.push(a):a.columnIndex===t&&n.push(a)}return n},e.prototype.updateGridBefore=function(e,t){e.rowFormat.beforeWidth+t!==e.rowFormat.beforeWidth&&(e.rowFormat.beforeWidth=e.rowFormat.beforeWidth+t,e.rowFormat.gridBeforeWidth=e.rowFormat.beforeWidth)},e.prototype.getLeastGridBefore=function(e,t){for(var i=0,n=0,r=0;r<e.childWidgets.length;r++){var o=e.childWidgets[r];o!==t&&(0===n&&(i=o.rowFormat.beforeWidth,n++),o.rowFormat.beforeWidth<=i&&(i=o.rowFormat.beforeWidth))}return i},e.prototype.increaseOrDecreaseWidth=function(e,t,i){var n=e.cellFormat.preferredWidth;"Auto"===e.cellFormat.preferredWidthType&&(n=e.cellFormat.cellWidth,e.cellFormat.preferredWidthType="Point");var r=e.ownerColumn.minWidth;"Percent"===e.cellFormat.preferredWidthType&&(r=e.convertPointToPercent(r)),e.cellFormat.preferredWidth=i?n+t>r?n+t:r:n-t>r?n-t:r},e.prototype.changeWidthOfCells=function(e,t,i,n){if(t.length>0){for(var r=!1,o=0;o<t.length;o++){var s=t[o];this.increaseOrDecreaseWidth(s,n,!0),s.cellIndex===s.ownerRow.childWidgets.length-1&&(r=!0)}r&&this.updateRowsGridAfterWidth(e)}if(i.length>0){for(var a=0,o=0;o<i.length;o++){if(0===(s=i[o]).cellIndex){var l=s.ownerRow.rowFormat.beforeWidth+n;l>=0?this.updateGridBefore(s.ownerRow,n):(a!==l&&(a=l),s.ownerRow.rowFormat.gridBeforeWidth=0,s.ownerRow.rowFormat.gridBeforeWidthType="Auto")}this.increaseOrDecreaseWidth(s,n,!1)}if(0!==a){var d=e.leftIndent+a;e.tableFormat.leftIndent=d>=-1440?d<=1440?d:1440:-1440;for(var h=0;h<e.childWidgets.length;h++){var c=e.childWidgets[h];-1===i.indexOf(c.childWidgets[0])&&this.updateGridBefore(c,a>0?a:-a)}}}},e.prototype.updateRowsGridAfterWidth=function(e){for(var t=this.getMaxRowWidth(e,!0),i=0;i<e.childWidgets.length;i++){var n=e.childWidgets[i],r=this.getRowWidth(n,!0);if(t>=r&&n.rowFormat.afterWidth!==t-r){var o=t-r;n.rowFormat.gridAfterWidth=o,n.rowFormat.afterWidth=o}}},e.prototype.getRowWidth=function(e,t){var i=0;t&&(i+=e.rowFormat.beforeWidth);for(var n=0;n<e.childWidgets.length;n++)i+=e.childWidgets[n].cellFormat.cellWidth;return i},e.prototype.getMaxRowWidth=function(e,t){for(var i=0,n=0;n<e.childWidgets.length;n++){var r=e.childWidgets[n],o=0;t&&(o+=r.rowFormat.beforeWidth);for(var s=0;s<r.childWidgets.length;s++)o+=r.childWidgets[s].cellFormat.cellWidth;i<o&&(i=o)}return i},e.prototype.isColumnSelected=function(e,t){for(var i=this.owner.selection.getSelectedCells(),n=this.getColumnCells(e,t,!0),r=this.getColumnCells(e,t,!1),o=!1,s=0;s<n.length;s++){a=n[s];o=-1!==i.indexOf(a)}if(!o)for(s=0;s<r.length;s++){var a=r[s];o=-1!==i.indexOf(a)}return o},e.prototype.applyProperties=function(e,i){if(!t.isNullOrUndefined(i)){i.tableHolder&&(e.tableHolder=i.tableHolder.clone()),null!==i.tableFormat&&(e.tableFormat.leftIndent=i.tableFormat.leftIndent,e.tableFormat.preferredWidth=i.tableFormat.preferredWidth,e.tableFormat.preferredWidthType=i.tableFormat.preferredWidthType,e.tableFormat.allowAutoFit=i.tableFormat.allowAutoFit);for(var n=0;n<e.childWidgets.length;n++){var r=e.childWidgets[n],o=i.rows[n];r.rowFormat.gridBefore=o.gridBefore,r.rowFormat.gridBeforeWidth=o.gridBeforeWidth,r.rowFormat.gridBeforeWidthType=o.gridBeforeWidthType,r.rowFormat.gridAfter=o.gridAfter,r.rowFormat.gridAfterWidth=o.gridAfterWidth,r.rowFormat.gridAfterWidthType=o.gridAfterWidthType;for(var s=0;s<r.childWidgets.length;s++){var a=r.childWidgets[s],l=o.cells[s];a.columnIndex=l.columnIndex,a.cellFormat.columnSpan=l.columnSpan,a.cellFormat.preferredWidth=l.preferredWidth,a.cellFormat.preferredWidthType=l.preferredWidthType}}var d=e.getOwnerWidth(!0),h=e.getTableClientWidth(d);e.setWidthToCells(h,"Auto"===e.tableFormat.preferredWidthType)}},e.prototype.getActualWidth=function(e){var t=0;if(e.childWidgets.length>0)for(var i=0;i<e.childWidgets.length;i++)t+=e.childWidgets[i].cellFormat.cellWidth;return t},e.prototype.setPreferredWidth=function(e){for(var t=0;t<e.childWidgets.length;t++){var i=e.childWidgets[t],n=i.rowFormat;n.gridBefore>0&&(n.gridBeforeWidth=n.beforeWidth,n.gridBeforeWidthType="Point");for(var r=0;r<i.childWidgets.length;r++){var o=i.childWidgets[r];o.cellFormat.preferredWidth=o.cellFormat.cellWidth,o.cellFormat.preferredWidthType="Point"}n.gridAfter>0&&(n.gridAfterWidth=n.afterWidth,n.gridAfterWidthType="Point")}},e.prototype.updateCellPreferredWidths=function(e){for(var t=e.tableHolder.tableWidth,i=0;i<e.childWidgets.length;i++){var n=e.childWidgets[i];if(n.rowFormat.gridBefore>0){var r=e.tableHolder.getCellWidth(0,n.rowFormat.gridBefore,t);this.updateGridBeforeWidth(r,n)}for(var o=0;o<n.childWidgets.length;o++){var s=n.childWidgets[o];s.updateWidth(e.tableHolder.getCellWidth(s.columnIndex,s.cellFormat.columnSpan,t))}n.rowFormat.gridAfter>0&&this.updateGridAfterWidth(e.tableHolder.getCellWidth(n.childWidgets.length,n.rowFormat.gridAfter,t),n)}},e.prototype.updateGridBeforeWidth=function(e,t){var i=t.rowFormat;if(e!==i.beforeWidth)if(i.beforeWidth=e,"Auto"===i.gridBeforeWidthType&&(i.gridBeforeWidthType="Point"),"Point"===i.gridBeforeWidthType)i.gridBeforeWidth=i.beforeWidth;else{var n=t.ownerTable.getTableClientWidth(t.ownerTable.getOwnerWidth(!0)),r=t.ownerTable.convertPointToPercent(i.beforeWidth,n);i.gridBeforeWidth=r}},e.prototype.updateGridAfterWidth=function(e,t){var i=t.rowFormat;if(e!==i.afterWidth&&(i.afterWidth=e),"Auto"===i.gridAfterWidthType&&(i.gridAfterWidthType="Point"),"Point"===i.gridAfterWidthType)i.gridAfterWidth=i.afterWidth;else{var n=t.ownerTable.getTableClientWidth(t.ownerTable.getOwnerWidth(!0)),r=t.ownerTable.convertPointToPercent(i.afterWidth,n);i.gridAfterWidth=r}},e}(),zt=function(){function e(e){var i=this;this.nodes=[],this.editHyperlinkInternal=!1,this.startParagraph=void 0,this.endParagraph=void 0,this.removeEditRange=!1,this.formFieldCounter=1,this.skipFieldDeleteTracking=!1,this.isForHyperlinkFormat=!1,this.isTrackingFormField=!1,this.isRemoveRevision=!1,this.isHandledComplex=!1,this.tableResize=void 0,this.tocStyles={},this.chartType=!1,this.refListNumber=void 0,this.incrementListNumber=-1,this.removedBookmarkElements=[],this.tocBookmarkId=0,this.copiedData=void 0,this.pageRefFields={},this.delBlockContinue=!1,this.delBlock=void 0,this.delSection=void 0,this.isInsertingTOC=!1,this.editStartRangeCollection=[],this.skipReplace=!1,this.skipTableElements=!1,this.listNumberFormat="",this.listLevelNumber=0,this.isXmlMapped=!1,this.copiedContent="",this.copiedTextContent="",this.previousParaFormat=void 0,this.previousCharFormat=void 0,this.previousSectionFormat=void 0,this.pasteTextPosition=void 0,this.isSkipHistory=!1,this.isPaste=!1,this.isPasteListUpdated=!1,this.isInsertField=!1,this.isBordersAndShadingDialog=!1,this.onTextInputInternal=function(){if(t.Browser.isDevice){var e=i.documentHelper,n=new RegExp(String.fromCharCode(160),"g"),r=new RegExp(String.fromCharCode(10),"g");e.prefix=e.prefix.replace(n," ").replace(r," ");var o=(s=e.editableDiv.textContent.replace(n," ").replace(r," ")).substring(2);if(e.isCompositionStart&&e.isCompositionUpdated)return e.isCompositionUpdated=!1,void(!e.owner.isReadOnlyMode&&e.owner.isDocumentLoaded&&i.canEditContentControl&&e.prefix.substring(2)!==o&&(i.selection.isEmpty?(i.selection.start.setPositionForLineWidget(e.selection.start.currentWidget,i.selection.start.offset-(e.prefix.length-2)),i.handleTextInput(o),e.prefix="@"+String.fromCharCode(160)+o):(i.handleTextInput(o),e.prefix="@"+String.fromCharCode(160)+o)));if(e.isCompositionStart&&e.isCompositionEnd&&""===e.suffix)return e.prefix.substring(2)!==o?i.selection.isEmpty&&e.isCompositionStart?(e.isCompositionStart=!1,i.selection.start.setPositionForLineWidget(e.selection.start.currentWidget,i.selection.start.offset-e.prefix.substring(2).length),i.selection.retrieveCurrentFormatProperties(),""!==e.suffix&&""!==o||i.handleTextInput(o)):i.selection.isEmpty||(e.isCompositionStart=!1,i.handleTextInput(o)):""===o?(e.isCompositionStart=!1,i.handleBackKey()):e.prefix.substring(2)===o&&""===e.suffix&&(e.isCompositionStart=!1,i.handleTextInput(" ")),void(e.isCompositionEnd=!1);if(e.isCompositionEnd||e.isCompositionStart&&!e.isCompositionUpdated){if(o.length<e.prefix.length&&o===e.prefix.substring(2,e.prefix.length-1)||e.editableDiv.innerText.length<2)return void i.handleBackKey();if(""!==e.suffix&&e.editableDiv.innerText[e.editableDiv.innerText.length-1]!==String.fromCharCode(160))return e.isCompositionStart=!1,i.selection.start.setPositionForLineWidget(e.selection.start.currentWidget,i.selection.start.offset-(e.prefix.length-2)),i.selection.end.setPositionForLineWidget(e.selection.end.currentWidget,i.selection.end.offset+e.suffix.length),i.selection.retrieveCurrentFormatProperties(),void i.handleTextInput(o)}"\r"!==s&&"\b"!==s&&""!==s&&!e.owner.isReadOnlyMode&&!1===e.isControlPressed&&i.canEditContentControl&&("@"===s||"@"!==s[0]||""===s||s.length<e.prefix.length&&o===e.prefix.substring(2,e.prefix.length-1)?(i.handleBackKey(),e.editableDiv.innerText.length<2&&i.predictText()):0===s.indexOf(e.prefix)&&s.length>e.prefix.length?i.handleTextInput(s.substring(e.prefix.length)):-1===s.indexOf(e.prefix)&&s[s.length-1]!==String.fromCharCode(160)&&" "!==s[s.length-1]?(o.charAt(0).toLowerCase()+o.slice(1)===e.prefix.substring(2)&&i.selection.start.setPositionParagraph(e.selection.start.currentWidget,i.selection.start.offset-(e.prefix.length-2)),i.handleTextInput(o)):2!==s.length&&i.handleTextInput(" "))}else{var s=i.documentHelper.editableDiv.innerText;s!==String.fromCharCode(160)?"\r"!==s&&"\b"!==s&&""!==s&&!i.owner.isReadOnlyMode&&!1===i.documentHelper.isControlPressed&&i.canEditContentControl&&i.handleTextInput(s):i.handleTextInput(" "),i.documentHelper.editableDiv.innerText=""}},this.onPaste=function(e){!i.owner.isReadOnlyMode&&i.canEditContentControl&&i.pasteInternal(e),e.preventDefault()},this.documentHelper=e,this.tableResize=new Ut(this.documentHelper.owner),this.base64=new k}return Object.defineProperty(e.prototype,"restrictFormatting",{get:function(){return this.documentHelper.isDocumentProtected&&(this.documentHelper.restrictFormatting||!this.documentHelper.restrictFormatting&&!this.selection.isSelectionInEditRegion())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"restrictEditing",{get:function(){return this.documentHelper.isDocumentProtected&&("ReadOnly"===this.documentHelper.protectionType&&!this.selection.isSelectionInEditRegion()||"FormFieldsOnly"===this.documentHelper.protectionType)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"canEditContentControl",{get:function(){return!this.owner.isReadOnlyMode&&!this.selection.checkContentControlLocked()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewer",{get:function(){return this.owner.viewer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"editorHistory",{get:function(){return this.documentHelper.owner.editorHistory},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selection",{get:function(){if(this.documentHelper)return this.documentHelper.selection},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"owner",{get:function(){return this.documentHelper.owner},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"Editor"},e.prototype.insertField=function(e,i){this.isInsertField=!0;var n=e;if(t.isNullOrUndefined(i)&&"MERGEFIELD"===(n=W.trimStart(n)).substring(0,10)){var r=(n=n.substring(10).trim()).indexOf("\\*");i="«"+n.substring(0,r).trim()+"»"}var o=new fe,s=new H,a=this.copyInsertFormat(s,!1),l=new we(o),d=new xe(0);d.characterFormat.mergeFormat(a),l.children.push(d);var h=new Ie;h.text=e,l.children.push(h);var c=new xe(2);c.fieldBegin=d,d.fieldSeparator=c,l.children.push(c);var p=new Ie;p.text=i,p.characterFormat.mergeFormat(a),l.children.push(p);var u=new xe(1);u.characterFormat.mergeFormat(a),u.fieldSeparator=c,u.fieldBegin=d,d.fieldEnd=u,c.fieldEnd=u,l.children.push(u),d.line=l,o.childWidgets.push(l),this.documentHelper.fields.push(d);var g=new pe;g.sectionFormat=new b(g),g.childWidgets.push(o),this.pasteContentsInternal([g],!1),this.isInsertField=!1},e.prototype.applyStyle=function(e,i){var n=void 0,r=void 0;if(i=!t.isNullOrUndefined(i)&&i){this.initComplexHistory("ApplyStyle"),this.setOffsetValue(this.selection),n=this.startOffset,r=this.endOffset;var o=this.selection.isEmpty;this.clearFormatting(),o&&!this.selection.isEmpty&&this.selection.end.setPositionInternal(this.selection.start)}var s=this.documentHelper.styles.findByName(e);void 0!==s?this.onApplyParagraphFormat("styleName",s,!1,!0):(this.documentHelper.owner.parser.parseStyle(JSON.parse(this.getCompleteStyles()),JSON.parse(this.documentHelper.preDefinedStyles.get(e)),this.documentHelper.styles),this.applyStyle(e)),this.editorHistory&&this.editorHistory.currentHistoryInfo&&"ApplyStyle"===this.editorHistory.currentHistoryInfo.action&&(this.startOffset=n,this.endOffset=r,this.editorHistory.updateComplexHistory()),this.startParagraph=void 0,this.endParagraph=void 0},e.prototype.cut=function(){this.owner.isReadOnlyMode||this.selection.isEmpty||!this.canEditContentControl||(this.selection.copySelectedContent(!0),this.documentHelper.owner.parser.isCutPerformed=!0)},e.prototype.insertEditingRegion=function(e){this.insertEditRangeElement(e&&""!==e?e:"Everyone")},e.prototype.enforceProtection=function(e,t,i){var n,r;"boolean"==typeof t?(n=i?"ReadOnly":this.documentHelper.protectionType,r=t):(r=!0,n=t),this.documentHelper.restrictFormatting=r,this.documentHelper.protectionType=n,this.selection.isHighlightEditRegion=!0,this.addProtection(e,this.documentHelper.protectionType)},e.prototype.getCommentHierarchicalIndex=function(e){for(var t="";e.ownerComment;)t=e.ownerComment.replyComments.indexOf(e)+";"+t,e=e.ownerComment;return t="C;"+this.documentHelper.comments.indexOf(e)+";"+t},e.prototype.alertBox=function(){var e=new t.L10n("documenteditor",this.owner.defaultLocale);e.setLocale(this.owner.locale),n.DialogUtility.alert(e.getConstant("Multiple Comment"))},e.prototype.insertComment=function(e){if(!(t.isNullOrUndefined(this.selection.start)||this.owner.isReadOnlyMode||this.viewer.owner.enableHeaderAndFooter)&&this.viewer.owner.enableComment){if(this.viewer.owner.commentReviewPane.commentPane.isEditMode)return this.alertBox();t.isNullOrUndefined(e)&&(e=""),this.insertCommentInternal(e)}},e.prototype.insertCommentInternal=function(e){if(this.selection.isEmpty){if(this.selection.start.isAtSamePosition(this.selection.end)&&this.selection.start.isAtParagraphEnd){var i=this.selection.start.offset;this.selection.start.offset=i-1!=-1?i-1:i}this.selection.selectCurrentWord(),this.selection.isParagraphLastLine(this.selection.end.currentWidget)&&this.selection.end.offset===this.selection.getLineLength(this.selection.end.currentWidget)+1&&(this.selection.end.offset-=1)}var n=this.selection.getParagraphInfo(this.selection.start),r=(this.selection.getHierarchicalIndex(n.paragraph,n.offset.toString()),this.selection.getParagraphInfo(this.selection.end));this.selection.getHierarchicalIndex(r.paragraph,r.offset.toString());this.initComplexHistory("InsertComment");var o=this.selection.start,s=this.selection.end,a=new Nt(this.owner);this.selection.isForward||(o=this.selection.end,s=this.selection.start),a.setPositionInternal(s);var l=new pt(0),d=new pt(1),h=o.isInSameParagraphIndex(s);if(s.setPositionInternal(o),this.initInsertInline(l),t.isNullOrUndefined(a.paragraph)){var c=this.selection.getHierarchicalIndex(r.paragraph,r.offset.toString()),p=this.selection.getTextPosBasedOnLogicalIndex(c);a.setPositionInternal(p)}h&&a.setPositionParagraph(a.currentWidget,a.offset+l.length),o.setPositionInternal(a),s.setPositionInternal(a),this.initInsertInline(d);var u=new ut((new Date).toISOString());this.owner.editorHistory&&(this.initHistory("InsertCommentWidget"),this.owner.editorHistory.currentBaseHistoryInfo.removedNodes.push(u)),u.author=this.owner.currentUser?this.owner.currentUser:"Guest user",u.initial=this.constructCommentInitial(u.author),u.text=e,u.commentId=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),l.comment=u,l.commentId=u.commentId,d.comment=u,d.commentId=u.commentId,u.commentStart=l,u.commentEnd=d,this.addCommentWidget(u,!0,!0,!0),this.editorHistory&&(this.editorHistory.currentBaseHistoryInfo.insertPosition=this.getCommentHierarchicalIndex(u),this.editorHistory.updateHistory()),this.editorHistory&&this.editorHistory.updateComplexHistory(),this.reLayout(this.selection,!1)},e.prototype.deleteAllComments=function(){if(0!==this.documentHelper.comments.length){this.initComplexHistory("DeleteAllComments"),this.owner.isLayoutEnabled=!1;var e;for(this.editorHistory&&this.editorHistory.currentHistoryInfo&&(e=this.editorHistory.currentHistoryInfo);this.documentHelper.comments.length>0;){var t=this.documentHelper.comments[0];this.initComplexHistory("DeleteComment"),this.deleteCommentInternal(t),this.editorHistory&&this.editorHistory.currentHistoryInfo&&e.addModifiedAction(this.editorHistory.currentHistoryInfo)}this.selection.selectContent(this.owner.documentStart,!0),this.editorHistory&&(this.editorHistory.currentHistoryInfo=e,this.editorHistory.updateComplexHistory())}},e.prototype.deleteComment=function(){this.owner.isReadOnlyMode||t.isNullOrUndefined(this.owner)||t.isNullOrUndefined(this.owner.viewer)||t.isNullOrUndefined(this.owner.documentHelper.currentSelectedComment)||this.owner.enableHeaderAndFooter||!this.viewer.owner.enableComment||this.deleteCommentInternal(this.owner.documentHelper.currentSelectedComment)},e.prototype.deleteCommentInternal=function(e){if(this.initComplexHistory("DeleteComment"),e){var t=e.commentStart,i=e.commentEnd;if(this.removeInline(i),this.removeInline(t),t.removeCommentMark(),e.replyComments.length>0)for(var n=e.replyComments.length-1;n>=0;n--)this.deleteCommentInternal(e.replyComments[n]);this.owner.editorHistory&&(this.initHistory("DeleteCommentWidget"),this.owner.editorHistory.currentBaseHistoryInfo.insertPosition=this.getCommentHierarchicalIndex(e),this.owner.editorHistory.currentBaseHistoryInfo.removedNodes.push(e)),this.deleteCommentWidget(e),this.editorHistory&&this.editorHistory.updateHistory()}this.editorHistory&&this.editorHistory.updateComplexHistory()},e.prototype.deleteCommentWidget=function(e){var t=this.documentHelper.comments.indexOf(e);-1!==t?this.documentHelper.comments.splice(t,1):e.isReply&&e.ownerComment&&(t=e.ownerComment.replyComments.indexOf(e),e.ownerComment.replyComments.splice(t,1)),this.owner.commentReviewPane&&(this.owner.commentReviewPane.deleteComment(e),this.documentHelper.currentSelectedComment===e&&(this.documentHelper.currentSelectedComment=void 0))},e.prototype.resolveComment=function(e){var t={author:e.author,cancel:!1,type:"Resolve"};this.owner.trigger("beforeCommentAction",t),t.cancel&&"Resolve"===t.type||(this.resolveOrReopenComment(e,!0),this.owner.commentReviewPane&&this.owner.commentReviewPane.resolveComment(e))},e.prototype.reopenComment=function(e){var t={author:e.author,cancel:!1,type:"Reopen"};this.owner.trigger("beforeCommentAction",t),t.cancel&&"Reopen"===t.type||(this.resolveOrReopenComment(e,!1),this.owner.commentReviewPane&&this.owner.commentReviewPane.reopenComment(e))},e.prototype.resolveOrReopenComment=function(e,t){e.isResolved=t;for(var i=0;i<e.replyComments.length;i++)e.replyComments[i].isResolved=t},e.prototype.replyComment=function(e,t){var i=e;if(e){this.initComplexHistory("InsertComment");var n=i.commentStart,r=i.commentEnd,o=n.line.getOffset(n,1),s=new Nt(this.documentHelper.owner);s.setPositionParagraph(n.line,o);var a=r.line.getOffset(r,1),l=new Nt(this.documentHelper.owner);l.setPositionParagraph(r.line,a),this.selection.start.setPositionInternal(s),this.selection.end.setPositionInternal(l),s=this.selection.start,l=this.selection.end;var d=new Nt(this.owner);d.setPositionInternal(l);var h=new pt(0),c=new pt(1),p=s.isInSameParagraph(l);l.setPositionInternal(s),this.initInsertInline(h),p&&d.setPositionParagraph(d.currentWidget,d.offset+h.length),s.setPositionInternal(d),l.setPositionInternal(d),this.initInsertInline(c);var u=new ut((new Date).toISOString());u.author=this.owner.currentUser?this.owner.currentUser:"Guest user",u.text=t||"",u.commentId=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),u.isReply=!0,i.replyComments.push(u),u.ownerComment=i,this.owner.editorHistory&&(this.initHistory("InsertCommentWidget"),this.owner.editorHistory.currentBaseHistoryInfo.removedNodes.push(u)),h.comment=u,h.commentId=u.commentId,c.comment=u,c.commentId=u.commentId,u.commentStart=h,u.commentEnd=c,this.owner.commentReviewPane&&this.owner.commentReviewPane.addReply(u,!1,!0),this.editorHistory&&(this.editorHistory.currentBaseHistoryInfo.insertPosition=this.getCommentHierarchicalIndex(u),this.editorHistory.updateHistory()),this.editorHistory&&this.editorHistory.updateComplexHistory(),this.reLayout(this.selection)}},e.prototype.removeInline=function(e){this.selection.start.setPositionParagraph(e.line,e.line.getOffset(e,0)),this.selection.end.setPositionParagraph(this.selection.start.currentWidget,this.selection.start.offset+e.length),this.initHistory("RemoveInline"),this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&this.updateHistoryPosition(this.selection.start,!0),this.removeSelectedContents(this.documentHelper.selection),this.editorHistory&&this.editorHistory.updateHistory(),this.fireContentChange()},e.prototype.addCommentWidget=function(e,t,i,n){if(-1===this.documentHelper.comments.indexOf(e)){var r=!1;if(this.documentHelper.comments.length>0)for(var o=this.selection.getElementPosition(e.commentStart).startPosition,s=0;s<this.documentHelper.comments.length;s++){var a=this.selection.getElementPosition(this.documentHelper.comments[s].commentStart).startPosition;if(o.isExistBefore(a)){r=!0,this.documentHelper.comments.splice(s,0,e);break}}r||this.documentHelper.comments.push(e),this.owner.commentReviewPane&&(this.owner.showComments=i,this.owner.commentReviewPane.selectedTab=0,this.owner.commentReviewPane.addComment(e,t,n),n&&this.owner.selection.selectComment(e))}},e.prototype.addReplyComment=function(e,t){var i=t.split(";"),n=this.documentHelper.comments[parseInt(i[1],10)];""!==i[2]&&(n.replyComments.splice(parseInt(i[2],10),0,e),e.ownerComment=n),this.owner.commentReviewPane&&(this.owner.showComments=!0,this.owner.commentReviewPane.addReply(e,!1,!0),this.owner.selection.selectComment(e))},e.prototype.addProtection=function(e,t){if(""===e)this.protectDocument(t);else{this.currentProtectionType=t;var i=new v,n={passwordBase64:this.base64.encodeString(e),saltBase64:"",spinCount:1e5},r=this.owner.serviceUrl+this.owner.serverActionSettings.restrictEditing;i.url=r,i.contentType="application/json;charset=UTF-8",i.onSuccess=this.enforceProtectionInternal.bind(this),i.onFailure=this.protectionFailureHandler.bind(this),i.onError=this.protectionFailureHandler.bind(this),i.customHeaders=this.owner.headers,i.send(n)}},e.prototype.protectionFailureHandler=function(e){var i=new t.L10n("documenteditor",this.owner.defaultLocale);i.setLocale(this.documentHelper.owner.locale),"onError"===e.name?n.DialogUtility.alert(i.getConstant("Error in establishing connection with web server")):(this.owner.fireServiceFailure(e),console.error(e.statusText))},e.prototype.enforceProtectionInternal=function(e){var t=JSON.parse(e.data);this.documentHelper.saltValue=t[0],this.documentHelper.hashValue=t[1],this.protectDocument(this.currentProtectionType)},e.prototype.protectDocument=function(e){this.protect(e);var t=this.documentHelper.restrictEditingPane.restrictPane;t&&"block"===t.style.display&&(this.documentHelper.restrictEditingPane.showStopProtectionPane(!0),this.documentHelper.restrictEditingPane.loadPaneValue(),this.documentHelper.dialog.hide())},e.prototype.stopProtection=function(e){if(this.documentHelper.isDocumentProtected){var t=new v,i={passwordBase64:this.base64.encodeString(e),saltBase64:this.documentHelper.saltValue,spinCount:1e5};t.url=this.owner.serviceUrl+this.owner.serverActionSettings.restrictEditing,t.contentType="application/json;charset=UTF-8",t.customHeaders=this.owner.headers,t.onSuccess=this.onUnProtectionSuccess.bind(this),t.onFailure=this.protectionFailureHandler.bind(this),t.onError=this.protectionFailureHandler.bind(this),t.send(i)}},e.prototype.onUnProtectionSuccess=function(e){var t=JSON.parse(e.data);this.validateHashValue(t[1])},e.prototype.validateHashValue=function(e){var i=new t.L10n("documenteditor",this.owner.defaultLocale);i.setLocale(this.documentHelper.owner.locale);var r=this.base64.decodeString(e),o=this.documentHelper.hashValue,s=this.base64.decodeString(o),a=!0;if(r.length===s.length){for(var l=0;l<r.length;l++)if(r[l]!==s[l]){a=!1;break}}else a=!1;a?this.unProtectDocument():n.DialogUtility.alert(i.getConstant("The password is incorrect"))},e.prototype.unProtectDocument=function(){this.documentHelper.isDocumentProtected=!1,this.documentHelper.restrictFormatting=!1,this.documentHelper.selection.highlightEditRegion();var e=this.documentHelper.restrictEditingPane.restrictPane;e&&"block"===e.style.display&&this.documentHelper.restrictEditingPane.showStopProtectionPane(!1),this.documentHelper.dialog.hide()},e.prototype.fireContentChange=function(){this.selection.isHighlightEditRegion&&(this.owner.enableLockAndEdit?this.owner.collaborativeEditingModule.updateLockRegion():this.selection.onHighlight()),this.selection.highlightFormFields(),this.isPaste||(this.copiedContent=void 0,this.copiedTextContent="",this.previousSectionFormat=void 0,this.previousParaFormat=void 0,this.previousCharFormat=void 0,this.selection.isViewPasteOptions=!1,this.isPasteListUpdated&&(this.isPasteListUpdated=!1),this.selection.showHidePasteOptions(void 0,void 0)),this.documentHelper.owner.isLayoutEnabled&&!this.documentHelper.owner.isShiftingEnabled&&this.documentHelper.owner.fireContentChange()},e.prototype.updateSelectionTextPosition=function(e){this.getOffsetValue(this.selection),this.selection.start.updatePhysicalPosition(!0),this.selection.isEmpty?this.selection.end.setPositionInternal(this.selection.start):this.selection.end.updatePhysicalPosition(!0),this.selection.upDownSelectionLength=this.selection.end.location.x,this.selection.fireSelectionChanged(e)},e.prototype.predictText=function(){this.documentHelper.suffix="",this.selection.start.paragraph.isEmpty()||0===this.selection.start.offset&&this.selection.start.currentWidget.isFirstLine()||0===this.selection.end.offset&&this.selection.end.currentWidget.isFirstLine()?this.documentHelper.prefix="":this.getPrefixAndSuffix(),this.documentHelper.prefix="@"+String.fromCharCode(160)+this.documentHelper.prefix,this.documentHelper.editableDiv.innerText=this.documentHelper.prefix,this.documentHelper.selection.setEditableDivCaretPosition(this.documentHelper.prefix.length)},e.prototype.getPrefixAndSuffix=function(){var e=this.owner.documentHelper;if(""!==this.selection.text)return void(e.prefix="");var i=0,n=this.selection.start.currentWidget.getInline(this.selection.start.offset,i),r=n.element;if(i=n.index,void 0!==r){var o=this.selection.getElementBoxInternal(r,i),s=o.element;i=o.index;var a=0;if(!t.isNullOrUndefined(s)){var l=!1;for(s instanceof Ie&&i>0&&s.line.isFirstLine()&&(e.prefix=""),r instanceof Ie||(r=this.selection.getPreviousTextElement(r));(a=e.prefix.lastIndexOf(" "))<0&&r instanceof Ie;)if(r.previousNode instanceof Ie&&-1===e.prefix.indexOf(" ")){if(l?e.prefix=r.text+e.prefix:(e.prefix=r.text.substring(0,i),l=!0),(r=r.previousNode)instanceof Ke)break;r instanceof Ie||(r=this.selection.getPreviousTextElement(r))}else if(!(r.previousNode instanceof Ie)){l?e.prefix=r.text+e.prefix:(e.prefix=r.text.substring(0,i),l=!0);break}e.prefix.length>1&&" "===e.prefix[e.prefix.length-1]&&"."===e.prefix[e.prefix.length-2]?(a=-1,e.prefix=""):a=e.prefix.lastIndexOf(" "),e.prefix=a<0?e.prefix:e.prefix.substring(a),0===e.prefix.indexOf(" ")&&e.prefix.length>=1&&(e.prefix=e.prefix.substring(1));var d=0,h=this.selection.end.currentWidget.getInline(this.selection.end.offset,d),c=h.element;if(d=h.index,o=this.selection.getElementBoxInternal(c,d),s=o.element,d=o.index,s){var p=!1;for(s instanceof Ie&&d<s.length&&(e.suffix="");(a=e.suffix.indexOf(" "))<0&&c instanceof Ie;)if(c.nextNode instanceof Ie&&-1===e.suffix.indexOf(" "))p?e.suffix=e.suffix+c.text:(e.suffix=s.text.substring(d),p=!0),c=c.nextNode;else if(!(c.nextNode instanceof Ie)){p?e.suffix=e.suffix+c.text:(e.suffix=s.text.substring(d),p=!0);break}a=e.suffix.indexOf(" "),e.suffix=a<0?e.suffix:e.suffix.substring(0,a)}}}},e.prototype.onKeyDownInternal=function(e,t,i,n){var r=e.which||e.keyCode;if(!t||i||n)if(!i||t||n)if(i&&t&&!n)switch(r){case 68:this.owner.isReadOnlyMode||this.owner.selection.toggleUnderline("Double");break;case 77:this.owner.isReadOnlyMode||this.owner.selection.decreaseIndent(),e.preventDefault();break;case 188:e.preventDefault(),this.owner.isReadOnlyMode||this.onApplyCharacterFormat("fontSize","decrement",!0);break;case 190:e.preventDefault(),this.owner.isReadOnlyMode||this.onApplyCharacterFormat("fontSize","increment",!0);break;case 187:e.preventDefault(),this.owner.isReadOnlyMode||this.toggleBaselineAlignment("Superscript");break;case 69:if(e.preventDefault(),!this.owner.isReadOnlyMode){var o={isTrackChangesEnabled:!this.owner.enableTrackChanges};this.owner.trigger("trackChange",o)}}else if(!i&&t&&n)switch(r){case 72:e.preventDefault(),!this.owner.isReadOnlyMode&&this.owner.isDocumentLoaded&&this.toggleHighlightColor();break;case 70:e.preventDefault(),!this.owner.isReadOnlyMode&&this.owner.isDocumentLoaded&&this.insertFootnote();break;case 68:e.preventDefault(),!this.owner.isReadOnlyMode&&this.owner.isDocumentLoaded&&this.insertEndnote()}else switch(r){case 8:e.preventDefault(),this.handleBackKey();break;case 9:e.preventDefault(),this.owner.acceptTab&&this.selection.handleTabKey(!0,!1);break;case 13:e.preventDefault(),this.documentHelper.triggerSpellCheck=!0,this.handleEnterKey(),this.documentHelper.triggerSpellCheck=!1;break;case 27:e.preventDefault(),this.isPaste||(this.copiedContent=void 0,this.copiedTextContent="",this.previousParaFormat=void 0,this.previousCharFormat=void 0,this.previousSectionFormat=void 0,this.selection.isViewPasteOptions=!1,this.isPasteListUpdated&&(this.isPasteListUpdated=!1),this.selection.showHidePasteOptions(void 0,void 0));break;case 46:this.handleDelete(),e.preventDefault();break;case 32:this.selection.handleSpaceBarKey();break;case 120:var s=this.selection.getDocumentEnd();s.offset=this.selection.getDocumentEnd().offset+1,this.selection.start.isAtSamePosition(this.selection.getDocumentStart())&&this.selection.end.isAtSamePosition(s)?this.owner.updateFields():this.selection.updateRefField()}else switch(r){case 9:e.preventDefault(),this.owner.acceptTab&&this.selection.handleTabKey(!1,!0);break;case 13:this.handleShiftEnter(),e.preventDefault()}else switch(this.documentHelper.isControlPressed=!0,r){case 8:e.preventDefault(),this.handleCtrlBackKey();break;case 46:e.preventDefault(),this.handleCtrlDelete();break;case 9:e.preventDefault(),this.owner.acceptTab&&this.selection.handleTabKey(!1,!1);break;case 13:e.preventDefault(),this.insertPageBreak();break;case 48:e.preventDefault(),this.onApplyParagraphFormat("beforeSpacing",0,!1,!1);break;case 49:e.preventDefault(),this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.onApplyParagraphFormat("lineSpacing",1,!1,!1);break;case 50:e.preventDefault(),this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.onApplyParagraphFormat("lineSpacing",2,!1,!1);break;case 53:e.preventDefault(),this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.onApplyParagraphFormat("lineSpacing",1.5,!1,!1);break;case 66:e.preventDefault(),this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.toggleBold();break;case 68:e.preventDefault(),!this.owner.isReadOnlyMode&&this.owner.fontDialogModule&&this.owner.fontDialogModule.showFontDialog();break;case 69:this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.toggleTextAlignment("Center"),e.preventDefault();break;case 72:e.preventDefault(),!this.owner.isReadOnly&&this.owner.optionsPaneModule&&(this.owner.optionsPaneModule.isReplace=!0,this.owner.optionsPaneModule.showHideOptionsPane(!0));break;case 73:e.preventDefault(),this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.toggleItalic();break;case 74:this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.toggleTextAlignment("Justify"),e.preventDefault();break;case 75:e.preventDefault(),this.owner.hyperlinkDialogModule&&!this.owner.isReadOnlyMode&&this.owner.hyperlinkDialogModule.show();break;case 76:this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.toggleTextAlignment("Left"),e.preventDefault();break;case 77:this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.owner.selection.increaseIndent(),e.preventDefault();break;case 78:e.preventDefault(),this.owner.isReadOnlyMode||this.owner.openBlank();break;case 82:this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.toggleTextAlignment("Right"),e.preventDefault();break;case 85:e.preventDefault(),this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.owner.selection.toggleUnderline("Single");break;case 88:e.preventDefault(),this.owner.isReadOnlyMode||this.owner.editor.cut();break;case 89:this.owner.enableEditorHistory&&(this.editorHistory.redo(),e.preventDefault());break;case 90:this.owner.enableEditorHistory&&(this.editorHistory.undo(),e.preventDefault());break;case 219:e.preventDefault(),this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.onApplyCharacterFormat("fontSize","decrement",!0);break;case 221:e.preventDefault(),this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.onApplyCharacterFormat("fontSize","increment",!0);break;case 187:e.preventDefault(),this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.toggleBaselineAlignment("Subscript")}},e.prototype.handleShiftEnter=function(){this.owner.isReadOnlyMode||this.handleTextInput("\v"),this.selection.checkForCursorVisibility()},e.prototype.handleBackKey=function(){(!this.owner.isReadOnlyMode&&this.canEditContentControl||this.selection.isInlineFormFillMode())&&this.owner.editorModule.onBackSpace(),this.selection.checkForCursorVisibility()},e.prototype.handleDelete=function(){(!this.owner.isReadOnlyMode&&this.canEditContentControl||this.selection.isInlineFormFillMode())&&this.owner.editorModule.delete(),this.selection.checkForCursorVisibility()},e.prototype.handleEnterKey=function(){(!this.owner.isReadOnlyMode&&this.canEditContentControl||this.selection.isInlineFormFillMode())&&(t.Browser.isDevice&&(this.documentHelper.isCompositionStart=!1),this.owner.editorModule.onEnter()),this.selection.checkForCursorVisibility()},e.prototype.handleCtrlBackKey=function(){var e=this.selection.start,i=this.selection.end;if(!this.owner.isReadOnlyMode||this.selection.isInlineFormFillMode())if(this.selection.isForward||(e=i),this.selection.isEmpty)this.selection.handleControlShiftLeftKey(),this.owner.editorModule.onBackSpace();else{if((t.isNullOrUndefined(e.paragraph.previousRenderedWidget)||e.paragraph.previousRenderedWidget instanceof ve)&&0===e.offset)return;this.selection.handleLeftKey(),this.selection.handleControlShiftLeftKey(),this.owner.editorModule.onBackSpace()}},e.prototype.handleCtrlDelete=function(){if(!this.owner.isReadOnlyMode&&this.canEditContentControl||this.selection.isInlineFormFillMode())if(this.selection.isEmpty)this.selection.handleControlShiftRightKey(),this.owner.editorModule.delete();else{this.selection.handleLeftKey(),this.selection.handleControlShiftRightKey();var e=this.selection.text;W.endsWith(e)&&this.selection.handleShiftLeftKey(),this.owner.editorModule.delete()}},e.prototype.handleTextInput=function(e){var i=this;(!this.owner.isReadOnlyMode&&this.canEditContentControl||this.selection.isInlineFormFillMode())&&(this.animationTimer&&clearTimeout(this.animationTimer),t.classList(this.selection.caret,[],["e-de-cursor-animation"]),this.owner.editorModule.insertText(e),this.animationTimer=setTimeout(function(){i.animationTimer&&clearTimeout(i.animationTimer),i.selection&&i.selection.caret&&t.classList(i.selection.caret,["e-de-cursor-animation"],[])},600)),this.selection.checkForCursorVisibility()},e.prototype.copyInsertFormat=function(e,i){var n=new H,r=this.selection.characterFormat;return i&&n.copyFormat(e),t.isNullOrUndefined(r.bold)||e.bold===r.bold||(n.bold=r.bold),t.isNullOrUndefined(r.italic)||e.italic===r.italic||(n.italic=r.italic),r.fontSize>0&&e.fontSize!==r.fontSize&&(n.fontSize=r.fontSize),t.isNullOrUndefined(r.fontFamily)||e.fontFamily===r.fontFamily||(n.fontFamily=r.fontFamily),t.isNullOrUndefined(r.highlightColor)||e.highlightColor===r.highlightColor||(n.highlightColor=r.highlightColor),t.isNullOrUndefined(r.baselineAlignment)||e.baselineAlignment===r.baselineAlignment||(n.baselineAlignment=r.baselineAlignment),t.isNullOrUndefined(r.fontColor)||e.fontColor===r.fontColor||(n.fontColor=r.fontColor),t.isNullOrUndefined(r.underline)||e.underline===r.underline||(n.underline=r.underline),t.isNullOrUndefined(r.strikethrough)||e.strikethrough===r.strikethrough||(n.strikethrough=r.strikethrough),n},e.prototype.getResultContentControlText=function(e){for(var i=e.nextNode,n="";!(i instanceof Le||(i instanceof Ie&&(n+=i.text),t.isNullOrUndefined(i)));)if(t.isNullOrUndefined(i.nextNode)){if(!i.paragraph.nextRenderedWidget)break;i=i.paragraph.nextRenderedWidget.firstChild.children[0]}else i=i.nextNode;return n},e.prototype.updateXmlMappedContentControl=function(){if(this.isXmlMapped){var e=this.getContentControl();e&&e.contentControlProperties&&this.updateCustomXml(e.contentControlProperties.xmlMapping.storeItemId,e.contentControlProperties.xmlMapping.xPath,this.getResultContentControlText(e))}},e.prototype.updateCustomXml=function(e,t,i){if(this.documentHelper.customXmlData.containsKey(e)){var n=this.documentHelper.customXmlData.get(e),r=(new DOMParser).parseFromString(n,"text/xml"),o=t.substring(t.lastIndexOf("/")+1);o=(o=(o=o.split("[")[0]).substring(o.lastIndexOf(":")+1)).substring(o.lastIndexOf("@")+1);var s=r.getElementsByTagName(o);if(s.length>0)s[0].childNodes[0].nodeValue=i;else{if(!(r.documentElement.attributes.length>0&&null!==r.documentElement.attributes.getNamedItem(o)))return;r.documentElement.attributes.getNamedItem(o).value=i}var a=(new XMLSerializer).serializeToString(r);this.documentHelper.customXmlData.set(e,a)}},e.prototype.insertText=function(e){t.isNullOrUndefined(e)||""===e||this.insertTextInternal(e,!1)},e.prototype.insertTextInternal=function(e,i,n){if("FormFieldsOnly"===this.documentHelper.protectionType&&this.selection.isInlineFormFillMode()){var r=this.selection.getCurrentFormField(),o=this.getFormFieldText(),s=new RegExp(this.owner.documentHelper.textHelper.getEnSpaceCharacter(),"gi");o.length>0&&""===o.replace(s,"")&&(o="",this.selection.selectFieldInternal(r));var a=r.formFieldData.maxLength;if(0!==a&&o.length>=a)return}var l,d=this.documentHelper.selection,h=!0;n=this.owner.enableTrackChanges&&t.isNullOrUndefined(n)?"Insertion":n,this.isListTextSelected(),(t.isNullOrUndefined(n)||"Insertion"===n)&&this.initHistory("Insert");var c=this.selection.getParagraphInfo(d.start),p=c.paragraph.paragraphFormat;d.editPosition=d.getHierarchicalIndex(c.paragraph,c.offset.toString());var u=d.start.paragraph.paragraphFormat.bidi;if(!d.isEmpty&&!d.isImageSelected||this.documentHelper.isListTextSelected&&"List"===d.contextType){d.isSkipLayouting=!0,d.skipFormatRetrieval=!0;var g=void 0;this.owner.enableTrackChanges&&(g=this.selection.start.isExistBefore(this.selection.end)?this.selection.end.clone():this.selection.start.clone(),this.skipReplace=!0),h=this.removeSelectedContents(d),this.skipReplace=!1,!t.isNullOrUndefined(g)&&this.owner.search.isRepalceTracking?(this.owner.search.isRepalceTracking=!1,this.selection.start.setPositionInternal(this.selection.start),this.selection.end.setPositionInternal(g)):t.isNullOrUndefined(g)||(this.selection.start.setPositionInternal(g),this.selection.end.setPositionInternal(g)),d.skipFormatRetrieval=!1,d.isSkipLayouting=!1}else!d.isEmpty||this.documentHelper.isListTextSelected||i||(this.documentHelper.isTextInput=!0);(c=this.selection.getParagraphInfo(d.start)).paragraph.paragraphFormat.copyFormat(p);var m=this.documentHelper.textHelper.containsSpecialCharAlone(e);if(h){if(d.owner.isShiftingEnabled=!0,this.updateInsertPosition(),(l=d.start).paragraph.isEmpty()){var f=new Ie,v=this.copyInsertFormat(l.paragraph.characterFormat,!0);f.characterFormat.copyFormat(v),f.text=e;C=this.documentHelper.textHelper.getRtlLanguage(e).isRtl;if(f.characterFormat.bidi=C,f.isRightToLeft=C,f.line=l.paragraph.childWidgets[0],f.margin=new de(0,0,0,0),f.line.children.push(f),this.owner.enableTrackChanges)if(f.paragraph.characterFormat.revisions.length>0){var y=this.getMatchedRevisionsToCombine(f.paragraph.characterFormat.revisions,n);y.length>0&&this.mapMatchedRevisions(y,f.paragraph.characterFormat,f,!0)}else this.checkToCombineRevisionWithPrevPara(f,n)||this.insertRevision(f,n);"Center"!==l.paragraph.paragraphFormat.textAlignment&&"Right"!==l.paragraph.paragraphFormat.textAlignment||-1!==l.paragraph.paragraphFormat.listFormat.listId||(l.paragraph.x=this.owner.viewer.clientActiveArea.x),this.documentHelper.layout.reLayoutParagraph(l.paragraph,0,0)}else{var b=0,w=l.currentWidget.getInline(l.offset,b,u,!i),r=w.element;b=w.index,r.ischangeDetected=!0,r instanceof Ie&&" "!==e&&this.documentHelper.owner.isSpellCheck&&(this.owner.spellChecker.removeErrorsFromCollection({element:r,text:r.text}),i||(r.ignoreOnceItems=[])),r.canTrigger&&r.text.length<=1&&(r.canTrigger=!1);var v=this.copyInsertFormat(r.characterFormat,!0),C=this.documentHelper.textHelper.getRtlLanguage(e).isRtl,x=this.documentHelper.textHelper.getRtlLanguage(e).id,F=0,P=!1,T=!1;if(r instanceof Ie&&(F=this.documentHelper.textHelper.getRtlLanguage(r.text).id,P=this.documentHelper.textHelper.getRtlLanguage(r.text).isRtl,T=this.documentHelper.textHelper.containsSpecialCharAlone(r.text)),!C&&this.documentHelper.owner.isSpellCheck||(v.bidi=C),(!this.documentHelper.owner.isSpellCheck||" "!==e&&" "!==r.text)&&v.isSameFormat(r.characterFormat)&&this.canInsertRevision(r,n)&&x===F||""===e.trim()&&!C&&r.characterFormat.bidi||P&&v.isSameFormat(r.characterFormat)&&m)this.insertTextInline(r,d,e,b);else{var S=this.documentHelper.layout.isContainsRtl(d.start.currentWidget),I=new Ie;I.text=e,I.line=r.line,I.isRightToLeft=P,I.characterFormat.copyFormat(v),r instanceof Ee&&(I.characterFormat.baselineAlignment="Normal");var N=!1,E=r.indexInOwner,H=I.revisions.length;if(b===r.length){var W=r.line.paragraph.bidi;W&&r instanceof xe&&1===r.fieldType&&(E=(r=r.fieldBegin).indexInOwner);var O=-1;O=W||r instanceof Xe||S&&T||P&&C?E:E+1,!this.owner.enableTrackChanges||r instanceof ke||(N=this.checkToMapRevisionWithInlineText(r,b,I,C,n))||I.revisions.length!==H||(N=this.checkToMapRevisionWithNextNode(r.nextNode,I,C,n)),N||(r.line.children.splice(O,0,I),this.checkToCombineRevisionsinBlocks(I,H===I.revisions.length,!0,n))}else if(0===b)this.owner.enableTrackChanges&&((N=this.checkToMapRevisionWithInlineText(r,b,I,C,n))||0!==I.revisions.length||this.checkToMapRevisionWithPreviousNode(r.previousNode,I,C,n)),N||(P&&!C?r.line.children.splice(E+1,0,I):r.line.children.splice(E,0,I),this.checkToCombineRevisionsinBlocks(I,H===I.revisions.length,!0,n));else{if(r instanceof Ie){var k=new Ie;k.line=r.line,k.characterFormat.copyFormat(r.characterFormat),u&&P&&!C?(k.text=r.text.slice(0,b),this.owner.enableTrackChanges||this.updateRevisionForSpittedTextElement(r,k),r.text=r.text.substring(b)):(k.text=r.text.substring(b),this.owner.enableTrackChanges||this.selection.isInField||this.updateRevisionForSpittedTextElement(r,k),r.text=r.text.slice(0,b)),this.owner.enableTrackChanges?(N=this.checkToMapRevisionWithInlineText(r,b,I,C,n))||I.revisions.length>H?this.copyElementRevision(r,k,!0):I.revisions.length===H&&(this.updateRevisionForSpittedTextElement(r,k),this.insertRevision(I,n)):this.selection.isInField&&(this.copyElementRevision(r,k,!1),this.updateElementInFieldRevision(r,I,r.revisions,!0)),this.owner.isSpellCheck&&this.owner.spellChecker.updateSplittedElementError(r,k),r.line.children.splice(E+1,0,k)}N||r.line.children.splice(E+1,0,I)}!u&&this.documentHelper.layout.isContainsRtl(d.start.currentWidget)&&this.documentHelper.layout.reArrangeElementsForRtl(d.start.currentWidget,u),this.documentHelper.layout.reLayoutParagraph(l.paragraph,r.line.indexInOwner,0)}}this.setPositionParagraph(c.paragraph,c.offset+e.length,!0),this.updateEndPosition(),t.isNullOrUndefined(this.editorHistory)||t.isNullOrUndefined(this.editorHistory.currentHistoryInfo)||"ListSelect"!==this.editorHistory.currentHistoryInfo.action||!this.documentHelper.isListTextSelected||(this.editorHistory.updateHistory(),this.editorHistory.updateComplexHistory()),(t.isNullOrUndefined(n)||"Insertion"===n)&&this.reLayout(d),this.documentHelper.isTextInput=!1}if(this.updateXmlMappedContentControl(),!i&&h&&(" "===e||"\t"===e||"\v"===e)){var L=!1;if("\v"!==e&&(L=this.checkAndConvertList(d,"\t"===e)),!L){if(!t.isNullOrUndefined(d.getHyperlinkField()))return;this.checkAndConvertToHyperlink(d,!1)}}},e.prototype.updateElementInFieldRevision=function(e,t,i,n){for(var r=0;r<i.length;r++){var o=i[r],s=o.range.indexOf(e);o.range.splice(n?s+1:s,0,t)}},e.prototype.retrieveFieldResultantText=function(e){var i="";if(1===e.fieldType)for(var n=e.previousElement;!t.isNullOrUndefined(n)&&n instanceof Ie;)i=n.text+i,n=t.isNullOrUndefined(n.previousNode)?void 0:n.previousNode.previousValidNodeForTracking;return i},e.prototype.checkToCombineRevisionsinBlocks=function(e,t,i,n){if(t&&this.owner.enableTrackChanges&&!(e instanceof ke||e instanceof pt||e instanceof Ye||e instanceof Xe)){(i?this.combineRevisionWithNextPara(e,n):this.combineRevisionWithPrevPara(e,n))||this.insertRevision(e,n)}},e.prototype.checkToMapRevisionWithNextNode=function(e,i,n,r){if(t.isNullOrUndefined(e))return!1;var o=e.nextValidNodeForTracking;return!t.isNullOrUndefined(o)&&this.checkToMapRevisionWithInlineText(o,0,i,n,r)},e.prototype.checkToMapRevisionWithPreviousNode=function(e,i,n,r){if(t.isNullOrUndefined(e))return!1;var o=e.previousValidNodeForTracking;return!t.isNullOrUndefined(o)&&this.checkToMapRevisionWithInlineText(o,o.length,i,n,r)},e.prototype.checkToMapRevisionWithInlineText=function(e,i,n,r,o){if(!t.isNullOrUndefined(e))if("Deletion"===o&&this.updateLastElementRevision(n),e.length===i){if(e=e.previousValidNodeForTracking,i=e.length,e.revisions.length>0)return this.applyMatchedRevisionInorder(e,n,i,!1,r,o)}else if(0===i&&(e=e.nextValidNodeForTracking,!t.isNullOrUndefined(e)&&e.revisions.length>0))return this.applyMatchedRevisionInorder(e,n,i,!0,r,o);return!1},e.prototype.combineElementRevisions=function(e,t){if(0!==e.revisions.length&&0!==t.revisions.length)for(var i=0;i<e.revisions.length;i++)for(var n=e.revisions[i],r=0;r<t.revisions.length;r++){var o=t.revisions[i];-1===n.range.indexOf(t)&&o.revisionType===n.revisionType&&o.author===n.author&&(t.revisions.splice(r,1),n.range.push(t),t.revisions.splice(r,0,n))}},e.prototype.applyMatchedRevisionInorder=function(e,t,i,n,r,o){var s=this.getMatchedRevisionsToCombine(e.revisions,o);return s.length>0&&this.mapMatchedRevisions(s,e,t,n),!1},e.prototype.copyElementRevision=function(e,t,i){if(!this.isTrackingFormField)for(var n=0;n<e.revisions.length;n++){var r=e.revisions[n],o=r.range.indexOf(e);t.revisions.splice(0,0,r),r.range.splice(o+(i?2:1),0,t)}},e.prototype.mapMatchedRevisions=function(e,t,i,n){for(var r=0;r<e.length;r++){var o=e[r];if(!this.isRevisionAlreadyIn(i,o)){i.revisions.splice(0,0,o);var s=o.range.indexOf(t);o.range.splice(n?s:s+1,0,i)}}},e.prototype.isRevisionAlreadyIn=function(e,t){if(e.revisions.length>0)for(var i=0;i<e.revisions.length;i++)if(e.revisions[i].revisionID===t.revisionID)return!0;return!1},e.prototype.getMatchedRevisionsToCombine=function(e,t){for(var i=[],n=0;n<e.length;n++)this.isRevisionMatched(e[n],t)&&i.push(e[n]);return i},e.prototype.decideInlineForTrackChanges=function(e,i){var n=!1;if(this.owner.enableTrackChanges&&!this.canInsertRevision(e,i)){var r=e.nextValidNodeForTracking;!t.isNullOrUndefined(r)&&this.canInsertRevision(r,i)&&(e=r,n=!0)}return{element:e,isMatched:n}},e.prototype.insertIMEText=function(e,t){if(this.documentHelper.lastComposedText!==e||!t){var i=this.selection.getParagraphInfo(this.selection.start),n=this.selection.getHierarchicalIndex(i.paragraph,i.offset.toString());this.insertText(e),this.documentHelper.lastComposedText=e;var r=this.selection.start;this.setPositionForCurrentIndex(r,n);var o=new Nt(this.owner);o.setPositionForLineWidget(r.currentWidget,r.offset+e.length),this.selection.selectPosition(t?r:o,o)}},e.prototype.insertSectionBreak=function(){var e=this.documentHelper.selection;t.isNullOrUndefined(e)||this.owner.isReadOnlyMode||e.start.paragraph.isInHeaderFooter||(this.initHistory("SectionBreak"),e.isEmpty||e.selectContent(e.isForward?e.start:e.end,!0),this.documentHelper.owner.isShiftingEnabled=!0,this.updateInsertPosition(),this.insertSection(e,!0),this.updateEndPosition(),this.reLayout(e,!0),"Continuous"===this.owner.layoutType&&this.layoutWholeDocument())},e.prototype.combineRevisionWithBlocks=function(e,i){if(this.owner.enableTrackChanges&&!t.isNullOrUndefined(e)){for(;e instanceof ke||e instanceof pt;)e=e.nextElement;if(!t.isNullOrUndefined(e)){var n=e.paragraph.previousRenderedWidget;if(!(n instanceof ve)){if(!t.isNullOrUndefined(n)&&!n.isEmpty()&&n.characterFormat.revisions.length>0){var r=n.lastChild;if(t.isNullOrUndefined(r)||0===r.children.length)return;for(var o=r.children[r.children.length-1];o instanceof ke||o instanceof pt;)o=o.previousElement;if(o.revisions.length>0&&this.compareElementRevision(n.characterFormat,e)){var s=e.revisions[e.revisions.length-1];this.compareElementRevision(o,e)&&s!==(c=o.revisions[o.revisions.length-1])&&this.clearAndUpdateRevisons(s.range,c,c.range.indexOf(o)+1)}}n=null;var a=e.paragraph.lastChild,l=(e=a.children[a.children.length-1]).paragraph.nextRenderedWidget;if(!(l instanceof ve)){if(!t.isNullOrUndefined(l)&&!l.isEmpty()&&e.paragraph.characterFormat.revisions.length>0){for(var d=l.firstChild.children[0];d instanceof ke||d instanceof pt;)d=d.previousElement;if(t.isNullOrUndefined(d))return;if(d.revisions.length>0){var h=d.revisions[d.revisions.length-1];if(this.compareElementRevision(e.paragraph.characterFormat,d)&&this.compareElementRevision(e,d)){var c=e.revisions[e.revisions.length-1];h!==c&&this.clearAndUpdateRevisons(h.range,c,c.range.indexOf(e)+1)}}}0===e.revisions.length&&this.insertRevision(e,i)}}}}},e.prototype.checkToCombineRevisionWithNextPara=function(e,i){var n=e.paragraph.nextRenderedWidget;if(n instanceof ve)return!1;if(!t.isNullOrUndefined(n)&&!n.isEmpty()){for(var r=n.firstChild.children[0];r instanceof ke||r instanceof pt;)r=r.previousElement;if(t.isNullOrUndefined(r))return!1;if(r.revisions.length>0){var o=this.getMatchedRevisionsToCombine(r.revisions,i);if(o.length>0)return this.mapMatchedRevisions(o,r,e,!0),!0}}return!1},e.prototype.checkToCombineRevisionWithPrevPara=function(e,i){var n=e.paragraph.previousRenderedWidget;if(n instanceof ve)return!1;if(!t.isNullOrUndefined(n)&&n.characterFormat.revisions.length>0){if(!this.isRevisionMatched(n.characterFormat,i))return!1;var r=this.getMatchedRevisionsToCombine(n.characterFormat.revisions,i);if(r.length>0)return this.mapMatchedRevisions(r,n.characterFormat,e,!1),!0}return!1},e.prototype.combineRevisionWithNextPara=function(e,i){var n=e.line.isLastLine(),r=e.nextNode;return!(!n||!t.isNullOrUndefined(r))&&this.checkToCombineRevisionWithNextPara(e,i)},e.prototype.combineRevisionWithPrevPara=function(e,i){var n=e.line.isFirstLine(),r=e.previousNode;return!(!n||!t.isNullOrUndefined(r))&&this.checkToCombineRevisionWithPrevPara(e,i)},e.prototype.removeRevision=function(e){var t=this.selection.start.currentWidget.getInline(this.selection.start.offset+1,0),i=t.element;if(t.element.revisions.length>0)for(var n=0;n<i.revisions.length;n++)if(i.revisions[n].revisionType===e.revisionType)for(var r=i.revisions[n],o=r.range.indexOf(i),s=o;o<r.range.length;o++)r.range[s].revisions.splice(n,1),r.range.splice(s,1)},e.prototype.clearElementRevision=function(e){if(!t.isNullOrUndefined(e))for(var i=0;i<e.range.length;i++)if(e.range[i]instanceof Ce){var n=e.range[i];n.revisions.splice(n.revisions.length-1,1),e.range.splice(i,1)}},e.prototype.insertRevision=function(e,i,n,r,o){n=t.isNullOrUndefined(n)?this.owner.currentUser?this.owner.currentUser:"Guest user":n;var s=t.isNullOrUndefined(r)?(new Date).toISOString():r;if(e instanceof Ce&&!t.isNullOrUndefined(e.line)&&e.line.paragraph.associatedCell||e instanceof H&&e.ownerBase instanceof fe&&e.ownerBase.associatedCell){var a=void 0;if(e instanceof Ce?a=e.line.paragraph.associatedCell:e instanceof H&&(a=e.ownerBase.associatedCell),a.ownerRow.rowFormat.revisions.length>0){var l=a.ownerRow.rowFormat,d=this.getMatchedRevisionsToCombine(l.revisions,i);if(d.length>0){for(var h=0;h<d.length;h++)e.revisions.splice(0,0,d[h]),d[h].range.push(e);return}}}var c=new N(this.owner,n,s);c.revisionType=i,c.revisionID=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),!t.isNullOrUndefined(o)&&o.length>0?this.clearAndUpdateRevisons(o,c,o.indexOf(e)):(e.revisions.push(c),c.range.push(e)),this.updateRevisionCollection(c)},e.prototype.clearAndUpdateRevisons=function(e,t,i){for(var n=0;n<e.length;n++)if(e[n]instanceof Ce){var r=e[n];r.revisions.splice(r.revisions.length-1,1),r.revisions.push(t),t.range.splice(i+n,0,r)}},e.prototype.splitRevisionByElement=function(e,t){if(e.revisions.length>0){var i=t.range,n=i.indexOf(e);return t.range=i.splice(0,n+1),i}},e.prototype.updateRevisionForSpittedTextElement=function(e,t){for(var i=0;i<e.revisions.length;i++){var n=e.revisions[i],r=this.splitRevisionByElement(e,n);this.insertRevision(t,n.revisionType,n.author,n.date,r)}},e.prototype.isRevisionMatched=function(e,i){var n=this.owner.currentUser?this.owner.currentUser:"Guest user";if(e instanceof N){if((t.isNullOrUndefined(i)||i===e.revisionType)&&e.author===n)return!0}else if(e.revisions.length>0)for(var r=0;r<e.revisions.length;r++){var o=e.revisions[r];if((t.isNullOrUndefined(i)||i===o.revisionType)&&o.author===n)return!0}return!1},e.prototype.compareElementRevision=function(e,t){if(0===e.revisions.length||0===t.revisions.length)return!1;for(var i=0;i<e.revisions.length;i++)for(var n=e.revisions[i],r=0;r<t.revisions.length;r++)if(n.author===t.revisions[i].author&&n.revisionType===t.revisions[i].revisionType)return!0;return!1},e.prototype.canInsertRevision=function(e,i){var n=t.isNullOrUndefined(i)?"Insertion":i;return"Deletion"!==n&&(this.owner.enableTrackChanges?this.isRevisionMatched(e,n):!(e.revisions.length>0))},e.prototype.insertRevisionAtEnd=function(e,i,n){return!(i instanceof ke||i instanceof pt||i instanceof Ye||i instanceof Xe)&&(e=e.previousValidNodeForTracking,!t.isNullOrUndefined(e)&&this.insertRevisionAtPosition(e,i,!0,n))},e.prototype.insertRevisionAtPosition=function(e,t,i,n){var r=t.revisions.length,o=this.checkToMapRevisionWithInlineText(e,i?e.length:0,t,!1,n);return i?o||t.revisions.length!==r||(o=this.checkToMapRevisionWithNextNode(e.nextNode,t,!1,n)):o||t.revisions.length!==r||(o=this.checkToMapRevisionWithPreviousNode(e.previousNode,t,!1,n)),o},e.prototype.insertRevisionAtBegining=function(e,i,n){return!(i instanceof ke||i instanceof pt||i instanceof Ye||i instanceof Xe)&&(e=e.nextValidNodeForTracking,!t.isNullOrUndefined(e)&&this.insertRevisionAtPosition(e,i,!1,n))},e.prototype.splitRevisionForSpittedElement=function(e,t){for(var i=e.revisions.length-1;i>=0;i--){var n=e.revisions[i],r=this.splitRevisionByElement(e,n);this.insertRevision(t,n.revisionType,n.author,n.date,r)}},e.prototype.combineElementRevision=function(e,t){for(var i=0;i<e.length;i++)for(var n=0;n<t.length;n++){var r=e[i],o=t[i];if(r.author===o.author&&r.revisionType===o.revisionType){for(var s=o.range.length,a=0;a<s;a++){var l=o.range[0];l.revisions.splice(l.revisions.indexOf(o),1),o.range.splice(0,1),r.range.push(l),l.revisions.push(r)}0===o.range.length&&this.owner.revisions.remove(o)}}},e.prototype.combineRevisions=function(e,i,n){if(this.owner.enableTrackChanges){var r=this.selection.getLineInfo(e,i.offset).line.getInline(i.offset,0).element;if(r.revisions.length>0&&this.isRevisionMatched(r,"Insertion")){var o=r.nextElement;if(!t.isNullOrUndefined(o)&&o.revisions.length>0){var s=r.revisions[r.revisions.length-1],a=o.revisions[o.revisions.length-1].range;this.clearAndUpdateRevisons(a,s,s.range.indexOf(r)+1)}}}},e.prototype.insertRevisionForBlock=function(e,i,n,r){if(0!==e.childWidgets.length&&this.owner.enableTrackChanges)if("Deletion"===i){for(var o=this.selection.editPosition,s=this.selection.start.clone(),a=this.selection.end.clone(),l=0;l<e.childWidgets.length;l++){var d=e.childWidgets[l];this.removeContent(d,0,this.documentHelper.selection.getLineLength(d))}this.selection.editPosition=o,this.selection.start.setPositionInternal(s),this.selection.end.setPositionInternal(a),this.removeEmptyLine(e)}else{var h=!1;if(t.isNullOrUndefined(r)){var c=this.owner.currentUser?this.owner.currentUser:"Guest user",p=(new Date).toISOString();(r=new N(this.owner,c,p)).revisionID=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),r.revisionType=i}for(l=0;l<e.childWidgets.length;l++){var u=e.childWidgets[l].children;if(0===u.length){var g=e.containerWidget.childWidgets.indexOf(e),m=void 0;if(g>0&&(m=e.containerWidget.childWidgets[g-1]),!t.isNullOrUndefined(m)&&m instanceof fe&&m.characterFormat.revisions.length>0&&this.isRevisionMatched(m.characterFormat,i)){var f=this.getMatchedRevisionsToCombine(m.characterFormat.revisions,i);f.length>0&&(this.mapMatchedRevisions(f,m.characterFormat,e.characterFormat,!1),h=!0,r=void 0)}}for(var v=0;v<u.length;v++)if(0!==v||n)u[v].revisions.push(r),r.range.push(u[v]);else{var y=u[l].revisions.length;this.checkToCombineRevisionsinBlocks(u[l],!0,!1,"Insertion"),u[l].revisions.length>y?r=u[l].revisions[u[l].revisions.length-1]:(u[v].revisions.push(r),r.range.push(u[v]))}}n||h||(e.characterFormat.revisions.push(r),r.range.push(e.characterFormat)),t.isNullOrUndefined(r)||this.updateRevisionCollection(r)}},e.prototype.updateRevisionCollection=function(e){var i=!1,n=void 0;if(this.owner.revisions.changes.indexOf(e)<0){if(this.documentHelper.revisionsInternal.containsKey(e.revisionID)||this.documentHelper.revisionsInternal.add(e.revisionID,e),this.owner.revisions.changes.length>0)for(var r=this.owner.selection.start,o=0;o<this.owner.revisions.changes.length;o++){var s=this.owner.revisions.changes[o].range[0];if(s instanceof Ce&&!t.isNullOrUndefined(s.line)&&s.line.paragraph.bodyWidget)n=this.selection.getElementPosition(this.owner.revisions.changes[o].range[0]).startPosition;else if(s instanceof I){var a=s.ownerBase.childWidgets[0];if(this.selection.getFirstParagraph(a).bodyWidget){var l=this.documentHelper.selection;this.updateEditPosition(a,l),n=this.selection.getTextPosBasedOnLogicalIndex(l.editPosition)}}else if(s instanceof H){var d=s.ownerBase;if(d.lastChild&&d.lastChild.paragraph.bodyWidget){var h=d.getLength(),c=new Nt(this.owner);c.setPositionParagraph(d.lastChild,h),n=c}}if(!t.isNullOrUndefined(n)&&!t.isNullOrUndefined(r)&&r.isExistBefore(n)){i=!0,this.owner.revisions.changes.splice(o,0,e);break}}i||this.owner.revisions.changes.push(e),this.documentHelper.updateAuthorIdentity()}},e.prototype.insertSection=function(e,i){var n,r,o=this.selection.start.paragraph.bodyWidget.sectionFormat.cloneFormat();if(e.start.paragraph.isInsideTable){var s=this.documentHelper.layout.getParentTable(e.start.paragraph);s=s.combineWidget(this.owner.viewer);var a=!1;0===e.start.paragraph.associatedCell.rowIndex&&(a=!0);var l=new fe,d=s.previousRenderedWidget;a?n=s:(n=this.splitTable(s,e.start.paragraph.associatedCell.ownerRow),this.documentHelper.layout.layoutBodyWidgetCollection(n.index,n.containerWidget,n,!1),n=n.getSplitWidgets().pop());var h=0;!t.isNullOrUndefined(d)&&d.bodyWidget.equals(n.bodyWidget)||!a?(h=n.indexInOwner+1,l.index=n.index+1):(h=0,l.index=0),n.containerWidget.childWidgets.splice(h,0,l),l.containerWidget=n.containerWidget,this.updateNextBlocksIndex(l,!0),this.documentHelper.layout.layoutBodyWidgetCollection(l.index,l.containerWidget,l,!1),n=l}else{var c=this.selection.getParagraphInfo(e.start),p=this.selection.getHierarchicalIndex(c.paragraph,c.offset.toString());this.splitParagraphInternal(e,e.start.paragraph,e.start.currentWidget,e.start.offset),this.setPositionForCurrentIndex(e.start,p),n=e.start.paragraph.getSplitWidgets().pop()}return(r=this.splitBodyWidget(n.bodyWidget,o,n).firstChild)instanceof ve&&r.updateRowIndex(0),this.documentHelper.layout.layoutBodyWidgetCollection(r.index,r.containerWidget,r,!1),r instanceof ve&&(r=e.getFirstParagraphInFirstCell(r)),i&&e.selectParagraphInternal(r,!0),r},e.prototype.splitBodyWidget=function(e,t,i){var n=this.documentHelper.layout.moveBlocksToNextPage(i);return this.updateSectionIndex(t,n,!0),this.insertRemoveHeaderFooter(n.sectionIndex,!0),this.documentHelper.viewer instanceof re&&this.documentHelper.layout.layoutHeaderFooter(n,this.owner.viewer,n.page),this.updateBlockIndex(0,n.firstChild),this.owner.viewer.updateClientArea(n.sectionFormat,n.page),n},e.prototype.insertRemoveHeaderFooter=function(e,t){this.documentHelper.headersFooters[e]||(this.documentHelper.headersFooters[e]={})},e.prototype.updateBlockIndex=function(e,i){var n,r=i.bodyWidget.sectionIndex;do{n=i.getSplitWidgets();for(var o=0;o<n.length;o++)n[o].index=e;e++,i=n.pop().nextRenderedWidget}while(!t.isNullOrUndefined(i)&&i.bodyWidget.sectionIndex===r)},e.prototype.updateSectionIndex=function(e,t,i){var n=t.sectionIndex,r=t;do{r.index===n&&e&&(r.sectionFormat=e),i?r.index++:r.index--,r=r.nextRenderedWidget}while(r)},e.prototype.checkAndConvertList=function(e,i){var n=e.paragraphFormat.getList();if(!t.isNullOrUndefined(n)||e.start.paragraph.containerWidget instanceof me)return!1;var r=!1,o=!1,s=0,a=e.start.currentWidget.getInline(e.start.offset-1,s),l=a.element;if(s=a.index,!(l instanceof Ie))return!1;for(var d=l,h=d.text.substring(0,s),c=0,p=0;!t.isNullOrUndefined(d.previousNode);){if(!(d.previousNode instanceof Ie)||"\t"!==d.previousNode.text&&0!==d.previousNode.text.trim().length)return!1;"\t"===d.previousNode.text?c+=36:p=2.5*d.previousNode.text.length,d=d.previousNode}d=l;var u=0,g=h.lastIndexOf("\t");for(u=g>=0?g+1:h.lastIndexOf(" ")+1;d.previousNode instanceof Ie&&0===u;){var m=(d=d.previousNode).text;u=(g=m.lastIndexOf("\t"))>=0?g+1:m.lastIndexOf(" ")+1,h=(h=d.text+h).substring(u)}var f=(h=W.trimStart(h)).substring(1,2),v=void 0,y=this.getListLevelPattern(h.substring(0,1));if("None"!==y&&this.checkNumberFormat(f,"Bullet"===y,h)?r=!0:this.checkLeadingZero(h)?(o=!0,r=!0):(v=this.checkNextLevelAutoList(h),t.isNullOrUndefined(v)||(r=!0)),r){this.initComplexHistory("AutoList");var b=l.paragraph;e.start.setPositionParagraph(b.childWidgets[0],b.childWidgets[0].getOffset(l,s+1)),e.end.setPositionParagraph(b.childWidgets[0],0),this.initHistory("Delete"),this.deleteSelectedContents(e,!1),this.reLayout(e,!1);var w=i?"Tab":"Space";f=o?"%1"+h.substring(h.length-1,h.length):"%1"+f;var C=h.substring(h.length-3,h.length-1);y=o?this.getListLevelPattern(C):y;var x=new _(void 0);x.listLevelPattern=y,"Bullet"===y?"*"===h?(x.numberFormat="",x.characterFormat.fontFamily="Symbol"):"-"===h&&(x.numberFormat="-"):x.numberFormat=f,x.followCharacter=w;var F=e.paragraphFormat.leftIndent;x.paragraphFormat.leftIndent=0!==c||0!==p?F+18+c+p:s>2?F+2.5*(s-2)+18:F>0?F+18:36,x.paragraphFormat.firstLineIndent=-18,!o&&"0"===h.substring(0,1)||"00"===C?x.startAt=0:x.startAt=1,t.isNullOrUndefined(v)?this.autoConvertList(e,x):e.paragraphFormat.setList(v),this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentHistoryInfo)?this.editorHistory.updateComplexHistory():this.reLayout(e)}return r},e.prototype.checkNextLevelAutoList=function(e){for(var i=this.documentHelper.selection,n=void 0,r=!1,o=i.start.paragraph,s=i.getPreviousParagraphBlock(o),a=!1;!t.isNullOrUndefined(s)&&s instanceof fe;){if(s.paragraphFormat.listFormat&&-1!==s.paragraphFormat.listFormat.listId){a=!0;break}s=i.getPreviousParagraphBlock(s)}if(a){var l=this.documentHelper.layout.getListNumber(s.paragraphFormat.listFormat,!0),d=l.substring(0,l.length-1),h=e.substring(0,e.length-1),c=void 0;if(l.substring(l.length-1)!==e.substring(e.length-1))r=!1;else if(h.match(/^[0-9]+$/)&&d.match(/^[0-9]+$/))c=parseInt(h,10),parseInt(d,10)!==c&&parseInt(d,10)+1!==c&&parseInt(d,10)+2!==c||(r=!0);else if(h.match(/^[a-zA-Z]+$/)&&d.match(/^[a-zA-Z]+$/))if(d.charCodeAt(0)===e.charCodeAt(0)||d.charCodeAt(0)+1===e.charCodeAt(0)||d.charCodeAt(0)+2===e.charCodeAt(0))r=!0;else if(h.match(/^[MDCLXVImdclxvi]+$/)&&d.match(/^[MDCLXVImdclxvi]+$/)){var p=this.getNumber(d.toUpperCase()),u=this.getNumber(h.toUpperCase());p!==u&&p+1!==u&&p+2!==u||(r=!0)}r&&(n=this.documentHelper.getListById(s.paragraphFormat.listFormat.listId))}return n},e.prototype.getNumber=function(e){for(var t={M:1e3,D:500,C:100,L:50,X:10,V:5,I:1},i=e.split(""),n=0,r=0;r<i.length;r++){var o=t[i[r]];o<t[i[r+1]]?n-=o:n+=o}return n},e.prototype.getListLevelPattern=function(e){switch(e){case"0":case"1":return"Arabic";case"I":return"UpRoman";case"i":return"LowRoman";case"A":return"UpLetter";case"a":return"LowLetter";case"*":case"-":return"Bullet";case"00":case"01":return"LeadingZero";default:return"None"}},e.prototype.autoConvertList=function(e,t){e.start;e.isForward||e.end;var i=new C;this.documentHelper.lists.length>0?i.listId=this.documentHelper.lists[this.documentHelper.lists.length-1].listId+1:i.listId=0;var n=new V,r=this.documentHelper;r.abstractLists.length>0?n.abstractListId=r.abstractLists[r.abstractLists.length-1].abstractListId+1:n.abstractListId=0,i.abstractListId=n.abstractListId,i.abstractList=n,r.abstractLists.push(n),n.levels.push(t),t.ownerBase=n,e.paragraphFormat.setList(i),e.paragraphFormat.listLevelNumber=0},e.prototype.checkNumberFormat=function(e,t,i){if(t)return""===e;var n=i.indexOf(e);return("."===e||")"===e||">"===e||"-"===e)&&""===i.substring(n,i.length-1)},e.prototype.checkLeadingZero=function(e){for(var t,i=!1,n=0;n<=e.length-1;n++){if("0"!==e.charAt(n)){t=n;break}i=!0}var r=void 0;return r="1"===e.charAt(t)?e.charAt(t+1):e.charAt(t),i&&this.checkNumberFormat(r,!1,e)},e.prototype.getPageFromBlockWidget=function(e){var t=void 0;return e.containerWidget instanceof pe?t=e.containerWidget.page:e.containerWidget instanceof ue?t=e.containerWidget.page:e.containerWidget instanceof be&&(t=e.containerWidget.bodyWidget.page),t},e.prototype.insertTextInline=function(e,i,n,r,o){if(e instanceof Ie){e.text=W.insert(e.text,r,n);var s=e.line.paragraph,a=s.childWidgets.indexOf(e.line),l=e.line.children.indexOf(e);(e.line.paragraph.bidi||this.documentHelper.layout.isContainsRtl(e.line))&&this.documentHelper.layout.reArrangeElementsForRtl(e.line,e.line.paragraph.bidi),!t.isNullOrUndefined(o)&&o||this.documentHelper.layout.reLayoutParagraph(s,a,l,e.line.paragraph.bidi)}else e instanceof Ge?this.insertImageText(e,i,n,r):e instanceof xe?0===e.fieldType?this.insertFieldBeginText(e,i,n,r):2===e.fieldType?this.insertFieldSeparatorText(e,i,n,r):this.insertFieldEndText(e,i,n,r):(e instanceof ke||e instanceof Ye||e instanceof Xe)&&this.insertBookMarkText(e,n)},e.prototype.insertFieldBeginText=function(e,t,i,n){var r=new Ie;r.text=i;var o=e.line.paragraph.childWidgets.indexOf(e.line),s=e.line.children.indexOf(e);r.characterFormat.copyFormat(e.characterFormat),e.line.children.splice(s,0,r),r.line=e.line,this.documentHelper.layout.reLayoutParagraph(e.line.paragraph,o,s)},e.prototype.insertBookMarkText=function(e,t){var i=new Ie;i.text=t;var n=e.line.paragraph.childWidgets.indexOf(e.line),r=e.line.children.indexOf(e);i.characterFormat.copyFormat(e.characterFormat),e instanceof Xe||e instanceof ke?e.line.children.splice(r,0,i):e.line.children.splice(r+1,0,i),i.line=e.line,this.documentHelper.layout.reLayoutParagraph(e.line.paragraph,n,r)},e.prototype.insertFieldSeparatorText=function(e,i,n,r){var o=i.getPreviousTextInline(e),s=i.getNextTextInline(e),a=new Ie;a.text=n;var l=e.line.children.indexOf(e);r===e.length&&l++,t.isNullOrUndefined(o)&&t.isNullOrUndefined(s)?a.characterFormat.copyFormat(e.line.paragraph.characterFormat):t.isNullOrUndefined(o)?a.characterFormat.copyFormat(s.characterFormat):a.characterFormat.copyFormat(o.characterFormat),e.line.children.splice(l,0,a),a.line=e.line;var d=e.line.paragraph.childWidgets.indexOf(e.line);this.documentHelper.layout.reLayoutParagraph(e.line.paragraph,d,l)},e.prototype.insertFieldEndText=function(e,t,i,n){var r=new Ie;r.text=i;var o=e.line.children.indexOf(e);r.characterFormat.copyFormat(e.characterFormat),e.line.children.splice(o+1,0,r),r.line=e.line;var s=e.line.paragraph.childWidgets.indexOf(e.line);if(this.owner.enableTrackChanges){var a=this.documentHelper.textHelper.getRtlLanguage(i).isRtl,l=this.checkToMapRevisionWithInlineText(e,n,r,a,"Insertion");l||0!==r.revisions.length||(l=this.checkToMapRevisionWithNextNode(e.nextNode,r,a,"Insertion"))}this.documentHelper.layout.reLayoutParagraph(e.line.paragraph,s,o)},e.prototype.insertImageText=function(e,i,n,r){var o=i.getPreviousTextInline(e),s=i.getNextTextInline(e),a=e.line,l=new Ie,d=a.paragraph,h=d.childWidgets.indexOf(a);l.text=n;var c=a.children.indexOf(e);r===e.length&&c++,t.isNullOrUndefined(o)&&t.isNullOrUndefined(s)?l.characterFormat.copyFormat(d.characterFormat):t.isNullOrUndefined(o)?l.characterFormat.copyFormat(s.characterFormat):l.characterFormat.copyFormat(o.characterFormat),a.children.splice(c,0,l),l.line=a,this.documentHelper.layout.reLayoutParagraph(d,h,c)},e.prototype.isListTextSelected=function(){this.documentHelper.isListTextSelected&&(this.initComplexHistory("ListSelect"),this.documentHelper.selection.start.paragraph.paragraphFormat.listFormat&&-1!==this.documentHelper.selection.start.paragraph.paragraphFormat.listFormat.listId&&this.onApplyList(void 0))},e.prototype.checkAndConvertToHyperlink=function(e,t,i){var n,r;if(t)n=(r=i.lastChild.children[i.lastChild.children.length-1]).text;else{var o=0,s=e.start.currentWidget.getInline(e.start.offset-1,o),a=s.element;if(o=s.index,!(a instanceof Ie))return;n=(r=a).text.substring(0,o)}var l=0,d=n.lastIndexOf("\t");for(l=d>=0?d+1:n.lastIndexOf(" ")+1;r.previousElement instanceof Ie&&0===l;){var h=(r=r.previousNode).text;l=(d=h.lastIndexOf("\t"))>=0?d+1:h.lastIndexOf(" ")+1,n=r.text+n}var c=(n=n.substring(l)).toLowerCase(),p=!1;if("file:///"===c.substring(0,8)||"http://"===c.substring(0,7)&&c.length>7||"https://"===c.substring(0,8)&&c.length>8||"www."===c.substring(0,4)&&c.length>4||"\\"===c.substring(0,3)&&c.length>3||"mailto:"===c.substring(0,7)&&c.length>7)p=!0,"www."===c.substring(0,4)&&c.length>4&&(n="http://"+n);else{var u=n.indexOf("@"),g=n.indexOf(".");u>0&&u<g&&g<n.length-1&&(p=!0,n="mailto:"+n)}if(p){var m=new Nt(this.documentHelper.owner);m.setPositionParagraph(r.line,r.line.getOffset(r,l));var f=new Nt(this.documentHelper.owner);if(t)f.setPositionParagraph(r.line,r.line.getEndOffset());else if(0===e.end.currentWidget.children.length&&0===e.end.offset){var v=e.end.currentWidget.previousLine;f.setPositionParagraph(v,v.getEndOffset())}else f.setPositionParagraph(e.end.currentWidget,e.end.offset-1);this.autoFormatHyperlink(e,n,m,f)}},e.prototype.autoFormatHyperlink=function(e,t,i,n){this.initComplexHistory("AutoFormatHyperlink");var r=this.selection.getParagraphInfo(i),o=this.selection.getHierarchicalIndex(r.paragraph,r.offset.toString());this.editorHistory&&this.editorHistory.currentHistoryInfo&&(this.editorHistory.currentHistoryInfo.insertPosition=o),e.start.setPositionInternal(i),e.end.setPositionInternal(n);var s=this.getCharacterFormat(e),a=new H;a.copyFormat(s);var l=this.createHyperlinkElement(t,i,n,a);e.start.setPositionParagraph(l.line,l.line.getOffset(l,1)),e.start.moveNextPosition(),e.end.setPositionInternal(e.start),r=this.selection.getParagraphInfo(e.end);var d=this.selection.getHierarchicalIndex(r.paragraph,r.offset.toString());this.editorHistory&&this.editorHistory.currentHistoryInfo?(this.editorHistory.currentHistoryInfo.endPosition=d,this.editorHistory.updateComplexHistory(),this.reLayout(e)):this.updateComplexWithoutHistory(0,o,d)},e.prototype.appylingHyperlinkFormat=function(e){this.initHistory("Underline"),this.updateCharacterFormatWithUpdate(e,"underline","Single",!1),this.editorHistory&&this.editorHistory.updateHistory(),this.reLayout(e,!1),this.initHistory("FontColor"),this.isForHyperlinkFormat=!0,this.updateCharacterFormatWithUpdate(e,"fontColor","#0563c1",!1),this.isForHyperlinkFormat=!1,this.editorHistory&&this.editorHistory.updateHistory(),this.reLayout(e,!1)},e.prototype.createHyperlinkElement=function(e,t,i,n){var r=this.selection;this.documentHelper.layout.allowLayout=!1,this.appylingHyperlinkFormat(r),this.documentHelper.layout.allowLayout=!0;var o=new xe(1);o.characterFormat.copyFormat(n),o.line=r.end.currentWidget,r.start.setPositionInternal(r.end),this.initInsertInline(o),r.start.setPositionInternal(t),r.end.setPositionInternal(r.start);var s=this.insertHyperlinkfield(r,n,e),a=r.start.paragraph.childWidgets.indexOf(s.line),l=s.line.children.indexOf(s);return o.linkFieldCharacter(this.documentHelper),this.documentHelper.layout.reLayoutParagraph(r.start.paragraph,a,l),o},e.prototype.insertHyperlinkfield=function(e,t,i,n){var r=new xe(0);r.characterFormat.copyFormat(t),r.line=e.start.currentWidget,this.initInsertInline(r);var o=new Ie;o.characterFormat.copyFormat(t),o.text=n?' HYPERLINK \\l "'+i+'" ':' HYPERLINK "'+i+'" ',o.line=e.start.currentWidget,this.initInsertInline(o);var s=new xe(2);return s.characterFormat.copyFormat(t),s.line=e.start.currentWidget,this.initInsertInline(s),r},e.prototype.unlinkRangeFromRevision=function(e,t){for(var i=0;i<e.revisions.length;i++){var n=e.revisions[i],r=n.range.indexOf(e);r>=0&&n.range.splice(r,1),0===n.range.length&&t&&(this.owner.revisions.remove(n),this.isRemoveRevision&&this.documentHelper.revisionsInternal.containsKey(n.revisionID)&&this.documentHelper.revisionsInternal.remove(n.revisionID))}},e.prototype.unlinkWholeRangeInRevision=function(e,t){var i=t;e.revisions.splice(e.revisions.indexOf(e),1);for(var n=i.range.length,r=0;r<n;r++)i.range.splice(0,1);0===i.range.length&&(this.owner.revisions.remove(i),this.isRemoveRevision&&this.documentHelper.revisionsInternal.containsKey(i.revisionID)&&this.documentHelper.revisionsInternal.remove(i.revisionID))},e.prototype.unLinkFieldCharacter=function(e){if(e instanceof xe&&0===e.fieldType&&e.fieldEnd&&(this.documentHelper&&(this.documentHelper.fieldToLayout=e,this.documentHelper.fieldEndParagraph=e.line.paragraph),e.fieldEnd&&(e.fieldEnd.fieldBegin=void 0),e.fieldEnd=void 0),e instanceof xe&&2===e.fieldType)t.isNullOrUndefined(e.fieldEnd)||(this.documentHelper&&(this.documentHelper.fieldToLayout=e.fieldBegin,this.documentHelper.fieldEndParagraph=e.line.paragraph),e.fieldBegin.fieldSeparator=void 0,e.fieldEnd.fieldSeparator=void 0);else if(e instanceof xe&&1===e.fieldType&&e.fieldBegin){t.isNullOrUndefined(this.documentHelper)||(this.documentHelper.fieldToLayout=e.fieldBegin,this.documentHelper.fieldEndParagraph=e.line.paragraph);var i=this.documentHelper.fields.indexOf(e.fieldBegin);-1!==i&&this.documentHelper.fields.splice(i,1);var n=this.documentHelper.formFields.indexOf(e.fieldBegin);-1!==n&&this.documentHelper.formFields.splice(n,1),e.fieldBegin=void 0}},e.prototype.getCharacterFormat=function(e){return e.start.paragraph.isEmpty()?e.start.paragraph.characterFormat:e.start.currentWidget.getInline(e.start.offset,0).element.characterFormat},e.prototype.insertHyperlink=function(e,i){t.isNullOrUndefined(i)&&(i=e),this.insertHyperlinkInternal(e,i,this.owner.selection.text!==i,!1)},e.prototype.insertHyperlinkInternal=function(e,t,i,n){var r=this.documentHelper.selection;if(r.start.paragraph.associatedCell===r.end.paragraph.associatedCell)if(i)this.insertHyperlinkInternalInternal(r,e,t,n);else{var o=r.start,s=r.end;r.isForward||(o=r.end,s=r.start);var a=new Nt(this.documentHelper.owner);a.setPositionInternal(o);var l=this.getCharacterFormat(r),d=new H(void 0);d.copyFormat(l),this.initComplexHistory("InsertHyperlink");var h=this.selection.getParagraphInfo(o),c=this.selection.getHierarchicalIndex(h.paragraph,h.offset.toString());this.editorHistory&&this.editorHistory.currentHistoryInfo&&(this.editorHistory.currentHistoryInfo.insertPosition=this.selection.getHierarchicalIndex(h.paragraph,h.offset.toString())),this.appylingHyperlinkFormat(r),this.documentHelper.layout.allowLayout=!0,o.setPositionInternal(s);var p=new xe(1);p.characterFormat.copyFormat(d),p.line=r.end.currentWidget,o.setPositionInternal(s),this.initInsertInline(p),o.setPositionInternal(a),s.setPositionInternal(o);var u=this.insertHyperlinkfield(r,d,e,n);p.linkFieldCharacter(this.documentHelper);var g=r.start.paragraph.childWidgets.indexOf(u.line),m=u.line.children.indexOf(u);this.documentHelper.layout.reLayoutParagraph(r.start.paragraph,g,m);var f=p.line;r.selects(f,f.getOffset(p,p.length),!0),h=this.selection.getParagraphInfo(s);var v=this.selection.getHierarchicalIndex(h.paragraph,h.offset.toString());this.editorHistory&&this.editorHistory.currentHistoryInfo?(this.editorHistory.currentHistoryInfo.endPosition=this.selection.getHierarchicalIndex(h.paragraph,h.offset.toString()),this.editorHistory.updateComplexHistory()):this.updateComplexWithoutHistory(1,c,v)}},e.prototype.insertHyperlinkInternalInternal=function(e,i,n,r){if(!t.isNullOrUndefined(e.start)&&!this.editHyperlink(e,i,n)){this.initHistory("InsertHyperlink");var o=!0;if(!e.isEmpty){var s=this.owner.enableTrackChanges;this.owner.enableTrackChanges=!1,o=this.removeSelectedContents(e),this.owner.enableTrackChanges=s}if(o){var a=this.getCharacterFormat(e),l=new H;l.copyFormat(a),this.insertHyperlinkByFormat(e,i,n,l,r)}}},e.prototype.insertHyperlinkByFormat=function(e,i,n,r,o){this.updateInsertPosition(),e.owner.isShiftingEnabled=!0;var s=[],a=new xe(0);s.push(a);var l=new Ie;l.text=o?' HYPERLINK \\l "'+i+'" ':' HYPERLINK "'+i+'" ',s.push(l);var d=new xe(2);s.push(d),t.isNullOrUndefined(n)||""===n||((l=new Ie).characterFormat.underline="Single",l.characterFormat.fontColor="#0563c1",l.text=n,s.push(l));var h=new xe(1);s.push(h),this.insertElement(s),h.linkFieldCharacter(this.documentHelper),-1===this.documentHelper.fields.indexOf(a)&&this.documentHelper.fields.push(a),e.selects(h.line,h.line.getOffset(h,h.length),!0),this.updateEndPosition(),this.reLayout(e,!0)},e.prototype.initInsertInline=function(e,t){this.initHistory("InsertInline"),this.insertInlineInSelection(this.documentHelper.selection,e),this.editorHistory&&this.editorHistory.updateHistory()},e.prototype.insertElementInCurrentLine=function(e,t){this.checkIsNotRedoing()&&(e.owner.isShiftingEnabled=!0),e.isEmpty||this.removeSelectedContents(e),this.updateInsertPosition(),this.insertElement([t]),this.checkEndPosition(e)&&this.updateHistoryPosition(e.start,!1),this.fireContentChange()},e.prototype.editHyperlink=function(e,i,n,r){var o=e.getHyperlinkField();if(t.isNullOrUndefined(o))return!1;this.initHistory("InsertHyperlink"),this.editHyperlinkInternal=t.isNullOrUndefined(this.editorHistory)||this.editorHistory&&t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo);var s="",a=!1,l=this.getCharacterFormat(e),d=new H;d.copyFormat(l);var h=void 0;if(!t.isNullOrUndefined(o.fieldSeparator)){h=o.fieldSeparator;var c=e.getHyperlinkDisplayText(o.fieldSeparator.line.paragraph,o.fieldSeparator,o.fieldEnd,a,d);s=c.displayText,a=c.isNestedField,d=c.format}var p=o.line.getOffset(o,0);if(e.start.setPositionParagraph(o.line,p),p=o.fieldEnd.line.getOffset(o.fieldEnd,1),e.end.setPositionParagraph(o.fieldEnd.line,p),this.skipFieldDeleteTracking=!0,this.deleteSelectedContents(e,!1),!a&&s!==n||t.isNullOrUndefined(h))this.insertHyperlinkByFormat(e,i,n,d,r);else{this.updateInsertPosition();var u=new xe(0);u.characterFormat.copyFormat(o.characterFormat),u.line=e.start.currentWidget,this.insertInlineInternal(u);var g=new Ie;g.characterFormat.copyFormat(o.characterFormat),g.text=r?' HYPERLINK \\l "'+i+'" ':' HYPERLINK "'+i+'" ',g.line=e.start.currentWidget,this.insertInlineInternal(g);var m=this.editorHistory&&this.editorHistory.currentBaseHistoryInfo?this.editorHistory.currentBaseHistoryInfo.removedNodes:this.nodes;this.insertClonedFieldResult(e,m,h),e.end.currentWidget.getInline(e.end.offset,0).element.linkFieldCharacter(this.documentHelper),this.skipFieldDeleteTracking=!1;var f=u.line.paragraph,v=u.line.paragraph.childWidgets.indexOf(u.line),y=u.line.children.indexOf(u);this.documentHelper.layout.reLayoutParagraph(f,v,y),e.selects(u.fieldEnd.line,p,!0),this.updateEndPosition(),this.reLayout(e,!0)}return this.editHyperlinkInternal=!1,this.nodes=[],!0},e.prototype.insertClonedFieldResult=function(e,t,i){for(var n=!1,r=t.length-1;r>-1;r--){var o=t[r];if(!n){if(i!==o){if(o instanceof fe&&o===i.line.paragraph){n=!0;var s=void 0;if(r===t.length-1){s=e.start.paragraph;var a=i.line.paragraph;this.getClonedFieldResultWithSel(a,e,i)}else s=this.getClonedFieldResult(i.line.paragraph,i),this.insertParagraph(s,!0);e.selectParagraphInternal(e.getNextParagraphBlock(s),!0)}continue}n=!0}o instanceof Ce?this.insertInlineInternal(o.clone()):o instanceof ge&&this.insertBlock(o.clone())}},e.prototype.getClonedFieldResultWithSel=function(e,t,i){for(var n=e.childWidgets.indexOf(i.line),r=e.childWidgets[n].children.indexOf(i),o=n;o<e.childWidgets.length;o++){var s=e.childWidgets[o];o!==n&&(r=0);for(var a=r;a<s.children.length;a++)this.insertInlineInternal(s.children[a].clone())}},e.prototype.getClonedFieldResult=function(e,t){var i=new fe;i.characterFormat.copyFormat(e.characterFormat),i.paragraphFormat.copyFormat(e.paragraphFormat);for(var n=e.childWidgets.indexOf(t.line),r=e.childWidgets[n].children.indexOf(t),o=n;o<e.childWidgets.length;o++){var s=e.childWidgets[o];o!==n&&(r=0);for(var a=r;a<s.children.length;a++)i.childWidgets[0].children.push(s.children[a])}return i},e.prototype.removeHyperlink=function(){if(!this.owner.isReadOnlyMode){var e=this.selection,i=e.getHyperlinkField();if(!t.isNullOrUndefined(i)){var n=i.fieldEnd,r=i.fieldSeparator,o=new Nt(e.owner);o.setPositionParagraph(i.line,i.line.getOffset(i,0));var s=this.selection.getParagraphInfo(o),a=this.selection.getHierarchicalIndex(s.paragraph,s.offset.toString()),l=new Nt(e.owner);l.setPositionParagraph(r.line,r.line.getOffset(r,r.length)),s=this.selection.getParagraphInfo(l);var d=this.selection.getHierarchicalIndex(s.paragraph,s.offset.toString());this.initComplexHistory("RemoveHyperlink"),e.start.setPositionParagraph(n.line,n.line.getOffset(n,0)),s=this.selection.getParagraphInfo(e.start);var h=this.selection.getHierarchicalIndex(s.paragraph,s.offset.toString());e.end.setPositionInternal(e.start),this.delete(),e.start.setPositionInternal(this.selection.getTextPosBasedOnLogicalIndex(d)),this.initHistory("Underline"),this.updateCharacterFormatWithUpdate(e,"underline","None",!1),this.editorHistory&&this.editorHistory.updateHistory(),e.end.setPositionInternal(this.selection.getTextPosBasedOnLogicalIndex(h)),this.initHistory("FontColor"),this.updateCharacterFormatWithUpdate(e,"fontColor",void 0,!1),this.editorHistory&&this.editorHistory.updateHistory(),this.reLayout(e,!1),e.end.setPositionInternal(e.start),e.start.setPositionInternal(this.selection.getTextPosBasedOnLogicalIndex(a)),this.initHistory("Delete"),this.deleteSelectedContents(e,!1),this.reLayout(e,!0),this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentHistoryInfo)&&this.editorHistory.updateComplexHistory()}}},e.prototype.pasteInternal=function(e,i){if(this.currentPasteOptions=this.owner.defaultPasteOption,this.documentHelper.owner.enableLocalPaste)this.paste();else{this.selection.isViewPasteOptions=!0,this.selection.pasteElement&&(this.selection.pasteElement.style.display="none"),t.isNullOrUndefined(i)&&(i=window);var n="",r="",o="",s=i.clipboardData?i.clipboardData:e.clipboardData;if("msie"!==t.Browser.info.name&&(o=s.getData("Text/Rtf"),r=s.getData("Text/Html")),this.copiedTextContent=n=s.getData("Text"),this.previousCharFormat=new H,this.previousCharFormat.copyFormat(this.selection.start.paragraph.characterFormat),this.previousParaFormat=new P,this.previousParaFormat.copyFormat(this.selection.start.paragraph.paragraphFormat),"FormFieldsOnly"===this.documentHelper.protectionType&&this.documentHelper.selection.isInlineFormFillMode()&&(r="",o=""),""!==o)this.pasteAjax(o,".rtf");else if(""!==r){var a=(new DOMParser).parseFromString(r,"text/html"),l=(new XMLSerializer).serializeToString(a);l=(l=(l=l.replace(/<!--StartFragment-->/gi,"")).replace(/<!--EndFragment-->/gi,"")).replace('xmlns="http://www.w3.org/1999/xhtml"',""),this.pasteAjax(l,".html")}else null!==n&&""!==n?(this.pasteContents(n),this.applyPasteOptions(this.currentPasteOptions),this.documentHelper.editableDiv.innerHTML=""):"msie"!==t.Browser.info.name&&void 0!==s.items&&0!==s.items.length&&"image/png"===s.items[0].type?this.pasteImage(s.items[0].getAsFile()):"msie"===t.Browser.info.name&&void 0!==s.files&&0!==s.files.length&&"image/png"===s.files[0].type&&this.pasteImage(s.files[0])}},e.prototype.pasteImage=function(e){var t=this,i=new FileReader;i.onload=function(){t.onPasteImage(i.result)},i.readAsDataURL(e)},e.prototype.onPasteImage=function(e){var t=document.createElement("img"),i=this;t.addEventListener("load",function(){i.insertImage(e,this.width,this.height)}),t.src=e},e.prototype.pasteAjax=function(e,t){var i=this,r={content:e,type:t};this.pasteRequestHandler=new v,this.owner.documentHelper.viewerContainer.focus(),n.showSpinner(this.owner.element),this.pasteRequestHandler.url=i.owner.serviceUrl+this.owner.serverActionSettings.systemClipboard,this.pasteRequestHandler.responseType="json",this.pasteRequestHandler.contentType="application/json;charset=UTF-8",this.pasteRequestHandler.customHeaders=i.owner.headers,this.pasteRequestHandler.onSuccess=this.pasteFormattedContent.bind(this),this.pasteRequestHandler.onFailure=this.onPasteFailure.bind(this),this.pasteRequestHandler.onError=this.onPasteFailure.bind(this),this.pasteRequestHandler.send(r)},e.prototype.pasteFormattedContent=function(e){var i=this;this.isPasteListUpdated&&(this.isPasteListUpdated=!1),this.pasteContents(t.isNullOrUndefined(e.data)?this.copiedTextContent:e.data),"KeepSourceFormatting"!==this.currentPasteOptions&&this.applyPasteOptions(this.currentPasteOptions),n.hideSpinner(this.owner.element),setTimeout(function(){i.viewer.updateScrollBars()},0)},e.prototype.onPasteFailure=function(e){this.owner.fireServiceFailure(e),console.error(e.status,e.statusText),n.hideSpinner(this.owner.element),this.documentHelper.updateFocus()},e.prototype.paste=function(e,i){var n=this;if(t.isNullOrUndefined(e)&&(e=this.owner.enableLocalPaste?this.copiedData:void 0),t.isNullOrUndefined(i)||(this.currentPasteOptions=i),e){var r=JSON.parse(e);this.pasteContents(r),this.applyPasteOptions(this.currentPasteOptions),this.chartType&&(setTimeout(function(){n.viewer.updateScrollBars()},30),this.chartType=!1)}},e.prototype.getUniqueListOrAbstractListId=function(e){if(e&&this.documentHelper.lists.length){var t=this.documentHelper.lists.slice().sort(function(e,t){return e.listId-t.listId});return t[t.length-1].listId+1}if(this.documentHelper.abstractLists.length){var i=this.documentHelper.abstractLists.slice().sort(function(e,t){return e.abstractListId-t.abstractListId});return i[i.length-1].abstractListId+1}return 0},e.prototype.checkSameLevelFormat=function(e,t,i){return t.levels[e].listLevelPattern===i.abstractList.levels[e].listLevelPattern&&t.levels[e].numberFormat===i.abstractList.levels[e].numberFormat&&("Bullet"===t.levels[e].listLevelPattern||t.levels[e].startAt===i.abstractList.levels[e].startAt)},e.prototype.listLevelPatternInCollection=function(e,t){var i=this;return this.documentHelper.lists.filter(function(n){return n.abstractList.levels[e].listLevelPattern===t.listLevelPattern&&n.abstractList.levels[e].numberFormat===t.numberFormat&&("Bullet"===t.listLevelPattern||n.abstractList.levels[e].startAt===t.startAt)&&i.isEqualParagraphFormat(n.abstractList.levels[e].paragraphFormat,t.paragraphFormat)})[0]},e.prototype.isEqualParagraphFormat=function(e,i){return!(t.isNullOrUndefined(i.leftIndent)&&0!==e.leftIndent||!t.isNullOrUndefined(i.leftIndent)&&Math.round(e.leftIndent)!==Math.round(i.leftIndent))&&(!(t.isNullOrUndefined(i.rightIndent)&&0!==e.rightIndent||!t.isNullOrUndefined(i.rightIndent)&&Math.round(e.rightIndent)!==Math.round(i.rightIndent))&&(!(t.isNullOrUndefined(i.firstLineIndent)&&0!==e.firstLineIndent||!t.isNullOrUndefined(i.firstLineIndent)&&Math.round(e.firstLineIndent)!==Math.round(i.firstLineIndent))&&(!(t.isNullOrUndefined(i.beforeSpacing)&&0!==e.beforeSpacing||!t.isNullOrUndefined(i.beforeSpacing)&&Math.round(e.beforeSpacing)!==Math.round(i.beforeSpacing))&&(!(t.isNullOrUndefined(i.afterSpacing)&&0!==e.afterSpacing||!t.isNullOrUndefined(i.afterSpacing)&&Math.round(e.afterSpacing)!==Math.round(i.afterSpacing))&&(!(t.isNullOrUndefined(i.textAlignment)&&"Left"!==e.textAlignment||!t.isNullOrUndefined(i.textAlignment)&&e.textAlignment!==i.textAlignment)&&(!(t.isNullOrUndefined(i.bidi)&&!1!==e.bidi||!t.isNullOrUndefined(i.bidi)&&e.bidi!==i.bidi)&&(!(t.isNullOrUndefined(i.contextualSpacing)&&!1!==e.contextualSpacing||!t.isNullOrUndefined(i.contextualSpacing)&&e.contextualSpacing!==i.contextualSpacing)&&(!(t.isNullOrUndefined(i.outlineLevel)&&"BodyText"!==e.outlineLevel||!t.isNullOrUndefined(i.outlineLevel)&&e.outlineLevel!==i.outlineLevel)&&(!(t.isNullOrUndefined(i.lineSpacing)&&1!==e.lineSpacing||!t.isNullOrUndefined(i.lineSpacing)&&Math.round(e.lineSpacing)!==Math.round(i.lineSpacing))&&!(t.isNullOrUndefined(i.lineSpacingType)&&"Multiple"!==e.lineSpacingType||!t.isNullOrUndefined(i.lineSpacingType)&&e.lineSpacingType!==i.lineSpacingType))))))))))},e.prototype.getBlocksToUpdate=function(e){for(var t=[],i=0;i<e.length;i++){var n=e[i];if(n.paragraphFormat&&n.paragraphFormat.listFormat&&Object.keys(n.paragraphFormat.listFormat).length>0)t.push(n);else if(n.rows)for(var r=0;r<n.rows.length;r++)for(var o=n.rows[r],s=0;s<o.cells.length;s++){var a=o.cells[s];t=t.concat(this.getBlocksToUpdate(a.blocks))}}return t},e.prototype.updateListIdForBlocks=function(e,i,n,r,o){for(var s=!1,a=0;a<e.length;a++){var l=e[a];if(l.paragraphFormat&&l.paragraphFormat.listFormat&&Object.keys(l.paragraphFormat.listFormat).length>0){var d=l.paragraphFormat.listFormat,h=this.listLevelPatternInCollection(d.listLevelNumber,i.levels[d.listLevelNumber]);d.listId===r&&(t.isNullOrUndefined(h)&&(!n||n&&!this.checkSameLevelFormat(d.listLevelNumber,i,n))?(s=!0,d.listId=o):!t.isNullOrUndefined(h)&&this.checkSameLevelFormat(d.listLevelNumber,i,h)&&(d.isUpdated||(d.listId=h.listId,d.isUpdated=!0),s=!1))}else if(l.rows)for(var c=0;c<l.rows.length;c++)for(var p=l.rows[c],u=0;u<p.cells.length;u++){var g=p.cells[u],m=this.updateListIdForBlocks(g.blocks,i,n,r,o);s||(s=m)}}return s},e.prototype.updatePasteContent=function(e,t){var i=this.getUniqueListOrAbstractListId(!0);if(e.lists.filter(function(e){return e.listId===i}).length>0){var n=e.lists.slice().sort(function(e,t){return e.listId-t.listId});i=n[n.length-1].listId+1}var r=this.getUniqueListOrAbstractListId(!1);if(e.abstractLists.filter(function(e){return e.abstractListId===r}).length>0){var o=e.abstractLists.slice().sort(function(e,t){return e.abstractListId-t.abstractListId});r=o[o.length-1].abstractListId+1}for(var s,a=this,l=0;l<e.lists.length;l++)!function(n){var o=e.lists[n],l=e.abstractLists.filter(function(e){return e.abstractListId===o.abstractListId})[0],d=a.documentHelper.lists.filter(function(e){return e.listId===o.listId});a.updateListIdForBlocks(e.sections[t].blocks,l,d[0],o.listId,i)?(l.abstractListId=r,o.listId=i,o.abstractListId=r,i++,r++):(e.lists.splice(n,1),e.abstractLists.splice(e.abstractLists.indexOf(l),1),n--),s=n}(l),l=s;for(var d=this.getBlocksToUpdate(e.sections[t].blocks),h=0;h<d.length;h++)delete d[h].paragraphFormat.listFormat.isUpdated},e.prototype.getBlocks=function(e,i,n,r,o){var s=[];if("string"==typeof e){var a=this.selection.start.paragraph;this.selection.isForward||(a=this.selection.end.paragraph);var l=[],d=e;d=d.replace(/\r\n/g,"\r"),l=-1!==navigator.userAgent.indexOf("Firefox")?d.split("\n"):d.split("\r");var h=[];(N=new pe).sectionFormat=new b(N),N.childWidgets=h;for(w=0;w<l.length;w++)if(w!==l.length-1||0!==l[w].length){var c=this.selection.start.currentWidget.getInline(this.selection.start.offset,0),p=this.selection.getPreviousValidElement(c.element);p!==c.element&&(p=this.selection.getNextValidElement(c.element));var u=p&&p===c.element?a.characterFormat:p?p.characterFormat:this.copyInsertFormat(a.characterFormat,!1);t.isNullOrUndefined(this.previousCharFormat)||(u=this.previousCharFormat);var m=this.documentHelper.selection.copySelectionParagraphFormat();t.isNullOrUndefined(this.previousParaFormat)||(m=this.previousParaFormat);var f=new fe;f.paragraphFormat.copyFormat(m);var v=new we(f);if(l[w].length>0){var y=new Ie;y.characterFormat.copyFormat(u),y.text=l[w],v.children.push(y),y.line=v}f.childWidgets.push(v),f.containerWidget=N,h.push(f)}s.push(N)}else{this.viewer.owner.parser.addCustomStyles(e),!i&&e.comments.length>0&&(this.documentHelper.owner.parser.commentsCollection=new g,this.documentHelper.owner.parser.parseComments(e,r));for(var w=0;w<e.sections.length;w++){var C=this.documentHelper.owner.parser;if(C.isPaste=i,this.isPasteListUpdated||t.isNullOrUndefined(e.lists)||(this.documentHelper.lists.length>0&&this.updatePasteContent(e,w),this.isPasteListUpdated=!0,t.isNullOrUndefined(e.abstractLists)||C.parseAbstractList(e,this.documentHelper.abstractLists),t.isNullOrUndefined(e.lists)||C.parseList(e,this.documentHelper.lists)),!t.isNullOrUndefined(e.revisions))if(i){var x=this.viewer.owner.revisionsInternal.changes;t.isNullOrUndefined(C.revisionCollection)||(C.revisionCollection=void 0),C.revisionCollection=new g;var F=C.revisionCollection;if((!this.documentHelper.owner.sfdtExportModule.copyWithTrackChange||!C.isCutPerformed)&&e.revisions.length>=1)for(var P=0;P<e.revisions.length;P++){var T=!0;if(F.containsKey(e.revisions[P].revisionId)){if(x.length>0)for(var S=0;S<x.length;S++)x[S].revisionID===e.revisions[P].revisionId&&(T=!1);if(T){var I=F.get(e.revisions[P].revisionId);x.push(I)}}else C.parseRevisions(e,x)}this.documentHelper.owner.sfdtExportModule.copyWithTrackChange=!1}else C.revisionCollection=this.documentHelper.revisionsInternal,C.parseRevisions(e,o);var N=new pe;N.sectionFormat=new b(N),C.parseSectionFormat(e.sections[w].sectionFormat,N.sectionFormat),i?s.push(N):n.unshift(N),C.parseBody(e.sections[w].blocks,N.childWidgets),C.isPaste=!1}}return"MergeWithExistingFormatting"===this.currentPasteOptions&&this.applyMergeFormat(s),s},e.prototype.applyMergeFormat=function(e){for(var t=this.selection.start.paragraph,i=this.selection.start.currentWidget.getInline(this.selection.start.offset,0),n=this.selection.getPreviousValidElement(i.element),r=n?n.characterFormat:this.copyInsertFormat(t.characterFormat,!1),o=this.documentHelper.selection.copySelectionParagraphFormat(),s=0;s<e.length;s++)for(var a=e[s].childWidgets,l=0;l<a.length;l++){var d=a[l];if(d instanceof fe)d.paragraphFormat.copyFormat(o),this.applyFormatInternal(d,r);else for(var h=0;h<d.childWidgets.length;h++)for(var c=d.childWidgets[h],p=0;p<c.childWidgets.length;p++)for(var u=c.childWidgets[p],g=0;g<u.childWidgets.length;g++)this.applyFormatInternal(u.childWidgets[g],r)}},e.prototype.applyFormatInternal=function(e,i){if(e instanceof fe)for(s=0;s<e.childWidgets.length;s++)for(var n=e.childWidgets[s],r=0;r<n.children.length;r++){var o=n.children[r].characterFormat.cloneFormat();t.isNullOrUndefined(i.uniqueCharacterFormat)?n.children[r].characterFormat=i:(n.children[r].characterFormat.uniqueCharacterFormat=void 0,n.children[r].characterFormat.copyFormat(i)),o.bold&&(n.children[r].characterFormat.bold=o.bold),o.italic&&(n.children[r].characterFormat.italic=o.italic),"None"!==o.underline&&(n.children[r].characterFormat.underline=o.underline)}else for(var s=0;s<e.childWidgets.length;s++)for(var a=e.childWidgets[s],r=0;r<a.childWidgets.length;r++)for(var l=a.childWidgets[r],d=0;d<l.childWidgets.length;d++)this.applyFormatInternal(l.childWidgets[d],i)},e.prototype.applyPasteOptions=function(e){if(!t.isNullOrUndefined(this.copiedContent)&&""!==this.copiedTextContent){switch(this.isSkipHistory=!0,this.currentPasteOptions=e,this.selection.start.setPositionInternal(this.pasteTextPosition.startPosition),this.selection.end.setPositionInternal(this.pasteTextPosition.endPosition),e){case"KeepSourceFormatting":this.pasteContents(""!==this.copiedContent?this.copiedContent:this.copiedTextContent);break;case"MergeWithExistingFormatting":var i=(this.selection.isForward?this.selection.start:this.selection.end).paragraph.paragraphFormat;this.pasteContents(""!==this.copiedContent?this.copiedContent:this.copiedTextContent,i);break;case"KeepTextOnly":this.pasteContents(this.copiedTextContent)}this.isSkipHistory=!1}},e.prototype.pasteContents=function(e,t){if("string"!=typeof e&&(this.copiedContent=e),"FormFieldsOnly"===this.documentHelper.protectionType&&this.documentHelper.selection.isInlineFormFillMode()){var i=this.selection.getCurrentFormField(),n=this.getFormFieldText(),r=i.formFieldData.maxLength,o=this.documentHelper.selection.text.length;if(r>0)if(0===o){var s=r-n.length;e=e.substring(0,s)}else o>0&&(e=e.substring(0,o))}this.pasteContentsInternal(this.getBlocks(e,!0),!0,t),this.isInsertField=!1},e.prototype.pasteContentsInternal=function(e,t,i){this.isPaste=t;var n=this.documentHelper.selection,r=!0;if(this.isSkipHistory||this.initComplexHistory("Paste"),this.documentHelper.isListTextSelected){var o=n.start.paragraph;o.paragraphFormat.listFormat&&-1!==o.paragraphFormat.listFormat.listId&&this.onApplyList(void 0)}this.isSkipHistory||this.initHistory("Paste"),n.isEmpty&&!this.documentHelper.isListTextSelected||(r=this.removeSelectedContentInternal(n,n.start,n.end)),r?this.pasteContent(e,i):this.editorHistory&&(this.editorHistory.currentBaseHistoryInfo=void 0),this.editorHistory&&this.editorHistory.currentHistoryInfo?(this.editorHistory.updateHistory(),this.editorHistory.updateComplexHistory()):this.reLayout(n,n.isEmpty),this.isPaste=!1},e.prototype.pasteContent=function(e,t){this.documentHelper.owner.isShiftingEnabled=!0;var i="";if(this.updateInsertPosition(),this.editorHistory&&this.editorHistory.currentBaseHistoryInfo)i=this.editorHistory.currentBaseHistoryInfo.insertPosition;else{var n=this.selection.start;this.selection.isForward||(n=this.selection.end);o=this.selection.getParagraphInfo(n);i=this.selection.getHierarchicalIndex(o.paragraph,o.offset.toString())}this.documentHelper.owner.isLayoutEnabled=!0,this.documentHelper.owner.isPastingContent=!0,this.pasteCopiedData(e,t);var r="";if(this.updateEndPosition(),this.editorHistory&&this.editorHistory.currentBaseHistoryInfo)r=this.editorHistory.currentBaseHistoryInfo.endPosition;else{var o=this.selection.getParagraphInfo(this.selection.start);r=this.selection.getHierarchicalIndex(o.paragraph,o.offset.toString())}var s=new Nt(this.documentHelper.owner);this.setPositionForCurrentIndex(s,i);var a=new Nt(this.documentHelper.owner);this.setPositionForCurrentIndex(a,r),this.pasteTextPosition={startPosition:s,endPosition:a},this.documentHelper.owner.isPastingContent=!1,this.documentHelper.selection.fireSelectionChanged(!0)},e.prototype.pasteCopiedData=function(e,i){if(this.documentHelper.layout.isBidiReLayout&&(this.documentHelper.layout.isBidiReLayout=!1),this.isPaste&&this.isSectionEmpty(this.selection)&&!this.selection.start.paragraph.isInHeaderFooter&&(this.previousSectionFormat=new b,this.previousSectionFormat.copyFormat(this.selection.start.paragraph.bodyWidget.sectionFormat),this.selection.start.paragraph.bodyWidget.sectionFormat.copyFormat(e[0].sectionFormat),this.selection.start.paragraph.bodyWidget.sectionFormat.footerDistance=this.previousSectionFormat.footerDistance,this.selection.start.paragraph.bodyWidget.sectionFormat.headerDistance=this.previousSectionFormat.headerDistance,this.owner.viewer instanceof re)){var n=this.selection.start.paragraph.bodyWidget.page;this.owner.viewer.updatePageBoundingRectangle(this.selection.start.paragraph.bodyWidget,n,n.boundingRectangle.y),this.owner.viewer.updateClientArea(this.selection.start.paragraph.bodyWidget.sectionFormat,n)}for(var r=0;r<e.length;r++)for(var o=e[r].childWidgets,s=0;s<o.length;s++){var a=o[s];if(a instanceof fe&&0===a.childWidgets.length&&(a.childWidgets[0]=new we(a)),a instanceof fe&&!t.isNullOrUndefined(i)){a.paragraphFormat.copyFormat(i);var l=this.copyInsertFormat(this.selection.start.paragraph.characterFormat,!1);a.characterFormat.mergeFormat(l)}if(s===o.length-1&&a instanceof fe){var d=a;if(d.childWidgets.length>0&&d.childWidgets[0].children.length>0){var h=this.selection.start;if("Center"!==h.paragraph.paragraphFormat.textAlignment&&"Right"!==h.paragraph.paragraphFormat.textAlignment||-1!==h.paragraph.paragraphFormat.listFormat.listId||(h.paragraph.x=this.owner.viewer.clientActiveArea.x),"KeepTextOnly"===this.currentPasteOptions){var c=new P;this.selection.start.paragraph.paragraphFormat=c}this.insertElement(d.childWidgets[0].children,d.paragraphFormat)}}else if(a instanceof ge){var p=this.selection.start.paragraph;if(a instanceof ve){var u=a;if(this.generateTableRevision(u),p.isInsideTable){var g=p.getContainerWidth();u.fitCellsToClientArea(g)}if(p.isEmpty()&&p.previousWidget instanceof ve)return this.insertTableRows(u,p.previousWidget)}this.insertBlockInternal(a)}}},e.prototype.generateTableRevision=function(e){if(this.owner.enableTrackChanges&&!t.isNullOrUndefined(e))for(var i=0;i<e.childWidgets.length;i++){var n=e.childWidgets[i];this.insertRevision(n.rowFormat,"Insertion");for(var r=0;r<n.childWidgets.length;r++)for(var o=n.childWidgets[r],s=0;s<o.childWidgets.length;s++){var a=o.childWidgets[s];t.isNullOrUndefined(a)||this.insertRevisionForBlock(a,"Insertion")}}},e.prototype.isSectionEmpty=function(e){var i=e.start.paragraph;if(i){if(i.isInsideTable||i.isInHeaderFooter||i!==e.end.paragraph)return!1;var n=i.bodyWidget;if(n){var r=n.page;if(r&&(t.isNullOrUndefined(r.previousPage)||r.previousPage.sectionIndex!==r.sectionIndex)&&t.isNullOrUndefined(r.nextPage)&&i.isEmpty()&&1===n.childWidgets.length)return!0}}return!1},e.prototype.insertTableInternal=function(e,t,i){var n=e.getIndex();if(i)for(var r=0,o=0;r<e.childWidgets.length;r++,o++){var s=e.childWidgets[r];t.childWidgets.splice(o,0,s),s.containerWidget=t,e.childWidgets.splice(r,1),r--}var a=e.containerWidget;this.constructRevisionsForTable(e,!1),this.removeBlock(e,!0),a.childWidgets.splice(n,0,t),t.index=e.index,e.containerWidget=void 0,t.containerWidget=a,this.documentHelper.layout.clearTableWidget(t,!0,!0,!0),t.buildTableColumns(),this.constructRevisionsForTable(t,!0),t.isGridUpdated=!0,this.updateNextBlocksIndex(t,!0),this.documentHelper.layout.linkFieldInTable(t),this.documentHelper.layout.layoutBodyWidgetCollection(t.index,a,t,!1)},e.prototype.canConstructRevision=function(e){return e.revisions.length>0&&0===e.revisions[0].range.length||e.removedIds.length>0},e.prototype.constructRevisionsForTable=function(e,t){for(var i=0;i<e.childWidgets.length;i++){var n=e.childWidgets[i];if(t){this.canConstructRevision(n.rowFormat)&&this.constructRevisionFromID(n.rowFormat,!0);for(var r=0;r<n.childWidgets.length;r++)for(var o=n.childWidgets[r],s=0;s<o.childWidgets.length;s++)o.childWidgets[s]instanceof fe&&this.constructRevisionsForBlock(o.childWidgets[s],t)}else this.removeDeletedCellRevision(n)}},e.prototype.constructRevisionsForBlock=function(e,t){for(var i=0;i<e.childWidgets.length;i++)for(var n=e.childWidgets[i],r=0;r<n.children.length;r++)t&&n.children[r]instanceof Ce&&this.canConstructRevision(n.children[r])&&this.constructRevisionFromID(n.children[r],!0);this.canConstructRevision(e.characterFormat)&&this.constructRevisionFromID(e.characterFormat,!0)},e.prototype.applyRevisionForCurrentPara=function(e,i,n,r,o){var s=e.getInline(i+1,0).element,a=!1;i===e.getLength()&&(a=!0);var l=e.getInline(n,0).element;if(n>e.getLength()&&(o=!0),t.isNullOrUndefined(s)||t.isNullOrUndefined(l))t.isNullOrUndefined(s)||a?t.isNullOrUndefined(l)||(l.removedIds.push(r),this.constructRevisionFromID(l,!0)):(s.removedIds.push(r),this.constructRevisionFromID(s,!0));else if(a||s!==l){for(;!t.isNullOrUndefined(s)&&s!==l;)a||(s.removedIds.push(r),this.constructRevisionFromID(s,!0)),t.isNullOrUndefined(s.nextNode)||(s=s.nextNode.nextValidNodeForTracking),a=!1;t.isNullOrUndefined(s)||a||(s.removedIds.push(r),this.constructRevisionFromID(s,!0))}else s.removedIds.push(r),this.constructRevisionFromID(s,!0);o&&(e.characterFormat.removedIds.push(r),this.constructRevisionFromID(e.characterFormat,!0))},e.prototype.insertBlockTable=function(e,t,i){var n=e.start.offset;e.start.paragraph.childWidgets.indexOf(e.start.currentWidget);t instanceof fe&&n>0&&(this.moveInlines(e.start.paragraph,t,0,0,e.start.paragraph.firstChild,n,e.start.currentWidget),e.selectParagraphInternal(e.start.paragraph,!0),this.checkInsertPosition(e)&&this.updateHistoryPosition(this.selection.getHierarchicalIndex(t,n.toString()),!0)),n>0&&this.checkInsertPosition(e)&&this.updateHistoryPosition(e.start,!0);var r=i.indexInOwner;if(i.containerWidget.childWidgets.splice(r,0,t),t.containerWidget=i.containerWidget,t.index=i.index,this.updateNextBlocksIndex(t,!0),this.documentHelper.layout.layoutBodyWidgetCollection(t.index,t.containerWidget,t,!1),this.checkInsertPosition(e)){var o=void 0;t instanceof fe&&(o=t),t instanceof ve&&(o=e.getFirstParagraphInFirstCell(t)),this.updateHistoryPosition(this.selection.getHierarchicalIndex(o,"0"),!0)}},e.prototype.handleCut=function(e){var t=e.start,i=e.end;e.isForward||(t=e.end,i=e.start);var n=this.selection.getParagraphInfo(t);if(e.editPosition=this.selection.getHierarchicalIndex(n.paragraph,n.offset.toString()),t.paragraph===i.paragraph&&t.offset+1===i.offset)t.paragraph.getInline(i.offset,0).element;this.initHistory("Cut"),e.owner.isShiftingEnabled=!0,this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&this.checkInsertPosition(e)&&this.updateHistoryPosition(e.editPosition,!0),this.deleteSelectedContent(i.paragraph,e,t,i,3);var r=new Nt(e.owner);this.setPositionForCurrentIndex(r,e.editPosition),e.selectContent(r,!0),this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&this.checkEndPosition(e)&&this.updateHistoryPosition(e.end,!1),this.reLayout(e)},e.prototype.insertInlineInternal=function(e,i){var n=this.selection,r=e.length,o=this.selection.getParagraphInfo(n.start);if(i=t.isNullOrUndefined(i)?"Insertion":i,n.start.paragraph.isEmpty()){var s=n.start.paragraph;"Center"!==s.paragraphFormat.textAlignment&&"Right"!==s.paragraphFormat.textAlignment||-1!==s.paragraphFormat.listFormat.listId||(s.x=this.owner.viewer.clientActiveArea.x);var a=!t.isNullOrUndefined(this.editorHistory)&&(this.editorHistory.isUndoing||this.editorHistory.isRedoing);s.childWidgets[0].children.push(e),e.line=s.childWidgets[0],this.owner.enableTrackChanges&&e.isValidNodeForTracking&&!a&&this.insertRevision(e,i),(e.removedIds.length>0||a)&&this.constructRevisionFromID(e,!0),e.linkFieldCharacter(this.documentHelper),e instanceof Ee&&("Footnote"===e.footnoteType&&this.updateFootnoteCollection(e),"Endnote"===e.footnoteType&&this.updateEndnoteCollection(e)),this.documentHelper.layout.reLayoutParagraph(s,0,0,void 0,void 0)}else{var l=0,d=n.start.currentWidget.getInline(n.start.offset,l),h=d.element;l=d.index,this.insertElementInternal(h,e,l,i,!0)}this.setPositionParagraph(o.paragraph,o.offset+r,!0)},e.prototype.insertElement=function(e,i){var n=this.selection,r=0,o=void 0,s=-1,a=void 0,l=0,d=void 0,h=this.selection.getParagraphInfo(n.start),c=this.owner.enableTrackChanges,p=void 0,u=void 0,g=0;if(n.start.paragraph.isEmpty())a=(o=n.start.paragraph).childWidgets[0],s=0;else{var m=n.start.paragraph.paragraphFormat.bidi,f=n.start.currentWidget.getInline(n.start.offset,g,m);p=f.element,g=f.index,s=(o=p.line.paragraph).childWidgets.indexOf(p.line),l=p.indexInOwner,a=p.line;var v=!1;p instanceof Ie&&(v=this.documentHelper.textHelper.getRtlLanguage(p.text).isRtl),g===p.length?(m||l++,d=!1):0===g?(v&&m&&this.isInsertField?l++:t.isNullOrUndefined(p.previousNode)&&(l=0),d=!0):(l++,(u=new Ie).characterFormat.copyFormat(p.characterFormat),m&&this.isInsertField&&v?(u.text=p.text.slice(0,g),p.text=p.text.substring(g)):(u.text=p.text.substring(g),p.text=p.text.slice(0,g)),p.revisions.length>0&&!this.owner.enableTrackChanges&&this.splitRevisionForSpittedElement(p,u),a.children.splice(l,0,u),u.line=p.line)}for(var y=0;y<e.length;y++){r+=e[y].length,e[y]instanceof Ie&&e[y].text.indexOf(" ")>=0&&(this.documentHelper.triggerSpellCheck=!0);var b=e[y].revisions.length;e[y].ischangeDetected=!0,a.children.splice(l,0,e[y]),e[y].line=a,e[y].linkFieldCharacter(this.documentHelper);var w=this.updateRevisionForElement(p,e[y],g,0===y,u,d);c&&!w&&e[y].revisions.length===b&&this.checkToCombineRevisionsinBlocks(e[y],b===e[y].revisions.length,y>0&&y===e.length-1,"Insertion"),p=e[y],l++}i&&(t.isNullOrUndefined(o.paragraphFormat.listFormat.list)||!t.isNullOrUndefined(o.paragraphFormat.listFormat)&&-1===o.paragraphFormat.listFormat.listId)&&o.paragraphFormat.copyFormat(i),this.documentHelper.layout.reLayoutParagraph(o,s,0,this.isInsertField?void 0:o.paragraphFormat.bidi),this.setPositionParagraph(h.paragraph,h.offset+r,!0)},e.prototype.updateRevisionForElement=function(e,i,n,r,o,s){if(!this.owner.enableTrackChanges)return!1;if(t.isNullOrUndefined(e)&&t.isNullOrUndefined(o))return!1;var a=!!t.isNullOrUndefined(s),l=i.revisions.length;return r?a?(this.checkToMapRevisionWithInlineText(e,n,i,!1,"Insertion")||i.revisions.length>l?this.copyElementRevision(e,o,!0):0===i.revisions.length&&(this.splitRevisionForSpittedElement(e,o),this.insertRevision(i,"Insertion")),!1):s?this.insertRevisionAtBegining(e,i,"Insertion"):this.insertRevisionAtEnd(e,i,"Insertion"):this.insertRevisionAtEnd(e,i,"Insertion")},e.prototype.insertElementInternal=function(e,i,n,r,o){var s=e.line,a=s.paragraph,l=s.indexInOwner,d=e.indexInOwner,h=a.paragraphFormat.bidi&&e.isRightToLeft,c=!1;r=t.isNullOrUndefined(r)?"Insertion":r;var p=this.skipTracking(),u=this.owner.enableTrackChanges,g=!1,m=i.revisions.length;if(this.owner.editorHistory&&(this.owner.editorHistory.isUndoing||this.owner.editorHistory.isRedoing)&&i instanceof Ie&&(c=e.characterFormat.isEqualFormat(i.characterFormat)&&this.documentHelper.textHelper.isRTLText(i.text)),c)e.text=e.text.substring(0,n)+i.text+e.text.substring(n);else if(n===e.length)h||d++,i.removedIds.length>0||p?this.constructRevisionFromID(i,!0,e):!u||p||this.skipFieldDeleteTracking||(g=this.insertRevisionAtEnd(e,i,r)),s.children.splice(d,0,i);else if(0===n)i.removedIds.length>0?this.constructRevisionFromID(i,!1):!u||p||this.skipFieldDeleteTracking||(g=this.insertRevisionAtBegining(e,i,r)),t.isNullOrUndefined(e.previousNode)?(e.line.children.splice(0,0,i),d=0):e.line.children.splice(d,0,i);else{h||d++;var f=new Ie;f.characterFormat.copyFormat(e.characterFormat),f.text=e.text.substring(n),e.revisions.length>0&&!u&&!p&&0===i.removedIds.length&&this.splitRevisionForSpittedElement(e,f),e.text=e.text.substr(0,n),s.children.splice(d,0,f),f.line=e.line,g=!0,this.isTrackingFormField=e.previousElement instanceof xe,i.removedIds.length>0&&!this.isTrackingFormField?(this.constructRevisionFromID(i,!1),this.copyElementRevision(e,f,!0)):this.owner.enableTrackChanges&&(i instanceof ke||i instanceof pt||i instanceof Ye||i instanceof Xe?this.copyElementRevision(e,f,!1):this.checkToMapRevisionWithInlineText(e,n,i,h,r)||i.revisions.length>m?this.copyElementRevision(e,f,!0):i.revisions.length===m&&(this.splitRevisionForSpittedElement(e,f),this.insertRevision(i,r))),s.children.splice(h?d+1:d,0,i),d-=1}i.line=e.line,i.linkFieldCharacter(this.documentHelper),i instanceof Le&&0===i.type&&this.documentHelper.contentControlCollection.push(i),i instanceof ze&&"Inline"!==i.textWrappingStyle&&(-1===a.floatingElements.indexOf(i)&&a.floatingElements.push(i),-1===a.bodyWidget.floatingElements.indexOf(i)&&a.bodyWidget.floatingElements.push(i)),!u||g||p||this.skipFieldDeleteTracking||this.checkToCombineRevisionsinBlocks(i,m===i.revisions.length,n===e.length,r),i instanceof Ee&&(p&&(i.isLayout=!1),"Footnote"===i.footnoteType&&this.updateFootnoteCollection(i),"Endnote"===i.footnoteType&&this.updateEndnoteCollection(i)),o&&this.documentHelper.layout.reLayoutParagraph(a,l,d,void 0,void 0)},e.prototype.constructRevisionFromID=function(e,i,n){if(e.removedIds.length>0){for(s=0;s<e.removedIds.length;s++){var r=void 0;if(this.documentHelper.revisionsInternal.containsKey(e.removedIds[s])){if(r=this.documentHelper.revisionsInternal.get(e.removedIds[s]),e.revisions.push(r),(i=!!i||this.skipTracking())&&this.editorHistory.isRedoing&&this.owner.editorHistory.currentBaseHistoryInfo&&"BackSpace"===this.owner.editorHistory.currentBaseHistoryInfo.action&&(i=!1),t.isNullOrUndefined(n))r.range.splice(i?r.range.length:0,0,e);else{var o=r.range.indexOf(n);o>=0?r.range.splice(o+(i?1:0),0,e):r.range.splice(i?r.range.length:0,0,e)}this.updateRevisionCollection(r)}}e.removedIds=[]}else for(var s=0;s<e.revisions.length;s++){var a=e.revisions[s];this.documentHelper.revisionsInternal.containsKey(a.revisionID)&&((a=this.documentHelper.revisionsInternal.get(a.revisionID)).range.splice(i?a.range.length:0,0,e),this.updateRevisionCollection(a))}},e.prototype.insertBlock=function(e){var t=!0,i=this.selection;if(i.isEmpty||(t=this.removeSelectedContents(i)),t||i.selectContent(i.start,!1),this.insertBlockInternal(e),this.checkInsertPosition(i)){var n=void 0;n=e instanceof fe?e:this.selection.getFirstParagraphInFirstCell(e),this.updateHistoryPosition(this.selection.getHierarchicalIndex(n,"0"),!0)}this.fireContentChange()},e.prototype.insertBlockInternal=function(e){var i=this.selection,n=this.selection.start.paragraph;if(!i.start.isAtParagraphStart){if(e instanceof fe){var r=i.start.clone();return this.insertNewParagraphWidget(e,!1),void(this.isInsertingTOC||this.combineRevisions(e,r,this.selection.end))}this.updateInsertPosition(),n=n.combineWidget(this.owner.viewer),this.splitParagraph(n,n.firstChild,0,i.start.currentWidget,i.start.offset,!1),i.selectParagraphInternal(this.selection.start.paragraph,!0)}var o=i.start.paragraph.containerWidget,s=i.start.paragraph.index,a=o.childWidgets.indexOf(i.start.paragraph);t.isNullOrUndefined(o)||(o.childWidgets.splice(a,0,e),e.containerWidget=o,e.index=s,e.height=0,e instanceof ve&&(e.isGridUpdated=!1,e.buildTableColumns(),e.isGridUpdated=!0),this.updateNextBlocksIndex(e,!0),!this.isInsertingTOC&&this.owner.enableTrackChanges&&!this.skipTracking()&&e instanceof fe?this.insertRevisionForBlock(e,"Insertion"):e instanceof fe?this.constructRevisionsForBlock(e,!0):e instanceof ve&&this.constructRevisionsForTable(e,!0),this.documentHelper.layout.layoutBodyWidgetCollection(s,o,e,!1))},e.prototype.insertImage=function(e,i,n){var r=this;!this.owner.isReadOnlyMode&&this.canEditContentControl&&(t.isNullOrUndefined(i)&&(i=100),t.isNullOrUndefined(n)&&(n=100),this.insertPicture(e,i,n),setTimeout(function(){r.viewer.updateScrollBars()},10))},e.prototype.insertTable=function(e,t){var i=this.selection.start;if(!this.owner.isReadOnlyMode&&this.canEditContentControl){e=e||1,t=t||1;var n=this.createTable(e,t),r=i.paragraph.getContainerWidth()-n.tableFormat.leftIndent;n.splitWidthToTableCells(r);var o=i.paragraph.previousWidget;if(i.currentWidget.isFirstLine()&&0===i.offset&&o instanceof ve)return this.insertTableRows(n,o),void n.destroy();this.initHistory("InsertTable"),this.documentHelper.owner.isShiftingEnabled=!0,this.insertBlock(n);var s=this.selection.getFirstParagraphInFirstCell(n).childWidgets[0];i.setPosition(s,!0),this.selection.end.setPositionInternal(i);var a=this.selection.getLastParagraphInLastCell(n.getSplitWidgets().pop()),l=a.getLength()+1;this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&(this.editorHistory.currentBaseHistoryInfo.endPosition=this.selection.getHierarchicalIndex(a,l.toString())),this.reLayout(this.selection)}},e.prototype.insertRow=function(e,i){var n=e?"Above":"Below";if(!this.owner.isReadOnlyMode&&this.canEditContentControl){var r=this.selection.isForward?this.selection.start:this.selection.end;this.selection.isForward?this.selection.end:this.selection.start;if(r.paragraph.isInsideTable){this.checkIsNotRedoing()&&this.initHistory("Above"===n?"InsertRowAbove":"InsertRowBelow"),this.documentHelper.owner.isShiftingEnabled=!0;var o=this.getOwnerCell(this.selection.isForward).getSplitWidgets()[0],s=this.getOwnerCell(!this.selection.isForward).getSplitWidgets()[0],a=o.ownerTable.combineWidget(this.owner.viewer),l="Below"===n?s.ownerRow:o.ownerRow;if(this.editorHistory)this.cloneTableToHistoryInfo(a);var d=i||this.getRowCountToInsert(),h=[],c=l.rowIndex;if("Below"===n){c++;var p=t.isNullOrUndefined(s.previousWidget)||s.columnIndex===s.previousWidget.columnIndex+1;s.cellIndex!==s.columnIndex&&p&&l.rowIndex+o.cellFormat.rowSpan-1===s.ownerRow.rowIndex||s.cellFormat.rowSpan>1&&!t.isNullOrUndefined(l.nextWidget)&&l.nextWidget instanceof ye&&(s.cellFormat.rowSpan+=d,l=l.nextWidget),l.bottomBorderWidth=0}for(var u=0;u<d;u++){var g=this.updateRowspan(l,"Below"===n?s:o,n),m=this.createRowAndColumn(g.count,u);m.rowFormat.copyFormat(l.rowFormat),this.owner.enableTrackChanges&&this.insertRevision(m.rowFormat,"Insertion"),this.updateCellFormatForInsertedRow(m,g.cellFormats),h.push(m)}a.insertTableRowsInternal(h,c);var f=void 0,v=void 0;if(a.childWidgets[c]instanceof ye)f=a.childWidgets[c].firstChild,v=this.selection.getFirstParagraph(f);else{for(var y=void 0;!(y instanceof ve);)y=a.nextRenderedWidget;v=this.selection.getFirstParagraphInFirstCell(y)}this.documentHelper.layout.reLayoutTable(a),this.selection.selectParagraphInternal(v,!0)}this.reLayout(this.selection,!0)}},e.prototype.autoFitTable=function(e){if(!this.documentHelper.owner.isReadOnlyMode&&this.canEditContentControl){var i=this.selection.start,n=this.selection.end;this.selection.isForward||(i=this.selection.end,n=this.selection.start);var r=this.selection.getTable(i,n);r=r.getSplitWidgets()[0];var o=this.documentHelper.layout.getParentTable(r);t.isNullOrUndefined(o)||(this.setOffsetValue(this.selection),o=o.combineWidget(this.owner.viewer),this.initHistory("FitToContents"===e?"TableAutoFitToContents":"FitToWindow"===e?"TableAutoFitToWindow":"TableFixedColumnWidth"),this.documentHelper.owner.editorHistoryModule&&this.cloneTableToHistoryInfo(o),o.updateProperties(!0,r,e),this.documentHelper.owner.isShiftingEnabled=!0,this.documentHelper.layout.reLayoutTable(r),this.reLayout(this.selection,!0))}},e.prototype.updateCellFormatForInsertedRow=function(e,t){for(var i=0;i<e.childWidgets.length;i++)e.childWidgets[i].cellFormat.copyFormat(t[i]),e.childWidgets[i].cellFormat.rowSpan=1},e.prototype.updateRowspan=function(e,i,n){for(var r=e.getPreviousRowSpannedCells(!0),o=0,s=[],a=0;a<e.childWidgets.length;a++){for(var l=e.childWidgets[a],d=!1,h=t.isNullOrUndefined(l.previousWidget)||l.columnIndex!==l.previousWidget.columnIndex+1,c=0;c<r.length;c++)if(h){var p=r[c],u=p.ownerRow.rowIndex+p.cellFormat.rowSpan-1;if(l.columnIndex<p.columnIndex&&l.cellIndex!==l.columnIndex&&(d=!0,o++,s.push(l.cellFormat)),1===i.cellFormat.rowSpan)if(u>l.ownerRow.rowIndex){if("Above"===n&&p.ownerRow===i.ownerRow)continue;p.cellFormat.rowSpan+=1,r.splice(c,1),c--}else l.cellIndex!==l.columnIndex&&h&&u===l.ownerRow.rowIndex&&("Above"===n?(p.cellFormat.rowSpan+=1,r.splice(c,1),c--):(o++,s.push(p.cellFormat),r.splice(c,1),c--));else if(p!==i){if("Above"===n&&(p.ownerRow===i.ownerRow||p.columnIndex===i.columnIndex))continue;p.columnIndex!==i.columnIndex&&p.ownerRow.rowIndex!==l.ownerRow.rowIndex&&(u>i.ownerRow.rowIndex||"Above"===n&&u===i.ownerRow.rowIndex)&&(p.cellFormat.rowSpan+=1,r.splice(c,1),c--)}}-1===r.indexOf(l)&&l.cellFormat.rowSpan>1&&(d=!0),d||(o++,s.push(l.cellFormat))}return{count:o,cellFormats:s}},e.prototype.insertTableRows=function(e,t){this.initHistory("InsertTableBelow"),e.containerWidget=t.containerWidget;var i=(t=t.combineWidget(this.owner.viewer)).childWidgets[t.childWidgets.length-1];t.insertTableRowsInternal(e.childWidgets,t.childWidgets.length);var n=this.selection.getFirstParagraph(i.nextWidget.childWidgets[0]);this.checkInsertPosition(this.selection)&&this.updateHistoryPosition(this.selection.getHierarchicalIndex(n,"0"),!0),t.isDefaultFormatUpdated=!1,this.documentHelper.layout.reLayoutTable(t),this.selection.start.setPosition(n.firstChild,!0),this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&this.updateHistoryPosition(this.selection.end,!1),this.selection.end.setPosition(n.firstChild,!0),this.reLayout(this.selection)},e.prototype.insertColumn=function(e,i){if(!this.owner.isReadOnlyMode&&this.canEditContentControl){var n=e?"Left":"Right";if(this.selection.start.paragraph.isInsideTable){this.checkIsNotRedoing()&&this.initHistory("Left"===n?"InsertColumnLeft":"InsertColumnRight"),this.selection.owner.isShiftingEnabled=!0;var r=this.getOwnerCell(this.selection.isForward),o=this.getOwnerCell(!this.selection.isForward),s=r.ownerRow.ownerTable.combineWidget(this.owner.viewer);this.editorHistory&&this.cloneTableToHistoryInfo(s),this.selection.owner.isLayoutEnabled=!1;var a=r.columnIndex;"Right"===n&&(a=o.columnIndex+o.cellFormat.columnSpan);for(var l=void 0,d=void 0,h=i||this.getColumnCountToInsert(),c=[],p=0;p<h;p++)for(var u=0;u<s.childWidgets.length;u++){var g=s.childWidgets[u];if(d=this.createColumn(this.selection.getLastParagraph(r)),d.index=u,d.rowIndex=g.rowIndex,d.containerWidget=g,d.cellFormat.copyFormat(r.cellFormat),d.cellFormat.rowSpan=1,t.isNullOrUndefined(l)&&(l=this.selection.getFirstParagraph(d)),0===a)g.childWidgets.splice(a,0,d);else{for(var m=!1,f=0;f<g.childWidgets.length;f++){var v=g.childWidgets[f];if(v.cellFormat.rowSpan>1&&c.push(v),v.columnIndex+v.cellFormat.columnSpan===a?(g.childWidgets.splice(v.cellIndex+1,0,d),m=!0):a>v.columnIndex&&v.columnIndex+v.cellFormat.columnSpan>a&&a<v.columnIndex+v.cellFormat.columnSpan&&(g.childWidgets.splice(v.cellIndex,0,d),m=!0),m)break}if(!m&&c.length>0)for(var y=0;y<c.length;y++){var b=c[y];if(b.ownerRow!==g&&g.rowIndex<=b.ownerRow.rowIndex+b.cellFormat.rowSpan-1&&(b.columnIndex+b.cellFormat.columnSpan===a?(b.cellIndex>g.childWidgets.length?g.childWidgets.push(d):g.childWidgets.splice(b.cellIndex,0,d),m=!0):a>b.columnIndex&&b.columnIndex+b.cellFormat.columnSpan>a&&a<b.columnIndex+b.cellFormat.columnSpan&&(g.childWidgets.splice(b.columnIndex,0,d),m=!0)),m)break}}}s.updateRowIndex(0);var w=this.documentHelper.layout.getParentTable(s);w?w.fitChildToClientArea():s.fitChildToClientArea(),this.selection.owner.isLayoutEnabled=!0,s.isGridUpdated=!1,s.buildTableColumns(),s.isGridUpdated=!0,this.documentHelper.skipScrollToPosition=!0,this.documentHelper.layout.reLayoutTable(s),this.selection.start.setPosition(l.firstChild,!0),this.selection.end.setPosition(this.selection.getLastParagraph(d).firstChild,!1),(this.checkIsNotRedoing()||t.isNullOrUndefined(this.editorHistory))&&this.reLayout(this.selection)}}},e.prototype.createTable=function(e,t){this.selection.start.paragraph;var i=new ve;i.tableFormat=new U(i),i.tableFormat.preferredWidthType="Auto",i.tableFormat.leftIndent=this.selection.start.paragraph.leftIndent,i.tableFormat.initializeTableBorders();for(var n=0;n<e;){var r=this.createRowAndColumn(t,n);r.rowFormat.heightType="Auto",this.owner.enableTrackChanges&&this.insertRevision(r.rowFormat,"Insertion"),r.containerWidget=i,i.childWidgets.push(r),n++}return i},e.prototype.createRowAndColumn=function(e,t){var i=this.selection.start.paragraph,n=new ye;n.rowFormat=new I(n),n.index=t;for(var r=0;r<e;r++){var o=this.createColumn(i);o.index=r,o.rowIndex=t,o.containerWidget=n,n.childWidgets.push(o)}return n},e.prototype.createColumn=function(e){var t=new be,i=new fe;return i.paragraphFormat.copyFormat(e.paragraphFormat),i.paragraphFormat.leftIndent=0,i.characterFormat.copyFormat(e.characterFormat),i.containerWidget=t,t.childWidgets.push(i),t.cellFormat=new z(t),t},e.prototype.getColumnCountToInsert=function(){var e=1,t=this.selection.start,i=this.selection.end;if(this.selection.isForward||(t=this.selection.end,i=this.selection.start),t&&i&&this.selection.getTable(t,i)){if(t.paragraph.associatedCell===i.paragraph.associatedCell)return e=1;if(t.paragraph.associatedCell.ownerRow===i.paragraph.associatedCell.ownerRow)return e=e+i.paragraph.associatedCell.cellIndex-t.paragraph.associatedCell.cellIndex;e=0;for(var n=t.paragraph.associatedCell.ownerTable.getColumnCellsForSelection(t.paragraph.associatedCell,i.paragraph.associatedCell),r=0;r<n.length;r++)t.paragraph.associatedCell.ownerRow===n[r].ownerRow&&e++}return 0===e?1:e},e.prototype.getRowCountToInsert=function(){var e=1,i=this.selection.start,n=this.selection.end;return this.selection.isForward||(i=this.selection.end,n=this.selection.start),t.isNullOrUndefined(i)||t.isNullOrUndefined(n)||t.isNullOrUndefined(this.selection.getTable(i,n))?0===e?1:e:e=i.paragraph.associatedCell===n.paragraph.associatedCell||i.paragraph.associatedCell.ownerRow===n.paragraph.associatedCell.ownerRow?1:e+this.getOwnerRow(!this.selection.isForward).rowIndex-this.getOwnerRow(this.selection.isForward).rowIndex},e.prototype.getOwnerCell=function(e){for(var i=void 0,n=e?this.selection.start.paragraph.associatedCell:this.selection.end.paragraph.associatedCell,r=e?this.selection.end.paragraph.associatedCell:this.selection.start.paragraph.associatedCell,o=(i=n).ownerTable;!t.isNullOrUndefined(o)&&o.containerWidget instanceof be&&o!==r.ownerTable;)o=(i=o.containerWidget).ownerTable;return i},e.prototype.getOwnerRow=function(e){for(var i,n=e?this.selection.start.paragraph.associatedCell.ownerRow:this.selection.end.paragraph.associatedCell.ownerRow,r=e?this.selection.end.paragraph.associatedCell.ownerRow:this.selection.start.paragraph.associatedCell.ownerRow,o=(i=n).ownerTable;!t.isNullOrUndefined(o)&&o.containerWidget instanceof be&&o!==r.ownerTable;)o=(i=o.containerWidget.ownerRow).ownerTable;return i},e.prototype.getOwnerTable=function(e){var t=void 0,i=this.selection.start.paragraph.associatedCell.ownerTable,n=this.selection.end.paragraph.associatedCell.ownerTable;for(t=e?i:n;t.containerWidget instanceof be&&t!==(e?n:i);)t=t.containerWidget.ownerTable;return t},e.prototype.mergeSelectedCellsInTable=function(){if(this.canMergeCells())if(this.owner.enableTrackChanges){var e=new t.L10n("documenteditor",this.owner.defaultLocale);e.setLocale(this.owner.locale),this.alertDialog=n.DialogUtility.alert({title:e.getConstant("UnTrack"),content:e.getConstant("Merge Track"),showCloseIcon:!0,okButton:{text:"Ok",click:this.confirmCellMerge.bind(this)},closeOnEscape:!0,position:{X:"center",Y:"center"},animationSettings:{effect:"Zoom"}})}else this.confirmCellMerge()},e.prototype.confirmCellMerge=function(){this.checkIsNotRedoing()&&this.initHistory("MergeCells"),this.selection.owner.isShiftingEnabled=!0;var e=this.selection.start,i=this.selection.end;this.selection.isForward||(e=this.selection.end,i=this.selection.start);var n=this.getOwnerCell(this.selection.isForward),r=this.getOwnerCell(!this.selection.isForward),o=this.selection.getContainerCellOf(n,r);if(o.ownerTable.contains(r)&&!this.selection.containsCell(o,r)){var s=n.ownerTable.combineWidget(this.owner.viewer);n=this.selection.getSelectedCell(n,o),r=this.selection.getSelectedCell(r,o);var a=this.mergeSelectedCells(s,n,r),l=this.selection.getFirstParagraph(a);e.setPosition(l.firstChild,!0);var d=this.selection.getLastParagraph(a);i.setPosition(d.lastChild,!1)}(this.checkIsNotRedoing()||t.isNullOrUndefined(this.editorHistory))&&this.reLayout(this.selection,!1),t.isNullOrUndefined(this.alertDialog)||(this.alertDialog.close(),this.alertDialog=void 0)},e.prototype.mergeSelectedCells=function(e,i,n){this.cloneTableToHistoryInfo(e);this.selection.owner.isLayoutEnabled=!1;var r=this.selection.getCellLeft(i.ownerRow,i),o=r+i.cellFormat.cellWidth,s=this.selection.getCellLeft(n.ownerRow,n),a=s+n.cellFormat.cellWidth,l=this.updateSelectedCellsInTable(r,o,s,a);r=l.start,o=l.end;for(var d,h=e.childWidgets.indexOf(n.ownerRow),c=e.childWidgets.indexOf(i.ownerRow),p=void 0,u=c;u<=h;u++){for(var g=e.childWidgets[u],m=0;m<g.childWidgets.length;m++){var f=g.childWidgets[m],v=this.selection.getCellLeft(g,f);if(W.round(r,2)<=W.round(v,2)&&W.round(v,2)<W.round(o,2)){var y=f.lastChild;if(y instanceof fe&&y.isEmpty()&&f.childWidgets.pop(),t.isNullOrUndefined(p))p=f,d=y;else{u===c&&(p.cellFormat.preferredWidth+=f.cellFormat.preferredWidth,p.cellFormat.columnSpan+=f.cellFormat.columnSpan,this.mergeBorders(p,f));for(var b=0;b<f.childWidgets.length;b++)(w=f.childWidgets[b].clone()).containerWidget=p,p.childWidgets.push(w);g.childWidgets.splice(m,1),f.destroy(),m--}}}if((0===p.childWidgets.length||1===p.childWidgets.length&&p.childWidgets[0]instanceof ve)&&d){var w=d.clone();p.childWidgets.push(w),w.containerWidget=p}if(0===g.childWidgets.length){var C=e.childWidgets.indexOf(g);g.updateRowBySpannedCells(),e.childWidgets.splice(C,1),g.destroy(),h--,u--}}return!t.isNullOrUndefined(p)&&c<h&&(p.cellFormat.rowSpan=h-c+1),this.updateBlockIndexAfterMerge(p),e.updateRowIndex(0),e.calculateGrid(),e.isGridUpdated=!1,e.buildTableColumns(),e.isGridUpdated=!0,this.documentHelper.layout.reLayoutTable(e),this.selection.owner.isLayoutEnabled=!0,p},e.prototype.mergeBorders=function(e,i){var n=void 0,r=null;if(t.isNullOrUndefined(e.cellFormat.borders)||(n=e.cellFormat.borders),t.isNullOrUndefined(i.cellFormat.borders)||(r=i.cellFormat.borders),!t.isNullOrUndefined(n)||!t.isNullOrUndefined(r))if(t.isNullOrUndefined(n))(n=new S(e.cellFormat)).copyFormat(r);else{if(t.isNullOrUndefined(r))return;e.ownerRow.rowIndex===i.ownerRow.rowIndex&&(n.top=e.getBorderBasedOnPriority(n.top,r.bottom),n.bottom=e.getBorderBasedOnPriority(n.bottom,r.bottom))}},e.prototype.updateBlockIndexAfterMerge=function(e){for(var t=0;t<e.childWidgets.length;t++)e.childWidgets[t].index=t},e.prototype.canMergeCells=function(){if(this.selection.isEmpty||!this.selection.start.paragraph.isInsideTable||!this.selection.end.paragraph.isInsideTable)return!1;this.selection.start,this.selection.end;this.selection.isForward||(this.selection.end,this.selection.start);var e=this.getOwnerCell(this.selection.isForward),i=this.getOwnerCell(!this.selection.isForward),n=this.selection.getContainerCellOf(e,i);if(n.ownerTable.contains(i)&&!this.selection.containsCell(n,i)){e=this.selection.getSelectedCell(e,n),i=this.selection.getSelectedCell(i,n);var r=1;if(e.ownerRow===i.ownerRow){for(var o=e.ownerRow.childWidgets.indexOf(e),s=o;s<=e.ownerRow.childWidgets.indexOf(i);s++){var a=e.ownerRow.childWidgets[s],l=a.previousWidget;if(s!==o){if(a.cellFormat.rowSpan!==r)return!1;if(!t.isNullOrUndefined(l)&&a.columnIndex!==l.cellFormat.columnSpan+l.columnIndex)return!1}r=a.cellFormat.rowSpan}return!0}return this.canMergeSelectedCellsInTable(e.ownerTable,e,i)}return!1},e.prototype.canMergeSelectedCellsInTable=function(e,i,n){var r=e.childWidgets.indexOf(n.ownerRow),o=e.childWidgets.indexOf(i.ownerRow),s=this.selection.getCellLeft(i.ownerRow,i),a=s+i.cellFormat.cellWidth,l=this.selection.getCellLeft(n.ownerRow,n),d=l+n.cellFormat.cellWidth,h=this.updateSelectedCellsInTable(s,a,l,d);s=h.start,a=h.end;for(var c=0,p=0,u=!1,g=!1,m=[],f=o;f<=r;f++){for(var v=e.childWidgets[f],y=0,b=0,w=!1,C=0;C<v.childWidgets.length;C++){var x=v.childWidgets[C],F=this.selection.getCellLeft(v,x);if(this.checkCellWithInSelection(s,a,F)){u=!1,g=!1,x.cellFormat.rowSpan>1&&m.push(x),w||(y=F,b=F,w=!0);var P=x.previousWidget;0!==b&&W.round(b,0)!==W.round(F,0)&&(b=F),b+=W.convertPointToPixel(x.cellFormat.cellWidth);var T=this.checkPrevOrNextCellIsWithinSel(s,a,x,!0),S=this.checkPrevOrNextCellIsWithinSel(s,a,x,!1),I=0===m.length||1===m.length&&m[0]===x,N=this.checkCurrentCell(m,x,T,S);if(f===r&&!t.isNullOrUndefined(P)&&x.cellFormat.rowSpan>P.cellFormat.rowSpan&&!N)return!1;if(f!==o)for(var E=0;E<m.length;E++){var H=m[E].ownerRow.rowIndex+m[E].cellFormat.rowSpan-1;if(H>=v.rowIndex){if(m[E].columnIndex>x.columnIndex?g=!0:u=!0,f===r&&m[E]!==x&&H>x.ownerRow.rowIndex+x.cellFormat.rowSpan-1)return!1;H!==v.rowIndex||this.checkPrevOrNextCellIsWithinSel(s,a,x,!1)||m.splice(m.indexOf(m[E]),1)}}if(T&&!t.isNullOrUndefined(P)&&I&&x.columnIndex!==P.columnIndex+1&&this.checkCellWidth(x))return!1}}if(f===o)c=y,p=b;else{if(b>0&&y>0&&(!u&&Math.round(c)!==Math.round(y)||!g&&Math.round(p)!==Math.round(b)))return!1;if(f===r)return!0}}return!1},e.prototype.checkCellWidth=function(e){var t=e.previousWidget,i=this.documentHelper.selection.getCellLeft(e.ownerRow,e),n=this.documentHelper.selection.getCellLeft(e.ownerRow,t)+W.convertPointToPixel(t.cellFormat.cellWidth);return W.round(n,2)!==W.round(i,2)},e.prototype.checkCellWithInSelection=function(e,t,i){return W.round(e,2)<=W.round(i,2)&&W.round(i,2)<W.round(t,2)},e.prototype.checkPrevOrNextCellIsWithinSel=function(e,i,n,r){var o=r?n.previousWidget:n.nextWidget,s=0;return!t.isNullOrUndefined(o)&&(s=this.documentHelper.selection.getCellLeft(o.ownerRow,o),this.checkCellWithInSelection(e,i,s))},e.prototype.checkCurrentCell=function(e,t,i,n){var r=t.ownerRow;if(e.length>0)for(var o=0;o<e.length;o++){var s=e[o].ownerRow,a=s.rowIndex+e[o].cellFormat.rowSpan-1;if(e[o]===t&&(1===e.length||this.checkRowSpannedCells(e,t))&&!n&&!i)return!0;if(e[o]!==t&&s.rowIndex<r.rowIndex&&a===r.rowIndex+t.cellFormat.rowSpan-1)return!0}return!1},e.prototype.checkRowSpannedCells=function(e,t){for(var i=0;i<e.length;i++)if(e[i]!==t&&e[i].columnIndex===t.columnIndex)return!0;return!1},e.prototype.insertNewParagraphWidget=function(e,i){if(this.updateInsertPosition(),this.insertParagraph(e,i),!i){var n=void 0,r=e;do{r=n=this.selection.getNextParagraphBlock(r)}while(n&&n.equals(e));t.isNullOrUndefined(n)?this.selection.selectParagraphInternal(e,!0):this.selection.selectParagraphInternal(n,!0)}this.fireContentChange()},e.prototype.insertParagraph=function(e,t){var i=this.selection.start.currentWidget,n=this.selection.start.offset;this.editorHistory&&this.editorHistory.isUndoing&&"InsertTextParaReplace"===this.editorHistory.currentBaseHistoryInfo.action&&(n=0);var r=this.selection.start.paragraph;if(r=r.combineWidget(this.owner.viewer),t){var o=this.selection.getLineLength(r.lastChild),s=e.firstChild?e.firstChild.children.length:0;this.moveInlines(r,e,s,n,i,o,r.lastChild)}else n>0&&this.moveInlines(r,e,0,0,r.firstChild,n,i);var a=r.getSplitWidgets(),l=(r=t?a[a.length-1]:a[0]).containerWidget.childWidgets.indexOf(r);t&&l++;var d=r.containerWidget;e.index=r.index,e.containerWidget=d,d.childWidgets.splice(l,0,e),this.constructRevisionsForBlock(e,!0),this.updateNextBlocksIndex(t?r:e,!0),e.height=0,this.documentHelper.layout.layoutBodyWidgetCollection(e.index,d,e,!1)},e.prototype.moveInlines=function(e,t,i,n,r,o,s){if(0===t.childWidgets.length){var a=new we(t);t.childWidgets.push(a)}var l=!1;this.documentHelper.layout.clearListElementBox(e),this.documentHelper.layout.clearListElementBox(t);for(var d=0;d<e.childWidgets.length;d++){var h=e.childWidgets[d];if(r===h&&s===h){i=this.moveContent(h,n,o,i,t);break}if(s===h){i=this.moveContent(h,0,o,i,t);break}r===h?(l=!0,i=this.moveContent(h,n,this.documentHelper.selection.getLineLength(h),i,t)):l&&(i=this.moveContent(h,0,this.documentHelper.selection.getLineLength(h),i,t))}this.removeEmptyLine(e),e.isInsideTable||this.documentHelper.layout.reLayoutParagraph(e,0,0)},e.prototype.moveContent=function(e,t,i,n,r){for(var o=0,s=0;s<e.children.length;s++){var a=e.children[s];if(t>=o+a.length||a instanceof Ke)a instanceof Ke||(o+=a.length);else{var l=0;t>o&&(l=t-o);var d=i-o;if(d>a.length&&(d=a.length),l>0&&(o+=l),0===l&&d===a.length){if(a instanceof Ve){var h=e.paragraph.floatingElements.indexOf(a);-1!==h&&e.paragraph.floatingElements.splice(h,1)}r.firstChild.children.splice(n,0,a),a.line=r.firstChild,n++,e.children.splice(s,1),s--}else if(a instanceof Ie){var c=new Ie;c.characterFormat.copyFormat(a.characterFormat),c.text=a.text.substr(l,d-l),a.ischangeDetected=!0,c.ischangeDetected=!0,r.firstChild.children.splice(n,0,c),c.line=r.firstChild,n++,this.updateRevisionForMovedContent(a,c),a.text=a.text.slice(0,l)+a.text.slice(d),a.ischangeDetected=!0}if(i<=o+d-l)break;o+=d-l}}return n},e.prototype.updateRevisionForMovedContent=function(e,t){for(var i=0;i<e.revisions.length;i++){var n=e.revisions[i],r=n.range.indexOf(e);t.revisions.splice(0,0,n),n.range.splice(r,0,t)}},e.prototype.updateComplexWithoutHistory=function(e,t,i){var n=this.documentHelper.selection;if(0===e){r=new Nt(n.owner);this.setPositionForCurrentIndex(r,t),this.documentHelper.layout.reLayoutParagraph(r.paragraph,0,0),this.setPositionForCurrentIndex(n.start,i),this.setPositionForCurrentIndex(n.end,i)}if(1===e){var r=new Nt(n.owner);this.setPositionForCurrentIndex(r,t);var o=new Nt(n.owner);this.setPositionForCurrentIndex(o,i),this.documentHelper.layout.reLayoutParagraph(r.paragraph,0,0),o.paragraph!==r.paragraph&&this.documentHelper.layout.reLayoutParagraph(o.paragraph,0,0)}n.owner.isShiftingEnabled&&(this.documentHelper.layout.shiftLayoutedItems(!1),this.documentHelper.owner.enableHeaderAndFooter&&this.updateHeaderFooterWidget()),n.owner.isShiftingEnabled=!1,n.start.updatePhysicalPosition(!0),n.isEmpty?n.end.setPositionInternal(n.start):n.end.updatePhysicalPosition(!0),n.upDownSelectionLength=n.end.location.x,n.fireSelectionChanged(!0),this.documentHelper.updateFocus(),this.owner.viewer.updateScrollBars(),this.fireContentChange(),this.isHandledComplex=!0},e.prototype.reLayout=function(e,i){if(!this.documentHelper.isComposingIME&&this.editorHistory&&this.editorHistory.isHandledComplexHistory())return this.editorHistory.currentHistoryInfo&&"ClearFormat"!==this.editorHistory.currentHistoryInfo.action&&"ApplyStyle"!==this.editorHistory.currentHistoryInfo.action&&(this.startParagraph=void 0,this.endParagraph=void 0),void(this.isHandledComplex=!1);t.isNullOrUndefined(this.documentHelper.blockToShift)&&(this.documentHelper.removeEmptyPages(),this.documentHelper.layout.updateFieldElements(),this.owner.viewer.updateScrollBars(),e.owner.isShiftingEnabled||(e.fireSelectionChanged(!0),this.startParagraph=void 0,this.endParagraph=void 0)),t.isNullOrUndefined(i)&&(i=e.isEmpty),this.owner.showRevisions&&this.owner.trackChangesPane.updateTrackChanges(),e.owner.isShiftingEnabled&&(e.owner.isShiftingEnabled=!1,e.owner.isLayoutEnabled=!0,this.documentHelper.layout.shiftLayoutedItems(!0),this.documentHelper.owner.enableHeaderAndFooter&&this.updateHeaderFooterWidget(),t.isNullOrUndefined(e.start.paragraph)||e.start.paragraph.containerWidget instanceof me&&("Footnote"===e.start.paragraph.containerWidget.footNoteType?(this.documentHelper.layout.isRelayoutFootnote=!0,this.shiftFootnotePageContent()):(this.documentHelper.layout.isRelayoutFootnote=!1,this.shiftFootnotePageContent())),this.getOffsetValue(e),e.upDownSelectionLength=e.end.location.x,e.fireSelectionChanged(!0),this.documentHelper.updateFocus(),this.startParagraph=void 0,this.endParagraph=void 0,this.documentHelper.layout.allowLayout=!0),this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&("RowResizing"!==this.editorHistory.currentBaseHistoryInfo.action&&"CellResizing"!==this.editorHistory.currentBaseHistoryInfo.action||this.editorHistory.isUndoing||this.editorHistory.isRedoing)&&(this.editorHistory.currentBaseHistoryInfo.modifiedProperties.length>0&&this.editorHistory.currentBaseHistoryInfo.updateSelection(),this.editorHistory.updateHistory()),this.fireContentChange(),this.owner.enableLockAndEdit&&this.owner.viewer.updateScrollBars(),this.owner.documentHelper.layout.isRelayout=!1},e.prototype.updateHeaderFooterWidget=function(e){t.isNullOrUndefined(e)&&(e=this.selection.start.paragraph.bodyWidget),this.updateHeaderFooterWidgetToPage(e),this.shiftPageContent(e.headerFooterType,e.sectionFormat)},e.prototype.updateHeaderFooterWidgetToPage=function(e){for(var t=e.page,i="EvenHeader"===(e=this.documentHelper.layout.updateHeaderFooterToParent(e)).headerFooterType||"EvenFooter"===e.headerFooterType,n=0;n<this.documentHelper.pages.length;n++){var r=this.documentHelper.pages[n];if(n+1===1&&r.bodyWidgets[0].sectionFormat.differentFirstPage&&-1!==e.headerFooterType.indexOf("FirstPage"))return;0===r.index&&r.bodyWidgets[0].sectionFormat.differentFirstPage&&-1===e.headerFooterType.indexOf("FirstPage")||t!==r&&(r.bodyWidgets[0].sectionFormat.differentOddAndEvenPages?i&&(n+1)%2==0?this.updateHeaderFooterWidgetToPageInternal(r,e,-1!==e.headerFooterType.indexOf("Header")):i||(n+1)%2==0||(n>0||!r.bodyWidgets[0].sectionFormat.differentFirstPage)&&this.updateHeaderFooterWidgetToPageInternal(r,e,-1!==e.headerFooterType.indexOf("Header")):this.updateHeaderFooterWidgetToPageInternal(r,e,-1!==e.headerFooterType.indexOf("Header")))}},e.prototype.updateHeaderFooterWidgetToPageInternal=function(e,t,i){if(t.page!==e){var n=t.clone();n.page=e,this.owner.viewer.updateHFClientArea(n.sectionFormat,i),n=this.documentHelper.layout.layoutHeaderFooterItems(this.owner.viewer,n);var r=void 0;i?(r=e.headerWidget,e.headerWidget=n):(r=e.footerWidget,e.footerWidget=n),this.removeFieldInWidget(r),this.removeFieldInWidget(r,void 0,!0),r.destroy()}},e.prototype.removeFieldInWidget=function(e,i,n){t.isNullOrUndefined(i)&&(i=!1);for(var r=0;r<e.childWidgets.length;r++)this.removeFieldInBlock(e.childWidgets[r],i,n)},e.prototype.removeFieldInBlock=function(e,t,i){e instanceof ve?this.removeFieldTable(e,t,i):this.removeField(e,t,i)},e.prototype.removeFieldTable=function(e,t,i){for(var n=0;n<e.childWidgets.length;n++)for(var r=e.childWidgets[n],o=0;o<r.childWidgets.length;o++)this.removeFieldInWidget(r.childWidgets[o],t,i)},e.prototype.shiftFootnotePageContent=function(){var e=this.documentHelper.pages[0].bodyWidgets[0];t.isNullOrUndefined(e.page.footnoteWidget)||this.checkAndShiftFromBottom(e.page,e.page.footnoteWidget),t.isNullOrUndefined(e.page.endnoteWidget),this.documentHelper.blockToShift&&(this.documentHelper.renderedLists.clear(),this.documentHelper.renderedLevelOverrides=[],this.documentHelper.layout.shiftLayoutedItems(!1))},e.prototype.shiftPageContent=function(e,i){var n;if(-1!==e.indexOf("First"))n=0;else if(i.differentOddAndEvenPages){var r=-1!==e.indexOf("Even");n=i.differentFirstPage?r?1:2:r?1:0}else 1===(n=i.differentFirstPage?1:0)&&1===this.documentHelper.pages.length&&(n=0);var o=this.documentHelper.pages[n].bodyWidgets[0];do{if(-1!==e.indexOf("Header")){var s=o.page.headerWidget,a=!s.isEmpty||s.isEmpty&&this.owner.enableHeaderAndFooter,l=o.firstChild,d=W.convertPointToPixel(i.topMargin),h=W.convertPointToPixel(i.headerDistance);if(a&&(d=Math.max(h+o.page.headerWidget.height,d)),l.y!==d){this.owner.viewer.updateClientArea(o.sectionFormat,o.page);var c=(l=l.combineWidget(this.owner.viewer)).previousRenderedWidget;c&&l.containerWidget.equals(c.containerWidget)&&(this.owner.viewer.cutFromTop(c.y+c.height),this.documentHelper.layout.updateContainerWidget(l,c.containerWidget,c.indexInOwner+1,!1)),this.documentHelper.blockToShift=l}}else this.checkAndShiftFromBottom(o.page,o.page.footerWidget);for(this.documentHelper.blockToShift&&(this.documentHelper.renderedLists.clear(),this.documentHelper.renderedLevelOverrides=[],this.documentHelper.layout.shiftLayoutedItems(!1));o;){var p=o.getSplitWidgets();if(o=p[p.length-1].nextRenderedWidget){if(0===n)break;if(o.page.index+1===0&&1===n||o.page.index+1!==0&&2===n)break;var u=o.page.nextPage;if(!t.isNullOrUndefined(u)&&u.bodyWidgets[0].equals(o)){o=u.bodyWidgets[0];break}}}}while(o)},e.prototype.checkAndShiftFromBottom=function(e,t){for(var i,n=e.bodyWidgets[0],r=0;r<n.childWidgets.length;r++){var o=n.childWidgets[r];if(o.y+o.height>t.y){i=o;break}if(n.childWidgets.length-1===r&&o.y+o.height<t.y){i=o;break}if(t instanceof me&&o.y+o.height<t.y){i=o;break}}this.owner.viewer.updateClientArea(n.sectionFormat,e,!0),this.owner.viewer.cutFromTop(i.y),this.documentHelper.blockToShift=i},e.prototype.allowFormattingInFormFields=function(e){if("FormFieldsOnly"===this.documentHelper.protectionType&&this.selection.isInlineFormFillMode()&&!t.isNullOrUndefined(this.owner.documentEditorSettings.formFieldSettings.formattingExceptions))for(var i=0;i<this.owner.documentEditorSettings.formFieldSettings.formattingExceptions.length;i++)if(e.toLowerCase()===this.owner.documentEditorSettings.formFieldSettings.formattingExceptions[i].toLowerCase())return!0;return!1},e.prototype.getContentControl=function(){for(var e=0;e<this.documentHelper.contentControlCollection.length;e++){var t=this.documentHelper.contentControlCollection[e],i=this.selection.getPosition(t),n=i.startPosition,r=i.endPosition,o=this.selection.start,s=this.selection.end;if(this.selection.isForward||(o=this.selection.end,s=this.selection.start),(o.isExistAfter(n)||o.isAtSamePosition(n))&&(s.isExistBefore(r)||s.isAtSamePosition(r)))return t}},e.prototype.checkPlainTextContentControl=function(){var e=this.selection.start,i=this.selection.end;this.selection.isForward||(i=this.selection.start,e=this.selection.end);var n=0,r=0,o=e.currentWidget.getInline(e.offset,n),s=i.currentWidget.getInline(i.offset,r);n=o.index,r=s.index;var a,l,d=o.element,h=s.element;if(d&&d.contentControlProperties&&"Text"===d.contentControlProperties.type||h&&h.contentControlProperties&&"Text"===h.contentControlProperties.type){if((d=this.getContentControl()).contentControlProperties&&!t.isNullOrUndefined(d)){var c=d.line.getOffset(d,1);(a=new Nt(this.owner)).setPositionParagraph(d.line,c)}else a=e;if(h.contentControlProperties&&d.reference){var p=(h=d.reference).line.getOffset(h,h.length);(l=new Nt(this.owner)).setPositionParagraph(h.line,p)}else l=i;this.selection.selectRange(a,l)}else e.paragraph.contentControlProperties&&"Text"===e.paragraph.contentControlProperties.type&&this.selection.selectParagraph()},e.prototype.onApplyCharacterFormat=function(e,i,n){var r=this.documentHelper.isFormFillProtectedMode&&this.documentHelper.selection.isInlineFormFillMode()&&this.allowFormattingInFormFields(e);if(!(this.restrictFormatting&&!r||this.selection.checkContentControlLocked(!0))){this.documentHelper.layout.isBidiReLayout=!0;var o=this.documentHelper.selection;if((!o.owner.isReadOnlyMode||r)&&o.owner.isDocumentLoaded){n=!t.isNullOrUndefined(n)&&n;var s=e[0].toUpperCase()+e.slice(1),a=o.start.paragraph;a.childWidgets[a.childWidgets.length-1];if(this.checkPlainTextContentControl(),o.isEmpty&&"List"!==o.contextType)return o.skipFormatRetrieval=!0,o.end.isAtParagraphEnd?(this.initHistory(s),this.documentHelper.owner.isShiftingEnabled=!0,this.applyCharFormatValue(a.characterFormat,e,i,n),this.reLayout(this.documentHelper.selection),this.documentHelper.updateFocus()):o.fireSelectionChanged(!0),void(o.skipFormatRetrieval=!1);if("highlightColor"===e&&o.start.isInSameParagraph(o.end)){var l=o.start,d=o.end;if(this.selection.isForward||(d=o.start,l=o.end),d.offset===o.getLineLength(d.currentWidget)+1&&d.offset-1===l.offset)return}this.setOffsetValue(o),this.initHistory(s),"List"===o.contextType?this.applyCharacterFormatForListText(o,e,i,n):this.updateSelectionCharacterFormatting(e,i,n),this.documentHelper.layout.isBidiReLayout=!1}}},e.prototype.applyCharacterFormatForListText=function(e,i,n,r){var o=e.getListLevel(e.start.paragraph);if(!t.isNullOrUndefined(o)){var s=o.characterFormat;switch(i){case"bold":this.applyListCharacterFormatByValue(e,s,"bold",!s.bold);break;case"italic":this.applyListCharacterFormatByValue(e,s,"italic",!s.italic);break;case"fontColor":this.applyListCharacterFormatByValue(e,s,"fontColor",n);break;case"fontFamily":this.applyListCharacterFormatByValue(e,s,"fontFamily",n);break;case"fontSize":this.applyListCharacterFormatByValue(e,s,"fontSize",n);break;case"highlightColor":this.applyListCharacterFormatByValue(e,s,"highlightColor",n);break;case"baselineAlignment":s.baselineAlignment===n&&(n="Normal"),this.applyListCharacterFormatByValue(e,s,"baselineAlignment",n);break;case"strikethrough":s.strikethrough===n&&(n="None"),this.applyListCharacterFormatByValue(e,s,"strikethrough",n);break;case"underline":s.underline===n&&(n="None"),this.applyListCharacterFormatByValue(e,s,"underline",n);break;case"characterFormat":this.applyListCharacterFormatByValue(e,s,void 0,n)}}},e.prototype.applyListCharacterFormatByValue=function(e,t,i,n){this.initHistory("ListCharacterFormat"),this.applyCharFormatValue(t,i,n,!1),this.editorHistory.updateHistory(),this.reLayout(e),this.fireContentChange()},e.prototype.updateListCharacterFormat=function(e,t,i){this.updateListTextSelRange(e,t,i,!1)},e.prototype.updateListTextSelRange=function(e,t,i,n){this.documentHelper.owner.isShiftingEnabled=!0;var r=e.start,o=e.end;e.isForward||(r=e.end,o=e.start),this.initHistoryPosition(e,r);var s=e.getListLevel(e.start.paragraph);this.applyCharFormatValue(s.characterFormat,t,i,n),this.startSelectionReLayouting(r.paragraph,e,r,o)},e.prototype.updateInsertPosition=function(){var e=this.documentHelper.selection,i=e.start;e.isForward||(i=e.end),!this.editorHistory||t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)||t.isNullOrUndefined(i)||t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo.insertPosition)&&this.updateHistoryPosition(i,!0)},e.prototype.setOffsetValue=function(e){var t=this.selection.getParagraphInfo(e.start);this.startParagraph=t.paragraph,this.startOffset=t.offset,t=this.selection.getParagraphInfo(e.end),this.endParagraph=t.paragraph,this.endOffset=t.offset},e.prototype.toggleHighlightColor=function(e){var i=this.documentHelper.selection;(t.isNullOrUndefined(e)||"NoColor"===e)&&(e="Yellow"),i.characterFormat.highlightColor===e&&(e="NoColor"),this.selection.characterFormat.highlightColor=e},e.prototype.toggleSubscript=function(){if(!this.owner.isReadOnlyMode){var e="Subscript"===this.selection.characterFormat.baselineAlignment?"Normal":"Subscript";this.selection.characterFormat.baselineAlignment=e}},e.prototype.toggleSuperscript=function(){if(!this.owner.isReadOnlyMode){var e="Superscript"===this.selection.characterFormat.baselineAlignment?"Normal":"Superscript";this.selection.characterFormat.baselineAlignment=e}},e.prototype.increaseIndent=function(){this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.onApplyParagraphFormat("leftIndent",this.documentHelper.defaultTabWidth,!0,!1)},e.prototype.decreaseIndent=function(){this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.onApplyParagraphFormat("leftIndent",-this.documentHelper.defaultTabWidth,!0,!1)},e.prototype.clearList=function(){this.selection.owner.editorModule.onApplyList(void 0)},e.prototype.applyBullet=function(e,t){this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.applyBulletOrNumbering(e,"Bullet",t)},e.prototype.applyNumbering=function(e,t){this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.applyBulletOrNumbering(e,t,"Verdana")},e.prototype.toggleBaselineAlignment=function(e){this.updateProperty(2,e)},e.prototype.clearFormatting=function(){var e=this.documentHelper.selection;this.initComplexHistory("ClearFormat"),e.isEmpty&&(e.start.moveToParagraphStartInternal(e,!1),e.end.moveToParagraphEndInternal(e,!1)),this.setOffsetValue(e),this.editorHistory&&this.editorHistory.initializeHistory("ClearCharacterFormat"),this.updateSelectionCharacterFormatting("ClearCharacterFormat",void 0,!1),this.getOffsetValue(e),this.editorHistory&&this.editorHistory.updateHistory(),this.setOffsetValue(e),this.editorHistory&&this.editorHistory.initializeHistory("ClearParagraphFormat"),this.updateParagraphFormatInternal("ClearParagraphFormat",void 0,!1),this.editorHistory&&this.editorHistory.updateHistory(),this.getOffsetValue(e),this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentHistoryInfo)&&this.editorHistory.updateComplexHistory(),this.startParagraph=void 0,this.endParagraph=void 0},e.prototype.updateProperty=function(e,i){var n=this.selection;if((!n.owner.isReadOnlyMode||this.selection.isInlineFormFillMode())&&n.owner.isDocumentLoaded){var r=n.start;n.end;n.isForward||(r=n.end,n.start);var o=0,s=r.currentWidget.getInline(r.offset,o),a=s.element;o=s.index;var l=r.paragraph;if(t.isNullOrUndefined(a)||a.length!==o||this.selection.isEmpty||(a=a.nextNode),1===e){var d="None";t.isNullOrUndefined(a)?t.isNullOrUndefined(l)||(d=l.characterFormat.underline):d=a.characterFormat.underline,this.selection.characterFormat.underline=i===d?"None":i}else{var h="Normal";t.isNullOrUndefined(a)?t.isNullOrUndefined(l)||(h=l.characterFormat.baselineAlignment):h=a.characterFormat.baselineAlignment,h===i&&(i="Normal"),this.selection.characterFormat.baselineAlignment=i}}},e.prototype.getCompleteStyles=function(){for(var e='{"styles":[',t=0,i=this.documentHelper.preDefinedStyles.keys;t<i.length;t++){var n=i[t];e+=this.documentHelper.preDefinedStyles.get(n)+","}return e.slice(0,-1)+"]}"},e.prototype.intializeDefaultStyles=function(){for(var e=this.owner.getStyleNames("Paragraph"),t=0,i=["Normal","Heading 1","Heading 2","Heading 3","Heading 4","Heading 5","Heading 6"].filter(function(t){return-1===e.indexOf(t)});t<i.length;t++){var n=i[t];this.createStyle(this.documentHelper.preDefinedStyles.get(n))}},e.prototype.createStyle=function(e){this.createStyleIn(e)},e.prototype.createStyleIn=function(e){var t=JSON.parse(e);return void 0!==this.documentHelper.styles.findByName(t.name)&&(t.name=this.getUniqueStyleName(t.name)),this.documentHelper.owner.parser.parseStyle(JSON.parse(this.getCompleteStyles()),t,this.documentHelper.styles),this.documentHelper.styles.findByName(t.name)},e.prototype.getUniqueStyleName=function(e){for(var i=this.getUniqueName(e),n=this.documentHelper.styles.findByName(i);!t.isNullOrUndefined(n);)i=this.getUniqueStyleName(n.name),n=this.documentHelper.styles.findByName(i);return i},e.prototype.getUniqueName=function(e){var i=e.match(/\d+$/);return!t.isNullOrUndefined(i)&&i.length>0?e.replace(i[0],(parseInt(i[0],10)+1).toString()):e+"_1"},e.prototype.updateSelectionCharacterFormatting=function(e,i,n){switch(t.isNullOrUndefined(e)&&(e="CharacterFormat"),e){case"bold":this.updateCharacterFormat("bold",i);break;case"italic":this.updateCharacterFormat("italic",i);break;case"fontColor":this.updateCharacterFormat("fontColor",i);break;case"fontFamily":this.updateCharacterFormat("fontFamily",i);break;case"fontSize":this.documentHelper.layout.isBidiReLayout=!1,this.updateCharacterFormatWithUpdate(this.documentHelper.selection,"fontSize",i,n);break;case"highlightColor":this.updateCharacterFormat("highlightColor",i);break;case"baselineAlignment":this.updateCharacterFormat("baselineAlignment",i);break;case"strikethrough":this.updateCharacterFormat("strikethrough",i);break;case"underline":this.updateCharacterFormat("underline",i);break;case"styleName":this.updateCharacterFormatWithUpdate(this.documentHelper.selection,"styleName",i,!0);break;case"CharacterFormat":case"ClearCharacterFormat":this.updateCharacterFormat(void 0,i);break;case"allCaps":this.updateCharacterFormat("allCaps",i)}this.reLayout(this.documentHelper.selection)},e.prototype.updateCharacterFormat=function(e,t){this.updateCharacterFormatWithUpdate(this.documentHelper.selection,e,t,!1)},e.prototype.updateCharacterFormatWithUpdate=function(e,t,i,n){this.documentHelper.owner.isShiftingEnabled=!0;var r=e.start,o=e.end;e.isForward||(r=e.end,o=e.start),this.applyCharFormatSelectedContent(r.paragraph,e,r,o,t,i,n)},e.prototype.applyCharFormatSelectedContent=function(e,t,i,n,r,o,s){if(!i.paragraph.isInsideTable||n.paragraph.isInsideTable&&i.paragraph.associatedCell===n.paragraph.associatedCell&&!t.isCellSelected(i.paragraph.associatedCell,i,n))this.applyCharFormat(e,t,i,n,r,o,s);else{var a=void 0;i.paragraph.associatedCell.ownerTable.combineWidget(this.owner.viewer),this.checkInsertPosition(t)&&this.updateHistoryPosition(i,!0),a=i.paragraph.associatedCell,this.applyCharFormatCell(a,t,i,n,r,o,s);var l=a.ownerTable;this.documentHelper.layout.layoutBodyWidgetCollection(l.index,l.containerWidget,l,!1)}},e.prototype.applyCharFormatForSelectedPara=function(e,t,i,n,r){for(var o=0;o<e.childWidgets.length;o++)for(var s=e.childWidgets[o],a=0;a<s.children.length;a++){var l=s.children[a];this.applyCharFormatValue(l.characterFormat,i,n,r)}this.applyCharFormatValue(e.characterFormat,i,n,r)},e.prototype.splittedLastParagraph=function(e){var t=e.getSplitWidgets();return t[t.length-1]},e.prototype.getNextParagraphForCharacterFormatting=function(e,i,n,r,o,s){var a=e.getSplitWidgets();e=a[a.length-1],e=this.documentHelper.selection.getNextRenderedBlock(e),t.isNullOrUndefined(e)||(e instanceof fe?this.applyCharFormat(e,this.documentHelper.selection,i,n,r,o,s):this.applyCharFormatForTable(0,e,this.documentHelper.selection,i,n,r,o,s))},e.prototype.applyCharFormat=function(e,i,n,r,o,s,a){e=e.combineWidget(this.owner.viewer);var l=0,d=i.getParagraphLength(e),h=-1!==e.childWidgets.indexOf(n.currentWidget)?e.childWidgets.indexOf(n.currentWidget):0,c=r.offset,p=-1!==e.childWidgets.indexOf(r.currentWidget)?e.childWidgets.indexOf(r.currentWidget):e.childWidgets.length-1;if(t.isNullOrUndefined(i)||e===n.paragraph&&(l=n.offset),e.equals(r.paragraph)){u=e.childWidgets[e.childWidgets.length-1];i.isParagraphLastLine(u)&&r.currentWidget===u&&(c===i.getLineLength(u)+1||i.isEmpty&&i.end.isAtParagraphEnd)&&this.applyCharFormatValue(e.characterFormat,o,s,a)}else{var u=e.childWidgets[e.childWidgets.length-1];"highlightColor"===o&&i.isParagraphLastLine(u)&&n.currentWidget===u&&n.offset===i.getLineLength(u)||this.applyCharFormatValue(e.characterFormat,o,s,a),c=d}for(var g=h;g<=p;g++){var m=e.childWidgets[g];g!==h&&(l=i.getStartLineOffset(m)),c=m===r.currentWidget?r.offset:i.getLineLength(m);for(var f=0,v=m.paragraph.paragraphFormat.bidi,y=this.documentHelper.layout.isContainsRtl(m),b=!0,w=void 0,C=-1,x=!0,F=v?m.children.length-1:0;v?F>=0:F<m.children.length;v?F--:x?F++:F--){var P=m.children[F];if(!v&&y)for(;(b||t.isNullOrUndefined(w))&&P instanceof Ie&&(this.documentHelper.textHelper.isRTLText(P.text)||this.documentHelper.textHelper.containsSpecialCharAlone(P.text))&&P.nextElement;)w||(w=P),-1===C&&(C=m.children.indexOf(P)),F=P.line.children.indexOf(P),P=P.nextElement,x=!1;if(b=!1,!(P instanceof Ke))if(w===P&&(w=void 0,F=C,C=-1,x=!0),l>=f+P.length)f+=P.length;else{var T=0;l>f&&(T=l-f);var S=c-f,I=P.length;S>I&&(S=I);var N=this.applyCharFormatInline(P,i,T,S,o,s,a);if(v||y&&!x?F-=N:F+=N,c<=f+I)break;f+=I}}}var E=r.paragraph;!e.bidi&&this.documentHelper.layout.isContainsRtl(e.childWidgets[h])?this.documentHelper.layout.reLayoutParagraph(e,h,0,!1,!0):this.documentHelper.layout.reLayoutParagraph(e,h,0),e.equals(E)||this.getNextParagraphForCharacterFormatting(e,n,r,o,s,a)},e.prototype.toggleBold=function(){if(!this.documentHelper.owner.isReadOnlyMode||this.selection.isInlineFormFillMode()){var e=this.getCurrentSelectionValue("bold");this.selection.characterFormat.bold=e}},e.prototype.toggleItalic=function(){if(!this.documentHelper.owner.isReadOnlyMode||this.selection.isInlineFormFillMode()){var e=this.getCurrentSelectionValue("italic");this.selection.characterFormat.italic=e}},e.prototype.changeCase=function(e){if(!(this.selection.isEmpty||this.documentHelper.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode())){this.initHistory("Uppercase"),this.documentHelper.owner.isShiftingEnabled=!0;var t=this.selection,i=t.start,n=t.end;t.isForward||(i=t.end,n=t.start),this.changeSelectedTextCase(t,i,n,e),this.reLayout(t)}},e.prototype.changeSelectedTextCase=function(e,i,n,r,o){var s=this.selection.getParagraphInfo(i);e.editPosition=this.selection.getHierarchicalIndex(s.paragraph,s.offset.toString()),this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&this.checkInsertPosition(e)&&this.updateHistoryPosition(i,!0);var a=this.editorHistory.isUndoing;a&&!t.isNullOrUndefined(o)&&o.length>0&&(this.removedTextNodes=o);var l=n.selection.endOffset;this.changeTextCase(i.paragraph,e,i,n,r,a),this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&(n.selection.endOffset!==l&&(n=e.getTextPosBasedOnLogicalIndex(l)),this.checkEndPosition(e)&&this.updateHistoryPosition(n,!1),e.selectPosition(i,n))},e.prototype.changeTextCase=function(e,t,i,n,r,o){if(!i.paragraph.isInsideTable||n.paragraph.isInsideTable&&i.paragraph.associatedCell===n.paragraph.associatedCell&&!t.isCellSelected(i.paragraph.associatedCell,i,n))this.changeCaseParagraph(e,t,i,n,r,o);else{var s=void 0;i.paragraph.associatedCell.ownerTable.combineWidget(this.owner.viewer),this.checkInsertPosition(t)&&this.updateHistoryPosition(i,!0),s=i.paragraph.associatedCell,this.changeCaseParaFormatInCell(s,i,n,r,o);var a=s.ownerTable;this.documentHelper.layout.layoutBodyWidgetCollection(a.index,a.containerWidget,a,!1)}},e.prototype.changeCaseParagraph=function(e,i,n,r,o,s){e=e.combineWidget(this.owner.viewer);var a=0,l=i.getParagraphLength(e),d=-1!==e.childWidgets.indexOf(n.currentWidget)?e.childWidgets.indexOf(n.currentWidget):0,h=r.offset,c=-1!==e.childWidgets.indexOf(r.currentWidget)?e.childWidgets.indexOf(r.currentWidget):e.childWidgets.length-1;t.isNullOrUndefined(i)||e===n.paragraph&&(a=n.offset),e.equals(r.paragraph)||(h=l);for(var p=d;p<=c;p++){var u=e.childWidgets[p];p!==d&&(a=i.getStartLineOffset(u)),h=u===r.currentWidget?r.offset:i.getLineLength(u);for(var g=0,m=u.paragraph.paragraphFormat.bidi,f=this.documentHelper.layout.isContainsRtl(u),v=!0,y=void 0,b=-1,w=!0,C=m?u.children.length-1:0;m?C>=0:C<u.children.length;m?C--:w?C++:C--){var x=u.children[C];if(!m&&f)for(;(v||t.isNullOrUndefined(y))&&x instanceof Ie&&(this.documentHelper.textHelper.isRTLText(x.text)||this.documentHelper.textHelper.containsSpecialCharAlone(x.text))&&x.nextElement;)y||(y=x),-1===b&&(b=u.children.indexOf(x)),C=x.line.children.indexOf(x),x=x.nextElement,w=!1;if(v=!1,!(x instanceof Ke))if(y===x&&(y=void 0,C=b,b=-1,w=!0),a>=g+x.length)g+=x.length;else{var F=0;a>g&&(F=a-g);var P=h-g,T=x.length;P>T&&(P=T);var S=this.changeCaseInline(x,i,F,P,o,s);if(m||f&&!w?C-=S:C+=S,h<=g+T)break;g+=T}}}var I=r.paragraph;!e.bidi&&this.documentHelper.layout.isContainsRtl(e.childWidgets[d])?this.documentHelper.layout.reLayoutParagraph(e,d,0,!1,!0):this.documentHelper.layout.reLayoutParagraph(e,d,0),e.equals(I)||this.changeCaseNextBlock(e,n,r,o,s)},e.prototype.changeCaseInline=function(e,t,i,n,r,o){if(e instanceof Ie){if(0!==i||n!==e.length)return this.changeCaseInlineInternal(e,t,i,n,r,o);this.changeCaseInlineInternal(e,t,i,n,r,o)}return 0},e.prototype.addRemovedTextNodes=function(e,i){if(e instanceof Ie&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)){var n=this.editorHistory.currentBaseHistoryInfo.removedNodes[0];t.isNullOrUndefined(n)&&((n=new Ie).text="",this.editorHistory.currentBaseHistoryInfo.removedNodes.push(n)),n.text+=i}},e.prototype.changeCaseInlineInternal=function(e,t,i,n,r,o){var s,a=0,l=e.line.children.indexOf(e),d=e.paragraph;d.childWidgets.indexOf(e.line);if(i>0){var h=e.text.substr(i,n-i);this.addRemovedTextNodes(e,h),(s=new Ie).characterFormat.copyFormat(e.characterFormat),s.line=e.line,s.text=this.getChangeCaseText(h,r,o),s.isRightToLeft=e.isRightToLeft,d.paragraphFormat.bidi||this.documentHelper.layout.isContainsRtl(e.line)||l++,e.line.children.splice(l,0,s),a++}n<e.length&&((s=new Ie).characterFormat.copyFormat(e.characterFormat),s.text=e.text.substring(n),s.line=e.line,s.isRightToLeft=e.isRightToLeft,d.paragraphFormat.bidi||this.documentHelper.layout.isContainsRtl(e.line)||l++,e.line.children.splice(l,0,s),a++);var c=e;if(0===i){var p=c.text.substr(0,n);this.addRemovedTextNodes(e,p),c.text=this.getChangeCaseText(p,r,o)}else{var u=c.text.substr(0,i);c.text=u}return a},e.prototype.changeCaseNextBlock=function(e,i,n,r,o){e=this.getNextBlockForChangeCase(e,i,n,r,o),t.isNullOrUndefined(e)||(e instanceof fe?this.changeCaseParagraph(e,this.documentHelper.selection,i,n,r,o):this.changeCaseForTable(0,e,this.documentHelper.selection,i,n,r,o))},e.prototype.getNextBlockForChangeCase=function(e,t,i,n,r){var o=e.getSplitWidgets();return e=o[o.length-1],e=this.documentHelper.selection.getNextRenderedBlock(e)},e.prototype.getChangeCaseText=function(e,i,n){if(n){if(!t.isNullOrUndefined(this.removedTextNodes)&&this.removedTextNodes.length>0){var r=this.removedTextNodes[0],o=r.text.substr(0,e.length);r.text=r.text.substr(o.length,r.length-o.length),e=o,""===r.text&&this.removedTextNodes.splice(0,1)}}else switch(i){case"Uppercase":e=e.toUpperCase()}return e},e.prototype.changeCaseForTable=function(e,t,i,n,r,o,s){t=t.combineWidget(this.owner.viewer);for(var a=e;a<t.childWidgets.length;a++){for(var l=t.childWidgets[a],d=0;d<l.childWidgets.length;d++)this.changeCaseForSelectedCell(l.childWidgets[d],i,o,s);if(r.paragraph.isInsideTable&&i.containsRow(l,r.paragraph.associatedCell))return void this.documentHelper.layout.layoutBodyWidgetCollection(t.index,t.containerWidget,t,!1)}this.documentHelper.layout.layoutBodyWidgetCollection(t.index,t.containerWidget,t,!1),this.changeCaseNextBlock(t,n,r,o,s)},e.prototype.changeCaseForSelectedCell=function(e,t,i,n){for(var r=0;r<e.childWidgets.length;r++){var o=e.childWidgets[r];o instanceof fe?this.changeCaseForSelectedPara(o,t,i,n):this.changeCaseForSelTable(o,t,i,n)}},e.prototype.changeCaseForSelectedPara=function(e,i,n,r){for(var o=0;o<e.childWidgets.length;o++)for(var s=e.childWidgets[o],a=0;a<s.children.length;a++){var l=s.children[a];!t.isNullOrUndefined(l)&&l instanceof Ie&&(this.addRemovedTextNodes(l,l.text),l.text=this.getChangeCaseText(l.text,n,r))}},e.prototype.changeCaseForSelTable=function(e,t,i,n){for(var r=0;r<e.childWidgets.length;r++)for(var o=e.childWidgets[r],s=0;s<o.childWidgets.length;s++)this.changeCaseForSelectedCell(o.childWidgets[s],t,i,n)},e.prototype.changeCaseParaFormatInCell=function(e,t,i,n,r){var o=this.documentHelper.selection;if(i.paragraph.isInsideTable){var s=o.getContainerCellOf(e,i.paragraph.associatedCell);if(s.ownerTable.contains(i.paragraph.associatedCell)){var a=o.getSelectedCell(e,s),l=o.getSelectedCell(i.paragraph.associatedCell,s);o.containsCell(s,i.paragraph.associatedCell)?o.isCellSelected(s,t,i)?this.changeCaseParaForCellInternal(s,o,n,r):a===s?this.changeCaseParagraph(t.paragraph,o,t,i,n,r):this.changeCaseParaForRow(a.ownerRow,o,t,i,n,r):this.changeCaseParaForTableCell(s.ownerTable,s,l,n,r)}else this.changeCaseParaForRow(s.ownerRow,o,t,i,n,r)}else{var d=o.getContainerCell(e);this.changeCaseParaForRow(d.ownerRow,o,t,i,n,r)}},e.prototype.changeCaseParaForTableCell=function(e,t,i,n,r){var o=this.documentHelper.selection,s=o.getCellLeft(t.ownerRow,t),a=s+t.cellFormat.cellWidth,l=o.getCellLeft(i.ownerRow,i),d=l+i.cellFormat.cellWidth,h=this.updateSelectedCellsInTable(s,a,l,d);s=h.start,a=h.end;for(var c=e.childWidgets.indexOf(i.ownerRow),p=e.childWidgets.indexOf(t.ownerRow);p<=c;p++)for(var u=e.childWidgets[p],g=0;g<u.childWidgets.length;g++){var m=o.getCellLeft(u,u.childWidgets[g]);Math.round(s)<=Math.round(m)&&Math.round(m)<Math.round(a)&&this.changeCaseParaForCellInternal(u.childWidgets[g],o,n,r)}},e.prototype.changeCaseParaForCellInternal=function(e,t,i,n){for(var r=0;r<e.childWidgets.length;r++){var o=e.childWidgets[r];o instanceof fe?this.changeCaseForSelectedPara(o,t,i,n):this.changeCaseParaFormatTableInternal(o,t,i,n)}},e.prototype.changeCaseParaFormatTableInternal=function(e,t,i,n){for(var r=0;r<e.childWidgets.length;r++)for(var o=e.childWidgets[r],s=0;s<o.childWidgets.length;s++)this.changeCaseParaForCellInternal(o.childWidgets[s],t,i,n)},e.prototype.changeCaseParaForRow=function(e,t,i,n,r,o){for(var s=e.rowIndex;s<e.ownerTable.childWidgets.length;s++){for(var a=e.ownerTable.childWidgets[s],l=0;l<a.childWidgets.length;l++)this.changeCaseParaForCellInternal(a.childWidgets[l],t,r,o);if(n.paragraph.isInsideTable&&this.documentHelper.selection.containsRow(a,n.paragraph.associatedCell))return}this.changeCaseNextBlock(e.ownerTable,i,n,r,o)},e.prototype.toggleAllCaps=function(){if(!this.documentHelper.owner.isReadOnlyMode||this.selection.isInlineFormFillMode()){var e=this.getCurrentSelectionValue("allCaps");this.selection.characterFormat.allCaps=e}},e.prototype.getCurrentSelectionValue=function(e){var t=!1;if("bold"===e||"italic"===e){var i=this.getSelectedCharacterFormat();"bold"===e&&(t=!i.bold),"italic"===e&&(t=!i.italic)}return t},e.prototype.getSelectedCharacterFormat=function(){var e=0,i=this.selection.start;this.selection.isForward||(i=this.selection.end);var n=i.currentWidget,r=n.getInline(i.offset,e),o=r.element;e=r.index;var s=n.paragraph.characterFormat;if(!t.isNullOrUndefined(o))if(this.selection.isEmpty&&"List"===this.selection.contextType){var a=this.selection.getListLevel(this.selection.start.paragraph);a.characterFormat.uniqueCharacterFormat&&(s=a.characterFormat)}else s=this.selection.isEmpty||e!==o.length?o.characterFormat:t.isNullOrUndefined(o.nextNode)?n.paragraph.characterFormat:o.nextNode.characterFormat;return s},e.prototype.toggleUnderline=function(e){this.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||this.updateProperty(1,e)},e.prototype.toggleStrikethrough=function(e){if(!this.owner.isReadOnlyMode||this.selection.isInlineFormFillMode()){var i=void 0;i=t.isNullOrUndefined(e)?"SingleStrike"===this.selection.characterFormat.strikethrough?"None":"SingleStrike":e,this.selection.characterFormat.strikethrough=i}},e.prototype.updateFontSize=function(e,t){if("number"==typeof t&&!(t<0&&1===e.fontSize))return e.fontSize+t;var i=[8,9,10,11,12,14,16,18,20,24,26,28,36,48,72];if("string"==typeof t&&"increment"===t){if(e.fontSize<8)return e.fontSize+1;if(e.fontSize>=72&&e.fontSize<80)return 80;if(e.fontSize>=80)return e.fontSize+10;for(n=0;n<i.length;n++)if(e.fontSize<i[n])return i[n]}else if("string"==typeof t&&"decrement"===t&&e.fontSize>1){if(e.fontSize<=8)return e.fontSize-1;if(e.fontSize>72&&e.fontSize<=80)return 72;if(e.fontSize>80)return e.fontSize-10;for(var n=0;n<i.length;n++)if(e.fontSize<=i[n])return i[n-1]}return e.fontSize},e.prototype.applyCharFormatInline=function(e,t,i,n,r,o,s){return 0===i&&n===e.length?(this.applyCharFormatValue(e.characterFormat,r,o,s),0):e instanceof Ie?this.formatInline(e,t,i,n,r,o,s):0},e.prototype.formatInline=function(e,t,i,n,r,o,s){var a,l=0,d=e,h=e.line.children.indexOf(d),c=e.paragraph;c.childWidgets.indexOf(e.line);return i>0&&((a=new Ie).characterFormat.copyFormat(e.characterFormat),a.line=e.line,a.text=e.text.substr(i,n-i),a.isRightToLeft=e.isRightToLeft,this.applyCharFormatValue(a.characterFormat,r,o,s),c.paragraphFormat.bidi||this.documentHelper.layout.isContainsRtl(e.line)||h++,d.line.children.splice(h,0,a),l++),n<d.length&&((a=new Ie).characterFormat.copyFormat(e.characterFormat),a.text=d.text.substring(n),a.line=e.line,a.isRightToLeft=e.isRightToLeft,c.paragraphFormat.bidi||this.documentHelper.layout.isContainsRtl(e.line)||h++,d.line.children.splice(h,0,a),l++),0===i?(e.text=e.text.substr(0,n),this.applyCharFormatValue(e.characterFormat,r,o,s)):e.text=e.text.substr(0,i),l},e.prototype.applyCharFormatCell=function(e,t,i,n,r,o,s){if(n.paragraph.isInsideTable){var a=t.getContainerCellOf(e,n.paragraph.associatedCell);if(a.ownerTable.contains(n.paragraph.associatedCell)){var l=t.getSelectedCell(e,a),d=t.getSelectedCell(n.paragraph.associatedCell,a);t.containsCell(a,n.paragraph.associatedCell)?t.isCellSelected(a,i,n)?(o=this.getCharacterFormatValueOfCell(e,t,o,r),this.applyCharFormatForSelectedCell(a,t,r,o,s)):l===a?this.applyCharFormat(i.paragraph,t,i,n,r,o,s):this.applyCharFormatRow(l.ownerRow,t,i,n,r,o,s):this.applyCharFormatForTableCell(a.ownerTable,t,a,d,r,o,s)}else this.applyCharFormatRow(a.ownerRow,t,i,n,r,o,s)}else{var h=t.getContainerCell(e);this.applyCharFormatRow(h.ownerRow,t,i,n,r,o,s)}},e.prototype.applyCharFormatForSelectedCell=function(e,t,i,n,r){for(var o=0;o<e.childWidgets.length;o++){var s=e.childWidgets[o];s instanceof fe?this.applyCharFormatForSelectedPara(s,t,i,n,r):this.applyCharFormatForSelTable(s,t,i,n,r)}},e.prototype.applyCharFormatRow=function(e,t,i,n,r,o,s){o=this.getCharacterFormatValueOfCell(e.childWidgets[0],t,o,r),this.applyCharFormatForTable(e.rowIndex,e.ownerTable,t,i,n,r,o,s)},e.prototype.applyCharFormatForTable=function(e,t,i,n,r,o,s,a){t=t.combineWidget(this.owner.viewer);for(var l=e;l<t.childWidgets.length;l++){for(var d=t.childWidgets[l],h=0;h<d.childWidgets.length;h++)this.applyCharFormatForSelectedCell(d.childWidgets[h],i,o,s,a);if(r.paragraph.isInsideTable&&i.containsRow(d,r.paragraph.associatedCell))return void this.documentHelper.layout.layoutBodyWidgetCollection(t.index,t.containerWidget,t,!1)}this.documentHelper.layout.layoutBodyWidgetCollection(t.index,t.containerWidget,t,!1),this.getNextParagraphForCharacterFormatting(t,n,r,o,s,a)},e.prototype.applyCharFormatForSelTable=function(e,t,i,n,r){for(var o=0;o<e.childWidgets.length;o++)for(var s=e.childWidgets[o],a=0;a<s.childWidgets.length;a++)this.applyCharFormatForSelectedCell(s.childWidgets[a],t,i,n,r)},e.prototype.applyCharFormatForTableCell=function(e,t,i,n,r,o,s){var a=t.getCellLeft(i.ownerRow,i),l=a+i.cellFormat.cellWidth,d=t.getCellLeft(n.ownerRow,n),h=d+n.cellFormat.cellWidth,c=this.updateSelectedCellsInTable(a,l,d,h);a=c.start,l=c.end;for(var p=e.childWidgets.indexOf(n.ownerRow),u=!1,g=e.childWidgets.indexOf(i.ownerRow);g<=p;g++)for(var m=e.childWidgets[g],f=0;f<m.childWidgets.length;f++){var v=t.getCellLeft(m,m.childWidgets[f]);W.round(a,2)<=W.round(v,2)&&W.round(v,2)<W.round(l,2)&&(u||(o=this.getCharacterFormatValueOfCell(m.childWidgets[f],t,o,r),u=!0),this.applyCharFormatForSelectedCell(m.childWidgets[f],t,r,o,s))}},e.prototype.updateSelectedCellsInTable=function(e,t,i,n){var r=this.documentHelper.selection;return e>i&&(e=i),t<n&&(t=n),e>r.upDownSelectionLength&&(e=r.upDownSelectionLength),t<r.upDownSelectionLength&&(t=r.upDownSelectionLength),{start:e,end:t}},e.prototype.getCharacterFormatValueOfCell=function(e,t,i,n){if("boolean"==typeof i||void 0===i&&("bold"===n||"italic"===n)){var r=t.getFirstParagraph(e),o=r.characterFormat;r.childWidgets.length>0&&r.childWidgets[0].children.length>0&&(o=r.childWidgets[0].children[0].characterFormat),i=!o.getPropertyValue(n)}return i},e.prototype.applyCharFormatValueInternal=function(e,t,i,n){this.applyCharFormatValue(t,i,n,!1)},e.prototype.copyInlineCharacterFormat=function(e,t){t.uniqueCharacterFormat=e.uniqueCharacterFormat,t.baseCharStyle=e.baseCharStyle},e.prototype.applyCharFormatValue=function(e,i,n,r){if(r&&"fontSize"===i&&(n=this.updateFontSize(e,n)),this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)&&(n=this.editorHistory.currentBaseHistoryInfo.addModifiedProperties(e,i,n)),n instanceof H)return void(this.editorHistory&&(this.editorHistory.isUndoing||this.editorHistory.isRedoing)?this.copyInlineCharacterFormat(n,e):e.copyFormat(n));if(this.isForHyperlinkFormat&&this.owner.enableTrackChanges&&e.ownerBase instanceof Ce){var o=e.ownerBase,s=o.previousNode;if(t.isNullOrUndefined(s)){var a=o.paragraph.previousWidget;if(!t.isNullOrUndefined(a)&&!a.isEmpty()){var l=a.lastChild;s=l.children[l.children.length-1]}}for(;!(t.isNullOrUndefined(s)||s instanceof Ie);)s=s.previousNode;if(!t.isNullOrUndefined(s)&&s.revisions.length>0){var d=s.revisions[s.revisions.length-1];this.isRevisionAlreadyIn(o,d)||(o.revisions.push(d),d.range.push(o))}else this.insertRevision(o,"Insertion")}if(t.isNullOrUndefined(n))return void e.clearFormat();"bold"===i?e.bold=n:"italic"===i?e.italic=n:"fontColor"===i?e.fontColor=n:"fontFamily"===i?e.fontFamily=n:"fontSize"===i?e.fontSize=n:"highlightColor"===i?e.highlightColor=n:"baselineAlignment"===i?e.baselineAlignment=n:"strikethrough"===i?e.strikethrough=n:"underline"===i?e.underline=n:"styleName"===i?e.baseCharStyle=n:"allCaps"===i&&(e.allCaps=n)},e.prototype.onImageFormat=function(e,t,i){var n=new Wt(e);this.editorHistory&&(this.editorHistory.initializeHistory("ImageResizing"),this.editorHistory.currentBaseHistoryInfo.modifiedProperties.push(n)),this.setOffsetValue(this.selection),e.width=t,e.height=i,this.documentHelper.layout.reLayoutParagraph(e.line.paragraph,e.line.indexInOwner,0),this.reLayout(this.selection,!1),this.documentHelper.owner.imageResizerModule&&this.documentHelper.owner.imageResizerModule.positionImageResizer(e)},e.prototype.toggleTextAlignment=function(e){this.documentHelper.owner.isReadOnlyMode&&!this.selection.isInlineFormFillMode()||!this.documentHelper.owner.isDocumentLoaded||(t.isNullOrUndefined(this.documentHelper.selection.paragraphFormat.textAlignment)||this.documentHelper.selection.paragraphFormat.textAlignment!==e?this.onApplyParagraphFormat("textAlignment",e,!1,!0):"Left"===e?this.onApplyParagraphFormat("textAlignment","Justify",!1,!0):this.onApplyParagraphFormat("textAlignment","Left",!1,!0))},e.prototype.onApplyParagraphFormat=function(e,t,i,n){var r=this.documentHelper.isFormFillProtectedMode&&this.documentHelper.selection.isInlineFormFillMode()&&this.allowFormattingInFormFields(e);if(!this.restrictFormatting||r){var o="bidi"===e?"ParagraphBidi":e[0].toUpperCase()+e.slice(1);this.documentHelper.owner.isShiftingEnabled=!0;var s=this.documentHelper.selection;if(this.initHistory(o),(!this.owner.isReadOnlyMode||r)&&this.owner.isDocumentLoaded){if("leftIndent"===e&&-1!==s.paragraphFormat.listId&&i)return void this.updateListLevel(t>0);if(s.isEmpty){this.setOffsetValue(s);var a=s.paragraphFormat.bidi&&("listFormat"===e||-1!==s.paragraphFormat.listId);a||(this.documentHelper.layout.isBidiReLayout=!0),i&&"leftIndent"===e&&(t=this.getIndentIncrementValue(s.start.paragraph,t));var l=s.start.paragraph.combineWidget(this.owner.viewer);this.applyParaFormatProperty(l,e,t,i),this.layoutItemBlock(l,!1),a||(this.documentHelper.layout.isBidiReLayout=!1)}else"ParagraphBidi"!==o&&this.setOffsetValue(s),this.updateSelectionParagraphFormatting(e,t,i);this.reLayout(s)}}},e.prototype.updateListLevel=function(e){var i,n=this.documentHelper,r=(this.documentHelper.selection.start.paragraph.paragraphFormat.listFormat,this.documentHelper.selection.start.paragraph.paragraphFormat),o=n.getListById(r.listFormat.listId);n.layout.getListLevel(o,r.listFormat.listLevelNumber);i=e?r.listFormat.listLevelNumber+1:r.listFormat.listLevelNumber-1;var s=n.layout.getListLevel(o,i);t.isNullOrUndefined(s)||(this.onApplyListInternal(o,i),n.selection.start.updatePhysicalPosition(!0),n.selection.end.updatePhysicalPosition(!0),n.selection.updateCaretPosition())},e.prototype.onApplyListInternal=function(e,i){var n=new x;!t.isNullOrUndefined(e)&&i>=0&&i<9&&(n.listId=e.listId,n.listLevelNumber=i),this.onApplyParagraphFormat("listFormat",n,!1,!1)},e.prototype.updateSelectionParagraphFormatting=function(e,i,n){var r=this.documentHelper.selection;"leftIndent"===e&&n&&(i=!t.isNullOrUndefined(r.start)&&r.start.isExistBefore(r.end)?this.getIndentIncrementValue(r.start.paragraph,i):this.getIndentIncrementValue(r.end.paragraph,i)),this.updateParagraphFormatInternal(e,i,n)},e.prototype.getIndentIncrementValue=function(e,t){var i=e.paragraphFormat.leftIndent;if(i<0){if(t<0||i+t>=0)return-i;var n=-this.getIndentIncrementValueInternal(-i,-t);return n%t==0?n:n+t}return this.getIndentIncrementValueInternal(i,t)},e.prototype.getIndentIncrementValueInternal=function(e,t){var i=Math.abs(t);if(0===e||0===i)return t>0?i:0;var n=100*Math.round(e)%(100*Math.round(i))/100,r=(Math.round(e)-n)/Math.round(i)*i;return t>0&&(r+=i),r-e==0?t:r-e},e.prototype.updateParagraphFormatInternal=function(e,i,n){switch(t.isNullOrUndefined(e)&&(e="ParagraphFormat"),e){case"afterSpacing":this.updateParagraphFormat("afterSpacing",i,!1);break;case"beforeSpacing":this.updateParagraphFormat("beforeSpacing",i,!1);break;case"rightIndent":this.updateParagraphFormat("rightIndent",i,!1);break;case"leftIndent":this.updateParagraphFormat("leftIndent",i,n);break;case"firstLineIndent":this.updateParagraphFormat("firstLineIndent",i,!1);break;case"lineSpacing":this.updateParagraphFormat("lineSpacing",i,!1);break;case"lineSpacingType":this.updateParagraphFormat("lineSpacingType",i,!1);break;case"textAlignment":this.updateParagraphFormat("textAlignment",i,!1);break;case"listFormat":this.updateParagraphFormat("listFormat",i,!1);break;case"ParagraphFormat":this.updateParagraphFormat(void 0,i,!1);break;case"styleName":this.updateParagraphFormat("styleName",i,!1);break;case"ClearParagraphFormat":this.updateParagraphFormat(void 0,i,!1);break;case"bidi":var r=-1!==this.selection.paragraphFormat.listId;r||(this.documentHelper.layout.isBidiReLayout=!0),this.updateParagraphFormat("bidi",i,!1),r||(this.documentHelper.layout.isBidiReLayout=!1);break;case"contextualSpacing":this.updateParagraphFormat("contextualSpacing",i,!1)}},e.prototype.updateParagraphFormat=function(e,t,i){var n=this.documentHelper.selection,r=n.start,o=n.end;n.isForward||(r=n.end,o=n.start),this.applyParaFormatSelectedContent(r,o,e,t,i)},e.prototype.applyParaFormatSelectedContent=function(e,i,n,r,o){var s=this.documentHelper.selection;if(!e.paragraph.isInsideTable||i.paragraph.isInsideTable&&e.paragraph.associatedCell===i.paragraph.associatedCell&&!s.isCellSelected(e.paragraph.associatedCell,e,i)){if(!t.isNullOrUndefined(r)&&!this.selection.isEmpty&&"styleName"===n&&this.applyCharacterStyle(e.paragraph,e,i,n,r,o))return;this.applyParaFormat(e.paragraph,e,i,n,r,o)}else{var a=void 0;e.paragraph.associatedCell.ownerTable.combineWidget(this.owner.viewer),this.checkInsertPosition(s)&&this.updateHistoryPosition(e,!0),a=e.paragraph.associatedCell,this.applyParaFormatInCell(a,e,i,n,r,o);var l=a.ownerTable;this.documentHelper.layout.layoutBodyWidgetCollection(l.index,l.containerWidget,l,!1)}},e.prototype.applyParaFormatProperty=function(e,i,n,r){var o=e.paragraphFormat;if(r&&"leftIndent"===i&&(n=o.leftIndent+n),"listFormat"===i&&n instanceof x){var s=n;s.hasValue("listLevelNumber")||(s.listLevelNumber=o.listFormat.listLevelNumber)}if(this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)&&(n=this.editorHistory.currentBaseHistoryInfo.addModifiedPropertiesForParagraphFormat(o,i,n)),n instanceof P&&(t.isNullOrUndefined(i)?this.editorHistory&&(this.editorHistory.isUndoing||this.editorHistory.isRedoing)?this.copyParagraphFormat(n,o):o.copyFormat(n):"listFormat"===i&&(o.listFormat=n.listFormat)),t.isNullOrUndefined(n))return o.clearFormat(),void this.documentHelper.layout.reLayoutParagraph(o.ownerBase,0,0);if("afterSpacing"===i)o.afterSpacing=n;else if("beforeSpacing"===i)o.beforeSpacing=n;else if("leftIndent"===i)o.leftIndent=n;else if("lineSpacingType"===i)o.lineSpacingType=n;else if("lineSpacing"===i)o.lineSpacing=n;else if("rightIndent"===i)o.rightIndent=n;else if("firstLineIndent"===i)o.firstLineIndent=n;else if("textAlignment"===i)o.textAlignment=n,this.documentHelper.layout.allowLayout=!1;else if("styleName"===i)"string"==typeof n&&(n=this.documentHelper.styles.findByName(n)),o.applyStyle(n);else{if("listFormat"===i)return n instanceof P&&(this.copyFromListLevelParagraphFormat(o,n),n=n.listFormat),o.listFormat.copyFormat(n),this.documentHelper.layout.clearListElementBox(o.ownerBase),this.onListFormatChange(o.ownerBase,n,o),void this.layoutItemBlock(o.ownerBase,!1);"bidi"===i?o.bidi=n:"contextualSpacing"===i&&(o.contextualSpacing=n)}},e.prototype.copyParagraphFormat=function(e,t){t.uniqueParagraphFormat=e.uniqueParagraphFormat,t.listFormat=e.listFormat,t.baseStyle=e.baseStyle},e.prototype.onListFormatChange=function(e,t,i){t instanceof x&&this.updateListParagraphFormat(e,t)},e.prototype.updateListParagraphFormat=function(e,i){var n=this.documentHelper.getListById(i.listId),r=void 0;t.isNullOrUndefined(n)||(r=this.documentHelper.layout.getListLevel(n,i.listLevelNumber)),(!this.editorHistory||this.editorHistory&&!this.editorHistory.isUndoing)&&(e instanceof fe&&!t.isNullOrUndefined(r)&&!t.isNullOrUndefined(r.paragraphFormat)&&!t.isNullOrUndefined(e.containerWidget)?this.copyFromListLevelParagraphFormat(e.paragraphFormat,r.paragraphFormat):t.isNullOrUndefined(n)&&(e.paragraphFormat.leftIndent=void 0,e.paragraphFormat.firstLineIndent=void 0))},e.prototype.copyFromListLevelParagraphFormat=function(e,i){t.isNullOrUndefined(i.leftIndent)||(e.leftIndent=i.leftIndent),t.isNullOrUndefined(i.firstLineIndent)||(e.firstLineIndent=i.firstLineIndent)},e.prototype.applyContinueNumbering=function(){var e=this.selection;this.editorHistory&&this.editorHistory.initializeHistory("ContinueNumbering"),this.applyContinueNumberingInternal(e)},e.prototype.applyContinueNumberingInternal=function(e){var t=e.start.paragraph,i=this.getContinueNumberingInfo(t),n=this.getParagraphFormat(t,i.listLevelNumber,i.listPattern);this.changeListId(i.currentList,t,n,i.listLevelNumber,i.listPattern),this.reLayout(e,!1),this.documentHelper.updateFocus()},e.prototype.getContinueNumberingInfo=function(e){var i=void 0,n=0,r="None";t.isNullOrUndefined(e.paragraphFormat)||t.isNullOrUndefined(e.paragraphFormat.listFormat)||(i=this.documentHelper.getListById(e.paragraphFormat.listFormat.listId),n=e.paragraphFormat.listFormat.listLevelNumber);var o=this.documentHelper;if(0!==n&&!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(o.getAbstractListById(i.abstractListId))&&!t.isNullOrUndefined(o.getAbstractListById(i.abstractListId).levels[n])){var s=this.documentHelper.layout.getListLevel(i,n);t.isNullOrUndefined(s)||(r=s.listLevelPattern)}return{currentList:i,listLevelNumber:n,listPattern:r}},e.prototype.revertContinueNumbering=function(e,i){var n=e.start.paragraph,r=this.getContinueNumberingInfo(n);this.changeListId(r.currentList,n,i,r.listLevelNumber,r.listPattern),this.reLayout(e,!1),this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)&&this.editorHistory.updateHistory()},e.prototype.changeListId=function(e,i,n,r,o){if(!t.isNullOrUndefined(i)){if(i instanceof fe&&e.listId===i.paragraphFormat.listFormat.listId&&r===i.paragraphFormat.listFormat.listLevelNumber){if(this.editorHistory){var s=this.editorHistory.currentBaseHistoryInfo;t.isNullOrUndefined(s)||(n=s.addModifiedPropertiesForContinueNumbering(i.paragraphFormat,n))}i.paragraphFormat.copyFormat(n),this.documentHelper.layout.reLayoutParagraph(i,0,0)}return this.changeListId(e,i.nextRenderedWidget,n,r,o)}},e.prototype.getParagraphFormat=function(e,i,n){if(!t.isNullOrUndefined(e.previousRenderedWidget)&&e.previousRenderedWidget instanceof fe){if(t.isNullOrUndefined(e.previousRenderedWidget.paragraphFormat.listFormat)||-1===e.previousRenderedWidget.paragraphFormat.listFormat.listId)return this.getParagraphFormat(e.previousRenderedWidget,i,n);var r=this.selection.getListLevel(e.previousRenderedWidget);return 0===i?e.previousRenderedWidget.paragraphFormat:n===r.listLevelPattern||this.checkNumberArabic(n,r.listLevelPattern)?e.previousRenderedWidget.paragraphFormat:this.getParagraphFormat(e.previousRenderedWidget,i,n)}},e.prototype.checkNumberArabic=function(e,t){return"Number"===e&&"Arabic"===t||"Number"===t&&"Arabic"===e},e.prototype.applyRestartNumbering=function(e){this.editorHistory&&this.editorHistory.initializeHistory("RestartNumbering"),this.restartListAt(e)},e.prototype.restartListAt=function(e){var t=e.paragraphFormat.getList(),i=t.clone();i.listId=this.documentHelper.lists[this.documentHelper.lists.length-1].listId+1,this.documentHelper.lists.push(i);var n=t.abstractList.clone();n.abstractListId=this.documentHelper.abstractLists[this.documentHelper.abstractLists.length-1].abstractListId+1,i.abstractListId=n.abstractListId,i.abstractList=n,this.documentHelper.abstractLists.push(n),this.restartListAtInternal(e,i.listId)},e.prototype.restartListAtInternal=function(e,t){var i=this.getContinueNumberingInfo(e.start.paragraph);this.changeRestartNumbering(i.currentList,e.start.paragraph,t),this.reLayout(e,!1),this.incrementListNumber=-1,this.refListNumber=void 0,this.documentHelper.updateFocus()},e.prototype.changeRestartNumbering=function(e,i,n){if(!t.isNullOrUndefined(i)){if(i instanceof fe&&e.listId===i.paragraphFormat.listFormat.listId){if(this.editorHistory){var r=this.editorHistory.currentBaseHistoryInfo;t.isNullOrUndefined(r)||(n=r.addModifiedPropertiesForRestartNumbering(i.paragraphFormat.listFormat,n))}i.paragraphFormat.listFormat.listId=n,void 0===this.refListNumber&&-1===this.incrementListNumber&&(this.incrementListNumber=i.paragraphFormat.listFormat.listLevelNumber-1),this.refListNumber!==i.paragraphFormat.listFormat.listLevelNumber&&(this.incrementListNumber+=1,this.refListNumber=i.paragraphFormat.listFormat.listLevelNumber),i.paragraphFormat.listFormat.listLevelNumber=this.incrementListNumber,this.documentHelper.layout.reLayoutParagraph(i,0,0)}return this.changeRestartNumbering(e,i.nextRenderedWidget,n)}},e.prototype.applyParaFormat=function(e,t,i,n,r,o){this.setOffsetValue(this.selection),e=e.combineWidget(this.owner.viewer),this.applyParaFormatProperty(e,n,r,o),this.layoutItemBlock(e,!1),this.getOffsetValue(this.selection),e.equals(i.paragraph)||this.getNextParagraphForFormatting(e,t,i,n,r,o)},e.prototype.applyCharacterStyle=function(e,t,i,n,r,o){var s=e.getSplitWidgets(),a=i.owner.selection,l=i.currentWidget;if(!(0===t.offset&&(a.isParagraphLastLine(l)&&i.currentWidget===l&&i.offset===a.getLineLength(l)+1||i.isAtParagraphEnd))&&(i.paragraph===e||-1!==s.indexOf(i.paragraph))&&("Paragraph"===r.type&&r.link instanceof D||"Character"===r.type)){var d="Character"===r.type?r:r.link;return this.updateSelectionCharacterFormatting(n,d,o),!0}return!1},e.prototype.applyParaFormatInCell=function(e,t,i,n,r,o){var s=this.documentHelper.selection;if(i.paragraph.isInsideTable){var a=s.getContainerCellOf(e,i.paragraph.associatedCell);if(a.ownerTable.contains(i.paragraph.associatedCell)){var l=s.getSelectedCell(e,a),d=s.getSelectedCell(i.paragraph.associatedCell,a);s.containsCell(a,i.paragraph.associatedCell)?s.isCellSelected(a,t,i)?(r=this.getParaFormatValueInCell(a,n,r),this.applyParaFormatCellInternal(a,n,r,o)):l===a?this.applyParaFormat(t.paragraph,t,i,n,r,o):this.applyParagraphFormatRow(l.ownerRow,t,i,n,r,o):this.applyParaFormatTableCell(a.ownerTable,a,d,n,r,o)}else this.applyParagraphFormatRow(a.ownerRow,t,i,n,r,o)}else{var h=s.getContainerCell(e);this.applyParagraphFormatRow(h.ownerRow,t,i,n,r,o)}},e.prototype.applyParaFormatCellInternal=function(e,t,i,n){for(var r=0;r<e.childWidgets.length;r++){var o=e.childWidgets[r];o instanceof fe?this.applyParaFormatProperty(o,t,i,n):this.applyParagraphFormatTableInternal(o,t,i,n)}},e.prototype.getParaFormatValueInCell=function(e,t,i){return"boolean"==typeof i&&(i=!this.documentHelper.selection.getFirstParagraph(e).paragraphFormat.getPropertyValue(t)),i},e.prototype.applyParagraphFormatRow=function(e,t,i,n,r,o){r=this.getParaFormatValueInCell(e.childWidgets[0],n,r);for(var s=e.rowIndex;s<e.ownerTable.childWidgets.length;s++){for(var a=e.ownerTable.childWidgets[s],l=0;l<a.childWidgets.length;l++)this.applyParaFormatCellInternal(a.childWidgets[l],n,r,o);if(i.paragraph.isInsideTable&&this.documentHelper.selection.containsRow(a,i.paragraph.associatedCell))return}this.getNextParagraphForFormatting(e.ownerTable,t,i,n,r,o)},e.prototype.applyParaFormatTableCell=function(e,t,i,n,r,o){var s=this.documentHelper.selection,a=s.getCellLeft(t.ownerRow,t),l=a+t.cellFormat.cellWidth,d=s.getCellLeft(i.ownerRow,i),h=d+i.cellFormat.cellWidth,c=this.updateSelectedCellsInTable(a,l,d,h);a=c.start,l=c.end;for(var p=e.childWidgets.indexOf(i.ownerRow),u=!1,g=e.childWidgets.indexOf(t.ownerRow);g<=p;g++)for(var m=e.childWidgets[g],f=0;f<m.childWidgets.length;f++){var v=s.getCellLeft(m,m.childWidgets[f]);Math.round(a)<=Math.round(v)&&Math.round(v)<Math.round(l)&&(u||(r=this.getParaFormatValueInCell(m.childWidgets[f],n,r),u=!0),this.applyParaFormatCellInternal(m.childWidgets[f],n,r,o))}},e.prototype.applyParaFormatTable=function(e,t,i,n,r,o){e=e.combineWidget(this.owner.viewer);for(var s=this.documentHelper.selection,a=0;a<e.childWidgets.length;a++){for(var l=e.childWidgets[a],d=0;d<l.childWidgets.length;d++)this.applyParaFormatCellInternal(l.childWidgets[d],n,r,o);if(i.paragraph.isInsideTable&&s.containsRow(l,i.paragraph.associatedCell))return void this.documentHelper.layout.layoutBodyWidgetCollection(e.index,e.containerWidget,e,!1)}this.documentHelper.layout.layoutBodyWidgetCollection(e.index,e.containerWidget,e,!1),this.getNextParagraphForFormatting(e,t,i,n,r,o)},e.prototype.getNextParagraphForFormatting=function(e,i,n,r,o,s){var a=e.getSplitWidgets();e=a[a.length-1],e=this.documentHelper.selection.getNextRenderedBlock(e),t.isNullOrUndefined(e)||(e instanceof fe?this.applyParaFormat(e,i,n,r,o,s):this.applyParaFormatTable(e,i,n,r,o,s))},e.prototype.applyParagraphFormatTableInternal=function(e,t,i,n){for(var r=0;r<e.childWidgets.length;r++)for(var o=e.childWidgets[r],s=0;s<o.childWidgets.length;s++)this.applyParaFormatCellInternal(o.childWidgets[s],t,i,n)},e.prototype.onApplySectionFormat=function(e,i){if(!this.restrictFormatting){if(t.isNullOrUndefined(e))this.initHistory("SectionFormat");else{var n=e[0].toUpperCase()+e.slice(1);this.initHistory(n)}this.updateSectionFormat(e,i)}},e.prototype.updateSectionFormat=function(e,t){var i=this.documentHelper.selection;i.owner.isShiftingEnabled=!0;var n=i.start,r=i.end;i.isForward||(n=i.end,r=i.start);var o,s;this.documentHelper.clearContent();for(var a=n.paragraph.bodyWidget.sectionIndex,l=r.paragraph.bodyWidget.sectionIndex,d=0;d<this.documentHelper.pages.length;d++)if(this.documentHelper.pages[d].bodyWidgets[0].index===a){o=d;break}for(d=o;d<this.documentHelper.pages.length;d++){var h=this.documentHelper.pages[d].bodyWidgets[0];if(s=d,h.index!==a&&!(h.index>=a&&h.index<=l)){s=d-1;break}}for(var c=!0,p=0,d=o;d<=s;d++)p===this.documentHelper.pages[d].bodyWidgets[0].index||c||(c=!0),this.applyPropertyValueForSection(this.documentHelper.pages[d].bodyWidgets[0].sectionFormat,e,t,c),p=this.documentHelper.pages[d].bodyWidgets[0].index,c=!1;this.layoutWholeDocument(),this.fireContentChange()},e.prototype.onApplyTableFormat=function(e,t){if(!this.restrictFormatting){var i=this.getTableFormatAction(e);this.viewer.owner.isShiftingEnabled=!0;var n=this.documentHelper.selection,r=n.start.paragraph.associatedCell.ownerTable;r=r.combineWidget(this.owner.viewer),n.isEmpty?(this.initHistory(i),this.applyTablePropertyValue(n,e,t,r)):this.updateSelectionTableFormat(this.selection,i,t),r.calculateGrid(),this.selection.owner.isLayoutEnabled=!0,this.documentHelper.layout.reLayoutTable(r),this.reLayout(n,!1)}},e.prototype.getTableFormatAction=function(e){switch(e){case"tableAlignment":return"TableAlignment";case"leftIndent":return"TableLeftIndent";case"leftMargin":return"DefaultCellLeftMargin";case"rightMargin":return"DefaultCellRightMargin";case"bottomMargin":return"DefaultCellBottomMargin";case"topMargin":return"DefaultCellTopMargin";case"preferredWidth":return"TablePreferredWidth";case"preferredWidthType":return"TablePreferredWidthType";case"shading":return"Shading";case"bidi":return"TableBidi";default:return"DefaultCellSpacing"}},e.prototype.onApplyTableRowFormat=function(e,t){if(!this.restrictFormatting){var i=this.getRowAction(e);this.documentHelper.owner.isShiftingEnabled=!0;var n=this.documentHelper.selection;if(n.isEmpty){this.initHistory(i);n.start.paragraph.associatedCell.ownerRow.ownerTable;this.applyRowPropertyValue(n,e,t,n.start.paragraph.associatedCell.ownerRow)}else this.updateSelectionTableFormat(this.selection,i,t);this.reLayout(n,!1)}},e.prototype.getRowAction=function(e){switch(e){case"height":return"RowHeight";case"heightType":return"RowHeightType";case"isHeader":return"RowHeader";default:return"AllowBreakAcrossPages"}},e.prototype.onApplyTableCellFormat=function(e,t){if(!this.restrictFormatting){var i=this.getTableCellAction(e);this.documentHelper.owner.isShiftingEnabled=!0;var n=this.documentHelper.selection,r=n.start.paragraph.associatedCell.ownerTable;r=r.combineWidget(this.owner.viewer),n.isEmpty?(this.initHistory(i),this.applyCellPropertyValue(n,e,t,n.start.paragraph.associatedCell.cellFormat),r.calculateGrid(),this.selection.owner.isLayoutEnabled=!0,this.documentHelper.layout.reLayoutTable(r)):this.updateSelectionTableFormat(this.selection,i,t),this.reLayout(n,!1)}},e.prototype.getTableCellAction=function(e){switch(e){case"verticalAlignment":return"CellContentVerticalAlignment";case"leftMargin":return"CellLeftMargin";case"rightMargin":return"CellRightMargin";case"bottomMargin":return"CellBottomMargin";case"topMargin":return"CellTopMargin";case"preferredWidth":return"CellPreferredWidth";case"shading":return"Shading";default:return"CellPreferredWidthType"}},e.prototype.applyPropertyValueForSection=function(e,i,n,r){if(r&&this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)&&(n=this.editorHistory.currentBaseHistoryInfo.addModifiedPropertiesForSection(e,i,n)),!t.isNullOrUndefined(n))return n instanceof b?void(t.isNullOrUndefined(i)&&e.copyFormat(n,this.editorHistory)):void("pageHeight"===i?e.pageHeight=n:"pageWidth"===i?e.pageWidth=n:"leftMargin"===i?e.leftMargin=n:"rightMargin"===i?e.rightMargin=n:"topMargin"===i?e.topMargin=n:"bottomMargin"===i?e.bottomMargin=n:"differentFirstPage"===i?e.differentFirstPage=n:"differentOddAndEvenPages"===i?e.differentOddAndEvenPages=n:"headerDistance"===i?e.headerDistance=n:"footerDistance"===i?e.footerDistance=n:"pageStartingNumber"===i?e.pageStartingNumber=n:"restartPageNumbering"===i?e.restartPageNumbering=n:"endnoteNumberFormat"===i?e.endnoteNumberFormat=n:"footNoteNumberFormat"===i?e.footNoteNumberFormat=n:"restartIndexForEndnotes"===i?e.restartIndexForEndnotes=n:"restartIndexForFootnotes"===i?e.restartIndexForFootnotes=n:"initialFootNoteNumber"===i?e.initialFootNoteNumber=n:"initialEndNoteNumber"===i&&(e.initialEndNoteNumber=n))},e.prototype.layoutWholeDocument=function(){this.documentHelper.layout.isLayoutWhole=!0;var e=this.documentHelper.selection.start,t=this.documentHelper.selection.end;e.isExistAfter(t)&&(e=this.documentHelper.selection.end,t=this.documentHelper.selection.start);var i=this.selection.getParagraphInfo(e),n=this.selection.getParagraphInfo(t),r=this.selection.getHierarchicalIndex(i.paragraph,i.offset.toString()),o=this.selection.getHierarchicalIndex(n.paragraph,n.offset.toString());this.documentHelper.renderedLists.clear(),this.documentHelper.renderedLevelOverrides=[];var s=this.combineSection();this.documentHelper.clearContent(),this.documentHelper.layout.layoutItems(s,!0),this.documentHelper.owner.isShiftingEnabled=!1,this.setPositionForCurrentIndex(e,r),this.setPositionForCurrentIndex(t,o),this.documentHelper.selection.selectPosition(e,t),this.reLayout(this.documentHelper.selection),this.documentHelper.layout.isLayoutWhole=!1},e.prototype.combineSection=function(){var e=[],t=this.documentHelper.pages[0].bodyWidgets[0];do{t=this.combineSectionChild(t,e)}while(t);return e},e.prototype.combineSectionChild=function(e,t){var i=e,n=new pe;n.sectionFormat=e.sectionFormat,n.index=i.index;do{i=e,e.lastChild&&e.lastChild.combineWidget(this.owner.viewer),e=e.nextRenderedWidget;for(var r=0;r<i.childWidgets.length;r++){var o=i.childWidgets[r];o instanceof ve?this.documentHelper.layout.clearTableWidget(o,!0,!0,!0):(o.x=0,o.y=0,o.width=0,o.height=0),n.childWidgets.push(o),i.childWidgets.splice(r,1),r--,o.containerWidget=n}i.page.destroy()}while(e&&i.equals(e));return t.push(n),e},e.prototype.updateSelectionTableFormat=function(e,t,i){switch(t){case"TableAlignment":this.editorHistory.initializeHistory("TableAlignment"),this.updateTableFormat(e,"tableAlignment",i);break;case"TableLeftIndent":this.editorHistory.initializeHistory("TableLeftIndent"),this.updateTableFormat(e,"leftIndent",i);break;case"DefaultCellSpacing":this.editorHistory.initializeHistory("DefaultCellSpacing"),this.updateTableFormat(e,"cellSpacing",i);break;case"DefaultCellLeftMargin":this.editorHistory.initializeHistory("DefaultCellLeftMargin"),this.updateTableFormat(e,"leftMargin",i);break;case"DefaultCellRightMargin":this.editorHistory.initializeHistory("DefaultCellRightMargin"),this.updateTableFormat(e,"rightMargin",i);break;case"DefaultCellTopMargin":this.editorHistory.initializeHistory("DefaultCellTopMargin"),this.updateTableFormat(e,"topMargin",i);break;case"TablePreferredWidth":this.editorHistory.initializeHistory("TablePreferredWidth"),this.updateTableFormat(e,"preferredWidth",i);break;case"TablePreferredWidthType":this.editorHistory.initializeHistory("TablePreferredWidthType"),this.updateTableFormat(e,"preferredWidthType",i);break;case"DefaultCellBottomMargin":this.editorHistory.initializeHistory("DefaultCellBottomMargin"),this.updateTableFormat(e,"bottomMargin",i);break;case"CellContentVerticalAlignment":this.editorHistory.initializeHistory("CellContentVerticalAlignment"),this.updateCellFormat(e,"verticalAlignment",i);break;case"CellLeftMargin":this.editorHistory.initializeHistory("CellLeftMargin"),this.updateCellFormat(e,"leftMargin",i);break;case"CellRightMargin":this.editorHistory.initializeHistory("CellRightMargin"),this.updateCellFormat(e,"rightMargin",i);break;case"CellTopMargin":this.editorHistory.initializeHistory("CellTopMargin"),this.updateCellFormat(e,"topMargin",i);break;case"CellBottomMargin":this.editorHistory.initializeHistory("CellBottomMargin"),this.updateCellFormat(e,"bottomMargin",i);break;case"CellPreferredWidth":this.editorHistory.initializeHistory("CellPreferredWidth"),this.updateCellFormat(e,"preferredWidth",i);break;case"CellPreferredWidthType":this.editorHistory.initializeHistory("CellPreferredWidthType"),this.updateCellFormat(e,"preferredWidthType",i);break;case"Shading":this.editorHistory.initializeHistory("Shading"),this.updateCellFormat(e,"shading",i);break;case"RowHeight":this.editorHistory.initializeHistory("RowHeight"),this.updateRowFormat(e,"height",i);break;case"RowHeightType":this.editorHistory.initializeHistory("RowHeightType"),this.updateRowFormat(e,"heightType",i);break;case"RowHeader":this.editorHistory.initializeHistory("RowHeader"),this.updateRowFormat(e,"isHeader",i);break;case"AllowBreakAcrossPages":this.editorHistory.initializeHistory("AllowBreakAcrossPages"),this.updateRowFormat(e,"allowBreakAcrossPages",i);break;case"TableBidi":this.editorHistory.initializeHistory(t),this.updateTableFormat(e,"bidi",i)}},e.prototype.updateTableFormat=function(e,t,i){var n=e.start;e.end;e.isForward||(n=e.end,e.start),this.initHistoryPosition(e,n),this.applyTablePropertyValue(e,t,i,n.paragraph.associatedCell.ownerTable),this.editorHistory&&(this.editorHistory.isUndoing||this.editorHistory.isRedoing)&&this.documentHelper.layout.reLayoutTable(n.paragraph.associatedCell.ownerTable)},e.prototype.updateCellFormat=function(e,t,i){e.owner.isShiftingEnabled=!0;var n=e.start;e.end;e.isForward||(n=e.end,e.start),this.initHistoryPosition(e,n),this.updateFormatForCell(e,t,i)},e.prototype.updateRowFormat=function(e,t,i){var n=e.start,r=e.end;e.isForward||(n=e.end,r=e.start),this.initHistoryPosition(e,n),this.applyRowFormat(n.paragraph.associatedCell.ownerRow,n,r,t,i)},e.prototype.initHistoryPosition=function(e,i){this.documentHelper.owner.editorHistoryModule&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)&&(t.isNullOrUndefined(i)?t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo.insertPosition)&&(this.editorHistory.currentBaseHistoryInfo.insertPosition=e.start.getHierarchicalIndexInternal()):t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo.insertPosition)&&(this.editorHistory.currentBaseHistoryInfo.insertPosition=i.getHierarchicalIndexInternal()))},e.prototype.startSelectionReLayouting=function(e,t,i,n){if(t.owner.isLayoutEnabled=!0,i.paragraph.isInsideTable){for(var r=i.paragraph.associatedCell.ownerTable;r.isInsideTable;)r=r.associatedCell.ownerTable;this.reLayoutSelectionOfTable(r,t,i,n)}else this.reLayoutSelection(e,t,i,n)},e.prototype.reLayoutSelectionOfTable=function(e,i,n,r){var o=!1;if(this.documentHelper.layout.layoutBodyWidgetCollection(e.index,e.containerWidget,e,!1),!t.isNullOrUndefined(r.paragraph.associatedCell)&&e.contains(r.paragraph.associatedCell))return!0;var s=i.getNextRenderedBlock(e);return t.isNullOrUndefined(s)||(o=this.reLayoutSelectionOfBlock(s,i,n,r)),o},e.prototype.reLayoutSelection=function(e,i,n,r){if(n.paragraph===e){n.offset,i.getParagraphLength(e);var o=0,s=0,a=e.getInline(n.offset,o),l=a.element;o=a.index,t.isNullOrUndefined(l)||(o!==l.length||t.isNullOrUndefined(l.nextNode)||(l=l.nextNode),s=l.line.children.indexOf(l));var d=0;n.currentWidget.paragraph===e&&(d=e.childWidgets.indexOf(n.currentWidget),s=n.currentWidget.children.indexOf(l)),l instanceof Ie&&!l.line&&s>0?this.documentHelper.layout.reLayoutParagraph(e,d,s-1):this.documentHelper.layout.reLayoutParagraph(e,d,s)}else this.documentHelper.layout.reLayoutParagraph(e,0,0);if(r.paragraph===e)return!0;var h=i.getNextRenderedBlock(e);return!t.isNullOrUndefined(h)&&this.reLayoutSelectionOfBlock(h,i,n,r)},e.prototype.reLayoutSelectionOfBlock=function(e,t,i,n){return e instanceof fe?this.reLayoutSelection(e,t,i,n):void 0},e.prototype.layoutItemBlock=function(e,i){var n=void 0;if(e.containerWidget instanceof ce){(n=e.containerWidget).childWidgets.indexOf(e);!t.isNullOrUndefined(this.documentHelper.owner)&&this.documentHelper.owner.isLayoutEnabled&&this.documentHelper.layout.layoutBodyWidgetCollection(e.index,n,e,!1)}else if(e.containerWidget instanceof be){var r=e.containerWidget;r=this.documentHelper.selection.getContainerCell(r),!t.isNullOrUndefined(this.documentHelper.owner)&&this.documentHelper.owner.isLayoutEnabled&&this.documentHelper.layout.reLayoutTable(e)}},e.prototype.removeSelectedContents=function(e){return this.removeSelectedContentInternal(e,e.start,e.end)},e.prototype.removeSelectedContentInternal=function(e,t,i){var n=t,r=i;if(t.isExistBefore(i)||(n=i,r=t),n.paragraph===r.paragraph&&n.paragraph.childWidgets.indexOf(n.currentWidget)===n.paragraph.childWidgets.length-1&&n.offset===e.getParagraphLength(n.paragraph)&&n.offset+1===r.offset)return e.owner.isShiftingEnabled=!0,e.selectContent(n,!0),!0;var o=this.selection.getParagraphInfo(n);e.editPosition=this.selection.getHierarchicalIndex(o.paragraph,o.offset.toString());var s=this.removeSelectedContent(r.paragraph,e,n,r),a=new Nt(e.owner);return this.setPositionForCurrentIndex(a,e.editPosition),e.selectContent(a,!0),s},e.prototype.removeSelectedContent=function(e,t,i,n){return!(n.paragraph.isInsideTable&&n.paragraph!==t.getLastParagraphInLastCell(n.paragraph.associatedCell.ownerTable)&&(!i.paragraph.isInsideTable||i.paragraph.associatedCell.ownerTable.index!==n.paragraph.associatedCell.ownerTable.index))&&(t.owner.isShiftingEnabled=!0,this.deleteSelectedContent(e,t,i,n,2),!0)},e.prototype.deleteSelectedContent=function(e,t,i,n,r){var o=0,s=i.currentWidget.getInline(i.offset,o);s.element;if(o=s.index,o=0,s=n.currentWidget.getInline(n.offset,o),s.element,o=s.index,n.paragraph!==e)return void this.deleteSelectedContent(n.paragraph,t,i,n,r);if(!n.paragraph.isInsideTable||i.paragraph.isInsideTable&&i.paragraph.associatedCell===n.paragraph.associatedCell&&!t.isCellSelected(n.paragraph.associatedCell,i,n)){if(this.deletePara(e,i,n,r),this.delBlockContinue&&this.delBlock){if(this.delSection){var a=e.bodyWidget instanceof pe?e.bodyWidget:void 0;this.deleteSection(t,this.delSection,a,r),this.delSection=void 0}this.deleteBlock(this.delBlock,t,i,n,r),this.delBlockContinue=!1,this.delBlock=void 0}}else n.paragraph.associatedCell.ownerTable.combineWidget(this.owner.viewer),this.deleteTableCell(n.paragraph.associatedCell,t,i,n,r)},e.prototype.mergeCells=function(){!this.owner.isReadOnlyMode&&this.canEditContentControl&&this.owner.isDocumentLoaded&&(t.isNullOrUndefined(this.documentHelper)||this.selection.isEmpty||this.mergeSelectedCellsInTable())},e.prototype.deleteTable=function(){if(!this.owner.isReadOnlyMode&&this.canEditContentControl){var e=this.selection.isForward?this.selection.start:this.selection.end;if(e.paragraph.isInsideTable){var i=this.getOwnerTable(this.selection.isForward).combineWidget(this.owner.viewer);this.selection.owner.isShiftingEnabled=!0,this.checkIsNotRedoing()&&(this.initHistory("DeleteTable"),this.updateHistoryPosition(e,!0));var n=this.getParagraphForSelection(i);if(this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&this.editorHistory.currentBaseHistoryInfo.removedNodes.push(i.clone()),this.owner.enableTrackChanges)for(var r=0;r<i.childWidgets.length;r++){if(0===r){var o=i.childWidgets[0];n=this.selection.getFirstParagraph(o)}this.trackRowDeletion(i.childWidgets[r])}else this.removeBlock(i);this.selection.selectParagraphInternal(n,!0),(this.checkIsNotRedoing()||t.isNullOrUndefined(this.editorHistory))&&this.reLayout(this.selection)}}},e.prototype.deleteColumn=function(){if(!this.owner.isReadOnlyMode&&this.canEditContentControl)if(this.owner.enableTrackChanges){var e=new t.L10n("documenteditor",this.owner.defaultLocale);e.setLocale(this.owner.locale),this.alertDialog=n.DialogUtility.alert({title:e.getConstant("UnTrack"),content:e.getConstant("Merge Track"),showCloseIcon:!0,okButton:{text:"Ok",click:this.onDeleteColumnConfirmed.bind(this)},closeOnEscape:!0,position:{X:"center",Y:"center"},animationSettings:{effect:"Zoom"}})}else this.onDeleteColumnConfirmed()},e.prototype.onDeleteColumnConfirmed=function(){var e=this.selection.isForward?this.selection.start:this.selection.end;this.selection.isForward?this.selection.end:this.selection.start;if(e.paragraph.isInsideTable){this.selection.owner.isShiftingEnabled=!0,this.checkIsNotRedoing()&&this.initHistory("DeleteColumn");var i=this.getOwnerCell(this.selection.isForward),n=this.getOwnerCell(!this.selection.isForward),r=i.ownerTable.combineWidget(this.owner.viewer);this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&this.cloneTableToHistoryInfo(r);var o=void 0;if(n.nextWidget){var s=n.nextWidget;o=this.selection.getFirstParagraph(s)}else if(i.previousWidget){var a=i.previousWidget;o=this.selection.getFirstParagraph(a)}t.isNullOrUndefined(o)&&(o=this.getParagraphForSelection(r));for(var l=r.getColumnCellsForSelection(i,n),d=0;d<r.childWidgets.length;d++){var h=r.childWidgets[d];if(1===h.childWidgets.length)l.indexOf(h.childWidgets[0])>=0&&(r.childWidgets.splice(r.childWidgets.indexOf(h),1),h.destroy(),d--);else{for(var c=0;c<h.childWidgets.length;c++){var p=h.childWidgets[c];l.indexOf(p)>=0&&(h.childWidgets.splice(c,1),p.destroy(),c--)}0===h.childWidgets.length&&(r.childWidgets.splice(r.childWidgets.indexOf(h),1),h.destroy(),d--)}}0===r.childWidgets.length?(o=this.getParagraphForSelection(r),this.removeBlock(r),this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&(this.editorHistory.currentBaseHistoryInfo.action="DeleteTable"),r.destroy()):(r.isGridUpdated=!1,r.buildTableColumns(),r.isGridUpdated=!0,this.documentHelper.layout.reLayoutTable(r)),this.selection.selectParagraphInternal(o,!0),(t.isNullOrUndefined(this.editorHistory)||this.checkIsNotRedoing())&&this.reLayout(this.selection,!0),t.isNullOrUndefined(this.alertDialog)||(this.alertDialog.close(),this.alertDialog=void 0)}},e.prototype.deleteRow=function(){if(!this.owner.isReadOnlyMode&&this.canEditContentControl){var e=this.selection.isForward?this.selection.start:this.selection.end,i=(this.selection.isForward?this.selection.end:this.selection.start,this.selection.getParagraphInfo(e)),n=this.selection.getHierarchicalIndex(i.paragraph,i.offset.toString());if(e.paragraph.isInsideTable){var r=this.getOwnerCell(this.selection.isForward),o=this.getOwnerCell(!this.selection.isForward);this.checkIsNotRedoing()&&this.initHistory("DeleteRow"),this.selection.owner.isShiftingEnabled=!0;var s=r.ownerTable.combineWidget(this.owner.viewer),a=this.getOwnerRow(!0);this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&this.cloneTableToHistoryInfo(s);var l=void 0;if(a.nextWidget){c=a.nextWidget.childWidgets[0];l=this.selection.getFirstParagraph(c)}if(t.isNullOrUndefined(l)&&(l=this.getParagraphForSelection(s)),e=e.clone(),this.selection.isEmpty)this.owner.enableTrackChanges?this.trackRowDeletion(a,!0,!1):this.removeRow(a);else{var d=this.selection.getContainerCellOf(r,o);if(d.ownerTable.contains(o))if(r=this.selection.getSelectedCell(r,d),o=this.selection.getSelectedCell(o,d),this.selection.containsCell(d,o))a=r.ownerRow,this.removeRow(a);else{a=r.ownerRow;var h=o.ownerRow;if(l=void 0,h.nextWidget){var c=h.nextWidget.childWidgets[0];l=this.selection.getFirstParagraph(c)}t.isNullOrUndefined(l)&&(l=this.getParagraphForSelection(s));for(var p=0;p<s.childWidgets.length;p++){var u=s.childWidgets[p];u.rowIndex>=a.rowIndex&&u.rowIndex<=h.rowIndex&&(this.owner.enableTrackChanges&&this.checkIsNotRedoing()?this.trackRowDeletion(u,!0,!1):(s.childWidgets.splice(p,1),u.destroy(),p--))}0===s.childWidgets.length?(this.removeBlock(s),this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&(this.editorHistory.currentBaseHistoryInfo.action="DeleteTable"),s.destroy()):this.updateTable(s)}}if(!this.owner.enableTrackChanges||t.isNullOrUndefined(s.childWidgets))this.selection.selectParagraphInternal(l,!0);else{var g=this.selection.getTextPosBasedOnLogicalIndex(n);this.selection.selectContent(g,!0)}(t.isNullOrUndefined(this.editorHistory)||this.checkIsNotRedoing())&&this.reLayout(this.selection,!0)}}},e.prototype.trackRowDeletion=function(e,i,n){var r=e.rowFormat;if(!t.isNullOrUndefined(r)){if(r.revisions.length>0){var o=this.retrieveRevisionInOder(r);if("Insertion"===o.revisionType){if(this.isRevisionMatched(r,void 0))return t.isNullOrUndefined(i)||i?this.removeRow(e):this.removeRevisionsInRow(e),!0}else"Deletion"===o.revisionType&&this.unlinkWholeRangeInRevision(r,o)}(t.isNullOrUndefined(n)||n)&&this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&(this.editorHistory.currentBaseHistoryInfo.action="RemoveRowTrack"),this.insertRevision(r,"Deletion");for(var s=0;s<e.childWidgets.length;s++)for(var a=e.childWidgets[s],l=0;l<a.childWidgets.length;l++)if(a.childWidgets[l]instanceof ve)this.trackInnerTable(a.childWidgets[s],i,n);else{var d=a.childWidgets[l];this.skipTableElements=!0,this.insertRevisionForBlock(d,"Deletion"),this.skipTableElements=!1}}return!1},e.prototype.trackInnerTable=function(e,t,i){for(var n=0;n<e.childWidgets.length;n++)this.trackRowDeletion(e.childWidgets[n],t,i)},e.prototype.returnDeleteRevision=function(e){for(var t=0;t<e.length;t++)if("Deletion"===e[t].revisionType)return e[t]},e.prototype.removeRow=function(e){var t=e.ownerTable;e.rowFormat.revisions.length>0&&this.removeRevisionsInRow(e),1===t.childWidgets.length?(this.removeBlock(t),this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&(this.editorHistory.currentBaseHistoryInfo.action="Delete"),t.destroy()):(t.childWidgets.splice(t.childWidgets.indexOf(e),1),e.destroy(),this.updateTable(t))},e.prototype.updateTable=function(e){e.updateRowIndex(0),e.isGridUpdated=!1,e.buildTableColumns(),e.isGridUpdated=!0,this.documentHelper.layout.reLayoutTable(e)},e.prototype.getParagraphForSelection=function(e){var t=void 0,i=e.nextWidget?e.nextWidget:e.nextRenderedWidget,n=e.previousWidget?e.previousWidget:e.previousRenderedWidget;return i?t=i instanceof fe?i:this.selection.getFirstParagraphInFirstCell(i):n&&(t=n instanceof fe?n:this.selection.getLastParagraphInLastCell(n)),t},e.prototype.deletePara=function(e,i,n,r){e=e.combineWidget(this.owner.viewer);var o=this.documentHelper.selection,s=o.getStartOffset(e),a=o.getStartOffset(n.paragraph),l=s,d=0,h=!1,c=this.selection.getLineLength(e.lastChild),p=e,u=e.bodyWidget instanceof pe?e.bodyWidget:void 0,g=void 0,m=void 0;e===i.paragraph?(l=i.offset,g=i.currentWidget,n.paragraph.isInsideTable&&(h=this.isEndInAdjacentTable(e,n.paragraph))):g=e.firstChild,e!==i.paragraph&&o.isSkipLayouting&&(o.isSkipLayouting=!1),e===n.paragraph?(m=n.currentWidget,d=n.offset):(m=e.lastChild,d=this.documentHelper.selection.getLineLength(e.lastChild));var f=e.previousRenderedWidget?e.previousRenderedWidget.combineWidget(this.documentHelper.viewer):void 0;(l>s&&i.currentWidget===e.lastChild&&l===c&&(e===n.paragraph&&n.offset===l+1||e.nextRenderedWidget===n.paragraph&&n.offset===a)||this.editorHistory&&this.editorHistory.isUndoing&&this.editorHistory.currentHistoryInfo&&"PageBreak"===this.editorHistory.currentHistoryInfo.action&&f&&f.isPageBreak()&&(0===l&&!i.currentWidget.isFirstLine||l>0))&&(h=!0);var v=n.clone();v.offset=v.offset-1;var y=i.paragraph===e&&i.isAtParagraphStart&&v.isAtParagraphEnd&&this.editorHistory&&"Insert"===this.editorHistory.currentBaseHistoryInfo.action;if(y&&(this.editorHistory.currentBaseHistoryInfo.action="InsertTextParaReplace"),n.paragraph===e&&n.currentWidget!==e.lastChild||n.currentWidget===e.lastChild&&n.offset<=o.getLineLength(e.lastChild)||y){var b=i.paragraph===e;if((n.currentWidget.isFirstLine()&&n.offset>s||!n.currentWidget.isFirstLine()||y)&&this.removeInlines(e,g,l,m,d,r),t.isNullOrUndefined(f)||b||y)this.delBlockContinue=!1,this.delBlock=void 0;else{this.delBlockContinue=!0,this.delBlock=f;var w=f.bodyWidget instanceof pe?f.bodyWidget:void 0;w&&!u.equals(w)&&u.index!==w.index?this.delSection=w:this.delSection=void 0}}else{if(i.paragraph===e&&(i.currentWidget!==e.firstChild||i.currentWidget===e.firstChild&&l>s))return this.delBlockContinue=!1,this.delBlock=void 0,4===r?void 0:void(this.skipTracking()&&"ParaMarkTrack"===this.editorHistory.currentBaseHistoryInfo.action?(this.addRemovedNodes(e.characterFormat.cloneFormat()),e.characterFormat.revisions.length>0&&this.unlinkRangeFromRevision(e.characterFormat,!0),e.characterFormat.revisions=[]):this.owner.enableTrackChanges&&!this.skipTracking()&&"TOC"!==this.editorHistory.currentBaseHistoryInfo.action&&"Reject Change"!==this.editorHistory.currentBaseHistoryInfo.action?h?(p=this.splitParagraph(e,e.firstChild,0,g,l,!0),this.deleteParagraphMark(p,o,r,!0),this.addRemovedNodes(e)):this.removeInlines(e,g,l,m,d,r):(p=this.splitParagraph(e,e.firstChild,0,g,l,!0),this.insertParagraphPaste(e,p,i,n,h,r),this.removeRevisionForBlock(e,void 0,!1,!0),this.addRemovedNodes(e)));var C=void 0,x=e.previousWidget,F=x instanceof fe?x:void 0,P=e.nextRenderedWidget;if(r<4){if(this.owner.enableTrackChanges&&!this.skipTracking()&&this.editorHistory.currentBaseHistoryInfo&&"TOC"!==this.editorHistory.currentBaseHistoryInfo.action){if(this.insertRevisionForBlock(e,"Deletion"),!e.isEmpty()||n.paragraph.previousRenderedWidget instanceof ve?this.combineRevisionWithBlocks(e.firstChild.children[0]):(C=this.checkAndInsertBlock(e,i,n,r,F),this.removeBlock(e)),e===n.paragraph&&"Delete"===this.editorHistory.currentBaseHistoryInfo.action){var T=this.selection.getParagraphInfo(n);this.selection.editPosition=this.selection.getHierarchicalIndex(T.paragraph,T.offset.toString())}if(i.paragraph!==e&&!t.isNullOrUndefined(f))return this.delBlockContinue=!0,void(this.delBlock=f)}else C=this.checkAndInsertBlock(e,i,n,r,F),this.removeRevisionForBlock(e,void 0,!1,!0),this.addRemovedNodes(e),this.removeBlock(e);if(this.documentHelper.blockToShift===e&&(this.documentHelper.blockToShift=void 0),t.isNullOrUndefined(C)){if(e===i.paragraph&&t.isNullOrUndefined(P)&&!t.isNullOrUndefined(F)){S=this.selection.getParagraphLength(F);o.editPosition=this.selection.getHierarchicalIndex(F,S.toString()),this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)&&(this.updateHistoryPosition(o.editPosition,!0),this.editorHistory.currentBaseHistoryInfo.endPosition=o.editPosition)}}else{o.editPosition=this.selection.getHierarchicalIndex(C,"0");var S=o.getParagraphLength(C)+1;this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)&&(this.editorHistory.currentBaseHistoryInfo.endPosition=this.selection.getHierarchicalIndex(C,S.toString()))}}i.paragraph===e||t.isNullOrUndefined(f)?(this.delBlockContinue=!1,this.delBlock=void 0):(this.delBlockContinue=!0,this.delBlock=f)}this.insertParagraphPaste(e,p,i,n,h,r)},e.prototype.deleteSection=function(e,t,i,n){n<4&&this.combineSectionInternal(e,t,i),n>2&&t.sectionFormat.copyFormat(i.sectionFormat)},e.prototype.combineSectionInternal=function(e,t,i){var n=t.getSplitWidgets()[0],r=[];this.combineSectionChild(n,r);var o=(n=r[0]).lastChild.index;this.updateBlockIndex(o+1,i.firstChild);for(var s=0,a=i,l=0;l<n.childWidgets.length;l++){var d=n.childWidgets.splice(l,1)[0];a.childWidgets.splice(s,0,d),d.containerWidget=a,this.documentHelper.layout.layoutBodyWidgetCollection(d.index,d.bodyWidget,d,!1),a=(d=d.getSplitWidgets().pop()).containerWidget,s=d.indexInOwner+1,l--}this.updateSectionIndex(void 0,i,!1),this.addRemovedNodes(n)},e.prototype.checkAndInsertBlock=function(e,i,n,r,o){if(e instanceof fe&&e===i.paragraph||e instanceof ve){var s=void 0;return t.isNullOrUndefined(e.nextWidget)&&(t.isNullOrUndefined(o)||o.nextRenderedWidget instanceof ve)&&(s=new fe,1===r&&e instanceof fe&&(s.characterFormat.copyFormat(e.characterFormat),s.paragraphFormat.copyFormat(e.paragraphFormat)),s.index=e.index+1,s.containerWidget=e.containerWidget,e instanceof fe&&(s.paragraphFormat.lineSpacing=e.paragraphFormat.lineSpacing,s.paragraphFormat.lineSpacingType=e.paragraphFormat.lineSpacingType),this.documentHelper.layout.layoutBodyWidgetCollection(s.index,s.bodyWidget,s,!1),e.containerWidget instanceof he&&e.containerWidget.childWidgets.push(s)),s}},e.prototype.splitParagraph=function(e,t,i,n,r,o){var s=new fe;s.paragraphFormat=new P(s),s.characterFormat=new H(s),s.paragraphFormat.copyFormat(e.paragraphFormat),s.characterFormat.copyFormat(e.characterFormat);var a=new we(s);s.childWidgets.push(a);var l=e.index,d=e.indexInOwner;return this.moveInlines(e,s,0,i,t,r,n),e.containerWidget.childWidgets.splice(d,0,s),s.index=l,s.containerWidget=e.containerWidget,this.updateNextBlocksIndex(s,!0),o&&this.removeBlock(e),this.documentHelper.layout.layoutBodyWidgetCollection(l,s.containerWidget,s,!1),s},e.prototype.removeBlock=function(e,t){var i,n;if(this.removeFieldInBlock(e),this.removeFieldInBlock(e,!0),this.removeFieldInBlock(e,void 0,!0),e.isInsideTable)n=e.associatedCell,i=e.associatedCell.childWidgets.indexOf(e),e.associatedCell.childWidgets,this.updateNextBlocksIndex(e,!1),e.associatedCell.childWidgets.splice(i,1),e.containerWidget=void 0,this.documentHelper.layout.layoutBodyWidgetCollection(e.index,n,e,!1);else{n=e.containerWidget;for(var r=0;r<e.childWidgets.length;r++){var o=void 0;if(this.isPasteRevertAction()||(o=this.skipTracking()),e.childWidgets[r]instanceof ye&&!o){var s=e.childWidgets[r];this.removeDeletedCellRevision(s)}}i=n.childWidgets.indexOf(e),n.childWidgets,this.updateNextBlocksIndex(e,!1),n.childWidgets.splice(i,1),e.containerWidget=void 0,n.height-=e.height,this.documentHelper.layout.layoutBodyWidgetCollection(e.index,n,e,!1,t)}},e.prototype.isPasteRevertAction=function(){return!(t.isNullOrUndefined(this.editorHistory)||!this.editorHistory.currentBaseHistoryInfo||"Paste"!==this.editorHistory.currentBaseHistoryInfo.action)},e.prototype.toCheckForTrack=function(e){if(this.owner.enableTrackChanges&&!this.skipTracking()&&e instanceof ve&&e.childWidgets.length>0){var t=e.childWidgets[0].rowFormat;if(t.revisions.length>0&&"Insertion"!==t.revisions[0].revisionType&&t.revisions[0].author===(""===this.owner.currentUser?"Guest user":this.owner.currentUser)||0===t.revisions.length)return!0}return!1},e.prototype.removeFootnote=function(e,t){if(e.paragraph.bodyWidget.page.footnoteWidget){for(var i=e.paragraph.bodyWidget.page.footnoteWidget,n=0;n<i.childWidgets.length;n++)e===i.childWidgets[n].footNoteReference&&(i.height-=i.childWidgets[n].height,i.childWidgets.splice(n,1),n--);1===i.childWidgets.length&&(e.paragraph.bodyWidget.page.footnoteWidget=void 0)}this.documentHelper.footnoteCollection.splice(this.documentHelper.footnoteCollection.indexOf(e),1)},e.prototype.removeEndnote=function(e,t){if(e.paragraph.bodyWidget.page.endnoteWidget){for(var i=e.paragraph.bodyWidget.page.endnoteWidget,n=0;n<i.childWidgets.length;n++)e===i.childWidgets[n].footNoteReference&&(i.height-=i.childWidgets[n].height,i.childWidgets.splice(n,1),n--);1===i.childWidgets.length&&(e.paragraph.bodyWidget.page.endnoteWidget=void 0)}this.documentHelper.endnoteCollection.splice(this.documentHelper.endnoteCollection.indexOf(e),1)},e.prototype.removeAutoShape=function(e){var t=e.line.paragraph.floatingElements.indexOf(e);e.line.paragraph.bodyWidget.floatingElements.splice(e.line.paragraph.bodyWidget.floatingElements.indexOf(e),1),e.line.paragraph.floatingElements.splice(t,1)},e.prototype.removeField=function(e,t,i){var n=this.documentHelper.fields;if(t?n=this.documentHelper.bookmarks.keys:i&&(n=this.documentHelper.contentControlCollection),e.floatingElements.length>0)for(var r=0;r<e.floatingElements.length;r++){var o=e.floatingElements[r];this.removeAutoShape(o)}for(l=0;l<n.length;l++)(d=t?this.documentHelper.bookmarks.get(n[l]):n[l]).line.paragraph===e&&(t?this.documentHelper.bookmarks.remove(n[l]):i?this.documentHelper.contentControlCollection.splice(l,1):(this.documentHelper.fields.splice(l,1),-1!==this.documentHelper.formFields.indexOf(d)&&this.documentHelper.formFields.splice(this.documentHelper.formFields.indexOf(d),1)),l--);if(this.documentHelper.footnoteCollection.length>0)for(l=0;l<this.documentHelper.footnoteCollection.length;l++)if((d=this.documentHelper.footnoteCollection[l]).line.paragraph===e){if(d.paragraph.bodyWidget.page.footnoteWidget){for(var s=d.paragraph.bodyWidget.page.footnoteWidget,a=0;a<s.childWidgets.length;a++)d===s.childWidgets[a].footNoteReference&&(s.height-=s.childWidgets[a].height,s.childWidgets.splice(a,1),a--);1===s.childWidgets.length&&(d.paragraph.bodyWidget.page.footnoteWidget=void 0)}this.documentHelper.footnoteCollection.splice(l,1),l--}if(this.documentHelper.endnoteCollection.length>0)for(var l=0;l<this.documentHelper.endnoteCollection.length;l++){var d=this.documentHelper.endnoteCollection[l];if(d.line.paragraph===e){if(d.paragraph.bodyWidget.page.endnoteWidget){for(var h=d.paragraph.bodyWidget.page.endnoteWidget,a=0;a<h.childWidgets.length;a++)d===h.childWidgets[a].footNoteReference&&(h.height-=h.childWidgets[a].height,h.childWidgets.splice(a,1),a--);1===h.childWidgets.length&&(d.paragraph.bodyWidget.page.endnoteWidget=void 0)}this.documentHelper.endnoteCollection.splice(l,1),l--}}},e.prototype.addRemovedNodes=function(e){e instanceof pt&&0===e.commentType&&e.commentMark&&e.removeCommentMark(),e instanceof Le&&0===e.type&&this.documentHelper.contentControlCollection.splice(this.documentHelper.contentControlCollection.indexOf(e),1),e instanceof xe&&0===e.fieldType&&(-1!==this.documentHelper.fields.indexOf(e)&&this.documentHelper.fields.splice(this.documentHelper.fields.indexOf(e),1),-1!==this.documentHelper.formFields.indexOf(e)&&this.documentHelper.formFields.splice(this.documentHelper.formFields.indexOf(e),1)),this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)?this.editorHistory.currentBaseHistoryInfo.removedNodes.push(e):this.editHyperlinkInternal&&this.nodes.push(e)},e.prototype.deleteBlock=function(e,t,i,n,r){if(e instanceof fe){if(this.deletePara(e,i,n,r),this.delBlockContinue&&this.delBlock){if(this.delSection){var o=e.bodyWidget instanceof pe?e.bodyWidget:void 0;this.deleteSection(t,this.delSection,o,r),this.delSection=void 0}-1!==this.delBlock.indexInOwner&&this.deleteBlock(this.delBlock,t,i,n,r),this.delBlockContinue=!1,this.delBlock=void 0}}else this.deleteTableBlock(e,t,i,n,r)},e.prototype.deleteTableCell=function(e,i,n,r,o){var s=!(n.paragraph.isInsideTable&&e.ownerTable.contains(n.paragraph.associatedCell)),a=e.ownerTable.previousRenderedWidget;if(n.paragraph.isInsideTable){var l=i.getContainerCellOf(e,n.paragraph.associatedCell);if(l.ownerTable.contains(n.paragraph.associatedCell)){var d=i.getSelectedCell(e,l);i.getSelectedCell(n.paragraph.associatedCell,l);if(i.containsCell(l,n.paragraph.associatedCell))if(i.isCellSelected(l,n,r))if(this.updateEditPosition(l,i),1===o)this.deleteCellsInTable(e.ownerRow.ownerTable,i,n,r,o);else{var h=this.deleteCell(l,i,o,!0);!h&&2!==o&&this.editorHistory?this.editorHistory.currentBaseHistoryInfo=void 0:h&&this.documentHelper.layout.reLayoutTable(l.ownerRow.ownerTable)}else if(d===l){if(this.deletePara(r.paragraph,n,r,o),this.delBlockContinue&&this.delBlock){if(this.delSection){var c=r.paragraph,p=c.bodyWidget instanceof pe?c.bodyWidget:void 0;this.deleteSection(i,this.delSection,p,o),this.delSection=void 0}this.deleteBlock(this.delBlock,i,n,r,o),this.delBlockContinue=!1,this.delBlock=void 0}}else this.deleteContainer(d,i,n,r,o);else 2===o?this.deleteCell(e,i,2,!1):this.deleteCellsInTable(l.ownerTable,i,n,r,o)}else this.deleteContainer(l,i,n,r,o)}else{var u=i.getContainerCell(e);this.deleteContainer(u,i,n,r,o)}if(s){a.bodyWidget instanceof pe&&a.bodyWidget;t.isNullOrUndefined(a)||this.deleteBlock(a,i,n,r,o)}},e.prototype.deleteCellsInTable=function(e,i,r,o,s,a){var l="Delete",d=!1,h=r.paragraph.associatedCell,c=o.paragraph.associatedCell;if(t.isNullOrUndefined(a)||(c=a),this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)){if(l=this.editorHistory.currentBaseHistoryInfo.action,d="BackSpace"===this.editorHistory.currentBaseHistoryInfo.action||"DeleteCells"===this.editorHistory.currentBaseHistoryInfo.action||"InsertTable"===this.editorHistory.currentBaseHistoryInfo.action||"RemoveRowTrack"===this.editorHistory.currentBaseHistoryInfo.action||t.isNullOrUndefined(h.ownerRow.previousWidget)&&t.isNullOrUndefined(c.ownerRow.nextWidget)&&"Cut"===this.editorHistory.currentBaseHistoryInfo.action,this.cloneTableToHistoryInfo(e),"RemoveRowTrack"===this.editorHistory.currentBaseHistoryInfo.action)return;this.editorHistory.currentBaseHistoryInfo.action=d?"DeleteCells":"ClearCells",i.owner.isLayoutEnabled=!1}var p=h.columnIndex,u=c.columnIndex+c.cellFormat.columnSpan-1,g=h.rowIndex,m=c.rowIndex,f=this.isWholeRowSelected(h.ownerRow,p,u);if(this.owner.enableTrackChanges&&!this.skipTracking())if(f)this.onConfirmedTableCellsDeletion(e,i,g,m,p,u,d,s,f,l);else{var v=new t.L10n("documenteditor",this.owner.defaultLocale),y=v.getConstant("UnTrack"),b=v.getConstant("Merge Track");v.setLocale(this.owner.locale),this.alertDialog=n.DialogUtility.alert({title:y,content:b,showCloseIcon:!0,okButton:{text:"Ok",click:this.onConfirmedTableCellsDeletion.bind(this,e,i,g,m,p,u,d,s,f,l)},closeOnEscape:!0,position:{X:"center",Y:"center"},animationSettings:{effect:"Zoom"}})}else this.onConfirmedTableCellsDeletion(e,i,g,m,p,u,d,s,f,l)},e.prototype.removeDeletedCellRevision=function(e){e.rowFormat.revisions.length>0&&this.unlinkRangeFromRevision(e.rowFormat,!0);for(var i=0;i<e.childWidgets.length;i++)for(var n=e.childWidgets[i],r=0;r<n.childWidgets.length;r++){var o=n.childWidgets[r];if(!t.isNullOrUndefined(o)&&o instanceof fe){for(var s=0;s<o.childWidgets.length;s++){var a=o.childWidgets[s];if(!t.isNullOrUndefined(a.children))for(var l=0;l<a.children.length;l++){var d=a.children[l];d.revisions.length>0&&this.unlinkRangeFromRevision(d,!0)}}this.unlinkRangeFromRevision(o.characterFormat,!0)}}},e.prototype.onConfirmedTableCellsDeletion=function(e,i,n,r,o,s,a,l,d,h){for(var c=0;c<e.childWidgets.length;c++){var p=e.childWidgets[c],u=!1;p.index>=n&&p.index<=r&&(this.owner.enableTrackChanges&&!this.skipTracking()&&d?(u=this.trackRowDeletion(p,!1))&&this.onConfirmedCellDeletion(p,i,n,r,o,s,a,l):this.onConfirmedCellDeletion(p,i,n,r,o,s,a,l)),u||0!==p.childWidgets.length||(this.updateNextBlocksIndex(e.childWidgets[c],!1),e.childWidgets.splice(c,1),c--,r--)}if(i.owner.isLayoutEnabled=!0,0===e.childWidgets.length?(i.editPosition=this.selection.getHierarchicalIndex(e,"0"),this.setActionInternal(i,h),this.removeBlock(e)):(e.isGridUpdated=!1,e.buildTableColumns(),e.isGridUpdated=!0,this.documentHelper.layout.reLayoutTable(e)),!t.isNullOrUndefined(this.alertDialog)){var g=i.getTextPosBasedOnLogicalIndex(i.editPosition);i.selectContent(g,!0),this.reLayout(i),this.alertDialog.close(),this.alertDialog=void 0}},e.prototype.onConfirmedCellDeletion=function(e,t,i,n,r,o,s,a){var l=!1;this.removeDeletedCellRevision(e);for(var d=0;d<e.childWidgets.length;d++){var h=e.childWidgets[d];if(h.columnIndex>=r&&h.columnIndex<=o)if(l||(this.updateEditPosition(h,t),l=!0),s){var c=e.childWidgets[d];this.updateNextBlocksIndex(c,!1),e.childWidgets.splice(d,1),d--}else a<4&&this.deleteCell(h,t,a,!1)}},e.prototype.removeRevisionForRow=function(e){e.rowFormat.revisions.length>0&&this.skipTracking()&&(this.unlinkRangeFromRevision(e.rowFormat,!0),this.addRemovedRevisionInfo(e.rowFormat,void 0))},e.prototype.removeRevisionsInRow=function(e){if(e.rowFormat.revisions.length>0)for(var t=0;t<e.rowFormat.revisions.length;t++){var i=e.rowFormat.revisions[t];this.unlinkWholeRangeInRevision(e.rowFormat,i)}},e.prototype.removeRevisionForCell=function(e,i){for(var n=0;n<e.childWidgets.length;n++)if(e.childWidgets[n]instanceof fe)for(var r=e.childWidgets[n],o=0;o<r.childWidgets.length;o++)for(var s=r.childWidgets[o],a=0;a<s.children.length;a++){var l=s.children[a];!t.isNullOrUndefined(l)&&l.revisions.length>0&&(this.unlinkRangeFromRevision(l,i),this.addRemovedRevisionInfo(l,void 0))}else e.childWidgets[n]instanceof ve&&this.removeRevisionForInnerTable(e.childWidgets[n])},e.prototype.removeRevisionForInnerTable=function(e){if(e.childWidgets.length>0)for(var i=0;i<e.childWidgets.length;i++){var n=e.childWidgets[i];t.isNullOrUndefined(n)||this.removeRevisionForRow(n)}},e.prototype.removeRevisionForBlock=function(e,i,n,r){if(e.characterFormat.revisions.length>0&&!n&&(r&&this.addRemovedRevisionInfo(e.characterFormat,void 0,!1),t.isNullOrUndefined(i)?this.unlinkRangeFromRevision(e.characterFormat,!0):this.unlinkRangeByRevision(e.characterFormat,i),e.characterFormat.revisions=[]),!t.isNullOrUndefined(e))for(var o=0;o<e.childWidgets.length;o++)for(var s=e.childWidgets[o],a=0;a<s.children.length;a++){var l=s.children[a];!t.isNullOrUndefined(l)&&l.revisions.length>0&&(r&&this.addRemovedRevisionInfo(l,void 0,!1),t.isNullOrUndefined(i)?this.unlinkRangeFromRevision(l,!0):this.unlinkRangeByRevision(l,i),l.revisions=[])}},e.prototype.unlinkRangeByRevision=function(e,t){for(var i=0;i<e.revisions.length;i++){var n=e.revisions[i];if(n.author===t.author&&n.revisionType===t.revisionType){e.revisions.splice(e.revisions.indexOf(t),1);var r=t.range.indexOf(e);t.range.splice(r,1)}}},e.prototype.isWholeRowSelected=function(e,t,i){var n=t+i;return 0===t&&e.childWidgets.length-1===n},e.prototype.deleteCell=function(e,t,i,n){var r=e.childWidgets[0];if(1===e.childWidgets.length&&r instanceof fe&&r.isEmpty())return!1;for(var o=0;o<e.childWidgets.length;o++)if(r=e.childWidgets[o],i<4){if(r instanceof fe&&1===e.childWidgets.length){for(var s=r,a=0;a<s.childWidgets.length;a++){for(var l=s.childWidgets[a],d=0;d<l.children.length;d++){var h=l.children[d];this.unLinkFieldCharacter(h),l.children.splice(d,1),d--,this.checkClearCells(t)&&this.addRemovedNodes(h)}s.childWidgets.length>1&&(s.childWidgets.splice(a,1),a--)}this.checkClearCells(t)&&(t.editPosition=this.selection.getHierarchicalIndex(s,"0"),this.updateHistoryPosition(t.editPosition,!0));break}this.removeBlock(r),o--,this.checkClearCells(t)&&this.addRemovedNodes(r)}return!0},e.prototype.deleteContainer=function(e,t,i,n,r){var o=e.ownerTable;if(t.containsRow(o.lastChild,n.paragraph.associatedCell))this.deleteContent(o,t,r);else if(this.toCheckForTrack(o))for(a=0;a<o.childWidgets.length;a++){var s=o.childWidgets[a];if(this.trackRowDeletion(s),n.paragraph.isInsideTable&&t.containsRow(s,n.paragraph.associatedCell))return void this.documentHelper.layout.reLayoutTable(o)}else for(var a=0;a<o.childWidgets.length;a++){var l=o.childWidgets[a];if(r<4&&(this.updateNextBlocksIndex(l,!1),o.childWidgets.splice(a,1),this.addRemovedNodes(l),a--),n.paragraph.isInsideTable&&t.containsRow(l,n.paragraph.associatedCell))return void this.documentHelper.layout.reLayoutTable(o)}},e.prototype.deleteTableBlock=function(e,i,n,r,o){if(e=e.combineWidget(this.owner.viewer),n.paragraph.isInsideTable&&e.contains(n.paragraph.associatedCell)){var s=e.previousRenderedWidget,a=this.checkAndInsertBlock(e,n,r,o,s instanceof fe?s:void 0);if(i.containsRow(e.firstChild,n.paragraph.associatedCell))this.deleteContent(e,i,o);else if(this.owner.enableTrackChanges){if(t.isNullOrUndefined(r.paragraph.associatedCell)&&!r.paragraph.isInsideTable){var l=r.paragraph.previousRenderedWidget.lastChild.lastChild;this.deleteCellsInTable(e,i,n,r,o,l)}}else{var d=this.splitTable(e,n.paragraph.associatedCell.ownerRow);this.deleteContent(e,i,o),this.documentHelper.layout.layoutBodyWidgetCollection(d.index,d.containerWidget,d,!1)}t.isNullOrUndefined(a)||(i.editPosition=this.selection.getHierarchicalIndex(a,"0"),this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)&&(this.editorHistory.currentBaseHistoryInfo.endPosition=i.editPosition))}else{var h=e.previousRenderedWidget;e.bodyWidget instanceof pe&&e.bodyWidget;if(this.owner.enableTrackChanges)for(var c=0;c<e.childWidgets.length;c++)this.trackRowDeletion(e.childWidgets[c]);else this.deleteContent(e,i,o);t.isNullOrUndefined(h)||this.deleteBlock(h,i,n,r,o)}},e.prototype.splitTable=function(e,t){var i=new ve;i.tableFormat.copyFormat(e.tableFormat),i.index=e.index;for(var n=0;n<e.childWidgets.length;n++){var r=e.childWidgets[n];if(r===t)break;i.childWidgets.push(r),r.containerWidget=i,e.childWidgets.splice(n,1),n--}var o=e.getIndex();return e.containerWidget.childWidgets.splice(o,0,i),i.containerWidget=e.containerWidget,this.updateNextBlocksIndex(i,!0),i},e.prototype.updateEditPosition=function(e,t){var i=t.getFirstParagraphInCell(e);t.editPosition=this.selection.getHierarchicalIndex(i,"0")},e.prototype.deleteContent=function(e,t,i){i<4&&(this.removeBlock(e),this.addRemovedNodes(e))},e.prototype.setActionInternal=function(e,i){this.documentHelper.owner.enableHistoryMode&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)&&(this.editorHistory.currentBaseHistoryInfo.action=i)},e.prototype.checkClearCells=function(e){return this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&"ClearCells"!==this.editorHistory.currentBaseHistoryInfo.action},e.prototype.isEndInAdjacentTable=function(e,t){var i=this.selection.getHierarchicalIndex(e,""),n=this.selection.getHierarchicalIndex(t,""),r=i.split(";"),o=n.split(";");return r.length<o.length},e.prototype.cloneTableToHistoryInfo=function(e){if(this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)){var i=e.clone();return this.editorHistory.currentBaseHistoryInfo.removedNodes.push(i),this.documentHelper.selection.start.paragraph.isInsideTable&&this.documentHelper.selection.start.paragraph.associatedCell.ownerTable===e&&this.updateHistoryPosition(this.selection.getHierarchicalIndex(e,"0"),!0),i}},e.prototype.insertParagraphPaste=function(e,i,n,r,o,s){if(this.editorHistory&&(this.editorHistory.isUndoing||this.editorHistory.isRedoing)&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)&&"Paste"===this.editorHistory.currentBaseHistoryInfo.action){var a=this.selection.getNextParagraphBlock(i);if(a&&n.offset>0&&a===r.paragraph&&e===n.paragraph&&"Paste"===this.editorHistory.currentBaseHistoryInfo.action){var l=0;this.removeBlock(i),this.documentHelper.layout.clearListElementBox(a),this.documentHelper.layout.clearListElementBox(i);for(var d=0;d<i.childWidgets.length;d++){var h=i.childWidgets[d];a.childWidgets.splice(l,0,h),i.childWidgets.splice(d,1),d--,l++,h.paragraph=a}this.documentHelper.layout.reLayoutParagraph(a,0,0),o=!1;var c=this.selection.editPosition.substring(this.selection.editPosition.lastIndexOf(";")+1);this.selection.editPosition=this.selection.getHierarchicalIndex(a,c)}}o&&this.deleteParagraphMark(i,this.selection,s)},e.prototype.removeInlines=function(e,t,i,n,r,o){var s=!1;this.documentHelper.layout.clearListElementBox(e);e.childWidgets.indexOf(t);for(var a=this.selection.start.clone(),l=this.selection.end.clone(),d=this.selection.editPosition,h=e.childWidgets.length-1;h>=0;h--){var c=e.childWidgets[h];if(t===c&&n===c){this.removeContent(c,i,r,o),s=!0;break}if(n===c)s=!0,this.removeContent(c,0,r,o);else{if(t===c){this.removeContent(c,i,this.documentHelper.selection.getLineLength(c),o);break}s&&this.removeContent(c,0,this.documentHelper.selection.getLineLength(c),o)}}if(this.owner.enableTrackChanges&&!this.skipTracking()){if(this.selection.start.setPositionInternal(a),this.selection.end.setPositionInternal(l),this.editorHistory.currentBaseHistoryInfo&&"Delete"===this.editorHistory.currentBaseHistoryInfo.action){a.offset>l.offset&&(l=a);var p=this.selection.getParagraphInfo(l);d=this.selection.getHierarchicalIndex(p.paragraph,p.offset.toString())}this.skipReplace&&(this.editorHistory.currentBaseHistoryInfo.insertPosition=void 0,this.updateInsertPosition()),this.selection.editPosition=d}s&&(this.removeEmptyLine(e),this.documentHelper.layout.reLayoutParagraph(e,0,0))},e.prototype.skipTracking=function(){return!(t.isNullOrUndefined(this.editorHistory)||!this.editorHistory.isUndoing&&!this.editorHistory.isRedoing)||!(t.isNullOrUndefined(this.editorHistory)||!this.editorHistory.currentBaseHistoryInfo||"Reject Change"!==this.editorHistory.currentBaseHistoryInfo.action&&"Accept Change"!==this.editorHistory.currentBaseHistoryInfo.action)},e.prototype.canHandleDeletion=function(){return!(t.isNullOrUndefined(this.editorHistory)||!this.editorHistory.currentBaseHistoryInfo||"DeleteRow"!==this.editorHistory.currentBaseHistoryInfo.action)},e.prototype.removeContent=function(e,i,n,r){for(var o=this.selection.getLineLength(e),s=e.paragraph.paragraphFormat.bidi,a=void 0,l=0,d=void 0,h=s?0:e.children.length-1;s?h<e.children.length:h>=0;s?h++:h--){var c=e.children[h];if(t.isNullOrUndefined(r)||2!==r)for(var p=0;p<e.children.length;p++){var u=e.children[p];if(u instanceof Ie){var g=u.text;g.length+l>i&&!(l>i)&&(a=g[i-l-1],t.isNullOrUndefined(a)&&i-l==0&&(a=d)),g.length+l>n&&(" "===g[n-l]&&0===i||" "===a&&" "===g[n-l])&&(n+=1),d=g[g.length-1]}l+=u.length}if(n<=o-c.length)o-=c.length;else{var m=c.length;o>n&&o-m<n&&(m=n-(o-c.length));var f=0;if(o-c.length<i&&(f=i-(o-c.length)),o>n&&(o-=c.length-m),0===f&&m===c.length){if(this.editorHistory&&(this.editorHistory.isUndoing||this.editorHistory.isRedoing)||c instanceof ke&&this.removedBookmarkElements.push(c),c instanceof ke&&this.documentHelper.bookmarks.containsKey(c.name)&&this.documentHelper.bookmarks.remove(c.name),c instanceof ze&&"Inline"!==c.textWrappingStyle&&this.removeAutoShape(c),this.skipFieldDeleteTracking&&c.revisions.length>0){var v=c;v instanceof xe&&(1!==v.fieldType&&2!==v.fieldType||(v=v.fieldBegin),this.clearFieldElementRevisions(v,c.revisions))}this.canHandleDeletion()||this.owner.enableTrackChanges&&!this.skipTracking()&&!this.skipFieldDeleteTracking?(this.skipTableElements||this.addRemovedNodes(c.clone()),this.handleDeleteTracking(c,i,n,h)):(this.unLinkFieldCharacter(c),this.unlinkRangeFromRevision(c,!0),this.addRemovedRevisionInfo(c,void 0),this.addRemovedNodes(c),e.children.splice(h,1)),s&&(this.isSkipHistory?h--:h++)}else if(c instanceof Ie){var y=this.handleDeleteTracking(c,f,m);t.isNullOrUndefined(y)||this.skipTableElements||(c.revisions.length>0&&this.addRemovedRevisionInfo(c,y),this.addRemovedNodes(y))}if(c instanceof Ee&&("Footnote"===c.footnoteType?this.removeFootnote(c):this.removeEndnote(c)),i>=o-(m-f))break;o-=m-f}}},e.prototype.clearFieldElementRevisions=function(e,t){for(var i=t,n=0;n<i.length;n++)for(var r=i[n],o=0;o<r.range.length;o++)if(r.range[o]===e)for(var s=o;s<r.range.length;s){if(r.range[o]instanceof xe&&1===r.range[o].fieldType&&r.range[o].fieldBegin===e){r.removeRangeRevisionForItem(r.range[o]),0===r.range.length&&this.owner.revisions.remove(r);break}r.removeRangeRevisionForItem(r.range[o])}},e.prototype.addRemovedRevisionInfo=function(e,i,n){for(var r=0;r<e.revisions.length;r++){var o=e.revisions[r].revisionID;t.isNullOrUndefined(i)?e.removedIds.push(o):i.removedIds.push(o)}t.isNullOrUndefined(i)&&(t.isNullOrUndefined(n)||n)&&(e.revisions=[])},e.prototype.removeEmptyLine=function(e){if(e.childWidgets.length>1)for(var t=0;t<e.childWidgets.length;t++)0===e.childWidgets[t].children.length&&e.childWidgets.length>1&&(e.childWidgets.splice(t,1),t--)},e.prototype.cloneListLevel=function(e){var t=new _(void 0);return this.copyListLevel(t,e),t},e.prototype.copyListLevel=function(e,i){t.isNullOrUndefined(i.paragraphFormat)||(e.paragraphFormat=new P(e),e.paragraphFormat.copyFormat(i.paragraphFormat)),t.isNullOrUndefined(i.characterFormat)||(e.characterFormat=new H(e),e.characterFormat.copyFormat(i.characterFormat)),t.isNullOrUndefined(i.followCharacter)||(e.followCharacter=i.followCharacter),t.isNullOrUndefined(i.listLevelPattern)||(e.listLevelPattern=i.listLevelPattern),t.isNullOrUndefined(i.numberFormat)||(e.numberFormat=i.numberFormat),t.isNullOrUndefined(i.restartLevel)||(e.restartLevel=i.restartLevel),t.isNullOrUndefined(i.startAt)||(e.startAt=i.startAt)},e.prototype.cloneLevelOverride=function(e){var i=new w;return t.isNullOrUndefined(e.startAt)||(i.startAt=e.startAt),t.isNullOrUndefined(e.overrideListLevel)||(i.overrideListLevel=e.overrideListLevel),t.isNullOrUndefined(e.levelNumber)||(i.levelNumber=e.levelNumber),i},e.prototype.updateListParagraphs=function(){this.documentHelper.listParagraphs=[];for(var e=0;e<this.documentHelper.pages.length;e++)for(var t=this.documentHelper.pages[e].bodyWidgets[0],i=0;i<t.childWidgets.length;i++)this.updateListParagraphsInBlock(t.childWidgets[i])},e.prototype.updateListParagraphsInBlock=function(e){if(e instanceof fe)t.isNullOrUndefined(e.paragraphFormat)||t.isNullOrUndefined(e.paragraphFormat.listFormat)||t.isNullOrUndefined(e.paragraphFormat.listFormat.listId)||(t.isNullOrUndefined(this.documentHelper.listParagraphs)&&(this.documentHelper.listParagraphs=[]),this.documentHelper.listParagraphs.push(e));else if(e instanceof ve)for(var i=0;i<e.childWidgets.length;i++)for(var n=0;n<e.childWidgets[i].childWidgets.length;n++)for(var r=e.childWidgets[i].childWidgets[n],o=0;o<r.childWidgets.length;o++)this.updateListParagraphsInBlock(r.childWidgets[o])},e.prototype.onApplyList=function(e){var i=this.documentHelper.selection;this.setOffsetValue(this.documentHelper.selection),this.initHistory("ListFormat");var n=new x;t.isNullOrUndefined(e)||(n.listId=e.listId),this.documentHelper.owner.isShiftingEnabled=!0,i.isEmpty?(this.applyParaFormatProperty(i.start.paragraph,"listFormat",n,!1),this.layoutItemBlock(i.start.paragraph,!1)):this.updateSelectionParagraphFormatting("listFormat",n,!1),this.reLayout(i)},e.prototype.applyBulletOrNumbering=function(e,i,n){var r=this.documentHelper.selection,o=r.paragraphFormat.getList(),s=!1,a=r.start;r.isForward||(a=r.end);var l=a.paragraph;if(t.isNullOrUndefined(o)){for(;!t.isNullOrUndefined(l.previousWidget)&&l.previousWidget instanceof fe&&l.previousWidget.isEmpty()&&-1===l.previousWidget.paragraphFormat.listFormat.listId;)l=l.previousWidget;if(l.previousWidget&&l.previousWidget instanceof fe&&-1!==l.previousWidget.paragraphFormat.listFormat.listId&&(l=l.previousWidget,o=this.documentHelper.getListById(l.paragraphFormat.listFormat.listId),s=!0),!s){for(;!t.isNullOrUndefined(l.nextWidget)&&l.nextWidget instanceof fe&&l.nextWidget.isEmpty()&&-1===l.nextWidget.paragraphFormat.listFormat.listId;)l=l.nextWidget;l.nextWidget&&l.nextWidget instanceof fe&&-1!==l.nextWidget.paragraphFormat.listFormat.listId&&(l=l.nextWidget,o=this.documentHelper.getListById(l.paragraphFormat.listFormat.listId),s=!0)}}var d=void 0,h=-1,c=void 0,p=!1;if(-1===l.paragraphFormat.listFormat.listId||t.isNullOrUndefined(l.paragraphFormat.listFormat.listLevel)||(this.listNumberFormat=l.paragraphFormat.listFormat.listLevel.numberFormat,this.listLevelPattern=l.paragraphFormat.listFormat.listLevel.listLevelPattern,this.listLevelNumber=l.paragraphFormat.listFormat.listLevelNumber),!t.isNullOrUndefined(o)){h=l.paragraphFormat.listFormat.listLevelNumber;g=this.documentHelper.getListById(l.paragraphFormat.listFormat.listId);if(d=this.documentHelper.layout.getListLevel(g,h),h>0&&(c=this.documentHelper.layout.getListLevel(g,0),p=!t.isNullOrUndefined(c)&&h>0&&r.start.isInSameParagraph(r.end)),(u=g.abstractList)||(u=this.documentHelper.getAbstractListById(o.abstractListId)),0===u.levels.length&&(d=this.documentHelper.layout.getListLevel(g,l.paragraphFormat.listFormat.listLevelNumber)),s){if("Bullet"!==i&&d.listLevelPattern===i&&(d.numberFormat===e||-1!==d.numberFormat.indexOf(e)))return r.paragraphFormat.listId=o.listId,r.paragraphFormat.listLevelNumber=h,void r.paragraphFormat.setList(o);d=u.levels[0]}}if(t.isNullOrUndefined(o)||!t.isNullOrUndefined(o)&&0===h&&(d.listLevelPattern!==i||d.numberFormat!==e||d.characterFormat.fontFamily!==n&&"Bullet"===d.listLevelPattern)){s=!1,o=new C,this.documentHelper.lists.length>0?o.listId=this.documentHelper.lists[this.documentHelper.lists.length-1].listId+1:o.listId=0;var u=new V;this.documentHelper.abstractLists.length>0?u.abstractListId=this.documentHelper.abstractLists[this.documentHelper.abstractLists.length-1].abstractListId+1:u.abstractListId=0,o.abstractListId=u.abstractListId,o.abstractList=u,this.documentHelper.abstractLists.push(u),"bullet"===e||"multiLevel"===e||"numbering"===e?this.addListLevels(u,e,r):((m=new _(u)).listLevelPattern=i,m.numberFormat=e,"Bullet"!==i?m.startAt=1:m.characterFormat.fontFamily=n,m.paragraphFormat.leftIndent=36,m.paragraphFormat.firstLineIndent=-18,u.levels.push(m),r.paragraphFormat.listLevelNumber=0),r.paragraphFormat.setList(o)}else if(p&&!t.isNullOrUndefined(o)){var g=this.documentHelper.getListById(l.paragraphFormat.listFormat.listId),m=this.documentHelper.layout.getListLevel(g,h);if("Bullet"===i)m.numberFormat=e,m.characterFormat.fontFamily=n;else{m.listLevelPattern=i,m.characterFormat.fontFamily=n;var f=m.numberFormat.substring(m.numberFormat.length-1);m.numberFormat.length!==e.length&&h>0?m.numberFormat=e:e.substring(e.length-1)!==m.numberFormat.substring(m.numberFormat.length-1)&&(m.numberFormat=m.numberFormat.replace(f,e.substring(e.length-1)))}r.paragraphFormat.setList(g)}else!t.isNullOrUndefined(o)&&s?r.paragraphFormat.setList(o):r.paragraphFormat.setList(void 0)},e.prototype.addListLevels=function(e,t,i){for(var n=["","","","",""],r=e.levels.length;r<9;r++){var o=new _(e);if(t.match("bullet"))o.listLevelPattern="Bullet",o.numberFormat=n[r<5?r%5:r%5+1],o.characterFormat.fontFamily=r<3||5===r?"Wingdings":"Symbol";else{if(t.match("multiLevel")){for(var s=0;s<r+1;s++)o.numberFormat+="%"+(s+1).toString()+".";o.listLevelPattern="Number"}else o.numberFormat="%"+(r+1).toString()+")",o.listLevelPattern=r%3==0?"Number":r%3==1?"LowLetter":"LowRoman";o.startAt=1,o.restartLevel=r}o.paragraphFormat.leftIndent=0===r?36:36*r,o.paragraphFormat.firstLineIndent=-18,e.levels.push(o),i.paragraphFormat.listLevelNumber=r}},e.prototype.insertPageBreak=function(){if(!this.owner.isReadOnlyMode){if(this.documentHelper.selection.start.paragraph.isInsideTable||this.documentHelper.selection.start.paragraph.isInHeaderFooter)return;this.initComplexHistory("PageBreak"),this.onEnter(!0),this.editorHistory&&null!==this.editorHistory.currentHistoryInfo&&this.editorHistory.updateComplexHistory(),this.selection.checkForCursorVisibility()}},e.prototype.onEnter=function(e){var i=this.documentHelper.selection;if(!this.isXmlMapped){if(i.isEmpty){var n=i.getHyperlinkField();if(!t.isNullOrUndefined(n))return void i.fireRequestNavigate(n);if((m=i.start.paragraph).isEmpty()&&-1!==m.paragraphFormat.listFormat.listId)return void this.onApplyListInternal(this.documentHelper.getListById(m.paragraphFormat.listFormat.listId),m.paragraphFormat.listFormat.listLevelNumber-1)}this.initHistory("Enter");var r=!0;if(i.isEmpty||(r=this.removeSelectedContents(i)),r){i.owner.isShiftingEnabled=!0,this.updateInsertPosition();var o=this.selection.getParagraphInfo(i.start),s=this.selection.getHierarchicalIndex(o.paragraph,o.offset.toString());if(this.splitParagraphInternal(i,i.start.paragraph,i.start.currentWidget,i.start.offset),this.setPositionForCurrentIndex(i.start,s),e){var a=i.start.paragraph,l=new fe;l.characterFormat.copyFormat(a.characterFormat),l.paragraphFormat.copyFormat(a.paragraphFormat);var d=new Ie;d.text="\f";var h=new we(l);if(h.children.push(d),d.line=h,l.childWidgets.push(h),this.owner.enableTrackChanges&&a.characterFormat.revisions.length>0){var c=this.retrieveRevisionInOder(a.characterFormat);c.range.push(l.characterFormat),l.characterFormat.revisions.push(c),l.characterFormat.removedIds=[]}this.insertParagraph(l,!0),i.selectParagraphInternal(l,!0)}var p=i.start.paragraph.nextWidget;t.isNullOrUndefined(p)&&(p=i.getNextRenderedBlock(i.start.paragraph)),i.selectParagraphInternal(p,!0),this.updateEndPosition(),e&&this.editorHistory&&this.owner.editorHistory.updateHistory(),this.reLayout(i);var u=this.selection.start.paragraph.containerWidget.firstChild;if(!t.isNullOrUndefined(u)){u.isChangeDetected=!1;for(var g=u.nextRenderedWidget;this.owner.isSpellCheck&&!t.isNullOrUndefined(g);)(u=g).isChangeDetected=!1,g=u.nextRenderedWidget}var m=i.start.paragraph.previousWidget;!t.isNullOrUndefined(m)&&!m.isEmpty()&&m.lastChild.children[m.lastChild.children.length-1]instanceof Ie&&this.checkAndConvertToHyperlink(i,!0,m)}}},e.prototype.splitParagraphInternal=function(e,i,n,r){var o=0,s=i.index,a=i;for(a.isChangeDetected=0===r;this.owner.isSpellCheck&&!t.isNullOrUndefined(a.nextRenderedWidget);)(a=a.nextRenderedWidget).isChangeDetected=!0;var l=new fe,d=new we(l);if(l.childWidgets.push(d),l.paragraphFormat.ownerBase=l,l.footNoteReference=i.footNoteReference,n===i.lastChild&&r===e.getLineLength(n)){if(i.paragraphFormat.baseStyle&&"Normal"!==i.paragraphFormat.baseStyle.name&&i.paragraphFormat.baseStyle.next instanceof R?(i.paragraphFormat.baseStyle.name===i.paragraphFormat.baseStyle.next.name?(l.paragraphFormat.copyFormat(i.paragraphFormat),l.characterFormat.copyFormat(i.characterFormat)):l.paragraphFormat.baseStyle=i.paragraphFormat.baseStyle.next,this.selection.skipFormatRetrieval=!1):(l.paragraphFormat.copyFormat(i.paragraphFormat),l.characterFormat.copyFormat(i.characterFormat)),this.owner.enableTrackChanges){var h=i.lastChild;if(!t.isNullOrUndefined(h)&&h.children.length>0){var c=h.children[h.children.length-1].previousValidNodeForTracking;this.checkParaMarkMatchedWithElement(c,i.characterFormat,!1,"Insertion")||this.insertParaRevision(i)}}o++,s++}else{if(l.paragraphFormat.copyFormat(i.paragraphFormat),l.characterFormat.copyFormat(i.characterFormat),r>0||!n.isFirstLine())i=i.combineWidget(this.owner.viewer),this.moveInlines(i,l,0,0,i.firstChild,r,n),this.insertParaRevision(l,i.firstChild);else if(this.owner.enableTrackChanges){var p=i.firstChild.children[0].previousValidNodeForTracking;this.checkParaMarkMatchedWithElement(p,l.characterFormat,!0,"Insertion")||this.insertParaRevision(l)}i=i.getSplitWidgets()[0]}o+=i.getIndex();var u=i.containerWidget;u.childWidgets.splice(o,0,l),this.owner.enableTrackChanges&&0===l.characterFormat.revisions.length&&0===i.characterFormat.revisions.length&&(this.checkToMatchEmptyParaMark(i)||this.insertParaRevision(i)),l.containerWidget=u,l.index=s,this.updateNextBlocksIndex(l,!0),this.documentHelper.layout.layoutBodyWidgetCollection(s,u,l,!1)},e.prototype.insertParaRevision=function(e,i){if(this.owner.enableTrackChanges&&t.isNullOrUndefined(i)&&!this.isRevisionMatched(e.characterFormat,"Insertion")&&(e.characterFormat.revisions=[],this.insertRevision(e.characterFormat,"Insertion")),!t.isNullOrUndefined(i)){if(i.paragraph.isInsideTable)return void this.insertRevision(e.characterFormat,"Insertion");this.applyRevisionForParaMark(e,i,"Insertion",!0)}},e.prototype.applyRevisionForParaMark=function(e,i,n,r){var o=i.children[0];if(!t.isNullOrUndefined(o)){o=o.nextValidNodeForTracking;var s=e.lastChild,a=0===s.children.length?void 0:s.children[s.children.length-1].previousValidNodeForTracking,l=!1,d=e.characterFormat.revisions.length;if(t.isNullOrUndefined(a)||(l=this.checkParaMarkMatchedWithElement(a,e.characterFormat,!1,n)),!t.isNullOrUndefined(o))if(e.characterFormat.revisions.length>d){if(this.isRevisionMatched(o,n))for(var h=e.characterFormat.revisions[0],c=this.getMatchedRevisionsToCombine(o.revisions,n),p=0;p<c.length;p++)c[p]!==h&&(l=!0,this.clearAndUpdateRevisons(c[p].range,h,h.range.indexOf(e.characterFormat)+1))}else l=this.checkParaMarkMatchedWithElement(o,e.characterFormat,!0,n);!l&&(this.owner.enableTrackChanges||i.paragraph.characterFormat.revisions.length>0)&&(this.insertRevision(e.characterFormat,n),r&&a.revisions.length>0&&o.revisions.length>0&&this.updateRevisionForSpittedTextElement(a,o))}},e.prototype.checkParaMarkMatchedWithElement=function(e,t,i,n){var r=this.getMatchedRevisionsToCombine(e.revisions,n);return r.length>0&&(this.mapMatchedRevisions(r,e,t,i),!0)},e.prototype.checkToMatchEmptyParaMark=function(e){var i=e.previousRenderedWidget;if(!t.isNullOrUndefined(i)&&i instanceof fe&&i.characterFormat.revisions.length>0){var n=this.getMatchedRevisionsToCombine(i.characterFormat.revisions,"Insertion");if(n.length>0)return this.mapMatchedRevisions(n,i.characterFormat,e.characterFormat,!1),!0}return!1},e.prototype.updateNextBlocksIndex=function(e,t){var i=e.containerWidget.childWidgets.indexOf(e)+1;if(e.containerWidget instanceof pe)for(var n=e.containerWidget.index,r=this.documentHelper.pages.indexOf(e.containerWidget.page);r<this.documentHelper.pages.length;r++){var o=this.documentHelper.pages[r];if(o.bodyWidgets[0].index!==n)return;for(var s=i;s<o.bodyWidgets[0].childWidgets.length;s++){var a=o.bodyWidgets[0].childWidgets[s];this.updateIndex(a,t)}i=0}else if(e.containerWidget instanceof be)for(var l=e.containerWidget.getSplitWidgets(),d=l.indexOf(e.containerWidget),h=d;h<l.length;h++){for(var c=l[h].childWidgets,p=i;p<c.length;p++)this.updateIndex(c[p],t);d=0,i=0}else if(e.containerWidget instanceof ye)for(m=i;m<e.containerWidget.childWidgets.length;m++){var u=e.containerWidget.childWidgets[m];u.rowIndex===e.containerWidget.index&&this.updateIndex(u,t)}else if(e.containerWidget instanceof ve)for(m=i;m<e.containerWidget.childWidgets.length;m++){var g=e.containerWidget.childWidgets[m];this.updateIndex(g,t);for(r=0;r<g.childWidgets.length;r++)g.childWidgets[r].rowIndex=g.index}else if(e.containerWidget instanceof ue||e.containerWidget instanceof _e||e.containerWidget instanceof me)for(var m=i;m<e.containerWidget.childWidgets.length;m++){var f=e.containerWidget.childWidgets[m];this.updateIndex(f,t)}},e.prototype.updateIndex=function(e,t){t?e.index++:e.index--},e.prototype.updateEndPosition=function(){var e=this.documentHelper.selection;this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)&&this.updateHistoryPosition(e.start,!1)},e.prototype.onBackSpace=function(){this.removeEditRange=!0;var e=this.documentHelper.selection;if(this.documentHelper.triggerSpellCheck=!0,e.isEmpty)this.singleBackspace(e,!1);else{this.initHistory("BackSpace");var t=this.deleteSelectedContents(e,!0);this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&(t?this.editorHistory.currentBaseHistoryInfo=void 0:(this.checkEndPosition(e)&&this.updateHistoryPosition(e.end,!1),this.reLayout(e),this.insertSpaceInFormField())),this.documentHelper.triggerSpellCheck=!1}this.removeEditRange=!1,this.updateXmlMappedContentControl()},e.prototype.insertRemoveBookMarkElements=function(){for(var e=!1,t=0;t<this.removedBookmarkElements.length;t++){var i=this.removedBookmarkElements[t];if(0===i.bookmarkType){this.documentHelper.bookmarks.containsKey(i.name)||this.documentHelper.bookmarks.add(i.name,i);var n=i;if(n&&n.reference&&-1!==this.removedBookmarkElements.indexOf(n.reference)){var r=this.removedBookmarkElements.indexOf(n.reference),o=this.removedBookmarkElements.indexOf(n);this.removedBookmarkElements.splice(r,1),this.removedBookmarkElements.splice(o,1),t--}else this.editorHistory.currentBaseHistoryInfo&&(this.initComplexHistory(this.editorHistory.currentBaseHistoryInfo.action),this.editorHistory.updateHistory()),this.initInsertInline(n.clone()),this.editorHistory.currentHistoryInfo&&(this.editorHistory.updateComplexHistory(),e=!0)}else{var s=i;if(s&&s.reference&&-1!==this.removedBookmarkElements.indexOf(s.reference)){var r=this.removedBookmarkElements.indexOf(s.reference),o=this.removedBookmarkElements.indexOf(s);this.removedBookmarkElements.splice(r,1),this.removedBookmarkElements.splice(o,1),t--}else this.editorHistory.currentBaseHistoryInfo&&(this.initComplexHistory(this.editorHistory.currentBaseHistoryInfo.action),this.editorHistory.updateHistory()),this.initInsertInline(s.clone()),this.editorHistory.currentHistoryInfo&&(this.editorHistory.updateComplexHistory(),e=!0)}}return this.removedBookmarkElements=[],e},e.prototype.deleteSelectedContents=function(e,t){var i=this.deleteSelectedContentInternal(e,t,e.start,e.end),n=e.getTextPosBasedOnLogicalIndex(e.editPosition);return e.selectContent(n,!0),i},e.prototype.removeWholeElement=function(e){this.initHistory("BackSpace"),this.deleteSelectedContents(e,!0),this.checkEndPosition(e)&&this.updateHistoryPosition(e.end,!1),this.reLayout(e)},e.prototype.singleBackspace=function(e,i){var n=this.editorHistory;if(n&&!i&&!n.canRedo()&&n.canUndo()){var r=n.undoStack[n.undoStack.length-1],o=this.selection.getParagraphInfo(e.start),s=this.selection.getParagraphInfo(e.end);if("AutoFormatHyperlink"===r.action&&r.insertPosition===this.selection.getHierarchicalIndex(o.paragraph,o.offset.toString())&&r.endPosition===this.selection.getHierarchicalIndex(s.paragraph,s.offset.toString()))return void n.undo()}var a=e.start.paragraph,l=e.start.currentWidget,d=e.start.offset,h=0,c=l.getInline(d,h),p=c.element;if(this.selection.isInlineFormFillMode()){if(p instanceof xe&&2===p.fieldType)return;if(1===this.getFormFieldText().length)return this.selection.selectFieldInternal(this.selection.getCurrentFormField()),this.insertTextInternal(this.documentHelper.textHelper.repeatChar(this.documentHelper.textHelper.getEnSpaceCharacter(),5),!0),void this.selection.selectTextElementStartOfField(this.selection.getCurrentFormField())}if(h=c.index,p instanceof Ie&&(p.ignoreOnceItems=[]),p instanceof Ie&&(p.ignoreOnceItems=[]),p instanceof xe&&2===p.fieldType&&W.isLinkedFieldCharacter(p)){var u=p.fieldBegin,g=p.fieldEnd;return u.nextNode instanceof ke&&(g=u.nextNode.reference),e.start.setPositionParagraph(u.line,u.line.getOffset(u,0)),e.end.setPositionParagraph(g.line,g.line.getOffset(g,0)+1),void e.fireSelectionChanged(!0)}if(p instanceof Ee&&("Footnote"===p.footnoteType?this.removeFootnote(p):this.removeEndnote(p)),p&&(p instanceof Le||p.previousNode instanceof Le)&&(p instanceof Le&&p.previousNode&&(a=(p=p.previousNode).line.paragraph,d=p.line.getOffset(p,p.length)),p&&1===p.length&&p.nextNode instanceof Le&&p.previousNode instanceof Le)){var m=p.previousNode,g=p.nextNode;if(!m.contentControlProperties.lockContentControl)return e.start.setPositionParagraph(m.line,m.line.getOffset(m,0)),e.end.setPositionParagraph(g.line,g.line.getOffset(g,0)+1),void this.removeWholeElement(e)}if(p&&(p instanceof ke||p.previousNode instanceof ke)){if(p instanceof ke&&1===p.bookmarkType){if(p.previousNode)a=(p=p.previousNode).line.paragraph,d=p.line.getOffset(p,p.length);else if(a.previousRenderedWidget instanceof fe){var f=a.previousRenderedWidget.lastChild;return e.start.setPositionParagraph(p.line,p.line.getOffset(p,0)),e.end.setPositionParagraph(f,f.getEndOffset()),void this.removeWholeElement(e)}}else if(p.nextNode instanceof ke&&p instanceof ke&&0===p.bookmarkType&&p.reference===p.nextNode)return void this.deleteBookmark(p.name);if(1===p.length&&p.nextNode instanceof ke&&p.previousNode instanceof ke){var u=p.previousNode,g=p.nextNode;return e.start.setPositionParagraph(u.line,u.line.getOffset(u,0)),e.end.setPositionParagraph(g.line,g.line.getOffset(g,0)+1),void this.removeWholeElement(e)}}if(p instanceof xe&&1===p.fieldType){var v=e.getPreviousValidElement(p);if(v instanceof xe){if(p=v.fieldBegin,a=p.line.paragraph,d=p.line.getOffset(p,0),p.nextNode instanceof ke){m=p.nextNode.reference;e.start.setPositionParagraph(m.line,m.line.getOffset(m,0))}return e.end.setPositionParagraph(p.line,d),void e.fireSelectionChanged(!0)}v!==p&&(a=(p=v).line.paragraph,d=p.line.getOffset(p,p.length))}if(p instanceof Ye||p instanceof Xe){if(p.nextNode instanceof Xe&&p.editRangeEnd===p.nextNode||p.previousNode instanceof Ye&&p.editRangeStart===p.previousNode)return;if(p instanceof Ye&&!(p.previousNode instanceof Xe))return;if(p instanceof Xe&&(t.isNullOrUndefined(p.previousNode)||(a=(p=p.previousNode).line.paragraph,d=p.line.getOffset(p,p.length))),1===p.length&&p.nextNode instanceof Xe&&p.previousNode instanceof Ye){var m=p.previousNode,g=p.nextNode;return e.start.setPositionParagraph(m.line,m.line.getOffset(m,0)),e.end.setPositionParagraph(g.line,g.line.getOffset(g,0)+1),void this.removeWholeElement(e)}}if(i||this.initHistory("BackSpace"),d===e.getStartOffset(a)&&e.start.currentWidget.isFirstLine()){if(a.paragraphFormat.listFormat&&-1!==a.paragraphFormat.listFormat.listId)return void this.onApplyList(void 0);if(0!==a.paragraphFormat.firstLineIndent)return void this.onApplyParagraphFormat("firstLineIndent",0,!1,!1);if(0!==a.paragraphFormat.leftIndent)return void this.onApplyParagraphFormat("leftIndent",0,!1,!1);if(!a.paragraphFormat.bidi&&"Left"!==a.paragraphFormat.textAlignment)return void this.onApplyParagraphFormat("textAlignment","Left",!1,!0);if(a.previousRenderedWidget instanceof fe){e.owner.isShiftingEnabled=!0;var y=a.previousRenderedWidget;if(y.isEmpty())this.removeBlock(y),this.addRemovedNodes(y);else{this.removeBlock(a);var b=this.documentHelper.selection.getLineLength(y.lastChild),w=y.childWidgets.length-1,C=void 0;if(!a.isEmpty())for(var x=0;x<a.childWidgets.length;x++)C=a.childWidgets[x],y.childWidgets.push(C),a.childWidgets.splice(x,1),x--,C.paragraph=y;this.documentHelper.layout.reLayoutParagraph(y,w,0),e.selects(y.childWidgets[w],b,!0),this.addRemovedNodes(a)}this.setPositionForHistory(),this.reLayout(e)}else this.editorHistory&&(this.editorHistory.currentBaseHistoryInfo=void 0)}else{i||(e.owner.isShiftingEnabled=!0);var F=this.selection.getParagraphInfo(e.start),C=e.start.currentWidget,P=d-1;P<0&&(C=C.previousLine,P=this.documentHelper.selection.getLineLength(C)+P),this.removeAtOffset(C,e,P),this.setPositionParagraph(F.paragraph,F.offset-1,!1),this.setPositionForHistory(),i?this.fireContentChange():this.reLayout(e)}},e.prototype.setPositionForHistory=function(e){var i=this.documentHelper.selection;this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)&&(t.isNullOrUndefined(e)?(this.updateHistoryPosition(i.start,!0),this.editorHistory.currentBaseHistoryInfo.endPosition=this.editorHistory.currentBaseHistoryInfo.insertPosition):(this.editorHistory.currentBaseHistoryInfo.insertPosition=e,this.editorHistory.currentBaseHistoryInfo.endPosition=e))},e.prototype.removeAtOffset=function(e,i,n){var r=0,o=e.paragraph.childWidgets.indexOf(e),s=e.paragraph.paragraphFormat.bidi,a=e.children.length;if(!s&&this.viewer.documentHelper.layout.isContainsRtl(e))for(var l=e.children[0],d=void 0,h=-1,c=!0;l;){for(;(c||t.isNullOrUndefined(d))&&l instanceof Ie&&(this.documentHelper.textHelper.isRTLText(l.text)||this.documentHelper.textHelper.containsSpecialCharAlone(l.text))&&l.nextElement;)d||(d=l),-1===h&&(h=e.children.indexOf(l)),l=l.nextElement;c=!1;var p=e.children.indexOf(l);if(g=this.removeCharacter(l,n,r,e,o,p,!0))break;r+=l.length,d===l?(-1!==h&&(l=e.children[h+1]),d=void 0,h=-1):l=d?l.previousElement:l.nextElement}else for(var u=s?a-1:0;s?u>=0:u<a;s?u--:u++)if(!((l=e.children[u])instanceof Ke)){var g=this.removeCharacter(l,n,r,e,o,u);if(g)break;r+=l.length}},e.prototype.removeCharacter=function(e,i,n,r,o,s,a){var l=!1;if(e instanceof ke&&e.line!==e.reference.line)return t.isNullOrUndefined(e.line.previousLine)?t.isNullOrUndefined(e.line.paragraph.previousRenderedWidget)?t.isNullOrUndefined(e.line.paragraph.nextRenderedWidget)||(e.line.paragraph.nextRenderedWidget.firstChild.children.splice(e.line.paragraph.nextRenderedWidget.firstChild.children.length,0,e),e.line=e.line.paragraph.nextRenderedWidget.firstChild):(e.line.paragraph.previousRenderedWidget.lastChild.children.splice(e.line.paragraph.previousRenderedWidget.lastChild.children.length,0,e),e.line=e.line.paragraph.previousRenderedWidget.lastChild):(e.line.previousLine.children.splice(e.line.previousLine.children.length,0,e),e.line=e.line.previousLine),r.children.splice(s,1),!0;if(i<n+e.length){var d=i-n;if(e.ischangeDetected=!0,this.owner.isSpellCheck&&this.owner.spellChecker.removeErrorsFromCollection({element:e,text:e.text}),e.canTrigger||(this.documentHelper.triggerSpellCheck=!1),i===n&&1===e.length)this.owner.enableTrackChanges&&!this.skipTracking()?(this.addRemovedNodes(e.clone()),this.handleDeleteTracking(e,d,1,s)):(this.unLinkFieldCharacter(e),this.unlinkRangeFromRevision(e,!0),this.addRemovedRevisionInfo(e,void 0),this.addRemovedNodes(e),r.children.splice(s,1)),this.documentHelper.layout.reLayoutParagraph(r.paragraph,o,s,void 0,a);else{var h=this.handleDeleteTracking(e,d,1);this.documentHelper.layout.reLayoutParagraph(r.paragraph,o,s,void 0,a),t.isNullOrUndefined(h)||(e.revisions.length>0&&this.addRemovedRevisionInfo(e,h),this.addRemovedNodes(h))}l=!0}return l},e.prototype.removeCharacterInLine=function(e,t,i){var n=new Ie;if(e instanceof Ie){n.characterFormat.copyFormat(e.characterFormat);var r=1===i?1:i-t;n.text=e.text.substr(t,r);var o=e.text;e.text=o.substring(0,t)+o.substring(t+r,o.length),e.contentControlProperties&&(n.contentControlProperties=e.contentControlProperties.clone())}return n},e.prototype.removeRevisionsInformation=function(e,t,i,n){var r=e.previousElement;"Insertion"===this.retrieveRevisionInOder(r).revisionType&&this.isRevisionMatched(r,void 0)&&e.line.children.splice(n,1)},e.prototype.handleDeleteTracking=function(e,i,n,r,o,s){var a=this.owner.enableTrackChanges,l=(!t.isNullOrUndefined(this.editorHistory)&&(this.editorHistory.isUndoing||this.editorHistory.isRedoing),void 0);if(this.canHandleDeletion()||a&&!this.skipTracking()){if(e instanceof ke||e instanceof pt||e instanceof Ye||e instanceof Xe)return void(e instanceof ke&&e.previousElement instanceof xe&&e.previousElement.formFieldData?e.previousElement.revisions.length>0&&this.removeRevisionsInformation(e,i,n,r):e.line.children.splice(e.indexInOwner,1));var d=!1;if(this.owner.editorHistory&&(d=!t.isNullOrUndefined(this.owner.editorHistory.currentBaseHistoryInfo)&&"Delete"===this.owner.editorHistory.currentBaseHistoryInfo.action),this.skipTableElements||this.updateEndRevisionIndex(),e.revisions.length>0){var h=this.retrieveRevisionInOder(e),c=this.owner.revisions.changes.indexOf(h);if("Insertion"===h.revisionType)if(this.isRevisionMatched(e,void 0))t.isNullOrUndefined(r)?l=this.removeCharacterInLine(e,i,n):(h.range.splice(h.range.indexOf(e),1),0===h.range.length&&this.owner.revisionsInternal.remove(h),this.unLinkFieldCharacter(e),e.line.children.splice(r,1));else if(t.isNullOrUndefined(r)){var p=this.removeCharacterInLine(e,i,n);if(0===i){var u=e.previousElement;this.handleDeletionForInsertRevision(u,e,p,n,i,!0)}else if(e.length!==i)for(var g=e.revisions.length-1;g>=0;g--){var m=e.revisions[g],f=m.range.indexOf(e),v=new Ie;v.characterFormat.copyFormat(e.characterFormat),v.line=e.line,v.text=e.text.substr(i),v.revisions.splice(0,0,m),m.range.splice(f+1,0,v),p.revisions.splice(0,0,m),p.line=e.line,m.range.splice(f+1,0,p),e.text=e.text.substr(0,i);var y=e.indexInOwner;e.line.children.splice(y+1,0,v),e.line.children.splice(y+1,0,p),this.addRemovedNodes(p.clone()),this.insertRevision(p,"Deletion"),this.updateLastElementRevision(p)}else if(e.length===i){var b=e.nextElement;this.handleDeletionForInsertRevision(b,e,p,n,i,!1)}else 1===n?d||(this.selection.start.movePreviousPosition(),this.selection.end.setPositionInternal(this.selection.start)):this.updateCursorForInsertRevision(e,i,n),this.addRemovedNodes(p.clone()),this.insertInlineInternal(p,"Deletion")}else this.checkToCombineRevisionsInSides(e,"Deletion")?this.updateLastElementRevision(e):(this.insertRevision(e,"Deletion"),this.updateLastElementRevision(e));else if("Deletion"===h.revisionType){if(-1!==c&&h.author!==this.owner.currentUser){var w=h.range,C=w[0].line.getOffset(w[0],0),x=w[w.length-1],F=x.line.getOffset(x,x.length);C===i&&F===n&&(e.revisions.splice(e.revisions.indexOf(h),1),this.checkToCombineRevisionsInSides(e,"Deletion")?this.combineElementRevision(e.revisions,e.revisions):(this.insertRevision(e,"Deletion"),this.updateLastElementRevision(e)),e.line.getOffset(e,0)===C&&this.owner.revisions.changes.splice(c,1))}if(1===n)d?(this.selection.start.moveNextPosition(),this.selection.end.setPositionInternal(this.selection.start)):(this.selection.start.movePreviousPosition(),this.selection.end.setPositionInternal(this.selection.start));else if(this.isRevisionMatched(e,"Deletion"))this.updateCursorForInsertRevision(e,i,n);else{var P=h.range.indexOf(e);(F=e.line.getOffset(e,e.length))>=n&&h.range.length>P+1?(this.updateRevisionForSpittedTextElement(e,h.range[P+1]),h.range.splice(h.range.indexOf(e),1),this.toCombineOrInsertRevision(e,"Deletion")):1===h.range.length||0===i?(this.handleDeleteBySplitting(e,i,n),-1!==P&&1!==h.range.length&&(this.updateRevisionForSpittedTextElement(h.range[P-1],h.range[P]),h.range.splice(h.range.indexOf(e),1))):(h.range.splice(h.range.indexOf(e),1),this.toCombineOrInsertRevision(e,"Deletion"))}this.updateLastElementRevision(e)}}else t.isNullOrUndefined(r)?this.handleDeleteBySplitting(e,i,n):(this.checkToCombineRevisionsInSides(e,"Deletion")||this.insertRevision(e,"Deletion"),this.updateLastElementRevision(e))}else l=this.removeCharacterInLine(e,i,n);return l},e.prototype.toCombineOrInsertRevision=function(e,t){this.checkToCombineRevisionsInSides(e,t)?this.combineElementRevision(e.revisions,e.revisions):(this.insertRevision(e,t),this.updateLastElementRevision(e))},e.prototype.updateLastElementRevision=function(e){this.skipTableElements||!this.editorHistory||!this.editorHistory.currentBaseHistoryInfo||this.skipReplace||!t.isNullOrUndefined(this.owner.search)&&this.owner.search.isRepalceTracking||t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo.lastElementRevision)&&(this.editorHistory.currentBaseHistoryInfo.lastElementRevision=e,e.isMarkedForRevision=!0)},e.prototype.updateEndRevisionIndex=function(){if(!t.isNullOrUndefined(this.editorHistory.undoStack)&&this.editorHistory.undoStack.length>0){var e=this.editorHistory.undoStack[this.editorHistory.undoStack.length-1];e.lastElementRevision&&t.isNullOrUndefined(e.endRevisionLogicalIndex)&&e.updateEndRevisionInfo()}},e.prototype.retrieveRevisionInOder=function(e){if(1===e.revisions.length)return e.revisions[0];for(var t=0;t<e.revisions.length;t++)if("Deletion"===e.revisions[t].revisionType)return e.revisions[t];return e.revisions[e.revisions.length-1]},e.prototype.handleDeletionForInsertRevision=function(e,i,n,r,o,s){if(!t.isNullOrUndefined(e)&&0===i.revisions.length&&this.isRevisionMatched(e,"Deletion"))this.addRemovedNodes(n.clone()),this.insertTextInline(e,this.selection,n.text,0);else{var a=i.revisions[i.revisions.length-1],l=a.range.indexOf(i);a.range.splice(s?l:l+1,0,n),n.revisions.splice(0,0,a);var d=!1;this.owner.editorHistory&&(d=!t.isNullOrUndefined(this.owner.editorHistory.currentBaseHistoryInfo)&&"Delete"===this.owner.editorHistory.currentBaseHistoryInfo.action),1!==r||d?this.updateCursorForInsertRevision(i,o,r):(this.selection.start.movePreviousPosition(),this.selection.end.setPositionInternal(this.selection.start)),this.addRemovedNodes(n.clone()),this.insertInlineInternal(n,"Deletion")}},e.prototype.handleDeleteBySplitting=function(e,i,n){var r=!1;if(this.owner.editorHistory&&(r=!t.isNullOrUndefined(this.owner.editorHistory.currentBaseHistoryInfo)&&"Delete"===this.owner.editorHistory.currentBaseHistoryInfo.action),1===n){var o=e.line.getOffset(e,0);if(o>0){var s=new Nt(this.owner);s.setPositionForLineWidget(e.line,o+i),this.selection.start.setPositionInternal(s),this.selection.end.setPositionInternal(this.selection.start)}else r||(this.selection.start.movePreviousPosition(),this.selection.end.setPositionInternal(this.selection.start))}else this.updateCursorForInsertRevision(e,i,n);var a=this.removeCharacterInLine(e,i,n);this.addRemovedNodes(a.clone()),this.insertTextInternal(a.text,!1,"Deletion")},e.prototype.updateCursorForInsertRevision=function(e,t,i){var n=e.line.getOffset(e,0);n>0&&(t=n+t,i=n+i);var r=new Nt(this.owner);r.setPositionFromLine(e.line,t);var o=new Nt(this.owner);o.setPositionFromLine(e.line,i),r.isExistBefore(o)?(this.selection.end.setPositionInternal(r),this.selection.start.setPositionInternal(r)):(this.selection.start.setPositionInternal(o),this.selection.end.setPositionInternal(o))},e.prototype.checkToCombineRevisionsInSides=function(e,i){var n=e.previousNode,r=e.nextNode,o=!1;if(t.isNullOrUndefined(n)||(n=n.previousValidNodeForTracking,t.isNullOrUndefined(n)||(s=this.getMatchedRevisionsToCombine(n.revisions,i)).length>0&&(this.mapMatchedRevisions(s,n,e,!1),o=!0)),!t.isNullOrUndefined(r)&&(r=r.nextValidNodeForTracking,!t.isNullOrUndefined(r))){var s=this.getMatchedRevisionsToCombine(r.revisions,i);s.length>0&&(o?this.combineElementRevision(e.revisions,r.revisions):this.mapMatchedRevisions(s,r,e,!0),o=!0)}return o},e.prototype.delete=function(){this.removeEditRange=!0;var e=this.documentHelper.selection;if(e.isEmpty)this.singleDelete(e,!1);else{this.initHistory("Delete"),this.deleteSelectedContentInternal(e,!1,e.start,e.end);var t=new Nt(e.owner);this.setPositionForCurrentIndex(t,e.editPosition),e.selectContent(t,!0),this.reLayout(e),this.insertSpaceInFormField()}this.removeEditRange=!1,this.updateXmlMappedContentControl()},e.prototype.deleteEditElement=function(e){this.initHistory("Delete"),this.deleteSelectedContentInternal(e,!1,e.start,e.end);var t=new Nt(e.owner);this.setPositionForCurrentIndex(t,e.editPosition),e.selectContent(t,!0),this.reLayout(e)},e.prototype.removeContentControlMark=function(e,t){return!e.contentControlProperties.lockContentControl&&(this.selection.start.setPositionParagraph(e.line,e.line.getOffset(e,0)),this.selection.end.setPositionParagraph(t.line,t.line.getOffset(t,0)+1),this.deleteEditElement(this.selection),!0)},e.prototype.singleDelete=function(e,i){var n=e.start.currentWidget,r=e.start.paragraph,o=e.start.offset,s=0,a=n.getInline(e.start.offset,s),l=a.element;if(this.selection.isInlineFormFillMode()){if(l instanceof xe&&1===l.fieldType)return;var d=this.getFormFieldText();if(l instanceof Ie||(l=l.nextElement),1===d.length&&l instanceof Ie)return this.selection.selectFieldInternal(this.selection.getCurrentFormField()),this.insertTextInternal(this.documentHelper.textHelper.repeatChar(this.documentHelper.textHelper.getEnSpaceCharacter(),5),!0),void this.selection.selectTextElementStartOfField(this.selection.getCurrentFormField());if(l instanceof xe&&1===l.fieldType)return}if(s=a.index,r.paragraphFormat.listFormat&&-1!==r.paragraphFormat.listFormat.listId&&this.documentHelper.isListTextSelected&&"List"===e.contextType)return void this.onApplyList(void 0);if(!t.isNullOrUndefined(l)&&s===l.length&&!t.isNullOrUndefined(l.nextNode)){if((l=l.nextNode)instanceof xe&&1===l.fieldType&&!t.isNullOrUndefined(l.fieldBegin.formFieldData))return;s=0}if(!t.isNullOrUndefined(l)&&s===l.length&&!t.isNullOrUndefined(l.nextNode)){if((l=l.nextNode)instanceof Ee)return;s=0}if(l instanceof Ee&&("Footnote"===l.footnoteType?this.removeFootnote(l):this.removeEndnote(l)),!t.isNullOrUndefined(l)){var h=void 0,c=e.getNextValidElement(l);if(c instanceof Ce&&(h=c),!t.isNullOrUndefined(h)&&h instanceof xe&&0===h.fieldType)return l=h.fieldEnd,r=l.line.paragraph,o=l.line.getOffset(l,1),e.end.setPositionParagraph(l.line,o),void e.fireSelectionChanged(!0);l!==h&&(r=(l=h).line.paragraph,o=l.line.getOffset(l,0),l instanceof xe&&1===l.fieldType&&o++)}if(l instanceof Ye||l instanceof Xe){if(l.nextNode instanceof Xe&&l.editRangeEnd===l.nextNode||l.previousNode instanceof Ye&&l.editRangeStart===l.previousNode)return;if(this.documentHelper.isDocumentProtected&&"ReadOnly"===this.documentHelper.protectionType){if(l instanceof Ye||l instanceof Xe)return}else l instanceof Ye?(o=(l=l.nextNode).line.getOffset(l,0),r=l.line.paragraph):l instanceof Xe&&o++;if(1===l.length&&l.nextNode instanceof Xe&&l.previousNode instanceof Ye){var p=l.previousNode,u=l.nextNode;return e.start.setPositionParagraph(p.line,p.line.getOffset(p,0)),e.end.setPositionParagraph(u.line,u.line.getOffset(u,0)+1),void this.deleteEditElement(e)}}if(l&&(l instanceof Le||l.nextNode instanceof Le)){if(l instanceof Le&&l.nextNode)return l=l.nextNode,r=l.line.paragraph,o=l.line.getOffset(l,0),e.start.setPositionParagraph(l.line,o),void e.end.setPositionParagraph(l.line,o);if(l&&1===l.length&&l.nextNode instanceof Le&&l.previousNode instanceof Le&&this.removeContentControlMark(l.previousNode,l.nextNode))return;if(l instanceof Le&&l.previousNode instanceof Le&&l.previousNode.reference===l&&this.removeContentControlMark(l.previousNode,l))return}if(l&&(l instanceof ke&&0===l.bookmarkType||l.nextNode instanceof ke)){if(l.nextNode&&l instanceof ke&&(r=(l=l.nextNode).line.paragraph,o=l.line.getOffset(l,0)),1===l.length&&l.nextNode instanceof ke&&l.previousNode instanceof ke){var g=l.previousNode,m=l.nextNode;return e.start.setPositionParagraph(g.line,g.line.getOffset(g,0)),e.end.setPositionParagraph(m.line,m.line.getOffset(m,0)+1),void this.deleteEditElement(e)}l instanceof ke&&(o=l.line.getOffset(l,1))}if(e.start.currentWidget.isLastLine()&&o===this.documentHelper.selection.getLineLength(e.start.currentWidget)){if(r.isInsideTable&&t.isNullOrUndefined(r.nextWidget))return;var f=void 0,v=e.getNextParagraphBlock(r);if(t.isNullOrUndefined(v)){if(o>0)return;if(r.previousWidget instanceof fe&&(f=r.previousWidget),r.previousWidget instanceof me)return;if(r.previousWidget instanceof ve)return;if(t.isNullOrUndefined(f))return}if(i||this.initHistory("Delete"),r.isEndsWithPageBreak){var y=r.lastChild,b=y.children[y.children.length-1];this.selection.start.setPositionForSelection(y,b,0,this.selection.start.location)}var w=this.selection.getParagraphInfo(e.start);if(e.editPosition=this.selection.getHierarchicalIndex(w.paragraph,w.offset.toString()),this.checkInsertPosition(e)&&this.setPositionForHistory(e.editPosition),e.owner.isShiftingEnabled=!0,r.isEmpty())if(this.removeBlock(r),this.addRemovedNodes(r),t.isNullOrUndefined(v))if(t.isNullOrUndefined(f)){var C=e.getParagraphLength(void 0)+1;this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)&&(this.updateHistoryPosition(e.start,!0),this.editorHistory.currentBaseHistoryInfo.endPosition=this.selection.getHierarchicalIndex(void 0,C.toString()))}else e.selectParagraphInternal(f,!1),this.setPositionForHistory();else e.selectParagraphInternal(v,!0);else{r=r.combineWidget(this.owner.viewer);var x=this.splitParagraph(r,r.firstChild,0,e.start.currentWidget,e.start.offset,!0);this.deleteParagraphMark(x,e,0),this.addRemovedNodes(r),this.setPositionForCurrentIndex(e.start,e.editPosition),e.selectContent(e.start,!0)}this.reLayout(e)}else this.singleDeleteInternal(e,i,r)},e.prototype.singleDeleteInternal=function(e,t,i){t||(e.owner.isShiftingEnabled=!0,this.initHistory("Delete")),this.checkInsertPosition(e)&&(this.updateHistoryPosition(e.start,!0),this.editorHistory.currentBaseHistoryInfo.endPosition=this.editorHistory.currentBaseHistoryInfo.insertPosition);var n=this.selection.getParagraphInfo(e.start),r=e.start.currentWidget,o=e.start.offset,s=e.getLineLength(e.start.currentWidget);o>=s&&(r=r.nextLine,o-=s),this.removeAtOffset(r,e,o),this.owner.enableTrackChanges&&!this.skipTracking()?this.setPositionParagraph(n.paragraph,n.offset+1,!1):this.setPositionParagraph(n.paragraph,n.offset,!1),t?this.fireContentChange():this.reLayout(e)},e.prototype.deleteParagraphMark=function(e,i,n,r){if(!t.isNullOrUndefined(e.containerWidget)){e=e.combineWidget(this.owner.viewer);var o=i.getNextParagraphBlock(e);if(!(e.isInsideTable&&t.isNullOrUndefined(e.nextWidget)||t.isNullOrUndefined(o))){e.containerWidget instanceof pe&&e.containerWidget;var s=void 0;if(s=i.getNextRenderedBlock(e)instanceof ve?i.getNextRenderedBlock(e):void 0,o.isInsideTable&&!t.isNullOrUndefined(s)&&s.contains(o.associatedCell)){if(n<4){var a=0;this.removeBlock(e),this.documentHelper.layout.clearListElementBox(o),this.documentHelper.layout.clearListElementBox(e);for(u=e.childWidgets.length-1;u>=0;u--)for(var l=e.childWidgets[u],d=l.children.length-1;d>=0;d--){var h=l.children[d];a+=h.length,o.firstChild.children.unshift(h),h.line=o.firstChild}this.documentHelper.layout.reLayoutParagraph(o,0,0),a>0&&(i.editPosition=this.selection.getHierarchicalIndex(o,a.toString()))}}else if(n<4){e.childWidgets.length;var c=o.getSplitWidgets();if(o=o.combineWidget(this.owner.viewer),this.documentHelper.layout.clearListElementBox(o),this.documentHelper.layout.clearListElementBox(e),this.updateEditPositionOnMerge(e,o),!(!t.isNullOrUndefined(r)&&r)||this.handleDeleteParaMark(e,c[0])){for(var p=e.childWidgets.length-1,u=(e.childWidgets[p].children.length,0);u<o.childWidgets.length;u++){var g=o.childWidgets[u];if(o.characterFormat.revisions.length>0)for(var m=0;m<o.characterFormat.revisions.length;m++){for(d=0;d<o.characterFormat.revisions[m].range.length;d++)o.characterFormat.revisions[m].range[d].ownerBase=e;e.characterFormat.revisions.push(o.characterFormat.revisions[m])}o.childWidgets.splice(u,1),e.childWidgets.push(g),g.paragraph=e,u--}0===o.childWidgets.length&&o.childWidgets.push(new we(o)),this.removeBlock(o),this.documentHelper.layout.reLayoutParagraph(e,0,0),this.addRemovedNodes(o)}}}}},e.prototype.handleDeleteParaMark=function(e,i){if(!this.owner.enableTrackChanges&&e.characterFormat.revisions.length>0)for(var n=0;n<e.characterFormat.revisions.length;n++){var r=e.characterFormat.revisions[n],o=r.range.indexOf(e.characterFormat);return r.range.splice(o,1),0===r.range.length&&this.owner.revisions.remove(r),!0}if(this.owner.enableTrackChanges){var s=!1;if(e.characterFormat.revisions.length>0){var a=this.retrieveRevisionByType(e.characterFormat,"Deletion");if(!t.isNullOrUndefined(a)&&this.isRevisionMatched(a,"Deletion")){var l=e.characterFormat.revisions.indexOf(a);e.characterFormat.revisions.splice(l,1),a.range.splice(a.range.indexOf(e.characterFormat),1),0===a.range.length&&this.owner.revisions.remove(a),s=!0}var d=this.retrieveRevisionByType(e.characterFormat,"Insertion");if(!t.isNullOrUndefined(d)&&this.isRevisionMatched(e.characterFormat,"Insertion")){o=d.range.indexOf(e.characterFormat);d.range.splice(o,1),0===d.range.length&&this.owner.revisions.remove(d),s=!0}return!!s||(this.applyRevisionForParaMark(e,i.firstChild,"Deletion",!1),!1)}return this.applyRevisionForParaMark(e,i.firstChild,"Deletion",!1),!1}return!0},e.prototype.insertDeleteParaMarkRevision=function(e,i){var n=e.lastChild,r=n.children.length>0?n.children[n.children.length-1].previousValidNodeForTracking:void 0;if(!t.isNullOrUndefined(r)){var o=this.getMatchedRevisionsToCombine(r.revisions,"Deletion");o.length>0&&this.mapMatchedRevisions(o,r,e.characterFormat,!1)}i.firstChild.children[0].nextValidNodeForTracking},e.prototype.retrieveRevisionByType=function(e,t){for(var i=0;i<e.revisions.length;i++)if(e.revisions[i].revisionType===t)return e.revisions[i]},e.prototype.combineRevisionOnDeleteParaMark=function(e,t,i){var n=e.childWidgets[t].children[i],r=n.nextNode;r=r.nextValidNodeForTracking,n=n.nextValidNodeForTracking,r.revisions.length>0&&n.revisions.length>0&&this.combineElementRevisions(n,r)},e.prototype.updateEditPositionOnMerge=function(e,t){this.documentHelper.selection.editPosition===this.selection.getHierarchicalIndex(t,"0")&&void 0===t.nextRenderedWidget&&(this.documentHelper.selection.editPosition=this.selection.getHierarchicalIndex(e,this.documentHelper.selection.getLineLength(e.lastChild).toString()))},e.prototype.checkEndPosition=function(e){return this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)&&t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo.endPosition)},e.prototype.checkInsertPosition=function(e){return this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)&&t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo.insertPosition)},e.prototype.checkIsNotRedoing=function(){return this.documentHelper.owner.enableHistoryMode&&!this.editorHistory.isRedoing},e.prototype.deleteSelectedContentInternal=function(e,i,n,r){var o=n,s=r;n.isExistBefore(r)||(o=r,s=n);var a=this.selection.getParagraphInfo(o);e.editPosition=this.selection.getHierarchicalIndex(a.paragraph,a.offset.toString());var l=!1;if(i&&o.isInSameParagraph(s)&&(o.offset<s.offset&&o.offset===e.getParagraphLength(s.paragraph)&&(l=e.getNextRenderedBlock(o.paragraph)instanceof ve),!(1===s.offset&&s.offset>e.getParagraphLength(s.paragraph))||s.paragraph.isInsideTable&&t.isNullOrUndefined(s.paragraph.nextWidget)||(i=!1)),!l){e.owner.isShiftingEnabled=!0,this.checkInsertPosition(e)&&(this.editorHistory.currentBaseHistoryInfo.insertPosition=e.editPosition);var d=i?1:0;this.deleteSelectedContent(s.paragraph,e,o,s,d)}return l},e.prototype.initHistory=function(e){this.documentHelper.owner.enableHistoryMode&&this.editorHistory.initializeHistory(e)},e.prototype.initComplexHistory=function(e){this.documentHelper.owner.enableHistoryMode&&this.editorHistory.initComplexHistory(this.documentHelper.selection,e)},e.prototype.insertPicture=function(e,t,i){var n=new Ge(!0);n.imageString=e,n.width=t,n.height=i,n.textWrappingStyle="Inline",this.insertPictureInternal(n)},e.prototype.insertPictureInternal=function(e){var t=this.documentHelper.selection;this.initHistory("InsertInline"),this.fitImageToPage(t,e),this.insertInlineInSelection(t,e),this.reLayout(t)},e.prototype.fitImageToPage=function(e,t){var i=e.start.paragraph.bodyWidget,n=i.sectionFormat.pageWidth-i.sectionFormat.leftMargin-i.sectionFormat.rightMargin,r=i.sectionFormat.pageHeight-i.sectionFormat.topMargin-i.sectionFormat.topMargin;t.width>n&&(t.height=t.height*n/t.width,t.width=n),t.height>r&&(t.width=t.width*r/t.height,t.height=r)},e.prototype.insertInlineInSelection=function(e,t){this.checkIsNotRedoing()&&(e.owner.isShiftingEnabled=!0),e.isEmpty||this.removeSelectedContents(e),this.updateInsertPosition(),this.insertInlineInternal(t),this.checkEndPosition(e)&&this.updateHistoryPosition(e.start,!1),this.fireContentChange()},e.prototype.onPortrait=function(){var e=new b,t=this.documentHelper.selection.sectionFormat.pageWidth,i=this.documentHelper.selection.sectionFormat.pageHeight;t>i&&(e.pageWidth=i,e.pageHeight=t),this.onApplySectionFormat(void 0,e)},e.prototype.onLandscape=function(){var e=new b,t=this.documentHelper.selection.sectionFormat.pageWidth,i=this.documentHelper.selection.sectionFormat.pageHeight;t<i&&(e.pageWidth=i,e.pageHeight=t),this.onApplySectionFormat(void 0,e)},e.prototype.copyValues=function(){var e=new b;return e.bottomMargin=this.documentHelper.selection.sectionFormat.bottomMargin,e.topMargin=this.documentHelper.selection.sectionFormat.topMargin,e.leftMargin=this.documentHelper.selection.sectionFormat.leftMargin,e.rightMargin=this.documentHelper.selection.sectionFormat.rightMargin,e.pageHeight=this.documentHelper.selection.sectionFormat.pageHeight,e.pageWidth=this.documentHelper.selection.sectionFormat.pageWidth,e.footerDistance=this.documentHelper.selection.sectionFormat.footerDistance,e.headerDistance=this.documentHelper.selection.sectionFormat.headerDistance,e},e.prototype.changeMarginValue=function(e){var t=this.copyValues();"lastCustomSetting"===e||"normal"===e?(t.topMargin=72,t.bottomMargin=72,t.leftMargin=72,t.rightMargin=72):"narrow"===e?(t.topMargin=36,t.bottomMargin=36,t.leftMargin=36,t.rightMargin=36):"moderate"===e?(t.topMargin=72,t.bottomMargin=72,t.leftMargin=54,t.rightMargin=54):"wide"===e?(t.topMargin=72,t.bottomMargin=72,t.leftMargin=144,t.rightMargin=144):"mirrored"===e?(t.topMargin=72,t.bottomMargin=72,t.leftMargin=90,t.rightMargin=72):"office2003Default"===e&&(t.topMargin=72,t.bottomMargin=72,t.leftMargin=90,t.rightMargin=90),this.onApplySectionFormat(void 0,t)},e.prototype.onPaperSize=function(e){var t=this.copyValues(),i=this.documentHelper.selection.sectionFormat.pageWidth,n=this.documentHelper.selection.sectionFormat.pageHeight;"letter"===e?i<n?(t.pageWidth=611.9,t.pageHeight=791.9):(t.pageWidth=791.9,t.pageHeight=611.9):"tabloid"===e?i<n?(t.pageWidth=791.9,t.pageHeight=1223.9):(t.pageWidth=1223.9,t.pageHeight=791.9):"legal"===e?i<n?(t.pageWidth=611.9,t.pageHeight=1007.9):(t.pageWidth=1007.9,t.pageHeight=611.9):"statement"===e?i<n?(t.pageWidth=396,t.pageHeight=611.9):(t.pageWidth=611.9,t.pageHeight=396):"executive"===e?i<n?(t.pageWidth=521.9,t.pageHeight=755.9):(t.pageWidth=755.9,t.pageHeight=521.9):"a3"===e?i<n?(t.pageWidth=841.8,t.pageHeight=1190.4):(t.pageWidth=1190.4,t.pageHeight=841.8):"a4"===e?i<n?(t.pageWidth=595.2,t.pageHeight=841.8):(t.pageWidth=841.8,t.pageHeight=595.2):"a5"===e?i<n?(t.pageWidth=419.5,t.pageHeight=595.2):(t.pageWidth=595.2,t.pageHeight=419.5):"b4"===e?i<n?(t.pageWidth=728.4,t.pageHeight=1031.7):(t.pageWidth=1031.7,t.pageHeight=728.4):"b5"===e&&(i<n?(t.pageWidth=515.8,t.pageHeight=728.4):(t.pageWidth=728.4,t.pageHeight=515.8)),this.onApplySectionFormat(void 0,t)},e.prototype.updateListItemsTillEnd=function(e,i){for(var n=i?this.documentHelper.selection.getNextRenderedBlock(e):e;!t.isNullOrUndefined(n)&&!this.documentHelper.isTextInput;)this.updateRenderedListItems(n),n=n.getSplitWidgets().pop().nextRenderedWidget},e.prototype.updateWholeListItems=function(e){this.documentHelper.renderedLists.clear(),this.documentHelper.renderedLevelOverrides=[];for(var i,n=e.bodyWidget.index,r=0;r<this.documentHelper.pages.length;r++){var o=this.documentHelper.pages[r];if(o.bodyWidgets[0].index===n&&(i=this.getNextBlockForList(o.bodyWidgets[0].firstChild),!t.isNullOrUndefined(i)))break}do{if(this.updateListItems(i,e))break;i=i.getSplitWidgets().pop().nextRenderedWidget,t.isNullOrUndefined(i)||(i=this.getNextBlockForList(i))}while(i)},e.prototype.getNextBlockForList=function(e){if(e instanceof fe&&this.documentHelper.layout.isFirstElementWithPageBreak(e)){var t=e.nextRenderedWidget;if(t.equals(e))return t}return e},e.prototype.updateListItems=function(e,t){return e instanceof fe?this.updateListItemsForPara(e,t):this.updateListItemsForTable(e,t)},e.prototype.updateListItemsForTable=function(e,t){if(t instanceof ve&&e.equals(t))return!0;var i=e.firstChild;do{if(this.updateListItemsForRow(i,t))return!0;i=i.getSplitWidgets().pop().nextRenderedWidget}while(i);return!1},e.prototype.updateListItemsForRow=function(e,t){if(t.isInsideTable&&-1!==e.childWidgets.indexOf(this.documentHelper.selection.getContainerCell(t.associatedCell)))return!0;var i=e.firstChild;do{this.updateListItemsForCell(i,t),i=i.nextRenderedWidget}while(i);return!1},e.prototype.updateListItemsForCell=function(e,t){if(0!==e.childWidgets.length){var i=e.firstChild;do{this.updateListItems(i,t),i=i.getSplitWidgets().pop().nextRenderedWidget}while(i)}},e.prototype.updateRenderedListItems=function(e){e instanceof fe?this.updateRenderedListItemsForPara(e):this.updateRenderedListItemsForTable(e)},e.prototype.updateRenderedListItemsForTable=function(e){var t=e.firstChild;do{this.updateRenderedListItemsForRow(t),t=t.getSplitWidgets().pop().nextRenderedWidget}while(t)},e.prototype.updateRenderedListItemsForRow=function(e){var t=e.firstChild;do{this.updateRenderedListItemsForCell(t),t=t.nextRenderedWidget}while(t)},e.prototype.updateRenderedListItemsForCell=function(e){if(0!==e.childWidgets.length){var t=e.firstChild;do{this.updateRenderedListItems(t),t=t.getSplitWidgets().pop().nextRenderedWidget}while(t)}},e.prototype.updateListItemsForPara=function(e,i){if(e.equals(i))return!0;var n=void 0,r=0;if(t.isNullOrUndefined(e.paragraphFormat)||t.isNullOrUndefined(e.paragraphFormat.listFormat)||(n=this.documentHelper.getListById(e.paragraphFormat.listFormat.listId),r=e.paragraphFormat.listFormat.listLevelNumber),!t.isNullOrUndefined(n)&&!t.isNullOrUndefined(this.documentHelper.getAbstractListById(n.abstractListId))&&!t.isNullOrUndefined(this.documentHelper.getAbstractListById(n.abstractListId).levels[r])){var o=this.documentHelper.layout.getListLevel(n,r);this.updateListNumber(o,e,!1)}return!1},e.prototype.updateRenderedListItemsForPara=function(e){if(!t.isNullOrUndefined(this.documentHelper.getListById(e.paragraphFormat.listFormat.listId))){var i=this.documentHelper.getListById(e.paragraphFormat.listFormat.listId),n=e.paragraphFormat.listFormat.listLevelNumber;if(!t.isNullOrUndefined(i)&&!t.isNullOrUndefined(this.documentHelper.getAbstractListById(i.abstractListId))&&!t.isNullOrUndefined(this.documentHelper.getAbstractListById(i.abstractListId).levels[e.paragraphFormat.listFormat.listLevelNumber])){var r=this.documentHelper.layout.getListLevel(i,n);this.updateListNumber(r,e,!0)}}},e.prototype.updateListNumber=function(e,i,n){if("Bullet"!==e.listLevelPattern){var r=void 0;if(i.childWidgets.length>0){var o=i.childWidgets[0];o.children.length>0&&(r=i.paragraphFormat.bidi?o.children[o.children.length-1]:o.children[0])}if(!t.isNullOrUndefined(r)&&r instanceof Ke){var s=this.documentHelper.layout.getListNumber(i.paragraphFormat.listFormat);if(n){var a=r.width;r.text=s;var l=this.documentHelper.textHelper.getTextSize(r,r.characterFormat);l>a&&(r.width=l)}}}},e.prototype.getOffsetValue=function(e){if(this.startParagraph){t=e.getLineInfoBasedOnParagraph(this.startParagraph,this.startOffset);e.start.setPositionFromLine(t.line,t.offset)}if(e.start.updatePhysicalPosition(!0),e.isEmpty)e.end.setPositionInternal(e.start);else{if(this.endParagraph){var t=e.getLineInfoBasedOnParagraph(this.endParagraph,this.endOffset);e.end.setPositionFromLine(t.line,t.offset)}e.end.updatePhysicalPosition(!0)}},e.prototype.setPositionParagraph=function(e,t,i){var n=this.documentHelper.selection,r=n.getLineInfoBasedOnParagraph(e,t);n.start.setPositionFromLine(r.line,r.offset),n.end.setPositionInternal(n.start),i||n.fireSelectionChanged(!0)},e.prototype.setPositionForCurrentIndex=function(e,t){var i=this.selection.getParagraph({index:t}),n=this.selection.getLineInfoBasedOnParagraph(i.paragraph,i.offset);e.setPositionForLineWidget(n.line,n.offset)},e.prototype.insertPageNumber=function(e){var i="PAGE "+(e=t.isNullOrUndefined(e)?"":" \\*"+e)+" \\* MERGEFORMAT";this.createFields(i)},e.prototype.insertPageCount=function(e){var i="NUMPAGES "+(e=t.isNullOrUndefined(e)?"":" *"+e)+" * MERGEFORMAT";this.createFields(i)},e.prototype.createFields=function(e){var t=new fe,i=new we(t),n=new xe(0);i.children.push(n);var r=new We;r.fieldBegin=n,r.text="1";var o=new Ie;o.text=e,i.children.push(o);var s=new xe(2);s.fieldBegin=n,n.fieldSeparator=s,i.children.push(s),i.children.push(r);var a=new xe(1);a.fieldBegin=n,a.fieldSeparator=s,s.fieldEnd=a,n.fieldEnd=a,i.children.push(a),n.line=i,t.childWidgets.push(i),this.documentHelper.fields.push(n);var l=new pe;l.sectionFormat=new b(l),l.childWidgets.push(t),this.pasteContentsInternal([l],!1)},e.prototype.insertBookmark=function(e){if(this.documentHelper.bookmarks.containsKey(e)){var t=this.documentHelper.bookmarks.get(e);t.line.children.splice(t.line.children.indexOf(t),1),t.reference.line.children.splice(t.reference.line.children.indexOf(t.reference),1),this.documentHelper.bookmarks.remove(e)}var i=new ke(0);i.name=e;var n=new ke(1);n.name=e,i.reference=n,n.reference=i,this.initComplexHistory("InsertBookmark"),this.insertElements([n],[i]),this.editorHistory&&this.editorHistory.updateComplexHistoryInternal(),this.documentHelper.owner.enableHeaderAndFooter&&this.updateHeaderFooterWidget(),this.documentHelper.bookmarks.add(e,i),this.selection.start.setPositionForSelection(i.line,i,1,this.selection.start.location),this.selection.end.setPositionForSelection(n.line,n,0,this.selection.end.location),this.selection.fireSelectionChanged(!0),this.fireContentChange()},e.prototype.deleteBookmark=function(e){var t=this.documentHelper.bookmarks.get(e);if(t instanceof ke){t.reference;this.initHistory("DeleteBookmark"),this.editorHistory&&(this.editorHistory.currentBaseHistoryInfo.setBookmarkInfo(t),this.editorHistory.updateHistory()),this.deleteBookmarkInternal(t)}this.fireContentChange()},e.prototype.deleteBookmarkInternal=function(e){var i=e.previousNode;i instanceof xe&&0===i.fieldType&&!t.isNullOrUndefined(i.formFieldData)&&(i.formFieldData.name=""),this.documentHelper.bookmarks.remove(e.name),e.line.children.splice(e.indexInOwner,1),t.isNullOrUndefined(e.reference)||e.reference.line.children.splice(e.reference.indexInOwner,1);var n=e.line.paragraph;if(e.line.paragraph.isInHeaderFooter){var r=void 0;n.containerWidget instanceof be?r=n.containerWidget.getContainerTable().containerWidget:n.containerWidget instanceof ue&&(r=n.containerWidget),this.updateHeaderFooterWidget(r)}},e.prototype.getSelectionInfo=function(){var e=this.selection.start,t=this.selection.end;this.selection.isForward||(e=this.selection.end,t=this.selection.start),t.offset===this.selection.getLineLength(t.currentWidget)+1&&this.selection.isParagraphLastLine(t.currentWidget)||(t.offset+=1);var i=this.selection.getParagraphInfo(e),n=this.selection.getHierarchicalIndex(i.paragraph,i.offset.toString());return i=this.selection.getParagraphInfo(t),{start:n,end:this.selection.getHierarchicalIndex(i.paragraph,i.offset.toString())}},e.prototype.insertElements=function(e,i){var n=this.getSelectionInfo();t.isNullOrUndefined(i)||this.insertElementsInternal(this.selection.getTextPosBasedOnLogicalIndex(n.start),i),t.isNullOrUndefined(e)||this.insertElementsInternal(this.selection.getTextPosBasedOnLogicalIndex(n.end),e)},e.prototype.insertElementsInternal=function(e,t,i){this.selection.selectPosition(e,e),this.initHistory("InsertElements"),this.updateInsertPosition();var n=0,r=this.selection.getParagraphInfo(this.selection.start);if(this.selection.start.paragraph.isEmpty()){var o=this.selection.start.paragraph;o.childWidgets[0].children.push(t[0]),t[0].line=o.childWidgets[0],t[0].linkFieldCharacter(this.documentHelper),this.documentHelper.layout.reLayoutParagraph(o,0,0),this.setPositionParagraph(r.paragraph,r.offset+length,!0),e.setPositionForSelection(t[0].line,t[0],t[0].length,this.selection.start.location),this.selection.selectPosition(e,e)}else{var s=this.selection.start.currentWidget.getInline(this.documentHelper.selection.start.offset,n),a=s.element;n=s.index;var l=t[0];this.insertElementInternal(a,l,n,void 0,!0);for(var d=l.indexInOwner,h=l,c=1;c<t.length;c++)h=t[c],l.line.children.splice(d+c,0,h);e.setPositionForSelection(h.line,h,h.length,this.selection.start.location),this.selection.selectPosition(e,e)}this.editorHistory&&(this.checkEndPosition()&&this.updateHistoryPosition(this.selection.start,!1),this.editorHistory.updateHistory())},e.prototype.getCommentElementBox=function(e){var t=e.split(";"),i=this.documentHelper.comments[parseInt(t[1],10)];return t.length>2&&""!==t[2]?i.replyComments[parseInt(t[2],10)]:i},e.prototype.getBlock=function(e){var t=this.selection.getBodyWidget(e);return this.getBlockInternal(t,e)},e.prototype.getBlockInternal=function(e,i){if(""!==i.index&&!t.isNullOrUndefined(i)){var n=i.index.indexOf(";"),r=i.index.substring(0,n);i.index=i.index.substring(n).replace(";","");var o=e;n=parseInt(r,10);var s=this.selection.getBlockByIndex(e,n);if(!s)return{node:o,position:i};var a=s;if(!(i.index.indexOf(";")>=0))return{node:a,position:i};if(a instanceof fe)return i.index.indexOf(";")>=0&&(i.index="0"),{node:a,position:i};if(a instanceof he){var l=this.getBlockInternal(a,i);return{node:t.isNullOrUndefined(l)?void 0:l.node,position:t.isNullOrUndefined(l)?void 0:l.position}}return{node:o,position:i}}},e.prototype.updateHistoryPosition=function(e,i){if(this.editorHistory&&!t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)){var n=void 0;if(e instanceof Nt){var r=this.selection.getParagraphInfo(e);n=this.selection.getHierarchicalIndex(r.paragraph,r.offset.toString())}else n=e;i?this.editorHistory.currentBaseHistoryInfo.insertPosition=n:this.editorHistory.currentBaseHistoryInfo.endPosition=n}},e.prototype.applyBorders=function(e){this.initHistory("Borders");var t=this.selection.isForward?this.selection.start:this.selection.end,i=this.selection.isForward?this.selection.end:this.selection.start,n=t.paragraph.associatedCell.ownerTable;if(n=n.combineWidget(this.owner.viewer),this.editorHistory)this.cloneTableToHistoryInfo(n);t.paragraph.associatedCell;var r,o=i.paragraph.associatedCell,s=this.getBorder(e.borderColor,e.lineWidth,e.borderStyle);if(this.selection.isEmpty)"OutsideBorders"!==e.type&&"AllBorders"!==e.type&&"LeftBorder"!==e.type||o.cellFormat.borders.left.copyFormat(s),"OutsideBorders"!==e.type&&"AllBorders"!==e.type&&"TopBorder"!==e.type||o.cellFormat.borders.top.copyFormat(s),"OutsideBorders"!==e.type&&"AllBorders"!==e.type&&"RightBorder"!==e.type||o.cellFormat.borders.right.copyFormat(s),"OutsideBorders"!==e.type&&"AllBorders"!==e.type&&"BottomBorder"!==e.type||o.cellFormat.borders.bottom.copyFormat(s),"AllBorders"!==e.type&&"InsideBorders"!==e.type&&"InsideVerticalBorder"!==e.type||o.cellFormat.borders.vertical.copyFormat(s),"AllBorders"!==e.type&&"InsideBorders"!==e.type&&"InsideHorizontalBorder"!==e.type||o.cellFormat.borders.horizontal.copyFormat(s),"NoBorder"===e.type&&this.clearAllBorderValues(o.cellFormat.borders);else{if("OutsideBorders"===e.type||"TopBorder"===e.type)for(var a=this.getTopBorderCellsOnSelection(),l=0;l<a.length;l++)a[l].cellFormat.borders.top.copyFormat(s);if("OutsideBorders"===e.type||"LeftBorder"===e.type)for(var a=this.getLeftBorderCellsOnSelection(),l=0;l<a.length;l++)a[l].cellFormat.borders.left.copyFormat(s);if("OutsideBorders"===e.type||"RightBorder"===e.type)for(var a=this.getRightBorderCellsOnSelection(),l=0;l<a.length;l++)a[l].cellFormat.borders.right.copyFormat(s);if("OutsideBorders"===e.type||"BottomBorder"===e.type)for(var a=this.getBottomBorderCellsOnSelection(),l=0;l<a.length;l++)a[l].cellFormat.borders.bottom.copyFormat(s)}if("BottomBorder"===e.type||"AllBorders"===e.type||"OutsideBorders"===e.type||"NoBorder"===e.type){r=this.getAdjacentCellToApplyBottomBorder();for(l=0;l<r.length;l++){d=r[l];"NoBorder"===e.type?d.cellFormat.borders.top.copyFormat(this.clearBorder()):d.cellFormat.borders.top.copyFormat(s)}}if("AllBorders"===e.type||"OutsideBorders"===e.type||"RightBorder"===e.type||"NoBorder"===e.type){r=this.getAdjacentCellToApplyRightBorder();for(l=0;l<r.length;l++){var d=r[l];"NoBorder"===e.type?d.cellFormat.borders.left.copyFormat(this.clearBorder()):d.cellFormat.borders.left.copyFormat(s)}}"AllBorders"!==e.type&&"NoBorder"!==e.type||this.applyAllBorders(s,e.type),"InsideBorders"!==e.type&&"InsideVerticalBorder"!==e.type&&"InsideHorizontalBorder"!==e.type&&"NoBorder"!==e.type||this.applyInsideBorders(s,e.type,n),this.updateGridForTableDialog(n,!1),this.reLayout(this.selection,!1),this.editorHistory.updateHistory()},e.prototype.applyAllBorders=function(e,t){for(var i=this.selection.getSelectedCells(),n=0;n<i.length;n++)"NoBorder"===t?(i[n].cellFormat.borders.left.copyFormat(this.clearBorder()),i[n].cellFormat.borders.right.copyFormat(this.clearBorder()),i[n].cellFormat.borders.top.copyFormat(this.clearBorder()),i[n].cellFormat.borders.bottom.copyFormat(this.clearBorder())):(i[n].cellFormat.borders.left.copyFormat(e),i[n].cellFormat.borders.right.copyFormat(e),i[n].cellFormat.borders.top.copyFormat(e),i[n].cellFormat.borders.bottom.copyFormat(e))},e.prototype.applyInsideBorders=function(e,t,i){for(var n=this.selection.getSelectedCells(),r=0;r<n.length;r++){var o=n[r],s=o.ownerRow===n[n.length-1].ownerRow,a=o.columnIndex+o.cellFormat.columnSpan-1===n[n.length-1].columnIndex;if("NoBorder"===t?(o.cellFormat.borders.right.copyFormat(this.clearBorder()),o.cellFormat.borders.bottom.copyFormat(this.clearBorder())):(a||"InsideHorizontalBorder"===t||o.cellFormat.borders.right.copyFormat(e),s||"InsideVerticalBorder"===t||o.cellFormat.borders.bottom.copyFormat(e)),!s&&"InsideVerticalBorder"!==t){var l=o.ownerRow.rowIndex+o.cellFormat.rowSpan,d=i.childWidgets[l];if(d)for(var h=this.getAdjacentBottomBorderOnEmptyCells(d,o,!0),c=0;c<h.length;c++)"NoBorder"===t?h[c].cellFormat.borders.top.copyFormat(this.clearBorder()):h[c].cellFormat.borders.top.copyFormat(e)}if(!a&&"InsideHorizontalBorder"!==t)for(var p=this.getSelectedCellsNextWidgets(o,i),u=0;u<p.length;u++)"NoBorder"===t?p[u].cellFormat.borders.left.copyFormat(this.clearBorder()):p[u].cellFormat.borders.left.copyFormat(e)}},e.prototype.getTopBorderCellsOnSelection=function(){for(var e=(this.selection.isForward?this.selection.start:this.selection.end).paragraph.associatedCell,t=[],i=this.selection.getSelectedCells(),n=0;n<i.length;n++)i[n].ownerRow===e.ownerRow&&t.push(i[n]);return t},e.prototype.getLeftBorderCellsOnSelection=function(){for(var e=(this.selection.isForward?this.selection.start:this.selection.end).paragraph.associatedCell,t=this.selection.getSelectedCells(),i=[],n=0;n<t.length;n++)t[n].columnIndex===e.columnIndex&&i.push(t[n]);return i},e.prototype.getRightBorderCellsOnSelection=function(){for(var e=this.selection.getSelectedCells(),t=[],i=0;i<e.length;i++)e[i].columnIndex+e[i].cellFormat.columnSpan-1===e[e.length-1].columnIndex&&t.push(e[i]);return t},e.prototype.getBottomBorderCellsOnSelection=function(){for(var e=(this.selection.isForward?this.selection.end:this.selection.start).paragraph.associatedCell,t=this.selection.getSelectedCells(),i=[],n=0;n<t.length;n++)t[n].ownerRow===e.ownerRow&&i.push(t[n]);return i},e.prototype.clearAllBorderValues=function(e){var t=this.clearBorder();e.bottom.copyFormat(t),e.left.copyFormat(t),e.right.copyFormat(t),e.top.copyFormat(t),e.vertical.copyFormat(t),e.horizontal.copyFormat(t)},e.prototype.clearBorder=function(){var e=new T;return e.lineStyle="Cleared",e},e.prototype.getAdjacentCellToApplyBottomBorder=function(){var e=[],t=this.selection.start,i=this.selection.end;this.selection.isForward||(t=this.selection.end,i=this.selection.start);var n=t.paragraph.associatedCell.ownerTable;n=n.combineWidget(this.owner.viewer);var r=t.paragraph.associatedCell,o=i.paragraph.associatedCell,s=o.ownerRow.rowIndex+o.cellFormat.rowSpan,a=n.childWidgets[s];if(a)if(o.cellFormat.columnSpan>1)for(l=o.columnIndex;l<o.columnIndex+o.cellFormat.columnSpan;l++)e.push(a.childWidgets[l]);else if(e=this.getAdjacentBottomBorderOnEmptyCells(a,o),!this.selection.isEmpty)for(var l=0;l<a.childWidgets.length;l++){var d=a.childWidgets[l].columnIndex;d>=r.columnIndex&&d<=o.columnIndex&&e.push(a.childWidgets[l])}return e},e.prototype.getAdjacentBottomBorderOnEmptyCells=function(e,t,i){var n=[];if(t.cellFormat.columnSpan>1)for(r=t.columnIndex;r<t.columnIndex+t.cellFormat.columnSpan;r++)n.push(e.childWidgets[r]);else if(this.selection.isEmpty||i)for(var r=0;r<e.childWidgets.length;r++)e.childWidgets[r].columnIndex===t.columnIndex&&n.push(e.childWidgets[r]);return n},e.prototype.getAdjacentCellToApplyRightBorder=function(){var e=[],t=this.selection.start,i=this.selection.end;this.selection.isForward||(t=this.selection.end,i=this.selection.start);var n=t.paragraph.associatedCell.ownerTable;n=n.combineWidget(this.owner.viewer);t.paragraph.associatedCell,i.paragraph.associatedCell;if(this.selection.isEmpty){var r=t.paragraph.associatedCell;e=this.getSelectedCellsNextWidgets(r,n)}else for(var o=this.getRightBorderCellsOnSelection(),s=0;s<o.length;s++){var a=o[s];e=e.concat(this.getSelectedCellsNextWidgets(a,n))}return e},e.prototype.getSelectedCellsNextWidgets=function(e,t){var i=[];if(e.nextWidget&&i.push(e.nextWidget),e.cellFormat.rowSpan>1)for(var n=e.ownerRow.rowIndex+e.cellFormat.rowSpan,r=e.ownerRow.rowIndex+1;r<n;r++){var o=t.childWidgets[r];if(o)for(var s=0;s<o.childWidgets.length;s++)o.childWidgets[s].columnIndex===e.nextWidget.columnIndex&&i.push(o.childWidgets[s])}return i},e.prototype.getBorder=function(e,t,i){var n=new T;return n.color=e||"#000000",n.lineWidth=t||1,n.lineStyle=i||"Single",n},e.prototype.applyBordersInternal=function(e,i){t.isNullOrUndefined(e)||t.isNullOrUndefined(e)||(t.isNullOrUndefined(e.top)||this.applyBorder(e.top,i.top),t.isNullOrUndefined(e.bottom)||this.applyBorder(e.bottom,i.bottom),t.isNullOrUndefined(e.left)||this.applyBorder(e.left,i.left),t.isNullOrUndefined(e.right)||this.applyBorder(e.right,i.right),t.isNullOrUndefined(e.horizontal)||this.applyBorder(e.horizontal,i.horizontal),t.isNullOrUndefined(e.vertical)||this.applyBorder(e.vertical,i.vertical),t.isNullOrUndefined(e.diagonalUp)||this.applyBorder(e.diagonalUp,i.diagonalUp),t.isNullOrUndefined(e.diagonalDown)||this.applyBorder(e.diagonalDown,i.diagonalDown))},e.prototype.applyShading=function(e,i){t.isNullOrUndefined(i)||t.isNullOrUndefined(e)||(t.isNullOrUndefined(i.backgroundColor)||e.backgroundColor===i.backgroundColor||(e.backgroundColor=i.backgroundColor),t.isNullOrUndefined(i.foregroundColor)||e.foregroundColor===i.foregroundColor||(e.foregroundColor=i.foregroundColor),t.isNullOrUndefined(i.textureStyle)||e.textureStyle===i.textureStyle||(e.textureStyle=i.textureStyle))},e.prototype.applyBorder=function(e,i){t.isNullOrUndefined(e)||t.isNullOrUndefined(i)||(t.isNullOrUndefined(i.color)||e.color===i.color||(e.color=i.color),t.isNullOrUndefined(i.lineStyle)||e.lineStyle===i.lineStyle||(e.lineStyle=i.lineStyle),t.isNullOrUndefined(i.lineWidth)||e.lineWidth===i.lineWidth||(e.lineWidth=i.lineWidth),t.isNullOrUndefined(i.shadow)||e.shadow===i.shadow||(e.shadow=i.shadow),t.isNullOrUndefined(i.space)||e.space===i.space||(e.space=i.space))},e.prototype.onTableFormat=function(e,i){if(!t.isNullOrUndefined(this.selection.tableFormat)){t.isNullOrUndefined(i)&&(i=!1),this.documentHelper.owner.isShiftingEnabled=!0,this.editorHistory.initializeHistory("TableFormat");var n=this.selection.start.paragraph.associatedCell.ownerTable.combineWidget(this.owner.viewer);if(i)for(var r=0;r<n.childWidgets.length;r++)for(var o=n.childWidgets[r],s=0;s<o.childWidgets.length;s++)o.childWidgets[s].cellFormat.shading.copyFormat(e.shading);this.applyTableFormat(n,void 0,e),this.reLayout(this.selection,!1)}},e.prototype.applyTableFormat=function(e,t,i){this.applyTablePropertyValue(this.documentHelper.selection,void 0,i,e)},e.prototype.applyTablePropertyValue=function(e,i,n,r){var o=r.tableFormat;if(t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)||(n=this.editorHistory.currentBaseHistoryInfo.addModifiedTableProperties(o,i,n)),n instanceof U)return void(t.isNullOrUndefined(i)&&this.handleTableFormat(o,n));"preferredWidth"===i?o.preferredWidth=n:"leftIndent"===i?o.leftIndent=n:"tableAlignment"===i?o.tableAlignment=n:"cellSpacing"===i?o.cellSpacing=n:"leftMargin"===i?o.leftMargin=n:"rightMargin"===i?o.rightMargin=n:"topMargin"===i?o.topMargin=n:"bottomMargin"===i?o.bottomMargin=n:"preferredWidthType"===i?o.preferredWidthType=n:"bidi"===i&&(o.bidi=n),"shading"===i?o.shading=n:"borders"===i&&(o.borders=n)},e.prototype.handleTableFormat=function(e,i){(this.isBordersAndShadingDialog||this.editorHistory.isUndoing||this.editorHistory.isRedoing)&&(t.isNullOrUndefined(e.borders)||this.applyBordersInternal(e.borders,i.borders),t.isNullOrUndefined(e.shading)||this.applyShading(e.shading,i.shading)),this.isBordersAndShadingDialog||(i.hasValue("bidi")&&i.bidi!==e.bidi&&(e.bidi=i.bidi),i.hasValue("preferredWidth")&&i.preferredWidth!==e.preferredWidth&&(e.preferredWidth=i.preferredWidth),i.hasValue("preferredWidthType")&&i.preferredWidthType!==e.preferredWidthType&&(e.preferredWidthType=i.preferredWidthType),i.hasValue("tableAlignment")&&i.tableAlignment!==e.tableAlignment&&(e.tableAlignment=i.tableAlignment),i.hasValue("leftIndent")&&i.leftIndent!==e.leftIndent&&(e.leftIndent=i.leftIndent)),this.updateGridForTableDialog(e.ownerBase,!1)},e.prototype.updateGridForTableDialog=function(e,t){e.tableHolder&&(e.updateRowIndex(0),e.calculateGrid(),e.isGridUpdated=!1),this.documentHelper.layout.reLayoutTable(e)},e.prototype.onRowFormat=function(e){if(!t.isNullOrUndefined(this.selection)&&!t.isNullOrUndefined(e)){this.editorHistory.initializeHistory("RowFormat"),this.documentHelper.owner.isShiftingEnabled=!0;var i=this.selection.isForward?this.selection.start:this.selection.end,n=this.selection.isForward?this.selection.end:this.selection.start;i.paragraph.associatedCell.ownerTable.combineWidget(this.owner.viewer);this.applyRowFormat(i.paragraph.associatedCell.ownerRow,i,n,void 0,e),this.reLayout(this.selection,!1)}},e.prototype.applyRowFormat=function(e,i,n,r,o){if(this.applyRowPropertyValue(this.documentHelper.selection,r,o,e),n.paragraph.associatedCell.ownerRow!==e){var s=e.nextWidget;t.isNullOrUndefined(s)||this.applyRowFormat(s,i,n,r,o)}},e.prototype.applyRowPropertyValue=function(e,i,n,r){var o=r.rowFormat;if(t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)||(n=this.editorHistory.currentBaseHistoryInfo.addModifiedRowProperties(o,i,n)),n instanceof I)return void(t.isNullOrUndefined(i)&&this.handleRowFormat(n,o));"heightType"===i?o.heightType=n:"height"===i?o.height=n:"isHeader"===i?o.isHeader=n:"allowBreakAcrossPages"===i&&(o.allowBreakAcrossPages=n),t.isNullOrUndefined(r.ownerTable)||this.layoutItemBlock(r.ownerTable,!0)},e.prototype.handleRowFormat=function(e,t){e.hasValue("allowBreakAcrossPages")&&e.allowBreakAcrossPages!==t.allowBreakAcrossPages&&(t.allowBreakAcrossPages=e.allowBreakAcrossPages),e.hasValue("isHeader")&&e.isHeader!==t.isHeader&&(t.isHeader=e.isHeader),e.hasValue("heightType")&&e.heightType!==t.heightType&&(t.heightType=e.heightType),e.hasValue("height")&&e.height!==t.height&&(t.height=e.height),this.updateGridForTableDialog(t.ownerBase.ownerTable,!0)},e.prototype.onCellFormat=function(e){t.isNullOrUndefined(this.selection)||t.isNullOrUndefined(e)||(this.editorHistory.initializeHistory("CellFormat"),this.updateFormatForCell(this.selection,void 0,e),this.reLayout(this.selection,!1))},e.prototype.updateCellMargins=function(e,t){var i=e.start,n=e.end;e.isForward||(i=e.end,n=e.start),this.initHistoryPosition(e,i),this.documentHelper.owner.cellOptionsDialogModule.applyCellMarginValue(i.paragraph.associatedCell.ownerRow,i,n,t)},e.prototype.updateFormatForCell=function(e,t,i){var n=e.start,r=e.end;e.isForward||(n=e.end,r=e.start);for(var o,s=n.paragraph.associatedCell,a=r.paragraph.associatedCell,l=s.ownerTable.combineWidget(this.owner.viewer),d=s.columnIndex;d<=a.columnIndex;d++){o=this.getSelectedCellInColumn(s.ownerTable,s.ownerRow.rowIndex,d,a.ownerRow.rowIndex);for(var h=0;h<o.length;h++)this.applyCellPropertyValue(this.documentHelper.selection,t,i,o[h].cellFormat)}this.updateGridForTableDialog(l,!1)},e.prototype.getSelectedCellInColumn=function(e,t,i,n){for(var r=[],o=t;o<=n;o++)for(var s=e.childWidgets[o],a=0;a<s.childWidgets.length;a++)s.childWidgets[a].columnIndex===i&&r.push(s.childWidgets[a]);return r},e.prototype.getColumnCells=function(e,t,i){for(var n=[],r=0;r<e.childWidgets.length;r++)for(var o=e.childWidgets[r],s=0;s<o.childWidgets.length;s++){var a=o.childWidgets[s];i?a.columnIndex+a.cellFormat.columnSpan===t&&n.push(a):a.columnIndex===t&&n.push(a)}return n},e.prototype.getTableWidth=function(e){return 0!==e.tableFormat.preferredWidth||"Percent"===e.tableFormat.preferredWidthType?"Auto"===e.tableFormat.preferredWidthType||"Point"===e.tableFormat.preferredWidthType?e.tableFormat.preferredWidth:0===e.tableFormat.preferredWidth?0:W.convertPixelToPoint(this.owner.viewer.clientArea.width)/100*e.tableFormat.preferredWidth:W.convertPixelToPoint(this.documentHelper.layout.getTableWidth(e))},e.prototype.applyCellPropertyValue=function(e,i,n,r){if(t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo)||(n=this.editorHistory.currentBaseHistoryInfo.addModifiedCellProperties(r,i,n)),n instanceof z)return t.isNullOrUndefined(i)&&this.handleCellFormat(n,r),n;"leftMargin"===i?r.leftMargin=n:"topMargin"===i?r.topMargin=n:"rightMargin"===i?r.rightMargin=n:"bottomMargin"===i?r.bottomMargin=n:"preferredWidth"===i?(r.preferredWidth=n,r.cellWidth=n):"cellWidth"===i?r.cellWidth=n:"columnSpan"===i?r.columnSpan=n:"rowSpan"===i?r.rowSpan=n:"preferredWidthType"===i?r.preferredWidthType=n:"verticalAlignment"===i&&(r.verticalAlignment=n),"shading"===i?r.shading=n:"borders"===i&&(r.borders=n)},e.prototype.handleCellFormat=function(e,i){t.isNullOrUndefined(e)||t.isNullOrUndefined(i)||(this.isBordersAndShadingDialog?(t.isNullOrUndefined(e.borders)||this.applyBordersInternal(i.borders,e.borders),t.isNullOrUndefined(e.shading)||this.applyShading(i.shading,e.shading)):(e.hasValue("preferredWidth")&&i.preferredWidth!==e.preferredWidth&&(i.preferredWidth=e.preferredWidth),e.hasValue("preferredWidthType")&&i.preferredWidthType!==e.preferredWidthType&&(i.preferredWidthType=e.preferredWidthType),e.hasValue("verticalAlignment")&&i.verticalAlignment!==e.verticalAlignment&&(i.verticalAlignment=e.verticalAlignment)))},e.prototype.destroy=function(){this.documentHelper=void 0,this.nodes=[]},e.prototype.updateToc=function(e){if(t.isNullOrUndefined(e)&&(e=this.selection.getTocFieldInternal()),this.documentHelper.layout.isTocField(e)){var i=this.selection.getFieldCode(e);-1!==i.toLocaleLowerCase().indexOf("toc")&&this.insertTableOfContents(this.validateTocSettings(this.getTocSettings(i,e)))}},e.prototype.getTocSettings=function(e,i){var n={};if(n.includePageNumber=!0,n.rightAlign=!0,"toc \\mergeformat"===e.toLowerCase())n.startLevel=1,n.endLevel=3;else for(var r=e.split("\\"),o=0;o<r.length;o++){var s=r[o];if(0!==s.length)switch(s[0]){case"o":if(t.isNullOrUndefined(s.match(/\d+/g)))n.startLevel=1,n.endLevel=9;else{var a=s.match(/\d+/g).map(Number);n.startLevel=a[0],n.endLevel=a[1]}break;case"h":n.includeHyperlink=!0;break;case"n":n.includePageNumber=!1;break;case"p":n.rightAlign=!1;break;case"u":n.includeOutlineLevels=!0;break;case"t":this.decodeTSwitch(n,s)}}var l=i.paragraph.paragraphFormat.getUpdatedTabs();return l.length>0&&(n.tabLeader=l[l.length-1].tabLeader),n.rightAlign&&t.isNullOrUndefined(n.tabLeader)&&(n.tabLeader="Dot"),n},e.prototype.decodeTSwitch=function(e,t){e.levelSettings={};for(var i=(t=(t=(t=(t=t.replace("t","")).replace('"',"")).replace('"',"")).trim()).split(","),n=0;n<i.length;n++)e.levelSettings[i[n]]=parseInt(i[n+1],10),n++},e.prototype.insertTableOfContents=function(e){this.isInsertingTOC=!0,this.initComplexHistory("TOC"),t.isNullOrUndefined(e)&&((e={}).startLevel=1,e.endLevel=3,e.includeHyperlink=!0,e.includeOutlineLevels=!0,e.includePageNumber=!0,e.rightAlign=!0,e.tabLeader="Dot");var i=void 0,r=void 0;"TableOfContents"===this.selection.contextType&&(i=this.selection.getTocFieldInternal()),i instanceof xe&&(this.selection.start.setPositionForSelection(i.line,i,0,this.selection.start.location),this.selection.end.setPositionForSelection(i.fieldEnd.line,i.fieldEnd,2,this.selection.end.location),this.delete()),r=this.constructTocFieldCode(e);var o=this.selection.start.isAtParagraphStart,s=this.selection.getParagraphInfo(this.selection.start),a=this.selection.getHierarchicalIndex(s.paragraph,s.offset.toString()),l=this.buildToc(this.validateTocSettings(e),r,!0,o);if(l.length>0){var d=new fe,h=new we(d);d.childWidgets.push(h);var c=0;o||(c=1);var p=l[c].childWidgets[0].children[0];this.appendEndField(p,h),l.push(d),this.appendEmptyPara(l)}else{var u=new t.L10n("documenteditor",this.owner.defaultLocale);u.setLocale(this.owner.locale),n.DialogUtility.alert({title:u.getConstant("No Headings"),content:u.getConstant("Add Headings"),showCloseIcon:!0,closeOnEscape:!0,position:{X:"center",Y:"center"},animationSettings:{effect:"Zoom"}})}this.setPositionForCurrentIndex(this.selection.start,a),this.selection.end.setPositionInternal(this.selection.start);var g=new pe;g.sectionFormat=new b(g),g.childWidgets=l,this.pasteContentsInternal([g],!1),this.isInsertingTOC=!1,this.updatePageRef(),this.editorHistory&&this.editorHistory.updateComplexHistoryInternal(),0===l.length&&(this.owner.editorHistory.undo(),this.owner.editorHistory.redoStack.pop())},e.prototype.appendEmptyPara=function(e){var t=new fe,i=new we(t);t.childWidgets.push(i),e.push(t)},e.prototype.constructTocFieldCode=function(e){var i="TOC";t.isNullOrUndefined(e.startLevel)||0===e.startLevel||t.isNullOrUndefined(e.endLevel)||0===e.endLevel||(i=i+' \\o "'+e.startLevel+"-"+e.endLevel+'"'),e.includePageNumber&&!e.rightAlign&&(i+=' \\p " "'),e.includePageNumber||(i+=" \\n"),e.includeHyperlink&&(i+=" \\h \\z"),e.includeOutlineLevels&&(i+=" \\u");var n=this.constructTSwitch(e);return n.length>6&&(i+=n),i},e.prototype.constructTSwitch=function(e){var i="";if(!t.isNullOrUndefined(e.levelSettings))for(var n=0,r=Object.keys(e.levelSettings);n<r.length;n++){var o=r[n];i=i+o+","+e.levelSettings[o].toString()+","}return i=i.slice(0,-1),i=' \\t "'+i+'"'},e.prototype.appendEndField=function(e,t){var i=new xe(1);if(i.fieldSeparator=e.fieldSeparator,e.fieldSeparator.fieldEnd=i,i.fieldBegin=e,i.fieldBegin.fieldEnd=i,i.line=t,e.revisions.length>0){var n=e.revisions[e.revisions.length-1];n.range.push(i),i.revisions.push(n)}t.children.push(i)},e.prototype.validateTocSettings=function(e){return(t.isNullOrUndefined(e.startLevel)||e.startLevel<1)&&(e.startLevel=1),(t.isNullOrUndefined(e.endLevel)||e.endLevel<e.endLevel)&&(e.endLevel=e.startLevel>3?e.startLevel:3),t.isNullOrUndefined(e.includeHyperlink)&&(e.includeHyperlink=!1),t.isNullOrUndefined(e.includePageNumber)&&(e.includePageNumber=!1),t.isNullOrUndefined(e.rightAlign)&&(e.rightAlign=!1),t.isNullOrUndefined(e.levelSettings)&&(e.levelSettings={}),e},e.prototype.buildToc=function(e,t,i,n){var r=this.documentHelper.pages[0].bodyWidgets[0],o=[];this.createHeadingLevels(e),e.includeOutlineLevels&&this.createOutlineLevels(e);for(var s=this.selection.start.paragraph.bodyWidget.sectionFormat,a=r.childWidgets[0];void 0!==a;){if(a instanceof fe&&(this.isHeadingStyle(a)||e.includeOutlineLevels&&this.isOutlineLevelStyle(a))){var l=this.insertTocBookmark(a);this.createTOCWidgets(a,o,t,l,e,i,n,s),i=!1}a=this.selection.getNextParagraphBlock(a.getSplitWidgets().pop())}return this.tocStyles={},o},e.prototype.createOutlineLevels=function(e){for(var i=e.startLevel;i<=e.endLevel;i++){var n="Level"+i.toString();t.isNullOrUndefined(this.tocStyles[n])&&(this.tocStyles[n]=i)}},e.prototype.createHeadingLevels=function(e){for(var i=e.startLevel;i<=e.endLevel;i++){var n="Heading "+i.toString();t.isNullOrUndefined(this.tocStyles[n])&&(this.tocStyles[n]=i)}if(!t.isNullOrUndefined(e.levelSettings))for(var r=0,o=Object.keys(e.levelSettings);r<o.length;r++){var s=o[r];this.tocStyles[s]=e.levelSettings[s]}},e.prototype.isHeadingStyle=function(e){var i=e.paragraphFormat.baseStyle;return void 0!==i&&!t.isNullOrUndefined(this.tocStyles[i.name])},e.prototype.isOutlineLevelStyle=function(e){var i=e.paragraphFormat.outlineLevel;return!t.isNullOrUndefined(this.tocStyles[i])},e.prototype.createTocFieldElement=function(e,t,i){var n=new xe(0);n.hasFieldEnd=!0,n.line=e,e.children.push(n);var r=new Ie;r.text=t,r.line=e,e.children.push(r);var o=new xe(2);return o.fieldBegin=n,o.fieldBegin.fieldSeparator=o,o.line=e,e.children.push(o),n},e.prototype.createTOCWidgets=function(e,i,n,r,o,s,a,l){var d=void 0,h=void 0,c=void 0,p=!1;if(1!==i.length||3!==i[0].childWidgets[0].children.length||t.isNullOrUndefined(s)||s){h=new fe;var u=void 0,g=e.paragraphFormat.baseStyle.name;u=o.includeOutlineLevels&&t.isNullOrUndefined(this.tocStyles[g])?e.paragraphFormat.outlineLevel:g;var m="Toc"+this.tocStyles[u],f=this.documentHelper.styles.findByName(m,"Paragraph");if(t.isNullOrUndefined(f)&&(this.documentHelper.owner.parser.parseStyle(JSON.parse(this.getCompleteStyles()),JSON.parse(this.documentHelper.preDefinedStyles.get(m)),this.documentHelper.styles),f=this.documentHelper.styles.findByName(m,"Paragraph")),h.paragraphFormat.applyStyle(f),o.rightAlign&&o.includePageNumber){var v=new F;v.position=l.pageWidth-(l.leftMargin+l.rightMargin),v.tabLeader=o.tabLeader,v.deletePosition=0,v.tabJustification="Right",h.paragraphFormat.tabs.push(v)}c=new we(h),h.childWidgets.push(c)}else c=i[0].childWidgets[0];void 0!==s&&s&&(t.isNullOrUndefined(a)||a||(this.appendEmptyPara(i),p=!0),this.createTocFieldElement(c,n));for(var y="",b=!1,w=e;w instanceof fe;){for(var C=0;C<w.childWidgets.length;C++)for(var x=w.childWidgets[C],P=0;P<x.children.length;P++){var T=x.children[P];if(!T.isPageBreak)if(T instanceof xe||T instanceof ke||b)T instanceof xe&&(0===T.fieldType?b=!0:2===T.fieldType&&(b=!1));else if(T instanceof Ie||T instanceof Ke){var S=T.text;-1!==S.indexOf("\t")&&(S=S.replace(new RegExp("\t","g")," ")),y+=S}}w=w.nextSplitWidget}if(""!==y){if(o.includeHyperlink&&void 0!==r)d=this.insertTocHyperlink(c,r,y);else{var I=new Ie;I.text=y,I.line=c,c.children.push(I)}if(o.includePageNumber&&void 0!==r){if(o.rightAlign){var N=new Oe;N.text="\t",N.line=c,c.children.push(N)}var E=this.insertTocPageNumber(r,c,o.rightAlign,e);this.appendEndField(E,c)}o.includeHyperlink&&void 0!==d&&this.appendEndField(d,c)}if(t.isNullOrUndefined(h)||""===y&&!s||i.push(h),this.owner.enableTrackChanges&&!t.isNullOrUndefined(h))if(1===i.length||p)this.insertRevisionForBlock(h,"Insertion",!0);else{var H=this.owner.revisionsInternal.changes[0];this.insertRevisionForBlock(h,"Insertion",!0,H)}},e.prototype.insertTocHyperlink=function(e,t,i){var n=' HYPERLINK \\l "'+t+'" ',r=this.createTocFieldElement(e,n,!0),o=new Ie;return o.text=i,o.line=e,e.children.push(o),r},e.prototype.insertTocPageNumber=function(e,t,i,n){var r=" PAGEREF"+e+" \\h ",o=this.createTocFieldElement(t,r,!0),s=(this.documentHelper.pages.indexOf(n.bodyWidget.page)+1).toString(),a=new We;return a.fieldBegin=o,i||(s=" "+s),a.text=s,a.line=t,t.children.push(a),this.pageRefFields[e]=a,o},e.prototype.updatePageRef=function(){for(var e=0,t=Object.keys(this.pageRefFields);e<t.length;e++){var i=t[e];if(this.documentHelper.bookmarks.containsKey(i)){var n=(this.documentHelper.bookmarks.get(i).paragraph.bodyWidget.page.index+1).toString(),r=this.pageRefFields[i];if(n!==r.text){r.text=n;var o=r.paragraph,s=o.childWidgets.indexOf(r.line),a=r.line.children.indexOf(r);this.documentHelper.layout.reLayoutParagraph(o,s,a)}}}},e.prototype.insertTocBookmark=function(e){var i=void 0;if(e.childWidgets.length>0){var n=e.getSplitWidgets(),r=n[0],o=n.pop(),s=r.childWidgets[0],a=o.childWidgets[o.childWidgets.length-1];if(void 0!==s&&void 0!==a){var l=s.children[0];if(l instanceof Ke||l instanceof pt)do{l=l.nextNode}while(l instanceof Ke||l instanceof pt);if(!t.isNullOrUndefined(l)&&l instanceof ke&&0===l.bookmarkType&&l.name.toLowerCase().match("^_toc"))return l.name;var d=a.children[a.children.length-1];void 0!==l&&void 0!==d&&(this.selection.start.setPositionForSelection(s,l,0,this.selection.start.location),this.selection.end.setPositionForSelection(a,d,d.length,this.selection.end.location),i=this.generateBookmarkName(),this.insertBookmark(i))}}return i},e.prototype.generateBookmarkName=function(){for(var e=10-(++this.tocBookmarkId).toString().length,t="";e-1>0;)t="0"+t,e--;return"_Toc"+t+this.tocBookmarkId},e.prototype.onCellContentAlignment=function(e,i){this.owner.isShiftingEnabled=!0;var n=this.owner.selection;if(n.isEmpty&&n.start.paragraph.isInsideTable){this.owner.editorHistory&&this.owner.editorHistory.initComplexHistory(n,"MultiSelection"),n.selectTableCell(),this.initHistory("CellContentVerticalAlignment");var r=n.start.paragraph.associatedCell.cellFormat;this.applyCellPropertyValue(n,"verticalAlignment",e,r),this.reLayout(n,!1),this.initHistory("TextAlignment"),this.updateParagraphFormat("textAlignment",i,!1),this.reLayout(this.owner.selection,!1),this.owner.editorHistory&&this.owner.editorHistory.updateComplexHistory()}else this.owner.editorHistory&&this.owner.editorHistory.initComplexHistory(n,"MultiSelection"),t.isNullOrUndefined(n.getTable(n.start,n.end))||(this.updateSelectionTableFormat(n,"CellContentVerticalAlignment",e),this.reLayout(this.owner.selection,!1),this.initHistory("TextAlignment"),this.updateSelectionParagraphFormatting("textAlignment",i,!1),this.reLayout(n,!1)),this.owner.editorHistory&&this.owner.editorHistory.updateComplexHistory()},e.prototype.insertEditRangeElement=function(e){if(!this.documentHelper.isDocumentProtected&&!this.documentHelper.selection.isEmpty){this.initComplexHistory("RestrictEditing"),this.selection.skipEditRangeRetrieval=!0;var t=this.documentHelper.selection;this.selection.start,this.selection.end;if(this.selection.isForward||(this.selection.end,this.selection.start),t.start.paragraph.isInsideTable&&t.end.paragraph.isInsideTable&&t.start.paragraph.associatedCell.ownerTable.contains(t.end.paragraph.associatedCell)){var i=this.getOwnerCell(this.selection.isForward),n=this.getOwnerCell(!this.selection.isForward);if(i.rowIndex===n.rowIndex){for(var r=i.ownerRow.childWidgets.indexOf(i),o=i.ownerRow.childWidgets.indexOf(n),s=[],a=[],l=r;l<=o;l++){var d=this.addEditElement(e);d.columnFirst=l,d.columnLast=l,d.line=t.start.currentWidget;var h=d.editRangeEnd;h.line=t.end.currentWidget,s.push(d),a.push(h)}this.insertElements(a,s);u=s[0].line.getOffset(s[0],1);this.selection.start.setPositionParagraph(s[0].line,u),u=a[0].line.getOffset(a[0],1),this.selection.end.setPositionParagraph(a[0].line,u),this.selection.fireSelectionChanged(!0),this.fireContentChange()}else{this.insertEditRangeInsideTable(i,n,e);var c=this.selection.getFirstParagraphInCell(i).childWidgets[0],p=this.selection.getLastParagraph(n).childWidgets[0],u=c.getOffset(c.children[0],1);this.selection.start.setPositionParagraph(c,u),u=p.getOffset(p.children[0],1),this.selection.end.setPositionParagraph(p,u),this.selection.fireSelectionChanged(!0),this.fireContentChange()}}else this.addRestrictEditingForSelectedArea(e);this.selection.skipEditRangeRetrieval=!1}},e.prototype.insertEditRangeInsideTable=function(e,t,i){var n=e.ownerTable,r=n.childWidgets.indexOf(t.ownerRow),o=n.childWidgets.indexOf(e.ownerRow),s=this.selection.getCellLeft(e.ownerRow,e),a=s+e.cellFormat.cellWidth,l=this.selection.getCellLeft(t.ownerRow,t),d=l+t.cellFormat.cellWidth,h=this.updateSelectedCellsInTable(s,a,l,d);s=h.start,a=h.end;for(var c=[],p=o;p<=r;p++){for(var u=n.childWidgets[p],g=-1,m=-1,f=0;f<u.childWidgets.length;f++){var v=u.childWidgets[f],y=this.selection.getCellLeft(u,v);this.checkCellWithInSelection(s,a,y)&&(-1===g&&(g=f),m=f)}for(var b=[],w=g;w<=m;w++){var C=0,x=void 0,F=void 0;w===g&&(x=u.childWidgets[g],F=this.selection.getFirstParagraphInCell(x).childWidgets[0]);var P=this.addEditElement(i);P.columnFirst=w,P.columnLast=w,P.line=F,P.line.children.splice(C,0,P),C++;var T=P.editRangeEnd;if(b.push(T),c.length>0&&w===m){for(N=0;N<c.length;N++)c[N].line=P.line,P.line.children.splice(C,0,c[N]),C++;c=[]}}if(c=b,p===r&&c.length>0)for(var S=u.childWidgets[m],I=this.selection.getLastParagraph(S).lastChild,C=I.children.length-1,N=0;N<c.length;N++)c[N].line=I,I.children.splice(C,0,c[N]),C++}},e.prototype.addRestrictEditingForSelectedArea=function(e){var t=this.addEditElement(e),i=t.editRangeEnd;this.editorHistory&&this.editorHistory.currentHistoryInfo&&(this.editorHistory.currentHistoryInfo.editRangeStart=t),this.insertElements([i],[t]),this.editorHistory&&this.editorHistory.updateComplexHistoryInternal();var n=t.line.getOffset(t,1);this.selection.start.setPositionParagraph(t.line,n),n=i.line.getOffset(i,1),this.selection.end.setPositionParagraph(i.line,n),this.selection.fireSelectionChanged(!0),this.fireContentChange()},e.prototype.addEditElement=function(e){var t=new Ye;"everyone"===e.toLocaleLowerCase()?t.group=e:t.user=e;var i=new Xe;return i.editRangeStart=t,t.editRangeEnd=i,this.editStartRangeCollection.push(t),this.addEditCollectionToDocument(),this.editStartRangeCollection=[],t},e.prototype.protect=function(e){this.documentHelper.isDocumentProtected=!0,this.documentHelper.protectionType=e,this.selection.highlightEditRegion(),this.editorHistory&&this.editorHistory.destroy()},e.prototype.addEditCollectionToDocument=function(){for(var e=0;e<this.editStartRangeCollection.length;e++){var t=this.editStartRangeCollection[e],i=""===t.user?t.group:t.user;if(this.documentHelper.editRanges.length>0&&this.documentHelper.editRanges.containsKey(i))this.documentHelper.editRanges.get(i).push(t);else{var n=[];n.push(t),this.documentHelper.editRanges.add(i,n)}}this.selection.updateEditRangeCollection()},e.prototype.updateRangeCollection=function(e,t){if(this.documentHelper.editRanges.length>0&&this.documentHelper.editRanges.containsKey(t))this.documentHelper.editRanges.get(t).push(e);else{var i=[];i.push(e),this.documentHelper.editRanges.add(t,i)}},e.prototype.removeUserRestrictions=function(e){if(this.selection.checkSelectionIsAtEditRegion()){this.selection.skipEditRangeRetrieval=!0;var t=this.selection.getEditRangeStartElement();this.initHistory("RemoveEditRange"),this.editorHistory&&(this.editorHistory.currentBaseHistoryInfo.setEditRangeInfo(t),this.editorHistory.updateHistory()),t.user!==e&&t.group!==e||this.removeUserRestrictionsInternal(t,e),this.selection.updateEditRangeCollection(),this.fireContentChange(),this.selection.skipEditRangeRetrieval=!1}},e.prototype.removeUserRestrictionsInternal=function(e,i){var n=i;t.isNullOrUndefined(i)&&(n=""===e.user?e.group:e.user);var r=this.documentHelper.editRanges.get(n).indexOf(e);this.documentHelper.editRanges.get(n).splice(r,1),0===this.documentHelper.editRanges.get(n).length&&this.documentHelper.editRanges.remove(n),e.removeEditRangeMark(),e.editRangeEnd.line.children.splice(e.editRangeEnd.indexInOwner,1),e.line.children.splice(e.indexInOwner,1)},e.prototype.removeAllEditRestrictions=function(){this.selection.skipEditRangeRetrieval=!0;for(var e=this.selection.start,t=this.selection.end,i=[],n=this.documentHelper.editRanges.keys,r=0;r<n.length;r++){i=this.documentHelper.editRanges.get(n[r]);for(var o=0;o<i.length;o++)i[o].editRangeEnd.line.children.splice(i[o].editRangeEnd.indexInOwner,1),i[o].line.children.splice(i[o].indexInOwner,1)}this.documentHelper.editRanges.clear(),this.selection.updateEditRangeCollection(),this.selection.start.setPositionInternal(e),this.selection.end.setPositionInternal(t),this.selection.editRegionHighlighters.clear(),this.owner.viewer.updateScrollBars(),this.selection.fireSelectionChanged(!1),this.selection.skipEditRangeRetrieval=!1},e.prototype.insertFormField=function(e){if(!t.isNullOrUndefined(this.selection.start)&&!this.owner.enableHeaderAndFooter){this.initHistory("InsertHyperlink");var i=!0;this.selection.isEmpty||(i=this.removeSelectedContents(this.selection)),i&&this.insertFormFieldInternal(e)}},e.prototype.insertFormFieldInternal=function(e){this.updateInsertPosition();var t=[],i=this.getCharacterFormat(this.selection),n=new H(void 0);n.copyFormat(i);var r=new xe(0);r.formFieldData=this.getFormFieldData(e),r.characterFormat.copyFormat(n),t.push(r);var o=new ke(0);o.characterFormat.copyFormat(n),r.formFieldData.name=this.getBookmarkName(e,"Insert",this.formFieldCounter),o.name=r.formFieldData.name,t.push(o);var s=new Ie;s.text=this.getFormFieldCode(e),t.push(s);var a=new xe(2);t.push(a);var l=new Ie;l.text="CheckBox"===e?String.fromCharCode(9744):this.documentHelper.textHelper.repeatChar(this.documentHelper.textHelper.getEnSpaceCharacter(),5),l.characterFormat.copyFormat(n),t.push(l);var d=new xe(1);d.characterFormat.copyFormat(n),t.push(d);var h=new ke(1);h.characterFormat.copyFormat(n),h.name=r.formFieldData.name,h.reference=o,o.reference=h,t.push(h),this.insertElement(t);this.selection.start.paragraph;d.linkFieldCharacter(this.documentHelper),-1===this.documentHelper.fields.indexOf(r)&&this.documentHelper.fields.push(r),-1===this.documentHelper.formFields.indexOf(r)&&this.documentHelper.formFields.push(r);var c=h.line.getOffset(h,1);this.selection.selects(h.line,c,!0),this.updateEndPosition(),this.reLayout(this.selection,!0)},e.prototype.getFormFieldData=function(e){switch(e){case"Text":return new Pe;case"CheckBox":return new Te;case"DropDown":return new Se}},e.prototype.setFormField=function(e,i){var n,r;t.isNullOrUndefined(i.format)?t.isNullOrUndefined(i.sizeType)?t.isNullOrUndefined(i.dropdownItems)||(n="DropDown",r=new Se):(n="CheckBox",r=new Te):(n="Text",r=new Pe),t.isNullOrUndefined(n)||t.isNullOrUndefined(r)||(r.name=e.formFieldData.name,r.copyFieldInfo(i),this.editFormField(n,r))},e.prototype.editFormField=function(e,i){var n=this.selection.getCurrentFormField();if(t.isNullOrUndefined(n)||t.isNullOrUndefined(n.formFieldData))return!1;this.initComplexHistory("FormField");var r,o;""!==i.name&&(n.formFieldData.name!==i.name&&this.documentHelper.bookmarks.containsKey(i.name)&&this.deleteBookmark(i.name),(r=new ke(0)).name=i.name,(o=new ke(1)).name=i.name,r.reference=o,o.reference=r),this.initHistory("InsertHyperlink"),this.editHyperlinkInternal=t.isNullOrUndefined(this.editorHistory)||this.editorHistory&&t.isNullOrUndefined(this.editorHistory.currentBaseHistoryInfo);var s=n.characterFormat.cloneFormat(),a=new H;a.copyFormat(s);var l=n.fieldSeparator.nextElement.characterFormat.cloneFormat(),d=n.line.getOffset(n,0);this.selection.start.setPositionParagraph(n.line,d);var h=n.fieldEnd;n.nextNode&&n.nextNode instanceof ke&&(h=n.nextNode.reference),d=h.line.getOffset(h,1),this.selection.end.setPositionParagraph(h.line,d),this.skipFieldDeleteTracking=!0,this.deleteSelectedContents(this.selection,!1),this.skipFieldDeleteTracking=!1,this.updateInsertPosition();var c=[],p=new xe(0);p.formFieldData=i,c.push(p),p.characterFormat.copyFormat(a),t.isNullOrUndefined(r)||c.push(r);var u=new Ie;u.text=this.getFormFieldCode(e),c.push(u);var g=new xe(2);g.characterFormat.copyFormat(a),c.push(g),(u=new Ie).characterFormat.copyFormat(l),u.text=this.getDefaultText(i),"CheckBox"===e?(u.characterFormat=p.characterFormat.cloneFormat(),"Exactly"===i.sizeType&&(u.characterFormat.fontSize=i.size)):i instanceof Pe&&""!==i.defaultValue&&("Text"===i.type?u.text=W.formatText(i.format,i.defaultValue):"Number"===i.type?u.text=W.formatNumber(i.format,i.defaultValue):u.text=W.formatDate(i.format,i.defaultValue)),c.push(u);var m=new xe(1);m.characterFormat.copyFormat(a),c.push(m);var f=m;t.isNullOrUndefined(o)||(f=o,c.push(o)),this.insertElement(c);this.selection.start.paragraph;m.linkFieldCharacter(this.documentHelper),-1===this.documentHelper.fields.indexOf(p)&&this.documentHelper.fields.push(p);var v=f.line.getOffset(f,1);return this.selection.selects(f.line,v,!0),this.updateEndPosition(),this.editorHistory&&this.editorHistory.currentBaseHistoryInfo&&this.editorHistory.updateHistory(),this.editorHistory&&this.editorHistory.currentHistoryInfo&&this.editorHistory.updateComplexHistory(),this.reLayout(this.selection,!0),this.editHyperlinkInternal=!1,this.nodes=[],!0},e.prototype.getDefaultText=function(e){var t="";return e instanceof Te?t=e.defaultValue?String.fromCharCode(9745):String.fromCharCode(9744):e instanceof Se?t=e.dropdownItems.length>0?e.dropdownItems[0]:this.documentHelper.textHelper.repeatChar(this.documentHelper.textHelper.getEnSpaceCharacter(),5):e instanceof Pe&&(t=""!==e.defaultValue?e.defaultValue:this.documentHelper.textHelper.repeatChar(this.documentHelper.textHelper.getEnSpaceCharacter(),5)),t},e.prototype.getFormFieldCode=function(e){switch(e){case"Text":return"FORMTEXT";case"CheckBox":return"FORMCHECKBOX";case"DropDown":return"FORMDROPDOWN"}},e.prototype.toggleCheckBoxFormField=function(e,t,i){var n=e.formFieldData;if(n instanceof Te&&n.enabled){if(this.initHistory("UpdateFormField"),this.editorHistory){var r=void 0;n instanceof Te&&(r=n.checked),this.editorHistory.currentBaseHistoryInfo.setFormFieldInfo(e,r),this.editorHistory.updateHistory()}n.checked=t?i:!n.checked;var o=e.fieldSeparator.nextNode;n.checked?o.text=String.fromCharCode(9745):o.text=String.fromCharCode(9744),this.owner.documentHelper.layout.reLayoutParagraph(e.line.paragraph,0,0),this.reLayout(this.selection,!1)}},e.prototype.updateFormField=function(e,t,i){var n=e.formFieldData;if(n){if(this.initHistory("UpdateFormField"),this.editorHistory){var r=void 0;n instanceof Pe?r=e.resultText:n instanceof Se&&(r=n.selectedIndex),this.editorHistory.currentBaseHistoryInfo.setFormFieldInfo(e,r),this.editorHistory.updateHistory()}this.updateFormFieldInternal(e,n,t,i)}},e.prototype.updateFormFieldInternal=function(e,t,i,n){if(t instanceof Pe){""===i&&(i=n?this.getDefaultText(t):this.documentHelper.textHelper.repeatChar(this.documentHelper.textHelper.getEnSpaceCharacter(),5));var r=i;"Text"===t.type&&""!==t.format&&(r=W.formatText(t.format,i)),this.updateFormFieldResult(e,r)}else if(t instanceof Se){var o=t.dropdownItems[i];t.selectedIndex=i,this.updateFormFieldResult(e,o)}var s=e.fieldEnd.line.getOffset(e.fieldEnd,1),a=new Nt(this.owner);a.setPositionParagraph(e.fieldEnd.line,s),this.documentHelper.selection.selectRange(a,a),this.reLayout(this.selection,!1)},e.prototype.updateFormFieldResult=function(e,t){for(var i=e.fieldSeparator.nextNode;!(i instanceof Ie)&&(i=i.nextNode)!==e.fieldEnd;);if(i instanceof Ie){i.text=t,i=i.nextNode;do{var n=e.line.children.indexOf(i);if(i instanceof Ie)i=i.nextNode,e.line.children.splice(n,1);else{if(i===e.fieldEnd)break;i=i.nextNode}}while(i!==e.fieldEnd)}this.owner.documentHelper.layout.reLayoutParagraph(e.line.paragraph,0,0)},e.prototype.checkBookmarkAvailability=function(e,t){for(var i=this.documentHelper.bookmarks,n=0;n<i.length;n++)if(i.containsKey(e))return!1;return!0},e.prototype.getBookmarkName=function(e,t,i){for(var n,r=!1;!1===r;)n=e+i,r=this.checkBookmarkAvailability(n,t),i+=1;return n},e.prototype.applyFormTextFormat=function(e){if(!t.isNullOrUndefined(e)){var i=this.getFormFieldText(e),n=i;i=W.formatText(e.formFieldData.format,i),this.applyTextFormatInternal(e,i),this.initHistory("FormTextFormat"),this.editorHistory&&(this.editorHistory.currentBaseHistoryInfo.setFormFieldInfo(e,n),this.editorHistory.updateHistory())}},e.prototype.insertSpaceInFormField=function(){if(this.documentHelper.isInlineFormFillProtectedMode&&this.selection.isInlineFormFillMode()){var e=this.getFormFieldText();0!==e.length&&"\r"!==e||(this.insertTextInternal(this.documentHelper.textHelper.repeatChar(this.documentHelper.textHelper.getEnSpaceCharacter(),5),!0),this.selection.selectTextElementStartOfField(this.selection.getCurrentFormField()))}},e.prototype.getFormFieldText=function(e){t.isNullOrUndefined(e)&&(e=this.selection.getCurrentFormField());var i=e.fieldSeparator;return this.getNextRenderedWidgetText(i)},e.prototype.getNextRenderedWidgetText=function(e){var i="";if(e instanceof xe&&2===e.fieldType){var n=e;do{if(!t.isNullOrUndefined(n)&&n instanceof Ie&&(i+=n.text),t.isNullOrUndefined(n.nextNode)){i+="\r";var r=n.paragraph.nextRenderedWidget;if(t.isNullOrUndefined(r))break;for(r instanceof ve&&(r=this.selection.getFirstParagraphBlock(r));r.isEmpty();)i+="\r",r=r.nextRenderedWidget;n=r.childWidgets[0].children[0]}else n=n.nextNode}while(!(n instanceof xe&&1===n.fieldType&&n===e.fieldEnd))}return i},e.prototype.applyTextFormatInternal=function(e,i){var n=e.fieldSeparator.nextElement,r=0;i=i.replace(/\r/g,"");do{if(!t.isNullOrUndefined(n)&&n instanceof Ie&&(n.text=i.slice(r,r+n.text.length),r+=n.length),t.isNullOrUndefined(n.nextElement))if(t.isNullOrUndefined(n.line.nextLine)){this.documentHelper.layout.layoutBodyWidgetCollection(n.paragraph.index,n.paragraph.bodyWidget,n.paragraph,!0);var o=n.paragraph.nextRenderedWidget;if(t.isNullOrUndefined(o))break;for(o instanceof ve&&(o=this.selection.getFirstParagraphBlock(o));o.isEmpty();)o=o.nextRenderedWidget;n=o.childWidgets[0].children[0]}else n=n.line.nextLine.children[0];else n=n.nextElement}while(!(n instanceof xe&&1===n.fieldType&&n.fieldBegin.formFieldData instanceof Pe));this.documentHelper.layout.layoutBodyWidgetCollection(n.paragraph.index,n.paragraph.bodyWidget,n.paragraph,!0),this.selection.isFormatUpdated=!0,this.reLayout(this.selection,!1),this.selection.isFormatUpdated=!1},e.prototype.constructCommentInitial=function(e){for(var t=e.split(" "),i="",n=0;n<t.length;n++)t[n].length>0&&""!==t[n]&&(i+=t[n][0]);return i},e.prototype.insertFootnote=function(){var e=new Ee;e.characterFormat.baselineAlignment="Superscript",e.footnoteType="Footnote",e.text="s";var t=new fe,i=new we(t),n=new Ie;n.characterFormat.baselineAlignment="Superscript",n.line=i,n.text="?",i.children.push(n);var r=new Ie;r.text=" ",r.line=i,i.children.push(r),t.childWidgets.push(i),t.footNoteReference=e,e.blocks.push(t),this.selection.isEmpty||this.selection.handleRightKey(),this.initInsertInline(e);var o;if(e.paragraph.bodyWidget.page.footnoteWidget)for(var s=0;s<e.paragraph.bodyWidget.page.footnoteWidget.childWidgets.length;s++)e.paragraph.bodyWidget.page.footnoteWidget.childWidgets[s].footNoteReference===e&&(o=e.paragraph.bodyWidget.page.footnoteWidget.childWidgets[s]);this.selection.start.setPositionForLineWidget(o.childWidgets[0],r.line.getOffset(r,e.text.length)),this.selection.end.setPositionInternal(this.selection.start),this.reLayout(this.selection,!1),this.separator("footnote"),this.continuationSeparator("footnote")},e.prototype.updateFootnoteCollection=function(e){if(-1===this.documentHelper.footnoteCollection.indexOf(e)){var t=!1;if(this.documentHelper.footnoteCollection.length>0)for(var i=this.selection.getElementPosition(e).startPosition,n=0;n<this.documentHelper.footnoteCollection.length;n++){var r=this.selection.getElementPosition(this.documentHelper.footnoteCollection[n]).startPosition;if(i.isExistBefore(r)){t=!0,this.documentHelper.footnoteCollection.splice(n,0,e);break}}t||this.documentHelper.footnoteCollection.push(e)}},e.prototype.insertEndnote=function(){this.documentHelper.layout.isEndnoteContentChanged=!0;var e=new Ee;e.characterFormat.baselineAlignment="Superscript",e.footnoteType="Endnote",e.text="s";var t=new fe,i=new we(t),n=new Ie;n.characterFormat.baselineAlignment="Superscript",n.line=i,n.text="?",i.children.push(n);var r=new Ie;r.text=" ",r.line=i,i.children.push(r),t.childWidgets.push(i),t.footNoteReference=e,e.blocks.push(t),this.selection.isEmpty||this.selection.handleRightKey(),this.initInsertInline(e);var o,s=this.documentHelper.pages.length,a=this.documentHelper.pages[s-1].bodyWidgets[0];if(a.page.endnoteWidget)for(var l=0;l<a.page.endnoteWidget.childWidgets.length;l++)a.page.endnoteWidget.childWidgets[l].footNoteReference===e&&(o=a.page.endnoteWidget.childWidgets[l]);this.selection.start.setPositionForLineWidget(o.childWidgets[0],n.line.getOffset(r,e.text.length)),this.selection.end.setPositionInternal(this.selection.start),this.reLayout(this.selection,!1),this.separator("endnote"),this.continuationSeparator("endnote"),this.documentHelper.layout.isEndnoteContentChanged=!1},e.prototype.updateEndnoteCollection=function(e){if(-1===this.documentHelper.endnoteCollection.indexOf(e)){var t=!1;if(this.documentHelper.endnoteCollection.length>0)for(var i=this.selection.getElementPosition(e).startPosition,n=0;n<this.documentHelper.endnoteCollection.length;n++){var r=this.selection.getElementPosition(this.documentHelper.endnoteCollection[n]).startPosition;if(i.isExistBefore(r)){t=!0,this.documentHelper.endnoteCollection.splice(n,0,e);break}}t||this.documentHelper.endnoteCollection.push(e);var o=this.documentHelper.pages.length;if(this.documentHelper.endnoteCollection.length>0){var s=!1,a=void 0,l=void 0,d=this.documentHelper.endnoteCollection.indexOf(e),h=1,c=void 0,p=this.documentHelper.pages[o-1].bodyWidgets[0];if(p.page.endnoteWidget)for(f=0;f<p.page.endnoteWidget.childWidgets.length;f++){var u=this.documentHelper.endnoteCollection.indexOf(p.page.endnoteWidget.childWidgets[f].footNoteReference);if(u>d&&u-d==1){h=f,s=!0;break}}if(a=e,p.page.endnoteWidget instanceof me&&"Endnote"===p.page.endnoteWidget.footNoteType)l=p.page.endnoteWidget;else{c=!0,(l=new me).footNoteType="Endnote",l.page=p.page;var g=new fe;g.characterFormat=new H,g.paragraphFormat=new P,g.index=0;var m=new we(g);g.childWidgets.push(m),l.childWidgets.push(g)}for(var f=0;f<a.blocks.length;f++)a.blocks[f];s?l.childWidgets.splice(h,0,a.blocks[0]):l.childWidgets.push(a.blocks[0]),h++,c&&(p.page.endnoteWidget=l),l.height+=0}}},e.prototype.separator=function(e){var t=new fe,i=new we(t),n=new Ie;n.characterFormat.fontColor="empty",n.line=i,n.text="",i.children.push(n),t.childWidgets.push(i),"footnote"===e&&this.documentHelper.footnotes.separator.length<1?this.documentHelper.footnotes.separator.push(t):"endnote"===e&&this.documentHelper.endnotes.separator.length<1&&this.documentHelper.endnotes.separator.push(t)},e.prototype.continuationSeparator=function(e){var t=new fe,i=new we(t),n=new Ie;n.characterFormat.fontColor="empty",n.line=i,n.text="",i.children.push(n),t.childWidgets.push(i),"footnote"===e&&this.documentHelper.footnotes.continuationSeparator.length<1?this.documentHelper.footnotes.continuationSeparator.push(t):"endnote"===e&&this.documentHelper.endnotes.continuationSeparator.length<1&&this.documentHelper.endnotes.continuationSeparator.push(t)},e}(),Vt=function(){function e(e,t){this.ownerListLevelIn=void 0,this.modifiedListLevelIn=void 0,this.ownerListLevel=e,this.modifiedListLevel=t}return Object.defineProperty(e.prototype,"ownerListLevel",{get:function(){return this.ownerListLevelIn},set:function(e){this.ownerListLevelIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"modifiedListLevel",{get:function(){return this.modifiedListLevelIn},set:function(e){this.modifiedListLevelIn=e},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){this.ownerListLevel=void 0,this.modifiedListLevel=void 0},e}(),_t=function(){function e(e,t){this.ownerFormatIn=void 0,this.modifiedFormatIn=void 0,this.ownerFormat=e,this.modifiedFormat=t}return Object.defineProperty(e.prototype,"ownerFormat",{get:function(){return this.ownerFormatIn},set:function(e){this.ownerFormatIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"modifiedFormat",{get:function(){return this.modifiedFormatIn},set:function(e){this.modifiedFormatIn=e},enumerable:!0,configurable:!0}),e.prototype.destroy=function(){this.ownerFormat=void 0,this.modifiedFormat.destroy(),this.modifiedFormat=void 0},e}(),jt=function(){function e(e,t){this.startingPoint=e,this.rowFormat=t,this.rowHeightType=t.heightType}return e.prototype.revertChanges=function(e,t){var i=this.rowFormat.heightType;t.editorModule.tableResize.updateRowHeight(this.rowFormat.ownerBase,e?this.displacement:-this.displacement),t.documentHelper.layout.reLayoutTable(this.rowFormat.ownerBase.ownerTable),this.rowFormat.heightType!==this.rowHeightType&&(this.rowFormat.heightType=this.rowHeightType),this.rowHeightType=i},e}(),qt=function(){function e(e,t){this.tableHolder=new mt,this.tableFormat=new Gt,this.rows=[],this.owner=t,this.copyProperties(e)}return e.prototype.copyProperties=function(e){e.tableHolder&&(this.tableHolder=e.tableHolder.clone()),e.tableFormat&&(this.tableFormat.leftIndent=e.tableFormat.leftIndent,this.tableFormat.preferredWidth=e.tableFormat.preferredWidth,this.tableFormat.preferredWidthType=e.tableFormat.preferredWidthType,this.tableFormat.allowAutoFit=e.tableFormat.allowAutoFit);for(var t=0;t<e.childWidgets.length;t++){var i=e.childWidgets[t],n=new Kt;n.gridBefore=i.rowFormat.gridBefore,n.gridBeforeWidth=i.rowFormat.gridBeforeWidth,n.gridBeforeWidthType=i.rowFormat.gridBeforeWidthType,n.gridAfter=i.rowFormat.gridAfter,n.gridAfterWidth=i.rowFormat.gridAfterWidth,n.gridAfterWidthType=i.rowFormat.gridAfterWidthType;for(var r=0;r<i.childWidgets.length;r++){var o=i.childWidgets[r],s=new Xt;s.columnIndex=o.columnIndex,s.columnSpan=o.cellFormat.columnSpan,s.preferredWidth=o.cellFormat.preferredWidth,s.preferredWidthType=o.cellFormat.preferredWidthType,n.cells.push(s)}this.rows.push(n)}this.tableHierarchicalIndex=this.owner.selection.getHierarchicalIndex(e,"0")},e.prototype.destroy=function(){this.tableHierarchicalIndex=void 0,this.tableHolder&&(this.tableHolder.destroy(),this.tableHolder=void 0),this.tableFormat&&(this.tableFormat=null),this.rows&&(this.rows=[],this.rows=void 0)},e}(),Gt=function(){function e(){}return e}(),Kt=function(){function e(){this.cells=[]}return e}(),Xt=function(){function e(){}return e}(),Yt=function(){function e(e){this.startingPoint=e}return e}(),Jt=function(){function e(e){this.ownerIn=e,this.documentHelper=e.documentHelper,this.modifiedPropertiesIn=[],this.modifiedNodeLength=[],this.removedNodesIn=[]}return Object.defineProperty(e.prototype,"owner",{get:function(){return this.ownerIn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"editorHistory",{get:function(){return this.owner.editorHistory},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"action",{get:function(){return this.actionIn},set:function(e){this.actionIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"modifiedProperties",{get:function(){return this.modifiedPropertiesIn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"removedNodes",{get:function(){return this.removedNodesIn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectionStart",{get:function(){return this.selectionStartIn},set:function(e){this.selectionStartIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selectionEnd",{get:function(){return this.selectionEndIn},set:function(e){this.selectionEndIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"insertPosition",{get:function(){return this.insertPositionIn},set:function(e){this.insertPositionIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endPosition",{get:function(){return this.endPositionIn},set:function(e){this.endPositionIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewer",{get:function(){return this.ownerIn.viewer},enumerable:!0,configurable:!0}),e.prototype.updateSelection=function(){var e=this.owner.selection.getParagraphInfo(this.owner.selection.start);this.selectionStart=this.owner.selection.getHierarchicalIndex(e.paragraph,e.offset.toString()),e=this.owner.selection.getParagraphInfo(this.owner.selection.end),this.selectionEnd=this.owner.selection.getHierarchicalIndex(e.paragraph,e.offset.toString())},e.prototype.setBookmarkInfo=function(e){this.removedNodes.push({bookmark:e,startIndex:e.indexInOwner,endIndex:e.reference.indexInOwner})},e.prototype.setFormFieldInfo=function(e,t){this.removedNodes.push({formField:e,value:t})},e.prototype.setEditRangeInfo=function(e){this.removedNodes.push({editStart:e,startIndex:e.indexInOwner,endIndex:e.editRangeEnd.indexInOwner})},e.prototype.revertFormTextFormat=function(){var e=this.removedNodes[0],t=e.value,i=e.formField;this.editorHistory.isUndoing?(this.owner.editorModule.applyTextFormatInternal(i,t),this.editorHistory.recordChanges(this)):(t=W.formatText(i.formFieldData.format,t),this.owner.editorModule.applyTextFormatInternal(i,t),this.editorHistory.undoStack.push(this))},e.prototype.revertFormField=function(){var e=this.removedNodes[0],t=e.formField;t.formFieldData instanceof Te?this.owner.editorModule.toggleCheckBoxFormField(t,!0,e.value):this.owner.editorModule.updateFormField(t,e.value)},e.prototype.revertBookmark=function(){var e=this.removedNodes[0],i=e.bookmark;if(this.editorHistory.isUndoing){this.documentHelper.bookmarks.add(i.name,i),i.line.children.splice(e.startIndex,0,i);var n=i.previousNode;n instanceof xe&&!t.isNullOrUndefined(n.formFieldData)&&(n.formFieldData.name=i.name),i.reference.line.children.splice(e.endIndex,0,i.reference),this.editorHistory.recordChanges(this)}else this.owner.editorModule.deleteBookmarkInternal(i),this.editorHistory.undoStack.push(this)},e.prototype.revertComment=function(){var e=this.insertPosition,t=this.removedNodes[0],i=!1;if("InsertCommentWidget"===this.action?i=this.editorHistory.isRedoing:"DeleteCommentWidget"===this.action&&(i=this.editorHistory.isUndoing),i)t&&(t.isReply?this.owner.editor.addReplyComment(t,this.insertPosition):this.owner.editor.addCommentWidget(t,!1,!0,!0));else{var n=this.owner.editor.getCommentElementBox(e);this.owner.editor.deleteCommentWidget(n)}},e.prototype.revertEditRangeRegion=function(){var e=this.removedNodes[0],t=e.editStart;if(this.editorHistory.isUndoing){var i=""===t.user?t.group:t.user;this.owner.editor.updateRangeCollection(t,i),t.line.children.splice(e.startIndex,0,t),t.editRangeEnd.line.children.splice(e.endIndex,0,t.editRangeEnd),this.editorHistory.recordChanges(this)}else this.owner.editorModule.removeUserRestrictionsInternal(t),this.editorHistory.undoStack.push(this);this.owner.editor.fireContentChange()},e.prototype.revert=function(){if("FormTextFormat"===this.action)return void this.revertFormTextFormat();if("UpdateFormField"===this.action)return void this.revertFormField();if("DeleteBookmark"===this.action)return void this.revertBookmark();if("RemoveEditRange"===this.action)return void this.revertEditRangeRegion();if("InsertCommentWidget"===this.action||"DeleteCommentWidget"===this.action)return void this.revertComment();if("ListFormat"===this.action&&""!==this.owner.editor.listNumberFormat){var e=this.documentHelper.lists[0].abstractList.levels[this.owner.editor.listLevelNumber],i=e.listLevelPattern,n=e.numberFormat;e.listLevelPattern=this.owner.editor.listLevelPattern,e.numberFormat=this.owner.editor.listNumberFormat,this.owner.editor.listLevelPattern=i,this.owner.editor.listNumberFormat=n}this.owner.isShiftingEnabled=!0;var r=void 0,o=void 0,s=this.selectionStart,a=this.selectionEnd,l=Nt.isForwardSelection(s,a);if(this.modifiedProperties.length>0||"Selection"===this.action||"ClearCharacterFormat"===this.action||"ClearParagraphFormat"===this.action)r=this.owner.selection.getTextPosBasedOnLogicalIndex(s),o=this.owner.selection.getTextPosBasedOnLogicalIndex(a),this.revertModifiedProperties(r,o);else{var d=this.owner.selection,h=this.removedNodes;this.removedNodesIn=[];var c=Nt.isForwardSelection(this.insertPosition,this.endPosition),p=d.getTextPosBasedOnLogicalIndex(c?this.insertPosition:this.endPosition),u=d.getTextPosBasedOnLogicalIndex(c?this.endPosition:this.insertPosition);if(this.lastElementRevision&&this.editorHistory.isUndoing&&t.isNullOrUndefined(this.endRevisionLogicalIndex)&&this.updateEndRevisionInfo(),"ClearRevisions"===this.action&&(this.undoRevisionForElements(p,u,h[h.length-1]),h=[]),"Uppercase"===this.action){d.selectPosition(p,u),this.editorHistory.currentBaseHistoryInfo=this;var g=this.owner.editorModule;return g.changeSelectedTextCase(d,p,u,this.action.toString(),h),void g.reLayout(d)}if(p.isAtSamePosition(u)?d.selectContent(p,!0):d.selectPosition(p,u),"InsertHyperlink"===this.action&&this.editorHistory.isRedoing){var m=this.owner.selection.getHyperlinkField();if(!t.isNullOrUndefined(m)){var f=m.line.getOffset(m,0);p.setPositionParagraph(m.line,f),this.owner.selection.start.setPositionInternal(p),f=m.fieldEnd.line.getOffset(m.fieldEnd,1),u.setPositionParagraph(m.fieldEnd.line,f)}}this.editorHistory.currentBaseHistoryInfo=this,this.selectionStart=this.insertPosition,this.insertPosition=void 0,this.selectionEnd=this.endPosition,this.endPosition=void 0;var v=!1;if(this.endRevisionLogicalIndex&&h.length>0){if(this.editorHistory.isUndoing||this.editorHistory.isRedoing&&p.isAtSamePosition(u)){var y=d.getTextPosBasedOnLogicalIndex(this.endRevisionLogicalIndex);d.selectPosition(p,y)}this.editorHistory.isUndoing&&this.owner.editor.deleteSelectedContents(d,!0)}if(!p.isAtSamePosition(u)){v="BackSpace"===this.action||"Delete"===this.action||"ClearCells"===this.action||"DeleteCells"===this.action;var b=h.length>0&&"ParaMarkTrack"===this.action||"ClearRevisions"===this.action||"AcceptTOC"===this.action;v||"MergeCells"===this.action||"InsertRowAbove"===this.action||"InsertRowBelow"===this.action||"InsertColumnLeft"===this.action||"InsertColumnRight"===this.action||"Borders"===this.action||"DeleteTable"===this.action||"DeleteColumn"===this.action||"DeleteRow"===this.action||(d.end.setPositionInternal(u),this.owner.selection.isEmpty||b||(this.editorHistory.isRedoing&&"Accept Change"!==this.action&&"ParaMarkTrack"!==this.action&&"ParaMarkReject"!==this.action&&"RemoveRowTrack"!==this.action?this.owner.editorModule.removeSelectedContents(d):this.owner.editorModule.deleteSelectedContents(d,!0),!t.isNullOrUndefined(this.editorHistory.currentHistoryInfo)&&"PageBreak"===this.editorHistory.currentHistoryInfo.action&&this.documentHelper.blockToShift&&this.documentHelper.layout.shiftLayoutedItems(!1)))}var w=this.editorHistory.isRedoing&&!v;v=!this.lastElementRevision&&v,this.revertModifiedNodes(h,w,l?s:a,s===a),v&&this.removeContent(p,u)}var C=!1,x=!1;t.isNullOrUndefined(this.editorHistory.currentHistoryInfo)||"Reject All"!==this.editorHistory.currentHistoryInfo.action&&"Accept All"!==this.editorHistory.currentHistoryInfo.action||(x=!0),(!this.owner.trackChangesPane.isTrackingPageBreak&&((this.editorHistory.isUndoing||this.endRevisionLogicalIndex||"RemoveRowTrack"===this.action||x)&&t.isNullOrUndefined(this.editorHistory.currentHistoryInfo)||x)||("InsertRowAbove"===this.action||"Borders"===this.action||"InsertRowBelow"===this.action||"InsertColumnLeft"===this.action||"InsertColumnRight"===this.action||"Accept Change"===this.action)&&(this.editorHistory.isRedoing||"Paste"===this.editorHistory.currentHistoryInfo.action))&&("RemoveRowTrack"===this.action&&this.editorHistory.isRedoing?(r=this.owner.selection.getTextPosBasedOnLogicalIndex(this.selectionStart),o=this.owner.selection.getTextPosBasedOnLogicalIndex(this.selectionEnd)):(r=this.owner.selection.getTextPosBasedOnLogicalIndex(s),o=this.owner.selection.getTextPosBasedOnLogicalIndex(a)),this.owner.selection.selectRange(r,o),C=!0),this.owner.trackChangesPane.isTrackingPageBreak=!1,this.insertPosition=s,this.endPosition=a,t.isNullOrUndefined(this.editorHistory.currentHistoryInfo)||"Accept All"!==this.editorHistory.currentHistoryInfo.action&&"Reject All"!==this.editorHistory.currentHistoryInfo.action||this.owner.documentHelper.blockToShift&&this.owner.documentHelper.layout.shiftLayoutedItems(!1),this.owner.editorModule.reLayout(this.owner.selection,this.owner.selection.isEmpty),C&&this.documentHelper.scrollToPosition(this.owner.selection.start,this.owner.selection.end),this.highlightListText()},e.prototype.highlightListText=function(){if(!t.isNullOrUndefined(this.editorHistory.currentHistoryInfo)&&("ListCharacterFormat"===this.action||"ListSelect"===this.editorHistory.currentHistoryInfo.action&&"ListFormat"===this.action)){var e=this.owner.selection.getTextPosBasedOnLogicalIndex(this.selectionStart).currentWidget;this.documentHelper.selection.highlightListText(e)}},e.prototype.removeContent=function(e,i){if(!t.isNullOrUndefined(e.paragraph.containerWidget)&&e.paragraph.containerWidget instanceof pe&&!t.isNullOrUndefined(i.paragraph.containerWidget)&&i.paragraph.containerWidget instanceof pe||!t.isNullOrUndefined(e.paragraph.containerWidget)&&!t.isNullOrUndefined(i.paragraph.containerWidget)&&e.paragraph.containerWidget instanceof be&&i.paragraph.containerWidget instanceof be&&!t.isNullOrUndefined(e.paragraph.bodyWidget)||!t.isNullOrUndefined(e.paragraph.containerWidget)&&!t.isNullOrUndefined(i.paragraph.containerWidget)&&e.paragraph.containerWidget instanceof _e&&i.paragraph.containerWidget instanceof _e){this.owner.selection.selectRange(e,i);var n=!1;"BackSpace"!==this.action&&"Uppercase"!==this.action&&"RemoveRowTrack"!==this.action||(n=!0),this.owner.editorModule.deleteSelectedContents(this.owner.selection,n)}},e.prototype.updateEndRevisionInfo=function(){this.lastElementRevision=this.checkAdjacentNodeForMarkedRevision(this.lastElementRevision);var e=this.retrieveEndPosition(this.lastElementRevision),t=this.owner.selection.getParagraphInfo(e);this.endRevisionLogicalIndex=this.owner.selection.getHierarchicalIndex(t.paragraph,t.offset.toString()),this.lastElementRevision.isMarkedForRevision=!1},e.prototype.retrieveEndPosition=function(e){var t=new Nt(this.owner),i=e.line.getOffset(e,0)+e.length;return t.setPositionFromLine(e.line,i),t},e.prototype.checkAdjacentNodeForMarkedRevision=function(e){for(var i,n=e.nextNode;!t.isNullOrUndefined(n)&&n.isMarkedForRevision;)i=n,n=n.nextNode;return t.isNullOrUndefined(i)?e:i},e.prototype.revertModifiedProperties=function(e,t){"CellFormat"!==this.action&&"CellOptions"!==this.action&&"TableOptions"!==this.action||(this.owner.isShiftingEnabled=!1),this.owner.selection.selectRange(e,t),"RowResizing"===this.action||"CellResizing"===this.action?this.revertResizing():"CellOptions"===this.action||"TableOptions"===this.action?this.revertTableDialogProperties(this.action):"Selection"!==this.action&&this.revertProperties()},e.prototype.redoAction=function(){var e=this.owner.editorModule;switch(this.action){case"BackSpace":e.singleBackspace(this.owner.selection,!0);break;case"Delete":e.singleDelete(this.owner.selection,!0);break;case"DeleteTable":e.deleteTable();break;case"DeleteColumn":e.deleteColumn();break;case"DeleteRow":e.deleteRow();break;case"MergeCells":e.mergeSelectedCellsInTable();break;case"InsertRowAbove":e.insertRow(!0);break;case"InsertRowBelow":e.insertRow(!1);break;case"InsertColumnLeft":case"InsertColumnRight":e.insertColumn(!0);break;case"SectionBreak":e.insertSection(this.owner.selection,!0);break;case"TableAutoFitToContents":e.autoFitTable("FitToContents");break;case"TableAutoFitToWindow":e.autoFitTable("FitToWindow");break;case"TableFixedColumnWidth":e.autoFitTable("FixedColumnWidth");break;case"RemoveRowTrack":this.owner.selection.handleAcceptReject(!0)}},e.prototype.revertModifiedNodes=function(e,i,n,r){if((!i||"BackSpace"!==this.action&&"Delete"!==this.action&&"DeleteTable"!==this.action&&"DeleteColumn"!==this.action&&"DeleteRow"!==this.action&&"InsertRowAbove"!==this.action&&"InsertRowBelow"!==this.action&&"InsertColumnLeft"!==this.action&&"InsertColumnRight"!==this.action&&"MergeCells"!==this.action&&"SectionBreak"!==this.action&&"TableAutoFitToContents"!==this.action&&"TableAutoFitToWindow"!==this.action&&"TableFixedColumnWidth"!==this.action||(this.redoAction(),"SectionBreak"!==this.action))&&e.length>0)if(this.editorHistory.isUndoing&&("RemoveRowTrack"===this.action||"DeleteCells"===this.action||"DeleteColumn"===this.action||"DeleteRow"===this.action||"MergeCells"===this.action)||"InsertRowAbove"===this.action||"InsertRowBelow"===this.action||"InsertColumnLeft"===this.action||"ClearCells"===this.action||"InsertColumnRight"===this.action||"Borders"===this.action||"TableAutoFitToContents"===this.action||"TableAutoFitToWindow"===this.action||"TableFixedColumnWidth"===this.action||"RemoveRowTrack"===this.action){var o=this.selectionStart,s=this.owner.editorModule.getBlock({index:o}).node,a=e[e.length-1];(s instanceof ve||s.previousRenderedWidget instanceof ve||s.isInsideTable)&&a instanceof ve?(s instanceof fe&&!s.isInsideTable?s=s.previousRenderedWidget:s instanceof fe&&s.isInsideTable&&(s=s.associatedCell.ownerTable),s=s.combineWidget(this.viewer),this.owner.editorModule.insertTableInternal(s,a,!1),e.splice(e.indexOf(a),1)):a instanceof ve&&this.owner.editorModule.insertBlock(a)}else{var l=n,s=this.owner.editorModule.getBlock({index:l}).node;if(e.length>0&&("BackSpace"===this.action&&r||!(s instanceof ve)&&!(s instanceof ue))){a=e[0];if(("TrackingPageBreak"===this.action||"SectionBreak"===this.action&&a instanceof pe||!t.isNullOrUndefined(this.editorHistory.currentHistoryInfo)&&"PageBreak"===this.editorHistory.currentHistoryInfo.action)&&(a=e[1]),a instanceof fe&&this.owner.selection.start.offset>0&&(this.owner.editorModule.insertNewParagraphWidget(a,!0),a.characterFormat.removedIds.length>0&&this.owner.editor.constructRevisionFromID(a.characterFormat,void 0),e.splice(e.indexOf(a),1),t.isNullOrUndefined(s))){h=this.documentHelper.selection.getNextParagraphBlock(a.getSplitWidgets().pop());this.owner.selection.getNextRenderedBlock(a),t.isNullOrUndefined(h)&&this.owner.selection.selectParagraphInternal(a,!0)}if(a instanceof ve&&this.owner.selection.start.offset>0){var d=e[e.length-1];if(d instanceof fe&&(this.owner.editorModule.insertNewParagraphWidget(d,!0),e.splice(e.indexOf(d),1),t.isNullOrUndefined(s))){var h=this.documentHelper.selection.getNextParagraphBlock(d.getSplitWidgets().pop());t.isNullOrUndefined(h)&&this.owner.selection.selectParagraphInternal(d,!0)}}}if(e.length>0){var c=e[e.length-1];if(s instanceof ve&&(s=s.combineWidget(this.viewer),c instanceof ve)){this.owner.editorModule.insertTableInternal(s,c,!0),e.splice(e.indexOf(c),1),this.insertPosition=n;var p=c.getSplitWidgets().pop();p.nextRenderedWidget instanceof ve?s=p.nextRenderedWidget:(l=n,s=this.owner.editorModule.getBlock({index:l}).node)}if(c instanceof fe&&this.owner.selection.start.offset>0&&this.owner.selection.start.offset===this.owner.selection.getLineLength(this.owner.selection.start.paragraph.lastChild)){var u=this.owner.editorModule;u.insertNewParagraphWidget(c,!1),c.characterFormat.removedIds.length>0&&this.owner.editor.constructRevisionFromID(c.characterFormat,void 0),e.splice(e.indexOf(c),1),"Paste"!==this.action&&u.removeBlock(this.owner.selection.start.paragraph);var g=this.documentHelper.selection.getNextParagraphBlock(c.getSplitWidgets().pop());t.isNullOrUndefined(g)||this.owner.selection.selectParagraphInternal(g,!0)}else if(e[0]instanceof ve&&1!==e.length){var m=e[1];m instanceof fe&&m.isEmpty()&&e.splice(e.indexOf(m),1)}}e.length>0&&(s instanceof ve&&(s=s.combineWidget(this.viewer)),this.insertRemovedNodes(e,s))}},e.prototype.insertRemovedNodes=function(e,t){for(var i=e.length-1;i>-1;i--){var n=e[i];if(n instanceof Ce)this.owner.editorModule.insertInlineInSelection(this.owner.selection,n);else if(n instanceof ge)n instanceof ye?t instanceof ve&&(t.childWidgets.splice(0,0,n),this.owner.editorModule.updateNextBlocksIndex(n,!0),0!==i&&e[i-1]instanceof ye||this.documentHelper.layout.layoutBodyWidgetCollection(t.index,t.containerWidget,t,!1)):t instanceof ve?this.owner.editorModule.insertBlockTable(this.owner.selection,n,t):this.owner.editorModule.insertBlock(n);else if(n instanceof H){var r=this.selectionStart,o=this.owner.editorModule.getBlock({index:r}).node;o instanceof fe&&(n.removedIds.length>0?(o.characterFormat.removedIds=n.removedIds.slice(),this.owner.editor.constructRevisionFromID(o.characterFormat,!0)):o.characterFormat.revisions.length>0&&(o.characterFormat=n.cloneFormat()))}else if(n instanceof pe)this.owner.editorModule.insertSection(this.owner.selection,!1);else if("string"==typeof n&&"AcceptTOC"===this.action){var r=this.selectionStart,s=this.owner.editorModule.getBlock({index:r}).node,a=this.owner.editorModule.getBlock({index:this.selectionEnd}).node,l=this.owner.documentHelper.revisionsInternal.get(n);if(this.editorHistory.isUndoing){for(;s instanceof fe&&s!==a;)this.owner.editor.insertRevisionForBlock(s,l.revisionType,!0,l),s=this.documentHelper.selection.getNextParagraphBlock(s.getSplitWidgets().pop());this.owner.editor.insertRevisionForBlock(a,l.revisionType,!0,l)}else for(;l.range.length>0;){var d=l.range[0],h=d.revisions.indexOf(l);if(h>=0){d.revisions.splice(h,1);var c=l.range.indexOf(d);l.range.splice(c,1)}0===l.range.length&&this.owner.revisions.remove(l)}this.owner.editor.addRemovedNodes(l.revisionID)}}e=[]},e.prototype.undoRevisionForElements=function(e,t,i){var n=e.paragraph,r=t.paragraph,o=this.documentHelper.revisionsInternal.get(i),s=this.owner.selection.getParagraphInfo(e).offset,a=this.owner.selection.getParagraphInfo(t).offset,l=e.paragraph===t.paragraph;if(this.editorHistory.isUndoing){for(;n!==r;)this.owner.editor.applyRevisionForCurrentPara(n,s,n.getLength(),i,!0),(n=this.documentHelper.selection.getNextParagraphBlock(n.getSplitWidgets().pop()))!==r&&(s=0);n===r&&(l||(s=0),this.owner.editor.applyRevisionForCurrentPara(n,s,a,i,!1))}else for(;o.range.length>0;){var d=o.range[0],h=d.revisions.indexOf(o);if(h>=0){d.revisions.splice(h,1);var c=o.range.indexOf(d);o.range.splice(c,1)}0===o.range.length&&this.owner.revisions.remove(o)}this.removedNodes.push(i)},e.prototype.revertResizing=function(){if(this.editorHistory.currentBaseHistoryInfo=this,"RowResizing"===this.action)this.modifiedProperties[0]instanceof jt&&this.modifiedProperties[0].revertChanges(this.editorHistory.isRedoing,this.owner);else if(this.modifiedProperties[0]instanceof qt){0===this.owner.selection.selectedWidgets.length&&this.owner.selection.highlightSelection(!0);var e=this.modifiedProperties[0],t=e.tableHierarchicalIndex,i=this.owner.editorModule.getBlock({index:t}).node;if(i instanceof ve){var n=this.owner.editorModule.tableResize;if(this.owner.editor.setOffsetValue(this.owner.selection),i=i.combineWidget(this.owner.viewer),n.currentResizingTable=i,this.modifiedProperties.splice(0,1),this.editorHistory.isUndoing||this.editorHistory.isRedoing){var r=new qt(i,this.owner);this.modifiedProperties.splice(0,0,r),this.owner.isLayoutEnabled=!1,n.applyProperties(n.currentResizingTable,e),n.currentResizingTable.isGridUpdated=!0,this.owner.isLayoutEnabled=!0,n.updateGridValue(n.currentResizingTable,!1),e.destroy(),e=void 0}}}},e.prototype.revertTableDialogProperties=function(e){if(this.owner.isShiftingEnabled=!1,this.editorHistory.currentBaseHistoryInfo=this,this.currentPropertyIndex=0,"CellOptions"===e){var t=this.owner.selection,i=this.modifiedProperties[0];this.owner.editorModule.updateCellMargins(t,i)}else"TableOptions"===e&&this.owner.tableOptionsDialogModule.applyTableOptionsHelper(this.modifiedProperties[0]);this.currentPropertyIndex=0,this.owner.isShiftingEnabled=!0},e.prototype.addModifiedPropertiesForSection=function(e,i,n){if(this.editorHistory.isUndoing||this.editorHistory.isRedoing){var r=this.modifiedProperties,o=this.currentPropertyIndex<r.length?r[this.currentPropertyIndex]:r[r.length-1];t.isNullOrUndefined(i)?(n=o,this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]=e.cloneFormat():this.modifiedProperties[this.modifiedProperties.length-1]=e.cloneFormat()):(n=o.getPropertyValue(i),o.copyFormat(e)),this.currentPropertyIndex++}else if(t.isNullOrUndefined(i))this.modifiedProperties.push(e.cloneFormat());else{var s=new b;s.copyFormat(e),this.modifiedProperties.push(s)}return n},e.prototype.addModifiedProperties=function(e,i,n){if(this.editorHistory.isUndoing||this.editorHistory.isRedoing){var r=this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]:this.modifiedProperties[this.modifiedProperties.length-1],o=!1;if(e.ownerBase instanceof Ce){var s=this.modifiedNodeLength[this.currentPropertyIndex];if(e.ownerBase.length<s){o=!0,this.modifiedNodeLength[this.currentPropertyIndex]=e.ownerBase.length,this.modifiedNodeLength.splice(this.currentPropertyIndex+1,0,s-e.ownerBase.length);var a=new H(void 0);a.copyFormat(r),this.modifiedProperties.splice(this.currentPropertyIndex+1,0,a)}}"ClearCharacterFormat"===this.action?this.editorHistory.isUndoing?(n=r,o||(this.modifiedProperties.splice(this.currentPropertyIndex,1),this.currentPropertyIndex--)):this.modifiedProperties.push(e.cloneFormat()):(n=r,this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]=e.cloneFormat():this.modifiedProperties[this.modifiedProperties.length-1]=e.cloneFormat()),this.currentPropertyIndex++}else{if(t.isNullOrUndefined(i))this.modifiedProperties.push(e.cloneFormat());else{var l=new H(void 0);l.copyFormat(e),this.modifiedProperties.push(l)}e.ownerBase instanceof Ce?this.modifiedNodeLength.push(e.ownerBase.length):this.modifiedNodeLength.push(0)}return n},e.prototype.addModifiedPropertiesForParagraphFormat=function(e,i,n){if(this.editorHistory.isUndoing||this.editorHistory.isRedoing){var r=this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]:this.modifiedProperties[this.modifiedProperties.length-1];if("ClearParagraphFormat"===this.action)return this.editorHistory.isUndoing?(n=r,this.modifiedProperties.splice(this.currentPropertyIndex,1),this.currentPropertyIndex--):this.modifiedProperties.push(e.cloneFormat()),this.currentPropertyIndex++,n;if(t.isNullOrUndefined(i))return n=r,this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]=e.cloneFormat():this.modifiedProperties[this.modifiedProperties.length-1]=e.cloneFormat(),this.currentPropertyIndex++,n;if("listFormat"===i)return(n=new P(void 0)).copyFormat(r),r.listFormat=new x,r.listFormat.copyFormat(e.listFormat),this.currentPropertyIndex++,n;if("styleName"===i)return t.isNullOrUndefined(r.baseStyle)?void(t.isNullOrUndefined(e.baseStyle)||(r.baseStyle=new R,r.baseStyle.copyStyle(e.baseStyle))):((n=new R).copyStyle(r.baseStyle),this.currentPropertyIndex++,t.isNullOrUndefined(e.baseStyle)||(r.baseStyle=new R,r.baseStyle.copyStyle(e.baseStyle)),n);n=r.getPropertyValue(i),r.copyFormat(e),this.currentPropertyIndex++}else if(t.isNullOrUndefined(i))this.modifiedProperties.push(e.cloneFormat());else{var o=new P(void 0);o.copyFormat(e),this.modifiedProperties.push(o)}return n},e.prototype.addModifiedPropertiesForContinueNumbering=function(e,t){if(this.editorHistory.isUndoing||this.editorHistory.isRedoing)return t=this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]:this.modifiedProperties[this.modifiedProperties.length-1],this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]=e.cloneFormat():this.modifiedProperties[this.modifiedProperties.length-1]=e.cloneFormat(),this.currentPropertyIndex++,t;var i=new P;return i.copyFormat(e),this.modifiedProperties.push(i),t},e.prototype.addModifiedPropertiesForRestartNumbering=function(e,t){return this.editorHistory.isUndoing||this.editorHistory.isRedoing?(t=this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]:this.modifiedProperties[this.modifiedProperties.length-1],this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]=e.listId:this.modifiedProperties[this.modifiedProperties.length-1]=e.listId,this.currentPropertyIndex++,t):(this.modifiedProperties.push(e.listId),t)},e.prototype.addModifiedPropertiesForList=function(e){var t;if(this.editorHistory.isUndoing||this.editorHistory.isRedoing){var i=this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]:this.modifiedProperties[this.modifiedProperties.length-1];t=i,i=new Vt(e,this.owner.editorModule.cloneListLevel(e)),this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]=i:this.modifiedProperties[this.modifiedProperties.length-1]=i,this.currentPropertyIndex++}else this.modifiedProperties.push(new Vt(e,this.owner.editorModule.cloneListLevel(e))),t=e;return t},e.prototype.revertProperties=function(){this.editorHistory.currentBaseHistoryInfo=this,this.currentPropertyIndex=0;var e=this.getProperty();if(this.viewer.owner.editorModule.setOffsetValue(this.documentHelper.selection),"ClearCharacterFormat"===this.action||this.modifiedProperties[0]instanceof H){if("ListCharacterFormat"===this.action)return void this.owner.editorModule.updateListCharacterFormat(this.documentHelper.selection,e,void 0);this.owner.editorModule.updateSelectionCharacterFormatting(e,void 0,!1)}else if("ClearParagraphFormat"===this.action||this.modifiedProperties[0]instanceof P){if("ContinueNumbering"===this.action)return void this.owner.editorModule.revertContinueNumbering(this.owner.selection,this.modifiedProperties[0]);if("StyleName"===this.action&&this.modifiedProperties[0]instanceof P)return void this.owner.editorModule.updateSelectionParagraphFormatting(e,this.modifiedProperties[0].baseStyle,!1);var t=this.owner.documentHelper.selection,i=(t.paragraphFormat.bidi||(this.modifiedProperties[0]instanceof P&&this.modifiedProperties[0]).bidi)&&(-1!==t.paragraphFormat.listId||"listFormat"===e);i||(this.owner.documentHelper.layout.isBidiReLayout=!0),this.owner.editorModule.updateSelectionParagraphFormatting(e,void 0,!1),i||(this.owner.documentHelper.layout.isBidiReLayout=!1)}else if(this.modifiedProperties[0]instanceof b)this.owner.editorModule.updateSectionFormat(e,void 0);else{if("RestartNumbering"===this.action)return void this.owner.editorModule.restartListAtInternal(this.owner.selection,this.modifiedProperties[0]);if(this.modifiedProperties[0]instanceof Wt)this.owner.selection.updateImageSize(this.modifiedProperties[0]);else if(this.modifiedProperties[0]instanceof Vt){for(var n=new g,r=0;r<this.modifiedProperties.length;r++){var o=this.modifiedProperties[r];n.add(r,o)}this.editorHistory.updateListChanges(n),n.destroy(),n=void 0}else this.modifiedProperties[0]instanceof U?this.owner.editorModule.updateTableFormat(this.owner.selection,e,void 0):this.modifiedProperties[0]instanceof z?(this.owner.isShiftingEnabled=!0,this.owner.editorModule.updateCellFormat(this.owner.selection,e,void 0)):this.modifiedProperties[0]instanceof I&&this.owner.editorModule.updateRowFormat(this.owner.selection,e,void 0)}this.currentPropertyIndex=0,"ClearCharacterFormat"!==this.action&&"ClearParagraphFormat"!==this.action||this.owner.editorModule.getOffsetValue(this.documentHelper.selection)},e.prototype.addModifiedCellOptions=function(e,i,n){var r;return r=t.isNullOrUndefined(e.bottomMargin)&&t.isNullOrUndefined(e.topMargin)&&t.isNullOrUndefined(e.rightMargin)&&t.isNullOrUndefined(e.leftMargin)?this.copyCellOptions(n.tableFormat):this.copyCellOptions(e),this.editorHistory.isUndoing||this.editorHistory.isRedoing?(i=this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]:this.modifiedProperties[this.modifiedProperties.length-1],this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]=this.copyCellOptions(e):this.modifiedProperties[this.modifiedProperties.length-1]=this.copyCellOptions(e),this.currentPropertyIndex++,i):(this.modifiedProperties.push(r),i)},e.prototype.copyCellOptions=function(e){var t=new z;return t.topMargin=e.topMargin,t.rightMargin=e.rightMargin,t.bottomMargin=e.bottomMargin,t.leftMargin=e.leftMargin,t},e.prototype.addModifiedTableOptions=function(e){var t=this.copyTableOptions(e);if(this.editorHistory.isUndoing||this.editorHistory.isRedoing){this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]:this.modifiedProperties[this.modifiedProperties.length-1];this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties.splice(this.currentPropertyIndex,1,t):this.modifiedProperties.splice(this.modifiedProperties.length-1,1,t),this.currentPropertyIndex++}else this.modifiedProperties.push(t)},e.prototype.copyTableOptions=function(e){var t=new U;return t.topMargin=e.topMargin,t.rightMargin=e.rightMargin,t.bottomMargin=e.bottomMargin,t.leftMargin=e.leftMargin,t.cellSpacing=e.cellSpacing,t},e.prototype.getProperty=function(){switch(this.action){case"Bold":return"bold";case"Italic":return"italic";case"FontColor":return"fontColor";case"FontFamily":return"fontFamily";case"FontSize":return"fontSize";case"HighlightColor":return"highlightColor";case"BaselineAlignment":return"baselineAlignment";case"Strikethrough":return"strikethrough";case"Underline":return"underline";case"AfterSpacing":return"afterSpacing";case"BeforeSpacing":return"beforeSpacing";case"LeftIndent":return"leftIndent";case"RightIndent":return"rightIndent";case"FirstLineIndent":return"firstLineIndent";case"LineSpacingType":return"lineSpacingType";case"LineSpacing":return"lineSpacing";case"TextAlignment":return"textAlignment";case"ListFormat":return"listFormat";case"PageHeight":return"pageHeight";case"PageWidth":return"pageWidth";case"TableAlignment":return"tableAlignment";case"TableLeftIndent":return"leftIndent";case"DefaultCellSpacing":return"cellSpacing";case"LeftMargin":case"CellLeftMargin":case"DefaultCellLeftMargin":return"leftMargin";case"RightMargin":case"CellRightMargin":case"DefaultCellRightMargin":return"rightMargin";case"TopMargin":case"CellTopMargin":case"DefaultCellTopMargin":return"topMargin";case"BottomMargin":case"CellBottomMargin":case"DefaultCellBottomMargin":return"bottomMargin";case"CellContentVerticalAlignment":return"verticalAlignment";case"RowHeight":return"height";case"RowHeightType":return"heightType";case"RowHeader":return"isHeader";case"AllowBreakAcrossPages":return"allowBreakAcrossPages";case"TablePreferredWidth":case"CellPreferredWidth":return"preferredWidth";case"TablePreferredWidthType":case"CellPreferredWidthType":return"preferredWidthType";case"Shading":return"shading";case"StyleName":return"styleName";case"ParagraphBidi":case"TableBidi":return"bidi";case"ContextualSpacing":return"contextualSpacing"}},e.prototype.getCharacterPropertyValue=function(e,t){var i;return"bold"===e?i=t.bold:"italic"===e?i=t.italic:"fontColor"===e?i=t.fontColor:"fontFamily"===e?i=t.fontFamily:"fontSize"===e?i=t.fontSize:"highlightColor"===e?i=t.highlightColor:"baselineAlignment"===e?i=t.baselineAlignment:"strikethrough"===e?i=t.strikethrough:"underline"===e&&(i=t.underline),i},e.prototype.addModifiedTableProperties=function(e,i,n){if(this.editorHistory.isUndoing||this.editorHistory.isRedoing){var r=this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]:this.modifiedProperties[this.modifiedProperties.length-1];if(t.isNullOrUndefined(i))return n=r,this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]=e.cloneFormat():this.modifiedProperties[this.modifiedProperties.length-1]=e.cloneFormat(),this.currentPropertyIndex++,n;n="shading"===i?r.shading:r.getPropertyValue(i),r.copyFormat(e),this.currentPropertyIndex++}else{var o=new U;o.copyFormat(e),this.modifiedProperties.push(o)}return n},e.prototype.addModifiedRowProperties=function(e,i,n){if(this.editorHistory.isUndoing||this.editorHistory.isRedoing){var r=this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]:this.modifiedProperties[this.modifiedProperties.length-1];if(t.isNullOrUndefined(i))return n=r,this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]=e.cloneFormat():this.modifiedProperties[this.modifiedProperties.length-1]=e.cloneFormat(),this.currentPropertyIndex++,n;n=r.getPropertyValue(i),r.copyFormat(e),this.currentPropertyIndex++}else{var o=new I;o.copyFormat(e),this.modifiedProperties.push(o)}return n},e.prototype.addModifiedCellProperties=function(e,i,n){if(this.editorHistory.isUndoing||this.editorHistory.isRedoing){var r=this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]:this.modifiedProperties[this.modifiedProperties.length-1];if(t.isNullOrUndefined(i))return n=r,this.currentPropertyIndex<this.modifiedProperties.length?this.modifiedProperties[this.currentPropertyIndex]=e.cloneFormat():this.modifiedProperties[this.modifiedProperties.length-1]=e.cloneFormat(),this.currentPropertyIndex++,n;n="shading"===i?r.shading:r.getPropertyValue(i),r.copyFormat(e),this.currentPropertyIndex++}else{var o=new z;o.copyFormat(e),this.modifiedProperties.push(o)}return n},e.prototype.destroy=function(){if(this.selectionStart=void 0,this.selectionEnd=void 0,this.insertPosition=void 0,this.endPosition=void 0,t.isNullOrUndefined(this.modifiedNodeLength)||(this.modifiedNodeLength=[],this.modifiedNodeLength=void 0),!t.isNullOrUndefined(this.modifiedProperties)){for(i=0;i<this.modifiedProperties.length;i++){var e=this.modifiedProperties[i];e instanceof H?e.destroy():e instanceof P?e.destroy():e instanceof b?e.destroy():e instanceof Vt&&e.destroy(),this.modifiedProperties.splice(this.modifiedProperties.indexOf(e),1),i--}this.modifiedPropertiesIn=void 0}if(!t.isNullOrUndefined(this.removedNodes)){for(var i=0;i<this.removedNodes.length;i++){var n=this.removedNodes[i];n instanceof fe?n.destroyInternal(this.viewer):n instanceof Ce&&n.destroy(),this.removedNodes.splice(this.removedNodes.indexOf(n),1),i--}this.removedNodesIn=void 0}this.ownerIn=void 0},e}(),Zt=function(){function e(e,i){this.resizeContainerDiv=void 0,this.topLeftRect=void 0,this.topMiddleRect=void 0,this.topRightRect=void 0,this.bottomLeftRect=void 0,this.bottomMiddleRect=void 0,this.bottomRightRect=void 0,this.leftMiddleRect=void 0,this.rightMiddleRect=void 0,this.topLeftRectParent=void 0,this.topMiddleRectParent=void 0,this.topRightRectParent=void 0,this.bottomLeftRectParent=void 0,this.bottomMiddleRectParent=void 0,this.bottomRightRectParent=void 0,this.leftMiddleRectParent=void 0,this.rightMiddleRectParent=void 0,this.resizeMarkSizeIn=7,this.selectedImageWidget=void 0,this.baseHistoryInfo=void 0,this.isImageResizing=!1,this.isImageResizerVisible=!1,this.isImageMoveToNextPage=!1,this.selectedResizeElement=void 0,this.topValue=void 0,this.leftValue=void 0,this.owner=e,this.selectedImageWidget=new g,this.documentHelper=i,this.imageResizerPoints=new Qt,t.isNullOrUndefined(this.imageResizerDiv)&&this.viewer&&this.documentHelper.pageContainer&&this.initializeImageResizer()}return Object.defineProperty(e.prototype,"currentImageElementBox",{get:function(){return this.currentImageElementBoxIn},set:function(e){this.currentImageElementBoxIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"resizeMarkSize",{get:function(){return this.resizeMarkSizeIn},set:function(e){this.resizeMarkSizeIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isShapeResize",{get:function(){return this.currentImageElementBox instanceof Ve},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewer",{get:function(){return this.owner.viewer},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"ImageResizer"},e.prototype.setImageResizerPositions=function(e,t,i,n){this.imageResizerDivElement.style.top=t.toString()+"px",this.imageResizerDivElement.style.left=e.toString()+"px",this.imageResizerDivElement.style.borderWidth="0px",this.imageResizerDivElement.style.height=n+"px",this.owner.viewer instanceof oe?this.imageResizerDivElement.style.width=i-e-this.documentHelper.scrollbarWidth+"px":this.imageResizerDivElement.style.width=i+"px",this.imageResizerDivElement.style.backgroundColor="transparent",this.imageResizerDivElement.style.overflow="hidden",this.imageResizerDivElement.style.position="absolute"},e.prototype.initializeImageResizer=function(){this.imageResizerDivElement=document.createElement("div"),this.imageResizerDivElement.style.zIndex="1",this.imageResizerDivElement.style.display="none",this.documentHelper.pageContainer.appendChild(this.imageResizerDivElement)},e.prototype.positionImageResizer=function(e){this.selectedImageWidget.clear();var i;t.isNullOrUndefined(this.documentHelper.currentPage)||(i=this.imageResizerDivElement),t.isNullOrUndefined(i)||i.contains(this.imageResizerDiv)||(this.imageResizerDiv=this.initResizeMarks(i,this)),this.imageResizerDiv.style.width=e.width+"px",this.imageResizerDiv.style.height=e.height+"px",this.currentImageElementBox=e;var n,r,o=e.line;e instanceof Ge&&"Inline"!==e.textWrappingStyle?(n=e.y,r=e.x):(n=this.documentHelper.selection.getTop(o)+e.margin.top,r=this.documentHelper.selection.getLeftInternal(o,e,0));var s=this.documentHelper.selection.getPage(o.paragraph);this.currentPage=s;var a=0;t.isNullOrUndefined(i)||(this.owner.viewer instanceof oe&&(this.imageResizerDivElement.style.width=s.boundingRectangle.width-s.boundingRectangle.x-r-this.documentHelper.scrollbarWidth+"px"),this.imageResizerDivElement.style.display="block",this.owner.viewer instanceof oe?i.style.width=s.boundingRectangle.width-this.documentHelper.scrollbarWidth-s.boundingRectangle.x-r+"px":i.style.width=s.boundingRectangle.width+"px",i.style.height=s.boundingRectangle.height+"px",i.style.left=s.boundingRectangle.x+"px",i.style.top=s.boundingRectangle.y+"px",i.style.borderWidth="0px",i.style.backgroundColor="transparent",i.style.overflow="hidden",i.style.position="absolute");var l=0,d=this.documentHelper.getPageWidth(s);l=parseFloat(this.imageResizerDivElement.style.width),(a=(this.documentHelper.visibleBounds.width-l*this.documentHelper.zoomFactor)/2)<30&&(a=30),d<l&&(a+=(l-d)*this.documentHelper.zoomFactor/2);var h=this.imageResizerDivElement,c=parseFloat(h.style.width),p=parseFloat(h.style.height),u=parseFloat(this.imageResizerDiv.style.width),g=parseFloat(this.imageResizerDiv.style.height),m=(this.resizeMarkSize-1)/2,f=u+2*m,v=g+2*m;if(f>(c-r)*this.documentHelper.zoomFactor+m&&(f=(c-r)*this.documentHelper.zoomFactor),v>(p-n)*this.documentHelper.zoomFactor+m&&(v=(p-n)*this.documentHelper.zoomFactor),this.imageResizerDivElement.style.width=parseInt(this.imageResizerDivElement.style.width.replace("px",""),10)*this.documentHelper.zoomFactor+"px",this.imageResizerDivElement.style.height=parseInt(this.imageResizerDivElement.style.height.replace("px",""),10)*this.documentHelper.zoomFactor+"px",v=this.documentHelper.render.getScaledValue(e.height),f=this.documentHelper.render.getScaledValue(e.width),e instanceof Ge?(r=this.documentHelper.render.getScaledValue(r),n=this.documentHelper.render.getScaledValue(n)):(r=e.x*this.documentHelper.zoomFactor,n=e.y*this.documentHelper.zoomFactor),this.setImageResizerPosition(r,n,f,v,this),this.owner.selection.isInShape?this.resizeContainerDiv.style.borderStyle="dashed":this.resizeContainerDiv.style.borderStyle="solid",!this.selectedImageWidget.containsKey(o)){var y=new $t(e.height,e.width);this.selectedImageWidget.add(o,y)}},e.prototype.showImageResizer=function(){t.isNullOrUndefined(this.imageResizerDivElement)||(this.imageResizerDivElement.style.display=""),t.isNullOrUndefined(this.resizeContainerDiv)||(this.resizeContainerDiv.style.display=""),t.isNullOrUndefined(this.bottomLeftRect)||(this.bottomLeftRect.style.display="",this.bottomLeftRectParent.style.display=""),t.isNullOrUndefined(this.bottomRightRect)||(this.bottomRightRect.style.display="",this.bottomRightRectParent.style.display=""),t.isNullOrUndefined(this.bottomMiddleRect)||(this.bottomMiddleRect.style.display="",this.bottomMiddleRectParent.style.display=""),t.isNullOrUndefined(this.rightMiddleRect)||(this.rightMiddleRect.style.display="",this.rightMiddleRectParent.style.display=""),t.isNullOrUndefined(this.topRightRect)||(this.topRightRect.style.display="",this.topRightRectParent.style.display=""),t.isNullOrUndefined(this.topLeftRect)||(this.topLeftRect.style.display="",this.topLeftRectParent.style.display=""),t.isNullOrUndefined(this.leftMiddleRect)||(this.leftMiddleRect.style.display="",this.leftMiddleRectParent.style.display=""),t.isNullOrUndefined(this.topMiddleRect)||(this.topMiddleRect.style.display="",this.topMiddleRectParent.style.display=""),this.isImageResizerVisible=!0},e.prototype.hideImageResizer=function(){t.isNullOrUndefined(this.imageResizerDivElement)||(this.imageResizerDivElement.style.display="none"),t.isNullOrUndefined(this.resizeContainerDiv)||(this.resizeContainerDiv.style.display="none"),t.isNullOrUndefined(this.bottomLeftRect)||(this.bottomLeftRect.style.display="none",this.bottomLeftRectParent.style.display="none"),t.isNullOrUndefined(this.bottomRightRect)||(this.bottomRightRect.style.display="none",this.bottomRightRectParent.style.display="none"),t.isNullOrUndefined(this.bottomMiddleRect)||(this.bottomMiddleRect.style.display="none",this.bottomMiddleRectParent.style.display="none"),t.isNullOrUndefined(this.rightMiddleRect)||(this.rightMiddleRect.style.display="none",this.rightMiddleRectParent.style.display="none"),t.isNullOrUndefined(this.topRightRect)||(this.topRightRect.style.display="none",this.topRightRectParent.style.display="none"),t.isNullOrUndefined(this.topLeftRect)||(this.topLeftRect.style.display="none",this.topLeftRectParent.style.display="none"),t.isNullOrUndefined(this.leftMiddleRect)||(this.leftMiddleRect.style.display="none",this.leftMiddleRectParent.style.display="none"),t.isNullOrUndefined(this.topMiddleRect)||(this.topMiddleRect.style.display="none",this.topMiddleRectParent.style.display="none"),this.isImageResizerVisible=!1,this.currentPage=void 0},e.prototype.initResizeMarks=function(e,t){return this.initResizeContainerDiv(t),e.appendChild(t.resizeContainerDiv),t.topRightRectParent=document.createElement("div"),t.topRightRectParent.style.cursor="ne-resize",t.topRightRectParent.id=this.documentHelper.owner.containerId+"_TopRightRectParent",this.applyProperties(t.topRightRectParent),t.topRightRectParent.style.width=this.documentHelper.isTouchInput?"30px":"14px",t.topRightRectParent.style.height=this.documentHelper.isTouchInput?"30px":"14px",t.topRightRectParent.style.opacity="-1",e.appendChild(t.topRightRectParent),t.topRightRect=document.createElement("div"),t.topRightRect.id=this.documentHelper.owner.containerId+"_TopRightRect",t.topRightRect.style.cursor="ne-resize",this.applyProperties(t.topRightRect),e.appendChild(t.topRightRect),t.topLeftRectParent=document.createElement("div"),t.topLeftRectParent.style.cursor="nw-resize",t.topLeftRectParent.id=this.documentHelper.owner.containerId+"_TopLeftRectParent",this.applyProperties(t.topLeftRectParent),t.topLeftRectParent.style.width=this.documentHelper.isTouchInput?"30px":"14px",t.topLeftRectParent.style.height=this.documentHelper.isTouchInput?"30px":"14px",t.topLeftRectParent.style.opacity="-1",e.appendChild(t.topLeftRectParent),t.topLeftRect=document.createElement("div"),t.topLeftRect.id=this.documentHelper.owner.containerId+"_TopLeftRect",t.topLeftRect.style.cursor="nw-resize",this.applyProperties(t.topLeftRect),e.appendChild(t.topLeftRect),t.topMiddleRectParent=document.createElement("div"),t.topMiddleRectParent.style.cursor="n-resize",t.topMiddleRectParent.id=this.documentHelper.owner.containerId+"_TopMiddleRectParent",this.applyProperties(t.topMiddleRectParent),t.topMiddleRectParent.style.width=this.documentHelper.isTouchInput?"30px":"14px",t.topMiddleRectParent.style.height=this.documentHelper.isTouchInput?"30px":"14px",t.topMiddleRectParent.style.opacity="-1",e.appendChild(t.topMiddleRectParent),t.topMiddleRect=document.createElement("div"),t.topMiddleRect.id=this.documentHelper.owner.containerId+"_TopMiddleRect",t.topMiddleRect.style.cursor="n-resize",this.applyProperties(t.topMiddleRect),e.appendChild(t.topMiddleRect),t.bottomRightRectParent=document.createElement("div"),t.bottomRightRectParent.style.cursor="se-resize",t.bottomRightRectParent.id=this.documentHelper.owner.containerId+"_BottomRightRectParent",this.applyProperties(t.bottomRightRectParent),t.bottomRightRectParent.style.width=this.documentHelper.isTouchInput?"30px":"14px",t.bottomRightRectParent.style.height=this.documentHelper.isTouchInput?"30px":"14px",t.bottomRightRectParent.style.opacity="-1",e.appendChild(t.bottomRightRectParent),t.bottomRightRect=document.createElement("div"),t.bottomRightRect.id=this.documentHelper.owner.containerId+"_BottomRightRect",t.bottomRightRect.style.cursor="se-resize",this.applyProperties(t.bottomRightRect),e.appendChild(t.bottomRightRect),t.bottomLeftRectParent=document.createElement("div"),t.bottomLeftRectParent.style.cursor="sw-resize",t.bottomLeftRectParent.id=this.documentHelper.owner.containerId+"_BottomLeftRectParent",this.applyProperties(t.bottomLeftRectParent),t.bottomLeftRectParent.style.width=this.documentHelper.isTouchInput?"30px":"14px",t.bottomLeftRectParent.style.height=this.documentHelper.isTouchInput?"30px":"14px",t.bottomLeftRectParent.style.opacity="-1",e.appendChild(t.bottomLeftRectParent),t.bottomLeftRect=document.createElement("div"),t.bottomLeftRect.id=this.documentHelper.owner.containerId+"_BottomLeftRect",t.bottomLeftRect.style.cursor="sw-resize",this.applyProperties(t.bottomLeftRect),e.appendChild(t.bottomLeftRect),t.bottomMiddleRectParent=document.createElement("div"),t.bottomMiddleRectParent.style.cursor="s-resize",t.bottomMiddleRectParent.id=this.documentHelper.owner.containerId+"_BottomMiddleRectParent",this.applyProperties(t.bottomMiddleRectParent),t.bottomMiddleRectParent.style.width=this.documentHelper.isTouchInput?"30px":"14px",t.bottomMiddleRectParent.style.height=this.documentHelper.isTouchInput?"30px":"14px",t.bottomMiddleRectParent.style.opacity="-1",e.appendChild(t.bottomMiddleRectParent),t.bottomMiddleRect=document.createElement("div"),t.bottomMiddleRect.id=this.documentHelper.owner.containerId+"_BottomMiddleRect",t.bottomMiddleRect.style.cursor="s-resize",this.applyProperties(t.bottomMiddleRect),e.appendChild(t.bottomMiddleRect),t.rightMiddleRectParent=document.createElement("div"),t.rightMiddleRectParent.style.cursor="e-resize",t.rightMiddleRectParent.id=this.documentHelper.owner.containerId+"_RightMiddleRectParent",this.applyProperties(t.rightMiddleRectParent),t.rightMiddleRectParent.style.width=this.documentHelper.isTouchInput?"30px":"14px",t.rightMiddleRectParent.style.height=this.documentHelper.isTouchInput?"30px":"14px",t.rightMiddleRectParent.style.opacity="-1",e.appendChild(t.rightMiddleRectParent),t.rightMiddleRect=document.createElement("div"),t.rightMiddleRect.id=this.documentHelper.owner.containerId+"_RightMiddleRect",t.rightMiddleRect.style.cursor="e-resize",this.applyProperties(t.rightMiddleRect),e.appendChild(t.rightMiddleRect),t.leftMiddleRectParent=document.createElement("div"),t.leftMiddleRectParent.style.cursor="w-resize",t.leftMiddleRectParent.id=this.documentHelper.owner.containerId+"_LeftMiddleRectParent",this.applyProperties(t.leftMiddleRectParent),t.leftMiddleRectParent.style.width=this.documentHelper.isTouchInput?"30px":"14px",t.leftMiddleRectParent.style.height=this.documentHelper.isTouchInput?"30px":"14px",t.leftMiddleRectParent.style.opacity="-1",e.appendChild(t.leftMiddleRectParent),t.leftMiddleRect=document.createElement("div"),t.leftMiddleRect.id=this.documentHelper.owner.containerId+"_LeftMiddleRect",t.leftMiddleRect.style.cursor="w-resize",this.applyProperties(t.leftMiddleRect),e.appendChild(t.leftMiddleRect),t.resizeContainerDiv},e.prototype.setImageResizerPosition=function(e,t,i,n,r){r.resizeContainerDiv.style.width=i+"px",r.resizeContainerDiv.style.height=n+"px",r.resizeContainerDiv.style.left=e+"px",r.resizeContainerDiv.style.top=t+"px",r.topRightRect.style.left=e+i-5+"px",r.topRightRect.style.top=t-4+"px",r.topLeftRect.style.left=e-5+"px",r.topLeftRect.style.top=t-4+"px",r.topMiddleRect.style.left=parseFloat(r.topLeftRect.style.left)+i/2-4+"px",r.topMiddleRect.style.top=t-4+"px",r.bottomRightRect.style.left=r.topRightRect.style.left,r.bottomRightRect.style.top=parseFloat(r.topRightRect.style.top)+n+"px",r.bottomLeftRect.style.left=r.topLeftRect.style.left,r.bottomLeftRect.style.top=parseFloat(r.topLeftRect.style.top)+n+"px",r.bottomMiddleRect.style.left=r.topMiddleRect.style.left,r.bottomMiddleRect.style.top=parseFloat(r.topMiddleRect.style.top)+n+"px",r.rightMiddleRect.style.left=e+i-4+"px",r.rightMiddleRect.style.top=parseFloat(r.topRightRect.style.top)+n/2+"px",r.leftMiddleRect.style.left=r.topLeftRect.style.left,r.leftMiddleRect.style.top=parseFloat(r.topLeftRect.style.top)+n/2+"px",r.topRightRectParent.style.left=this.documentHelper.isTouchInput?e+i-15+"px":e+i-8+"px",r.topRightRectParent.style.top=this.documentHelper.isTouchInput?t-15+"px":t-7+"px",r.topLeftRectParent.style.left=this.documentHelper.isTouchInput?e-15+"px":e-8+"px",r.topLeftRectParent.style.top=this.documentHelper.isTouchInput?t-15+"px":t-7+"px",r.topMiddleRectParent.style.left=parseFloat(r.topLeftRectParent.style.left)+i/2-4+"px",r.topMiddleRectParent.style.top=this.documentHelper.isTouchInput?t-15+"px":t-7+"px",r.bottomRightRectParent.style.left=r.topRightRectParent.style.left,r.bottomRightRectParent.style.top=parseFloat(r.topRightRectParent.style.top)+n+"px",r.bottomLeftRectParent.style.left=r.topLeftRectParent.style.left,r.bottomLeftRectParent.style.top=parseFloat(r.topLeftRectParent.style.top)+n+"px",r.bottomMiddleRectParent.style.left=r.topMiddleRectParent.style.left,r.bottomMiddleRectParent.style.top=parseFloat(r.topMiddleRectParent.style.top)+n+"px",r.rightMiddleRectParent.style.left=this.documentHelper.isTouchInput?e+i-15+"px":e+i-7+"px",r.rightMiddleRectParent.style.top=parseFloat(r.topRightRectParent.style.top)+n/2+"px",r.leftMiddleRectParent.style.left=r.topLeftRectParent.style.left,r.leftMiddleRectParent.style.top=parseFloat(r.topLeftRectParent.style.top)+n/2+"px",this.setImageResizingPoints(r),this.documentHelper.isTouchInput?this.applyPropertiesForTouch():this.applyPropertiesForMouse()},e.prototype.setImageResizingPoints=function(e){this.imageResizerPoints.resizeContainerDiv.x=parseFloat(e.resizeContainerDiv.style.left),this.imageResizerPoints.resizeContainerDiv.y=parseFloat(e.resizeContainerDiv.style.top),this.imageResizerPoints.bottomLeftRectParent.x=parseFloat(e.bottomLeftRectParent.style.left),this.imageResizerPoints.bottomLeftRectParent.y=parseFloat(e.bottomLeftRectParent.style.top),this.imageResizerPoints.bottomRightRectParent.x=parseFloat(e.bottomRightRectParent.style.left),this.imageResizerPoints.bottomRightRectParent.y=parseFloat(e.bottomRightRectParent.style.top),this.imageResizerPoints.bottomMiddleRectParent.x=parseFloat(e.bottomMiddleRectParent.style.left),this.imageResizerPoints.bottomMiddleRectParent.y=parseFloat(e.bottomMiddleRectParent.style.top),this.imageResizerPoints.topLeftRectParent.x=parseFloat(e.topLeftRectParent.style.left),this.imageResizerPoints.topLeftRectParent.y=parseFloat(e.topLeftRectParent.style.top),this.imageResizerPoints.topRightRectParent.x=parseFloat(e.topRightRectParent.style.left),this.imageResizerPoints.topRightRectParent.y=parseFloat(e.topRightRectParent.style.top),this.imageResizerPoints.topMiddleRectParent.x=parseFloat(e.topMiddleRectParent.style.left),this.imageResizerPoints.topMiddleRectParent.y=parseFloat(e.topMiddleRectParent.style.top),this.imageResizerPoints.leftMiddleRectParent.x=parseFloat(e.leftMiddleRectParent.style.left),this.imageResizerPoints.leftMiddleRectParent.y=parseFloat(e.leftMiddleRectParent.style.top),this.imageResizerPoints.rightMiddleRectParent.x=parseFloat(e.rightMiddleRectParent.style.left),this.imageResizerPoints.rightMiddleRectParent.y=parseFloat(e.rightMiddleRectParent.style.top)},e.prototype.initResizeContainerDiv=function(e){e.resizeContainerDiv=document.createElement("div"),e.resizeContainerDiv.id=this.documentHelper.owner.containerId+"_ResizeDivElement",e.resizeContainerDiv.style.position="absolute",e.resizeContainerDiv.style.border="1px solid #bfbfbf",e.resizeContainerDiv.style.zIndex="30",e.resizeContainerDiv.style.backgroundColor="transparent",e.resizeContainerDiv.style.display="block"},e.prototype.applyProperties=function(e){e.style.position="absolute",e.style.width="8px",e.style.height="8px",e.style.fontSize="0px",e.style.zIndex=" 551",e.style.backgroundColor="#ffffff",e.style.border="1px solid #bfbfbf",e.style.boxShadow="0 1px 2px 0 #bfbfbf 0.35",e.style.color="#000000"},e.prototype.handleImageResizing=function(e,i,n){i/=this.documentHelper.zoomFactor,n/=this.documentHelper.zoomFactor,this.leftValue=t.isNullOrUndefined(this.leftValue)?i:this.leftValue,this.topValue=t.isNullOrUndefined(this.topValue)?n:this.topValue;var r,o=this.selectedResizeElement.id.split("_"),s=o[o.length-1];switch(s){case"TopRightRectParent":i=(r=this.topRightResizing(e)).left,n=r.top;break;case"TopLeftRectParent":i=-(r=this.topLeftResizing(e)).left,n=-r.top;break;case"TopMiddleRectParent":i=0,n=this.topMiddleResizing(e);break;case"BottomRightRectParent":i=(r=this.bottomRightResizing(e)).left,n=r.top;break;case"BottomLeftRectParent":i=-(r=this.bottomLeftResizing(e)).left,n=-r.top;break;case"BottomMiddleRectParent":n=e.y-n,i=0;break;case"RightMiddleRectParent":i=e.x-i,n=0;break;case"LeftMiddleRectParent":i=this.leftMiddleResizing(e),n=0}if(0!==i||0!==n){var a=this.currentImageElementBox.line.paragraph,l=this.currentImageElementBox;if(!t.isNullOrUndefined(a)&&a.isInsideTable){var d=a.containerWidget;if(!t.isNullOrUndefined(d)){var h=d.containerWidget,c=W.convertPointToPixel(l.height),p=h.height-c;n>0&&h.y+p+c+n>this.viewer.clientArea.bottom&&(this.isImageMoveToNextPage=!0)}}if(this.owner.enableHistoryMode&&this.initHistoryForImageResizer(this.currentImageElementBox),!t.isNullOrUndefined(this.currentImageElementBox)){var u=this.currentImageElementBox.width+i>10?this.currentImageElementBox.width+i:10,g=this.currentImageElementBox.height+n>10?this.currentImageElementBox.height+n:10;"BottomRightRectParent"!==s&&"TopRightRectParent"!==s&&"BottomLeftRectParent"!==s&&"TopLeftRectParent"!==s||(g=this.currentImageElementBox.height/this.currentImageElementBox.width*u,u=this.currentImageElementBox.width/this.currentImageElementBox.height*g),this.currentImageElementBox.width=u,this.currentImageElementBox.height=g;this.currentImageElementBox.line.paragraph;this.positionImageResizer(this.currentImageElementBox)}this.isImageResizing=!0}},e.prototype.handleImageResizingOnMouse=function(e){if(!t.isNullOrUndefined(this.selectedResizeElement)){var i=parseFloat(this.selectedResizeElement.style.left),n=parseFloat(this.selectedResizeElement.style.top),r=new O(e.offsetX,e.offsetY),o=this.viewer.findFocusedPage(r,!0);this.handleImageResizing(o,i,n)}},e.prototype.topMiddleResizing=function(e){var t;return this.topValue>=e.y?(t=this.topValue/e.y,this.topValue=e.y,this.viewer instanceof re&&this.topValue<=this.viewer.pageGap&&(t=1)):(t=-e.y/this.topValue,this.topValue=e.y,0===this.topValue&&(t=-1)),t},e.prototype.leftMiddleResizing=function(e){var t;return this.leftValue>=e.x?(t=this.leftValue/e.x,this.leftValue=e.x,0===this.leftValue&&(t=1,this.leftValue=parseFloat(this.selectedResizeElement.style.left))):(t=-e.x/this.leftValue,this.leftValue=e.x),t},e.prototype.topRightResizing=function(e){return this.leftValue<=e.x&&this.topValue>=e.y?this.getOuterResizingPoint(e):this.getInnerResizingPoint(e)},e.prototype.topLeftResizing=function(e){return this.leftValue>=e.x&&this.topValue>=e.y?this.getOuterResizingPoint(e):this.getInnerResizingPoint(e)},e.prototype.bottomRightResizing=function(e){return this.leftValue<=e.x&&this.topValue<=e.y?this.getOuterResizingPoint(e):this.getInnerResizingPoint(e)},e.prototype.bottomLeftResizing=function(e){return this.leftValue>=e.x&&this.topValue<=e.y?this.getOuterResizingPoint(e):this.getInnerResizingPoint(e)},e.prototype.getOuterResizingPoint=function(e){var t,i;return t=e.x-this.leftValue,this.leftValue=e.x,i=e.y-this.topValue,this.topValue=e.y,{left:t,top:i}},e.prototype.getInnerResizingPoint=function(e){var t,i;return t=-(this.leftValue-e.x),this.leftValue=e.x,i=-(this.topValue-e.y),this.topValue=e.y,{left:t,top:i}},e.prototype.handleImageResizingOnTouch=function(e){if(!t.isNullOrUndefined(this.selectedResizeElement)){var i=parseFloat(this.selectedResizeElement.style.left)+24,n=parseFloat(this.selectedResizeElement.style.top)+24,r=e.touches,o=new O(r[0].clientX,r[0].clientY),s=this.viewer.findFocusedPage(o,!0);if(t.isNullOrUndefined(this.currentImageElementBox)||t.isNullOrUndefined(this.currentImageElementBox))return;this.handleImageResizing(s,i,n)}},e.prototype.getImagePoint=function(e){var i=this.documentHelper.render.getScaledValue(e.x,1),n=this.documentHelper.render.getScaledValue(e.y,2);e=new O(i,n);var r=this.imageResizerPoints,o="",s=void 0,a=r.bottomMiddleRectParent,l=r.bottomRightRectParent,d=r.bottomLeftRectParent,h=r.topMiddleRectParent,c=r.topRightRectParent,p=r.topLeftRectParent,u=r.rightMiddleRectParent,g=r.leftMiddleRectParent;return t.isNullOrUndefined(this.bottomMiddleRectParent)||"none"===this.bottomMiddleRectParent.style.display||(e.x>a.x&&e.x<=a.x+15&&e.y>a.y&&e.y<=a.y+15?(s=this.bottomMiddleRectParent,o="s-resize"):e.x>l.x&&e.x<=l.x+15&&e.y>l.y&&e.y<=l.y+15?(s=this.bottomRightRectParent,o="se-resize"):e.x>d.x&&e.x<=d.x+15&&e.y>d.y&&e.y<=d.y+15?(s=this.bottomLeftRectParent,o="sw-resize"):e.x>h.x&&e.x<=h.x+15&&e.y>h.y&&e.y<=h.y+15?(s=this.topMiddleRectParent,o="n-resize"):e.x>c.x&&e.x<=c.x+15&&e.y>c.y&&e.y<=c.y+15?(s=this.topRightRectParent,o="ne-resize"):e.x>p.x&&e.x<=p.x+15&&e.y>p.y&&e.y<=p.y+15?(s=this.topLeftRectParent,o="nw-resize"):e.x>g.x&&e.x<=g.x+15&&e.y>g.y&&e.y<=g.y+15?(s=this.leftMiddleRectParent,o="w-resize"):e.x>u.x&&e.x<=u.x+15&&e.y>u.y&&e.y<=u.y+15?(s=this.rightMiddleRectParent,o="e-resize"):!t.isNullOrUndefined(this.resizeContainerDiv)&&e.x>parseFloat(this.resizeContainerDiv.style.left)&&e.x<=parseFloat(this.resizeContainerDiv.style.left)+parseFloat(this.resizeContainerDiv.style.width)&&e.y>parseFloat(this.resizeContainerDiv.style.top)&&e.y<=parseFloat(this.resizeContainerDiv.style.top)+parseFloat(this.resizeContainerDiv.style.height)&&(o="move")),{selectedElement:s,resizePosition:o}},e.prototype.applyPropertiesForMouse=function(){t.isNullOrUndefined(this.bottomLeftRectParent)||(this.bottomMiddleRectParent.style.width="14px",this.bottomMiddleRectParent.style.height="14px",this.bottomRightRectParent.style.width="14px",this.bottomRightRectParent.style.height="14px",this.bottomLeftRectParent.style.width="14px",this.bottomLeftRectParent.style.height="14px",this.topMiddleRectParent.style.width="14px",this.topMiddleRectParent.style.height="14px",this.topRightRectParent.style.width="14px",this.topRightRectParent.style.height="14px",this.topLeftRectParent.style.width="14px",this.topLeftRectParent.style.height="14px",this.leftMiddleRectParent.style.width="14px",this.leftMiddleRectParent.style.height="14px",this.rightMiddleRectParent.style.width="14px",this.rightMiddleRectParent.style.height="14px")},e.prototype.getImagePointOnTouch=function(e){var i=this.documentHelper.render.getScaledValue(e.x,1),n=this.documentHelper.render.getScaledValue(e.y,2);e=new O(i,n);var r=this.imageResizerPoints,o="",s=void 0,a=r.bottomMiddleRectParent,l=r.bottomRightRectParent,d=r.bottomLeftRectParent,h=r.topMiddleRectParent,c=r.topRightRectParent,p=r.topLeftRectParent,u=r.rightMiddleRectParent,g=r.leftMiddleRectParent;return t.isNullOrUndefined(this.bottomMiddleRectParent)||"none"===this.bottomMiddleRectParent.style.display||(e.x>a.x&&e.x<=a.x+25&&e.y>a.y&&e.y<=a.y+25?(s=this.bottomMiddleRectParent,o="s-resize"):e.x>l.x&&e.x<=l.x+25&&e.y>l.y&&e.y<=l.y+25?(s=this.bottomRightRectParent,o="se-resize"):e.x>d.x&&e.x<=d.x+25&&e.y>d.y&&e.y<=d.y+25?(s=this.bottomLeftRectParent,o="sw-resize"):e.x>h.x&&e.x<=h.x+25&&e.y>h.y&&e.y<=h.y+25?(s=this.topMiddleRectParent,o="n-resize"):e.x>c.x&&e.x<=c.x+25&&e.y>c.y&&e.y<=c.y+25?(s=this.topRightRectParent,o="ne-resize"):e.x>p.x&&e.x<=p.x+25&&e.y>p.y&&e.y<=p.y+25?(s=this.topLeftRectParent,o="nw-resize"):e.x>g.x&&e.x<=g.x+25&&e.y>g.y&&e.y<=g.y+25?(s=this.leftMiddleRectParent,o="w-resize"):e.x>u.x&&e.x<=u.x+25&&e.y>u.y&&e.y<=u.y+25?(s=this.rightMiddleRectParent,o="e-resize"):!t.isNullOrUndefined(this.resizeContainerDiv)&&e.x>parseFloat(this.resizeContainerDiv.style.left)&&e.x<=parseFloat(this.resizeContainerDiv.style.left)+parseFloat(this.resizeContainerDiv.style.width)&&e.y>parseFloat(this.resizeContainerDiv.style.top)&&e.y<=parseFloat(this.resizeContainerDiv.style.top)+parseFloat(this.resizeContainerDiv.style.height)&&(o="move")),{selectedElement:s,resizePosition:o}},e.prototype.applyPropertiesForTouch=function(){t.isNullOrUndefined(this.bottomLeftRectParent)||(this.bottomMiddleRectParent.style.width="30px",this.bottomMiddleRectParent.style.height="30px",this.bottomRightRectParent.style.width="30px",this.bottomRightRectParent.style.height="30px",this.bottomLeftRectParent.style.width="30px",this.bottomLeftRectParent.style.height="30px",this.topMiddleRectParent.style.width="30px",this.topMiddleRectParent.style.height="30px",this.topRightRectParent.style.width="30px",this.topRightRectParent.style.height="30px",this.topLeftRectParent.style.width="30px",this.topLeftRectParent.style.height="30px",this.leftMiddleRectParent.style.width="30px",this.leftMiddleRectParent.style.height="30px",this.rightMiddleRectParent.style.width="30px",this.rightMiddleRectParent.style.height="30px")},e.prototype.mouseUpInternal=function(){this.currentImageElementBox.width=parseFloat(this.imageResizerDiv.style.width)/this.documentHelper.zoomFactor,this.currentImageElementBox.height=parseFloat(this.imageResizerDiv.style.height)/this.documentHelper.zoomFactor,this.owner.isShiftingEnabled=!0,this.owner.editorModule.setOffsetValue(this.owner.selection),this.documentHelper.layout.reLayoutParagraph(this.currentImageElementBox.line.paragraph,0,0),this.updateHistoryForImageResizer(),this.owner.editorModule.reLayout(this.owner.selection,!0),this.viewer.updateScrollBars()},e.prototype.initHistoryForImageResizer=function(e){!t.isNullOrUndefined(this.owner)&&t.isNullOrUndefined(this.baseHistoryInfo)&&(this.baseHistoryInfo=new Jt(this.owner),this.baseHistoryInfo.action="ImageResizing",this.baseHistoryInfo.updateSelection(),this.baseHistoryInfo.modifiedProperties.push(new Wt(e)))},e.prototype.updateHistoryForImageResizer=function(){if(!t.isNullOrUndefined(this.owner)&&!t.isNullOrUndefined(this.baseHistoryInfo)){var e=this.baseHistoryInfo.modifiedProperties[0];this.currentImageElementBox.width===e.width&&this.currentImageElementBox.height===e.height?this.baseHistoryInfo.modifiedProperties.pop():this.owner.editorHistory.recordChanges(this.baseHistoryInfo),this.baseHistoryInfo=void 0}},e.prototype.updateImageResizerPosition=function(){if(!t.isNullOrUndefined(this.currentImageElementBox)){var e,i=(this.currentImageElementBox,this.currentImageElementBox),n=i.line,r=void 0,o=void 0,s=void 0;this.currentImageElementBox instanceof Ge?(e=this.documentHelper.selection.getTop(n)+i.margin.top,r=this.documentHelper.selection.getLeftInternal(n,i,0),o=e*this.documentHelper.zoomFactor,s=r*this.documentHelper.zoomFactor):(s=i.x*this.documentHelper.zoomFactor,o=i.y*this.documentHelper.zoomFactor);var a=this.documentHelper.render.getScaledValue(i.height,2),l=this.documentHelper.render.getScaledValue(i.width,1);this.setImageResizerPosition(s,o,l,a,this)}},e.prototype.destroy=function(){t.isNullOrUndefined(this.resizeContainerDiv)||(this.resizeContainerDiv.innerHTML=""),t.isNullOrUndefined(this.topLeftRect)||(this.topLeftRect.innerHTML=""),t.isNullOrUndefined(this.topMiddleRect)||(this.topMiddleRect.innerHTML=""),t.isNullOrUndefined(this.topRightRect)||(this.topRightRect.innerHTML=""),t.isNullOrUndefined(this.bottomLeftRect)||(this.bottomLeftRect.innerHTML=""),t.isNullOrUndefined(this.bottomMiddleRect)||(this.bottomMiddleRect.innerHTML=""),t.isNullOrUndefined(this.bottomRightRect)||(this.bottomRightRect.innerHTML=""),t.isNullOrUndefined(this.leftMiddleRect)||(this.leftMiddleRect.innerHTML=""),t.isNullOrUndefined(this.rightMiddleRect)||(this.rightMiddleRect.innerHTML=""),t.isNullOrUndefined(this.imageResizerDiv)||(this.imageResizerDiv.innerHTML=""),t.isNullOrUndefined(this.selectedImageWidget)||this.selectedImageWidget.destroy(),t.isNullOrUndefined(this.imageResizerDivElement)||(this.imageResizerDivElement.innerHTML=""),this.imageResizerDivElement=void 0,this.resizeContainerDiv=void 0,this.topLeftRect=void 0,this.topMiddleRect=void 0,this.topRightRect=void 0,this.bottomLeftRect=void 0,this.bottomMiddleRect=void 0,this.bottomRightRect=void 0,this.leftMiddleRect=void 0,this.rightMiddleRect=void 0,this.imageResizerDiv=void 0,this.selectedImageWidget=void 0,this.isImageResizing=!1,this.isImageResizerVisible=!1,this.currentImageElementBoxIn=void 0,this.resizeMarkSizeIn=void 0,this.documentHelper=void 0,this.owner=void 0},e}(),Qt=function(){function e(){this.resizeContainerDiv=new O(0,0),this.topLeftRectParent=new O(0,0),this.topMiddleRectParent=new O(0,0),this.topRightRectParent=new O(0,0),this.bottomLeftRectParent=new O(0,0),this.bottomMiddleRectParent=new O(0,0),this.bottomRightRectParent=new O(0,0),this.leftMiddleRectParent=new O(0,0),this.rightMiddleRectParent=new O(0,0)}return e}(),$t=function(){function e(e,t){this.heightIn=0,this.widthIn=0,this.heightIn=e,this.widthIn=t}return Object.defineProperty(e.prototype,"height",{get:function(){return this.heightIn},set:function(e){this.heightIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.widthIn},set:function(e){this.widthIn=e},enumerable:!0,configurable:!0}),e}(),ei=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ti=function(e){function i(t,i){var n=e.call(this,t)||this;return n.isChildHistoryInfo=!1,n.editRangeStart=void 0,n.documentHelper=t.documentHelper,n.isChildHistoryInfo=i,n}return ei(i,e),Object.defineProperty(i.prototype,"hasAction",{get:function(){return!t.isNullOrUndefined(this.modifiedActions)},enumerable:!0,configurable:!0}),i.prototype.addModifiedAction=function(e){this.editorHistory.isUndoing||this.editorHistory.isRedoing||(t.isNullOrUndefined(this.modifiedActions)&&(this.modifiedActions=[]),this.modifiedActions.push(e))},i.prototype.revert=function(){if(this.editorHistory.currentHistoryInfo=this,"BordersAndShading"===this.action&&(this.owner.editorModule.isBordersAndShadingDialog=!0),!t.isNullOrUndefined(this.modifiedActions))if(this.editorHistory.isUndoing)for(e=this.modifiedActions.length;e>0;)(i=this.modifiedActions[e-1]).revert(),e-=1;else for(var e=0;e<this.modifiedActions.length;){var i=this.modifiedActions[e];i.revert(),e+=1}if("RestrictEditing"===this.action){var n=""!==this.editRangeStart.user?this.editRangeStart.user:this.editRangeStart.group;if(this.editorHistory.isUndoing){var r=this.owner.documentHelper.editRanges.get(n).indexOf(this.editRangeStart);-1!==r&&this.owner.documentHelper.editRanges.get(n).splice(r,1)}else this.owner.editor.updateRangeCollection(this.editRangeStart,n);this.owner.selection.updateEditRangeCollection()}this.isChildHistoryInfo?this.editorHistory.updateComplexHistoryInternal():this.editorHistory.updateComplexHistory()},i.prototype.destroy=function(){if(!t.isNullOrUndefined(this.modifiedActions)){for(;this.modifiedActions.length>0;){var i=this.modifiedActions[this.modifiedActions.length-1];i.destroy(),this.modifiedActions.splice(this.modifiedActions.indexOf(i),1)}this.modifiedActions=void 0}e.prototype.destroy.call(this)},i}(Jt),ii=function(){function e(e){this.undoStackIn=[],this.redoStackIn=[],this.historyInfoStack=[],this.isUndoing=!1,this.isRedoing=!1,this.owner=e,this.documentHelper=e.documentHelper,this.modifiedParaFormats=new g,this.undoLimitIn=500,this.redoLimitIn=500}return Object.defineProperty(e.prototype,"currentHistoryInfo",{get:function(){return this.historyInfoStack&&this.historyInfoStack.length>0?this.historyInfoStack[this.historyInfoStack.length-1]:void 0},set:function(e){e instanceof ti?this.historyInfoStack.push(e):this.historyInfoStack.pop()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"undoStack",{get:function(){return this.undoStackIn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"redoStack",{get:function(){return this.redoStackIn},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"undoLimit",{get:function(){return t.isNullOrUndefined(this.undoLimitIn)?0:this.undoLimitIn},set:function(e){if(e<0)throw new Error("The limit should be greater than or equal to zero.");this.undoLimitIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"redoLimit",{get:function(){return t.isNullOrUndefined(this.redoLimitIn)?0:this.redoLimitIn},set:function(e){if(e<0)throw new Error("The limit should be greater than or equal to zero.");this.redoLimitIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewer",{get:function(){return this.owner.viewer},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"EditorHistory"},e.prototype.canUndo=function(){return!t.isNullOrUndefined(this.undoStack)&&this.undoStack.length>0},e.prototype.canRedo=function(){return!t.isNullOrUndefined(this.redoStack)&&this.redoStack.length>0},e.prototype.initializeHistory=function(e){this.currentBaseHistoryInfo=new Jt(this.owner),this.currentBaseHistoryInfo.action=e,this.currentBaseHistoryInfo.updateSelection()},e.prototype.initComplexHistory=function(e,i){this.currentHistoryInfo=new ti(e.owner,!t.isNullOrUndefined(this.currentHistoryInfo)),this.currentHistoryInfo.action=i,this.currentHistoryInfo.updateSelection()},e.prototype.initResizingHistory=function(e,i){if(1===i.resizeNode)this.initializeHistory("RowResizing"),t.isNullOrUndefined(this.currentBaseHistoryInfo)||this.currentBaseHistoryInfo.modifiedProperties.push(new jt(e,i.currentResizingTable.childWidgets[i.resizerPosition].rowFormat));else if(this.initializeHistory("CellResizing"),this.currentBaseHistoryInfo){i.currentResizingTable=i.currentResizingTable.combineWidget(this.viewer);var n=new qt(i.currentResizingTable,this.owner);n.startingPoint=e,this.currentBaseHistoryInfo.modifiedProperties.push(n)}},e.prototype.updateResizingHistory=function(e,i){if(1===i.resizeNode){if(!t.isNullOrUndefined(this.currentBaseHistoryInfo)){var n=this.currentBaseHistoryInfo.modifiedProperties[0];n.startingPoint.y===e.y?this.currentBaseHistoryInfo.modifiedProperties.length=0:(n.displacement=W.convertPixelToPoint(e.y-n.startingPoint.y),this.recordChanges(this.currentBaseHistoryInfo),this.currentBaseHistoryInfo=void 0)}}else if(!t.isNullOrUndefined(this.currentBaseHistoryInfo)){var r=this.currentBaseHistoryInfo.modifiedProperties[0];r.startingPoint.x===e.x?this.currentBaseHistoryInfo.modifiedProperties.length=0:(r.displacement=W.convertPixelToPoint(e.x-r.startingPoint.x),r.endIndex=i.getCellReSizerPosition(e),this.owner.editorHistory.recordChanges(this.currentBaseHistoryInfo),this.currentBaseHistoryInfo=void 0)}},e.prototype.recordChanges=function(e){if(this.owner.enableHistoryMode)if(this.isUndoing){if(t.isNullOrUndefined(this.redoStack)&&(this.redoStackIn=[]),this.redoStack.length===this.redoLimit&&this.redoLimit>0){i=this.undoLimit>20?10:1;this.redoStackIn.splice(0,i)}this.redoStack.length<this.redoLimit&&this.redoStack.push(e)}else{if(this.isRedoing||this.clearRedoStack(),t.isNullOrUndefined(this.undoStack)&&(this.undoStackIn=[]),this.undoStack.length===this.undoLimit&&this.undoLimit>0){var i=this.undoLimit>20?10:1;this.undoStackIn.splice(0,i)}this.undoStack.length<this.undoLimit&&this.undoStackIn.push(e)}},e.prototype.updateHistory=function(){this.documentHelper.owner.enableHistoryMode&&!t.isNullOrUndefined(this.currentBaseHistoryInfo)&&(!t.isNullOrUndefined(this.currentBaseHistoryInfo)&&t.isNullOrUndefined(this.currentBaseHistoryInfo.endPosition)&&(this.currentBaseHistoryInfo.endPosition=this.currentBaseHistoryInfo.insertPosition),t.isNullOrUndefined(this.currentHistoryInfo)?this.recordChanges(this.currentBaseHistoryInfo):this.currentHistoryInfo.addModifiedAction(this.currentBaseHistoryInfo),this.currentBaseHistoryInfo=void 0)},e.prototype.isHandledComplexHistory=function(){var e=!1;return this.isUndoing||this.isRedoing||(e=this.owner.editorModule.insertRemoveBookMarkElements()),this.documentHelper.owner.enableHistoryMode&&!t.isNullOrUndefined(this.currentHistoryInfo)?(this.updateHistory(),e=!0):this.owner.editorModule.isHandledComplex&&(e=!0),e},e.prototype.updateComplexHistory=function(){var e=this.documentHelper.selection;if(this.currentHistoryInfo.hasAction){if("AutoFormatHyperlink"===this.currentHistoryInfo.action){t=new Nt(e.owner);this.owner.editorModule.setPositionForCurrentIndex(t,this.currentHistoryInfo.insertPosition),e.owner.editorHistory.isUndoing?(this.owner.editorModule.setPositionForCurrentIndex(e.start,this.currentHistoryInfo.selectionStart),this.owner.editorModule.setPositionForCurrentIndex(e.end,this.currentHistoryInfo.selectionEnd)):(this.owner.editorModule.setPositionForCurrentIndex(e.start,this.currentHistoryInfo.endPosition),this.owner.editorModule.setPositionForCurrentIndex(e.end,this.currentHistoryInfo.endPosition))}if("InsertHyperlink"===this.currentHistoryInfo.action){var t=new Nt(e.owner);this.owner.editorModule.setPositionForCurrentIndex(t,this.currentHistoryInfo.insertPosition);var i=new Nt(e.owner);this.owner.editorModule.setPositionForCurrentIndex(i,this.currentHistoryInfo.endPosition),this.documentHelper.layout.reLayoutParagraph(t.paragraph,0,0),i.paragraph!==t.paragraph&&this.documentHelper.layout.reLayoutParagraph(i.paragraph,0,0)}"ReplaceAll"===this.currentHistoryInfo.action?this.owner.editorModule.layoutWholeDocument():e.owner.isShiftingEnabled&&(this.documentHelper.layout.shiftLayoutedItems(!1),this.owner.enableHeaderAndFooter&&this.owner.editorModule.updateHeaderFooterWidget(),this.documentHelper.removeEmptyPages())}this.owner.showRevisions&&this.owner.trackChangesPane.updateTrackChanges(),e.owner.isShiftingEnabled=!1,e.owner.isLayoutEnabled=!0,"ApplyStyle"===this.currentHistoryInfo.action?this.owner.editor.getOffsetValue(e):(e.start.updatePhysicalPosition(!0),e.isEmpty?e.end.setPositionInternal(e.start):e.end.updatePhysicalPosition(!0)),e.upDownSelectionLength=e.end.location.x,this.documentHelper.isScrollHandler=!0,this.viewer.updateScrollBars(),e.fireSelectionChanged(!0),this.documentHelper.isScrollHandler=!1,this.documentHelper.updateFocus(),this.updateComplexHistoryInternal(),this.owner.editorModule.fireContentChange()},e.prototype.updateComplexHistoryInternal=function(){t.isNullOrUndefined(this.currentHistoryInfo)||(t.isNullOrUndefined(this.currentHistoryInfo.endPosition)&&(this.currentHistoryInfo.endPosition=this.currentHistoryInfo.insertPosition),this.historyInfoStack.length>1?this.historyInfoStack[this.historyInfoStack.length-2].addModifiedAction(this.currentHistoryInfo):this.recordChanges(this.currentHistoryInfo),this.currentHistoryInfo=void 0)},e.prototype.updateListChangesInHistory=function(e,i){this.currentBaseHistoryInfo=new Jt(this.documentHelper.owner),this.currentBaseHistoryInfo.action="List",this.currentBaseHistoryInfo.updateSelection();for(var n=new g,r=0;r<e.levels.length;r++){var o=this.documentHelper.getAbstractListById(i.abstractListId).levels[r];this.currentBaseHistoryInfo.addModifiedPropertiesForList(o);var s=new Vt(o,e.levels[r]);t.isNullOrUndefined(o)||this.documentHelper.owner.editorModule.copyListLevel(o,e.levels[r]),n.add(r,s)}return n},e.prototype.applyListChanges=function(e,i){t.isNullOrUndefined(this.modifiedParaFormats)&&(this.modifiedParaFormats=new g);for(var n=[],r=0;r<this.documentHelper.listParagraphs.length;r++){var o=this.documentHelper.listParagraphs[r].paragraphFormat,s=this.documentHelper.getListById(o.listFormat.listId),a=this.documentHelper.layout.getListLevel(s,o.listFormat.listLevelNumber);if(i.containsKey(o.listFormat.listLevelNumber)&&i.get(o.listFormat.listLevelNumber).ownerListLevel===a){var l=new P(null);l.leftIndent=o.leftIndent,l.firstLineIndent=o.firstLineIndent;var d=new _t(o,l);n.push(d),this.owner.editorModule.copyFromListLevelParagraphFormat(o,a.paragraphFormat)}}this.modifiedParaFormats.add(this.currentBaseHistoryInfo,n)},e.prototype.updateListChanges=function(e){this.documentHelper.owner.isLayoutEnabled=!1,this.owner.editorModule.updateListParagraphs();for(var i=0;i<e.keys.length;i++){var n=e.keys[0],r=e.get(n);t.isNullOrUndefined(this.currentBaseHistoryInfo)||(r=this.currentBaseHistoryInfo.addModifiedPropertiesForList(r.ownerListLevel)),this.owner.editorModule.copyListLevel(r.ownerListLevel,r.modifiedListLevel)}this.revertListChanges(),this.documentHelper.owner.isLayoutEnabled=!0,this.documentHelper.renderedLists.clear(),this.documentHelper.renderedLevelOverrides=[],this.documentHelper.pages=[],this.documentHelper.layout.layout();var o=this.documentHelper.selection;o.start.updatePhysicalPosition(!0),o.isEmpty?o.end.setPositionInternal(o.start):o.end.updatePhysicalPosition(!0),o.upDownSelectionLength=o.end.location.x,o.fireSelectionChanged(!1),this.updateHistory()},e.prototype.revertListChanges=function(){if(!t.isNullOrUndefined(this.currentBaseHistoryInfo)&&this.documentHelper.owner.editorHistory.modifiedParaFormats.containsKey(this.currentBaseHistoryInfo))for(var e=this.modifiedParaFormats.get(this.currentBaseHistoryInfo),i=0;i<e.length;i++){var n=new P(null);n.leftIndent=e[i].ownerFormat.leftIndent,n.firstLineIndent=e[i].ownerFormat.firstLineIndent,e[i].ownerFormat.copyFormat(e[i].modifiedFormat),e[i].modifiedFormat.leftIndent=n.leftIndent,e[i].modifiedFormat.firstLineIndent=n.firstLineIndent}},e.prototype.undo=function(){if((!this.owner.isReadOnlyMode||"FormFieldsOnly"===this.owner.documentHelper.protectionType)&&this.canUndo()&&this.owner.enableHistoryMode){var e=this.undoStack.pop();this.isUndoing=!0,e.revert(),this.isUndoing=!1,this.owner.selection.checkForCursorVisibility(),this.owner.editorModule.isBordersAndShadingDialog=!1}},e.prototype.redo=function(){if((!this.owner.isReadOnlyMode||"FormFieldsOnly"===this.owner.documentHelper.protectionType)&&this.canRedo()&&this.owner.enableHistoryMode){var e=this.redoStack.pop();"BordersAndShading"===e.action&&(this.owner.editorModule.isBordersAndShadingDialog=!0),this.isRedoing=!0,e.revert(),this.isRedoing=!1,this.owner.selection.checkForCursorVisibility(),this.owner.editorModule.isBordersAndShadingDialog=!1}},e.prototype.destroy=function(){this.clearHistory(),this.undoStackIn=void 0,this.redoStackIn=void 0},e.prototype.clearHistory=function(){this.clearUndoStack(),this.clearRedoStack()},e.prototype.clearUndoStack=function(){if(this.canUndo())for(;this.undoStack.length>0;){var e=this.undoStack.pop();e.destroy(),e=void 0}},e.prototype.clearRedoStack=function(){if(this.canRedo())for(;this.redoStack.length>0;){var e=this.redoStack.pop();e.destroy(),e=void 0}},e}(),ni=function(){function e(e){this.version=0,this.owner=e}return Object.defineProperty(e.prototype,"documentHelper",{get:function(){return this.owner.documentHelper},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"selection",{get:function(){return this.owner.selection},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"collaborativeEditingSettings",{get:function(){return this.owner.documentEditorSettings.collaborativeEditingSettings},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"CollaborativeEditing"},e.prototype.updateAction=function(e){Array.isArray(e)||(e=[e]);for(var t=0;t<e.length;t++){var i=e[t];switch(i.action){case"LockContent":this.transFormLockRegion(i),this.lockRegion(i.selectionInfo.start,i.selectionInfo.end,i.author);break;case"SaveContent":this.version=i.version,this.updateRegion(i.author,i.data);break;case"UnlockContent":this.version=i.version,this.updateRegion(i.author,i.data),this.removeEditRange(i.author)}}},e.prototype.transFormLockRegion=function(e){var i=e.selectionInfo.previousLockInfo;if(!t.isNullOrUndefined(i)){var n=i.author,r=0,o=0;if(this.documentHelper.editRanges.containsKey(n)){var s=this.documentHelper.editRanges.get(n);if(s.length>0){var a=this.selection.getPosition(s[0]),l=this.selection.getHierarchicalIndexByPosition(a.endPosition).split(";"),d=i.end.split(";");r=parseInt(l[0],10)-parseInt(d[0],10),o=parseInt(l[1],10)-parseInt(d[1],10),e.selectionInfo.start.split(";")[0]===i.end.split(";")[0]?(e.selectionInfo.start=this.tranformPosition(e.selectionInfo.start,r,o),e.selectionInfo.end=this.tranformPosition(e.selectionInfo.end,r,o)):(e.selectionInfo.start=this.tranformPosition(e.selectionInfo.start,r,0),e.selectionInfo.end=this.tranformPosition(e.selectionInfo.end,r,0))}}}},e.prototype.lockContent=function(e){var i=this;if(this.canLock()){var n=this.owner.selection.start,r=this.owner.selection.end;if(this.owner.selection.isForward||(n=this.owner.selection.end,r=this.owner.selection.start),n.paragraph.isInsideTable){var o=this.owner.documentHelper.layout.getParentTable(n.paragraph),s=this.owner.selection.getFirstParagraphBlock(o);n.setPosition(s.childWidgets[0],!0)}else n.paragraphStartInternal(this.owner.selection,!1);if(r.paragraph.isInsideTable){var o=this.owner.documentHelper.layout.getParentTable(r.paragraph),a=this.owner.selection.getLastParagraphBlock(o),l=a.lastChild.getEndOffset();r.setPositionParagraph(a.lastChild,l)}else r.moveToParagraphEndInternal(this.owner.selection,!1);var d=this.owner.selection.getHierarchicalIndexByPosition(n),h=this.owner.selection.getHierarchicalIndexByPosition(r),c={start:d,end:h,roomName:this.owner.documentEditorSettings.collaborativeEditingSettings.roomName,author:t.isNullOrUndefined(e)?this.owner.currentUser:e,version:this.version},p=this.selection.getParagraphInfo(n),u=this.selection.getParagraphInfo(r);this.owner.selection.select(d,h);var g=new v;g.url=this.owner.serviceUrl+this.owner.serverActionSettings.canLock,g.contentType="application/json;charset=UTF-8",g.onSuccess=function(e){i.successHandler(e,c,p,u)},g.onFailure=this.failureHandler.bind(this),g.onError=this.failureHandler.bind(this),g.customHeaders=this.owner.headers,g.send(c)}},e.prototype.canLock=function(){var e=this.documentHelper.editRanges;if(e.containsKey(this.owner.currentUser))return!1;for(var i=e.keys,n=0;n<i.length;n++){var r=e.get(i[n]);if(!t.isNullOrUndefined(r)&&r.length>0&&this.isSelectionInEditableRange(r[0]))return!1}return!0},e.prototype.getPreviousLockedRegion=function(){var e=this.documentHelper.editRanges;if(!e.containsKey(this.owner.currentUser)){for(var i,n=e.keys,r=0;r<n.length;r++){var o=e.get(n[r])[0],s=this.selection.getPosition(o).startPosition;s.isExistBefore(this.selection.start)&&(t.isNullOrUndefined(i)?i=o:s.isExistAfter(this.selection.getPosition(i).startPosition)&&(i=o))}return i}},e.prototype.unlockContent=function(e){if(this.documentHelper.editRanges.containsKey(e)){this.saveTimer&&clearTimeout(this.saveTimer);var t=JSON.stringify(this.serializeEditableRegion(e)),i={action:"UnlockContent",author:e,version:this.version,data:t,selectionInfo:{start:"",end:"",roomName:this.collaborativeEditingSettings.roomName,author:this.owner.currentUser,version:this.version},roomName:this.collaborativeEditingSettings.roomName};this.removeEditRange(e),this.owner.editorHistory.clearHistory(),this.owner.fireContentChange(),this.owner.trigger("actionComplete",i)}},e.prototype.removeEditRange=function(e){this.documentHelper.editRanges.containsKey(e)&&(this.updateLockRegion(e,!1),this.owner.editor.removeUserRestrictionsInternal(this.documentHelper.editRanges.get(e)[0]),this.documentHelper.clearContent(),this.selection.updateEditRangeCollection(),this.documentHelper.owner.viewer.updateScrollBars())},e.prototype.saveContent=function(){var e=this;this.saveTimer&&clearTimeout(this.saveTimer);var i=this.collaborativeEditingSettings.saveTimeout;t.isNullOrUndefined(i)&&(i=3e3),this.saveTimer=setTimeout(function(){e.saveContentInternal()},i)},e.prototype.saveContentInternal=function(){if(this.documentHelper.editRanges.containsKey(this.owner.currentUser)){var e=this.documentHelper.editRanges.get(this.owner.currentUser)[0],t=this.selection.getPosition(e),i={action:"SaveContent",author:this.owner.currentUser,version:this.version,data:JSON.stringify(this.serializeEditableRegion(this.owner.currentUser)),selectionInfo:{start:this.selection.getHierarchicalIndexByPosition(t.startPosition),end:this.selection.getHierarchicalIndexByPosition(t.endPosition),roomName:this.collaborativeEditingSettings.roomName,author:this.owner.currentUser,version:this.version},roomName:this.collaborativeEditingSettings.roomName};this.owner.trigger("actionComplete",i)}},e.prototype.serializeEditableRegion=function(e){var t=this.documentHelper.editRanges.get(e)[0],i=t.editRangeEnd,n=new Nt(this.owner);n.setPosition(t.line,!0);var r=new Nt(this.owner);r.setPosition(i.line,!1),this.owner.sfdtExportModule.isPartialExport=!0;var o=this.owner.sfdtExportModule.write(n.currentWidget,n.offset,r.currentWidget,r.offset,!1);return this.owner.sfdtExportModule.isPartialExport=!1,o},e.prototype.successHandler=function(e,i,r,o){if(JSON.parse(e.data).canLock){i.start=this.selection.getHierarchicalIndex(r.paragraph,r.offset.toString()),i.end=this.selection.getHierarchicalIndex(o.paragraph,o.offset.toString());var s=this.getPreviousLockedRegion();if(s){var a=this.selection.getPosition(s);i.previousLockInfo={start:this.selection.getHierarchicalIndexByPosition(a.startPosition),end:this.selection.getHierarchicalIndexByPosition(a.endPosition),author:s.user,roomName:"",version:0}}var l={action:"LockContent",selectionInfo:i,author:this.owner.currentUser,version:this.version,data:"",roomName:this.collaborativeEditingSettings.roomName};this.owner.trigger("actionComplete",l)}else{var d=new t.L10n("documenteditor",this.owner.defaultLocale);d.setLocale(this.owner.locale),n.DialogUtility.alert({content:d.getConstant("Already locked"),closeOnEscape:!0,showCloseIcon:!0,position:{X:"Center",Y:"Center"}})}},e.prototype.failureHandler=function(){var e=new t.L10n("documenteditor",this.owner.defaultLocale);e.setLocale(this.owner.locale),n.DialogUtility.alert({content:e.getConstant("Error in establishing connection with web server"),closeOnEscape:!0,showCloseIcon:!0,position:{X:"Center",Y:"Center"}})},e.prototype.lockRegion=function(e,t,i){var n=this.selection.getTextPosBasedOnLogicalIndex(e),r=this.selection.getTextPosBasedOnLogicalIndex(t);this.lockRegionInternal(n,r,i)},e.prototype.lockRegionInternal=function(e,t,i){var n=this.owner.editor.addEditElement(i),r=n.editRangeEnd;this.insertElements(e,t,[r],[n]),this.updateLockInfo(n.paragraph,r.paragraph,i,!0),this.owner.viewer.updateScrollBars()},e.prototype.insertElements=function(e,i,n,r){t.isNullOrUndefined(r)||this.insertElementsInternal(e,r),t.isNullOrUndefined(n)||this.insertElementsInternal(i,n)},e.prototype.insertElementsInternal=function(e,t){var i=0;if(e.paragraph.isEmpty()){var n=e.paragraph;n.childWidgets[0].children.push(t[0]),t[0].line=n.childWidgets[0],this.documentHelper.layout.reLayoutParagraph(n,0,0)}else{var r=e.currentWidget.getInline(e.offset,i),o=r.element;i=r.index;var s=t[0];this.insertElementInternal(o,s,i);for(var a=s.indexInOwner,l=s,d=1;d<t.length;d++)l=t[d],s.line.children.splice(a+d,0,l)}},e.prototype.insertElementInternal=function(e,i,n){var r=e.line,o=r.paragraph,s=e.indexInOwner,a=o.paragraphFormat.bidi&&e.isRightToLeft;n===e.length?(a||s++,r.children.splice(s,0,i)):0===n&&(t.isNullOrUndefined(e.previousNode)?(r.children.splice(0,0,i),s=0):r.children.splice(s,0,i)),i.line=e.line},e.prototype.setEditableRegion=function(){if(this.documentHelper.editRanges.containsKey(this.owner.currentUser)){var e=this.documentHelper.editRanges.get(this.owner.currentUser)[0],t=this.getParentBlock(e.paragraph);this.lockStart=this.owner.selection.getHierarchicalIndex(t,"0").split(";")}},e.prototype.isSelectionInEditableRange=function(e){var i;if(!t.isNullOrUndefined(this.owner.selection)){var n=this.owner.selection.start,r=this.owner.selection.end;this.owner.selection.isForward||(n=(i=[r,n])[0],r=i[1]);var o=this.owner.selection.getPosition(e);if((n.isExistAfter(o.startPosition)||n.isAtSamePosition(o.startPosition))&&(r.isExistBefore(o.endPosition)||r.isAtSamePosition(o.endPosition))||(o.startPosition.isExistAfter(n)||o.startPosition.isAtSamePosition(n))&&(o.endPosition.isExistBefore(r)||o.endPosition.isAtSamePosition(r))||o.startPosition.isExistAfter(n)&&o.startPosition.isExistBefore(r)&&(r.isExistAfter(o.endPosition)||r.isExistBefore(o.endPosition))||o.endPosition.isExistBefore(r)&&o.endPosition.isExistAfter(n)&&(n.isExistBefore(o.startPosition)||n.isExistAfter(o.startPosition)))return!0}return!1},e.prototype.updateRegion=function(e,i){if(this.documentHelper.editRanges.containsKey(e)){var n=this.documentHelper.editRanges.get(e);1===n.length&&(this.documentHelper.editRanges.remove(e),n[0].removeEditRangeMark()),this.setEditableRegion();var r=n[0],o=r.editRangeEnd,s=this.getParentBlock(r.paragraph),a=this.getParentBlock(o.paragraph),l=this.isSelectionInEditableRange(r),d=void 0,h=void 0;this.owner.editor.isRemoveRevision=!0,l||(d=this.owner.selection.getParagraphInfo(this.owner.selection.start),h=this.owner.selection.getParagraphInfo(this.owner.selection.end));for(var c=[];a!==s;){var p=a.combineWidget(this.owner.viewer);(a=p.previousRenderedWidget).bodyWidget.index!==p.bodyWidget.index&&c.push(p.bodyWidget);f=p.containerWidget.childWidgets[p.indexInOwner];this.removeDuplicateCollection(f),p.containerWidget.removeChild(p.indexInOwner)}if(!t.isNullOrUndefined(s)){var u=s.index,g=s.containerWidget;c.push(g);var m=s.containerWidget.childWidgets.indexOf(s),f=g.childWidgets[m];g.removeChild(m),this.removeDuplicateCollection(f);var v=[],y=[],w=[];if(this.owner.editor.isPasteListUpdated=!1,this.owner.editor.getBlocks(JSON.parse(i),!1,y,v,w),c.length!==y.length){if(1===c.length){F=c[0];c.unshift(this.owner.editor.splitBodyWidget(F,y[y.length-2].sectionFormat,F.childWidgets[m-1]))}if(c.length<y.length)for(var C=1;C<y.length-1;C++){var x=new gt(this.owner.documentHelper),F=new pe;x.bodyWidgets.push(F),F.page=x,c.splice(C,0,F),F.index=c[C-1].index,F.sectionFormat=new b(F),F.sectionFormat.copyFormat(y[C].sectionFormat);var P=c[C-1].page.index;if(this.documentHelper.insertPage(P,x),this.owner.editor.updateSectionIndex(c[C-1].sectionFormat,c[C-1],!0),c.length===y.length)break}}for(O=0;O<c.length;O++){var T=c[O],S=0,I=0;O===c.length-1&&(S=u,I=m);for(var N=y[O].childWidgets,E=0;E<N.length;E++)N[E].containerWidget=T,N[E].index=S,T.childWidgets.splice(I,0,N[E]),I++,S++;(a=N[N.length-1]).nextRenderedWidget&&a.nextRenderedWidget.index!==a.index&&this.updateNextBlocksIndex(a,!0),this.documentHelper.layout.layoutBodyWidgetCollection(N[0].index,T,void 0,!1)}for(var H=0;H<v.length;H++){var W=v[H];if(this.owner.editor.addCommentWidget(W,!1,this.owner.showComments,!1),W.replyComments.length>0)for(var O=0;O<W.replyComments.length;O++)this.owner.commentReviewPane.addReply(W.replyComments[O],!1,!1)}w.length>0&&this.updateRevisionCollection(w),this.owner.trackChangesPane.updateTrackChanges();var k=this.documentHelper.editRanges.get(e);if(l){if(k.length>0){var L=this.selection.getPosition(k[0]);this.selection.selectPosition(L.endPosition,L.endPosition)}}else this.tranformSelection(d,h);this.tranformHistoryPosition(),this.selection.updateEditRangeCollection(),this.updateLockRegion(e),this.documentHelper.removeEmptyPages(),this.owner.viewer.updateScrollBars(),this.owner.editor.isRemoveRevision=!1}}},e.prototype.updateRevisionCollection=function(e){var i=0,n=this.getRevisionTextPosition(e[0]),r=!1;if(this.owner.revisionsInternal.changes.length>0&&!t.isNullOrUndefined(n))for(var o=0;o<this.owner.revisionsInternal.changes.length;o++)if(this.getRevisionTextPosition(this.owner.revisionsInternal.changes[o]).isExistAfter(n)){i=o,r=!0;break}for(var s=0;s<e.length;s++)r?(this.owner.revisionsInternal.changes.splice(i,0,e[s]),i++):this.owner.revisionsInternal.changes.push(e[s])},e.prototype.getRevisionTextPosition=function(e){if(e.range.length>0){var t=e.range[0];if(t instanceof Ce)return this.selection.getElementPosition(t).startPosition;if(t instanceof I){var i=t.ownerBase.firstChild.firstChild;if(i.bodyWidget)return this.selection.getTextPosBasedOnLogicalIndex(this.selection.getHierarchicalIndex(i,"0"))}else if(t instanceof H){var n=t.ownerBase;if(n.lastChild.paragraph.bodyWidget){var r=n.getLength(),o=new Nt(this.owner);return o.setPositionParagraph(n.lastChild,r),o}}}},e.prototype.tranformSelection=function(e,t){this.documentHelper.skipScrollToPosition=!0;var i=this.selection.getHierarchicalIndex(e.paragraph,e.offset.toString()),n=this.selection.getHierarchicalIndex(t.paragraph,t.offset.toString());this.selection.select(i,n)},e.prototype.tranformHistoryPosition=function(){if(this.documentHelper.editRanges.containsKey(this.owner.currentUser)){var e=this.documentHelper.editRanges.get(this.owner.currentUser)[0],i=this.getParentBlock(e.paragraph),n=this.selection.getHierarchicalIndex(i,"0").split(";");if(!t.isNullOrUndefined(this.lockStart)&&this.lockStart.length>1){var r=parseInt(n[0],10)-parseInt(this.lockStart[0],10),o=parseInt(n[1],10)-parseInt(this.lockStart[1],10);this.transformHistory(r,o)}}},e.prototype.transformHistory=function(e,i){if(this.owner.enableEditorHistory){var n=this.owner.editorHistory.undoStack;if(!t.isNullOrUndefined(n))for(o=0;o<n.length;o++)this.transformBaseHistoryInfo(n[o],e,i);var r=this.owner.editorHistory.redoStack;if(!t.isNullOrUndefined(r))for(var o=0;o<r.length;o++)this.transformBaseHistoryInfo(r[o],e,i)}},e.prototype.transformBaseHistoryInfo=function(e,t,i){if(e.endPosition&&(e.endPosition=this.tranformPosition(e.endPosition,t,i)),e.insertPosition&&(e.insertPosition=this.tranformPosition(e.insertPosition,t,i)),e.selectionStart&&(e.selectionStart=this.tranformPosition(e.selectionStart,t,i)),e.selectionEnd&&(e.selectionEnd=this.tranformPosition(e.selectionEnd,t,i)),e instanceof ti)for(var n=e.modifiedActions,r=0;r<n.length;r++)this.transformBaseHistoryInfo(n[r],t,i)},e.prototype.tranformPosition=function(e,t,i){var n=e.split(";");return n[0]=(parseInt(n[0],10)+t).toString(),n[1]=(parseInt(n[1],10)+i).toString(),n.join(";")},e.prototype.getParentBlock=function(e){return e.isInsideTable&&(e=this.owner.documentHelper.layout.getParentTable(e)),e.combineWidget(this.owner.viewer)},e.prototype.removeDuplicateCollection=function(e){if(this.removeFieldInBlock(e,!1,!1),this.removeFieldInBlock(e,!0,!1),this.removeFieldInBlock(e,!1,!0),e instanceof ve){for(var t=0;t<e.childWidgets.length;t++)if(e.childWidgets[t]instanceof ye){var i=e.childWidgets[t];this.owner.editor.removeDeletedCellRevision(i)}}else this.owner.editor.removeRevisionForBlock(e,void 0,!1,!1)},e.prototype.removeFieldInBlock=function(e,t,i){e instanceof ve?this.removeFieldTable(e,t,i):(this.owner.editor.removeField(e,t,i),this.removeComment(e))},e.prototype.removeFieldTable=function(e,t,i){for(var n=0;n<e.childWidgets.length;n++)for(var r=e.childWidgets[n],o=0;o<r.childWidgets.length;o++)for(var s=r.childWidgets[o],a=0;a<s.childWidgets.length;a++)this.removeFieldInBlock(s.childWidgets[a],t,i)},e.prototype.removeComment=function(e){if(this.documentHelper.comments.length>0)for(var t=0;t<this.documentHelper.comments.length;t++){var i=this.documentHelper.comments[t];i.commentStart.line.paragraph===e&&(this.documentHelper.comments.splice(t,1),this.owner.commentReviewPane.deleteComment(i),t--)}},e.prototype.updateNextBlocksIndex=function(e,t){var i=e.getSplitWidgets().pop().nextRenderedWidget,n=1;i.bodyWidget.index===e.bodyWidget.index&&(n=e.index-i.index+1);var r=e.containerWidget.childWidgets.indexOf(e)+1;if(e.containerWidget instanceof pe)for(var o=e.containerWidget.index,s=this.documentHelper.pages.indexOf(e.containerWidget.page);s<this.documentHelper.pages.length;s++){var a=this.documentHelper.pages[s];if(a.bodyWidgets[0].index!==o)return;for(var l=r;l<a.bodyWidgets[0].childWidgets.length;l++)a.bodyWidgets[0].childWidgets[l].index+=n;r=0}},e.prototype.updateLockRegion=function(e,i){if(t.isNullOrUndefined(e)&&(e=this.owner.currentUser),i=!!t.isNullOrUndefined(i)||i,this.documentHelper.editRanges.containsKey(e)){var n=this.documentHelper.editRanges.get(e);if(1===n.length&&!t.isNullOrUndefined(n[0].editRangeEnd)){var r=n[0];this.updateLockInfo(r.paragraph,r.editRangeEnd.paragraph,e,i)}}},e.prototype.updateLockInfo=function(e,i,n,r){e.isInsideTable&&(e=this.documentHelper.layout.getParentTable(e)),i.isInsideTable&&(i=this.documentHelper.layout.getParentTable(i));do{if(r?(e.lockedBy=n,e.locked=r):(e.lockedBy=void 0,e.locked=r),e===i)break;if(e=e.nextRenderedWidget,t.isNullOrUndefined(e))break}while(e)},e.prototype.pullAction=function(){var e=this;if(this.owner){var t=new v;t.url=this.owner.serviceUrl+this.owner.serverActionSettings.getPendingActions,t.contentType="application/json;charset=UTF-8",t.onSuccess=function(t){e.updateAction(JSON.parse(t.data)),n.hideSpinner(e.owner.element)},t.onFailure=this.failureHandler.bind(this),t.onError=this.failureHandler.bind(this),t.customHeaders=this.owner.headers,n.showSpinner(this.owner.element),t.send({roomName:this.collaborativeEditingSettings.roomName,version:this.version})}},e.prototype.destroy=function(){this.owner=void 0},e}(),ri=function(){function e(){this.customXMLItemsPath="customXml/item",this.customXMLItemsPropspath="customXml/itemProps",this.itemPropsPath="itemProps",this.documentPath="word/document.xml",this.stylePath="word/styles.xml",this.chartPath="word/charts",this.numberingPath="word/numbering.xml",this.settingsPath="word/settings.xml",this.headerPath="word/header",this.footerPath="word/footer",this.imagePath="word/media/image",this.footnotesPath="word/footnotes.xml",this.endnotesPath="word/endnotes.xml",this.appPath="docProps/app.xml",this.corePath="docProps/core.xml",this.contentTypesPath="[Content_Types].xml",this.defaultEmbeddingPath="word/embeddings/",this.commentsPath="word/comments.xml",this.commentsExtendedPath="word/commentsExtended.xml",this.generalRelationPath="_rels/.rels",this.wordRelationPath="word/_rels/document.xml.rels",this.customXMLRelPath="customXml/_rels/item",this.excelRelationPath="xl/_rels/workbook.xml.rels",this.footnotesRelationPath="word/_rels/footnotes.xml.rels",this.endnotesRelationPath="word/_rels/endnotes.xml.rels",this.headerRelationPath="word/_rels/header",this.footerRelationPath="word/_rels/footer",this.xmlContentType="application/xml",this.fontContentType="application/vnd.openxmlformats-officedocument.obfuscatedFont",this.documentContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",this.settingsContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml",this.commentsContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml",this.commentsExContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.commentsExtended+xml",this.endnoteContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml",this.footerContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml",this.footnoteContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml",this.headerContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.header+xml",this.numberingContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml",this.stylesContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml",this.webSettingsContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.webSettings+xml",this.appContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml",this.coreContentType="application/vnd.openxmlformats-package.core-properties+xml",this.customContentType="application/vnd.openxmlformats-officedocument.custom-properties+xml",this.customXmlContentType="application/vnd.openxmlformats-officedocument.customXmlProperties+xml",this.relationContentType="application/vnd.openxmlformats-package.relationships+xml",this.chartsContentType="application/vnd.openxmlformats-officedocument.drawingml.chart+xml",this.tableStyleContentType="application/vnd.openxmlformats-officedocument.presentationml.tableStyles+xml",this.chartColorStyleContentType="application/vnd.ms-office.chartcolorstyle+xml",this.commentsRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",this.commentsExRelType="http://schemas.microsoft.com/office/2011/relationships/commentsExtended",this.settingsRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings",this.endnoteRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes",this.footerRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer",this.footnoteRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes",this.headerRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/header",this.documentRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",this.numberingRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering",this.stylesRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",this.chartRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",this.fontRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/font",this.tableStyleRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/tableStyles",this.coreRelType="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",this.appRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties",this.customRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",this.imageRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",this.hyperlinkRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink",this.controlRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/control",this.packageRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/package",this.customXmlRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml",this.customUIRelType="http://schemas.microsoft.com/office/2006/relationships/ui/extensibility",this.attachedTemplateRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/attachedTemplate",this.chartColorStyleRelType="http://schemas.microsoft.com/office/2011/relationships/chartColorStyle",this.wNamespace="http://schemas.openxmlformats.org/wordprocessingml/2006/main",this.wpNamespace="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing",this.pictureNamespace="http://schemas.openxmlformats.org/drawingml/2006/picture",this.aNamespace="http://schemas.openxmlformats.org/drawingml/2006/main",this.a14Namespace="http://schemas.microsoft.com/office/drawing/2010/main",this.rNamespace="http://schemas.openxmlformats.org/officeDocument/2006/relationships",this.rpNamespace="http://schemas.openxmlformats.org/package/2006/relationships",this.vNamespace="urn:schemas-microsoft-com:vml",this.oNamespace="urn:schemas-microsoft-com:office:office",this.xmlNamespace="http://www.w3.org/XML/1998/namespace",this.w10Namespace="urn:schemas-microsoft-com:office:word",this.cpNamespace="http://schemas.openxmlformats.org/package/2006/metadata/core-properties",this.dcNamespace="http://purl.org/dc/elements/1.1/",this.docPropsNamespace="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties",this.veNamespace="http://schemas.openxmlformats.org/markup-compatibility/2006",this.mNamespace="http://schemas.openxmlformats.org/officeDocument/2006/math",this.wneNamespace="http://schemas.microsoft.com/office/word/2006/wordml",this.customPropsNamespace="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties",this.vtNamespace="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes",this.chartNamespace="http://schemas.openxmlformats.org/drawingml/2006/chart",this.slNamespace="http://schemas.openxmlformats.org/schemaLibrary/2006/main",this.dtNamespace="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882",this.wmlNamespace="http://schemas.microsoft.com/office/word/2003/wordml",this.w14Namespace="http://schemas.microsoft.com/office/word/2010/wordml",this.wpCanvasNamespace="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas",this.wpDrawingNamespace="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing",this.wpGroupNamespace="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup",this.wpInkNamespace="http://schemas.microsoft.com/office/word/2010/wordprocessingInk",this.wpShapeNamespace="http://schemas.microsoft.com/office/word/2010/wordprocessingShape",this.w15Namespace="http://schemas.microsoft.com/office/word/2012/wordml",this.diagramNamespace="http://schemas.openxmlformats.org/drawingml/2006/diagram",this.eNamespace="http://schemas.microsoft.com/office/2006/encryption",this.pNamespace="http://schemas.microsoft.com/office/2006/keyEncryptor/password",this.certNamespace="http://schemas.microsoft.com/office/2006/keyEncryptor/certificate",this.cxNamespace="http://schemas.microsoft.com/office/drawing/2014/chartex",this.c15Namespace="http://schemas.microsoft.com/office/drawing/2015/06/chart",this.c7Namespace="http://schemas.microsoft.com/office/drawing/2007/8/2/chart",this.csNamespace="http://schemas.microsoft.com/office/drawing/2012/chartStyle",this.spreadSheetNamespace="http://schemas.openxmlformats.org/spreadsheetml/2006/main",this.spreadSheet9="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main",this.cRelationshipsTag="Relationships",this.cRelationshipTag="Relationship",this.cIdTag="Id",this.cTypeTag="Type",this.cTargetTag="Target",this.cUserShapesTag="userShapes",this.cExternalData="externalData",this.twipsInOnePoint=20,this.twentiethOfPoint=20,this.borderMultiplier=8,this.percentageFactor=50,this.emusPerPoint=12700,this.cConditionalTableStyleTag="tblStylePr",this.cTableFormatTag="tblPr",this.cTowFormatTag="trPr",this.cCellFormatTag="tcPr",this.cParagraphFormatTag="pPr",this.cCharacterFormatTag="rPr",this.packageType="http://schemas.microsoft.com/office/2006/xmlPackage",this.relsPartPath="/_rels/.rels",this.documentRelsPartPath="/word/_rels/document.xml.rels",this.webSettingsPath="/word/webSettings.xml",this.wordMLDocumentPath="/word/document.xml",this.wordMLStylePath="/word/styles.xml",this.wordMLNumberingPath="/word/numbering.xml",this.wordMLSettingsPath="/word/settings.xml",this.wordMLHeaderPath="/word/header",this.wordMLFooterPath="/word/footer",this.wordMLCommentsPath="/word/comments.xml",this.wordMLImagePath="/word/media/image",this.wordMLFootnotesPath="/word/footnotes.xml",this.wordMLEndnotesPath="/word/endnotes.xml",this.wordMLAppPath="/docProps/app.xml",this.wordMLCorePath="/docProps/core.xml",this.wordMLCustomPath="/docProps/custom.xml",this.wordMLFontTablePath="/word/fontTable.xml",this.wordMLChartsPath="/word/charts/",this.wordMLDefaultEmbeddingPath="/word/embeddings/",this.wordMLEmbeddingPath="/word/embeddings/",this.wordMLDrawingPath="/word/drawings/",this.wordMLThemePath="/word/theme/theme1.xml",this.wordMLFontsPath="/word/fonts/",this.wordMLDiagramPath="/word/diagrams/",this.wordMLControlPath="/word/activeX/",this.wordMLVbaProject="/vbaProject.bin",this.wordMLVbaData="/vbaData.xml",this.wordMLVbaProjectPath="/word/vbaProject.bin",this.wordMLVbaDataPath="/word/vbaData.xml",this.wordMLWebSettingsPath="/word/webSettings.xml",this.wordMLCustomItemProp1Path="/customXml/itemProps1.xml",this.wordMLFootnoteRelPath="/word/_rels/footnotes.xml.rels",this.wordMLEndnoteRelPath="/word/_rels/endnotes.xml.rels",this.wordMLSettingsRelPath="/word/_rels/settings.xml.rels",this.wordMLNumberingRelPath="/word/_rels/numbering.xml.rels",this.wordMLFontTableRelPath="/word/_rels/fontTable.xml.rels",this.wordMLCustomXmlPropsRelType="http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps",this.wordMLControlRelType="http://schemas.microsoft.com/office/2006/relationships/activeXControlBinary",this.wordMLDiagramContentType="application/vnd.ms-office.drawingml.diagramDrawing+xml",this.dsNamespace="http://schemas.openxmlformats.org/officeDocument/2006/customXml",this.excelFiles=void 0,this.lastSection=!1,this.mRelationShipID=0,this.cRelationShipId=0,this.eRelationShipId=0,this.efRelationShipId=0,this.mDocPrID=1,this.chartCount=0,this.seriesCount=0,this.chartStringCount=0,this.mDifferentFirstPage=!1,this.mBookmarks=void 0,this.mComments=[],this.revisions=[],this.customXMLProps=[],this.paraID=0,this.commentParaID=0,this.commentParaIDInfo={},this.isInsideComment=!1,this.commentId={},this.currentCommentId=0,this.trackChangesId=0,this.prevRevisionIds=[],this.isRevisionContinuous=!1}return e.prototype.getModuleName=function(){return"WordExport"},Object.defineProperty(e.prototype,"bookmarks",{get:function(){return t.isNullOrUndefined(this.mBookmarks)&&(this.mBookmarks=[]),this.mBookmarks},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"documentImages",{get:function(){return void 0===this.mDocumentImages&&(this.mDocumentImages=new g),this.mDocumentImages},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"externalImages",{get:function(){return void 0===this.mExternalLinkImages&&(this.mExternalLinkImages=new g),this.mExternalLinkImages},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"headerFooterImages",{get:function(){return void 0===this.mHeaderFooterImages&&(this.mHeaderFooterImages=new g),this.mHeaderFooterImages},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"documentCharts",{get:function(){return void 0===this.mDocumentCharts&&(this.mDocumentCharts=new g),this.mDocumentCharts},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"headersFooters",{get:function(){return void 0===this.mHeaderFooterColl&&(this.mHeaderFooterColl=new g),this.mHeaderFooterColl},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"endnotesFootnotes",{get:function(){return void 0===this.mFootEndnotesColl&&(this.mFootEndnotesColl=new g),this.mFootEndnotesColl},enumerable:!0,configurable:!0}),e.prototype.save=function(e,t){var i=this;this.fileName=t,this.serialize(e);var n=this.serializeExcelFiles();n&&n.length>0?Promise.all(n).then(function(){i.saveInternal(t)}):this.saveInternal(t),this.close()},e.prototype.saveInternal=function(e){this.mArchive.save(e+".docx").then(function(e){e.destroy()})},e.prototype.saveAsBlob=function(e){var t=this;this.serialize(e);var i=this.serializeExcelFiles();return new Promise(function(e,n){i.length>0?Promise.all(i).then(function(){t.mArchive.saveAsBlob().then(function(i){t.mArchive.destroy(),i=new Blob([i],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}),e(i)})}):t.mArchive.saveAsBlob().then(function(i){t.mArchive.destroy(),i=new Blob([i],{type:"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}),e(i)})})},e.prototype.serializeExcelFiles=function(){var e=this,t=this.excelFiles,i=[];if(t&&t.length>0){for(var n=0;n<t.length;n++)!function(n){var r=t.keys[n],o=t.get(r).saveAsBlob();i.push(o),o.then(function(t){var i=new c.ZipArchiveItem(t,r);e.mArchive.addItem(i)})}(n);this.excelFiles.clear()}return i},e.prototype.saveExcel=function(){var e=this.defaultEmbeddingPath+"Microsoft_Excel_Worksheet"+this.chartCount+".xlsx";this.excelFiles.add(e,this.mArchiveExcel),this.mArchiveExcel=void 0},e.prototype.destroy=function(){this.clearDocument(),this.mRelationShipID=void 0,this.mDocPrID=void 0,this.mDifferentFirstPage=void 0,this.fileName=void 0,this.mArchive&&(this.mArchive.destroy(),this.mArchive=void 0),this.mArchiveExcel&&(this.mArchiveExcel.destroy(),this.mArchiveExcel=void 0)},e.prototype.serialize=function(e){var t=e.owner.sfdtExportModule.write();this.setDocument(t),this.mComments=e.comments,this.mCustomXML=e.customXmlData,this.revisions=e.owner.revisions.changes,this.mArchive=new c.ZipArchive,this.mArchive.compressionLevel="Normal",this.commentParaIDInfo={},this.commentParaID=0,this.currentCommentId=0,this.commentId={},this.mVerticalMerge=new g,this.mGridSpans=new g;this.serializeDocument(),this.serializeStyles(),this.serializeNumberings(),this.serializeComments(),this.serializeCommentsExtended(),this.serializeSettings(),this.serializeCoreProperties(),this.serializeAppProperties(),this.serializeFontTable(void 0),this.serializeSettingsRelation(),this.serializeHeaderFooters(),this.serializeFootnotes(),this.serializeEndnotes(),this.serializeDocumentRelations(),this.serializeGeneralRelations(),this.serializeContentTypes(void 0),this.clearDocument()},e.prototype.setDocument=function(e){this.document=e,this.mSections=e.sections,this.mLists=e.lists,this.mAbstractLists=e.abstractLists,this.defCharacterFormat=e.characterFormat,this.defParagraphFormat=e.paragraphFormat,this.defaultTabWidthValue=e.defaultTabWidth,this.dontUseHtmlParagraphAutoSpacing=e.dontUseHTMLParagraphAutoSpacing,this.mStyles=e.styles,this.formatting=e.formatting,this.enforcement=e.enforcement,this.hashValue=e.hashValue,this.saltValue=e.saltValue,this.protectionType=e.protectionType,this.formFieldShading=e.formFieldShading,this.trackChanges=e.trackChanges},e.prototype.clearDocument=function(){this.section=void 0,this.lastSection=void 0,this.blockOwner=void 0,this.paragraph=void 0,this.table=void 0,this.row=void 0,this.headerFooter=void 0,this.commentParaIDInfo={},this.commentParaID=0,this.currentCommentId=0,this.commentId={},this.document=void 0,this.mSections=void 0,this.mLists=void 0,this.mAbstractLists=void 0,this.defCharacterFormat=void 0,this.defParagraphFormat=void 0,this.defaultTabWidthValue=void 0,this.trackChanges=void 0,this.customXMLProps=[],this.mRelationShipID=0,this.eRelationShipId=0,this.cRelationShipId=0,this.efRelationShipId=0,this.mDocPrID=1,this.chartCount=0,this.mDifferentFirstPage=!1,this.mHeaderFooterColl&&(this.mHeaderFooterColl.destroy(),this.mHeaderFooterColl=void 0),this.mVerticalMerge&&(this.mVerticalMerge.destroy(),this.mVerticalMerge=void 0),this.mGridSpans&&(this.mGridSpans.destroy(),this.mGridSpans=void 0),this.mDocumentImages&&(this.mDocumentImages.destroy(),this.mDocumentImages=void 0),this.mExternalLinkImages&&(this.mExternalLinkImages.destroy(),this.mExternalLinkImages=void 0),this.mHeaderFooterImages&&(this.mHeaderFooterImages.destroy(),this.mHeaderFooterImages=void 0),this.mDocumentCharts&&(this.mDocumentCharts.destroy(),this.mDocumentCharts=void 0),this.mFootEndnotesColl&&(this.mFootEndnotesColl.destroy(),this.mFootEndnotesColl=void 0)},e.prototype.serializeDocument=function(){var e=new p.XmlWriter;e.writeStartElement("w","document",this.wNamespace),this.writeCommonAttributeStrings(e),this.serializeDocumentBody(e),e.writeEndElement();var t=new c.ZipArchiveItem(e.buffer,this.documentPath);this.mArchive.addItem(t)},e.prototype.writeCommonAttributeStrings=function(e){e.writeAttributeString("xmlns","wpc",void 0,this.wpCanvasNamespace),this.writeCustom(e),e.writeAttributeString("xmlns","wp14",void 0,this.wpDrawingNamespace),e.writeAttributeString("xmlns","wp",void 0,this.wpNamespace),e.writeAttributeString("xmlns","w10",void 0,this.w10Namespace),e.writeAttributeString("xmlns","w",void 0,this.wNamespace),this.writeDup(e),e.writeAttributeString("xmlns","wne",void 0,this.wneNamespace),e.writeAttributeString("xmlns","wps",void 0,this.wpShapeNamespace),e.writeAttributeString("mc","Ignorable",void 0,"w14 w15 wp14")},e.prototype.writeDup=function(e){e.writeAttributeString("xmlns","w14",void 0,this.w14Namespace),e.writeAttributeString("xmlns","w15",void 0,this.w15Namespace),e.writeAttributeString("xmlns","wpg",void 0,this.wpGroupNamespace),e.writeAttributeString("xmlns","wpi",void 0,this.wpInkNamespace)},e.prototype.writeCustom=function(e){e.writeAttributeString("xmlns","mc",void 0,this.veNamespace),e.writeAttributeString("xmlns","o",void 0,this.oNamespace),e.writeAttributeString("xmlns","r",void 0,this.rNamespace),e.writeAttributeString("xmlns","m",void 0,this.mNamespace),e.writeAttributeString("xmlns","v",void 0,this.vNamespace)},e.prototype.serializeDocumentBody=function(e){e.writeStartElement(void 0,"body",this.wNamespace);for(var t=this.document.sections.length,i=0;i<t;i++)this.section=this.document.sections[i],this.lastSection=i===t-1,this.serializeSection(e,this.section,i===t-1),this.section=void 0;e.writeEndElement()},e.prototype.serializeSection=function(e,t,i){this.blockOwner=t,this.serializeBodyItems(e,t.blocks,i),i&&this.serializeSectionProperties(e,t),this.blockOwner=void 0},e.prototype.serializeComments=function(){if(0!==this.mComments.length&&(1!==this.mComments.length||""!==this.mComments[0].text)){var e=new p.XmlWriter;e.writeStartElement("w","comments",this.wNamespace),this.serializeCommentCommonAttribute(e),this.serializeCommentInternal(e,this.mComments),e.writeEndElement();var t=new c.ZipArchiveItem(e.buffer,this.commentsPath);this.mArchive.addItem(t)}},e.prototype.serializeCommentCommonAttribute=function(e){e.writeAttributeString("xmlns","wpc",void 0,this.wpCanvasNamespace),e.writeAttributeString("xmlns","cx",void 0,this.cxNamespace),e.writeAttributeString("xmlns","mc",void 0,this.veNamespace),e.writeAttributeString("xmlns","o",void 0,this.oNamespace),e.writeAttributeString("xmlns","r",void 0,this.rNamespace),e.writeAttributeString("xmlns","m",void 0,this.mNamespace),e.writeAttributeString("xmlns","v",void 0,this.vNamespace),e.writeAttributeString("xmlns","wp14",void 0,this.wpDrawingNamespace),e.writeAttributeString("xmlns","wp",void 0,this.wpNamespace),e.writeAttributeString("xmlns","w10",void 0,this.w10Namespace),e.writeAttributeString("xmlns","w",void 0,this.wNamespace),e.writeAttributeString("xmlns","w14",void 0,this.w14Namespace),e.writeAttributeString("xmlns","w15",void 0,this.w15Namespace),e.writeAttributeString("mc","Ignorable",void 0,"w14 w15")},e.prototype.serializeCommentInternal=function(e,t){for(var i=0;i<t.length;i++){var n=t[i];e.writeStartElement("w","comment",this.wNamespace),e.writeAttributeString("w","id",this.wNamespace,this.commentId[n.commentId].toString()),n.author&&" "!==n.author&&e.writeAttributeString("w","author",this.wNamespace,n.author),n.date&&e.writeAttributeString("w","date",this.wNamespace,n.date),n.initial&&""!==n.initial&&e.writeAttributeString("w","initials",this.wNamespace,n.initial);for(var r=this.retrieveCommentText(n.text),o=0;o<r.length;o++)this.isInsideComment=!0,this.commentParaID++,this.serializeBodyItem(e,r[o],!0),this.isInsideComment=!1;0===r.length&&(this.isInsideComment=!0,this.commentParaID++),this.commentParaIDInfo[n.commentId]=this.commentParaID,this.isInsideComment=!1,e.writeEndElement(),n.replyComments.length>0&&this.serializeCommentInternal(e,n.replyComments)}},e.prototype.retrieveCommentText=function(e){var t=[],i=e.split("\n"),n={};if(0===(i=i.filter(function(e){return""!==e})).length)n.inlines=[{text:""}],t.push(n);else for(;i.length>0;)n.inlines=[{text:i[0]}],t.push(n),i.splice(0,1);return t},e.prototype.serializeCommentsExtended=function(){if(0!==this.mComments.length&&(1!==this.mComments.length||""!==this.mComments[0].text)){var e=new p.XmlWriter;e.writeStartElement("w15","commentsEx",this.wNamespace),this.serializeCommentCommonAttribute(e),this.serializeCommentsExInternal(e,this.mComments,!1),e.writeEndElement();var t=new c.ZipArchiveItem(e.buffer,this.commentsExtendedPath);this.mArchive.addItem(t)}},e.prototype.serializeCommentsExInternal=function(e,t,i){for(var n=0;n<t.length;n++){var r=t[n];e.writeStartElement("w15","commentEx",this.wNamespace);var o=this.commentParaIDInfo[r.commentId];if(i){var s=this.commentParaIDInfo[r.ownerComment.commentId];e.writeAttributeString("w15","paraIdParent",this.wNamespace,s.toString())}e.writeAttributeString("w15","paraId",this.wNamespace,o.toString());var a=r.done?1:0;e.writeAttributeString("w15","done",this.wNamespace,a.toString()),e.writeEndElement(),r.replyComments.length>0&&this.serializeCommentsExInternal(e,r.replyComments,!0)}},e.prototype.serializeSectionProperties=function(e,i){e.writeStartElement("w","sectPr",this.wNamespace),i.headersFooters&&this.serializeHFReference(e,i.headersFooters),this.serializeSectionType(e,"nextPage"),this.serializePageSetup(e,i.sectionFormat),this.serializeColumns(e),this.serializeFootNotesPr(e,i.sectionFormat),this.serializeEndNotesPr(e,i.sectionFormat),void 0!==i.sectionFormat&&i.sectionFormat.differentFirstPage&&(e.writeStartElement(void 0,"titlePg",this.wNamespace),e.writeEndElement()),!t.isNullOrUndefined(i.sectionFormat)&&i.sectionFormat.bidi&&(e.writeStartElement(void 0,"bidi",this.wNamespace),e.writeEndElement()),e.writeEndElement()},e.prototype.serializeFootNotesPr=function(e,t){(t.footNoteNumberFormat||t.restartIndexForFootnotes)&&(e.writeStartElement(void 0,"footnotePr",this.wNamespace),e.writeStartElement(void 0,"pos",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,"pageBottom"),e.writeEndElement(),void 0!==t.footNoteNumberFormat&&(e.writeStartElement(void 0,"numFmt",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,this.getFootNoteNumberFormat(t.footNoteNumberFormat)),e.writeEndElement()),void 0!==t.restartIndexForFootnotes&&(e.writeStartElement(void 0,"numRestart",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,this.getFootNoteNumberRestart(t.restartIndexForFootnotes)),e.writeEndElement()),void 0!==t.initialFootNoteNumber&&(e.writeStartElement(void 0,"numStart",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,t.initialFootNoteNumber.toString()),e.writeEndElement()),e.writeEndElement())},e.prototype.getFootNoteNumberFormat=function(e){var t;switch(e){case"UpperCaseRoman":t="upperRoman";break;case"LowerCaseRoman":t="lowerRoman";break;case"UpperCaseLetter":t="upperLetter";break;case"LowerCaseLetter":t="lowerLetter";break;default:t="decimal"}return t},e.prototype.getFootNoteNumberRestart=function(e){switch(e){case"RestartForEachSection ":return"eachSect";case"RestartForEachPage":return"eachPage";default:return"continuous"}},e.prototype.serializeEndNotesPr=function(e,t){(t.endnoteNumberFormat||t.restartIndexForEndnotes)&&(e.writeStartElement(void 0,"endnotePr",this.wNamespace),e.writeStartElement(void 0,"pos",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,"docEnd"),e.writeEndElement(),void 0!==t.endnoteNumberFormat&&(e.writeStartElement(void 0,"numFmt",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,this.getFootNoteNumberFormat(t.endnoteNumberFormat)),e.writeEndElement()),void 0!==t.restartIndexForEndnotes&&(e.writeStartElement(void 0,"numRestart",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,this.getFootNoteNumberRestart(t.restartIndexForEndnotes)),e.writeEndElement()),void 0!==t.initialEndNoteNumber&&(e.writeStartElement(void 0,"numStart",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,t.initialEndNoteNumber.toString()),e.writeEndElement()),e.writeEndElement())},e.prototype.serializeColumns=function(e){e.writeStartElement(void 0,"cols",this.wNamespace),e.writeAttributeString(void 0,"equalWidth",this.wNamespace,"1"),e.writeAttributeString(void 0,"space",this.wNamespace,"0"),e.writeEndElement()},e.prototype.serializePageSetup=function(e,t){void 0!==t&&(this.serializePageSize(e,t),this.serializePageMargins(e,t)),t.restartPageNumbering&&(e.writeStartElement(void 0,"pgNumType",this.wNamespace),e.writeAttributeString(void 0,"start",this.wNamespace,t.pageStartingNumber.toString()),e.writeEndElement()),e.writeStartElement(void 0,"pgBorders",this.wNamespace),e.writeEndElement()},e.prototype.serializePageSize=function(e,t){e.writeStartElement(void 0,"pgSz",this.wNamespace),e.writeAttributeString(void 0,"w",this.wNamespace,this.roundToTwoDecimal(t.pageWidth*this.twentiethOfPoint).toString()),e.writeAttributeString(void 0,"h",this.wNamespace,this.roundToTwoDecimal(t.pageHeight*this.twentiethOfPoint).toString()),e.writeEndElement()},e.prototype.serializePageMargins=function(e,t){e.writeStartElement(void 0,"pgMar",this.wNamespace);var i=Math.round(t.topMargin*this.twentiethOfPoint);e.writeAttributeString(void 0,"top",this.wNamespace,i.toString()),i=Math.round(t.rightMargin*this.twentiethOfPoint),e.writeAttributeString(void 0,"right",this.wNamespace,i.toString()),i=Math.round(t.bottomMargin*this.twentiethOfPoint),e.writeAttributeString(void 0,"bottom",this.wNamespace,i.toString()),i=Math.round(t.leftMargin*this.twentiethOfPoint),e.writeAttributeString(void 0,"left",this.wNamespace,i.toString()),e.writeAttributeString(void 0,"header",this.wNamespace,this.roundToTwoDecimal(t.headerDistance*this.twentiethOfPoint).toString()),e.writeAttributeString(void 0,"footer",this.wNamespace,this.roundToTwoDecimal(t.footerDistance*this.twentiethOfPoint).toString()),e.writeAttributeString(void 0,"gutter",this.wNamespace,"0"),e.writeEndElement()},e.prototype.serializeSectionType=function(e,t){e.writeStartElement("w","type",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,t),e.writeEndElement()},e.prototype.serializeHFReference=function(e,t){var i="";if(void 0!==t){this.mDifferentFirstPage=this.section.sectionFormat.differentOddAndEvenPages;var n=t.firstPageHeader;n&&n.blocks&&n.blocks.length>0&&(e.writeStartElement(void 0,"headerReference",this.wNamespace),e.writeAttributeString(void 0,"type",this.wNamespace,"first"),i=this.getNextRelationShipID(),e.writeAttributeString(void 0,"id",this.rNamespace,i),this.addHeaderFooter(n,"FirstPageHeader",i),e.writeEndElement()),(n=t.firstPageFooter)&&n.blocks&&n.blocks.length>0&&(e.writeStartElement(void 0,"footerReference",this.wNamespace),e.writeAttributeString(void 0,"type",this.wNamespace,"first"),i=this.getNextRelationShipID(),e.writeAttributeString(void 0,"id",this.rNamespace,i),this.addHeaderFooter(n,"FirstPageFooter",i),e.writeEndElement()),(n=t.evenHeader)&&n.blocks&&n.blocks.length>0&&(e.writeStartElement(void 0,"headerReference",this.wNamespace),e.writeAttributeString(void 0,"type",this.wNamespace,"even"),i=this.getNextRelationShipID(),e.writeAttributeString(void 0,"id",this.rNamespace,i),this.addHeaderFooter(n,"EvenHeader",i),e.writeEndElement()),(n=t.evenFooter)&&n.blocks&&n.blocks.length>0&&(e.writeStartElement(void 0,"footerReference",this.wNamespace),e.writeAttributeString(void 0,"type",this.wNamespace,"even"),i=this.getNextRelationShipID(),e.writeAttributeString(void 0,"id",this.rNamespace,i),this.addHeaderFooter(n,"EvenFooter",i),e.writeEndElement()),(n=t.header)&&n.blocks&&n.blocks.length>0&&(e.writeStartElement(void 0,"headerReference",this.wNamespace),e.writeAttributeString(void 0,"type",this.wNamespace,"default"),i=this.getNextRelationShipID(),e.writeAttributeString(void 0,"id",this.rNamespace,i),this.addHeaderFooter(n,"OddHeader",i),e.writeEndElement()),(n=t.footer)&&n.blocks&&n.blocks.length>0&&(e.writeStartElement(void 0,"footerReference",this.wNamespace),e.writeAttributeString(void 0,"type",this.wNamespace,"default"),i=this.getNextRelationShipID(),e.writeAttributeString(void 0,"id",this.rNamespace,i),this.addHeaderFooter(n,"OddFooter",i),e.writeEndElement())}},e.prototype.addHeaderFooter=function(e,t,i){var n=new g;this.headersFooters.add(t,n),this.headersFooters.get(t).add(i,e)},e.prototype.serializeBodyItems=function(e,t,i){for(var n=0;n<t.length;n++)this.serializeBodyItem(e,t[n],i)},e.prototype.serializeContentControl=function(e,i,n,r,o){if(t.isNullOrUndefined(i))throw new Error("contentCOntrol should not be undefined");e.writeStartElement("w","sdt",this.wNamespace),e.writeStartElement(void 0,"sdtPr",this.wNamespace),t.isNullOrUndefined(i)||this.serializeContentProperties(e,i,n,r,o)},e.prototype.serializeContentProperties=function(e,i,n,r,o){if(t.isNullOrUndefined(i.title)||(e.writeStartElement(void 0,"alias",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,i.title),e.writeEndElement(),e.writeStartElement(void 0,"tag",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,i.tag),e.writeEndElement()),t.isNullOrUndefined(i.characterFormat)||this.serializeCharacterFormat(e,n.contentControlProperties.characterFormat),(i.lockContents||i.lockContentControl)&&(e.writeStartElement(void 0,"lock",this.wNamespace),i.lockContentControl&&i.lockContents?e.writeAttributeString("w","val",this.wNamespace,"sdtContentLocked"):i.lockContentControl?e.writeAttributeString("w","val",this.wNamespace,"sdtLocked"):i.lockContents&&e.writeAttributeString("w","val",this.wNamespace,"contentLocked"),e.writeEndElement()),i.hasPlaceHolderText&&t.isNullOrUndefined(void 0)&&(e.writeStartElement("w","placeholder",void 0),e.writeAttributeString("w","docPart",this.wNamespace,void 0),e.writeEndElement(),e.writeStartElement("w","showingPlcHdr",void 0),e.writeEndElement()),i.isTemporary&&(e.writeStartElement("w","temporary",void 0),e.writeEndElement()),t.isNullOrUndefined(i.appearance)||(e.writeStartElement("w15","appearance",void 0),e.writeAttributeString("w15","val",void 0,i.appearance.toLowerCase()),e.writeEndElement()),t.isNullOrUndefined(i.color)||(e.writeStartElement("w15","color",void 0),e.writeAttributeString("w","val",void 0,this.getColor(i.color)),e.writeEndElement()),i.multiline&&(e.writeStartElement(void 0,"text",this.wNamespace),e.writeAttributeString("w","multiLine",this.wNamespace,"1"),e.writeEndElement()),t.isNullOrUndefined(i.xmlMapping)||i.xmlMapping.isMapped&&(e.writeStartElement("w","dataBinding",this.wNamespace),e.writeAttributeString("w","xpath",void 0,i.xmlMapping.xPath),e.writeAttributeString("w","storeItemID",void 0,i.xmlMapping.storeItemId),e.writeEndElement()),i.picture&&(e.writeStartElement("w","picture",this.wNamespace),e.writeEndElement()),t.isNullOrUndefined(i.uncheckedState||i.checkedState)||(e.writeStartElement("w14","checkbox",void 0),i.isChecked?(e.writeStartElement("w14","checked",void 0),e.writeAttributeString("w14","val",void 0,"1"),e.writeEndElement()):(e.writeStartElement("w14","checked",void 0),e.writeAttributeString("w14","val",void 0,"0"),e.writeEndElement()),e.writeStartElement("w14","uncheckedState",void 0),e.writeAttributeString("w14","val",void 0,this.toUnicode(i.uncheckedState.value)),e.writeAttributeString("w14","font",void 0,i.uncheckedState.font),e.writeEndElement(),e.writeStartElement("w14","checkedState",void 0),e.writeAttributeString("w14","val",void 0,this.toUnicode(i.checkedState.value)),e.writeAttributeString("w14","font",void 0,i.checkedState.font),e.writeEndElement(),e.writeEndElement()),!t.isNullOrUndefined(i.contentControlListItems)&&"DropDownList"===i.type){var s=i.contentControlListItems;e.writeStartElement(void 0,"dropDownList",this.wNamespace),this.serializeContentControlList(e,s),e.writeEndElement()}if(!t.isNullOrUndefined(i.contentControlListItems)&&"ComboBox"===i.type){var a=i.contentControlListItems;e.writeStartElement(void 0,"comboBox",this.wNamespace),this.serializeContentControlList(e,a),e.writeEndElement()}if(this.serializeContentControlDate(e,i),t.isNullOrUndefined(i.type)||"Picture"===i.type&&(e.writeStartElement(void 0,"picture",this.wNamespace),e.writeEndElement()),e.writeEndElement(),e.writeStartElement("w","sdtContent",this.wNamespace),!o){if(n.hasOwnProperty("blocks")&&t.isNullOrUndefined(n.cellFormat))for(var l=0;l<n.blocks.length;l++){var d=n.blocks[l];if(d.hasOwnProperty("inlines"))this.paragraph=d,this.serializeParagraph(e,d,r),this.paragraph=void 0;else if(d.hasOwnProperty("rowFormat")){c=new g;this.serializeRow(e,d,c)}else if(d.hasOwnProperty("contentControlProperties"))this.serializeContentControl(e,d.contentControlProperties,d,r);else{var h=d;this.serializeTable(e,h)}}else if(n.hasOwnProperty("rowFormat")){if(n.cells.length>0){c=new g;this.serializeRow(e,n,c)}}else if(n.hasOwnProperty("cellFormat")){var c=new g;this.serializeCell(e,n,c)}e.writeEndElement(),e.writeEndElement()}},e.prototype.toUnicode=function(e){return e.charCodeAt(0).toString(16)},e.prototype.serializeContentControlList=function(e,i){for(var n=0;n<i.length;n++)e.writeStartElement(void 0,"listItem",this.wNamespace),t.isNullOrUndefined(i[n].displayText)||e.writeAttributeString("w","displayText",this.wNamespace,i[n].displayText),e.writeAttributeString("w","value",this.wNamespace,i[n].value),e.writeEndElement()},e.prototype.serializeContentParagraph=function(e,i){for(var n=0;n<i.blocks.length;n++){var r=i.blocks[n];if(r.hasOwnProperty("inlines"))for(var o=0;o<r.inlines.length;o++){var s=r.inlines[o];t.isNullOrUndefined(s.characterFormat)||this.serializeCharacterFormat(e,s.characterFormat)}}},e.prototype.serializeContentControlDate=function(e,i){"Date"===i.type&&(e.writeStartElement("w","date",this.wNamespace),t.isNullOrUndefined(i.dateDisplayFormat)||(e.writeStartElement("w","calender",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,i.dateCalendarType),e.writeEndElement()),t.isNullOrUndefined(i.dateDisplayLocale)||(e.writeStartElement("w","lid",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,i.dateDisplayLocale),e.writeEndElement()),t.isNullOrUndefined(i.dateStorageFormat)||(e.writeStartElement("w","storeMappedDataAs",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,i.dateStorageFormat),e.writeEndElement()),t.isNullOrUndefined(i.dateCalendarType)||(e.writeStartElement("w","dateFormat",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,i.dateDisplayFormat),e.writeEndElement()),e.writeEndElement())},e.prototype.serializeBodyItem=function(e,i,n){if(t.isNullOrUndefined(i))throw new Error("BodyItem should not be undefined");if(i.hasOwnProperty("contentControlProperties"))this.serializeContentControl(e,i.contentControlProperties,i,n);else if(i.hasOwnProperty("inlines"))this.paragraph=i,this.serializeParagraph(e,i,n),this.paragraph=void 0;else for(var r=i,o=0;o<r.rows.length;o++)if(r.rows[o].cells.length>0){this.serializeTable(e,r);break}var s=this.blockOwner;!n&&s.hasOwnProperty("sectionFormat")&&s.blocks.indexOf(i)===s.blocks.length-1&&(e.writeStartElement("w","p",this.wNamespace),e.writeStartElement(void 0,"pPr",this.wNamespace),this.serializeSectionProperties(e,s),e.writeEndElement(),e.writeEndElement())},e.prototype.serializeParagraph=function(e,i,n){if(t.isNullOrUndefined(i))throw new Error("Paragraph should not be undefined");e.writeStartElement("w","p",this.wNamespace),this.isInsideComment&&e.writeAttributeString("w14","paraId",void 0,this.commentParaID.toString()),e.writeStartElement(void 0,"pPr",this.wNamespace),t.isNullOrUndefined(i.paragraphFormat)||this.serializeParagraphFormat(e,i.paragraphFormat,i),t.isNullOrUndefined(i.characterFormat)||this.serializeCharacterFormat(e,i.characterFormat),e.writeEndElement(),this.prevRevisionIds=[],this.serializeParagraphItems(e,i.inlines),e.writeEndElement()},e.prototype.serializeRevisionStart=function(e,i,n){if(i.hasOwnProperty("revisionIds")){if(!t.isNullOrUndefined(n)&&n.hasOwnProperty("fieldType")&&0===n.fieldType)return;if(i.hasOwnProperty("fieldType")&&1===i.fieldType)return;if(!t.isNullOrUndefined(n)&&n.hasOwnProperty("bookmarkType")&&0===n.bookmarkType&&!(n.name.indexOf("_Toc")>=0))return;for(var r=i.revisionIds,o=0;o<r.length;o++){var s=this.retrieveRevision(r[o]);"Insertion"===s.revisionType&&this.serializeTrackChanges(e,"ins",s.author,s.date),"Deletion"===s.revisionType&&this.serializeTrackChanges(e,"del",s.author,s.date)}}},e.prototype.serializeTrackChanges=function(e,t,i,n){e.writeStartElement("w",t,this.wNamespace),e.writeAttributeString("w","id",this.wNamespace,(this.trackChangesId++).toString()),e.writeAttributeString("w","author",this.wNamespace,i),e.writeAttributeString("w","date",this.wNamespace,n)},e.prototype.retrieveRevision=function(e){for(var t=0;t<this.revisions.length;t++)if(this.revisions[t].revisionID===e)return this.revisions[t]},e.prototype.serializeParagraphItems=function(e,i){for(var n,r=void 0,o=!1,s=0;s<i.length;s++){var a=i[s];a.hasOwnProperty("contentControlProperties")&&(n=!0,this.serializeContentControl(e,a.contentControlProperties,a,void 0,n),this.serializeParagraphItems(e,a.inlines)),a.hasOwnProperty("inlines")&&this.serializeParagraphItems(e,a),this.serializeRevisionStart(e,a,r);var l=!1;if(a.characterFormat&&(l=!t.isNullOrUndefined(a.characterFormat.bdo)&&"None"!==a.characterFormat.bdo)&&!o&&(this.serializeBiDirectionalOverride(e,a.characterFormat),o=!0),o&&!l&&(e.writeEndElement(),o=!1),a.hasOwnProperty("fieldType"))this.serializeFieldCharacter(e,a);else if(a.hasOwnProperty("imageString"))this.serializePicture(e,a);else if(a.hasOwnProperty("shapeId")){var d=this.paragraph;this.serializeShape(e,a),this.paragraph=d}else a.hasOwnProperty("bookmarkType")?this.serializeBookMark(e,a):a.hasOwnProperty("editRangeId")?this.serializeEditRange(e,a):a.hasOwnProperty("chartType")?(this.chart=a,this.serializeChart(e,a),this.serializeChartStructure()):a.hasOwnProperty("commentCharacterType")?this.serializeComment(e,a):a.hasOwnProperty("footnoteType")?this.serializeEFReference(e,a):this.serializeTextRange(e,a,r);this.serializeRevisionEnd(e,a,r),r=a,n&&(e.writeEndElement(),e.writeEndElement(),n=!1)}o&&e.writeEndElement()},e.prototype.serializeEFReference=function(e,t){var i="",n=t.blocks;"Footnote"===t.footnoteType?(e.writeStartElement(void 0,"r",this.wNamespace),this.serializeCharacterFormat(e,t.characterFormat),e.writeStartElement(void 0,"footnoteReference",this.wNamespace),i=this.getEFNextRelationShipID(),e.writeAttributeString(void 0,"id",this.wNamespace,i),this.addFootnotesEndnotes(n,"footnote",i),e.writeEndElement(),e.writeEndElement()):(e.writeStartElement(void 0,"r",this.wNamespace),this.serializeCharacterFormat(e,t.characterFormat),e.writeStartElement(void 0,"endnoteReference",this.wNamespace),i=this.getEFNextRelationShipID(),e.writeAttributeString(void 0,"id",this.wNamespace,i),this.addFootnotesEndnotes(n,"endnote",i),e.writeEndElement(),e.writeEndElement())},e.prototype.addFootnotesEndnotes=function(e,t,i){var n=new g;this.endnotesFootnotes.add(t,n),this.endnotesFootnotes.get(t).add(i,e)},e.prototype.serializeEndnotesFootnote=function(e,t){if(0!==this.endnotesFootnotes.length){if(this.endnotesFootnotes.containsKey(t))for(var i=this.endnotesFootnotes.get(t),n=void 0,r=0;r<i.keys.length;r++){var o=i.keys[r];n=i.get(o),"endnote"===t?(this.endnotesPath,this.endnotesRelationPath,this.serializeInlineEndnotes(e,n,o)):(this.footnotesPath,this.footnotesRelationPath,this.serializeInlineFootnotes(e,n,o))}}},e.prototype.serializeInlineEndnotes=function(e,t,i){this.endNoteFootnote=t;var n=this.blockOwner;this.blockOwner=t,e.writeStartElement("w","endnote",this.wNamespace),e.writeAttributeString(void 0,"id",this.wNamespace,i),this.serializeBodyItems(e,t,!0),e.writeEndElement(),this.blockOwner=n,this.endNoteFootnote=void 0},e.prototype.serializeInlineFootnotes=function(e,t,i){this.endNoteFootnote=t;var n=this.blockOwner;this.blockOwner=t,e.writeStartElement("w","footnote",this.wNamespace),e.writeAttributeString(void 0,"id",this.wNamespace,i),this.serializeBodyItems(e,t,!0),e.writeEndElement(),this.blockOwner=n,this.endNoteFootnote=void 0},e.prototype.writeEFCommonAttributes=function(e){e.writeAttributeString("xmlns","wpc",void 0,this.wpCanvasNamespace),e.writeAttributeString("xmlns","cx",void 0,this.cxNamespace),e.writeAttributeString("xmlns","aink",void 0,"http://schemas.microsoft.com/office/drawing/2016/ink"),e.writeAttributeString("xmlns","am3d",void 0,"http://schemas.microsoft.com/office/drawing/2017/,odel3d"),this.writeCustom(e),e.writeAttributeString("xmlns","wp14",void 0,this.wpDrawingNamespace),e.writeAttributeString("xmlns","wp",void 0,this.wpNamespace),e.writeAttributeString("xmlns","w",void 0,this.wNamespace),this.writeDup(e),e.writeAttributeString("xmlns","wne",void 0,this.wneNamespace),e.writeAttributeString("xmlns","wps",void 0,this.wpShapeNamespace),e.writeAttributeString("mc","Ignorable",void 0,"w14 w15")},e.prototype.serializeFootnotes=function(){if(!t.isNullOrUndefined(this.document.footnotes)){var e=new p.XmlWriter;e.writeStartElement("w","footnotes",this.wNamespace),this.writeEFCommonAttributes(e),e.writeStartElement("w","footnote",this.wNamespace),e.writeAttributeString(void 0,"type",this.wNamespace,"separator"),e.writeAttributeString(void 0,"id",this.wNamespace,"-1"),this.serializeBodyItems(e,this.document.footnotes.separator,!0),e.writeEndElement(),e.writeStartElement("w","footnote",this.wNamespace),e.writeAttributeString(void 0,"type",this.wNamespace,"continuationSeparator"),e.writeAttributeString(void 0,"id",this.wNamespace,"0"),this.serializeBodyItems(e,this.document.footnotes.continuationSeparator,!0),e.writeEndElement(),this.document.footnotes.continuationNotice&&(e.writeStartElement("w","endnote",this.wNamespace),e.writeAttributeString(void 0,"type",this.wNamespace,"continuationNotice"),e.writeAttributeString(void 0,"id",this.wNamespace,"1"),this.serializeBodyItems(e,this.document.footnotes.continuationNotice,!0),e.writeEndElement()),this.serializeEndnotesFootnote(e,"footnote"),e.writeEndElement();var i=new c.ZipArchiveItem(e.buffer,this.footnotesPath);this.mArchive.addItem(i)}},e.prototype.serializeEndnotes=function(){if(!t.isNullOrUndefined(this.document.endnotes)){var e=new p.XmlWriter;e.writeStartElement("w","endnotes",this.wNamespace),this.writeEFCommonAttributes(e),e.writeStartElement("w","endnote",this.wNamespace),e.writeAttributeString(void 0,"type",this.wNamespace,"separator"),e.writeAttributeString(void 0,"id",this.wNamespace,"-1"),this.serializeBodyItems(e,this.document.endnotes.separator,!0),e.writeEndElement(),e.writeStartElement("w","endnote",this.wNamespace),e.writeAttributeString(void 0,"type",this.wNamespace,"continuationSeparator"),e.writeAttributeString(void 0,"id",this.wNamespace,"0"),this.serializeBodyItems(e,this.document.endnotes.continuationSeparator,!0),e.writeEndElement(),this.document.endnotes.continuationNotice&&(e.writeStartElement("w","endnote",this.wNamespace),e.writeAttributeString(void 0,"type",this.wNamespace,"continuationNotice"),e.writeAttributeString(void 0,"id",this.wNamespace,"1"),this.serializeBodyItems(e,this.document.endnotes.continuationNotice,!0),e.writeEndElement()),this.serializeEndnotesFootnote(e,"endnote"),e.writeEndElement();var i=new c.ZipArchiveItem(e.buffer,this.endnotesPath);this.mArchive.addItem(i)}},e.prototype.serializeRevisionEnd=function(e,i,n){if(i.hasOwnProperty("revisionIds")){if(i.hasOwnProperty("fieldType")&&0===i.fieldType)return;if(!t.isNullOrUndefined(n)&&n.hasOwnProperty("fieldType")&&(2===n.fieldType||0===n.fieldType&&i.text.indexOf("TOC")>=0))return;for(var r=0;r<i.revisionIds.length;r++){var o=this.retrieveRevision(i.revisionIds[r]);"Insertion"!==o.revisionType&&"Deletion"!==o.revisionType||e.writeEndElement()}}},e.prototype.serializeComment=function(e,i){if(1!==this.mComments.length||""!==this.mComments[0].text){0===i.commentCharacterType?e.writeStartElement("w","commentRangeStart",this.wNamespace):1===i.commentCharacterType&&e.writeStartElement("w","commentRangeEnd",this.wNamespace);var n=this.commentId[i.commentId];t.isNullOrUndefined(n)&&(n=this.commentId[i.commentId]=this.currentCommentId++),e.writeAttributeString("w","id",this.wNamespace,n.toString()),e.writeEndElement(),1===i.commentCharacterType&&this.serializeCommentItems(e,n)}},e.prototype.serializeCommentItems=function(e,t){e.writeStartElement("w","r",this.wNamespace),e.writeStartElement("w","commentReference",this.wNamespace),e.writeAttributeString("w","id",this.wNamespace,t.toString()),e.writeEndElement(),e.writeEndElement()},e.prototype.serializeBiDirectionalOverride=function(e,t){e.writeStartElement(void 0,"bdo",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,t.bdo.toLowerCase())},e.prototype.serializeEditRange=function(e,t){t.hasOwnProperty("editableRangeStart")?e.writeStartElement("w","permEnd",this.wNamespace):(e.writeStartElement("w","permStart",this.wNamespace),t.user&&""!==t.user&&e.writeAttributeString("w","ed",this.wNamespace,t.user),t.group&&""!==t.group&&e.writeAttributeString("w","edGrp",this.wNamespace,t.group.toLowerCase()),t.columnFirst&&-1!==t.columnFirst&&e.writeAttributeString("w","colFirst",this.wNamespace,t.columnFirst.toString()),t.columnLast&&-1!==t.columnLast&&e.writeAttributeString("w","colLast",this.wNamespace,t.columnLast.toString())),e.writeAttributeString("w","id",this.wNamespace,t.editRangeId),e.writeEndElement()},e.prototype.serializeBookMark=function(e,t){var i=this.getBookmarkId(t.name),n=t.name;0===t.bookmarkType?(e.writeStartElement("w","bookmarkStart",this.wNamespace),e.writeAttributeString("w","name",this.wNamespace,n)):1===t.bookmarkType&&e.writeStartElement("w","bookmarkEnd",this.wNamespace),e.writeAttributeString("w","id",this.wNamespace,i.toString()),e.writeEndElement()},e.prototype.getBookmarkId=function(e){var t=this.bookmarks.indexOf(e);return t<0&&(t=this.bookmarks.length,this.bookmarks.push(e)),t},e.prototype.serializePicture=function(e,t){t.width>=0&&t.height>=0&&(e.writeStartElement(void 0,"r",this.wNamespace),this.serializeCharacterFormat(e,t.characterFormat),this.serializeDrawing(e,t),e.writeEndElement())},e.prototype.serializeShape=function(e,t){t.width>=0&&t.height>=0&&(e.writeStartElement(void 0,"r",this.wNamespace),this.serializeCharacterFormat(e,t.characterFormat),this.serializeDrawing(e,t),e.writeEndElement())},e.prototype.serializeDrawing=function(e,t){e.writeStartElement(void 0,"drawing",this.wNamespace),t.hasOwnProperty("chartType")?this.serializeInlineCharts(e,t):"Inline"===t.textWrappingStyle?this.serializeInlinePictureAndShape(e,t):this.serializeWrappingPictureAndShape(e,t),e.writeEndElement()},e.prototype.serializeWrappingPictureAndShape=function(e,i){e.writeStartElement("wp","anchor",this.wpNamespace),this.serializePictureAndShapeDistance(e,i),e.writeAttributeString(void 0,"simplePos",void 0,"0"),e.writeAttributeString(void 0,"relativeHeight",void 0,i.zOrderPosition?i.zOrderPosition.toString():"0");var n=i.textWrappingStyle&&"Behind"===i.textWrappingStyle;e.writeAttributeString(void 0,"behindDoc",void 0,n?"1":"0");var r=i.LockAnchor?"1":"0";e.writeAttributeString(void 0,"locked",void 0,r);var o=i.layoutInCell?"1":"0";e.writeAttributeString(void 0,"layoutInCell",void 0,o);var s=i.allowOverlap?"1":"0";if(e.writeAttributeString(void 0,"allowOverlap",void 0,s),e.writeStartElement("wp","simplePos",this.wpNamespace),e.writeAttributeString(void 0,"x",void 0,"0"),e.writeAttributeString(void 0,"y",void 0,"0"),e.writeEndElement(),e.writeStartElement("wp","positionH",this.wpNamespace),e.writeAttributeString(void 0,"relativeFrom",void 0,i.horizontalOrigin.toString().toLowerCase()),"None"===i.horizontalAlignment){e.writeStartElement("wp","posOffset",this.wpNamespace);var a=Math.round(i.horizontalPosition*this.emusPerPoint);e.writeString(a.toString()),e.writeEndElement()}else{e.writeStartElement("wp","align",this.wpNamespace);var l=i.horizontalAlignment.toString().toLowerCase();e.writeString(l),e.writeEndElement()}if(e.writeEndElement(),e.writeStartElement("wp","positionV",this.wpNamespace),e.writeAttributeString(void 0,"relativeFrom",void 0,i.verticalOrigin.toString().toLowerCase()),"None"===i.verticalAlignment){e.writeStartElement("wp","posOffset",this.wpNamespace);var d=Math.round(i.verticalPosition*this.emusPerPoint);e.writeString(d.toString()),e.writeEndElement()}else{e.writeStartElement("wp","align",this.wpNamespace);var h=i.verticalAlignment.toString().toLowerCase();e.writeString(h),e.writeEndElement()}e.writeEndElement(),e.writeStartElement(void 0,"extent",this.wpNamespace);var c=Math.round(i.width*this.emusPerPoint);e.writeAttributeString(void 0,"cx",void 0,c.toString());var p=Math.round(i.height*this.emusPerPoint);e.writeAttributeString(void 0,"cy",void 0,p.toString()),e.writeEndElement(),t.isNullOrUndefined(i.imageString)?this.serializeShapeDrawingGraphics(e,i):(this.serializeShapeWrapStyle(e,i),this.serializeDrawingGraphics(e,i)),e.writeEndElement()},e.prototype.serializeInlinePictureAndShape=function(e,i){e.writeStartElement(void 0,"inline",this.wpNamespace),this.writeDefaultDistAttribute(e),e.writeStartElement(void 0,"extent",this.wpNamespace);var n=Math.round(i.width*this.emusPerPoint);e.writeAttributeString(void 0,"cx",void 0,n.toString());var r=Math.round(i.height*this.emusPerPoint);e.writeAttributeString(void 0,"cy",void 0,r.toString()),e.writeEndElement(),t.isNullOrUndefined(i.imageString)?this.serializeShapeDrawingGraphics(e,i):(this.serializeShapeWrapStyle(e,i),this.serializeDrawingGraphics(e,i)),e.writeEndElement()},e.prototype.serializePictureAndShapeDistance=function(e,t){var i=t.distanceTop?Math.round(t.distanceTop*this.emusPerPoint).toString():"0";e.writeAttributeString(void 0,"distT",void 0,i);var n=t.distanceBottom?Math.round(t.distanceBottom*this.emusPerPoint).toString():"0";e.writeAttributeString(void 0,"distB",void 0,n);var r=t.distanceLeft?Math.round(t.distanceLeft*this.emusPerPoint).toString():"114300";e.writeAttributeString(void 0,"distL",void 0,r);var o=t.distanceRight?Math.round(t.distanceRight*this.emusPerPoint).toString():"114300";e.writeAttributeString(void 0,"distR",void 0,o)},e.prototype.writeDefaultDistAttribute=function(e){e.writeAttributeString(void 0,"distT",void 0,"0"),e.writeAttributeString(void 0,"distB",void 0,"0"),e.writeAttributeString(void 0,"distL",void 0,"0"),e.writeAttributeString(void 0,"distR",void 0,"0")},e.prototype.serializeInlineCharts=function(e,t){e.writeStartElement(void 0,"inline",this.wpNamespace),this.writeDefaultDistAttribute(e),e.writeStartElement(void 0,"extent",this.wpNamespace);var i=Math.round(t.width*this.emusPerPoint);e.writeAttributeString(void 0,"cx",void 0,i.toString());var n=Math.round(t.height*this.emusPerPoint);e.writeAttributeString(void 0,"cy",void 0,n.toString()),e.writeEndElement(),e.writeStartElement(void 0,"effectExtent",this.wpNamespace),e.writeAttributeString(void 0,"l",void 0,"0"),e.writeAttributeString(void 0,"t",void 0,"0"),e.writeAttributeString(void 0,"r",void 0,"0"),e.writeAttributeString(void 0,"b",void 0,"0"),e.writeEndElement(),this.serializeDrawingGraphicsChart(e,t),e.writeEndElement()},e.prototype.serializeDrawingGraphicsChart=function(e,t){var i="";i=this.updatechartId(t),e.writeStartElement("wp","docPr",this.wpNamespace),e.writeAttributeString(void 0,"id",void 0,(this.mDocPrID++).toString()),e.writeAttributeString(void 0,"name",void 0,this.getNextChartName()),e.writeEndElement(),e.writeStartElement("wp","cNvGraphicFramePr",this.wpNamespace),e.writeEndElement(),e.writeStartElement("a","graphic",this.aNamespace),e.writeStartElement("a","graphicData",this.aNamespace),e.writeAttributeString(void 0,"uri",void 0,this.chartNamespace),e.writeStartElement("c","chart",this.chartNamespace),e.writeAttributeString("xmlns","r",void 0,this.rNamespace),e.writeAttributeString("r","id",void 0,i),e.writeEndElement(),e.writeEndElement(),e.writeEndElement()},e.prototype.getNextChartName=function(){return"Chart"+ ++this.chartCount},e.prototype.serializeChart=function(e,t){e.writeStartElement("w","r",this.wNamespace),this.serializeCharacterFormat(e,t.characterFormat),this.serializeDrawing(e,t),e.writeEndElement()},e.prototype.serializeChartStructure=function(){this.serializeChartXML(),this.serializeChartColors(),this.serializeChartExcelData(),this.serializeChartRelations(),this.chart=void 0,this.saveExcel()},e.prototype.serializeChartXML=function(){var e="",t=new p.XmlWriter;t.writeStartElement("c","chartSpace",this.chartNamespace),t.writeAttributeString("xmlns","a",void 0,this.aNamespace),t.writeAttributeString("xmlns","r",void 0,this.rNamespace),t.writeAttributeString("xmlns","c16r2",void 0,this.c15Namespace),this.serializeChartData(t,this.chart),t.writeStartElement("c","externalData",this.chartNamespace),t.writeAttributeString("r","id",void 0,"rId1"),t.writeStartElement("c","autoUpdate",this.chartNamespace),t.writeAttributeString(void 0,"val",void 0,"0"),t.writeEndElement(),t.writeEndElement(),t.writeEndElement(),e=this.chartPath+"/chart"+this.chartCount+".xml";var i=new c.ZipArchiveItem(t.buffer,e);this.mArchive.addItem(i)},e.prototype.serializeChartColors=function(){var e=new p.XmlWriter,t="";e.writeStartElement("cs","colorStyle",this.csNamespace),e.writeAttributeString("xmlns","a",void 0,this.aNamespace),e.writeAttributeString(void 0,"meth",void 0,"cycle"),e.writeAttributeString(void 0,"id",void 0,"10"),this.serializeChartColor(e),t=this.chartPath+"/colors"+this.chartCount+".xml",e.writeEndElement();var i=new c.ZipArchiveItem(e.buffer,t);this.mArchive.addItem(i),t=""},e.prototype.serializeChartColor=function(e){for(var t=1;t<=6;t++)e.writeStartElement("a","schemeClr",this.aNamespace),e.writeAttributeString(void 0,"val",void 0,"accent"+t),e.writeEndElement();e.writeStartElement("cs","variation",this.csNamespace),e.writeEndElement(),e.writeStartElement("cs","variation",this.csNamespace),e.writeStartElement("a","lumMod",this.aNamespace),e.writeAttributeString(void 0,"val",void 0,"60000"),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("cs","variation",this.csNamespace),e.writeStartElement("a","lumMod",this.aNamespace),e.writeAttributeString(void 0,"val",void 0,"80000"),e.writeEndElement(),e.writeStartElement("a","lumOff",this.aNamespace),e.writeAttributeString(void 0,"val",void 0,"20000"),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("cs","variation",this.csNamespace),e.writeStartElement("a","lumMod",this.aNamespace),e.writeAttributeString(void 0,"val",void 0,"80000"),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("cs","variation",this.csNamespace),e.writeStartElement("a","lumMod",this.aNamespace),e.writeAttributeString(void 0,"val",void 0,"60000"),e.writeEndElement(),e.writeStartElement("a","lumOff",this.aNamespace),e.writeAttributeString(void 0,"val",void 0,"40000"),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("cs","variation",this.csNamespace),e.writeStartElement("a","lumMod",this.aNamespace),e.writeAttributeString(void 0,"val",void 0,"50000"),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("cs","variation",this.csNamespace),e.writeStartElement("a","lumMod",this.aNamespace),e.writeAttributeString(void 0,"val",void 0,"70000"),e.writeEndElement(),e.writeStartElement("a","lumOff",this.aNamespace),e.writeAttributeString(void 0,"val",void 0,"30000"),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("cs","variation",this.csNamespace),e.writeStartElement("a","lumMod",this.aNamespace),e.writeAttributeString(void 0,"val",void 0,"70000"),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("cs","variation",this.csNamespace),e.writeStartElement("a","lumMod",this.aNamespace),e.writeAttributeString(void 0,"val",void 0,"50000"),e.writeEndElement(),e.writeStartElement("a","lumOff",this.aNamespace),e.writeAttributeString(void 0,"val",void 0,"50000"),e.writeEndElement(),e.writeEndElement()},e.prototype.serializeChartExcelData=function(){t.isNullOrUndefined(this.excelFiles)&&(this.excelFiles=new g),this.mArchiveExcel=new c.ZipArchive,this.mArchiveExcel.compressionLevel="Normal";var e=this.chart.chartType,i="Scatter_Markers"===e||"Bubble"===e;this.serializeWorkBook(),this.serializeSharedString(i),this.serializeExcelContentTypes(),this.serializeExcelData(i),this.serializeExcelStyles(),this.serializeExcelRelation(),this.serializeExcelGeneralRelations(),this.chartStringCount=0},e.prototype.serializeWorkBook=function(){var e=new p.XmlWriter;this.resetExcelRelationShipId(),e.writeStartElement(void 0,"workbook",void 0),e.writeAttributeString("xmlns","r",void 0,this.rNamespace),e.writeAttributeString("xmlns",void 0,void 0,this.spreadSheetNamespace),e.writeStartElement(void 0,"sheets",void 0),e.writeStartElement(void 0,"sheet",void 0),e.writeAttributeString(void 0,"name",void 0,"Sheet1"),e.writeAttributeString(void 0,"sheetId",void 0,"1"),e.writeAttributeString("r","id",void 0,this.getNextExcelRelationShipID()),e.writeEndElement(),e.writeEndElement(),e.writeEndElement();var t=new c.ZipArchiveItem(e.buffer,"xl/workbook.xml");this.mArchiveExcel.addItem(t)},e.prototype.serializeExcelStyles=function(){var e=new p.XmlWriter;e.writeStartElement(void 0,"styleSheet",void 0),e.writeAttributeString("xmlns","mc",void 0,this.veNamespace),e.writeAttributeString("mc","Ignorable",void 0,"x14ac"),e.writeAttributeString("xmlns","x14ac",void 0,"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"),e.writeAttributeString("xmlns",void 0,void 0,this.spreadSheetNamespace),e.writeEndElement();var t=new c.ZipArchiveItem(e.buffer,"xl/styles.xml");this.mArchiveExcel.addItem(t)},e.prototype.serializeExcelData=function(e){var t=new p.XmlWriter;t.writeStartElement(void 0,"worksheet",void 0),t.writeAttributeString("xmlns","r",void 0,this.rNamespace),t.writeAttributeString("xmlns","x14",void 0,this.spreadSheet9),t.writeAttributeString("xmlns","mc",void 0,this.veNamespace),t.writeAttributeString("xmlns",void 0,void 0,this.spreadSheetNamespace),this.serializeExcelSheet(t,e),t.writeEndElement();var i=new c.ZipArchiveItem(t.buffer,"xl/worksheets/sheet1.xml");this.mArchiveExcel.addItem(i)},e.prototype.serializeSharedString=function(e){for(var t=this.chart,i=new p.XmlWriter,n=[],r=this.chart.chartType,o=t.chartSeries.length,s=0;s<o;s++){var a=t.chartSeries[s],l=a.seriesName.match(/[a-z]/i);e&&0===s&&n.push("X-Values"),l&&(n.push(a.seriesName),this.chartStringCount++)}"Bubble"===r&&n.push("Size");for(var d=0;d<t.chartCategory.length;d++){var h=t.chartCategory[d],u=t.chartPrimaryCategoryAxis.numberFormat;((l=h.categoryXName.match(/[a-z]/i))||"m/d/yyyy"===u)&&(n.push(h.categoryXName),this.chartStringCount++)}var g=this.chartStringCount+1;i.writeStartElement(void 0,"sst",void 0),i.writeAttributeString("xmlns",void 0,void 0,this.spreadSheetNamespace),i.writeAttributeString(void 0,"count",void 0,g.toString()),i.writeAttributeString(void 0,"uniqueCount",void 0,g.toString());for(var m=0;m<=n.length;m++)i.writeStartElement(void 0,"si",void 0),i.writeStartElement(void 0,"t",void 0),m!==n.length?i.writeString(n[m]):e||(i.writeAttributeString("xml","space",this.xmlNamespace,"preserve"),i.writeString(" ")),i.writeEndElement(),i.writeEndElement();i.writeEndElement();var f=new c.ZipArchiveItem(i.buffer,"xl/sharedStrings.xml");this.mArchiveExcel.addItem(f)},e.prototype.serializeExcelSheet=function(e,i){var n,r=this.chart,o="s",s="Bubble"===r.chartType,a=r.chartCategory.length+1,l=r.chartPrimaryCategoryAxis.numberFormat,d=r.chartSeries.length+1;s&&(n=d,d+=1);var h=void 0,c=void 0,p=0;e.writeStartElement(void 0,"sheetData",void 0);for(var u=0;u<a;u++){e.writeStartElement(void 0,"row",void 0),e.writeAttributeString(void 0,"r",void 0,(u+1).toString());for(var g=0;g<d;g++){var m=String.fromCharCode("A".charCodeAt(0)+g)+(u+1).toString();if(e.writeStartElement(void 0,"c",void 0),e.writeAttributeString(void 0,"r",void 0,m),0!==u&&0===g){var f=(h=r.chartCategory[u-1]).categoryXName.match(/[a-z]/i);o=t.isNullOrUndefined(f)&&"m/d/yyyy"===l?"s":!f&&!t.isNullOrUndefined(f)||i?"n":"s"}else o=0===u&&0!==g&&g!==n?(f=(c=r.chartSeries[g-1]).seriesName.match(/[a-z]/i))?"s":"n":0===u&&s&&g===n?"s":0===u&&0===g?"s":"n";if(e.writeAttributeString(void 0,"t",void 0,o),e.writeStartElement(void 0,"v",void 0),0!==u||0!==g||i){if("s"===o)e.writeString(p.toString()),p++;else if(0!==u&&"s"!==o&&0===g&&g!==n)e.writeString(h.categoryXName);else if(0!==g&&"s"!==o&&0===u&&g!==n)e.writeString(c.seriesName);else if(0!==g&&g!==n){var v=(y=h.chartData[g-1]).yValue;e.writeString(v.toString())}else if(s&&g===n){var y=h.chartData[g-2],b=y.size;e.writeString(b.toString())}}else e.writeString(this.chartStringCount.toString());e.writeEndElement(),e.writeEndElement(),o=""}e.writeEndElement()}e.writeEndElement()},e.prototype.serializeExcelContentTypes=function(){var e=new p.XmlWriter;e.writeStartElement(void 0,"Types","http://schemas.openxmlformats.org/package/2006/content-types"),this.serializeDefaultContentType(e,"xml",this.xmlContentType),this.serializeDefaultContentType(e,"rels",this.relationContentType),this.serializeOverrideContentType(e,"xl/styles.xml","application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"),this.serializeOverrideContentType(e,"xl/workbook.xml","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"),this.serializeOverrideContentType(e,"xl/sharedStrings.xml","application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"),this.serializeOverrideContentType(e,"xl/worksheets/sheet1.xml","application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"),e.writeEndElement();var t=new c.ZipArchiveItem(e.buffer,this.contentTypesPath);this.mArchiveExcel.addItem(t)},e.prototype.serializeExcelRelation=function(){var e=new p.XmlWriter;this.resetExcelRelationShipId();e.writeStartElement(void 0,"Relationships",this.rpNamespace),this.serializeRelationShip(e,this.getNextExcelRelationShipID(),"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet","worksheets/sheet1.xml"),this.serializeRelationShip(e,this.getNextExcelRelationShipID(),this.stylesRelType,"styles.xml"),this.serializeRelationShip(e,this.getNextExcelRelationShipID(),"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings","sharedStrings.xml"),e.writeEndElement();var t=new c.ZipArchiveItem(e.buffer,this.excelRelationPath);this.mArchiveExcel.addItem(t)},e.prototype.serializeExcelGeneralRelations=function(){var e=new p.XmlWriter;this.resetExcelRelationShipId(),e.writeStartElement(void 0,"Relationships",this.rpNamespace),this.serializeRelationShip(e,this.getNextExcelRelationShipID(),this.documentRelType,"xl/workbook.xml"),e.writeEndElement();var t=new c.ZipArchiveItem(e.buffer,this.generalRelationPath);this.mArchiveExcel.addItem(t)},e.prototype.getNextExcelRelationShipID=function(){return"rId"+ ++this.eRelationShipId},e.prototype.getNextChartRelationShipID=function(){return"rId"+ ++this.cRelationShipId},e.prototype.serializeChartData=function(e,i){e.writeStartElement("c","date1904",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement(),e.writeStartElement("c","lang",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"en-US"),e.writeEndElement(),e.writeStartElement("c","roundedCorners",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement(),e.writeStartElement("mc","AlternateContent",this.veNamespace),e.writeStartElement("mc","Choice",this.veNamespace),e.writeAttributeString("xmlns","c14",void 0,this.c7Namespace),e.writeAttributeString(void 0,"Requires",void 0,"c14"),e.writeStartElement("c14","style",void 0),e.writeAttributeString(void 0,"val",void 0,"102"),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("mc","Fallback",this.veNamespace),e.writeStartElement("c","style",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"2"),e.writeEndElement(),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("c","chart",this.chartNamespace),t.isNullOrUndefined(this.chart.chartTitle)||(e.writeStartElement("c","title",this.chartNamespace),this.serializeTextProperties(e,this.chart.chartTitleArea,this.chart.chartTitle),e.writeEndElement()),this.serializeChartPlotArea(e,i),e.writeEndElement(),this.serializeShapeProperties(e,"D9D9D9",!0),e.writeStartElement("c","txPr",this.chartNamespace),e.writeAttributeString("xmlns","c",void 0,this.chartNamespace),e.writeStartElement("a","bodyPr",this.aNamespace),e.writeAttributeString("xmlns","a",void 0,this.aNamespace),e.writeEndElement(),e.writeStartElement("a","lstStyle",this.aNamespace),e.writeAttributeString("xmlns","a",void 0,this.aNamespace),e.writeEndElement(),e.writeStartElement("a","p",this.aNamespace),e.writeAttributeString("xmlns","a",void 0,this.aNamespace),e.writeStartElement("a","pPr",this.aNamespace),e.writeStartElement("a","defRPr",this.aNamespace),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("a","endParaRPr",this.aNamespace),e.writeAttributeString(void 0,"lang",void 0,"en-US"),e.writeEndElement(),e.writeEndElement(),e.writeEndElement()},e.prototype.serializeChartPlotArea=function(e,i){e.writeStartElement("c","autoTitleDeleted",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement(),e.writeStartElement("c","plotArea",this.chartNamespace),e.writeStartElement("c","layout",this.chartNamespace),e.writeEndElement();var n=this.chartType(i),r="pieChart"===n||"doughnutChart"===n,o="scatterChart"===n||"bubbleChart"===n;if(e.writeStartElement("c",n,this.chartNamespace),"barChart"===n){var s="";s="Column_Clustered"===i.chartType||"Column_Stacked"===i.chartType||"Column_Stacked_100"===i.chartType?"col":"bar",e.writeStartElement("c","barDir",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,s),e.writeEndElement()}if(!r&&!o){var a=this.chartGrouping(i.chartType);e.writeStartElement("c","grouping",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,a),e.writeEndElement()}"scatterChart"===n&&(e.writeStartElement("c","scatterStyle",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"marker"),e.writeEndElement()),e.writeStartElement("c","varyColors",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement();for(var l="",d=0;d<i.chartSeries.length;d++){var h=i.chartSeries[d];this.seriesCount=d,e.writeStartElement("c","ser",this.chartNamespace),e.writeStartElement("c","idx",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,d.toString()),e.writeEndElement(),e.writeStartElement("c","order",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,d.toString()),e.writeEndElement(),e.writeStartElement("c","tx",this.chartNamespace),e.writeStartElement("c","strRef",this.chartNamespace),e.writeStartElement("c","f",this.chartNamespace);var c=String.fromCharCode("B".charCodeAt(0)+d);if(l="Sheet1!$"+c,e.writeString(l+"$1"),l=l+"$2:$"+c+"$",e.writeEndElement(),e.writeStartElement("c","strCache",this.chartNamespace),e.writeStartElement("c","ptCount",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"1"),e.writeEndElement(),e.writeStartElement("c","pt",this.chartNamespace),e.writeAttributeString(void 0,"idx",void 0,"0"),e.writeStartElement("c","v",this.chartNamespace),e.writeString(h.seriesName),e.writeEndElement(),e.writeEndElement(),e.writeEndElement(),e.writeEndElement(),e.writeEndElement(),"Pie"===i.chartType||"Doughnut"===i.chartType?(this.parseChartDataPoint(e,h),e.writeStartElement("c","explosion",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement()):o||this.parseChartSeriesColor(e,h.dataPoints,n),"scatterChart"===n){var p=h.dataPoints[0].fill.foreColor;e.writeStartElement("c","marker",this.chartNamespace),e.writeStartElement("c","symbol",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"circle"),e.writeEndElement(),e.writeStartElement("c","size",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"5"),e.writeEndElement(),this.serializeShapeProperties(e,p,!1),e.writeEndElement()}h.dataLabel&&this.parseChartDataLabels(e,h.dataLabel),h.trendLines&&this.parseChartTrendLines(e,h),h.errorBar&&this.serializeChartErrorBar(e,h),"scatterChart"===n?this.serializeDefaultShapeProperties(e):"bubbleChart"===n&&this.serializeShapeProperties(e,h.dataPoints[d].fill.foreColor,!1);var u="cat",g="strRef",m="strCache";"scatterChart"===n&&(u="xVal",g="numRef",m="numCache"),e.writeStartElement("c",u,this.chartNamespace),e.writeStartElement("c",g,this.chartNamespace),this.serializeChartCategory(e,i,m),e.writeEndElement(),e.writeEndElement(),this.serializeChartValue(e,l,n),e.writeEndElement()}if(e.writeStartElement("c","dLbls",this.chartNamespace),r&&(e.writeStartElement("c","dLblPos",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"bestFit"),e.writeEndElement()),e.writeStartElement("c","showLegendKey",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement(),e.writeStartElement("c","showVal",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement(),e.writeStartElement("c","showCatName",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement(),e.writeStartElement("c","showSerName",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement(),e.writeStartElement("c","showPercent",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement(),e.writeStartElement("c","showBubbleSize",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement(),e.writeStartElement("c","showLeaderLines",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"1"),e.writeEndElement(),e.writeEndElement(),r){var f=0,v=0;(h=this.chart.chartSeries[0]).hasOwnProperty("firstSliceAngle")&&(f=h.firstSliceAngle),e.writeStartElement("c","firstSliceAng",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,f.toString()),e.writeEndElement(),"Doughnut"===i.chartType&&(v=h.holeSize,e.writeStartElement("c","holeSize",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,v.toString()),e.writeEndElement())}"lineChart"===n||o?"bubbleChart"!==n&&(e.writeStartElement("c","smooth",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement()):(e.writeStartElement("c","gapWidth",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,this.chart.gapWidth.toString()),e.writeEndElement(),e.writeStartElement("c","overlap",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,this.chart.overlap.toString()),e.writeEndElement()),"bubbleChart"===n&&(e.writeStartElement("c","sizeRepresents",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"area"),e.writeEndElement());var y=this.chart.chartType;r||(e.writeStartElement("c","axId",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"335265000"),e.writeEndElement(),e.writeStartElement("c","axId",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"335263360"),e.writeEndElement()),e.writeEndElement();var b="Column_Stacked_100"===y||"Area_Stacked_100"===y||"Bar_Stacked_100"===y||"Line_Stacked_100"===y||"Line_Markers_Stacked_100"===y,w=this.chart.chartPrimaryCategoryAxis.categoryType;if(r||(this.serializeCategoryAxis(e,w,b),this.serializeValueAxis(e,w,b)),this.chart.hasOwnProperty("chartDataTable")){var C=this.chart.chartDataTable,x=0,F=0,P=0,T=0;C.showSeriesKeys&&(T=1),C.hasHorzBorder&&(x=1),C.hasVertBorder&&(F=1),C.hasBorders&&(P=1),e.writeStartElement("c","dTable",this.chartNamespace),e.writeStartElement("c","showHorzBorder",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,x.toString()),e.writeEndElement(),e.writeStartElement("c","showVertBorder",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,F.toString()),e.writeEndElement(),e.writeStartElement("c","showOutline",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,P.toString()),e.writeEndElement(),e.writeStartElement("c","showKeys",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,T.toString()),e.writeEndElement(),e.writeEndElement()}this.serializeDefaultShapeProperties(e),e.writeEndElement(),t.isNullOrUndefined(this.chart.chartLegend.position)||this.serializeChartLegend(e),e.writeStartElement("c","plotVisOnly",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"1"),e.writeEndElement(),e.writeStartElement("c","dispBlanksAs",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"gap"),e.writeEndElement()},e.prototype.serializeChartLegend=function(e){var t=this.chartLegendPosition(this.chart.chartLegend),i=this.chart.chartLegend.chartTitleArea,n=i.dataFormat.fill.foreColor;e.writeStartElement("c","legend",this.chartNamespace),e.writeStartElement("c","legendPos",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,t),e.writeEndElement(),e.writeStartElement("c","overlay",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement(),this.serializeDefaultShapeProperties(e),e.writeStartElement("c","txPr",this.chartNamespace),e.writeStartElement("a","bodyPr",this.aNamespace),e.writeEndElement(),e.writeStartElement("a","lstStyle",this.aNamespace),e.writeEndElement(),e.writeStartElement("a","p",this.aNamespace),this.serializeChartTitleFont(e,i.fontSize,n,i.fontName),e.writeEndElement(),e.writeEndElement(),e.writeEndElement()},e.prototype.serializeChartErrorBar=function(e,t){var i=t.errorBar,n=this.errorBarValueType(i.type),r=0;"Cap"!==i.endStyle&&(r=1),e.writeStartElement("c","errBars",this.chartNamespace),e.writeStartElement("c","errBarType",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,i.direction.toLowerCase()),e.writeEndElement(),e.writeStartElement("c","errValType",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,n),e.writeEndElement(),e.writeStartElement("c","noEndCap",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,r.toString()),e.writeEndElement(),e.writeStartElement("c","val",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,i.numberValue.toString()),e.writeEndElement(),this.serializeShapeProperties(e,"595959",!0),e.writeEndElement()},e.prototype.errorBarValueType=function(e){var t="";switch(e){case"StandardError":t="stdErr";break;case"StandardDeviation":t="stdDev";break;case"Percentage":t="percentage";break;case"Fixed":t="fixedVal";break;default:t="stdErr"}return t},e.prototype.serializeCategoryAxis=function(e,t,i){var n="catAx",r=this.chart.chartPrimaryCategoryAxis.numberFormat,o=this.chart.chartType,s="Scatter_Markers"===o||"Bubble"===o;"Time"===t&&(n="dateAx"),s&&(n="valAx"),e.writeStartElement("c",n,this.chartNamespace),e.writeStartElement("c","axId",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"335265000"),e.writeEndElement(),this.serializeAxis(e,"335263360",this.chart.chartPrimaryCategoryAxis,r,i),s||(e.writeStartElement("c","auto",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"1"),e.writeEndElement(),e.writeStartElement("c","lblAlgn",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"ctr"),e.writeEndElement(),e.writeStartElement("c","lblOffset",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"100"),e.writeEndElement()),"Time"===t?(e.writeStartElement("c","baseTimeUnit",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"days"),e.writeEndElement()):"Bubble"!==this.chart.chartType&&(e.writeStartElement("c","noMultiLvlLbl",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement()),e.writeEndElement()},e.prototype.serializeValueAxis=function(e,t,i){var n=this.chart.chartPrimaryValueAxis,r="between";"Time"===t&&(r="midCat"),e.writeStartElement("c","valAx",this.chartNamespace),e.writeStartElement("c","axId",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"335263360"),e.writeEndElement(),this.serializeAxis(e,"335265000",n,"General",i),e.writeStartElement("c","crossBetween",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,r),e.writeEndElement(),0===n.majorUnit||i||(e.writeStartElement("c","majorUnit",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,n.majorUnit.toString()),e.writeEndElement()),e.writeEndElement()},e.prototype.serializeAxis=function(e,t,i,n,r){e.writeStartElement("c","scaling",this.chartNamespace),e.writeStartElement("c","orientation",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"minMax"),e.writeEndElement(),0===i.maximumValue||r||(e.writeStartElement("c","max",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,i.maximumValue.toString()),e.writeEndElement(),e.writeStartElement("c","min",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,i.minimumValue.toString()),e.writeEndElement()),e.writeEndElement(),e.writeStartElement("c","delete",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement(),e.writeStartElement("c","axPos",this.chartNamespace),"335265000"===t?e.writeAttributeString(void 0,"val",void 0,"l"):e.writeAttributeString(void 0,"val",void 0,"b"),e.writeEndElement(),i.hasMajorGridLines&&(e.writeStartElement("c","majorGridlines",this.chartNamespace),this.serializeShapeProperties(e,"D9D9D9",!0),e.writeEndElement()),i.hasMinorGridLines&&(e.writeStartElement("c","minorGridlines",this.chartNamespace),this.serializeShapeProperties(e,"F2F2F2",!0),e.writeEndElement()),i.chartTitle&&(e.writeStartElement("c","title",this.chartNamespace),this.serializeTextProperties(e,i.chartTitleArea,i.chartTitle),e.writeEndElement()),e.writeStartElement("c","numFmt",this.chartNamespace),e.writeAttributeString(void 0,"formatCode",void 0,n),e.writeAttributeString(void 0,"sourceLinked",void 0,"1"),e.writeEndElement(),e.writeStartElement("c","majorTickMark",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"none"),e.writeEndElement(),e.writeStartElement("c","minorTickMark",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"none"),e.writeEndElement(),e.writeStartElement("c","tickLblPos",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"nextTo"),e.writeEndElement(),"Bubble"===this.chart.chartType?this.serializeShapeProperties(e,"BFBFBF",!0):this.serializeDefaultShapeProperties(e),e.writeStartElement("c","txPr",this.chartNamespace),e.writeStartElement("a","bodyPr",this.aNamespace),e.writeEndElement(),e.writeStartElement("a","p",this.aNamespace),this.serializeChartTitleFont(e,i.fontSize,"595959",i.fontName),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("c","crossAx",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,t),e.writeEndElement(),e.writeStartElement("c","crosses",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"autoZero"),e.writeEndElement()},e.prototype.parseChartTrendLines=function(e,t){for(var i=0;i<t.trendLines.length;i++){var n=t.trendLines[i],r=this.chartTrendLineType(n.type),o=0,s=0;n.isDisplayEquation?s=1:n.isDisplayRSquared&&(o=1);var a=t.dataPoints[i];e.writeStartElement("c","trendline",this.chartNamespace),e.writeStartElement("c","spPr",this.chartNamespace),e.writeStartElement("a","ln",this.aNamespace),e.writeAttributeString(void 0,"w",void 0,"19050"),this.serializeChartSolidFill(e,a.fill.foreColor,!1),e.writeStartElement("a","prstDash",this.aNamespace),e.writeAttributeString(void 0,"val",void 0,"sysDot"),e.writeEndElement(),e.writeStartElement("a","round",this.aNamespace),e.writeEndElement(),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("c","trendlineType",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,r),e.writeEndElement(),e.writeStartElement("c","forward",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,n.forward.toString()),e.writeEndElement(),e.writeStartElement("c","backward",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,n.backward.toString()),e.writeEndElement(),"NaN"!==n.intercept&&(e.writeStartElement("c","intercept",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,n.intercept.toString()),e.writeEndElement()),e.writeStartElement("c","dispRSqr",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,o.toString()),e.writeEndElement(),e.writeStartElement("c","dispEq",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,s.toString()),e.writeEndElement(),e.writeEndElement()}},e.prototype.chartTrendLineType=function(e){var t="";switch(e){case"Linear":t="linear";break;case"Exponential":t="exp"}return t},e.prototype.parseChartDataLabels=function(e,t){var i="",n=0,r=0,o=0,s=0,a=0,l=0,d=0;switch(t.position){case"Center":i="ctr";break;case"Left":i="l";break;case"Right":i="r";break;case"Outside":i="outEnd";break;case"BestFit":i="bestFit";break;case"Bottom":case"OutsideBase":i="inBase";break;case"Inside":i="inEnd";break;case"Above":i="t";break;case"Below":i="b";break;default:i="Automatic"}e.writeStartElement("c","dLbls",this.chartNamespace),this.serializeDefaultShapeProperties(e),e.writeStartElement("c","txPr",this.chartNamespace),e.writeStartElement("a","bodyPr",this.aNamespace),e.writeEndElement(),e.writeStartElement("a","lstStyle",this.aNamespace),e.writeEndElement(),e.writeStartElement("a","p",this.aNamespace),this.serializeChartTitleFont(e,t.fontSize,t.fontColor,t.fontName),e.writeEndElement(),e.writeEndElement(),t.isLegendKey?n=1:t.isBubbleSize?r=1:t.isCategoryName?o=1:t.isSeriesName?s=1:t.isValue?a=1:t.isPercentage?l=1:t.isLeaderLines&&(d=1),"Automatic"!==i&&(e.writeStartElement("c","dLblPos",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,i),e.writeEndElement()),e.writeStartElement("c","showLegendKey",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,n.toString()),e.writeEndElement(),e.writeStartElement("c","showVal",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,a.toString()),e.writeEndElement(),e.writeStartElement("c","showCatName",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,o.toString()),e.writeEndElement(),e.writeStartElement("c","showSerName",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,s.toString()),e.writeEndElement(),e.writeStartElement("c","showPercent",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,l.toString()),e.writeEndElement(),e.writeStartElement("c","showBubbleSize",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,r.toString()),e.writeEndElement(),e.writeStartElement("c","showLeaderLines",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,d.toString()),e.writeEndElement(),e.writeEndElement()},e.prototype.serializeShapeProperties=function(e,t,i){var n=this.chart.chartType,r="Scatter_Markers"===n||"Bubble"===n;e.writeStartElement("c","spPr",this.chartNamespace),!r||i?(e.writeStartElement("a","ln",this.aNamespace),e.writeAttributeString(void 0,"w",void 0,"9525"),this.serializeChartSolidFill(e,t,!1),e.writeStartElement("a","prstDash",this.aNamespace),e.writeAttributeString(void 0,"val",void 0,"solid"),e.writeEndElement(),e.writeStartElement("a","round",this.aNamespace),e.writeEndElement(),e.writeEndElement()):"Scatter_Markers"===n?(this.serializeChartSolidFill(e,t,!1),this.serializeDefaultLineProperties(e)):"Bubble"===n&&(this.serializeChartSolidFill(e,t,!0),this.serializeDefaultLineProperties(e)),e.writeStartElement("a","effectLst",this.aNamespace),e.writeEndElement(),e.writeEndElement()},e.prototype.serializeDefaultShapeProperties=function(e){e.writeStartElement("c","spPr",this.chartNamespace),e.writeStartElement("a","noFill",this.aNamespace),e.writeEndElement(),this.serializeDefaultLineProperties(e),e.writeStartElement("a","effectLst",this.aNamespace),e.writeEndElement(),e.writeEndElement()},e.prototype.serializeDefaultLineProperties=function(e){e.writeStartElement("a","ln",this.aNamespace),e.writeStartElement("a","noFill",this.aNamespace),e.writeEndElement(),e.writeStartElement("a","round",this.aNamespace),e.writeEndElement(),e.writeEndElement()},e.prototype.serializeTextProperties=function(e,t,i){var n=t.dataFormat.fill.foreColor,r=100*t.fontSize;e.writeStartElement("c","tx",this.chartNamespace),e.writeStartElement("c","rich",this.chartNamespace),e.writeStartElement("a","bodyPr",this.aNamespace),e.writeAttributeString(void 0,"rot",void 0,"0"),e.writeAttributeString(void 0,"vert",void 0,"horz"),e.writeEndElement(),e.writeStartElement("a","lstStyle",this.aNamespace),e.writeEndElement(),e.writeStartElement("a","p",this.aNamespace),this.serializeChartTitleFont(e,t.fontSize,n,t.fontName),e.writeStartElement("a","r",this.aNamespace),e.writeStartElement("a","rPr",this.aNamespace),e.writeAttributeString(void 0,"lang",void 0,"en-US"),e.writeAttributeString(void 0,"b",void 0,"0"),e.writeAttributeString(void 0,"sz",void 0,r.toString()),e.writeAttributeString(void 0,"baseline",void 0,"0"),this.serializeChartSolidFill(e,n,!1),this.serializeFont(e,t.fontName),e.writeEndElement(),e.writeStartElement("a","t",this.aNamespace),e.writeString(i),e.writeEndElement(),e.writeEndElement(),e.writeEndElement(),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("c","layout",this.chartNamespace),e.writeEndElement(),e.writeStartElement("c","overlay",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement(),this.serializeDefaultShapeProperties(e),e.writeStartElement("c","txPr",this.chartNamespace),e.writeStartElement("a","bodyPr",this.aNamespace),e.writeEndElement(),e.writeStartElement("a","lstStyle",this.aNamespace),e.writeEndElement(),e.writeStartElement("a","p",this.aNamespace),e.writeEndElement(),this.serializeChartTitleFont(e,t.fontSize,n,t.fontName),e.writeEndElement()},e.prototype.serializeChartTitleFont=function(e,t,i,n){var r=100*t;e.writeStartElement("a","pPr",this.aNamespace),e.writeStartElement("a","defRPr",this.aNamespace),e.writeAttributeString(void 0,"lang",void 0,"en-US"),e.writeAttributeString(void 0,"b",void 0,"0"),e.writeAttributeString(void 0,"sz",void 0,r.toString()),e.writeAttributeString(void 0,"baseline",void 0,"0"),this.serializeChartSolidFill(e,i,!1),this.serializeFont(e,n),e.writeEndElement(),e.writeEndElement()},e.prototype.serializeChartSolidFill=function(e,t,i){e.writeStartElement("a","solidFill",this.aNamespace),e.writeStartElement("a","srgbClr",this.aNamespace),"000000"!==t?e.writeAttributeString(void 0,"val",void 0,t):e.writeAttributeString(void 0,"val",void 0,"595959"),"Bubble"===this.chart.chartType&&i&&(e.writeStartElement("a","alpha",this.aNamespace),e.writeAttributeString(void 0,"val",void 0,"75000"),e.writeEndElement()),e.writeEndElement(),e.writeEndElement()},e.prototype.serializeFont=function(e,t){e.writeStartElement("a","latin",this.aNamespace),e.writeAttributeString(void 0,"typeface",void 0,t),e.writeEndElement(),e.writeStartElement("a","ea",this.aNamespace),e.writeAttributeString(void 0,"typeface",void 0,t),e.writeEndElement(),e.writeStartElement("a","cs",this.aNamespace),e.writeAttributeString(void 0,"typeface",void 0,t),e.writeEndElement()},e.prototype.parseChartSeriesColor=function(e,t,i){for(var n=0;n<t.length;n++){var r=t[n];if(e.writeStartElement("c","spPr",this.chartNamespace),"lineChart"===i&&(e.writeStartElement("a","ln",this.aNamespace),e.writeAttributeString(void 0,"w",void 0,"28575"),e.writeAttributeString(void 0,"cap",void 0,"rnd")),"lineChart"!==i?this.serializeChartSolidFill(e,r.fill.foreColor,!0):this.serializeChartSolidFill(e,r.line.color,!0),"lineChart"!==i&&(e.writeStartElement("a","ln",this.aNamespace),e.writeStartElement("a","noFill",this.aNamespace),e.writeEndElement()),e.writeStartElement("a","round",this.aNamespace),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("a","effectLst",this.aNamespace),e.writeEndElement(),e.writeEndElement(),"lineChart"===i){var o="none",s=0;this.chart.chartSeries[n].hasOwnProperty("seriesFormat")&&(o=this.chart.chartSeries[n].seriesFormat.markerStyle,s=this.chart.chartSeries[n].seriesFormat.markerSize),e.writeStartElement("c","marker",this.chartNamespace),e.writeStartElement("c","symbol",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,o.toLowerCase()),e.writeEndElement(),this.chart.chartSeries[n].hasOwnProperty("seriesFormat")&&(e.writeStartElement("c","size",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,s.toString()),e.writeEndElement()),e.writeEndElement()}}},e.prototype.parseChartDataPoint=function(e,t){for(var i=t.dataPoints,n=[],r=0;r<i.length;r++)n.push(i[r]),e.writeStartElement("c","dPt",this.chartNamespace),e.writeStartElement("c","idx",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,r.toString()),e.writeEndElement(),e.writeStartElement("c","bubble3D",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement(),this.parseChartSeriesColor(e,n,this.chart.chartType),e.writeEndElement(),n=[]},e.prototype.serializeChartCategory=function(e,t,i){var n=t.chartCategory,r=n.length;e.writeStartElement("c","f",this.chartNamespace),e.writeString("Sheet1!$A$2:$A$"+(r+1).toString()),e.writeEndElement(),e.writeStartElement("c",i,this.chartNamespace),"numCache"===i&&(e.writeStartElement("c","formatCode",this.chartNamespace),e.writeString("General"),e.writeEndElement()),e.writeStartElement("c","ptCount",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,r.toString()),e.writeEndElement();for(var o=0;o<n.length;o++){var s=n[o];e.writeStartElement("c","pt",this.chartNamespace),e.writeAttributeString(void 0,"idx",void 0,o.toString()),e.writeStartElement("c","v",this.chartNamespace),""!==s.categoryXName&&e.writeString(s.categoryXName),e.writeEndElement(),e.writeEndElement()}e.writeEndElement()},e.prototype.serializeChartValue=function(e,t,i){var n="val";("scatterChart"===i||"bubbleChart"===i)&&(n="yVal"),this.serializeChartYValue(e,n,t),"bubbleChart"===i&&(n="bubbleSize",t="Sheet1!$C$2:$C$",this.serializeChartYValue(e,n,t)),"lineChart"!==i&&"scatterChart"!==i||(e.writeStartElement("c","smooth",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,"0"),e.writeEndElement())},e.prototype.serializeChartYValue=function(e,t,i){var n=this.chart.chartCategory,r=n.length;e.writeStartElement("c",t,this.chartNamespace),e.writeStartElement("c","numRef",this.chartNamespace),e.writeStartElement("c","f",this.chartNamespace),e.writeString(i+(r+1).toString()),e.writeEndElement(),e.writeStartElement("c","numCache",this.chartNamespace),e.writeStartElement("c","formatCode",this.chartNamespace),e.writeString("General"),e.writeEndElement(),e.writeStartElement("c","ptCount",this.chartNamespace),e.writeAttributeString(void 0,"val",void 0,r.toString()),e.writeEndElement();for(var o=0;o<r;o++)for(var s=n[o],a=0;a<s.chartData.length;a++)if(a===this.seriesCount){var l=s.chartData[this.seriesCount];e.writeStartElement("c","pt",this.chartNamespace),e.writeAttributeString(void 0,"idx",void 0,o.toString()),e.writeStartElement("c","v",this.chartNamespace),"bubbleSize"!==t?e.writeString(l.yValue.toString()):e.writeString(l.size.toString()),e.writeEndElement(),e.writeEndElement()}e.writeEndElement(),e.writeEndElement(),e.writeEndElement()},e.prototype.chartType=function(e){var t=e.chartType;switch(t){case"Pie":t="pieChart";break;case"Doughnut":t="doughnutChart";break;case"Scatter_Markers":t="scatterChart";break;case"Bubble":t="bubbleChart"}return"Area"!==t&&"Area_Stacked"!==t&&"Area_Stacked_100"!==t||(t="areaChart"),"Bar_Stacked_100"!==t&&"Bar_Stacked"!==t&&"Bar_Clustered"!==t&&"Column_Clustered"!==t&&"Column_Stacked"!==t&&"Column_Stacked_100"!==t||(t="barChart"),"Line"!==t&&"Line_Markers"!==t&&"Line_Markers_Stacked"!==t&&"Line_Stacked"!==t&&"Line_Markers_Stacked_100"!==t&&"Line_Stacked_100"!==t||(t="lineChart"),t},e.prototype.chartGrouping=function(e){var t="standard";return"Bar_Stacked"===e||"Column_Stacked"===e||"Area_Stacked"===e||"Line_Stacked"===e||"Line_Markers_Stacked"===e?t="stacked":"Bar_Stacked_100"===e||"Column_Stacked_100"===e||"Area_Stacked_100"===e||"Line_Stacked_100"===e||"Line_Markers_Stacked_100"===e?t="percentStacked":"Bar_Clustered"!==e&&"Column_Clustered"!==e||(t="clustered"),t},e.prototype.chartLegendPosition=function(e){var t=e.position;switch(t){case"Top":t="t";break;case"Bottom":t="b";break;case"Left":t="l";break;case"Right":t="r";break;case"Corner":t="tr";break;default:t="b"}return t},e.prototype.updatechartId=function(e){var t="";return""===t&&(t=this.addChartRelation(this.documentCharts,e)),t},e.prototype.addChartRelation=function(e,t){var i="";return i=this.getNextRelationShipID(),e.add(i,t),i},e.prototype.startsWith=function(e,t){return t.length>0&&e.substring(0,t.length)===t},e.prototype.serializeShapeDrawingGraphics=function(e,i){var n=i.autoShapeType;i.shapeId;this.serializeShapeWrapStyle(e,i),e.writeStartElement("wp","docPr",this.wpNamespace),e.writeAttributeString(void 0,"id",void 0,(this.mDocPrID++).toString()),e.writeAttributeString(void 0,"name",void 0,i.name),e.writeAttributeString(void 0,"title",void 0,i.title),e.writeEndElement(),e.writeStartElement("a","graphic",this.aNamespace),e.writeStartElement("a","graphicData",this.aNamespace),e.writeAttributeString(void 0,"uri",void 0,this.wpShapeNamespace),e.writeStartElement("wps","wsp",this.wpShapeNamespace),e.writeStartElement("wps","cNvCnPr",this.wpShapeNamespace),e.writeStartElement("a","cxnSpLocks",this.aNamespace),e.writeAttributeString(void 0,"noChangeShapeType",void 0,"1"),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("wps","spPr",this.wpShapeNamespace),e.writeAttributeString(void 0,"bwMode",void 0,"auto"),e.writeStartElement("a","xfrm",this.aNamespace),e.writeStartElement("a","off",this.aNamespace),e.writeAttributeString(void 0,"x",void 0,"0"),e.writeAttributeString(void 0,"y",void 0,"0"),e.writeEndElement(),e.writeStartElement("a","ext",this.aNamespace);var r=Math.round(i.width*this.emusPerPoint);e.writeAttributeString(void 0,"cx",void 0,r.toString());var o=Math.round(i.height*this.emusPerPoint);if(e.writeAttributeString(void 0,"cy",void 0,o.toString()),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("a","prstGeom",this.aNamespace),"StraightConnector"===n?e.writeAttributeString(void 0,"prst",void 0,"straightConnector1"):"RoundedRectangle"===n?e.writeAttributeString(void 0,"prst",void 0,"roundRect"):e.writeAttributeString(void 0,"prst",void 0,"rect"),e.writeStartElement("a","avLst",this.aNamespace),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("a","noFill",this.aNamespace),e.writeEndElement(),e.writeStartElement("a","ln",this.aNamespace),e.writeAttributeString(void 0,"w",void 0,"12700"),!t.isNullOrUndefined(i.lineFormat.lineFormatType)&&"None"!==i.lineFormat.lineFormatType||i.lineFormat.line?(e.writeStartElement("a","solidFill",this.aNamespace),e.writeStartElement("a","srgbClr",this.aNamespace),e.writeAttributeString(void 0,"val",void 0,this.getColor(i.lineFormat.color)),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("a","round",this.aNamespace),e.writeEndElement(),e.writeStartElement("a","headEnd",this.aNamespace),e.writeEndElement(),e.writeStartElement("a","tailEnd",this.aNamespace),e.writeEndElement()):(e.writeStartElement("a","noFill",this.aNamespace),e.writeEndElement()),e.writeEndElement(),e.writeEndElement(),"Rectangle"!==n&&"RoundedRectangle"!==n||(e.writeStartElement("wps","txbx",this.wpShapeNamespace),e.writeStartElement(void 0,"txbxContent",this.wNamespace),this.serializeBodyItems(e,i.textFrame.blocks,!0),e.writeEndElement(),e.writeEndElement()),e.writeStartElement("wps","bodyPr",this.wpShapeNamespace),!t.isNullOrUndefined(i.textFrame)){var s=void 0;i.textFrame.leftMargin>=0&&(s=Math.round(i.textFrame.leftMargin*this.emusPerPoint).toString(),e.writeAttributeString(void 0,"lIns",void 0,s)),i.textFrame.topMargin>=0&&(s=Math.round(i.textFrame.topMargin*this.emusPerPoint).toString(),e.writeAttributeString(void 0,"tIns",void 0,s)),i.textFrame.rightMargin>=0&&(s=Math.round(i.textFrame.rightMargin*this.emusPerPoint).toString(),e.writeAttributeString(void 0,"rIns",void 0,s)),i.textFrame.bottomMargin>=0&&(s=Math.round(i.textFrame.bottomMargin*this.emusPerPoint).toString(),e.writeAttributeString(void 0,"bIns",void 0,s)),e.writeAttributeString(void 0,"anchor",void 0,"t"),e.writeAttributeString(void 0,"anchorCtr",void 0,"0")}e.writeEndElement(),e.writeEndElement(),e.writeEndElement(),e.writeEndElement()},e.prototype.serializeShapeWrapStyle=function(e,t){var i="wrapNone";if(t.textWrappingStyle&&"InFrontOfText"!==t.textWrappingStyle&&"Behind"!==t.textWrappingStyle&&(i="wrap"+t.textWrappingStyle,"Tight"===t.textWrappingStyle&&(i="wrapSquare")),e.writeStartElement("wp",i,this.wpNamespace),t.textWrappingStyle&&"InFrontOfText"!==t.textWrappingStyle&&"Behind"!==t.textWrappingStyle&&t.textWrappingType){var n="Both"===t.textWrappingType?"bothSides":t.textWrappingType.toLowerCase();e.writeAttributeString(void 0,"wrapText",void 0,n)}e.writeEndElement()},e.prototype.serializeDrawingGraphics=function(e,i){var n="";if(i.isMetaFile&&!t.isNullOrUndefined(i.metaFileImageString)&&(i.imageString=i.metaFileImageString),n=this.updateShapeId(i),e.writeStartElement("wp","docPr",this.wpNamespace),e.writeAttributeString(void 0,"id",void 0,(this.mDocPrID++).toString()),t.isNullOrUndefined(i.alternativeText)||e.writeAttributeString(void 0,"descr",void 0,i.alternativeText),e.writeAttributeString(void 0,"name",void 0,t.isNullOrUndefined(i.name)?"":i.name),e.writeAttributeString(void 0,"title",void 0,""),e.writeEndElement(),e.writeStartElement("a","graphic",this.aNamespace),e.writeStartElement("a","graphicData",this.aNamespace),e.writeAttributeString(void 0,"uri",void 0,this.pictureNamespace),e.writeStartElement("pic","pic",this.pictureNamespace),e.writeStartElement("pic","nvPicPr",this.pictureNamespace),e.writeStartElement("pic","cNvPr",this.pictureNamespace),e.writeAttributeString(void 0,"id",void 0,"0"),e.writeAttributeString(void 0,"name",void 0,""),e.writeAttributeString(void 0,"descr",void 0,""),e.writeEndElement(),e.writeStartElement("pic","cNvPicPr",this.pictureNamespace),e.writeStartElement("a","picLocks",this.aNamespace),e.writeAttributeString(void 0,"noChangeAspect",void 0,"1"),e.writeAttributeString(void 0,"noChangeArrowheads",void 0,"1"),e.writeEndElement(),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("pic","blipFill",this.pictureNamespace),e.writeStartElement("a","blip",this.aNamespace),this.startsWith(i.imageString,"data:image")?e.writeAttributeString("r","embed",this.rNamespace,n):this.documentImages.containsKey(n)&&(this.documentImages.remove(n),this.externalImages.add(n,i.imageString),e.writeAttributeString(void 0,"link",this.rNamespace,n)),e.writeEndElement(),i.iscrop){e.writeStartElement("a","srcRect",this.aNamespace);var r=Math.round(1e3*i.left);e.writeAttributeString(void 0,"l",void 0,r.toString());var o=Math.round(1e3*i.top);e.writeAttributeString(void 0,"t",void 0,o.toString());var s=Math.round(1e3*i.right);e.writeAttributeString(void 0,"r",void 0,s.toString());var a=Math.round(1e3*i.bottom);e.writeAttributeString(void 0,"b",void 0,a.toString()),e.writeEndElement()}e.writeStartElement("a","stretch",this.aNamespace),e.writeStartElement("a","fillRect",this.aNamespace),e.writeEndElement(),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("pic","spPr",this.pictureNamespace),e.writeAttributeString(void 0,"bwMode",void 0,"auto"),e.writeStartElement("a","xfrm",this.aNamespace),e.writeStartElement("a","off",this.aNamespace),e.writeAttributeString(void 0,"x",void 0,"0"),e.writeAttributeString(void 0,"y",void 0,"0"),e.writeEndElement(),e.writeStartElement("a","ext",this.aNamespace);var l=Math.round(i.width*this.emusPerPoint);e.writeAttributeString(void 0,"cx",void 0,l.toString());var d=Math.round(i.height*this.emusPerPoint);e.writeAttributeString(void 0,"cy",void 0,d.toString()),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("a","prstGeom",this.aNamespace),e.writeAttributeString(void 0,"prst",void 0,"rect"),e.writeStartElement("a","avLst",this.aNamespace),e.writeEndElement(),e.writeEndElement(),e.writeEndElement(),e.writeEndElement(),e.writeEndElement(),e.writeEndElement()},e.prototype.updateShapeId=function(e){var t="",i=this.paragraph;return this.headerFooter?t=this.updateHFImageRels(this.headerFooter,e):""===t&&(i.hasOwnProperty("sectionFormat")||i.hasOwnProperty("inlines"))&&(t=this.addImageRelation(this.documentImages,e)),t},e.prototype.addImageRelation=function(e,t){var i="";return i=this.getNextRelationShipID(),e.add(i,t),i},e.prototype.updateHFImageRels=function(e,t){for(var i="",n="",r=this.headersFooters.keys,o=0;o<r.length;o++)for(var s=this.headersFooters.get(r[o]),a=s.keys,l=0;l<a.length;l++)if(s.get(a[l])===e){n=a[l];var d=void 0;this.headerFooterImages.containsKey(n)?(d=this.headerFooterImages.get(n),i=this.addImageRelation(d,t)):(d=new g,i=this.addImageRelation(d,t),this.headerFooterImages.add(n,d))}return i},e.prototype.serializeTable=function(e,t){if(!(t.rows.length<=0)){var i=this.table;this.table=t,e.writeStartElement(void 0,"tbl",this.wNamespace);var n=t.rows[0].rowFormat;this.serializeTableFormat(e,n,t),this.serializeTableGrid(e,t);var r=new g,o=new g,s=new g,a=t.rows;if(a.length>0)for(var l=0;l<a.length;l++){var d=a[l];if(d.cells.length>0){if(d.hasOwnProperty("contentControlProperties")){this.serializeContentControl(e,d.contentControlProperties,d);continue}var h=this.row;this.row=d,e.writeStartElement(void 0,"tr",this.wNamespace),this.serializeRowFormat(e,d);for(var c=d.cells,p=c.length,u=0,m=0;m<p;m++){var f=c[m],v=f.columnIndex;if(f.hasOwnProperty("contentControlProperties"))this.serializeContentControl(e,f.contentControlProperties,f);else{var y=f.cellFormat;if(v-u>0)for(var b=0===m?0:u+1;b<v;b++)if(r.containsKey(b)){var w=this.getMergeCellFormat(y,s.get(b),b<f.columnIndex);this.serializeTableCell(e,f,w,!1),r.set(b,r.get(b)-1),1===r.get(b)&&(r.remove(b),s.remove(b),o.containsKey(b)&&o.remove(b)),o.containsKey(b)&&(u+=o.get(b)-1,b+=o.get(b))}u=v,y.rowSpan>1&&(r.add(v,y.rowSpan),s.add(v,y)),this.serializeTableCell(e,f,y,!0),y.columnSpan>1&&y.rowSpan>1&&o.add(v,y.columnSpan);for(var C=v+1;;C++)if(r.containsKey(C)){var x=this.getMergeCellFormat(y,s.get(C),C<f.columnIndex);this.serializeTableCell(e,f,x,!1),r.set(C,r.get(C)-1),u++,1===r.get(C)&&(r.remove(C),s.remove(C),o.containsKey(C)&&o.remove(C)),o.containsKey(C)&&(u+=o.get(C)-1,C+=o.get(C))}else if(!(m===p-1&&C<t.columnCount))break}}e.writeEndElement(),this.row=h}}e.writeEndElement(),this.table=i}},e.prototype.getMergeCellFormat=function(e,t,i){var n=t;return i?n.borders.right=e.borders.left:n.borders.left=e.borders.right,n},e.prototype.serializeTableCell=function(e,t,i,n){var r=this.blockOwner;if(this.blockOwner=t,e.writeStartElement(void 0,"tc",this.wNamespace),e.writeStartElement(void 0,"tcPr",this.wNamespace),this.serializeCellWidth(e,i),this.serializeCellMargins(e,i),e.writeStartElement(void 0,"tcBorders",this.wNamespace),this.serializeBorders(e,i.borders,8),e.writeEndElement(),this.serializeShading(e,t.cellFormat.shading),this.serializeTableCellDirection(e,i),this.serializeCellVerticalAlign(e,i.verticalAlignment),i.columnSpan>1){var o=i.columnSpan;e.writeStartElement(void 0,"gridSpan",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,o.toString()),e.writeEndElement()}if(i.rowSpan>1&&(e.writeStartElement(void 0,"vMerge",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,n?"restart":"continue"),e.writeEndElement()),e.writeEndElement(),t&&t.blocks.length>0)for(var s=0,a=void 0;s<t.blocks.length;)a=t.blocks[s],this.serializeBodyItem(e,a,!1),s+=1;else e.writeStartElement(void 0,"p",this.wNamespace),e.writeStartElement(void 0,"pPr",this.wNamespace),e.writeStartElement(void 0,"pStyle",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,"Normal"),e.writeEndElement(),e.writeEndElement(),e.writeEndElement();e.writeEndElement(),this.blockOwner=r},e.prototype.serializeTableGrid=function(e,t){e.writeStartElement(void 0,"tblGrid",this.wNamespace),0!==t.grid.length&&this.serializeGridColumns(e,t.grid),e.writeEndElement()},e.prototype.serializeTableRows=function(e,t){var i=new g;if(t.length>0)for(var n=0;n<t.length;n++){var r=t[n];if(r.cells.length>0){if(r.hasOwnProperty("contentControlProperties")){this.serializeContentControl(e,r.contentControlProperties,r);continue}this.serializeRow(e,r,i)}}},e.prototype.serializeRow=function(e,t,i){var n=this.row;this.row=t,e.writeStartElement(void 0,"tr",this.wNamespace),this.serializeRowFormat(e,t),this.serializeCells(e,t.cells,i),e.writeEndElement(),this.row=n},e.prototype.serializeRowFormat=function(e,i){if(this.serializeRowMargins(e,i.rowFormat),e.writeStartElement(void 0,"trPr",this.wNamespace),i.rowFormat.height>0){e.writeStartElement(void 0,"trHeight",this.wNamespace),"Exactly"===i.rowFormat.heightType?e.writeAttributeString("w","hRule",this.wNamespace,"exact"):"AtLeast"===i.rowFormat.heightType&&e.writeAttributeString("w","hRule",this.wNamespace,"atLeast");var n=this.roundToTwoDecimal(i.rowFormat.height*this.twentiethOfPoint).toString();e.writeAttributeString("w","val",this.wNamespace,n),e.writeEndElement()}var r=i.rowFormat,o=r.gridBefore;o>0&&(e.writeStartElement(void 0,"gridBefore",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,o.toString()),e.writeEndElement());var s=r.gridAfter;if(s>0&&(e.writeStartElement(void 0,"gridAfter",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,s.toString()),e.writeEndElement()),o>0){switch(e.writeStartElement(void 0,"wBefore",this.wNamespace),r.gridBeforeWidthType){case"Percent":a=this.roundToTwoDecimal(r.gridBeforeWidth*this.percentageFactor).toString();e.writeAttributeString("w","val",this.wNamespace,a),e.writeAttributeString("w","type",this.wNamespace,"pct");break;case"Point":l=this.roundToTwoDecimal(r.gridBeforeWidth*this.twipsInOnePoint).toString();e.writeAttributeString("w","val",this.wNamespace,l),e.writeAttributeString("w","type",this.wNamespace,"dxa")}e.writeEndElement()}if(s>0){switch(e.writeStartElement(void 0,"wAfter",this.wNamespace),r.gridAfterWidthType){case"Percent":var a=this.roundToTwoDecimal(r.gridAfterWidth*this.percentageFactor).toString();e.writeAttributeString("w","val",this.wNamespace,a),e.writeAttributeString("w","type",this.wNamespace,"pct");break;case"Point":var l=this.roundToTwoDecimal(r.gridAfterWidth*this.twipsInOnePoint).toString();e.writeAttributeString("w","val",this.wNamespace,l),e.writeAttributeString("w","type",this.wNamespace,"dxa")}e.writeEndElement()}r.allowBreakAcrossPages||(e.writeStartElement(void 0,"cantSplit",this.wNamespace),e.writeEndElement()),r.isHeader&&(e.writeStartElement(void 0,"tblHeader",this.wNamespace),e.writeEndElement()),!t.isNullOrUndefined(r.revisionIds)&&r.revisionIds.length>0&&(this.serializeRevisionStart(e,r,void 0),this.serializeRevisionEnd(e,r,void 0)),e.writeEndElement()},e.prototype.serializeCells=function(e,t,i){for(var n=0;n<t.length;n++)t[n].hasOwnProperty("contentControlProperties")?this.serializeContentControl(e,t[n].contentControlProperties,t[n]):this.serializeCell(e,t[n],i)},e.prototype.serializeCell=function(e,t,i){var n=this.blockOwner;if(this.blockOwner=t,e.writeStartElement(void 0,"tc",this.wNamespace),i=this.serializeCellFormat(e,t.cellFormat,!0,!0,i),t.blocks.length>0)for(var r=0,o=void 0;r<t.blocks.length;)o=t.blocks[r],this.serializeBodyItem(e,o,!1),r+=1;else e.writeStartElement(void 0,"p",this.wNamespace),e.writeStartElement(void 0,"pPr",this.wNamespace),e.writeStartElement(void 0,"pStyle",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,"Normal"),e.writeEndElement(),e.writeEndElement(),e.writeEndElement();e.writeEndElement();var s=1;if(i.containsKey(t.columnIndex+t.cellFormat.columnSpan-1+s)&&1===this.row.cells.length)for(var a=i.keys[i.keys.length-1];s<=a;)s=this.createCellForMerge(e,t,i,s),s++;else this.createCellForMerge(e,t,i,s);this.blockOwner=n},e.prototype.createCellForMerge=function(e,i,n,r){for(;n.containsKey(i.columnIndex+i.cellFormat.columnSpan-1+r)&&(this.row.cells.indexOf(i)===this.row.cells.length-1||this.row.cells.indexOf(i)===i.columnIndex)&&void 0===i.nextNode;){var o=i.columnIndex+i.cellFormat.columnSpan-1+r;e.writeStartElement(void 0,"tc",this.wNamespace);var s=!0;t.isNullOrUndefined(this.spanCellFormat)?(e.writeStartElement(void 0,"tcPr",this.wNamespace),s=!1):(s=!1,n=this.serializeCellFormat(e,this.spanCellFormat,!1,s,n)),this.serializeColumnSpan(o,e),e.writeStartElement(void 0,"vMerge",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,"continue"),e.writeEndElement(),t.isNullOrUndefined(this.spanCellFormat)&&(e.writeStartElement(void 0,"tcBorders",this.wNamespace),this.serializeBorders(e,i.cellFormat.borders,8),e.writeEndElement()),s||e.writeEndElement(),n=this.checkMergeCell(o,n),e.writeStartElement("w","p",this.wNamespace),e.writeEndElement(),e.writeEndElement(),r++}return r},e.prototype.serializeCellFormat=function(e,t,i,n,r){var o=this.blockOwner;this.table.tableFormat,this.row.rowFormat;return e.writeStartElement(void 0,"tcPr",this.wNamespace),this.serializeCellWidth(e,t),this.serializeCellMargins(e,t),i&&(r=this.serializeCellMerge(e,t,r),this.serializeGridSpan(e,o)),e.writeStartElement(void 0,"tcBorders",this.wNamespace),this.serializeBorders(e,t.borders,8),e.writeEndElement(),this.serializeShading(e,o.cellFormat.shading),this.serializeTableCellDirection(e,t),this.serializeCellVerticalAlign(e,t.verticalAlignment),n&&e.writeEndElement(),r},e.prototype.serializeCellWidth=function(e,t){e.writeStartElement(void 0,"tcW",this.wNamespace),"Percent"===t.preferredWidthType?(e.writeAttributeString(void 0,"type",this.wNamespace,"pct"),e.writeAttributeString(void 0,"w",this.wNamespace,this.roundToTwoDecimal(t.preferredWidth*this.percentageFactor).toString())):"Auto"===t.preferredWidthType?(e.writeAttributeString(void 0,"type",this.wNamespace,"auto"),e.writeAttributeString(void 0,"w",this.wNamespace,"0")):(e.writeAttributeString(void 0,"w",this.wNamespace,this.roundToTwoDecimal(t.preferredWidth*this.twipsInOnePoint).toString()),e.writeAttributeString(void 0,"type",this.wNamespace,"dxa")),e.writeEndElement()},e.prototype.serializeCellMerge=function(e,t,i){var n,r=this.blockOwner,o=!1,s=r.columnIndex,a=this.row.cells.indexOf(r),l=a>0?this.row.cells[a-1].columnIndex:r.columnIndex;if(r.columnIndex===a?(n=r.columnIndex,o=!0):o=!1,!o){0===a&&(s=r.columnIndex,l=-1);for(var d=l;d<s;d++)n=l+1,l+=1,0===n&&i.containsKey(n)&&(i=this.createMerge(e,n,r,i))}return t.rowSpan>1?(e.writeStartElement(void 0,"vMerge",this.wNamespace),this.spanCellFormat=t,i.add(n,t.rowSpan-1),t.columnSpan>1&&this.mGridSpans.add(n,t.columnSpan),e.writeAttributeString("w","val",this.wNamespace,"restart"),e.writeEndElement()):i.containsKey(n)&&o&&(i=this.createMerge(e,n,r,i)),i},e.prototype.createMerge=function(e,t,i,n){return this.serializeColumnSpan(t,e),e.writeStartElement(void 0,"vMerge",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,"continue"),e.writeEndElement(),e.writeStartElement(void 0,"tcBorders",this.wNamespace),this.serializeBorders(e,i.cellFormat.borders,8),e.writeEndElement(),e.writeEndElement(),e.writeStartElement("w","p",this.wNamespace),e.writeEndElement(),e.writeEndElement(),e.writeStartElement(void 0,"tc",this.wNamespace),e.writeStartElement(void 0,"tcPr",this.wNamespace),this.serializeCellWidth(e,i.cellFormat),n=this.checkMergeCell(t,n)},e.prototype.serializeColumnSpan=function(e,t){this.mGridSpans.keys.length>0&&this.mGridSpans.containsKey(e)&&(t.writeStartElement(void 0,"gridSpan",this.wNamespace),t.writeAttributeString("w","val",this.wNamespace,this.mGridSpans.get(e).toString()),t.writeEndElement())},e.prototype.checkMergeCell=function(e,t){return t.get(e)-1==0?(t.remove(e),this.spanCellFormat=void 0,this.mGridSpans.keys.length>0&&this.mGridSpans.containsKey(e)&&this.mGridSpans.remove(e)):t.set(e,t.get(e)-1),t},e.prototype.serializeGridSpan=function(e,t){if(t.cellFormat.columnSpan>1){var i=t.cellFormat.columnSpan;e.writeStartElement(void 0,"gridSpan",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,i.toString()),e.writeEndElement()}},e.prototype.serializeTableCellDirection=function(e,t){},e.prototype.serializeCellVerticalAlign=function(e,t){switch(e.writeStartElement(void 0,"vAlign",this.wNamespace),t){case"Center":e.writeAttributeString("w","val",this.wNamespace,"center");break;case"Bottom":e.writeAttributeString("w","val",this.wNamespace,"bottom");break;default:e.writeAttributeString("w","val",this.wNamespace,"top")}e.writeEndElement()},e.prototype.serializeGridColumns=function(e,t){for(var i=0,n=t.length;i<n;i++){var r=Math.round(20*t[i]);e.writeStartElement(void 0,"gridCol",this.wNamespace),e.writeAttributeString(void 0,"w",this.wNamespace,r.toString()),e.writeEndElement()}},e.prototype.serializeTableFormat=function(e,i,n){e.writeStartElement(void 0,"tblPr",this.wNamespace),this.serializeTableWidth(e,n),this.serializeTableAlignment(e,n.tableFormat),this.serializeCellSpacing(e,n.tableFormat),this.serializeTableIndentation(e,n.tableFormat),this.serializeTableMargins(e,n.tableFormat),this.serializeTableBorders(e,n.tableFormat),this.serializeShading(e,n.tableFormat.shading),n.tableFormat.bidi&&(e.writeStartElement(void 0,"bidiVisual",this.wNamespace),e.writeEndElement()),this.serializeTblLayout(e,n.tableFormat),t.isNullOrUndefined(n)||e.writeEndElement()},e.prototype.serializeTableMargins=function(e,t){this.serializeMargins(e,t,"tblCellMar")},e.prototype.serializeRowMargins=function(e,t){e.writeStartElement(void 0,"tblPrEx",this.wNamespace),this.serializeMargins(e,t,"tblCellMar"),e.writeEndElement()},e.prototype.serializeCellMargins=function(e,t){this.serializeMargins(e,t,"tcMar")},e.prototype.serializeMargins=function(e,i,n){if(e.writeStartElement(void 0,n,this.wNamespace),!t.isNullOrUndefined(i.topMargin)){var r=Math.round(20*i.topMargin);e.writeStartElement(void 0,"top",this.wNamespace),e.writeAttributeString(void 0,"w",this.wNamespace,r.toString()),e.writeAttributeString(void 0,"type",this.wNamespace,"dxa"),e.writeEndElement()}if(!t.isNullOrUndefined(i.leftMargin)){var o=Math.round(20*i.leftMargin);e.writeStartElement(void 0,"left",this.wNamespace),e.writeAttributeString(void 0,"w",this.wNamespace,o.toString()),e.writeAttributeString(void 0,"type",this.wNamespace,"dxa"),e.writeEndElement()}if(!t.isNullOrUndefined(i.bottomMargin)){var s=Math.round(20*i.bottomMargin);e.writeStartElement(void 0,"bottom",this.wNamespace),e.writeAttributeString(void 0,"w",this.wNamespace,s.toString()),e.writeAttributeString(void 0,"type",this.wNamespace,"dxa"),e.writeEndElement()}if(!t.isNullOrUndefined(i.rightMargin)){var a=Math.round(20*i.rightMargin);e.writeStartElement(void 0,"right",this.wNamespace),e.writeAttributeString(void 0,"w",this.wNamespace,a.toString()),e.writeAttributeString(void 0,"type",this.wNamespace,"dxa"),e.writeEndElement()}e.writeEndElement()},e.prototype.serializeShading=function(e,i){e.writeStartElement(void 0,"shd",this.wNamespace),i.backgroundColor&&e.writeAttributeString(void 0,"fill",this.wNamespace,this.getColor(i.backgroundColor)),"empty"===i.foregroundColor||t.isNullOrUndefined(i.foregroundColor)?e.writeAttributeString(void 0,"color",this.wNamespace,"auto"):e.writeAttributeString(void 0,"color",this.wNamespace,this.getColor(i.foregroundColor)),t.isNullOrUndefined(i.textureStyle)||e.writeAttributeString("w","val",this.wNamespace,this.getTextureStyle(i.textureStyle)),e.writeEndElement()},e.prototype.getTextureStyle=function(e){switch(e){case"Texture5Percent":case"Texture2Pt5Percent":case"Texture7Pt5Percent":return"pct5";case"Texture10Percent":return"pct10";case"Texture12Pt5Percent":return"pct12";case"Texture15Percent":case"Texture17Pt5Percent":return"pct15";case"Texture20Percent":case"Texture22Pt5Percent":return"pct20";case"Texture25Percent":case"Texture27Pt5Percent":return"pct25";case"Texture30Percent":case"Texture32Pt5Percent":return"pct30";case"Texture35Percent":return"pct35";case"Texture37Pt5Percent":return"pct37";case"Texture40Percent":case"Texture42Pt5Percent":return"pct40";case"Texture45Percent":case"Texture47Pt5Percent":return"pct45";case"Texture50Percent":case"Texture52Pt5Percent":return"pct50";case"Texture55Percent":case"Texture57Pt5Percent":return"pct55";case"Texture60Percent":return"pct60";case"Texture62Pt5Percent":return"pct62";case"Texture65Percent":case"Texture67Pt5Percent":return"pct65";case"Texture70Percent":case"Texture72Pt5Percent":return"pct70";case"Texture75Percent":case"Texture77Pt5Percent":return"pct75";case"Texture80Percent":case"Texture82Pt5Percent":return"pct80";case"Texture85Percent":return"pct85";case"Texture87Pt5Percent":return"pct87";case"Texture90Percent":case"Texture92Pt5Percent":return"pct90";case"Texture95Percent":case"Texture97Pt5Percent":return"pct95";case"TextureCross":return"thinHorzCross";case"TextureDarkCross":return"horzCross";case"TextureDarkDiagonalCross":return"diagCross";case"TextureDarkDiagonalDown":return"reverseDiagStripe";case"TextureDarkDiagonalUp":return"diagStripe";case"TextureDarkHorizontal":return"horzStripe";case"TextureDarkVertical":return"vertStripe";case"TextureDiagonalCross":return"thinDiagCross";case"TextureDiagonalDown":return"thinReverseDiagStripe";case"TextureDiagonalUp":return"thinDiagStripe";case"TextureHorizontal":return"thinHorzStripe";case"TextureSolid":return"solid";case"TextureVertical":return"thinVertStripe";default:return"clear"}},e.prototype.serializeTableBorders=function(e,t){t.borders;e.writeStartElement(void 0,"tblBorders",this.wNamespace),this.serializeBorders(e,t.borders,8),e.writeEndElement()},e.prototype.serializeBorders=function(e,t,i){this.serializeBorder(e,t.top,"top",i),this.serializeBorder(e,t.left,"left",i),this.serializeBorder(e,t.bottom,"bottom",i),this.serializeBorder(e,t.right,"right",i),this.serializeBorder(e,t.horizontal,"insideH",i),this.serializeBorder(e,t.vertical,"insideV",i),this.serializeBorder(e,t.diagonalDown,"tl2br",i),this.serializeBorder(e,t.diagonalUp,"tr2bl",i)},e.prototype.serializeTblLayout=function(e,t){t.allowAutoFit||(e.writeStartElement(void 0,"tblLayout",this.wNamespace),e.writeAttributeString(void 0,"type",this.wNamespace,"fixed"),e.writeEndElement())},e.prototype.serializeBorder=function(e,i,n,r){var o=i.lineStyle,s=(i.lineWidth?i.lineWidth:0)*r,a=i.space?i.space:0;if("Cleared"===o)return e.writeStartElement(void 0,n,this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,"nil"),void e.writeEndElement();("None"===o||t.isNullOrUndefined(o))&&!i.hasNoneStyle||s<=0||(e.writeStartElement(void 0,n,this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,this.getBorderStyle(o)),i.color&&e.writeAttributeString(void 0,"color",this.wNamespace,this.getColor(i.color)),e.writeAttributeString(void 0,"sz",this.wNamespace,this.roundToTwoDecimal(s).toString()),e.writeAttributeString(void 0,"space",this.wNamespace,a.toString()),i.shadow&&e.writeAttributeString(void 0,"shadow",this.wNamespace,"on"),e.writeEndElement())},e.prototype.getBorderStyle=function(e){switch(e){case"Cleared":return"cleared";case"DashSmallGap":return"dashSmallGap";case"Triple":return"triple";case"Dot":return"dotted";case"DashDot":return"dotDash";case"DashLargeGap":return"dashed";case"DashDotDot":return"dotDotDash";case"Double":return"double";case"ThinThickSmallGap":return"thinThickSmallGap";case"ThickThinSmallGap":return"thickThinSmallGap";case"ThinThickThinSmallGap":return"thinThickThinSmallGap";case"ThickThinMediumGap":return"thickThinMediumGap";case"ThinThickMediumGap":return"thinThickMediumGap";case"ThinThickThinMediumGap":return"thinThickThinMediumGap";case"ThickThinLargeGap":return"thickThinLargeGap";case"ThinThickLargeGap":return"thinThickLargeGap";case"ThinThickThinLargeGap":return"thinThickThinLargeGap";case"Thick":return"thick";case"SingleWavy":return"wave";case"DoubleWavy":return"doubleWave";case"DashDotStroked":return"dashDotStroked";case"Engrave3D":return"threeDEngrave";case"Emboss3D":return"threeDEmboss";case"Outset":return"outset";case"Inset":return"inset";default:return"single"}},e.prototype.serializeTableIndentation=function(e,i){if(!t.isNullOrUndefined(i.leftIndent)){e.writeStartElement(void 0,"tblInd",this.wNamespace);var n=Math.round(i.leftIndent*this.twipsInOnePoint);e.writeAttributeString(void 0,"w",this.wNamespace,n.toString()),e.writeAttributeString(void 0,"type",this.wNamespace,"dxa"),e.writeEndElement()}},e.prototype.serializeCellSpacing=function(e,i){!t.isNullOrUndefined(i.cellSpacing)&&i.cellSpacing>0&&(e.writeStartElement(void 0,"tblCellSpacing",this.wNamespace),e.writeAttributeString(void 0,"w",this.wNamespace,this.roundToTwoDecimal(i.cellSpacing/2*this.twentiethOfPoint).toString()),e.writeAttributeString(void 0,"type",this.wNamespace,"dxa"),e.writeEndElement())},e.prototype.serializeTableWidth=function(e,t){if(e.writeStartElement(void 0,"tblW",this.wNamespace),"Percent"===t.tableFormat.preferredWidthType)e.writeAttributeString(void 0,"w",this.wNamespace,(t.tableFormat.preferredWidth*this.percentageFactor).toString()),e.writeAttributeString(void 0,"type",this.wNamespace,"pct");else if("Point"===t.tableFormat.preferredWidthType){var i=Math.round(t.tableFormat.preferredWidth*this.twipsInOnePoint);e.writeAttributeString(void 0,"w",this.wNamespace,i.toString()),e.writeAttributeString(void 0,"type",this.wNamespace,"dxa")}else e.writeAttributeString(void 0,"w",this.wNamespace,"0"),e.writeAttributeString(void 0,"type",this.wNamespace,"auto");e.writeEndElement()},e.prototype.serializeTableAlignment=function(e,t){switch(e.writeStartElement(void 0,"jc",this.wNamespace),t.tableAlignment){case"Right":e.writeAttributeString("w","val",this.wNamespace,"right");break;case"Center":e.writeAttributeString("w","val",this.wNamespace,"center");break;default:e.writeAttributeString("w","val",this.wNamespace,"left")}e.writeEndElement()},e.prototype.serializeFieldCharacter=function(e,i){e.writeStartElement(void 0,"r",this.wNamespace),this.serializeCharacterFormat(e,i.characterFormat),e.writeStartElement(void 0,"fldChar",this.wNamespace);var n=0===i.fieldType?"begin":1===i.fieldType?"end":"separate";if(e.writeAttributeString(void 0,"fldCharType",this.wNamespace,n),"begin"===n&&!t.isNullOrUndefined(i.formFieldData)){var r=i.formFieldData;if(e.writeStartElement(void 0,"ffData",this.wNamespace),e.writeStartElement(void 0,"name",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,r.name),e.writeEndElement(),e.writeStartElement(void 0,"enabled",this.wNamespace),e.writeEndElement(),r.hasOwnProperty("textInput")){e.writeStartElement(void 0,"textInput",this.wNamespace);r.textInput.type;e.writeStartElement(void 0,"type",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,r.textInput.type.toString().toLowerCase()),e.writeEndElement(),e.writeStartElement(void 0,"defalut",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,r.textInput.defaultValue),e.writeEndElement(),e.writeStartElement(void 0,"format",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,r.textInput.format),e.writeEndElement(),e.writeEndElement()}else if(r.hasOwnProperty("checkBox"))e.writeStartElement(void 0,"checkBox",this.wNamespace),"Auto"===r.checkBox.sizeType?(e.writeStartElement(void 0,"sizeAuto",this.wNamespace),e.writeEndElement()):(e.writeStartElement(void 0,"size",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,this.roundToTwoDecimal(2*r.checkBox.size).toString()),e.writeEndElement()),e.writeStartElement(void 0,"defalut",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,r.checkBox.defaultValue?"1":"0"),e.writeEndElement(),r.checkBox.checked&&(e.writeStartElement(void 0,"checked",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,r.checkBox.checked?"1":"0"),e.writeEndElement()),e.writeEndElement();else{e.writeStartElement(void 0,"ddList",this.wNamespace),0!==r.dropDownList.selectedIndex&&(e.writeStartElement(void 0,"result",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,r.dropDownList.selectedIndex.toString()),e.writeEndElement());for(var o=0;o<r.dropDownList.dropDownItems.length;o++)e.writeStartElement(void 0,"listEntry",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,r.dropDownList.dropDownItems[o].toString()),e.writeEndElement();e.writeEndElement()}e.writeEndElement()}e.writeEndElement(),e.writeEndElement(),0===i.fieldType&&"FieldFormTextInput"===i.fieldCodeType&&(e.writeStartElement("w","r",this.wNamespace),e.writeStartElement(void 0,"instrText",this.wNamespace),e.writeAttributeString("xml","space",this.xmlNamespace,"preserve"),e.writeString("FORMTEXT"),e.writeEndElement(),e.writeEndElement())},e.prototype.serializeTextRange=function(e,i,n,r){if(e.writeStartElement("w","r",this.wNamespace),t.isNullOrUndefined(i.characterFormat)||this.serializeCharacterFormat(e,i.characterFormat),"\t"===i.text)e.writeElementString(void 0,"tab",this.wNamespace,void 0);else if("\v"===i.text)e.writeElementString(void 0,"br",this.wNamespace,void 0);else if("\f"===i.text)e.writeStartElement(void 0,"br",this.wNamespace),e.writeAttributeString("w","type",this.wNamespace,"page"),e.writeEndElement();else if("%02"===encodeURI(i.text))e.writeStartElement(void 0,"footnoteRef",this.wNamespace),e.writeEndElement();else if("%02"===encodeURI(i.text)&&"endnote"===r)e.writeStartElement(void 0,"endnoteRef",this.wNamespace),e.writeEndElement();else if("%03"===encodeURI(i.text))e.writeStartElement(void 0,"separator",this.wNamespace),e.writeEndElement();else if("%04"===encodeURI(i.text))e.writeStartElement(void 0,"continuationSeparator",this.wNamespace),e.writeEndElement();else{var o=this.retrieveDeleteRevision(i),s=!t.isNullOrUndefined(n)&&n.hasOwnProperty("fieldType")&&2!==n.fieldType?o?"delInstrText":"instrText":o?"delText":"t";e.writeStartElement(void 0,s,this.wNamespace),e.writeAttributeString("xml","space",this.xmlNamespace,"preserve"),e.writeString(i.text),e.writeEndElement()}e.writeEndElement()},e.prototype.retrieveDeleteRevision=function(e){if(e.hasOwnProperty("revisionIds")&&e.revisionIds.length>0)for(var t=0;t<e.revisionIds.length;t++)if("Deletion"===this.retrieveRevision(e.revisionIds[t]).revisionType)return!0;return!1},e.prototype.serializeParagraphFormat=function(e,i,n){t.isNullOrUndefined(i)||(t.isNullOrUndefined(i.styleName)||(e.writeStartElement(void 0,"pStyle",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,i.styleName),e.writeEndElement()),t.isNullOrUndefined(n)?this.serializeListFormat(e,i.listFormat):this.serializeListFormat(e,n.paragraphFormat.listFormat),i.bidi&&(e.writeStartElement(void 0,"bidi",this.wNamespace),e.writeEndElement()),t.isNullOrUndefined(i.outlineLevel)||(e.writeStartElement(void 0,"outlineLvl",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,this.getOutlineLevelValue(i.outlineLevel).toString()),e.writeEndElement()),this.serializeParagraphSpacing(e,i),t.isNullOrUndefined(i.contextualSpacing)||(e.writeStartElement("w","contextualSpacing",this.wNamespace),i.contextualSpacing||e.writeAttributeString("w","val",this.wNamespace,"0"),e.writeEndElement()),this.serializeIndentation(e,i),this.serializeParagraphAlignment(e,i.textAlignment,i.bidi),!t.isNullOrUndefined(i.tabs)&&i.tabs.length>0&&this.serializeTabs(e,i.tabs))},e.prototype.getOutlineLevelValue=function(e){if(-1!==e.indexOf("Level")){var t=parseInt(e.substring(5),10);if(t>0)return t-1}return 9},e.prototype.serializeTabs=function(e,t){e.writeStartElement("w","tabs",this.wNamespace);for(var i=0;i<t.length;i++)this.serializeTab(e,t[i]);e.writeEndElement()},e.prototype.serializeTab=function(e,i){var n=0;e.writeStartElement("w","tab",this.wNamespace),0===i.position&&0!==i.deletePosition?(n=i.deletePosition*this.twentiethOfPoint,e.writeAttributeString("w","val",this.wNamespace,"clear")):(n=i.position*this.twentiethOfPoint,e.writeAttributeString("w","val",this.wNamespace,this.getTabJustification(i.tabJustification))),t.isNullOrUndefined(i.tabLeader)||"None"===i.tabLeader||e.writeAttributeString("w","leader",this.wNamespace,this.getTabLeader(i.tabLeader)),isNaN(n)||e.writeAttributeString("w","pos",this.wNamespace,n.toString()+""),e.writeEndElement()},e.prototype.getTabLeader=function(e){switch(e){case"Dot":return"dot";case"Hyphen":return"hyphen";case"Underscore":return"underscore";default:return"none"}},e.prototype.getTabJustification=function(e){switch(e){case"Bar":return"bar";case"Center":return"center";case"Decimal":return"decimal";case"Left":return"left";case"List":return"num";case"Right":return"right";default:return"clear"}},e.prototype.serializeListFormat=function(e,i){if(!t.isNullOrUndefined(i.listId)||!t.isNullOrUndefined(i.listLevelNumber)){if(e.writeStartElement(void 0,"numPr",this.wNamespace),t.isNullOrUndefined(i.listLevelNumber)||-1===i.listLevelNumber||(e.writeStartElement(void 0,"ilvl",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,i.listLevelNumber.toString()),e.writeEndElement()),!t.isNullOrUndefined(i.listId)){e.writeStartElement(void 0,"numId",this.wNamespace);var n=(i.listId+1).toString();-1===i.listId&&(n=""),e.writeAttributeString("w","val",this.wNamespace,n),e.writeEndElement()}e.writeEndElement()}},e.prototype.serializeParagraphAlignment=function(e,i,n){if(n&&("Right"===i?i="Left":"Left"===i&&(i="Right")),!t.isNullOrUndefined(i)){e.writeStartElement(void 0,"jc",this.wNamespace);var r=void 0;switch(i){case"Center":r="center";break;case"Right":r="right";break;case"Justify":r="both";break;default:r="left"}e.writeAttributeString("w","val",this.wNamespace,r),e.writeEndElement()}},e.prototype.serializeParagraphSpacing=function(e,i){if(e.writeStartElement(void 0,"spacing",this.wNamespace),t.isNullOrUndefined(i.beforeSpacing)||e.writeAttributeString(void 0,"before",this.wNamespace,this.roundToTwoDecimal(i.beforeSpacing*this.twentiethOfPoint).toString()),t.isNullOrUndefined(i.afterSpacing)||e.writeAttributeString(void 0,"after",this.wNamespace,this.roundToTwoDecimal(i.afterSpacing*this.twentiethOfPoint).toString()),!t.isNullOrUndefined(i.lineSpacing)){var n="AtLeast"===i.lineSpacingType||"Exactly"===i.lineSpacingType?this.roundToTwoDecimal(i.lineSpacing*this.twentiethOfPoint):this.roundToTwoDecimal(240*i.lineSpacing);e.writeAttributeString(void 0,"line",this.wNamespace,n.toString())}if(!t.isNullOrUndefined(i.lineSpacingType)){var r="auto";"AtLeast"===i.lineSpacingType?r="atLeast":"Exactly"===i.lineSpacingType&&(r="exact"),e.writeAttributeString(void 0,"lineRule",this.wNamespace,r)}e.writeEndElement()},e.prototype.serializeIndentation=function(e,i){e.writeStartElement(void 0,"ind",this.wNamespace),t.isNullOrUndefined(i.leftIndent)||e.writeAttributeString(void 0,"left",this.wNamespace,this.roundToTwoDecimal(i.leftIndent*this.twipsInOnePoint).toString()),t.isNullOrUndefined(i.rightIndent)||e.writeAttributeString(void 0,"right",this.wNamespace,this.roundToTwoDecimal(i.rightIndent*this.twipsInOnePoint).toString()),t.isNullOrUndefined(i.firstLineIndent)||(i.firstLineIndent<0?e.writeAttributeString(void 0,"hanging",this.wNamespace,this.roundToTwoDecimal(-1*i.firstLineIndent*this.twipsInOnePoint).toString()):e.writeAttributeString(void 0,"firstLine",this.wNamespace,this.roundToTwoDecimal(i.firstLineIndent*this.twipsInOnePoint).toString())),e.writeEndElement()},e.prototype.serializeCustomXMLMapping=function(e,t){if(e.length>0)for(var i=e.keys,n=0;n<i.length;n++){var r=new p.XmlWriter;r.writeStartElement(void 0,"Relationships",this.rpNamespace);var o=this.mCustomXML.get(i[n]),s=i[n],a=this.getNextRelationShipID(),l=n+1,d=this.createXMLItem(o,a,l),h=this.createXMLItemProps(s,l);this.serializeRelationShip(t,a,this.customXmlRelType,"../"+d),this.customXMLRelation(r,l,h),r.writeEndElement();var u=new c.ZipArchiveItem(r.buffer,this.customXMLRelPath+l+".xml.rels");this.mArchive.addItem(u)}},e.prototype.customXMLRelation=function(e,t,i){this.serializeRelationShip(e,"rId1",this.wordMLCustomXmlPropsRelType,i)},e.prototype.createXMLItem=function(e,t,i){var n=new Blob([e],{type:"text/plain"}),r=this.customXMLItemsPath+i+".xml",o=new c.ZipArchiveItem(n,r);return this.mArchive.addItem(o),r},e.prototype.createXMLItemProps=function(e,t){var i=new p.XmlWriter,n=this.customXMLItemsPropspath+t+".xml",r=this.itemPropsPath+t+".xml";i.writeStartElement("ds","datastoreItem",this.wNamespace),i.writeAttributeString("ds","itemID",void 0,e),i.writeAttributeString("xmlns","ds",void 0,this.dsNamespace),i.writeEndElement(),this.customXMLProps.push(n);var o=new c.ZipArchiveItem(i.buffer,n);return this.mArchive.addItem(o),r},e.prototype.serializeStyles=function(){var e=new p.XmlWriter;e.writeStartElement("w","styles",this.wNamespace),e.writeAttributeString("xmlns","mc",void 0,this.veNamespace),e.writeAttributeString("xmlns","r",void 0,this.rNamespace),e.writeAttributeString("xmlns","w",void 0,this.wNamespace),e.writeAttributeString("xmlns","w14",void 0,this.w14Namespace),e.writeAttributeString("xmlns","w15",void 0,this.w15Namespace),e.writeAttributeString("mc","Ignorable",void 0,"w14 w15"),this.serializeDefaultStyles(e),this.serializeDocumentStyles(e),e.writeEndElement();var t=new c.ZipArchiveItem(e.buffer,this.stylePath);this.mArchive.addItem(t)},e.prototype.serializeDefaultStyles=function(e){e.writeStartElement(void 0,"docDefaults",this.wNamespace),e.writeStartElement(void 0,"rPrDefault",this.wNamespace),this.serializeCharacterFormat(e,this.defCharacterFormat),e.writeEndElement(),e.writeStartElement(void 0,"pPrDefault",this.wNamespace),t.isNullOrUndefined(this.defParagraphFormat)||(e.writeStartElement(void 0,"pPr",this.wNamespace),this.serializeParagraphFormat(e,this.defParagraphFormat,void 0),e.writeEndElement()),e.writeEndElement(),e.writeEndElement()},e.prototype.serializeDocumentStyles=function(e){for(var i=0;i<this.mStyles.length;i++){var n=this.mStyles[i];e.writeStartElement(void 0,"style",this.wNamespace);var r="Paragraph"===n.type?"paragraph":"character";e.writeAttributeString("w","type",this.wNamespace,r),e.writeAttributeString("w","styleId",this.wNamespace,n.name),e.writeStartElement(void 0,"name",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,n.name),e.writeEndElement(),t.isNullOrUndefined(n.basedOn)||(e.writeStartElement(void 0,"basedOn",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,n.basedOn),e.writeEndElement()),t.isNullOrUndefined(n.next)||(e.writeStartElement(void 0,"next",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,n.next),e.writeEndElement()),t.isNullOrUndefined(n.link)||(e.writeStartElement(void 0,"link",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,n.link),e.writeEndElement()),"Paragraph"===n.type&&(e.writeStartElement(void 0,"pPr",this.wNamespace),this.serializeParagraphFormat(e,n.paragraphFormat,void 0),e.writeEndElement()),this.serializeCharacterFormat(e,n.characterFormat),e.writeEndElement()}},e.prototype.serializeCharacterFormat=function(e,i){if(e.writeStartElement(void 0,"rPr",this.wNamespace),t.isNullOrUndefined(i.styleName)||(e.writeStartElement(void 0,"rStyle",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,i.styleName),e.writeEndElement()),t.isNullOrUndefined(i.fontFamily)||(e.writeStartElement(void 0,"rFonts",this.wNamespace),e.writeAttributeString(void 0,"ascii",this.wNamespace,i.fontFamily),e.writeAttributeString(void 0,"hAnsi",this.wNamespace,i.fontFamily),e.writeAttributeString(void 0,"eastAsia",this.wNamespace,i.fontFamily),e.writeAttributeString(void 0,"cs",this.wNamespace,i.fontFamilyBidi),e.writeEndElement()),t.isNullOrUndefined(i.bold)||this.serializeBoolProperty(e,"b",i.bold),i.boldBidi&&this.serializeBoolProperty(e,"bCs",i.boldBidi),t.isNullOrUndefined(i.italic)||this.serializeBoolProperty(e,"i",i.italic),t.isNullOrUndefined(i.italicBidi)||this.serializeBoolProperty(e,"iCs",i.italicBidi),i.bidi&&(e.writeStartElement(void 0,"rtl",this.wNamespace),e.writeEndElement()),i.allCaps&&this.serializeBoolProperty(e,"caps",i.allCaps),!t.isNullOrUndefined(i.strikethrough))switch(i.strikethrough){case"SingleStrike":this.serializeBoolProperty(e,"strike",!0);break;case"DoubleStrike":this.serializeBoolProperty(e,"dstrike",!0);break;default:this.serializeBoolProperty(e,"strike",!1),this.serializeBoolProperty(e,"dstrike",!1)}if(t.isNullOrUndefined(i.fontColor)||(e.writeStartElement(void 0,"color",this.wNamespace),"empty"===i.fontColor?e.writeAttributeString("w","val",this.wNamespace,"auto"):e.writeAttributeString("w","val",this.wNamespace,this.getColor(i.fontColor)),e.writeEndElement()),t.isNullOrUndefined(i.fontSize)||(e.writeStartElement(void 0,"sz",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,this.roundToTwoDecimal(2*i.fontSize).toString()),e.writeEndElement()),t.isNullOrUndefined(i.fontSizeBidi)||(e.writeStartElement(void 0,"szCs",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,this.roundToTwoDecimal(2*i.fontSizeBidi).toString()),e.writeEndElement()),t.isNullOrUndefined(i.highlightColor)||"NoColor"===i.highlightColor||(e.writeStartElement(void 0,"highlight",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,this.getHighlightColor(i.highlightColor)),e.writeEndElement()),!t.isNullOrUndefined(i.revisionIds)&&i.revisionIds.length>0&&(this.serializeRevisionStart(e,i,void 0),this.serializeRevisionEnd(e,i,void 0)),t.isNullOrUndefined(i.underline)||"None"===i.underline||(e.writeStartElement(void 0,"u",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,this.getUnderlineStyle(i.underline)),e.writeEndElement()),!t.isNullOrUndefined(i.baselineAlignment)){switch(e.writeStartElement(void 0,"vertAlign",this.wNamespace),i.baselineAlignment){case"Subscript":e.writeAttributeString("w","val",this.wNamespace,"subscript");break;case"Superscript":e.writeAttributeString("w","val",this.wNamespace,"superscript");break;default:e.writeAttributeString("w","val",this.wNamespace,"baseline")}e.writeEndElement()}e.writeEndElement()},e.prototype.getColor=function(e){return e.length>0&&("#"===e[0]&&(e=e.substr(1)),e.length>6&&(e=e.substr(0,6))),e},e.prototype.getUnderlineStyle=function(e){switch(e){case"DotDotDashHeavy":return"dashDotDotHeavy";case"DotDashHeavy":return"dashDotHeavy";case"DashHeavy":return"dashedHeavy";case"DashLong":return"dashLong";case"DashLongHeavy":return"dashLongHeavy";case"DotDash":return"dotDash";case"DotDotDash":return"dotDotDash";case"Dotted":return"dotted";case"DottedHeavy":return"dottedHeavy";case"Double":return"double";case"Single":return"single";case"Thick":return"thick";case"Wavy":return"wave";case"WavyDouble":return"wavyDouble";case"WavyHeavy":return"wavyHeavy";case"Words":return"words";default:return"dash"}},e.prototype.getHighlightColor=function(e){switch(e){case"BrightGreen":return"green";case"Turquoise":return"cyan";case"Pink":return"magenta";case"Blue":return"blue";case"Red":return"red";case"DarkBlue":return"darkBlue";case"Teal":return"darkCyan";case"Green":return"darkGreen";case"Violet":return"darkMagenta";case"DarkRed":return"darkRed";case"DarkYellow":return"darkYellow";case"Gray50":return"darkGray";case"Gray25":return"lightGray";case"Black":return"black";default:return"yellow"}},e.prototype.serializeBoolProperty=function(e,t,i){e.writeStartElement(void 0,t,this.wNamespace),i||e.writeAttributeString(void 0,"val",this.wNamespace,"0"),e.writeEndElement()},e.prototype.serializeNumberings=function(){if(0!==this.document.lists.length){var e=new p.XmlWriter;e.writeStartElement("w","numbering",this.wNamespace),this.writeCommonAttributeStrings(e),this.serializeAbstractListStyles(e,this.document.abstractLists),this.serializeListInstances(e,this.document.lists),e.writeEndElement();var t=new c.ZipArchiveItem(e.buffer,this.numberingPath);this.mArchive.addItem(t)}},e.prototype.serializeAbstractListStyles=function(e,t){for(var i=0;i<t.length;i++){var n=t[i];e.writeStartElement(void 0,"abstractNum",this.wNamespace),e.writeAttributeString(void 0,"abstractNumId",this.wNamespace,n.abstractListId.toString()),e.writeStartElement(void 0,"nsid",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,this.generateHex()),e.writeEndElement();for(var r=0,o=n.levels.length;r<o;r++)this.serializeListLevel(e,n.levels[r],r);e.writeEndElement()}},e.prototype.serializeListInstances=function(e,t){for(var i=0;i<t.length;i++){var n=t[i];e.writeStartElement(void 0,"num",this.wNamespace),e.writeAttributeString(void 0,"numId",this.wNamespace,(n.listId+1).toString()),e.writeStartElement(void 0,"abstractNumId",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,n.abstractListId.toString()),e.writeEndElement(),e.writeEndElement()}},e.prototype.generateHex=function(){return(Math.floor(373e7*Math.random())+27e7).toString(16).toUpperCase()},e.prototype.roundToTwoDecimal=function(e){return Math.round(e)},e.prototype.serializeListLevel=function(e,t,i){e.writeStartElement(void 0,"lvl",this.wNamespace),e.writeAttributeString(void 0,"ilvl",this.wNamespace,i.toString()),e.writeStartElement(void 0,"start",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,t.startAt.toString()),e.writeEndElement(),e.writeStartElement(void 0,"numFmt",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,this.getLevelPattern(t.listLevelPattern)),e.writeEndElement(),this.serializeLevelFollow(e,t),this.serializeLevelText(e,t,i+1),e.writeStartElement(void 0,"pPr",this.wNamespace),this.serializeParagraphFormat(e,t.paragraphFormat,void 0),e.writeEndElement(),this.serializeCharacterFormat(e,t.characterFormat),e.writeEndElement()},e.prototype.getLevelPattern=function(e){var t;switch(e){case"Arabic":t="decimal";break;case"UpRoman":t="upperRoman";break;case"LowRoman":t="lowerRoman";break;case"UpLetter":t="upperLetter";break;case"LowLetter":t="lowerLetter";break;default:t="bullet"}return t},e.prototype.serializeLevelText=function(e,t,i){e.writeStartElement(void 0,"lvlText",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,t.numberFormat),e.writeEndElement()},e.prototype.serializeLevelFollow=function(e,t){var i;i="Tab"===t.followCharacter?"tab":"Space"===t.followCharacter?"space":"nothing",e.writeStartElement(void 0,"suff",this.wNamespace),e.writeAttributeString(void 0,"val",this.wNamespace,i),e.writeEndElement()},e.prototype.serializeDocumentProtectionSettings=function(e){if(e.writeStartElement("w","documentProtection",this.wNamespace),this.formatting&&e.writeAttributeString("w","formatting",this.wNamespace,"1"),this.protectionType&&"NoProtection"!==this.protectionType){var t="ReadOnly"===this.protectionType?"readOnly":"forms";e.writeAttributeString("w","edit",this.wNamespace,t)}e.writeAttributeString("w","cryptProviderType",this.wNamespace,"rsaAES"),e.writeAttributeString("w","cryptAlgorithmClass",this.wNamespace,"hash"),e.writeAttributeString("w","cryptAlgorithmType",this.wNamespace,"typeAny"),e.writeAttributeString("w","cryptAlgorithmSid",this.wNamespace,"14"),e.writeAttributeString("w","cryptSpinCount",this.wNamespace,"100000"),this.enforcement&&e.writeAttributeString("w","enforcement",this.wNamespace,"1"),this.hashValue&&e.writeAttributeString("w","hash",this.wNamespace,this.hashValue),this.saltValue&&e.writeAttributeString("w","salt",this.wNamespace,this.saltValue),e.writeEndElement()},e.prototype.serializeSettings=function(){var e=new p.XmlWriter;e.writeStartElement("w","settings",this.wNamespace),this.writeCustom(e),e.writeAttributeString("xmlns","w10",void 0,this.w10Namespace),e.writeAttributeString("xmlns","w14",void 0,this.w14Namespace),e.writeAttributeString("xmlns","w15",void 0,this.w15Namespace),e.writeAttributeString("xmlns","sl",void 0,this.slNamespace),e.writeAttributeString("mc","Ignorable",void 0,"w14 w15"),this.serializeDocumentProtectionSettings(e),e.writeStartElement("w","zoom",this.wNamespace),e.writeAttributeString("w","val",this.wNamespace,"none"),e.writeAttributeString("w","percent",this.wNamespace,"100"),e.writeEndElement(),e.writeStartElement(void 0,"displayBackgroundShape",this.wNamespace),e.writeEndElement(),e.writeStartElement(void 0,"defaultTabStop",this.wNamespace);var t=Math.round(this.defaultTabWidthValue*this.twipsInOnePoint);e.writeAttributeString(void 0,"val",this.wNamespace,t.toString()),e.writeEndElement(),this.trackChanges&&(e.writeStartElement(void 0,"trackRevisions",this.wNamespace),e.writeEndElement()),this.mDifferentFirstPage&&(e.writeStartElement(void 0,"evenAndOddHeaders",this.wNamespace),e.writeEndElement()),this.formFieldShading||(e.writeStartElement(void 0,"doNotShadeFormData",this.wNamespace),e.writeEndElement()),e.writeStartElement(void 0,"compat",this.wNamespace),this.dontUseHtmlParagraphAutoSpacing&&this.serializeBoolProperty(e,"doNotUseHTMLParagraphAutoSpacing",this.dontUseHtmlParagraphAutoSpacing),e.writeStartElement(void 0,"compatSetting",this.wNamespace),e.writeAttributeString(void 0,"name",this.wNamespace,"compatibilityMode"),e.writeAttributeString(void 0,"uri",this.wNamespace,"http://schemas.microsoft.com/office/word"),e.writeAttributeString(void 0,"val",this.wNamespace,"15"),e.writeEndElement(),e.writeEndElement(),this.document.footnotes&&(e.writeStartElement(void 0,"footnotePr",this.wNamespace),e.writeStartElement(void 0,"footnote",this.wNamespace),e.writeAttributeString(void 0,"id",this.wNamespace,"-1"),e.writeEndElement(),e.writeStartElement(void 0,"footnote",this.wNamespace),e.writeAttributeString(void 0,"id",this.wNamespace,"0"),e.writeEndElement(),e.writeEndElement()),this.document.endnotes&&(e.writeStartElement(void 0,"endnotePr",this.wNamespace),e.writeStartElement(void 0,"endnote",this.wNamespace),e.writeAttributeString(void 0,"id",this.wNamespace,"-1"),e.writeEndElement(),e.writeStartElement(void 0,"endnote",this.wNamespace),e.writeAttributeString(void 0,"id",this.wNamespace,"0"),e.writeEndElement(),e.writeEndElement()),e.writeEndElement();var i=new c.ZipArchiveItem(e.buffer,this.settingsPath);this.mArchive.addItem(i)},e.prototype.serializeCoreProperties=function(){},e.prototype.serializeAppProperties=function(){},e.prototype.serializeFontTable=function(e){},e.prototype.serializeSettingsRelation=function(){},e.prototype.serializeHeaderFooters=function(){this.serializeHeaderFooter("EvenFooter"),this.serializeHeaderFooter("EvenHeader"),this.serializeHeaderFooter("FirstPageFooter"),this.serializeHeaderFooter("FirstPageHeader"),this.serializeHeaderFooter("OddFooter"),this.serializeHeaderFooter("OddHeader")},e.prototype.serializeHeaderFooter=function(e){if(0!==this.headersFooters.length){var t,i;if(this.headersFooters.containsKey(e))for(var n=this.headersFooters.get(e),r=void 0,o=0;o<n.keys.length;o++){var s=n.keys[o];r=n.get(s),"EvenHeader"===e||"FirstPageHeader"===e||"OddHeader"===e?(t=this.headerPath+s.replace("rId","")+".xml",i=this.headerRelationPath+s.replace("rId","")+".xml.rels",this.serializeHeader(r,s,t,i)):(t=this.footerPath+s.replace("rId","")+".xml",i=this.footerRelationPath+s.replace("rId","")+".xml.rels",this.serializeFooter(r,s,t,i))}}},e.prototype.serializeHeader=function(e,t,i,n){this.headerFooter=e;var r=new p.XmlWriter;r.writeStartElement("w","hdr",this.wNamespace),this.writeHFCommonAttributes(r);var o=this.blockOwner;this.blockOwner=e,this.serializeBodyItems(r,e.blocks,!0),this.blockOwner=o,r.writeEndElement();var s=new c.ZipArchiveItem(r.buffer,i);this.mArchive.addItem(s),this.serializeHFRelations(t,n),this.headerFooter=void 0},e.prototype.serializeHFRelations=function(e,t){if(this.headerFooterImages.containsKey(e)){var i=new p.XmlWriter;i.writeStartElement(void 0,"Relationships",this.rpNamespace),this.serializeImagesRelations(this.headerFooterImages.get(e),i),i.writeEndElement();var n=new c.ZipArchiveItem(i.buffer,t);this.mArchive.addItem(n)}},e.prototype.writeHFCommonAttributes=function(e){e.writeAttributeString("xmlns","v",void 0,this.vNamespace),e.writeAttributeString("xmlns","w10",void 0,this.w10Namespace),e.writeAttributeString("xmlns","o",void 0,this.oNamespace),e.writeAttributeString("xmlns","ve",void 0,this.veNamespace),e.writeAttributeString("xmlns","r",void 0,this.rNamespace),e.writeAttributeString("xmlns","m",void 0,this.mNamespace),e.writeAttributeString("xmlns","wne",void 0,this.wneNamespace),e.writeAttributeString("xmlns","a",void 0,this.aNamespace),e.writeAttributeString("xmlns","pic",void 0,this.pictureNamespace),e.writeAttributeString("xmlns","wp",void 0,this.wpNamespace),e.writeAttributeString("xmlns","wpc",void 0,this.wpCanvasNamespace),e.writeAttributeString("xmlns","wp14",void 0,this.wpDrawingNamespace),this.writeDup(e),e.writeAttributeString("xmlns","wps",void 0,this.wpShapeNamespace),e.writeAttributeString("ve","Ignorable",void 0,"w14 w15 wp14")},e.prototype.serializeFooter=function(e,t,i,n){this.headerFooter=e;var r=new p.XmlWriter;r.writeStartElement("w","ftr",this.wNamespace),this.writeHFCommonAttributes(r),this.serializeBodyItems(r,e.blocks,!0),r.writeEndElement();var o=new c.ZipArchiveItem(r.buffer,i);this.mArchive.addItem(o),this.serializeHFRelations(t,n)},e.prototype.serializeDocumentRelations=function(){var e=new p.XmlWriter;e.writeStartElement(void 0,"Relationships",this.rpNamespace),this.serializeRelationShip(e,this.getNextRelationShipID(),this.stylesRelType,"styles.xml"),this.serializeRelationShip(e,this.getNextRelationShipID(),this.settingsRelType,"settings.xml"),this.document.endnotes&&this.serializeRelationShip(e,this.getNextRelationShipID(),this.endnoteRelType,"endnotes.xml"),this.document.footnotes&&this.serializeRelationShip(e,this.getNextRelationShipID(),this.footnoteRelType,"footnotes.xml"),this.mComments.length>0&&(1===this.mComments.length&&""===this.mComments[0].text||(this.serializeRelationShip(e,this.getNextRelationShipID(),this.commentsRelType,"comments.xml"),this.serializeRelationShip(e,this.getNextRelationShipID(),this.commentsExRelType,"commentsExtended.xml"))),this.document.lists.length>0&&this.serializeRelationShip(e,this.getNextRelationShipID(),this.numberingRelType,"numbering.xml"),this.serializeHeaderFooterRelations(e),this.serializeImagesRelations(this.documentImages,e),this.serializeCustomXMLMapping(this.mCustomXML,e),this.serializeChartDocumentRelations(this.documentCharts,e),e.writeEndElement();var t=new c.ZipArchiveItem(e.buffer,this.wordRelationPath);this.mArchive.addItem(t),this.headerFooter=void 0},e.prototype.serializeChartDocumentRelations=function(e,t){if(e.length>0)for(var i=e.keys,n=1;n<=i.length;n++)this.serializeRelationShip(t,i[n-1],this.chartRelType,"charts/chart"+n+".xml")},e.prototype.serializeChartRelations=function(){var e=new p.XmlWriter;this.resetChartRelationShipId(),e.writeStartElement(void 0,"Relationships",this.rpNamespace);var t="colors"+this.chartCount+".xml",i=this.chartPath+"/_rels/chart"+this.chartCount+".xml.rels",n="../embeddings/Microsoft_Excel_Worksheet"+this.chartCount+".xlsx";this.serializeRelationShip(e,this.getNextChartRelationShipID(),this.packageRelType,n),this.serializeRelationShip(e,this.getNextChartRelationShipID(),this.chartColorStyleRelType,t),e.writeEndElement();var r=new c.ZipArchiveItem(e.buffer,i);this.mArchive.addItem(r)},e.prototype.serializeImagesRelations=function(e,i){if(e.length>0)for(var n="",r=void 0,o=e.keys,s=0;s<o.length;s++)if(r=e.get(o[s]).imageString,t.isNullOrUndefined(r))n=this.imagePath+"/0.jpeg",this.serializeRelationShip(i,o[s],this.imageRelType,n.replace("word/",""));else{var a=W.formatClippedString(r),l=a.extension,d=a.formatClippedString;n=this.imagePath+o[s]+l,this.serializeRelationShip(i,o[s],this.imageRelType,n.replace("word/",""));var h=new Blob([this.encodedString(d)]),p=new c.ZipArchiveItem(h,n);this.mArchive.addItem(p)}},e.prototype.encodedString=function(e){var t,i,n,r,o,s,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=0,d=0,h=3*(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"")).length/4;if(e.charAt(e.length-1)===a.charAt(64)&&h--,e.charAt(e.length-2)===a.charAt(64)&&h--,h%1!=0)throw new Error("Invalid base64 input, bad content length.");for(var c=new Uint8Array(0|h);l<e.length;)t=a.indexOf(e.charAt(l++))<<2|(r=a.indexOf(e.charAt(l++)))>>4,i=(15&r)<<4|(o=a.indexOf(e.charAt(l++)))>>2,n=(3&o)<<6|(s=a.indexOf(e.charAt(l++))),c[d++]=t,64!==o&&(c[d++]=i),64!==s&&(c[d++]=n);return c},e.prototype.serializeExternalLinkImages=function(e){for(var t=this.externalImages.keys,i=0;i<this.externalImages.keys.length;i++)this.serializeRelationShip(e,t[i],this.imageRelType,this.externalImages.get(t[i]))},e.prototype.serializeHeaderFooterRelations=function(e){this.serializeHFRelation(e,"EvenFooter"),this.serializeHFRelation(e,"EvenHeader"),this.serializeHFRelation(e,"FirstPageFooter"),this.serializeHFRelation(e,"FirstPageHeader"),this.serializeHFRelation(e,"OddFooter"),this.serializeHFRelation(e,"OddHeader")},e.prototype.serializeHFRelation=function(e,t){var i,n="";if(this.headersFooters.containsKey(t))for(var r=this.headersFooters.get(t),o=0;o<r.keys.length;o++){var s=r.keys[o];"EvenHeader"===t||"FirstPageHeader"===t||"OddHeader"===t?(n="header"+s.replace("rId","")+".xml",i=this.headerRelType):(n="footer"+s.replace("rId","")+".xml",i=this.footerRelType),this.serializeRelationShip(e,s,i,n)}},e.prototype.serializeRelationShip=function(e,t,i,n){e.writeStartElement(void 0,"Relationship",void 0),e.writeAttributeString(void 0,"Id",void 0,t),e.writeAttributeString(void 0,"Type",void 0,i),e.writeAttributeString(void 0,"Target",void 0,n.replace("\\","/").replace("\v","")),(i===this.hyperlinkRelType||this.startsWith(n,"http://")||this.startsWith(n,"https://")||this.startsWith(n,"file:///"))&&e.writeAttributeString(void 0,"TargetMode",void 0,"External"),e.writeEndElement()},e.prototype.getNextRelationShipID=function(){return"rId"+ ++this.mRelationShipID},e.prototype.getEFNextRelationShipID=function(){return(++this.efRelationShipId).toString()},e.prototype.serializeGeneralRelations=function(){var e=new p.XmlWriter;this.resetRelationShipID(),e.writeStartElement(void 0,"Relationships",this.rpNamespace),this.serializeRelationShip(e,this.getNextRelationShipID(),this.documentRelType,this.documentPath),e.writeEndElement();var t=new c.ZipArchiveItem(e.buffer,this.generalRelationPath);this.mArchive.addItem(t)},e.prototype.serializeContentTypes=function(e){var t=new p.XmlWriter;if(t.writeStartElement(void 0,"Types","http://schemas.openxmlformats.org/package/2006/content-types"),this.serializeDefaultContentType(t,"rels",this.relationContentType),this.serializeDefaultContentType(t,"xml",this.xmlContentType),(this.documentImages.length>0||this.externalImages.length>0||this.headerFooterImages.length>0)&&(this.serializeDefaultContentType(t,"png","image/png"),this.serializeDefaultContentType(t,"bmp","image/bmp"),this.serializeDefaultContentType(t,"emf","image/x-emf"),this.serializeDefaultContentType(t,"wmf","image/x-wmf"),this.serializeDefaultContentType(t,"gif","image/gif"),this.serializeDefaultContentType(t,"ico","image/x-icon"),this.serializeDefaultContentType(t,"tif","image/tiff"),this.serializeDefaultContentType(t,"tiff","image/tiff"),this.serializeDefaultContentType(t,"jpeg","image/jpeg"),this.serializeDefaultContentType(t,"jpg","image/jpeg"),this.serializeDefaultContentType(t,"svg","image/svg+xml")),this.serializeOverrideContentType(t,this.documentPath,this.documentContentType),this.serializeOverrideContentType(t,this.numberingPath,this.numberingContentType),this.serializeOverrideContentType(t,this.stylePath,this.stylesContentType),this.serializeOverrideContentType(t,this.settingsPath,this.settingsContentType),this.serializeOverrideContentType(t,this.commentsPath,this.commentsContentType),this.serializeOverrideContentType(t,this.commentsExtendedPath,this.commentsExContentType),this.chartCount>0){var i=1;for(this.serializeDefaultContentType(t,"xlsx","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");i<=this.chartCount;)this.serializeOverrideContentType(t,"word/charts/chart"+i+".xml",this.chartsContentType),this.serializeOverrideContentType(t,"word/charts/colors"+i+".xml",this.chartColorStyleContentType),i++}if(this.customXMLProps.length>0)for(var n=0;n<this.customXMLProps.length;n++)this.serializeOverrideContentType(t,this.customXMLProps[n],this.customXmlContentType);this.serializeHFContentTypes(t),this.SerializeEFContentTypes(t),t.writeEndElement();var r=new c.ZipArchiveItem(t.buffer,this.contentTypesPath);this.mArchive.addItem(r)},e.prototype.serializeHFContentTypes=function(e){this.serializeHeaderFootersContentType(e,"EvenFooter"),this.serializeHeaderFootersContentType(e,"EvenHeader"),this.serializeHeaderFootersContentType(e,"FirstPageFooter"),this.serializeHeaderFootersContentType(e,"FirstPageHeader"),this.serializeHeaderFootersContentType(e,"OddFooter"),this.serializeHeaderFootersContentType(e,"OddHeader")},e.prototype.serializeHeaderFootersContentType=function(e,t){var i,n;if(this.headersFooters.containsKey(t))for(var r=this.headersFooters.get(t),o=0;o<r.keys.length;o++){var s=r.keys[o];"EvenHeader"===t||"FirstPageHeader"===t||"OddHeader"===t?(n=this.headerPath+s.replace("rId","")+".xml",i=this.headerContentType):(n=this.footerPath+s.replace("rId","")+".xml",i=this.footerContentType),this.serializeOverrideContentType(e,n,i)}},e.prototype.SerializeEFContentTypes=function(e){this.serializeEFContentType(e)},e.prototype.serializeEFContentType=function(e){var t,i;i=this.endnotesPath,t=this.endnoteContentType,this.serializeOverrideContentType(e,i,t),i=this.footnotesPath,t=this.footnoteContentType,this.serializeOverrideContentType(e,i,t)},e.prototype.serializeOverrideContentType=function(e,t,i){e.writeStartElement(void 0,"Override",void 0),e.writeAttributeString(void 0,"PartName",void 0,"/"+t.replace("\\","/")),e.writeAttributeString(void 0,"ContentType",void 0,i),e.writeEndElement()},e.prototype.serializeDefaultContentType=function(e,t,i){e.writeStartElement(void 0,"Default",void 0),e.writeAttributeString(void 0,"Extension",void 0,t),e.writeAttributeString(void 0,"ContentType",void 0,i),e.writeEndElement()},e.prototype.resetRelationShipID=function(){this.mRelationShipID=0},e.prototype.resetExcelRelationShipId=function(){this.eRelationShipId=0},e.prototype.resetChartRelationShipId=function(){this.cRelationShipId=0},e.prototype.close=function(){},e}(),oi=function(){function e(){this.pageContent="",this.curSectionIndex=0,this.inField=!1}return e.prototype.getModuleName=function(){return"TextExport"},e.prototype.save=function(e,t){this.serialize(e);var i=new p.StreamWriter;this.writeInternal(i),i.save(t+".txt")},e.prototype.saveAsBlob=function(e){this.serialize(e);var t=new p.StreamWriter;this.writeInternal(t);var i=t.buffer;return t.destroy(),new Promise(function(e,t){e(i)})},e.prototype.serialize=function(e){var t=e.owner.sfdtExportModule.write();this.setDocument(t)},e.prototype.setDocument=function(e){this.document=e,this.mSections=e.sections},e.prototype.writeInternal=function(e){var t=void 0,i=this.document.sections.length-1,n=!1;this.updateLastParagraph();for(var r=0;r<=i;r++)t=this.document.sections[r],n=r===i,this.writeBody(e,t.blocks),this.writeNewLine(e),this.writeSectionEnd(t,n);for(var o=0;o<=i;o++)t=this.document.sections[o],this.writeHeadersFooters(e,t)},e.prototype.writeBody=function(e,t){for(var i=t.length-1,n=void 0,r=0;r<=i;r++)if((n=t[r]).hasOwnProperty("inlines")){var o=n===this.lastPara;this.writeParagraph(e,n,o)}else this.writeTable(e,n)},e.prototype.writeParagraph=function(e,t,i){for(var n=0;n<t.inlines.length;n++){var r=t.inlines[n];r.hasOwnProperty("fieldType")?this.inField=0===r.fieldType:r.hasOwnProperty("text")&&!this.inField&&this.writeText(e,r.text)}i||this.writeNewLine(e)},e.prototype.writeTable=function(e,t){for(var i=0;i<t.rows.length;i++)for(var n=t.rows[i],r=0;r<n.cells.length;r++){var o=n.cells[r];this.writeBody(e,o.blocks)}},e.prototype.writeHeadersFooters=function(e,i){var n=i.headersFooters;t.isNullOrUndefined(n)||(this.writeHeaderFooter(e,i.headersFooters.header),this.writeHeaderFooter(e,i.headersFooters.footer),this.writeHeaderFooter(e,i.headersFooters.evenFooter),this.writeHeaderFooter(e,i.headersFooters.evenHeader),this.writeHeaderFooter(e,i.headersFooters.firstPageHeader),this.writeHeaderFooter(e,i.headersFooters.firstPageFooter))},e.prototype.writeHeaderFooter=function(e,t){t&&t.blocks&&this.writeBody(e,t.blocks)},e.prototype.writeSectionEnd=function(e,t){this.curSectionIndex++},e.prototype.writeNewLine=function(e){t.isNullOrUndefined(e)?this.pageContent=this.pageContent+" ":e.writeLine("")},e.prototype.writeText=function(e,i){t.isNullOrUndefined(e)?this.pageContent+=i:e.write(i)},e.prototype.updateLastParagraph=function(){var e,i=this.document.sections.length;if(i>0&&(e=this.document.sections[i-1]),!t.isNullOrUndefined(e)){for(var n=[],r=0;r<e.blocks.length;r++)e.blocks[r].hasOwnProperty("inlines")&&n.push(e.blocks[r]);var o=n.length;o>0&&(this.lastPara=n[o-1])}},e.prototype.destroy=function(){this.document=void 0,this.lastPara=void 0,this.mSections=void 0,this.sections=void 0},e}(),si=function(){function e(e){this.endLine=void 0,this.endOffset=void 0,this.endCell=void 0,this.startColumnIndex=void 0,this.endColumnIndex=void 0,this.lists=void 0,this.document=void 0,this.writeInlineStyles=void 0,this.blockContent=!1,this.startContent=!1,this.multipleLineContent=!1,this.nestedContent=!1,this.editRangeId=-1,this.selectedCommentsId=[],this.selectedRevisionId=[],this.nestedBlockContent=!1,this.nestedBlockEnabled=!1,this.blocks=[],this.contentInline=[],this.isContentControl=!1,this.isBlockClosed=!0,this.isExport=!0,this.isPartialExport=!1,this.checkboxOrDropdown=!1,this.copyWithTrackChange=!1,this.documentHelper=e}return Object.defineProperty(e.prototype,"viewer",{get:function(){return this.documentHelper.owner.viewer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"owner",{get:function(){return this.documentHelper.owner},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"SfdtExport"},e.prototype.clear=function(){this.writeInlineStyles=void 0,this.endLine=void 0,this.lists=void 0,this.document=void 0,this.endCell=void 0,this.startColumnIndex=void 0,this.endColumnIndex=void 0,this.selectedCommentsId=[],this.selectedRevisionId=[],this.startBlock=void 0,this.endBlock=void 0,this.isPartialExport=!1},e.prototype.serialize=function(){return JSON.stringify(this.write())},e.prototype.saveAsBlob=function(e){var t=new p.StreamWriter;t.write(this.serialize());var i=t.buffer;return t.destroy(),new Promise(function(e,t){e(i)})},e.prototype.updateEditRangeId=function(){for(var e=-1,t=0;t<this.documentHelper.editRanges.keys.length;t++)for(var i=this.documentHelper.editRanges.keys,n=0;n<i[t].length;n++)for(var r=this.documentHelper.editRanges.get(i[t]),o=0;o<r.length;o++)e++,r[o].editRangeId=e,r[o].editRangeEnd.editRangeId=e},e.prototype.write=function(e,i,n,r,o,s){if(o&&(this.writeInlineStyles=!0),this.Initialize(),this.updateEditRangeId(),e instanceof we&&n instanceof we){this.isExport=!1,t.isNullOrUndefined(s)||(this.isExport=s);var a=e.paragraph,l=n.paragraph;this.isPartialExport&&(this.startBlock=this.getParentBlock(a),this.endBlock=this.getParentBlock(l));var d=a.associatedCell,h=l.associatedCell,c=(a.bodyWidget,this.createSection(e.paragraph.bodyWidget));if(this.document.sections.push(c),d===h||t.isNullOrUndefined(h))this.endLine=n,this.endOffset=r;else if(d instanceof be){var p=d.getContainerTable(),u=h.getContainerTable();p.tableFormat===u.tableFormat&&(this.endCell=h,this.endCell.ownerTable!==d.ownerTable&&d.ownerTable.associatedCell&&d.ownerTable.associatedCell.ownerTable===this.endCell.ownerTable&&0===d.ownerTable.associatedCell.childWidgets.indexOf(d.ownerTable)&&(d=d.ownerTable.associatedCell),this.endColumnIndex=this.endCell.columnIndex+this.endCell.cellFormat.columnSpan,this.startColumnIndex=d.columnIndex)}else this.endCell=h;var g=void 0;if(d===h&&!this.isPartialExport||t.isNullOrUndefined(d)){var m=this.createParagraph(e.paragraph);c.blocks.push(m);b=e.paragraph;for(g=this.writeParagraph(e.paragraph,m,c.blocks,e.indexInOwner,i),this.isPartialExport&&(g=this.getNextBlock(g,b),c=this.document.sections[this.document.sections.length-1]);g;)b=g,g=this.writeBlock(g,0,c.blocks),this.isPartialExport&&t.isNullOrUndefined(g)&&(g=this.getNextBlock(g,b),c=this.document.sections[this.document.sections.length-1])}else{if(t.isNullOrUndefined(h)&&d.ownerTable.associatedCell){var f=(p=d.getContainerTable()).childWidgets[p.childWidgets.length-1],v=f.childWidgets[f.childWidgets.length-1];if(v.ownerTable!==d.ownerTable&&d.ownerTable.associatedCell&&0===d.ownerTable.associatedCell.childWidgets.indexOf(d.ownerTable))for(;d.ownerTable!==v.ownerTable;)d=d.ownerTable.associatedCell;this.endColumnIndex=v.columnIndex+v.cellFormat.columnSpan,this.startColumnIndex=d.columnIndex}var y=this.createTable(d.ownerTable);c.blocks.push(y);var b=d.ownerTable;for(g=this.writeTable(d.ownerTable,y,d.ownerRow.indexInOwner,c.blocks),this.isPartialExport&&(g=this.getNextBlock(g,b),c=this.document.sections[this.document.sections.length-1]);g;)b=g,g=this.writeBlock(g,0,c.blocks),this.isPartialExport&&(g=this.getNextBlock(g,b),c=this.document.sections[this.document.sections.length-1])}}else if(this.isExport=!0,this.documentHelper.pages.length>0){var w=this.documentHelper.pages[0];this.writePage(w)}this.writeStyles(this.documentHelper),this.writeLists(this.documentHelper),this.writeComments(this.documentHelper),this.writeRevisions(this.documentHelper),this.writeCustomXml(this.documentHelper),this.footnotes(this.documentHelper),this.endnotes(this.documentHelper);var C=this.document;return this.clear(),C},e.prototype.getNextBlock=function(e,i){if(t.isNullOrUndefined(e)&&this.isPartialExport&&this.endBlock&&!this.endBlock.equals(i))if((e=i.getSplitWidgets().pop().nextRenderedWidget)&&i.bodyWidget.index!==e.bodyWidget.index){var n=this.createSection(e.bodyWidget);this.document.sections.push(n)}else e=void 0;return e},e.prototype.Initialize=function(){this.lists=[],this.document={},this.document.sections=[],this.document.characterFormat=this.writeCharacterFormat(this.documentHelper.characterFormat),this.document.paragraphFormat=this.writeParagraphFormat(this.documentHelper.paragraphFormat),this.document.defaultTabWidth=this.documentHelper.defaultTabWidth,this.document.trackChanges=this.owner.enableTrackChanges,this.document.enforcement=this.documentHelper.isDocumentProtected,this.document.hashValue=this.documentHelper.hashValue,this.document.saltValue=this.documentHelper.saltValue,this.document.formatting=this.documentHelper.restrictFormatting,this.document.protectionType=this.documentHelper.protectionType,this.document.dontUseHTMLParagraphAutoSpacing=this.documentHelper.dontUseHtmlParagraphAutoSpacing,this.document.formFieldShading=this.documentHelper.owner.documentEditorSettings.formFieldSettings.applyShading},e.prototype.writePage=function(e){if(e.bodyWidgets.length>0){var i=e.bodyWidgets[0];do{i=this.writeBodyWidget(i,0)}while(!t.isNullOrUndefined(i))}return this.document},e.prototype.writeBodyWidget=function(e,i){if(e instanceof pe){var n=this.createSection(e);this.document.sections.push(n),this.writeHeaderFooters(this.documentHelper.headersFooters[e.index],n);var r=e.childWidgets[i];do{r=this.writeBlock(r,0,n.blocks)}while(r);var o=e;do{e=o,o=o.nextRenderedWidget,!t.isNullOrUndefined(o)||t.isNullOrUndefined(e.page.nextPage)||t.isNullOrUndefined(e.page.nextPage)||(o=e.page.nextPage.bodyWidgets[0])}while(o instanceof pe&&o.index===e.index);return o}},e.prototype.writeHeaderFooters=function(e,i){t.isNullOrUndefined(e)||(i.headersFooters.header=this.writeHeaderFooter(e[0]),i.headersFooters.footer=this.writeHeaderFooter(e[1]),i.headersFooters.evenHeader=this.writeHeaderFooter(e[2]),i.headersFooters.evenFooter=this.writeHeaderFooter(e[3]),i.headersFooters.firstPageHeader=this.writeHeaderFooter(e[4]),i.headersFooters.firstPageFooter=this.writeHeaderFooter(e[5]))},e.prototype.writeHeaderFooter=function(e){if(!t.isNullOrUndefined(e)&&!e.isEmpty){var i={};if(e&&e.childWidgets&&e.childWidgets.length>0){i.blocks=[];var n=e.firstChild;do{n=this.writeBlock(n,0,i.blocks)}while(n)}return i}},e.prototype.createSection=function(e){var i={};return i.sectionFormat={},i.sectionFormat.pageWidth=e.sectionFormat.pageWidth,i.sectionFormat.pageHeight=e.sectionFormat.pageHeight,i.sectionFormat.leftMargin=e.sectionFormat.leftMargin,i.sectionFormat.rightMargin=e.sectionFormat.rightMargin,i.sectionFormat.topMargin=e.sectionFormat.topMargin,i.sectionFormat.bottomMargin=e.sectionFormat.bottomMargin,i.sectionFormat.differentFirstPage=e.sectionFormat.differentFirstPage,i.sectionFormat.differentOddAndEvenPages=e.sectionFormat.differentOddAndEvenPages,i.sectionFormat.headerDistance=e.sectionFormat.headerDistance,i.sectionFormat.footerDistance=e.sectionFormat.footerDistance,i.sectionFormat.bidi=e.sectionFormat.bidi,e.sectionFormat.restartPageNumbering&&(i.sectionFormat.restartPageNumbering=e.sectionFormat.restartPageNumbering,i.sectionFormat.pageStartingNumber=e.sectionFormat.pageStartingNumber),t.isNullOrUndefined(e.page.endnoteWidget||e.page.footnoteWidget)||(i.sectionFormat.endnoteNumberFormat=e.sectionFormat.endnoteNumberFormat,i.sectionFormat.footNoteNumberFormat=e.sectionFormat.footNoteNumberFormat,i.sectionFormat.restartIndexForFootnotes=e.sectionFormat.restartIndexForFootnotes,i.sectionFormat.restartIndexForEndnotes=e.sectionFormat.restartIndexForEndnotes,i.sectionFormat.initialFootNoteNumber=e.sectionFormat.initialFootNoteNumber,i.sectionFormat.initialEndNoteNumber=e.sectionFormat.initialEndNoteNumber),i.blocks=[],i.headersFooters={},i},e.prototype.writeBlock=function(e,i,n){if(e instanceof ge){if(e instanceof fe){if(e.hasOwnProperty("contentControlProperties")&&"BuildingBlockGallery"!==e.contentControlProperties.type){s=this.blockContentControl(e);return!t.isNullOrUndefined(s)&&this.isBlockClosed&&(n.push(s),this.blocks=[]),this.nextBlock}var r=this.createParagraph(e);return n.push(r),this.writeParagraph(e,r,n)}var o=e;if(o.hasOwnProperty("contentControlProperties")&&"BuildingBlockGallery"!==o.contentControlProperties.type){var s=this.tableContentControl(o);return this.isBlockClosed&&n.push(s),this.nextBlock}var a=this.createTable(o);return n.push(a),this.writeTable(o,a,0,n)}},e.prototype.writeParagraphs=function(e){var i=this.blocks,n=e.childWidgets[0],r=n.children[0],o=n.children[1];if((r instanceof Ke||o instanceof Ke)&&(r=n.children[2],o=n.children[3]),this.nestedBlockEnabled&&(i=[]),r instanceof Le&&o instanceof Le&&!this.nestedBlockContent||this.blockContent&&r instanceof Le&&!this.nestedBlockContent){var s=!1;if(o instanceof Le&&"Block"===o.contentControlWidgetType&&(s=!0),s||this.blockContent&&r instanceof Le&&!this.nestedBlockContent&&0===r.type&&"Block"===r.contentControlWidgetType){this.nestedBlockContent=!0,this.nestedBlockEnabled=!0;var a=this.blockContentControl(e);t.isNullOrUndefined(a)||this.blocks.push(a)}else{l=this.createParagraph(e);i.push(l),this.nextBlock=this.writeParagraph(e,l,i)}}else{var l=this.createParagraph(e);i.push(l),this.nextBlock=this.writeParagraph(e,l,i)}return this.blockContent?!this.nestedBlockContent&&this.nestedBlockEnabled?(this.nestedBlockEnabled=!1,i):void 0:i},e.prototype.contentControlProperty=function(e){var i={};return i.lockContentControl=e.lockContentControl,i.lockContents=e.lockContents,i.tag=e.tag,i.color=e.color,i.title=e.title,t.isNullOrUndefined(e.appearance)||(i.appearance=e.appearance),i.type=e.type,i.hasPlaceHolderText=e.hasPlaceHolderText,i.multiline=e.multiline,i.isTemporary=e.isTemporary,t.isNullOrUndefined(e.isChecked)||(i.isChecked=e.isChecked),t.isNullOrUndefined(e.uncheckedState)||(i.uncheckedState=this.tounCheckedState(e.uncheckedState)),t.isNullOrUndefined(e.checkedState)||(i.checkedState=this.toCheckedState(e.checkedState)),t.isNullOrUndefined(e.dateCalendarType)||(i.dateCalendarType=e.dateCalendarType),t.isNullOrUndefined(e.dateStorageFormat)||(i.dateStorageFormat=e.dateStorageFormat),t.isNullOrUndefined(e.dateDisplayLocale)||(i.dateDisplayLocale=e.dateDisplayLocale),t.isNullOrUndefined(e.dateDisplayFormat)||(i.dateDisplayFormat=e.dateDisplayFormat),t.isNullOrUndefined(e.xmlMapping)||(i.xmlMapping=e.xmlMapping),t.isNullOrUndefined(e.characterFormat)||(i.characterFormat=this.writeCharacterFormat(e.characterFormat)),i.contentControlListItems=e.contentControlListItems,i},e.prototype.tounCheckedState=function(e){var t={};return t.font=e.font,t.value=e.value,t},e.prototype.toCheckedState=function(e){var t={};return t.font=e.font,t.value=e.value,t},e.prototype.blockContentControl=function(e){var i={};if(0===e.childWidgets.length)return void(this.nextBlock=e.nextWidget);if(i.blocks=this.writeParagraphs(e),!t.isNullOrUndefined(i.blocks)){var n=e.childWidgets[0],r=n.children[0],o=n.children[1];if((r instanceof Ke||o instanceof Ke)&&(r=n.children[2],o=n.children[3]),r instanceof Le&&o instanceof Le&&!this.nestedBlockContent||this.blockContent&&r instanceof Le&&!this.nestedBlockContent){if(!(o instanceof Le))return i.contentControlProperties=this.contentControlProperty(r.contentControlProperties),i;"Block"===o.contentControlWidgetType?i.contentControlProperties=this.contentControlProperty(o.contentControlProperties):i.contentControlProperties=this.contentControlProperty(e.contentControlProperties)}else i.contentControlProperties=this.contentControlProperty(e.contentControlProperties);return i}},e.prototype.tableContentControl=function(e){var i={};return i.blocks=this.tableContentControls(e),t.isNullOrUndefined(this.nextBlock)||e.contentControlProperties!==this.nextBlock.contentControlProperties?(i.contentControlProperties=this.contentControlProperty(e.contentControlProperties),i):this.blocks=i.blocks},e.prototype.tableContentControls=function(e){var t=[];this.isBlockClosed||(t=this.blocks);var i=this.createTable(e);return t.push(i),this.nextBlock=this.writeTable(e,i,0,t),t},e.prototype.writeParagraph=function(e,i,n,r,o){t.isNullOrUndefined(r)&&(r=0),t.isNullOrUndefined(o)&&(o=0);for(var s=e;s instanceof fe;){if(this.writeLines(s,r,o,i.inlines))return;r=0,o=0,s=(e=s).nextSplitWidget}return s=e.nextRenderedWidget,t.isNullOrUndefined(s)&&e.containerWidget instanceof pe&&!t.isNullOrUndefined(e.containerWidget.page.nextPage)&&!t.isNullOrUndefined(e.containerWidget.page.nextPage.bodyWidgets)&&(s=e.containerWidget.page.nextPage.bodyWidgets[0].childWidgets[0]),s instanceof ge&&e.containerWidget.index===s.containerWidget.index?s:void 0},e.prototype.writeInlines=function(e,i,n){this.contentInline=[];var r=i.clone(),o=!1,s=e.paragraphFormat.bidi;(s||this.documentHelper.layout.isContainsRtl(r))&&this.documentHelper.layout.reArrangeElementsForRtl(r,s);for(var a=0;a<r.children.length;a++){var l=r.children[a];if(this.isExport&&this.checkboxOrDropdown){if(o&&l instanceof Ie)continue;l instanceof xe&&2===l.fieldType&&(o=!0)}if(!(l instanceof Ke))if(l instanceof Ee)n.push(this.writeInlinesFootNote(e,l,i,n));else if(l instanceof Le||this.startContent||this.blockContent)this.writeInlinesContentControl(l,i,n,a);else{var d=this.writeInline(l);t.isNullOrUndefined(d)||n.push(d),this.isExport&&l instanceof xe&&1===l.fieldType&&(o=!1,this.checkboxOrDropdown=!1)}}},e.prototype.inlineContentControl=function(e,i,n){var r={},o=[];if(t.isNullOrUndefined(n))if(this.nestedContent){r.inlines=this.inlineContentControls(e,void 0,o);s=this.nestedContentProperty(i,r);t.isNullOrUndefined(s)&&!this.multipleLineContent||(this.contentInline.push(r),o=[])}else r.inlines=this.inlineContentControls(e,this.contentInline);else if(this.nestedContent){n=n[n.length-1].inlines,r=this.inlineContentControls(e,n[n.length-1].inlines);var s=this.nestedContentProperty(i,n[n.length-1]);t.isNullOrUndefined(s)||(this.contentInline.push(r),o=[])}else this.inlineContentControls(e,n[n.length-1].inlines);if(t.isNullOrUndefined(i)){if(this.startContent)return this.multipleLineContent=!0,r}else if(1===i.type&&!this.nestedContent)return this.multipleLineContent?(n[n.length-1].contentControlProperties=this.contentControlProperty(i.contentControlProperties),void(this.multipleLineContent=!1)):(r.contentControlProperties=this.contentControlProperty(i.contentControlProperties),r)},e.prototype.nestedContentProperty=function(e,i,n){if(t.isNullOrUndefined(e)){if(this.startContent)return this.multipleLineContent=!0,i}else{if(1===e.type)return i.contentControlProperties=this.contentControlProperty(e.contentControlProperties),i;if(this.startContent)return this.multipleLineContent=!0,i}},e.prototype.inlineContentControls=function(e,i,n){var r=this.writeInline(e);return t.isNullOrUndefined(n)?(i.push(r),i):(n.push(r),n)},e.prototype.writeInline=function(e){var t={};if(e.removedIds.length>0)for(var i=0;i<e.removedIds.length;i++)e.revisions[i]=this.documentHelper.revisionsInternal.get(e.removedIds[i]);if(t.characterFormat=this.writeCharacterFormat(e.characterFormat),e instanceof xe)t.fieldType=e.fieldType,0===e.fieldType&&(t.hasFieldEnd=!0,e.formFieldData&&(t.formFieldData={},t.formFieldData.name=e.formFieldData.name,t.formFieldData.enabled=e.formFieldData.enabled,t.formFieldData.helpText=e.formFieldData.helpText,t.formFieldData.statusText=e.formFieldData.statusText,e.formFieldData instanceof Pe?(t.formFieldData.textInput={},t.formFieldData.textInput.type=e.formFieldData.type,t.formFieldData.textInput.maxLength=e.formFieldData.maxLength,t.formFieldData.textInput.defaultValue=e.formFieldData.defaultValue,t.formFieldData.textInput.format=e.formFieldData.format):e.formFieldData instanceof Te?(t.formFieldData.checkBox={},this.checkboxOrDropdown=!0,t.formFieldData.checkBox.sizeType=e.formFieldData.sizeType,t.formFieldData.checkBox.size=e.formFieldData.size,t.formFieldData.checkBox.defaultValue=e.formFieldData.defaultValue,t.formFieldData.checkBox.checked=e.formFieldData.checked):(t.formFieldData.dropDownList={},this.checkboxOrDropdown=!0,t.formFieldData.dropDownList.dropDownItems=e.formFieldData.dropdownItems,t.formFieldData.dropDownList.selectedIndex=e.formFieldData.selectedIndex))),e.fieldCodeType&&""!==e.fieldCodeType&&(t.fieldCodeType=e.fieldCodeType);else if(e instanceof Je)this.writeChart(e,t);else if(e instanceof Ge)t.imageString=e.imageString,t.metaFileImageString=e.metaFileImageString,t.isMetaFile=e.isMetaFile,t.isCompressed=e.isCompressed,t.width=W.convertPixelToPoint(e.width),t.height=W.convertPixelToPoint(e.height),t.iscrop=e.isCrop,e.isCrop&&(t.bottom=e.bottom,t.right=e.right,t.left=e.left,t.top=e.top,t.getimagewidth=e.cropWidthScale,t.getimageheight=e.cropHeightScale),t.name=e.name,t.alternativeText=e.alternativeText,t.title=e.title,t.visible=e.visible,t.widthScale=e.widthScale,t.heightScale=e.heightScale,t.verticalPosition=W.convertPixelToPoint(e.verticalPosition),t.verticalOrigin=e.verticalOrigin,t.verticalAlignment=e.verticalAlignment,t.horizontalPosition=W.convertPixelToPoint(e.horizontalPosition),t.horizontalOrigin=e.horizontalOrigin,t.horizontalAlignment=e.horizontalAlignment,t.allowOverlap=e.allowOverlap,t.textWrappingStyle=e.textWrappingStyle,t.textWrappingType=e.textWrappingType,t.layoutInCell=e.layoutInCell;else if(e instanceof ke)t.bookmarkType=e.bookmarkType,t.name=e.name;else if(e instanceof Ie)if(-1!==e.text.indexOf(""))t.text=e.text.replace(/\u001e/g,"-");else if(-1!==e.text.indexOf(""))t.text=e.text.replace(/\u001f/g,"");else if(0!==e.revisions.length)if(this.isExport||!this.owner.enableTrackChanges||this.isPartialExport)t.text=e.text;else{this.copyWithTrackChange=!0;for(r=0;r<e.revisions.length;r++){var n=e.revisions[r];-1===this.selectedRevisionId.indexOf(n.revisionID)&&this.selectedRevisionId.push(n.revisionID),"Deletion"===e.revisions[r].revisionType?e.revisions.pop():"Insertion"===e.revisions[r].revisionType?(e.revisions.pop(),t.text=e.text):t.text=e.text}}else t.text=e.text;else e instanceof Ye?(t.user=e.user,t.group=e.group,t.columnFirst=e.columnFirst,t.columnLast=e.columnLast,t.editRangeId=e.editRangeId.toString()):e instanceof Xe?(t.editableRangeStart={user:e.editRangeStart.user,group:e.editRangeStart.group,columnFirst:e.editRangeStart.columnFirst,columnLast:e.editRangeStart.columnLast},t.editRangeId=e.editRangeId.toString()):e instanceof pt?(this.isExport||0!==e.commentType||this.selectedCommentsId.push(e.commentId),t.commentCharacterType=e.commentType,t.commentId=e.commentId):e instanceof Ve?this.writeShape(e,t):t=void 0;if(e.revisions.length>0){t.revisionIds=[];for(var r=0;r<e.revisions.length;r++)-1===this.selectedRevisionId.indexOf(e.revisions[r].revisionID)&&this.selectedRevisionId.push(e.revisions[r].revisionID),t.revisionIds.push(e.revisions[r].revisionID)}return t},e.prototype.writeShape=function(e,t){if(t.shapeId=e.shapeId,t.name=e.name,t.alternativeText=e.alternativeText,t.title=e.title,t.visible=e.visible,t.width=W.convertPixelToPoint(e.width),t.height=W.convertPixelToPoint(e.height),t.widthScale=e.widthScale,t.heightScale=e.heightScale,t.verticalPosition=W.convertPixelToPoint(e.verticalPosition),t.verticalOrigin=e.verticalOrigin,t.verticalAlignment=e.verticalAlignment,t.horizontalPosition=W.convertPixelToPoint(e.horizontalPosition),t.horizontalOrigin=e.horizontalOrigin,t.horizontalAlignment=e.horizontalAlignment,t.zOrderPosition=e.zOrderPosition,t.allowOverlap=e.allowOverlap,t.textWrappingStyle=e.textWrappingStyle,t.textWrappingType=e.textWrappingType,t.distanceBottom=W.convertPixelToPoint(e.distanceBottom),t.distanceLeft=W.convertPixelToPoint(e.distanceLeft),t.distanceRight=W.convertPixelToPoint(e.distanceRight),t.distanceTop=W.convertPixelToPoint(e.distanceTop),t.layoutInCell=e.layoutInCell,t.lockAnchor=e.lockAnchor,t.autoShapeType=e.autoShapeType,e.lineFormat&&(t.lineFormat={},t.lineFormat.lineFormatType=e.lineFormat.lineFormatType,t.lineFormat.color=e.lineFormat.color,t.lineFormat.weight=e.lineFormat.weight,t.lineFormat.lineStyle=e.lineFormat.dashStyle,t.lineFormat.line=e.lineFormat.line),e.textFrame){t.textFrame={},t.textFrame.textVerticalAlignment=e.textFrame.textVerticalAlignment,t.textFrame.leftMargin=W.convertPixelToPoint(e.textFrame.marginLeft),t.textFrame.rightMargin=W.convertPixelToPoint(e.textFrame.marginRight),t.textFrame.topMargin=W.convertPixelToPoint(e.textFrame.marginTop),t.textFrame.bottomMargin=W.convertPixelToPoint(e.textFrame.marginBottom),t.textFrame.blocks=[];for(var i=0;i<e.textFrame.childWidgets.length;i++){var n=e.textFrame.childWidgets[i];this.writeBlock(n,0,t.textFrame.blocks)}}},e.prototype.writeChart=function(e,t){t.chartLegend={},t.chartTitleArea={},t.chartArea={},t.plotArea={},t.chartCategory=[],t.chartSeries=[],t.chartPrimaryCategoryAxis={},t.chartPrimaryValueAxis={},this.writeChartTitleArea(e.chartTitleArea,t.chartTitleArea),this.writeChartArea(e.chartArea,t.chartArea),this.writeChartArea(e.chartPlotArea,t.plotArea),this.writeChartCategory(e,t.chartCategory),this.createChartSeries(e,t.chartSeries),this.writeChartLegend(e.chartLegend,t.chartLegend),this.writeChartCategoryAxis(e.chartPrimaryCategoryAxis,t.chartPrimaryCategoryAxis),this.writeChartCategoryAxis(e.chartPrimaryValueAxis,t.chartPrimaryValueAxis),void 0!==e.chartDataTable.showSeriesKeys&&(t.chartDataTable={},this.writeChartDataTable(e.chartDataTable,t.chartDataTable)),t.chartTitle=e.title,t.chartType=e.type,t.gapWidth=e.chartGapWidth,t.overlap=e.chartOverlap,t.height=W.convertPixelToPoint(e.height),t.width=W.convertPixelToPoint(e.width)},e.prototype.writeChartTitleArea=function(e,t){t.fontName=e.chartfontName,t.fontSize=e.chartFontSize,t.layout={},t.dataFormat=this.writeChartDataFormat(e.dataFormat),this.writeChartLayout(e.layout,t.layout)},e.prototype.writeChartDataFormat=function(e){var t={};return t.fill={},t.line={},t.fill.foreColor=e.fill.color,t.fill.rgb=e.fill.rgb,t.line.color=e.line.color,t.line.rgb=e.line.rgb,t},e.prototype.writeChartLayout=function(e,t){t.layoutX=e.chartLayoutLeft,t.layoutY=e.chartLayoutTop},e.prototype.writeChartArea=function(e,t){t.foreColor=e.chartForeColor},e.prototype.writeChartLegend=function(e,t){t.position=e.chartLegendPostion,t.chartTitleArea={},this.writeChartTitleArea(e.chartTitleArea,t.chartTitleArea)},e.prototype.writeChartCategoryAxis=function(e,t){t.chartTitle=e.categoryAxisTitle,t.chartTitleArea={},this.writeChartTitleArea(e.chartTitleArea,t.chartTitleArea),t.categoryType=e.categoryAxisType,t.fontSize=e.axisFontSize,t.fontName=e.axisFontName,t.numberFormat=e.categoryNumberFormat,t.maximumValue=e.max,t.minimumValue=e.min,t.majorUnit=e.interval,t.hasMajorGridLines=e.majorGridLines,t.hasMinorGridLines=e.minorGridLines,t.majorTickMark=e.majorTick,t.minorTickMark=e.minorTick,t.tickLabelPosition=e.tickPosition},e.prototype.writeChartDataTable=function(e,t){t.showSeriesKeys=e.showSeriesKeys,t.hasHorzBorder=e.hasHorzBorder,t.hasVertBorder=e.hasVertBorder,t.hasBorders=e.hasBorders},e.prototype.writeChartCategory=function(e,t){var i=e.chartCategory;t.chartData=[];for(var n=0;n<i.length;n++){var r=i[n],o=this.createChartCategory(r,e.chartType);t.push(o)}},e.prototype.createChartCategory=function(e,t){var i={};return i.chartData=[],this.writeChartData(e,i.chartData,t),i.categoryXName=e.categoryXName,i},e.prototype.writeChartData=function(e,t,i){for(var n=e.chartData,r=0;r<n.length;r++){var o=n[r],s=this.createChartData(o,i);t.push(s)}},e.prototype.createChartData=function(e,t){var i={};return i.yValue=e.yValue,"Bubble"===t&&(i.size=e.size),i},e.prototype.createChartSeries=function(e,t){for(var i=e.chartSeries,n=e.chartType,r=0;r<i.length;r++){var o=i[r],s=this.writeChartSeries(o,n);t.push(s)}},e.prototype.writeChartSeries=function(e,i){var n="Pie"===i||"Doughnut"===i,r={},o={},s=e.errorBar;if(r.dataPoints=[],r.seriesName=e.seriesName,n&&(t.isNullOrUndefined(e.firstSliceAngle)||(r.firstSliceAngle=e.firstSliceAngle),"Doughnut"===i&&(r.holeSize=e.doughnutHoleSize)),!t.isNullOrUndefined(e.dataLabels.labelPosition)){var a=this.writeChartDataLabels(e.dataLabels);r.dataLabel=a}if(!t.isNullOrUndefined(e.seriesFormat.markerStyle)){var l={},d=e.seriesFormat;l.markerStyle=d.markerStyle,l.markerSize=d.numberValue,l.markerColor=d.markerColor,r.seriesFormat=l}if(t.isNullOrUndefined(s.type)||(o.type=s.type,o.direction=s.direction,o.endStyle=s.endStyle,o.numberValue=s.numberValue,r.errorBar=s),e.trendLines.length>0){r.trendLines=[];for(c=0;c<e.trendLines.length;c++){var h=this.writeChartTrendLines(e.trendLines[c]);r.trendLines.push(h)}}for(var c=0;c<e.chartDataFormat.length;c++){d=this.writeChartDataFormat(e.chartDataFormat[c]);r.dataPoints.push(d)}return r},e.prototype.writeChartDataLabels=function(e){var t={};return t.position=e.position,t.fontName=e.fontName,t.fontColor=e.fontColor,t.fontSize=e.fontSize,t.isLegendKey=e.isLegendKey,t.isBubbleSize=e.isBubbleSize,t.isCategoryName=e.isCategoryName,t.isSeriesName=e.isSeriesName,t.isValue=e.isValue,t.isPercentage=e.isPercentage,t.isLeaderLines=e.isLeaderLines,t},e.prototype.writeChartTrendLines=function(e){var t={};return t.name=e.trendLineName,t.type=e.trendLineType,t.forward=e.forwardValue,t.backward=e.backwardValue,t.intercept=e.interceptValue,t.isDisplayEquation=e.isDisplayEquation,t.isDisplayRSquared=e.isDisplayRSquared,t},e.prototype.writeLines=function(e,t,i,n){for(var r=t,o=this.endLine instanceof we&&this.endLine.paragraph===e,s=o?this.endLine.indexInOwner:e.childWidgets.length-1,a=r;a<=s;a++){var l=e.childWidgets[a];this.endLine===l||t===a&&0!==i?this.writeLine(l,i,n):this.writeInlines(e,l,n)}return o},e.prototype.writeLine=function(e,t,i){this.contentInline=[];var n=!1,r=!1,o=e===this.endLine,s=e.clone(),a=e.paragraph.paragraphFormat.bidi;(a||this.documentHelper.layout.isContainsRtl(s))&&this.documentHelper.layout.reArrangeElementsForRtl(s,a);for(var l=!1,d=!1,h=0,c=0;c<s.children.length;c++){var p=s.children[c];if(!(p instanceof Ke)){var u=void 0;if(h+=p.length,l=h>t,p instanceof Le&&(l||(n=0===p.type),r=!0),p instanceof Ie&&p.hasOwnProperty("contentControlProperties")&&l&&!r&&(n=!0),p instanceof Le&&(n&&1===p.type&&(n=!1),r&&1===p.type&&(r=!1)),d=o&&h>=this.endOffset,l&&!n)if(p instanceof Le||this.startContent||this.blockContent){if(d){this.startContent=!1;break}this.writeInlinesContentControl(p,e,i,c)}else{if(u=this.writeInline(p),i[i.length]=u,h>t||d){if(u.hasOwnProperty("text")){var g=h-p.length,m=t-g,f=d?this.endOffset-g:p.length;u.text=u.text.substring(m,f)}t=-1}if(!this.isExport&&!u.hasOwnProperty("text")&&this.owner.enableTrackChanges&&!this.isPartialExport){var v=i.length-1;i.splice(v,1)}if(d)break}}}},e.prototype.writeInlinesFootNote=function(e,t,i,n){var r={};r.footnoteType=t.footnoteType,r.characterFormat={},r.characterFormat=this.writeCharacterFormat(t.characterFormat),r.blocks=[];for(var o=0;o<t.blocks.length;o++)this.writeBlock(t.blocks[o],0,r.blocks);return r.symbolCode=t.symbolCode,r.symbolFontName=t.symbolFontName,r.customMarker=t.customMarker,r},e.prototype.writeInlinesContentControl=function(e,i,n,r){if(e instanceof Le&&"Block"===e.contentControlWidgetType)return this.isBlockClosed=!1,this.blockContent&&0===e.type?(this.nestedBlockContent=!0,!0):this.nestedBlockContent&&1===e.type?(this.nestedBlockContent=!1,!0):(this.blockContent=0===e.type,i.children[r-1]instanceof Le&&"Block"===i.children[r-1].contentControlWidgetType&&(this.blockContent=!0),this.blockContent||(this.isBlockClosed=!0),!0);if(e instanceof Le){if(this.startContent&&0===e.type)return this.nestedContent=!0,!0;if(this.startContent&&this.nestedContent){if((a={}).inlines=this.contentInline,this.contentInline.length>0){var o=this.nestedContentProperty(i.children[r+1],a);n.push(o),this.contentInline=[]}return this.multipleLineContent&&(a=n[n.length-1],this.nestedContentProperty(i.children[r+1],a),this.multipleLineContent=!1),this.nestedContent=!1,!0}return this.contentType=e.contentControlWidgetType,this.startContent=0===e.type,!0}if(this.startContent&&"Inline"===this.contentType)if(this.multipleLineContent)this.inlineContentControl(e,i.children[r+1],n),this.contentInline=[];else{var s=this.inlineContentControl(e,i.children[r+1]);if(!t.isNullOrUndefined(s)){if(!this.nestedContent||!this.multipleLineContent)return n.push(s),this.contentInline=[],!1;(a={}).inlines=this.contentInline,n.push(a)}}else{var a=this.writeInline(e);t.isNullOrUndefined(a)||n.push(a)}},e.prototype.createParagraph=function(e){var t={},i=!1;if(!this.documentHelper.selection||this.documentHelper.selection.isEmpty||this.isExport)i=!0;else{var n=this.documentHelper.selection.end;this.documentHelper.selection.isForward||(n=this.documentHelper.selection.start);var r=n.paragraph.childWidgets[n.paragraph.childWidgets.length-1];i=this.documentHelper.selection.isParagraphLastLine(r)&&n.currentWidget===r&&n.offset===this.documentHelper.selection.getLineLength(r)+1}return t.paragraphFormat=this.writeParagraphFormat(i?e.paragraphFormat:new P(e)),t.characterFormat=this.writeCharacterFormat(i?e.characterFormat:new H(e)),t.inlines=[],t},e.prototype.writeCharacterFormat=function(e,t){var i={};return W.writeCharacterFormat(i,t,e),i.boldBidi=t?e.bold:e.getValue("bold"),i.italicBidi=t?e.italic:e.getValue("italic"),i.fontSizeBidi=t?e.fontSize:e.getValue("fontSize"),i.fontFamilyBidi=t?e.fontFamily:e.getValue("fontFamily"),this.writeInlineStyles&&!t&&(i.inlineFormat=this.writeCharacterFormat(e,!0)),i},e.prototype.writeParagraphFormat=function(e,i){var n={};return n.leftIndent=i?e.leftIndent:e.getValue("leftIndent"),n.rightIndent=i?e.rightIndent:e.getValue("rightIndent"),n.firstLineIndent=i?e.firstLineIndent:e.getValue("firstLineIndent"),n.textAlignment=i?e.textAlignment:e.getValue("textAlignment"),n.beforeSpacing=i?e.beforeSpacing:e.getValue("beforeSpacing"),n.afterSpacing=i?e.afterSpacing:e.getValue("afterSpacing"),n.lineSpacing=i?e.lineSpacing:e.getValue("lineSpacing"),n.lineSpacingType=i?e.lineSpacingType:e.getValue("lineSpacingType"),n.styleName=t.isNullOrUndefined(e.baseStyle)?void 0:e.baseStyle.name,n.outlineLevel=i?e.outlineLevel:e.getValue("outlineLevel"),n.listFormat=this.writeListFormat(e.listFormat,i),n.tabs=this.writeTabs(e.tabs),n.bidi=i?e.bidi:e.getValue("bidi"),n.contextualSpacing=i?e.contextualSpacing:e.getValue("contextualSpacing"),this.writeInlineStyles&&!i&&(n.inlineFormat=this.writeParagraphFormat(e,!0)),n},e.prototype.writeTabs=function(e){if(!(t.isNullOrUndefined(e)||e.length<1)){for(var i=[],n=0;n<e.length;n++){var r=e[n],o={};o.position=r.position,o.deletePosition=r.deletePosition,o.tabJustification=r.tabJustification,o.tabLeader=r.tabLeader,i.push(o)}return i}},e.prototype.writeListFormat=function(e,i){var n={},r=e.getValue("listId");t.isNullOrUndefined(r)||(n.listId=r,this.lists.indexOf(e.listId)<0&&this.lists.push(e.listId));var o=e.getValue("listLevelNumber");return t.isNullOrUndefined(o)||(n.listLevelNumber=o),n},e.prototype.writeTable=function(e,t,i,n){var r=e.childWidgets[i];if(!(r instanceof ye&&this.writeRow(r,t.rows))){var o=e;do{o=(e=o).nextSplitWidget}while(o instanceof ge);return o=e.nextRenderedWidget,o instanceof ge&&o.containerWidget.index===e.containerWidget.index?o:void 0}},e.prototype.writeRow=function(e,i){if(!(e instanceof ye))return!1;var n=this.createRow(e);i.push(n);for(var r=0;r<e.childWidgets.length;r++){var o=e.childWidgets[r];if(o instanceof be&&e.index===o.rowIndex&&(t.isNullOrUndefined(this.startColumnIndex)||o.columnIndex>=this.startColumnIndex)&&(t.isNullOrUndefined(this.endColumnIndex)||o.columnIndex<this.endColumnIndex)&&this.writeCell(o,n.cells))return!0}var s=e;do{(s=(e=s).nextRenderedWidget)&&e.ownerTable.index!==s.ownerTable.index&&(s=void 0)}while(s instanceof ye&&s.index===e.index);return this.writeRow(s,i)},e.prototype.writeCell=function(e,t){var i=this.createCell(e);t.push(i);var n=e.firstChild;do{n=this.writeBlock(n,0,i.blocks)}while(n);return this.endCell instanceof be&&this.endCell.cellFormat===e.cellFormat},e.prototype.createTable=function(e){var t={};t.rows=[],t.grid=[];for(var i=0;i<e.tableHolder.columns.length;i++)t.grid[i]=e.tableHolder.columns[i].preferredWidth;return t.tableFormat=this.writeTableFormat(e.tableFormat),t.description=e.description,t.title=e.title,t.columnCount=e.tableHolder.columns.length,t},e.prototype.createRow=function(e){var t={};return t.cells=[],t.rowFormat=this.writeRowFormat(e.rowFormat),e.hasOwnProperty("contentControlProperties")&&(t.contentControlProperties=this.contentControlProperty(e.contentControlProperties)),t},e.prototype.createCell=function(e){var t={};return t.blocks=[],t.cellFormat=this.writeCellFormat(e.cellFormat),t.columnIndex=e.columnIndex,e.hasOwnProperty("contentControlProperties")&&(t.contentControlProperties=this.contentControlProperty(e.contentControlProperties)),t},e.prototype.writeShading=function(e){var t={};return t.backgroundColor=e.hasValue("backgroundColor")?e.backgroundColor:void 0,t.foregroundColor=e.hasValue("foregroundColor")?e.foregroundColor:void 0,t.textureStyle=e.hasValue("textureStyle")?e.textureStyle:void 0,t},e.prototype.writeBorder=function(e){var t={};return t.color=e.hasValue("color")?e.color:void 0,t.hasNoneStyle=e.hasValue("hasNoneStyle")?e.hasNoneStyle:void 0,t.lineStyle=e.hasValue("lineStyle")?e.lineStyle:void 0,t.lineWidth=e.hasValue("lineWidth")?e.lineWidth:void 0,t.shadow=e.hasValue("shadow")?e.shadow:void 0,t.space=e.hasValue("space")?e.space:void 0,t},e.prototype.writeBorders=function(e){var t={};return t.top=this.writeBorder(e.top),t.left=this.writeBorder(e.left),t.right=this.writeBorder(e.right),t.bottom=this.writeBorder(e.bottom),t.diagonalDown=this.writeBorder(e.diagonalDown),t.diagonalUp=this.writeBorder(e.diagonalUp),t.horizontal=this.writeBorder(e.horizontal),t.vertical=this.writeBorder(e.vertical),t},e.prototype.writeCellFormat=function(e){var t={};return t.borders=this.writeBorders(e.borders),t.shading=this.writeShading(e.shading),t.topMargin=e.hasValue("topMargin")?e.topMargin:void 0,t.rightMargin=e.hasValue("rightMargin")?e.rightMargin:void 0,t.leftMargin=e.hasValue("leftMargin")?e.leftMargin:void 0,t.bottomMargin=e.hasValue("bottomMargin")?e.bottomMargin:void 0,t.preferredWidth=e.hasValue("preferredWidth")?e.preferredWidth:void 0,t.preferredWidthType=e.hasValue("preferredWidthType")?e.preferredWidthType:void 0,t.cellWidth=e.hasValue("cellWidth")?e.cellWidth:void 0,t.columnSpan=e.columnSpan,t.rowSpan=e.rowSpan,t.verticalAlignment=e.hasValue("verticalAlignment")?e.verticalAlignment:void 0,t},e.prototype.writeRowFormat=function(e){var t={},i=[];t.height=e.hasValue("height")?e.height:void 0,t.allowBreakAcrossPages=e.hasValue("allowBreakAcrossPages")?e.allowBreakAcrossPages:void 0,t.heightType=e.hasValue("heightType")?e.heightType:void 0,t.isHeader=e.hasValue("isHeader")?e.isHeader:void 0,t.borders=this.writeBorders(e.borders),t.gridBefore=e.gridBefore,t.gridBeforeWidth=e.hasValue("gridBeforeWidth")?e.gridBeforeWidth:void 0,t.gridBeforeWidthType=e.hasValue("gridBeforeWidthType")?e.gridBeforeWidthType:void 0,t.gridAfter=e.gridAfter,t.gridAfterWidth=e.hasValue("gridAfterWidth")?e.gridAfterWidth:void 0,t.gridAfterWidthType=e.hasValue("gridAfterWidthType")?e.gridAfterWidthType:void 0,t.leftMargin=e.hasValue("leftMargin")?e.leftMargin:void 0,t.topMargin=e.hasValue("topMargin")?e.topMargin:void 0,t.rightMargin=e.hasValue("rightMargin")?e.rightMargin:void 0,t.bottomMargin=e.hasValue("bottomMargin")?e.bottomMargin:void 0,t.leftIndent=e.hasValue("leftIndent")?e.leftIndent:void 0;for(var n=0;n<e.revisions.length;n++)t.revisionIds=this.writeRowRevisions(e.revisions[n],i);return t},e.prototype.writeRowRevisions=function(e,t){return-1===this.selectedRevisionId.indexOf(e.revisionID)&&this.selectedRevisionId.push(e.revisionID),t.push(e.revisionID),t},e.prototype.writeTableFormat=function(e){var t={};return t.borders=this.writeBorders(e.borders),t.shading=this.writeShading(e.shading),t.cellSpacing=e.hasValue("cellSpacing")?e.cellSpacing:void 0,t.leftIndent=e.hasValue("leftIndent")?e.leftIndent:void 0,t.tableAlignment=e.hasValue("tableAlignment")?e.tableAlignment:void 0,t.topMargin=e.hasValue("topMargin")?e.topMargin:void 0,t.rightMargin=e.hasValue("rightMargin")?e.rightMargin:void 0,t.leftMargin=e.hasValue("leftMargin")?e.leftMargin:void 0,t.bottomMargin=e.hasValue("bottomMargin")?e.bottomMargin:void 0,t.preferredWidth=e.hasValue("preferredWidth")?e.preferredWidth:void 0,t.preferredWidthType=e.hasValue("preferredWidthType")?e.preferredWidthType:void 0,t.bidi=e.hasValue("bidi")?e.bidi:void 0,t.allowAutoFit=e.hasValue("allowAutoFit")?e.allowAutoFit:void 0,t},e.prototype.footnotes=function(e){for(var t=0;t<e.footnotes.separator.length;t++)this.seprators(e)},e.prototype.seprators=function(e){if(e.footnotes.separator.length>0){this.document.footnotes={},this.document.footnotes.separator=[];for(t=0;t<e.footnotes.separator.length;t++)this.writeBlock(e.footnotes.separator[t],0,this.document.footnotes.separator)}if(e.footnotes.continuationSeparator.length>0){this.document.footnotes.continuationSeparator=[];for(t=0;t<e.footnotes.continuationSeparator.length;t++)this.writeBlock(e.footnotes.continuationSeparator[t],0,this.document.footnotes.continuationSeparator)}if(e.footnotes.continuationNotice.length>0){this.document.footnotes.continuationNotice=[];for(var t=0;t<e.footnotes.continuationNotice.length;t++)this.writeBlock(e.footnotes.continuationNotice[t],0,this.document.footnotes.continuationNotice)}},e.prototype.endnotes=function(e){for(var t=0;t<this.documentHelper.endnotes.separator.length;t++)this.endnoteSeparator(e)},e.prototype.endnoteSeparator=function(e){if(e.endnotes.separator.length>0){this.document.endnotes={},this.document.endnotes.separator=[];for(t=0;t<e.endnotes.separator.length;t++)this.writeBlock(e.endnotes.separator[t],0,this.document.endnotes.separator)}if(e.endnotes.continuationSeparator.length>0){this.document.endnotes.continuationSeparator=[];for(t=0;t<e.endnotes.continuationSeparator.length;t++)this.writeBlock(e.endnotes.continuationSeparator[t],0,this.document.endnotes.continuationSeparator)}if(e.endnotes.continuationNotice.length>0){this.document.endnotes.continuationNotice=[];for(var t=0;t<e.endnotes.continuationNotice.length;t++)this.writeBlock(e.endnotes.continuationNotice[t],0,this.document.endnotes.continuationNotice)}},e.prototype.writeStyles=function(e){this.document.styles=[];for(var t=0;t<e.styles.length;t++)this.document.styles.push(this.writeStyle(e.styles.getItem(t)))},e.prototype.writeStyle=function(e){var i={};return i.name=e.name,"Paragraph"===e.type&&(i.type="Paragraph",i.paragraphFormat=this.writeParagraphFormat(e.paragraphFormat),i.characterFormat=this.writeCharacterFormat(e.characterFormat)),"Character"===e.type&&(i.type="Character",i.characterFormat=this.writeCharacterFormat(e.characterFormat)),t.isNullOrUndefined(e.basedOn)||(i.basedOn=e.basedOn.name),t.isNullOrUndefined(e.link)||(i.link=e.link.name),t.isNullOrUndefined(e.next)||(i.next=e.next.name),i},e.prototype.writeRevisions=function(e){this.document.revisions=[];for(var t=0;t<e.owner.revisions.changes.length;t++)(this.isExport||!this.isExport&&-1!==this.selectedRevisionId.indexOf(e.owner.revisions.changes[t].revisionID))&&this.document.revisions.push(this.writeRevision(e.owner.revisions.changes[t]))},e.prototype.writeRevision=function(e){var t={};return t.author=e.author,t.date=e.date,t.revisionType=e.revisionType,t.revisionId=e.revisionID,t},e.prototype.writeComments=function(e){this.document.comments=[];for(var t=0;t<e.comments.length;t++)(this.isExport||!this.isExport&&-1!==this.selectedCommentsId.indexOf(this.documentHelper.comments[t].commentId))&&this.document.comments.push(this.writeComment(this.documentHelper.comments[t]))},e.prototype.writeCustomXml=function(e){this.document.customXml=[];for(var t=0;t<e.customXmlData.length;t++){var i={},n=e.customXmlData.keys[t];i.itemID=n;var r=this.documentHelper.customXmlData.get(n);i.xml=r,this.document.customXml.push(i)}},e.prototype.writeComment=function(e){var t={};t.commentId=e.commentId,t.author=e.author,t.date=e.date,t.blocks=[],t.blocks.push(this.commentInlines(e.text)),t.done=e.isResolved,t.replyComments=[];for(var i=0;i<e.replyComments.length;i++)t.replyComments.push(this.writeComment(e.replyComments[i]));return t},e.prototype.commentInlines=function(e){var t={};return t.inlines=[{text:e}],t},e.prototype.writeLists=function(e){var t=[];this.document.lists=[];for(n=0;n<e.lists.length;n++){var i=e.lists[n];this.lists.indexOf(i.listId)>-1&&(this.document.lists.push(this.writeList(i)),t.indexOf(i.abstractListId)<0&&t.push(i.abstractListId))}this.document.abstractLists=[];for(var n=0;n<e.abstractLists.length;n++){var r=e.abstractLists[n];t.indexOf(r.abstractListId)>-1&&this.document.abstractLists.push(this.writeAbstractList(r))}},e.prototype.writeAbstractList=function(e){var t={};t.abstractListId=e.abstractListId,t.levels=[];for(var i=0;i<e.levels.length;i++)t.levels[i]=this.writeListLevel(e.levels[i]);return t},e.prototype.writeList=function(e){var t={};t.abstractListId=e.abstractListId,t.levelOverrides=[];for(var i=0;i<e.levelOverrides.length;i++)t.levelOverrides.push(this.writeLevelOverrides(e.levelOverrides[i]));return t.listId=e.listId,t},e.prototype.writeLevelOverrides=function(e){var t={};return t.levelNumber=e.levelNumber,e.overrideListLevel&&(t.overrideListLevel=this.writeListLevel(e.overrideListLevel)),t.startAt=e.startAt,t},e.prototype.writeListLevel=function(e){var t={};return t.characterFormat=this.writeCharacterFormat(e.characterFormat),t.paragraphFormat=this.writeParagraphFormat(e.paragraphFormat),t.followCharacter=e.followCharacter,t.listLevelPattern=e.listLevelPattern,t.numberFormat=e.numberFormat,t.restartLevel=e.restartLevel,t.startAt=e.startAt,t},e.prototype.getParentBlock=function(e){return e.isInsideTable&&(e=this.owner.documentHelper.layout.getParentTable(e)),e},e.prototype.destroy=function(){this.lists=void 0,this.endLine=void 0,this.endOffset=void 0,this.documentHelper=void 0},e}(),ai=function(){function e(e){var i=this;this.displayText="",this.navigationUrl=void 0,this.bookmarkDropdown=void 0,this.bookmarkCheckbox=void 0,this.bookmarks=[],this.onKeyUpOnUrlBox=function(e){if(13===e.keyCode)return void(""!==i.displayTextBox.value&&""!==i.urlTextBox.value&&i.onInsertHyperlink());var t=i.urlTextBox.value;"www."===t.substring(0,4).toLowerCase()&&(i.urlTextBox.value="http://"+t),""===i.displayText&&(i.displayTextBox.value=t),i.enableOrDisableInsertButton()},this.onKeyUpOnDisplayBox=function(){i.displayText=i.displayTextBox.value,i.enableOrDisableInsertButton()},this.onInsertButtonClick=function(){i.onInsertHyperlink()},this.onCancelButtonClick=function(){i.documentHelper.dialog.hide(),i.clearValue(),i.documentHelper.updateFocus()},this.loadHyperlinkDialog=function(){i.documentHelper.updateFocus(),i.bookmarks=[];for(var e=0;e<i.documentHelper.bookmarks.keys.length;e++){var n=i.documentHelper.bookmarks.keys[e];0!==n.indexOf("_")&&i.bookmarks.push(n)}var r=i.documentHelper.selection.getHyperlinkField();if(t.isNullOrUndefined(r))i.displayText=i.documentHelper.selection.getText(!0),""!==i.displayText&&(-1!==i.displayText.indexOf(String.fromCharCode(65532))||-1!==i.displayText.indexOf("\r")&&-1!==i.displayText.lastIndexOf("\r")&&-1!==i.displayText.slice(0,-1).indexOf("\r")?(i.displayTextBox.value="<<Selection in document>>",i.displayTextBox.disabled=!0):i.displayTextBox.value=i.displayText);else{if(!t.isNullOrUndefined(r.fieldSeparator)){var o=i.documentHelper.selection.getHyperlinkDisplayText(r.fieldSeparator.line.paragraph,r.fieldSeparator,r.fieldEnd,!1,void 0);i.displayText=o.displayText,i.displayTextBox.disabled=o.isNestedField}i.displayTextBox.value=i.displayText;var s=i.documentHelper.selection.getLinkText(r);i.urlTextBox.value=i.navigationUrl=s,i.documentHelper.dialog.header=i.localObj.getConstant("Edit Hyperlink")}i.bookmarkDiv.style.display="none",i.addressText.style.display="block",i.urlTextBox.style.display="block",i.bookmarkCheckbox.checked=!1,i.bookmarkDropdown.dataSource=i.documentHelper.bookmarks.keys,i.insertButton=document.getElementsByClassName("e-hyper-insert")[0],i.enableOrDisableInsertButton(),i.urlTextBox.focus(),"none"!==i.documentHelper.selection.caret.style.display&&(i.documentHelper.selection.caret.style.display="none")},this.closeHyperlinkDialog=function(){i.clearValue(),i.documentHelper.updateFocus()},this.onUseBookmarkChange=function(e){e.checked?(i.bookmarkDiv.style.display="block",i.bookmarkDropdown.dataSource=i.bookmarks,i.addressText.style.display="none",i.urlTextBox.style.display="none"):(i.bookmarkDiv.style.display="none",i.addressText.style.display="block",i.urlTextBox.style.display="block")},this.onBookmarkchange=function(){""!==i.bookmarkDropdown.value&&(i.insertButton.disabled=!1)},this.documentHelper=e}return e.prototype.getModuleName=function(){return"HyperlinkDialog"},e.prototype.initHyperlinkDialog=function(e,i){var n=this.documentHelper.owner.containerId+"_insert_hyperlink";this.target=t.createElement("div",{id:n,className:"e-de-hyperlink"});var o=t.createElement("div"),a=t.createElement("div",{className:"e-de-hyperlink-dlg-title",innerHTML:e.getConstant("Text to display")});this.displayTextBox=t.createElement("input",{id:this.documentHelper.owner.containerId+"_display_text",className:"e-input e-de-hyperlink-dlg-input"}),this.displayTextBox.addEventListener("keyup",this.onKeyUpOnDisplayBox),o.appendChild(a),o.appendChild(this.displayTextBox),this.addressText=t.createElement("div",{className:"e-de-hyperlink-dlg-title",innerHTML:e.getConstant("Address")}),this.urlTextBox=t.createElement("input",{id:this.documentHelper.owner.containerId+"_url_text",className:"e-input e-de-hyperlink-dlg-input",attrs:{autofocus:"true"}}),this.urlTextBox.addEventListener("input",this.onKeyUpOnUrlBox),this.urlTextBox.addEventListener("keyup",this.onKeyUpOnUrlBox),o.appendChild(this.addressText),o.appendChild(this.urlTextBox),this.bookmarkDiv=t.createElement("div",{styles:"display:none;"});var l=t.createElement("div",{className:"e-de-hyperlink-dlg-title",innerHTML:e.getConstant("Bookmark")}),d=t.createElement("div",{className:"e-de-hyperlink-dlg-bookmark"}),h=t.createElement("input",{id:"e-de-hyperlink-dlg-bookmark-value"});d.appendChild(h),this.bookmarkDropdown=new s.DropDownList({dataSource:[],change:this.onBookmarkchange,popupHeight:"230px",width:"230px",noRecordsTemplate:e.getConstant("No bookmarks found")}),this.bookmarkDropdown.appendTo(h),this.bookmarkDiv.appendChild(l),this.bookmarkDiv.appendChild(d),o.appendChild(this.bookmarkDiv);var c=t.createElement("div",{className:"e-de-hyperlink-bookmark-check e-de-hyperlink-dlg-title"}),p=t.createElement("input",{attrs:{type:"checkbox"},id:this.target.id+"_bookmark",className:this.target.id+"_bookmarkcheck"});c.appendChild(p),this.bookmarkCheckbox=new r.CheckBox({label:e.getConstant("Use bookmarks"),enableRtl:i,change:this.onUseBookmarkChange}),this.bookmarkCheckbox.appendTo(p),o.appendChild(c),this.target.appendChild(o)},e.prototype.show=function(){this.localObj=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale),this.localObj.setLocale(this.documentHelper.owner.locale),this.target||this.initHyperlinkDialog(this.localObj,this.documentHelper.owner.enableRtl),this.documentHelper.dialog.header=this.localObj.getConstant("Insert Hyperlink"),this.documentHelper.dialog.height="auto",this.documentHelper.dialog.width="auto",this.documentHelper.dialog.content=this.target,this.documentHelper.dialog.buttons=[{click:this.onInsertButtonClick,buttonModel:{content:this.localObj.getConstant("Ok"),cssClass:"e-flat e-hyper-insert",isPrimary:!0}},{click:this.onCancelButtonClick,buttonModel:{content:this.localObj.getConstant("Cancel"),cssClass:"e-flat e-hyper-cancel"}}],this.documentHelper.dialog.dataBind(),this.documentHelper.dialog.beforeOpen=this.loadHyperlinkDialog,this.documentHelper.dialog.close=this.closeHyperlinkDialog,this.documentHelper.dialog.show()},e.prototype.hide=function(){this.closeHyperlinkDialog()},e.prototype.enableOrDisableInsertButton=function(){t.isNullOrUndefined(this.insertButton)||(this.insertButton.disabled=""===this.urlTextBox.value||""===this.displayTextBox.value)},e.prototype.onInsertHyperlink=function(){var e=this.displayTextBox.value.trim(),i=this.urlTextBox.value.trim(),n=!1;if(t.isNullOrUndefined(this.bookmarkDropdown.value)||""===this.bookmarkDropdown.value||(i=this.bookmarkDropdown.value,n=!0),""===i)return void this.documentHelper.hideDialog();if(e=""===e&&""!==i?i:this.displayTextBox.value,t.isNullOrUndefined(this.navigationUrl)){var r=(this.documentHelper.selection.text!==e||-1===this.documentHelper.selection.text.indexOf("\r"))&&!this.displayTextBox.disabled;this.documentHelper.owner.editorModule.insertHyperlinkInternal(i,e,r,n)}else this.documentHelper.owner.editorModule.editHyperlink(this.documentHelper.selection,i,e,n);this.documentHelper.hideDialog(),this.navigationUrl=void 0},e.prototype.clearValue=function(){this.displayTextBox.value="",this.urlTextBox.value="",this.displayText="",this.displayTextBox.disabled=!1,this.bookmarks=[]},e.prototype.destroy=function(){this.displayTextBox&&(this.displayTextBox.innerHTML="",this.displayTextBox=void 0),this.urlTextBox&&(this.urlTextBox.parentElement.removeChild(this.urlTextBox),this.urlTextBox=void 0),this.documentHelper=void 0,t.isNullOrUndefined(this.target)||(this.target.parentElement&&this.target.parentElement.removeChild(this.target),this.target.innerHTML="",this.target=void 0)},e}(),li=function(){function e(e){var i=this;this.keyUpInsertTable=function(e){13===e.keyCode&&""!==i.rowsCountBox.value&&""!==i.columnsCountBox.value&&i.onInsertTableClick()},this.onCancelButtonClick=function(){i.documentHelper.dialog.hide(),i.documentHelper.updateFocus()},this.onInsertTableClick=function(){var e=i.rowValueTextBox.value,n=i.columnValueTexBox.value;t.isNullOrUndefined(e)&&t.isNullOrUndefined(n)||i.documentHelper.owner.editor.insertTable(e,n),i.documentHelper.hideDialog()},this.documentHelper=e}return e.prototype.getModuleName=function(){return"TableDialog"},e.prototype.initTableDialog=function(e){var i=this.documentHelper.owner.containerId+"_insert_Table";this.target=t.createElement("div",{id:i,className:"e-de-insert-table"});var n=t.createElement("div"),r=t.createElement("div",{className:"e-de-insert-table-dlg-sub-header",innerHTML:e.getConstant("Number of columns")}),o=t.createElement("div",{className:"e-de-insert-table-dlg-input"});this.columnsCountBox=t.createElement("input",{attrs:{type:"text"},id:this.documentHelper.owner.containerId+"_column"}),o.appendChild(this.columnsCountBox);var s=t.createElement("div",{className:"e-de-insert-table-dlg-sub-header",innerHTML:e.getConstant("Number of rows")}),l=t.createElement("div");this.rowsCountBox=t.createElement("input",{attrs:{type:"text"},id:this.documentHelper.owner.containerId+"row"}),l.appendChild(this.rowsCountBox),n.appendChild(r),n.appendChild(o),n.appendChild(s),n.appendChild(l),this.target.appendChild(n),this.columnsCountBox.addEventListener("keyup",this.keyUpInsertTable),this.rowsCountBox.addEventListener("keyup",this.keyUpInsertTable),this.rowValueTextBox=new a.NumericTextBox({format:"#",value:2,min:1,max:32767,enablePersistence:!1}),this.rowValueTextBox.appendTo(this.rowsCountBox),this.columnValueTexBox=new a.NumericTextBox({format:"#",value:2,min:1,max:63,enablePersistence:!1}),this.columnValueTexBox.appendTo(this.columnsCountBox)},e.prototype.show=function(){var e=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);e.setLocale(this.documentHelper.owner.locale),this.target||this.initTableDialog(e),"none"!==this.documentHelper.selection.caret.style.display&&(this.documentHelper.selection.caret.style.display="none"),this.documentHelper.dialog.header=e.getConstant("Insert Table"),this.documentHelper.dialog.height="auto",this.documentHelper.dialog.width="auto",this.documentHelper.dialog.content=this.target,this.documentHelper.dialog.beforeOpen=this.documentHelper.updateFocus,this.documentHelper.dialog.buttons=[{click:this.onInsertTableClick,buttonModel:{content:e.getConstant("Ok"),cssClass:"e-flat e-table-ok",isPrimary:!0}},{click:this.onCancelButtonClick,buttonModel:{content:e.getConstant("Cancel"),cssClass:"e-flat e-table-cancel"}}],this.rowValueTextBox.value=2,this.columnValueTexBox.value=2,this.documentHelper.dialog.close=this.documentHelper.updateFocus,this.documentHelper.dialog.dataBind(),this.columnValueTexBox.focusIn(),this.documentHelper.dialog.show()},e.prototype.destroy=function(){if(this.columnsCountBox&&(this.columnsCountBox.parentElement&&this.columnsCountBox.parentElement.removeChild(this.columnsCountBox),this.columnsCountBox=void 0),this.rowsCountBox&&(this.rowsCountBox.parentElement&&this.rowsCountBox.parentElement.removeChild(this.rowsCountBox),this.rowsCountBox=void 0),this.columnValueTexBox&&(this.columnValueTexBox.destroy(),this.columnValueTexBox=void 0),this.rowValueTextBox&&(this.rowValueTextBox.destroy(),this.rowValueTextBox=void 0),this.columnsCountBox=void 0,this.rowsCountBox=void 0,this.documentHelper=void 0,!t.isNullOrUndefined(this.target)){this.target.parentElement&&this.target.parentElement.removeChild(this.target);for(var e=0;e<this.target.childNodes.length;e++)this.target.removeChild(this.target.childNodes[e]),e--;this.target=void 0}},e}(),di=function(){function e(e){var t=this;this.onKeyUpOnTextBox=function(){t.enableOrDisableButton()},this.addBookmark=function(){t.documentHelper.owner.editorModule.insertBookmark(t.textBoxInput.value),t.documentHelper.hideDialog()},this.selectHandler=function(e){t.focusTextBox(e.text)},this.gotoBookmark=function(){t.documentHelper.selection.selectBookmark(t.textBoxInput.value)},this.deleteBookmark=function(){t.documentHelper.owner.editorModule.deleteBookmark(t.textBoxInput.value),t.show()},this.documentHelper=e}return e.prototype.getModuleName=function(){return"BookmarkDialog"},e.prototype.initBookmarkDialog=function(e,i,n){var s=this.documentHelper.owner.containerId+"_insert_bookmark";this.target=t.createElement("div",{id:s,className:"e-de-bookmark"});var a=e.getConstant("Bookmark name")+":",l=t.createElement("div",{innerHTML:a,className:"e-bookmark-dlgfields"});this.target.appendChild(l);var d=t.createElement("div",{className:"e-bookmark-common"});this.target.appendChild(d);var h=t.createElement("div",{className:"e-bookmark-list"});d.appendChild(h),n&&h.classList.add("e-de-rtl");var c=t.createElement("div",{className:"e-bookmark-textboxdiv"});h.appendChild(c),this.textBoxInput=t.createElement("input",{className:"e-input e-bookmark-textbox-input",id:"bookmark_text_box",attrs:{autofocus:"true"}}),this.textBoxInput.setAttribute("type","text"),c.appendChild(this.textBoxInput);var p=t.createElement("div",{className:"e-bookmark-listViewDiv",id:"bookmark_listview"});h.appendChild(p),this.listviewInstance=new o.ListView({dataSource:i,cssClass:"e-bookmark-listview"});var u=void 0===i||0===i.length;this.listviewInstance.appendTo(p),this.listviewInstance.addEventListener("select",this.selectHandler);var g=t.createElement("div",{className:"e-bookmark-button"});d.appendChild(g);var m=t.createElement("div",{className:"e-bookmark-addbutton"});g.appendChild(m);var f=t.createElement("button",{innerHTML:e.getConstant("Add"),id:"add",attrs:{type:"button"}});m.appendChild(f),this.addButton=new r.Button({cssClass:"e-button-custom"}),this.addButton.disabled=!0,this.addButton.appendTo(f),this.textBoxInput.addEventListener("input",this.onKeyUpOnTextBox),this.textBoxInput.addEventListener("keyup",this.onKeyUpOnTextBox),f.addEventListener("click",this.addBookmark);var v=t.createElement("div",{className:"e-bookmark-deletebutton"});g.appendChild(v);var y=t.createElement("button",{innerHTML:e.getConstant("Delete"),id:"delete",attrs:{type:"button"}});v.appendChild(y),this.deleteButton=new r.Button({cssClass:"e-button-custom"}),this.deleteButton.disabled=u,this.deleteButton.appendTo(y),y.addEventListener("click",this.deleteBookmark);var b=t.createElement("div",{className:"e-bookmark-gotobutton"});g.appendChild(b);var w=t.createElement("button",{innerHTML:e.getConstant("Go To"),id:"goto",attrs:{type:"button"}});b.appendChild(w),this.gotoButton=new r.Button({cssClass:"e-button-custom"}),this.gotoButton.disabled=u,this.gotoButton.appendTo(w),w.addEventListener("click",this.gotoBookmark)},e.prototype.show=function(){var e=this.documentHelper.getBookmarks(),i=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);if(i.setLocale(this.documentHelper.owner.locale),this.initBookmarkDialog(i,e,this.documentHelper.owner.enableRtl),this.documentHelper.dialog.header=i.getConstant("Bookmark"),this.documentHelper.dialog.height="auto",this.documentHelper.dialog.width="auto",this.documentHelper.dialog.content=this.target,this.documentHelper.dialog.beforeOpen=this.documentHelper.updateFocus,this.documentHelper.dialog.close=this.documentHelper.updateFocus,this.documentHelper.dialog.buttons=[{click:this.removeObjects.bind(this),buttonModel:{content:i.getConstant("Cancel"),cssClass:"e-flat e-hyper-insert",isPrimary:!0}}],this.documentHelper.dialog.dataBind(),!(void 0===e||0===e.length)){var n=e[0];this.listviewInstance.selectItem(n)}this.documentHelper.dialog.show()},e.prototype.enableOrDisableButton=function(){t.isNullOrUndefined(this.addButton)||(this.addButton.disabled=""===this.textBoxInput.value)},e.prototype.focusTextBox=function(e){this.textBoxInput.value=e;var t=document.getElementById("bookmark_text_box");t.setSelectionRange(0,e.length),t.focus(),this.enableOrDisableButton()},e.prototype.removeObjects=function(){this.documentHelper.hideDialog()},e.prototype.destroy=function(){this.textBoxInput&&(this.textBoxInput.remove(),this.textBoxInput=void 0),this.listviewInstance&&(this.listviewInstance.destroy(),this.listviewInstance=void 0)},e}(),hi=function(){function e(e){var i=this;this.loadTableofContentDialog=function(){i.documentHelper.updateFocus(),i.pageNumber.checked=!0,i.rightAlign.disabled=!1,i.rightAlign.checked=!0,i.tabLeader.enabled=!0,i.hyperlink.checked=!0,i.style.checked=!0,i.outline.checked=!0,i.outline.disabled=!1,i.showLevel.enabled=!0},this.closeTableOfContentDialog=function(){i.unWireEventsAndBindings(),i.documentHelper.updateFocus()},this.onCancelButtonClick=function(){i.documentHelper.dialog3.hide(),i.unWireEventsAndBindings(),i.documentHelper.updateFocus()},this.selectHandler=function(e){i.textBoxInput.value=e.text;var t=document.getElementById("toclist");t.setSelectionRange(0,e.text.length),t.focus()},this.showStyleDialog=function(){t.isNullOrUndefined(i.documentHelper.owner.styleDialogModule)||i.documentHelper.owner.styleDialogModule.show(i.textBoxInput.value)},this.reset=function(){i.showLevel.enabled=!0,i.showLevel.value=3,i.outline.disabled=!1,i.outline.checked=!0;var e=["1","2","3",null,null,null,null,null,null];i.changeByValue(e),i.normal.value=null},this.changeStyle=function(e){var t=e.srcElement.value;t!==i.getElementValue(e.srcElement)&&""!==t?i.showLevel.enabled=!1:(i.showLevel.enabled=!0,i.checkLevel())},this.changeHeadingStyle=function(e){var t=e.srcElement.value;i.showLevel.enabled=""===t,i.normal===e.srcElement&&(i.outline.checked=!1,i.outline.disabled=!0)},this.changePageNumberValue=function(e){e.checked?(i.rightAlign.checked=!0,i.rightAlign.disabled=!1,i.tabLeader.enabled=!0):(i.rightAlign.disabled=!0,i.tabLeader.enabled=!1)},this.changeRightAlignValue=function(e){e.checked?i.tabLeader.enabled=!0:i.tabLeader.enabled=!1},this.changeStyleValue=function(e){e.checked?(i.heading1.disabled=!1,i.heading2.disabled=!1,i.heading3.disabled=!1,i.heading4.disabled=!1,i.heading5.disabled=!1,i.heading6.disabled=!1,i.heading7.disabled=!1,i.heading8.disabled=!1,i.heading9.disabled=!1,i.normal.disabled=!1):(i.heading1.disabled=!0,i.heading2.disabled=!0,i.heading3.disabled=!0,i.heading4.disabled=!0,i.heading5.disabled=!0,i.heading6.disabled=!0,i.heading7.disabled=!0,i.heading8.disabled=!0,i.heading9.disabled=!0,i.normal.disabled=!0)},this.applyTableOfContentProperties=function(){var e={startLevel:1,endLevel:i.showLevel.value,includeHyperlink:i.hyperlink.checked,includePageNumber:i.pageNumber.checked,rightAlign:i.rightAlign.checked,tabLeader:i.tabLeader.value,includeOutlineLevels:i.outline.checked};i.applyLevelSetting(e),i.documentHelper.owner.editorModule.insertTableOfContents(e),i.documentHelper.dialog3.hide(),i.documentHelper.updateFocus()},this.unWireEventsAndBindings=function(){i.pageNumber.checked=!1,i.rightAlign.checked=!1,i.tabLeader.value="",i.hyperlink.checked=!1,i.style.checked=!1,i.outline.checked=!1,i.normal.value=""},this.documentHelper=e}return e.prototype.getModuleName=function(){return"TableOfContentsDialog"},e.prototype.initTableOfContentDialog=function(e,i){var n=this.documentHelper.owner.containerId,l=n+"_toc_dialog";this.target=t.createElement("div",{id:l,className:"e-de-toc-dlg-container"});var d=t.createElement("div",{id:"general_div",className:"e-de-toc-dlg-sub-container"});this.target.appendChild(d);var h=t.createElement("div",{id:n+"_genLabel",className:"e-de-toc-dlg-main-heading",styles:"margin-bottom: 13px;",innerHTML:e.getConstant("General")});d.appendChild(h);var c,p;i?(c="float:right;",p="float:left;position:relative;"):(c="float:left;",p="float:right;");var u=t.createElement("div",{id:"general_top_container",styles:"display:inline-flex"}),g=t.createElement("div",{id:"left_general",styles:c+"position:relative;"});u.appendChild(g);var m=t.createElement("div",{className:"e-de-toc-dlg-right-general-div"});u.appendChild(m),d.appendChild(u);var f=t.createElement("div",{id:"general_bottom_container",styles:"display:inline-flex"}),v=t.createElement("div",{id:"leftBottom_general",styles:"float:left;"});f.appendChild(v);var y=t.createElement("div",{className:"e-de-toc-dlg-right-sub-container",styles:p});f.appendChild(y),d.appendChild(f);var b=t.createElement("div",{id:"pageNumber_div",className:"e-de-toc-dlg-sub-container"}),w=t.createElement("input",{attrs:{type:"checkbox"},id:this.target.id+"_pageNumber"});b.appendChild(w);var C=t.createElement("div",{id:"rightAlign_div",className:"e-de-toc-dlg-sub-container"}),x=t.createElement("input",{attrs:{type:"checkbox"},id:this.target.id+"_rightAlign"});C.appendChild(x),this.pageNumber=new r.CheckBox({label:e.getConstant("Show page numbers"),enableRtl:i,checked:!0,change:this.changePageNumberValue}),this.rightAlign=new r.CheckBox({label:e.getConstant("Right align page numbers"),enableRtl:i,checked:!0,change:this.changeRightAlignValue}),this.pageNumber.appendTo(w),this.rightAlign.appendTo(x);var F=t.createElement("div",{id:"tab_div",className:"e-de-toc-dlg-tab-div"}),P=t.createElement("div",{id:"tabLeaderLabel_div"}),T=t.createElement("label",{id:n+"_tabLeaderLabel",className:"e-de-toc-dlg-heading",innerHTML:e.getConstant("Tab leader")+":"});P.appendChild(T);var S=t.createElement("div",{id:"tabLeader_div"}),I=t.createElement("select",{id:n+"_tabLeader",innerHTML:'<option value="None">('+e.getConstant("None").toLocaleLowerCase()+')</option><option value="Dot" selected>....................</option><option value="Hyphen">-------------------</option><option value="Underscore">____________</option>'});S.appendChild(I),F.appendChild(P),F.appendChild(S),g.appendChild(b),g.appendChild(C),g.appendChild(F),this.tabLeader=new s.DropDownList({width:210,enableRtl:i}),this.tabLeader.appendTo(I);var N=t.createElement("input",{attrs:{type:"checkbox"},id:this.target.id+"_hyperlink"});m.appendChild(N),this.hyperlink=new r.CheckBox({label:e.getConstant("Use hyperlinks instead of page numbers"),cssClass:"e-de-toc-label",enableRtl:i,checked:!0}),this.hyperlink.appendTo(N);var E=t.createElement("div",{id:"show_div",className:"e-de-toc-dlg-style-label"}),H=t.createElement("div",{id:"showLevelLabel_div",className:"e-de-toc-dlg-show-level-div"}),W=t.createElement("label",{id:n+"_showLevelLabel",className:"e-de-toc-dlg-heading",innerHTML:e.getConstant("Show levels")+":"});H.appendChild(W);var O=t.createElement("div",{id:"showLevel_div",className:"e-de-toc-dlg-showlevel-div"}),k=t.createElement("input",{id:n+"_showLevel",attrs:{type:"text"}});O.appendChild(k),E.appendChild(H),E.appendChild(O),m.appendChild(E),this.showLevel=new a.NumericTextBox({format:"#",value:3,min:1,max:9,width:210,change:this.changeShowLevelValue.bind(this)}),this.showLevel.appendTo(k),i&&(this.hyperlink.cssClass="e-de-toc-label-rtl",H.classList.add("e-de-rtl"),O.classList.add("e-de-rtl"),y.classList.add("e-de-rtl"));var L=t.createElement("div",{id:"buildTable_div",className:"e-de-toc-dlg-sub-container"}),B=t.createElement("div",{id:n+"_buildTableLabel",className:"e-de-toc-dlg-main-heading e-de-toc-dlg-build-table",styles:"margin-bottom: 13px;",innerHTML:e.getConstant("Build table of contents from")+":"});v.appendChild(L),v.appendChild(B);var R=t.createElement("input",{attrs:{type:"checkbox"},id:this.target.id+"_style"});v.appendChild(R),this.style=new r.CheckBox({label:e.getConstant("Styles"),enableRtl:i,checked:!0,change:this.changeStyleValue}),this.style.appendTo(R);var D=t.createElement("TABLE",{styles:"margin-top:3px;"}),M=t.createElement("tr"),A=t.createElement("td",{styles:"width:120px;padding-left:10px;"}),U=t.createElement("label",{innerHTML:e.getConstant("Available styles"),className:"e-de-toc-dlg-main-heading e-de-toc-dlg-sub-level-heading",id:this.target.id+"_availableLabel"});A.appendChild(U);var z=t.createElement("td"),V=t.createElement("label",{innerHTML:e.getConstant("TOC level")+":",className:"e-de-toc-dlg-main-heading e-de-toc-dlg-sub-level-heading",id:this.target.id+"_tocLabel"});z.appendChild(V),M.appendChild(A),M.appendChild(z),D.appendChild(M);var _=t.createElement("div",{id:"table_div",className:"e-de-toc-table-div"}),j=t.createElement("TABLE"),q=t.createElement("tr"),G=t.createElement("td"),K=t.createElement("label",{innerHTML:e.getConstant("Heading")+" 1",className:"e-de-toc-dlg-sub-heading",id:this.target.id+"_heading1Label"});G.appendChild(K);var X=t.createElement("td");this.heading1=t.createElement("input",{id:"_heading1",className:"e-input e-de-toc-dlg-toc-level"}),this.heading1.value="1",this.heading1.addEventListener("keyup",this.changeStyle),X.appendChild(this.heading1),q.appendChild(G),q.appendChild(X);var Y=t.createElement("tr"),J=t.createElement("td"),Z=t.createElement("label",{innerHTML:e.getConstant("Heading")+" 2",className:"e-de-toc-dlg-sub-heading",id:this.target.id+"_heading2Label"});J.appendChild(Z);var Q=t.createElement("td");this.heading2=t.createElement("input",{id:"_heading2",className:"e-input e-de-toc-dlg-toc-level"}),this.heading2.value="2",this.heading2.addEventListener("keyup",this.changeStyle),Q.appendChild(this.heading2),Y.appendChild(J),Y.appendChild(Q);var $=t.createElement("tr"),ee=t.createElement("td"),te=t.createElement("label",{innerHTML:e.getConstant("Heading")+" 3",className:"e-de-toc-dlg-sub-heading",id:this.target.id+"_heading3Label"});ee.appendChild(te);var ie=t.createElement("td");this.heading3=t.createElement("input",{id:"_heading3",className:"e-input e-de-toc-dlg-toc-level"}),this.heading3.value="3",this.heading3.addEventListener("keyup",this.changeStyle),ie.appendChild(this.heading3),$.appendChild(ee),$.appendChild(ie);var ne=t.createElement("tr"),re=t.createElement("td"),oe=t.createElement("label",{innerHTML:e.getConstant("Heading")+" 4",className:"e-de-toc-dlg-sub-heading",id:this.target.id+"_heading4Label"});re.appendChild(oe);var se=t.createElement("td");this.heading4=t.createElement("input",{id:"_heading4",className:"e-input e-de-toc-dlg-toc-level"}),this.heading4.addEventListener("keyup",this.changeStyle),se.appendChild(this.heading4),ne.appendChild(re),ne.appendChild(se);var ae=t.createElement("tr"),le=t.createElement("td"),de=t.createElement("label",{innerHTML:e.getConstant("Heading")+" 5",className:"e-de-toc-dlg-sub-heading",id:this.target.id+"_heading5Label"});le.appendChild(de);var he=t.createElement("td");this.heading5=t.createElement("input",{id:"_heading5",className:"e-input e-de-toc-dlg-toc-level"}),this.heading5.addEventListener("keyup",this.changeStyle),he.appendChild(this.heading5),ae.appendChild(le),ae.appendChild(he);var ce=t.createElement("tr"),pe=t.createElement("td"),ue=t.createElement("label",{innerHTML:e.getConstant("Heading")+" 6",className:"e-de-toc-dlg-sub-heading",id:this.target.id+"_heading6Label"});pe.appendChild(ue);var ge=t.createElement("td");this.heading6=t.createElement("input",{id:"_heading6",className:"e-input e-de-toc-dlg-toc-level"}),this.heading6.addEventListener("keyup",this.changeStyle),ge.appendChild(this.heading6),ce.appendChild(pe),ce.appendChild(ge);var me=t.createElement("tr"),fe=t.createElement("td"),ve=t.createElement("label",{innerHTML:e.getConstant("Heading")+" 7",className:"e-de-toc-dlg-sub-heading",id:this.target.id+"_heading7Label"});fe.appendChild(ve);var ye=t.createElement("td");this.heading7=t.createElement("input",{id:"_heading7",className:"e-input e-de-toc-dlg-toc-level"}),this.heading7.addEventListener("keyup",this.changeStyle),ye.appendChild(this.heading7),me.appendChild(fe),me.appendChild(ye);var be=t.createElement("tr"),we=t.createElement("td"),Ce=t.createElement("label",{innerHTML:e.getConstant("Heading")+" 8",className:"e-de-toc-dlg-sub-heading",id:this.target.id+"_heading8Label"});we.appendChild(Ce);var xe=t.createElement("td");this.heading8=t.createElement("input",{id:"_heading8",className:"e-input e-de-toc-dlg-toc-level"}),this.heading8.addEventListener("keyup",this.changeStyle),xe.appendChild(this.heading8),be.appendChild(we),be.appendChild(xe);var Fe=t.createElement("tr"),Pe=t.createElement("td"),Te=t.createElement("label",{innerHTML:e.getConstant("Heading")+" 9",className:"e-de-toc-dlg-sub-heading",id:this.target.id+"_heading9Label"});Pe.appendChild(Te);var Se=t.createElement("td");this.heading9=t.createElement("input",{id:"_heading9",className:"e-input e-de-toc-dlg-toc-level"}),this.heading9.addEventListener("keyup",this.changeStyle),Se.appendChild(this.heading9),Fe.appendChild(Pe),Fe.appendChild(Se);var Ie=t.createElement("tr"),Ne=t.createElement("td"),Ee=t.createElement("label",{innerHTML:e.getConstant("Normal"),className:"e-de-toc-dlg-sub-heading",id:this.target.id+"_normalLabel"});Ne.appendChild(Ee);var He=t.createElement("td");this.normal=t.createElement("input",{id:"_normal",className:"e-input e-de-toc-dlg-toc-level"}),this.normal.addEventListener("keyup",this.changeHeadingStyle),He.appendChild(this.normal),Ie.appendChild(Ne),Ie.appendChild(He),i&&(this.normal.classList.add("e-de-rtl"),this.heading1.classList.add("e-de-rtl"),this.heading2.classList.add("e-de-rtl"),this.heading3.classList.add("e-de-rtl"),this.heading4.classList.add("e-de-rtl"),this.heading5.classList.add("e-de-rtl"),this.heading6.classList.add("e-de-rtl"),this.heading7.classList.add("e-de-rtl"),this.heading8.classList.add("e-de-rtl"),this.heading9.classList.add("e-de-rtl")),j.appendChild(q),j.appendChild(Y),j.appendChild($),j.appendChild(ne),j.appendChild(ae),j.appendChild(ce),j.appendChild(me),j.appendChild(be),j.appendChild(Fe),j.appendChild(Ie),_.appendChild(j);var We=t.createElement("div",{className:"e-de-toc-styles-table-div"});We.appendChild(D),We.appendChild(_),v.appendChild(We);var Oe=t.createElement("div",{id:"fields_div",styles:"display: flex;"});v.appendChild(Oe);var ke=t.createElement("div",{id:"out_div"}),Le=t.createElement("div",{id:"outline_div",className:"e-de-toc-dlg-sub-container e-de-toc-dlg-outline-levels"}),Be=t.createElement("input",{attrs:{type:"checkbox"},id:"_outline"});Le.appendChild(Be),ke.appendChild(Le),Oe.appendChild(ke),this.outline=new r.CheckBox({label:e.getConstant("Outline levels"),enableRtl:i,checked:!0,cssClass:"e-de-outline-rtl"}),this.outline.appendTo(Be);var Re=t.createElement("div",{className:"e-de-toc-reset-button"});Oe.appendChild(Re);var De=t.createElement("button",{innerHTML:e.getConstant("Reset"),id:"reset",attrs:{type:"button"}});Re.appendChild(De),new r.Button({cssClass:"e-btn e-flat"}).appendTo(De),De.addEventListener("click",this.reset);var Me=t.createElement("div",{id:"tocStyles_div",className:"e-de-toc-dlg-sub-container"}),Ae=t.createElement("div",{id:n+"_tocStylesLabel",className:"e-de-toc-dlg-main-heading e-de-toc-dlg-styles",innerHTML:e.getConstant("Styles")+":"});y.appendChild(Me),y.appendChild(Ae);var Ue=t.createElement("div",{className:"e-de-toc-dlg-style-input"});y.appendChild(Ue),this.textBoxInput=t.createElement("input",{className:"e-input",id:"toclist"}),this.textBoxInput.setAttribute("type","text"),Ue.appendChild(this.textBoxInput);var ze=t.createElement("div",{className:"e-de-toc-list-view"}),Ve=["TOC 1","TOC 2","TOC 3","TOC 4","TOC 5","TOC 6","TOC 7","TOC 8","TOC 9"],_e=this.styleLocaleValue(Ve,e);this.listViewInstance=new o.ListView({dataSource:_e,cssClass:"e-toc-list-view"}),this.listViewInstance.appendTo(ze),this.listViewInstance.addEventListener("select",this.selectHandler),y.appendChild(ze);var je=t.createElement("div",{className:"e-de-toc-modify-button"});y.appendChild(je);var qe=t.createElement("button",{innerHTML:e.getConstant("Modify")+"...",id:"modify",attrs:{type:"button"}});je.appendChild(qe),new r.Button({cssClass:"e-btn e-flat"}).appendTo(qe),qe.addEventListener("click",this.showStyleDialog),i&&(Re.classList.add("e-de-rtl"),Ae.classList.add("e-de-rtl"),Ue.classList.add("e-de-rtl"),ze.classList.add("e-de-rtl"),je.classList.add("e-de-rtl"))},e.prototype.styleLocaleValue=function(e,t){for(var i=[],n=0;n<e.length;n++)i.push(t.getConstant(e[n]));return i},e.prototype.show=function(){var e=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);e.setLocale(this.documentHelper.owner.locale),this.target||this.initTableOfContentDialog(e,this.documentHelper.owner.enableRtl),this.documentHelper.dialog3.header=e.getConstant("Table of Contents"),this.documentHelper.dialog3.position={X:"center",Y:"center"},this.documentHelper.dialog3.width="auto",this.documentHelper.dialog3.height="auto",this.documentHelper.dialog3.content=this.target,this.documentHelper.dialog3.beforeOpen=this.loadTableofContentDialog,this.documentHelper.dialog3.close=this.closeTableOfContentDialog,this.documentHelper.dialog3.buttons=[{click:this.applyTableOfContentProperties,buttonModel:{content:e.getConstant("Ok"),cssClass:"e-flat e-toc-okay",isPrimary:!0}},{click:this.onCancelButtonClick,buttonModel:{content:e.getConstant("Cancel"),cssClass:"e-flat e-toc-cancel"}}],this.documentHelper.dialog3.dataBind(),this.documentHelper.dialog3.show()},e.prototype.changeShowLevelValue=function(e){var t=[];switch(e.value){case 1:t=["1",null,null,null,null,null,null,null,null],this.changeByValue(t);break;case 2:t=["1","2",null,null,null,null,null,null,null],this.changeByValue(t);break;case 3:t=["1","2","3",null,null,null,null,null,null],this.changeByValue(t);break;case 4:t=["1","2","3","4",null,null,null,null,null],this.changeByValue(t);break;case 5:t=["1","2","3","4","5",null,null,null,null],this.changeByValue(t);break;case 6:t=["1","2","3","4","5","6",null,null,null],this.changeByValue(t);break;case 7:t=["1","2","3","4","5","6","7",null,null],this.changeByValue(t);break;case 8:t=["1","2","3","4","5","6","7","8",null],this.changeByValue(t);break;case 9:t=["1","2","3","4","5","6","7","8","9"],this.changeByValue(t)}},e.prototype.changeByValue=function(e){this.heading1.value=e[0],this.heading2.value=e[1],this.heading3.value=e[2],this.heading4.value=e[3],this.heading5.value=e[4],this.heading6.value=e[5],this.heading7.value=e[6],this.heading8.value=e[7],this.heading9.value=e[8]},e.prototype.checkLevel=function(){""!==this.heading1.value&&(this.showLevel.value=1),""!==this.heading2.value&&(this.showLevel.value=2),""!==this.heading3.value&&(this.showLevel.value=3),""!==this.heading4.value&&(this.showLevel.value=4),""!==this.heading5.value&&(this.showLevel.value=5),""!==this.heading6.value&&(this.showLevel.value=6),""!==this.heading7.value&&(this.showLevel.value=7),""!==this.heading8.value&&(this.showLevel.value=8),""!==this.heading9.value&&(this.showLevel.value=9)},e.prototype.getElementValue=function(e){switch(e){case this.heading1:return"1";case this.heading2:return"2";case this.heading3:return"3";case this.heading4:return"4";case this.heading5:return"5";case this.heading6:return"6";case this.heading7:return"7";case this.heading8:return"8";case this.heading9:return"9";default:return"1"}},e.prototype.getHeadingLevel=function(e){switch(e){case 1:return parseInt(this.heading1.value);case 2:return parseInt(this.heading2.value);case 3:return parseInt(this.heading3.value);case 4:return parseInt(this.heading4.value);case 5:return parseInt(this.heading5.value);case 6:return parseInt(this.heading6.value);case 7:return parseInt(this.heading7.value);case 8:return parseInt(this.heading8.value);case 9:return parseInt(this.heading9.value);default:return 0}},e.prototype.applyLevelSetting=function(e){e.levelSettings={};for(var t=0,i=0,n=!1,r=1;r<=e.endLevel;r++){var o=this.getHeadingLevel(r);if(r===o)0===t&&(t=r,n=!1),n||(i=r);else if(n=!0,0!==o){var s="Heading "+r.toString();e.levelSettings[s]=o}}e.startLevel=t,e.endLevel=i,""!==this.normal.value&&(e.levelSettings.Normal=+this.normal.value)},e.prototype.destroy=function(){if(this.pageNumber&&(this.pageNumber.destroy(),this.pageNumber=void 0),this.rightAlign&&(this.rightAlign.destroy(),this.rightAlign=void 0),this.tabLeader&&(this.tabLeader.destroy(),this.tabLeader=void 0),this.showLevel&&(this.showLevel.destroy(),this.showLevel=void 0),this.hyperlink&&(this.hyperlink.destroy(),this.hyperlink=void 0),this.style&&(this.style.destroy(),this.style=void 0),this.outline&&(this.outline.destroy(),this.outline=void 0),this.listViewInstance&&(this.listViewInstance.destroy(),this.listViewInstance=void 0),this.heading1=void 0,this.heading2=void 0,this.heading3=void 0,this.heading4=void 0,this.heading5=void 0,this.heading6=void 0,this.heading7=void 0,this.heading8=void 0,this.heading9=void 0,this.normal=void 0,this.textBoxInput=void 0,this.documentHelper=void 0,!t.isNullOrUndefined(this.target)){this.target.parentElement&&this.target.parentElement.removeChild(this.target);for(var e=0;e<this.target.childNodes.length;e++)this.target.removeChild(this.target.childNodes[e]),e--;this.target=void 0}},e}(),ci=function(){function e(e){var t=this;this.isPortrait=!0,this.loadPageSetupDialog=function(){t.documentHelper.updateFocus();var e=t.documentHelper.selection.sectionFormat;t.topMarginBox.value=e.topMargin,t.leftMarginBox.value=e.leftMargin,t.bottomMarginBox.value=e.bottomMargin,t.rightMarginBox.value=e.rightMargin,t.widthBox.value=e.pageWidth,t.heightBox.value=e.pageHeight,t.checkBox1.checked=e.differentOddAndEvenPages,t.checkBox2.checked=e.differentFirstPage,t.headerBox.value=e.headerDistance,t.footerBox.value=e.footerDistance,t.widthBox.value>t.heightBox.value?t.landscape.checked=!0:t.portrait.checked=!0,t.setPageSize(t.portrait.checked,parseFloat(e.pageWidth.toFixed(1)),parseFloat(e.pageHeight.toFixed(1)))},this.closePageSetupDialog=function(){t.unWireEventsAndBindings(),t.documentHelper.updateFocus()},this.onCancelButtonClick=function(){t.documentHelper.dialog.hide(),t.unWireEventsAndBindings(),t.documentHelper.updateFocus()},this.keyUpInsertPageSettings=function(e){13===e.keyCode&&t.applyPageSetupProperties()},this.applyPageSetupProperties=function(){var e=new b;e.bottomMargin=t.bottomMarginBox.value,e.topMargin=t.topMarginBox.value,e.leftMargin=t.leftMarginBox.value,e.rightMargin=t.rightMarginBox.value,e.pageWidth=t.widthBox.value,e.pageHeight=t.heightBox.value,e.differentOddAndEvenPages=t.checkBox1.checked,e.differentFirstPage=t.checkBox2.checked,e.headerDistance=t.headerBox.value,e.footerDistance=t.footerBox.value,t.documentHelper.owner.editorModule.onApplySectionFormat(void 0,e),t.documentHelper.hideDialog()},this.changeByPaperSize=function(e){var i=e.value;t.documentHelper.selection.sectionFormat.pageWidth>t.documentHelper.selection.sectionFormat.pageHeight||t.landscape.checked?(t.isPortrait=!1,t.portrait.checked=!1):t.isPortrait=!0,"letter"===i?t.isPortrait?(t.widthBox.value=612,t.heightBox.value=792):(t.widthBox.value=792,t.heightBox.value=612):"tabloid"===i?t.isPortrait?(t.widthBox.value=792,t.heightBox.value=1224):(t.widthBox.value=1224,t.heightBox.value=792):"legal"===i?t.isPortrait?(t.widthBox.value=612,t.heightBox.value=1008):(t.widthBox.value=1008,t.heightBox.value=612):"statement"===i?t.isPortrait?(t.widthBox.value=392,t.heightBox.value=612):(t.widthBox.value=612,t.heightBox.value=392):"executive"===i?t.isPortrait?(t.widthBox.value=522,t.heightBox.value=756):(t.widthBox.value=756,t.heightBox.value=522):"a3"===i?t.isPortrait?(t.widthBox.value=841.9,t.heightBox.value=1190.55):(t.widthBox.value=1190.55,t.heightBox.value=841.9):"a4"===i?t.isPortrait?(t.widthBox.value=595.3,t.heightBox.value=841.9):(t.widthBox.value=841.9,t.heightBox.value=595.3):"a5"===i?t.isPortrait?(t.widthBox.value=419.55,t.heightBox.value=595.3):(t.widthBox.value=595.3,t.heightBox.value=419.55):"b4"===i?t.isPortrait?(t.widthBox.value=728.5,t.heightBox.value=1031.8):(t.widthBox.value=1031.8,t.heightBox.value=728.5):"b5"===i?t.isPortrait?(t.widthBox.value=515.9,t.heightBox.value=728.5):(t.widthBox.value=728.5,t.heightBox.value=515.9):"customsize"===i&&(t.isPortrait,t.widthBox.value=t.documentHelper.selection.sectionFormat.pageWidth,t.heightBox.value=t.documentHelper.selection.sectionFormat.pageHeight)},this.onPortrait=function(){t.landscape.checked=!1;var e=t.widthBox.value,i=t.heightBox.value;e>i&&(t.widthBox.value=i,t.heightBox.value=e)},this.onLandscape=function(){t.portrait.checked=!1;var e=t.widthBox.value,i=t.heightBox.value;e<i&&(t.widthBox.value=i,t.heightBox.value=e)},this.unWireEventsAndBindings=function(){t.paperSize.value=void 0,t.topMarginBox.value=void 0,t.bottomMarginBox.value=void 0,t.leftMarginBox.value=void 0,t.rightMarginBox.value=void 0,t.headerBox.value=void 0,t.footerBox.value=void 0,t.widthBox.value=void 0,t.heightBox.value=void 0,t.checkBox1.checked=!1,t.checkBox2.checked=!1,t.portrait.checked=!1,t.landscape.checked=!1},this.documentHelper=e}return e.prototype.getModuleName=function(){return"PageSetupDialog"},e.prototype.initPageSetupDialog=function(e,n){var r=this.documentHelper.owner.containerId+"_pagesetup_dialog";this.target=t.createElement("div",{id:r,className:"e-de-pagesetup-dlg-container"});var o=t.createElement("div",{id:this.target.id+"_MarginTabContainer"});this.target.appendChild(o),this.marginTab=t.createElement("div",{id:this.target.id+"_marginPropertyTab",styles:"position: relative;"}),this.paperTab=t.createElement("div",{id:this.target.id+"_paperSizePropertyTab",styles:"position: relative;"}),this.layoutTab=t.createElement("div",{id:this.target.id+"_CellPropertiesDialogTab",styles:"position: relative;"});var s=t.createElement("div",{id:this.target.id+"_PageSetupDialogTab",className:"e-de-page-setup-ppty-tab"}),a=t.createElement("div",{className:"e-tab-header"}),l=t.createElement("div",{id:this.target.id+"_marginHeader",innerHTML:e.getConstant("Margin")}),d=t.createElement("div",{id:this.target.id+"_paperHeader",innerHTML:e.getConstant("Paper")}),h=t.createElement("div",{id:this.target.id+"_layoutHeader",innerHTML:e.getConstant("Layout")});a.appendChild(l),a.appendChild(d),a.appendChild(h);var c=t.createElement("div",{id:this.target.id+"_marginContent"}),p=t.createElement("div",{id:this.target.id+"_paperContent"}),u=t.createElement("div",{id:this.target.id+"_layoutContent"});c.appendChild(this.marginTab),p.appendChild(this.paperTab),u.appendChild(this.layoutTab),o.appendChild(s),this.initMarginProperties(this.marginTab,e,n),this.initPaperSizeProperties(this.paperTab,e,n),this.initLayoutProperties(this.layoutTab,e,n);var g=[{header:{text:l},content:c},{header:{text:d},content:p},{header:{text:h},content:u}];new i.Tab({items:g,enableRtl:n},s).isStringTemplate=!0,this.target.addEventListener("keyup",this.keyUpInsertPageSettings)},e.prototype.initMarginProperties=function(e,i,n){var o=t.createElement("div",{id:"margin_div",className:"e-de-page-setup-dlg-sub-container",styles:"height:135px;"}),s=t.createElement("div",{id:"left_margin",className:"e-de-page-setup-dlg-left-sub-container"});o.appendChild(s);var l=t.createElement("div",{className:"e-de-page-setup-dlg-right-sub-container"});o.appendChild(l),n&&(s.classList.add("e-de-rtl"),l.classList.add("e-de-rtl"));var d=t.createElement("label",{innerHTML:i.getConstant("Top"),className:"e-de-page-setup-dlg-sub-header",id:this.target.id+"_TopLabel",styles:"padding-top:0px;"}),h=t.createElement("input",{attrs:{type:"text"},id:this.target.id+"_Top"}),c=t.createElement("label",{innerHTML:i.getConstant("Bottom"),className:"e-de-page-setup-dlg-sub-title-header",id:this.target.id+"_bottomLabel"}),p=t.createElement("input",{attrs:{type:"text"},id:this.target.id+"_bottom"});s.appendChild(d),s.appendChild(h),s.appendChild(c),s.appendChild(p);var u=t.createElement("label",{innerHTML:i.getConstant("Left"),className:"e-de-page-setup-dlg-sub-header",styles:"padding-top:0px;",id:this.target.id+"_leftLabel"}),g=t.createElement("input",{attrs:{type:"text"},id:this.target.id+"_left"}),m=t.createElement("label",{innerHTML:i.getConstant("Right"),id:this.target.id+"_rightLabel",className:"e-de-page-setup-dlg-sub-title-header"}),f=t.createElement("input",{attrs:{type:"text"},id:this.target.id+"_right"});l.appendChild(u),l.appendChild(g),l.appendChild(m),l.appendChild(f),e.appendChild(o),this.topMarginBox=new a.NumericTextBox({value:71,width:170,decimals:2}),this.topMarginBox.appendTo(h),this.leftMarginBox=new a.NumericTextBox({value:73,width:170,decimals:2}),this.leftMarginBox.appendTo(g),this.bottomMarginBox=new a.NumericTextBox({value:72,width:170,decimals:2}),this.bottomMarginBox.appendTo(p),this.rightMarginBox=new a.NumericTextBox({value:74,width:170,decimals:2}),this.rightMarginBox.appendTo(f);var v,y=t.createElement("div",{id:"orientation_div",className:"e-de-page-setup-dlg-sub-container-port"}),b=t.createElement("div",{id:"_orientationLabelDiv",className:"e-de-page-setup-dlg-sub-label",innerHTML:i.getConstant("Orientation")}),w=t.createElement("div",{id:"_orientationPropDiv",styles:"display: flex;",className:"e-de-page-setup-dlg-orientation-prop"});v=n?"padding-left: 30px;":"padding-right: 30px;";var C=t.createElement("div",{id:"_portraitDiv",styles:v}),x=t.createElement("input",{attrs:{type:"radiobutton"},id:this.target.id+"_portrait"}),F=t.createElement("div",{id:"_landscapeDiv"}),P=t.createElement("input",{attrs:{type:"radiobutton"},id:this.target.id+"_landscape"});C.appendChild(x),F.appendChild(P),w.appendChild(C),w.appendChild(F),y.appendChild(b),y.appendChild(w),this.portrait=new r.RadioButton({label:i.getConstant("Portrait"),checked:!0,enableRtl:n,change:this.onPortrait}),this.landscape=new r.RadioButton({label:i.getConstant("Landscape"),enableRtl:n,change:this.onLandscape}),this.portrait.appendTo(x),this.landscape.appendTo(P),e.appendChild(y)},e.prototype.initPaperSizeProperties=function(e,i,n){var r=t.createElement("div",{id:"size_div",className:"e-de-page-setup-dlg-sub-size-container"}),o=t.createElement("div",{id:"left_size",className:"e-de-page-setup-dlg-left-sub-container"});r.appendChild(o);var l=t.createElement("div",{className:"e-de-page-setup-dlg-right-sub-container"});r.appendChild(l),n&&(o.classList.add("e-de-rtl"),l.classList.add("e-de-rtl"));var d=t.createElement("label",{innerHTML:i.getConstant("Width"),className:"e-de-page-setup-dlg-sub-header",id:this.target.id+"_widthLabel",styles:"padding-top:0px;"}),h=t.createElement("input",{attrs:{type:"text"},id:this.target.id+"_Width"});o.appendChild(d),o.appendChild(h);var c=t.createElement("label",{innerHTML:i.getConstant("Height"),className:"e-de-page-setup-dlg-sub-header",styles:"padding-top:0px;",id:this.target.id+"_heightLabel"}),p=t.createElement("input",{attrs:{type:"text"},id:this.target.id+"_height"});l.appendChild(c),l.appendChild(p),e.appendChild(r),this.widthBox=new a.NumericTextBox({value:612,width:170,decimals:2}),this.widthBox.appendTo(h),this.heightBox=new a.NumericTextBox({value:792,width:170,decimals:2}),this.heightBox.appendTo(p);var u=t.createElement("div",{id:"_paperSizeDiv",styles:"height:37px;",className:"e-de-page-setup-dlg-sub-container"}),g=t.createElement("select",{id:this.target.id+"_papersize",styles:"width:170px;padding-bottom: 20px;",innerHTML:'<option value="letter">'+i.getConstant("Letter")+'</option><option value="tabloid">'+i.getConstant("Tabloid")+'</option><option value="legal">'+i.getConstant("Legal")+'</option><option value="statement">'+i.getConstant("Statement")+'</option><option value="executive">'+i.getConstant("Executive")+'</option><option value="a3">'+i.getConstant("A3")+'</option><option value="a4">'+i.getConstant("A4")+'</option><option value="a5">'+i.getConstant("A5")+'</option><option value="b4">'+i.getConstant("B4")+'</option><option value="b5">'+i.getConstant("B5")+'</option><option value="customsize">'+i.getConstant("Custom Size")+"</option>"});u.appendChild(g),this.paperSize=new s.DropDownList({change:this.changeByPaperSize,width:"170px",enableRtl:n}),this.paperSize.appendTo(g),e.appendChild(u)},e.prototype.initLayoutProperties=function(e,i,n){var o=t.createElement("div",{id:"_layoutDiv",className:"e-de-page-setup-dlg-layout-sub-container"}),s=t.createElement("div",{id:"_firstPageDiv",styles:"height: 27px;",className:"e-de-page-setup-dlg-first-page-prop"}),l=t.createElement("input",{attrs:{type:"checkbox"},id:this.target.id+"_oddoreven"});s.appendChild(l);var d=t.createElement("div",{id:"_oddOrEvenDiv",styles:"height: 27px;",className:"e-de-page-setup-dlg-odd-or-even-prop"}),h=t.createElement("input",{attrs:{type:"checkbox"},id:this.target.id+"_even"});d.appendChild(h),o.appendChild(s),o.appendChild(d),this.checkBox1=new r.CheckBox({label:i.getConstant("Different odd and even"),enableRtl:n}),this.checkBox2=new r.CheckBox({label:i.getConstant("Different first page"),enableRtl:n}),this.checkBox1.appendTo(l),this.checkBox2.appendTo(h),e.appendChild(o);var c=t.createElement("div",{id:"_textLabelDiv",className:"e-de-page-setup-dlg-sub-label"}),p=t.createElement("label",{innerHTML:i.getConstant("From edge"),id:this.target.id+"_textLabel"});c.appendChild(p),e.appendChild(c);var u=t.createElement("div",{id:"_headerFooeterPropDiv",className:"e-de-page-setup-dlg-sub-container",styles:"height: 65px;"}),g=t.createElement("div",{id:"_leftLayoutDiv",className:"e-de-page-setup-dlg-left-layout-container"});u.appendChild(g);var m=t.createElement("div",{className:"e-de-page-setup-dlg-right-layout-container"});u.appendChild(m),n&&(m.classList.add("e-de-rtl"),g.classList.add("e-de-rtl"));var f=t.createElement("label",{innerHTML:i.getConstant("Header"),className:"e-de-page-setup-dlg-sub-header",id:this.target.id+"_headerLabel",styles:"padding-top:0px;"}),v=t.createElement("input",{attrs:{type:"text"},id:this.target.id+"_header"});g.appendChild(f),g.appendChild(v);var y=t.createElement("label",{innerHTML:i.getConstant("Footer"),className:"e-de-page-setup-dlg-sub-header",styles:"padding-top:0px;",id:this.target.id+"_footerLabel"}),b=t.createElement("input",{attrs:{type:"text"},id:this.target.id+"_footer"});m.appendChild(y),m.appendChild(b),e.appendChild(u),this.headerBox=new a.NumericTextBox({value:612,width:170,decimals:2}),this.headerBox.appendTo(v),this.footerBox=new a.NumericTextBox({value:792,width:170,decimals:2}),this.footerBox.appendTo(b)},e.prototype.show=function(){var e=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);e.setLocale(this.documentHelper.owner.locale),this.target||this.initPageSetupDialog(e,this.documentHelper.owner.enableRtl),this.documentHelper.dialog.header=e.getConstant("Page Setup"),this.documentHelper.dialog.width="auto",this.documentHelper.dialog.height="auto",this.documentHelper.dialog.content=this.target,this.documentHelper.dialog.beforeOpen=this.loadPageSetupDialog,this.documentHelper.dialog.close=this.closePageSetupDialog,this.documentHelper.dialog.buttons=[{click:this.applyPageSetupProperties,buttonModel:{content:e.getConstant("Ok"),cssClass:"e-flat e-layout-ppty-okay",isPrimary:!0}},{click:this.onCancelButtonClick,buttonModel:{content:e.getConstant("Cancel"),cssClass:"e-flat e-layout-ppty-cancel"}}],this.documentHelper.dialog.dataBind(),this.documentHelper.dialog.show()},e.prototype.setPageSize=function(e,t,i){this.paperSize.value=e&&612===t&&792===i||!e&&792===t&&612===i?"letter":e&&792===t&&1224===i||!e&&1224===t&&792===i?"tabloid":e&&612===t&&1008===i||!e&&1008===t&&612===i?"legal":e&&392===t&&612===i||!e&&392===t&&612===i?"statement":e&&522===t&&756===i||!e&&756===t&&522===i?"executive":e&&841.9===t&&1190.5===i||!e&&1190.5===t&&841.9===i?"a3":e&&595.3===t&&841.9===i||!e&&841.9===t&&595.3===i?"a4":e&&419.6===t&&595.3===i||!e&&595.3===t&&419.6===i?"a5":e&&728.5===t&&1031.8===i||!e&&1031.8===t&&728.5===i?"b4":e&&515.9===t&&728.5===i||!e&&728.5===t&&515.9===i?"letter":"customsize"},e.prototype.destroy=function(){if(this.topMarginBox&&(this.topMarginBox.destroy(),this.topMarginBox=void 0),this.leftMarginBox&&(this.leftMarginBox.destroy(),this.leftMarginBox=void 0),this.bottomMarginBox&&(this.bottomMarginBox.destroy(),this.bottomMarginBox=void 0),this.rightMarginBox&&(this.rightMarginBox.destroy(),this.rightMarginBox=void 0),this.headerBox&&(this.headerBox.destroy(),this.headerBox=void 0),this.footerBox&&(this.footerBox.destroy(),this.footerBox=void 0),this.widthBox&&(this.widthBox.destroy(),this.widthBox=void 0),this.heightBox&&(this.heightBox.destroy(),this.heightBox=void 0),this.paperSize&&(this.paperSize.destroy(),this.paperSize=void 0),this.checkBox1&&(this.checkBox1.destroy(),this.checkBox1=void 0),this.checkBox2&&(this.checkBox2.destroy(),this.checkBox2=void 0),this.portrait&&(this.portrait.destroy(),this.portrait=void 0),this.landscape&&(this.landscape.destroy(),this.landscape=void 0),this.documentHelper=void 0,!t.isNullOrUndefined(this.target)){this.target.parentElement&&this.target.parentElement.removeChild(this.target);for(var e=0;e<this.target.childNodes.length;e++)this.target.removeChild(this.target.childNodes[e]),e--;this.target=void 0}},e}(),pi=function(){function e(e){var i=this;this.leftIndent=void 0,this.rightIndent=void 0,this.beforeSpacing=void 0,this.afterSpacing=void 0,this.textAlignment=void 0,this.firstLineIndent=void 0,this.lineSpacingIn=void 0,this.lineSpacingType=void 0,this.paragraphFormat=void 0,this.bidi=void 0,this.contextualSpacing=void 0,this.isStyleDialog=!1,this.directionDiv=void 0,this.keyUpParagraphSettings=function(e){13===e.keyCode&&i.applyParagraphFormat()},this.changeBeforeSpacing=function(e){i.beforeSpacing=e.value},this.changeAfterSpacing=function(e){i.afterSpacing=e.value},this.changeLeftIndent=function(e){i.leftIndent=e.value},this.changeRightIndent=function(e){i.rightIndent=e.value},this.changeLineSpacingValue=function(e){i.lineSpacingIn=e.value},this.changeFirstLineIndent=function(e){i.firstLineIndent=e.value,2===i.special.index&&(i.firstLineIndent=-i.firstLineIndent,i.leftIndent=e.value)},this.changeByTextAlignment=function(e){i.textAlignment=e.value},this.changeBidirectional=function(e){"ltr"===e.value?(i.rtlButton.checked=!i.ltrButton.checked,i.bidi=!1):(i.ltrButton.checked=!i.rtlButton.checked,i.bidi=!0),i.changeAlignmentByBidi()},this.changeContextualSpacing=function(e){i.contextualSpacing=e.checked},this.changeByValue=function(){var e=i.documentHelper.selection.paragraphFormat;switch(i.special.index){case 0:0!==e.firstLineIndent&&(i.byIn.value=0);break;case 1:0===e.firstLineIndent||t.isNullOrUndefined(e.firstLineIndent)?i.byIn.value=.1:e.firstLineIndent<0&&(i.byIn.value=-e.firstLineIndent);break;case 2:0===e.firstLineIndent||t.isNullOrUndefined(e.firstLineIndent)?e.firstLineIndent=-.1:e.firstLineIndent>0&&(i.byIn.value=-e.firstLineIndent)}},this.changeBySpacing=function(){if(!t.isNullOrUndefined(i.lineSpacing))switch(i.lineSpacing.index){case 0:i.lineSpacingType="AtLeast",i.atIn.value=12;break;case 1:i.lineSpacingType="Exactly",i.atIn.value=12;break;case 2:i.lineSpacingType="Multiple",i.atIn.value=1}},this.loadParagraphDialog=function(){i.isStyleDialog?i.directionDiv.classList.add("e-de-disabledbutton"):i.directionDiv.classList.remove("e-de-disabledbutton");var e;e=i.paragraphFormat?i.paragraphFormat:i.documentHelper.selection.paragraphFormat;var t=i.getAlignmentValue(e.textAlignment);i.alignment.index=t,i.beforeSpacingIn.value=e.beforeSpacing,i.afterSpacingIn.value=e.afterSpacing,i.leftIndentIn.value=e.leftIndent,i.rightIndentIn.value=e.rightIndent,i.byIn.value=e.firstLineIndent;var n=i.lineSpacing.index;n="AtLeast"===e.lineSpacingType?0:"Exactly"===e.lineSpacingType?1:2,i.lineSpacing.index=n,i.atIn.value=e.lineSpacing,"none"!==i.documentHelper.selection.caret.style.display&&(i.documentHelper.selection.caret.style.display="none"),e.bidi?(i.rtlButton.checked=!0,i.ltrButton.checked=!1):(i.ltrButton.checked=!0,i.rtlButton.checked=!1),i.contextSpacing.checked=e.contextualSpacing},this.applyParagraphFormat=function(){var e,n;i.paragraphFormat?(e=i.paragraphFormat,n=!1):(e=new P,n=!0),t.isNullOrUndefined(i.beforeSpacing)||(e.beforeSpacing=i.beforeSpacing),t.isNullOrUndefined(i.afterSpacing)||(e.afterSpacing=i.afterSpacing),t.isNullOrUndefined(i.lineSpacingType)||(e.lineSpacingType=i.lineSpacingType),t.isNullOrUndefined(i.leftIndent)||(e.leftIndent=i.leftIndent),t.isNullOrUndefined(i.rightIndent)||(e.rightIndent=i.rightIndent),t.isNullOrUndefined(i.lineSpacingIn)||(e.lineSpacing=i.lineSpacingIn),t.isNullOrUndefined(i.firstLineIndent)||(e.firstLineIndent=i.firstLineIndent),t.isNullOrUndefined(i.bidi)||(e.bidi=i.bidi),t.isNullOrUndefined(i.textAlignment)||(e.textAlignment=i.textAlignment),t.isNullOrUndefined(i.contextualSpacing)||(e.contextualSpacing=i.contextualSpacing),n?i.onParagraphFormat(e):i.documentHelper.owner.styleDialogModule.updateParagraphFormat(),i.documentHelper.hideDialog()},this.closeParagraphDialog=function(){i.leftIndent=void 0,i.afterSpacing=void 0,i.beforeSpacing=void 0,i.firstLineIndent=void 0,i.textAlignment=void 0,i.rightIndent=void 0,i.lineSpacingIn=void 0,i.lineSpacingType=void 0,i.paragraphFormat=void 0,i.documentHelper.hideDialog()},this.documentHelper=e}return Object.defineProperty(e.prototype,"owner",{get:function(){return this.documentHelper.owner.viewer},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"ParagraphDialog"},e.prototype.initParagraphDialog=function(e){var i=this,n=this.documentHelper.owner.containerId,o=n+"_paragraph_dialog";this.target=t.createElement("div",{id:o,className:"e-de-para-dlg-container"});var l=t.createElement("div",{id:"property_div",styles:"width:400px;"}),d=t.createElement("div",{id:"genral_div",className:"e-de-para-dlg-sub-container"}),h=t.createElement("div",{id:n+"_genLabel",className:"e-de-para-dlg-heading",innerHTML:e.getConstant("General")}),c=t.createElement("div",{id:n+"_AlignLabel",className:"e-de-dlg-sub-header",innerHTML:e.getConstant("Alignment")}),p=t.createElement("select",{id:n+"_Alignment",innerHTML:'<option value="Center">'+e.getConstant("Center")+'</option><option value="Left">'+e.getConstant("Left")+'</option><option value="Right">'+e.getConstant("Right")+'</option><option value="Justify">'+e.getConstant("Justify")+"</option>"});d.appendChild(h),d.appendChild(c),d.appendChild(p);var u=t.createElement("div",{id:n+"_DirLabel",className:"e-de-dlg-sub-header",innerHTML:e.getConstant("Direction")});this.directionDiv=t.createElement("div",{id:n+"_DirDiv",styles:"display:flex"});var g=t.createElement("div",{id:n+"_DirDiv",className:"e-de-rtl-btn-div"}),m=t.createElement("input",{id:n+"_rtlEle"});g.appendChild(m),this.directionDiv.appendChild(g);var f=this.documentHelper.owner.enableRtl;f&&g.classList.add("e-de-rtl");var v=t.createElement("div",{id:n+"_DirDiv",className:"e-de-ltr-btn-div"}),y=t.createElement("input",{id:n+"_ltrEle"});v.appendChild(y),this.directionDiv.appendChild(v),d.appendChild(u),d.appendChild(this.directionDiv),this.rtlButton=new r.RadioButton({label:e.getConstant("Right-to-left"),enableRtl:f,value:"rtl",cssClass:"e-small",change:this.changeBidirectional}),this.rtlButton.appendTo(m),this.ltrButton=new r.RadioButton({label:e.getConstant("Left-to-right"),enableRtl:f,value:"ltr",cssClass:"e-small",change:this.changeBidirectional}),this.ltrButton.appendTo(y);var b=t.createElement("div",{id:"indention_div",styles:"width: 400px;",className:"e-de-para-dlg-sub-container e-para-dlg-sub-height"}),w=t.createElement("div",{id:"left_indention",styles:"float:left;position:relative;"});b.appendChild(w);var C=t.createElement("div",{className:"e-de-para-dlg-right-sub-container",styles:"float:right;position:relative;"});b.appendChild(C);var x=t.createElement("div",{id:"spacing_div"}),F=t.createElement("div",{id:"left_spacing",styles:"float:left;position:relative;"});x.appendChild(F);var P="float:left";f&&(P="float:right;");var T=t.createElement("div",{id:"context_spacing",styles:P+"position:relative;"});x.appendChild(T);var S=t.createElement("div",{styles:"display:inline-flex;"});x.appendChild(S);var I=t.createElement("input",{attrs:{type:"checkbox"},id:n+"_contextSpacing"});T.appendChild(I);var N=t.createElement("div",{id:n+"_indentLabel",className:"e-de-para-dlg-heading",innerHTML:e.getConstant("Indentation")}),E=t.createElement("div",{id:n+"_bfTextLabel",className:"e-de-dlg-sub-header",innerHTML:e.getConstant("Before text")}),H=t.createElement("input",{id:n+"_leftIndent",attrs:{type:"text"}}),W=t.createElement("div",{id:n+"_specialLabel",className:"e-de-dlg-sub-header",innerHTML:e.getConstant("Special")}),O=t.createElement("select",{id:n+"_special",innerHTML:'<option value="None">'+e.getConstant("None")+'</option><option value="First Line">'+e.getConstant("First line")+'</option><option value="Hanging">'+e.getConstant("Hanging")+"</option> "});w.appendChild(N),w.appendChild(E),w.appendChild(H),w.appendChild(W),w.appendChild(O);var k=t.createElement("div",{id:n+"_afTextLabel",className:"e-de-dlg-sub-header",innerHTML:e.getConstant("After text")}),L=t.createElement("input",{id:n+"_rightIndent",attrs:{type:"text"}}),B=t.createElement("label",{id:n+"_byLabel",className:"e-de-dlg-sub-header",innerHTML:e.getConstant("By")}),R=t.createElement("input",{id:n+"_By",attrs:{type:"text"}});C.appendChild(k),C.appendChild(L),C.appendChild(B),C.appendChild(R);var D=t.createElement("div",{innerHTML:e.getConstant("Spacing"),className:"e-de-para-dlg-heading",id:n+"_spaceLabel"}),M=t.createElement("div",{id:n+"_spacingWholeDiv",styles:"display:inline-flex;"}),A=t.createElement("div",{id:n+"_beforeSpacingWholeDiv"}),U=t.createElement("div",{className:"e-de-dlg-sub-header",innerHTML:e.getConstant("Before"),id:n+"_beforeLabel"}),z=t.createElement("input",{id:n+"_beforeSpacing",attrs:{type:"text"}}),V=t.createElement("div",{id:n+"_afterSpacingWholeDiv",className:"e-de-para-dlg-spacing-div"}),_=t.createElement("div",{innerHTML:e.getConstant("After"),className:"e-de-dlg-sub-header",id:n+"_afterLabel"}),j=t.createElement("input",{id:n+"_afterSpacing",attrs:{type:"text"}});F.appendChild(D),F.appendChild(M),A.appendChild(U),A.appendChild(z),M.appendChild(A),V.appendChild(_),V.appendChild(j),M.appendChild(V);var q=t.createElement("div",{id:n+"_lineSpacingWholeDiv"}),G=t.createElement("div",{id:n+"_lineSpaceLabel",className:"e-de-dlg-sub-header",innerHTML:e.getConstant("Line Spacing")}),K=t.createElement("select",{id:n+"_lineSpacing",styles:"width:180px;",innerHTML:'<option value="At least">'+e.getConstant("At least")+'</option><option value="Exactly">'+e.getConstant("Exactly")+'</option><option value="Multiple">'+e.getConstant("Multiple")+"</option>"}),X=t.createElement("div",{id:n+"_lineTypeWholeDiv",className:"e-de-para-dlg-spacing-div"}),Y=t.createElement("div",{innerHTML:e.getConstant("At"),id:n+"_atLabel",className:"e-de-dlg-sub-header"}),J=t.createElement("input",{id:n+"_lineSpacingAt",attrs:{type:"text"}});q.appendChild(G),q.appendChild(K),S.appendChild(q),X.appendChild(Y),X.appendChild(J),S.appendChild(X),l.appendChild(d),l.appendChild(b),l.appendChild(x),this.target.appendChild(l),this.leftIndentIn=new a.NumericTextBox({format:"n1",value:0,min:-1584,max:1584,width:180,enablePersistence:!1,change:this.changeLeftIndent}),this.leftIndentIn.appendTo(H),this.rightIndentIn=new a.NumericTextBox({format:"n1",value:0,min:-1584,max:1584,width:180,enablePersistence:!1,change:this.changeRightIndent}),this.rightIndentIn.appendTo(L),this.byIn=new a.NumericTextBox({format:"n1",value:0,min:0,max:1584,width:180,enablePersistence:!1,change:this.changeFirstLineIndent}),this.byIn.appendTo(R),this.beforeSpacingIn=new a.NumericTextBox({format:"n1",value:0,min:0,max:1584,width:180,step:6,enablePersistence:!1,change:this.changeBeforeSpacing}),this.beforeSpacingIn.appendTo(z),this.afterSpacingIn=new a.NumericTextBox({format:"n1",value:0,min:0,max:1584,width:180,step:6,enablePersistence:!1,change:this.changeAfterSpacing}),this.afterSpacingIn.appendTo(j),this.atIn=new a.NumericTextBox({format:"n1",value:0,min:1,max:1584,width:180,step:.5,enablePersistence:!1,change:this.changeLineSpacingValue}),this.special=new s.DropDownList({change:this.changeByValue,width:180,enableRtl:f}),this.special.appendTo(O),this.lineSpacing=new s.DropDownList({change:this.changeBySpacing,width:"180px",enableRtl:f}),this.lineSpacing.appendTo(K),this.alignment=new s.DropDownList({width:180,change:this.changeByTextAlignment,enableRtl:f}),this.alignment.appendTo(p),this.atIn.appendTo(J),this.contextSpacing=new r.CheckBox({change:this.changeContextualSpacing,label:e.getConstant("Contextual Spacing"),enableRtl:f,cssClass:"e-de-para-dlg-cs-check-box"}),this.contextSpacing.appendTo(I),this.target.addEventListener("keyup",i.keyUpParagraphSettings),f&&(V.classList.add("e-de-rtl"),X.classList.add("e-de-rtl"))},e.prototype.changeAlignmentByBidi=function(){"Left"===this.textAlignment?this.textAlignment="Right":"Right"===this.textAlignment&&(this.textAlignment="Left"),t.isNullOrUndefined(this.textAlignment)?0===this.alignment.index?this.textAlignment="Center":this.textAlignment="Justify":this.alignment.index=this.getAlignmentValue(this.textAlignment)},e.prototype.getAlignmentValue=function(e){return"Center"===e?0:"Left"===e?1:"Right"===e?2:3},e.prototype.onParagraphFormat=function(e){var t=this.documentHelper.selection,i=e.bidi&&-1!==t.paragraphFormat.listId;i||(this.documentHelper.layout.isBidiReLayout=!0),this.documentHelper.owner.editorModule.initHistory("ParagraphFormat"),this.documentHelper.owner.isShiftingEnabled=!0,this.documentHelper.selection.isEmpty?(this.documentHelper.owner.editorModule.applyParaFormatProperty(t.start.paragraph,void 0,e,!1),this.documentHelper.owner.editor.layoutItemBlock(t.start.paragraph,!1)):this.documentHelper.owner.editorModule.updateSelectionParagraphFormatting("ParagraphFormat",e,!1),this.documentHelper.owner.editorModule.reLayout(t),i||(this.documentHelper.layout.isBidiReLayout=!1)},e.prototype.show=function(e){e?(this.isStyleDialog=!0,this.paragraphFormat=e):this.isStyleDialog=!1;var i=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);i.setLocale(this.documentHelper.owner.locale),this.target||this.initParagraphDialog(i),this.loadParagraphDialog(),this.documentHelper.dialog.header=i.getConstant("Paragraph"),this.documentHelper.dialog.content=this.target,this.documentHelper.dialog.height="auto",this.documentHelper.dialog.width="auto",this.documentHelper.dialog.buttons=[{click:this.applyParagraphFormat,buttonModel:{content:i.getConstant("Ok"),cssClass:"e-flat e-para-okay",isPrimary:!0}},{click:this.closeParagraphDialog,buttonModel:{content:i.getConstant("Cancel"),cssClass:"e-flat e-para-cancel"}}],this.documentHelper.dialog.beforeOpen=this.documentHelper.updateFocus,this.documentHelper.dialog.close=this.documentHelper.updateFocus,this.documentHelper.dialog.dataBind(),this.documentHelper.dialog.show()},e.prototype.destroy=function(){if(this.afterSpacingIn&&(this.afterSpacingIn.destroy(),this.afterSpacingIn=void 0),this.beforeSpacingIn&&(this.beforeSpacingIn.destroy(),this.beforeSpacingIn=void 0),this.leftIndentIn&&(this.leftIndentIn.destroy(),this.leftIndentIn=void 0),this.rightIndentIn&&(this.rightIndentIn.destroy(),this.rightIndentIn=void 0),this.byIn&&(this.byIn.destroy(),this.byIn=void 0),this.atIn&&(this.atIn.destroy(),this.atIn=void 0),this.alignment&&(this.alignment.change=void 0,this.alignment.destroy()),this.alignment=void 0,this.lineSpacing&&(this.lineSpacing.change=void 0,this.lineSpacing.destroy()),this.lineSpacing=void 0,this.special&&(this.special.change=void 0,this.special.destroy()),this.special=void 0,this.documentHelper=void 0,!t.isNullOrUndefined(this.target)){this.target.parentElement&&this.target.parentElement.removeChild(this.target);for(var e=0;e<this.target.childNodes.length;e++)this.target.removeChild(this.target.childNodes[e]),e--;this.target=void 0}},e}(),ui=function(){function e(){this.listIn=void 0,this.levelNumberIn=void 0,this.dialog=void 0,this.levelNumber=0}return Object.defineProperty(e.prototype,"levelNumber",{get:function(){return this.levelNumberIn},set:function(e){this.levelNumberIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){return this.listIn},set:function(e){t.isNullOrUndefined(e)?this.createList():this.listIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"listLevel",{get:function(){if(!t.isNullOrUndefined(this.list)&&this.levelNumber>=0&&this.levelNumber<9){if(t.isNullOrUndefined(this.dialog.documentHelper.getAbstractListById(this.list.abstractListId))){this.dialog.documentHelper.lists.push(this.list);var e=this.list.abstractList;this.list.abstractList||((e=new V).abstractListId=this.list.abstractListId);var i=new _(e);return i.characterFormat=new H(i),i.paragraphFormat=new P(i),i.paragraphFormat.leftIndent=48,i.paragraphFormat.firstLineIndent=-24,i.numberFormat="%"+1..toString()+".",i.listLevelPattern="UpRoman",i.followCharacter="Tab",i.startAt=1,i.restartLevel=1,this.dialog.documentHelper.abstractLists.push(e),this.dialog.documentHelper.getAbstractListById(this.list.abstractListId).levels[0]}return this.dialog.documentHelper.getAbstractListById(this.list.abstractListId).levels.length<=this.levelNumber&&this.addListLevels(),this.dialog.documentHelper.getAbstractListById(this.list.abstractListId).levels[this.levelNumber]}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"listLevelPattern",{get:function(){return t.isNullOrUndefined(this.listLevel)?"Arabic":this.listLevel.listLevelPattern},set:function(e){t.isNullOrUndefined(this.listLevel)||(this.listLevel.listLevelPattern=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"followCharacter",{get:function(){return t.isNullOrUndefined(this.listLevel)?"None":this.listLevel.followCharacter},set:function(e){t.isNullOrUndefined(this.listLevel)||(this.listLevel.followCharacter=e)},enumerable:!0,configurable:!0}),e.prototype.createList=function(){this.list=new C,this.list.listId=this.dialog.documentHelper.lists.length+1;var e=new V;e.abstractListId=this.dialog.documentHelper.abstractLists.length+1,this.list.abstractListId=e.abstractListId,this.dialog.documentHelper.lists.push(this.list);var t=new _(e);t.paragraphFormat=new P(t),t.paragraphFormat.leftIndent=48,t.paragraphFormat.firstLineIndent=-24,t.characterFormat=new H(t),t.numberFormat="%1.",t.startAt=1,e.levels.push(t),this.dialog.documentHelper.abstractLists.push(e)},e.prototype.addListLevels=function(){if(!t.isNullOrUndefined(this.list)&&!t.isNullOrUndefined(this.list.abstractListId))for(var e=this.dialog.documentHelper.getAbstractListById(this.list.abstractListId).levels.length;e<9;e++){var i=new _(this.dialog.documentHelper.getAbstractListById(this.list.abstractListId));i.characterFormat=new H(i),i.paragraphFormat=new P(i),i.paragraphFormat.leftIndent=48*(e+1),i.paragraphFormat.firstLineIndent=-24,i.numberFormat="%"+(e+1).toString()+".",i.listLevelPattern="Arabic",i.followCharacter="Tab",i.startAt=1,i.restartLevel=e,this.dialog.documentHelper.getAbstractListById(this.list.abstractListId).levels.push(i)}},e.prototype.destroy=function(){this.list=void 0,this.followCharacter=void 0,this.levelNumber=void 0,this.listLevelPattern=void 0},e}(),gi=function(){function e(e){var i=this;this.dialog=void 0,this.target=void 0,this.documentHelper=void 0,this.viewModel=void 0,this.startAt=void 0,this.textIndent=void 0,this.alignedAt=void 0,this.listLevelElement=void 0,this.followNumberWith=void 0,this.numberStyle=void 0,this.numberFormat=void 0,this.restartBy=void 0,this.isListCharacterFormat=!1,this.onTextIndentChanged=function(e){i.viewModel.listLevel.paragraphFormat.leftIndent=e.value},this.onStartValueChanged=function(e){t.isNullOrUndefined(i.viewModel)||t.isNullOrUndefined(i.viewModel.listLevel)||(i.viewModel.listLevel.startAt=e.value)},this.onListLevelValueChanged=function(e){i.viewModel.levelNumber=parseInt(e.value.slice(e.value.length-1),10)-1,t.isNullOrUndefined(i.listLevel)||(t.isNullOrUndefined(i.listLevel.characterFormat)&&(i.listLevel.characterFormat=new H(i.viewModel.listLevel)),t.isNullOrUndefined(i.listLevel.paragraphFormat)||(i.listLevel.paragraphFormat=new P(i.viewModel.listLevel)),i.updateDialogValues(),i.updateRestartLevelBox())},this.onNumberFormatChanged=function(e){i.viewModel.listLevel.numberFormat=e.target.value},this.onAlignedAtValueChanged=function(e){i.viewModel.listLevel.paragraphFormat.firstLineIndent=e.value},this.onFollowCharacterValueChanged=function(e){e.value&&(i.viewModel.followCharacter=e.value)},this.onLevelPatternValueChanged=function(e){i.viewModel.listLevelPattern=e.value;var t="%"+(i.levelNumber+1).toString(),n=document.getElementById(i.documentHelper.owner.containerId+"_numberFormat");"Bullet"===i.listLevel.listLevelPattern?(i.listLevel.numberFormat="",n.value=i.listLevel.numberFormat,i.listLevel.characterFormat.fontFamily="Wingdings"):("None"===i.listLevel.listLevelPattern&&(i.listLevel.numberFormat=""),i.listLevel.numberFormat.match(t)||"None"===i.listLevel.listLevelPattern||(i.listLevel.numberFormat=t+"."),n.value=i.listLevel.numberFormat)},this.loadListDialog=function(){i.documentHelper.updateFocus(),t.isNullOrUndefined(i.documentHelper.owner)||(i.viewModel=new ui,i.viewModel.dialog=i,i.documentHelper.selection.paragraphFormat.listLevelNumber>0&&(i.viewModel.levelNumber=i.documentHelper.selection.paragraphFormat.listLevelNumber),i.viewModel.list=i.documentHelper.selection.paragraphFormat.getList(),t.isNullOrUndefined(i.listLevel)||(t.isNullOrUndefined(i.listLevel.characterFormat)&&(i.listLevel.characterFormat=new H(i.viewModel.listLevel)),t.isNullOrUndefined(i.listLevel.paragraphFormat)&&(i.listLevel.paragraphFormat=new P(i.viewModel.listLevel)),i.updateDialogValues(),"none"!==i.documentHelper.selection.caret.style.display&&(i.documentHelper.selection.caret.style.display="none")))},this.showFontDialog=function(){i.documentHelper.owner.fontDialogModule.showFontDialog(i.listLevel.characterFormat)},this.onApplyList=function(){t.isNullOrUndefined(i.owner)||i.documentHelper.selection.paragraphFormat.setList(i.list),i.documentHelper.dialog2.hide(),i.documentHelper.updateFocus()},this.onCancelButtonClick=function(){i.disposeBindingForListUI(),i.documentHelper.dialog2.hide(),i.documentHelper.updateFocus(),i.isListCharacterFormat=!1},this.closeListDialog=function(){i.disposeBindingForListUI(),i.documentHelper.updateFocus(),i.isListCharacterFormat=!1},this.documentHelper=e,this.viewModel=new ui}return Object.defineProperty(e.prototype,"listLevel",{get:function(){if(!t.isNullOrUndefined(this.viewModel))return this.viewModel.listLevel},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"list",{get:function(){if(!t.isNullOrUndefined(this.viewModel))return this.viewModel.list},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"levelNumber",{get:function(){return this.listLevel.ownerBase instanceof w?this.listLevel.ownerBase.levelNumber:this.listLevel.ownerBase instanceof V&&!t.isNullOrUndefined(this.listLevel.ownerBase.levels)?this.listLevel.ownerBase.levels.indexOf(this.listLevel):-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"owner",{get:function(){return this.documentHelper.owner.viewer},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"ListDialog"},e.prototype.showListDialog=function(){var e=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);e.setLocale(this.documentHelper.owner.locale),this.target||this.initListDialog(e,this.documentHelper.owner.enableRtl),this.isListCharacterFormat=!0,this.documentHelper.dialog2.header=e.getConstant("Define new Multilevel list"),this.documentHelper.dialog2.height="auto",this.documentHelper.dialog2.width="auto",this.documentHelper.dialog2.content=this.target;var i,n=this.documentHelper.owner.enableRtl;i=n?"e-flat e-list-dlg-font e-de-dlg-target.e-de-rtl e-font-rtl":"e-flat e-list-dlg-font e-font",this.documentHelper.dialog2.buttons=[{click:this.showFontDialog,buttonModel:{content:e.getConstant("Font"),cssClass:i}},{click:this.onApplyList,buttonModel:{content:e.getConstant("Ok"),cssClass:"e-flat e-list-dlg",isPrimary:!0}},{click:this.onCancelButtonClick,buttonModel:{content:e.getConstant("Cancel"),cssClass:"e-flat e-list-dlg"}}],this.documentHelper.dialog2.dataBind(),this.wireAndBindEvent(e,n),this.documentHelper.dialog2.beforeOpen=this.loadListDialog,this.documentHelper.dialog2.close=this.closeListDialog,this.documentHelper.dialog2.position={X:"center",Y:"top"},this.documentHelper.dialog2.show()},e.prototype.initListDialog=function(e,i){var n=this.documentHelper.owner.containerId,r=n+"_insert_list";this.target=t.createElement("div",{id:r,className:"e-de-list-dlg"});var o=t.createElement("div",{innerHTML:'<label id="'+n+'_listLevellabel" style="display:block;" class=e-de-list-ddl-header-list-level>'+e.getConstant("List level")+'</label><label id="'+n+'_modifyLabel" style="display:block;" class=e-de-list-ddl-subheader>'+e.getConstant("Choose level to modify")+'</label><select style="height:20px;width:43%" id="'+n+'_listLevel"><option>'+e.getConstant("Level")+" 1</option><option>"+e.getConstant("Level")+" 2</option><option>"+e.getConstant("Level")+" 3</option><option>"+e.getConstant("Level")+" 4</option><option>"+e.getConstant("Level")+" 5</option><option>"+e.getConstant("Level")+" 6</option><option>"+e.getConstant("Level")+" 7</option><option>"+e.getConstant("Level")+" 8</option><option>"+e.getConstant("Level")+" 9</option></select>"});this.target.appendChild(o);var s,a=t.createElement("div");s=i?'<div style="float:right;display:block;width:241px;">':'<div style="float:left;display:block;">';var l=t.createElement("div",{innerHTML:s+'<label id="'+n+'_numberFormatLabel" style="display:block;" class=e-de-list-ddl-header>'+e.getConstant("Number format")+'</label><label id="'+n+'_numberStyleLabel" style="display:block;" class=e-de-list-ddl-subheader>'+e.getConstant("Number style for this level")+'</label><select style="height:20px;width:100%" id="'+n+'_numberStyle"><option>'+e.getConstant("Arabic")+"</option><option>"+e.getConstant("UpRoman")+"</option><option>"+e.getConstant("LowRoman")+"</option><option>"+e.getConstant("UpLetter")+"</option><option>"+e.getConstant("LowLetter")+"</option><option>"+e.getConstant("Number")+"</option><option>"+e.getConstant("Leading zero")+"</option><option>"+e.getConstant("Bullet")+"</option><option>"+e.getConstant("Ordinal")+"</option><option>"+e.getConstant("Ordinal Text")+"</option><option>"+e.getConstant("Special")+"</option><option>"+e.getConstant("For East")+'</option></select><label id="'+n+'_startAtLabel" style="display:block;" class=e-de-list-ddl-subheaderbottom>'+e.getConstant("Start at")+'</label><input type="text" id="'+n+'_startAt">'});a.appendChild(l),this.numberFormatDiv=t.createElement("div",{className:"e-de-list-dlg-subdiv",innerHTML:'<div><div><label id="'+n+'_formatLabel" style="display:inline-block;width:86%" class=e-de-list-ddl-subheader>'+e.getConstant("Enter formatting for number")+'</label><button type="button" id="'+n+'_list_info" class="e-control e-btn e-primary e-de-list-format-info">i</button></div><input style=width:180px; type="text" id="'+n+'_numberFormat" class=e-input></div><label id="'+n+'_restartLabel" style="display:block;" class=e-de-list-ddl-subheaderbottom>'+e.getConstant("Restart list after")+'</label><select style="height:20px;width:100%" id="'+n+'_restartBy"><option>'+e.getConstant("No Restart")+"</option></select></div>"}),a.appendChild(this.numberFormatDiv),this.target.appendChild(a);var d;d=i?"display:block;position:relative; ":"display:block; ";var h=t.createElement("div",{innerHTML:s+'<label id="'+n+'_IndentsLabel" style='+d+"class=e-de-list-ddl-header>"+e.getConstant("Position")+'</label><label id="'+n+'_textIndentLabel" style='+d+"class=e-de-list-ddl-subheader>"+e.getConstant("Text indent at")+'</label><input type="text" id="'+n+'_textIndent"><label id="'+n+'_followCharacterLabel" style='+d+"class=e-de-list-ddl-subheaderbottom>"+e.getConstant("Follow number with")+'</label><select style="height:20px;width:100%" id="'+n+'_followCharacter"><option>'+e.getConstant("Tab character")+"</option><option>"+e.getConstant("Space")+"</option><option>"+e.getConstant("Nothing")+'</option></select></div><div id="e-de-list-dlg-div" class="e-de-list-dlg-div"><label id="'+n+'_alignedAtLabel" style="display:block;" class=e-de-list-ddl-subheader>'+e.getConstant("Aligned at")+'</label><input type="text" id="'+n+'_alignedAt"></div>'});this.target.appendChild(h)},e.prototype.wireAndBindEvent=function(e,t){var i=this.documentHelper.owner.containerId;t&&(document.getElementById("e-de-list-dlg-div").classList.add("e-de-rtl"),this.numberFormatDiv.classList.add("e-de-rtl"));var r=document.getElementById(i+"_startAt"),o=document.getElementById(i+"_textIndent"),l=document.getElementById(i+"_alignedAt");this.startAt=new a.NumericTextBox({format:"#",decimals:0,min:0,max:50,width:"180px",enablePersistence:!1}),this.startAt.addEventListener("change",this.onStartValueChanged),this.startAt.appendTo(r),this.textIndent=new a.NumericTextBox({format:"#",decimals:0,min:0,max:1584,width:"180px",step:4,enablePersistence:!1}),this.textIndent.addEventListener("change",this.onTextIndentChanged),this.textIndent.appendTo(o),this.alignedAt=new a.NumericTextBox({format:"#",max:1584,step:6,width:"180px",enablePersistence:!1}),this.alignedAt.addEventListener("change",this.onAlignedAtValueChanged),this.alignedAt.appendTo(l);var d=document.getElementById(i+"_listLevel");this.listLevelElement=new s.DropDownList({popupHeight:"150px",width:"180px",enableRtl:t,change:this.onListLevelValueChanged}),this.listLevelElement.appendTo(d);var h=document.getElementById(i+"_followCharacter");this.followNumberWith=new s.DropDownList({popupHeight:"150px",width:"180px",enableRtl:t,change:this.onFollowCharacterValueChanged}),this.followNumberWith.appendTo(h);var c=document.getElementById(i+"_numberStyle");this.numberStyle=new s.DropDownList({popupHeight:"150px",width:"180px",enableRtl:t,change:this.onLevelPatternValueChanged}),this.numberStyle.appendTo(c),this.numberFormat=document.getElementById(i+"_numberFormat"),this.numberFormat.addEventListener("change",this.onNumberFormatChanged);var p=document.getElementById(i+"_restartBy");this.restartBy=new s.DropDownList({popupHeight:"150px",width:"180px",enableRtl:t}),this.restartBy.appendTo(p);var u=document.getElementById(i+"_list_info");this.formatInfoToolTip=new n.Tooltip({width:200}),this.formatInfoToolTip.content=e.getConstant("Number format tooltip information"),this.formatInfoToolTip.position="RightTop",this.formatInfoToolTip.appendTo(u)},e.prototype.updateRestartLevelBox=function(){for(var e=this.documentHelper.owner.containerId,t=document.getElementById(e+"_listLevel"),i=document.getElementById(e+"_restartBy"),n=0;n<i.options.length;n)i.options.remove(n);if(0===t.selectedIndex)(o=document.createElement("option")).value="No Restart",o.innerHTML="No Restart",i.appendChild(o);else{for(n=t.selectedIndex;n>0;n--){var r=document.createElement("option");r.value="Level "+n,r.innerHTML="Level "+n,i.appendChild(r)}var o=document.createElement("option");o.value="No Restart",o.innerHTML="No Restart",i.appendChild(o)}i.selectedIndex=0},e.prototype.listPatternConverter=function(e){switch(e){case"Arabic":return 0;case"LowLetter":return 1;case"LowRoman":return 2;case"UpLetter":return 3;case"UpRoman":return 4;case"Number":return 5;case"LeadingZero":return 6;case"Bullet":return 7;case"Ordinal":return 8;case"OrdinalText":return 9;case"Special":return 10;case"FarEast":return 11;default:return 12}},e.prototype.followCharacterConverter=function(e){switch(e){case"Tab":return 0;case"Space":return 1;default:return 2}},e.prototype.updateDialogValues=function(){t.isNullOrUndefined(this.viewModel)||t.isNullOrUndefined(this.viewModel.listLevel)||(this.startAt.value=this.viewModel.listLevel.startAt,this.textIndent.value=this.viewModel.listLevel.paragraphFormat.leftIndent,this.alignedAt.value=this.viewModel.listLevel.paragraphFormat.firstLineIndent,this.followNumberWith.index=this.followCharacterConverter(this.viewModel.followCharacter),this.numberFormat.value=this.viewModel.listLevel.numberFormat,this.numberStyle.index=this.listPatternConverter(this.viewModel.listLevelPattern),this.listLevelElement.index=this.viewModel.levelNumber)},e.prototype.disposeBindingForListUI=function(){this.followNumberWith.index=-1,this.numberFormat.value=" ",this.numberStyle.index=-1,this.listLevelElement.index=-1,this.restartBy.index=-1,this.viewModel.destroy()},e.prototype.destroy=function(){if(this.alignedAt&&this.alignedAt.destroy(),this.alignedAt=void 0,this.dialog=void 0,this.followNumberWith&&this.followNumberWith.destroy(),this.followNumberWith=void 0,this.listLevelElement&&this.listLevelElement.destroy(),this.listLevelElement=void 0,this.textIndent&&this.textIndent.destroy(),this.textIndent=void 0,this.startAt&&this.startAt.destroy(),this.startAt=void 0,this.numberStyle&&this.numberStyle.destroy(),this.numberStyle=void 0,this.numberFormat=void 0,this.restartBy&&this.restartBy.destroy(),this.restartBy=void 0,!t.isNullOrUndefined(this.target)){this.target.parentElement&&this.target.parentElement.removeChild(this.target);for(var e=0;e<this.target.childNodes.length;e++)this.target.removeChild(this.target.childNodes[e]),e--;this.target=void 0}this.documentHelper=void 0,this.viewModel=void 0},e}(),mi=function(){function e(e){var i=this;this.target=void 0,this.styleType=void 0,this.styleBasedOn=void 0,this.styleParagraph=void 0,this.onlyThisDocument=void 0,this.template=void 0,this.fontFamily=void 0,this.fontSize=void 0,this.characterFormat=void 0,this.paragraphFormat=void 0,this.openDialog=function(e){switch(e.item.id){case"style_font":i.showFontDialog();break;case"style_paragraph":i.showParagraphDialog();break;case"style_numbering":i.showNumberingBulletDialog()}},this.setBoldProperty=function(){i.characterFormat.bold=!i.characterFormat.bold,i.fontButtonClicked()},this.setItalicProperty=function(){i.characterFormat.italic=!i.characterFormat.italic,i.fontButtonClicked()},this.setUnderlineProperty=function(){i.characterFormat.underline="None"===i.characterFormat.underline?"Single":"None",i.fontButtonClicked()},this.fontButtonClicked=function(){i.characterFormat.bold?i.bold.classList.contains("e-active")||i.bold.classList.add("e-active"):i.bold.classList.contains("e-active")&&i.bold.classList.remove("e-active"),i.characterFormat.italic?i.italic.classList.contains("e-active")||i.italic.classList.add("e-active"):i.italic.classList.contains("e-active")&&i.italic.classList.remove("e-active"),void 0!==i.characterFormat.underline&&"None"!==i.characterFormat.underline?i.underline.classList.contains("e-active")||(i.underline.classList.add("e-active"),i.characterFormat.underline="Single"):i.underline.classList.contains("e-active")&&(i.underline.classList.remove("e-active"),i.characterFormat.underline="None")},this.fontSizeUpdate=function(e){i.characterFormat.fontSize=e.value},this.fontFamilyChanged=function(e){i.characterFormat.fontFamily=e.value.toString()},this.fontColorUpdate=function(e){i.characterFormat.fontColor=e.currentValue.hex},this.setLeftAlignment=function(){"Left"===i.paragraphFormat.textAlignment?i.paragraphFormat.textAlignment="Justify":i.paragraphFormat.textAlignment="Left",i.updateParagraphFormat()},this.setRightAlignment=function(){"Right"===i.paragraphFormat.textAlignment?i.paragraphFormat.textAlignment="Left":i.paragraphFormat.textAlignment="Right",i.updateParagraphFormat()},this.setCenterAlignment=function(){"Center"===i.paragraphFormat.textAlignment?i.paragraphFormat.textAlignment="Left":i.paragraphFormat.textAlignment="Center",i.updateParagraphFormat()},this.setJustifyAlignment=function(){"Justify"===i.paragraphFormat.textAlignment?i.paragraphFormat.textAlignment="Left":i.paragraphFormat.textAlignment="Justify",i.updateParagraphFormat()},this.increaseBeforeAfterSpacing=function(){i.paragraphFormat.beforeSpacing+=6,i.paragraphFormat.afterSpacing+=6},this.decreaseBeforeAfterSpacing=function(){i.paragraphFormat.beforeSpacing>=6?i.paragraphFormat.beforeSpacing-=6:i.paragraphFormat.beforeSpacing=0,i.paragraphFormat.afterSpacing>=6?i.paragraphFormat.afterSpacing-=6:i.paragraphFormat.afterSpacing=0},this.updateNextStyle=function(e){var n=e.srcElement.value;if(i.getTypeValue()===i.localObj.getConstant("Paragraph")&&!t.isNullOrUndefined(n)&&""!==n&&!i.isUserNextParaUpdated){var r=i.documentHelper.styles.getStyleNames(i.getTypeValue());i.isEdit&&(r=r.filter(function(e){return e!==i.editStyleName})),r.push(n),i.styleParagraph.dataSource=r,i.styleParagraph.index=null,i.styleParagraph.index=r.indexOf(n),i.styleParagraph.dataBind()}},this.updateOkButton=function(){i.target.getElementsByClassName("e-input e-de-style-dlg-name-input").item(0).value;i.enableOrDisableOkButton()},this.styleTypeChange=function(e){if(e.isInteracted){var t=void 0;e.value===i.localObj.getConstant("Character")&&(i.style=new D,t="Character"),e.value!==i.localObj.getConstant("Paragraph")&&e.value!==i.localObj.getConstant("Linked Style")||(i.style=new R,t="Paragraph"),i.toggleDisable(),i.updateStyleNames(t)}},this.styleBasedOnChange=function(){},this.styleParagraphChange=function(e){e.isInteracted&&(i.isUserNextParaUpdated=!0)},this.showFontDialog=function(){t.isNullOrUndefined(i.documentHelper.owner.fontDialogModule)||i.documentHelper.owner.showFontDialog(i.characterFormat),i.updateCharacterFormat()},this.showParagraphDialog=function(){t.isNullOrUndefined(i.documentHelper.owner.paragraphDialogModule)||i.documentHelper.owner.showParagraphDialog(i.paragraphFormat)},this.showNumberingBulletDialog=function(){i.numberingBulletDialog=new fi(i.documentHelper),i.style instanceof R&&!t.isNullOrUndefined(i.style.paragraphFormat)&&i.numberingBulletDialog.showNumberBulletDialog(i.style.paragraphFormat.listFormat,i.abstractList)},this.onOkButtonClick=function(){var e=i.styleNameElement.value;if(!(e.length>0))throw new Error("Enter valid Style name");var n,r=i.documentHelper.styles.findByName(e);if(t.isNullOrUndefined(r)){var o="Paragraph"===i.getTypeValue()?new R:new D;o.copyStyle(i.style);var s=i.documentHelper.styles.findByName(i.styleBasedOn.value);i.styleType.value!==i.localObj.getConstant("Paragraph")&&i.styleType.value!==i.localObj.getConstant("Linked Style")||(e===i.styleParagraph.value?o.next=o:o.next=i.documentHelper.styles.findByName(i.styleParagraph.value),i.updateList()),o.link=i.styleType.value===i.localObj.getConstant("Linked Style")?i.createLinkStyle(e):void 0,o.type=i.getTypeValue(),o.name=e,o.basedOn=s,i.documentHelper.styles.push(o),n=e,i.documentHelper.owner.editorModule.applyStyle(n)}else i.style.type=i.getTypeValue(),i.style.basedOn=i.documentHelper.styles.findByName(i.styleBasedOn.value),i.styleType.value!==i.localObj.getConstant("Paragraph")&&i.styleType.value!==i.localObj.getConstant("Linked Style")||(i.style.next=i.documentHelper.styles.findByName(i.styleParagraph.value),i.style.characterFormat.mergeFormat(r.characterFormat),i.style.paragraphFormat.mergeFormat(r.paragraphFormat,!0),i.updateList(),i.style.link=i.styleType.value===i.localObj.getConstant("Linked Style")?i.createLinkStyle(e,i.isEdit):void 0),i.style.name=r.name,n=r.name,r=i.style,i.documentHelper.owner.isShiftingEnabled=!0,i.documentHelper.owner.editorModule.layoutWholeDocument(),i.documentHelper.owner.isShiftingEnabled=!1;i.documentHelper.dialog2.hide(),i.documentHelper.updateFocus(),i.style,i.documentHelper.updateFocus()},this.loadStyleDialog=function(){i.documentHelper.updateFocus(),i.isUserNextParaUpdated=!1,i.styleNameElement=i.target.getElementsByClassName("e-input e-de-style-dlg-name-input").item(0),i.styleNameElement.value=null,i.isEdit||(i.styleType.index=0);var e;i.isEdit&&(i.styleNameElement.value=i.editStyleName,e=i.editStyleName),i.okButton=i.documentHelper.dialog2.element.getElementsByClassName("e-flat e-style-okay").item(0),i.enableOrDisableOkButton(),i.updateStyleNames(i.getTypeValue(),e),i.updateCharacterFormat(i.style.characterFormat),i.updateParagraphFormat(i.style.paragraphFormat)},this.onCancelButtonClick=function(){!i.isEdit&&i.style&&i.style.destroy(),i.documentHelper.dialog2.hide(),i.documentHelper.updateFocus()},this.closeStyleDialog=function(){i.documentHelper.updateFocus()},this.documentHelper=e}return e.prototype.getModuleName=function(){return"StyleDialog"},e.prototype.initStyleDialog=function(e,i){this.localObj=e;var n=this.documentHelper.owner.containerId+"_style";this.target=t.createElement("div",{id:n,className:"e-de-style-dialog"});var r=t.createElement("div"),o=t.createElement("div",{className:"e-de-style-properties",innerHTML:e.getConstant("Properties")});r.appendChild(o);var a=t.createElement("div",{styles:"display:flex",className:"e-de-style-nametype-div"});r.appendChild(a);var l=t.createElement("div",{className:"e-de-style-left-div"});a.appendChild(l);var d=t.createElement("div",{className:"e-de-style-name",innerHTML:e.getConstant("Name")+":"});l.appendChild(d);var h=t.createElement("input",{id:this.documentHelper.owner.containerId+"_style_name",styles:"width:210px;",className:"e-input e-de-style-dlg-name-input"});h.addEventListener("keyup",this.updateOkButton),h.addEventListener("input",this.updateOkButton),h.addEventListener("blur",this.updateNextStyle),l.appendChild(h);var c=t.createElement("div");a.appendChild(c);var p=t.createElement("div",{className:"e-de-style-styletype",innerHTML:e.getConstant("Style type")+":"});c.appendChild(p);var u=t.createElement("div",{className:"e-de-style-style-type-div"}),g=t.createElement("select",{id:"e-de-style-style-type"});g.innerHTML='<option value="Paragraph">'+e.getConstant("Paragraph")+'</option><option value="Character">'+e.getConstant("Character")+"</option><option>"+e.getConstant("Linked Style")+"</option>",u.appendChild(g),this.styleType=new s.DropDownList({change:this.styleTypeChange,popupHeight:"253px",width:"210px",enableRtl:i}),this.styleType.appendTo(g),c.appendChild(u);var m=t.createElement("div",{styles:"display:flex",className:"e-de-style-based-para-div"});r.appendChild(m);var f=t.createElement("div",{className:"e-de-style-left-div"});m.appendChild(f);var v=t.createElement("div",{className:"e-de-style-style-based-on",innerHTML:e.getConstant("Style based on")+":"});f.appendChild(v);var y=t.createElement("div",{className:"e-de-style-style-based-on-div"}),b=t.createElement("input",{id:"e-de-style-style-based-on-value"});y.appendChild(b),this.styleBasedOn=new s.DropDownList({dataSource:[],select:this.styleBasedOnChange,popupHeight:"253px",width:"210px",enableRtl:i}),this.styleBasedOn.appendTo(b),f.appendChild(y);var w=t.createElement("div");m.appendChild(w),i&&(l.classList.add("e-de-rtl"),f.classList.add("e-de-rtl"),w.classList.add("e-de-rtl"));var C=t.createElement("div",{className:"e-de-style-style-paragraph",innerHTML:e.getConstant("Style for following paragraph")+":"});w.appendChild(C);var x=t.createElement("div",{className:"e-de-style-style-paragraph-div"}),F=t.createElement("input",{id:"e-de-style-style-paragraph-value"});x.appendChild(F),this.styleParagraph=new s.DropDownList({dataSource:[],select:this.styleParagraphChange,popupHeight:"253px",width:"210px",enableRtl:i}),this.styleParagraph.appendTo(F),w.appendChild(x);var P=t.createElement("div",{className:"e-de-style-formatting",innerHTML:e.getConstant("Formatting")});r.appendChild(P);var T=t.createElement("div",{className:"e-de-style-options-div"});r.appendChild(T);var S=t.createElement("div",{styles:"display:flex;margin-bottom: 14px;"});T.appendChild(S),this.createFontOptions(S,i);var I=t.createElement("div",{styles:"display:flex",className:"e-style-paragraph"});T.appendChild(I),this.createParagraphOptions(I),this.createFormatDropdown(r,e,i),this.target.appendChild(r)},e.prototype.createFormatDropdown=function(e,i,n){var r=this,o=t.createElement("button",{id:"style_format_dropdown",innerHTML:i.getConstant("Format"),attrs:{type:"button"}});o.style.height="31px",e.appendChild(o);var s=[{text:i.getConstant("Font")+"...",id:"style_font"},{text:i.getConstant("Paragraph")+"...",id:"style_paragraph"},{text:i.getConstant("Numbering")+"...",id:"style_numbering"}];this.styleDropdwn=new d.DropDownButton({items:s,cssClass:"e-de-style-format-dropdwn",enableRtl:n,beforeItemRender:function(e){r.styleType.value===i.getConstant("Character")?(e.item.text===i.getConstant("Paragraph")&&e.element.classList.add("e-disabled"),"Numbering"===e.item.text&&e.element.classList.add("e-disabled")):(e.item.text===i.getConstant("Paragraph")&&e.element.classList.remove("e-disabled"),"Numbering"===e.item.text&&e.element.classList.remove("e-disabled"))}}),this.styleDropdwn.appendTo(o),this.styleDropdwn.addEventListener("select",this.openDialog)},e.prototype.createFontOptions=function(e,i){var n=this,r=t.createElement("input",{id:this.target.id+"_fontName"});e.appendChild(r),this.fontFamily=new s.ComboBox({dataSource:void 0,query:(new u.Query).select(["FontName"]),fields:{text:"FontName",value:"value"},allowCustom:!0,width:"123px",popupWidth:"123px",cssClass:"e-style-font-fmaily-right",enableRtl:i,change:this.fontFamilyChanged,showClearButton:!1,itemTemplate:'<span style="font-family: ${FontName};">${FontName}</span>'}),this.fontFamily.appendTo(r),this.fontFamily.isStringTemplate=!0;for(var o=this.documentHelper.owner.documentEditorSettings.fontFamilies,l=0;l<o.length;l++){var d=o[l],h={FontName:d,value:d};this.fontFamily.addItem(h,l)}this.fontFamily.focus=function(){n.fontFamily.element.select()},this.fontFamily.element.parentElement.setAttribute("title",this.localObj.getConstant("Font"));var c=t.createElement("input");e.appendChild(c);var p=[8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72];this.fontSize=new s.ComboBox({dataSource:p,width:"73px",cssClass:"e-style-font-fmaily-right",enableRtl:i,change:this.fontSizeUpdate}),this.fontSize.showClearButton=!1,this.fontSize.appendTo(c);var g=t.createElement("div",{className:"e-de-style-font-group-button"});e.appendChild(g),this.bold=this.createButtonElement(g,"e-de-bold","e-de-style-bold-button-size",this.documentHelper.owner.containerId+"_style_bold"),this.bold.addEventListener("click",this.setBoldProperty),this.italic=this.createButtonElement(g,"e-de-italic","e-de-style-icon-button-size",this.documentHelper.owner.containerId+"_style_italic"),this.italic.addEventListener("click",this.setItalicProperty),this.underline=this.createButtonElement(g,"e-de-underline","e-de-style-icon-button-size",this.documentHelper.owner.containerId+"_style_underline"),this.underline.addEventListener("click",this.setUnderlineProperty);var m=t.createElement("input",{attrs:{type:"color"},className:"e-de-style-icon-button-size"});e.appendChild(m),this.fontColor=new a.ColorPicker({cssClass:"e-de-style-font-color-picker",enableRtl:i,change:this.fontColorUpdate,locale:this.documentHelper.owner.locale}),this.fontColor.appendTo(m)},e.prototype.createParagraphOptions=function(e){var i=this,n=t.createElement("div",{className:"e-de-style-paragraph-group-button"});e.appendChild(n),this.leftAlign=this.createButtonElement(n,"e-de-align-left","e-de-style-icon-button-size"),this.leftAlign.addEventListener("click",this.setLeftAlignment),this.centerAlign=this.createButtonElement(n,"e-de-align-center","e-de-style-icon-button-size"),this.centerAlign.addEventListener("click",this.setCenterAlignment),this.rightAlign=this.createButtonElement(n,"e-de-align-right","e-de-style-icon-button-size"),this.rightAlign.addEventListener("click",this.setRightAlignment),this.justify=this.createButtonElement(n,"e-de-justify","e-de-style-icon-button-last-size"),this.justify.addEventListener("click",this.setJustifyAlignment);var r=t.createElement("div",{className:"e-de-style-paragraph-group-button"});e.appendChild(r),this.singleLineSpacing=this.createButtonElement(r,"e-de-single-spacing","e-de-style-icon-button-first-size"),this.singleLineSpacing.addEventListener("click",function(){i.paragraphFormat.lineSpacing=1,i.updateParagraphFormat()}),this.onePointFiveLineSpacing=this.createButtonElement(r,"e-de-one-point-five-spacing","e-de-style-icon-button-size"),this.onePointFiveLineSpacing.addEventListener("click",function(){i.paragraphFormat.lineSpacing=1.5,i.updateParagraphFormat()}),this.doubleLineSpacing=this.createButtonElement(r,"e-de-double-spacing","e-de-style-icon-button-last-size"),this.doubleLineSpacing.addEventListener("click",function(){i.paragraphFormat.lineSpacing=2,i.updateParagraphFormat()});var o=t.createElement("div",{className:"e-de-style-paragraph-group-button"});e.appendChild(o);var s=this.createButtonElement(o,"e-de-before-spacing","e-de-style-icon-button-first-size"),a=this.createButtonElement(o,"e-de-after-spacing","e-de-style-icon-button-last-size");s.addEventListener("click",this.increaseBeforeAfterSpacing),a.addEventListener("click",this.decreaseBeforeAfterSpacing);var l=t.createElement("div",{className:"e-de-style-paragraph-indent-group-button"});e.appendChild(l),this.createButtonElement(l,"e-de-indent","e-de-style-icon-button-first-size").addEventListener("click",function(){i.paragraphFormat.leftIndent>=36?i.paragraphFormat.leftIndent-=36:i.paragraphFormat.leftIndent=0}),this.createButtonElement(l,"e-de-outdent","e-de-style-icon-button-size").addEventListener("click",function(){i.paragraphFormat.leftIndent+=36})},e.prototype.createButtonElement=function(e,i,n,o){var s=t.createElement("button",{attrs:{type:"button"}});return t.isNullOrUndefined(o)||(s.id=o),e.appendChild(s),new r.Button({iconCss:i,cssClass:n}).appendTo(s),s},e.prototype.toggleDisable=function(){this.styleType.value===this.localObj.getConstant("Character")?(this.styleParagraph.enabled=!1,this.target.getElementsByClassName("e-style-paragraph").item(0).setAttribute("style","display:flex;pointer-events:none;opacity:0.5")):(this.styleParagraph.enabled=!0,this.target.getElementsByClassName("e-style-paragraph").item(0).removeAttribute("style"),this.target.getElementsByClassName("e-style-paragraph").item(0).setAttribute("style","display:flex")),this.styleBasedOn.enabled=!0},e.prototype.show=function(e,i){var n=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);this.isEdit=!t.isNullOrUndefined(e)&&e.length>0,this.editStyleName=e,this.abstractList=new V;var r=this.documentHelper.styles.findByName(e);this.style=this.isEdit?r||this.getStyle(e):new R,n.setLocale(this.documentHelper.owner.locale),this.target||this.initStyleDialog(n,this.documentHelper.owner.enableRtl),t.isNullOrUndefined(i)&&(i=n.getConstant("Create New Style")),this.documentHelper.dialog2.header=i,this.documentHelper.dialog2.height="auto",this.documentHelper.dialog2.width="auto",this.documentHelper.dialog2.content=this.target,this.documentHelper.dialog2.buttons=[{click:this.onOkButtonClick,buttonModel:{content:n.getConstant("Ok"),cssClass:"e-flat e-style-okay",isPrimary:!0}},{click:this.onCancelButtonClick,buttonModel:{content:n.getConstant("Cancel"),cssClass:"e-flat e-style-cancel"}}],this.toggleDisable(),this.documentHelper.dialog2.dataBind(),this.documentHelper.dialog2.beforeOpen=this.loadStyleDialog,this.documentHelper.dialog2.close=this.closeStyleDialog,this.documentHelper.dialog2.position={X:"center",Y:"center"},this.documentHelper.dialog2.show()},e.prototype.updateList=function(){var e=this.style.paragraphFormat.listFormat.listId;e>-1&&(0===this.documentHelper.lists.filter(function(t){return t.listId===e}).length?this.documentHelper.lists.push(this.style.paragraphFormat.listFormat.list):(this.documentHelper.lists=this.documentHelper.lists.filter(function(t){return t.listId!==e}),this.documentHelper.lists.push(this.style.paragraphFormat.listFormat.list))),-1!==this.abstractList.abstractListId&&this.documentHelper.abstractLists.push(this.abstractList)},e.prototype.createLinkStyle=function(e,t){var i;return i=t?this.documentHelper.styles.findByName(e+" Char","Character"):new D,i.type="Character",i.name=e+" Char",i.characterFormat=this.style.characterFormat.cloneFormat(),i.basedOn=this.style.basedOn,t||this.documentHelper.styles.push(i),this.documentHelper.styles.findByName(i.name,"Character")},e.prototype.updateCharacterFormat=function(e){t.isNullOrUndefined(e)||(this.characterFormat=e),this.fontFamily.value=this.characterFormat.fontFamily,this.fontSize.value=this.characterFormat.fontSize,this.fontColor.value=this.characterFormat.fontColor,this.fontButtonClicked()},e.prototype.updateParagraphFormat=function(e){t.isNullOrUndefined(e)||(this.paragraphFormat=e),"Left"===this.paragraphFormat.textAlignment?(this.leftAlign.classList.contains("e-active")||this.leftAlign.classList.add("e-active"),this.rightAlign.classList.contains("e-active")&&this.rightAlign.classList.remove("e-active"),this.centerAlign.classList.contains("e-active")&&this.centerAlign.classList.remove("e-active"),this.justify.classList.contains("e-active")&&this.justify.classList.remove("e-active")):"Right"===this.paragraphFormat.textAlignment?(this.leftAlign.classList.contains("e-active")&&this.leftAlign.classList.remove("e-active"),this.rightAlign.classList.contains("e-active")||this.rightAlign.classList.add("e-active"),this.centerAlign.classList.contains("e-active")&&this.centerAlign.classList.remove("e-active"),this.justify.classList.contains("e-active")&&this.justify.classList.remove("e-active")):"Center"===this.paragraphFormat.textAlignment?(this.leftAlign.classList.contains("e-active")&&this.leftAlign.classList.remove("e-active"),this.rightAlign.classList.contains("e-active")&&this.rightAlign.classList.remove("e-active"),this.centerAlign.classList.contains("e-active")||this.centerAlign.classList.add("e-active"),this.justify.classList.contains("e-active")&&this.justify.classList.remove("e-active")):"Justify"===this.paragraphFormat.textAlignment&&(this.leftAlign.classList.contains("e-active")&&this.leftAlign.classList.remove("e-active"),this.rightAlign.classList.contains("e-active")&&this.rightAlign.classList.remove("e-active"),this.centerAlign.classList.contains("e-active")&&this.centerAlign.classList.remove("e-active"),this.justify.classList.contains("e-active")||this.justify.classList.add("e-active")),1===this.paragraphFormat.lineSpacing?(this.singleLineSpacing.classList.add("e-active"),this.onePointFiveLineSpacing.classList.remove("e-active"),this.doubleLineSpacing.classList.remove("e-active")):1.5===this.paragraphFormat.lineSpacing?(this.singleLineSpacing.classList.remove("e-active"),this.onePointFiveLineSpacing.classList.add("e-active"),this.doubleLineSpacing.classList.remove("e-active")):2===this.paragraphFormat.lineSpacing?(this.singleLineSpacing.classList.remove("e-active"),this.onePointFiveLineSpacing.classList.remove("e-active"),this.doubleLineSpacing.classList.add("e-active")):(this.singleLineSpacing.classList.remove("e-active"),this.onePointFiveLineSpacing.classList.remove("e-active"),this.doubleLineSpacing.classList.remove("e-active"))},e.prototype.enableOrDisableOkButton=function(){t.isNullOrUndefined(this.okButton)||(this.okButton.disabled=""===this.styleNameElement.value)},e.prototype.getTypeValue=function(){return this.styleType.value===this.localObj.getConstant("Linked Style")||this.styleType.value===this.localObj.getConstant("Paragraph")?"Paragraph":"Character"},e.prototype.updateStyleNames=function(e,i){var n=this.documentHelper.styles.getStyleNames(e);if(this.styleParagraph.dataSource=n,this.styleParagraph.index=null,i){this.styleBasedOn.dataSource=n.filter(function(e){return e!==i}),this.styleBasedOn.index=null;var r=this.getStyle(i);if(r.basedOn instanceof String||t.isNullOrUndefined(r.basedOn)?this.styleBasedOn.enabled=!1:this.styleBasedOn.index=n.indexOf(r.basedOn.name)>-1?n.indexOf(r.basedOn.name):0,"Paragraph"===r.type?t.isNullOrUndefined(r.link)?this.styleType.index=0:this.styleType.index=2:this.styleType.index=1,!t.isNullOrUndefined(r.next)){var o=r.next.name,s=0;n.indexOf(o)>-1&&(s=n.indexOf(o)),this.styleParagraph.index=s,this.isUserNextParaUpdated=o!==i}}else{this.styleBasedOn.dataSource=n,this.styleBasedOn.index=null;var a=0;if(this.documentHelper.owner.selectionModule){var l=void 0;l="Character"===e?this.documentHelper.owner.selection.characterFormat.styleName:this.documentHelper.owner.selection.paragraphFormat.styleName,a=n.indexOf(l)}this.styleBasedOn.index=a,this.styleParagraph.index=0}this.isEdit?this.styleType.enabled=!1:this.styleType.enabled=!0,this.styleBasedOn.dataBind(),this.styleParagraph.dataBind()},e.prototype.getStyle=function(e){return t.isNullOrUndefined(this.documentHelper.styles.findByName(e))&&this.documentHelper.owner.editor.createStyle(this.documentHelper.preDefinedStyles.get(e)),this.documentHelper.styles.findByName(e)},e.prototype.destroy=function(){if(this.documentHelper=void 0,!t.isNullOrUndefined(this.target)){this.target.parentElement&&this.target.parentElement.removeChild(this.target);for(var e=0;e<this.target.childNodes.length;e++)this.target.removeChild(this.target.childNodes[e]),e--;this.target=void 0}this.fontColor&&(this.fontColor.destroy(),this.fontColor=void 0),this.fontSize&&(this.fontSize.destroy(),this.fontSize=void 0),this.fontFamily&&(this.fontFamily.destroy(),this.fontFamily=void 0),this.styleType&&(this.styleType.destroy(),this.styleType=void 0),this.styleBasedOn&&(this.styleBasedOn.destroy(),this.styleBasedOn=void 0),this.styleParagraph&&(this.styleParagraph.destroy(),this.styleParagraph=void 0),this.onlyThisDocument&&this.onlyThisDocument.destroy(),this.onlyThisDocument=void 0,this.template&&(this.template.destroy(),this.template=void 0),this.style&&(this.style=void 0),this.abstractList&&(this.abstractList=void 0),this.numberingBulletDialog&&(this.numberingBulletDialog.destroy(),this.numberingBulletDialog=void 0),this.styleDropdwn&&(this.styleDropdwn.destroy(),this.styleDropdwn=void 0)},e}(),fi=function(){function e(e){var i=this;this.isBullet=!1,this.numberListClick=function(e){i.isBullet=!1,i.setActiveElement(e),e.currentTarget.classList.contains("e-de-list-numbered-none")?(i.numberFormat=void 0,i.listLevelPattern=void 0):e.currentTarget.classList.contains("e-de-list-numbered-number-dot")?(i.numberFormat="%1.",i.listLevelPattern="Arabic"):e.currentTarget.classList.contains("e-de-list-numbered-number-brace")?(i.numberFormat="%1)",i.listLevelPattern="Arabic"):e.currentTarget.classList.contains("e-de-list-numbered-up-roman")?(i.numberFormat="%1.",i.listLevelPattern="UpRoman"):e.currentTarget.classList.contains("e-de-list-numbered-up-letter")?(i.numberFormat="%1.",i.listLevelPattern="UpLetter"):e.currentTarget.classList.contains("e-de-list-numbered-low-letter-brace")?(i.numberFormat="%1)",i.listLevelPattern="LowLetter"):e.currentTarget.classList.contains("e-de-numbered-low-letter-dot")?(i.numberFormat="%1.",i.listLevelPattern="LowLetter"):e.currentTarget.classList.contains("e-de-list-numbered-low-roman")&&(i.numberFormat="%1.",i.listLevelPattern="LowRoman")},this.bulletListClick=function(e){i.isBullet=!0,i.setActiveElement(e),e.currentTarget.classList.contains("e-bullet-none")?(i.symbol=void 0,i.fontFamily=void 0):e.currentTarget.classList.contains("e-bullet-dot")?(i.symbol="",i.fontFamily="Symbol"):e.currentTarget.classList.contains("e-bullet-circle")?(i.symbol=" ",i.fontFamily="Symbol"):e.currentTarget.classList.contains("e-bullet-square")?(i.symbol="",i.fontFamily="Wingdings"):e.currentTarget.classList.contains("e-bullet-flower")?(i.symbol="",i.fontFamily="Wingdings"):e.currentTarget.classList.contains("e-bullet-arrow")?(i.symbol="",i.fontFamily="Wingdings"):e.currentTarget.classList.contains("e-bullet-tick")&&(i.symbol="",i.fontFamily="Wingdings")},this.loadNumberingBulletDialog=function(){i.documentHelper.updateFocus()},this.closeNumberingBulletDialog=function(){i.unWireEventsAndBindings(),i.documentHelper.updateFocus()},this.onCancelButtonClick=function(){i.isBullet=!1,i.listLevelPattern=void 0,i.numberFormat=void 0,i.symbol=void 0,i.fontFamily=void 0,i.documentHelper.dialog.hide(),i.unWireEventsAndBindings()},this.onOkButtonClick=function(){i.documentHelper.owner.documentHelper.lists.length>0?(i.listFormat.list.listId=i.documentHelper.owner.documentHelper.lists[i.documentHelper.owner.documentHelper.lists.length-1].listId+1,i.listFormat.listId=i.listFormat.list.listId):(i.listFormat.list.listId=0,i.listFormat.listId=0),i.documentHelper.owner.documentHelper.abstractLists.length>0?i.abstractList.abstractListId=i.documentHelper.owner.documentHelper.abstractLists[i.documentHelper.owner.documentHelper.abstractLists.length-1].abstractListId+1:i.abstractList.abstractListId=0,i.listFormat.list.abstractListId=i.abstractList.abstractListId;var e=new _(i.abstractList);e.listLevelPattern=t.isNullOrUndefined(i.listLevelPattern)?"Bullet":i.listLevelPattern,e.numberFormat=i.isBullet?i.symbol:i.numberFormat,"Bullet"!==e.listLevelPattern&&(e.startAt=1),e.characterFormat.fontFamily=t.isNullOrUndefined(i.fontFamily)?"Verdana":i.fontFamily,e.paragraphFormat.leftIndent=36,e.paragraphFormat.firstLineIndent=-18,i.abstractList.levels.push(e),i.listFormat.listLevelNumber=0,i.listFormat.list.abstractList=i.abstractList,i.documentHelper.hideDialog()},this.documentHelper=e}return e.prototype.getModuleName=function(){return"BulletsAndNumberingDialog"},e.prototype.initNumberingBulletDialog=function(e){var n=this.documentHelper.owner.containerId;this.target=t.createElement("div",{id:n+"_insertNumberBulletDialog",className:"e-de-number-bullet-dlg"});var r=t.createElement("div",{id:n+"_tabNumberBulletDialog",className:"e-de-tab-number-bullet-dlg"});this.target.appendChild(r),this.createNumberList(n),this.createBulletList(n),this.tabObj=new i.Tab({items:[{header:{text:t.createElement("div",{innerHTML:e.getConstant("Numbering")})},content:this.numberListDiv},{header:{text:t.createElement("div",{innerHTML:e.getConstant("Bullets")})},content:this.bulletListDiv}],heightAdjustMode:"None",width:272,selecting:this.onTabSelect.bind(this)}),this.tabObj.isStringTemplate=!0,this.tabObj.appendTo(r)},e.prototype.onTabSelect=function(e){1===e.selectingIndex&&(this.bulletListDiv.style.display="block")},e.prototype.createNumberList=function(e){this.numberListDiv=t.createElement("div",{className:"e-de-style-numbered-list",id:e+"_Number"});var i=this.numberListDiv;i.style.height="270px";var n=t.createElement("ul",{styles:"display: block; outline: 0px;",id:"listMenu",className:"e-de-ui-wfloating-menu e-de-ui-bullets-menu e-de-list-container e-de-list-thumbnail"});i.appendChild(n);var r=this.createNumberNoneListTag(n),o=this.createNumberListTag(n,"1.","2.","3.","e-de-list-numbered-number-dot"),s=this.createNumberListTag(n,"1)","2)","3)","e-de-list-numbered-number-brace"),a=this.createNumberListTag(n,"I.","II.","III.","e-de-list-numbered-up-roman"),l=this.createNumberListTag(n,"A.","B.","C.","e-de-list-numbered-up-letter"),d=this.createNumberListTag(n,"a.","b.","c.","e-de-numbered-low-letter-dot"),h=this.createNumberListTag(n,"a)","b)","c)","e-de-list-numbered-low-letter-brace"),c=this.createNumberListTag(n,"i.","ii.","iii.","e-de-list-numbered-low-roman");r.addEventListener("click",this.numberListClick),o.addEventListener("click",this.numberListClick),s.addEventListener("click",this.numberListClick),a.addEventListener("click",this.numberListClick),l.addEventListener("click",this.numberListClick),h.addEventListener("click",this.numberListClick),d.addEventListener("click",this.numberListClick),c.addEventListener("click",this.numberListClick),this.target.appendChild(i)},e.prototype.createNumberListTag=function(e,i,n,r,o){var s=t.createElement("li",{styles:"display:block",className:"e-de-ui-wfloating-menuitem e-de-ui-wfloating-menuitem-md e-de-list-items e-de-list-item-size "+o});e.appendChild(s);var a="<div>"+i+'<span class="e-de-ui-list-line"></span></div><div>'+n+'<span class="e-de-ui-list-line">';a+="</span></div><div>"+r+'<span class="e-de-ui-list-line"> </span></div >';var l=t.createElement("div",{className:"e-de-ui-list-header-presetmenu",id:"e-de-ui-zlist0",innerHTML:a});return s.style.cssFloat="left",s.appendChild(l),s},e.prototype.createNumberNoneListTag=function(e){var i=t.createElement("li",{styles:"display:block",className:"e-de-ui-wfloating-menuitem e-de-ui-wfloating-menuitem-md e-de-list-items e-de-list-item-size e-de-list-numbered-none"});e.appendChild(i);var n=t.createElement("div",{className:"e-de-ui-list-header-presetmenu",id:"e-de-ui-zlist0",innerHTML:'<div class="e-de-ui-bullets e-de-bullet-icons">None</div>'});return i.style.cssFloat="left",i.appendChild(n),i},e.prototype.createBulletListTag=function(e,i,n){var r=t.createElement("li",{styles:"display:block;",className:"e-de-ui-wfloating-menuitem e-de-ui-wfloating-bullet-menuitem-md e-de-list-items e-de-list-item-size "+n});e.appendChild(r);var o=t.createElement("div",{className:"e-de-ui-bullet-list-header-presetmenu e-de-bullet-icon-size",id:"e-de-ui-zlist0"}),s=t.createElement("div",{className:i});return o.appendChild(s),r.appendChild(o),r},e.prototype.createBulletList=function(e){this.bulletListDiv=t.createElement("div",{className:"e-de-ui-bullet-list-header-presetmenu",id:e+"_Bullet"});var i=this.bulletListDiv;i.style.height="270px",i.style.display="none";var n=t.createElement("ul",{styles:"display: block; outline: 0px;",id:"listMenu",className:"e-de-ui-wfloating-menu e-de-ui-bullets-menu e-de-list-container e-de-list-thumbnail"});i.appendChild(n);var r=this.createBulletListTag(n,"e-de-icon-bullet-list-none e-de-bullet-icons","e-bullet-none"),o=this.createBulletListTag(n,"e-de-icon-bullet-list-dot e-de-bullet-icons","e-bullet-dot"),s=this.createBulletListTag(n,"e-de-icon-bullet-list-circle e-de-bullet-icons","e-bullet-circle"),a=this.createBulletListTag(n,"e-de-icon-bullet-list-square e-de-bullet-icons","e-bullet-square"),l=this.createBulletListTag(n,"e-de-icon-bullet-list-flower e-de-bullet-icons","e-bullet-flower"),d=this.createBulletListTag(n,"e-de-icon-bullet-list-arrow e-de-bullet-icons","e-bullet-arrow"),h=this.createBulletListTag(n,"e-de-icon-bullet-list-tick e-de-bullet-icons","e-bullet-tick");r.addEventListener("click",this.bulletListClick),o.addEventListener("click",this.bulletListClick),s.addEventListener("click",this.bulletListClick),a.addEventListener("click",this.bulletListClick),l.addEventListener("click",this.bulletListClick),d.addEventListener("click",this.bulletListClick),h.addEventListener("click",this.bulletListClick),this.target.appendChild(i)},e.prototype.showNumberBulletDialog=function(e,i){t.isNullOrUndefined(e)?this.listFormat=new x:this.listFormat=e,t.isNullOrUndefined(this.listFormat.list)&&(this.listFormat.list=new C),t.isNullOrUndefined(i)?this.abstractList=new V:this.abstractList=i;var n=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);n.setLocale(this.documentHelper.owner.locale),this.target||this.initNumberingBulletDialog(n),this.documentHelper.dialog.header=n.getConstant("Numbering and Bullets"),this.documentHelper.dialog.width="auto",this.documentHelper.dialog.height="auto",this.documentHelper.dialog.content=this.target,this.documentHelper.dialog.beforeOpen=this.loadNumberingBulletDialog,this.documentHelper.dialog.close=this.closeNumberingBulletDialog,this.documentHelper.dialog.position={X:"center",Y:"center"},this.documentHelper.dialog.buttons=[{click:this.onOkButtonClick,buttonModel:{content:n.getConstant("Ok"),cssClass:"e-flat e-numbering-bullet-okay",isPrimary:!0}},{click:this.onCancelButtonClick,buttonModel:{content:n.getConstant("Cancel"),cssClass:"e-flat e-numbering-bullet-cancel"}}],this.documentHelper.dialog.dataBind(),this.documentHelper.dialog.show(),this.tabObj.refresh()},e.prototype.setActiveElement=function(e){for(var t=e.currentTarget.parentElement,i=0;i<t.childElementCount;i++)t.childNodes[i].classList.contains("e-de-list-active")&&t.childNodes[i].classList.remove("e-de-list-active");e.currentTarget.classList.add("e-de-list-active")},e.prototype.unWireEventsAndBindings=function(){},e.prototype.destroy=function(){if(this.documentHelper=void 0,this.listFormat&&(this.listFormat.destroy(),this.listFormat=void 0),this.tabObj&&(this.tabObj.destroy(),this.tabObj=void 0),this.abstractList&&(this.abstractList.destroy(),this.abstractList=void 0),this.target&&this.target.parentElement){this.target.parentElement.removeChild(this.target);for(var e=0;e<this.target.childNodes.length;e++)this.target.removeChild(this.target.childNodes[e]),e--;this.target=void 0}this.bulletListDiv=void 0,this.numberListDiv=void 0},e}(),vi=function(){function e(e){var i=this;this.fontStyleInternal=void 0,this.fontNameList=void 0,this.fontStyleText=void 0,this.fontSizeText=void 0,this.colorPicker=void 0,this.underlineDrop=void 0,this.strikethroughBox=void 0,this.doublestrikethrough=void 0,this.superscript=void 0,this.subscript=void 0,this.allcaps=void 0,this.bold=void 0,this.italic=void 0,this.underline=void 0,this.strikethrough=void 0,this.baselineAlignment=void 0,this.fontSize=void 0,this.fontFamily=void 0,this.fontColor=void 0,this.allCaps=void 0,this.characterFormat=void 0,this.loadFontDialog=function(){i.documentHelper.updateFocus();var e;if(e=i.characterFormat?i.characterFormat:i.documentHelper.owner.selection.characterFormat,i.fontNameList.value=e.fontFamily,i.fontNameList.dataBind(),e.bold||e.italic?e.bold&&!e.italic?(i.fontStyleText.value=i.fontSizeText.value,i.fontStyleText.index=1):!e.bold&&e.italic?(i.fontStyleText.value=i.fontSizeText.value,i.fontStyleText.index=2):e.bold&&e.italic&&(i.fontStyleText.value=i.fontSizeText.value,i.fontStyleText.index=3):(i.fontStyleText.value=i.fontSizeText.value,i.fontStyleText.index=0),!t.isNullOrUndefined(e.fontSize))for(var n=0;n<=15;n++){var r=i.fontSizeText.getItems();if(e.fontSize.toString()===r[n].innerHTML){i.fontSizeText.value=e.fontSize,i.fontSizeText.index=n;break}}t.isNullOrUndefined(e.fontColor)?i.colorPicker.value="#000000":i.colorPicker.value=e.fontColor,"None"===e.underline?i.underlineDrop.index=0:"Single"===e.underline&&(i.underlineDrop.index=1),"SingleStrike"===e.strikethrough?i.strikethroughBox.checked=!0:"DoubleStrike"===e.strikethrough?i.doublestrikethrough.checked=!0:(i.strikethroughBox.checked=!1,i.doublestrikethrough.checked=!1),"Superscript"===e.baselineAlignment?i.superscript.checked=!0:"Subscript"===e.baselineAlignment?i.subscript.checked=!0:(i.superscript.checked=!1,i.subscript.checked=!1),"none"!==i.documentHelper.selection.caret.style.display&&(i.documentHelper.selection.caret.style.display="none"),e.allCaps?i.allcaps.checked=!0:i.allcaps.checked=!1},this.closeFontDialog=function(){i.unWireEventsAndBindings(),i.documentHelper.updateFocus()},this.onCancelButtonClick=function(){i.documentHelper.dialog.hide(),i.unWireEventsAndBindings(),i.documentHelper.updateFocus()},this.onInsertFontFormat=function(){var e;e=i.characterFormat?i.characterFormat:new H(void 0),t.isNullOrUndefined(i.bold)||(e.bold=i.bold),t.isNullOrUndefined(i.italic)||(e.italic=i.italic),!t.isNullOrUndefined(i.fontSize)&&i.fontSize>0&&(e.fontSize=i.fontSize),t.isNullOrUndefined(i.fontColor)||(e.fontColor=i.fontColor),t.isNullOrUndefined(i.baselineAlignment)||(e.baselineAlignment=i.baselineAlignment),t.isNullOrUndefined(i.strikethrough)||(e.strikethrough=i.strikethrough),t.isNullOrUndefined(i.underline)||(e.underline=i.underline),t.isNullOrUndefined(i.fontFamily)||(e.fontFamily=i.fontFamily),t.isNullOrUndefined(i.allCaps)||(e.allCaps=i.allCaps),i.characterFormat?i.documentHelper.owner.styleDialogModule.updateCharacterFormat():i.onCharacterFormat(i.documentHelper.selection,e),i.documentHelper.hideDialog()},this.fontSizeUpdate=function(e){i.fontSize=e.value},this.fontStyleUpdate=function(e){i.fontStyle=e.value},this.fontFamilyUpdate=function(e){i.fontFamily=e.value},this.underlineUpdate=function(e){i.underline=e.value},this.fontColorUpdate=function(e){t.isNullOrUndefined(e.currentValue)||(i.fontColor=e.currentValue.hex)},this.singleStrikeUpdate=function(e){i.enableCheckBoxProperty(e),e.checked?i.strikethrough="SingleStrike":i.strikethrough="None"},this.doubleStrikeUpdate=function(e){i.enableCheckBoxProperty(e),e.checked?i.strikethrough="DoubleStrike":i.strikethrough="None"},this.superscriptUpdate=function(e){i.enableCheckBoxProperty(e),e.checked?i.baselineAlignment="Superscript":i.baselineAlignment="Normal"},this.subscriptUpdate=function(e){i.enableCheckBoxProperty(e),e.checked?i.baselineAlignment="Subscript":i.baselineAlignment="Normal"},this.allcapsUpdate=function(e){i.enableCheckBoxProperty(e),e.checked?i.allCaps=!0:i.allCaps=!1},this.documentHelper=e}return Object.defineProperty(e.prototype,"fontStyle",{get:function(){return this.fontStyleInternal},set:function(e){switch(this.fontStyleInternal=e,this.fontStyle){case"Bold":this.bold=!0,this.italic=!1;break;case"Italic":this.bold=!1,this.italic=!0;break;case"BoldItalic":this.bold=!0,this.italic=!0;break;case"Regular":this.bold=!1,this.italic=!1}},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"FontDialog"},e.prototype.createInputElement=function(e,i,n){return t.createElement("input",{attrs:{type:e},id:i,className:n})},e.prototype.initFontDialog=function(e,i){var n,o,s,l,d,h,c=this.documentHelper.owner.containerId;this.target=t.createElement("div",{id:c+"_insertFontDialog",className:"e-de-font-dlg"});var p=this.getFontDiv(e,i);this.target.appendChild(p);var u=this.getFontSizeDiv(e,i);this.target.appendChild(u);var g=t.createElement("div",{id:c+"_fontColor",styles:"margin-top:14px;"});this.fontColorDiv=t.createElement("div",{id:c+"_fontColorDiv",className:"e-de-font-dlg-display"});var m=t.createElement("label",{className:"e-de-font-dlg-header-font-color e-de-font-color-margin",innerHTML:e.getConstant("Font color"),styles:"width:63px"});i&&m.classList.add("e-de-rtl"),this.fontColorDiv.appendChild(m);var f=this.createInputElement("color",this.target.id+"_ColorDiv","e-de-font-dlg-color");this.fontColorDiv.appendChild(f),g.appendChild(this.fontColorDiv),this.target.appendChild(g);var v=t.createElement("div",{id:c+"_fontEffectsDiv"}),y=t.createElement("div",{className:"e-de-font-color-label e-de-font-dlg-display",id:this.target.id+"_fontEffectsSubDiv1"});n=t.createElement("label",{className:"e-de-font-dlg-header-effects",innerHTML:e.getConstant("Effects"),styles:"width:58px"}),y.appendChild(n),o=this.createInputElement("checkbox",this.target.id+"_strikeThrough",""),y.appendChild(o),s=this.createInputElement("checkbox",this.target.id+"_superScript",""),y.appendChild(s),v.appendChild(y);var b=t.createElement("div",{className:"e-de-font-checkbox",id:c+"_fontEffectsSubDiv2"});l=this.createInputElement("checkbox",this.target.id+"_subScript",""),b.appendChild(l),d=this.createInputElement("checkbox",this.target.id+"_doubleStrikeThrough",""),b.appendChild(d),v.appendChild(b);var w=t.createElement("div",{className:"e-de-font-checkbox-transform-label e-de-font-checkbox-transform",id:c+"_fontEffectsSubDiv3"});h=this.createInputElement("checkbox",this.target.id+"_allCaps",""),w.appendChild(h),v.appendChild(w),this.target.appendChild(v),this.colorPicker=new a.ColorPicker({change:this.fontColorUpdate,value:"#000000",enableRtl:i,locale:this.documentHelper.owner.locale}),this.colorPicker.appendTo(f),this.strikethroughBox=new r.CheckBox({change:this.singleStrikeUpdate,cssClass:"e-de-font-content-label",label:e.getConstant("Strikethrough"),enableRtl:i}),this.strikethroughBox.appendTo(o),this.doublestrikethrough=new r.CheckBox({change:this.doubleStrikeUpdate,cssClass:"e-de-font-content-checkbox-label",label:e.getConstant("Double strikethrough"),enableRtl:i}),this.doublestrikethrough.appendTo(d),this.subscript=new r.CheckBox({label:e.getConstant("Subscript"),cssClass:"e-de-font-content-label-width",change:this.subscriptUpdate,enableRtl:i}),this.subscript.appendTo(l),this.superscript=new r.CheckBox({label:e.getConstant("Superscript"),cssClass:"e-de-font-content-label",change:this.superscriptUpdate,enableRtl:i}),this.superscript.appendTo(s),this.allcaps=new r.CheckBox({label:e.getConstant("All caps"),cssClass:"e-de-font-content-label-caps",change:this.allcapsUpdate,enableRtl:i}),this.allcaps.appendTo(h),i&&(b.classList.add("e-de-rtl"),this.doublestrikethrough.cssClass="e-de-font-content-checkbox-label-rtl")},e.prototype.getFontSizeDiv=function(e,i){var n,r,o=this.documentHelper.owner.containerId;r=t.createElement("div",{id:o+"_fontSizeAndUnderlineDiv",className:"e-de-font-dlg-padding e-de-font-dlg-display"});var a=t.createElement("div",{id:o+"_fontSizeAndUnderlineSubDiv1"}),l=t.createElement("label",{className:"e-de-font-dlg-header",innerHTML:e.getConstant("Size")}),d="font-family:Roboto;font-size:14px;opacity:0.8;";(n=t.createElement("select",{id:this.target.id+"_fontSize",styles:d})).innerHTML="<option>8</option><option>9</option><option>10</option><option>11</option><option>12</option><option>14</option><option>16</option><option>18</option><option>20</option><option>24</option><option>26</option><option>28</option><option>36</option><option>48</option><option>72</option><option>96</option>",a.appendChild(l),a.appendChild(n),r.appendChild(a);var h=t.createElement("div",{className:"e-de-font-dlg-cb-right",id:o+"_fontSizeAndUnderlineSubDiv2"});i&&h.classList.add("e-de-rtl");var c,p=e.getConstant("Underline style"),u=t.createElement("label",{className:"e-de-font-dlg-header",innerHTML:p});return c=t.createElement("select",{id:this.target.id+"_underLine",styles:d}),c.innerHTML='<option value="None">'+e.getConstant("None")+"</option><option>________</option>",h.appendChild(u),h.appendChild(c),r.appendChild(h),this.fontSizeText=new s.ComboBox({change:this.fontSizeUpdate,popupHeight:"170px",width:"170px",enableRtl:i}),this.fontSizeText.showClearButton=!1,this.fontSizeText.appendTo(n),this.underlineDrop=new s.DropDownList({change:this.underlineUpdate,popupHeight:"100px",width:"170px",enableRtl:i}),this.underlineDrop.appendTo(c),r},e.prototype.getFontDiv=function(e,i){for(var n=this.documentHelper.owner.containerId,r=t.createElement("div",{id:n+"_fontDiv",className:"e-de-font-dlg-display"}),o=t.createElement("div",{id:n+"_fontSubDiv1"}),a=t.createElement("label",{className:"e-de-font-dlg-header",innerHTML:e.getConstant("Font")}),l=t.createElement("select",{id:this.target.id+"_fontName"}),d=this.documentHelper.owner.documentEditorSettings.fontFamilies,h=0;h<d.length;h++)l.innerHTML+="<option>"+d[h]+"</option>";o.appendChild(a),o.appendChild(l),r.appendChild(o);var c,p,u;c=t.createElement("div",{className:"e-de-font-dlg-cb-right",id:n+"_fontSubDiv2",styles:"float:right;"}),i&&c.classList.add("e-de-rtl"),p=t.createElement("label",{className:"e-de-font-dlg-header",innerHTML:e.getConstant("Font style")});return u=t.createElement("select",{id:this.target.id+"_fontStyle",styles:"font-family:Roboto;font-size:14px;opacity:0.8;"}),u.innerHTML='<option value="Regular">'+e.getConstant("Regular")+'</option><option value="Bold">'+e.getConstant("Bold")+'</option><option value="Italic">'+e.getConstant("Italic")+'</option><option value="BoldItalic">'+e.getConstant("Bold")+e.getConstant("Italic")+"</option>",c.appendChild(p),c.appendChild(u),r.appendChild(c),this.fontNameList=new s.ComboBox({change:this.fontFamilyUpdate,popupHeight:"200px",width:"170px",enableRtl:i}),this.fontNameList.showClearButton=!1,this.fontNameList.appendTo(l),this.fontStyleText=new s.DropDownList({change:this.fontStyleUpdate,popupHeight:"170px",width:"170px",enableRtl:i}),this.fontStyleText.appendTo(u),r},e.prototype.showFontDialog=function(e){e&&(this.characterFormat=e);var i=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);i.setLocale(this.documentHelper.owner.locale),this.target||this.initFontDialog(i,this.documentHelper.owner.enableRtl),this.documentHelper.dialog.header=i.getConstant("Font"),this.documentHelper.dialog.width="auto",this.documentHelper.dialog.height="auto",this.documentHelper.dialog.content=this.target,this.documentHelper.dialog.beforeOpen=this.loadFontDialog,this.documentHelper.dialog.close=this.closeFontDialog,this.documentHelper.dialog.buttons=[{click:this.onInsertFontFormat,buttonModel:{content:i.getConstant("Ok"),cssClass:"e-flat e-font-okay",isPrimary:!0}},{click:this.onCancelButtonClick,buttonModel:{content:i.getConstant("Cancel"),cssClass:"e-flat e-font-cancel"}}],this.documentHelper.dialog.dataBind(),this.documentHelper.dialog.show()},e.prototype.onCharacterFormat=function(e,t){if(this.documentHelper.owner.editorModule.initHistory("CharacterFormat"),e.isEmpty)return e.start.offset===e.getParagraphLength(e.start.paragraph)&&(this.documentHelper.owner.editorModule.applyCharFormatValueInternal(e,e.start.paragraph.characterFormat,void 0,t),this.documentHelper.owner.editorModule.reLayout(e)),void this.documentHelper.updateFocus();this.documentHelper.owner.editorModule.setOffsetValue(this.documentHelper.selection),this.documentHelper.owner.editorModule.updateSelectionCharacterFormatting("CharacterFormat",t,!1)},e.prototype.enableCheckBoxProperty=function(e){this.strikethroughBox.checked&&this.doublestrikethrough.checked&&(this.strikethroughBox.checked=!1,this.doublestrikethrough.checked=!1,e.event.currentTarget.id===this.target.id+"_doubleStrikeThrough"?this.doublestrikethrough.checked=!0:this.strikethroughBox.checked=!0),this.superscript.checked&&this.subscript.checked&&(this.subscript.checked=!1,this.superscript.checked=!1,e.event.currentTarget.id===this.target.id+"_subScript"?this.subscript.checked=!0:this.superscript.checked=!0)},e.prototype.unWireEventsAndBindings=function(){this.fontNameList.value="",this.fontSizeText.value="",this.fontStyleText.value="",this.strikethroughBox.checked=!1,this.doublestrikethrough.checked=!1,this.superscript.checked=!1,this.subscript.checked=!1,this.allcaps.checked=!1,this.bold=void 0,this.italic=void 0,this.underline=void 0,this.strikethrough=void 0,this.baselineAlignment=void 0,this.fontColor=void 0,this.fontSize=void 0,this.fontFamily=void 0},e.prototype.destroy=function(){if(this.documentHelper=void 0,this.characterFormat&&(this.characterFormat.destroy(),this.characterFormat=void 0),!t.isNullOrUndefined(this.target)){this.target.parentElement&&this.target.parentElement.removeChild(this.target);for(var e=0;e<this.target.childNodes.length;e++)this.target.removeChild(this.target.childNodes[e]),e--;this.target=void 0}this.fontNameList&&this.fontNameList.destroy(),this.fontNameList=void 0,this.fontStyleText&&this.fontStyleText.destroy(),this.fontStyleText=void 0,this.fontSizeText&&this.fontSizeText.destroy(),this.fontSizeText=void 0,this.colorPicker&&this.colorPicker.destroy(),this.colorPicker=void 0,this.underlineDrop&&this.underlineDrop.destroy(),this.underlineDrop=void 0,this.strikethroughBox&&this.strikethroughBox.destroy(),this.strikethroughBox=void 0,this.doublestrikethrough&&this.doublestrikethrough.destroy(),this.doublestrikethrough=void 0,this.superscript&&this.superscript.destroy(),this.superscript=void 0,this.subscript&&this.subscript.destroy(),this.subscript=void 0,this.allcaps&&this.allcaps.destroy(),this.allcaps=void 0},e}(),yi=function(){function e(e){var i=this;this.hasTableWidth=!1,this.hasCellWidth=!1,this.bidi=!1,this.isTableBordersAndShadingUpdated=!1,this.isCellBordersAndShadingUpdated=!1,this.tabObj=void 0,this.localValue=void 0,this.isCellOptionsUpdated=!1,this.isTableOptionsUpdated=!1,this.onBeforeOpen=function(){i.documentHelper.updateFocus(),i.loadTableProperties()},this.onCloseTablePropertyDialog=function(){i.unWireEvent.bind(i),i.documentHelper.updateFocus()},this.applyTableProperties=function(){var e=i.documentHelper.selection;if(i.preferCheckBox.checked||i.preferCheckBox.indeterminate||(t.isNullOrUndefined(e.tableFormat.preferredWidth)||0!==e.tableFormat.preferredWidth)&&(i.tableFormat.preferredWidth=0,i.tableFormat.preferredWidthType="Point"),i.tableFormat.hasValue("tableAlignment")&&"Left"!==i.tableFormat.tableAlignment&&(t.isNullOrUndefined(e.tableFormat.leftIndent)||0!==e.tableFormat.leftIndent)&&(i.tableFormat.leftIndent=0),i.rowHeightCheckBox.checked||i.rowHeightCheckBox.indeterminate||(t.isNullOrUndefined(e.rowFormat.height)||0!==e.rowFormat.height)&&(i.rowFormat.heightType="AtLeast",i.rowFormat.height=0),i.preferredCellWidthCheckBox.checked||i.preferredCellWidthCheckBox.indeterminate){if("Percent"===i.cellFormat.preferredWidthType&&!i.tableFormat.hasValue("preferredWidth")&&!i.tableFormat.hasValue("preferredWidthType")&&0===i.documentHelper.selection.start.paragraph.associatedCell.ownerTable.tableFormat.preferredWidth){var n=i.documentHelper.selection.start.paragraph.associatedCell.ownerTable.getOwnerWidth(!0),r=i.documentHelper.selection.start.paragraph.associatedCell.ownerTable.getTableClientWidth(n);i.tableFormat.preferredWidthType="Percent",i.tableFormat.preferredWidth=r/W.convertPixelToPoint(i.documentHelper.owner.viewer.clientArea.width)*100}}else(t.isNullOrUndefined(e.cellFormat.preferredWidth)||0===e.cellFormat.preferredWidth)&&(i.cellFormat.preferredWidthType="Point",i.cellFormat.preferredWidth=0);i.rowHeightValue&&(i.rowFormat.height=i.rowHeightValue),i.documentHelper.owner.editorModule.initComplexHistory("TableProperties"),i.documentHelper.owner.editorModule.onTableFormat(i.tableFormat),i.documentHelper.owner.editorModule.onRowFormat(i.rowFormat),i.documentHelper.owner.editorModule.onCellFormat(i.cellFormat),i.documentHelper.owner.editorHistory.updateComplexHistory(),i.closeTablePropertiesDialog(),i.documentHelper.updateFocus()},this.applyTableSubProperties=function(){if(i.isCellOptionsUpdated){var e=i.documentHelper.owner.cellOptionsDialogModule.cellFormat;i.documentHelper.owner.cellOptionsDialogModule.applySubCellOptions(e)}if(i.isTableOptionsUpdated){var t=i.documentHelper.owner.tableOptionsDialogModule.tableFormat;i.documentHelper.owner.tableOptionsDialogModule.applySubTableOptions(t)}i.isCellOptionsUpdated=!1,i.isTableOptionsUpdated=!1},this.unWireEvent=function(){i.preferCheckBox.change=void 0,i.tableWidthBox.change=void 0,i.tableWidthType.change=void 0,i.leftIndentBox.change=void 0,i.rowHeightCheckBox.change=void 0,i.rowHeightBox.change=void 0,i.rowHeightType.change=void 0,i.repeatHeader.change=void 0,i.allowRowBreak.change=void 0,i.preferredCellWidthCheckBox.change=void 0,i.cellWidthBox.change=void 0,i.cellWidthType.change=void 0,i.cellFormat.destroy(),i.rowFormat.destroy(),i.tableFormat.destroy(),i.rowHeightValue=void 0,i.documentHelper.dialog2.open=i.documentHelper.selection.hideCaret.bind(i.documentHelper.owner.viewer)},this.closeTablePropertiesDialog=function(){i.documentHelper.dialog2.hide(),i.documentHelper.updateFocus()},this.changeBidirectional=function(e){"ltr"===e.value?(i.rtlButton.checked=!i.ltrButton.checked,i.tableFormat.bidi=!1):(i.ltrButton.checked=!i.rtlButton.checked,i.tableFormat.bidi=!0),i.tableFormat.bidi&&"Left"===i.tableFormat.tableAlignment?i.tableFormat.tableAlignment="Right":i.tableFormat.bidi||"Right"!==i.tableFormat.tableAlignment||(i.tableFormat.tableAlignment="Left"),i.activeTableAlignment(i.tableFormat,!0)},this.changeTableCheckBox=function(){var e=i.preferCheckBox.checked||i.preferCheckBox.indeterminate;i.tableWidthBox.enabled=e,i.tableWidthType.enabled=e,i.tableFormat.preferredWidthType=e?"Points"===i.tableWidthType.value?"Point":i.tableWidthType.value:i.documentHelper.selection.tableFormat.preferredWidthType},this.changeTableAlignment=function(e){i.updateClassForAlignmentProperties(i.tableTab);var n=e.target;t.classList(n,["e-de-table-alignment-active"],["e-de-table-properties-alignment"]);var r=i.tableFormat.bidi||i.rtlButton.checked;n.classList.contains("e-de-table-left-alignment")&&!r||n.classList.contains("e-de-table-right-alignment")&&r?i.leftIndentBox.enabled=!0:i.leftIndentBox.enabled=!1,i.tableFormat.tableAlignment=i.getTableAlignment()},this.changeTableRowCheckBox=function(){i.rowHeightType.enabled=i.rowHeightCheckBox.checked,i.rowHeightBox.enabled=i.rowHeightCheckBox.checked,i.rowHeightType.enabled?i.rowFormat.heightType=i.rowHeightType.value:i.rowFormat.heightType=i.documentHelper.selection.rowFormat.heightType},this.changeTableCellCheckBox=function(){i.cellWidthType.enabled=i.preferredCellWidthCheckBox.checked,i.cellWidthBox.enabled=i.preferredCellWidthCheckBox.checked},this.changeCellAlignment=function(e){i.updateClassForCellAlignment(i.cellTab);var n=e.target;t.classList(n,["e-de-table-alignment-active"],["e-de-tablecell-alignment"]),i.cellFormat.verticalAlignment=i.getCellAlignment()},this.showTableOptionsDialog=function(){i.documentHelper.owner.tableOptionsDialogModule.show(),i.documentHelper.dialog2.element.style.pointerEvents="none"},this.showBordersShadingsPropertiesDialog=function(){i.documentHelper.owner.bordersAndShadingDialogModule.show(),i.documentHelper.dialog2.element.style.pointerEvents="none"},this.showCellOptionsDialog=function(){i.documentHelper.owner.cellOptionsDialogModule.show(),i.documentHelper.dialog2.element.style.pointerEvents="none"},this.documentHelper=e}return Object.defineProperty(e.prototype,"cellFormat",{get:function(){return t.isNullOrUndefined(this.cellFormatIn)?this.cellFormatIn=new z:this.cellFormatIn},set:function(e){this.cellFormatIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"tableFormat",{get:function(){return t.isNullOrUndefined(this.tableFormatIn)?(this.tableFormatIn=new U,this.tableFormatIn):this.tableFormatIn},set:function(e){this.tableFormatIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rowFormat",{get:function(){return t.isNullOrUndefined(this.rowFormatInternal)?(this.rowFormatInternal=new I,this.rowFormatInternal):this.rowFormatInternal},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"TablePropertiesDialog"},e.prototype.initTablePropertyDialog=function(e,n){this.localValue=e;var r=this.documentHelper.owner.containerId+"_TablePropertiesDialog";this.target=t.createElement("div",{id:r,className:"e-de-table-properties-dlg"});var o=t.createElement("div",{id:this.target.id+"_TabContainer"});this.target.appendChild(o),this.tableTab=t.createElement("div",{id:this.target.id+"_TablePropertiesContentDialogTab",className:"e-de-table-ppty-dlg-tabs"}),this.rowTab=t.createElement("div",{id:this.target.id+"_RowPropertiesDialogTab",className:"e-de-table-ppty-dlg-tabs"}),this.cellTab=t.createElement("div",{id:this.target.id+"_CellPropertiesDialogTab",className:"e-de-table-ppty-dlg-tabs"});var s=t.createElement("div",{className:"e-de-table-dialog-separator-line"}),a=t.createElement("div",{id:this.target.id+"_TablePropertiesDialogTab",className:"e-de-table-ppty-tab"}),l=t.createElement("div",{className:"e-tab-header"}),d=t.createElement("div",{id:this.target.id+"_tableHeader",innerHTML:e.getConstant("Table")}),h=t.createElement("div",{id:this.target.id+"_rowHeader",innerHTML:e.getConstant("Row")}),c=t.createElement("div",{id:this.target.id+"_cellHeader",innerHTML:e.getConstant("Cell")});l.appendChild(d),l.appendChild(h),l.appendChild(c);var p=t.createElement("div",{id:this.target.id+"_tableContent"}),u=t.createElement("div",{id:this.target.id+"_rowContent"}),g=t.createElement("div",{id:this.target.id+"_cellContent"}),m=[{header:{text:d},content:p},{header:{text:h},content:u},{header:{text:c},content:g}];p.appendChild(this.tableTab),u.appendChild(this.rowTab),g.appendChild(this.cellTab),o.appendChild(a),this.initTableProperties(this.tableTab,e,this.documentHelper.owner.enableRtl),this.initTableRowProperties(this.rowTab,e,this.documentHelper.owner.enableRtl),this.initTableCellProperties(this.cellTab,e,this.documentHelper.owner.enableRtl),this.tabObj=new i.Tab({items:m,enableRtl:n},a),this.tabObj.isStringTemplate=!0,this.target.appendChild(s);for(var f=this.tableTab.getElementsByClassName(this.tableTab.id+"e-de-table-alignment"),v=0;v<f.length;v++)f[v].addEventListener("click",this.changeTableAlignment);for(var y=this.cellTab.getElementsByClassName(this.cellTab.id+"e-de-table-cell-alignment"),v=0;v<y.length;v++)y[v].addEventListener("click",this.changeCellAlignment)},e.prototype.show=function(){var e=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);e.setLocale(this.documentHelper.owner.locale),this.target||this.initTablePropertyDialog(e,this.documentHelper.owner.enableRtl),"none"!==this.documentHelper.selection.caret.style.display&&(this.documentHelper.selection.caret.style.display="none"),this.documentHelper.dialog2.header=e.getConstant("Table Properties"),this.documentHelper.dialog2.position={X:"center",Y:"center"},this.documentHelper.dialog2.width="auto",this.documentHelper.dialog2.height="auto",this.documentHelper.dialog2.content=this.target,this.documentHelper.dialog2.beforeOpen=this.onBeforeOpen,this.documentHelper.dialog2.close=this.onCloseTablePropertyDialog,this.documentHelper.dialog2.open=this.wireEvent.bind(this),this.documentHelper.dialog2.buttons=[{click:this.applyTableProperties,buttonModel:{content:e.getConstant("Ok"),cssClass:"e-flat e-table-ppty-okay",isPrimary:!0}},{click:this.closeTablePropertiesDialog,buttonModel:{content:e.getConstant("Cancel"),cssClass:"e-flat e-table-ppty-cancel"}}],this.documentHelper.dialog2.dataBind(),this.documentHelper.dialog2.show()},e.prototype.calculateGridValue=function(e){e.calculateGrid(),e.isGridUpdated=!1,e.buildTableColumns(),e.isGridUpdated=!0,this.documentHelper.selection.owner.isLayoutEnabled=!0,this.documentHelper.layout.reLayoutTable(e),this.documentHelper.owner.editorModule.reLayout(this.documentHelper.selection),this.documentHelper.owner.editorModule.updateSelectionTextPosition(!0);var t=this.documentHelper.owner.editorHistory;t&&t.currentBaseHistoryInfo&&(t.currentBaseHistoryInfo.modifiedProperties.length>0&&t.currentBaseHistoryInfo.updateSelection(),t.updateHistory()),this.documentHelper.owner.editorModule.fireContentChange()},e.prototype.loadTableProperties=function(){this.setTableProperties(),this.setTableRowProperties(),this.setTableCellProperties(),this.documentHelper.owner.bordersAndShadingDialogModule?this.bordersAndShadingButton.disabled=!1:this.bordersAndShadingButton.disabled=!0,this.tableOptionButton.disabled=!1,this.cellOptionButton.disabled=!1},e.prototype.wireEvent=function(){this.documentHelper.selection.hideCaret(),this.preferCheckBox.change=this.changeTableCheckBox.bind(this),this.tableWidthBox.change=this.onTableWidthChange.bind(this),this.tableWidthType.change=this.onTableWidthTypeChange.bind(this),this.leftIndentBox.change=this.onLeftIndentChange.bind(this),this.rowHeightCheckBox.change=this.changeTableRowCheckBox.bind(this),this.rowHeightBox.change=this.onRowHeightChange.bind(this),this.rowHeightType.change=this.onRowHeightTypeChange.bind(this),this.allowRowBreak.change=this.onAllowBreakAcrossPage.bind(this),this.repeatHeader.change=this.onRepeatHeader.bind(this),this.preferredCellWidthCheckBox.change=this.changeTableCellCheckBox.bind(this),this.cellWidthBox.change=this.onCellWidthChange.bind(this),this.cellWidthType.change=this.onCellWidthTypeChange.bind(this)},e.prototype.initTableProperties=function(e,i,n){var o=t.createElement("div",{id:e.id+"_table_TabContainer"}),l=t.createElement("div",{id:o.id+"_sizeLabel",innerHTML:i.getConstant("Size"),styles:"width:100%;margin:0px;",className:"e-de-table-dialog-options-label"}),d=t.createElement("div",{styles:"display: inline-flex;"}),h=t.createElement("div",{styles:"float: left;",className:"e-de-table-container-div"}),c=t.createElement("div",{className:"e-de-table-ppty-dlg-preferred-width-div"}),p=t.createElement("div",{styles:"display: inline;",className:"e-de-table-ppty-dlg-measure-div"}),u=t.createElement("div",{styles:"display: inline;position: absolute;",className:"e-de-table-ppty-dlg-measure-drop-down-div"}),g=t.createElement("div"),m=t.createElement("input",{id:e.id+"_Prefer_Width_CheckBox",attrs:{type:"checkbox"}});this.preferredWidth=t.createElement("input",{id:e.id+"preferred_Width"});var f=t.createElement("div"),v=t.createElement("select",{innerHTML:'<option value="Points">'+i.getConstant("Points")+'</option><option value="Percent">'+i.getConstant("Percent")+"</option>",id:e.id+"_width_dropdown"}),y=t.createElement("label",{innerHTML:i.getConstant("Measure in"),styles:"width: 60px;font-size: 11px; font-weight: normal;"}),b=t.createElement("div",{innerHTML:i.getConstant("Alignment"),className:"e-de-table-dialog-options-label",styles:"width: 100%;margin: 0px;"}),w=t.createElement("div",{styles:"height:85px;display:inline-flex"}),C=e.id+"e-de-table-alignment",x=t.createElement("div",{className:"e-de-table-dia-align-div"});this.left=t.createElement("div",{className:"e-icons e-de-table-properties-alignment e-de-table-left-alignment "+C,id:e.id+"_left_alignment",styles:"width:54px;height:54px;margin:2px"}),x.appendChild(this.left);var F=t.createElement("div",{className:"e-de-table-dia-align-div"});this.center=t.createElement("div",{className:"e-icons e-de-table-properties-alignment e-de-table-center-alignment "+C,id:e.id+"_center_alignment",styles:"width:54px;height:54px;margin:2px"}),F.appendChild(this.center),this.right=t.createElement("div",{styles:"width:54px;height:54px;margin:2px",id:e.id+"_right_alignment",className:"e-icons e-de-table-properties-alignment e-de-table-right-alignment "+C});var P=t.createElement("div",{className:"e-de-table-dia-align-div"});P.appendChild(this.right);var T,S,I=t.createElement("label",{innerHTML:i.getConstant("Left"),className:"e-de-table-dia-align-label"}),N=t.createElement("label",{innerHTML:i.getConstant("Center"),className:"e-de-table-dia-align-label"}),E=t.createElement("label",{innerHTML:i.getConstant("Right"),className:"e-de-table-dia-align-label"}),H=t.createElement("div",{className:"e-de-table-ppty-dlg-left-indent-container"});n?(T="left: 45px;",S="left: 45px;"):(T="right: 45px;",S="right: 45px;"),this.indentingLabel=t.createElement("label",{innerHTML:i.getConstant("Indent from left"),styles:"font-weight: normal;font-size: 11px;position:relative;display:block;margin-bottom:18px;top:10px;"+T});var W=t.createElement("div",{styles:"margin-top: 15px;position: relative;"+S});this.leftIndent=t.createElement("input",{id:e.id+"_left_indent"});var O=t.createElement("div",{innerHTML:i.getConstant("Table direction"),className:"e-de-table-dialog-options-label",styles:"width: 100%;margin: 0px;padding-top:14px;"}),k=t.createElement("div",{styles:"display:flex"}),L=t.createElement("div",{id:e.id+"_TableDirDiv",className:"e-de-tbl-rtl-btn-div"}),B=t.createElement("input",{id:e.id+"_rtlEle"});L.appendChild(B),k.appendChild(L);var R=t.createElement("div",{id:e.id+"_DirDiv",className:"e-de-tbl-ltr-btn-div"}),D=t.createElement("input",{id:e.id+"_ltrEle"});R.appendChild(D),k.appendChild(R),this.rtlButton=new r.RadioButton({label:i.getConstant("Right-to-left"),value:"rtl",cssClass:"e-small",change:this.changeBidirectional,enableRtl:n}),this.rtlButton.appendTo(B),this.ltrButton=new r.RadioButton({label:i.getConstant("Left-to-right"),value:"ltr",cssClass:"e-small",change:this.changeBidirectional,enableRtl:n}),this.ltrButton.appendTo(D);var M=t.createElement("div",{className:"e-de-tbl-dlg-border-btn"});n&&(M.style.cssFloat="left"),this.bordersAndShadingButton=t.createElement("button",{innerHTML:i.getConstant("Borders and Shading")+"...",id:e.id+"_borders_and_shadings",className:"e-control e-btn e-flat e-de-ok-button",attrs:{type:"button"}}),this.tableOptionButton=t.createElement("button",{className:"e-control e-btn e-flat",innerHTML:i.getConstant("Options")+"...",id:e.id+"_table_cellmargin",attrs:{type:"button"}}),this.tableOptionButton.addEventListener("click",this.showTableOptionsDialog),this.bordersAndShadingButton.addEventListener("click",this.showBordersShadingsPropertiesDialog),M.appendChild(this.bordersAndShadingButton),M.appendChild(this.tableOptionButton),H.appendChild(this.indentingLabel),W.appendChild(this.leftIndent),H.appendChild(W),w.appendChild(x),w.appendChild(F),w.appendChild(P),x.appendChild(I),F.appendChild(N),P.appendChild(E),w.appendChild(H),o.appendChild(l),e.appendChild(o),h.appendChild(m),d.appendChild(h),c.appendChild(this.preferredWidth),d.appendChild(c),f.appendChild(v),p.appendChild(y),u.appendChild(f),g.appendChild(p),g.appendChild(u),d.appendChild(g),e.appendChild(d),e.appendChild(b),e.appendChild(w),e.appendChild(O),e.appendChild(k),e.appendChild(M),this.tableWidthBox=new a.NumericTextBox({value:0,decimals:2,min:0,max:1584,width:120,enablePersistence:!1}),this.tableWidthBox.appendTo(this.preferredWidth),this.leftIndentBox=new a.NumericTextBox({value:0,decimals:2,min:-1584,max:1584,width:140,enablePersistence:!1}),this.leftIndentBox.appendTo(this.leftIndent),this.preferCheckBox=new r.CheckBox({label:i.getConstant("Preferred Width"),enableRtl:n}),this.preferCheckBox.appendTo(m),this.tableWidthType=new s.DropDownList({width:"120px",enableRtl:n}),this.tableWidthType.appendTo(v),n&&(L.classList.add("e-de-rtl"),c.classList.add("e-de-rtl"),p.classList.add("e-de-rtl"),u.classList.add("e-de-rtl"),H.classList.add("e-de-rtl"),M.classList.add("e-de-rtl"),this.bordersAndShadingButton.classList.add("e-de-rtl"),x.classList.add("e-de-rtl"),F.classList.add("e-de-rtl"),P.classList.add("e-de-rtl"))},e.prototype.onTableWidthChange=function(){this.tableFormat.preferredWidth=this.tableWidthBox.value},e.prototype.onTableWidthTypeChange=function(){var e,t=W.convertPixelToPoint(this.documentHelper.owner.viewer.clientArea.width);"Percent"===this.tableWidthType.text&&"Percent"!==this.documentHelper.selection.tableFormat.preferredWidthType?(e=this.tableWidthBox.value/t*100,this.formatNumericTextBox(this.tableWidthBox,"Percent",e)):"Points"===this.tableWidthType.text&&"Point"!==this.documentHelper.selection.tableFormat.preferredWidthType?(e=t/100*this.tableWidthBox.value,this.formatNumericTextBox(this.tableWidthBox,"Point",e)):(e="#'%'"===this.tableWidthBox.format?"Points"===this.tableWidthType.text?t/100*this.tableWidthBox.value:this.tableWidthBox.value:"Percent"===this.tableWidthType.text?this.tableWidthBox.value/t*100:this.tableWidthBox.value,this.formatNumericTextBox(this.tableWidthBox,"Points"===this.tableWidthType.text?"Point":this.tableWidthType.text,e)),this.tableFormat.preferredWidthType="Points"===this.tableWidthType.text?"Point":this.tableWidthType.text},e.prototype.onLeftIndentChange=function(){this.tableFormat.leftIndent=this.leftIndentBox.value},e.prototype.setTableProperties=function(){var e=this.documentHelper.selection.tableFormat,i=e.preferredWidth>0,n=e.preferredWidth;t.isNullOrUndefined(e.preferredWidth)?(this.preferCheckBox.indeterminate=!0,n=this.documentHelper.selection.start.paragraph.associatedCell.ownerTable.combineWidget(this.documentHelper.owner.viewer).tableFormat.preferredWidth):this.preferCheckBox.checked=i,this.tableWidthBox.enabled=i,this.tableWidthType.enabled=i,this.formatNumericTextBox(this.tableWidthBox,e.preferredWidthType,n),"Auto"===e.preferredWidthType||"Point"===e.preferredWidthType?this.tableWidthType.index=0:this.tableWidthType.index=1,this.activeTableAlignment(e,!1),e.bidi?(this.rtlButton.checked=!0,this.ltrButton.checked=!1):(this.ltrButton.checked=!0,this.rtlButton.checked=!1)},e.prototype.activeTableAlignment=function(e,i){var n=i?this.tableFormat.tableAlignment:void 0;t.isNullOrUndefined(n)&&(e.bidi?"Left"===e.tableAlignment?n="Right":"Right"===e.tableAlignment&&(n="Left"):n=e.tableAlignment),e.bidi?(this.leftIndentBox.enabled="Right"===n,this.indentingLabel.innerHTML=this.localValue.getConstant("Indent from right")):(this.leftIndentBox.enabled="Left"===n,this.indentingLabel.innerHTML=this.localValue.getConstant("Indent from left")),this.leftIndentBox.value=e.leftIndent,t.classList(this.left,[],["e-de-table-alignment-active"]),t.classList(this.right,[],["e-de-table-alignment-active"]),t.classList(this.center,[],["e-de-table-alignment-active"]),"Left"===n?this.left.classList.add("e-de-table-alignment-active"):"Center"===n?this.center.classList.add("e-de-table-alignment-active"):"Right"===n&&this.right.classList.add("e-de-table-alignment-active")},e.prototype.getTableAlignment=function(){for(var e=this.tableTab.id,t=this.tableTab.getElementsByClassName(e+"e-de-table-alignment"),i=0;i<t.length;i++)if(t[i].classList.contains("e-de-table-alignment-active"))return 0===i?this.ltrButton.checked?"Left":"Right":1===i?"Center":this.ltrButton.checked?"Right":"Left"},e.prototype.updateClassForAlignmentProperties=function(e){for(var i=e.id,n=e.getElementsByClassName(i+"e-de-table-alignment"),r=0;r<n.length;r++){var o=n[r];o.classList.contains("e-de-table-alignment-active")&&t.classList(o,["e-de-table-properties-alignment"],["e-de-table-alignment-active"])}},e.prototype.initTableRowProperties=function(e,i,n){var o=t.createElement("div",{styles:"width: 100%;"}),l=t.createElement("div",{innerHTML:i.getConstant("Size"),styles:"width: 100%;",className:"e-de-table-dialog-options-label"}),d=t.createElement("div",{styles:"display: inline-flex;width: 100%;"}),h=t.createElement("div",{className:"e-de-table-header-div",styles:"margin-top:6px"}),c=t.createElement("input",{attrs:{type:"checkbox"},id:e.id+"_height_CheckBox"}),p=t.createElement("div",{className:"e-de-row-ht-top"});this.rowHeight=t.createElement("input",{attrs:{type:"text"},id:e.id+"_table_row_height"});var u=t.createElement("div",{className:"e-de-ht-wdth-type"}),g=t.createElement("div"),m=t.createElement("div"),f=t.createElement("div"),v=t.createElement("select",{innerHTML:'<option value="At least">'+i.getConstant("At least")+'</option><option value="Exactly">'+i.getConstant("Exactly")+"</option>",id:e.id+"_height_type"}),y=t.createElement("label",{innerHTML:i.getConstant("Row height is"),styles:"font-size: 11px;font-weight: normal;width: 75px;display:block;margin-bottom:8px"});o.appendChild(l),e.appendChild(o),h.appendChild(c),d.appendChild(h),p.appendChild(this.rowHeight),d.appendChild(p),f.appendChild(v),g.appendChild(y),m.appendChild(f),u.appendChild(g),u.appendChild(m),d.appendChild(u),e.appendChild(d);var b=t.createElement("div",{innerHTML:i.getConstant("Options")+"...",styles:"width: 100%;",className:"e-de-table-dialog-options-label"}),w=t.createElement("div",{className:"e-de-table-ppty-options-break"}),C=t.createElement("div",{className:"e-de-table-ppty-options-header-row"}),x=t.createElement("input",{attrs:{type:"checkbox"},id:e.id+"_allow_row_break"}),F=t.createElement("input",{attrs:{type:"checkbox"},id:e.id+"_repeat_header"});w.appendChild(x),C.appendChild(F),e.appendChild(b),e.appendChild(w),e.appendChild(C),this.rowHeightBox=new a.NumericTextBox({value:0,decimals:2,min:0,max:1584,width:120,enablePersistence:!1}),this.rowHeightBox.appendTo(this.rowHeight),this.rowHeightCheckBox=new r.CheckBox({label:i.getConstant("Specify height"),enableRtl:n}),this.rowHeightCheckBox.appendTo(c),this.rowHeightType=new s.DropDownList({width:"120px",enableRtl:n}),this.rowHeightType.appendTo(v),this.allowRowBreak=new r.CheckBox({label:i.getConstant("Allow row to break across pages"),enableRtl:n}),this.allowRowBreak.appendTo(x),this.repeatHeader=new r.CheckBox({label:i.getConstant("Repeat as header row at the top of each page"),enableRtl:n}),this.repeatHeader.appendTo(F),n&&(g.classList.add("e-de-rtl"),m.classList.add("e-de-rtl"),p.classList.add("e-de-rtl"))},e.prototype.setTableRowProperties=function(){var e=this.documentHelper.selection.rowFormat,i=e.height>0||"Exactly"===e.heightType;i?this.rowHeightCheckBox.checked=!0:void 0===e.heightType?(this.rowHeightCheckBox.indeterminate=!0,i=!0):this.rowHeightCheckBox.checked=!1,this.rowHeightBox.enabled=i,this.rowHeightType.enabled=i;var n=!this.enableRepeatHeader();t.isNullOrUndefined(this.documentHelper.selection.rowFormat.isHeader)?(this.repeatHeader.indeterminate=!0,this.repeatHeader.disabled=!0):this.documentHelper.selection.rowFormat.isHeader?(this.repeatHeader.checked=!n,this.repeatHeader.indeterminate=n,this.repeatHeader.disabled=n):(this.repeatHeader.checked=!1,this.repeatHeader.indeterminate=!1,this.repeatHeader.disabled=n),t.isNullOrUndefined(e.allowBreakAcrossPages)?this.allowRowBreak.indeterminate=!0:this.allowRowBreak.checked=e.allowBreakAcrossPages,this.rowHeightBox.value=e.height,"Auto"===e.heightType||"AtLeast"===e.heightType?this.rowHeightType.index=0:this.rowHeightType.index=1},e.prototype.onRowHeightChange=function(){this.rowHeightValue=this.rowHeightBox.value},e.prototype.onRowHeightTypeChange=function(){this.rowFormat.heightType=this.rowHeightType.text},e.prototype.onAllowBreakAcrossPage=function(){this.rowFormat.allowBreakAcrossPages=this.allowRowBreak.checked},e.prototype.onRepeatHeader=function(){this.rowFormat.isHeader=this.repeatHeader.checked},e.prototype.enableRepeatHeader=function(){var e=this.documentHelper.selection,t=e.start,i=e.end;e.isForward||(t=e.end,i=e.start);var n=t.paragraph.associatedCell,r=i.paragraph.associatedCell;return 0===n.ownerRow.index&&r.ownerTable.equals(n.ownerTable)},e.prototype.initTableCellProperties=function(e,i,n){var o=t.createElement("div",{styles:"width: 100%;"}),l=t.createElement("div",{innerHTML:i.getConstant("Size"),className:"e-de-table-dialog-options-label",styles:"width: 100%;"}),d=t.createElement("div",{styles:"width: 100%;display: inline-flex;"}),h=t.createElement("div",{className:"e-de-table-cell-header-div",styles:"margin-top:9px"}),c=t.createElement("input",{attrs:{type:"checkbox"},id:e.id+"_Prefer_Width_CheckBox_cell"}),p=t.createElement("div",{styles:"padding:0px 20px"});this.preferredCellWidth=t.createElement("input",{id:e.id+"tablecell_Width_textBox",attrs:{type:"text"}});var u=t.createElement("div",{className:"e-de-ht-wdth-type"}),g=t.createElement("div"),m=t.createElement("div"),f=t.createElement("div"),v=t.createElement("select",{innerHTML:'<option value="Points">'+i.getConstant("Points")+'</option><option value="Percent">'+i.getConstant("Percent")+"</option>",id:e.id+"_measure_type_cell"}),y=t.createElement("label",{innerHTML:i.getConstant("Measure in"),styles:"font-size: 11px;font-weight: normal;display:block;margin-bottom:8px"});o.appendChild(l),e.appendChild(o),h.appendChild(c),d.appendChild(h),p.appendChild(this.preferredCellWidth),d.appendChild(p),f.appendChild(v),g.appendChild(y),m.appendChild(f),u.appendChild(g),u.appendChild(m),d.appendChild(u),e.appendChild(d);var b=t.createElement("div",{innerHTML:i.getConstant("Vertical alignment"),styles:"width: 100%;margin: 0px;",className:"e-de-table-dialog-options-label"}),w=e.id+"e-de-table-cell-alignment",C=t.createElement("div",{styles:"width: 100%;height: 100px;"}),x="width:54px;height:54px;margin:2px;border-style:solid;border-width:1px",F=t.createElement("div",{className:"e-de-table-dia-align-div"});this.cellTopAlign=t.createElement("div",{styles:x,id:e.id+"_cell_top-alignment",className:"e-icons e-de-tablecell-alignment e-de-tablecell-top-alignment "+w}),F.appendChild(this.cellTopAlign);var P=t.createElement("div",{className:"e-de-table-dia-align-div"});this.cellCenterAlign=t.createElement("div",{styles:x,id:e.id+"_cell_center-alignment",className:"e-icons e-de-tablecell-alignment e-de-tablecell-center-alignment "+w}),P.appendChild(this.cellCenterAlign);var T=t.createElement("div",{className:"e-de-table-dia-align-div"});this.cellBottomAlign=t.createElement("div",{styles:x,id:e.id+"_cell_bottom-alignment",className:"e-icons e-de-tablecell-alignment e-de-tablecell-bottom-alignment "+w}),T.appendChild(this.cellBottomAlign);var S=t.createElement("label",{innerHTML:i.getConstant("Top"),className:"e-de-table-dia-align-label"}),I=t.createElement("label",{innerHTML:i.getConstant("Center"),className:"e-de-table-dia-align-label"}),N=t.createElement("label",{innerHTML:i.getConstant("Bottom"),className:"e-de-table-dia-align-label"});this.cellOptionButton=t.createElement("button",{innerHTML:i.getConstant("Options")+"...",id:e.id+"_table_cellmargin",className:"e-control e-btn e-flat",attrs:{type:"button"}}),this.cellOptionButton.style.cssFloat=n?"left":"right",C.appendChild(F),C.appendChild(P),C.appendChild(T),F.appendChild(S),P.appendChild(I),T.appendChild(N),e.appendChild(b),e.appendChild(C),e.appendChild(this.cellOptionButton),this.cellOptionButton.addEventListener("click",this.showCellOptionsDialog),this.cellWidthBox=new a.NumericTextBox({value:0,decimals:2,min:0,max:1584,width:120,enablePersistence:!1}),this.cellWidthBox.appendTo(this.preferredCellWidth),this.preferredCellWidthCheckBox=new r.CheckBox({label:i.getConstant("Preferred Width"),enableRtl:n}),this.preferredCellWidthCheckBox.appendTo(c),this.cellWidthType=new s.DropDownList({width:"120px",enableRtl:n}),this.cellWidthType.appendTo(v),n&&(p.classList.add("e-de-rtl"),g.classList.add("e-de-rtl"),m.classList.add("e-de-rtl"),this.cellOptionButton.classList.add("e-de-rtl"),F.classList.add("e-de-rtl"),P.classList.add("e-de-rtl"),T.classList.add("e-de-rtl"))},e.prototype.setTableCellProperties=function(){var e=this.documentHelper.selection.cellFormat;this.hasCellWidth=e.preferredWidth>0;var i=e.preferredWidth;t.isNullOrUndefined(e.preferredWidth)?(this.preferredCellWidthCheckBox.indeterminate=!0,i=this.documentHelper.selection.start.paragraph.associatedCell.cellFormat.preferredWidth):this.preferredCellWidthCheckBox.checked=this.hasCellWidth,this.cellWidthBox.enabled=this.hasCellWidth,this.cellWidthType.enabled=this.hasCellWidth,"Auto"===e.preferredWidthType||"Point"===e.preferredWidthType?this.cellWidthType.index=0:this.cellWidthType.index=1,this.formatNumericTextBox(this.cellWidthBox,e.preferredWidthType,i),t.classList(this.cellTopAlign,["e-de-tablecell-alignment"],["e-de-table-alignment-active"]),t.classList(this.cellCenterAlign,["e-de-tablecell-alignment"],["e-de-table-alignment-active"]),t.classList(this.cellBottomAlign,["e-de-tablecell-alignment"],["e-de-table-alignment-active"]),"Top"===e.verticalAlignment?this.cellTopAlign.classList.add("e-de-table-alignment-active"):"Center"===e.verticalAlignment?this.cellCenterAlign.classList.add("e-de-table-alignment-active"):"Bottom"===e.verticalAlignment&&this.cellBottomAlign.classList.add("e-de-table-alignment-active")},e.prototype.updateClassForCellAlignment=function(e){for(var i=e.getElementsByClassName(e.id+"e-de-table-cell-alignment"),n=0;n<i.length;n++){var r=i[n];r.classList.contains("e-de-table-alignment-active")&&t.classList(r,["e-de-tablecell-alignment"],["e-de-table-alignment-active"])}},e.prototype.formatNumericTextBox=function(e,t,i){e.format="Auto"===t||"Point"===t?"n2":"#'%'",e.step=1,e.decimals=2,e.value=i},e.prototype.getCellAlignment=function(){for(var e=this.cellTab.id,t=this.cellTab.getElementsByClassName(e+"e-de-table-cell-alignment"),i=0;i<t.length;i++)if(t[i].classList.contains("e-de-table-alignment-active"))return 0===i?"Top":1===i?"Center":"Bottom";return this.documentHelper.selection.cellFormat.verticalAlignment},e.prototype.onCellWidthChange=function(){this.cellFormat.preferredWidth=this.cellWidthBox.value},e.prototype.onCellWidthTypeChange=function(){var e,t=this.documentHelper.selection.start.paragraph.associatedCell.ownerTable,i=t.getOwnerWidth(!0),n=t.getTableClientWidth(i);"Percent"===this.cellWidthType.text&&"Percent"!==this.documentHelper.selection.cellFormat.preferredWidthType?(e=this.cellWidthBox.value/n*100,this.formatNumericTextBox(this.cellWidthBox,"Percent",e)):"Points"===this.cellWidthType.text&&"Point"!==this.documentHelper.selection.cellFormat.preferredWidthType?(e=n/100*this.cellWidthBox.value,this.formatNumericTextBox(this.cellWidthBox,"Point",e)):(e="#'%'"===this.cellWidthBox.format?"Points"===this.cellWidthType.text?n/100*this.cellWidthBox.value:this.cellWidthBox.value:"Percent"===this.cellWidthType.text?this.cellWidthBox.value/n*100:this.cellWidthBox.value,this.formatNumericTextBox(this.cellWidthBox,"Points"===this.cellWidthType.text?"Point":this.cellWidthType.text,e)),this.cellFormat.preferredWidthType="Points"===this.cellWidthType.text?"Point":this.cellWidthType.text},e.prototype.destroy=function(){if(!t.isNullOrUndefined(this.target)){this.target.parentElement&&this.target.parentElement.removeChild(this.target);for(var e=0;e<this.target.childNodes.length;e++)this.target.removeChild(this.target.childNodes[e]),e--;this.target=void 0}this.dialog=void 0,this.target=void 0,this.cellAlignment=void 0,this.tableAlignment=void 0,this.documentHelper=void 0,this.preferCheckBox=void 0,this.tableWidthType=void 0,this.preferredWidth=void 0,this.rowHeightType=void 0,this.rowHeightCheckBox=void 0,this.rowHeight=void 0,this.cellWidthType=void 0,this.preferredCellWidthCheckBox=void 0,this.preferredCellWidth=void 0,this.tableTab=void 0,this.rowTab=void 0,this.cellTab=void 0,this.left=void 0,this.center=void 0,this.right=void 0,this.leftIndent=void 0,this.allowRowBreak=void 0,this.repeatHeader=void 0,this.cellTopAlign=void 0,this.cellCenterAlign=void 0,this.cellBottomAlign=void 0,this.tableFormat.destroy(),this.cellFormat.destroy(),this.tableFormat=void 0,this.cellFormat=void 0},e}(),bi=function(){function e(e){var i=this;this.cellFormat=new z,this.tableFormat=new U,this.isShadingChanged=!1,this.applyBordersShadingsProperties=function(){var e=i.documentHelper.owner.tablePropertiesDialogModule,n=i.documentHelper.selection.start.paragraph.associatedCell,r=void 0;(i.checkClassName(i.previewDivTopTop)||i.checkClassName(i.previewDivTopBottom)||i.checkClassName(i.previewDivTopCenter)||i.checkClassName(i.previewDivBottomcenter)||i.checkClassName(i.previewDivBottomLeft)||i.checkClassName(i.previewDivBottomRight)||i.checkClassName(i.previewDivDiagonalRight)||i.checkClassName(i.previewDivLeftDiagonal))&&(r=new S,i.checkClassName(i.previewDivTopTop)&&(r.top=i.getBorder()),i.checkClassName(i.previewDivTopBottom)&&(r.bottom=i.getBorder()),i.checkClassName(i.previewDivBottomLeft)&&(r.left=i.getBorder()),i.checkClassName(i.previewDivBottomRight)&&(r.right=i.getBorder()),i.checkClassName(i.previewDivTopCenter)&&(r.horizontal=i.getBorder()),i.checkClassName(i.previewDivBottomcenter)&&(r.vertical=i.getBorder()),i.checkClassName(i.previewDivLeftDiagonal)&&(r.diagonalDown=i.getBorder()),i.checkClassName(i.previewDivDiagonalRight)&&(r.diagonalUp=i.getBorder()));var o=new A,s=i.documentHelper.owner.editorModule;if(o.backgroundColor=i.shadingColorPicker.value,0===i.ulelementShading.index)i.applyTo=0,e&&(e.isCellBordersAndShadingUpdated=!0),i.cellFormat.borders=new S,t.isNullOrUndefined(r)?i.noneDiv.classList.contains("e-de-table-border-inside-setting-click")&&s.applyBordersInternal(i.cellFormat.borders,new S):s.applyBordersInternal(i.cellFormat.borders,r),t.isNullOrUndefined(n.cellFormat.shading)||(o.foregroundColor=n.cellFormat.shading.foregroundColor,o.textureStyle=n.cellFormat.shading.textureStyle),i.cellFormat.shading=new A,s.applyShading(i.cellFormat.shading,o);else{e&&(e.isTableBordersAndShadingUpdated=!0),i.applyTo=1;var a=i.documentHelper.owner.selection.tableFormat.table.tableFormat;i.tableFormat.copyFormat(a),i.tableFormat.borders=new S,t.isNullOrUndefined(r)?i.noneDiv.classList.contains("e-de-table-border-inside-setting-click")&&s.applyBordersInternal(i.tableFormat.borders,new S):s.applyBordersInternal(i.tableFormat.borders,r),t.isNullOrUndefined(a.shading)||(o.foregroundColor=a.shading.foregroundColor,o.textureStyle=a.shading.textureStyle),i.tableFormat.shading=new A,i.isShadingChanged=a.shading.backgroundColor!==o.backgroundColor,s.applyShading(i.tableFormat.shading,o)}i.applyFormat(),i.closeDialog()},this.closeDialog=function(){i.documentHelper.dialog.hide(),i.closeBordersShadingsDialog()},this.closeBordersShadingsDialog=function(){i.documentHelper.dialog2.element.style.pointerEvents="",i.documentHelper.updateFocus()},this.handleSettingCheckBoxAction=function(e){var t=e.target.id,n=i.target.id;t===n+"_None_Div"||t===n+"_None_Div_Container"||t===n+"_None_Div_Transparent"?(i.updateClassForSettingDivElements(),i.noneDiv.classList.add("e-de-table-border-inside-setting-click"),i.setSettingPreviewDivElement("none")):t===n+"_Box_Div"||t===n+"_Box_Div_Container"||t===n+"_Box_Div_Transparent"?(i.updateClassForSettingDivElements(),i.boxDiv.classList.add("e-de-table-border-inside-setting-click"),i.setSettingPreviewDivElement("box")):t===n+"_All_Div"||t===n+"_All_Div_Container"||t===n+"_All_Div_Transparent"?(i.updateClassForSettingDivElements(),i.allDiv.classList.add("e-de-table-border-inside-setting-click"),i.setSettingPreviewDivElement("all")):(i.updateClassForSettingDivElements(),i.customDiv.classList.add("e-de-table-border-inside-setting-click"),i.setSettingPreviewDivElement("customDiv"))},this.handlePreviewCheckBoxAction=function(e){var t=e.target.id,n=i.target.id,r="e-de-table-border-inside-preview-click";i.customDiv.click(),t===n+"_Preview_Div_TopTop_Container"||t===n+"_Preview_Div_TopTop"||t===n+"_previewDivTopTopTransParent"?(i.handlePreviewCheckBoxShowHide(n,r,i.previewDivTopTop),i.showHidePreviewDivElements(n,r,"_Preview_Div","_Preview_Div_TopTop","TopTop")):t===n+"_Preview_Div_TopCenter_Container"||t===n+"_Preview_Div_TopCenter"||t===n+"_previewDivTopCenterTransParent"?(i.handlePreviewCheckBoxShowHide(n,r,i.previewDivTopCenter),i.showHidePreviewDivElements(n,r,"_Preview_Div_Horizontal","_Preview_Div_TopCenter","TopCenter")):t===n+"_Preview_Div_TopBottom_Container"||t===n+"_Preview_Div_TopBottom"||t===n+"_previewDivTopBottomTransParent"?(i.handlePreviewCheckBoxShowHide(n,r,i.previewDivTopBottom),i.showHidePreviewDivElements(n,r,"_Preview_Div","_Preview_Div_TopBottom","TopBottom")):t===n+"_Preview_Div_LeftDiagonal_Container"||t===n+"_Preview_Div_LeftDiagonal"||t===n+"_previewDivLeftDiagonalTransParent"?(i.handlePreviewCheckBoxShowHide(n,r,i.previewDivLeftDiagonal),i.showHidePreviewDivElements(n,r,"_Preview_Div_Left_Diagonal","_Preview_Div_LeftDiagonal","LeftDiagonal")):t===n+"_Preview_Div_BottomLeft_Container"||t===n+"_Preview_Div_BottomLeft"||t===n+"_previewDivBottomLeftTransparent"?(i.handlePreviewCheckBoxShowHide(n,r,i.previewDivBottomLeft),i.showHidePreviewDivElements(n,r,"_Preview_Div","_Preview_Div_BottomLeft","BottomLeft")):t===n+"_Preview_Div_BottomCenter_Container"||t===n+"_Preview_Div_BottomCenter"||t===n+"_previewDivBottomcenterTransparent"?(i.handlePreviewCheckBoxShowHide(n,r,i.previewDivBottomcenter),i.showHidePreviewDivElements(n,r,"_Preview_Div_Vertical","_Preview_Div_BottomCenter","BottomCenter")):t===n+"_Preview_Div_BottomRight_Container"||t===n+"_Preview_Div_BottomRight"||t===n+"_previewDivBottomRightTransparent"?(i.handlePreviewCheckBoxShowHide(n,r,i.previewDivBottomRight),i.showHidePreviewDivElements(n,r,"_Preview_Div","_Preview_Div_BottomRight","BottomRight")):t!==n+"_Preview_Div_RightDiagonal_Container"&&t!==n+"_Preview_Div_RightDiagonal"&&t!==n+"_previewDivDiagonalRightTransparent"||(i.handlePreviewCheckBoxShowHide(n,r,i.previewDivDiagonalRight),i.showHidePreviewDivElements(n,r,"_Preview_Div_Right_Diagonal","_Preview_Div_RightDiagonal","RightDiagonal"))},this.applyTableCellPreviewBoxes=function(){i.customDiv.click(),t.isNullOrUndefined(i.ulelementShading)||(0===i.ulelementShading.index?(i.previewDivBottomcenterContainer.style.display="none",i.previewDivTopCenterContainer.style.display="none",i.previewVerticalDiv.style.display="none",i.previewHorizontalDiv.style.display="none",i.previewDivLeftDiagonal.style.display="",i.previewDivDiagonalRight.style.display="",i.previewDivBottomRightContainer.style.left="80px"):(i.previewDivLeftDiagonal.style.display="none",i.previewDivDiagonalRight.style.display="none",i.previewDivBottomcenterContainer.style.display="",i.previewDivTopCenterContainer.style.display="",i.previewVerticalDiv.style.display="",i.previewHorizontalDiv.style.display="",i.previewDivBottomRightContainer.style.left="110px"))},this.applyPreviewTableBackgroundColor=function(e){if(!t.isNullOrUndefined(e.currentValue)){var n=e.currentValue.hex;i.previewDiv.style.backgroundColor=n}},this.applyPreviewTableBorderColor=function(e){if(!t.isNullOrUndefined(e.currentValue)){var n=e.currentValue.hex;i.previewDiv.style.borderColor=n,i.previewRightDiagonalDiv.style.backgroundColor=n,i.previewLeftDiagonalDiv.style.backgroundColor=n,i.previewVerticalDiv.style.backgroundColor=n,i.previewHorizontalDiv.style.backgroundColor=n}},this.documentHelper=e}return e.prototype.getModuleName=function(){return"BordersAndShadingDialog"},e.prototype.initBordersAndShadingsDialog=function(e,i){this.target=t.createElement("div",{id:this.documentHelper.owner.containerId+"_table_border_shadings",className:"e-de-table-border-shading-dlg"});var n,r=t.createElement("div",{innerHTML:e.getConstant("Borders"),styles:"position: absolute;top: 65px;",id:this.target.id+"_border_label",className:"e-de-table-border-heading"}),o=t.createElement("div",{styles:"display: inline-block;position: absolute;top: 105px;width: 100px;height: 235px;border-style: none;",id:this.target.id+"_border_settings"});n=i?"left: 148px;":"left: 125px;";var l,d=t.createElement("div",{styles:"display: inline-block;position: absolute;"+n+"top: 125px;width: 150px;height: 235px;padding-left: 40px;border-style: none;padding-right: 40px;",id:this.target.id+"_border_style"});l=i?"right: 342px;":"left: 339px;";var h=t.createElement("div",{styles:"display: inline-block;position: absolute;"+l+"top: 87px;width: 180px;height: 235px;padding: 0px;border-style: none;",id:this.target.id+"_border_preview"}),c=t.createElement("div",{innerHTML:e.getConstant("Style"),styles:"width: 100%;padding-bottom: 10px;",className:"e-de-table-element-subheading"}),p=t.createElement("select",{id:this.target.id+"_border_style_dropDown"});p.innerHTML="<option>None</option><option>Single</option><option>Dot</option><option>DashSmallGap</option><option>DashLargeGap</option><option>DashDot</option><option>DashDotDot</option><option>Double</option><option>Triple</option><option>ThinThickSmallGap</option><option>ThickThinSmallGap</option><option>ThinThickThinSmallGap</option><option>ThinThickMediumGap</option><option>ThickThinMediumGap</option><option>ThinThickThinMediumGap</option><option>ThinThickLargeGap</option><option>ThickThinLargeGap</option><option>ThinThickThinLargeGap</option><option>SingleWavy</option><option>DoubleWavy</option><option>DashDotStroked</option><option>Emboss3D</option><option>Engrave3D</option><option>Outset</option><option>Inset</option><option>Thick</option>";var u,g=t.createElement("div",{innerHTML:e.getConstant("Width"),styles:"width:100%;padding-top: 20px;padding-bottom: 10px;",className:"e-de-table-element-subheading"}),m=t.createElement("input",{id:this.target.id+"_width"}),f=t.createElement("div",{innerHTML:e.getConstant("Color"),styles:"padding-top: 25px;",className:"e-de-table-setting-heading"}),v=t.createElement("input",{attrs:{type:"color"},id:this.target.id+"_border_color",styles:"width: 30px;position: absolute;left: 90px;",className:"e-dlg-clr-pkr-top"}),y=t.createElement("div",{innerHTML:e.getConstant("Setting"),styles:"width: 100%;position: absolute;",className:"e-de-table-setting-heading"}),b=t.createElement("div",{id:this.target.id+"_None_Div_Container",className:"e-de-table-border-none"});u=i?"padding-right:10px;":"padding-left:10px;",this.noneDiv=t.createElement("div",{id:this.target.id+"_None_Div",className:"e-de-table-border-inside-setting e-de-table-border-setting-genral"});var w=t.createElement("label",{innerHTML:e.getConstant("None"),className:"e-de-table-setting-labels-heading",styles:u+"top: 20px;position: absolute;",id:this.target.id+"_None_Div_Label"}),C=t.createElement("div",{id:this.target.id+"_Box_Div_Container",className:"e-de-table-border-box"});this.boxDiv=t.createElement("div",{id:this.target.id+"_Box_Div",className:"e-de-table-border-inside-setting e-de-table-border-setting-genral"});var x=t.createElement("label",{innerHTML:e.getConstant("Box"),className:"e-de-table-setting-labels-heading",styles:u+"top: 20px;position: absolute;",id:this.target.id+"_Box_Div_Label"}),F=t.createElement("div",{id:this.target.id+"_All_Div_Container",className:"e-de-table-border-all"});this.allDiv=t.createElement("div",{id:this.target.id+"_All_Div",className:"e-de-table-border-inside-setting e-de-table-border-setting-genral"});var P=t.createElement("label",{innerHTML:e.getConstant("All"),className:"e-de-table-setting-labels-heading",styles:u+"top: 25px;position: absolute;",id:this.target.id+"_All_Div_Label"}),T=t.createElement("div",{id:this.target.id+"_Custom_Div_Container",className:"e-de-table-border-custom"});this.customDiv=t.createElement("div",{id:this.target.id+"_Custom_Div",className:"e-de-table-border-inside-setting e-de-table-border-setting-genral"});var S=t.createElement("label",{innerHTML:e.getConstant("Custom"),className:"e-de-table-setting-labels-heading",styles:u+"top: 25px;position: absolute;",id:this.target.id+"_Custom_Div_Label"});this.noneDivTransparent=t.createElement("div",{id:this.target.id+"_None_Div_Transparent",className:"e-icons e-de-table-border-setting e-de-table-border-none-setting"}),this.boxDivTransparent=t.createElement("div",{id:this.target.id+"_Box_Div_Transparent",className:"e-icons e-de-table-border-setting e-de-table-border-box-setting"}),this.allDivTransparent=t.createElement("div",{id:this.target.id+"_All_Div_Transparent",className:"e-icons e-de-table-border-setting e-de-table-border-all-setting"}),this.customDivTransparent=t.createElement("div",{id:this.target.id+"_Custom_Div_Transparent",className:"e-icons e-de-table-border-setting e-de-table-border-custom-setting"}),i&&(this.noneDivTransparent.classList.add("e-de-rtl"),this.boxDivTransparent.classList.add("e-de-rtl"),this.allDivTransparent.classList.add("e-de-rtl"),this.customDivTransparent.classList.add("e-de-rtl"));var I;I=i?"margin-right: 10px;":"margin-left: 10px;";var N=t.createElement("div",{innerHTML:e.getConstant("Preview"),className:"e-de-table-setting-heading",styles:"position: absolute;top: 20px;"+I});this.previewDiv=t.createElement("div",{styles:"width: 80px;height: 80px;position: absolute; left: 50px;top: 50px;",id:this.target.id+"_Preview_Div",className:"e-de-border-dlg-preview-div"}),this.previewRightDiagonalDiv=t.createElement("div",{styles:"position: absolute;width:1px;height:113px;left: 90px;top: 34px;transform: rotate(135deg);",id:this.target.id+"_Preview_Div_Right_Diagonal",className:"e-de-border-dlg-preview-inside-divs"}),this.previewLeftDiagonalDiv=t.createElement("div",{styles:"position: absolute;width: 1px;height: 113px;left: 90px;top: 34px;transform:rotate(45deg);",id:this.target.id+"_Preview_Div_Left_Diagonal",className:"e-de-border-dlg-preview-inside-divs"}),this.previewVerticalDiv=t.createElement("div",{styles:"width: 1px;height: 81px;position: absolute;left: 90px;top: 50px;",id:this.target.id+"_Preview_Div_Vertical",className:"e-de-border-dlg-preview-inside-divs"}),this.previewHorizontalDiv=t.createElement("div",{styles:"width: 81px;height: 1px;position: absolute;left: 50px;top: 90px;",id:this.target.id+"_Preview_Div_Horizontal",className:"e-de-border-dlg-preview-inside-divs"});var E;E=i?"right: 10px;":"left: 10px;",this.previewDivTopTopContainer=t.createElement("div",{styles:"top: 50px;position: absolute;"+E,id:this.target.id+"_Preview_Div_TopTop_Container"}),this.previewDivTopTop=t.createElement("div",{id:this.target.id+"_Preview_Div_TopTop",className:"e-de-table-border-inside-preview e-de-table-border-preview-genral"}),this.previewDivTopCenterContainer=t.createElement("div",{styles:"top: 80px;position: absolute;"+E,id:this.target.id+"_Preview_Div_TopCenter_Container"}),this.previewDivTopCenter=t.createElement("div",{id:this.target.id+"_Preview_Div_TopCenter",className:"e-de-table-border-inside-preview e-de-table-border-preview-genral"}),this.previewDivTopBottomContainer=t.createElement("div",{styles:"top: 110px;position: absolute;"+E,id:this.target.id+"_Preview_Div_TopBottom_Container"}),this.previewDivTopBottom=t.createElement("div",{id:this.target.id+"_Preview_Div_TopBottom",className:"e-de-table-border-inside-preview e-de-table-border-preview-genral"}),this.previewDivLeftDiagonalContainer=t.createElement("div",{styles:"top: 145px;position: absolute;left: 10px;",id:this.target.id+"_Preview_Div_LeftDiagonal_Container"}),this.previewDivLeftDiagonal=t.createElement("div",{id:this.target.id+"_Preview_Div_LeftDiagonal",className:"e-de-table-border-inside-preview e-de-table-border-preview-genral"});var H,W,O;i?(H="left: 104px",W="left: 74px",O="left: 44px"):(H="left: 50px;",W="left : 80px;",O="left : 110px"),this.previewDivBottomLeftContainer=t.createElement("div",{styles:"top: 145px;position: absolute;"+H,id:this.target.id+"_Preview_Div_BottomLeft_Container"}),this.previewDivBottomLeft=t.createElement("div",{id:this.target.id+"_Preview_Div_BottomLeft",className:"e-de-table-border-inside-preview e-de-table-border-preview-genral"}),this.previewDivBottomcenterContainer=t.createElement("div",{styles:"top: 145px;position: absolute;"+W,id:this.target.id+"_Preview_Div_BottomCenter_Container"}),this.previewDivBottomcenter=t.createElement("div",{id:this.target.id+"_Preview_Div_BottomCenter",className:"e-de-table-border-inside-preview e-de-table-border-preview-genral"}),this.previewDivBottomRightContainer=t.createElement("div",{styles:"top: 145px;position: absolute;"+O,id:this.target.id+"_Preview_Div_BottomRight_Container"}),this.previewDivBottomRight=t.createElement("div",{id:this.target.id+"_Preview_Div_BottomRight",className:"e-de-table-border-inside-preview e-de-table-border-preview-genral"}),this.previewDivDiagonalRightContainer=t.createElement("div",{styles:"top: 145px; position: absolute; left: 110px;",id:this.target.id+"_Preview_Div_RightDiagonal_Container"}),this.previewDivDiagonalRight=t.createElement("div",{id:this.target.id+"_Preview_Div_RightDiagonal",className:"e-de-table-border-inside-preview e-de-table-border-preview-genral"}),this.previewDivTopTopTransParent=t.createElement("div",{id:this.target.id+"_previewDivTopTopTransParent",className:"e-icons e-de-table-border-preview e-de-table-border-toptop-alignment"}),this.previewDivTopCenterTransParent=t.createElement("div",{id:this.target.id+"_previewDivTopCenterTransParent",className:"e-icons e-de-table-border-preview e-de-table-border-topcenter-alignment"}),this.previewDivTopBottomTransParent=t.createElement("div",{id:this.target.id+"_previewDivTopBottomTransParent",className:"e-icons e-de-table-border-preview e-de-table-border-topbottom-alignment"}),this.previewDivLeftDiagonalTransParent=t.createElement("div",{id:this.target.id+"_previewDivLeftDiagonalTransParent",className:"e-icons e-de-table-border-preview e-de-table-border-diagionalup-alignment"}),this.previewDivBottomLeftTransparent=t.createElement("div",{id:this.target.id+"_previewDivBottomLeftTransparent",className:"e-icons e-de-table-border-preview e-de-table-border-bottomleft-alignment"}),this.previewDivBottomcenterTransparent=t.createElement("div",{id:this.target.id+"_previewDivBottomcenterTransparent",className:"e-icons e-de-table-border-preview e-de-table-border-bottomcenter-alignment"}),this.previewDivBottomRightTransparent=t.createElement("div",{id:this.target.id+"_previewDivBottomRightTransparent",className:"e-icons e-de-table-border-preview e-de-table-border-bottomright-alignment"}),this.previewDivDiagonalRightTransparent=t.createElement("div",{id:this.target.id+"_previewDivDiagonalRightTransparent",className:"e-icons e-de-table-border-preview e-de-table-border-diagionaldown-alignment"});var k;k=i?"left:60px;":"left:17px;",this.shadingContiner=t.createElement("div",{styles:"display:inline-block;position:absolute;"+k+";width:400px;height:100px;padding:0px;border-style: none;margin-left:10px;",id:this.target.id+"_shading_preview",className:"e-de-table-shading-preview"});var L,B=t.createElement("div",{innerHTML:e.getConstant("Shading"),className:"e-de-table-border-heading",styles:"padding-top: 30px;left: 5px;"}),R=t.createElement("div",{styles:"display:flex;"}),D=t.createElement("div",{innerHTML:e.getConstant("Fill"),className:"e-de-table-setting-heading e-de-table-border-fill",styles:"top: 50px;left: 10px;"}),M=t.createElement("input",{attrs:{type:"color"},id:this.target.id+"_shading_color",styles:"position: absolute;top: 75px;left: 40px;width: 30px;"});L=i?"left: 75px;":"left: 150px;";var A=t.createElement("div",{styles:"position:absolute;top:44px;"+L+"width:180px;"}),U=t.createElement("div",{styles:"width:100px;padding-bottom: 10px;",innerHTML:e.getConstant("Apply To"),className:"e-de-table-element-subheading"}),z=t.createElement("div",{styles:"width:100px;position:absolute;"}),V=t.createElement("select",{innerHTML:'<option value="Cell">'+e.getConstant("Cell")+'</option><option value="Table">'+e.getConstant("Table")+"</option>",id:this.target.id+"_shading"});z.appendChild(V),this.noneDiv.appendChild(this.noneDivTransparent),this.boxDiv.appendChild(this.boxDivTransparent),this.allDiv.appendChild(this.allDivTransparent),this.customDiv.appendChild(this.customDivTransparent),b.appendChild(this.noneDiv),b.appendChild(w),C.appendChild(this.boxDiv),C.appendChild(x),F.appendChild(this.allDiv),F.appendChild(P),T.appendChild(this.customDiv),T.appendChild(S),o.appendChild(y),o.appendChild(b),o.appendChild(C),o.appendChild(F),o.appendChild(T),this.previewDivBottomcenter.appendChild(this.previewDivBottomcenterTransparent),this.previewDivBottomRight.appendChild(this.previewDivBottomRightTransparent),this.previewDivBottomLeft.appendChild(this.previewDivBottomLeftTransparent),this.previewDivTopTop.appendChild(this.previewDivTopTopTransParent),this.previewDivTopCenter.appendChild(this.previewDivTopCenterTransParent),this.previewDivTopBottom.appendChild(this.previewDivTopBottomTransParent),this.previewDivDiagonalRight.appendChild(this.previewDivDiagonalRightTransparent),this.previewDivLeftDiagonal.appendChild(this.previewDivLeftDiagonalTransParent),this.previewDivBottomcenterContainer.appendChild(this.previewDivBottomcenter),this.previewDivBottomLeftContainer.appendChild(this.previewDivBottomLeft),this.previewDivBottomRightContainer.appendChild(this.previewDivBottomRight),this.previewDivDiagonalRightContainer.appendChild(this.previewDivDiagonalRight),this.previewDivLeftDiagonalContainer.appendChild(this.previewDivLeftDiagonal),this.previewDivTopBottomContainer.appendChild(this.previewDivTopBottom),this.previewDivTopCenterContainer.appendChild(this.previewDivTopCenter),this.previewDivTopTopContainer.appendChild(this.previewDivTopTop),h.appendChild(N),h.appendChild(this.previewDiv),h.appendChild(this.previewRightDiagonalDiv),h.appendChild(this.previewHorizontalDiv),h.appendChild(this.previewLeftDiagonalDiv),h.appendChild(this.previewVerticalDiv),h.appendChild(this.previewDivBottomcenterContainer),h.appendChild(this.previewDivBottomLeftContainer),h.appendChild(this.previewDivBottomRightContainer),h.appendChild(this.previewDivDiagonalRightContainer),h.appendChild(this.previewDivLeftDiagonalContainer),h.appendChild(this.previewDivTopBottomContainer),h.appendChild(this.previewDivTopCenterContainer),h.appendChild(this.previewDivTopTopContainer),A.appendChild(U),A.appendChild(z),R.appendChild(D),R.appendChild(M),R.appendChild(A),this.shadingContiner.appendChild(B),this.shadingContiner.appendChild(R),d.appendChild(c),d.appendChild(p),d.appendChild(g),d.appendChild(m),d.appendChild(f),d.appendChild(v),this.target.appendChild(r),this.target.appendChild(o),this.target.appendChild(d),this.target.appendChild(h),this.target.appendChild(this.shadingContiner),b.addEventListener("click",this.handleSettingCheckBoxAction),C.addEventListener("click",this.handleSettingCheckBoxAction),F.addEventListener("click",this.handleSettingCheckBoxAction),T.addEventListener("click",this.handleSettingCheckBoxAction),this.previewDivBottomcenterContainer.addEventListener("click",this.handlePreviewCheckBoxAction),this.previewDivBottomLeftContainer.addEventListener("click",this.handlePreviewCheckBoxAction),this.previewDivBottomRightContainer.addEventListener("click",this.handlePreviewCheckBoxAction),this.previewDivTopTopContainer.addEventListener("click",this.handlePreviewCheckBoxAction),this.previewDivTopBottomContainer.addEventListener("click",this.handlePreviewCheckBoxAction),this.previewDivTopCenterContainer.addEventListener("click",this.handlePreviewCheckBoxAction),this.previewDivDiagonalRightContainer.addEventListener("click",this.handlePreviewCheckBoxAction),this.previewDivLeftDiagonalContainer.addEventListener("click",this.handlePreviewCheckBoxAction),this.borderWidth=new a.NumericTextBox({value:0,min:0,max:6,decimals:2,width:150,enablePersistence:!1}),this.borderWidth.appendTo(m),this.borderStyle=new s.DropDownList({width:"150px",popupHeight:"150px",index:1,enableRtl:i}),this.borderStyle.appendTo(p),this.ulelementShading=new s.DropDownList({width:"150px",change:this.applyTableCellPreviewBoxes,index:1,enableRtl:i}),this.ulelementShading.appendTo(V),this.borderColorPicker=new a.ColorPicker({value:"#000000",change:this.applyPreviewTableBorderColor,enableRtl:i,locale:this.documentHelper.owner.locale,cssClass:"e-de-dlg-clr-picker"}),this.borderColorPicker.appendTo(v),this.shadingColorPicker=new a.ColorPicker({value:"#FFFFFF",change:this.applyPreviewTableBackgroundColor,enableRtl:i,locale:this.documentHelper.owner.locale,cssClass:"e-de-dlg-clr-picker"}),this.shadingColorPicker.appendTo(M),i&&D.classList.add("e-de-rtl")},e.prototype.applyFormat=function(){var e=this.documentHelper.owner.editorModule;e.initComplexHistory("BordersAndShading"),e.isBordersAndShadingDialog=!0,0===this.applyTo?e.onCellFormat(this.cellFormat):e.onTableFormat(this.tableFormat,this.isShadingChanged),t.isNullOrUndefined(this.documentHelper.owner.editorHistory.currentHistoryInfo)||this.documentHelper.owner.editorHistory.updateComplexHistory(),e.isBordersAndShadingDialog=!1},e.prototype.getBorder=function(){var e=new T;return e.color=this.borderColorPicker.value,e.lineStyle=this.borderStyle.text,e.lineWidth=this.borderWidth.value,e},e.prototype.checkClassName=function(e){return e.classList.contains("e-de-table-border-inside-preview-click")},e.prototype.show=function(){var e=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);e.setLocale(this.documentHelper.owner.locale),this.target||this.initBordersAndShadingsDialog(e,this.documentHelper.owner.enableRtl),this.loadBordersShadingsPropertiesDialog(),this.documentHelper.dialog.content=this.target,this.documentHelper.dialog.header=e.getConstant("Borders and Shading"),this.documentHelper.dialog.beforeOpen=this.documentHelper.updateFocus,this.documentHelper.dialog.close=this.closeBordersShadingsDialog,this.documentHelper.dialog.position={X:"center",Y:"center"},this.documentHelper.dialog.width="auto",this.documentHelper.dialog.height="auto",this.documentHelper.dialog.buttons=[{click:this.applyBordersShadingsProperties,buttonModel:{content:e.getConstant("Ok"),cssClass:"e-flat e-table-border-shading-okay",isPrimary:!0}},{click:this.closeDialog,buttonModel:{content:e.getConstant("Cancel"),cssClass:"e-flat e-table-border-shading-cancel"}}],this.documentHelper.dialog.dataBind(),this.documentHelper.dialog.show()},e.prototype.updateClassForSettingDivElements=function(){for(var e=this.target.getElementsByClassName("e-de-table-border-inside-setting"),t=0;t<e.length;t++)if(-1!==e[t].className.indexOf("e-de-table-border-inside-setting-click")){var i=e[t].className;i=i.replace("e-de-table-border-inside-setting-click",""),e[t].className=i}},e.prototype.setSettingPreviewDivElement=function(e){switch(e){case"none":this.previewDivTopTop.classList.remove("e-de-table-border-inside-preview-click"),this.previewDivTopCenter.classList.remove("e-de-table-border-inside-preview-click"),this.previewDivTopBottom.classList.remove("e-de-table-border-inside-preview-click"),this.previewDivLeftDiagonal.classList.remove("e-de-table-border-inside-preview-click"),this.previewDivDiagonalRight.classList.remove("e-de-table-border-inside-preview-click"),this.previewDivBottomRight.classList.remove("e-de-table-border-inside-preview-click"),this.previewDivBottomLeft.classList.remove("e-de-table-border-inside-preview-click"),this.previewDivBottomcenter.classList.remove("e-de-table-border-inside-preview-click"),this.isShowHidePreviewTableElements("none");break;case"box":this.previewDivTopCenter.classList.remove("e-de-table-border-inside-preview-click"),this.previewDivLeftDiagonal.classList.remove("e-de-table-border-inside-preview-click"),this.previewDivDiagonalRight.classList.remove("e-de-table-border-inside-preview-click"),this.previewDivBottomcenter.classList.remove("e-de-table-border-inside-preview-click"),this.previewDivTopTop.classList.add("e-de-table-border-inside-preview-click"),this.previewDivTopBottom.classList.add("e-de-table-border-inside-preview-click"),this.previewDivBottomRight.classList.add("e-de-table-border-inside-preview-click"),this.previewDivBottomLeft.classList.add("e-de-table-border-inside-preview-click"),this.isShowHidePreviewTableElements("box");break;case"all":this.previewDivLeftDiagonal.classList.remove("e-de-table-border-inside-preview-click"),this.previewDivDiagonalRight.classList.remove("e-de-table-border-inside-preview-click"),this.previewDivBottomcenter.classList.add("e-de-table-border-inside-preview-click"),this.previewDivTopTop.classList.add("e-de-table-border-inside-preview-click"),this.previewDivTopBottom.classList.add("e-de-table-border-inside-preview-click"),this.previewDivBottomRight.classList.add("e-de-table-border-inside-preview-click"),this.previewDivBottomLeft.classList.add("e-de-table-border-inside-preview-click"),this.previewDivTopCenter.classList.add("e-de-table-border-inside-preview-click"),this.isShowHidePreviewTableElements("all")}},e.prototype.isShowHidePreviewTableElements=function(e){switch(e){case"none":this.previewDiv.style.border="none",this.previewRightDiagonalDiv.style.display="none",this.previewLeftDiagonalDiv.style.display="none",this.previewHorizontalDiv.style.display="none",this.previewVerticalDiv.style.display="none";break;case"box":this.previewDiv.style.border="1px solid rgba(0, 0, 0, .54)",this.previewRightDiagonalDiv.style.display="none",this.previewLeftDiagonalDiv.style.display="none",this.previewHorizontalDiv.style.display="none",this.previewVerticalDiv.style.display="none";break;case"all":this.previewDiv.style.border="1px solid rgba(0, 0, 0, .54)",this.previewRightDiagonalDiv.style.display="none",this.previewLeftDiagonalDiv.style.display="none",this.previewHorizontalDiv.style.display="block",this.previewVerticalDiv.style.display="block"}},e.prototype.handlePreviewCheckBoxShowHide=function(e,t,i){i.classList.contains(t)?i.classList.remove(t):i.classList.add(t)},e.prototype.showHidePreviewDivElements=function(e,t,i,n,r){var o=document.getElementById(e+i),s=document.getElementById(e+n);"TopTop"===r?this.setPropertyPreviewDivElement(o,s,t,"border-top"):"TopCenter"===r?this.setPropertyPreviewDivElement(o,s,t,"display"):"TopBottom"===r?this.setPropertyPreviewDivElement(o,s,t,"border-bottom"):"LeftDiagonal"===r?this.setPropertyPreviewDivElement(o,s,t,"display"):"BottomLeft"===r?this.setPropertyPreviewDivElement(o,s,t,"border-left"):"BottomCenter"===r?this.setPropertyPreviewDivElement(o,s,t,"display"):"BottomRight"===r?this.setPropertyPreviewDivElement(o,s,t,"border-right"):"RightDiagonal"===r&&this.setPropertyPreviewDivElement(o,s,t,"display")},e.prototype.setPropertyPreviewDivElement=function(e,t,i,n){t.classList.contains(i)&&"border"===n.split("-")[0]?e.style[n]="1px solid rgba(0, 0, 0, .54)":t.classList.contains(i)&&"display"===n?e.style[n]="block":e.style[n]="none"},e.prototype.loadBordersShadingsPropertiesDialog=function(){var e,i,n,r,o=this.documentHelper.selection.tableFormat.table.tableFormat;t.isNullOrUndefined(o)||t.isNullOrUndefined(o.borders)||(this.cloneBorders(o.borders),t.isNullOrUndefined(o.borders)||t.isNullOrUndefined(o.borders.top)?(e=1,i="#000000",r=0,n="#000000"):(e=this.getLineStyle(o.borders.top.lineStyle),i=o.borders.top.color,r=o.borders.top.getLineWidth(),n=o.shading.backgroundColor)),this.borderColorPicker.value=i,this.shadingColorPicker.value=n;var s={target:this.borderColorPicker,ctrlKey:!1,shiftKey:!1,which:0},a={target:this.shadingColorPicker,ctrlKey:!1,shiftKey:!1,which:0};this.applyPreviewTableBackgroundColor(a),this.applyPreviewTableBorderColor(s),this.ulelementShading.index=1,this.previewDivLeftDiagonal.style.display="none",this.previewDivDiagonalRight.style.display="none",this.borderWidth.value=r,this.borderStyle.index=e},e.prototype.cloneBorders=function(e){var t=!1,i=!1,n=!1,r=!1,o=!1,s=!1,a=!1,l=!1,d=!1;null!==e&&(e.top&&(e.top.hasNoneStyle||"None"!==e.top.lineStyle)&&(t=!0),e.bottom&&(e.bottom.hasNoneStyle||"None"!==e.bottom.lineStyle)&&(i=!0),e.left&&(e.left.hasNoneStyle||"None"!==e.left.lineStyle)&&(n=!0),e.right&&(e.right.hasNoneStyle||"None"!==e.right.lineStyle)&&(r=!0),e.horizontal&&(e.horizontal.hasNoneStyle||"None"!==e.horizontal.lineStyle)&&(o=!0),e.vertical&&(e.vertical.hasNoneStyle||"None"!==e.vertical.lineStyle)&&(s=!0),e.diagonalDown&&(e.diagonalDown.hasNoneStyle||"None"!==e.diagonalDown.lineStyle)&&(a=!0),e.diagonalUp&&(e.diagonalUp.hasNoneStyle||"None"!==e.diagonalUp.lineStyle)&&(d=!0),t&&i&&n&&r?t&&i&&n&&r&&o&&s&&!d&&!a?t&&i&&n&&r&&o&&s&&!d&&!a&&(e.top.hasNoneStyle&&e.bottom.hasNoneStyle&&e.left.hasNoneStyle&&e.right.hasNoneStyle&&e.horizontal.hasNoneStyle&&e.vertical.hasNoneStyle?(this.setSettingPreviewDivElement("none"),this.customDiv.classList.remove("e-de-table-border-inside-setting-click"),this.noneDiv.classList.add("e-de-table-border-inside-setting-click"),this.boxDiv.classList.remove("e-de-table-border-inside-setting-click"),this.allDiv.classList.remove("e-de-table-border-inside-setting-click")):(this.setSettingPreviewDivElement("all"),this.allDiv.classList.add("e-de-table-border-inside-setting-click"),this.customDiv.classList.remove("e-de-table-border-inside-setting-click"),this.noneDiv.classList.remove("e-de-table-border-inside-setting-click"),this.boxDiv.classList.remove("e-de-table-border-inside-setting-click"))):n&&i&&t&&r&&!o&&!s?e.top.hasNoneStyle&&e.bottom.hasNoneStyle&&e.left.hasNoneStyle&&e.right.hasNoneStyle&&e.horizontal.hasNoneStyle&&e.vertical.hasNoneStyle?(this.setSettingPreviewDivElement("none"),this.boxDiv.classList.remove("e-de-table-border-inside-setting-click"),this.allDiv.classList.remove("e-de-table-border-inside-setting-click"),this.customDiv.classList.remove("e-de-table-border-inside-setting-click"),this.noneDiv.classList.add("e-de-table-border-inside-setting-click")):(this.setSettingPreviewDivElement("box"),this.customDiv.classList.remove("e-de-table-border-inside-setting-click"),this.noneDiv.classList.remove("e-de-table-border-inside-setting-click"),this.boxDiv.classList.add("e-de-table-border-inside-setting-click"),this.allDiv.classList.remove("e-de-table-border-inside-setting-click")):l=!0:l=!0,this.previewDivLeftDiagonal.classList.remove("e-de-table-border-inside-preview-click"),this.previewDivDiagonalRight.classList.remove("e-de-table-border-inside-preview-click"),l&&(this.customDiv.classList.add("e-de-table-border-inside-setting-click"),this.noneDiv.classList.remove("e-de-table-border-inside-setting-click"),this.boxDiv.classList.remove("e-de-table-border-inside-setting-click"),this.allDiv.classList.remove("e-de-table-border-inside-setting-click"),t?this.previewDivTopTop.classList.add("e-de-table-border-inside-preview-click"):this.previewDivTopTop.classList.remove("e-de-table-border-inside-preview-click"),i?this.previewDivTopBottom.classList.add("e-de-table-border-inside-preview-click"):this.previewDivTopBottom.classList.remove("e-de-table-border-inside-preview-click"),n?this.previewDivBottomLeft.classList.add("e-de-table-border-inside-preview-click"):this.previewDivBottomLeft.classList.remove("e-de-table-border-inside-preview-click"),r?this.previewDivBottomRight.classList.add("e-de-table-border-inside-preview-click"):this.previewDivBottomRight.classList.remove("e-de-table-border-inside-preview-click"),s?this.previewDivBottomcenter.classList.add("e-de-table-border-inside-preview-click"):this.previewDivBottomcenter.classList.remove("e-de-table-border-inside-preview-click"),o?this.previewDivTopCenter.classList.add("e-de-table-border-inside-preview-click"):this.previewDivTopCenter.classList.remove("e-de-table-border-inside-preview-click")))},e.prototype.getLineStyle=function(e){switch(e){case"Single":return 1;case"Dot":return 2;case"DashSmallGap":return 3;case"DashLargeGap":return 4;case"DashDot":return 5;case"DashDotDot":return 6;case"Double":return 7;case"Triple":return 8;case"ThinThickSmallGap":return 9;case"ThickThinSmallGap":return 10;case"ThinThickThinSmallGap":return 11;case"ThinThickMediumGap":return 12;case"ThickThinMediumGap":return 13;case"ThinThickThinMediumGap":return 14;case"ThinThickLargeGap":return 15;case"ThickThinLargeGap":return 16;case"ThinThickThinLargeGap":return 17;case"SingleWavy":return 18;case"DoubleWavy":return 19;case"DashDotStroked":return 20;case"Emboss3D":return 21;case"Engrave3D":return 22;case"Outset":return 23;case"Inset":return 24;case"Thick":return 25}return 0},e.prototype.destroy=function(){if(!t.isNullOrUndefined(this.target)){this.target.parentElement&&this.target.parentElement.removeChild(this.target);for(var e=0;e<this.target.childNodes.length;e++)this.target.removeChild(this.target.childNodes[e]),e--;this.target=void 0}this.cellFormat&&(this.cellFormat.destroy(),this.cellFormat=void 0),this.tableFormat&&(this.tableFormat.destroy(),this.tableFormat=void 0),this.dialog=void 0,this.target=void 0,t.isNullOrUndefined(this.borderStyle)||this.borderStyle.destroy(),this.borderStyle=void 0,t.isNullOrUndefined(this.borderColorPicker)||this.borderColorPicker.destroy(),this.borderColorPicker=void 0,t.isNullOrUndefined(this.shadingColorPicker)||this.shadingColorPicker.destroy(),this.shadingColorPicker=void 0,t.isNullOrUndefined(this.ulelementShading)||this.ulelementShading.destroy(),this.ulelementShading=void 0,this.noneDivTransparent=void 0,this.boxDivTransparent=void 0,this.allDivTransparent=void 0,this.customDivTransparent=void 0,this.previewDiv=void 0,this.previewRightDiagonalDiv=void 0,this.previewLeftDiagonalDiv=void 0,this.previewVerticalDiv=void 0,this.previewHorizontalDiv=void 0,this.previewDivTopTopContainer=void 0,this.previewDivTopTop=void 0,this.previewDivTopCenterContainer=void 0,this.previewDivTopCenter=void 0,this.previewDivTopBottomContainer=void 0,this.previewDivTopBottom=void 0,this.previewDivLeftDiagonalContainer=void 0,this.previewDivLeftDiagonal=void 0,this.previewDivBottomLeftContainer=void 0,this.previewDivBottomLeft=void 0,this.previewDivBottomcenterContainer=void 0,this.previewDivBottomcenter=void 0,this.previewDivBottomRightContainer=void 0,this.previewDivBottomRight=void 0,this.previewDivDiagonalRightContainer=void 0,this.previewDivDiagonalRight=void 0,this.previewDivTopTopTransParent=void 0,this.previewDivTopCenterTransParent=void 0,this.previewDivTopBottomTransParent=void 0,this.previewDivLeftDiagonalTransParent=void 0,this.previewDivBottomLeftTransparent=void 0,this.previewDivBottomcenterTransparent=void 0,this.previewDivBottomRightTransparent=void 0,this.previewDivDiagonalRightTransparent=void 0,this.shadingContiner=void 0,this.noneDiv=void 0,this.customDiv=void 0,this.allDiv=void 0,this.boxDiv=void 0},e}(),wi=function(){function e(e){var i=this;this.applyTableCellProperties=function(){var e=i.documentHelper.selection.tableFormat;t.isNullOrUndefined(i.bottomMarginBox.value||i.leftMarginBox.value||i.rightMarginBox.value||i.topMarginBox.value||i.cellSpaceTextBox.value)||e.bottomMargin===i.bottomMarginBox.value&&e.leftMargin===i.leftMarginBox.value&&e.rightMargin===i.rightMarginBox.value&&e.topMargin===i.topMarginBox.value&&e.cellSpacing===i.cellSpaceTextBox.value||(i.documentHelper.owner.tablePropertiesDialogModule.isTableOptionsUpdated=!0,i.applyTableOptions(i.tableFormat),i.documentHelper.owner.tablePropertiesDialogModule.applyTableSubProperties()),i.closeCellMarginsDialog()},this.closeCellMarginsDialog=function(){i.documentHelper.dialog.hide(),i.documentHelper.dialog.element.style.pointerEvents="",i.documentHelper.updateFocus()},this.changeAllowSpaceCheckBox=function(){i.allowSpaceCheckBox.checked?i.cellSpaceTextBox.enabled=!0:i.cellSpaceTextBox.enabled=!1},this.removeEvents=function(){i.documentHelper.dialog2.element.style.pointerEvents="",i.documentHelper.updateFocus()},this.documentHelper=e}return Object.defineProperty(e.prototype,"tableFormat",{get:function(){return t.isNullOrUndefined(this.tableFormatIn)?this.tableFormatIn=new U:this.tableFormatIn},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"TableOptionsDialog"},e.prototype.initTableOptionsDialog=function(e,i){this.target=t.createElement("div",{id:this.documentHelper.owner.containerId+"_insertCellMarginsDialog",className:"e-de-table-options-dlg"});var n=t.createElement("div",{className:"e-de-table-options-dlg-div"}),o=t.createElement("Label",{id:this.target.id+"_innerDivLabel",className:"e-de-cell-dia-options-label",innerHTML:e.getConstant("Default cell margins")});n.appendChild(o),Ci.getCellMarginDialogElements(this,n,e);var s=t.createElement("div",{styles:"width: 475px; position: relative;"}),l=t.createElement("Label",{className:"e-de-cell-dia-options-label",id:this.target.id+"_cellSpaceLabel"});l.innerHTML=e.getConstant("Default cell spacing"),s.appendChild(l);var d,h=t.createElement("TABLE",{styles:"height: 30px;"}),c=t.createElement("tr"),p=t.createElement("td"),u=t.createElement("input",{attrs:{type:"checkbox"},id:this.target.id+"_cellcheck"});d=i?"padding-right:15px;":"padding-left:14px;";var g=t.createElement("td",{styles:d});this.cellspacingTextBox=t.createElement("input",{attrs:{type:"text"},id:this.target.id+"_cellspacing"}),p.appendChild(u),g.appendChild(this.cellspacingTextBox),c.appendChild(p),c.appendChild(g),h.appendChild(c),s.appendChild(h);var m=document.createElement("div");this.target.appendChild(s),this.target.appendChild(m),this.cellSpaceTextBox=new a.NumericTextBox({value:0,min:0,max:264.5,width:163,decimals:2,enablePersistence:!1}),this.cellSpaceTextBox.appendTo(this.cellspacingTextBox),this.allowSpaceCheckBox=new r.CheckBox({label:e.getConstant("Allow spacing between cells"),change:this.changeAllowSpaceCheckBox,enableRtl:i,cssClass:"e-de-tbl-margin-sub-header"}),this.allowSpaceCheckBox.appendTo(u)},e.prototype.loadCellMarginsDialog=function(){var e=this.documentHelper.selection.tableFormat;this.cellSpaceTextBox.value=e.cellSpacing,this.bottomMarginBox.value=e.bottomMargin,this.topMarginBox.value=e.topMargin,this.rightMarginBox.value=e.rightMargin,this.leftMarginBox.value=e.leftMargin,e.cellSpacing>0?(this.allowSpaceCheckBox.checked=!0,this.cellSpaceTextBox.enabled=!0):(this.allowSpaceCheckBox.checked=!1,this.cellSpaceTextBox.enabled=!1)},e.prototype.applySubTableOptions=function(e){this.documentHelper.owner.editorHistory.initComplexHistory(this.documentHelper.selection,"TableMarginsSelection"),this.applyTableOptionsHistory(e),t.isNullOrUndefined(this.documentHelper.owner.editorHistory.currentHistoryInfo)||this.documentHelper.owner.editorHistory.updateComplexHistory()},e.prototype.applyTableOptionsHelper=function(e){this.applySubTableOptionsHelper(e)},e.prototype.applyTableOptionsHistory=function(e){this.documentHelper.owner.editorModule.initHistory("TableOptions"),this.applySubTableOptionsHelper(e)},e.prototype.applySubTableOptionsHelper=function(e){var i=this.documentHelper.selection.start.currentWidget.paragraph.associatedCell.ownerTable,n=(i=i.combineWidget(this.documentHelper.owner.viewer)).tableFormat;t.isNullOrUndefined(this.documentHelper.owner.editorHistory.currentBaseHistoryInfo)||this.documentHelper.owner.editorHistory.currentBaseHistoryInfo.addModifiedTableOptions(n),n.cellSpacing=e.cellSpacing,n.leftMargin=e.leftMargin,n.topMargin=e.topMargin,n.rightMargin=e.rightMargin,n.bottomMargin=e.bottomMargin,this.documentHelper.owner.tablePropertiesDialogModule.calculateGridValue(i)},e.prototype.applyTableOptions=function(e){e.leftMargin=this.leftMarginBox.value,e.topMargin=this.topMarginBox.value,e.bottomMargin=this.bottomMarginBox.value,e.rightMargin=this.rightMarginBox.value,this.allowSpaceCheckBox.checked&&(e.cellSpacing=this.cellSpaceTextBox.value)},e.prototype.show=function(){var e=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);e.setLocale(this.documentHelper.owner.locale),this.target||this.initTableOptionsDialog(e,this.documentHelper.owner.enableRtl),this.loadCellMarginsDialog(),this.documentHelper.dialog.header=e.getConstant("Table Options"),this.documentHelper.dialog.content=this.target,this.documentHelper.dialog.beforeOpen=void 0,this.documentHelper.dialog.position={X:"center",Y:"center"},this.documentHelper.dialog.height="auto",this.documentHelper.dialog.width="auto",this.documentHelper.dialog.open=void 0,this.documentHelper.dialog.beforeOpen=this.documentHelper.updateFocus,this.documentHelper.dialog.close=this.removeEvents,this.documentHelper.dialog.buttons=[{click:this.applyTableCellProperties,buttonModel:{content:e.getConstant("Ok"),cssClass:"e-flat e-table-cell-okay",isPrimary:!0}},{click:this.closeCellMarginsDialog,buttonModel:{content:e.getConstant("Cancel"),cssClass:"e-flat e-table-cell-cancel"}}],this.documentHelper.dialog.dataBind(),this.documentHelper.dialog.show()},e.prototype.destroy=function(){if(!t.isNullOrUndefined(this.target)){this.target.parentElement&&this.target.parentElement.removeChild(this.target);for(var e=0;e<this.target.childNodes.length;e++)this.target.removeChild(this.target.childNodes[e]),e--;this.target=void 0}this.dialog=void 0,this.target=void 0,this.documentHelper=void 0,this.cellspacingTextBox=void 0,this.allowSpaceCheckBox=void 0},e}(),Ci=function(){function e(e){var i=this;this.removeEvents=function(){i.documentHelper.dialog2.element.style.pointerEvents="",i.documentHelper.updateFocus()},this.changeSameAsTable=function(){i.sameAsTableCheckBox.checked?(i.leftMarginBox.enabled=!1,i.rightMarginBox.enabled=!1,i.bottomMarginBox.enabled=!1,i.topMarginBox.enabled=!1):(i.leftMarginBox.enabled=!0,i.rightMarginBox.enabled=!0,i.bottomMarginBox.enabled=!0,i.topMarginBox.enabled=!0)},this.applyTableCellProperties=function(){var e=i.documentHelper.selection.cellFormat;t.isNullOrUndefined(i.bottomMarginBox.value||i.leftMarginBox.value||i.rightMarginBox.value||i.topMarginBox.value)||e.bottomMargin===i.bottomMarginBox.value&&e.leftMargin===i.leftMarginBox.value&&e.rightMargin===i.rightMarginBox.value&&e.topMargin===i.topMarginBox.value||(i.documentHelper.owner.tablePropertiesDialogModule.isCellOptionsUpdated=!0,i.applyTableOptions(i.cellFormat),i.documentHelper.owner.tablePropertiesDialogModule.applyTableSubProperties()),i.closeCellMarginsDialog()},this.closeCellMarginsDialog=function(){i.documentHelper.dialog.hide(),i.documentHelper.dialog.element.style.pointerEvents=""},this.documentHelper=e}return Object.defineProperty(e.prototype,"cellFormat",{get:function(){return t.isNullOrUndefined(this.cellFormatIn)?this.cellFormatIn=new z:this.cellFormatIn},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"CellOptionsDialog"},e.prototype.initCellMarginsDialog=function(i,n){this.owner=this.documentHelper.owner.viewer,this.target=t.createElement("div",{id:this.documentHelper.owner.containerId+"_tableCellMarginsDialog",className:"e-de-table-cell-margin-dlg"});var o=t.createElement("div",{styles:"width: 504px;position: relative;height: auto;"}),s=t.createElement("Label",{className:"e-de-cell-dia-options-label",id:this.target.id+"_innerDivLabel"});s.innerHTML=i.getConstant("Cell margins"),o.appendChild(s);var a=t.createElement("TABLE",{styles:"padding-bottom: 8px;padding-top: 8px;",className:"e-de-cell-margin-top"}),l=t.createElement("tr"),d=t.createElement("td",{className:"e-de-tbl-btn-separator"}),h=t.createElement("input",{attrs:{type:"checkbox"},id:this.target.id+"_sameAsCheckBox"});d.appendChild(h),l.appendChild(d),a.appendChild(l),o.appendChild(a),e.getCellMarginDialogElements(this,o,i);var c=document.createElement("div");this.target.appendChild(c),this.sameAsTableCheckBox=new r.CheckBox({label:i.getConstant("Same as the whole table"),change:this.changeSameAsTable,enableRtl:n}),this.sameAsTableCheckBox.appendTo(h),this.sameAsTableCheckBox.addEventListener("change",this.changeSameAsTable)},e.prototype.show=function(){var e=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);e.setLocale(this.documentHelper.owner.locale),this.target||this.initCellMarginsDialog(e,this.documentHelper.owner.enableRtl),this.loadCellMarginsDialog(),this.documentHelper.dialog.header=e.getConstant("Cell Options"),this.documentHelper.dialog.position={X:"center",Y:"top"},this.documentHelper.dialog.height="auto",this.documentHelper.dialog.width="auto",this.documentHelper.dialog.content=this.target,this.documentHelper.dialog.beforeOpen=void 0,this.documentHelper.dialog.open=void 0,this.documentHelper.dialog.close=this.removeEvents,this.documentHelper.dialog.buttons=[{click:this.applyTableCellProperties,buttonModel:{content:e.getConstant("Ok"),cssClass:"e-flat e-table-cell-margin-okay",isPrimary:!0}},{click:this.closeCellMarginsDialog,buttonModel:{content:e.getConstant("Cancel"),cssClass:"e-flat e-table-cell-margin-cancel"}}],this.documentHelper.dialog.show()},e.prototype.loadCellMarginsDialog=function(){var e=this.documentHelper.selection.cellFormat;if(this.sameAsTable=t.isNullOrUndefined(e.leftMargin||e.topMargin||e.rightMargin||e.bottomMargin),this.sameAsTable){var i=this.documentHelper.selection.tableFormat;this.loadCellProperties(i,!1,!0)}else this.loadCellProperties(e,!0,!1)},e.prototype.loadCellProperties=function(e,t,i){this.leftMarginBox.value=e.leftMargin,this.rightMarginBox.value=e.rightMargin,this.topMarginBox.value=e.topMargin,this.bottomMarginBox.value=e.bottomMargin,this.leftMarginBox.enabled=t,this.rightMarginBox.enabled=t,this.topMarginBox.enabled=t,this.bottomMarginBox.enabled=t,this.sameAsTableCheckBox.checked=i},e.prototype.applySubCellOptions=function(e){this.documentHelper.owner.editorHistory.initComplexHistory(this.documentHelper.selection,"CellMarginsSelection"),this.documentHelper.owner.editorModule.initHistory("CellOptions"),this.documentHelper.selection.start.paragraph.associatedCell.ownerTable.combineWidget(this.owner),this.applyCellMarginValue(this.documentHelper.selection.start.paragraph.associatedCell.ownerRow.combineWidget(this.owner),this.documentHelper.selection.start,this.documentHelper.selection.end,e),this.documentHelper.owner.editorModule.reLayout(this.documentHelper.selection,!1),t.isNullOrUndefined(this.documentHelper.owner.editorHistory.currentHistoryInfo)||this.documentHelper.owner.editorHistory.updateComplexHistory()},e.prototype.applyCellMarginValue=function(e,i,n,r){if(this.applyCellMarginsInternal(e,r),n.paragraph.associatedCell.ownerRow!==e){var o=e.nextWidget;t.isNullOrUndefined(o)||this.applyCellMarginValue(o,i,n,r)}},e.prototype.applyCellMarginsInternal=function(e,i){if(!t.isNullOrUndefined(this.documentHelper.owner.editorHistory.currentBaseHistoryInfo)){var n=e.childWidgets[0].cellFormat;i=this.documentHelper.owner.editorHistory.currentBaseHistoryInfo.addModifiedCellOptions(n,i,e.ownerTable)}t.isNullOrUndefined(i)||this.applyCellMarginsForCells(e,i)},e.prototype.applyCellMarginsForCells=function(e,t){var i=e.childWidgets;this.iterateCells(i,t)},e.prototype.iterateCells=function(e,t){for(var i=0;i<e.length;i++)this.applySubCellMargins(e[i].cellFormat,t);this.documentHelper.owner.tablePropertiesDialogModule.calculateGridValue(e[0].ownerTable)},e.prototype.applySubCellMargins=function(e,t){e.leftMargin=t.leftMargin,e.topMargin=t.topMargin,e.rightMargin=t.rightMargin,e.bottomMargin=t.bottomMargin},e.prototype.applyTableOptions=function(e){this.sameAsTableCheckBox.checked||(e.leftMargin=this.leftMarginBox.value,e.topMargin=this.topMarginBox.value,e.bottomMargin=this.bottomMarginBox.value,e.rightMargin=this.rightMarginBox.value)},e.prototype.destroy=function(){if(!t.isNullOrUndefined(this.target)){this.target.parentElement&&this.target.parentElement.removeChild(this.target);for(var e=0;e<this.target.childNodes.length;e++)this.target.removeChild(this.target.childNodes[e]),e--;this.target=void 0}this.dialog=void 0,this.target=void 0,this.documentHelper=void 0,this.sameAsTableCheckBox=void 0},e.getCellMarginDialogElements=function(e,i,n){if(!t.isNullOrUndefined(e)){var r=t.createElement("TABLE",{className:"e-de-cell-margin-top"}),o=t.createElement("tr",{styles:"height: 50px;"}),s=t.createElement("td"),l=t.createElement("label",{innerHTML:n.getConstant("Top"),className:"e-de-cell-dia-label-common",id:e.target.id+"_TopLabel"}),d=t.createElement("input",{attrs:{type:"text"},styles:"width:100%",id:e.target.id+"_Top"});s.appendChild(l),s.appendChild(d);var h=t.createElement("td",{className:"e-de-tbl-btn-separator"}),c=t.createElement("label",{innerHTML:n.getConstant("Left"),className:"e-de-cell-dia-label-common",id:e.target.id+"_leftLabel"}),p=t.createElement("input",{attrs:{type:"text"},styles:"width:100%",id:e.target.id+"_left"});h.appendChild(c),h.appendChild(p),o.appendChild(s),o.appendChild(h);var u=t.createElement("tr",{styles:"height: 50px;"}),g=t.createElement("td",{styles:"width:40%;"}),m=t.createElement("label",{innerHTML:n.getConstant("Bottom"),className:"e-de-cell-dia-label-common",id:e.target.id+"_bottomLabel"}),f=t.createElement("input",{attrs:{type:"text"},styles:"width:100%",id:e.target.id+"_bottom"});g.appendChild(m),g.appendChild(f);var v=t.createElement("td",{styles:"width:40%;"}),y=t.createElement("label",{innerHTML:n.getConstant("Right"),id:e.target.id+"_rightLabel",className:"e-de-cell-dia-label-common"}),b=t.createElement("input",{attrs:{type:"text"},styles:"width:100%",id:e.target.id+"_right"});v.appendChild(y),v.appendChild(b),u.appendChild(g),u.appendChild(v),r.appendChild(o),r.appendChild(u),i.appendChild(r),e.target.appendChild(i),e.topMarginBox=new a.NumericTextBox({value:0,min:0,max:1584,width:175,decimals:2,enablePersistence:!1}),e.topMarginBox.appendTo(d),e.leftMarginBox=new a.NumericTextBox({value:0,min:0,max:1584,width:175,decimals:2,enablePersistence:!1}),e.leftMarginBox.appendTo(p),e.bottomMarginBox=new a.NumericTextBox({value:0,min:0,max:1584,width:175,decimals:2,enablePersistence:!1}),e.bottomMarginBox.appendTo(f),e.rightMarginBox=new a.NumericTextBox({value:0,min:0,max:1584,width:175,decimals:2,enablePersistence:!1}),e.rightMarginBox.appendTo(b)}},e}(),xi=function(){function e(e){var t=this;this.modifyStyles=function(){t.documentHelper.dialog.hide(),t.documentHelper.owner.styleDialogModule.show(t.styleName,t.localValue.getConstant("Modify Style"))},this.selectHandler=function(e){t.styleName=e.text},this.addNewStyles=function(){t.documentHelper.dialog.hide(),t.documentHelper.owner.styleDialogModule.show()},this.documentHelper=e}return e.prototype.getModuleName=function(){return"StylesDialog"},e.prototype.initStylesDialog=function(e,i,n){var s=this.documentHelper.owner.containerId+"_insert_styles";this.target=t.createElement("div",{id:s,className:"e-de-styles"});var a=e.getConstant("Styles"),l=t.createElement("div",{innerHTML:a,className:"e-styles-dlgfields"});this.target.appendChild(l);var d=t.createElement("div",{className:"e-styles-common"});this.target.appendChild(d);var h=t.createElement("div",{className:"e-styles-list"});d.appendChild(h),n&&h.classList.add("e-de-rtl");var c=t.createElement("div",{className:"e-styles-listViewDiv",id:"styles_listview"});h.appendChild(c),this.listviewInstance=new o.ListView({dataSource:i,cssClass:"e-styles-listview"}),this.listviewInstance.appendTo(c),this.listviewInstance.addEventListener("select",this.selectHandler);var p=t.createElement("div",{className:"e-styles-button"});d.appendChild(p);var u=t.createElement("div",{className:"e-styles-addbutton"});p.appendChild(u);var g=t.createElement("button",{innerHTML:e.getConstant("New")+"...",id:"new",attrs:{type:"button"}});u.appendChild(g),new r.Button({cssClass:"e-button-custom"}).appendTo(g),g.addEventListener("click",this.addNewStyles);var m=t.createElement("div",{className:"e-styles-addbutton"});p.appendChild(m);var f=t.createElement("button",{innerHTML:e.getConstant("Modify")+"...",id:"modify",attrs:{type:"button"}});m.appendChild(f),new r.Button({cssClass:"e-button-custom"}).appendTo(f),f.addEventListener("click",this.modifyStyles)},e.prototype.show=function(){var e=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);e.setLocale(this.documentHelper.owner.locale);var i=this.updateStyleNames();this.localValue=e,this.initStylesDialog(e,i,this.documentHelper.owner.enableRtl),this.documentHelper.dialog.content=this.target,this.documentHelper.dialog.beforeOpen=this.documentHelper.updateFocus,this.documentHelper.dialog.close=this.documentHelper.updateFocus,this.documentHelper.dialog.header=e.getConstant("Styles"),this.documentHelper.dialog.height="auto",this.documentHelper.dialog.width="auto",this.documentHelper.dialog.buttons=[{click:this.hideObjects.bind(this),buttonModel:{content:e.getConstant("Cancel"),cssClass:"e-flat e-hyper-insert",isPrimary:!0}}],this.documentHelper.dialog.dataBind(),this.documentHelper.dialog.show()},e.prototype.updateStyleNames=function(){var e=this.documentHelper.owner.documentHelper.styles.getStyleNames("Paragraph"),t=["Normal","Heading 1","Heading 2","Heading 3","Heading 4","Heading 5","Heading 6"],i=this.defaultStyleName(t);return e.concat(i).filter(function(e,t,i){return i.indexOf(e)===t})},e.prototype.defaultStyleName=function(e){for(var t=[],i=0;i<e.length;i++)t.push(e[i]);return t},e.prototype.hideObjects=function(){this.documentHelper.dialog.hide(),this.documentHelper.updateFocus()},e.prototype.destroy=function(){this.listviewInstance&&(this.listviewInstance.destroy(),this.listviewInstance=void 0)},e}(),Fi=function(){function e(e){var i=this;this.selectHandler=function(e){i.selectedText=e.text},this.onCancelButtonClick=function(){i.documentHelper.clearSelectionHighlight(),i.documentHelper.hideDialog()},this.onIgnoreClicked=function(){t.isNullOrUndefined(i.elementBox)||(n.showSpinner(i.documentHelper.dialog.element),i.parent.spellChecker.manageReplace("Ignore Once",i.elementBox),i.removeErrors(),i.parent.spellChecker.checkForNextError(),n.hideSpinner(i.documentHelper.dialog.element))},this.onIgnoreAllClicked=function(){if(!t.isNullOrUndefined(i.elementBox)){n.showSpinner(i.documentHelper.dialog.element);var e=i.elementBox.text;i.parent.spellChecker.handleIgnoreAllItems({element:i.elementBox,text:e}),i.parent.spellChecker.checkForNextError(),n.hideSpinner(i.documentHelper.dialog.element)}},this.addToDictClicked=function(){t.isNullOrUndefined(i.elementBox)||(n.showSpinner(i.documentHelper.dialog.element),i.parent.spellChecker.handleAddToDictionary({element:i.elementBox,text:i.elementBox.text}),i.parent.spellChecker.errorWordCollection.containsKey(i.errorText)&&i.parent.spellChecker.errorWordCollection.remove(i.errorText),i.parent.spellChecker.checkForNextError(),i.documentHelper.hideDialog())},this.changeButtonClicked=function(){t.isNullOrUndefined(i.selectedText)||(i.isSpellChecking=!0,n.showSpinner(i.documentHelper.dialog.element),i.parent.spellChecker.manageReplace(i.selectedText,i.elementBox),i.removeErrors(),i.parent.spellChecker.checkForNextError(),i.documentHelper.dialog.content="",n.hideSpinner(i.documentHelper.dialog.element))},this.changeAllButtonClicked=function(){if(!t.isNullOrUndefined(i.selectedText)){i.isSpellChecking=!0,n.showSpinner(i.documentHelper.dialog.element);for(var e=i.parent.spellChecker.errorWordCollection.get(i.errorText),r=0;r<e.length;r++)if(e[r]instanceof He&&!e[r].ischangeDetected)i.parent.spellChecker.manageReplace(i.selectedText,e[r]);else if(e[r]instanceof Ie){var o=i.parent.spellChecker.getMatchedResultsFromElement(e[r]),s=o.textResults,a=e[r].ischangeDetected?e[r].start.offset:e[r].line.getOffset(e[r],0);i.parent.searchModule.textSearch.updateMatchedTextLocation(o.matches,s,o.elementInfo,0,e[r],!1,null,a);for(var l=0;l<s.length;l++){var d=i.parent.spellChecker.createErrorElementWithInfo(s.innerList[l],e[r]);i.parent.spellChecker.manageReplace(i.selectedText,d)}}i.parent.spellChecker.errorWordCollection.containsKey(i.errorText)&&i.parent.spellChecker.errorWordCollection.remove(i.errorText),i.parent.spellChecker.checkForNextError(),i.documentHelper.dialog.content="",n.hideSpinner(i.documentHelper.dialog.element)}},this.documentHelper=e,n.createSpinner({target:this.documentHelper.dialog.element,cssClass:"e-spin-overlay"})}return Object.defineProperty(e.prototype,"parent",{get:function(){return this.documentHelper.owner},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"SpellCheckDialog"},e.prototype.removeErrors=function(){if(!t.isNullOrUndefined(this.errorText)&&this.parent.spellChecker.errorWordCollection.containsKey(this.errorText)){var e=this.parent.spellChecker.errorWordCollection.get(this.errorText);e.splice(0,1),0===e.length&&this.parent.spellChecker.errorWordCollection.remove(this.errorText)}0===this.parent.spellChecker.errorWordCollection.length&&this.documentHelper.hideDialog()},e.prototype.show=function(e,i){this.target=void 0,this.localValue=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale),this.localValue.setLocale(this.documentHelper.owner.locale),this.target||this.updateSuggestionDialog(e,i)},e.prototype.updateSuggestionDialog=function(e,t){var i=this;this.elementBox=t;var n;this.isSpellChecking?this.parent.spellChecker.callSpellChecker(this.parent.spellChecker.languageID,e,!1,!0).then(function(t){var r=JSON.parse(t);n=r.Suggestions,i.isSpellChecking=!1,i.handleRetrievedSuggestion(e,n)}):(e=this.parent.spellChecker.manageSpecialCharacters(e,void 0,!0),n=this.parent.spellChecker.errorSuggestions.containsKey(e)?this.parent.spellChecker.errorSuggestions.get(e):[],this.handleRetrievedSuggestion(e,n))},e.prototype.handleRetrievedSuggestion=function(e,t){e=this.parent.spellChecker.manageSpecialCharacters(e,void 0,!0),this.initSpellCheckDialog(this.localValue,e,t),"none"!==this.documentHelper.selection.caret.style.display&&(this.documentHelper.selection.caret.style.display="none"),this.documentHelper.dialog.header="Spelling Editor",this.documentHelper.dialog.height="auto",this.documentHelper.dialog.width="auto",this.documentHelper.dialog.content=this.target,this.documentHelper.dialog.beforeOpen=this.documentHelper.updateFocus,this.documentHelper.dialog.buttons=[{click:this.onCancelButtonClick,buttonModel:{content:this.localValue.getConstant("Cancel"),cssClass:"e-control e-flat",isPrimary:!0}}],this.documentHelper.dialog.dataBind(),this.documentHelper.dialog.show(),n.hideSpinner(this.documentHelper.dialog.element)},e.prototype.initSpellCheckDialog=function(e,i,n){var s=this.documentHelper.owner.containerId+"_add_SpellCheck";this.target=t.createElement("div",{id:s,className:"e-de-insert-spellchecker"}),this.errorText=i;var a=t.createElement("div",{className:"e-de-dlg-spellchecker-subheader",innerHTML:e.getConstant("Spelling")});this.target.appendChild(a);var l=t.createElement("div",{className:"e-de-spellcheck-error-container"}),d=t.createElement("div",{className:"e-de-dlg-spellcheck-listview",id:"styles_listview"});l.appendChild(d),this.spellingListView=new o.ListView({dataSource:[i],cssClass:"e-dlg-spellcheck-listitem"}),this.spellingListView.appendTo(d);var h=t.createElement("div",{className:"e-de-spellcheck-btncontainer"});l.appendChild(h);var c=t.createElement("button",{innerHTML:e.getConstant("Ignore"),id:"ignore"});h.appendChild(c),new r.Button({cssClass:"e-de-spellcheck-btn"}).appendTo(c),c.addEventListener("click",this.onIgnoreClicked);var p=t.createElement("button",{innerHTML:e.getConstant("Ignore all"),id:"new"});h.appendChild(p),new r.Button({cssClass:"e-de-spellcheck-btn"}).appendTo(p),p.addEventListener("click",this.onIgnoreAllClicked);var u=t.createElement("button",{innerHTML:e.getConstant("Add to Dictionary"),id:"new"});h.appendChild(u),new r.Button({cssClass:"e-de-spellcheck-btn"}).appendTo(u),u.addEventListener("click",this.addToDictClicked),this.target.appendChild(l);var g=t.createElement("div",{className:"e-de-dlg-spellchecker-subheaderbtm",innerHTML:e.getConstant("Suggestions")});this.target.appendChild(g);var m=t.createElement("div",{className:"e-de-spellcheck-suggestion-container"});this.target.appendChild(m);var f=t.createElement("div",{className:"e-de-dlg-spellcheck-listview"});m.appendChild(f),this.suggestionListView=new o.ListView({dataSource:n,cssClass:"e-dlg-spellcheck-listitem"}),this.suggestionListView.appendTo(f),this.suggestionListView.addEventListener("select",this.selectHandler);var v=t.createElement("div",{className:"e-de-spellcheck-btncontainer"});m.appendChild(v);var y=t.createElement("button",{innerHTML:e.getConstant("Change"),id:"Change"});v.appendChild(y);var b=new r.Button({cssClass:"e-de-spellcheck-btn"});b.appendTo(y),y.addEventListener("click",this.changeButtonClicked);var w=t.createElement("button",{innerHTML:e.getConstant("Change All"),id:"Change All"});v.appendChild(w);var C=new r.Button({cssClass:"e-de-spellcheck-btn"});C.appendTo(w),w.addEventListener("click",this.changeAllButtonClicked),(t.isNullOrUndefined(n)||0===n.length)&&(b.disabled=!0,C.disabled=!0)},e.prototype.destroy=function(){this.target&&(this.target.remove(),this.target=void 0),this.spellingListView&&(this.spellingListView.destroy(),this.spellingListView=void 0),this.suggestionListView&&(this.suggestionListView.destroy(),this.suggestionListView=void 0)},e}(),Pi=function(){function e(e){var t=this;this.changeBidirectional=function(e){"exact"===e.value?(t.autoButton.checked=!t.exactButton.checked,t.exactlyNumber.enabled=!0):(t.exactButton.checked=!t.autoButton.checked,t.exactlyNumber.enabled=!1)},this.changeBidirect=function(e){"check"===e.value?t.notCheckedButton.checked=!t.checkedButton.checked:t.checkedButton.checked=!t.notCheckedButton.checked},this.onCancelButtonClick=function(){t.documentHelper.dialog.hide()},this.insertCheckBoxField=function(){t.closeCheckBoxField();var e=new Te;e.defaultValue=t.checkedButton.checked,e.name=t.bookmarkInputText.value,e.helpText=t.tooltipInputText.value,e.checked=e.defaultValue,e.enabled=t.checBoxEnableElement.checked,t.exactButton.checked?(e.sizeType="Exactly",e.size=t.exactlyNumber.value):(e.sizeType="Auto",e.size=11),t.owner.editor.editFormField("CheckBox",e)},this.closeCheckBoxField=function(){t.documentHelper.dialog.hide(),t.documentHelper.dialog.element.style.pointerEvents=""},this.owner=e}return Object.defineProperty(e.prototype,"documentHelper",{get:function(){return this.owner.documentHelper},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"CheckBoxFormFieldDialog"},e.prototype.initCheckBoxDialog=function(e,i){this.target=t.createElement("div");var n=t.createElement("div"),o=t.createElement("div",{className:"e-de-ff-dlg-heading",innerHTML:e.getConstant("Check box size")}),s=t.createElement("div",{className:"e-de-ff-radio-scnd-div"}),l=t.createElement("div",{className:"e-de-ff-radio-scnd-div"}),d=t.createElement("input",{className:"e-de-rtl-btn-div"}),h=t.createElement("input",{className:"e-de-rtl-btn-div"});this.autoButton=new r.RadioButton({label:e.getConstant("Auto"),cssClass:"e-small",change:this.changeBidirectional,checked:!0,enableRtl:i}),this.exactButton=new r.RadioButton({label:e.getConstant("Exactly"),value:"exact",cssClass:"e-small",change:this.changeBidirectional,enableRtl:i}),this.exactNumberDiv=t.createElement("div",{className:"e-de-ff-chck-exact"});var c=t.createElement("input",{attrs:{type:"text"}});this.exactlyNumber=new a.NumericTextBox({format:"n",value:10,min:1,max:1584,enablePersistence:!1,enabled:!1,cssClass:"e-de-check-exactnumbr-width",enableRtl:i});var p=t.createElement("div",{className:"e-de-ff-dlg-heading",innerHTML:e.getConstant("Default value")}),u=t.createElement("div",{className:"e-de-ff-radio-div"}),g=t.createElement("div",{className:"e-de-ff-radio-div"}),m=t.createElement("input",{className:"e-de-rtl-btn-div"}),f=t.createElement("input",{className:"e-de-rtl-btn-div"});this.notCheckedButton=new r.RadioButton({label:e.getConstant("Not checked"),enableRtl:i,cssClass:"e-small",change:this.changeBidirect}),this.checkedButton=new r.RadioButton({label:e.getConstant("Checked"),value:"check",enableRtl:i,cssClass:"e-small",change:this.changeBidirect,checked:!0});var v=t.createElement("div",{className:"e-de-ff-dlg-heading",innerHTML:e.getConstant("Field settings")}),y=t.createElement("div",{className:"e-de-div-seperate-dlg"}),b=t.createElement("div",{className:"e-de-ff-dlg-lft-hlf"}),w=t.createElement("div",{className:"e-de-ff-dlg-rght-hlf"}),C=t.createElement("div",{className:"e-de-ff-dlg-heading-small",innerHTML:e.getConstant("Tooltip")});this.tooltipInputText=t.createElement("input",{className:"e-input e-bookmark-textbox-input"});var x=t.createElement("div",{className:"e-de-ff-dlg-heading-small",innerHTML:e.getConstant("Name")});this.bookmarkInputText=t.createElement("input",{className:"e-input e-bookmark-textbox-input"});var F=t.createElement("div"),P=t.createElement("input",{attrs:{type:"checkbox"}});this.checBoxEnableElement=new r.CheckBox({cssClass:"e-de-ff-dlg-check",label:e.getConstant("Check box enabled"),enableRtl:i}),i&&(s.classList.add("e-de-rtl"),l.classList.add("e-de-rtl"),this.exactNumberDiv.classList.add("e-de-rtl"),u.classList.add("e-de-rtl"),g.classList.add("e-de-rtl"),b.classList.add("e-de-rtl"),w.classList.add("e-de-rtl")),this.target.appendChild(n),n.appendChild(p),n.appendChild(u),u.appendChild(m),this.notCheckedButton.appendTo(m),n.appendChild(g),g.appendChild(f),this.checkedButton.appendTo(f),n.appendChild(o),n.appendChild(s),s.appendChild(d),this.autoButton.appendTo(d),n.appendChild(l),l.appendChild(h),this.exactButton.appendTo(h),l.appendChild(this.exactNumberDiv),this.exactNumberDiv.appendChild(c),this.exactlyNumber.appendTo(c),n.appendChild(v),n.appendChild(y),y.appendChild(b),y.appendChild(w),b.appendChild(C),b.appendChild(this.tooltipInputText),w.appendChild(x),w.appendChild(this.bookmarkInputText),n.appendChild(F),F.appendChild(P),this.checBoxEnableElement.appendTo(P)},e.prototype.show=function(){var e=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);e.setLocale(this.documentHelper.owner.locale),t.isNullOrUndefined(this.target)&&this.initCheckBoxDialog(e,this.documentHelper.owner.enableRtl),this.loadCheckBoxDialog(),this.documentHelper.dialog.header=e.getConstant("Check Box Form Field"),this.documentHelper.dialog.position={X:"center",Y:"center"},this.documentHelper.dialog.height="auto",this.documentHelper.dialog.width="400px",this.documentHelper.dialog.content=this.target,this.documentHelper.dialog.buttons=[{click:this.insertCheckBoxField,buttonModel:{content:e.getConstant("Ok"),cssClass:"e-flat e-table-cell-margin-okay",isPrimary:!0}},{click:this.onCancelButtonClick,buttonModel:{content:e.getConstant("Cancel"),cssClass:"e-flat e-table-cell-margin-cancel"}}],this.documentHelper.dialog.show()},e.prototype.loadCheckBoxDialog=function(){var e=this.owner.selection.getCurrentFormField();if(e instanceof xe){this.fieldBegin=e;var t=this.fieldBegin.formFieldData;t.defaultValue?(this.checkedButton.checked=!0,this.notCheckedButton.checked=!1):(this.checkedButton.checked=!1,this.notCheckedButton.checked=!0),"Auto"!==t.sizeType?(this.exactButton.checked=!0,this.autoButton.checked=!1,this.exactlyNumber.enabled=!0):(this.autoButton.checked=!0,this.exactButton.checked=!1,this.exactlyNumber.enabled=!1),t.size&&(this.exactlyNumber.value=t.size),t.enabled?this.checBoxEnableElement.checked=!0:this.checBoxEnableElement.checked=!1,t.name&&""!==t.name?this.bookmarkInputText.value=t.name:this.bookmarkInputText.value="",t.helpText&&""!==t.helpText?this.tooltipInputText.value=t.helpText:this.tooltipInputText.value=""}},e.prototype.destroy=function(){var e=this.target;e&&(e.parentElement&&e.parentElement.removeChild(e),this.target=void 0),this.owner=void 0,this.autoButton&&(this.autoButton.destroy(),this.autoButton=void 0),this.exactButton&&(this.exactButton.destroy(),this.exactButton=void 0),this.notCheckedButton&&(this.notCheckedButton.destroy(),this.notCheckedButton=void 0),this.checkedButton&&(this.checkedButton.destroy(),this.checkedButton=void 0),this.bookmarkInputText=void 0,this.tooltipInputText=void 0,this.checBoxEnableElement&&(this.checBoxEnableElement.destroy(),this.checBoxEnableElement=void 0),this.exactlyNumber&&(this.exactlyNumber.destroy(),this.exactlyNumber=void 0),this.exactNumberDiv=void 0},e}(),Ti=function(){function e(e){var i=this;this.updateTextFormtas=function(){var e=i.updateFormats(i.defaultTextInput.value);i.defaultTextInput.value=t.isNullOrUndefined(e)?"":e},this.onCancelButtonClick=function(){i.documentHelper.dialog.hide()},this.insertTextField=function(){var e=!0;if("Date"===i.typeDropDown.value&&(e=i.isValidDateFormat()),e)if(i.updateTextFormtas(),i.defaultTextInput.value.length>i.maxLengthNumber.value&&!t.isNullOrUndefined(i.maxLengthNumber.value)&&0!==i.maxLengthNumber.value)n.DialogUtility.alert({content:"The maximum length value must be equal or greater than the length of the default text.",showCloseIcon:!0,closeOnEscape:!0,position:{X:"center",Y:"center"},animationSettings:{effect:"Zoom"}});else{var r=void 0;r="Date"===i.typeDropDown.value?"Date":"Number"===i.typeDropDown.value?"Number":"Text";var o=i.textFormatDropDown.value,s=new Pe;s.type=r,s.defaultValue=i.defaultTextInput.value,s.maxLength=i.maxLengthNumber.value,s.format=t.isNullOrUndefined(o)?"":o,s.name=i.bookmarkTextInput.value,s.helpText=i.tooltipTextInput.value,s.enabled=i.fillInEnable.checked,i.owner.editor.editFormField("Text",s),i.closeTextField()}else n.DialogUtility.alert({content:"A valid date or time is required",showCloseIcon:!0,closeOnEscape:!0,position:{X:"center",Y:"center"},animationSettings:{effect:"Zoom"}})},this.closeTextField=function(){i.documentHelper.dialog.hide(),i.documentHelper.dialog.element.style.pointerEvents=""},this.owner=e}return Object.defineProperty(e.prototype,"documentHelper",{get:function(){return this.owner.documentHelper},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"TextFormFieldDialog"},e.prototype.initTextDialog=function(e,i){var n=this;this.target=t.createElement("div");var o=t.createElement("div"),l=t.createElement("div",{className:"e-de-div-seperate-dlg"}),d=t.createElement("div",{className:"e-de-ff-dlg-lft-hlf"});this.defaultTextDiv=t.createElement("div",{className:"e-de-ff-dlg-rght-hlf"});var h=t.createElement("div",{className:"e-de-ff-dlg-heading-small",innerHTML:e.getConstant("Type")}),c=t.createElement("input"),p=["Regular text","Number","Date"];this.typeDropDown=new s.DropDownList({dataSource:p,popupHeight:"150px",value:"Regular text",change:this.changeTypeDropDown.bind(this)}),this.defaultTextLabel=t.createElement("div",{className:"e-de-ff-dlg-heading-small",innerHTML:e.getConstant("Default text")}),this.defaultTextInput=t.createElement("input",{className:"e-input e-bookmark-textbox-input",styles:"margin-top:3px"});var u=t.createElement("div",{className:"e-de-div-seperate-dlg"}),g=t.createElement("div",{className:"e-de-ff-dlg-lft-hlf"}),m=t.createElement("div",{className:"e-de-ff-dlg-heading-small",innerHTML:e.getConstant("Maximum length")}),f=t.createElement("input");this.maxLengthNumber=new a.NumericTextBox({format:"n",value:0,min:0,max:32767,width:"100%",enablePersistence:!1,change:function(e){e.value||(this.element.value="Unlimited")},focus:function(e){e.value||(this.element.value="Unlimited")},blur:function(e){if(!e.value){var t=this;setTimeout(function(){t.element.value="Unlimited"},0)}}});var v=t.createElement("div",{className:"e-de-ff-dlg-rght-hlf"});this.textFormatLabel=t.createElement("div",{className:"e-de-ff-dlg-heading-small",innerHTML:e.getConstant("Text format")});var y=t.createElement("input"),b=["Uppercase","Lowercase","FirstCapital","Titlecase"];this.textFormatDropDown=new s.ComboBox({dataSource:b,popupHeight:"150px",allowCustom:!0,showClearButton:!1,change:this.updateTextFormtas.bind(this)}),this.textFormatDropDown.focus=function(){n.textFormatDropDown.element.select()};var w=t.createElement("div",{className:"e-de-ff-dlg-heading",innerHTML:e.getConstant("Field settings")}),C=t.createElement("div",{className:"e-de-div-seperate-dlg"}),x=t.createElement("div",{className:"e-de-ff-dlg-lft-hlf"}),F=t.createElement("div",{className:"e-de-ff-dlg-rght-hlf"}),P=t.createElement("div",{className:"e-de-ff-dlg-heading-small",innerHTML:e.getConstant("Tooltip")});this.tooltipTextInput=t.createElement("input",{className:"e-input e-bookmark-textbox-input"});var T=t.createElement("div",{className:"e-de-ff-dlg-heading-small",innerHTML:e.getConstant("Name")});this.bookmarkTextInput=t.createElement("input",{className:"e-input e-bookmark-textbox-input"});var S=t.createElement("div"),I=t.createElement("input",{attrs:{type:"checkbox"}});this.fillInEnable=new r.CheckBox({cssClass:"e-de-ff-dlg-check",label:e.getConstant("Fillin enabled"),enableRtl:i}),i&&(d.classList.add("e-de-rtl"),g.classList.add("e-de-rtl"),x.classList.add("e-de-rtl"),F.classList.add("e-de-rtl")),this.target.appendChild(o),o.appendChild(l),l.appendChild(d),d.appendChild(h),d.appendChild(c),this.typeDropDown.appendTo(c),l.appendChild(this.defaultTextDiv),this.defaultTextDiv.appendChild(this.defaultTextLabel),this.defaultTextDiv.appendChild(this.defaultTextInput),o.appendChild(u),u.appendChild(g),g.appendChild(m),g.appendChild(f),this.maxLengthNumber.appendTo(f),u.appendChild(v),v.appendChild(this.textFormatLabel),v.appendChild(y),this.textFormatDropDown.appendTo(y),o.appendChild(w),o.appendChild(C),C.appendChild(x),x.appendChild(P),x.appendChild(this.tooltipTextInput),C.appendChild(F),F.appendChild(T),F.appendChild(this.bookmarkTextInput),o.appendChild(S),S.appendChild(I),this.fillInEnable.appendTo(I)},e.prototype.show=function(){this.localObj=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale),this.localObj.setLocale(this.documentHelper.owner.locale),t.isNullOrUndefined(this.target)&&this.initTextDialog(this.localObj,this.documentHelper.owner.enableRtl),this.loadTextDialog(),this.documentHelper.dialog.header=this.localObj.getConstant("Text Form Field"),this.documentHelper.dialog.position={X:"center",Y:"center"},this.documentHelper.dialog.height="auto",this.documentHelper.dialog.width="448px",this.documentHelper.dialog.content=this.target,this.documentHelper.dialog.buttons=[{click:this.insertTextField,buttonModel:{content:this.localObj.getConstant("Ok"),cssClass:"e-flat e-table-cell-margin-okay",isPrimary:!0}},{click:this.onCancelButtonClick,buttonModel:{content:this.localObj.getConstant("Cancel"),cssClass:"e-flat e-table-cell-margin-cancel"}}],this.documentHelper.dialog.show()},e.prototype.changeTypeDropDown=function(e){e.isInteracted&&(this.defaultTextInput.value="",this.textFormatDropDown.value=""),"Regular text"===e.value?(this.defaultTextLabel.innerHTML=this.localObj.getConstant("Default text"),this.textFormatLabel.innerHTML=this.localObj.getConstant("Text format"),this.textFormatDropDown.dataSource=["Uppercase","Lowercase","FirstCapital","Titlecase"]):"Number"===e.value?(this.defaultTextLabel.innerHTML=this.localObj.getConstant("Default number"),this.textFormatLabel.innerHTML=this.localObj.getConstant("Number format"),this.textFormatDropDown.dataSource=["0","0.00","#,##0","#,##0.00","$#,##0.00;($#,##0.00)","0%"]):"Date"===e.value&&(this.defaultTextLabel.innerHTML=this.localObj.getConstant("Default date"),this.textFormatLabel.innerHTML=this.localObj.getConstant("Date format"),this.textFormatDropDown.dataSource=["M/d/yyyy","dddd, MMMM d, yyyy","MMMM d, yyyy","M/d/yy","yyyy-MM-dd","d-MMM-yy","M.d.yyyy","MMM. d, yy","d MMMM yyyy","MMMM yy","MMM-yy","M/d/yyyy h:mm am/pm","M/d/yyyy h:mm:ss am/pm","h:mm am/pm","h:mm:ss am/pm","HH:mm","HH:mm:ss"])},e.prototype.loadTextDialog=function(){var e=this.owner.selection.getCurrentFormField();if(e instanceof xe){this.fieldBegin=e;var i=e.formFieldData;i.maxLength>0?this.maxLengthNumber.value=i.maxLength:(this.maxLengthNumber.value=0,this.maxLengthNumber.element.value="Unlimited"),"Date"===i.type?this.typeDropDown.value="Date":"Number"===i.type?this.typeDropDown.value="Number":this.typeDropDown.value="Regular text",i.format?this.textFormatDropDown.value=i.format:this.textFormatDropDown.value="",this.defaultTextInput.value=t.isNullOrUndefined(i.defaultValue)?"":i.defaultValue,this.fillInEnable.checked=i.enabled,this.tooltipTextInput.value=t.isNullOrUndefined(i.helpText)?"":i.helpText,this.bookmarkTextInput.value=t.isNullOrUndefined(i.name)?"":i.name}},e.prototype.updateFormats=function(e){var i=t.isNullOrUndefined(this.textFormatDropDown.value)?"":this.textFormatDropDown.value.toString();if("Regular text"===this.typeDropDown.value)return W.formatText(i,e);if("Number"===this.typeDropDown.value){var n=W.formatNumber(i,e);return"NaN"!==n.toString()?n:""}return"Date"===this.typeDropDown.value?W.formatDate(i,e):""},e.prototype.isValidDateFormat=function(){var e=this.defaultTextInput.value;if(""!==e){var t=new Date(e);if(isNaN(t.getDate()))return!1}return!0},e.prototype.destroy=function(){var e=this.target;e&&(e.parentElement&&e.parentElement.removeChild(e),this.target=void 0),this.maxLengthNumber&&(this.maxLengthNumber.destroy(),this.maxLengthNumber=void 0),this.fillInEnable&&(this.fillInEnable.destroy(),this.fillInEnable=void 0),this.typeDropDown&&(this.typeDropDown.destroy(),this.typeDropDown=void 0),this.textFormatDropDown&&(this.textFormatDropDown.destroy(),this.textFormatDropDown=void 0),this.owner=void 0,this.defaultTextInput=void 0,this.tooltipTextInput=void 0,this.bookmarkTextInput=void 0,this.defaultTextLabel=void 0,this.defaultTextDiv=void 0,this.textFormatLabel=void 0},e}(),Si=function(){function e(e){var t=this;this.addItemtoList=function(){t.dropDownItems.push(t.drpDownItemsInput.value),t.currentSelectedItem=t.drpDownItemsInput.value,t.drpDownItemsInput.value="",t.enableOrDisableButton(),t.updateList()},this.removeItemFromList=function(){for(var e=0;e<t.dropDownItems.length;e++)t.dropDownItems[e]===t.currentSelectedItem&&t.dropDownItems.splice(e,1);t.updateList()},this.selectHandler=function(e){t.currentSelectedItem=e.text},this.moveUpItem=function(){var e=t.getSelectedIndex();t.moveUp(e,e-1),t.updateList()},this.moveDownItem=function(){var e=t.getSelectedIndex();t.moveDown(e,e+1),t.updateList()},this.onKeyUpOnTextBox=function(){t.enableOrDisableButton()},this.onCancelButtonClick=function(){t.documentHelper.dialog.hide()},this.insertDropDownField=function(){var e=new Se;e.dropdownItems=t.dropDownItems,e.selectedIndex=0,e.name=t.bookmarkInput.value,e.helpText=t.tooltipInput.value,e.enabled=t.dropDownEnable.checked,t.owner.editor.editFormField("DropDown",e),t.closeDropDownField()},this.closeDropDownField=function(){t.documentHelper.dialog.hide(),t.documentHelper.dialog.element.style.pointerEvents=""},this.owner=e}return Object.defineProperty(e.prototype,"documentHelper",{get:function(){return this.owner.documentHelper},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"DropDownFormFieldDialog"},e.prototype.initTextDialog=function(e,i){this.target=t.createElement("div");var n=t.createElement("div"),s=t.createElement("div",{className:"e-de-drp-dwn-frst-div"}),a=t.createElement("div",{className:"e-de-ff-dlg-heading-small",innerHTML:e.getConstant("Drop-down items")});this.drpDownItemsInput=t.createElement("input",{className:"e-input e-bookmark-textbox-input",id:"fielditems_text_box"}),this.drpDownItemsInput.addEventListener("keyup",this.onKeyUpOnTextBox);var l=t.createElement("div",{className:"e-de-ff-drpdwn-dlg-scndiv"}),d=t.createElement("div",{className:"e-de-ff-dlg-drpdwn-heading",innerHTML:e.getConstant("Items in drop-down list")}),h=t.createElement("div",{className:"e-bookmark-listViewDiv e-de-ff-drpdwn-listview",attrs:{style:"height:100%"}});this.listviewInstance=new o.ListView({cssClass:"e-bookmark-listview",select:this.selectHandler});var c=t.createElement("div"),p=t.createElement("div",{className:"e-bookmark-addbutton"}),u=t.createElement("button",{innerHTML:e.getConstant("ADD"),attrs:{type:"button",style:"height:36px;width:100%"}});this.addButton=new r.Button({cssClass:"e-button-custom"}),this.addButton.disabled=!0,u.addEventListener("click",this.addItemtoList.bind(this));var g=t.createElement("div",{className:"e-bookmark-addbutton"});g.style.display="none";var m=t.createElement("button",{innerHTML:"EDIT",attrs:{type:"button",style:"height:36px;width:100%"}});this.editButton=new r.Button({cssClass:"e-button-custom"});var f=t.createElement("div",{className:"e-bookmark-addbutton"}),v=t.createElement("button",{innerHTML:e.getConstant("REMOVE"),attrs:{type:"button",style:"height:36px;width:100%"}});this.removeButton=new r.Button({cssClass:"e-button-custom"}),v.addEventListener("click",this.removeItemFromList.bind(this));var y=t.createElement("div",{attrs:{style:"display:inline-flex"}}),b=t.createElement("div",{className:"e-bookmark-addbutton"}),w=t.createElement("button",{attrs:{type:"button",style:"height:36px;width:36px"},className:"e-de-ff-drpdwn-mvup"});this.moveUpButton=new r.Button({cssClass:"e-button-custom",iconCss:"e-de-arrow-up"}),w.addEventListener("click",this.moveUpItem.bind(this));var C=t.createElement("div",{className:"e-bookmark-addbutton"}),x=t.createElement("button",{attrs:{type:"button",style:"height:36px;width:36px"}});this.moveDownButton=new r.Button({cssClass:"e-button-custom",iconCss:"e-de-arrow-down"}),x.addEventListener("click",this.moveDownItem.bind(this));var F=t.createElement("div",{className:"e-de-ff-dlg-heading",innerHTML:e.getConstant("Field settings")}),P=t.createElement("div",{className:"e-de-div-seperate-dlg"}),T=t.createElement("div",{className:"e-de-ff-dlg-lft-hlf"}),S=t.createElement("div",{className:"e-de-ff-dlg-rght-hlf"}),I=t.createElement("div",{className:"e-de-ff-dlg-heading-small",innerHTML:e.getConstant("Tooltip")});this.tooltipInput=t.createElement("input",{className:"e-input e-bookmark-textbox-input"});var N=t.createElement("div",{className:"e-de-ff-dlg-heading-small",innerHTML:e.getConstant("Name")});this.bookmarkInput=t.createElement("input",{className:"e-input e-bookmark-textbox-input"});var E=t.createElement("div"),H=t.createElement("input",{attrs:{type:"checkbox"}});this.dropDownEnable=new r.CheckBox({cssClass:"e-de-ff-dlg-check",label:e.getConstant("Dropdown enabled"),enableRtl:i}),i&&(h.classList.add("e-de-rtl"),w.classList.add("e-de-rtl"),T.classList.add("e-de-rtl"),S.classList.add("e-de-rtl")),this.target.appendChild(n),n.appendChild(s),s.appendChild(a),s.appendChild(this.drpDownItemsInput),n.appendChild(d),n.appendChild(l),l.appendChild(h),this.listviewInstance.appendTo(h),l.appendChild(c),c.appendChild(p),p.appendChild(u),this.addButton.appendTo(u),c.appendChild(g),g.appendChild(m),this.editButton.appendTo(m),c.appendChild(f),f.appendChild(v),this.removeButton.appendTo(v),c.appendChild(y),y.appendChild(b),b.appendChild(w),this.moveUpButton.appendTo(w),y.appendChild(C),C.appendChild(x),this.moveDownButton.appendTo(x),n.appendChild(F),n.appendChild(P),P.appendChild(T),T.appendChild(I),T.appendChild(this.tooltipInput),P.appendChild(S),S.appendChild(N),S.appendChild(this.bookmarkInput),n.appendChild(E),E.appendChild(H),this.dropDownEnable.appendTo(H)},e.prototype.show=function(){var e=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);e.setLocale(this.documentHelper.owner.locale),t.isNullOrUndefined(this.target)&&this.initTextDialog(e,this.documentHelper.owner.enableRtl),this.loadDropDownDialog(),this.documentHelper.dialog.header=e.getConstant("Drop Down Form Field"),this.documentHelper.dialog.position={X:"center",Y:"center"},this.documentHelper.dialog.height="auto",this.documentHelper.dialog.width="448px",this.documentHelper.dialog.content=this.target,this.documentHelper.dialog.buttons=[{click:this.insertDropDownField,buttonModel:{content:e.getConstant("Ok"),cssClass:"e-flat e-table-cell-margin-okay",isPrimary:!0}},{click:this.onCancelButtonClick,buttonModel:{content:e.getConstant("Cancel"),cssClass:"e-flat e-table-cell-margin-cancel"}}],this.documentHelper.dialog.show()},e.prototype.loadDropDownDialog=function(){var e=this.owner.selection.getCurrentFormField();if(e instanceof xe){if(this.fieldBegin=e,this.dropDownInstance=e.formFieldData,this.dropDownInstance.dropdownItems.length>0){var t=this.dropDownInstance.selectedIndex;this.currentSelectedItem=this.dropDownInstance.dropdownItems[t]}this.dropDownInstance.enabled?this.dropDownEnable.checked=!0:this.dropDownEnable.disabled=!1,""!==this.dropDownInstance.helpText?this.tooltipInput.value=this.dropDownInstance.helpText:this.tooltipInput.value="",""!==this.dropDownInstance.name?this.bookmarkInput.value=this.dropDownInstance.name:this.bookmarkInput.value="",this.dropDownItems=this.dropDownInstance.dropdownItems.slice(),this.updateList()}},e.prototype.updateList=function(){if(this.listviewInstance.dataSource=this.dropDownItems.slice(),this.listviewInstance.dataBind(),this.currentSelectedItem){var e=this.currentSelectedItem;this.listviewInstance.selectItem(e)}},e.prototype.getSelectedIndex=function(){for(var e=0;e<this.dropDownItems.length;e++)if(this.dropDownItems[e]===this.currentSelectedItem)return e;return 0},e.prototype.moveUp=function(e,t){var i=[];if(0===e){for(var n=0;n<this.dropDownItems.length;n++)n<this.dropDownItems.length-1?i[n]=this.dropDownItems[n+1]:i[n]=this.dropDownItems[0];this.dropDownItems=i}else{var r=this.dropDownItems[e];this.dropDownItems[e]=this.dropDownItems[t],this.dropDownItems[t]=r}},e.prototype.moveDown=function(e,t){var i=[];if(e===this.dropDownItems.length-1){for(var n=0;n<this.dropDownItems.length;n++)i[n]=0!==n?this.dropDownItems[n-1]:this.dropDownItems[this.dropDownItems.length-1];this.dropDownItems=i}else{var r=this.dropDownItems[e];this.dropDownItems[e]=this.dropDownItems[t],this.dropDownItems[t]=r}},e.prototype.enableOrDisableButton=function(){t.isNullOrUndefined(this.addButton)||(this.addButton.disabled=""===this.drpDownItemsInput.value)},e.prototype.destroy=function(){var e=this.target;e&&(e.parentElement&&e.parentElement.removeChild(e),this.target=void 0),this.owner=void 0,this.drpDownItemsInput=void 0,this.listviewInstance&&(this.listviewInstance.destroy(),this.listviewInstance=void 0),this.addButton&&(this.addButton.destroy(),this.addButton=void 0),this.editButton&&(this.editButton.destroy(),this.editButton=void 0),this.removeButton&&(this.removeButton.destroy(),this.removeButton=void 0),this.moveUpButton&&(this.moveUpButton.destroy(),this.moveUpButton=void 0),this.moveDownButton&&(this.moveDownButton.destroy(),this.moveDownButton=void 0),this.tooltipInput=void 0,this.bookmarkInput=void 0,this.dropDownEnable&&(this.dropDownEnable.destroy(),this.dropDownEnable=void 0),this.dropDownInstance=void 0},e}(),Ii=function(){function e(e){this.langIDInternal=0,this.enableSpellCheckInternal=!0,this.uniqueSpelledWords={},this.spellSuggestionInternal=!0,this.uniqueKey="",this.removeUnderlineInternal=!1,this.uniqueWordsCountInternal=1e4,this.performOptimizedCheck=!1,this.documentHelper=e,this.errorWordCollection=new g,this.errorSuggestions=new g,this.ignoreAllItems=[],this.uniqueSpelledWords={},this.textSearchResults=new Rt(this.documentHelper.owner),this.uniqueKey=this.documentHelper.owner.element.id+"_"+this.createGuid()}return e.prototype.getModuleName=function(){return"SpellChecker"},Object.defineProperty(e.prototype,"enableOptimizedSpellCheck",{get:function(){return this.performOptimizedCheck},set:function(e){this.performOptimizedCheck=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"uniqueWordsCount",{get:function(){return t.isNullOrUndefined(this.uniqueWordsCountInternal)?0:this.uniqueWordsCountInternal},set:function(e){this.uniqueWordsCountInternal=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"languageID",{get:function(){return t.isNullOrUndefined(this.langIDInternal)?0:this.langIDInternal},set:function(e){this.langIDInternal=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"allowSpellCheckAndSuggestion",{get:function(){return this.spellSuggestionInternal},set:function(e){this.spellSuggestionInternal=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"removeUnderline",{get:function(){return this.removeUnderlineInternal},set:function(e){this.removeUnderlineInternal=e,this.documentHelper.owner.editor.reLayout(this.documentHelper.selection)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableSpellCheck",{get:function(){return this.enableSpellCheckInternal},set:function(e){this.enableSpellCheckInternal=e,this.documentHelper.owner.editor.reLayout(this.documentHelper.selection)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"viewer",{get:function(){return this.documentHelper.owner.viewer},enumerable:!0,configurable:!0}),e.prototype.manageReplace=function(e,i){this.documentHelper.triggerSpellCheck=!0;if(!t.isNullOrUndefined(i)&&i instanceof He){var n=i.text;if(this.documentHelper.selection.start=i.start,this.documentHelper.selection.end=i.end,"Ignore Once"!==e)return e=this.manageSpecialCharacters(n,e),this.documentHelper.owner.editor.insertTextInternal(e,!0),this.documentHelper.selection.start.setPositionInternal(this.documentHelper.selection.end),void this.documentHelper.clearSelectionHighlight();this.currentContextInfo={text:n,element:i}}if(!t.isNullOrUndefined(this.currentContextInfo)&&this.currentContextInfo.element&&"Ignore Once"!==e){var r=this.currentContextInfo.element;this.currentContextInfo.element.text,this.documentHelper.selection.start=r.start,this.documentHelper.selection.end=r.end}else this.handleReplace(e);"Ignore Once"!==e&&(this.documentHelper.owner.editor.insertTextInternal(e,!0),t.isNullOrUndefined(this.currentContextInfo)||this.removeErrorsFromCollection(this.currentContextInfo),this.documentHelper.selection.start.setPositionInternal(this.documentHelper.selection.end),this.documentHelper.clearSelectionHighlight()),this.documentHelper.triggerSpellCheck=!1},e.prototype.handleReplace=function(e){var i=this.documentHelper.selection.start,n=i.offset,r=i.currentWidget.getInline(n,0,!1,!0);r.element.line.getOffset(r.element,0)+r.element.length===n&&this.retrieveExactElementInfo(r);for(var o,s=r.element.text,a=new RegExp("^[#\\@\\!\\~\\$\\%\\^\\&\\*\\(\\)\\-\\_\\+\\=\\{\\}\\[\\]\\:\\;\\\"'\\,\\<\\.\\>\\/\\?\\`\\s]+","g"),l=[];!t.isNullOrUndefined(o=a.exec(s));)l.push(o);if("Ignore Once"===e)return void this.handleIgnoreOnce(r);i.offset=n-r.index,!t.isNullOrUndefined(l)&&l.length>0&&(i.offset+=l[0].toString().length),i.location=this.documentHelper.owner.selection.getPhysicalPositionInternal(i.currentWidget,i.offset,!0),(i=this.documentHelper.owner.searchModule.textSearch.getTextPosition(i.currentWidget,i.offset.toString())).setPositionParagraph(i.currentWidget,i.offset);var d=i.offset+r.element.length-i.offset,h=i.currentWidget.getOffset(r.element,d),c=i.currentWidget,p=new RegExp("[#\\@\\!\\~\\$\\%\\^\\&\\*\\(\\)\\-\\_\\+\\=\\{\\}\\[\\]\\:\\;\\\"'\\,\\<\\.\\>\\/\\?\\s\\`]+$","g");for(l=[];!t.isNullOrUndefined(o=p.exec(s));)l.push(o);!t.isNullOrUndefined(l)&&l.length>0&&(h-=l[0].toString().length),this.documentHelper.selection.end=this.documentHelper.owner.searchModule.textSearch.getTextPosition(c,h.toString()),this.documentHelper.selection.end.location=this.documentHelper.owner.selection.getPhysicalPositionInternal(i.currentWidget,h,!0),this.documentHelper.selection.end.setPositionParagraph(c,h),this.currentContextInfo={element:r.element,text:r.element.text}},e.prototype.retrieveExactElementInfo=function(e){var i=e.element.nextElement;e.element=!t.isNullOrUndefined(i)&&i instanceof Ie?e.element.nextElement:e.element},e.prototype.handleIgnoreOnce=function(e){var i=e.element,n="";n=!t.isNullOrUndefined(this.currentContextInfo)&&this.currentContextInfo.element?this.currentContextInfo.element.text:i.text,n=this.manageSpecialCharacters(n,void 0,!0),-1===i.ignoreOnceItems.indexOf(n)&&i.ignoreOnceItems.push(n),this.documentHelper.owner.editor.reLayout(this.documentHelper.selection)},e.prototype.handleIgnoreAllItems=function(e){var i=t.isNullOrUndefined(e)?this.retriveText():e,n=this.manageSpecialCharacters(i.text,void 0,!0);-1===this.ignoreAllItems.indexOf(n)&&(this.ignoreAllItems.push(n),this.removeErrorsFromCollection(i),this.documentHelper.triggerSpellCheck=!0,this.documentHelper.owner.editor.reLayout(this.documentHelper.selection),this.documentHelper.triggerSpellCheck=!1,this.documentHelper.clearSelectionHighlight())},e.prototype.handleAddToDictionary=function(e){var i=this,n=t.isNullOrUndefined(e)?this.retriveText():e,r=this.manageSpecialCharacters(n.text,void 0,!0);this.callSpellChecker(this.languageID,r,!1,!1,!0).then(function(e){i.documentHelper.triggerSpellCheck=!0,i.removeErrorsFromCollection(n),i.ignoreAllItems.push(r),i.documentHelper.owner.editor.reLayout(i.documentHelper.selection,!0),i.documentHelper.triggerSpellCheck=!1})},e.prototype.manageSpecialCharacters=function(e,i,n){if(!t.isNullOrUndefined(e)){t.isNullOrUndefined(i)&&(i=e);for(var r=new RegExp("^[#\\@\\!\\~\\$\\%\\^\\&\\*\\(\\)\\-\\_\\+\\=\\{\\}\\[\\]\\:\\;\\\"\\”'\\,\\<\\.\\>\\/\\?\\`\\s]+","g"),o=[],s=void 0;!t.isNullOrUndefined(s=r.exec(e));)o.push(s);if(o.length>0)for(l=0;l<o.length;l++){d=o[l];i=n?i.replace(d[0],""):d[0]+i}var a=new RegExp("[#\\@\\!\\~\\$\\%\\^\\&\\*\\(\\)\\-\\_\\+\\=\\{\\}\\[\\]\\:\\;\\\"\\”'\\,\\<\\.\\>\\/\\?\\s\\`]+$","g");for(o=[];!t.isNullOrUndefined(s=a.exec(i));)o.push(s);if(o.length>0)for(var l=0;l<o.length;l++){var d=o[l];i=n?i.slice(0,d.index):i+d[0]}}return i},e.prototype.removeErrorsFromCollection=function(e){if(this.errorWordCollection.containsKey(e.text)){var t=this.errorWordCollection.get(e.text);t.indexOf(e.element)>=0&&t.splice(0,1),0===t.length&&this.errorWordCollection.remove(e.text)}},e.prototype.retriveText=function(){var e,i;if(!t.isNullOrUndefined(this.currentContextInfo)&&this.currentContextInfo.element)i=this.currentContextInfo.element,e=this.currentContextInfo.element.text,this.documentHelper.selection.start=i.start,this.documentHelper.selection.end=i.end;else{var n=this.documentHelper.selection.start,r=n.offset,o=n.currentWidget.getInline(r,0);i=o.element,e=o.element.text}return{text:e,element:i}},e.prototype.handleSuggestions=function(e){this.spellCheckSuggestion=[],0===e.length?this.spellCheckSuggestion.push("Add To Dictionary"):(e=5===e.length?this.constructInlineMenu(e):e,this.spellCheckSuggestion.push("Add To Dictionary"));var t=[];if(this.spellCheckSuggestion.length>0)for(var i=0,n=this.spellCheckSuggestion;i<n.length;i++){var r=n[i];t.push({text:r,id:this.documentHelper.owner.element.id+"_contextmenu_otherSuggestions_spellcheck_"+r,iconCss:""})}return t},e.prototype.checktextElementHasErrors=function(e,i,n){var r=!1,o=[];if(e=e.replace(/[\s]+/g,""),!t.isNullOrUndefined(i.errorCollection)&&i.errorCollection.length>0){if(!this.documentHelper.isScrollHandler&&(i.ischangeDetected||i.paragraph.isChangeDetected))return this.updateStatusForGlobalErrors(i.errorCollection,i),i.errorCollection=[],i.ischangeDetected=!0,{errorFound:r,elements:o};for(var s=0;s<i.errorCollection.length;s++)this.handleErrorCollection(i.errorCollection[s])&&(r=!0,o.push(i.errorCollection[s]))}else!this.documentHelper.isScrollHandler&&i.paragraph.isChangeDetected?i.ischangeDetected=!0:!i.ischangeDetected&&this.handleErrorCollection(i)&&(r=!0,o.push(i));return{errorFound:r,elements:o}},e.prototype.updateStatusForGlobalErrors=function(e,t){if(e.length>0)for(var i=0;i<e.length;i++){var n=this.manageSpecialCharacters(e[i].text,void 0,!0);if(this.errorWordCollection.containsKey(n))for(var r=this.errorWordCollection.get(n),o=0;o<r.length;o++)if(r[o]instanceof He&&r[o]===e[i]){r[o].ischangeDetected=!0,r[o].start.offset=t.line.getOffset(t.istextCombined?this.getCombinedElement(t):t,0),r[o].line=t.line;break}}},e.prototype.handleErrorCollection=function(e){var t=this.errorWordCollection,i=this.manageSpecialCharacters(e.text,void 0,!0);return!!(t.containsKey(i)&&e.length>1)&&(!(this.ignoreAllItems.indexOf(i)>-1)||(t.containsKey(i)&&t.remove(i),!1))},e.prototype.constructInlineMenu=function(e){for(var t=e.length-1;t>0;t--)e.length>3&&(this.spellCheckSuggestion.push(e[t]),e.pop());return e},e.prototype.findCurretText=function(){var e,i,n=this.documentHelper.selection.start,r=n.currentWidget.getInline(this.documentHelper.selection.start.offset,0);if(!t.isNullOrUndefined(r.element)){if(!t.isNullOrUndefined(r.element.errorCollection)&&r.element.errorCollection.length>0)for(var o=0;o<r.element.errorCollection.length;o++){var s=r.element.errorCollection[o];if(s.start.location.x<=n.location.x&&s.end.location.x>=n.location.x){i=s.text,e=s;break}}else i=r.element.text;" "===i&&(i=(r=n.currentWidget.getInline(this.documentHelper.selection.start.offset+1,0)).element.text)}return{text:i,element:e}},e.prototype.addErrorCollection=function(e,i,n){if(e=this.manageSpecialCharacters(e,void 0,!0),this.errorWordCollection.containsKey(e)){var r=this.errorWordCollection.get(e);i instanceof He?this.compareErrorTextElement(i,r)||r.push(i):i instanceof Ie&&(this.compareTextElement(i,r)||r.push(i))}else!t.isNullOrUndefined(n)&&n.length>0&&this.errorSuggestions.add(e,n),this.errorWordCollection.add(e,[i])},e.prototype.compareErrorTextElement=function(e,t){for(var i=[],n=!1,r=0;r<t.length;r++)i.push(t[r]);for(var o=t.length,r=0;r<o;r++)if(i[r]instanceof He)if(i[r].ischangeDetected){var s=this.manageSpecialCharacters(i[r].text,void 0,!0);n=!0,this.removeErrorsFromCollection({element:i[r],text:s})}else{var a=i[r];if(e.start.offset===a.start.offset&&e.end.offset===a.end.offset)return!0}return n&&this.errorWordCollection.add(this.manageSpecialCharacters(e.text,void 0,!0),[e]),!1},e.prototype.compareTextElement=function(e,t){for(var i=0;i<t.length;i++)if(t[i]instanceof Ie&&t[i]===e)return!0;return!1},e.prototype.handleWordByWordSpellCheck=function(e,t,i,n,r,o,s){if(e.HasSpellingError&&s){this.addErrorCollection(t.text,t,e.Suggestions);var a=t.line.paragraph.containerWidget instanceof be?t.line.paragraph.containerWidget.cellFormat.shading.backgroundColor:this.documentHelper.backgroundColor;this.documentHelper.render.renderWavyLine(t,i,n,r,"#FF0000","Single",o,a),t.isSpellChecked=!0}else t.isSpellChecked=!0},e.prototype.checkElementCanBeCombined=function(e,i,n,r,o,s,a,l){var d=t.isNullOrUndefined(o)?"":o,h=!t.isNullOrUndefined(l)&&l,c=!!t.isNullOrUndefined(a)||a,p=!!t.isNullOrUndefined(s)||s,u=[],g=this.documentHelper.selection.getLineWidget(e,0),m=g.children.indexOf(e),f=e.text;u.push(e);var v=a?0:1,y=!1,b=!1;if("\v"!==e.text){if(c){for(var w=void 0,C=m-v;C>=0;C--)if((w=g.children[C])instanceof Ie&&!b){if(0!==f.indexOf(" ")&&w.text.lastIndexOf(" ")!==w.text.length-1)y=!t.isNullOrUndefined(o),d=w.text+d,f=w.text,b=!1,u.push(w),h=!0;else if(!t.isNullOrUndefined(w)){w=w.nextElement;break}}else w instanceof xe&&1!==w.fieldType&&(b=!0);var x=h?w:e;if(this.lookThroughPreviousLine(d,f,x,i,n))return!0}a?d=y?d:e.text+d:d+=e.text,b=!1;var F=e.text;if(p){for(var P=!1,T=void 0,C=m+1;C<g.children.length;C++)if((T=g.children[C])instanceof Ie&&!b){if(F.lastIndexOf(" ")!==F.length-1&&0!==T.text.indexOf(" "))d+=T.text,F=T.text,b=!1,u.push(T),P=!0,h=!0;else if(!t.isNullOrUndefined(T)){T=T.previousElement;break}}else T instanceof xe&&2!==T.fieldType&&(b=!0);if("\f"!==(x=P?T:e).text&&this.lookThroughNextLine(d,f,x,i,n))return!0}}return h&&r&&!this.checkCombinedElementsBeIgnored(u,d)&&this.handleCombinedElements(e,d,i,n),h},e.prototype.lookThroughPreviousLine=function(e,i,n,r,o){if(!t.isNullOrUndefined(n)&&0===n.indexInOwner&&!t.isNullOrUndefined(n.line.previousLine)){var s=n.line.previousLine,a=s.children.length-1;if(!t.isNullOrUndefined(s.children[a])&&s.children[a]instanceof Ie){var l=s.children[a];if(!t.isNullOrUndefined(n.text)&&0!==n.text.indexOf(" ")&&l.text.lastIndexOf(" ")!==l.text.length-1)return e=e.length>0?e:i,this.checkElementCanBeCombined(l,r,o,!0,e,!1,!0,!0),!0}}return!1},e.prototype.lookThroughNextLine=function(e,i,n,r,o){if(!t.isNullOrUndefined(n)&&n.indexInOwner===n.line.children.length-1&&!t.isNullOrUndefined(n.line.nextLine)){var s=n.line.nextLine;if(!t.isNullOrUndefined(s.children[0])&&s.children[0]instanceof Ie){var a=s.children[0];if(n.text.lastIndexOf(" ")!==n.text.length-1&&0!==a.text.indexOf(" "))return e=e.length>0?e:i,this.checkElementCanBeCombined(a,r,o,!0,e,!0,!1,!0),!0}}return!1},e.prototype.handleCombinedElements=function(e,t,i,n){e.istextCombined=!0;var r=t.split(/[\s]+/);if(-1===this.ignoreAllItems.indexOf(t)&&e instanceof Ie&&-1===e.ignoreOnceItems.indexOf(t))if(r.length>1)for(var o=0;o<r.length;o++){var s=r[o];s=this.manageSpecialCharacters(s,void 0,!0),this.documentHelper.render.handleUnorderedElements(s,e,i,o,0,o===r.length-1,n)}else t=this.manageSpecialCharacters(t,void 0,!0),this.documentHelper.render.handleUnorderedElements(t,e,i,0,0,!0,n)},e.prototype.checkArrayHasSameElement=function(e,t){for(var i=0;i<e.length;i++){var n=e[i];if(n.start.location.x===t.start.location.x&&n.start.location.y===t.start.location.y)return!0}return!1},e.prototype.handleSplitWordSpellCheck=function(e,t,i,n,r,o,s,a){if(e.HasSpellingError&&" "!==i.text&&n){var l=this.getMatchedResultsFromElement(i,t);s=i.istextCombined?i.line.getOffset(this.getCombinedElement(i),0):s,this.documentHelper.owner.searchModule.textSearch.updateMatchedTextLocation(l.matches,l.textResults,l.elementInfo,0,i,!1,null,s),this.handleMatchedResults(l.textResults,i,r,o,e.Suggestions,a)}else a&&(i.isSpellChecked=!0);this.updateUniqueWords([{Text:t,HasSpellError:e.HasSpellingError}])},e.prototype.handleMatchedResults=function(e,i,n,r,o,s){if(0===e.length&&s)return void(i.isSpellChecked=!0);for(var a=0;a<e.length;a++){var l=this.createErrorElementWithInfo(e.innerList[a],i);t.isNullOrUndefined(i.errorCollection)||this.checkArrayHasSameElement(i.errorCollection,l)||i.errorCollection.splice(r,0,l),this.addErrorCollection(l.text,l,o);var d=i.line.paragraph.containerWidget instanceof be?i.paragraph.containerWidget.cellFormat.shading.backgroundColor:this.documentHelper.backgroundColor;this.documentHelper.render.renderWavyLine(l,l.start.location.x,l.start.location.y-i.margin.top,n,"#FF0000","Single",i.characterFormat.baselineAlignment,d),s&&(i.isSpellChecked=!0)}},e.prototype.callSpellChecker=function(e,i,n,r,o,s){var a=this,l=this;return new Promise(function(d,h){if(!t.isNullOrUndefined(a)){var c=new XMLHttpRequest,p=a.documentHelper.owner.serviceUrl+a.documentHelper.owner.serverActionSettings.spellCheck;p=s?p+"ByPage":p,c.open("POST",p,!0),c.setRequestHeader("Content-Type","application/json"),a.setCustomHeaders(c);var u={LanguageID:e,TexttoCheck:i,CheckSpelling:n,CheckSuggestion:r,AddWord:o};c.send(JSON.stringify(u)),c.onreadystatechange=function(){if(4===c.readyState)if(200===c.status||304===c.status)d(c.response);else{var e={name:"onFailure",status:c.status,statusText:c.responseText,url:p};l.documentHelper.owner.fireServiceFailure(e),h(c.response)}}}})},e.prototype.setCustomHeaders=function(e){for(var t=0;t<this.documentHelper.owner.headers.length;t++)for(var i=this.documentHelper.owner.headers[t],n=0,r=Object.keys(i);n<r.length;n++){var o=r[n];e.setRequestHeader(o,i[o])}},e.prototype.checkForNextError=function(){if(!t.isNullOrUndefined(this.viewer)){var e=this.errorWordCollection;if(e.length>0)for(var i=0;i<e.length;i++){for(var n=e.get(e.keys[i]),r=0;r<n.length;r++){if(n[r]instanceof He&&!n[r].ischangeDetected)this.updateErrorElementTextBox(e.keys[i],n[r]);else if(n[r]instanceof Ie){var o=this.getMatchedResultsFromElement(n[r]),s=o.textResults,a=n[r].ischangeDetected?n[r].start.offset:n[r].line.getOffset(n[r],0);this.documentHelper.owner.searchModule.textSearch.updateMatchedTextLocation(o.matches,s,o.elementInfo,0,n[r],!1,null,a);for(var l=0;l<s.length;l++){var d=this.createErrorElementWithInfo(s.innerList[l],n[r]);this.updateErrorElementTextBox(d.text,d);break}}break}break}else this.documentHelper.clearSelectionHighlight()}},e.prototype.createErrorElementWithInfo=function(e,t){var i=new He;return i.text=e.text,i.start=e.start,i.end=e.end,i.height=t.height,i.canTrigger=t.canTrigger,i.characterFormat.copyFormat(t.characterFormat),i.width=this.documentHelper.textHelper.getWidth(i.text,t.characterFormat),i},e.prototype.getMatchedResultsFromElement=function(e,i){var n=e.line,r=this.documentHelper.owner.searchModule.textSearch.stringToRegex(t.isNullOrUndefined(i)?e.text:i,"CaseSensitive");this.textSearchResults.clearResults();for(var o,s=this.textSearchResults,a=this.documentHelper.owner.searchModule.textSearch.getElementInfo(n.children[0],0,!1),l=a.fullText,d=[],h=a.elementsWithOffset;!t.isNullOrUndefined(o=r.exec(l));)d.push(o);return{matches:d,elementInfo:h,textResults:s}},e.prototype.updateErrorElementTextBox=function(e,t){var i=t;this.documentHelper.clearSelectionHighlight(),this.documentHelper.selection.start=i.start,this.documentHelper.selection.end=i.end,this.documentHelper.selection.highlight(t.start.paragraph,t.start,t.end),this.documentHelper.owner.spellCheckDialog.updateSuggestionDialog(e,i)},e.prototype.getWhiteSpaceCharacterInfo=function(e,i){var n=[],r=0,o=0;if(n=e.match(/[\s]+/),!t.isNullOrUndefined(n)&&n.length>0)for(var s=0;s<n.length;s++)r+=this.documentHelper.textHelper.getWidth(n[s],i),o+=n[s].length;return{width:r,wordLength:o,isBeginning:!t.isNullOrUndefined(n)&&0===n.index}},e.prototype.getSpecialCharactersInfo=function(e,i){var n=[],r=0,o=0,s=0;n=e.match(/^[\#\@\!\~\$\%\^\&\*\(\)\-\_\+\=\{\}\[\]\:\;\"\'\,\<\.\>\/\?\`]*/);for(a=0;a<n.length;a++)!t.isNullOrUndefined(n[a])&&n[a].length>0&&(r=this.documentHelper.textHelper.getWidth(n[a],i)),s=n.length;n=e.match(/[\#\@\!\~\$\%\^\&\*\(\)\-\_\+\=\{\}\[\]\:\;\"\'\,\<\.\>\/\?\`]*$/);for(var a=0;a<n.length;a++)!t.isNullOrUndefined(n[a])&&n[a].length>0&&(o=this.documentHelper.textHelper.getWidth(n[a],i)),s=n.length;return{beginningWidth:r,endWidth:o,wordLength:s}},e.prototype.getCombinedElement=function(e){for(var i=e;!t.isNullOrUndefined(e)&&e instanceof Ie&&e.istextCombined;)i=e,e=e.previousElement;return i},e.prototype.checkCombinedElementsBeIgnored=function(e,t){t=this.manageSpecialCharacters(t,void 0,!0);for(var i=0;i<e.length;i++)if(-1!==e[i].ignoreOnceItems.indexOf(t))return!0;return!1},e.prototype.updateSplittedElementError=function(e,t){var i=e.errorCollection.length;if(i>0){for(var n=[],r=0;r<i;r++)n.push(e.errorCollection[r]);for(r=0;r<i;r++)-1===e.text.indexOf(n[r].text)&&(t.ischangeDetected=!0,e.errorCollection.splice(0,1))}},e.prototype.getPageContent=function(e){var t="";if(this.documentHelper.owner.sfdtExportModule){var i=this.documentHelper.owner.sfdtExportModule;i.Initialize();var n=i.writePage(e);if(this.documentHelper.owner.textExportModule){var r=this.documentHelper.owner.textExportModule;r.pageContent="",r.setDocument(n),r.writeInternal(),t=r.pageContent}}return t},e.prototype.updateUniqueWords=function(e){if(t.isNullOrUndefined(localStorage.getItem(this.uniqueKey))||(this.uniqueSpelledWords=JSON.parse(localStorage.getItem(this.uniqueKey))),this.uniqueSpelledWords=this.uniqueSpelledWords||{},e.length+Object.keys(this.uniqueSpelledWords).length<=this.uniqueWordsCount)for(var i=0;i<e.length;i++)this.checkForUniqueWords(e[i]);localStorage.setItem(this.uniqueKey,JSON.stringify(this.uniqueSpelledWords)),this.uniqueSpelledWords={}},e.prototype.checkForUniqueWords=function(e){this.uniqueSpelledWords[e.Text]||(this.uniqueSpelledWords[e.Text]=e.HasSpellError)},e.prototype.clearCache=function(){t.isNullOrUndefined(localStorage.getItem(this.uniqueKey))||localStorage.removeItem(this.uniqueKey)},e.prototype.createGuid=function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var i=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?i:3&i|8).toString(16)})},e.prototype.checkSpellingInPageInfo=function(e){var i=JSON.parse(localStorage.getItem(this.uniqueKey));return t.isNullOrUndefined(i)||t.isNullOrUndefined(i[e])?{hasSpellError:!1,isElementPresent:!1}:{hasSpellError:i[e],isElementPresent:!0}},e.prototype.destroy=function(){this.errorWordCollection=void 0,this.ignoreAllItems=void 0,this.errorSuggestions=void 0,this.uniqueSpelledWords={},this.textSearchResults=void 0,t.isNullOrUndefined(localStorage.getItem(this.uniqueKey))||localStorage.removeItem(this.uniqueKey)},e}(),Ni=function(){function e(e){var i=this;this.isNewComment=!1,this.selectedTab=0,this.onTabSelection=function(e){i.selectedTab=e.selectedIndex,1===i.selectedTab?i.owner.trackChangesPane.updateHeight():i.commentPane.updateHeight(),i.owner.resize()},this.owner=e;var n=new t.L10n("documenteditor",this.owner.defaultLocale);n.setLocale(this.owner.locale),this.initReviewPane(n),this.parentPaneElement.style.display="none"}return Object.defineProperty(e.prototype,"previousSelectedComment",{get:function(){return this.previousSelectedCommentInt},set:function(e){if(!t.isNullOrUndefined(e)&&e!==this.previousSelectedCommentInt&&this.commentPane.comments.containsKey(e)){var i=this.commentPane.getCommentStart(e).commentMark;i&&(t.classList(i,[],["e-de-cmt-mark-selected"]),this.commentPane.removeSelectionMark("e-de-cmt-selection"),this.commentPane.removeSelectionMark("e-de-cmt-mark-selected"));var n=this.commentPane.comments.get(e);n.hideDrawer();for(var r=0;r<e.replyComments.length;r++)(n=this.commentPane.comments.get(e.replyComments[r]))&&(n.hideDrawer(),n.hideMenuItems())}this.previousSelectedCommentInt=e},enumerable:!0,configurable:!0}),e.prototype.showHidePane=function(e,t){this.parentPaneElement&&(this.updateTabHeaderWidth(),this.parentPaneElement.style.display=e?"block":"none","Changes"===t?this.reviewTab.select(1):this.reviewTab.select(0)),this.owner.trackChangesPane.updateTrackChanges(e),e&&this.commentPane.updateHeight(),this.owner&&this.owner.resize()},e.prototype.updateTabHeaderWidth=function(){var e=this.reviewTab.getRootElement().getElementsByClassName("e-tab-wrap");e[0].style.padding="0 8px",e[1].style.padding="0 8px"},e.prototype.initReviewPane=function(e){var t=this.owner.documentHelper.optionsPaneContainer;t.style.display="inline-flex",this.initPaneHeader(e),t.appendChild(this.addReviewTab(e)),this.initCommentPane()},e.prototype.addReviewTab=function(e){var n=t.createElement("div",{innerHTML:e.getConstant("Comments")}),r=t.createElement("div",{innerHTML:e.getConstant("Changes")});this.parentPaneElement=t.createElement("div",{styles:"height:100%;overflow:auto;display:none",className:"e-de-review-pane"}),this.element=t.createElement("div",{className:"e-de-property-tab"});var o=[{header:{text:n},content:this.reviewPane},{header:{text:r}}];this.reviewTab=new i.Tab({items:o,selected:this.onTabSelection,animation:{previous:{effect:"None"},next:{effect:"None"}}}),this.reviewTab.appendTo(this.element),this.owner.enableRtl&&(this.reviewTab.enableRtl=!0),this.reviewTab.enablePersistence=!0,this.parentPaneElement.appendChild(this.element),this.closeButton=t.createElement("button",{className:"e-de-close-icon e-btn e-flat e-icon-btn",id:"close",attrs:{type:"button",style:"position:absolute;top:6px;right:1px"}}),this.closeButton.title=e.getConstant("Close");var s=t.createElement("span",{className:"e-de-op-close-icon e-de-close-icon e-btn-icon e-icons"});return this.closeButton.appendChild(s),this.element.appendChild(this.closeButton),this.closeButton.addEventListener("click",this.closePane.bind(this)),this.parentPaneElement},e.prototype.initPaneHeader=function(e){return this.headerContainer=t.createElement("div"),this.reviewPane=t.createElement("div",{className:"e-de-cmt-pane"}),this.owner.enableRtl&&t.classList(this.reviewPane,["e-rtl"],[]),this.headerContainer.appendChild(this.initToolbar(e)),this.reviewPane.appendChild(this.headerContainer),this.reviewPane.style.display="block",this.reviewPane},e.prototype.closePane=function(){if(this.commentPane&&this.commentPane.isEditMode)if(!t.isNullOrUndefined(this.commentPane.currentEditingComment)&&this.commentPane.isInsertingReply&&""===this.commentPane.currentEditingComment.replyViewTextBox.value)this.owner.documentHelper.currentSelectedComment=void 0,this.commentPane.currentEditingComment.cancelReply(),this.owner.showComments=!1;else if(this.isNewComment||!t.isNullOrUndefined(this.commentPane.currentEditingComment)&&this.commentPane.isInsertingReply&&""!==this.commentPane.currentEditingComment.replyViewTextBox.value||!t.isNullOrUndefined(this.commentPane.currentEditingComment)&&!this.commentPane.isInsertingReply&&this.commentPane.currentEditingComment.textArea.value!==this.commentPane.currentEditingComment.comment.text){var e=new t.L10n("documenteditor",this.owner.defaultLocale);e.setLocale(this.owner.locale),this.confirmDialog=n.DialogUtility.confirm({title:e.getConstant("Un-posted comments"),content:e.getConstant("Discard Comment"),okButton:{text:"Discard",click:this.discardButtonClick.bind(this)},cancelButton:{text:"Cancel",click:this.closeDialogUtils.bind(this)},showCloseIcon:!0,closeOnEscape:!0,animationSettings:{effect:"Zoom"},position:{X:"Center",Y:"Center"}})}else this.owner.documentHelper.currentSelectedComment=void 0,this.commentPane.currentEditingComment.cancelEditing(),this.owner.showComments=!1;else this.owner.documentHelper.currentSelectedComment=void 0,this.owner.showComments=!1,this.owner.showRevisions=!1,this.owner.documentHelper.currentSelectedRevision=void 0},e.prototype.discardButtonClick=function(){if(this.commentPane.currentEditingComment){var e=this.isNewComment;this.commentPane.currentEditingComment&&this.commentPane.isInsertingReply?this.commentPane.currentEditingComment.cancelReply():(this.commentPane.currentEditingComment.cancelEditing(),e&&this.discardComment(this.commentPane.currentEditingComment.comment)),this.owner.documentHelper.currentSelectedComment=void 0,this.closeDialogUtils(),this.owner.showComments=!1}},e.prototype.closeDialogUtils=function(){this.confirmDialog.close(),this.confirmDialog=void 0},e.prototype.initToolbar=function(e){return this.toolbarElement=t.createElement("div"),this.toolbar=new i.Toolbar({items:[{prefixIcon:"e-de-new-cmt e-de-cmt-tbr",tooltipText:e.getConstant("New Comment"),text:e.getConstant("New Comment"),click:this.insertComment.bind(this)},{prefixIcon:"e-de-nav-left-arrow e-de-cmt-tbr",align:"Right",tooltipText:e.getConstant("Previous Comment"),click:this.navigatePreviousComment.bind(this)},{prefixIcon:"e-de-nav-right-arrow e-de-cmt-tbr",align:"Right",tooltipText:e.getConstant("Next Comment"),click:this.navigateNextComment.bind(this)}],enableRtl:this.owner.enableRtl}),this.toolbar.appendTo(this.toolbarElement),this.toolbarElement},e.prototype.insertComment=function(){this.owner&&this.owner.editorModule&&this.owner.editorModule.insertComment("")},e.prototype.addComment=function(e,t,i){this.isNewComment=t,this.owner.documentHelper.currentSelectedComment=e,this.commentPane.insertComment(e),t||(this.commentPane.comments.get(e).cancelEditing(),this.enableDisableToolbarItem()),i&&this.selectComment(e)},e.prototype.deleteComment=function(e){this.commentPane&&this.commentPane.deleteComment(e)},e.prototype.selectComment=function(e){this.commentPane.isEditMode||(e.isReply&&(e=e.ownerComment),this.owner&&this.owner.viewer&&this.owner.documentHelper.currentSelectedComment!==e&&(this.owner.documentHelper.currentSelectedComment=e),this.commentPane.selectComment(e))},e.prototype.resolveComment=function(e){this.commentPane.resolveComment(e)},e.prototype.reopenComment=function(e){this.commentPane.reopenComment(e)},e.prototype.addReply=function(e,t,i){this.isNewComment=t,this.commentPane.insertReply(e),t||(this.commentPane.comments.get(e).cancelEditing(),this.enableDisableToolbarItem()),i&&this.selectComment(e.ownerComment)},e.prototype.navigatePreviousComment=function(){this.owner&&this.owner.editorModule&&this.owner.selection.navigatePreviousComment()},e.prototype.navigateNextComment=function(){this.owner&&this.owner.editorModule&&this.owner.selection.navigateNextComment()},e.prototype.enableDisableToolbarItem=function(){if(this.toolbar){var e=!0;this.commentPane.isEditMode&&(e=!this.commentPane.isEditMode);var t=this.toolbar.element.querySelectorAll(".e-de-cmt-tbr");this.toolbar.enableItems(t[0].parentElement.parentElement,e),e&&this.owner&&this.owner.viewer&&(e=!(0===this.owner.documentHelper.comments.length)),this.toolbar.enableItems(t[1].parentElement.parentElement,e),this.toolbar.enableItems(t[2].parentElement.parentElement,e)}},e.prototype.initCommentPane=function(){this.commentPane=new Ei(this.owner,this),this.commentPane.initCommentPane()},e.prototype.layoutComments=function(){for(var e=0;e<this.owner.documentHelper.comments.length;e++)this.commentPane.addComment(this.owner.documentHelper.comments[e])},e.prototype.clear=function(){this.previousSelectedCommentInt=void 0,this.commentPane.clear()},e.prototype.discardComment=function(e){e&&(this.owner.editorHistory?(this.owner.editorHistory.undo(),this.owner.editorHistory.redoStack.pop()):this.owner.editor&&this.owner.editor.deleteCommentInternal(e))},e.prototype.destroy=function(){this.commentPane&&this.commentPane.destroy(),this.commentPane=void 0,this.closeButton&&this.closeButton.parentElement&&this.closeButton.parentElement.removeChild(this.closeButton),this.closeButton=void 0,this.toolbar&&this.toolbar.destroy(),this.toolbar=void 0,this.toolbarElement&&this.toolbarElement.parentElement&&this.toolbarElement.parentElement.removeChild(this.toolbarElement),this.toolbarElement=void 0,this.headerContainer&&this.headerContainer.parentElement&&this.headerContainer.parentElement.removeChild(this.headerContainer),this.headerContainer=void 0,this.previousSelectedCommentInt=void 0,this.reviewPane&&this.reviewPane.parentElement&&this.reviewPane.parentElement.removeChild(this.reviewPane),this.reviewPane.innerHTML="",this.reviewPane=void 0,this.owner=void 0},e}(),Ei=function(){function e(e,t){this.isEditModeInternal=!1,this.isInsertingReply=!1,this.owner=e,this.parentPane=t,this.parent=t.reviewPane,this.comments=new g}return Object.defineProperty(e.prototype,"isEditMode",{get:function(){return this.isEditModeInternal},set:function(e){this.isEditModeInternal=e;for(var t=this.comments.keys,i=0;i<t.length;i++){var n=this.comments.get(t[i]);e?n.menuBar.style.display="none":n.comment.isReply||(n.menuBar.style.display="block")}this.parentPane&&this.parentPane.enableDisableToolbarItem(),this.owner&&(this.isEditModeInternal?this.owner.trigger("commentBegin"):this.owner.trigger("commentEnd"))},enumerable:!0,configurable:!0}),e.prototype.initCommentPane=function(){this.commentPane=t.createElement("div",{className:"e-de-cmt-container"});var e=new t.L10n("documenteditor",this.owner.defaultLocale);e.setLocale(this.owner.locale),this.noCommentIndicator=t.createElement("div",{className:"e-de-cmt-no-cmt",innerHTML:e.getConstant("No comments in this document")}),this.commentPane.appendChild(this.noCommentIndicator),this.parent.appendChild(this.commentPane)},e.prototype.addComment=function(e){var t=new Hi(this.owner,this,e),i=t.layoutComment(!1);this.comments.add(e,t),this.commentPane.appendChild(i);for(var n=0;n<e.replyComments.length;n++){var r=new Hi(this.owner,this,e.replyComments[n]);this.comments.add(e.replyComments[n],r),i.insertBefore(r.layoutComment(!0),t.replyViewContainer)}this.updateCommentStatus(),t.hideDrawer()},e.prototype.updateHeight=function(){var e=this.parentPane.reviewTab.getRootElement().getElementsByClassName("e-tab-header")[0].getBoundingClientRect().height;this.commentPane.style.height=this.parentPane.parentPaneElement.clientHeight-this.parentPane.headerContainer.clientHeight-e+"px"},e.prototype.insertReply=function(e){var t=e.ownerComment,i=this.comments.get(t),n=new Hi(this.owner,this,e);this.comments.add(e,n);var r=n.layoutComment(!0),o=t.replyComments.indexOf(e);if(o===t.replyComments.length-1)i.parentElement.insertBefore(r,i.replyViewContainer);else{var s=t.replyComments[o+1];i.parentElement.insertBefore(r,this.comments.get(s).parentElement)}n.editComment()},e.prototype.insertComment=function(e){var t=new Hi(this.owner,this,e),i=t.layoutComment(!1);if(this.comments.add(e,t),this.owner.documentHelper.comments.indexOf(e)===this.owner.documentHelper.comments.length-1)this.commentPane.appendChild(i);else{var n=this.owner.documentHelper.comments.indexOf(e),r=this.comments.get(this.owner.documentHelper.comments[n+1]).parentElement;this.commentPane.insertBefore(i,r),i.focus()}this.updateCommentStatus(),t.editComment()},e.prototype.removeSelectionMark=function(e){if(this.parent)for(var i=this.parent.getElementsByClassName(e),n=0;n<i.length;n++)t.classList(i[n],[],[e])},e.prototype.selectComment=function(e){if(this.removeSelectionMark("e-de-cmt-selection"),e.isReply&&(e=e.ownerComment),e){var i=this.comments.get(e),n=i.parentElement;n&&(t.classList(n,["e-de-cmt-selection"],[]),n.focus());var r=this.getCommentStart(e);r.commentMark||r.renderCommentMark(),t.classList(r.commentMark,["e-de-cmt-mark-selected"],[]),i.showDrawer()}},e.prototype.getCommentStart=function(e){var i=new t.L10n("documenteditor",this.owner.defaultLocale);i.setLocale(this.owner.locale);var n=void 0;return e&&e.commentStart&&(n=e.commentStart),void 0!==n.commentMark&&(n.commentMark.title=i.getConstant("Click to see this comment")),this.getFirstCommentInLine(n)},e.prototype.getFirstCommentInLine=function(e){for(var t=0;t<e.line.children.length;t++){var i=e.line.children[t];if(i instanceof pt&&0===i.commentType)return i}return e},e.prototype.deleteComment=function(e){var t=this.comments.get(e);t.parentElement&&t.parentElement.parentElement&&t.parentElement.parentElement.removeChild(t.parentElement),this.comments.remove(e),t.destroy(),this.updateCommentStatus()},e.prototype.resolveComment=function(e){var t=this.comments.get(e);t&&t.resolveComment()},e.prototype.reopenComment=function(e){var t=this.comments.get(e);t&&t.reopenComment()},e.prototype.updateCommentStatus=function(){0===this.owner.documentHelper.comments.length?(this.noCommentIndicator.parentElement||this.commentPane.appendChild(this.noCommentIndicator),this.noCommentIndicator.style.display="block"):this.noCommentIndicator.style.display="none",this.parentPane&&this.parentPane.enableDisableToolbarItem()},e.prototype.clear=function(){this.isEditMode=!1,this.currentEditingComment=void 0,this.isInsertingReply=!1,this.removeChildElements(),this.commentPane.innerHTML="",this.updateCommentStatus()},e.prototype.removeChildElements=function(){for(var e=this.comments.keys,t=0;t<e.length;t++)this.comments.get(e[t]).destroy();this.comments.clear()},e.prototype.destroy=function(){this.removeChildElements(),this.noCommentIndicator&&this.noCommentIndicator&&this.noCommentIndicator.parentElement.removeChild(this.noCommentIndicator),this.noCommentIndicator=void 0,this.commentPane&&this.commentPane.parentElement&&this.commentPane.parentElement.removeChild(this.commentPane),this.commentPane.innerHTML="",this.parentPane=void 0,this.owner=void 0},e}(),Hi=function(){function e(e,t,i){this.isReply=!1,this.isDrawerExpand=!1,this.owner=e,this.comment=i,this.commentPane=t}return e.prototype.layoutComment=function(e){this.isReply=e;var i="e-de-cmt-sub-container";e&&(i+=" e-de-cmt-reply");var n=new t.L10n("documenteditor",this.owner.defaultLocale);return n.setLocale(this.owner.locale),this.parentElement=t.createElement("div",{className:i}),this.initCommentHeader(n),this.initCommentView(n),this.initDateView(),this.comment.isReply?this.menuBar.style.display="none":(this.parentElement.tabIndex=0,this.initReplyView(n),this.initResolveOption(n),this.initDrawer(),this.comment.isResolved&&this.resolveComment()),this.commentView.addEventListener("mouseenter",this.showMenuItems.bind(this)),this.commentView.addEventListener("mouseleave",this.hideMenuItemOnMouseLeave.bind(this)),this.parentElement},e.prototype.initCommentHeader=function(e){var i=t.createElement("div",{className:"e-de-cmt-view"}),n=t.createElement("div",{className:"e-de-cmt-author"}),r=t.createElement("div",{className:"e-de-cmt-author-name"});r.textContent=this.comment.author,t.isNullOrUndefined(this.comment.author)||(n.style.display="flex",this.owner.documentHelper.getAvatar(n,r,this.comment,void 0)),this.menuBar=t.createElement("button",{className:"e-de-cp-option",attrs:{type:"button"}});var o=[{text:e.getConstant("Edit")},{text:e.getConstant("Delete")},{text:e.getConstant("Reply")},{text:e.getConstant("Resolve")}],s=new d.DropDownButton({items:this.isReply?o.splice(0,2):o,select:this.userOptionSelectEvent.bind(this),iconCss:"e-de-menu-icon",cssClass:"e-caret-hide",enableRtl:this.owner.enableRtl});this.menuBar.title=e.getConstant("More Options")+"...",s.appendTo(this.menuBar),n.appendChild(this.menuBar),this.dropDownButton=s,i.appendChild(n),this.commentView=i,this.parentElement.appendChild(i),i.addEventListener("click",this.selectComment.bind(this))},e.prototype.selectComment=function(){if(this.commentPane)if(this.commentPane.isEditMode){if(this.commentPane.isEditMode&&this.commentPane.isInsertingReply&&this.commentPane.currentEditingComment&&""===this.commentPane.currentEditingComment.replyViewTextBox.value){var e=this.comment;if(e&&e.isReply&&(e=this.comment.ownerComment),e&&this.owner.documentHelper.currentSelectedComment===e)return;this.commentPane.currentEditingComment.cancelReply(),this.owner.selection.selectComment(this.comment)}}else this.owner.selection.selectComment(this.comment)},e.prototype.initCommentView=function(e){this.commentText=t.createElement("div",{className:"e-de-cmt-readonly"}),this.commentText.innerText=this.comment.text,this.commentView.appendChild(this.commentText),this.initEditView(e)},e.prototype.initEditView=function(e){this.textAreaContainer=t.createElement("div",{styles:"display:none"}),this.textArea=t.createElement("textarea",{className:"e-de-cmt-textarea e-input"}),this.textArea.placeholder=e.getConstant("Type your comment here"),this.textArea.rows=1,this.textArea.value=this.comment.text.trim(),this.textArea.addEventListener("keydown",this.updateTextAreaHeight.bind(this)),this.textArea.addEventListener("keyup",this.enableDisablePostButton.bind(this));var i=t.createElement("div",{className:"e-de-cmt-action-button"}),n=t.createElement("button",{className:"e-de-cmt-post-btn e-btn e-flat",attrs:{type:"button"}});this.postButton=new r.Button({cssClass:"e-btn e-flat e-primary e-de-overlay",iconCss:"e-de-cmt-post",disabled:!0},n),n.addEventListener("click",this.postComment.bind(this)),n.title=e.getConstant("Post");var o=t.createElement("button",{className:"e-de-cmt-cancel-btn e-btn e-flat",attrs:{type:"button"}});this.cancelButton=new r.Button({cssClass:"e-btn e-flat",iconCss:"e-de-cmt-cancel"},o),o.title=e.getConstant("Cancel"),o.addEventListener("click",this.cancelEditing.bind(this)),i.appendChild(n),i.appendChild(o),this.textAreaContainer.appendChild(this.textArea),this.textAreaContainer.appendChild(i),this.commentView.appendChild(this.textAreaContainer)},e.prototype.initDateView=function(){this.commentDate=t.createElement("div",{className:"e-de-cmt-date"}),this.commentDate.innerText=W.getModifiedDate(this.comment.date),this.commentView.appendChild(this.commentDate)},e.prototype.initDrawer=function(){this.drawerElement=t.createElement("div",{styles:"display:none;",className:"e-de-cmt-drawer-cnt"});var e=t.createElement("div",{className:"e-de-cmt-drawer"}),i=t.createElement("span");e.appendChild(i),this.drawerElement.appendChild(e),this.drawerSpanElement=i,this.drawerAction=e,this.drawerAction.addEventListener("click",this.showOrHideDrawer.bind(this)),this.parentElement.appendChild(this.drawerElement)},e.prototype.initReplyView=function(e){this.replyViewContainer=t.createElement("div",{className:"e-de-cmt-rply-view"}),this.commentPane.parentPane.isNewComment&&(this.replyViewContainer.style.display="none"),this.replyViewTextBox=t.createElement("textarea",{className:"e-de-cmt-textarea e-input"}),this.replyViewTextBox.placeholder=e.getConstant("Reply"),this.replyViewTextBox.rows=1,this.replyViewTextBox.value="",this.replyViewTextBox.readOnly=!0,this.replyViewTextBox.addEventListener("click",this.enableReplyView.bind(this)),this.replyViewTextBox.addEventListener("keydown",this.updateReplyTextAreaHeight.bind(this)),this.replyViewTextBox.addEventListener("keyup",this.enableDisableReplyPostButton.bind(this));var i=t.createElement("div",{styles:"display:none",className:"e-de-cmt-action-button"}),n=t.createElement("button",{className:"e-de-cmt-post-btn e-de-overlay e-btn e-flat",attrs:{type:"button"}});this.replyPostButton=new r.Button({cssClass:"e-btn e-flat e-primary",iconCss:"e-de-cmt-post",disabled:!0},n),n.addEventListener("click",this.postReply.bind(this)),n.title=e.getConstant("Post");var o=t.createElement("button",{className:"e-de-cmt-cancel-btn e-btn e-flat",attrs:{type:"button"}});this.replyCancelButton=new r.Button({cssClass:"e-btn e-flat",iconCss:"e-de-cmt-cancel"},o),o.addEventListener("click",this.cancelReply.bind(this)),o.title=e.getConstant("Cancel"),i.appendChild(n),i.appendChild(o),this.replyFooter=i,this.replyViewContainer.appendChild(this.replyViewTextBox),this.replyViewContainer.appendChild(i),this.parentElement.appendChild(this.replyViewContainer)},e.prototype.initResolveOption=function(e){var i=t.createElement("div",{className:"e-de-cmt-resolve-btn"}),n=t.createElement("button",{className:"e-de-cmt-post-btn e-btn e-flat",attrs:{type:"button"}});this.reopenButton=new r.Button({cssClass:"e-btn e-flat",iconCss:"e-de-cmt-reopen"},n),n.title=e.getConstant("Reopen"),n.addEventListener("click",this.reopenButtonClick.bind(this));var o=t.createElement("button",{className:"e-de-cmt-cancel-btn e-btn e-flat",attrs:{type:"button"}});o.title=e.getConstant("Delete"),this.deleteButton=new r.Button({cssClass:"e-btn e-flat",iconCss:"e-de-cmt-delete"},o),o.addEventListener("click",this.deleteComment.bind(this)),i.appendChild(n),i.appendChild(o),this.parentElement.appendChild(i)},e.prototype.reopenButtonClick=function(){this.owner.editor.reopenComment(this.comment)},e.prototype.deleteComment=function(){var e={author:this.comment.author,cancel:!1};this.owner.trigger("commentDelete",e);var t={author:this.comment.author,cancel:e.cancel,type:"Delete"};this.owner.trigger("beforeCommentAction",t),t.cancel||(this.owner.editorModule.deleteCommentInternal(this.comment),this.owner.trigger("commentDelete",e),e.cancel||this.owner.editorModule.deleteCommentInternal(this.comment))},e.prototype.updateReplyTextAreaHeight=function(){var e=this;setTimeout(function(){e.replyViewTextBox.style.height="auto";var t=e.replyViewTextBox.scrollHeight;e.replyViewTextBox.style.height=t+"px"})},e.prototype.enableDisableReplyPostButton=function(){this.replyPostButton.disabled=""===this.replyViewTextBox.value,this.replyPostButton.disabled?t.classList(this.replyPostButton.element,["e-de-overlay"],[]):this.replyPostButton.element.classList.contains("e-de-overlay")&&t.classList(this.replyPostButton.element,[],["e-de-overlay"])},e.prototype.enableReplyView=function(){var e=this,t={author:this.comment.author,cancel:!1,type:"Reply"};this.owner.trigger("beforeCommentAction",t),t.cancel&&"Reply"===t.type||this.commentPane.isEditMode||(this.commentPane.currentEditingComment=this,this.commentPane.isInsertingReply=!0,this.owner.documentHelper.currentSelectedComment!==this.comment&&this.owner.selection.selectComment(this.comment),this.commentPane.isEditMode=!0,this.replyViewTextBox.readOnly=!1,this.replyFooter.style.display="block",setTimeout(function(){e.replyViewTextBox.focus()}))},e.prototype.postReply=function(){var e=this.replyViewTextBox.value;this.cancelReply(),this.updateReplyTextAreaHeight(),this.owner.editorModule.replyComment(this.comment,e),this.owner.fireContentChange()},e.prototype.cancelReply=function(){this.commentPane.currentEditingComment=void 0,this.commentPane.isInsertingReply=!0,this.commentPane.isEditMode=!1,this.replyPostButton.disabled=!0,this.replyViewTextBox.value="",this.replyViewTextBox.readOnly=!0,this.replyFooter.style.display="none"},e.prototype.updateTextAreaHeight=function(){var e=this;setTimeout(function(){if(!t.isNullOrUndefined(e.textArea)){e.textArea.style.height="auto";var i=e.textArea.scrollHeight;e.textArea.style.height=i+"px"}})},e.prototype.showMenuItems=function(){this.comment.isReply&&(this.commentPane.isEditMode||t.isNullOrUndefined(this.comment)||this.comment.isResolved||(this.menuBar.style.display="block"));var e=this.commentPane.getCommentStart(this.comment);t.isNullOrUndefined(e)||t.isNullOrUndefined(e.commentMark)||e.commentMark.classList.add("e-de-cmt-mark-hover")},e.prototype.hideMenuItemOnMouseLeave=function(){if(this.comment.isReply&&this.owner.documentHelper.currentSelectedComment!==this.comment.ownerComment&&this.hideMenuItems(),this.commentPane){var e=this.commentPane.getCommentStart(this.comment);t.isNullOrUndefined(e)||t.isNullOrUndefined(e.commentMark)||e.commentMark.classList.remove("e-de-cmt-mark-hover")}},e.prototype.hideMenuItems=function(){this.menuBar.style.display="none"},e.prototype.enableDisablePostButton=function(){this.postButton.disabled=""===this.textArea.value,this.postButton.disabled?t.classList(this.postButton.element,["e-de-overlay"],[]):this.postButton.element.classList.contains("e-de-overlay")&&t.classList(this.postButton.element,[],["e-de-overlay"])},e.prototype.editComment=function(){var e=this,t={author:this.comment.author,cancel:!1,type:"Edit"};this.owner.trigger("beforeCommentAction",t),t.cancel&&"Edit"===t.type||(this.commentPane.currentEditingComment=this,this.commentPane.isInsertingReply=!1,this.commentPane.isEditMode=!0,this.commentText.style.display="none",this.textAreaContainer.style.display="block",this.commentDate.style.display="none",this.menuBar.style.display="none",this.updateTextAreaHeight(),setTimeout(function(){e.textArea&&e.textArea.focus()}))},e.prototype.resolveComment=function(){t.classList(this.parentElement,["e-de-cmt-resolved"],[]);var e=new t.L10n("documenteditor",this.owner.defaultLocale);e.setLocale(this.owner.locale),this.dropDownButton.items=[{text:e.getConstant("Reopen")},{text:e.getConstant("Delete")}]},e.prototype.reopenComment=function(){t.classList(this.parentElement,[],["e-de-cmt-resolved"]);var e=new t.L10n("documenteditor",this.owner.defaultLocale);e.setLocale(this.owner.locale),this.dropDownButton.items=[{text:e.getConstant("Edit")},{text:e.getConstant("Delete")},{text:e.getConstant("Reply")},{text:e.getConstant("Resolve")}],this.showDrawer()},e.prototype.postComment=function(){var e={author:this.comment.author,cancel:!1,type:"Post"};if(this.owner.trigger("beforeCommentAction",e),!e.cancel||"Post"!==e.type){var i=this.textArea.value;this.commentText.innerText=i,this.comment.text=i,this.showCommentView(),this.commentPane&&this.commentPane.parentPane&&(this.commentPane.parentPane.isNewComment=!1),t.isNullOrUndefined(this.replyViewContainer)||(this.replyViewContainer.style.display=""),this.owner.fireContentChange()}},e.prototype.showCommentView=function(){this.commentPane.isEditMode=!1,this.textAreaContainer.style.display="none",this.commentText.style.display="block",this.commentDate.style.display="block",this.menuBar.style.display="block"},e.prototype.cancelEditing=function(){this.showCommentView(),this.textArea.value=this.comment.text.trim(),this.commentPane.parentPane.isNewComment&&(this.commentPane&&this.commentPane.parentPane&&(this.commentPane.parentPane.isNewComment=!1),this.commentPane.parentPane.discardComment(this.comment))},e.prototype.showOrHideDrawer=function(){this.isDrawerExpand?this.hideDrawer():this.showDrawer()},e.prototype.hideDrawer=function(){if(this.parentElement){var e=new t.L10n("documenteditor",this.owner.defaultLocale);e.setLocale(this.owner.locale);var i=this.parentElement.getElementsByClassName("e-de-cmt-sub-container");if(i.length>1){for(var n=1;n<i.length;n++)i[n].style.display="none";this.drawerElement.style.display="block",t.classList(this.drawerSpanElement,[],["e-de-nav-up"]),this.drawerSpanElement.innerText="+"+(i.length-1)+" "+e.getConstant("more")+"..."}this.isDrawerExpand=!1}},e.prototype.showDrawer=function(){if(this.parentElement){var e=this.parentElement.getElementsByClassName("e-de-cmt-sub-container");if(e.length>1){for(var i=0;i<e.length;i++)e[i].style.display="block";this.drawerElement.style.display="block",this.drawerSpanElement.innerText="",t.classList(this.drawerSpanElement,["e-de-nav-up"],[])}this.isDrawerExpand=!0}},e.prototype.userOptionSelectEvent=function(e){var i=e.item.text,n=new t.L10n("documenteditor",this.owner.defaultLocale);switch(n.setLocale(this.owner.locale),i){case n.getConstant("Edit"):this.editComment();break;case n.getConstant("Reply"):this.enableReplyView();break;case n.getConstant("Delete"):this.deleteComment();break;case n.getConstant("Resolve"):this.owner.editor.resolveComment(this.comment);break;case n.getConstant("Reopen"):this.owner.editor.reopenComment(this.comment)}},e.prototype.unwireEvent=function(){this.drawerAction&&this.drawerAction.removeEventListener("click",this.showOrHideDrawer.bind(this)),this.textArea&&(this.textArea.removeEventListener("keydown",this.updateTextAreaHeight.bind(this)),this.textArea.removeEventListener("keyup",this.enableDisablePostButton.bind(this))),this.postButton&&this.postButton.removeEventListener("click",this.postComment.bind(this)),this.cancelButton&&this.cancelButton.removeEventListener("click",this.cancelEditing.bind(this)),this.commentView&&(this.commentView.removeEventListener("click",this.selectComment.bind(this)),this.commentView.removeEventListener("mouseenter",this.showMenuItems.bind(this)),this.commentView.removeEventListener("mouseleave",this.hideMenuItemOnMouseLeave.bind(this)))},e.prototype.destroy=function(){this.unwireEvent(),this.comment&&(this.comment=void 0),this.dropDownButton&&this.dropDownButton.destroy(),this.dropDownButton=void 0,this.postButton&&this.postButton.destroy(),this.postButton=void 0,this.cancelButton&&this.cancelButton.destroy(),this.replyPostButton&&(this.replyPostButton.destroy(),this.replyPostButton=void 0),this.replyCancelButton&&(this.replyCancelButton.destroy(),this.replyCancelButton=void 0),this.reopenButton&&(this.reopenButton.destroy(),this.reopenButton=void 0),this.deleteButton&&(this.deleteButton.destroy(),this.deleteButton=void 0),this.replyViewContainer=void 0,this.replyViewTextBox=void 0,this.replyFooter=void 0,this.parentElement&&this.parentElement.parentElement&&this.parentElement.parentElement.removeChild(this.parentElement),this.commentPane=void 0,this.parentElement.innerHTML="",this.cancelButton=void 0,this.owner=void 0,this.menuBar=void 0,this.commentView=void 0,this.drawerAction=void 0,this.commentText=void 0,this.commentDate=void 0,this.textAreaContainer=void 0,this.textArea=void 0,this.drawerElement=void 0,this.drawerSpanElement=void 0,this.parentElement=null},e}(),Wi=function(){function e(e){var i=this;this.list=void 0,this.noteNumberFormat=void 0,this.sectionFormat=void 0,this.onCancelButtonClick=function(){i.documentHelper.dialog.hide(),i.documentHelper.updateFocus(),i.unWireEventsAndBindings()},this.loadFontDialog=function(){i.documentHelper.updateFocus();var e,t;if(t=i.sectionFormat?i.sectionFormat:i.documentHelper.owner.selection.sectionFormat,i.documentHelper.selection.isinFootnote){var n=t.footNoteNumberFormat,r=t.initialFootNoteNumber;e=i.reversetype(n),i.notesList.value=e,i.startValueTextBox.value=r}else{var o=t.endnoteNumberFormat;e=i.reversetype(o);r=t.initialEndNoteNumber;i.notesList.value=e,i.startValueTextBox.value=r}},this.onInsertFootnoteClick=function(){var e=new b(void 0);if(!t.isNullOrUndefined(i.notesList)){var n=i.notesList.value.toString(),r=i.types(n),o=i.startValueTextBox.value;t.isNullOrUndefined(i.notesList)||(i.documentHelper.selection.isinFootnote?(e.footNoteNumberFormat=r,e.footNoteNumberFormat=r,e.initialFootNoteNumber=o,i.documentHelper.owner.editorModule.onApplySectionFormat(void 0,e)):(e.endnoteNumberFormat=r,e.endnoteNumberFormat=r,e.initialEndNoteNumber=o,i.documentHelper.owner.editorModule.onApplySectionFormat(void 0,e)))}i.documentHelper.hideDialog()},this.unWireEventsAndBindings=function(){i.notesList.value=void 0},this.documentHelper=e}return e.prototype.getModuleName=function(){return"FootNotesDialog"},e.prototype.notesDialog=function(e,i){var n=this.documentHelper.owner.containerId+"_insert_Footnote";this.target=t.createElement("div",{id:n,className:"e-de-insert-footnote"});var r=t.createElement("div"),o=t.createElement("div",{className:"e-de-insert-footnote-dlg-sub-header",innerHTML:e.getConstant("Start at")}),l=t.createElement("div");this.footCount=t.createElement("input",{attrs:{type:"text"},id:this.documentHelper.owner.containerId+"row"}),l.appendChild(this.footCount);var d=t.createElement("div",{className:"e-de-insert-footnote-dlg-sub-header",innerHTML:e.getConstant("Number format")}),h=t.createElement("div",{id:"_paperSizeDiv",styles:"height:37px;",className:"e-de-page-setup-dlg-sub-container"}),c=t.createElement("select",{id:this.target.id+"_papersize",styles:"padding-bottom: 20px;",innerHTML:'<option value="1, 2, 3, ...">'+e.getConstant("1, 2, 3, ...")+'</option><option value="a, b, c, ...">'+e.getConstant("a, b, c, ...")+'</option><option value="A, B, C, ...">'+e.getConstant("A, B, C, ...")+'</option><option value="I, II, III, ...">'+e.getConstant("I, II, III, ...")+'</option><option value="i, ii, iii, ...">'+e.getConstant("i, ii, iii, ...")+"</option>"});h.appendChild(c),this.notesList=new s.DropDownList({enableRtl:i}),this.notesList.appendTo(c),r.appendChild(d),r.appendChild(h),r.appendChild(o),r.appendChild(l),this.target.appendChild(r),this.startValueTextBox=new a.NumericTextBox({format:"#",min:1,max:99999,enablePersistence:!1}),this.startValueTextBox.appendTo(this.footCount)},e.prototype.show=function(){var e=new t.L10n("documenteditor",this.documentHelper.owner.defaultLocale);if(e.setLocale(this.documentHelper.owner.locale),this.target||this.notesDialog(e),"none"!==this.documentHelper.selection.caret.style.display&&(this.documentHelper.selection.caret.style.display="none"),this.documentHelper.selection.isinFootnote?this.documentHelper.dialog.header=e.getConstant("Footnote"):this.documentHelper.dialog.header=e.getConstant("Endnote"),this.documentHelper.dialog.height="auto",this.documentHelper.dialog.width="auto",this.documentHelper.dialog.content=this.target,this.documentHelper.dialog.beforeOpen=this.loadFontDialog,this.documentHelper.dialog.buttons=[{click:this.onInsertFootnoteClick,buttonModel:{content:e.getConstant("Apply"),cssClass:"e-flat e-table-ok",isPrimary:!0}},{click:this.onCancelButtonClick,buttonModel:{content:e.getConstant("Cancel"),cssClass:"e-flat e-table-cancel"}}],this.startValueTextBox.value=1,this.documentHelper.dialog.close=this.documentHelper.updateFocus,this.documentHelper.dialog.dataBind(),this.documentHelper.dialog.show(),this.documentHelper.selection.isinEndnote){var i=this.endnoteListValue(this.list);this.notesList.index=i}},e.prototype.types=function(e){switch(e){case"1, 2, 3, ...":return"Arabic";case"A, B, C, ...":return"UpperCaseLetter";case"a, b, c, ...":return"LowerCaseLetter";case"I, II, III, ...":return"LowerCaseRoman";case"i, ii, iii, ...":return"UpperCaseRoman";default:return"Arabic"}},e.prototype.reversetype=function(e){switch(e){case"Arabic":return"1, 2, 3, ...";case"UpperCaseLetter":return"A, B, C, ...";case"LowerCaseLetter":return"a, b, c, ...";case"UpperCaseRoman":return"I, II, III, ...";case"LowerCaseRoman":return"i, ii, iii, ...";default:return"1, 2, 3, ..."}},e.prototype.endnoteListValue=function(e){return"A, B, C, ..."===e?0:"1, 2, 3, ..."===e?1:"a, b, c, ..."===e?2:3},e.prototype.destroy=function(){this.footCount&&(this.footCount.parentElement&&this.footCount.parentElement.removeChild(this.footCount),this.footCount=void 0),this.startValueTextBox&&(this.startValueTextBox.destroy(),this.startValueTextBox=void 0),this.notesList&&(this.notesList.destroy(),this.notesList=void 0),this.footCount=void 0},e}(),Oi=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),ki=function(e,t,i,n){var r,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,i,s):r(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},Li=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Oi(i,e),ki([t.Property("#FFE97F")],i.prototype,"searchHighlightColor",void 0),ki([t.Property(["Algerian","Arial","Calibri","Cambria","Cambria Math","Candara","Courier New","Georgia","Impact","Segoe Print","Segoe Script","Segoe UI","Symbol","Times New Roman","Verdana","Wingdings"])],i.prototype,"fontFamilies",void 0),ki([t.Property({shadingColor:"#cfcfcf",applyShading:!0,selectionColor:"#cccccc",formFillingMode:"Popup"})],i.prototype,"formFieldSettings",void 0),ki([t.Property({roomName:"",editableRegionColor:"#22b24b",lockedRegionColor:"#f44336"})],i.prototype,"collaborativeEditingSettings",void 0),i}(t.ChildProperty),Bi=function(e){function i(t,i){var n=e.call(this,t,i)||this;return n.enableHeaderFooterIn=!1,n.isShiftingEnabled=!1,n.isLayoutEnabled=!0,n.isPastingContent=!1,n.parser=void 0,n.disableHistoryIn=!1,n.findResultsList=void 0,n.tablePropertiesDialogModule=void 0,n.bordersAndShadingDialogModule=void 0,n.cellOptionsDialogModule=void 0,n.tableOptionsDialogModule=void 0,n.paragraphDialogModule=void 0,n.imageResizerModule=void 0,n.createdTriggered=!1,n.defaultLocale={Table:"Table",Row:"Row",Cell:"Cell",Ok:"OK",Apply:"Apply",Cancel:"Cancel",Size:"Size","Preferred Width":"Preferred width",Points:"Points",Percent:"Percent","Measure in":"Measure in",Alignment:"Alignment",Left:"Left",Center:"Center",Right:"Right",Justify:"Justify","Indent from left":"Indent from left","Borders and Shading":"Borders and Shading",Options:"Options","Specify height":"Specify height","At least":"At least",Exactly:"Exactly","Row height is":"Row height is","Allow row to break across pages":"Allow row to break across pages","Repeat as header row at the top of each page":"Repeat as header row at the top of each page","Vertical alignment":"Vertical alignment",Top:"Top",Bottom:"Bottom","Default cell margins":"Default cell margins","Default cell spacing":"Default cell spacing","Allow spacing between cells":"Allow spacing between cells","Cell margins":"Cell margins","Same as the whole table":"Same as the whole table",Borders:"Borders",None:"None",Style:"Style",Width:"Width",Height:"Height",Letter:"Letter","1, 2, 3, ...":"1, 2, 3, ...","a, b, c, ...":"a, b, c, ...","A, B, C, ...":"A, B, C, ...","I, II, III, ...":"I, II, III, ...","i, ii, iii, ...":"i, ii, iii, ...",Tabloid:"Tabloid",Legal:"Legal",Statement:"Statement",Executive:"Executive",A3:"A3",A4:"A4",A5:"A5",B4:"B4",B5:"B5","Custom Size":"Custom size","Different odd and even":"Different odd and even","Different first page":"Different first page","From edge":"From edge",Header:"Header",Footer:"Footer",Margin:"Margins",Paper:"Paper",Layout:"Layout",Orientation:"Orientation",Landscape:"Landscape",Portrait:"Portrait","Show page numbers":"Show page numbers","Right align page numbers":"Right align page numbers",Nothing:"Nothing","Tab leader":"Tab leader","Show levels":"Show levels","Use hyperlinks instead of page numbers":"Use hyperlinks instead of page numbers","Build table of contents from":"Build table of contents from",Styles:"Styles","Available styles":"Available styles","TOC level":"TOC level",Heading:"Heading","Heading 1":"Heading 1","Heading 2":"Heading 2","Heading 3":"Heading 3","Heading 4":"Heading 4","Heading 5":"Heading 5","Heading 6":"Heading 6","List Paragraph":"List Paragraph",Normal:"Normal","Outline levels":"Outline levels","Table entry fields":"Table entry fields",Modify:"Modify",Color:"Color",Setting:"Setting",Box:"Box",All:"All",Custom:"Custom",Preview:"Preview",Shading:"Shading",Fill:"Fill","Apply To":"Apply to","Table Properties":"Table Properties","Cell Options":"Cell Options","Table Options":"Table Options","Insert Table":"Insert Table","Number of columns":"Number of columns","Number of rows":"Number of rows","Text to display":"Text to display",Address:"Address","Insert Hyperlink":"Insert Hyperlink","Edit Hyperlink":"Edit Hyperlink",Insert:"Insert",General:"General",Indentation:"Indentation","Before text":"Before text",Special:"Special","First line":"First line",Hanging:"Hanging","After text":"After text",By:"By",Before:"Before","Line Spacing":"Line spacing",After:"After",At:"At",Multiple:"Multiple",Spacing:"Spacing","Define new Multilevel list":"Define new Multilevel list","List level":"List level","Choose level to modify":"Choose level to modify",Level:"Level","Number format":"Number format","Number style for this level":"Number style for this level","Enter formatting for number":"Enter formatting for number","Start at":"Start at","Restart list after":"Restart list after",Position:"Position","Text indent at":"Text indent at","Aligned at":"Aligned at","Follow number with":"Follow number with","Tab character":"Tab character",Space:"Space",Arabic:"Arabic",UpRoman:"UpRoman",LowRoman:"LowRoman",UpLetter:"UpLetter",LowLetter:"LowLetter",Number:"Number","Leading zero":"Leading zero",Bullet:"Bullet",Ordinal:"Ordinal","Ordinal Text":"Ordinal Text","For East":"For East","No Restart":"No Restart",Font:"Font","Font style":"Font style","Underline style":"Underline style","Font color":"Font color",Effects:"Effects",Strikethrough:"Strikethrough",Superscript:"Superscript",Subscript:"Subscript","Double strikethrough":"Double strikethrough",Regular:"Regular",Bold:"Bold",Italic:"Italic",Cut:"Cut",Copy:"Copy",Paste:"Paste",Hyperlink:"Hyperlink","Open Hyperlink":"Open Hyperlink","Copy Hyperlink":"Copy Hyperlink","Remove Hyperlink":"Remove Hyperlink",Paragraph:"Paragraph","Linked Style":"Linked(Paragraph and Character)",Character:"Character","Merge Cells":"Merge Cells","Insert Above":"Insert Above","Insert Below":"Insert Below","Insert Left":"Insert Left","Insert Right":"Insert Right",Delete:"Delete","Delete Table":"Delete Table","Delete Row":"Delete Row","Delete Column":"Delete Column","File Name":"File Name","Format Type":"Format Type",Save:"Save",Navigation:"Navigation",Results:"Results",Replace:"Replace","Replace All":"Replace All","We replaced all":"We replaced all",Find:"Find","No matches":"No matches","All Done":"All Done",Result:"Result",of:"of",instances:"instances",with:"with","Click to follow link":"Click to follow link","Continue Numbering":"Continue Numbering","Bookmark name":"Bookmark name",Close:"Close","Restart At":"Restart At",Properties:"Properties",Name:"Name","Style type":"Style type","Style based on":"Style based on","Style for following paragraph":"Style for following paragraph",Formatting:"Formatting","Numbering and Bullets":"Numbering and Bullets",Numbering:"Numbering","Update Field":"Update Field","Edit Field":"Edit Field",Bookmark:"Bookmark","Page Setup":"Page Setup","No bookmarks found":"No bookmarks found","Number format tooltip information":'Single-level number format: </br>[PREFIX]%[LEVELNUMBER][SUFFIX]</br>For example, "Chapter %1." will display numbering like</br>Chapter 1. Item</br>Chapter 2. Item</br>…</br>Chapter N. Item</br></br>Multilevel number format:</br>[PREFIX]%[LEVELNUMBER][SUFFIX]+[PREFIX]%[LEVELNUMBER][SUFFIX]</br>For example, "%1.%2." will display numbering like</br>1.1. Item</br>1.2. Item</br>…</br>1.N. Item',Format:"Format","Create New Style":"Create New Style","Modify Style":"Modify Style",New:"New",InsertFootnote:"InsertFootnote",InsertEndnote:"InsertEndnote",Footnote:"Footnote",Endnote:"Endnote","Notes Options":"Notes Options",Bullets:"Bullets","Use bookmarks":"Use bookmarks","Table of Contents":"Table of Contents",AutoFit:"AutoFit","AutoFit to Contents":"AutoFit to Contents","AutoFit to Window":"AutoFit to Window","Fixed Column Width":"Fixed Column Width",Reset:"Reset","Match case":"Match case","Whole words":"Whole words",Add:"Add","Go To":"Go To","Search for":"Search for","Replace with":"Replace with","TOC 1":"TOC 1","TOC 2":"TOC 2","TOC 3":"TOC 3","TOC 4":"TOC 4","TOC 5":"TOC 5","TOC 6":"TOC 6","TOC 7":"TOC 7","TOC 8":"TOC 8","TOC 9":"TOC 9","Right-to-left":"Right-to-left","Left-to-right":"Left-to-right",Direction:"Direction","Table direction":"Table direction","Indent from right":"Indent from right","Contextual Spacing":"Don't add space between the paragraphs of the same styles","Password Mismatch":"The password don't match","Restrict Editing":"Restrict Editing","Formatting restrictions":"Formatting restrictions","Allow formatting":"Allow formatting","Editing restrictions":"Editing restrictions","Read only":"Read only","Exceptions Optional":"Exceptions (optional)","Select Part Of Document And User":"Select parts of the document and choose users who are allowed to freely edit them.",Everyone:"Everyone","More users":"More users","Add Users":"Add Users","Enforcing Protection":"Yes, Start Enforcing Protection","Start Enforcing Protection":"Start Enforcing Protection","Enter User":"Enter User",Users:"Users","Enter new password":"Enter new password","Reenter new password to confirm":"Reenter new password to confirm","Your permissions":"Your permissions","Protected Document":"This document is protected from unintentional editing.You may edit in this region.",FormFieldsOnly:"This document is protected from unintentional editing. You may only fill in forms in this region.","You may format text only with certain styles":"You may format text only with certain styles.","Stop Protection":"Stop Protection",Password:"Password","Spelling Editor":"Spelling Editor",Spelling:"Spelling","Spell Check":"Spell Check","Underline errors":"Underline errors",Ignore:"Ignore","Ignore all":"Ignore All","Add to Dictionary":"Add to Dictionary",Change:"Change","Change All":"Change All",Suggestions:"Suggestions","The password is incorrect":"The password is incorrect","Error in establishing connection with web server":"Error in establishing connection with web server","Highlight the regions I can edit":"Highlight the regions I can edit","Show All Regions I Can Edit":"Show All Regions I Can Edit","Find Next Region I Can Edit":"Find Next Region I Can Edit","Keep source formatting":"Keep source formatting","Match destination formatting":"Match destination formatting","Text only":"Text only",Comments:"Comments","Type your comment":"Type your comment",Post:"Post",Reply:"Reply","New Comment":"New Comment",Edit:"Edit",Resolve:"Resolve",Reopen:"Reopen","No comments in this document":"No comments in this document",more:"more","Type your comment here":"Type your comment here","Next Comment":"Next Comment","Previous Comment":"Previous Comment","Un-posted comments":"Un-posted comments","Discard Comment":"Added comments not posted. If you continue, that comment will be discarded.","No Headings":"No Heading Found!","Add Headings":"This document has no headings. Please add headings and try again.","More Options":"More Options","Click to see this comment":"Click to see this comment","Form Fields":"Form Fields","Text Form":"Text Form","Check Box":"Check Box","Drop Down Form Field":"Drop Down Form Field","Dropdown items":"Drop-down items","Items in dropdown list":"Items in drop-down list",ADD:"ADD",REMOVE:"REMOVE","Field settings":"Field settings",Tooltip:"Tooltip","Dropdown enabled":"Drop-down enabled","Check Box Form Field":"Check Box Form Field","Check box size":"Check box size",Auto:"Auto","Default value":"Default value","Not checked":"Not checked",Checked:"Checked","Check box enabled":"Check box enabled","Text Form Field":"Text Form Field",Type:"Type","Default text":"Default text","Maximum length":"Maximum length","Text format":"Text format","Fillin enabled":"Fill-in enabled","Default number":"Default number","Default date":"Default date","Date format":"Date format","Merge Track":"This action wont be marked as change. Do you want to continue?",UnTrack:"Cannot be tracked !",Accept:"Accept",Reject:"Reject","Previous Changes":"Previous Changes","Next Changes":"Next Changes",Inserted:"Inserted",Deleted:"Deleted","Move From":"Move From","Move To":"Move To",Changes:"Changes","Accept all":"Accept all","Reject all":"Reject all","No changes":"No changes","Accept Changes":"Accept Changes","Reject Changes":"Reject Changes",User:"User",View:"View",Insertion:"Insertion",Deletion:"Deletion","All caps":"All caps","This region is locked by":"This region is locked by",Lock:"Lock",Unlock:"Unlock","Already locked":"Selected or part of region is already locked by another user","Click to View/Edit Footnote":"Click to View/Edit Footnote","Click to View/Edit Endnote":"Click to View/Edit Endnote","Multiple Comment":"Please post your comment"},n.documentHelper=new ie(n),"Pages"===n.layoutType?n.viewer=new re(n):n.viewer=new oe(n),n.parser=new bt(n.documentHelper),n}Oi(i,e),n=i,Object.defineProperty(i.prototype,"enableHeaderAndFooter",{get:function(){return this.enableHeaderFooterIn},set:function(e){this.enableHeaderFooterIn=e,!e&&this.selection&&this.selection.isWebLayout&&(this.selection.isWebLayout=!1),this.viewer.updateScrollBars()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pageCount",{get:function(){return!this.isDocumentLoaded||t.isNullOrUndefined(this.viewer)||this.viewer instanceof oe?1:this.documentHelper.pages.length},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"selection",{get:function(){return this.selectionModule},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"editor",{get:function(){return this.editorModule},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"editorHistory",{get:function(){return this.editorHistoryModule},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"search",{get:function(){return this.searchModule},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"contextMenu",{get:function(){return this.contextMenuModule},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"spellCheckDialog",{get:function(){return this.spellCheckDialogModule},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"spellChecker",{get:function(){return this.spellCheckerModule},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"containerId",{get:function(){return this.element.id},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isDocumentLoaded",{get:function(){return this.isDocumentLoadedIn},set:function(e){this.isDocumentLoadedIn=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"revisions",{get:function(){return t.isNullOrUndefined(this.revisionsInternal)&&(this.revisionsInternal=new E(this)),this.revisionsInternal},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"enableHistoryMode",{get:function(){return this.enableEditorHistory&&!t.isNullOrUndefined(this.editorHistoryModule)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"documentStart",{get:function(){if(!t.isNullOrUndefined(this.selectionModule))return this.selection.getDocumentStart()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"documentEnd",{get:function(){if(!t.isNullOrUndefined(this.selectionModule))return this.selection.getDocumentEnd()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isReadOnlyMode",{get:function(){return this.isReadOnly||t.isNullOrUndefined(this.editorModule)||t.isNullOrUndefined(this.selectionModule)||!t.isNullOrUndefined(this.editor)&&this.editor.restrictEditing},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isSpellCheck",{get:function(){return this.enableSpellCheck&&this.spellChecker.enableSpellCheck},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"enableImageResizerMode",{get:function(){return this.enableImageResizer&&!t.isNullOrUndefined(this.imageResizerModule)},enumerable:!0,configurable:!0}),i.prototype.preRender=function(){this.findResultsList=[]},i.prototype.render=function(){if(!t.isNullOrUndefined(this.element)){var e=this.element;e.style.minHeight="200px",e.style.minWidth="200px",""!==this.height&&(this.element.style.height=t.formatUnit(this.height)),""!==this.width&&(this.element.style.width=t.formatUnit(this.width))}this.documentHelper.initializeComponents(),this.openBlank(),this.renderComplete(),this.createdTriggered=!0},i.prototype.getModuleName=function(){return"DocumentEditor"},i.prototype.onPropertyChanged=function(e,i){for(var n=this,r=0,o=Object.keys(e);r<o.length;r++)switch(o[r]){case"zoomFactor":this.viewer&&i.zoomFactor!==e.zoomFactor&&(this.documentHelper.zoomFactor=e.zoomFactor);break;case"layoutType":if(this.selection&&this.selection.isWebLayout)break;this.viewer.destroy(),"Pages"===this.layoutType?this.viewer=new re(this):(!0===this.enableHeaderAndFooter&&this.selection.closeHeaderFooter(),this.viewer=new oe(this)),this.editor.layoutWholeDocument(),setTimeout(function(){n.fireViewChange()},200);break;case"locale":this.localizeDialogs();break;case"isReadOnly":!t.isNullOrUndefined(this.optionsPaneModule)&&this.optionsPaneModule.isOptionsPaneShow&&this.optionsPaneModule.showHideOptionsPane(!1),this.showComments&&this.commentReviewPane.showHidePane(!0,"Comments");break;case"currentUser":case"userColor":this.selection&&this.documentHelper.isDocumentProtected&&this.selection.highlightEditRegion(),this.viewer.updateScrollBars();break;case"pageGap":case"pageOutline":this.viewer.updateScrollBars();break;case"zIndex":this.documentHelper.dialog&&(this.documentHelper.dialog.zIndex=e.zIndex+10),this.documentHelper.dialog2&&(this.documentHelper.dialog2.zIndex=e.zIndex);break;case"showComments":this.viewer&&this.documentHelper.showComments(e.showComments),this.viewer.updateScrollBars();break;case"enableRtl":this.localizeDialogs(e.enableRtl);break;case"enableComment":this.viewer&&this.showComments&&(this.showComments=!!this.showComments&&this.enableComment,this.documentHelper.showComments(e.enableComment)),this.viewer.updateScrollBars();break;case"showRevisions":this.isReadOnly||this.documentHelper.isDocumentProtected?(this.showRevisions=!1,this.documentHelper.showRevisions(!1)):this.viewer&&this.documentHelper.showRevisions(e.showRevisions),this.viewer.updateScrollBars();break;case"documentEditorSettings":this.viewer.updateScrollBars();break;case"height":this.element.style.height=t.formatUnit(this.height),this.resize();break;case"width":this.element.style.width=t.formatUnit(this.width),this.resize()}},i.prototype.localizeDialogs=function(e){if(""!==this.locale){var i=new t.L10n("documenteditor",this.defaultLocale);i.setLocale(this.locale),t.isNullOrUndefined(e)||(this.documentHelper.dialog.enableRtl=e,this.documentHelper.dialog2.enableRtl=e),this.optionsPaneModule&&this.optionsPaneModule.initOptionsPane(i,e),this.paragraphDialogModule&&this.paragraphDialogModule.initParagraphDialog(i),this.footNotesDialogModule&&this.footNotesDialogModule.notesDialog(i,e),this.pageSetupDialogModule&&this.pageSetupDialogModule.initPageSetupDialog(i,e),this.fontDialogModule&&this.fontDialogModule.initFontDialog(i,e),this.hyperlinkDialogModule&&this.hyperlinkDialogModule.initHyperlinkDialog(i,e),this.contextMenuModule&&(this.contextMenuModule.contextMenuInstance.destroy(),this.contextMenuModule.initContextMenu(i,e)),this.listDialogModule&&this.listDialogModule.initListDialog(i,e),this.tablePropertiesDialogModule&&this.tablePropertiesDialogModule.initTablePropertyDialog(i,e),this.bordersAndShadingDialogModule&&this.bordersAndShadingDialogModule.initBordersAndShadingsDialog(i,e),this.cellOptionsDialogModule&&this.cellOptionsDialogModule.initCellMarginsDialog(i,e),this.tableOptionsDialogModule&&this.tableOptionsDialogModule.initTableOptionsDialog(i,e),this.tableDialogModule&&this.tableDialogModule.initTableDialog(i),this.styleDialogModule&&this.styleDialogModule.initStyleDialog(i,e),this.tableOfContentsDialogModule&&this.tableOfContentsDialogModule.initTableOfContentDialog(i,e),this.commentReviewPane&&this.commentReviewPane.parentPaneElement&&(this.enableRtl?t.classList(this.commentReviewPane.parentPaneElement,["e-rtl"],[]):t.classList(this.commentReviewPane.parentPaneElement,[],["e-rtl"]))}},i.prototype.setDefaultCharacterFormat=function(e){this.characterFormat=e},i.prototype.setDefaultParagraphFormat=function(e){this.paragraphFormat=e},i.prototype.setDefaultSectionFormat=function(e){this.sectionFormat=e},i.prototype.getPersistData=function(){return"documenteditor"},i.prototype.clearPreservedCollectionsInViewer=function(){this.viewer instanceof ne&&this.documentHelper.clearDocumentItems()},i.prototype.getDocumentEditorElement=function(){return this.element},i.prototype.fireContentChange=function(){this.enableLockAndEdit&&this.collaborativeEditingModule&&this.collaborativeEditingModule.saveContent();var e={source:t.isBlazor()?null:this};this.trigger("contentChange",e)},i.prototype.fireDocumentChange=function(){this.enableLockAndEdit&&this.enableEditor&&this.editor.enforceProtection("",!1,!0);var e={source:t.isBlazor()?null:this};this.trigger("documentChange",e)},i.prototype.fireSelectionChange=function(){!this.documentHelper.isCompositionStart&&t.Browser.isDevice&&this.editorModule&&this.editorModule.predictText();var e={source:t.isBlazor()?null:this};this.trigger("selectionChange",e)},i.prototype.fireZoomFactorChange=function(){var e={source:t.isBlazor()?null:this};this.trigger("zoomFactorChange",e)},i.prototype.fireBeformFieldFill=function(){var e={};this.trigger("beforeFieldFill",e)},i.prototype.fireAfterFormFieldFill=function(){var e={};this.trigger("afterFieldFill",e)},i.prototype.fireServiceFailure=function(e){this.trigger("serviceFailure",e)},i.prototype.fireViewChange=function(){if(this.viewer&&this.documentHelper.pages.length>0&&this.viewer.visiblePages.length>0){var e=this.viewer.visiblePages,i={startPage:e[0].index+1,endPage:e[e.length-1].index+1,source:t.isBlazor()?null:this};this.trigger("viewChange",i)}},i.prototype.fireCustomContextMenuSelect=function(e){var t={id:e};this.trigger("customContextMenuSelect",t)},i.prototype.fireCustomContextMenuBeforeOpen=function(e){var t={ids:e};this.trigger("customContextMenuBeforeOpen",t)},i.prototype.showParagraphDialog=function(e){this.paragraphDialogModule&&!this.isReadOnlyMode&&this.viewer&&this.paragraphDialogModule.show(e)},i.prototype.showPageSetupDialog=function(){this.pageSetupDialogModule&&!this.isReadOnlyMode&&this.viewer&&this.pageSetupDialogModule.show()},i.prototype.showFootNotesDialog=function(){this.footNotesDialogModule&&!this.isReadOnlyMode&&this.viewer&&this.footNotesDialogModule.show()},i.prototype.showFontDialog=function(e){this.fontDialogModule&&!this.isReadOnlyMode&&this.viewer&&this.fontDialogModule.showFontDialog(e)},i.prototype.showCellOptionsDialog=function(){this.cellOptionsDialogModule&&!this.isReadOnlyMode&&this.viewer&&this.cellOptionsDialogModule.show()},i.prototype.showTableOptionsDialog=function(){this.tableOptionsDialogModule&&!this.isReadOnlyMode&&this.viewer&&this.tableOptionsDialogModule.show()},i.prototype.showTableDialog=function(){this.tableDialogModule&&!this.isReadOnlyMode&&this.viewer&&this.tableDialogModule.show()},i.prototype.showTableOfContentsDialog=function(){this.tableOfContentsDialogModule&&!this.isReadOnlyMode&&this.viewer&&this.tableOfContentsDialogModule.show()},i.prototype.showStyleDialog=function(){this.styleDialogModule&&!this.isReadOnlyMode&&this.viewer&&this.styleDialogModule.show()},i.prototype.showHyperlinkDialog=function(){this.hyperlinkDialogModule&&!this.isReadOnlyMode&&this.viewer&&this.hyperlinkDialogModule.show()},i.prototype.showBookmarkDialog=function(){this.bookmarkDialogModule&&!this.isReadOnlyMode&&this.viewer&&this.bookmarkDialogModule.show()},i.prototype.showStylesDialog=function(){this.stylesDialogModule&&!this.isReadOnlyMode&&this.viewer&&this.stylesDialogModule.show()},i.prototype.showListDialog=function(){this.listDialogModule&&!this.isReadOnlyMode&&this.viewer&&this.listDialogModule.showListDialog()},i.prototype.showTablePropertiesDialog=function(){this.tablePropertiesDialogModule&&!this.isReadOnlyMode&&this.viewer&&this.tablePropertiesDialogModule.show()},i.prototype.showBordersAndShadingDialog=function(){this.bordersAndShadingDialogModule&&!this.isReadOnlyMode&&this.viewer&&this.bordersAndShadingDialogModule.show()},i.prototype.requiredModules=function(){var e=[];return this.enableLockAndEdit&&e.push({member:"CollaborativeEditing",args:[this]}),this.enablePrint&&e.push({member:"Print",args:[]}),(this.enableSfdtExport||this.enableWordExport||this.enableTextExport||this.enableSelection||this.enableEditor)&&e.push({member:"SfdtExport",args:[this.documentHelper]}),this.enableWordExport&&e.push({member:"WordExport",args:[]}),this.enableTextExport&&e.push({member:"TextExport",args:[]}),(this.enableSelection||this.enableSearch||this.enableEditor)&&(e.push({member:"Selection",args:[this]}),this.enableContextMenu&&e.push({member:"ContextMenu",args:[this.documentHelper]})),this.enableSearch&&(e.push({member:"Search",args:[this]}),this.enableOptionsPane&&e.push({member:"OptionsPane",args:[this.documentHelper]})),this.enableEditor&&(e.push({member:"Editor",args:[this.documentHelper]}),this.enableImageResizer&&e.push({member:"ImageResizer",args:[this,this.documentHelper]}),this.enableEditorHistory&&e.push({member:"EditorHistory",args:[this]}),this.enableHyperlinkDialog&&e.push({member:"HyperlinkDialog",args:[this.documentHelper]}),this.enableTableDialog&&e.push({member:"TableDialog",args:[this.documentHelper]}),this.enableBookmarkDialog&&e.push({member:"BookmarkDialog",args:[this.documentHelper]}),this.enableTableOfContentsDialog&&e.push({member:"TableOfContentsDialog",args:[this.documentHelper]}),this.enablePageSetupDialog&&e.push({member:"PageSetupDialog",args:[this.documentHelper]}),this.enableFootnoteAndEndnoteDialog&&e.push({member:"FootNotesDialog",args:[this.documentHelper]}),this.enableStyleDialog&&(e.push({member:"StylesDialog",args:[this.documentHelper]}),e.push({member:"StyleDialog",args:[this.documentHelper]}),e.push({member:"BulletsAndNumberingDialog",args:[this.documentHelper]})),this.enableListDialog&&e.push({member:"ListDialog",args:[this.documentHelper]}),this.enableParagraphDialog&&e.push({member:"ParagraphDialog",args:[this.documentHelper]}),this.enableFontDialog&&e.push({member:"FontDialog",args:[this.documentHelper]}),this.enableTablePropertiesDialog&&(e.push({member:"TablePropertiesDialog",args:[this.documentHelper]}),e.push({member:"CellOptionsDialog",args:[this.documentHelper]})),this.enableBordersAndShadingDialog&&e.push({member:"BordersAndShadingDialog",args:[this.documentHelper]}),this.enableTableOptionsDialog&&e.push({member:"TableOptionsDialog",args:[this.documentHelper]}),this.enableSpellCheck&&(e.push({member:"SpellChecker",args:[this.documentHelper]}),e.push({member:"SpellCheckDialog",args:[this.documentHelper]})),this.enableFormField&&(e.push({member:"TextFormFieldDialog",args:[this]}),e.push({member:"DropDownFormFieldDialog",args:[this]}),e.push({member:"CheckBoxFormFieldDialog",args:[this]}))),e},i.prototype.open=function(e){t.isNullOrUndefined(this.viewer)||(this.showComments=!1,this.clearPreservedCollectionsInViewer(),this.documentHelper.userCollection.push("Everyone"),this.documentHelper.lists=[],this.documentHelper.abstractLists=[],this.documentHelper.styles=new M,this.documentHelper.cachedPages=[],this.showRevisions=!1,this.isSpellCheck&&!this.spellChecker.enableOptimizedSpellCheck&&(this.documentHelper.triggerElementsOnLoading=!0,this.documentHelper.triggerSpellCheck=!0),!t.isNullOrUndefined(e)&&this.viewer&&(this.documentHelper.setDefaultDocumentFormat(),this.documentHelper.onDocumentChanged(this.parser.convertJsonToDocument(e)),this.editorModule&&this.editorModule.intializeDefaultStyles()),this.isSpellCheck&&!this.spellChecker.enableOptimizedSpellCheck&&(this.documentHelper.triggerElementsOnLoading=!1,this.documentHelper.triggerSpellCheck=!1))},i.prototype.scrollToPage=function(e){return!(t.isNullOrUndefined(this.viewer)||e<1||e>this.documentHelper.pages.length)&&(this.viewer.scrollToPage(e-1),!0)},i.prototype.enableAllModules=function(){this.enablePrint=this.enableSfdtExport=this.enableWordExport=this.enableTextExport=this.enableSelection=this.enableContextMenu=this.enableSearch=this.enableOptionsPane=this.enableEditor=this.enableImageResizer=this.enableEditorHistory=this.enableHyperlinkDialog=this.enableTableDialog=this.enableBookmarkDialog=this.enableTableOfContentsDialog=this.enableFootnoteAndEndnoteDialog=this.enablePageSetupDialog=this.enableStyleDialog=this.enableListDialog=this.enableParagraphDialog=this.enableFontDialog=this.enableTablePropertiesDialog=this.enableBordersAndShadingDialog=this.enableTableOptionsDialog=this.enableSpellCheck=this.enableComment=this.enableFormField=!0,n.Inject(y,si,ri,oi,Ot,Mt,zt,Zt,ii,yt,At,ai,li,Wi,di,hi,ci,mi,gi,pi,fi,vi,yi,bi,wi,Ci,xi,Ii,Fi,Pi,Ti,Si)},i.prototype.resize=function(e,i){this.element&&(!t.isNullOrUndefined(e)&&e>200&&(this.element.style.width=e+"px"),!t.isNullOrUndefined(i)&&i>200&&(this.element.style.height=i+"px"),this.viewer&&this.documentHelper.updateViewerSize(),this.trackChangesPane.toolbar&&this.trackChangesPane.toolbar.refreshOverflow())},i.prototype.getFormFieldNames=function(){for(var e=[],t=this.documentHelper.formFields,i=0;i<t.length;i++)""!==t[i].formFieldData.name&&e.push(t[i].formFieldData.name);return e},i.prototype.getFormFieldInfo=function(e){for(var t=this.documentHelper.formFields,i=0;i<t.length;i++)if(t[i].formFieldData.name===e&&""!==t[i].formFieldData.name)return t[i].formFieldData.getFormFieldInfo()},i.prototype.setFormFieldInfo=function(e,t){for(var i=this.documentHelper.formFields,n=0;n<i.length;n++)if(i[n].formFieldData.name===e&&""!==i[n].formFieldData.name){var r=i[n];return void(this.selection&&(this.selection.selectFieldInternal(r),this.editor&&this.editor.setFormField(r,t)))}},i.prototype.resetFormFields=function(e){for(var i=this.documentHelper.formFields,n=0;n<i.length;n++)(t.isNullOrUndefined(e)||e===i[n].formFieldData.name)&&(i[n].formFieldData instanceof Pe?this.editor.updateFormField(i[n],i[n].formFieldData.defaultValue,!0):i[n].formFieldData instanceof Te?this.editor.toggleCheckBoxFormField(i[n],!0,i[n].formFieldData.defaultValue):i[n].formFieldData instanceof Se&&this.editor.updateFormField(i[n],0,!0))},i.prototype.importFormData=function(e){for(var t=this.documentHelper.formFields,i=0;i<e.length;i++)for(var n=e[i],r=n.fieldName,o=0;o<t.length;o++)t[o].formFieldData.name===r&&(t[o].formFieldData instanceof Te?this.editor.toggleCheckBoxFormField(t[o],!0,n.value):t[o].formFieldData instanceof Pe?this.editor.updateFormField(t[o],n.value):t[o].formFieldData instanceof Se&&this.editor.updateFormField(t[o],n.value))},i.prototype.exportFormData=function(){for(var e=[],t=this.documentHelper.formFields,i=0;i<t.length;i++)if(""!==t[i].formFieldData.name){var n={fieldName:"",value:""};if(n.fieldName=t[i].formFieldData.name,t[i].formFieldData instanceof Te)n.value=t[i].formFieldData.checked;else if(t[i].formFieldData instanceof Pe){var r="";r=this.documentHelper.isInlineFormFillProtectedMode?this.editorModule.getFormFieldText(t[i]):t[i].resultText;var o=new RegExp(this.documentHelper.textHelper.getEnSpaceCharacter(),"gi");""===r.replace(o,"")&&(r=""),n.value=r}else t[i].formFieldData instanceof Se&&(n.value=t[i].formFieldData.selectedIndex);e.push(n)}return e},i.prototype.updateFields=function(){for(var e=0;e<this.documentHelper.fields.length;e++){var t=this.documentHelper.fields[e];0===this.selection.getFieldCode(t).toLowerCase().trim().indexOf("ref ")&&this.selection.updateRefField(t)}},i.prototype.focusIn=function(){this.viewer&&this.documentHelper.updateFocus()},i.prototype.fitPage=function(e){t.isNullOrUndefined(e)&&(e="None"),this.viewer&&(this.viewer.pageFitType=e)},i.prototype.print=function(e){if(t.isNullOrUndefined(this.viewer))throw new Error("Invalid operation.");if(!this.printModule)throw new Error("Invalid operation. Print is not enabled.");"Continuous"===this.layoutType?(this.documentHelper.isWebPrinting=!0,this.viewer=new re(this),this.editor.layoutWholeDocument(),this.printModule.print(this.documentHelper,e),this.viewer=new oe(this),this.editor.layoutWholeDocument(),this.documentHelper.isWebPrinting=!1):this.printModule.print(this.documentHelper,e)},i.prototype.serialize=function(){if(!(this.enableSfdtExport&&this.sfdtExportModule instanceof si))throw new Error("Invalid operation. Sfdt export is not enabled.");return this.sfdtExportModule.serialize()},i.prototype.save=function(e,i){if(e=e||"Untitled",t.isNullOrUndefined(this.documentHelper))throw new Error("Invalid operation.");if("Docx"===i&&this.wordExportModule)this.wordExportModule&&this.wordExportModule.save(this.documentHelper,e);else if("Txt"===i&&this.textExportModule)this.textExportModule.save(this.documentHelper,e);else{if("Sfdt"!==i||!this.enableSfdtExport||!this.sfdtExportModule)throw new Error("Invalid operation. Specified export is not enabled.");var n=this.serialize(),r=new Blob([n],{type:"application/json"});p.Save.save(e+".sfdt",r)}},i.prototype.saveAsBlob=function(e){var i=this;if(t.isNullOrUndefined(this.viewer))throw new Error("Invalid operation");return new Promise(function(t){"Docx"===e&&i.wordExportModule?t(i.wordExportModule.saveAsBlob(i.documentHelper)):"Txt"===e&&i.textExportModule?t(i.textExportModule.saveAsBlob(i.documentHelper)):"Sfdt"===e&&i.enableSfdtExport&&i.sfdtExportModule&&t(i.sfdtExportModule.saveAsBlob(i.documentHelper))})},i.prototype.openBlank=function(){var e=new pe;e.index=0,e.sectionFormat=new b(e),this.sectionFormat&&this.parser.parseSectionFormat(this.sectionFormat,e.sectionFormat);var t=new fe;t.index=0,t.paragraphFormat=new P(t),t.characterFormat=new H(t),e.childWidgets.push(t),t.containerWidget=e;var i=[];i.push(e);var n=this.parser.parseHeaderFooter({header:{},footer:{},evenHeader:{},evenFooter:{},firstPageHeader:{},firstPageFooter:{}},void 0);if(this.viewer&&(this.clearPreservedCollectionsInViewer(),this.documentHelper.userCollection.push("Everyone"),this.documentHelper.cachedPages=[],this.documentHelper.setDefaultDocumentFormat(),this.documentHelper.headersFooters.push(n),this.documentHelper.onDocumentChanged(i),this.editorModule)){this.editorModule.intializeDefaultStyles();var r=this.documentHelper.styles.findByName("Normal");t.paragraphFormat.baseStyle=r,t.paragraphFormat.listFormat.baseStyle=r}},i.prototype.getStyleNames=function(e){return this.viewer?this.documentHelper.styles.getStyleNames(e):[]},i.prototype.getStyles=function(e){return this.viewer?this.documentHelper.styles.getStyles(e):[]},i.prototype.getBookmarks=function(){var e=[];return this.viewer&&(e=this.documentHelper.getBookmarks(!0)),e},i.prototype.showDialog=function(e){switch(e){case"Hyperlink":this.showHyperlinkDialog();break;case"Table":this.showTableDialog();break;case"Bookmark":this.showBookmarkDialog();break;case"TableOfContents":this.showTableOfContentsDialog();break;case"PageSetup":this.showPageSetupDialog();break;case"List":this.showListDialog();break;case"Styles":this.showStylesDialog();break;case"Style":this.showStyleDialog();break;case"Paragraph":this.showParagraphDialog();break;case"Font":this.showFontDialog();break;case"TableProperties":this.showTablePropertiesDialog();break;case"BordersAndShading":this.showBordersAndShadingDialog();break;case"TableOptions":this.showTableOptionsDialog();break;case"SpellCheck":this.showSpellCheckDialog()}},i.prototype.showOptionsPane=function(){t.isNullOrUndefined(this.optionsPaneModule)||t.isNullOrUndefined(this.viewer)||this.optionsPaneModule.showHideOptionsPane(!0)},i.prototype.showRestrictEditingPane=function(e){e=!!t.isNullOrUndefined(e)||e,this.documentHelper&&this.documentHelper.restrictEditingPane&&this.documentHelper.restrictEditingPane.showHideRestrictPane(e)},i.prototype.showSpellCheckDialog=function(){if(this.spellCheckDialogModule&&this.spellChecker){var e=this.spellChecker.retriveText();t.isNullOrUndefined(e)||this.spellCheckDialogModule.show(e.text,e.element)}},i.prototype.destroy=function(){e.prototype.destroy.call(this),this.destroyDependentModules(),t.isNullOrUndefined(this.documentHelper)||this.documentHelper.destroy(),this.viewer=void 0,t.isNullOrUndefined(this.element)||(this.element.classList.remove("e-documenteditor"),this.element.innerHTML=""),this.element=void 0,this.findResultsList=[],this.findResultsList=void 0},i.prototype.destroyDependentModules=function(){this.printModule&&(this.printModule.destroy(),this.printModule=void 0),this.sfdtExportModule&&(this.sfdtExportModule.destroy(),this.sfdtExportModule=void 0),this.optionsPaneModule&&(this.optionsPaneModule.destroy(),this.optionsPaneModule=void 0),this.commentReviewPane&&(this.commentReviewPane.destroy(),this.commentReviewPane=void 0),this.trackChangesPane&&(this.trackChangesPane.destroy(),this.trackChangesPane=void 0),t.isNullOrUndefined(this.hyperlinkDialogModule)||(this.hyperlinkDialogModule.destroy(),this.hyperlinkDialogModule=void 0),this.searchModule&&(this.searchModule.destroy(),this.searchModule=void 0),this.contextMenuModule&&(this.contextMenuModule.destroy(),this.contextMenuModule=void 0),this.editorModule&&(this.editorModule.destroy(),this.editorModule=void 0),this.selectionModule&&(this.selectionModule.destroy(),this.selectionModule=void 0),this.editorHistoryModule&&(this.editorHistoryModule.destroy(),this.editorHistoryModule=void 0),t.isNullOrUndefined(this.paragraphDialogModule)||(this.paragraphDialogModule.destroy(),this.paragraphDialogModule=void 0),this.pageSetupDialogModule&&(this.pageSetupDialogModule.destroy(),this.pageSetupDialogModule=void 0),this.footNotesDialogModule&&(this.footNotesDialogModule.destroy(),this.footNotesDialogModule=void 0),this.fontDialogModule&&(this.fontDialogModule.destroy(),this.fontDialogModule=void 0),this.listDialogModule&&(this.listDialogModule.destroy(),this.listDialogModule=void 0),this.imageResizerModule&&(this.imageResizerModule.destroy(),this.imageResizerModule=void 0),this.tablePropertiesDialogModule&&(this.tablePropertiesDialogModule.destroy(),this.tablePropertiesDialogModule=void 0),this.bordersAndShadingDialogModule&&(this.bordersAndShadingDialogModule.destroy(),this.bordersAndShadingDialogModule=void 0),this.cellOptionsDialogModule&&(this.cellOptionsDialogModule.destroy(),this.cellOptionsDialogModule=void 0),this.tableOptionsDialogModule&&(this.tableOptionsDialogModule.destroy(),this.tableOptionsDialogModule=void 0),this.tableDialogModule&&(this.tableDialogModule.destroy(),this.tableDialogModule=void 0),this.styleDialogModule&&(this.styleDialogModule=void 0),this.bookmarkDialogModule&&(this.bookmarkDialogModule.destroy(),this.bookmarkDialogModule=void 0),this.styleDialogModule&&(this.styleDialogModule.destroy(),this.styleDialogModule=void 0),this.textExportModule&&(this.textExportModule.destroy(),this.textExportModule=void 0),this.wordExportModule&&(this.wordExportModule.destroy(),this.wordExportModule=void 0),this.tableOfContentsDialogModule&&(this.tableOfContentsDialogModule.destroy(),this.tableOfContentsDialogModule=void 0),this.spellCheckerModule&&(this.spellCheckerModule.destroy(),this.spellCheckerModule=void 0)};var n;return ki([t.Property("KeepSourceFormatting")],i.prototype,"defaultPasteOption",void 0),ki([t.Property("Pages")],i.prototype,"layoutType",void 0),ki([t.Property("")],i.prototype,"currentUser",void 0),ki([t.Property("#FFFF00")],i.prototype,"userColor",void 0),ki([t.Property(20)],i.prototype,"pageGap",void 0),ki([t.Property("")],i.prototype,"documentName",void 0),ki([t.Property("100%")],i.prototype,"width",void 0),ki([t.Property("200px")],i.prototype,"height",void 0),ki([t.Property("")],i.prototype,"serviceUrl",void 0),ki([t.Property(1)],i.prototype,"zoomFactor",void 0),ki([t.Property(2e3)],i.prototype,"zIndex",void 0),ki([t.Property(!0)],i.prototype,"isReadOnly",void 0),ki([t.Property(!1)],i.prototype,"enablePrint",void 0),ki([t.Property(!1)],i.prototype,"enableSelection",void 0),ki([t.Property(!1)],i.prototype,"enableEditor",void 0),ki([t.Property(!1)],i.prototype,"enableEditorHistory",void 0),ki([t.Property(!1)],i.prototype,"enableSfdtExport",void 0),ki([t.Property(!1)],i.prototype,"enableWordExport",void 0),ki([t.Property(!1)],i.prototype,"enableTextExport",void 0),ki([t.Property(!1)],i.prototype,"enableOptionsPane",void 0),ki([t.Property(!1)],i.prototype,"enableContextMenu",void 0),ki([t.Property(!1)],i.prototype,"enableHyperlinkDialog",void 0),ki([t.Property(!1)],i.prototype,"enableBookmarkDialog",void 0),ki([t.Property(!1)],i.prototype,"enableTableOfContentsDialog",void 0),ki([t.Property(!1)],i.prototype,"enableSearch",void 0),ki([t.Property(!1)],i.prototype,"enableParagraphDialog",void 0),ki([t.Property(!1)],i.prototype,"enableListDialog",void 0),ki([t.Property(!1)],i.prototype,"enableTablePropertiesDialog",void 0),ki([t.Property(!1)],i.prototype,"enableBordersAndShadingDialog",void 0),ki([t.Property(!1)],i.prototype,"enableFootnoteAndEndnoteDialog",void 0),ki([t.Property(!1)],i.prototype,"enablePageSetupDialog",void 0),ki([t.Property(!1)],i.prototype,"enableStyleDialog",void 0),ki([t.Property(!1)],i.prototype,"enableFontDialog",void 0),ki([t.Property(!1)],i.prototype,"enableTableOptionsDialog",void 0),ki([t.Property(!1)],i.prototype,"enableTableDialog",void 0),ki([t.Property(!1)],i.prototype,"enableImageResizer",void 0),ki([t.Property(!1)],i.prototype,"enableSpellCheck",void 0),ki([t.Property(!1)],i.prototype,"enableComment",void 0),ki([t.Property(!1)],i.prototype,"enableTrackChanges",void 0),ki([t.Property(!0)],i.prototype,"enableFormField",void 0),ki([t.Property(!1)],i.prototype,"acceptTab",void 0),ki([t.Property(!0)],i.prototype,"useCtrlClickToFollowHyperlink",void 0),ki([t.Property("#000000")],i.prototype,"pageOutline",void 0),ki([t.Property(!1)],i.prototype,"enableCursorOnReadOnly",void 0),ki([t.Property(!1)],i.prototype,"enableLocalPaste",void 0),ki([t.Property(!1)],i.prototype,"enableLockAndEdit",void 0),ki([t.Complex({},Li)],i.prototype,"documentEditorSettings",void 0),ki([t.Property({systemClipboard:"SystemClipboard",spellCheck:"SpellCheck",restrictEditing:"RestrictEditing",canLock:"CanLock",getPendingActions:"GetPendingActions"})],i.prototype,"serverActionSettings",void 0),ki([t.Property([])],i.prototype,"headers",void 0),ki([t.Property(!1)],i.prototype,"showComments",void 0),ki([t.Property(!1)],i.prototype,"showRevisions",void 0),ki([t.Event()],i.prototype,"documentChange",void 0),ki([t.Event()],i.prototype,"viewChange",void 0),ki([t.Event()],i.prototype,"zoomFactorChange",void 0),ki([t.Event()],i.prototype,"selectionChange",void 0),ki([t.Event()],i.prototype,"requestNavigate",void 0),ki([t.Event()],i.prototype,"contentChange",void 0),ki([t.Event()],i.prototype,"keyDown",void 0),ki([t.Event()],i.prototype,"searchResultsChange",void 0),ki([t.Event()],i.prototype,"created",void 0),ki([t.Event()],i.prototype,"destroyed",void 0),ki([t.Event()],i.prototype,"customContextMenuSelect",void 0),ki([t.Event()],i.prototype,"customContextMenuBeforeOpen",void 0),ki([t.Event()],i.prototype,"beforePaneSwitch",void 0),ki([t.Event()],i.prototype,"commentBegin",void 0),ki([t.Event()],i.prototype,"commentEnd",void 0),ki([t.Event()],i.prototype,"beforeFileOpen",void 0),ki([t.Event()],i.prototype,"commentDelete",void 0),ki([t.Event()],i.prototype,"beforeCommentAction",void 0),ki([t.Event()],i.prototype,"trackChange",void 0),ki([t.Event()],i.prototype,"beforeFormFieldFill",void 0),ki([t.Event()],i.prototype,"serviceFailure",void 0),ki([t.Event()],i.prototype,"afterFormFieldFill",void 0),ki([t.Event()],i.prototype,"actionComplete",void 0),ki([t.Event()],i.prototype,"contentControl",void 0),i=n=ki([t.NotifyPropertyChanges],i)}(t.Component),Ri=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Oi(i,e),ki([t.Property("SystemClipboard")],i.prototype,"systemClipboard",void 0),ki([t.Property("SpellCheck")],i.prototype,"spellCheck",void 0),ki([t.Property("RestrictEditing")],i.prototype,"restrictEditing",void 0),ki([t.Property("CanLock")],i.prototype,"canLock",void 0),ki([t.Property("GetPendingActions")],i.prototype,"getPendingActions",void 0),i}(t.ChildProperty),Di=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Oi(i,e),ki([t.Property("#cfcfcf")],i.prototype,"shadingColor",void 0),ki([t.Property(!0)],i.prototype,"applyShading",void 0),ki([t.Property("#cccccc")],i.prototype,"selectionColor",void 0),ki([t.Property("Popup")],i.prototype,"formFillingMode",void 0),ki([t.Property([])],i.prototype,"formattingExceptions",void 0),i}(t.ChildProperty),Mi=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Oi(i,e),ki([t.Property("")],i.prototype,"roomName",void 0),ki([t.Property("#22b24b")],i.prototype,"editableRegionColor",void 0),ki([t.Property("#f44336")],i.prototype,"lockedRegionColor",void 0),ki([t.Property(3e3)],i.prototype,"saveTimeout",void 0),i}(t.ChildProperty),Ai=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return Oi(i,e),ki([t.Property("Import")],i.prototype,"import",void 0),i}(Ri),Ui="_use_local_clipboard",zi=function(){function e(e){this.isCommentEditing=!1,this.container=e,this.importHandler=new v}return Object.defineProperty(e.prototype,"documentEditor",{get:function(){return this.container.documentEditor},enumerable:!0,configurable:!0}),e.prototype.getModuleName=function(){return"toolbar"},e.prototype.enableItems=function(e,t){this.toolbar.enableItems(e,t)},e.prototype.initToolBar=function(e){this.toolbarItems=e,this.renderToolBar(),this.wireEvent()},e.prototype.renderToolBar=function(){if(!t.isNullOrUndefined(this.container)){var e=this.container.toolbarContainer,i=t.createElement("div",{className:"e-de-tlbr-wrapper"}),n=t.createElement("div",{className:"e-de-toolbar"});this.initToolbarItems(),i.appendChild(n),e.appendChild(i);var o=t.createElement("div",{className:"e-de-ctnr-properties-pane-btn"});this.buttonElement=t.createElement("button",{attrs:{type:"button"}}),o.appendChild(this.buttonElement);var s="e-tbar-btn e-tbtn-txt e-control e-btn e-de-showhide-btn",a="e-icons e-de-ctnr-showhide";this.container.enableRtl&&(s+="-rtl",a="e-icons e-de-ctnr-showhide e-de-flip"),this.propertiesPaneButton=new r.Button({cssClass:s,iconCss:a});var l=this.container.localObj;this.buttonElement.title=l.getConstant("Hide properties pane"),this.propertiesPaneButton.appendTo(this.buttonElement),t.EventHandler.add(this.buttonElement,"click",this.showHidePropertiesPane,this),e.appendChild(o),this.toolbar.appendTo(n),this.initToolbarDropdown(n)}},e.prototype.initToolbarDropdown=function(e){var i=this;if(this.container){var n=this.container.localObj,r=this.container.element.id+"_toolbar";if(this.toolbarItems.indexOf("Image")>=0){var o=e.getElementsByClassName("e-de-image-splitbutton")[0].firstChild,s={items:[{text:n.getConstant("Upload from computer"),iconCss:"e-icons e-de-ctnr-upload",id:r+"_image_local"}],cssClass:"e-de-toolbar-btn-first e-caret-hide",iconCss:"e-icons e-de-ctnr-image",select:this.onDropDownButtonSelect.bind(this)};t.isNullOrUndefined(this.imgDropDwn)||(this.imgDropDwn=void 0),this.imgDropDwn=new d.DropDownButton(s,o)}if(this.toolbarItems.indexOf("Break")>=0){var a=e.getElementsByClassName("e-de-break-splitbutton")[0].firstChild,s={items:[{text:n.getConstant("Page Break"),iconCss:"e-icons e-de-ctnr-page-break",id:r+"_page_break"},{text:n.getConstant("Section Break"),iconCss:"e-icons e-de-ctnr-section-break",id:r+"_section_break"}],cssClass:"e-caret-hide",iconCss:"e-icons e-de-ctnr-break",select:this.onDropDownButtonSelect.bind(this)};t.isNullOrUndefined(this.breakDropDwn)||(this.breakDropDwn=void 0),this.breakDropDwn=new d.DropDownButton(s,a)}if(this.filePicker=t.createElement("input",{attrs:{type:"file",accept:".doc,.docx,.rtf,.txt,.htm,.html,.sfdt"},className:"e-de-ctnr-file-picker"}),t.Browser.isIE&&document.body.appendChild(this.filePicker),this.imagePicker=t.createElement("input",{attrs:{type:"file",accept:".jpg,.jpeg,.png,.bmp"},className:"e-de-ctnr-file-picker"}),t.Browser.isIE&&document.body.appendChild(this.imagePicker),this.toolbarItems.indexOf("LocalClipboard")>=0&&this.toggleButton(r+Ui,this.container.enableLocalPaste),this.toolbarItems.indexOf("TrackChanges")>=0&&this.toggleButton(r+"_track",this.container.enableTrackChanges),this.toolbarItems.indexOf("RestrictEditing")>=0){this.toggleButton(r+"_restrict_edit",this.container.restrictEditing);var l=e.getElementsByClassName("e-de-lock-dropdownbutton")[0].firstChild,h="";this.container.restrictEditing&&(h=" e-de-selected-item");s={items:[{text:n.getConstant("Read only"),id:r+"_read_only",iconCss:"e-icons"+h},{text:n.getConstant("Protections"),id:r+"_protections",iconCss:"e-icons"}],cssClass:"e-de-toolbar-btn-first e-caret-hide",select:this.onDropDownButtonSelect.bind(this),beforeItemRender:function(e){i.onBeforeRenderRestrictDropdown(e,r)}};t.isNullOrUndefined(this.restrictDropDwn)||(this.restrictDropDwn=void 0),this.restrictDropDwn=new d.DropDownButton(s,l)}if(this.toolbarItems.indexOf("FormFields")>=0){var a=e.getElementsByClassName("e-de-formfields")[0].firstChild,s={items:[{text:n.getConstant("Text Form"),iconCss:"e-icons e-de-textform",id:r+"_text_form"},{text:n.getConstant("Check Box"),iconCss:"e-icons e-de-checkbox-form",id:r+"_checkbox"},{text:n.getConstant("DropDown"),iconCss:"e-icons e-de-dropdownform",id:r+"_dropdown"}],cssClass:"e-de-toolbar-btn-first e-caret-hide",select:this.onDropDownButtonSelect.bind(this)};t.isNullOrUndefined(this.formFieldDropDown)||(this.formFieldDropDown=void 0),this.formFieldDropDown=new d.DropDownButton(s,a)}}},e.prototype.onBeforeRenderRestrictDropdown=function(e,i){var n=e.element.getElementsByClassName("e-menu-icon")[0];if(!t.isNullOrUndefined(n)&&(e.item.id===i+"_read_only"&&this.toggleRestrictIcon(n,this.container.restrictEditing),e.item.id===i+"_protections")){var r=document.getElementsByClassName("e-de-restrict-pane")[0];if(!t.isNullOrUndefined(r)){var o=!("none"===r.style.display);this.toggleRestrictIcon(n,o)}}},e.prototype.toggleRestrictIcon=function(e,t){t?e.classList.add("e-de-selected-item"):e.classList.remove("e-de-selected-item")},e.prototype.showHidePropertiesPane=function(){var e=document.getElementsByClassName("e-de-ctnr-properties-pane-btn")[0],i=this.container.localObj;"none"===this.container.propertiesPaneContainer.style.display?(this.container.showPropertiesPane=!0,e.classList.remove("e-de-pane-disable-clr"),this.buttonElement.title=i.getConstant("Hide properties pane"),t.classList(e,["e-de-pane-enable-clr"],[]),this.container.trigger("beforePaneSwitch",{type:"PropertiesPane"})):this.container.previousContext.indexOf("Header")>=0||this.container.previousContext.indexOf("Footer")>=0?this.container.showHeaderProperties=!this.container.showHeaderProperties:(this.container.showPropertiesPane=!1,e.classList.remove("e-de-pane-enable-clr"),this.buttonElement.title=i.getConstant("Show properties pane"),t.classList(e,["e-de-pane-disable-clr"],[])),this.enableDisablePropertyPaneButton(this.container.showPropertiesPane),this.container.showPropertiesPaneOnSelection(),this.documentEditor.focusIn()},e.prototype.onWrapText=function(e){var t="",i=e.lastIndexOf(" ");return t=e.slice(0,i),e.slice(i),t+='<div class="e-de-text-wrap">'+e.slice(i)+"</div>"},e.prototype.wireEvent=function(){this.propertiesPaneButton.on("click",this.togglePropertiesPane.bind(this)),t.EventHandler.add(this.filePicker,"change",this.onFileChange,this),t.EventHandler.add(this.imagePicker,"change",this.onImageChange,this)},e.prototype.initToolbarItems=function(){this.toolbar=new i.Toolbar({enableRtl:this.container.enableRtl,clicked:this.clickHandler.bind(this),items:this.getToolbarItems()})},e.prototype.reInitToolbarItems=function(e){var i=this;this.toolbarItems=e;var n=this.container.toolbarContainer;this.toolbar.items=this.getToolbarItems(),this.toolbarTimer=setTimeout(function(){i.toolbarTimer&&clearTimeout(i.toolbarTimer),i.initToolbarDropdown(n),e.indexOf("Open")>=0&&t.EventHandler.add(i.filePicker,"change",i.onFileChange,i),e.indexOf("Image")>=0&&t.EventHandler.add(i.imagePicker,"change",i.onImageChange,i)},200)},e.prototype.getToolbarItems=function(){for(var e,t=this.container.localObj,i=this.container.element.id+"_toolbar",n=[],r=this.toolbarItems,o=0;o<this.toolbarItems.length;o++)switch(e=0===o?"e-de-toolbar-btn-start":"Separator"===r[o+1]&&"Separator"===r[o-1]?"e-de-toolbar-btn":"Separator"===r[o+1]?"e-de-toolbar-btn-last":"Separator"===r[o-1]?"e-de-toolbar-btn-first":o===this.toolbarItems.length-1?"e-de-toolbar-btn-end":"e-de-toolbar-btn-middle",r[o]){case"Separator":n.push({type:"Separator",cssClass:"e-de-separator"});break;case"New":n.push({prefixIcon:"e-de-ctnr-new",tooltipText:t.getConstant("Create a new document"),id:i+"_new",text:t.getConstant("New"),cssClass:e});break;case"Open":n.push({prefixIcon:"e-de-ctnr-open",tooltipText:t.getConstant("Open a document"),id:i+"_open",text:t.getConstant("Open"),cssClass:e});break;case"Undo":n.push({prefixIcon:"e-de-ctnr-undo",tooltipText:t.getConstant("Undo Tooltip"),id:i+"_undo",text:t.getConstant("Undo"),cssClass:e});break;case"Redo":n.push({prefixIcon:"e-de-ctnr-redo",tooltipText:t.getConstant("Redo Tooltip"),id:i+"_redo",text:t.getConstant("Redo"),cssClass:e});break;case"Comments":n.push({prefixIcon:"e-de-cnt-cmt-add",tooltipText:t.getConstant("Show comments"),id:i+"_comment",text:t.getConstant("Comments"),cssClass:e});break;case"TrackChanges":n.push({prefixIcon:"e-de-cnt-track",tooltipText:t.getConstant("Track Changes"),id:i+"_track",text:this.onWrapText(t.getConstant("TrackChanges")),cssClass:e});break;case"Image":n.push({tooltipText:t.getConstant("Insert inline picture from a file."),id:i+"_image",text:t.getConstant("Image"),cssClass:e+" e-de-image-splitbutton e-de-image-focus"});break;case"Table":n.push({prefixIcon:"e-de-ctnr-table",tooltipText:t.getConstant("Insert a table into the document"),id:i+"_table",text:t.getConstant("Table"),cssClass:e});break;case"Hyperlink":n.push({prefixIcon:"e-de-ctnr-link",tooltipText:t.getConstant("Create Hyperlink"),id:i+"_link",text:t.getConstant("Link"),cssClass:e});break;case"Bookmark":n.push({prefixIcon:"e-de-ctnr-bookmark",tooltipText:t.getConstant("Insert a bookmark in a specific place in this document"),id:i+"_bookmark",text:t.getConstant("Bookmark"),cssClass:e});break;case"TableOfContents":n.push({prefixIcon:"e-de-ctnr-tableofcontent",tooltipText:t.getConstant("Provide an overview of your document by adding a table of contents"),id:i+"_toc",text:this.onWrapText(t.getConstant("Table of Contents")),cssClass:e});break;case"Header":n.push({prefixIcon:"e-de-ctnr-header",tooltipText:t.getConstant("Add or edit the header"),id:i+"_header",text:t.getConstant("Header"),cssClass:e});break;case"Footer":n.push({prefixIcon:"e-de-ctnr-footer",tooltipText:t.getConstant("Add or edit the footer"),id:i+"_footer",text:t.getConstant("Footer"),cssClass:e});break;case"PageSetup":n.push({prefixIcon:"e-de-ctnr-pagesetup",tooltipText:t.getConstant("Open the page setup dialog"),id:i+"_page_setup",text:this.onWrapText(t.getConstant("Page Setup")),cssClass:e});break;case"PageNumber":n.push({prefixIcon:"e-de-ctnr-pagenumber",tooltipText:t.getConstant("Add page numbers"),id:i+"_page_number",text:this.onWrapText(t.getConstant("Page Number")),cssClass:e});break;case"Break":n.push({tooltipText:t.getConstant("Break"),text:t.getConstant("Break"),id:"_break",cssClass:e+" e-de-break-splitbutton"});break;case"Find":n.push({prefixIcon:"e-de-ctnr-find",tooltipText:t.getConstant("Find Text"),id:i+"_find",text:t.getConstant("Find"),cssClass:e});break;case"LocalClipboard":n.push({prefixIcon:"e-de-ctnr-paste",tooltipText:t.getConstant("Toggle between the internal clipboard and system clipboard"),id:i+Ui,text:this.onWrapText(t.getConstant("Local Clipboard")),cssClass:e});break;case"RestrictEditing":n.push({prefixIcon:"e-de-ctnr-lock",tooltipText:t.getConstant("Restrict editing"),id:i+"_restrict_edit",text:this.onWrapText(t.getConstant("Restrict Editing")),cssClass:e+" e-de-lock-dropdownbutton"});break;case"FormFields":n.push({prefixIcon:"e-de-formfield",tooltipText:t.getConstant("Form Fields"),id:i+"_form_fields",text:this.onWrapText(t.getConstant("Form Fields")),cssClass:e+" e-de-formfields"});break;case"UpdateFields":n.push({prefixIcon:"e-de-update-field",tooltipText:t.getConstant("Update cross reference fields"),id:i+"_update_fields",text:this.onWrapText(t.getConstant("Update Fields")),cssClass:e+" e-de-formfields"});break;case"InsertFootnote":n.push({prefixIcon:"e-de-footnote",tooltipText:t.getConstant("Footnote Tooltip"),text:this.onWrapText(t.getConstant("Insert Footnote")),id:i+"_footnote",cssClass:e});break;case"InsertEndnote":n.push({prefixIcon:"e-de-endnote",tooltipText:t.getConstant("Endnote Tooltip"),text:this.onWrapText(t.getConstant("Insert Endnote")),id:i+"_endnote",cssClass:e});break;default:n.push(r[o])}return n},e.prototype.clickHandler=function(e){var t=this.container.element.id+"_toolbar";switch(e.item.id){case t+"_new":this.container.documentEditor.openBlank();break;case t+"_open":this.filePicker.value="",this.filePicker.click();break;case t+"_undo":this.container.documentEditor.editorHistory.undo();break;case t+"_redo":this.container.documentEditor.editorHistory.redo();break;case t+"_table":this.container.documentEditor.showDialog("Table");break;case t+"_link":this.container.documentEditor.showDialog("Hyperlink");break;case t+"_bookmark":this.container.documentEditor.showDialog("Bookmark");break;case t+"_comment":this.documentEditor.editor.insertComment("");break;case t+"_track":this.toggleTrackChangesInternal(e.item.id);break;case t+"_header":this.container.documentEditor.selection.goToHeader(),this.container.statusBar.toggleWebLayout();break;case t+"_toc":this.onToc();break;case t+"_footer":this.container.documentEditor.selection.goToFooter(),this.container.statusBar.toggleWebLayout();break;case t+"_page_setup":this.container.documentEditor.showDialog("PageSetup");break;case t+"_page_number":this.container.documentEditor.editor.insertPageNumber();break;case t+"_find":this.container.documentEditor.showOptionsPane();break;case t+Ui:this.toggleLocalPaste(e.item.id);break;case t+"_update_fields":this.documentEditor.updateFields();break;case t+"_footnote":this.documentEditor.editor.insertFootnote();break;case t+"_endnote":this.documentEditor.editor.insertEndnote();break;default:this.container.trigger("toolbarClick",e)}e.item.id!==t+"_find"&&e.item.id!==t+"_image"&&this.container.documentEditor.focusIn()},e.prototype.toggleLocalPaste=function(e){this.container.enableLocalPaste=!this.container.enableLocalPaste,this.toggleButton(e,this.container.enableLocalPaste)},e.prototype.toggleEditing=function(){this.container.restrictEditing=!this.container.restrictEditing,this.container.showPropertiesPane=!this.container.restrictEditing},e.prototype.toggleButton=function(e,i){var n=document.getElementById(e);i?t.classList(n,["e-btn-toggle"],[]):t.classList(n,[],["e-btn-toggle"])},e.prototype.toggleTrackChangesInternal=function(e,i){t.isNullOrUndefined(i)||(this.container.enableTrackChanges=!i),this.container.enableTrackChanges=!this.container.enableTrackChanges,this.container.documentEditor.showRevisions=this.container.enableTrackChanges,this.toggleButton(e,this.container.enableTrackChanges)},e.prototype.togglePropertiesPane=function(){this.container.showPropertiesPane=!this.container.showPropertiesPane},e.prototype.onDropDownButtonSelect=function(e){var t=this,i=this.container.element.id+"_toolbar",n=e.item.id;n===i+"_page_break"?this.container.documentEditor.editorModule.insertPageBreak():n===i+"_section_break"?this.container.documentEditor.editorModule.insertSectionBreak():n===i+"_image_local"?(this.imagePicker.value="",this.imagePicker.click()):n===i+"_image_url"||(n===i+"_read_only"?this.toggleEditing():n===i+"_protections"?this.documentEditor.documentHelper.restrictEditingPane.showHideRestrictPane(!0):n===i+"_checkbox"?this.documentEditor.editor.insertFormField("CheckBox"):n===i+"_dropdown"?this.documentEditor.editor.insertFormField("DropDown"):n===i+"_text_form"&&this.documentEditor.editor.insertFormField("Text")),setTimeout(function(){t.documentEditor.focusIn()},30)},e.prototype.onFileChange=function(){var e=this,t=this.filePicker.files[0],i={fileSize:t.size,isCanceled:void 0};if(this.documentEditor.trigger("beforeFileOpen",i),!i.isCanceled&&t){if(".sfdt"===t.name.substr(t.name.lastIndexOf("."))){var n=new FileReader;n.onload=function(){e.container.documentEditor.open(n.result)},n.readAsText(t)}else this.convertToSfdt(t);this.container.documentEditor.documentName=t.name.substr(0,t.name.lastIndexOf("."))}},e.prototype.convertToSfdt=function(e){n.showSpinner(this.container.containerTarget),this.importHandler.url=this.container.serviceUrl+this.container.serverActionSettings.import,this.importHandler.onSuccess=this.successHandler.bind(this),this.importHandler.onFailure=this.failureHandler.bind(this),this.importHandler.onError=this.failureHandler.bind(this),this.importHandler.customHeaders=this.container.headers;var t=new FormData;t.append("files",e),this.importHandler.send(t)},e.prototype.failureHandler=function(e){"onError"===e.name?n.DialogUtility.alert({content:this.container.localObj.getConstant("Error in establishing connection with web server"),closeOnEscape:!0,showCloseIcon:!0,position:{X:"Center",Y:"Center"}}):(alert("Failed to load the file"),this.documentEditor.fireServiceFailure(e)),n.hideSpinner(this.container.containerTarget)},e.prototype.successHandler=function(e){this.container.documentEditor.open(e.data),n.hideSpinner(this.container.containerTarget)},e.prototype.onImageChange=function(){var e=this,t=this.imagePicker.files[0],i=new FileReader;i.onload=function(){e.insertImage(i.result)},i.readAsDataURL(t)},e.prototype.insertImage=function(e){var t=document.createElement("img"),i=this.container;t.addEventListener("load",function(){i.documentEditor.editor.insertImage(e,this.width,this.height)}),t.src=e},e.prototype.enableDisableFormField=function(e){var i=document.getElementById("container_toolbar_form_fields");t.isNullOrUndefined(i)||this.toolbar.enableItems(i.parentElement,e)},e.prototype.enableDisableInsertComment=function(e){this.isCommentEditing=!e;var i=this.container.element.id+"_toolbar"+"_comment",n=document.getElementById(i);!this.container.enableComment&&n?this.toolbar.removeItems(n.parentElement):n&&(t.isNullOrUndefined(this.documentEditor)||!this.documentEditor.isReadOnly&&!this.documentEditor.documentHelper.isDocumentProtected||(e=!1),this.toolbar.enableItems(n.parentElement,e))},e.prototype.toggleTrackChanges=function(e){var t=this.container.element.id+"_toolbar_track";document.getElementById(t)&&this.toggleTrackChangesInternal(t,e)},e.prototype.enableDisableToolBarItem=function(e,i){for(var n=this.container.element.id+"_toolbar",r=0,o=this.toolbar.items;r<o.length;r++){var s=o[r],a=s.id;if(a!==n+"_new"&&a!==n+"_open"&&a!==n+"_find"&&a!==n+Ui&&a!==n+"_restrict_edit"&&a!==n+"_update_fields"&&"Separator"!==s.type){if(e&&this.isCommentEditing&&a===n+"_comment")continue;if(a!==n+"_undo"&&a!==n+"_redo"&&a!==n+"_table"&&a!==n+"_link"&&a!==n+"_bookmark"&&a!==n+"_comment"&&a!==n+"_header"&&a!==n+"_toc"&&a!==n+"_footer"&&a!==n+"_page_setup"&&a!==n+"_page_number"&&a!==n+"_image"&&a!==n+"_form_fields"&&"_break"!==a&&a!==n+"_track"&&a!==n+"_footnote"&&a!==n+"_endnote")continue;var l=document.getElementById(s.id);this.toolbar.enableItems(l.parentElement,e)}}t.isNullOrUndefined(this.documentEditor)||this.enableDisableFormField(!this.documentEditor.enableHeaderAndFooter&&e&&!this.documentEditor.isReadOnlyMode),(this.documentEditor.selection.isinFootnote||this.documentEditor.selection.isinEndnote)&&(e=!1,this.toolbar.enableItems(document.getElementById(n+"_endnote").parentElement,e),this.toolbar.enableItems(document.getElementById(n+"_footnote").parentElement,e)),i&&!this.container.showPropertiesPane||(i&&(e=this.container.showPropertiesPane),t.classList(this.propertiesPaneButton.element.parentElement,e?[]:["e-de-overlay"],e?["e-de-overlay"]:[])),(e||this.documentEditor.documentHelper.isDocumentProtected&&"FormFieldsOnly"===this.documentEditor.documentHelper.protectionType)&&this.enableDisableUndoRedo()},e.prototype.enableDisableUndoRedo=function(){var e=this.container.element.id+"_toolbar";this.toolbarItems.indexOf("Undo")>=0&&this.toolbar.enableItems(document.getElementById(e+"_undo").parentElement,this.container.documentEditor.editorHistory.canUndo()),this.toolbarItems.indexOf("Redo")>=0&&this.toolbar.enableItems(document.getElementById(e+"_redo").parentElement,this.container.documentEditor.editorHistory.canRedo())},e.prototype.onToc=function(){if("TableOfContents"===this.container.previousContext&&"none"===this.container.propertiesPaneContainer.style.display)return this.container.showPropertiesPane=!1,void this.documentEditor.focusIn();"block"===this.container.headerFooterProperties.element.style.display&&this.documentEditor.selection.closeHeaderFooter(),this.enableDisablePropertyPaneButton(!1),this.container.showProperties("toc")},e.prototype.enableDisablePropertyPaneButton=function(e){e?t.classList(this.propertiesPaneButton.element.firstChild,["e-pane-enabled"],["e-pane-disabled"]):t.classList(this.propertiesPaneButton.element.firstChild,["e-pane-disabled"],["e-pane-enabled"])},e.prototype.destroy=function(){if(this.restrictDropDwn&&(this.restrictDropDwn.destroy(),this.restrictDropDwn=void 0),this.imgDropDwn&&(this.imgDropDwn.destroy(),this.imgDropDwn=void 0),this.breakDropDwn&&(this.breakDropDwn.destroy(),this.breakDropDwn=void 0),this.formFieldDropDown&&(this.formFieldDropDown.destroy(),this.formFieldDropDown=void 0),this.toolbar){var e=this.toolbar.element;this.toolbar.destroy(),this.toolbar=void 0,e.parentElement.removeChild(e)}this.container.toolbarContainer&&(this.container.containerTarget.removeChild(this.container.toolbarContainer),this.container.toolbarContainer=void 0),this.container.toolbarModule&&(this.container.toolbarModule=void 0),this.container=void 0},e}(),Vi=function(){function e(e,i){var n=this;this.isRetrieving=!1,this.appliedHighlightColor="rgb(255, 255, 0)",this.createChangecase=function(e){var i=n.createDropdownForChangeCase(),r=t.createElement("div",{id:e.id+"_changeCase",className:"e-de-ctnr-group-btn"}),o=t.createElement("button",{id:r.id+"_dropdownBtn",attrs:{type:"button"}});r.appendChild(o),e.appendChild(r),i.appendTo(o)},this.createDropdownForChangeCase=function(){var e=[{text:"UPPERCASE"}];return new d.DropDownButton({items:e,iconCss:"e-icons e-de-ctnr-change-case",enableRtl:n.isRtl,select:function(e){n.isRetrieving=!1,n.changeCase(e)}})},this.changeCase=function(e){if(!n.isRetrieving)switch(e.item.text){case"UPPERCASE":!n.documentEditor.isReadOnly&&n.documentEditor.editor&&n.documentEditor.editor.changeCase("Uppercase")}},this.container=e,this.isRtl=i}return Object.defineProperty(e.prototype,"documentEditor",{get:function(){return this.container.documentEditor},enumerable:!0,configurable:!0}),e.prototype.initializeTextPropertiesDiv=function(e,i){this.localObj=new t.L10n("documenteditorcontainer",this.container.defaultLocale,this.container.locale),this.textProperties=e;var n=this.documentEditor.element.id+"_font_properties",r=this.createDiv(n+"_text",e);t.classList(r,["e-de-cntr-pane-padding","e-de-prop-separator-line"],[]);var o=t.createElement("label",{className:"e-de-ctnr-prop-label"});o.innerHTML=this.localObj.getConstant("Text"),r.appendChild(o);var s=this.createDiv(n+"_sizeStyle",r,"display:inline-flex;");t.classList(s,["e-de-ctnr-segment"],[]),i&&t.classList(s,["e-de-ctnr-segment-rtl"],[]);var a=this.createDiv(n+"_fontFamilyDiv",s),l=t.createElement("input",{id:n+"_fontFamily",className:"e-prop-font-style"});a.appendChild(l),t.classList(a,["e-de-panel-left-width"],[]),this.createDropDownListForFamily(l);var d=this.createDiv(n+"_fontSizeDiv",s),h="e-de-ctnr-group-btn e-de-char-fmt-btn-left e-btn-group";i&&(h="e-rtl "+h);var c=t.createElement("input",{id:n+"_fontSize",innerHTML:"type:number",className:"e-prop-font-style"});d.appendChild(c),t.classList(d,["e-de-panel-right-width"],[]),this.createDropDownListForSize(c);var p=t.createElement("div",{id:n+"_properties",styles:"display:inline-flex;",className:"e-de-ctnr-segment"});i&&t.classList(p,["e-de-ctnr-segment-rtl"],[]),r.appendChild(p);var u=t.createElement("div",{id:n+"_leftDiv",className:h,styles:"display:inline-flex;"});p.appendChild(u),this.bold=this.createButtonTemplate(n+"_bold","e-de-ctnr-bold e-icons",u,"e-de-prop-font-button","40.5",this.localObj.getConstant("Bold Tooltip")),this.italic=this.createButtonTemplate(n+"_italic","e-de-ctnr-italic e-icons",u,"e-de-prop-font-button","40.5",this.localObj.getConstant("Italic Tooltip")),this.underline=this.createButtonTemplate(n+"_underline","e-de-ctnr-underline e-icons",u,"e-de-prop-font-button","40.5",this.localObj.getConstant("Underline Tooltip")),this.strikethrough=this.createButtonTemplate(n+"_strikethrough","e-de-ctnr-strikethrough e-icons",u,"e-de-prop-font-last-button","40.5",this.localObj.getConstant("Strikethrough")),h="e-de-ctnr-group-btn e-de-char-fmt-btn-right e-btn-group",i&&(h="e-rtl "+h);var g=t.createElement("div",{id:n+"_rightDiv",className:h,styles:"display:inline-flex;"});p.appendChild(g),this.superscript=this.createButtonTemplate(n+"_superscript","e-de-ctnr-superscript e-icons",g,"e-de-prop-font-button","38.5",this.localObj.getConstant("Superscript Tooltip")),this.subscript=this.createButtonTemplate(n+"_subscript","e-de-ctnr-subscript e-icons",g,"e-de-prop-font-last-button","38.5",this.localObj.getConstant("Subscript Tooltip"));var m=t.createElement("div",{id:n+"_colorDiv",styles:"display:inline-flex;",className:"e-de-ctnr-segment"});i&&t.classList(p,["e-de-ctnr-segment-rtl"],[]);var f=t.createElement("div",{id:n+"_color",className:"e-de-font-clr-picker e-de-ctnr-group-btn",styles:"display:inline-flex;"});i&&t.classList(f,["e-rtl"],[]),m.appendChild(f),r.appendChild(m),this.fontColor=this.createFontColorPicker(n+"_textColor",40.5,f,this.localObj.getConstant("Font color")),t.classList(f.firstElementChild.lastElementChild.lastElementChild.firstChild,["e-de-ctnr-fontcolor","e-icons"],["e-caret"]),this.initializeHighlightColorElement(),this.highlightColor=this.createHighlightColorSplitButton(n+"_highlightColor",34.5,f,this.localObj.getConstant("Text highlight color")),t.classList(this.highlightColor.element.nextElementSibling.firstElementChild,["e-de-ctnr-highlight","e-icons"],["e-caret"]),this.highlightColorInputElement=this.highlightColor.element.firstChild,this.clearFormat=this.createButtonTemplate(n+"_clearFormat","e-de-ctnr-clearall e-icons",f,"e-de-prop-font-last-button","40.5",this.localObj.getConstant("Clear all formatting"));var v=t.createElement("div",{id:n+"_rightDiv2",className:h,styles:"display:inline-flex;"});i&&t.classList(v,["e-rtl"],[]),v.setAttribute("title",this.container.localObj.getConstant("Change case Tooltip")),r.appendChild(v),this.createChangecase(v)},e.prototype.createHighlightColorSplitButton=function(e,i,n,r){var o=this,s=t.createElement("button",{id:e,attrs:{type:"button"}});n.appendChild(s);var a=new d.SplitButton({cssClass:"e-de-btn-hghlclr",iconCss:"e-de-ctnr-hglt-color",target:this.highlightColorElement,close:this.closePopup.bind(this),beforeOpen:this.openPopup.bind(this),enableRtl:this.isRtl});return a.appendTo(s),a.click=function(){o.applyHighlightColor(o.highlightColorInputElement.style.backgroundColor)},a.element.firstChild.style.backgroundColor="rgb(255, 255, 0)",a.element.parentElement.setAttribute("title",r),a},e.prototype.openPopup=function(){this.highlightColorElement.style.display="block"},e.prototype.closePopup=function(){this.highlightColorElement.style.display="none"},e.prototype.initializeHighlightColorElement=function(){this.highlightColorElement=t.createElement("div",{id:"highlight_color_ppty",styles:"display:none;width:157px",className:"e-de-cntr-highlight-pane"});var e=this.createHightlighColorPickerDiv("#ffff00","yellowDiv"),i=this.createHightlighColorPickerDiv("#00ff00","brightGreenDiv"),n=this.createHightlighColorPickerDiv("#00ffff","turquoiseDiv"),r=this.createHightlighColorPickerDiv("#ff00ff","hotPinkDiv"),o=this.createHightlighColorPickerDiv("#0000ff","blueDiv"),s=this.createHightlighColorPickerDiv("#ff0000","redDiv"),a=this.createHightlighColorPickerDiv("#000080","darkBlueDiv"),l=this.createHightlighColorPickerDiv("#008080","tealDiv"),d=this.createHightlighColorPickerDiv("#008000","greenDiv"),h=this.createHightlighColorPickerDiv("#800080","violetDiv"),c=this.createHightlighColorPickerDiv("#800000","darkRedDiv"),p=this.createHightlighColorPickerDiv("#808000","darkYellowDiv"),u=this.createHightlighColorPickerDiv("#808080","gray50Div"),g=this.createHightlighColorPickerDiv("#c0c0c0","gray25Div"),m=this.createHightlighColorPickerDiv("#000000","blackDiv"),f=t.createElement("div",{className:"e-hglt-no-color"});this.highlightColorElement.appendChild(f);var v=t.createElement("div",{styles:"width:24px;height:24px;background-color:#ffffff;margin:3px;",id:"noColorDiv"});f.appendChild(v);var y=t.createElement("div",{innerHTML:"No color",className:"e-de-ctnr-hglt-no-color"});v.appendChild(y),e.addEventListener("click",this.onHighLightColor.bind(this)),i.addEventListener("click",this.onHighLightColor.bind(this)),n.addEventListener("click",this.onHighLightColor.bind(this)),r.addEventListener("click",this.onHighLightColor.bind(this)),o.addEventListener("click",this.onHighLightColor.bind(this)),s.addEventListener("click",this.onHighLightColor.bind(this)),a.addEventListener("click",this.onHighLightColor.bind(this)),l.addEventListener("click",this.onHighLightColor.bind(this)),d.addEventListener("click",this.onHighLightColor.bind(this)),h.addEventListener("click",this.onHighLightColor.bind(this)),c.addEventListener("click",this.onHighLightColor.bind(this)),p.addEventListener("click",this.onHighLightColor.bind(this)),u.addEventListener("click",this.onHighLightColor.bind(this)),g.addEventListener("click",this.onHighLightColor.bind(this)),m.addEventListener("click",this.onHighLightColor.bind(this)),f.addEventListener("click",this.onHighLightColor.bind(this))},e.prototype.createHightlighColorPickerDiv=function(e,i){var n=t.createElement("div",{className:"e-de-ctnr-hglt-btn",id:i});return n.style.backgroundColor=e,this.highlightColorElement.appendChild(n),n},e.prototype.onHighLightColor=function(e){this.documentEditor.selection&&(this.applyHighlightColor(e.currentTarget.style.backgroundColor),this.highlightColor.toggle())},e.prototype.applyHighlightColorAsBackground=function(e){this.removeSelectedColorDiv(),"NoColor"===e?this.highlightColorElement.querySelector("#noColorDiv").classList.add("e-color-selected"):"Yellow"===e?this.highlightColorElement.querySelector("#yellowDiv").classList.add("e-color-selected"):"BrightGreen"===e?this.highlightColorElement.querySelector("#brightGreenDiv").classList.add("e-color-selected"):"Turquoise"===e?this.highlightColorElement.querySelector("#turquoiseDiv").classList.add("e-color-selected"):"Pink"===e?this.highlightColorElement.querySelector("#hotPinkDiv").classList.add("e-color-selected"):"Red"===e?this.highlightColorElement.querySelector("#redDiv").classList.add("e-color-selected"):"DarkBlue"===e?this.highlightColorElement.querySelector("#darkBlueDiv").classList.add("e-color-selected"):"Teal"===e?this.highlightColorElement.querySelector("#tealDiv").classList.add("e-color-selected"):"Green"===e?this.highlightColorElement.querySelector("#greenDiv").classList.add("e-color-selected"):"Violet"===e?this.highlightColorElement.querySelector("#violetDiv").classList.add("e-color-selected"):"DarkRed"===e?this.highlightColorElement.querySelector("#darkRedDiv").classList.add("e-color-selected"):"DarkYellow"===e?this.highlightColorElement.querySelector("#darkYellowDiv").classList.add("e-color-selected"):"Gray50"===e?this.highlightColorElement.querySelector("#gray50Div").classList.add("e-color-selected"):"Gray25"===e?this.highlightColorElement.querySelector("#gray25Div").classList.add("e-color-selected"):"Black"===e?this.highlightColorElement.querySelector("#blackDiv").classList.add("e-color-selected"):"Blue"===e&&this.highlightColorElement.querySelector("#blueDiv").classList.add("e-color-selected")},e.prototype.removeSelectedColorDiv=function(){this.highlightColorElement.querySelector("#noColorDiv").classList.remove("e-color-selected"),this.highlightColorElement.querySelector("#yellowDiv").classList.remove("e-color-selected"),this.highlightColorElement.querySelector("#brightGreenDiv").classList.remove("e-color-selected"),this.highlightColorElement.querySelector("#turquoiseDiv").classList.remove("e-color-selected"),this.highlightColorElement.querySelector("#hotPinkDiv").classList.remove("e-color-selected"),this.highlightColorElement.querySelector("#redDiv").classList.remove("e-color-selected"),this.highlightColorElement.querySelector("#darkBlueDiv").classList.remove("e-color-selected"),this.highlightColorElement.querySelector("#tealDiv").classList.remove("e-color-selected"),this.highlightColorElement.querySelector("#greenDiv").classList.remove("e-color-selected"),this.highlightColorElement.querySelector("#violetDiv").classList.remove("e-color-selected"),this.highlightColorElement.querySelector("#darkRedDiv").classList.remove("e-color-selected"),this.highlightColorElement.querySelector("#darkYellowDiv").classList.remove("e-color-selected"),this.highlightColorElement.querySelector("#gray50Div").classList.remove("e-color-selected"),this.highlightColorElement.querySelector("#gray25Div").classList.remove("e-color-selected"),this.highlightColorElement.querySelector("#blackDiv").classList.remove("e-color-selected")},e.prototype.applyHighlightColor=function(e){this.appliedHighlightColor=e;var t=this.getHighLightColor(e);"NoColor"===t&&(this.documentEditor.selection.characterFormat.highlightColor=null),this.documentEditor.selection.characterFormat.highlightColor=t},e.prototype.getHighLightColor=function(e){switch(e){case"rgb(255, 255, 0)":return"Yellow";case"rgb(0, 255, 0)":return"BrightGreen";case"rgb(0, 255, 255)":return"Turquoise";case"rgb(255, 0, 255)":return"Pink";case"rgb(0, 0, 255)":return"Blue";case"rgb(255, 0, 0)":return"Red";case"rgb(0, 0, 128)":return"DarkBlue";case"rgb(0, 128, 128)":return"Teal";case"rgb(0, 128, 0)":return"Green";case"rgb(128, 0, 128)":return"Violet";case"rgb(128, 0, 0)":return"DarkRed";case"rgb(128, 128, 0)":return"DarkYellow";case"rgb(128, 128, 128)":return"Gray50";case"rgb(192, 192, 192)":return"Gray25";case"rgb(0, 0, 0)":return"Black";default:return"NoColor"}},e.prototype.createDiv=function(e,i,n){var r;return r=n?t.createElement("div",{id:e,styles:n}):t.createElement("div",{id:e}),i.appendChild(r),r},e.prototype.createButtonTemplate=function(e,i,n,o,s,a){var l=t.createElement("Button",{id:e,attrs:{type:"button"}});return n.appendChild(l),new r.Button({cssClass:o,iconCss:i,enableRtl:this.isRtl}).appendTo(l),l.setAttribute("title",a),l},e.prototype.createFontColorPicker=function(e,i,n,r){var o=t.createElement("input",{id:e,attrs:{type:"color"}});return o.style.width=i+"px",n.appendChild(o),this.fontColorInputElement=new a.ColorPicker({value:"#000000",showButtons:!0,enableRtl:this.isRtl,locale:this.container.locale},o),this.fontColorInputElement.element.parentElement.setAttribute("title",r),o},e.prototype.createDropDownListForSize=function(e){var t=this,i=["8","9","10","11","12","14","16","18","20","22","24","26","28","36","48","72","96"];this.fontSize=new s.ComboBox({dataSource:i,popupHeight:"180px",cssClass:"e-de-prop-dropdown",allowCustom:!0,showClearButton:!1,enableRtl:this.isRtl}),this.fontSize.focus=function(){t.isRetrieving=!1,t.fontSize.element.select()},this.fontSize.value=this.documentEditor.selection.characterFormat.fontSize.toString(),this.fontSize.appendTo(e),this.fontSize.element.parentElement.setAttribute("title",this.localObj.getConstant("Font Size"))},e.prototype.createDropDownListForFamily=function(e){var t=this,i=!1,n="";this.container.enableCsp||(n='<span style="font-family: ${FontName};">${FontName}</span>',i=!0),this.fontFamily=new s.ComboBox({dataSource:void 0,query:(new u.Query).select(["FontName"]),fields:{text:"FontName",value:"FontValue"},popupHeight:"150px",cssClass:"e-de-prop-dropdown",allowCustom:!0,showClearButton:!1,enableRtl:this.isRtl,itemTemplate:n}),this.fontFamily.appendTo(e),this.fontFamily.isStringTemplate=i;for(var r=this.container.documentEditorSettings.fontFamilies,o=0;o<r.length;o++){var a=r[o],l={FontName:a,FontValue:a};this.fontFamily.addItem(l,o)}this.fontFamily.focus=function(){t.isRetrieving=!1,t.fontFamily.element.select()},this.fontFamily.element.parentElement.setAttribute("title",this.localObj.getConstant("Font"))},e.prototype.wireEvent=function(){var e=this;this.fontFamily.addEventListener("change",function(){e.changeFontFamily()}),this.fontSize.addEventListener("change",function(){e.changeFontSize()}),this.bold.addEventListener("click",function(){e.isRetrieving=!1,e.boldAction()}),this.italic.addEventListener("click",function(){e.isRetrieving=!1,e.italicAction()}),this.underline.addEventListener("click",function(){e.isRetrieving=!1,e.underlineAction()}),this.strikethrough.addEventListener("click",function(){e.isRetrieving=!1,e.strikethroughAction()}),this.superscript.addEventListener("click",function(){e.isRetrieving=!1,e.superscriptAction()}),this.subscript.addEventListener("click",function(){e.isRetrieving=!1,e.subscriptAction()}),this.fontColorInputElement.addEventListener("change",function(t){e.isRetrieving=!1,e.changeFontColor(t)}),this.clearFormat.addEventListener("click",function(){e.isRetrieving=!1,e.clearFormatAction()})},e.prototype.unwireEvents=function(){this.fontFamily.change=void 0,this.fontSize.change=void 0,this.bold.click=void 0,this.italic.click=void 0,this.underline.click=void 0,this.strikethrough.click=void 0,this.superscript.click=void 0,this.subscript.click=void 0,this.fontColorInputElement.change=void 0,this.highlightColorElement.click=void 0,this.highlightColor.click=void 0,this.clearFormat.click=void 0},e.prototype.boldAction=function(){this.isRetrieving||!this.documentEditor.isReadOnly&&this.documentEditor.editor&&this.documentEditor.editor.toggleBold()},e.prototype.italicAction=function(){this.isRetrieving||!this.documentEditor.isReadOnly&&this.documentEditor.editor&&this.documentEditor.editor.toggleItalic()},e.prototype.underlineAction=function(){this.isRetrieving||!this.documentEditor.isReadOnly&&this.documentEditor.editor&&this.documentEditor.editor.toggleUnderline("Single")},e.prototype.strikethroughAction=function(){this.isRetrieving||!this.documentEditor.isReadOnly&&this.documentEditor.editor&&this.documentEditor.editor.toggleStrikethrough()},e.prototype.clearFormatAction=function(){this.isRetrieving||!this.documentEditor.isReadOnly&&this.documentEditor.editor&&this.documentEditor.editor.clearFormatting()},e.prototype.subscriptAction=function(){this.isRetrieving||!this.documentEditor.isReadOnly&&this.documentEditor.editor&&this.documentEditor.editor.toggleSubscript()},e.prototype.superscriptAction=function(){this.isRetrieving||!this.documentEditor.isReadOnly&&this.documentEditor.editor&&this.documentEditor.editor.toggleSuperscript()},e.prototype.changeFontColor=function(e){var t=this;this.isRetrieving||!this.documentEditor.isReadOnly&&this.documentEditor.selection&&(this.documentEditor.selection.characterFormat.fontColor=e.currentValue.hex,setTimeout(function(){t.documentEditor.focusIn()},30))},e.prototype.changeFontFamily=function(){var e=this;this.isRetrieving||!this.documentEditor.isReadOnly&&this.documentEditor.selection&&""!==this.fontFamily.value&&setTimeout(function(){e.documentEditor.selection.characterFormat.fontFamily=e.fontFamily.value},10)},e.prototype.changeFontSize=function(){var e=this;this.isRetrieving||!this.documentEditor.isReadOnly&&this.documentEditor.selection&&""!==this.fontSize.value&&setTimeout(function(){e.documentEditor.selection.characterFormat.fontSize=e.fontSize.value},10)},e.prototype.onSelectionChange=function(){this.isRetrieving=!0,this.documentEditor.selection&&(this.documentEditor.selection.characterFormat.fontFamily?(this.fontFamily.value=this.documentEditor.selection.characterFormat.fontFamily,this.fontFamily.dataBind()):this.fontFamily.value="",this.documentEditor.selection.characterFormat.fontSize?(this.fontSize.value=this.documentEditor.selection.characterFormat.fontSize.toString(),this.fontSize.dataBind()):this.fontSize.value="",this.documentEditor.selection.characterFormat.bold?this.bold.classList.contains("e-btn-toggle")||this.bold.classList.add("e-btn-toggle"):this.bold.classList.contains("e-btn-toggle")&&this.bold.classList.remove("e-btn-toggle"),this.documentEditor.selection.characterFormat.italic?this.italic.classList.contains("e-btn-toggle")||this.italic.classList.add("e-btn-toggle"):this.italic.classList.contains("e-btn-toggle")&&this.italic.classList.remove("e-btn-toggle"),this.documentEditor.selection.characterFormat.underline&&"None"!==this.documentEditor.selection.characterFormat.underline?this.underline.classList.contains("e-btn-toggle")||this.underline.classList.add("e-btn-toggle"):this.underline.classList.contains("e-btn-toggle")&&this.underline.classList.remove("e-btn-toggle"),this.documentEditor.selection.characterFormat.strikethrough&&"None"!==this.documentEditor.selection.characterFormat.strikethrough?this.strikethrough.classList.contains("e-btn-toggle")||this.strikethrough.classList.add("e-btn-toggle"):this.strikethrough.classList.contains("e-btn-toggle")&&this.strikethrough.classList.remove("e-btn-toggle"),this.documentEditor.selection.characterFormat.baselineAlignment&&"Subscript"===this.documentEditor.selection.characterFormat.baselineAlignment?this.subscript.classList.contains("e-btn-toggle")||this.subscript.classList.add("e-btn-toggle"):this.subscript.classList.contains("e-btn-toggle")&&this.subscript.classList.remove("e-btn-toggle"),this.documentEditor.selection.characterFormat.baselineAlignment&&"Superscript"===this.documentEditor.selection.characterFormat.baselineAlignment?this.superscript.classList.contains("e-btn-toggle")||this.superscript.classList.add("e-btn-toggle"):this.superscript.classList.contains("e-btn-toggle")&&this.superscript.classList.remove("e-btn-toggle"),this.documentEditor.selection.characterFormat.fontColor&&(this.fontColorInputElement.value=this.documentEditor.selection.characterFormat.fontColor),this.documentEditor.selection.characterFormat.highlightColor&&(this.highlightColorInputElement.style.backgroundColor=this.appliedHighlightColor,this.applyHighlightColorAsBackground(this.documentEditor.selection.characterFormat.highlightColor)))},e.prototype.destroy=function(){this.container=void 0,this.highlightColor&&(this.highlightColor.destroy(),this.highlightColor=void 0),this.fontColorInputElement&&(this.fontColorInputElement.destroy(),this.fontColorInputElement=void 0),this.fontSize&&(this.fontSize.destroy(),this.fontSize=void 0),this.fontFamily&&(this.fontFamily.destroy(),this.fontFamily=void 0)},e}(),_i=function(){function e(e){this.isRetrieving=!1,this.appliedBulletStyle="dot",this.appliedNumberingStyle="arabic",this.appliedLineSpacing="",this.splitButtonClass="e-de-prop-splitbutton",this.container=e}return Object.defineProperty(e.prototype,"documentEditor",{get:function(){return this.container.documentEditor},enumerable:!0,configurable:!0}),e.prototype.initializeParagraphPropertiesDiv=function(e,i){this.localObj=new t.L10n("documenteditorcontainer",this.container.defaultLocale,this.container.locale),this.isRtl=i,this.isRtl&&(this.splitButtonClass="e-rtl "+this.splitButtonClass),this.textProperties=e;var n=this.documentEditor.element.id+"_font_properties",r=this.createDivElement(n+"_paragraph",e,"");t.classList(r,["e-de-cntr-pane-padding"],[]);var o=t.createElement("label",{styles:"width:26px;",className:"e-de-ctnr-prop-label"});o.innerHTML=this.localObj.getConstant("Paragraph"),r.appendChild(o);var s=this.createDivElement(n+"_styleDiv",r);s.classList.add("e-de-ctnr-segment","e-de-ctnr-style-div");var a=t.createElement("input",{id:n+"_style",styles:"width:248px;font-size: 12px;letter-spacing: 0.05px;"});s.appendChild(a),this.createStyleDropDownList(a);var l=this.createDivElement(n+"_indentWholeDiv",r);l.style.display="flex",l.classList.add("e-de-ctnr-segment"),i&&t.classList(l,["e-de-ctnr-segment-rtl"],[]);var d=this.createDivElement(n+"_indentDiv",l,"display:flex;"),h="e-de-ctnr-group-btn e-de-char-fmt-btn-left e-btn-group";i&&(h="e-rtl "+h),d.className=h,this.leftAlignment=this.createButtonTemplate(n+"_leftIndent","e-de-ctnr-alignleft e-icons",d,"e-de-prop-indent-button","40.5",this.localObj.getConstant("Align left Tooltip")),this.centerAlignment=this.createButtonTemplate(n+"_centerIndent","e-de-ctnr-aligncenter e-icons",d,"e-de-prop-indent-button","40.5",this.localObj.getConstant("Center Tooltip")),this.rightAlignment=this.createButtonTemplate(n+"_rightIndent","e-de-ctnr-alignright e-icons",d,"e-de-prop-indent-button","40.5",this.localObj.getConstant("Align right Tooltip")),this.justify=this.createButtonTemplate(n+"_justify","e-de-ctnr-justify e-icons",d,"e-de-prop-indent-last-button","40.5",this.localObj.getConstant("Justify Tooltip"));var c="e-de-ctnr-increaseindent e-icons",p="e-de-ctnr-decreaseindent e-icons",u=this.createDivElement(n+"_indentDiv",l,"display:flex;");h="e-de-ctnr-group-btn e-de-char-fmt-btn-right e-btn-group",i&&(h="e-rtl "+h,c+=" e-de-flip",p+=" e-de-flip"),u.className=h,this.decreaseIndent=this.createButtonTemplate(n+"_decreaseIndent",p,u,"e-de-prop-indent-button","37",this.localObj.getConstant("Decrease indent")),this.increaseIndent=this.createButtonTemplate(n+"_increaseIndent",c,u,"e-de-prop-indent-last-button","37",this.localObj.getConstant("Increase indent"));var g=this.createDivElement(n+"_listDiv",r,"display:flex;");t.classList(g,["e-de-ctnr-segment","e-de-ctnr-group-btn"],[]),i&&t.classList(g,["e-de-ctnr-segment-rtl","e-de-ctnr-group-btn"],[]);var m=t.createElement("button",{id:n+"_lineHeight",attrs:{type:"button"}});g.appendChild(m),this.lineSpacing=this.createLineSpacingDropdown(m);var f=this.createDivElement(n+"_listDropDiv",g);f.className="de-split-button";var v=t.createElement("button",{id:n+"_bullet",attrs:{type:"button"}});f.appendChild(v);var y=t.createElement("button",{id:n+"_numberingList",attrs:{type:"button"}});f.appendChild(y);var b="e-de-ctnr-bullets e-icons",w="e-de-ctnr-numbering e-icons";i&&(b+=" e-de-flip",w+=" e-de-flip"),this.createBulletListDropButton(b,v),this.createNumberListDropButton(w,y)},e.prototype.createSeparator=function(e){var i=t.createElement("div",{className:"e-de-prop-vline"});e.appendChild(i)},e.prototype.createDivElement=function(e,i,n){var r;return r=n?t.createElement("div",{id:e,styles:n}):t.createElement("div",{id:e}),i.appendChild(r),r},e.prototype.createButtonTemplate=function(e,i,n,o,s,a){var l=t.createElement("Button",{id:e,attrs:{type:"button"}});return n.appendChild(l),new r.Button({cssClass:o,iconCss:i}).appendTo(l),l.setAttribute("title",a),l},e.prototype.createLineSpacingDropdown=function(e){var t=this,i=[{text:this.localObj.getConstant("Single")},{text:"1.15"},{text:"1.5"},{text:this.localObj.getConstant("Double")}],n=new d.DropDownButton({items:i,iconCss:"e-de-ctnr-linespacing e-icons",enableRtl:this.isRtl,select:this.lineSpacingAction.bind(this),cssClass:this.splitButtonClass,beforeItemRender:function(e){e.element.innerHTML="<span></span>"+e.item.text;var i=e.element.children[0];e.item.text===t.appliedLineSpacing?(i.style.marginRight="10px",i.setAttribute("class","e-de-selected-item e-icons e-de-linespacing")):(e.element.children[0].style.marginRight="25px",e.element.children[0].classList.remove("e-de-selected-item"))}});return n.appendTo(e),e.setAttribute("title",this.localObj.getConstant("Line spacing")),n},e.prototype.createNumberListDropButton=function(e,i){var n=this,r=t.createElement("div",{id:"target",styles:"width: 211px;height: auto;display:none"}),o=t.createElement("ul",{styles:"display: block; outline: 0px;",id:"listMenu",className:"e-de-floating-menu e-de-bullets-menu e-de-list-container e-de-list-thumbnail"});r.appendChild(o),this.noneNumberTag=this.createNumberNoneListTag(o),this.noneNumberTag.addEventListener("click",this.numberedNoneClick.bind(this)),this.numberList=this.createNumberListTag(o,"1.","2.","3."),this.numberList.addEventListener("click",this.numberedNumberDotClick.bind(this)),this.lowLetter=this.createNumberListTag(o,"a.","b.","c."),this.lowLetter.addEventListener("click",this.numberedLowLetterClick.bind(this)),this.upLetter=this.createNumberListTag(o,"A.","B.","C."),this.upLetter.addEventListener("click",this.numberedUpLetterClick.bind(this)),this.lowRoman=this.createNumberListTag(o,"i.","ii.","iii."),this.lowRoman.addEventListener("click",this.numberedLowRomanClick.bind(this)),this.upRoman=this.createNumberListTag(o,"I.","II.","III."),this.upRoman.addEventListener("click",this.numberedUpRomanClick.bind(this));var s={target:r,iconCss:e,cssClass:this.splitButtonClass,beforeOpen:function(){r.style.display="block",n.updateSelectedNumberedListType(n.documentEditor.selection.paragraphFormat.listText)},beforeClose:function(){r.style.display="none",n.removeSelectedList()}};this.numberedListBtn=new d.SplitButton(s),this.numberedListBtn.click=function(){n.applyLastAppliedNumbering()},this.numberedListBtn.appendTo(i),i.parentElement.setAttribute("title",this.localObj.getConstant("Numbering"))},e.prototype.updateSelectedBulletListType=function(e){switch(e){case"":this.dotBullet.classList.add("de-list-item-selected");break;case" ":this.circleBullet.classList.add("de-list-item-selected");break;case"":this.squareBullet.classList.add("de-list-item-selected");break;case"":this.flowerBullet.classList.add("de-list-item-selected");break;case"":this.arrowBullet.classList.add("de-list-item-selected");break;case"":this.tickBullet.classList.add("de-list-item-selected");break;default:this.noneBulletTag.classList.add("de-list-item-selected")}},e.prototype.updateSelectedNumberedListType=function(e){switch(e){case"1.":this.numberList.classList.add("de-list-item-selected");break;case"I.":this.upRoman.classList.add("de-list-item-selected");break;case"A.":this.upLetter.classList.add("de-list-item-selected");break;case"a.":this.lowLetter.classList.add("de-list-item-selected");break;case"i.":this.lowRoman.classList.add("de-list-item-selected");break;default:this.noneNumberTag.classList.add("de-list-item-selected")}},e.prototype.removeSelectedList=function(){var e="de-list-item-selected";this.noneNumberTag.classList.remove(e),this.numberList.classList.remove(e),this.lowLetter.classList.remove(e),this.upLetter.classList.remove(e),this.lowRoman.classList.remove(e),this.upRoman.classList.remove(e),this.noneBulletTag.classList.remove(e),this.dotBullet.classList.remove(e),this.circleBullet.classList.remove(e),this.squareBullet.classList.remove(e),this.flowerBullet.classList.remove(e),this.arrowBullet.classList.remove(e),this.tickBullet.classList.remove(e)},e.prototype.applyLastAppliedNumbering=function(){switch(this.appliedNumberingStyle){case"arabic":this.numberedNumberDotClick();break;case"lowletter":this.numberedLowLetterClick();break;case"upletter":this.numberedUpLetterClick();break;case"lowroman":this.numberedLowRomanClick();break;case"uproman":this.numberedUpRomanClick()}},e.prototype.applyLastAppliedBullet=function(){switch(this.appliedBulletStyle){case"dot":this.bulletDotClick();break;case"circle":this.bulletCircleClick();break;case"square":this.bulletSquareClick();break;case"arrow":this.bulletArrowClick();break;case"tick":this.bulletTickClick();break;case"flower":this.bulletFlowerClick()}},e.prototype.createBulletListDropButton=function(e,i){var n=this,r=t.createElement("div",{id:"bullet_list",styles:"width: 196px;height: auto;display:none"}),o=t.createElement("ul",{styles:"display: block; outline: 0px;",id:"listMenu",className:"e-de-floating-menu e-de-bullets-menu e-de-list-container e-de-list-thumbnail"});r.appendChild(o),this.noneBulletTag=this.createBulletListTag(o,"e-de-ctnr-bullet-none e-icons e-de-ctnr-list"),this.noneBulletTag.addEventListener("click",this.numberedNoneClick.bind(this)),this.dotBullet=this.createBulletListTag(o,"e-de-ctnr-bullet-dot e-icons e-de-ctnr-list"),this.dotBullet.addEventListener("click",this.bulletDotClick.bind(this)),this.circleBullet=this.createBulletListTag(o,"e-de-ctnr-bullet-circle e-icons e-de-ctnr-list"),this.circleBullet.addEventListener("click",this.bulletCircleClick.bind(this)),this.squareBullet=this.createBulletListTag(o,"e-de-ctnr-bullet-square e-icons e-de-ctnr-list"),this.squareBullet.addEventListener("click",this.bulletSquareClick.bind(this)),this.flowerBullet=this.createBulletListTag(o,"e-de-ctnr-bullet-flower e-icons e-de-ctnr-list"),this.flowerBullet.addEventListener("click",this.bulletFlowerClick.bind(this)),this.arrowBullet=this.createBulletListTag(o,"e-de-ctnr-bullet-arrow e-icons e-de-ctnr-list"),this.arrowBullet.addEventListener("click",this.bulletArrowClick.bind(this)),this.tickBullet=this.createBulletListTag(o,"e-de-ctnr-bullet-tick e-icons e-de-ctnr-list"),this.tickBullet.addEventListener("click",this.bulletTickClick.bind(this));var s={target:r,iconCss:e,cssClass:this.splitButtonClass,beforeOpen:function(){r.style.display="block",n.updateSelectedBulletListType(n.documentEditor.selection.paragraphFormat.listText)},beforeClose:function(){r.style.display="none",n.removeSelectedList()}};this.bulletListBtn=new d.SplitButton(s),this.bulletListBtn.click=function(){n.applyLastAppliedBullet()},this.bulletListBtn.appendTo(i),i.parentElement.setAttribute("title",this.localObj.getConstant("Bullets"))},e.prototype.createNumberListTag=function(e,i,n,r){var o=t.createElement("li",{styles:"display:block",className:"e-de-floating-menuitem e-de-floating-menuitem-md e-de-list-items e-de-list-item-size"});e.appendChild(o);var s="<div>"+i+'<span class="e-de-list-line"></span></div><div>'+n+'<span class="e-de-list-line">';s+="</span></div><div>"+r+'<span class="e-de-list-line"> </span></div >';var a=t.createElement("div",{className:"e-de-list-header-presetmenu",id:"ui-zlist0",innerHTML:s});return o.appendChild(a),o},e.prototype.createNumberNoneListTag=function(e){var i=t.createElement("li",{styles:"display:block;",className:"e-de-floating-menuitem e-de-floating-menuitem-md e-de-list-items e-de-list-item-size"});e.appendChild(i);var n=t.createElement("div",{className:"e-de-list-header-presetmenu",styles:"position:relative;left:11px;top:13px",id:"ui-zlist0",innerHTML:'<div><span class="e-de-bullets">None</span></div>'});return i.appendChild(n),i},e.prototype.createBulletListTag=function(e,i){var n=t.createElement("li",{styles:"display:block;",className:"e-de-floating-menuitem e-de-floating-bullet-menuitem-md e-de-list-items e-de-list-item-size"});e.appendChild(n);var r=t.createElement("div",{className:"e-de-bullet-list-header-presetmenu",id:"ui-zlist0"}),o=t.createElement("div");r.appendChild(o);var s=t.createElement("span",{className:i});return o.appendChild(s),n.appendChild(r),n},e.prototype.createStyleDropDownList=function(e){this.style=new s.DropDownList({dataSource:[{StyleName:"Normal",Class:"e-icons e-edit-font"}],cssClass:"e-de-prop-dropdown",popupHeight:"240px",enableRtl:this.isRtl,query:(new u.Query).select(["StyleName","Style"]),fields:{text:"StyleName",value:"StyleName"},change:this.selectStyleValue.bind(this)}),this.container.enableCsp||(this.style.open=this.updateOptions.bind(this),this.style.itemTemplate='<span style="${Style}">${StyleName}</span>',this.style.footerTemplate='<span class="e-de-ctnr-dropdown-ftr">'+this.localObj.getConstant("Manage Styles")+"...</span>",this.style.isStringTemplate=!0),this.style.appendTo(e),e.parentElement.setAttribute("title",this.localObj.getConstant("Styles"))},e.prototype.updateOptions=function(e){this.updateStyleNames(),e.popup.element.getElementsByClassName("e-de-ctnr-dropdown-ftr")[0].addEventListener("click",this.createStyle.bind(this))},e.prototype.updateStyleNames=function(){this.styleName=t.isNullOrUndefined(this.style.itemData)?void 0:this.style.itemData.StyleName,this.style.dataSource=this.constructStyleDropItems(this.documentEditor.getStyles("Paragraph")),this.style.dataBind(),this.onSelectionChange()},e.prototype.createStyle=function(){this.style.hidePopup(),this.documentEditor.isReadOnly||this.documentEditor.showDialog("Styles")},e.prototype.constructStyleDropItems=function(e){for(var t=[],i=0,n=e;i<n.length;i++){var r=n[i],o={};o.StyleName=r.name,o.Style=this.parseStyle(r.style),t.push(o)}return t},e.prototype.parseStyle=function(e){var i="",n=JSON.parse(e),r="";if(!t.isNullOrUndefined(n.characterFormat.baselineAlignment)&&"Normal"!==n.characterFormat.baselineAlignment){var o="";switch(n.characterFormat.baselineAlignment){case"Superscript":o="super";break;case"Subscript":o="sub"}o.length>1&&(i+="vertical-align:"+o+";")}return t.isNullOrUndefined(n.characterFormat.underline)||"None"===n.characterFormat.underline||(r+="underline "),t.isNullOrUndefined(n.characterFormat.strikethrough)||"None"===n.characterFormat.strikethrough||(r+="line-through "),t.isNullOrUndefined(n.characterFormat.fontSize)||(i+="font-size:"+n.characterFormat.fontSize+"px;"),t.isNullOrUndefined(n.characterFormat.fontFamily)||(i+="font-family:"+n.characterFormat.fontFamily+";"),!t.isNullOrUndefined(n.characterFormat.bold)&&n.characterFormat.bold&&(i+="font-weight:bold;"),!t.isNullOrUndefined(n.characterFormat.italic)&&n.characterFormat.italic&&(i+="font-style:italic;"),r.length>1&&(i+="text-decoration:"+r+";"),i},e.prototype.wireEvent=function(){var e=this;this.leftAlignment.addEventListener("click",function(){e.leftAlignmentAction()}),this.rightAlignment.addEventListener("click",function(){e.rightAlignmentAction()}),this.centerAlignment.addEventListener("click",function(){e.centerAlignmentAction()}),this.justify.addEventListener("click",function(){e.justifyAction()}),this.increaseIndent.addEventListener("click",function(){e.increaseIndentAction()}),this.decreaseIndent.addEventListener("click",function(){e.decreaseIndentAction()}),this.lineSpacing.addEventListener("select",function(t){e.lineSpacingAction(t)})},e.prototype.unwireEvents=function(){this.leftAlignment.click=void 0,this.rightAlignment.click=void 0,this.centerAlignment.click=void 0,this.justify.click=void 0,this.increaseIndent.click=void 0,this.decreaseIndent.click=void 0,this.lineSpacing.select=void 0,this.style.select=void 0},e.prototype.leftAlignmentAction=function(){this.isRetrieving||!this.documentEditor.isReadOnly&&this.documentEditor.editor&&this.documentEditor.editor.toggleTextAlignment("Left")},e.prototype.lineSpacingAction=function(e){var t=this;if(!this.isRetrieving){switch(e.item.text){case this.localObj.getConstant("Single"):this.documentEditor.selection.paragraphFormat.lineSpacing=1;break;case"1.15":this.documentEditor.selection.paragraphFormat.lineSpacing=1.15;break;case"1.5":this.documentEditor.selection.paragraphFormat.lineSpacing=1.5;break;case this.localObj.getConstant("Double"):this.documentEditor.selection.paragraphFormat.lineSpacing=2}setTimeout(function(){t.documentEditor.focusIn()},30)}},e.prototype.setLineSpacing=function(){var e=this.documentEditor.selection.paragraphFormat.lineSpacing;this.appliedLineSpacing=1===e?this.localObj.getConstant("Single"):1.15===e?"1.15":1.5===e?"1.5":2===e?this.localObj.getConstant("Double"):""},e.prototype.selectStyleValue=function(e){var t=this;!this.isRetrieving&&e.isInteracted&&setTimeout(function(){t.applyStyleValue(e)},10)},e.prototype.applyStyleValue=function(e){!this.documentEditor.isReadOnly&&this.documentEditor.editor&&this.documentEditor.editor.applyStyle(e.itemData.StyleName,!0)},e.prototype.rightAlignmentAction=function(){this.isRetrieving||!this.documentEditor.isReadOnly&&this.documentEditor.editor&&this.documentEditor.editor.toggleTextAlignment("Right")},e.prototype.centerAlignmentAction=function(){this.isRetrieving||!this.documentEditor.isReadOnly&&this.documentEditor.editor&&this.documentEditor.editor.toggleTextAlignment("Center")},e.prototype.justifyAction=function(){this.isRetrieving||!this.documentEditor.isReadOnly&&this.documentEditor.editor&&this.documentEditor.editor.toggleTextAlignment("Justify")},e.prototype.increaseIndentAction=function(){this.isRetrieving||!this.documentEditor.isReadOnly&&this.documentEditor.editor&&this.documentEditor.editor.increaseIndent()},e.prototype.decreaseIndentAction=function(){this.isRetrieving||!this.documentEditor.isReadOnly&&this.documentEditor.editor&&this.documentEditor.editor.decreaseIndent()},e.prototype.numberedNoneClick=function(){var e=this;this.isRetrieving||this.documentEditor.editor&&(this.documentEditor.editor.clearList(),setTimeout(function(){e.documentEditor.focusIn()},30))},e.prototype.numberedNumberDotClick=function(){var e=this;this.isRetrieving||this.documentEditor.editor&&(this.appliedNumberingStyle="arabic",this.documentEditor.editor.applyNumbering("%1.","Arabic"),setTimeout(function(){e.documentEditor.focusIn()},30))},e.prototype.numberedUpRomanClick=function(){var e=this;this.isRetrieving||this.documentEditor.editor&&(this.appliedNumberingStyle="uproman",this.documentEditor.editor.applyNumbering("%1.","UpRoman"),setTimeout(function(){e.documentEditor.focusIn()},30))},e.prototype.numberedUpLetterClick=function(){var e=this;this.isRetrieving||this.documentEditor.editor&&(this.appliedNumberingStyle="upletter",this.documentEditor.editor.applyNumbering("%1.","UpLetter"),setTimeout(function(){e.documentEditor.focusIn()},30))},e.prototype.numberedLowLetterClick=function(){var e=this;this.isRetrieving||this.documentEditor.editor&&(this.appliedNumberingStyle="lowletter",this.documentEditor.editor.applyNumbering("%1.","LowLetter"),setTimeout(function(){e.documentEditor.focusIn()},30))},e.prototype.numberedLowRomanClick=function(){var e=this;this.isRetrieving||this.documentEditor.editor&&(this.appliedNumberingStyle="lowroman",this.documentEditor.editor.applyNumbering("%1.","LowRoman"),setTimeout(function(){e.documentEditor.focusIn()},30))},e.prototype.bulletDotClick=function(){var e=this;this.isRetrieving||this.documentEditor.editor&&(this.appliedBulletStyle="dot",this.documentEditor.editor.applyBullet("","Symbol"),setTimeout(function(){e.documentEditor.focusIn()},30))},e.prototype.bulletCircleClick=function(){var e=this;this.isRetrieving||this.documentEditor.editor&&(this.appliedBulletStyle="circle",this.documentEditor.editor.applyBullet(" ","Symbol"),setTimeout(function(){e.documentEditor.focusIn()},30))},e.prototype.bulletSquareClick=function(){var e=this;this.isRetrieving||this.documentEditor.editor&&(this.appliedBulletStyle="square",this.documentEditor.editor.applyBullet("","Wingdings"),setTimeout(function(){e.documentEditor.focusIn()},30))},e.prototype.bulletFlowerClick=function(){var e=this;this.isRetrieving||this.documentEditor.editor&&(this.appliedBulletStyle="flower",this.documentEditor.editor.applyBullet("","Wingdings"),setTimeout(function(){e.documentEditor.focusIn()},30))},e.prototype.bulletArrowClick=function(){var e=this;this.isRetrieving||this.documentEditor.editor&&(this.appliedBulletStyle="arrow",this.documentEditor.editor.applyBullet("","Wingdings"),setTimeout(function(){e.documentEditor.focusIn()},30))},e.prototype.bulletTickClick=function(){var e=this;this.isRetrieving||this.documentEditor.editor&&(this.appliedBulletStyle="tick",this.documentEditor.editor.applyBullet("","Wingdings"),setTimeout(function(){e.documentEditor.focusIn()},30))},e.prototype.onSelectionChange=function(){if(this.isRetrieving=!0,this.documentEditor.editor){var e=this.documentEditor.selection.paragraphFormat.styleName;e?(this.style.value=e,this.style.dataBind()):this.style.value=null,t.classList(this.leftAlignment,[],["e-btn-toggle"]),t.classList(this.rightAlignment,[],["e-btn-toggle"]),t.classList(this.centerAlignment,[],["e-btn-toggle"]),t.classList(this.justify,[],["e-btn-toggle"]),"Left"===this.documentEditor.selection.paragraphFormat.textAlignment?t.classList(this.leftAlignment,["e-btn-toggle"],[]):"Right"===this.documentEditor.selection.paragraphFormat.textAlignment?t.classList(this.rightAlignment,["e-btn-toggle"],[]):"Center"===this.documentEditor.selection.paragraphFormat.textAlignment?t.classList(this.centerAlignment,["e-btn-toggle"],[]):"Justify"===this.documentEditor.selection.paragraphFormat.textAlignment&&t.classList(this.justify,["e-btn-toggle"],[])}this.setLineSpacing(),this.isRetrieving=!1},e.prototype.destroy=function(){this.container=void 0,this.lineSpacing&&(this.lineSpacing.destroy(),this.lineSpacing=void 0),this.style&&(this.style.destroy(),this.style=void 0),this.bulletListBtn&&(this.bulletListBtn.destroy(),this.bulletListBtn=void 0),this.numberedListBtn&&(this.numberedListBtn.destroy(),this.numberedListBtn=void 0)},e}(),ji=function(){function e(e,t,i,n){this.isInitial=!0,this.container=e,this.text=new Vi(e,n),this.paragraph=new _i(e),this.initializeTextProperties(t,i,n),this.wireEvents()}return Object.defineProperty(e.prototype,"documentEditor",{get:function(){return this.container.documentEditor},enumerable:!0,configurable:!0}),e.prototype.enableDisableElements=function(e){e?t.classList(this.element,[],["e-de-overlay"]):t.classList(this.element,["e-de-overlay"],[])},e.prototype.updateStyles=function(){this.paragraph.updateStyleNames()},Object.defineProperty(e.prototype,"appliedHighlightColor",{get:function(){return this.text.appliedHighlightColor},set:function(e){this.text.appliedHighlightColor=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"appliedBulletStyle",{get:function(){return this.paragraph.appliedBulletStyle},set:function(e){this.paragraph.appliedBulletStyle=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"appliedNumberingStyle",{get:function(){return this.paragraph.appliedNumberingStyle},set:function(e){this.paragraph.appliedNumberingStyle=e},enumerable:!0,configurable:!0}),e.prototype.showTextProperties=function(e){e&&this.onSelectionChange(),!e&&"none"===this.element.style.display||e&&"block"===this.element.style.display||(this.element.style.display=e?"block":"none",this.documentEditor.resize())},e.prototype.initializeTextProperties=function(e,i,n){this.element=t.createElement("div",{id:e+"id_"+this.generateUniqueID(),className:"e-de-prop-pane"}),this.text.initializeTextPropertiesDiv(this.element,n),this.paragraph.initializeParagraphPropertiesDiv(this.element,n),this.paragraph.updateStyleNames(),i||this.container.propertiesPaneContainer.appendChild(this.element)},e.prototype.generateUniqueID=function(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)},e.prototype.wireEvents=function(){this.text.wireEvent(),this.paragraph.wireEvent()},e.prototype.onSelectionChange=function(){this.text.onSelectionChange(),this.paragraph.onSelectionChange()},e.prototype.destroy=function(){this.text&&(this.text.destroy(),this.text=void 0),this.paragraph&&(this.paragraph.destroy(),this.paragraph=void 0)},e}(),qi=function(){function e(e,t){this.isHeaderTopApply=!1,this.isFooterTopApply=!1,this.container=e,this.isRtl=t,this.initHeaderFooterPane(),this.wireEvents()}return Object.defineProperty(e.prototype,"documentEditor",{get:function(){return this.container.documentEditor},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"toolbar",{get:function(){return this.container.toolbarModule},enumerable:!0,configurable:!0}),e.prototype.enableDisableElements=function(e){e?t.classList(this.element,[],["e-de-overlay"]):t.classList(this.element,["e-de-overlay"],[])},e.prototype.initHeaderFooterPane=function(){this.initializeHeaderFooter(),this.element.style.display="none",this.container.propertiesPaneContainer.appendChild(this.element)},e.prototype.showHeaderFooterPane=function(e){e&&(this.toolbar&&this.toolbar.enableDisablePropertyPaneButton(!1),this.onSelectionChange()),!e&&"none"===this.element.style.display||e&&"block"===this.element.style.display||(this.element.style.display=e?"block":"none",this.documentEditor.resize())},e.prototype.initializeHeaderFooter=function(){var e=this,i=new t.L10n("documenteditorcontainer",this.container.defaultLocale,this.container.locale),n="header_footer_properties";this.element=t.createElement("div",{id:this.documentEditor.element.id+n,className:"e-de-prop-pane"});var o=this.createDivTemplate("_header_footer",this.element,"padding-bottom:0");t.classList(o,["e-de-cntr-pane-padding"],[]);var s=t.createElement("label",{className:"e-de-prop-header-label"});s.innerHTML=i.getConstant("Header And Footer");var l;l=this.isRtl?"float:left;":"float:right;";var d=t.createElement("span",{id:"_header_footer_close",className:"e-de-ctnr-close e-de-close-icon e-icons",styles:"display:inline-block;cursor:pointer;"+l});d.addEventListener("click",function(){e.onClose()}),o.appendChild(s),o.appendChild(d);var h=this.createDivTemplate(n+"_options",this.element);t.classList(h,["e-de-cntr-pane-padding","e-de-prop-separator-line"],[]);var c=t.createElement("label",{className:"e-de-ctnr-prop-label",styles:"height:20px;"});c.innerHTML=i.getConstant("Options"),h.appendChild(c);var p=this.createDivTemplate(n+"_optionsDiv",h),u=this.createDivTemplate(n+"_firstPageDiv",p,"margin-bottom:10px;"),g=t.createElement("input",{id:"firstPage",className:"e-de-prop-sub-label"});u.appendChild(g),this.firstPage=new r.CheckBox({label:i.getConstant("Different First Page"),change:this.changeFirstPageOptions.bind(this),cssClass:"e-de-prop-sub-label",enableRtl:this.isRtl}),this.firstPage.appendTo(g),u.children[0].setAttribute("title",i.getConstant("Different header and footer for first page"));var m=this.createDivTemplate(n+"_oddOrEvenDiv",p),f=t.createElement("input",{id:"oddOrEven",className:"e-de-sub-prop-label"});m.appendChild(f),this.oddOrEven=new r.CheckBox({label:i.getConstant("Different Odd And Even Pages"),change:this.changeoddOrEvenOptions.bind(this),cssClass:"e-de-prop-sub-label",enableRtl:this.isRtl}),this.oddOrEven.appendTo(f),m.children[0].setAttribute("title",i.getConstant("Different header and footer for odd and even pages"));var v=this.createDivTemplate(n+"_positionLabelDiv",this.element);t.classList(v,["e-de-cntr-pane-padding","e-de-prop-separator-line"],[]);var y=t.createElement("label",{className:"e-de-ctnr-prop-label",styles:"height:20px;"});y.innerHTML=i.getConstant("Position"),v.appendChild(y);var b=this.createDivTemplate(n+"_positionDiv",v),w=this.createDivTemplate(n+"_headerTopDiv",b,"margin-bottom:14px;"),C=t.createElement("label",{className:"e-de-prop-sub-label",styles:"display:block"});C.innerHTML=i.getConstant("Header from Top"),w.appendChild(C);var x=t.createElement("input",{id:this.documentEditor.element.id+"_headerFromTop",className:"e-de-prop-sub-label"});w.appendChild(x),this.headerFromTop=new a.NumericTextBox({value:36,cssClass:"e-de-prop-header-numeric",showSpinButton:!1,format:"n0",decimals:2,max:1584,min:0,enableRtl:this.isRtl}),this.headerFromTop.appendTo(x),this.headerFromTop.element.parentElement.setAttribute("title",i.getConstant("Distance from top of the page to top of the header"));var F=this.createDivTemplate(n+"_footerBottomDiv",b),P=t.createElement("label",{className:"e-de-prop-sub-label",styles:"display:block"});P.innerHTML=i.getConstant("Footer from Bottom"),F.appendChild(P);var T=t.createElement("input",{id:this.documentEditor.element.id+"_footerFromTop",className:"e-de-prop-sub-label"});F.appendChild(T),this.footerFromTop=new a.NumericTextBox({value:36,cssClass:"e-de-prop-header-numeric",showSpinButton:!1,format:"n0",decimals:2,max:1584,min:0,enableRtl:this.isRtl}),this.footerFromTop.appendTo(T),this.footerFromTop.element.parentElement.setAttribute("title",i.getConstant("Distance from bottom of the page to bottom of the footer"))},e.prototype.createDivTemplate=function(e,i,n){var r;return r=n?t.createElement("div",{id:e,styles:n}):t.createElement("div",{id:e}),i.appendChild(r),r},e.prototype.wireEvents=function(){var e=this;this.headerFromTop.element.addEventListener("click",function(){e.isHeaderTopApply=!0}),this.footerFromTop.element.addEventListener("click",function(){e.isFooterTopApply=!0}),this.headerFromTop.element.addEventListener("keydown",this.onHeaderValue.bind(this)),this.footerFromTop.element.addEventListener("keydown",this.onFooterValue.bind(this)),this.headerFromTop.element.addEventListener("blur",function(){e.changeHeaderValue(),e.isHeaderTopApply=!1}),this.footerFromTop.element.addEventListener("blur",function(){e.changeFooterValue(),e.isFooterTopApply=!1})},e.prototype.onClose=function(){this.container.showHeaderProperties=!0,this.container.documentEditor.selection.closeHeaderFooter()},e.prototype.changeFirstPageOptions=function(){var e=this;this.documentEditor.isReadOnly||(this.documentEditor.selection.sectionFormat.differentFirstPage=this.firstPage.checked,setTimeout(function(){e.documentEditor.focusIn()},10))},e.prototype.changeoddOrEvenOptions=function(){var e=this;this.documentEditor.isReadOnly||(this.documentEditor.selection.sectionFormat.differentOddAndEvenPages=this.oddOrEven.checked,setTimeout(function(){e.documentEditor.focusIn()},10))},e.prototype.changeHeaderValue=function(){if(this.isHeaderTopApply&&!this.documentEditor.isReadOnly){var e=this.headerFromTop.value;e>this.headerFromTop.max&&(e=this.headerFromTop.max),this.documentEditor.selection.sectionFormat.headerDistance=e}},e.prototype.onHeaderValue=function(e){var t=this;13===e.keyCode&&setTimeout(function(){t.changeHeaderValue(),t.isHeaderTopApply=!1},30)},e.prototype.onFooterValue=function(e){var t=this;13===e.keyCode&&setTimeout(function(){t.changeFooterValue(),t.isFooterTopApply=!1},30)},e.prototype.changeFooterValue=function(){if(this.isFooterTopApply&&!this.documentEditor.isReadOnly){var e=this.footerFromTop.value;e>this.footerFromTop.max&&(e=this.footerFromTop.max),this.documentEditor.selection.sectionFormat.footerDistance=e}},e.prototype.onSelectionChange=function(){this.headerFromTop.value=this.documentEditor.selection.sectionFormat.headerDistance,this.footerFromTop.value=this.documentEditor.selection.sectionFormat.footerDistance,this.documentEditor.selection.sectionFormat.differentFirstPage?this.firstPage.checked=!0:this.firstPage.checked=!1,this.documentEditor.selection.sectionFormat.differentOddAndEvenPages?this.oddOrEven.checked=!0:this.oddOrEven.checked=!1},e.prototype.destroy=function(){this.headerFromTop&&(this.headerFromTop.destroy(),this.headerFromTop=void 0),this.footerFromTop&&(this.footerFromTop.destroy(),this.footerFromTop=void 0)},e}(),Gi=function(){function e(e,t){this.isWidthApply=!1,this.isHeightApply=!1,this.container=e,this.elementId=this.documentEditor.element.id,this.isMaintainAspectRatio=!1,this.isRtl=t,this.initializeImageProperties()}return Object.defineProperty(e.prototype,"documentEditor",{get:function(){return this.container.documentEditor},enumerable:!0,configurable:!0}),e.prototype.enableDisableElements=function(e){e?t.classList(this.element,[],["e-de-overlay"]):t.classList(this.element,["e-de-overlay"],[])},e.prototype.initializeImageProperties=function(){this.element=t.createElement("div",{id:this.elementId+"_imageProperties",className:"e-de-prop-pane"}),this.element.style.display="none",this.container.propertiesPaneContainer.appendChild(this.element),this.initImageProp(),this.wireEvents()},e.prototype.initImageProp=function(){var e=new t.L10n("documenteditorcontainer",this.container.defaultLocale,this.container.locale),i=t.createElement("div",{id:this.elementId+"_imageDiv",className:"e-de-cntr-pane-padding",styles:"border:0px"});this.element.appendChild(i);var n=t.createElement("label",{className:"e-de-ctnr-prop-label"});n.textContent=e.getConstant("Image"),i.appendChild(n);var o=t.createElement("div");i.appendChild(o),this.widthElement=this.createImagePropertiesDiv("_widthDiv",o,"_widthInput",e.getConstant("W"),e.getConstant("Width")),this.widthNumericBox=new a.NumericTextBox({min:0,max:23500,cssClass:"e-de-image-property",showSpinButton:!1,format:"n0",decimals:2}),this.widthNumericBox.appendTo(this.widthElement),this.heightElement=this.createImagePropertiesDiv("_heightDiv",o,"_heightInput",e.getConstant("H"),e.getConstant("Height")),this.heightNumericBox=new a.NumericTextBox({min:0,max:23500,cssClass:"e-de-image-property",showSpinButton:!1,format:"n0",decimals:2}),this.heightNumericBox.appendTo(this.heightElement);var s=t.createElement("div",{id:this.elementId+"_aspectRatioDiv"});s.setAttribute("title",e.getConstant("Aspect ratio")),o.appendChild(s);var l=t.createElement("input",{id:this.elementId+"_aspectRatio",className:"e-de-ctnr-prop-label"});s.appendChild(l),this.aspectRatioBtn=new r.CheckBox({label:e.getConstant("Aspect ratio"),enableRtl:this.isRtl},l)},e.prototype.createImagePropertiesDiv=function(e,i,n,r,o){var s=t.createElement("div",{id:this.elementId+e,styles:"position: relative;width: 100%;",className:"e-de-ctnr-segment"});s.setAttribute("title",o),i.appendChild(s);var a=t.createElement("input",{id:this.elementId+n,className:"e-textbox",styles:"width:100%;"});s.appendChild(a);var l=t.createElement("span",{className:"e-de-img-prty-span"});return l.textContent=r,s.appendChild(l),a},e.prototype.wireEvents=function(){var e=this;this.aspectRatioBtn.element.addEventListener("change",this.onAspectRatioBtnClick.bind(this)),this.widthNumericBox.element.addEventListener("click",function(){e.isWidthApply=!0}),this.heightNumericBox.element.addEventListener("click",function(){e.isHeightApply=!0}),this.widthNumericBox.element.addEventListener("keydown",this.onImageWidth.bind(this)),this.heightNumericBox.element.addEventListener("keydown",this.onImageHeight.bind(this)),this.widthNumericBox.element.addEventListener("blur",function(){e.applyImageWidth(),e.isWidthApply=!1}),this.heightNumericBox.element.addEventListener("blur",function(){e.applyImageHeight(),e.isHeightApply=!1})},e.prototype.onImageWidth=function(e){var t=this;13===e.keyCode&&setTimeout(function(){t.applyImageWidth(),t.isWidthApply=!1},30)},e.prototype.onImageHeight=function(e){var t=this;13===e.keyCode&&setTimeout(function(){t.applyImageHeight(),t.isHeightApply=!1},30)},e.prototype.applyImageWidth=function(){if(this.isMaintainAspectRatio){if(this.isMaintainAspectRatio){(i=this.widthNumericBox.value)>this.widthNumericBox.max&&(i=this.widthNumericBox.max);var e=i/this.documentEditor.selection.imageFormat.width,t=this.heightNumericBox.value*e;this.heightNumericBox.value=t,null!==i&&null!==t&&this.documentEditor.selection.imageFormat.resize(i,t)}}else{var i=this.widthNumericBox.value,t=this.heightNumericBox.value;i>this.widthNumericBox.max&&(i=this.widthNumericBox.max),t>this.heightNumericBox.max&&(t=this.heightNumericBox.max),null!==i&&null!==t&&this.documentEditor.selection.imageFormat.resize(i,t)}},e.prototype.applyImageHeight=function(){if(this.isMaintainAspectRatio){if(this.isMaintainAspectRatio){var e=(i=this.heightNumericBox.value)/this.documentEditor.selection.imageFormat.height,t=this.widthNumericBox.value*e;this.widthNumericBox.value=t,null!==t&&null!==i&&this.documentEditor.selection.imageFormat.resize(t,i)}}else{var t=this.widthNumericBox.value,i=this.heightNumericBox.value;null!==t&&null!==i&&this.documentEditor.selection.imageFormat.resize(t,i)}},e.prototype.onAspectRatioBtnClick=function(){this.isMaintainAspectRatio?this.isMaintainAspectRatio=!1:this.isMaintainAspectRatio=!0},e.prototype.showImageProperties=function(e){"block"===this.element.style.display&&this.updateImageProperties(),!e&&"none"===this.element.style.display||e&&"block"===this.element.style.display||(this.element.style.display=e?"block":"none",this.documentEditor.resize())},e.prototype.updateImageProperties=function(){this.widthNumericBox.value=this.documentEditor.selection.imageFormat.width,this.heightNumericBox.value=this.documentEditor.selection.imageFormat.height},e.prototype.destroy=function(){this.container=void 0,this.widthNumericBox&&(this.widthNumericBox.destroy(),this.widthNumericBox=void 0),this.heightNumericBox&&(this.heightNumericBox.destroy(),this.heightNumericBox=void 0)},e}(),Ki=function(){function e(e,t){this.container=e,this.elementId=this.documentEditor.element.id,this.isRtl=t,this.initializeTocPane()}return Object.defineProperty(e.prototype,"documentEditor",{get:function(){return this.container.documentEditor},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"toolbar",{get:function(){return this.container.toolbarModule},enumerable:!0,configurable:!0}),e.prototype.enableDisableElements=function(e){e?t.classList(this.element,[],["e-de-overlay"]):t.classList(this.element,["e-de-overlay"],[])},e.prototype.initializeTocPane=function(){this.localObj=new t.L10n("documenteditorcontainer",this.container.defaultLocale,this.container.locale),this.element=t.createElement("div",{id:this.elementId+"_tocProperties",className:"e-de-prop-pane"});var e=t.createElement("div",{className:"e-de-cntr-pane-padding e-de-prop-separator-line"});this.tocHeaderDiv(e),this.initTemplates(e),e=t.createElement("div",{className:"e-de-cntr-pane-padding"}),this.tocOptionsDiv(e),this.contentStylesDropdown(e),this.checkboxContent(e),this.buttonDiv(e),this.wireEvents(),this.updateTocProperties(),this.container.propertiesPaneContainer.appendChild(this.element)},e.prototype.updateTocProperties=function(){this.rightalignPageNumber.checked=!0,this.showPageNumber.checked=!0,this.hyperlink.checked=!0},e.prototype.wireEvents=function(){var e=this;this.cancelBtn.element.addEventListener("click",function(){e.onClose()}),this.updateBtn.element.addEventListener("click",this.onInsertToc.bind(this)),this.closeButton.addEventListener("click",function(){e.onClose()})},e.prototype.onClose=function(){this.container.showPropertiesPane&&"TableOfContents"!==this.container.previousContext?this.container.showPropertiesPaneOnSelection():(this.showTocPane(!1),this.toolbar&&this.toolbar.enableDisablePropertyPaneButton(!1),this.container.showPropertiesPane=!1)},e.prototype.tocHeaderDiv=function(e){var i,n;this.isRtl?(i="float:left;",n="margin-left:7px;"):(i="float:right;",n="margin-right:7px;");var r=t.createElement("div",{id:this.elementId+"toc_id",styles:"display: block;"});e.appendChild(r),this.element.appendChild(e);var o=t.createElement("label",{className:"e-de-ctnr-prop-label"});o.textContent=this.localObj.getConstant("Table of Contents"),r.appendChild(o),this.closeButton=t.createElement("span",{className:"e-de-ctnr-close e-icons",styles:"cursor: pointer;display:inline-block;color: #4A4A4A;"+i+n}),r.appendChild(this.closeButton)},e.prototype.initTemplates=function(e){this.template1(e)},e.prototype.template1=function(e){this.template1Div=t.createElement("div",{className:"e-de-toc-template1"}),this.isRtl&&this.template1Div.classList.add("e-de-rtl"),e.appendChild(this.template1Div);var i=t.createElement("div",{className:"e-de-toc-template1-content1"});i.textContent=this.localObj.getConstant("HEADING - - - - 1"),this.template1Div.appendChild(i);var n=t.createElement("div",{className:"e-de-toc-template1-content2"});n.textContent=this.localObj.getConstant("HEADING - - - - 2"),this.template1Div.appendChild(n);var r=t.createElement("div",{className:"e-de-toc-template1-content3"});r.textContent=this.localObj.getConstant("HEADING - - - - 3"),this.template1Div.appendChild(r)},e.prototype.tocOptionsDiv=function(e){var i=t.createElement("div");e.appendChild(i),this.element.appendChild(e),this.isRtl&&i.classList.add("e-de-rtl");var n=t.createElement("label",{className:"e-de-ctnr-prop-label"});n.textContent=this.localObj.getConstant("Options"),i.appendChild(n)},e.prototype.createDropDownButton=function(e,i,n,r,o){var a=t.createElement("input",{id:e});return i.appendChild(a),new s.DropDownList({index:o,dataSource:r,popupHeight:"150px",cssClass:"e-de-prop-font-button"},a)},e.prototype.contentStylesDropdown=function(e){var i=this;this.isRtl;var n=t.createElement("div",{id:"contentstyle_div"});n.setAttribute("title",this.localObj.getConstant("Number of heading or outline levels to be shown in table of contents")),e.appendChild(n),this.isRtl;var r=t.createElement("label",{className:"e-de-prop-sub-label",styles:"display:block"});r.textContent=this.localObj.getConstant("Levels"),n.appendChild(r),e.appendChild(n);var o=["1","2","3","4","5","6","7","8","9"];this.borderLevelStyle=this.createDropDownButton(this.elementId+"_borderLevelDiv",n,"",o,2),this.borderLevelStyle.change=function(e){i.borderLevelStyle.value=e.item.value},e.appendChild(n)},e.prototype.checkboxContent=function(e){this.isRtl;var i=t.createElement("div",{id:"toc_checkboxDiv",styles:"margin-bottom:36px;"});e.appendChild(i);var n=t.createElement("div",{className:"e-de-toc-checkbox1"});n.setAttribute("title",this.localObj.getConstant("Show page numbers in table of contents")),i.appendChild(n);var o=t.createElement("input",{id:"showpagenumber",styles:"width:12px;height:12px;margin-bottom:8px",className:"e-de-prop-sub-label"});n.appendChild(o),this.showPageNumber=new r.CheckBox({label:this.localObj.getConstant("Show page numbers"),enableRtl:this.isRtl}),this.showPageNumber.appendTo(o);var s=t.createElement("div",{className:"e-de-toc-checkbox2"});s.setAttribute("title",this.localObj.getConstant("Right align page numbers in table of contents")),i.appendChild(s);var a=t.createElement("input",{id:"rightalignpagenumber",styles:"width:12px;height:12px",className:"e-de-prop-sub-label"});s.appendChild(a),this.rightalignPageNumber=new r.CheckBox({label:this.localObj.getConstant("Right align page numbers"),enableRtl:this.isRtl}),this.rightalignPageNumber.appendTo(a);var l=t.createElement("div",{className:"e-de-toc-checkbox3"});l.setAttribute("title",this.localObj.getConstant("Use hyperlinks instead of page numbers")),i.appendChild(l);var d=t.createElement("input",{id:"hyperlinkdiv",styles:"width:12px;height:12px",className:"e-de-prop-sub-label"});l.appendChild(d),this.hyperlink=new r.CheckBox({label:this.localObj.getConstant("Use hyperlinks"),enableRtl:this.isRtl}),this.hyperlink.appendTo(d)},e.prototype.buttonDiv=function(e){var i;i=this.isRtl?"float:left":"float:right";var n=t.createElement("div",{id:"footerDiv",styles:i});e.appendChild(n);var o=t.createElement("button",{id:"footerupdatebuttonDiv",attrs:{type:"button"}});n.appendChild(o),this.updateBtn=new r.Button({content:this.localObj.getConstant("Update"),cssClass:"btn-update",isPrimary:!0}),this.updateBtn.appendTo(o);var s=t.createElement("button",{id:"footercancelbuttonDiv",attrs:{type:"button"}});n.appendChild(s),this.cancelBtn=new r.Button({content:this.localObj.getConstant("Cancel"),cssClass:this.isRtl?"e-de-btn-cancel-rtl":"e-de-btn-cancel"}),this.cancelBtn.appendTo(s)},e.prototype.showTocPane=function(e,t){!e&&"none"===this.element.style.display||e&&"block"===this.element.style.display||(this.element.style.display=e?"block":"none",this.updateBtn.content="TableOfContents"===this.documentEditor.selection.contextType?this.localObj.getConstant("Update"):this.localObj.getConstant("Insert"),this.prevContext=this.documentEditor.selection.contextType,this.documentEditor.resize(),e&&this.updateBtn.element.focus())},e.prototype.onInsertToc=function(){var e={startLevel:1,endLevel:parseInt(this.borderLevelStyle.value,0),includeHyperlink:this.hyperlink.checked,includePageNumber:this.showPageNumber.checked,rightAlign:this.rightalignPageNumber.checked};e.rightAlign&&(e.tabLeader="Dot"),this.documentEditor.editor.insertTableOfContents(e)},e.prototype.destroy=function(){this.container=void 0,this.showPageNumber&&(this.showPageNumber.destroy(),this.showPageNumber=void 0),this.rightalignPageNumber&&(this.rightalignPageNumber.destroy(),this.rightalignPageNumber=void 0),this.borderBtn&&(this.borderBtn.destroy(),this.borderBtn=void 0),this.borderLevelStyle&&(this.borderLevelStyle.destroy(),this.borderLevelStyle=void 0)},e}(),Xi=function(){function e(e,t,i,n){this.isTopMarginApply=!1,this.isRightMarginApply=!1,this.isBottomMarginApply=!1,this.isLeftMarginApply=!1,this.borderColor="#000000",this.groupButtonClass="e-de-ctnr-group-btn e-btn-group",this.container=e,this.isRtl=n,this.isRtl&&(this.groupButtonClass="e-rtl "+this.groupButtonClass),this.tableTextProperties=new ji(e,"textProperties",!0,this.isRtl),this.imageProperty=t,this.elementId=this.documentEditor.element.id,this.initializeTablePropPane(),this.prevContext=this.documentEditor.selection.contextType,this.textProperties=i}return Object.defineProperty(e.prototype,"documentEditor",{get:function(){return this.container.documentEditor},enumerable:!0,configurable:!0}),e.prototype.initializeTablePropPane=function(){this.localObj=new t.L10n("documenteditorcontainer",this.container.defaultLocale,this.container.locale),this.tableProperties=t.createElement("div",{id:this.elementId+"_tableProperties"}),this.initFillColorDiv(),this.initBorderStylesDiv(),this.initCellDiv(),this.initInsertOrDelCell(),this.initCellMargin(),this.initAlignText(),this.addTablePropertyTab(),this.wireEvent()},e.prototype.enableDisableElements=function(e){this.textProperties.enableDisableElements(e),e?t.classList(this.element,[],["e-de-overlay"]):t.classList(this.element,["e-de-overlay"],[])},e.prototype.addTablePropertyTab=function(){var e=t.createElement("div",{innerHTML:this.localObj.getConstant("Table")}),n=t.createElement("div",{innerHTML:this.localObj.getConstant("Text")});this.parentElement=t.createElement("div",{styles:"height:100%;overflow:auto;display:none",className:"e-de-prop-pane"}),this.element=t.createElement("div",{id:this.elementId+"_propertyTabDiv",className:"e-de-property-tab"});var r=[{header:{text:e},content:this.tableProperties},{header:{text:n},content:this.tableTextProperties.element}];this.propertiesTab=new i.Tab({items:r,animation:{previous:{effect:"None"},next:{effect:"None"}},selected:this.onTabSelection.bind(this)}),this.propertiesTab.isStringTemplate=!0,this.propertiesTab.appendTo(this.element),this.parentElement.appendChild(this.element),this.container.propertiesPaneContainer.appendChild(this.parentElement)},e.prototype.onTabSelection=function(){this.documentEditor.resize()},e.prototype.wireEvent=function(){var e=this;this.shadingBtn.addEventListener("change",this.changeBackgroundColor.bind(this)),this.borderBtn.addEventListener("change",function(t){setTimeout(function(){e.borderColor=t.currentValue.hex,e.tableOutlineBorder.element.focus()},10)}),this.tableOutlineBorder.element.addEventListener("click",this.onOutlineBorder.bind(this)),this.tableAllBorder.element.addEventListener("click",this.onAllBorder.bind(this)),this.tableCenterBorder.element.addEventListener("click",this.onInsideBorder.bind(this)),this.tableLeftBorder.element.addEventListener("click",this.onLeftBorder.bind(this)),this.tableCenterVerticalBorder.element.addEventListener("click",this.onVerticalBorder.bind(this)),this.tableRightBorder.element.addEventListener("click",this.onRightBorder.bind(this)),this.tableTopBorder.element.addEventListener("click",this.onTopBorder.bind(this)),this.tableCenterHorizontalBorder.element.addEventListener("click",this.onHorizontalBorder.bind(this)),this.tableBottomBorder.element.addEventListener("click",this.onBottomBorder.bind(this)),this.insertRowAbove.element.addEventListener("click",this.onInsertRowAbove.bind(this)),this.insertRowBelow.element.addEventListener("click",this.onInsertRowBelow.bind(this)),this.insertColumnLeft.element.addEventListener("click",this.onInsertColumnLeft.bind(this)),this.insertColumnRight.element.addEventListener("click",this.onInsertColumnRight.bind(this)),this.deleteRow.element.addEventListener("click",this.onDeleteRow.bind(this)),this.deleteColumn.element.addEventListener("click",this.onDeleteColumn.bind(this)),this.horizontalMerge.element.addEventListener("click",this.onMergeCell.bind(this)),this.alignTop.element.addEventListener("click",this.applyAlignTop.bind(this)),this.alignBottom.element.addEventListener("click",this.applyAlignBottom.bind(this)),this.alignCenterHorizontal.element.addEventListener("click",this.applyAlignCenterHorizontal.bind(this)),this.topMargin.element.addEventListener("click",function(){e.isTopMarginApply=!0}),this.rightMargin.element.addEventListener("click",function(){e.isRightMarginApply=!0}),this.leftMargin.element.addEventListener("click",function(){e.isLeftMarginApply=!0}),this.bottomMargin.element.addEventListener("click",function(){e.isBottomMarginApply=!0}),this.topMargin.element.addEventListener("keydown",this.onTopMargin.bind(this)),this.rightMargin.element.addEventListener("keydown",this.onRightMargin.bind(this)),this.leftMargin.element.addEventListener("keydown",this.onLeftMargin.bind(this)),this.bottomMargin.element.addEventListener("keydown",this.onBottomMargin.bind(this)),this.topMargin.element.addEventListener("blur",function(){e.applyTopMargin(),e.isTopMarginApply=!1}),this.rightMargin.element.addEventListener("blur",function(){e.applyRightMargin(),e.isRightMarginApply=!1}),this.leftMargin.element.addEventListener("blur",function(){e.applyLeftMargin(),e.isLeftMarginApply=!1}),this.bottomMargin.element.addEventListener("blur",function(){e.applyBottomMargin(),e.isBottomMarginApply=!1})},e.prototype.getBorder=function(e){var t=this.borderSize.content.indexOf("No Border")>=0?0:parseInt(this.borderSize.content,10),i=0===t?"Cleared":"Single";return{type:e,borderColor:this.borderColor,lineWidth:t,borderStyle:i}},e.prototype.onOutlineBorder=function(){this.documentEditor.editor.applyBorders(this.getBorder("OutsideBorders"))},e.prototype.onAllBorder=function(){this.documentEditor.editor.applyBorders(this.getBorder("AllBorders"))},e.prototype.onInsideBorder=function(){this.documentEditor.editor.applyBorders(this.getBorder("InsideBorders"))},e.prototype.onLeftBorder=function(){this.documentEditor.editor.applyBorders(this.getBorder("LeftBorder"))},e.prototype.onVerticalBorder=function(){this.documentEditor.editor.applyBorders(this.getBorder("InsideVerticalBorder"))},e.prototype.onRightBorder=function(){this.documentEditor.editor.applyBorders(this.getBorder("RightBorder"))},e.prototype.onTopBorder=function(){this.documentEditor.editor.applyBorders(this.getBorder("TopBorder"))},e.prototype.onHorizontalBorder=function(){this.documentEditor.editor.applyBorders(this.getBorder("InsideHorizontalBorder"))},e.prototype.onBottomBorder=function(){this.documentEditor.editor.applyBorders(this.getBorder("BottomBorder"))},e.prototype.onTopMargin=function(e){var t=this;13===e.keyCode&&setTimeout(function(){t.applyTopMargin(),t.isTopMarginApply=!1},30)},e.prototype.onBottomMargin=function(e){var t=this;13===e.keyCode&&setTimeout(function(){t.applyBottomMargin(),t.isBottomMarginApply=!1},30)},e.prototype.onLeftMargin=function(e){var t=this;13===e.keyCode&&setTimeout(function(){t.applyLeftMargin(),t.isLeftMarginApply=!1},30)},e.prototype.onRightMargin=function(e){var t=this;13===e.keyCode&&setTimeout(function(){t.applyRightMargin(),t.isRightMarginApply=!1},30)},e.prototype.applyTopMargin=function(){this.isTopMarginApply&&(this.documentEditor.selection.cellFormat.topMargin=this.topMargin.value>this.topMargin.max?this.topMargin.max:this.topMargin.value)},e.prototype.applyBottomMargin=function(){this.isBottomMarginApply&&(this.documentEditor.selection.cellFormat.bottomMargin=this.bottomMargin.value>this.bottomMargin.max?this.bottomMargin.max:this.bottomMargin.value)},e.prototype.applyLeftMargin=function(){this.isLeftMarginApply&&(this.documentEditor.selection.cellFormat.leftMargin=this.leftMargin.value>this.leftMargin.max?this.leftMargin.max:this.leftMargin.value)},e.prototype.applyRightMargin=function(){this.isRightMarginApply&&(this.documentEditor.selection.cellFormat.rightMargin=this.rightMargin.value>this.rightMargin.max?this.rightMargin.max:this.rightMargin.value)},e.prototype.applyAlignTop=function(){this.documentEditor.selection.cellFormat.verticalAlignment="Top"},e.prototype.applyAlignBottom=function(){this.documentEditor.selection.cellFormat.verticalAlignment="Bottom"},e.prototype.applyAlignCenterHorizontal=function(){this.documentEditor.selection.cellFormat.verticalAlignment="Center"},e.prototype.onMergeCell=function(){this.documentEditor.editor.mergeCells()},e.prototype.onInsertRowAbove=function(){this.documentEditor.editor.insertRow(!0)},e.prototype.onInsertRowBelow=function(){this.documentEditor.editor.insertRow(!1)},e.prototype.onInsertColumnLeft=function(){this.documentEditor.editor.insertColumn(!0)},e.prototype.onInsertColumnRight=function(){this.documentEditor.editor.insertColumn(!1)},e.prototype.onDeleteRow=function(){this.documentEditor.editor.deleteRow()},e.prototype.onDeleteColumn=function(){this.documentEditor.editor.deleteColumn()},e.prototype.onSelectionChange=function(){this.documentEditor.selection&&(this.documentEditor.editor&&this.documentEditor.editor.canMergeCells()?this.horizontalMerge.disabled=!1:this.horizontalMerge.disabled=!0,"TableText"!==this.documentEditor.selection.contextType&&"TableImage"!==this.documentEditor.selection.contextType||(this.shadingBtn.value=this.documentEditor.selection.cellFormat.background?this.documentEditor.selection.cellFormat.background:""),this.topMargin.value=this.documentEditor.selection.cellFormat.topMargin?this.documentEditor.selection.cellFormat.topMargin:0,this.bottomMargin.value=this.documentEditor.selection.cellFormat.bottomMargin?this.documentEditor.selection.cellFormat.bottomMargin:0,this.rightMargin.value=this.documentEditor.selection.cellFormat.rightMargin?this.documentEditor.selection.cellFormat.rightMargin:0,this.leftMargin.value=this.documentEditor.selection.cellFormat.leftMargin?this.documentEditor.selection.cellFormat.leftMargin:0)},e.prototype.changeBackgroundColor=function(e){var t=this;this.documentEditor.isReadOnly||(this.documentEditor.selection.cellFormat.background=e.currentValue.hex,setTimeout(function(){t.documentEditor.focusIn()},10))},e.prototype.initFillColorDiv=function(){var e=t.createElement("div",{id:this.elementId+"_fillColorDiv",className:"e-de-property-div-padding de-tbl-fill-clr"});this.tableProperties.appendChild(e);var i=t.createElement("label",{className:"e-de-prop-sub-label"});i.classList.add("e-de-prop-fill-label"),this.isRtl&&i.classList.add("e-de-rtl"),i.textContent=this.localObj.getConstant("Fill"),e.appendChild(i),this.shadingBtn=this.createColorPickerTemplate(this.elementId+"_tableShading",e,this.localObj.getConstant("Fill color"),!1),t.classList(e.lastElementChild.lastElementChild.lastElementChild.firstChild,["e-de-ctnr-cellbg-clr-picker"],["e-caret"])},e.prototype.initBorderStylesDiv=function(){var e=t.createElement("div",{className:"e-de-property-div-padding"});this.tableProperties.appendChild(e);var i=t.createElement("label",{className:"e-de-ctnr-prop-label"});i.classList.add("e-de-table-prop-label"),i.textContent=this.localObj.getConstant("Border Style"),e.appendChild(i);var n=t.createElement("div",{id:this.elementId+"_borderStyleDiv",className:"e-de-border-style-div",styles:"display:inline-flex;"}),r=t.createElement("div",{styles:"width:126px;height:126px",className:"e-de-grp-btn-ctnr"}),o=t.createElement("div",{className:this.groupButtonClass+" e-de-ctnr-group-btn-top"});r.appendChild(o);var s=t.createElement("div",{className:this.groupButtonClass+" e-de-ctnr-group-btn-middle"});r.appendChild(s);var a=t.createElement("div",{className:this.groupButtonClass+" e-de-ctnr-group-btn-bottom"});r.appendChild(a),this.isRtl&&(o.classList.add("e-de-rtl"),a.classList.add("e-de-rtl"),n.classList.add("e-de-rtl"),i.classList.add("e-de-rtl"));this.tableOutlineBorder=this.createButtonTemplate(this.elementId+"_tableOutlineBorder","e-de-ctnr-outsideborder e-icons",o,"e-de-prop-font-button","",this.localObj.getConstant("Outside borders")),this.tableAllBorder=this.createButtonTemplate(this.elementId+"_tableAllBorder","e-de-ctnr-allborders e-icons",o,"e-de-prop-font-button","",this.localObj.getConstant("All borders")),this.tableCenterBorder=this.createButtonTemplate(this.elementId+"_tableCenterBorder","e-de-ctnr-insideborders e-icons",o,"e-de-prop-font-button","",this.localObj.getConstant("Inside borders")),this.tableLeftBorder=this.createButtonTemplate(this.elementId+"_tableLeftBorder","e-de-ctnr-leftborders e-icons",s,"e-de-prop-font-button","",this.localObj.getConstant("Left border")),this.tableCenterVerticalBorder=this.createButtonTemplate(this.elementId+"_tableCenterVBorder","e-de-ctnr-insideverticalborder e-icons",s,"e-de-prop-font-button","",this.localObj.getConstant("Inside vertical border")),this.tableRightBorder=this.createButtonTemplate(this.elementId+"_tableRightBorder","e-de-ctnr-rightborder e-icons",s,"e-de-prop-font-button","",this.localObj.getConstant("Right border")),this.tableTopBorder=this.createButtonTemplate(this.elementId+"_tableTopBorder","e-de-ctnr-topborder e-icons",a,"e-de-prop-font-button","",this.localObj.getConstant("Top border")),this.tableCenterHorizontalBorder=this.createButtonTemplate(this.elementId+"_tableCenterHBorder","e-de-ctnr-insidehorizondalborder e-icons",a,"e-de-prop-font-button","",this.localObj.getConstant("Inside horizontal border")),this.tableBottomBorder=this.createButtonTemplate(this.elementId+"_tableBottomBorder","e-de-ctnr-bottomborder e-icons",a,"e-de-prop-font-button","",this.localObj.getConstant("Bottom border")),n.appendChild(r);var l=t.createElement("div",{className:"de-tbl-fill-clr"});this.isRtl?l.classList.add("e-de-stylediv-rtl"):l.classList.add("e-de-stylediv"),this.borderBtn=this.createColorPickerTemplate(this.elementId+"_tableBorderColor",l,this.localObj.getConstant("Border color"),!0),this.borderBtn.value="#000000",l.firstElementChild.lastElementChild.lastElementChild.style.width="30px",l.firstElementChild.lastElementChild.firstElementChild.firstElementChild.style.width="100%",t.classList(l.lastElementChild.lastElementChild.lastElementChild.firstChild,["e-de-ctnr-highlightcolor"],["e-caret"]);var d=t.createElement("button",{id:this.elementId+"_tableBorderSize",className:"e-de-border-size-button",styles:"font-size:10px;padding:0px;",attrs:{type:"button"}});l.appendChild(d),this.borderSize=this.createBorderSizeDropDown("e-de-ctnr-strokesize e-icons",d),n.appendChild(l),this.borderSizeColorElement=document.getElementsByClassName("e-de-border-width"),e.appendChild(n)},e.prototype.initCellDiv=function(){var e=t.createElement("div",{className:"e-de-property-div-padding"});this.tableProperties.appendChild(e);var i=t.createElement("label",{className:"e-de-ctnr-prop-label"});i.classList.add("e-de-table-prop-label"),i.textContent=this.localObj.getConstant("Cell"),e.appendChild(i);var n=t.createElement("div",{className:"e-de-ctnr-group-btn"});n.classList.add("e-de-cell-div"),this.isRtl&&(n.classList.add("e-de-rtl"),i.classList.add("e-de-rtl"));this.horizontalMerge=this.createButtonTemplate(this.elementId+"_tableOutlineBorder","e-de-ctnr-mergecell e-icons",n,"e-de-prop-font-button","width:38px;","Merge cells"),e.appendChild(n)},e.prototype.initInsertOrDelCell=function(){var e=t.createElement("div",{className:"e-de-property-div-padding"});this.tableProperties.appendChild(e);var i=t.createElement("label",{className:"e-de-ctnr-prop-label"});i.classList.add("e-de-table-prop-label"),i.textContent=this.localObj.getConstant("Insert Or Delete"),e.appendChild(i);var n=t.createElement("div",{className:"e-de-insert-del-cell",styles:"display:inline-flex"}),r=t.createElement("div",{className:this.groupButtonClass});n.appendChild(r);var o=t.createElement("div",{className:this.groupButtonClass});this.isRtl?(o.style.marginRight="12px",n.classList.add("e-de-rtl"),i.classList.add("e-de-rtl")):o.style.marginLeft="12px",n.appendChild(o);var s="width:38px;";this.insertColumnLeft=this.createButtonTemplate(this.elementId+"_insertColumnLeft","e-de-ctnr-insertleft e-icons",r,"e-de-prop-font-button",s,this.localObj.getConstant("Insert columns to the left")),this.insertColumnRight=this.createButtonTemplate(this.elementId+"_insertColumnRight","e-de-ctnr-insertright e-icons",r,"e-de-prop-font-button",s,this.localObj.getConstant("Insert columns to the right")),this.insertRowAbove=this.createButtonTemplate(this.elementId+"_insertRowAbove","e-de-ctnr-insertabove e-icons",r,"e-de-prop-font-button",s,this.localObj.getConstant("Insert rows above")),this.insertRowBelow=this.createButtonTemplate(this.elementId+"_insertRowBelow","e-de-ctnr-insertbelow e-icons",r,"e-de-prop-font-button",s,this.localObj.getConstant("Insert rows below")),this.deleteRow=this.createButtonTemplate(this.elementId+"_deleteRow","e-de-ctnr-deleterows e-icons",o,"e-de-prop-font-button",s,this.localObj.getConstant("Delete rows")),this.deleteColumn=this.createButtonTemplate(this.elementId+"_deleteColumn","e-de-ctnr-deletecolumns e-icons",o,"e-de-prop-font-button",s,this.localObj.getConstant("Delete columns")),e.appendChild(n)},e.prototype.initCellMargin=function(){var e=t.createElement("div",{className:"e-de-property-div-padding e-de-cellmargin-text"});this.tableProperties.appendChild(e);var i=t.createElement("label",{className:"e-de-ctnr-prop-label"});i.classList.add("e-de-table-prop-label"),i.textContent=this.localObj.getConstant("Cell Margin"),e.appendChild(i);var n=t.createElement("div",{className:"e-de-cell-margin",styles:"height: 60px;display:inline-flex"});this.isRtl&&i.classList.add("e-de-rtl");this.topMargin=this.createCellMarginTextBox(this.localObj.getConstant("Top"),this.elementId+"_topMargin",n,"width:48px","width:50px;float:left;",500,"Top margin"),this.bottomMargin=this.createCellMarginTextBox(this.localObj.getConstant("Bottom"),this.elementId+"_bottomMargin",n,"width:48px","width:50px;float:left;",500,"Bottom margin"),this.leftMargin=this.createCellMarginTextBox(this.localObj.getConstant("Left"),this.elementId+"_leftMargin",n,"width:48px","width:50px;float:left;",500,"Left margin"),this.rightMargin=this.createCellMarginTextBox(this.localObj.getConstant("Right"),this.elementId+"_rightMargin",n,"width:48px","width:50px;float:left;",500,"Right margin"),e.appendChild(n)},e.prototype.initAlignText=function(){var e=t.createElement("div",{className:"e-de-property-div-padding",styles:"border-bottom-width:0px"});this.tableProperties.appendChild(e);var i=t.createElement("label",{className:"e-de-ctnr-prop-label"});i.classList.add("e-de-table-prop-label"),i.textContent=this.localObj.getConstant("Align Text"),e.appendChild(i);var n=t.createElement("div",{className:"e-de-align-text",styles:"margin-bottom: 10px;"});this.isRtl&&(n.classList.add("e-de-rtl"),i.classList.add("e-de-rtl"));var r=t.createElement("div",{className:this.groupButtonClass});n.appendChild(r);this.alignTop=this.createButtonTemplate(this.elementId+"_alignTop","e-de-ctnr-aligntop e-icons",r,"e-de-prop-font-button","width:38px;",this.localObj.getConstant("Align top")),this.alignBottom=this.createButtonTemplate(this.elementId+"_alignBottom","e-de-ctnr-alignbottom e-icons",r,"e-de-prop-font-button","width:38px;",this.localObj.getConstant("Align bottom")),this.alignCenterHorizontal=this.createButtonTemplate(this.elementId+"_alignCenterHorizontal","e-de-ctnr-aligncenter-table e-icons",r,"e-de-prop-font-button","width:38px;",this.localObj.getConstant("Align center")),this.alignCenterHorizontal.addEventListener("click",this.applyAlignCenterHorizontal.bind(this)),e.appendChild(n)},e.prototype.createCellMarginTextBox=function(e,i,n,r,o,s,l){var d=t.createElement("div",{styles:o});d.classList.add("e-de-cell-text-box");var h=t.createElement("label",{className:"e-de-prop-sub-label"});h.textContent=e,d.appendChild(h);var c=t.createElement("input",{className:"e-textbox",id:i,styles:r});d.appendChild(c);var p=new a.NumericTextBox({showSpinButton:!1,min:0,format:"n0",max:s,enableRtl:this.isRtl},c);return n.appendChild(d),c.setAttribute("title",l),p},e.prototype.createBorderSizeDropDown=function(e,i){var n=this,r=t.createElement("div",{id:"borderSizeTarget",styles:"display:none"}),o=t.createElement("ul",{styles:"display: block; outline: 0px; width: 126px; height: auto;",id:"borderSizeListMenu"});r.appendChild(o),this.createDropdownOption(o,this.localObj.getConstant("No Border")).addEventListener("click",function(){n.onBorderSizeChange("No Border")}),this.createDropdownOption(o,"1px").addEventListener("click",function(){n.onBorderSizeChange("1px")}),this.createDropdownOption(o,"1.5px").addEventListener("click",function(){n.onBorderSizeChange("1.5px")}),this.createDropdownOption(o,"2px").addEventListener("click",function(){n.onBorderSizeChange("2px")}),this.createDropdownOption(o,"3px").addEventListener("click",function(){n.onBorderSizeChange("3px")}),this.createDropdownOption(o,"4px").addEventListener("click",function(){n.onBorderSizeChange("4px")}),this.createDropdownOption(o,"5px").addEventListener("click",function(){n.onBorderSizeChange("5px")});var s={target:r,iconCss:e,cssClass:"e-de-prop-bordersize",enableRtl:this.isRtl,content:"1.5px"},a=new d.DropDownButton(s);return a.beforeOpen=function(){r.style.display="block";for(var e=0;e<n.borderSizeColorElement.length;e++)n.borderSizeColorElement[e].style.borderBottomColor=n.borderColor},a.beforeClose=function(){r.style.display="none"},a.appendTo(i),a.element.setAttribute("title",this.localObj.getConstant("Border width")),a},e.prototype.onBorderSizeChange=function(e){var t=this;this.borderSize.content=e,setTimeout(function(){t.tableOutlineBorder.element.focus()},10)},e.prototype.createDropdownOption=function(e,i){var n=t.createElement("li",{styles:"display:block",className:"e-de-floating-menuitem e-de-floating-menuitem-md e-de-list-items e-de-list-item-size"});e.appendChild(n);var r;r="No Border"===i?"<div>"+i+"</div>":"1.5px"===i?"<div>"+i+'<span class="e-de-list-line e-de-border-width" style="margin-left:10px;border-bottom-width:'+i+';"></span></div>':"<div>"+i+'<span class="e-de-list-line e-de-border-width" style="margin-left:20px;border-bottom-width:'+i+';"></span></div>';var o=t.createElement("div",{className:"e-de-list-header-presetmenu",innerHTML:r});return n.appendChild(o),n},e.prototype.createDropDownButton=function(e,i,n,r,o,s,a){var l=t.createElement("button",{id:e,styles:i,attrs:{type:"button"}});n.appendChild(l);var h="e-de-prop-splitbutton";this.isRtl&&(h="e-rtl "+h);var c=new d.DropDownButton({iconCss:r,content:o,enableRtl:this.isRtl,cssClass:h},l);return s&&(c.items=s),a&&(c.target=a),c},e.prototype.createButtonTemplate=function(e,i,n,o,s,a,l,d){var h=t.createElement("Button",{id:e,styles:s,attrs:{type:"button"}});n.appendChild(h);var c=new r.Button({cssClass:o,iconCss:i,enableRtl:this.isRtl,iconPosition:d||"Left",content:l||""});return c.appendTo(h),h.setAttribute("title",a),c},e.prototype.createColorPickerTemplate=function(e,i,n,r){var o=t.createElement("input",{id:e});i.appendChild(o);var s="e-de-prop-font-button e-de-prop-font-colorpicker";r&&(s+=" e-de-border-clr-picker");var l=new a.ColorPicker({showButtons:!0,cssClass:s,enableRtl:this.isRtl,locale:this.container.locale},o);return o.parentElement.setAttribute("title",n),l},e.prototype.showTableProperties=function(e){e&&(this.prevContext!==this.documentEditor.selection.contextType&&(this.propertiesTab.selectedItem=0,this.tableTextProperties.appliedHighlightColor=this.textProperties.appliedHighlightColor,this.tableTextProperties.appliedBulletStyle=this.textProperties.appliedBulletStyle,this.tableTextProperties.appliedNumberingStyle=this.textProperties.appliedNumberingStyle),this.onSelectionChange(),this.tableTextProperties.onSelectionChange(),this.textProperties.appliedHighlightColor=this.tableTextProperties.appliedHighlightColor,this.textProperties.appliedBulletStyle=this.tableTextProperties.appliedBulletStyle,this.textProperties.appliedNumberingStyle=this.tableTextProperties.appliedNumberingStyle),!e&&"none"===this.parentElement.style.display||e&&"block"===this.parentElement.style.display||(this.parentElement.style.display=e?"block":"none",this.documentEditor.resize(),this.prevContext=this.documentEditor.selection.contextType)},e.prototype.destroy=function(){this.container=void 0,this.shadingBtn&&(this.shadingBtn.destroy(),this.shadingBtn=void 0),this.borderBtn&&(this.borderBtn.destroy(),this.borderBtn=void 0),this.borderSize&&(this.borderSize.destroy(),this.borderSize=void 0),this.topMargin&&(this.topMargin.destroy(),this.topMargin=void 0),this.bottomMargin&&(this.bottomMargin.destroy(),this.bottomMargin=void 0),this.leftMargin&&(this.leftMargin.destroy(),this.leftMargin=void 0),this.rightMargin&&(this.rightMargin.destroy(),this.rightMargin=void 0),this.tableTextProperties&&(this.tableTextProperties.destroy(),this.tableTextProperties=void 0),this.propertiesTab&&(this.propertiesTab.destroy(),this.propertiesTab=void 0)},e}(),Yi=function(){function e(e,t){this.startPage=1,this.statusBarDiv=e,this.container=t,this.initializeStatusBar(),this.wireEvents()}return Object.defineProperty(e.prototype,"documentEditor",{get:function(){return this.container?this.container.documentEditor:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"editorPageCount",{get:function(){return this.documentEditor?this.documentEditor.pageCount:1},enumerable:!0,configurable:!0}),e.prototype.initializeStatusBar=function(){var e=this,i=this.container.enableRtl;this.documentEditor.enableSpellCheck=!!this.container.enableSpellCheck,this.localObj=new t.L10n("documenteditorcontainer",this.container.defaultLocale,this.container.locale);var n=i?"padding-right:16px":"padding-left:16px",r=t.createElement("div",{className:this.container.enableSpellCheck?"e-de-ctnr-pg-no":"e-de-ctnr-pg-no-spellout",styles:n});this.statusBarDiv.appendChild(r);var o=t.createElement("label");o.textContent=this.localObj.getConstant("Page")+" ",r.appendChild(o),this.pageNumberInput=t.createElement("input",{styles:"text-transform:capitalize;white-space:pre;overflow:hidden;user-select:none;cursor:text",attrs:{type:"text"},className:"e-de-pagenumber-input"}),this.editablePageNumber=t.createElement("div",{styles:"display: inline-flex",className:"e-input e-de-pagenumber-text"}),this.editablePageNumber.appendChild(this.pageNumberInput),i?(o.style.marginLeft="6px",this.editablePageNumber.style.marginLeft="6px"):(o.style.marginRight="6px",this.editablePageNumber.style.marginRight="6px"),this.updatePageNumber(),r.appendChild(this.editablePageNumber),this.editablePageNumber.setAttribute("title",this.localObj.getConstant("Current Page Number"));var s=t.createElement("label",{styles:"width:16px"});if(s.textContent=" "+this.localObj.getConstant("of")+" ",r.appendChild(s),this.pageCount=t.createElement("label"),r.appendChild(this.pageCount),this.updatePageCount(),this.documentEditor.enableSpellCheck){var a=t.createElement("div",{className:"e-de-statusbar-separator"});this.statusBarDiv.appendChild(a);var l=this.addSpellCheckElement();this.spellCheckButton.appendTo(l)}this.pageButton=this.createButtonTemplate(this.container.enableSpellCheck?"e-de-statusbar-pageweb e-btn-pageweb-spellcheck":"e-de-statusbar-pageweb","e-de-printlayout e-icons",this.localObj.getConstant("Print layout"),this.statusBarDiv,this.pageButton,"Pages"===this.documentEditor.layoutType),this.webButton=this.createButtonTemplate("e-de-statusbar-pageweb","e-de-weblayout e-icons",this.localObj.getConstant("Web layout"),this.statusBarDiv,this.webButton,"Continuous"===this.documentEditor.layoutType),this.pageButton.addEventListener("click",function(){e.documentEditor.layoutType="Pages",e.addRemoveClass(e.pageButton,e.webButton)}),this.webButton.addEventListener("click",function(){e.documentEditor.layoutType="Continuous",e.addRemoveClass(e.webButton,e.pageButton)});var h=t.createElement("button",{className:"e-de-statusbar-zoom",attrs:{type:"button"}});this.statusBarDiv.appendChild(h),h.setAttribute("title","Zoom level. Click or tap to open the Zoom options.");var c=[{text:"200%"},{text:"175%"},{text:"150%"},{text:"125%"},{text:"100%"},{text:"75%"},{text:"50%"},{text:"25%"},{separator:!0},{text:this.localObj.getConstant("Fit one page")},{text:this.localObj.getConstant("Fit page width")}];this.zoom=new d.DropDownButton({content:"100%",items:c,enableRtl:this.container.enableRtl,select:this.onZoom.bind(this)}),this.zoom.isStringTemplate=!0,this.zoom.appendTo(h)},e.prototype.addSpellCheckElement=function(){var e=this,i=t.createElement("button",{className:"e-de-statusbar-spellcheck"});this.statusBarDiv.appendChild(i),i.setAttribute("title","Spell Checker options");var n=[{text:"Spell Check"},{text:"Underline errors"}];return this.spellCheckButton=new d.DropDownButton({content:"Spelling",items:n,enableRtl:this.container.enableRtl,select:this.onSpellCheck.bind(this),beforeItemRender:function(i){i.element.innerHTML="<span></span>"+i.item.text,t.isNullOrUndefined(e.currentLanguage)&&(e.currentLanguage=e.documentEditor.spellChecker.languageID),t.isNullOrUndefined(e.allowSuggestion)&&(e.allowSuggestion=e.documentEditor.spellChecker.allowSpellCheckAndSuggestion);var n=i.element.children[0];"Spell Check"===i.item.text&&e.documentEditor.enableSpellCheck&&e.documentEditor.spellChecker.enableSpellCheck?(n.style.marginRight="10px",n.setAttribute("class","e-de-selected-spellcheck-item")):"Underline errors"===i.item.text&&e.documentEditor.enableSpellCheck&&e.documentEditor.spellChecker.enableSpellCheck&&!e.documentEditor.spellChecker.removeUnderline?(n.style.marginRight="10px",n.setAttribute("class","e-de-selected-underline-item")):(n.style.marginRight="25px",i.element.children[0].classList.remove("e-de-selected-spellcheck-item"),i.element.children[0].classList.remove("e-de-selected-underline-item"))}}),i},e.prototype.onZoom=function(e){this.setZoomValue(e.item.text),this.updateZoomContent()},e.prototype.onSpellCheck=function(e){this.setSpellCheckValue(e.item.text)},e.prototype.updateZoomContent=function(){this.zoom.content=Math.round(100*this.documentEditor.zoomFactor)+"%"},e.prototype.setSpellCheckValue=function(e){var t=this;this.spellCheckButton.content="Spelling",e.match(this.localObj.getConstant("Spell Check"))?(this.documentEditor.spellChecker.enableSpellCheck=!this.documentEditor.spellChecker.enableSpellCheck,setTimeout(function(){t.documentEditor.enableSpellCheck&&t.documentEditor.spellChecker.enableSpellCheck&&(t.documentEditor.documentHelper.triggerElementsOnLoading=!0,t.documentEditor.documentHelper.triggerSpellCheck=!0)},50),this.documentEditor.documentHelper.triggerSpellCheck=!1,this.documentEditor.documentHelper.triggerElementsOnLoading=!1):e.match(this.localObj.getConstant("Underline errors"))&&this.documentEditor.enableSpellCheck&&this.documentEditor.spellChecker.enableSpellCheck&&(this.documentEditor.spellChecker.removeUnderline=!this.documentEditor.spellChecker.removeUnderline)},e.prototype.setZoomValue=function(e){e.match(this.localObj.getConstant("Fit one page"))?this.documentEditor.fitPage("FitOnePage"):e.match(this.localObj.getConstant("Fit page width"))?this.documentEditor.fitPage("FitPageWidth"):this.documentEditor.zoomFactor=parseInt(e,10)/100},e.prototype.updatePageCount=function(){this.pageCount.textContent=this.editorPageCount.toString()},e.prototype.updatePageNumber=function(){this.pageNumberInput.value=this.startPage.toString(),this.updatePageNumberWidth()},e.prototype.updatePageNumberOnViewChange=function(e){this.documentEditor.selection&&this.documentEditor.selection.startPage>=e.startPage&&this.documentEditor.selection.startPage<=e.endPage?this.startPage=this.documentEditor.selection.startPage:this.startPage=e.startPage,this.updatePageNumber(),this.updatePageCount()},e.prototype.wireEvents=function(){var e=this;this.pageNumberInput.addEventListener("keydown",function(t){13===t.which&&(t.preventDefault(),parseInt(e.pageNumberInput.value,10)>e.editorPageCount?e.updatePageNumber():e.documentEditor.selection?e.documentEditor.selection.goToPage(parseInt(e.pageNumberInput.value,10)):e.documentEditor.scrollToPage(parseInt(e.pageNumberInput.value,10)),e.pageNumberInput.contentEditable="false",""===e.pageNumberInput.value&&e.updatePageNumber()),t.which>64&&t.preventDefault()}),this.pageNumberInput.addEventListener("keyup",function(){e.updatePageNumberWidth()}),this.pageNumberInput.addEventListener("blur",function(){(""===e.pageNumberInput.value||parseInt(e.pageNumberInput.value,10)>e.editorPageCount)&&e.updatePageNumber(),e.pageNumberInput.contentEditable="false"}),this.pageNumberInput.addEventListener("focus",function(){e.pageNumberInput.select()})},e.prototype.updatePageNumberWidth=function(){this.pageNumberInput&&(this.pageNumberInput.style.width=this.pageNumberInput.value.length>=3?"30px":"22px")},e.prototype.toggleWebLayout=function(){this.addRemoveClass(this.pageButton,this.webButton)},e.prototype.addRemoveClass=function(e,t){e.classList.add("e-btn-toggle"),t.classList.contains("e-btn-toggle")&&t.classList.remove("e-btn-toggle")},e.prototype.createButtonTemplate=function(e,i,n,o,s,a){s=t.createElement("Button",{className:e,attrs:{type:"button"}}),o.appendChild(s);var l=new r.Button({cssClass:e,iconCss:i,enableRtl:this.container.enableRtl});return!0===a&&s.classList.add("e-btn-toggle"),l.appendTo(s),s.setAttribute("title",n),s},e.prototype.destroy=function(){this.container=void 0,this.zoom&&(this.zoom.destroy(),this.zoom=void 0),this.spellCheckButton&&(this.spellCheckButton.destroy(),this.spellCheckButton=void 0),this.pageButton&&(this.pageButton=void 0),this.webButton&&(this.webButton=void 0)},e}(),Ji=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}}(),Zi=function(e,t,i,n){var r,o=arguments.length,s=o<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,i):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,n);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(s=(o<3?r(s):o>3?r(t,i,s):r(t,i))||s);return o>3&&s&&Object.defineProperty(t,i,s),s},Qi=function(e){function i(t,i){var n=e.call(this,t,i)||this;return n.previousContext="",n.showHeaderProperties=!0,n.defaultLocale={New:"New","Insert Footnote":"Insert Footnote","Insert Endnote":"Insert Endnote","Footnote Tooltip":"Insert Footnote (Alt+Ctrl+F).","Endnote Tooltip":"Insert Endnote (Alt+Ctrl+D).",Open:"Open",Undo:"Undo",Redo:"Redo",Image:"Image",Table:"Table",Link:"Link",Bookmark:"Bookmark","Table of Contents":"Table of Contents","HEADING - - - - 1":"HEADING - - - - 1","HEADING - - - - 2":"HEADING - - - - 2","HEADING - - - - 3":"HEADING - - - - 3",Header:"Header",Footer:"Footer","Page Setup":"Page Setup","Page Number":"Page Number",Break:"Break",Find:"Find","Local Clipboard":"Local Clipboard","Restrict Editing":"Restrict Editing","Upload from computer":"Upload from computer","By URL":"By URL","Page Break":"Page Break","Show properties pane":"Show properties pane","Hide properties pane":"Hide properties pane","Section Break":"Section Break","Header And Footer":"Header & Footer",Options:"Options",Levels:"Levels","Different First Page":"Different First Page","Different header and footer for odd and even pages":"Different header and footer for odd and even pages.","Different Odd And Even Pages":"Different Odd & Even Pages","Different header and footer for first page":"Different header and footer for first page.",Position:"Position","Header from Top":"Header from Top","Footer from Bottom":"Footer from Bottom","Distance from top of the page to top of the header":"Distance from top of the page to top of the header.","Distance from bottom of the page to bottom of the footer":"Distance from bottom of the page to bottom of the footer.","Aspect ratio":"Aspect ratio",W:"W",H:"H",Width:"Width",Height:"Height",Text:"Text",Paragraph:"Paragraph",Fill:"Fill","Fill color":"Fill color","Border Style":"Border Style","Outside borders":"Outside borders","All borders":"All borders","Inside borders":"Inside borders","Left border":"Left border","Inside vertical border":"Inside vertical border","Right border":"Right border","Top border":"Top border","Inside horizontal border":"Inside horizontal border","Bottom border":"Bottom border","Border color":"Border color","Border width":"Border width",Cell:"Cell","Merge cells":"Merge cells","Insert Or Delete":"Insert / Delete","Insert columns to the left":"Insert columns to the left","Insert columns to the right":"Insert columns to the right","Insert rows above":"Insert rows above","Insert rows below":"Insert rows below","Delete rows":"Delete rows","Delete columns":"Delete columns","Cell Margin":"Cell Margin",Top:"Top",Bottom:"Bottom",Left:"Left",Right:"Right","Align Text":"Align Text","Align top":"Align top","Align bottom":"Align bottom","Align center":"Align center","Number of heading or outline levels to be shown in table of contents":"Number of heading or outline levels to be shown in table of contents.","Show page numbers":"Show page numbers","Show page numbers in table of contents":"Show page numbers in table of contents.","Right align page numbers":"Right align page numbers","Right align page numbers in table of contents":"Right align page numbers in table of contents.","Use hyperlinks":"Use hyperlinks","Use hyperlinks instead of page numbers":"Use hyperlinks instead of page numbers.",Font:"Font","Font Size":"Font Size","Font color":"Font color","Text highlight color":"Text highlight color","Clear all formatting":"Clear all formatting","Bold Tooltip":"Bold (Ctrl+B)","Italic Tooltip":"Italic (Ctrl+I)","Underline Tooltip":"Underline (Ctrl+U)",Strikethrough:"Strikethrough","Superscript Tooltip":"Superscript (Ctrl+Shift++)","Subscript Tooltip":"Subscript (Ctrl+=)","Align left Tooltip":"Align left (Ctrl+L)","Center Tooltip":"Center (Ctrl+E)","Align right Tooltip":"Align right (Ctrl+R)","Justify Tooltip":"Justify (Ctrl+J)","Decrease indent":"Decrease indent","Increase indent":"Increase indent","Line spacing":"Line spacing",Bullets:"Bullets",Numbering:"Numbering",Styles:"Styles","Manage Styles":"Manage Styles",Page:"Page",of:"of","Fit one page":"Fit one page","Spell Check":"Spell Check","Underline errors":"Underline errors","Fit page width":"Fit page width",Update:"Update",Cancel:"Cancel",Insert:"Insert","No Border":"No Border","Create a new document":"Create a new document.","Open a document":"Open a document.","Undo Tooltip":"Undo the last operation (Ctrl+Z).","Redo Tooltip":"Redo the last operation (Ctrl+Y).","Insert inline picture from a file":"Insert inline picture from a file.","Insert a table into the document":"Insert a table into the document","Create Hyperlink":"Create a link in your document for quick access to web pages and files (Ctrl+K).","Insert a bookmark in a specific place in this document":"Insert a bookmark in a specific place in this document.","Provide an overview of your document by adding a table of contents":"Provide an overview of your document by adding a table of contents.","Add or edit the header":"Add or edit the header.","Add or edit the footer":"Add or edit the footer.","Open the page setup dialog":"Open the page setup dialog.","Add page numbers":"Add page numbers.","Find Text":"Find text in the document (Ctrl+F).","Toggle between the internal clipboard and system clipboard":"Toggle between the internal clipboard and system clipboard.</br>Access to system clipboard through script is denied due to browsers security policy. Instead, </br> 1. You can enable internal clipboard to cut, copy and paste within the component.</br> 2. You can use the keyboard shortcuts (Ctrl+X, Ctrl+C and Ctrl+V) to cut, copy and paste with system clipboard.","Current Page Number":"The current page number in the document. Click or tap to navigate specific page.","Read only":"Read only",Protections:"Protections","Error in establishing connection with web server":"Error in establishing connection with web server",Single:"Single",Double:"Double","New comment":"New comment",Comments:"Comments","Print layout":"Print layout","Web layout":"Web layout","Form Fields":"Form Fields","Text Form":"Text Form","Check Box":"Check Box",DropDown:"Drop-Down","Update Fields":"Update Fields","Update cross reference fields":"Update cross reference fields","Track Changes":"Keep track of the changes made in the document",TrackChanges:"Track Changes",AllCaps:"AllCaps","Change case Tooltip":"Change case"},n}return Ji(i,e),Object.defineProperty(i.prototype,"documentEditor",{get:function(){return this.documentEditorInternal},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"toolbar",{get:function(){return this.toolbarModule},enumerable:!0,configurable:!0}),i.prototype.getModuleName=function(){return"DocumentEditorContainer"},i.prototype.onPropertyChanged=function(e,i){for(var n=0,r=Object.keys(e);n<r.length;n++)switch(r[n]){case"restrictEditing":this.restrictEditingToggleHelper(e.restrictEditing);break;case"showPropertiesPane":this.showHidePropertiesPane(e.showPropertiesPane);break;case"enableTrackChanges":this.documentEditor&&(this.documentEditor.enableTrackChanges=e.enableTrackChanges,this.documentEditor.showRevisions=e.enableTrackChanges,this.toolbarModule&&this.toolbarModule.toggleTrackChanges(e.enableTrackChanges),this.documentEditor.enableTrackChanges&&(this.documentEditor.documentHelper.showRevision=!0),this.documentEditor.resize());break;case"enableLocalPaste":this.documentEditor&&(this.documentEditor.enableLocalPaste=e.enableLocalPaste);break;case"serviceUrl":this.documentEditor&&(this.documentEditor.serviceUrl=e.serviceUrl);break;case"serverActionSettings":this.documentEditor&&this.setserverActionSettings();break;case"zIndex":this.documentEditor&&(this.documentEditor.zIndex=e.zIndex);break;case"headers":this.documentEditor&&(this.documentEditor.headers=e.headers);break;case"locale":case"enableRtl":this.refresh();break;case"enableComment":this.documentEditor&&(this.documentEditor.enableComment=e.enableComment),this.toolbarModule&&this.toolbarModule.enableDisableInsertComment(e.enableComment);break;case"enableSpellCheck":this.documentEditor&&(this.documentEditor.enableSpellCheck=e.enableSpellCheck);break;case"documentEditorSettings":this.documentEditor&&this.customizeDocumentEditorSettings();break;case"toolbarItems":this.toolbarModule&&this.toolbarModule.reInitToolbarItems(e.toolbarItems);break;case"currentUser":this.documentEditor&&(this.documentEditor.currentUser=e.currentUser);break;case"userColor":this.documentEditor&&(this.documentEditor.userColor=e.userColor);break;case"layoutType":this.documentEditor&&(this.documentEditor.layoutType=e.layoutType);break;case"enableToolbar":this.createToolbarContainer(this.enableRtl,!0),e.enableToolbar&&this.toolbarModule&&(this.toolbarModule.initToolBar(this.toolbarItems),this.toolbarModule.enableDisableInsertComment(this.enableComment),this.toolbarModule.toggleTrackChanges(this.enableTrackChanges)),this.documentEditor&&this.documentEditor.resize();break;case"height":this.element.style.height=t.formatUnit(this.height),this.documentEditor&&this.documentEditor.resize();break;case"width":this.element.style.width=t.formatUnit(this.width),this.documentEditor&&this.documentEditor.resize()}},i.prototype.preRender=function(){this.localObj=new t.L10n("documenteditorcontainer",this.defaultLocale,this.locale),this.initContainerElement()},i.prototype.render=function(){this.toolbarModule&&(this.toolbarModule.initToolBar(this.toolbarItems),this.toolbarModule.enableDisableInsertComment(this.enableComment)),""!==this.height&&(this.element.style.height=t.formatUnit(this.height)),""!==this.width&&(this.element.style.width=t.formatUnit(this.width)),this.element.style.minHeight="320px",this.initializeDocumentEditor(),this.restrictEditing&&this.restrictEditingToggleHelper(this.restrictEditing),this.textProperties=new ji(this,this.element.id,!1,this.enableRtl),this.headerFooterProperties=new qi(this,this.enableRtl),this.imageProperties=new Gi(this,this.enableRtl),this.tocProperties=new Ki(this,this.enableRtl),this.tableProperties=new Xi(this,this.imageProperties,this.textProperties,this.enableRtl),this.statusBar=new Yi(this.statusBarElement,this),n.createSpinner({target:this.containerTarget,cssClass:"e-spin-overlay"}),this.setserverActionSettings(),this.customizeDocumentEditorSettings(),this.renderComplete()},i.prototype.restrictEditingToggleHelper=function(e){this.documentEditor.isReadOnly=e,this.toolbarModule&&this.toolbarModule.enableDisableToolBarItem(!e,!1),this.showPropertiesPane=!e,this.showHidePropertiesPane(!e),this.documentEditor.trackChangesPane.enableDisableButton(!e)},i.prototype.setFormat=function(){this.characterFormat&&this.documentEditor.setDefaultCharacterFormat(this.characterFormat),this.paragraphFormat&&this.documentEditor.setDefaultParagraphFormat(this.paragraphFormat),this.sectionFormat&&this.documentEditor.setDefaultSectionFormat(this.sectionFormat)},i.prototype.setserverActionSettings=function(){this.serviceUrl&&(this.documentEditor.serviceUrl=this.serviceUrl),this.serverActionSettings.spellCheck&&(this.documentEditor.serverActionSettings.spellCheck=this.serverActionSettings.spellCheck),this.serverActionSettings.restrictEditing&&(this.documentEditor.serverActionSettings.restrictEditing=this.serverActionSettings.restrictEditing),this.serverActionSettings.systemClipboard&&(this.documentEditor.serverActionSettings.systemClipboard=this.serverActionSettings.systemClipboard),this.headers&&(this.documentEditor.headers=this.headers)},i.prototype.customizeDocumentEditorSettings=function(){if(this.documentEditorSettings.formFieldSettings){var e=this.documentEditorSettings.formFieldSettings,i=this.documentEditor;t.isNullOrUndefined(e.applyShading)||(i.documentEditorSettings.formFieldSettings.applyShading=e.applyShading),t.isNullOrUndefined(e.formFillingMode)||(i.documentEditorSettings.formFieldSettings.formFillingMode=e.formFillingMode),t.isNullOrUndefined(e.formattingExceptions)||(i.documentEditorSettings.formFieldSettings.formattingExceptions=e.formattingExceptions),t.isNullOrUndefined(e.selectionColor)||(i.documentEditorSettings.formFieldSettings.selectionColor=e.selectionColor),t.isNullOrUndefined(e.shadingColor)||(i.documentEditorSettings.formFieldSettings.shadingColor=e.shadingColor)}this.documentEditorSettings.searchHighlightColor&&(this.documentEditor.documentEditorSettings.searchHighlightColor=this.documentEditorSettings.searchHighlightColor),this.documentEditorSettings.fontFamilies&&(this.documentEditor.documentEditorSettings.fontFamilies=this.documentEditorSettings.fontFamilies),this.documentEditorSettings.collaborativeEditingSettings&&(this.documentEditor.documentEditorSettings.collaborativeEditingSettings=this.documentEditorSettings.collaborativeEditingSettings)},i.prototype.getPersistData=function(){return"documenteditor-container"},i.prototype.requiredModules=function(){var e=[];return this.enableToolbar&&e.push({member:"toolbar",args:[this]}),e},i.prototype.initContainerElement=function(){var e=this.enableRtl;this.containerTarget=this.createElement("div",{className:"e-de-ctn"}),this.createToolbarContainer(e);var t;t=e?"e-de-pane-rtl":"e-de-pane",this.propertiesPaneContainer=this.createElement("div",{className:t,styles:"display:none"}),this.editorContainer.appendChild(this.propertiesPaneContainer),this.containerTarget.appendChild(this.editorContainer),this.statusBarElement=this.createElement("div",{className:"e-de-status-bar"}),e&&(this.statusBarElement.style.direction="rtl"),this.containerTarget.appendChild(this.statusBarElement),this.element.appendChild(this.containerTarget)},i.prototype.createToolbarContainer=function(e,i){t.isNullOrUndefined(this.editorContainer)&&(this.editorContainer=this.createElement("div",{className:"e-de-tool-ctnr-properties-pane"+(e?" e-de-ctnr-rtl":"")})),this.enableToolbar?(this.toolbarContainer=this.createElement("div",{className:"e-de-ctnr-toolbar"+(e?" e-de-ctnr-rtl":"")}),i?this.containerTarget.insertBefore(this.toolbarContainer,this.containerTarget.firstChild):this.containerTarget.appendChild(this.toolbarContainer),this.editorContainer.classList.remove("e-de-ctnr-properties-pane"),this.editorContainer.classList.add("e-de-tool-ctnr-properties-pane")):(this.editorContainer.classList.remove("e-de-tool-ctnr-properties-pane"),this.editorContainer.classList.add("e-de-ctnr-properties-pane"))},i.prototype.initializeDocumentEditor=function(){var e=this.element.id+"_editor",t=this.createElement("div",{id:e,styles:"width:100%;height:100%"});this.documentEditorInternal=new Bi({isReadOnly:!1,enableRtl:this.enableRtl,selectionChange:this.onSelectionChange.bind(this),contentChange:this.onContentChange.bind(this),documentChange:this.onDocumentChange.bind(this),zoomFactorChange:this.onZoomFactorChange.bind(this),requestNavigate:this.onRequestNavigate.bind(this),viewChange:this.onViewChange.bind(this),customContextMenuSelect:this.onCustomContextMenuSelect.bind(this),customContextMenuBeforeOpen:this.onCustomContextMenuBeforeOpen.bind(this),beforePaneSwitch:this.onBeforePaneSwitch.bind(this),commentBegin:this.onCommentBegin.bind(this),commentEnd:this.onCommentEnd.bind(this),commentDelete:this.onCommentDelete.bind(this),beforeCommentAction:this.onCommentAction.bind(this),trackChange:this.onTrackChange.bind(this),serviceFailure:this.fireServiceFailure.bind(this),locale:this.locale,acceptTab:!0,zIndex:this.zIndex,enableLocalPaste:this.enableLocalPaste,layoutType:this.layoutType,pageOutline:"#E0E0E0",currentUser:this.currentUser,userColor:this.userColor,height:"100%",width:"100%",enableTrackChanges:this.enableTrackChanges,showRevisions:this.enableTrackChanges,enableLockAndEdit:this.enableLockAndEdit}),this.documentEditor.enableAllModules(),this.documentEditor.enableComment=this.enableComment,this.editorContainer.insertBefore(t,this.editorContainer.firstChild),this.setFormat(),this.documentEditor.appendTo(t),this.documentEditor.resize()},i.prototype.onCommentBegin=function(){this.toolbarModule&&this.toolbarModule.enableDisableInsertComment(!1)},i.prototype.onCommentEnd=function(){this.toolbarModule&&this.toolbarModule.enableDisableInsertComment(this.enableComment)},i.prototype.onCommentDelete=function(e){this.trigger("commentDelete",e)},i.prototype.onCommentAction=function(e){this.trigger("beforeCommentAction",e)},i.prototype.onTrackChange=function(e){this.trigger("trackChange",e),this.toolbarModule&&this.toolbarModule.toggleTrackChanges(e.isTrackChangesEnabled)},i.prototype.onBeforePaneSwitch=function(e){this.trigger("beforePaneSwitch",e)},i.prototype.fireServiceFailure=function(e){this.trigger("serviceFailure",e)},i.prototype.showHidePropertiesPane=function(e){this.showPropertiesPane&&this.showPropertiesPaneOnSelection(),this.propertiesPaneContainer.style.display=e?"block":"none",this.toolbarModule&&(this.toolbarModule.propertiesPaneButton.element.style.opacity=e?"1":"0.5"),this.documentEditor.resize()},i.prototype.resize=function(e,i){this.element&&(t.isNullOrUndefined(i)&&this.element&&this.element.parentElement&&(i=this.element.parentElement.clientHeight),t.isNullOrUndefined(e)&&this.element&&this.element.parentElement&&(e=this.element.parentElement.clientWidth),!t.isNullOrUndefined(e)&&e>200&&(this.width=e.toString(),this.element.style.width=e+"px"),!t.isNullOrUndefined(i)&&i>200&&(this.height=i.toString(),this.element.style.height=i+"px"),this.documentEditor&&this.documentEditor.resize(),this.toolbarModule&&this.toolbarModule.toolbar.refreshOverflow())},i.prototype.onContentChange=function(){this.toolbarModule&&this.toolbarModule.enableDisableUndoRedo(),this.statusBar&&this.statusBar.updatePageCount();var e={source:t.isBlazor()?null:this};this.trigger("contentChange",e)},i.prototype.onDocumentChange=function(){this.enableTrackChanges=this.documentEditor.enableTrackChanges,this.toolbarModule&&(this.toolbarModule.isCommentEditing=!1,this.toolbarModule.enableDisableInsertComment(!0),this.toolbarModule.enableDisableUndoRedo()),this.textProperties&&this.textProperties.updateStyles(),this.statusBar&&this.statusBar.updatePageCount();var e={source:t.isBlazor()?null:this};this.trigger("documentChange",e)},i.prototype.onSelectionChange=function(){var e=this;setTimeout(function(){e.showPropertiesPaneOnSelection();var i={source:t.isBlazor()?null:e};e.trigger("selectionChange",i)})},i.prototype.onZoomFactorChange=function(){this.statusBar&&this.statusBar.updateZoomContent()},i.prototype.onRequestNavigate=function(e){if("Bookmark"!==e.linkType){var t=e.navigationLink;e.localReference.length>0&&(t+="#"+e.localReference),window.open(t),e.isHandled=!0}},i.prototype.onViewChange=function(e){this.statusBar&&this.statusBar.updatePageNumberOnViewChange(e)},i.prototype.onCustomContextMenuSelect=function(e){this.trigger("customContextMenuSelect",e)},i.prototype.onCustomContextMenuBeforeOpen=function(e){this.trigger("customContextMenuBeforeOpen",e)},i.prototype.showPropertiesPaneOnSelection=function(){if(!this.restrictEditing&&void 0!==this.textProperties||this.showPropertiesPane){var e="NoProtection"!==this.documentEditor.documentHelper.protectionType,t=e&&this.documentEditor.documentHelper.restrictFormatting,i=this.documentEditor.editor.restrictEditing;if(e)this.toolbarModule&&this.toolbarModule.enableDisableToolBarItem(!i,!0),this.textProperties.enableDisableElements(!t&&!i),this.tableProperties.enableDisableElements(!t&&!i),this.tocProperties.enableDisableElements(!i),this.headerFooterProperties.enableDisableElements(!i),this.imageProperties.enableDisableElements(!i);else{var n=!this.documentEditor.isReadOnly;this.toolbarModule&&this.toolbarModule.enableDisableToolBarItem(n,!0),this.textProperties.enableDisableElements(n||this.showPropertiesPane),this.tableProperties.enableDisableElements(!0),this.tocProperties.enableDisableElements(!0),this.headerFooterProperties.enableDisableElements(!0),this.imageProperties.enableDisableElements(!0)}var r=this.documentEditor.selection.contextType,o=r.indexOf("Header")>=0||r.indexOf("Footer")>=0;o||(this.showHeaderProperties=!0),this.showPropertiesPane?(this.propertiesPaneContainer.style.display="block",o&&this.showHeaderProperties?this.showProperties("headerfooter"):r.indexOf("List")>=0||r.indexOf("Text")>=0&&r.indexOf("Table")<0?this.showProperties("text"):r.indexOf("Image")>=0?this.showProperties("image"):r.indexOf("TableOfContents")>=0?this.showProperties("toc"):r.indexOf("Table")>=0&&this.showProperties("table")):(this.showHidePropertiesPane(!1),this.propertiesPaneContainer.style.display="none"),this.previousContext=this.documentEditor.selection.contextType,this.toolbarModule&&this.toolbarModule.toolbar&&this.toolbarModule.enableDisableInsertComment(!this.documentEditor.enableHeaderAndFooter&&this.enableComment&&!this.documentEditor.isReadOnlyMode)}},i.prototype.showProperties=function(e){this.toolbarModule&&"headerfooter"!==e&&"toc"!==e&&this.toolbarModule.enableDisablePropertyPaneButton(!0),this.textProperties.showTextProperties("text"===e),this.tableProperties.showTableProperties("table"===e),this.imageProperties.showImageProperties("image"===e),this.headerFooterProperties.showHeaderFooterPane("headerfooter"===e),this.tocProperties.showTocPane("toc"===e)},i.prototype.setDefaultCharacterFormat=function(e){this.characterFormat=e},i.prototype.setDefaultParagraphFormat=function(e){this.paragraphFormat=e},i.prototype.setDefaultSectionFormat=function(e){this.sectionFormat=e},i.prototype.destroy=function(){e.prototype.destroy.call(this),this.element&&(this.element.classList.remove("e-documenteditorcontainer"),this.element.innerHTML=""),this.refreshing||(this.element=void 0),this.toolbarContainer&&this.toolbarContainer.parentElement&&(this.toolbarContainer.innerHTML="",this.toolbarContainer.parentElement.removeChild(this.toolbarContainer)),this.toolbarContainer=void 0,this.documentEditorInternal&&this.documentEditorInternal.destroy(),this.documentEditorInternal=void 0,this.textProperties&&this.textProperties.destroy(),this.textProperties=void 0,this.headerFooterProperties&&this.headerFooterProperties.destroy(),this.headerFooterProperties=void 0,this.imageProperties&&this.imageProperties.destroy(),this.imageProperties=void 0,this.tocProperties&&this.tocProperties.destroy(),this.tocProperties=void 0,this.tableProperties&&this.tableProperties.destroy(),this.tableProperties=void 0,this.statusBar&&this.statusBar.destroy(),this.propertiesPaneContainer&&this.editorContainer.parentElement&&(this.propertiesPaneContainer.innerHTML="",this.propertiesPaneContainer.parentElement.removeChild(this.propertiesPaneContainer)),this.propertiesPaneContainer=void 0,this.editorContainer&&this.editorContainer.parentElement&&(this.editorContainer.innerHTML="",this.editorContainer.parentElement.removeChild(this.editorContainer)),this.statusBarElement&&this.statusBarElement.parentElement&&(this.statusBarElement.innerHTML="",this.statusBarElement.parentElement.removeChild(this.statusBarElement)),this.containerTarget&&this.containerTarget.parentElement&&(this.containerTarget.innerHTML="",this.containerTarget.parentElement.removeChild(this.containerTarget)),this.containerTarget=void 0,this.statusBarElement=void 0,this.editorContainer=void 0},Zi([t.Property(!0)],i.prototype,"showPropertiesPane",void 0),Zi([t.Property(!0)],i.prototype,"enableToolbar",void 0),Zi([t.Property(!1)],i.prototype,"restrictEditing",void 0),Zi([t.Property(!1)],i.prototype,"enableSpellCheck",void 0),Zi([t.Property(!1)],i.prototype,"enableTrackChanges",void 0),Zi([t.Property("Pages")],i.prototype,"layoutType",void 0),Zi([t.Property("")],i.prototype,"currentUser",void 0),Zi([t.Property("#FFFF00")],i.prototype,"userColor",void 0),Zi([t.Property(!1)],i.prototype,"enableLocalPaste",void 0),Zi([t.Property()],i.prototype,"serviceUrl",void 0),Zi([t.Property(2e3)],i.prototype,"zIndex",void 0),Zi([t.Property(!1)],i.prototype,"enableCsp",void 0),Zi([t.Property(!0)],i.prototype,"enableComment",void 0),Zi([t.Property("100%")],i.prototype,"width",void 0),Zi([t.Property("320px")],i.prototype,"height",void 0),Zi([t.Property(!1)],i.prototype,"enableLockAndEdit",void 0),Zi([t.Event()],i.prototype,"created",void 0),Zi([t.Event()],i.prototype,"destroyed",void 0),Zi([t.Event()],i.prototype,"contentChange",void 0),Zi([t.Event()],i.prototype,"selectionChange",void 0),Zi([t.Event()],i.prototype,"documentChange",void 0),Zi([t.Event()],i.prototype,"toolbarClick",void 0),Zi([t.Event()],i.prototype,"customContextMenuSelect",void 0),Zi([t.Event()],i.prototype,"customContextMenuBeforeOpen",void 0),Zi([t.Event()],i.prototype,"beforePaneSwitch",void 0),Zi([t.Event()],i.prototype,"commentDelete",void 0),Zi([t.Event()],i.prototype,"beforeCommentAction",void 0),Zi([t.Event()],i.prototype,"serviceFailure",void 0),Zi([t.Event()],i.prototype,"trackChange",void 0),Zi([t.Event()],i.prototype,"contentControl",void 0),Zi([t.Complex({},Li)],i.prototype,"documentEditorSettings",void 0),Zi([t.Property({import:"Import",systemClipboard:"SystemClipboard",spellCheck:"SpellCheck",restrictEditing:"RestrictEditing",canLock:"CanLock",getPendingActions:"GetPendingActions"})],i.prototype,"serverActionSettings",void 0),Zi([t.Property(["New","Open","Separator","Undo","Redo","Separator","Image","Table","Hyperlink","Bookmark","TableOfContents","Separator","Header","Footer","PageSetup","PageNumber","Break","InsertFootnote","InsertEndnote","Separator","Find","Separator","Comments","TrackChanges","Separator","LocalClipboard","RestrictEditing","Separator","FormFields","UpdateFields"])],i.prototype,"toolbarItems",void 0),Zi([t.Property([])],i.prototype,"headers",void 0),i=Zi([t.NotifyPropertyChanges],i)}(t.Component);return Bi.Inject(y,si,ri,oi,Ot,Mt,zt,ii,At,yt,Zt,ai,li,di,hi,ci,pi,gi,mi,xi,fi,vi,yi,bi,wi,Ci,Ii,Fi,ni),Qi.Inject(zi),e.Dictionary=g,e.WUniqueFormat=m,e.WUniqueFormats=f,e.XmlHttpRequestHandler=v,e.Print=y,e.ContextMenu=yt,e.WSectionFormat=b,e.WStyle=B,e.WParagraphStyle=R,e.WCharacterStyle=D,e.WStyles=M,e.WCharacterFormat=H,e.WListFormat=x,e.WTabStop=F,e.WParagraphFormat=P,e.WTableFormat=U,e.WRowFormat=I,e.WCellFormat=z,e.WBorder=T,e.WBorders=S,e.WShading=A,e.WList=C,e.WAbstractList=V,e.WListLevel=_,e.WLevelOverride=w,e.DocumentHelper=ie,e.LayoutViewer=ne,e.PageLayoutViewer=re,e.WebLayoutViewer=oe,e.Rect=ae,e.Padding=le,e.Margin=de,e.Widget=he,e.BlockContainer=ce,e.BodyWidget=pe,e.HeaderFooterWidget=ue,e.BlockWidget=ge,e.FootNoteWidget=me,e.ParagraphWidget=fe,e.TableWidget=ve,e.TableRowWidget=ye,e.TableCellWidget=be,e.LineWidget=we,e.ElementBox=Ce,e.FieldElementBox=xe,e.FormField=Fe,e.TextFormField=Pe,e.CheckBoxFormField=Te,e.DropDownFormField=Se,e.TextElementBox=Ie,e.Footnote=Ne,e.FootnoteElementBox=Ee,e.ErrorTextElementBox=He,e.FieldTextElementBox=We,e.TabElementBox=Oe,e.BookmarkElementBox=ke,e.ContentControl=Le,e.ContentControlProperties=Be,e.ContentControlListItems=Re,e.CheckBoxState=De,e.XmlMapping=Me,e.CustomXmlPart=Ae,e.ShapeCommon=Ue,e.ShapeBase=ze,e.ShapeElementBox=Ve,e.TextFrame=_e,e.LineFormat=je,e.FillFormat=qe,e.ImageElementBox=Ge,e.ListTextElementBox=Ke,e.EditRangeEndElementBox=Xe,e.EditRangeStartElementBox=Ye,e.ChartElementBox=Je,e.ChartArea=Ze,e.ChartCategory=Qe,e.ChartData=$e,e.ChartLegend=et,e.ChartSeries=tt,e.ChartErrorBar=it,e.ChartSeriesFormat=nt,e.ChartDataLabels=rt,e.ChartTrendLines=ot,e.ChartTitleArea=st,e.ChartDataFormat=at,e.ChartFill=lt,e.ChartLayout=dt,e.ChartCategoryAxis=ht,e.ChartDataTable=ct,e.CommentCharacterElementBox=pt,e.CommentElementBox=ut,e.Page=gt,e.WTableHolder=mt,e.WColumn=ft,e.ColumnSizeInfo=vt,e.Layout=j,e.Renderer=q,e.SfdtReader=bt,e.TextHelper=G,e.Zoom=K,e.Selection=Ot,e.SelectionCharacterFormat=wt,e.SelectionParagraphFormat=Ct,e.SelectionSectionFormat=xt,e.SelectionTableFormat=Ft,e.SelectionCellFormat=Pt,e.SelectionRowFormat=Tt,e.SelectionImageFormat=St,e.TextPosition=Nt,e.SelectionWidgetInfo=Et,e.Hyperlink=Ht,e.ImageFormat=Wt,e.Search=Mt,e.OptionsPane=At,e.TextSearch=kt,e.SearchWidgetInfo=Lt,e.TextSearchResult=Bt,e.TextSearchResults=Rt,e.Editor=zt,e.ImageResizer=Zt,e.ImageResizingPoints=Qt,e.SelectedImageInfo=$t,e.TableResizer=Ut,e.HelperMethods=W,e.Point=O,e.Base64=k,e.CollaborativeEditing=ni,e.EditorHistory=ii,e.BaseHistoryInfo=Jt,e.HistoryInfo=ti,e.ModifiedLevel=Vt,e.ModifiedParagraphFormat=_t,e.RowHistoryFormat=jt,e.TableHistoryInfo=qt,e.TableFormatHistoryInfo=Gt,e.RowFormatHistoryInfo=Kt,e.CellFormatHistoryInfo=Xt,e.CellHistoryFormat=Yt,e.WordExport=ri,e.TextExport=oi,e.SfdtExport=si,e.HtmlExport=It,e.HyperlinkDialog=ai,e.TableDialog=li,e.BookmarkDialog=di,e.TableOfContentsDialog=hi,e.PageSetupDialog=ci,e.ParagraphDialog=pi,e.ListDialog=gi,e.StyleDialog=mi,e.BulletsAndNumberingDialog=fi,e.FontDialog=vi,e.TablePropertiesDialog=yi,e.BordersAndShadingDialog=bi,e.TableOptionsDialog=wi,e.CellOptionsDialog=Ci,e.StylesDialog=xi,e.SpellCheckDialog=Fi,e.CheckBoxFormFieldDialog=Pi,e.TextFormFieldDialog=Ti,e.DropDownFormFieldDialog=Si,e.FormFieldPopUp=Q,e.SpellChecker=Ii,e.AddUserDialog=X,e.EnforceProtectionDialog=Y,e.UnProtectDocumentDialog=J,e.RestrictEditing=Z,e.CommentReviewPane=Ni,e.CommentPane=Ei,e.CommentView=Hi,e.Revision=N,e.RevisionCollection=E,e.TrackChangesPane=$,e.ChangesSingleView=ee,e.DocumentEditorSettings=Li,e.DocumentEditor=Bi,e.ServerActionSettings=Ri,e.FormFieldSettings=Di,e.CollaborativeEditingSettings=Mi,e.ContainerServerActionSettings=Ai,e.Toolbar=zi,e.DocumentEditorContainer=Qi,e}({},ej.base,ej.navigations,ej.popups,ej.buttons,ej.lists,ej.dropdowns,ej.inputs,ej.calendars,ej.splitbuttons,ej.officechart,ej.compression,ej.fileutils,ej.data),this.ejs=ej;