@microsoft/teamsfx 0.3.0-alpha.def66483.0 → 0.3.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +42 -17
- package/dist/index.js +127 -53
- package/dist/index.js.map +1 -1
- package/dist/teamsfx.js +30 -0
- package/dist/teamsfx.js.map +1 -0
- package/dist-esm/src/bot/teamsBotSsoPrompt.js +7 -4
- package/dist-esm/src/bot/teamsBotSsoPrompt.js.map +1 -1
- package/dist-esm/src/core/errors.js +4 -0
- package/dist-esm/src/core/errors.js.map +1 -1
- package/dist-esm/src/credential/m365TenantCredential.js +19 -21
- package/dist-esm/src/credential/m365TenantCredential.js.map +1 -1
- package/dist-esm/src/credential/onBehalfOfUserCredential.js +8 -17
- package/dist-esm/src/credential/onBehalfOfUserCredential.js.map +1 -1
- package/dist-esm/src/credential/teamsUserCredential.browser.js.map +1 -1
- package/dist-esm/src/models/configuration.js.map +1 -1
- package/dist-esm/src/util/logger.js +22 -3
- package/dist-esm/src/util/logger.js.map +1 -1
- package/dist-esm/src/util/utils.js +38 -0
- package/dist-esm/src/util/utils.js.map +1 -1
- package/dist-esm/src/util/utils.node.js +23 -0
- package/dist-esm/src/util/utils.node.js.map +1 -0
- package/package.json +24 -19
- package/types/teamsfx.d.ts +900 -871
package/dist/teamsfx.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import"crypto";var e;!function(e){e.InvalidParameter="InvalidParameter",e.InvalidConfiguration="InvalidConfiguration",e.InvalidCertificate="InvalidCertificate",e.InternalError="InternalError",e.ChannelNotSupported="ChannelNotSupported",e.RuntimeNotSupported="RuntimeNotSupported",e.ConsentFailed="ConsentFailed",e.UiRequiredError="UiRequiredError",e.TokenExpiredError="TokenExpiredError",e.ServiceError="ServiceError",e.FailedOperation="FailedOperation"}(e||(e={}));class t{}t.InvalidConfiguration="{0} in configuration is invalid: {1}.",t.ConfigurationNotExists="Configuration does not exist. {0}",t.ResourceConfigurationNotExists="{0} resource configuration does not exist.",t.MissingResourceConfiguration="Missing resource configuration with type: {0}, name: {1}.",t.AuthenticationConfigurationNotExists="Authentication configuration does not exist.",t.BrowserRuntimeNotSupported="{0} is not supported in browser.",t.NodejsRuntimeNotSupported="{0} is not supported in Node.",t.FailToAcquireTokenOnBehalfOfUser="Failed to acquire access token on behalf of user: {0}",t.OnlyMSTeamsChannelSupported="{0} is only supported in MS Teams Channel";class ErrorWithCode extends Error{constructor(e,t){t?(super(e),Object.setPrototypeOf(this,ErrorWithCode.prototype),this.name=`${new.target.name}.${t}`,this.code=t):super(e)}}
|
|
2
|
+
/*! *****************************************************************************
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
+
purpose with or without fee is hereby granted.
|
|
7
|
+
|
|
8
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
+
***************************************************************************** */function n(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))}function r(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function o(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,i=n.call(e),a=[];try{for(;(void 0===t||t-- >0)&&!(r=i.next()).done;)a.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=i.return)&&n.call(i)}finally{if(o)throw o.error}}return a}function i(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(o(arguments[t]));return e}function a(e){this.message=e}a.prototype=new Error,a.prototype.name="InvalidCharacterError";var s,l="undefined"!=typeof window&&window.atob&&window.atob.bind(window)||function(e){var t=String(e).replace(/=+$/,"");if(t.length%4==1)throw new a("'atob' failed: The string to be decoded is not correctly encoded.");for(var n,r,o=0,i=0,s="";r=t.charAt(i++);~r&&(n=o%4?64*n+r:r,o++%4)?s+=String.fromCharCode(255&n>>(-2*o&6)):0)r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".indexOf(r);return s};function u(e){var t=e.replace(/-/g,"+").replace(/_/g,"/");switch(t.length%4){case 0:break;case 2:t+="==";break;case 3:t+="=";break;default:throw"Illegal base64url string!"}try{return function(e){return decodeURIComponent(l(e).replace(/(.)/g,(function(e,t){var n=t.charCodeAt(0).toString(16).toUpperCase();return n.length<2&&(n="0"+n),"%"+n})))}(t)}catch(e){return l(t)}}function c(e){this.message=e}function d(e){p.level=e}function f(){return p.level}c.prototype=new Error,c.prototype.name="InvalidTokenError",function(e){e[e.Verbose=0]="Verbose",e[e.Info=1]="Info",e[e.Warn=2]="Warn",e[e.Error=3]="Error"}(s||(s={}));const p=new class{constructor(){this.level=void 0,this.defaultLogger={verbose:console.debug,info:console.info,warn:console.warn,error:console.error}}error(e){this.log(s.Error,e=>e.error,e)}warn(e){this.log(s.Warn,e=>e.warn,e)}info(e){this.log(s.Info,e=>e.info,e)}verbose(e){this.log(s.Verbose,e=>e.verbose,e)}log(e,t,n){if(""===n.trim())return;const r=`${`[${(new Date).toUTCString()}] : @microsoft/teamsfx : ${s[e]} - `}${n}`;void 0!==this.level&&this.level<=e&&(this.customLogger?t(this.customLogger)(r):this.customLogFunction?this.customLogFunction(e,r):t(this.defaultLogger)(r))}};function h(e){p.customLogger=e}function m(e){p.customLogFunction=e}function g(t){try{const n=function(e,t){if("string"!=typeof e)throw new c("Invalid token specified");var n=!0===(t=t||{}).header?0:1;try{return JSON.parse(u(e.split(".")[n]))}catch(e){throw new c("Invalid token specified: "+e.message)}}(t);if(!n||!n.exp)throw new ErrorWithCode("Decoded token is null or exp claim does not exists.",e.InternalError);return n}catch(t){const n="Parse jwt token failed in node env with error: "+t.message;throw p.error(n),new ErrorWithCode(n,e.InternalError)}}function v(e,...t){const n=t;return e.replace(/{(\d+)}/g,(function(e,t){return void 0!==n[t]?n[t]:e}))}function C(t){if("string"==typeof t||t instanceof String)return;if(Array.isArray(t)&&0===t.length)return;if(Array.isArray(t)&&t.length>0&&t.every(e=>"string"==typeof e))return;const n="The type of scopes is not valid, it must be string or string array";throw p.error(n),new ErrorWithCode(n,e.InvalidParameter)}class y{constructor(){throw new ErrorWithCode(v(t.BrowserRuntimeNotSupported,"M365TenantCredential"),e.RuntimeNotSupported)}getToken(r,o){return n(this,void 0,void 0,(function*(){throw new ErrorWithCode(v(t.BrowserRuntimeNotSupported,"M365TenantCredential"),e.RuntimeNotSupported)}))}}class w{constructor(n){throw new ErrorWithCode(v(t.BrowserRuntimeNotSupported,"OnBehalfOfUserCredential"),e.RuntimeNotSupported)}getToken(r,o){return n(this,void 0,void 0,(function*(){throw new ErrorWithCode(v(t.BrowserRuntimeNotSupported,"OnBehalfOfUserCredential"),e.RuntimeNotSupported)}))}getUserInfo(){throw new ErrorWithCode(v(t.BrowserRuntimeNotSupported,"OnBehalfOfUserCredential"),e.RuntimeNotSupported)}}class E{static get(e){return sessionStorage.getItem(e)}static set(e,t){sessionStorage.setItem(e,t)}static remove(e){sessionStorage.removeItem(e)}static clear(){sessionStorage.clear()}}function T(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var b=T(function(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}((function(e,t){window,e.exports=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}return 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="",n(n.s=19)}([function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),o=n(6),i=n(3),a=function(){};t.Communication=a;var s=function(){function e(){}return e.parentMessageQueue=[],e.childMessageQueue=[],e.nextMessageId=0,e.callbacks={},e}();function l(e,t,n){var r;t instanceof Function?n=t:t instanceof Array&&(r=t);var i=a.parentWindow,l=function(e,t){return{id:s.nextMessageId++,func:e,timestamp:Date.now(),args:t||[]}}(e,r);if(o.GlobalVars.isFramelessWindow)a.currentWindow&&a.currentWindow.nativeInterface&&a.currentWindow.nativeInterface.framelessPostMessage(JSON.stringify(l));else{var u=f(i);i&&u?i.postMessage(l,u):d(i).push(l)}n&&(s.callbacks[l.id]=n)}function u(e){if(e&&e.data&&"object"==typeof e.data){var t=e.source||e.originalEvent&&e.originalEvent.source,n=e.origin||e.originalEvent&&e.originalEvent.origin;(function(e,t){return!(a.currentWindow&&e===a.currentWindow||!(a.currentWindow&&a.currentWindow.location&&t&&t===a.currentWindow.location.origin)&&!(r.validOriginRegExp.test(t.toLowerCase())||o.GlobalVars.additionalValidOriginsRegexp&&o.GlobalVars.additionalValidOriginsRegexp.test(t.toLowerCase())))})(t,n)&&(function(e,t){o.GlobalVars.isFramelessWindow||a.parentWindow&&!a.parentWindow.closed&&e!==a.parentWindow?a.childWindow&&!a.childWindow.closed&&e!==a.childWindow||(a.childWindow=e,a.childOrigin=t):(a.parentWindow=e,a.parentOrigin=t),a.parentWindow&&a.parentWindow.closed&&(a.parentWindow=null,a.parentOrigin=null),a.childWindow&&a.childWindow.closed&&(a.childWindow=null,a.childOrigin=null),p(a.parentWindow),p(a.childWindow)}(t,n),t===a.parentWindow?c(e):t===a.childWindow&&function(e){if("id"in e.data&&"func"in e.data){var t=e.data,n=i.callHandler(t.func,t.args),r=n[0],o=n[1];r&&void 0!==o?h(t.id,Array.isArray(o)?o:[o]):l(t.func,t.args,(function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(a.childWindow){var r=e.pop();h(t.id,e,r)}}))}}(e))}}function c(e){if("id"in e.data&&"number"==typeof e.data.id){var t=e.data,n=s.callbacks[t.id];n&&(n.apply(null,t.args.concat([t.isPartialResponse])),function(e){return!0===e.data.isPartialResponse}(e)||delete s.callbacks[t.id])}else"func"in e.data&&"string"==typeof e.data.func&&(t=e.data,i.callHandler(t.func,t.args))}function d(e){return e===a.parentWindow?s.parentMessageQueue:e===a.childWindow?s.childMessageQueue:[]}function f(e){return e===a.parentWindow?a.parentOrigin:e===a.childWindow?a.childOrigin:null}function p(e){for(var t=f(e),n=d(e);e&&t&&n.length>0;)e.postMessage(n.shift(),t)}function h(e,t,n){var r=a.childWindow,o=function(e,t,n){return{id:e,args:t||[],isPartialResponse:n}}(e,t,n),i=f(r);r&&i&&r.postMessage(o,i)}t.initializeCommunication=function(e,t){s.messageListener=function(e){return u(e)},a.currentWindow=a.currentWindow||window,a.parentWindow=a.currentWindow.parent!==a.currentWindow.self?a.currentWindow.parent:a.currentWindow.opener,(a.parentWindow||t)&&a.currentWindow.addEventListener("message",s.messageListener,!1),a.parentWindow||(o.GlobalVars.isFramelessWindow=!0,window.onNativeMessage=c);try{a.parentOrigin="*",l("initialize",[r.version],e)}finally{a.parentOrigin=null}},t.uninitializeCommunication=function(){a.currentWindow.removeEventListener("message",s.messageListener,!1),a.parentWindow=null,a.parentOrigin=null,a.childWindow=null,a.childOrigin=null,s.parentMessageQueue=[],s.childMessageQueue=[],s.nextMessageId=0,s.callbacks={}},t.sendMessageToParent=l,t.waitForMessageQueue=function(e,t){var n=a.currentWindow.setInterval((function(){0===d(e).length&&(clearInterval(n),t())}),100)},t.sendMessageEventToChild=function(e,t){var n=a.childWindow,r=function(e,t){return{func:e,args:t||[]}}(e,t),o=f(n);n&&o?n.postMessage(r,o):d(n).push(r)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(4),o=n(6),i=n(5);t.ensureInitialized=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(!o.GlobalVars.initializeCalled)throw new Error("The library has not yet been initialized");if(o.GlobalVars.frameContext&&e&&e.length>0){for(var n=!1,r=0;r<e.length;r++)if(e[r]===o.GlobalVars.frameContext){n=!0;break}if(!n)throw new Error("This call is not allowed in the '"+o.GlobalVars.frameContext+"' context")}},t.isAPISupportedByPlatform=function(e){void 0===e&&(e=r.defaultSDKVersionForCompatCheck);var t=i.compareSDKVersions(o.GlobalVars.clientSupportedSDKVersion,e);return!isNaN(t)&&t>=0},t.processAdditionalValidOrigins=function(e){var t=o.GlobalVars.additionalValidOrigins.concat(e.filter((function(e){return"string"==typeof e&&r.userOriginUrlValidationRegExp.test(e)}))),n={};t=t.filter((function(e){return!n[e]&&(n[e]=!0,!0)})),o.GlobalVars.additionalValidOrigins=t,o.GlobalVars.additionalValidOrigins.length>0?o.GlobalVars.additionalValidOriginsRegexp=i.generateRegExpFromUrls(o.GlobalVars.additionalValidOrigins):o.GlobalVars.additionalValidOriginsRegexp=null}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.desktop="desktop",e.web="web",e.android="android",e.ios="ios",e.rigel="rigel",e.surfaceHub="surfaceHub"}(t.HostClientType||(t.HostClientType={})),function(e){e.settings="settings",e.content="content",e.authentication="authentication",e.remove="remove",e.task="task",e.sidePanel="sidePanel",e.stage="stage",e.meetingStage="meetingStage"}(t.FrameContexts||(t.FrameContexts={})),function(e){e[e.Standard=0]="Standard",e[e.Edu=1]="Edu",e[e.Class=2]="Class",e[e.Plc=3]="Plc",e[e.Staff=4]="Staff"}(t.TeamType||(t.TeamType={})),function(e){e[e.Admin=0]="Admin",e[e.User=1]="User",e[e.Guest=2]="Guest"}(t.UserTeamRole||(t.UserTeamRole={})),function(e){e.Large="large",e.Medium="medium",e.Small="small"}(t.TaskModuleDimension||(t.TaskModuleDimension={})),function(e){e.Regular="Regular",e.Private="Private",e.Shared="Shared"}(t.ChannelType||(t.ChannelType={}))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(8),o=n(0),i=function(){function e(){}return e.handlers={},e}();function a(e){i.themeChangeHandler&&i.themeChangeHandler(e),o.Communication.childWindow&&o.sendMessageEventToChild("themeChange",[e])}function s(){i.backButtonPressHandler&&i.backButtonPressHandler()||r.navigateBack()}function l(e){i.loadHandler&&i.loadHandler(e),o.Communication.childWindow&&o.sendMessageEventToChild("load",[e])}function u(){var e=function(){o.sendMessageToParent("readyToUnload",[])};i.beforeUnloadHandler&&i.beforeUnloadHandler(e)||e()}t.initializeHandlers=function(){i.handlers.themeChange=a,i.handlers.backButtonPress=s,i.handlers.load=l,i.handlers.beforeUnload=u},t.callHandler=function(e,t){var n=i.handlers[e];return n?[!0,n.apply(this,t)]:[!1,void 0]},t.registerHandler=function(e,t,n,r){void 0===n&&(n=!0),void 0===r&&(r=[]),t?(i.handlers[e]=t,n&&o.sendMessageToParent("registerHandler",[e].concat(r))):delete i.handlers[e]},t.removeHandler=function(e){delete i.handlers[e]},t.registerOnThemeChangeHandler=function(e){i.themeChangeHandler=e,e&&o.sendMessageToParent("registerHandler",["themeChange"])},t.handleThemeChange=a,t.registerBackButtonHandler=function(e){i.backButtonPressHandler=e,e&&o.sendMessageToParent("registerHandler",["backButton"])},t.registerOnLoadHandler=function(e){i.loadHandler=e,e&&o.sendMessageToParent("registerHandler",["load"])},t.registerBeforeUnloadHandler=function(e){i.beforeUnloadHandler=e,e&&o.sendMessageToParent("registerHandler",["beforeUnload"])}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(5);t.version="1.10.0",t.defaultSDKVersionForCompatCheck="1.6.0",t.getUserJoinedTeamsSupportedAndroidClientVersion="2.0.1",t.locationAPIsRequiredVersion="1.9.0",t.peoplePickerRequiredVersion="2.0.0",t.captureImageMobileSupportVersion="1.7.0",t.mediaAPISupportVersion="1.8.0",t.getMediaCallbackSupportVersion="2.0.0",t.scanBarCodeAPIMobileSupportVersion="1.9.0",t.validOrigins=["https://teams.microsoft.com","https://teams.microsoft.us","https://gov.teams.microsoft.us","https://dod.teams.microsoft.us","https://int.teams.microsoft.com","https://teams.live.com","https://devspaces.skype.com","https://ssauth.skype.com","https://local.teams.live.com","https://local.teams.live.com:8080","https://local.teams.office.com","https://local.teams.office.com:8080","https://msft.spoppe.com","https://*.sharepoint.com","https://*.sharepoint-df.com","https://*.sharepointonline.com","https://outlook.office.com","https://outlook-sdf.office.com","https://*.teams.microsoft.com","https://www.office.com","https://word.office.com","https://excel.office.com","https://powerpoint.office.com","https://www.officeppe.com","https://*.www.office.com"],t.validOriginRegExp=r.generateRegExpFromUrls(t.validOrigins),t.userOriginUrlValidationRegExp=/^https\:\/\//},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(22);function o(e){for(var t="^",n=e.split("."),r=0;r<n.length;r++)t+=(r>0?"[.]":"")+n[r].replace("*","[^/^.]+");return t+"$"}t.generateRegExpFromUrls=function(e){for(var t="",n=0;n<e.length;n++)t+=(0===n?"":"|")+o(e[n]);return new RegExp(t)},t.getGenericOnCompleteHandler=function(e){return function(t,n){if(!t)throw new Error(e||n)}},t.compareSDKVersions=function(e,t){if("string"!=typeof e||"string"!=typeof t)return NaN;var n=e.split("."),r=t.split(".");function o(e){return/^\d+$/.test(e)}if(!n.every(o)||!r.every(o))return NaN;for(;n.length<r.length;)n.push("0");for(;r.length<n.length;)r.push("0");for(var i=0;i<n.length;++i)if(Number(n[i])!=Number(r[i]))return Number(n[i])>Number(r[i])?1:-1;return 0},t.generateGUID=function(){return r.v4()}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(){}return e.initializeCalled=!1,e.initializeCompleted=!1,e.additionalValidOrigins=[],e.additionalValidOriginsRegexp=null,e.initializeCallbacks=[],e.isFramelessWindow=!1,e.printCapabilityEnabled=!1,e}();t.GlobalVars=r},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Inline="inline",e.Desktop="desktop",e.Web="web"}(t.FileOpenPreference||(t.FileOpenPreference={})),function(e){e[e.NOT_SUPPORTED_ON_PLATFORM=100]="NOT_SUPPORTED_ON_PLATFORM",e[e.INTERNAL_ERROR=500]="INTERNAL_ERROR",e[e.NOT_SUPPORTED_IN_CURRENT_CONTEXT=501]="NOT_SUPPORTED_IN_CURRENT_CONTEXT",e[e.PERMISSION_DENIED=1e3]="PERMISSION_DENIED",e[e.NETWORK_ERROR=2e3]="NETWORK_ERROR",e[e.NO_HW_SUPPORT=3e3]="NO_HW_SUPPORT",e[e.INVALID_ARGUMENTS=4e3]="INVALID_ARGUMENTS",e[e.UNAUTHORIZED_USER_OPERATION=5e3]="UNAUTHORIZED_USER_OPERATION",e[e.INSUFFICIENT_RESOURCES=6e3]="INSUFFICIENT_RESOURCES",e[e.THROTTLE=7e3]="THROTTLE",e[e.USER_ABORT=8e3]="USER_ABORT",e[e.OPERATION_TIMED_OUT=8001]="OPERATION_TIMED_OUT",e[e.OLD_PLATFORM=9e3]="OLD_PLATFORM",e[e.FILE_NOT_FOUND=404]="FILE_NOT_FOUND",e[e.SIZE_EXCEEDED=1e4]="SIZE_EXCEEDED"}(t.ErrorCode||(t.ErrorCode={}))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(25);t.appInitialization=r.appInitialization;var o=n(11);t.authentication=o.authentication;var i=n(2);t.FrameContexts=i.FrameContexts,t.HostClientType=i.HostClientType,t.TaskModuleDimension=i.TaskModuleDimension,t.TeamType=i.TeamType,t.UserTeamRole=i.UserTeamRole,t.ChannelType=i.ChannelType;var a=n(7);t.ErrorCode=a.ErrorCode,t.FileOpenPreference=a.FileOpenPreference;var s=n(26);t.enablePrintCapability=s.enablePrintCapability,t.executeDeepLink=s.executeDeepLink,t.getContext=s.getContext,t.getMruTabInstances=s.getMruTabInstances,t.getTabInstances=s.getTabInstances,t.initialize=s.initialize,t.initializeWithFrameContext=s.initializeWithFrameContext,t.print=s.print,t.registerBackButtonHandler=s.registerBackButtonHandler,t.registerBeforeUnloadHandler=s.registerBeforeUnloadHandler,t.registerChangeSettingsHandler=s.registerChangeSettingsHandler,t.registerFullScreenHandler=s.registerFullScreenHandler,t.registerOnLoadHandler=s.registerOnLoadHandler,t.registerOnThemeChangeHandler=s.registerOnThemeChangeHandler,t.registerAppButtonClickHandler=s.registerAppButtonClickHandler,t.registerAppButtonHoverEnterHandler=s.registerAppButtonHoverEnterHandler,t.registerAppButtonHoverLeaveHandler=s.registerAppButtonHoverLeaveHandler,t.setFrameContext=s.setFrameContext,t.shareDeepLink=s.shareDeepLink;var l=n(27);t.returnFocus=l.returnFocus,t.navigateBack=l.navigateBack,t.navigateCrossDomain=l.navigateCrossDomain,t.navigateToTab=l.navigateToTab;var u=n(12);t.settings=u.settings;var c=n(28);t.tasks=c.tasks;var d=n(16);t.ChildAppWindow=d.ChildAppWindow,t.ParentAppWindow=d.ParentAppWindow;var f=n(17);t.media=f.media;var p=n(29);t.location=p.location;var h=n(30);t.meeting=h.meeting;var m=n(31);t.people=m.people},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var r=new Uint8Array(16);e.exports=function(){return n(r),r}}else{var o=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),o[t]=e>>>((3&t)<<3)&255;return o}}},function(e,t){for(var n=[],r=0;r<256;++r)n[r]=(r+256).toString(16).substr(1);e.exports=function(e,t){var r=t||0,o=n;return[o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],"-",o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]],o[e[r++]]].join("")}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(6),i=n(2),a=n(0),s=n(3);!function(e){var t,n;function l(){u();try{a.Communication.childWindow&&a.Communication.childWindow.close()}finally{a.Communication.childWindow=null,a.Communication.childOrigin=null}}function u(){n&&(clearInterval(n),n=0),s.removeHandler("initialize"),s.removeHandler("navigateCrossDomain")}function c(){u(),n=a.Communication.currentWindow.setInterval((function(){if(!a.Communication.childWindow||a.Communication.childWindow.closed)f("CancelledByUser");else{var e=a.Communication.childOrigin;try{a.Communication.childOrigin="*",a.sendMessageEventToChild("ping")}finally{a.Communication.childOrigin=e}}}),100),s.registerHandler("initialize",(function(){return[i.FrameContexts.authentication,o.GlobalVars.hostClientType]})),s.registerHandler("navigateCrossDomain",(function(){return!1}))}function d(e){try{t&&t.successCallback&&t.successCallback(e)}finally{t=null,l()}}function f(e){try{t&&t.failureCallback&&t.failureCallback(e)}finally{t=null,l()}}function p(e,t,n){if(e){var r=document.createElement("a");r.href=decodeURIComponent(e),r.host&&r.host!==window.location.host&&"outlook.office.com"===r.host&&r.search.indexOf("client_type=Win32_Outlook")>-1&&(t&&"result"===t&&(n&&(r.href=h(r.href,"result",n)),a.Communication.currentWindow.location.assign(h(r.href,"authSuccess",""))),t&&"reason"===t&&(n&&(r.href=h(r.href,"reason",n)),a.Communication.currentWindow.location.assign(h(r.href,"authFailure",""))))}}function h(e,t,n){var r=e.indexOf("#"),o=-1===r?"#":e.substr(r);return o=o+"&"+t+(""!==n?"="+n:""),(e=-1===r?e:e.substr(0,r))+o}e.initialize=function(){s.registerHandler("authentication.authenticate.success",d,!1),s.registerHandler("authentication.authenticate.failure",f,!1)},e.registerAuthenticationHandlers=function(e){t=e},e.authenticate=function(e){var n=void 0!==e?e:t;if(r.ensureInitialized(i.FrameContexts.content,i.FrameContexts.sidePanel,i.FrameContexts.settings,i.FrameContexts.remove,i.FrameContexts.task,i.FrameContexts.stage,i.FrameContexts.meetingStage),o.GlobalVars.hostClientType===i.HostClientType.desktop||o.GlobalVars.hostClientType===i.HostClientType.android||o.GlobalVars.hostClientType===i.HostClientType.ios||o.GlobalVars.hostClientType===i.HostClientType.rigel){var s=document.createElement("a");s.href=n.url,a.sendMessageToParent("authentication.authenticate",[s.href,n.width,n.height],(function(e,t){e?n.successCallback(t):n.failureCallback(t)}))}else!function(e){t=e,l();var n=t.width||600,r=t.height||400;n=Math.min(n,a.Communication.currentWindow.outerWidth-400),r=Math.min(r,a.Communication.currentWindow.outerHeight-200);var o=document.createElement("a");o.href=t.url;var i=void 0!==a.Communication.currentWindow.screenLeft?a.Communication.currentWindow.screenLeft:a.Communication.currentWindow.screenX,s=void 0!==a.Communication.currentWindow.screenTop?a.Communication.currentWindow.screenTop:a.Communication.currentWindow.screenY;i+=a.Communication.currentWindow.outerWidth/2-n/2,s+=a.Communication.currentWindow.outerHeight/2-r/2,a.Communication.childWindow=a.Communication.currentWindow.open(o.href,"_blank","toolbar=no, location=yes, status=no, menubar=no, scrollbars=yes, top="+s+", left="+i+", width="+n+", height="+r),a.Communication.childWindow?c():f("FailedToOpenWindow")}(n)},e.getAuthToken=function(e){r.ensureInitialized(),a.sendMessageToParent("authentication.getAuthToken",[e.resources,e.claims,e.silent],(function(t,n){t?e.successCallback(n):e.failureCallback(n)}))},e.getUser=function(e){r.ensureInitialized(),a.sendMessageToParent("authentication.getUser",(function(t,n){t?e.successCallback(n):e.failureCallback(n)}))},e.notifySuccess=function(e,t){p(t,"result",e),r.ensureInitialized(i.FrameContexts.authentication),a.sendMessageToParent("authentication.authenticate.success",[e]),a.waitForMessageQueue(a.Communication.parentWindow,(function(){return setTimeout((function(){return a.Communication.currentWindow.close()}),200)}))},e.notifyFailure=function(e,t){p(t,"reason",e),r.ensureInitialized(i.FrameContexts.authentication),a.sendMessageToParent("authentication.authenticate.failure",[e]),a.waitForMessageQueue(a.Communication.parentWindow,(function(){return setTimeout((function(){return a.Communication.currentWindow.close()}),200)}))}}(t.authentication||(t.authentication={}))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(2),i=n(5),a=n(0),s=n(3);!function(e){var t,n;function l(e){var n=new u(e);t?t(n):n.notifySuccess()}e.initialize=function(){s.registerHandler("settings.save",l,!1),s.registerHandler("settings.remove",c,!1)},e.setValidityState=function(e){r.ensureInitialized(o.FrameContexts.settings,o.FrameContexts.remove),a.sendMessageToParent("settings.setValidityState",[e])},e.getSettings=function(e){r.ensureInitialized(o.FrameContexts.content,o.FrameContexts.settings,o.FrameContexts.remove,o.FrameContexts.sidePanel),a.sendMessageToParent("settings.getSettings",e)},e.setSettings=function(e,t){r.ensureInitialized(o.FrameContexts.content,o.FrameContexts.settings,o.FrameContexts.sidePanel),a.sendMessageToParent("settings.setSettings",[e],t||i.getGenericOnCompleteHandler())},e.registerOnSaveHandler=function(e){r.ensureInitialized(o.FrameContexts.settings),t=e,e&&a.sendMessageToParent("registerHandler",["save"])},e.registerOnRemoveHandler=function(e){r.ensureInitialized(o.FrameContexts.remove,o.FrameContexts.settings),n=e,e&&a.sendMessageToParent("registerHandler",["remove"])};var u=function(){function e(e){this.notified=!1,this.result=e||{}}return e.prototype.notifySuccess=function(){this.ensureNotNotified(),a.sendMessageToParent("settings.save.success"),this.notified=!0},e.prototype.notifyFailure=function(e){this.ensureNotNotified(),a.sendMessageToParent("settings.save.failure",[e]),this.notified=!0},e.prototype.ensureNotNotified=function(){if(this.notified)throw new Error("The SaveEvent may only notify success or failure once.")},e}();function c(){var e=new d;n?n(e):e.notifySuccess()}var d=function(){function e(){this.notified=!1}return e.prototype.notifySuccess=function(){this.ensureNotNotified(),a.sendMessageToParent("settings.remove.success"),this.notified=!0},e.prototype.notifyFailure=function(e){this.ensureNotNotified(),a.sendMessageToParent("settings.remove.failure",[e]),this.notified=!0},e.prototype.ensureNotNotified=function(){if(this.notified)throw new Error("The removeEvent may only notify success or failure once.")},e}()}(t.settings||(t.settings={}))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(0),i=n(3);!function(e){e.registerGetLogHandler=function(e){r.ensureInitialized(),e?i.registerHandler("log.request",(function(){var t=e();o.sendMessageToParent("log.receive",[t])})):i.removeHandler("log.request")}}(t.logs||(t.logs={}))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(2),i=n(5),a=n(0),s=n(15),l=n(3),u=n(6),c=n(7),d=n(4);t.initializePrivateApis=function(){s.menus.initialize()},t.getUserJoinedTeams=function(e,t){if(r.ensureInitialized(),u.GlobalVars.hostClientType===o.HostClientType.android&&!r.isAPISupportedByPlatform(d.getUserJoinedTeamsSupportedAndroidClientVersion)){var n={errorCode:c.ErrorCode.OLD_PLATFORM};throw new Error(JSON.stringify(n))}a.sendMessageToParent("getUserJoinedTeams",[t],e)},t.enterFullscreen=function(){r.ensureInitialized(o.FrameContexts.content),a.sendMessageToParent("enterFullscreen",[])},t.exitFullscreen=function(){r.ensureInitialized(o.FrameContexts.content),a.sendMessageToParent("exitFullscreen",[])},t.openFilePreview=function(e){r.ensureInitialized(o.FrameContexts.content);var t=[e.entityId,e.title,e.description,e.type,e.objectUrl,e.downloadUrl,e.webPreviewUrl,e.webEditUrl,e.baseUrl,e.editFile,e.subEntityId,e.viewerAction,e.fileOpenPreference];a.sendMessageToParent("openFilePreview",t)},t.showNotification=function(e){r.ensureInitialized(o.FrameContexts.content);var t=[e.message,e.notificationType];a.sendMessageToParent("showNotification",t)},t.uploadCustomApp=function(e,t){r.ensureInitialized(),a.sendMessageToParent("uploadCustomApp",[e],t||i.getGenericOnCompleteHandler())},t.sendCustomMessage=function(e,t,n){r.ensureInitialized(),a.sendMessageToParent(e,t,n)},t.sendCustomEvent=function(e,t){if(r.ensureInitialized(),!a.Communication.childWindow)throw new Error("The child window has not yet been initialized or is not present");a.sendMessageEventToChild(e,t)},t.registerCustomHandler=function(e,t){var n=this;r.ensureInitialized(),l.registerHandler(e,(function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return t.apply(n,e)}))},t.getChatMembers=function(e){r.ensureInitialized(),a.sendMessageToParent("getChatMembers",e)},t.getConfigSetting=function(e,t){r.ensureInitialized(),a.sendMessageToParent("getConfigSetting",[t],e)},t.registerUserSettingsChangeHandler=function(e,t){r.ensureInitialized(),l.registerHandler("userSettingsChange",t,!0,[e])}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(0),i=n(3);!function(e){var t,n,a,s=function(){this.enabled=!0,this.selected=!1};function l(e){a&&a(e)||(r.ensureInitialized(),o.sendMessageToParent("viewConfigItemPress",[e]))}function u(e){t&&t(e)||(r.ensureInitialized(),o.sendMessageToParent("handleNavBarMenuItemPress",[e]))}function c(e){n&&n(e)||(r.ensureInitialized(),o.sendMessageToParent("handleActionMenuItemPress",[e]))}e.MenuItem=s,function(e){e.dropDown="dropDown",e.popOver="popOver"}(e.MenuListType||(e.MenuListType={})),e.initialize=function(){i.registerHandler("navBarMenuItemPress",u,!1),i.registerHandler("actionMenuItemPress",c,!1),i.registerHandler("setModuleView",l,!1)},e.setUpViews=function(e,t){r.ensureInitialized(),a=t,o.sendMessageToParent("setUpViews",[e])},e.setNavBarMenu=function(e,n){r.ensureInitialized(),t=n,o.sendMessageToParent("setNavBarMenu",[e])},e.showActionMenu=function(e,t){r.ensureInitialized(),n=t,o.sendMessageToParent("showActionMenu",[e])}}(t.menus||(t.menus={}))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(2),i=n(5),a=n(0),s=n(3),l=function(){function e(){}return e.prototype.postMessage=function(e,t){r.ensureInitialized(),a.sendMessageToParent("messageForChild",[e],t||i.getGenericOnCompleteHandler())},e.prototype.addEventListener=function(e,t){"message"===e&&s.registerHandler("messageForParent",t)},e}();t.ChildAppWindow=l;var u=function(){function e(){}return Object.defineProperty(e,"Instance",{get:function(){return this._instance||(this._instance=new this)},enumerable:!0,configurable:!0}),e.prototype.postMessage=function(e,t){r.ensureInitialized(o.FrameContexts.task),a.sendMessageToParent("messageForParent",[e],t||i.getGenericOnCompleteHandler())},e.prototype.addEventListener=function(e,t){"message"===e&&s.registerHandler("messageForChild",t)},e}();t.ParentAppWindow=u},function(e,t,n){var r=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}();Object.defineProperty(t,"__esModule",{value:!0});var o=n(6),i=n(7),a=n(1),s=n(2),l=n(5),u=n(18),c=n(0),d=n(3),f=n(4);!function(e){!function(e){e.Base64="base64",e.ID="id"}(e.FileFormat||(e.FileFormat={}));var t=function(){};e.File=t,e.captureImage=function(e){if(!e)throw new Error("[captureImage] Callback cannot be null");a.ensureInitialized(s.FrameContexts.content,s.FrameContexts.task),o.GlobalVars.isFramelessWindow?a.isAPISupportedByPlatform(f.captureImageMobileSupportVersion)?c.sendMessageToParent("captureImage",e):e({errorCode:i.ErrorCode.OLD_PLATFORM},void 0):e({errorCode:i.ErrorCode.NOT_SUPPORTED_ON_PLATFORM},void 0)};var n=function(e){function t(t){void 0===t&&(t=null);var n=e.call(this)||this;return t&&(n.content=t.content,n.format=t.format,n.mimeType=t.mimeType,n.name=t.name,n.preview=t.preview,n.size=t.size),n}return r(t,e),t.prototype.getMedia=function(e){if(!e)throw new Error("[get Media] Callback cannot be null");a.ensureInitialized(s.FrameContexts.content,s.FrameContexts.task),a.isAPISupportedByPlatform(f.mediaAPISupportVersion)?u.validateGetMediaInputs(this.mimeType,this.format,this.content)?a.isAPISupportedByPlatform(f.getMediaCallbackSupportVersion)?this.getMediaViaCallback(e):this.getMediaViaHandler(e):e({errorCode:i.ErrorCode.INVALID_ARGUMENTS},null):e({errorCode:i.ErrorCode.OLD_PLATFORM},null)},t.prototype.getMediaViaCallback=function(e){var t={mediaMimeType:this.mimeType,assembleAttachment:[]},n=[this.content];c.sendMessageToParent("getMedia",n,(function(n){if(e)if(n&&n.error)e(n.error,null);else if(n&&n.mediaChunk)if(n.mediaChunk.chunkSequence<=0){var r=u.createFile(t.assembleAttachment,t.mediaMimeType);e(n.error,r)}else{var o=u.decodeAttachment(n.mediaChunk,t.mediaMimeType);t.assembleAttachment.push(o)}else e({errorCode:i.ErrorCode.INTERNAL_ERROR,message:"data receieved is null"},null)}))},t.prototype.getMediaViaHandler=function(e){var t=l.generateGUID(),n={mediaMimeType:this.mimeType,assembleAttachment:[]},r=[t,this.content];this.content&&e&&c.sendMessageToParent("getMedia",r),d.registerHandler("getMedia"+t,(function(r){if(e){var o=JSON.parse(r);if(o.error)e(o.error,null),d.removeHandler("getMedia"+t);else if(o.mediaChunk)if(o.mediaChunk.chunkSequence<=0){var a=u.createFile(n.assembleAttachment,n.mediaMimeType);e(o.error,a),d.removeHandler("getMedia"+t)}else{var s=u.decodeAttachment(o.mediaChunk,n.mediaMimeType);n.assembleAttachment.push(s)}else e({errorCode:i.ErrorCode.INTERNAL_ERROR,message:"data receieved is null"},null),d.removeHandler("getMedia"+t)}}))},t}(t);e.Media=n,function(e){e[e.Photo=1]="Photo",e[e.Document=2]="Document",e[e.Whiteboard=3]="Whiteboard",e[e.BusinessCard=4]="BusinessCard"}(e.CameraStartMode||(e.CameraStartMode={})),function(e){e[e.Camera=1]="Camera",e[e.Gallery=2]="Gallery"}(e.Source||(e.Source={})),function(e){e[e.Image=1]="Image",e[e.Audio=4]="Audio"}(e.MediaType||(e.MediaType={})),function(e){e[e.ID=1]="ID",e[e.URL=2]="URL"}(e.ImageUriType||(e.ImageUriType={})),e.selectMedia=function(e,t){if(!t)throw new Error("[select Media] Callback cannot be null");if(a.ensureInitialized(s.FrameContexts.content,s.FrameContexts.task),a.isAPISupportedByPlatform(f.mediaAPISupportVersion))if(u.validateSelectMediaInputs(e)){var r=[e];c.sendMessageToParent("selectMedia",r,(function(e,r){if(r){for(var o=[],i=0,a=r;i<a.length;i++){var s=a[i];o.push(new n(s))}t(e,o)}else t(e,null)}))}else{var o={errorCode:i.ErrorCode.INVALID_ARGUMENTS};t(o,null)}else{var l={errorCode:i.ErrorCode.OLD_PLATFORM};t(l,null)}},e.viewImages=function(e,t){if(!t)throw new Error("[view images] Callback cannot be null");if(a.ensureInitialized(s.FrameContexts.content,s.FrameContexts.task),a.isAPISupportedByPlatform(f.mediaAPISupportVersion))if(u.validateViewImagesInput(e)){var n=[e];c.sendMessageToParent("viewImages",n,t)}else t({errorCode:i.ErrorCode.INVALID_ARGUMENTS});else t({errorCode:i.ErrorCode.OLD_PLATFORM})},e.scanBarCode=function(e,t){if(!e)throw new Error("[media.scanBarCode] Callback cannot be null");a.ensureInitialized(s.FrameContexts.content,s.FrameContexts.task),o.GlobalVars.hostClientType!==s.HostClientType.desktop&&o.GlobalVars.hostClientType!==s.HostClientType.web&&o.GlobalVars.hostClientType!==s.HostClientType.rigel?a.isAPISupportedByPlatform(f.scanBarCodeAPIMobileSupportVersion)?u.validateScanBarCodeInput(t)?c.sendMessageToParent("media.scanBarCode",[t],e):e({errorCode:i.ErrorCode.INVALID_ARGUMENTS},null):e({errorCode:i.ErrorCode.OLD_PLATFORM},null):e({errorCode:i.ErrorCode.NOT_SUPPORTED_ON_PLATFORM},null)}}(t.media||(t.media={}))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(17);t.createFile=function(e,t){if(null==e||null==t||e.length<=0)return null;var n,r=1;return e.sort((function(e,t){return e.sequence>t.sequence?1:-1})),e.forEach((function(e){e.sequence==r&&(n=n?new Blob([n,e.file],{type:t}):new Blob([e.file],{type:t}),r++)})),n},t.decodeAttachment=function(e,t){if(null==e||null==t)return null;for(var n=atob(e.chunk),r=new Array(n.length),o=0;o<n.length;o++)r[o]=n.charCodeAt(o);var i=new Uint8Array(r),a=new Blob([i],{type:t});return{sequence:e.chunkSequence,file:a}},t.validateSelectMediaInputs=function(e){return!(null==e||e.maxMediaCount>10)},t.validateGetMediaInputs=function(e,t,n){return null!=e&&null!=t&&t==r.media.FileFormat.ID&&null!=n},t.validateViewImagesInput=function(e){return!(null==e||e.length<=0||e.length>10)},t.validateScanBarCodeInput=function(e){return!e||!(null===e.timeOutIntervalInSec||e.timeOutIntervalInSec<=0||e.timeOutIntervalInSec>60)},t.validatePeoplePickerInput=function(e){if(e){if(e.title&&"string"!=typeof e.title)return!1;if(e.setSelected&&"object"!=typeof e.setSelected)return!1;if(e.openOrgWideSearchInChatOrChannel&&"boolean"!=typeof e.openOrgWideSearchInChatOrChannel)return!1;if(e.singleSelect&&"boolean"!=typeof e.singleSelect)return!1}return!0}},function(e,t,n){function r(e){for(var n in e)t.hasOwnProperty(n)||(t[n]=e[n])}Object.defineProperty(t,"__esModule",{value:!0}),r(n(20)),r(n(8))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(21);t.bot=r.bot;var o=n(15);t.menus=o.menus;var i=n(13);t.logs=i.logs;var a=n(32);t.NotificationTypes=a.NotificationTypes,t.ViewerActionTypes=a.ViewerActionTypes,t.UserSettingTypes=a.UserSettingTypes;var s=n(14);t.enterFullscreen=s.enterFullscreen,t.exitFullscreen=s.exitFullscreen,t.getChatMembers=s.getChatMembers,t.getConfigSetting=s.getConfigSetting,t.getUserJoinedTeams=s.getUserJoinedTeams,t.openFilePreview=s.openFilePreview,t.sendCustomMessage=s.sendCustomMessage,t.showNotification=s.showNotification,t.sendCustomEvent=s.sendCustomEvent,t.registerCustomHandler=s.registerCustomHandler,t.uploadCustomApp=s.uploadCustomApp,t.registerUserSettingsChangeHandler=s.registerUserSettingsChangeHandler;var l=n(33);t.conversations=l.conversations;var u=n(34);t.meetingRoom=u.meetingRoom;var c=n(35);t.remoteCamera=c.remoteCamera;var d=n(36);t.files=d.files;var f=n(37);t.appEntity=f.appEntity},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=n(1);!function(e){e.sendQuery=function(e,t,n){o.ensureInitialized(),r.sendMessageToParent("bot.executeQuery",[e],(function(e,r){e?t(r):n(r)}))},e.getSupportedCommands=function(e,t){o.ensureInitialized(),r.sendMessageToParent("bot.getSupportedCommands",(function(n,r){n?e(r):t(r)}))},e.authenticate=function(e,t,n){o.ensureInitialized(),r.sendMessageToParent("bot.authenticate",[e],(function(e,r){e?t(r):n(r)}))},function(e){e.Results="Results",e.Auth="Auth"}(e.ResponseType||(e.ResponseType={}))}(t.bot||(t.bot={}))},function(e,t,n){var r=n(23),o=n(24),i=o;i.v1=r,i.v4=o,e.exports=i},function(e,t,n){var r,o,i=n(9),a=n(10),s=0,l=0;e.exports=function(e,t,n){var u=t&&n||0,c=t||[],d=(e=e||{}).node||r,f=void 0!==e.clockseq?e.clockseq:o;if(null==d||null==f){var p=i();null==d&&(d=r=[1|p[0],p[1],p[2],p[3],p[4],p[5]]),null==f&&(f=o=16383&(p[6]<<8|p[7]))}var h=void 0!==e.msecs?e.msecs:(new Date).getTime(),m=void 0!==e.nsecs?e.nsecs:l+1,g=h-s+(m-l)/1e4;if(g<0&&void 0===e.clockseq&&(f=f+1&16383),(g<0||h>s)&&void 0===e.nsecs&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");s=h,l=m,o=f;var v=(1e4*(268435455&(h+=122192928e5))+m)%4294967296;c[u++]=v>>>24&255,c[u++]=v>>>16&255,c[u++]=v>>>8&255,c[u++]=255&v;var C=h/4294967296*1e4&268435455;c[u++]=C>>>8&255,c[u++]=255&C,c[u++]=C>>>24&15|16,c[u++]=C>>>16&255,c[u++]=f>>>8|128,c[u++]=255&f;for(var y=0;y<6;++y)c[u+y]=d[y];return t||a(c)}},function(e,t,n){var r=n(9),o=n(10);e.exports=function(e,t,n){var i=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var a=(e=e||{}).random||(e.rng||r)();if(a[6]=15&a[6]|64,a[8]=63&a[8]|128,t)for(var s=0;s<16;++s)t[i+s]=a[s];return t||o(a)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(4),i=n(0);!function(e){e.Messages={AppLoaded:"appInitialization.appLoaded",Success:"appInitialization.success",Failure:"appInitialization.failure",ExpectedFailure:"appInitialization.expectedFailure"},function(e){e.AuthFailed="AuthFailed",e.Timeout="Timeout",e.Other="Other"}(e.FailedReason||(e.FailedReason={})),function(e){e.PermissionError="PermissionError",e.NotFound="NotFound",e.Throttling="Throttling",e.Offline="Offline",e.Other="Other"}(e.ExpectedFailureReason||(e.ExpectedFailureReason={})),e.notifyAppLoaded=function(){r.ensureInitialized(),i.sendMessageToParent(e.Messages.AppLoaded,[o.version])},e.notifySuccess=function(){r.ensureInitialized(),i.sendMessageToParent(e.Messages.Success,[o.version])},e.notifyFailure=function(t){r.ensureInitialized(),i.sendMessageToParent(e.Messages.Failure,[t.reason,t.message])},e.notifyExpectedFailure=function(t){r.ensureInitialized(),i.sendMessageToParent(e.Messages.ExpectedFailure,[t.reason,t.message])}}(t.appInitialization||(t.appInitialization={}))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(6),i=n(4),a=n(12),s=n(5),l=n(13),u=n(2),c=n(0),d=n(11),f=n(14),p=n(3);function h(e,t){o.GlobalVars.initializeCalled||(o.GlobalVars.initializeCalled=!0,p.initializeHandlers(),c.initializeCommunication((function(e,t,n){void 0===n&&(n=i.defaultSDKVersionForCompatCheck),o.GlobalVars.frameContext=e,o.GlobalVars.hostClientType=t,o.GlobalVars.clientSupportedSDKVersion=n,o.GlobalVars.initializeCallbacks.forEach((function(e){return e()})),o.GlobalVars.initializeCallbacks=[],o.GlobalVars.initializeCompleted=!0}),t),d.authentication.initialize(),a.settings.initialize(),f.initializePrivateApis(),this._uninitialize=function(){o.GlobalVars.frameContext&&(g(null),v(null),C(null),w(null),y(null),l.logs.registerGetLogHandler(null)),o.GlobalVars.frameContext===u.FrameContexts.settings&&a.settings.registerOnSaveHandler(null),o.GlobalVars.frameContext===u.FrameContexts.remove&&a.settings.registerOnRemoveHandler(null),o.GlobalVars.initializeCalled=!1,o.GlobalVars.initializeCompleted=!1,o.GlobalVars.initializeCallbacks=[],o.GlobalVars.additionalValidOrigins=[],o.GlobalVars.frameContext=null,o.GlobalVars.hostClientType=null,o.GlobalVars.isFramelessWindow=!1,c.uninitializeCommunication()}),Array.isArray(t)&&r.processAdditionalValidOrigins(t),e&&(o.GlobalVars.initializeCompleted?e():o.GlobalVars.initializeCallbacks.push(e))}function m(){window.print()}function g(e){r.ensureInitialized(),p.registerOnThemeChangeHandler(e)}function v(e){r.ensureInitialized(),p.registerHandler("fullScreenChange",e)}function C(e){r.ensureInitialized(),p.registerBackButtonHandler(e)}function y(e){r.ensureInitialized(),p.registerOnLoadHandler(e)}function w(e){r.ensureInitialized(),p.registerBeforeUnloadHandler(e)}function E(e){r.ensureInitialized(u.FrameContexts.content),c.sendMessageToParent("setFrameContext",[e])}t.initialize=h,t._initialize=function(e){c.Communication.currentWindow=e},t._uninitialize=function(){},t.enablePrintCapability=function(){o.GlobalVars.printCapabilityEnabled||(o.GlobalVars.printCapabilityEnabled=!0,r.ensureInitialized(),document.addEventListener("keydown",(function(e){(e.ctrlKey||e.metaKey)&&80===e.keyCode&&(m(),e.cancelBubble=!0,e.preventDefault(),e.stopImmediatePropagation())})))},t.print=m,t.getContext=function(e){r.ensureInitialized(),c.sendMessageToParent("getContext",(function(t){t.frameContext||(t.frameContext=o.GlobalVars.frameContext),e(t)}))},t.registerOnThemeChangeHandler=g,t.registerFullScreenHandler=v,t.registerAppButtonClickHandler=function(e){r.ensureInitialized(u.FrameContexts.content),p.registerHandler("appButtonClick",e)},t.registerAppButtonHoverEnterHandler=function(e){r.ensureInitialized(u.FrameContexts.content),p.registerHandler("appButtonHoverEnter",e)},t.registerAppButtonHoverLeaveHandler=function(e){r.ensureInitialized(u.FrameContexts.content),p.registerHandler("appButtonHoverLeave",e)},t.registerBackButtonHandler=C,t.registerOnLoadHandler=y,t.registerBeforeUnloadHandler=w,t.registerChangeSettingsHandler=function(e){r.ensureInitialized(u.FrameContexts.content),p.registerHandler("changeSettings",e)},t.getTabInstances=function(e,t){r.ensureInitialized(),c.sendMessageToParent("getTabInstances",[t],e)},t.getMruTabInstances=function(e,t){r.ensureInitialized(),c.sendMessageToParent("getMruTabInstances",[t],e)},t.shareDeepLink=function(e){r.ensureInitialized(u.FrameContexts.content,u.FrameContexts.sidePanel,u.FrameContexts.meetingStage),c.sendMessageToParent("shareDeepLink",[e.subEntityId,e.subEntityLabel,e.subEntityWebUrl])},t.executeDeepLink=function(e,t){r.ensureInitialized(u.FrameContexts.content,u.FrameContexts.sidePanel,u.FrameContexts.settings,u.FrameContexts.task,u.FrameContexts.stage,u.FrameContexts.meetingStage),c.sendMessageToParent("executeDeepLink",[e],t||s.getGenericOnCompleteHandler())},t.setFrameContext=E,t.initializeWithFrameContext=function(e,t,n){h(t,n),E(e)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(5),i=n(2),a=n(0);t.returnFocus=function(e){r.ensureInitialized(i.FrameContexts.content),a.sendMessageToParent("returnFocus",[e])},t.navigateToTab=function(e,t){r.ensureInitialized(),a.sendMessageToParent("navigateToTab",[e],t||o.getGenericOnCompleteHandler("Invalid internalTabInstanceId and/or channelId were/was provided"))},t.navigateCrossDomain=function(e,t){r.ensureInitialized(i.FrameContexts.content,i.FrameContexts.sidePanel,i.FrameContexts.settings,i.FrameContexts.remove,i.FrameContexts.task,i.FrameContexts.stage,i.FrameContexts.meetingStage),a.sendMessageToParent("navigateCrossDomain",[e],t||o.getGenericOnCompleteHandler("Cross-origin navigation is only supported for URLs matching the pattern registered in the manifest."))},t.navigateBack=function(e){r.ensureInitialized(),a.sendMessageToParent("navigateBack",[],e||o.getGenericOnCompleteHandler("Back navigation is not supported in the current client or context."))}},function(e,t,n){var r=this&&this.__rest||function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var o=0;for(r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&(n[r[o]]=e[r[o]])}return n};Object.defineProperty(t,"__esModule",{value:!0});var o=n(2),i=n(16),a=n(0),s=n(1);!function(e){e.startTask=function(e,t){return s.ensureInitialized(o.FrameContexts.content,o.FrameContexts.sidePanel,o.FrameContexts.meetingStage),a.sendMessageToParent("tasks.startTask",[e],t),new i.ChildAppWindow},e.updateTask=function(e){s.ensureInitialized(o.FrameContexts.content,o.FrameContexts.sidePanel,o.FrameContexts.task,o.FrameContexts.meetingStage),e.width,e.height;var t=r(e,["width","height"]);if(Object.keys(t).length)throw new Error("updateTask requires a taskInfo argument containing only width and height");a.sendMessageToParent("tasks.updateTask",[e])},e.submitTask=function(e,t){s.ensureInitialized(o.FrameContexts.content,o.FrameContexts.sidePanel,o.FrameContexts.task,o.FrameContexts.meetingStage),a.sendMessageToParent("tasks.completeTask",[e,Array.isArray(t)?t:[t]])}}(t.tasks||(t.tasks={}))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=n(1),i=n(2),a=n(0),s=n(4);!function(e){e.getLocation=function(e,t){if(!t)throw new Error("[location.getLocation] Callback cannot be null");o.ensureInitialized(i.FrameContexts.content,i.FrameContexts.task),o.isAPISupportedByPlatform(s.locationAPIsRequiredVersion)?e?a.sendMessageToParent("location.getLocation",[e],t):t({errorCode:r.ErrorCode.INVALID_ARGUMENTS},void 0):t({errorCode:r.ErrorCode.OLD_PLATFORM},void 0)},e.showLocation=function(e,t){if(!t)throw new Error("[location.showLocation] Callback cannot be null");o.ensureInitialized(i.FrameContexts.content,i.FrameContexts.task),o.isAPISupportedByPlatform(s.locationAPIsRequiredVersion)?e?a.sendMessageToParent("location.showLocation",[e],t):t({errorCode:r.ErrorCode.INVALID_ARGUMENTS},void 0):t({errorCode:r.ErrorCode.OLD_PLATFORM},void 0)}}(t.location||(t.location={}))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=n(3),i=n(1),a=n(2);!function(e){!function(e){e.Unknown="Unknown",e.Adhoc="Adhoc",e.Scheduled="Scheduled",e.Recurring="Recurring",e.Broadcast="Broadcast",e.MeetNow="MeetNow"}(e.MeetingType||(e.MeetingType={})),e.getIncomingClientAudioState=function(e){if(!e)throw new Error("[get incoming client audio state] Callback cannot be null");i.ensureInitialized(),r.sendMessageToParent("getIncomingClientAudioState",e)},e.toggleIncomingClientAudio=function(e){if(!e)throw new Error("[toggle incoming client audio] Callback cannot be null");i.ensureInitialized(),r.sendMessageToParent("toggleIncomingClientAudio",e)},e.getMeetingDetails=function(e){if(!e)throw new Error("[get meeting details] Callback cannot be null");i.ensureInitialized(),r.sendMessageToParent("meeting.getMeetingDetails",e)},e.getAuthenticationTokenForAnonymousUser=function(e){if(!e)throw new Error("[get Authentication Token For AnonymousUser] Callback cannot be null");i.ensureInitialized(),r.sendMessageToParent("meeting.getAuthenticationTokenForAnonymousUser",e)},e.getLiveStreamState=function(e){if(!e)throw new Error("[get live stream state] Callback cannot be null");i.ensureInitialized(a.FrameContexts.sidePanel),r.sendMessageToParent("meeting.getLiveStreamState",e)},e.requestStartLiveStreaming=function(e,t,n){if(!e)throw new Error("[request start live streaming] Callback cannot be null");i.ensureInitialized(a.FrameContexts.sidePanel),r.sendMessageToParent("meeting.requestStartLiveStreaming",[t,n],e)},e.requestStopLiveStreaming=function(e){if(!e)throw new Error("[request stop live streaming] Callback cannot be null");i.ensureInitialized(a.FrameContexts.sidePanel),r.sendMessageToParent("meeting.requestStopLiveStreaming",e)},e.registerLiveStreamChangedHandler=function(e){if(!e)throw new Error("[register live stream changed handler] Handler cannot be null");i.ensureInitialized(a.FrameContexts.sidePanel),o.registerHandler("meeting.liveStreamChanged",e)}}(t.meeting||(t.meeting={}))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(2),i=n(7),a=n(18),s=n(0),l=n(4);(t.people||(t.people={})).selectPeople=function(e,t){if(!e)throw new Error("[people picker] Callback cannot be null");r.ensureInitialized(o.FrameContexts.content,o.FrameContexts.task,o.FrameContexts.settings),r.isAPISupportedByPlatform(l.peoplePickerRequiredVersion)?a.validatePeoplePickerInput(t)?s.sendMessageToParent("people.selectPeople",[t],e):e({errorCode:i.ErrorCode.INVALID_ARGUMENTS},null):e({errorCode:i.ErrorCode.OLD_PLATFORM},void 0)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.fileDownloadStart="fileDownloadStart",e.fileDownloadComplete="fileDownloadComplete"}(t.NotificationTypes||(t.NotificationTypes={})),function(e){e.view="view",e.edit="edit",e.editNew="editNew"}(t.ViewerActionTypes||(t.ViewerActionTypes={})),function(e){e.fileOpenPreference="fileOpenPreference",e.theme="theme"}(t.UserSettingTypes||(t.UserSettingTypes={}))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(2),i=n(0),a=n(3);!function(e){e.openConversation=function(e){r.ensureInitialized(o.FrameContexts.content),i.sendMessageToParent("conversations.openConversation",[{title:e.title,subEntityId:e.subEntityId,conversationId:e.conversationId,channelId:e.channelId,entityId:e.entityId}],(function(e,t){if(!e)throw new Error(t)})),e.onStartConversation&&a.registerHandler("startConversation",(function(t,n,r,o){return e.onStartConversation({subEntityId:t,conversationId:n,channelId:r,entityId:o})})),e.onCloseConversation&&a.registerHandler("closeConversation",(function(t,n,r,o){return e.onCloseConversation({subEntityId:t,conversationId:n,channelId:r,entityId:o})}))},e.closeConversation=function(){r.ensureInitialized(o.FrameContexts.content),i.sendMessageToParent("conversations.closeConversation"),a.removeHandler("startConversation"),a.removeHandler("closeConversation")}}(t.conversations||(t.conversations={}))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(0),i=n(3);!function(e){!function(e){e.toggleMute="toggleMute",e.toggleCamera="toggleCamera",e.toggleCaptions="toggleCaptions",e.volume="volume",e.showVideoGallery="showVideoGallery",e.showContent="showContent",e.showVideoGalleryAndContent="showVideoGalleryAndContent",e.showLargeGallery="showLargeGallery",e.showTogether="showTogether",e.leaveMeeting="leaveMeeting"}(e.Capability||(e.Capability={})),e.getPairedMeetingRoomInfo=function(e){r.ensureInitialized(),o.sendMessageToParent("meetingRoom.getPairedMeetingRoomInfo",e)},e.sendCommandToPairedMeetingRoom=function(e,t){if(!e||0==e.length)throw new Error("[meetingRoom.sendCommandToPairedMeetingRoom] Command name cannot be null or empty");if(!t)throw new Error("[meetingRoom.sendCommandToPairedMeetingRoom] Callback cannot be null");r.ensureInitialized(),o.sendMessageToParent("meetingRoom.sendCommandToPairedMeetingRoom",[e],t)},e.registerMeetingRoomCapabilitiesUpdateHandler=function(e){if(!e)throw new Error("[meetingRoom.registerMeetingRoomCapabilitiesUpdateHandler] Handler cannot be null");r.ensureInitialized(),i.registerHandler("meetingRoom.meetingRoomCapabilitiesUpdate",(function(t){r.ensureInitialized(),e(t)}))},e.registerMeetingRoomStatesUpdateHandler=function(e){if(!e)throw new Error("[meetingRoom.registerMeetingRoomStatesUpdateHandler] Handler cannot be null");r.ensureInitialized(),i.registerHandler("meetingRoom.meetingRoomStatesUpdate",(function(t){r.ensureInitialized(),e(t)}))}}(t.meetingRoom||(t.meetingRoom={}))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(1),o=n(2),i=n(0),a=n(3);!function(e){!function(e){e.Reset="Reset",e.ZoomIn="ZoomIn",e.ZoomOut="ZoomOut",e.PanLeft="PanLeft",e.PanRight="PanRight",e.TiltUp="TiltUp",e.TiltDown="TiltDown"}(e.ControlCommand||(e.ControlCommand={})),function(e){e[e.CommandResetError=0]="CommandResetError",e[e.CommandZoomInError=1]="CommandZoomInError",e[e.CommandZoomOutError=2]="CommandZoomOutError",e[e.CommandPanLeftError=3]="CommandPanLeftError",e[e.CommandPanRightError=4]="CommandPanRightError",e[e.CommandTiltUpError=5]="CommandTiltUpError",e[e.CommandTiltDownError=6]="CommandTiltDownError",e[e.SendDataError=7]="SendDataError"}(e.ErrorReason||(e.ErrorReason={})),function(e){e[e.None=0]="None",e[e.ControlDenied=1]="ControlDenied",e[e.ControlNoResponse=2]="ControlNoResponse",e[e.ControlBusy=3]="ControlBusy",e[e.AckTimeout=4]="AckTimeout",e[e.ControlTerminated=5]="ControlTerminated",e[e.ControllerTerminated=6]="ControllerTerminated",e[e.DataChannelError=7]="DataChannelError",e[e.ControllerCancelled=8]="ControllerCancelled",e[e.ControlDisabled=9]="ControlDisabled"}(e.SessionTerminatedReason||(e.SessionTerminatedReason={})),e.getCapableParticipants=function(e){if(!e)throw new Error("[remoteCamera.getCapableParticipants] Callback cannot be null");r.ensureInitialized(o.FrameContexts.sidePanel),i.sendMessageToParent("remoteCamera.getCapableParticipants",e)},e.requestControl=function(e,t){if(!e)throw new Error("[remoteCamera.requestControl] Participant cannot be null");if(!t)throw new Error("[remoteCamera.requestControl] Callback cannot be null");r.ensureInitialized(o.FrameContexts.sidePanel),i.sendMessageToParent("remoteCamera.requestControl",[e],t)},e.sendControlCommand=function(e,t){if(!e)throw new Error("[remoteCamera.sendControlCommand] ControlCommand cannot be null");if(!t)throw new Error("[remoteCamera.sendControlCommand] Callback cannot be null");r.ensureInitialized(o.FrameContexts.sidePanel),i.sendMessageToParent("remoteCamera.sendControlCommand",[e],t)},e.terminateSession=function(e){if(!e)throw new Error("[remoteCamera.terminateSession] Callback cannot be null");r.ensureInitialized(o.FrameContexts.sidePanel),i.sendMessageToParent("remoteCamera.terminateSession",e)},e.registerOnCapableParticipantsChangeHandler=function(e){if(!e)throw new Error("[remoteCamera.registerOnCapableParticipantsChangeHandler] Handler cannot be null");r.ensureInitialized(o.FrameContexts.sidePanel),a.registerHandler("remoteCamera.capableParticipantsChange",e)},e.registerOnErrorHandler=function(e){if(!e)throw new Error("[remoteCamera.registerOnErrorHandler] Handler cannot be null");r.ensureInitialized(o.FrameContexts.sidePanel),a.registerHandler("remoteCamera.handlerError",e)},e.registerOnDeviceStateChangeHandler=function(e){if(!e)throw new Error("[remoteCamera.registerOnDeviceStateChangeHandler] Handler cannot be null");r.ensureInitialized(o.FrameContexts.sidePanel),a.registerHandler("remoteCamera.deviceStateChange",e)},e.registerOnSessionStatusChangeHandler=function(e){if(!e)throw new Error("[remoteCamera.registerOnSessionStatusChangeHandler] Handler cannot be null");r.ensureInitialized(o.FrameContexts.sidePanel),a.registerHandler("remoteCamera.sessionStatusChange",e)}}(t.remoteCamera||(t.remoteCamera={}))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(8);!function(e){!function(e){e.Dropbox="DROPBOX",e.Box="BOX",e.Sharefile="SHAREFILE",e.GoogleDrive="GOOGLEDRIVE",e.Egnyte="EGNYTE"}(e.CloudStorageProvider||(e.CloudStorageProvider={})),function(e){e[e.Sharepoint=0]="Sharepoint",e[e.WopiIntegration=1]="WopiIntegration",e[e.Google=2]="Google"}(e.CloudStorageProviderType||(e.CloudStorageProviderType={})),e.getCloudStorageFolders=function(e,t){if(o.ensureInitialized(i.FrameContexts.content),!e||0==e.length)throw new Error("[files.getCloudStorageFolders] channelId name cannot be null or empty");if(!t)throw new Error("[files.getCloudStorageFolders] Callback cannot be null");r.sendMessageToParent("files.getCloudStorageFolders",[e],t)},e.addCloudStorageFolder=function(e,t){if(o.ensureInitialized(i.FrameContexts.content),!e||0==e.length)throw new Error("[files.addCloudStorageFolder] channelId name cannot be null or empty");if(!t)throw new Error("[files.addCloudStorageFolder] Callback cannot be null");r.sendMessageToParent("files.addCloudStorageFolder",[e],t)},e.deleteCloudStorageFolder=function(e,t,n){if(o.ensureInitialized(i.FrameContexts.content),!e)throw new Error("[files.deleteCloudStorageFolder] channelId name cannot be null or empty");if(!t)throw new Error("[files.deleteCloudStorageFolder] folderToDelete cannot be null or empty");if(!n)throw new Error("[files.deleteCloudStorageFolder] Callback cannot be null");r.sendMessageToParent("files.deleteCloudStorageFolder",[e,t],n)},e.getCloudStorageFolderContents=function(e,t,n){if(o.ensureInitialized(i.FrameContexts.content),!e||!t)throw new Error("[files.getCloudStorageFolderContents] folder/providerCode name cannot be null or empty");if(!n)throw new Error("[files.getCloudStorageFolderContents] Callback cannot be null");if("isSubdirectory"in e&&!e.isSubdirectory)throw new Error("[files.getCloudStorageFolderContents] provided folder is not a subDirectory");r.sendMessageToParent("files.getCloudStorageFolderContents",[e,t],n)},e.openCloudStorageFile=function(e,t,n){if(o.ensureInitialized(i.FrameContexts.content),!e||!t)throw new Error("[files.openCloudStorageFile] file/providerCode cannot be null or empty");if(e.isSubdirectory)throw new Error("[files.openCloudStorageFile] provided file is a subDirectory");r.sendMessageToParent("files.openCloudStorageFile",[e,t,n])}}(t.files||(t.files={}))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(0),o=n(1),i=n(8);(t.appEntity||(t.appEntity={})).selectAppEntity=function(e,t,n){if(o.ensureInitialized(i.FrameContexts.content),!e||0==e.length)throw new Error("[appEntity.selectAppEntity] threadId name cannot be null or empty");if(!n)throw new Error("[appEntity.selectAppEntity] Callback cannot be null");r.sendMessageToParent("appEntity.selectAppEntity",[e,t],n)}}])}))),S="undefined"!=typeof process&&!!process.version&&!!process.versions&&!!process.versions.node;var P,I="undefined"!=typeof process&&process.env&&process.env.DEBUG||void 0,O=[],A=[],R=[];I&&x(I);var M=Object.assign((function(e){return k(e)}),{enable:x,enabled:_,disable:function(){var e=P||"";return x(""),e},log:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(e.length>0){var n=String(e[0]);n.includes(":error")?console.error.apply(console,i(e)):n.includes(":warning")?console.warn.apply(console,i(e)):n.includes(":info")?console.info.apply(console,i(e)):(n.includes(":verbose"),console.debug.apply(console,i(e)))}}});function x(e){var t,n,o,i;P=e,O=[],A=[];var a=/\*/g,s=e.split(",").map((function(e){return e.trim().replace(a,".*?")}));try{for(var l=r(s),u=l.next();!u.done;u=l.next()){var c=u.value;c.startsWith("-")?A.push(new RegExp("^"+c.substr(1)+"$")):O.push(new RegExp("^"+c+"$"))}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=l.return)&&n.call(l)}finally{if(t)throw t.error}}try{for(var d=r(R),f=d.next();!f.done;f=d.next()){var p=f.value;p.enabled=_(p.namespace)}}catch(e){o={error:e}}finally{try{f&&!f.done&&(i=d.return)&&i.call(d)}finally{if(o)throw o.error}}}function _(e){var t,n,o,i;if(e.endsWith("*"))return!0;try{for(var a=r(A),s=a.next();!s.done;s=a.next()){if(s.value.test(e))return!1}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}try{for(var l=r(O),u=l.next();!u.done;u=l.next()){if(u.value.test(e))return!0}}catch(e){o={error:e}}finally{try{u&&!u.done&&(i=l.return)&&i.call(l)}finally{if(o)throw o.error}}return!1}function k(e){var t=Object.assign((function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];if(!t.enabled)return;n.length>0&&(n[0]=e+" "+n[0]);t.log.apply(t,i(n))}),{enabled:_(e),destroy:F,log:M.log,namespace:e,extend:N});return R.push(t),t}function F(){var e=R.indexOf(this);return e>=0&&(R.splice(e,1),!0)}function N(e){var t=k(this.namespace+":"+e);return t.log=this.log,t}var D,L=new Set,U="undefined"!=typeof process&&process.env&&process.env.AZURE_LOG_LEVEL||void 0,H=M("azure");H.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];M.log.apply(M,i(e))};var z=["verbose","info","warning","error"];U&&(q(U)?function(e){var t,n;if(e&&!q(e))throw new Error("Unknown log level '"+e+"'. Acceptable values: "+z.join(","));D=e;var o=[];try{for(var i=r(L),a=i.next();!a.done;a=i.next()){var s=a.value;G(s)&&o.push(s.namespace)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}M.enable(o.join(","))}(U):console.error("AZURE_LOG_LEVEL set to unknown log level '"+U+"'; logging is not enabled. Acceptable values: "+z.join(", ")+"."));var B,V={verbose:400,info:300,warning:200,error:100};function j(e,t){t.log=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];e.log.apply(e,i(t))}}function W(e,t){var n=Object.assign(e.extend(t),{level:t});if(j(e,n),G(n)){var r=M.disable();M.enable(r+","+n.namespace)}return L.add(n),n}function G(e){return!!(D&&V[e.level]<=V[D])}function q(e){return z.includes(e)}let Q;function $(t){if(p.info("load configuration"),!S){if(!t){const t="You are running the code in browser. Configuration must be passed in.";throw p.error(t),new ErrorWithCode(t,e.InvalidParameter)}return void(Q=t)}let n,r=[];n=(null==t?void 0:t.authentication)?t.authentication:{authorityHost:process.env.M365_AUTHORITY_HOST,tenantId:process.env.M365_TENANT_ID,clientId:process.env.M365_CLIENT_ID,clientSecret:process.env.M365_CLIENT_SECRET,simpleAuthEndpoint:process.env.SIMPLE_AUTH_ENDPOINT,initiateLoginEndpoint:process.env.INITIATE_LOGIN_ENDPOINT,applicationIdUri:process.env.M365_APPLICATION_ID_URI},r=(null==t?void 0:t.resources)?t.resources:[{type:B.SQL,name:"default",properties:{sqlServerEndpoint:process.env.SQL_ENDPOINT,sqlUsername:process.env.SQL_USER_NAME,sqlPassword:process.env.SQL_PASSWORD,sqlDatabaseName:process.env.SQL_DATABASE_NAME,sqlIdentityId:process.env.IDENTITY_ID}},{type:B.API,name:"default",properties:{endpoint:process.env.API_ENDPOINT}}],Q={authentication:n,resources:r}}function X(n,r="default"){var o;p.info(`Get resource configuration of ${B[n]} from ${r}`);const i=null===(o=Q.resources)||void 0===o?void 0:o.find(e=>e.type===n&&e.name===r);if(i)return i.properties;const a=v(t.MissingResourceConfiguration,B[n],r);throw p.error(a),new ErrorWithCode(a,e.InvalidConfiguration)}function Y(){if(p.info("Get authentication configuration"),Q)return Q.authentication;const n="Please call loadConfiguration() first before calling getAuthenticationConfiguration().";throw p.error(n),new ErrorWithCode(v(t.ConfigurationNotExists,n),e.InvalidConfiguration)}!function(e){e[e.SQL=0]="SQL",e[e.API=1]="API"}(B||(B={}));var J=function(e,t){return function(){for(var n=new Array(arguments.length),r=0;r<n.length;r++)n[r]=arguments[r];return e.apply(t,n)}},K=Object.prototype.toString;function Z(e){return"[object Array]"===K.call(e)}function ee(e){return void 0===e}function te(e){return null!==e&&"object"==typeof e}function ne(e){if("[object Object]"!==K.call(e))return!1;var t=Object.getPrototypeOf(e);return null===t||t===Object.prototype}function re(e){return"[object Function]"===K.call(e)}function oe(e,t){if(null!=e)if("object"!=typeof e&&(e=[e]),Z(e))for(var n=0,r=e.length;n<r;n++)t.call(null,e[n],n,e);else for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.call(null,e[o],o,e)}var ie={isArray:Z,isArrayBuffer:function(e){return"[object ArrayBuffer]"===K.call(e)},isBuffer:function(e){return null!==e&&!ee(e)&&null!==e.constructor&&!ee(e.constructor)&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)},isFormData:function(e){return"undefined"!=typeof FormData&&e instanceof FormData},isArrayBufferView:function(e){return"undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer&&e.buffer instanceof ArrayBuffer},isString:function(e){return"string"==typeof e},isNumber:function(e){return"number"==typeof e},isObject:te,isPlainObject:ne,isUndefined:ee,isDate:function(e){return"[object Date]"===K.call(e)},isFile:function(e){return"[object File]"===K.call(e)},isBlob:function(e){return"[object Blob]"===K.call(e)},isFunction:re,isStream:function(e){return te(e)&&re(e.pipe)},isURLSearchParams:function(e){return"undefined"!=typeof URLSearchParams&&e instanceof URLSearchParams},isStandardBrowserEnv:function(){return("undefined"==typeof navigator||"ReactNative"!==navigator.product&&"NativeScript"!==navigator.product&&"NS"!==navigator.product)&&("undefined"!=typeof window&&"undefined"!=typeof document)},forEach:oe,merge:function e(){var t={};function n(n,r){ne(t[r])&&ne(n)?t[r]=e(t[r],n):ne(n)?t[r]=e({},n):Z(n)?t[r]=n.slice():t[r]=n}for(var r=0,o=arguments.length;r<o;r++)oe(arguments[r],n);return t},extend:function(e,t,n){return oe(t,(function(t,r){e[r]=n&&"function"==typeof t?J(t,n):t})),e},trim:function(e){return e.replace(/^\s*/,"").replace(/\s*$/,"")},stripBOM:function(e){return 65279===e.charCodeAt(0)&&(e=e.slice(1)),e}};function ae(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}var se=function(e,t,n){if(!t)return e;var r;if(n)r=n(t);else if(ie.isURLSearchParams(t))r=t.toString();else{var o=[];ie.forEach(t,(function(e,t){null!=e&&(ie.isArray(e)?t+="[]":e=[e],ie.forEach(e,(function(e){ie.isDate(e)?e=e.toISOString():ie.isObject(e)&&(e=JSON.stringify(e)),o.push(ae(t)+"="+ae(e))})))})),r=o.join("&")}if(r){var i=e.indexOf("#");-1!==i&&(e=e.slice(0,i)),e+=(-1===e.indexOf("?")?"?":"&")+r}return e};function le(){this.handlers=[]}le.prototype.use=function(e,t){return this.handlers.push({fulfilled:e,rejected:t}),this.handlers.length-1},le.prototype.eject=function(e){this.handlers[e]&&(this.handlers[e]=null)},le.prototype.forEach=function(e){ie.forEach(this.handlers,(function(t){null!==t&&e(t)}))};var ue=le,ce=function(e,t,n){return ie.forEach(n,(function(n){e=n(e,t)})),e},de=function(e){return!(!e||!e.__CANCEL__)},fe=function(e,t){ie.forEach(e,(function(n,r){r!==t&&r.toUpperCase()===t.toUpperCase()&&(e[t]=n,delete e[r])}))},pe=function(e,t,n,r,o){return function(e,t,n,r,o){return e.config=t,n&&(e.code=n),e.request=r,e.response=o,e.isAxiosError=!0,e.toJSON=function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code}},e}(new Error(e),t,n,r,o)},he=ie.isStandardBrowserEnv()?{write:function(e,t,n,r,o,i){var a=[];a.push(e+"="+encodeURIComponent(t)),ie.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),ie.isString(r)&&a.push("path="+r),ie.isString(o)&&a.push("domain="+o),!0===i&&a.push("secure"),document.cookie=a.join("; ")},read:function(e){var t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},me=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"],ge=ie.isStandardBrowserEnv()?function(){var e,t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");function r(e){var r=e;return t&&(n.setAttribute("href",r),r=n.href),n.setAttribute("href",r),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:"/"===n.pathname.charAt(0)?n.pathname:"/"+n.pathname}}return e=r(window.location.href),function(t){var n=ie.isString(t)?r(t):t;return n.protocol===e.protocol&&n.host===e.host}}():function(){return!0},ve=function(e){return new Promise((function(t,n){var r=e.data,o=e.headers;ie.isFormData(r)&&delete o["Content-Type"];var i=new XMLHttpRequest;if(e.auth){var a=e.auth.username||"",s=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";o.Authorization="Basic "+btoa(a+":"+s)}var l,u,c=(l=e.baseURL,u=e.url,l&&!/^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(u)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(l,u):u);if(i.open(e.method.toUpperCase(),se(c,e.params,e.paramsSerializer),!0),i.timeout=e.timeout,i.onreadystatechange=function(){if(i&&4===i.readyState&&(0!==i.status||i.responseURL&&0===i.responseURL.indexOf("file:"))){var r,o,a,s,l,u="getAllResponseHeaders"in i?(r=i.getAllResponseHeaders(),l={},r?(ie.forEach(r.split("\n"),(function(e){if(s=e.indexOf(":"),o=ie.trim(e.substr(0,s)).toLowerCase(),a=ie.trim(e.substr(s+1)),o){if(l[o]&&me.indexOf(o)>=0)return;l[o]="set-cookie"===o?(l[o]?l[o]:[]).concat([a]):l[o]?l[o]+", "+a:a}})),l):l):null,c={data:e.responseType&&"text"!==e.responseType?i.response:i.responseText,status:i.status,statusText:i.statusText,headers:u,config:e,request:i};!function(e,t,n){var r=n.config.validateStatus;n.status&&r&&!r(n.status)?t(pe("Request failed with status code "+n.status,n.config,null,n.request,n)):e(n)}(t,n,c),i=null}},i.onabort=function(){i&&(n(pe("Request aborted",e,"ECONNABORTED",i)),i=null)},i.onerror=function(){n(pe("Network Error",e,null,i)),i=null},i.ontimeout=function(){var t="timeout of "+e.timeout+"ms exceeded";e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),n(pe(t,e,"ECONNABORTED",i)),i=null},ie.isStandardBrowserEnv()){var d=(e.withCredentials||ge(c))&&e.xsrfCookieName?he.read(e.xsrfCookieName):void 0;d&&(o[e.xsrfHeaderName]=d)}if("setRequestHeader"in i&&ie.forEach(o,(function(e,t){void 0===r&&"content-type"===t.toLowerCase()?delete o[t]:i.setRequestHeader(t,e)})),ie.isUndefined(e.withCredentials)||(i.withCredentials=!!e.withCredentials),e.responseType)try{i.responseType=e.responseType}catch(t){if("json"!==e.responseType)throw t}"function"==typeof e.onDownloadProgress&&i.addEventListener("progress",e.onDownloadProgress),"function"==typeof e.onUploadProgress&&i.upload&&i.upload.addEventListener("progress",e.onUploadProgress),e.cancelToken&&e.cancelToken.promise.then((function(e){i&&(i.abort(),n(e),i=null)})),r||(r=null),i.send(r)}))},Ce={"Content-Type":"application/x-www-form-urlencoded"};function ye(e,t){!ie.isUndefined(e)&&ie.isUndefined(e["Content-Type"])&&(e["Content-Type"]=t)}var we,Ee={adapter:(("undefined"!=typeof XMLHttpRequest||"undefined"!=typeof process&&"[object process]"===Object.prototype.toString.call(process))&&(we=ve),we),transformRequest:[function(e,t){return fe(t,"Accept"),fe(t,"Content-Type"),ie.isFormData(e)||ie.isArrayBuffer(e)||ie.isBuffer(e)||ie.isStream(e)||ie.isFile(e)||ie.isBlob(e)?e:ie.isArrayBufferView(e)?e.buffer:ie.isURLSearchParams(e)?(ye(t,"application/x-www-form-urlencoded;charset=utf-8"),e.toString()):ie.isObject(e)?(ye(t,"application/json;charset=utf-8"),JSON.stringify(e)):e}],transformResponse:[function(e){if("string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,validateStatus:function(e){return e>=200&&e<300}};Ee.headers={common:{Accept:"application/json, text/plain, */*"}},ie.forEach(["delete","get","head"],(function(e){Ee.headers[e]={}})),ie.forEach(["post","put","patch"],(function(e){Ee.headers[e]=ie.merge(Ce)}));var Te=Ee;function be(e){e.cancelToken&&e.cancelToken.throwIfRequested()}var Se=function(e){return be(e),e.headers=e.headers||{},e.data=ce(e.data,e.headers,e.transformRequest),e.headers=ie.merge(e.headers.common||{},e.headers[e.method]||{},e.headers),ie.forEach(["delete","get","head","post","put","patch","common"],(function(t){delete e.headers[t]})),(e.adapter||Te.adapter)(e).then((function(t){return be(e),t.data=ce(t.data,t.headers,e.transformResponse),t}),(function(t){return de(t)||(be(e),t&&t.response&&(t.response.data=ce(t.response.data,t.response.headers,e.transformResponse))),Promise.reject(t)}))},Pe=function(e,t){t=t||{};var n={},r=["url","method","data"],o=["headers","auth","proxy","params"],i=["baseURL","transformRequest","transformResponse","paramsSerializer","timeout","timeoutMessage","withCredentials","adapter","responseType","xsrfCookieName","xsrfHeaderName","onUploadProgress","onDownloadProgress","decompress","maxContentLength","maxBodyLength","maxRedirects","transport","httpAgent","httpsAgent","cancelToken","socketPath","responseEncoding"],a=["validateStatus"];function s(e,t){return ie.isPlainObject(e)&&ie.isPlainObject(t)?ie.merge(e,t):ie.isPlainObject(t)?ie.merge({},t):ie.isArray(t)?t.slice():t}function l(r){ie.isUndefined(t[r])?ie.isUndefined(e[r])||(n[r]=s(void 0,e[r])):n[r]=s(e[r],t[r])}ie.forEach(r,(function(e){ie.isUndefined(t[e])||(n[e]=s(void 0,t[e]))})),ie.forEach(o,l),ie.forEach(i,(function(r){ie.isUndefined(t[r])?ie.isUndefined(e[r])||(n[r]=s(void 0,e[r])):n[r]=s(void 0,t[r])})),ie.forEach(a,(function(r){r in t?n[r]=s(e[r],t[r]):r in e&&(n[r]=s(void 0,e[r]))}));var u=r.concat(o).concat(i).concat(a),c=Object.keys(e).concat(Object.keys(t)).filter((function(e){return-1===u.indexOf(e)}));return ie.forEach(c,l),n};function Ie(e){this.defaults=e,this.interceptors={request:new ue,response:new ue}}Ie.prototype.request=function(e){"string"==typeof e?(e=arguments[1]||{}).url=arguments[0]:e=e||{},(e=Pe(this.defaults,e)).method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var t=[Se,void 0],n=Promise.resolve(e);for(this.interceptors.request.forEach((function(e){t.unshift(e.fulfilled,e.rejected)})),this.interceptors.response.forEach((function(e){t.push(e.fulfilled,e.rejected)}));t.length;)n=n.then(t.shift(),t.shift());return n},Ie.prototype.getUri=function(e){return e=Pe(this.defaults,e),se(e.url,e.params,e.paramsSerializer).replace(/^\?/,"")},ie.forEach(["delete","get","head","options"],(function(e){Ie.prototype[e]=function(t,n){return this.request(Pe(n||{},{method:e,url:t,data:(n||{}).data}))}})),ie.forEach(["post","put","patch"],(function(e){Ie.prototype[e]=function(t,n,r){return this.request(Pe(r||{},{method:e,url:t,data:n}))}}));var Oe=Ie;function Ae(e){this.message=e}Ae.prototype.toString=function(){return"Cancel"+(this.message?": "+this.message:"")},Ae.prototype.__CANCEL__=!0;var Re=Ae;function Me(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");var t;this.promise=new Promise((function(e){t=e}));var n=this;e((function(e){n.reason||(n.reason=new Re(e),t(n.reason))}))}Me.prototype.throwIfRequested=function(){if(this.reason)throw this.reason},Me.source=function(){var e;return{token:new Me((function(t){e=t})),cancel:e}};var xe=Me;function _e(e){var t=new Oe(e),n=J(Oe.prototype.request,t);return ie.extend(n,Oe.prototype,t),ie.extend(n,t),n}var ke=_e(Te);ke.Axios=Oe,ke.create=function(e){return _e(Pe(ke.defaults,e))},ke.Cancel=Re,ke.CancelToken=xe,ke.isCancel=de,ke.all=function(e){return Promise.all(e)},ke.spread=function(e){return function(t){return e.apply(null,t)}},ke.isAxiosError=function(e){return"object"==typeof e&&!0===e.isAxiosError};var Fe=ke,Ne=ke;Fe.default=Ne;var De,Le=Fe;!function(e){e.authCode="authorization_code",e.ssoToken="sso_token"}(De||(De={}));const Ue="accessToken";class He{constructor(){p.info("Create teams user credential"),this.config=this.loadAndValidateConfig(),this.ssoToken=null}login(t){return n(this,void 0,void 0,(function*(){C(t);const r="string"==typeof t?t:t.join(" ");return p.info("Popup login page to get user's access token with scopes: "+r),new Promise((t,o)=>{b.initialize(()=>{b.authentication.authenticate({url:`${this.config.initiateLoginEndpoint}?clientId=${this.config.clientId}&scope=${encodeURI(r)}`,width:600,height:535,successCallback:i=>n(this,void 0,void 0,(function*(){if(!i){const t="Get empty authentication result from Teams";return p.error(t),void o(new ErrorWithCode(t,e.InternalError))}const n=JSON.parse(i);try{yield this.exchangeAccessTokenFromSimpleAuthServer(r,n),t()}catch(e){o(this.generateAuthServerError(e))}})),failureCallback:t=>{const n=`Consent failed for the scope ${r} with error: ${t}`;p.error(n),o(new ErrorWithCode(n,e.ConsentFailed))}})})})}))}getToken(e,t){return n(this,void 0,void 0,(function*(){C(e);const t=yield this.getSSOToken(),n="string"==typeof e?e:e.join(" ");if(""===n)return p.info("Get SSO token"),t;{p.info("Get access token with scopes: "+n);const e=yield this.getAccessTokenCacheKey(n),t=this.getTokenCache(e);if(t){if(!this.isAccessTokenNearExpired(t))return p.verbose("Get access token from cache"),t;p.verbose("Cached access token is expired")}else p.verbose("No cached access token");return yield this.getAndCacheAccessTokenFromSimpleAuthServer(n)}}))}getUserInfo(){return n(this,void 0,void 0,(function*(){p.info("Get basic user info from SSO token");return function(t){if(!t){const t="SSO token is undefined.";throw p.error(t),new ErrorWithCode(t,e.InvalidParameter)}const n=g(t),r={displayName:n.name,objectId:n.oid,preferredUserName:""};return"2.0"===n.ver?r.preferredUserName=n.preferred_username:"1.0"===n.ver&&(r.preferredUserName=n.upn),r}((yield this.getSSOToken()).token)}))}exchangeAccessTokenFromSimpleAuthServer(e,t){var r,o;return n(this,void 0,void 0,(function*(){const n=yield this.getAxiosInstance();let i=0;for(;;)try{const r=(yield n.post("/auth/token",{scope:e,code:t.code,code_verifier:t.codeVerifier,redirect_uri:t.redirectUri,grant_type:De.authCode})).data,o=yield this.getAccessTokenCacheKey(e);return void this.setTokenCache(o,{token:r.access_token,expiresOnTimestamp:r.expires_on})}catch(e){if((null===(o=null===(r=e.response)||void 0===r?void 0:r.data)||void 0===o?void 0:o.type)&&"AadUiRequiredException"===e.response.data.type&&(p.warn("Exchange access token failed, retry..."),i<3)){yield this.sleep(3e3),i++;continue}throw e}}))}getAndCacheAccessTokenFromSimpleAuthServer(e){return n(this,void 0,void 0,(function*(){try{p.verbose("Get access token from authentication server with scopes: "+e);const t=yield this.getAxiosInstance(),n=(yield t.post("/auth/token",{scope:e,grant_type:De.ssoToken})).data,r={token:n.access_token,expiresOnTimestamp:n.expires_on},o=yield this.getAccessTokenCacheKey(e);return this.setTokenCache(o,r),r}catch(e){throw this.generateAuthServerError(e)}}))}getSSOToken(){return new Promise((t,n)=>{if(this.ssoToken&&this.ssoToken.expiresOnTimestamp-Date.now()>3e5)return p.verbose("Get SSO token from memory cache"),void t(this.ssoToken);let r=!1;b.initialize(()=>{r=!0,b.authentication.getAuthToken({successCallback:r=>{if(!r){const t="Get empty SSO token from Teams";return p.error(t),void n(new ErrorWithCode(t,e.InternalError))}const o=g(r);if("1.0"!==o.ver&&"2.0"!==o.ver){const t="SSO token is not valid with an unknown version: "+o.ver;return p.error(t),void n(new ErrorWithCode(t,e.InternalError))}const i={token:r,expiresOnTimestamp:1e3*o.exp};this.ssoToken=i,t(i)},failureCallback:t=>{const r="Get SSO token failed with error: "+t;p.error(r),n(new ErrorWithCode(r,e.InternalError))},resources:[]})}),setTimeout(()=>{if(!r){const t="Initialize teams sdk timeout, maybe the code is not running inside Teams";p.error(t),n(new ErrorWithCode(t,e.InternalError))}},5e3)})}loadAndValidateConfig(){p.verbose("Validate authentication configuration");const n=Y();if(!n)throw p.error(t.AuthenticationConfigurationNotExists),new ErrorWithCode(t.AuthenticationConfigurationNotExists,e.InvalidConfiguration);if(n.initiateLoginEndpoint&&n.simpleAuthEndpoint&&n.clientId)return n;const r=[];n.initiateLoginEndpoint||r.push("initiateLoginEndpoint"),n.simpleAuthEndpoint||r.push("simpleAuthEndpoint"),n.clientId||r.push("clientId");const o=v(t.InvalidConfiguration,r.join(", "),"undefined");throw p.error(o),new ErrorWithCode(o,e.InvalidConfiguration)}getAxiosInstance(){return n(this,void 0,void 0,(function*(){const e=yield this.getSSOToken(),t=Le.create({baseURL:this.config.simpleAuthEndpoint});return t.interceptors.request.use(t=>(t.headers.Authorization="Bearer "+e.token,t)),t}))}setTokenCache(e,t){E.set(e,JSON.stringify(t))}getTokenCache(e){const t=E.get(e);if(null===t)return null;return this.validateAndParseJson(t)}validateAndParseJson(e){try{const t=JSON.parse(e);return t&&"object"==typeof t?t:null}catch(e){return null}}getAccessTokenCacheKey(e){return n(this,void 0,void 0,(function*(){const t=g((yield this.getSSOToken()).token),n=this.config.clientId,r=t.oid,o=t.tid;return[Ue,r,n,o,e].join("-").replace(/" "/g,"_")}))}isAccessTokenNearExpired(e){return!(new Date(e.expiresOnTimestamp).getTime()-Date.now()>3e5)}generateAuthServerError(t){var n,r;let o=t.message;if(null===(r=null===(n=t.response)||void 0===n?void 0:n.data)||void 0===r?void 0:r.type){if(o=t.response.data.detail,"AadUiRequiredException"===t.response.data.type){const t="Failed to get access token from authentication server, please login first: "+o;return p.warn(t),new ErrorWithCode(t,e.UiRequiredError)}{const t="Failed to get access token from authentication server: "+o;return p.error(t),new ErrorWithCode(t,e.ServiceError)}}return new ErrorWithCode("Failed to get access token with error: "+o,e.InternalError)}sleep(e){return new Promise(t=>setTimeout(t,e))}}class ze{constructor(e,t){this.credential=e;let n="https://graph.microsoft.com/.default";t&&(C(t),n="string"==typeof t?t:t.join(" "),""===n&&(n="https://graph.microsoft.com/.default")),p.info(`Create Microsoft Graph Authentication Provider with scopes: '${n}'`),this.scopes=n}getAccessToken(){return n(this,void 0,void 0,(function*(){p.info(`Get Graph Access token with scopes: '${this.scopes}'`);const t=yield this.credential.getToken(this.scopes);return new Promise((n,r)=>{if(t)n(t.token);else{const t="Graph access token is undefined or empty";p.error(t),r(new ErrorWithCode(t,e.InternalError))}})}))}}class Be{constructor(n,r){throw this.settings=r,new ErrorWithCode(v(t.BrowserRuntimeNotSupported,"TeamsBotSsoPrompt"),e.RuntimeNotSupported)}beginDialog(r){return n(this,void 0,void 0,(function*(){throw new ErrorWithCode(v(t.BrowserRuntimeNotSupported,"TeamsBotSsoPrompt"),e.RuntimeNotSupported)}))}continueDialog(r){return n(this,void 0,void 0,(function*(){throw new ErrorWithCode(v(t.BrowserRuntimeNotSupported,"TeamsBotSsoPrompt"),e.RuntimeNotSupported)}))}}
|
|
16
|
+
/*! *****************************************************************************
|
|
17
|
+
Copyright (c) Microsoft Corporation.
|
|
18
|
+
|
|
19
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
20
|
+
purpose with or without fee is hereby granted.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
23
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
24
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
25
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
26
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
27
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
28
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
29
|
+
***************************************************************************** */function Ve(e,t,n,r){return new(n||(n=Promise))((function(o,i){function a(e){try{l(r.next(e))}catch(e){i(e)}}function s(e){try{l(r.throw(e))}catch(e){i(e)}}function l(e){var t;e.done?o(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}l((r=r.apply(e,t||[])).next())}))}var je;!function(e){e.GET="GET",e.PATCH="PATCH",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE"}(je||(je={}));class We{constructor(e=[]){this.middlewareOptions=new Map;for(const t of e){const e=t.constructor;this.middlewareOptions.set(e,t)}}getMiddlewareOptions(e){return this.middlewareOptions.get(e)}setMiddlewareOptions(e,t){this.middlewareOptions.set(e,t)}}const Ge=(e,t,n)=>{let r=null;if("undefined"!=typeof Request&&e instanceof Request)r=e.headers.get(n);else if(void 0!==t&&void 0!==t.headers)if("undefined"!=typeof Headers&&t.headers instanceof Headers)r=t.headers.get(n);else if(t.headers instanceof Array){const e=t.headers;for(let t=0,o=e.length;t<o;t++)if(e[t][0]===n){r=e[t][1];break}}else void 0!==t.headers[n]&&(r=t.headers[n]);return r},qe=(e,t,n,r)=>{if("undefined"!=typeof Request&&e instanceof Request)e.headers.set(n,r);else if(void 0!==t)if(void 0===t.headers)t.headers=new Headers({[n]:r});else if("undefined"!=typeof Headers&&t.headers instanceof Headers)t.headers.set(n,r);else if(t.headers instanceof Array){let e=0;const o=t.headers.length;for(;e<o;e++){const o=t.headers[e];if(o[0]===n){o[1]=r;break}}e===o&&t.headers.push([n,r])}else Object.assign(t.headers,{[n]:r})},Qe=(e,t,n,r)=>{"undefined"!=typeof Request&&e instanceof Request?e.headers.append(n,r):void 0!==t&&(void 0===t.headers?t.headers=new Headers({[n]:r}):"undefined"!=typeof Headers&&t.headers instanceof Headers?t.headers.append(n,r):t.headers instanceof Array?t.headers.push([n,r]):void 0===t.headers?t.headers={[n]:r}:void 0===t.headers[n]?t.headers[n]=r:t.headers[n]+=", "+r)};class $e{constructor(e,t){this.authenticationProvider=e,this.authenticationProviderOptions=t}}var Xe;!function(e){e[e.NONE=0]="NONE",e[e.REDIRECT_HANDLER_ENABLED=1]="REDIRECT_HANDLER_ENABLED",e[e.RETRY_HANDLER_ENABLED=2]="RETRY_HANDLER_ENABLED",e[e.AUTHENTICATION_HANDLER_ENABLED=4]="AUTHENTICATION_HANDLER_ENABLED"}(Xe||(Xe={}));class Ye{constructor(){this.featureUsage=Xe.NONE}static updateFeatureUsageFlag(e,t){let n;e.middlewareControl instanceof We?n=e.middlewareControl.getMiddlewareOptions(Ye):e.middlewareControl=new We,void 0===n&&(n=new Ye,e.middlewareControl.setMiddlewareOptions(Ye,n)),n.setFeatureUsage(t)}setFeatureUsage(e){this.featureUsage=this.featureUsage|e}getFeatureUsage(){return this.featureUsage.toString(16)}}class Je{constructor(e){this.authenticationProvider=e}execute(e){return Ve(this,void 0,void 0,(function*(){try{let t,n,r;e.middlewareControl instanceof We&&(t=e.middlewareControl.getMiddlewareOptions($e)),void 0!==t&&(n=t.authenticationProvider,r=t.authenticationProviderOptions),void 0===n&&(n=this.authenticationProvider);const o="Bearer "+(yield n.getAccessToken(r));return Qe(e.request,e.options,Je.AUTHORIZATION_HEADER,o),Ye.updateFeatureUsageFlag(e,Xe.AUTHENTICATION_HANDLER_ENABLED),yield this.nextMiddleware.execute(e)}catch(e){throw e}}))}setNext(e){this.nextMiddleware=e}}Je.AUTHORIZATION_HEADER="Authorization";class Ke{execute(e){return Ve(this,void 0,void 0,(function*(){try{return void(e.response=yield fetch(e.request,e.options))}catch(e){throw e}}))}}class Ze{constructor(e=Ze.DEFAULT_DELAY,t=Ze.DEFAULT_MAX_RETRIES,n=Ze.DEFAULT_SHOULD_RETRY){if(e>Ze.MAX_DELAY&&t>Ze.MAX_MAX_RETRIES){const e=new Error(`Delay and MaxRetries should not be more than ${Ze.MAX_DELAY} and ${Ze.MAX_MAX_RETRIES}`);throw e.name="MaxLimitExceeded",e}if(e>Ze.MAX_DELAY){const e=new Error("Delay should not be more than "+Ze.MAX_DELAY);throw e.name="MaxLimitExceeded",e}if(t>Ze.MAX_MAX_RETRIES){const e=new Error("MaxRetries should not be more than "+Ze.MAX_MAX_RETRIES);throw e.name="MaxLimitExceeded",e}if(e<0&&t<0){const e=new Error("Delay and MaxRetries should not be negative");throw e.name="MinExpectationNotMet",e}if(e<0){const e=new Error("Delay should not be negative");throw e.name="MinExpectationNotMet",e}if(t<0){const e=new Error("MaxRetries should not be negative");throw e.name="MinExpectationNotMet",e}this.delay=Math.min(e,Ze.MAX_DELAY),this.maxRetries=Math.min(t,Ze.MAX_MAX_RETRIES),this.shouldRetry=n}getMaxDelay(){return Ze.MAX_DELAY}}Ze.DEFAULT_DELAY=3,Ze.DEFAULT_MAX_RETRIES=3,Ze.MAX_DELAY=180,Ze.MAX_MAX_RETRIES=10,Ze.DEFAULT_SHOULD_RETRY=()=>!0;class et{constructor(e=new Ze){this.options=e}isRetry(e){return-1!==et.RETRY_STATUS_CODES.indexOf(e.status)}isBuffered(e,t){const n="string"==typeof e?t.method:e.method;if(n===je.PUT||n===je.PATCH||n===je.POST){if("application/octet-stream"===Ge(e,t,"Content-Type"))return!1}return!0}getDelay(e,t,n){const r=()=>Number(Math.random().toFixed(3)),o=void 0!==e.headers?e.headers.get(et.RETRY_AFTER_HEADER):null;let i;return i=null!==o?Number.isNaN(Number(o))?Math.round((new Date(o).getTime()-Date.now())/1e3):Number(o):t>=2?this.getExponentialBackOffTime(t)+n+r():n+r(),Math.min(i,this.options.getMaxDelay()+r())}getExponentialBackOffTime(e){return Math.round(.5*(Math.pow(2,e)-1))}sleep(e){return Ve(this,void 0,void 0,(function*(){const t=1e3*e;return new Promise(e=>setTimeout(e,t))}))}getOptions(e){let t;return e.middlewareControl instanceof We&&(t=e.middlewareControl.getMiddlewareOptions(this.options.constructor)),void 0===t&&(t=Object.assign(new Ze,this.options)),t}executeWithRetry(e,t,n){return Ve(this,void 0,void 0,(function*(){try{if(yield this.nextMiddleware.execute(e),t<n.maxRetries&&this.isRetry(e.response)&&this.isBuffered(e.request,e.options)&&n.shouldRetry(n.delay,t,e.request,e.options,e.response)){++t,qe(e.request,e.options,et.RETRY_ATTEMPT_HEADER,t.toString());const r=this.getDelay(e.response,t,n.delay);return yield this.sleep(r),yield this.executeWithRetry(e,t,n)}return}catch(e){throw e}}))}execute(e){return Ve(this,void 0,void 0,(function*(){try{const t=0,n=this.getOptions(e);return Ye.updateFeatureUsageFlag(e,Xe.RETRY_HANDLER_ENABLED),yield this.executeWithRetry(e,t,n)}catch(e){throw e}}))}setNext(e){this.nextMiddleware=e}}et.RETRY_STATUS_CODES=[429,503,504],et.RETRY_ATTEMPT_HEADER="Retry-Attempt",et.RETRY_AFTER_HEADER="Retry-After";class tt{constructor(e=tt.DEFAULT_MAX_REDIRECTS,t=tt.DEFAULT_SHOULD_RETRY){if(e>tt.MAX_MAX_REDIRECTS){const e=new Error("MaxRedirects should not be more than "+tt.MAX_MAX_REDIRECTS);throw e.name="MaxLimitExceeded",e}if(e<0){const e=new Error("MaxRedirects should not be negative");throw e.name="MinExpectationNotMet",e}this.maxRedirects=e,this.shouldRedirect=t}}tt.DEFAULT_MAX_REDIRECTS=5,tt.MAX_MAX_REDIRECTS=20,tt.DEFAULT_SHOULD_RETRY=()=>!0;class nt{constructor(e=new tt){this.options=e}isRedirect(e){return-1!==nt.REDIRECT_STATUS_CODES.indexOf(e.status)}hasLocationHeader(e){return e.headers.has(nt.LOCATION_HEADER)}getLocationHeader(e){return e.headers.get(nt.LOCATION_HEADER)}isRelativeURL(e){return-1===e.indexOf("://")}shouldDropAuthorizationHeader(e,t){const n=/^[A-Za-z].+?:\/\/.+?(?=\/|$)/,r=n.exec(e);let o,i;null!==r&&(o=r[0]);const a=n.exec(t);return null!==a&&(i=a[0]),void 0!==o&&void 0!==i&&o!==i}updateRequestUrl(e,t){return Ve(this,void 0,void 0,(function*(){var n,r;t.request="string"==typeof t.request?e:yield(n=e,r=t.request,Ve(void 0,void 0,void 0,(function*(){const e=r.headers.get("Content-Type")?yield r.blob():yield Promise.resolve(void 0),{method:t,headers:o,referrer:i,referrerPolicy:a,mode:s,credentials:l,cache:u,redirect:c,integrity:d,keepalive:f,signal:p}=r;return new Request(n,{method:t,headers:o,body:e,referrer:i,referrerPolicy:a,mode:s,credentials:l,cache:u,redirect:c,integrity:d,keepalive:f,signal:p})})))}))}getOptions(e){let t;return e.middlewareControl instanceof We&&(t=e.middlewareControl.getMiddlewareOptions(tt)),void 0===t&&(t=Object.assign(new tt,this.options)),t}executeWithRedirect(e,t,n){return Ve(this,void 0,void 0,(function*(){try{yield this.nextMiddleware.execute(e);const r=e.response;if(!(t<n.maxRedirects&&this.isRedirect(r)&&this.hasLocationHeader(r)&&n.shouldRedirect(r)))return;if(++t,r.status===nt.STATUS_CODE_SEE_OTHER)e.options.method=je.GET,delete e.options.body;else{const t=this.getLocationHeader(r);!this.isRelativeURL(t)&&this.shouldDropAuthorizationHeader(r.url,t)&&delete e.options.headers[nt.AUTHORIZATION_HEADER],yield this.updateRequestUrl(t,e)}yield this.executeWithRedirect(e,t,n)}catch(e){throw e}}))}execute(e){return Ve(this,void 0,void 0,(function*(){try{const t=0,n=this.getOptions(e);return e.options.redirect=nt.MANUAL_REDIRECT,Ye.updateFeatureUsageFlag(e,Xe.REDIRECT_HANDLER_ENABLED),yield this.executeWithRedirect(e,t,n)}catch(e){throw e}}))}setNext(e){this.nextMiddleware=e}}nt.REDIRECT_STATUS_CODES=[301,302,303,307,308],nt.STATUS_CODE_SEE_OTHER=303,nt.LOCATION_HEADER="Location",nt.AUTHORIZATION_HEADER="Authorization",nt.MANUAL_REDIRECT="manual";const rt=new Set(["graph.microsoft.com","graph.microsoft.us","dod-graph.microsoft.us","graph.microsoft.de","microsoftgraph.chinacloudapi.cn"]),ot=["$select","$expand","$orderby","$filter","$top","$skip","$skipToken","$count"],it=e=>{const t=e&&e.constructor&&e.constructor.name;if("Buffer"===t||"Blob"===t||"File"===t||"FormData"===t||"string"==typeof e)return e;if("ArrayBuffer"===t)e=Buffer.from(e);else if("Int8Array"===t||"Int16Array"===t||"Int32Array"===t||"Uint8Array"===t||"Uint16Array"===t||"Uint32Array"===t||"Uint8ClampedArray"===t||"Float32Array"===t||"Float64Array"===t||"DataView"===t)e=Buffer.from(e.buffer);else try{e=JSON.stringify(e)}catch(e){throw new Error("Unable to stringify the content")}return e};class at{execute(e){return Ve(this,void 0,void 0,(function*(){try{if((e=>{if(-1!==(e=e.toLowerCase()).indexOf("https://")){const t=(e=e.replace("https://","")).indexOf(":"),n=e.indexOf("/");let r="";if(-1!==n)return-1!==t&&t<n?(r=e.substring(0,t),rt.has(r)):(r=e.substring(0,n),rt.has(r))}return!1})("string"==typeof e.request?e.request:e.request.url)){let t=Ge(e.request,e.options,at.CLIENT_REQUEST_ID_HEADER);t||(t=(()=>{let e="";for(let t=0;t<32;t++)8!==t&&12!==t&&16!==t&&20!==t||(e+="-"),e+=Math.floor(16*Math.random()).toString(16);return e})(),qe(e.request,e.options,at.CLIENT_REQUEST_ID_HEADER,t));let n,r=at.PRODUCT_NAME+"/2.2.1";if(e.middlewareControl instanceof We&&(n=e.middlewareControl.getMiddlewareOptions(Ye)),n){const e=n.getFeatureUsage();r+=` (${at.FEATURE_USAGE_STRING}=${e})`}Qe(e.request,e.options,at.SDK_VERSION_HEADER,r)}else delete e.options.headers[at.CLIENT_REQUEST_ID_HEADER],delete e.options.headers[at.SDK_VERSION_HEADER];return yield this.nextMiddleware.execute(e)}catch(e){throw e}}))}setNext(e){this.nextMiddleware=e}}var st,lt,ut,ct,dt;at.CLIENT_REQUEST_ID_HEADER="client-request-id",at.SDK_VERSION_HEADER="SdkVersion",at.PRODUCT_NAME="graph-js",at.FEATURE_USAGE_STRING="featureUsage",function(e){e[e.MANUAL=0]="MANUAL",e[e.RANDOM=1]="RANDOM"}(st||(st={}));class ft{constructor(e){this.provider=e}getAccessToken(){return Ve(this,void 0,void 0,(function*(){return new Promise((e,t)=>{this.provider((n,r)=>{r?e(r):t(n)})})}))}}class pt extends Error{constructor(e=-1,t,n){super(t||n&&n.message),Object.setPrototypeOf(this,pt.prototype),this.statusCode=e,this.code=null,this.requestId=null,this.date=new Date,this.body=null,this.stack=n?n.stack:this.stack}}class ht{static constructError(e,t){const n=new pt(t,"",e);return void 0!==e.name&&(n.code=e.name),n.body=e.toString(),n.date=new Date,n}static constructErrorFromResponse(e,t){e=e.error;const n=new pt(t,e.message);n.code=e.code,void 0!==e.innerError&&(n.requestId=e.innerError["request-id"],n.date=new Date(e.innerError.date));try{n.body=JSON.stringify(e)}catch(e){}return n}static getError(e=null,t=-1,n){return Ve(this,void 0,void 0,(function*(){let r;if(r=e&&e.error?ht.constructErrorFromResponse(e,t):"undefined"!=typeof Error&&e instanceof Error?ht.constructError(e,t):new pt(t),"function"!=typeof n)return r;n(r,null)}))}}!function(e){e.ARRAYBUFFER="arraybuffer",e.BLOB="blob",e.DOCUMENT="document",e.JSON="json",e.RAW="raw",e.STREAM="stream",e.TEXT="text"}(lt||(lt={})),function(e){e.TEXT_HTML="text/html",e.TEXT_XML="text/xml",e.APPLICATION_XML="application/xml",e.APPLICATION_XHTML="application/xhtml+xml"}(ut||(ut={})),function(e){e.TEXT_PLAIN="text/plain",e.APPLICATION_JSON="application/json"}(ct||(ct={})),function(e){e.DOCUMENT="^(text\\/(html|xml))|(application\\/(xml|xhtml\\+xml))$",e.IMAGE="^image\\/.+"}(dt||(dt={}));class mt{static parseDocumentResponse(e,t){try{return"undefined"!=typeof DOMParser?new Promise((n,r)=>{e.text().then(e=>{try{const r=(new DOMParser).parseFromString(e,t);n(r)}catch(e){r(e)}})}):Promise.resolve(e.body)}catch(e){throw e}}static convertResponse(e,t){return Ve(this,void 0,void 0,(function*(){if(204===e.status)return Promise.resolve();let n;try{switch(t){case lt.ARRAYBUFFER:n=yield e.arrayBuffer();break;case lt.BLOB:n=yield e.blob();break;case lt.DOCUMENT:n=yield mt.parseDocumentResponse(e,ut.TEXT_XML);break;case lt.JSON:n=yield e.json();break;case lt.STREAM:n=yield Promise.resolve(e.body);break;case lt.TEXT:n=yield e.text();break;default:const t=e.headers.get("Content-type");if(null!==t){const r=t.split(";")[0];n=new RegExp(dt.DOCUMENT).test(r)?yield mt.parseDocumentResponse(e,r):new RegExp(dt.IMAGE).test(r)?e.blob():r===ct.TEXT_PLAIN?yield e.text():r===ct.APPLICATION_JSON?yield e.json():Promise.resolve(e.body)}else n=Promise.resolve(e.body)}}catch(e){throw e}return n}))}static getResponse(e,t,n){return Ve(this,void 0,void 0,(function*(){try{if(t===lt.RAW)return Promise.resolve(e);{const r=yield mt.convertResponse(e,t);if(!e.ok)throw r;if("function"!=typeof n)return r;n(null,r)}}catch(e){throw e}}))}}class gt{constructor(e,t,n){this.parsePath=e=>{if(-1!==e.indexOf("https://")){const t=(e=e.replace("https://","")).indexOf("/");-1!==t&&(this.urlComponents.host="https://"+e.substring(0,t),e=e.substring(t+1,e.length));const n=e.indexOf("/");-1!==n&&(this.urlComponents.version=e.substring(0,n),e=e.substring(n+1,e.length))}"/"===e.charAt(0)&&(e=e.substr(1));const t=e.indexOf("?");if(-1===t)this.urlComponents.path=e;else{this.urlComponents.path=e.substr(0,t);const n=e.substring(t+1,e.length).split("&");for(const e of n)this.parseQueryParameter(e)}},this.httpClient=e,this.config=t,this.urlComponents={host:this.config.baseUrl,version:this.config.defaultVersion,oDataQueryParams:{},otherURLQueryParams:{},otherURLQueryOptions:[]},this._headers={},this._options={},this._middlewareOptions=[],this.parsePath(n)}addCsvQueryParameter(e,t,n){this.urlComponents.oDataQueryParams[e]=this.urlComponents.oDataQueryParams[e]?this.urlComponents.oDataQueryParams[e]+",":"";let r=[];n.length>1&&"string"==typeof t?r=Array.prototype.slice.call(n):"string"==typeof t?r.push(t):r=r.concat(t),this.urlComponents.oDataQueryParams[e]+=r.join(",")}buildFullUrl(){const e=(e=>{const t=e=>e.replace(/^\/+/,"");return Array.prototype.slice.call(e).reduce((e,n)=>{return[(r=e,r.replace(/\/+$/,"")),t(n)].join("/");var r})})([this.urlComponents.host,this.urlComponents.version,this.urlComponents.path])+this.createQueryString();return this.config.debugLogging&&console.log(e),e}createQueryString(){const e=this.urlComponents,t=[];if(0!==Object.keys(e.oDataQueryParams).length)for(const n in e.oDataQueryParams)e.oDataQueryParams.hasOwnProperty(n)&&t.push(n+"="+e.oDataQueryParams[n]);if(0!==Object.keys(e.otherURLQueryParams).length)for(const n in e.otherURLQueryParams)e.otherURLQueryParams.hasOwnProperty(n)&&t.push(n+"="+e.otherURLQueryParams[n]);if(0!==e.otherURLQueryOptions.length)for(const n of e.otherURLQueryOptions)t.push(n);return t.length>0?"?"+t.join("&"):""}parseQueryParameter(e){if("string"==typeof e)if("?"===e.charAt(0)&&(e=e.substring(1)),-1!==e.indexOf("&")){const t=e.split("&");for(const e of t)this.parseQueryParamenterString(e)}else this.parseQueryParamenterString(e);else if(e.constructor===Object)for(const t in e)e.hasOwnProperty(t)&&this.setURLComponentsQueryParamater(t,e[t]);return this}parseQueryParamenterString(e){if(this.isValidQueryKeyValuePair(e)){const t=e.indexOf("="),n=e.substring(0,t),r=e.substring(t+1);this.setURLComponentsQueryParamater(n,r)}else this.urlComponents.otherURLQueryOptions.push(e)}setURLComponentsQueryParamater(e,t){if(-1!==ot.indexOf(e)){const n=this.urlComponents.oDataQueryParams[e],r=n&&("$expand"===e||"$select"===e||"$orderby"===e);this.urlComponents.oDataQueryParams[e]=r?n+","+t:t}else this.urlComponents.otherURLQueryParams[e]=t}isValidQueryKeyValuePair(e){const t=e.indexOf("=");if(-1===t)return!1;return!(-1!==e.indexOf("(")&&e.indexOf("(")<t)}updateRequestOptions(e){const t=Object.assign({},e.headers);if(void 0!==this.config.fetchOptions){const t=Object.assign({},this.config.fetchOptions);Object.assign(e,t),void 0!==typeof this.config.fetchOptions.headers&&(e.headers=Object.assign({},this.config.fetchOptions.headers))}Object.assign(e,this._options),void 0!==e.headers&&Object.assign(t,e.headers),Object.assign(t,this._headers),e.headers=t}send(e,t,n){return Ve(this,void 0,void 0,(function*(){let r;const o=new We(this._middlewareOptions);this.updateRequestOptions(t);try{r=(yield this.httpClient.sendRequest({request:e,options:t,middlewareControl:o})).response;return yield mt.getResponse(r,this._responseType,n)}catch(e){let t;void 0!==r&&(t=r.status);throw yield ht.getError(e,t,n)}}))}setHeaderContentType(){if(!this._headers)return void this.header("Content-Type","application/json");const e=Object.keys(this._headers);for(const t of e)if("content-type"===t.toLowerCase())return;this.header("Content-Type","application/json")}header(e,t){return this._headers[e]=t,this}headers(e){for(const t in e)e.hasOwnProperty(t)&&(this._headers[t]=e[t]);return this}option(e,t){return this._options[e]=t,this}options(e){for(const t in e)e.hasOwnProperty(t)&&(this._options[t]=e[t]);return this}middlewareOptions(e){return this._middlewareOptions=e,this}version(e){return this.urlComponents.version=e,this}responseType(e){return this._responseType=e,this}select(e){return this.addCsvQueryParameter("$select",e,arguments),this}expand(e){return this.addCsvQueryParameter("$expand",e,arguments),this}orderby(e){return this.addCsvQueryParameter("$orderby",e,arguments),this}filter(e){return this.urlComponents.oDataQueryParams.$filter=e,this}search(e){return this.urlComponents.oDataQueryParams.$search=e,this}top(e){return this.urlComponents.oDataQueryParams.$top=e,this}skip(e){return this.urlComponents.oDataQueryParams.$skip=e,this}skipToken(e){return this.urlComponents.oDataQueryParams.$skipToken=e,this}count(e=!1){return this.urlComponents.oDataQueryParams.$count=e.toString(),this}query(e){return this.parseQueryParameter(e)}get(e){return Ve(this,void 0,void 0,(function*(){const t=this.buildFullUrl(),n={method:je.GET};try{return yield this.send(t,n,e)}catch(e){throw e}}))}post(e,t){return Ve(this,void 0,void 0,(function*(){const n=this.buildFullUrl(),r={method:je.POST,body:it(e)};"FormData"===(e&&e.constructor&&e.constructor.name)?r.headers={}:(this.setHeaderContentType(),r.headers=this._headers);try{return yield this.send(n,r,t)}catch(e){throw e}}))}create(e,t){return Ve(this,void 0,void 0,(function*(){try{return yield this.post(e,t)}catch(e){throw e}}))}put(e,t){return Ve(this,void 0,void 0,(function*(){const n=this.buildFullUrl();this.setHeaderContentType();const r={method:je.PUT,body:it(e)};try{return yield this.send(n,r,t)}catch(e){throw e}}))}patch(e,t){return Ve(this,void 0,void 0,(function*(){const n=this.buildFullUrl();this.setHeaderContentType();const r={method:je.PATCH,body:it(e)};try{return yield this.send(n,r,t)}catch(e){throw e}}))}update(e,t){return Ve(this,void 0,void 0,(function*(){try{return yield this.patch(e,t)}catch(e){throw e}}))}delete(e){return Ve(this,void 0,void 0,(function*(){const t=this.buildFullUrl(),n={method:je.DELETE};try{return yield this.send(t,n,e)}catch(e){throw e}}))}del(e){return Ve(this,void 0,void 0,(function*(){try{return yield this.delete(e)}catch(e){throw e}}))}getStream(e){return Ve(this,void 0,void 0,(function*(){const t=this.buildFullUrl(),n={method:je.GET};this.responseType(lt.STREAM);try{return yield this.send(t,n,e)}catch(e){throw e}}))}putStream(e,t){return Ve(this,void 0,void 0,(function*(){const n=this.buildFullUrl(),r={method:je.PUT,headers:{"Content-Type":"application/octet-stream"},body:e};try{return yield this.send(n,r,t)}catch(e){throw e}}))}}class vt{constructor(...e){if(!e||!e.length){const e=new Error;throw e.name="InvalidMiddlewareChain",e.message="Please provide a default middleware chain or custom middleware chain",e}this.setMiddleware(...e)}setMiddleware(...e){e.length>1?this.parseMiddleWareArray(e):this.middleware=e[0]}parseMiddleWareArray(e){e.forEach((t,n)=>{n<e.length-1&&t.setNext(e[n+1])}),this.middleware=e[0]}sendRequest(e){return Ve(this,void 0,void 0,(function*(){try{if("string"==typeof e.request&&void 0===e.options){const e=new Error;throw e.name="InvalidRequestOptions",e.message="Unable to execute the middleware, Please provide valid options for a request",e}return yield this.middleware.execute(e),e}catch(e){throw e}}))}}class Ct{static createWithAuthenticationProvider(e){const t=new Je(e),n=new et(new Ze),r=new at,o=new Ke;if(t.setNext(n),"object"==typeof process&&"function"==typeof require){const e=new nt(new tt);n.setNext(e),e.setNext(r)}else n.setNext(r);return r.setNext(o),Ct.createWithMiddleware(t)}static createWithMiddleware(...e){return new vt(...e)}}class yt{constructor(e){this.config={baseUrl:"https://graph.microsoft.com/",debugLogging:!1,defaultVersion:"v1.0"};try{(()=>{if("undefined"==typeof Promise&&"undefined"==typeof fetch){const e=new Error("Library cannot function without Promise and fetch. So, please provide polyfill for them.");throw e.name="PolyFillNotAvailable",e}if("undefined"==typeof Promise){const e=new Error("Library cannot function without Promise. So, please provide polyfill for it.");throw e.name="PolyFillNotAvailable",e}if("undefined"==typeof fetch){const e=new Error("Library cannot function without fetch. So, please provide polyfill for it.");throw e.name="PolyFillNotAvailable",e}})()}catch(e){throw e}for(const t in e)e.hasOwnProperty(t)&&(this.config[t]=e[t]);let t;if(void 0!==e.authProvider&&void 0!==e.middleware){const e=new Error;throw e.name="AmbiguityInInitialization",e.message="Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain not both",e}if(void 0!==e.authProvider)t=Ct.createWithAuthenticationProvider(e.authProvider);else{if(void 0===e.middleware){const e=new Error;throw e.name="InvalidMiddlewareChain",e.message="Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain",e}t=new vt(...[].concat(e.middleware))}this.httpClient=t}static init(e){const t={};for(const n in e)e.hasOwnProperty(n)&&(t[n]="authProvider"===n?new ft(e[n]):e[n]);return yt.initWithMiddleware(t)}static initWithMiddleware(e){try{return new yt(e)}catch(e){throw e}}api(e){return new gt(this.httpClient,this.config,e)}}function wt(e,t){p.info("Create Microsoft Graph Client");const n=new ze(e,t);return yt.initWithMiddleware({authProvider:n})}const Et=(Tt="identity",bt=H.extend(Tt),j(H,bt),{error:W(bt,"error"),warning:W(bt,"warning"),info:W(bt,"info"),verbose:W(bt,"verbose")});var Tt,bt;function St(e,t){let n="ERROR.";return(null==e?void 0:e.length)&&(n+=` Scopes: ${Array.isArray(e)?e.join(", "):e}.`),`${n} Error message: ${"string"==typeof t?t:t.message}.`}function Pt(e,t,n=Et){const r=t?`${t.fullTitle} ${e}`:e;return{title:e,fullTitle:r,info:function(e){n.info(r+" =>",e)}}}const It=new Error("ManagedIdentityCredential is not supported in the browser."),Ot=function(e,t=Et){const n=Pt(e,void 0,t);return Object.assign(Object.assign({},n),{getToken:Pt("=> getToken()",n,t)})}("ManagedIdentityCredential");class At{constructor(){throw Ot.info(St("",It)),It}getToken(){return n(this,void 0,void 0,(function*(){throw Ot.getToken.info(St("",It)),It}))}}class Rt{constructor(){this.defaultSQLScope="https://database.windows.net/"}getConfig(){return n(this,void 0,void 0,(function*(){p.info("Get SQL configuration");const t=X(B.SQL);if(!t){const t="SQL resource configuration not exist";throw p.error(t),new ErrorWithCode(t,e.InvalidConfiguration)}try{this.isSQLConfigurationValid(t)}catch(e){throw e}if(!this.isMsiAuthentication()){const e=this.generateDefaultConfig(t);return p.verbose("SQL configuration with username and password generated"),e}try{const e=yield this.generateTokenConfig(t);return p.verbose("SQL configuration with MSI token generated"),e}catch(e){throw e}}))}isMsiAuthentication(){p.verbose("Check connection config using MSI access token or username and password");const e=X(B.SQL);return null!=(null==e?void 0:e.sqlUsername)&&null!=(null==e?void 0:e.sqlPassword)?(p.verbose("Login with username and password"),!1):(p.verbose("Login with MSI identity"),!0)}isSQLConfigurationValid(t){if(p.verbose("Check SQL configuration if valid"),!t.sqlServerEndpoint)throw p.error("SQL configuration is not valid without SQL server endpoint exist"),new ErrorWithCode("SQL configuration error without SQL server endpoint exist",e.InvalidConfiguration);if(!(t.sqlUsername&&t.sqlPassword||t.sqlIdentityId)){const n=`SQL configuration is not valid without ${t.sqlIdentityId?"":"identity id "} ${t.sqlUsername?"":"SQL username "} ${t.sqlPassword?"":"SQL password"} exist`;throw p.error(n),new ErrorWithCode(n,e.InvalidConfiguration)}p.verbose("SQL configuration is valid")}generateDefaultConfig(e){p.verbose(`SQL server ${e.sqlServerEndpoint}, user name ${e.sqlUsername}, database name ${e.sqlDatabaseName}`);return{server:e.sqlServerEndpoint,authentication:{type:Mt.default,options:{userName:e.sqlUsername,password:e.sqlPassword}},options:{database:e.sqlDatabaseName,encrypt:!0}}}generateTokenConfig(t){return n(this,void 0,void 0,(function*(){let n;p.verbose("Generate tedious config with MSI token");try{const e=new At(t.sqlIdentityId);n=yield e.getToken(this.defaultSQLScope)}catch(t){const n="Get user MSI token failed";throw p.error(n),new ErrorWithCode(n,e.InternalError)}if(n){const e={server:t.sqlServerEndpoint,authentication:{type:Mt.MSI,options:{token:n.token}},options:{database:t.sqlDatabaseName,encrypt:!0}};return p.verbose(`Generate token configuration success, server endpoint is ${t.sqlServerEndpoint}, database name is ${t.sqlDatabaseName}`),e}throw p.error(`Generate token configuration, server endpoint is ${t.sqlServerEndpoint}, MSI token is not valid`),new ErrorWithCode("MSI token is not valid",e.InternalError)}))}}var Mt;!function(e){e.default="default",e.MSI="azure-active-directory-access-token"}(Mt||(Mt={}));export{Rt as DefaultTediousConnectionConfiguration,e as ErrorCode,ErrorWithCode,s as LogLevel,y as M365TenantCredential,ze as MsGraphAuthProvider,w as OnBehalfOfUserCredential,B as ResourceType,Be as TeamsBotSsoPrompt,He as TeamsUserCredential,wt as createMicrosoftGraphClient,Y as getAuthenticationConfiguration,f as getLogLevel,X as getResourceConfiguration,$ as loadConfiguration,m as setLogFunction,d as setLogLevel,h as setLogger};
|
|
30
|
+
//# sourceMappingURL=teamsfx.js.map
|