/* Copyright (c) Microsoft Corporation. All rights reserved. */ /* Your use of this file is governed by the Microsoft Services Agreement http://go.microsoft.com/fwlink/?LinkId=266419. */ /* * @overview es6-promise - a tiny implementation of Promises/A+. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) * @license Licensed under MIT license * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE * @version 2.3.0 */ // Sources: // osfweb: none // runtime: 16.0\13326.10000 // core: 16.0\13326.10000 // host: 16.0.13327.34950 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 r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(e){var t;!function(e){e.OfficeRequire=function(){return null}()}(e._Internal||(e._Internal={})),function(e){!function(t){t.Init=function(){return function(){"use strict";function t(e){return"function"===typeof e}var n,r=Array.isArray?Array.isArray:function(e){return"[object Array]"===Object.prototype.toString.call(e)},i=0,o=function(e,t){l[i]=e,l[i+1]=t,2===(i+=2)&&(n?n(p):u())};var s=("undefined"!==typeof window?window:void 0)||{},a=(s.MutationObserver||s.WebKitMutationObserver,"undefined"!==typeof process&&"[object process]"==={}.toString.call(process)),c="undefined"!==typeof Uint8ClampedArray&&"undefined"!==typeof importScripts&&"undefined"!==typeof MessageChannel;var u,l=new Array(1e3);function p(){for(var e=0;e=0&&(e=e.substring(t+5,e.length))<"14.14393"}()?e.PromiseImpl.Init():window.Promise:e.PromiseImpl.Init()}()}(t=e._Internal||(e._Internal={}));var n=t.OfficePromise;e.Promise=n}(OfficeExtension||(OfficeExtension={})),function(e){var t=function(){function e(){}return e.prototype._resolveRequestUrlAndHeaderInfo=function(){return u._createPromiseFromResult(null)},e.prototype._createRequestExecutorOrNull=function(){return null},Object.defineProperty(e.prototype,"eventRegistration",{get:function(){return null},enumerable:!0,configurable:!0}),e}();e.SessionBase=t;var n=function(){function e(){}return e.setCustomSendRequestFunc=function(t){e.s_customSendRequestFunc=t},e.xhrSendRequestFunc=function(e){return u.createPromise((function(t,n){var i=new XMLHttpRequest;if(i.open(e.method,e.url),i.onload=function(){var e={statusCode:i.status,headers:u._parseHttpResponseHeaders(i.getAllResponseHeaders()),body:i.responseText};t(e)},i.onerror=function(){n(new r.RuntimeError({code:o.connectionFailure,httpStatusCode:i.status,message:u._getResourceString(s.connectionFailureWithStatus,i.statusText)}))},e.headers)for(var a in e.headers)i.setRequestHeader(a,e.headers[a]);i.send(u._getRequestBodyText(e))}))},e.fetchSendRequestFunc=function(e){var t=u._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,r={};return e.headers.forEach((function(e,t){r[t]=e})),{statusCode:n,headers:r,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=u._validateLocalDocumentRequest(e);var t=u._buildRequestMessageSafeArray(e);return u.createPromise((function(e,n){OSF.DDA.RichApi.executeRichApiRequestAsync(t,(function(t){var n;n="succeeded"==t.status?{statusCode:c.getResponseStatusCode(t),headers:c.getResponseHeaders(t),body:c.getResponseBody(t)}:c.buildHttpResponseFromOfficeJsError(t.error.code,t.error.message),u.log("Response:"),u.log(JSON.stringify(n)),e(n)}))}))},e.validateAndNormalizeRequest=function(e){if(u.isNullOrUndefined(e))throw r.RuntimeError._createInvalidArgError({argumentName:"request"});u.isNullOrEmptyString(e.method)&&(e.method="GET"),e.method=e.method.toUpperCase()},e.logRequest=function(t){if(u._logEnabled){if(u.log("---HTTP Request---"),u.log(t.method+" "+t.url),t.headers)for(var n in t.headers)u.log(n+": "+t.headers[n]);e._logBodyEnabled&&u.log(u._getRequestBodyText(t))}},e.logResponse=function(t){if(u._logEnabled){if(u.log("---HTTP Response---"),u.log(""+t.statusCode),t.headers)for(var n in t.headers)u.log(n+": "+t.headers[n]);e._logBodyEnabled&&u.log(t.body)}},e._logBodyEnabled=!1,e}();e.HttpUtility=n;var r,i=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 r=n.message;if(r&&r.entries)for(var i=0;i=0){var o=t.url.substr(i+1),s=u._parseRequestFlagsAndCustomDataFromQueryStringIfAny(o);s.flags>=0&&(n=s.flags)}var a={id:e.nextId(),type:1,flags:n,message:t};return r.sendMessageToHostAndExpectResponse(a).then((function(e){return e.message}))}));for(var i=0;i=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;n0},e._getLocalDocumentUrlPrefixLength=function(e){for(var t=["http://document.localhost","https://document.localhost","//document.localhost"],n=e.toLowerCase().trim(),r=0;r0){var o=t.url.substr(i+1),s=e._parseRequestFlagsAndCustomDataFromQueryStringIfAny(o);s.flags>=0&&(n=s.flags),r=s.customData}}return c.buildRequestMessageSafeArray(r,n,t.method,t.url,t.headers,e._getRequestBodyText(t))},e._parseHttpResponseHeaders=function(t){var n={};if(!e.isNullOrEmptyString(t))for(var r=new RegExp("\r?\n"),i=t.split(r),o=0;o0){var c=s.substr(0,a),u=s.substr(a+1);c=e.trim(c),u=e.trim(u),n[c.toUpperCase()]=u}}}return n},e._parseErrorResponse=function(t){var n=null;if(e.isPlainJsonObject(t.body))n=t.body;else if(!e.isNullOrEmptyString(t.body)){var r=e.trim(t.body);try{n=JSON.parse(r)}catch(t){e.log("Error when parse "+r)}}var i=t.statusCode.toString();if(e.isNullOrUndefined(n)||"object"!==typeof n||!n.error)return e._createDefaultErrorResponse(i);var o=n.error,s=o.innerError;return s&&s.code?e._createErrorResponse(s.code,i,s.message):o.code?e._createErrorResponse(o.code,i,o.message):e._createDefaultErrorResponse(i)},e._createDefaultErrorResponse=function(t){return{errorCode:o.connectionFailure,errorMessage:e._getResourceString(s.connectionFailureWithStatus,t)}},e._createErrorResponse=function(t,n,r){return{errorCode:t,errorMessage:e._getResourceString(s.connectionFailureWithDetails,[n,t,r])}},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=u;var l=function(){function e(){}return e.setMock=function(t){e.s_isMock=t},e.isMock=function(){return e.s_isMock},e}();e.TestUtility=l,e._internalConfig={showDisposeInfoInDebugInfo:!1,showInternalApiInDebugInfo:!1,enableEarlyDispose:!0,alwaysPolyfillClientObjectUpdateMethod:!1,alwaysPolyfillClientObjectRetrieveMethod:!1,enableConcurrentFlag:!0,enableUndoableFlag:!0,appendTypeNameToObjectPathInfo:!1},e.config={extendedErrorLogging:!1};var p=function(){function e(){}return e.createSetPropertyAction=function(e,t,n,r,i){P.validateObjectPath(t);var o={Id:e._nextId(),ActionType:4,Name:n,ObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}},s=[r],a=P.setMethodArguments(e,o.ArgumentInfo,s);P.validateReferencedObjectPaths(a);var c=new h(o,0,i);return c.referencedObjectPath=t._objectPath,c.referencedArgumentObjectPaths=a,t._addAction(c)},e.createQueryAction=function(e,t,n,r){P.validateObjectPath(t);var i={Id:e._nextId(),ActionType:2,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,QueryInfo:n},o=new h(i,1,4);return o.referencedObjectPath=t._objectPath,t._addAction(o,r)},e.createQueryAsJsonAction=function(e,t,n,r){P.validateObjectPath(t);var i={Id:e._nextId(),ActionType:7,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,QueryInfo:n},o=new h(i,1,4);return o.referencedObjectPath=t._objectPath,t._addAction(o,r)},e.createUpdateAction=function(e,t,n){P.validateObjectPath(t);var r={Id:e._nextId(),ActionType:9,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,ObjectState:n},i=new h(r,0,0);return i.referencedObjectPath=t._objectPath,t._addAction(i)},e}();e.CommonActionFactory=p;var f=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),u.createPromise((function(r,i){n._context._addServiceApiAction(e,t,r,i)}))},t.prototype._retrieve=function(t,n){var r=e._internalConfig.alwaysPolyfillClientObjectRetrieveMethod;r||(r=!P.isSetSupported("RichApiRuntime","1.1"));var i=m._parseQueryOption(t);return r?p.createQueryAction(this._context,this,i,n):p.createQueryAsJsonAction(this._context,this,i,n)},t.prototype._recursivelyUpdate=function(t){var n=e._internalConfig.alwaysPolyfillClientObjectUpdateMethod;n||(n=!P.isSetSupported("RichApiRuntime","1.2"));try{var i=this[O.scalarPropertyNames];i||(i=[]);var a=this[O.scalarPropertyUpdateable];if(!a){a=[];for(var c=0;c=0){if(!a[y])throw new r.RuntimeError({code:o.invalidArgument,httpStatusCode:400,message:u._getResourceString(I.attemptingToSetReadOnlyProperty,m),debugInfo:{errorLocation:m}});f[m]=t[m],++d}else{if(!(l.indexOf(m)>=0))throw new r.RuntimeError({code:o.invalidArgument,httpStatusCode:400,message:u._getResourceString(I.propertyDoesNotExist,m),debugInfo:{errorLocation:m}});h[m]=t[m]}}if(d>0)if(n)for(c=0;c0)throw r.RuntimeError._createInvalidArgError({argumentName:e.combineQueryPath(i,s,".")});t.Top=a}else if("$skip"===s){if("number"!==typeof a||n.length>0)throw r.RuntimeError._createInvalidArgError({argumentName:e.combineQueryPath(i,s,".")});t.Skip=a}else if("boolean"===typeof a)a&&t.Select.push(e.combineQueryPath(n,s,"/"));else{if("object"!==typeof a)throw r.RuntimeError._createInvalidArgError({argumentName:e.combineQueryPath(i,s,".")});e.parseStrictLoadOptionHelper(t,e.combineQueryPath(n,s,"/"),e.combineQueryPath(i,s,"."),a)}}},e}();e.ClientRequestContextBase=m;var y=function(){function e(e){this.m_objectPath=e}return e.prototype._handleResult=function(e){u.isNullOrUndefined(e)?this.m_objectPath._updateAsNullObject():this.m_objectPath.updateUsingObjectData(e,null)},e}(),g=function(){function t(e){this.m_contextBase=e,this.m_actions=[],this.m_actionResultHandler={},this.m_referencedObjectPaths={},this.m_instantiatedObjectPaths={},this.m_preSyncPromises=[]}return t.prototype.addAction=function(e){this.m_actions.push(e),1==e.actionInfo.ActionType&&(this.m_instantiatedObjectPaths[e.actionInfo.ObjectPathId]=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 r=new y(e);this.addActionResultHandler(n,r)}}},t.prototype.ensureInstantiateObjectPaths=function(e){if(e)for(var t=0;t=0;t--){var n=this.m_actions[t].actionInfo;if(n.ObjectPathId===e&&3===n.ActionType&&n.Name===O.keepReference){this.m_actions.splice(t,1);break}}},t._updateLastUsedActionIdOfObjectPathId=function(e,n,r){for(;n;){if(e[n.objectPathInfo.Id])return;e[n.objectPathInfo.Id]=r;var i=n.argumentObjectPaths;if(i)for(var o=i.length,s=0;s=0;--i){var o=(f=e[i]).actionInfo.Id;f.referencedObjectPath&&t._updateLastUsedActionIdOfObjectPathId(n,f.referencedObjectPath,o);var s=f.referencedArgumentObjectPaths;if(s)for(var a=s.length,c=0;c0?f.actionInfo.L=h:f.actionInfo.L&&delete f.actionInfo.L}},t}();e.ClientRequestBase=g;var b=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:o.valueNotLoaded,httpStatusCode:400,message:u._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=P.adjustToDateTime(e):this.m_value=e)},e}();e.ClientResult=b;var _=function(){function e(e){this.m_context=e,this.m_actions=[]}return e.prototype.add=function(e,t,n,r){var i=this;this.m_actions.push({action:e,resultHandler:t,resolve:n,reject:r}),1===this.m_actions.length&&setTimeout((function(){return i.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 g(this.m_context),r=0;r=65&&e.charCodeAt(t)<=90;)t++;return t0?".":"")+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,r){if(u.isNullOrUndefined(r))return null;var i=new Array,o=new Array,s=t.collectObjectPathInfos(e,r,i,o);return n.Arguments=r,s&&(n.ReferencedObjectPathIds=o),i},t.validateContext=function(e,t){if(e&&t&&t._context!==e)throw new r.RuntimeError({code:o.invalidRequestContext,httpStatusCode:400,message:u._getResourceString(s.invalidRequestContext)})},t.isSetSupported=function(e,t){return!("undefined"!==typeof window&&window.Office&&window.Office.context&&window.Office.context.requirements)||window.Office.context.requirements.isSetSupported(e,t)},t.throwIfApiNotSupported=function(e,n,i,a){if(t._doApiNotSupportedCheck&&!t.isSetSupported(n,i)){var c=u._getResourceString(s.apiNotFoundDetails,[e,n+" "+i,a]);throw new r.RuntimeError({code:o.apiNotFound,httpStatusCode:404,message:c,debugInfo:{errorLocation:e}})}},t.calculateApiFlags=function(e,n,r){return t.isSetSupported(n,r)||(e&=-3),e},t._parseSelectExpand=function(e){var t=[];if(!u.isNullOrEmptyString(e))for(var n=e.split(","),r=0;r0&&t.push(i)}return t;function o(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=[],r=0;r=0){var s=new $(this._rootObjectPropertyName,t._objectPaths,t._actions,!1,!0),a=s.processForDebugStatementInfo(n.Body.Error.ActionIndex);o={statement:a.statement,surroundingStatements:a.surroundingStatements,fullStatements:["Please enable config.extendedErrorLogging to see full statements."]},e.config.extendedErrorLogging&&(s=new $(this._rootObjectPropertyName,t._objectPaths,t._actions,!1,!1),o.fullStatements=s.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(!X.isNullOrEmptyString(n.ErrorCode))return new r.RuntimeError({code:n.ErrorCode,httpStatusCode:n.HttpStatusCode,message:n.ErrorMessage,traceMessages:i});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=X._createPromiseFromResult(null),n=0;n0)if(i.isValidRequestInfo(n[0]))f=n[0],d=1;else if(X.isPlainJsonObject(n[0])){if(null!=(f=(m=n[0]).session)&&!i.isValidRequestInfo(f))return i.createErrorPromise(t);h=m.previousObjects,d=1}if(n.length==d+1)p=n[d+0];else{if(null!=m||n.length!=d+2)return i.createErrorPromise(t);h=n[d+0],p=n[d+1]}if(null!=h)if(h instanceof F)l=function(){return h.context};else if(h instanceof i)l=function(){return h};else{if(!Array.isArray(h))return i.createErrorPromise(t);var y=h;if(0==y.length)return i.createErrorPromise(t);for(var g=0;g0&&d._onRunFinishedNotifiers.shift()();if(b)return m;throw m}))},i}(m);e.ClientRequestContext=M;var L=function(){function e(e,t){this.m_proxy=e,this.m_shouldPolyfill=t;var n=e[H.scalarPropertyNames],r=e[H.navigationPropertyNames],i=e[H.className],o=e[H.isCollection];if(n)for(var s=0;s=0;a--)if(i[a]===r[o].handler){i.splice(a,1);break}break;case 2:i=[]}return s&&(!this.m_registered&&i.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==i.length&&(n=n.then((function(){return t.m_eventInfo.unregisterFunc(t.m_callback)})).catch((function(e){u.log("Error when unregister event: "+JSON.stringify(e))})).then((function(){return t.m_registered=!1}))),n=n.then((function(){return t.m_handlers=i}))),n},e.prototype.fireEvent=function(e){for(var t=[],n=0;n0},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):X._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):X._createPromiseFromResult(null)},e}();e.EventRegistration=G;var J=function(){function e(){this.m_eventRegistration=new G(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})):i.instance?this.m_ready=X._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 r=this;return this.ready().then((function(){return r.m_eventRegistration.register(e,t,n)}))},e.prototype.unregister=function(e,t,n){var r=this;return this.ready().then((function(){return r.m_eventRegistration.unregister(e,t,n)}))},e.prototype._registerEventImpl=function(e,t){return X._createPromiseFromResult(null)},e.prototype._unregisterEventImpl=function(e,t){return X._createPromiseFromResult(null)},e.prototype._handleRichApiMessage=function(e){if(e&&e.entries)for(var t=0;t=0;r--)if(n[r]===e){n.splice(r,1);break}0==n.length&&J.getGenericEventRegistration().unregister(t.m_genericEventInfo.eventType,t.m_genericEventInfo.getTargetIdFunc(),t._callback)}))},t.prototype.removeAll=function(){},t}(q);e.GenericEventHandlers=W;var z=function(){function e(e){this.m_clientObject=e}return e.prototype._handleResult=function(e){this.m_clientObject._handleIdResult(e)},e}(),Q=function(){function e(){}return e.createGlobalObjectObjectPath=function(e){var t={Id:e._nextId(),ObjectPathType:1,Name:""};return new d(t,null,!1,!1,1,4)},e.createNewObjectObjectPath=function(e,t,n,r){var i={Id:e._nextId(),ObjectPathType:2,Name:t};return new d(i,null,n,!1,1,X._fixupApiFlags(r))},e.createPropertyObjectPath=function(e,t,n,r,i,o){var s={Id:e._nextId(),ObjectPathType:4,Name:n,ParentObjectPathId:t._objectPath.objectPathInfo.Id};return new d(s,t._objectPath,r,i,1,X._fixupApiFlags(o))},e.createIndexerObjectPath=function(e,t,n){var r={Id:e._nextId(),ObjectPathType:5,Name:"",ParentObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}};return r.ArgumentInfo.Arguments=n,new d(r,t._objectPath,!1,!1,1,4)},e.createIndexerObjectPathUsingParentPath=function(e,t,n){var r={Id:e._nextId(),ObjectPathType:5,Name:"",ParentObjectPathId:t.objectPathInfo.Id,ArgumentInfo:{}};return r.ArgumentInfo.Arguments=n,new d(r,t,!1,!1,1,4)},e.createMethodObjectPath=function(e,t,n,r,i,o,s,a,c){var u={Id:e._nextId(),ObjectPathType:3,Name:n,ParentObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}},l=X.setMethodArguments(e,u.ArgumentInfo,i),p=new d(u,t._objectPath,o,s,r,X._fixupApiFlags(c));return p.argumentObjectPaths=l,p.getByIdMethodName=a,p},e.createReferenceIdObjectPath=function(e,t){var n={Id:e._nextId(),ObjectPathType:6,Name:t,ArgumentInfo:{}};return new d(n,null,!1,!1,1,4)},e.createChildItemObjectPathUsingIndexerOrGetItemAt=function(t,n,r,i,o){var s=X.tryGetObjectIdFromLoadOrRetrieveResult(i);return t&&!X.isNullOrUndefined(s)?e.createChildItemObjectPathUsingIndexer(n,r,i):e.createChildItemObjectPathUsingGetItemAt(n,r,i,o)},e.createChildItemObjectPathUsingIndexer=function(e,t,n){var r=X.tryGetObjectIdFromLoadOrRetrieveResult(n),i=i={Id:e._nextId(),ObjectPathType:5,Name:"",ParentObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}};return i.ArgumentInfo.Arguments=[r],new d(i,t._objectPath,!1,!1,1,4)},e.createChildItemObjectPathUsingGetItemAt=function(e,t,n,r){var i=n[H.index];i&&(r=i);var o={Id:e._nextId(),ObjectPathType:3,Name:H.getItemAt,ParentObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}};return o.ArgumentInfo.Arguments=[r],new d(o,t._objectPath,!1,!1,1,4)},e}();e.ObjectPathFactory=Q;var K=function(){function t(e){this.m_context=e}return t.prototype.executeAsync=function(n,r,i){var o=this,s=c.buildMessageArrayForIRequestExecutor(n,r,i,t.SourceLibHeaderValue);return new e.Promise((function(e,t){OSF.DDA.RichApi.executeRichApiRequestAsync(s,(function(t){var n;u.log("Response:"),u.log(JSON.stringify(t)),"succeeded"==t.status?n=c.buildResponseOnSuccess(c.getResponseBody(t),c.getResponseHeaders(t)):(n=c.buildResponseOnError(t.error.code,t.error.message),o.m_context._processOfficeJsErrorResponse(t.error.code,n)),e(n)}))}))},t.SourceLibHeaderValue="officejs",t}(),Z=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[H.isTracked]&&e!==this.m_context._rootObject&&t&&!X.isNullOrEmptyString(t[H.referenceId])&&(this._autoCleanupList[e._objectPath.objectPathInfo.Id]=e,e[H.isTracked]=!0)},e.prototype._addCommon=function(e,t){if(e[H.isTracked])t&&this.m_context._autoCleanup&&delete this._autoCleanupList[e._objectPath.objectPathInfo.Id];else{var n=e[H.referenceId];if(e._objectPath.objectPathInfo[H.objectPathInfoDoNotKeepReferenceFieldName])throw X.createRuntimeError(o.generalException,u._getResourceString(Y.objectIsUntracked),null);X.isNullOrEmptyString(n)&&e._KeepReference&&(e._KeepReference(),U.createInstantiateAction(this.m_context,e),t&&this.m_context._autoCleanup&&delete this._autoCleanupList[e._objectPath.objectPathInfo.Id],e[H.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[H.objectPathInfoDoNotKeepReferenceFieldName]=!0,e.context._pendingRequest._removeKeepReferenceAction(e._objectPath.objectPathInfo.Id);var t=e[H.referenceId];if(!X.isNullOrEmptyString(t)){var n=this.m_context._rootObject;n._RemoveReference&&n._RemoveReference(t)}delete e[H.isTracked]},e.prototype._retrieveAndClearAutoCleanupList=function(){var e=this._autoCleanupList;return this._autoCleanupList={},e},e}();e.TrackedObjects=Z;var $=function(){function t(e,t,n,r,i){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=r,this.m_removePII=i}return t.prototype.process=function(){this.m_showDispose&&B._calculateLastUsedObjectPathIds(this.m_actions);for(var e=0;e=0&&this.m_statements.length>t+5+1));n++);if(t<0)return null;var r=t-5;r<0&&(r=0);var i=t+1+5;i>this.m_statements.length&&(i=this.m_statements.length);var o=[];0!=r&&o.push("...");for(var s=r;s>>>>"),o.push(this.m_statements[t]),o.push("// <<<<<");for(var a=t+1;a0)return e+" // And then dispose {"+r.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,"undefined"===typeof t.top&&"undefined"===typeof t.skip&&"undefined"===typeof t.expand?"undefined"===typeof 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 X._toCamelLowerCase(e.Name)+"("+this.buildArgumentsExpression(e.ArgumentInfo)+")";case 2:return e.Name+".newObject()";case 7:return"null";case 4:return X._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"undefined"===typeof e.Arguments[0]?t:"...";for(var n=0;n0&&(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=X._toCamelLowerCase(n.objectPathInfo.Name);break;case 3:var r=n.objectPathInfo.Name;r.length>3&&"Get"===r.substr(0,3)&&(r=r.substr(3)),t=X._toCamelLowerCase(r);break;case 5:var i=this.getObjVarNameBase(n.objectPathInfo.ParentObjectPathId);t="s"===i.charAt(i.length-1)?i.substr(0,i.length-1):i+"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}(),Y=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=Y,u.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.",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 X=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,r){var i=e._internalConfig.alwaysPolyfillClientObjectRetrieveMethod;i||(i=!n.isSetSupported("RichApiRuntime","1.1"));var o=new L(t,i);return t._retrieve(r,o),o},n.retrieveAndSync=function(e,t){var r=n.retrieve(e,t);return e.context.sync().then((function(){return r}))},n.toJson=function(e,t,r,i){var o={};for(var s in t){"undefined"!==typeof(a=t[s])&&(o[s]=a)}for(var s in r){var a;"undefined"!==typeof(a=r[s])&&(a[n.fieldName_isCollection]&&"undefined"!==typeof a[n.fieldName_m__items]?o[s]=a.toJSON().items:o[s]=a.toJSON())}return i&&(o.items=i.map((function(e){return e.toJSON()}))),o},n.throwError=function(e,t,n){throw new r.RuntimeError({code:e,httpStatusCode:400,message:u._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,r,i){if(!i&&u.isUndefined(t)&&e.charCodeAt(0)!=n.s_underscoreCharCode)throw n.createPropertyNotLoadedException(r,e)},n.createPropertyNotLoadedException=function(e,t){return new r.RuntimeError({code:T.propertyNotLoaded,httpStatusCode:400,message:u._getResourceString(Y.propertyNotLoaded,t),debugInfo:e?{errorLocation:e+"."+t}:void 0})},n.createCannotUpdateReadOnlyPropertyException=function(e,t){return new r.RuntimeError({code:T.cannotUpdateReadOnlyProperty,httpStatusCode:400,message:u._getResourceString(Y.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 r=0;r0;)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 r=0;rn)return!1;return!0},t.prototype.evaluateEventType=function(t){if(X.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&&X.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;n0){var n=this.m_apiSets[t-1];n&&(e=P.calculateApiFlags(e,n.name,n.version))}return e},t.prototype.buildScalarProperty=function(e,n,r){this.ensureOriginalName(r);var i=this,o=this.getFieldName(r),s={get:function(){return X.throwIfNotLoaded(r.name,this[o],n.name,this._isNull),i.throwIfApiNotSupported(n,r),this[o]},enumerable:!0,configurable:!0};0===(2&r.behaviorFlags)&&(s.set=function(e){if(4&r.behaviorFlags&&i.getFunction(t.CustomizationCodeNamespace+"."+n.name+"_"+r.originalName+"_Set").call(this,this,e).handled)return;this[o]=e;var s=i.calculateApiFlags(r.setMethodApiFlags,r.undoableApiSetInfoOrdinal);ee.invokeSetProperty(this,r.originalName,e,s)}),Object.defineProperty(e.prototype,r.name,s)},t.prototype.buildNavigationProperties=function(e,t){if(Array.isArray(t.navigationProperties))for(var n=0;n0){for(var o=0;o0){for(var o=0;o0&&(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");X.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;n0||this.m_url.toLowerCase().indexOf("/_layouts/15/preauth.aspx")>0)&&(n=!0);var r=document.createElement("a");if(r.href=this.m_url,this.m_options.webApplication){var i=se.embeddingPageOrigin+"="+e+"&"+se.embeddingPageSessionInfo+"="+this.m_options.sessionKey;0===r.search.length||"?"===r.search?r.search="?"+se.sessionContext+"="+encodeURIComponent(i):r.search=r.search+"&"+se.sessionContext+"="+encodeURIComponent(i)}else n?0===r.hash.length||"#"===r.hash?r.hash="#"+t:r.hash=r.hash+"&"+t:0===r.search.length||"?"===r.search?r.search="?"+t:r.search=r.search+"&"+t;return r.href},t.prototype.init=function(){var e=this;window.addEventListener("message",this.m_onMessageHandler);var t=this._getIFrameSrc();return u.createPromise((function(n,r){var i=document.createElement("iframe");if(e.m_options.id&&(i.id=e.m_options.id,i.name=e.m_options.id),i.style.height=e.m_options.height,i.style.width=e.m_options.width,e.m_options.webApplication){var a=document.createElement("form");a.setAttribute("action",t),a.setAttribute("method","post"),a.setAttribute("target",i.name),e.m_options.container.appendChild(a);var c=document.createElement("input");c.setAttribute("type","hidden"),c.setAttribute("name","access_token"),c.setAttribute("value",e.m_options.webApplication.accessToken),a.appendChild(c);var l=document.createElement("input");l.setAttribute("type","hidden"),l.setAttribute("name","access_token_ttl"),l.setAttribute("value",e.m_options.webApplication.accessTokenTtl),a.appendChild(l),e.m_options.container.appendChild(i),a.submit()}else i.src=t,e.m_options.container.appendChild(i);e.m_timeoutId=window.setTimeout((function(){e.close();var t=X.createRuntimeError(o.timeout,u._getResourceString(s.timeout),"EmbeddedSession.init");r(t)}),e.m_options.timeoutInMilliseconds),e.m_promiseResolver=n}))},t.prototype._invoke=function(e,t,n){this.m_enabled?(ie&&(n=ie(n)),this._sendMessageWithCallback(this.m_id++,e,n,(function(e){oe&&(e=oe(e));var n=e.Error;delete e.Error,t(n||0,e)}))):t(5001,null)},t.prototype.close=function(){window.removeEventListener("message",this.m_onMessageHandler),window.clearTimeout(this.m_timeoutId),this.m_enabled=!1},Object.defineProperty(t.prototype,"eventRegistration",{get:function(){return this.m_sessionEventManager||(this.m_sessionEventManager=new G(this._registerEventImpl.bind(this),this._unregisterEventImpl.bind(this))),this.m_sessionEventManager},enumerable:!0,configurable:!0}),t.prototype._createRequestExecutorOrNull=function(){return new ce(this)},t.prototype._resolveRequestUrlAndHeaderInfo=function(){return u._createPromiseFromResult(null)},t.prototype._registerEventImpl=function(e,t){var n=this;return u.createPromise((function(r,i){n._sendMessageWithCallback(n.m_id++,ne.RegisterEventCommand,{EventId:e,TargetId:t},(function(){r(null)}))}))},t.prototype._unregisterEventImpl=function(e,t){var n=this;return u.createPromise((function(r,i){n._sendMessageWithCallback(n.m_id++,ne.UnregisterEventCommand,{EventId:e,TargetId:t},(function(){r()}))}))},t.prototype._onMessage=function(e){var t=this;if(this.m_enabled&&(!this.m_chosenWindow||this.m_chosenWindow===e.source&&this.m_chosenOrigin===e.origin)){var n=e.data;if(n&&n[ne.CommandKey]===ne.ApiReadyCommand)!this.m_chosenWindow&&this._isValidDescendant(e.source)&&n[ne.SessionInfoKey]===this.m_options.sessionKey&&(this.m_chosenWindow=e.source,this.m_chosenOrigin=e.origin,this._sendMessageWithCallback(this.m_id++,ne.GetAppContextCommand,null,(function(e){t._setupContext(e),window.clearTimeout(t.m_timeoutId),t.m_promiseResolver()})));else if(n&&n[ne.CommandKey]===ne.FireEventCommand){var r=n[ne.ParamsKey],i=r.EventId,o=r.TargetId,s=r.Data;if(this.m_sessionEventManager)for(var a=this.m_sessionEventManager.getHandlers(i,o),c=0;c0&&i[i.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]=2){var s=t[n].message[1];s&&(r=a(s)?JSON.parse(s):s)}i.apply(null,[r])}else OfficeExtension.Utility.log("ActionProxy._handleMessage unknown message type "+t[n].messageType)}catch(e){throw function(e){var t=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}(e);OfficeExtension.Utility.log(t)}(e),e}return OfficeExtension.Utility._createPromiseFromResult(null)}function a(e){return"string"===typeof e&&"{"===e[0]}function c(){try{Microsoft.Office.WebExtension.onReadyInternal().then((function(){return i()})).then((function(){return"web"===OSF._OfficeAppFactory.getHostInfo().hostPlatform&&"excel"!==OSF._OfficeAppFactory.getHostInfo().hostType?void 0:function(){var e=new OfficeExtension.ClientRequestContext,t=OfficeCore.AddinInternalService.newObject(e);return e._customData="WacPartition",t.notifyActionHandlerReady(),e.sync()}()}))}catch(e){}}!function(){OfficeExtension.Utility.log("ActionProxy.initOnce"),"undefined"!==typeof document&&(document.readyState&&"loading"!==document.readyState?(OfficeExtension.Utility.log("ActionProxy.initOnce: document.readyState is not loading state"),c()):document.addEventListener&&document.addEventListener("DOMContentLoaded",(function(){OfficeExtension.Utility.log("ActionProxy.initOnce: DOMContentLoaded event triggered"),c()})))}()}(t||(t={}))}(Office||(Office={}));var Visio;__extends=this&&this.__extends||function(){var 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])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();!function(e){var t=OfficeExtension.BatchApiHelper.createPropertyObject,n=OfficeExtension.BatchApiHelper.createMethodObject,r=OfficeExtension.BatchApiHelper.createIndexerObject,i=(OfficeExtension.BatchApiHelper.createRootServiceObject,OfficeExtension.BatchApiHelper.createTopLevelServiceObject,OfficeExtension.BatchApiHelper.createChildItemObject),o=OfficeExtension.BatchApiHelper.invokeMethod,s=OfficeExtension.BatchApiHelper.invokeEnsureUnchanged,a=OfficeExtension.BatchApiHelper.invokeSetProperty,c=OfficeExtension.Utility.isNullOrUndefined,u=OfficeExtension.Utility.isUndefined,l=OfficeExtension.Utility.throwIfNotLoaded,p=(OfficeExtension.Utility.throwIfApiNotSupported,OfficeExtension.Utility.load),f=OfficeExtension.Utility.retrieve,h=OfficeExtension.Utility.toJson,d=OfficeExtension.Utility.fixObjectPathIfNecessary,m=OfficeExtension.Utility._handleNavigationPropertyResults,y=(OfficeExtension.Utility.adjustToDateTime,OfficeExtension.Utility.processRetrieveResult),g=OfficeExtension.Utility.setMockData,b=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),Object.defineProperty(t.prototype,"_className",{get:function(){return"Application"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_scalarPropertyNames",{get:function(){return["showBorders","showToolbars"]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_scalarPropertyOriginalNames",{get:function(){return["ShowBorders","ShowToolbars"]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_scalarPropertyUpdateable",{get:function(){return[!0,!0]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showBorders",{get:function(){return l("showBorders",this._S,"Application",this._isNull),this._S},set:function(e){this._S=e,a(this,"ShowBorders",e,0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"showToolbars",{get:function(){return l("showToolbars",this._Sh,"Application",this._isNull),this._Sh},set:function(e){this._Sh=e,a(this,"ShowToolbars",e,0)},enumerable:!0,configurable:!0}),t.prototype.set=function(e,t){this._recursivelySet(e,t,["showBorders","showToolbars"],[],[])},t.prototype.update=function(e){this._recursivelyUpdate(e)},t.prototype.showToolbar=function(e,t){o(this,"ShowToolbar",0,[e,t],0,0)},t.prototype._handleResult=function(t){if(e.prototype._handleResult.call(this,t),!c(t)){var n=t;d(this,n),u(n.ShowBorders)||(this._S=n.ShowBorders),u(n.ShowToolbars)||(this._Sh=n.ShowToolbars)}},t.prototype.load=function(e){return p(this,e)},t.prototype.retrieve=function(e){return f(this,e)},t.prototype._handleRetrieveResult=function(t,n){e.prototype._handleRetrieveResult.call(this,t,n),y(this,t,n)},t.prototype.toJSON=function(){return h(this,{showBorders:this._S,showToolbars:this._Sh},{})},t.prototype.setMockData=function(e){g(this,e)},t.prototype.ensureUnchanged=function(e){s(this,e)},t}(OfficeExtension.ClientObject);e.Application=b;var _=function(r){function i(){return null!==r&&r.apply(this,arguments)||this}return __extends(i,r),Object.defineProperty(i.prototype,"_className",{get:function(){return"Document"},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_navigationPropertyNames",{get:function(){return["view","application","pages"]},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"application",{get:function(){return this._A||(this._A=t(e.Application,this,"Application",!1,4)),this._A},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"pages",{get:function(){return this._P||(this._P=t(e.PageCollection,this,"Pages",!0,4)),this._P},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"view",{get:function(){return this._V||(this._V=t(e.DocumentView,this,"View",!1,4)),this._V},enumerable:!0,configurable:!0}),i.prototype.set=function(e,t){this._recursivelySet(e,t,[],["view","application"],["pages"])},i.prototype.update=function(e){this._recursivelyUpdate(e)},i.prototype.getActivePage=function(){return n(e.Page,this,"GetActivePage",1,[],!1,!1,null,4)},i.prototype.setActivePage=function(e){o(this,"SetActivePage",1,[e],4,0)},i.prototype.showTaskPane=function(e,t,n){o(this,"ShowTaskPane",1,[e,t,n],4,0)},i.prototype.startDataRefresh=function(){o(this,"StartDataRefresh",1,[],4,0)},i.prototype._RegisterDataVisualizerDiagramOperationCompletedEvent=function(){o(this,"_RegisterDataVisualizerDiagramOperationCompletedEvent",0,[],0,0)},i.prototype._UnregisterDataVisualizerDiagramOperationCompletedEvent=function(){o(this,"_UnregisterDataVisualizerDiagramOperationCompletedEvent",0,[],0,0)},i.prototype._handleResult=function(e){if(r.prototype._handleResult.call(this,e),!c(e)){var t=e;d(this,t),m(this,t,["application","Application","pages","Pages","view","View"])}},i.prototype.load=function(e){return p(this,e)},i.prototype.retrieve=function(e){return f(this,e)},i.prototype._handleRetrieveResult=function(e,t){r.prototype._handleRetrieveResult.call(this,e,t),y(this,e,t)},Object.defineProperty(i.prototype,"onDataRefreshComplete",{get:function(){var e=this;return this.m_dataRefreshComplete||(this.m_dataRefreshComplete=new OfficeExtension.EventHandlers(this.context,this,"DataRefreshComplete",{registerFunc:function(t){return e.context.eventRegistration.register(3,"",t)},unregisterFunc:function(t){return e.context.eventRegistration.unregister(3,"",t)},eventArgsTransformFunc:function(e){var t={document:this,success:e.ddaBinding.Object.success};return OfficeExtension.Utility._createPromiseFromResult(t)}})),this.m_dataRefreshComplete},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onDataVisualizerDiagramOperationCompleted",{get:function(){return this.m_dataVisualizerDiagramOperationCompleted||(this.m_dataVisualizerDiagramOperationCompleted=new OfficeExtension.EventHandlers(this.context,this,"DataVisualizerDiagramOperationCompleted",null)),this.m_dataVisualizerDiagramOperationCompleted},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onDocumentError",{get:function(){var e=this;return this.m_documentError||(this.m_documentError=new OfficeExtension.EventHandlers(this.context,this,"DocumentError",{registerFunc:function(t){return e.context.eventRegistration.register(15,"",t)},unregisterFunc:function(t){return e.context.eventRegistration.unregister(15,"",t)},eventArgsTransformFunc:function(e){return OfficeExtension.Utility._createPromiseFromResult(e.ddaBinding.Object)}})),this.m_documentError},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onDocumentLoadComplete",{get:function(){var e=this;return this.m_documentLoadComplete||(this.m_documentLoadComplete=new OfficeExtension.EventHandlers(this.context,this,"DocumentLoadComplete",{registerFunc:function(t){return e.context.eventRegistration.register(7,"",t)},unregisterFunc:function(t){return e.context.eventRegistration.unregister(7,"",t)},eventArgsTransformFunc:function(e){var t={success:e.ddaBinding.Object.success};return OfficeExtension.Utility._createPromiseFromResult(t)}})),this.m_documentLoadComplete},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onPageLoadComplete",{get:function(){var e=this;return this.m_pageLoadComplete||(this.m_pageLoadComplete=new OfficeExtension.EventHandlers(this.context,this,"PageLoadComplete",{registerFunc:function(t){return e.context.eventRegistration.register(1,"",t)},unregisterFunc:function(t){return e.context.eventRegistration.unregister(1,"",t)},eventArgsTransformFunc:function(e){return OfficeExtension.Utility._createPromiseFromResult(e.ddaBinding.Object)}})),this.m_pageLoadComplete},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onSelectionChanged",{get:function(){var e=this;return this.m_selectionChanged||(this.m_selectionChanged=new OfficeExtension.EventHandlers(this.context,this,"SelectionChanged",{registerFunc:function(t){return e.context.eventRegistration.register(2,"",t)},unregisterFunc:function(t){return e.context.eventRegistration.unregister(2,"",t)},eventArgsTransformFunc:function(e){return OfficeExtension.Utility._createPromiseFromResult(e.ddaBinding.Object)}})),this.m_selectionChanged},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onShapeMouseEnter",{get:function(){var e=this;return this.m_shapeMouseEnter||(this.m_shapeMouseEnter=new OfficeExtension.EventHandlers(this.context,this,"ShapeMouseEnter",{registerFunc:function(t){return e.context.eventRegistration.register(4,"",t)},unregisterFunc:function(t){return e.context.eventRegistration.unregister(4,"",t)},eventArgsTransformFunc:function(e){return OfficeExtension.Utility._createPromiseFromResult(e.ddaBinding.Object)}})),this.m_shapeMouseEnter},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onShapeMouseLeave",{get:function(){var e=this;return this.m_shapeMouseLeave||(this.m_shapeMouseLeave=new OfficeExtension.EventHandlers(this.context,this,"ShapeMouseLeave",{registerFunc:function(t){return e.context.eventRegistration.register(5,"",t)},unregisterFunc:function(t){return e.context.eventRegistration.unregister(5,"",t)},eventArgsTransformFunc:function(e){return OfficeExtension.Utility._createPromiseFromResult(e.ddaBinding.Object)}})),this.m_shapeMouseLeave},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onTaskPaneStateChanged",{get:function(){var e=this;return this.m_taskPaneStateChanged||(this.m_taskPaneStateChanged=new OfficeExtension.EventHandlers(this.context,this,"TaskPaneStateChanged",{registerFunc:function(t){return e.context.eventRegistration.register(18,"",t)},unregisterFunc:function(t){return e.context.eventRegistration.unregister(18,"",t)},eventArgsTransformFunc:function(e){return OfficeExtension.Utility._createPromiseFromResult(e.ddaBinding.Object)}})),this.m_taskPaneStateChanged},enumerable:!0,configurable:!0}),i.prototype.toJSON=function(){return h(this,{},{application:this._A,pages:this._P,view:this._V})},i.prototype.setMockData=function(e){g(this,e)},i.prototype.ensureUnchanged=function(e){s(this,e)},i}(OfficeExtension.ClientObject);e.Document=_;var v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return __extends(t,e),Object.defineProperty(t.prototype,"_className",{get:function(){return"DocumentView"},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_scalarPropertyNames",{get:function(){return["disableHyperlinks","disableZoom","disablePan","hideDiagramBoundary","disablePanZoomWindow"]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_scalarPropertyOriginalNames",{get:function(){return["DisableHyperlinks","DisableZoom","DisablePan","HideDiagramBoundary","DisablePanZoomWindow"]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_scalarPropertyUpdateable",{get:function(){return[!0,!0,!0,!0,!0]},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"disableHyperlinks",{get:function(){return l("disableHyperlinks",this._D,"DocumentView",this._isNull),this._D},set:function(e){this._D=e,a(this,"DisableHyperlinks",e,0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"disablePan",{get:function(){return l("disablePan",this._Di,"DocumentView",this._isNull),this._Di},set:function(e){this._Di=e,a(this,"DisablePan",e,0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"disablePanZoomWindow",{get:function(){return l("disablePanZoomWindow",this._Dis,"DocumentView",this._isNull),this._Dis},set:function(e){this._Dis=e,a(this,"DisablePanZoomWindow",e,0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"disableZoom",{get:function(){return l("disableZoom",this._Disa,"DocumentView",this._isNull),this._Disa},set:function(e){this._Disa=e,a(this,"DisableZoom",e,0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"hideDiagramBoundary",{get:function(){return l("hideDiagramBoundary",this._H,"DocumentView",this._isNull),this._H},set:function(e){this._H=e,a(this,"HideDiagramBoundary",e,0)},enumerable:!0,configurable:!0}),t.prototype.set=function(e,t){this._recursivelySet(e,t,["disableHyperlinks","disableZoom","disablePan","hideDiagramBoundary","disablePanZoomWindow"],[],[])},t.prototype.update=function(e){this._recursivelyUpdate(e)},t.prototype._handleResult=function(t){if(e.prototype._handleResult.call(this,t),!c(t)){var n=t;d(this,n),u(n.DisableHyperlinks)||(this._D=n.DisableHyperlinks),u(n.DisablePan)||(this._Di=n.DisablePan),u(n.DisablePanZoomWindow)||(this._Dis=n.DisablePanZoomWindow),u(n.DisableZoom)||(this._Disa=n.DisableZoom),u(n.HideDiagramBoundary)||(this._H=n.HideDiagramBoundary)}},t.prototype.load=function(e){return p(this,e)},t.prototype.retrieve=function(e){return f(this,e)},t.prototype._handleRetrieveResult=function(t,n){e.prototype._handleRetrieveResult.call(this,t,n),y(this,t,n)},t.prototype.toJSON=function(){return h(this,{disableHyperlinks:this._D,disablePan:this._Di,disablePanZoomWindow:this._Dis,disableZoom:this._Disa,hideDiagramBoundary:this._H},{})},t.prototype.setMockData=function(e){g(this,e)},t.prototype.ensureUnchanged=function(e){s(this,e)},t}(OfficeExtension.ClientObject);e.DocumentView=v;var O=function(n){function r(){return null!==n&&n.apply(this,arguments)||this}return __extends(r,n),Object.defineProperty(r.prototype,"_className",{get:function(){return"Page"},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_scalarPropertyNames",{get:function(){return["index","name","isBackground","width","height"]},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_scalarPropertyOriginalNames",{get:function(){return["Index","Name","IsBackground","Width","Height"]},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_navigationPropertyNames",{get:function(){return["shapes","view","comments","allShapes","dataVisualizerDiagrams"]},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"allShapes",{get:function(){return this._A||(this._A=t(e.ShapeCollection,this,"AllShapes",!0,4)),this._A},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"comments",{get:function(){return this._C||(this._C=t(e.CommentCollection,this,"Comments",!0,4)),this._C},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"dataVisualizerDiagrams",{get:function(){return this._D||(this._D=t(e.DataVisualizerDiagramCollection,this,"DataVisualizerDiagrams",!0,4)),this._D},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"shapes",{get:function(){return this._S||(this._S=t(e.ShapeCollection,this,"Shapes",!0,4)),this._S},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"view",{get:function(){return this._V||(this._V=t(e.PageView,this,"View",!1,4)),this._V},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return l("height",this._H,"Page",this._isNull),this._H},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"index",{get:function(){return l("index",this._I,"Page",this._isNull),this._I},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"isBackground",{get:function(){return l("isBackground",this._Is,"Page",this._isNull),this._Is},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"name",{get:function(){return l("name",this._N,"Page",this._isNull),this._N},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"width",{get:function(){return l("width",this._W,"Page",this._isNull),this._W},enumerable:!0,configurable:!0}),r.prototype.set=function(e,t){this._recursivelySet(e,t,[],["view"],["allShapes","comments","dataVisualizerDiagrams","shapes"])},r.prototype.update=function(e){this._recursivelyUpdate(e)},r.prototype.activate=function(){o(this,"Activate",1,[],4,0)},r.prototype._handleResult=function(e){if(n.prototype._handleResult.call(this,e),!c(e)){var t=e;d(this,t),u(t.Height)||(this._H=t.Height),u(t.Index)||(this._I=t.Index),u(t.IsBackground)||(this._Is=t.IsBackground),u(t.Name)||(this._N=t.Name),u(t.Width)||(this._W=t.Width),m(this,t,["allShapes","AllShapes","comments","Comments","dataVisualizerDiagrams","DataVisualizerDiagrams","shapes","Shapes","view","View"])}},r.prototype.load=function(e){return p(this,e)},r.prototype.retrieve=function(e){return f(this,e)},r.prototype._handleRetrieveResult=function(e,t){n.prototype._handleRetrieveResult.call(this,e,t),y(this,e,t)},r.prototype.toJSON=function(){return h(this,{height:this._H,index:this._I,isBackground:this._Is,name:this._N,width:this._W},{allShapes:this._A,comments:this._C,dataVisualizerDiagrams:this._D,shapes:this._S,view:this._V})},r.prototype.setMockData=function(e){g(this,e)},r.prototype.ensureUnchanged=function(e){s(this,e)},r}(OfficeExtension.ClientObject);e.Page=O;var P=function(t){function r(){return null!==t&&t.apply(this,arguments)||this}return __extends(r,t),Object.defineProperty(r.prototype,"_className",{get:function(){return"PageView"},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_scalarPropertyNames",{get:function(){return["zoom"]},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_scalarPropertyOriginalNames",{get:function(){return["Zoom"]},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"_scalarPropertyUpdateable",{get:function(){return[!0]},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"zoom",{get:function(){return l("zoom",this._Z,"PageView",this._isNull),this._Z},set:function(e){this._Z=e,a(this,"Zoom",e,0)},enumerable:!0,configurable:!0}),r.prototype.set=function(e,t){this._recursivelySet(e,t,["zoom"],[],[])},r.prototype.update=function(e){this._recursivelyUpdate(e)},r.prototype.centerViewportOnShape=function(e){o(this,"CenterViewportOnShape",1,[e],4,0)},r.prototype.fitToWindow=function(){o(this,"FitToWindow",1,[],4,0)},r.prototype.getPosition=function(){return o(this,"GetPosition",1,[],4,0)},r.prototype.getSelection=function(){return n(e.Selection,this,"GetSelection",1,[],!1,!1,null,4)},r.prototype.isShapeInViewport=function(e){return o(this,"IsShapeInViewport",1,[e],4,0)},r.prototype.setPosition=function(e){o(this,"SetPosition",1,[e],4,0)},r.prototype._handleResult=function(e){if(t.prototype._handleResult.call(this,e),!c(e)){var n=e;d(this,n),u(n.Zoom)||(this._Z=n.Zoom)}},r.prototype.load=function(e){return p(this,e)},r.prototype.retrieve=function(e){return f(this,e)},r.prototype._handleRetrieveResult=function(e,n){t.prototype._handleRetrieveResult.call(this,e,n),y(this,e,n)},r.prototype.toJSON=function(){return h(this,{zoom:this._Z},{})},r.prototype.setMockData=function(e){g(this,e)},r.prototype.ensureUnchanged=function(e){s(this,e)},r}(OfficeExtension.ClientObject);e.PageView=P;var I=function(t){function n(){return null!==t&&t.apply(this,arguments)||this}return __extends(n,t),Object.defineProperty(n.prototype,"_className",{get:function(){return"PageCollection"},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"_isCollection",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"items",{get:function(){return l("items",this.m__items,"PageCollection",this._isNull),this.m__items},enumerable:!0,configurable:!0}),n.prototype.getCount=function(){return o(this,"GetCount",1,[],4,0)},n.prototype.getItem=function(t){return r(e.Page,this,[t])},n.prototype._handleResult=function(n){if(t.prototype._handleResult.call(this,n),!c(n)){var r=n;if(d(this,r),!c(r[OfficeExtension.Constants.items])){this.m__items=[];for(var o=r[OfficeExtension.Constants.items],s=0;s