Mini Kabibi Habibi

Current Path : C:/Program Files/Microsoft Office/root/Office16/
Upload File :
Current File : C:/Program Files/Microsoft Office/root/Office16/excel-udf-host.win32.bundle

!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="http://localhost:8081/",n(n.s=5)}([function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.TestUtility=t.CoreUtility=t.RichApiMessageUtility=t.CoreConstants=t.CoreResourceStrings=t.CoreErrorCodes=t.Provider=t.Attribution=t.WebImage=t.Entity=t.FormattedNumber=t.Error=t._Internal=t.HostBridge=t.HttpUtility=t.SessionBase=void 0;var i=function(){function e(){}return e.prototype._resolveRequestUrlAndHeaderInfo=function(){return f._createPromiseFromResult(null)},e.prototype._createRequestExecutorOrNull=function(){return null},Object.defineProperty(e.prototype,"eventRegistration",{get:function(){return null},enumerable:!1,configurable:!0}),e}();t.SessionBase=i;var s=function(){function e(){}return e.setCustomSendRequestFunc=function(t){e.s_customSendRequestFunc=t},e.xhrSendRequestFunc=function(e){return f.createPromise((function(t,n){var r=new XMLHttpRequest;if(r.open(e.method,e.url),r.onload=function(){var e={statusCode:r.status,headers:f._parseHttpResponseHeaders(r.getAllResponseHeaders()),body:r.responseText};t(e)},r.onerror=function(){n(new a.RuntimeError({code:u.connectionFailure,httpStatusCode:r.status,message:f._getResourceString(l.connectionFailureWithStatus,r.statusText)}))},e.headers)for(var o in e.headers)r.setRequestHeader(o,e.headers[o]);r.send(f._getRequestBodyText(e))}))},e.fetchSendRequestFunc=function(e){var t=f._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=f._validateLocalDocumentRequest(e);var t=f._buildRequestMessageSafeArray(e);return f.createPromise((function(e,n){OSF.DDA.RichApi.executeRichApiRequestAsync(t,(function(t){var n;n="succeeded"==t.status?{statusCode:p.getResponseStatusCode(t),headers:p.getResponseHeaders(t),body:p.getResponseBody(t)}:p.buildHttpResponseFromOfficeJsError(t.error.code,t.error.message),f.log("Response:"),f.log(JSON.stringify(n)),e(n)}))}))},e.validateAndNormalizeRequest=function(e){if(f.isNullOrUndefined(e))throw a.RuntimeError._createInvalidArgError({argumentName:"request"});f.isNullOrEmptyString(e.method)&&(e.method="GET"),e.method=e.method.toUpperCase()},e.logRequest=function(t){if(f._logEnabled){if(f.log("---HTTP Request---"),f.log(t.method+" "+t.url),t.headers)for(var n in t.headers)f.log(n+": "+t.headers[n]);e._logBodyEnabled&&f.log(f._getRequestBodyText(t))}},e.logResponse=function(t){if(f._logEnabled){if(f.log("---HTTP Response---"),f.log(""+t.statusCode),t.headers)for(var n in t.headers)f.log(n+": "+t.headers[n]);e._logBodyEnabled&&f.log(t.body)}},e._logBodyEnabled=!1,e}();t.HttpUtility=s;var a,c=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 o=0;o<r.entries.length;o++){var i=r.entries[o];if(Array.isArray(i)){var s={messageCategory:i[0],messageType:i[1],targetId:i[2],message:i[3],id:i[4]};r.entries[o]=s}}}t.dispatchMessage(n)}}return e.init=function(t){if("object"==typeof t&&t){var n=new e(t);e.s_instance=n,s.setCustomSendLocalDocumentRequestFunc((function(t){t=f._validateLocalDocumentRequest(t);var r=0;f.isReadonlyRestRequest(t.method)||(r=1);var o=t.url.indexOf("?");if(o>=0){var i=t.url.substr(o+1),s=f._parseRequestFlagsAndCustomDataFromQueryStringIfAny(i);s.flags>=0&&(r=s.flags)}var a={id:e.nextId(),type:1,flags:r,message:t};return n.sendMessageToHostAndExpectResponse(a).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:!1,configurable:!0}),e.prototype.sendMessageToHost=function(e){this.m_bridge.sendMessageToHost(JSON.stringify(e))},e.prototype.sendMessageToHostAndExpectResponse=function(e){var t=this,n=f.createPromise((function(n,r){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}();t.HostBridge=c,"object"==typeof _richApiNativeBridge&&_richApiNativeBridge&&c.init(_richApiNativeBridge),function(e){var t=function(t){function n(e){var r=t.call(this,"string"==typeof e?e:e.message)||this;if(Object.setPrototypeOf(r,n.prototype),r.name="RichApi.Error","string"==typeof e?r.message=e:(r.code=e.code,r.message=e.message,r.traceMessages=e.traceMessages||[],r.innerError=e.innerError||null,r.debugInfo=r._createDebugInfo(e.debugInfo||{}),r.httpStatusCode=e.httpStatusCode,r.data=e.data),f.isNullOrUndefined(r.httpStatusCode)||200===r.httpStatusCode){var o={};o[u.accessDenied]=401,o[u.connectionFailure]=500,o[u.generalException]=500,o[u.invalidArgument]=400,o[u.invalidObjectPath]=400,o[u.invalidOrTimedOutSession]=408,o[u.invalidRequestContext]=400,o[u.timeout]=408,o[u.valueNotLoaded]=400,r.httpStatusCode=o[r.code]}return f.isNullOrUndefined(r.httpStatusCode)&&(r.httpStatusCode=500),r}return o(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 r in t)n[r]=t[r];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:u.invalidArgument,httpStatusCode:400,message:f.isNullOrEmptyString(t.argumentName)?f._getResourceString(l.invalidArgumentGeneric):f._getResourceString(l.invalidArgument,t.argumentName),debugInfo:t.errorLocation?{errorLocation:t.errorLocation}:{},innerError:t.innerError})},n}(Error);e.RuntimeError=t}(a=t._Internal||(t._Internal={})),t.Error=a.RuntimeError,t.FormattedNumber=a.FormattedNumber,t.Entity=a.Entity,t.WebImage=a.WebImage,t.Attribution=a.Attribution,t.Provider=a.Provider;var u=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}();t.CoreErrorCodes=u;var l=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.invalidObjectPath="InvalidObjectPath",e.invalidRequestContext="InvalidRequestContext",e.valueNotLoaded="ValueNotLoaded",e}();t.CoreResourceStrings=l;var d=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}();t.CoreConstants=d;var p=function(){function e(){}return e.buildMessageArrayForIRequestExecutor=function(t,n,r,o){var i=JSON.stringify(r.Body);f.log("Request:"),f.log(i);var s={};return f._copyHeaders(r.Headers,s),s[d.sourceLibHeader]=o,e.buildRequestMessageSafeArray(t,n,"POST",d.processQuery,s,i)},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 r={HttpStatusCode:500,ErrorCode:"",ErrorMessage:"",Headers:null,Body:null};return r.ErrorCode=u.generalException,r.ErrorMessage=n,t==e.OfficeJsErrorCode_ooeNoCapability?(r.ErrorCode=u.accessDenied,r.HttpStatusCode=401):t==e.OfficeJsErrorCode_ooeActivityLimitReached?(r.ErrorCode=u.activityLimitReached,r.HttpStatusCode=429):t==e.OfficeJsErrorCode_ooeInvalidOrTimedOutSession?(r.ErrorCode=u.invalidOrTimedOutSession,r.HttpStatusCode=408,r.ErrorMessage=f._getResourceString(l.invalidOrTimedOutSessionMessage)):t==e.OfficeJsErrorCode_ooeRequestPayloadSizeLimitExceeded&&(r.ErrorCode=u.requestPayloadSizeLimitExceeded,r.HttpStatusCode=400),r},e.buildHttpResponseFromOfficeJsError=function(t,n){var r=500,o={error:{}};return o.error.code=u.generalException,o.error.message=n,t===e.OfficeJsErrorCode_ooeNoCapability?(r=403,o.error.code=u.accessDenied):t===e.OfficeJsErrorCode_ooeActivityLimitReached&&(r=429,o.error.code=u.activityLimitReached),{statusCode:r,headers:{},body:JSON.stringify(o)}},e.buildRequestMessageSafeArray=function(e,t,n,r,o,i){var s=[];if(o)for(var a in o)s.push(a),s.push(o[a]);return[e,n,r,s,i,0,t,"","",""]},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={},r=0;r<t.length-1;r+=2)n[t[r]]=t[r+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}();t.RichApiMessageUtility=p,function(e){e.getPromiseType=function(){if("undefined"!=typeof Promise)return Promise;if("undefined"!=typeof Office&&Office.Promise)return Office.Promise;if("undefined"!=typeof OfficeExtension&&OfficeExtension.Promise)return OfficeExtension.Promise;throw new e.Error("No Promise implementation found")}}(a=t._Internal||(t._Internal={}));var f=function(){function e(){}return e.log=function(t){e._logEnabled},e.checkArgumentNull=function(t,n){if(e.isNullOrUndefined(t))throw a.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 r;if("undefined"!=typeof window&&window.Strings&&window.Strings.OfficeOM){var o="L_"+t,i=window.Strings.OfficeOM[o];i&&(r=i)}if(r||(r=e.s_resourceStringValues[t]),r||(r=t),!e.isNullOrUndefined(n))if(Array.isArray(n)){var s=n;r=e._formatString(r,s)}else r=r.replace("{0}",n);return r},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 a.RuntimeError._createInvalidArgError({argumentName:"format"})}))},Object.defineProperty(e,"Promise",{get:function(){return a.getPromiseType()},enumerable:!1,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 a.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(),r=0;r<t.length;r++){if(n===t[r])return t[r].length;if(n.substr(0,t[r].length+1)===t[r]+"/")return t[r].length+1}return 0},e._validateLocalDocumentRequest=function(t){var n=e._getLocalDocumentUrlPrefixLength(t.url);if(n<=0)throw a.RuntimeError._createInvalidArgError({argumentName:"request"});var r=t.url.substr(n),o=r.toLowerCase();return"_api"===o?r="":"_api/"===o.substr(0,"_api/".length)&&(r=r.substr("_api/".length)),{method:t.method,url:r,headers:t.headers,body:t.body}},e._parseRequestFlagsAndCustomDataFromQueryStringIfAny=function(e){for(var t={flags:-1,customData:""},n=e.split("&"),r=0;r<n.length;r++){var o=n[r].split("=");if(o[0].toLowerCase()===d.flags){var i=parseInt(o[1]);i&=4095,t.flags=i}else o[0].toLowerCase()===d.customData&&(t.customData=decodeURIComponent(o[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 r="";if(t.url.substr(0,d.processQuery.length).toLowerCase()===d.processQuery.toLowerCase()){var o=t.url.indexOf("?");if(o>0){var i=t.url.substr(o+1),s=e._parseRequestFlagsAndCustomDataFromQueryStringIfAny(i);s.flags>=0&&(n=s.flags),r=s.customData}}return p.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"),o=t.split(r),i=0;i<o.length;i++){var s=o[i];if(null!=s){var a=s.indexOf(":");if(a>0){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 o=t.statusCode.toString();if(e.isNullOrUndefined(n)||"object"!=typeof n||!n.error)return e._createDefaultErrorResponse(o);var i=n.error,s=i.innerError;return s&&s.code?e._createErrorResponse(s.code,o,s.message):i.code?e._createErrorResponse(i.code,o,i.message):e._createDefaultErrorResponse(o)},e._createDefaultErrorResponse=function(t){return{errorCode:u.connectionFailure,errorMessage:e._getResourceString(l.connectionFailureWithStatus,t)}},e._createErrorResponse=function(t,n,r){return{errorCode:t,errorMessage:e._getResourceString(l.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}();t.CoreUtility=f;var h=function(){function e(){}return e.setMock=function(t){e.s_isMock=t},e.isMock=function(){return e.s_isMock},e}();t.TestUtility=h},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.CommonResourceStrings=t.CommonUtility=t.CommonConstants=t.HttpRequestExecutor=t.ClientResult=t.ClientRequestBase=t.ClientRequestContextBase=t.ObjectPath=t.Action=t.ClientObjectBase=t.CommonActionFactory=t.config=t._internalConfig=void 0;var a=n(1);s(n(1),t),t._internalConfig={showDisposeInfoInDebugInfo:!1,showInternalApiInDebugInfo:!1,enableEarlyDispose:!0,alwaysPolyfillClientObjectUpdateMethod:!1,alwaysPolyfillClientObjectRetrieveMethod:!1,enableConcurrentFlag:!0,enableUndoableFlag:!0,appendTypeNameToObjectPathInfo:!1},t.config={extendedErrorLogging:!1};var c=function(){function e(){}return e.createSetPropertyAction=function(e,t,n,r,o){b.validateObjectPath(t);var i={Id:e._nextId(),ActionType:4,Name:n,ObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}},s=[r],a=b.setMethodArguments(e,i.ArgumentInfo,s);b.validateReferencedObjectPaths(a);var c=new l(i,0,o);return c.referencedObjectPath=t._objectPath,c.referencedArgumentObjectPaths=a,t._addAction(c)},e.createQueryAction=function(e,t,n,r){b.validateObjectPath(t);var o={Id:e._nextId(),ActionType:2,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,QueryInfo:n},i=new l(o,1,4);return i.referencedObjectPath=t._objectPath,t._addAction(i,r)},e.createQueryAsJsonAction=function(e,t,n,r){b.validateObjectPath(t);var o={Id:e._nextId(),ActionType:7,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,QueryInfo:n},i=new l(o,1,4);return i.referencedObjectPath=t._objectPath,t._addAction(i,r)},e.createUpdateAction=function(e,t,n){b.validateObjectPath(t);var r={Id:e._nextId(),ActionType:9,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,ObjectState:n},o=new l(r,0,0);return o.referencedObjectPath=t._objectPath,t._addAction(o)},e}();t.CommonActionFactory=c;var u=function(){function e(e,t){this.m_contextBase=e,this.m_objectPath=t}return Object.defineProperty(e.prototype,"_objectPath",{get:function(){return this.m_objectPath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_context",{get:function(){return this.m_contextBase},enumerable:!1,configurable:!0}),e.prototype._addAction=function(e,t){var n=this;return void 0===t&&(t=null),a.CoreUtility.createPromise((function(r,o){n._context._addServiceApiAction(e,t,r,o)}))},e.prototype._retrieve=function(e,n){var r=t._internalConfig.alwaysPolyfillClientObjectRetrieveMethod;r||(r=!b.isSetSupported("RichApiRuntime","1.1"));var o=p._parseQueryOption(e);return r?c.createQueryAction(this._context,this,o,n):c.createQueryAsJsonAction(this._context,this,o,n)},e.prototype._recursivelyUpdate=function(e){var n=t._internalConfig.alwaysPolyfillClientObjectUpdateMethod;n||(n=!b.isSetSupported("RichApiRuntime","1.2"));try{var r=this[v.scalarPropertyNames];r||(r=[]);var o=this[v.scalarPropertyUpdateable];if(!o){o=[];for(var i=0;i<r.length;i++)o.push(!1)}var s=this[v.navigationPropertyNames];s||(s=[]);var u={},l={},d=0;for(var p in e){var f=r.indexOf(p);if(f>=0){if(!o[f])throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidArgument,httpStatusCode:400,message:a.CoreUtility._getResourceString(_.attemptingToSetReadOnlyProperty,p),debugInfo:{errorLocation:p}});u[p]=e[p],++d}else{if(!(s.indexOf(p)>=0))throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidArgument,httpStatusCode:400,message:a.CoreUtility._getResourceString(_.propertyDoesNotExist,p),debugInfo:{errorLocation:p}});l[p]=e[p]}}if(d>0)if(n)for(i=0;i<r.length;i++){var h=u[p=r[i]];b.isUndefined(h)||c.createSetPropertyAction(this._context,this,p,h)}else c.createUpdateAction(this._context,this,u);for(var p in l){var m=this[p],g=l[p];m._recursivelyUpdate(g)}}catch(e){throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidArgument,httpStatusCode:400,message:a.CoreUtility._getResourceString(a.CoreResourceStrings.invalidArgument,"properties"),debugInfo:{errorLocation:this._className+".update"},innerError:e})}},e}();t.ClientObjectBase=u;var l=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:!1,configurable:!0}),Object.defineProperty(e.prototype,"operationType",{get:function(){return this.m_operationType},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"flags",{get:function(){return this.m_flags},enumerable:!1,configurable:!0}),e}();t.Action=l;var d=function(){function e(e,t,n,r,o,i){this.m_objectPathInfo=e,this.m_parentObjectPath=t,this.m_isCollection=n,this.m_isInvalidAfterRequest=r,this.m_isValid=!0,this.m_operationType=o,this.m_flags=i}return Object.defineProperty(e.prototype,"id",{get:function(){var e=this.m_objectPathInfo.ArgumentInfo;if(e){var t=e.Arguments;if(t)return t[0]}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){var e=this.m_parentObjectPath;if(e)return e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentId",{get:function(){return this.parent?this.parent.id:void 0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"objectPathInfo",{get:function(){return this.m_objectPathInfo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"operationType",{get:function(){return this.m_operationType},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"flags",{get:function(){return this.m_flags},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isCollection",{get:function(){return this.m_isCollection},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isInvalidAfterRequest",{get:function(){return this.m_isInvalidAfterRequest},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parentObjectPath",{get:function(){return this.m_parentObjectPath},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"argumentObjectPaths",{get:function(){return this.m_argumentObjectPaths},set:function(e){this.m_argumentObjectPaths=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isValid",{get:function(){return this.m_isValid},set:function(t){this.m_isValid=t,!t&&6===this.m_objectPathInfo.ObjectPathType&&this.m_savedObjectPathInfo&&(e.copyObjectPathInfo(this.m_savedObjectPathInfo.pathInfo,this.m_objectPathInfo),this.m_parentObjectPath=this.m_savedObjectPathInfo.parent,this.m_isValid=!0,this.m_savedObjectPathInfo=null)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"originalObjectPathInfo",{get:function(){return this.m_originalObjectPathInfo},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"getByIdMethodName",{get:function(){return this.m_getByIdMethodName},set:function(e){this.m_getByIdMethodName=e},enumerable:!1,configurable:!0}),e.prototype._updateAsNullObject=function(){this.resetForUpdateUsingObjectData(),this.m_objectPathInfo.ObjectPathType=7,this.m_objectPathInfo.Name="",this.m_parentObjectPath=null},e.prototype.saveOriginalObjectPathInfo=function(){t.config.extendedErrorLogging&&!this.m_originalObjectPathInfo&&(this.m_originalObjectPathInfo={},e.copyObjectPathInfo(this.m_objectPathInfo,this.m_originalObjectPathInfo))},e.prototype.updateUsingObjectData=function(t,n){var r=t[v.referenceId];if(!a.CoreUtility.isNullOrEmptyString(r)){if(!this.m_savedObjectPathInfo&&!this.isInvalidAfterRequest&&e.isRestorableObjectPath(this.m_objectPathInfo.ObjectPathType)){var o={};e.copyObjectPathInfo(this.m_objectPathInfo,o),this.m_savedObjectPathInfo={pathInfo:o,parent:this.m_parentObjectPath}}return this.saveOriginalObjectPathInfo(),this.resetForUpdateUsingObjectData(),this.m_objectPathInfo.ObjectPathType=6,this.m_objectPathInfo.Name=r,delete this.m_objectPathInfo.ParentObjectPathId,void(this.m_parentObjectPath=null)}if(n){var i=n[v.collectionPropertyPath];if(!a.CoreUtility.isNullOrEmptyString(i)&&n.context){var s=b.tryGetObjectIdFromLoadOrRetrieveResult(t);if(!a.CoreUtility.isNullOrUndefined(s)){for(var c=i.split("."),u=n.context[c[0]],l=1;l<c.length;l++)u=u[c[l]];return this.saveOriginalObjectPathInfo(),this.resetForUpdateUsingObjectData(),this.m_parentObjectPath=u._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=[s])}}}var d=this.parentObjectPath&&this.parentObjectPath.isCollection,p=this.getByIdMethodName;if(d||!a.CoreUtility.isNullOrEmptyString(p)){s=b.tryGetObjectIdFromLoadOrRetrieveResult(t);if(!a.CoreUtility.isNullOrUndefined(s))return this.saveOriginalObjectPathInfo(),this.resetForUpdateUsingObjectData(),a.CoreUtility.isNullOrEmptyString(p)?(this.m_objectPathInfo.ObjectPathType=5,this.m_objectPathInfo.Name=""):(this.m_objectPathInfo.ObjectPathType=3,this.m_objectPathInfo.Name=p),void(this.m_objectPathInfo.ArgumentInfo.Arguments=[s])}},e.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},e.isRestorableObjectPath=function(e){return 1===e||5===e||3===e||4===e},e.copyObjectPathInfo=function(e,t){t.Id=e.Id,t.ArgumentInfo=e.ArgumentInfo,t.Name=e.Name,t.ObjectPathType=e.ObjectPathType,t.ParentObjectPathId=e.ParentObjectPathId},e}();t.ObjectPath=d;var p=function(){function e(){this.m_nextId=0}return e.prototype._nextId=function(){return++this.m_nextId},e.prototype._addServiceApiAction=function(e,t,n,r){this.m_serviceApiQueue||(this.m_serviceApiQueue=new g(this)),this.m_serviceApiQueue.add(e,t,n,r)},e._parseQueryOption=function(t){var n={};if("string"==typeof t){var r=t;n.Select=b._parseSelectExpand(r)}else if(Array.isArray(t))n.Select=t;else if("object"==typeof t){var o=t;if(e.isLoadOption(o)){if("string"==typeof o.select)n.Select=b._parseSelectExpand(o.select);else if(Array.isArray(o.select))n.Select=o.select;else if(!b.isNullOrUndefined(o.select))throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"option.select"});if("string"==typeof o.expand)n.Expand=b._parseSelectExpand(o.expand);else if(Array.isArray(o.expand))n.Expand=o.expand;else if(!b.isNullOrUndefined(o.expand))throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"option.expand"});if("number"==typeof o.top)n.Top=o.top;else if(!b.isNullOrUndefined(o.top))throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"option.top"});if("number"==typeof o.skip)n.Skip=o.skip;else if(!b.isNullOrUndefined(o.skip))throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"option.skip"})}else n=e.parseStrictLoadOption(t)}else if(!b.isNullOrUndefined(t))throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"option"});return n},e.isLoadOption=function(e){if(!b.isUndefined(e.select)&&("string"==typeof e.select||Array.isArray(e.select)))return!0;if(!b.isUndefined(e.expand)&&("string"==typeof e.expand||Array.isArray(e.expand)))return!0;if(!b.isUndefined(e.top)&&"number"==typeof e.top)return!0;if(!b.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,r,o){for(var i in o){var s=o[i];if("$all"===i){if("boolean"!=typeof s)throw a._Internal.RuntimeError._createInvalidArgError({argumentName:e.combineQueryPath(r,i,".")});s&&t.Select.push(e.combineQueryPath(n,"*","/"))}else if("$top"===i){if("number"!=typeof s||n.length>0)throw a._Internal.RuntimeError._createInvalidArgError({argumentName:e.combineQueryPath(r,i,".")});t.Top=s}else if("$skip"===i){if("number"!=typeof s||n.length>0)throw a._Internal.RuntimeError._createInvalidArgError({argumentName:e.combineQueryPath(r,i,".")});t.Skip=s}else if("boolean"==typeof s)s&&t.Select.push(e.combineQueryPath(n,i,"/"));else{if("object"!=typeof s)throw a._Internal.RuntimeError._createInvalidArgError({argumentName:e.combineQueryPath(r,i,".")});e.parseStrictLoadOptionHelper(t,e.combineQueryPath(n,i,"/"),e.combineQueryPath(r,i,"."),s)}}},e}();t.ClientRequestContextBase=p;var f=function(){function e(e){this.m_objectPath=e}return e.prototype._handleResult=function(e){a.CoreUtility.isNullOrUndefined(e)?this.m_objectPath._updateAsNullObject():this.m_objectPath.updateUsingObjectData(e,null)},e}(),h=function(){function e(e){this.m_contextBase=e,this.m_actions=[],this.m_actionResultHandler={},this.m_referencedObjectPaths={},this.m_instantiatedObjectPaths={},this.m_preSyncPromises=[]}return e.prototype.addAction=function(e){this.m_actions.push(e),1==e.actionInfo.ActionType&&(this.m_instantiatedObjectPaths[e.actionInfo.ObjectPathId]=e)},Object.defineProperty(e.prototype,"hasActions",{get:function(){return this.m_actions.length>0},enumerable:!1,configurable:!0}),e.prototype._getLastAction=function(){return this.m_actions[this.m_actions.length-1]},e.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 l(t,1,4);n.referencedObjectPath=e,this.addReferencedObjectPath(e),this.addAction(n);var r=new f(e);this.addActionResultHandler(n,r)}}},e.prototype.ensureInstantiateObjectPaths=function(e){if(e)for(var t=0;t<e.length;t++)this.ensureInstantiateObjectPath(e[t])},e.prototype.addReferencedObjectPath=function(e){if(e&&!this.m_referencedObjectPaths[e.objectPathInfo.Id]){if(!e.isValid)throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidObjectPath,httpStatusCode:400,message:a.CoreUtility._getResourceString(a.CoreResourceStrings.invalidObjectPath,b.getObjectPathExpression(e)),debugInfo:{errorLocation:b.getObjectPathExpression(e)}});for(;e;)this.m_referencedObjectPaths[e.objectPathInfo.Id]=e,3==e.objectPathInfo.ObjectPathType&&this.addReferencedObjectPaths(e.argumentObjectPaths),e=e.parentObjectPath}},e.prototype.addReferencedObjectPaths=function(e){if(e)for(var t=0;t<e.length;t++)this.addReferencedObjectPath(e[t])},e.prototype.addActionResultHandler=function(e,t){this.m_actionResultHandler[e.actionInfo.Id]=t},e.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},e.prototype.finallyNormalizeFlags=function(e){return 0==(1&e)&&(e&=-17,e&=-257),t._internalConfig.enableConcurrentFlag||(e&=-5),t._internalConfig.enableUndoableFlag||(e&=-17),b.isSetSupported("RichApiRuntimeFlag","1.1")||(e&=-5,e&=-17),b.isSetSupported("RichApiRuntimeFlag","1.2")||(e&=-257),"number"==typeof this.m_flagsForTesting&&(e=this.m_flagsForTesting),e},e.prototype.buildRequestMessageBodyAndRequestFlags=function(){t._internalConfig.enableEarlyDispose&&e._calculateLastUsedObjectPathIds(this.m_actions);var n=276,r={};for(var o in this.m_referencedObjectPaths)n=this.aggregrateRequestFlags(n,this.m_referencedObjectPaths[o].operationType,this.m_referencedObjectPaths[o].flags),r[o]=this.m_referencedObjectPaths[o].objectPathInfo;for(var i=[],s=!1,a=0;a<this.m_actions.length;a++){var c=this.m_actions[a];3===c.actionInfo.ActionType&&c.actionInfo.Name===v.keepReference&&(s=!0),n=this.aggregrateRequestFlags(n,c.operationType,c.flags),i.push(c.actionInfo)}return n=this.finallyNormalizeFlags(n),{body:{AutoKeepReference:this.m_contextBase._autoCleanup&&s,Actions:i,ObjectPaths:r},flags:n}},e.prototype.processResponse=function(e){if(e)for(var t=0;t<e.length;t++){var n=e[t],r=this.m_actionResultHandler[n.ActionId];r&&r._handleResult(n.Value)}},e.prototype.invalidatePendingInvalidObjectPaths=function(){for(var e in this.m_referencedObjectPaths)this.m_referencedObjectPaths[e].isInvalidAfterRequest&&(this.m_referencedObjectPaths[e].isValid=!1)},e.prototype._addPreSyncPromise=function(e){this.m_preSyncPromises.push(e)},Object.defineProperty(e.prototype,"_preSyncPromises",{get:function(){return this.m_preSyncPromises},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_actions",{get:function(){return this.m_actions},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_objectPaths",{get:function(){return this.m_referencedObjectPaths},enumerable:!1,configurable:!0}),e.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===v.keepReference){this.m_actions.splice(t,1);break}}},e._updateLastUsedActionIdOfObjectPathId=function(t,n,r){for(;n;){if(t[n.objectPathInfo.Id])return;t[n.objectPathInfo.Id]=r;var o=n.argumentObjectPaths;if(o)for(var i=o.length,s=0;s<i;s++)e._updateLastUsedActionIdOfObjectPathId(t,o[s],r);n=n.parentObjectPath}},e._calculateLastUsedObjectPathIds=function(t){for(var n={},r=t.length,o=r-1;o>=0;--o){var i=(p=t[o]).actionInfo.Id;p.referencedObjectPath&&e._updateLastUsedActionIdOfObjectPathId(n,p.referencedObjectPath,i);var s=p.referencedArgumentObjectPaths;if(s)for(var a=s.length,c=0;c<a;c++)e._updateLastUsedActionIdOfObjectPathId(n,s[c],i)}var u={};for(var l in n){var d=u[i=n[l]];d||(d=[],u[i]=d),d.push(parseInt(l))}for(o=0;o<r;o++){var p,f=u[(p=t[o]).actionInfo.Id];f&&f.length>0?p.actionInfo.L=f:p.actionInfo.L&&delete p.actionInfo.L}},e}();t.ClientRequestBase=h;var m=function(){function e(e){this.m_type=e}return Object.defineProperty(e.prototype,"value",{get:function(){if(!this.m_isLoaded)throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.valueNotLoaded,httpStatusCode:400,message:a.CoreUtility._getResourceString(a.CoreResourceStrings.valueNotLoaded),debugInfo:{errorLocation:"clientResult.value"}});return this.m_value},enumerable:!1,configurable:!0}),e.prototype._handleResult=function(e){this.m_isLoaded=!0,"object"==typeof e&&e&&e._IsNull||(1===this.m_type?this.m_value=b.adjustToDateTime(e):this.m_value=e)},e}();t.ClientResult=m;var g=function(){function e(e){this.m_context=e,this.m_actions=[]}return e.prototype.add=function(e,t,n,r){var o=this;this.m_actions.push({action:e,resultHandler:t,resolve:n,reject:r}),1===this.m_actions.length&&setTimeout((function(){return o.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 h(this.m_context),r=0;r<t.length;r++){var o=t[r];n.ensureInstantiateObjectPath(o.action.referencedObjectPath),n.ensureInstantiateObjectPaths(o.action.referencedArgumentObjectPaths),n.addAction(o.action),n.addReferencedObjectPath(o.action.referencedObjectPath),n.addReferencedObjectPaths(o.action.referencedArgumentObjectPaths)}var i=n.buildRequestMessageBodyAndRequestFlags(),s=i.body,c=i.flags,u={Url:a.CoreConstants.localDocumentApiPrefix,Headers:null,Body:s};a.CoreUtility.log("Request:"),a.CoreUtility.log(JSON.stringify(s)),(new y).executeAsync(this.m_context._customData,c,u).then((function(r){e.processResponse(n,t,r)})).catch((function(e){for(var n=0;n<t.length;n++){t[n].reject(e)}}))}},e.prototype.processResponse=function(e,t,n){var r=this.getErrorFromResponse(n),o=null;n.Body.Results?o=n.Body.Results:n.Body.ProcessedResults&&n.Body.ProcessedResults.Results&&(o=n.Body.ProcessedResults.Results),o||(o=[]),this.processActionResults(e,t,o,r)},e.prototype.getErrorFromResponse=function(e){return a.CoreUtility.isNullOrEmptyString(e.ErrorCode)?e.Body&&e.Body.Error?new a._Internal.RuntimeError({code:e.Body.Error.Code,httpStatusCode:e.Body.Error.HttpStatusCode,message:e.Body.Error.Message}):null:new a._Internal.RuntimeError({code:e.ErrorCode,httpStatusCode:e.HttpStatusCode,message:e.ErrorMessage})},e.prototype.processActionResults=function(e,t,n,r){e.processResponse(n);for(var o=0;o<t.length;o++){for(var i=t[o],s=i.action.actionInfo.Id,a=!1,c=0;c<n.length;c++)if(s==n[c].ActionId){var u=n[c].Value;i.resultHandler&&(i.resultHandler._handleResult(u),u=i.resultHandler.value),i.resolve&&i.resolve(u),a=!0;break}!a&&i.reject&&(r?i.reject(r):i.reject("No response for the action."))}},e}(),y=function(){function e(){}return e.prototype.getRequestUrl=function(e,t){return"/"!=e.charAt(e.length-1)&&(e+="/"),e=(e+=a.CoreConstants.processQuery)+"?"+a.CoreConstants.flags+"="+t.toString()},e.prototype.executeAsync=function(t,n,r){var o={method:"POST",url:this.getRequestUrl(r.Url,n),headers:{},body:r.Body};if(o.headers[a.CoreConstants.sourceLibHeader]=e.SourceLibHeaderValue,o.headers["CONTENT-TYPE"]="application/json",r.Headers)for(var i in r.Headers)o.headers[i]=r.Headers[i];return(a.CoreUtility._isLocalDocumentUrl(o.url)?a.HttpUtility.sendLocalDocumentRequest:a.HttpUtility.sendRequest)(o).then((function(e){var t;if(200===e.statusCode)t={HttpStatusCode:e.statusCode,ErrorCode:null,ErrorMessage:null,Headers:e.headers,Body:a.CoreUtility._parseResponseBody(e)};else{a.CoreUtility.log("Error Response:"+e.body);var n=a.CoreUtility._parseErrorResponse(e);t={HttpStatusCode:e.statusCode,ErrorCode:n.errorCode,ErrorMessage:n.errorMessage,Headers:e.headers,Body:null}}return t}))},e.SourceLibHeaderValue="officejs-rest",e}();t.HttpRequestExecutor=y;var v=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(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}(a.CoreConstants);t.CommonConstants=v;var b=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.validateObjectPath=function(e){for(var n=e._objectPath;n;){if(!n.isValid)throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidObjectPath,httpStatusCode:400,message:a.CoreUtility._getResourceString(a.CoreResourceStrings.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 r=e[n];r;){if(!r.isValid)throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidObjectPath,httpStatusCode:400,message:a.CoreUtility._getResourceString(a.CoreResourceStrings.invalidObjectPath,t.getObjectPathExpression(r))});r=r.parentObjectPath}},t._toCamelLowerCase=function(e){if(a.CoreUtility.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(a.CoreUtility.isNullOrUndefined(e))return null;if("string"==typeof e)return new Date(e);if(Array.isArray(e)){for(var n=e,r=0;r<n.length;r++)n[r]=t.adjustToDateTime(n[r]);return n}throw a.CoreUtility._createInvalidArgError({argumentName:"date"})},t.tryGetObjectIdFromLoadOrRetrieveResult=function(e){var t=e[v.id];return a.CoreUtility.isNullOrUndefined(t)&&(t=e[v.idLowerCase]),a.CoreUtility.isNullOrUndefined(t)&&(t=e[v.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,r){if(a.CoreUtility.isNullOrUndefined(r))return null;var o=new Array,i=new Array,s=t.collectObjectPathInfos(e,r,o,i);return n.Arguments=r,s&&(n.ReferencedObjectPathIds=i),o},t.validateContext=function(e,t){if(e&&t&&t._context!==e)throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidRequestContext,httpStatusCode:400,message:a.CoreUtility._getResourceString(a.CoreResourceStrings.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,r,o){if(t._doApiNotSupportedCheck&&!t.isSetSupported(n,r)){var i=a.CoreUtility._getResourceString(a.CoreResourceStrings.apiNotFoundDetails,[e,n+" "+r,o]);throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.apiNotFound,httpStatusCode:404,message:i,debugInfo:{errorLocation:e}})}},t.calculateApiFlags=function(e,n,r){return t.isSetSupported(n,r)||(e&=-3),e},t._parseSelectExpand=function(e){var t=[];if(!a.CoreUtility.isNullOrEmptyString(e))for(var n=e.split(","),r=0;r<n.length;r++){var o=n[r];(o=i(o.trim())).length>0&&t.push(o)}return t;function i(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<e.length;r++)n.push(this.changePropertyNameToCamelLowerCase(e[r]));return n}if("object"==typeof e&&null!==e){n={};for(var o in e){var i=e[o];if(o===v.items){(n={})[v.itemsLowerCase]=this.changePropertyNameToCamelLowerCase(i);break}n[t._toCamelLowerCase(o)]=this.changePropertyNameToCamelLowerCase(i)}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 r in e)if(95!==r.charCodeAt(0)){var o=e[r];"object"==typeof o&&null!==o&&Array.isArray(o.items)&&(o=o.items),t[r]=this.purifyJson(o)}return t}return e},t.collectObjectPathInfos=function(e,n,r,o){for(var i=!1,s=0;s<n.length;s++)if(n[s]instanceof u){var c=n[s];t.validateContext(e,c),n[s]=c._objectPath.objectPathInfo.Id,o.push(c._objectPath.objectPathInfo.Id),r.push(c._objectPath),i=!0}else if(Array.isArray(n[s])){var l=new Array;t.collectObjectPathInfos(e,n[s],r,l)?(o.push(l),i=!0):o.push(0)}else a.CoreUtility.isPlainJsonObject(n[s])?(o.push(0),t.replaceClientObjectPropertiesWithObjectPathIds(n[s],r)):o.push(0);return i},t.replaceClientObjectPropertiesWithObjectPathIds=function(e,n){var r,o;for(var i in e){var s=e[i];if(s instanceof u)n.push(s._objectPath),e[i]=((r={})[v.objectPathIdPrivate]=s._objectPath.objectPathInfo.Id,r);else if(Array.isArray(s))for(var c=0;c<s.length;c++)if(s[c]instanceof u){var l=s[c];n.push(l._objectPath),s[c]=((o={})[v.objectPathIdPrivate]=l._objectPath.objectPathInfo.Id,o)}else a.CoreUtility.isPlainJsonObject(s[c])&&t.replaceClientObjectPropertiesWithObjectPathIds(s[c],n);else a.CoreUtility.isPlainJsonObject(s)&&t.replaceClientObjectPropertiesWithObjectPathIds(s,n)}},t.normalizeName=function(e){return e.substr(0,1).toLowerCase()+e.substr(1)},t._doApiNotSupportedCheck=!1,t}(a.CoreUtility);t.CommonUtility=b;var _=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.propertyDoesNotExist="PropertyDoesNotExist",t.attemptingToSetReadOnlyProperty="AttemptingToSetReadOnlyProperty",t}(a.CoreResourceStrings);t.CommonResourceStrings=_},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LibraryBuilder=t.BatchApiHelper=t._internalConfig=t.WebImage=t.Utility=t.SessionBase=t.ResourceStrings=t.Provider=t.HttpUtility=t.GenericEventHandlers=t.FormattedNumber=t.EventHandlers=t.ErrorCodes=t.Error=t.Entity=t.CoreUtility=t.Constants=t.config=t.CommonUtility=t.ClientObject=t.ClientResult=t.ClientRequestContext=t.Attribution=void 0;var r=n(1);Object.defineProperty(t,"Attribution",{enumerable:!0,get:function(){return r.Attribution}}),Object.defineProperty(t,"CoreUtility",{enumerable:!0,get:function(){return r.CoreUtility}}),Object.defineProperty(t,"Entity",{enumerable:!0,get:function(){return r.Entity}}),Object.defineProperty(t,"Error",{enumerable:!0,get:function(){return r.Error}}),Object.defineProperty(t,"FormattedNumber",{enumerable:!0,get:function(){return r.FormattedNumber}}),Object.defineProperty(t,"HttpUtility",{enumerable:!0,get:function(){return r.HttpUtility}}),Object.defineProperty(t,"Provider",{enumerable:!0,get:function(){return r.Provider}}),Object.defineProperty(t,"SessionBase",{enumerable:!0,get:function(){return r.SessionBase}}),Object.defineProperty(t,"WebImage",{enumerable:!0,get:function(){return r.WebImage}});var o=n(2);Object.defineProperty(t,"CommonUtility",{enumerable:!0,get:function(){return o.CommonUtility}}),Object.defineProperty(t,"ClientResult",{enumerable:!0,get:function(){return o.ClientResult}});var i=n(4);Object.defineProperty(t,"ClientRequestContext",{enumerable:!0,get:function(){return i.ClientRequestContext}}),Object.defineProperty(t,"ClientObject",{enumerable:!0,get:function(){return i.ClientObject}}),Object.defineProperty(t,"config",{enumerable:!0,get:function(){return i.config}}),Object.defineProperty(t,"Constants",{enumerable:!0,get:function(){return i.Constants}}),Object.defineProperty(t,"ErrorCodes",{enumerable:!0,get:function(){return i.ErrorCodes}}),Object.defineProperty(t,"EventHandlers",{enumerable:!0,get:function(){return i.EventHandlers}}),Object.defineProperty(t,"GenericEventHandlers",{enumerable:!0,get:function(){return i.GenericEventHandlers}}),Object.defineProperty(t,"ResourceStrings",{enumerable:!0,get:function(){return i.ResourceStrings}}),Object.defineProperty(t,"Utility",{enumerable:!0,get:function(){return i.Utility}}),Object.defineProperty(t,"_internalConfig",{enumerable:!0,get:function(){return i._internalConfig}});var s=function(){function e(){}return e.invokeMethod=function(e,t,n,r,s,a){var c=i.ActionFactory.createMethodAction(e.context,e,t,n,r,s),u=new o.ClientResult(a);return i.Utility._addActionResultHandler(e,c,u),u},e.invokeEnsureUnchanged=function(e,t){i.ActionFactory.createEnsureUnchangedAction(e.context,e,t)},e.invokeSetProperty=function(e,t,n,r){i.ActionFactory.createSetPropertyAction(e.context,e,t,n,r)},e.createRootServiceObject=function(e,t){return new e(t,i.ObjectPathFactory.createGlobalObjectObjectPath(t))},e.createObjectFromReferenceId=function(e,t,n){return new e(t,i.ObjectPathFactory.createReferenceIdObjectPath(t,n))},e.createTopLevelServiceObject=function(e,t,n,r,o){return new e(t,i.ObjectPathFactory.createNewObjectObjectPath(t,n,r,o))},e.createPropertyObject=function(e,t,n,r,o){var s=i.ObjectPathFactory.createPropertyObjectPath(t.context,t,n,r,!1,o);return new e(t.context,s)},e.createIndexerObject=function(e,t,n){var r=i.ObjectPathFactory.createIndexerObjectPath(t.context,t,n);return new e(t.context,r)},e.createMethodObject=function(e,t,n,r,o,s,a,c,u){var l=i.ObjectPathFactory.createMethodObjectPath(t.context,t,n,r,o,s,a,c,u);return new e(t.context,l)},e.createChildItemObject=function(e,t,n,r,o){var s=i.ObjectPathFactory.createChildItemObjectPathUsingIndexerOrGetItemAt(t,n.context,n,r,o);return new e(n.context,s)},e}();t.BatchApiHelper=s;var a=function(){function e(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 r=0;r<n.enumTypes.length;r++)this.buildEnumType(n.enumTypes[r]);if(n.apiSets){for(r=0;r<n.apiSets.length;r++){var o=n.apiSets[r];Array.isArray(o)&&(n.apiSets[r]={version:o[0],name:o[1]||this.m_defaultApiSetName})}this.m_apiSets=n.apiSets}if(this.m_strings=n.strings,n.clientObjectTypes)for(r=0;r<n.clientObjectTypes.length;r++){o=n.clientObjectTypes[r];Array.isArray(o)&&(this.ensureArraySize(o,11),n.clientObjectTypes[r]={name:this.getString(o[0]),behaviorFlags:o[1],collectionPropertyPath:this.getString(o[6]),newObjectServerTypeFullName:this.getString(o[9]),newObjectApiFlags:o[10],childItemTypeFullName:this.getString(o[7]),scalarProperties:o[2],navigationProperties:o[3],scalarMethods:o[4],navigationMethods:o[5],events:o[8]}),this.buildClientObjectType(n.clientObjectTypes[r],e.fullyInitialize)}}return e.prototype.ensureArraySize=function(e,t){for(var n=t-e.length;n>0;)e.push(0),n--},e.prototype.getString=function(e){return"number"==typeof e?e>0?this.m_strings[e-1]:null:e},e.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;r<n.length;r++)t.fields[n[r]]=this.toSimpleCamelUpperCase(n[r])}else t=e;this.m_targetNamespaceObject[t.name]=t.fields},e.prototype.buildClientObjectType=function(t,n){var r=this,o=function(e,n){i.ClientObject.apply(this,arguments),r.m_targetNamespaceObject[t.name]._typeInited||(r.buildPrototype(r.m_targetNamespaceObject[t.name],t),r.m_targetNamespaceObject[t.name]._typeInited=!0),i._internalConfig.appendTypeNameToObjectPathInfo&&this._objectPath&&this._objectPath.objectPathInfo&&this._className&&(this._objectPath.objectPathInfo.T=this._className)};(this.m_targetNamespaceObject[t.name]=o,this.extendsType(o,i.ClientObject),this.buildNewObject(o,t),0!=(2&t.behaviorFlags)&&(o.prototype._KeepReference=function(){s.invokeMethod(this,"_KeepReference",1,[],0,0)}),0!=(32&t.behaviorFlags))&&this.getFunction(e.CustomizationCodeNamespace+"."+t.name+"_StaticCustomize").call(null,o);n&&(this.buildPrototype(o,t),o._typeInited=!0)},e.prototype.extendsType=function(e,t){function n(){this.constructor=e}e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},e.prototype.findObjectUnderPath=function(e,t,n){for(var o=e,i=n;i<t.length;i++){if("object"!=typeof o)throw new r.Error("Cannot find "+t.join("."));o=o[t[i]]}return o},e.prototype.getFunction=function(e){var t=this.resolveObjectByFullName(e);if("function"!=typeof t)throw new r.Error("Cannot find function or type: "+e);return t},e.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)},e.prototype.evaluateSimpleExpression=function(e,t){if(i.Utility.isNullOrUndefined(e))return null;var n=e.split(".");if(3===n.length&&"OfficeExtension"===n[0]&&"Constants"===n[1])return i.Constants[n[2]];if("this"===n[0]){for(var o=t,s=1;s<n.length;s++)o="toString()"==n[s]?o.toString():"()"===n[s].substr(n[s].length-2)?o[n[s].substr(0,n[s].length-2)]():o[n[s]];return o}throw new r.Error("Cannot evaluate: "+e)},e.prototype.evaluateEventTargetId=function(e,t){return i.Utility.isNullOrEmptyString(e)?"":this.evaluateSimpleExpression(e,t)},e.prototype.isAllDigits=function(e){for(var t="0".charCodeAt(0),n="9".charCodeAt(0),r=0;r<e.length;r++)if(e.charCodeAt(r)<t||e.charCodeAt(r)>n)return!1;return!0},e.prototype.evaluateEventType=function(e){if(i.Utility.isNullOrEmptyString(e))return 0;if(this.isAllDigits(e))return parseInt(e);var t=this.resolveObjectByFullName(e);if("number"!=typeof t)throw new r.Error("Invalid event type: "+e);return t},e.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)},e.prototype.toSimpleCamelUpperCase=function(e){return e.substr(0,1).toUpperCase()+e.substr(1)},e.prototype.ensureOriginalName=function(e){null===e.originalName&&(e.originalName=this.toSimpleCamelUpperCase(e.name))},e.prototype.getFieldName=function(e){return"m_"+e.name},e.prototype.throwIfApiNotSupported=function(e,t){if(this.m_apiSets&&t.apiSetInfoOrdinal>0){var n=this.m_apiSets[t.apiSetInfoOrdinal-1];n&&i.Utility.throwIfApiNotSupported(e.name+"."+t.name,n.name,n.version,this.m_hostName)}},e.prototype.buildScalarProperties=function(e,t){if(Array.isArray(t.scalarProperties))for(var n=0;n<t.scalarProperties.length;n++){var r=t.scalarProperties[n];Array.isArray(r)&&(this.ensureArraySize(r,6),t.scalarProperties[n]={name:this.getString(r[0]),behaviorFlags:r[1],apiSetInfoOrdinal:r[2],originalName:this.getString(r[3]),setMethodApiFlags:r[4],undoableApiSetInfoOrdinal:r[5]}),this.buildScalarProperty(e,t,t.scalarProperties[n])}},e.prototype.calculateApiFlags=function(e,t){if(t>0){var n=this.m_apiSets[t-1];n&&(e=o.CommonUtility.calculateApiFlags(e,n.name,n.version))}return e},e.prototype.buildScalarProperty=function(t,n,r){this.ensureOriginalName(r);var o=this,a=this.getFieldName(r),c={get:function(){return i.Utility.throwIfNotLoaded(r.name,this[a],n.name,this._isNull),o.throwIfApiNotSupported(n,r),this[a]},enumerable:!0,configurable:!0};0==(2&r.behaviorFlags)&&(c.set=function(t){if(4&r.behaviorFlags&&o.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_"+r.originalName+"_Set").call(this,this,t).handled)return;this[a]=t;var i=o.calculateApiFlags(r.setMethodApiFlags,r.undoableApiSetInfoOrdinal);s.invokeSetProperty(this,r.originalName,t,i)}),Object.defineProperty(t.prototype,r.name,c)},e.prototype.buildNavigationProperties=function(e,t){if(Array.isArray(t.navigationProperties))for(var n=0;n<t.navigationProperties.length;n++){var r=t.navigationProperties[n];Array.isArray(r)&&(this.ensureArraySize(r,8),t.navigationProperties[n]={name:this.getString(r[0]),behaviorFlags:r[2],apiSetInfoOrdinal:r[3],originalName:this.getString(r[4]),getMethodApiFlags:r[5],setMethodApiFlags:r[6],propertyTypeFullName:this.getString(r[1]),undoableApiSetInfoOrdinal:r[7]}),this.buildNavigationProperty(e,t,t.navigationProperties[n])}},e.prototype.buildNavigationProperty=function(t,n,r){this.ensureOriginalName(r);var o=this,i=this.getFieldName(r),a={get:function(){(this[o.getFieldName(r)]||(o.throwIfApiNotSupported(n,r),this[i]=s.createPropertyObject(o.getFunction(r.propertyTypeFullName),this,r.originalName,0!=(16&r.behaviorFlags),r.getMethodApiFlags)),64&r.behaviorFlags)&&o.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_"+r.originalName+"_Get").call(this,this,this[i]);return this[i]},enumerable:!0,configurable:!0};0==(2&r.behaviorFlags)&&(a.set=function(t){if(4&r.behaviorFlags&&o.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_"+r.originalName+"_Set").call(this,this,t).handled)return;this[i]=t;var a=o.calculateApiFlags(r.setMethodApiFlags,r.undoableApiSetInfoOrdinal);s.invokeSetProperty(this,r.originalName,t,a)}),Object.defineProperty(t.prototype,r.name,a)},e.prototype.buildScalarMethods=function(e,t){if(Array.isArray(t.scalarMethods))for(var n=0;n<t.scalarMethods.length;n++){var r=t.scalarMethods[n];Array.isArray(r)&&(this.ensureArraySize(r,7),t.scalarMethods[n]={name:this.getString(r[0]),behaviorFlags:r[2],apiSetInfoOrdinal:r[3],originalName:this.getString(r[5]),apiFlags:r[4],parameterCount:r[1],undoableApiSetInfoOrdinal:r[6]}),this.buildScalarMethod(e,t,t.scalarMethods[n])}},e.prototype.buildScalarMethod=function(t,n,r){this.ensureOriginalName(r);var o=this;t.prototype[r.name]=function(){var t=[];if(64&r.behaviorFlags&&r.parameterCount>0){for(var i=0;i<r.parameterCount-1;i++)t.push(arguments[i]);var a=[];for(i=r.parameterCount-1;i<arguments.length;i++)a.push(arguments[i]);t.push(a)}else for(i=0;i<arguments.length;i++)t.push(arguments[i]);if(1&r.behaviorFlags){var c=o.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_"+r.originalName),u=[this];for(i=0;i<t.length;i++)u.push(t[i]);var l=c.apply(this,u),d=l.handled,p=l.result;if(d)return p}o.throwIfApiNotSupported(n,r);var f=0;32&r.behaviorFlags&&(f=1);var h=0;2&r.behaviorFlags&&(h=1);var m=o.calculateApiFlags(r.apiFlags,r.undoableApiSetInfoOrdinal);return s.invokeMethod(this,r.originalName,h,t,m,f)}},e.prototype.buildNavigationMethods=function(e,t){if(Array.isArray(t.navigationMethods))for(var n=0;n<t.navigationMethods.length;n++){var r=t.navigationMethods[n];Array.isArray(r)&&(this.ensureArraySize(r,9),t.navigationMethods[n]={name:this.getString(r[0]),behaviorFlags:r[3],apiSetInfoOrdinal:r[4],originalName:this.getString(r[6]),apiFlags:r[5],parameterCount:r[2],returnTypeFullName:this.getString(r[1]),returnObjectGetByIdMethodName:this.getString(r[7]),undoableApiSetInfoOrdinal:r[8]}),this.buildNavigationMethod(e,t,t.navigationMethods[n])}},e.prototype.buildNavigationMethod=function(t,n,r){this.ensureOriginalName(r);var o=this;t.prototype[r.name]=function(){var t=[];if(64&r.behaviorFlags&&r.parameterCount>0){for(var i=0;i<r.parameterCount-1;i++)t.push(arguments[i]);var a=[];for(i=r.parameterCount-1;i<arguments.length;i++)a.push(arguments[i]);t.push(a)}else for(i=0;i<arguments.length;i++)t.push(arguments[i]);if(1&r.behaviorFlags){var c=o.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_"+r.originalName),u=[this];for(i=0;i<t.length;i++)u.push(t[i]);var l=c.apply(this,u),d=l.handled,p=l.result;if(d)return p}if(o.throwIfApiNotSupported(n,r),0!=(16&r.behaviorFlags))return s.createIndexerObject(o.getFunction(r.returnTypeFullName),this,t);var f=0;2&r.behaviorFlags&&(f=1);var h=o.calculateApiFlags(r.apiFlags,r.undoableApiSetInfoOrdinal);return s.createMethodObject(o.getFunction(r.returnTypeFullName),this,r.originalName,f,t,0!=(4&r.behaviorFlags),0!=(8&r.behaviorFlags),r.returnObjectGetByIdMethodName,h)}},e.prototype.buildHandleResult=function(t,n){var r=this;t.prototype._handleResult=function(t){if(i.ClientObject.prototype._handleResult.call(this,t),!i.Utility.isNullOrUndefined(t)){if(i.Utility.fixObjectPathIfNecessary(this,t),8&n.behaviorFlags)r.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_HandleResult").call(this,this,t);if(n.scalarProperties)for(var o=0;o<n.scalarProperties.length;o++)i.Utility.isUndefined(t[n.scalarProperties[o].originalName])||(0!=(8&n.scalarProperties[o].behaviorFlags)?this[r.getFieldName(n.scalarProperties[o])]=i.Utility.adjustToDateTime(t[n.scalarProperties[o].originalName]):this[r.getFieldName(n.scalarProperties[o])]=t[n.scalarProperties[o].originalName]);if(n.navigationProperties){for(var a=[],c=0;c<n.navigationProperties.length;c++)a.push(n.navigationProperties[c].name),a.push(n.navigationProperties[c].originalName);i.Utility._handleNavigationPropertyResults(this,t,a)}if(0!=(1&n.behaviorFlags)){var u=r.hasIndexMethod(n);if(!i.Utility.isNullOrUndefined(t[i.Constants.items])){this.m__items=[];for(var l=t[i.Constants.items],d=r.getFunction(n.childItemTypeFullName),p=0;p<l.length;p++){var f=s.createChildItemObject(d,u,this,l[p],p);f._handleResult(l[p]),this.m__items.push(f)}}}}}},e.prototype.buildHandleRetrieveResult=function(e,t){var n=this;e.prototype._handleRetrieveResult=function(e,r){if(i.ClientObject.prototype._handleRetrieveResult.call(this,e,r),!i.Utility.isNullOrUndefined(e)){if(t.scalarProperties)for(var o=0;o<t.scalarProperties.length;o++)8&t.scalarProperties[o].behaviorFlags&&(i.Utility.isNullOrUndefined(e[t.scalarProperties[o].name])||(e[t.scalarProperties[o].name]=i.Utility.adjustToDateTime(e[t.scalarProperties[o].name])));if(1&t.behaviorFlags){var a=n.hasIndexMethod(t),c=n.getFunction(t.childItemTypeFullName),u=this;i.Utility.processRetrieveResult(u,e,r,(function(e,t){return s.createChildItemObject(c,a,u,e,t)}))}else i.Utility.processRetrieveResult(this,e,r)}}},e.prototype.buildHandleIdResult=function(t,n){var r=this;t.prototype._handleIdResult=function(t){if(i.ClientObject.prototype._handleIdResult.call(this,t),!i.Utility.isNullOrUndefined(t)){if(16&n.behaviorFlags)r.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_HandleIdResult").call(this,this,t);if(n.scalarProperties)for(var o=0;o<n.scalarProperties.length;o++){var s=n.scalarProperties[o].originalName;"Id"!==s&&"_Id"!==s&&"_ReferenceId"!==s||i.Utility.isNullOrUndefined(t[n.scalarProperties[o].originalName])||(this[r.getFieldName(n.scalarProperties[o])]=t[n.scalarProperties[o].originalName])}}}},e.prototype.buildLoad=function(e,t){e.prototype.load=function(e){return i.Utility.load(this,e)}},e.prototype.buildRetrieve=function(e,t){e.prototype.retrieve=function(e){return i.Utility.retrieve(this,e)}},e.prototype.buildNewObject=function(e,t){i.Utility.isNullOrEmptyString(t.newObjectServerTypeFullName)||(e.newObject=function(n){return s.createTopLevelServiceObject(e,n,t.newObjectServerTypeFullName,0!=(1&t.behaviorFlags),t.newObjectApiFlags)})},e.prototype.buildSetMockData=function(e,t){var n=this;if(1&t.behaviorFlags){var r=n.hasIndexMethod(t);e.prototype.setMockData=function(e){var o=this;i.Utility.setMockData(o,e,(function(e,i){return s.createChildItemObject(n.getFunction(t.childItemTypeFullName),r,o,e,i)}),(function(e){o.m__items=e}))}}else e.prototype.setMockData=function(e){i.Utility.setMockData(this,e)}},e.prototype.buildEnsureUnchanged=function(e,t){e.prototype.ensureUnchanged=function(e){s.invokeEnsureUnchanged(this,e)}},e.prototype.buildUpdate=function(e,t){e.prototype.update=function(e){this._recursivelyUpdate(e)}},e.prototype.buildSet=function(e,t){if(0==(1&t.behaviorFlags)){var n=[],r=[];if(t.scalarProperties)for(var o=0;o<t.scalarProperties.length;o++)0==(2&t.scalarProperties[o].behaviorFlags)&&0!=(1&t.scalarProperties[o].behaviorFlags)?r.push(t.scalarProperties[o].name):n.push(t.scalarProperties[o].name);var i=[];if(t.navigationProperties)for(o=0;o<t.navigationProperties.length;o++)0!=(16&t.navigationProperties[o].behaviorFlags)||0==(1&t.navigationProperties[o].behaviorFlags)||0==(32&t.navigationProperties[o].behaviorFlags)?n.push(t.navigationProperties[o].name):i.push(t.navigationProperties[o].name);0===i.length&&0===r.length||(e.prototype.set=function(e,t){this._recursivelySet(e,t,r,i,n)})}},e.prototype.buildItems=function(e,t){0!=(1&t.behaviorFlags)&&Object.defineProperty(e.prototype,"items",{get:function(){return i.Utility.throwIfNotLoaded("items",this.m__items,t.name,this._isNull),this.m__items},enumerable:!0,configurable:!0})},e.prototype.buildToJSON=function(e,t){var n=this;0==(1&t.behaviorFlags)?e.prototype.toJSON=function(){var e={};if(t.scalarProperties)for(var r=0;r<t.scalarProperties.length;r++)0!=(1&t.scalarProperties[r].behaviorFlags)&&(e[t.scalarProperties[r].name]=this[n.getFieldName(t.scalarProperties[r])]);var o={};if(t.navigationProperties)for(r=0;r<t.navigationProperties.length;r++)0!=(1&t.navigationProperties[r].behaviorFlags)&&(o[t.navigationProperties[r].name]=this[n.getFieldName(t.navigationProperties[r])]);return i.Utility.toJson(this,e,o)}:e.prototype.toJSON=function(){return i.Utility.toJson(this,{},{},this.m__items)}},e.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}),i.Utility.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})},e.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})},e.prototype.buildMixin=function(e,t){if(4&t.behaviorFlags){var n=this.getFunction(t.name+"Custom");i.Utility.applyMixin(e,n)}},e.prototype.getOnEventName=function(e){return"_"===e[0]?"_on"+e.substr(1):"on"+e},e.prototype.buildEvents=function(e,t){if(t.events)for(var n=0;n<t.events.length;n++){var r=t.events[n];Array.isArray(r)&&(this.ensureArraySize(r,7),t.events[n]={name:this.getString(r[0]),behaviorFlags:r[1],apiSetInfoOrdinal:r[2],typeExpression:this.getString(r[3]),targetIdExpression:this.getString(r[4]),register:this.getString(r[5]),unregister:this.getString(r[6])}),this.buildEvent(e,t,t.events[n])}},e.prototype.buildEvent=function(e,t,n){1&n.behaviorFlags?this.buildV0Event(e,t,n):this.buildV2Event(e,t,n)},e.prototype.buildV2Event=function(t,n,r){var o=this,s=this.getOnEventName(r.name),a=this.getFieldName(r);Object.defineProperty(t.prototype,s,{get:function(){if(!this[a]){o.throwIfApiNotSupported(n,r);var t=this,s=null;"null"!==r.register&&(s=this[r.register].bind(this));var c=null;"null"!==r.unregister&&(c=this[r.unregister].bind(this));var u=null;2&r.behaviorFlags&&(u=o.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_"+r.name+"_EventArgsTransform"));var l=o.evaluateEventType(r.typeExpression);this[a]=new i.GenericEventHandlers(this.context,this,r.name,{eventType:l,getTargetIdFunc:function(){return o.evaluateEventTargetId(r.targetIdExpression,t)},registerFunc:s,unregisterFunc:c,eventArgsTransformFunc:function(e){return u&&(e=u.call(t,t,e)),i.Utility._createPromiseFromResult(e)}})}return this[a]},enumerable:!0,configurable:!0})},e.prototype.buildV0Event=function(t,n,r){var o=this,s=this.getOnEventName(r.name),a=this.getFieldName(r);Object.defineProperty(t.prototype,s,{get:function(){if(!this[a]){o.throwIfApiNotSupported(n,r);var t=this,s=null;if(i.Utility.isNullOrEmptyString(r.register)){var c=o.evaluateEventType(r.typeExpression);s=function(e){var n=o.evaluateEventTargetId(r.targetIdExpression,t);return t.context.eventRegistration.register(c,n,e)}}else if("null"!==r.register){var u=o.getFunction(r.register);s=function(e){return u.call(t,t,e)}}var l=null;if(i.Utility.isNullOrEmptyString(r.unregister)){var d=o.evaluateEventType(r.typeExpression);l=function(e){var n=o.evaluateEventTargetId(r.targetIdExpression,t);return t.context.eventRegistration.unregister(d,n,e)}}else if("null"!==r.unregister){var p=o.getFunction(r.unregister);l=function(e){return p.call(t,t,e)}}var f=null;2&r.behaviorFlags&&(f=o.getFunction(e.CustomizationCodeNamespace+"."+n.name+"_"+r.name+"_EventArgsTransform"));this[a]=new i.EventHandlers(this.context,this,r.name,{registerFunc:s,unregisterFunc:l,eventArgsTransformFunc:function(e){return f&&(e=f.call(t,t,e)),i.Utility._createPromiseFromResult(e)}})}return this[a]},enumerable:!0,configurable:!0})},e.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},e.CustomizationCodeNamespace="_CC",e}();t.LibraryBuilder=a},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__createBinding||(Object.create?function(e,t,n,r){void 0===r&&(r=n);var o=Object.getOwnPropertyDescriptor(t,n);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,o)}:function(e,t,n,r){void 0===r&&(r=n),e[r]=t[n]}),s=this&&this.__exportStar||function(e,t){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(t,n)||i(t,e,n)};Object.defineProperty(t,"__esModule",{value:!0}),t.Utility=t.ResourceStrings=t.TrackedObjects=t.ObjectPathFactory=t.GenericEventHandlers=t._testTriggerRichApiMessageEvent=t._testSetRichApiMessageReadyImpl=t.GenericEventRegistration=t.EventRegistration=t._Internal=t.EventHandlerResult=t.EventHandlers=t.ClientRequest=t.Constants=t.ClientRequestContext=t.HostBridgeSession=t.ClientObject=t.ActionFactory=t.ErrorCodes=void 0;var a=n(1),c=n(2);s(n(2),t);var u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.propertyNotLoaded="PropertyNotLoaded",t.runMustReturnPromise="RunMustReturnPromise",t.cannotRegisterEvent="CannotRegisterEvent",t.invalidOrTimedOutSession="InvalidOrTimedOutSession",t.cannotUpdateReadOnlyProperty="CannotUpdateReadOnlyProperty",t}(a.CoreErrorCodes);t.ErrorCodes=u;var l=function(){function e(e){this.m_callback=e}return e.prototype._handleResult=function(e){this.m_callback&&this.m_callback()},e}(),d=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.createMethodAction=function(e,t,n,r,o,i){N.validateObjectPath(t);var s={Id:e._nextId(),ActionType:3,Name:n,ObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}},a=N.setMethodArguments(e,s.ArgumentInfo,o);N.validateReferencedObjectPaths(a);var u=new c.Action(s,r,N._fixupApiFlags(i));return u.referencedObjectPath=t._objectPath,u.referencedArgumentObjectPaths=a,t._addAction(u),u},t.createRecursiveQueryAction=function(e,t,n){N.validateObjectPath(t);var r={Id:e._nextId(),ActionType:6,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,RecursiveQueryInfo:n},o=new c.Action(r,1,4);return o.referencedObjectPath=t._objectPath,t._addAction(o),o},t.createEnsureUnchangedAction=function(e,t,n){N.validateObjectPath(t);var r={Id:e._nextId(),ActionType:8,Name:"",ObjectPathId:t._objectPath.objectPathInfo.Id,ObjectState:n},o=new c.Action(r,1,4);return o.referencedObjectPath=t._objectPath,t._addAction(o),o},t.createInstantiateAction=function(e,t){N.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},r=new c.Action(n,1,4);return r.referencedObjectPath=t._objectPath,t._addAction(r,new j(t),!0),r},t.createTraceAction=function(e,t,n){var r={Id:e._nextId(),ActionType:5,Name:"Trace",ObjectPathId:0},o=new c.Action(r,1,4);return e._pendingRequest.addAction(o),n&&e._pendingRequest.addTrace(r.Id,t),o},t.createTraceMarkerForCallback=function(e,n){var r=t.createTraceAction(e,null,!1);e._pendingRequest.addActionResultHandler(r,new l(n))},t}(c.CommonActionFactory);t.ActionFactory=d;var p=function(e){function t(t,n){var r=e.call(this,t,n)||this;return N.checkArgumentNull(t,"context"),r.m_context=t,r._objectPath&&(!t._processingResult&&t._pendingRequest&&(d.createInstantiateAction(t,r),t._autoCleanup&&r._KeepReference&&t.trackedObjects._autoAdd(r)),c._internalConfig.appendTypeNameToObjectPathInfo&&r._objectPath.objectPathInfo&&r._className&&(r._objectPath.objectPathInfo.T=r._className)),r}return o(t,e),Object.defineProperty(t.prototype,"context",{get:function(){return this.m_context},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isNull",{get:function(){return(void 0!==this.m_isNull||!a.TestUtility.isMock())&&(N.throwIfNotLoaded("isNull",this._isNull,null,this._isNull),this._isNull)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isNullObject",{get:function(){return(void 0!==this.m_isNull||!a.TestUtility.isMock())&&(N.throwIfNotLoaded("isNullObject",this._isNull,null,this._isNull),this._isNull)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_isNull",{get:function(){return this.m_isNull},set:function(e){this.m_isNull=e,e&&this._objectPath&&this._objectPath._updateAsNullObject()},enumerable:!1,configurable:!0}),t.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),a.CoreUtility._createPromiseFromResult(null)},t.prototype._handleResult=function(e){this._isNull=N.isNullOrUndefined(e),this.context.trackedObjects._autoTrackIfNecessaryWhenHandleObjectResultValue(this,e)},t.prototype._handleIdResult=function(e){this._isNull=N.isNullOrUndefined(e),N.fixObjectPathIfNecessary(this,e),this.context.trackedObjects._autoTrackIfNecessaryWhenHandleObjectResultValue(this,e)},t.prototype._handleRetrieveResult=function(e,t){this._handleIdResult(e)},t.prototype._recursivelySet=function(e,n,r,o,i){var s=e instanceof t,u=e;if(s){if(Object.getPrototypeOf(this)!==Object.getPrototypeOf(e))throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"properties",errorLocation:this._className+".set"});e=JSON.parse(JSON.stringify(e))}try{for(var l,d=0;d<r.length;d++)l=r[d],e.hasOwnProperty(l)&&void 0!==e[l]&&(this[l]=e[l]);for(d=0;d<o.length;d++)if(l=o[d],e.hasOwnProperty(l)&&void 0!==e[l]){var p=s?u[l]:e[l];this[l].set(p,n)}var f=!s;n&&!N.isNullOrUndefined(f)&&(f=n.throwOnReadOnly);for(d=0;d<i.length;d++)if(l=i[d],e.hasOwnProperty(l)&&void 0!==e[l]&&f)throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidArgument,httpStatusCode:400,message:a.CoreUtility._getResourceString(F.cannotApplyPropertyThroughSetMethod,l),debugInfo:{errorLocation:l}});for(l in e)if(r.indexOf(l)<0&&o.indexOf(l)<0){var h=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),l);if(!h)throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidArgument,httpStatusCode:400,message:a.CoreUtility._getResourceString(c.CommonResourceStrings.propertyDoesNotExist,l),debugInfo:{errorLocation:l}});if(f&&!h.set)throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidArgument,httpStatusCode:400,message:a.CoreUtility._getResourceString(c.CommonResourceStrings.attemptingToSetReadOnlyProperty,l),debugInfo:{errorLocation:l}})}}catch(e){throw new a._Internal.RuntimeError({code:a.CoreErrorCodes.invalidArgument,httpStatusCode:400,message:a.CoreUtility._getResourceString(a.CoreResourceStrings.invalidArgument,"properties"),debugInfo:{errorLocation:this._className+".set"},innerError:e})}},t}(c.ClientObjectBase);t.ClientObject=p;var f=function(){function e(e){this.m_session=e}return e.prototype.executeAsync=function(e,t,n){var r={url:a.CoreConstants.processQuery,method:"POST",headers:n.Headers,body:n.Body},o={id:a.HostBridge.nextId(),type:1,flags:t,message:r};return a.CoreUtility.log(JSON.stringify(o)),this.m_session.sendMessageToHost(o).then((function(e){a.CoreUtility.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:a.CoreUtility._parseResponseBody(n)};else{a.CoreUtility.log("Error Response:"+n.body);var r=a.CoreUtility._parseErrorResponse(n);t={HttpStatusCode:n.statusCode,ErrorCode:r.errorCode,ErrorMessage:r.errorMessage,Headers:n.headers,Body:null}}return t}))},e}(),h=function(e){function t(t){var n=e.call(this)||this;return n.m_bridge=t,n.m_bridge.addHostMessageHandler((function(e){3===e.type&&C.getGenericEventRegistration()._handleRichApiMessage(e.message)})),n}return o(t,e),t.getInstanceIfHostBridgeInited=function(){return a.HostBridge.instance?((a.CoreUtility.isNullOrUndefined(t.s_instance)||t.s_instance.m_bridge!==a.HostBridge.instance)&&(t.s_instance=new t(a.HostBridge.instance)),t.s_instance):null},t.prototype._resolveRequestUrlAndHeaderInfo=function(){return a.CoreUtility._createPromiseFromResult(null)},t.prototype._createRequestExecutorOrNull=function(){return a.CoreUtility.log("NativeBridgeSession::CreateRequestExecutor"),new f(this)},Object.defineProperty(t.prototype,"eventRegistration",{get:function(){return C.getGenericEventRegistration()},enumerable:!1,configurable:!0}),t.prototype.sendMessageToHost=function(e){return this.m_bridge.sendMessageToHostAndExpectResponse(e)},t}(a.SessionBase);t.HostBridgeSession=h;var m=function(e){function t(n){var r=e.call(this)||this;if(r.m_customRequestHeaders={},r.m_batchMode=0,r._onRunFinishedNotifiers=[],a.SessionBase._overrideSession)r.m_requestUrlAndHeaderInfoResolver=a.SessionBase._overrideSession;else if((N.isNullOrUndefined(n)||"string"==typeof n&&0===n.length)&&((n=t.defaultRequestUrlAndHeaders)||(n={url:a.CoreConstants.localDocument,headers:{}})),"string"==typeof n)r.m_requestUrlAndHeaderInfo={url:n,headers:{}};else if(t.isRequestUrlAndHeaderInfoResolver(n))r.m_requestUrlAndHeaderInfoResolver=n;else{if(!t.isRequestUrlAndHeaderInfo(n))throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"url"});var o=n;r.m_requestUrlAndHeaderInfo={url:o.url,headers:{}},a.CoreUtility._copyHeaders(o.headers,r.m_requestUrlAndHeaderInfo.headers)}return!r.m_requestUrlAndHeaderInfoResolver&&r.m_requestUrlAndHeaderInfo&&a.CoreUtility._isLocalDocumentUrl(r.m_requestUrlAndHeaderInfo.url)&&h.getInstanceIfHostBridgeInited()&&(r.m_requestUrlAndHeaderInfo=null,r.m_requestUrlAndHeaderInfoResolver=h.getInstanceIfHostBridgeInited()),r.m_requestUrlAndHeaderInfoResolver instanceof a.SessionBase&&(r.m_session=r.m_requestUrlAndHeaderInfoResolver),r._processingResult=!1,r._customData=y.iterativeExecutor,r.sync=r.sync.bind(r),r}return o(t,e),Object.defineProperty(t.prototype,"session",{get:function(){return this.m_session},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"eventRegistration",{get:function(){return this.m_session?this.m_session.eventRegistration:_.officeJsEventRegistration},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_url",{get:function(){return this.m_requestUrlAndHeaderInfo?this.m_requestUrlAndHeaderInfo.url:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_pendingRequest",{get:function(){return null==this.m_pendingRequest&&(this.m_pendingRequest=new v(this)),this.m_pendingRequest},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"debugInfo",{get:function(){return{pendingStatements:new S(this._rootObjectPropertyName,this._pendingRequest._objectPaths,this._pendingRequest._actions,c._internalConfig.showDisposeInfoInDebugInfo).process()}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"trackedObjects",{get:function(){return this.m_trackedObjects||(this.m_trackedObjects=new A(this)),this.m_trackedObjects},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"requestHeaders",{get:function(){return this.m_customRequestHeaders},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"batchMode",{get:function(){return this.m_batchMode},enumerable:!1,configurable:!0}),t.prototype.ensureInProgressBatchIfBatchMode=function(){if(1===this.m_batchMode&&!this.m_explicitBatchInProgress)throw N.createRuntimeError(a.CoreErrorCodes.generalException,a.CoreUtility._getResourceString(F.notInsideBatch),null)},t.prototype.load=function(e,n){N.validateContext(this,e);var r=t._parseQueryOption(n);c.CommonActionFactory.createQueryAction(this,e,r,e)},t.prototype.loadRecursive=function(e,n,r){if(!N.isPlainJsonObject(n))throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"options"});var o={};for(var i in n)o[i]=t._parseQueryOption(n[i]);var s=d.createRecursiveQueryAction(this,e,{Queries:o,MaxDepth:r});this._pendingRequest.addActionResultHandler(s,e)},t.prototype.trace=function(e){d.createTraceAction(this,e,!0)},t.prototype._processOfficeJsErrorResponse=function(e,t){},t.prototype.ensureRequestUrlAndHeaderInfo=function(){var e=this;return N._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:a.CoreConstants.localDocument,headers:{}}),N.isNullOrEmptyString(e.m_requestUrlAndHeaderInfo.url)&&(e.m_requestUrlAndHeaderInfo.url=a.CoreConstants.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)}}))}))},t.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)}))}))},t.prototype.syncPrivate=function(e){var t=this;if(a.TestUtility.isMock())return a.CoreUtility._createPromiseFromResult(null);if(!e.hasActions)return this.processPendingEventHandlers(e);var n=e.buildRequestMessageBodyAndRequestFlags(),r=n.body,o=n.flags;this._requestFlagModifier&&(o|=this._requestFlagModifier),this._requestExecutor||(a.CoreUtility._isLocalDocumentUrl(this.m_requestUrlAndHeaderInfo.url)?this._requestExecutor=new E(this):this._requestExecutor=new c.HttpRequestExecutor);var i=this._requestExecutor,s={};a.CoreUtility._copyHeaders(this.m_requestUrlAndHeaderInfo.headers,s),a.CoreUtility._copyHeaders(this.m_customRequestHeaders,s),delete this.m_customRequestHeaders[y.officeScriptEventId];var l={Url:this.m_requestUrlAndHeaderInfo.url,Headers:s,Body:r};e.invalidatePendingInvalidObjectPaths();var d=null,p=null;return this._lastSyncStart="undefined"==typeof performance?Date.now():performance.now(),this._lastRequestFlags=o,i.executeAsync(this._customData,o,l).then((function(n){return t._lastSyncEnd="undefined"==typeof performance?Date.now():performance.now(),c.config.executePerfLogFunc&&c.config.executePerfLogFunc({syncStart:t._lastSyncStart,syncEnd:t._lastSyncEnd}),d=t.processRequestExecutorResponseMessage(e,n),t.processPendingEventHandlers(e).catch((function(e){a.CoreUtility.log("Error in processPendingEventHandlers"),a.CoreUtility.log(JSON.stringify(e)),p=e}))})).then((function(){if(d)throw a.CoreUtility.log("Throw error from response: "+JSON.stringify(d)),d;if(p){a.CoreUtility.log("Throw error from ProcessEventHandler: "+JSON.stringify(p));var t=null;if(p instanceof a._Internal.RuntimeError)(t=p).traceMessages=e._responseTraceMessages;else{var n=null;n="string"==typeof p?p:p.message,N.isNullOrEmptyString(n)&&(n=a.CoreUtility._getResourceString(F.cannotRegisterEvent)),t=new a._Internal.RuntimeError({code:u.cannotRegisterEvent,httpStatusCode:400,message:n,traceMessages:e._responseTraceMessages})}throw t}}))},t.prototype.processRequestExecutorResponseMessage=function(e,t){t.Body&&t.Body.TraceIds&&e._setResponseTraceIds(t.Body.TraceIds);var n=e._responseTraceMessages,r=null;if(t.Body){if(t.Body.Error&&t.Body.Error.ActionIndex>=0){var o=new S(this._rootObjectPropertyName,e._objectPaths,e._actions,!1,!0),i=o.processForDebugStatementInfo(t.Body.Error.ActionIndex);r={statement:i.statement,surroundingStatements:i.surroundingStatements,fullStatements:["Please enable config.extendedErrorLogging to see full statements."]},c.config.extendedErrorLogging&&(o=new S(this._rootObjectPropertyName,e._objectPaths,e._actions,!1,!1),r.fullStatements=o.process())}var s=null;if(t.Body.Results?s=t.Body.Results:t.Body.ProcessedResults&&t.Body.ProcessedResults.Results&&(s=t.Body.ProcessedResults.Results),s){this._processingResult=!0;try{e.processResponse(s)}finally{this._processingResult=!1}}}if(!N.isNullOrEmptyString(t.ErrorCode))return new a._Internal.RuntimeError({code:t.ErrorCode,httpStatusCode:t.HttpStatusCode,message:t.ErrorMessage,traceMessages:n});if(t.Body&&t.Body.Error){var u={errorLocation:t.Body.Error.Location};return r&&(u.statement=r.statement,u.surroundingStatements=r.surroundingStatements,u.fullStatements=r.fullStatements),new a._Internal.RuntimeError({code:t.Body.Error.Code,httpStatusCode:t.Body.Error.HttpStatusCode,message:t.Body.Error.Message,traceMessages:n,debugInfo:u})}return null},t.prototype.processPendingEventHandlers=function(e){for(var t=N._createPromiseFromResult(null),n=0;n<e._pendingProcessEventHandlers.length;n++){var r=e._pendingProcessEventHandlers[n];t=t.then(this.createProcessOneEventHandlersFunc(r,e))}return t},t.prototype.createProcessOneEventHandlersFunc=function(e,t){return function(){return e._processRegistration(t)}},t.prototype.processPreSyncPromises=function(e){for(var t=N._createPromiseFromResult(null),n=0;n<e._preSyncPromises.length;n++){var r=e._preSyncPromises[n];t=t.then(this.createProcessOneProSyncFunc(r))}return t},t.prototype.createProcessOneProSyncFunc=function(e){return function(){return e}},t.prototype.sync=function(e){return a.TestUtility.isMock()?a.CoreUtility._createPromiseFromResult(e):this.syncPrivateMain().then((function(){return e}))},t.prototype.batch=function(e){var t=this;if(1!==this.m_batchMode)return a.CoreUtility._createPromiseFromException(N.createRuntimeError(a.CoreErrorCodes.generalException,null,null));if(this.m_explicitBatchInProgress)return a.CoreUtility._createPromiseFromException(N.createRuntimeError(a.CoreErrorCodes.generalException,a.CoreUtility._getResourceString(F.pendingBatchInProgress),null));if(N.isNullOrUndefined(e))return N._createPromiseFromResult(null);this.m_explicitBatchInProgress=!0;var n,r,o,i=this.m_pendingRequest;this.m_pendingRequest=new v(this);try{n=e(this._rootObject,this)}catch(e){return this.m_explicitBatchInProgress=!1,this.m_pendingRequest=i,a.CoreUtility._createPromiseFromException(e)}return"object"==typeof n&&n&&"function"==typeof n.then?o=N._createPromiseFromResult(null).then((function(){return n})).then((function(e){return t.m_explicitBatchInProgress=!1,r=t.m_pendingRequest,t.m_pendingRequest=i,e})).catch((function(e){return t.m_explicitBatchInProgress=!1,r=t.m_pendingRequest,t.m_pendingRequest=i,a.CoreUtility._createPromiseFromException(e)})):(this.m_explicitBatchInProgress=!1,r=this.m_pendingRequest,this.m_pendingRequest=i,o=N._createPromiseFromResult(n)),o.then((function(e){return t.ensureRequestUrlAndHeaderInfo().then((function(){return t.syncPrivate(r)})).then((function(){return e}))}))},t._run=function(e,n,r,o,i,s){return void 0===r&&(r=3),void 0===o&&(o=5e3),t._runCommon("run",null,e,0,n,r,o,null,i,s)},t.isValidRequestInfo=function(e){return"string"==typeof e||t.isRequestUrlAndHeaderInfo(e)||t.isRequestUrlAndHeaderInfoResolver(e)},t.isRequestUrlAndHeaderInfo=function(e){return"object"==typeof e&&null!==e&&Object.getPrototypeOf(e)===Object.getPrototypeOf({})&&!N.isNullOrUndefined(e.url)},t.isRequestUrlAndHeaderInfoResolver=function(e){return"object"==typeof e&&null!==e&&"function"==typeof e._resolveRequestUrlAndHeaderInfo},t._runBatch=function(e,n,r,o,i,s,a,c){return void 0===i&&(i=3),void 0===s&&(s=5e3),t._runBatchCommon(0,e,n,r,i,s,o,a,c)},t._runExplicitBatch=function(e,n,r,o,i,s,a,c){return void 0===i&&(i=3),void 0===s&&(s=5e3),t._runBatchCommon(1,e,n,r,i,s,o,a,c)},t._runBatchCommon=function(e,n,r,o,i,s,a,c,u){var l,d;void 0===i&&(i=3),void 0===s&&(s=5e3);var f=null,h=null,m=0,g=null;if(r.length>0)if(t.isValidRequestInfo(r[0]))f=r[0],m=1;else if(N.isPlainJsonObject(r[0])){if(null!=(f=(g=r[0]).session)&&!t.isValidRequestInfo(f))return t.createErrorPromise(n);h=g.previousObjects,m=1}if(r.length==m+1)d=r[m+0];else{if(null!=g||r.length!=m+2)return t.createErrorPromise(n);h=r[m+0],d=r[m+1]}if(null!=h)if(h instanceof p)l=function(){return h.context};else if(h instanceof t)l=function(){return h};else{if(!Array.isArray(h))return t.createErrorPromise(n);var y=h;if(0==y.length)return t.createErrorPromise(n);for(var v=0;v<y.length;v++){if(!(y[v]instanceof p))return t.createErrorPromise(n);if(y[v].context!=y[0].context)return t.createErrorPromise(n,F.invalidRequestContext)}l=function(){return y[0].context}}else l=o;var b=null;return a&&(b=function(e){return a(g||{},e)}),t._runCommon(n,f,l,e,d,i,s,b,c,u)},t.createErrorPromise=function(e,t){return void 0===t&&(t=a.CoreResourceStrings.invalidArgument),a.CoreUtility._createPromiseFromException(N.createRuntimeError(t,a.CoreUtility._getResourceString(t),e))},t._runCommon=function(e,n,r,o,i,s,c,u,l,d){a.SessionBase._overrideSession&&(n=a.SessionBase._overrideSession);var p,f,h,m=a.CoreUtility.createPromise((function(e,t){e()})),g=!1;return m.then((function(){if((p=r(n))._autoCleanup)return new Promise((function(e,t){p._onRunFinishedNotifiers.push((function(){p._autoCleanup=!0,e()}))}));p._autoCleanup=!0})).then((function(){return"function"!=typeof i?t.createErrorPromise(e):(h=p.m_batchMode,p.m_batchMode=o,u&&u(p),n=i(1==o?p.batch.bind(p):p),(N.isNullOrUndefined(n)||"function"!=typeof n.then)&&N.throwError(F.runMustReturnPromise),n);var n})).then((function(e){return 1===o?e:p.sync(e)})).then((function(e){g=!0,f=e})).catch((function(e){f=e})).then((function(){var e=p.trackedObjects._retrieveAndClearAutoCleanupList();for(var r in p._autoCleanup=!1,p.m_batchMode=h,e)e[r]._objectPath.isValid=!1;var o=0;if(N._synchronousCleanup||t.isRequestUrlAndHeaderInfoResolver(n))return i();function i(){o++;var t=p.m_pendingRequest,n=p.m_batchMode,r=new v(p);p.m_pendingRequest=r,p.m_batchMode=0;try{for(var a in e)p.trackedObjects.remove(e[a])}finally{p.m_batchMode=n,p.m_pendingRequest=t}return p.syncPrivate(r).then((function(){l&&l(o)})).catch((function(){d&&d(o),o<s&&setTimeout((function(){i()}),c)}))}i()})).then((function(){p._onRunFinishedNotifiers&&p._onRunFinishedNotifiers.length>0&&p._onRunFinishedNotifiers.shift()();if(g)return f;throw f}))},t}(c.ClientRequestContextBase);t.ClientRequestContext=m;var g=function(){function e(e,t){this.m_proxy=e,this.m_shouldPolyfill=t;var n=e[y.scalarPropertyNames],r=e[y.navigationPropertyNames],o=e[y.className],i=e[y.isCollection];if(n)for(var s=0;s<n.length;s++)N.definePropertyThrowUnloadedException(this,o,n[s]);if(r)for(s=0;s<r.length;s++)N.definePropertyThrowUnloadedException(this,o,r[s]);i&&N.definePropertyThrowUnloadedException(this,o,y.itemsLowerCase)}return Object.defineProperty(e.prototype,"$proxy",{get:function(){return this.m_proxy},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"$isNullObject",{get:function(){if(!this.m_isLoaded)throw new a._Internal.RuntimeError({code:u.valueNotLoaded,httpStatusCode:400,message:a.CoreUtility._getResourceString(F.valueNotLoaded),debugInfo:{errorLocation:"retrieveResult.$isNullObject"}});return this.m_isNullObject},enumerable:!1,configurable:!0}),e.prototype.toJSON=function(){if(this.m_isLoaded)return this.m_isNullObject?null:(N.isUndefined(this.m_json)&&(this.m_json=N.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=N.changePropertyNameToCamelLowerCase(e)),this.m_value=e,this.m_proxy._handleRetrieveResult(e,this)},e}(),y=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(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}(c.CommonConstants);t.Constants=y;var v=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 o(t,e),Object.defineProperty(t.prototype,"traceInfos",{get:function(){return this.m_traceInfos},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_responseTraceMessages",{get:function(){return this.m_responseTraceMessages},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_responseTraceIds",{get:function(){return this.m_responseTraceIds},enumerable:!1,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 r=this.m_traceInfos[n];a.CoreUtility.isNullOrUndefined(r)||this.m_responseTraceMessages.push(r)}},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:!1,configurable:!0}),t.prototype._getPendingEventHandlerActions=function(e){return this.m_pendingEventHandlerActions[e._id]},t}(c.ClientRequestBase);t.ClientRequest=v;var b=function(){function e(e,t,n,r){var o=this;this.m_id=e._nextId(),this.m_context=e,this.m_name=n,this.m_handlers=[],this.m_registered=!1,this.m_eventInfo=r,this.m_callback=function(e){o.m_eventInfo.eventArgsTransformFunc(e).then((function(e){return o.fireEvent(e)}))}}return Object.defineProperty(e.prototype,"_registered",{get:function(){return this.m_registered},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_id",{get:function(){return this.m_id},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_handlers",{get:function(){return this.m_handlers},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_context",{get:function(){return this.m_context},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"_callback",{get:function(){return this.m_callback},enumerable:!1,configurable:!0}),e.prototype.add=function(e){var t=d.createTraceAction(this.m_context,null,!1);return this.m_context._pendingRequest._addPendingEventHandlerAction(this,{id:t.actionInfo.Id,handler:e,operation:0}),new O(this.m_context,this,e)},e.prototype.remove=function(e){var t=d.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=d.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=a.CoreUtility._createPromiseFromResult(null),r=e._getPendingEventHandlerActions(this);if(!r)return n;for(var o=[],i=0;i<this.m_handlers.length;i++)o.push(this.m_handlers[i]);var s=!1;for(i=0;i<r.length;i++)if(e._responseTraceIds[r[i].id])switch(s=!0,r[i].operation){case 0:o.push(r[i].handler);break;case 1:for(var c=o.length-1;c>=0;c--)if(o[c]===r[i].handler){o.splice(c,1);break}break;case 2:o=[]}return s&&(!this.m_registered&&o.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==o.length&&(n=n.then((function(){return t.m_eventInfo.unregisterFunc(t.m_callback)})).catch((function(e){a.CoreUtility.log("Error when unregister event: "+JSON.stringify(e))})).then((function(){return t.m_registered=!1}))),n=n.then((function(){return t.m_handlers=o}))),n},e.prototype.fireEvent=function(e){for(var t=[],n=0;n<this.m_handlers.length;n++){var r=this.m_handlers[n],o=a.CoreUtility._createPromiseFromResult(null).then(this.createFireOneEventHandlerFunc(r,e)).catch((function(e){a.CoreUtility.log("Error when invoke handler: "+JSON.stringify(e))}));t.push(o)}a.CoreUtility.Promise.all(t)},e.prototype.createFireOneEventHandlerFunc=function(e,t){return function(){return e(t)}},e}();t.EventHandlers=b;var _,O=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:!1,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}();t.EventHandlerResult=O,function(e){var t=function(){function e(){}return e.prototype.register=function(e,t,n){switch(e){case 4:return N.promisify((function(e){return Office.context.document.bindings.getByIdAsync(t,e)})).then((function(e){return N.promisify((function(t){return e.addHandlerAsync(Office.EventType.BindingDataChanged,n,t)}))}));case 3:return N.promisify((function(e){return Office.context.document.bindings.getByIdAsync(t,e)})).then((function(e){return N.promisify((function(t){return e.addHandlerAsync(Office.EventType.BindingSelectionChanged,n,t)}))}));case 2:return N.promisify((function(e){return Office.context.document.addHandlerAsync(Office.EventType.DocumentSelectionChanged,n,e)}));case 1:return N.promisify((function(e){return Office.context.document.settings.addHandlerAsync(Office.EventType.SettingsChanged,n,e)}));case 5:return N.promisify((function(e){return OSF.DDA.RichApi.richApiMessageManager.addHandlerAsync("richApiMessage",n,e)}));case 13:return N.promisify((function(e){return Office.context.document.addHandlerAsync(Office.EventType.ObjectDeleted,n,{id:t},e)}));case 14:return N.promisify((function(e){return Office.context.document.addHandlerAsync(Office.EventType.ObjectSelectionChanged,n,{id:t},e)}));case 15:return N.promisify((function(e){return Office.context.document.addHandlerAsync(Office.EventType.ObjectDataChanged,n,{id:t},e)}));case 16:return N.promisify((function(e){return Office.context.document.addHandlerAsync(Office.EventType.ContentControlAdded,n,{id:t},e)}));default:throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"eventId"})}},e.prototype.unregister=function(e,t,n){switch(e){case 4:return N.promisify((function(e){return Office.context.document.bindings.getByIdAsync(t,e)})).then((function(e){return N.promisify((function(t){return e.removeHandlerAsync(Office.EventType.BindingDataChanged,{handler:n},t)}))}));case 3:return N.promisify((function(e){return Office.context.document.bindings.getByIdAsync(t,e)})).then((function(e){return N.promisify((function(t){return e.removeHandlerAsync(Office.EventType.BindingSelectionChanged,{handler:n},t)}))}));case 2:return N.promisify((function(e){return Office.context.document.removeHandlerAsync(Office.EventType.DocumentSelectionChanged,{handler:n},e)}));case 1:return N.promisify((function(e){return Office.context.document.settings.removeHandlerAsync(Office.EventType.SettingsChanged,{handler:n},e)}));case 5:return N.promisify((function(e){return OSF.DDA.RichApi.richApiMessageManager.removeHandlerAsync("richApiMessage",{handler:n},e)}));case 13:return N.promisify((function(e){return Office.context.document.removeHandlerAsync(Office.EventType.ObjectDeleted,{id:t,handler:n},e)}));case 14:return N.promisify((function(e){return Office.context.document.removeHandlerAsync(Office.EventType.ObjectSelectionChanged,{id:t,handler:n},e)}));case 15:return N.promisify((function(e){return Office.context.document.removeHandlerAsync(Office.EventType.ObjectDataChanged,{id:t,handler:n},e)}));case 16:return N.promisify((function(e){return Office.context.document.removeHandlerAsync(Office.EventType.ContentControlAdded,{id:t,handler:n},e)}));default:throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"eventId"})}},e}();e.officeJsEventRegistration=new t}(_=t._Internal||(t._Internal={}));var P=function(){function e(e,t){this.m_handlersByEventByTarget={},this.m_registerEventImpl=e,this.m_unregisterEventImpl=t}return e.getTargetIdOrDefault=function(e){return N.isNullOrUndefined(e)?"":e},e.prototype.getHandlers=function(t,n){n=e.getTargetIdOrDefault(n);var r=this.m_handlersByEventByTarget[t];r||(r={},this.m_handlersByEventByTarget[t]=r);var o=r[n];return o||(o=[],r[n]=o),o},e.prototype.callHandlers=function(e,t,n){for(var r=this.getHandlers(e,t),o=0;o<r.length;o++)r[o](n)},e.prototype.hasHandlers=function(e,t){return this.getHandlers(e,t).length>0},e.prototype.register=function(e,t,n){if(!n)throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"handler"});var r=this.getHandlers(e,t);return r.push(n),1===r.length?this.m_registerEventImpl(e,t):N._createPromiseFromResult(null)},e.prototype.unregister=function(e,t,n){if(!n)throw a._Internal.RuntimeError._createInvalidArgError({argumentName:"handler"});for(var r=this.getHandlers(e,t),o=r.length-1;o>=0;o--)if(r[o]===n){r.splice(o,1);break}return 0===r.length?this.m_unregisterEventImpl(e,t):N._createPromiseFromResult(null)},e}();t.EventRegistration=P;var C=function(){function e(){this.m_eventRegistration=new P(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})):a.HostBridge.instance?this.m_ready=N._createPromiseFromResult(null).then((function(){t.m_isReady=!0})):this.m_ready=_.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:!1,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 N._createPromiseFromResult(null)},e.prototype._unregisterEventImpl=function(e,t){return N._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==y.eventMessageCategory){a.CoreUtility._logEnabled&&a.CoreUtility.log(JSON.stringify(n));var r=n.messageType,o=n.targetId;if(this.m_eventRegistration.hasHandlers(r,o)){var i=JSON.parse(n.message);n.isRemoteOverride&&(i.source=y.eventSourceRemote),this.m_eventRegistration.callHandlers(r,o,i)}}}},e.getGenericEventRegistration=function(){return e.s_genericEventRegistration||(e.s_genericEventRegistration=new e),e.s_genericEventRegistration},e.richApiMessageEventCategory=65536,e}();t.GenericEventRegistration=C,t._testSetRichApiMessageReadyImpl=function(e){C._testReadyImpl=e},t._testTriggerRichApiMessageEvent=function(e){C.getGenericEventRegistration()._handleRichApiMessage(e)};var I=function(e){function t(t,n,r,o){var i=e.call(this,t,n,r,o)||this;return i.m_genericEventInfo=o,i}return o(t,e),t.prototype.add=function(e){var t=this;return 0==this._handlers.length&&this.m_genericEventInfo.registerFunc&&this.m_genericEventInfo.registerFunc(),C.getGenericEventRegistration().isReady||this._context._pendingRequest._addPreSyncPromise(C.getGenericEventRegistration().ready()),d.createTraceMarkerForCallback(this._context,(function(){t._handlers.push(e),1==t._handlers.length&&C.getGenericEventRegistration().register(t.m_genericEventInfo.eventType,t.m_genericEventInfo.getTargetIdFunc(),t._callback)})),new O(this._context,this,e)},t.prototype.remove=function(e){var t=this;1==this._handlers.length&&this.m_genericEventInfo.unregisterFunc&&this.m_genericEventInfo.unregisterFunc(),d.createTraceMarkerForCallback(this._context,(function(){for(var n=t._handlers,r=n.length-1;r>=0;r--)if(n[r]===e){n.splice(r,1);break}0==n.length&&C.getGenericEventRegistration().unregister(t.m_genericEventInfo.eventType,t.m_genericEventInfo.getTargetIdFunc(),t._callback)}))},t.prototype.removeAll=function(){},t}(b);t.GenericEventHandlers=I;var j=function(){function e(e){this.m_clientObject=e}return e.prototype._handleResult=function(e){this.m_clientObject._handleIdResult(e)},e}(),R=function(){function e(){}return e.createGlobalObjectObjectPath=function(e){var t={Id:e._nextId(),ObjectPathType:1,Name:""};return new c.ObjectPath(t,null,!1,!1,1,4)},e.createNewObjectObjectPath=function(e,t,n,r){var o={Id:e._nextId(),ObjectPathType:2,Name:t};return new c.ObjectPath(o,null,n,!1,1,N._fixupApiFlags(r))},e.createPropertyObjectPath=function(e,t,n,r,o,i){var s={Id:e._nextId(),ObjectPathType:4,Name:n,ParentObjectPathId:t._objectPath.objectPathInfo.Id};return new c.ObjectPath(s,t._objectPath,r,o,1,N._fixupApiFlags(i))},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 c.ObjectPath(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 c.ObjectPath(r,t,!1,!1,1,4)},e.createMethodObjectPath=function(e,t,n,r,o,i,s,a,u){var l={Id:e._nextId(),ObjectPathType:3,Name:n,ParentObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}},d=N.setMethodArguments(e,l.ArgumentInfo,o),p=new c.ObjectPath(l,t._objectPath,i,s,r,N._fixupApiFlags(u));return p.argumentObjectPaths=d,p.getByIdMethodName=a,p},e.createReferenceIdObjectPath=function(e,t){var n={Id:e._nextId(),ObjectPathType:6,Name:t,ArgumentInfo:{}};return new c.ObjectPath(n,null,!1,!1,1,4)},e.createChildItemObjectPathUsingIndexerOrGetItemAt=function(t,n,r,o,i){var s=N.tryGetObjectIdFromLoadOrRetrieveResult(o);return t&&!N.isNullOrUndefined(s)?e.createChildItemObjectPathUsingIndexer(n,r,o):e.createChildItemObjectPathUsingGetItemAt(n,r,o,i)},e.createChildItemObjectPathUsingIndexer=function(e,t,n){var r=N.tryGetObjectIdFromLoadOrRetrieveResult(n),o=o={Id:e._nextId(),ObjectPathType:5,Name:"",ParentObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}};return o.ArgumentInfo.Arguments=[r],new c.ObjectPath(o,t._objectPath,!1,!1,1,4)},e.createChildItemObjectPathUsingGetItemAt=function(e,t,n,r){var o=n[y.index];o&&(r=o);var i={Id:e._nextId(),ObjectPathType:3,Name:y.getItemAt,ParentObjectPathId:t._objectPath.objectPathInfo.Id,ArgumentInfo:{}};return i.ArgumentInfo.Arguments=[r],new c.ObjectPath(i,t._objectPath,!1,!1,1,4)},e}();t.ObjectPathFactory=R;var E=function(){function e(e){this.m_context=e}return e.prototype.executeAsync=function(t,n,r){var o=this,i=a.RichApiMessageUtility.buildMessageArrayForIRequestExecutor(t,n,r,e.SourceLibHeaderValue);return new Promise((function(e,t){OSF.DDA.RichApi.executeRichApiRequestAsync(i,(function(t){var n;a.CoreUtility.log("Response:"),a.CoreUtility.log(JSON.stringify(t)),"succeeded"==t.status?n=a.RichApiMessageUtility.buildResponseOnSuccess(a.RichApiMessageUtility.getResponseBody(t),a.RichApiMessageUtility.getResponseHeaders(t)):(n=a.RichApiMessageUtility.buildResponseOnError(t.error.code,t.error.message),o.m_context._processOfficeJsErrorResponse(t.error.code,n)),e(n)}))}))},e.SourceLibHeaderValue="officejs",e}(),A=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[y.isTracked]&&e!==this.m_context._rootObject&&t&&!N.isNullOrEmptyString(t[y.referenceId])&&(this._autoCleanupList[e._objectPath.objectPathInfo.Id]=e,e[y.isTracked]=!0)},e.prototype._addCommon=function(e,t){if(e[y.isTracked])t&&this.m_context._autoCleanup&&delete this._autoCleanupList[e._objectPath.objectPathInfo.Id];else{var n=e[y.referenceId];if(e._objectPath.objectPathInfo[y.objectPathInfoDoNotKeepReferenceFieldName])throw N.createRuntimeError(a.CoreErrorCodes.generalException,a.CoreUtility._getResourceString(F.objectIsUntracked),null);N.isNullOrEmptyString(n)&&e._KeepReference&&(e._KeepReference(),d.createInstantiateAction(this.m_context,e),t&&this.m_context._autoCleanup&&delete this._autoCleanupList[e._objectPath.objectPathInfo.Id],e[y.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[y.objectPathInfoDoNotKeepReferenceFieldName]=!0,e.context._pendingRequest._removeKeepReferenceAction(e._objectPath.objectPathInfo.Id);var t=e[y.referenceId];if(!N.isNullOrEmptyString(t)){var n=this.m_context._rootObject;n._RemoveReference&&n._RemoveReference(t)}delete e[y.isTracked]},e.prototype._retrieveAndClearAutoCleanupList=function(){var e=this._autoCleanupList;return this._autoCleanupList={},e},e}();t.TrackedObjects=A;var S=function(){function e(e,t,n,r,o){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=o}return e.prototype.process=function(){this.m_showDispose&&v._calculateLastUsedObjectPathIds(this.m_actions);for(var e=0;e<this.m_actions.length;e++)this.processOneAction(this.m_actions[e]);return this.m_statements},e.prototype.processForDebugStatementInfo=function(e){this.m_showDispose&&v._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 r=t-5;r<0&&(r=0);var o=t+1+5;o>this.m_statements.length&&(o=this.m_statements.length);var i=[];0!=r&&i.push("...");for(var s=r;s<t;s++)i.push(this.m_statements[s]);i.push("// >>>>>"),i.push(this.m_statements[t]),i.push("// <<<<<");for(var a=t+1;a<o;a++)i.push(this.m_statements[a]);return o<this.m_statements.length&&i.push("..."),{statement:this.m_statements[t],surroundingStatements:i}},e.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)}},e.prototype.processInstantiateAction=function(e){var t=e.actionInfo.ObjectPathId,n=this.m_referencedObjectPaths[t],r=this.getObjVarName(t);if(this.m_declaredObjectPathMap[t]){o="// Instantiate {"+r+"}";o=this.appendDisposeCommentIfRelevant(o,e),this.m_statements.push(o)}else{var o="var "+r+" = "+this.buildObjectPathExpressionWithParent(n)+";";o=this.appendDisposeCommentIfRelevant(o,e),this.m_statements.push(o),this.m_declaredObjectPathMap[t]=r}},e.prototype.processMethodAction=function(e){var t=e.actionInfo.Name;if("_KeepReference"===t){if(!c._internalConfig.showInternalApiInDebugInfo)return;t="track"}var n=this.getObjVarName(e.actionInfo.ObjectPathId)+"."+N._toCamelLowerCase(t)+"("+this.buildArgumentsExpression(e.actionInfo.ArgumentInfo)+");";n=this.appendDisposeCommentIfRelevant(n,e),this.m_statements.push(n)},e.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)},e.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)},e.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)},e.prototype.processSetPropertyAction=function(e){var t=this.getObjVarName(e.actionInfo.ObjectPathId)+"."+N._toCamelLowerCase(e.actionInfo.Name)+" = "+this.buildArgumentsExpression(e.actionInfo.ArgumentInfo)+";";t=this.appendDisposeCommentIfRelevant(t,e),this.m_statements.push(t)},e.prototype.processTraceAction=function(e){var t="context.trace();";t=this.appendDisposeCommentIfRelevant(t,e),this.m_statements.push(t)},e.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)},e.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)},e.prototype.appendDisposeCommentIfRelevant=function(e,t){var n=this;if(this.m_showDispose){var r=t.actionInfo.L;if(r&&r.length>0)return e+" // And then dispose {"+r.map((function(e){return n.getObjVarName(e)})).join(", ")+"}"}return e},e.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""},e.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)},e.prototype.buildObjectPathExpression=function(e){var t=this.buildObjectPathInfoExpression(e.objectPathInfo),n=e.originalObjectPathInfo;return n&&(t=t+" /* originally "+this.buildObjectPathInfoExpression(n)+" */"),t},e.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 N._toCamelLowerCase(e.Name)+"("+this.buildArgumentsExpression(e.ArgumentInfo)+")";case 2:return e.Name+".newObject()";case 7:return"null";case 4:return N._toCamelLowerCase(e.Name);case 6:return"context."+this.m_globalObjName+"._getObjectByReferenceId("+JSON.stringify(e.Name)+")"}},e.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},e.prototype.buildArgumentLiteral=function(e,t){return"number"==typeof e&&e===t?this.getObjVarName(t):JSON.stringify(e)},e.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=N._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=N._toCamelLowerCase(r);break;case 5:var o=this.getObjVarNameBase(n.objectPathInfo.ParentObjectPathId);t="s"===o.charAt(o.length-1)?o.substr(0,o.length-1):o+"Item"}return t},e.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},e}(),F=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(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}(c.CommonResourceStrings);t.ResourceStrings=F,a.CoreUtility.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 N=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),t.fixObjectPathIfNecessary=function(e,t){e&&e._objectPath&&t&&e._objectPath.updateUsingObjectData(t,e)},t.load=function(e,t){return e.context.load(e,t),e},t.loadAndSync=function(e,t){return e.context.load(e,t),e.context.sync().then((function(){return e}))},t.retrieve=function(e,n){var r=c._internalConfig.alwaysPolyfillClientObjectRetrieveMethod;r||(r=!t.isSetSupported("RichApiRuntime","1.1"));var o=new g(e,r);return e._retrieve(n,o),o},t.retrieveAndSync=function(e,n){var r=t.retrieve(e,n);return e.context.sync().then((function(){return r}))},t.toJson=function(e,n,r,o){var i={};for(var s in n){void 0!==(a=n[s])&&(i[s]=a)}for(var s in r){var a;void 0!==(a=r[s])&&(a[t.fieldName_isCollection]&&void 0!==a[t.fieldName_m__items]?i[s]=a.toJSON().items:i[s]=a.toJSON())}return o&&(i.items=o.map((function(e){return e.toJSON()}))),i},t.throwError=function(e,t,n){throw new a._Internal.RuntimeError({code:e,httpStatusCode:400,message:a.CoreUtility._getResourceString(e,t),debugInfo:n?{errorLocation:n}:void 0})},t.createRuntimeError=function(e,t,n,r,o){return new a._Internal.RuntimeError({code:e,httpStatusCode:r,message:t,debugInfo:{errorLocation:n},data:o})},t.throwIfNotLoaded=function(e,n,r,o){if(!o&&a.CoreUtility.isUndefined(n)&&e.charCodeAt(0)!=t.s_underscoreCharCode)throw t.createPropertyNotLoadedException(r,e)},t.createPropertyNotLoadedException=function(e,t){return new a._Internal.RuntimeError({code:u.propertyNotLoaded,httpStatusCode:400,message:a.CoreUtility._getResourceString(F.propertyNotLoaded,t),debugInfo:e?{errorLocation:e+"."+t}:void 0})},t.createCannotUpdateReadOnlyPropertyException=function(e,t){return new a._Internal.RuntimeError({code:u.cannotUpdateReadOnlyProperty,httpStatusCode:400,message:a.CoreUtility._getResourceString(F.cannotUpdateReadOnlyProperty,t),debugInfo:e?{errorLocation:e+"."+t}:void 0})},t.promisify=function(e){return new Promise((function(t,n){e((function(e){"failed"==e.status?n(e.error):t(e.value)}))}))},t._addActionResultHandler=function(e,t,n){e.context._pendingRequest.addActionResultHandler(t,n)},t._handleNavigationPropertyResults=function(e,t,n){for(var r=0;r<n.length-1;r+=2)a.CoreUtility.isUndefined(t[n[r+1]])||e[n[r]]._handleResult(t[n[r+1]])},t._fixupApiFlags=function(e){return"boolean"==typeof e&&(e=e?1:0),e},t.definePropertyThrowUnloadedException=function(e,n,r){Object.defineProperty(e,r,{configurable:!0,enumerable:!0,get:function(){throw t.createPropertyNotLoadedException(n,r)},set:function(){throw t.createCannotUpdateReadOnlyPropertyException(n,r)}})},t.defineReadOnlyPropertyWithValue=function(e,n,r){Object.defineProperty(e,n,{configurable:!0,enumerable:!0,get:function(){return r},set:function(){throw t.createCannotUpdateReadOnlyPropertyException(null,n)}})},t.processRetrieveResult=function(e,n,r,o){if(!a.CoreUtility.isNullOrUndefined(n))if(o){var i=n[y.itemsLowerCase];if(Array.isArray(i)){for(var s=[],c=0;c<i.length;c++){var u=o(i[c],c),l={};l[y.proxy]=u,u._handleRetrieveResult(i[c],l),s.push(l)}t.defineReadOnlyPropertyWithValue(r,y.itemsLowerCase,s)}}else{var d=e[y.scalarPropertyNames],p=e[y.navigationPropertyNames],f=e[y.className];if(d)for(c=0;c<d.length;c++){var h=n[m=d[c]];a.CoreUtility.isUndefined(h)?t.definePropertyThrowUnloadedException(r,f,m):t.defineReadOnlyPropertyWithValue(r,m,h)}if(p)for(c=0;c<p.length;c++){var m;h=n[m=p[c]];if(a.CoreUtility.isUndefined(h))t.definePropertyThrowUnloadedException(r,f,m);else{var g=e[m],v={};g._handleRetrieveResult(h,v),v[y.proxy]=g,Array.isArray(v[y.itemsLowerCase])&&(v=v[y.itemsLowerCase]),t.defineReadOnlyPropertyWithValue(r,m,v)}}}},t.setMockData=function(e,n,r,o){if(a.CoreUtility.isNullOrUndefined(n))e._handleResult(n);else{if(e[y.scalarPropertyOriginalNames]){for(var i={},s=e[y.scalarPropertyOriginalNames],c=e[y.scalarPropertyNames],u=0;u<c.length;u++)void 0!==n[c[u]]&&(i[s[u]]=n[c[u]]);e._handleResult(i)}if(e[y.navigationPropertyNames]){var l=e[y.navigationPropertyNames];for(u=0;u<l.length;u++)if(void 0!==n[l[u]]){var d=e[l[u]];d.setMockData&&d.setMockData(n[l[u]])}}if(e[y.isCollection]&&r){var p=Array.isArray(n)?n:n[y.itemsLowerCase];if(Array.isArray(p)){var f=[];for(u=0;u<p.length;u++){var h=r(p,u);t.setMockData(h,p[u]),f.push(h)}o(f)}}}},t.applyMixin=function(e,t){Object.getOwnPropertyNames(t.prototype).forEach((function(n){"constructor"!==n&&Object.defineProperty(e.prototype,n,Object.getOwnPropertyDescriptor(t.prototype,n))}))},t.fieldName_m__items="m__items",t.fieldName_isCollection="_isCollection",t._synchronousCleanup=!1,t.s_underscoreCharCode="_".charCodeAt(0),t}(c.CommonUtility);t.Utility=N},function(e,t,n){n(6),n(7),n(8),e.exports=n(9)},function(e,t,n){"use strict";(function(e){if(void 0!==e.__platformBundles){var t=e.__platformBundles.concat();Reflect.deleteProperty(e,"__platformBundles");for(var n=0;n<t.length;++n)console.log("PB start ".concat(n+1,"/").concat(t.length)),e.eval(t[n]),console.log("PB done  ".concat(n+1,"/").concat(t.length))}}).call(this,n(0))},function(e,t,n){(function(e){var t=0,n=function(e){throw e},r={setGlobalHandler:function(e){n=e},getGlobalHandler:function(){return n},reportError:function(e){n&&n(e)},reportFatalError:function(e){n&&n(e,!0)},applyWithGuard:function(e,n,o){try{return t++,e.apply(n,o)}catch(e){r.reportError(e)}finally{t--}return null},applyWithGuardIfNeeded:function(e,t,n){return r.inGuard()?e.apply(t,n):(r.applyWithGuard(e,t,n),null)},inGuard:function(){return t},guard:function(e,t,n){if("function"!=typeof e)return null;return t=t||e.name||"<generated guard>",function(){return r.applyWithGuard(e,n||this,arguments,null,t)}}};e.ErrorUtils=r}).call(this,n(0))},function(e,t){!function(){"use strict";var e=Object.prototype.hasOwnProperty;"function"!=typeof Object.entries&&(Object.entries=function(t){if(null==t)throw new TypeError("Object.entries called on non-object");var n=[];for(var r in t)e.call(t,r)&&n.push([r,t[r]]);return n}),"function"!=typeof Object.values&&(Object.values=function(t){if(null==t)throw new TypeError("Object.values called on non-object");var n=[];for(var r in t)e.call(t,r)&&n.push(t[r]);return n})}()},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0}),n(10),n(11),n(13),e.__apiSets={CustomFunctionsRuntime:"1.1"}}).call(this,n(0))},function(e,t,n){(function(e){e.CustomFunctionMappings={}}).call(this,n(0))},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(4),i=n(12),s=new(function(){function e(){}return e.prototype.sendMessageToHost=function(e){i.RekaInstance.InvokeNative("RichApiDataService","ProcessMessageToHost",e)},e}()),a=function(){function e(){}return e.prototype.Invoke=function(e,t){"ProcessMessageFromHost"===e&&s.onMessageFromHost&&s.onMessageFromHost(t)},e}();i.ReactNativeReka.init(),i.RekaInstance.RegisterService("RichApiDataService",(function(){return new a})),r.HostBridge.init(s),o.HostBridgeSession.getInstanceIfHostBridgeInited();var c=function(){function t(){}return t.prototype.Invoke=function(t,n){"LoadCustomFunctions"===t&&eval.apply(e,[n])},t}();i.RekaInstance.RegisterService("LoadCustomFunctionDataService",(function(){return new c}))}).call(this,n(0))},function(e,t){e.exports=OfficePlatformGlobal.ReactNativeReka},function(e,t,n){"use strict";(function(e){Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(14),i=n(3),s=n(15),a=n(16),c=n(18),u=(n(1),n(19)),l=n(20);e.OfficeExtensionBatch=i,e.OfficeRuntime=e.OfficeRuntime||{},e.OfficeRuntime.displayWebDialog=s.displayWebDialog,e.OfficeRuntime.storage=a.storage,e.OfficeRuntime.apiInformation=c.apiInformation,e.OfficeRuntime.message=l.Message.instance,e.OfficeExtension={Promise:Promise,Error:i.Error,ErrorCodes:i.ErrorCodes,FormattedNumber:i.FormattedNumber,Entity:i.Entity,WebImage:i.WebImage,Attribution:i.Attribution,Provider:i.Provider},e.CustomFunctions=e.CustomFunctions||{},r=new u.Association,e.CustomFunctions.associate=r.associate.bind(r),o.setCustomFunctionAssociation(r),e.CustomFunctions.setCustomFunctionInvoker=o.setCustomFunctionInvoker,e.CustomFunctions.Error=o.CustomFunctionError,e.CustomFunctions.ErrorCode=o.ErrorCode,e.CustomFunctions.FormattedNumber=o.CustomFunctionFormattedNumber,e.CustomFunctions.Entity=o.CustomFunctionEntity,e.CustomFunctions.WebImage=o.CustomFunctionWebImage,e.CustomFunctions.Attribution=o.CustomFunctionAttribution,e.CustomFunctions.Provider=o.CustomFunctionProvider}).call(this,n(0))},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CustomFunctionsContainer=t.CustomFunctions=t.setCustomFunctionInvoker=t.setCustomFunctionAssociation=t.customFunctionProxy=t.CustomFunctionProxy=t.CreateCustomFunctionInstance=t.CustomFunctionProvider=t.CustomFunctionAttribution=t.CustomFunctionWebImage=t.CustomFunctionFormattedNumber=t.CustomFunctionEntity=t.CustomFunctionError=t.ErrorCode=t.InvocationContext=t.Script=void 0;var i=n(3),s=n(1),a=i.BatchApiHelper.createPropertyObject,c=(i.BatchApiHelper.createMethodObject,i.BatchApiHelper.createIndexerObject,i.BatchApiHelper.createRootServiceObject),u=i.BatchApiHelper.createTopLevelServiceObject,l=(i.BatchApiHelper.createChildItemObject,i.BatchApiHelper.invokeMethod),d=(i.BatchApiHelper.invokeEnsureUnchanged,i.BatchApiHelper.invokeSetProperty,i.Utility.isNullOrUndefined),p=(i.Utility.isUndefined,i.Utility.throwIfNotLoaded,i.Utility.throwIfApiNotSupported),f=i.Utility.load,h=(i.Utility.retrieve,i.Utility.toJson),m=i.Utility.fixObjectPathIfNecessary,g=i.Utility._handleNavigationPropertyResults,y=(i.Utility.adjustToDateTime,i.Utility.processRetrieveResult),v=(i.Utility.setMockData,i.CommonUtility.calculateApiFlags,function(e){function t(t){var n=e.call(this,t)||this;return n.m_customFunctions=N.newObject(n),n.m_container=c(U,n),n._rootObject=n.m_container,n._rootObjectPropertyName="customFunctionsContainer",n._requestFlagModifier=2176,n}return o(t,e),Object.defineProperty(t.prototype,"customFunctions",{get:function(){return this.m_customFunctions},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"customFunctionsContainer",{get:function(){return this.m_container},enumerable:!1,configurable:!0}),t.prototype._processOfficeJsErrorResponse=function(e,t){5004===e&&(t.ErrorCode=x.invalidOperationInCellEditMode,t.ErrorMessage=i.Utility._getResourceString(i.ResourceStrings.invalidOperationInCellEditMode))},t}(i.ClientRequestContext));t.Script={_CustomFunctionMetadata:{}};var b,_=function(){function e(e,t,n,r,o){this._functionName=e,d(t)||(this._address=t),d(n)||(this._parameterAddresses=n),this.setResult=r,this.setError=o}return Object.defineProperty(e.prototype,"onCanceled",{get:function(){if(!d(this._onCanceled)&&"function"==typeof this._onCanceled)return this._onCanceled},set:function(e){this._onCanceled=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"functionName",{get:function(){return this._functionName},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"address",{get:function(){return this._address},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"parameterAddresses",{get:function(){return this._parameterAddresses},enumerable:!1,configurable:!0}),e}();t.InvocationContext=_,function(e){e.Info="Medium",e.Error="Unexpected",e.Verbose="Verbose"}(b||(b={}));var O,P=function(e,t){this.Severity=e,this.Message=t},C=function(){function e(){}return e.logEvent=function(t,n,r){if(e.s_shouldLog||i.CoreUtility._logEnabled){var o=t.Severity+" "+t.Message+n;if(r&&(o=o+" "+r),i.Utility.log(o),e.s_shouldLog)switch(t.Severity){case b.Verbose:case b.Info:case b.Error:}}},e.shouldLog=function(){try{return!d(console)&&!d(window)&&window.name&&"string"==typeof window.name&&JSON.parse(window.name)[e.CustomFunctionLoggingFlag]}catch(e){return i.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!"}(O=t.ErrorCode||(t.ErrorCode={}));var I=function(e){function t(n,r,o){var i=e.call(this,r||"")||this;return i.type=t.valueType,i.basicType=t.valueType,Object.setPrototypeOf(i,t.prototype),i.code=n||O.invalidValue,i.basicValue=n||O.invalidValue,i.errorSubType=o,i.stack=void 0,i}return o(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 O.invalidValue:return"Value";case O.divisionByZero:return"Div0";case O.notAvailable:return"NotAvailable";case O.invalidNumber:return"Num";case O.invalidName:return"Name";case O.invalidReference:return"Ref";case O.nullReference:return"Null";default:return}},t.prototype._getMessage=function(){switch(this.basicValue){case O.invalidValue:case O.notAvailable:return""==this.message?void 0:this.message;case O.divisionByZero:case O.invalidNumber:case O.invalidName:case O.invalidReference:case O.nullReference:default:return}},t.valueType="Error",t}(Error);t.CustomFunctionError=I;var j=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}();t.CustomFunctionEntity=j;var R=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}();t.CustomFunctionFormattedNumber=R;var E=function(){function e(t,n,r,o,i){this.type=e.valueType,this.basicValue="#VALUE!",this.basicType="Error",this.address=t,null!=o&&(this.attribution=o),null!=i&&(this.provider=i),null!=n&&(this.altText=n),null!=r&&(this.relatedImagesAddress=r)}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}();t.CustomFunctionWebImage=E;var A=function(){function e(e,t,n,r){null!=e&&(this.licenseAddress=e),null!=t&&(this.licenseText=t),null!=n&&(this.sourceAddress=n),null!=r&&(this.sourceText=r)}return e.prototype.toJSON=function(){return{licenseAddress:this.licenseAddress,licenseText:this.licenseText,sourceAddress:this.sourceAddress,sourceText:this.sourceText}},e}();t.CustomFunctionAttribution=A;var S=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}();t.CustomFunctionProvider=S,t.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 j.valueType:return new j(n.text,n.properties);case R.valueType:return new R(n.primitive,n.numberFormat);case I.valueType:return new I(n.primitive,void 0,n.errorSubCode);case E.valueType:return new E(n.address,n.altText,n.relatedImagesAddress,n.attribution,n.provider);case"Double":case"String":case"Boolean":return n.primitive;default:throw i.Utility.createRuntimeError(x.generalException,"message","CustomFunctionProxy.createRichDataFromJsonString")}};var F=function(){function e(){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 e.prototype._initSettings=function(){if("object"==typeof t.Script&&"object"==typeof t.Script._CustomFunctionSettings){if("number"==typeof t.Script._CustomFunctionSettings.setResultsDelayMillis){var e=t.Script._CustomFunctionSettings.setResultsDelayMillis;e=Math.max(0,e),e=Math.min(1e3,e),this._setResultsDelayMillis=e}if("number"==typeof t.Script._CustomFunctionSettings.ensureInitRetryDelayMillis){var n=t.Script._CustomFunctionSettings.ensureInitRetryDelayMillis;n=Math.max(0,n),n=Math.min(2e3,n),this._ensureInitRetryDelayMillis=n}if("number"==typeof t.Script._CustomFunctionSettings.setResultsLifeMillis){var r=t.Script._CustomFunctionSettings.setResultsLifeMillis;r=Math.max(0,r),r=Math.min(6e5,r),this._setResultsLifeMillis=r}if("number"==typeof t.Script._CustomFunctionSettings.batchQuotaMillis){var o=t.Script._CustomFunctionSettings.batchQuotaMillis;o=Math.max(0,o),o=Math.min(1e3,o),this._batchQuotaMillis=o}}},e.prototype.ensureInit=function(e){var t=this;return this._initSettings(),void 0===this._whenInit&&(this._whenInit=i.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},e.prototype.setCustomFunctionInvoker=function(e){"object"==typeof CustomFunctionMappings&&delete CustomFunctionMappings.__delay__,this._invoker=e},e.prototype.setCustomFunctionAssociation=function(e){var t=this;this._customFunctionMappingsUpperCase=void 0,this._association=e,this._association&&this._association.onchange((function(){t._customFunctionMappingsUpperCase=void 0}))},e.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=i.CoreUtility.Promise.resolve()},e.prototype._handleSettings=function(e){i.Utility.log("CustomFunctionProxy._handleSettings:"+JSON.stringify(e)),e&&"object"==typeof e&&(C.s_shouldLog=e[C.CustomFunctionLoggingFlag])},e.prototype._handleMessage=function(t){try{i.Utility.log("CustomFunctionProxy._handleMessage"),i.Utility.checkArgumentNull(t,"args");for(var n=t.entries,r=[],o=[],s=[],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?r.push(n[a]):1001===n[a].messageType?o.push(n[a]):1002===n[a].messageType?s.push(n[a]):i.Utility.log("CustomFunctionProxy._handleMessage unknown message type "+n[a].messageType));if(s.length>0&&this._handleMetadataEntries(s),r.length>0){var c=this._batchInvocationEntries(r);c.length>0&&this._invokeRemainingBatchEntries(c,0)}o.length>0&&this._handleCancellationEntries(o)}catch(t){throw e._tryLog(t),t}return i.Utility._createPromiseFromResult(null)},e.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},e._tryLog=function(t){var n=e.toLogMessage(t);i.Utility.log(n)},e.prototype._handleMetadataEntries=function(e){for(var n=0;n<e.length;n++){var r=e[n].message;if(d(r))throw i.Utility.createRuntimeError(x.generalException,"message","CustomFunctionProxy._handleMetadataEntries");t.Script._CustomFunctionMetadata[r.functionName]={options:{stream:r.isStream,cancelable:r.isCancelable}}}},e.prototype._handleCancellationEntries=function(t){for(var n=0;n<t.length;n++){var r=t[n].message;if(d(r))throw i.Utility.createRuntimeError(x.generalException,"message","CustomFunctionProxy._handleCancellationEntries");var o=r.invocationId,s=this._invocationContextMap[o];d(s)||(delete this._invocationContextMap[o],C.logEvent(e.CustomFunctionCancellation,s.functionName),d(s.onCanceled)||s.onCanceled())}},e.prototype._transferCustomFunctionError=function(e){var t=this;return e.map((function(e,n){return null===e?e:null!=e.code&&"CustomFunctionError"==e.type?new I(e.code):e instanceof Array?t._transferCustomFunctionError(e):e}))},e.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}))},e.prototype._batchInvocationEntries=function(n){for(var r=this,o=[],s=function(s){var c,u=n[s].message;if(Array.isArray(u)?(c={invocationId:u[0],functionName:u[1],parameterValues:u[2],address:u[3],flags:u[4],parameterAddresses:null},d(u[5])||(c.parameterAddresses=u[5])):c=u,d(c))throw i.Utility.createRuntimeError(x.generalException,"message","CustomFunctionProxy._batchInvocationEntries");if(d(c.invocationId)||c.invocationId<0)throw i.Utility.createRuntimeError(x.generalException,"invocationId","CustomFunctionProxy._batchInvocationEntries");if(d(c.functionName))throw i.Utility.createRuntimeError(x.generalException,"functionName","CustomFunctionProxy._batchInvocationEntries");var l=null,p=!1,f=!1,h=!1;if("number"==typeof c.flags)p=0!=(1&c.flags),f=0!=(2&c.flags),h=0!=(4&c.flags),0!=(8&c.flags)&&(c.parameterValues=a._transferCustomFunctionRichData(c.parameterValues)),h&&(c.parameterValues=a._transferCustomFunctionError(c.parameterValues));else{var m=t.Script._CustomFunctionMetadata[c.functionName];if(d(m))return C.logEvent(e.CustomFunctionExecutionNotFoundLog,c.functionName),i.Utility.isSetSupported("CustomFunctions","1.8")?a._setError(c.invocationId,null,9):a._setError(c.invocationId,"N/A",1),"continue";p=m.options.cancelable,f=m.options.stream}if(a._invoker&&!a._customFunctionMappingsContains(c.functionName))return a._invokeFunctionUsingInvoker(c),"continue";try{l=a._getFunction(c.functionName)}catch(t){return C.logEvent(e.CustomFunctionExecutionNotFoundLog,c.functionName),i.Utility.isSetSupported("CustomFunctions","1.8")?a._setError(c.invocationId,t,10):a._setError(c.invocationId,t,1),"continue"}var g=void 0;if(f||p){var y=void 0,v=void 0;f&&(y=function(t){r._invocationContextMap[c.invocationId]?r._setResult(c.invocationId,t):C.logEvent(e.CustomFunctionAlreadyCancelled,c.functionName)},v=function(t){r._invocationContextMap[c.invocationId]?r._setError(c.invocationId,t.message,r._getCustomFunctionResultErrorCodeFromErrorCode(t.code)):C.logEvent(e.CustomFunctionAlreadyCancelled,c.functionName)}),g=new _(c.functionName,c.address,c.parameterAddresses,y,v),a._invocationContextMap[c.invocationId]=g}else g=new _(c.functionName,c.address,c.parameterAddresses);c.parameterValues.push(g),o.push({call:l,isBatching:!1,isStreaming:f,invocationIds:[c.invocationId],parameterValueSets:[c.parameterValues],functionName:c.functionName})},a=this,c=0;c<n.length;c++)s(c);return o},e.prototype._invokeFunctionUsingInvoker=function(e){var t=this,n=0!=(1&e.flags),r=0!=(2&e.flags),o=e.invocationId,i=void 0,s=void 0;if(r)i=function(e){t._invocationContextMap[o]&&t._setResult(o,e)},s=function(e){t._invocationContextMap[o]&&t._setError(o,e.message,t._getCustomFunctionResultErrorCodeFromErrorCode(e.code))};else{var a=!1;i=function(e){a||t._setResult(o,e),a=!0},s=function(e){a||t._setError(o,e.message,t._getCustomFunctionResultErrorCodeFromErrorCode(e.code)),a=!0}}var c=new _(e.functionName,e.address,e.parameterAddresses,i,s);(r||n)&&(this._invocationContextMap[o]=c),this._invoker.invoke(e.functionName,e.parameterValues,c)},e.prototype._ensureCustomFunctionMappingsUpperCase=function(){if(d(this._customFunctionMappingsUpperCase)){if(this._customFunctionMappingsUpperCase={},"object"==typeof CustomFunctionMappings)for(var t in i.CoreUtility.log("CustomFunctionMappings.Keys="+JSON.stringify(Object.keys(CustomFunctionMappings))),CustomFunctionMappings)this._customFunctionMappingsUpperCase[t.toUpperCase()]&&C.logEvent(e.CustomFunctionDuplicatedName,t),this._customFunctionMappingsUpperCase[t.toUpperCase()]=CustomFunctionMappings[t];if(this._association)for(var t in i.CoreUtility.log("CustomFunctionAssociateMappings.Keys="+JSON.stringify(Object.keys(this._association.mappings))),this._association.mappings)this._customFunctionMappingsUpperCase[t.toUpperCase()]&&C.logEvent(e.CustomFunctionDuplicatedName,t),this._customFunctionMappingsUpperCase[t.toUpperCase()]=this._association.mappings[t]}},e.prototype._customFunctionMappingsContains=function(e){this._ensureCustomFunctionMappingsUpperCase();var t=e.toUpperCase();if(!d(this._customFunctionMappingsUpperCase[t]))return!0;if("undefined"!=typeof window){for(var n=window,r=e.split("."),o=0;o<r.length-1;o++)if(n=n[r[o]],d(n)||"object"!=typeof n)return!1;if("function"==typeof n[r[r.length-1]])return!0}return!1},e.prototype._getCustomFunctionMappings=function(e){this._ensureCustomFunctionMappingsUpperCase();var t=e.toUpperCase();if(!d(this._customFunctionMappingsUpperCase[t])){if("function"==typeof this._customFunctionMappingsUpperCase[t])return this._customFunctionMappingsUpperCase[t];throw i.Utility.createRuntimeError(x.invalidOperation,i.Utility._getResourceString(i.ResourceStrings.customFunctionInvalidFunctionMapping,e),"CustomFunctionProxy._getCustomFunctionMappings")}},e.prototype._getFunction=function(e){return this._getCustomFunctionMappings(e)},e.prototype._invokeRemainingBatchEntries=function(e,t){i.Utility.log("CustomFunctionProxy._invokeRemainingBatchEntries");for(var n=Date.now(),r=t;r<e.length;r++){if(!(Date.now()-n<this._batchQuotaMillis)){i.Utility.log("setTimeout(CustomFunctionProxy._invokeRemainingBatchEntries)"),setTimeout(this._invokeRemainingBatchEntries.bind(this),0,e,r);break}this._invokeFunctionAndSetResult(e[r])}},e.prototype._invokeFunctionAndSetResult=function(t){var n,r=this;C.logEvent(e.CustomFunctionExecutionStartLog,t.functionName);var o=Date.now();try{n=t.isBatching?t.call.call(null,t.parameterValueSets):[t.call.apply(null,t.parameterValueSets[0])]}catch(n){var s=[];s.push(Date.now()-o);for(var a=0;a<t.invocationIds.length;a++)n instanceof I?this._setErrorWithOutboundData(t.invocationIds[a],n.message,this._getCustomFunctionResultErrorCodeFromErrorCode(n.code),s):this._setErrorWithOutboundData(t.invocationIds[a],n,2,s);return void C.logEvent(e.CustomFunctionExecutionExceptionThrownLog,t.functionName,e.toLogMessage(n))}var c=[];if(N.isFeatureEnabled(3)||c.push(Date.now()-o),t.isStreaming);else if(n.length===t.parameterValueSets.length){var u=function(i){d(n[i])||"object"!=typeof n[i]||"function"!=typeof n[i].then?(N.isFeatureEnabled(3)&&c.push(Date.now()-o),C.logEvent(e.CustomFunctionExecutionFinishLog,t.functionName),l._setResultWithOutboundData(t.invocationIds[i],n[i],c)):n[i].then((function(n){N.isFeatureEnabled(3)&&c.push(Date.now()-o),C.logEvent(e.CustomFunctionExecutionFinishLog,t.functionName),r._setResultWithOutboundData(t.invocationIds[i],n,c)}),(function(n){N.isFeatureEnabled(3)&&c.push(Date.now()-o),C.logEvent(e.CustomFunctionExecutionRejectedPromoseLog,t.functionName,e.toLogMessage(n)),n instanceof I?r._setErrorWithOutboundData(t.invocationIds[i],n,r._getCustomFunctionResultErrorCodeFromErrorCode(n.code),c):r._setErrorWithOutboundData(t.invocationIds[i],n,3,c)}))},l=this;for(a=0;a<n.length;a++)u(a)}else{N.isFeatureEnabled(3)&&c.push(Date.now()-o),C.logEvent(e.CustomFunctionExecutionBatchMismatchLog,t.functionName);for(a=0;a<t.invocationIds.length;a++)this._setErrorWithOutboundData(t.invocationIds[a],i.Utility._getResourceString(i.ResourceStrings.customFunctionUnexpectedNumberOfEntriesInResultBatch),4,c)}},e.prototype._setResult=function(e,t){var n=[];n.push(0),this._setResultWithOutboundData(e,t,n)},e.prototype._setResultWithOutboundData=function(t,n,r){var o={id:t,value:n,outboundData:r};"number"==typeof n?isNaN(n)?(o.failed=!0,o.value="NaN"):isFinite(n)||(o.failed=!0,o.value="Infinity",o.errorCode=6):n instanceof I||n instanceof j||n instanceof R||n instanceof E?(o.failed=!1,o.value=n.toJSON()):n instanceof Error&&(o.failed=!0,o.value=e.toLogMessage(n),o.errorCode=0);var i=Date.now();this._resultEntryBuffer[t]={timeCreated:i,result:o},this._ensureSetResultsTaskIsScheduled(i)},e.prototype._setError=function(e,t,n){var r=[];r.push(0),this._setErrorWithOutboundData(e,t,n,r)},e.prototype._setErrorWithOutboundData=function(e,t,n,r){var o="";d(t)||(t instanceof I&&!d(t.message)?o=t.message:"string"==typeof t&&(o=t));var i={id:e,failed:!0,value:o,errorCode:n,outboundData:r},s=Date.now();this._resultEntryBuffer[e]={timeCreated:s,result:i},this._ensureSetResultsTaskIsScheduled(s)},e.prototype._getCustomFunctionResultErrorCodeFromErrorCode=function(e){var t;switch(e){case O.notAvailable:t=1;break;case O.divisionByZero:t=5;break;case O.invalidValue:t=7;break;case O.invalidNumber:t=6;break;case O.nullReference:t=8;break;default:t=7}return t},e.prototype._ensureSetResultsTaskIsScheduled=function(e){if(this._setResultsTaskOverdueTime>0&&e>this._setResultsTaskOverdueTime)return i.Utility.log("SetResultsTask overdue"),void this._executeSetResultsTask();this._isSetResultsTaskScheduled||(i.Utility.log("setTimeout(CustomFunctionProxy._executeSetResultsTask)"),setTimeout(this._executeSetResultsTask.bind(this),this._setResultsDelayMillis),this._isSetResultsTaskScheduled=!0,this._setResultsTaskOverdueTime=e+this._setResultsDelayMillis+this._setResultsOverdueDelayMillis)},e.prototype._convertCustomFunctionInvocationResultToArray=function(e){var t=[];return t.push(e.id),t.push(!e.failed),i.CoreUtility.isUndefined(e.value)?t.push(null):t.push(e.value),e.failed&&(i.CoreUtility.isUndefined(e.errorCode)?t.push(0):t.push(e.errorCode)),i.Utility.isSetSupported("CustomFunctions","1.9")&&t.push(e.outboundData),t},e.prototype._executeSetResultsTask=function(){var e=this;i.Utility.log("CustomFunctionProxy._executeSetResultsTask");var t=Date.now();if(this._inProgressContextSyncExpectedFinishTime>0&&this._inProgressContextSyncExpectedFinishTime>t)return i.Utility.log("context.sync() is in progress. setTimeout(CustomFunctionProxy._executeSetResultsTask)"),setTimeout(this._executeSetResultsTask.bind(this),this._setResultsDelayMillis),void(this._setResultsTaskOverdueTime=t+this._setResultsDelayMillis+this._setResultsOverdueDelayMillis);this._isSetResultsTaskScheduled=!1,this._setResultsTaskOverdueTime=0;var n={},r=!1;N.isFeatureEnabled(1)&&Object.keys(this._resultEntryRetryBuffer).length>0?(n=this._resultEntryRetryBuffer,this._resultEntryRetryBuffer={},this._retryBufferBodySize=2,r=!0):(n=this._resultEntryBuffer,this._resultEntryBuffer={});var o=i.Utility.isSetSupported("CustomFunctions","1.7"),s=[];for(var a in n)o?s.push(this._convertCustomFunctionInvocationResultToArray(n[a].result)):s.push(n[a].result);if(0!==s.length){var c=new v;o?c.customFunctions.setInvocationArrayResults(s):c.customFunctions.setInvocationResults(s);var u=Date.now();this._inProgressContextSyncExpectedFinishTime=u+this._maxContextSyncExecutionDurationMills,c.sync().then((function(t){var n=Date.now();e._clearInProgressContextSyncExpectedFinishTimeAfterMinInterval(n-u),r&&e._ensureSetResultsTaskIsScheduled(n)}),(function(t){var r=Date.now();e._clearInProgressContextSyncExpectedFinishTimeAfterMinInterval(r-u),N.isFeatureEnabled(1)&&t.code==i.ErrorCodes.requestPayloadSizeLimitExceeded?e._restoreAndSliceResultEntries(r,n):e._restoreResultEntries(r,n),e._ensureSetResultsTaskIsScheduled(r)}))}},e.prototype._restoreResultEntries=function(e,t){for(var n in t){var r=t[n];e-r.timeCreated<=this._setResultsLifeMillis&&(this._resultEntryBuffer[n]||(this._resultEntryBuffer[n]=r))}},e.prototype._restoreAndSliceResultEntries=function(e,t){for(var n in t){var r=t[n],o=void 0;if(e-r.timeCreated<=this._setResultsLifeMillis&&!this._resultEntryBuffer[n]){try{o=JSON.stringify(this._convertCustomFunctionInvocationResultToArray(r.result)).length+1}catch(e){this._resultEntryBuffer[n]=r,i.Utility.log("Result can't pass in JSON.stringify");continue}this._retryBufferBodySize+o<this._maxResultSize?(this._resultEntryRetryBuffer[n]=r,this._retryBufferBodySize+=o):this._resultEntryBuffer[n]=r}}},e.prototype._clearInProgressContextSyncExpectedFinishTimeAfterMinInterval=function(e){var t=this,n=N.isFeatureEnabled(2)?this._smallerMinContextSyncIntervalMills:this._minContextSyncIntervalMills,r=Math.max(n,2*e),o=N.isFeatureEnabled(4)?Math.min(this._maxContextSyncIntervalMills,r):r;i.Utility.log("setTimeout(clearInProgressContestSyncExpectedFinishedTime,"+r+")"),setTimeout((function(){i.Utility.log("clearInProgressContestSyncExpectedFinishedTime"),t._inProgressContextSyncExpectedFinishTime=0}),o)},e.CustomFunctionExecutionStartLog=new P(b.Verbose,"CustomFunctions [Execution] [Begin] Function="),e.CustomFunctionExecutionFailureLog=new P(b.Error,"CustomFunctions [Execution] [End] [Failure] Function="),e.CustomFunctionExecutionRejectedPromoseLog=new P(b.Error,"CustomFunctions [Execution] [End] [Failure] [RejectedPromise] Function="),e.CustomFunctionExecutionExceptionThrownLog=new P(b.Error,"CustomFunctions [Execution] [End] [Failure] [ExceptionThrown] Function="),e.CustomFunctionExecutionBatchMismatchLog=new P(b.Error,"CustomFunctions [Execution] [End] [Failure] [BatchMismatch] Function="),e.CustomFunctionExecutionFinishLog=new P(b.Info,"CustomFunctions [Execution] [End] [Success] Function="),e.CustomFunctionExecutionNotFoundLog=new P(b.Error,"CustomFunctions [Execution] [NotFound] Function="),e.CustomFunctionCancellation=new P(b.Info,"CustomFunctions [Cancellation] Function="),e.CustomFunctionAlreadyCancelled=new P(b.Info,"CustomFunctions [AlreadyCancelled] Function="),e.CustomFunctionDuplicatedName=new P(b.Error,"CustomFunctions [DuplicatedName] Function="),e.CustomFunctionInvalidArg=new P(b.Error,"CustomFunctions [InvalidArg] Name="),e}();t.CustomFunctionProxy=F,t.customFunctionProxy=new F,t.setCustomFunctionAssociation=t.customFunctionProxy.setCustomFunctionAssociation.bind(t.customFunctionProxy),t.setCustomFunctionInvoker=t.customFunctionProxy.setCustomFunctionInvoker.bind(t.customFunctionProxy),s.HostBridge.onInited((function(e){t.customFunctionProxy._initFromHostBridge(e)}));var N=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return o(n,e),Object.defineProperty(n.prototype,"_className",{get:function(){return"CustomFunctions"},enumerable:!1,configurable:!0}),n.isFeatureEnabled=function(e){return this._enabledFeature instanceof Array&&this._enabledFeature.indexOf(e)>=0},n.initialize=function(){var e=this,r=new v;return t.customFunctionProxy.ensureInit(r).then((function(){var o;return r.customFunctions._SetOsfControlContainerReadyForCustomFunctions(),i.Utility.isSetSupported("CustomFunctions","1.9")&&(o=r.customFunctions._GetEnabledFeatures()),i.Utility.log("OsfControl activation lifecycle: Set OsfControlContainer ready for CustomFunctions"),r._customData="SetOsfControlContainerReadyForCustomFunctions",r.sync().then((function(){d(o)||(e._enabledFeature=o.value)})).catch((function(e){!function(e,r){var o=e instanceof i.Error&&e.code===x.invalidOperationInCellEditMode;if(i.CoreUtility.log("Error on starting custom functions: "+e),o){i.CoreUtility.log("Was in cell-edit mode, will try again");var s=t.customFunctionProxy._ensureInitRetryDelayMillis;return new i.CoreUtility.Promise((function(e){return setTimeout(e,s)})).then((function(){return n.initialize()}))}if(r)throw e}(e,!0)}))}))},n.prototype.setInvocationArrayResults=function(e){p("CustomFunctions.setInvocationArrayResults","CustomFunctions","1.4","Excel"),l(this,"SetInvocationArrayResults",0,[e],2,0)},n.prototype.setInvocationResults=function(e){l(this,"SetInvocationResults",0,[e],2,0)},n.prototype._GetEnabledFeatures=function(){return p("CustomFunctions._GetEnabledFeatures","CustomFunctions","1.4","Excel"),l(this,"_GetEnabledFeatures",1,[],4,0)},n.prototype._SetInvocationError=function(e,t){l(this,"_SetInvocationError",0,[e,t],2,0)},n.prototype._SetInvocationResult=function(e,t){l(this,"_SetInvocationResult",0,[e,t],2,0)},n.prototype._SetOsfControlContainerReadyForCustomFunctions=function(){l(this,"_SetOsfControlContainerReadyForCustomFunctions",0,[],10,0)},n.prototype._handleResult=function(t){(e.prototype._handleResult.call(this,t),d(t))||m(this,t)},n.prototype._handleRetrieveResult=function(t,n){e.prototype._handleRetrieveResult.call(this,t,n),y(this,t,n)},n.newObject=function(e){return u(n,e,"Microsoft.ExcelServices.CustomFunctions",!1,4)},n.prototype.toJSON=function(){return h(this,{},{})},n}(i.ClientObject);t.CustomFunctions=N;var x,U=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),Object.defineProperty(t.prototype,"_className",{get:function(){return"CustomFunctionsContainer"},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_navigationPropertyNames",{get:function(){return["customFunctions"]},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"customFunctions",{get:function(){return p("CustomFunctionsContainer.customFunctions","CustomFunctions","1.2","Excel"),this._C||(this._C=a(N,this,"CustomFunctions",!1,4)),this._C},enumerable:!1,configurable:!0}),t.prototype._handleResult=function(t){if(e.prototype._handleResult.call(this,t),!d(t)){var n=t;m(this,n),g(this,n,["customFunctions","CustomFunctions"])}},t.prototype.load=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,{},{})},t}(i.ClientObject);t.CustomFunctionsContainer=U,function(e){e.generalException="GeneralException",e.invalidOperation="InvalidOperation",e.invalidOperationInCellEditMode="InvalidOperationInCellEditMode"}(x||(x={}))},function(e,t,n){"use strict";var r,o=this&&this.__extends||(r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)},function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.DialogErrorCodes=t.DialogService=t.displayWebDialog=t.Dialog=void 0;var i=n(3),s=(i.BatchApiHelper.createPropertyObject,i.BatchApiHelper.createMethodObject,i.BatchApiHelper.createIndexerObject,i.BatchApiHelper.createRootServiceObject,i.BatchApiHelper.createTopLevelServiceObject),a=(i.BatchApiHelper.createChildItemObject,i.BatchApiHelper.invokeMethod),c=(i.BatchApiHelper.invokeEnsureUnchanged,i.BatchApiHelper.invokeSetProperty,i.Utility.isNullOrUndefined),u=(i.Utility.isUndefined,i.Utility.throwIfNotLoaded,i.Utility.throwIfApiNotSupported,i.Utility.load,i.Utility.retrieve,i.Utility.toJson),l=i.Utility.fixObjectPathIfNecessary,d=(i.Utility._handleNavigationPropertyResults,i.Utility.adjustToDateTime,i.Utility.processRetrieveResult),p=(i.Utility.setMockData,i.CommonUtility.calculateApiFlags,function(){function e(e){this._dialogService=e}return e.prototype.close=function(){return this._dialogService.close(),this._dialogService.context.sync()},e}());t.Dialog=p,t.displayWebDialog=function(e,t){return void 0===t&&(t={}),new i.CoreUtility.Promise((function(r,o){if(t.width&&t.height&&(!n(t.width)||!n(t.height)))throw new i.Error({code:"InvalidArgument",message:'Dimensions must be "number%" or number.'});var s=new i.ClientRequestContext,a=h.newObject(s),c=new p(a),u=a.onDialogMessage.add((function(e){switch(i.Utility.log("dialogMessageHandler:"+JSON.stringify(e)),e.type){case 17:e.error?o(e.error):r(c);break;case 12:t.onMessage&&t.onMessage(e.message,c,e.origin);break;case 10:default:12006===e.originalErrorCode?(u&&(u.remove(),s.sync()),t.onClose&&t.onClose()):t.onRuntimeError&&(t.onRuntimeError(e.error,c),o(e.error))}return i.CoreUtility.Promise.resolve()}));return s.sync().then((function(){var n={width:t.width?parseInt(t.width):50,height:t.height?parseInt(t.height):50,displayInIFrame:t.displayInIFrame};return a.displayDialog(e,n),s.sync()})).catch((function(e){o(e)}))}));function n(e){return/^(\-|\+)?([0-9]+)%?$/.test(e)}};var f,h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return o(t,e),Object.defineProperty(t.prototype,"_className",{get:function(){return"DialogService"},enumerable:!1,configurable:!0}),t.prototype.close=function(){a(this,"Close",1,[],4,0)},t.prototype.displayDialog=function(e,t){a(this,"DisplayDialog",1,[e,t],4,0)},t.prototype._handleResult=function(t){(e.prototype._handleResult.call(this,t),c(t))||l(this,t)},t.prototype._handleRetrieveResult=function(t,n){e.prototype._handleRetrieveResult.call(this,t,n),d(this,t,n)},t.newObject=function(e){return s(t,e,"Microsoft.Dialog.DialogService",!1,4)},Object.defineProperty(t.prototype,"onDialogMessage",{get:function(){return this.m_dialogMessage||(this.m_dialogMessage=new i.GenericEventHandlers(this.context,this,"DialogMessage",{eventType:65536,registerFunc:function(){},unregisterFunc:function(){},getTargetIdFunc:function(){return null},eventArgsTransformFunc:function(e){var t,n,r,o;try{var s=JSON.parse(e.message),a=s.errorCode?new i.Error((n=s.errorCode,(r={})[12002]={code:"InvalidUrl",message:"Cannot load URL, no such page or bad URL syntax."},r[12003]={code:"InvalidUrl",message:"HTTPS is required."},r[12004]={code:"Untrusted",message:"Domain is not trusted."},r[12005]={code:"InvalidUrl",message:"HTTPS is required."},r[12007]={code:"FailedToOpen",message:"Another dialog is already opened."},(o=r)[n]?o[n]:{code:"Unknown",message:"An unknown error has occured with code: "+n})):null;t={originalErrorCode:s.errorCode,type:s.type,error:a,message:s.message,origin:s.origin}}catch(e){t={originalErrorCode:null,type:17,error:new i.Error({code:"GenericException",message:"Unknown error"}),message:e.message}}return i.Utility._createPromiseFromResult(t)}})),this.m_dialogMessage},enumerable:!1,configurable:!0}),t.prototype.toJSON=function(){return u(this,{},{})},t}(i.ClientObject);t.DialogService=h,function(e){e[e.dialogMessageReceived=0]="dialogMessageReceived",e[e.dialogEventReceived=1]="dialogEventReceived"}(f||(f={})),function(e){e.generalException="GeneralException"}(t.DialogErrorCodes||(t.DialogErrorCodes={}))},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))((function(o,i){function s(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(s,a)}c((r=r.apply(e,t||[])).next())}))},o=this&&this.__generator||function(e,t){var n,r,o,i,s={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;s;)try{if(n=1,r&&(o=2&i[0]?r.return:i[0]?r.throw||((o=r.return)&&o.call(r),0):r.next)&&!(o=o.call(r,i[1])).done)return o;switch(r=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return s.label++,{value:i[1],done:!1};case 5:s.label++,r=i[1],i=[0];continue;case 7:i=s.ops.pop(),s.trys.pop();continue;default:if(!(o=s.trys,(o=o.length>0&&o[o.length-1])||6!==i[0]&&2!==i[0])){s=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]<o[3])){s.label=i[1];break}if(6===i[0]&&s.label<o[1]){s.label=o[1],o=i;break}if(o&&s.label<o[2]){s.label=o[2],s.ops.push(i);break}o[2]&&s.ops.pop(),s.trys.pop();continue}i=t.call(e,s)}catch(e){i=[6,e],r=0}finally{n=o=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.storage=void 0;var i=n(17);function s(e){var t={};return e.forEach((function(e){var n=e[0],r=e[1];t[n]=r||null})),t}function a(e,t){if("string"!=typeof e)throw new Error("Argument '".concat(t,"' must be a string"))}function c(e,t){if(!Array.isArray(e))throw new Error("Argument '".concat(t,"' must be an array"));e.forEach((function(e){if("string"!=typeof e)throw new Error("All elements in argument '".concat(t,"' must be strings"))}))}t.storage={getItem:function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return a(e,"key"),[4,i.default.getItem(e)];case 1:return[2,t.sent()]}}))}))},setItem:function(e,t){return r(void 0,void 0,void 0,(function(){return o(this,(function(n){switch(n.label){case 0:return a(e,"key"),a(t,"value"),[4,i.default.setItem(e,t)];case 1:return[2,n.sent()]}}))}))},removeItem:function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return a(e,"key"),[4,i.default.removeItem(e)];case 1:return[2,t.sent()]}}))}))},getItems:function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return c(e,"keys"),[4,i.default.multiGet(e)];case 1:return[2,s(t.sent().concat())]}}))}))},setItems:function(e){return r(void 0,void 0,void 0,(function(){var t;return o(this,(function(n){switch(n.label){case 0:return function(e,t){if("object"!=typeof e)throw new Error("Argument '".concat(t,"' must be an object with string properties"));for(var n in e)if(e.hasOwnProperty(n)&&"string"!=typeof e[n])throw new Error("All properties in argument ".concat(t," must be a string"))}(e,"keyValues"),t=function(e){var t=[];for(var n in e)e.hasOwnProperty(n)&&t.push([n,e[n]]);return t}(e),[4,i.default.multiSet(t)];case 1:return[2,n.sent()]}}))}))},removeItems:function(e){return r(void 0,void 0,void 0,(function(){return o(this,(function(t){switch(t.label){case 0:return c(e,"keys"),[4,i.default.multiRemove(e)];case 1:return[2,t.sent()]}}))}))},getKeys:function(){return r(void 0,void 0,void 0,(function(){return o(this,(function(e){switch(e.label){case 0:return[4,i.default.getAllKeys()];case 1:return[2,e.sent().concat()]}}))}))}}},function(e,t){e.exports=OfficePlatformGlobal.ReactNative.AsyncStorage},function(e,t,n){"use strict";(function(e){function n(e){var t=e.split("."),n=0,r=0,o=0;if(t.length<2&&isNaN(Number(e)))throw"version format incorrect";if(n=Number(t[0]),t.length>=2&&(r=Number(t[1])),t.length>=3&&(o=Number(t[2])),isNaN(n)||isNaN(r)||isNaN(o))throw"version format incorrect";return{major:n,minor:r,patch:o}}Object.defineProperty(t,"__esModule",{value:!0}),t.apiInformation=void 0,t.apiInformation={isSetSupported:function(t,r){if("string"!=typeof t)return!1;if(null==r&&(r="0.0.0"),void 0===e.__apiSets)return!1;var o=e.__apiSets,i=Object.keys(o).map((function(e){return e.toLowerCase()})).indexOf(t.toLowerCase());if(i>-1){var s=o[Object.keys(o)[i]];try{var a=n(r),c=void 0;if((c=Array.isArray(s)?function(e,t){for(var r=0;r<e.length;r++){var o=n(e[r]);if(o.major==t)return o}return{major:0,minor:0,patch:0}}(s,a.major):n(s)).major>0){if(c.major>a.major)return!0;if(c.major==a.major&&c.minor>a.minor)return!0;if(c.major==a.major&&c.minor==a.minor&&c.patch>=a.patch)return!0}}catch(e){return!1}}return!1}}}).call(this,n(0))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Association=void 0;var r=function(){function e(){this.m_mappings={},this.m_onchangeHandlers=[]}return e.prototype.associate=function(e,t){if(1==arguments.length&&"object"==typeof arguments[0]&&arguments[0]){var n=arguments[0];for(var r in n)this.associate(r,n[r])}else if(2==arguments.length){var o=arguments[0],i=arguments[1];if("string"!=typeof o)return;if("function"!=typeof i)return;var s=o.toUpperCase();this.m_mappings[s],this.m_mappings[s]=i;for(var a=0;a<this.m_onchangeHandlers.length;a++)this.m_onchangeHandlers[a]()}},e.prototype.onchange=function(e){e&&this.m_onchangeHandlers.push(e)},Object.defineProperty(e.prototype,"mappings",{get:function(){return this.m_mappings},enumerable:!1,configurable:!0}),e}();t.Association=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Message=void 0;var r=n(21);Object.defineProperty(t,"Message",{enumerable:!0,get:function(){return r.Message}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Message=void 0;var r=n(22),o=function(){function e(){this.listeners={}}return e.prototype.on=function(e,t){return this.add(e,t),new Promise((function(e){e()}))},e.prototype.off=function(e,t){return this.remove(e,t),new Promise((function(e){e()}))},e.prototype.emit=function(e,t){return this.send(e,t),new Promise((function(e){e()}))},Object.defineProperty(e,"instance",{get:function(){return e.singleton||(e.singleton=new e),this.singleton},enumerable:!1,configurable:!0}),e.prototype.setupReceive=function(){Office&&Office.context&&Office.context.messaging&&!Office.context.messaging.onMessage&&(Office.context.messaging.onMessage=this.receiveMessage.bind(this))},e.prototype.add=function(e,t){this.listeners.hasOwnProperty(e)||(this.listeners[e]=new r.ListenerManager,this.setupReceive()),this.listeners[e].add(t)},e.prototype.remove=function(e,t){this.listeners.hasOwnProperty(e)&&(t?this.listeners[e].remove(t):delete this.listeners[e])},e.prototype.send=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.prototype.receiveMessage=function(e){var t=e.eventName,n=e.message;this.listeners.hasOwnProperty(t)&&this.listeners[t].call(n)},e}();t.Message=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ListenerManager=void 0;var r=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}();t.ListenerManager=r}]);
//# sourceMappingURL=excel-udf-host.win32.bundle.map