Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@microsoft/microsoft-graph-client

Package Overview
Dependencies
Maintainers
3
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@microsoft/microsoft-graph-client - npm Package Compare versions

Comparing version 2.0.0-Preview.3 to 2.0.0-Preview.4

3

lib/es/browser/ImplicitMSALAuthenticationProvider.js

@@ -67,2 +67,5 @@ /**

}
else {
throw error;
}
}

@@ -69,0 +72,0 @@ }

@@ -71,2 +71,5 @@ /**

}
else {
throw error;
}
}

@@ -73,0 +76,0 @@ }

2

lib/es/Version.d.ts

@@ -10,2 +10,2 @@ /**

*/
export declare const PACKAGE_VERSION = "2.0.0-Preview.3";
export declare const PACKAGE_VERSION = "2.0.0-Preview.4";

@@ -12,3 +12,3 @@ /**

*/
export const PACKAGE_VERSION = "2.0.0-Preview.3";
export const PACKAGE_VERSION = "2.0.0-Preview.4";
//# sourceMappingURL=Version.js.map

@@ -1,1 +0,1 @@

function e(e,t,n,r){return new(n||(n=Promise))(function(s,i){function o(e){try{d(r.next(e))}catch(e){i(e)}}function a(e){try{d(r.throw(e))}catch(e){i(e)}}function d(e){e.done?s(e.value):new n(function(t){t(e.value)}).then(o,a)}d((r=r.apply(e,t||[])).next())})}var t;!function(e){e.GET="GET",e.PATCH="PATCH",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE"}(t||(t={}));class n{constructor(e){if(this.requests=new Map,void 0!==e){const t=n.requestLimit;if(e.length>t){const e=new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${t}`);throw e.name="Limit Exceeded Error",e}for(const t of e)this.addRequest(t)}}static validateDependencies(e){if(0===e.size){const e=new Error("Empty requests map, Please provide at least one request.");throw e.name="Empty Requests Error",e}return(e=>{const t=e.entries();let n=t.next();for(;!n.done;){const e=n.value[1];if(void 0!==e.dependsOn&&e.dependsOn.length>0)return!1;n=t.next()}return!0})(e)||(e=>{const t=e.entries();let n=t.next();const r=n.value[1];if(void 0!==r.dependsOn&&r.dependsOn.length>0)return!1;let s=n;for(n=t.next();!n.done;){const e=n.value[1];if(void 0===e.dependsOn||1!==e.dependsOn.length||e.dependsOn[0]!==s.value[1].id)return!1;s=n,n=t.next()}return!0})(e)||(e=>{const t=e.entries();let n=t.next();const r=n.value[1];let s;if(void 0===r.dependsOn||0===r.dependsOn.length)s=r.id;else{if(1!==r.dependsOn.length)return!1;{const t=r.dependsOn[0];if(t===r.id||!e.has(t))return!1;s=t}}for(n=t.next();!n.done;){const e=n.value[1];if((void 0===e.dependsOn||0===e.dependsOn.length)&&s!==e.id)return!1;if(void 0!==e.dependsOn&&0!==e.dependsOn.length){if(1===e.dependsOn.length&&(e.id===s||e.dependsOn[0]!==s))return!1;if(e.dependsOn.length>1)return!1}n=t.next()}return!0})(e)}static getRequestData(r){return e(this,void 0,void 0,function*(){const e={url:""},s=new RegExp("^https?://");e.url=s.test(r.url)?"/"+r.url.split(/.*?\/\/.*?\//)[1]:r.url,e.method=r.method;const i={};return r.headers.forEach((e,t)=>{i[t]=e}),Object.keys(i).length&&(e.headers=i),r.method!==t.PATCH&&r.method!==t.POST&&r.method!==t.PUT||(e.body=yield n.getRequestBody(r)),e})}static getRequestBody(t){return e(this,void 0,void 0,function*(){let e,n=!1;try{const r=t.clone();e=yield r.json(),n=!0}catch(e){}if(!n)try{if("undefined"!=typeof Blob){const n=yield t.blob(),r=new FileReader;e=yield new Promise(e=>{r.addEventListener("load",()=>{const t=r.result,n=new RegExp("^s*data:(.+?/.+?(;.+?=.+?)*)?(;base64)?,(.*)s*$").exec(t);e(n[4])},!1),r.readAsDataURL(n)})}else if("undefined"!=typeof Buffer){e=(yield t.buffer()).toString("base64")}n=!0}catch(e){}return e})}addRequest(e){const t=n.requestLimit;if(""===e.id){const e=new Error("Id for a request is empty, Please provide an unique id");throw e.name="Empty Id For Request",e}if(this.requests.size===t){const e=new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${t}`);throw e.name="Limit Exceeded Error",e}if(this.requests.has(e.id)){const t=new Error(`Adding request with duplicate id ${e.id}, Make the id of the requests unique`);throw t.name="Duplicate RequestId Error",t}return this.requests.set(e.id,e),e.id}removeRequest(e){const t=this.requests.delete(e),n=this.requests.entries();let r=n.next();for(;!r.done;){const t=r.value[1].dependsOn;if(void 0!==t){const n=t.indexOf(e);-1!==n&&t.splice(n,1),0===t.length&&delete r.value[1].dependsOn}r=n.next()}return t}getContent(){return e(this,void 0,void 0,function*(){const e=[],t={requests:e},r=this.requests.entries();let s=r.next();if(s.done){const e=new Error("No requests added yet, Please add at least one request.");throw e.name="Empty Payload",e}if(!n.validateDependencies(this.requests)){const e=new Error("Invalid dependency found, Dependency should be:\n1. Parallel - no individual request states a dependency in the dependsOn property.\n2. Serial - all individual requests depend on the previous individual request.\n3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency.");throw e.name="Invalid Dependency",e}for(;!s.done;){const t=s.value[1],i=yield n.getRequestData(t.request);if(void 0!==i.body&&(void 0===i.headers||void 0===i.headers["content-type"])){const e=new Error(`Content-type header is not mentioned for request #${t.id}, For request having body, Content-type header should be mentioned`);throw e.name="Invalid Content-type header",e}i.id=t.id,void 0!==t.dependsOn&&t.dependsOn.length>0&&(i.dependsOn=t.dependsOn),e.push(i),s=r.next()}return t.requests=e,t})}addDependency(e,t){if(!this.requests.has(e)){const t=new Error(`Dependent ${e} does not exists, Please check the id`);throw t.name="Invalid Dependent",t}if(void 0!==t&&!this.requests.has(t)){const e=new Error(`Dependency ${t} does not exists, Please check the id`);throw e.name="Invalid Dependency",e}if(void 0!==t){const n=this.requests.get(e);if(void 0===n.dependsOn&&(n.dependsOn=[]),-1!==n.dependsOn.indexOf(t)){const n=new Error(`Dependency ${t} is already added for the request ${e}`);throw n.name="Duplicate Dependency",n}n.dependsOn.push(t)}else{const n=this.requests.entries();let r,s=n.next();for(;!s.done&&s.value[1].id!==e;)r=s,s=n.next();if(void 0===r){const e=new Error(`Can't add dependency ${t}, There is only a dependent request in the batch`);throw e.name="Invalid Dependency Addition",e}{const t=r.value[0];if(void 0===s.value[1].dependsOn&&(s.value[1].dependsOn=[]),-1!==s.value[1].dependsOn.indexOf(t)){const n=new Error(`Dependency ${t} is already added for the request ${e}`);throw n.name="Duplicate Dependency",n}s.value[1].dependsOn.push(t)}}}removeDependency(e,t){const n=this.requests.get(e);if(void 0===n||void 0===n.dependsOn||0===n.dependsOn.length)return!1;if(void 0!==t){const e=n.dependsOn.indexOf(t);return-1!==e&&(n.dependsOn.splice(e,1),!0)}return delete n.dependsOn,!0}}n.requestLimit=20;class r{constructor(e){this.responses=new Map,this.update(e)}createResponseObject(e){const t=e.body,n={};return n.status=e.status,void 0!==e.statusText&&(n.statusText=e.statusText),n.headers=e.headers,new Response(t,n)}update(e){this.nextLink=e["@odata.nextLink"];const t=e.responses;for(let e=0,n=t.length;e<n;e++)this.responses.set(t[e].id,this.createResponseObject(t[e]))}getResponseById(e){return this.responses.get(e)}getResponses(){return this.responses}*getResponsesIterator(){const e=this.responses.entries();let t=e.next();for(;!t.done;)yield t.value,t=e.next()}}class s{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 i=()=>{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},o=(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,s=e.length;t<s;t++)if(e[t][0]===n){r=e[t][1];break}}else void 0!==t.headers[n]&&(r=t.headers[n]);return r},a=(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 s=t.headers.length;for(;e<s;e++){const s=t.headers[e];if(s[0]===n){s[1]=r;break}}e===s&&t.headers.push([n,r])}else Object.assign(t.headers,{[n]:r})},d=(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}`)},c=(t,n)=>e(void 0,void 0,void 0,function*(){const e=n.headers.get("Content-Type")?yield n.blob():yield Promise.resolve(void 0),{method:r,headers:s,referrer:i,referrerPolicy:o,mode:a,credentials:d,cache:c,redirect:h,integrity:l,keepalive:u,signal:p}=n;return new Request(t,{method:r,headers:s,body:e,referrer:i,referrerPolicy:o,mode:a,credentials:d,cache:c,redirect:h,integrity:l,keepalive:u,signal:p})});class h{constructor(e,t){this.authenticationProvider=e,this.authenticationProviderOptions=t}}var l;!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"}(l||(l={}));class u{constructor(){this.featureUsage=l.NONE}static updateFeatureUsageFlag(e,t){let n;e.middlewareControl instanceof s?n=e.middlewareControl.getMiddlewareOptions(u):e.middlewareControl=new s,void 0===n&&(n=new u,e.middlewareControl.setMiddlewareOptions(u,n)),n.setFeatureUsage(t)}setFeatureUsage(e){this.featureUsage=this.featureUsage|e}getFeatureUsage(){return this.featureUsage.toString(16)}}class p{constructor(e){this.authenticationProvider=e}execute(t){return e(this,void 0,void 0,function*(){try{let e,n,r;t.middlewareControl instanceof s&&(e=t.middlewareControl.getMiddlewareOptions(h)),void 0!==e&&(n=e.authenticationProvider,r=e.authenticationProviderOptions),void 0===n&&(n=this.authenticationProvider);const i=`Bearer ${yield n.getAccessToken(r)}`;return d(t.request,t.options,p.AUTHORIZATION_HEADER,i),u.updateFeatureUsageFlag(t,l.AUTHENTICATION_HANDLER_ENABLED),yield this.nextMiddleware.execute(t)}catch(e){throw e}})}setNext(e){this.nextMiddleware=e}}p.AUTHORIZATION_HEADER="Authorization";class f{execute(t){return e(this,void 0,void 0,function*(){try{return void(t.response=yield fetch(t.request,t.options))}catch(e){throw e}})}}class y{constructor(e=y.DEFAULT_DELAY,t=y.DEFAULT_MAX_RETRIES,n=y.DEFAULT_SHOULD_RETRY){if(e>y.MAX_DELAY&&t>y.MAX_MAX_RETRIES){const e=new Error(`Delay and MaxRetries should not be more than ${y.MAX_DELAY} and ${y.MAX_MAX_RETRIES}`);throw e.name="MaxLimitExceeded",e}if(e>y.MAX_DELAY){const e=new Error(`Delay should not be more than ${y.MAX_DELAY}`);throw e.name="MaxLimitExceeded",e}if(t>y.MAX_MAX_RETRIES){const e=new Error(`MaxRetries should not be more than ${y.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,y.MAX_DELAY),this.maxRetries=Math.min(t,y.MAX_MAX_RETRIES),this.shouldRetry=n}getMaxDelay(){return y.MAX_DELAY}}y.DEFAULT_DELAY=3,y.DEFAULT_MAX_RETRIES=3,y.MAX_DELAY=180,y.MAX_MAX_RETRIES=10,y.DEFAULT_SHOULD_RETRY=()=>!0;class m{constructor(e=new y){this.options=e}isRetry(e){return-1!==m.RETRY_STATUS_CODES.indexOf(e.status)}isBuffered(e,n){const r="string"==typeof e?n.method:e.method;if(r===t.PUT||r===t.PATCH||r===t.POST){if("application/octet-stream"===o(e,n,"Content-Type"))return!1}return!0}getDelay(e,t,n){const r=()=>Number(Math.random().toFixed(3)),s=void 0!==e.headers?e.headers.get(m.RETRY_AFTER_HEADER):null;let i;return i=null!==s?Number.isNaN(Number(s))?Math.round((new Date(s).getTime()-Date.now())/1e3):Number(s):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(t){return e(this,void 0,void 0,function*(){const e=1e3*t;return new Promise(t=>setTimeout(t,e))})}getOptions(e){let t;return e.middlewareControl instanceof s&&(t=e.middlewareControl.getMiddlewareOptions(this.options.constructor)),void 0===t&&(t=Object.assign(new y,this.options)),t}executeWithRetry(t,n,r){return e(this,void 0,void 0,function*(){try{if(yield this.nextMiddleware.execute(t),n<r.maxRetries&&this.isRetry(t.response)&&this.isBuffered(t.request,t.options)&&r.shouldRetry(r.delay,n,t.request,t.options,t.response)){++n,a(t.request,t.options,m.RETRY_ATTEMPT_HEADER,n.toString());const e=this.getDelay(t.response,n,r.delay);return yield this.sleep(e),yield this.executeWithRetry(t,n,r)}return}catch(e){throw e}})}execute(t){return e(this,void 0,void 0,function*(){try{const e=0,n=this.getOptions(t);return u.updateFeatureUsageFlag(t,l.RETRY_HANDLER_ENABLED),yield this.executeWithRetry(t,e,n)}catch(e){throw e}})}setNext(e){this.nextMiddleware=e}}m.RETRY_STATUS_CODES=[429,503,504],m.RETRY_ATTEMPT_HEADER="Retry-Attempt",m.RETRY_AFTER_HEADER="Retry-After";const E="2.0.0-Preview.3";class v{execute(t){return e(this,void 0,void 0,function*(){try{let e=o(t.request,t.options,v.CLIENT_REQUEST_ID_HEADER);null===e&&(e=i(),a(t.request,t.options,v.CLIENT_REQUEST_ID_HEADER,e));let n,r=`${v.PRODUCT_NAME}/${E}`;if(t.middlewareControl instanceof s&&(n=t.middlewareControl.getMiddlewareOptions(u)),void 0!==n){const e=n.getFeatureUsage();r+=` (${v.FEATURE_USAGE_STRING}=${e})`}return d(t.request,t.options,v.SDK_VERSION_HEADER,r),yield this.nextMiddleware.execute(t)}catch(e){throw e}})}setNext(e){this.nextMiddleware=e}}v.CLIENT_REQUEST_ID_HEADER="client-request-id",v.SDK_VERSION_HEADER="SdkVersion",v.PRODUCT_NAME="graph-js",v.FEATURE_USAGE_STRING="featureUsage";class w{constructor(e=-1,t=-1){this.minValue=e,this.maxValue=t}}class R{constructor(e,t,n,r={}){this.DEFAULT_FILE_SIZE=5242880,this.client=e,this.file=t,void 0===r.rangeSize&&(r.rangeSize=this.DEFAULT_FILE_SIZE),this.options=r,this.uploadSession=n,this.nextRange=new w(0,this.options.rangeSize-1)}static createUploadSession(t,n,r,s={}){return e(this,void 0,void 0,function*(){try{const e=yield t.api(n).headers(s).post(r);return{url:e.uploadUrl,expiry:new Date(e.expirationDateTime)}}catch(e){throw e}})}parseRange(e){const t=e[0];if(void 0===t||""===t)return new w;const n=t.split("-"),r=parseInt(n[0],10);let s=parseInt(n[1],10);return Number.isNaN(s)&&(s=this.file.size-1),new w(r,s)}updateTaskStatus(e){this.uploadSession.expiry=new Date(e.expirationDateTime),this.nextRange=this.parseRange(e.nextExpectedRanges)}getNextRange(){if(-1===this.nextRange.minValue)return this.nextRange;const e=this.nextRange.minValue;let t=e+this.options.rangeSize-1;return t>=this.file.size&&(t=this.file.size-1),new w(e,t)}sliceFile(e){return this.file.content.slice(e.minValue,e.maxValue+1)}upload(){return e(this,void 0,void 0,function*(){try{for(;;){const e=this.getNextRange();if(-1===e.maxValue){const e=new Error("Task with which you are trying to upload is already completed, Please check for your uploaded file");throw e.name="Invalid Session",e}const t=this.sliceFile(e),n=yield this.uploadSlice(t,e,this.file.size);if(void 0!==n.id)return n;this.updateTaskStatus(n)}}catch(e){throw e}})}uploadSlice(t,n,r){return e(this,void 0,void 0,function*(){try{return yield this.client.api(this.uploadSession.url).headers({"Content-Length":`${n.maxValue-n.minValue+1}`,"Content-Range":`bytes ${n.minValue}-${n.maxValue}/${r}`}).put(t)}catch(e){throw e}})}cancel(){return e(this,void 0,void 0,function*(){try{return yield this.client.api(this.uploadSession.url).delete()}catch(e){throw e}})}getStatus(){return e(this,void 0,void 0,function*(){try{const e=yield this.client.api(this.uploadSession.url).get();return this.updateTaskStatus(e),e}catch(e){throw e}})}resume(){return e(this,void 0,void 0,function*(){try{return yield this.getStatus(),yield this.upload()}catch(e){throw e}})}}const g=(e=5242880)=>{return e>62914560&&(e=62914560),(e=>(e>327680&&(e=320*Math.floor(e/327680)*1024),e))(e)};class A extends R{constructor(e,t,n,r){super(e,t,n,r)}static constructCreateSessionUrl(e,t=A.DEFAULT_UPLOAD_PATH){return e=e.trim(),""===(t=t.trim())&&(t="/"),"/"!==t[0]&&(t=`/${t}`),"/"!==t[t.length-1]&&(t=`${t}/`),encodeURI(`/me/drive/root:${t}${e}:/createUploadSession`)}static create(t,n,r){return e(this,void 0,void 0,function*(){const e=r.fileName;let s,i;if("undefined"!=typeof Blob&&n instanceof Blob)i=(s=new File([n],e)).size;else if("undefined"!=typeof File&&n instanceof File)i=(s=n).size;else if("undefined"!=typeof Buffer&&n instanceof Buffer){const e=n;i=e.byteLength-e.byteOffset,s=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}try{const n=A.constructCreateSessionUrl(r.fileName,r.path),o=yield A.createUploadSession(t,n,r.fileName),a=g(r.rangeSize);return new A(t,{name:e,content:s,size:i},o,{rangeSize:a})}catch(e){throw e}})}static createUploadSession(t,n,r){const s=Object.create(null,{createUploadSession:{get:()=>super.createUploadSession}});return e(this,void 0,void 0,function*(){const e={item:{"@microsoft.graph.conflictBehavior":"rename",name:r}};try{return s.createUploadSession.call(this,t,n,e)}catch(e){throw e}})}commit(t){return e(this,void 0,void 0,function*(){try{const e={name:this.file.name,"@microsoft.graph.conflictBehavior":"rename","@microsoft.graph.sourceUrl":this.uploadSession.url};return yield this.client.api(t).put(e)}catch(e){throw e}})}}A.DEFAULT_UPLOAD_PATH="/";class T{constructor(e,t,n){this.client=e,this.collection=t.value,this.nextLink=t["@odata.nextLink"],this.deltaLink=t["@odata.deltaLink"],this.callback=n,this.complete=!1}iterationHelper(){if(void 0===this.collection)return!1;let e=!0;for(;e&&0!==this.collection.length;){const t=this.collection.shift();e=this.callback(t)}return e}fetchAndUpdateNextPageData(){return e(this,void 0,void 0,function*(){try{const e=yield this.client.api(this.nextLink).get();this.collection=e.value,this.nextLink=e["@odata.nextLink"],this.deltaLink=e["@odata.deltaLink"]}catch(e){throw e}})}getDeltaLink(){return this.deltaLink}iterate(){return e(this,void 0,void 0,function*(){try{let e=this.iterationHelper();for(;e;)void 0!==this.nextLink?(yield this.fetchAndUpdateNextPageData(),e=this.iterationHelper()):e=!1;void 0===this.nextLink&&0===this.collection.length&&(this.complete=!0)}catch(e){throw e}})}resume(){return e(this,void 0,void 0,function*(){try{return this.iterate()}catch(e){throw e}})}isComplete(){return this.complete}}const O="v1.0",D="https://graph.microsoft.com/";class x{constructor(e){this.provider=e}getAccessToken(){return e(this,void 0,void 0,function*(){return new Promise((e,t)=>{this.provider((n,r)=>{r?e(r):t(n)})})})}}class _{constructor(e=-1){this.statusCode=e,this.code=null,this.message=null,this.requestId=null,this.date=new Date,this.body=null}}class b{static constructError(e,t){const n=new _(t);return void 0!==e.name&&(n.code=e.name),n.body=e.toString(),n.message=e.message,n.date=new Date,n}static constructErrorFromResponse(e,t){e=e.error;const n=new _(t);n.code=e.code,n.message=e.message,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(t=null,n=-1,r){return e(this,void 0,void 0,function*(){let e;if(e=t&&t.error?b.constructErrorFromResponse(t,n):"undefined"!=typeof Error&&t instanceof Error?b.constructError(t,n):new _(n),"function"!=typeof r)return e;r(e,null)})}}const P=["$select","$expand","$orderby","$filter","$top","$skip","$skipToken","$count"],L=e=>{const t=e=>e.replace(/\/+$/,""),n=e=>e.replace(/^\/+/,"");return Array.prototype.slice.call(e).reduce((e,r)=>[t(e),n(r)].join("/"))},U=e=>{const t=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};var S,C,M,N;!function(e){e.ARRAYBUFFER="arraybuffer",e.BLOB="blob",e.DOCUMENT="document",e.JSON="json",e.RAW="raw",e.STREAM="stream",e.TEXT="text"}(S||(S={})),function(e){e.TEXT_HTML="text/html",e.TEXT_XML="text/xml",e.APPLICATION_XML="application/xml",e.APPLICATION_XHTML="application/xhtml+xml"}(C||(C={})),function(e){e.TEXT_PLAIN="text/plain",e.APPLICATION_JSON="application/json"}(M||(M={})),function(e){e.DOCUMENT="^(text\\/(html|xml))|(application\\/(xml|xhtml\\+xml))$",e.IMAGE="^image\\/.+"}(N||(N={}));class q{static parseDocumentResponse(e,t){try{return"undefined"!=typeof DOMParser?new Promise((n,r)=>{e.text().then(e=>{try{const s=(new DOMParser).parseFromString(e,t);n(s)}catch(e){r(e)}})}):Promise.resolve(e.body)}catch(e){throw e}}static convertResponse(t,n){return e(this,void 0,void 0,function*(){if(204===t.status)return Promise.resolve();let e;try{switch(n){case S.ARRAYBUFFER:e=yield t.arrayBuffer();break;case S.BLOB:e=yield t.blob();break;case S.DOCUMENT:e=yield q.parseDocumentResponse(t,C.TEXT_XML);break;case S.JSON:e=yield t.json();break;case S.STREAM:e=yield Promise.resolve(t.body);break;case S.TEXT:e=yield t.text();break;default:const r=t.headers.get("Content-type");if(null!==r){const n=r.split(";")[0];e=new RegExp(N.DOCUMENT).test(n)?yield q.parseDocumentResponse(t,n):new RegExp(N.IMAGE).test(n)?t.blob():n===M.TEXT_PLAIN?yield t.text():n===M.APPLICATION_JSON?yield t.json():Promise.resolve(t.body)}else e=Promise.resolve(t.body)}}catch(e){throw e}return e})}static getResponse(t,n,r){return e(this,void 0,void 0,function*(){try{if(n===S.RAW)return Promise.resolve(t);{const e=yield q.convertResponse(t,n);if(!t.ok)throw e;if("function"!=typeof r)return e;r(null,e)}}catch(e){throw e}})}}class I{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){const t=e.split("="),n=t[0],r=t[1];-1!==P.indexOf(n)?this.urlComponents.oDataQueryParams[n]=r:this.urlComponents.otherURLQueryParams[n]=r}}},this.httpClient=e,this.config=t,this.urlComponents={host:this.config.baseUrl,version:this.config.defaultVersion,oDataQueryParams:{},otherURLQueryParams:{}},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=L([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]);return t.length>0?"?"+t.join("&"):""}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(t,n,r){return e(this,void 0,void 0,function*(){let e;const i=new s(this._middlewareOptions);this.updateRequestOptions(n);try{return e=(yield this.httpClient.sendRequest({request:t,options:n,middlewareControl:i})).response,yield q.getResponse(e,this._responseType,r)}catch(t){let n;throw void 0!==e&&(n=e.status),yield b.getError(t,n,r)}})}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){return this.urlComponents.oDataQueryParams.$count=e.toString(),this}query(e){const t=this.urlComponents.otherURLQueryParams;if("string"==typeof e){const n=e.split("="),r=n[0],s=n[1];t[r]=s}else for(const n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return this}get(n){return e(this,void 0,void 0,function*(){const e=this.buildFullUrl(),r={method:t.GET};try{return yield this.send(e,r,n)}catch(e){throw e}})}post(n,r){return e(this,void 0,void 0,function*(){const e=this.buildFullUrl(),s={method:t.POST,body:U(n),headers:"undefined"!=typeof FormData&&n instanceof FormData?{}:{"Content-Type":"application/json"}};try{return yield this.send(e,s,r)}catch(e){throw e}})}create(t,n){return e(this,void 0,void 0,function*(){try{return yield this.post(t,n)}catch(e){throw e}})}put(n,r){return e(this,void 0,void 0,function*(){const e=this.buildFullUrl(),s={method:t.PUT,body:U(n),headers:{"Content-Type":"application/json"}};try{return yield this.send(e,s,r)}catch(e){throw e}})}patch(n,r){return e(this,void 0,void 0,function*(){const e=this.buildFullUrl(),s={method:t.PATCH,body:U(n),headers:{"Content-Type":"application/json"}};try{return yield this.send(e,s,r)}catch(e){throw e}})}update(t,n){return e(this,void 0,void 0,function*(){try{return yield this.patch(t,n)}catch(e){throw e}})}delete(n){return e(this,void 0,void 0,function*(){const e=this.buildFullUrl(),r={method:t.DELETE};try{return yield this.send(e,r,n)}catch(e){throw e}})}del(t){return e(this,void 0,void 0,function*(){try{return yield this.delete(t)}catch(e){throw e}})}getStream(n){return e(this,void 0,void 0,function*(){const e=this.buildFullUrl(),r={method:t.GET};this.responseType(S.STREAM);try{return yield this.send(e,r,n)}catch(e){throw e}})}putStream(n,r){return e(this,void 0,void 0,function*(){const e=this.buildFullUrl(),s={method:t.PUT,headers:{"Content-Type":"application/octet-stream"},body:n};try{return yield this.send(e,s,r)}catch(e){throw e}})}}class F{constructor(e){this.middleware=e}sendRequest(t){return e(this,void 0,void 0,function*(){try{if("string"==typeof t.request&&void 0===t.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(t),t}catch(e){throw e}})}}class H{constructor(e=H.DEFAULT_MAX_REDIRECTS,t=H.DEFAULT_SHOULD_RETRY){if(e>H.MAX_MAX_REDIRECTS){const e=new Error(`MaxRedirects should not be more than ${H.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}}H.DEFAULT_MAX_REDIRECTS=5,H.MAX_MAX_REDIRECTS=20,H.DEFAULT_SHOULD_RETRY=()=>!0;class k{constructor(e=new H){this.options=e}isRedirect(e){return-1!==k.REDIRECT_STATUS_CODES.indexOf(e.status)}hasLocationHeader(e){return e.headers.has(k.LOCATION_HEADER)}getLocationHeader(e){return e.headers.get(k.LOCATION_HEADER)}isRelativeURL(e){return-1===e.indexOf("://")}shouldDropAuthorizationHeader(e,t){const n=/^[A-Za-z].+?:\/\/.+?(?=\/|$)/,r=n.exec(e);let s,i;null!==r&&(s=r[0]);const o=n.exec(t);return null!==o&&(i=o[0]),void 0!==s&&void 0!==i&&s!==i}updateRequestUrl(t,n){return e(this,void 0,void 0,function*(){n.request="string"==typeof n.request?t:yield c(t,n.request)})}getOptions(e){let t;return e.middlewareControl instanceof s&&(t=e.middlewareControl.getMiddlewareOptions(H)),void 0===t&&(t=Object.assign(new H,this.options)),t}executeWithRedirect(n,r,s){return e(this,void 0,void 0,function*(){try{yield this.nextMiddleware.execute(n);const e=n.response;if(!(r<s.maxRedirects&&this.isRedirect(e)&&this.hasLocationHeader(e)&&s.shouldRedirect(e)))return;if(++r,e.status===k.STATUS_CODE_SEE_OTHER)n.options.method=t.GET,delete n.options.body;else{const t=this.getLocationHeader(e);!this.isRelativeURL(t)&&this.shouldDropAuthorizationHeader(e.url,t)&&a(n.request,n.options,k.AUTHORIZATION_HEADER,void 0),yield this.updateRequestUrl(t,n)}yield this.executeWithRedirect(n,r,s)}catch(e){throw e}})}execute(t){return e(this,void 0,void 0,function*(){try{const e=0,n=this.getOptions(t);return t.options.redirect=k.MANUAL_REDIRECT,u.updateFeatureUsageFlag(t,l.REDIRECT_HANDLER_ENABLED),yield this.executeWithRedirect(t,e,n)}catch(e){throw e}})}setNext(e){this.nextMiddleware=e}}k.REDIRECT_STATUS_CODES=[301,302,303,307,308],k.STATUS_CODE_SEE_OTHER=303,k.LOCATION_HEADER="Location",k.AUTHORIZATION_HEADER="Authorization",k.MANUAL_REDIRECT="manual";const $=()=>new Function("try {return this === global;}catch(e){return false;}")();class X{static createWithAuthenticationProvider(e){const t=new p(e),n=new m(new y),r=new v,s=new f;if(t.setNext(n),$()){const e=new k(new H);n.setNext(e),e.setNext(r)}else n.setNext(r);return r.setNext(s),X.createWithMiddleware(t)}static createWithMiddleware(e){return new F(e)}}const B=()=>{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}return!0};class Q{constructor(e){this.config={baseUrl:D,debugLogging:!1,defaultVersion:O};try{B()}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=X.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 F(e.middleware)}this.httpClient=t}static init(e){const t={};for(const n in e)e.hasOwnProperty(n)&&(t[n]="authProvider"===n?new x(e[n]):e[n]);return Q.initWithMiddleware(t)}static initWithMiddleware(e){try{return new Q(e)}catch(e){throw e}}api(e){return new I(this.httpClient,this.config,e)}}class j{constructor(e,t){this.options=t,this.msalApplication=e}getAccessToken(t){return e(this,void 0,void 0,function*(){let e;if(void 0!==t&&(e=t.scopes),void 0!==e&&0!==e.length||(e=this.options.scopes),0===e.length){const e=new Error;throw e.name="EmptyScopes",e.message="Scopes cannot be empty, Please provide a scopes",e}if(this.msalApplication.getAccount()){const t={scopes:e};try{return(yield this.msalApplication.acquireTokenSilent(t)).accessToken}catch(e){if("InteractionRequiredAuthError"===e.name)try{return(yield this.msalApplication.acquireTokenPopup(t)).accessToken}catch(e){throw e}}}else try{const t={scopes:e};return yield this.msalApplication.loginPopup(t),(yield this.msalApplication.acquireTokenSilent(t)).accessToken}catch(e){throw e}})}}class Y{constructor(e){this.scopes=e}}export{p as AuthenticationHandler,h as AuthenticationHandlerOptions,n as BatchRequestContent,r as BatchResponseContent,Q as Client,l as FeatureUsageFlag,_ as GraphError,I as GraphRequest,f as HTTPMessageHandler,j as ImplicitMSALAuthenticationProvider,R as LargeFileUploadTask,Y as MSALAuthenticationProviderOptions,A as OneDriveLargeFileUploadTask,T as PageIterator,S as ResponseType,m as RetryHandler,y as RetryHandlerOptions,v as TelemetryHandler,u as TelemetryHandlerOptions};
function e(e,t,n,r){return new(n||(n=Promise))(function(s,i){function o(e){try{d(r.next(e))}catch(e){i(e)}}function a(e){try{d(r.throw(e))}catch(e){i(e)}}function d(e){e.done?s(e.value):new n(function(t){t(e.value)}).then(o,a)}d((r=r.apply(e,t||[])).next())})}var t;!function(e){e.GET="GET",e.PATCH="PATCH",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE"}(t||(t={}));class n{constructor(e){if(this.requests=new Map,void 0!==e){const t=n.requestLimit;if(e.length>t){const e=new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${t}`);throw e.name="Limit Exceeded Error",e}for(const t of e)this.addRequest(t)}}static validateDependencies(e){if(0===e.size){const e=new Error("Empty requests map, Please provide at least one request.");throw e.name="Empty Requests Error",e}return(e=>{const t=e.entries();let n=t.next();for(;!n.done;){const e=n.value[1];if(void 0!==e.dependsOn&&e.dependsOn.length>0)return!1;n=t.next()}return!0})(e)||(e=>{const t=e.entries();let n=t.next();const r=n.value[1];if(void 0!==r.dependsOn&&r.dependsOn.length>0)return!1;let s=n;for(n=t.next();!n.done;){const e=n.value[1];if(void 0===e.dependsOn||1!==e.dependsOn.length||e.dependsOn[0]!==s.value[1].id)return!1;s=n,n=t.next()}return!0})(e)||(e=>{const t=e.entries();let n=t.next();const r=n.value[1];let s;if(void 0===r.dependsOn||0===r.dependsOn.length)s=r.id;else{if(1!==r.dependsOn.length)return!1;{const t=r.dependsOn[0];if(t===r.id||!e.has(t))return!1;s=t}}for(n=t.next();!n.done;){const e=n.value[1];if((void 0===e.dependsOn||0===e.dependsOn.length)&&s!==e.id)return!1;if(void 0!==e.dependsOn&&0!==e.dependsOn.length){if(1===e.dependsOn.length&&(e.id===s||e.dependsOn[0]!==s))return!1;if(e.dependsOn.length>1)return!1}n=t.next()}return!0})(e)}static getRequestData(r){return e(this,void 0,void 0,function*(){const e={url:""},s=new RegExp("^https?://");e.url=s.test(r.url)?"/"+r.url.split(/.*?\/\/.*?\//)[1]:r.url,e.method=r.method;const i={};return r.headers.forEach((e,t)=>{i[t]=e}),Object.keys(i).length&&(e.headers=i),r.method!==t.PATCH&&r.method!==t.POST&&r.method!==t.PUT||(e.body=yield n.getRequestBody(r)),e})}static getRequestBody(t){return e(this,void 0,void 0,function*(){let e,n=!1;try{const r=t.clone();e=yield r.json(),n=!0}catch(e){}if(!n)try{if("undefined"!=typeof Blob){const n=yield t.blob(),r=new FileReader;e=yield new Promise(e=>{r.addEventListener("load",()=>{const t=r.result,n=new RegExp("^s*data:(.+?/.+?(;.+?=.+?)*)?(;base64)?,(.*)s*$").exec(t);e(n[4])},!1),r.readAsDataURL(n)})}else if("undefined"!=typeof Buffer){e=(yield t.buffer()).toString("base64")}n=!0}catch(e){}return e})}addRequest(e){const t=n.requestLimit;if(""===e.id){const e=new Error("Id for a request is empty, Please provide an unique id");throw e.name="Empty Id For Request",e}if(this.requests.size===t){const e=new Error(`Maximum requests limit exceeded, Max allowed number of requests are ${t}`);throw e.name="Limit Exceeded Error",e}if(this.requests.has(e.id)){const t=new Error(`Adding request with duplicate id ${e.id}, Make the id of the requests unique`);throw t.name="Duplicate RequestId Error",t}return this.requests.set(e.id,e),e.id}removeRequest(e){const t=this.requests.delete(e),n=this.requests.entries();let r=n.next();for(;!r.done;){const t=r.value[1].dependsOn;if(void 0!==t){const n=t.indexOf(e);-1!==n&&t.splice(n,1),0===t.length&&delete r.value[1].dependsOn}r=n.next()}return t}getContent(){return e(this,void 0,void 0,function*(){const e=[],t={requests:e},r=this.requests.entries();let s=r.next();if(s.done){const e=new Error("No requests added yet, Please add at least one request.");throw e.name="Empty Payload",e}if(!n.validateDependencies(this.requests)){const e=new Error("Invalid dependency found, Dependency should be:\n1. Parallel - no individual request states a dependency in the dependsOn property.\n2. Serial - all individual requests depend on the previous individual request.\n3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency.");throw e.name="Invalid Dependency",e}for(;!s.done;){const t=s.value[1],i=yield n.getRequestData(t.request);if(void 0!==i.body&&(void 0===i.headers||void 0===i.headers["content-type"])){const e=new Error(`Content-type header is not mentioned for request #${t.id}, For request having body, Content-type header should be mentioned`);throw e.name="Invalid Content-type header",e}i.id=t.id,void 0!==t.dependsOn&&t.dependsOn.length>0&&(i.dependsOn=t.dependsOn),e.push(i),s=r.next()}return t.requests=e,t})}addDependency(e,t){if(!this.requests.has(e)){const t=new Error(`Dependent ${e} does not exists, Please check the id`);throw t.name="Invalid Dependent",t}if(void 0!==t&&!this.requests.has(t)){const e=new Error(`Dependency ${t} does not exists, Please check the id`);throw e.name="Invalid Dependency",e}if(void 0!==t){const n=this.requests.get(e);if(void 0===n.dependsOn&&(n.dependsOn=[]),-1!==n.dependsOn.indexOf(t)){const n=new Error(`Dependency ${t} is already added for the request ${e}`);throw n.name="Duplicate Dependency",n}n.dependsOn.push(t)}else{const n=this.requests.entries();let r,s=n.next();for(;!s.done&&s.value[1].id!==e;)r=s,s=n.next();if(void 0===r){const e=new Error(`Can't add dependency ${t}, There is only a dependent request in the batch`);throw e.name="Invalid Dependency Addition",e}{const t=r.value[0];if(void 0===s.value[1].dependsOn&&(s.value[1].dependsOn=[]),-1!==s.value[1].dependsOn.indexOf(t)){const n=new Error(`Dependency ${t} is already added for the request ${e}`);throw n.name="Duplicate Dependency",n}s.value[1].dependsOn.push(t)}}}removeDependency(e,t){const n=this.requests.get(e);if(void 0===n||void 0===n.dependsOn||0===n.dependsOn.length)return!1;if(void 0!==t){const e=n.dependsOn.indexOf(t);return-1!==e&&(n.dependsOn.splice(e,1),!0)}return delete n.dependsOn,!0}}n.requestLimit=20;class r{constructor(e){this.responses=new Map,this.update(e)}createResponseObject(e){const t=e.body,n={};return n.status=e.status,void 0!==e.statusText&&(n.statusText=e.statusText),n.headers=e.headers,new Response(t,n)}update(e){this.nextLink=e["@odata.nextLink"];const t=e.responses;for(let e=0,n=t.length;e<n;e++)this.responses.set(t[e].id,this.createResponseObject(t[e]))}getResponseById(e){return this.responses.get(e)}getResponses(){return this.responses}*getResponsesIterator(){const e=this.responses.entries();let t=e.next();for(;!t.done;)yield t.value,t=e.next()}}class s{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 i=()=>{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},o=(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,s=e.length;t<s;t++)if(e[t][0]===n){r=e[t][1];break}}else void 0!==t.headers[n]&&(r=t.headers[n]);return r},a=(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 s=t.headers.length;for(;e<s;e++){const s=t.headers[e];if(s[0]===n){s[1]=r;break}}e===s&&t.headers.push([n,r])}else Object.assign(t.headers,{[n]:r})},d=(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}`)},c=(t,n)=>e(void 0,void 0,void 0,function*(){const e=n.headers.get("Content-Type")?yield n.blob():yield Promise.resolve(void 0),{method:r,headers:s,referrer:i,referrerPolicy:o,mode:a,credentials:d,cache:c,redirect:h,integrity:l,keepalive:u,signal:p}=n;return new Request(t,{method:r,headers:s,body:e,referrer:i,referrerPolicy:o,mode:a,credentials:d,cache:c,redirect:h,integrity:l,keepalive:u,signal:p})});class h{constructor(e,t){this.authenticationProvider=e,this.authenticationProviderOptions=t}}var l;!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"}(l||(l={}));class u{constructor(){this.featureUsage=l.NONE}static updateFeatureUsageFlag(e,t){let n;e.middlewareControl instanceof s?n=e.middlewareControl.getMiddlewareOptions(u):e.middlewareControl=new s,void 0===n&&(n=new u,e.middlewareControl.setMiddlewareOptions(u,n)),n.setFeatureUsage(t)}setFeatureUsage(e){this.featureUsage=this.featureUsage|e}getFeatureUsage(){return this.featureUsage.toString(16)}}class p{constructor(e){this.authenticationProvider=e}execute(t){return e(this,void 0,void 0,function*(){try{let e,n,r;t.middlewareControl instanceof s&&(e=t.middlewareControl.getMiddlewareOptions(h)),void 0!==e&&(n=e.authenticationProvider,r=e.authenticationProviderOptions),void 0===n&&(n=this.authenticationProvider);const i=`Bearer ${yield n.getAccessToken(r)}`;return d(t.request,t.options,p.AUTHORIZATION_HEADER,i),u.updateFeatureUsageFlag(t,l.AUTHENTICATION_HANDLER_ENABLED),yield this.nextMiddleware.execute(t)}catch(e){throw e}})}setNext(e){this.nextMiddleware=e}}p.AUTHORIZATION_HEADER="Authorization";class f{execute(t){return e(this,void 0,void 0,function*(){try{return void(t.response=yield fetch(t.request,t.options))}catch(e){throw e}})}}class y{constructor(e=y.DEFAULT_DELAY,t=y.DEFAULT_MAX_RETRIES,n=y.DEFAULT_SHOULD_RETRY){if(e>y.MAX_DELAY&&t>y.MAX_MAX_RETRIES){const e=new Error(`Delay and MaxRetries should not be more than ${y.MAX_DELAY} and ${y.MAX_MAX_RETRIES}`);throw e.name="MaxLimitExceeded",e}if(e>y.MAX_DELAY){const e=new Error(`Delay should not be more than ${y.MAX_DELAY}`);throw e.name="MaxLimitExceeded",e}if(t>y.MAX_MAX_RETRIES){const e=new Error(`MaxRetries should not be more than ${y.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,y.MAX_DELAY),this.maxRetries=Math.min(t,y.MAX_MAX_RETRIES),this.shouldRetry=n}getMaxDelay(){return y.MAX_DELAY}}y.DEFAULT_DELAY=3,y.DEFAULT_MAX_RETRIES=3,y.MAX_DELAY=180,y.MAX_MAX_RETRIES=10,y.DEFAULT_SHOULD_RETRY=()=>!0;class m{constructor(e=new y){this.options=e}isRetry(e){return-1!==m.RETRY_STATUS_CODES.indexOf(e.status)}isBuffered(e,n){const r="string"==typeof e?n.method:e.method;if(r===t.PUT||r===t.PATCH||r===t.POST){if("application/octet-stream"===o(e,n,"Content-Type"))return!1}return!0}getDelay(e,t,n){const r=()=>Number(Math.random().toFixed(3)),s=void 0!==e.headers?e.headers.get(m.RETRY_AFTER_HEADER):null;let i;return i=null!==s?Number.isNaN(Number(s))?Math.round((new Date(s).getTime()-Date.now())/1e3):Number(s):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(t){return e(this,void 0,void 0,function*(){const e=1e3*t;return new Promise(t=>setTimeout(t,e))})}getOptions(e){let t;return e.middlewareControl instanceof s&&(t=e.middlewareControl.getMiddlewareOptions(this.options.constructor)),void 0===t&&(t=Object.assign(new y,this.options)),t}executeWithRetry(t,n,r){return e(this,void 0,void 0,function*(){try{if(yield this.nextMiddleware.execute(t),n<r.maxRetries&&this.isRetry(t.response)&&this.isBuffered(t.request,t.options)&&r.shouldRetry(r.delay,n,t.request,t.options,t.response)){++n,a(t.request,t.options,m.RETRY_ATTEMPT_HEADER,n.toString());const e=this.getDelay(t.response,n,r.delay);return yield this.sleep(e),yield this.executeWithRetry(t,n,r)}return}catch(e){throw e}})}execute(t){return e(this,void 0,void 0,function*(){try{const e=0,n=this.getOptions(t);return u.updateFeatureUsageFlag(t,l.RETRY_HANDLER_ENABLED),yield this.executeWithRetry(t,e,n)}catch(e){throw e}})}setNext(e){this.nextMiddleware=e}}m.RETRY_STATUS_CODES=[429,503,504],m.RETRY_ATTEMPT_HEADER="Retry-Attempt",m.RETRY_AFTER_HEADER="Retry-After";const E="2.0.0-Preview.4";class v{execute(t){return e(this,void 0,void 0,function*(){try{let e=o(t.request,t.options,v.CLIENT_REQUEST_ID_HEADER);null===e&&(e=i(),a(t.request,t.options,v.CLIENT_REQUEST_ID_HEADER,e));let n,r=`${v.PRODUCT_NAME}/${E}`;if(t.middlewareControl instanceof s&&(n=t.middlewareControl.getMiddlewareOptions(u)),void 0!==n){const e=n.getFeatureUsage();r+=` (${v.FEATURE_USAGE_STRING}=${e})`}return d(t.request,t.options,v.SDK_VERSION_HEADER,r),yield this.nextMiddleware.execute(t)}catch(e){throw e}})}setNext(e){this.nextMiddleware=e}}v.CLIENT_REQUEST_ID_HEADER="client-request-id",v.SDK_VERSION_HEADER="SdkVersion",v.PRODUCT_NAME="graph-js",v.FEATURE_USAGE_STRING="featureUsage";class w{constructor(e=-1,t=-1){this.minValue=e,this.maxValue=t}}class R{constructor(e,t,n,r={}){this.DEFAULT_FILE_SIZE=5242880,this.client=e,this.file=t,void 0===r.rangeSize&&(r.rangeSize=this.DEFAULT_FILE_SIZE),this.options=r,this.uploadSession=n,this.nextRange=new w(0,this.options.rangeSize-1)}static createUploadSession(t,n,r,s={}){return e(this,void 0,void 0,function*(){try{const e=yield t.api(n).headers(s).post(r);return{url:e.uploadUrl,expiry:new Date(e.expirationDateTime)}}catch(e){throw e}})}parseRange(e){const t=e[0];if(void 0===t||""===t)return new w;const n=t.split("-"),r=parseInt(n[0],10);let s=parseInt(n[1],10);return Number.isNaN(s)&&(s=this.file.size-1),new w(r,s)}updateTaskStatus(e){this.uploadSession.expiry=new Date(e.expirationDateTime),this.nextRange=this.parseRange(e.nextExpectedRanges)}getNextRange(){if(-1===this.nextRange.minValue)return this.nextRange;const e=this.nextRange.minValue;let t=e+this.options.rangeSize-1;return t>=this.file.size&&(t=this.file.size-1),new w(e,t)}sliceFile(e){return this.file.content.slice(e.minValue,e.maxValue+1)}upload(){return e(this,void 0,void 0,function*(){try{for(;;){const e=this.getNextRange();if(-1===e.maxValue){const e=new Error("Task with which you are trying to upload is already completed, Please check for your uploaded file");throw e.name="Invalid Session",e}const t=this.sliceFile(e),n=yield this.uploadSlice(t,e,this.file.size);if(void 0!==n.id)return n;this.updateTaskStatus(n)}}catch(e){throw e}})}uploadSlice(t,n,r){return e(this,void 0,void 0,function*(){try{return yield this.client.api(this.uploadSession.url).headers({"Content-Length":`${n.maxValue-n.minValue+1}`,"Content-Range":`bytes ${n.minValue}-${n.maxValue}/${r}`}).put(t)}catch(e){throw e}})}cancel(){return e(this,void 0,void 0,function*(){try{return yield this.client.api(this.uploadSession.url).delete()}catch(e){throw e}})}getStatus(){return e(this,void 0,void 0,function*(){try{const e=yield this.client.api(this.uploadSession.url).get();return this.updateTaskStatus(e),e}catch(e){throw e}})}resume(){return e(this,void 0,void 0,function*(){try{return yield this.getStatus(),yield this.upload()}catch(e){throw e}})}}const g=(e=5242880)=>{return e>62914560&&(e=62914560),(e=>(e>327680&&(e=320*Math.floor(e/327680)*1024),e))(e)};class A extends R{constructor(e,t,n,r){super(e,t,n,r)}static constructCreateSessionUrl(e,t=A.DEFAULT_UPLOAD_PATH){return e=e.trim(),""===(t=t.trim())&&(t="/"),"/"!==t[0]&&(t=`/${t}`),"/"!==t[t.length-1]&&(t=`${t}/`),encodeURI(`/me/drive/root:${t}${e}:/createUploadSession`)}static create(t,n,r){return e(this,void 0,void 0,function*(){const e=r.fileName;let s,i;if("undefined"!=typeof Blob&&n instanceof Blob)i=(s=new File([n],e)).size;else if("undefined"!=typeof File&&n instanceof File)i=(s=n).size;else if("undefined"!=typeof Buffer&&n instanceof Buffer){const e=n;i=e.byteLength-e.byteOffset,s=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}try{const n=A.constructCreateSessionUrl(r.fileName,r.path),o=yield A.createUploadSession(t,n,r.fileName),a=g(r.rangeSize);return new A(t,{name:e,content:s,size:i},o,{rangeSize:a})}catch(e){throw e}})}static createUploadSession(t,n,r){const s=Object.create(null,{createUploadSession:{get:()=>super.createUploadSession}});return e(this,void 0,void 0,function*(){const e={item:{"@microsoft.graph.conflictBehavior":"rename",name:r}};try{return s.createUploadSession.call(this,t,n,e)}catch(e){throw e}})}commit(t){return e(this,void 0,void 0,function*(){try{const e={name:this.file.name,"@microsoft.graph.conflictBehavior":"rename","@microsoft.graph.sourceUrl":this.uploadSession.url};return yield this.client.api(t).put(e)}catch(e){throw e}})}}A.DEFAULT_UPLOAD_PATH="/";class T{constructor(e,t,n){this.client=e,this.collection=t.value,this.nextLink=t["@odata.nextLink"],this.deltaLink=t["@odata.deltaLink"],this.callback=n,this.complete=!1}iterationHelper(){if(void 0===this.collection)return!1;let e=!0;for(;e&&0!==this.collection.length;){const t=this.collection.shift();e=this.callback(t)}return e}fetchAndUpdateNextPageData(){return e(this,void 0,void 0,function*(){try{const e=yield this.client.api(this.nextLink).get();this.collection=e.value,this.nextLink=e["@odata.nextLink"],this.deltaLink=e["@odata.deltaLink"]}catch(e){throw e}})}getDeltaLink(){return this.deltaLink}iterate(){return e(this,void 0,void 0,function*(){try{let e=this.iterationHelper();for(;e;)void 0!==this.nextLink?(yield this.fetchAndUpdateNextPageData(),e=this.iterationHelper()):e=!1;void 0===this.nextLink&&0===this.collection.length&&(this.complete=!0)}catch(e){throw e}})}resume(){return e(this,void 0,void 0,function*(){try{return this.iterate()}catch(e){throw e}})}isComplete(){return this.complete}}const O="v1.0",D="https://graph.microsoft.com/";class x{constructor(e){this.provider=e}getAccessToken(){return e(this,void 0,void 0,function*(){return new Promise((e,t)=>{this.provider((n,r)=>{r?e(r):t(n)})})})}}class _{constructor(e=-1){this.statusCode=e,this.code=null,this.message=null,this.requestId=null,this.date=new Date,this.body=null}}class b{static constructError(e,t){const n=new _(t);return void 0!==e.name&&(n.code=e.name),n.body=e.toString(),n.message=e.message,n.date=new Date,n}static constructErrorFromResponse(e,t){e=e.error;const n=new _(t);n.code=e.code,n.message=e.message,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(t=null,n=-1,r){return e(this,void 0,void 0,function*(){let e;if(e=t&&t.error?b.constructErrorFromResponse(t,n):"undefined"!=typeof Error&&t instanceof Error?b.constructError(t,n):new _(n),"function"!=typeof r)return e;r(e,null)})}}const P=["$select","$expand","$orderby","$filter","$top","$skip","$skipToken","$count"],L=e=>{const t=e=>e.replace(/\/+$/,""),n=e=>e.replace(/^\/+/,"");return Array.prototype.slice.call(e).reduce((e,r)=>[t(e),n(r)].join("/"))},U=e=>{const t=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};var S,C,M,N;!function(e){e.ARRAYBUFFER="arraybuffer",e.BLOB="blob",e.DOCUMENT="document",e.JSON="json",e.RAW="raw",e.STREAM="stream",e.TEXT="text"}(S||(S={})),function(e){e.TEXT_HTML="text/html",e.TEXT_XML="text/xml",e.APPLICATION_XML="application/xml",e.APPLICATION_XHTML="application/xhtml+xml"}(C||(C={})),function(e){e.TEXT_PLAIN="text/plain",e.APPLICATION_JSON="application/json"}(M||(M={})),function(e){e.DOCUMENT="^(text\\/(html|xml))|(application\\/(xml|xhtml\\+xml))$",e.IMAGE="^image\\/.+"}(N||(N={}));class q{static parseDocumentResponse(e,t){try{return"undefined"!=typeof DOMParser?new Promise((n,r)=>{e.text().then(e=>{try{const s=(new DOMParser).parseFromString(e,t);n(s)}catch(e){r(e)}})}):Promise.resolve(e.body)}catch(e){throw e}}static convertResponse(t,n){return e(this,void 0,void 0,function*(){if(204===t.status)return Promise.resolve();let e;try{switch(n){case S.ARRAYBUFFER:e=yield t.arrayBuffer();break;case S.BLOB:e=yield t.blob();break;case S.DOCUMENT:e=yield q.parseDocumentResponse(t,C.TEXT_XML);break;case S.JSON:e=yield t.json();break;case S.STREAM:e=yield Promise.resolve(t.body);break;case S.TEXT:e=yield t.text();break;default:const r=t.headers.get("Content-type");if(null!==r){const n=r.split(";")[0];e=new RegExp(N.DOCUMENT).test(n)?yield q.parseDocumentResponse(t,n):new RegExp(N.IMAGE).test(n)?t.blob():n===M.TEXT_PLAIN?yield t.text():n===M.APPLICATION_JSON?yield t.json():Promise.resolve(t.body)}else e=Promise.resolve(t.body)}}catch(e){throw e}return e})}static getResponse(t,n,r){return e(this,void 0,void 0,function*(){try{if(n===S.RAW)return Promise.resolve(t);{const e=yield q.convertResponse(t,n);if(!t.ok)throw e;if("function"!=typeof r)return e;r(null,e)}}catch(e){throw e}})}}class I{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){const t=e.split("="),n=t[0],r=t[1];-1!==P.indexOf(n)?this.urlComponents.oDataQueryParams[n]=r:this.urlComponents.otherURLQueryParams[n]=r}}},this.httpClient=e,this.config=t,this.urlComponents={host:this.config.baseUrl,version:this.config.defaultVersion,oDataQueryParams:{},otherURLQueryParams:{}},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=L([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]);return t.length>0?"?"+t.join("&"):""}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(t,n,r){return e(this,void 0,void 0,function*(){let e;const i=new s(this._middlewareOptions);this.updateRequestOptions(n);try{return e=(yield this.httpClient.sendRequest({request:t,options:n,middlewareControl:i})).response,yield q.getResponse(e,this._responseType,r)}catch(t){let n;throw void 0!==e&&(n=e.status),yield b.getError(t,n,r)}})}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){return this.urlComponents.oDataQueryParams.$count=e.toString(),this}query(e){const t=this.urlComponents.otherURLQueryParams;if("string"==typeof e){const n=e.split("="),r=n[0],s=n[1];t[r]=s}else for(const n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return this}get(n){return e(this,void 0,void 0,function*(){const e=this.buildFullUrl(),r={method:t.GET};try{return yield this.send(e,r,n)}catch(e){throw e}})}post(n,r){return e(this,void 0,void 0,function*(){const e=this.buildFullUrl(),s={method:t.POST,body:U(n),headers:"undefined"!=typeof FormData&&n instanceof FormData?{}:{"Content-Type":"application/json"}};try{return yield this.send(e,s,r)}catch(e){throw e}})}create(t,n){return e(this,void 0,void 0,function*(){try{return yield this.post(t,n)}catch(e){throw e}})}put(n,r){return e(this,void 0,void 0,function*(){const e=this.buildFullUrl(),s={method:t.PUT,body:U(n),headers:{"Content-Type":"application/json"}};try{return yield this.send(e,s,r)}catch(e){throw e}})}patch(n,r){return e(this,void 0,void 0,function*(){const e=this.buildFullUrl(),s={method:t.PATCH,body:U(n),headers:{"Content-Type":"application/json"}};try{return yield this.send(e,s,r)}catch(e){throw e}})}update(t,n){return e(this,void 0,void 0,function*(){try{return yield this.patch(t,n)}catch(e){throw e}})}delete(n){return e(this,void 0,void 0,function*(){const e=this.buildFullUrl(),r={method:t.DELETE};try{return yield this.send(e,r,n)}catch(e){throw e}})}del(t){return e(this,void 0,void 0,function*(){try{return yield this.delete(t)}catch(e){throw e}})}getStream(n){return e(this,void 0,void 0,function*(){const e=this.buildFullUrl(),r={method:t.GET};this.responseType(S.STREAM);try{return yield this.send(e,r,n)}catch(e){throw e}})}putStream(n,r){return e(this,void 0,void 0,function*(){const e=this.buildFullUrl(),s={method:t.PUT,headers:{"Content-Type":"application/octet-stream"},body:n};try{return yield this.send(e,s,r)}catch(e){throw e}})}}class F{constructor(e){this.middleware=e}sendRequest(t){return e(this,void 0,void 0,function*(){try{if("string"==typeof t.request&&void 0===t.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(t),t}catch(e){throw e}})}}class H{constructor(e=H.DEFAULT_MAX_REDIRECTS,t=H.DEFAULT_SHOULD_RETRY){if(e>H.MAX_MAX_REDIRECTS){const e=new Error(`MaxRedirects should not be more than ${H.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}}H.DEFAULT_MAX_REDIRECTS=5,H.MAX_MAX_REDIRECTS=20,H.DEFAULT_SHOULD_RETRY=()=>!0;class k{constructor(e=new H){this.options=e}isRedirect(e){return-1!==k.REDIRECT_STATUS_CODES.indexOf(e.status)}hasLocationHeader(e){return e.headers.has(k.LOCATION_HEADER)}getLocationHeader(e){return e.headers.get(k.LOCATION_HEADER)}isRelativeURL(e){return-1===e.indexOf("://")}shouldDropAuthorizationHeader(e,t){const n=/^[A-Za-z].+?:\/\/.+?(?=\/|$)/,r=n.exec(e);let s,i;null!==r&&(s=r[0]);const o=n.exec(t);return null!==o&&(i=o[0]),void 0!==s&&void 0!==i&&s!==i}updateRequestUrl(t,n){return e(this,void 0,void 0,function*(){n.request="string"==typeof n.request?t:yield c(t,n.request)})}getOptions(e){let t;return e.middlewareControl instanceof s&&(t=e.middlewareControl.getMiddlewareOptions(H)),void 0===t&&(t=Object.assign(new H,this.options)),t}executeWithRedirect(n,r,s){return e(this,void 0,void 0,function*(){try{yield this.nextMiddleware.execute(n);const e=n.response;if(!(r<s.maxRedirects&&this.isRedirect(e)&&this.hasLocationHeader(e)&&s.shouldRedirect(e)))return;if(++r,e.status===k.STATUS_CODE_SEE_OTHER)n.options.method=t.GET,delete n.options.body;else{const t=this.getLocationHeader(e);!this.isRelativeURL(t)&&this.shouldDropAuthorizationHeader(e.url,t)&&a(n.request,n.options,k.AUTHORIZATION_HEADER,void 0),yield this.updateRequestUrl(t,n)}yield this.executeWithRedirect(n,r,s)}catch(e){throw e}})}execute(t){return e(this,void 0,void 0,function*(){try{const e=0,n=this.getOptions(t);return t.options.redirect=k.MANUAL_REDIRECT,u.updateFeatureUsageFlag(t,l.REDIRECT_HANDLER_ENABLED),yield this.executeWithRedirect(t,e,n)}catch(e){throw e}})}setNext(e){this.nextMiddleware=e}}k.REDIRECT_STATUS_CODES=[301,302,303,307,308],k.STATUS_CODE_SEE_OTHER=303,k.LOCATION_HEADER="Location",k.AUTHORIZATION_HEADER="Authorization",k.MANUAL_REDIRECT="manual";const $=()=>new Function("try {return this === global;}catch(e){return false;}")();class X{static createWithAuthenticationProvider(e){const t=new p(e),n=new m(new y),r=new v,s=new f;if(t.setNext(n),$()){const e=new k(new H);n.setNext(e),e.setNext(r)}else n.setNext(r);return r.setNext(s),X.createWithMiddleware(t)}static createWithMiddleware(e){return new F(e)}}const B=()=>{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}return!0};class Q{constructor(e){this.config={baseUrl:D,debugLogging:!1,defaultVersion:O};try{B()}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=X.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 F(e.middleware)}this.httpClient=t}static init(e){const t={};for(const n in e)e.hasOwnProperty(n)&&(t[n]="authProvider"===n?new x(e[n]):e[n]);return Q.initWithMiddleware(t)}static initWithMiddleware(e){try{return new Q(e)}catch(e){throw e}}api(e){return new I(this.httpClient,this.config,e)}}class j{constructor(e,t){this.options=t,this.msalApplication=e}getAccessToken(t){return e(this,void 0,void 0,function*(){let e;if(void 0!==t&&(e=t.scopes),void 0!==e&&0!==e.length||(e=this.options.scopes),0===e.length){const e=new Error;throw e.name="EmptyScopes",e.message="Scopes cannot be empty, Please provide a scopes",e}if(this.msalApplication.getAccount()){const t={scopes:e};try{return(yield this.msalApplication.acquireTokenSilent(t)).accessToken}catch(e){if("InteractionRequiredAuthError"!==e.name)throw e;try{return(yield this.msalApplication.acquireTokenPopup(t)).accessToken}catch(e){throw e}}}else try{const t={scopes:e};return yield this.msalApplication.loginPopup(t),(yield this.msalApplication.acquireTokenSilent(t)).accessToken}catch(e){throw e}})}}class Y{constructor(e){this.scopes=e}}export{p as AuthenticationHandler,h as AuthenticationHandlerOptions,n as BatchRequestContent,r as BatchResponseContent,Q as Client,l as FeatureUsageFlag,_ as GraphError,I as GraphRequest,f as HTTPMessageHandler,j as ImplicitMSALAuthenticationProvider,R as LargeFileUploadTask,Y as MSALAuthenticationProviderOptions,A as OneDriveLargeFileUploadTask,T as PageIterator,S as ResponseType,m as RetryHandler,y as RetryHandlerOptions,v as TelemetryHandler,u as TelemetryHandlerOptions};

@@ -1,1 +0,1 @@

var MicrosoftGraph=function(e){"use strict";function t(e,t){return e(t={exports:{}},t.exports),t.exports}var r=t(function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function u(e,t,r,n){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),o=new O(n||[]);return i._invoke=function(e,t,r){var n=h;return function(a,i){if(n===l)throw new Error("Generator is already running");if(n===p){if("throw"===a)throw i;return _()}for(r.method=a,r.arg=i;;){var o=r.delegate;if(o){var s=R(o,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=l;var u=c(e,t,r);if("normal"===u.type){if(n=r.done?p:d,u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=p,r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h="suspendedStart",d="suspendedYield",l="executing",p="completed",f={};function v(){}function y(){}function m(){}var w={};w[i]=function(){return this};var x=Object.getPrototypeOf,g=x&&x(x(D([])));g&&g!==r&&n.call(g,i)&&(w=g);var E=m.prototype=v.prototype=Object.create(w);function b(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function k(e){var t;this._invoke=function(r,a){function i(){return new Promise(function(t,i){!function t(r,a,i,o){var s=c(e[r],e,a);if("throw"!==s.type){var u=s.arg,h=u.value;return h&&"object"==typeof h&&n.call(h,"__await")?Promise.resolve(h.__await).then(function(e){t("next",e,i,o)},function(e){t("throw",e,i,o)}):Promise.resolve(h).then(function(e){u.value=e,i(u)},function(e){return t("throw",e,i,o)})}o(s.arg)}(r,a,t,i)})}return t=t?t.then(i,i):i()}}function R(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,R(e,r),"throw"===r.method))return f;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var a=c(n,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,f;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,f):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function D(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,o=function r(){for(;++a<e.length;)if(n.call(e,a))return r.value=e[a],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}return{next:_}}function _(){return{value:t,done:!0}}return y.prototype=E.constructor=m,m.constructor=y,m[s]=y.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s in e||(e[s]="GeneratorFunction")),e.prototype=Object.create(E),e},e.awrap=function(e){return{__await:e}},b(k.prototype),k.prototype[o]=function(){return this},e.AsyncIterator=k,e.async=function(t,r,n,a){var i=new k(u(t,r,n,a));return e.isGeneratorFunction(r)?i:i.next().then(function(e){return e.done?e.value:i.next()})},b(E),E[s]="Generator",E[i]=function(){return this},E.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=D,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function a(n,a){return s.type="throw",s.arg=e,r.next=n,a&&(r.method="next",r.arg=t),!!a}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return a("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return a(o.catchLoc,!0);if(this.prev<o.finallyLoc)return a(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return a(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return a(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;A(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:D(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),f}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}});var n=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var i,o=function(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e};function s(e,t,r,n){return new(r||(r=Promise))(function(a,i){function o(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?a(e.value):new r(function(t){t(e.value)}).then(o,s)}u((n=n.apply(e,t||[])).next())})}!function(e){e.GET="GET",e.PATCH="PATCH",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE"}(i||(i={}));var u=function(){function e(t){if(n(this,e),this.requests=new Map,void 0!==t){var r=e.requestLimit;if(t.length>r){var a=new Error("Maximum requests limit exceeded, Max allowed number of requests are ".concat(r));throw a.name="Limit Exceeded Error",a}var i=!0,o=!1,s=void 0;try{for(var u,c=t[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var h=u.value;this.addRequest(h)}}catch(e){o=!0,s=e}finally{try{i||null==c.return||c.return()}finally{if(o)throw s}}}}return o(e,[{key:"addRequest",value:function(t){var r=e.requestLimit;if(""===t.id){var n=new Error("Id for a request is empty, Please provide an unique id");throw n.name="Empty Id For Request",n}if(this.requests.size===r){var a=new Error("Maximum requests limit exceeded, Max allowed number of requests are ".concat(r));throw a.name="Limit Exceeded Error",a}if(this.requests.has(t.id)){var i=new Error("Adding request with duplicate id ".concat(t.id,", Make the id of the requests unique"));throw i.name="Duplicate RequestId Error",i}return this.requests.set(t.id,t),t.id}},{key:"removeRequest",value:function(e){for(var t=this.requests.delete(e),r=this.requests.entries(),n=r.next();!n.done;){var a=n.value[1].dependsOn;if(void 0!==a){var i=a.indexOf(e);-1!==i&&a.splice(i,1),0===a.length&&delete n.value[1].dependsOn}n=r.next()}return t}},{key:"getContent",value:function(){return s(this,void 0,void 0,r.mark(function t(){var n,a,i,o,s,u,c,h,d;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(a={requests:n=[]},i=this.requests.entries(),!(o=i.next()).done){t.next=8;break}throw(s=new Error("No requests added yet, Please add at least one request.")).name="Empty Payload",s;case 8:if(e.validateDependencies(this.requests)){t.next=12;break}throw(u=new Error("Invalid dependency found, Dependency should be:\n1. Parallel - no individual request states a dependency in the dependsOn property.\n2. Serial - all individual requests depend on the previous individual request.\n3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency.")).name="Invalid Dependency",u;case 12:if(o.done){t.next=27;break}return c=o.value[1],t.next=16,e.getRequestData(c.request);case 16:if(void 0===(h=t.sent).body||void 0!==h.headers&&void 0!==h.headers["content-type"]){t.next=21;break}throw(d=new Error("Content-type header is not mentioned for request #".concat(c.id,", For request having body, Content-type header should be mentioned"))).name="Invalid Content-type header",d;case 21:h.id=c.id,void 0!==c.dependsOn&&c.dependsOn.length>0&&(h.dependsOn=c.dependsOn),n.push(h),o=i.next(),t.next=12;break;case 27:return a.requests=n,t.abrupt("return",a);case 29:case"end":return t.stop()}},t,this)}))}},{key:"addDependency",value:function(e,t){if(!this.requests.has(e)){var r=new Error("Dependent ".concat(e," does not exists, Please check the id"));throw r.name="Invalid Dependent",r}if(void 0!==t&&!this.requests.has(t)){var n=new Error("Dependency ".concat(t," does not exists, Please check the id"));throw n.name="Invalid Dependency",n}if(void 0!==t){var a=this.requests.get(e);if(void 0===a.dependsOn&&(a.dependsOn=[]),-1!==a.dependsOn.indexOf(t)){var i=new Error("Dependency ".concat(t," is already added for the request ").concat(e));throw i.name="Duplicate Dependency",i}a.dependsOn.push(t)}else{for(var o,s=this.requests.entries(),u=s.next();!u.done&&u.value[1].id!==e;)o=u,u=s.next();if(void 0===o){var c=new Error("Can't add dependency ".concat(t,", There is only a dependent request in the batch"));throw c.name="Invalid Dependency Addition",c}var h=o.value[0];if(void 0===u.value[1].dependsOn&&(u.value[1].dependsOn=[]),-1!==u.value[1].dependsOn.indexOf(h)){var d=new Error("Dependency ".concat(h," is already added for the request ").concat(e));throw d.name="Duplicate Dependency",d}u.value[1].dependsOn.push(h)}}},{key:"removeDependency",value:function(e,t){var r=this.requests.get(e);if(void 0===r||void 0===r.dependsOn||0===r.dependsOn.length)return!1;if(void 0!==t){var n=r.dependsOn.indexOf(t);return-1!==n&&(r.dependsOn.splice(n,1),!0)}return delete r.dependsOn,!0}}],[{key:"validateDependencies",value:function(e){if(0===e.size){var t=new Error("Empty requests map, Please provide at least one request.");throw t.name="Empty Requests Error",t}return function(e){for(var t=e.entries(),r=t.next();!r.done;){var n=r.value[1];if(void 0!==n.dependsOn&&n.dependsOn.length>0)return!1;r=t.next()}return!0}(e)||function(e){var t=e.entries(),r=t.next(),n=r.value[1];if(void 0!==n.dependsOn&&n.dependsOn.length>0)return!1;var a=r;for(r=t.next();!r.done;){var i=r.value[1];if(void 0===i.dependsOn||1!==i.dependsOn.length||i.dependsOn[0]!==a.value[1].id)return!1;a=r,r=t.next()}return!0}(e)||function(e){var t,r=e.entries(),n=r.next(),a=n.value[1];if(void 0===a.dependsOn||0===a.dependsOn.length)t=a.id;else{if(1!==a.dependsOn.length)return!1;var i=a.dependsOn[0];if(i===a.id||!e.has(i))return!1;t=i}for(n=r.next();!n.done;){var o=n.value[1];if((void 0===o.dependsOn||0===o.dependsOn.length)&&t!==o.id)return!1;if(void 0!==o.dependsOn&&0!==o.dependsOn.length){if(1===o.dependsOn.length&&(o.id===t||o.dependsOn[0]!==t))return!1;if(o.dependsOn.length>1)return!1}n=r.next()}return!0}(e)}},{key:"getRequestData",value:function(t){return s(this,void 0,void 0,r.mark(function n(){var a,o,s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(a={url:""},o=new RegExp("^https?://"),a.url=o.test(t.url)?"/"+t.url.split(/.*?\/\/.*?\//)[1]:t.url,a.method=t.method,s={},t.headers.forEach(function(e,t){s[t]=e}),Object.keys(s).length&&(a.headers=s),t.method!==i.PATCH&&t.method!==i.POST&&t.method!==i.PUT){r.next=11;break}return r.next=10,e.getRequestBody(t);case 10:a.body=r.sent;case 11:return r.abrupt("return",a);case 12:case"end":return r.stop()}},n)}))}},{key:"getRequestBody",value:function(e){return s(this,void 0,void 0,r.mark(function t(){var n,a,i,o,s,u;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=!1,t.prev=1,i=e.clone(),t.next=5,i.json();case 5:a=t.sent,n=!0,t.next=11;break;case 9:t.prev=9,t.t0=t.catch(1);case 11:if(n){t.next=33;break}if(t.prev=12,"undefined"==typeof Blob){t.next=23;break}return t.next=16,e.blob();case 16:return o=t.sent,s=new FileReader,t.next=20,new Promise(function(e){s.addEventListener("load",function(){var t=s.result,r=new RegExp("^s*data:(.+?/.+?(;.+?=.+?)*)?(;base64)?,(.*)s*$").exec(t);e(r[4])},!1),s.readAsDataURL(o)});case 20:a=t.sent,t.next=28;break;case 23:if("undefined"==typeof Buffer){t.next=28;break}return t.next=26,e.buffer();case 26:u=t.sent,a=u.toString("base64");case 28:n=!0,t.next=33;break;case 31:t.prev=31,t.t1=t.catch(12);case 33:return t.abrupt("return",a);case 34:case"end":return t.stop()}},t,null,[[1,9],[12,31]])}))}}]),e}();u.requestLimit=20;var c=function(){function e(t){n(this,e),this.responses=new Map,this.update(t)}return o(e,[{key:"createResponseObject",value:function(e){var t=e.body,r={};return r.status=e.status,void 0!==e.statusText&&(r.statusText=e.statusText),r.headers=e.headers,new Response(t,r)}},{key:"update",value:function(e){this.nextLink=e["@odata.nextLink"];for(var t=e.responses,r=0,n=t.length;r<n;r++)this.responses.set(t[r].id,this.createResponseObject(t[r]))}},{key:"getResponseById",value:function(e){return this.responses.get(e)}},{key:"getResponses",value:function(){return this.responses}},{key:"getResponsesIterator",value:r.mark(function e(){var t,n;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=this.responses.entries(),n=t.next();case 2:if(n.done){e.next=8;break}return e.next=5,n.value;case 5:n=t.next(),e.next=2;break;case 8:case"end":return e.stop()}},e,this)})}]),e}(),h=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];n(this,e),this.middlewareOptions=new Map;var r=!0,a=!1,i=void 0;try{for(var o,s=t[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var u=o.value,c=u.constructor;this.middlewareOptions.set(c,u)}}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}}return o(e,[{key:"getMiddlewareOptions",value:function(e){return this.middlewareOptions.get(e)}},{key:"setMiddlewareOptions",value:function(e,t){this.middlewareOptions.set(e,t)}}]),e}();var d,l=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},p=function(){for(var e="",t=0;t<32;t++)8!==t&&12!==t&&16!==t&&20!==t||(e+="-"),e+=Math.floor(16*Math.random()).toString(16);return e},f=function(e,t,r){var n=null;if("undefined"!=typeof Request&&e instanceof Request)n=e.headers.get(r);else if(void 0!==t&&void 0!==t.headers)if("undefined"!=typeof Headers&&t.headers instanceof Headers)n=t.headers.get(r);else if(t.headers instanceof Array){for(var a=t.headers,i=0,o=a.length;i<o;i++)if(a[i][0]===r){n=a[i][1];break}}else void 0!==t.headers[r]&&(n=t.headers[r]);return n},v=function(e,t,r,n){if("undefined"!=typeof Request&&e instanceof Request)e.headers.set(r,n);else if(void 0!==t)if(void 0===t.headers)t.headers=new Headers(l({},r,n));else if("undefined"!=typeof Headers&&t.headers instanceof Headers)t.headers.set(r,n);else if(t.headers instanceof Array){for(var a=0,i=t.headers.length;a<i;a++){var o=t.headers[a];if(o[0]===r){o[1]=n;break}}a===i&&t.headers.push([r,n])}else Object.assign(t.headers,l({},r,n))},y=function(e,t,r,n){"undefined"!=typeof Request&&e instanceof Request?e.headers.append(r,n):void 0!==t&&(void 0===t.headers?t.headers=new Headers(l({},r,n)):"undefined"!=typeof Headers&&t.headers instanceof Headers?t.headers.append(r,n):t.headers instanceof Array?t.headers.push([r,n]):void 0===t.headers?t.headers=l({},r,n):void 0===t.headers[r]?t.headers[r]=n:t.headers[r]+=", ".concat(n))},m=function(e,t){return s(void 0,void 0,void 0,r.mark(function n(){var a,i,o,s,u,c,h,d,l,p,f,v;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!t.headers.get("Content-Type")){r.next=6;break}return r.next=3,t.blob();case 3:r.t0=r.sent,r.next=9;break;case 6:return r.next=8,Promise.resolve(void 0);case 8:r.t0=r.sent;case 9:return a=r.t0,i=t.method,o=t.headers,s=t.referrer,u=t.referrerPolicy,c=t.mode,h=t.credentials,d=t.cache,l=t.redirect,p=t.integrity,f=t.keepalive,v=t.signal,r.abrupt("return",new Request(e,{method:i,headers:o,body:a,referrer:s,referrerPolicy:u,mode:c,credentials:h,cache:d,redirect:l,integrity:p,keepalive:f,signal:v}));case 12:case"end":return r.stop()}},n)}))},w=function e(t,r){n(this,e),this.authenticationProvider=t,this.authenticationProviderOptions=r};(d=e.FeatureUsageFlag||(e.FeatureUsageFlag={}))[d.NONE=0]="NONE",d[d.REDIRECT_HANDLER_ENABLED=1]="REDIRECT_HANDLER_ENABLED",d[d.RETRY_HANDLER_ENABLED=2]="RETRY_HANDLER_ENABLED",d[d.AUTHENTICATION_HANDLER_ENABLED=4]="AUTHENTICATION_HANDLER_ENABLED";var x=function(){function t(){n(this,t),this.featureUsage=e.FeatureUsageFlag.NONE}return o(t,[{key:"setFeatureUsage",value:function(e){this.featureUsage=this.featureUsage|e}},{key:"getFeatureUsage",value:function(){return this.featureUsage.toString(16)}}],[{key:"updateFeatureUsageFlag",value:function(e,r){var n;e.middlewareControl instanceof h?n=e.middlewareControl.getMiddlewareOptions(t):e.middlewareControl=new h,void 0===n&&(n=new t,e.middlewareControl.setMiddlewareOptions(t,n)),n.setFeatureUsage(r)}}]),t}(),g=function(){function t(e){n(this,t),this.authenticationProvider=e}return o(t,[{key:"execute",value:function(n){return s(this,void 0,void 0,r.mark(function a(){var i,o,s,u,c;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,n.middlewareControl instanceof h&&(i=n.middlewareControl.getMiddlewareOptions(w)),void 0!==i&&(o=i.authenticationProvider,s=i.authenticationProviderOptions),void 0===o&&(o=this.authenticationProvider),r.next=6,o.getAccessToken(s);case 6:return u=r.sent,c="Bearer ".concat(u),y(n.request,n.options,t.AUTHORIZATION_HEADER,c),x.updateFeatureUsageFlag(n,e.FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED),r.next=12,this.nextMiddleware.execute(n);case 12:return r.abrupt("return",r.sent);case 15:throw r.prev=15,r.t0=r.catch(0),r.t0;case 18:case"end":return r.stop()}},a,this,[[0,15]])}))}},{key:"setNext",value:function(e){this.nextMiddleware=e}}]),t}();g.AUTHORIZATION_HEADER="Authorization";var E=function(){function e(){n(this,e)}return o(e,[{key:"execute",value:function(e){return s(this,void 0,void 0,r.mark(function t(){return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,fetch(e.request,e.options);case 3:return e.response=t.sent,t.abrupt("return");case 7:throw t.prev=7,t.t0=t.catch(0),t.t0;case 10:case"end":return t.stop()}},t,null,[[0,7]])}))}}]),e}(),b=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.DEFAULT_DELAY,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.DEFAULT_MAX_RETRIES,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.DEFAULT_SHOULD_RETRY;if(n(this,e),t>e.MAX_DELAY&&r>e.MAX_MAX_RETRIES){var i=new Error("Delay and MaxRetries should not be more than ".concat(e.MAX_DELAY," and ").concat(e.MAX_MAX_RETRIES));throw i.name="MaxLimitExceeded",i}if(t>e.MAX_DELAY){var o=new Error("Delay should not be more than ".concat(e.MAX_DELAY));throw o.name="MaxLimitExceeded",o}if(r>e.MAX_MAX_RETRIES){var s=new Error("MaxRetries should not be more than ".concat(e.MAX_MAX_RETRIES));throw s.name="MaxLimitExceeded",s}if(t<0&&r<0){var u=new Error("Delay and MaxRetries should not be negative");throw u.name="MinExpectationNotMet",u}if(t<0){var c=new Error("Delay should not be negative");throw c.name="MinExpectationNotMet",c}if(r<0){var h=new Error("MaxRetries should not be negative");throw h.name="MinExpectationNotMet",h}this.delay=Math.min(t,e.MAX_DELAY),this.maxRetries=Math.min(r,e.MAX_MAX_RETRIES),this.shouldRetry=a}return o(e,[{key:"getMaxDelay",value:function(){return e.MAX_DELAY}}]),e}();b.DEFAULT_DELAY=3,b.DEFAULT_MAX_RETRIES=3,b.MAX_DELAY=180,b.MAX_MAX_RETRIES=10,b.DEFAULT_SHOULD_RETRY=function(){return!0};var k=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new b;n(this,t),this.options=e}return o(t,[{key:"isRetry",value:function(e){return-1!==t.RETRY_STATUS_CODES.indexOf(e.status)}},{key:"isBuffered",value:function(e,t){var r="string"==typeof e?t.method:e.method;if((r===i.PUT||r===i.PATCH||r===i.POST)&&"application/octet-stream"===f(e,t,"Content-Type"))return!1;return!0}},{key:"getDelay",value:function(e,r,n){var a,i=function(){return Number(Math.random().toFixed(3))},o=void 0!==e.headers?e.headers.get(t.RETRY_AFTER_HEADER):null;return a=null!==o?Number.isNaN(Number(o))?Math.round((new Date(o).getTime()-Date.now())/1e3):Number(o):r>=2?this.getExponentialBackOffTime(r)+n+i():n+i(),Math.min(a,this.options.getMaxDelay()+i())}},{key:"getExponentialBackOffTime",value:function(e){return Math.round(.5*(Math.pow(2,e)-1))}},{key:"sleep",value:function(e){return s(this,void 0,void 0,r.mark(function t(){var n;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=1e3*e,t.abrupt("return",new Promise(function(e){return setTimeout(e,n)}));case 2:case"end":return t.stop()}},t)}))}},{key:"getOptions",value:function(e){var t;return e.middlewareControl instanceof h&&(t=e.middlewareControl.getMiddlewareOptions(this.options.constructor)),void 0===t&&(t=Object.assign(new b,this.options)),t}},{key:"executeWithRetry",value:function(e,n,a){return s(this,void 0,void 0,r.mark(function i(){var o;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,this.nextMiddleware.execute(e);case 3:if(!(n<a.maxRetries&&this.isRetry(e.response)&&this.isBuffered(e.request,e.options)&&a.shouldRetry(a.delay,n,e.request,e.options,e.response))){r.next=14;break}return++n,v(e.request,e.options,t.RETRY_ATTEMPT_HEADER,n.toString()),o=this.getDelay(e.response,n,a.delay),r.next=9,this.sleep(o);case 9:return r.next=11,this.executeWithRetry(e,n,a);case 11:return r.abrupt("return",r.sent);case 14:return r.abrupt("return");case 15:r.next=20;break;case 17:throw r.prev=17,r.t0=r.catch(0),r.t0;case 20:case"end":return r.stop()}},i,this,[[0,17]])}))}},{key:"execute",value:function(t){return s(this,void 0,void 0,r.mark(function n(){var a;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,0,a=this.getOptions(t),x.updateFeatureUsageFlag(t,e.FeatureUsageFlag.RETRY_HANDLER_ENABLED),r.next=6,this.executeWithRetry(t,0,a);case 6:return r.abrupt("return",r.sent);case 9:throw r.prev=9,r.t0=r.catch(0),r.t0;case 12:case"end":return r.stop()}},n,this,[[0,9]])}))}},{key:"setNext",value:function(e){this.nextMiddleware=e}}]),t}();k.RETRY_STATUS_CODES=[429,503,504],k.RETRY_ATTEMPT_HEADER="Retry-Attempt",k.RETRY_AFTER_HEADER="Retry-After";var R=function(){function e(){n(this,e)}return o(e,[{key:"execute",value:function(t){return s(this,void 0,void 0,r.mark(function n(){var a,i,o,s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,null===(a=f(t.request,t.options,e.CLIENT_REQUEST_ID_HEADER))&&(a=p(),v(t.request,t.options,e.CLIENT_REQUEST_ID_HEADER,a)),i="".concat(e.PRODUCT_NAME,"/").concat("2.0.0-Preview.3"),t.middlewareControl instanceof h&&(o=t.middlewareControl.getMiddlewareOptions(x)),void 0!==o&&(s=o.getFeatureUsage(),i+=" (".concat(e.FEATURE_USAGE_STRING,"=").concat(s,")")),y(t.request,t.options,e.SDK_VERSION_HEADER,i),r.next=9,this.nextMiddleware.execute(t);case 9:return r.abrupt("return",r.sent);case 12:throw r.prev=12,r.t0=r.catch(0),r.t0;case 15:case"end":return r.stop()}},n,this,[[0,12]])}))}},{key:"setNext",value:function(e){this.nextMiddleware=e}}]),e}();R.CLIENT_REQUEST_ID_HEADER="client-request-id",R.SDK_VERSION_HEADER="SdkVersion",R.PRODUCT_NAME="graph-js",R.FEATURE_USAGE_STRING="featureUsage";var T=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;n(this,e),this.minValue=t,this.maxValue=r},A=function(){function e(t,r,a){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};n(this,e),this.DEFAULT_FILE_SIZE=5242880,this.client=t,this.file=r,void 0===i.rangeSize&&(i.rangeSize=this.DEFAULT_FILE_SIZE),this.options=i,this.uploadSession=a,this.nextRange=new T(0,this.options.rangeSize-1)}return o(e,[{key:"parseRange",value:function(e){var t=e[0];if(void 0===t||""===t)return new T;var r=t.split("-"),n=parseInt(r[0],10),a=parseInt(r[1],10);return Number.isNaN(a)&&(a=this.file.size-1),new T(n,a)}},{key:"updateTaskStatus",value:function(e){this.uploadSession.expiry=new Date(e.expirationDateTime),this.nextRange=this.parseRange(e.nextExpectedRanges)}},{key:"getNextRange",value:function(){if(-1===this.nextRange.minValue)return this.nextRange;var e=this.nextRange.minValue,t=e+this.options.rangeSize-1;return t>=this.file.size&&(t=this.file.size-1),new T(e,t)}},{key:"sliceFile",value:function(e){return this.file.content.slice(e.minValue,e.maxValue+1)}},{key:"upload",value:function(){return s(this,void 0,void 0,r.mark(function e(){var t,n,a,i;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0;case 1:if(-1!==(t=this.getNextRange()).maxValue){e.next=7;break}throw(n=new Error("Task with which you are trying to upload is already completed, Please check for your uploaded file")).name="Invalid Session",n;case 7:return a=this.sliceFile(t),e.next=10,this.uploadSlice(a,t,this.file.size);case 10:if(void 0===(i=e.sent).id){e.next=15;break}return e.abrupt("return",i);case 15:this.updateTaskStatus(i);case 16:e.next=1;break;case 18:e.next=23;break;case 20:throw e.prev=20,e.t0=e.catch(0),e.t0;case 23:case"end":return e.stop()}},e,this,[[0,20]])}))}},{key:"uploadSlice",value:function(e,t,n){return s(this,void 0,void 0,r.mark(function a(){return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,this.client.api(this.uploadSession.url).headers({"Content-Length":"".concat(t.maxValue-t.minValue+1),"Content-Range":"bytes ".concat(t.minValue,"-").concat(t.maxValue,"/").concat(n)}).put(e);case 3:return r.abrupt("return",r.sent);case 6:throw r.prev=6,r.t0=r.catch(0),r.t0;case 9:case"end":return r.stop()}},a,this,[[0,6]])}))}},{key:"cancel",value:function(){return s(this,void 0,void 0,r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.client.api(this.uploadSession.url).delete();case 3:return e.abrupt("return",e.sent);case 6:throw e.prev=6,e.t0=e.catch(0),e.t0;case 9:case"end":return e.stop()}},e,this,[[0,6]])}))}},{key:"getStatus",value:function(){return s(this,void 0,void 0,r.mark(function e(){var t;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.client.api(this.uploadSession.url).get();case 3:return t=e.sent,this.updateTaskStatus(t),e.abrupt("return",t);case 8:throw e.prev=8,e.t0=e.catch(0),e.t0;case 11:case"end":return e.stop()}},e,this,[[0,8]])}))}},{key:"resume",value:function(){return s(this,void 0,void 0,r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getStatus();case 3:return e.next=5,this.upload();case 5:return e.abrupt("return",e.sent);case 8:throw e.prev=8,e.t0=e.catch(0),e.t0;case 11:case"end":return e.stop()}},e,this,[[0,8]])}))}}],[{key:"createUploadSession",value:function(e,t,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return s(this,void 0,void 0,r.mark(function i(){var o,s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,e.api(t).headers(a).post(n);case 3:return o=r.sent,s={url:o.uploadUrl,expiry:new Date(o.expirationDateTime)},r.abrupt("return",s);case 8:throw r.prev=8,r.t0=r.catch(0),r.t0;case 11:case"end":return r.stop()}},i,null,[[0,8]])}))}}]),e}(),O=t(function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(n){return"function"==typeof Symbol&&"symbol"===t(Symbol.iterator)?e.exports=r=function(e){return t(e)}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":t(e)},r(n)}e.exports=r});var D=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e};var _=function(e,t){return!t||"object"!==O(t)&&"function"!=typeof t?D(e):t},L=t(function(e){function t(r){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},t(r)}e.exports=t});var P=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=L(e)););return e},S=t(function(e){function t(r,n,a){return"undefined"!=typeof Reflect&&Reflect.get?e.exports=t=Reflect.get:e.exports=t=function(e,t,r){var n=P(e,t);if(n){var a=Object.getOwnPropertyDescriptor(n,t);return a.get?a.get.call(r):a.value}},t(r,n,a||r)}e.exports=t}),U=t(function(e){function t(r,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(r,n)}e.exports=t});var C=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&U(e,t)},M=function(e){return e>327680&&(e=320*Math.floor(e/327680)*1024),e},N=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5242880,t=62914560;return e>t&&(e=t),M(e)},I=function(e){function t(e,r,a,i){return n(this,t),_(this,L(t).call(this,e,r,a,i))}return C(t,A),o(t,[{key:"commit",value:function(e){return s(this,void 0,void 0,r.mark(function t(){var n;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,n={name:this.file.name,"@microsoft.graph.conflictBehavior":"rename","@microsoft.graph.sourceUrl":this.uploadSession.url},t.next=4,this.client.api(e).put(n);case 4:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(0),t.t0;case 10:case"end":return t.stop()}},t,this,[[0,7]])}))}}],[{key:"constructCreateSessionUrl",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.DEFAULT_UPLOAD_PATH;return e=e.trim(),""===(r=r.trim())&&(r="/"),"/"!==r[0]&&(r="/".concat(r)),"/"!==r[r.length-1]&&(r="".concat(r,"/")),encodeURI("/me/drive/root:".concat(r).concat(e,":/createUploadSession"))}},{key:"create",value:function(e,n,a){return s(this,void 0,void 0,r.mark(function i(){var o,s,u,c,h,d,l,p;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return o=a.fileName,"undefined"!=typeof Blob&&n instanceof Blob?(s=new File([n],o),u=s.size):"undefined"!=typeof File&&n instanceof File?u=(s=n).size:"undefined"!=typeof Buffer&&n instanceof Buffer&&(u=(c=n).byteLength-c.byteOffset,s=c.buffer.slice(c.byteOffset,c.byteOffset+c.byteLength)),r.prev=2,h=t.constructCreateSessionUrl(a.fileName,a.path),r.next=6,t.createUploadSession(e,h,a.fileName);case 6:return d=r.sent,l=N(a.rangeSize),p={name:o,content:s,size:u},r.abrupt("return",new t(e,p,d,{rangeSize:l}));case 12:throw r.prev=12,r.t0=r.catch(2),r.t0;case 15:case"end":return r.stop()}},i,null,[[2,12]])}))}},{key:"createUploadSession",value:function(e,n,a){var i=this,o=Object.create(null,{createUploadSession:{get:function(){return S(L(t),"createUploadSession",i)}}});return s(this,void 0,void 0,r.mark(function t(){var i;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return i={item:{"@microsoft.graph.conflictBehavior":"rename",name:a}},t.prev=1,t.abrupt("return",o.createUploadSession.call(this,e,n,i));case 5:throw t.prev=5,t.t0=t.catch(1),t.t0;case 8:case"end":return t.stop()}},t,this,[[1,5]])}))}}]),t}();I.DEFAULT_UPLOAD_PATH="/";var q,F,H,j,X=function(){function e(t,r,a){n(this,e),this.client=t,this.collection=r.value,this.nextLink=r["@odata.nextLink"],this.deltaLink=r["@odata.deltaLink"],this.callback=a,this.complete=!1}return o(e,[{key:"iterationHelper",value:function(){if(void 0===this.collection)return!1;for(var e=!0;e&&0!==this.collection.length;){var t=this.collection.shift();e=this.callback(t)}return e}},{key:"fetchAndUpdateNextPageData",value:function(){return s(this,void 0,void 0,r.mark(function e(){var t;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.client.api(this.nextLink).get();case 3:t=e.sent,this.collection=t.value,this.nextLink=t["@odata.nextLink"],this.deltaLink=t["@odata.deltaLink"],e.next=12;break;case 9:throw e.prev=9,e.t0=e.catch(0),e.t0;case 12:case"end":return e.stop()}},e,this,[[0,9]])}))}},{key:"getDeltaLink",value:function(){return this.deltaLink}},{key:"iterate",value:function(){return s(this,void 0,void 0,r.mark(function e(){var t;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,t=this.iterationHelper();case 2:if(!t){e.next=12;break}if(void 0===this.nextLink){e.next=9;break}return e.next=6,this.fetchAndUpdateNextPageData();case 6:t=this.iterationHelper(),e.next=10;break;case 9:t=!1;case 10:e.next=2;break;case 12:void 0===this.nextLink&&0===this.collection.length&&(this.complete=!0),e.next=18;break;case 15:throw e.prev=15,e.t0=e.catch(0),e.t0;case 18:case"end":return e.stop()}},e,this,[[0,15]])}))}},{key:"resume",value:function(){return s(this,void 0,void 0,r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.abrupt("return",this.iterate());case 4:throw e.prev=4,e.t0=e.catch(0),e.t0;case 7:case"end":return e.stop()}},e,this,[[0,4]])}))}},{key:"isComplete",value:function(){return this.complete}}]),e}(),B="v1.0",Q="https://graph.microsoft.com/",Y=function(){function e(t){n(this,e),this.provider=t}return o(e,[{key:"getAccessToken",value:function(){return s(this,void 0,void 0,r.mark(function e(){var t=this;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,r){t.provider(function(t,n){n?e(n):r(t)})}));case 1:case"end":return e.stop()}},e)}))}}]),e}(),G=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;n(this,e),this.statusCode=t,this.code=null,this.message=null,this.requestId=null,this.date=new Date,this.body=null},z=function(){function e(){n(this,e)}return o(e,null,[{key:"constructError",value:function(e,t){var r=new G(t);return void 0!==e.name&&(r.code=e.name),r.body=e.toString(),r.message=e.message,r.date=new Date,r}},{key:"constructErrorFromResponse",value:function(e,t){e=e.error;var r=new G(t);r.code=e.code,r.message=e.message,void 0!==e.innerError&&(r.requestId=e.innerError["request-id"],r.date=new Date(e.innerError.date));try{r.body=JSON.stringify(e)}catch(e){}return r}},{key:"getError",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,a=arguments.length>2?arguments[2]:void 0;return s(this,void 0,void 0,r.mark(function i(){var o;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(o=t&&t.error?e.constructErrorFromResponse(t,n):"undefined"!=typeof Error&&t instanceof Error?e.constructError(t,n):new G(n),"function"!=typeof a){r.next=5;break}a(o,null),r.next=6;break;case 5:return r.abrupt("return",o);case 6:case"end":return r.stop()}},i)}))}}]),e}(),$=["$select","$expand","$orderby","$filter","$top","$skip","$skipToken","$count"],V=function(e){var t=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};(q=e.ResponseType||(e.ResponseType={})).ARRAYBUFFER="arraybuffer",q.BLOB="blob",q.DOCUMENT="document",q.JSON="json",q.RAW="raw",q.STREAM="stream",q.TEXT="text",function(e){e.TEXT_HTML="text/html",e.TEXT_XML="text/xml",e.APPLICATION_XML="application/xml",e.APPLICATION_XHTML="application/xhtml+xml"}(F||(F={})),function(e){e.TEXT_PLAIN="text/plain",e.APPLICATION_JSON="application/json"}(H||(H={})),function(e){e.DOCUMENT="^(text\\/(html|xml))|(application\\/(xml|xhtml\\+xml))$",e.IMAGE="^image\\/.+"}(j||(j={}));var W=function(){function t(){n(this,t)}return o(t,null,[{key:"parseDocumentResponse",value:function(e,t){try{return"undefined"!=typeof DOMParser?new Promise(function(r,n){e.text().then(function(e){try{var a=(new DOMParser).parseFromString(e,t);r(a)}catch(e){n(e)}})}):Promise.resolve(e.body)}catch(e){throw e}}},{key:"convertResponse",value:function(n,a){return s(this,void 0,void 0,r.mark(function i(){var o,s,u;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(204!==n.status){r.next=2;break}return r.abrupt("return",Promise.resolve());case 2:r.prev=2,r.t0=a,r.next=r.t0===e.ResponseType.ARRAYBUFFER?6:r.t0===e.ResponseType.BLOB?10:r.t0===e.ResponseType.DOCUMENT?14:r.t0===e.ResponseType.JSON?18:r.t0===e.ResponseType.STREAM?22:r.t0===e.ResponseType.TEXT?26:30;break;case 6:return r.next=8,n.arrayBuffer();case 8:return o=r.sent,r.abrupt("break",60);case 10:return r.next=12,n.blob();case 12:return o=r.sent,r.abrupt("break",60);case 14:return r.next=16,t.parseDocumentResponse(n,F.TEXT_XML);case 16:return o=r.sent,r.abrupt("break",60);case 18:return r.next=20,n.json();case 20:return o=r.sent,r.abrupt("break",60);case 22:return r.next=24,Promise.resolve(n.body);case 24:return o=r.sent,r.abrupt("break",60);case 26:return r.next=28,n.text();case 28:return o=r.sent,r.abrupt("break",60);case 30:if(null===(s=n.headers.get("Content-type"))){r.next=58;break}if(u=s.split(";")[0],!new RegExp(j.DOCUMENT).test(u)){r.next=39;break}return r.next=36,t.parseDocumentResponse(n,u);case 36:o=r.sent,r.next=56;break;case 39:if(!new RegExp(j.IMAGE).test(u)){r.next=43;break}o=n.blob(),r.next=56;break;case 43:if(u!==H.TEXT_PLAIN){r.next=49;break}return r.next=46,n.text();case 46:o=r.sent,r.next=56;break;case 49:if(u!==H.APPLICATION_JSON){r.next=55;break}return r.next=52,n.json();case 52:o=r.sent,r.next=56;break;case 55:o=Promise.resolve(n.body);case 56:r.next=59;break;case 58:o=Promise.resolve(n.body);case 59:return r.abrupt("break",60);case 60:r.next=65;break;case 62:throw r.prev=62,r.t1=r.catch(2),r.t1;case 65:return r.abrupt("return",o);case 66:case"end":return r.stop()}},i,null,[[2,62]])}))}},{key:"getResponse",value:function(n,a,i){return s(this,void 0,void 0,r.mark(function o(){var s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,a!==e.ResponseType.RAW){r.next=5;break}return r.abrupt("return",Promise.resolve(n));case 5:return r.next=7,t.convertResponse(n,a);case 7:if(s=r.sent,!n.ok){r.next=16;break}if("function"!=typeof i){r.next=13;break}i(null,s),r.next=14;break;case 13:return r.abrupt("return",s);case 14:r.next=17;break;case 16:throw s;case 17:r.next=22;break;case 19:throw r.prev=19,r.t0=r.catch(0),r.t0;case 22:case"end":return r.stop()}},o,null,[[0,19]])}))}}]),t}(),Z=function(){function t(e,r,a){var i=this;n(this,t),this.parsePath=function(e){if(-1!==e.indexOf("https://")){var t=(e=e.replace("https://","")).indexOf("/");-1!==t&&(i.urlComponents.host="https://"+e.substring(0,t),e=e.substring(t+1,e.length));var r=e.indexOf("/");-1!==r&&(i.urlComponents.version=e.substring(0,r),e=e.substring(r+1,e.length))}"/"===e.charAt(0)&&(e=e.substr(1));var n=e.indexOf("?");if(-1===n)i.urlComponents.path=e;else{i.urlComponents.path=e.substr(0,n);var a=e.substring(n+1,e.length).split("&"),o=!0,s=!1,u=void 0;try{for(var c,h=a[Symbol.iterator]();!(o=(c=h.next()).done);o=!0){var d=c.value.split("="),l=d[0],p=d[1];-1!==$.indexOf(l)?i.urlComponents.oDataQueryParams[l]=p:i.urlComponents.otherURLQueryParams[l]=p}}catch(e){s=!0,u=e}finally{try{o||null==h.return||h.return()}finally{if(s)throw u}}}},this.httpClient=e,this.config=r,this.urlComponents={host:this.config.baseUrl,version:this.config.defaultVersion,oDataQueryParams:{},otherURLQueryParams:{}},this._headers={},this._options={},this._middlewareOptions=[],this.parsePath(a)}return o(t,[{key:"addCsvQueryParameter",value:function(e,t,r){this.urlComponents.oDataQueryParams[e]=this.urlComponents.oDataQueryParams[e]?this.urlComponents.oDataQueryParams[e]+",":"";var n=[];r.length>1&&"string"==typeof t?n=Array.prototype.slice.call(r):"string"==typeof t?n.push(t):n=n.concat(t),this.urlComponents.oDataQueryParams[e]+=n.join(",")}},{key:"buildFullUrl",value:function(){var e,t,r=(e=[this.urlComponents.host,this.urlComponents.version,this.urlComponents.path],t=function(e){return e.replace(/^\/+/,"")},Array.prototype.slice.call(e).reduce(function(e,r){return[(n=e,n.replace(/\/+$/,"")),t(r)].join("/");var n})+this.createQueryString());return this.config.debugLogging&&console.log(r),r}},{key:"createQueryString",value:function(){var e=this.urlComponents,t=[];if(0!==Object.keys(e.oDataQueryParams).length)for(var r in e.oDataQueryParams)e.oDataQueryParams.hasOwnProperty(r)&&t.push(r+"="+e.oDataQueryParams[r]);if(0!==Object.keys(e.otherURLQueryParams).length)for(var n in e.otherURLQueryParams)e.otherURLQueryParams.hasOwnProperty(n)&&t.push(n+"="+e.otherURLQueryParams[n]);return t.length>0?"?"+t.join("&"):""}},{key:"updateRequestOptions",value:function(e){var t=Object.assign({},e.headers);if(void 0!==this.config.fetchOptions){var r=Object.assign({},this.config.fetchOptions);Object.assign(e,r),void 0!==O(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}},{key:"send",value:function(e,t,n){return s(this,void 0,void 0,r.mark(function a(){var i,o,s,u,c;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return o=new h(this._middlewareOptions),this.updateRequestOptions(t),r.prev=2,r.next=5,this.httpClient.sendRequest({request:e,options:t,middlewareControl:o});case 5:return s=r.sent,i=s.response,r.next=9,W.getResponse(i,this._responseType,n);case 9:return u=r.sent,r.abrupt("return",u);case 13:return r.prev=13,r.t0=r.catch(2),void 0!==i&&(c=i.status),r.next=18,z.getError(r.t0,c,n);case 18:throw r.sent;case 20:case"end":return r.stop()}},a,this,[[2,13]])}))}},{key:"header",value:function(e,t){return this._headers[e]=t,this}},{key:"headers",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(this._headers[t]=e[t]);return this}},{key:"option",value:function(e,t){return this._options[e]=t,this}},{key:"options",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(this._options[t]=e[t]);return this}},{key:"middlewareOptions",value:function(e){return this._middlewareOptions=e,this}},{key:"version",value:function(e){return this.urlComponents.version=e,this}},{key:"responseType",value:function(e){return this._responseType=e,this}},{key:"select",value:function(e){return this.addCsvQueryParameter("$select",e,arguments),this}},{key:"expand",value:function(e){return this.addCsvQueryParameter("$expand",e,arguments),this}},{key:"orderby",value:function(e){return this.addCsvQueryParameter("$orderby",e,arguments),this}},{key:"filter",value:function(e){return this.urlComponents.oDataQueryParams.$filter=e,this}},{key:"search",value:function(e){return this.urlComponents.oDataQueryParams.$search=e,this}},{key:"top",value:function(e){return this.urlComponents.oDataQueryParams.$top=e,this}},{key:"skip",value:function(e){return this.urlComponents.oDataQueryParams.$skip=e,this}},{key:"skipToken",value:function(e){return this.urlComponents.oDataQueryParams.$skipToken=e,this}},{key:"count",value:function(e){return this.urlComponents.oDataQueryParams.$count=e.toString(),this}},{key:"query",value:function(e){var t=this.urlComponents.otherURLQueryParams;if("string"==typeof e){var r=e.split("="),n=r[0],a=r[1];t[n]=a}else for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return this}},{key:"get",value:function(e){return s(this,void 0,void 0,r.mark(function t(){var n,a,o;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.buildFullUrl(),a={method:i.GET},t.prev=2,t.next=5,this.send(n,a,e);case 5:return o=t.sent,t.abrupt("return",o);case 9:throw t.prev=9,t.t0=t.catch(2),t.t0;case 12:case"end":return t.stop()}},t,this,[[2,9]])}))}},{key:"post",value:function(e,t){return s(this,void 0,void 0,r.mark(function n(){var a,o,s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return a=this.buildFullUrl(),o={method:i.POST,body:V(e),headers:"undefined"!=typeof FormData&&e instanceof FormData?{}:{"Content-Type":"application/json"}},r.prev=2,r.next=5,this.send(a,o,t);case 5:return s=r.sent,r.abrupt("return",s);case 9:throw r.prev=9,r.t0=r.catch(2),r.t0;case 12:case"end":return r.stop()}},n,this,[[2,9]])}))}},{key:"create",value:function(e,t){return s(this,void 0,void 0,r.mark(function n(){return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,this.post(e,t);case 3:return r.abrupt("return",r.sent);case 6:throw r.prev=6,r.t0=r.catch(0),r.t0;case 9:case"end":return r.stop()}},n,this,[[0,6]])}))}},{key:"put",value:function(e,t){return s(this,void 0,void 0,r.mark(function n(){var a,o,s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return a=this.buildFullUrl(),o={method:i.PUT,body:V(e),headers:{"Content-Type":"application/json"}},r.prev=2,r.next=5,this.send(a,o,t);case 5:return s=r.sent,r.abrupt("return",s);case 9:throw r.prev=9,r.t0=r.catch(2),r.t0;case 12:case"end":return r.stop()}},n,this,[[2,9]])}))}},{key:"patch",value:function(e,t){return s(this,void 0,void 0,r.mark(function n(){var a,o,s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return a=this.buildFullUrl(),o={method:i.PATCH,body:V(e),headers:{"Content-Type":"application/json"}},r.prev=2,r.next=5,this.send(a,o,t);case 5:return s=r.sent,r.abrupt("return",s);case 9:throw r.prev=9,r.t0=r.catch(2),r.t0;case 12:case"end":return r.stop()}},n,this,[[2,9]])}))}},{key:"update",value:function(e,t){return s(this,void 0,void 0,r.mark(function n(){return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,this.patch(e,t);case 3:return r.abrupt("return",r.sent);case 6:throw r.prev=6,r.t0=r.catch(0),r.t0;case 9:case"end":return r.stop()}},n,this,[[0,6]])}))}},{key:"delete",value:function(e){return s(this,void 0,void 0,r.mark(function t(){var n,a,o;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.buildFullUrl(),a={method:i.DELETE},t.prev=2,t.next=5,this.send(n,a,e);case 5:return o=t.sent,t.abrupt("return",o);case 9:throw t.prev=9,t.t0=t.catch(2),t.t0;case 12:case"end":return t.stop()}},t,this,[[2,9]])}))}},{key:"del",value:function(e){return s(this,void 0,void 0,r.mark(function t(){return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.delete(e);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),t.t0;case 9:case"end":return t.stop()}},t,this,[[0,6]])}))}},{key:"getStream",value:function(t){return s(this,void 0,void 0,r.mark(function n(){var a,o,s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return a=this.buildFullUrl(),o={method:i.GET},this.responseType(e.ResponseType.STREAM),r.prev=3,r.next=6,this.send(a,o,t);case 6:return s=r.sent,r.abrupt("return",s);case 10:throw r.prev=10,r.t0=r.catch(3),r.t0;case 13:case"end":return r.stop()}},n,this,[[3,10]])}))}},{key:"putStream",value:function(e,t){return s(this,void 0,void 0,r.mark(function n(){var a,o,s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return a=this.buildFullUrl(),o={method:i.PUT,headers:{"Content-Type":"application/octet-stream"},body:e},r.prev=2,r.next=5,this.send(a,o,t);case 5:return s=r.sent,r.abrupt("return",s);case 9:throw r.prev=9,r.t0=r.catch(2),r.t0;case 12:case"end":return r.stop()}},n,this,[[2,9]])}))}}]),t}(),J=function(){function e(t){n(this,e),this.middleware=t}return o(e,[{key:"sendRequest",value:function(e){return s(this,void 0,void 0,r.mark(function t(){var n;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,"string"!=typeof e.request||void 0!==e.options){t.next=6;break}throw(n=new Error).name="InvalidRequestOptions",n.message="Unable to execute the middleware, Please provide valid options for a request",n;case 6:return t.next=8,this.middleware.execute(e);case 8:return t.abrupt("return",e);case 11:throw t.prev=11,t.t0=t.catch(0),t.t0;case 14:case"end":return t.stop()}},t,this,[[0,11]])}))}}]),e}(),K=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.DEFAULT_MAX_REDIRECTS,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.DEFAULT_SHOULD_RETRY;if(n(this,e),t>e.MAX_MAX_REDIRECTS){var a=new Error("MaxRedirects should not be more than ".concat(e.MAX_MAX_REDIRECTS));throw a.name="MaxLimitExceeded",a}if(t<0){var i=new Error("MaxRedirects should not be negative");throw i.name="MinExpectationNotMet",i}this.maxRedirects=t,this.shouldRedirect=r};K.DEFAULT_MAX_REDIRECTS=5,K.MAX_MAX_REDIRECTS=20,K.DEFAULT_SHOULD_RETRY=function(){return!0};var ee=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new K;n(this,t),this.options=e}return o(t,[{key:"isRedirect",value:function(e){return-1!==t.REDIRECT_STATUS_CODES.indexOf(e.status)}},{key:"hasLocationHeader",value:function(e){return e.headers.has(t.LOCATION_HEADER)}},{key:"getLocationHeader",value:function(e){return e.headers.get(t.LOCATION_HEADER)}},{key:"isRelativeURL",value:function(e){return-1===e.indexOf("://")}},{key:"shouldDropAuthorizationHeader",value:function(e,t){var r,n,a=/^[A-Za-z].+?:\/\/.+?(?=\/|$)/,i=a.exec(e);null!==i&&(r=i[0]);var o=a.exec(t);return null!==o&&(n=o[0]),void 0!==r&&void 0!==n&&r!==n}},{key:"updateRequestUrl",value:function(e,t){return s(this,void 0,void 0,r.mark(function n(){return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if("string"!=typeof t.request){r.next=4;break}r.t0=e,r.next=7;break;case 4:return r.next=6,m(e,t.request);case 6:r.t0=r.sent;case 7:t.request=r.t0;case 8:case"end":return r.stop()}},n)}))}},{key:"getOptions",value:function(e){var t;return e.middlewareControl instanceof h&&(t=e.middlewareControl.getMiddlewareOptions(K)),void 0===t&&(t=Object.assign(new K,this.options)),t}},{key:"executeWithRedirect",value:function(e,n,a){return s(this,void 0,void 0,r.mark(function o(){var s,u;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,this.nextMiddleware.execute(e);case 3:if(s=e.response,!(n<a.maxRedirects&&this.isRedirect(s)&&this.hasLocationHeader(s)&&a.shouldRedirect(s))){r.next=19;break}if(++n,s.status!==t.STATUS_CODE_SEE_OTHER){r.next=11;break}e.options.method=i.GET,delete e.options.body,r.next=15;break;case 11:return u=this.getLocationHeader(s),!this.isRelativeURL(u)&&this.shouldDropAuthorizationHeader(s.url,u)&&v(e.request,e.options,t.AUTHORIZATION_HEADER,void 0),r.next=15,this.updateRequestUrl(u,e);case 15:return r.next=17,this.executeWithRedirect(e,n,a);case 17:r.next=20;break;case 19:return r.abrupt("return");case 20:r.next=25;break;case 22:throw r.prev=22,r.t0=r.catch(0),r.t0;case 25:case"end":return r.stop()}},o,this,[[0,22]])}))}},{key:"execute",value:function(n){return s(this,void 0,void 0,r.mark(function a(){var i;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,0,i=this.getOptions(n),n.options.redirect=t.MANUAL_REDIRECT,x.updateFeatureUsageFlag(n,e.FeatureUsageFlag.REDIRECT_HANDLER_ENABLED),r.next=7,this.executeWithRedirect(n,0,i);case 7:return r.abrupt("return",r.sent);case 10:throw r.prev=10,r.t0=r.catch(0),r.t0;case 13:case"end":return r.stop()}},a,this,[[0,10]])}))}},{key:"setNext",value:function(e){this.nextMiddleware=e}}]),t}();ee.REDIRECT_STATUS_CODES=[301,302,303,307,308],ee.STATUS_CODE_SEE_OTHER=303,ee.LOCATION_HEADER="Location",ee.AUTHORIZATION_HEADER="Authorization",ee.MANUAL_REDIRECT="manual";var te=function(){function e(){n(this,e)}return o(e,null,[{key:"createWithAuthenticationProvider",value:function(t){var r=new g(t),n=new k(new b),a=new R,i=new E;if(r.setNext(n),new Function("try {return this === global;}catch(e){return false;}")()){var o=new ee(new K);n.setNext(o),o.setNext(a)}else n.setNext(a);return a.setNext(i),e.createWithMiddleware(r)}},{key:"createWithMiddleware",value:function(e){return new J(e)}}]),e}(),re=function(){if("undefined"==typeof Promise&&"undefined"==typeof fetch){var 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){var t=new Error("Library cannot function without Promise. So, please provide polyfill for it.");throw t.name="PolyFillNotAvailable",t}if("undefined"==typeof fetch){var r=new Error("Library cannot function without fetch. So, please provide polyfill for it.");throw r.name="PolyFillNotAvailable",r}return!0},ne=function(){function e(t){n(this,e),this.config={baseUrl:Q,debugLogging:!1,defaultVersion:B};try{re()}catch(i){throw i}for(var r in t)t.hasOwnProperty(r)&&(this.config[r]=t[r]);var a;if(void 0!==t.authProvider&&void 0!==t.middleware){var i=new Error;throw i.name="AmbiguityInInitialization",i.message="Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain not both",i}if(void 0!==t.authProvider)a=te.createWithAuthenticationProvider(t.authProvider);else{if(void 0===t.middleware){var o=new Error;throw o.name="InvalidMiddlewareChain",o.message="Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain",o}a=new J(t.middleware)}this.httpClient=a}return o(e,[{key:"api",value:function(e){return new Z(this.httpClient,this.config,e)}}],[{key:"init",value:function(t){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]="authProvider"===n?new Y(t[n]):t[n]);return e.initWithMiddleware(r)}},{key:"initWithMiddleware",value:function(t){try{return new e(t)}catch(e){throw e}}}]),e}(),ae=function(){function e(t,r){n(this,e),this.options=r,this.msalApplication=t}return o(e,[{key:"getAccessToken",value:function(e){return s(this,void 0,void 0,r.mark(function t(){var n,a,i,o,s,u,c,h;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==(n=e)&&(a=n.scopes),void 0!==a&&0!==a.length||(a=this.options.scopes),0!==a.length){t.next=8;break}throw(i=new Error).name="EmptyScopes",i.message="Scopes cannot be empty, Please provide a scopes",i;case 8:if(!this.msalApplication.getAccount()){t.next=32;break}return o={scopes:a},t.prev=10,t.next=13,this.msalApplication.acquireTokenSilent(o);case 13:return s=t.sent,t.abrupt("return",s.accessToken);case 17:if(t.prev=17,t.t0=t.catch(10),"InteractionRequiredAuthError"!==t.t0.name){t.next=30;break}return t.prev=20,t.next=23,this.msalApplication.acquireTokenPopup(o);case 23:return u=t.sent,t.abrupt("return",u.accessToken);case 27:throw t.prev=27,t.t1=t.catch(20),t.t1;case 30:t.next=45;break;case 32:return t.prev=32,c={scopes:a},t.next=36,this.msalApplication.loginPopup(c);case 36:return t.next=38,this.msalApplication.acquireTokenSilent(c);case 38:return h=t.sent,t.abrupt("return",h.accessToken);case 42:throw t.prev=42,t.t2=t.catch(32),t.t2;case 45:case"end":return t.stop()}},t,this,[[10,17],[20,27],[32,42]])}))}}]),e}();return e.AuthenticationHandler=g,e.AuthenticationHandlerOptions=w,e.BatchRequestContent=u,e.BatchResponseContent=c,e.Client=ne,e.GraphError=G,e.GraphRequest=Z,e.HTTPMessageHandler=E,e.ImplicitMSALAuthenticationProvider=ae,e.LargeFileUploadTask=A,e.MSALAuthenticationProviderOptions=function e(t){n(this,e),this.scopes=t},e.OneDriveLargeFileUploadTask=I,e.PageIterator=X,e.RetryHandler=k,e.RetryHandlerOptions=b,e.TelemetryHandler=R,e.TelemetryHandlerOptions=x,e}({});
var MicrosoftGraph=function(e){"use strict";function t(e,t){return e(t={exports:{}},t.exports),t.exports}var r=t(function(e){var t=function(e){var t,r=Object.prototype,n=r.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},i=a.iterator||"@@iterator",o=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function u(e,t,r,n){var a=t&&t.prototype instanceof v?t:v,i=Object.create(a.prototype),o=new O(n||[]);return i._invoke=function(e,t,r){var n=h;return function(a,i){if(n===l)throw new Error("Generator is already running");if(n===p){if("throw"===a)throw i;return _()}for(r.method=a,r.arg=i;;){var o=r.delegate;if(o){var s=R(o,r);if(s){if(s===f)continue;return s}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(n===h)throw n=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n=l;var u=c(e,t,r);if("normal"===u.type){if(n=r.done?p:d,u.arg===f)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n=p,r.method="throw",r.arg=u.arg)}}}(e,r,o),i}function c(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=u;var h="suspendedStart",d="suspendedYield",l="executing",p="completed",f={};function v(){}function y(){}function m(){}var w={};w[i]=function(){return this};var x=Object.getPrototypeOf,g=x&&x(x(D([])));g&&g!==r&&n.call(g,i)&&(w=g);var E=m.prototype=v.prototype=Object.create(w);function b(e){["next","throw","return"].forEach(function(t){e[t]=function(e){return this._invoke(t,e)}})}function k(e){var t;this._invoke=function(r,a){function i(){return new Promise(function(t,i){!function t(r,a,i,o){var s=c(e[r],e,a);if("throw"!==s.type){var u=s.arg,h=u.value;return h&&"object"==typeof h&&n.call(h,"__await")?Promise.resolve(h.__await).then(function(e){t("next",e,i,o)},function(e){t("throw",e,i,o)}):Promise.resolve(h).then(function(e){u.value=e,i(u)},function(e){return t("throw",e,i,o)})}o(s.arg)}(r,a,t,i)})}return t=t?t.then(i,i):i()}}function R(e,r){var n=e.iterator[r.method];if(n===t){if(r.delegate=null,"throw"===r.method){if(e.iterator.return&&(r.method="return",r.arg=t,R(e,r),"throw"===r.method))return f;r.method="throw",r.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var a=c(n,e.iterator,r.arg);if("throw"===a.type)return r.method="throw",r.arg=a.arg,r.delegate=null,f;var i=a.arg;return i?i.done?(r[e.resultName]=i.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,f):i:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,f)}function T(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function O(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(T,this),this.reset(!0)}function D(e){if(e){var r=e[i];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var a=-1,o=function r(){for(;++a<e.length;)if(n.call(e,a))return r.value=e[a],r.done=!1,r;return r.value=t,r.done=!0,r};return o.next=o}}return{next:_}}function _(){return{value:t,done:!0}}return y.prototype=E.constructor=m,m.constructor=y,m[s]=y.displayName="GeneratorFunction",e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,s in e||(e[s]="GeneratorFunction")),e.prototype=Object.create(E),e},e.awrap=function(e){return{__await:e}},b(k.prototype),k.prototype[o]=function(){return this},e.AsyncIterator=k,e.async=function(t,r,n,a){var i=new k(u(t,r,n,a));return e.isGeneratorFunction(r)?i:i.next().then(function(e){return e.done?e.value:i.next()})},b(E),E[s]="Generator",E[i]=function(){return this},E.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=D,O.prototype={constructor:O,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(A),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function a(n,a){return s.type="throw",s.arg=e,r.next=n,a&&(r.method="next",r.arg=t),!!a}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return a("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),c=n.call(o,"finallyLoc");if(u&&c){if(this.prev<o.catchLoc)return a(o.catchLoc,!0);if(this.prev<o.finallyLoc)return a(o.finallyLoc)}else if(u){if(this.prev<o.catchLoc)return a(o.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return a(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var i=a;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=e,o.arg=t,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(o)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),A(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var a=n.arg;A(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:D(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),f}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}});var n=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};function a(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}var i,o=function(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),e};function s(e,t,r,n){return new(r||(r=Promise))(function(a,i){function o(e){try{u(n.next(e))}catch(e){i(e)}}function s(e){try{u(n.throw(e))}catch(e){i(e)}}function u(e){e.done?a(e.value):new r(function(t){t(e.value)}).then(o,s)}u((n=n.apply(e,t||[])).next())})}!function(e){e.GET="GET",e.PATCH="PATCH",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE"}(i||(i={}));var u=function(){function e(t){if(n(this,e),this.requests=new Map,void 0!==t){var r=e.requestLimit;if(t.length>r){var a=new Error("Maximum requests limit exceeded, Max allowed number of requests are ".concat(r));throw a.name="Limit Exceeded Error",a}var i=!0,o=!1,s=void 0;try{for(var u,c=t[Symbol.iterator]();!(i=(u=c.next()).done);i=!0){var h=u.value;this.addRequest(h)}}catch(e){o=!0,s=e}finally{try{i||null==c.return||c.return()}finally{if(o)throw s}}}}return o(e,[{key:"addRequest",value:function(t){var r=e.requestLimit;if(""===t.id){var n=new Error("Id for a request is empty, Please provide an unique id");throw n.name="Empty Id For Request",n}if(this.requests.size===r){var a=new Error("Maximum requests limit exceeded, Max allowed number of requests are ".concat(r));throw a.name="Limit Exceeded Error",a}if(this.requests.has(t.id)){var i=new Error("Adding request with duplicate id ".concat(t.id,", Make the id of the requests unique"));throw i.name="Duplicate RequestId Error",i}return this.requests.set(t.id,t),t.id}},{key:"removeRequest",value:function(e){for(var t=this.requests.delete(e),r=this.requests.entries(),n=r.next();!n.done;){var a=n.value[1].dependsOn;if(void 0!==a){var i=a.indexOf(e);-1!==i&&a.splice(i,1),0===a.length&&delete n.value[1].dependsOn}n=r.next()}return t}},{key:"getContent",value:function(){return s(this,void 0,void 0,r.mark(function t(){var n,a,i,o,s,u,c,h,d;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(a={requests:n=[]},i=this.requests.entries(),!(o=i.next()).done){t.next=8;break}throw(s=new Error("No requests added yet, Please add at least one request.")).name="Empty Payload",s;case 8:if(e.validateDependencies(this.requests)){t.next=12;break}throw(u=new Error("Invalid dependency found, Dependency should be:\n1. Parallel - no individual request states a dependency in the dependsOn property.\n2. Serial - all individual requests depend on the previous individual request.\n3. Same - all individual requests that state a dependency in the dependsOn property, state the same dependency.")).name="Invalid Dependency",u;case 12:if(o.done){t.next=27;break}return c=o.value[1],t.next=16,e.getRequestData(c.request);case 16:if(void 0===(h=t.sent).body||void 0!==h.headers&&void 0!==h.headers["content-type"]){t.next=21;break}throw(d=new Error("Content-type header is not mentioned for request #".concat(c.id,", For request having body, Content-type header should be mentioned"))).name="Invalid Content-type header",d;case 21:h.id=c.id,void 0!==c.dependsOn&&c.dependsOn.length>0&&(h.dependsOn=c.dependsOn),n.push(h),o=i.next(),t.next=12;break;case 27:return a.requests=n,t.abrupt("return",a);case 29:case"end":return t.stop()}},t,this)}))}},{key:"addDependency",value:function(e,t){if(!this.requests.has(e)){var r=new Error("Dependent ".concat(e," does not exists, Please check the id"));throw r.name="Invalid Dependent",r}if(void 0!==t&&!this.requests.has(t)){var n=new Error("Dependency ".concat(t," does not exists, Please check the id"));throw n.name="Invalid Dependency",n}if(void 0!==t){var a=this.requests.get(e);if(void 0===a.dependsOn&&(a.dependsOn=[]),-1!==a.dependsOn.indexOf(t)){var i=new Error("Dependency ".concat(t," is already added for the request ").concat(e));throw i.name="Duplicate Dependency",i}a.dependsOn.push(t)}else{for(var o,s=this.requests.entries(),u=s.next();!u.done&&u.value[1].id!==e;)o=u,u=s.next();if(void 0===o){var c=new Error("Can't add dependency ".concat(t,", There is only a dependent request in the batch"));throw c.name="Invalid Dependency Addition",c}var h=o.value[0];if(void 0===u.value[1].dependsOn&&(u.value[1].dependsOn=[]),-1!==u.value[1].dependsOn.indexOf(h)){var d=new Error("Dependency ".concat(h," is already added for the request ").concat(e));throw d.name="Duplicate Dependency",d}u.value[1].dependsOn.push(h)}}},{key:"removeDependency",value:function(e,t){var r=this.requests.get(e);if(void 0===r||void 0===r.dependsOn||0===r.dependsOn.length)return!1;if(void 0!==t){var n=r.dependsOn.indexOf(t);return-1!==n&&(r.dependsOn.splice(n,1),!0)}return delete r.dependsOn,!0}}],[{key:"validateDependencies",value:function(e){if(0===e.size){var t=new Error("Empty requests map, Please provide at least one request.");throw t.name="Empty Requests Error",t}return function(e){for(var t=e.entries(),r=t.next();!r.done;){var n=r.value[1];if(void 0!==n.dependsOn&&n.dependsOn.length>0)return!1;r=t.next()}return!0}(e)||function(e){var t=e.entries(),r=t.next(),n=r.value[1];if(void 0!==n.dependsOn&&n.dependsOn.length>0)return!1;var a=r;for(r=t.next();!r.done;){var i=r.value[1];if(void 0===i.dependsOn||1!==i.dependsOn.length||i.dependsOn[0]!==a.value[1].id)return!1;a=r,r=t.next()}return!0}(e)||function(e){var t,r=e.entries(),n=r.next(),a=n.value[1];if(void 0===a.dependsOn||0===a.dependsOn.length)t=a.id;else{if(1!==a.dependsOn.length)return!1;var i=a.dependsOn[0];if(i===a.id||!e.has(i))return!1;t=i}for(n=r.next();!n.done;){var o=n.value[1];if((void 0===o.dependsOn||0===o.dependsOn.length)&&t!==o.id)return!1;if(void 0!==o.dependsOn&&0!==o.dependsOn.length){if(1===o.dependsOn.length&&(o.id===t||o.dependsOn[0]!==t))return!1;if(o.dependsOn.length>1)return!1}n=r.next()}return!0}(e)}},{key:"getRequestData",value:function(t){return s(this,void 0,void 0,r.mark(function n(){var a,o,s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(a={url:""},o=new RegExp("^https?://"),a.url=o.test(t.url)?"/"+t.url.split(/.*?\/\/.*?\//)[1]:t.url,a.method=t.method,s={},t.headers.forEach(function(e,t){s[t]=e}),Object.keys(s).length&&(a.headers=s),t.method!==i.PATCH&&t.method!==i.POST&&t.method!==i.PUT){r.next=11;break}return r.next=10,e.getRequestBody(t);case 10:a.body=r.sent;case 11:return r.abrupt("return",a);case 12:case"end":return r.stop()}},n)}))}},{key:"getRequestBody",value:function(e){return s(this,void 0,void 0,r.mark(function t(){var n,a,i,o,s,u;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=!1,t.prev=1,i=e.clone(),t.next=5,i.json();case 5:a=t.sent,n=!0,t.next=11;break;case 9:t.prev=9,t.t0=t.catch(1);case 11:if(n){t.next=33;break}if(t.prev=12,"undefined"==typeof Blob){t.next=23;break}return t.next=16,e.blob();case 16:return o=t.sent,s=new FileReader,t.next=20,new Promise(function(e){s.addEventListener("load",function(){var t=s.result,r=new RegExp("^s*data:(.+?/.+?(;.+?=.+?)*)?(;base64)?,(.*)s*$").exec(t);e(r[4])},!1),s.readAsDataURL(o)});case 20:a=t.sent,t.next=28;break;case 23:if("undefined"==typeof Buffer){t.next=28;break}return t.next=26,e.buffer();case 26:u=t.sent,a=u.toString("base64");case 28:n=!0,t.next=33;break;case 31:t.prev=31,t.t1=t.catch(12);case 33:return t.abrupt("return",a);case 34:case"end":return t.stop()}},t,null,[[1,9],[12,31]])}))}}]),e}();u.requestLimit=20;var c=function(){function e(t){n(this,e),this.responses=new Map,this.update(t)}return o(e,[{key:"createResponseObject",value:function(e){var t=e.body,r={};return r.status=e.status,void 0!==e.statusText&&(r.statusText=e.statusText),r.headers=e.headers,new Response(t,r)}},{key:"update",value:function(e){this.nextLink=e["@odata.nextLink"];for(var t=e.responses,r=0,n=t.length;r<n;r++)this.responses.set(t[r].id,this.createResponseObject(t[r]))}},{key:"getResponseById",value:function(e){return this.responses.get(e)}},{key:"getResponses",value:function(){return this.responses}},{key:"getResponsesIterator",value:r.mark(function e(){var t,n;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=this.responses.entries(),n=t.next();case 2:if(n.done){e.next=8;break}return e.next=5,n.value;case 5:n=t.next(),e.next=2;break;case 8:case"end":return e.stop()}},e,this)})}]),e}(),h=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];n(this,e),this.middlewareOptions=new Map;var r=!0,a=!1,i=void 0;try{for(var o,s=t[Symbol.iterator]();!(r=(o=s.next()).done);r=!0){var u=o.value,c=u.constructor;this.middlewareOptions.set(c,u)}}catch(e){a=!0,i=e}finally{try{r||null==s.return||s.return()}finally{if(a)throw i}}}return o(e,[{key:"getMiddlewareOptions",value:function(e){return this.middlewareOptions.get(e)}},{key:"setMiddlewareOptions",value:function(e,t){this.middlewareOptions.set(e,t)}}]),e}();var d,l=function(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e},p=function(){for(var e="",t=0;t<32;t++)8!==t&&12!==t&&16!==t&&20!==t||(e+="-"),e+=Math.floor(16*Math.random()).toString(16);return e},f=function(e,t,r){var n=null;if("undefined"!=typeof Request&&e instanceof Request)n=e.headers.get(r);else if(void 0!==t&&void 0!==t.headers)if("undefined"!=typeof Headers&&t.headers instanceof Headers)n=t.headers.get(r);else if(t.headers instanceof Array){for(var a=t.headers,i=0,o=a.length;i<o;i++)if(a[i][0]===r){n=a[i][1];break}}else void 0!==t.headers[r]&&(n=t.headers[r]);return n},v=function(e,t,r,n){if("undefined"!=typeof Request&&e instanceof Request)e.headers.set(r,n);else if(void 0!==t)if(void 0===t.headers)t.headers=new Headers(l({},r,n));else if("undefined"!=typeof Headers&&t.headers instanceof Headers)t.headers.set(r,n);else if(t.headers instanceof Array){for(var a=0,i=t.headers.length;a<i;a++){var o=t.headers[a];if(o[0]===r){o[1]=n;break}}a===i&&t.headers.push([r,n])}else Object.assign(t.headers,l({},r,n))},y=function(e,t,r,n){"undefined"!=typeof Request&&e instanceof Request?e.headers.append(r,n):void 0!==t&&(void 0===t.headers?t.headers=new Headers(l({},r,n)):"undefined"!=typeof Headers&&t.headers instanceof Headers?t.headers.append(r,n):t.headers instanceof Array?t.headers.push([r,n]):void 0===t.headers?t.headers=l({},r,n):void 0===t.headers[r]?t.headers[r]=n:t.headers[r]+=", ".concat(n))},m=function(e,t){return s(void 0,void 0,void 0,r.mark(function n(){var a,i,o,s,u,c,h,d,l,p,f,v;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!t.headers.get("Content-Type")){r.next=6;break}return r.next=3,t.blob();case 3:r.t0=r.sent,r.next=9;break;case 6:return r.next=8,Promise.resolve(void 0);case 8:r.t0=r.sent;case 9:return a=r.t0,i=t.method,o=t.headers,s=t.referrer,u=t.referrerPolicy,c=t.mode,h=t.credentials,d=t.cache,l=t.redirect,p=t.integrity,f=t.keepalive,v=t.signal,r.abrupt("return",new Request(e,{method:i,headers:o,body:a,referrer:s,referrerPolicy:u,mode:c,credentials:h,cache:d,redirect:l,integrity:p,keepalive:f,signal:v}));case 12:case"end":return r.stop()}},n)}))},w=function e(t,r){n(this,e),this.authenticationProvider=t,this.authenticationProviderOptions=r};(d=e.FeatureUsageFlag||(e.FeatureUsageFlag={}))[d.NONE=0]="NONE",d[d.REDIRECT_HANDLER_ENABLED=1]="REDIRECT_HANDLER_ENABLED",d[d.RETRY_HANDLER_ENABLED=2]="RETRY_HANDLER_ENABLED",d[d.AUTHENTICATION_HANDLER_ENABLED=4]="AUTHENTICATION_HANDLER_ENABLED";var x=function(){function t(){n(this,t),this.featureUsage=e.FeatureUsageFlag.NONE}return o(t,[{key:"setFeatureUsage",value:function(e){this.featureUsage=this.featureUsage|e}},{key:"getFeatureUsage",value:function(){return this.featureUsage.toString(16)}}],[{key:"updateFeatureUsageFlag",value:function(e,r){var n;e.middlewareControl instanceof h?n=e.middlewareControl.getMiddlewareOptions(t):e.middlewareControl=new h,void 0===n&&(n=new t,e.middlewareControl.setMiddlewareOptions(t,n)),n.setFeatureUsage(r)}}]),t}(),g=function(){function t(e){n(this,t),this.authenticationProvider=e}return o(t,[{key:"execute",value:function(n){return s(this,void 0,void 0,r.mark(function a(){var i,o,s,u,c;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,n.middlewareControl instanceof h&&(i=n.middlewareControl.getMiddlewareOptions(w)),void 0!==i&&(o=i.authenticationProvider,s=i.authenticationProviderOptions),void 0===o&&(o=this.authenticationProvider),r.next=6,o.getAccessToken(s);case 6:return u=r.sent,c="Bearer ".concat(u),y(n.request,n.options,t.AUTHORIZATION_HEADER,c),x.updateFeatureUsageFlag(n,e.FeatureUsageFlag.AUTHENTICATION_HANDLER_ENABLED),r.next=12,this.nextMiddleware.execute(n);case 12:return r.abrupt("return",r.sent);case 15:throw r.prev=15,r.t0=r.catch(0),r.t0;case 18:case"end":return r.stop()}},a,this,[[0,15]])}))}},{key:"setNext",value:function(e){this.nextMiddleware=e}}]),t}();g.AUTHORIZATION_HEADER="Authorization";var E=function(){function e(){n(this,e)}return o(e,[{key:"execute",value:function(e){return s(this,void 0,void 0,r.mark(function t(){return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,fetch(e.request,e.options);case 3:return e.response=t.sent,t.abrupt("return");case 7:throw t.prev=7,t.t0=t.catch(0),t.t0;case 10:case"end":return t.stop()}},t,null,[[0,7]])}))}}]),e}(),b=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.DEFAULT_DELAY,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.DEFAULT_MAX_RETRIES,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.DEFAULT_SHOULD_RETRY;if(n(this,e),t>e.MAX_DELAY&&r>e.MAX_MAX_RETRIES){var i=new Error("Delay and MaxRetries should not be more than ".concat(e.MAX_DELAY," and ").concat(e.MAX_MAX_RETRIES));throw i.name="MaxLimitExceeded",i}if(t>e.MAX_DELAY){var o=new Error("Delay should not be more than ".concat(e.MAX_DELAY));throw o.name="MaxLimitExceeded",o}if(r>e.MAX_MAX_RETRIES){var s=new Error("MaxRetries should not be more than ".concat(e.MAX_MAX_RETRIES));throw s.name="MaxLimitExceeded",s}if(t<0&&r<0){var u=new Error("Delay and MaxRetries should not be negative");throw u.name="MinExpectationNotMet",u}if(t<0){var c=new Error("Delay should not be negative");throw c.name="MinExpectationNotMet",c}if(r<0){var h=new Error("MaxRetries should not be negative");throw h.name="MinExpectationNotMet",h}this.delay=Math.min(t,e.MAX_DELAY),this.maxRetries=Math.min(r,e.MAX_MAX_RETRIES),this.shouldRetry=a}return o(e,[{key:"getMaxDelay",value:function(){return e.MAX_DELAY}}]),e}();b.DEFAULT_DELAY=3,b.DEFAULT_MAX_RETRIES=3,b.MAX_DELAY=180,b.MAX_MAX_RETRIES=10,b.DEFAULT_SHOULD_RETRY=function(){return!0};var k=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new b;n(this,t),this.options=e}return o(t,[{key:"isRetry",value:function(e){return-1!==t.RETRY_STATUS_CODES.indexOf(e.status)}},{key:"isBuffered",value:function(e,t){var r="string"==typeof e?t.method:e.method;if((r===i.PUT||r===i.PATCH||r===i.POST)&&"application/octet-stream"===f(e,t,"Content-Type"))return!1;return!0}},{key:"getDelay",value:function(e,r,n){var a,i=function(){return Number(Math.random().toFixed(3))},o=void 0!==e.headers?e.headers.get(t.RETRY_AFTER_HEADER):null;return a=null!==o?Number.isNaN(Number(o))?Math.round((new Date(o).getTime()-Date.now())/1e3):Number(o):r>=2?this.getExponentialBackOffTime(r)+n+i():n+i(),Math.min(a,this.options.getMaxDelay()+i())}},{key:"getExponentialBackOffTime",value:function(e){return Math.round(.5*(Math.pow(2,e)-1))}},{key:"sleep",value:function(e){return s(this,void 0,void 0,r.mark(function t(){var n;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=1e3*e,t.abrupt("return",new Promise(function(e){return setTimeout(e,n)}));case 2:case"end":return t.stop()}},t)}))}},{key:"getOptions",value:function(e){var t;return e.middlewareControl instanceof h&&(t=e.middlewareControl.getMiddlewareOptions(this.options.constructor)),void 0===t&&(t=Object.assign(new b,this.options)),t}},{key:"executeWithRetry",value:function(e,n,a){return s(this,void 0,void 0,r.mark(function i(){var o;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,this.nextMiddleware.execute(e);case 3:if(!(n<a.maxRetries&&this.isRetry(e.response)&&this.isBuffered(e.request,e.options)&&a.shouldRetry(a.delay,n,e.request,e.options,e.response))){r.next=14;break}return++n,v(e.request,e.options,t.RETRY_ATTEMPT_HEADER,n.toString()),o=this.getDelay(e.response,n,a.delay),r.next=9,this.sleep(o);case 9:return r.next=11,this.executeWithRetry(e,n,a);case 11:return r.abrupt("return",r.sent);case 14:return r.abrupt("return");case 15:r.next=20;break;case 17:throw r.prev=17,r.t0=r.catch(0),r.t0;case 20:case"end":return r.stop()}},i,this,[[0,17]])}))}},{key:"execute",value:function(t){return s(this,void 0,void 0,r.mark(function n(){var a;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,0,a=this.getOptions(t),x.updateFeatureUsageFlag(t,e.FeatureUsageFlag.RETRY_HANDLER_ENABLED),r.next=6,this.executeWithRetry(t,0,a);case 6:return r.abrupt("return",r.sent);case 9:throw r.prev=9,r.t0=r.catch(0),r.t0;case 12:case"end":return r.stop()}},n,this,[[0,9]])}))}},{key:"setNext",value:function(e){this.nextMiddleware=e}}]),t}();k.RETRY_STATUS_CODES=[429,503,504],k.RETRY_ATTEMPT_HEADER="Retry-Attempt",k.RETRY_AFTER_HEADER="Retry-After";var R=function(){function e(){n(this,e)}return o(e,[{key:"execute",value:function(t){return s(this,void 0,void 0,r.mark(function n(){var a,i,o,s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,null===(a=f(t.request,t.options,e.CLIENT_REQUEST_ID_HEADER))&&(a=p(),v(t.request,t.options,e.CLIENT_REQUEST_ID_HEADER,a)),i="".concat(e.PRODUCT_NAME,"/").concat("2.0.0-Preview.4"),t.middlewareControl instanceof h&&(o=t.middlewareControl.getMiddlewareOptions(x)),void 0!==o&&(s=o.getFeatureUsage(),i+=" (".concat(e.FEATURE_USAGE_STRING,"=").concat(s,")")),y(t.request,t.options,e.SDK_VERSION_HEADER,i),r.next=9,this.nextMiddleware.execute(t);case 9:return r.abrupt("return",r.sent);case 12:throw r.prev=12,r.t0=r.catch(0),r.t0;case 15:case"end":return r.stop()}},n,this,[[0,12]])}))}},{key:"setNext",value:function(e){this.nextMiddleware=e}}]),e}();R.CLIENT_REQUEST_ID_HEADER="client-request-id",R.SDK_VERSION_HEADER="SdkVersion",R.PRODUCT_NAME="graph-js",R.FEATURE_USAGE_STRING="featureUsage";var T=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1;n(this,e),this.minValue=t,this.maxValue=r},A=function(){function e(t,r,a){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};n(this,e),this.DEFAULT_FILE_SIZE=5242880,this.client=t,this.file=r,void 0===i.rangeSize&&(i.rangeSize=this.DEFAULT_FILE_SIZE),this.options=i,this.uploadSession=a,this.nextRange=new T(0,this.options.rangeSize-1)}return o(e,[{key:"parseRange",value:function(e){var t=e[0];if(void 0===t||""===t)return new T;var r=t.split("-"),n=parseInt(r[0],10),a=parseInt(r[1],10);return Number.isNaN(a)&&(a=this.file.size-1),new T(n,a)}},{key:"updateTaskStatus",value:function(e){this.uploadSession.expiry=new Date(e.expirationDateTime),this.nextRange=this.parseRange(e.nextExpectedRanges)}},{key:"getNextRange",value:function(){if(-1===this.nextRange.minValue)return this.nextRange;var e=this.nextRange.minValue,t=e+this.options.rangeSize-1;return t>=this.file.size&&(t=this.file.size-1),new T(e,t)}},{key:"sliceFile",value:function(e){return this.file.content.slice(e.minValue,e.maxValue+1)}},{key:"upload",value:function(){return s(this,void 0,void 0,r.mark(function e(){var t,n,a,i;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0;case 1:if(-1!==(t=this.getNextRange()).maxValue){e.next=7;break}throw(n=new Error("Task with which you are trying to upload is already completed, Please check for your uploaded file")).name="Invalid Session",n;case 7:return a=this.sliceFile(t),e.next=10,this.uploadSlice(a,t,this.file.size);case 10:if(void 0===(i=e.sent).id){e.next=15;break}return e.abrupt("return",i);case 15:this.updateTaskStatus(i);case 16:e.next=1;break;case 18:e.next=23;break;case 20:throw e.prev=20,e.t0=e.catch(0),e.t0;case 23:case"end":return e.stop()}},e,this,[[0,20]])}))}},{key:"uploadSlice",value:function(e,t,n){return s(this,void 0,void 0,r.mark(function a(){return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,this.client.api(this.uploadSession.url).headers({"Content-Length":"".concat(t.maxValue-t.minValue+1),"Content-Range":"bytes ".concat(t.minValue,"-").concat(t.maxValue,"/").concat(n)}).put(e);case 3:return r.abrupt("return",r.sent);case 6:throw r.prev=6,r.t0=r.catch(0),r.t0;case 9:case"end":return r.stop()}},a,this,[[0,6]])}))}},{key:"cancel",value:function(){return s(this,void 0,void 0,r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.client.api(this.uploadSession.url).delete();case 3:return e.abrupt("return",e.sent);case 6:throw e.prev=6,e.t0=e.catch(0),e.t0;case 9:case"end":return e.stop()}},e,this,[[0,6]])}))}},{key:"getStatus",value:function(){return s(this,void 0,void 0,r.mark(function e(){var t;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.client.api(this.uploadSession.url).get();case 3:return t=e.sent,this.updateTaskStatus(t),e.abrupt("return",t);case 8:throw e.prev=8,e.t0=e.catch(0),e.t0;case 11:case"end":return e.stop()}},e,this,[[0,8]])}))}},{key:"resume",value:function(){return s(this,void 0,void 0,r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getStatus();case 3:return e.next=5,this.upload();case 5:return e.abrupt("return",e.sent);case 8:throw e.prev=8,e.t0=e.catch(0),e.t0;case 11:case"end":return e.stop()}},e,this,[[0,8]])}))}}],[{key:"createUploadSession",value:function(e,t,n){var a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return s(this,void 0,void 0,r.mark(function i(){var o,s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,e.api(t).headers(a).post(n);case 3:return o=r.sent,s={url:o.uploadUrl,expiry:new Date(o.expirationDateTime)},r.abrupt("return",s);case 8:throw r.prev=8,r.t0=r.catch(0),r.t0;case 11:case"end":return r.stop()}},i,null,[[0,8]])}))}}]),e}(),O=t(function(e){function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(n){return"function"==typeof Symbol&&"symbol"===t(Symbol.iterator)?e.exports=r=function(e){return t(e)}:e.exports=r=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":t(e)},r(n)}e.exports=r});var D=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e};var _=function(e,t){return!t||"object"!==O(t)&&"function"!=typeof t?D(e):t},L=t(function(e){function t(r){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},t(r)}e.exports=t});var P=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=L(e)););return e},S=t(function(e){function t(r,n,a){return"undefined"!=typeof Reflect&&Reflect.get?e.exports=t=Reflect.get:e.exports=t=function(e,t,r){var n=P(e,t);if(n){var a=Object.getOwnPropertyDescriptor(n,t);return a.get?a.get.call(r):a.value}},t(r,n,a||r)}e.exports=t}),U=t(function(e){function t(r,n){return e.exports=t=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},t(r,n)}e.exports=t});var C=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&U(e,t)},M=function(e){return e>327680&&(e=320*Math.floor(e/327680)*1024),e},N=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5242880,t=62914560;return e>t&&(e=t),M(e)},I=function(e){function t(e,r,a,i){return n(this,t),_(this,L(t).call(this,e,r,a,i))}return C(t,A),o(t,[{key:"commit",value:function(e){return s(this,void 0,void 0,r.mark(function t(){var n;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,n={name:this.file.name,"@microsoft.graph.conflictBehavior":"rename","@microsoft.graph.sourceUrl":this.uploadSession.url},t.next=4,this.client.api(e).put(n);case 4:return t.abrupt("return",t.sent);case 7:throw t.prev=7,t.t0=t.catch(0),t.t0;case 10:case"end":return t.stop()}},t,this,[[0,7]])}))}}],[{key:"constructCreateSessionUrl",value:function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t.DEFAULT_UPLOAD_PATH;return e=e.trim(),""===(r=r.trim())&&(r="/"),"/"!==r[0]&&(r="/".concat(r)),"/"!==r[r.length-1]&&(r="".concat(r,"/")),encodeURI("/me/drive/root:".concat(r).concat(e,":/createUploadSession"))}},{key:"create",value:function(e,n,a){return s(this,void 0,void 0,r.mark(function i(){var o,s,u,c,h,d,l,p;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return o=a.fileName,"undefined"!=typeof Blob&&n instanceof Blob?(s=new File([n],o),u=s.size):"undefined"!=typeof File&&n instanceof File?u=(s=n).size:"undefined"!=typeof Buffer&&n instanceof Buffer&&(u=(c=n).byteLength-c.byteOffset,s=c.buffer.slice(c.byteOffset,c.byteOffset+c.byteLength)),r.prev=2,h=t.constructCreateSessionUrl(a.fileName,a.path),r.next=6,t.createUploadSession(e,h,a.fileName);case 6:return d=r.sent,l=N(a.rangeSize),p={name:o,content:s,size:u},r.abrupt("return",new t(e,p,d,{rangeSize:l}));case 12:throw r.prev=12,r.t0=r.catch(2),r.t0;case 15:case"end":return r.stop()}},i,null,[[2,12]])}))}},{key:"createUploadSession",value:function(e,n,a){var i=this,o=Object.create(null,{createUploadSession:{get:function(){return S(L(t),"createUploadSession",i)}}});return s(this,void 0,void 0,r.mark(function t(){var i;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return i={item:{"@microsoft.graph.conflictBehavior":"rename",name:a}},t.prev=1,t.abrupt("return",o.createUploadSession.call(this,e,n,i));case 5:throw t.prev=5,t.t0=t.catch(1),t.t0;case 8:case"end":return t.stop()}},t,this,[[1,5]])}))}}]),t}();I.DEFAULT_UPLOAD_PATH="/";var q,F,H,j,X=function(){function e(t,r,a){n(this,e),this.client=t,this.collection=r.value,this.nextLink=r["@odata.nextLink"],this.deltaLink=r["@odata.deltaLink"],this.callback=a,this.complete=!1}return o(e,[{key:"iterationHelper",value:function(){if(void 0===this.collection)return!1;for(var e=!0;e&&0!==this.collection.length;){var t=this.collection.shift();e=this.callback(t)}return e}},{key:"fetchAndUpdateNextPageData",value:function(){return s(this,void 0,void 0,r.mark(function e(){var t;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.client.api(this.nextLink).get();case 3:t=e.sent,this.collection=t.value,this.nextLink=t["@odata.nextLink"],this.deltaLink=t["@odata.deltaLink"],e.next=12;break;case 9:throw e.prev=9,e.t0=e.catch(0),e.t0;case 12:case"end":return e.stop()}},e,this,[[0,9]])}))}},{key:"getDeltaLink",value:function(){return this.deltaLink}},{key:"iterate",value:function(){return s(this,void 0,void 0,r.mark(function e(){var t;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,t=this.iterationHelper();case 2:if(!t){e.next=12;break}if(void 0===this.nextLink){e.next=9;break}return e.next=6,this.fetchAndUpdateNextPageData();case 6:t=this.iterationHelper(),e.next=10;break;case 9:t=!1;case 10:e.next=2;break;case 12:void 0===this.nextLink&&0===this.collection.length&&(this.complete=!0),e.next=18;break;case 15:throw e.prev=15,e.t0=e.catch(0),e.t0;case 18:case"end":return e.stop()}},e,this,[[0,15]])}))}},{key:"resume",value:function(){return s(this,void 0,void 0,r.mark(function e(){return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.abrupt("return",this.iterate());case 4:throw e.prev=4,e.t0=e.catch(0),e.t0;case 7:case"end":return e.stop()}},e,this,[[0,4]])}))}},{key:"isComplete",value:function(){return this.complete}}]),e}(),B="v1.0",Q="https://graph.microsoft.com/",Y=function(){function e(t){n(this,e),this.provider=t}return o(e,[{key:"getAccessToken",value:function(){return s(this,void 0,void 0,r.mark(function e(){var t=this;return r.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,r){t.provider(function(t,n){n?e(n):r(t)})}));case 1:case"end":return e.stop()}},e)}))}}]),e}(),G=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;n(this,e),this.statusCode=t,this.code=null,this.message=null,this.requestId=null,this.date=new Date,this.body=null},z=function(){function e(){n(this,e)}return o(e,null,[{key:"constructError",value:function(e,t){var r=new G(t);return void 0!==e.name&&(r.code=e.name),r.body=e.toString(),r.message=e.message,r.date=new Date,r}},{key:"constructErrorFromResponse",value:function(e,t){e=e.error;var r=new G(t);r.code=e.code,r.message=e.message,void 0!==e.innerError&&(r.requestId=e.innerError["request-id"],r.date=new Date(e.innerError.date));try{r.body=JSON.stringify(e)}catch(e){}return r}},{key:"getError",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,a=arguments.length>2?arguments[2]:void 0;return s(this,void 0,void 0,r.mark(function i(){var o;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(o=t&&t.error?e.constructErrorFromResponse(t,n):"undefined"!=typeof Error&&t instanceof Error?e.constructError(t,n):new G(n),"function"!=typeof a){r.next=5;break}a(o,null),r.next=6;break;case 5:return r.abrupt("return",o);case 6:case"end":return r.stop()}},i)}))}}]),e}(),$=["$select","$expand","$orderby","$filter","$top","$skip","$skipToken","$count"],V=function(e){var t=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};(q=e.ResponseType||(e.ResponseType={})).ARRAYBUFFER="arraybuffer",q.BLOB="blob",q.DOCUMENT="document",q.JSON="json",q.RAW="raw",q.STREAM="stream",q.TEXT="text",function(e){e.TEXT_HTML="text/html",e.TEXT_XML="text/xml",e.APPLICATION_XML="application/xml",e.APPLICATION_XHTML="application/xhtml+xml"}(F||(F={})),function(e){e.TEXT_PLAIN="text/plain",e.APPLICATION_JSON="application/json"}(H||(H={})),function(e){e.DOCUMENT="^(text\\/(html|xml))|(application\\/(xml|xhtml\\+xml))$",e.IMAGE="^image\\/.+"}(j||(j={}));var W=function(){function t(){n(this,t)}return o(t,null,[{key:"parseDocumentResponse",value:function(e,t){try{return"undefined"!=typeof DOMParser?new Promise(function(r,n){e.text().then(function(e){try{var a=(new DOMParser).parseFromString(e,t);r(a)}catch(e){n(e)}})}):Promise.resolve(e.body)}catch(e){throw e}}},{key:"convertResponse",value:function(n,a){return s(this,void 0,void 0,r.mark(function i(){var o,s,u;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(204!==n.status){r.next=2;break}return r.abrupt("return",Promise.resolve());case 2:r.prev=2,r.t0=a,r.next=r.t0===e.ResponseType.ARRAYBUFFER?6:r.t0===e.ResponseType.BLOB?10:r.t0===e.ResponseType.DOCUMENT?14:r.t0===e.ResponseType.JSON?18:r.t0===e.ResponseType.STREAM?22:r.t0===e.ResponseType.TEXT?26:30;break;case 6:return r.next=8,n.arrayBuffer();case 8:return o=r.sent,r.abrupt("break",60);case 10:return r.next=12,n.blob();case 12:return o=r.sent,r.abrupt("break",60);case 14:return r.next=16,t.parseDocumentResponse(n,F.TEXT_XML);case 16:return o=r.sent,r.abrupt("break",60);case 18:return r.next=20,n.json();case 20:return o=r.sent,r.abrupt("break",60);case 22:return r.next=24,Promise.resolve(n.body);case 24:return o=r.sent,r.abrupt("break",60);case 26:return r.next=28,n.text();case 28:return o=r.sent,r.abrupt("break",60);case 30:if(null===(s=n.headers.get("Content-type"))){r.next=58;break}if(u=s.split(";")[0],!new RegExp(j.DOCUMENT).test(u)){r.next=39;break}return r.next=36,t.parseDocumentResponse(n,u);case 36:o=r.sent,r.next=56;break;case 39:if(!new RegExp(j.IMAGE).test(u)){r.next=43;break}o=n.blob(),r.next=56;break;case 43:if(u!==H.TEXT_PLAIN){r.next=49;break}return r.next=46,n.text();case 46:o=r.sent,r.next=56;break;case 49:if(u!==H.APPLICATION_JSON){r.next=55;break}return r.next=52,n.json();case 52:o=r.sent,r.next=56;break;case 55:o=Promise.resolve(n.body);case 56:r.next=59;break;case 58:o=Promise.resolve(n.body);case 59:return r.abrupt("break",60);case 60:r.next=65;break;case 62:throw r.prev=62,r.t1=r.catch(2),r.t1;case 65:return r.abrupt("return",o);case 66:case"end":return r.stop()}},i,null,[[2,62]])}))}},{key:"getResponse",value:function(n,a,i){return s(this,void 0,void 0,r.mark(function o(){var s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(r.prev=0,a!==e.ResponseType.RAW){r.next=5;break}return r.abrupt("return",Promise.resolve(n));case 5:return r.next=7,t.convertResponse(n,a);case 7:if(s=r.sent,!n.ok){r.next=16;break}if("function"!=typeof i){r.next=13;break}i(null,s),r.next=14;break;case 13:return r.abrupt("return",s);case 14:r.next=17;break;case 16:throw s;case 17:r.next=22;break;case 19:throw r.prev=19,r.t0=r.catch(0),r.t0;case 22:case"end":return r.stop()}},o,null,[[0,19]])}))}}]),t}(),Z=function(){function t(e,r,a){var i=this;n(this,t),this.parsePath=function(e){if(-1!==e.indexOf("https://")){var t=(e=e.replace("https://","")).indexOf("/");-1!==t&&(i.urlComponents.host="https://"+e.substring(0,t),e=e.substring(t+1,e.length));var r=e.indexOf("/");-1!==r&&(i.urlComponents.version=e.substring(0,r),e=e.substring(r+1,e.length))}"/"===e.charAt(0)&&(e=e.substr(1));var n=e.indexOf("?");if(-1===n)i.urlComponents.path=e;else{i.urlComponents.path=e.substr(0,n);var a=e.substring(n+1,e.length).split("&"),o=!0,s=!1,u=void 0;try{for(var c,h=a[Symbol.iterator]();!(o=(c=h.next()).done);o=!0){var d=c.value.split("="),l=d[0],p=d[1];-1!==$.indexOf(l)?i.urlComponents.oDataQueryParams[l]=p:i.urlComponents.otherURLQueryParams[l]=p}}catch(e){s=!0,u=e}finally{try{o||null==h.return||h.return()}finally{if(s)throw u}}}},this.httpClient=e,this.config=r,this.urlComponents={host:this.config.baseUrl,version:this.config.defaultVersion,oDataQueryParams:{},otherURLQueryParams:{}},this._headers={},this._options={},this._middlewareOptions=[],this.parsePath(a)}return o(t,[{key:"addCsvQueryParameter",value:function(e,t,r){this.urlComponents.oDataQueryParams[e]=this.urlComponents.oDataQueryParams[e]?this.urlComponents.oDataQueryParams[e]+",":"";var n=[];r.length>1&&"string"==typeof t?n=Array.prototype.slice.call(r):"string"==typeof t?n.push(t):n=n.concat(t),this.urlComponents.oDataQueryParams[e]+=n.join(",")}},{key:"buildFullUrl",value:function(){var e,t,r=(e=[this.urlComponents.host,this.urlComponents.version,this.urlComponents.path],t=function(e){return e.replace(/^\/+/,"")},Array.prototype.slice.call(e).reduce(function(e,r){return[(n=e,n.replace(/\/+$/,"")),t(r)].join("/");var n})+this.createQueryString());return this.config.debugLogging&&console.log(r),r}},{key:"createQueryString",value:function(){var e=this.urlComponents,t=[];if(0!==Object.keys(e.oDataQueryParams).length)for(var r in e.oDataQueryParams)e.oDataQueryParams.hasOwnProperty(r)&&t.push(r+"="+e.oDataQueryParams[r]);if(0!==Object.keys(e.otherURLQueryParams).length)for(var n in e.otherURLQueryParams)e.otherURLQueryParams.hasOwnProperty(n)&&t.push(n+"="+e.otherURLQueryParams[n]);return t.length>0?"?"+t.join("&"):""}},{key:"updateRequestOptions",value:function(e){var t=Object.assign({},e.headers);if(void 0!==this.config.fetchOptions){var r=Object.assign({},this.config.fetchOptions);Object.assign(e,r),void 0!==O(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}},{key:"send",value:function(e,t,n){return s(this,void 0,void 0,r.mark(function a(){var i,o,s,u,c;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return o=new h(this._middlewareOptions),this.updateRequestOptions(t),r.prev=2,r.next=5,this.httpClient.sendRequest({request:e,options:t,middlewareControl:o});case 5:return s=r.sent,i=s.response,r.next=9,W.getResponse(i,this._responseType,n);case 9:return u=r.sent,r.abrupt("return",u);case 13:return r.prev=13,r.t0=r.catch(2),void 0!==i&&(c=i.status),r.next=18,z.getError(r.t0,c,n);case 18:throw r.sent;case 20:case"end":return r.stop()}},a,this,[[2,13]])}))}},{key:"header",value:function(e,t){return this._headers[e]=t,this}},{key:"headers",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(this._headers[t]=e[t]);return this}},{key:"option",value:function(e,t){return this._options[e]=t,this}},{key:"options",value:function(e){for(var t in e)e.hasOwnProperty(t)&&(this._options[t]=e[t]);return this}},{key:"middlewareOptions",value:function(e){return this._middlewareOptions=e,this}},{key:"version",value:function(e){return this.urlComponents.version=e,this}},{key:"responseType",value:function(e){return this._responseType=e,this}},{key:"select",value:function(e){return this.addCsvQueryParameter("$select",e,arguments),this}},{key:"expand",value:function(e){return this.addCsvQueryParameter("$expand",e,arguments),this}},{key:"orderby",value:function(e){return this.addCsvQueryParameter("$orderby",e,arguments),this}},{key:"filter",value:function(e){return this.urlComponents.oDataQueryParams.$filter=e,this}},{key:"search",value:function(e){return this.urlComponents.oDataQueryParams.$search=e,this}},{key:"top",value:function(e){return this.urlComponents.oDataQueryParams.$top=e,this}},{key:"skip",value:function(e){return this.urlComponents.oDataQueryParams.$skip=e,this}},{key:"skipToken",value:function(e){return this.urlComponents.oDataQueryParams.$skipToken=e,this}},{key:"count",value:function(e){return this.urlComponents.oDataQueryParams.$count=e.toString(),this}},{key:"query",value:function(e){var t=this.urlComponents.otherURLQueryParams;if("string"==typeof e){var r=e.split("="),n=r[0],a=r[1];t[n]=a}else for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i]);return this}},{key:"get",value:function(e){return s(this,void 0,void 0,r.mark(function t(){var n,a,o;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.buildFullUrl(),a={method:i.GET},t.prev=2,t.next=5,this.send(n,a,e);case 5:return o=t.sent,t.abrupt("return",o);case 9:throw t.prev=9,t.t0=t.catch(2),t.t0;case 12:case"end":return t.stop()}},t,this,[[2,9]])}))}},{key:"post",value:function(e,t){return s(this,void 0,void 0,r.mark(function n(){var a,o,s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return a=this.buildFullUrl(),o={method:i.POST,body:V(e),headers:"undefined"!=typeof FormData&&e instanceof FormData?{}:{"Content-Type":"application/json"}},r.prev=2,r.next=5,this.send(a,o,t);case 5:return s=r.sent,r.abrupt("return",s);case 9:throw r.prev=9,r.t0=r.catch(2),r.t0;case 12:case"end":return r.stop()}},n,this,[[2,9]])}))}},{key:"create",value:function(e,t){return s(this,void 0,void 0,r.mark(function n(){return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,this.post(e,t);case 3:return r.abrupt("return",r.sent);case 6:throw r.prev=6,r.t0=r.catch(0),r.t0;case 9:case"end":return r.stop()}},n,this,[[0,6]])}))}},{key:"put",value:function(e,t){return s(this,void 0,void 0,r.mark(function n(){var a,o,s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return a=this.buildFullUrl(),o={method:i.PUT,body:V(e),headers:{"Content-Type":"application/json"}},r.prev=2,r.next=5,this.send(a,o,t);case 5:return s=r.sent,r.abrupt("return",s);case 9:throw r.prev=9,r.t0=r.catch(2),r.t0;case 12:case"end":return r.stop()}},n,this,[[2,9]])}))}},{key:"patch",value:function(e,t){return s(this,void 0,void 0,r.mark(function n(){var a,o,s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return a=this.buildFullUrl(),o={method:i.PATCH,body:V(e),headers:{"Content-Type":"application/json"}},r.prev=2,r.next=5,this.send(a,o,t);case 5:return s=r.sent,r.abrupt("return",s);case 9:throw r.prev=9,r.t0=r.catch(2),r.t0;case 12:case"end":return r.stop()}},n,this,[[2,9]])}))}},{key:"update",value:function(e,t){return s(this,void 0,void 0,r.mark(function n(){return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,this.patch(e,t);case 3:return r.abrupt("return",r.sent);case 6:throw r.prev=6,r.t0=r.catch(0),r.t0;case 9:case"end":return r.stop()}},n,this,[[0,6]])}))}},{key:"delete",value:function(e){return s(this,void 0,void 0,r.mark(function t(){var n,a,o;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=this.buildFullUrl(),a={method:i.DELETE},t.prev=2,t.next=5,this.send(n,a,e);case 5:return o=t.sent,t.abrupt("return",o);case 9:throw t.prev=9,t.t0=t.catch(2),t.t0;case 12:case"end":return t.stop()}},t,this,[[2,9]])}))}},{key:"del",value:function(e){return s(this,void 0,void 0,r.mark(function t(){return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,this.delete(e);case 3:return t.abrupt("return",t.sent);case 6:throw t.prev=6,t.t0=t.catch(0),t.t0;case 9:case"end":return t.stop()}},t,this,[[0,6]])}))}},{key:"getStream",value:function(t){return s(this,void 0,void 0,r.mark(function n(){var a,o,s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return a=this.buildFullUrl(),o={method:i.GET},this.responseType(e.ResponseType.STREAM),r.prev=3,r.next=6,this.send(a,o,t);case 6:return s=r.sent,r.abrupt("return",s);case 10:throw r.prev=10,r.t0=r.catch(3),r.t0;case 13:case"end":return r.stop()}},n,this,[[3,10]])}))}},{key:"putStream",value:function(e,t){return s(this,void 0,void 0,r.mark(function n(){var a,o,s;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return a=this.buildFullUrl(),o={method:i.PUT,headers:{"Content-Type":"application/octet-stream"},body:e},r.prev=2,r.next=5,this.send(a,o,t);case 5:return s=r.sent,r.abrupt("return",s);case 9:throw r.prev=9,r.t0=r.catch(2),r.t0;case 12:case"end":return r.stop()}},n,this,[[2,9]])}))}}]),t}(),J=function(){function e(t){n(this,e),this.middleware=t}return o(e,[{key:"sendRequest",value:function(e){return s(this,void 0,void 0,r.mark(function t(){var n;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,"string"!=typeof e.request||void 0!==e.options){t.next=6;break}throw(n=new Error).name="InvalidRequestOptions",n.message="Unable to execute the middleware, Please provide valid options for a request",n;case 6:return t.next=8,this.middleware.execute(e);case 8:return t.abrupt("return",e);case 11:throw t.prev=11,t.t0=t.catch(0),t.t0;case 14:case"end":return t.stop()}},t,this,[[0,11]])}))}}]),e}(),K=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.DEFAULT_MAX_REDIRECTS,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e.DEFAULT_SHOULD_RETRY;if(n(this,e),t>e.MAX_MAX_REDIRECTS){var a=new Error("MaxRedirects should not be more than ".concat(e.MAX_MAX_REDIRECTS));throw a.name="MaxLimitExceeded",a}if(t<0){var i=new Error("MaxRedirects should not be negative");throw i.name="MinExpectationNotMet",i}this.maxRedirects=t,this.shouldRedirect=r};K.DEFAULT_MAX_REDIRECTS=5,K.MAX_MAX_REDIRECTS=20,K.DEFAULT_SHOULD_RETRY=function(){return!0};var ee=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new K;n(this,t),this.options=e}return o(t,[{key:"isRedirect",value:function(e){return-1!==t.REDIRECT_STATUS_CODES.indexOf(e.status)}},{key:"hasLocationHeader",value:function(e){return e.headers.has(t.LOCATION_HEADER)}},{key:"getLocationHeader",value:function(e){return e.headers.get(t.LOCATION_HEADER)}},{key:"isRelativeURL",value:function(e){return-1===e.indexOf("://")}},{key:"shouldDropAuthorizationHeader",value:function(e,t){var r,n,a=/^[A-Za-z].+?:\/\/.+?(?=\/|$)/,i=a.exec(e);null!==i&&(r=i[0]);var o=a.exec(t);return null!==o&&(n=o[0]),void 0!==r&&void 0!==n&&r!==n}},{key:"updateRequestUrl",value:function(e,t){return s(this,void 0,void 0,r.mark(function n(){return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if("string"!=typeof t.request){r.next=4;break}r.t0=e,r.next=7;break;case 4:return r.next=6,m(e,t.request);case 6:r.t0=r.sent;case 7:t.request=r.t0;case 8:case"end":return r.stop()}},n)}))}},{key:"getOptions",value:function(e){var t;return e.middlewareControl instanceof h&&(t=e.middlewareControl.getMiddlewareOptions(K)),void 0===t&&(t=Object.assign(new K,this.options)),t}},{key:"executeWithRedirect",value:function(e,n,a){return s(this,void 0,void 0,r.mark(function o(){var s,u;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,r.next=3,this.nextMiddleware.execute(e);case 3:if(s=e.response,!(n<a.maxRedirects&&this.isRedirect(s)&&this.hasLocationHeader(s)&&a.shouldRedirect(s))){r.next=19;break}if(++n,s.status!==t.STATUS_CODE_SEE_OTHER){r.next=11;break}e.options.method=i.GET,delete e.options.body,r.next=15;break;case 11:return u=this.getLocationHeader(s),!this.isRelativeURL(u)&&this.shouldDropAuthorizationHeader(s.url,u)&&v(e.request,e.options,t.AUTHORIZATION_HEADER,void 0),r.next=15,this.updateRequestUrl(u,e);case 15:return r.next=17,this.executeWithRedirect(e,n,a);case 17:r.next=20;break;case 19:return r.abrupt("return");case 20:r.next=25;break;case 22:throw r.prev=22,r.t0=r.catch(0),r.t0;case 25:case"end":return r.stop()}},o,this,[[0,22]])}))}},{key:"execute",value:function(n){return s(this,void 0,void 0,r.mark(function a(){var i;return r.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,0,i=this.getOptions(n),n.options.redirect=t.MANUAL_REDIRECT,x.updateFeatureUsageFlag(n,e.FeatureUsageFlag.REDIRECT_HANDLER_ENABLED),r.next=7,this.executeWithRedirect(n,0,i);case 7:return r.abrupt("return",r.sent);case 10:throw r.prev=10,r.t0=r.catch(0),r.t0;case 13:case"end":return r.stop()}},a,this,[[0,10]])}))}},{key:"setNext",value:function(e){this.nextMiddleware=e}}]),t}();ee.REDIRECT_STATUS_CODES=[301,302,303,307,308],ee.STATUS_CODE_SEE_OTHER=303,ee.LOCATION_HEADER="Location",ee.AUTHORIZATION_HEADER="Authorization",ee.MANUAL_REDIRECT="manual";var te=function(){function e(){n(this,e)}return o(e,null,[{key:"createWithAuthenticationProvider",value:function(t){var r=new g(t),n=new k(new b),a=new R,i=new E;if(r.setNext(n),new Function("try {return this === global;}catch(e){return false;}")()){var o=new ee(new K);n.setNext(o),o.setNext(a)}else n.setNext(a);return a.setNext(i),e.createWithMiddleware(r)}},{key:"createWithMiddleware",value:function(e){return new J(e)}}]),e}(),re=function(){if("undefined"==typeof Promise&&"undefined"==typeof fetch){var 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){var t=new Error("Library cannot function without Promise. So, please provide polyfill for it.");throw t.name="PolyFillNotAvailable",t}if("undefined"==typeof fetch){var r=new Error("Library cannot function without fetch. So, please provide polyfill for it.");throw r.name="PolyFillNotAvailable",r}return!0},ne=function(){function e(t){n(this,e),this.config={baseUrl:Q,debugLogging:!1,defaultVersion:B};try{re()}catch(i){throw i}for(var r in t)t.hasOwnProperty(r)&&(this.config[r]=t[r]);var a;if(void 0!==t.authProvider&&void 0!==t.middleware){var i=new Error;throw i.name="AmbiguityInInitialization",i.message="Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain not both",i}if(void 0!==t.authProvider)a=te.createWithAuthenticationProvider(t.authProvider);else{if(void 0===t.middleware){var o=new Error;throw o.name="InvalidMiddlewareChain",o.message="Unable to Create Client, Please provide either authentication provider for default middleware chain or custom middleware chain",o}a=new J(t.middleware)}this.httpClient=a}return o(e,[{key:"api",value:function(e){return new Z(this.httpClient,this.config,e)}}],[{key:"init",value:function(t){var r={};for(var n in t)t.hasOwnProperty(n)&&(r[n]="authProvider"===n?new Y(t[n]):t[n]);return e.initWithMiddleware(r)}},{key:"initWithMiddleware",value:function(t){try{return new e(t)}catch(e){throw e}}}]),e}(),ae=function(){function e(t,r){n(this,e),this.options=r,this.msalApplication=t}return o(e,[{key:"getAccessToken",value:function(e){return s(this,void 0,void 0,r.mark(function t(){var n,a,i,o,s,u,c,h;return r.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(void 0!==(n=e)&&(a=n.scopes),void 0!==a&&0!==a.length||(a=this.options.scopes),0!==a.length){t.next=8;break}throw(i=new Error).name="EmptyScopes",i.message="Scopes cannot be empty, Please provide a scopes",i;case 8:if(!this.msalApplication.getAccount()){t.next=35;break}return o={scopes:a},t.prev=10,t.next=13,this.msalApplication.acquireTokenSilent(o);case 13:return s=t.sent,t.abrupt("return",s.accessToken);case 17:if(t.prev=17,t.t0=t.catch(10),"InteractionRequiredAuthError"!==t.t0.name){t.next=32;break}return t.prev=20,t.next=23,this.msalApplication.acquireTokenPopup(o);case 23:return u=t.sent,t.abrupt("return",u.accessToken);case 27:throw t.prev=27,t.t1=t.catch(20),t.t1;case 30:t.next=33;break;case 32:throw t.t0;case 33:t.next=48;break;case 35:return t.prev=35,c={scopes:a},t.next=39,this.msalApplication.loginPopup(c);case 39:return t.next=41,this.msalApplication.acquireTokenSilent(c);case 41:return h=t.sent,t.abrupt("return",h.accessToken);case 45:throw t.prev=45,t.t2=t.catch(35),t.t2;case 48:case"end":return t.stop()}},t,this,[[10,17],[20,27],[35,45]])}))}}]),e}();return e.AuthenticationHandler=g,e.AuthenticationHandlerOptions=w,e.BatchRequestContent=u,e.BatchResponseContent=c,e.Client=ne,e.GraphError=G,e.GraphRequest=Z,e.HTTPMessageHandler=E,e.ImplicitMSALAuthenticationProvider=ae,e.LargeFileUploadTask=A,e.MSALAuthenticationProviderOptions=function e(t){n(this,e),this.scopes=t},e.OneDriveLargeFileUploadTask=I,e.PageIterator=X,e.RetryHandler=k,e.RetryHandlerOptions=b,e.TelemetryHandler=R,e.TelemetryHandlerOptions=x,e}({});

@@ -54,3 +54,3 @@ "use strict";

}
if (!this.msalApplication.getAccount()) return [3 /*break*/, 9];
if (!this.msalApplication.getAccount()) return [3 /*break*/, 11];
tokenRequest = {

@@ -61,3 +61,3 @@ scopes: scopes,

case 1:
_a.trys.push([1, 3, , 8]);
_a.trys.push([1, 3, , 10]);
return [4 /*yield*/, this.msalApplication.acquireTokenSilent(tokenRequest)];

@@ -69,3 +69,3 @@ case 2:

error_1 = _a.sent();
if (!(error_1.name === "InteractionRequiredAuthError")) return [3 /*break*/, 7];
if (!(error_1.name === "InteractionRequiredAuthError")) return [3 /*break*/, 8];
_a.label = 4;

@@ -81,6 +81,8 @@ case 4:

throw error_2;
case 7: return [3 /*break*/, 8];
case 8: return [3 /*break*/, 13];
case 9:
_a.trys.push([9, 12, , 13]);
case 7: return [3 /*break*/, 9];
case 8: throw error_1;
case 9: return [3 /*break*/, 10];
case 10: return [3 /*break*/, 15];
case 11:
_a.trys.push([11, 14, , 15]);
tokenRequest = {

@@ -90,12 +92,12 @@ scopes: scopes,

return [4 /*yield*/, this.msalApplication.loginPopup(tokenRequest)];
case 10:
case 12:
_a.sent();
return [4 /*yield*/, this.msalApplication.acquireTokenSilent(tokenRequest)];
case 11:
case 13:
authResponse = _a.sent();
return [2 /*return*/, authResponse.accessToken];
case 12:
case 14:
error_3 = _a.sent();
throw error_3;
case 13: return [2 /*return*/];
case 15: return [2 /*return*/];
}

@@ -102,0 +104,0 @@ });

@@ -58,3 +58,3 @@ "use strict";

}
if (!this.msalApplication.getAccount()) return [3 /*break*/, 9];
if (!this.msalApplication.getAccount()) return [3 /*break*/, 11];
tokenRequest = {

@@ -65,3 +65,3 @@ scopes: scopes,

case 1:
_a.trys.push([1, 3, , 8]);
_a.trys.push([1, 3, , 10]);
return [4 /*yield*/, this.msalApplication.acquireTokenSilent(tokenRequest)];

@@ -73,3 +73,3 @@ case 2:

error_1 = _a.sent();
if (!(error_1 instanceof msal_1.InteractionRequiredAuthError)) return [3 /*break*/, 7];
if (!(error_1 instanceof msal_1.InteractionRequiredAuthError)) return [3 /*break*/, 8];
_a.label = 4;

@@ -85,6 +85,8 @@ case 4:

throw error_2;
case 7: return [3 /*break*/, 8];
case 8: return [3 /*break*/, 13];
case 9:
_a.trys.push([9, 12, , 13]);
case 7: return [3 /*break*/, 9];
case 8: throw error_1;
case 9: return [3 /*break*/, 10];
case 10: return [3 /*break*/, 15];
case 11:
_a.trys.push([11, 14, , 15]);
tokenRequest = {

@@ -94,12 +96,12 @@ scopes: scopes,

return [4 /*yield*/, this.msalApplication.loginPopup(tokenRequest)];
case 10:
case 12:
_a.sent();
return [4 /*yield*/, this.msalApplication.acquireTokenSilent(tokenRequest)];
case 11:
case 13:
authResponse = _a.sent();
return [2 /*return*/, authResponse.accessToken];
case 12:
case 14:
error_3 = _a.sent();
throw error_3;
case 13: return [2 /*return*/];
case 15: return [2 /*return*/];
}

@@ -106,0 +108,0 @@ });

@@ -10,2 +10,2 @@ /**

*/
export declare const PACKAGE_VERSION = "2.0.0-Preview.3";
export declare const PACKAGE_VERSION = "2.0.0-Preview.4";

@@ -14,3 +14,3 @@ "use strict";

*/
exports.PACKAGE_VERSION = "2.0.0-Preview.3";
exports.PACKAGE_VERSION = "2.0.0-Preview.4";
//# sourceMappingURL=Version.js.map
{
"name": "@microsoft/microsoft-graph-client",
"version": "2.0.0-Preview.3",
"version": "2.0.0-Preview.4",
"description": "Microsoft Graph Client Library",

@@ -5,0 +5,0 @@ "main": "lib/src/index.js",

@@ -75,3 +75,3 @@ # Microsoft Graph JavaScript Client Library

auth: {
clientId: "your_client_id"; // Client Id of the registered application
clientId: "your_client_id", // Client Id of the registered application
redirectUri: "your_redirect_uri",

@@ -78,0 +78,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc