/*! For license information please see cdn.bundle.js.LICENSE.txt */
(()=>{var t,e,n={559:(t,e,n)=>{"use strict";Object.defineProperty(e,"__esModule",{value:!0});var i,r=(i={},"undefined"!=typeof window&&(i=window),i.vp=i.vp||{},i.vp.auth=i.vp.auth||{},i.vp.auth.deps=i.vp.auth.deps||null,i.vp.auth.cache=i.vp.auth.cache||null,i),o=function(){return r.vp.auth.deps},s=function(t){t&&(r.vp.auth.deps=t)},a=function(){return null!==r.vp.auth.deps},u=function(){return r.vp.auth.cache},c=function(t){t&&(r.vp.auth.cache=t)},h=function(){return null!==r.vp.auth.cache},p="a00e1368c32c471cb7e2ba0defd99a1a",l="cimpress.auth0.com",f=/([cenuw]{1})([0-9]{10})([a-zA-Z0-9]*)/g;function d(t){var e=t.split(".");try{var n=e[1];return JSON.parse(atob(n))}catch(t){return null}}var g={parse:d,getCanonicalId:function(t){return t["https://claims.cimpress.io/canonical_id"]},getRecentAnonymousIds:function(t){return t["https://claims.cimpress.io/was"]},isValidToken:function(t){return d(t).exp-Math.round(Date.now()/1e3)>7200}};function y(t){return(y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function m(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function v(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function w(t){return function(t){if(Array.isArray(t))return t}(t)||function(t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(t))return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return b(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?b(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function b(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,i=new Array(e);n<e;n++)i[n]=t[n];return i}var _=["vistaprint","vista","proshopnext","ourproshop"],T=function(t){if(!t)return null;for(var e=t.split(".").slice(-3),n=e.length-1;n>=0;n-=1){var i=e[n];if(_.indexOf(i)>=0)return e.slice(n).join(".")}return t};function k(t,e,n){var i=T(window.location.hostname);document.cookie=t+"="+e+";expires="+n+";path=/;domain="+i}function O(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=null;try{return document.cookie.split(";").every((function(e){var i=w(e.trim().split("=")),r=i[0],o=i.slice(1);return r!==t||(n=o.join("="),!1)})),n&&e?JSON.parse(n):n}catch(e){return console.error("Unable to parse cookie value for - ".concat(t)),null}}var I={setPresumedLoginState:function(){var t=new Date;t.setTime(t.getTime()+2592e6),k("_pls",1,t.toUTCString())},deletePresumedLoginState:function(){k("_pls","","Thu, 01 Jan 1970 00:00:00 UTC")},getPresumedLoginState:function(){return O("_pls")},setAnonymousIdentityState:function(t,e,n){var i=new Date;i.setTime(i.getTime()+864e8);var r=i.toUTCString(),o={id:t,nonce:e,anonKey:n};k("anon",JSON.stringify(o),r)},getAnonymousIdentityState:function(){return O("anon")},deleteAnonymousIdentityState:function(){k("anon","","Thu, 01 Jan 1970 00:00:00 UTC")},getOptimizelyId:function(){return O("testUserId",!1)||O("optimizelyEndUserId",!1)},setAuthCookie:function(t){var e=new Date;e.setTime(e.getTime()+2592e6);var n=e.toUTCString();k("vpauth",JSON.stringify(t),n)},getAuthCookie:function(){return O("vpauth")},deleteAuthCookie:function(){k("vpauth","","Thu, 01 Jan 1970 00:00:00 UTC")},getCookie:O,setSessionCookie:function(t){var e=new Date;e.setTime(e.getTime()+2592e6),k("vpsession",t,e.toUTCString())},getSessionCookie:function(){return O("vpsession",!1)},deleteSessionCookie:function(){k("vpsession","","Thu, 01 Jan 1970 00:00:00 UTC")},setConfigCookie:function(t,e){var n=new Date;n.setTime(n.getTime()+2592e6);var i=n.toUTCString();k("vpconfig",JSON.stringify({clientId:t,domain:e}),i)},getConfigCookie:function(){return O("vpconfig")},deleteConfigCookie:function(){k("vpconfig","","Thu, 01 Jan 1970 00:00:00 UTC")}},E="https://sessions.cimpress.io/v1/sessions";function S(t){var e=I.getSessionCookie();if(e&&e.match(f)){var n=new XMLHttpRequest;n.onload=C,n.onerror=C,n.passToken=t,n.open("PUT","".concat(E,"/").concat(e,"/tokens")),n.setRequestHeader("Content-Type","application/json; charset=utf-8"),n.send(JSON.stringify({accessToken:t}))}}function C(){if(200===this.status)var t;else if(console.log("Unable to update session from Sessions service. Status:"+this.status),[408,429,500,502,503,504,522,524].includes(xhr.status)){if(0===this.retryCount)return;this.retryCount=this.retryCount-1,t=this.passToken,setTimeout((function(){S(t)}),12e4)}}function A(){204===this.status||console.log("Unable to close session from Sessions service. Status:"+this.status)}var U={createSession:function(t,e,n){var i=new XMLHttpRequest;i.onload=function(){if(201===this.status){var e=JSON.parse(this.response).sessionId;I.setSessionCookie(e)}window.location=decodeURIComponent(t.redirectUrl)},i.onerror=function(){console.log("Unable to create a new session from Sessions service having the origin"+window.location.origin),window.location=decodeURIComponent(t.redirectUrl)},i.open("POST",E),i.setRequestHeader("Content-Type","application/json; charset=utf-8"),i.send(JSON.stringify({origin:window.location.origin,clientId:t.clientId||e.oidc.clientID,accessToken:n.accessToken}))},updateSession:S,closeSession:function(t){if(t.match(f)){var e=new XMLHttpRequest;e.onload=A,e.onerror=A,e.open("POST","".concat(E,"/").concat(t,"/lifecycle/logout")),e.send()}}},R=["signUp"];function x(t){this.connection=t.connection,this.site=t.site,this.culture=t.culture,this.allowGuestUser=t.allowGuestUser,this.guestReturnUrl=t.guestReturnUrl,this.clientId=t.oidc&&t.oidc.clientID,this.domain=t.oidc&&t.oidc.domain,this.hasAnonymousId=!1,this.hasCulture=!1,this.skipFasterCheckoutText=!0===t.skipFasterCheckoutText,this.loginContext=t.loginContext,this.navHint=t.navHint,this.originUrl=String(window.location.href).split("?")[0],this.requireSession=!0===t.requireSession,this.customText=t.customText,this.enableGoogleOneTap=!0===t.enableGoogleOneTap,this.enforcedEmail=t.enforcedEmail,this.isFirstLogin=!0===t.isFirstLogin,this.isSteppedUp=!0===t.isSteppedUp,this.unificationEntityId=t.unificationEntityId,this.vcsStoreUrl=t.vcsStoreUrl,this.testUserId=t.testUserId,this.storeId=t.storeId,this.vcsStoreLogoUrl=t.vcsStoreLogoUrl,this.restrictSignup=!0===t.restrictSignup,this.disableEmailField=!0===t.disableEmailField,this.anonReferenceToken=void 0}function D(){for(var t=((window.location||{}).host||"").split("."),e={promotique:"Promotique","99designs":"99designs",vistacreate:"vistacreate"},n=Object.keys(e),i=0;i<t.length;i++)if(n.includes(t[i]))return e[t[i]];return"Vistaprint"}function B(t,e,n,i,r){var o={redirectUrl:t,wauth:e,clientId:n,requireSession:i,domain:r};return btoa(JSON.stringify(o))}x.prototype.withReturnUrl=function(t){if(!t)throw new Error("[AuthOptionsBuilder] Error: ReturnUrl is not provided.");return this.returnUrl=t,this},x.prototype.withAnonymousId=function(t){return this.hasAnonymousId=!0,t&&!t.match(f)&&(this.anonReferenceToken=t),this},x.prototype.withCulture=function(){return this.hasCulture=!0,this},x.prototype.build=function(){if(!this.returnUrl)throw new Error("[AuthOptionsBuilder] Error: ReturnUrl was not set up.");var t;return-1===this.connection.indexOf("-waad")&&(t=function(t,e,n,i,r,o,s,a,u,c,h,p,l,f,d,g,y,m,v,w,b,_,T,k){var O={site:s||D()};if(t){var E=I.getAnonymousIdentityState();E&&(_?(O.anonReferenceToken=_,O.anonymousId=encodeURIComponent(E.id)):(O.anonymousId=encodeURIComponent(E.id),O.validationKey=encodeURIComponent(E.nonce),O.anonKey=E.anonKey&&encodeURIComponent(E.anonKey)))}var S=I.getOptimizelyId();S&&(O.optimizelyId=S),m&&(O.optimizelyId=m),v&&(O.storeId=v),e&&n&&(O.culture=n),o&&(O.redirectUrl=o),i&&(O.guestReturnUrl=r||o),a&&(O.skipFasterCheckoutText=!0),u&&(O.loginContext=u),c&&(R.includes(c)?O.navHint=c:console.error("Invalid nav hint value passed - ",c)),h&&(O.originUrl=h);var C=I.getCookie("_ga",!1);C&&(O.ga=C);var A=I.getCookie("visit",!1);return A&&(O.visit=A),p&&(O.customText=p),l&&(O.enableGoogleOneTap=l),f&&(O.enforcedEmail=f),d&&(O.isFirstLogin=d),b&&(O.isSteppedUp=b),g&&(O.unificationEntityId=g),y&&(O.vcsStoreUrl=y),w&&(O.vcsStoreLogoUrl=w),T&&(O.restrictSignup=T),k&&(O.disableEmailField=k),btoa(JSON.stringify(O))}(this.hasAnonymousId,this.hasCulture,this.culture,this.allowGuestUser,this.guestReturnUrl,this.returnUrl,this.site,this.skipFasterCheckoutText,this.loginContext,this.navHint,this.originUrl,this.customText,this.enableGoogleOneTap,this.enforcedEmail,this.isFirstLogin,this.unificationEntityId,this.vcsStoreUrl,this.testUserId,this.storeId,this.vcsStoreLogoUrl,this.isSteppedUp,this.anonReferenceToken,this.restrictSignup,this.disableEmailField)),{connection:this.connection,state:B(this.returnUrl,t,this.clientId,this.requireSession,this.domain),wauth:t}};var P=x;function j(t){if(!t||!t.href||!t.origin)throw new Error("[ReturnUrlBuilder]: Parameter 'location' has to be specified and valid.");this.location=t,this.additionalQueryParams=[],this.additionalHashParams=[]}function L(t,e){return e?t+e:t}function q(t,e,n){if(0===e.length)return t;var i=e.map((function(t){return"".concat(t[0],"=").concat(t[1])})).join("&");return"".concat(t).concat(n).concat(i)}j.prototype.withAdditionalQueryParam=function(t,e){var n=encodeURIComponent(t),i=encodeURIComponent(e);return this.additionalQueryParams.push([n,i]),this},j.prototype.withAdditionalHashParam=function(t,e){var n=encodeURIComponent(t),i=encodeURIComponent(e);return this.additionalHashParams.push([n,i]),this},j.prototype.build=function(){if(0===this.additionalQueryParams.length&&0===this.additionalHashParams.length&&this.location.search.indexOf("askUserToLogin")<0)return this.location.href;var t=this.location.origin,e=this.location.search?function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"askUserToLogin",n=t.split("?");if(n.length>=2){for(var i=encodeURIComponent(e)+"=",r=n[1].split(/[&;]/g),o=r.length-1;o>=0;o--)-1!==r[o].lastIndexOf(i,0)&&r.splice(o,1);return n[0]+(r.length>0?"?"+r.join("&"):"")}return t}(this.location.search):"";return t=q(t=L(t=function(t,e){return e?t+e:t}(t,this.location.pathname),e),this.additionalQueryParams,e?"&":"?"),q(t=L(t,this.location.hash),this.additionalHashParams,e?"&":"#")};var M=j,N=function(t,e){!function(t,e){window&&window.tracking&&"function"==typeof window.tracking.track?window.tracking.track("Sign-in Flow Initiated",{caller:e}):console.warn("Tracking-js not found. Cannot track sign-in event.")}(0,t),e&&setTimeout(e,300)},H="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function V(t,e){return t(e={exports:{}},e.exports),e.exports}for(var W=V((function(t){"function"==typeof Object.create?t.exports=function(t,e){e&&(t.super_=e,t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(t,e){if(e){t.super_=e;var n=function(){};n.prototype=e.prototype,t.prototype=new n,t.prototype.constructor=t}}})),z=[],F=[],Y="undefined"!=typeof Uint8Array?Uint8Array:Array,K="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",J=0,X=K.length;J<X;++J)z[J]=K[J],F[K.charCodeAt(J)]=J;function $(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function Z(t,e,n){for(var i,r,o=[],s=e;s<n;s+=3)i=(t[s]<<16&16711680)+(t[s+1]<<8&65280)+(255&t[s+2]),o.push(z[(r=i)>>18&63]+z[r>>12&63]+z[r>>6&63]+z[63&r]);return o.join("")}F["-".charCodeAt(0)]=62,F["_".charCodeAt(0)]=63;var G=function(t){var e,n,i=$(t),r=i[0],o=i[1],s=new Y(function(t,e,n){return 3*(e+n)/4-n}(0,r,o)),a=0,u=o>0?r-4:r;for(n=0;n<u;n+=4)e=F[t.charCodeAt(n)]<<18|F[t.charCodeAt(n+1)]<<12|F[t.charCodeAt(n+2)]<<6|F[t.charCodeAt(n+3)],s[a++]=e>>16&255,s[a++]=e>>8&255,s[a++]=255&e;return 2===o&&(e=F[t.charCodeAt(n)]<<2|F[t.charCodeAt(n+1)]>>4,s[a++]=255&e),1===o&&(e=F[t.charCodeAt(n)]<<10|F[t.charCodeAt(n+1)]<<4|F[t.charCodeAt(n+2)]>>2,s[a++]=e>>8&255,s[a++]=255&e),s},Q=function(t){for(var e,n=t.length,i=n%3,r=[],o=0,s=n-i;o<s;o+=16383)r.push(Z(t,o,o+16383>s?s:o+16383));return 1===i?(e=t[n-1],r.push(z[e>>2]+z[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],r.push(z[e>>10]+z[e>>4&63]+z[e<<2&63]+"=")),r.join("")},tt=function(t,e,n,i,r){var o,s,a=8*r-i-1,u=(1<<a)-1,c=u>>1,h=-7,p=n?r-1:0,l=n?-1:1,f=t[e+p];for(p+=l,o=f&(1<<-h)-1,f>>=-h,h+=a;h>0;o=256*o+t[e+p],p+=l,h-=8);for(s=o&(1<<-h)-1,o>>=-h,h+=i;h>0;s=256*s+t[e+p],p+=l,h-=8);if(0===o)o=1-c;else{if(o===u)return s?NaN:1/0*(f?-1:1);s+=Math.pow(2,i),o-=c}return(f?-1:1)*s*Math.pow(2,o-i)},et=function(t,e,n,i,r,o){var s,a,u,c=8*o-r-1,h=(1<<c)-1,p=h>>1,l=23===r?Math.pow(2,-24)-Math.pow(2,-77):0,f=i?0:o-1,d=i?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=h):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),(e+=s+p>=1?l/u:l*Math.pow(2,1-p))*u>=2&&(s++,u/=2),s+p>=h?(a=0,s=h):s+p>=1?(a=(e*u-1)*Math.pow(2,r),s+=p):(a=e*Math.pow(2,p-1)*Math.pow(2,r),s=0));r>=8;t[n+f]=255&a,f+=d,a/=256,r-=8);for(s=s<<r|a,c+=r;c>0;t[n+f]=255&s,f+=d,s/=256,c-=8);t[n+f-d]|=128*g},nt={}.toString,it=Array.isArray||function(t){return"[object Array]"==nt.call(t)},rt=V((function(t,e){function n(){return r.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function i(t,e){if(n()<e)throw new RangeError("Invalid typed array length");return r.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=r.prototype:(null===t&&(t=new r(e)),t.length=e),t}function r(t,e,n){if(!(r.TYPED_ARRAY_SUPPORT||this instanceof r))return new r(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return a(this,t)}return o(this,t,e,n)}function o(t,e,n,o){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,i){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(i||0))throw new RangeError("'length' is out of bounds");return e=void 0===n&&void 0===i?new Uint8Array(e):void 0===i?new Uint8Array(e,n):new Uint8Array(e,n,i),r.TYPED_ARRAY_SUPPORT?(t=e).__proto__=r.prototype:t=u(t,e),t}(t,e,n,o):"string"==typeof e?function(t,e,n){if("string"==typeof n&&""!==n||(n="utf8"),!r.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var o=0|h(e,n),s=(t=i(t,o)).write(e,n);return s!==o&&(t=t.slice(0,s)),t}(t,e,n):function(t,e){if(r.isBuffer(e)){var n=0|c(e.length);return 0===(t=i(t,n)).length||e.copy(t,0,0,n),t}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(o=e.length)!=o?i(t,0):u(t,e);if("Buffer"===e.type&&it(e.data))return u(t,e.data)}var o;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function s(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function a(t,e){if(s(e),t=i(t,e<0?0:0|c(e)),!r.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function u(t,e){var n=e.length<0?0:0|c(e.length);t=i(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function c(t){if(t>=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|t}function h(t,e){if(r.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var i=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return j(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return L(t).length;default:if(i)return j(t).length;e=(""+e).toLowerCase(),i=!0}}function p(t,e,n){var i=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return I(this,e,n);case"utf8":case"utf-8":return T(this,e,n);case"ascii":return k(this,e,n);case"latin1":case"binary":return O(this,e,n);case"base64":return _(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,n);default:if(i)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),i=!0}}function l(t,e,n){var i=t[e];t[e]=t[n],t[n]=i}function f(t,e,n,i,o){if(0===t.length)return-1;if("string"==typeof n?(i=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=o?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(o)return-1;n=t.length-1}else if(n<0){if(!o)return-1;n=0}if("string"==typeof e&&(e=r.from(e,i)),r.isBuffer(e))return 0===e.length?-1:d(t,e,n,i,o);if("number"==typeof e)return e&=255,r.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?o?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):d(t,[e],n,i,o);throw new TypeError("val must be string, number or Buffer")}function d(t,e,n,i,r){var o,s=1,a=t.length,u=e.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(t.length<2||e.length<2)return-1;s=2,a/=2,u/=2,n/=2}function c(t,e){return 1===s?t[e]:t.readUInt16BE(e*s)}if(r){var h=-1;for(o=n;o<a;o++)if(c(t,o)===c(e,-1===h?0:o-h)){if(-1===h&&(h=o),o-h+1===u)return h*s}else-1!==h&&(o-=o-h),h=-1}else for(n+u>a&&(n=a-u),o=n;o>=0;o--){for(var p=!0,l=0;l<u;l++)if(c(t,o+l)!==c(e,l)){p=!1;break}if(p)return o}return-1}function g(t,e,n,i){n=Number(n)||0;var r=t.length-n;i?(i=Number(i))>r&&(i=r):i=r;var o=e.length;if(o%2!=0)throw new TypeError("Invalid hex string");i>o/2&&(i=o/2);for(var s=0;s<i;++s){var a=parseInt(e.substr(2*s,2),16);if(isNaN(a))return s;t[n+s]=a}return s}function y(t,e,n,i){return q(j(e,t.length-n),t,n,i)}function m(t,e,n,i){return q(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,i)}function v(t,e,n,i){return m(t,e,n,i)}function w(t,e,n,i){return q(L(e),t,n,i)}function b(t,e,n,i){return q(function(t,e){for(var n,i,r,o=[],s=0;s<t.length&&!((e-=2)<0);++s)i=(n=t.charCodeAt(s))>>8,r=n%256,o.push(r),o.push(i);return o}(e,t.length-n),t,n,i)}function _(t,e,n){return 0===e&&n===t.length?Q(t):Q(t.slice(e,n))}function T(t,e,n){n=Math.min(t.length,n);for(var i=[],r=e;r<n;){var o,s,a,u,c=t[r],h=null,p=c>239?4:c>223?3:c>191?2:1;if(r+p<=n)switch(p){case 1:c<128&&(h=c);break;case 2:128==(192&(o=t[r+1]))&&(u=(31&c)<<6|63&o)>127&&(h=u);break;case 3:o=t[r+1],s=t[r+2],128==(192&o)&&128==(192&s)&&(u=(15&c)<<12|(63&o)<<6|63&s)>2047&&(u<55296||u>57343)&&(h=u);break;case 4:o=t[r+1],s=t[r+2],a=t[r+3],128==(192&o)&&128==(192&s)&&128==(192&a)&&(u=(15&c)<<18|(63&o)<<12|(63&s)<<6|63&a)>65535&&u<1114112&&(h=u)}null===h?(h=65533,p=1):h>65535&&(h-=65536,i.push(h>>>10&1023|55296),h=56320|1023&h),i.push(h),r+=p}return function(t){var e=t.length;if(e<=4096)return String.fromCharCode.apply(String,t);for(var n="",i=0;i<e;)n+=String.fromCharCode.apply(String,t.slice(i,i+=4096));return n}(i)}function k(t,e,n){var i="";n=Math.min(t.length,n);for(var r=e;r<n;++r)i+=String.fromCharCode(127&t[r]);return i}function O(t,e,n){var i="";n=Math.min(t.length,n);for(var r=e;r<n;++r)i+=String.fromCharCode(t[r]);return i}function I(t,e,n){var i=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>i)&&(n=i);for(var r="",o=e;o<n;++o)r+=P(t[o]);return r}function E(t,e,n){for(var i=t.slice(e,n),r="",o=0;o<i.length;o+=2)r+=String.fromCharCode(i[o]+256*i[o+1]);return r}function S(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function C(t,e,n,i,o,s){if(!r.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>o||e<s)throw new RangeError('"value" argument is out of bounds');if(n+i>t.length)throw new RangeError("Index out of range")}function A(t,e,n,i){e<0&&(e=65535+e+1);for(var r=0,o=Math.min(t.length-n,2);r<o;++r)t[n+r]=(e&255<<8*(i?r:1-r))>>>8*(i?r:1-r)}function U(t,e,n,i){e<0&&(e=4294967295+e+1);for(var r=0,o=Math.min(t.length-n,4);r<o;++r)t[n+r]=e>>>8*(i?r:3-r)&255}function R(t,e,n,i,r,o){if(n+i>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function x(t,e,n,i,r){return r||R(t,0,n,4),et(t,e,n,i,23,4),n+4}function D(t,e,n,i,r){return r||R(t,0,n,8),et(t,e,n,i,52,8),n+8}e.Buffer=r,e.SlowBuffer=function(t){return+t!=t&&(t=0),r.alloc(+t)},e.INSPECT_MAX_BYTES=50,r.TYPED_ARRAY_SUPPORT=void 0!==H.TYPED_ARRAY_SUPPORT?H.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=n(),r.poolSize=8192,r._augment=function(t){return t.__proto__=r.prototype,t},r.from=function(t,e,n){return o(null,t,e,n)},r.TYPED_ARRAY_SUPPORT&&(r.prototype.__proto__=Uint8Array.prototype,r.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&r[Symbol.species]===r&&Object.defineProperty(r,Symbol.species,{value:null,configurable:!0})),r.alloc=function(t,e,n){return function(t,e,n,r){return s(e),e<=0?i(t,e):void 0!==n?"string"==typeof r?i(t,e).fill(n,r):i(t,e).fill(n):i(t,e)}(null,t,e,n)},r.allocUnsafe=function(t){return a(null,t)},r.allocUnsafeSlow=function(t){return a(null,t)},r.isBuffer=function(t){return!(null==t||!t._isBuffer)},r.compare=function(t,e){if(!r.isBuffer(t)||!r.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,i=e.length,o=0,s=Math.min(n,i);o<s;++o)if(t[o]!==e[o]){n=t[o],i=e[o];break}return n<i?-1:i<n?1:0},r.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},r.concat=function(t,e){if(!it(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return r.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var i=r.allocUnsafe(e),o=0;for(n=0;n<t.length;++n){var s=t[n];if(!r.isBuffer(s))throw new TypeError('"list" argument must be an Array of Buffers');s.copy(i,o),o+=s.length}return i},r.byteLength=h,r.prototype._isBuffer=!0,r.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)l(this,e,e+1);return this},r.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)l(this,e,e+3),l(this,e+1,e+2);return this},r.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)l(this,e,e+7),l(this,e+1,e+6),l(this,e+2,e+5),l(this,e+3,e+4);return this},r.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?T(this,0,t):p.apply(this,arguments)},r.prototype.equals=function(t){if(!r.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===r.compare(this,t)},r.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},r.prototype.compare=function(t,e,n,i,o){if(!r.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),e<0||n>t.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&e>=n)return 0;if(i>=o)return-1;if(e>=n)return 1;if(this===t)return 0;for(var s=(o>>>=0)-(i>>>=0),a=(n>>>=0)-(e>>>=0),u=Math.min(s,a),c=this.slice(i,o),h=t.slice(e,n),p=0;p<u;++p)if(c[p]!==h[p]){s=c[p],a=h[p];break}return s<a?-1:a<s?1:0},r.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},r.prototype.indexOf=function(t,e,n){return f(this,t,e,n,!0)},r.prototype.lastIndexOf=function(t,e,n){return f(this,t,e,n,!1)},r.prototype.write=function(t,e,n,i){if(void 0===e)i="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)i=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===i&&(i="utf8")):(i=n,n=void 0)}var r=this.length-e;if((void 0===n||n>r)&&(n=r),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return g(this,t,e,n);case"utf8":case"utf-8":return y(this,t,e,n);case"ascii":return m(this,t,e,n);case"latin1":case"binary":return v(this,t,e,n);case"base64":return w(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b(this,t,e,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},r.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},r.prototype.slice=function(t,e){var n,i=this.length;if((t=~~t)<0?(t+=i)<0&&(t=0):t>i&&(t=i),(e=void 0===e?i:~~e)<0?(e+=i)<0&&(e=0):e>i&&(e=i),e<t&&(e=t),r.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=r.prototype;else{var o=e-t;n=new r(o,void 0);for(var s=0;s<o;++s)n[s]=this[s+t]}return n},r.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||S(t,e,this.length);for(var i=this[t],r=1,o=0;++o<e&&(r*=256);)i+=this[t+o]*r;return i},r.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||S(t,e,this.length);for(var i=this[t+--e],r=1;e>0&&(r*=256);)i+=this[t+--e]*r;return i},r.prototype.readUInt8=function(t,e){return e||S(t,1,this.length),this[t]},r.prototype.readUInt16LE=function(t,e){return e||S(t,2,this.length),this[t]|this[t+1]<<8},r.prototype.readUInt16BE=function(t,e){return e||S(t,2,this.length),this[t]<<8|this[t+1]},r.prototype.readUInt32LE=function(t,e){return e||S(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},r.prototype.readUInt32BE=function(t,e){return e||S(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},r.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||S(t,e,this.length);for(var i=this[t],r=1,o=0;++o<e&&(r*=256);)i+=this[t+o]*r;return i>=(r*=128)&&(i-=Math.pow(2,8*e)),i},r.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||S(t,e,this.length);for(var i=e,r=1,o=this[t+--i];i>0&&(r*=256);)o+=this[t+--i]*r;return o>=(r*=128)&&(o-=Math.pow(2,8*e)),o},r.prototype.readInt8=function(t,e){return e||S(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},r.prototype.readInt16LE=function(t,e){e||S(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},r.prototype.readInt16BE=function(t,e){e||S(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},r.prototype.readInt32LE=function(t,e){return e||S(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},r.prototype.readInt32BE=function(t,e){return e||S(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},r.prototype.readFloatLE=function(t,e){return e||S(t,4,this.length),tt(this,t,!0,23,4)},r.prototype.readFloatBE=function(t,e){return e||S(t,4,this.length),tt(this,t,!1,23,4)},r.prototype.readDoubleLE=function(t,e){return e||S(t,8,this.length),tt(this,t,!0,52,8)},r.prototype.readDoubleBE=function(t,e){return e||S(t,8,this.length),tt(this,t,!1,52,8)},r.prototype.writeUIntLE=function(t,e,n,i){t=+t,e|=0,n|=0,i||C(this,t,e,n,Math.pow(2,8*n)-1,0);var r=1,o=0;for(this[e]=255&t;++o<n&&(r*=256);)this[e+o]=t/r&255;return e+n},r.prototype.writeUIntBE=function(t,e,n,i){t=+t,e|=0,n|=0,i||C(this,t,e,n,Math.pow(2,8*n)-1,0);var r=n-1,o=1;for(this[e+r]=255&t;--r>=0&&(o*=256);)this[e+r]=t/o&255;return e+n},r.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,1,255,0),r.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},r.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):A(this,t,e,!0),e+2},r.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,65535,0),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):A(this,t,e,!1),e+2},r.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):U(this,t,e,!0),e+4},r.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,4294967295,0),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},r.prototype.writeIntLE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);C(this,t,e,n,r-1,-r)}var o=0,s=1,a=0;for(this[e]=255&t;++o<n&&(s*=256);)t<0&&0===a&&0!==this[e+o-1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},r.prototype.writeIntBE=function(t,e,n,i){if(t=+t,e|=0,!i){var r=Math.pow(2,8*n-1);C(this,t,e,n,r-1,-r)}var o=n-1,s=1,a=0;for(this[e+o]=255&t;--o>=0&&(s*=256);)t<0&&0===a&&0!==this[e+o+1]&&(a=1),this[e+o]=(t/s>>0)-a&255;return e+n},r.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,1,127,-128),r.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},r.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):A(this,t,e,!0),e+2},r.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,2,32767,-32768),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):A(this,t,e,!1),e+2},r.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,2147483647,-2147483648),r.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):U(this,t,e,!0),e+4},r.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||C(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),r.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):U(this,t,e,!1),e+4},r.prototype.writeFloatLE=function(t,e,n){return x(this,t,e,!0,n)},r.prototype.writeFloatBE=function(t,e,n){return x(this,t,e,!1,n)},r.prototype.writeDoubleLE=function(t,e,n){return D(this,t,e,!0,n)},r.prototype.writeDoubleBE=function(t,e,n){return D(this,t,e,!1,n)},r.prototype.copy=function(t,e,n,i){if(n||(n=0),i||0===i||(i=this.length),e>=t.length&&(e=t.length),e||(e=0),i>0&&i<n&&(i=n),i===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-e<i-n&&(i=t.length-e+n);var o,s=i-n;if(this===t&&n<e&&e<i)for(o=s-1;o>=0;--o)t[o+e]=this[o+n];else if(s<1e3||!r.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)t[o+e]=this[o+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+s),e);return s},r.prototype.fill=function(t,e,n,i){if("string"==typeof t){if("string"==typeof e?(i=e,e=0,n=this.length):"string"==typeof n&&(i=n,n=this.length),1===t.length){var o=t.charCodeAt(0);o<256&&(t=o)}if(void 0!==i&&"string"!=typeof i)throw new TypeError("encoding must be a string");if("string"==typeof i&&!r.isEncoding(i))throw new TypeError("Unknown encoding: "+i)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var s;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=e;s<n;++s)this[s]=t;else{var a=r.isBuffer(t)?t:j(new r(t,i).toString()),u=a.length;for(s=0;s<n-e;++s)this[s+e]=a[s%u]}return this};var B=/[^+\/0-9A-Za-z-_]/g;function P(t){return t<16?"0"+t.toString(16):t.toString(16)}function j(t,e){var n;e=e||1/0;for(var i=t.length,r=null,o=[],s=0;s<i;++s){if((n=t.charCodeAt(s))>55295&&n<57344){if(!r){if(n>56319){(e-=3)>-1&&o.push(239,191,189);continue}if(s+1===i){(e-=3)>-1&&o.push(239,191,189);continue}r=n;continue}if(n<56320){(e-=3)>-1&&o.push(239,191,189),r=n;continue}n=65536+(r-55296<<10|n-56320)}else r&&(e-=3)>-1&&o.push(239,191,189);if(r=null,n<128){if((e-=1)<0)break;o.push(n)}else if(n<2048){if((e-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function L(t){return G(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(B,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function q(t,e,n,i){for(var r=0;r<i&&!(r+n>=e.length||r>=t.length);++r)e[r+n]=t[r];return r}})),ot=(rt.Buffer,rt.SlowBuffer,rt.INSPECT_MAX_BYTES,rt.kMaxLength,V((function(t,e){var n=rt.Buffer;function i(t,e){for(var n in t)e[n]=t[n]}function r(t,e,i){return n(t,e,i)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?t.exports=rt:(i(rt,e),e.Buffer=r),r.prototype=Object.create(n.prototype),i(n,r),r.from=function(t,e,i){if("number"==typeof t)throw new TypeError("Argument must not be a number");return n(t,e,i)},r.alloc=function(t,e,i){if("number"!=typeof t)throw new TypeError("Argument must be a number");var r=n(t);return void 0!==e?"string"==typeof i?r.fill(e,i):r.fill(e):r.fill(0),r},r.allocUnsafe=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return n(t)},r.allocUnsafeSlow=function(t){if("number"!=typeof t)throw new TypeError("Argument must be a number");return rt.SlowBuffer(t)}}))),st=(ot.Buffer,ot.Buffer);function at(t,e){this._block=st.alloc(t),this._finalSize=e,this._blockSize=t,this._len=0}at.prototype.update=function(t,e){"string"==typeof t&&(e=e||"utf8",t=st.from(t,e));for(var n=this._block,i=this._blockSize,r=t.length,o=this._len,s=0;s<r;){for(var a=o%i,u=Math.min(r-s,i-a),c=0;c<u;c++)n[a+c]=t[s+c];s+=u,(o+=u)%i==0&&this._update(n)}return this._len+=r,this},at.prototype.digest=function(t){var e=this._len%this._blockSize;this._block[e]=128,this._block.fill(0,e+1),e>=this._finalSize&&(this._update(this._block),this._block.fill(0));var n=8*this._len;if(n<=4294967295)this._block.writeUInt32BE(n,this._blockSize-4);else{var i=(4294967295&n)>>>0,r=(n-i)/4294967296;this._block.writeUInt32BE(r,this._blockSize-8),this._block.writeUInt32BE(i,this._blockSize-4)}this._update(this._block);var o=this._hash();return t?o.toString(t):o},at.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var ut=at,ct=ot.Buffer,ht=[1518500249,1859775393,-1894007588,-899497514],pt=new Array(80);function lt(){this.init(),this._w=pt,ut.call(this,64,56)}function ft(t){return t<<30|t>>>2}function dt(t,e,n,i){return 0===t?e&n|~e&i:2===t?e&n|e&i|n&i:e^n^i}W(lt,ut),lt.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},lt.prototype._update=function(t){for(var e,n=this._w,i=0|this._a,r=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,u=0;u<16;++u)n[u]=t.readInt32BE(4*u);for(;u<80;++u)n[u]=n[u-3]^n[u-8]^n[u-14]^n[u-16];for(var c=0;c<80;++c){var h=~~(c/20),p=0|((e=i)<<5|e>>>27)+dt(h,r,o,s)+a+n[c]+ht[h];a=s,s=o,o=ft(r),r=i,i=p}this._a=i+this._a|0,this._b=r+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},lt.prototype._hash=function(){var t=ct.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var gt=lt,yt=ot.Buffer,mt=[1518500249,1859775393,-1894007588,-899497514],vt=new Array(80);function wt(){this.init(),this._w=vt,ut.call(this,64,56)}function bt(t){return t<<5|t>>>27}function _t(t){return t<<30|t>>>2}function Tt(t,e,n,i){return 0===t?e&n|~e&i:2===t?e&n|e&i|n&i:e^n^i}W(wt,ut),wt.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this},wt.prototype._update=function(t){for(var e,n=this._w,i=0|this._a,r=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,u=0;u<16;++u)n[u]=t.readInt32BE(4*u);for(;u<80;++u)n[u]=(e=n[u-3]^n[u-8]^n[u-14]^n[u-16])<<1|e>>>31;for(var c=0;c<80;++c){var h=~~(c/20),p=bt(i)+Tt(h,r,o,s)+a+n[c]+mt[h]|0;a=s,s=o,o=_t(r),r=i,i=p}this._a=i+this._a|0,this._b=r+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0},wt.prototype._hash=function(){var t=yt.allocUnsafe(20);return t.writeInt32BE(0|this._a,0),t.writeInt32BE(0|this._b,4),t.writeInt32BE(0|this._c,8),t.writeInt32BE(0|this._d,12),t.writeInt32BE(0|this._e,16),t};var kt=wt,Ot=ot.Buffer,It=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Et=new Array(64);function St(){this.init(),this._w=Et,ut.call(this,64,56)}function Ct(t,e,n){return n^t&(e^n)}function At(t,e,n){return t&e|n&(t|e)}function Ut(t){return(t>>>2|t<<30)^(t>>>13|t<<19)^(t>>>22|t<<10)}function Rt(t){return(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7)}function xt(t){return(t>>>7|t<<25)^(t>>>18|t<<14)^t>>>3}W(St,ut),St.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this},St.prototype._update=function(t){for(var e,n=this._w,i=0|this._a,r=0|this._b,o=0|this._c,s=0|this._d,a=0|this._e,u=0|this._f,c=0|this._g,h=0|this._h,p=0;p<16;++p)n[p]=t.readInt32BE(4*p);for(;p<64;++p)n[p]=0|(((e=n[p-2])>>>17|e<<15)^(e>>>19|e<<13)^e>>>10)+n[p-7]+xt(n[p-15])+n[p-16];for(var l=0;l<64;++l){var f=h+Rt(a)+Ct(a,u,c)+It[l]+n[l]|0,d=Ut(i)+At(i,r,o)|0;h=c,c=u,u=a,a=s+f|0,s=o,o=r,r=i,i=f+d|0}this._a=i+this._a|0,this._b=r+this._b|0,this._c=o+this._c|0,this._d=s+this._d|0,this._e=a+this._e|0,this._f=u+this._f|0,this._g=c+this._g|0,this._h=h+this._h|0},St.prototype._hash=function(){var t=Ot.allocUnsafe(32);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t.writeInt32BE(this._h,28),t};var Dt=St,Bt=ot.Buffer,Pt=new Array(64);function jt(){this.init(),this._w=Pt,ut.call(this,64,56)}W(jt,Dt),jt.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this},jt.prototype._hash=function(){var t=Bt.allocUnsafe(28);return t.writeInt32BE(this._a,0),t.writeInt32BE(this._b,4),t.writeInt32BE(this._c,8),t.writeInt32BE(this._d,12),t.writeInt32BE(this._e,16),t.writeInt32BE(this._f,20),t.writeInt32BE(this._g,24),t};var Lt=jt,qt=ot.Buffer,Mt=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],Nt=new Array(160);function Ht(){this.init(),this._w=Nt,ut.call(this,128,112)}function Vt(t,e,n){return n^t&(e^n)}function Wt(t,e,n){return t&e|n&(t|e)}function zt(t,e){return(t>>>28|e<<4)^(e>>>2|t<<30)^(e>>>7|t<<25)}function Ft(t,e){return(t>>>14|e<<18)^(t>>>18|e<<14)^(e>>>9|t<<23)}function Yt(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^t>>>7}function Kt(t,e){return(t>>>1|e<<31)^(t>>>8|e<<24)^(t>>>7|e<<25)}function Jt(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^t>>>6}function Xt(t,e){return(t>>>19|e<<13)^(e>>>29|t<<3)^(t>>>6|e<<26)}function $t(t,e){return t>>>0<e>>>0?1:0}W(Ht,ut),Ht.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this},Ht.prototype._update=function(t){for(var e=this._w,n=0|this._ah,i=0|this._bh,r=0|this._ch,o=0|this._dh,s=0|this._eh,a=0|this._fh,u=0|this._gh,c=0|this._hh,h=0|this._al,p=0|this._bl,l=0|this._cl,f=0|this._dl,d=0|this._el,g=0|this._fl,y=0|this._gl,m=0|this._hl,v=0;v<32;v+=2)e[v]=t.readInt32BE(4*v),e[v+1]=t.readInt32BE(4*v+4);for(;v<160;v+=2){var w=e[v-30],b=e[v-30+1],_=Yt(w,b),T=Kt(b,w),k=Jt(w=e[v-4],b=e[v-4+1]),O=Xt(b,w),I=e[v-14],E=e[v-14+1],S=e[v-32],C=e[v-32+1],A=T+E|0,U=_+I+$t(A,T)|0;U=(U=U+k+$t(A=A+O|0,O)|0)+S+$t(A=A+C|0,C)|0,e[v]=U,e[v+1]=A}for(var R=0;R<160;R+=2){U=e[R],A=e[R+1];var x=Wt(n,i,r),D=Wt(h,p,l),B=zt(n,h),P=zt(h,n),j=Ft(s,d),L=Ft(d,s),q=Mt[R],M=Mt[R+1],N=Vt(s,a,u),H=Vt(d,g,y),V=m+L|0,W=c+j+$t(V,m)|0;W=(W=(W=W+N+$t(V=V+H|0,H)|0)+q+$t(V=V+M|0,M)|0)+U+$t(V=V+A|0,A)|0;var z=P+D|0,F=B+x+$t(z,P)|0;c=u,m=y,u=a,y=g,a=s,g=d,s=o+W+$t(d=f+V|0,f)|0,o=r,f=l,r=i,l=p,i=n,p=h,n=W+F+$t(h=V+z|0,V)|0}this._al=this._al+h|0,this._bl=this._bl+p|0,this._cl=this._cl+l|0,this._dl=this._dl+f|0,this._el=this._el+d|0,this._fl=this._fl+g|0,this._gl=this._gl+y|0,this._hl=this._hl+m|0,this._ah=this._ah+n+$t(this._al,h)|0,this._bh=this._bh+i+$t(this._bl,p)|0,this._ch=this._ch+r+$t(this._cl,l)|0,this._dh=this._dh+o+$t(this._dl,f)|0,this._eh=this._eh+s+$t(this._el,d)|0,this._fh=this._fh+a+$t(this._fl,g)|0,this._gh=this._gh+u+$t(this._gl,y)|0,this._hh=this._hh+c+$t(this._hl,m)|0},Ht.prototype._hash=function(){var t=qt.allocUnsafe(64);function e(e,n,i){t.writeInt32BE(e,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),e(this._gh,this._gl,48),e(this._hh,this._hl,56),t};var Zt=Ht,Gt=ot.Buffer,Qt=new Array(160);function te(){this.init(),this._w=Qt,ut.call(this,128,112)}W(te,Zt),te.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this},te.prototype._hash=function(){var t=Gt.allocUnsafe(48);function e(e,n,i){t.writeInt32BE(e,i),t.writeInt32BE(n,i+4)}return e(this._ah,this._al,0),e(this._bh,this._bl,8),e(this._ch,this._cl,16),e(this._dh,this._dl,24),e(this._eh,this._el,32),e(this._fh,this._fl,40),t};var ee=te,ne=V((function(t){var e=t.exports=function(t){t=t.toLowerCase();var n=e[t];if(!n)throw new Error(t+" is not supported (we accept pull requests)");return new n};e.sha=gt,e.sha1=kt,e.sha224=Lt,e.sha256=Dt,e.sha384=ee,e.sha512=Zt})),ie=V((function(t){var e=ot.Buffer,n=H.crypto||H.msCrypto;n&&n.getRandomValues?t.exports=function(t,i){if(t>4294967295)throw new RangeError("requested too many random bytes");var r=e.allocUnsafe(t);if(t>0)if(t>65536)for(var o=0;o<t;o+=65536)n.getRandomValues(r.slice(o,o+65536));else n.getRandomValues(r);return"function"==typeof i?process.nextTick((function(){i(null,r)})):r}:t.exports=function(){throw new Error("Secure random number generation is not supported by this browser.\nUse Chrome, Firefox or Internet Explorer 11")}})),re=function(t){try{return JSON.parse(atob(decodeURIComponent(t)))}catch(e){return{redirectUrl:t}}},oe=function(t){return new RegExp("-Customers$").test(t.options.connection)||new RegExp("-Unification$").test(t.options.connection)},se=function(t){return-1!==t.options.connection.indexOf("-waad")},ae=function(t,e){return e?{type:"Session",token:e}:t?{type:"Bearer",token:t}:null};function ue(){this.version="6.1.193"}function ce(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}ue.prototype.getToken=function(){if(!a())return null;var t=o(),e=t.storage.get(t.options.storageTokenKey);return e?e.value:null},ue.prototype.getTokenType=function(){if(!a())return null;var t=o(),e=t.storage.get(t.options.storageTokenKey);return e?e.type:null},ue.prototype.signIn=function(t,e,n){if(!a())throw new Error("[WebAuth] Error: Not initialized. Use init().");var i=o();if(!this.isSignedIn()){var r=function(t,e){var n=new M(window.location);return Array.isArray(t)&&t.forEach((function(t){t&&n.withAdditionalQueryParam(t.key,t.value)})),Array.isArray(e)&&e.forEach((function(t){t&&n.withAdditionalHashParam(t.key,t.value)})),n.build()}(t,e);console.error("[authjs] Debug:redirectURL "+r);var s=i.options||{};n&&(void 0!==n.allowGuestUser&&(s.allowGuestUser=n.allowGuestUser),void 0!==n.guestReturnUrl&&(s.guestReturnUrl=n.guestReturnUrl),void 0!==n.site&&(s.site=n.site),void 0!==n.skipFasterCheckoutText&&(s.skipFasterCheckoutText=n.skipFasterCheckoutText),void 0!==n.loginContext&&(s.loginContext=n.loginContext),void 0!==n.navHint&&(s.navHint=n.navHint),void 0!==n.requireSession&&(s.requireSession=n.requireSession),void 0!==n.enableGoogleOneTap&&(s.enableGoogleOneTap=n.enableGoogleOneTap),void 0!==n.enforcedEmail&&(s.enforcedEmail=n.enforcedEmail),void 0!==n.customText&&(s.customText=n.customText),void 0!==n.isFirstLogin&&(s.isFirstLogin=n.isFirstLogin),void 0!==n.isSteppedUp&&(s.isSteppedUp=n.isSteppedUp),void 0!==n.unificationEntityId&&(s.unificationEntityId=n.unificationEntityId),void 0!==n.vcsStoreUrl&&(s.vcsStoreUrl=n.vcsStoreUrl),void 0!==n.testUserId&&(s.testUserId=n.testUserId),void 0!==n.storeId&&(s.storeId=n.storeId),void 0!==n.vcsStoreLogoUrl&&(s.vcsStoreLogoUrl=n.vcsStoreLogoUrl),void 0!==n.restrictSignup&&(s.restrictSignup=n.restrictSignup),void 0!==n.disableEmailField&&(s.disableEmailField=n.disableEmailField));var u=new P(s).withReturnUrl(r);se(i)||(u.withAnonymousId(I.getSessionCookie()).withCulture(),console.error("[authjs] Debug:culture "+s.culture));var c=this;N(n&&n.trackingCaller,(function(){c.authorize(u.build(),i)}))}},ue.prototype.authorize=function(t,e){var n,i=ce(ie(32).toString("base64")),r=(n=i,ce(ne("sha256").update(n).digest("base64")));e.storage.set(e.options.storageVerifierKey,"user",i);var o="https://".concat(e.options.oidc.domain,"/authorize");o+="?connection=".concat(t.connection),o+="&state=".concat(encodeURIComponent(t.state)),o+="".concat(se(e)?"":"&wauth=".concat(t.wauth)),o+="&response_type=".concat(e.options.oidc.responseType),o+="&client_id=".concat(e.options.oidc.clientID),o+="&audience=".concat(e.options.oidc.audience),o+="&code_challenge=".concat(r),o+="&code_challenge_method=S256",o+="&scope=".concat(encodeURIComponent(e.options.oidc.scope)),o+="&redirect_uri=".concat(e.options.oidc.redirectUri),window.location=o},ue.prototype.signOut=function(t){if(!a())throw new Error("[WebAuth] Error: Not initialized. Use init().");var e=o();if(this.isSignedIn()){e.storage.delete(e.options.storageTokenKey),e.storage.delete(e.options.storageRefreshKey),I.deleteAuthCookie(),I.deletePresumedLoginState();var n,i,r,s,u=oe(e),c=(n=e.options.signOutUrl,i=(s=o().options.redirectAfterSignOutCallback())?"raso=".concat(encodeURIComponent(s)):null,r="".concat(n,"/sign-out-callback/"),o().options.developmentMode&&(r="".concat(n,"/")),i?"".concat(r,"?").concat(i):r),h={returnTo:c};if((null==t?void 0:t.forceFederatedLogOut)&&(h.federated=!0,h.forceFederatedLogOut=!0),u)if(e.options&&"Vistaprint-Staging-Customers"===e.options.connection)h.federated=!0;else if("VP-Customers-Unification"===e.options.connection)h={clientID:"KYWF9D4UM3hT8jM1asfQj7X6xSDXZp7R",returnTo:"https://vistaprint-unification.eu.auth0.com/v2/logout?returnTo=".concat(c,"&client_id=7KyluKip2WIpBexLw8HuyujKPiSnAuBI")};else{var p="https://account.vista.com/v2/logout?returnTo=".concat(c,"&client_id=YhWiXWN12uDSeYo62BY2uD35vWLeETx1");h={clientID:void 0,returnTo:"https://account.vistaprint.com/v2/logout?returnTo=".concat(encodeURIComponent(p),"&client_id=YhWiXWN12uDSeYo62BY2uD35vWLeETx1")}}var l=I.getSessionCookie();l&&(U.closeSession(l),I.deleteSessionCookie()),this.logout(h)}},ue.prototype.logout=function(t){if(!a())throw new Error("[WebAuth] Error: Not initialized. Use init().");var e=o(),n=I.getConfigCookie(),i=n&&n.domain||e.options.oidc.domain,r="https://".concat(i,"/v2/logout");r+="?returnTo=".concat(encodeURIComponent(t.returnTo)),t.clientID&&(r+="&clientID=".concat(t.clientID)),t.federated&&(r+="&federated"),t.forceFederatedLogOut&&(r+="&client_id=".concat(clientID)),I.deleteConfigCookie(),window.location=r},ue.prototype.isSignedIn=function(){if(!a())return!1;var t=o(),e=this.getTokenType();return t.options.enableCrossSiteSso?"user"===e:"user"===e&&I.getPresumedLoginState()},ue.prototype.getProfile=function(){var t=this.getToken();return t?g.parse(t):null},ue.prototype.getCanonicalId=function(){var t=this.getProfile();return t?g.getCanonicalId(t):null},ue.prototype.getRecentAnonymousIds=function(){var t=this.getProfile();return t?g.getRecentAnonymousIds(t):null},ue.prototype.getIdentity=function(){return{profile:this.getProfile(),accessToken:this.getToken(),isSignedIn:this.isSignedIn(),canonicalId:this.getCanonicalId(),recentAnonymousIds:this.getRecentAnonymousIds(),authorizationHeader:this.getAuthorizationHeader(),authorization:this.getAuthorization()}},ue.prototype.getAuthorizationHeader=function(){var t=this.getAuthorization();return t?"".concat(t.type," ").concat(t.token):null},ue.prototype.getAuthorization=function(){var t=I.getSessionCookie(),e=this.getToken();return ae(e,t)},ue.prototype.onUserIdentityUpdate=function(t){"function"==typeof t&&(h()&&t(u()),window.addEventListener("userIdentity",(function(e){t(e.detail)})))};var he=ue;function pe(t,e){e=e||{bubbles:!1,cancelable:!1,detail:null};var n=document.createEvent("CustomEvent");return n.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),n}var le=("undefined"!=typeof window&&"function"!=typeof window.CustomEvent&&(window.CustomEvent=pe),pe);function fe(){this.target=window}fe.prototype.publish=function(t,e){var n=new le(t,e);this.target.dispatchEvent(n)},fe.prototype.publishUserIdentity=function(t,e){var n=g.parse(t),i=ae(t,e);this.publish("userIdentity",{detail:{profile:n,accessToken:t,isSignedIn:!0,canonicalId:g.getCanonicalId(n),recentAnonymousIds:g.getRecentAnonymousIds(n),authorizationHeader:i?"".concat(i.type," ").concat(i.token):null,authorization:i}})},fe.prototype.publishAnonymousIdentity=function(t,e){var n=g.parse(t),i=ae(t,e);this.publish("userIdentity",{detail:{profile:n,accessToken:t,isSignedIn:!1,canonicalId:g.getCanonicalId(n),authorizationHeader:i?"".concat(i.type," ").concat(i.token):null,authorization:i}})},fe.prototype.publishEmptyIdentity=function(){this.publish("userIdentity",{detail:{profile:{},accessToken:null,isSignedIn:!1,canonicalId:null,authorizationHeader:null,authorization:{}}})},fe.prototype.publishUserIdentityError=function(t){this.publish("userIdentityError",{detail:t})};var de=fe;function ge(t,e){this.storage=t,this.options=e}ge.prototype.subscribeOnce=function(t,e){this.storageChangedBound=this.storageChanged.bind(this,t,e),this.storage.addStorageChangedInOtherWindowEventListener(this.storageChangedBound)},ge.prototype.storageChanged=function(t,e,n){if(n.key===this.options.storageTokenKey){var i=function(t){if(!t)return null;try{return JSON.parse(t)}catch(t){return null}}(n.newValue);i&&i.type===t&&(this.storage.removeStorageChangedInOtherWindowEventListener(this.storageChangedBound),e())}};var ye,me=ge;function ve(t,e,n){if(!e)throw new Error("[Session] Error: Storage layer not provided.");if(!se({options:n})&&!t)throw new Error("[Session] Error: Anonymous fallback not provided.");if(!n)throw new Error("[Session] Error: Options not provided.");this.anon=t,this.storage=e,this.options=n,this.events=new de,this.storageNotification=new me(e,n),this.hasInitialEventBeenPublished=!1,this.bindedEventListenerCallback=this.eventListenerCallback.bind(this)}ve.prototype.init=function(){if(!this.options.enableCrossSiteSso&&!I.getPresumedLoginState())return this.cleanUp();this.storageNotification.subscribeOnce("anonymous",this.storageChanged.bind(this)),this.checkRefresh(),window.addEventListener("visibilitychange",this.bindedEventListenerCallback)},ve.prototype.eventListenerCallback=function(){"visible"===document.visibilityState&&this.checkRefresh()},ve.prototype.refreshPkce=function(t,e,n){var i=new XMLHttpRequest;i.onload=this.refreshTokenCallback.bind(this,i,{clientId:n,domain:e}),i.onerror=this.refreshTokenCallback.bind(this,i,{clientId:n,domain:e}),i.open("POST","https://".concat(e,"/oauth/token")),i.setRequestHeader("Content-Type","application/json; charset=utf-8"),i.send(JSON.stringify({grant_type:"refresh_token",refresh_token:t,client_id:n}))},ve.prototype.refreshTokenCallback=function(t,e){if(this.signedOutInOtherWindow)this.signedOutInOtherWindow=null;else{if(200!==t.status)return this.cleanUp();var n=JSON.parse(t.response);n.alternative_access_token?I.setSessionCookie(n.alternative_access_token):this.options.requireSession&&U.updateSession(n.access_token),this.storage.set(this.options.storageTokenKey,"user",n.access_token),this.storage.set(this.options.storageRefreshKey,"user",n.refresh_token),I.setAuthCookie(n.refresh_token),I.setConfigCookie(e.clientId,e.domain),I.setPresumedLoginState(),this.events.publishUserIdentity(n.access_token,n.alternative_access_token),this.schedule()}},ve.prototype.schedule=function(t){ye&&clearTimeout(ye);var e=t||this.options.tokenRefreshInterval;ye=setTimeout(this.checkRefresh.bind(this),e)},ve.prototype.checkRefresh=function(){if(this.signedOutInOtherWindow)this.signedOutInOtherWindow=null;else{var t=this.storage.get(this.options.storageTokenKey),e=this.storage.get(this.options.storageRefreshKey),n=I.getAuthCookie()||e&&e.value;if(!n)return this.cleanUp();var i=I.getConfigCookie(),r=i&&i.clientId||this.options.oidc.clientID,o=i&&i.domain||this.options.oidc.domain;if(t&&"anonymous"!==t.type){var s=(Date.now()-t.timestamp)/1e3;if(g.isValidToken(t.value)){if(!this.hasInitialEventBeenPublished){var a=I.getSessionCookie();this.events.publishUserIdentity(t.value,a),this.hasInitialEventBeenPublished=!0}this.schedule(this.options.tokenRefreshInterval-s>0?this.options.tokenRefreshInterval-s:this.options.tokenRefreshInterval)}else this.refreshPkce(n,o,r)}else this.refreshPkce(n,o,r)}},ve.prototype.cleanUp=function(){this.sessionEnded=!0,this.hasInitialEventBeenPublished=!1;var t=this.storage.get(this.options.storageTokenKey);if(t&&"user"===t.type){this.storage.delete(this.options.storageTokenKey),this.storage.delete(this.options.storageRefreshKey),I.deleteAuthCookie(),I.deleteConfigCookie(),I.deletePresumedLoginState();var e=I.getSessionCookie();e&&(U.closeSession(e),I.deleteSessionCookie())}window.removeEventListener("visibilitychange",this.bindedEventListenerCallback),this.anon?this.anon.init(this):this.events.publishEmptyIdentity()},ve.prototype.storageChanged=function(){this.sessionEnded?this.sessionEnded=null:(this.signedOutInOtherWindow=!0,this.hasInitialEventBeenPublished=!1,window.removeEventListener("visibilitychange",this.bindedEventListenerCallback),this.anon?this.anon.init(this):this.events.publishEmptyIdentity())};var we=ve;function be(){try{return window.localStorage.setItem("test","test"),window.localStorage.removeItem("test"),!0}catch(t){return!1}}function _e(t){window.addEventListener("storage",t)}function Te(t){window.removeEventListener("storage",t)}var ke={getStorage:function(){return be()?{getItem:window.localStorage.getItem.bind(window.localStorage),setItem:window.localStorage.setItem.bind(window.localStorage),removeItem:window.localStorage.removeItem.bind(window.localStorage),addStorageChangedInOtherWindowEventListener:_e,removeStorageChangedInOtherWindowEventListener:Te}:null},isAvailable:be};function Oe(){this.storage={}}Oe.prototype.getItem=function(t){return this.storage[t]},Oe.prototype.setItem=function(t,e){this.storage[t]=e},Oe.prototype.removeItem=function(t){this.storage[t]=void 0},Oe.prototype.addStorageChangedInOtherWindowEventListener=function(){},Oe.prototype.removeStorageChangedInOtherWindowEventListener=function(){};var Ie=Oe;function Ee(){!0===ke.isAvailable()?this.storage=ke.getStorage():this.storage=new Ie}Ee.prototype.set=function(t,e,n,i){if("string"!=typeof n)throw new Error("[Storage.prototype.set] Error: Value must be of type 'string'.");var r={type:e,value:n,timestamp:Date.now(),data:i},o=JSON.stringify(r);this.storage.setItem(t,o)},Ee.prototype.get=function(t){var e=this.storage.getItem(t);if(!e)return null;try{return JSON.parse(e)}catch(e){return this.storage.removeItem(t),null}},Ee.prototype.delete=function(t){this.storage.removeItem(t)},Ee.prototype.addStorageChangedInOtherWindowEventListener=function(t){this.storage.addStorageChangedInOtherWindowEventListener(t)},Ee.prototype.removeStorageChangedInOtherWindowEventListener=function(t){this.storage.removeStorageChangedInOtherWindowEventListener(t)};var Se,Ce=Ee;function Ae(t,e){if(!t)throw new Error("[AnonymousSession] Error: Storage layer not provided.");if(!e)throw new Error("[AnonymousSession] Error: Options not provided.");this.storage=t,this.options=e,this.cookies=I,this.events=new de,this.cimpressAnonKey=e.cimpressAnonKey,this.anonymousBaseEndpoint=e.anonymousBaseEndpoint,this.hasInitialEventBeenPublished=!1,this.storageNotification=new me(t,e),this.retryCount=2}Ae.prototype.init=function(t){this.session=t,this.storageNotification.subscribeOnce("user",this.storageChanged.bind(this)),this.checkRefresh()},Ae.prototype.checkRefresh=function(){if(this.signedInOtherWindow)this.signedInOtherWindow=null;else{var t=this.storage.get(this.options.storageTokenKey),e=this.cookies.getAnonymousIdentityState();if(e)if(t){var n=(Date.now()-t.timestamp)/1e3;g.isValidToken(t.value)?(this.hasInitialEventBeenPublished||(this.events.publishAnonymousIdentity(t.value),this.hasInitialEventBeenPublished=!0),this.schedule(this.options.tokenRefreshInterval-n)):this.refreshAnonymousIdentity(e)}else this.refreshAnonymousIdentity(e);else this.createAnonymousIdentity()}},Ae.prototype.createAnonymousIdentity=function(){var t=new XMLHttpRequest;t.onload=this.createAnonymousIdentityCallback.bind(this,t),t.onerror=this.createAnonymousIdentityCallback.bind(this,t),t.open("POST","".concat(this.anonymousBaseEndpoint).concat(this.cimpressAnonKey,"/token")),t.send()},Ae.prototype.refreshAnonymousIdentity=function(t){var e=new XMLHttpRequest;e.onload=this.refreshAnonymousIdentityCallback.bind(this,e,t),e.onerror=this.refreshAnonymousIdentityCallback.bind(this,e,t);var n="".concat(this.anonymousBaseEndpoint).concat(t.anonKey||this.cimpressAnonKey);e.open("POST",n+"/identities/"+t.id+"/token"),e.setRequestHeader("Content-Type","application/json; charset=utf-8"),e.send(JSON.stringify({validationKey:t.nonce}))},Ae.prototype.createAnonymousIdentityCallback=function(t){if(201===t.status)this.processTokenResponse(t.response,this.cimpressAnonKey);else if(console.log("Unable to create token from Cimpress anon service. Status:"+t.status),[408,429,500,502,503,504,522,524].includes(t.status)){if(0===this.retryCount)return void this.events.publishUserIdentityError({message:t.responseText,statusCode:t.status});this.retryCount=this.retryCount-1,this.scheduleCreateAnonymousIdentity()}},Ae.prototype.refreshAnonymousIdentityCallback=function(t,e){if(200!==t.status)return console.log("Unable to refresh token from Cimpress anon service. Status:"+t.status),void this.schedule();this.processTokenResponse(t.response,e.anonKey||this.cimpressAnonKey)},Ae.prototype.processTokenResponse=function(t,e){if(this.signedInOtherWindow)this.signedInOtherWindow=null;else{var n=JSON.parse(t),i={id:n.anonymousId,nonce:n.validationKey,value:n.anonymousToken};this.storage.set(this.options.storageTokenKey,"anonymous",i.value),this.cookies.setAnonymousIdentityState(i.id,i.nonce,e),this.schedule(),this.events.publishAnonymousIdentity(i.value)}},Ae.prototype.schedule=function(t){Se&&clearTimeout(Se);var e=t||this.options.tokenRefreshInterval;Se=setTimeout(this.checkRefresh.bind(this),e)},Ae.prototype.scheduleCreateAnonymousIdentity=function(){setTimeout(this.createAnonymousIdentity.bind(this),3e4)},Ae.prototype.storageChanged=function(){this.signedInOtherWindow=!0,this.hasInitialEventBeenPublished=!1,this.session.init()};var Ue,Re=Ae;function xe(t,e){if(!t)throw new Error("[CimpressAnonSession] Error: Storage layer not provided.");if(!e)throw new Error("[CimpressAnonSession] Error: Options not provided.");this.storage=t,this.options=e,this.cookies=I,this.events=new de,this.hasInitialEventBeenPublished=!1,this.storageNotification=new me(t,e),this.retryCount=2}xe.prototype.init=function(t){this.session=t,this.storageNotification.subscribeOnce("user",this.storageChanged.bind(this)),this.checkRefresh()},xe.prototype.checkRefresh=function(){if(this.signedInOtherWindow)this.signedInOtherWindow=null;else{var t=this.cookies.getAnonymousIdentityState();if(t){var e=this.storage.get(this.options.storageTokenKey);if(!t.anonKey&&e){var n=(Date.now()-e.timestamp)/1e3;if(g.isValidToken(e.value)){if(!this.hasInitialEventBeenPublished){var i=I.getSessionCookie();this.events.publishAnonymousIdentity(e.value,i),this.hasInitialEventBeenPublished=!0}this.schedule(this.options.tokenRefreshInterval-n)}else this.refreshAnonymousIdentity(t)}else this.refreshAnonymousIdentity(t)}else this.createAnonymousIdentity()}},xe.prototype.createAnonymousIdentity=function(){var t=new XMLHttpRequest;t.onload=this.createAnonymousIdentityCallback.bind(this,t),t.onerror=this.createAnonymousIdentityCallback.bind(this,t),t.open("POST",this.options.authFrontAnonymousEndpoint),t.setRequestHeader("Content-Type","application/json; charset=utf-8"),t.send(JSON.stringify({client_id:this.options.oidc.clientID||p,grant_type:"https://cimpress.io/oauth/grant-type/anonymous",scope:"offline_access",audience:this.options.oidc.audience}))},xe.prototype.createAnonymousIdentityCallback=function(t){if(200===t.status)this.processTokenResponse(t.response);else if(console.log("Unable to create token from Cimpress OAuth service. Status:"+t.status),[408,429,500,502,503,504,522,524].includes(t.status)){if(0===this.retryCount)return void this.events.publishUserIdentityError({message:t.responseText,statusCode:t.status});this.retryCount=this.retryCount-1,this.scheduleCreateAnonymousIdentity()}},xe.prototype.refreshAnonymousIdentity=function(t){var e=new XMLHttpRequest;e.onload=this.refreshAnonymousIdentityCallback.bind(this,e,t),e.onerror=this.refreshAnonymousIdentityCallback.bind(this,e,t),e.open("POST",this.options.authFrontAnonymousEndpoint),e.setRequestHeader("Content-Type","application/json; charset=utf-8"),e.send(JSON.stringify(function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?v(Object(n),!0).forEach((function(e){m(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({client_id:this.options.oidc.clientID||p,grant_type:"refresh_token",refresh_token:t.nonce},t.anonKey?{anonymous_id:t.id,anonymous_key:t.anonKey}:{})))},xe.prototype.refreshAnonymousIdentityCallback=function(t){if(200!==t.status)return console.log("Unable to refresh token from Cimpress OAuth service. Status:"+t.status),void this.schedule();this.processTokenResponse(t.response)},xe.prototype.processTokenResponse=function(t){if(this.signedInOtherWindow)this.signedInOtherWindow=null;else{var e=JSON.parse(t),n={id:g.getCanonicalId(g.parse(e.access_token)),nonce:e.refresh_token,access_token:e.access_token,reference_token:e.alternative_access_token};this.storage.set(this.options.storageTokenKey,"anonymous",n.access_token),this.cookies.setAnonymousIdentityState(n.id,n.nonce),n.reference_token&&this.cookies.setSessionCookie(n.reference_token),this.schedule(),this.events.publishAnonymousIdentity(n.access_token,n.reference_token)}},xe.prototype.schedule=function(t){Ue&&clearTimeout(Ue);var e=t||this.options.tokenRefreshInterval;Ue=setTimeout(this.checkRefresh.bind(this),e)},xe.prototype.scheduleCreateAnonymousIdentity=function(){setTimeout(this.createAnonymousIdentity.bind(this),3e4)},xe.prototype.storageChanged=function(){this.signedInOtherWindow=!0,this.hasInitialEventBeenPublished=!1,this.session.init()};var De=xe,Be=function(){return{clientId:p,connection:"VP-Customers",defaultSite:"Vistaprint",domain:"oauth.cimpress.io"}};function Pe(t){return t?"/":"/auth-callback/"}function je(t,e){var n={domain:e.domain,clientID:e.clientId,audience:"https://api.cimpress.io/",redirectUri:window.location.origin+Pe(t),responseType:"code",scope:"openid offline_access",leeway:60};return"object"===y(t)&&("string"==typeof t.clientID&&(n.clientID=t.clientID,"string"!=typeof t.domain&&(n.domain="cimpress.auth0.com")),"string"==typeof t.redirectUriOrigin&&(n.redirectUri=t.redirectUriOrigin.replace(/\/$/,"")+Pe(t)),"string"==typeof t.domain&&(n.domain=t.domain),"string"==typeof t.audience&&(n.audience=t.audience),"string"==typeof t.scope&&(n.scope=t.scope)),n}var Le=function(t){var e=Be();return{developmentMode:!!t,storageTokenKey:"vp-access-token",storageRefreshKey:"vp-refresh-token",storageVerifierKey:"vp-code-verifier",oidc:je(t,e),tokenRefreshInterval:18e5,connection:e.connection,site:e.defaultSite||"Vistaprint",signOutUrl:window.location.origin,redirectAfterSignOutCallback:function(){return window.location.origin},anonymousEndpoint:"https://anon.oauth.cimpress.io/v0/7AeLhPS4Ab7fztoMVAchwX",cimpressAnonymousEndpoint:"https://anon.oauth.cimpress.io/v0/pA8i267E3bgjL8Tomhmrew",anonymousBaseEndpoint:"https://anon.oauth.cimpress.io/v1/",cimpressAnonKey:"pA8i267E3bgjL8Tomhmrew",authFrontAnonymousEndpoint:"https://oauth.cimpress.io/v2/token"}},qe="undefined"!=typeof window?window:void 0!==n.g?n.g:"undefined"!=typeof self?self:{};function Me(t,e){return t(e={exports:{}},e.exports),e.exports}var Ne=Me((function(t){var e,n;e=qe,n=function(){return function(){return function(t){var e=[];if(t[0].match(/^[^\/:]+:\/*$/)&&t.length>1){var n=t.shift();t[0]=n+t[0]}t[0].match(/^file:\/\/\//)?t[0]=t[0].replace(/^([^\/:]+):\/*/,"$1:///"):t[0]=t[0].replace(/^([^\/:]+):\/*/,"$1://");for(var i=0;i<t.length;i++){var r=t[i];if("string"!=typeof r)throw new TypeError("Url must be a string. Received "+r);""!==r&&(i>0&&(r=r.replace(/^[\/]+/,"")),r=i<t.length-1?r.replace(/[\/]+$/,""):r.replace(/[\/]+$/,"/"),e.push(r))}var o=e.join("/"),s=(o=o.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return s.shift()+(s.length>0?"?":"")+s.join("&")}("object"==y(arguments[0])?arguments[0]:[].slice.call(arguments))}},t.exports?t.exports=n():e.urljoin=n()})),He=Me((function(t,e){var n=Object.prototype.hasOwnProperty,i=function(){for(var t=[],e=0;e<256;++e)t.push("%"+((e<16?"0":"")+e.toString(16)).toUpperCase());return t}();e.arrayToObject=function(t,e){for(var n=e&&e.plainObjects?Object.create(null):{},i=0;i<t.length;++i)void 0!==t[i]&&(n[i]=t[i]);return n},e.merge=function(t,i,r){if(!i)return t;if("object"!=y(i)){if(Array.isArray(t))t.push(i);else{if("object"!=y(t))return[t,i];(r.plainObjects||r.allowPrototypes||!n.call(Object.prototype,i))&&(t[i]=!0)}return t}if("object"!=y(t))return[t].concat(i);var o=t;return Array.isArray(t)&&!Array.isArray(i)&&(o=e.arrayToObject(t,r)),Array.isArray(t)&&Array.isArray(i)?(i.forEach((function(i,o){n.call(t,o)?t[o]&&"object"==y(t[o])?t[o]=e.merge(t[o],i,r):t.push(i):t[o]=i})),t):Object.keys(i).reduce((function(t,n){var o=i[n];return Object.prototype.hasOwnProperty.call(t,n)?t[n]=e.merge(t[n],o,r):t[n]=o,t}),o)},e.decode=function(t){try{return decodeURIComponent(t.replace(/\+/g," "))}catch(e){return t}},e.encode=function(t){if(0===t.length)return t;for(var e="string"==typeof t?t:String(t),n="",r=0;r<e.length;++r){var o=e.charCodeAt(r);45===o||46===o||95===o||126===o||o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122?n+=e.charAt(r):o<128?n+=i[o]:o<2048?n+=i[192|o>>6]+i[128|63&o]:o<55296||o>=57344?n+=i[224|o>>12]+i[128|o>>6&63]+i[128|63&o]:(r+=1,o=65536+((1023&o)<<10|1023&e.charCodeAt(r)),n+=i[240|o>>18]+i[128|o>>12&63]+i[128|o>>6&63]+i[128|63&o])}return n},e.compact=function(t,n){if("object"!=y(t)||null===t)return t;var i=n||[],r=i.indexOf(t);if(-1!==r)return i[r];if(i.push(t),Array.isArray(t)){for(var o=[],s=0;s<t.length;++s)t[s]&&"object"==y(t[s])?o.push(e.compact(t[s],i)):void 0!==t[s]&&o.push(t[s]);return o}return Object.keys(t).forEach((function(n){t[n]=e.compact(t[n],i)})),t},e.isRegExp=function(t){return"[object RegExp]"===Object.prototype.toString.call(t)},e.isBuffer=function(t){return null!=t&&!!(t.constructor&&t.constructor.isBuffer&&t.constructor.isBuffer(t))}})),Ve=(He.arrayToObject,He.merge,He.decode,He.encode,He.compact,He.isRegExp,He.isBuffer,String.prototype.replace),We=/%20/g,ze={default:"RFC3986",formatters:{RFC1738:function(t){return Ve.call(t,We,"+")},RFC3986:function(t){return t}},RFC1738:"RFC1738",RFC3986:"RFC3986"},Fe={brackets:function(t){return t+"[]"},indices:function(t,e){return t+"["+e+"]"},repeat:function(t){return t}},Ye=Date.prototype.toISOString,Ke={delimiter:"&",encode:!0,encoder:He.encode,encodeValuesOnly:!1,serializeDate:function(t){return Ye.call(t)},skipNulls:!1,strictNullHandling:!1},Je=function t(e,n,i,r,o,s,a,u,c,h,p,l){var f=e;if("function"==typeof a)f=a(n,f);else if(f instanceof Date)f=h(f);else if(null===f){if(r)return s&&!l?s(n):n;f=""}if("string"==typeof f||"number"==typeof f||"boolean"==typeof f||He.isBuffer(f))return s?[p(l?n:s(n))+"="+p(s(f))]:[p(n)+"="+p(String(f))];var d,g=[];if(void 0===f)return g;if(Array.isArray(a))d=a;else{var y=Object.keys(f);d=u?y.sort(u):y}for(var m=0;m<d.length;++m){var v=d[m];o&&null===f[v]||(g=Array.isArray(f)?g.concat(t(f[v],i(n,v),i,r,o,s,a,u,c,h,p,l)):g.concat(t(f[v],n+(c?"."+v:"["+v+"]"),i,r,o,s,a,u,c,h,p,l)))}return g},Xe=Object.prototype.hasOwnProperty,$e={allowDots:!1,allowPrototypes:!1,arrayLimit:20,decoder:He.decode,delimiter:"&",depth:5,parameterLimit:1e3,plainObjects:!1,strictNullHandling:!1},Ze=function(t,e,n){if(t){var i=n.allowDots?t.replace(/\.([^.[]+)/g,"[$1]"):t,r=/(\[[^[\]]*])/g,o=/(\[[^[\]]*])/.exec(i),s=o?i.slice(0,o.index):i,a=[];if(s){if(!n.plainObjects&&Xe.call(Object.prototype,s)&&!n.allowPrototypes)return;a.push(s)}for(var u=0;null!==(o=r.exec(i))&&u<n.depth;){if(u+=1,!n.plainObjects&&Xe.call(Object.prototype,o[1].slice(1,-1))&&!n.allowPrototypes)return;a.push(o[1])}return o&&a.push("["+i.slice(o.index)+"]"),function t(e,n,i){if(!e.length)return n;var r,o=e.shift();if("[]"===o)r=(r=[]).concat(t(e,n,i));else{r=i.plainObjects?Object.create(null):{};var s="["===o.charAt(0)&&"]"===o.charAt(o.length-1)?o.slice(1,-1):o,a=parseInt(s,10);!isNaN(a)&&o!==s&&String(a)===s&&a>=0&&i.parseArrays&&a<=i.arrayLimit?(r=[])[a]=t(e,n,i):r[s]=t(e,n,i)}return r}(a,e,n)}},Ge=function(t,e){var n=t,i=e||{};if(null!==i.encoder&&void 0!==i.encoder&&"function"!=typeof i.encoder)throw new TypeError("Encoder has to be a function.");var r=void 0===i.delimiter?Ke.delimiter:i.delimiter,o="boolean"==typeof i.strictNullHandling?i.strictNullHandling:Ke.strictNullHandling,s="boolean"==typeof i.skipNulls?i.skipNulls:Ke.skipNulls,a="boolean"==typeof i.encode?i.encode:Ke.encode,u="function"==typeof i.encoder?i.encoder:Ke.encoder,c="function"==typeof i.sort?i.sort:null,h=void 0!==i.allowDots&&i.allowDots,p="function"==typeof i.serializeDate?i.serializeDate:Ke.serializeDate,l="boolean"==typeof i.encodeValuesOnly?i.encodeValuesOnly:Ke.encodeValuesOnly;if(void 0===i.format)i.format=ze.default;else if(!Object.prototype.hasOwnProperty.call(ze.formatters,i.format))throw new TypeError("Unknown format option provided.");var f,d,g=ze.formatters[i.format];"function"==typeof i.filter?n=(d=i.filter)("",n):Array.isArray(i.filter)&&(f=d=i.filter);var m,v=[];if("object"!=y(n)||null===n)return"";m=i.arrayFormat in Fe?i.arrayFormat:"indices"in i?i.indices?"indices":"repeat":"indices";var w=Fe[m];f||(f=Object.keys(n)),c&&f.sort(c);for(var b=0;b<f.length;++b){var _=f[b];s&&null===n[_]||(v=v.concat(Je(n[_],_,w,o,s,a?u:null,d,c,h,p,g,l)))}return v.join(r)},Qe=Me((function(t){function e(t){if(t)return function(t){for(var n in e.prototype)t[n]=e.prototype[n];return t}(t)}t.exports=e,e.prototype.on=e.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},e.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},e.prototype.off=e.prototype.removeListener=e.prototype.removeAllListeners=e.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,i=this._callbacks["$"+t];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var r=0;r<i.length;r++)if((n=i[r])===e||n.fn===e){i.splice(r,1);break}return this},e.prototype.emit=function(t){this._callbacks=this._callbacks||{};var e=[].slice.call(arguments,1),n=this._callbacks["$"+t];if(n)for(var i=0,r=(n=n.slice(0)).length;i<r;++i)n[i].apply(this,e);return this},e.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]},e.prototype.hasListeners=function(t){return!!this.listeners(t).length}})),tn=function(t){return null!==t&&"object"==y(t)},en=nn;function nn(t){if(t)return function(t){for(var e in nn.prototype)t[e]=nn.prototype[e];return t}(t)}nn.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,this},nn.prototype.parse=function(t){return this._parser=t,this},nn.prototype.responseType=function(t){return this._responseType=t,this},nn.prototype.serialize=function(t){return this._serializer=t,this},nn.prototype.timeout=function(t){if(!t||"object"!=y(t))return this._timeout=t,this._responseTimeout=0,this;for(var e in t)switch(e){case"deadline":this._timeout=t.deadline;break;case"response":this._responseTimeout=t.response;break;default:console.warn("Unknown timeout option",e)}return this},nn.prototype.retry=function(t,e){return 0!==arguments.length&&!0!==t||(t=1),t<=0&&(t=0),this._maxRetries=t,this._retries=0,this._retryCallback=e,this};var rn=["ECONNRESET","ETIMEDOUT","EADDRINFO","ESOCKETTIMEDOUT"];nn.prototype._shouldRetry=function(t,e){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var n=this._retryCallback(t,e);if(!0===n)return!0;if(!1===n)return!1}catch(t){console.error(t)}if(e&&e.status&&e.status>=500&&501!=e.status)return!0;if(t){if(t.code&&~rn.indexOf(t.code))return!0;if(t.timeout&&"ECONNABORTED"==t.code)return!0;if(t.crossDomain)return!0}return!1},nn.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this._end()},nn.prototype.then=function(t,e){if(!this._fullfilledPromise){var n=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise((function(t,e){n.end((function(n,i){n?e(n):t(i)}))}))}return this._fullfilledPromise.then(t,e)},nn.prototype.catch=function(t){return this.then(void 0,t)},nn.prototype.use=function(t){return t(this),this},nn.prototype.ok=function(t){if("function"!=typeof t)throw Error("Callback required");return this._okCallback=t,this},nn.prototype._isResponseOK=function(t){return!!t&&(this._okCallback?this._okCallback(t):t.status>=200&&t.status<300)},nn.prototype.get=function(t){return this._header[t.toLowerCase()]},nn.prototype.getHeader=nn.prototype.get,nn.prototype.set=function(t,e){if(tn(t)){for(var n in t)this.set(n,t[n]);return this}return this._header[t.toLowerCase()]=e,this.header[t]=e,this},nn.prototype.unset=function(t){return delete this._header[t.toLowerCase()],delete this.header[t],this},nn.prototype.field=function(t,e){if(null==t)throw new Error(".field(name, val) name can not be empty");if(this._data&&console.error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()"),tn(t)){for(var n in t)this.field(n,t[n]);return this}if(Array.isArray(e)){for(var i in e)this.field(t,e[i]);return this}if(null==e)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof e&&(e=""+e),this._getFormData().append(t,e),this},nn.prototype.abort=function(){return this._aborted||(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort")),this},nn.prototype._auth=function(t,e,n,i){switch(n.type){case"basic":this.set("Authorization","Basic "+i(t+":"+e));break;case"auto":this.username=t,this.password=e;break;case"bearer":this.set("Authorization","Bearer "+t)}return this},nn.prototype.withCredentials=function(t){return null==t&&(t=!0),this._withCredentials=t,this},nn.prototype.redirects=function(t){return this._maxRedirects=t,this},nn.prototype.maxResponseSize=function(t){if("number"!=typeof t)throw TypeError("Invalid argument");return this._maxResponseSize=t,this},nn.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},nn.prototype.send=function(t){var e=tn(t),n=this._header["content-type"];if(this._formData&&console.error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()"),e&&!this._data)Array.isArray(t)?this._data=[]:this._isHost(t)||(this._data={});else if(t&&this._data&&this._isHost(this._data))throw Error("Can't merge these send calls");if(e&&tn(this._data))for(var i in t)this._data[i]=t[i];else"string"==typeof t?(n||this.type("form"),n=this._header["content-type"],this._data="application/x-www-form-urlencoded"==n?this._data?this._data+"&"+t:t:(this._data||"")+t):this._data=t;return!e||this._isHost(t)||n||this.type("json"),this},nn.prototype.sortQuery=function(t){return this._sort=void 0===t||t,this},nn.prototype._finalizeQueryString=function(){var t=this._query.join("&");if(t&&(this.url+=(this.url.indexOf("?")>=0?"&":"?")+t),this._query.length=0,this._sort){var e=this.url.indexOf("?");if(e>=0){var n=this.url.substring(e+1).split("&");"function"==typeof this._sort?n.sort(this._sort):n.sort(),this.url=this.url.substring(0,e)+"?"+n.join("&")}}},nn.prototype._appendQueryString=function(){console.trace("Unsupported")},nn.prototype._timeoutError=function(t,e,n){if(!this._aborted){var i=new Error(t+e+"ms exceeded");i.timeout=e,i.code="ECONNABORTED",i.errno=n,this.timedout=!0,this.abort(),this.callback(i)}},nn.prototype._setTimeouts=function(){var t=this;this._timeout&&!this._timer&&(this._timer=setTimeout((function(){t._timeoutError("Timeout of ",t._timeout,"ETIME")}),this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout((function(){t._timeoutError("Response timeout of ",t._responseTimeout,"ETIMEDOUT")}),this._responseTimeout))};var on=sn;function sn(t){if(t)return function(t){for(var e in sn.prototype)t[e]=sn.prototype[e];return t}(t)}function an(){this._defaults=[]}sn.prototype.get=function(t){return this.header[t.toLowerCase()]},sn.prototype._setHeaderProperties=function(t){var e=t["content-type"]||"";this.type=function(t){return t.split(/ *; */).shift()}(e);var n=function(t){return t.split(/ *; */).reduce((function(t,e){var n=e.split(/ *= */),i=n.shift(),r=n.shift();return i&&r&&(t[i]=r),t}),{})}(e);for(var i in n)this[i]=n[i];this.links={};try{t.link&&(this.links=function(t){return t.split(/ *, */).reduce((function(t,e){var n=e.split(/ *; */),i=n[0].slice(1,-1);return t[n[1].split(/ *= */)[1].slice(1,-1)]=i,t}),{})}(t.link))}catch(t){}},sn.prototype._setStatusProperties=function(t){var e=t/100|0;this.status=this.statusCode=t,this.statusType=e,this.info=1==e,this.ok=2==e,this.redirect=3==e,this.clientError=4==e,this.serverError=5==e,this.error=(4==e||5==e)&&this.toError(),this.accepted=202==t,this.noContent=204==t,this.badRequest=400==t,this.unauthorized=401==t,this.notAcceptable=406==t,this.forbidden=403==t,this.notFound=404==t},["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert"].forEach((function(t){an.prototype[t]=function(){return this._defaults.push({fn:t,arguments:arguments}),this}})),an.prototype._setDefaults=function(t){this._defaults.forEach((function(e){t[e.fn].apply(t,e.arguments)}))};for(var un=an,cn=Me((function(t,e){var n;function i(){}"undefined"!=typeof window?n=window:"undefined"!=typeof self?n=self:(console.warn("Using browser-only version of superagent in non-browser environment"),n=qe);var r=e=t.exports=function(t,n){return"function"==typeof n?new e.Request("GET",t).end(n):1==arguments.length?new e.Request("GET",t):new e.Request(t,n)};e.Request=p,r.getXHR=function(){if(!(!n.XMLHttpRequest||n.location&&"file:"==n.location.protocol&&n.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(t){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(t){}throw Error("Browser-only version of superagent could not find XHR")};var o="".trim?function(t){return t.trim()}:function(t){return t.replace(/(^\s*|\s*$)/g,"")};function s(t){if(!tn(t))return t;var e=[];for(var n in t)a(e,n,t[n]);return e.join("&")}function a(t,e,n){if(null!=n)if(Array.isArray(n))n.forEach((function(n){a(t,e,n)}));else if(tn(n))for(var i in n)a(t,e+"["+i+"]",n[i]);else t.push(encodeURIComponent(e)+"="+encodeURIComponent(n));else null===n&&t.push(encodeURIComponent(e))}function u(t){for(var e,n,i={},r=t.split("&"),o=0,s=r.length;o<s;++o)-1==(n=(e=r[o]).indexOf("="))?i[decodeURIComponent(e)]="":i[decodeURIComponent(e.slice(0,n))]=decodeURIComponent(e.slice(n+1));return i}function c(t){return/[\/+]json($|[^-\w])/.test(t)}function h(t){this.req=t,this.xhr=this.req.xhr,this.text="HEAD"!=this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var e=this.xhr.status;1223===e&&(e=204),this._setStatusProperties(e),this.header=this.headers=function(t){for(var e,n,i,r,s=t.split(/\r?\n/),a={},u=0,c=s.length;u<c;++u)-1!==(e=(n=s[u]).indexOf(":"))&&(i=n.slice(0,e).toLowerCase(),r=o(n.slice(e+1)),a[i]=r);return a}(this.xhr.getAllResponseHeaders()),this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&t._responseType?this.body=this.xhr.response:this.body="HEAD"!=this.req.method?this._parseBody(this.text?this.text:this.xhr.response):null}function p(t,e){var n=this;this._query=this._query||[],this.method=t,this.url=e,this.header={},this._header={},this.on("end",(function(){var t,e=null,i=null;try{i=new h(n)}catch(t){return(e=new Error("Parser is unable to parse the response")).parse=!0,e.original=t,n.xhr?(e.rawResponse=void 0===n.xhr.responseType?n.xhr.responseText:n.xhr.response,e.status=n.xhr.status?n.xhr.status:null,e.statusCode=e.status):(e.rawResponse=null,e.status=null),n.callback(e)}n.emit("response",i);try{n._isResponseOK(i)||(t=new Error(i.statusText||"Unsuccessful HTTP response"))}catch(e){t=e}t?(t.original=e,t.response=i,t.status=i.status,n.callback(t,i)):n.callback(null,i)}))}function l(t,e,n){var i=r("DELETE",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i}r.serializeObject=s,r.parseString=u,r.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},r.serialize={"application/x-www-form-urlencoded":s,"application/json":JSON.stringify},r.parse={"application/x-www-form-urlencoded":u,"application/json":JSON.parse},on(h.prototype),h.prototype._parseBody=function(t){var e=r.parse[this.type];return this.req._parser?this.req._parser(this,t):(!e&&c(this.type)&&(e=r.parse["application/json"]),e&&t&&(t.length||t instanceof Object)?e(t):null)},h.prototype.toError=function(){var t=this.req,e=t.method,n=t.url,i="cannot "+e+" "+n+" ("+this.status+")",r=new Error(i);return r.status=this.status,r.method=e,r.url=n,r},r.Response=h,Qe(p.prototype),en(p.prototype),p.prototype.type=function(t){return this.set("Content-Type",r.types[t]||t),this},p.prototype.accept=function(t){return this.set("Accept",r.types[t]||t),this},p.prototype.auth=function(t,e,n){return 1===arguments.length&&(e=""),"object"==y(e)&&null!==e&&(n=e,e=""),n||(n={type:"function"==typeof btoa?"basic":"auto"}),this._auth(t,e,n,(function(t){if("function"==typeof btoa)return btoa(t);throw new Error("Cannot use basic auth, btoa is not a function")}))},p.prototype.query=function(t){return"string"!=typeof t&&(t=s(t)),t&&this._query.push(t),this},p.prototype.attach=function(t,e,n){if(e){if(this._data)throw Error("superagent can't mix .send() and .attach()");this._getFormData().append(t,e,n||e.name)}return this},p.prototype._getFormData=function(){return this._formData||(this._formData=new n.FormData),this._formData},p.prototype.callback=function(t,e){if(this._shouldRetry(t,e))return this._retry();var n=this._callback;this.clearTimeout(),t&&(this._maxRetries&&(t.retries=this._retries-1),this.emit("error",t)),n(t,e)},p.prototype.crossDomainError=function(){var t=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");t.crossDomain=!0,t.status=this.status,t.method=this.method,t.url=this.url,this.callback(t)},p.prototype.buffer=p.prototype.ca=p.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},p.prototype.pipe=p.prototype.write=function(){throw Error("Streaming is not supported in browser version of superagent")},p.prototype._isHost=function(t){return t&&"object"==y(t)&&!Array.isArray(t)&&"[object Object]"!==Object.prototype.toString.call(t)},p.prototype.end=function(t){return this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=t||i,this._finalizeQueryString(),this._end()},p.prototype._end=function(){var t=this,e=this.xhr=r.getXHR(),n=this._formData||this._data;this._setTimeouts(),e.onreadystatechange=function(){var n=e.readyState;if(n>=2&&t._responseTimeoutTimer&&clearTimeout(t._responseTimeoutTimer),4==n){var i;try{i=e.status}catch(t){i=0}if(!i){if(t.timedout||t._aborted)return;return t.crossDomainError()}t.emit("end")}};var i=function(e,n){n.total>0&&(n.percent=n.loaded/n.total*100),n.direction=e,t.emit("progress",n)};if(this.hasListeners("progress"))try{e.onprogress=i.bind(null,"download"),e.upload&&(e.upload.onprogress=i.bind(null,"upload"))}catch(t){}try{this.username&&this.password?e.open(this.method,this.url,!0,this.username,this.password):e.open(this.method,this.url,!0)}catch(t){return this.callback(t)}if(this._withCredentials&&(e.withCredentials=!0),!this._formData&&"GET"!=this.method&&"HEAD"!=this.method&&"string"!=typeof n&&!this._isHost(n)){var o=this._header["content-type"],s=this._serializer||r.serialize[o?o.split(";")[0]:""];!s&&c(o)&&(s=r.serialize["application/json"]),s&&(n=s(n))}for(var a in this.header)null!=this.header[a]&&this.header.hasOwnProperty(a)&&e.setRequestHeader(a,this.header[a]);return this._responseType&&(e.responseType=this._responseType),this.emit("request",this),e.send(void 0!==n?n:null),this},r.agent=function(){return new un},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach((function(t){un.prototype[t.toLowerCase()]=function(e,n){var i=new r.Request(t,e);return this._setDefaults(i),n&&i.end(n),i}})),un.prototype.del=un.prototype.delete,r.get=function(t,e,n){var i=r("GET",t);return"function"==typeof e&&(n=e,e=null),e&&i.query(e),n&&i.end(n),i},r.head=function(t,e,n){var i=r("HEAD",t);return"function"==typeof e&&(n=e,e=null),e&&i.query(e),n&&i.end(n),i},r.options=function(t,e,n){var i=r("OPTIONS",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},r.del=l,r.delete=l,r.patch=function(t,e,n){var i=r("PATCH",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},r.post=function(t,e,n){var i=r("POST",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i},r.put=function(t,e,n){var i=r("PUT",t);return"function"==typeof e&&(n=e,e=null),e&&i.send(e),n&&i.end(n),i}})),hn=(cn.Request,[]),pn=[],ln="undefined"!=typeof Uint8Array?Uint8Array:Array,fn="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",dn=0,gn=fn.length;dn<gn;++dn)hn[dn]=fn[dn],pn[fn.charCodeAt(dn)]=dn;function yn(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===t[e-2]?2:"="===t[e-1]?1:0}function mn(t,e,n){for(var i,r=[],o=e;o<n;o+=3)i=(t[o]<<16)+(t[o+1]<<8)+t[o+2],r.push(hn[(s=i)>>18&63]+hn[s>>12&63]+hn[s>>6&63]+hn[63&s]);var s;return r.join("")}pn["-".charCodeAt(0)]=62,pn["_".charCodeAt(0)]=63;var vn=function(t){var e,n,i,r,o,s,a=t.length;o=yn(t),s=new ln(3*a/4-o),i=o>0?a-4:a;var u=0;for(e=0,n=0;e<i;e+=4,n+=3)r=pn[t.charCodeAt(e)]<<18|pn[t.charCodeAt(e+1)]<<12|pn[t.charCodeAt(e+2)]<<6|pn[t.charCodeAt(e+3)],s[u++]=r>>16&255,s[u++]=r>>8&255,s[u++]=255&r;return 2===o?(r=pn[t.charCodeAt(e)]<<2|pn[t.charCodeAt(e+1)]>>4,s[u++]=255&r):1===o&&(r=pn[t.charCodeAt(e)]<<10|pn[t.charCodeAt(e+1)]<<4|pn[t.charCodeAt(e+2)]>>2,s[u++]=r>>8&255,s[u++]=255&r),s},wn=function(t){for(var e,n=t.length,i=n%3,r="",o=[],s=0,a=n-i;s<a;s+=16383)o.push(mn(t,s,s+16383>a?a:s+16383));return 1===i?(e=t[n-1],r+=hn[e>>2],r+=hn[e<<4&63],r+="=="):2===i&&(e=(t[n-2]<<8)+t[n-1],r+=hn[e>>10],r+=hn[e>>4&63],r+=hn[e<<2&63],r+="="),o.push(r),o.join("")},bn=function(t){return wn(function(t){for(var e=new Array(t.length),n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}(t)).replace(/\+/g,"-").replace(/\//g,"_")},_n={raw:"9.10.4"},Tn=Object.prototype.toString;function kn(t,e,n,i){if(n="array"===n?"object":n,t&&y(t[e])!==n)throw new Error(i)}function On(t,e,n){if(y(t)!==e)throw new Error(n)}function In(t,e,n){if(-1===e.indexOf(t))throw new Error(n)}var En={check:function(t,e,n){if(e.optional&&!t||On(t,e.type,e.message),"object"===e.type&&n)for(var i=Object.keys(n),r=0;r<i.length;r++){var o=i[r];n[o].optional&&!t[o]||n[o].condition&&!n[o].condition(t)||(kn(t,o,n[o].type,n[o].message),n[o].values&&In(t[o],n[o].values,n[o].value_message))}},attribute:kn,variable:On,value:In,isArray:function(t){return this.supportsIsArray()?Array.isArray(t):"[object Array]"===Tn.call(t)},supportsIsArray:function(){return null!=Array.isArray}};function Sn(t){if(null==t)throw new TypeError("Cannot convert first argument to object");for(var e=Object(t),n=1;n<arguments.length;n++){var i=arguments[n];if(null!=i)for(var r=Object.keys(Object(i)),o=0,s=r.length;o<s;o++){var a=r[o],u=Object.getOwnPropertyDescriptor(i,a);void 0!==u&&u.enumerable&&(e[a]=i[a])}}return e}var Cn=function(){return Object.assign?Object.assign:Sn};function An(t,e){return e.reduce((function(e,n){return t[n]&&(e[n]=t[n]),e}),{})}function Un(t){var e=[];for(var n in t)e.push(t[n]);return e}function Rn(){var t=Un(arguments);return t.unshift({}),Cn().apply(void 0,t)}function xn(t){var e=t.match(/^(https?:|file:)\/\/(([^:\/?#]*)(?::([0-9]+))?)([\/]{0,1}[^?#]*)(\?[^#]*|)(#.*|)$/);return e&&{href:t,protocol:e[1],host:e[2],hostname:e[3],port:e[4],pathname:e[5],search:e[6],hash:e[7]}}function Dn(t,e){var n=Rn(t);return t[e]&&(n[e]=t[e].trim()),n}var Bn={toSnakeCase:function t(e,n){return"object"!=y(e)||En.isArray(e)||null===e?e:(n=n||[],Object.keys(e).reduce((function(i,r){return i[-1===n.indexOf(r)?function(t){for(var e,n="",i=0,r=!0,o=!0;i<t.length;)e=t.charCodeAt(i),!o&&e>=65&&e<=90||!r&&e>=48&&e<=57?(n+="_",n+=t[i].toLowerCase()):n+=t[i].toLowerCase(),r=e>=48&&e<=57,o=e>=65&&e<=90,i++;return n}(r):r]=t(e[r]),i}),{}))},toCamelCase:function t(e,n,i){return"object"!=y(e)||En.isArray(e)||null===e?e:(n=n||[],i=i||{},Object.keys(e).reduce((function(r,o){var s,a=-1===n.indexOf(o)?(s=o.split("_")).reduce((function(t,e){return t+e.charAt(0).toUpperCase()+e.slice(1)}),s.shift()):o;return r[a]=t(e[a]||e[o],[],i),i.keepOriginal&&(r[o]=t(e[o],[],i)),r}),{}))},blacklist:function(t,e){return Object.keys(t).reduce((function(n,i){return-1===e.indexOf(i)&&(n[i]=t[i]),n}),{})},merge:function(t,e){return{base:e?An(t,e):t,with:function(t,e){return t=e?An(t,e):t,Rn(this.base,t)}}},pick:An,getKeysNotIn:function(t,e){var n=[];for(var i in t)-1===e.indexOf(i)&&n.push(i);return n},extend:Rn,getOriginFromUrl:function(t){if(t){var e=xn(t),n=e.protocol+"//"+e.hostname;return e.port&&(n+=":"+e.port),n}},getLocationFromUrl:xn,trimUserDetails:function(t){return function(t,e){return["username","email","phoneNumber"].reduce(Dn,t)}(t)}};function Pn(t){this.request=t,this.method=t.method,this.url=t.url,this.body=t._data,this.headers=t._header}function jn(t){this.request=t}function Ln(t){this._sendTelemetry=!1!==t._sendTelemetry||t._sendTelemetry,this._telemetryInfo=t._telemetryInfo||null,this._timesToRetryFailedRequests=t._timesToRetryFailedRequests,this.headers=t.headers||{},this._universalLoginPage=t.universalLoginPage}function qn(){return window}Pn.prototype.abort=function(){this.request.abort()},Pn.prototype.getMethod=function(){return this.method},Pn.prototype.getBody=function(){return this.body},Pn.prototype.getUrl=function(){return this.url},Pn.prototype.getHeaders=function(){return this.headers},jn.prototype.set=function(t,e){return this.request=this.request.set(t,e),this},jn.prototype.send=function(t){return this.request=this.request.send(Bn.trimUserDetails(t)),this},jn.prototype.withCredentials=function(){return this.request=this.request.withCredentials(),this},jn.prototype.end=function(t){return this.request=this.request.end(t),new Pn(this.request)},Ln.prototype.setCommonConfiguration=function(t,e){if(e=e||{},this._timesToRetryFailedRequests>0&&(t=t.retry(this._timesToRetryFailedRequests)),e.noHeaders)return t;var n=this.headers;t=t.set("Content-Type","application/json");for(var i=Object.keys(this.headers),r=0;r<i.length;r++)t=t.set(i[r],n[i[r]]);return this._sendTelemetry&&(t=t.set("Auth0-Client",this.getTelemetryData())),t},Ln.prototype.getTelemetryData=function(){var t=this._universalLoginPage?"auth0.js-ulp":"auth0.js",e={name:t,version:_n.raw};this._telemetryInfo&&((e=Bn.extend({},this._telemetryInfo)).env=Bn.extend({},this._telemetryInfo.env),e.env[t]=_n.raw);var n=JSON.stringify(e);return bn(n)},Ln.prototype.get=function(t,e){return new jn(this.setCommonConfiguration(cn.get(t),e))},Ln.prototype.post=function(t,e){return new jn(this.setCommonConfiguration(cn.post(t),e))},Ln.prototype.patch=function(t,e){return new jn(this.setCommonConfiguration(cn.patch(t),e))};var Mn={redirect:function(t){qn().location=t},getDocument:function(){return qn().document},getWindow:qn,getOrigin:function(){var t=qn().location,e=t.origin;return e||(e=Bn.getOriginFromUrl(t.href)),e}};function Nn(){}Nn.prototype.getItem=function(){return null},Nn.prototype.removeItem=function(){},Nn.prototype.setItem=function(){};var Hn=Me((function(t,e){t.exports=function(){function t(){for(var t=0,e={};t<arguments.length;t++){var n=arguments[t];for(var i in n)e[i]=n[i]}return e}return function e(n){function i(e,r,o){var s;if("undefined"!=typeof document){if(arguments.length>1){if("number"==typeof(o=t({path:"/"},i.defaults,o)).expires){var a=new Date;a.setMilliseconds(a.getMilliseconds()+864e5*o.expires),o.expires=a}o.expires=o.expires?o.expires.toUTCString():"";try{s=JSON.stringify(r),/^[\{\[]/.test(s)&&(r=s)}catch(t){}r=n.write?n.write(r,e):encodeURIComponent(String(r)).replace(/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,decodeURIComponent),e=(e=(e=encodeURIComponent(String(e))).replace(/%(23|24|26|2B|5E|60|7C)/g,decodeURIComponent)).replace(/[\(\)]/g,escape);var u="";for(var c in o)o[c]&&(u+="; "+c,!0!==o[c]&&(u+="="+o[c]));return document.cookie=e+"="+r+u}e||(s={});for(var h=document.cookie?document.cookie.split("; "):[],p=/(%[0-9A-Z]{2})+/g,l=0;l<h.length;l++){var f=h[l].split("="),d=f.slice(1).join("=");this.json||'"'!==d.charAt(0)||(d=d.slice(1,-1));try{var g=f[0].replace(p,decodeURIComponent);if(d=n.read?n.read(d,g):n(d,g)||d.replace(p,decodeURIComponent),this.json)try{d=JSON.parse(d)}catch(t){}if(e===g){s=d;break}e||(s[g]=d)}catch(t){}}return s}}return i.set=i,i.get=function(t){return i.call(i,t)},i.getJSON=function(){return i.apply({json:!0},[].slice.call(arguments))},i.defaults={},i.remove=function(e,n){i(e,"",t(n,{expires:-1}))},i.withConverter=e,i}((function(){}))}()}));function Vn(){}function Wn(t){this.disableWarnings=t.disableWarnings}function zn(t){if(this.warn=new Wn({}),this.storage=new Vn,!0===t.__tryLocalStorageFirst)try{var e=Mn.getWindow().localStorage;e&&(this.storage=e)}catch(t){this.warn.warning(t),this.warn.warning("Can't use localStorage. Using CookieStorage instead.")}}function Fn(t){this.handler=new zn(t)}function Yn(t){this.storage=new Fn(t)}function Kn(t,e){return{error:t,errorDescription:e}}Vn.prototype.getItem=function(t){return Hn.get(t)},Vn.prototype.removeItem=function(t){Hn.remove(t)},Vn.prototype.setItem=function(t,e,n){var i=Bn.extend({expires:1},n);Hn.set(t,e,i)},Wn.prototype.warning=function(t){this.disableWarnings||console.warn(t)},zn.prototype.failover=function(){this.storage instanceof Nn?this.warn.warning("DummyStorage: ignore failover"):this.storage instanceof Vn?(this.warn.warning("CookieStorage: failing over DummyStorage"),this.storage=new Nn):(this.warn.warning("LocalStorage: failing over CookieStorage"),this.storage=new Vn)},zn.prototype.getItem=function(t){try{return this.storage.getItem(t)}catch(e){return this.warn.warning(e),this.failover(),this.getItem(t)}},zn.prototype.removeItem=function(t){try{return this.storage.removeItem(t)}catch(e){return this.warn.warning(e),this.failover(),this.removeItem(t)}},zn.prototype.setItem=function(t,e,n){try{return this.storage.setItem(t,e,n)}catch(i){return this.warn.warning(i),this.failover(),this.setItem(t,e,n)}},Fn.prototype.getItem=function(t){var e=this.handler.getItem(t);try{return JSON.parse(e)}catch(t){return e}},Fn.prototype.removeItem=function(t){return this.handler.removeItem(t)},Fn.prototype.setItem=function(t,e,n){var i=JSON.stringify(e);return this.handler.setItem(t,i,n)},Yn.prototype.set=function(t,e){var n={lastUsedConnection:t,lastUsedSub:e};this.storage.setItem("auth0.ssodata",JSON.stringify(n))},Yn.prototype.get=function(){var t=this.storage.getItem("auth0.ssodata");if(t)return JSON.parse(t)};var Jn={buildResponse:Kn,invalidToken:function(t){return Kn("invalid_token",t)}};function Xn(t,e){return(e=e||{}).ignoreCasing=!!e.ignoreCasing&&e.ignoreCasing,function(n,i){var r;return n||i?(!n&&i.err&&(n=i.err,i=null),!n&&i.error&&(n=i,i=null),n?(r={original:n},n.response&&n.response.statusCode&&(r.statusCode=n.response.statusCode),n.response&&n.response.statusText&&(r.statusText=n.response.statusText),n.response&&n.response.body&&(n=n.response.body),n.err&&(n=n.err),r.code=n.code||n.error||n.error_code||n.status||null,r.description=n.errorDescription||n.error_description||n.description||n.error||n.details||n.err||null,e.forceLegacyError&&(r.error=r.code,r.error_description=r.description),n.name&&(r.name=n.name),n.policy&&(r.policy=n.policy),t(r)):!i.type||"text/html"!==i.type&&"text/plain"!==i.type?e.ignoreCasing?t(null,i.body||i):t(null,Bn.toCamelCase(i.body||i,[],{keepOriginal:e.keepOriginalCasing})):t(null,i.text)):t(Jn.buildResponse("generic_error","Something went wrong"))}}var $n=["realm","audience","client_id","client_secret","redirect_uri","scope","code","grant_type","username","password","refresh_token","assertion","client_assertion","client_assertion_type","code_verifier"],Zn=["connection","connection_scope","auth0Client","owp","device","realm","protocol","_csrf","_intstate","login_ticket","client_id","response_type","response_mode","redirect_uri","audience","scope","state","nonce","display","prompt","max_age","ui_locales","claims_locales","id_token_hint","login_hint","acr_values","claims","registration","request","request_uri","code_challenge","code_challenge_method","access_type","display"],Gn=function(t,e){return Bn.pick(e,$n)},Qn=function(t,e){var n=Bn.getKeysNotIn(e,Zn);return n.length>0&&t.warning("Following parameters are not allowed on the `/authorize` endpoint: ["+n.join(",")+"]"),e},ti=Me((function(t,e){var n;t.exports=n=n||function(t,e){var n=Object.create||function(){function t(){}return function(e){var n;return t.prototype=e,n=new t,t.prototype=null,n}}(),i={},r=i.lib={},o=r.Base={extend:function(t){var e=n(this);return t&&e.mixIn(t),e.hasOwnProperty("init")&&this.init!==e.init||(e.init=function(){e.$super.init.apply(this,arguments)}),e.init.prototype=e,e.$super=this,e},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}},s=r.WordArray=o.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||u).stringify(this)},concat:function(t){var e=this.words,n=t.words,i=this.sigBytes,r=t.sigBytes;if(this.clamp(),i%4)for(var o=0;o<r;o++){var s=n[o>>>2]>>>24-o%4*8&255;e[i+o>>>2]|=s<<24-(i+o)%4*8}else for(o=0;o<r;o+=4)e[i+o>>>2]=n[o>>>2];return this.sigBytes+=r,this},clamp:function(){var e=this.words,n=this.sigBytes;e[n>>>2]&=4294967295<<32-n%4*8,e.length=t.ceil(n/4)},clone:function(){var t=o.clone.call(this);return t.words=this.words.slice(0),t},random:function(e){for(var n,i=[],r=function(e){e=e;var n=987654321,i=4294967295;return function(){var r=((n=36969*(65535&n)+(n>>16)&i)<<16)+(e=18e3*(65535&e)+(e>>16)&i)&i;return r/=4294967296,(r+=.5)*(t.random()>.5?1:-1)}},o=0;o<e;o+=4){var a=r(4294967296*(n||t.random()));n=987654071*a(),i.push(4294967296*a()|0)}return new s.init(i,e)}}),a=i.enc={},u=a.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,i=[],r=0;r<n;r++){var o=e[r>>>2]>>>24-r%4*8&255;i.push((o>>>4).toString(16)),i.push((15&o).toString(16))}return i.join("")},parse:function(t){for(var e=t.length,n=[],i=0;i<e;i+=2)n[i>>>3]|=parseInt(t.substr(i,2),16)<<24-i%8*4;return new s.init(n,e/2)}},c=a.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,i=[],r=0;r<n;r++){var o=e[r>>>2]>>>24-r%4*8&255;i.push(String.fromCharCode(o))}return i.join("")},parse:function(t){for(var e=t.length,n=[],i=0;i<e;i++)n[i>>>2]|=(255&t.charCodeAt(i))<<24-i%4*8;return new s.init(n,e)}},h=a.Utf8={stringify:function(t){try{return decodeURIComponent(escape(c.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return c.parse(unescape(encodeURIComponent(t)))}},p=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=h.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(e){var n=this._data,i=n.words,r=n.sigBytes,o=this.blockSize,a=r/(4*o),u=(a=e?t.ceil(a):t.max((0|a)-this._minBufferSize,0))*o,c=t.min(4*u,r);if(u){for(var h=0;h<u;h+=o)this._doProcessBlock(i,h);var p=i.splice(0,u);n.sigBytes-=c}return new s.init(p,c)},clone:function(){var t=o.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),l=(r.Hasher=p.extend({cfg:o.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new l.HMAC.init(t,n).finalize(e)}}}),i.algo={});return i}(Math)})),ei=Me((function(t,e){var n;t.exports=(n=ti,function(t){var e=n,i=e.lib,r=i.WordArray,o=i.Hasher,s=e.algo,a=[],u=[];!function(){function e(e){for(var n=t.sqrt(e),i=2;i<=n;i++)if(!(e%i))return!1;return!0}function n(t){return 4294967296*(t-(0|t))|0}for(var i=2,r=0;r<64;)e(i)&&(r<8&&(a[r]=n(t.pow(i,.5))),u[r]=n(t.pow(i,1/3)),r++),i++}();var c=[],h=s.SHA256=o.extend({_doReset:function(){this._hash=new r.init(a.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,i=n[0],r=n[1],o=n[2],s=n[3],a=n[4],h=n[5],p=n[6],l=n[7],f=0;f<64;f++){if(f<16)c[f]=0|t[e+f];else{var d=c[f-15],g=(d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3,y=c[f-2],m=(y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10;c[f]=g+c[f-7]+m+c[f-16]}var v=i&r^i&o^r&o,w=(i<<30|i>>>2)^(i<<19|i>>>13)^(i<<10|i>>>22),b=l+((a<<26|a>>>6)^(a<<21|a>>>11)^(a<<7|a>>>25))+(a&h^~a&p)+u[f]+c[f];l=p,p=h,h=a,a=s+b|0,s=o,o=r,r=i,i=b+(w+v)|0}n[0]=n[0]+i|0,n[1]=n[1]+r|0,n[2]=n[2]+o|0,n[3]=n[3]+s|0,n[4]=n[4]+a|0,n[5]=n[5]+h|0,n[6]=n[6]+p|0,n[7]=n[7]+l|0},_doFinalize:function(){var e=this._data,n=e.words,i=8*this._nDataBytes,r=8*e.sigBytes;return n[r>>>5]|=128<<24-r%32,n[14+(r+64>>>9<<4)]=t.floor(i/4294967296),n[15+(r+64>>>9<<4)]=i,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=o._createHelper(h),e.HmacSHA256=o._createHmacHelper(h)}(Math),n.SHA256)})),ni=Me((function(t,e){var n,i,r;t.exports=(r=(i=n=ti).lib.WordArray,i.enc.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,i=this._map;t.clamp();for(var r=[],o=0;o<n;o+=3)for(var s=(e[o>>>2]>>>24-o%4*8&255)<<16|(e[o+1>>>2]>>>24-(o+1)%4*8&255)<<8|e[o+2>>>2]>>>24-(o+2)%4*8&255,a=0;a<4&&o+.75*a<n;a++)r.push(i.charAt(s>>>6*(3-a)&63));var u=i.charAt(64);if(u)for(;r.length%4;)r.push(u);return r.join("")},parse:function(t){var e=t.length,n=this._map,i=this._reverseMap;if(!i){i=this._reverseMap=[];for(var o=0;o<n.length;o++)i[n.charCodeAt(o)]=o}var s=n.charAt(64);if(s){var a=t.indexOf(s);-1!==a&&(e=a)}return function(t,e,n){for(var i=[],o=0,s=0;s<e;s++)if(s%4){var a=n[t.charCodeAt(s-1)]<<s%4*2,u=n[t.charCodeAt(s)]>>>6-s%4*2;i[o>>>2]|=(a|u)<<24-o%4*8,o++}return r.create(i,o)}(t,e,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},n.enc.Base64)})),ii=Me((function(t,e){t.exports=ti.enc.Hex})),ri=Me((function(t,e){(function(){var e;function n(t,e,n){null!=t&&("number"==typeof t?this.fromNumber(t,e,n):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function i(){return new n(null)}var r="undefined"!=typeof navigator;r&&"Microsoft Internet Explorer"==navigator.appName?(n.prototype.am=function(t,e,n,i,r,o){for(var s=32767&e,a=e>>15;--o>=0;){var u=32767&this[t],c=this[t++]>>15,h=a*u+c*s;r=((u=s*u+((32767&h)<<15)+n[i]+(1073741823&r))>>>30)+(h>>>15)+a*c+(r>>>30),n[i++]=1073741823&u}return r},e=30):r&&"Netscape"!=navigator.appName?(n.prototype.am=function(t,e,n,i,r,o){for(;--o>=0;){var s=e*this[t++]+n[i]+r;r=Math.floor(s/67108864),n[i++]=67108863&s}return r},e=26):(n.prototype.am=function(t,e,n,i,r,o){for(var s=16383&e,a=e>>14;--o>=0;){var u=16383&this[t],c=this[t++]>>14,h=a*u+c*s;r=((u=s*u+((16383&h)<<14)+n[i]+r)>>28)+(h>>14)+a*c,n[i++]=268435455&u}return r},e=28),n.prototype.DB=e,n.prototype.DM=(1<<e)-1,n.prototype.DV=1<<e,n.prototype.FV=Math.pow(2,52),n.prototype.F1=52-e,n.prototype.F2=2*e-52;var o,s,a=new Array;for(o="0".charCodeAt(0),s=0;s<=9;++s)a[o++]=s;for(o="a".charCodeAt(0),s=10;s<36;++s)a[o++]=s;for(o="A".charCodeAt(0),s=10;s<36;++s)a[o++]=s;function u(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function c(t,e){var n=a[t.charCodeAt(e)];return null==n?-1:n}function h(t){var e=i();return e.fromInt(t),e}function p(t){var e,n=1;return 0!=(e=t>>>16)&&(t=e,n+=16),0!=(e=t>>8)&&(t=e,n+=8),0!=(e=t>>4)&&(t=e,n+=4),0!=(e=t>>2)&&(t=e,n+=2),0!=(e=t>>1)&&(t=e,n+=1),n}function l(t){this.m=t}function f(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function d(t,e){return t&e}function g(t,e){return t|e}function y(t,e){return t^e}function m(t,e){return t&~e}function v(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function w(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function b(){}function _(t){return t}function T(t){this.r2=i(),this.q3=i(),n.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}l.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},l.prototype.revert=function(t){return t},l.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},l.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},l.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},f.prototype.convert=function(t){var e=i();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(n.ZERO)>0&&this.m.subTo(e,e),e},f.prototype.revert=function(t){var e=i();return t.copyTo(e),this.reduce(e),e},f.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var n=32767&t[e],i=n*this.mpl+((n*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[n=e+this.m.t]+=this.m.am(0,i,t,e,0,this.m.t);t[n]>=t.DV;)t[n]-=t.DV,t[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},f.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},f.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},n.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},n.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},n.prototype.fromString=function(t,e){var i;if(16==e)i=4;else if(8==e)i=3;else if(256==e)i=8;else if(2==e)i=1;else if(32==e)i=5;else{if(4!=e)return void this.fromRadix(t,e);i=2}this.t=0,this.s=0;for(var r=t.length,o=!1,s=0;--r>=0;){var a=8==i?255&t[r]:c(t,r);a<0?"-"==t.charAt(r)&&(o=!0):(o=!1,0==s?this[this.t++]=a:s+i>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,(s+=i)>=this.DB&&(s-=this.DB))}8==i&&0!=(128&t[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),o&&n.ZERO.subTo(this,this)},n.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},n.prototype.dlShiftTo=function(t,e){var n;for(n=this.t-1;n>=0;--n)e[n+t]=this[n];for(n=t-1;n>=0;--n)e[n]=0;e.t=this.t+t,e.s=this.s},n.prototype.drShiftTo=function(t,e){for(var n=t;n<this.t;++n)e[n-t]=this[n];e.t=Math.max(this.t-t,0),e.s=this.s},n.prototype.lShiftTo=function(t,e){var n,i=t%this.DB,r=this.DB-i,o=(1<<r)-1,s=Math.floor(t/this.DB),a=this.s<<i&this.DM;for(n=this.t-1;n>=0;--n)e[n+s+1]=this[n]>>r|a,a=(this[n]&o)<<i;for(n=s-1;n>=0;--n)e[n]=0;e[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()},n.prototype.rShiftTo=function(t,e){e.s=this.s;var n=Math.floor(t/this.DB);if(n>=this.t)e.t=0;else{var i=t%this.DB,r=this.DB-i,o=(1<<i)-1;e[0]=this[n]>>i;for(var s=n+1;s<this.t;++s)e[s-n-1]|=(this[s]&o)<<r,e[s-n]=this[s]>>i;i>0&&(e[this.t-n-1]|=(this.s&o)<<r),e.t=this.t-n,e.clamp()}},n.prototype.subTo=function(t,e){for(var n=0,i=0,r=Math.min(t.t,this.t);n<r;)i+=this[n]-t[n],e[n++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i-=t.s;n<this.t;)i+=this[n],e[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<t.t;)i-=t[n],e[n++]=i&this.DM,i>>=this.DB;i-=t.s}e.s=i<0?-1:0,i<-1?e[n++]=this.DV+i:i>0&&(e[n++]=i),e.t=n,e.clamp()},n.prototype.multiplyTo=function(t,e){var i=this.abs(),r=t.abs(),o=i.t;for(e.t=o+r.t;--o>=0;)e[o]=0;for(o=0;o<r.t;++o)e[o+i.t]=i.am(0,r[o],e,o,0,i.t);e.s=0,e.clamp(),this.s!=t.s&&n.ZERO.subTo(e,e)},n.prototype.squareTo=function(t){for(var e=this.abs(),n=t.t=2*e.t;--n>=0;)t[n]=0;for(n=0;n<e.t-1;++n){var i=e.am(n,e[n],t,2*n,0,1);(t[n+e.t]+=e.am(n+1,2*e[n],t,2*n+1,i,e.t-n-1))>=e.DV&&(t[n+e.t]-=e.DV,t[n+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(n,e[n],t,2*n,0,1)),t.s=0,t.clamp()},n.prototype.divRemTo=function(t,e,r){var o=t.abs();if(!(o.t<=0)){var s=this.abs();if(s.t<o.t)return null!=e&&e.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=i());var a=i(),u=this.s,c=t.s,h=this.DB-p(o[o.t-1]);h>0?(o.lShiftTo(h,a),s.lShiftTo(h,r)):(o.copyTo(a),s.copyTo(r));var l=a.t,f=a[l-1];if(0!=f){var d=f*(1<<this.F1)+(l>1?a[l-2]>>this.F2:0),g=this.FV/d,y=(1<<this.F1)/d,m=1<<this.F2,v=r.t,w=v-l,b=null==e?i():e;for(a.dlShiftTo(w,b),r.compareTo(b)>=0&&(r[r.t++]=1,r.subTo(b,r)),n.ONE.dlShiftTo(l,b),b.subTo(a,a);a.t<l;)a[a.t++]=0;for(;--w>=0;){var _=r[--v]==f?this.DM:Math.floor(r[v]*g+(r[v-1]+m)*y);if((r[v]+=a.am(0,_,r,w,0,l))<_)for(a.dlShiftTo(w,b),r.subTo(b,r);r[v]<--_;)r.subTo(b,r)}null!=e&&(r.drShiftTo(l,e),u!=c&&n.ZERO.subTo(e,e)),r.t=l,r.clamp(),h>0&&r.rShiftTo(h,r),u<0&&n.ZERO.subTo(r,r)}}},n.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},n.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},n.prototype.exp=function(t,e){if(t>4294967295||t<1)return n.ONE;var r=i(),o=i(),s=e.convert(this),a=p(t)-1;for(s.copyTo(r);--a>=0;)if(e.sqrTo(r,o),(t&1<<a)>0)e.mulTo(o,s,r);else{var u=r;r=o,o=u}return e.revert(r)},n.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var n,i=(1<<e)-1,r=!1,o="",s=this.t,a=this.DB-s*this.DB%e;if(s-- >0)for(a<this.DB&&(n=this[s]>>a)>0&&(r=!0,o=u(n));s>=0;)a<e?(n=(this[s]&(1<<a)-1)<<e-a,n|=this[--s]>>(a+=this.DB-e)):(n=this[s]>>(a-=e)&i,a<=0&&(a+=this.DB,--s)),n>0&&(r=!0),r&&(o+=u(n));return r?o:"0"},n.prototype.negate=function(){var t=i();return n.ZERO.subTo(this,t),t},n.prototype.abs=function(){return this.s<0?this.negate():this},n.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var n=this.t;if(0!=(e=n-t.t))return this.s<0?-e:e;for(;--n>=0;)if(0!=(e=this[n]-t[n]))return e;return 0},n.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+p(this[this.t-1]^this.s&this.DM)},n.prototype.mod=function(t){var e=i();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(n.ZERO)>0&&t.subTo(e,e),e},n.prototype.modPowInt=function(t,e){var n;return n=t<256||e.isEven()?new l(e):new f(e),this.exp(t,n)},n.ZERO=h(0),n.ONE=h(1),b.prototype.convert=_,b.prototype.revert=_,b.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n)},b.prototype.sqrTo=function(t,e){t.squareTo(e)},T.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=i();return t.copyTo(e),this.reduce(e),e},T.prototype.revert=function(t){return t},T.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},T.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},T.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var k,O,I,E=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],S=(1<<26)/E[E.length-1];function C(){var t;t=(new Date).getTime(),O[I++]^=255&t,O[I++]^=t>>8&255,O[I++]^=t>>16&255,O[I++]^=t>>24&255,I>=P&&(I-=P)}if(n.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},n.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),n=Math.pow(t,e),r=h(n),o=i(),s=i(),a="";for(this.divRemTo(r,o,s);o.signum()>0;)a=(n+s.intValue()).toString(t).substr(1)+a,o.divRemTo(r,o,s);return s.intValue().toString(t)+a},n.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var i=this.chunkSize(e),r=Math.pow(e,i),o=!1,s=0,a=0,u=0;u<t.length;++u){var h=c(t,u);h<0?"-"==t.charAt(u)&&0==this.signum()&&(o=!0):(a=e*a+h,++s>=i&&(this.dMultiply(r),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),o&&n.ZERO.subTo(this,this)},n.prototype.fromNumber=function(t,e,i){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(n.ONE.shiftLeft(t-1),g,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(n.ONE.shiftLeft(t-1),this);else{var r=new Array,o=7&t;r.length=1+(t>>3),e.nextBytes(r),o>0?r[0]&=(1<<o)-1:r[0]=0,this.fromString(r,256)}},n.prototype.bitwiseTo=function(t,e,n){var i,r,o=Math.min(t.t,this.t);for(i=0;i<o;++i)n[i]=e(this[i],t[i]);if(t.t<this.t){for(r=t.s&this.DM,i=o;i<this.t;++i)n[i]=e(this[i],r);n.t=this.t}else{for(r=this.s&this.DM,i=o;i<t.t;++i)n[i]=e(r,t[i]);n.t=t.t}n.s=e(this.s,t.s),n.clamp()},n.prototype.changeBit=function(t,e){var i=n.ONE.shiftLeft(t);return this.bitwiseTo(i,e,i),i},n.prototype.addTo=function(t,e){for(var n=0,i=0,r=Math.min(t.t,this.t);n<r;)i+=this[n]+t[n],e[n++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i+=t.s;n<this.t;)i+=this[n],e[n++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;n<t.t;)i+=t[n],e[n++]=i&this.DM,i>>=this.DB;i+=t.s}e.s=i<0?-1:0,i>0?e[n++]=i:i<-1&&(e[n++]=this.DV+i),e.t=n,e.clamp()},n.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},n.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},n.prototype.multiplyLowerTo=function(t,e,n){var i,r=Math.min(this.t+t.t,e);for(n.s=0,n.t=r;r>0;)n[--r]=0;for(i=n.t-this.t;r<i;++r)n[r+this.t]=this.am(0,t[r],n,r,0,this.t);for(i=Math.min(t.t,e);r<i;++r)this.am(0,t[r],n,r,0,e-r);n.clamp()},n.prototype.multiplyUpperTo=function(t,e,n){--e;var i=n.t=this.t+t.t-e;for(n.s=0;--i>=0;)n[i]=0;for(i=Math.max(e-this.t,0);i<t.t;++i)n[this.t+i-e]=this.am(e-i,t[i],n,0,0,this.t+i-e);n.clamp(),n.drShiftTo(1,n)},n.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,n=this.s<0?t-1:0;if(this.t>0)if(0==e)n=this[0]%t;else for(var i=this.t-1;i>=0;--i)n=(e*n+this[i])%t;return n},n.prototype.millerRabin=function(t){var e=this.subtract(n.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var o=e.shiftRight(r);(t=t+1>>1)>E.length&&(t=E.length);for(var s=i(),a=0;a<t;++a){s.fromInt(E[Math.floor(Math.random()*E.length)]);var u=s.modPow(o,this);if(0!=u.compareTo(n.ONE)&&0!=u.compareTo(e)){for(var c=1;c++<r&&0!=u.compareTo(e);)if(0==(u=u.modPowInt(2,this)).compareTo(n.ONE))return!1;if(0!=u.compareTo(e))return!1}}return!0},n.prototype.clone=function(){var t=i();return this.copyTo(t),t},n.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},n.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},n.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},n.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},n.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var n,i=this.DB-t*this.DB%8,r=0;if(t-- >0)for(i<this.DB&&(n=this[t]>>i)!=(this.s&this.DM)>>i&&(e[r++]=n|this.s<<this.DB-i);t>=0;)i<8?(n=(this[t]&(1<<i)-1)<<8-i,n|=this[--t]>>(i+=this.DB-8)):(n=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),0!=(128&n)&&(n|=-256),0==r&&(128&this.s)!=(128&n)&&++r,(r>0||n!=this.s)&&(e[r++]=n);return e},n.prototype.equals=function(t){return 0==this.compareTo(t)},n.prototype.min=function(t){return this.compareTo(t)<0?this:t},n.prototype.max=function(t){return this.compareTo(t)>0?this:t},n.prototype.and=function(t){var e=i();return this.bitwiseTo(t,d,e),e},n.prototype.or=function(t){var e=i();return this.bitwiseTo(t,g,e),e},n.prototype.xor=function(t){var e=i();return this.bitwiseTo(t,y,e),e},n.prototype.andNot=function(t){var e=i();return this.bitwiseTo(t,m,e),e},n.prototype.not=function(){for(var t=i(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},n.prototype.shiftLeft=function(t){var e=i();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},n.prototype.shiftRight=function(t){var e=i();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},n.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+v(this[t]);return this.s<0?this.t*this.DB:-1},n.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,n=0;n<this.t;++n)t+=w(this[n]^e);return t},n.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)},n.prototype.setBit=function(t){return this.changeBit(t,g)},n.prototype.clearBit=function(t){return this.changeBit(t,m)},n.prototype.flipBit=function(t){return this.changeBit(t,y)},n.prototype.add=function(t){var e=i();return this.addTo(t,e),e},n.prototype.subtract=function(t){var e=i();return this.subTo(t,e),e},n.prototype.multiply=function(t){var e=i();return this.multiplyTo(t,e),e},n.prototype.divide=function(t){var e=i();return this.divRemTo(t,e,null),e},n.prototype.remainder=function(t){var e=i();return this.divRemTo(t,null,e),e},n.prototype.divideAndRemainder=function(t){var e=i(),n=i();return this.divRemTo(t,e,n),new Array(e,n)},n.prototype.modPow=function(t,e){var n,r,o=t.bitLength(),s=h(1);if(o<=0)return s;n=o<18?1:o<48?3:o<144?4:o<768?5:6,r=o<8?new l(e):e.isEven()?new T(e):new f(e);var a=new Array,u=3,c=n-1,d=(1<<n)-1;if(a[1]=r.convert(this),n>1){var g=i();for(r.sqrTo(a[1],g);u<=d;)a[u]=i(),r.mulTo(g,a[u-2],a[u]),u+=2}var y,m,v=t.t-1,w=!0,b=i();for(o=p(t[v])-1;v>=0;){for(o>=c?y=t[v]>>o-c&d:(y=(t[v]&(1<<o+1)-1)<<c-o,v>0&&(y|=t[v-1]>>this.DB+o-c)),u=n;0==(1&y);)y>>=1,--u;if((o-=u)<0&&(o+=this.DB,--v),w)a[y].copyTo(s),w=!1;else{for(;u>1;)r.sqrTo(s,b),r.sqrTo(b,s),u-=2;u>0?r.sqrTo(s,b):(m=s,s=b,b=m),r.mulTo(b,a[y],s)}for(;v>=0&&0==(t[v]&1<<o);)r.sqrTo(s,b),m=s,s=b,b=m,--o<0&&(o=this.DB-1,--v)}return r.revert(s)},n.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return n.ZERO;for(var i=t.clone(),r=this.clone(),o=h(1),s=h(0),a=h(0),u=h(1);0!=i.signum();){for(;i.isEven();)i.rShiftTo(1,i),e?(o.isEven()&&s.isEven()||(o.addTo(this,o),s.subTo(t,s)),o.rShiftTo(1,o)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;r.isEven();)r.rShiftTo(1,r),e?(a.isEven()&&u.isEven()||(a.addTo(this,a),u.subTo(t,u)),a.rShiftTo(1,a)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);i.compareTo(r)>=0?(i.subTo(r,i),e&&o.subTo(a,o),s.subTo(u,s)):(r.subTo(i,r),e&&a.subTo(o,a),u.subTo(s,u))}return 0!=r.compareTo(n.ONE)?n.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u},n.prototype.pow=function(t){return this.exp(t,new b)},n.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(e.compareTo(n)<0){var i=e;e=n,n=i}var r=e.getLowestSetBit(),o=n.getLowestSetBit();if(o<0)return e;for(r<o&&(o=r),o>0&&(e.rShiftTo(o,e),n.rShiftTo(o,n));e.signum()>0;)(r=e.getLowestSetBit())>0&&e.rShiftTo(r,e),(r=n.getLowestSetBit())>0&&n.rShiftTo(r,n),e.compareTo(n)>=0?(e.subTo(n,e),e.rShiftTo(1,e)):(n.subTo(e,n),n.rShiftTo(1,n));return o>0&&n.lShiftTo(o,n),n},n.prototype.isProbablePrime=function(t){var e,n=this.abs();if(1==n.t&&n[0]<=E[E.length-1]){for(e=0;e<E.length;++e)if(n[0]==E[e])return!0;return!1}if(n.isEven())return!1;for(e=1;e<E.length;){for(var i=E[e],r=e+1;r<E.length&&i<S;)i*=E[r++];for(i=n.modInt(i);e<r;)if(i%E[e++]==0)return!1}return n.millerRabin(t)},n.prototype.square=function(){var t=i();return this.squareTo(t),t},n.prototype.Barrett=T,null==O){var A;if(O=new Array,I=0,"undefined"!=typeof window&&window.crypto)if(window.crypto.getRandomValues){var U=new Uint8Array(32);for(window.crypto.getRandomValues(U),A=0;A<32;++A)O[I++]=U[A]}else if("Netscape"==navigator.appName&&navigator.appVersion<"5"){var R=window.crypto.random(32);for(A=0;A<R.length;++A)O[I++]=255&R.charCodeAt(A)}for(;I<P;)A=Math.floor(65536*Math.random()),O[I++]=A>>>8,O[I++]=255&A;I=0,C()}function x(){if(null==k){for(C(),(k=new B).init(O),I=0;I<O.length;++I)O[I]=0;I=0}return k.next()}function D(){}function B(){this.i=0,this.j=0,this.S=new Array}D.prototype.nextBytes=function(t){var e;for(e=0;e<t.length;++e)t[e]=x()},B.prototype.init=function(t){var e,n,i;for(e=0;e<256;++e)this.S[e]=e;for(n=0,e=0;e<256;++e)n=n+this.S[e]+t[e%t.length]&255,i=this.S[e],this.S[e]=this.S[n],this.S[n]=i;this.i=0,this.j=0},B.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var P=256;n.SecureRandom=D,n.BigInteger=n,t.exports=n}).call(qe)})).BigInteger,oi={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},si={sha256:ei};function ai(t,e){if(this.n=null,this.e=0,!(null!=t&&null!=e&&t.length>0&&e.length>0))throw new Error("Invalid key data");this.n=new ri(t,16),this.e=parseInt(e,16)}ai.prototype.verify=function(t,e){e=e.replace(/[^0-9a-f]|[\s\n]]/gi,"");var n=new ri(e,16);if(n.bitLength()>this.n.bitLength())throw new Error("Signature does not match with the key modulus.");var i=function(t){for(var e in oi){var n=oi[e],i=n.length;if(t.substring(0,i)===n)return{alg:e,hash:t.substring(i)}}return[]}(n.modPowInt(this.e,this.n).toString(16).replace(/^1f+00/,""));if(0===i.length)return!1;if(!si.hasOwnProperty(i.alg))throw new Error("Hashing algorithm is not supported.");var r=si[i.alg](t).toString();return i.hash===r};var ui=ai;function ci(t){var e=t.length%4;return 0===e?t:t+new Array(4-e+1).join("=")}function hi(t){for(var e="",n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e}function pi(t){for(var e="",n=0;n<t.length;n++){var i=t[n].toString(16);e+=2===i.length?i:"0"+i}return e}var li=function(t){return t=ci(t).replace(/\-/g,"+").replace(/_/g,"/"),decodeURIComponent(hi(vn(t)).split("").map((function(t){return"%"+("00"+t.charCodeAt(0).toString(16)).slice(-2)})).join(""))},fi=function(t){return pi(vn(ci(t)))},di=function(t){var e={"+":"-","/":"_","=":""};return t.replace(/[+\/=]/g,(function(t){return e[t]}))},gi=Me((function(t){var e,n;e=qe,n=function(){return function(){var t=arguments;"object"==y(arguments[0])&&(t=arguments[0]);var e=[].slice.call(t,0).join("/");return e.replace(/:\//g,"://").replace(/([^:\s])\/+/g,"$1/").replace(/\/(\?|&|#[^!])/g,"$1").replace(/(\?.+)\?/g,"$1&")}},t.exports?t.exports=n():e.urljoin=n()}));function yi(t){return{modulus:fi(t.n),exp:fi(t.e)}}var mi=function(t,e){var n=t.jwksURI||gi(t.iss,".well-known","jwks.json");return cn.get(n).end((function(n,i){var r,o,s=null;if(n)return e(n);for(r=0;r<i.body.keys.length&&null===s;r++)(o=i.body.keys[r]).kid===t.kid&&(s=o);return e(null,yi(s))}))};function vi(t){this.name="ConfigurationError",this.message=t||""}function wi(t){this.name="TokenValidationError",this.message=t||""}vi.prototype=Error.prototype,wi.prototype=Error.prototype;var bi={ConfigurationError:vi,TokenValidationError:wi};function _i(){}_i.prototype.get=function(){return null},_i.prototype.has=function(){return!1},_i.prototype.set=function(){};var Ti=_i,ki=["RS256"];function Oi(t){var e=t||{};if(this.jwksCache=e.jwksCache||new Ti,this.expectedAlg=e.expectedAlg||"RS256",this.issuer=e.issuer,this.audience=e.audience,this.leeway=e.leeway||0,this.__disableExpirationCheck=e.__disableExpirationCheck||!1,this.jwksURI=e.jwksURI,this.leeway<0||this.leeway>60)throw new bi.ConfigurationError("The leeway should be positive and lower than a minute.");if(-1===ki.indexOf(this.expectedAlg))throw new bi.ConfigurationError("Algorithm "+this.expectedAlg+" is not supported. (Expected algs: ["+ki.join(",")+"])")}Oi.prototype.verify=function(t,e,n){var i=this.decode(t);if(i instanceof Error)return n(i,!1);var r=i.encoded.header+"."+i.encoded.payload,o=fi(i.encoded.signature),s=i.header.alg,a=i.header.kid,u=i.payload.aud,c=i.payload.iss,h=i.payload.exp,p=i.payload.nbf,l=i.payload.nonce||null;if(this.issuer!==c)return n(new bi.TokenValidationError("Issuer "+c+" is not valid."),!1);if(this.audience!==u)return n(new bi.TokenValidationError("Audience "+u+" is not valid."),!1);if(this.expectedAlg!==s)return n(new bi.TokenValidationError("Algorithm "+s+" is not supported. (Expected algs: ["+ki.join(",")+"])"),!1);if(l!==e)return n(new bi.TokenValidationError("Nonce does not match."),!1);var f=this.verifyExpAndNbf(h,p);return f?n(f,!1):this.getRsaVerifier(c,a,(function(t,e){return t?n(t):e.verify(r,o)?n(null,i.payload):n(new bi.TokenValidationError("Invalid signature."))}))},Oi.prototype.verifyExpAndNbf=function(t,e){var n=new Date,i=new Date(0),r=new Date(0);return this.__disableExpirationCheck?null:(i.setUTCSeconds(t+this.leeway),n>i?new bi.TokenValidationError("Expired token."):void 0===e?null:(r.setUTCSeconds(e-this.leeway),n<r?new bi.TokenValidationError("The token is not valid until later in the future. Please check your computed clock."):null))},Oi.prototype.verifyExpAndIat=function(t,e){var n=new Date,i=new Date(0),r=new Date(0);return this.__disableExpirationCheck?null:(i.setUTCSeconds(t+this.leeway),n>i?new bi.TokenValidationError("Expired token."):(r.setUTCSeconds(e-this.leeway),n<r?new bi.TokenValidationError("The token was issued in the future. Please check your computed clock."):null))},Oi.prototype.getRsaVerifier=function(t,e,n){var i=this,r=t+e;if(this.jwksCache.has(r)){var o=this.jwksCache.get(r);n(null,new ui(o.modulus,o.exp))}else mi({jwksURI:this.jwksURI,iss:t,kid:e},(function(t,e){return t?n(t):(i.jwksCache.set(r,e),n(null,new ui(e.modulus,e.exp)))}))},Oi.prototype.decode=function(t){var e,n,i=t.split(".");if(3!==i.length)return new bi.TokenValidationError("Cannot decode a malformed JWT");try{e=JSON.parse(li(i[0])),n=JSON.parse(li(i[1]))}catch(t){return new bi.TokenValidationError("Token header or payload is not valid JSON")}return{header:e,payload:n,encoded:{header:i[0],payload:i[1],signature:i[2]}}},Oi.prototype.validateAccessToken=function(t,e,n,i){if(this.expectedAlg!==e)return i(new bi.TokenValidationError("Algorithm "+e+" is not supported. (Expected alg: "+this.expectedAlg+")"));var r=ei(t),o=ii.stringify(r),s=o.substring(0,o.length/2),a=ii.parse(s),u=ni.stringify(a);return i(di(u)!==n?new bi.TokenValidationError("Invalid access_token"):null)};var Ii=Oi;function Ei(t,e){this.plugins=e;for(var n=0;n<this.plugins.length;n++){if(this.plugins[n].version!==_n.raw){var i="";throw this.plugins[n].constructor&&this.plugins[n].constructor.name&&(i=this.plugins[n].constructor.name),new Error("Plugin "+i+" version ("+this.plugins[n].version+") is not compatible with the SDK version ("+_n.raw+")")}this.plugins[n].setWebAuth(t)}}Ei.prototype.get=function(t){for(var e=0;e<this.plugins.length;e++)if(this.plugins[e].supports(t))return this.plugins[e].init();return null};var Si=function(t){var e=new Uint8Array(t),n=[],i="0123456789ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvwxyz-._~",r=Mn.getWindow().crypto||Mn.getWindow().msCrypto;if(!r)return null;for(var o=r.getRandomValues(e),s=0;s<o.length;s++)n.push(i[o[s]%i.length]);return n.join("")};function Ci(t){var e=t.transaction||{};this.namespace=e.namespace||"com.auth0.auth.",this.keyLength=e.keyLength||32,this.storage=new Fn(t),this.options=t}function Ai(t){if(this.url=t.url,this.callback=t.callback,this.timeout=t.timeout||6e4,this.timeoutCallback=t.timeoutCallback||null,this.eventListenerType=t.eventListenerType||"message",this.iframe=null,this.timeoutHandle=null,this._destroyTimeout=null,this.transientMessageEventListener=null,this.proxyEventListener=null,this.eventValidator=t.eventValidator||{isValid:function(){return!0}},"function"!=typeof this.callback)throw new Error("options.callback must be a function")}function Ui(t){this.webAuth=t,this.warn=new Wn(t.baseOptions)}function Ri(t,e){this.webAuth=t,this.baseOptions=e,this.request=new Ln(e),this.webMessageHandler=new Ui(t),this.storage=new Fn(e)}function xi(t,e){return["co/verifier",encodeURIComponent(t),encodeURIComponent(e)].join("/")}function Di(t,e){this.webAuth=t,this.baseOptions=e,this.crossOriginAuthentication=new Ri(t,this.baseOptions),this.warn=new Wn({disableWarnings:!!e._disableDeprecationWarnings})}Ci.prototype.process=function(t){if(!t.responseType)throw new Error("responseType is required");var e=t.realm||t.connection,n=-1!==t.responseType.indexOf("id_token"),i=this.generateTransaction(t.appState,t.state,t.nonce,e,n);return t.state||(t.state=i.state),n&&!t.nonce&&(t.nonce=i.nonce),t},Ci.prototype.generateTransaction=function(t,e,n,i,r){return e=e||Si(this.keyLength),n=n||(r?Si(this.keyLength):null),Mn.getWindow().location.host===this.options.domain||this.storage.setItem(this.namespace+e,{nonce:n,appState:t,state:e,lastUsedConnection:i},{expires:1/48}),{state:e,nonce:n}},Ci.prototype.getStoredTransaction=function(t){var e;return e=this.storage.getItem(this.namespace+t),this.clearTransaction(t),e},Ci.prototype.clearTransaction=function(t){this.storage.removeItem(this.namespace+t)},Ai.prototype.init=function(){var t=this,e=Mn.getWindow();switch(this.iframe=e.document.createElement("iframe"),this.iframe.style.display="none",this.proxyEventListener=function(e){t.eventListener(e)},this.eventListenerType){case"message":this.eventSourceObject=e;break;case"load":this.eventSourceObject=this.iframe;break;default:throw new Error("Unsupported event listener type: "+this.eventListenerType)}this.eventSourceObject.addEventListener(this.eventListenerType,this.proxyEventListener,!1),e.document.body.appendChild(this.iframe),this.iframe.src=this.url,this.timeoutHandle=setTimeout((function(){t.timeoutHandler()}),this.timeout)},Ai.prototype.eventListener=function(t){var e={event:t,sourceObject:this.eventSourceObject};this.eventValidator.isValid(e)&&(this.destroy(),this.callback(e))},Ai.prototype.timeoutHandler=function(){this.destroy(),this.timeoutCallback&&this.timeoutCallback()},Ai.prototype.destroy=function(){var t=this;clearTimeout(this.timeoutHandle),this._destroyTimeout=setTimeout((function(){t.eventSourceObject.removeEventListener(t.eventListenerType,t.proxyEventListener,!1),t.iframe.parentNode&&t.iframe.parentNode.removeChild(t.iframe)}),0)},Ui.prototype.run=function(t,e){var n=this;t.responseMode="web_message",t.prompt="none";var i=Mn.getOrigin(),r=Bn.getOriginFromUrl(t.redirectUri);if(r&&i!==r)return e({error:"origin_mismatch",error_description:"The redirectUri's origin ("+r+") should match the window's origin ("+i+")."});!function(t,e,n){new Ai({url:t,eventListenerType:"message",callback:function(t){n(null,t)},timeout:e.timeout,eventValidator:{isValid:function(t){return"authorization_response"===t.event.data.type&&e.state===t.event.data.response.state}},timeoutCallback:function(){n({error:"timeout",error_description:"Timeout during executing web_message communication",state:e.state})}}).init()}(this.webAuth.client.buildAuthorizeUrl(t),t,(function(i,r){var o=i;if(!i&&r.event.data.response.error&&(o=r.event.data.response),!o){var s=r.event.data.response;return n.webAuth.validateAuthenticationResponse(t,s,e)}return"consent_required"===o.error&&"localhost"===Mn.getWindow().location.hostname&&n.warn.warning("Consent Required. Consent can't be skipped on localhost. Read more here: https://auth0.com/docs/api-auth/user-consent#skipping-consent-for-first-party-clients"),n.webAuth.transactionManager.clearTransaction(o.state),e(Bn.pick(o,["error","error_description"]))}))},Ri.prototype.login=function(t,e){var n=this,i=Ne(this.baseOptions.rootUrl,"/co/authenticate");t.username=t.username||t.email,delete t.email;var r={client_id:t.clientID||this.baseOptions.clientID,username:t.username};t.password&&(r.password=t.password),t.otp&&(r.otp=t.otp);var o=t.realm||this.baseOptions.realm;if(o){var s=t.credentialType||this.baseOptions.credentialType||"http://auth0.com/oauth/grant-type/password-realm";r.realm=o,r.credential_type=s}else r.credential_type="password";this.request.post(i).withCredentials().send(r).end((function(i,r){if(i){var o=i.response&&i.response.body||{error:"request_error",error_description:JSON.stringify(i)};return Xn(e,{forceLegacyError:!0})(o)}var s=!0===t.popup;t=Bn.blacklist(t,["password","credentialType","otp","popup"]);var a=Bn.merge(t).with({loginTicket:r.body.login_ticket}),u=xi(n.baseOptions.rootUrl,r.body.co_id);n.storage.setItem(u,r.body.co_verifier,{expires:1/96}),s?n.webMessageHandler.run(a,Xn(e,{forceLegacyError:!0})):n.webAuth.authorize(a)}))},Ri.prototype.callback=function(){var t=decodeURIComponent(function(t){var e=("&"+Mn.getWindow().location.hash.substring(1)).split("&origin=");if(2===e.length)return e.pop().split("&").shift()}()),e=Mn.getWindow(),n=this;e.addEventListener("message",(function(t){if("co_verifier_request"===t.data.type){var e=xi(t.origin,t.data.request.id),i=function(t,e){try{var n=t.getItem(e);return t.removeItem(e),n||""}catch(t){return""}}(n.storage,e);t.source.postMessage({type:"co_verifier_response",response:{verifier:i}},t.origin)}})),e.parent.postMessage({type:"ready"},t)},Di.prototype.loginWithCredentials=function(t,e){t.realm=t.realm||t.connection,delete t.connection,this.crossOriginAuthentication.login(t,e)},Di.prototype.signupAndLogin=function(t,e){var n=this;return this.webAuth.client.dbConnection.signup(t,(function(i){return i?e(i):(t.realm=t.realm||t.connection,delete t.connection,n.webAuth.login(t,e))}))};var Bi=Me((function(t){var e=function(){function t(t,e,n){t.attachEvent?t.attachEvent("on"+e,n):t.addEventListener&&t.addEventListener(e,n,!1)}function e(t,e,n){t.detachEvent?t.detachEvent("on"+e,n):t.removeEventListener&&t.removeEventListener(e,n,!1)}function n(t){/^https?:\/\//.test(t)||(t=window.location.href);var e=/^(https?:\/\/[\-_a-zA-Z\.0-9:]+)/.exec(t);return e?e[1]:t}var i=function(){if("undefined"==typeof navigator)return!1;var t=-1,e=navigator.userAgent;return"Microsoft Internet Explorer"===navigator.appName?null!=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})").exec(e)&&(t=parseFloat(RegExp.$1)):e.indexOf("Trident")>-1&&null!==new RegExp("rv:([0-9]{2,2}[.0-9]{0,})").exec(e)&&(t=parseFloat(RegExp.$1)),t>=8}();return"undefined"!=typeof window&&window.JSON&&window.JSON.stringify&&window.JSON.parse&&window.postMessage?{open:function(r,o){if(!o)throw"missing required callback argument";var s,a;r.url||(s="missing required 'url' parameter"),r.relay_url||(s="missing required 'relay_url' parameter"),s&&setTimeout((function(){o(s)}),0),r.window_name||(r.window_name=null),r.window_features&&!function(){try{var t=navigator.userAgent;return-1!=t.indexOf("Fennec/")||-1!=t.indexOf("Firefox/")&&-1!=t.indexOf("Android")}catch(t){}return!1}()||(r.window_features=void 0);var u,c=r.origin||n(r.url);if(c!==n(r.relay_url))return setTimeout((function(){o("invalid arguments: origin of url and relay_url must match")}),0);i&&((a=document.createElement("iframe")).setAttribute("src",r.relay_url),a.style.display="none",a.setAttribute("name","__winchan_relay_frame"),document.body.appendChild(a),u=a.contentWindow);var h=r.popup||window.open(r.url,r.window_name,r.window_features);r.popup&&(h.location.href=r.url),u||(u=h);var p=setInterval((function(){h&&h.closed&&(f(),o&&(o("User closed the popup window"),o=null))}),500),l=JSON.stringify({a:"request",d:r.params});function f(){if(a&&document.body.removeChild(a),a=void 0,p&&(p=clearInterval(p)),e(window,"message",d),e(window,"unload",f),h)try{h.close()}catch(t){u.postMessage("die",c)}h=u=void 0}function d(t){if(t.origin===c){try{var e=JSON.parse(t.data)}catch(t){if(o)return o(t);throw t}"ready"===e.a?u.postMessage(l,c):"error"===e.a?(f(),o&&(o(e.d),o=null)):"response"===e.a&&(f(),o&&(o(null,e.d),o=null))}}return t(window,"unload",f),t(window,"message",d),{close:f,focus:function(){if(h)try{h.focus()}catch(t){}}}},onOpen:function(n){var r="*",o=i?function(){for(var t=window.opener.frames,e=t.length-1;e>=0;e--)try{if(t[e].location.protocol===window.location.protocol&&t[e].location.host===window.location.host&&"__winchan_relay_frame"===t[e].name)return t[e]}catch(t){}}():window.opener;if(!o)throw"can't find relay frame";function s(t){t=JSON.stringify(t),i?o.doPost(t,r):o.postMessage(t,r)}function a(t){if("die"===t.data)try{window.close()}catch(t){}}t(i?o:window,"message",(function t(i){var o;try{o=JSON.parse(i.data)}catch(t){}o&&"request"===o.a&&(e(window,"message",t),r=i.origin,n&&setTimeout((function(){n(r,o.d,(function(t){n=void 0,s({a:"response",d:t})}))}),0))})),t(i?o:window,"message",a);try{s({a:"ready"})}catch(e){t(o,"load",(function(t){s({a:"ready"})}))}var u=function(){try{e(i?o:window,"message",a)}catch(t){}n&&s({a:"error",d:"client closed window"}),n=void 0;try{window.close()}catch(t){}};return t(window,"unload",u),{detach:function(){e(window,"unload",u)}}}}:{open:function(t,e,n,i){setTimeout((function(){i("unsupported browser")}),0)},onOpen:function(t){setTimeout((function(){t("unsupported browser")}),0)}}}();t.exports&&(t.exports=e)})),Pi=function(t){/^https?:\/\//.test(t)||(t=window.location.href);var e=/^(https?:\/\/[-_a-zA-Z.0-9:]+)/.exec(t);return e?e[1]:t};function ji(){this._current_popup=null}function Li(t,e){this.baseOptions=e,this.baseOptions.popupOrigin=e.popupOrigin,this.client=t.client,this.webAuth=t,this.transactionManager=new Ci(this.baseOptions),this.crossOriginAuthentication=new Ri(t,this.baseOptions),this.warn=new Wn({disableWarnings:!!e._disableDeprecationWarnings})}function qi(t){this.authenticationUrl=t.authenticationUrl,this.timeout=t.timeout||6e4,this.handler=null,this.postMessageDataType=t.postMessageDataType||!1,this.postMessageOrigin=t.postMessageOrigin||Mn.getWindow().location.origin||Mn.getWindow().location.protocol+"//"+Mn.getWindow().location.hostname+(Mn.getWindow().location.port?":"+Mn.getWindow().location.port:"")}function Mi(t){this.baseOptions=t,this.request=new Ln(t),this.transactionManager=new Ci(this.baseOptions)}function Ni(t,e){this.baseOptions=e,this.client=t,this.baseOptions.universalLoginPage=!0,this.request=new Ln(this.baseOptions),this.warn=new Wn({disableWarnings:!!e._disableDeprecationWarnings})}function Hi(t){En.check(t,{type:"object",message:"options parameter is not valid"},{domain:{type:"string",message:"domain option is required"},clientID:{type:"string",message:"clientID option is required"},responseType:{optional:!0,type:"string",message:"responseType is not valid"},responseMode:{optional:!0,type:"string",message:"responseMode is not valid"},redirectUri:{optional:!0,type:"string",message:"redirectUri is not valid"},scope:{optional:!0,type:"string",message:"scope is not valid"},audience:{optional:!0,type:"string",message:"audience is not valid"},popupOrigin:{optional:!0,type:"string",message:"popupOrigin is not valid"},leeway:{optional:!0,type:"number",message:"leeway is not valid"},plugins:{optional:!0,type:"array",message:"plugins is not valid"},_disableDeprecationWarnings:{optional:!0,type:"boolean",message:"_disableDeprecationWarnings option is not valid"},_sendTelemetry:{optional:!0,type:"boolean",message:"_sendTelemetry option is not valid"},_telemetryInfo:{optional:!0,type:"object",message:"_telemetryInfo option is not valid"},_timesToRetryFailedRequests:{optional:!0,type:"number",message:"_timesToRetryFailedRequests option is not valid"}}),t.overrides&&En.check(t.overrides,{type:"object",message:"overrides option is not valid"},{__tenant:{optional:!0,type:"string",message:"__tenant option is required"},__token_issuer:{optional:!0,type:"string",message:"__token_issuer option is required"},__jwks_uri:{optional:!0,type:"string",message:"__jwks_uri is required"}}),this.baseOptions=t,this.baseOptions.plugins=new Ei(this,this.baseOptions.plugins||[]),this.baseOptions._sendTelemetry=!1!==this.baseOptions._sendTelemetry||this.baseOptions._sendTelemetry,this.baseOptions._timesToRetryFailedRequests=t._timesToRetryFailedRequests?parseInt(t._timesToRetryFailedRequests,0):0,this.baseOptions.tenant=this.baseOptions.overrides&&this.baseOptions.overrides.__tenant||this.baseOptions.domain.split(".")[0],this.baseOptions.token_issuer=this.baseOptions.overrides&&this.baseOptions.overrides.__token_issuer||"https://"+this.baseOptions.domain+"/",this.baseOptions.jwksURI=this.baseOptions.overrides&&this.baseOptions.overrides.__jwks_uri,this.transactionManager=new Ci(this.baseOptions),this.client=new zi(this.baseOptions),this.redirect=new Di(this,this.baseOptions),this.popup=new Li(this,this.baseOptions),this.crossOriginAuthentication=new Ri(this,this.baseOptions),this.webMessageHandler=new Ui(this),this._universalLogin=new Ni(this,this.baseOptions),this.ssodataStorage=new Yn(this.baseOptions)}function Vi(t,e){this.baseOptions=e,this.request=t}function Wi(t,e){this.baseOptions=e,this.request=t}function zi(t,e){2===arguments.length?this.auth0=t:e=t,En.check(e,{type:"object",message:"options parameter is not valid"},{domain:{type:"string",message:"domain option is required"},clientID:{type:"string",message:"clientID option is required"},responseType:{optional:!0,type:"string",message:"responseType is not valid"},responseMode:{optional:!0,type:"string",message:"responseMode is not valid"},redirectUri:{optional:!0,type:"string",message:"redirectUri is not valid"},scope:{optional:!0,type:"string",message:"scope is not valid"},audience:{optional:!0,type:"string",message:"audience is not valid"},_disableDeprecationWarnings:{optional:!0,type:"boolean",message:"_disableDeprecationWarnings option is not valid"},_sendTelemetry:{optional:!0,type:"boolean",message:"_sendTelemetry option is not valid"},_telemetryInfo:{optional:!0,type:"object",message:"_telemetryInfo option is not valid"}}),this.baseOptions=e,this.baseOptions._sendTelemetry=!1!==this.baseOptions._sendTelemetry||this.baseOptions._sendTelemetry,this.baseOptions.rootUrl="https://"+this.baseOptions.domain,this.request=new Ln(this.baseOptions),this.passwordless=new Vi(this.request,this.baseOptions),this.dbConnection=new Wi(this.request,this.baseOptions),this.warn=new Wn({disableWarnings:!!e._disableDeprecationWarnings}),this.ssodataStorage=new Yn(this.baseOptions)}function Fi(t){En.check(t,{type:"object",message:"options parameter is not valid"},{domain:{type:"string",message:"domain option is required"},token:{type:"string",message:"token option is required"},_sendTelemetry:{optional:!0,type:"boolean",message:"_sendTelemetry option is not valid"},_telemetryInfo:{optional:!0,type:"object",message:"_telemetryInfo option is not valid"}}),this.baseOptions=t,this.baseOptions.headers={Authorization:"Bearer "+this.baseOptions.token},this.request=new Ln(this.baseOptions),this.baseOptions.rootUrl=Ne("https://"+this.baseOptions.domain,"api","v2")}ji.prototype.calculatePosition=function(t){var e=t.width||500,n=t.height||600,i=Mn.getWindow(),r=void 0!==i.screenX?i.screenX:i.screenLeft,o=void 0!==i.screenY?i.screenY:i.screenTop,s=void 0!==i.outerWidth?i.outerWidth:i.document.body.clientWidth,a=void 0!==i.outerHeight?i.outerHeight:i.document.body.clientHeight;return{width:e,height:n,left:t.left||r+(s-e)/2,top:t.top||o+(a-n)/2}},ji.prototype.preload=function(t){var e=this,n=Mn.getWindow(),i=this.calculatePosition(t.popupOptions||{}),r=Bn.merge(i).with(t.popupOptions),o=t.url||"about:blank",s=Ge(r,{encode:!1,delimiter:","});return this._current_popup&&!this._current_popup.closed||(this._current_popup=n.open(o,"auth0_signup_popup",s),this._current_popup.kill=function(){this.close(),e._current_popup=null}),this._current_popup},ji.prototype.load=function(t,e,n,i){var r=this,o=this.calculatePosition(n.popupOptions||{}),s=Bn.merge(o).with(n.popupOptions),a=Bn.merge({url:t,relay_url:e,window_features:Ge(s,{delimiter:",",encode:!1}),popup:this._current_popup}).with(n),u=Bi.open(a,(function(t,e){return r._current_popup=null,i(t,e)}));return u.focus(),u},Li.prototype.buildPopupHandler=function(){var t=this.baseOptions.plugins.get("popup.getPopupHandler");return t?t.getPopupHandler():new ji},Li.prototype.preload=function(t){t=t||{};var e=this.buildPopupHandler();return e.preload(t),e},Li.prototype.getPopupHandler=function(t,e){return t.popupHandler?t.popupHandler:e?this.preload(t):this.buildPopupHandler()},Li.prototype.callback=function(t){var e=this,n=Mn.getWindow(),i=(t=t||{}).popupOrigin||this.baseOptions.popupOrigin||Mn.getOrigin();n.opener?Bi.onOpen((function(n,r,o){if(n!==i)return o({error:"origin_mismatch",error_description:"The popup's origin ("+n+") should match the `popupOrigin` parameter ("+i+")."});e.webAuth.parseHash(t||{},(function(t,e){return o(t||e)}))})):n.doPost=function(t){n.parent&&n.parent.postMessage(t,i)}},Li.prototype.authorize=function(t,e){var n,i,r={},o=this.baseOptions.plugins.get("popup.authorize"),s=Bn.merge(this.baseOptions,["clientID","scope","domain","audience","tenant","responseType","redirectUri","_csrf","state","_intstate","nonce"]).with(Bn.blacklist(t,["popupHandler"]));return En.check(s,{type:"object",message:"options parameter is not valid"},{responseType:{type:"string",message:"responseType option is required"}}),i=Ne(this.baseOptions.rootUrl,"relay.html"),t.owp?s.owp=!0:(r.origin=Pi(s.redirectUri),i=s.redirectUri),t.popupOptions&&(r.popupOptions=Bn.pick(t.popupOptions,["width","height","top","left"])),o&&(s=o.processParams(s)),(s=this.transactionManager.process(s)).scope=s.scope||"openid profile email",delete s.domain,n=this.client.buildAuthorizeUrl(s),this.getPopupHandler(t).load(n,i,r,Xn(e,{keepOriginalCasing:!0}))},Li.prototype.loginWithCredentials=function(t,e){t.realm=t.realm||t.connection,t.popup=!0,t=Bn.merge(this.baseOptions,["redirectUri","responseType","state","nonce"]).with(Bn.blacklist(t,["popupHandler","connection"])),t=this.transactionManager.process(t),this.crossOriginAuthentication.login(t,e)},Li.prototype.passwordlessVerify=function(t,e){var n=this;return this.client.passwordless.verify(Bn.blacklist(t,["popupHandler"]),(function(i){if(i)return e(i);t.username=t.phoneNumber||t.email,t.password=t.verificationCode,delete t.email,delete t.phoneNumber,delete t.verificationCode,delete t.type,n.client.loginWithResourceOwner(t,e)}))},Li.prototype.signupAndLogin=function(t,e){var n=this;return this.client.dbConnection.signup(t,(function(i){if(i)return e(i);n.loginWithCredentials(t,e)}))},qi.create=function(t){return new qi(t)},qi.prototype.login=function(t,e){this.handler=new Ai({auth0:this.auth0,url:this.authenticationUrl,eventListenerType:t?"message":"load",callback:this.getCallbackHandler(e,t),timeout:this.timeout,eventValidator:this.getEventValidator(),timeoutCallback:function(){e(null,"#error=timeout&error_description=Timeout+during+authentication+renew.")},usePostMessage:t||!1}),this.handler.init()},qi.prototype.getEventValidator=function(){var t=this;return{isValid:function(e){switch(e.event.type){case"message":return e.event.origin===t.postMessageOrigin&&e.event.source===t.handler.iframe.contentWindow&&(!1===t.postMessageDataType||e.event.data.type&&e.event.data.type===t.postMessageDataType);case"load":if("about:"===e.sourceObject.contentWindow.location.protocol)return!1;default:return!0}}}},qi.prototype.getCallbackHandler=function(t,e){return function(n){var i;i=e?"object"==y(n.event.data)&&n.event.data.hash?n.event.data.hash:n.event.data:n.sourceObject.contentWindow.location.hash,t(null,i)}},Mi.prototype.login=function(t,e){var n,i;return n=Ne(this.baseOptions.rootUrl,"usernamepassword","login"),t.username=t.username||t.email,t=Bn.blacklist(t,["email"]),i=Bn.merge(this.baseOptions,["clientID","redirectUri","tenant","responseType","responseMode","scope","audience"]).with(t),i=this.transactionManager.process(i),i=Bn.toSnakeCase(i,["auth0Client"]),this.request.post(n).send(i).end(Xn(e))},Mi.prototype.callback=function(t){var e,n=Mn.getDocument();(e=n.createElement("div")).innerHTML=t,n.body.appendChild(e).children[0].submit()},Ni.prototype.login=function(t,e){if(Mn.getWindow().location.host!==this.baseOptions.domain)throw new Error("This method is meant to be used only inside the Universal Login Page.");var n,i=Bn.merge(this.baseOptions,["clientID","redirectUri","tenant","responseType","responseMode","scope","audience","_csrf","state","_intstate","nonce"]).with(t);return En.check(i,{type:"object",message:"options parameter is not valid"},{responseType:{type:"string",message:"responseType option is required"}}),(n=new Mi(this.baseOptions)).login(i,(function(t,i){return t?e(t):n.callback(i)}))},Ni.prototype.signupAndLogin=function(t,e){var n=this;return n.client.client.dbConnection.signup(t,(function(i){return i?e(i):n.login(t,e)}))},Ni.prototype.getSSOData=function(t,e){var n,i="";return"function"==typeof t&&(e=t,t=!1),En.check(t,{type:"boolean",message:"withActiveDirectories parameter is not valid"}),En.check(e,{type:"function",message:"cb parameter is not valid"}),t&&(i="?"+Ge({ldaps:1,client_id:this.baseOptions.clientID})),n=Ne(this.baseOptions.rootUrl,"user","ssodata",i),this.request.get(n,{noHeaders:!0}).withCredentials().end(Xn(e))},Hi.prototype.parseHash=function(t,e){var n,i;e||"function"!=typeof t?t=t||{}:(e=t,t={});var r=Mn.getWindow(),o=void 0===t.hash?r.location.hash:t.hash;if((n=function(t,e){var n=e||{};if(null!==n.decoder&&void 0!==n.decoder&&"function"!=typeof n.decoder)throw new TypeError("Decoder has to be a function.");if(n.delimiter="string"==typeof n.delimiter||He.isRegExp(n.delimiter)?n.delimiter:$e.delimiter,n.depth="number"==typeof n.depth?n.depth:$e.depth,n.arrayLimit="number"==typeof n.arrayLimit?n.arrayLimit:$e.arrayLimit,n.parseArrays=!1!==n.parseArrays,n.decoder="function"==typeof n.decoder?n.decoder:$e.decoder,n.allowDots="boolean"==typeof n.allowDots?n.allowDots:$e.allowDots,n.plainObjects="boolean"==typeof n.plainObjects?n.plainObjects:$e.plainObjects,n.allowPrototypes="boolean"==typeof n.allowPrototypes?n.allowPrototypes:$e.allowPrototypes,n.parameterLimit="number"==typeof n.parameterLimit?n.parameterLimit:$e.parameterLimit,n.strictNullHandling="boolean"==typeof n.strictNullHandling?n.strictNullHandling:$e.strictNullHandling,""===t||null==t)return n.plainObjects?Object.create(null):{};for(var i="string"==typeof t?function(t,e){for(var n={},i=t.split(e.delimiter,e.parameterLimit===1/0?void 0:e.parameterLimit),r=0;r<i.length;++r){var o,s,a=i[r],u=-1===a.indexOf("]=")?a.indexOf("="):a.indexOf("]=")+1;-1===u?(o=e.decoder(a),s=e.strictNullHandling?null:""):(o=e.decoder(a.slice(0,u)),s=e.decoder(a.slice(u+1))),Xe.call(n,o)?n[o]=[].concat(n[o]).concat(s):n[o]=s}return n}(t,n):t,r=n.plainObjects?Object.create(null):{},o=Object.keys(i),s=0;s<o.length;++s){var a=o[s],u=Ze(a,i[a],n);r=He.merge(r,u,n)}return He.compact(r)}(o=o.replace(/^#?\/?/,""))).hasOwnProperty("error"))return i=Jn.buildResponse(n.error,n.error_description),n.state&&(i.state=n.state),e(i);if(!n.hasOwnProperty("access_token")&&!n.hasOwnProperty("id_token")&&!n.hasOwnProperty("refresh_token"))return e(null,null);var s=(this.baseOptions.responseType||t.responseType||"").split(" ");return s.length>0&&-1!==s.indexOf("token")&&!n.hasOwnProperty("access_token")?e(Jn.buildResponse("invalid_hash","response_type contains `token`, but the parsed hash does not contain an `access_token` property")):s.length>0&&-1!==s.indexOf("id_token")&&!n.hasOwnProperty("id_token")?e(Jn.buildResponse("invalid_hash","response_type contains `id_token`, but the parsed hash does not contain an `id_token` property")):this.validateAuthenticationResponse(t,n,e)},Hi.prototype.validateAuthenticationResponse=function(t,e,n){var i=this;t.__enableIdPInitiatedLogin=t.__enableIdPInitiatedLogin||t.__enableImpersonation;var r=e.state,o=this.transactionManager.getStoredTransaction(r),s=t.state||o&&o.state||null,a=s===r;if((r||s||!t.__enableIdPInitiatedLogin)&&!a)return n({error:"invalid_token",errorDescription:"`state` does not match."});var u=t.nonce||o&&o.nonce||null,c=t.state||o&&o.appState||null,h=function(t,r){return t?n(t):(o&&o.lastUsedConnection&&(r&&(s=r.sub),i.ssodataStorage.set(o.lastUsedConnection,s)),n(null,function(t,e,n){return{accessToken:t.access_token||null,idToken:t.id_token||null,idTokenPayload:n||null,appState:e||null,refreshToken:t.refresh_token||null,state:t.state||null,expiresIn:t.expires_in?parseInt(t.expires_in,10):null,tokenType:t.token_type||null,scope:t.scope||null}}(e,c,r)));var s};return e.id_token?this.validateToken(e.id_token,u,(function(t,n){return t?"invalid_token"!==t.error||"Nonce does not match."===t.errorDescription||"HS256"!==(new Ii).decode(e.id_token).header.alg?h(t):e.access_token?i.client.userInfo(e.access_token,(function(t,e){return t?h(t):h(null,e)})):h({error:"invalid_token",description:"The id_token cannot be validated because it was signed with the HS256 algorithm and public clients (like a browser) can’t store secrets. Please read the associated doc for possible ways to fix this. Read more: https://auth0.com/docs/errors/libraries/auth0-js/invalid-token#parsing-an-hs256-signed-id-token-without-an-access-token"}):e.access_token&&n.at_hash?(new Ii).validateAccessToken(e.access_token,"RS256",n.at_hash,(function(t){return t?h(Jn.invalidToken(t.message)):h(null,n)})):h(null,n)})):h(null,null)},Hi.prototype.validateToken=function(t,e,n){new Ii({issuer:this.baseOptions.token_issuer,jwksURI:this.baseOptions.jwksURI,audience:this.baseOptions.clientID,leeway:this.baseOptions.leeway||0,__disableExpirationCheck:this.baseOptions.__disableExpirationCheck}).verify(t,e,(function(t,e){if(t)return n(Jn.invalidToken(t.message));n(null,e)}))},Hi.prototype.renewAuth=function(t,e){var n=!!t.usePostMessage,i=t.postMessageDataType||!1,r=t.postMessageOrigin||Mn.getWindow().origin,o=t.timeout,s=this,a=Bn.merge(this.baseOptions,["clientID","redirectUri","responseType","scope","audience","_csrf","state","_intstate","nonce"]).with(t);a.responseType=a.responseType||"token",a.responseMode=a.responseMode||"fragment",a=this.transactionManager.process(a),En.check(a,{type:"object",message:"options parameter is not valid"}),En.check(e,{type:"function",message:"cb parameter is not valid"}),a.prompt="none",a=Bn.blacklist(a,["usePostMessage","tenant","postMessageDataType","postMessageOrigin"]),qi.create({authenticationUrl:this.client.buildAuthorizeUrl(a),postMessageDataType:i,postMessageOrigin:r,timeout:o}).login(n,(function(t,n){if("object"==y(n))return e(t,n);s.parseHash({hash:n},e)}))},Hi.prototype.checkSession=function(t,e){var n=Bn.merge(this.baseOptions,["clientID","responseType","redirectUri","scope","audience","_csrf","state","_intstate","nonce"]).with(t);return"code"===n.responseType?e({error:"error",error_description:"responseType can't be `code`"}):(t.nonce||(n=this.transactionManager.process(n)),n.redirectUri?(En.check(n,{type:"object",message:"options parameter is not valid"}),En.check(e,{type:"function",message:"cb parameter is not valid"}),n=Bn.blacklist(n,["usePostMessage","tenant","postMessageDataType"]),void this.webMessageHandler.run(n,Xn(e,{forceLegacyError:!0,ignoreCasing:!0}))):e({error:"error",error_description:"redirectUri can't be empty"}))},Hi.prototype.changePassword=function(t,e){return this.client.dbConnection.changePassword(t,e)},Hi.prototype.passwordlessStart=function(t,e){var n=Bn.merge(this.baseOptions,["responseType","responseMode","redirectUri","scope","audience","_csrf","state","_intstate","nonce"]).with(t.authParams);return t.authParams=this.transactionManager.process(n),this.client.passwordless.start(t,e)},Hi.prototype.signup=function(t,e){return this.client.dbConnection.signup(t,e)},Hi.prototype.authorize=function(t){var e=Bn.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience","_csrf","state","_intstate","nonce"]).with(t);En.check(e,{type:"object",message:"options parameter is not valid"},{responseType:{type:"string",message:"responseType option is required"}}),(e=this.transactionManager.process(e)).scope=e.scope||"openid profile email",Mn.redirect(this.client.buildAuthorizeUrl(e))},Hi.prototype.signupAndAuthorize=function(t,e){var n=this;return this.client.dbConnection.signup(Bn.blacklist(t,["popupHandler"]),(function(i){if(i)return e(i);t.realm=t.connection,t.username||(t.username=t.email),n.client.login(t,e)}))},Hi.prototype.login=function(t,e){var n=Bn.merge(this.baseOptions,["clientID","responseType","redirectUri","scope","audience","_csrf","state","_intstate","nonce"]).with(t);n=this.transactionManager.process(n),Mn.getWindow().location.host===this.baseOptions.domain?(n.connection=n.realm,delete n.realm,this._universalLogin.login(n,e)):this.crossOriginAuthentication.login(n,e)},Hi.prototype.passwordlessLogin=function(t,e){var n=Bn.merge(this.baseOptions,["clientID","responseType","redirectUri","scope","audience","_csrf","state","_intstate","nonce"]).with(t);if(n=this.transactionManager.process(n),Mn.getWindow().location.host===this.baseOptions.domain)this.passwordlessVerify(n,e);else{var i=Bn.extend({credentialType:"http://auth0.com/oauth/grant-type/passwordless/otp",realm:n.connection,username:n.email||n.phoneNumber,otp:n.verificationCode},Bn.blacklist(n,["connection","email","phoneNumber","verificationCode"]));this.crossOriginAuthentication.login(i,e)}},Hi.prototype.crossOriginAuthenticationCallback=function(){this.crossOriginVerification()},Hi.prototype.crossOriginVerification=function(){this.crossOriginAuthentication.callback()},Hi.prototype.logout=function(t){Mn.redirect(this.client.buildLogoutUrl(t))},Hi.prototype.passwordlessVerify=function(t,e){var n=this,i=Bn.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience","_csrf","state","_intstate","nonce"]).with(t);return En.check(i,{type:"object",message:"options parameter is not valid"},{responseType:{type:"string",message:"responseType option is required"}}),i=this.transactionManager.process(i),this.client.passwordless.verify(i,(function(t){return t?e(t):Mn.redirect(n.client.passwordless.buildVerifyUrl(i))}))},Vi.prototype.buildVerifyUrl=function(t){var e,n;return En.check(t,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},verificationCode:{type:"string",message:"verificationCode option is required"},phoneNumber:{optional:!1,type:"string",message:"phoneNumber option is required",condition:function(t){return!t.email}},email:{optional:!1,type:"string",message:"email option is required",condition:function(t){return!t.phoneNumber}}}),e=Bn.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience","_csrf","state","_intstate","protocol","nonce"]).with(t),this.baseOptions._sendTelemetry&&(e.auth0Client=this.request.getTelemetryData()),e=Bn.toSnakeCase(e,["auth0Client"]),n=Ge(e),Ne(this.baseOptions.rootUrl,"passwordless","verify_redirect","?"+n)},Vi.prototype.start=function(t,e){var n,i;return En.check(t,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},send:{type:"string",message:"send option is required",values:["link","code"],value_message:"send is not valid ([link, code])"},phoneNumber:{optional:!0,type:"string",message:"phoneNumber option is required",condition:function(t){return"code"===t.send||!t.email}},email:{optional:!0,type:"string",message:"email option is required",condition:function(t){return"link"===t.send||!t.phoneNumber}},authParams:{optional:!0,type:"object",message:"authParams option is required"}}),En.check(e,{type:"function",message:"cb parameter is not valid"}),n=Ne(this.baseOptions.rootUrl,"passwordless","start"),(i=Bn.merge(this.baseOptions,["clientID","responseType","redirectUri","scope"]).with(t)).scope&&(i.authParams=i.authParams||{},i.authParams.scope=i.scope),i.redirectUri&&(i.authParams=i.authParams||{},i.authParams.redirect_uri=i.redirectUri),i.responseType&&(i.authParams=i.authParams||{},i.authParams.response_type=i.responseType),delete i.redirectUri,delete i.responseType,delete i.scope,i=Bn.toSnakeCase(i,["auth0Client","authParams"]),this.request.post(n).send(i).end(Xn(e))},Vi.prototype.verify=function(t,e){var n,i;return En.check(t,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},verificationCode:{type:"string",message:"verificationCode option is required"},phoneNumber:{optional:!1,type:"string",message:"phoneNumber option is required",condition:function(t){return!t.email}},email:{optional:!1,type:"string",message:"email option is required",condition:function(t){return!t.phoneNumber}}}),En.check(e,{type:"function",message:"cb parameter is not valid"}),i=Bn.pick(t,["connection","verificationCode","phoneNumber","email","auth0Client"]),i=Bn.toSnakeCase(i,["auth0Client"]),n=Ne(this.baseOptions.rootUrl,"passwordless","verify"),this.request.post(n).send(i).end(Xn(e))},Wi.prototype.signup=function(t,e){var n,i,r;return En.check(t,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},email:{type:"string",message:"email option is required"},password:{type:"string",message:"password option is required"}}),En.check(e,{type:"function",message:"cb parameter is not valid"}),n=Ne(this.baseOptions.rootUrl,"dbconnections","signup"),r=(i=Bn.merge(this.baseOptions,["clientID"]).with(t)).user_metadata||i.userMetadata,i=Bn.blacklist(i,["scope","userMetadata","user_metadata"]),i=Bn.toSnakeCase(i,["auth0Client"]),r&&(i.user_metadata=r),this.request.post(n).send(i).end(Xn(e))},Wi.prototype.changePassword=function(t,e){var n,i;return En.check(t,{type:"object",message:"options parameter is not valid"},{connection:{type:"string",message:"connection option is required"},email:{type:"string",message:"email option is required"}}),En.check(e,{type:"function",message:"cb parameter is not valid"}),n=Ne(this.baseOptions.rootUrl,"dbconnections","change_password"),i=Bn.merge(this.baseOptions,["clientID"]).with(t,["email","connection"]),i=Bn.toSnakeCase(i,["auth0Client"]),this.request.post(n).send(i).end(Xn(e))},zi.prototype.buildAuthorizeUrl=function(t){var e,n;return En.check(t,{type:"object",message:"options parameter is not valid"}),e=Bn.merge(this.baseOptions,["clientID","responseType","responseMode","redirectUri","scope","audience"]).with(t),En.check(e,{type:"object",message:"options parameter is not valid"},{clientID:{type:"string",message:"clientID option is required"},redirectUri:{optional:!0,type:"string",message:"redirectUri option is required"},responseType:{type:"string",message:"responseType option is required"},nonce:{type:"string",message:"nonce option is required",condition:function(t){return-1===t.responseType.indexOf("code")&&-1!==t.responseType.indexOf("id_token")}},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),this.baseOptions._sendTelemetry&&(e.auth0Client=this.request.getTelemetryData()),e.connection_scope&&En.isArray(e.connection_scope)&&(e.connection_scope=e.connection_scope.join(",")),e=Bn.blacklist(e,["username","popupOptions","domain","tenant","timeout","appState"]),e=Bn.toSnakeCase(e,["auth0Client"]),e=Qn(this.warn,e),n=Ge(e),Ne(this.baseOptions.rootUrl,"authorize","?"+n)},zi.prototype.buildLogoutUrl=function(t){var e,n;return En.check(t,{optional:!0,type:"object",message:"options parameter is not valid"}),e=Bn.merge(this.baseOptions,["clientID"]).with(t||{}),this.baseOptions._sendTelemetry&&(e.auth0Client=this.request.getTelemetryData()),e=Bn.toSnakeCase(e,["auth0Client","returnTo"]),n=Ge(Bn.blacklist(e,["federated"])),t&&void 0!==t.federated&&!1!==t.federated&&"false"!==t.federated&&(n+="&federated"),Ne(this.baseOptions.rootUrl,"v2","logout","?"+n)},zi.prototype.loginWithDefaultDirectory=function(t,e){return En.check(t,{type:"object",message:"options parameter is not valid"},{username:{type:"string",message:"username option is required"},password:{type:"string",message:"password option is required"},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),t.grantType="password",this.oauthToken(t,e)},zi.prototype.login=function(t,e){return En.check(t,{type:"object",message:"options parameter is not valid"},{username:{type:"string",message:"username option is required"},password:{type:"string",message:"password option is required"},realm:{type:"string",message:"realm option is required"},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),t.grantType="http://auth0.com/oauth/grant-type/password-realm",this.oauthToken(t,e)},zi.prototype.oauthToken=function(t,e){var n,i;return En.check(t,{type:"object",message:"options parameter is not valid"}),En.check(e,{type:"function",message:"cb parameter is not valid"}),n=Ne(this.baseOptions.rootUrl,"oauth","token"),i=Bn.merge(this.baseOptions,["clientID","scope","audience"]).with(t),En.check(i,{type:"object",message:"options parameter is not valid"},{clientID:{type:"string",message:"clientID option is required"},grantType:{type:"string",message:"grantType option is required"},scope:{optional:!0,type:"string",message:"scope option is required"},audience:{optional:!0,type:"string",message:"audience option is required"}}),i=Bn.toSnakeCase(i,["auth0Client"]),i=Gn(this.warn,i),this.request.post(n).send(i).end(Xn(e))},zi.prototype.loginWithResourceOwner=function(t,e){var n,i;return En.check(t,{type:"object",message:"options parameter is not valid"},{username:{type:"string",message:"username option is required"},password:{type:"string",message:"password option is required"},connection:{type:"string",message:"connection option is required"},scope:{optional:!0,type:"string",message:"scope option is required"}}),En.check(e,{type:"function",message:"cb parameter is not valid"}),n=Ne(this.baseOptions.rootUrl,"oauth","ro"),i=Bn.merge(this.baseOptions,["clientID","scope"]).with(t,["username","password","scope","connection","device"]),(i=Bn.toSnakeCase(i,["auth0Client"])).grant_type=i.grant_type||"password",this.request.post(n).send(i).end(Xn(e))},zi.prototype.getSSOData=function(t,e){if(this.auth0||(this.auth0=new Hi(this.baseOptions)),Mn.getWindow().location.host===this.baseOptions.domain)return this.auth0._universalLogin.getSSOData(t,e);"function"==typeof t&&(e=t),En.check(e,{type:"function",message:"cb parameter is not valid"});var n=this.baseOptions.clientID,i=this.ssodataStorage.get()||{};this.auth0.checkSession({responseType:"token id_token",scope:"openid profile email",connection:i.lastUsedConnection,timeout:5e3},(function(t,r){return t?"login_required"===t.error?e(null,{sso:!1}):("consent_required"===t.error&&(t.error_description="Consent required. When using `getSSOData`, the user has to be authenticated with the following scope: `openid profile email`."),e(t,{sso:!1})):i.lastUsedSub&&i.lastUsedSub!==r.idTokenPayload.sub?e(t,{sso:!1}):e(null,{lastUsedConnection:{name:i.lastUsedConnection},lastUsedUserID:r.idTokenPayload.sub,lastUsedUsername:r.idTokenPayload.email||r.idTokenPayload.name,lastUsedClientID:n,sessionClients:[n],sso:!0})}))},zi.prototype.userInfo=function(t,e){var n;return En.check(t,{type:"string",message:"accessToken parameter is not valid"}),En.check(e,{type:"function",message:"cb parameter is not valid"}),n=Ne(this.baseOptions.rootUrl,"userinfo"),this.request.get(n).set("Authorization","Bearer "+t).end(Xn(e,{ignoreCasing:!0}))},zi.prototype.delegation=function(t,e){var n,i;return En.check(t,{type:"object",message:"options parameter is not valid"},{grant_type:{type:"string",message:"grant_type option is required"}}),En.check(e,{type:"function",message:"cb parameter is not valid"}),n=Ne(this.baseOptions.rootUrl,"delegation"),i=Bn.merge(this.baseOptions,["clientID"]).with(t),i=Bn.toSnakeCase(i,["auth0Client"]),this.request.post(n).send(i).end(Xn(e))},zi.prototype.getUserCountry=function(t){var e;return En.check(t,{type:"function",message:"cb parameter is not valid"}),e=Ne(this.baseOptions.rootUrl,"user","geoloc","country"),this.request.get(e).end(Xn(t))},Fi.prototype.getUser=function(t,e){var n;return En.check(t,{type:"string",message:"userId parameter is not valid"}),En.check(e,{type:"function",message:"cb parameter is not valid"}),n=Ne(this.baseOptions.rootUrl,"users",t),this.request.get(n).end(Xn(e,{ignoreCasing:!0}))},Fi.prototype.patchUserMetadata=function(t,e,n){var i;return En.check(t,{type:"string",message:"userId parameter is not valid"}),En.check(e,{type:"object",message:"userMetadata parameter is not valid"}),En.check(n,{type:"function",message:"cb parameter is not valid"}),i=Ne(this.baseOptions.rootUrl,"users",t),this.request.patch(i).send({user_metadata:e}).end(Xn(n,{ignoreCasing:!0}))},Fi.prototype.linkUser=function(t,e,n){var i;return En.check(t,{type:"string",message:"userId parameter is not valid"}),En.check(e,{type:"string",message:"secondaryUserToken parameter is not valid"}),En.check(n,{type:"function",message:"cb parameter is not valid"}),i=Ne(this.baseOptions.rootUrl,"users",t,"identities"),this.request.post(i).send({link_with:e}).end(Xn(n,{ignoreCasing:!0}))};var Yi={Authentication:zi,Management:Fi,WebAuth:Hi,version:_n},Ki=function(){return window.location.hash||window.location.search?(!window.location.search||-1===window.location.search.indexOf("code=")&&-1===window.location.search.indexOf("raso=")?window.location.hash:window.location.search).substring(1).split("&").reduce((function(t,e){var n=e.split("=");return t[n[0]]=n[1],t}),{}):{}};function Ji(t,e,n,i){var r=Ki();I.setPresumedLoginState(),I.getAnonymousIdentityState()&&(I.deleteAnonymousIdentityState(),I.deleteSessionCookie()),n?(e.set(t.storageTokenKey,"user",n.accessToken),e.set(t.storageRefreshKey,"user",n.refreshToken),I.setAuthCookie(n.refreshToken),I.setConfigCookie(i.clientId,i.domain),n.alternativeAccessToken&&I.setSessionCookie(n.alternativeAccessToken),e.delete(t.storageVerifierKey)):e.set(t.storageTokenKey,"user",r.access_token)}function Xi(t){console.error("[callback] Debug:redirectURL "+encodedUrl),window.location=t}function $i(t){return!!t.match(/^[a-zA-Z]{2,3}$/)}function Zi(t){return!!t.match(/^[a-zA-Z]{2}$/)||!!t.match(/^[0-9]{3}$/)}function Gi(t){if(!t)return!1;var e=t.split("-");return 2===e.length?$i(e[0])&&Zi(e[1]):3===e.length&&$i(e[0])&&!!e[1].match(/^[a-zA-Z]{4}$/)&&Zi(e[2])}var Qi={isCultureCodeValid:Gi,convertToConvention:function(t){if(!Gi(t))return t;var e=t.split("-");return 2===e.length?[e[0].toLowerCase(),e[1].toUpperCase()].join("-"):3===e.length?[e[0].toLowerCase(),e[1].charAt(0).toUpperCase()+e[1].slice(1).toLowerCase(),e[2].toUpperCase()].join("-"):void 0}};function tr(t,e,n,i,r){var o={useAnonSessionV2:!1};if(200===t.status){var s=JSON.parse(t.response);s&&s.useAnonSessionV2&&(s.useAnonSessionV2.includes(window.location.hostname)||s.useAnonSessionV2.includes("*"))&&(o.useAnonSessionV2=!0)}er(e,n,o,i,r)}function er(t,e,n,i,r){if(a())ir(e,r);else{nr(t,n),window.addEventListener("userIdentity",(function(t){c(t.detail)})),ir(e,r);var s=o();s.session&&s.session.init(),i&&i.askUserToLogin&&(new he).signIn([],[],{})}}function nr(t,e){var n=function(t,e){if(!t)throw new Error("[@vp/auth#init] Configuration must be provided.");if(!Qi.isCultureCodeValid(t.culture))throw new Error("[@vp/auth#init] Configuration must contain a valid culture code.");if(t.options=t.options||{},null!=t.options.redirectAfterSignOutCallback&&!(t.options.redirectAfterSignOutCallback instanceof Function))throw new Error("[@vp/auth#init] redirectAfterSignOutCallback must be a function.");t.options.culture=Qi.convertToConvention(t.culture),t.options.enableCrossSiteSso=!!t.enableCrossSiteSso,t.developmentMode=t.developmentMode||!1;var n,i,r=(n=Le(t.developmentMode),i=t.options,"function"==typeof Object.assign?Object.assign({},n,i):[n,i].reduce((function(t,e){return null==e||Object.keys(e).forEach((function(n){t[n]=e[n]})),t}),{}));return t.options.clientID&&(r.oidc.clientID=t.options.clientID,t.developmentMode&&t.developmentMode.domain||(r.oidc.domain=l)),r.overrides=e,r}(t,e),i=new Ce;t.developmentMode&&function(t,e){var n=Ki();if(e.developmentMode&&n.raso&&Xi(n.raso),window.location.origin+window.location.pathname===e.oidc.redirectUri)if(window.location.search){if(n.code&&n.state){var i=t.get(e.storageVerifierKey),r=re(n.state),o=r.requireSession,s=r.clientId||e.oidc.clientID,a=r.domain||e.oidc.domain;new Yi.Authentication({domain:a,clientID:s,audience:e.oidc.audience,scope:"openid offline_access"}).oauthToken({grantType:"authorization_code",clientId:s,codeVerifier:i.value,code:n.code,redirect_uri:r.redirectUrl},(function(n,i){n?console.error(n):(Ji(e,t,i,{clientId:s,domain:a}),o&&i&&!i.alternativeAccessToken?U.createSession(r,e,i):Xi(r.redirectUrl))}))}}else window.location.hash&&(n.access_token&&Ji(e,t),n.state&&Xi(re(n.state).redirectUrl))}(i,n);var r,o=I.getAnonymousIdentityState();se({options:n})||(r=e.useAnonSessionV2||o&&!o.anonKey?new De(i,n):new Re(i,n));var a=new we(r,i,n);s({options:n,storage:i,anon:r,session:a})}function ir(t,e){"function"==typeof t&&(h()?t(u()):(window.addEventListener("userIdentity",(function e(n){window.removeEventListener("userIdentity",e,!1),t(n.detail)})),"function"==typeof e&&window.addEventListener("userIdentityError",(function t(n){window.removeEventListener("userIdentityError",t,!1),e(n.detail)}))))}console.log("@vp/auth:6.1.193");var rr={WebAuth:he,init:function(t,e,n){a()?ir(e,n):function(t,e,n){var i;if(window.location.search&&(i=window.location.search.substring(1).split("&").reduce((function(t,e){var n=e.split("=");return t[n[0]]=n[1],t}),{})),i&&(i.overrides||i.code&&i.state)){var r={useAnonSessionV2:!1};i.overrides&&(r={useAnonSessionV2:!0}),er(t,e,r,i,n)}else{var o=new XMLHttpRequest;o.onload=tr.bind(this,o,t,e,i,n),o.onerror=tr.bind(this,o,t,e,i,n),o.open("GET","https://oauth.cimpress.io/overrides.json"),o.send(null)}}(t,e,n)}},or=rr.WebAuth,sr=rr.init;e.WebAuth=or,e.default=rr,e.init=sr}},i={};function r(t){var e=i[t];if(void 0!==e)return e.exports;var o=i[t]={exports:{}};return n[t](o,o.exports,r),o.exports}r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),t=r(559),e=new CustomEvent("vpAuthReady",{detail:{VistaprintAuth:t}}),window.VistaprintAuth=t,window.dispatchEvent(e)})();