403Webshell
Server IP : 121.121.20.254  /  Your IP : 216.73.217.51
Web Server : Microsoft-IIS/10.0
System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64
User : IUSR ( 0)
PHP Version : 8.3.28
Disable Function : NONE
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Program Files/Microsoft Office/root/Office16/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Program Files/Microsoft Office/root/Office16/excel-udf-host.win32.new.bundle
var OSFPerformance,CustomFunctionMappings,Strings;!function(e){e.now=function(){return"undefined"!=typeof performance&&performance.now?performance.now():0},e.getTotalJSHeapSize=function(){return"undefined"!=typeof performance&&performance.memory?performance.memory.totalJSHeapSize:0},e.getUsedJSHeapSize=function(){return"undefined"!=typeof performance&&performance.memory?performance.memory.usedJSHeapSize:0},e.getJSHeapSizeLimit=function(){return"undefined"!=typeof performance&&performance.memory?performance.memory.jsHeapSizeLimit:0},e.officeExecuteStartDate=e.officeExecuteStartDate||Date.now(),e.officeExecuteStart=e.officeExecuteStart||0,e.officeExecuteEnd=e.officeExecuteEnd||0,e.hostInitializationStart=0,e.hostInitializationEnd=0,e.totalJSHeapSize=0,e.usedJSHeapSize=0,e.jsHeapSizeLimit=0,e.createOMEnd=0,e.hostSpecificFileName="",e.getAppContextStart=0,e.getAppContextEnd=0,e.getAppContextXdmStart=0,e.getAppContextXdmEnd=0,e.officeOnReady=0}(OSFPerformance||(OSFPerformance={})),function(e){e.definePropertyOnNamespace=function(e,t,n){Object.defineProperty(e,t,{get:function(){return n()},configurable:!0,enumerable:!0})}}(OSF||(OSF={})),OSFPerformance.hostInitializationStart=OSFPerformance.now(),function(e){!function(e){function t(){return e.m_association||(e.m_association=new OSF.Association),e.m_association}e.m_association=e.m_association,e.associate=function(){OTel&&OTel.OTelLogger&&OTel.OTelLogger.onTelemetryLoaded((function(){Microsoft.Office.WebExtension.sendTelemetryEvent({eventName:"Office.Extensibility.OfficeJs.ApiCall",dataFields:[oteljs.makeStringDataField("Api","Office.actions.associate")],eventFlags:{dataCategories:2,diagnosticLevel:110}})})),t().associate.apply(t(),arguments)},OSF.definePropertyOnNamespace(e,"_association",t)}(e.actions||(e.actions={}))}(Office||(Office={})),function(e){!function(e){e[e.Select=0]="Select",e[e.UnSelect=1]="UnSelect",e[e.CancelDialog=2]="CancelDialog",e[e.InsertAgave=3]="InsertAgave",e[e.CtrlF6In=4]="CtrlF6In",e[e.CtrlF6Exit=5]="CtrlF6Exit",e[e.CtrlF6ExitShift=6]="CtrlF6ExitShift",e[e.SelectWithError=7]="SelectWithError",e[e.NotifyHostError=8]="NotifyHostError",e[e.RefreshAddinCommands=9]="RefreshAddinCommands",e[e.PageIsReady=10]="PageIsReady",e[e.TabIn=11]="TabIn",e[e.TabInShift=12]="TabInShift",e[e.TabExit=13]="TabExit",e[e.TabExitShift=14]="TabExitShift",e[e.EscExit=15]="EscExit",e[e.F2Exit=16]="F2Exit",e[e.ExitNoFocusable=17]="ExitNoFocusable",e[e.ExitNoFocusableShift=18]="ExitNoFocusableShift",e[e.MouseEnter=19]="MouseEnter",e[e.MouseLeave=20]="MouseLeave",e[e.UpdateTargetUrl=21]="UpdateTargetUrl",e[e.InstallCustomFunctions=22]="InstallCustomFunctions",e[e.SendTelemetryEvent=23]="SendTelemetryEvent",e[e.UninstallCustomFunctions=24]="UninstallCustomFunctions",e[e.SendMessage=25]="SendMessage",e[e.LaunchExtensionComponent=26]="LaunchExtensionComponent",e[e.StopExtensionComponent=27]="StopExtensionComponent",e[e.RestartExtensionComponent=28]="RestartExtensionComponent",e[e.EnableTaskPaneHeaderButton=29]="EnableTaskPaneHeaderButton",e[e.DisableTaskPaneHeaderButton=30]="DisableTaskPaneHeaderButton",e[e.TaskPaneHeaderButtonClicked=31]="TaskPaneHeaderButtonClicked",e[e.RemoveAppCommandsAddin=32]="RemoveAppCommandsAddin",e[e.RefreshRibbonGallery=33]="RefreshRibbonGallery",e[e.GetOriginalControlId=34]="GetOriginalControlId",e[e.OfficeJsReady=35]="OfficeJsReady",e[e.InsertDevManifest=36]="InsertDevManifest",e[e.InsertDevManifestError=37]="InsertDevManifestError",e[e.SendCustomerContent=38]="SendCustomerContent",e[e.KeyboardShortcuts=39]="KeyboardShortcuts",e[e.CloseSDXDialog=42]="CloseSDXDialog",e[e.ResizeSDXDialog=43]="ResizeSDXDialog",e[e.SendNonStandardEvent=44]="SendNonStandardEvent",e[e.Interactive=48]="Interactive"}(e.AgaveHostAction||(e.AgaveHostAction={}))}(OSF||(OSF={})),function(e){var t=function(){function t(){var t=this;this._processAppCommandInvocation=function(e){var n=t._verifyManifestCallback(e.callbackName);if(0==n.errorCode){var i=t._constructEventObjectForCallback(e);i?window.setTimeout((function(){n.callback(i)}),0):t._invokeAppCommandCompletedMethod(e.appCommandId,5001,"")}else t._invokeAppCommandCompletedMethod(e.appCommandId,n.errorCode,"")},this._eventDispatch=new e.EventDispatch([{type:e.EventType.AppCommandInvoked,id:e.EventDispId.dispidAppCommandInvokedEvent,getTargetId:function(){return""},fromSafeArrayHost:function(t){return{type:e.EventType.AppCommandInvoked,appCommandId:t[0],callbackName:t[1],eventObjStr:t[2]}},fromWebHost:function(t){return{type:e.EventType.AppCommandInvoked,appCommandId:t[0],callbackName:t[1],eventObjStr:t[2]}}}])}return t.prototype.initializeEventHandler=function(t){var n=this;this.addHandlerAsync(e.EventType.AppCommandInvoked,(function(e){n._processAppCommandInvocation(e)}),t)},t.prototype.appCommandInvocationCompletedAsync=function(t,n,i,r){e._OfficeAppFactory.getAsyncMethodExecutor().executeAsync(94,{fromSafeArrayHost:function(e){return e},fromWebHost:function(e){return e},toSafeArrayHost:function(){return[t,n,i]},toWebHost:function(){var e={};return e[0]=t,e[1]=n,e[2]=i,e}},r)},t.prototype.addHandlerAsync=function(t,n,i){e.EventHelper.addEventHandler(t,n,i,this._eventDispatch,void 0,e.OUtil.isPopupWindow())},t.prototype._verifyManifestCallback=function(e){var t={callback:null,errorCode:11101};e=e.trim();try{var n=this._getCallbackFunc(e);if("function"!=typeof n)return t}catch(e){return t}return{callback:n,errorCode:0}},t.prototype._getCallbackFuncFromActionAssociateTable=function(e){var t=e.toUpperCase();return Office.actions._association.mappings[t]},t.prototype._getCallbackFunc=function(e){return this._getCallbackFuncFromActionAssociateTable(e)},t.prototype._invokeAppCommandCompletedMethod=function(e,t,n){this.appCommandInvocationCompletedAsync(e,t,n,(function(e){e.status!==Office.AsyncResultStatus.Succeeded&&console.error("Failed to notify the host thta app command is completed")}))},t.prototype._constructEventObjectForCallback=function(e){var t,n,i=this;try{t=JSON.parse(e.eventObjStr),n=JSON.parse(e.eventObjStr)}catch(e){}return t||(t={}),n||(n={}),t.completed=function(t){n.completedContext=t;var r=JSON.stringify(n);i._invokeAppCommandCompletedMethod(e.appCommandId,0,r)},t},t.initialize=function(){null==t._instance&&(t._instance=new t,t._instance.initializeEventHandler((function(e){e.status!==Office.AsyncResultStatus.Succeeded&&console.error("Cannot initialize app command: "+JSON.stringify(e))})))},t._instance=null,t}();e.AppCommandManager=t}(OSF||(OSF={})),function(e){!function(e){e[e.Unsupported=0]="Unsupported",e[e.Excel=1]="Excel",e[e.Word=2]="Word",e[e.PowerPoint=4]="PowerPoint",e[e.Outlook=8]="Outlook",e[e.ExcelWebApp=16]="ExcelWebApp",e[e.WordWebApp=32]="WordWebApp",e[e.OutlookWebApp=64]="OutlookWebApp",e[e.Project=128]="Project",e[e.AccessWebApp=256]="AccessWebApp",e[e.PowerpointWebApp=512]="PowerpointWebApp",e[e.ExcelIOS=1024]="ExcelIOS",e[e.Sway=2048]="Sway",e[e.WordIOS=4096]="WordIOS",e[e.PowerPointIOS=8192]="PowerPointIOS",e[e.Access=16384]="Access",e[e.Lync=32768]="Lync",e[e.OutlookIOS=65536]="OutlookIOS",e[e.OneNoteWebApp=131072]="OneNoteWebApp",e[e.OneNote=262144]="OneNote",e[e.ExcelWinRT=524288]="ExcelWinRT",e[e.WordWinRT=1048576]="WordWinRT",e[e.PowerpointWinRT=2097152]="PowerpointWinRT",e[e.OutlookAndroid=4194304]="OutlookAndroid",e[e.OneNoteWinRT=8388608]="OneNoteWinRT",e[e.ExcelAndroid=8388609]="ExcelAndroid",e[e.VisioWebApp=8388610]="VisioWebApp",e[e.OneNoteIOS=8388611]="OneNoteIOS",e[e.WordAndroid=8388613]="WordAndroid",e[e.PowerpointAndroid=8388614]="PowerpointAndroid",e[e.Visio=8388615]="Visio",e[e.OneNoteAndroid=4194305]="OneNoteAndroid"}(e.AppName||(e.AppName={}))}(OSF||(OSF={})),function(e){var t=function(){function e(){this.m_mappings={},this.m_onchangeHandlers=[]}return e.prototype.associate=function(e,t){function n(e){"undefined"!=typeof console&&console.warn&&console.warn(e)}if(1==arguments.length&&"object"==typeof arguments[0]&&arguments[0]){var i=arguments[0];for(var r in i)this.associate(r,i[r])}else if(2==arguments.length){var o=arguments[0],a=arguments[1];if("string"!=typeof o)return void n("[InvalidArg] Function=associate");if("function"!=typeof a)return void n("[InvalidArg] Function=associate");var s=o.toUpperCase();this.m_mappings[s]&&n("[DuplicatedName] Function="+o),this.m_mappings[s]=a;for(var c=0;c<this.m_onchangeHandlers.length;c++)this.m_onchangeHandlers[c]()}else n("[InvalidArg] Function=associate")},e.prototype.onchange=function(e){e&&this.m_onchangeHandlers.push(e)},Object.defineProperty(e.prototype,"mappings",{get:function(){return this.m_mappings},enumerable:!0,configurable:!0}),e}();e.Association=t}(OSF||(OSF={})),function(e){var t=function(){function e(){}return e.prototype.invokeCallback=function(e,t,n,i,r){if(0==n){var o={status:Office.AsyncResultStatus.Succeeded,value:i,asyncContext:r};"function"==typeof t&&t(o)}else{var a={status:Office.AsyncResultStatus.Failed,error:{code:n},asyncContext:r};"function"==typeof t&&t(a)}},e}();e.AsyncMethodExecutor=t}(OSF||(OSF={})),function(e){var t=function(){function t(e){this._asyncMethodExecutor=e}return t.prototype.handleSafeArrayHostResponse=function(t,n,i,r,o,a,s){var c,u;if("number"==typeof(t=e.Utility.fromSafeArray(t))?(c=[],u=t):u=(c=t)[0],1==u)return null!=(l=c[1])&&(i[l[0]]=l[1]),!1;if(r){var l;if(0==u){if(c.length>2){l=[];for(var d=1;d<c.length;d++)l[d-1]=c[d]}else l=c[1];if(i.length>0&&null!=l){var f=l[l.length-1];i.length==f?l[l.length-1]=i:u=5001}}else l=c[1];var p=null;0==u&&(p=o.fromSafeArrayHost(l)),this._asyncMethodExecutor.invokeCallback(a,r,u,p,s)}return!0},t.prototype.handleWebHostResponse=function(e,t,n,i,r,o){var a=null;0==t&&(a=i.fromWebHost(e)),this._asyncMethodExecutor.invokeCallback(r,n,t,a,o)},t}();e.AsyncMethodExecutorHelper=t}(OSF||(OSF={})),function(e){!function(e){!function(e){!function(e){e.Context="Context",e.Value="Value",e.Status="Status",e.Error="Error"}(e.Properties||(e.Properties={})),function(e){e[e.Success=0]="Success",e[e.Failed=1]="Failed"}(e.ErrorCode||(e.ErrorCode={})),function(e){e.Name="Name",e.Message="Message",e.Code="Code"}(e.ErrorProperties||(e.ErrorProperties={}))}(e.AsyncResultEnum||(e.AsyncResultEnum={}));var t=function(e,t){this.value=e.Value,this.status=t?Office.AsyncResultStatus.Failed:Office.AsyncResultStatus.Succeeded,e.Context&&(this.asyncContext=e.Context),t&&(this.error=new n(t.Name,t.Message,t.Code))};e.AsyncResult=t;var n=function(e,t,n){this.name=e,this.message=t,this.code=n};e.Error=n}(e.DDA||(e.DDA={}))}(OSF||(OSF={})),function(e){!function(t){t.createWebClientHostControllerHelper=function(t,n){return new e.WebClientHostControllerHelper(t,n)},t.createAsyncMethodExecutorHelper=function(t){return new e.AsyncMethodExecutorHelper(t)}}(e.BootStrapExtension||(e.BootStrapExtension={}))}(OSF||(OSF={})),function(e){!function(e){e.DefaultLocale="en-us",e.OfficeJS="office.js",e.OfficeDebugJS="office.debug.js",e.OfficeStringsId="OFFICESTRINGS",e.OfficeJsId="OFFICEJS",e.HostFileId="HOST",e.OfficeStringJS="office_strings.js",e.OfficeStringDebugJS="office_strings.debug.js",e.FileVersion="0.0.0.0"}(e.ConstantNames||(e.ConstantNames={}))}(OSF||(OSF={})),function(e){var t=function(){function e(){}return e.NotificationConversationIdSuffix="_ntf",e}();e.Constants=t}(OSF||(OSF={})),CustomFunctionMappings||(CustomFunctionMappings={}),function(e){e.delayInitialization=function(){CustomFunctionMappings.__delay__=!0},e._association=e._association||new OSF.Association,e.associate=function(){e._association.associate.apply(e._association,arguments),delete CustomFunctionMappings.__delay__}}(CustomFunctions||(CustomFunctions={})),function(e){!function(t){!function(t){var n={},i=!1;t.getErrorArgs=function(t){i||(n[1e3]={name:e.ErrorNames.InvalidCoercion},n[1001]={name:e.ErrorNames.DataReadError},n[1002]={name:e.ErrorNames.InvalidCoercion},n[1003]={name:e.ErrorNames.DataReadError},n[1004]={name:e.ErrorNames.DataReadError},n[1005]={name:e.ErrorNames.DataReadError},n[1006]={name:e.ErrorNames.DataReadError},n[1008]={name:e.ErrorNames.DataReadError},n[1009]={name:e.ErrorNames.DataReadError},n[1010]={name:e.ErrorNames.DataReadError},n[1011]={name:e.ErrorNames.DataReadError},n[1012]={name:e.ErrorNames.DataReadError},n[1013]={name:e.ErrorNames.DataReadError},n[2e3]={name:e.ErrorNames.DataWriteError},n[2001]={name:e.ErrorNames.DataWriteError},n[2002]={name:e.ErrorNames.DataWriteError},n[2003]={name:e.ErrorNames.DataWriteError},n[2004]={name:e.ErrorNames.DataWriteError},n[2005]={name:e.ErrorNames.DataWriteError},n[2006]={name:e.ErrorNames.InvalidFormat},n[2007]={name:e.ErrorNames.InvalidDataObject},n[2008]={name:e.ErrorNames.InvalidDataObject},n[2009]={name:e.ErrorNames.DataWriteError},n[2010]={name:e.ErrorNames.DataWriteError},n[2011]={name:e.ErrorNames.DataWriteError},n[2012]={name:e.ErrorNames.DataWriteError},n[2013]={name:e.ErrorNames.DataWriteError},n[3e3]={name:e.ErrorNames.BindingCreationError},n[3002]={name:e.ErrorNames.InvalidBindingError},n[3003]={name:e.ErrorNames.BindingCreationError},n[3004]={name:e.ErrorNames.BindingCreationError},n[3005]={name:e.ErrorNames.InvalidBindingOperation},n[3006]={name:e.ErrorNames.BindingCreationError},n[3007]={name:e.ErrorNames.BindingCreationError},n[3008]={name:e.ErrorNames.BindingCreationError},n[3009]={name:e.ErrorNames.InvalidBinding},n[3010]={name:e.ErrorNames.InvalidBindingOperation},n[3011]={name:e.ErrorNames.InvalidBinding},n[4e3]={name:e.ErrorNames.ReadSettingsError},n[4001]={name:e.ErrorNames.SaveSettingsError},n[4002]={name:e.ErrorNames.SettingsStaleError},n[5e3]={name:e.ErrorNames.HostError},n[5001]={name:e.ErrorNames.InternalError},n[5002]={name:e.ErrorNames.PermissionDenied},n[5003]={name:e.ErrorNames.EventRegistrationError},n[5004]={name:e.ErrorNames.InvalidAPICall},n[5005]={name:e.ErrorNames.ShuttingDown},n[5007]={name:e.ErrorNames.UnsupportedEnumeration},n[5008]={name:e.ErrorNames.IndexOutOfRange},n[5009]={name:e.ErrorNames.APINotSupported},n[5011]={name:e.ErrorNames.APICallFailed},n[5012]={name:e.ErrorNames.InvalidOrTimedOutSession},n[5013]={name:e.ErrorNames.APICallFailed},n[5015]={name:e.ErrorNames.APICallFailed},n[5016]={name:e.ErrorNames.APICallFailed},n[5017]={name:e.ErrorNames.APICallFailed},n[5018]={name:e.ErrorNames.APICallFailed},n[5100]={name:e.ErrorNames.APICallFailed},n[5101]={name:e.ErrorNames.APICallFailed},n[5102]={name:e.ErrorNames.APICallFailed},n[5103]={name:e.ErrorNames.APICallFailed},n[5104]={name:e.ErrorNames.APICallFailed},n[6e3]={name:e.ErrorNames.InvalidNode},n[6100]={name:e.ErrorNames.CustomXmlError},n[6101]={name:e.ErrorNames.CustomXmlExceedQuotaName},n[6102]={name:e.ErrorNames.CustomXmlOutOfDateName},n[7e3]={name:e.ErrorNames.PermissionDenied},n[7001]={name:e.ErrorNames.CannotNavigateTo},n[7002]={name:e.ErrorNames.SpecifiedIdNotExist},n[7004]={name:e.ErrorNames.NavOutOfBounds},n[2014]={name:e.ErrorNames.DataWriteReminder},n[8e3]={name:e.ErrorNames.MissingParameter},n[8001]={name:e.ErrorNames.PermissionDenied},n[8010]={name:e.ErrorNames.InvalidValue},n[8011]={name:e.ErrorNames.InvalidValue},n[8012]={name:e.ErrorNames.InvalidValue},n[8020]={name:e.ErrorNames.OutOfRange},n[8021]={name:e.ErrorNames.OutOfRange},n[8022]={name:e.ErrorNames.OutOfRange},n[8023]={name:e.ErrorNames.FormattingReminder},n[1e4]={name:e.ErrorNames.UserNotSignedIn},n[11e3]={name:e.ErrorNames.MemoryLimitExceeded},n[11001]={name:e.ErrorNames.NetworkProblem},n[11002]={name:e.ErrorNames.InvalidValue},n[12007]={name:e.ErrorNames.DisplayDialogError},n[12e3]={name:e.ErrorNames.IndexOutOfRange},n[12001]={name:e.ErrorNames.IndexOutOfRange},n[12002]={name:e.ErrorNames.DisplayDialogError},n[12003]={name:e.ErrorNames.DialogNavigateError},n[12004]={name:e.ErrorNames.DisplayDialogError},n[12005]={name:e.ErrorNames.DisplayDialogError},n[12009]={name:e.ErrorNames.DisplayDialogError},n[12011]={name:e.ErrorNames.DisplayDialogError},n[13e3]={name:e.ErrorNames.APINotSupported},n[13001]={name:e.ErrorNames.UserNotSignedIn},n[13002]={name:e.ErrorNames.UserAborted},n[13003]={name:e.ErrorNames.UnsupportedUserIdentity},n[13004]={name:e.ErrorNames.InvalidResourceUrl},n[13005]={name:e.ErrorNames.InvalidGrant},n[13006]={name:e.ErrorNames.SSOClientError},n[13007]={name:e.ErrorNames.SSOServerError},n[13008]={name:e.ErrorNames.AddinIsAlreadyRequestingToken},n[13009]={name:e.ErrorNames.SSOUserConsentNotSupportedByCurrentAddinCategory},n[13010]={name:e.ErrorNames.SSOConnectionLostError},n[13012]={name:e.ErrorNames.APINotSupported},n[13013]={name:e.ErrorNames.APICallFailed},n[5014]={name:e.ErrorNames.OperationCancelledError},i=!0);var r=n[t];return r||(r=n[5001]),r.name||(r.name=n[5001].name),r.message||(r.message=r.name),r},t.addErrorMessage=function(e,t){n[e]=t}}(t.ErrorCodeManager||(t.ErrorCodeManager={}))}(e.DDA||(e.DDA={}))}(OSF||(OSF={})),function(e){e.ErrorNames={AddinIsAlreadyRequestingToken:"AddinIsAlreadyRequestingToken",APICallFailed:"APICallFailed",APINotSupported:"APINotSupported",BindingCreationError:"BindingCreationError",CallbackNotFunction:"CallbackNotFunction",CannotNavigateTo:"CannotNavigateTo",CustomXmlError:"CustomXmlError",CustomXmlExceedQuotaName:"CustomXmlExceedQuota",CustomXmlOutOfDateName:"CustomXmlOutOfDate",DataReadError:"DataReadError",DataWriteError:"DataWriteError",DataWriteReminder:"DataWriteReminder",DialogNavigateError:"DialogNavigateError",DisplayDialogError:"DisplayDialogError",EventRegistrationError:"EventRegistrationError",FormattingReminder:"FormattingReminder",HostError:"HostError",IndexOutOfRange:"IndexOutOfRange",InternalError:"InternalError",InvalidAPICall:"InvalidAPICall",InvalidBinding:"InvalidBinding",InvalidBindingError:"InvalidBindingError",InvalidBindingOperation:"InvalidBindingOperation",InvalidCoercion:"InvalidCoercion",InvalidDataObject:"InvalidDataObject",InvalidFormat:"InvalidFormat",InvalidGrant:"InvalidGrant",InvalidNode:"InvalidNode",InvalidOptionalArgument:"InvalidOptionalArgument",InvalidOrTimedOutSession:"InvalidOrTimedOutSession",InvalidResourceUrl:"InvalidResourceUrl",InvalidValue:"InvalidValue",MemoryLimitExceeded:"MemoryLimitExceeded",MissingParameter:"MissingParameter",MissingRequiredArguments:"MissingRequiredArguments",NavOutOfBounds:"NavOutOfBounds",NetworkProblem:"NetworkProblem",OperationCancelledError:"OperationCancelledError",OutOfRange:"OutOfRange",PermissionDenied:"PermissionDenied",ReadSettingsError:"ReadSettingsError",RedundantCallbackSpecification:"RedundantCallbackSpecification",SaveSettingsError:"SaveSettingsError",SettingsStaleError:"SettingsStaleError",ShuttingDown:"ShuttingDown",SSOClientError:"SSOClientError",SSOConnectionLostError:"SSOConnectionLostError",SSOServerError:"SSOServerError",SSOUserConsentNotSupportedByCurrentAddinCategory:"SSOUserConsentNotSupportedByCurrentAddinCategory",SpecifiedIdNotExist:"SpecifiedIdNotExist",TooManyArguments:"TooManyArguments",TooManyOptionalFunctions:"TooManyOptionalFunctions",TooManyOptionalObjects:"TooManyOptionalObjects",UnsupportedEnumeration:"UnsupportedEnumeration",UnsupportedUserIdentity:"UnsupportedUserIdentity",UserAborted:"UserAborted",UserNotSignedIn:"UserNotSignedIn"}}(OSF||(OSF={})),function(e){var t=function(){function e(e){if(this._eventInfos={},this._queuedEventsArgs={},this._eventHandlers={},this._queuedEventsArgs={},null!=e)for(var t=0;t<e.length;t++)if("string"==typeof e[t]){var n=e[t];this._eventHandlers[n]=[],this._queuedEventsArgs[n]=[]}else{n=e[t].type;this._eventInfos[n]=e[t],this._eventHandlers[n]=[],this._queuedEventsArgs[n]=[]}}return e.prototype.getSupportedEvents=function(){var e=[];for(var t in this._eventHandlers)e.push(t);return e},e.prototype.supportsEvent=function(e){for(var t in this._eventHandlers)if(e==t)return!0;return!1},e.prototype.hasEventHandler=function(e,t){var n=this._eventHandlers[e];if(n&&n.length>0)for(var i=0;i<n.length;i++)if(n[i]===t)return!0;return!1},e.prototype.addEventHandler=function(e,t){if("function"!=typeof t)return!1;var n=this._eventHandlers[e];return!(!n||this.hasEventHandler(e,t))&&(n.push(t),!0)},e.prototype.addEventHandlerAndFireQueuedEvent=function(e,t){var n=this._eventHandlers[e],i=!n||0==n.length,r=this.addEventHandler(e,t);return i&&r&&this.fireQueuedEvent(e),r},e.prototype.removeEventHandler=function(e,t){var n=this._eventHandlers[e];if(n&&n.length>0)for(var i=0;i<n.length;i++)if(n[i]===t)return n.splice(i,1),!0;return!1},e.prototype.clearEventHandlers=function(e){return void 0!==this._eventHandlers[e]&&this._eventHandlers[e].length>0&&(this._eventHandlers[e]=[],!0)},e.prototype.getEventHandlerCount=function(e){return null!=this._eventHandlers[e]?this._eventHandlers[e].length:-1},e.prototype.getEventInfo=function(e){return this._eventInfos[e]},e.prototype.fireEvent=function(e){if(null==e.type)return!1;var t=e.type;if(t&&this._eventHandlers[t]){for(var n=this._eventHandlers[t],i=0;i<n.length;i++)n[i](e);return!0}return!1},e.prototype.fireOrQueueEvent=function(e){if(null==e.type)return!1;var t=e.type;if(t&&this._eventHandlers[t]){var n=this._eventHandlers[t],i=this._queuedEventsArgs[t];return 0==n.length?i.push(e):this.fireEvent(e),!0}return!1},e.prototype.fireQueuedEvent=function(e){if(e&&this._eventHandlers[e]){var t=this._eventHandlers[e],n=this._queuedEventsArgs[e];if(t.length>0){for(var i=t[0];n.length>0;){i(n.shift())}return!0}}return!1},e.prototype.clearQueuedEvent=function(e){e&&this._eventHandlers[e]&&(this._queuedEventsArgs[e]&&(this._queuedEventsArgs[e]=[]))},e}();e.EventDispatch=t}(OSF||(OSF={})),function(e){!function(e){e.dispidEventMin=0,e.dispidInitializeEvent=0,e.dispidSettingsChangedEvent=1,e.dispidDocumentSelectionChangedEvent=2,e.dispidBindingSelectionChangedEvent=3,e.dispidBindingDataChangedEvent=4,e.dispidDocumentOpenEvent=5,e.dispidDocumentCloseEvent=6,e.dispidActiveViewChangedEvent=7,e.dispidDocumentThemeChangedEvent=8,e.dispidOfficeThemeChangedEvent=9,e.dispidDialogMessageReceivedEvent=10,e.dispidDialogNotificationShownInAddinEvent=11,e.dispidDialogParentMessageReceivedEvent=12,e.dispidObjectDeletedEvent=13,e.dispidObjectSelectionChangedEvent=14,e.dispidObjectDataChangedEvent=15,e.dispidContentControlAddedEvent=16,e.dispidLiveShareStateChangedEvent=17,e.dispidActivationStatusChangedEvent=32,e.dispidRichApiMessageEvent=33,e.dispidAppCommandInvokedEvent=39,e.dispidOnSdxSendMessageEvent=40,e.dispidDataNodeAddedEvent=60,e.dispidDataNodeReplacedEvent=61,e.dispidDataNodeDeletedEvent=62}(e.EventDispId||(e.EventDispId={}))}(OSF||(OSF={})),function(e){var t=function(){function t(){}return t.addEventHandler=function(n,i,r,o,a,s){var c=0;function u(t){0==t&&(o.hasEventHandler(n,i)||o.addEventHandler(n,i)||(t=5010));e._OfficeAppFactory.getAsyncMethodExecutor().invokeCallback(c,r,t,null,a)}var l=o.getEventInfo(n);if(l)try{if(s)return void u(0);c=l.id;var d=l.getTargetId();if(0==o.getEventHandlerCount(n))e._OfficeAppFactory.getAsyncMethodExecutor().registerEventAsync(c,l.type,d,(function(e){o.fireEvent(e)}),l,(function(t){u(e.Utility.getErrorCodeFromAsyncResult(t))}),a);else u(0)}catch(e){t.onException(c,e,r)}else u(5010)},t.removeEventHandler=function(n,i,r,o,a,s){var c=0;function u(t){e._OfficeAppFactory.getAsyncMethodExecutor().invokeCallback(c,r,t,null,a)}var l=o.getEventInfo(n);if(l)try{c=l.id;var d=l.getTargetId(),f=0,p=!0;null===i?(p=o.clearEventHandlers(n),f=0):f=(p=o.removeEventHandler(n,i))?0:5003;var h=o.getEventHandlerCount(n);if(p&&0==h)e._OfficeAppFactory.getAsyncMethodExecutor().unregisterEventAsync(c,l.type,d,(function(t){u(e.Utility.getErrorCodeFromAsyncResult(t))}),a);else u(f)}catch(e){t.onException(c,e,r)}else u(5010)},t.onException=function(t,n,i){if("number"!=typeof n)throw n;e._OfficeAppFactory.getAsyncMethodExecutor().invokeCallback(t,i,n,null)},t}();e.EventHelper=t}(OSF||(OSF={})),function(e){!function(e){e.ActiveViewChanged="activeViewChanged",e.AppCommandInvoked="appCommandInvoked",e.RichApiMessage="richApiMessage",e.DocumentSelectionChanged="documentSelectionChanged",e.BindingSelectionChanged="bindingSelectionChanged",e.BindingDataChanged="bindingDataChanged",e.OfficeThemeChanged="officeThemeChanged",e.DocumentThemeChanged="documentThemeChanged",e.LiveShareStateChanged="liveShareStateChanged",e.DataNodeDeleted="nodeDeleted",e.DataNodeInserted="nodeInserted",e.DataNodeReplaced="nodeReplaced",e.DialogMessageReceived="dialogMessageReceived",e.DialogParentMessageReceived="dialogParentMessageReceived",e.DialogParentEventReceived="dialogParentEventReceived",e.DialogEventReceived="dialogEventReceived",e.NodeDeleted="nodeDeleted",e.NodeInserted="nodeInserted",e.NodeReplaced="nodeReplaced",e.SettingsChanged="settingsChanged"}(e.EventType||(e.EventType={}))}(OSF||(OSF={})),function(e){!function(t){var n=function(){function t(){this.platformRemappings={web:Office.PlatformType.OfficeOnline,winrt:Office.PlatformType.Universal,win32:Office.PlatformType.PC,mac:Office.PlatformType.Mac,ios:Office.PlatformType.iOS,android:Office.PlatformType.Android},this.camelCaseMappings={powerpoint:Office.HostType.PowerPoint,onenote:Office.HostType.OneNote},this.hostInfo=e._OfficeAppFactory.getHostInfo()}return t.prototype.capitalizeFirstLetter=function(e){return e?e[0].toUpperCase()+e.slice(1).toLowerCase():e},t.getInstance=function(){return void 0===t.hostObj&&(t.hostObj=new t),t.hostObj},t.prototype.getPlatform=function(e){if(this.hostInfo&&this.hostInfo.hostPlatform){var t=this.hostInfo.hostPlatform.toLowerCase();if(this.platformRemappings[t])return this.platformRemappings[t]}return null},t.prototype.getHost=function(e){if(this.hostInfo&&this.hostInfo.hostType){var t=this.hostInfo.hostType.toLowerCase();if(this.camelCaseMappings[t])return this.camelCaseMappings[t];if(t=this.capitalizeFirstLetter(this.hostInfo.hostType),Office.HostType[t])return Office.HostType[t]}return null},t.prototype.getDefaultVersion=function(){return this.getHost()?"16.0.0000.0000":null},t.prototype.getDiagnostics=function(e){return{host:this.getHost(),version:e||this.getDefaultVersion(),platform:this.getPlatform()}},t}();t.Host=n}(e.HostName||(e.HostName={}))}(OSF||(OSF={})),function(e){!function(e){e[e.SharedApp=1]="SharedApp",e[e.CustomFunction=2]="CustomFunction",e[e.ProtectedDocDisable=4]="ProtectedDocDisable",e[e.ExperimentJsEnabled=8]="ExperimentJsEnabled",e[e.PublicAddin=16]="PublicAddin",e[e.BundleJsEnabled=32]="BundleJsEnabled",e[e.IsMos=64]="IsMos",e[e.IsMonarch=128]="IsMonarch",e[e.CustomFunctionsInitAfterCFRuntimeReady=256]="CustomFunctionsInitAfterCFRuntimeReady"}(e.HostInfoFlags||(e.HostInfoFlags={}))}(OSF||(OSF={})),function(e){!function(e){e.excel="excel",e.word="word"}(e.HostInfoHostType||(e.HostInfoHostType={}))}(OSF||(OSF={})),function(e){!function(e){e.web="web",e.winrt="winrt",e.win32="win32",e.mac="mac",e.ios="ios",e.android="android"}(e.HostInfoPlatform||(e.HostInfoPlatform={}))}(OSF||(OSF={})),function(e){var t=function(){function t(e,t,n,i){this._hostInfo=e,this._webAppState=t,this._context=n,this._hostFacade=i}return t.prototype.saveAndSetDialogInfo=function(e){},t.prototype.setAgaveHostCommunication=function(){},t.prototype.createClientHostController=function(){return null},t.prototype.createAsyncMethodExecutor=function(){return null},t.prototype.createClientSettingsManager=function(){return null},t.prototype.createSettings=function(t){var n=e.OUtil.getSessionStorage();if(n){var i=n.getItem(e._OfficeAppFactory.getCachedSessionSettingsKey());i?t=JSON.parse(i):(i=JSON.stringify(t),n.setItem(e._OfficeAppFactory.getCachedSessionSettingsKey(),i))}var r=e.OUtil.deserializeSettings(t),o=this.createClientSettingsManager();return new Office.Settings(r,o)},t.prototype.prepareApiSurface=function(t){var n=t.get_featureGates();n&&(Microsoft.Office.WebExtension.FeatureGates=n),e.BootStrapExtension.prepareApiSurface&&e.BootStrapExtension.prepareApiSurface(),e.BootStrapExtension.prepareHostSpecificSurface&&e.BootStrapExtension.prepareHostSpecificSurface(),OSFPerformance.createOMEnd=OSFPerformance.now()},t.prototype.getTabbableElements=function(){return null},t.prototype.setupNestedAppAuthDependencies=function(){},t.prototype.setCreateNaaBridge=function(e){this._createNaaBridge=e},t}();e.InitializationHelper=t}(OSF||(OSF={})),function(e){!function(e){e.Inserted="inserted",e.DocumentOpened="documentOpened"}(e.InitializationReason||(e.InitializationReason={}))}(OSF||(OSF={})),OSF||(OSF={}),function(e){var t;e.DisabledChangeGates=[],function(t){var n=0,i="resources.office.net",r="officeapps.live.com";t.getLibraryReleaseVehicle=function(){return n},t.setLibraryReleaseVehicle=function(e){n=e},t.isChangeGateEnabled=function(t){return!e.DisabledChangeGates||-1===e.DisabledChangeGates.indexOf(t)};var o=null,a=null;function s(){if(!a&&o&&o.officeCdnEndpoint)if(o.officeCdnEndpoint.origin&&o.officeCdnEndpoint.origin.length>0){var e="";e=o.officeCdnEndpoint.isOCDICompliant?"/"===o.officeCdnEndpoint.origin[o.officeCdnEndpoint.origin.length-1]?"beta/":"/beta/":"/"===o.officeCdnEndpoint.origin[o.officeCdnEndpoint.origin.length-1]?"appsforoffice/lib/beta/hosted/":"/appsforoffice/lib/beta/hosted/",a=o.officeCdnEndpoint.origin+e}else{var t=function(e){var t=new URL(e).hostname.toLowerCase();if(-1!==t.indexOf(i,t.length-i.length))return i;if(-1!==t.indexOf(r,t.length-r.length))return r;var n=t.split(".");return n.length<5||"mro1cdnstorage"!==n[1]?void 0:n.slice(2).join(".")}(window.location.href);t&&"public.onecdn.static.microsoft"!==t?"public.cdn.office.net"===t||t===i||t===r?(o.officeCdnEndpoint.isOCDICompliant=!1,o.officeCdnEndpoint.isSovereign=!1,a="https://appsforoffice.microsoft.com/lib/beta/hosted/"):(o.officeCdnEndpoint.isOCDICompliant=!1,o.officeCdnEndpoint.isSovereign=!0,a="https://appsforoffice."+t+"/appsforoffice/lib/beta/hosted/"):(o.officeCdnEndpoint.isOCDICompliant=!0,o.officeCdnEndpoint.isSovereign=!1,a="https://officeapis.public.onecdn.static.microsoft/beta/")}}function c(){if(!e.OUtil.isChangeGateEnabled("Microsoft.Office.SharedOnline.ChangeGate.OfficeVSO_10910853_OfficeJsNPMDownloadTrustedDomainList"))return"object"==typeof officeInitializationSettings&&officeInitializationSettings?officeInitializationSettings:{};if(!o){var t="officeInitializationSettings";if(window.hasOwnProperty(t)){var n=window.officeInitializationSettings;"object"==typeof n&&null!==n&&(o=n)}1!==e.OUtil.getLibraryReleaseVehicle()?o?o.officeCdnEndpoint={}:o={trustAllCloudEnvironments:!1,officeCdnEndpoint:{}}:(o&&o.officeCdnEndpoint&&"object"==typeof o.officeCdnEndpoint||(o={trustAllCloudEnvironments:!1,officeCdnEndpoint:{origin:"",isSovereign:!1,isOCDICompliant:!1,isSdx:!0,trustedTypesOptIn:!1}}),"string"==typeof o.officeCdnEndpoint.origin?o.officeCdnEndpoint.origin=o.officeCdnEndpoint.origin.trim():o.officeCdnEndpoint.origin="",o.officeCdnEndpoint.isSdx=!0,s())}return o}t.getCustomOfficeInitializationSettings=c,t.getAppsForOfficeBaseForNpm=function(){return a||c(),a||""}}(t=e.OUtil||(e.OUtil={})),function(n){var i,r=null,o=!1,a=["excel","word","powerpoint","onenote","outlook","visio","office-common","office.common","office","officebase"],s=[".js",".debug.js"],c="_osfDisableHostCheck",u=function(){try{return document.currentScript}catch(e){return null}}();function l(){return 1===e.OUtil.getLibraryReleaseVehicle()?e.OUtil.getCustomOfficeInitializationSettings().officeCdnEndpoint.trustedTypesOptIn:(f(),i.trustedTypesOptIn)}function d(e,t){var n=null!=e?e.src:null;if(!n)return null;var i=n.toLowerCase(),r="",o=!1,a=!0,s=void 0,u=!1;if(t){var l=i.indexOf(t);if(!(l>=0)||0!==l&&"/"!==n.charAt(l-1)&&"\\"!==n.charAt(l-1)||l+t.length!==n.length&&"?"!==n.charAt(l+t.length))a=!1;else{r=n.substring(0,l),o=i.indexOf(".debug.js",l)>0;var d=e.getAttribute("data-is-sdx");u="1"===d||"true"===d;var f=e.getAttribute("data-enable-trusted-types");s=null!=f?"1"===f||"true"===f:void 0}}return a?{basePath:r,name:t||"",isDebugJs:o,isSdx:u,disableHostCheck:window.hasOwnProperty(c)&&!0===window._osfDisableHostCheck,trustedTypesOptIn:s}:null}function f(){if(!i){if(e.OUtil.isChangeGateEnabled("Microsoft.Office.SharedOnline.ChangeGate.OfficeVSO_10910853_OfficeJsNPMDownloadTrustedDomainList")){var t=function(e){for(var t=0;t<a.length;t++)for(var n=0;n<s.length;n++){var i=d(e,a[t]+s[n]);if(i)return i}return null};if(1===e.OUtil.getLibraryReleaseVehicle())return void(i=d(u,null));if(i=t(u))return;for(var n=document.getElementsByTagName("script"),r=n.length,o=0;o<r;o++)if(i=t(n[o]))return}else{var l=function(e){var t=null!=e?e.src:null;if(!t)return null;for(var n=t.toLowerCase(),i=0;i<a.length;i++)for(var r=0;r<s.length;r++){var o=a[i]+s[r],u=n.indexOf(o);if(u>=0&&(0===u||"/"===t.charAt(u-1)||"\\"===t.charAt(u-1))&&(u+o.length===t.length||"?"===t.charAt(u+o.length))){var l=t.substring(0,u),d=n.indexOf(".debug.js",u)>0,f=e.getAttribute("data-is-sdx"),p="1"===f||"true"===f,h=e.getAttribute("data-enable-trusted-types"),g=null!=h?"1"===h||"true"===h:void 0;return{basePath:l,name:o,isDebugJs:d,isSdx:p,disableHostCheck:window.hasOwnProperty(c)&&!0===window._osfDisableHostCheck,trustedTypesOptIn:g}}}return null};if(i=l(u))return;var f=document.getElementsByTagName("script"),p=f.length;for(o=0;o<p;o++)if(i=l(f[o]))return}i={basePath:"",name:"",isDebugJs:!1,isSdx:!1,disableHostCheck:!1,trustedTypesOptIn:!1}}}n.getHostBundleJsBasePath=function(){return e.OUtil.isChangeGateEnabled("Microsoft.Office.SharedOnline.ChangeGate.OfficeVSO_10910853_OfficeJsNPMDownloadTrustedDomainList")&&1===e.OUtil.getLibraryReleaseVehicle()?e.OUtil.getAppsForOfficeBaseForNpm():(f(),i.basePath)},n.getHostBundleJsName=function(){return f(),i.name},n.getOfficeStringJsName=function(){return f(),i.isDebugJs?e.ConstantNames.OfficeStringDebugJS:e.ConstantNames.OfficeStringJS},n.isSdx=function(){return 1===e.OUtil.getLibraryReleaseVehicle()?e.OUtil.getCustomOfficeInitializationSettings().officeCdnEndpoint.isSdx:(f(),i.isSdx)},n.disableHostCheck=function(){return f(),i.disableHostCheck},n.getTrustedTypesOptIn=l,n.loadScriptWithBasename=function(e,n,r){f();var o=e+(i.isDebugJs?".debug.js":".js");o=o.toLowerCase();var a=i.basePath+o;t.loadScript(a,n,h())};var p=["https://alcdn.msauth.net/browser-1p/2.28.1/js/msal-browser-1p.min.js"];function h(){if(!o){o=!0;try{var t=l();if(!(null!=t?t:e.OUtil.isSecureDefaultsEnabled())||!window.trustedTypes||!window.trustedTypes.createPolicy)return null;var n=u.src,i=new URL(n).origin.toLowerCase();if(!i)return null;r=window.trustedTypes.createPolicy("officejs",{createScriptURL:function(e){var t=e.toLowerCase(),n=new URL(t).origin;if(i&&i===n)return e;for(var r=0,o=p;r<o.length;r++){if(t===o[r])return e}throw new Error("Untrusted script URL")}})}catch(e){}}return r}n.getTrustedTypesPolicy=h}(e.LoadScriptHelper||(e.LoadScriptHelper={}))}(OSF||(OSF={})),function(e){var t;!function(e){e[e.MaxLiveShareStateDataSizeInBytes=1024]="MaxLiveShareStateDataSizeInBytes"}(t=e.LiveShareStateParams||(e.LiveShareStateParams={}));var n=function(){function e(e){var t=this;e=e||null,this._liveShareState=e,this._eventDispatch=new OSF.EventDispatch([{id:OSF.EventDispId.dispidLiveShareStateChangedEvent,type:OSF.EventType.LiveShareStateChanged,getTargetId:function(){return""},fromSafeArrayHost:function(e){return{type:OSF.EventType.LiveShareStateChanged,liveShareState:t}},fromWebHost:function(e){return{type:OSF.EventType.LiveShareStateChanged,liveShareState:t}}}])}return e.prototype.get=function(){return this._liveShareState},e.prototype.set=function(e){if((new TextEncoder).encode(e).length>t.MaxLiveShareStateDataSizeInBytes)throw new Error("State data size is limited to "+t.MaxLiveShareStateDataSizeInBytes+" bytes.");this._liveShareState=e},e.prototype.addHandlerAsync=function(e,t,n){OSF.EventHelper.addEventHandler(e,t,n,this._eventDispatch)},e.prototype.removeHandlerAsync=function(e,t,n){OSF.EventHelper.removeEventHandler(e,t,n,this._eventDispatch)},e}();e.LiveShareState=n}(Office||(Office={})),function(e){var t={"ar-sa":!0,"bg-bg":!0,"bn-in":!0,"ca-es":!0,"cs-cz":!0,"da-dk":!0,"de-de":!0,"el-gr":!0,"en-us":!0,"es-es":!0,"et-ee":!0,"eu-es":!0,"fa-ir":!0,"fi-fi":!0,"fr-fr":!0,"gl-es":!0,"he-il":!0,"hi-in":!0,"hr-hr":!0,"hu-hu":!0,"id-id":!0,"it-it":!0,"ja-jp":!0,"kk-kz":!0,"ko-kr":!0,"lo-la":!0,"lt-lt":!0,"lv-lv":!0,"ms-my":!0,"nb-no":!0,"nl-nl":!0,"nn-no":!0,"pl-pl":!0,"pt-br":!0,"pt-pt":!0,"ro-ro":!0,"ru-ru":!0,"sk-sk":!0,"sl-si":!0,"sr-cyrl-cs":!0,"sr-cyrl-rs":!0,"sr-latn-cs":!0,"sr-latn-rs":!0,"sv-se":!0,"th-th":!0,"tr-tr":!0,"uk-ua":!0,"ur-pk":!0,"vi-vn":!0,"zh-cn":!0,"zh-tw":!0},n={ar:"ar-sa",bg:"bg-bg",bn:"bn-in",ca:"ca-es",cs:"cs-cz",da:"da-dk",de:"de-de",el:"el-gr",en:"en-us",es:"es-es",et:"et-ee",eu:"eu-es",fa:"fa-ir",fi:"fi-fi",fr:"fr-fr",gl:"gl-es",he:"he-il",hi:"hi-in",hr:"hr-hr",hu:"hu-hu",id:"id-id",it:"it-it",ja:"ja-jp",kk:"kk-kz",ko:"ko-kr",lo:"lo-la",lt:"lt-lt",lv:"lv-lv",ms:"ms-my",nb:"nb-no",nl:"nl-nl",nn:"nn-no",pl:"pl-pl",pt:"pt-br",ro:"ro-ro",ru:"ru-ru",sk:"sk-sk",sl:"sl-si",sr:"sr-cyrl-cs",sv:"sv-se",th:"th-th",tr:"tr-tr",uk:"uk-ua",ur:"ur-pk",vi:"vi-vn",zh:"zh-cn"};e.getSupportedLocale=function(e,i){if(void 0===i&&(i="en-us"),!e)return i;var r;if((e=e.toLowerCase())in t)r=e;else{var o=e.split("-",1);o&&o.length>0&&(r=n[o[0]])}return r||(r=i),r}}(OSF||(OSF={})),function(e){e.OfficeOM||(e.OfficeOM={})}(Strings||(Strings={})),function(e){!function(t){var n;t.ensureOfficeStringsJs=function(){return n||(n=1==e.OUtil.getLibraryReleaseVehicle()?new Office.Promise((function(e,t){e()})):new Office.Promise((function(n,i){if(e.OUtil.isChangeGateEnabled("Microsoft.Office.SharedOnline.ChangeGate.OfficeVSO_9441111_DefaultLocaleOfficeStrings")){var r=e.LoadScriptHelper.getHostBundleJsBasePath()+e.ConstantNames.DefaultLocale+"/"+e.LoadScriptHelper.getOfficeStringJsName();e.OUtil.loadScript(r,(function(t){t?n():i(new Error("Cannot load "+e.ConstantNames.OfficeStringJS))}),e.LoadScriptHelper.getTrustedTypesPolicy())}else{if(!e._OfficeAppFactory.getHostInfo().hostLocale)return void i(new Error("No host locale"));r=e.LoadScriptHelper.getHostBundleJsBasePath()+e._OfficeAppFactory.getHostInfo().hostLocale+"/"+e.LoadScriptHelper.getOfficeStringJsName();e.OUtil.loadScript(r,(function(r){if(r)n();else{var o=e.LoadScriptHelper.getHostBundleJsBasePath()+e.ConstantNames.DefaultLocale+"/"+e.LoadScriptHelper.getOfficeStringJsName();t.loadScript(o,(function(t){t?n():i(new Error("Cannot load "+e.ConstantNames.OfficeStringJS))}),e.LoadScriptHelper.getTrustedTypesPolicy())}}),e.LoadScriptHelper.getTrustedTypesPolicy())}}))),n}}(e.OUtil||(e.OUtil={}))}(OSF||(OSF={})),function(e){!function(t){!function(t){var n;OSF.definePropertyOnNamespace(t,"url",(function(){return OSF._OfficeAppFactory.getOfficeAppContext().get_docUrl()})),OSF.definePropertyOnNamespace(t,"mode",(function(){return 0==OSF._OfficeAppFactory.getOfficeAppContext().get_clientMode()?e.DocumentMode.ReadOnly:e.DocumentMode.ReadWrite})),OSF.definePropertyOnNamespace(t,"settings",(function(){if(!n){var e=OSF._OfficeAppFactory.getOfficeAppContext().get_settingsFunc()();n=OSF._OfficeAppFactory.getInitializationHelper().createSettings(e)}return n})),t.goToByIdAsync=function(t,n,i,r){var o={};o[e.GoToType.Binding]=0,o[e.GoToType.NamedItem]=1,o[e.GoToType.Slide]=2,o[e.GoToType.Index]=3;var a={};a[e.SelectionMode.Default]=0,a[e.SelectionMode.Selected]=1,a[e.SelectionMode.None]=2;var s=o[n],c=0,u=r;"function"==typeof i?u=i:void 0!==i&&(c=a[i]);var l={toSafeArrayHost:function(){return[t,s,c]},fromSafeArrayHost:function(e){return e},toWebHost:function(){return{DdaGoToByIdMethod:{Id:t,GoToType:s,SelectionMode:c}}},fromWebHost:function(e){return e}};OSF._OfficeAppFactory.getAsyncMethodExecutor().executeAsync(82,l,u)}}(t.document||(t.document={}))}(e.context||(e.context={}))}(Office||(Office={})),function(e){!function(e){!function(e){e.sendMessage=function(e){if(OSF._OfficeAppFactory.getHostInfo().hostPlatform==OSF.HostInfoPlatform.web){var t=OSF._OfficeAppFactory.getWebAppState();t.clientEndPoint.invoke("ContextActivationManager_notifyHost",null,[t.id,OSF.AgaveHostAction.SendMessage,e])}else{var n=JSON.stringify(e);OSF._OfficeAppFactory.getClientHostController().execute(208,[n],null)}},e.registerOnMessageEventHandler=function(t){if(OSF._OfficeAppFactory.getHostInfo().hostPlatform==OSF.HostInfoPlatform.web)e.onMessage=t;else{OSF._OfficeAppFactory.getClientHostController().registerEvent(OSF.EventDispId.dispidOnSdxSendMessageEvent,"","",(function(e,n){var i=n.toArray();t(JSON.parse(i[0]))}),null)}}}(e.messaging||(e.messaging={}))}(e.context||(e.context={}))}(Office||(Office={})),function(e){!function(t){var n,i;OSF.definePropertyOnNamespace(t,"contentLanguage",(function(){return OSF._OfficeAppFactory.getOfficeAppContext().get_dataLocale()})),OSF.definePropertyOnNamespace(t,"displayLanguage",(function(){return OSF._OfficeAppFactory.getOfficeAppContext().get_appUILocale()})),OSF.definePropertyOnNamespace(t,"partitionKey",(function(){return OSF._OfficeAppFactory.getOfficeAppContext().get_partitionKey()})),OSF.definePropertyOnNamespace(t,"isDialog",(function(){return OSF._OfficeAppFactory.getHostInfo().isDialog})),OSF.definePropertyOnNamespace(t,"touchEnabled",(function(){return OSF._OfficeAppFactory.getOfficeAppContext().get_touchEnabled()})),OSF.definePropertyOnNamespace(t,"commerceAllowed",(function(){return OSF._OfficeAppFactory.getOfficeAppContext().get_commerceAllowed()})),OSF.definePropertyOnNamespace(t,"host",(function(){return OSF.HostName.Host.getInstance().getHost()})),OSF.definePropertyOnNamespace(t,"platform",(function(){return OSF.HostName.Host.getInstance().getPlatform()})),OSF.definePropertyOnNamespace(t,"diagnostics",(function(){return OSF.HostName.Host.getInstance().getDiagnostics(OSF._OfficeAppFactory.getOfficeAppContext().get_hostFullVersion())})),OSF.definePropertyOnNamespace(t,"requirements",(function(){if(!n){var e=OSF._OfficeAppFactory.getOfficeAppContext();e&&(n=e.get_isDialog()?OSF.Requirement.RequirementsMatrixFactory.getDefaultDialogRequirementMatrix(e):OSF.Requirement.RequirementsMatrixFactory.getDefaultRequirementMatrix(e))}return n})),OSF.definePropertyOnNamespace(t,"officeTheme",(function(){var e=OSF._OfficeAppFactory.getOfficeAppContext().get_officeThemeFunc();return e?"function"==typeof e?e():e:void 0})),OSF.definePropertyOnNamespace(t,"webAuth",(function(){if(OSF.DDA.WebAuth)return OSF.DDA.WebAuth})),OSF.definePropertyOnNamespace(t,"auth",(function(){if(OSF.DDA.Auth)return OSF.DDA.Auth})),OSF.definePropertyOnNamespace(t,"license",(function(){return OSF._OfficeAppFactory.getOfficeAppContext().get_eToken()})),OSF.definePropertyOnNamespace(t,"hostSettings",(function(){if(!i){var t=OSF._OfficeAppFactory.getOfficeAppContext().get_hostSettingsFunc();if(void 0!==t){var n=t(),r=OSF.OUtil.deserializeSettings(n);i=new e.Settings(r,void 0)}}return i}))}(e.context||(e.context={}))}(Office||(Office={})),function(e){!function(e){!function(e){e.refreshRibbon=function(e){OSF.getClientEndPoint().invoke("ContextActivationManager_notifyHost",null,[OSF._OfficeAppFactory.getWebAppState().id,OSF.AgaveHostAction.RefreshRibbonGallery,e])}}(e.ribbonGallery||(e.ribbonGallery={}))}(e.context||(e.context={}))}(Office||(Office={})),function(e){!function(e){!function(e){e.taskPaneAction||(e.taskPaneAction={})}(e.ui||(e.ui={}))}(e.context||(e.context={}))}(Office||(Office={}));var __assign=this&&this.__assign||function(){return(__assign=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};!function(e){function t(){e._officeOnReadyState.officeOnReadyPromise||(e._officeOnReadyState.officeOnReadyPromise=new e.Promise((function(t,n){e._officeOnReadyState.officeOnReadyPromiseResolve=t,e._officeOnReadyState.officeOnReadyPromiseReject=n})))}function n(){if(!e._officeOnReadyState.onReadyAllowsRejection||!e._officeOnReadyState.officeOnReadyRejected){for(OSFPerformance.officeOnReady||(OSFPerformance.officeOnReady=OSFPerformance.now()),e._officeOnReadyState.officeOnReadyPromiseResolve(e._officeOnReadyState.officeOnReadyHostAndPlatformInfo),e._officeOnReadyState.officeOnReadyPromiseReject=null;e._officeOnReadyState.officeOnReadyExternalCallbacks.length>0;)e._officeOnReadyState.officeOnReadyExternalCallbacks.shift()(e._officeOnReadyState.officeOnReadyHostAndPlatformInfo);e._officeOnReadyState.isOfficeOnReadyCalled||OSF.OUtil.waitForFunction((function(){return"function"==typeof e.initialize}),(function(t){t&&e.initialize(OSF._OfficeAppFactory.getOfficeAppContext().get_reason())}),400,50)}}function i(n,i){t();var r=e._officeOnReadyState.officeOnReadyFired&&(!i||0===Object.keys(e._officeOnReadyState.heldLocks).length);return i&&e._officeOnReadyState.onReadyAllowsRejection&&e._officeOnReadyState.officeOnReadyRejected||n&&(r?n(e._officeOnReadyState.officeOnReadyHostAndPlatformInfo):i?e._officeOnReadyState.officeOnReadyExternalCallbacks.push(n):e._officeOnReadyState.officeOnReadyInternalCallbacks.push(n)),e._officeOnReadyState.officeOnReadyPromise}e.OnReadyLockId=e.OnReadyLockId||{CustomFunctionsRuntimeReady:"CustomFunctionsRuntimeReady"},e._officeOnReadyState=e._officeOnReadyState||{isOfficeOnReadyCalled:!1,officeOnReadyPromise:null,officeOnReadyPromiseResolve:null,officeOnReadyPromiseReject:null,officeOnReadyInternalCallbacks:[],officeOnReadyExternalCallbacks:[],officeOnReadyHostAndPlatformInfo:null,officeOnReadyFired:!1,officeOnReadyRejected:!1,officeOnReadyRejectionError:null,heldLocks:{},onReadyAllowsRejection:!1},e.initialize=e.initialize,e.onReadyInternal=function(e){return i(e,!1)},e.onReady=function(t){return e._officeOnReadyState.isOfficeOnReadyCalled=!0,i(t,!0)},e.onReadyOptions=e.onReadyOptions||{setRejectionEnabled:function(){e._officeOnReadyState.onReadyAllowsRejection=!0}},e.rejectOfficeOnReady=function(n){e._officeOnReadyState.officeOnReadyRejected||(e._officeOnReadyState.officeOnReadyRejectionError=n,e._officeOnReadyState.officeOnReadyRejected=!0,e._officeOnReadyState.onReadyAllowsRejection&&(t(),e._officeOnReadyState.officeOnReadyPromiseReject&&(e._officeOnReadyState.officeOnReadyPromiseReject(n),e._officeOnReadyState.officeOnReadyExternalCallbacks=[])))},e.fireOnReady=function(i){t(),e._officeOnReadyState.officeOnReadyHostAndPlatformInfo=__assign({},i),e._officeOnReadyState.officeOnReadyFired=!0,function(){for(;e._officeOnReadyState.officeOnReadyInternalCallbacks.length>0;)e._officeOnReadyState.officeOnReadyInternalCallbacks.shift()(e._officeOnReadyState.officeOnReadyHostAndPlatformInfo)}(),Object.keys(e._officeOnReadyState.heldLocks).length>0||n()},e.acquireOnReadyLock=function(t){return Object.keys(e.OnReadyLockId).some((function(n){return e.OnReadyLockId[n]===t}))?(e._officeOnReadyState.heldLocks[t]=!0,t):null},e.releaseOnReadyLock=function(t){e._officeOnReadyState.heldLocks[t]&&(delete e._officeOnReadyState.heldLocks[t],0===Object.keys(e._officeOnReadyState.heldLocks).length&&e._officeOnReadyState.officeOnReadyPromise&&e._officeOnReadyState.officeOnReadyFired&&n())}}(Office||(Office={})),function(e){var t=function(){function t(t,n,i,r,o,a,s,c,u,l,d,f,p,h,g,m,v,y,_,b,O,S,E,I,C,A,P,w,x,F,R,N,T,M){this._id=t,this._appName=n,this._appVersion=i,this._appUILocale=r,this._dataLocale=o,this._docUrl=a,this._clientMode=s,this._settingsFunc=c,this._reason=u,this._osfControlType=l,this._eToken=d,this._correlationId=f,this._appInstanceId=p,this._touchEnabled=h,this._commerceAllowed=g,this._appMinorVersion=m,this._requirementMatrix=v,this._hostCustomMessage=y,this._hostFullVersion=_,this._isDialog=e.OUtil.isDialog(),this._clientWindowHeight=b,this._clientWindowWidth=O,this._addinName=S,this._appDomains=E,this._dialogRequirementMatrix=I,this._featureGates=C,this._officeThemeFunc=A,this._initialDisplayMode=P,this._isFromWacAutomation=w,this._wopiHostOriginForSingleSignOn=x,this._hostSettingsFunc=F,this._isWeb=R,this._nestedAppAuthBridgeType=N,this._partitionKey=T,this._topFrameOrigin=M}return t.prototype.get_id=function(){return this._id},t.prototype.get_appName=function(){return this._appName},t.prototype.get_appVersion=function(){return this._appVersion},t.prototype.get_appUILocale=function(){return this._appUILocale},t.prototype.get_dataLocale=function(){return this._dataLocale},t.prototype.get_docUrl=function(){return this._docUrl},t.prototype.get_clientMode=function(){return this._isWeb?this._clientMode:0==this._clientMode?Office.DocumentMode.ReadWrite:Office.DocumentMode.ReadOnly},t.prototype.get_settingsFunc=function(){return this._settingsFunc},t.prototype.get_reason=function(){return this._reason},t.prototype.get_osfControlType=function(){return this._osfControlType},t.prototype.get_eToken=function(){return this._eToken},t.prototype.get_correlationId=function(){return this._correlationId},t.prototype.get_appInstanceId=function(){return this._appInstanceId},t.prototype.get_touchEnabled=function(){return this._touchEnabled},t.prototype.get_commerceAllowed=function(){return this._commerceAllowed},t.prototype.get_appMinorVersion=function(){return this._appMinorVersion},t.prototype.get_requirementMatrix=function(){return this._requirementMatrix},t.prototype.get_dialogRequirementMatrix=function(){return this._dialogRequirementMatrix},t.prototype.get_hostCustomMessage=function(){return this._hostCustomMessage},t.prototype.get_hostFullVersion=function(){return this._hostFullVersion},t.prototype.get_isDialog=function(){return this._isDialog},t.prototype.get_clientWindowHeight=function(){return this._clientWindowHeight},t.prototype.get_clientWindowWidth=function(){return this._clientWindowWidth},t.prototype.get_addinName=function(){return this._addinName},t.prototype.get_appDomains=function(){return this._appDomains},t.prototype.get_taskpaneUrl=function(){return this._taskpaneUrl},t.prototype.set_taskpaneUrl=function(e){this._taskpaneUrl=e},t.prototype.get_featureGates=function(){return this._featureGates},t.prototype.get_officeThemeFunc=function(){return this._officeThemeFunc},t.prototype.get_initialDisplayMode=function(){return this._initialDisplayMode?this._initialDisplayMode:0},t.prototype.get_isFromWacAutomation=function(){return this._isFromWacAutomation},t.prototype.get_wopiHostOriginForSingleSignOn=function(){return this._wopiHostOriginForSingleSignOn},t.prototype.get_hostSettingsFunc=function(){return this._hostSettingsFunc},t.prototype.get_isWeb=function(){return this._isWeb},t.prototype.get_nestedAppAuthBridgeType=function(){return this._nestedAppAuthBridgeType},t.prototype.get_partitionKey=function(){return this._partitionKey},t.prototype.get_topFrameOrigin=function(){return this._topFrameOrigin},t}();e.OfficeAppContext=t}(OSF||(OSF={})),function(e){!function(t){t.retrieveHostInfo=function(){var t={isO15:!0,isRichClient:!0,hostType:"",hostPlatform:"",hostSpecificFileVersion:"",hostLocale:"",osfControlAppCorrelationId:"",isDialog:!1,disableLogging:!1,flags:0},n="_host_Info",i=null;try{if(window.external=window.external||{},"undefined"!=typeof agaveHost&&agaveHost.GetHostInfo&&(window.external.GetHostInfo=function(){return agaveHost.GetHostInfo()}),window.external.GetHostInfo){var r=window.external.GetHostInfo();if("isDialog"==r)t.isO15=!0,t.isDialog=!0;else{var o=r.split("_host_Info=");i=o.length>1?o[1]:r}}}catch(t){e.Utility.log(JSON.stringify(t))}if(!i)try{var a=window.name;if(a){var s=JSON.parse(a);i=s?s.hostInfo:null}}catch(t){e.Utility.log(JSON.stringify(t))}i||(i=e.Utility.getQueryStringValue(n));var c=e.OUtil.getSessionStorage();if(!i&&c.getItem("hostInfoValue")&&(i=c.getItem("hostInfoValue")),i){i=decodeURIComponent(i),t.isO15=!1;var u=i.split("$");void 0===u[2]&&(u=i.split("|")),t.hostType=void 0===u[0]?"":u[0].toLowerCase(),t.hostPlatform=void 0===u[1]?"":u[1].toLowerCase(),t.hostSpecificFileVersion=void 0===u[2]?"":u[2].toLowerCase(),t.hostLocale=void 0===u[3]?"":u[3].toLowerCase(),t.osfControlAppCorrelationId=void 0===u[4]?"":u[4],"telemetry"==t.osfControlAppCorrelationId&&(t.osfControlAppCorrelationId=""),t.isDialog=void 0!==u[5]&&"isDialog"==u[5],t.disableLogging=void 0!==u[6]&&"disableLogging"==u[6],t.flags="string"==typeof u[7]&&u[7].length>0?parseInt(u[7]):0,c.setItem("hostInfoValue",i)}else t.isO15=!0,t.hostLocale=e.Utility.getQueryStringValue("locale");return t}}(e._OfficeAppFactory||(e._OfficeAppFactory={}))}(OSF||(OSF={})),function(e){var t;!function(t){var n,i,r,o,a,s,c,u,l;"undefined"!=typeof window&&(window.location&&(n=window.location.hash,i=window.location.search),r=window.name);var d={0:"Unknown",1:"Hidden",2:"Taskpane",3:"Dialog"};function f(t,n){e.AppCommandManager.initialize();var i=t.get_appName(),r=null;0!=(o.flags&e.HostInfoFlags.SharedApp)&&(r={visibilityMode:d[t.get_initialDisplayMode()]});var s={host:e.HostName.Host.getInstance().getHost(i),platform:e.HostName.Host.getInstance().getPlatform(i),addin:r};0==(o.flags&e.HostInfoFlags.CustomFunctionsInitAfterCFRuntimeReady)||0==(o.flags&e.HostInfoFlags.CustomFunction)||t.get_isDialog()||"function"==typeof Office.acquireOnReadyLock&&Office.OnReadyLockId,o.hostPlatform!=e.HostInfoPlatform.web||Microsoft.Office.WebExtension.Interactive||(Microsoft.Office.WebExtension.Interactive=function(t){null!=a.clientEndPoint&&a.clientEndPoint.invoke("ContextActivationManager_notifyHost",null,[a.id,e.AgaveHostAction.Interactive,{isInteractive:t,timestamp:Date.now()}])}),Office.fireOnReady(s),o.hostPlatform==e.HostInfoPlatform.web&&null!=a.clientEndPoint&&a.clientEndPoint.invoke("ContextActivationManager_notifyHost",null,[a.id,e.AgaveHostAction.OfficeJsReady,Date.now()]),n(t)}t.bootstrap=function(n,i){if(a={id:null,webAppUrl:null,conversationID:null,clientEndPoint:null,wnd:window.parent,focused:!1,serviceEndPoint:null},o=t.retrieveHostInfo(),function(){!0;try{if(o.disableLogging)return void!1;window.external=window.external||{},void 0===window.external.GetLoggingAllowed||window.external.GetLoggingAllowed()}catch(e){}}(),function(){if(o.hostPlatform===e.HostInfoPlatform.web)s=new e.WebInitializationHelper(o,a,null,null);else if(o.hostPlatform===e.HostInfoPlatform.win32)s=new e.RichClientInitializationHelper(o,a,null,null);else if(o.hostPlatform===e.HostInfoPlatform.ios||o.hostPlatform===e.HostInfoPlatform.mac){if(!(window.webkit&&window.webkit.messageHandlers&&window.webkit.messageHandlers.Agave))throw e.Utility.createNotImplementedException();s=new e.WebkitInitializationHelper(o,a,null,null)}else o.hostPlatform===e.HostInfoPlatform.android||o.hostPlatform===e.HostInfoPlatform.winrt?s=new e.WebViewInitializationHelper(o,a,null,null):console.warn("Office.js is loaded inside in unknown host or platform "+o.hostPlatform)}(),s){o.hostPlatform===e.HostInfoPlatform.web&&s.saveAndSetDialogInfo(e.Utility.getQueryStringValue("_host_Info")),s.setAgaveHostCommunication(),s.setupNestedAppAuthDependencies(),OSFPerformance.getAppContextStart=OSFPerformance.now();s.getAppContext(window,(function(t){OSFPerformance.getAppContextEnd=OSFPerformance.now(),e.AppTelemetry.initialize(t),u=t,l=s.createClientHostController(),c=s.createAsyncMethodExecutor(),s.prepareApiSurface(t),e.BootStrapExtension.onGetAppContext?e.BootStrapExtension.onGetAppContext(t,a.wnd).then((function(){f(t,n)})):f(t,n)}),(function(e){i(e)}))}else i(new Error("Office.js cannot be initialized."))},t.getWindowName=function(){return r},t.getWindowLocationHash=function(){return n},t.getWindowLocationSearch=function(){return i},t.getAsyncMethodExecutor=function(){return c},t.getOfficeAppContext=function(){return u},t.getHostInfo=function(){return o},t.getCachedSessionSettingsKey=function(){return(null!=a.conversationID?a.conversationID:u.get_appInstanceId())+"CachedSessionSettings"},t.getWebAppState=function(){return a},t.getId=function(){return a.id},t.getInitializationHelper=function(){return s},t.getClientHostController=function(){return l}}(t=e._OfficeAppFactory||(e._OfficeAppFactory={})),e.getClientEndPoint=function(){return t.getWebAppState().clientEndPoint}}(OSF||(OSF={})),function(e){!function(e){e.Succeeded="succeeded",e.Failed="failed"}(e.AsyncResultStatus||(e.AsyncResultStatus={})),function(e){e.ReadOnly="readOnly",e.ReadWrite="readWrite"}(e.DocumentMode||(e.DocumentMode={})),function(e){e.Word="Word",e.Excel="Excel",e.PowerPoint="PowerPoint",e.Outlook="Outlook",e.OneNote="OneNote",e.Project="Project",e.Access="Access",e.Visio="Visio"}(e.HostType||(e.HostType={})),function(e){e.Inserted="inserted",e.DocumentOpened="documentOpened"}(e.InitializationReason||(e.InitializationReason={})),function(e){e.PC="PC",e.OfficeOnline="OfficeOnline",e.Mac="Mac",e.iOS="iOS",e.Android="Android",e.Universal="Universal"}(e.PlatformType||(e.PlatformType={})),function(e){e.Binding="binding",e.NamedItem="namedItem",e.Slide="slide",e.Index="index"}(e.GoToType||(e.GoToType={})),function(e){e.Default="default",e.Selected="selected",e.None="none"}(e.SelectionMode||(e.SelectionMode={})),function(e){e.Unformatted="unformatted",e.Formatted="formatted"}(e.ValueFormat||(e.ValueFormat={})),function(e){e.Text="text",e.Compressed="compressed",e.Pdf="pdf"}(e.FileType||(e.FileType={})),e.CoercionType={Html:"html",Matrix:"matrix",Ooxml:"ooxml",OoxmlPackage:"ooxmlPackage",PdfFile:"pdfFile",SlideRange:"slideRange",Table:"table",Text:"text"},function(e){e.Table="table",e.Text="text",e.Matrix="matrix"}(e.BindingType||(e.BindingType={})),function(e){e.OnlyVisible="onlyVisible",e.All="all"}(e.FilterType||(e.FilterType={})),function(e){e[e.All=0]="All",e[e.Data=1]="Data",e[e.Headers=2]="Headers"}(e.Table||(e.Table={})),function(e){e.Read="read",e.Edit="edit"}(e.ActiveView||(e.ActiveView={})),function(e){e[e.None=0]="None",e[e.EditOccurred=1]="EditOccurred",e[e.NewUndoEntry=2]="NewUndoEntry",e[e.UndoPerformed=4]="UndoPerformed",e[e.RedoPerformed=8]="RedoPerformed",e[e.UndoStackCleared=16]="UndoStackCleared"}(e.UndoStackChangedReason||(e.UndoStackChangedReason={}))}(Office||(Office={}));var OfficeExt,OSFPerfUtil,OSFWebkit,SDX,OSF,OTel,Microsoft,Office,__extends=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),__awaiter=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))((function(r,o){function a(e){try{c(i.next(e))}catch(e){o(e)}}function s(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){e.done?r(e.value):new n((function(t){t(e.value)})).then(a,s)}c((i=i.apply(e,t||[])).next())}))},__generator=this&&this.__generator||function(e,t){var n,i,r,o,a={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function s(o){return function(s){return function(o){if(n)throw new TypeError("Generator is already executing.");for(;a;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return a.label++,{value:o[1],done:!1};case 5:a.label++,i=o[1],o=[0];continue;case 7:o=a.ops.pop(),a.trys.pop();continue;default:if(!(r=a.trys,(r=r.length>0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){a.label=o[1];break}if(6===o[0]&&a.label<r[1]){a.label=r[1],r=o;break}if(r&&a.label<r[2]){a.label=r[2],a.ops.push(o);break}r[2]&&a.ops.pop(),a.trys.pop();continue}o=t.call(e,a)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,s])}}};!function(e){e.appSpecificCheckOrigin=function(e,t,n,i){return!1}}(OfficeExt||(OfficeExt={})),function(e){var t=function(){function e(e,t,n){this._method=e,this._invokeType=t,this._blockingOthers=n}return e.prototype.getMethod=function(){return this._method},e.prototype.getInvokeType=function(){return this._invokeType},e.prototype.getBlockingFlag=function(){return this._blockingOthers},e}();e.XdmMethodObject=t;var n=function(){function e(e,t){this._registerMethodObject=e,this._unregisterMethodObject=t}return e.prototype.getRegisterMethodObject=function(){return this._registerMethodObject},e.prototype.getUnregisterMethodObject=function(){return this._unregisterMethodObject},e}();e.XdmEventMethodObject=n;var i=function(){function i(e){this._methodObjectList={},this._eventHandlerProxyList={},this._conversations={},this._policyManager=null,this._appDomains={},this._onHandleRequestError=null,this._methodObjectList={},this._eventHandlerProxyList={},this._Id=e,this._conversations={},this._policyManager=null,this._appDomains={},this._onHandleRequestError=null}return i.prototype.registerMethod=function(n,i,r,o){if(0!==r&&1!==r)throw e.Utility.createArgumentException("invokeType");var a=new t(i,r,o);this._methodObjectList[n]=a},i.prototype.unregisterMethod=function(e){delete this._methodObjectList[e]},i.prototype.registerEvent=function(e,i,r){var o=new n(new t(i,4,!1),new t(r,5,!1));this._methodObjectList[e]=o},i.prototype.registerEventEx=function(e,i,r,o,a){var s=new n(new t(i,r,!1),new t(o,a,!1));this._methodObjectList[e]=s},i.prototype.unregisterEvent=function(e){this.unregisterMethod(e)},i.prototype.registerConversation=function(t,n,i){if(e.Utility.xdmDebugLog("registerConversation: cId="+t+" Url="+n),i){if(!Array.isArray(i))throw e.Utility.createArgumentException("appDomains");this._appDomains[t]=i}this._conversations[t]={url:n}},i.prototype.unregisterConversation=function(e){delete this._conversations[e]},i.prototype.setPolicyManager=function(t){if(!t.checkPermission)throw e.Utility.createArgumentException("policyManager");this._policyManager=t},i.prototype.getPolicyManager=function(){return this._policyManager},i.prototype.dispose=function(){this._methodObjectList=null,this._eventHandlerProxyList=null,this._Id=null,this._conversations=null,this._policyManager=null,this._appDomains=null,this._onHandleRequestError=null},i}();e.XdmServiceEndPoint=i;var r,o=function(){function e(e,t,n){this._callbackList={},this._eventHandlerList={},this._hostTrustCheckStatus=0,this._checkStatusLogged=!1,this._fHostTrusted=!1,this._conversationId=e,this._targetWindow=t,this._targetUrl=n,this._callingIndex=0,this._callbackList={},this._eventHandlerList={},this._checkReceiverOriginAndRun=null}return Object.defineProperty(e.prototype,"targetUrl",{get:function(){return this._targetUrl},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hostTrustCheckStatus",{get:function(){return this._hostTrustCheckStatus},set:function(e){this._hostTrustCheckStatus=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fHostTrusted",{get:function(){return this._fHostTrusted},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"checkStatusLogged",{get:function(){return this._checkStatusLogged},set:function(e){this._checkStatusLogged=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"checkReceiverOriginAndRun",{get:function(){return this._checkReceiverOriginAndRun},set:function(e){this._checkReceiverOriginAndRun=e},enumerable:!0,configurable:!0}),e.prototype.invoke=function(e,t,n){var i=this,o=function(){var o=i._callingIndex++,a=new Date,c={callback:t,createdOn:a.getTime()};n&&"object"==typeof n&&"number"==typeof n.__timeout__&&(c.timeout=n.__timeout__,delete n.__timeout__),i._callbackList[o]=c;try{if(3!==i._hostTrustCheckStatus&&"ContextActivationManager_getAppContextAsync"!==e)throw"Access Denied";var l=new s(e,0,i._conversationId,o,n),d=u.envelope(l);i._targetWindow.postMessage(d,i._targetUrl),r._startMethodTimeoutTimer()}catch(e){try{null!==t&&t(-1,e)}finally{delete i._callbackList[o]}}};this._checkReceiverOriginAndRun?this._checkReceiverOriginAndRun(o):(this._hostTrustCheckStatus=3,o())},e.prototype.registerForEvent=function(e,t,n,i){var o=this._callingIndex++,a=new Date;this._callbackList[o]={callback:n,createdOn:a.getTime()};try{var c=new s(e,1,this._conversationId,o,i),l=u.envelope(c);this._targetWindow.postMessage(l,this._targetUrl),r._startMethodTimeoutTimer(),this._eventHandlerList[e]=t}catch(e){try{null!==n&&n(-1,e)}finally{delete this._callbackList[o]}}},e.prototype.unregisterForEvent=function(e,t,n){var i=this._callingIndex++,o=new Date;this._callbackList[i]={callback:t,createdOn:o.getTime()};try{var a=new s(e,2,this._conversationId,i,n),c=u.envelope(a);this._targetWindow.postMessage(c,this._targetUrl),r._startMethodTimeoutTimer()}catch(e){try{null!==t&&t(-1,e)}finally{delete this._callbackList[i]}}finally{delete this._eventHandlerList[e]}},e}();e.XdmClientEndPoint=o,function(t){var n,r=[],a=null,s=null,l=!1,p={},h={},g=!1;function m(t){for(var n in p)if(p[n]._conversations[t])return p[n];throw e.Utility.createArgumentException("conversationId")}function v(t){var n=h[t];return n||e.Utility.xdmDebugLog("Unknown conversation Id."),n}function y(t,n){var i=t._methodObjectList[n._actionName];if(!i)throw e.Utility.xdmDebugLog("The specified method is not registered on service endpoint:"+n._actionName),e.Utility.createArgumentException("messageObject");return 0===n._actionType?i:1===n._actionType?i.getRegisterMethodObject():i.getUnregisterMethodObject()}function _(e){r.push(e)}function b(){null!==s?l||(r.length>0?O(r.shift()):(clearInterval(s),s=null)):e.Utility.xdmDebugLog("channel is not ready.")}function O(e){l=e.getInvokeBlockingFlag(),e.invoke(),a=(new Date).getTime()}function S(){l=!1}function E(t){if(window.addEventListener)window.addEventListener("message",t,!1);else{if(!(navigator.userAgent.indexOf("MSIE")>-1&&window.attachEvent))throw e.Utility.xdmDebugLog("Browser doesn't support the required API."),e.Utility.createArgumentException("Browser");window.attachEvent("onmessage",t)}}function I(t,n){return!!(t&&n&&"null"!==t&&"null"!==n&&t.length&&n.length)&&x(e.OUtil.parseUrl(t,!0),e.OUtil.parseUrl(n,!0))}function C(t,n){var i=!1;if(!(n&&"null"!==n&&n.length&&t&&t instanceof Array&&t.length))return i;for(var r=0;r<t.length&&!i;r++)if(-1!==t[r].indexOf("://")){var o=e.OUtil.parseUrl(n,!0);i=x(e.OUtil.parseUrl(t[r],!0),o)}return i}function A(t){if(!t||"null"===t)return!1;var n=new Array("^outlook\\.office\\.com$","^outlook-sdf\\.office\\.com$","^outlook\\.live\\.com$","^outlook-sdf\\.live\\.com$","^consumer\\.live-int\\.com$","^outlook-tdf\\.live\\.com$","^sdfpilot\\.live\\.com$","^outlook\\.office365\\.us$","^outlook\\.office365\\.com$","^exchangelabs\\.live-int\\.com$","^.*\\.dod\\.online\\.office365\\.us$","^.*\\.gov\\.online\\.office365\\.us$","^.*\\.officeapps\\.live\\.com$","^.*\\.officeapps-df\\.live\\.com$","^"+document.domain.replace(new RegExp("\\.","g"),"\\.")+"$");return!0===e.OUtil.getCustomOfficeInitializationSettings().trustAllCloudEnvironments&&n.push("^partner\\.outlook\\.cn$","^.*\\.partner\\.officewebapps\\.cn$"),new RegExp(n.join("|")).test(t)}function P(t){return __awaiter(this,void 0,void 0,(function(){var i;return __generator(this,(function(r){switch(r.label){case 0:return n||(n=new e.SovereignHelper),[4,(i=n).isConfigAvailable()];case 1:return r.sent()?[4,i.isSovereignHostTrusted(t)]:[2,!1];case 2:return[2,r.sent()]}}))}))}function w(t,n){if(!t||!n||"null"===t||"null"===n)return!1;var i=e.OUtil.parseUrl(t,!0),r=e.OUtil.parseUrl(n,!0);if(null==i||null==r)return!1;var o=i.protocol===r.protocol,a=i.port===r.port,s=r.hostname,c=i.hostname,u=s===c,l=!1;return!u&&s.length>c.length+1&&(l=s.slice(-(c.length+1))==="."+c),a&&o&&(u||l)}function x(e,t){return e.hostname==t.hostname&&e.protocol==t.protocol&&e.port==t.port}function F(t){return __awaiter(this,void 0,void 0,(function(){var n,i,r,o,p,h,g,E,A,P,x,F,R,N,M,j,k,H,D,U,L,B;return __generator(this,(function(W){switch(W.label){case 0:if(""==t.data)return[3,10];i=t.data;try{n=u.unenvelope(i)}catch(e){return[2]}if(e.Utility.xdmDebugLog(i),0!==n._messageType)return[3,9];r=null==t.origin||"null"===t.origin?n._origin:t.origin,W.label=1;case 1:if(W.trys.push([1,2,,8]),o=m(n._conversationId),e.Utility.xdmDebugLog("_receiveAsync: request, origin="+r+" sourceURL:"+o._conversations[n._conversationId]),p=o._conversations[n._conversationId],e.Utility.xdmDebugLog("_receiveAsync: request, origin="+r+" sourceURL:"+p.url),!C(h=[p.url].concat(o._appDomains[n._conversationId]),t.origin)&&!OfficeExt.appSpecificCheckOrigin(h,t,n._origin,C)&&!w(p.url,t.origin))throw"Failed origin check";if((g=o.getPolicyManager())&&!g.checkPermission(n._conversationId,n._actionName,n._data))throw"Access Denied";return E=y(o,n),A=new d(t.source,r,n._actionName,n._conversationId,n._correlationId,S),P=new f(E,n._data,A,o._eventHandlerProxyList,n._conversationId,n._actionName),x=!0,null==s&&((null==a||(new Date).getTime()-a>10)&&!l?(O(P),x=!1):s=setInterval(b,10)),x&&_(P),[3,8];case 2:F=W.sent(),o&&o._onHandleRequestError&&o._onHandleRequestError(n,F),R=-2,"Access Denied"==F&&(R=-5),N=new c(n._actionName,n._conversationId,n._correlationId,R,0,F),M=u.envelope(N),j=!1;try{j=!(!t.source||!t.source.postMessage)}catch(e){}return k=!1,window.location.href&&t.origin&&"null"!==t.origin&&w(window.location.href,t.origin)?(k=!0,[3,7]):[3,3];case 3:if(!t.origin||"null"===t.origin)return[3,7];H=e.OUtil.parseUrl(t.origin,!0).hostname,W.label=4;case 4:return W.trys.push([4,6,,7]),[4,T(H,null)];case 5:return k=W.sent(),[3,7];case 6:return D=W.sent(),e.Utility.xdmDebugLog("isHostNameValidWacDomainAsync failed with exception: "+D),k=!1,[3,7];case 7:return j&&k&&t.source.postMessage(M,r),[3,8];case 8:return[3,10];case 9:if(1!==n._messageType)return[2];if(!(U=v(n._conversationId)))return[2];if(e.Utility.xdmDebugLog("_receiveAsync: response, origin="+t.origin+" targetURL:"+U._targetUrl),!I(U._targetUrl,t.origin))throw"Failed orgin check";if(3==U._hostTrustCheckStatus&&(U._fHostTrusted=!0),0===n._responseType){if(L=U._callbackList[n._correlationId])try{L.callback&&L.callback(n._errorCode,n._data)}finally{delete U._callbackList[n._correlationId]}}else null!=(B=U._eventHandlerList[n._actionName])&&B(n._data);W.label=10;case 10:return[2]}}))}))}function R(t){if(""!=t.data){var n,i=t.data;try{n=u.unenvelope(i)}catch(e){return}if(e.Utility.xdmDebugLog(i),0===n._messageType){var r=null==t.origin||"null"===t.origin?n._origin:t.origin;try{var o=m(n._conversationId);e.Utility.xdmDebugLog("_receive: request, origin="+r+" sourceURL:"+o._conversations[n._conversationId]);var p=o._conversations[n._conversationId];e.Utility.xdmDebugLog("_receive: request, origin="+r+" sourceURL:"+p.url);var h=[p.url].concat(o._appDomains[n._conversationId]);if(!C(h,t.origin))if(!OfficeExt.appSpecificCheckOrigin(h,t,n._origin,C))if(!w(p.url,t.origin))throw"Failed origin check";var g=o.getPolicyManager();if(g&&!g.checkPermission(n._conversationId,n._actionName,n._data))throw"Access Denied";var E=y(o,n),P=new d(t.source,r,n._actionName,n._conversationId,n._correlationId,S),x=new f(E,n._data,P,o._eventHandlerProxyList,n._conversationId,n._actionName),F=!0;null==s&&((null==a||(new Date).getTime()-a>10)&&!l?(O(x),F=!1):s=setInterval(b,10)),F&&_(x)}catch(i){o&&o._onHandleRequestError&&o._onHandleRequestError(n,i);var R=-2;"Access Denied"==i&&(R=-5);var N=new c(n._actionName,n._conversationId,n._correlationId,R,0,i),T=u.envelope(N),M=!1;try{M=!(!t.source||!t.source.postMessage)}catch(e){}var j=!1;if(window.location.href&&t.origin&&"null"!==t.origin&&w(window.location.href,t.origin))j=!0;else if(t.origin&&"null"!==t.origin)j=A(e.OUtil.parseUrl(t.origin,!0).hostname);M&&j&&t.source.postMessage(T,r)}}else{if(1!==n._messageType)return;var k=v(n._conversationId);if(!k)return;if(e.Utility.xdmDebugLog("_receive: response, origin="+t.origin+" targetURL:"+k._targetUrl),!I(k._targetUrl,t.origin))throw"Failed orgin check";if(3==k._hostTrustCheckStatus&&(k._fHostTrusted=!0),0===n._responseType){var H=k._callbackList[n._correlationId];if(H)try{H.callback&&H.callback(n._errorCode,n._data)}finally{delete k._callbackList[n._correlationId]}}else{var D=k._eventHandlerList[n._actionName];null!=D&&D(n._data)}}}}function N(){g||(e.OUtil.isChangeGateEnabled("Microsoft.Office.SharedOnline.ChangeGate.OfficeVSO_10910853_OfficeJsNPMDownloadTrustedDomainList")?E(F):E(R),g=!0)}function T(t,n){return __awaiter(this,void 0,void 0,(function(){var i,r;return __generator(this,(function(o){switch(o.label){case 0:return i=!1,1===e.OUtil.getLibraryReleaseVehicle()?[3,3]:((r=e.SovereignHelper.isSovereignVersion())&&!0!==e.OUtil.getCustomOfficeInitializationSettings().trustAllCloudEnvironments||(i=A(t),n&&(i=i||n(t))),i||!r?[3,2]:[4,P(t)]);case 1:i=o.sent(),o.label=2;case 2:return[3,5];case 3:return[4,P(t)];case 4:(i=o.sent())||!e.LoadScriptHelper.isSdx()||e.SovereignHelper.isSovereignVersion()||(i=A(t)),o.label=5;case 5:return[2,i]}}))}))}t.connect=function(e,t,n){var i=h[e];return i||(N(),i=new o(e,t,n),h[e]=i),i},t.getClientEndPoint=function(e){return h[e]},t.createServiceEndPoint=function(e){N();var t=new i(e);return p[e]=t,t},t.getServiceEndPoint=function(e){return p[e]},t.deleteClientEndPoint=function(e){delete h[e]},t.deleteServiceEndPoint=function(e){delete p[e]},t.checkUrlWithAppDomains=function(e,t){return C(e,t)},t.isTargetSubdomainOfSourceLocation=function(e,t){return w(e,t)},t._setMethodTimeout=function(e){e<=0?65e3:e},t._startMethodTimeoutTimer=function(){},t.isHostNameValidWacDomain=function(e){return A(e)},t.isHostNameValidWacDomainAsync=T}(r=e.XdmCommunicationManager||(e.XdmCommunicationManager={}));var a=function(){function e(e,t,n,i,r){this._messageType=e,this._actionName=t,this._conversationId=n,this._correlationId=i,this._origin=window.location.origin,this._data=void 0===r?null:r}return e.prototype.getActionName=function(){return this._actionName},e.prototype.getConversationId=function(){return this._conversationId},e.prototype.getCorrelationId=function(){return this._correlationId},e.prototype.getOrigin=function(){return this._origin},e.prototype.getData=function(){return this._data},e.prototype.getMessageType=function(){return this._messageType},e}(),s=function(e){function t(t,n,i,r,o){var a=e.call(this,0,t,i,r,o)||this;return a._actionType=n,a}return __extends(t,e),t.prototype.getActionType=function(){return this._actionType},t}(a),c=function(e){function t(t,n,i,r,o,a){var s=e.call(this,1,t,n,i,a)||this;return s._errorCode=r,s._responseType=o,s}return __extends(t,e),t.prototype.getErrorCode=function(){return this._errorCode},t.prototype.getResponseType=function(){return this._responseType},t}(a),u=function(){function e(){}return e.envelope=function(e){return JSON.stringify(e)},e.unenvelope=function(e){return JSON.parse(e)},e}(),l=function(){function t(t,n,i,r,o,a){var s=this;this._invokeResultCode=0,this._requesterWindow=t,this._requesterUrl=n,this._actionName=i,this._conversationId=r,this._correlationId=o,this._invokeResultCode=0,this._responseType=a,this._send=function(t){try{var n=new c(s._actionName,s._conversationId,s._correlationId,s._invokeResultCode,s._responseType,t),i=u.envelope(n);s._requesterWindow.postMessage(i,s._requesterUrl),e.Utility.xdmDebugLog("_send: requestUrl="+s._requesterUrl+" _actionName:"+s._actionName)}catch(t){e.Utility.xdmDebugLog("ResponseSender._send error:"+t.message)}}}return t.prototype.getRequesterWindow=function(){return this._requesterWindow},t.prototype.getRequesterUrl=function(){return this._requesterUrl},t.prototype.getActionName=function(){return this._actionName},t.prototype.getConversationId=function(){return this._conversationId},t.prototype.getCorrelationId=function(){return this._correlationId},t.prototype.getSend=function(){return this._send},t.prototype.setResultCode=function(e){this._invokeResultCode=e},t}(),d=function(t){function n(n,i,r,o,a,s){var l=t.call(this,n,i,r,o,a,0)||this;return l._postCallbackHandler=s,l._send=function(t,n){null!=n&&(l._invokeResultCode=n);try{var i=new c(l._actionName,l._conversationId,l._correlationId,l._invokeResultCode,l._responseType,t),r=u.envelope(i);l._requesterWindow.postMessage(r,l._requesterUrl),l._postCallbackHandler()}catch(t){e.Utility.xdmDebugLog("InvokeCompleteCallback._send error:"+t.message)}},l}return __extends(n,t),n}(l),f=function(){function e(e,t,n,i,r,o){this._callerId="",this._methodObject=e,this._param=t,this._invokeCompleteCallback=n,this._eventHandlerProxyList=i,this._conversationId=r,this._eventName=o}return e.prototype.invoke=function(){try{var e;switch(this._methodObject.getInvokeType()){case 0:this._methodObject.getMethod()(this._param,this._invokeCompleteCallback.getSend());break;case 1:e=this._methodObject.getMethod()(this._param),this._invokeCompleteCallback.getSend()(e);break;case 4:var t=this._createEventHandlerProxyObject(this._invokeCompleteCallback);e=this._methodObject.getMethod()(t.getSend(),this._param),this._eventHandlerProxyList[this._conversationId+this._eventName]=t.getSend(),this._invokeCompleteCallback.getSend()(e);break;case 5:var n=this._eventHandlerProxyList[this._conversationId+this._eventName];e=this._methodObject.getMethod()(n,this._param),delete this._eventHandlerProxyList[this._conversationId+this._eventName],this._invokeCompleteCallback.getSend()(e);break;case 2:var i=this._createEventHandlerProxyObject(this._invokeCompleteCallback);this._methodObject.getMethod()(i.getSend(),this._invokeCompleteCallback.getSend(),this._param),this._eventHandlerProxyList[this._callerId+this._eventName]=i.getSend();break;case 3:var r=this._eventHandlerProxyList[this._callerId+this._eventName];this._methodObject.getMethod()(r,this._invokeCompleteCallback.getSend(),this._param),delete this._eventHandlerProxyList[this._callerId+this._eventName]}}catch(e){this._invokeCompleteCallback.setResultCode(-3),this._invokeCompleteCallback.getSend()(e)}},e.prototype.getInvokeBlockingFlag=function(){return this._methodObject.getBlockingFlag()},e.prototype._createEventHandlerProxyObject=function(e){return new l(e.getRequesterWindow(),e.getRequesterUrl(),e.getActionName(),e.getConversationId(),e.getCorrelationId(),1)},e}()}(OSF||(OSF={})),function(e){function t(e,t){return t+="_Resource",void 0!==oteljs?[oteljs.makeDoubleDataField(t+"_responseEnd",e.responseEnd),oteljs.makeDoubleDataField(t+"_responseStart",e.responseStart),oteljs.makeDoubleDataField(t+"_startTime",e.startTime),oteljs.makeDoubleDataField(t+"_transferSize",e.transferSize)]:[]}e.sendPerformanceTelemetry=function(){if(OSF.AppTelemetry.enableTelemetry&&"undefined"!=typeof performance&&performance.getEntriesByType){var e,n,i=OSF.LoadScriptHelper.getHostBundleJsName().toLowerCase();performance.getEntriesByType("resource").forEach((function(t){var r=t.name.toLowerCase();OSF.Utility.stringEndsWith(r,i)?e=t:(OSF.Utility.stringEndsWith(r,OSF.ConstantNames.OfficeDebugJS)||OSF.Utility.stringEndsWith(r,OSF.ConstantNames.OfficeJS))&&(n=t)})),OTel.OTelLogger.onTelemetryLoaded((function(){var i=[];e&&(i=i.concat(t(e,"HostJs"))),n&&(i=i.concat(t(n,"OfficeJs"))),i=i.concat([oteljs.makeDoubleDataField("officeExecuteStartDate",OSFPerformance.officeExecuteStartDate),oteljs.makeDoubleDataField("officeExecuteStart",OSFPerformance.officeExecuteStart),oteljs.makeDoubleDataField("officeExecuteEnd",OSFPerformance.officeExecuteEnd),oteljs.makeDoubleDataField("hostInitializationStart",OSFPerformance.hostInitializationStart),oteljs.makeDoubleDataField("hostInitializationEnd",OSFPerformance.hostInitializationEnd),oteljs.makeDoubleDataField("totalJSHeapSize",OSFPerformance.totalJSHeapSize),oteljs.makeDoubleDataField("usedJSHeapSize",OSFPerformance.usedJSHeapSize),oteljs.makeDoubleDataField("jsHeapSizeLimit",OSFPerformance.jsHeapSizeLimit),oteljs.makeDoubleDataField("getAppContextStart",OSFPerformance.getAppContextStart),oteljs.makeDoubleDataField("getAppContextEnd",OSFPerformance.getAppContextEnd),oteljs.makeDoubleDataField("getAppContextXdmStart",OSFPerformance.getAppContextXdmStart),oteljs.makeDoubleDataField("getAppContextXdmEnd",OSFPerformance.getAppContextXdmEnd),oteljs.makeDoubleDataField("createOMEnd",OSFPerformance.createOMEnd),oteljs.makeDoubleDataField("officeOnReady",OSFPerformance.officeOnReady),oteljs.makeBooleanDataField("isSharedRuntime",0!=(OSF._OfficeAppFactory.getHostInfo().flags&OSF.HostInfoFlags.SharedApp)),oteljs.makeBooleanDataField("isExperimentJsEnabled",0!=(OSF._OfficeAppFactory.getHostInfo().flags&OSF.HostInfoFlags.ExperimentJsEnabled))]),Microsoft.Office.WebExtension.sendTelemetryEvent({eventName:"Office.Extensibility.OfficeJs.JSPerformanceTelemetryV06",dataFields:i,eventFlags:{dataCategories:2,diagnosticLevel:110}})}))}}}(OSFPerfUtil||(OSFPerfUtil={})),function(e){!function(t){var n,i,r={};function o(e,t,n,i){if(e&&t){var o=window.document,a=r[e];if(a)a.loaded?t(!0):a.pendingCallbacks.push(t);else{var s=o.createElement("script");s.type="text/javascript",a={loaded:!1,pendingCallbacks:[t],timer:null},r[e]=a;var c=function(){null!=a.timer&&(clearTimeout(a.timer),delete a.timer),a.loaded=!0;for(var e=a.pendingCallbacks.length,t=0;t<e;t++){a.pendingCallbacks.shift()(!0)}},u=function(){delete r[e],null!=a.timer&&(clearTimeout(a.timer),delete a.timer);for(var t=a.pendingCallbacks.length,n=0;n<t;n++){a.pendingCallbacks.shift()(!1)}};s.readyState?s.onreadystatechange=function(){"loaded"!=s.readyState&&"complete"!=s.readyState||(s.onreadystatechange=null,c())}:s.onload=c,s.onerror=u,i=i||3e4,a.timer=setTimeout(u,i),s.setAttribute("crossOrigin","anonymous"),s.src=n?n.createScriptURL(e):e,o.getElementsByTagName("head")[0].appendChild(s)}}}!function(e){var t=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];e.generateNewGuid=function(){for(var e="",n=(new Date).getTime(),i=0;i<32&&n>0;i++)8!=i&&12!=i&&16!=i&&20!=i||(e+="-"),e+=t[n%16],n=Math.floor(n/16);for(;i<32;i++)8!=i&&12!=i&&16!=i&&20!=i||(e+="-"),e+=t[Math.floor(16*Math.random())];return e}}(t.Guid||(t.Guid={})),t.loadScriptPromise=function(e,t,n){return new Promise((function(i,r){o(e,(function(e){i(e)}),t,n)}))},t.loadScript=o,t.getSessionStorage=function(){if(!n){try{var t=window.sessionStorage}catch(e){t=null}n=new e.SafeStorage(t)}return n},t.getLocalStorage=function(){if(!i){try{var t=window.localStorage}catch(e){t=null}i=new e.SafeStorage(t)}return i},t.waitForFunction=function(e,t,n,i){var r,o=n,a=function(){o--,e()?t(!0):o>0?(r=window.setTimeout(a,i),o--):(window.clearTimeout(r),t(!1))};a()},t.isSecureDefaultsEnabled=function(){return"undefined"!=typeof isOsfSecurityDefaultsEnabled&&!0===isOsfSecurityDefaultsEnabled}}(e.OUtil||(e.OUtil={}))}(OSF||(OSF={})),function(e){e.Flights=[];!function(t){var n="&_flights=",i="&_disabledChangeGates=",r="_flights=",o="_disabledChangeGates=";function a(e,t){return e.substr(0,t.length)===t}function s(e,t,n,i){return a(e,t+"//"+n+":"+i)||a(e,n+":"+i)}t.isArray=function(e){return"[object Array]"===Object.prototype.toString.apply(e)},t.isFunction=function(e){return"[object Function]"===Object.prototype.toString.apply(e)},t.isDate=function(e){return"[object Date]"===Object.prototype.toString.apply(e)},t.addEventListener=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1);else{if(!e.attachEvent)throw new Error("Cannot attach event");e.attachEvent("on"+t,n)}},t.removeEventListener=function(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1);else{if(!e.detachEvent)throw new Error("Cannot remove event");e.detachEvent("on"+t,n)}};var c="Date(";function u(e){var t=[];try{t=JSON.parse(e)}catch(e){}return Array.isArray(t)||(t=[]),t}function l(e,n,i){try{var r=JSON.parse(n),o=null!=r?r[i]:null,a=t.getSessionStorage();if(!e&&a&&null!=r){var s=r.baseFrameName+i;o?a.setItem(s,o):o=a.getItem(s)}return o}catch(e){return null}}function d(e,n,i,r,o){var a=o.split(e),s=a.length>1?a[a.length-1]:null;i&&null!=s&&(s.indexOf("&")>=0&&(s=s.split("&")[0]),s=decodeURIComponent(s));var c=t.getSessionStorage();if(!r&&c){var u=window.name.indexOf(n);if(u>-1){var l=window.name.indexOf(";",u);-1==l&&(l=window.name.length);var d=window.name.substring(u,l);s?c.setItem(d,s):s=c.getItem(d)}}return s}function f(e,t){for(var n=0;n<e.length;n++)if(e.charAt(n)===t){if(n+1>=e.length)return this.removeChar(e,n);if("/"===t){if("?"===e.charAt(n+1)||"#"===e.charAt(n+1))return this.removeChar(e,n)}else if("?"===t&&"#"===e.charAt(n+1))return this.removeChar(e,n)}return e}function p(e){if(e=f(e,"/"),e=f(e,"?"),"https://"==(e=f(e,"#")).substr(0,8))-1!=(t=e.indexOf(":443"))&&(t!=e.length-4&&"/"!=e.charAt(t+4)&&"?"!=e.charAt(t+4)&&"#"!=e.charAt(t+4)||(e=e.substring(0,t)+e.substring(t+4)));else if("http://"==e.substr(0,7)){var t;-1!=(t=e.indexOf(":80"))&&(t!=e.length-3&&"/"!=e.charAt(t+3)&&"?"!=e.charAt(t+3)&&"#"!=e.charAt(t+3)||(e=e.substring(0,t)+e.substring(t+3)))}return e}function h(e){var t,n,i=[],r=[],o=e.length;for(t=0;t<o;t++)(n=e[t]).tabIndex?n.tabIndex>0?r.push(n):0===n.tabIndex&&i.push(n):i.push(n);return r=r.sort((function(e,t){var n=e.tabIndex-t.tabIndex;return 0===n&&(n=r.indexOf(e)-r.indexOf(t)),n})),[].concat(r,i)}t.serializeSettings=function(t){var n={};for(var i in t){var r=t[i];try{r=JSON.stringify(r,(function(t,n){return e.OUtil.isDate(this[t])?c+this[t].getTime()+")":n})),n[i]=r}catch(e){}}return n},t.deserializeSettings=function(e){var t={};for(var n in e=e||{}){var i=e[n];try{i=JSON.parse(i,(function(e,t){var n;return"string"==typeof t&&t&&t.length>6&&t.slice(0,5)===c&&")"===t.slice(-1)&&(n=new Date(parseInt(t.slice(5,-1))))?n:t})),t[n]=i}catch(e){}}return t},t.convertIntToCssHexColor=function(e){return"#"+(Number(e)+16777216).toString(16).slice(-6)},t.parseAppContextFromWindowName=function(e,n){return t.parseInfoFromWindowName(e,n,"appContext")},t.parseHostInfoFromWindowName=function(t,n){return e.OUtil.parseInfoFromWindowName(t,n,"hostInfo")},t.parseXdmInfo=function(e){var n=t.parseXdmInfoWithGivenFragment(e,window.location.hash);return n||(n=t.parseXdmInfoFromWindowName(e,window.name)),n},t.parseXdmInfoFromWindowName=function(t,n){return e.OUtil.parseInfoFromWindowName(t,n,"xdmInfo")},t.parseXdmInfoWithGivenFragment=function(t,n){return e.OUtil.parseInfoWithGivenFragment("&_xdm_Info=","_xdm_",!1,t,n)},t.parseFlights=function(e){var t=function(e,t){return u(d(n,r,!0,e,t))}(e,window.location.hash);return 0==t.length&&(t=function(e,t){return u(l(e,t,"flights"))}(e,window.name)),t},t.parseDisabledChangeGates=function(e){var t=function(e,t){return u(d(i,o,!0,e,t))}(e,window.location.hash);return 0==t.length&&(t=function(e,t){return u(l(e,t,"disabledChangeGates"))}(e,window.name)),t},t.checkFlight=function(t){return e.Flights&&e.Flights.indexOf(t)>=0},t.parseInfoFromWindowName=l,t.parseInfoWithGivenFragment=d,t.getConversationId=function(){var e=window.location.search,t=null;if(e){var n=e.indexOf("&");(t=n>0?e.substring(1,n):e.substr(1))&&"="===t.charAt(t.length-1)&&(t=t.substring(0,t.length-1))&&(t=decodeURIComponent(t))}return t},t.getInfoItems=function(e){var t=e.split("$");return void 0===t[1]&&(t=e.split("|")),void 0===t[1]&&(t=e.split("%7C")),t},t.getXdmFieldValue=function(t,n){var i="",r=e.OUtil.parseXdmInfo(n);if(r){var o=e.OUtil.getInfoItems(r);if(null!=o&&o.length>=3)switch(t){case"ConversationUrl":i=o[2];break;case"AppId":i=o[1]}}return i},t.parseUrl=function(t,n){if(void 0===n&&(n=!1),void 0!==t&&t){var i="NotHttps",r="undefined"!=typeof window&&void 0!==window.navigator&&window.navigator.userAgent.indexOf("Trident")>0,o=("undefined"!=typeof window&&void 0!==window.navigator&&window.navigator.userAgent.indexOf("Edge"),{protocol:void 0,hostname:void 0,host:void 0,port:void 0,pathname:void 0,search:void 0,hash:void 0,isPortPartOfUrl:void 0});try{if(r){var a=document.createElement("a");if(a.href=t,!(a&&a.protocol&&a.host&&a.hostname&&a.href&&p(a.href).toLowerCase()===p(t).toLowerCase()))throw"InvalidUrl";if(e.OUtil.checkFlight(2)&&n&&"https:"!=a.protocol)throw new Error(i);var c=function(e,t){return e&&t?"https:"==t.protocol&&s(e,"https:",t.hostname,"443")?":443":"http:"==t.protocol&&s(e,"http:",t.hostname,"80")?":80":"":""}(t,a);o.protocol=a.protocol,o.hostname=a.hostname,o.port=""==c?a.port:"",o.host=""!=c?a.hostname:a.host,o.pathname=(r?"/":"")+a.pathname,o.search=a.search,o.hash=a.hash,o.isPortPartOfUrl=s(t,a.protocol,a.hostname,a.port)}else{var u=new URL(t);if(u&&u.protocol&&u.host&&u.hostname){if(e.OUtil.checkFlight(2)&&n&&"https:"!=u.protocol)throw new Error(i);o.protocol=u.protocol,o.hostname=u.hostname,o.port=u.port,o.host=u.host,o.pathname=u.pathname,o.search=u.search,o.hash=u.hash,o.isPortPartOfUrl=u.host.lastIndexOf(":"+u.port)==u.host.length-u.port.length-1}}}catch(e){if(e.message===i)throw e}return o}},t.focusToFirstTabbable=function(e,t){var n,i,r=!1,o=function(e){r=!0},a=function(e,t,n){return t<0||t>e||0===t&&n?-1:t!==e-1||n?n?t-1:t+1:-1};if(e=h(e),n=t?e.length-1:0,0===e.length)return null;for(;!r&&n>=0&&n<e.length;)i=e[n],window.focus(),i.addEventListener("focus",o),i.focus(),i.removeEventListener("focus",o),n=a(e.length,n,t),r||i!==document.activeElement||(r=!0);return r?i:null},t.focusToNextTabbable=function(e,t,n){var i,r,o,a=!1,s=function(e){a=!0},c=function(e,t,n){return t<0||t>e||0===t&&n?-1:t!==e-1||n?n?t-1:t+1:-1};if(i=function(e,t){for(var n=0;n<e.length;n++)if(e[n]===t)return n;return-1}(e=h(e),t),(r=c(e.length,i,n))<0)return null;for(;!a&&r>=0&&r<e.length;)(o=e[r]).addEventListener("focus",s),o.focus(),o.removeEventListener("focus",s),r=c(e.length,r,n),a||o!==document.activeElement||(a=!0);return a?o:null},t.defineMethodOnNamespace=function(e,t,n){e[t]=n},t.isDialog=function(){return e._OfficeAppFactory.getHostInfo().isDialog},t.isPopupWindow=function(){return e.OUtil.isDialog()&&e._OfficeAppFactory.getHostInfo().hostPlatform==e.HostInfoPlatform.web&&null!=window.opener},t.getHostPlatform=function(){return e._OfficeAppFactory.getHostInfo().hostPlatform}}(e.OUtil||(e.OUtil={}))}(OSF||(OSF={})),function(e){!function(e){e.Callback="callback",e.AsyncContext="asyncContext",e.Data="data",e.MessageToParent="messageToParent",e.MessageContent="messageContent",e.MessageOrigin="messageOrigin",e.TargetOrigin="targetOrigin",e.AppCommandInvocationCompletedData="appCommandInvocationCompletedData"}(e.ParameterNames||(e.ParameterNames={}))}(OSF||(OSF={})),function(e){!function(t){var n=function(){};t.RequirementVersion=n;var i=function(){function e(e){this._setMap=e}return e.prototype.isSetSupported=function(e,t){if(null==e)return!1;null==t&&(t=0);var n=this._setMap._sets;if(n.hasOwnProperty(e.toLowerCase())){var i=n[e.toLowerCase()];try{var r=this._getVersion(i+"");t+="";var o=this._getVersion(t);if(r.major>0&&r.major>o.major)return!0;if(r.major>0&&r.minor>=0&&r.major==o.major&&r.minor>=o.minor)return!0}catch(e){return!1}}return!1},e.prototype._getVersion=function(e){var t=(e+="").split("."),n=0,i=0;if(t.length<2&&isNaN(Number(e)))throw"version format incorrect";if(n=Number(t[0]),t.length>=2&&(i=Number(t[1])),isNaN(n)||isNaN(i))throw"version format incorrect";return{minor:i,major:n}},e}();t.RequirementMatrix=i;var r=function(){function e(e){this._sets=e}return e.prototype._addSetMap=function(e){for(var t in e)this._sets[t]=e[t]},e}();t.DefaultSetRequirement=r;var o=function(e){function t(){return e.call(this,{dialogapi:1.1})||this}return __extends(t,e),t}(r);t.DefaultRequiredDialogSetRequirement=o;var a=function(e){function t(){return e.call(this,{dialogorigin:1.1})||this}return __extends(t,e),t}(r);t.DefaultOptionalDialogSetRequirement=a;var s=function(){function t(){}return t.getDefaultRequirementMatrix=function(t){var n=void 0,o=t.get_requirementMatrix();if(null!=o&&o.length>0){var a=JSON.parse(t.get_requirementMatrix().toLowerCase());if(e._OfficeAppFactory.getHostInfo().hostPlatform==e.HostInfoPlatform.web)try{var s="dialogorigin";a.hasOwnProperty(s)||(a[s]=1.1)}catch(e){}n=new i(new r(a))}else n=new i(new r({}));return n},t.getDefaultDialogRequirementMatrix=function(t){var n=void 0,s=t.get_dialogRequirementMatrix();if(null!=s&&s.length>0){var c=JSON.parse(t.get_requirementMatrix().toLowerCase());n=new r(c)}else{n=new o;var u=t.get_requirementMatrix();if(null!=u&&u.length>0&&"undefined"!=typeof JSON){c=JSON.parse(u.toLowerCase());for(var l in n._sets)c.hasOwnProperty(l)&&(n._sets[l]=c[l]);var d=new a;for(var l in d._sets)c.hasOwnProperty(l)&&(n._sets[l]=c[l])}}if(e._OfficeAppFactory.getHostInfo().hostPlatform==e.HostInfoPlatform.web)try{var f="dialogorigin";!n._sets.hasOwnProperty(f)&&window.opener&&(n._sets[f]=1.1)}catch(e){}return new i(n)},t}();t.RequirementsMatrixFactory=s}(e.Requirement||(e.Requirement={}))}(OSF||(OSF={})),function(e){!function(t){!function(t){var n;t.executeRichApiRequestAsync=function(t,n){var i={toSafeArrayHost:function(){return[t]},fromSafeArrayHost:function(e){return{data:e}},toWebHost:function(){return{ArrayData:t}},fromWebHost:function(e){return{data:e.Data}}};e._OfficeAppFactory.getAsyncMethodExecutor().executeAsync(93,i,n)},Object.defineProperty(t,"richApiMessageManager",{get:function(){return n||(n=new e.RichApiMessageManager),n}})}(t.RichApi||(t.RichApi={}))}(e.DDA||(e.DDA={}))}(OSF||(OSF={})),function(e){var t=function(){function t(){this._registerHandlers=[],this._eventDispatch=new e.EventDispatch([{type:e.EventType.RichApiMessage,id:e.EventDispId.dispidRichApiMessageEvent,getTargetId:function(){return""},fromSafeArrayHost:function(e){var n=e;return t.transferEventArgument(n)},fromWebHost:function(e){var n=e.ArrayData;return t.transferEventArgument(n)}}])}return t.transferEventArgument=function(t){var n=[];if(t)for(var i=0;i<t.length;i++){var r=t[i];r.toArray&&(r=r.toArray()),n.push({messageCategory:r[0],messageType:r[1],targetId:r[2],message:r[3],id:r[4],isRemoteOverride:r[5]})}return{type:e.EventType.RichApiMessage,entries:n}},t.prototype.addHandlerAsync=function(t,n,i){e.EventHelper.addEventHandler(t,n,i,this._eventDispatch)},t.prototype.removeHandlerAsync=function(t,n,i){e.EventHelper.removeEventHandler(t,n,i,this._eventDispatch)},t.prototype.register=function(t){var n=this;return this._registerPromise||(this._registerPromise=new Office.Promise((function(t,i){n.addHandlerAsync(e.EventType.RichApiMessage,(function(e){n._registerHandlers.forEach((function(t){t&&t(e)}))}),(function(e){"failed"==e.status?i(e.error):t()}))}))),this._registerPromise.then((function(){n._registerHandlers.push(t)}))},t}();e.RichApiMessageManager=t}(OSF||(OSF={})),function(e){var t=function(){function t(){}return t.prototype.execute=function(e,t,n){"undefined"!=typeof OsfOMToken&&OsfOMToken?window.external.Execute(e,t,n,OsfOMToken):window.external.Execute(e,t,n)},t.prototype.registerEvent=function(e,t,n,i,r){"undefined"!=typeof OsfOMToken&&OsfOMToken?window.external.RegisterEvent(e,n,i,r,OsfOMToken):window.external.RegisterEvent(e,n,i,r)},t.prototype.unregisterEvent=function(e,t,n,i){"undefined"!=typeof OsfOMToken&&OsfOMToken?window.external.UnregisterEvent(e,n,i,OsfOMToken):window.external.UnregisterEvent(e,n,i)},t.prototype.closeSdxDialog=function(t){throw e.Utility.createNotImplementedException()},t.prototype.resizeSdxDialog=function(t,n){throw e.Utility.createNotImplementedException()},t}();e.RichClientHostController=t}(OSF||(OSF={})),function(e){var t=function(t){function n(){var e=null!==t&&t.apply(this,arguments)||this;return e.officeThemeTimeStamp=null,e.officeTheme=null,e}return __extends(n,t),n.prototype.getOsfControlContext=function(){if(!this._osfControlContext){var t="Warning: Office.js is loaded outside of Office client";try{if(!window.external)return console.error("There is no window.external."),e.Utility.trace(t),null;this._osfControlContext=window.external.GetContext()}catch(n){return console.error("Error when call window.external.GetContext() :"+JSON.stringify(n)),e.Utility.trace(t),null}}return this._osfControlContext},n.prototype.getAppContext=function(t,n,i){var r=this,o=this.getOsfControlContext();if(o){var a,s,c,u,l,d,f,p,h,g,m,v,y,_,b,O,S,E,I,C,A,P,w,x,F,R,N=0,T=!1;if((M=e.Utility.externalNativeFunctionExists)(typeof o.GetContextDataInJson))if("undefined"!=typeof OsfOMToken&&OsfOMToken)if((F=o.GetContextDataInJson(OsfOMToken))&&(R=JSON.parse(F)),R)a=R.appType,s=R.solutionRef,c=R.versionMajor,u=R.versionMinor,l=R.uiLocale,d=R.dataLocale,f=R.docUrl,p=R.clientMode,h=R.activationMode,m=R.controlType,v=R.eToken,y=R.correlationId,_=R.appInstanceId,b=R.touchEnabled,O=o.commerceAllowed,S=R.requirementMatrix,I=R.hostFullVersion,C=R.requirementMatrix,(j=R.featureGates)&&(A=JSON.parse(j)),N=R.initialDisplayMode,P=function(){var t={};if(R.settings)try{var n=JSON.parse(R.settings);if(n)for(var i=[n.names,n.values],r=i[0],o=i[1],a=0;a<r.length;a++)t[r[a]]=o[a]}catch(t){e.Utility.trace("Exception while parsing settings. Details: "+t)}return t},w=function(){var e=R.themeInfo;return r.getOfficeThemeFromInfoString(e)};else T=!0;else T=!0;else T=!0;if(T){a=o.GetAppType(),s=o.GetSolutionRef(),c=o.GetAppVersionMajor(),u=o.GetAppVersionMinor(),l=o.GetAppUILocale(),d=o.GetAppDataLocale(),f=o.GetDocUrl(),p=o.GetAppCapabilities(),h=o.GetActivationMode(),m=o.GetControlIntegrationLevel();try{v=o.GetSolutionToken()}catch(e){}var M;if((M=e.Utility.externalNativeFunctionExists)(typeof o.GetCorrelationId)&&(y=o.GetCorrelationId()),M(typeof o.GetInstanceId)&&(_=o.GetInstanceId()),M(typeof o.GetTouchEnabled)&&(b=o.GetTouchEnabled()),M(typeof o.GetCommerceAllowed)&&(O=o.GetCommerceAllowed()),M(typeof o.GetSupportedMatrix)&&(S=o.GetSupportedMatrix()),M(typeof o.GetHostCustomMessage)&&(E=o.GetHostCustomMessage()),M(typeof o.GetHostFullVersion)&&(I=o.GetHostFullVersion()),M(typeof o.GetDialogRequirementMatrix)&&(C=o.GetDialogRequirementMatrix()),M(typeof o.GetFeaturesForSolution))try{var j;(j=o.GetFeaturesForSolution())&&(A=JSON.parse(j))}catch(t){e.Utility.trace("Exception while creating the SDX FeatureGates object. Details: "+t)}M(typeof o.GetInitialDisplayMode)&&(N=o.GetInitialDisplayMode()),P=function(){return r.getSerializedSettings()},w=function(){return r.getOfficeTheme()},x=function(){return r.getSerializedHostSettings()}}g=2===h?Office.InitializationReason.DocumentOpened:Office.InitializationReason.Inserted,v=v?v.toString():"",n(new e.OfficeAppContext(s,a,c,l,d,f,p,P,g,m,v,y,_,b,O,u,S,E,I,void 0,void 0,void 0,void 0,C,A,w,N,void 0,void 0,x,!1,void 0,void 0,void 0))}else i(new Error("The Office.js is loaded outside of Office client"))},n.prototype.createClientHostController=function(){if(!this._clientHostController){if(this._hostInfo.hostPlatform!==e.HostInfoPlatform.win32)throw e.Utility.createNotImplementedException();this._clientHostController=new e.Win32RichClientHostController}return this._clientHostController},n.prototype.createAsyncMethodExecutor=function(){return new e.SafeArrayAsyncMethodExecutor(this._clientHostController)},n.prototype.createClientSettingsManager=function(){return new e.RichClientSettingsManager(this.getOsfControlContext())},n.prototype.getSerializedSettings=function(){var e=this.getOsfControlContext(),t=[],n=[];"undefined"!=typeof OsfOMToken&&OsfOMToken?e.GetSettings(OsfOMToken).Read(t,n):e.GetSettings().Read(t,n);for(var i={},r=0;r<t.length;r++)i[t[r]]=n[r];return i},n.prototype.getOfficeTheme=function(){var e=this.getOsfControlContext();if(e){if(!(this.officeTheme&&this.officeThemeTimeStamp&&(new Date).getTime()-this.officeThemeTimeStamp<n.officeThemeCacheValidPeriod)){var t=e.GetOfficeThemeInfo();this.officeTheme=this.getOfficeThemeFromInfoString(t),this.officeThemeTimeStamp=(new Date).getTime()}return this.officeTheme}},n.prototype.getOfficeThemeFromInfoString=function(t){var n=null;if(t)try{n=JSON.parse(t)}catch(t){e.AppTelemetry&&e.AppTelemetry.logAppException("Exception while parsing officeThemeInfo. Details: "+t)}var i={};if(n){var r={bodyBackgroundColor:{name:"bodyBackgroundColor",convertToHex:!0},bodyForegroundColor:{name:"bodyForegroundColor",convertToHex:!0},controlBackgroundColor:{name:"controlBackgroundColor",convertToHex:!0},controlForegroundColor:{name:"controlForegroundColor",convertToHex:!0},primaryFontColor:{name:"bodyForegroundColor",convertToHex:!0},primaryBackgroundColor:{name:"bodyBackgroundColor",convertToHex:!0},secondaryFontColor:{name:"controlForegroundColor",convertToHex:!0},secondaryBackgroundColor:{name:"controlBackgroundColor",convertToHex:!0},fluentThemeData:{name:"fluentThemeData",convertToHex:!1}};for(var o in n){var a=!1,s=o;r[o]&&(s=r[o].name,a=r[o].convertToHex),i[s]=a?e.OUtil.convertIntToCssHexColor(n[o]):n[o]}}return i},n.prototype.getSerializedHostSettings=function(){var e=this.getOsfControlContext(),t=[],n=[];"function"==typeof e.GetSettings().ReadHost&&("undefined"!=typeof OsfOMToken&&OsfOMToken?e.GetSettings(OsfOMToken).ReadHost(t,n):e.GetSettings().ReadHost(t,n));for(var i={},r=0;r<t.length;r++)i[t[r]]=n[r];return i},n.officeThemeCacheValidPeriod=5e3,n}(e.InitializationHelper);e.RichClientInitializationHelper=t}(OSF||(OSF={})),function(e){var t=function(){function e(e){this._osfClientContext=e}return e.prototype.read=function(e){var t,n=this._osfClientContext;t="undefined"!=typeof OsfOMToken&&OsfOMToken?n.GetSettings(OsfOMToken):n.GetSettings();var i=function(){var n=[],i=[];t.Read(n,i);for(var r={},o=0;o<n.length;o++)r[n[o]]=i[o];e&&e(0,r)};t.RefreshAsync?t.RefreshAsync((function(){i()})):i()},e.prototype.write=function(e,t){var n=[],i=[];for(var r in e)n.push(r),i.push(e[r]);var o,a=this._osfClientContext;void 0!==(o="undefined"!=typeof OsfOMToken&&OsfOMToken?a.GetSettings(OsfOMToken):a.GetSettings()).WriteAsync?o.WriteAsync(n,i,t):(o.Write(n,i),t(0))},e}();e.RichClientSettingsManager=t}(OSF||(OSF={})),function(e){var t=function(t){function n(n){var i=t.call(this)||this;return i._clientHostController=n,i._asyncMethodExecutorHelper=e.BootStrapExtension.createAsyncMethodExecutorHelper(i),i}return __extends(n,t),n.prototype.executeAsync=function(t,n,i,r){var o=this;try{var a=new Array;this._clientHostController.execute(t,n.toSafeArrayHost(),(function(s,c){var u=e.Utility.fromSafeArray(s);return o._asyncMethodExecutorHelper.handleSafeArrayHostResponse(u,c,a,i,n,t,r)}))}catch(e){this.onException(e,t,i)}},n.prototype.registerEventAsync=function(t,n,i,r,o,a,s){var c=this;try{this._clientHostController.registerEvent(t,n,i,(function(t,n){var i=e.Utility.fromSafeArray(n),a=o.fromSafeArrayHost(i);r(a)}),(function(n){var i,r=e.Utility.fromSafeArray(n);return"number"==typeof r?([],i=r):i=r[0],c.invokeCallback(t,a,i,null,s),!0}))}catch(e){this.onException(e,t,a)}},n.prototype.unregisterEventAsync=function(t,n,i,r,o){var a=this;try{this._clientHostController.unregisterEvent(t,n,i,(function(n,i){var s,c=e.Utility.fromSafeArray(n);return"number"==typeof c?([],s=c):s=c[0],a.invokeCallback(t,r,s,null,o),!0}))}catch(e){this.onException(e,t,r)}},n.prototype.onException=function(t,n,i){var r,o=t.number;if(o)switch(o){case-2146828218:r=7e3;break;case-2147467259:r=n==e.EventDispId.dispidDialogMessageReceivedEvent?12007:5001;break;case-2146828283:case-2147209089:r=5010;break;case-2147208704:r=5100;break;case-2146827850:default:r=5001}i&&this.invokeCallback(n,i,r||5001,null)},n}(e.AsyncMethodExecutor);e.SafeArrayAsyncMethodExecutor=t}(OSF||(OSF={})),function(e){var t=function(){function e(e){this._internalStorage=e}return e.prototype.getItem=function(e){try{return this._internalStorage&&this._internalStorage.getItem(e)}catch(e){return null}},e.prototype.setItem=function(e,t){try{this._internalStorage&&this._internalStorage.setItem(e,t)}catch(e){}},e.prototype.clear=function(){try{this._internalStorage&&this._internalStorage.clear()}catch(e){}},e.prototype.removeItem=function(e){try{this._internalStorage&&this._internalStorage.removeItem(e)}catch(e){}},e.prototype.getKeysWithPrefix=function(e){var t=[];try{for(var n=this._internalStorage&&this._internalStorage.length||0,i=0;i<n;i++){var r=this._internalStorage.key(i);0===r.indexOf(e)&&t.push(r)}}catch(e){}return t},e}();e.SafeStorage=t}(OSF||(OSF={})),function(e){var t=function(){function t(e,t){var n=this;this._clientSettingsManager=t,e=e||{},this._settings=e,this._eventDispatch=new OSF.EventDispatch([{id:OSF.EventDispId.dispidSettingsChangedEvent,type:OSF.EventType.SettingsChanged,getTargetId:function(){return""},fromSafeArrayHost:function(e){return{type:OSF.EventType.SettingsChanged,settings:n}},fromWebHost:function(e){return{type:OSF.EventType.SettingsChanged,settings:n}}}])}return t.prototype.cacheSessionSettings=function(e){var t=OSF.OUtil.getSessionStorage();if(t){var n=OSF.OUtil.serializeSettings(e),i=JSON.stringify(n);t.setItem(OSF._OfficeAppFactory.getCachedSessionSettingsKey(),i)}},t.prototype.get=function(e){var t=this._settings[e];return void 0===t?null:t},t.prototype.set=function(e,t){this._settings[e]=t,this.cacheSessionSettings(this._settings)},t.prototype.remove=function(e){delete this._settings[e],this.cacheSessionSettings(this._settings)},t.prototype.saveAsync=function(e){var t=this._clientSettingsManager,n=OSF.OUtil.serializeSettings(this._settings);t.write(n,(function(t){var n=OSF.Utility.asyncResultFromErrorCode(t);e&&e(n)}))},t.prototype.refreshAsync=function(t){var n=this;this._clientSettingsManager.read((function(i,r){var o=OSF.Utility.asyncResultFromErrorCode(i);o.status===e.AsyncResultStatus.Succeeded&&(n._settings=OSF.OUtil.deserializeSettings(r),o.value=n),t&&t(o)}))},t.prototype.addHandlerAsync=function(e,t,n){OSF.EventHelper.addEventHandler(e,t,n,this._eventDispatch)},t.prototype.removeHandlerAsync=function(e,t,n){OSF.EventHelper.removeEventHandler(e,t,n,this._eventDispatch)},t.prototype.toJSON=function(){return this._settings},t}();e.Settings=t}(Office||(Office={})),function(e){var t=function(){function t(){}return t.isSovereignVersion=function(){return 1!==e.OUtil.getLibraryReleaseVehicle()?"undefined"!=typeof isOsfSovereignVersion&&!0===isOsfSovereignVersion:e.OUtil.getCustomOfficeInitializationSettings().officeCdnEndpoint.isSovereign},t.prototype.getEnvironmentName=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,this.getConfig()];case 1:return[2,null!=(e=t.sent())&&e.envName?e.envName:null]}}))}))},t.prototype.getEnvironmentType=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,this.getConfig()];case 1:return[2,null!=(e=t.sent())&&e.envType?e.envType:null]}}))}))},t.prototype.getTrustedHostOrigins=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,this.getConfig()];case 1:return[2,null!=(e=t.sent())?e.trustedHostOrigins:null]}}))}))},t.prototype.isConfigAvailable=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,this.getConfig()];case 1:return[2,!!e.sent()]}}))}))},t.prototype.isSovereignHostTrusted=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){switch(n.label){case 0:return e?e===window.location.hostname?[2,!0]:[4,this.getTrustedHostOrigins()]:[2,!1];case 1:return(t=n.sent())&&0!=t.length?[2,new RegExp(t.join("|")).test(e)]:[2,!1]}}))}))},t.prototype.getConfigPath=function(){var t=e.LoadScriptHelper.getHostBundleJsBasePath(),n="undefined"!=typeof isOsfSecurityDefaultsEnabled&&!0===isOsfSecurityDefaultsEnabled;if(t){if(t=t.toLowerCase(),e.OUtil.isChangeGateEnabled("Microsoft.Office.SharedOnline.ChangeGate.OfficeVSO_10910853_OfficeJsNPMDownloadTrustedDomainList")&&1===e.OUtil.getLibraryReleaseVehicle()){var i="/lib/";if(e.OUtil.getCustomOfficeInitializationSettings().officeCdnEndpoint.isOCDICompliant){var r=t.indexOf("beta/");return r>-1?t.substring(0,r)+"officeconfig.json":""}return(o=t.indexOf(i))>-1?t.substring(0,o+i.length)+"officeconfig.json":""}if(n)try{return new URL(t).origin.toLowerCase()+"/officeconfig.json"}catch(e){}else{var o,a="/lib/";if((o=t.indexOf(a))>-1)return t.toLowerCase().substring(0,o+a.length)+"officeconfig.json"}}return""},t.prototype.getConfig=function(){return this._configPromise||(this._configPromise=this.tryLoadConfig()),this._configPromise},t.prototype.tryLoadConfig=function(){return __awaiter(this,void 0,void 0,(function(){var t,n,i,r,o,a,s;return __generator(this,(function(c){switch(c.label){case 0:if(!(t=this.getConfigPath()))return[3,2];if(n=e.OUtil.getLocalStorage(),i=t+"_cache",r=n.getItem(i),o=null,r){try{o=JSON.parse(r)}catch(e){}if(864e5,a=(new Date).getTime(),o&&o.config&&o.createTime<=a&&o.createTime+864e5>=a)return[2,o.config]}return[4,this.downloadConfig(t)];case 1:return(s=c.sent())?(o={createTime:(new Date).getTime(),config:s},n.setItem(i,JSON.stringify(o))):o&&(s=o.config),[2,s];case 2:return[2,null]}}))}))},t.prototype.downloadConfig=function(e){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(t){switch(t.label){case 0:return t.trys.push([0,3,,4]),[4,fetch(e)];case 1:return[4,t.sent().json()];case 2:return[2,t.sent()];case 3:return t.sent(),[3,4];case 4:return[2,null]}}))}))},t}();e.SovereignHelper=t}(OSF||(OSF={})),function(e){!function(e){function t(e){return void 0===e||null===e}e.createParameterException=function(e){return new Error("Parameter count mismatch: "+e)},e.createArgumentException=function(e){return new Error("Invalid argument "+e)},e.createNotImplementedException=function(){return new Error("Not implemented yet")},e.log=function(e){console.log(e)},e.trace=function(e){console.log(e)},e.debugLog=function(e){console.log(e)},e.getQueryStringValue=function(e){if("undefined"!=typeof window&&window.location&&window.location.search){var t=new RegExp("[?&]"+e+"=([^&]*)").exec(window.location.search);if(t)return t[1]}return null},e.isNullOrUndefined=t,e.isNullOrEmpty=function(e){return!!t(e)||0===e.length},e.isInUnittest=function(){return"boolean"==typeof g_osfUnittest&&g_osfUnittest}}(e.Utility||(e.Utility={}))}(OSF||(OSF={})),function(e){e.isOfficeReactNative=function(){try{return"undefined"!=typeof OfficePlatformGlobal&&void 0!==OfficePlatformGlobal.ReactNativeReka}catch(e){return!1}},function(e){function t(e){return new Promise(e)}function n(e){var t=e,r=1;if(("object"==typeof e||"unknown"==typeof e)&&null!=e&&e.toArray)if(e.dimensions&&(r=e.dimensions()),2===r)t=i(e);else{var o=e.toArray();t=new Array(o.length);for(var a=0;a<o.length;a++)t[a]=n(o[a])}return t}function i(e){var t;try{var n=e.ubound(1),i=e.ubound(2);if(e=e.toArray(),1==n&&1==i)t=[e];else{t=[];for(var r=0;r<n;r++){for(var o=[],a=0;a<i;a++){var s=e[r*i+a];"{66e7831f-81b2-42e2-823c-89e872d541b3}"!=s&&o.push(s)}o.length>0&&t.push(o)}}}catch(e){}return t}e.xdmDebugLog=function(t){e._DebugXdm&&console.log(t)},e.enableDebugXdm=function(){e._DebugXdm=!0},e.createPromiseFromResult=function(e){return Promise.resolve(e)},e.createPromise=t,e.promisify=function(e,n){return t((function(t,i){e((function(e){0===e?t():i()})),setTimeout((function(){i()}),n)}))},e.compareVersions=function(e,t){var n,i=e.split("."),r=t.split(".");for(n in i){if(parseInt(i[n])<parseInt(r[n]))return!1;if(parseInt(i[n])>parseInt(r[n]))return!0}return!1},e.getErrorCodeFromAsyncResult=function(e){return e.status===Office.AsyncResultStatus.Succeeded?0:e.error&&e.error.code?e.error.code:5001},e.externalNativeFunctionExists=function(e){return"unknown"===e||"undefined"!==e},e.stringEndsWith=function(t,n){if(e.isNullOrUndefined(t))throw e.createArgumentException("value");if(e.isNullOrUndefined(n))throw e.createArgumentException("subString");return!(n.length>t.length)&&t.substr(t.length-n.length)===n},e.fromSafeArray=function(e){var t=e;if(("object"==typeof e||"unknown"==typeof e)&&null!=e&&e.toArray){var i=e.toArray();t=new Array(i.length);for(var r=0;r<i.length;r++)t[r]=n(i[r])}return t},e.twoDVBArrayToJaggedArray=i,e.asyncResultFromErrorCode=function(e){return Array.isArray(e)&&1===e.length&&(e=e[0]),0===e?{status:Office.AsyncResultStatus.Succeeded}:{status:Office.AsyncResultStatus.Failed,error:{code:e}}},e._DebugXdm=!1}(e.Utility||(e.Utility={}))}(OSF||(OSF={})),function(e){var t=function(t){function n(n){var i=t.call(this)||this;return i._clientHostController=n,i._asyncMethodExecutorHelper=e.BootStrapExtension.createAsyncMethodExecutorHelper(i),i}return __extends(n,t),n.prototype.executeAsync=function(e,t,n,i){var r=this;this._clientHostController.execute(e,t.toWebHost(),(function(o,a){return n&&r._asyncMethodExecutorHelper.handleWebHostResponse(a,o,n,t,e,i),!0}))},n.prototype.registerEventAsync=function(e,t,n,i,r,o,a){var s=this;this._clientHostController.registerEvent(e,t,n,(function(e){var t=e,n=r.fromWebHost(t);i(n)}),(function(t,n){return o&&s.invokeCallback(e,o,t,null,a),!0}))},n.prototype.unregisterEventAsync=function(e,t,n,i,r){var o=this;this._clientHostController.unregisterEvent(e,t,n,(function(t,n){return i&&o.invokeCallback(e,i,t,null,r),!0}))},n}(e.AsyncMethodExecutor);e.WebAsyncMethodExecutor=t}(OSF||(OSF={})),function(e){!function(t){!function(t){t.getAuthContextAsync=function(t){e._OfficeAppFactory.getAsyncMethodExecutor().executeAsync(99,{toSafeArrayHost:function(){return[]},fromSafeArrayHost:function(e){return null},toWebHost:function(){return{}},fromWebHost:function(e){return e.authContext}},t)}}(t.WebAuth||(t.WebAuth={}))}(e.DDA||(e.DDA={})),function(t){var n;!function(e){e.AuthCode="authcode",e.Broker="broker",e.Implicit="implicit"}(n=t.AuthFlow||(t.AuthFlow={})),t.loadAttempts=0;var i="webauth/",r="webauth.browserauth.debug.js",o="webauth.browserauth.js",a=!0,s=!1;t.load=function(c){return t.config&&t.config.authFlow===n.AuthCode?(t.loadAttempts++,t.config&&!0===t.config.useMsal5?(r="webauth.browserauth.msal5.debug.js",o="webauth.browserauth.msal5.js",s=!0):(t.config&&!1===t.config.useMsal3&&(a=!1),a&&(r="webauth.browserauth.msal3.debug.js",o="webauth.browserauth.msal3.js",s=!0)),new Promise((function(n,a){var u=function(t,n,i){return new Promise((function(r,o){t?e.OUtil.loadScript(t,(function(e){if("boolean"!=typeof e||e)if(e instanceof Event&&e)o(new Event("loadScript: "+e.type+" '"+t+"'"));else if(i&&!n())var a=0,s=setInterval((function(){a+=500,!(n()||a>i)||(clearInterval(s),n())||o(new Event("Missing expected object after loaded."))}),500);else r(null);else o(new Event("loadScript: failed to load '"+t+"'"))}),e.LoadScriptHelper.getTrustedTypesPolicy(),i):r(null)}))},l=[u(t.config&&t.config.authVersion?e.LoadScriptHelper.getHostBundleJsBasePath()+i+t.config.authVersion+"/"+(t.config&&t.config.debugging?r:o):e.LoadScriptHelper.getHostBundleJsBasePath()+i+(t.config&&t.config.debugging?r:o),(function(){return!!BrowserAuth}),t.config.delayWebAuth)];s||l.push(u(t.config.msal,(function(){return!!msal}),t.config.delayMsal)),Promise.all(l).then((function(){if(t.config){var i=__assign({},t.config);c&&(i.appIds=c.appIds,i.redirectUri=c.redirectUri,i.prefetch=c.prefetch,i.clientCapabilities=c.clientCapabilities,i.usePairwiseBroker=c.usePairwiseBroker,i.trustedBrokerDomain=c.trustedBrokerDomain),BrowserAuth.Load(i,e._OfficeAppFactory.getHostInfo().osfControlAppCorrelationId).then((function(e){n(e)}),(function(e){a(e)}))}else a(new Event("config is empty."))}),(function(e){a(e)}))}))):new Promise((function(e,t){return t(new Event("'authcode' as authFlow is only supported"))}))},t.getToken=function(e,i,r,o,a,c){return t.config&&t.config.authFlow===n.AuthCode?s?BrowserAuth.GetToken({resource:e,scopes:i,applicationId:r,correlationId:o,popup:!!a,claims:c}):BrowserAuth.GetToken(e,r,o,!!a,!!a,!1,c):Promise.reject(new Event("'authcode' as authFlow is only supported"))}}(e.WebAuth||(e.WebAuth={}))}(OSF||(OSF={})),function(e){var t=function(){function t(t){this._delegateVersion=1,this._webAppState=t,this._webClientHostControllerHelper=e.BootStrapExtension.createWebClientHostControllerHelper(this._webAppState,this._delegateVersion)}return t.prototype.execute=function(e,t,n){var i=this,r=this._webClientHostControllerHelper.getHostCallArgs(e,t),o=this._webClientHostControllerHelper.getTargetMethodName(e);this._webAppState.clientEndPoint.invoke(o,(function(t,r){var o=0;if(0==t)i._delegateVersion=r.Version,o=i._webClientHostControllerHelper.parseErrorFromPayload(e,r);else switch(t){case-5:o=7e3;break;default:o=5001}n&&n(o,r)}),r)},t.prototype.registerEvent=function(e,t,n,i,r){this._webAppState.clientEndPoint.registerForEvent(this.getXdmEventName(n,t),(function(e){i&&i(e)}),this._getOnAfterRegisterEvent(!0,e,r),{controlId:this._webAppState.id,eventDispId:e,targetId:n,__timeout__:-1})},t.prototype.unregisterEvent=function(e,t,n,i){this._webAppState.clientEndPoint.unregisterForEvent(this.getXdmEventName(n,t),this._getOnAfterRegisterEvent(!1,e,i),{controlId:this._webAppState.id,eventDispId:e,targetId:n,__timeout__:-1})},t.prototype.messageParent=function(t){throw e.Utility.createNotImplementedException()},t.prototype.openDialog=function(t,n,i,r,o){throw e.Utility.createNotImplementedException()},t.prototype.closeDialog=function(t,n,i,r){throw e.Utility.createNotImplementedException()},t.prototype.sendMessage=function(t){throw e.Utility.createNotImplementedException()},t.prototype.closeSdxDialog=function(t){this._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost",null,[this._webAppState.id,e.AgaveHostAction.CloseSDXDialog,{InstanceId:this._webAppState.id,DialogCloseCallbackParam:t}])},t.prototype.resizeSdxDialog=function(t,n){this._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost",null,[this._webAppState.id,e.AgaveHostAction.ResizeSDXDialog,{InstanceId:this._webAppState.id,DialogWidth:t+"px",DialogHeight:n+"px"}])},t.prototype.getXdmEventName=function(t,n){return n==e.EventType.BindingSelectionChanged||n==e.EventType.BindingDataChanged||n==e.EventType.DataNodeDeleted||n==e.EventType.DataNodeInserted||n==e.EventType.DataNodeReplaced?t+"_"+n:n},t.prototype._getOnAfterRegisterEvent=function(t,n,i){var r=(new Date).getTime();return function(o,a){var s;if(0!=o)switch(o){case-5:s=7e3;break;default:s=5001}else s=a?a.Error?a.Error:0:5001;i&&i(s),e.AppTelemetry&&e.AppTelemetry.onRegisterDone(t,n,Math.abs((new Date).getTime()-r),s)}},t}();e.WebClientHostController=t}(OSF||(OSF={})),function(e){var t=function(){function e(e,t){this._webAppState=e,this._delegateVersion=t}return e.prototype.getHostCallArgs=function(e,t){var n=t;return n||(n={}),n.DdaMethod={ControlId:this.getControlId(),DispatchId:e,Version:this._delegateVersion},n.__timeout__=-1,n},e.prototype.getTargetMethodName=function(e){return"executeMethod"},e.prototype.parseErrorFromPayload=function(e,t){return t.Error},e.prototype.getControlId=function(){return this._webAppState.id},e}();e.WebClientHostControllerHelper=t}(OSF||(OSF={})),function(e){var t=function(){function t(){}return t.prototype.read=function(t){e._OfficeAppFactory.getAsyncMethodExecutor().executeAsync(75,{toSafeArrayHost:function(){return[]},fromSafeArrayHost:function(e){return null},toWebHost:function(){return{}},fromWebHost:function(e){return e.Properties.Settings}},(function(e){if(e.status===Office.AsyncResultStatus.Succeeded){for(var n={},i=0;i<e.value.length;i++){var r=e.value[i];Array.isArray(r)?n[r[0]]=r[1]:n[r.Name]=r.Value}t(0,n)}else{var o=e.error.code;t(o,{})}}))},t.prototype.write=function(t,n){var i=e._OfficeAppFactory.getAsyncMethodExecutor(),r=[];for(var o in t){var a=[];a.push(o),a.push(t[o]),r.push(a)}var s={toSafeArrayHost:function(){return null},fromSafeArrayHost:function(e){return null},toWebHost:function(){return{DdaSettingsMethod:{OverwriteIfStale:!0,Properties:r}}},fromWebHost:function(e){return null}};i.executeAsync(76,s,(function(e){if(e.status===Office.AsyncResultStatus.Succeeded)n(0);else{var t=e.error.code;n(t)}}))},t}();e.WebClientSettingsManager=t}(OSF||(OSF={})),function(e){var t=function(t){function n(e,n,i,r){var o=t.call(this,e,n,i,r)||this;return o._serializedSettings={},o._serializedHostSettings={},o._initializeNestedAppAuthPromise=null,o._appContext={},o._tabbableElements="a[href]:not([tabindex='-1']),area[href]:not([tabindex='-1']),button:not([disabled]):not([tabindex='-1']),input:not([disabled]):not([tabindex='-1']),select:not([disabled]):not([tabindex='-1']),textarea:not([disabled]):not([tabindex='-1']),*[tabindex]:not([tabindex='-1']),*[contenteditable]:not([disabled]):not([tabindex='-1'])",o}return __extends(n,t),Object.defineProperty(n.prototype,"isHostOriginTrusted",{get:function(){return this._isHostOriginTrustedFunc},set:function(e){this._isHostOriginTrustedFunc=e},enumerable:!0,configurable:!0}),n.prototype.saveAndSetDialogInfo=function(t){var n,i=e.OUtil.getSessionStorage();if(i){if(t||(t=e.OUtil.parseHostInfoFromWindowName(!0,e._OfficeAppFactory.getWindowName())),t&&t.indexOf("isDialog")>-1){var r=(n=e.OUtil.parseXdmInfo(!0))?n.split("|")[1]:null;return null!=r&&i.setItem(r+"IsDialog","true"),void(this._hostInfo.isDialog=!0)}this._hostInfo.isDialog=null!=i.getItem(e.OUtil.getXdmFieldValue("AppId",!1)+"IsDialog")}},n.prototype.checkReceiverOriginAndRun=function(t){return __awaiter(this,void 0,void 0,(function(){var n,i,r,o,a,s,c,u,l,d;return __generator(this,(function(f){switch(f.label){case 0:return 3===(n=this)._webAppState.clientEndPoint.hostTrustCheckStatus?(t(),[2]):(i=e.OUtil.parseUrl(n._webAppState.clientEndPoint.targetUrl,!1),r="https:"==i.protocol,o=i.hostname,a="NotHttps",0!==n._webAppState.clientEndPoint.hostTrustCheckStatus?[3,6]:(r||(n._webAppState.clientEndPoint.hostTrustCheckStatus=2),2==n._webAppState.clientEndPoint.hostTrustCheckStatus?[3,6]:(s=!1,e.OUtil.isChangeGateEnabled("Microsoft.Office.SharedOnline.ChangeGate.OfficeVSO_10910853_OfficeJsNPMDownloadTrustedDomainList")?[4,e.XdmCommunicationManager.isHostNameValidWacDomainAsync(o,n.isHostOriginTrusted)]:[3,2])));case 1:return s=f.sent(),[3,5];case 2:return(c=e.SovereignHelper.isSovereignVersion())&&!0!==e.OUtil.getCustomOfficeInitializationSettings().trustAllCloudEnvironments||(s=e.XdmCommunicationManager.isHostNameValidWacDomain(o),n.isHostOriginTrusted&&(s=s||n.isHostOriginTrusted(o))),s||!c?[3,5]:(n._sovereignHelper||(n._sovereignHelper=new e.SovereignHelper),[4,(u=n._sovereignHelper).isConfigAvailable()]);case 3:return f.sent()?[4,u.isSovereignHostTrusted(o)]:[2];case 4:s=f.sent(),f.label=5;case 5:s&&(n._webAppState.clientEndPoint.hostTrustCheckStatus=3),f.label=6;case 6:if(n._webAppState.clientEndPoint.checkStatusLogged||null==n._hostInfo||void 0===n._hostInfo||(e.AppTelemetry.onCheckWACHost(n._webAppState.clientEndPoint.hostTrustCheckStatus,n._webAppState.id,n._hostInfo.hostType,n._hostInfo.hostPlatform,n._webAppState.clientEndPoint.targetUrl),n._webAppState.clientEndPoint.checkStatusLogged=!0),3===n._webAppState.clientEndPoint.hostTrustCheckStatus||e.LoadScriptHelper.disableHostCheck())t();else{if(e.LoadScriptHelper.isSdx())throw new Error("Not supported host");l=function(){var i=e.LoadScriptHelper.getHostBundleJsBasePath().match(/^https?:\/\/[^:/?#]*(?::([0-9]+))?/);if(i&&i[0]){var s=e.LoadScriptHelper.getHostBundleJsBasePath()+"AgaveErrorUX/index.html#",c={error:"NotTrustedWAC",locale:e.getSupportedLocale(n._hostInfo.hostLocale,e.ConstantNames.DefaultLocale),hostname:o,noHttps:!r,validate:!1},u=document.createElement("iframe");u.style.visibility="hidden",u.style.height="0",u.style.width="0";var l=function(r){if(r.source==u.contentWindow&&r.origin==i[0])try{!0===JSON.parse(r.data).hostUserTrusted?(n._webAppState.clientEndPoint.hostTrustCheckStatus=3,e.OUtil.removeEventListener(window,"message",l),document.body.removeChild(u)):(c.validate=!1,window.location.replace(s+encodeURIComponent(JSON.stringify(c)))),t()}catch(t){e.OUtil.ensureOfficeStringsJs().then((function(){document.body.textContent=Strings.OfficeOM.L_NotTrustedWAC}))}};e.OUtil.addEventListener(window,"message",l),c.validate=!0,u.setAttribute("src",s+encodeURIComponent(JSON.stringify(c))),u.onload=function(){var e={hostname:o,noHttps:!r};u.contentWindow.postMessage(JSON.stringify(e),i[0])},document.body.appendChild(u)}else e.OUtil.ensureOfficeStringsJs().then((function(){document.body.textContent=Strings.OfficeOM.L_NotTrustedWAC}));if(e.OUtil.checkFlight(2)&&!r)throw new Error(a)},document.body?l():(d=!1,document.addEventListener("DOMContentLoaded",(function(){d||(d=!0,l())})))}return[2]}}))}))},n.prototype.setAgaveHostCommunication=function(){try{var t=this,n=e.OUtil.parseXdmInfoWithGivenFragment(!1,e._OfficeAppFactory.getWindowLocationHash());if(n||(n=e.OUtil.parseXdmInfoFromWindowName(!1,e._OfficeAppFactory.getWindowName())),n){var i=e.OUtil.getInfoItems(n);null!=i&&i.length>=3&&(t._webAppState.conversationID=i[0],t._webAppState.id=i[1],t._webAppState.webAppUrl=i[2].indexOf(":")>=0?i[2]:decodeURIComponent(i[2]))}if(t._webAppState.wnd=null!=window.opener?window.opener:window.parent,this._hostInfo.isDialog&&null!=window.opener)return;t._webAppState.clientEndPoint=e.XdmCommunicationManager.connect(t._webAppState.conversationID,t._webAppState.wnd,t._webAppState.webAppUrl),t._webAppState.serviceEndPoint=e.XdmCommunicationManager.createServiceEndPoint(t._webAppState.id),t._webAppState.clientEndPoint.checkReceiverOriginAndRun=function(e){t.checkReceiverOriginAndRun(e)};var r=t._webAppState.conversationID+e.Constants.NotificationConversationIdSuffix;t._webAppState.serviceEndPoint.registerConversation(r,t._webAppState.webAppUrl);t._webAppState.serviceEndPoint.registerMethod("Office_notifyAgave",(function(n){var i;switch(i="string"==typeof n?n:n[0]){case e.AgaveHostAction.Select:t._webAppState.focused=!0;break;case e.AgaveHostAction.UnSelect:t._webAppState.focused=!1;break;case e.AgaveHostAction.TabIn:case e.AgaveHostAction.CtrlF6In:window.focus();var r=document.querySelectorAll(t._tabbableElements);e.OUtil.focusToFirstTabbable(r,!1)||(window.blur(),t._webAppState.focused=!1,t._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost",null,[t._webAppState.id,e.AgaveHostAction.ExitNoFocusable]));break;case e.AgaveHostAction.TabInShift:window.focus();r=document.querySelectorAll(t._tabbableElements);e.OUtil.focusToFirstTabbable(r,!0)||(window.blur(),t._webAppState.focused=!1,t._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost",null,[t._webAppState.id,e.AgaveHostAction.ExitNoFocusableShift]));break;case e.AgaveHostAction.SendMessage:if(Office.context.messaging.onMessage){var o=n[1];Office.context.messaging.onMessage(o)}break;case e.AgaveHostAction.TaskPaneHeaderButtonClicked:Office.context.ui.taskPaneAction.onHeaderButtonClick&&Office.context.ui.taskPaneAction.onHeaderButtonClick();break;default:e.Utility.trace("actionId "+i+" notifyAgave is wrong.")}}),0,!1),t.addOrRemoveEventListenersForWindow(!0)}catch(t){throw e.AppTelemetry&&e.AppTelemetry.logAppException("Exception thrown in setAgaveHostCommunication. Exception:["+t+"]"),t}},n.prototype.getAppContext=function(t,n,i){var r=this,o=this,a=function(t,a){if(OSFPerformance.getAppContextXdmEnd=OSFPerformance.now(),a._appName===e.AppName.ExcelWebApp&&Array.isArray(a._settings))for(var s=0,c=a._settings;s<c.length;s++){var u=c[s],l=u[0],d=u[1];r._serializedSettings[l]=d}else r._serializedSettings=a._settings||{};if(a._appName===e.AppName.ExcelWebApp&&Array.isArray(a._hostSettings))for(var f=0,p=a._hostSettings;f<p.length;f++){var h=p[f];l=h[0],d=h[1];r._serializedHostSettings[l]=d}else r._serializedHostSettings=a._hostSettings||{};if(a._appAndHostSettingsEqual&&(r._serializedHostSettings=__assign({},r._serializedSettings)),!o._hostInfo.isDialog||null==window.opener){var g=window.location.origin;o._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost",null,[o._webAppState.id,e.AgaveHostAction.UpdateTargetUrl,g])}if(0===t&&null!=a._id&&null!=a._appName&&null!=a._appVersion&&null!=a._appUILocale&&null!=a._dataLocale&&null!=a._docUrl&&null!=a._clientMode&&null!=a._reason){o._appContext=a;var m=a._appInstanceId?a._appInstanceId:a._id,v=0;null!=a._appMinorVersion&&(v=a._appMinorVersion);var y=void 0;null!=a._requirementMatrix&&(y=a._requirementMatrix),a.eToken=a.eToken?a.eToken:"";var _=new e.OfficeAppContext(a._id,a._appName,a._appVersion,a._appUILocale,a._dataLocale,a._docUrl,a._clientMode,(function(){return r._serializedSettings}),a._reason,a._osfControlType,a._eToken,a._correlationId,m,!1,!0,v,y,a._hostCustomMessage,a._hostFullVersion,a._clientWindowHeight,a._clientWindowWidth,a._addinName,a._appDomains,a._dialogRequirementMatrix,a._featureGates,a._officeTheme,a._initialDisplayMode,a._isFromWacAutomation,a._wopiHostOriginForSingleSignOn,(function(){return r._serializedHostSettings}),!0,a._nestedAppAuthBridgeType,a._partitionKey,a._topFrameOrigin);_.set_taskpaneUrl(a._taskpaneUrl),n(_)}else{var b="Function ContextActivationManager_getAppContextAsync call failed. ErrorCode is "+t+", exception: "+a;e.AppTelemetry&&e.AppTelemetry.logAppException(b),i(b)}};try{var s=!0;this._hostInfo.isDialog&&null!=window.opener&&(s=!1);var c=e.OUtil.parseAppContextFromWindowName(s,e._OfficeAppFactory.getWindowName());c?a(0,c):(OSFPerformance.getAppContextXdmStart=OSFPerformance.now(),this._webAppState.clientEndPoint.invoke("ContextActivationManager_getAppContextAsync",a,this._webAppState.id))}catch(t){e.AppTelemetry&&e.AppTelemetry.logAppException("Exception thrown when trying to invoke getAppContextAsync. Exception:["+t+"]"),i(t)}},n.prototype.createClientHostController=function(){return this._clientHostController||(this._clientHostController=new e.WebClientHostController(this._webAppState)),this._clientHostController},n.prototype.createAsyncMethodExecutor=function(){return new e.WebAsyncMethodExecutor(this._clientHostController)},n.prototype.createClientSettingsManager=function(){return new e.WebClientSettingsManager},n.prototype.addOrRemoveEventListenersForWindow=function(t){var n=this,i=function(){n._webAppState.focused||(n._webAppState.focused=!0),n._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost",null,[n._webAppState.id,e.AgaveHostAction.Select])},r=function(){e&&(n._webAppState.focused&&(n._webAppState.focused=!1),n._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost",null,[n._webAppState.id,e.AgaveHostAction.UnSelect]))},o=function(t){if(t.preventDefault=t.preventDefault||function(){t.returnValue=!1},117==t.keyCode&&(t.ctrlKey||t.metaKey)){t.preventDefault();var i=e.AgaveHostAction.CtrlF6Exit;t.shiftKey&&(i=e.AgaveHostAction.CtrlF6ExitShift),n._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost",null,[n._webAppState.id,i])}else if(9==t.keyCode){t.preventDefault();var r=document.querySelectorAll(n._tabbableElements);e.OUtil.focusToNextTabbable(r,t.target||t.srcElement,t.shiftKey)||(n._hostInfo.isDialog?e.OUtil.focusToFirstTabbable(r,t.shiftKey):t.shiftKey?n._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost",null,[n._webAppState.id,e.AgaveHostAction.TabExitShift]):n._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost",null,[n._webAppState.id,e.AgaveHostAction.TabExit]))}else if(27==t.keyCode)t.preventDefault(),n._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost",null,[n._webAppState.id,e.AgaveHostAction.EscExit]);else if(113==t.keyCode)t.preventDefault(),n._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost",null,[n._webAppState.id,e.AgaveHostAction.F2Exit]);else if((t.ctrlKey||t.metaKey||t.shiftKey||t.altKey)&&t.keyCode>=1&&t.keyCode<=255){var o={keyCode:t.keyCode,shiftKey:t.shiftKey,altKey:t.altKey,ctrlKey:t.ctrlKey,metaKey:t.metaKey};n._webAppState.clientEndPoint.invoke("ContextActivationManager_notifyHost",null,[n._webAppState.id,e.AgaveHostAction.KeyboardShortcuts,o])}},a=function(e){117==e.keyCode&&e.ctrlKey&&(e.preventDefault?e.preventDefault():e.returnValue=!1)};e.Utility._DebugXdm||(t?(e.OUtil.addEventListener(window,"focus",i),e.OUtil.addEventListener(window,"blur",r),e.OUtil.addEventListener(window,"keydown",o),e.OUtil.addEventListener(window,"keypress",a)):(e.OUtil.removeEventListener(window,"focus",i),e.OUtil.removeEventListener(window,"blur",r),e.OUtil.removeEventListener(window,"keydown",o),e.OUtil.removeEventListener(window,"keypress",a)))},n.prototype.getTabbableElements=function(){return this._tabbableElements},n.prototype.setupNestedAppAuthDependencies=function(){var e=this;window.__initializeNestedAppAuth=function(){return e._initializeNestedAppAuthPromise||(e._initializeNestedAppAuthPromise=__awaiter(e,void 0,void 0,(function(){return __generator(this,(function(e){switch(e.label){case 0:return[4,Office.onReadyInternal()];case 1:return e.sent(),this._createNaaBridge?[4,this._createNaaBridge()]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}}))}))),e._initializeNestedAppAuthPromise}},n}(e.InitializationHelper);e.WebInitializationHelper=t}(OSF||(OSF={})),function(e){var t=function(){function t(e,t){this._initializationHelper=e,this._scriptMessager=t}return t.prototype.read=function(e){this._initializationHelper.getAppContext(null,(function(t){if(e){var n=t.get_settingsFunc()();e(0,n)}}),(function(t){e&&e(5001,{})}))},t.prototype.write=function(t,n){var i={},r=[],o=[];for(var a in t)r.push(a),o.push(t[a]);i.keys=r,i.values=o;this._scriptMessager.invokeMethod(e.Webkit.MessageHandlerName,e.Webkit.MethodId.WriteSettings,i,(function(e){n&&n(e[0])}))},t}();e.WebkitClientSettingsManager=t}(OSF||(OSF={})),function(e){!function(t){t.MessageHandlerName="Agave",t.PopupMessageHandlerName="WefPopupHandler",function(e){e[e.Settings=0]="Settings",e[e.SolutionReferenceId=1]="SolutionReferenceId",e[e.AppType=2]="AppType",e[e.MajorVersion=3]="MajorVersion",e[e.MinorVersion=4]="MinorVersion",e[e.RevisionVersion=5]="RevisionVersion",e[e.APIVersionSequence=6]="APIVersionSequence",e[e.AppCapabilities=7]="AppCapabilities",e[e.APPUILocale=8]="APPUILocale",e[e.AppDataLocale=9]="AppDataLocale",e[e.BindingCount=10]="BindingCount",e[e.DocumentUrl=11]="DocumentUrl",e[e.ActivationMode=12]="ActivationMode",e[e.ControlIntegrationLevel=13]="ControlIntegrationLevel",e[e.SolutionToken=14]="SolutionToken",e[e.APISetVersion=15]="APISetVersion",e[e.CorrelationId=16]="CorrelationId",e[e.InstanceId=17]="InstanceId",e[e.TouchEnabled=18]="TouchEnabled",e[e.CommerceAllowed=19]="CommerceAllowed",e[e.RequirementMatrix=20]="RequirementMatrix",e[e.HostCustomMessage=21]="HostCustomMessage",e[e.HostFullVersion=22]="HostFullVersion",e[e.InitialDisplayMode=23]="InitialDisplayMode",e[e.FeatureGates=24]="FeatureGates",e[e.HostSettings=25]="HostSettings",e[e.OfficeThemeInfo=26]="OfficeThemeInfo"}(t.AppContextProperties||(t.AppContextProperties={})),function(e){e[e.Execute=1]="Execute",e[e.RegisterEvent=2]="RegisterEvent",e[e.UnregisterEvent=3]="UnregisterEvent",e[e.WriteSettings=4]="WriteSettings",e[e.GetContext=5]="GetContext",e[e.SendMessage=6]="SendMessage",e[e.MessageParent=7]="MessageParent",e[e.SendMessage2=8]="SendMessage2",e[e.MessageParent2=9]="MessageParent2",e[e.CloseSdxDialog=10]="CloseSdxDialog",e[e.ResizeSdxDialog=11]="ResizeSdxDialog"}(t.MethodId||(t.MethodId={}));var n=function(){function t(e){this.hostScriptProxy=e,this.useFullDialogAPI=!!window._enableFullDialogAPI,this.osfSupportsDialogOrigin=!!window._osfEnableDialogOrigin}return t.prototype.execute=function(t,n,i){var r={id:t,apiArgs:n};this.hostScriptProxy.invokeMethod(e.Webkit.MessageHandlerName,e.Webkit.MethodId.Execute,r,(function(t){if(i){var n=[];if(e.OUtil.isArray(t))for(var r=0;r<t.length;r++){var o=t[r];e.OUtil.isArray(o)&&(o=new e.WebkitSafeArray(o)),n.unshift(o)}return i.apply(null,n)}}))},t.prototype.registerEvent=function(t,n,i,r,o){this.hostScriptProxy.registerEvent(e.Webkit.MessageHandlerName,e.Webkit.MethodId.RegisterEvent,t,i,(function(t){var n=t,i=0;e.OUtil.isArray(t)&&t.length>=2&&(n=t[0],i=t[1]),r&&r(i,new e.WebkitSafeArray(n))}),(function(t){if(o)return o(new e.WebkitSafeArray(t))}))},t.prototype.unregisterEvent=function(t,n,i,r){this.hostScriptProxy.unregisterEvent(e.Webkit.MessageHandlerName,e.Webkit.MethodId.UnregisterEvent,t,i,(function(t){return r(new e.WebkitSafeArray(t))}))},t.prototype.messageParent=function(t){var n,i;if(this.osfSupportsDialogOrigin&&t[e.ParameterNames.TargetOrigin]?(n=this.useFullDialogAPI?JSON.stringify(t):t[e.ParameterNames.MessageToParent],i=e.Webkit.MethodId.MessageParent2):(n=t[e.ParameterNames.MessageToParent],i=e.Webkit.MethodId.MessageParent),this.useFullDialogAPI)this.hostScriptProxy.invokeMethod(e.Webkit.MessageHandlerName,i,n,null);else{var r={dialogMessage:{messageType:0,messageContent:n}},o=i==e.Webkit.MethodId.MessageParent2?t[e.ParameterNames.TargetOrigin]:window.location.origin;window.opener.postMessage(JSON.stringify(r),o)}},t.prototype.openDialog=function(n,i,r,o,a){if(this.useFullDialogAPI)this.registerEvent(n,i,r,o,a);else if(!t.popup||t.popup.closed){t.OpenDialogCallback=void 0;var s=JSON.parse(r),c=s.url;if(c){var u=c.split("#"),l="?";u[0].indexOf("?")>-1&&(l="&");var d="width="+screen.width*s.width/100+", height="+screen.height*s.height/100;u[0]=u[0].concat(l).concat("action=displayDialog");var f=u.join("#");t.popup=window.open(f,"",d),t.DialogEventListener=function(t){if(t.origin==window.location.origin)try{var i=JSON.parse(t.data);i.dialogMessage&&o(n,[0,i.dialogMessage.messageContent,t.origin])}catch(n){e.Utility.trace("messages received cannot be handlered. Message:"+t.data)}},t.OpenDialogCallback=function(e){0==e&&(window.addEventListener("message",t.DialogEventListener),t.interval=window.setInterval(p,1e3),t.NotifyError=function(e){o(n,[e])}),a(e)}}else a(12003)}else a(12007);function p(){try{(null==t.popup||t.popup.closed)&&(window.clearInterval(t.interval),window.removeEventListener("message",t.DialogEventListener),t.NotifyError=null,t.popup=null,o(n,[12006]))}catch(t){e.Utility.trace("Error happened when popup window closed.")}}},t.prototype.closeDialog=function(e,n,i,r){this.useFullDialogAPI?this.unregisterEvent(e,n,i,r):t.popup?(t.interval&&window.clearInterval(t.interval),t.popup.close(),t.popup=null,window.removeEventListener("message",t.DialogEventListener),t.NotifyError=null,r(0)):r(5001)},t.prototype.sendMessage=function(t){var n,i;this.osfSupportsDialogOrigin&&t[e.ParameterNames.TargetOrigin]?(n=JSON.stringify(t),i=e.Webkit.MethodId.SendMessage2):(n=t[e.ParameterNames.MessageContent],i=e.Webkit.MethodId.SendMessage,!isNaN(parseFloat(n))&&isFinite(n)&&(n=n.toString())),this.hostScriptProxy.invokeMethod(e.Webkit.MessageHandlerName,i,n,null)},t.prototype.closeSdxDialog=function(t){var n=[t],i=e.Webkit.MethodId.CloseSdxDialog;this.hostScriptProxy.invokeMethod(e.Webkit.MessageHandlerName,i,n,null)},t.prototype.resizeSdxDialog=function(t,n){var i=[t,n],r=e.Webkit.MethodId.ResizeSdxDialog;this.hostScriptProxy.invokeMethod(e.Webkit.MessageHandlerName,r,i,null)},t}();t.WebkitHostController=n}(e.Webkit||(e.Webkit={}))}(OSF||(OSF={})),function(e){var t=function(t){function n(e,n,i,r){var o=t.call(this,e,n,i,r)||this;return o._serializedSettings={},o._serializedHostSettings={},o.initializeWebkitMessaging(),o}return __extends(n,t),n.prototype.initializeWebkitMessaging=function(){e.ScriptMessaging=OSFWebkit.ScriptMessaging},n.prototype.getAppContext=function(t,n,i){var r,o=this;r=this._hostInfo.isDialog&&window.webkit.messageHandlers[e.Webkit.PopupMessageHandlerName]?e.Webkit.PopupMessageHandlerName:e.Webkit.MessageHandlerName,e.ScriptMessaging.GetScriptMessenger().invokeMethod(r,e.Webkit.MethodId.GetContext,[],(function(t){var i,r=e.Webkit.AppContextProperties,a=t[r.AppType],s=t[r.Settings];if(s&&2===s.length)for(var c=s[0],u=s[1],l=0;l<c.length;l++)o._serializedSettings[c[l]]=u[l];var d=t[r.HostSettings];if(d&&2===d.length)for(c=d[0],u=d[1],l=0;l<c.length;l++)o._serializedHostSettings[c[l]]=u[l];var f=t[r.SolutionReferenceId],p=t[r.MajorVersion],h=t[r.MinorVersion],g=t[r.AppCapabilities],m=t[r.APPUILocale],v=t[r.AppDataLocale],y=t[r.DocumentUrl],_=t[r.ActivationMode],b=t[r.ControlIntegrationLevel],O=t[r.SolutionToken];O=O?O.toString():"";var S,E=t[r.CorrelationId],I=t[r.InstanceId],C=t[r.TouchEnabled],A=t[r.CommerceAllowed],P=t[r.RequirementMatrix],w=t[r.HostCustomMessage],x=t[r.HostFullVersion],F=t[r.InitialDisplayMode],R=t[r.FeatureGates];if(R)try{S=JSON.parse(R)}catch(t){e.AppTelemetry&&e.AppTelemetry.logAppException("Exception trying to parse FeatureGates."+t)}var N=null;if(t[r.OfficeThemeInfo])try{N=JSON.parse(t[r.OfficeThemeInfo])}catch(t){e.AppTelemetry&&e.AppTelemetry.logAppException("Exception while parsing officeThemeInfo. Details: "+t)}var T={};if(N){var M={bodyBackgroundColor:{name:"bodyBackgroundColor",convertToHex:!0},bodyForegroundColor:{name:"bodyForegroundColor",convertToHex:!0},controlBackgroundColor:{name:"controlBackgroundColor",convertToHex:!0},controlForegroundColor:{name:"controlForegroundColor",convertToHex:!0},primaryFontColor:{name:"bodyForegroundColor",convertToHex:!0},primaryBackgroundColor:{name:"bodyBackgroundColor",convertToHex:!0},secondaryFontColor:{name:"controlForegroundColor",convertToHex:!0},secondaryBackgroundColor:{name:"controlBackgroundColor",convertToHex:!0},fluentThemeData:{name:"fluentThemeData",convertToHex:!1}};for(var j in N){var k=!1,H=j;M[j]&&(H=M[j].name,k=M[j].convertToHex),T[H]=k?e.OUtil.convertIntToCssHexColor(N[j]):N[j]}}i=new e.OfficeAppContext(f,a,p,m,v,y,g,(function(){return o._serializedSettings}),_,b,O,E,I,C,A,h,P,w,x,void 0,void 0,void 0,void 0,void 0,S,T,F,void 0,void 0,(function(){return o._serializedHostSettings}),!1,void 0,void 0,void 0),n(i)}))},n.prototype.createClientHostController=function(){return this._clientHostController||(this._clientHostController=new e.Webkit.WebkitHostController(e.ScriptMessaging.GetScriptMessenger())),this._clientHostController},n.prototype.createAsyncMethodExecutor=function(){return new e.SafeArrayAsyncMethodExecutor(this.createClientHostController())},n.prototype.createClientSettingsManager=function(){return new e.WebkitClientSettingsManager(this,e.ScriptMessaging.GetScriptMessenger())},n}(e.InitializationHelper);e.WebkitInitializationHelper=t}(OSF||(OSF={})),function(e){var t=function(){function t(e){this.data=e,this.safeArrayFlag=this.isSafeArray(e)}return t.prototype.dimensions=function(){var e=0;return this.safeArrayFlag?e=this.data[0][0]:this.isArray()&&(e=2),e},t.prototype.getItem=function(){var e=null;e=this.safeArrayFlag?this.toArray():this.data;for(var t=0;t<arguments.length;t++)e=e[arguments[t]];return e},t.prototype.lbound=function(e){return 0},t.prototype.ubound=function(t){var n=0;if(this.safeArrayFlag)n=this.data[0][t];else if(this.isArray()){if(1==t)return this.data.length;if(2==t){if(e.OUtil.isArray(this.data[0]))return this.data[0].length;if(null!=this.data[0])return 1}}return n},t.prototype.toArray=function(){if(0==this.isArray())return this.data;for(var e=[],n=this.safeArrayFlag?1:0;n<this.data.length;n++){var i=this.data[n];this.isSafeArray(i)?e.push(new t(i)):e.push(i)}return e},t.prototype.isArray=function(){return e.OUtil.isArray(this.data)},t.prototype.isSafeArray=function(t){var n=!1;if(e.OUtil.isArray(t)&&e.OUtil.isArray(t[0])){var i=t[0],r=i[0];if(i.length!=r+1)return!1;for(var o=1,a=1;a<i.length;a++){var s=i[a];if(0==isFinite(s))return!1;o*=s}n=++o==t.length}return n},t}();e.WebkitSafeArray=t}(OSF||(OSF={})),function(e){!function(e){var t=null;e.agaveHostCallback=function(e,n){t.agaveHostCallback(e,n)},e.agaveHostEventCallback=function(e,n){t.agaveHostEventCallback(e,n)},e.GetScriptMessenger=function(){return null==t&&(t=i.IsSupportedByHost()?new i:new r("OSF.ScriptMessaging.agaveHostCallback","OSF.ScriptMessaging.agaveHostEventCallback")),t};var n=function(e,t,n){this.id=e,this.targetId=t,this.handler=n},i=function(){function e(){this.eventHandlers=[]}return e.IsSupportedByHost=function(){return!!window._osfHostAPI},e.prototype.invokeMethod=function(e,t,n,i){window._osfHostAPI(e,this.constructMessagingArgs(t,n),(function(e){var t=i(e);return void 0===t||!0===t}))},e.prototype.registerEvent=function(e,t,n,i,r,o){var a={id:n,targetId:i},s=window._osfHostRegisterEvent(e,this.constructMessagingArgs(t,a),(function(e){return r(e),!1}),(function(e){return o(e),!0}));this.eventHandlers.push({targetId:i,dispId:n,callbackId:s.eventCallbackId})},e.prototype.unregisterEvent=function(e,t,n,i,r){var o={id:n,targetId:i};window._osfHostAPI(e,this.constructMessagingArgs(t,o),(function(e){return r(e),!0}));for(var a=this.eventHandlers.length-1;a>=0;a--){var s=this.eventHandlers[a];s.dispId===n&&s.targetId===i&&(this.eventHandlers.splice(a,1),window._osfHostUnregisterCallback(s.callbackId))}},e.prototype.agaveHostCallback=function(e,t){},e.prototype.agaveHostEventCallback=function(e,t){},e.prototype.constructMessagingArgs=function(e,t){return{params:t,methodId:e}},e}(),r=function(){function e(t,n){this.callingIndex=0,this.callbackList={},this.eventHandlerList={},this.asyncMethodCallbackFunctionName=t,this.eventCallbackFunctionName=n,this.conversationId=e.getCurrentTimeMS().toString()}return e.prototype.invokeMethod=function(e,t,n,i){this.postWebkitMessage({},e,t,n,i)},e.prototype.registerEvent=function(e,t,i,r,o,a){var s={eventCallbackFunction:this.eventCallbackFunctionName},c={id:i,targetId:r},u=this.postWebkitMessage(s,e,t,c,a);this.eventHandlerList[u]=new n(i,r,o)},e.prototype.unregisterEvent=function(e,t,n,i,r){var o={id:n,targetId:i};for(var a in this.eventHandlerList)if(this.eventHandlerList.hasOwnProperty(a)){var s=this.eventHandlerList[a];s.id==n&&s.targetId==i&&delete this.eventHandlerList[a]}this.invokeMethod(e,t,o,r)},e.prototype.agaveHostCallback=function(e,t){var n=this.callbackList[e];if(n){var i=n(t);void 0!==i&&!0!==i||delete this.callbackList[e]}},e.prototype.agaveHostEventCallback=function(e,t){var n=this.eventHandlerList[e];n&&n.handler(t)},e.prototype.postWebkitMessage=function(t,n,i,r,o){t.methodId=i,t.params=r;var a="";o&&(a=this.generateCorrelationId(),this.callbackList[a]=o,t.callbackId=a,t.callbackFunction=this.asyncMethodCallbackFunctionName);var s=function(){window.webkit.messageHandlers[n].postMessage(JSON.stringify(t))},c=e.getCurrentTimeMS();return null==this.lastMessageTimestamp||c-this.lastMessageTimestamp>=e.MESSAGE_TIME_DELTA?(s(),this.lastMessageTimestamp=c):(this.lastMessageTimestamp+=e.MESSAGE_TIME_DELTA,setTimeout((function(){s()}),this.lastMessageTimestamp-c)),a},e.prototype.generateCorrelationId=function(){return++this.callingIndex,this.conversationId+this.callingIndex},e.getCurrentTimeMS=function(){return(new Date).getTime()},e.MESSAGE_TIME_DELTA=10,e}()}(e.ScriptMessaging||(e.ScriptMessaging={}))}(OSFWebkit||(OSFWebkit={})),function(e){var t=function(){function t(e,t){this._initializationHelper=e,this._scriptMessager=t}return t.prototype.read=function(e){this._initializationHelper.getAppContext(null,(function(t){if(e){var n=t.get_settingsFunc()();e(0,n)}}),(function(t){e&&e(5001,{})}))},t.prototype.write=function(t,n){var i={},r=[],o=[];for(var a in t)r.push(a),o.push(t[a]);i.keys=r,i.values=o;this._scriptMessager.invokeMethod(e.WebView.MessageHandlerName,e.WebView.MethodId.WriteSettings,i,(function(e){n&&n(e[0])}))},t}();e.WebViewClientSettingsManager=t}(OSF||(OSF={})),function(e){!function(t){t.MessageHandlerName="Agave",t.PopupMessageHandlerName="WefPopupHandler",function(e){e[e.Settings=0]="Settings",e[e.SolutionReferenceId=1]="SolutionReferenceId",e[e.AppType=2]="AppType",e[e.MajorVersion=3]="MajorVersion",e[e.MinorVersion=4]="MinorVersion",e[e.RevisionVersion=5]="RevisionVersion",e[e.APIVersionSequence=6]="APIVersionSequence",e[e.AppCapabilities=7]="AppCapabilities",e[e.APPUILocale=8]="APPUILocale",e[e.AppDataLocale=9]="AppDataLocale",e[e.BindingCount=10]="BindingCount",e[e.DocumentUrl=11]="DocumentUrl",e[e.ActivationMode=12]="ActivationMode",e[e.ControlIntegrationLevel=13]="ControlIntegrationLevel",e[e.SolutionToken=14]="SolutionToken",e[e.APISetVersion=15]="APISetVersion",e[e.CorrelationId=16]="CorrelationId",e[e.InstanceId=17]="InstanceId",e[e.TouchEnabled=18]="TouchEnabled",e[e.CommerceAllowed=19]="CommerceAllowed",e[e.RequirementMatrix=20]="RequirementMatrix",e[e.OfficeThemeInfo=21]="OfficeThemeInfo"}(t.AppContextProperties||(t.AppContextProperties={})),function(e){e[e.Execute=1]="Execute",e[e.RegisterEvent=2]="RegisterEvent",e[e.UnregisterEvent=3]="UnregisterEvent",e[e.WriteSettings=4]="WriteSettings",e[e.GetContext=5]="GetContext",e[e.OnKeydown=6]="OnKeydown",e[e.AddinInitialized=7]="AddinInitialized",e[e.OpenWindow=8]="OpenWindow",e[e.MessageParent=9]="MessageParent",e[e.SendMessage=10]="SendMessage"}(t.MethodId||(t.MethodId={}));var n=function(){function t(e){this.hostScriptProxy=e}return t.prototype.execute=function(t,n,i){var r=n;null==r&&(r=[]);var o={id:t,apiArgs:r};this.hostScriptProxy.invokeMethod(e.WebView.MessageHandlerName,e.WebView.MethodId.Execute,o,(function(t){var n=t;if(e.OUtil.isArray(t)&&t.length>=2){t[0];n=t[1]}if(i)return i(new e.WebkitSafeArray(n))}))},t.prototype.registerEvent=function(t,n,i,r,o){this.hostScriptProxy.registerEvent(e.WebView.MessageHandlerName,e.WebView.MethodId.RegisterEvent,t,i,(function(t){var n=t,i=0;e.OUtil.isArray(t)&&t.length>=2&&(i=t[0],n=t[1]),r&&r(i,new e.WebkitSafeArray(n))}),(function(t){if(o)return o(new e.WebkitSafeArray(t))}))},t.prototype.unregisterEvent=function(t,n,i,r){this.hostScriptProxy.unregisterEvent(e.WebView.MessageHandlerName,e.WebView.MethodId.UnregisterEvent,t,i,(function(t){return r(new e.WebkitSafeArray(t))}))},t.prototype.messageParent=function(t){var n={dialogMessage:{messageType:0,messageContent:t[e.ParameterNames.MessageToParent]}};window.opener.postMessage(JSON.stringify(n),window.location.origin)},t.prototype.openDialog=function(n,i,r,o,a){var s=JSON.parse(r),c=s.url;if(c){var u=c.split("#"),l="?";c.indexOf("?")>-1&&(l="&");var d="width="+screen.width*s.width/100+", height="+screen.height*s.height/100;u[0]=u[0].concat(l).concat("action=displayDialog");var f,p=u.join("#");t.popup=window.open(p,"",d),window.addEventListener("message",(function(i){if(i.source==t.popup)try{var r=JSON.parse(i.data);r.dialogMessage&&o(n,[0,r.dialogMessage.messageContent])}catch(t){e.Utility.trace("messages received cannot be handled. Message:"+i.data)}})),f=window.setInterval((function(){try{(null==t.popup||t.popup.closed)&&(window.clearInterval(f),o(n,[12006]))}catch(t){e.Utility.trace("Error happened when popup window closed.")}}),1e3),a(0)}},t.prototype.closeDialog=function(e,n,i,r){t.popup?(t.popup.close(),t.popup=null,r(0)):r(5001)},t.prototype.sendMessage=function(t){var n=t[e.ParameterNames.MessageContent];!isNaN(parseFloat(n))&&isFinite(n)&&(n=n.toString()),this.hostScriptProxy.invokeMethod(e.WebView.MessageHandlerName,e.WebView.MethodId.SendMessage,n,null)},t.prototype.closeSdxDialog=function(t){throw e.Utility.createNotImplementedException()},t.prototype.resizeSdxDialog=function(t,n){throw e.Utility.createNotImplementedException()},t}();t.WebViewHostController=n}(e.WebView||(e.WebView={}))}(OSF||(OSF={})),function(e){var t=function(t){function n(e,n,i,r){var o=t.call(this,e,n,i,r)||this;return o._serializedSettings={},o.initializeWebViewMessaging(),o}return __extends(n,t),n.prototype.initializeWebViewMessaging=function(){e.ScriptMessaging=e.WebView.ScriptMessaging},n.prototype.getAppContext=function(t,n,i){var r,o=this;r=this._hostInfo.isDialog?e.WebView.PopupMessageHandlerName:e.WebView.MessageHandlerName,e.ScriptMessaging.GetScriptMessenger().invokeMethod(r,e.WebView.MethodId.GetContext,[],(function(t){var i,r=e.Webkit.AppContextProperties,a=t[r.AppType],s=t[r.Settings];if(s&&2===s.length)for(var c=s[0],u=s[1],l=0;l<c.length;l++)o._serializedSettings[c[l]]=u[l];var d=t[r.SolutionReferenceId],f=t[r.MajorVersion],p=t[r.MinorVersion],h=t[r.AppCapabilities],g=t[r.APPUILocale],m=t[r.AppDataLocale],v=t[r.DocumentUrl],y=t[r.ActivationMode],_=t[r.ControlIntegrationLevel],b=t[r.SolutionToken];b=b?b.toString():"";var O=t[r.CorrelationId],S=t[r.InstanceId],E=t[r.TouchEnabled],I=t[r.CommerceAllowed],C=t[r.RequirementMatrix],A=t[r.HostCustomMessage],P=t[r.HostFullVersion],w=t[r.InitialDisplayMode];i=new e.OfficeAppContext(d,a,f,g,m,v,h,(function(){return o._serializedSettings}),y,_,b,O,S,E,I,p,C,A,P,void 0,void 0,void 0,void 0,void 0,void 0,void 0,w,void 0,void 0,void 0,!1,void 0,void 0,void 0),n(i)}))},n.prototype.createClientHostController=function(){return this._clientHostController||(this._clientHostController=new e.WebView.WebViewHostController(e.ScriptMessaging.GetScriptMessenger())),this._clientHostController},n.prototype.createAsyncMethodExecutor=function(){return new e.SafeArrayAsyncMethodExecutor(this.createClientHostController())},n.prototype.createClientSettingsManager=function(){return new e.WebViewClientSettingsManager(this,e.ScriptMessaging.GetScriptMessenger())},n}(e.InitializationHelper);e.WebViewInitializationHelper=t}(OSF||(OSF={})),function(e){var t;!function(e){!function(e){e[e.MethodCallback=0]="MethodCallback",e[e.EventCallback=1]="EventCallback"}(e.CallbackType||(e.CallbackType={}));var t=function(e,t,n){this.callbackType=e,this.callbackId=t,this.params=n};e.CallbackData=t}(t||(t={})),function(n){var i=function(){function n(){}return n.getInstance=function(){return null==n.uniqueInstance&&(n.uniqueInstance=new n),n.uniqueInstance},n.prototype.postMessage=function(e,t){agaveHost.postMessage(t)},n.prototype.ReceiveMessage=function(n){switch(n.callbackType){case t.CallbackType.MethodCallback:e.WebView.ScriptMessaging.agaveHostCallback(n.callbackId,n.params);break;case t.CallbackType.EventCallback:e.WebView.ScriptMessaging.agaveHostEventCallback(n.callbackId,n.params)}},n}();n.Poster=i}(e.Android||(e.Android={})),function(n){var i=function(){function n(){window.addEventListener("message",this.OnReceiveMessage.bind(this))}return n.prototype.postMessage=function(e,t){window.parent.postMessage(t,"*")},n.prototype.OnReceiveMessage=function(n){if(n.source==window.parent&&window.parent==window.top&&n.origin.startsWith("ms-appx-web://")){var i;try{i=JSON.parse(n.data)}catch(e){return}switch(i.callbackType){case t.CallbackType.MethodCallback:e.WebView.ScriptMessaging.agaveHostCallback(i.callbackId,JSON.parse(i.params));break;case t.CallbackType.EventCallback:e.WebView.ScriptMessaging.agaveHostEventCallback(i.callbackId,JSON.parse(i.params))}}},n}();n.Poster=i}(e.WinRT||(e.WinRT={}))}(OSF||(OSF={})),function(e){!function(t){!function(t){var n=null;t.agaveHostCallback=function(e,t){n.agaveHostCallback(e,t)},t.agaveHostEventCallback=function(e,t){n.agaveHostEventCallback(e,t)},t.GetScriptMessenger=function(){if(null==n){var t=e._OfficeAppFactory.getHostInfo().hostPlatform;if(t===e.HostInfoPlatform.android)n=new r("OSF.ScriptMessaging.agaveHostCallback","OSF.ScriptMessaging.agaveHostEventCallback",e.Android.Poster.getInstance());else{if(t!==e.HostInfoPlatform.winrt)throw e.Utility.createNotImplementedException();n=new r("agaveHostCallback","agaveHostEventCallback",new e.WinRT.Poster)}}return n};var i=function(e,t,n){this.id=e,this.targetId=t,this.handler=n},r=function(){function e(t,n,i){this.callingIndex=0,this.callbackList={},this.eventHandlerList={},this.asyncMethodCallbackFunctionName=t,this.eventCallbackFunctionName=n,this.poster=i,this.conversationId=e.getCurrentTimeMS().toString()}return e.prototype.invokeMethod=function(e,t,n,i){this.postMessage({},e,t,n,i)},e.prototype.registerEvent=function(e,t,n,r,o,a){var s={eventCallbackFunction:this.eventCallbackFunctionName},c={id:n,targetId:r},u=this.postMessage(s,e,t,c,a);this.eventHandlerList[u]=new i(n,r,o)},e.prototype.unregisterEvent=function(e,t,n,i,r){var o={id:n,targetId:i};for(var a in this.eventHandlerList)if(this.eventHandlerList.hasOwnProperty(a)){var s=this.eventHandlerList[a];s.id==n&&s.targetId==i&&delete this.eventHandlerList[a]}this.invokeMethod(e,t,o,r)},e.prototype.agaveHostCallback=function(e,t){var n=this.callbackList[e];if(n){var i=n(t);void 0!==i&&!0!==i||delete this.callbackList[e]}},e.prototype.agaveHostEventCallback=function(e,t){var n=this.eventHandlerList[e];n&&n.handler(t)},e.prototype.postMessage=function(e,t,n,i,r){var o=this.generateCorrelationId();return this.callbackList[o]=r,e.methodId=n,e.params=i,e.callbackId=o,e.callbackFunction=this.asyncMethodCallbackFunctionName,this.poster.postMessage(t,JSON.stringify(e)),o},e.prototype.generateCorrelationId=function(){return++this.callingIndex,this.conversationId+this.callingIndex},e.getCurrentTimeMS=function(){return(new Date).getTime()},e.MESSAGE_TIME_DELTA=10,e}()}(t.ScriptMessaging||(t.ScriptMessaging={}))}(e.WebView||(e.WebView={}))}(OSF||(OSF={})),function(e){var t=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.messageParent=function(t){if(e.Utility.externalNativeFunctionExists(typeof window.external.MessageParent2))"undefined"!=typeof OsfOMToken&&OsfOMToken?window.external.MessageParent2(JSON.stringify(t),OsfOMToken):window.external.MessageParent2(JSON.stringify(t));else{var n=t[e.ParameterNames.MessageToParent];window.external.MessageParent(n)}},n.prototype.openDialog=function(e,t,n,i,r){this.registerEvent(e,t,n,i,r)},n.prototype.closeDialog=function(e,t,n,i){this.unregisterEvent(e,t,n,i)},n.prototype.sendMessage=function(t){if(e.Utility.externalNativeFunctionExists(typeof window.external.MessageChild2))"undefined"!=typeof OsfOMToken&&OsfOMToken?window.external.MessageChild2(JSON.stringify(t),OsfOMToken):window.external.MessageChild2(JSON.stringify(t));else{var n=t[e.ParameterNames.MessageContent];window.external.MessageChild(n)}},n.prototype.closeSdxDialog=function(t){e.Utility.externalNativeFunctionExists(typeof window.external.closeSdxDialog)&&window.external.closeSdxDialog(t)},n.prototype.resizeSdxDialog=function(t,n){e.Utility.externalNativeFunctionExists(typeof window.external.resizeSdxDialog)&&window.external.resizeSdxDialog(t,n)},n}(e.RichClientHostController);e.Win32RichClientHostController=t}(OSF||(OSF={})),function(e){var t=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.prototype.openDialog=function(t,i,r,o,a){if(!n.popup||n.popup.closed){window.dialogAPIErrorCode=void 0;var s=JSON.parse(r),c=s.url;if(c){var u=c.split("#"),l="?";u[0].indexOf("?")>-1&&(l="&");var d="width="+screen.width*s.width/100+", height="+screen.height*s.height/100;u[0]=u[0].concat(l).concat("action=displayDialog");var f=u.join("#");if(n.popup=window.open(f,"",d),n.DialogEventListener=function(i){if(i.source==n.popup)try{var r=JSON.parse(i.data);r.dialogMessage&&o(t,[0,r.dialogMessage.messageContent])}catch(t){e.Utility.trace("messages received cannot be handlered. Message:"+i.data)}},null!=n.popup&&null==window.dialogAPIErrorCode)window.addEventListener("message",n.DialogEventListener),n.interval=window.setInterval((function(){try{(null==n.popup||n.popup.closed)&&(window.clearInterval(n.interval),window.removeEventListener("message",n.DialogEventListener),n.NotifyError=null,o(t,[12006]))}catch(t){e.Utility.trace("Error happened when popup window closed.")}}),500),n.NotifyError=function(e){o(t,[e])},a(0);else{var p=5001;window.dialogAPIErrorCode&&(p=window.dialogAPIErrorCode),a(p)}}else a(12003)}else a(12007)},n.prototype.messageParent=function(t){var n={dialogMessage:{messageType:0,messageContent:t[e.ParameterNames.MessageToParent]}};window.opener.postMessage(JSON.stringify(n),window.location.origin)},n.prototype.closeDialog=function(e,t,i,r){n.popup?(n.interval&&window.clearInterval(n.interval),n.popup.close(),n.popup=null,window.removeEventListener("message",n.DialogEventListener),n.NotifyError=null,r(0)):r(5001)},n}(e.Webkit.WebkitHostController);e.MacRichClientHostController=t}(OSF||(OSF={})),function(e){var t;!function(e){!function(e){e.Init=function(){return function(){"use strict";function e(e){return"function"==typeof e}var t,n=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=0,r=function(e,n){f[i]=e,f[i+1]=n,2===(i+=2)&&(t?t(p):c())};var o=("undefined"!=typeof window?window:void 0)||{},a=(o.MutationObserver||o.WebKitMutationObserver,"undefined"!=typeof process&&"[object process]"==={}.toString.call(process)),s="undefined"!=typeof Uint8ClampedArray&&"undefined"!=typeof importScripts&&"undefined"!=typeof MessageChannel;var c,u,l,d,f=new Array(1e3);function p(){for(var e=0;e<i;e+=2){(0,f[e])(f[e+1]),f[e]=void 0,f[e+1]=void 0}i=0}function h(){}a?(l=process.nextTick,d=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/),Array.isArray(d)&&"0"===d[1]&&"10"===d[2]&&(l=setImmediate),c=function(){l(p)}):s?((u=new MessageChannel).port1.onmessage=p,c=function(){u.port2.postMessage(0)}):c=function(){setTimeout(p,1)};var g=void 0,m=new I;function v(t,n){if(n.constructor===t.constructor)!function(e,t){1===t._state?b(e,t._result):2===t._state?O(e,t._result):S(t,void 0,(function(t){y(e,t)}),(function(t){O(e,t)}))}(t,n);else{var i=function(e){try{return e.then}catch(e){return m.error=e,m}}(n);i===m?O(t,m.error):void 0===i?b(t,n):e(i)?function(e,t,n){r((function(e){var i=!1,r=function(e,t,n,i){try{e.call(t,n,i)}catch(e){return e}}(n,t,(function(n){i||(i=!0,t!==n?y(e,n):b(e,n))}),(function(t){i||(i=!0,O(e,t))}),e._label);!i&&r&&(i=!0,O(e,r))}),e)}(t,n,i):b(t,n)}}function y(e,t){var n;e===t?O(e,new TypeError("You cannot resolve a promise with itself")):"function"==typeof(n=t)||"object"==typeof n&&null!==n?v(e,t):b(e,t)}function _(e){e._onerror&&e._onerror(e._result),E(e)}function b(e,t){e._state===g&&(e._result=t,e._state=1,0!==e._subscribers.length&&r(E,e))}function O(e,t){e._state===g&&(e._state=2,e._result=t,r(_,e))}function S(e,t,n,i){var o=e._subscribers,a=o.length;e._onerror=null,o[a]=t,o[a+1]=n,o[a+2]=i,0===a&&e._state&&r(E,e)}function E(e){var t=e._subscribers,n=e._state;if(0!==t.length){for(var i,r,o=e._result,a=0;a<t.length;a+=3)i=t[a],r=t[a+n],i?A(n,i,r,o):r(o);e._subscribers.length=0}}function I(){this.error=null}var C=new I;function A(t,n,i,r){var o,a,s,c,u=e(i);if(u){if((o=function(e,t){try{return e(t)}catch(e){return C.error=e,C}}(i,r))===C?(c=!0,a=o.error,o=null):s=!0,n===o)return void O(n,new TypeError("A promises callback cannot return that same promise."))}else o=r,s=!0;n._state!==g||(u&&s?y(n,o):c?O(n,a):1===t?b(n,o):2===t&&O(n,o))}function P(e,t){var n=this;n._instanceConstructor=e,n.promise=new e(h),n._validateInput(t)?(n._input=t,n.length=t.length,n._remaining=t.length,n._init(),0===n.length?b(n.promise,n._result):(n.length=n.length||0,n._enumerate(),0===n._remaining&&b(n.promise,n._result))):O(n.promise,n._validationError())}P.prototype._validateInput=function(e){return n(e)},P.prototype._validationError=function(){return new Error("Array Methods must be provided an Array")},P.prototype._init=function(){this._result=new Array(this.length)};var w=P;P.prototype._enumerate=function(){for(var e=this,t=e.length,n=e.promise,i=e._input,r=0;n._state===g&&r<t;r++)e._eachEntry(i[r],r)},P.prototype._eachEntry=function(e,t){var n,i=this,r=i._instanceConstructor;"object"==typeof(n=e)&&null!==n?e.constructor===r&&e._state!==g?(e._onerror=null,i._settledAt(e._state,t,e._result)):i._willSettleAt(r.resolve(e),t):(i._remaining--,i._result[t]=e)},P.prototype._settledAt=function(e,t,n){var i=this,r=i.promise;r._state===g&&(i._remaining--,2===e?O(r,n):i._result[t]=n),0===i._remaining&&b(r,i._result)},P.prototype._willSettleAt=function(e,t){var n=this;S(e,void 0,(function(e){n._settledAt(1,t,e)}),(function(e){n._settledAt(2,t,e)}))};var x=function(e){return new w(this,e).promise};var F=function(e){var t=new this(h);if(!n(e))return O(t,new TypeError("You must pass an array to race.")),t;var i=e.length;function r(e){y(t,e)}function o(e){O(t,e)}for(var a=0;t._state===g&&a<i;a++)S(this.resolve(e[a]),void 0,r,o);return t};var R=function(e){if(e&&"object"==typeof e&&e.constructor===this)return e;var t=new this(h);return y(t,e),t};var N=function(e){var t=new this(h);return O(t,e),t},T=0;var M=j;function j(t){this._id=T++,this._state=void 0,this._result=void 0,this._subscribers=[],h!==t&&(e(t)||function(){throw new TypeError("You must pass a resolver function as the first argument to the promise constructor")}(),this instanceof j||function(){throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.")}(),function(e,t){try{t((function(t){y(e,t)}),(function(t){O(e,t)}))}catch(t){O(e,t)}}(this,t))}return j.all=x,j.race=F,j.resolve=R,j.reject=N,j._setScheduler=function(e){t=e},j._setAsap=function(e){r=e},j._asap=r,j.prototype={constructor:j,then:function(e,t){var n=this,i=n._state;if(1===i&&!e||2===i&&!t)return this;var o=new this.constructor(h),a=n._result;if(i){var s=arguments[i-1];r((function(){A(i,o,s,a)}))}else S(n,o,e,t);return o},catch:function(e){return this.then(null,e)}},M}.call(this)}}(e.PromiseImpl||(e.PromiseImpl={}))}(e._Internal||(e._Internal={})),function(e){e.OfficePromise=function(){if("undefined"==typeof window&&"function"==typeof Promise)return Promise;if("undefined"!=typeof window){if(window.Promise)return window.Promise;var t=e.PromiseImpl.Init();return window.Promise=t,t}}()}(t=e._Internal||(e._Internal={})),e.OfficePromise=t.OfficePromise,e.Promise=e.OfficePromise}(Office||(Office={})),function(e){e.getFields=function(e,t){var n=[];return void 0!==t.id&&n.push(oteljs.makeStringDataField(e+".Id",t.id)),void 0!==t.version&&n.push(oteljs.makeStringDataField(e+".Version",t.version)),void 0!==t.instanceId&&n.push(oteljs.makeStringDataField(e+".InstanceId",t.instanceId)),void 0!==t.name&&n.push(oteljs.makeStringDataField(e+".Name",t.name)),void 0!==t.marketplaceType&&n.push(oteljs.makeStringDataField(e+".MarketplaceType",t.marketplaceType)),void 0!==t.sessionId&&n.push(oteljs.makeStringDataField(e+".SessionId",t.sessionId)),void 0!==t.browserToken&&n.push(oteljs.makeStringDataField(e+".BrowserToken",t.browserToken)),void 0!==t.osfRuntimeVersion&&n.push(oteljs.makeStringDataField(e+".OsfRuntimeVersion",t.osfRuntimeVersion)),void 0!==t.officeJsVersion&&n.push(oteljs.makeStringDataField(e+".OfficeJsVersion",t.officeJsVersion)),void 0!==t.hostJsVersion&&n.push(oteljs.makeStringDataField(e+".HostJsVersion",t.hostJsVersion)),void 0!==t.assetId&&n.push(oteljs.makeStringDataField(e+".AssetId",t.assetId)),void 0!==t.providerName&&n.push(oteljs.makeStringDataField(e+".ProviderName",t.providerName)),void 0!==t.type&&n.push(oteljs.makeStringDataField(e+".Type",t.type)),void 0!==t.officeJSSource&&n.push(oteljs.makeInt64DataField(e+".OfficeJSSource",t.officeJSSource)),void 0!==t.isSecureDefaultsEnabled&&n.push(oteljs.makeBooleanDataField(e+".IsSecureDefaultsEnabled",t.isSecureDefaultsEnabled)),n}}(SDX||(SDX={})),function(e){!function(t){var n,i=e.OUtil.Guid.generateNewGuid(),r=new RegExp("^https?://store\\.office(ppe|-int)?\\.com/","i"),o=!1,a="PRIVATE";t.enableTelemetry=!0;var s=function(){};t.AppInfo=s;var c=function(){function t(){this.clientIDKey="Office API client",this.logIdSetKey="Office App Log Id Set"}return t.prototype.getClientId=function(){var t=this.getValue(this.clientIDKey);return(!t||t.length<=0||t.length>40)&&(t=e.OUtil.Guid.generateNewGuid(),this.setValue(this.clientIDKey,t)),t},t.prototype.getValue=function(t){var n=e.OUtil.getLocalStorage(),i="";return n&&(i=n.getItem(t)),i},t.prototype.setValue=function(t,n){var i=e.OUtil.getLocalStorage();i&&i.setItem(t,n)},t}();function u(e){return e&&(e=e.replace(/[{}]/g,"").toLowerCase()),e||""}function l(e){try{return JSON.parse(e)}catch(t){return e}}function d(){n&&(o||OTel.OTelLogger.onTelemetryLoaded((function(){var t=[],i=n.isMos?1:0;t=t.concat([oteljs.makeStringDataField("Browser",n.browser),oteljs.makeInt64DataField("AppSizeWidth",window.innerWidth),oteljs.makeInt64DataField("AppSizeHeight",window.innerHeight),oteljs.makeInt64DataField("IsMOS",i)]),e.OUtil.isChangeGateEnabled("Microsoft.Office.SharedOnline.ChangeGate.OfficeVSO_10045620_CopilotAgentTelSettings")&&n.launchSource&&n.launchReason&&(t.push(oteljs.makeStringDataField("LaunchSource",n.launchSource)),t.push(oteljs.makeStringDataField("LaunchReason",n.launchReason))),Microsoft.Office.WebExtension.sendTelemetryEvent({eventName:"Office.Extensibility.OfficeJs.AppActivatedX",dataFields:t,eventFlags:{dataCategories:2,diagnosticLevel:110,samplingPolicy:191}})})))}function f(e,t){}function p(){var t=0!=(e._OfficeAppFactory.getHostInfo().flags&e.HostInfoFlags.PublicAddin);return t||!!n&&g(e._OfficeAppFactory.getHostInfo().hostPlatform,n.hostVersion)}function h(e,t){return p()||t!==e?t:a}function g(t,n){var i=!1,r=/^(\d+)\.(\d+)\.(\d+)\.(\d+)$/.exec(n);if(r){var o=parseInt(r[1]),a=parseInt(r[2]),s=parseInt(r[3]);t==e.HostInfoPlatform.win32?(o<16||16==o&&s<14225)&&(i=!0):t==e.HostInfoPlatform.mac&&(o<16||16==o&&(a<52||52==a&&s<808))&&(i=!0)}return i}function m(){return 0!=(e._OfficeAppFactory.getHostInfo().flags&e.HostInfoFlags.IsMos)}t.initialize=function(d){if(t.enableTelemetry&&!n){n=new s,d.get_hostFullVersion()?n.hostVersion=d.get_hostFullVersion():n.hostVersion=d.get_appVersion(),n.appId=p()?d.get_id():a,n.marketplaceType=d._marketplaceType,n.host=""+d.get_appName(),n.browser=window.navigator.userAgent,n.correlationId=u(d.get_correlationId()),n.clientId=(new c).getClientId(),n.appInstanceId=d.get_appInstanceId(),n.appInstanceId&&(n.appInstanceId=u(n.appInstanceId),n.appInstanceId=h(d.get_id(),n.appInstanceId)),n.message=d.get_hostCustomMessage(),n.officeJSVersion=e.ConstantNames.FileVersion,n.hostJSVersion="NA",d._wacHostEnvironment&&(n.wacHostEnvironment=d._wacHostEnvironment);var f=d.get_isFromWacAutomation();null!=f&&(n.isFromWacAutomation=f.toString().toLowerCase()),n.officeJSSource=e.OUtil.getLibraryReleaseVehicle(),n.isSecureDefaultsEnabled="undefined"!=typeof isOsfSecurityDefaultsEnabled&&!0===isOsfSecurityDefaultsEnabled;var g=d.get_docUrl();n.docUrl=r.test(g)?g:"";var v=location.href;if(v&&(n.isPreload=-1!==v.indexOf("preload=1"),v=v.split("?")[0].split("#")[0]),n.isMos=m(),e.OUtil.isChangeGateEnabled("Microsoft.Office.SharedOnline.ChangeGate.OfficeVSO_10045620_CopilotAgentTelSettings")){var y=d.get_settingsFunc()();y&&y.LaunchSource&&y.LaunchReason&&(n.launchSource=l(y.LaunchSource),n.launchReason=l(y.LaunchReason))}!function(t,n){n.assetId="",n.userId="";try{if(!e.Utility.isNullOrEmpty(t)){var i=decodeURIComponent(t),r=new DOMParser,o=void 0,a=e.LoadScriptHelper.getTrustedTypesOptIn();if((null!=a?a:e.OUtil.isSecureDefaultsEnabled())&&window.trustedTypes&&window.trustedTypes.createPolicy)o=window.trustedTypes.createPolicy("officejs-domparser",{createHTML:function(e){return e}}).createHTML(i);else o=i;var s=r.parseFromString(o,"text/xml"),c=s.getElementsByTagName("t")[0].attributes.getNamedItem("cid"),u=s.getElementsByTagName("t")[0].attributes.getNamedItem("oid");c&&c.nodeValue?n.userId=c.nodeValue:u&&u.nodeValue&&(n.userId=u.nodeValue),n.assetId=s.getElementsByTagName("t")[0].attributes.getNamedItem("aid").nodeValue}}catch(e){}}(d.get_eToken(),n),n.sessionId=i,OTel.OTelLogger.initialize(n),n.isPreload?(o=!0,function(){try{Microsoft.Office.WebExtension.onReadyInternal().then((function(){var t=Office,n=OfficeCore;t.addin&&t.addin.onVisibilityModeChanged&&t.addin.onVisibilityModeChanged((function(n){n.visibilityMode===t.VisibilityMode.taskpane&&e.AppTelemetry.CallOnAppActivatedIfPending()})),t.addin&&t.addin._getState&&t.addin._getState().then((function(t){n.AppRuntimeState&&t===n.AppRuntimeState.visible&&e.AppTelemetry.CallOnAppActivatedIfPending()}))}))}catch(t){e.AppTelemetry&&e.AppTelemetry.logAppException("Exception happens at registerVisibilityEventOnPreload"+t)}}()):t.onAppActivated()}},t.onAppActivated=d,t.onScriptDone=function(e,t,n,i){},t.onCallDone=function(e,t,n,i,r){},t.onMethodDone=function(e,t,n,i){},t.onPropertyDone=function(t,n){e.AppTelemetry.onCallDone("property",-1,t,n,0)},t.onCheckWACHost=function(e,t,n,i,r){},t.onEventDone=function(t,n){e.AppTelemetry.onCallDone("event",t,null,0,n)},t.onRegisterDone=function(t,n,i,r){e.AppTelemetry.onCallDone(t?"registerevent":"unregisterevent",n,null,i,r)},t.onAppClosed=function(e,t){},t.setOsfControlAppCorrelationId=function(e){u(e)},t.doAppInitializationLogging=f,t.logAppCommonMessage=function(e){},t.logAppException=function(e){},t.CallOnAppActivatedIfPending=function(){o&&(o=!1,d())},t.canSendAddinId=p,t.getCompliantAppInstanceId=h,t._isComplianceExceptedHost=g,t.isMos=m}(e.AppTelemetry||(e.AppTelemetry={}))}(OSF||(OSF={})),function(e){var t=function(){function t(){}return t.loaded=function(){return!(void 0===t.logger)},t.ensureValue=function(e,t){return e||t},t.create=function(n){var i,r={id:n.appId,marketplaceType:n.marketplaceType,assetId:n.assetId,officeJsVersion:n.officeJSVersion,hostJsVersion:n.hostJSVersion,browserToken:n.clientId,instanceId:n.appInstanceId,sessionId:n.sessionId,officeJSSource:n.officeJSSource,isSecureDefaultsEnabled:n.isSecureDefaultsEnabled},o=SDX.getFields("SDX",r),a=OSF._OfficeAppFactory.getHostInfo().hostPlatform;if("web"===a)i=new e.SdxWacSink;else if(Office.context.requirements.isSetSupported("Telemetry","1.2"))i=new e.RichApiSink,this.richApiSink=i;else{if(!oteljs.AgaveSink)return console.error("Cannot create telemetry sink successfully"),null;var s={"App.Name":OSF._OfficeAppFactory.getHostInfo().hostType,"App.Platform":a,"App.Version":n.hostVersion,"Session.Id":t.ensureValue(n.correlationId,"00000000-0000-0000-0000-000000000000")};i=oteljs.AgaveSink.createInstance(s)}var c=new oteljs.SimpleTelemetryLogger(void 0,o);return c.addSink(i),c.setTenantToken("Office.Extensibility.OfficeJs","db334b301e7b474db5e0f02f07c51a47-a1b5bc36-1bbe-482f-a64a-c2d9cb606706-7439",1755),oteljs.onNotification().addListener((function(e){OSF.Utility.debugLog(e.message())})),c},t.checkAndResolvePromises=function(){t.loaded()&&(t.promises.forEach((function(e){e()})),t.promises=[])},t.initialize=function(e){t.Enabled?Office.onReadyInternal().then((function(){t.loaded()||(OSF.Utility.debugLog("Creating OTelLogger"),t.logger=t.create(e),t.checkAndResolvePromises())})):t.promises=[]},t.sendTelemetryEvent=function(e){t.onTelemetryLoaded((function(){try{t.logger.sendTelemetryEvent(e)}catch(e){console.error("Cannot send telemetry event: "+JSON.stringify(e))}}))},t.sendNonStandardEvent=function(e,n){t.onTelemetryLoaded((function(){try{t.logger.sendNonStandardEvent(e,n)}catch(e){console.error("Cannot send telemetry event: "+JSON.stringify(e))}}))},t.flushTelemetryQueue=function(){var e=this;return new Office.Promise((function(n){t.onTelemetryLoaded((function(){e.richApiSink?e.richApiSink.flushTelemetryQueue().then((function(){n()})):n()}))}))},t.onTelemetryLoaded=function(e){t.Enabled&&(t.loaded()?e():t.promises.push(e))},t.promises=[],t.Enabled=!0,t}();e.OTelLogger=t}(OTel||(OTel={})),function(e){var t=function(){function e(){var e=this;this._requestIsPending=!0,this._telemetryQueue=[],this.pause(1e3).then((function(){var t=e._telemetryQueue;e._telemetryQueue=[],e._requestIsPending=!1,e.processTelemetryEvents(t)}))}return e.prototype.sendTelemetryEvent=function(e){this._telemetryQueue.push([e,1]),this._requestIsPending||this.processWorkBacklog()},e.prototype.sendNonStandardEvent=function(e,t){this._telemetryQueue.push([e,t]),this._requestIsPending||this.processWorkBacklog()},e.prototype.flushTelemetryQueue=function(){var e=this;return new Office.Promise((function(t){var n=e._telemetryQueue;e._telemetryQueue=[],e.processTelemetryEvents(n).then((function(){t()}))}))},e.prototype.processWorkBacklog=function(){var e=this;this._requestIsPending=!0;var t=this._telemetryQueue;this._telemetryQueue=[],this.processTelemetryEvents(t).then(this.waitAndProcessMore.bind(this)).catch((function(t){oteljs.logError(1,"RichApiSink Error",t),e.waitAndProcessMore.bind(e)()}))},e.prototype.waitAndProcessMore=function(){var e=this;this.pause(1e3).then((function(){e._telemetryQueue.length>0&&setTimeout((function(){return e.processWorkBacklog()}),0),e._requestIsPending=!1})).catch((function(){}))},e.prototype.processTelemetryEvents=function(e){var t=this,n=new OfficeCore.RequestContext;return e.forEach((function(e){var i=e[0],r=e[1];if(i.telemetryProperties){var o=[];t.addDataFields(o,i.dataFields);var a=i.eventContract?i.eventContract.name:"";i.eventContract&&t.addDataFields(o,i.eventContract.dataFields),1===r?n.telemetry.sendTelemetryEvent(i.telemetryProperties,i.eventName,a,oteljs.getEffectiveEventFlags(i),o):n.telemetry.sendNonStandardEvent(i.telemetryProperties,i.eventName,a,oteljs.getEffectiveEventFlags(i),o,r)}})),n.sync().catch((function(){oteljs.logNotification(2,1,(function(){return"RichApi telemetry call failed."}))}))},e.prototype.addDataFields=function(e,t){t&&t.forEach((function(t){e.push({name:t.name,value:t.value,classification:t.classification?t.classification:4,type:t.dataType})}))},e.prototype.pause=function(e){return new Office.Promise((function(t){return setTimeout(t,e)}))},e}();e.RichApiSink=t}(OTel||(OTel={})),function(e){var t=function(){function e(){}return e.prototype.sendTelemetryEvent=function(e,t){try{if(e.dataFields&&e.dataFields.filter((function(e){var t=e.classification;return t&&4!==t&&1!==t})).length>0)return;var n=OSF._OfficeAppFactory.getId(),i=OSF.AgaveHostAction.SendTelemetryEvent;OSF.getClientEndPoint().invoke("ContextActivationManager_notifyHost",null,[n,i,e])}catch(e){oteljs.logError(1,"AgaveWacSink",e)}},e.prototype.sendNonStandardEvent=function(e,t){try{if(1===t)throw new Error("Please call sendTelemetryEvent for events of type "+t);if(e.dataFields&&e.dataFields.filter((function(e){var t=e.classification;return t&&4!==t&&1!==t&&32!==t&&2048!==t})).length>0)return;var n=OSF._OfficeAppFactory.getId(),i=OSF.AgaveHostAction.SendNonStandardEvent;OSF.getClientEndPoint().invoke("ContextActivationManager_notifyHost",null,[n,i,e])}catch(e){oteljs.logError(1,"AgaveWacSink",e)}},e}();e.SdxWacSink=t}(OTel||(OTel={})),function(e){var t,n=[];function i(e,t,n){OTel.OTelLogger.onTelemetryLoaded((function(){Microsoft.Office.WebExtension.sendTelemetryEvent({eventName:"Office.Extensibility.OfficeJs.AddinSpecialPermissionRequest",dataFields:[oteljs.makeStringDataField("invocationId",e),oteljs.makeStringDataField("methodPath",t),oteljs.makeStringDataField("params",n)],eventFlags:{dataCategories:2,diagnosticLevel:110}})}))}function r(e,t,n){OTel.OTelLogger.onTelemetryLoaded((function(){Microsoft.Office.WebExtension.sendTelemetryEvent({eventName:"Office.Extensibility.OfficeJs.AddinSpecialPermissionResponse",dataFields:[oteljs.makeStringDataField("invocationId",e),oteljs.makeBooleanDataField("isSuccessful",t),oteljs.makeStringDataField("error",n?JSON.stringify({name:n.name,code:n.code,message:n.message}):void 0)],eventFlags:{dataCategories:2,diagnosticLevel:110}})}))}try{for(var o=0,a=function(e){var t=Navigator.prototype[e];t&&(Navigator.prototype[e]=function(n,a,s){if(3===arguments.length&&Function.prototype.isPrototypeOf(a)&&Function.prototype.isPrototypeOf(s)){var c=(o++).toString();return i(c,"Navigator.prototype."+e,JSON.stringify([{audio:!!n.audio,video:!!n.video}])),t.apply(this,[n,function(){return r(c,!0),a.apply(this,arguments)},function(){return r(c,!1,arguments[0]),s.apply(this,arguments)}])}return t.apply(this,arguments)},n.push("Navigator.prototype."+e))},s=0,c=["getUserMedia","webkitGetUserMedia","mozGetUserMedia"];s<c.length;s++){a(c[s])}var u=MediaDevices.prototype.getUserMedia;u&&(MediaDevices.prototype.getUserMedia=function(e){var t=(o++).toString();return 1===arguments.length&&void 0!==e?(i(t,"MediaDevices.prototype.getUserMedia",JSON.stringify([{audio:!!e.audio,video:!!e.video}])),u.apply(this,arguments).then((function(){return r(t,!0),arguments[0]}),(function(){throw r(t,!1,arguments[0]),arguments[0]}))):u.apply(this,arguments)},n.push("MediaDevices.prototype.getUserMedia"));for(var l=function(e){var t=Geolocation.prototype[e];t&&(Geolocation.prototype[e]=function(n,a,s){for(var c=[],u=3;u<arguments.length;u++)c[u-3]=arguments[u];var l=(o++).toString(),d=!1;i(l,"Geolocation.prototype."+e,JSON.stringify([]));var f=Function.prototype.isPrototypeOf(n)?function(){return d||(r(l,!0),d=!0),n.apply(this,arguments)}:n,p=Function.prototype.isPrototypeOf(a)?function(){return d||(r(l,!1,arguments[0]),d=!0),a.apply(this,arguments)}:a;return t.apply(this,[f,p,s].concat(c))},n.push("Geolocation.prototype."+e))},d=0,f=["getCurrentPosition","watchPosition"];d<f.length;d++){l(f[d])}}catch(e){t=e.toString()}OTel.OTelLogger.onTelemetryLoaded((function(){Microsoft.Office.WebExtension.sendTelemetryEvent({eventName:"Office.Extensibility.OfficeJs.AddinSpecialPermissionHookInstall",dataFields:[oteljs.makeStringDataField("hooksInstalled",JSON.stringify(n)),oteljs.makeStringDataField("error",t)],eventFlags:{dataCategories:2,diagnosticLevel:110}})}))}(Office||(Office={})),function(e){!function(e){!function(e){e.FeatureGates={},e.EventType=OSF.EventType,e.sendTelemetryEvent=function(e){OTel.OTelLogger.sendTelemetryEvent(e)},e.sendNonStandardEvent=function(e,t){OTel.OTelLogger.sendNonStandardEvent(e,t)},e.flushTelemetryQueue=function(){return OTel.OTelLogger.flushTelemetryQueue()},e.telemetrySink=OTel.OTelLogger}(e.WebExtension||(e.WebExtension={}))}(e.Office||(e.Office={}))}(Microsoft||(Microsoft={})),function(e){e.sendTelemetryEvent=function(e){Microsoft.Office.WebExtension.sendTelemetryEvent(e)},e.sendNonStandardEvent=function(e,t){Microsoft.Office.WebExtension.sendNonStandardEvent(e,t)},e.flushTelemetryQueue=function(){return Microsoft.Office.WebExtension.flushTelemetryQueue()},e.telemetrySink=Microsoft.Office.WebExtension.telemetrySink,e.isTrustedHost=function(){return __awaiter(this,void 0,void 0,(function(){var t,n,i,r,o;return __generator(this,(function(a){switch(a.label){case 0:return a.trys.push([0,10,,11]),OSF._OfficeAppFactory.getHostInfo().hostPlatform===OSF.HostInfoPlatform.web?[3,2]:[4,e.onReady()];case 1:return a.sent(),[2,!0];case 2:return null!=(t=OSF._OfficeAppFactory.getWebAppState().clientEndPoint)&&t.fHostTrusted?[2,!0]:null==document.referrer?[3,6]:(n=OSF.OUtil.parseUrl(document.referrer,!1),i="https:"==n.protocol,r=!1,OSF.OUtil.isChangeGateEnabled("Microsoft.Office.SharedOnline.ChangeGate.OfficeVSO_10910853_OfficeJsNPMDownloadTrustedDomainList")?[4,OSF.XdmCommunicationManager.isHostNameValidWacDomainAsync(n.hostname,null)]:[3,4]);case 3:return r=a.sent(),[3,5];case 4:r=OSF.XdmCommunicationManager.isHostNameValidWacDomain(n.hostname),a.label=5;case 5:if(i&&r&&!new RegExp("^"+document.domain.replace(new RegExp("\\.","g"),"\\.")+"$").test(n.hostname))return[2,!0];a.label=6;case 6:return null==t?[3,8]:[4,OSF.Utility.promisify((function(e){t.invoke("ContextActivationManager_getAppContextAsync",e,OSF._OfficeAppFactory.getWebAppState().id)}),1e4)];case 7:return a.sent(),[2,!0];case 8:return[2,!1];case 9:return[3,11];case 10:return o=a.sent(),OSF.AppTelemetry&&OSF.AppTelemetry.logAppException("Exception happens at Office.isTrustedHost."+o),[2,!1];case 11:return[2]}}))}))},Microsoft.Office.WebExtension.onReadyInternal=e.onReadyInternal}(Office||(Office={}));var OfficeExtension;__extends=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();!function(e){var t;!function(e){e.graph="graph",e.wfe="wfe"}(t=e.RemoteEndpointType||(e.RemoteEndpointType={}));var n=function(){function e(){}return e.prototype._resolveRequestUrlAndHeaderInfo=function(){return l._createPromiseFromResult(null)},e.prototype._createRequestExecutorOrNull=function(){return null},e.prototype.getEventRegistration=function(e){return null},e}();e.SessionBase=n;var i=function(){function e(){}return e.setCustomSendRequestFunc=function(t){e.s_customSendRequestFunc=t},e.xhrSendRequestFunc=function(e){return l.createPromise((function(t,n){var i=new XMLHttpRequest;if(i.open(e.method,e.url),i.onload=function(){var e={statusCode:i.status,headers:l._parseHttpResponseHeaders(i.getAllResponseHeaders()),body:i.responseText};t(e)},i.onerror=function(){n(new r.RuntimeError({code:a.connectionFailure,httpStatusCode:i.status,message:l._getResourceString(s.connectionFailureWithStatus,i.statusText)}))},e.headers)for(var o in e.headers)i.setRequestHeader(o,e.headers[o]);i.send(l._getRequestBodyText(e))}))},e.fetchSendRequestFunc=function(e){var t=l._getRequestBodyText(e);return""===t&&(t=void 0),fetch(e.url,{method:e.method,headers:e.headers,body:t}).then((function(e){return e.text().then((function(t){var n=e.status,i={};return e.headers.forEach((function(e,t){i[t]=e})),{statusCode:n,headers:i,body:t}}))}))},e.sendRequest=function(t){e.validateAndNormalizeRequest(t);var n=e.s_customSendRequestFunc;return n||(n="undefined"!=typeof fetch?e.fetchSendRequestFunc:e.xhrSendRequestFunc),n(t)},e.setCustomSendLocalDocumentRequestFunc=function(t){e.s_customSendLocalDocumentRequestFunc=t},e.sendLocalDocumentRequest=function(t){return e.validateAndNormalizeRequest(t),(e.s_customSendLocalDocumentRequestFunc||e.officeJsSendLocalDocumentRequestFunc)(t)},e.officeJsSendLocalDocumentRequestFunc=function(e){e=l._validateLocalDocumentRequest(e);var t=l._buildRequestMessageSafeArray(e);return l.createPromise((function(e,n){OSF.DDA.RichApi.executeRichApiRequestAsync(t,(function(t){var n;n="succeeded"==t.status?{statusCode:u.getResponseStatusCode(t),headers:u.getResponseHeaders(t),body:u.getResponseBody(t)}:u.buildHttpResponseFromOfficeJsError(t.error.code,t.error.message),l.log("Response:"),l.log(JSON.stringify(n)),e(n)}))}))},e.validateAndNormalizeRequest=function(e){if(l.isNullOrUndefined(e))throw r.RuntimeError._createInvalidArgError({argumentName:"request"});l.isNullOrEmptyString(e.method)&&(e.method="GET"),e.method=e.method.toUpperCase();var t=!1;if("object"==typeof e.headers&&e.headers[c.testRequestNameHeader]&&(t=!0),!t){var n=d._getCurrentTestNameWithSequenceId();n&&(e.headers||(e.headers={}),e.headers[c.testRequestNameHeader]=n)}},e.logRequest=function(t){if(l._logEnabled){if(l.log("---HTTP Request---"),l.log(t.method+" "+t.url),t.headers)for(var n in t.headers)l.log(n+": "+t.headers[n]);e._logBodyEnabled&&l.log(l._getRequestBodyText(t))}},e.logResponse=function(t){if(l._logEnabled){if(l.log("---HTTP Response---"),l.log(""+t.statusCode),t.headers)for(var n in t.headers)l.log(n+": "+t.headers[n]);e._logBodyEnabled&&l.log(t.body)}},e._logBodyEnabled=!1,e}();e.HttpUtility=i;var r,o=function(){function e(e){var t=this;this.m_bridge=e,this.m_promiseResolver={},this.m_handlers=[],this.m_bridge.onMessageFromHost=function(e){var n=JSON.parse(e);if(3==n.type){var i=n.message;if(i&&i.entries)for(var r=0;r<i.entries.length;r++){var o=i.entries[r];if(Array.isArray(o)){var a={messageCategory:o[0],messageType:o[1],targetId:o[2],message:o[3],id:o[4]};i.entries[r]=a}}}t.dispatchMessage(n)}}return e.init=function(t){if("object"==typeof t&&t){var n=new e(t);e.s_instance=n,i.setCustomSendLocalDocumentRequestFunc((function(t){t=l._validateLocalDocumentRequest(t);var i=0;l.isReadonlyRestRequest(t.method)||(i=1);var r=t.url.indexOf("?");if(r>=0){var o=t.url.substr(r+1),a=l._parseRequestFlagsAndCustomDataFromQueryStringIfAny(o);a.flags>=0&&(i=a.flags)}"string"==typeof t.body&&(t.body=JSON.parse(t.body));var s={id:e.nextId(),type:1,flags:i,message:t};return n.sendMessageToHostAndExpectResponse(s).then((function(e){return e.message}))}));for(var r=0;r<e.s_onInitedHandlers.length;r++)e.s_onInitedHandlers[r](n)}},Object.defineProperty(e,"instance",{get:function(){return e.s_instance},enumerable:!0,configurable:!0}),e.prototype.sendMessageToHost=function(e){this.m_bridge.sendMessageToHost(JSON.stringify(e))},e.prototype.sendMessageToHostAndExpectResponse=function(e){var t=this,n=l.createPromise((function(n,i){t.m_promiseResolver[e.id]=n}));return this.m_bridge.sendMessageToHost(JSON.stringify(e)),n},e.prototype.addHostMessageHandler=function(e){this.m_handlers.push(e)},e.prototype.removeHostMessageHandler=function(e){var t=this.m_handlers.indexOf(e);t>=0&&this.m_handlers.splice(t,1)},e.onInited=function(t){e.s_onInitedHandlers.push(t),e.s_instance&&t(e.s_instance)},e.prototype.dispatchMessage=function(e){if("number"==typeof e.id){var t=this.m_promiseResolver[e.id];if(t)return t(e),void delete this.m_promiseResolver[e.id]}for(var n=0;n<this.m_handlers.length;n++)this.m_handlers[n](e)},e.nextId=function(){return e.s_nextId++},e.s_onInitedHandlers=[],e.s_nextId=1,e}();e.HostBridge=o,"object"==typeof _richApiNativeBridge&&_richApiNativeBridge&&o.init(_richApiNativeBridge),function(e){var t=function(t){function n(e){var i=t.call(this,"string"==typeof e?e:e.message)||this;if(Object.setPrototypeOf(i,n.prototype),i.name="RichApi.Error","string"==typeof e?i.message=e:(i.code=e.code,i.message=e.message,i.traceMessages=e.traceMessages||[],i.innerError=e.innerError||null,i.debugInfo=i._createDebugInfo(e.debugInfo||{}),i.httpStatusCode=e.httpStatusCode,i.data=e.data),l.isNullOrUndefined(i.httpStatusCode)||200===i.httpStatusCode){var r={};r[a.accessDenied]=401,r[a.connectionFailure]=500,r[a.generalException]=500,r[a.invalidArgument]=400,r[a.invalidObjectPath]=400,r[a.invalidOrTimedOutSession]=408,r[a.invalidRequestContext]=400,r[a.timeout]=408,r[a.valueNotLoaded]=400,i.httpStatusCode=r[i.code]}return l.isNullOrUndefined(i.httpStatusCode)&&(i.httpStatusCode=500),i}return __extends(n,t),n.prototype.toString=function(){return this.code+": "+this.message},n.prototype._createDebugInfo=function(t){var n={code:this.code,message:this.message,toString:function(){return JSON.stringify(this)}};for(var i in t)n[i]=t[i];return this.innerError&&(this.innerError instanceof e.RuntimeError?n.innerError=this.innerError.debugInfo:n.innerError=this.innerError),n},n._createInvalidArgError=function(t){return new e.RuntimeError({code:a.invalidArgument,httpStatusCode:400,message:l.isNullOrEmptyString(t.argumentName)?l._getResourceString(s.invalidArgumentGeneric):l._getResourceString(s.invalidArgument,t.argumentName),debugInfo:t.errorLocation?{errorLocation:t.errorLocation}:{},innerError:t.innerError})},n}(Error);e.RuntimeError=t}(r=e._Internal||(e._Internal={})),e.Error=r.RuntimeError;var a=function(){function e(){}return e.apiNotFound="ApiNotFound",e.accessDenied="AccessDenied",e.generalException="GeneralException",e.activityLimitReached="ActivityLimitReached",e.invalidArgument="InvalidArgument",e.connectionFailure="ConnectionFailure",e.timeout="Timeout",e.invalidOrTimedOutSession="InvalidOrTimedOutSession",e.invalidObjectPath="InvalidObjectPath",e.invalidRequestContext="InvalidRequestContext",e.valueNotLoaded="ValueNotLoaded",e.requestPayloadSizeLimitExceeded="RequestPayloadSizeLimitExceeded",e.responsePayloadSizeLimitExceeded="ResponsePayloadSizeLimitExceeded",e.writeNotSupportedWhenModalDialogOpen="WriteNotSupportedWhenModalDialogOpen",e.undoNotSupported="UndoNotSupported",e}();e.CoreErrorCodes=a;var s=function(){function e(){}return e.apiNotFoundDetails="ApiNotFoundDetails",e.connectionFailureWithStatus="ConnectionFailureWithStatus",e.connectionFailureWithDetails="ConnectionFailureWithDetails",e.invalidArgument="InvalidArgument",e.invalidArgumentGeneric="InvalidArgumentGeneric",e.timeout="Timeout",e.invalidOrTimedOutSessionMessage="InvalidOrTimedOutSessionMessage",e.invalidSheetName="InvalidSheetName",e.invalidObjectPath="InvalidObjectPath",e.invalidRequestContext="InvalidRequestContext",e.valueNotLoaded="ValueNotLoaded",e}();e.CoreResourceStrings=s;var c=function(){function e(){}return e.flags="flags",e.sourceLibHeader="SdkVersion",e.processQuery="ProcessQuery",e.localDocument="http://document.localhost/",e.localDocumentApiPrefix="http://document.localhost/_api/",e.customData="customdata",e.testRequestNameHeader="x-test-request-name",e}();e.CoreConstants=c;var u=function(){function e(){}return e.buildMessageArrayForIRequestExecutor=function(t,n,i,r,o){var a=JSON.stringify(i.Body);l.log("Request:"),l.log(a);var s={};return l._copyHeaders(i.Headers,s),s[c.sourceLibHeader]=r,e.buildRequestMessageSafeArray(t,n,"POST",c.processQuery,s,a,o)},e.buildResponseOnSuccess=function(e,t){var n={HttpStatusCode:200,ErrorCode:"",ErrorMessage:"",Headers:null,Body:null};return n.Body=JSON.parse(e),n.Headers=t,n},e.buildResponseOnError=function(t,n){var i={HttpStatusCode:500,ErrorCode:"",ErrorMessage:"",Headers:null,Body:null};return i.ErrorCode=a.generalException,i.ErrorMessage=n,t==e.OfficeJsErrorCode_ooeNoCapability?(i.ErrorCode=a.accessDenied,i.HttpStatusCode=401):t==e.OfficeJsErrorCode_ooeActivityLimitReached?(i.ErrorCode=a.activityLimitReached,i.HttpStatusCode=429):t==e.OfficeJsErrorCode_ooeInvalidOrTimedOutSession?(i.ErrorCode=a.invalidOrTimedOutSession,i.HttpStatusCode=408,i.ErrorMessage=l._getResourceString(s.invalidOrTimedOutSessionMessage)):t==e.OfficeJsErrorCode_ooeRequestPayloadSizeLimitExceeded?(i.ErrorCode=a.requestPayloadSizeLimitExceeded,i.HttpStatusCode=400):t==e.OfficeJsErrorCode_ooeResponsePayloadSizeLimitExceeded?(i.ErrorCode=a.responsePayloadSizeLimitExceeded,i.HttpStatusCode=400):t==e.OfficeJsErrorCode_ooeWriteNotSupportedWhenModalDialogOpen?(i.ErrorCode=a.writeNotSupportedWhenModalDialogOpen,i.HttpStatusCode=400):t==e.OfficeJsErrorCode_ooeInvalidSheetName?(i.ErrorCode=a.invalidRequestContext,i.HttpStatusCode=400,i.ErrorMessage=l._getResourceString(s.invalidSheetName)):t==e.OfficeJsErrorCode_ooeUndoNotSupported&&(i.ErrorCode=a.undoNotSupported,i.HttpStatusCode=400),i},e.buildHttpResponseFromOfficeJsError=function(t,n){var i=500,r={error:{}};return r.error.code=a.generalException,r.error.message=n,t===e.OfficeJsErrorCode_ooeNoCapability?(i=403,r.error.code=a.accessDenied):t===e.OfficeJsErrorCode_ooeActivityLimitReached&&(i=429,r.error.code=a.activityLimitReached),{statusCode:i,headers:{},body:JSON.stringify(r)}},e.buildRequestMessageSafeArray=function(e,t,n,i,r,o,a){var s=[];if(r)for(var c in r)s.push(c),s.push(r[c]);return[e,n,i,s,o,0,t,"","","","","",""].concat(a?["",a]:[])},e.getResponseBody=function(t){return e.getResponseBodyFromSafeArray(t.value.data)},e.getResponseHeaders=function(t){return e.getResponseHeadersFromSafeArray(t.value.data)},e.getResponseBodyFromSafeArray=function(e){var t=e[2];return"string"==typeof t?t:t.join("")},e.getResponseHeadersFromSafeArray=function(e){var t=e[1];if(!t)return null;for(var n={},i=0;i<t.length-1;i+=2)n[t[i]]=t[i+1];return n},e.getResponseStatusCode=function(t){return e.getResponseStatusCodeFromSafeArray(t.value.data)},e.getResponseStatusCodeFromSafeArray=function(e){return e[0]},e.OfficeJsErrorCode_ooeInvalidOrTimedOutSession=5012,e.OfficeJsErrorCode_ooeActivityLimitReached=5102,e.OfficeJsErrorCode_ooeNoCapability=7e3,e.OfficeJsErrorCode_ooeRequestPayloadSizeLimitExceeded=5103,e.OfficeJsErrorCode_ooeResponsePayloadSizeLimitExceeded=5104,e.OfficeJsErrorCode_ooeWriteNotSupportedWhenModalDialogOpen=5016,e.OfficeJsErrorCode_ooeInvalidSheetName=1014,e.OfficeJsErrorCode_ooeUndoNotSupported=5017,e}();e.RichApiMessageUtility=u,function(e){e.getPromiseType=function(){if("undefined"!=typeof Promise)return Promise;if(void 0!==Office&&Office.Promise)return Office.Promise;if(void 0!==OfficeExtension&&OfficeExtension.Promise)return OfficeExtension.Promise;throw new e.Error("No Promise implementation found")}}(r=e._Internal||(e._Internal={}));var l=function(){function e(){}return e.log=function(t){e._logEnabled&&"undefined"!=typeof console&&console.log&&console.log(t)},e.checkArgumentNull=function(t,n){if(e.isNullOrUndefined(t))throw r.RuntimeError._createInvalidArgError({argumentName:n})},e.isNullOrUndefined=function(e){return null===e||void 0===e},e.isUndefined=function(e){return void 0===e},e.isNullOrEmptyString=function(e){return null===e||(void 0===e||0==e.length)},e.isPlainJsonObject=function(t){if(e.isNullOrUndefined(t))return!1;if("object"!=typeof t)return!1;if("[object Object]"!==Object.prototype.toString.apply(t))return!1;if(t.constructor&&!Object.prototype.hasOwnProperty.call(t,"constructor")&&!Object.prototype.hasOwnProperty.call(t.constructor.prototype,"hasOwnProperty"))return!1;for(var n in t)if(!Object.prototype.hasOwnProperty.call(t,n))return!1;return!0},e.trim=function(e){return e.replace(new RegExp("^\\s+|\\s+$","g"),"")},e.caseInsensitiveCompareString=function(t,n){return e.isNullOrUndefined(t)?e.isNullOrUndefined(n):!e.isNullOrUndefined(n)&&t.toUpperCase()==n.toUpperCase()},e.isReadonlyRestRequest=function(t){return e.caseInsensitiveCompareString(t,"GET")},e._getResourceString=function(t,n){var i;if("undefined"!=typeof window&&window.Strings&&window.Strings.OfficeOM){var r="L_"+t,o=window.Strings.OfficeOM[r];o&&(i=o)}if(i||(i=e.s_resourceStringValues[t]),i||(i=t),!e.isNullOrUndefined(n))if(Array.isArray(n)){var a=n;i=e._formatString(i,a)}else i=i.replace("{0}",n);return i},e._formatString=function(e,t){return e.replace(/\{\d\}/g,(function(e){var n=parseInt(e.substr(1,e.length-2));if(n<t.length)return t[n];throw r.RuntimeError._createInvalidArgError({argumentName:"format"})}))},Object.defineProperty(e,"Promise",{get:function(){return r.getPromiseType()},enumerable:!0,configurable:!0}),e.createPromise=function(t){return new e.Promise(t)},e._createPromiseFromResult=function(t){return e.createPromise((function(e,n){e(t)}))},e._createPromiseFromException=function(t){return e.createPromise((function(e,n){n(t)}))},e._createTimeoutPromise=function(t){return e.createPromise((function(e,n){setTimeout((function(){e(null)}),t)}))},e._createInvalidArgError=function(e){return r.RuntimeError._createInvalidArgError(e)},e._isLocalDocumentUrl=function(t){return e._getLocalDocumentUrlPrefixLength(t)>0},e._getLocalDocumentUrlPrefixLength=function(e){for(var t=["http://document.localhost","https://document.localhost","//document.localhost"],n=e.toLowerCase().trim(),i=0;i<t.length;i++){if(n===t[i])return t[i].length;if(n.substr(0,t[i].length+1)===t[i]+"/")return t[i].length+1}return 0},e._validateLocalDocumentRequest=function(t){var n=e._getLocalDocumentUrlPrefixLength(t.url);if(n<=0)throw r.RuntimeError._createInvalidArgError({argumentName:"request"});var i=t.url.substr(n),o=i.toLowerCase();return"_api"===o?i="":"_api/"===o.substr(0,"_api/".length)&&(i=i.substr("_api/".length)),{method:t.method,url:i,headers:t.headers,body:t.body}},e._parseRequestFlagsAndCustomDataFromQueryStringIfAny=function(e){for(var t={flags:-1,customData:""},n=e.split("&"),i=0;i<n.length;i++){var r=n[i].split("=");if(r[0].toLowerCase()===c.flags){var o=parseInt(r[1]);o&=65535,t.flags=o}else r[0].toLowerCase()===c.customData&&(t.customData=decodeURIComponent(r[1]))}return t},e._getRequestBodyText=function(e){var t="";return"string"==typeof e.body?t=e.body:e.body&&"object"==typeof e.body&&(t=JSON.stringify(e.body)),t},e._parseResponseBody=function(t){if("string"==typeof t.body){var n=e.trim(t.body);return JSON.parse(n)}return t.body},e._buildRequestMessageSafeArray=function(t){var n=0;e.isReadonlyRestRequest(t.method)||(n=1);var i="";if(t.url.substr(0,c.processQuery.length).toLowerCase()===c.processQuery.toLowerCase()){var r=t.url.indexOf("?");if(r>0){var o=t.url.substr(r+1),a=e._parseRequestFlagsAndCustomDataFromQueryStringIfAny(o);a.flags>=0&&(n=a.flags),i=a.customData}}return u.buildRequestMessageSafeArray(i,n,t.method,t.url,t.headers,e._getRequestBodyText(t))},e._parseHttpResponseHeaders=function(t){var n={};if(!e.isNullOrEmptyString(t))for(var i=new RegExp("\r?\n"),r=t.split(i),o=0;o<r.length;o++){var a=r[o];if(null!=a){var s=a.indexOf(":");if(s>0){var c=a.substr(0,s),u=a.substr(s+1);c=e.trim(c),u=e.trim(u),n[c.toUpperCase()]=u}}}return n},e._parseErrorResponse=function(t){var n=e._parseErrorResponseBody(t),i=t.statusCode.toString();if(e.isNullOrUndefined(n)||"object"!=typeof n||!n.error)return e._createDefaultErrorResponse(i);var r=n.error,o=r.innerError;return o&&o.code?e._createErrorResponse(o.code,i,o.message):r.code?e._createErrorResponse(r.code,i,r.message):e._createDefaultErrorResponse(i)},e._parseErrorResponseBody=function(t){if(e.isPlainJsonObject(t.body))return t.body;if(!e.isNullOrEmptyString(t.body)){var n=e.trim(t.body);try{return JSON.parse(n)}catch(t){e.log("Error when parse "+n)}}},e._createDefaultErrorResponse=function(t){return{errorCode:a.connectionFailure,errorMessage:e._getResourceString(s.connectionFailureWithStatus,t)}},e._createErrorResponse=function(t,n,i){return{errorCode:t,errorMessage:e._getResourceString(s.connectionFailureWithDetails,[n,t,i])}},e._copyHeaders=function(e,t){if(e&&t)for(var n in e)t[n]=e[n]},e.addResourceStringValues=function(t){for(var n in t)e.s_resourceStringValues[n]=t[n]},e._logEnabled=!1,e.s_resourceStringValues={ApiNotFoundDetails:"The method or property {0} is part of the {1} requirement set, which is not available in your version of {2}.",ConnectionFailureWithStatus:"The request failed with status code of {0}.",ConnectionFailureWithDetails:"The request failed with status code of {0}, error code {1} and the following error message: {2}",InvalidArgument:"The argument '{0}' doesn't work for this situation, is missing, or isn't in the right format.",InvalidObjectPath:'The object path \'{0}\' isn\'t working for what you\'re trying to do. If you\'re using the object across multiple "context.sync" calls and outside the sequential execution of a ".run" batch, please use the "context.trackedObjects.add()" and "context.trackedObjects.remove()" methods to manage the object\'s lifetime.',InvalidRequestContext:"Cannot use the object across different request contexts.",Timeout:"The operation has timed out.",ValueNotLoaded:'The value of the result object has not been loaded yet. Before reading the value property, call "context.sync()" on the associated request context.'},e}();e.CoreUtility=l;var d=function(){function e(){}return e.setMock=function(t){e.s_isMock=t},e.isMock=function(){return e.s_isMock},e._setCurrentTestName=function(t){e.s_currentTestName=t,e.s_currentTestSequenceId=0},e._getCurrentTestNameWithSequenceId=function(){return e.s_currentTestName?(e.s_currentTestSequenceId++,e.s_currentTestName+"."+e.s_currentTestSequenceId):null},e}();e.TestUtility=d,e._internalConfig={showDisposeInfoInDebugInfo:!1,showInternalApiInDebugInfo:!1,enableEarlyDispose:!0,alwaysPolyfillClientObjectUpdateMethod:!1,alwaysPolyfillClientObjectRetrieveMethod:!1,enableConcurrentFlag:!0,enableUndoableFlag:!0,appendTypeNameToObjectPathInfo:!1,enablePreviewExecution:!1},e.config={extendedErrorLogging:!1};var f=function(){function t(){}return t.createSetPropertyAction=function(t,n,i,r,o){E.validateObjectPath(n);var a={Id:t._nextId(),ActionType:4,Name:i,ObjectPathId:n._objectPath.objectPathInfo.Id,ArgumentInfo:{}},s=[r],c=E.setMethodArguments(t,a.ArgumentInfo,s);E.validateReferencedObjectPaths(c);var u=new h(a,0,o);if(u.referencedObjectPath=n._objectPath,u.referencedArgumentObjectPaths=c,e._internalConfig.enablePreviewExecution&&0!=(16&o)){var l={Id:t._nextId(),ActionType:4,Name:i,ObjectId:"",ObjectType:"",Arguments:[r]};n._addPreviewExecutionAction(l)}return n._addAction(u)},t.createQueryAction=function(e,t,n,i){E.validateObjectPath(t);var r={Id:e._nextId(),ActionType:2,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,QueryInfo:n},o=new h(r,1,4);return o.referencedObjectPath=t._objectPath,t._addAction(o,i)},t.createQueryAsJsonAction=function(e,t,n,i){E.validateObjectPath(t);var r={Id:e._nextId(),ActionType:7,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,QueryInfo:n},o=new h(r,1,4);return o.referencedObjectPath=t._objectPath,t._addAction(o,i)},t.createUpdateAction=function(e,t,n){E.validateObjectPath(t);var i={Id:e._nextId(),ActionType:9,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,ObjectState:n},r=new h(i,0,0);return r.referencedObjectPath=t._objectPath,t._addAction(r)},t}();e.CommonActionFactory=f;var p=function(){function t(e,t){this.m_contextBase=e,this.m_objectPath=t}return Object.defineProperty(t.prototype,"_objectPath",{get:function(){return this.m_objectPath},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_context",{get:function(){return this.m_contextBase},enumerable:!0,configurable:!0}),t.prototype._addAction=function(e,t){var n=this;return void 0===t&&(t=null),l.createPromise((function(i,r){n._context._addServiceApiAction(e,t,i,r)}))},t.prototype._addPreviewExecutionAction=function(e){},t.prototype._retrieve=function(t,n){var i=e._internalConfig.alwaysPolyfillClientObjectRetrieveMethod;i||(i=!E.isSetSupported("RichApiRuntime","1.1"));var r=m._parseQueryOption(t);return i?f.createQueryAction(this._context,this,r,n):f.createQueryAsJsonAction(this._context,this,r,n)},t.prototype._recursivelyUpdate=function(t){var n=e._internalConfig.alwaysPolyfillClientObjectUpdateMethod;n||(n=!E.isSetSupported("RichApiRuntime","1.2"));try{var i=this[S.scalarPropertyNames];i||(i=[]);var o=this[S.scalarPropertyUpdateable];if(!o){o=[];for(var c=0;c<i.length;c++)o.push(!1)}var u=this[S.navigationPropertyNames];u||(u=[]);var d={},p={},h=0;for(var g in t){var m=i.indexOf(g);if(m>=0){if(!o[m])throw new r.RuntimeError({code:a.invalidArgument,httpStatusCode:400,message:l._getResourceString(I.attemptingToSetReadOnlyProperty,g),debugInfo:{errorLocation:g}});d[g]=t[g],++h}else{if(!(u.indexOf(g)>=0))throw new r.RuntimeError({code:a.invalidArgument,httpStatusCode:400,message:l._getResourceString(I.propertyDoesNotExist,g),debugInfo:{errorLocation:g}});p[g]=t[g]}}if(h>0)if(n)for(c=0;c<i.length;c++){var v=d[g=i[c]];E.isUndefined(v)||f.createSetPropertyAction(this._context,this,g,v)}else f.createUpdateAction(this._context,this,d);for(var g in p){var y=this[g],_=p[g];y._recursivelyUpdate(_)}}catch(e){throw new r.RuntimeError({code:a.invalidArgument,httpStatusCode:400,message:l._getResourceString(s.invalidArgument,"properties"),debugInfo:{errorLocation:this._className+".update"},innerError:e})}},t}();e.ClientObjectBase=p;var h=function(){function e(e,t,n){this.m_actionInfo=e,this.m_operationType=t,this.m_flags=n}return Object.defineProperty(e.prototype,"actionInfo",{get:function(){return this.m_actionInfo},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"operationType",{get:function(){return this.m_operationType},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"flags",{get:function(){return this.m_flags},enumerable:!0,configurable:!0}),e}();e.Action=h;var g=function(){function t(e,t,n,i,r,o){this.m_objectPathInfo=e,this.m_parentObjectPath=t,this.m_isCollection=n,this.m_isInvalidAfterRequest=i,this.m_isValid=!0,this.m_operationType=r,this.m_flags=o}return Object.defineProperty(t.prototype,"id",{get:function(){var e=this.m_objectPathInfo.ArgumentInfo;if(e){var t=e.Arguments;if(t)return t[0]}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){var e=this.m_parentObjectPath;if(e)return e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parentId",{get:function(){return this.parent?this.parent.id:void 0},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"objectPathInfo",{get:function(){return this.m_objectPathInfo},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"operationType",{get:function(){return this.m_operationType},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"flags",{get:function(){return this.m_flags},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isCollection",{get:function(){return this.m_isCollection},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isInvalidAfterRequest",{get:function(){return this.m_isInvalidAfterRequest},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parentObjectPath",{get:function(){return this.m_parentObjectPath},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"argumentObjectPaths",{get:function(){return this.m_argumentObjectPaths},set:function(e){this.m_argumentObjectPaths=e},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isValid",{get:function(){return this.m_isValid},set:function(e){this.m_isValid=e,!e&&6===this.m_objectPathInfo.ObjectPathType&&this.m_savedObjectPathInfo&&(t.copyObjectPathInfo(this.m_savedObjectPathInfo.pathInfo,this.m_objectPathInfo),this.m_parentObjectPath=this.m_savedObjectPathInfo.parent,this.m_isValid=!0,this.m_savedObjectPathInfo=null)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"originalObjectPathInfo",{get:function(){return this.m_originalObjectPathInfo},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"getByIdMethodName",{get:function(){return this.m_getByIdMethodName},set:function(e){this.m_getByIdMethodName=e},enumerable:!0,configurable:!0}),t.prototype._updateAsNullObject=function(){this.resetForUpdateUsingObjectData(),this.m_objectPathInfo.ObjectPathType=7,this.m_objectPathInfo.Name="",this.m_parentObjectPath=null},t.prototype.saveOriginalObjectPathInfo=function(){e.config.extendedErrorLogging&&!this.m_originalObjectPathInfo&&(this.m_originalObjectPathInfo={},t.copyObjectPathInfo(this.m_objectPathInfo,this.m_originalObjectPathInfo))},t.prototype.updateUsingObjectData=function(e,n){var i=e[S.referenceId];if(!l.isNullOrEmptyString(i)){if(!this.m_savedObjectPathInfo&&!this.isInvalidAfterRequest&&t.isRestorableObjectPath(this.m_objectPathInfo.ObjectPathType)){var r={};t.copyObjectPathInfo(this.m_objectPathInfo,r),this.m_savedObjectPathInfo={pathInfo:r,parent:this.m_parentObjectPath}}return this.saveOriginalObjectPathInfo(),this.resetForUpdateUsingObjectData(),this.m_objectPathInfo.ObjectPathType=6,this.m_objectPathInfo.Name=i,delete this.m_objectPathInfo.ParentObjectPathId,void(this.m_parentObjectPath=null)}if(n){var o=n[S.collectionPropertyPath];if(!l.isNullOrEmptyString(o)&&n.context){var a=E.tryGetObjectIdFromLoadOrRetrieveResult(e);if(!l.isNullOrUndefined(a)){for(var s=o.split("."),c=n.context[s[0]],u=1;u<s.length;u++)c=c[s[u]];return this.saveOriginalObjectPathInfo(),this.resetForUpdateUsingObjectData(),this.m_parentObjectPath=c._objectPath,this.m_objectPathInfo.ParentObjectPathId=this.m_parentObjectPath.objectPathInfo.Id,this.m_objectPathInfo.ObjectPathType=5,this.m_objectPathInfo.Name="",void(this.m_objectPathInfo.ArgumentInfo.Arguments=[a])}}}var d=this.parentObjectPath&&this.parentObjectPath.isCollection,f=this.getByIdMethodName;if(d||!l.isNullOrEmptyString(f)){a=E.tryGetObjectIdFromLoadOrRetrieveResult(e);if(!l.isNullOrUndefined(a))return this.saveOriginalObjectPathInfo(),this.resetForUpdateUsingObjectData(),l.isNullOrEmptyString(f)?(this.m_objectPathInfo.ObjectPathType=5,this.m_objectPathInfo.Name=""):(this.m_objectPathInfo.ObjectPathType=3,this.m_objectPathInfo.Name=f),void(this.m_objectPathInfo.ArgumentInfo.Arguments=[a])}},t.prototype.resetForUpdateUsingObjectData=function(){this.m_isInvalidAfterRequest=!1,this.m_isValid=!0,this.m_operationType=1,this.m_flags=4,this.m_objectPathInfo.ArgumentInfo={},this.m_argumentObjectPaths=null,this.m_getByIdMethodName=null},t.isRestorableObjectPath=function(e){return 1===e||5===e||3===e||4===e},t.copyObjectPathInfo=function(e,t){t.Id=e.Id,t.ArgumentInfo=e.ArgumentInfo,t.Name=e.Name,t.ObjectPathType=e.ObjectPathType,t.ParentObjectPathId=e.ParentObjectPathId},t}();e.ObjectPath=g;var m=function(){function e(){this.m_nextId=0}return e.prototype._nextId=function(){return++this.m_nextId},e.prototype._addServiceApiAction=function(e,t,n,i){this.m_serviceApiQueue||(this.m_serviceApiQueue=new b(this)),this.m_serviceApiQueue.add(e,t,n,i)},e._parseQueryOption=function(t){var n={};if("string"==typeof t){var i=t;n.Select=E._parseSelectExpand(i)}else if(Array.isArray(t))n.Select=E._parseSelectExpand(t);else if("object"==typeof t){var o=t;if(e.isLoadOption(o)){if("string"==typeof o.select)n.Select=E._parseSelectExpand(o.select);else if(Array.isArray(o.select))n.Select=E._parseSelectExpand(o.select);else if(!E.isNullOrUndefined(o.select))throw r.RuntimeError._createInvalidArgError({argumentName:"option.select"});if("string"==typeof o.expand)n.Expand=E._parseSelectExpand(o.expand);else if(Array.isArray(o.expand))n.Expand=E._parseSelectExpand(o.expand);else if(!E.isNullOrUndefined(o.expand))throw r.RuntimeError._createInvalidArgError({argumentName:"option.expand"});if("number"==typeof o.top)n.Top=o.top;else if(!E.isNullOrUndefined(o.top))throw r.RuntimeError._createInvalidArgError({argumentName:"option.top"});if("number"==typeof o.skip)n.Skip=o.skip;else if(!E.isNullOrUndefined(o.skip))throw r.RuntimeError._createInvalidArgError({argumentName:"option.skip"})}else n=e.parseStrictLoadOption(t)}else if(!E.isNullOrUndefined(t))throw r.RuntimeError._createInvalidArgError({argumentName:"option"});return n},e.isLoadOption=function(e){if(!E.isUndefined(e.select)&&("string"==typeof e.select||Array.isArray(e.select)))return!0;if(!E.isUndefined(e.expand)&&("string"==typeof e.expand||Array.isArray(e.expand)))return!0;if(!E.isUndefined(e.top)&&"number"==typeof e.top)return!0;if(!E.isUndefined(e.skip)&&"number"==typeof e.skip)return!0;for(var t in e)return!1;return!0},e.parseStrictLoadOption=function(t){var n={Select:[]};return e.parseStrictLoadOptionHelper(n,"","option",t),n},e.combineQueryPath=function(e,t,n){return 0===e.length?t:e+n+t},e.parseStrictLoadOptionHelper=function(t,n,i,o){for(var a in o){var s=o[a];if("$all"===a){if("boolean"!=typeof s)throw r.RuntimeError._createInvalidArgError({argumentName:e.combineQueryPath(i,a,".")});s&&t.Select.push(e.combineQueryPath(n,"*","/"))}else if("$top"===a){if("number"!=typeof s||n.length>0)throw r.RuntimeError._createInvalidArgError({argumentName:e.combineQueryPath(i,a,".")});t.Top=s}else if("$skip"===a){if("number"!=typeof s||n.length>0)throw r.RuntimeError._createInvalidArgError({argumentName:e.combineQueryPath(i,a,".")});t.Skip=s}else if("boolean"==typeof s)s&&t.Select.push(e.combineQueryPath(n,a,"/"));else{if("object"!=typeof s)throw r.RuntimeError._createInvalidArgError({argumentName:e.combineQueryPath(i,a,".")});e.parseStrictLoadOptionHelper(t,e.combineQueryPath(n,a,"/"),e.combineQueryPath(i,a,"."),s)}}},e}();e.ClientRequestContextBase=m;var v=function(){function e(e){this.m_objectPath=e}return e.prototype._handleResult=function(e){l.isNullOrUndefined(e)?this.m_objectPath._updateAsNullObject():this.m_objectPath.updateUsingObjectData(e,null)},e}(),y=function(){function t(e){this.m_contextBase=e,this.m_actions=[],this.m_actionResultHandler={},this.m_referencedObjectPaths={},this.m_instantiatedObjectPaths={},this.m_preSyncPromises=[],this.m_previewExecutionActions=[]}return t.prototype.addAction=function(e){this.m_actions.push(e),1==e.actionInfo.ActionType&&(this.m_instantiatedObjectPaths[e.actionInfo.ObjectPathId]=e)},t.prototype.addPreviewExecutionAction=function(e){this.m_previewExecutionActions.push(e)},Object.defineProperty(t.prototype,"hasActions",{get:function(){return this.m_actions.length>0},enumerable:!0,configurable:!0}),t.prototype._getLastAction=function(){return this.m_actions[this.m_actions.length-1]},t.prototype.ensureInstantiateObjectPath=function(e){if(e){if(this.m_instantiatedObjectPaths[e.objectPathInfo.Id])return;if(this.ensureInstantiateObjectPath(e.parentObjectPath),this.ensureInstantiateObjectPaths(e.argumentObjectPaths),!this.m_instantiatedObjectPaths[e.objectPathInfo.Id]){var t={Id:this.m_contextBase._nextId(),ActionType:1,Name:"",ObjectPathId:e.objectPathInfo.Id},n=new h(t,1,4);n.referencedObjectPath=e,this.addReferencedObjectPath(e),this.addAction(n);var i=new v(e);this.addActionResultHandler(n,i)}}},t.prototype.ensureInstantiateObjectPaths=function(e){if(e)for(var t=0;t<e.length;t++)this.ensureInstantiateObjectPath(e[t])},t.prototype.addReferencedObjectPath=function(e){if(e&&!this.m_referencedObjectPaths[e.objectPathInfo.Id]){if(!e.isValid)throw new r.RuntimeError({code:a.invalidObjectPath,httpStatusCode:400,message:l._getResourceString(s.invalidObjectPath,E.getObjectPathExpression(e)),debugInfo:{errorLocation:E.getObjectPathExpression(e)}});for(;e;)this.m_referencedObjectPaths[e.objectPathInfo.Id]=e,3==e.objectPathInfo.ObjectPathType&&this.addReferencedObjectPaths(e.argumentObjectPaths),e=e.parentObjectPath}},t.prototype.addReferencedObjectPaths=function(e){if(e)for(var t=0;t<e.length;t++)this.addReferencedObjectPath(e[t])},t.prototype.addActionResultHandler=function(e,t){this.m_actionResultHandler[e.actionInfo.Id]=t},t.prototype.aggregrateRequestFlags=function(e,t,n){return 0===t&&(e|=1,0==(2&n)&&(e&=-17),0==(8&n)&&(e&=-257),e&=-5),1&n&&(e|=2),0==(4&n)&&(e&=-5),e},t.prototype.finallyNormalizeFlags=function(t){return 0==(1&t)&&(t&=-17,t&=-257),e._internalConfig.enableConcurrentFlag||(t&=-5),e._internalConfig.enableUndoableFlag||(t&=-17),E.isSetSupported("RichApiRuntimeFlag","1.1")||(t&=-5,t&=-17),E.isSetSupported("RichApiRuntimeFlag","1.2")||(t&=-257),"number"==typeof this.m_flagsForTesting&&(t=this.m_flagsForTesting),t},t.prototype.buildRequestMessageBodyAndRequestFlags=function(){e._internalConfig.enableEarlyDispose&&t._calculateLastUsedObjectPathIds(this.m_actions);var n=276,i={};for(var r in this.m_referencedObjectPaths)n=this.aggregrateRequestFlags(n,this.m_referencedObjectPaths[r].operationType,this.m_referencedObjectPaths[r].flags),i[r]=this.m_referencedObjectPaths[r].objectPathInfo;for(var o=[],a=!1,s=0;s<this.m_actions.length;s++){var c=this.m_actions[s];3===c.actionInfo.ActionType&&c.actionInfo.Name===S.keepReference&&(a=!0),n=this.aggregrateRequestFlags(n,c.operationType,c.flags),o.push(c.actionInfo)}n=this.finallyNormalizeFlags(n);var u={AutoKeepReference:this.m_contextBase._autoCleanup&&a,Actions:o,ObjectPaths:i};return this.m_previewExecutionActions.length>0&&(u.PreviewExecutionActions=this.m_previewExecutionActions,n|=4096),{body:u,flags:n}},t.prototype.processResponse=function(e){if(e)for(var t=0;t<e.length;t++){var n=e[t],i=this.m_actionResultHandler[n.ActionId];i&&i._handleResult(n.Value)}},t.prototype.invalidatePendingInvalidObjectPaths=function(){for(var e in this.m_referencedObjectPaths)this.m_referencedObjectPaths[e].isInvalidAfterRequest&&(this.m_referencedObjectPaths[e].isValid=!1)},t.prototype._addPreSyncPromise=function(e){this.m_preSyncPromises.push(e)},Object.defineProperty(t.prototype,"_preSyncPromises",{get:function(){return this.m_preSyncPromises},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_actions",{get:function(){return this.m_actions},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_objectPaths",{get:function(){return this.m_referencedObjectPaths},enumerable:!0,configurable:!0}),t.prototype._removeKeepReferenceAction=function(e){for(var t=this.m_actions.length-1;t>=0;t--){var n=this.m_actions[t].actionInfo;if(n.ObjectPathId===e&&3===n.ActionType&&n.Name===S.keepReference){this.m_actions.splice(t,1);break}}},t._updateLastUsedActionIdOfObjectPathId=function(e,n,i){for(;n;){if(e[n.objectPathInfo.Id])return;e[n.objectPathInfo.Id]=i;var r=n.argumentObjectPaths;if(r)for(var o=r.length,a=0;a<o;a++)t._updateLastUsedActionIdOfObjectPathId(e,r[a],i);n=n.parentObjectPath}},t._calculateLastUsedObjectPathIds=function(e){for(var n={},i=e.length,r=i-1;r>=0;--r){var o=(f=e[r]).actionInfo.Id;f.referencedObjectPath&&t._updateLastUsedActionIdOfObjectPathId(n,f.referencedObjectPath,o);var a=f.referencedArgumentObjectPaths;if(a)for(var s=a.length,c=0;c<s;c++)t._updateLastUsedActionIdOfObjectPathId(n,a[c],o)}var u={};for(var l in n){var d=u[o=n[l]];d||(d=[],u[o]=d),d.push(parseInt(l))}for(r=0;r<i;r++){var f,p=u[(f=e[r]).actionInfo.Id];p&&p.length>0?f.actionInfo.L=p:f.actionInfo.L&&delete f.actionInfo.L}},t}();e.ClientRequestBase=y;var _=function(){function e(e){this.m_type=e}return Object.defineProperty(e.prototype,"value",{get:function(){if(!this.m_isLoaded)throw new r.RuntimeError({code:a.valueNotLoaded,httpStatusCode:400,message:l._getResourceString(s.valueNotLoaded),debugInfo:{errorLocation:"clientResult.value"}});return this.m_value},enumerable:!0,configurable:!0}),e.prototype._handleResult=function(e){this.m_isLoaded=!0,"object"==typeof e&&e&&e._IsNull||(1===this.m_type?this.m_value=E.adjustToDateTime(e):this.m_value=e)},e}();e.ClientResult=_;var b=function(){function e(e){this.m_context=e,this.m_actions=[]}return e.prototype.add=function(e,t,n,i){var r=this;this.m_actions.push({action:e,resultHandler:t,resolve:n,reject:i}),1===this.m_actions.length&&setTimeout((function(){return r.processActions()}),0)},e.prototype.processActions=function(){var e=this;if(0!==this.m_actions.length){var t=this.m_actions;this.m_actions=[];for(var n=new y(this.m_context),i=0;i<t.length;i++){var r=t[i];n.ensureInstantiateObjectPath(r.action.referencedObjectPath),n.ensureInstantiateObjectPaths(r.action.referencedArgumentObjectPaths),n.addAction(r.action),n.addReferencedObjectPath(r.action.referencedObjectPath),n.addReferencedObjectPaths(r.action.referencedArgumentObjectPaths)}var o=n.buildRequestMessageBodyAndRequestFlags(),a=o.body,s=o.flags,u={Url:c.localDocumentApiPrefix,Headers:null,Body:a};l.log("Request:"),l.log(JSON.stringify(a)),(new O).executeAsync(this.m_context._customData,s,u).then((function(i){e.processResponse(n,t,i)})).catch((function(e){for(var n=0;n<t.length;n++){t[n].reject(e)}}))}},e.prototype.processResponse=function(e,t,n){var i=this.getErrorFromResponse(n),r=null;n.Body.Results?r=n.Body.Results:n.Body.ProcessedResults&&n.Body.ProcessedResults.Results&&(r=n.Body.ProcessedResults.Results),r||(r=[]),this.processActionResults(e,t,r,i)},e.prototype.getErrorFromResponse=function(e){return l.isNullOrEmptyString(e.ErrorCode)?e.Body&&e.Body.Error?new r.RuntimeError({code:e.Body.Error.Code,httpStatusCode:e.Body.Error.HttpStatusCode,message:e.Body.Error.Message}):null:new r.RuntimeError({code:e.ErrorCode,httpStatusCode:e.HttpStatusCode,message:e.ErrorMessage})},e.prototype.processActionResults=function(e,t,n,i){e.processResponse(n);for(var r=0;r<t.length;r++){for(var o=t[r],a=o.action.actionInfo.Id,s=!1,c=0;c<n.length;c++)if(a==n[c].ActionId){var u=n[c].Value;o.resultHandler&&(o.resultHandler._handleResult(u),u=o.resultHandler.value),o.resolve&&o.resolve(u),s=!0;break}!s&&o.reject&&(i?o.reject(i):o.reject("No response for the action."))}},e}(),O=function(){function e(){}return e.prototype.getRequestUrl=function(e,n,i){void 0===i&&(i=t.graph.toString());var r=c.flags+"="+n.toString();switch(i){case t.graph.toString():"/"!=e.charAt(e.length-1)&&(e+="/"),e=(e+=c.processQuery)+"?"+r;break;case t.wfe.toString():e=(e=e+"&"+r)+"&wdRestPart=_api/"+c.processQuery}return e},e.prototype.executeAsync=function(n,r,o){var a=o.Headers?o.Headers[S.remoteEndpointTypeHeaderKey]:t.graph.toString(),s={method:"POST",url:this.getRequestUrl(o.Url,r,a),headers:{},body:o.Body};if(s.headers[c.sourceLibHeader]=e.SourceLibHeaderValue,s.headers["CONTENT-TYPE"]="application/json",o.Headers)for(var u in o.Headers)s.headers[u]=o.Headers[u];return(l._isLocalDocumentUrl(s.url)?i.sendLocalDocumentRequest:i.sendRequest)(s).then((function(e){var t;if(200===e.statusCode)t={HttpStatusCode:e.statusCode,ErrorCode:null,ErrorMessage:null,Headers:e.headers,Body:l._parseResponseBody(e)};else{l.log("Error Response:"+e.body);var n=l._parseErrorResponse(e);t={HttpStatusCode:e.statusCode,ErrorCode:n.errorCode,ErrorMessage:n.errorMessage,Headers:e.headers,Body:null,RawErrorResponseBody:l._parseErrorResponseBody(e)}}return t}))},e.SourceLibHeaderValue="officejs-rest",e}();e.HttpRequestExecutor=O;var S=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.collectionPropertyPath="_collectionPropertyPath",t.id="Id",t.idLowerCase="id",t.idPrivate="_Id",t.keepReference="_KeepReference",t.objectPathIdPrivate="_ObjectPathId",t.referenceId="_ReferenceId",t.items="_Items",t.itemsLowerCase="items",t.scalarPropertyNames="_scalarPropertyNames",t.scalarPropertyOriginalNames="_scalarPropertyOriginalNames",t.navigationPropertyNames="_navigationPropertyNames",t.scalarPropertyUpdateable="_scalarPropertyUpdateable",t.previewExecutionObjectId="_previewExecutionObjectId",t.remoteEndpointTypeHeaderKey="X-EndpointType",t}(c);e.CommonConstants=S;var E=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.validateObjectPath=function(e){for(var n=e._objectPath;n;){if(!n.isValid)throw new r.RuntimeError({code:a.invalidObjectPath,httpStatusCode:400,message:l._getResourceString(s.invalidObjectPath,t.getObjectPathExpression(n)),debugInfo:{errorLocation:t.getObjectPathExpression(n)}});n=n.parentObjectPath}},t.validateReferencedObjectPaths=function(e){if(e)for(var n=0;n<e.length;n++)for(var i=e[n];i;){if(!i.isValid)throw new r.RuntimeError({code:a.invalidObjectPath,httpStatusCode:400,message:l._getResourceString(s.invalidObjectPath,t.getObjectPathExpression(i))});i=i.parentObjectPath}},t._toCamelLowerCase=function(e){if(l.isNullOrEmptyString(e))return e;for(var t=0;t<e.length&&e.charCodeAt(t)>=65&&e.charCodeAt(t)<=90;)t++;return t<e.length?e.substr(0,t).toLowerCase()+e.substr(t):e.toLowerCase()},t.adjustToDateTime=function(e){if(l.isNullOrUndefined(e))return null;if("string"==typeof e)return new Date(e);if(Array.isArray(e)){for(var n=e,i=0;i<n.length;i++)n[i]=t.adjustToDateTime(n[i]);return n}throw l._createInvalidArgError({argumentName:"date"})},t.tryGetObjectIdFromLoadOrRetrieveResult=function(e){var t=e[S.id];return l.isNullOrUndefined(t)&&(t=e[S.idLowerCase]),l.isNullOrUndefined(t)&&(t=e[S.idPrivate]),t},t.getObjectPathExpression=function(e){for(var n="";e;){switch(e.objectPathInfo.ObjectPathType){case 1:n=n;break;case 2:n="new()"+(n.length>0?".":"")+n;break;case 3:n=t.normalizeName(e.objectPathInfo.Name)+"()"+(n.length>0?".":"")+n;break;case 4:n=t.normalizeName(e.objectPathInfo.Name)+(n.length>0?".":"")+n;break;case 5:n="getItem()"+(n.length>0?".":"")+n;break;case 6:n="_reference()"+(n.length>0?".":"")+n}e=e.parentObjectPath}return n},t.setMethodArguments=function(e,n,i){if(l.isNullOrUndefined(i))return null;var r=new Array,o=new Array,a=t.collectObjectPathInfos(e,i,r,o);return n.Arguments=i,a&&(n.ReferencedObjectPathIds=o),r},t.validateContext=function(e,t){if(e&&t&&t._context!==e)throw new r.RuntimeError({code:a.invalidRequestContext,httpStatusCode:400,message:l._getResourceString(s.invalidRequestContext)})},t.isSetSupported=function(e,n){return"function"==typeof t.isSetSupportedOverride?t.isSetSupportedOverride(e,n):!("undefined"!=typeof window&&window.Office&&window.Office.context&&window.Office.context.requirements)||window.Office.context.requirements.isSetSupported(e,n)},t.throwIfApiNotSupported=function(e,n,i,o){if(t._doApiNotSupportedCheck&&!t.isSetSupported(n,i)){var c=l._getResourceString(s.apiNotFoundDetails,[e,n+" "+i,o]);throw new r.RuntimeError({code:a.apiNotFound,httpStatusCode:404,message:c,debugInfo:{errorLocation:e}})}},t.calculateApiFlags=function(e,n,i){var r="undefined"!=typeof window&&window&&window.location&&window.location.href&&-1!==window.location.href.indexOf("eed0a086-3498-4f91-a377-1e0265ecc0cc");return("function"==typeof t.isSetSupportedOverride?t.isSetSupportedOverride(n,i):!r&&t.isSetSupported(n,i))||(e&=-3),e},t._parseSelectExpand=function(e){var t,n=[];if(Array.isArray(e))t=e;else{if(l.isNullOrEmptyString(e))return n;t=e.split(",")}for(var i=0;i<t.length;i++){var o=t[i];if("string"!=typeof o)throw r.RuntimeError._createInvalidArgError({argumentName:"select"});(o=a(o.trim())).length>0&&n.push(o)}return n;function a(e){var t=e.toLowerCase();if("items"===t||"items/"===t)return"*";return("items/"===t.substr(0,6)||"items."===t.substr(0,6))&&(e=e.substr(6)),e.replace(new RegExp("[/.]items[/.]","gi"),"/")}},t.changePropertyNameToCamelLowerCase=function(e){if(Array.isArray(e)){for(var n=[],i=0;i<e.length;i++)n.push(this.changePropertyNameToCamelLowerCase(e[i]));return n}if("object"==typeof e&&null!==e){n={};for(var r in e){var o=e[r];if(r===S.items){(n={})[S.itemsLowerCase]=this.changePropertyNameToCamelLowerCase(o);break}n[t._toCamelLowerCase(r)]=this.changePropertyNameToCamelLowerCase(o)}return n}return e},t.purifyJson=function(e){if(Array.isArray(e)){for(var t=[],n=0;n<e.length;n++)t.push(this.purifyJson(e[n]));return t}if("object"==typeof e&&null!==e){t={};for(var i in e)if(95!==i.charCodeAt(0)){var r=e[i];"object"==typeof r&&null!==r&&Array.isArray(r.items)&&(r=r.items),t[i]=this.purifyJson(r)}return t}return e},t.collectObjectPathInfos=function(e,n,i,r){for(var o=!1,a=0;a<n.length;a++)if(n[a]instanceof p){var s=n[a];t.validateContext(e,s),n[a]=s._objectPath.objectPathInfo.Id,r.push(s._objectPath.objectPathInfo.Id),i.push(s._objectPath),o=!0}else if(Array.isArray(n[a])){var c=new Array;t.collectObjectPathInfos(e,n[a],i,c)?(r.push(c),o=!0):r.push(0)}else l.isPlainJsonObject(n[a])?(r.push(0),t.replaceClientObjectPropertiesWithObjectPathIds(n[a],i)):r.push(0);return o},t.replaceClientObjectPropertiesWithObjectPathIds=function(e,n){var i,r;for(var o in e){var a=e[o];if(a instanceof p)n.push(a._objectPath),e[o]=((i={})[S.objectPathIdPrivate]=a._objectPath.objectPathInfo.Id,i);else if(Array.isArray(a))for(var s=0;s<a.length;s++)if(a[s]instanceof p){var c=a[s];n.push(c._objectPath),a[s]=((r={})[S.objectPathIdPrivate]=c._objectPath.objectPathInfo.Id,r)}else l.isPlainJsonObject(a[s])&&t.replaceClientObjectPropertiesWithObjectPathIds(a[s],n);else l.isPlainJsonObject(a)&&t.replaceClientObjectPropertiesWithObjectPathIds(a,n)}},t.normalizeName=function(e){return e.substr(0,1).toLowerCase()+e.substr(1)},t._doApiNotSupportedCheck=!1,t}(l);e.CommonUtility=E;var I=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.propertyDoesNotExist="PropertyDoesNotExist",t.attemptingToSetReadOnlyProperty="AttemptingToSetReadOnlyProperty",t}(s);e.CommonResourceStrings=I;var C=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.propertyNotLoaded="PropertyNotLoaded",t.runMustReturnPromise="RunMustReturnPromise",t.cannotRegisterEvent="CannotRegisterEvent",t.invalidOrTimedOutSession="InvalidOrTimedOutSession",t.cannotUpdateReadOnlyProperty="CannotUpdateReadOnlyProperty",t}(a);e.ErrorCodes=C;var A=function(){function e(e){this.m_callback=e}return e.prototype._handleResult=function(e){this.m_callback&&this.m_callback()},e}(),P=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.createMethodAction=function(t,n,i,r,o,a){G.validateObjectPath(n);var s={Id:t._nextId(),ActionType:3,Name:i,ObjectPathId:n._objectPath.objectPathInfo.Id,ArgumentInfo:{}},c=G.setMethodArguments(t,s.ArgumentInfo,o);G.validateReferencedObjectPaths(c);var u=G._fixupApiFlags(a),l=new h(s,r,u);if(l.referencedObjectPath=n._objectPath,l.referencedArgumentObjectPaths=c,n._addAction(l),e._internalConfig.enablePreviewExecution&&0!=(16&u)){var d={Id:t._nextId(),ActionType:3,Name:i,Arguments:o,ObjectId:"",ObjectType:""};n._addPreviewExecutionAction(d)}return l},n.createRecursiveQueryAction=function(e,t,n){G.validateObjectPath(t);var i={Id:e._nextId(),ActionType:6,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,RecursiveQueryInfo:n},r=new h(i,1,4);return r.referencedObjectPath=t._objectPath,t._addAction(r),r},n.createEnsureUnchangedAction=function(e,t,n){G.validateObjectPath(t);var i={Id:e._nextId(),ActionType:8,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,ObjectState:n},r=new h(i,1,4);return r.referencedObjectPath=t._objectPath,t._addAction(r),r},n.createInstantiateAction=function(e,t){G.validateObjectPath(t),e._pendingRequest.ensureInstantiateObjectPath(t._objectPath.parentObjectPath),e._pendingRequest.ensureInstantiateObjectPaths(t._objectPath.argumentObjectPaths);var n={Id:e._nextId(),ActionType:1,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id},i=new h(n,1,4);return i.referencedObjectPath=t._objectPath,t._addAction(i,new L(t),!0),i},n.createTraceAction=function(e,t,n){var i={Id:e._nextId(),ActionType:5,Name:"Trace",ObjectPathId:0},r=new h(i,1,4);return e._pendingRequest.addAction(r),n&&e._pendingRequest.addTrace(i.Id,t),r},n.createTraceMarkerForCallback=function(e,t){var i=n.createTraceAction(e,null,!1);e._pendingRequest.addActionResultHandler(i,new A(t))},n}(f);e.ActionFactory=P;var w=function(t){function n(n,i){var r=t.call(this,n,i)||this;return G.checkArgumentNull(n,"context"),r.m_context=n,r._objectPath&&(!n._processingResult&&n._pendingRequest&&(P.createInstantiateAction(n,r),n._autoCleanup&&r._KeepReference&&n.trackedObjects._autoAdd(r)),e._internalConfig.appendTypeNameToObjectPathInfo&&r._objectPath.objectPathInfo&&r._className&&(r._objectPath.objectPathInfo.T=r._className)),r}return __extends(n,t),Object.defineProperty(n.prototype,"context",{get:function(){return this.m_context},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isNull",{get:function(){return(void 0!==this.m_isNull||!d.isMock())&&(G.throwIfNotLoaded("isNull",this._isNull,null,this._isNull),this._isNull)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"isNullObject",{get:function(){return(void 0!==this.m_isNull||!d.isMock())&&(G.throwIfNotLoaded("isNullObject",this._isNull,null,this._isNull),this._isNull)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"_isNull",{get:function(){return this.m_isNull},set:function(e){this.m_isNull=e,e&&this._objectPath&&this._objectPath._updateAsNullObject()},enumerable:!0,configurable:!0}),n.prototype._addAction=function(e,t,n){return void 0===t&&(t=null),n||(this.context._pendingRequest.ensureInstantiateObjectPath(this._objectPath),this.context._pendingRequest.ensureInstantiateObjectPaths(e.referencedArgumentObjectPaths)),this.context._pendingRequest.addAction(e),this.context._pendingRequest.addReferencedObjectPath(this._objectPath),this.context._pendingRequest.addReferencedObjectPaths(e.referencedArgumentObjectPaths),this.context._pendingRequest.addActionResultHandler(e,t),l._createPromiseFromResult(null)},n.prototype._addPreviewExecutionAction=function(e){if(!G.isUndefined(this._className)){e.ObjectType=this._className;var t=G._getPropertyValueWithoutCheckLoaded(this,T.idLowerCase);G.isUndefined(t)&&(t=G._getPropertyValueWithoutCheckLoaded(this,T.idPrivate)),G.isUndefined(t)&&(t=G._getPropertyValueWithoutCheckLoaded(this,T.previewExecutionObjectId)),e.ObjectId=t,this.context._pendingRequest.addPreviewExecutionAction(e)}},n.prototype._handleResult=function(e){this._isNull=G.isNullOrUndefined(e),this.context.trackedObjects._autoTrackIfNecessaryWhenHandleObjectResultValue(this,e)},n.prototype._handleIdResult=function(e){this._isNull=G.isNullOrUndefined(e),G.fixObjectPathIfNecessary(this,e),this.context.trackedObjects._autoTrackIfNecessaryWhenHandleObjectResultValue(this,e)},n.prototype._handleRetrieveResult=function(e,t){this._handleIdResult(e)},n.prototype._recursivelySet=function(e,t,i,o,c){var u=e instanceof n,d=e;if(u){if(Object.getPrototypeOf(this)!==Object.getPrototypeOf(e))throw r.RuntimeError._createInvalidArgError({argumentName:"properties",errorLocation:this._className+".set"});e=JSON.parse(JSON.stringify(e))}try{for(var f,p=0;p<i.length;p++)f=i[p],e.hasOwnProperty(f)&&void 0!==e[f]&&(this[f]=e[f]);for(p=0;p<o.length;p++)if(f=o[p],e.hasOwnProperty(f)&&void 0!==e[f]){var h=u?d[f]:e[f];this[f].set(h,t)}var g=!u;t&&!G.isNullOrUndefined(g)&&(g=t.throwOnReadOnly);for(p=0;p<c.length;p++)if(f=c[p],e.hasOwnProperty(f)&&void 0!==e[f]&&g)throw new r.RuntimeError({code:a.invalidArgument,httpStatusCode:400,message:l._getResourceString(J.cannotApplyPropertyThroughSetMethod,f),debugInfo:{errorLocation:f}});for(f in e)if(i.indexOf(f)<0&&o.indexOf(f)<0){var m=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),f);if(!m)throw new r.RuntimeError({code:a.invalidArgument,httpStatusCode:400,message:l._getResourceString(I.propertyDoesNotExist,f),debugInfo:{errorLocation:f}});if(g&&!m.set)throw new r.RuntimeError({code:a.invalidArgument,httpStatusCode:400,message:l._getResourceString(I.attemptingToSetReadOnlyProperty,f),debugInfo:{errorLocation:f}})}}catch(e){throw new r.RuntimeError({code:a.invalidArgument,httpStatusCode:400,message:l._getResourceString(s.invalidArgument,"properties"),debugInfo:{errorLocation:this._className+".set"},innerError:e})}},n}(p);e.ClientObject=w;var x=function(){function e(e){this.m_session=e}return e.prototype.executeAsync=function(e,t,n){var i={url:c.processQuery,method:"POST",headers:n.Headers,body:n.Body},r="";n.Headers&&(r=n.Headers[T.officeControlId]);var a={id:o.nextId(),type:1,flags:t,controlId:r,message:i,customData:e};return l.log(JSON.stringify(a)),this.m_session.sendMessageToHost(a).then((function(e){l.log("Received response: "+JSON.stringify(e));var t,n=e.message;if(200===n.statusCode)t={HttpStatusCode:n.statusCode,ErrorCode:null,ErrorMessage:null,Headers:n.headers,Body:l._parseResponseBody(n)};else{l.log("Error Response:"+n.body);var i=l._parseErrorResponse(n);t={HttpStatusCode:n.statusCode,ErrorCode:i.errorCode,ErrorMessage:i.errorMessage,Headers:n.headers,Body:null}}return t}))},e}(),F=function(e){function t(t){var n=e.call(this)||this;return n.m_bridge=t,n.m_bridge.addHostMessageHandler((function(e){if(3===e.type){var t=e.controlId;if(l.isNullOrEmptyString(t))D.getGenericEventRegistration(t)._handleRichApiMessage(e.message);else{var n=D.peekGenericEventRegistrationOrNull(t);n&&n._handleRichApiMessage(e.message),(n=D.peekGenericEventRegistrationOrNull(""))&&n._handleRichApiMessage(e.message)}}})),n}return __extends(t,e),t.getInstanceIfHostBridgeInited=function(){return o.instance?((l.isNullOrUndefined(t.s_instance)||t.s_instance.m_bridge!==o.instance)&&(t.s_instance=new t(o.instance)),t.s_instance):null},t.prototype._resolveRequestUrlAndHeaderInfo=function(){return l._createPromiseFromResult(null)},t.prototype._createRequestExecutorOrNull=function(){return l.log("NativeBridgeSession::CreateRequestExecutor"),new x(this)},t.prototype.getEventRegistration=function(e){return D.getGenericEventRegistration(e)},t.prototype.sendMessageToHost=function(e){return this.m_bridge.sendMessageToHostAndExpectResponse(e)},t}(n);e.HostBridgeSession=F;var R=function(t){function i(e){var o=t.call(this)||this;if(o.m_customRequestHeaders={},o.m_batchMode=0,o._onRunFinishedNotifiers=[],n._overrideSession)o.m_requestUrlAndHeaderInfoResolver=n._overrideSession;else if((G.isNullOrUndefined(e)||"string"==typeof e&&0===e.length)&&((e=i.defaultRequestUrlAndHeaders)||(e={url:c.localDocument,headers:{}})),"string"==typeof e)o.m_requestUrlAndHeaderInfo={url:e,headers:{}};else if(i.isRequestUrlAndHeaderInfoResolver(e))o.m_requestUrlAndHeaderInfoResolver=e;else{if(!i.isRequestUrlAndHeaderInfo(e))throw r.RuntimeError._createInvalidArgError({argumentName:"url"});var a=e;o.m_requestUrlAndHeaderInfo={url:a.url,headers:{}},l._copyHeaders(a.headers,o.m_requestUrlAndHeaderInfo.headers)}return!o.m_requestUrlAndHeaderInfoResolver&&o.m_requestUrlAndHeaderInfo&&l._isLocalDocumentUrl(o.m_requestUrlAndHeaderInfo.url)&&F.getInstanceIfHostBridgeInited()&&(o.m_requestUrlAndHeaderInfo=null,o.m_requestUrlAndHeaderInfoResolver=F.getInstanceIfHostBridgeInited()),o.m_requestUrlAndHeaderInfoResolver instanceof n&&(o.m_session=o.m_requestUrlAndHeaderInfoResolver),o._processingResult=!1,o._customData=T.iterativeExecutor,o.sync=o.sync.bind(o),o}return __extends(i,t),Object.defineProperty(i.prototype,"session",{get:function(){return this.m_session},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"eventRegistration",{get:function(){return this.m_session?this.m_session.getEventRegistration(this._controlId):r.officeJsEventRegistration},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_url",{get:function(){return this.m_requestUrlAndHeaderInfo?this.m_requestUrlAndHeaderInfo.url:null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_pendingRequest",{get:function(){return null==this.m_pendingRequest&&(this.m_pendingRequest=new M(this)),this.m_pendingRequest},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_controlId",{get:function(){var e=this.m_customRequestHeaders[T.officeControlId];return l.isNullOrUndefined(e)&&(e=""),e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"debugInfo",{get:function(){return{pendingStatements:new q(this._rootObjectPropertyName,this._pendingRequest._objectPaths,this._pendingRequest._actions,e._internalConfig.showDisposeInfoInDebugInfo).process()}},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"trackedObjects",{get:function(){return this.m_trackedObjects||(this.m_trackedObjects=new V(this)),this.m_trackedObjects},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"requestHeaders",{get:function(){return this.m_customRequestHeaders},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"batchMode",{get:function(){return this.m_batchMode},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"getAdditionalHeaders",{set:function(e){this.m_getAdditionalHeaders=e},enumerable:!0,configurable:!0}),i.prototype.ensureInProgressBatchIfBatchMode=function(){if(1===this.m_batchMode&&!this.m_explicitBatchInProgress)throw G.createRuntimeError(a.generalException,l._getResourceString(J.notInsideBatch),null)},i.prototype.load=function(e,t){G.validateContext(this,e);var n=i._parseQueryOption(t);f.createQueryAction(this,e,n,e)},i.prototype.loadRecursive=function(e,t,n){if(!G.isPlainJsonObject(t))throw r.RuntimeError._createInvalidArgError({argumentName:"options"});var o={};for(var a in t)o[a]=i._parseQueryOption(t[a]);var s=P.createRecursiveQueryAction(this,e,{Queries:o,MaxDepth:n});this._pendingRequest.addActionResultHandler(s,e)},i.prototype.trace=function(e){P.createTraceAction(this,e,!0)},i.prototype._processOfficeJsErrorResponse=function(e,t){},i.prototype.ensureRequestUrlAndHeaderInfo=function(){var e=this;return G._createPromiseFromResult(null).then((function(){if(!e.m_requestUrlAndHeaderInfo)return e.m_requestUrlAndHeaderInfoResolver._resolveRequestUrlAndHeaderInfo().then((function(t){if(e.m_requestUrlAndHeaderInfo=t,e.m_requestUrlAndHeaderInfo||(e.m_requestUrlAndHeaderInfo={url:c.localDocument,headers:{}}),G.isNullOrEmptyString(e.m_requestUrlAndHeaderInfo.url)&&(e.m_requestUrlAndHeaderInfo.url=c.localDocument),e.m_requestUrlAndHeaderInfo.headers||(e.m_requestUrlAndHeaderInfo.headers={}),"function"==typeof e.m_requestUrlAndHeaderInfoResolver._createRequestExecutorOrNull){var n=e.m_requestUrlAndHeaderInfoResolver._createRequestExecutorOrNull();n&&(e._requestExecutor=n)}}))}))},i.prototype.syncPrivateMain=function(){var e=this;return this.ensureRequestUrlAndHeaderInfo().then((function(){var t=e._pendingRequest;return e.m_pendingRequest=null,e.processPreSyncPromises(t).then((function(){return e.syncPrivate(t)}))}))},i.prototype.syncPrivate=function(t){var n=this;if(d.isMock())return l._createPromiseFromResult(null);if(!t.hasActions)return this.processPendingEventHandlers(t);var i=t.buildRequestMessageBodyAndRequestFlags(),o=i.body,a=i.flags;this._requestFlagModifier&&(a|=this._requestFlagModifier),this._requestExecutor||(l._isLocalDocumentUrl(this.m_requestUrlAndHeaderInfo.url)?this._requestExecutor=new W(this):this._requestExecutor=new O);var s=this._requestExecutor,u={};l._copyHeaders(this.m_requestUrlAndHeaderInfo.headers,u),l._copyHeaders(this.m_customRequestHeaders,u),delete this.m_customRequestHeaders[T.officeScriptEventId],this.m_getAdditionalHeaders&&l._copyHeaders(this.m_getAdditionalHeaders(),u);var f=d._getCurrentTestNameWithSequenceId();f&&(u[c.testRequestNameHeader]=f);var p={Url:this.m_requestUrlAndHeaderInfo.url,Headers:u,Body:o};t.invalidatePendingInvalidObjectPaths();var h=null,g=null;return this._lastSyncStart="undefined"==typeof performance?Date.now():performance.now(),this._lastRequestFlags=a,s.executeAsync(this._customData,a,p,this._invocationId).then((function(i){return n._lastSyncEnd="undefined"==typeof performance?Date.now():performance.now(),e.config.executePerfLogFunc&&e.config.executePerfLogFunc({syncStart:n._lastSyncStart,syncEnd:n._lastSyncEnd}),h=n.processRequestExecutorResponseMessage(t,i),n.processPendingEventHandlers(t).catch((function(e){l.log("Error in processPendingEventHandlers"),l.log(JSON.stringify(e)),g=e}))})).then((function(){if(h)throw l.log("Throw error from response: "+JSON.stringify(h)),h;if(g){l.log("Throw error from ProcessEventHandler: "+JSON.stringify(g));var e=null;if(g instanceof r.RuntimeError)(e=g).traceMessages=t._responseTraceMessages;else{var n=null;n="string"==typeof g?g:g.message,G.isNullOrEmptyString(n)&&(n=l._getResourceString(J.cannotRegisterEvent)),e=new r.RuntimeError({code:C.cannotRegisterEvent,httpStatusCode:400,message:n,traceMessages:t._responseTraceMessages})}throw e}}))},i.prototype.processRequestExecutorResponseMessage=function(t,n){n.Body&&n.Body.TraceIds&&t._setResponseTraceIds(n.Body.TraceIds);var i=t._responseTraceMessages,o=null;if(n.Body){if(n.Body.Error&&n.Body.Error.ActionIndex>=0){var a=new q(this._rootObjectPropertyName,t._objectPaths,t._actions,!1,!0),s=a.processForDebugStatementInfo(n.Body.Error.ActionIndex);o={statement:s.statement,surroundingStatements:s.surroundingStatements,fullStatements:["Please enable config.extendedErrorLogging to see full statements."]},e.config.extendedErrorLogging&&(a=new q(this._rootObjectPropertyName,t._objectPaths,t._actions,!1,!1),o.fullStatements=a.process())}var c=null;if(n.Body.Results?c=n.Body.Results:n.Body.ProcessedResults&&n.Body.ProcessedResults.Results&&(c=n.Body.ProcessedResults.Results),c){this._processingResult=!0;try{t.processResponse(c)}finally{this._processingResult=!1}}}if(!G.isNullOrEmptyString(n.ErrorCode))return new r.RuntimeError({code:n.ErrorCode,httpStatusCode:n.HttpStatusCode,message:n.ErrorMessage,traceMessages:i,data:{responseBody:n.RawErrorResponseBody}});if(n.Body&&n.Body.Error){var u={errorLocation:n.Body.Error.Location};return o&&(u.statement=o.statement,u.surroundingStatements=o.surroundingStatements,u.fullStatements=o.fullStatements),new r.RuntimeError({code:n.Body.Error.Code,httpStatusCode:n.Body.Error.HttpStatusCode,message:n.Body.Error.Message,traceMessages:i,debugInfo:u})}return null},i.prototype.processPendingEventHandlers=function(e){for(var t=G._createPromiseFromResult(null),n=0;n<e._pendingProcessEventHandlers.length;n++){var i=e._pendingProcessEventHandlers[n];t=t.then(this.createProcessOneEventHandlersFunc(i,e))}return t},i.prototype.createProcessOneEventHandlersFunc=function(e,t){return function(){return e._processRegistration(t)}},i.prototype.processPreSyncPromises=function(e){for(var t=G._createPromiseFromResult(null),n=0;n<e._preSyncPromises.length;n++){var i=e._preSyncPromises[n];t=t.then(this.createProcessOneProSyncFunc(i))}return t},i.prototype.createProcessOneProSyncFunc=function(e){return function(){return e}},i.prototype.sync=function(e){return d.isMock()?l._createPromiseFromResult(e):this.syncPrivateMain().then((function(){return e}))},i.prototype.batch=function(e){var t=this;if(1!==this.m_batchMode)return l._createPromiseFromException(G.createRuntimeError(a.generalException,null,null));if(this.m_explicitBatchInProgress)return l._createPromiseFromException(G.createRuntimeError(a.generalException,l._getResourceString(J.pendingBatchInProgress),null));if(G.isNullOrUndefined(e))return G._createPromiseFromResult(null);this.m_explicitBatchInProgress=!0;var n,i,r,o=this.m_pendingRequest;this.m_pendingRequest=new M(this);try{n=e(this._rootObject,this)}catch(e){return this.m_explicitBatchInProgress=!1,this.m_pendingRequest=o,l._createPromiseFromException(e)}return"object"==typeof n&&n&&"function"==typeof n.then?r=G._createPromiseFromResult(null).then((function(){return n})).then((function(e){return t.m_explicitBatchInProgress=!1,i=t.m_pendingRequest,t.m_pendingRequest=o,e})).catch((function(e){return t.m_explicitBatchInProgress=!1,i=t.m_pendingRequest,t.m_pendingRequest=o,l._createPromiseFromException(e)})):(this.m_explicitBatchInProgress=!1,i=this.m_pendingRequest,this.m_pendingRequest=o,r=G._createPromiseFromResult(n)),r.then((function(e){return t.ensureRequestUrlAndHeaderInfo().then((function(){return t.syncPrivate(i)})).then((function(){return e}))}))},i._run=function(e,t,n,r,o,a){return void 0===n&&(n=3),void 0===r&&(r=5e3),i._runCommon("run",null,e,0,t,n,r,null,null,o,a)},i.isValidRequestInfo=function(e){return"string"==typeof e||i.isRequestUrlAndHeaderInfo(e)||i.isRequestUrlAndHeaderInfoResolver(e)},i.isRequestUrlAndHeaderInfo=function(e){return"object"==typeof e&&null!==e&&Object.getPrototypeOf(e)===Object.getPrototypeOf({})&&!G.isNullOrUndefined(e.url)},i.isRequestUrlAndHeaderInfoResolver=function(e){return"object"==typeof e&&null!==e&&"function"==typeof e._resolveRequestUrlAndHeaderInfo},i._runBatch=function(e,t,n,r,o,a,s,c,u){return void 0===a&&(a=3),void 0===s&&(s=5e3),i._runBatchCommon(0,e,t,n,a,s,r,o,c,u)},i._runExplicitBatch=function(e,t,n,r,o,a,s,c,u){return void 0===a&&(a=3),void 0===s&&(s=5e3),i._runBatchCommon(1,e,t,n,a,s,r,o,c,u)},i._runBatchCommon=function(e,t,n,r,o,a,s,c,u,l){var d,f;void 0===o&&(o=3),void 0===a&&(a=5e3);var p=null,h=null,g=null,m=0,v=null;if(n.length>0)if(i.isValidRequestInfo(n[0]))p=n[0],m=1;else if(G.isPlainJsonObject(n[0])){if(null!=(p=(v=n[0]).session)&&!i.isValidRequestInfo(p))return i.createErrorPromise(t);h=v.getAdditionalHeaders,g=v.previousObjects,m=1}if(n.length==m+1)f=n[m+0];else{if(null!=v||n.length!=m+2)return i.createErrorPromise(t);g=n[m+0],f=n[m+1]}if(null!=g)if(g instanceof w)d=function(){return g.context};else if(g instanceof i)d=function(){return g};else{if(!Array.isArray(g))return i.createErrorPromise(t);var y=g;if(0==y.length)return i.createErrorPromise(t);for(var _=0;_<y.length;_++){if(!(y[_]instanceof w))return i.createErrorPromise(t);if(y[_].context!=y[0].context)return i.createErrorPromise(t,J.invalidRequestContext)}d=function(){return y[0].context}}else d=r;var b=null;s&&(b=function(e){return s(v||{},e)});var O=null;return c&&(O=function(e){return c(v||{},e)}),i._runCommon(t,p,d,e,f,o,a,b,O,u,l,h)},i.createErrorPromise=function(e,t){return void 0===t&&(t=s.invalidArgument),l._createPromiseFromException(G.createRuntimeError(t,l._getResourceString(t),e))},i._runCommon=function(t,r,o,a,s,c,u,d,f,p,h,g){n._overrideSession&&(r=n._overrideSession);var m,v,y,_=l.createPromise((function(e,t){e()})),b=!1;return _.then((function(){if((m=o(r)).getAdditionalHeaders=g,m._autoCleanup)return new e.Promise((function(e,t){m._onRunFinishedNotifiers.push((function(){m._autoCleanup=!0,e()}))}));m._autoCleanup=!0})).then((function(){return"function"!=typeof s?i.createErrorPromise(t):(y=m.m_batchMode,m.m_batchMode=a,d&&d(m),e=s(1==a?m.batch.bind(m):m),(G.isNullOrUndefined(e)||"function"!=typeof e.then)&&G.throwError(J.runMustReturnPromise),e);var e})).then((function(e){return 1===a?e:m.sync(e)})).then((function(e){b=!0,v=e})).catch((function(e){v=e})).then((function(){var e=m.trackedObjects._retrieveAndClearAutoCleanupList();for(var t in m._autoCleanup=!1,m.m_batchMode=y,e)e[t]._objectPath.isValid=!1;var n=0;if(G._synchronousCleanup||i.isRequestUrlAndHeaderInfoResolver(r))return o();function o(){n++;var t=m.m_pendingRequest,i=m.m_batchMode,r=new M(m);m.m_pendingRequest=r,m.m_batchMode=0;try{for(var a in e)m.trackedObjects.remove(e[a]);f&&f(m)}finally{m.m_batchMode=i,m.m_pendingRequest=t}return m.syncPrivate(r).then((function(){p&&p(n)})).catch((function(){h&&h(n),n<c&&setTimeout((function(){o()}),u)}))}o()})).then((function(){m._onRunFinishedNotifiers&&m._onRunFinishedNotifiers.length>0&&m._onRunFinishedNotifiers.shift()();if(b)return v;throw v}))},i}(m);e.ClientRequestContext=R;var N=function(){function e(e,t){this.m_proxy=e,this.m_shouldPolyfill=t;var n=e[T.scalarPropertyNames],i=e[T.navigationPropertyNames],r=e[T.className],o=e[T.isCollection];if(n)for(var a=0;a<n.length;a++)G.definePropertyThrowUnloadedException(this,r,n[a]);if(i)for(a=0;a<i.length;a++)G.definePropertyThrowUnloadedException(this,r,i[a]);o&&G.definePropertyThrowUnloadedException(this,r,T.itemsLowerCase)}return Object.defineProperty(e.prototype,"$proxy",{get:function(){return this.m_proxy},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"$isNullObject",{get:function(){if(!this.m_isLoaded)throw new r.RuntimeError({code:C.valueNotLoaded,httpStatusCode:400,message:l._getResourceString(J.valueNotLoaded),debugInfo:{errorLocation:"retrieveResult.$isNullObject"}});return this.m_isNullObject},enumerable:!0,configurable:!0}),e.prototype.toJSON=function(){if(this.m_isLoaded)return this.m_isNullObject?null:(G.isUndefined(this.m_json)&&(this.m_json=G.purifyJson(this.m_value)),this.m_json)},e.prototype.toString=function(){return JSON.stringify(this.toJSON())},e.prototype._handleResult=function(e){this.m_isLoaded=!0,null===e||"object"==typeof e&&e&&e._IsNull?(this.m_isNullObject=!0,e=null):this.m_isNullObject=!1,this.m_shouldPolyfill&&(e=G.changePropertyNameToCamelLowerCase(e)),this.m_value=e,this.m_proxy._handleRetrieveResult(e,this)},e}(),T=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.getItemAt="GetItemAt",t.index="_Index",t.iterativeExecutor="IterativeExecutor",t.isTracked="_IsTracked",t.eventMessageCategory=65536,t.eventWorkbookId="Workbook",t.eventSourceRemote="Remote",t.proxy="$proxy",t.className="_className",t.isCollection="_isCollection",t.collectionPropertyPath="_collectionPropertyPath",t.objectPathInfoDoNotKeepReferenceFieldName="D",t.officeScriptEventId="X-OfficeScriptEventId",t.officeScriptFireRecordingEvent="X-OfficeScriptFireRecordingEvent",t.officeControlId="X-OfficeControlId",t}(S);e.Constants=T;var M=function(e){function t(t){var n=e.call(this,t)||this;return n.m_context=t,n.m_pendingProcessEventHandlers=[],n.m_pendingEventHandlerActions={},n.m_traceInfos={},n.m_responseTraceIds={},n.m_responseTraceMessages=[],n}return __extends(t,e),Object.defineProperty(t.prototype,"traceInfos",{get:function(){return this.m_traceInfos},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_responseTraceMessages",{get:function(){return this.m_responseTraceMessages},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_responseTraceIds",{get:function(){return this.m_responseTraceIds},enumerable:!0,configurable:!0}),t.prototype._setResponseTraceIds=function(e){if(e)for(var t=0;t<e.length;t++){var n=e[t];this.m_responseTraceIds[n]=n;var i=this.m_traceInfos[n];l.isNullOrUndefined(i)||this.m_responseTraceMessages.push(i)}},t.prototype.addTrace=function(e,t){this.m_traceInfos[e]=t},t.prototype._addPendingEventHandlerAction=function(e,t){this.m_pendingEventHandlerActions[e._id]||(this.m_pendingEventHandlerActions[e._id]=[],this.m_pendingProcessEventHandlers.push(e)),this.m_pendingEventHandlerActions[e._id].push(t)},Object.defineProperty(t.prototype,"_pendingProcessEventHandlers",{get:function(){return this.m_pendingProcessEventHandlers},enumerable:!0,configurable:!0}),t.prototype._getPendingEventHandlerActions=function(e){return this.m_pendingEventHandlerActions[e._id]},t}(y);e.ClientRequest=M;var j=function(){function e(e,t,n,i){var r=this;this.m_id=e._nextId(),this.m_context=e,this.m_name=n,this.m_handlers=[],this.m_registered=!1,this.m_eventInfo=i,this.m_callback=function(e){r.m_eventInfo.eventArgsTransformFunc(e).then((function(e){return r.fireEvent(e)}))}}return Object.defineProperty(e.prototype,"_registered",{get:function(){return this.m_registered},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_id",{get:function(){return this.m_id},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_handlers",{get:function(){return this.m_handlers},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_context",{get:function(){return this.m_context},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_callback",{get:function(){return this.m_callback},enumerable:!0,configurable:!0}),e.prototype.add=function(e){var t=P.createTraceAction(this.m_context,null,!1);return this.m_context._pendingRequest._addPendingEventHandlerAction(this,{id:t.actionInfo.Id,handler:e,operation:0}),new k(this.m_context,this,e)},e.prototype.remove=function(e){var t=P.createTraceAction(this.m_context,null,!1);this.m_context._pendingRequest._addPendingEventHandlerAction(this,{id:t.actionInfo.Id,handler:e,operation:1})},e.prototype.removeAll=function(){var e=P.createTraceAction(this.m_context,null,!1);this.m_context._pendingRequest._addPendingEventHandlerAction(this,{id:e.actionInfo.Id,handler:null,operation:2})},e.prototype._processRegistration=function(e){var t=this,n=l._createPromiseFromResult(null),i=e._getPendingEventHandlerActions(this);if(!i)return n;for(var r=[],o=0;o<this.m_handlers.length;o++)r.push(this.m_handlers[o]);var a=!1;for(o=0;o<i.length;o++)if(e._responseTraceIds[i[o].id])switch(a=!0,i[o].operation){case 0:r.push(i[o].handler);break;case 1:for(var s=r.length-1;s>=0;s--)if(r[s]===i[o].handler){r.splice(s,1);break}break;case 2:r=[]}return a&&(!this.m_registered&&r.length>0?n=n.then((function(){return t.m_eventInfo.registerFunc(t.m_callback)})).then((function(){return t.m_registered=!0})):this.m_registered&&0==r.length&&(n=n.then((function(){return t.m_eventInfo.unregisterFunc(t.m_callback)})).catch((function(e){l.log("Error when unregister event: "+JSON.stringify(e))})).then((function(){return t.m_registered=!1}))),n=n.then((function(){return t.m_handlers=r}))),n},e.prototype.fireEvent=function(e){for(var t=[],n=0;n<this.m_handlers.length;n++){var i=this.m_handlers[n],r=l._createPromiseFromResult(null).then(this.createFireOneEventHandlerFunc(i,e)).catch((function(e){l.log("Error when invoke handler: "+JSON.stringify(e))}));t.push(r)}l.Promise.all(t)},e.prototype.createFireOneEventHandlerFunc=function(e,t){return function(){return e(t)}},e}();e.EventHandlers=j;var k=function(){function e(e,t,n){this.m_context=e,this.m_allHandlers=t,this.m_handler=n}return Object.defineProperty(e.prototype,"context",{get:function(){return this.m_context},enumerable:!0,configurable:!0}),e.prototype.remove=function(){this.m_allHandlers&&this.m_handler&&(this.m_allHandlers.remove(this.m_handler),this.m_allHandlers=null,this.m_handler=null)},e}();e.EventHandlerResult=k,function(e){var t=function(){function t(){}return t.prototype.register=function(t,n,i){switch(t){case 4:return G.promisify((function(e){return Office.context.document.bindings.getByIdAsync(n,e)})).then((function(e){return G.promisify((function(t){return e.addHandlerAsync(Office.EventType.BindingDataChanged,i,t)}))}));case 3:return G.promisify((function(e){return Office.context.document.bindings.getByIdAsync(n,e)})).then((function(e){return G.promisify((function(t){return e.addHandlerAsync(Office.EventType.BindingSelectionChanged,i,t)}))}));case 2:return G.promisify((function(e){return Office.context.document.addHandlerAsync(Office.EventType.DocumentSelectionChanged,i,e)}));case 1:return G.promisify((function(e){return Office.context.document.settings.addHandlerAsync(Office.EventType.SettingsChanged,i,e)}));case 5:return OSF.DDA.RichApi.richApiMessageManager.register(i);case 13:return G.promisify((function(e){return Office.context.document.addHandlerAsync(Office.EventType.ObjectDeleted,i,{id:n},e)}));case 14:return G.promisify((function(e){return Office.context.document.addHandlerAsync(Office.EventType.ObjectSelectionChanged,i,{id:n},e)}));case 15:return G.promisify((function(e){return Office.context.document.addHandlerAsync(Office.EventType.ObjectDataChanged,i,{id:n},e)}));case 16:return G.promisify((function(e){return Office.context.document.addHandlerAsync(Office.EventType.ContentControlAdded,i,{id:n},e)}));default:throw e.RuntimeError._createInvalidArgError({argumentName:"eventId"})}},t.prototype.unregister=function(t,n,i){switch(t){case 4:return G.promisify((function(e){return Office.context.document.bindings.getByIdAsync(n,e)})).then((function(e){return G.promisify((function(t){return e.removeHandlerAsync(Office.EventType.BindingDataChanged,{handler:i},t)}))}));case 3:return G.promisify((function(e){return Office.context.document.bindings.getByIdAsync(n,e)})).then((function(e){return G.promisify((function(t){return e.removeHandlerAsync(Office.EventType.BindingSelectionChanged,{handler:i},t)}))}));case 2:return G.promisify((function(e){return Office.context.document.removeHandlerAsync(Office.EventType.DocumentSelectionChanged,{handler:i},e)}));case 1:return G.promisify((function(e){return Office.context.document.settings.removeHandlerAsync(Office.EventType.SettingsChanged,{handler:i},e)}));case 5:return G.promisify((function(e){return OSF.DDA.RichApi.richApiMessageManager.removeHandlerAsync("richApiMessage",{handler:i},e)}));case 13:return G.promisify((function(e){return Office.context.document.removeHandlerAsync(Office.EventType.ObjectDeleted,{id:n,handler:i},e)}));case 14:return G.promisify((function(e){return Office.context.document.removeHandlerAsync(Office.EventType.ObjectSelectionChanged,{id:n,handler:i},e)}));case 15:return G.promisify((function(e){return Office.context.document.removeHandlerAsync(Office.EventType.ObjectDataChanged,{id:n,handler:i},e)}));case 16:return G.promisify((function(e){return Office.context.document.removeHandlerAsync(Office.EventType.ContentControlAdded,{id:n,handler:i},e)}));default:throw e.RuntimeError._createInvalidArgError({argumentName:"eventId"})}},t}();e.officeJsEventRegistration=new t}(r=e._Internal||(e._Internal={}));var H=function(){function e(e,t){this.m_handlersByEventByTarget={},this.m_registerEventImpl=e,this.m_unregisterEventImpl=t}return e.getTargetIdOrDefault=function(e){return G.isNullOrUndefined(e)?"":e},e.prototype.getHandlers=function(t,n){n=e.getTargetIdOrDefault(n);var i=this.m_handlersByEventByTarget[t];i||(i={},this.m_handlersByEventByTarget[t]=i);var r=i[n];return r||(r=[],i[n]=r),r},e.prototype.callHandlers=function(e,t,n){for(var i=this.getHandlers(e,t),r=0;r<i.length;r++)i[r](n)},e.prototype.hasHandlers=function(e,t){return this.getHandlers(e,t).length>0},e.prototype.register=function(e,t,n){if(!n)throw r.RuntimeError._createInvalidArgError({argumentName:"handler"});var i=this.getHandlers(e,t);return i.push(n),1===i.length?this.m_registerEventImpl(e,t):G._createPromiseFromResult(null)},e.prototype.unregister=function(e,t,n){if(!n)throw r.RuntimeError._createInvalidArgError({argumentName:"handler"});for(var i=this.getHandlers(e,t),o=i.length-1;o>=0;o--)if(i[o]===n){i.splice(o,1);break}return 0===i.length?this.m_unregisterEventImpl(e,t):G._createPromiseFromResult(null)},e}();e.EventRegistration=H;var D=function(){function e(){this.m_eventRegistration=new H(this._registerEventImpl.bind(this),this._unregisterEventImpl.bind(this)),this.m_richApiMessageHandler=this._handleRichApiMessage.bind(this)}return e.prototype.ready=function(){var t=this;return this.m_ready||(e._testReadyImpl?this.m_ready=e._testReadyImpl().then((function(){t.m_isReady=!0})):o.instance?this.m_ready=G._createPromiseFromResult(null).then((function(){t.m_isReady=!0})):this.m_ready=r.officeJsEventRegistration.register(5,"",this.m_richApiMessageHandler).then((function(){t.m_isReady=!0}))),this.m_ready},Object.defineProperty(e.prototype,"isReady",{get:function(){return this.m_isReady},enumerable:!0,configurable:!0}),e.prototype.register=function(e,t,n){var i=this;return this.ready().then((function(){return i.m_eventRegistration.register(e,t,n)}))},e.prototype.unregister=function(e,t,n){var i=this;return this.ready().then((function(){return i.m_eventRegistration.unregister(e,t,n)}))},e.prototype._registerEventImpl=function(e,t){return G._createPromiseFromResult(null)},e.prototype._unregisterEventImpl=function(e,t){return G._createPromiseFromResult(null)},e.prototype._handleRichApiMessage=function(e){if(e&&e.entries)for(var t=0;t<e.entries.length;t++){var n=e.entries[t];if(n.messageCategory==T.eventMessageCategory){l._logEnabled&&l.log(JSON.stringify(n));var i=n.messageType,r=n.targetId;if(this.m_eventRegistration.hasHandlers(i,r)){var o=JSON.parse(n.message);n.isRemoteOverride&&(o.source=T.eventSourceRemote),this.m_eventRegistration.callHandlers(i,r,o)}}}},e.getGenericEventRegistration=function(t){l.isNullOrUndefined(t)&&(t="");var n=e.s_genericEventRegistrations[t];return n||(n=new e,e.s_genericEventRegistrations[t]=n),n},e.peekGenericEventRegistrationOrNull=function(t){return l.isNullOrUndefined(t)&&(t=""),e.s_genericEventRegistrations[t]},e.richApiMessageEventCategory=65536,e.s_genericEventRegistrations={},e}();e.GenericEventRegistration=D,e._testSetRichApiMessageReadyImpl=function(e){D._testReadyImpl=e},e._testTriggerRichApiMessageEvent=function(e){D.getGenericEventRegistration("")._handleRichApiMessage(e)};var U=function(e){function t(t,n,i,r){var o=e.call(this,t,n,i,r)||this;return o.m_genericEventInfo=r,o}return __extends(t,e),t.prototype.add=function(e){var t=this;0==this._handlers.length&&this.m_genericEventInfo.registerFunc&&this.m_genericEventInfo.registerFunc();var n=this._context._controlId;return D.getGenericEventRegistration(n).isReady||this._context._pendingRequest._addPreSyncPromise(D.getGenericEventRegistration(n).ready()),P.createTraceMarkerForCallback(this._context,(function(){t._handlers.push(e),1==t._handlers.length&&D.getGenericEventRegistration(n).register(t.m_genericEventInfo.eventType,t.m_genericEventInfo.getTargetIdFunc(),t._callback)})),new k(this._context,this,e)},t.prototype.remove=function(e){var t=this;1==this._handlers.length&&this.m_genericEventInfo.unregisterFunc&&this.m_genericEventInfo.unregisterFunc();var n=this._context._controlId;P.createTraceMarkerForCallback(this._context,(function(){for(var i=t._handlers,r=i.length-1;r>=0;r--)if(i[r]===e){i.splice(r,1);break}0==i.length&&D.getGenericEventRegistration(n).unregister(t.m_genericEventInfo.eventType,t.m_genericEventInfo.getTargetIdFunc(),t._callback)}))},t.prototype.removeAll=function(){},t}(j);e.GenericEventHandlers=U;var L=function(){function e(e){this.m_clientObject=e}return e.prototype._handleResult=function(e){this.m_clientObject._handleIdResult(e)},e}(),B=function(){function e(){}return e.createGlobalObjectObjectPath=function(e){var t={Id:e._nextId(),ObjectPathType:1,Name:""};return new g(t,null,!1,!1,1,4)},e.createNewObjectObjectPath=function(e,t,n,i){var r={Id:e._nextId(),ObjectPathType:2,Name:t};return new g(r,null,n,!1,1,G._fixupApiFlags(i))},e.createPropertyObjectPath=function(e,t,n,i,r,o){var a={Id:e._nextId(),ObjectPathType:4,Name:n,ParentObjectPathId:t._objectPath.objectPathInfo.Id};return new g(a,t._objectPath,i,r,1,G._fixupApiFlags(o))},e.createIndexerObjectPath=function(e,t,n){var i={Id:e._nextId(),ObjectPathType:5,Name:"",ParentObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}};return i.ArgumentInfo.Arguments=n,new g(i,t._objectPath,!1,!1,1,4)},e.createIndexerObjectPathUsingParentPath=function(e,t,n){var i={Id:e._nextId(),ObjectPathType:5,Name:"",ParentObjectPathId:t.objectPathInfo.Id,ArgumentInfo:{}};return i.ArgumentInfo.Arguments=n,new g(i,t,!1,!1,1,4)},e.createMethodObjectPath=function(e,t,n,i,r,o,a,s,c){var u={Id:e._nextId(),ObjectPathType:3,Name:n,ParentObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}},l=G.setMethodArguments(e,u.ArgumentInfo,r),d=new g(u,t._objectPath,o,a,i,G._fixupApiFlags(c));return d.argumentObjectPaths=l,d.getByIdMethodName=s,d},e.createReferenceIdObjectPath=function(e,t){var n={Id:e._nextId(),ObjectPathType:6,Name:t,ArgumentInfo:{}};return new g(n,null,!1,!1,1,4)},e.createChildItemObjectPathUsingIndexerOrGetItemAt=function(t,n,i,r,o){var a=G.tryGetObjectIdFromLoadOrRetrieveResult(r);return t&&!G.isNullOrUndefined(a)?e.createChildItemObjectPathUsingIndexer(n,i,r):e.createChildItemObjectPathUsingGetItemAt(n,i,r,o)},e.createChildItemObjectPathUsingIndexer=function(e,t,n){var i=G.tryGetObjectIdFromLoadOrRetrieveResult(n),r=r={Id:e._nextId(),ObjectPathType:5,Name:"",ParentObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}};return r.ArgumentInfo.Arguments=[i],new g(r,t._objectPath,!1,!1,1,4)},e.createChildItemObjectPathUsingGetItemAt=function(e,t,n,i){var r=n[T.index];r&&(i=r);var o={Id:e._nextId(),ObjectPathType:3,Name:T.getItemAt,ParentObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}};return o.ArgumentInfo.Arguments=[i],new g(o,t._objectPath,!1,!1,1,4)},e}();e.ObjectPathFactory=B;var W=function(){function t(e){this.m_context=e}return t.prototype.executeAsync=function(n,i,r,o){var a=this,s=u.buildMessageArrayForIRequestExecutor(n,i,r,t.SourceLibHeaderValue,o),c=this.m_context._blockWrite&&0!=(1&i);if(c)throw"Block Write: "+c;return new e.Promise((function(e,t){OSF.DDA.RichApi.executeRichApiRequestAsync(s,(function(t){var n;l.log("Response:"),l.log(JSON.stringify(t)),"succeeded"==t.status?n=u.buildResponseOnSuccess(u.getResponseBody(t),u.getResponseHeaders(t)):(n=u.buildResponseOnError(t.error.code,t.error.message),a.m_context._processOfficeJsErrorResponse(t.error.code,n)),e(n)}))}))},t.SourceLibHeaderValue="officejs",t}(),V=function(){function e(e){this._autoCleanupList={},this.m_context=e}return e.prototype.add=function(e){var t=this;Array.isArray(e)?e.forEach((function(e){return t._addCommon(e,!0)})):this._addCommon(e,!0)},e.prototype._autoAdd=function(e){this._addCommon(e,!1),this._autoCleanupList[e._objectPath.objectPathInfo.Id]=e},e.prototype._autoTrackIfNecessaryWhenHandleObjectResultValue=function(e,t){this.m_context._autoCleanup&&!e[T.isTracked]&&e!==this.m_context._rootObject&&t&&!G.isNullOrEmptyString(t[T.referenceId])&&(this._autoCleanupList[e._objectPath.objectPathInfo.Id]=e,e[T.isTracked]=!0)},e.prototype._addCommon=function(e,t){if(e[T.isTracked])t&&this.m_context._autoCleanup&&delete this._autoCleanupList[e._objectPath.objectPathInfo.Id];else{var n=e[T.referenceId];if(e._objectPath.objectPathInfo[T.objectPathInfoDoNotKeepReferenceFieldName])throw G.createRuntimeError(a.generalException,l._getResourceString(J.objectIsUntracked),null);G.isNullOrEmptyString(n)&&e._KeepReference&&(e._KeepReference(),P.createInstantiateAction(this.m_context,e),t&&this.m_context._autoCleanup&&delete this._autoCleanupList[e._objectPath.objectPathInfo.Id],e[T.isTracked]=!0)}},e.prototype.remove=function(e){var t=this;Array.isArray(e)?e.forEach((function(e){return t._removeCommon(e)})):this._removeCommon(e)},e.prototype._removeCommon=function(e){e._objectPath.objectPathInfo[T.objectPathInfoDoNotKeepReferenceFieldName]=!0,e.context._pendingRequest._removeKeepReferenceAction(e._objectPath.objectPathInfo.Id);var t=e[T.referenceId];if(!G.isNullOrEmptyString(t)){var n=this.m_context._rootObject;n._RemoveReference&&n._RemoveReference(t)}delete e[T.isTracked]},e.prototype._retrieveAndClearAutoCleanupList=function(){var e=this._autoCleanupList;return this._autoCleanupList={},e},e}();e.TrackedObjects=V;var q=function(){function t(e,t,n,i,r){e||(e="root"),this.m_globalObjName=e,this.m_referencedObjectPaths=t,this.m_actions=n,this.m_statements=[],this.m_variableNameForObjectPathMap={},this.m_variableNameToObjectPathMap={},this.m_declaredObjectPathMap={},this.m_showDispose=i,this.m_removePII=r}return t.prototype.process=function(){this.m_showDispose&&M._calculateLastUsedObjectPathIds(this.m_actions);for(var e=0;e<this.m_actions.length;e++)this.processOneAction(this.m_actions[e]);return this.m_statements},t.prototype.processForDebugStatementInfo=function(e){this.m_showDispose&&M._calculateLastUsedObjectPathIds(this.m_actions);this.m_statements=[];for(var t=-1,n=0;n<this.m_actions.length&&(this.processOneAction(this.m_actions[n]),e==n&&(t=this.m_statements.length-1),!(t>=0&&this.m_statements.length>t+5+1));n++);if(t<0)return null;var i=t-5;i<0&&(i=0);var r=t+1+5;r>this.m_statements.length&&(r=this.m_statements.length);var o=[];0!=i&&o.push("...");for(var a=i;a<t;a++)o.push(this.m_statements[a]);o.push("// >>>>>"),o.push(this.m_statements[t]),o.push("// <<<<<");for(var s=t+1;s<r;s++)o.push(this.m_statements[s]);return r<this.m_statements.length&&o.push("..."),{statement:this.m_statements[t],surroundingStatements:o}},t.prototype.processOneAction=function(e){switch(e.actionInfo.ActionType){case 1:this.processInstantiateAction(e);break;case 3:this.processMethodAction(e);break;case 2:this.processQueryAction(e);break;case 7:this.processQueryAsJsonAction(e);break;case 6:this.processRecursiveQueryAction(e);break;case 4:this.processSetPropertyAction(e);break;case 5:this.processTraceAction(e);break;case 8:this.processEnsureUnchangedAction(e);break;case 9:this.processUpdateAction(e)}},t.prototype.processInstantiateAction=function(e){var t=e.actionInfo.ObjectPathId,n=this.m_referencedObjectPaths[t],i=this.getObjVarName(t);if(this.m_declaredObjectPathMap[t]){r="// Instantiate {"+i+"}";r=this.appendDisposeCommentIfRelevant(r,e),this.m_statements.push(r)}else{var r="var "+i+" = "+this.buildObjectPathExpressionWithParent(n)+";";r=this.appendDisposeCommentIfRelevant(r,e),this.m_statements.push(r),this.m_declaredObjectPathMap[t]=i}},t.prototype.processMethodAction=function(t){var n=t.actionInfo.Name;if("_KeepReference"===n){if(!e._internalConfig.showInternalApiInDebugInfo)return;n="track"}var i=this.getObjVarName(t.actionInfo.ObjectPathId)+"."+G._toCamelLowerCase(n)+"("+this.buildArgumentsExpression(t.actionInfo.ArgumentInfo)+");";i=this.appendDisposeCommentIfRelevant(i,t),this.m_statements.push(i)},t.prototype.processQueryAction=function(e){var t=this.buildQueryExpression(e),n=this.getObjVarName(e.actionInfo.ObjectPathId)+".load("+t+");";n=this.appendDisposeCommentIfRelevant(n,e),this.m_statements.push(n)},t.prototype.processQueryAsJsonAction=function(e){var t=this.buildQueryExpression(e),n=this.getObjVarName(e.actionInfo.ObjectPathId)+".retrieve("+t+");";n=this.appendDisposeCommentIfRelevant(n,e),this.m_statements.push(n)},t.prototype.processRecursiveQueryAction=function(e){var t="";e.actionInfo.RecursiveQueryInfo&&(t=JSON.stringify(e.actionInfo.RecursiveQueryInfo));var n=this.getObjVarName(e.actionInfo.ObjectPathId)+".loadRecursive("+t+");";n=this.appendDisposeCommentIfRelevant(n,e),this.m_statements.push(n)},t.prototype.processSetPropertyAction=function(e){var t=this.getObjVarName(e.actionInfo.ObjectPathId)+"."+G._toCamelLowerCase(e.actionInfo.Name)+" = "+this.buildArgumentsExpression(e.actionInfo.ArgumentInfo)+";";t=this.appendDisposeCommentIfRelevant(t,e),this.m_statements.push(t)},t.prototype.processTraceAction=function(e){var t="context.trace();";t=this.appendDisposeCommentIfRelevant(t,e),this.m_statements.push(t)},t.prototype.processEnsureUnchangedAction=function(e){var t=this.getObjVarName(e.actionInfo.ObjectPathId)+".ensureUnchanged("+JSON.stringify(e.actionInfo.ObjectState)+");";t=this.appendDisposeCommentIfRelevant(t,e),this.m_statements.push(t)},t.prototype.processUpdateAction=function(e){var t=this.getObjVarName(e.actionInfo.ObjectPathId)+".update("+JSON.stringify(e.actionInfo.ObjectState)+");";t=this.appendDisposeCommentIfRelevant(t,e),this.m_statements.push(t)},t.prototype.appendDisposeCommentIfRelevant=function(e,t){var n=this;if(this.m_showDispose){var i=t.actionInfo.L;if(i&&i.length>0)return e+" // And then dispose {"+i.map((function(e){return n.getObjVarName(e)})).join(", ")+"}"}return e},t.prototype.buildQueryExpression=function(e){if(e.actionInfo.QueryInfo){var t={};return t.select=e.actionInfo.QueryInfo.Select,t.expand=e.actionInfo.QueryInfo.Expand,t.skip=e.actionInfo.QueryInfo.Skip,t.top=e.actionInfo.QueryInfo.Top,void 0===t.top&&void 0===t.skip&&void 0===t.expand?void 0===t.select?"":JSON.stringify(t.select):JSON.stringify(t)}return""},t.prototype.buildObjectPathExpressionWithParent=function(e){return(5==e.objectPathInfo.ObjectPathType||3==e.objectPathInfo.ObjectPathType||4==e.objectPathInfo.ObjectPathType)&&e.objectPathInfo.ParentObjectPathId?this.getObjVarName(e.objectPathInfo.ParentObjectPathId)+"."+this.buildObjectPathExpression(e):this.buildObjectPathExpression(e)},t.prototype.buildObjectPathExpression=function(e){var t=this.buildObjectPathInfoExpression(e.objectPathInfo),n=e.originalObjectPathInfo;return n&&(t=t+" /* originally "+this.buildObjectPathInfoExpression(n)+" */"),t},t.prototype.buildObjectPathInfoExpression=function(e){switch(e.ObjectPathType){case 1:return"context."+this.m_globalObjName;case 5:return"getItem("+this.buildArgumentsExpression(e.ArgumentInfo)+")";case 3:return G._toCamelLowerCase(e.Name)+"("+this.buildArgumentsExpression(e.ArgumentInfo)+")";case 2:return e.Name+".newObject()";case 7:return"null";case 4:return G._toCamelLowerCase(e.Name);case 6:return"context."+this.m_globalObjName+"._getObjectByReferenceId("+JSON.stringify(e.Name)+")"}},t.prototype.buildArgumentsExpression=function(e){var t="";if(!e.Arguments||0===e.Arguments.length)return t;if(this.m_removePII)return void 0===e.Arguments[0]?t:"...";for(var n=0;n<e.Arguments.length;n++)n>0&&(t+=", "),t+=this.buildArgumentLiteral(e.Arguments[n],e.ReferencedObjectPathIds?e.ReferencedObjectPathIds[n]:null);return"undefined"===t&&(t=""),t},t.prototype.buildArgumentLiteral=function(e,t){return"number"==typeof e&&e===t?this.getObjVarName(t):JSON.stringify(e)},t.prototype.getObjVarNameBase=function(e){var t="v",n=this.m_referencedObjectPaths[e];if(n)switch(n.objectPathInfo.ObjectPathType){case 1:t=this.m_globalObjName;break;case 4:t=G._toCamelLowerCase(n.objectPathInfo.Name);break;case 3:var i=n.objectPathInfo.Name;i.length>3&&"Get"===i.substr(0,3)&&(i=i.substr(3)),t=G._toCamelLowerCase(i);break;case 5:var r=this.getObjVarNameBase(n.objectPathInfo.ParentObjectPathId);t="s"===r.charAt(r.length-1)?r.substr(0,r.length-1):r+"Item"}return t},t.prototype.getObjVarName=function(e){if(this.m_variableNameForObjectPathMap[e])return this.m_variableNameForObjectPathMap[e];var t=this.getObjVarNameBase(e);if(!this.m_variableNameToObjectPathMap[t])return this.m_variableNameForObjectPathMap[e]=t,this.m_variableNameToObjectPathMap[t]=e,t;for(var n=1;this.m_variableNameToObjectPathMap[t+n.toString()];)n++;return t+=n.toString(),this.m_variableNameForObjectPathMap[e]=t,this.m_variableNameToObjectPathMap[t]=e,t},t}(),J=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.cannotRegisterEvent="CannotRegisterEvent",t.connectionFailureWithStatus="ConnectionFailureWithStatus",t.connectionFailureWithDetails="ConnectionFailureWithDetails",t.propertyNotLoaded="PropertyNotLoaded",t.runMustReturnPromise="RunMustReturnPromise",t.moreInfoInnerError="MoreInfoInnerError",t.cannotApplyPropertyThroughSetMethod="CannotApplyPropertyThroughSetMethod",t.invalidOperationInCellEditMode="InvalidOperationInCellEditMode",t.objectIsUntracked="ObjectIsUntracked",t.customFunctionDefintionMissing="CustomFunctionDefintionMissing",t.customFunctionImplementationMissing="CustomFunctionImplementationMissing",t.customFunctionNameContainsBadChars="CustomFunctionNameContainsBadChars",t.customFunctionNameCannotSplit="CustomFunctionNameCannotSplit",t.customFunctionUnexpectedNumberOfEntriesInResultBatch="CustomFunctionUnexpectedNumberOfEntriesInResultBatch",t.customFunctionCancellationHandlerMissing="CustomFunctionCancellationHandlerMissing",t.customFunctionInvalidFunction="CustomFunctionInvalidFunction",t.customFunctionInvalidFunctionMapping="CustomFunctionInvalidFunctionMapping",t.customFunctionWindowMissing="CustomFunctionWindowMissing",t.customFunctionDefintionMissingOnWindow="CustomFunctionDefintionMissingOnWindow",t.pendingBatchInProgress="PendingBatchInProgress",t.notInsideBatch="NotInsideBatch",t.cannotUpdateReadOnlyProperty="CannotUpdateReadOnlyProperty",t}(I);e.ResourceStrings=J,l.addResourceStringValues({CannotRegisterEvent:"The event handler cannot be registered.",PropertyNotLoaded:"The property '{0}' is not available. Before reading the property's value, call the load method on the containing object and call \"context.sync()\" on the associated request context.",RunMustReturnPromise:'The batch function passed to the ".run" method didn\'t return a promise. The function must return a promise, so that any automatically-tracked objects can be released at the completion of the batch operation. Typically, you return a promise by returning the response from "context.sync()".',InvalidOrTimedOutSessionMessage:"Your Office Online session has expired or is invalid. To continue, refresh the page.",InvalidOperationInCellEditMode:"Excel is in cell-editing mode. Please exit the edit mode by pressing ENTER or TAB or selecting another cell, and then try again.",InvalidSheetName:"The request cannot be processed because the specified worksheet cannot be found. Please try again.",CustomFunctionDefintionMissing:"A property with the name '{0}' that represents the function's definition must exist on Excel.Script.CustomFunctions.",CustomFunctionDefintionMissingOnWindow:"A property with the name '{0}' that represents the function's definition must exist on the window object.",CustomFunctionImplementationMissing:"The property with the name '{0}' on Excel.Script.CustomFunctions that represents the function's definition must contain a 'call' property that implements the function.",CustomFunctionNameContainsBadChars:"The function name may only contain letters, digits, underscores, and periods.",CustomFunctionNameCannotSplit:"The function name must contain a non-empty namespace and a non-empty short name.",CustomFunctionUnexpectedNumberOfEntriesInResultBatch:"The batching function returned a number of results that doesn't match the number of parameter value sets that were passed into it.",CustomFunctionCancellationHandlerMissing:"The cancellation handler onCanceled is missing in the function. The handler must be present as the function is defined as cancelable.",CustomFunctionInvalidFunction:"The property with the name '{0}' that represents the function's definition is not a valid function.",CustomFunctionInvalidFunctionMapping:"The property with the name '{0}' on CustomFunctionMappings that represents the function's definition is not a valid function.",CustomFunctionWindowMissing:"The window object was not found.",PendingBatchInProgress:"There is a pending batch in progress. The batch method may not be called inside another batch, or simultaneously with another batch.",NotInsideBatch:"Operations may not be invoked outside of a batch method.",CannotUpdateReadOnlyProperty:"The property '{0}' is read-only and it cannot be updated.",ObjectIsUntracked:"The object is untracked."});var G=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),n.fixObjectPathIfNecessary=function(e,t){e&&e._objectPath&&t&&e._objectPath.updateUsingObjectData(t,e)},n.load=function(e,t){return e.context.load(e,t),e},n.loadAndSync=function(e,t){return e.context.load(e,t),e.context.sync().then((function(){return e}))},n.retrieve=function(t,i){var r=e._internalConfig.alwaysPolyfillClientObjectRetrieveMethod;r||(r=!n.isSetSupported("RichApiRuntime","1.1"));var o=new N(t,r);return t._retrieve(i,o),o},n.retrieveAndSync=function(e,t){var i=n.retrieve(e,t);return e.context.sync().then((function(){return i}))},n.toJson=function(e,t,i,r){var o={};for(var a in t){void 0!==(s=t[a])&&(o[a]=s)}for(var a in i){var s;void 0!==(s=i[a])&&(s[n.fieldName_isCollection]&&void 0!==s[n.fieldName_m__items]?o[a]=s.toJSON().items:o[a]=s.toJSON())}return r&&(o.items=r.map((function(e){return e.toJSON()}))),o},n.throwError=function(e,t,n){throw new r.RuntimeError({code:e,httpStatusCode:400,message:l._getResourceString(e,t),debugInfo:n?{errorLocation:n}:void 0})},n.createRuntimeError=function(e,t,n,i,o){return new r.RuntimeError({code:e,httpStatusCode:i,message:t,debugInfo:{errorLocation:n},data:o})},n.throwIfNotLoaded=function(e,t,i,r){if(!r&&l.isUndefined(t)&&e.charCodeAt(0)!=n.s_underscoreCharCode&&!n.s_suppressPropertyNotLoadedException)throw n.createPropertyNotLoadedException(i,e)},n._getPropertyValueWithoutCheckLoaded=function(e,t){n.s_suppressPropertyNotLoadedException=!0;try{return e[t]}finally{n.s_suppressPropertyNotLoadedException=!1}},n.createPropertyNotLoadedException=function(e,t){return new r.RuntimeError({code:C.propertyNotLoaded,httpStatusCode:400,message:l._getResourceString(J.propertyNotLoaded,t),debugInfo:e?{errorLocation:e+"."+t}:void 0})},n.createCannotUpdateReadOnlyPropertyException=function(e,t){return new r.RuntimeError({code:C.cannotUpdateReadOnlyProperty,httpStatusCode:400,message:l._getResourceString(J.cannotUpdateReadOnlyProperty,t),debugInfo:e?{errorLocation:e+"."+t}:void 0})},n.promisify=function(t){return new e.Promise((function(e,n){t((function(t){"failed"==t.status?n(t.error):e(t.value)}))}))},n._addActionResultHandler=function(e,t,n){e.context._pendingRequest.addActionResultHandler(t,n)},n._handleNavigationPropertyResults=function(e,t,n){for(var i=0;i<n.length-1;i+=2)l.isUndefined(t[n[i+1]])||e[n[i]]._handleResult(t[n[i+1]])},n._fixupApiFlags=function(e){return"boolean"==typeof e&&(e=e?1:0),e},n.definePropertyThrowUnloadedException=function(e,t,i){Object.defineProperty(e,i,{configurable:!0,enumerable:!0,get:function(){throw n.createPropertyNotLoadedException(t,i)},set:function(){throw n.createCannotUpdateReadOnlyPropertyException(t,i)}})},n.defineReadOnlyPropertyWithValue=function(e,t,i){Object.defineProperty(e,t,{configurable:!0,enumerable:!0,get:function(){return i},set:function(){throw n.createCannotUpdateReadOnlyPropertyException(null,t)}})},n.processRetrieveResult=function(e,t,i,r){if(!l.isNullOrUndefined(t))if(r){var o=t[T.itemsLowerCase];if(Array.isArray(o)){for(var a=[],s=0;s<o.length;s++){var c=r(o[s],s),u={};u[T.proxy]=c,c._handleRetrieveResult(o[s],u),a.push(u)}n.defineReadOnlyPropertyWithValue(i,T.itemsLowerCase,a)}}else{var d=e[T.scalarPropertyNames],f=e[T.navigationPropertyNames],p=e[T.className];if(d)for(s=0;s<d.length;s++){var h=t[g=d[s]];l.isUndefined(h)?n.definePropertyThrowUnloadedException(i,p,g):n.defineReadOnlyPropertyWithValue(i,g,h)}if(f)for(s=0;s<f.length;s++){var g;h=t[g=f[s]];if(l.isUndefined(h))n.definePropertyThrowUnloadedException(i,p,g);else{var m=e[g],v={};m._handleRetrieveResult(h,v),v[T.proxy]=m,Array.isArray(v[T.itemsLowerCase])&&(v=v[T.itemsLowerCase]),n.defineReadOnlyPropertyWithValue(i,g,v)}}}},n.setMockData=function(e,t,i,r){if(l.isNullOrUndefined(t))e._handleResult(t);else{if(e[T.scalarPropertyOriginalNames]){for(var o={},a=e[T.scalarPropertyOriginalNames],s=e[T.scalarPropertyNames],c=0;c<s.length;c++)void 0!==t[s[c]]&&(o[a[c]]=t[s[c]]);e._handleResult(o)}if(e[T.navigationPropertyNames]){var u=e[T.navigationPropertyNames];for(c=0;c<u.length;c++)if(void 0!==t[u[c]]){var d=e[u[c]];d.setMockData&&d.setMockData(t[u[c]])}}if(e[T.isCollection]&&i){var f=Array.isArray(t)?t:t[T.itemsLowerCase];if(Array.isArray(f)){var p=[];for(c=0;c<f.length;c++){var h=i(f,c);n.setMockData(h,f[c]),p.push(h)}r(p)}}}},n.applyMixin=function(e,t){Object.getOwnPropertyNames(t.prototype).forEach((function(n){"constructor"!==n&&Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n))}))},n.ensureTypeInitialized=function(e){var t=new R;new e(t,B.createNewObjectObjectPath(t,"Temp",!1,0))},n.fieldName_m__items="m__items",n.fieldName_isCollection="_isCollection",n._synchronousCleanup=!1,n.s_underscoreCharCode="_".charCodeAt(0),n.s_suppressPropertyNotLoadedException=!1,n}(E);e.Utility=G;var z=function(){function e(){}return e.invokeMethod=function(e,t,n,i,r,o){var a=P.createMethodAction(e.context,e,t,n,i,r),s=new _(o);return G._addActionResultHandler(e,a,s),s},e.invokeEnsureUnchanged=function(e,t){P.createEnsureUnchangedAction(e.context,e,t)},e.invokeSetProperty=function(e,t,n,i){P.createSetPropertyAction(e.context,e,t,n,i)},e.createRootServiceObject=function(e,t){return new e(t,B.createGlobalObjectObjectPath(t))},e.createObjectFromReferenceId=function(e,t,n){return new e(t,B.createReferenceIdObjectPath(t,n))},e.createTopLevelServiceObject=function(e,t,n,i,r){return new e(t,B.createNewObjectObjectPath(t,n,i,r))},e.createPropertyObject=function(e,t,n,i,r){var o=B.createPropertyObjectPath(t.context,t,n,i,!1,r);return new e(t.context,o)},e.createIndexerObject=function(e,t,n){var i=B.createIndexerObjectPath(t.context,t,n);return new e(t.context,i)},e.createMethodObject=function(e,t,n,i,r,o,a,s,c){var u=B.createMethodObjectPath(t.context,t,n,i,r,o,a,s,c);return new e(t.context,u)},e.createChildItemObject=function(e,t,n,i,r){var o=B.createChildItemObjectPathUsingIndexerOrGetItemAt(t,n.context,n,i,r);return new e(n.context,o)},e}();e.BatchApiHelper=z;var Q=function(){function t(e){if(this.m_namespaceMap={},this.m_namespace=e.metadata.name,this.m_targetNamespaceObject=e.targetNamespaceObject,this.m_namespaceMap[this.m_namespace]=e.targetNamespaceObject,e.namespaceMap)for(var t in e.namespaceMap)this.m_namespaceMap[t]=e.namespaceMap[t];this.m_defaultApiSetName=e.metadata.defaultApiSetName,this.m_hostName=e.metadata.hostName;var n=e.metadata;if(n.enumTypes)for(var i=0;i<n.enumTypes.length;i++)this.buildEnumType(n.enumTypes[i]);if(n.apiSets){for(i=0;i<n.apiSets.length;i++){var r=n.apiSets[i];Array.isArray(r)&&(n.apiSets[i]={version:r[0],name:r[1]||this.m_defaultApiSetName})}this.m_apiSets=n.apiSets}if(this.m_strings=n.strings,n.clientObjectTypes)for(i=0;i<n.clientObjectTypes.length;i++){r=n.clientObjectTypes[i];Array.isArray(r)&&(this.ensureArraySize(r,11),n.clientObjectTypes[i]={name:this.getString(r[0]),behaviorFlags:r[1],collectionPropertyPath:this.getString(r[6]),newObjectServerTypeFullName:this.getString(r[9]),newObjectApiFlags:r[10],childItemTypeFullName:this.getString(r[7]),scalarProperties:r[2],navigationProperties:r[3],scalarMethods:r[4],navigationMethods:r[5],events:r[8]}),this.buildClientObjectType(n.clientObjectTypes[i],e.fullyInitialize)}}return t.prototype.ensureArraySize=function(e,t){for(var n=t-e.length;n>0;)e.push(0),n--},t.prototype.getString=function(e){return"number"==typeof e?e>0?this.m_strings[e-1]:null:e},t.prototype.buildEnumType=function(e){var t;if(Array.isArray(e)){(t={name:e[0],fields:e[2]}).fields||(t.fields={});var n=e[1];if(Array.isArray(n))for(var i=0;i<n.length;i++)t.fields[n[i]]=this.toSimpleCamelUpperCase(n[i])}else t=e;this.m_targetNamespaceObject[t.name]=t.fields},t.prototype.buildClientObjectType=function(n,i){var r=this,o=function(t,i){w.apply(this,arguments),r.m_targetNamespaceObject[n.name]._typeInited||(r.buildPrototype(r.m_targetNamespaceObject[n.name],n),r.m_targetNamespaceObject[n.name]._typeInited=!0),e._internalConfig.appendTypeNameToObjectPathInfo&&this._objectPath&&this._objectPath.objectPathInfo&&this._className&&(this._objectPath.objectPathInfo.T=this._className)};(this.m_targetNamespaceObject[n.name]=o,this.extendsType(o,w),this.buildNewObject(o,n),0!=(2&n.behaviorFlags)&&(o.prototype._KeepReference=function(){z.invokeMethod(this,"_KeepReference",1,[],0,0)}),0!=(32&n.behaviorFlags))&&this.getFunction(t.CustomizationCodeNamespace+"."+n.name+"_StaticCustomize").call(null,o);i&&(this.buildPrototype(o,n),o._typeInited=!0)},t.prototype.extendsType=function(e,t){function n(){this.constructor=e}e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},t.prototype.findObjectUnderPath=function(t,n,i){for(var r=t,o=i;o<n.length;o++){if("object"!=typeof r)throw new e.Error("Cannot find "+n.join("."));r=r[n[o]]}return r},t.prototype.getFunction=function(t){var n=this.resolveObjectByFullName(t);if("function"!=typeof n)throw new e.Error("Cannot find function or type: "+t);return n},t.prototype.resolveObjectByFullName=function(e){var t=e.split(".");if(1===t.length)return this.m_targetNamespaceObject[t[0]];var n=t[0];return n===this.m_namespace?this.findObjectUnderPath(this.m_targetNamespaceObject,t,1):this.m_namespaceMap[n]?this.findObjectUnderPath(this.m_namespaceMap[n],t,1):this.findObjectUnderPath(this.m_targetNamespaceObject,t,0)},t.prototype.evaluateSimpleExpression=function(t,n){if(G.isNullOrUndefined(t))return null;var i=t.split(".");if(3===i.length&&"OfficeExtension"===i[0]&&"Constants"===i[1])return T[i[2]];if("this"===i[0]){for(var r=n,o=1;o<i.length;o++)r="toString()"==i[o]?r.toString():"()"===i[o].substr(i[o].length-2)?r[i[o].substr(0,i[o].length-2)]():r[i[o]];return r}throw new e.Error("Cannot evaluate: "+t)},t.prototype.evaluateEventTargetId=function(e,t){return G.isNullOrEmptyString(e)?"":this.evaluateSimpleExpression(e,t)},t.prototype.isAllDigits=function(e){for(var t="0".charCodeAt(0),n="9".charCodeAt(0),i=0;i<e.length;i++)if(e.charCodeAt(i)<t||e.charCodeAt(i)>n)return!1;return!0},t.prototype.evaluateEventType=function(t){if(G.isNullOrEmptyString(t))return 0;if(this.isAllDigits(t))return parseInt(t);var n=this.resolveObjectByFullName(t);if("number"!=typeof n)throw new e.Error("Invalid event type: "+t);return n},t.prototype.buildPrototype=function(e,t){this.buildScalarProperties(e,t),this.buildNavigationProperties(e,t),this.buildScalarMethods(e,t),this.buildNavigationMethods(e,t),this.buildEvents(e,t),this.buildHandleResult(e,t),this.buildHandleIdResult(e,t),this.buildHandleRetrieveResult(e,t),this.buildLoad(e,t),this.buildRetrieve(e,t),this.buildSetMockData(e,t),this.buildEnsureUnchanged(e,t),this.buildUpdate(e,t),this.buildSet(e,t),this.buildToJSON(e,t),this.buildItems(e,t),this.buildTypeMetadataInfo(e,t),this.buildTrackUntrack(e,t),this.buildMixin(e,t)},t.prototype.toSimpleCamelUpperCase=function(e){return e.substr(0,1).toUpperCase()+e.substr(1)},t.prototype.ensureOriginalName=function(e){null===e.originalName&&(e.originalName=this.toSimpleCamelUpperCase(e.name))},t.prototype.getFieldName=function(e){return"m_"+e.name},t.prototype.throwIfApiNotSupported=function(e,t){if(this.m_apiSets&&t.apiSetInfoOrdinal>0){var n=this.m_apiSets[t.apiSetInfoOrdinal-1];n&&G.throwIfApiNotSupported(e.name+"."+t.name,n.name,n.version,this.m_hostName)}},t.prototype.buildScalarProperties=function(e,t){if(Array.isArray(t.scalarProperties))for(var n=0;n<t.scalarProperties.length;n++){var i=t.scalarProperties[n];Array.isArray(i)&&(this.ensureArraySize(i,6),t.scalarProperties[n]={name:this.getString(i[0]),behaviorFlags:i[1],apiSetInfoOrdinal:i[2],originalName:this.getString(i[3]),setMethodApiFlags:i[4],undoableApiSetInfoOrdinal:i[5]}),this.buildScalarProperty(e,t,t.scalarProperties[n])}},t.prototype.calculateApiFlags=function(e,t){if(t>0){var n=this.m_apiSets[t-1];n&&(e=E.calculateApiFlags(e,n.name,n.version))}return e},t.prototype.buildScalarProperty=function(e,n,i){this.ensureOriginalName(i);var r=this,o=this.getFieldName(i),a={get:function(){return G.throwIfNotLoaded(i.name,this[o],n.name,this._isNull),r.throwIfApiNotSupported(n,i),this[o]},enumerable:!0,configurable:!0};0==(2&i.behaviorFlags)&&(a.set=function(e){if(4&i.behaviorFlags&&r.getFunction(t.CustomizationCodeNamespace+"."+n.name+"_"+i.originalName+"_Set").call(this,this,e).handled)return;this[o]=e;var a=r.calculateApiFlags(i.setMethodApiFlags,i.undoableApiSetInfoOrdinal);z.invokeSetProperty(this,i.originalName,e,a)}),Object.defineProperty(e.prototype,i.name,a)},t.prototype.buildNavigationProperties=function(e,t){if(Array.isArray(t.navigationProperties))for(var n=0;n<t.navigationProperties.length;n++){var i=t.navigationProperties[n];Array.isArray(i)&&(this.ensureArraySize(i,8),t.navigationProperties[n]={name:this.getString(i[0]),behaviorFlags:i[2],apiSetInfoOrdinal:i[3],originalName:this.getString(i[4]),getMethodApiFlags:i[5],setMethodApiFlags:i[6],propertyTypeFullName:this.getString(i[1]),undoableApiSetInfoOrdinal:i[7]}),this.buildNavigationProperty(e,t,t.navigationProperties[n])}},t.prototype.buildNavigationProperty=function(e,n,i){this.ensureOriginalName(i);var r=this,o=this.getFieldName(i),a={get:function(){(this[r.getFieldName(i)]||(r.throwIfApiNotSupported(n,i),this[o]=z.createPropertyObject(r.getFunction(i.propertyTypeFullName),this,i.originalName,0!=(16&i.behaviorFlags),i.getMethodApiFlags)),64&i.behaviorFlags)&&r.getFunction(t.CustomizationCodeNamespace+"."+n.name+"_"+i.originalName+"_Get").call(this,this,this[o]);return this[o]},enumerable:!0,configurable:!0};0==(2&i.behaviorFlags)&&(a.set=function(e){if(4&i.behaviorFlags&&r.getFunction(t.CustomizationCodeNamespace+"."+n.name+"_"+i.originalName+"_Set").call(this,this,e).handled)return;this[o]=e;var a=r.calculateApiFlags(i.setMethodApiFlags,i.undoableApiSetInfoOrdinal);z.invokeSetProperty(this,i.originalName,e,a)}),Object.defineProperty(e.prototype,i.name,a)},t.prototype.buildScalarMethods=function(e,t){if(Array.isArray(t.scalarMethods))for(var n=0;n<t.scalarMethods.length;n++){var i=t.scalarMethods[n];Array.isArray(i)&&(this.ensureArraySize(i,7),t.scalarMethods[n]={name:this.getString(i[0]),behaviorFlags:i[2],apiSetInfoOrdinal:i[3],originalName:this.getString(i[5]),apiFlags:i[4],parameterCount:i[1],undoableApiSetInfoOrdinal:i[6]}),this.buildScalarMethod(e,t,t.scalarMethods[n])}},t.prototype.buildScalarMethod=function(e,n,i){this.ensureOriginalName(i);var r=this;e.prototype[i.name]=function(){var e=[];if(64&i.behaviorFlags&&i.parameterCount>0){for(var o=0;o<i.parameterCount-1;o++)e.push(arguments[o]);var a=[];for(o=i.parameterCount-1;o<arguments.length;o++)a.push(arguments[o]);e.push(a)}else for(o=0;o<arguments.length;o++)e.push(arguments[o]);if(1&i.behaviorFlags){var s=r.getFunction(t.CustomizationCodeNamespace+"."+n.name+"_"+i.originalName),c=[this];for(o=0;o<e.length;o++)c.push(e[o]);var u=s.apply(this,c),l=u.handled,d=u.result;if(l)return d}r.throwIfApiNotSupported(n,i);var f=0;32&i.behaviorFlags&&(f=1);var p=0;2&i.behaviorFlags&&(p=1);var h=r.calculateApiFlags(i.apiFlags,i.undoableApiSetInfoOrdinal);return z.invokeMethod(this,i.originalName,p,e,h,f)}},t.prototype.buildNavigationMethods=function(e,t){if(Array.isArray(t.navigationMethods))for(var n=0;n<t.navigationMethods.length;n++){var i=t.navigationMethods[n];Array.isArray(i)&&(this.ensureArraySize(i,9),t.navigationMethods[n]={name:this.getString(i[0]),behaviorFlags:i[3],apiSetInfoOrdinal:i[4],originalName:this.getString(i[6]),apiFlags:i[5],parameterCount:i[2],returnTypeFullName:this.getString(i[1]),returnObjectGetByIdMethodName:this.getString(i[7]),undoableApiSetInfoOrdinal:i[8]}),this.buildNavigationMethod(e,t,t.navigationMethods[n])}},t.prototype.buildNavigationMethod=function(e,n,i){this.ensureOriginalName(i);var r=this;e.prototype[i.name]=function(){var e=[];if(64&i.behaviorFlags&&i.parameterCount>0){for(var o=0;o<i.parameterCount-1;o++)e.push(arguments[o]);var a=[];for(o=i.parameterCount-1;o<arguments.length;o++)a.push(arguments[o]);e.push(a)}else for(o=0;o<arguments.length;o++)e.push(arguments[o]);if(1&i.behaviorFlags){var s=r.getFunction(t.CustomizationCodeNamespace+"."+n.name+"_"+i.originalName),c=[this];for(o=0;o<e.length;o++)c.push(e[o]);var u=s.apply(this,c),l=u.handled,d=u.result;if(l)return d}if(r.throwIfApiNotSupported(n,i),0!=(16&i.behaviorFlags))return z.createIndexerObject(r.getFunction(i.returnTypeFullName),this,e);var f=0;2&i.behaviorFlags&&(f=1);var p=r.calculateApiFlags(i.apiFlags,i.undoableApiSetInfoOrdinal);return z.createMethodObject(r.getFunction(i.returnTypeFullName),this,i.originalName,f,e,0!=(4&i.behaviorFlags),0!=(8&i.behaviorFlags),i.returnObjectGetByIdMethodName,p)}},t.prototype.buildHandleResult=function(e,n){var i=this;e.prototype._handleResult=function(e){if(w.prototype._handleResult.call(this,e),!G.isNullOrUndefined(e)){if(G.fixObjectPathIfNecessary(this,e),8&n.behaviorFlags)i.getFunction(t.CustomizationCodeNamespace+"."+n.name+"_HandleResult").call(this,this,e);if(n.scalarProperties)for(var r=0;r<n.scalarProperties.length;r++)G.isUndefined(e[n.scalarProperties[r].originalName])||(0!=(8&n.scalarProperties[r].behaviorFlags)?this[i.getFieldName(n.scalarProperties[r])]=G.adjustToDateTime(e[n.scalarProperties[r].originalName]):this[i.getFieldName(n.scalarProperties[r])]=e[n.scalarProperties[r].originalName]);if(n.navigationProperties){for(var o=[],a=0;a<n.navigationProperties.length;a++)o.push(n.navigationProperties[a].name),o.push(n.navigationProperties[a].originalName);G._handleNavigationPropertyResults(this,e,o)}if(0!=(1&n.behaviorFlags)){var s=i.hasIndexMethod(n);if(!G.isNullOrUndefined(e[T.items])){this.m__items=[];for(var c=e[T.items],u=i.getFunction(n.childItemTypeFullName),l=0;l<c.length;l++){var d=z.createChildItemObject(u,s,this,c[l],l);d._handleResult(c[l]),this.m__items.push(d)}}}}}},t.prototype.buildHandleRetrieveResult=function(e,t){var n=this;e.prototype._handleRetrieveResult=function(e,i){if(w.prototype._handleRetrieveResult.call(this,e,i),!G.isNullOrUndefined(e)){if(t.scalarProperties)for(var r=0;r<t.scalarProperties.length;r++)8&t.scalarProperties[r].behaviorFlags&&(G.isNullOrUndefined(e[t.scalarProperties[r].name])||(e[t.scalarProperties[r].name]=G.adjustToDateTime(e[t.scalarProperties[r].name])));if(1&t.behaviorFlags){var o=n.hasIndexMethod(t),a=n.getFunction(t.childItemTypeFullName),s=this;G.processRetrieveResult(s,e,i,(function(e,t){return z.createChildItemObject(a,o,s,e,t)}))}else G.processRetrieveResult(this,e,i)}}},t.prototype.buildHandleIdResult=function(e,n){var i=this;e.prototype._handleIdResult=function(e){if(w.prototype._handleIdResult.call(this,e),!G.isNullOrUndefined(e)){if(16&n.behaviorFlags)i.getFunction(t.CustomizationCodeNamespace+"."+n.name+"_HandleIdResult").call(this,this,e);if(n.scalarProperties)for(var r=0;r<n.scalarProperties.length;r++){var o=n.scalarProperties[r].originalName;"Id"!==o&&"_Id"!==o&&"_ReferenceId"!==o||G.isNullOrUndefined(e[n.scalarProperties[r].originalName])||(this[i.getFieldName(n.scalarProperties[r])]=e[n.scalarProperties[r].originalName])}}}},t.prototype.buildLoad=function(e,t){e.prototype.load=function(e){return G.load(this,e)}},t.prototype.buildRetrieve=function(e,t){e.prototype.retrieve=function(e){return G.retrieve(this,e)}},t.prototype.buildNewObject=function(e,t){G.isNullOrEmptyString(t.newObjectServerTypeFullName)||(e.newObject=function(n){return z.createTopLevelServiceObject(e,n,t.newObjectServerTypeFullName,0!=(1&t.behaviorFlags),t.newObjectApiFlags)})},t.prototype.buildSetMockData=function(e,t){var n=this;if(1&t.behaviorFlags){var i=n.hasIndexMethod(t);e.prototype.setMockData=function(e){var r=this;G.setMockData(r,e,(function(e,o){return z.createChildItemObject(n.getFunction(t.childItemTypeFullName),i,r,e,o)}),(function(e){r.m__items=e}))}}else e.prototype.setMockData=function(e){G.setMockData(this,e)}},t.prototype.buildEnsureUnchanged=function(e,t){e.prototype.ensureUnchanged=function(e){z.invokeEnsureUnchanged(this,e)}},t.prototype.buildUpdate=function(e,t){e.prototype.update=function(e){this._recursivelyUpdate(e)}},t.prototype.buildSet=function(e,t){if(0==(1&t.behaviorFlags)){var n=[],i=[];if(t.scalarProperties)for(var r=0;r<t.scalarProperties.length;r++)0==(2&t.scalarProperties[r].behaviorFlags)&&0!=(1&t.scalarProperties[r].behaviorFlags)?i.push(t.scalarProperties[r].name):n.push(t.scalarProperties[r].name);var o=[];if(t.navigationProperties)for(r=0;r<t.navigationProperties.length;r++)0!=(16&t.navigationProperties[r].behaviorFlags)||0==(1&t.navigationProperties[r].behaviorFlags)||0==(32&t.navigationProperties[r].behaviorFlags)?n.push(t.navigationProperties[r].name):o.push(t.navigationProperties[r].name);0===o.length&&0===i.length||(e.prototype.set=function(e,t){this._recursivelySet(e,t,i,o,n)})}},t.prototype.buildItems=function(e,t){0!=(1&t.behaviorFlags)&&Object.defineProperty(e.prototype,"items",{get:function(){return G.throwIfNotLoaded("items",this.m__items,t.name,this._isNull),this.m__items},enumerable:!0,configurable:!0})},t.prototype.buildToJSON=function(e,t){var n=this;0==(1&t.behaviorFlags)?e.prototype.toJSON=function(){var e={};if(t.scalarProperties)for(var i=0;i<t.scalarProperties.length;i++)0!=(1&t.scalarProperties[i].behaviorFlags)&&(e[t.scalarProperties[i].name]=this[n.getFieldName(t.scalarProperties[i])]);var r={};if(t.navigationProperties)for(i=0;i<t.navigationProperties.length;i++)0!=(1&t.navigationProperties[i].behaviorFlags)&&(r[t.navigationProperties[i].name]=this[n.getFieldName(t.navigationProperties[i])]);return G.toJson(this,e,r)}:e.prototype.toJSON=function(){return G.toJson(this,{},{},this.m__items)}},t.prototype.buildTypeMetadataInfo=function(e,t){Object.defineProperty(e.prototype,"_className",{get:function(){return t.name},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_isCollection",{get:function(){return 0!=(1&t.behaviorFlags)},enumerable:!0,configurable:!0}),G.isNullOrEmptyString(t.collectionPropertyPath)||Object.defineProperty(e.prototype,"_collectionPropertyPath",{get:function(){return t.collectionPropertyPath},enumerable:!0,configurable:!0}),t.scalarProperties&&t.scalarProperties.length>0&&(Object.defineProperty(e.prototype,"_scalarPropertyNames",{get:function(){return this.m__scalarPropertyNames||(this.m__scalarPropertyNames=t.scalarProperties.map((function(e){return e.name}))),this.m__scalarPropertyNames},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_scalarPropertyOriginalNames",{get:function(){return this.m__scalarPropertyOriginalNames||(this.m__scalarPropertyOriginalNames=t.scalarProperties.map((function(e){return e.originalName}))),this.m__scalarPropertyOriginalNames},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_scalarPropertyUpdateable",{get:function(){return this.m__scalarPropertyUpdateable||(this.m__scalarPropertyUpdateable=t.scalarProperties.map((function(e){return 0==(2&e.behaviorFlags)}))),this.m__scalarPropertyUpdateable},enumerable:!0,configurable:!0})),t.navigationProperties&&t.navigationProperties.length>0&&Object.defineProperty(e.prototype,"_navigationPropertyNames",{get:function(){return this.m__navigationPropertyNames||(this.m__navigationPropertyNames=t.navigationProperties.map((function(e){return e.name}))),this.m__navigationPropertyNames},enumerable:!0,configurable:!0})},t.prototype.buildTrackUntrack=function(e,t){2&t.behaviorFlags&&(e.prototype.track=function(){return this.context.trackedObjects.add(this),this},e.prototype.untrack=function(){return this.context.trackedObjects.remove(this),this})},t.prototype.buildMixin=function(e,t){if(4&t.behaviorFlags){var n=this.getFunction(t.name+"Custom");G.applyMixin(e,n)}},t.prototype.getOnEventName=function(e){return"_"===e[0]?"_on"+e.substr(1):"on"+e},t.prototype.buildEvents=function(e,t){if(t.events)for(var n=0;n<t.events.length;n++){var i=t.events[n];Array.isArray(i)&&(this.ensureArraySize(i,7),t.events[n]={name:this.getString(i[0]),behaviorFlags:i[1],apiSetInfoOrdinal:i[2],typeExpression:this.getString(i[3]),targetIdExpression:this.getString(i[4]),register:this.getString(i[5]),unregister:this.getString(i[6])}),this.buildEvent(e,t,t.events[n])}},t.prototype.buildEvent=function(e,t,n){1&n.behaviorFlags?this.buildV0Event(e,t,n):this.buildV2Event(e,t,n)},t.prototype.buildV2Event=function(e,n,i){var r=this,o=this.getOnEventName(i.name),a=this.getFieldName(i);Object.defineProperty(e.prototype,o,{get:function(){if(!this[a]){r.throwIfApiNotSupported(n,i);var e=this,o=null;"null"!==i.register&&(o=this[i.register].bind(this));var s=null;"null"!==i.unregister&&(s=this[i.unregister].bind(this));var c=null;2&i.behaviorFlags&&(c=r.getFunction(t.CustomizationCodeNamespace+"."+n.name+"_"+i.name+"_EventArgsTransform"));var u=r.evaluateEventType(i.typeExpression);this[a]=new U(this.context,this,i.name,{eventType:u,getTargetIdFunc:function(){return r.evaluateEventTargetId(i.targetIdExpression,e)},registerFunc:o,unregisterFunc:s,eventArgsTransformFunc:function(t){return c&&(t=c.call(e,e,t)),G._createPromiseFromResult(t)}})}return this[a]},enumerable:!0,configurable:!0})},t.prototype.buildV0Event=function(e,n,i){var r=this,o=this.getOnEventName(i.name),a=this.getFieldName(i);Object.defineProperty(e.prototype,o,{get:function(){if(!this[a]){r.throwIfApiNotSupported(n,i);var e=this,o=null;if(G.isNullOrEmptyString(i.register)){var s=r.evaluateEventType(i.typeExpression);o=function(t){var n=r.evaluateEventTargetId(i.targetIdExpression,e);return e.context.eventRegistration.register(s,n,t)}}else if("null"!==i.register){var c=r.getFunction(i.register);o=function(t){return c.call(e,e,t)}}var u=null;if(G.isNullOrEmptyString(i.unregister)){var l=r.evaluateEventType(i.typeExpression);u=function(t){var n=r.evaluateEventTargetId(i.targetIdExpression,e);return e.context.eventRegistration.unregister(l,n,t)}}else if("null"!==i.unregister){var d=r.getFunction(i.unregister);u=function(t){return d.call(e,e,t)}}var f=null;2&i.behaviorFlags&&(f=r.getFunction(t.CustomizationCodeNamespace+"."+n.name+"_"+i.name+"_EventArgsTransform"));this[a]=new j(this.context,this,i.name,{registerFunc:o,unregisterFunc:u,eventArgsTransformFunc:function(t){return f&&(t=f.call(e,e,t)),G._createPromiseFromResult(t)}})}return this[a]},enumerable:!0,configurable:!0})},t.prototype.hasIndexMethod=function(e){var t=!1;if(e.navigationMethods)for(var n=0;n<e.navigationMethods.length;n++)if(0!=(16&e.navigationMethods[n].behaviorFlags)){t=!0;break}return t},t.CustomizationCodeNamespace="_CC",t}();e.LibraryBuilder=Q}(OfficeExtension||(OfficeExtension={})),function(e){var t;!function(t){t.getPromiseType=function(){if("undefined"!=typeof Promise)return Promise;if(void 0!==Office&&Office.Promise)return Office.Promise;throw new e.Error("No Promise implementation found")}}(t||(t={})),Object.defineProperty(e,"Promise",{get:function(){return t.getPromiseType()},enumerable:!0,configurable:!0})}(OfficeExtension||(OfficeExtension={}));try{if("undefined"!=typeof OfficePlatformGlobal&&void 0!==OfficePlatformGlobal.ReactNativeReka){var RichApiBridgeImpl=function(){function e(){}return e.prototype.sendMessageToHost=function(e){OfficePlatformGlobal.ReactNativeReka.RekaInstance.InvokeNative("RichApiDataService","ProcessMessageToHost",e)},e}(),RichApiBridge_1=new RichApiBridgeImpl,RichApiDataService_1=function(){function e(){}return e.prototype.Invoke=function(e,t){"ProcessMessageFromHost"===e&&RichApiBridge_1.onMessageFromHost&&RichApiBridge_1.onMessageFromHost(t)},e}();OfficePlatformGlobal.ReactNativeReka.initReka(),OfficePlatformGlobal.ReactNativeReka.RekaInstance.RegisterService("RichApiDataService",(function(){return new RichApiDataService_1})),OfficeExtension.HostBridge.init(RichApiBridge_1),OfficeExtension.HostBridgeSession.getInstanceIfHostBridgeInited()}}catch(e){}var Excel;__extends=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();!function(e){function t(){try{if("undefined"!=typeof oteljs&&oteljs)return!0}catch(e){}return!1}function n(e){try{void 0!==OTel&&OTel&&OTel.OTelLogger&&OTel.OTelLogger.onTelemetryLoaded((function(){t()&&OTel.OTelLogger.sendTelemetryEvent(e())}))}catch(e){}}function i(e){try{if(!e.isExecutionTelemetryEnabled)return;if(e.isStreaming)return;void 0!==OTel&&OTel&&OTel.OTelLogger&&OTel.OTelLogger.onTelemetryLoaded((function(){try{if(t()){var n=[oteljs.makeStringDataField("GranularEventName",e.granularEventName),oteljs.makeBooleanDataField("IsSuccess",e.isSuccess)];void 0!==e.invocationId&&n.push(oteljs.makeStringDataField("InvocationId",""+e.invocationId)),void 0!==e.isStreaming&&n.push(oteljs.makeBooleanDataField("IsStreaming",e.isStreaming)),void 0!==e.isBatching&&n.push(oteljs.makeBooleanDataField("IsBatching",e.isBatching)),void 0!==e.executionPath&&n.push(oteljs.makeStringDataField("ExecutionPath",e.executionPath)),void 0!==e.executionTimeMs&&n.push(oteljs.makeStringDataField("ExecutionTimeMs",""+e.executionTimeMs)),void 0!==e.waitingTimeMs&&n.push(oteljs.makeStringDataField("WaitingTimeMs",""+e.waitingTimeMs)),void 0!==e.errorCategory&&n.push(oteljs.makeStringDataField("ErrorCategory",e.errorCategory)),void 0!==e.internalErrorCode&&n.push(oteljs.makeStringDataField("InternalErrorCode",""+e.internalErrorCode)),void 0!==e.isResultConverted&&n.push(oteljs.makeBooleanDataField("IsResultConverted",e.isResultConverted)),void 0!==e.isInValuePreview&&n.push(oteljs.makeBooleanDataField("IsInValuePreview",e.isInValuePreview)),void 0!==e.resultType&&n.push(oteljs.makeStringDataField("ResultType",e.resultType)),void 0!==e.convertedErrorCategory&&n.push(oteljs.makeStringDataField("ConvertedErrorCategory",e.convertedErrorCategory)),void 0!==e.convertedErrorCode&&n.push(oteljs.makeStringDataField("ConvertedErrorCode",""+e.convertedErrorCode)),OTel.OTelLogger.sendTelemetryEvent({eventName:"Office.Extensibility.OfficeJs.CustomFunctionsExecution",dataFields:n,eventFlags:{dataCategories:oteljs.DataCategories.ProductServiceUsage,diagnosticLevel:oteljs.DiagnosticLevel.NecessaryServiceDataEvent}})}}catch(e){}}))}catch(e){}}function r(e){var t="",n="",i="",r="",o="",a="",s="";try{if(null!=e)if("string"==typeof e)n=e;else if("object"==typeof e){try{"string"!=typeof e.code&&"number"!=typeof e.code||(t=""+e.code)}catch(e){t="unable to get error code"}try{"string"==typeof e.message&&(n=e.message)}catch(e){n="unable to get error message"}try{"string"==typeof e.name&&(i=e.name)}catch(e){i="unable to get error name"}var c=!1;try{c=null!==e.debugInfo&&void 0!==e.debugInfo&&"object"==typeof e.debugInfo}catch(e){}var u="debugInfo not present";if(c){try{"string"!=typeof e.debugInfo.code&&"number"!=typeof e.debugInfo.code||(r=""+e.debugInfo.code)}catch(e){r="unable to get debug info code"}try{"string"==typeof e.debugInfo.message&&(o=e.debugInfo.message)}catch(e){o="unable to get debug info message"}try{"string"==typeof e.debugInfo.errorLocation&&(a=e.debugInfo.errorLocation)}catch(e){a="unable to get error location"}}else r=u,o=u,a=u}}catch(e){}try{null!=e&&"object"==typeof e&&"string"==typeof e.__cfFailureSource&&(s=e.__cfFailureSource)}catch(e){s="unable to get failure source"}return[oteljs.makeStringDataField("ErrorCode",t),oteljs.makeStringDataField("ErrorName",i),oteljs.makeStringDataField("ErrorMessage",n),oteljs.makeStringDataField("DebugInfoCode",r),oteljs.makeStringDataField("DebugInfoMessage",o),oteljs.makeStringDataField("ErrorLocation",a),oteljs.makeStringDataField("FailureSource",s)]}var o="Excel",a=OfficeExtension.BatchApiHelper.createPropertyObject,s=(OfficeExtension.BatchApiHelper.createMethodObject,OfficeExtension.BatchApiHelper.createIndexerObject,OfficeExtension.BatchApiHelper.createRootServiceObject),c=OfficeExtension.BatchApiHelper.createTopLevelServiceObject,u=(OfficeExtension.BatchApiHelper.createChildItemObject,OfficeExtension.BatchApiHelper.invokeMethod),l=(OfficeExtension.BatchApiHelper.invokeEnsureUnchanged,OfficeExtension.BatchApiHelper.invokeSetProperty,OfficeExtension.Utility.isNullOrUndefined),d=(OfficeExtension.Utility.isUndefined,OfficeExtension.Utility.throwIfNotLoaded,OfficeExtension.Utility.throwIfApiNotSupported),f=OfficeExtension.Utility.load,p=(OfficeExtension.Utility.retrieve,OfficeExtension.Utility.toJson),h=OfficeExtension.Utility.fixObjectPathIfNecessary,g=OfficeExtension.Utility._handleNavigationPropertyResults,m=(OfficeExtension.Utility.adjustToDateTime,OfficeExtension.Utility.processRetrieveResult),v=(OfficeExtension.Utility.setMockData,OfficeExtension.CommonUtility.calculateApiFlags,function(e){function t(t){var n=e.call(this,t)||this;return n.m_customFunctions=F.newObject(n),n.m_container=s(N,n),n._rootObject=n.m_container,n._rootObjectPropertyName="customFunctionsContainer",n._requestFlagModifier=2176,n}return __extends(t,e),Object.defineProperty(t.prototype,"customFunctions",{get:function(){return this.m_customFunctions},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"customFunctionsContainer",{get:function(){return this.m_container},enumerable:!0,configurable:!0}),t.prototype._processOfficeJsErrorResponse=function(e,t){5004===e&&(t.ErrorCode=R.invalidOperationInCellEditMode,t.ErrorMessage=OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.invalidOperationInCellEditMode))},t}(OfficeExtension.ClientRequestContext));e.Script={_CustomFunctionMetadata:{}};var y,_=function(){function e(e,t,n,i,r,o,a,s){this._functionName=e,l(t)||(this._address=t),l(n)||(this._parameterAddresses=n),this._isInValuePreview=i,this._isInSyncExecution=r,this.invocationId=l(o)?0:o,this.setResult=a,this.setError=s}return Object.defineProperty(e.prototype,"onCanceled",{get:function(){if(!l(this._onCanceled)&&"function"==typeof this._onCanceled)return this._onCanceled},set:function(e){this._onCanceled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"functionName",{get:function(){return this._functionName},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"address",{get:function(){return this._address},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parameterAddresses",{get:function(){return this._parameterAddresses},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isInValuePreview",{get:function(){return this._isInValuePreview},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isInSyncExecution",{get:function(){return this._isInSyncExecution},enumerable:!0,configurable:!0}),e}();e.InvocationContext=_,function(e){e.Info="Medium",e.Error="Unexpected",e.Verbose="Verbose"}(y||(y={}));var b,O=function(e,t){this.Severity=e,this.Message=t},S=function(){function e(){}return e.logEvent=function(t,n,i){if(e.s_shouldLog||OfficeExtension.CoreUtility._logEnabled){var r=t.Severity+" "+t.Message+n;if(i&&(r=r+" "+i),OfficeExtension.Utility.log(r),e.s_shouldLog)switch(t.Severity){case y.Verbose:null!==console.log&&console.log(r);break;case y.Info:null!==console.info&&console.info(r);break;case y.Error:null!==console.error&&console.error(r)}}},e.shouldLog=function(){try{return!l(console)&&!l(window)&&window.name&&"string"==typeof window.name&&JSON.parse(window.name)[e.CustomFunctionLoggingFlag]}catch(e){return OfficeExtension.Utility.log(JSON.stringify(e)),!1}},e.CustomFunctionLoggingFlag="CustomFunctionsRuntimeLogging",e.s_shouldLog=e.shouldLog(),e}();!function(e){e.invalidValue="#VALUE!",e.notAvailable="#N/A",e.divisionByZero="#DIV/0!",e.invalidNumber="#NUM!",e.nullReference="#NULL!",e.invalidName="#NAME?",e.invalidReference="#REF!"}(b=e.ErrorCode||(e.ErrorCode={}));var E=function(e){function t(n,i,r){var o=e.call(this,i||"")||this;return o.type=t.valueType,o.basicType=t.valueType,Object.setPrototypeOf(o,t.prototype),o.code=n||b.invalidValue,o.basicValue=n||b.invalidValue,o.errorSubType=r,o.stack=void 0,o}return __extends(t,e),t.prototype.toJSON=function(){return{valueType:"CustomFunctionError",code:this.code,type:this.type,basicValue:this.basicValue,basicType:this.type,errorSubType:this.errorSubType,message:this._getMessage(),errorType:this._getErrorType()}},t.prototype._getErrorType=function(){switch(this.basicValue){case b.invalidValue:return"Value";case b.divisionByZero:return"Div0";case b.notAvailable:return"NotAvailable";case b.invalidNumber:return"Num";case b.invalidName:return"Name";case b.invalidReference:return"Ref";case b.nullReference:return"Null";default:return}},t.prototype._getMessage=function(){switch(this.basicValue){case b.invalidValue:case b.notAvailable:return""==this.message?void 0:this.message;case b.divisionByZero:case b.invalidNumber:case b.invalidName:case b.invalidReference:case b.nullReference:default:return}},t.valueType="Error",t}(Error);e.CustomFunctionError=E;var I=function(){function e(t,n){this.type=e.valueType,this.basicValue="#VALUE!",this.basicType="Error",Object.setPrototypeOf(this,e.prototype),this.text=t,this.properties=n}return e.prototype.toJSON=function(){return{type:this.type,text:this.text,basicValue:this.basicValue,basicType:this.basicType,properties:this.properties}},e.valueType="Entity",e}();e.CustomFunctionEntity=I;var C=function(){function e(t,n){this.type=e.valueType,this.basicValue=t,this.numberFormat=n}return e.prototype.toJSON=function(){return{type:this.type,basicValue:this.basicValue,numberFormat:this.numberFormat}},e.valueType="FormattedNumber",e}();e.CustomFunctionFormattedNumber=C;var A=function(){function e(t,n,i,r,o){this.type=e.valueType,this.basicValue="#VALUE!",this.basicType="Error",this.address=t,null!=r&&(this.attribution=r),null!=o&&(this.provider=o),null!=n&&(this.altText=n),null!=i&&(this.relatedImagesAddress=i)}return e.prototype.toJSON=function(){return{type:this.type,basicValue:this.basicValue,basicType:this.basicType,address:this.address,altText:this.altText,relatedImagesAddress:this.relatedImagesAddress,attribution:null==this.attribution?void 0:this.attribution.map((function(e){return e.toJSON()})),provider:null==this.provider?void 0:this.provider.toJSON()}},e.valueType="WebImage",e}();e.CustomFunctionWebImage=A;var P=function(){function e(e,t,n,i){null!=e&&(this.licenseAddress=e),null!=t&&(this.licenseText=t),null!=n&&(this.sourceAddress=n),null!=i&&(this.sourceText=i)}return e.prototype.toJSON=function(){return{licenseAddress:this.licenseAddress,licenseText:this.licenseText,sourceAddress:this.sourceAddress,sourceText:this.sourceText}},e}();e.CustomFunctionAttribution=P;var w=function(){function e(e,t,n){this.description=e,null!=t&&(this.logoSourceAddress=t),null!=n&&(this.logoTargetAddress=n)}return e.prototype.toJSON=function(){return{description:this.description,logoSourceAddress:this.logoSourceAddress,logoTargetAddress:this.logoTargetAddress}},e}();e.CustomFunctionProvider=w,e.CreateCustomFunctionInstance=function e(t){if(t instanceof Array)return t.map((function(t){return e(t)}));if(!(t instanceof Object))return t;var n=JSON.parse(t.value);switch(n.type){case I.valueType:return new I(n.text,n.properties);case C.valueType:return new C(n.primitive,n.numberFormat);case E.valueType:return new E(n.primitive,void 0,n.errorSubCode);case A.valueType:return new A(n.address,n.altText,n.relatedImagesAddress,n.attribution,n.provider);case"Double":case"String":case"Boolean":return n.primitive;default:throw OfficeExtension.Utility.createRuntimeError(R.generalException,"message","CustomFunctionProxy.createRichDataFromJsonString")}};var x=function(){function t(){this._whenInit=void 0,this._isInit=!1,this._setResultsDelayMillis=50,this._setResultsOverdueDelayMillis=2e3,this._maxContextSyncExecutionDurationMills=15e3,this._minContextSyncIntervalMills=500,this._smallerMinContextSyncIntervalMills=200,this._maxContextSyncIntervalMills=2e3,this._setResultsLifeMillis=6e4,this._ensureInitRetryDelayMillis=500,this._resultEntryBuffer={},this._resultEntryRetryBuffer={},this._retryBufferBodySize=0,this._isSetResultsTaskScheduled=!1,this._setResultsTaskOverdueTime=0,this._inProgressContextSyncExpectedFinishTime=0,this._batchQuotaMillis=1e3,this._invocationContextMap={},this._maxResultSize=2e6}return t.prototype._initSettings=function(){if("object"==typeof e.Script&&"object"==typeof e.Script._CustomFunctionSettings){if("number"==typeof e.Script._CustomFunctionSettings.setResultsDelayMillis){var t=e.Script._CustomFunctionSettings.setResultsDelayMillis;t=Math.max(0,t),t=Math.min(1e3,t),this._setResultsDelayMillis=t}if("number"==typeof e.Script._CustomFunctionSettings.ensureInitRetryDelayMillis){var n=e.Script._CustomFunctionSettings.ensureInitRetryDelayMillis;n=Math.max(0,n),n=Math.min(2e3,n),this._ensureInitRetryDelayMillis=n}if("number"==typeof e.Script._CustomFunctionSettings.setResultsLifeMillis){var i=e.Script._CustomFunctionSettings.setResultsLifeMillis;i=Math.max(0,i),i=Math.min(6e5,i),this._setResultsLifeMillis=i}if("number"==typeof e.Script._CustomFunctionSettings.batchQuotaMillis){var r=e.Script._CustomFunctionSettings.batchQuotaMillis;r=Math.max(0,r),r=Math.min(1e3,r),this._batchQuotaMillis=r}}},t.prototype.ensureInit=function(e){var t=this;return this._initSettings(),void 0===this._whenInit&&(this._whenInit=OfficeExtension.Utility._createPromiseFromResult(null).then((function(){if(!t._isInit)return e.eventRegistration.register(5,"",t._handleMessage.bind(t))})).then((function(){t._isInit=!0}))),this._isInit||e._pendingRequest._addPreSyncPromise(this._whenInit),this._whenInit},t.prototype.setCustomFunctionInvoker=function(e){"object"==typeof CustomFunctionMappings&&delete CustomFunctionMappings.__delay__,this._invoker=e},t.prototype.setCustomFunctionAssociation=function(e){var t=this;this._customFunctionMappingsUpperCase=void 0,this._association=e,this._association&&this._association.onchange((function(){t._customFunctionMappingsUpperCase=void 0}))},t.prototype._initFromHostBridge=function(e){var t=this;this._initSettings(),e.addHostMessageHandler((function(e){3===e.type?t._handleMessage(e.message):4===e.type&&t._handleSettings(e.message)})),this._isInit=!0,this._whenInit=OfficeExtension.CoreUtility.Promise.resolve()},t.prototype._handleSettings=function(e){OfficeExtension.Utility.log("CustomFunctionProxy._handleSettings:"+JSON.stringify(e)),e&&"object"==typeof e&&(S.s_shouldLog=e[S.CustomFunctionLoggingFlag])},t.prototype._handleMessage=function(e){try{OfficeExtension.Utility.log("CustomFunctionProxy._handleMessage"),OfficeExtension.Utility.checkArgumentNull(e,"args");for(var n=e.entries,i=[],r=[],o=[],a=0;a<n.length;a++)1===n[a].messageCategory&&("string"==typeof n[a].message&&(n[a].message=JSON.parse(n[a].message)),1e3===n[a].messageType?i.push(n[a]):1001===n[a].messageType?r.push(n[a]):1002===n[a].messageType?o.push(n[a]):OfficeExtension.Utility.log("CustomFunctionProxy._handleMessage unknown message type "+n[a].messageType));if(o.length>0&&this._handleMetadataEntries(o),i.length>0){var s=this._batchInvocationEntries(i);s.length>0&&this._invokeRemainingBatchEntries(s,0)}r.length>0&&this._handleCancellationEntries(r)}catch(e){throw t._tryLog(e),e}return OfficeExtension.Utility._createPromiseFromResult(null)},t.toLogMessage=function(e){var t="Unknown Error";if(e)try{e.toString&&(t=e.toString()),t=t+" "+JSON.stringify(e)}catch(e){t="Unexpected Error"}return t},t._tryLog=function(e){var n=t.toLogMessage(e);OfficeExtension.Utility.log(n)},t.prototype._handleMetadataEntries=function(t){for(var n=0;n<t.length;n++){var i=t[n].message;if(l(i))throw OfficeExtension.Utility.createRuntimeError(R.generalException,"message","CustomFunctionProxy._handleMetadataEntries");e.Script._CustomFunctionMetadata[i.functionName]={options:{stream:i.isStream,cancelable:i.isCancelable}}}},t.prototype._handleCancellationEntries=function(e){for(var n=0;n<e.length;n++){var i=e[n].message;if(l(i))throw OfficeExtension.Utility.createRuntimeError(R.generalException,"message","CustomFunctionProxy._handleCancellationEntries");var r=i.invocationId,o=this._invocationContextMap[r];l(o)||(delete this._invocationContextMap[r],S.logEvent(t.CustomFunctionCancellation,o.functionName),l(o.onCanceled)||o.onCanceled())}},t.prototype._transferCustomFunctionError=function(e){var t=this;return e.map((function(e,n){return null===e?e:null!=e.code&&"CustomFunctionError"==e.type?new E(e.code):e instanceof Array?t._transferCustomFunctionError(e):e}))},t.prototype._transferCustomFunctionRichData=function(e){var t=this;return e.map((function(e,n){return e instanceof Array?t._transferCustomFunctionRichData(e):e instanceof Object?JSON.parse(e.value):e}))},t.prototype._batchInvocationEntries=function(n){for(var r=this,o=[],a=function(a){var c,u=n[a].message;if(Array.isArray(u)?(c={invocationId:u[0],functionName:u[1],parameterValues:u[2],address:u[3],flags:u[4],parameterAddresses:null,isInValuePreview:u[6],isInSyncExecution:u[7],isExecutionTelemetryEnabled:!!u[8]},l(u[5])||(c.parameterAddresses=u[5])):c=u,l(c))throw OfficeExtension.Utility.createRuntimeError(R.generalException,"message","CustomFunctionProxy._batchInvocationEntries");var d=!!c.isExecutionTelemetryEnabled,f=!!c.isInValuePreview,p=void 0;try{p="number"==typeof c.flags?0!=(2&c.flags):void 0}catch(e){p=void 0}if(i({isExecutionTelemetryEnabled:d,granularEventName:"InvocationMessageReceived",invocationId:l(c.invocationId)?void 0:c.invocationId,isSuccess:!0,isStreaming:p,isInValuePreview:f}),l(c.invocationId)||c.invocationId<0)throw i({isExecutionTelemetryEnabled:d,granularEventName:"InvocationValidationFailed",isSuccess:!1,errorCategory:"InvalidInvocationId",isStreaming:p,isInValuePreview:f}),OfficeExtension.Utility.createRuntimeError(R.generalException,"invocationId","CustomFunctionProxy._batchInvocationEntries");if(l(c.functionName))throw i({isExecutionTelemetryEnabled:d,granularEventName:"InvocationValidationFailed",invocationId:c.invocationId,isSuccess:!1,errorCategory:"NullFunctionName",isStreaming:p,isInValuePreview:f}),OfficeExtension.Utility.createRuntimeError(R.generalException,"functionName","CustomFunctionProxy._batchInvocationEntries");var h=null,g=!1,m=!1,v=!1,y=!1;if("number"==typeof c.flags)g=0!=(1&c.flags),m=0!=(2&c.flags),y=0!=(4&c.flags),0!=(8&c.flags)&&(c.parameterValues=s._transferCustomFunctionRichData(c.parameterValues)),y&&(c.parameterValues=s._transferCustomFunctionError(c.parameterValues));else{var b=e.Script._CustomFunctionMetadata[c.functionName];if(l(b))return S.logEvent(t.CustomFunctionExecutionNotFoundLog,c.functionName),i({isExecutionTelemetryEnabled:d,granularEventName:"FunctionMetadataNotFound",invocationId:c.invocationId,isSuccess:!1,errorCategory:"MissingMetadata",internalErrorCode:9,isStreaming:p,isInValuePreview:f}),OfficeExtension.Utility.isSetSupported("CustomFunctions","1.8")?s._setError(c.invocationId,c.isInValuePreview||c.isInSyncExecution,null,9):s._setError(c.invocationId,c.isInValuePreview||c.isInSyncExecution,"N/A",1),"continue";g=b.options.cancelable,m=b.options.stream}if(s._invoker&&!s._customFunctionMappingsContains(c.functionName))return i({isExecutionTelemetryEnabled:d,granularEventName:"DispatchPathSelected",invocationId:c.invocationId,isSuccess:!0,isStreaming:m,isBatching:!1,executionPath:"Invoker",isInValuePreview:f}),s._invokeFunctionUsingInvoker(c),"continue";i({isExecutionTelemetryEnabled:d,granularEventName:"DispatchPathSelected",invocationId:c.invocationId,isSuccess:!0,isStreaming:m,isBatching:v,executionPath:"Direct",isInValuePreview:f});try{h=s._getFunction(c.functionName)}catch(e){return S.logEvent(t.CustomFunctionExecutionNotFoundLog,c.functionName),i({isExecutionTelemetryEnabled:d,granularEventName:"FunctionMappingNotFound",invocationId:c.invocationId,isSuccess:!1,errorCategory:"InvalidFunctionMapping",internalErrorCode:10,isStreaming:m,isBatching:v,executionPath:"Direct",isInValuePreview:f}),OfficeExtension.Utility.isSetSupported("CustomFunctions","1.8")?s._setError(c.invocationId,c.isInValuePreview||c.isInSyncExecution,e,10):s._setError(c.invocationId,c.isInValuePreview||c.isInSyncExecution,e,1),"continue"}l(h)?i({isExecutionTelemetryEnabled:d,granularEventName:"FunctionMappingNotFound",invocationId:c.invocationId,isSuccess:!1,errorCategory:"MissingFunction",internalErrorCode:10,isStreaming:m,isBatching:v,executionPath:"Direct",isInValuePreview:f}):i({isExecutionTelemetryEnabled:d,granularEventName:"FunctionMappingFound",invocationId:c.invocationId,isSuccess:!0,isStreaming:m,isBatching:v,executionPath:"Direct",isInValuePreview:f});var O=void 0;if(m||g){var E=void 0,I=void 0;m&&(E=function(e){r._invocationContextMap[c.invocationId]?r._setResult(c.invocationId,c.isInValuePreview||c.isInSyncExecution,e,d,"Direct",!0):S.logEvent(t.CustomFunctionAlreadyCancelled,c.functionName)},I=function(e){if(r._invocationContextMap[c.invocationId]){var n=r._getCustomFunctionResultErrorCodeFromErrorCode(e.code);r._setError(c.invocationId,c.isInValuePreview||c.isInSyncExecution,e.message,n,d,"Direct",!0)}else S.logEvent(t.CustomFunctionAlreadyCancelled,c.functionName)}),O=new _(c.functionName,c.address,c.parameterAddresses,c.isInValuePreview,c.isInSyncExecution,c.invocationId,E,I),s._invocationContextMap[c.invocationId]=O}else O=new _(c.functionName,c.address,c.parameterAddresses,c.isInValuePreview,c.isInSyncExecution,c.invocationId);c.parameterValues.push(O),o.push({call:h,isBatching:v,isStreaming:m,invocationIds:[c.invocationId],parameterValueSets:[c.parameterValues],functionName:c.functionName,isInValuePreview:c.isInValuePreview,isInSyncExecution:c.isInSyncExecution,isExecutionTelemetryEnabled:!!c.isExecutionTelemetryEnabled})},s=this,c=0;c<n.length;c++)a(c);return o},t.prototype._invokeFunctionUsingInvoker=function(e){var t=this,n=0!=(1&e.flags),r=0!=(2&e.flags),o=e.invocationId,a=!!e.isExecutionTelemetryEnabled,s=Date.now(),c=void 0,u=void 0,l=!1;if(r)c=function(n){t._invocationContextMap[o]&&t._setResult(o,e.isInValuePreview||e.isInSyncExecution,n,a,"Invoker",!0)},u=function(n){if(t._invocationContextMap[o]){var i=t._getCustomFunctionResultErrorCodeFromErrorCode(n.code);t._setError(o,e.isInValuePreview||e.isInSyncExecution,n.message,i,a,"Invoker",!0)}};else{var d=!1;c=function(n){d||(l=!0,i({isExecutionTelemetryEnabled:a,granularEventName:"FunctionExecutionSucceeded",invocationId:o,isSuccess:!0,executionTimeMs:Date.now()-s,isStreaming:!1,isBatching:!1,executionPath:"Invoker",isInValuePreview:!!e.isInValuePreview}),t._setResult(o,e.isInValuePreview||e.isInSyncExecution,n,a,"Invoker",!1)),d=!0},u=function(n){if(!d){var r=t._getCustomFunctionResultErrorCodeFromErrorCode(n.code);l=!0,i({isExecutionTelemetryEnabled:a,granularEventName:"FunctionExecutionFailed",invocationId:o,isSuccess:!1,executionTimeMs:Date.now()-s,errorCategory:"CustomFunctionError",internalErrorCode:r,isStreaming:!1,isBatching:!1,executionPath:"Invoker",isInValuePreview:!!e.isInValuePreview}),t._setError(o,e.isInValuePreview||e.isInSyncExecution,n.message,r,a,"Invoker",!1)}d=!0}}var f=new _(e.functionName,e.address,e.parameterAddresses,e.isInValuePreview,e.isInSyncExecution,e.invocationId,c,u);(r||n)&&(this._invocationContextMap[o]=f);try{i({isExecutionTelemetryEnabled:a,granularEventName:"FunctionExecutionStarted",invocationId:o,isSuccess:!0,isStreaming:r,isBatching:!1,executionPath:"Invoker",isInValuePreview:!!e.isInValuePreview}),this._invoker.invoke(e.functionName,e.parameterValues,f)}catch(t){throw l||i({isExecutionTelemetryEnabled:a,granularEventName:"FunctionExecutionFailed",invocationId:o,isSuccess:!1,executionTimeMs:Date.now()-s,errorCategory:"ExceptionThrown",internalErrorCode:2,isStreaming:r,isBatching:!1,executionPath:"Invoker",isInValuePreview:!!e.isInValuePreview}),t}},t.prototype._ensureCustomFunctionMappingsUpperCase=function(){if(l(this._customFunctionMappingsUpperCase)){if(this._customFunctionMappingsUpperCase={},"object"==typeof CustomFunctionMappings)for(var e in OfficeExtension.CoreUtility.log("CustomFunctionMappings.Keys="+JSON.stringify(Object.keys(CustomFunctionMappings))),CustomFunctionMappings)this._customFunctionMappingsUpperCase[e.toUpperCase()]&&S.logEvent(t.CustomFunctionDuplicatedName,e),this._customFunctionMappingsUpperCase[e.toUpperCase()]=CustomFunctionMappings[e];if(this._association)for(var e in OfficeExtension.CoreUtility.log("CustomFunctionAssociateMappings.Keys="+JSON.stringify(Object.keys(this._association.mappings))),this._association.mappings)this._customFunctionMappingsUpperCase[e.toUpperCase()]&&S.logEvent(t.CustomFunctionDuplicatedName,e),this._customFunctionMappingsUpperCase[e.toUpperCase()]=this._association.mappings[e]}},t.prototype._customFunctionMappingsContains=function(e){this._ensureCustomFunctionMappingsUpperCase();var t=e.toUpperCase();if(!l(this._customFunctionMappingsUpperCase[t]))return!0;if("undefined"!=typeof window){for(var n=window,i=e.split("."),r=0;r<i.length-1;r++)if(n=n[i[r]],l(n)||"object"!=typeof n)return!1;if("function"==typeof n[i[i.length-1]])return!0}return!1},t.prototype._getCustomFunctionMappings=function(e){this._ensureCustomFunctionMappingsUpperCase();var t=e.toUpperCase();if(!l(this._customFunctionMappingsUpperCase[t])){if("function"==typeof this._customFunctionMappingsUpperCase[t])return this._customFunctionMappingsUpperCase[t];throw OfficeExtension.Utility.createRuntimeError(R.invalidOperation,OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.customFunctionInvalidFunctionMapping,e),"CustomFunctionProxy._getCustomFunctionMappings")}},t.prototype._getFunction=function(e){return this._getCustomFunctionMappings(e)},t.prototype._invokeRemainingBatchEntries=function(e,t,n){void 0===n&&(n=-1),OfficeExtension.Utility.log("CustomFunctionProxy._invokeRemainingBatchEntries");for(var r=Date.now(),o=t;o<e.length;o++){var a=Date.now()-r;if(!(a<this._batchQuotaMillis)){OfficeExtension.Utility.log("setTimeout(CustomFunctionProxy._invokeRemainingBatchEntries)");for(var s=!1,c=o;c<e.length;c++)if(e[c].isExecutionTelemetryEnabled&&!e[c].isStreaming){s=!0;break}i({isExecutionTelemetryEnabled:s,granularEventName:"BatchExecutionDeferred",isSuccess:!0,waitingTimeMs:a}),setTimeout(this._invokeRemainingBatchEntries.bind(this),0,e,o,n>0?n:r);break}this._invokeFunctionAndSetResult(e[o],n>0?n:r)}},t.prototype._invokeFunctionAndSetResult=function(e,n){var r,o=this;S.logEvent(t.CustomFunctionExecutionStartLog,e.functionName);for(var a=Date.now(),s=a-n,c=0;c<e.invocationIds.length;c++)i({isExecutionTelemetryEnabled:e.isExecutionTelemetryEnabled,granularEventName:"FunctionExecutionStarted",invocationId:e.invocationIds[c],isSuccess:!0,waitingTimeMs:s,isStreaming:e.isStreaming,isBatching:e.isBatching,executionPath:"Direct",isInValuePreview:!!e.isInValuePreview});try{r=e.isBatching?e.call.call(null,e.parameterValueSets):[e.call.apply(null,e.parameterValueSets[0])]}catch(n){var u=[];u.push(Date.now()-a),F.isFeatureEnabled(6)&&u.push(s);for(c=0;c<e.invocationIds.length;c++){var d=void 0,f=void 0,p=void 0;n instanceof E?(d="CustomFunctionError",f=this._getCustomFunctionResultErrorCodeFromErrorCode(n.code),p=n.message):(d="ExceptionThrown",f=2,p=n),i({isExecutionTelemetryEnabled:e.isExecutionTelemetryEnabled,granularEventName:"FunctionExecutionFailed",invocationId:e.invocationIds[c],isSuccess:!1,executionTimeMs:Date.now()-a,waitingTimeMs:s,errorCategory:d,internalErrorCode:f,isStreaming:e.isStreaming,isBatching:e.isBatching,executionPath:"Direct",isInValuePreview:!!e.isInValuePreview}),this._setErrorWithOutboundData(e.invocationIds[c],e.isInValuePreview||e.isInSyncExecution,p,f,u,e.isExecutionTelemetryEnabled,"Direct",e.isStreaming)}return void S.logEvent(t.CustomFunctionExecutionExceptionThrownLog,e.functionName,t.toLogMessage(n))}var h=[];if(F.isFeatureEnabled(3)||h.push(Date.now()-a),e.isStreaming);else if(r.length===e.parameterValueSets.length){var g=function(n){l(r[n])||"object"!=typeof r[n]||"function"!=typeof r[n].then?(F.isFeatureEnabled(3)&&(h.push(Date.now()-a),F.isFeatureEnabled(6)&&h.push(s)),S.logEvent(t.CustomFunctionExecutionFinishLog,e.functionName),i({isExecutionTelemetryEnabled:e.isExecutionTelemetryEnabled,granularEventName:"FunctionExecutionSucceeded",invocationId:e.invocationIds[n],isSuccess:!0,executionTimeMs:Date.now()-a,waitingTimeMs:s,isStreaming:e.isStreaming,isBatching:e.isBatching,executionPath:"Direct",isInValuePreview:!!e.isInValuePreview}),m._setResultWithOutboundData(e.invocationIds[n],e.isInValuePreview||e.isInSyncExecution,r[n],h,e.isExecutionTelemetryEnabled,"Direct",e.isStreaming)):r[n].then((function(r){F.isFeatureEnabled(3)&&(h.push(Date.now()-a),F.isFeatureEnabled(6)&&h.push(s)),S.logEvent(t.CustomFunctionExecutionFinishLog,e.functionName),i({isExecutionTelemetryEnabled:e.isExecutionTelemetryEnabled,granularEventName:"FunctionExecutionSucceeded",invocationId:e.invocationIds[n],isSuccess:!0,executionTimeMs:Date.now()-a,waitingTimeMs:s,isStreaming:e.isStreaming,isBatching:e.isBatching,executionPath:"Direct",isInValuePreview:!!e.isInValuePreview}),o._setResultWithOutboundData(e.invocationIds[n],e.isInValuePreview||e.isInSyncExecution,r,h,e.isExecutionTelemetryEnabled,"Direct",e.isStreaming)}),(function(r){if(F.isFeatureEnabled(3)&&(h.push(Date.now()-a),F.isFeatureEnabled(6)&&h.push(s)),S.logEvent(t.CustomFunctionExecutionRejectedPromoseLog,e.functionName,t.toLogMessage(r)),r instanceof E){var c=o._getCustomFunctionResultErrorCodeFromErrorCode(r.code);i({isExecutionTelemetryEnabled:e.isExecutionTelemetryEnabled,granularEventName:"FunctionExecutionFailed",invocationId:e.invocationIds[n],isSuccess:!1,executionTimeMs:Date.now()-a,waitingTimeMs:s,errorCategory:"CustomFunctionError",internalErrorCode:c,isStreaming:e.isStreaming,isBatching:e.isBatching,executionPath:"Direct",isInValuePreview:!!e.isInValuePreview}),o._setErrorWithOutboundData(e.invocationIds[n],e.isInValuePreview||e.isInSyncExecution,r,c,h,e.isExecutionTelemetryEnabled,"Direct",e.isStreaming)}else i({isExecutionTelemetryEnabled:e.isExecutionTelemetryEnabled,granularEventName:"FunctionExecutionFailed",invocationId:e.invocationIds[n],isSuccess:!1,executionTimeMs:Date.now()-a,waitingTimeMs:s,errorCategory:"RejectedPromise",internalErrorCode:3,isStreaming:e.isStreaming,isBatching:e.isBatching,executionPath:"Direct",isInValuePreview:!!e.isInValuePreview}),o._setErrorWithOutboundData(e.invocationIds[n],e.isInValuePreview||e.isInSyncExecution,r,3,h,e.isExecutionTelemetryEnabled,"Direct",e.isStreaming)}))},m=this;for(c=0;c<r.length;c++)g(c)}else{F.isFeatureEnabled(3)&&(h.push(Date.now()-a),F.isFeatureEnabled(6)&&h.push(s)),S.logEvent(t.CustomFunctionExecutionBatchMismatchLog,e.functionName);for(c=0;c<e.invocationIds.length;c++)i({isExecutionTelemetryEnabled:e.isExecutionTelemetryEnabled,granularEventName:"FunctionExecutionFailed",invocationId:e.invocationIds[c],isSuccess:!1,executionTimeMs:Date.now()-a,waitingTimeMs:s,errorCategory:"BatchMismatch",internalErrorCode:4,isStreaming:e.isStreaming,isBatching:e.isBatching,executionPath:"Direct",isInValuePreview:!!e.isInValuePreview}),this._setErrorWithOutboundData(e.invocationIds[c],e.isInValuePreview||e.isInSyncExecution,OfficeExtension.Utility._getResourceString(OfficeExtension.ResourceStrings.customFunctionUnexpectedNumberOfEntriesInResultBatch),4,h,e.isExecutionTelemetryEnabled,"Direct",e.isStreaming)}},t.prototype._setResult=function(e,t,n,i,r,o){var a=[];a.push(0),this._setResultWithOutboundData(e,t,n,a,i,r,o)},t.prototype._setResultWithOutboundData=function(e,n,r,o,a,s,c){var u,l,d={id:e,value:r,outboundData:o},f="Primitive";"number"==typeof r?isNaN(r)?(d.failed=!0,d.value="NaN",u="NaN",f="NaN"):isFinite(r)||(d.failed=!0,d.value="Infinity",d.errorCode=6,u="Infinity",l=6,f="Infinity"):r instanceof E?(d.failed=!1,d.value=r.toJSON(),f="CustomFunctionError"):r instanceof I||r instanceof C||r instanceof A?(d.failed=!1,d.value=r.toJSON(),f=r instanceof I?"Entity":r instanceof C?"FormattedNumber":"WebImage"):r instanceof Error&&(d.failed=!0,d.value=t.toLogMessage(r),d.errorCode=0,u="ErrorObject",l=0,f="ErrorObject"),i({isExecutionTelemetryEnabled:!!a,granularEventName:"FunctionResultClassified",invocationId:e,isSuccess:!d.failed,resultType:f,convertedErrorCategory:u,convertedErrorCode:l,isStreaming:c,isBatching:!1,executionPath:s,isInValuePreview:!!n});var p=Date.now();this._resultEntryBuffer[e]={timeCreated:p,allowImmediateExecution:n,result:d,isExecutionTelemetryEnabled:!!a&&!c},this._ensureSetResultsTaskIsScheduled(p)},t.prototype._setError=function(e,t,n,i,r,o,a){var s=[];s.push(0),this._setErrorWithOutboundData(e,t,n,i,s,r,o,a)},t.prototype._setErrorWithOutboundData=function(e,t,n,r,o,a,s,c){var u="";l(n)||(n instanceof E&&!l(n.message)?u=n.message:"string"==typeof n&&(u=n));var d={id:e,failed:!0,value:u,errorCode:r,outboundData:o};i({isExecutionTelemetryEnabled:!!a,granularEventName:"FunctionErrorBuffered",invocationId:e,isSuccess:!1,errorCategory:""+r,internalErrorCode:r,isStreaming:c,isBatching:!1,executionPath:s,isInValuePreview:!!t});var f=Date.now();this._resultEntryBuffer[e]={timeCreated:f,allowImmediateExecution:t,result:d,isExecutionTelemetryEnabled:!!a&&!c},this._ensureSetResultsTaskIsScheduled(f)},t.prototype._getCustomFunctionResultErrorCodeFromErrorCode=function(e){var t;switch(e){case b.notAvailable:t=1;break;case b.divisionByZero:t=5;break;case b.invalidValue:t=7;break;case b.invalidNumber:t=6;break;case b.nullReference:t=8;break;default:t=7}return t},t.prototype._ensureSetResultsTaskIsScheduled=function(e){if(this._setResultsTaskOverdueTime>0&&e>this._setResultsTaskOverdueTime)return OfficeExtension.Utility.log("SetResultsTask overdue"),void this._executeSetResultsTask();this._isSetResultsTaskScheduled||(OfficeExtension.Utility.log("setTimeout(CustomFunctionProxy._executeSetResultsTask)"),setTimeout(this._executeSetResultsTask.bind(this),this._setResultsDelayMillis),this._isSetResultsTaskScheduled=!0,this._setResultsTaskOverdueTime=e+this._setResultsDelayMillis+this._setResultsOverdueDelayMillis)},t.prototype._convertCustomFunctionInvocationResultToArray=function(e){var t=[];return t.push(e.id),t.push(!e.failed),OfficeExtension.CoreUtility.isUndefined(e.value)?t.push(null):t.push(e.value),e.failed&&(OfficeExtension.CoreUtility.isUndefined(e.errorCode)?t.push(0):t.push(e.errorCode)),OfficeExtension.Utility.isSetSupported("CustomFunctions","1.9")&&t.push(e.outboundData),t},t.prototype._executeSetResultsTask=function(){var e=this;OfficeExtension.Utility.log("CustomFunctionProxy._executeSetResultsTask");var t=Date.now();if(this._inProgressContextSyncExpectedFinishTime>0&&this._inProgressContextSyncExpectedFinishTime>t){OfficeExtension.Utility.log("context.sync() is in progress. setTimeout(CustomFunctionProxy._executeSetResultsTask)");var n=!1;try{for(var r in this._resultEntryBuffer)if(this._resultEntryBuffer[r].isExecutionTelemetryEnabled){n=!0;break}if(!n)for(var r in this._resultEntryRetryBuffer)if(this._resultEntryRetryBuffer[r].isExecutionTelemetryEnabled){n=!0;break}}catch(e){}return i({isExecutionTelemetryEnabled:n,granularEventName:"ResultDeliveryDeferred",isSuccess:!0}),setTimeout(this._executeSetResultsTask.bind(this),this._setResultsDelayMillis),void(this._setResultsTaskOverdueTime=t+this._setResultsDelayMillis+this._setResultsOverdueDelayMillis)}this._isSetResultsTaskScheduled=!1,this._setResultsTaskOverdueTime=0;var o={},a=!1;F.isFeatureEnabled(1)&&Object.keys(this._resultEntryRetryBuffer).length>0?(o=this._resultEntryRetryBuffer,this._resultEntryRetryBuffer={},this._retryBufferBodySize=2,a=!0):(o=this._resultEntryBuffer,this._resultEntryBuffer={});var s=OfficeExtension.Utility.isSetSupported("CustomFunctions","1.7"),c=[],u=[],l=!1;for(var r in o)o[r].isExecutionTelemetryEnabled&&(l=!0),o[r].allowImmediateExecution?(s?u.push(this._convertCustomFunctionInvocationResultToArray(o[r].result)):u.push(o[r].result),delete o[r]):s?c.push(this._convertCustomFunctionInvocationResultToArray(o[r].result)):c.push(o[r].result);if(0!==c.length||0!==u.length){var d=new v;d._requestFlagModifier|=16384,u.length>0&&(d._requestFlagModifier|=8192,this._restoreResultEntries(t,o),c=u),s?d.customFunctions.setInvocationArrayResults(c):d.customFunctions.setInvocationResults(c);var f=Date.now();this._inProgressContextSyncExpectedFinishTime=f+this._maxContextSyncExecutionDurationMills,i({isExecutionTelemetryEnabled:l,granularEventName:"ResultDeliveryStarted",isSuccess:!0}),d.sync().then((function(t){var n=Date.now();e._clearInProgressContextSyncExpectedFinishTimeAfterMinInterval(n-f),i({isExecutionTelemetryEnabled:l,granularEventName:"ResultDeliverySucceeded",isSuccess:!0,executionTimeMs:n-f}),a&&e._ensureSetResultsTaskIsScheduled(n)}),(function(t){var n=Date.now();e._clearInProgressContextSyncExpectedFinishTimeAfterMinInterval(n-f);var r="SyncFailed";F.isFeatureEnabled(1)&&t.code==OfficeExtension.ErrorCodes.requestPayloadSizeLimitExceeded?(r="PayloadSizeExceeded",e._restoreAndSliceResultEntries(n,o)):e._restoreResultEntries(n,o),i({isExecutionTelemetryEnabled:l,granularEventName:"ResultDeliveryFailed",isSuccess:!1,executionTimeMs:n-f,errorCategory:r}),e._ensureSetResultsTaskIsScheduled(n)}))}},t.prototype._restoreResultEntries=function(e,t){for(var n in t){var i=t[n];e-i.timeCreated<=this._setResultsLifeMillis&&(this._resultEntryBuffer[n]||(this._resultEntryBuffer[n]=i))}},t.prototype._restoreAndSliceResultEntries=function(e,t){for(var n in t){var i=t[n],r=void 0;if(e-i.timeCreated<=this._setResultsLifeMillis&&!this._resultEntryBuffer[n]){try{r=JSON.stringify(this._convertCustomFunctionInvocationResultToArray(i.result)).length+1}catch(e){this._resultEntryBuffer[n]=i,OfficeExtension.Utility.log("Result can't pass in JSON.stringify");continue}this._retryBufferBodySize+r<this._maxResultSize?(this._resultEntryRetryBuffer[n]=i,this._retryBufferBodySize+=r):this._resultEntryBuffer[n]=i}}},t.prototype._clearInProgressContextSyncExpectedFinishTimeAfterMinInterval=function(e){var t=this,n=F.isFeatureEnabled(2)?this._smallerMinContextSyncIntervalMills:this._minContextSyncIntervalMills,i=Math.max(n,2*e),r=F.isFeatureEnabled(4)?Math.min(this._maxContextSyncIntervalMills,i):i;OfficeExtension.Utility.log("setTimeout(clearInProgressContestSyncExpectedFinishedTime,"+i+")"),setTimeout((function(){OfficeExtension.Utility.log("clearInProgressContestSyncExpectedFinishedTime"),t._inProgressContextSyncExpectedFinishTime=0}),r)},t.CustomFunctionExecutionStartLog=new O(y.Verbose,"CustomFunctions [Execution] [Begin] Function="),t.CustomFunctionExecutionFailureLog=new O(y.Error,"CustomFunctions [Execution] [End] [Failure] Function="),t.CustomFunctionExecutionRejectedPromoseLog=new O(y.Error,"CustomFunctions [Execution] [End] [Failure] [RejectedPromise] Function="),t.CustomFunctionExecutionExceptionThrownLog=new O(y.Error,"CustomFunctions [Execution] [End] [Failure] [ExceptionThrown] Function="),t.CustomFunctionExecutionBatchMismatchLog=new O(y.Error,"CustomFunctions [Execution] [End] [Failure] [BatchMismatch] Function="),t.CustomFunctionExecutionFinishLog=new O(y.Info,"CustomFunctions [Execution] [End] [Success] Function="),t.CustomFunctionExecutionNotFoundLog=new O(y.Error,"CustomFunctions [Execution] [NotFound] Function="),t.CustomFunctionCancellation=new O(y.Info,"CustomFunctions [Cancellation] Function="),t.CustomFunctionAlreadyCancelled=new O(y.Info,"CustomFunctions [AlreadyCancelled] Function="),t.CustomFunctionDuplicatedName=new O(y.Error,"CustomFunctions [DuplicatedName] Function="),t.CustomFunctionInvalidArg=new O(y.Error,"CustomFunctions [InvalidArg] Name="),t}();e.CustomFunctionProxy=x,e.customFunctionProxy=new x,e.setCustomFunctionAssociation=e.customFunctionProxy.setCustomFunctionAssociation.bind(e.customFunctionProxy),e.setCustomFunctionInvoker=e.customFunctionProxy.setCustomFunctionInvoker.bind(e.customFunctionProxy),OfficeExtension.HostBridge.onInited((function(t){e.customFunctionProxy._initFromHostBridge(t)}));var F=function(i){function a(){return null!==i&&i.apply(this,arguments)||this}return __extends(a,i),Object.defineProperty(a.prototype,"_className",{get:function(){return"CustomFunctions"},enumerable:!0,configurable:!0}),a.isFeatureEnabled=function(e){return this._enabledFeature instanceof Array&&this._enabledFeature.indexOf(e)>=0},a.initialize=function(){var i=this,o=0,s=function(){var a=new v;return e.customFunctionProxy.ensureInit(a).then((function(){var e,c=a.customFunctions._SetOsfAndCheckRuntimeReadyForCustomFunctions();return OfficeExtension.Utility.isSetSupported("CustomFunctions","1.9")&&(e=a.customFunctions._GetEnabledFeatures()),OfficeExtension.CoreUtility.log("OsfControl activation lifecycle: Checking runtime ready for CustomFunctions"),a._customData="SetOsfAndCheckRuntimeReadyForCustomFunctions",a.sync().then((function(){if(l(e)||(i._enabledFeature=e.value),c.value)return OfficeExtension.CoreUtility.log("Runtime is ready for CustomFunctions"),void(t()&&n((function(){return{eventName:"Office.Extensibility.OfficeJs.CustomFunctionsInitialize",dataFields:[oteljs.makeStringDataField("GranularEventName","CustomFunctionRuntimeReadyCheck"),oteljs.makeBooleanDataField("IsReady",!0),oteljs.makeStringDataField("RetryCount",""+o)],eventFlags:{dataCategories:oteljs.DataCategories.ProductServiceUsage,diagnosticLevel:oteljs.DiagnosticLevel.NecessaryServiceDataEvent}}})));var r=100===++o;r&&OfficeExtension.CoreUtility.log("Max retries (100) reached for CustomFunctions runtime ready check"),(1===o||o%10==0||r)&&o<=100&&t()&&n((function(){return{eventName:"Office.Extensibility.OfficeJs.CustomFunctionsInitialize",dataFields:[oteljs.makeStringDataField("GranularEventName","CustomFunctionRuntimeReadyCheck"),oteljs.makeBooleanDataField("IsReady",!1),oteljs.makeBooleanDataField("MaxRetriesReached",r),oteljs.makeStringDataField("RetryCount",""+o),oteljs.makeStringDataField("RetryReason","RuntimeNotReady")],eventFlags:{dataCategories:oteljs.DataCategories.ProductServiceUsage,diagnosticLevel:oteljs.DiagnosticLevel.NecessaryServiceDataEvent}}})),OfficeExtension.CoreUtility.log("Runtime is not ready for CustomFunctions, retrying after 100ms");return new OfficeExtension.CoreUtility.Promise((function(e){return setTimeout(e,100)})).then((function(){return s()}))})).catch((function(e){var i=!1;try{i=e instanceof OfficeExtension.Error&&e.code===R.invalidOperationInCellEditMode}catch(e){}!function(e,t){try{null!=e&&"object"==typeof e&&Object.defineProperty(e,"__cfFailureSource",{value:t,enumerable:!1,configurable:!0,writable:!0})}catch(e){}}(e,"ContextSync"),t()&&n((function(){return{eventName:"Office.Extensibility.OfficeJs.CustomFunctionsInitialize",dataFields:[oteljs.makeStringDataField("GranularEventName","CustomFunctionRuntimeReadyCheck"),oteljs.makeBooleanDataField("IsReady",!1),oteljs.makeStringDataField("RetryCount",""+o),oteljs.makeStringDataField("RetryReason",i?"CellEditMode":"ContextSync"),oteljs.makeBooleanDataField("IsCellEditModeError",i)].concat(r(e)),eventFlags:{dataCategories:oteljs.DataCategories.ProductServiceUsage,diagnosticLevel:oteljs.DiagnosticLevel.NecessaryServiceDataEvent}}})),p(e,!0)}))})).catch((function(e){throw function(e,t){try{null!=e&&"object"==typeof e&&"string"!=typeof e.__cfFailureSource&&Object.defineProperty(e,"__cfFailureSource",{value:t,enumerable:!1,configurable:!0,writable:!0})}catch(e){}}(e,"EnsureInit"),e}))},c=!1;try{var u=window.OSF;if(u&&u._OfficeAppFactory&&u._OfficeAppFactory.getHostInfo&&u.HostInfoFlags){var d=u._OfficeAppFactory.getHostInfo();d&&void 0!==d.flags&&(c=0!=(d.flags&u.HostInfoFlags.CustomFunctionsInitAfterCFRuntimeReady))}}catch(e){OfficeExtension.CoreUtility.log("Error in getting the flighting value from HostInfoFlags: "+e)}if(c)return OfficeExtension.CoreUtility.log("Flight enabled, triggering the new flow"),s();OfficeExtension.CoreUtility.log("Flight not enabled, triggering the existing flow");var f=new v;return e.customFunctionProxy.ensureInit(f).then((function(){var e;return f.customFunctions._SetOsfControlContainerReadyForCustomFunctions(),OfficeExtension.Utility.isSetSupported("CustomFunctions","1.9")&&(e=f.customFunctions._GetEnabledFeatures()),OfficeExtension.Utility.log("OsfControl activation lifecycle: Set OsfControlContainer ready for CustomFunctions"),f._customData="SetOsfControlContainerReadyForCustomFunctions",f.sync().then((function(){l(e)||(i._enabledFeature=e.value)})).catch((function(e){p(e,!0)}))}));function p(t,n){var i=t instanceof OfficeExtension.Error&&t.code===R.invalidOperationInCellEditMode;if(OfficeExtension.CoreUtility.log("Error on starting custom functions: "+t),i){OfficeExtension.CoreUtility.log("Was in cell-edit mode, will try again");var r=e.customFunctionProxy._ensureInitRetryDelayMillis;return new OfficeExtension.CoreUtility.Promise((function(e){return setTimeout(e,r)})).then((function(){return a.initialize()}))}if(n)throw t}},a.logRuntime=function(e,t){var n=new v;n.customFunctions.logCustomFunctionsRuntime(e,t),n.sync()},a.prototype.logCustomFunctionsRuntime=function(e,t){d("CustomFunctions.logCustomFunctionsRuntime","CustomFunctions","1.6",o),u(this,"LogCustomFunctionsRuntime",1,[e,t],4,0)},a.prototype.setInvocationArrayResults=function(e){u(this,"SetInvocationArrayResults",0,[e],2,0)},a.prototype.setInvocationResults=function(e){u(this,"SetInvocationResults",0,[e],2,0)},a.prototype._GetEnabledFeatures=function(){return u(this,"_GetEnabledFeatures",1,[],4,0)},a.prototype._SetInvocationError=function(e,t){u(this,"_SetInvocationError",0,[e,t],2,0)},a.prototype._SetInvocationResult=function(e,t){u(this,"_SetInvocationResult",0,[e,t],2,0)},a.prototype._SetOsfAndCheckRuntimeReadyForCustomFunctions=function(){return u(this,"_SetOsfAndCheckRuntimeReadyForCustomFunctions",0,[],10,0)},a.prototype._SetOsfControlContainerReadyForCustomFunctions=function(){u(this,"_SetOsfControlContainerReadyForCustomFunctions",0,[],10,0)},a.prototype._handleResult=function(e){(i.prototype._handleResult.call(this,e),l(e))||h(this,e)},a.prototype._handleRetrieveResult=function(e,t){i.prototype._handleRetrieveResult.call(this,e,t),m(this,e,t)},a.newObject=function(t){return c(e.CustomFunctions,t,"Microsoft.ExcelServices.CustomFunctions",!1,4)},a.prototype.toJSON=function(){return p(this,{},{})},a}(OfficeExtension.ClientObject);e.CustomFunctions=F;var R,N=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),Object.defineProperty(n.prototype,"_className",{get:function(){return"CustomFunctionsContainer"},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"_navigationPropertyNames",{get:function(){return["customFunctions"]},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"customFunctions",{get:function(){return d("CustomFunctionsContainer.customFunctions","CustomFunctions","1.2",o),this._C||(this._C=a(e.CustomFunctions,this,"CustomFunctions",!1,4)),this._C},enumerable:!0,configurable:!0}),n.prototype._handleResult=function(e){if(t.prototype._handleResult.call(this,e),!l(e)){var n=e;h(this,n),g(this,n,["customFunctions","CustomFunctions"])}},n.prototype.load=function(e){return f(this,e)},n.prototype._handleRetrieveResult=function(e,n){t.prototype._handleRetrieveResult.call(this,e,n),m(this,e,n)},n.prototype.toJSON=function(){return p(this,{},{})},n}(OfficeExtension.ClientObject);e.CustomFunctionsContainer=N,function(e){e.generalException="GeneralException",e.invalidOperation="InvalidOperation",e.invalidOperationInCellEditMode="InvalidOperationInCellEditMode"}(R||(R={}))}(Excel||(Excel={})),function(e){!function(e){function t(){try{if(void 0!==OSF&&void 0!==OSF.isOfficeReactNative&&OSF.isOfficeReactNative())return!0}catch(e){}return!1}function n(){var e="web";try{void 0!==OSF&&void 0!==OSF._OfficeAppFactory&&void 0!==OSF._OfficeAppFactory.getHostInfo&&(e=OSF._OfficeAppFactory.getHostInfo().hostPlatform)}catch(e){}return e}e.isNativeStorage=function(){var e=n();return!(function(){try{if(void 0!==OSF&&void 0!==OSF._OfficeAppFactory&&void 0!==OSF._OfficeAppFactory.getHostInfo&&OSF._OfficeAppFactory.getHostInfo().flags&OSF.HostInfoFlags.SharedApp)return!0}catch(e){}return!1}()||!(t()||"win32"===e||"mac"===e&&window._useSDXSandbox))},e.isNativeApiInfomation=function(){var e=n();return!!(t()||"win32"===e||"mac"===e&&window._useSDXSandbox)},e.isNativeDialog=function(){var e=n();return!(!t()&&"win32"!==e)}}(e.ApiHelper||(e.ApiHelper={}))}(OfficeRuntime||(OfficeRuntime={})),function(e){e.ApiHelper.isNativeApiInfomation()?e.apiInformation=t:e.apiInformation=n;var t={isSetSupported:function(e,t){if("string"!=typeof e)return!1;if(null==t&&(t="0.0.0"),void 0===global.__apiSets)return!1;var n=global.__apiSets,r=Object.keys(n).map((function(e){return e.toLowerCase()})).indexOf(e.toLowerCase());if(r>-1){var o=n[Object.keys(n)[r]];try{var a=i(t),s=void 0;if((s=Array.isArray(o)?function(e,t){for(var n=0;n<e.length;n++){var r=i(e[n]);if(r.major==t)return r}return{major:0,minor:0,patch:0}}(o,a.major):i(o)).major>0){if(s.major>a.major)return!0;if(s.major==a.major&&s.minor>a.minor)return!0;if(s.major==a.major&&s.minor==a.minor&&s.patch>=a.patch)return!0}}catch(e){return!1}}return!1}},n={isSetSupported:function(e,t){try{return!!(Office&&Office.context&&Office.context.requirements)&&Office.context.requirements.isSetSupported(e,Number(t))}catch(e){return!1}}};function i(e){var t=e.split("."),n=0,i=0,r=0;if(t.length<2&&isNaN(Number(e)))throw"version format incorrect";if(n=Number(t[0]),t.length>=2&&(i=Number(t[1])),t.length>=3&&(r=Number(t[2])),isNaN(n)||isNaN(i)||isNaN(r))throw"version format incorrect";return{major:n,minor:i,patch:r}}}(OfficeRuntime||(OfficeRuntime={}));var OfficeRuntime,CustomFunctions;__extends=this&&this.__extends||function(){var e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(t,n)};return function(t,n){function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}();!function(e){OfficeExtension.BatchApiHelper.createPropertyObject,OfficeExtension.BatchApiHelper.createMethodObject,OfficeExtension.BatchApiHelper.createIndexerObject,OfficeExtension.BatchApiHelper.createRootServiceObject;var t=OfficeExtension.BatchApiHelper.createTopLevelServiceObject,n=(OfficeExtension.BatchApiHelper.createChildItemObject,OfficeExtension.BatchApiHelper.invokeMethod),i=(OfficeExtension.BatchApiHelper.invokeEnsureUnchanged,OfficeExtension.BatchApiHelper.invokeSetProperty,OfficeExtension.Utility.isNullOrUndefined),r=(OfficeExtension.Utility.isUndefined,OfficeExtension.Utility.throwIfNotLoaded,OfficeExtension.Utility.throwIfApiNotSupported,OfficeExtension.Utility.load,OfficeExtension.Utility.retrieve,OfficeExtension.Utility.toJson),o=OfficeExtension.Utility.fixObjectPathIfNecessary,a=(OfficeExtension.Utility._handleNavigationPropertyResults,OfficeExtension.Utility.adjustToDateTime,OfficeExtension.Utility.processRetrieveResult),s=(OfficeExtension.Utility.setMockData,OfficeExtension.CommonUtility.calculateApiFlags,function(e){this._dialogService=e});e.Dialog=s;var c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.close=function(){return this._dialogService.close(),OfficeExtension.CoreUtility.Promise.resolve()},t}(s),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),t.prototype.close=function(){return this._dialogService.close(),this._dialogService.context.sync()},t}(s);function l(e){return/^(\-|\+)?([0-9]+)%?$/.test(e)}function d(e){var t,n=((t={})[12002]={code:"InvalidUrl",message:"Cannot load URL, no such page or bad URL syntax."},t[12003]={code:"InvalidUrl",message:"HTTPS is required."},t[12004]={code:"Untrusted",message:"Domain is not trusted."},t[12005]={code:"InvalidUrl",message:"HTTPS is required."},t[12007]={code:"FailedToOpen",message:"Another dialog is already opened."},t);return n[e]?n[e]:{code:"Unknown",message:"An unknown error has occured with code: "+e}}e.displayWebDialog=function(t,n){return void 0===n&&(n={}),new OfficeExtension.CoreUtility.Promise((function(i,r){if(n.width&&n.height&&(!l(n.width)||!l(n.height)))throw new OfficeExtension.Error({code:"InvalidArgument",message:'Dimensions must be "number%" or number.'});var o={width:n.width?parseInt(n.width):50,height:n.height?parseInt(n.height):50,displayInIFrame:n.displayInIFrame};e.ApiHelper.isNativeDialog()?function(e,t,n,i,r){void 0===r&&(r={});var o=new OfficeExtension.ClientRequestContext,a=p.newObject(o),s=new u(a),c=a.onDialogMessage.add((function(e){switch(OfficeExtension.Utility.log("dialogMessageHandler:"+JSON.stringify(e)),e.type){case 17:e.error?n(e.error):t(s);break;case 12:r.onMessage&&r.onMessage(e.message,s);break;case 10:default:12006===e.originalErrorCode?(c&&(c.remove(),o.sync()),r.onClose&&r.onClose()):r.onRuntimeError&&(r.onRuntimeError(e.error,s),n(e.error))}return OfficeExtension.CoreUtility.Promise.resolve()}));o.sync().then((function(){return a.displayDialog(i,e),o.sync()})).catch((function(e){n(e)}))}(o,i,r,t,n):function(e,t,n,i,r){void 0===r&&(r={});var o;function a(e){"failed"===e.status?n(new OfficeExtension.Error(d(e.error.code))):((o=e.value).addEventHandler(Office.EventType.DialogMessageReceived,s),o.addEventHandler(Office.EventType.DialogEventReceived,u),t(new c(o)))}function s(e){r.onMessage&&r.onMessage(e.message,o,e.origin)}function u(e){12006===e.error?r.onClose&&r.onClose():r.onRuntimeError&&r.onRuntimeError(new OfficeExtension.Error(d(e.error)),o)}Office.context.ui.displayDialogAsync(i,e,a)}(o,i,r,t,n)}))};var f,p=function(s){function c(){return null!==s&&s.apply(this,arguments)||this}return __extends(c,s),Object.defineProperty(c.prototype,"_className",{get:function(){return"DialogService"},enumerable:!0,configurable:!0}),c.prototype.close=function(){n(this,"Close",1,[],4,0)},c.prototype.displayDialog=function(e,t){n(this,"DisplayDialog",1,[e,t],4,0)},c.prototype._handleResult=function(e){(s.prototype._handleResult.call(this,e),i(e))||o(this,e)},c.prototype._handleRetrieveResult=function(e,t){s.prototype._handleRetrieveResult.call(this,e,t),a(this,e,t)},c.newObject=function(n){return t(e.DialogService,n,"Microsoft.Dialog.DialogService",!1,4)},Object.defineProperty(c.prototype,"onDialogMessage",{get:function(){return this.m_dialogMessage||(this.m_dialogMessage=new OfficeExtension.GenericEventHandlers(this.context,this,"DialogMessage",{eventType:65536,registerFunc:function(){},unregisterFunc:function(){},getTargetIdFunc:function(){return null},eventArgsTransformFunc:function(e){var t;try{var n=JSON.parse(e.message),i=n.errorCode?new OfficeExtension.Error(d(n.errorCode)):null;t={originalErrorCode:n.errorCode,type:n.type,error:i,message:n.message,origin:n.origin}}catch(e){t={originalErrorCode:null,type:17,error:new OfficeExtension.Error({code:"GenericException",message:"Unknown error"}),message:e.message}}return OfficeExtension.Utility._createPromiseFromResult(t)}})),this.m_dialogMessage},enumerable:!0,configurable:!0}),c.prototype.toJSON=function(){return r(this,{},{})},c}(OfficeExtension.ClientObject);e.DialogService=p,function(e){e[e.dialogMessageReceived=0]="dialogMessageReceived",e[e.dialogEventReceived=1]="dialogEventReceived"}(f||(f={})),function(e){e.generalException="GeneralException"}(e.DialogErrorCodes||(e.DialogErrorCodes={}))}(OfficeRuntime||(OfficeRuntime={})),function(e){!function(e){function t(e,t){try{var n=Microsoft.Office.WebExtension.FeatureGates[e];return null==n?t:"true"===n.toString().toLowerCase()}catch(e){return t}}function n(e,t){try{var n=Microsoft.Office.WebExtension.FeatureGates,i=parseInt(n[e]);return isNaN(i)?t:i}catch(e){return t}}function i(e,t){try{var n=Microsoft.Office.WebExtension.FeatureGates[e];return null==n?t:n}catch(e){return t}}e.getBooleanFeatureGate=t,e.getIntFeatureGate=n,e.getStringFeatureGate=i,e.getBooleanFeatureGateAsync=function(e,n){return Promise.resolve(t(e,n))},e.getIntFeatureGateAsync=function(e,t){return Promise.resolve(n(e,t))},e.getStringFeatureGateAsync=function(e,t){return Promise.resolve(i(e,t))}}(e.experimentation||(e.experimentation={}))}(OfficeRuntime||(OfficeRuntime={})),function(e){!function(e){var n={};function i(e){var t=e.eventName,i=e.message;n.hasOwnProperty(t)&&n[t].call(i)}e.on=function(e,r){return function(e,r){n.hasOwnProperty(e)||(n[e]=new t,function(){Office&&Office.context&&Office.context.messaging&&!Office.context.messaging.onMessage&&(Office.context.messaging.onMessage=i.bind(this))}());n[e].add(r)}(e,r),new Promise((function(e){e()}))},e.off=function(e,t){return function(e,t){n.hasOwnProperty(e)&&(t?n[e].remove(t):delete n[e])}(e,t),new Promise((function(e){e()}))},e.emit=function(e,t){return function(e,t){var n={eventName:e,message:t};Office&&Office.context&&Office.context.messaging&&Office.context.messaging.sendMessage&&Office.context.messaging.sendMessage(n)}(e,t),new Promise((function(e){e()}))}}(e.message||(e.message={}));var t=function(){function e(){this.listeners=[]}return e.prototype.add=function(e){this.listeners.push(e)},e.prototype.remove=function(e){var t=this.listeners.lastIndexOf(e);-1!==t&&this.listeners.splice(t,1)},e.prototype.call=function(e){this.listeners.forEach((function(t){return t(e)}))},e}();e.ListenerManager=t}(OfficeRuntime||(OfficeRuntime={})),function(e){OfficeExtension.BatchApiHelper.createPropertyObject,OfficeExtension.BatchApiHelper.createMethodObject,OfficeExtension.BatchApiHelper.createIndexerObject,OfficeExtension.BatchApiHelper.createRootServiceObject;var t=OfficeExtension.BatchApiHelper.createTopLevelServiceObject,n=(OfficeExtension.BatchApiHelper.createChildItemObject,OfficeExtension.BatchApiHelper.invokeMethod),i=(OfficeExtension.BatchApiHelper.invokeEnsureUnchanged,OfficeExtension.BatchApiHelper.invokeSetProperty,OfficeExtension.Utility.isNullOrUndefined),r=(OfficeExtension.Utility.isUndefined,OfficeExtension.Utility.throwIfNotLoaded,OfficeExtension.Utility.throwIfApiNotSupported,OfficeExtension.Utility.load,OfficeExtension.Utility.retrieve,OfficeExtension.Utility.toJson),o=OfficeExtension.Utility.fixObjectPathIfNecessary,a=(OfficeExtension.Utility._handleNavigationPropertyResults,OfficeExtension.Utility.adjustToDateTime,OfficeExtension.Utility.processRetrieveResult),s=(OfficeExtension.Utility.setMockData,OfficeExtension.CommonUtility.calculateApiFlags,"_Office_AsyncStorage_"),c=s+"|_unusedKey_",u={getItem:function(e){return p((function(t,n){return t.multiGet(n,JSON.stringify([e]))}),(function(e){var t=JSON.parse(e);return t&&t[0]&&t[0][1]?t[0][1]:null}))},setItem:function(e,t){return p((function(n,i){return n.multiSet(i,JSON.stringify([[e,t]]))}),(function(){return null}))},removeItem:function(e){return p((function(t,n){return t.multiRemove(n,JSON.stringify([e]))}),(function(){return null}))},getItems:function(e){return p((function(t,n){return t.multiGet(n,JSON.stringify(e))}),(function(t){var n=JSON.parse(t),i={};return n&&n.forEach((function(e){var t=e[0],n=e[1];return i[t]=n,n})),e&&e.forEach((function(e){i[e]&&i[e]})),i}))},setItems:function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push([n,e[n]]);return p((function(e,n){return e.multiSet(n,JSON.stringify(t))}),(function(){return null}))},removeItems:function(e){return p((function(t,n){return t.multiRemove(n,JSON.stringify(e))}),(function(){return null}))},getKeys:function(){return p((function(e,t){return e.getAllKeys(t)}),(function(e){return JSON.parse(e)}))}},l={getItem:function(e){return m((function(){return d(e)}))},setItem:function(e,t){return g((function(){return f(e,t)}))},removeItem:function(e){return g((function(){return window.localStorage.removeItem(s+e)}))},getItems:function(e){return new Promise((function(t,n){var i={},r=[];try{h()}catch(e){n(e)}e.forEach((function(e){try{var t=d(e);i[e]=t||null}catch(e){r.push(e)}})),r.length>0?n(new Error("Unknown error.")):t(i)}))},setItems:function(e){return v(e,(function(t){return f(t,e[t])}))},removeItems:function(e){return v(e,(function(e){return window.localStorage.removeItem(s+e)}))},getKeys:function(){return m((function(){return Object.keys(window.localStorage).filter((function(e){return 0===e.indexOf(s)})).map((function(e){return e.substr(s.length)}))}))}};function d(e){return window.localStorage.getItem(s+e)}function f(e,t){window.localStorage.setItem(s+e,t)}function p(e,t){return new OfficeExtension.CoreUtility.Promise((function(n,i){var r=y.getInstance(),o=r.setCallBack((function(e,r){if(r)i(r);else{var o=t(e);n(o)}}));r.ctx.sync().then((function(){var t=r.getPersistentKvStorageService();return e(t,o),r.ctx.sync()})).catch((function(e){i(e)}))}))}function h(){f(c,null),window.localStorage.removeItem(c)}function g(e,t){return void 0===t&&(t=function(){}),new Promise((function(n,i){try{h(),e(),t(null),n()}catch(e){t(e),i(e)}}))}function m(e,t){return void 0===t&&(t=function(){}),new Promise((function(n,i){try{h();var r=e();t(null,r),n(r)}catch(e){t(e,null),i(e)}}))}function v(e,t,n){return void 0===n&&(n=function(){}),new Promise((function(i,r){var o=[];try{h()}catch(e){o.push(e)}for(var a in e)if(e.hasOwnProperty(a)||Array.isArray(e))try{Array.isArray(e)?t(e[a]):t(a)}catch(e){o.push(e)}n(o),o.length>0?r(o):i()}))}e.ApiHelper.isNativeStorage()?e.storage=u:e.storage=l;var y=function(){function e(){var e=this;this._invokeId=0,this._callDict={},this.ctx=new OfficeExtension.ClientRequestContext,this._perkvstorService=_.newObject(this.ctx),this._eventResult=this._perkvstorService.onPersistentStorageMessage.add((function(t){OfficeExtension.Utility.log("persistentKvStoragegMessageHandler:"+JSON.stringify(t));var n=e._callDict[t.invokeId];n&&(n(t.message,t.error),delete e._callDict[t.invokeId])}))}return e.getInstance=function(){return void 0===e.instance?e.instance=new e:e.instance._perkvstorService=_.newObject(e.instance.ctx),e.instance},e.prototype.getPersistentKvStorageService=function(){return this._perkvstorService},e.prototype.getCallBack=function(e){return this._callDict[e]},e.prototype.setCallBack=function(e){var t=this._invokeId;return this._callDict[this._invokeId++]=e,t},e}(),_=function(s){function c(){return null!==s&&s.apply(this,arguments)||this}return __extends(c,s),Object.defineProperty(c.prototype,"_className",{get:function(){return"PersistentKvStorageService"},enumerable:!0,configurable:!0}),c.prototype.clear=function(e){n(this,"Clear",1,[e],4,0)},c.prototype.getAllKeys=function(e){n(this,"GetAllKeys",1,[e],4,0)},c.prototype.multiGet=function(e,t){n(this,"MultiGet",1,[e,t],4,0)},c.prototype.multiRemove=function(e,t){n(this,"MultiRemove",1,[e,t],4,0)},c.prototype.multiSet=function(e,t){n(this,"MultiSet",1,[e,t],4,0)},c.prototype._handleResult=function(e){(s.prototype._handleResult.call(this,e),i(e))||o(this,e)},c.prototype._handleRetrieveResult=function(e,t){s.prototype._handleRetrieveResult.call(this,e,t),a(this,e,t)},c.newObject=function(n){return t(e.PersistentKvStorageService,n,"Microsoft.PersistentKvStorage.PersistentKvStorageService",!1,4)},Object.defineProperty(c.prototype,"onPersistentStorageMessage",{get:function(){return this.m_persistentStorageMessage||(this.m_persistentStorageMessage=new OfficeExtension.GenericEventHandlers(this.context,this,"PersistentStorageMessage",{eventType:65537,registerFunc:function(){},unregisterFunc:function(){},getTargetIdFunc:function(){return null},eventArgsTransformFunc:function(e){var t,n,i,r;try{var o=JSON.parse(e.message),a=parseInt(o.errorCode),s=0!=a?new OfficeExtension.Error((n=a,(i={})[16389]={code:"GenericException",message:"Unknown error."},i[65535]={code:"Unexcepted",message:"Catastrophic failure."},i[14]={code:"OutOfMemory",message:"Ran out of memory."},i[87]={code:"InvalidArg",message:"One or more arguments are invalid."},i[16385]={code:"NotImplemented",message:"Not implemented."},i[6]={code:"BadHandle",message:"File Handle is not Set."},i[5]={code:"AccessDenied",message:"Can't read the Storage File."},(r=i)[n]?r[n]:{code:"Unknown",message:"An unknown error has occured"})):null;t={invokeId:o.invokeId,message:o.message,error:s}}catch(e){t={invokeId:-1,message:e.message,error:new OfficeExtension.Error({code:"GenericException",message:"Unknown error"})}}return OfficeExtension.Utility._createPromiseFromResult(t)}})),this.m_persistentStorageMessage},enumerable:!0,configurable:!0}),c.prototype.toJSON=function(){return r(this,{},{})},c}(OfficeExtension.ClientObject);e.PersistentKvStorageService=_,function(e){e.generalException="GeneralException"}(e.ErrorCodes||(e.ErrorCodes={}))}(OfficeRuntime||(OfficeRuntime={})),function(e){e.setCustomFunctionInvoker=Excel.customFunctionProxy.setCustomFunctionInvoker.bind(Excel.customFunctionProxy),e.Error=Excel.CustomFunctionError,e.ErrorCode=Excel.ErrorCode,e.Entity=Excel.CustomFunctionEntity,e.FormattedNumber=Excel.CustomFunctionFormattedNumber,e.Attribution=Excel.CustomFunctionAttribution,e.Provider=Excel.CustomFunctionProvider,e.WebImage=Excel.CustomFunctionWebImage,Excel.customFunctionProxy.setCustomFunctionAssociation(e._association),setTimeout((function(){Excel.CustomFunctions.initialize()}),500)}(CustomFunctions||(CustomFunctions={}));

Youez - 2016 - github.com/yon3zu
LinuXploit