Socket
Socket
Sign inDemoInstall

@azure/ms-rest-js

Package Overview
Dependencies
Maintainers
7
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/ms-rest-js - npm Package Compare versions

Comparing version 1.6.0 to 1.7.0

2

dist/msRest.browser.min.js

@@ -5,2 +5,2 @@ /** @license ms-rest-js

*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.msRest={})}(this,function(N){"use strict";function r(e){return e.toLowerCase()}var p=function(){function e(e){if(this._headersMap={},e)for(var t in e)this.set(t,e[t])}return e.prototype.set=function(e,t){this._headersMap[r(e)]={name:e,value:t.toString()}},e.prototype.get=function(e){var t=this._headersMap[r(e)];return t?t.value:void 0},e.prototype.contains=function(e){return!!this._headersMap[r(e)]},e.prototype.remove=function(e){var t=this.contains(e);return delete this._headersMap[r(e)],t},e.prototype.rawHeaders=function(){var e={};for(var t in this._headersMap){var r=this._headersMap[t];e[r.name.toLowerCase()]=r.value}return e},e.prototype.headersArray=function(){var e=[];for(var t in this._headersMap)e.push(this._headersMap[t]);return e},e.prototype.headerNames=function(){for(var e=[],t=this.headersArray(),r=0;r<t.length;++r)e.push(t[r].name);return e},e.prototype.headerValues=function(){for(var e=[],t=this.headersArray(),r=0;r<t.length;++r)e.push(t[r].value);return e},e.prototype.toJson=function(){return this.rawHeaders()},e.prototype.toString=function(){return JSON.stringify(this.toJson())},e.prototype.clone=function(){return new e(this.rawHeaders())},e}();function s(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function a(e){for(var t=atob(e),r=new Uint8Array(t.length),n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}for(var e,u=(function(e){var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var n=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}}(e={exports:{}},e.exports),e.exports),o=[],t=0;t<256;++t)o[t]=(t+256).toString(16).substr(1);var l=function(e,t){var r=t||0,n=o;return[n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]]].join("")};var n=function(e,t,r){var n=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||u)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var i=0;i<16;++i)t[n+i]=o[i];return t||l(o)},c={msRestVersion:"1.6.0",HTTP:"http:",HTTPS:"https:",HTTP_PROXY:"HTTP_PROXY",HTTPS_PROXY:"HTTPS_PROXY",HttpConstants:{HttpVerbs:{PUT:"PUT",GET:"GET",DELETE:"DELETE",POST:"POST",MERGE:"MERGE",HEAD:"HEAD",PATCH:"PATCH"},StatusCodes:{TooManyRequests:429}},HeaderConstants:{AUTHORIZATION:"authorization",AUTHORIZATION_SCHEME:"Bearer",RETRY_AFTER:"Retry-After",USER_AGENT:"User-Agent"}},i="undefined"==typeof navigator&&"undefined"!=typeof process;function v(e){var t={};return t.body=e.bodyAsText,t.headers=e.headers,t.status=e.status,t}function g(e){var t=e.clone();return t.headers&&t.headers.remove("authorization"),t}function f(e){return new RegExp("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","ig").test(e)}function y(){return n()}function h(t,r){return new Promise(function(e){return setTimeout(function(){return e(r)},t)})}var d=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function m(e){return d.test(e)}function b(e,t,r){return e&&t?e.split(t).join(r||""):e}var E=function(){function e(e,t){void 0===e&&(e={}),this.modelMappers=e,this.isXML=t}return e.prototype.validateConstraints=function(e,r,n){var t=function(e,t){throw new Error('"'+n+'" with value "'+r+'" should satisfy the constraint "'+e+'": '+t+".")};if(e.constraints&&null!=r){var o=e.constraints,i=o.ExclusiveMaximum,a=o.ExclusiveMinimum,s=o.InclusiveMaximum,u=o.InclusiveMinimum,l=o.MaxItems,c=o.MaxLength,f=o.MinItems,p=o.MinLength,h=o.MultipleOf,d=o.Pattern,y=o.UniqueItems;null!=i&&i<=r&&t("ExclusiveMaximum",i),null!=a&&r<=a&&t("ExclusiveMinimum",a),null!=s&&s<r&&t("InclusiveMaximum",s),null!=u&&r<u&&t("InclusiveMinimum",u),null!=l&&r.length>l&&t("MaxItems",l),null!=c&&r.length>c&&t("MaxLength",c),null!=f&&r.length<f&&t("MinItems",f),null!=p&&r.length<p&&t("MinLength",p),null!=h&&r%h!=0&&t("MultipleOf",h),d&&null===r.match(d)&&t("Pattern",d),y&&r.some(function(e,t,r){return r.indexOf(e)!==t})&&t("UniqueItems",y)}},e.prototype.serialize=function(e,t,r){var n={},o=e.type.name;r||(r=e.serializedName),null!==o.match(/^Sequence$/gi)&&(n=[]),null!=t||null==e.defaultValue&&!e.isConstant||(t=e.defaultValue);var i=e.required,a=e.nullable;if(i&&a&&void 0===t)throw new Error(r+" cannot be undefined.");if(i&&!a&&null==t)throw new Error(r+" cannot be null or undefined.");if(!i&&!1===a&&null===t)throw new Error(r+" cannot be null.");if(null==t)n=t;else if(this.validateConstraints(e,t,r),null!==o.match(/^any$/gi))n=t;else if(null!==o.match(/^(Number|String|Boolean|Object|Stream|Uuid)$/gi))n=function(e,t,r){if(null!=r)if(null!==e.match(/^Number$/gi)){if("number"!=typeof r)throw new Error(t+" with value "+r+" must be of type number.")}else if(null!==e.match(/^String$/gi)){if("string"!=typeof r.valueOf())throw new Error(t+' with value "'+r+'" must be of type string.')}else if(null!==e.match(/^Uuid$/gi)){if("string"!=typeof r.valueOf()||!f(r))throw new Error(t+' with value "'+r+'" must be of type string and a valid uuid.')}else if(null!==e.match(/^Boolean$/gi)){if("boolean"!=typeof r)throw new Error(t+" with value "+r+" must be of type boolean.")}else if(null!==e.match(/^Stream$/gi)){var n=typeof r;if(!("string"===n||"function"===n||r instanceof ArrayBuffer||ArrayBuffer.isView(r)||"function"==typeof Blob&&r instanceof Blob))throw new Error(t+" must be a string, Blob, ArrayBuffer, ArrayBufferView, or a function returning NodeJS.ReadableStream.")}return r}(o,r,t);else if(null!==o.match(/^Enum$/gi)){n=function(e,t,r){if(!t)throw new Error("Please provide a set of allowedValues to validate "+e+" as an Enum Type.");if(t.some(function(e){return"string"==typeof e.valueOf()?e.toLowerCase()===r.toLowerCase():e===r}))return r;throw new Error(r+" is not a valid value for "+e+". The valid values are: "+JSON.stringify(t)+".")}(r,e.type.allowedValues,t)}else null!==o.match(/^(Date|DateTime|TimeSpan|DateTimeRfc1123|UnixTime)$/gi)?n=function(e,t,r){if(null!=t)if(null!==e.match(/^Date$/gi)){if(!(t instanceof Date||"string"==typeof t.valueOf()&&!isNaN(Date.parse(t))))throw new Error(r+" must be an instanceof Date or a string in ISO8601 format.");t=t instanceof Date?t.toISOString().substring(0,10):new Date(t).toISOString().substring(0,10)}else if(null!==e.match(/^DateTime$/gi)){if(!(t instanceof Date||"string"==typeof t.valueOf()&&!isNaN(Date.parse(t))))throw new Error(r+" must be an instanceof Date or a string in ISO8601 format.");t=t instanceof Date?t.toISOString():new Date(t).toISOString()}else if(null!==e.match(/^DateTimeRfc1123$/gi)){if(!(t instanceof Date||"string"==typeof t.valueOf()&&!isNaN(Date.parse(t))))throw new Error(r+" must be an instanceof Date or a string in RFC-1123 format.");t=t instanceof Date?t.toUTCString():new Date(t).toUTCString()}else if(null!==e.match(/^UnixTime$/gi)){if(!(t instanceof Date||"string"==typeof t.valueOf()&&!isNaN(Date.parse(t))))throw new Error(r+" must be an instanceof Date or a string in RFC-1123/ISO8601 format for it to be serialized in UnixTime/Epoch format.");t=function(e){if(!e)return;"string"==typeof e.valueOf()&&(e=new Date(e));return Math.floor(e.getTime()/1e3)}(t)}else if(null!==e.match(/^TimeSpan$/gi)){if(!m(t))throw new Error(r+' must be a string in ISO 8601 format. Instead was "'+t+'".');t=t}return t}(o,t,r):null!==o.match(/^ByteArray$/gi)?n=function(e,t){if(null!=t){if(!(t instanceof Uint8Array))throw new Error(e+" must be of type Uint8Array.");t=s(t)}return t}(r,t):null!==o.match(/^Base64Url$/gi)?n=function(e,t){if(null!=t){if(!(t instanceof Uint8Array))throw new Error(e+" must be of type Uint8Array.");t=function(e){if(!e)return;if(e instanceof Uint8Array)return function(e,t){for(var r=e.length;0<=r-1&&e[r-1]===t;)--r;return e.substr(0,r)}(s(e),"=").replace(/\+/g,"-").replace(/\//g,"_");throw new Error("Please provide an input of type Uint8Array for converting to Base64Url.")}(t)}return t}(r,t):null!==o.match(/^Sequence$/gi)?n=function(e,t,r,n){if(!Array.isArray(r))throw new Error(n+" must be of type Array.");var o=t.type.element;if(!o||"object"!=typeof o)throw new Error('element" metadata for an Array must be defined in the mapper and it must of type "object" in '+n+".");for(var i=[],a=0;a<r.length;a++)i[a]=e.serialize(o,r[a],n);return i}(this,e,t,r):null!==o.match(/^Dictionary$/gi)?n=function(e,t,r,n){if("object"!=typeof r)throw new Error(n+" must be of type object.");var o=t.type.value;if(!o||"object"!=typeof o)throw new Error('"value" metadata for a Dictionary must be defined in the mapper and it must of type "object" in '+n+".");for(var i={},a=0,s=Object.keys(r);a<s.length;a++){var u=s[a];i[u]=e.serialize(o,r[u],n+"."+u)}return i}(this,e,t,r):null!==o.match(/^Composite$/gi)&&(n=function(r,e,n,o){var t;j(r,e)&&(e=z(r,e,n,"clientName"));if(null==n)return n;for(var i={},a=M(r,e,o),s=0,u=Object.keys(a);s<u.length;s++){var l=u[s],c=a[l];if(!c.readOnly){var f=void 0,p=i;if(r.isXML)f=c.xmlIsWrapped?c.xmlName:c.xmlElementName||c.xmlName;else{var h=H(c.serializedName);f=h.pop();for(var d=0,y=h;d<y.length;d++){var m=y[d],v=p[m];null==v&&null!=n[l]&&(p[m]={}),p=p[m]}}if(null!=p){var g=""!==c.serializedName?o+"."+c.serializedName:o,b=n[l],E=j(r,e);E&&E.clientName===l&&null==b&&(b=e.serializedName);var w=r.serialize(c,b,g);void 0!==w&&null!=f&&(c.xmlIsAttribute?(p.$=p.$||{},p.$[f]=w):c.xmlIsWrapped?p[f]=((t={})[c.xmlElementName]=w,t):p[f]=w)}}}var R=e.type.additionalProperties;if(R){var _=Object.keys(a),T=function(t){var e=_.every(function(e){return e!==t});e&&(i[t]=r.serialize(R,n[t],o+'["'+t+'"]'))};for(var P in n)T(P)}return i}(this,e,t,r));return n},e.prototype.deserialize=function(e,t,r){if(null==t)return this.isXML&&"Sequence"===e.type.name&&!e.xmlIsWrapped&&(t=[]),t;var n,o,i=e.type.name;return r||(r=e.serializedName),null!==i.match(/^Composite$/gi)?n=function(e,t,r,n){j(e,t)&&(t=z(e,t,r,"serializedName"));for(var o=M(e,t,n),i={},a=[],s=0,u=Object.keys(o);s<u.length;s++){var l=u[s],c=o[l],f=H(o[l].serializedName);a.push(f[0]);var p=c.serializedName,h=c.xmlName,d=c.xmlElementName,y=n;""!==p&&void 0!==p&&(y=n+"."+p);var m=c.headerCollectionPrefix;if(m){for(var v={},g=0,b=Object.keys(r);g<b.length;g++){var E=b[g];E.startsWith(m)&&(v[E.substring(m.length)]=e.deserialize(c.type.value,r[E],y)),a.push(E)}i[l]=v}else if(e.isXML)if(c.xmlIsAttribute&&r.$)i[l]=e.deserialize(c,r.$[h],y);else{var w=d||h||p,R=r[w];if(c.xmlIsWrapped){var _=void 0===(R=(R=r[h])&&R[d]);_&&(R=[])}i[l]=e.deserialize(c,R,y)}else{for(var T=void 0,P=r,S=0,O=f;S<O.length;S++){var x=O[S];if(!P)break;P=P[x]}T=P;var N=t.type.polymorphicDiscriminator;N&&c.serializedName===N.serializedName&&null==T&&(T=t.serializedName);var q=void 0;Array.isArray(r[l])&&""===o[l].serializedName?(T=r[l],i=e.deserialize(c,T,y)):void 0!==T&&(q=e.deserialize(c,T,y),i[l]=q)}}var A=t.type.additionalProperties;if(A){var C=function(e){for(var t in o){var r=H(o[t].serializedName);if(r[0]===e)return!1}return!0};for(var D in r)C(D)&&(i[D]=e.deserialize(A,r[D],n+'["'+D+'"]'))}else if(r)for(var I=0,U=Object.keys(r);I<U.length;I++){var l=U[I];void 0!==i[l]||a.includes(l)||["$","_"].includes(l)||(i[l]=r[l])}return i}(this,e,t,r):(this.isXML&&null!=t.$&&null!=t._&&(t=t._),null!==i.match(/^Number$/gi)?(n=parseFloat(t),isNaN(n)&&(n=t)):null!==i.match(/^Boolean$/gi)?n="true"===t||"false"!==t&&t:null!==i.match(/^(String|Enum|Object|Stream|Uuid|TimeSpan|any)$/gi)?n=t:null!==i.match(/^(Date|DateTime|DateTimeRfc1123)$/gi)?n=new Date(t):null!==i.match(/^UnixTime$/gi)?n=(o=t)?new Date(1e3*o):void 0:null!==i.match(/^ByteArray$/gi)?n=a(t):null!==i.match(/^Base64Url$/gi)?n=function(e){if(!e)return;if(e&&"string"!=typeof e.valueOf())throw new Error("Please provide an input of type string for converting to Uint8Array");return a(e=e.replace(/\-/g,"+").replace(/\_/g,"/"))}(t):null!==i.match(/^Sequence$/gi)?n=function(e,t,r,n){var o=t.type.element;if(!o||"object"!=typeof o)throw new Error('element" metadata for an Array must be defined in the mapper and it must of type "object" in '+n);if(r){Array.isArray(r)||(r=[r]);for(var i=[],a=0;a<r.length;a++)i[a]=e.deserialize(o,r[a],n+"["+a+"]");return i}return r}(this,e,t,r):null!==i.match(/^Dictionary$/gi)&&(n=function(e,t,r,n){var o=t.type.value;if(!o||"object"!=typeof o)throw new Error('"value" metadata for a Dictionary must be defined in the mapper and it must of type "object" in '+n);if(r){for(var i={},a=0,s=Object.keys(r);a<s.length;a++){var u=s[a];i[u]=e.deserialize(o,r[u],n)}return i}return r}(this,e,t,r))),e.isConstant&&(n=e.defaultValue),n},e}();function H(e){var t=[],r="";if(e)for(var n=0,o=e.split(".");n<o.length;n++){var i=o[n];"\\"===i.charAt(i.length-1)?r+=i.substr(0,i.length-1)+".":(r+=i,t.push(r),r="")}return t}function M(e,t,r){var n=t.type.modelProperties;if(!n){var o=t.type.className;if(!o)throw new Error('Class name for model "'+r+'" is not provided in the mapper "'+JSON.stringify(t,void 0,2)+'".');var i=e.modelMappers[o];if(!i)throw new Error('mapper() cannot be null or undefined for model "'+o+'".');if(!(n=i.type.modelProperties))throw new Error('modelProperties cannot be null or undefined in the mapper "'+JSON.stringify(i)+'" of type "'+o+'" for object "'+r+'".')}return n}function z(e,t,r,n){var o=j(e,t);if(o){var i=o[n];if(null!=i){var a=r[i];if(null!=a){var s=t.type.uberParent||t.type.className,u=a===s?a:s+"."+a,l=e.modelMappers.discriminators[u];l&&(t=l)}}}return t}function j(e,t){return t.type.polymorphicDiscriminator||w(e,t.type.uberParent)||w(e,t.type.className)}function w(e,t){return t&&e.modelMappers[t]&&e.modelMappers[t].type.polymorphicDiscriminator}var q=function(e){for(var t={},r=0,n=e;r<n.length;r++){var o=n[r];t[o]=o}return t}(["Base64Url","Boolean","ByteArray","Composite","Date","DateTime","DateTimeRfc1123","Dictionary","Enum","Number","Object","Sequence","String","Stream","TimeSpan","UnixTime"]),A=function(){function t(e,t,r,n,o,i,a,s,u,l,c,f){this.streamResponseBody=i,this.url=e||"",this.method=t||"GET",this.headers=o instanceof p?o:new p(o),this.body=r,this.query=n,this.formData=void 0,this.withCredentials=a||!1,this.abortSignal=s,this.timeout=u||0,this.onUploadProgress=l,this.onDownloadProgress=c,this.proxySettings=f}return t.prototype.validateRequestProperties=function(){if(!this.method)throw new Error("WebResource.method is required.");if(!this.url)throw new Error("WebResource.url is required.")},t.prototype.prepare=function(e){if(!e)throw new Error("options object is required");if(null==e.method||"string"!=typeof e.method.valueOf())throw new Error("options.method must be a string.");if(e.url&&e.pathTemplate)throw new Error("options.url and options.pathTemplate are mutually exclusive. Please provide exactly one of them.");if(!(null!=e.pathTemplate&&"string"==typeof e.pathTemplate.valueOf()||null!=e.url&&"string"==typeof e.url.valueOf()))throw new Error("Please provide exactly one of options.pathTemplate or options.url.");if(e.url){if("string"!=typeof e.url)throw new Error('options.url must be of type "string".');this.url=e.url}if(e.method){var t=["GET","PUT","HEAD","DELETE","OPTIONS","POST","PATCH","TRACE"];if(-1===t.indexOf(e.method.toUpperCase()))throw new Error('The provided method "'+e.method+'" is invalid. Supported HTTP methods are: '+JSON.stringify(t))}if(this.method=e.method.toUpperCase(),e.pathTemplate){var n=e.pathTemplate,o=e.pathParameters;if("string"!=typeof n)throw new Error('options.pathTemplate must be of type "string".');e.baseUrl||(e.baseUrl="https://management.azure.com");var r=e.baseUrl,i=r+(r.endsWith("/")?"":"/")+(n.startsWith("/")?n.slice(1):n),a=i.match(/({\w*\s*\w*})/gi);if(a&&a.length){if(!o)throw new Error("pathTemplate: "+n+" has been provided. Hence, options.pathParameters must also be provided.");a.forEach(function(e){var t=e.slice(1,-1),r=o[t];if(null==r||"string"!=typeof r&&"object"!=typeof r)throw new Error("pathTemplate: "+n+" contains the path parameter "+t+" however, it is not present in "+o+" - "+JSON.stringify(o,void 0,2)+'.The value of the path parameter can either be a "string" of the form { '+t+': "some sample value" } or it can be an "object" of the form { "'+t+'": { value: "some sample value", skipUrlEncoding: true } }.');if("string"==typeof r.valueOf()&&(i=i.replace(e,encodeURIComponent(r))),"object"==typeof r.valueOf()){if(!r.value)throw new Error("options.pathParameters["+t+'] is of type "object" but it does not contain a "value" property.');i=r.skipUrlEncoding?i.replace(e,r.value):i.replace(e,encodeURIComponent(r.value))}})}this.url=i}if(e.queryParameters){var s=e.queryParameters;if("object"!=typeof s)throw new Error('options.queryParameters must be of type object. It should be a JSON object of "query-parameter-name" as the key and the "query-parameter-value" as the value. The "query-parameter-value" may be fo type "string" or an "object" of the form { value: "query-parameter-value", skipUrlEncoding: true }.');this.url&&-1===this.url.indexOf("?")&&(this.url+="?");var u=[];for(var l in this.query={},s){var c=s[l];if(c)if("string"==typeof c)u.push(l+"="+encodeURIComponent(c)),this.query[l]=encodeURIComponent(c);else if("object"==typeof c){if(!c.value)throw new Error("options.queryParameters["+l+'] is of type "object" but it does not contain a "value" property.');c.skipUrlEncoding?(u.push(l+"="+c.value),this.query[l]=c.value):(u.push(l+"="+encodeURIComponent(c.value)),this.query[l]=encodeURIComponent(c.value))}}this.url+=u.join("&")}if(e.headers)for(var f=e.headers,p=0,h=Object.keys(e.headers);p<h.length;p++){var d=h[p];this.headers.set(d,f[d])}return this.headers.get("accept-language")||this.headers.set("accept-language","en-US"),this.headers.get("x-ms-client-request-id")||e.disableClientRequestId||this.headers.set("x-ms-client-request-id",y()),this.headers.get("Content-Type")||this.headers.set("Content-Type","application/json; charset=utf-8"),this.body=e.body,null!=e.body&&(e.bodyIsStream?(this.headers.get("Transfer-Encoding")||this.headers.set("Transfer-Encoding","chunked"),"application/octet-stream"!==this.headers.get("Content-Type")&&this.headers.set("Content-Type","application/octet-stream")):(e.serializationMapper&&(this.body=new E(e.mappers).serialize(e.serializationMapper,e.body,"requestBody")),e.disableJsonStringifyOnBody||(this.body=JSON.stringify(e.body)))),this.abortSignal=e.abortSignal,this.onDownloadProgress=e.onDownloadProgress,this.onUploadProgress=e.onUploadProgress,this},t.prototype.clone=function(){var e=new t(this.url,this.method,this.body,this.query,this.headers&&this.headers.clone(),this.streamResponseBody,this.withCredentials,this.abortSignal,this.timeout,this.onUploadProgress,this.onDownloadProgress);return this.formData&&(e.formData=this.formData),this.operationSpec&&(e.operationSpec=this.operationSpec),this.shouldDeserialize&&(e.shouldDeserialize=this.shouldDeserialize),this.operationResponseGetter&&(e.operationResponseGetter=this.operationResponseGetter),e},t}(),R=function(e,t){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function _(e,t){function r(){this.constructor=e}R(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var T=function(){return(T=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function P(i,a,s,u){return new(s||(s=Promise))(function(e,t){function r(e){try{o(u.next(e))}catch(e){t(e)}}function n(e){try{o(u.throw(e))}catch(e){t(e)}}function o(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(r,n)}o((u=u.apply(i,a||[])).next())})}function S(r,n){var o,i,a,e,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,i&&(a=2&t[0]?i.return:t[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,t[1])).done)return a;switch(i=0,a&&(t=[2&t[0],a.value]),t[0]){case 0:case 1:a=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,i=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){s.label=t[1];break}if(6===t[0]&&s.label<a[1]){s.label=a[1],a=t;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(t);break}a[2]&&s.ops.pop(),s.trys.pop();continue}t=n.call(r,s)}catch(e){t=[6,e],i=0}finally{o=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}var O,x=function(s){function u(e,t,r,n,o,i){var a=s.call(this,e)||this;return a.code=t,a.statusCode=r,a.request=n,a.response=o,a.body=i,Object.setPrototypeOf(a,u.prototype),a}return _(u,s),u.REQUEST_SEND_ERROR="REQUEST_SEND_ERROR",u.REQUEST_ABORTED_ERROR="REQUEST_ABORTED_ERROR",u.PARSE_ERROR="PARSE_ERROR",u}(Error),C=function(){function e(){}return e.prototype.sendRequest=function(r){var n=new XMLHttpRequest;if(r.proxySettings)throw new Error("HTTP proxy is not supported in browser environment");var e=r.abortSignal;if(e){var t=function(){n.abort()};e.addEventListener("abort",t),n.addEventListener("readystatechange",function(){n.readyState===XMLHttpRequest.DONE&&e.removeEventListener("abort",t)})}if(D(n.upload,r.onUploadProgress),D(n,r.onDownloadProgress),r.formData){for(var o=r.formData,i=new FormData,a=function(e,t){t&&t.hasOwnProperty("value")&&t.hasOwnProperty("options")?i.append(e,t.value,t.options):i.append(e,t)},s=0,u=Object.keys(o);s<u.length;s++){var l=u[s],c=o[l];if(Array.isArray(c))for(var f=0;f<c.length;f++)a(l,c[f]);else a(l,c)}r.body=i,r.formData=void 0;var p=r.headers.get("Content-Type");p&&-1!==p.indexOf("multipart/form-data")&&r.headers.remove("Content-Type")}n.open(r.method,r.url),n.timeout=r.timeout,n.withCredentials=r.withCredentials;for(var h=0,d=r.headers.headersArray();h<d.length;h++){var y=d[h];n.setRequestHeader(y.name,y.value)}return n.responseType=r.streamResponseBody?"blob":"text",n.send(void 0===r.body?null:r.body),r.streamResponseBody?new Promise(function(t,e){n.addEventListener("readystatechange",function(){if(n.readyState===XMLHttpRequest.HEADERS_RECEIVED){var e=new Promise(function(e,t){n.addEventListener("load",function(){e(n.response)}),U(r,n,t)});t({request:r,status:n.status,headers:I(n),blobBody:e})}}),U(r,n,e)}):new Promise(function(e,t){n.addEventListener("load",function(){return e({request:r,status:n.status,headers:I(n),bodyAsText:n.responseText})}),U(r,n,t)})},e}();function D(e,t){t&&e.addEventListener("progress",function(e){return t({loadedBytes:e.loaded})})}function I(e){for(var t=new p,r=0,n=e.getAllResponseHeaders().trim().split(/[\r\n]+/);r<n.length;r++){var o=n[r],i=o.indexOf(":"),a=o.slice(0,i),s=o.slice(i+2);t.set(a,s)}return t}function U(e,t,r){t.addEventListener("error",function(){return r(new x("Failed to send request to "+e.url,x.REQUEST_SEND_ERROR,void 0,e))}),t.addEventListener("abort",function(){return r(new x("The request was aborted",x.REQUEST_ABORTED_ERROR,void 0,e))}),t.addEventListener("timeout",function(){return r(new x("timeout of "+t.timeout+"ms exceeded",x.REQUEST_SEND_ERROR,void 0,e))})}function L(e){return k(e.parameterPath,e.mapper)}function k(e,t){return"string"==typeof e?e:Array.isArray(e)?e.join("."):t.serializedName}function B(e){var t=!1;for(var r in e.responses){var n=e.responses[r];if(n.bodyMapper&&n.bodyMapper.type.name===q.Stream){t=!0;break}}return t}(O=N.HttpPipelineLogLevel||(N.HttpPipelineLogLevel={}))[O.OFF=0]="OFF",O[O.ERROR=1]="ERROR",O[O.WARNING=2]="WARNING",O[O.INFO=3]="INFO";var F=new DOMParser;function $(e){try{var t=F.parseFromString(e,"application/xml");!function(e){if(Q){var t=e.getElementsByTagNameNS(Q,"parsererror");if(t.length)throw new Error(t.item(0).innerHTML)}}(t);var r=function e(t){var r={};var n=t.childNodes.length;var o=t.childNodes[0];var i=o&&1===n&&o.nodeType===Node.TEXT_NODE&&o.nodeValue||void 0;var a=(u=t,s=u,s.attributes&&u.hasAttributes()?u:void 0);var s;var u;if(a){r.$={};for(var l=0;l<a.attributes.length;l++){var c=a.attributes[l];r.$[c.nodeName]=c.nodeValue}i&&(r._=i)}else 0===n?r="":i&&(r=i);if(!i)for(var l=0;l<n;l++){var f=t.childNodes[l];if(f.nodeType!==Node.TEXT_NODE){var p=e(f);r[f.nodeName]?Array.isArray(r[f.nodeName])?r[f.nodeName].push(p):r[f.nodeName]=[r[f.nodeName],p]:r[f.nodeName]=p}}return r}(t.childNodes[0]);return Promise.resolve(r)}catch(e){return Promise.reject(e)}}var Q="";try{Q=F.parseFromString("INVALID","text/xml").getElementsByTagName("parsererror")[0].namespaceURI}catch(e){}var V=document.implementation.createDocument(null,null,null),Y=new XMLSerializer;function X(e,t){var r=function e(t,r){{if("string"==typeof t||"number"==typeof t||"boolean"==typeof t){var n=V.createElement(r);return n.textContent=t.toString(),[n]}if(Array.isArray(t)){for(var o=[],i=0,a=t;i<a.length;i++)for(var s=a[i],u=0,l=e(s,r);u<l.length;u++){var c=l[u];o.push(c)}return o}if("object"!=typeof t)throw new Error("Illegal value passed to buildObject: "+t);for(var n=V.createElement(r),f=0,p=Object.keys(t);f<p.length;f++){var h=p[f];if("$"===h)for(var d=0,y=W(t[h]);d<y.length;d++){var m=y[d];n.attributes.setNamedItem(m)}else for(var v=0,g=e(t[h],h);v<g.length;v++){var c=g[v];n.appendChild(c)}}return[n]}}(e,t&&t.rootName||"root")[0];return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+Y.serializeToString(r)}function W(e){for(var t=[],r=0,n=Object.keys(e);r<n.length;r++){var o=n[r],i=V.createAttribute(o);i.value=e[o].toString(),t.push(i)}return t}var J=function(){function e(e,t){this._nextPolicy=e,this._options=t}return e.prototype.shouldLog=function(e){return this._options.shouldLog(e)},e.prototype.log=function(e,t){this._options.log(e,t)},e}(),G=function(){function e(e){this._logger=e}return e.prototype.shouldLog=function(e){return!!this._logger&&e!==N.HttpPipelineLogLevel.OFF&&e<=this._logger.minimumLogLevel},e.prototype.log=function(e,t){this._logger&&this.shouldLog(e)&&this._logger.log(e,t)},e}();function K(r){return{create:function(e,t){return new te(e,r,t)}}}var Z=["application/json","text/json"],ee=["application/xml","application/atom+xml"],te=function(o){function e(e,t,r){var n=o.call(this,e,r)||this;return n.jsonContentTypes=t&&t.json||Z,n.xmlContentTypes=t&&t.xml||ee,n}return _(e,o),e.prototype.sendRequest=function(r){return P(this,void 0,void 0,function(){var t=this;return S(this,function(e){return[2,this._nextPolicy.sendRequest(r).then(function(e){return re(t.jsonContentTypes,t.xmlContentTypes,e)})]})})},e}(J);function re(e,t,m){return function(t,r,o){var e=function(e){var t='Error "'+e+'" occurred while parsing the response body - '+o.bodyAsText+".",r=e.code||x.PARSE_ERROR,n=new x(t,r,o.status,o.request,o,o.bodyAsText);return Promise.reject(n)};if(!o.request.streamResponseBody&&o.bodyAsText){var n=o.bodyAsText,i=o.headers.get("Content-Type")||"",a=i?i.split(";").map(function(e){return e.toLowerCase()}):[];if(0===a.length||a.some(function(e){return-1!==t.indexOf(e)}))return new Promise(function(e){o.parsedBody=JSON.parse(n),e(o)}).catch(e);if(a.some(function(e){return-1!==r.indexOf(e)}))return $(n).then(function(e){return o.parsedBody=e,o}).catch(e)}return Promise.resolve(o)}(e,t,m).then(function(t){var e,r;if(void 0===(r=(e=t).request.shouldDeserialize)||("boolean"==typeof r?r:r(e))){var n=t.request.operationSpec;if(n&&n.responses){var o=t.status,i=Object.keys(n.responses),a=0===i.length||1===i.length&&"default"===i[0],s=function(e){var t,r=e.request,n=r.operationSpec;if(n){var o=r.operationResponseGetter;t=o?o(n,e):n.responses[e.status]}return t}(t);if(a?200<=o&&o<300:!!s){if(s){if(s.bodyMapper){y=t.parsedBody;n.isXML&&s.bodyMapper.type.name===q.Sequence&&(y="object"==typeof y?y[s.bodyMapper.xmlElementName]:[]);try{t.parsedBody=n.serializer.deserialize(s.bodyMapper,y,"operationRes.parsedBody")}catch(f){var u=new x("Error "+f+" occurred in deserializing the responseBody - "+t.bodyAsText);return u.request=g(t.request),u.response=v(t),Promise.reject(u)}}else"HEAD"===n.httpMethod&&(t.parsedBody=200<=m.status&&m.status<300);s.headersMapper&&(t.parsedHeaders=n.serializer.deserialize(s.headersMapper,t.headers.rawHeaders(),"operationRes.parsedHeaders"))}}else{var l=n.responses.default;if(l){var c=B(n)?"Unexpected status code: "+o:t.bodyAsText,f=new x(c);f.statusCode=o,f.request=g(t.request),f.response=v(t);var p=t.parsedBody;try{if(p){var h=l.bodyMapper;if(h&&"CloudError"===h.serializedName)p.error&&(p=p.error),p.code&&(f.code=p.code),p.message&&(f.message=p.message);else{var d=p;p.error&&(d=p.error),f.code=d.code,d.message&&(f.message=d.message)}if(h){var y=p;n.isXML&&h.type.name===q.Sequence&&(y="object"==typeof p?p[h.xmlElementName]:[]),f.body=n.serializer.deserialize(h,y,"error.body")}}}catch(e){f.message='Error "'+e.message+'" occurred in deserializing the responseBody - "'+t.bodyAsText+'" for the default response.'}return Promise.reject(f)}}}}return Promise.resolve(t)})}function ne(r,n,o,i){return{create:function(e,t){return new oe(e,t,r,n,o,i)}}}var oe=function(u){function e(e,t,r,n,o,i){var a=u.call(this,e,t)||this;function s(e){return"number"==typeof e}return a.retryCount=s(r)?r:3,a.retryInterval=s(n)?n:3e4,a.minRetryInterval=s(o)?o:3e3,a.maxRetryInterval=s(i)?i:9e4,a}return _(e,u),e.prototype.sendRequest=function(t){var r=this;return this._nextPolicy.sendRequest(t.clone()).then(function(e){return ie(r,t,e)}).catch(function(e){return ie(r,t,e.response,void 0,e)})},e}(J);function ie(t,r,n,o,e){o=function(e,t,r){t||(t={retryCount:0,retryInterval:0}),r&&(t.error&&(r.innerError=t.error),t.error=r),t.retryCount++;var n=Math.pow(2,t.retryCount)-1;return n*=.8*e.retryInterval+Math.floor(Math.random()*(1.2*e.retryInterval-.8*e.retryInterval)),t.retryInterval=Math.min(e.minRetryInterval+n,e.maxRetryInterval),t}(t,o,e);var i=r.abortSignal&&r.abortSignal.aborted;if(!i&&function(e,t,r){if(null==t||t<500&&408!==t||501===t||505===t)return!1;if(!r)throw new Error("retryData for the ExponentialRetryPolicyFilter cannot be null.");return(r&&r.retryCount)<e.retryCount}(t,n&&n.status,o))return h(o.retryInterval).then(function(){return t._nextPolicy.sendRequest(r.clone())}).then(function(e){return ie(t,r,e,o,void 0)}).catch(function(e){return ie(t,r,n,o,e)});if(i||e||!n){var a=o.error||new x("Failed to send the request.",x.REQUEST_SEND_ERROR,n&&n.status,n&&n.request,n);return Promise.reject(a)}return Promise.resolve(n)}var ae=function(o){function e(e,t,r){var n=o.call(this,e,t)||this;return n._requestIdHeaderName=r,n}return _(e,o),e.prototype.sendRequest=function(e){return e.headers.contains(this._requestIdHeaderName)||e.headers.set(this._requestIdHeaderName,y()),this._nextPolicy.sendRequest(e)},e}(J);function se(){var e,t,r,n,o=[{key:"ms-rest-js",value:c.msRestVersion}],i=[{key:"OS",value:((e=window.navigator).oscpu||e.platform).replace(" ","")}];return t=o.concat(i),void 0===r&&(r=" "),void 0===n&&(n="/"),t.map(function(e){var t=e.value?""+n+e.value:"";return""+e.key+t}).join(r)}function ue(e){var r=e&&null!=e.key?e.key:"x-ms-command-name",n=e&&null!=e.value?e.value:se();return{create:function(e,t){return new le(e,t,r,n)}}}var le=function(i){function e(e,t,r,n){var o=i.call(this,e,t)||this;return o._nextPolicy=e,o._options=t,o.headerKey=r,o.headerValue=n,o}return _(e,i),e.prototype.sendRequest=function(e){return this.addUserAgentHeader(e),this._nextPolicy.sendRequest(e)},e.prototype.addUserAgentHeader=function(e){e.headers||(e.headers=new p),!e.headers.get(this.headerKey)&&this.headerValue&&e.headers.set(this.headerKey,this.headerValue)},e}(J),ce=function(){function s(){this._rawQuery={}}return s.prototype.any=function(){return 0<Object.keys(this._rawQuery).length},s.prototype.set=function(e,t){if(e)if(null!=t){var r=Array.isArray(t)?t:t.toString();this._rawQuery[e]=r}else delete this._rawQuery[e]},s.prototype.get=function(e){return e?this._rawQuery[e]:void 0},s.prototype.toString=function(){var e="";for(var t in this._rawQuery){e&&(e+="&");var r=this._rawQuery[t];if(Array.isArray(r)){for(var n=[],o=0,i=r;o<i.length;o++){var a=i[o];n.push(t+"="+a)}e+=n.join("&")}else e+=t+"="+r}return e},s.parse=function(e){var t=new s;if(e){e.startsWith("?")&&(e=e.substring(1));for(var r="ParameterName",n="",o="",i=0;i<e.length;++i){var a=e[i];switch(r){case"ParameterName":switch(a){case"=":r="ParameterValue";break;case"&":o=n="";break;default:n+=a}break;case"ParameterValue":switch(a){case"=":o=n="",r="Invalid";break;case"&":t.set(n,o),o=n="",r="ParameterName";break;default:o+=a}break;case"Invalid":"&"===a&&(r="ParameterName");break;default:throw new Error("Unrecognized URLQuery parse state: "+r)}}"ParameterValue"===r&&t.set(n,o)}return t},s}(),fe=function(){function r(){}return r.prototype.setScheme=function(e){e?this.set(e,"SCHEME"):this._scheme=void 0},r.prototype.getScheme=function(){return this._scheme},r.prototype.setHost=function(e){e?this.set(e,"SCHEME_OR_HOST"):this._host=void 0},r.prototype.getHost=function(){return this._host},r.prototype.setPort=function(e){null==e||""===e?this._port=void 0:this.set(e.toString(),"PORT")},r.prototype.getPort=function(){return this._port},r.prototype.setPath=function(e){e?-1!==e.indexOf("://")?this.set(e,"SCHEME"):this.set(e,"PATH"):this._path=void 0},r.prototype.appendPath=function(e){if(e){var t=this.getPath();t&&(t.endsWith("/")||(t+="/"),e.startsWith("/")&&(e=e.substring(1)),e=t+e),this.set(e,"PATH")}},r.prototype.getPath=function(){return this._path},r.prototype.setQuery=function(e){this._query=e?ce.parse(e):void 0},r.prototype.setQueryParameter=function(e,t){e&&(this._query||(this._query=new ce),this._query.set(e,t))},r.prototype.getQueryParameterValue=function(e){return this._query?this._query.get(e):void 0},r.prototype.getQuery=function(){return this._query?this._query.toString():void 0},r.prototype.set=function(e,t){for(var r=new he(e,t);r.next();){var n=r.current();if(n)switch(n.type){case"SCHEME":this._scheme=n.text||void 0;break;case"HOST":this._host=n.text||void 0;break;case"PORT":this._port=n.text||void 0;break;case"PATH":var o=n.text||void 0;this._path&&"/"!==this._path&&"/"===o||(this._path=o);break;case"QUERY":this._query=ce.parse(n.text);break;default:throw new Error("Unrecognized URLTokenType: "+n.type)}}},r.prototype.toString=function(){var e="";return this._scheme&&(e+=this._scheme+"://"),this._host&&(e+=this._host),this._port&&(e+=":"+this._port),this._path&&(this._path.startsWith("/")||(e+="/"),e+=this._path),this._query&&this._query.any()&&(e+="?"+this._query.toString()),e},r.prototype.replaceAll=function(e,t){e&&(this.setScheme(b(this.getScheme(),e,t)),this.setHost(b(this.getHost(),e,t)),this.setPort(b(this.getPort(),e,t)),this.setPath(b(this.getPath(),e,t)),this.setQuery(b(this.getQuery(),e,t)))},r.parse=function(e){var t=new r;return t.set(e,"SCHEME_OR_HOST"),t},r}(),pe=function(){function t(e,t){this.text=e,this.type=t}return t.scheme=function(e){return new t(e,"SCHEME")},t.host=function(e){return new t(e,"HOST")},t.port=function(e){return new t(e,"PORT")},t.path=function(e){return new t(e,"PATH")},t.query=function(e){return new t(e,"QUERY")},t}();var he=function(){function e(e,t){this._text=e,this._textLength=e?e.length:0,this._currentState=null!=t?t:"SCHEME_OR_HOST",this._currentIndex=0}return e.prototype.current=function(){return this._currentToken},e.prototype.next=function(){if(de(this))switch(this._currentState){case"SCHEME":i=ge(o=this,function(e){return 48<=(t=e.charCodeAt(0))&&t<=57||65<=t&&t<=90||97<=t&&t<=122;var t}),o._currentToken=pe.scheme(i),de(o)?o._currentState="HOST":o._currentState="DONE";break;case"SCHEME_OR_HOST":n=be(r=this,":","/","?"),de(r)?":"===ye(r)?"://"===ve(r,3)?(r._currentToken=pe.scheme(n),r._currentState="HOST"):(r._currentToken=pe.host(n),r._currentState="PORT"):(r._currentToken=pe.host(n),"/"===ye(r)?r._currentState="PATH":r._currentState="QUERY"):(r._currentToken=pe.host(n),r._currentState="DONE");break;case"HOST":!function(e){"://"===ve(e,3)&&me(e,3);var t=be(e,":","/","?");e._currentToken=pe.host(t),de(e)?":"===ye(e)?e._currentState="PORT":"/"===ye(e)?e._currentState="PATH":e._currentState="QUERY":e._currentState="DONE"}(this);break;case"PORT":!function(e){":"===ye(e)&&me(e);var t=be(e,"/","?");e._currentToken=pe.port(t),de(e)?"/"===ye(e)?e._currentState="PATH":e._currentState="QUERY":e._currentState="DONE"}(this);break;case"PATH":t=be(e=this,"?"),e._currentToken=pe.path(t),de(e)?e._currentState="QUERY":e._currentState="DONE";break;case"QUERY":!function(e){"?"===ye(e)&&me(e);var t=function(e){var t="";e._currentIndex<e._textLength&&(t=e._text.substring(e._currentIndex),e._currentIndex=e._textLength);return t}(e);e._currentToken=pe.query(t),e._currentState="DONE"}(this);break;default:throw new Error("Unrecognized URLTokenizerState: "+this._currentState)}else this._currentToken=void 0;var e,t,r,n,o,i;return!!this._currentToken},e}();function de(e){return e._currentIndex<e._textLength}function ye(e){return e._text[e._currentIndex]}function me(e,t){de(e)&&(t||(t=1),e._currentIndex+=t)}function ve(e,t){var r=e._currentIndex+t;return e._textLength<r&&(r=e._textLength),e._text.substring(e._currentIndex,r)}function ge(e,t){for(var r="";de(e);){var n=ye(e);if(!t(n))break;r+=n,me(e)}return r}function be(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return ge(e,function(e){return-1===t.indexOf(e)})}function Ee(r){return void 0===r&&(r=20),{create:function(e,t){return new we(e,t,r)}}}var we=function(o){function e(e,t,r){void 0===r&&(r=20);var n=o.call(this,e,t)||this;return n.maxRetries=r,n}return _(e,o),e.prototype.sendRequest=function(e){var t=this;return this._nextPolicy.sendRequest(e).then(function(e){return function t(r,e,n){var o=e.request,i=e.status;var a=e.headers.get("location");if(a&&(300===i||307===i||303===i&&"POST"===o.method)&&(!r.maxRetries||n<r.maxRetries)){var s=fe.parse(o.url);return s.setPath(a),o.url=s.toString(),303===i&&(o.method="GET"),r._nextPolicy.sendRequest(o).then(function(e){return t(r,e,n+1)})}return Promise.resolve(e)}(t,e,0)})},e}(J);var Re=function(o){function e(e,t,r){void 0===r&&(r=30);var n=o.call(this,e,t)||this;return n._retryTimeout=r,n}return _(e,o),e.prototype.sendRequest=function(t){var r=this;return this._nextPolicy.sendRequest(t.clone()).then(function(e){return function(t,r,n){if(409===n.status){var e=function(e){var t,r;if(e){try{r=JSON.parse(e)}catch(e){}if(r&&r.error&&r.error.message&&r.error.code&&"MissingSubscriptionRegistration"===r.error.code){var n=r.error.message.match(/.*'(.*)'/i);n&&(t=n.pop())}}return t}(n.bodyAsText);if(e){var o=function(e){var t,r=e.match(/.*\/subscriptions\/[a-f0-9-]+\//gi);{if(!r||!r[0])throw new Error("Unable to extract subscriptionId from the given url - "+e+".");t=r[0]}return t}(r.url);return(i=t,a=o,s=e,u=r,l=a+"providers/"+s+"/register?api-version=2016-02-01",c=a+"providers/"+s+"?api-version=2016-02-01",f=_e(u),f.method="POST",f.url=l,i._nextPolicy.sendRequest(f).then(function(e){if(200!==e.status)throw new Error("Autoregistration of "+s+" failed. Please try registering manually.");return function r(n,o,i){var e=_e(i);return e.url=o,e.method="GET",n._nextPolicy.sendRequest(e).then(function(e){var t=e.parsedBody;return!(!e.parsedBody||!t.registrationState||"Registered"!==t.registrationState)||h(1e3*n._retryTimeout).then(function(){return r(n,o,i)})})}(i,c,u)})).catch(function(){return!1}).then(function(e){return e?(r.headers.set("x-ms-client-request-id",y()),t._nextPolicy.sendRequest(r.clone())):n})}}var i,a,s,u,l,c,f;return Promise.resolve(n)}(r,t,e)})},e}(J);function _e(e,t){void 0===t&&(t=!1);var r={headers:{}};for(var n in t&&(r.url=e.url),e.headers)r.headers.set(n,e.headers.get(n));return r.headers["x-ms-client-request-id"]=y(),r.headers["Content-Type"]="application/json; charset=utf-8",r}function Te(r){return{create:function(e,t){return new Pe(e,t,r)}}}var Pe=function(o){function e(e,t,r){var n=o.call(this,e,t)||this;return n.authenticationProvider=r,n}return _(e,o),e.prototype.signRequest=function(e){return this.authenticationProvider.signRequest(e)},e.prototype.sendRequest=function(e){var t=this;return this.signRequest(e).then(function(e){return t._nextPolicy.sendRequest(e)})},e}(J);function Se(r,n,o,i){return{create:function(e,t){return new xe(e,t,r,n,o,i)}}}var Oe,xe=function(s){function e(e,t,r,n,o,i){var a=s.call(this,e,t)||this;return a.DEFAULT_CLIENT_RETRY_INTERVAL=3e4,a.DEFAULT_CLIENT_RETRY_COUNT=3,a.DEFAULT_CLIENT_MAX_RETRY_INTERVAL=9e4,a.DEFAULT_CLIENT_MIN_RETRY_INTERVAL=3e3,a.retryCount="number"==typeof r?r:a.DEFAULT_CLIENT_RETRY_COUNT,a.retryInterval="number"==typeof n?n:a.DEFAULT_CLIENT_RETRY_INTERVAL,a.minRetryInterval="number"==typeof o?o:a.DEFAULT_CLIENT_MIN_RETRY_INTERVAL,a.maxRetryInterval="number"==typeof i?i:a.DEFAULT_CLIENT_MAX_RETRY_INTERVAL,a}return _(e,s),e.prototype.sendRequest=function(t){var r=this;return this._nextPolicy.sendRequest(t.clone()).then(function(e){return function t(r,n,o,i,a){i=qe(r,i,a);return a&&a.code&&Ne(r,i)&&("ETIMEDOUT"===a.code||"ESOCKETTIMEDOUT"===a.code||"ECONNREFUSED"===a.code||"ECONNRESET"===a.code||"ENOENT"===a.code)?h(i.retryInterval).then(function(){return r._nextPolicy.sendRequest(n.clone())}).then(function(e){return t(r,n,e,i,a)}).catch(function(e){return t(r,n,o,i,e)}):null!=a?(a=i.error,Promise.reject(a)):Promise.resolve(o)}(r,t,e)})},e}(J);function Ne(e,t){if(!t)throw new Error("retryData for the SystemErrorRetryPolicyFilter cannot be null.");return(t&&t.retryCount)<e.retryCount}function qe(e,t,r){t||(t={retryCount:0,retryInterval:0}),r&&(t.error&&(r.innerError=t.error),t.error=r),t.retryCount++;var n=Math.pow(2,t.retryCount)-1;return n*=.8*e.retryInterval+Math.floor(Math.random()*(1.2*e.retryInterval-.8*e.retryInterval)),t.retryInterval=Math.min(e.minRetryInterval+n,e.maxRetryInterval),t}(Oe=N.QueryCollectionFormat||(N.QueryCollectionFormat={})).Csv=",",Oe.Ssv=" ",Oe.Tsv="\t",Oe.Pipes="|",Oe.Multi="Multi";var Ae=new Error("ProxyPolicy is not supported in browser environment");!function(r){function e(e,t){r.call(this,e,t);throw Ae}_(e,r),e.prototype.sendRequest=function(e){throw Ae}}(J);var Ce=c.HttpConstants.StatusCodes;var De=function(o){function a(e,t,r){var n=o.call(this,e,t)||this;return n._handleResponse=r||n._defaultResponseHandler,n}return _(a,o),a.prototype.sendRequest=function(r){return P(this,void 0,void 0,function(){var t=this;return S(this,function(e){return[2,this._nextPolicy.sendRequest(r.clone()).then(function(e){return e.status!==Ce.TooManyRequests?e:t._handleResponse(r,e)})]})})},a.prototype._defaultResponseHandler=function(o,i){return P(this,void 0,void 0,function(){var t,r,n=this;return S(this,function(e){return(t=i.headers.get(c.HeaderConstants.RETRY_AFTER))&&(r=a.parseRetryAfterHeader(t))?[2,delay(r).then(function(e){return n._nextPolicy.sendRequest(o)})]:[2,i]})})},a.parseRetryAfterHeader=function(e){var t=Number(e);return Number.isNaN(t)?a.parseDateRetryAfterHeader(e):1e3*t},a.parseDateRetryAfterHeader=function(e){try{var t=Date.now(),r=Date.parse(e)-t;return Number.isNaN(r)?void 0:r}catch(e){return}},a}(J),Ie=function(){function e(e,t){if(t||(t={}),e&&!e.signRequest)throw new Error("credentials argument needs to implement signRequest method");var r;if(this._withCredentials=t.withCredentials||!1,this._httpClient=t.httpClient||new C,this._requestPolicyOptions=new G(t.httpPipelineLogger),Array.isArray(t.requestPolicyFactories))r=t.requestPolicyFactories;else if(r=function(e,t){var r,n=[];t.generateClientRequestIdHeader&&n.push((void 0===(o=t.clientRequestIdHeaderName)&&(o="x-ms-client-request-id"),{create:function(e,t){return new ae(e,t,o)}}));var o;e&&("function"==typeof e.create?n.push(e):n.push(Te(e)));"string"==typeof t.userAgent?r=t.userAgent:(r=se(),"function"==typeof t.userAgent&&(r=t.userAgent(r)));n.push(ue({value:r})),n.push(Ee()),n.push((i=t.rpRegistrationRetryTimeout,void 0===i&&(i=30),{create:function(e,t){return new Re(e,t,i)}})),t.noRetryPolicy||(n.push(ne()),n.push(Se()),n.push({create:function(e,t){return new De(e,t)}}));var i;n.push(K(t.deserializationContentTypes));var a=t.proxySettings||void 0;a&&n.push({create:function(e,t){throw Ae}});return n}(e,t),t.requestPolicyFactories){var n=t.requestPolicyFactories(r);n&&(r=n)}this._requestPolicyFactories=r}return e.prototype.sendRequest=function(e){if(null==e||"object"!=typeof e)throw new Error("options cannot be null or undefined and it must be of type object.");var t;try{t=e instanceof A?(e.validateRequestProperties(),e):(t=new A).prepare(e)}catch(e){return Promise.reject(e)}var r=this._httpClient;if(this._requestPolicyFactories&&0<this._requestPolicyFactories.length)for(var n=this._requestPolicyFactories.length-1;0<=n;--n)r=this._requestPolicyFactories[n].create(r,this._requestPolicyOptions);return r.sendRequest(t)},e.prototype.sendOperationRequest=function(e,t,r){"function"==typeof e.options&&(r=e.options,e.options=void 0);var n,o=new A;try{var i=t.baseUrl||this.baseUri;if(!i)throw new Error("If operationSpec.baseUrl is not specified, then the ServiceClient must have a baseUri string property that contains the base URL to use.");o.method=t.httpMethod,o.operationSpec=t;var a=fe.parse(i);if(t.path&&a.appendPath(t.path),t.urlParameters&&0<t.urlParameters.length)for(var s=0,u=t.urlParameters;s<u.length;s++){var l=u[s],c=Ue(this,e,l,t.serializer);c=t.serializer.serialize(l.mapper,c,L(l)),l.skipEncoding||(c=encodeURIComponent(c)),a.replaceAll("{"+(l.mapper.serializedName||L(l))+"}",c)}if(t.queryParameters&&0<t.queryParameters.length)for(var f=0,p=t.queryParameters;f<p.length;f++){var h=p[f],d=Ue(this,e,h,t.serializer);if(null!=d){if(d=t.serializer.serialize(h.mapper,d,L(h)),null!=h.collectionFormat)if(h.collectionFormat===N.QueryCollectionFormat.Multi)if(0===d.length)d="";else for(var y in d){var m=d[y];d[y]=null==m?"":m.toString()}else d=d.join(h.collectionFormat);if(!h.skipEncoding)if(Array.isArray(d))for(var y in d)d[y]=encodeURIComponent(d[y]);else d=encodeURIComponent(d);a.setQueryParameter(h.mapper.serializedName||L(h),d)}}o.url=a.toString();var v=t.contentType||this.requestContentType;if(v&&o.headers.set("Content-Type",v),t.headerParameters)for(var g=0,b=t.headerParameters;g<b.length;g++){var E=b[g],w=Ue(this,e,E,t.serializer);if(null!=w){w=t.serializer.serialize(E.mapper,w,L(E));var R=E.mapper.headerCollectionPrefix;if(R)for(var _=0,T=Object.keys(w);_<T.length;_++){var P=T[_];o.headers.set(R+P,w[P])}else o.headers.set(E.mapper.serializedName||L(E),w)}}var S=e.options;if(S){if(S.customHeaders)for(var O in S.customHeaders)o.headers.set(O,S.customHeaders[O]);S.abortSignal&&(o.abortSignal=S.abortSignal),S.timeout&&(o.timeout=S.timeout),S.onUploadProgress&&(o.onUploadProgress=S.onUploadProgress),S.onDownloadProgress&&(o.onDownloadProgress=S.onDownloadProgress)}o.withCredentials=this._withCredentials,function(e,t,r,n){if(n.requestBody&&n.requestBody.mapper){t.body=Ue(e,r,n.requestBody,n.serializer);var o=n.requestBody.mapper,i=o.required,a=o.xmlName,s=o.xmlElementName,u=o.serializedName,l=o.type.name;try{if(null!=t.body||i){var c=L(n.requestBody);t.body=n.serializer.serialize(o,t.body,c);var f=l===q.Stream;n.isXML?l===q.Sequence?t.body=X((v=t.body,g=s||a||u,Array.isArray(v)||(v=[v]),(b={})[g]=v,b),{rootName:a||u}):f||(t.body=X(t.body,{rootName:a||u})):f||(t.body=JSON.stringify(t.body))}}catch(e){throw new Error('Error "'+e.message+'" occurred in serializing the payload - '+JSON.stringify(u,void 0," ")+".")}}else if(n.formDataParameters&&0<n.formDataParameters.length){t.formData={};for(var p=0,h=n.formDataParameters;p<h.length;p++){var d=h[p],y=Ue(e,r,d,n.serializer);if(null!=y){var m=d.mapper.serializedName||L(d);t.formData[m]=n.serializer.serialize(d.mapper,y,L(d))}}}var v,g,b}(this,o,e,t),null==o.streamResponseBody&&(o.streamResponseBody=B(t)),n=this.sendRequest(o).then(function(e){return Me(e,t.responses[e.status])})}catch(e){n=Promise.reject(e)}var x=r;return x&&n.then(function(e){return x(null,e._response.parsedBody,e._response.request,e._response)}).catch(function(e){return x(e)}),n},e}();function Ue(e,t,r,n){return function e(t,r,n,o,i){var a;"string"==typeof n&&(n=[n]);if(Array.isArray(n)){if(0<n.length){if(o.isConstant)a=o.defaultValue;else{var s=He(r,n);s.propertyFound||(s=He(t,n));var u=!1;s.propertyFound||(u=o.required||"options"===n[0]&&2===n.length),a=u?o.defaultValue:s.propertyValue}var l=k(n,o);i.serialize(o,a,l)}}else for(var c in n){var f=o.type.modelProperties[c],p=n[c],h=e(t,r,p,f,i),d=k(p,f);i.serialize(f,h,d),void 0!==h&&(a||(a={}),a[c]=h)}return a}(e,t,r.parameterPath,r.mapper,n)}function He(e,t){for(var r={propertyFound:!1},n=0;n<t.length;++n){var o=t[n];if(!(null!=e&&o in e))break;e=e[o]}return n===t.length&&(r.propertyValue=e,r.propertyFound=!0),r}function Me(t,e){var r=t.parsedHeaders,n=e&&e.bodyMapper,o=function(e){return Object.defineProperty(e,"_response",{value:t})};if(n){var i=n.type.name;if("Stream"===i)return o(T({},r,{blobBody:t.blobBody,readableStreamBody:t.readableStreamBody}));var a="Composite"===i&&n.type.modelProperties||{},s=Object.keys(a).some(function(e){return""===a[e].serializedName});if("Sequence"===i||s){for(var u=(t.parsedBody||[]).slice(),l=0,c=Object.keys(a);l<c.length;l++){var f=c[l];a[f].serializedName&&(u[f]=t.parsedBody[f])}if(r)for(var p=0,h=Object.keys(r);p<h.length;p++){u[f=h[p]]=r[f]}return o(u),u}if("Composite"===i||"Dictionary"===i)return o(T({},r,t.parsedBody))}return n||"HEAD"===t.request.method?o(T({},r,{body:t.parsedBody})):o(T({},r,t.parsedBody))}var ze=function(o){function e(e,t,r){void 0===r&&(r=console.log);var n=o.call(this,e,t)||this;return n.logger=r,n}return _(e,o),e.prototype.sendRequest=function(e){var t=this;return this._nextPolicy.sendRequest(e).then(function(e){return function(e,t){e.logger(">> Request: "+JSON.stringify(t.request,void 0,2)),e.logger(">> Response status code: "+t.status);var r=t.bodyAsText;return e.logger(">> Body: "+r),Promise.resolve(t)}(t,e)})},e}(J);var je=c.HeaderConstants,Le=function(){function e(e,t){if(void 0===t&&(t="Bearer"),this.authorizationScheme="Bearer",!e)throw new Error("token cannot be null or undefined.");this.token=e,this.authorizationScheme=t}return e.prototype.signRequest=function(e){return e.headers||(e.headers=new p),e.headers.set(je.AUTHORIZATION,this.authorizationScheme+" "+this.token),Promise.resolve(e)},e}(),ke=c.HeaderConstants,Be=function(){function e(e,t,r){if(void 0===r&&(r="Basic"),this.authorizationScheme="Basic",null==e||"string"!=typeof e.valueOf())throw new Error("userName cannot be null or undefined and must be of type string.");if(null==t||"string"!=typeof t.valueOf())throw new Error("password cannot be null or undefined and must be of type string.");this.userName=e,this.password=t,this.authorizationScheme=r}return e.prototype.signRequest=function(e){var t=this.userName+":"+this.password,r=this.authorizationScheme+" "+btoa(t);return e.headers||(e.headers=new p),e.headers.set(ke.AUTHORIZATION,r),Promise.resolve(e)},e}(),Fe=function(){function e(e){if(!e||e&&!e.inHeader&&!e.inQuery)throw new Error('options cannot be null or undefined. Either "inHeader" or "inQuery" property of the options object needs to be provided.');this.inHeader=e.inHeader,this.inQuery=e.inQuery}return e.prototype.signRequest=function(e){if(!e)return Promise.reject(new Error('webResource cannot be null or undefined and must be of type "object".'));if(this.inHeader)for(var t in e.headers||(e.headers=new p),this.inHeader)e.headers.set(t,this.inHeader[t]);if(this.inQuery){if(!e.url)return Promise.reject(new Error("url cannot be null in the request object."));for(var r in e.url.indexOf("?")<0&&(e.url+="?"),this.inQuery)e.url.endsWith("?")||(e.url+="&"),e.url+=r+"="+this.inQuery[r]}return Promise.resolve(e)},e}(),$e=function(r){function e(e){if(!e||e&&"string"!=typeof e)throw new Error("topicKey cannot be null or undefined and must be of type string.");var t={inHeader:{"aeg-sas-key":e}};return r.call(this,t)||this}return _(e,r),e}(Fe);N.WebResource=A,N.DefaultHttpClient=C,N.HttpHeaders=p,N.RestError=x,N.ServiceClient=Ie,N.flattenResponse=Me,N.Constants=c,N.logPolicy=function(r){return void 0===r&&(r=console.log),{create:function(e,t){return new ze(e,t,r)}}},N.BaseRequestPolicy=J,N.RequestPolicyOptions=G,N.exponentialRetryPolicy=ne,N.systemErrorRetryPolicy=Se,N.redirectPolicy=Ee,N.signingPolicy=Te,N.userAgentPolicy=ue,N.getDefaultUserAgentValue=se,N.deserializationPolicy=K,N.deserializeResponseBody=re,N.MapperType=q,N.Serializer=E,N.serializeObject=function e(t){if(null!=t){if(t instanceof Uint8Array)return t=s(t);if(t instanceof Date)return t.toISOString();if(Array.isArray(t)){for(var r=[],n=0;n<t.length;n++)r.push(e(t[n]));return r}if("object"!=typeof t)return t;var o={};for(var i in t)o[i]=e(t[i]);return o}},N.stripRequest=g,N.stripResponse=v,N.delay=h,N.executePromisesSequentially=function(e,t){var r=Promise.resolve(t);return e.forEach(function(e){r=r.then(e)}),r},N.generateUuid=y,N.encodeUri=function(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/"/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")},N.promiseToCallback=function(e){if("function"!=typeof e.then)throw new Error("The provided input is not a Promise.");return function(t){e.then(function(e){t(void 0,e)},function(e){t(e)})}},N.promiseToServiceCallback=function(e){if("function"!=typeof e.then)throw new Error("The provided input is not a Promise.");return function(t){e.then(function(e){process.nextTick(t,void 0,e.parsedBody,e.request,e)},function(e){process.nextTick(t,e)})}},N.isValidUuid=f,N.applyMixins=function(r,e){e.forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){r.prototype[e]=t.prototype[e]})})},N.isNode=i,N.isDuration=m,N.URLBuilder=fe,N.URLQuery=ce,N.TokenCredentials=Le,N.BasicAuthenticationCredentials=Be,N.ApiKeyCredentials=Fe,N.TopicCredentials=$e,Object.defineProperty(N,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t(e.msRest={})}(this,function(N){"use strict";function r(e){return e.toLowerCase()}var p=function(){function e(e){if(this._headersMap={},e)for(var t in e)this.set(t,e[t])}return e.prototype.set=function(e,t){this._headersMap[r(e)]={name:e,value:t.toString()}},e.prototype.get=function(e){var t=this._headersMap[r(e)];return t?t.value:void 0},e.prototype.contains=function(e){return!!this._headersMap[r(e)]},e.prototype.remove=function(e){var t=this.contains(e);return delete this._headersMap[r(e)],t},e.prototype.rawHeaders=function(){var e={};for(var t in this._headersMap){var r=this._headersMap[t];e[r.name.toLowerCase()]=r.value}return e},e.prototype.headersArray=function(){var e=[];for(var t in this._headersMap)e.push(this._headersMap[t]);return e},e.prototype.headerNames=function(){for(var e=[],t=this.headersArray(),r=0;r<t.length;++r)e.push(t[r].name);return e},e.prototype.headerValues=function(){for(var e=[],t=this.headersArray(),r=0;r<t.length;++r)e.push(t[r].value);return e},e.prototype.toJson=function(){return this.rawHeaders()},e.prototype.toString=function(){return JSON.stringify(this.toJson())},e.prototype.clone=function(){return new e(this.rawHeaders())},e}();function s(e){for(var t="",r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return btoa(t)}function a(e){for(var t=atob(e),r=new Uint8Array(t.length),n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}for(var e,u=(function(e){var t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(t){var r=new Uint8Array(16);e.exports=function(){return t(r),r}}else{var n=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),n[t]=e>>>((3&t)<<3)&255;return n}}}(e={exports:{}},e.exports),e.exports),o=[],t=0;t<256;++t)o[t]=(t+256).toString(16).substr(1);var l=function(e,t){var r=t||0,n=o;return[n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],"-",n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]],n[e[r++]]].join("")};var n=function(e,t,r){var n=t&&r||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var o=(e=e||{}).random||(e.rng||u)();if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,t)for(var i=0;i<16;++i)t[n+i]=o[i];return t||l(o)},c={msRestVersion:"1.7.0",HTTP:"http:",HTTPS:"https:",HTTP_PROXY:"HTTP_PROXY",HTTPS_PROXY:"HTTPS_PROXY",HttpConstants:{HttpVerbs:{PUT:"PUT",GET:"GET",DELETE:"DELETE",POST:"POST",MERGE:"MERGE",HEAD:"HEAD",PATCH:"PATCH"},StatusCodes:{TooManyRequests:429}},HeaderConstants:{AUTHORIZATION:"authorization",AUTHORIZATION_SCHEME:"Bearer",RETRY_AFTER:"Retry-After",USER_AGENT:"User-Agent"}},i="undefined"==typeof navigator&&"undefined"!=typeof process;function v(e){var t={};return t.body=e.bodyAsText,t.headers=e.headers,t.status=e.status,t}function g(e){var t=e.clone();return t.headers&&t.headers.remove("authorization"),t}function f(e){return new RegExp("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$","ig").test(e)}function y(){return n()}function h(t,r){return new Promise(function(e){return setTimeout(function(){return e(r)},t)})}var d=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;function m(e){return d.test(e)}function b(e,t,r){return e&&t?e.split(t).join(r||""):e}var E=function(){function e(e,t){void 0===e&&(e={}),this.modelMappers=e,this.isXML=t}return e.prototype.validateConstraints=function(e,r,n){var t=function(e,t){throw new Error('"'+n+'" with value "'+r+'" should satisfy the constraint "'+e+'": '+t+".")};if(e.constraints&&null!=r){var o=e.constraints,i=o.ExclusiveMaximum,a=o.ExclusiveMinimum,s=o.InclusiveMaximum,u=o.InclusiveMinimum,l=o.MaxItems,c=o.MaxLength,f=o.MinItems,p=o.MinLength,h=o.MultipleOf,d=o.Pattern,y=o.UniqueItems;null!=i&&i<=r&&t("ExclusiveMaximum",i),null!=a&&r<=a&&t("ExclusiveMinimum",a),null!=s&&s<r&&t("InclusiveMaximum",s),null!=u&&r<u&&t("InclusiveMinimum",u),null!=l&&r.length>l&&t("MaxItems",l),null!=c&&r.length>c&&t("MaxLength",c),null!=f&&r.length<f&&t("MinItems",f),null!=p&&r.length<p&&t("MinLength",p),null!=h&&r%h!=0&&t("MultipleOf",h),d&&null===r.match(d)&&t("Pattern",d),y&&r.some(function(e,t,r){return r.indexOf(e)!==t})&&t("UniqueItems",y)}},e.prototype.serialize=function(e,t,r){var n={},o=e.type.name;r||(r=e.serializedName),null!==o.match(/^Sequence$/gi)&&(n=[]),null!=t||null==e.defaultValue&&!e.isConstant||(t=e.defaultValue);var i=e.required,a=e.nullable;if(i&&a&&void 0===t)throw new Error(r+" cannot be undefined.");if(i&&!a&&null==t)throw new Error(r+" cannot be null or undefined.");if(!i&&!1===a&&null===t)throw new Error(r+" cannot be null.");if(null==t)n=t;else if(this.validateConstraints(e,t,r),null!==o.match(/^any$/gi))n=t;else if(null!==o.match(/^(Number|String|Boolean|Object|Stream|Uuid)$/gi))n=function(e,t,r){if(null!=r)if(null!==e.match(/^Number$/gi)){if("number"!=typeof r)throw new Error(t+" with value "+r+" must be of type number.")}else if(null!==e.match(/^String$/gi)){if("string"!=typeof r.valueOf())throw new Error(t+' with value "'+r+'" must be of type string.')}else if(null!==e.match(/^Uuid$/gi)){if("string"!=typeof r.valueOf()||!f(r))throw new Error(t+' with value "'+r+'" must be of type string and a valid uuid.')}else if(null!==e.match(/^Boolean$/gi)){if("boolean"!=typeof r)throw new Error(t+" with value "+r+" must be of type boolean.")}else if(null!==e.match(/^Stream$/gi)){var n=typeof r;if(!("string"===n||"function"===n||r instanceof ArrayBuffer||ArrayBuffer.isView(r)||"function"==typeof Blob&&r instanceof Blob))throw new Error(t+" must be a string, Blob, ArrayBuffer, ArrayBufferView, or a function returning NodeJS.ReadableStream.")}return r}(o,r,t);else if(null!==o.match(/^Enum$/gi)){n=function(e,t,r){if(!t)throw new Error("Please provide a set of allowedValues to validate "+e+" as an Enum Type.");if(t.some(function(e){return"string"==typeof e.valueOf()?e.toLowerCase()===r.toLowerCase():e===r}))return r;throw new Error(r+" is not a valid value for "+e+". The valid values are: "+JSON.stringify(t)+".")}(r,e.type.allowedValues,t)}else null!==o.match(/^(Date|DateTime|TimeSpan|DateTimeRfc1123|UnixTime)$/gi)?n=function(e,t,r){if(null!=t)if(null!==e.match(/^Date$/gi)){if(!(t instanceof Date||"string"==typeof t.valueOf()&&!isNaN(Date.parse(t))))throw new Error(r+" must be an instanceof Date or a string in ISO8601 format.");t=t instanceof Date?t.toISOString().substring(0,10):new Date(t).toISOString().substring(0,10)}else if(null!==e.match(/^DateTime$/gi)){if(!(t instanceof Date||"string"==typeof t.valueOf()&&!isNaN(Date.parse(t))))throw new Error(r+" must be an instanceof Date or a string in ISO8601 format.");t=t instanceof Date?t.toISOString():new Date(t).toISOString()}else if(null!==e.match(/^DateTimeRfc1123$/gi)){if(!(t instanceof Date||"string"==typeof t.valueOf()&&!isNaN(Date.parse(t))))throw new Error(r+" must be an instanceof Date or a string in RFC-1123 format.");t=t instanceof Date?t.toUTCString():new Date(t).toUTCString()}else if(null!==e.match(/^UnixTime$/gi)){if(!(t instanceof Date||"string"==typeof t.valueOf()&&!isNaN(Date.parse(t))))throw new Error(r+" must be an instanceof Date or a string in RFC-1123/ISO8601 format for it to be serialized in UnixTime/Epoch format.");t=function(e){if(!e)return;"string"==typeof e.valueOf()&&(e=new Date(e));return Math.floor(e.getTime()/1e3)}(t)}else if(null!==e.match(/^TimeSpan$/gi)){if(!m(t))throw new Error(r+' must be a string in ISO 8601 format. Instead was "'+t+'".');t=t}return t}(o,t,r):null!==o.match(/^ByteArray$/gi)?n=function(e,t){if(null!=t){if(!(t instanceof Uint8Array))throw new Error(e+" must be of type Uint8Array.");t=s(t)}return t}(r,t):null!==o.match(/^Base64Url$/gi)?n=function(e,t){if(null!=t){if(!(t instanceof Uint8Array))throw new Error(e+" must be of type Uint8Array.");t=function(e){if(!e)return;if(e instanceof Uint8Array)return function(e,t){for(var r=e.length;0<=r-1&&e[r-1]===t;)--r;return e.substr(0,r)}(s(e),"=").replace(/\+/g,"-").replace(/\//g,"_");throw new Error("Please provide an input of type Uint8Array for converting to Base64Url.")}(t)}return t}(r,t):null!==o.match(/^Sequence$/gi)?n=function(e,t,r,n){if(!Array.isArray(r))throw new Error(n+" must be of type Array.");var o=t.type.element;if(!o||"object"!=typeof o)throw new Error('element" metadata for an Array must be defined in the mapper and it must of type "object" in '+n+".");for(var i=[],a=0;a<r.length;a++)i[a]=e.serialize(o,r[a],n);return i}(this,e,t,r):null!==o.match(/^Dictionary$/gi)?n=function(e,t,r,n){if("object"!=typeof r)throw new Error(n+" must be of type object.");var o=t.type.value;if(!o||"object"!=typeof o)throw new Error('"value" metadata for a Dictionary must be defined in the mapper and it must of type "object" in '+n+".");for(var i={},a=0,s=Object.keys(r);a<s.length;a++){var u=s[a];i[u]=e.serialize(o,r[u],n+"."+u)}return i}(this,e,t,r):null!==o.match(/^Composite$/gi)&&(n=function(r,e,n,o){var t;j(r,e)&&(e=z(r,e,n,"clientName"));if(null==n)return n;for(var i={},a=M(r,e,o),s=0,u=Object.keys(a);s<u.length;s++){var l=u[s],c=a[l];if(!c.readOnly){var f=void 0,p=i;if(r.isXML)f=c.xmlIsWrapped?c.xmlName:c.xmlElementName||c.xmlName;else{var h=H(c.serializedName);f=h.pop();for(var d=0,y=h;d<y.length;d++){var m=y[d],v=p[m];null==v&&null!=n[l]&&(p[m]={}),p=p[m]}}if(null!=p){var g=""!==c.serializedName?o+"."+c.serializedName:o,b=n[l],E=j(r,e);E&&E.clientName===l&&null==b&&(b=e.serializedName);var w=r.serialize(c,b,g);void 0!==w&&null!=f&&(c.xmlIsAttribute?(p.$=p.$||{},p.$[f]=w):c.xmlIsWrapped?p[f]=((t={})[c.xmlElementName]=w,t):p[f]=w)}}}var R=e.type.additionalProperties;if(R){var _=Object.keys(a),T=function(t){var e=_.every(function(e){return e!==t});e&&(i[t]=r.serialize(R,n[t],o+'["'+t+'"]'))};for(var P in n)T(P)}return i}(this,e,t,r));return n},e.prototype.deserialize=function(e,t,r){if(null==t)return this.isXML&&"Sequence"===e.type.name&&!e.xmlIsWrapped&&(t=[]),t;var n,o,i=e.type.name;return r||(r=e.serializedName),null!==i.match(/^Composite$/gi)?n=function(e,t,r,n){j(e,t)&&(t=z(e,t,r,"serializedName"));for(var o=M(e,t,n),i={},a=[],s=0,u=Object.keys(o);s<u.length;s++){var l=u[s],c=o[l],f=H(o[l].serializedName);a.push(f[0]);var p=c.serializedName,h=c.xmlName,d=c.xmlElementName,y=n;""!==p&&void 0!==p&&(y=n+"."+p);var m=c.headerCollectionPrefix;if(m){for(var v={},g=0,b=Object.keys(r);g<b.length;g++){var E=b[g];E.startsWith(m)&&(v[E.substring(m.length)]=e.deserialize(c.type.value,r[E],y)),a.push(E)}i[l]=v}else if(e.isXML)if(c.xmlIsAttribute&&r.$)i[l]=e.deserialize(c,r.$[h],y);else{var w=d||h||p,R=r[w];if(c.xmlIsWrapped){var _=void 0===(R=(R=r[h])&&R[d]);_&&(R=[])}i[l]=e.deserialize(c,R,y)}else{for(var T=void 0,P=r,S=0,O=f;S<O.length;S++){var x=O[S];if(!P)break;P=P[x]}T=P;var N=t.type.polymorphicDiscriminator;N&&c.serializedName===N.serializedName&&null==T&&(T=t.serializedName);var q=void 0;Array.isArray(r[l])&&""===o[l].serializedName?(T=r[l],i=e.deserialize(c,T,y)):void 0!==T&&(q=e.deserialize(c,T,y),i[l]=q)}}var A=t.type.additionalProperties;if(A){var C=function(e){for(var t in o){var r=H(o[t].serializedName);if(r[0]===e)return!1}return!0};for(var D in r)C(D)&&(i[D]=e.deserialize(A,r[D],n+'["'+D+'"]'))}else if(r)for(var I=0,U=Object.keys(r);I<U.length;I++){var l=U[I];void 0!==i[l]||a.includes(l)||["$","_"].includes(l)||(i[l]=r[l])}return i}(this,e,t,r):(this.isXML&&null!=t.$&&null!=t._&&(t=t._),null!==i.match(/^Number$/gi)?(n=parseFloat(t),isNaN(n)&&(n=t)):null!==i.match(/^Boolean$/gi)?n="true"===t||"false"!==t&&t:null!==i.match(/^(String|Enum|Object|Stream|Uuid|TimeSpan|any)$/gi)?n=t:null!==i.match(/^(Date|DateTime|DateTimeRfc1123)$/gi)?n=new Date(t):null!==i.match(/^UnixTime$/gi)?n=(o=t)?new Date(1e3*o):void 0:null!==i.match(/^ByteArray$/gi)?n=a(t):null!==i.match(/^Base64Url$/gi)?n=function(e){if(!e)return;if(e&&"string"!=typeof e.valueOf())throw new Error("Please provide an input of type string for converting to Uint8Array");return a(e=e.replace(/\-/g,"+").replace(/\_/g,"/"))}(t):null!==i.match(/^Sequence$/gi)?n=function(e,t,r,n){var o=t.type.element;if(!o||"object"!=typeof o)throw new Error('element" metadata for an Array must be defined in the mapper and it must of type "object" in '+n);if(r){Array.isArray(r)||(r=[r]);for(var i=[],a=0;a<r.length;a++)i[a]=e.deserialize(o,r[a],n+"["+a+"]");return i}return r}(this,e,t,r):null!==i.match(/^Dictionary$/gi)&&(n=function(e,t,r,n){var o=t.type.value;if(!o||"object"!=typeof o)throw new Error('"value" metadata for a Dictionary must be defined in the mapper and it must of type "object" in '+n);if(r){for(var i={},a=0,s=Object.keys(r);a<s.length;a++){var u=s[a];i[u]=e.deserialize(o,r[u],n)}return i}return r}(this,e,t,r))),e.isConstant&&(n=e.defaultValue),n},e}();function H(e){var t=[],r="";if(e)for(var n=0,o=e.split(".");n<o.length;n++){var i=o[n];"\\"===i.charAt(i.length-1)?r+=i.substr(0,i.length-1)+".":(r+=i,t.push(r),r="")}return t}function M(e,t,r){var n=t.type.modelProperties;if(!n){var o=t.type.className;if(!o)throw new Error('Class name for model "'+r+'" is not provided in the mapper "'+JSON.stringify(t,void 0,2)+'".');var i=e.modelMappers[o];if(!i)throw new Error('mapper() cannot be null or undefined for model "'+o+'".');if(!(n=i.type.modelProperties))throw new Error('modelProperties cannot be null or undefined in the mapper "'+JSON.stringify(i)+'" of type "'+o+'" for object "'+r+'".')}return n}function z(e,t,r,n){var o=j(e,t);if(o){var i=o[n];if(null!=i){var a=r[i];if(null!=a){var s=t.type.uberParent||t.type.className,u=a===s?a:s+"."+a,l=e.modelMappers.discriminators[u];l&&(t=l)}}}return t}function j(e,t){return t.type.polymorphicDiscriminator||w(e,t.type.uberParent)||w(e,t.type.className)}function w(e,t){return t&&e.modelMappers[t]&&e.modelMappers[t].type.polymorphicDiscriminator}var q=function(e){for(var t={},r=0,n=e;r<n.length;r++){var o=n[r];t[o]=o}return t}(["Base64Url","Boolean","ByteArray","Composite","Date","DateTime","DateTimeRfc1123","Dictionary","Enum","Number","Object","Sequence","String","Stream","TimeSpan","UnixTime"]),A=function(){function t(e,t,r,n,o,i,a,s,u,l,c,f){this.streamResponseBody=i,this.url=e||"",this.method=t||"GET",this.headers=o instanceof p?o:new p(o),this.body=r,this.query=n,this.formData=void 0,this.withCredentials=a||!1,this.abortSignal=s,this.timeout=u||0,this.onUploadProgress=l,this.onDownloadProgress=c,this.proxySettings=f}return t.prototype.validateRequestProperties=function(){if(!this.method)throw new Error("WebResource.method is required.");if(!this.url)throw new Error("WebResource.url is required.")},t.prototype.prepare=function(e){if(!e)throw new Error("options object is required");if(null==e.method||"string"!=typeof e.method.valueOf())throw new Error("options.method must be a string.");if(e.url&&e.pathTemplate)throw new Error("options.url and options.pathTemplate are mutually exclusive. Please provide exactly one of them.");if(!(null!=e.pathTemplate&&"string"==typeof e.pathTemplate.valueOf()||null!=e.url&&"string"==typeof e.url.valueOf()))throw new Error("Please provide exactly one of options.pathTemplate or options.url.");if(e.url){if("string"!=typeof e.url)throw new Error('options.url must be of type "string".');this.url=e.url}if(e.method){var t=["GET","PUT","HEAD","DELETE","OPTIONS","POST","PATCH","TRACE"];if(-1===t.indexOf(e.method.toUpperCase()))throw new Error('The provided method "'+e.method+'" is invalid. Supported HTTP methods are: '+JSON.stringify(t))}if(this.method=e.method.toUpperCase(),e.pathTemplate){var n=e.pathTemplate,o=e.pathParameters;if("string"!=typeof n)throw new Error('options.pathTemplate must be of type "string".');e.baseUrl||(e.baseUrl="https://management.azure.com");var r=e.baseUrl,i=r+(r.endsWith("/")?"":"/")+(n.startsWith("/")?n.slice(1):n),a=i.match(/({\w*\s*\w*})/gi);if(a&&a.length){if(!o)throw new Error("pathTemplate: "+n+" has been provided. Hence, options.pathParameters must also be provided.");a.forEach(function(e){var t=e.slice(1,-1),r=o[t];if(null==r||"string"!=typeof r&&"object"!=typeof r)throw new Error("pathTemplate: "+n+" contains the path parameter "+t+" however, it is not present in "+o+" - "+JSON.stringify(o,void 0,2)+'.The value of the path parameter can either be a "string" of the form { '+t+': "some sample value" } or it can be an "object" of the form { "'+t+'": { value: "some sample value", skipUrlEncoding: true } }.');if("string"==typeof r.valueOf()&&(i=i.replace(e,encodeURIComponent(r))),"object"==typeof r.valueOf()){if(!r.value)throw new Error("options.pathParameters["+t+'] is of type "object" but it does not contain a "value" property.');i=r.skipUrlEncoding?i.replace(e,r.value):i.replace(e,encodeURIComponent(r.value))}})}this.url=i}if(e.queryParameters){var s=e.queryParameters;if("object"!=typeof s)throw new Error('options.queryParameters must be of type object. It should be a JSON object of "query-parameter-name" as the key and the "query-parameter-value" as the value. The "query-parameter-value" may be fo type "string" or an "object" of the form { value: "query-parameter-value", skipUrlEncoding: true }.');this.url&&-1===this.url.indexOf("?")&&(this.url+="?");var u=[];for(var l in this.query={},s){var c=s[l];if(c)if("string"==typeof c)u.push(l+"="+encodeURIComponent(c)),this.query[l]=encodeURIComponent(c);else if("object"==typeof c){if(!c.value)throw new Error("options.queryParameters["+l+'] is of type "object" but it does not contain a "value" property.');c.skipUrlEncoding?(u.push(l+"="+c.value),this.query[l]=c.value):(u.push(l+"="+encodeURIComponent(c.value)),this.query[l]=encodeURIComponent(c.value))}}this.url+=u.join("&")}if(e.headers)for(var f=e.headers,p=0,h=Object.keys(e.headers);p<h.length;p++){var d=h[p];this.headers.set(d,f[d])}return this.headers.get("accept-language")||this.headers.set("accept-language","en-US"),this.headers.get("x-ms-client-request-id")||e.disableClientRequestId||this.headers.set("x-ms-client-request-id",y()),this.headers.get("Content-Type")||this.headers.set("Content-Type","application/json; charset=utf-8"),this.body=e.body,null!=e.body&&(e.bodyIsStream?(this.headers.get("Transfer-Encoding")||this.headers.set("Transfer-Encoding","chunked"),"application/octet-stream"!==this.headers.get("Content-Type")&&this.headers.set("Content-Type","application/octet-stream")):(e.serializationMapper&&(this.body=new E(e.mappers).serialize(e.serializationMapper,e.body,"requestBody")),e.disableJsonStringifyOnBody||(this.body=JSON.stringify(e.body)))),this.abortSignal=e.abortSignal,this.onDownloadProgress=e.onDownloadProgress,this.onUploadProgress=e.onUploadProgress,this},t.prototype.clone=function(){var e=new t(this.url,this.method,this.body,this.query,this.headers&&this.headers.clone(),this.streamResponseBody,this.withCredentials,this.abortSignal,this.timeout,this.onUploadProgress,this.onDownloadProgress);return this.formData&&(e.formData=this.formData),this.operationSpec&&(e.operationSpec=this.operationSpec),this.shouldDeserialize&&(e.shouldDeserialize=this.shouldDeserialize),this.operationResponseGetter&&(e.operationResponseGetter=this.operationResponseGetter),e},t}(),R=function(e,t){return(R=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function _(e,t){function r(){this.constructor=e}R(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var T=function(){return(T=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var o in t=arguments[r])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e}).apply(this,arguments)};function P(i,a,s,u){return new(s||(s=Promise))(function(e,t){function r(e){try{o(u.next(e))}catch(e){t(e)}}function n(e){try{o(u.throw(e))}catch(e){t(e)}}function o(t){t.done?e(t.value):new s(function(e){e(t.value)}).then(r,n)}o((u=u.apply(i,a||[])).next())})}function S(r,n){var o,i,a,e,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(o)throw new TypeError("Generator is already executing.");for(;s;)try{if(o=1,i&&(a=2&t[0]?i.return:t[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,t[1])).done)return a;switch(i=0,a&&(t=[2&t[0],a.value]),t[0]){case 0:case 1:a=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,i=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){s.label=t[1];break}if(6===t[0]&&s.label<a[1]){s.label=a[1],a=t;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(t);break}a[2]&&s.ops.pop(),s.trys.pop();continue}t=n.call(r,s)}catch(e){t=[6,e],i=0}finally{o=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}var O,x=function(s){function u(e,t,r,n,o,i){var a=s.call(this,e)||this;return a.code=t,a.statusCode=r,a.request=n,a.response=o,a.body=i,Object.setPrototypeOf(a,u.prototype),a}return _(u,s),u.REQUEST_SEND_ERROR="REQUEST_SEND_ERROR",u.REQUEST_ABORTED_ERROR="REQUEST_ABORTED_ERROR",u.PARSE_ERROR="PARSE_ERROR",u}(Error),C=function(){function e(){}return e.prototype.sendRequest=function(r){var n=new XMLHttpRequest;if(r.proxySettings)throw new Error("HTTP proxy is not supported in browser environment");var e=r.abortSignal;if(e){var t=function(){n.abort()};e.addEventListener("abort",t),n.addEventListener("readystatechange",function(){n.readyState===XMLHttpRequest.DONE&&e.removeEventListener("abort",t)})}if(D(n.upload,r.onUploadProgress),D(n,r.onDownloadProgress),r.formData){for(var o=r.formData,i=new FormData,a=function(e,t){t&&t.hasOwnProperty("value")&&t.hasOwnProperty("options")?i.append(e,t.value,t.options):i.append(e,t)},s=0,u=Object.keys(o);s<u.length;s++){var l=u[s],c=o[l];if(Array.isArray(c))for(var f=0;f<c.length;f++)a(l,c[f]);else a(l,c)}r.body=i,r.formData=void 0;var p=r.headers.get("Content-Type");p&&-1!==p.indexOf("multipart/form-data")&&r.headers.remove("Content-Type")}n.open(r.method,r.url),n.timeout=r.timeout,n.withCredentials=r.withCredentials;for(var h=0,d=r.headers.headersArray();h<d.length;h++){var y=d[h];n.setRequestHeader(y.name,y.value)}return n.responseType=r.streamResponseBody?"blob":"text",n.send(void 0===r.body?null:r.body),r.streamResponseBody?new Promise(function(t,e){n.addEventListener("readystatechange",function(){if(n.readyState===XMLHttpRequest.HEADERS_RECEIVED){var e=new Promise(function(e,t){n.addEventListener("load",function(){e(n.response)}),U(r,n,t)});t({request:r,status:n.status,headers:I(n),blobBody:e})}}),U(r,n,e)}):new Promise(function(e,t){n.addEventListener("load",function(){return e({request:r,status:n.status,headers:I(n),bodyAsText:n.responseText})}),U(r,n,t)})},e}();function D(e,t){t&&e.addEventListener("progress",function(e){return t({loadedBytes:e.loaded})})}function I(e){for(var t=new p,r=0,n=e.getAllResponseHeaders().trim().split(/[\r\n]+/);r<n.length;r++){var o=n[r],i=o.indexOf(":"),a=o.slice(0,i),s=o.slice(i+2);t.set(a,s)}return t}function U(e,t,r){t.addEventListener("error",function(){return r(new x("Failed to send request to "+e.url,x.REQUEST_SEND_ERROR,void 0,e))}),t.addEventListener("abort",function(){return r(new x("The request was aborted",x.REQUEST_ABORTED_ERROR,void 0,e))}),t.addEventListener("timeout",function(){return r(new x("timeout of "+t.timeout+"ms exceeded",x.REQUEST_SEND_ERROR,void 0,e))})}function L(e){return k(e.parameterPath,e.mapper)}function k(e,t){return"string"==typeof e?e:Array.isArray(e)?e.join("."):t.serializedName}function B(e){var t=!1;for(var r in e.responses){var n=e.responses[r];if(n.bodyMapper&&n.bodyMapper.type.name===q.Stream){t=!0;break}}return t}(O=N.HttpPipelineLogLevel||(N.HttpPipelineLogLevel={}))[O.OFF=0]="OFF",O[O.ERROR=1]="ERROR",O[O.WARNING=2]="WARNING",O[O.INFO=3]="INFO";var F=new DOMParser;function $(e){try{var t=F.parseFromString(e,"application/xml");!function(e){if(Q){var t=e.getElementsByTagNameNS(Q,"parsererror");if(t.length)throw new Error(t.item(0).innerHTML)}}(t);var r=function e(t){var r={};var n=t.childNodes.length;var o=t.childNodes[0];var i=o&&1===n&&o.nodeType===Node.TEXT_NODE&&o.nodeValue||void 0;var a=(u=t,s=u,s.attributes&&u.hasAttributes()?u:void 0);var s;var u;if(a){r.$={};for(var l=0;l<a.attributes.length;l++){var c=a.attributes[l];r.$[c.nodeName]=c.nodeValue}i&&(r._=i)}else 0===n?r="":i&&(r=i);if(!i)for(var l=0;l<n;l++){var f=t.childNodes[l];if(f.nodeType!==Node.TEXT_NODE){var p=e(f);r[f.nodeName]?Array.isArray(r[f.nodeName])?r[f.nodeName].push(p):r[f.nodeName]=[r[f.nodeName],p]:r[f.nodeName]=p}}return r}(t.childNodes[0]);return Promise.resolve(r)}catch(e){return Promise.reject(e)}}var Q="";try{Q=F.parseFromString("INVALID","text/xml").getElementsByTagName("parsererror")[0].namespaceURI}catch(e){}var V=document.implementation.createDocument(null,null,null),Y=new XMLSerializer;function X(e,t){var r=function e(t,r){{if("string"==typeof t||"number"==typeof t||"boolean"==typeof t){var n=V.createElement(r);return n.textContent=t.toString(),[n]}if(Array.isArray(t)){for(var o=[],i=0,a=t;i<a.length;i++)for(var s=a[i],u=0,l=e(s,r);u<l.length;u++){var c=l[u];o.push(c)}return o}if("object"!=typeof t)throw new Error("Illegal value passed to buildObject: "+t);for(var n=V.createElement(r),f=0,p=Object.keys(t);f<p.length;f++){var h=p[f];if("$"===h)for(var d=0,y=W(t[h]);d<y.length;d++){var m=y[d];n.attributes.setNamedItem(m)}else for(var v=0,g=e(t[h],h);v<g.length;v++){var c=g[v];n.appendChild(c)}}return[n]}}(e,t&&t.rootName||"root")[0];return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'+Y.serializeToString(r)}function W(e){for(var t=[],r=0,n=Object.keys(e);r<n.length;r++){var o=n[r],i=V.createAttribute(o);i.value=e[o].toString(),t.push(i)}return t}var J=function(){function e(e,t){this._nextPolicy=e,this._options=t}return e.prototype.shouldLog=function(e){return this._options.shouldLog(e)},e.prototype.log=function(e,t){this._options.log(e,t)},e}(),G=function(){function e(e){this._logger=e}return e.prototype.shouldLog=function(e){return!!this._logger&&e!==N.HttpPipelineLogLevel.OFF&&e<=this._logger.minimumLogLevel},e.prototype.log=function(e,t){this._logger&&this.shouldLog(e)&&this._logger.log(e,t)},e}();function K(r){return{create:function(e,t){return new te(e,r,t)}}}var Z=["application/json","text/json"],ee=["application/xml","application/atom+xml"],te=function(o){function e(e,t,r){var n=o.call(this,e,r)||this;return n.jsonContentTypes=t&&t.json||Z,n.xmlContentTypes=t&&t.xml||ee,n}return _(e,o),e.prototype.sendRequest=function(r){return P(this,void 0,void 0,function(){var t=this;return S(this,function(e){return[2,this._nextPolicy.sendRequest(r).then(function(e){return re(t.jsonContentTypes,t.xmlContentTypes,e)})]})})},e}(J);function re(e,t,m){return function(t,r,o){var e=function(e){var t='Error "'+e+'" occurred while parsing the response body - '+o.bodyAsText+".",r=e.code||x.PARSE_ERROR,n=new x(t,r,o.status,o.request,o,o.bodyAsText);return Promise.reject(n)};if(!o.request.streamResponseBody&&o.bodyAsText){var n=o.bodyAsText,i=o.headers.get("Content-Type")||"",a=i?i.split(";").map(function(e){return e.toLowerCase()}):[];if(0===a.length||a.some(function(e){return-1!==t.indexOf(e)}))return new Promise(function(e){o.parsedBody=JSON.parse(n),e(o)}).catch(e);if(a.some(function(e){return-1!==r.indexOf(e)}))return $(n).then(function(e){return o.parsedBody=e,o}).catch(e)}return Promise.resolve(o)}(e,t,m).then(function(t){var e,r;if(void 0===(r=(e=t).request.shouldDeserialize)||("boolean"==typeof r?r:r(e))){var n=t.request.operationSpec;if(n&&n.responses){var o=t.status,i=Object.keys(n.responses),a=0===i.length||1===i.length&&"default"===i[0],s=function(e){var t,r=e.request,n=r.operationSpec;if(n){var o=r.operationResponseGetter;t=o?o(n,e):n.responses[e.status]}return t}(t);if(a?200<=o&&o<300:!!s){if(s){if(s.bodyMapper){y=t.parsedBody;n.isXML&&s.bodyMapper.type.name===q.Sequence&&(y="object"==typeof y?y[s.bodyMapper.xmlElementName]:[]);try{t.parsedBody=n.serializer.deserialize(s.bodyMapper,y,"operationRes.parsedBody")}catch(f){var u=new x("Error "+f+" occurred in deserializing the responseBody - "+t.bodyAsText);return u.request=g(t.request),u.response=v(t),Promise.reject(u)}}else"HEAD"===n.httpMethod&&(t.parsedBody=200<=m.status&&m.status<300);s.headersMapper&&(t.parsedHeaders=n.serializer.deserialize(s.headersMapper,t.headers.rawHeaders(),"operationRes.parsedHeaders"))}}else{var l=n.responses.default;if(l){var c=B(n)?"Unexpected status code: "+o:t.bodyAsText,f=new x(c);f.statusCode=o,f.request=g(t.request),f.response=v(t);var p=t.parsedBody;try{if(p){var h=l.bodyMapper;if(h&&"CloudError"===h.serializedName)p.error&&(p=p.error),p.code&&(f.code=p.code),p.message&&(f.message=p.message);else{var d=p;p.error&&(d=p.error),f.code=d.code,d.message&&(f.message=d.message)}if(h){var y=p;n.isXML&&h.type.name===q.Sequence&&(y="object"==typeof p?p[h.xmlElementName]:[]),f.body=n.serializer.deserialize(h,y,"error.body")}}}catch(e){f.message='Error "'+e.message+'" occurred in deserializing the responseBody - "'+t.bodyAsText+'" for the default response.'}return Promise.reject(f)}}}}return Promise.resolve(t)})}function ne(r,n,o,i){return{create:function(e,t){return new oe(e,t,r,n,o,i)}}}var oe=function(u){function e(e,t,r,n,o,i){var a=u.call(this,e,t)||this;function s(e){return"number"==typeof e}return a.retryCount=s(r)?r:3,a.retryInterval=s(n)?n:3e4,a.minRetryInterval=s(o)?o:3e3,a.maxRetryInterval=s(i)?i:9e4,a}return _(e,u),e.prototype.sendRequest=function(t){var r=this;return this._nextPolicy.sendRequest(t.clone()).then(function(e){return ie(r,t,e)}).catch(function(e){return ie(r,t,e.response,void 0,e)})},e}(J);function ie(t,r,n,o,e){o=function(e,t,r){t||(t={retryCount:0,retryInterval:0}),r&&(t.error&&(r.innerError=t.error),t.error=r),t.retryCount++;var n=Math.pow(2,t.retryCount)-1;return n*=.8*e.retryInterval+Math.floor(Math.random()*(1.2*e.retryInterval-.8*e.retryInterval)),t.retryInterval=Math.min(e.minRetryInterval+n,e.maxRetryInterval),t}(t,o,e);var i=r.abortSignal&&r.abortSignal.aborted;if(!i&&function(e,t,r){if(null==t||t<500&&408!==t||501===t||505===t)return!1;if(!r)throw new Error("retryData for the ExponentialRetryPolicyFilter cannot be null.");return(r&&r.retryCount)<e.retryCount}(t,n&&n.status,o))return h(o.retryInterval).then(function(){return t._nextPolicy.sendRequest(r.clone())}).then(function(e){return ie(t,r,e,o,void 0)}).catch(function(e){return ie(t,r,n,o,e)});if(i||e||!n){var a=o.error||new x("Failed to send the request.",x.REQUEST_SEND_ERROR,n&&n.status,n&&n.request,n);return Promise.reject(a)}return Promise.resolve(n)}var ae=function(o){function e(e,t,r){var n=o.call(this,e,t)||this;return n._requestIdHeaderName=r,n}return _(e,o),e.prototype.sendRequest=function(e){return e.headers.contains(this._requestIdHeaderName)||e.headers.set(this._requestIdHeaderName,y()),this._nextPolicy.sendRequest(e)},e}(J);function se(){return"x-ms-command-name"}var ue=se;function le(){var e,t,r,n,o=[{key:"ms-rest-js",value:c.msRestVersion}],i=[{key:"OS",value:((e=window.navigator).oscpu||e.platform).replace(" ","")}];return t=o.concat(i),void 0===r&&(r=" "),void 0===n&&(n="/"),t.map(function(e){var t=e.value?""+n+e.value:"";return""+e.key+t}).join(r)}function ce(e){var r=e&&null!=e.key?e.key:"x-ms-command-name",n=e&&null!=e.value?e.value:le();return{create:function(e,t){return new fe(e,t,r,n)}}}var fe=function(i){function e(e,t,r,n){var o=i.call(this,e,t)||this;return o._nextPolicy=e,o._options=t,o.headerKey=r,o.headerValue=n,o}return _(e,i),e.prototype.sendRequest=function(e){return this.addUserAgentHeader(e),this._nextPolicy.sendRequest(e)},e.prototype.addUserAgentHeader=function(e){e.headers||(e.headers=new p),!e.headers.get(this.headerKey)&&this.headerValue&&e.headers.set(this.headerKey,this.headerValue)},e}(J),pe=function(){function s(){this._rawQuery={}}return s.prototype.any=function(){return 0<Object.keys(this._rawQuery).length},s.prototype.set=function(e,t){if(e)if(null!=t){var r=Array.isArray(t)?t:t.toString();this._rawQuery[e]=r}else delete this._rawQuery[e]},s.prototype.get=function(e){return e?this._rawQuery[e]:void 0},s.prototype.toString=function(){var e="";for(var t in this._rawQuery){e&&(e+="&");var r=this._rawQuery[t];if(Array.isArray(r)){for(var n=[],o=0,i=r;o<i.length;o++){var a=i[o];n.push(t+"="+a)}e+=n.join("&")}else e+=t+"="+r}return e},s.parse=function(e){var t=new s;if(e){e.startsWith("?")&&(e=e.substring(1));for(var r="ParameterName",n="",o="",i=0;i<e.length;++i){var a=e[i];switch(r){case"ParameterName":switch(a){case"=":r="ParameterValue";break;case"&":o=n="";break;default:n+=a}break;case"ParameterValue":switch(a){case"=":o=n="",r="Invalid";break;case"&":t.set(n,o),o=n="",r="ParameterName";break;default:o+=a}break;case"Invalid":"&"===a&&(r="ParameterName");break;default:throw new Error("Unrecognized URLQuery parse state: "+r)}}"ParameterValue"===r&&t.set(n,o)}return t},s}(),he=function(){function r(){}return r.prototype.setScheme=function(e){e?this.set(e,"SCHEME"):this._scheme=void 0},r.prototype.getScheme=function(){return this._scheme},r.prototype.setHost=function(e){e?this.set(e,"SCHEME_OR_HOST"):this._host=void 0},r.prototype.getHost=function(){return this._host},r.prototype.setPort=function(e){null==e||""===e?this._port=void 0:this.set(e.toString(),"PORT")},r.prototype.getPort=function(){return this._port},r.prototype.setPath=function(e){e?-1!==e.indexOf("://")?this.set(e,"SCHEME"):this.set(e,"PATH"):this._path=void 0},r.prototype.appendPath=function(e){if(e){var t=this.getPath();t&&(t.endsWith("/")||(t+="/"),e.startsWith("/")&&(e=e.substring(1)),e=t+e),this.set(e,"PATH")}},r.prototype.getPath=function(){return this._path},r.prototype.setQuery=function(e){this._query=e?pe.parse(e):void 0},r.prototype.setQueryParameter=function(e,t){e&&(this._query||(this._query=new pe),this._query.set(e,t))},r.prototype.getQueryParameterValue=function(e){return this._query?this._query.get(e):void 0},r.prototype.getQuery=function(){return this._query?this._query.toString():void 0},r.prototype.set=function(e,t){for(var r=new ye(e,t);r.next();){var n=r.current();if(n)switch(n.type){case"SCHEME":this._scheme=n.text||void 0;break;case"HOST":this._host=n.text||void 0;break;case"PORT":this._port=n.text||void 0;break;case"PATH":var o=n.text||void 0;this._path&&"/"!==this._path&&"/"===o||(this._path=o);break;case"QUERY":this._query=pe.parse(n.text);break;default:throw new Error("Unrecognized URLTokenType: "+n.type)}}},r.prototype.toString=function(){var e="";return this._scheme&&(e+=this._scheme+"://"),this._host&&(e+=this._host),this._port&&(e+=":"+this._port),this._path&&(this._path.startsWith("/")||(e+="/"),e+=this._path),this._query&&this._query.any()&&(e+="?"+this._query.toString()),e},r.prototype.replaceAll=function(e,t){e&&(this.setScheme(b(this.getScheme(),e,t)),this.setHost(b(this.getHost(),e,t)),this.setPort(b(this.getPort(),e,t)),this.setPath(b(this.getPath(),e,t)),this.setQuery(b(this.getQuery(),e,t)))},r.parse=function(e){var t=new r;return t.set(e,"SCHEME_OR_HOST"),t},r}(),de=function(){function t(e,t){this.text=e,this.type=t}return t.scheme=function(e){return new t(e,"SCHEME")},t.host=function(e){return new t(e,"HOST")},t.port=function(e){return new t(e,"PORT")},t.path=function(e){return new t(e,"PATH")},t.query=function(e){return new t(e,"QUERY")},t}();var ye=function(){function e(e,t){this._text=e,this._textLength=e?e.length:0,this._currentState=null!=t?t:"SCHEME_OR_HOST",this._currentIndex=0}return e.prototype.current=function(){return this._currentToken},e.prototype.next=function(){if(me(this))switch(this._currentState){case"SCHEME":i=Ee(o=this,function(e){return 48<=(t=e.charCodeAt(0))&&t<=57||65<=t&&t<=90||97<=t&&t<=122;var t}),o._currentToken=de.scheme(i),me(o)?o._currentState="HOST":o._currentState="DONE";break;case"SCHEME_OR_HOST":n=we(r=this,":","/","?"),me(r)?":"===ve(r)?"://"===be(r,3)?(r._currentToken=de.scheme(n),r._currentState="HOST"):(r._currentToken=de.host(n),r._currentState="PORT"):(r._currentToken=de.host(n),"/"===ve(r)?r._currentState="PATH":r._currentState="QUERY"):(r._currentToken=de.host(n),r._currentState="DONE");break;case"HOST":!function(e){"://"===be(e,3)&&ge(e,3);var t=we(e,":","/","?");e._currentToken=de.host(t),me(e)?":"===ve(e)?e._currentState="PORT":"/"===ve(e)?e._currentState="PATH":e._currentState="QUERY":e._currentState="DONE"}(this);break;case"PORT":!function(e){":"===ve(e)&&ge(e);var t=we(e,"/","?");e._currentToken=de.port(t),me(e)?"/"===ve(e)?e._currentState="PATH":e._currentState="QUERY":e._currentState="DONE"}(this);break;case"PATH":t=we(e=this,"?"),e._currentToken=de.path(t),me(e)?e._currentState="QUERY":e._currentState="DONE";break;case"QUERY":!function(e){"?"===ve(e)&&ge(e);var t=function(e){var t="";e._currentIndex<e._textLength&&(t=e._text.substring(e._currentIndex),e._currentIndex=e._textLength);return t}(e);e._currentToken=de.query(t),e._currentState="DONE"}(this);break;default:throw new Error("Unrecognized URLTokenizerState: "+this._currentState)}else this._currentToken=void 0;var e,t,r,n,o,i;return!!this._currentToken},e}();function me(e){return e._currentIndex<e._textLength}function ve(e){return e._text[e._currentIndex]}function ge(e,t){me(e)&&(t||(t=1),e._currentIndex+=t)}function be(e,t){var r=e._currentIndex+t;return e._textLength<r&&(r=e._textLength),e._text.substring(e._currentIndex,r)}function Ee(e,t){for(var r="";me(e);){var n=ve(e);if(!t(n))break;r+=n,ge(e)}return r}function we(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];return Ee(e,function(e){return-1===t.indexOf(e)})}function Re(r){return void 0===r&&(r=20),{create:function(e,t){return new _e(e,t,r)}}}var _e=function(o){function e(e,t,r){void 0===r&&(r=20);var n=o.call(this,e,t)||this;return n.maxRetries=r,n}return _(e,o),e.prototype.sendRequest=function(e){var t=this;return this._nextPolicy.sendRequest(e).then(function(e){return function t(r,e,n){var o=e.request,i=e.status;var a=e.headers.get("location");if(a&&(300===i||307===i||303===i&&"POST"===o.method)&&(!r.maxRetries||n<r.maxRetries)){var s=he.parse(o.url);return s.setPath(a),o.url=s.toString(),303===i&&(o.method="GET"),r._nextPolicy.sendRequest(o).then(function(e){return t(r,e,n+1)})}return Promise.resolve(e)}(t,e,0)})},e}(J);var Te=function(o){function e(e,t,r){void 0===r&&(r=30);var n=o.call(this,e,t)||this;return n._retryTimeout=r,n}return _(e,o),e.prototype.sendRequest=function(t){var r=this;return this._nextPolicy.sendRequest(t.clone()).then(function(e){return function(t,r,n){if(409===n.status){var e=function(e){var t,r;if(e){try{r=JSON.parse(e)}catch(e){}if(r&&r.error&&r.error.message&&r.error.code&&"MissingSubscriptionRegistration"===r.error.code){var n=r.error.message.match(/.*'(.*)'/i);n&&(t=n.pop())}}return t}(n.bodyAsText);if(e){var o=function(e){var t,r=e.match(/.*\/subscriptions\/[a-f0-9-]+\//gi);{if(!r||!r[0])throw new Error("Unable to extract subscriptionId from the given url - "+e+".");t=r[0]}return t}(r.url);return(i=t,a=o,s=e,u=r,l=a+"providers/"+s+"/register?api-version=2016-02-01",c=a+"providers/"+s+"?api-version=2016-02-01",f=Pe(u),f.method="POST",f.url=l,i._nextPolicy.sendRequest(f).then(function(e){if(200!==e.status)throw new Error("Autoregistration of "+s+" failed. Please try registering manually.");return function r(n,o,i){var e=Pe(i);return e.url=o,e.method="GET",n._nextPolicy.sendRequest(e).then(function(e){var t=e.parsedBody;return!(!e.parsedBody||!t.registrationState||"Registered"!==t.registrationState)||h(1e3*n._retryTimeout).then(function(){return r(n,o,i)})})}(i,c,u)})).catch(function(){return!1}).then(function(e){return e?(r.headers.set("x-ms-client-request-id",y()),t._nextPolicy.sendRequest(r.clone())):n})}}var i,a,s,u,l,c,f;return Promise.resolve(n)}(r,t,e)})},e}(J);function Pe(e,t){void 0===t&&(t=!1);var r={headers:{}};for(var n in t&&(r.url=e.url),e.headers)r.headers.set(n,e.headers.get(n));return r.headers["x-ms-client-request-id"]=y(),r.headers["Content-Type"]="application/json; charset=utf-8",r}function Se(r){return{create:function(e,t){return new Oe(e,t,r)}}}var Oe=function(o){function e(e,t,r){var n=o.call(this,e,t)||this;return n.authenticationProvider=r,n}return _(e,o),e.prototype.signRequest=function(e){return this.authenticationProvider.signRequest(e)},e.prototype.sendRequest=function(e){var t=this;return this.signRequest(e).then(function(e){return t._nextPolicy.sendRequest(e)})},e}(J);function xe(r,n,o,i){return{create:function(e,t){return new qe(e,t,r,n,o,i)}}}var Ne,qe=function(s){function e(e,t,r,n,o,i){var a=s.call(this,e,t)||this;return a.DEFAULT_CLIENT_RETRY_INTERVAL=3e4,a.DEFAULT_CLIENT_RETRY_COUNT=3,a.DEFAULT_CLIENT_MAX_RETRY_INTERVAL=9e4,a.DEFAULT_CLIENT_MIN_RETRY_INTERVAL=3e3,a.retryCount="number"==typeof r?r:a.DEFAULT_CLIENT_RETRY_COUNT,a.retryInterval="number"==typeof n?n:a.DEFAULT_CLIENT_RETRY_INTERVAL,a.minRetryInterval="number"==typeof o?o:a.DEFAULT_CLIENT_MIN_RETRY_INTERVAL,a.maxRetryInterval="number"==typeof i?i:a.DEFAULT_CLIENT_MAX_RETRY_INTERVAL,a}return _(e,s),e.prototype.sendRequest=function(t){var r=this;return this._nextPolicy.sendRequest(t.clone()).then(function(e){return function t(r,n,o,i,a){i=Ce(r,i,a);return a&&a.code&&Ae(r,i)&&("ETIMEDOUT"===a.code||"ESOCKETTIMEDOUT"===a.code||"ECONNREFUSED"===a.code||"ECONNRESET"===a.code||"ENOENT"===a.code)?h(i.retryInterval).then(function(){return r._nextPolicy.sendRequest(n.clone())}).then(function(e){return t(r,n,e,i,a)}).catch(function(e){return t(r,n,o,i,e)}):null!=a?(a=i.error,Promise.reject(a)):Promise.resolve(o)}(r,t,e)})},e}(J);function Ae(e,t){if(!t)throw new Error("retryData for the SystemErrorRetryPolicyFilter cannot be null.");return(t&&t.retryCount)<e.retryCount}function Ce(e,t,r){t||(t={retryCount:0,retryInterval:0}),r&&(t.error&&(r.innerError=t.error),t.error=r),t.retryCount++;var n=Math.pow(2,t.retryCount)-1;return n*=.8*e.retryInterval+Math.floor(Math.random()*(1.2*e.retryInterval-.8*e.retryInterval)),t.retryInterval=Math.min(e.minRetryInterval+n,e.maxRetryInterval),t}(Ne=N.QueryCollectionFormat||(N.QueryCollectionFormat={})).Csv=",",Ne.Ssv=" ",Ne.Tsv="\t",Ne.Pipes="|",Ne.Multi="Multi";var De=new Error("ProxyPolicy is not supported in browser environment");!function(r){function e(e,t){r.call(this,e,t);throw De}_(e,r),e.prototype.sendRequest=function(e){throw De}}(J);var Ie=c.HttpConstants.StatusCodes;var Ue=function(o){function a(e,t,r){var n=o.call(this,e,t)||this;return n._handleResponse=r||n._defaultResponseHandler,n}return _(a,o),a.prototype.sendRequest=function(r){return P(this,void 0,void 0,function(){var t=this;return S(this,function(e){return[2,this._nextPolicy.sendRequest(r.clone()).then(function(e){return e.status!==Ie.TooManyRequests?e:t._handleResponse(r,e)})]})})},a.prototype._defaultResponseHandler=function(o,i){return P(this,void 0,void 0,function(){var t,r,n=this;return S(this,function(e){return(t=i.headers.get(c.HeaderConstants.RETRY_AFTER))&&(r=a.parseRetryAfterHeader(t))?[2,delay(r).then(function(e){return n._nextPolicy.sendRequest(o)})]:[2,i]})})},a.parseRetryAfterHeader=function(e){var t=Number(e);return Number.isNaN(t)?a.parseDateRetryAfterHeader(e):1e3*t},a.parseDateRetryAfterHeader=function(e){try{var t=Date.now(),r=Date.parse(e)-t;return Number.isNaN(r)?void 0:r}catch(e){return}},a}(J),He=function(){function e(e,t){if(t||(t={}),e&&!e.signRequest)throw new Error("credentials argument needs to implement signRequest method");var r;if(this._withCredentials=t.withCredentials||!1,this._httpClient=t.httpClient||new C,this._requestPolicyOptions=new G(t.httpPipelineLogger),Array.isArray(t.requestPolicyFactories))r=t.requestPolicyFactories;else if(r=function(e,t){var r=[];t.generateClientRequestIdHeader&&r.push((void 0===(n=t.clientRequestIdHeaderName)&&(n="x-ms-client-request-id"),{create:function(e,t){return new ae(e,t,n)}}));var n;e&&("function"==typeof e.create?r.push(e):r.push(Se(e)));var o=Me(t.userAgentHeaderName,ue),i=Me(t.userAgent,le);o&&i&&r.push(ce({key:o,value:i}));r.push(Re()),r.push((a=t.rpRegistrationRetryTimeout,void 0===a&&(a=30),{create:function(e,t){return new Te(e,t,a)}})),t.noRetryPolicy||(r.push(ne()),r.push(xe()),r.push({create:function(e,t){return new Ue(e,t)}}));var a;r.push(K(t.deserializationContentTypes));var s=t.proxySettings||void 0;s&&r.push({create:function(e,t){throw De}});return r}(e,t),t.requestPolicyFactories){var n=t.requestPolicyFactories(r);n&&(r=n)}this._requestPolicyFactories=r}return e.prototype.sendRequest=function(e){if(null==e||"object"!=typeof e)throw new Error("options cannot be null or undefined and it must be of type object.");var t;try{t=e instanceof A?(e.validateRequestProperties(),e):(t=new A).prepare(e)}catch(e){return Promise.reject(e)}var r=this._httpClient;if(this._requestPolicyFactories&&0<this._requestPolicyFactories.length)for(var n=this._requestPolicyFactories.length-1;0<=n;--n)r=this._requestPolicyFactories[n].create(r,this._requestPolicyOptions);return r.sendRequest(t)},e.prototype.sendOperationRequest=function(e,t,r){"function"==typeof e.options&&(r=e.options,e.options=void 0);var n,o=new A;try{var i=t.baseUrl||this.baseUri;if(!i)throw new Error("If operationSpec.baseUrl is not specified, then the ServiceClient must have a baseUri string property that contains the base URL to use.");o.method=t.httpMethod,o.operationSpec=t;var a=he.parse(i);if(t.path&&a.appendPath(t.path),t.urlParameters&&0<t.urlParameters.length)for(var s=0,u=t.urlParameters;s<u.length;s++){var l=u[s],c=ze(this,e,l,t.serializer);c=t.serializer.serialize(l.mapper,c,L(l)),l.skipEncoding||(c=encodeURIComponent(c)),a.replaceAll("{"+(l.mapper.serializedName||L(l))+"}",c)}if(t.queryParameters&&0<t.queryParameters.length)for(var f=0,p=t.queryParameters;f<p.length;f++){var h=p[f],d=ze(this,e,h,t.serializer);if(null!=d){if(d=t.serializer.serialize(h.mapper,d,L(h)),null!=h.collectionFormat)if(h.collectionFormat===N.QueryCollectionFormat.Multi)if(0===d.length)d="";else for(var y in d){var m=d[y];d[y]=null==m?"":m.toString()}else d=d.join(h.collectionFormat);if(!h.skipEncoding)if(Array.isArray(d))for(var y in d)d[y]=encodeURIComponent(d[y]);else d=encodeURIComponent(d);a.setQueryParameter(h.mapper.serializedName||L(h),d)}}o.url=a.toString();var v=t.contentType||this.requestContentType;if(v&&o.headers.set("Content-Type",v),t.headerParameters)for(var g=0,b=t.headerParameters;g<b.length;g++){var E=b[g],w=ze(this,e,E,t.serializer);if(null!=w){w=t.serializer.serialize(E.mapper,w,L(E));var R=E.mapper.headerCollectionPrefix;if(R)for(var _=0,T=Object.keys(w);_<T.length;_++){var P=T[_];o.headers.set(R+P,w[P])}else o.headers.set(E.mapper.serializedName||L(E),w)}}var S=e.options;if(S){if(S.customHeaders)for(var O in S.customHeaders)o.headers.set(O,S.customHeaders[O]);S.abortSignal&&(o.abortSignal=S.abortSignal),S.timeout&&(o.timeout=S.timeout),S.onUploadProgress&&(o.onUploadProgress=S.onUploadProgress),S.onDownloadProgress&&(o.onDownloadProgress=S.onDownloadProgress)}o.withCredentials=this._withCredentials,function(e,t,r,n){if(n.requestBody&&n.requestBody.mapper){t.body=ze(e,r,n.requestBody,n.serializer);var o=n.requestBody.mapper,i=o.required,a=o.xmlName,s=o.xmlElementName,u=o.serializedName,l=o.type.name;try{if(null!=t.body||i){var c=L(n.requestBody);t.body=n.serializer.serialize(o,t.body,c);var f=l===q.Stream;n.isXML?l===q.Sequence?t.body=X((v=t.body,g=s||a||u,Array.isArray(v)||(v=[v]),(b={})[g]=v,b),{rootName:a||u}):f||(t.body=X(t.body,{rootName:a||u})):f||(t.body=JSON.stringify(t.body))}}catch(e){throw new Error('Error "'+e.message+'" occurred in serializing the payload - '+JSON.stringify(u,void 0," ")+".")}}else if(n.formDataParameters&&0<n.formDataParameters.length){t.formData={};for(var p=0,h=n.formDataParameters;p<h.length;p++){var d=h[p],y=ze(e,r,d,n.serializer);if(null!=y){var m=d.mapper.serializedName||L(d);t.formData[m]=n.serializer.serialize(d.mapper,y,L(d))}}}var v,g,b}(this,o,e,t),null==o.streamResponseBody&&(o.streamResponseBody=B(t)),n=this.sendRequest(o).then(function(e){return Le(e,t.responses[e.status])})}catch(e){n=Promise.reject(e)}var x=r;return x&&n.then(function(e){return x(null,e._response.parsedBody,e._response.request,e._response)}).catch(function(e){return x(e)}),n},e}();function Me(e,t){var r;return"string"==typeof e?r=e:(r=t(),"function"==typeof e&&(r=e(r))),r}function ze(e,t,r,n){return function e(t,r,n,o,i){var a;"string"==typeof n&&(n=[n]);if(Array.isArray(n)){if(0<n.length){if(o.isConstant)a=o.defaultValue;else{var s=je(r,n);s.propertyFound||(s=je(t,n));var u=!1;s.propertyFound||(u=o.required||"options"===n[0]&&2===n.length),a=u?o.defaultValue:s.propertyValue}var l=k(n,o);i.serialize(o,a,l)}}else for(var c in n){var f=o.type.modelProperties[c],p=n[c],h=e(t,r,p,f,i),d=k(p,f);i.serialize(f,h,d),void 0!==h&&(a||(a={}),a[c]=h)}return a}(e,t,r.parameterPath,r.mapper,n)}function je(e,t){for(var r={propertyFound:!1},n=0;n<t.length;++n){var o=t[n];if(!(null!=e&&o in e))break;e=e[o]}return n===t.length&&(r.propertyValue=e,r.propertyFound=!0),r}function Le(t,e){var r=t.parsedHeaders,n=e&&e.bodyMapper,o=function(e){return Object.defineProperty(e,"_response",{value:t})};if(n){var i=n.type.name;if("Stream"===i)return o(T({},r,{blobBody:t.blobBody,readableStreamBody:t.readableStreamBody}));var a="Composite"===i&&n.type.modelProperties||{},s=Object.keys(a).some(function(e){return""===a[e].serializedName});if("Sequence"===i||s){for(var u=(t.parsedBody||[]).slice(),l=0,c=Object.keys(a);l<c.length;l++){var f=c[l];a[f].serializedName&&(u[f]=t.parsedBody[f])}if(r)for(var p=0,h=Object.keys(r);p<h.length;p++){u[f=h[p]]=r[f]}return o(u),u}if("Composite"===i||"Dictionary"===i)return o(T({},r,t.parsedBody))}return n||"HEAD"===t.request.method?o(T({},r,{body:t.parsedBody})):o(T({},r,t.parsedBody))}var ke=function(o){function e(e,t,r){void 0===r&&(r=console.log);var n=o.call(this,e,t)||this;return n.logger=r,n}return _(e,o),e.prototype.sendRequest=function(e){var t=this;return this._nextPolicy.sendRequest(e).then(function(e){return function(e,t){e.logger(">> Request: "+JSON.stringify(t.request,void 0,2)),e.logger(">> Response status code: "+t.status);var r=t.bodyAsText;return e.logger(">> Body: "+r),Promise.resolve(t)}(t,e)})},e}(J);var Be=c.HeaderConstants,Fe=function(){function e(e,t){if(void 0===t&&(t="Bearer"),this.authorizationScheme="Bearer",!e)throw new Error("token cannot be null or undefined.");this.token=e,this.authorizationScheme=t}return e.prototype.signRequest=function(e){return e.headers||(e.headers=new p),e.headers.set(Be.AUTHORIZATION,this.authorizationScheme+" "+this.token),Promise.resolve(e)},e}(),$e=c.HeaderConstants,Qe=function(){function e(e,t,r){if(void 0===r&&(r="Basic"),this.authorizationScheme="Basic",null==e||"string"!=typeof e.valueOf())throw new Error("userName cannot be null or undefined and must be of type string.");if(null==t||"string"!=typeof t.valueOf())throw new Error("password cannot be null or undefined and must be of type string.");this.userName=e,this.password=t,this.authorizationScheme=r}return e.prototype.signRequest=function(e){var t=this.userName+":"+this.password,r=this.authorizationScheme+" "+btoa(t);return e.headers||(e.headers=new p),e.headers.set($e.AUTHORIZATION,r),Promise.resolve(e)},e}(),Ve=function(){function e(e){if(!e||e&&!e.inHeader&&!e.inQuery)throw new Error('options cannot be null or undefined. Either "inHeader" or "inQuery" property of the options object needs to be provided.');this.inHeader=e.inHeader,this.inQuery=e.inQuery}return e.prototype.signRequest=function(e){if(!e)return Promise.reject(new Error('webResource cannot be null or undefined and must be of type "object".'));if(this.inHeader)for(var t in e.headers||(e.headers=new p),this.inHeader)e.headers.set(t,this.inHeader[t]);if(this.inQuery){if(!e.url)return Promise.reject(new Error("url cannot be null in the request object."));for(var r in e.url.indexOf("?")<0&&(e.url+="?"),this.inQuery)e.url.endsWith("?")||(e.url+="&"),e.url+=r+"="+this.inQuery[r]}return Promise.resolve(e)},e}(),Ye=function(r){function e(e){if(!e||e&&"string"!=typeof e)throw new Error("topicKey cannot be null or undefined and must be of type string.");var t={inHeader:{"aeg-sas-key":e}};return r.call(this,t)||this}return _(e,r),e}(Ve);N.WebResource=A,N.DefaultHttpClient=C,N.HttpHeaders=p,N.RestError=x,N.ServiceClient=He,N.flattenResponse=Le,N.Constants=c,N.logPolicy=function(r){return void 0===r&&(r=console.log),{create:function(e,t){return new ke(e,t,r)}}},N.BaseRequestPolicy=J,N.RequestPolicyOptions=G,N.exponentialRetryPolicy=ne,N.systemErrorRetryPolicy=xe,N.redirectPolicy=Re,N.signingPolicy=Se,N.userAgentPolicy=ce,N.getDefaultUserAgentValue=le,N.deserializationPolicy=K,N.deserializeResponseBody=re,N.MapperType=q,N.Serializer=E,N.serializeObject=function e(t){if(null!=t){if(t instanceof Uint8Array)return t=s(t);if(t instanceof Date)return t.toISOString();if(Array.isArray(t)){for(var r=[],n=0;n<t.length;n++)r.push(e(t[n]));return r}if("object"!=typeof t)return t;var o={};for(var i in t)o[i]=e(t[i]);return o}},N.stripRequest=g,N.stripResponse=v,N.delay=h,N.executePromisesSequentially=function(e,t){var r=Promise.resolve(t);return e.forEach(function(e){r=r.then(e)}),r},N.generateUuid=y,N.encodeUri=function(e){return encodeURIComponent(e).replace(/!/g,"%21").replace(/"/g,"%27").replace(/\(/g,"%28").replace(/\)/g,"%29").replace(/\*/g,"%2A")},N.promiseToCallback=function(e){if("function"!=typeof e.then)throw new Error("The provided input is not a Promise.");return function(t){e.then(function(e){t(void 0,e)},function(e){t(e)})}},N.promiseToServiceCallback=function(e){if("function"!=typeof e.then)throw new Error("The provided input is not a Promise.");return function(t){e.then(function(e){process.nextTick(t,void 0,e.parsedBody,e.request,e)},function(e){process.nextTick(t,e)})}},N.isValidUuid=f,N.applyMixins=function(r,e){e.forEach(function(t){Object.getOwnPropertyNames(t.prototype).forEach(function(e){r.prototype[e]=t.prototype[e]})})},N.isNode=i,N.isDuration=m,N.URLBuilder=he,N.URLQuery=pe,N.TokenCredentials=Fe,N.BasicAuthenticationCredentials=Qe,N.ApiKeyCredentials=Ve,N.TopicCredentials=Ye,Object.defineProperty(N,"__esModule",{value:!0})});
import { HttpOperationResponse } from "../httpOperationResponse";
import { WebResource } from "../webResource";
import { getDefaultUserAgentKey } from "./msRestUserAgentPolicy";
import { BaseRequestPolicy, RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "./requestPolicy";

@@ -8,2 +9,3 @@ export declare type TelemetryInfo = {

};
export declare const getDefaultUserAgentHeaderName: typeof getDefaultUserAgentKey;
export declare function getDefaultUserAgentValue(): string;

@@ -10,0 +12,0 @@ export declare function userAgentPolicy(userAgentData?: TelemetryInfo): RequestPolicyFactory;

@@ -23,2 +23,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

}
export var getDefaultUserAgentHeaderName = getDefaultUserAgentKey;
export function getDefaultUserAgentValue() {

@@ -25,0 +26,0 @@ var runtimeInfo = getRuntimeInfo();

@@ -68,2 +68,8 @@ import { ServiceClientCredentials } from "./credentials/serviceClientCredentials";

/**
* The header name to use for the telemetry header while sending the request. If this is not
* specified, then "User-Agent" will be used when running on Node.js and "x-ms-command-name" will
* be used when running in a browser.
*/
userAgentHeaderName?: string | ((defaultUserAgentHeaderName: string) => string);
/**
* The string to be set to the telemetry header while sending the request, or a function that

@@ -70,0 +76,0 @@ * takes in the default user-agent string and returns the user-agent string that will be used.

@@ -10,3 +10,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

import { generateClientRequestIdPolicy } from "./policies/generateClientRequestIdPolicy";
import { userAgentPolicy, getDefaultUserAgentValue } from "./policies/userAgentPolicy";
import { userAgentPolicy, getDefaultUserAgentHeaderName, getDefaultUserAgentValue } from "./policies/userAgentPolicy";
import { redirectPolicy } from "./policies/redirectPolicy";

@@ -271,2 +271,15 @@ import { RequestPolicyOptions } from "./policies/requestPolicy";

}
function getValueOrFunctionResult(value, defaultValueCreator) {
var result;
if (typeof value === "string") {
result = value;
}
else {
result = defaultValueCreator();
if (typeof value === "function") {
result = value(result);
}
}
return result;
}
function createDefaultRequestPolicyFactories(credentials, options) {

@@ -285,13 +298,7 @@ var factories = [];

}
var userAgentString;
if (typeof options.userAgent === "string") {
userAgentString = options.userAgent;
var userAgentHeaderName = getValueOrFunctionResult(options.userAgentHeaderName, getDefaultUserAgentHeaderName);
var userAgentHeaderValue = getValueOrFunctionResult(options.userAgent, getDefaultUserAgentValue);
if (userAgentHeaderName && userAgentHeaderValue) {
factories.push(userAgentPolicy({ key: userAgentHeaderName, value: userAgentHeaderValue }));
}
else {
userAgentString = getDefaultUserAgentValue();
if (typeof options.userAgent === "function") {
userAgentString = options.userAgent(userAgentString);
}
}
factories.push(userAgentPolicy({ value: userAgentString }));
factories.push(redirectPolicy());

@@ -298,0 +305,0 @@ factories.push(rpRegistrationPolicy(options.rpRegistrationRetryTimeout));

@@ -9,3 +9,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

*/
msRestVersion: "1.6.0",
msRestVersion: "1.7.0",
/**

@@ -12,0 +12,0 @@ * Specifies HTTP.

@@ -29,2 +29,4 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

export const getDefaultUserAgentHeaderName = getDefaultUserAgentKey;
export function getDefaultUserAgentValue(): string {

@@ -31,0 +33,0 @@ const runtimeInfo = getRuntimeInfo();

@@ -15,3 +15,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

import { generateClientRequestIdPolicy } from "./policies/generateClientRequestIdPolicy";
import { userAgentPolicy, getDefaultUserAgentValue } from "./policies/userAgentPolicy";
import { userAgentPolicy, getDefaultUserAgentHeaderName, getDefaultUserAgentValue } from "./policies/userAgentPolicy";
import { redirectPolicy } from "./policies/redirectPolicy";

@@ -89,2 +89,8 @@ import { RequestPolicy, RequestPolicyFactory, RequestPolicyOptions } from "./policies/requestPolicy";

/**
* The header name to use for the telemetry header while sending the request. If this is not
* specified, then "User-Agent" will be used when running on Node.js and "x-ms-command-name" will
* be used when running in a browser.
*/
userAgentHeaderName?: string | ((defaultUserAgentHeaderName: string) => string);
/**
* The string to be set to the telemetry header while sending the request, or a function that

@@ -379,2 +385,15 @@ * takes in the default user-agent string and returns the user-agent string that will be used.

function getValueOrFunctionResult(value: undefined | string | ((defaultValue: string) => string), defaultValueCreator: (() => string)): string {
let result: string;
if (typeof value === "string") {
result = value;
} else {
result = defaultValueCreator();
if (typeof value === "function") {
result = value(result);
}
}
return result;
}
function createDefaultRequestPolicyFactories(credentials: ServiceClientCredentials | RequestPolicyFactory | undefined, options: ServiceClientOptions): RequestPolicyFactory[] {

@@ -395,12 +414,7 @@ const factories: RequestPolicyFactory[] = [];

let userAgentString: string;
if (typeof options.userAgent === "string") {
userAgentString = options.userAgent;
} else {
userAgentString = getDefaultUserAgentValue();
if (typeof options.userAgent === "function") {
userAgentString = options.userAgent(userAgentString);
}
const userAgentHeaderName: string = getValueOrFunctionResult(options.userAgentHeaderName, getDefaultUserAgentHeaderName);
const userAgentHeaderValue: string = getValueOrFunctionResult(options.userAgent, getDefaultUserAgentValue);
if (userAgentHeaderName && userAgentHeaderValue) {
factories.push(userAgentPolicy({ key: userAgentHeaderName, value: userAgentHeaderValue }));
}
factories.push(userAgentPolicy({ value: userAgentString }));
factories.push(redirectPolicy());

@@ -407,0 +421,0 @@ factories.push(rpRegistrationPolicy(options.rpRegistrationRetryTimeout));

@@ -11,3 +11,3 @@ // Copyright (c) Microsoft Corporation. All rights reserved.

*/
msRestVersion: "1.6.0",
msRestVersion: "1.7.0",

@@ -14,0 +14,0 @@ /**

@@ -8,3 +8,3 @@ {

},
"version": "1.6.0",
"version": "1.7.0",
"description": "Isomorphic client Runtime for Typescript/node.js/browser javascript client libraries generated using AutoRest",

@@ -11,0 +11,0 @@ "tags": [

Sorry, the diff of this file is too big to display

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 too big to display

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

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