PageSourceSearch

https://www.expcommercial.com/_next/static/chunks/0jw95xc~3.qab.js

js expcommercial.com collected 2026-09-29 18:47:33 UTC 254,298 bytes, 23 lines download raw bytes

1(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,417777,e=>{"use strict";var t,r,i,o,n,s,a,c,l,u,d,p,h,g,f,E,m,y,S,A,I,v,w,C,_,P;(f=t||(t={})).WebUnknown="0",f.React="1",f.NextJs="2",f.Angular="3",f.VueJs="4",f.Nuxt="5",f.Svelte="6",f.ServerSideUnknown="100",f.ReactSSR="101",f.NextJsSSR="102",f.AngularSSR="103",f.VueJsSSR="104",f.NuxtSSR="105",f.SvelteSSR="106",f.ReactNative="201",f.Expo="202",(E=r||(r={})).AI="ai",E.API="api",E.Auth="auth",E.Analytics="analytics",E.DataStore="datastore",E.Geo="geo",E.InAppMessaging="inappmessaging",E.Interactions="interactions",E.Predictions="predictions",E.PubSub="pubsub",E.PushNotification="pushnotification",E.Storage="storage",(m=i||(i={})).CreateConversation="1",m.GetConversation="2",m.ListConversations="3",m.DeleteConversation="4",m.SendMessage="5",m.ListMessages="6",m.OnMessage="7",m.Generation="8",m.UpdateConversation="9",(y=o||(o={})).Record="1",y.IdentifyUser="2",(S=n||(n={})).GraphQl="1",S.Get="2",S.Post="3",S.Put="4",S.Patch="5",S.Del="6",S.Head="7",(A=s||(s={})).SignUp="1",A.ConfirmSignUp="2",A.ResendSignUpCode="3",A.SignIn="4",A.FetchMFAPreference="6",A.UpdateMFAPreference="7",A.SetUpTOTP="10",A.VerifyTOTPSetup="11",A.ConfirmSignIn="12",A.DeleteUserAttributes="15",A.DeleteUser="16",A.UpdateUserAttributes="17",A.FetchUserAttributes="18",A.ConfirmUserAttribute="22",A.SignOut="26",A.UpdatePassword="27",A.ResetPassword="28",A.ConfirmResetPassword="29",A.FederatedSignIn="30",A.RememberDevice="32",A.ForgetDevice="33",A.FetchDevices="34",A.SendUserAttributeVerificationCode="35",A.SignInWithRedirect="36",A.StartWebAuthnRegistration="37",A.CompleteWebAuthnRegistration="38",A.ListWebAuthnCredentials="39",A.DeleteWebAuthnCredential="40",(I=a||(a={})).Subscribe="1",I.GraphQl="2",(v=c||(c={})).SearchByText="0",v.SearchByCoordinates="1",v.SearchForSuggestions="2",v.SearchByPlaceId="3",v.SaveGeofences="4",v.GetGeofence="5",v.ListGeofences="6",v.DeleteGeofences="7",(w=l||(l={})).SyncMessages="1",w.IdentifyUser="2",w.NotifyMessageInteraction="3",(u||(u={})).None="0",(C=d||(d={})).Convert="1",C.Identify="2",C.Interpret="3",(p||(p={})).Subscribe="1",(_=h||(h={})).InitializePushNotifications="1",_.IdentifyUser="2",(P=g||(g={})).UploadData="1",P.DownloadData="2",P.List="3",P.Copy="4",P.Remove="5",P.GetProperties="6",P.GetUrl="7",P.GetDataAccess="8",P.ListCallerAccessGrants="9",e.s(["AnalyticsAction",0,o,"AuthAction",0,s,"Category",0,r,"Framework",0,t])},791448,553774,e=>{"use strict";var t,r;let i="Logging";e.s(["AWS_CLOUDWATCH_CATEGORY",0,i,"NO_HUBCALLBACK_PROVIDED_EXCEPTION",0,"NoHubcallbackProvidedException","USER_AGENT_HEADER",0,"x-amz-user-agent"],553774),(r=t||(t={})).DEBUG="DEBUG",r.ERROR="ERROR",r.INFO="INFO",r.WARN="WARN",r.VERBOSE="VERBOSE",r.NONE="NONE";let o={VERBOSE:1,DEBUG:2,INFO:3,WARN:4,ERROR:5,NONE:6};class n{constructor(e,r=t.WARN){this.name=e,this.level=r,this._pluggables=[]}_padding(e){return e<10?"0"+e:""+e}_ts(){let e=new Date;return[this._padding(e.getMinutes()),this._padding(e.getSeconds())].join(":")+"."+e.getMilliseconds()}configure(e){return e&&(this._config=e),this._config}_log(e,...r){let i=this.level;n.LOG_LEVEL&&(i=n.LOG_LEVEL),"u">typeof window&&window.LOG_LEVEL&&(i=window.LOG_LEVEL);let s=o[i];if(!(o[e]>=s))return;let a=console.log.bind(console);e===t.ERROR&&console.error&&(a=console.error.bind(console)),e===t.WARN&&console.warn&&(a=console.warn.bind(console)),n.BIND_ALL_LOG_LEVELS&&(e===t.INFO&&console.info&&(a=console.info.bind(console)),e===t.DEBUG&&console.debug&&(a=console.debug.bind(console)));let c=`[${e}] ${this._ts()} ${this.name}`,l="";if(1===r.length&&"string"==typeof r[0])a(l=`${c} - ${r[0]}`);else if(1===r.length)l=`${c} ${r[0]}`,a(c,r[0]);else if("string"==typeof r[0]){let e=r.slice(1);1===e.length&&(e=e[0]),l=`${c} - ${r[0]} ${e}`,a(`${c} - ${r[0]}`,e)}else l=`${c} ${r}`,a(c,r);for(let e of this._pluggables){let t={message:l,timestamp:Date.now()};e.pushLogs([t])}}log(...e){this._log(t.INFO,...e)}info(...e){this._log(t.INFO,...e)}warn(...e){this._log(t.WARN,...e)}error(...e){this._log(t.ERROR,...e)}debug(...e){this._log(t.DEBUG,...e)}verbose(...e){this._log(t.VERBOSE,...e)}addPluggable(e){e&&e.getCategoryName()===i&&(this._pluggables.push(e),e.configure(this._config))}listPluggables(){return this._pluggables}}n.LOG_LEVEL=null,n.BIND_ALL_LOG_LEVELS=!1,e.s(["ConsoleLogger",0,n],791448)},221168,(e,t,r)=>{var i={675:function(e,t){"use strict";t.byteLength=function(e){var t=c(e),r=t[0],i=t[1];
1return(r+i)*3/4-i},t.toByteArray=function(e){var t,r,n=c(e),s=n[0],a=n[1],l=new o((s+a)*3/4-a),u=0,d=a>0?s-4:s;for(r=0;r<d;r+=4)t=i[e.charCodeAt(r)]<<18|i[e.charCodeAt(r+1)]<<12|i[e.charCodeAt(r+2)]<<6|i[e.charCodeAt(r+3)],l[u++]=t>>16&255,l[u++]=t>>8&255,l[u++]=255&t;return 2===a&&(t=i[e.charCodeAt(r)]<<2|i[e.charCodeAt(r+1)]>>4,l[u++]=255&t),1===a&&(t=i[e.charCodeAt(r)]<<10|i[e.charCodeAt(r+1)]<<4|i[e.charCodeAt(r+2)]>>2,l[u++]=t>>8&255,l[u++]=255&t),l},t.fromByteArray=function(e){for(var t,i=e.length,o=i%3,n=[],s=0,a=i-o;s<a;s+=16383)n.push(function(e,t,i){for(var o,n=[],s=t;s<i;s+=3)o=(e[s]<<16&0xff0000)+(e[s+1]<<8&65280)+(255&e[s+2]),n.push(r[o>>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return n.join("")}(e,s,s+16383>a?a:s+16383));return 1===o?n.push(r[(t=e[i-1])>>2]+r[t<<4&63]+"=="):2===o&&n.push(r[(t=(e[i-2]<<8)+e[i-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),n.join("")};for(var r=[],i=[],o="u">typeof Uint8Array?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,a=n.length;s<a;++s)r[s]=n[s],i[n.charCodeAt(s)]=s;function c(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var i=r===t?0:4-r%4;return[r,i]}i[45]=62,i[95]=63},72:function(e,t,r){"use strict";var i=r(675),o=r(783),n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function s(e){if(e>0x7fffffff)throw RangeError('The value "'+e+'" is invalid for option "size"');var t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return u(e)}return c(e,t,r)}function c(e,t,r){if("string"==typeof e){var i=e,o=t;if(("string"!=typeof o||""===o)&&(o="utf8"),!a.isEncoding(o))throw TypeError("Unknown encoding: "+o);var n=0|h(i,o),c=s(n),l=c.write(i,o);return l!==n&&(c=c.slice(0,l)),c}if(ArrayBuffer.isView(e))return d(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(N(e,ArrayBuffer)||e&&N(e.buffer,ArrayBuffer)||"u">typeof SharedArrayBuffer&&(N(e,SharedArrayBuffer)||e&&N(e.buffer,SharedArrayBuffer)))return function(e,t,r){var i;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(i=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),a.prototype),i}(e,t,r);if("number"==typeof e)throw TypeError('The "value" argument must not be of type number. Received type number');var u=e.valueOf&&e.valueOf();if(null!=u&&u!==e)return a.from(u,t,r);var g=function(e){if(a.isBuffer(e)){var t=0|p(e.length),r=s(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||function(e){return e!=e}(e.length)?s(0):d(e):"Buffer"===e.type&&Array.isArray(e.data)?d(e.data):void 0}(e);if(g)return g;if("u">typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function l(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return l(e),s(e<0?0:0|p(e))}function d(e){for(var t=e.length<0?0:0|p(e.length),r=s(t),i=0;i<t;i+=1)r[i]=255&e[i];return r}t.Buffer=a,t.SlowBuffer=function(e){return+e!=e&&(e=0),a.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=0x7fffffff,a.TYPED_ARRAY_SUPPORT=function(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),!a.TYPED_ARRAY_SUPPORT&&"u">typeof console&&"function"==typeof console.error&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return c(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return(l(e),e<=0)?s(e):void 0!==t?"string"==typeof r?s(e).fill(t,r):s(e).fill(t):s(e)},a.allocUnsafe=function(e){return u(e)},a.allocUnsafeSlow=function(e){return u(e)};function p(e){if(e>=0x7fffffff)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function h(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||N(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);var r=e.length,i=arguments.length>2&&!0===arguments[2];if(!i&&0===r)return 0;for(var o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return _(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return R(e).length;default:if(o)return i?-1:_(e).length;t=(""+t).toLowerCase(),o=!0}}function g(e,t,r){var o,n,s,a=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0||(r>>>=0)<=(t>>>=0)))return"";for(e||(e="utf8");;)switch(e){case"hex":return function(e,t,r){var i=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>i)&&(r=i);for(var o="",n=t;n<r;++n)o+=b[e[n]];return o}(this,t,r);case"utf8":case"utf-8":return y(this,t,r);case"ascii":return function(e,t,r){var i="";r=Math.min(e.length,r);for(var o=t;o<r;++o)i+=String.fromCharCode(127&e[o]);return i}(this,t,r);case"latin1":case"binary":return function(e,t,r){var i="";r=Math.min(e.length,r);for(var o=t;o<r;++o)i+=String.fromCharCode(e[o]);return i}(this,t,r);case"base64":return o=this,n=t,s=r,0===n&&s===o.length?i.fromByteArray(o):i.fromByteArray(o.slice(n,s));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(e,t,r){for(var i=e.slice(t,r),o="",n=0;n<i.length;n+=2)o+=String.fromCharCode(i[n]+256*i[n+1]);return o}(this,t,r);default:if(a)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),a=!0}}function f(e,t,r){var i=e[t];e[t]=e[r],e[r]=i}function E(e,t,r,i,o){var n;if(0===e.length)return -1;if("string"==typeof r?(i=r,r=0):r>0x7fffffff?r=0x7fffffff:r<-0x80000000&&(r=-0x80000000),(n=r*=1)!=n&&(r=o?0:e.length-1),r<0&&(r=e.length+r),r>=e.length)if(o)return -1;else r=e.length-1;else if(r<0)if(!o)return -1;else r=0;if("string"==typeof t&&(t=a.from(t,i)),a.isBuffer(t))return 0===t.length?-1:m(e,t,r,i,o);if("number"==typeof t){if(t&=255,"function"==typeof Uint8Array.prototype.indexOf)if(
vendor: 13,902 bytes, line 1
1o)return Uint8Array.prototype.indexOf.call(e,t,r);else return Uint8Array.prototype.lastIndexOf.call(e,t,r);return m(e,[t],r,i,o)}throw TypeError("val must be string, number or Buffer")}function m(e,t,r,i,o){var n,s=1,a=e.length,c=t.length;if(void 0!==i&&("ucs2"===(i=String(i).toLowerCase())||"ucs-2"===i||"utf16le"===i||"utf-16le"===i)){if(e.length<2||t.length<2)return -1;s=2,a/=2,c/=2,r/=2}function l(e,t){return 1===s?e[t]:e.readUInt16BE(t*s)}if(o){var u=-1;for(n=r;n<a;n++)if(l(e,n)===l(t,-1===u?0:n-u)){if(-1===u&&(u=n),n-u+1===c)return u*s}else -1!==u&&(n-=n-u),u=-1}else for(r+c>a&&(r=a-c),n=r;n>=0;n--){for(var d=!0,p=0;p<c;p++)if(l(e,n+p)!==l(t,p)){d=!1;break}if(d)return n}return -1}a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(N(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),N(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;for(var r=e.length,i=t.length,o=0,n=Math.min(r,i);o<n;++o)if(e[o]!==t[o]){r=e[o],i=t[o];break}return r<i?-1:+(i<r)},a.isEncoding=function(e){switch(String(e).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}},a.concat=function(e,t){if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;var r,i=a.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){var n=e[r];if(N(n,Uint8Array)&&(n=a.from(n)),!a.isBuffer(n))throw TypeError('"list" argument must be an Array of Buffers');n.copy(i,o),o+=n.length}return i},a.byteLength=h,a.prototype._isBuffer=!0,a.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)f(this,t,t+1);return this},a.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)f(this,t,t+3),f(this,t+1,t+2);return this},a.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)f(this,t,t+7),f(this,t+1,t+6),f(this,t+2,t+5),f(this,t+3,t+4);return this},a.prototype.toString=function(){var e=this.length;return 0===e?"":0==arguments.length?y(this,0,e):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){var e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},n&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(e,t,r,i,o){if(N(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===i&&(i=0),void 0===o&&(o=this.length),t<0||r>e.length||i<0||o>this.length)throw RangeError("out of range index");if(i>=o&&t>=r)return 0;if(i>=o)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,i>>>=0,o>>>=0,this===e)return 0;for(var n=o-i,s=r-t,c=Math.min(n,s),l=this.slice(i,o),u=e.slice(t,r),d=0;d<c;++d)if(l[d]!==u[d]){n=l[d],s=u[d];break}return n<s?-1:+(s<n)},a.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return E(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return E(this,e,t,r,!1)};function y(e,t,r){r=Math.min(e.length,r);for(var i=[],o=t;o<r;){var n,s,a,c,l=e[o],u=null,d=l>239?4:l>223?3:l>191?2:1;if(o+d<=r)switch(d){case 1:l<128&&(u=l);break;case 2:(192&(n=e[o+1]))==128&&(c=(31&l)<<6|63&n)>127&&(u=c);break;case 3:n=e[o+1],s=e[o+2],(192&n)==128&&(192&s)==128&&(c=(15&l)<<12|(63&n)<<6|63&s)>2047&&(c<55296||c>57343)&&(u=c);break;case 4:n=e[o+1],s=e[o+2],a=e[o+3],(192&n)==128&&(192&s)==128&&(192&a)==128&&(c=(15&l)<<18|(63&n)<<12|(63&s)<<6|63&a)>65535&&c<1114112&&(u=c)}null===u?(u=65533,d=1):u>65535&&(u-=65536,i.push(u>>>10&1023|55296),u=56320|1023&u),i.push(u),o+=d}var p=i,h=p.length;if(h<=4096)return String.fromCharCode.apply(String,p);for(var g="",f=0;f<h;)g+=String.fromCharCode.apply(String,p.slice(f,f+=4096));return g}function S(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function A(e,t,r,i,o,n){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>o||t<n)throw RangeError('"value" argument is out of bounds');if(r+i>e.length)throw RangeError("Index out of range")}function I(e,t,r,i,o,n){if(r+i>e.length||r<0)throw RangeError("Index out of range")}function v(e,t,r,i,n){return t*=1,r>>>=0,n||I(e,t,r,4,34028234663852886e22,-34028234663852886e22),o.write(e,t,r,i,23,4),r+4}function w(e,t,r,i,n){return t*=1,r>>>=0,n||I(e,t,r,8,17976931348623157e292,-17976931348623157e292),o.write(e,t,r,i,52,8),r+8}a.prototype.write=function(e,t,r,i){if(void 0===t)i="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)i=t,r=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(r)?(r>>>=0,void 0===i&&(i="utf8")):(i=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var o,n,s,a,c,l,u,d,p=this.length-t;if((void 0===r||r>p)&&(r=p),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var h=!1;;)switch(i){case"hex":return function(e,t,r,i){r=Number(r)||0;var o=e.length-r;i?(i=Number(i))>o&&(i=o):i=o;var n=t.length;i>n/2&&(i=n/2);for(var s=0;s<i;++s){var a,c=parseInt(t.substr(2*s,2),16);if((a=c)!=a)break;e[r+s]=c}return s}(this,e,t,r);case"utf8":case"utf-8":return o=t,n=r,T(_(e,this.length-o),this,o,n);case"ascii":return s=t,a=r,T(P(e),this,s,a);case"latin1":case"binary":return function(e,t,r,i){return T(P(t),e,r,i)}(this,e,t,r);case"base64":return c=t,l=r,T(R(e),this,c,l);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u=t,d=r,T(function(e,t){for(var r,i,o=[],n=0;n<e.length&&!((t-=2)<0);++n)i=(r=e.charCodeAt(n))>>8,o.push(r%256),o.push(i);return o}(e,this.length-u),this,u,d);default:if(h)throw TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),h=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){var r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=r),t<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);var i=this.subarray(e,t);return Object.setPrototypeOf(i,a.prototype),i},a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||S(e,t,this.length);for(var i=this[e],o=1,n=0;++n<t&&(o*=256);)i+=this[e+n]*o;return i},a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||S(e,t,this.length);for(var i=this[e+--t],o=1;t>0&&(o*=256);)i+=this[e+--t]*o;return i},a.prototype.readUInt8=function(e,t){return e>>>=0,t||S(e,1,this.length),this[e]},a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||S(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||S(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||S(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+0x1000000*this[e+3]},a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||S(e,4,this.length),0x1000000*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||S(e,t,this.length);for(var i=this[e],o=1,n=0;++n<t&&(o*=256);)i+=this[e+n]*o;return i>=(o*=128)&&(i-=Math.pow(2,8*t)),i},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||S(e,t,this.length);for(var i=t,o=1,n=this[e+--i];i>0&&(o*=256);)n+=this[e+--i]*o;return n>=(o*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readInt8=function(e,t){return(e>>>=0,t||S(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||S(e,2,this.length);var r=this[e]|this[e+1]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||S(e,2,this.length);var r=this[e+1]|this[e]<<8;return 32768&r?0xffff0000|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||S(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||S(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readFloatLE=function(e,t){return e>>>=0,t||S(e,4,this.length),o.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||S(e,4,this.length),o.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||S(e,8,this.length),o.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||S(e,8,this.length),o.read(this,e,!1,52,8)},a.prototype.writeUIntLE=function(e,t,r,i){if(e*=1,t>>>=0,r>>>=0,!i){var o=Math.pow(2,8*r)-1;A(this,e,t,r,o,0)}var n=1,s=0;for(this[t]=255&e;++s<r&&(n*=256);)this[t+s]=e/n&255;return t+r},a.prototype.writeUIntBE=function(e,t,r,i){if(e*=1,t>>>=0,r>>>=0,!i){var o=Math.pow(2,8*r)-1;A(this,e,t,r,o,0)}var n=r-1,s=1;for(this[t+n]=255&e;--n>=0&&(s*=256);)this[t+n]=e/s&255;return t+r},a.prototype.writeUInt8=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUInt16LE=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUInt16BE=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUInt32LE=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,4,0xffffffff,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},a.prototype.writeUInt32BE=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,4,0xffffffff,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeIntLE=function(e,t,r,i){if(e*=1,t>>>=0,!i){var o=Math.pow(2,8*r-1);A(this,e,t,r,o-1,-o)}var n=0,s=1,a=0;for(this[t]=255&e;++n<r&&(s*=256);)e<0&&0===a&&0!==this[t+n-1]&&(a=1),this[t+n]=(e/s|0)-a&255;return t+r},a.prototype.writeIntBE=function(e,t,r,i){if(e*=1,t>>>=0,!i){var o=Math.pow(2,8*r-1);A(this,e,t,r,o-1,-o)}var n=r-1,s=1,a=0;for(this[t+n]=255&e;--n>=0&&(s*=256);)e<0&&0===a&&0!==this[t+n+1]&&(a=1),this[t+n]=(e/s|0)-a&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,4,0x7fffffff,-0x80000000),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},a.prototype.writeInt32BE=function(e,t,r){return e*=1,t>>>=0,r||A(this,e,t,4,0x7fffffff,-0x80000000),e<0&&(e=0xffffffff+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},a.prototype.writeFloatLE=function(e,t,r){return v(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return v(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return w(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return w(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,i){if(!a.isBuffer(e))throw TypeError("argument should be a Buffer");if(r||(r=0),i||0===i||(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r||0===e.length||0===this.length)return 0;if(t<0)throw RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(i<0)throw RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-r&&(i=e.length-t+r);var o=i-r;if(this===e&&"function"==typeof Uint8Array.prototype.copyWithin)this.copyWithin(t,r,i);else if(this===e&&r<t&&t<i)for(var n=o-1;n>=0;--n)e[n+t]=this[n+r];else Uint8Array.prototype.set.call(e,this.subarray(r,i),t);return o},a.prototype.fill=function(e,t,r,i){if("string"==typeof e){if("string"==typeof t?(i=t,t=0,r=this.length):"string"==typeof r&&(i=r,r=this.length),void 0!==i&&"string"!=typeof i)throw TypeError("encoding must be a string");if("string"==typeof i&&!a.isEncoding(i))throw TypeError("Unknown encoding: "+i);if(1===e.length){var o,n=e.charCodeAt(0);("utf8"===i&&n<128||"latin1"===i)&&(e=n)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw RangeError("Out of range index");if(r<=t)return this;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(o=t;o<r;++o)this[o]=e;else{var s=a.isBuffer(e)?e:a.from(e,i),c=s.length;if(0===c)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=s[o%c]}return this};var C=/[^+/0-9A-Za-z-_]/g;function _(e,t){t=t||1/0;for(var r,i=e.length,o=null,n=[],s=0;s<i;++s){if((r=e.charCodeAt(s))>55295&&r<57344){if(!o){if(r>56319||s+1===i){(t-=3)>-1&&n.push(239,191,189);continue}o=r;continue}if(r<56320){(t-=3)>-1&&n.push(239,191,189),o=r;continue}r=(o-55296<<10|r-56320)+65536}else o&&(t-=3)>-1&&n.push(239,191,189);if(o=null,r<128){if((t-=1)<0)break;n.push(r)}else if(r<2048){if((t-=2)<0)break;n.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;n.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;n.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return n}function P(e){for(var t=[],r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}function R(e){return i.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(C,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}
1function T(e,t,r,i){for(var o=0;o<i&&!(o+r>=t.length)&&!(o>=e.length);++o)t[o+r]=e[o];return o}function N(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}var b=function(){for(var e="0123456789abcdef",t=Array(256),r=0;r<16;++r)for(var i=16*r,o=0;o<16;++o)t[i+o]=e[r]+e[o];return t}()},783:function(e,t){t.read=function(e,t,r,i,o){var n,s,a=8*o-i-1,c=(1<<a)-1,l=c>>1,u=-7,d=r?o-1:0,p=r?-1:1,h=e[t+d];for(d+=p,n=h&(1<<-u)-1,h>>=-u,u+=a;u>0;n=256*n+e[t+d],d+=p,u-=8);for(s=n&(1<<-u)-1,n>>=-u,u+=i;u>0;s=256*s+e[t+d],d+=p,u-=8);if(0===n)n=1-l;else{if(n===c)return s?NaN:1/0*(h?-1:1);s+=Math.pow(2,i),n-=l}return(h?-1:1)*s*Math.pow(2,n-i)},t.write=function(e,t,r,i,o,n){var s,a,c,l=8*n-o-1,u=(1<<l)-1,d=u>>1,p=5960464477539062e-23*(23===o),h=i?0:n-1,g=i?1:-1,f=+(t<0||0===t&&1/t<0);for(isNaN(t=Math.abs(t))||t===1/0?(a=+!!isNaN(t),s=u):(s=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-s))<1&&(s--,c*=2),s+d>=1?t+=p/c:t+=p*Math.pow(2,1-d),t*c>=2&&(s++,c/=2),s+d>=u?(a=0,s=u):s+d>=1?(a=(t*c-1)*Math.pow(2,o),s+=d):(a=t*Math.pow(2,d-1)*Math.pow(2,o),s=0));o>=8;e[r+h]=255&a,h+=g,a/=256,o-=8);for(s=s<<o|a,l+=o;l>0;e[r+h]=255&s,h+=g,s/=256,l-=8);e[r+h-g]|=128*f}}},o={};function n(e){var t=o[e];if(void 0!==t)return t.exports;var r=o[e]={exports:{}},s=!0;try{i[e](r,r.exports,n),s=!1}finally{s&&delete o[e]}return r.exports}n.ab="/ROOT/node_modules/next/dist/compiled/buffer/",t.exports=n(72)},11594,839444,492827,e=>{"use strict";var t=e.i(221168),r=void 0!==t.Buffer&&t.Buffer.from?function(e){return t.Buffer.from(e,"utf8")}:e=>new TextEncoder().encode(e);e.s(["convertToBuffer",0,function(e){return e instanceof Uint8Array?e:"string"==typeof e?r(e):ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength/Uint8Array.BYTES_PER_ELEMENT):new Uint8Array(e)}],839444),e.s([],11594),e.s(["isEmptyData",0,function(e){return"string"==typeof e?0===e.length:0===e.byteLength}],492827)},189280,255078,517652,e=>{"use strict";"function"==typeof SuppressedError&&SuppressedError,e.s(["__awaiter",0,function(e,t,r,i){return new(r||(r=Promise))(function(o,n){function s(e){try{c(i.next(e))}catch(e){n(e)}}function a(e){try{c(i.throw(e))}catch(e){n(e)}}function c(e){var t;e.done?o(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(s,a)}c((i=i.apply(e,t||[])).next())})},"__generator",0,function(e,t){var r,i,o,n={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){var l=[a,c];if(r)throw TypeError("Generator is already executing.");for(;s&&(s=0,l[0]&&(n=0)),n;)try{if(r=1,i&&(o=2&l[0]?i.return:l[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,l[1])).done)return o;switch(i=0,o&&(l=[2&l[0],o.value]),l[0]){case 0:case 1:o=l;break;case 4:return n.label++,{value:l[1],done:!1};case 5:n.label++,i=l[1],l=[0];continue;case 7:l=n.ops.pop(),n.trys.pop();continue;default:if(!(o=(o=n.trys).length>0&&o[o.length-1])&&(6===l[0]||2===l[0])){n=0;continue}if(3===l[0]&&(!o||l[1]>o[0]&&l[1]<o[3])){n.label=l[1];break}if(6===l[0]&&n.label<o[1]){n.label=o[1],o=l;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(l);break}o[2]&&n.ops.pop(),n.trys.pop();continue}l=t.call(e,n)}catch(e){l=[6,e],i=0}finally{r=o=0}if(5&l[0])throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}},"__values",0,function(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}],189280);var t=new Uint32Array([0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,0xe49b69c1,0xefbe4786,0xfc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x6ca6351,0x14292967,0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc
176c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2]),r=[0x6a09e667,0xbb67ae85,0x3c6ef372,0xa54ff53a,0x510e527f,0x9b05688c,0x1f83d9ab,0x5be0cd19];e.s(["BLOCK_SIZE",0,64,"DIGEST_LENGTH",0,32,"INIT",0,r,"KEY",0,t,"MAX_HASHABLE_LENGTH",0,0x1fffffffffffff],255078);var i=function(){function e(){this.state=Int32Array.from(r),this.temp=new Int32Array(64),this.buffer=new Uint8Array(64),this.bufferLength=0,this.bytesHashed=0,this.finished=!1}return e.prototype.update=function(e){if(this.finished)throw Error("Attempted to update an already finished hash.");var t=0,r=e.byteLength;if(this.bytesHashed+=r,8*this.bytesHashed>0x1fffffffffffff)throw Error("Cannot hash more than 2^53 - 1 bits");for(;r>0;)this.buffer[this.bufferLength++]=e[t++],r--,64===this.bufferLength&&(this.hashBuffer(),this.bufferLength=0)},e.prototype.digest=function(){if(!this.finished){var e=8*this.bytesHashed,t=new DataView(this.buffer.buffer,this.buffer.byteOffset,this.buffer.byteLength),r=this.bufferLength;if(t.setUint8(this.bufferLength++,128),r%64>=56){for(var i=this.bufferLength;i<64;i++)t.setUint8(i,0);this.hashBuffer(),this.bufferLength=0}for(var i=this.bufferLength;i<56;i++)t.setUint8(i,0);t.setUint32(56,Math.floor(e/0x100000000),!0),t.setUint32(60,e),this.hashBuffer(),this.finished=!0}for(var o=new Uint8Array(32),i=0;i<8;i++)o[4*i]=this.state[i]>>>24&255,o[4*i+1]=this.state[i]>>>16&255,o[4*i+2]=this.state[i]>>>8&255,o[4*i+3]=this.state[i]>>>0&255;return o},e.prototype.hashBuffer=function(){for(var e=this.buffer,r=this.state,i=r[0],o=r[1],n=r[2],s=r[3],a=r[4],c=r[5],l=r[6],u=r[7],d=0;d<64;d++){if(d<16)this.temp[d]=(255&e[4*d])<<24|(255&e[4*d+1])<<16|(255&e[4*d+2])<<8|255&e[4*d+3];else{var p=this.temp[d-2],h=(p>>>17|p<<15)^(p>>>19|p<<13)^p>>>10,g=((p=this.temp[d-15])>>>7|p<<25)^(p>>>18|p<<14)^p>>>3;this.temp[d]=(h+this.temp[d-7]|0)+(g+this.temp[d-16]|0)}var f=(((a>>>6|a<<26)^(a>>>11|a<<21)^(a>>>25|a<<7))+(a&c^~a&l)|0)+(u+(t[d]+this.temp[d]|0)|0)|0,E=((i>>>2|i<<30)^(i>>>13|i<<19)^(i>>>22|i<<10))+(i&o^i&n^o&n)|0;u=l,l=c,c=a,a=s+f|0,s=n,n=o,o=i,i=f+E|0}r[0]+=i,r[1]+=o,r[2]+=n,r[3]+=s,r[4]+=a,r[5]+=c,r[6]+=l,r[7]+=u},e}();e.s(["RawSha256",0,i],517652)},79471,860781,e=>{"use strict";var t=e.i(189280),r=e.i(255078),i=e.i(517652);e.i(11594);var o=e.i(492827),n=e.i(839444),s=function(){function e(e){this.secret=e,this.hash=new i.RawSha256,this.reset()}return e.prototype.update=function(e){if(!(0,o.isEmptyData)(e)&&!this.error)try{this.hash.update((0,n.convertToBuffer)(e))}catch(e){this.error=e}},e.prototype.digestSync=function(){if(this.error)throw this.error;return this.outer?(this.outer.finished||this.outer.update(this.hash.digest()),this.outer.digest()):this.hash.digest()},e.prototype.digest=function(){return(0,t.__awaiter)(this,void 0,void 0,function(){return(0,t.__generator)(this,function(e){return[2,this.digestSync()]})})},e.prototype.reset=function(){if(this.hash=new i.RawSha256,this.secret){this.outer=new i.RawSha256;var e=function(e){var t=(0,n.convertToBuffer)(e);if(t.byteLength>r.BLOCK_SIZE){var o=new i.RawSha256;o.update(t),t=o.digest()}var s=new Uint8Array(r.BLOCK_SIZE);return s.set(t),s}(this.secret),t=new Uint8Array(r.BLOCK_SIZE);t.set(e);for(var o=0;o<r.BLOCK_SIZE;o++)e[o]^=54,t[o]^=92;this.hash.update(e),this.outer.update(t);for(var o=0;o<e.byteLength;o++)e[o]=0}},e}();e.s(["Sha256",0,s],860781),e.s([],79471)},914505,677865,397028,845250,452145,e=>{"use strict";var t=e.i(791448),r=e.i(553774);class i extends Error{constructor({message:e,name:t,recoverySuggestion:r,underlyingError:o,metadata:n}){if(super(e),this.name=t,this.underlyingError=o,this.recoverySuggestion=r,n){const{extendedRequestId:e,httpStatusCode:t,requestId:r}=n;this.metadata={extendedRequestId:e,httpStatusCode:t,requestId:r}}this.constructor=i,Object.setPrototypeOf(this,i.prototype)}}e.s(["AmplifyError",0,i],677865);let o="u">typeof Symbol?Symbol("amplify_default"):"@@amplify_default",n=new t.ConsoleLogger("Hub");class s{constructor(e){this.listeners=new Map,this.protectedChannels=["core","auth","api","analytics","interactions","pubsub","storage","ui","xr"],this.name=e}_remove(e,t){let r=this.listeners.get(e);r?this.listeners.set(e,[...r.filter(({callback:e})=>e!==t)]):n.warn(`No listeners for ${e}`)}
1dispatch(e,t,r,i){"string"==typeof e&&this.protectedChannels.indexOf(e)>-1&&i!==o&&n.warn(`WARNING: ${e} is protected and dispatching on it can have unintended consequences`);let s={channel:e,payload:{...t},source:r,patternInfo:[]};try{this._toListeners(s)}catch(e){n.error(e)}}listen(e,t,o="noname"){if("function"!=typeof t)throw new i({name:r.NO_HUBCALLBACK_PROVIDED_EXCEPTION,message:"No callback supplied to Hub"});let n=this.listeners.get(e);return n||(n=[],this.listeners.set(e,n)),n.push({name:o,callback:t}),()=>{this._remove(e,t)}}_toListeners(e){let{channel:t,payload:r}=e,i=this.listeners.get(t);i&&i.forEach(i=>{n.debug(`Dispatching to ${t} with `,r);try{i.callback(e)}catch(e){n.error(e)}})}}let a=new s("__default__"),c=new s("internal-hub");e.s(["AMPLIFY_SYMBOL",0,o,"Hub",0,a,"HubInternal",0,c],914505);let l=e=>{for(let t of Reflect.ownKeys(e)){let r=e[t];(r&&"object"==typeof r||"function"==typeof r)&&l(r)}return Object.freeze(e)};e.s(["deepFreeze",0,l],397028);let u=Symbol("oauth-listener");e.s(["ADD_OAUTH_LISTENER",0,u],845250);let d=new t.ConsoleLogger("parseAWSExports"),p={API_KEY:"apiKey",AWS_IAM:"iam",AMAZON_COGNITO_USER_POOLS:"userPool",OPENID_CONNECT:"oidc",NONE:"none",AWS_LAMBDA:"lambda",LAMBDA:"lambda"},h=e=>e?.split(",")??[],g={AMAZON_COGNITO_USER_POOLS:"userPool",API_KEY:"apiKey",AWS_IAM:"iam",AWS_LAMBDA:"lambda",OPENID_CONNECT:"oidc"},f={GOOGLE:"Google",LOGIN_WITH_AMAZON:"Amazon",FACEBOOK:"Facebook",SIGN_IN_WITH_APPLE:"Apple"};e.s(["parseAmplifyConfig",0,e=>{if(Object.keys(e).some(e=>e.startsWith("aws_")))return((e={})=>{if(!Object.prototype.hasOwnProperty.call(e,"aws_project_region"))throw new i({name:"InvalidParameterException",message:"Invalid config parameter.",recoverySuggestion:"Ensure passing the config object imported from  `amplifyconfiguration.json`."});let{aws_appsync_apiKey:t,aws_appsync_authenticationType:r,aws_appsync_graphqlEndpoint:o,aws_appsync_region:n,aws_bots_config:s,aws_cognito_identity_pool_id:a,aws_cognito_sign_up_verification_method:c,aws_cognito_mfa_configuration:l,aws_cognito_mfa_types:u,aws_cognito_password_protection_settings:g,aws_cognito_verification_mechanisms:f,aws_cognito_signup_attributes:E,aws_cognito_social_providers:m,aws_cognito_username_attributes:y,aws_mandatory_sign_in:S,aws_mobile_analytics_app_id:A,aws_mobile_analytics_app_region:I,aws_user_files_s3_bucket:v,aws_user_files_s3_bucket_region:w,aws_user_files_s3_dangerously_connect_to_http_endpoint_for_testing:C,aws_user_pools_id:_,aws_user_pools_web_client_id:P,geo:R,oauth:T,predictions:N,aws_cloud_logic_custom:b,Notifications:U,modelIntrospection:x}=e,O={};A&&(O.Analytics={Pinpoint:{appId:A,region:I}});let{InAppMessaging:F,Push:D}=U??{};if(F?.AWSPinpoint||D?.AWSPinpoint){if(F?.AWSPinpoint){let{appId:e,region:t}=F.AWSPinpoint;O.Notifications={InAppMessaging:{Pinpoint:{appId:e,region:t}}}}if(D?.AWSPinpoint){let{appId:e,region:t}=D.AWSPinpoint;O.Notifications={...O.Notifications,PushNotification:{Pinpoint:{appId:e,region:t}}}}}if(Array.isArray(s)&&(O.Interactions={LexV1:Object.fromEntries(s.map(e=>[e.name,e]))}),o){let e=p[r];e||d.debug(`Invalid authentication type ${r}. Falling back to IAM.`),O.API={GraphQL:{endpoint:o,apiKey:t,region:n,defaultAuthMode:e??"iam"}},x&&(O.API.GraphQL.modelIntrospection=x)}let k=l?{status:l&&l.toLowerCase(),totpEnabled:u?.includes("TOTP")??!1,smsEnabled:u?.includes("SMS")??!1}:void 0,L=g?{minLength:g.passwordPolicyMinLength,requireLowercase:g.passwordPolicyCharacters?.includes("REQUIRES_LOWERCASE")??!1,requireUppercase:g.passwordPolicyCharacters?.includes("REQUIRES_UPPERCASE")??!1,requireNumbers:g.passwordPolicyCharacters?.includes("REQUIRES_NUMBERS")??!1,requireSpecialCharacters:g.passwordPolicyCharacters?.includes("REQUIRES_SYMBOLS")??!1}:void 0,M=Array.from(new Set([...f??[],...E??[]])).reduce((e,t)=>({...e,[t.toLowerCase()]:{required:!0}}),{}),V=y?.includes("EMAIL")??!1,B=y?.includes("PHONE_NUMBER")??!1;(a||_)&&(O.Auth={Cognito:{identityPoolId:a,allowGuestAccess:"enable"!==S,signUpVerificationMethod:c,userAttributes:M,userPoolClientId:P,userPoolId:_,mfa:k,passwordFormat:L,loginWith:{username:!(V||B),email:V,phone:B}}});let G=!!T&&Object.keys(T).length>0,q=!!m&&m.length>0;
1if(O.Auth&&G&&(O.Auth.Cognito.loginWith={...O.Auth.Cognito.loginWith,oauth:{...(({domain:e,scope:t,redirectSignIn:r,redirectSignOut:i,responseType:o})=>({domain:e,scopes:t,redirectSignIn:h(r),redirectSignOut:h(i),responseType:o}))(T),...q&&{providers:m.map(e=>{let t=e.toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)})}}}),v&&(O.Storage={S3:{bucket:v,region:w,dangerouslyConnectToHttpEndpointForTesting:C}}),R){let{amazon_location_service:e}=R;O.Geo={LocationService:{maps:e.maps,geofenceCollections:e.geofenceCollections,searchIndices:e.search_indices,region:e.region}}}if(b&&(O.API={...O.API,REST:b.reduce((e,t)=>{let{name:r,endpoint:i,region:o,service:n}=t;return{...e,[r]:{endpoint:i,...n?{service:n}:void 0,...o?{region:o}:void 0}}},{})}),N){let{VoiceId:e}=N?.convert?.speechGenerator?.defaults??{};O.Predictions=e?{...N,convert:{...N.convert,speechGenerator:{...N.convert.speechGenerator,defaults:{voiceId:e}}}}:N}return O})(e);if(!function(e){let{version:t}=e;return!!t&&t.startsWith("1")}(e))return e;let t={};if(e.storage&&(t.Storage=function(e){let t;if(!e)return;let{bucket_name:r,aws_region:i,buckets:o}=e;return{S3:{bucket:r,region:i,buckets:o&&(t={},o.forEach(({name:e,bucket_name:r,aws_region:i,paths:o})=>{if(e in t)throw Error(`Duplicate friendly name found: ${e}. Name must be unique.`);let n=o?Object.entries(o).reduce((e,[t,r])=>(void 0!==r&&(e[t]=r),e),{}):void 0;t[e]={bucketName:r,region:i,paths:n}}),t)}}}(e.storage)),e.auth&&(t.Auth=function(e){var t;if(!e)return;let{user_pool_id:r,user_pool_client_id:i,identity_pool_id:o,password_policy:n,mfa_configuration:s,mfa_methods:a,unauthenticated_identities_enabled:c,oauth:l,username_attributes:u,standard_required_attributes:d,groups:p,passwordless_options:h}=e,g={Cognito:{userPoolId:r,userPoolClientId:i,groups:p}};return o&&(g.Cognito={...g.Cognito,identityPoolId:o}),n&&(g.Cognito.passwordFormat={requireLowercase:n.require_lowercase,requireNumbers:n.require_numbers,requireUppercase:n.require_uppercase,requireSpecialCharacters:n.require_symbols,minLength:n.min_length??6}),s&&(g.Cognito.mfa={status:"OPTIONAL"===(t=s)?"optional":"REQUIRED"===t?"on":"off",smsEnabled:a?.includes("SMS"),totpEnabled:a?.includes("TOTP")}),c&&(g.Cognito.allowGuestAccess=c),l&&(g.Cognito.loginWith={oauth:{domain:l.domain,redirectSignIn:l.redirect_sign_in_uri,redirectSignOut:l.redirect_sign_out_uri,responseType:"token"===l.response_type?"token":"code",scopes:l.scopes,providers:function(e=[]){return e.reduce((e,t)=>(void 0!==f[t]&&e.push(f[t]),e),[])}(l.identity_providers)}}),u&&(g.Cognito.loginWith={...g.Cognito.loginWith,email:u.includes("email"),phone:u.includes("phone_number"),username:u.includes("username")}),d&&(g.Cognito.userAttributes=d.reduce((e,t)=>({...e,[t]:{required:!0}}),{})),h&&(g.Cognito.passwordless={emailOtpEnabled:h.email_otp_enabled,smsOtpEnabled:h.sms_otp_enabled,webAuthn:h.web_authn?{relyingPartyId:h.web_authn.relying_party_id,userVerification:h.web_authn.user_verification}:void 0,preferredChallenge:h.preferred_challenge}),g}(e.auth)),e.analytics&&(t.Analytics=function(e){if(!e?.amazon_pinpoint)return;let{amazon_pinpoint:t}=e;return{Pinpoint:{appId:t.app_id,region:t.aws_region}}}(e.analytics)),e.geo&&(t.Geo=function(e){if(!e)return;let{aws_region:t,geofence_collections:r,maps:i,search_indices:o}=e;return{LocationService:{region:t,searchIndices:o,geofenceCollections:r,maps:i}}}(e.geo)),e.data&&(t.API=function(e){if(!e)return;let{aws_region:t,default_authorization_type:r,url:i,api_key:o,model_introspection:n}=e;return{GraphQL:{endpoint:i,defaultAuthMode:g[r],region:t,apiKey:o,modelIntrospection:n}}}(e.data)),e.custom){let r=function(e){if(!e?.events)return;let{url:t,aws_region:r,api_key:i,default_authorization_type:o}=e.events;return{Events:{endpoint:t,defaultAuthMode:g[o],region:r,apiKey:i}}}(e.custom);r&&"Events"in r&&(t.API={...t.API,...r})}return e.notifications&&(t.Notifications=function(e){if(!e)return;let{aws_region:t,channels:r,amazon_pinpoint_app_id:i}=e,o=r.includes("IN_APP_MESSAGING"),n=r.includes("APNS")||r.includes("FCM");if(!(o||n))return;let s={};return o&&(s.InAppMessaging={Pinpoint:{appId:i,region:t}}),n&&(s.PushNotification={Pinpoint:{appId:i,region:t}}),s}(e.notifications)),t}],452145)},757396,123504,e=>{"use strict";var t=e.i(914505),r=e.i(397028),i=e.i(845250),o=e.i(452145);e.i(79471);let n={},s={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();1===t.length&&(t=`0${t}`),n[e]=t,s[t]=e}e.s([],123504);let a=new(e.i(791448)).ConsoleLogger("Auth");class c{configure(e,t){this.authConfig=e,this.authOptions=t,e&&e.Cognito?.userPoolEndpoint&&a.warn(l("Amazon Cognito User Pool")),e&&e.Cognito?.identityPoolEndpoint&&a.warn(l("Amazon Cognito Identity Pool"))}async fetchAuthSession(e={}){let t,r,i=await this.getTokens(e);return i?(r=i.accessToken?.payload?.sub,t=await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({authConfig:this.authConfig,tokens:i,authenticated:!0,forceRefresh:e.forceRefresh})):t=await this.authOptions?.credentialsProvider?.getCredentialsAndIdentityId({authConfig:this.authConfig,authenticated:!1,forceRefresh:e.forceRefresh}),{tokens:i,credentials:t?.credentials,identityId:t?.identityId,userSub:r}}async clearCredentials(){await this.authOptions?.credentialsProvider?.clearCredentialsAndIdentityId()}async getTokens(e){return await this.authOptions?.tokenProvider?.getTokens(e)??void 0}}let l=e=>`You are using a custom Amazon ${e} endpoint, ensure the endpoint is correct.`;class u{constructor(){this.oAuthListener=void 0,this.isConfigured=!1,this.resourcesConfig={},this.libraryOptions={},this.Auth=new c}configure(e,i){let n=(0,o.parseAmplifyConfig)(e);this.resourcesConfig=n,i&&(this.libraryOptions=i),this.resourcesConfig=(0,r.deepFreeze)(this.resourcesConfig),this.Auth.configure(this.resourcesConfig.Auth,this.libraryOptions.Auth),(this.resourcesConfig.Analytics?.Pinpoint||this.resourcesConfig.Notifications?.InAppMessaging?.Pinpoint||this.resourcesConfig.Notifications?.PushNotification?.Pinpoint)&&console.warn("AWS will end support for Amazon Pinpoint on October 30, 2026. The guidance is to use AWS End User Messaging for push notifications and 
1SMS, Amazon Simple Email Service for sending emails, Amazon Connect for campaigns, journeys, endpoints, and engagement analytics. Pinpoint recommends Amazon Kinesis for event collection and mobile analytics."),t.Hub.dispatch("core",{event:"configure",data:this.resourcesConfig},"Configure",t.AMPLIFY_SYMBOL),this.notifyOAuthListener(),this.isConfigured=!0}getConfig(){return this.isConfigured||console.warn("Amplify has not been configured. Please call Amplify.configure() before using this service."),this.resourcesConfig}[i.ADD_OAUTH_LISTENER](e){this.resourcesConfig.Auth?.Cognito.loginWith?.oauth?e(this.resourcesConfig.Auth?.Cognito):this.oAuthListener=e}notifyOAuthListener(){this.resourcesConfig.Auth?.Cognito.loginWith?.oauth&&this.oAuthListener&&(this.oAuthListener(this.resourcesConfig.Auth?.Cognito),this.oAuthListener=void 0)}}let d=new u;e.s(["Amplify",0,d],757396)},258768,e=>{"use strict";var t=e.i(757396);e.s(["fetchAuthSession",0,e=>{let r;return r=t.Amplify,r.Auth.fetchAuthSession(e)}],258768)},726205,e=>{"use strict";let t;var r=e.i(417777);let i="6.16.0";var o=e.i(350461);let n=(e,t)=>!!Object.keys(e).find(e=>e.startsWith(t)),s=[{platform:r.Framework.Expo,detectionMethod:function(){return void 0!==e.g.expo}},{platform:r.Framework.ReactNative,detectionMethod:function(){return"u">typeof navigator&&void 0!==navigator.product&&"ReactNative"===navigator.product}},{platform:r.Framework.NextJs,detectionMethod:function(){return"u">typeof window&&window.next&&"object"==typeof window.next}},{platform:r.Framework.Nuxt,detectionMethod:function(){return"u">typeof window&&(void 0!==window.__NUXT__||void 0!==window.$nuxt)}},{platform:r.Framework.Angular,detectionMethod:function(){let e=!!("u">typeof document&&document.querySelector("[ng-version]")),t=!!("u">typeof window&&void 0!==window.ng);return e||t}},{platform:r.Framework.React,detectionMethod:function(){let e=e=>e.startsWith("_react")||e.startsWith("__react");return"u">typeof document&&Array.from(document.querySelectorAll("[id]")).some(t=>Object.keys(t).find(e))}},{platform:r.Framework.VueJs,detectionMethod:function(){return"u">typeof window&&n(window,"__VUE")}},{platform:r.Framework.Svelte,detectionMethod:function(){return"u">typeof window&&n(window,"__SVELTE")}},{platform:r.Framework.WebUnknown,detectionMethod:function(){return"u">typeof window}},{platform:r.Framework.NextJsSSR,detectionMethod:function(){return n(e.g,"__next")||n(e.g,"__NEXT")}},{platform:r.Framework.NuxtSSR,detectionMethod:function(){return void 0!==e.g.__NUXT_PATHS__}},{platform:r.Framework.ReactSSR,detectionMethod:function(){return void 0!==o.default&&void 0!==o.default.env&&!!Object.keys(o.default.env).find(e=>e.includes("react"))}},{platform:r.Framework.VueJsSSR,detectionMethod:function(){return n(e.g,"__VUE")}},{platform:r.Framework.AngularSSR,detectionMethod:function(){return void 0!==o.default&&"object"==typeof o.default.env&&o.default.env.npm_lifecycle_script?.startsWith("ng ")||!1}},{platform:r.Framework.SvelteSSR,detectionMethod:function(){return void 0!==o.default&&void 0!==o.default.env&&!!Object.keys(o.default.env).find(e=>e.includes("svelte"))}}],a=[],c=!1,l=()=>{if(!t){if(t=s.find(e=>e.detectionMethod())?.platform||r.Framework.ServerSideUnknown,c)for(;a.length;)a.pop()?.();else a.forEach(e=>{e()});u(r.Framework.ServerSideUnknown,10),u(r.Framework.WebUnknown,10)}return t};function u(e,r){t!==e||c||setTimeout(()=>{t=void 0,c=!0,setTimeout(l,1e3)},r)}let d={},p="aws-amplify";new class{constructor(){this.userAgent=`${p}/${(e=>e.replace(/\+.*/,""))(i)}`}get framework(){return l()}get isReactNative(){return this.framework===r.Framework.ReactNative||this.framework===r.Framework.Expo}observeFrameworkChanges(e){c||a.push(e)}};let h=({category:e,action:t}={})=>{let r=[[p,i.replace(/\+.*/,"")]];if(e&&r.push([e,t]),r.push(["framework",l()]),e&&t){let i=d[e]?.[t]?.additionalDetails;i&&i.forEach(e=>{r.push(e)})}return r};e.s(["getAmplifyUserAgent",0,e=>h(e).map(([e,t])=>e&&t?`${e}/${t}`:e).join(" "),"getAmplifyUserAgentObject",0,h],726205)},320720,e=>{"use strict";var t,r;(r=t||(t={})).NoEndpointId="NoEndpointId",r.PlatformNotSupported="PlatformNotSupported",r.Unknown="Unknown",r.NetworkError="NetworkError",e.s(["AmplifyErrorCode",0,t])},438815,e=>{"use strict";var t=e.i(320720),r=e.i(677865);class i extends r.AmplifyError{constructor(){super({name:t.AmplifyErrorCode.PlatformNotSupported,message:"Function not supported on current platform"})}}class o{constructor(e){this.storage=e}async setItem(e,t){if(!this.storage)throw new i;this.storage.setItem(e,t)}async getItem(e){if(!this.storage)throw new i;return this.storage.getItem(e)}async removeItem(e){if(!this.storage)throw new i;this.storage.removeItem(e)}async clear(){if(!this.storage)throw new i;this.storage.clear()}}var n=e.i(791448);class s{constructor(){this.storage=new Map}get length(){return this.storage.size}key(e){return e>this.length-1?null:Array.from(this.storage.keys())[e]}setItem(e,t){this.storage.set(e,t)}getItem(e){return this.storage.get(e)??null}removeItem(e){this.storage.delete(e)}clear(){this.storage.clear()}}let a=new n.ConsoleLogger("CoreStorageUtils"),c=()=>{try{if("u">typeof window&&window.sessionStorage)return window.sessionStorage.getItem("test"),window.sessionStorage;throw Error("sessionStorage is not defined")}catch(e){return a.info("sessionStorage not found. InMemoryStorage is used as a fallback."),new s}};class l{constructor(e){this._storage=e}get storage(){if(!this._storage)throw new i;return this._storage}setItem(e,t){this.storage.setItem(e,t)}getItem(e){return this.storage.getItem(e)}removeItem(e){this.storage.removeItem(e)}clear(){this.storage.clear()}}let u=new class extends o{constructor(){super((()=>{try{if("u">typeof window&&window.localStorage)return window.localStorage}catch(e){a.info("localStorage not found. InMemoryStorage is used as a fallback.")}return new s})())}};new class extends o{constructor(){super(c())}};let d=new class extends l{constructor(){super(c())}};
1new o(new s),e.s(["defaultStorage",0,u,"syncSessionStorage",0,d],438815)},46384,44715,e=>{"use strict";let t=e=>{let{headers:t,statusCode:i}=e;return{...r(e)?e.$metadata:{},httpStatusCode:i,requestId:t["x-amzn-requestid"]??t["x-amzn-request-id"]??t["x-amz-request-id"],extendedRequestId:t["x-amz-id-2"],cfId:t["x-amz-cf-id"]}},r=e=>"object"==typeof e?.$metadata;e.s(["parseMetadata",0,t],44715);let i=async e=>{if(!e||e.statusCode<300)return;let r=await o(e),i=(e=>{let[t]=e.toString().split(/[,:]+/);return t.includes("#")?t.split("#")[1]:t})(e.headers["x-amzn-errortype"]??r.code??r.__type??"UnknownError");return Object.assign(Error(r.message??r.Message??"Unknown error"),{name:i,$metadata:t(e)})},o=async e=>{if(!e.body)throw Error("Missing response payload");return Object.assign(await e.body.json(),{$metadata:t(e)})};e.s(["parseJsonBody",0,o,"parseJsonError",0,i],46384)},420936,e=>{"use strict";e.s(["composeServiceApi",0,(e,t,r,i)=>async(o,n)=>{let s={...i,...o},a=await s.endpointResolver(s,n),c=await t(n,a);return r(await e(c,{...s}))}])},882610,e=>{"use strict";e.s(["jitteredBackoff",0,function(e=3e5){return t=>{let r=2**t*100+100*Math.random();return!(r>e)&&r}}],882610)},592907,e=>{"use strict";e.s(["AMZ_SDK_INVOCATION_ID_HEADER",0,"amz-sdk-invocation-id","AMZ_SDK_REQUEST_HEADER",0,"amz-sdk-request","DEFAULT_MAX_DELAY_MS",0,3e5,"DEFAULT_RETRY_ATTEMPTS",0,3])},647211,e=>{"use strict";var t=e.i(882610),r=e.i(592907);e.s(["jitteredBackoff",0,e=>{let i=(0,t.jitteredBackoff)(r.DEFAULT_MAX_DELAY_MS)(e);return!1===i?r.DEFAULT_MAX_DELAY_MS:i}])},626365,e=>{"use strict";var t=e.i(320720);let r=["AuthFailure","InvalidSignatureException","RequestExpired","RequestInTheFuture","RequestTimeTooSkewed","SignatureDoesNotMatch","BadRequestException"],i=["BandwidthLimitExceeded","EC2ThrottledException","LimitExceededException","PriorRequestNotComplete","ProvisionedThroughputExceededException","RequestLimitExceeded","RequestThrottled","RequestThrottledException","SlowDown","ThrottledException","Throttling","ThrottlingException","TooManyRequestsException"],o=["TimeoutError","RequestTimeout","RequestTimeoutException"];e.s(["getRetryDecider",0,e=>async(n,s)=>{let a,c,l,u,d,p=s??await e(n)??void 0,h=p?.code||p?.name,g=n?.statusCode;return{retryable:(a=s,[t.AmplifyErrorCode.NetworkError,"ERR_NETWORK"].includes(a?.name)||(c=g,l=h,429===c||!!l&&i.includes(l))||!!h&&r.includes(h)||(u=g,d=h,!!u&&[500,502,503,504].includes(u)||!!d&&o.includes(d)))}}],626365)},827739,947285,203827,396597,e=>{"use strict";let t;var r=e.i(592907);let i=(e,t)=>{let r,i;if(t?.aborted)return Promise.resolve();let o=new Promise(t=>{i=t,r=setTimeout(t,e)});return t?.addEventListener("abort",function e(o){clearTimeout(r),t?.removeEventListener("abort",e),i()}),o},o=(e,t)=>{"[object Object]"===Object.prototype.toString.call(e)&&(e.$metadata={...e.$metadata??{},attempts:t})};e.s(["retryMiddlewareFactory",0,({maxAttempts:e=r.DEFAULT_RETRY_ATTEMPTS,retryDecider:t,computeDelay:n,abortSignal:s})=>{if(e<1)throw Error("maxAttempts must be greater than 0");return(r,a)=>async function(c){let l,u,d=a.attemptsCount??0,p=()=>{if(u)return o(u,d),u;throw o(l,d),l};for(;!s?.aborted&&d<e;){try{u=await r(c),l=void 0}catch(e){l=e,u=void 0}d=(a.attemptsCount??0)>d?a.attemptsCount??0:d+1,a.attemptsCount=d;let{isCredentialsExpiredError:o,retryable:h}=await t(u,l,a);if(!h)return p();if(a.isCredentialsExpired=!!o,!s?.aborted&&d<e){let e=n(d);await i(e,s)}}if(!s?.aborted)return p();throw Error("Request aborted.")}}],827739);let n="u">typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),s=new Uint8Array(16),a=[];for(let e=0;e<256;++e)a.push((e+256).toString(16).slice(1));let c=function(e,r,i){if(n&&!r&&!e)return n();let o=(e=e||{}).random??e.rng?.()??function(){if(!t){if("u"<typeof crypto||!crypto.getRandomValues)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");t=crypto.getRandomValues.bind(crypto)}return t(s)}();if(o.length<16)throw Error("Random bytes length must be >= 16");if(o[6]=15&o[6]|64,o[8]=63&o[8]|128,r){if((i=i||0)<0||i+16>r.length)throw RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let e=0;e<16;++e)r[i+e]=o[e];return r}
1return function(e,t=0){return(a[e[t+0]]+a[e[t+1]]+a[e[t+2]]+a[e[t+3]]+"-"+a[e[t+4]]+a[e[t+5]]+"-"+a[e[t+6]]+a[e[t+7]]+"-"+a[e[t+8]]+a[e[t+9]]+"-"+a[e[t+10]]+a[e[t+11]]+a[e[t+12]]+a[e[t+13]]+a[e[t+14]]+a[e[t+15]]).toLowerCase()}(o)};e.i(79471),e.i(123504),e.s(["amzSdkInvocationIdHeaderMiddlewareFactory",0,()=>e=>async function(t){return t.headers[r.AMZ_SDK_INVOCATION_ID_HEADER]||(t.headers[r.AMZ_SDK_INVOCATION_ID_HEADER]=c()),e(t)}],947285);var l=r;e.s(["amzSdkRequestHeaderMiddlewareFactory",0,({maxAttempts:e=l.DEFAULT_RETRY_ATTEMPTS})=>(t,r)=>async function(i){let o=r.attemptsCount??0;return i.headers[l.AMZ_SDK_REQUEST_HEADER]=`attempt=${o+1}; max=${e}`,t(i)}],203827),e.s(["userAgentMiddlewareFactory",0,({userAgentHeader:e="x-amz-user-agent",userAgentValue:t=""})=>r=>async function(i){if(0===t.trim().length)return await r(i);{let o=e.toLowerCase();return i.headers[o]=i.headers[o]?`${i.headers[o]} ${t}`:t,await r(i)}}],396597)},153721,e=>{"use strict";e.s(["composeTransferHandler",0,(e,t)=>(r,i)=>{let o={},n=t=>e(t,i);for(let e=t.length-1;e>=0;e--)n=(0,t[e])(i)(n,o);return n(r)}])},637965,e=>{"use strict";var t=e.i(827739),r=e.i(947285),i=e.i(203827),o=e.i(396597),n=e.i(153721),s=e.i(677865),a=e.i(320720);let c=e=>{let t;return()=>(t||(t=e()),t)},l=async({url:e,method:t,headers:r,body:i},{abortSignal:o,cache:n,withCrossDomainCredentials:l})=>{let u;try{u=await fetch(e,{method:t,headers:r,body:["HEAD","GET"].includes(t.toUpperCase())?void 0:i,signal:o,cache:n,credentials:l?"include":"same-origin"})}catch(e){if(e instanceof TypeError)throw new s.AmplifyError({name:a.AmplifyErrorCode.NetworkError,message:"A network error has occurred.",underlyingError:e});throw e}let d={};u.headers?.forEach((e,t)=>{d[t.toLowerCase()]=e});let p={statusCode:u.status,headers:d,body:null},h=Object.assign(u.body??{},{text:c(()=>u.text()),blob:c(()=>u.blob()),json:c(()=>u.json())});return{...p,body:h}},u=(0,n.composeTransferHandler)(l,[o.userAgentMiddlewareFactory,r.amzSdkInvocationIdHeaderMiddlewareFactory,t.retryMiddlewareFactory,i.amzSdkRequestHeaderMiddlewareFactory]);e.s(["unauthenticatedHandler",0,u],637965)},426377,911476,874703,135736,e=>{"use strict";var t,r,i=e.i(677865);let o=()=>{if("u">typeof window&&"function"==typeof window.atob)return window.atob;if("function"==typeof atob)return atob;throw new i.AmplifyError({name:"Base64EncoderError",message:"Cannot resolve the `atob` function from the environment."})};e.s(["getAtob",0,o,"getBtoa",0,()=>{if("u">typeof window&&"function"==typeof window.btoa)return window.btoa;if("function"==typeof btoa)return btoa;throw new i.AmplifyError({name:"Base64EncoderError",message:"Cannot resolve the `btoa` function from the environment."})},"getCrypto",0,()=>{if("object"==typeof window&&"object"==typeof window.crypto)return window.crypto;if("object"==typeof crypto)return crypto;throw new i.AmplifyError({name:"MissingPolyfill",message:"Cannot resolve the `crypto` function from the environment."})}],911476);let n={convert(e,t){let r=e;return t?.urlSafe&&(r=r.replace(/-/g,"+").replace(/_/g,"/")),o()(r)}};e.s(["base64Decoder",0,n],874703);var s=i;let a=(e,t=s.AmplifyError)=>(r,i,o)=>{let{message:n,recoverySuggestion:s}=e[i];if(!r)throw new t({name:i,message:o?`${n} ${o}`:n,recoverySuggestion:s})};e.s(["createAssertionFunction",0,a],135736),(t=r||(r={})).AuthTokenConfigException="AuthTokenConfigException",t.AuthUserPoolAndIdentityPoolException="AuthUserPoolAndIdentityPoolException",t.AuthUserPoolException="AuthUserPoolException",t.InvalidIdentityPoolIdException="InvalidIdentityPoolIdException",t.OAuthNotConfigureException="OAuthNotConfigureException";let c=a({[r.AuthTokenConfigException]:{message:"Auth Token Provider not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app."},[r.AuthUserPoolAndIdentityPoolException]:{message:"Auth UserPool or IdentityPool not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app with UserPoolId and IdentityPoolId."},[r.AuthUserPoolException]:{message:"Auth UserPool not configured.",recoverySuggestion:"Make sure to call Amplify.configure in your app with userPoolId and userPoolClientId."},[r.InvalidIdentityPoolIdException]:{message:"Invalid identity pool id provided.",recoverySuggestion:"Make sure a valid identityPoolId is given in the config."},[r.OAuthNotConfigureException]:{message:"oauth param not configured.",recoverySuggestion:"Make sure to call Amplify.configure with oauth parameter in your app."}});e.s(["assertIdentityPoolIdConfig",0,function(e){c(!!e?.identityPoolId,r.InvalidIdentityPoolIdException)},"assertOAuthConfig",0,function(e){c(!!e?.loginWith?.oauth?.domain&&!!e?.loginWith?.oauth?.redirectSignOut&&!!e?.loginWith?.oauth?.redirectSignIn&&!!e?.loginWith?.oauth?.responseType,r.OAuthNotConfigureException)},"assertTokenProviderConfig",0,function(e){c(!!e&&!!e.userPoolId&&!!e.userPoolClientId,r.AuthUserPoolException)},"decodeJWT",0,function(e){let t=e.split(".");if(3!==t.length)throw Error("Invalid token");try{let r=t[1].replace(/-/g,"+").replace(/_/g,"/"),i=decodeURIComponent(n.convert(r).split("").map(e=>`%${`00${e.charCodeAt(0).toString(16)}`.slice(-2)}`).join("")),o=JSON.parse(i);return{toString:()=>e,payload:o}}catch(e){throw Error("Invalid token payload")}}],426377)},555634,e=>{"use strict";var t=e.i(677865);class r extends t.AmplifyError{constructor(e){super(e),this.constructor=r,Object.setPrototypeOf(this,r.prototype)}}e.s(["AuthError",0,r])},423299,e=>{"use strict";var t=e.i(320720),r=e.i(555634);e.s(["assertServiceError",0,function(e){if(!e||"Error"===e.name||e instanceof TypeError)throw new r.AuthError({name:t.AmplifyErrorCode.Unknown,message:"An unknown error has occurred.",underlyingError:e})}])},973227,e=>{"use strict";var t=e.i(555634);e.s(["getRegionFromIdentityPoolId",0,function(e){if(!e||!e.includes(":"))throw new t.AuthError({name:"InvalidIdentityPoolIdException",message:"Invalid identity pool id provided.",recoverySuggestion:"Make sure a valid identityPoolId is given in the config."});return e.split(":")[0]},"getRegionFromUserPoolId",0,function(e){let r=e?.split("_")[0];if(!e||0>e.indexOf("_")||!r||"string"!=typeof r)throw new t.AuthError({name:"InvalidUserPoolId",message:"Invalid user pool id provided."});return r}])},565941,175836,e=>{"use strict";var t=e.i(555634);let r="UserUnAuthenticatedException",i="DeviceMetadataNotFoundException",o=new t.AuthError({name:"InvalidRedirectException",message:"signInRedirect or signOutRedirect had an invali
1d format or was not found.",recoverySuggestion:"Please make sure the signIn/Out redirect in your oauth config is valid."});new t.AuthError({name:"InvalidAppSchemeException",message:"A valid non-http app scheme was not found in the config.",recoverySuggestion:"Please make sure a valid custom app scheme is present in the config."});let n=new t.AuthError({name:"InvalidPreferredRedirectUrlException",message:"The given preferredRedirectUrl does not match any items in the redirectSignOutUrls array from the config.",recoverySuggestion:"Please make sure a matching preferredRedirectUrl is provided."}),s=new t.AuthError({name:"InvalidOriginException",message:"redirect is coming from a different origin. The oauth flow needs to be initiated from the same origin",recoverySuggestion:"Please call signInWithRedirect from the same origin."}),a="TokenRefreshException";e.s(["AUTO_SIGN_IN_EXCEPTION",0,"AutoSignInException","DEVICE_METADATA_NOT_FOUND_EXCEPTION",0,i,"OAUTH_SIGNOUT_EXCEPTION",0,"OAuthSignOutException","TOKEN_REFRESH_EXCEPTION",0,a,"UNEXPECTED_SIGN_IN_INTERRUPTION_EXCEPTION",0,"UnexpectedSignInInterruptionException","USER_ALREADY_AUTHENTICATED_EXCEPTION",0,"UserAlreadyAuthenticatedException","USER_UNAUTHENTICATED_EXCEPTION",0,r,"invalidOriginException",0,s,"invalidPreferredRedirectUrlException",0,n,"invalidRedirectException",0,o],175836);let c=new t.AuthError({name:a,message:`Token refresh is not supported when authenticated with the 'implicit grant' (token) oauth flow. 
2	Please change your oauth configuration to use 'code grant' flow.`,recoverySuggestion:`Please logout and change your Amplify configuration to use "code grant" flow. 
3	E.g { responseType: 'code' }`}),l=new t.AuthError({name:r,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."});function u(e){return e?.accessToken||e?.idToken}e.s(["OAuthStorageKeys",0,{inflightOAuth:"inflightOAuth",oauthSignIn:"oauthSignIn",oauthPKCE:"oauthPKCE",oauthState:"oauthState"},"assertAuthTokens",0,function(e){if(!e||!e.accessToken)throw new t.AuthError({name:r,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."})},"assertAuthTokensWithRefreshToken",0,function(e){var t,r;if(u(t=e)&&!t?.refreshToken)throw c;if(!(u(r=e)&&r?.refreshToken))throw l},"assertDeviceMetadata",0,function(e){if(!e||!e.deviceKey||!e.deviceGroupKey||!e.randomPassword)throw new t.AuthError({name:i,message:"Either deviceKey, deviceGroupKey or secretPassword were not found during the sign-in process.",recoverySuggestion:"Make sure to not clear storage after calling the signIn API."})},"assertIdTokenInAuthTokens",0,function(e){if(!e||!e.idToken)throw new t.AuthError({name:r,message:"User needs to be authenticated to call this API.",recoverySuggestion:"Sign in before calling this API again."})}],565941)},973170,e=>{"use strict";let t={id:"aws",outputs:{dnsSuffix:"amazonaws.com"},regionRegex:"^(us|eu|ap|sa|ca|me|af)\\-\\w+\\-\\d+$",regions:["aws-global"]},r={partitions:[t,{id:"aws-cn",outputs:{dnsSuffix:"amazonaws.com.cn"},regionRegex:"^cn\\-\\w+\\-\\d+$",regions:["aws-cn-global"]}]};e.s(["getDnsSuffix",0,e=>{let{partitions:i}=r;for(let{regions:t,outputs:r,regionRegex:o}of i){let i=new RegExp(o);if(t.includes(e)||i.test(e))return r.dnsSuffix}return t.outputs.dnsSuffix}],973170)},62242,e=>{"use strict";let t=URL;URLSearchParams,e.s(["AmplifyUrl",0,t])},925896,e=>{"use strict";var t,r=e.i(426377),i=e.i(555634);let o={accessToken:"accessToken",idToken:"idToken",oidcProvider:"oidcProvider",clockDrift:"clockDrift",refreshToken:"refreshToken",deviceKey:"deviceKey",randomPasswordKey:"randomPasswordKey",deviceGroupKey:"deviceGroupKey",signInDetails:"signInDetails",oauthMetadata:"oauthMetadata"};var n=e.i(135736);(t||(t={})).InvalidAuthTokens="InvalidAuthTokens";let s={[t.InvalidAuthTokens]:{message:"Invalid tokens.",recoverySuggestion:"Make sure the tokens are valid."}},a=(0,n.createAssertionFunction)(s),c="CognitoIdentityServiceProvider";function l(e){let t=Object.values({...e});return(e,r)=>t.reduce((t,i)=>({...t,[i]:`${e}.${r}.${i}`}),{})}e.s(["DefaultTokenStore",0,class{getKeyValueStorage(){if(!this.keyValueStorage)throw new i.AuthError({name:"KeyValueStorageNotFoundException",message:"KeyValueStorage was not found in TokenStore"});return this.keyValueStorage}setKeyValueStorage(e){this.keyValueStorage=e}setAuthConfig(e){this.authConfig=e}async loadTokens(){try{let e=await this.getAuthKeys(),t=await this.getKeyValueStorage().getItem(e.accessToken);if(!t)throw new i.AuthError({name:"NoSessionFoundException",message:"Auth session was not found. Make sure to call signIn."});let o=(0,r.decodeJWT)(t),n=await this.getKeyValueStorage().getItem(e.idToken),s=n?(0,r.decodeJWT)(n):void 0,a=await this.getKeyValueStorage().getItem(e.refreshToken)??void 0,c=await this.getKeyValueStorage().getItem(e.clockDrift)??"0",l=Number.parseInt(c),u=await this.getKeyValueStorage().getItem(e.signInDetail
3s),d={accessToken:o,idToken:s,refreshToken:a,deviceMetadata:await this.getDeviceMetadata()??void 0,clockDrift:l,username:await this.getLastAuthUser()};return u&&(d.signInDetails=JSON.parse(u)),d}catch(e){return null}}async storeTokens(e){a(void 0!==e,t.InvalidAuthTokens);let r=e.username;await this.getKeyValueStorage().setItem(this.getLastAuthUserKey(),r);let i=await this.getAuthKeys();await this.getKeyValueStorage().setItem(i.accessToken,e.accessToken.toString()),e.idToken?await this.getKeyValueStorage().setItem(i.idToken,e.idToken.toString()):await this.getKeyValueStorage().removeItem(i.idToken),e.refreshToken?await this.getKeyValueStorage().setItem(i.refreshToken,e.refreshToken):await this.getKeyValueStorage().removeItem(i.refreshToken),e.deviceMetadata&&(e.deviceMetadata.deviceKey&&await this.getKeyValueStorage().setItem(i.deviceKey,e.deviceMetadata.deviceKey),e.deviceMetadata.deviceGroupKey&&await this.getKeyValueStorage().setItem(i.deviceGroupKey,e.deviceMetadata.deviceGroupKey),await this.getKeyValueStorage().setItem(i.randomPasswordKey,e.deviceMetadata.randomPassword)),e.signInDetails?await this.getKeyValueStorage().setItem(i.signInDetails,JSON.stringify(e.signInDetails)):await this.getKeyValueStorage().removeItem(i.signInDetails),await this.getKeyValueStorage().setItem(i.clockDrift,`${e.clockDrift}`)}async clearTokens(){let e=await this.getAuthKeys();await Promise.all([this.getKeyValueStorage().removeItem(e.accessToken),this.getKeyValueStorage().removeItem(e.idToken),this.getKeyValueStorage().removeItem(e.clockDrift),this.getKeyValueStorage().removeItem(e.refreshToken),this.getKeyValueStorage().removeItem(e.signInDetails),this.getKeyValueStorage().removeItem(this.getLastAuthUserKey()),this.getKeyValueStorage().removeItem(e.oauthMetadata)])}async getDeviceMetadata(e){let t=await this.getAuthKeys(e),r=await this.getKeyValueStorage().getItem(t.deviceKey),i=await this.getKeyValueStorage().getItem(t.deviceGroupKey),o=await this.getKeyValueStorage().getItem(t.randomPasswordKey);return o&&i&&r?{deviceKey:r,deviceGroupKey:i,randomPassword:o}:null}async clearDeviceMetadata(e){let t=await this.getAuthKeys(e);await Promise.all([this.getKeyValueStorage().removeItem(t.deviceKey),this.getKeyValueStorage().removeItem(t.deviceGroupKey),this.getKeyValueStorage().removeItem(t.randomPasswordKey)])}async getAuthKeys(e){let t,i;(0,r.assertTokenProviderConfig)(this.authConfig?.Cognito);let n=e??await this.getLastAuthUser();return t=c,i=`${this.authConfig.Cognito.userPoolClientId}.${n}`,l(o)(`${t}`,i)}getLastAuthUserKey(){(0,r.assertTokenProviderConfig)(this.authConfig?.Cognito);let e=this.authConfig.Cognito.userPoolClientId;return`${c}.${e}.LastAuthUser`}async getLastAuthUser(){return await this.getKeyValueStorage().getItem(this.getLastAuthUserKey())??"username"}async setOAuthMetadata(e){let{oauthMetadata:t}=await this.getAuthKeys();await this.getKeyValueStorage().setItem(t,JSON.stringify(e))}async getOAuthMetadata(){let{oauthMetadata:e}=await this.getAuthKeys(),t=await this.getKeyValueStorage().getItem(e);return t&&JSON.parse(t)}},"getAuthStorageKeys",0,l],925896)},264362,e=>{"use strict";e.s(["deDupeAsyncFunction",0,e=>{let t;return async(...r)=>t||(t=new Promise((i,o)=>{e(...r).then(e=>{i(e)}).catch(e=>{o(e)}).finally(()=>{t=void 0})}))}])},214269,e=>{"use strict";e.s(["COGNITO_IDP_SERVICE_NAME",0,"cognito-idp"])},971532,e=>{"use strict";var t=e.i(62242),r=e.i(973170),i=e.i(214269);e.s(["createCognitoUserPoolEndpointResolver",0,({endpointOverride:e})=>o=>e?{url:new t.AmplifyUrl(e)}:(({region:e})=>({url:new t.AmplifyUrl(`https://${i.COGNITO_IDP_SERVICE_NAME}.${e}.${(0,r.getDnsSuffix)(e)}`)}))(o)],971532)},31783,e=>{"use strict";e.s(["createUserPoolSerializer",0,e=>(t,r)=>{let i;return(({url:e},t,r)=>({headers:t,url:e,body:r,method:"POST"}))(r,(i=e,{"content-type":"application/x-amz-json-1.1","x-amz-target":`AWSCognitoIdentityProviderService.${i}`}),JSON.stringify(t))}])},190498,e=>{"use strict";var t=e.i(46384),r=e.i(423299),i=e.i(555634);e.s(["createUserPoolDeserializer",0,()=>async e=>{if(e.statusCode>=300){let o=await (0,t.parseJsonError)(e);throw(0,r.assertServiceError)(o),new i.AuthError({name:o.name,message:o.message,metadata:o.$metadata})}return(0,t.parseJsonBody)(e)}])},522488,e=>{"use strict";var t=e.i(153721),r=e.i(637965);let i=(0,t.composeTransferHandler)(r.unauthenticatedHandler,[()=>(e,t)=>async function(t){return t.headers["cache-control"]="no-store",e(t)}]);e.s(["cognitoUserPoolTransferHandler",0,i])},774488,e=>{"use strict";
3var t=e.i(626365),r=e.i(46384),i=e.i(647211),o=e.i(726205);let n={service:e.i(214269).COGNITO_IDP_SERVICE_NAME,retryDecider:(0,t.getRetryDecider)(r.parseJsonError),computeDelay:i.jitteredBackoff,get userAgentValue(){return(0,o.getAmplifyUserAgent)()},cache:"no-store"};e.s(["DEFAULT_SERVICE_CLIENT_API_CONFIG",0,n])},512311,e=>{"use strict";var t=e.i(264362),r=e.i(426377),i=e.i(973227),o=e.i(565941),n=e.i(555634),s=e.i(971532),a=e.i(420936),c=e.i(31783),l=e.i(190498),u=e.i(522488),d=e.i(774488);let p=async({tokens:e,authConfig:t,username:p,clientMetadata:h})=>{let g;(0,r.assertTokenProviderConfig)(t?.Cognito);let{userPoolId:f,userPoolClientId:E,userPoolEndpoint:m}=t.Cognito,y=(0,i.getRegionFromUserPoolId)(f);(0,o.assertAuthTokensWithRefreshToken)(e);let S=(g={endpointResolver:(0,s.createCognitoUserPoolEndpointResolver)({endpointOverride:m})},(0,a.composeServiceApi)(u.cognitoUserPoolTransferHandler,(0,c.createUserPoolSerializer)("GetTokensFromRefreshToken"),(0,l.createUserPoolDeserializer)(),{...d.DEFAULT_SERVICE_CLIENT_API_CONFIG,...g})),{AuthenticationResult:A}=await S({region:y},{ClientId:E,RefreshToken:e.refreshToken,DeviceKey:e.deviceMetadata?.deviceKey,ClientMetadata:h}),I=(0,r.decodeJWT)(A?.AccessToken??""),v=A?.IdToken?(0,r.decodeJWT)(A.IdToken):void 0,{iat:w}=I.payload;if(!w)throw new n.AuthError({name:"iatNotFoundException",message:"iat not found in access token"});return{accessToken:I,idToken:v,clockDrift:1e3*w-new Date().getTime(),refreshToken:A?.RefreshToken??e.refreshToken,username:p}},h=(0,t.deDupeAsyncFunction)(p);e.s(["refreshAuthTokens",0,h],512311)},996388,347344,377138,121348,100498,e=>{"use strict";var t=e.i(438815),r=e.i(512311),i=e.i(925896),o=e.i(914505);let n=()=>"u">typeof window&&void 0!==window.document;e.s(["isBrowser",0,n],347344);var s=e.i(426377);function a({expiresAt:e,clockDrift:t,tolerance:r=5e3}){return Date.now()+t+r>e}var c=e.i(423299),l=e.i(555634),u=e.i(565941);let d="amplify-signin-with-hostedUI",p="CognitoIdentityServiceProvider";class h{constructor(e){this.keyValueStorage=e}async clearOAuthInflightData(){(0,s.assertTokenProviderConfig)(this.cognitoConfig);let e=g(p,this.cognitoConfig.userPoolClientId);await Promise.all([this.keyValueStorage.removeItem(e.inflightOAuth),this.keyValueStorage.removeItem(e.oauthPKCE),this.keyValueStorage.removeItem(e.oauthState)])}async clearOAuthData(){(0,s.assertTokenProviderConfig)(this.cognitoConfig);let e=g(p,this.cognitoConfig.userPoolClientId);return await this.clearOAuthInflightData(),await this.keyValueStorage.removeItem(d),this.keyValueStorage.removeItem(e.oauthSignIn)}loadOAuthState(){(0,s.assertTokenProviderConfig)(this.cognitoConfig);let e=g(p,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.getItem(e.oauthState)}storeOAuthState(e){(0,s.assertTokenProviderConfig)(this.cognitoConfig);let t=g(p,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.setItem(t.oauthState,e)}loadPKCE(){(0,s.assertTokenProviderConfig)(this.cognitoConfig);let e=g(p,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.getItem(e.oauthPKCE)}storePKCE(e){(0,s.assertTokenProviderConfig)(this.cognitoConfig);let t=g(p,this.cognitoConfig.userPoolClientId);return this.keyValueStorage.setItem(t.oauthPKCE,e)}setAuthConfig(e){this.cognitoConfig=e}async loadOAuthInFlight(){(0,s.assertTokenProviderConfig)(this.cognitoConfig);let e=g(p,this.cognitoConfig.userPoolClientId);return await this.keyValueStorage.getItem(e.inflightOAuth)==="true"}async storeOAuthInFlight(e){(0,s.assertTokenProviderConfig)(this.cognitoConfig);let t=g(p,this.cognitoConfig.userPoolClientId);await this.keyValueStorage.setItem(t.inflightOAuth,`${e}`)}async loadOAuthSignIn(){(0,s.assertTokenProviderConfig)(this.cognitoConfig);let e=g(p,this.cognitoConfig.userPoolClientId),t=await this.keyValueStorage.getItem(d),[r,i]=(await this.keyValueStorage.getItem(e.oauthSignIn))?.split(",")??[];return{isOAuthSignIn:"true"===r||"true"===t,preferPrivateSession:"true"===i}}async storeOAuthSignIn(e,t=!1){(0,s.assertTokenProviderConfig)(this.cognitoConfig);let r=g(p,this.cognitoConfig.userPoolClientId);await this.keyValueStorage.setItem(r.oauthSignIn,`${e},${t}`)}}let g=(e,t)=>(0,i.getAuthStorageKeys)(u.OAuthStorageKeys)(e,t);e.s(["DefaultOAuthStore",0,h],377138);let f=new h(t.defaultStorage);e.s(["oAuthStore",0,f],121348);let E=[],m=e=>{E.push(e)};e.s(["addInflightPromise",0,m,"resolveAndClearInflightPromises",0,()=>{for(;E.length;)E.pop()?.()}],100498);class y{constructor(){this.waitForInflightOAuth=n()?async()=>
3{if(await f.loadOAuthInFlight())return this.inflightPromise||(this.inflightPromise=new Promise((e,t)=>{m(e)})),this.inflightPromise}:async()=>{}}setAuthConfig(e){f.setAuthConfig(e.Cognito),this.authConfig=e}setTokenRefresher(e){this.tokenRefresher=e}setAuthTokenStore(e){this.tokenStore=e}getTokenStore(){if(!this.tokenStore)throw new l.AuthError({name:"EmptyTokenStoreException",message:"TokenStore not set"});return this.tokenStore}getTokenRefresher(){if(!this.tokenRefresher)throw new l.AuthError({name:"EmptyTokenRefresherException",message:"TokenRefresher not set"});return this.tokenRefresher}setClientMetadataProvider(e){this.clientMetadataProvider=e}async getTokens(e){let t;try{(0,s.assertTokenProviderConfig)(this.authConfig?.Cognito)}catch(e){return null}await this.waitForInflightOAuth(),this.inflightPromise=void 0,t=await this.getTokenStore().loadTokens();let r=await this.getTokenStore().getLastAuthUser();if(null===t)return null;let i=!!t?.idToken&&a({expiresAt:(t.idToken?.payload?.exp??0)*1e3,clockDrift:t.clockDrift??0}),o=a({expiresAt:(t.accessToken?.payload?.exp??0)*1e3,clockDrift:t.clockDrift??0});return(e?.forceRefresh||i||o)&&null===(t=await this.refreshTokens({tokens:t,username:r,clientMetadata:e?.clientMetadata??await this.clientMetadataProvider?.()}))?null:{accessToken:t?.accessToken,idToken:t?.idToken,signInDetails:t?.signInDetails}}async refreshTokens({tokens:e,username:t,clientMetadata:r}){try{let{signInDetails:i}=e,n=await this.getTokenRefresher()({tokens:e,authConfig:this.authConfig,username:t,clientMetadata:r});return n.signInDetails=i,await this.setTokens({tokens:n}),o.Hub.dispatch("auth",{event:"tokenRefresh"},"Auth",o.AMPLIFY_SYMBOL),n}catch(e){return this.handleErrors(e)}}handleErrors(e){if((0,c.assertServiceError)(e),this.isAuthenticationError(e)&&this.clearTokens(),o.Hub.dispatch("auth",{event:"tokenRefresh_failure",data:{error:e}},"Auth",o.AMPLIFY_SYMBOL),e.name.startsWith("NotAuthorizedException"))return null;throw e}isAuthenticationError(e){return["NotAuthorizedException","TokenRevokedException","UserNotFoundException","PasswordResetRequiredException","UserNotConfirmedException","RefreshTokenReuseException"].some(t=>e?.name?.startsWith?.(t))}async setTokens({tokens:e}){return this.getTokenStore().storeTokens(e)}async clearTokens(){return this.getTokenStore().clearTokens()}getDeviceMetadata(e){return this.getTokenStore().getDeviceMetadata(e)}clearDeviceMetadata(e){return this.getTokenStore().clearDeviceMetadata(e)}setOAuthMetadata(e){return this.getTokenStore().setOAuthMetadata(e)}getOAuthMetadata(){return this.getTokenStore().getOAuthMetadata()}}let S=new class{constructor(){this.authTokenStore=new i.DefaultTokenStore,this.authTokenStore.setKeyValueStorage(t.defaultStorage),this.tokenOrchestrator=new y,this.tokenOrchestrator.setAuthTokenStore(this.authTokenStore),this.tokenOrchestrator.setTokenRefresher(r.refreshAuthTokens)}getTokens(e={}){return this.tokenOrchestrator.getTokens(e)}setKeyValueStorage(e){this.authTokenStore.setKeyValueStorage(e)}setClientMetadataProvider(e){this.tokenOrchestrator.setClientMetadataProvider(e)}setAuthConfig(e){this.authTokenStore.setAuthConfig(e),this.tokenOrchestrator.setAuthConfig(e)}},{tokenOrchestrator:A}=S;e.s(["cognitoUserPoolsTokenProvider",0,S,"tokenOrchestrator",0,A],996388)},635470,148462,244972,317138,893065,785589,950917,736619,627592,65988,839616,427167,161097,210650,720510,640080,544211,781800,874275,605486,e=>{"use strict";let t,r;var i,o,n,s,a,c,l,u,d,p,h,g,f,E,m,y,S,A,I=((i={}).ProceedWithLogin="Auth.Flow.ProceedWithLogin",i.RequiresPasswordReset="Auth.Flow.RequiresPasswordReset",i.RequiresEmailVerification="Auth.Flow.RequiresEmailVerification",i),v=((o={}).Confirmed="Auth.SignUp.Confirmed",o.RequiresEmailVerification="Auth.SignUp.RequiresEmailVerification",o.Incomplete="Auth.SignUp.Incomplete",o),w=((n={}).Attempt="Auth.SignUp.Attempt",n.Confirm="Auth.SignUp.Confirm",n.ResendCodeError="Auth.SignUp.ResendCodeError",n),C=((s={}).SignInAttempt="Auth.Idp.SignInAttempt",s.SignInComplete="Auth.Idp.SignInComplete",s.RequiresEmailVerification="Auth.Idp.RequiresEmailVerification",s.RequiresNewPassword="Auth.Idp.RequiresNewPassword",s.ClearStaleSessionError="Auth.Idp.ClearStaleSessionError",s),_=((a={}).GetSignInProvider="Auth.Idp.GetSignInProvider",a.GetSignInProviderNoSession="Auth.Idp.GetSignInProviderNoSession",a),P=((c={}).AccountReady="Auth.Probe.AccountReady",c.RequiresPasswordReset="Auth.Probe.RequiresPasswordReset",c.RequiresEmailVerification="Auth.Probe.RequiresEmailVerification",c.UserNotFound="Auth.Probe.UserNotFound",c.Unknown="Auth.Probe.Unknown",c),R=((l={}).AwaitingStart="Auth.Social.AwaitingStart",l.ClearingSession="Auth.Social.ClearingSession",l.RedirectingToProvider="Auth.Social.RedirectingToProvider",l.ExchangingToken="Auth.Social.ExchangingToken",l.Authenticated="Auth.Social.Authenticated",l.CollectingPhone="Auth.Social.CollectingPhone",l.Failed="Auth.Social.Failed",l.Hydrated="Auth.Social.Hydrated",l.Transition="Auth.Social.Transition",l.Ignored="Auth.Social.Ignored",l.MalformedPendingState="Auth.Social.MalformedPendingState",l.Error="Auth.Social.Error",l.ClearStaleSessionError="Auth.Social.ClearStaleSessionError",l.ProfileForwarded="Auth.Social.ProfileForwarded",l.PrivateEmailExposed="Auth.Social.PrivateEmailExposed",l.AuthenticateAfterRedirect="Auth.Social.AuthenticateAfterRedirect",l.StaleSessionRetry="Auth.Social.StaleSessionRetry",l.Po
3pupBlocked="Auth.Social.PopupBlocked",l.PopupClosedByUser="Auth.Social.PopupClosedByUser",l),T=((u={}).Request="Auth.TokenExchange.Request",u.Success="Auth.TokenExchange.Success",u.RegistrationRequired="Auth.TokenExchange.RegistrationRequired",u.Error="Auth.TokenExchange.Error",u.SubmitPhoneRequest="Auth.TokenExchange.SubmitPhoneRequest",u.SubmitPhoneSuccess="Auth.TokenExchange.SubmitPhoneSuccess",u),N=((d={}).Refresh="Auth.Session.Refresh",d.RefreshNoSession="Auth.Session.RefreshNoSession",d.SignOut="Auth.Session.SignOut",d.SignOutError="Auth.Session.SignOutError",d.RevalidateTimeout="Auth.Session.RevalidateTimeout",d.SubmitPhone="Auth.Session.SubmitPhone",d.Start="Auth.Session.Start",d.NeedsPhone="Auth.Session.NeedsPhone",d.Refreshed="Auth.Session.Refreshed",d.Expired="Auth.Session.Expired",d.FailOpen="Auth.Session.FailOpen",d.ExpiredOnError="Auth.Session.ExpiredOnError",d),b=((p={}).Request="Auth.DeleteAccount.Request",p.Success="Auth.DeleteAccount.Success",p),U=((h={}).Assembled="Auth.Factory.Assembled",h),x=((g={}).RequiresEmailVerification="Auth.Outcome.RequiresEmailVerification",g.RequiresPasswordReset="Auth.Outcome.RequiresPasswordReset",g.RequiresPhone="Auth.Outcome.RequiresPhone",g),O=((f={}).UserNotConfirmed="Auth.DomainError.UserNotConfirmed",f.PasswordResetRequired="Auth.DomainError.PasswordResetRequired",f.PrivateEmailExposed="Auth.DomainError.PrivateEmailExposed",f),F=((E={}).PrivateEmailExposed="Auth.Error.PrivateEmailExposed",E.SocialSignInFailed="Auth.Error.SocialSignInFailed",E),D=((m={}).RegisterFailed="auth_register_failure",m.RegisterSucceeded="auth_register_success",m.SignInFailed="auth_signin_failure",m.SignInSucceeded="auth_signin_success",m.SocialSignInSucceeded="auth_social_signin_success",m.ChangePasswordSucceeded="auth_change_password_success",m.SubmitPhoneSucceeded="auth_submit_phone_success",m.SessionRefreshSucceeded="auth_session_refresh_success",m.DeleteAccountSucceeded="auth_delete_account_success",m.EmailLookupFailed="auth_email_lookup_failure",m.IdpProbeFailed="auth_idp_probe_failure",m.SessionFailed="auth_session_failure",m.DeleteAccountFailed="auth_delete_account_failure",m.SignOutFailed="auth_signout_failure",m.SocialSignInFailed="auth_social_signin_failure",m.ResendCodeFailed="auth_resend_code_failure",m.ClearStaleSessionFailed="auth_clear_stale_session_failure",m.ChangePasswordFailed="auth_change_password_failure",m.SubmitPhoneFailed="auth_submit_phone_failure",m.BootstrapFailed="auth_bootstrap_failure",m.UpdateProfileFailed="auth_update_profile_failure",m.UpdateEmailFailed="auth_update_email_failure",m.UpdateEmailConfirmationFailed="auth_update_email_confirmation_failure",m),k=((y={}).InvalidCredentials="invalid_credentials",y.ValidationRejected="validation_error",y.ApiCallFailed="api_error",y.UnknownError="unknown_error",y),L=((S={}).Critical="critical",S),M=((A={}).InvalidPassword="formError:invalid_password",A.InvalidPasswordFormat="formError:invalid_password_format",A.InvalidEmail="formError:invalid_email",A.InvalidCode="formError:invalid_code",A.InvalidPhone="formError:invalid_phone",A.ExpiredCode="formError:expired_code",A.EmailTaken="formError:email_taken",A.Other="formError:other",A.PasswordChangedSuccess="formError:password_changed_success",A.PasswordResetEmailSent="formError:password_reset_email_sent",A.ResetTokenInvalid="formError:reset_token_invalid",A.InfoChangedSuccess="formError:info_changed_success",A.ValidationRequestFailed="formError:validation_request_failed",A.ValidationErrorMessage="formError:validation_error_message",A.AccountConfirmationFailed="formError:account_confirmation_failed",A.AccountDeleteFailed="formError:account_delete_failed",A.AccountDeletedSuccess="formError:account_deleted_success",A.PrivateEmailExposed="formError:private_email_exposed",A);e.s(["AuthErrorCode",()=>F,"AuthFlow",()=>I,"AuthOutcome",()=>x,"DeleteAccountStep",()=>b,"DomainErrorName",()=>O,"ErrorCategory",()=>k,"FactoryEvent",()=>U,"IdpEvent",()=>_,"IdpSignInStep",()=>C,"LocaleKey",()=>M,"ObservabilityEvent",()=>D,"ProbeStatus",()=>P,"SessionStep",()=>N,"Severity",()=>L,"SignUpStatus",()=>v,"SignUpStep",()=>w,"SocialFlowStatus",()=>R,"TokenExchangeStep",()=>T],148462),e.s([],635470);var V=e.i(391398),B=e.i(191788);let G=(0,B.createContext)(null),q=(0,B.createContext)(null);function H(){let e=(0,B.useContext)(G);if(!e)throw Error("useAuth must be used within an <AuthProvider>. Wrap your app in <AuthProvider> in _app.tsx.");return e}function K(){let e=(0,B.useContext)(q);
3if(!e)throw Error("useAuthSessionInternal must be used within an <AuthProvider>.");return e}function W(e){let[t,r]=(0,B.useReducer)(e.reducer,e.initialState),i=(0,B.useRef)(t);i.current=t;let o=(0,B.useRef)(new Set),n=(0,B.useRef)(e);n.current=e;let s=(0,B.useCallback)(e=>{let t=i.current;r(e);let a=n.current,c=a.effects[e.type];!c||o.current.has(e.type)||(o.current.add(e.type),c(e,t,s,a.deps).catch(t=>s(a.deriveFailure(e,t))).finally(()=>o.current.delete(e.type)))},[]);return[t,s]}e.s(["AuthProvider",0,function({session:e,children:t}){let r=(0,B.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot),i=(0,B.useMemo)(()=>({supportedFeatures:e.supportedFeatures,signOut:t=>e.signOut(t),setUser:t=>e.setUser(t),refreshSession:()=>e.refreshSession(),getSignInProvider:()=>e.getSignInProvider(),getLogoutUrl:t=>e.getLogoutUrl(t),signInWithSocial:t=>e.signInWithSocial(t),legacySocialSignIn:t=>e.legacySocialSignIn(t),hasPendingAfterLogout:()=>e.hasPendingAfterLogout(),resumeAfterLogout:()=>e.resumeAfterLogout(),failSocialAuth:t=>e.failSocialAuth(t),submitPhone:(t,r)=>e.submitPhone(t,r),deleteAccount:()=>e.deleteAccount(),changePassword:(t,r)=>e.changePassword(t,r),updateProfile:t=>e.updateProfile(t),updateEmail:(t,r,i,o,n)=>e.updateEmail(t,r,i,o,n),confirmEmailUpdate:t=>e.confirmEmailUpdate(t),consumePendingAction:()=>e.consumePendingAction(),peekPendingAction:()=>e.peekPendingAction(),clearPendingAction:()=>e.clearPendingAction(),getSocialProfile:()=>e.getSocialProfile(),signIn:(t,r)=>e.signIn(t,r),signUp:t=>e.signUp(t),confirmSignUp:(t,r)=>e.confirmSignUp(t,r),resendSignUpCode:t=>e.resendSignUpCode(t),validateUser:t=>e.validateUser(t),forgotPassword:(t,r)=>e.forgotPassword(t,r),confirmForgotPassword:(t,r,i,o)=>e.confirmForgotPassword(t,r,i,o),completeAuth:t=>e.completeAuth(t)}),[e]),o=(0,B.useMemo)(()=>({user:r.user,isLoaded:r.isLoaded,isSignedIn:r.isSignedIn,...i}),[r.user,r.isLoaded,r.isSignedIn,i]);return(0,V.jsx)(q.Provider,{value:e,children:(0,V.jsx)(G.Provider,{value:o,children:t})})},"useAuth",0,H,"useAuthSessionInternal",0,K],244972),e.s(["useUser",0,function(){let{user:e,isLoaded:t,isSignedIn:r}=H();return{user:e,isLoaded:t,isSignedIn:r}}],317138);let z={step:"IDLE",identifier:null,error:null};function $(e,t){if("RESET"===t.type)return z;switch(e.step){case"IDLE":if("SUBMIT_EMAIL"===t.type)return{step:"LOOKING_UP_EMAIL",identifier:t.identifier};return e;case"LOOKING_UP_EMAIL":switch(t.type){case"EMAIL_LOOKUP_OK":{let r={firstName:t.clientApp.firstName,authMethods:t.clientApp.authMethods};switch(t.cognitoCode){case"UserNotConfirmedException":return{step:"UNCONFIRMED",identifier:e.identifier,error:null};case"PasswordResetRequiredException":return{step:"RESET_REQUIRED",identifier:e.identifier,userData:r,error:null};case"AccountReady":return t.clientApp.exists&&t.clientApp.authMethods.length>0?{step:"ACCOUNT_READY",identifier:e.identifier,userData:r,error:null}:{step:"USER_NOT_FOUND",identifier:e.identifier,userData:r};default:return{step:"USER_NOT_FOUND",identifier:e.identifier,userData:r}}}case"EMAIL_LOOKUP_FAIL":return{step:"IDLE",identifier:e.identifier,error:t.error};case"BACK":return{step:"IDLE",identifier:e.identifier,error:null};default:return e}case"ACCOUNT_READY":switch(t.type){case"SUBMIT_EMAIL":return{step:"LOOKING_UP_EMAIL",identifier:t.identifier};case"SUBMIT_PASSWORD":return{step:"SIGNING_IN",identifier:e.identifier,userData:e.userData};case"SUBMIT_RESET_PASSWORD":return{step:"SENDING_RESET_CODE",identifier:e.identifier,userData:e.userData,pendingNewPassword:t.password};case"BACK":return{step:"IDLE",identifier:e.identifier,error:null};default:return e}case"USER_NOT_FOUND":switch(t.type){case"SUBMIT_EMAIL":return{step:"LOOKING_UP_EMAIL",identifier:t.identifier};case"BACK":return{step:"IDLE",identifier:e.identifier,error:null};default:return e}case"UNCONFIRMED":switch(t.type){case"SUBMIT_EMAIL":return{step:"LOOKING_UP_EMAIL",identifier:t.identifier};case"SUBMIT_VERIFICATION":return{step:"VERIFYING_SIGN_UP",identifier:e.identifier};case"RESEND_CODE_FAIL":return{...e,error:t.error};default:return e}case"RESET_REQUIRED":switch(t.type){case"SUBMIT_EMAIL":return{step:"LOOKING_UP_EMAIL",identifier:t.identifier};case"SUBMIT_RESET_PASSWORD":return{step:"SENDING_RESET_CODE",identifier:e.identifier,userData:e.userData,pendingNewPassword:t.password};case"BACK":return{step:"IDLE",identifier:e.identifier,error:null};default:return e}case"SIGNING_IN":switch(t.type){case"SIGN_IN_OK":case"SIGN_IN_NEEDS_PHONE":return{step:"COMPLETE"};case"SIGN_IN_FAIL":switch(t.stepOverride){case"UNCONFIRMED":return{step:"UNCONFIRMED",identifier:e.identifier,error:null};case"RESET_REQUIRED":return{step:"RESET_REQUIRED",identifier:e.identifier,userData:e.userData,error:null};default:return{step:"ACCOUNT_READY",identifier:e.identifier,userData:e.userData,error:t.error}}case"BACK":return{step:"IDLE",identifier:e.identifier,error:null};default:return e}case"SENDING_RESET_CODE":switch(t.type){case"RESET_CODE_OK":return{step:"RESET_CODE_SENT",identifier:e.identifier,pendingNewPassword:e.pendingNewPassword,error:null};case"RESET_CODE_FAIL":return{step:"RESET_REQUIRED",identifier:e.identifier,userData:e.userData,error:t.error};case"BACK":return{step:"IDLE",identifier:e.identifier,error:null};default:return e}case"RESET_CODE_SENT":switch(t.type){case"SUBMIT_VERIFICATION":return{step:"VERIFYING_RESET",identifier:e.identifier,pendingNewPassword:e.pendingNewPassword};case"RESEND_CODE_FAIL":return{...e,error:t.error};default:return e}case"VERIFYING_SIGN_UP":switch(t.type){case"VERIFICATION_OK":return{step:"COMPLETE"};case"SIGN_UP_CONFIRMED":return{step:"ACCOUNT_READY",identifier:e.identifier,userData:{authMethods:["password"]},error:null};case"VERIFICATION_FAIL":return{step:"UNCONFIRMED",identifier:e.identifier,error:t.error};default:return e}case"VERIFYING_RESET":switch(t.type){case"VERIFICATION_OK":case"SIGN_IN_NEEDS_PHONE":return{step:"COMPLETE"};case"VERIFICATION_FAIL":return{step:"RESET_CODE_SENT",identifier:e.identifier,pendingNewPassword:e.pendingNewPassword,error:t.error};default:return e}case"COMPLETE":if("BACK"===t.type)return z;return e;default:return e}}function j(e,t="Something went wrong"){if(!e)return t;if(e instanceof Error)return e.message;if("string"==typeof e)return e;if("object"==typeof e&&null!==e){if(Array.isArray(e.errors)&&e.errors.length>0)return e.errors.map(e=>e.message||e.title||t).join(", ");
3if("string"==typeof e.message)return e.message}return t}e.s(["extractErrorMessage",0,j],893065);let Y={SUBMIT_EMAIL:async function(e,t,r,i){if("SUBMIT_EMAIL"!==e.type)return;let{identifier:o}=e;try{let[e,t]=await Promise.all([i.service.checkClientAppUser(o),i.service.checkCognitoUser(o)]);"UserNotConfirmedException"===t&&i.service.resendSignUpCode(o).catch(e=>{i.observability.dispatch({type:"resend_code_failure",error:e,email:o})}),r({type:"EMAIL_LOOKUP_OK",cognitoCode:t,clientApp:e})}catch(e){i.observability.dispatch({type:"email_lookup_failure",error:e}),r({type:"EMAIL_LOOKUP_FAIL",error:ee(e)})}},SUBMIT_PASSWORD:async function(e,t,r,i){if("SUBMIT_PASSWORD"!==e.type)return;let o=Z(t);if(o)try{let t=await i.service.signIn(o,e.password);if("needsPhone"in t&&t.needsPhone)return void X(r,i);if(!t.user)throw Error("Sign-in succeeded but no session was returned. Please try again.");i.session.completeAuth(t.user),i.observability.dispatch({type:"signin_success"}),i.eventBus.emit({type:"email_sign_in_complete",user:t.user}),r({type:"SIGN_IN_OK",user:t.user})}catch(s){var n;let e;i.observability.dispatch({type:"signin_failure",error:s});let t=(n=s,"UserNotConfirmedException"===(e=n?.name)?"UNCONFIRMED":"PasswordResetRequiredException"===e?"RESET_REQUIRED":null);"UNCONFIRMED"===t&&i.service.resendSignUpCode(o).catch(e=>{i.observability.dispatch({type:"resend_code_failure",error:e,email:o})}),r({type:"SIGN_IN_FAIL",stepOverride:t??void 0,error:ee(s)})}},SUBMIT_RESET_PASSWORD:async function(e,t,r,i){if("SUBMIT_RESET_PASSWORD"!==e.type)return;let o=Z(t);if(o)try{let e=await i.service.forgotPassword(o,"");if(e.error){i.observability.dispatch({type:"signin_failure",error:Error(e.error)}),r({type:"RESET_CODE_FAIL",error:e.error});return}r({type:"RESET_CODE_OK"})}catch(e){i.observability.dispatch({type:"signin_failure",error:e}),r({type:"RESET_CODE_FAIL",error:ee(e)})}},SUBMIT_VERIFICATION:async function(e,t,r,i){if("SUBMIT_VERIFICATION"!==e.type)return;let o=Z(t);if(o)try{"UNCONFIRMED"===t.step?await J(o,e.code,r,i):"RESET_CODE_SENT"===t.step&&await Q(o,e.code,t.pendingNewPassword,r,i)}catch(e){i.observability.dispatch({type:"signin_failure",error:e}),r({type:"VERIFICATION_FAIL",error:ee(e,"Verification failed.")})}},RESEND_CODE:async function(e,t,r,i){if("RESEND_CODE"!==e.type)return;let o=Z(t);if(o)try{await i.service.resendSignUpCode(o),r({type:"RESEND_CODE_OK"})}catch(e){i.observability.dispatch({type:"resend_code_failure",error:e,email:o}),r({type:"RESEND_CODE_FAIL",error:ee(e,"Failed to resend code.")})}}};async function J(e,t,r,i){let o=await i.service.confirmSignUp(e,t);"user"in o&&o.user?(i.session.completeAuth(o.user),i.observability.dispatch({type:"signin_success"}),r({type:"VERIFICATION_OK",user:o.user})):r({type:"SIGN_UP_CONFIRMED"})}async function Q(e,t,r,i,o){let n=await o.service.confirmForgotPassword(e,t,r,"");if(n.error)throw Error(n.error);let s=await o.service.signIn(e,r);if("needsPhone"in s&&s.needsPhone)return void X(i,o);if(!s.user)throw Error("Password reset succeeded but sign-in failed. Please try signing in again.");o.session.completeAuth(s.user),o.observability.dispatch({type:"signin_success"}),o.eventBus.emit({type:"migrated_reset_complete",user:s.user}),i({type:"VERIFICATION_OK",user:s.user})}function X(e,t){t.eventBus.emit({type:"needs_phone"}),e({type:"SIGN_IN_NEEDS_PHONE",user:null})}function Z(e){return"identifier"in e?e.identifier:null}function ee(e,t="Something went wrong."){return j(e,t)}function et(e,t){let r=t instanceof Error?t.message:"Something went wrong.";switch(e.type){case"SUBMIT_EMAIL":return{type:"EMAIL_LOOKUP_FAIL",error:r};case"SUBMIT_PASSWORD":return{type:"SIGN_IN_FAIL",error:r};case"SUBMIT_RESET_PASSWORD":return{type:"RESET_CODE_FAIL",error:r};case"SUBMIT_VERIFICATION":return{type:"VERIFICATION_FAIL",error:r};case"RESEND_CODE":return{type:"RESEND_CODE_FAIL",error:r};default:return{type:"RESET"}}}e.s(["useSignIn",0,function(){let e=K(),[t,r]=W((0,B.useMemo)(()=>({reducer:$,initialState:z,effects:Y,deriveFailure:et,deps:{service:e.internals.service,observability:e.internals.observability,eventBus:e.internals.eventBus,session:e}}),[e]));return{state:t,isLoading:function(e){switch(e.step){case"LOOKING_UP_EMAIL":case"SIGNING_IN":case"SENDING_RESET_CODE":case"VERIFYING_SIGN_UP":case"VERIFYING_RESET":return!0;default:return!1}}(t),dispatch:r,status:t.step,identifier:"identifier"in t?t.identifier:null,error:"error"in t?t.error:null,userData:"userData"in t?t.userData:null,create:e=>r({type:"SUBMIT_EMAIL",identifier:e.identifier}),attemptFirstFactor:e=>{"password"===e.strategy?r({type:"SUBMIT_PASSWORD",password:e.password}):r({type:"SUBMIT_RESET_PASSWORD",password:e.password})},attemptVerification:e=>r({type:"SUBMIT_VERIFICATION",code:e.code}),back:()=>r({type:"BACK"}),reset:()=>r({type:"RESET"})}}],785589);let er={SUBMIT_REGISTRATION:async function(e,t,r,i){"SUBMIT_REGISTRATION"===e.type&&await ei(e.params,e.params.newsletter,r,i)},SUBMIT_CONSENT:async function(e,t,r,i){if("SUBMIT_CONSENT"!==e.type||"CONSENT_REQUIRED"!==t.step)return;if(i.config.captureConsent)try{await i.config.captureConsent({firstName:t.pendingProps.firstName,lastName:t.pendingProps.lastName,email:t.email,phone:t.pendingProps.homePhone??""})}catch(e){i.observability.dispatch({type:"register_failure",error:e}),r({type:"CONSENT_FAIL",error:eo(e,"Unable to save your consent. Please try again.")});return}let o={...t.pendingProps,newsletter:e.newsletterConsent};await ei(o,e.newsletterConsent,r,i)},SUBMIT_VERIFICATION:async function(e,t,r,i){if("SUBMIT_VERIFICATION"===e.type&&"AWAITING_VERIFICATION"===t.step)try{let o=await i.service.confirmSignUp(t.email,e.code);
3if("status"in o&&o.status===v.RequiresEmailVerification)return void r({type:"VERIFICATION_FAIL",error:"Confirmation failed. Please try again."});if("user"in o&&o.user){i.session.completeAuth(o.user),i.observability.dispatch({type:"register_success"}),i.eventBus.emit({type:"sign_up_complete",user:o.user,newsletterConsent:t.pendingProps?.newsletter}),r({type:"VERIFICATION_OK",user:o.user});return}r({type:"VERIFICATION_NEEDS_SIGN_IN"})}catch(e){i.observability.dispatch({type:"register_failure",error:e}),r({type:"VERIFICATION_FAIL",error:eo(e,"Verification failed.")})}},SUBMIT_PHONE:async function(e,t,r,i){if("SUBMIT_PHONE"===e.type)try{let t=i.session.getSnapshot().user?.id??"",o=await i.service.submitPhone(t,e.phone);o&&"user"in o&&o.user?(i.session.completeAuth(o.user),r({type:"PHONE_OK",user:o.user})):(i.session.clearPendingAction(),r({type:"PHONE_OK",user:null}))}catch(e){i.observability.dispatch({type:"register_failure",error:e}),r({type:"PHONE_FAIL",error:eo(e)})}},RESEND_CODE:async function(e,t,r,i){if("RESEND_CODE"!==e.type)return;let o="email"in t?t.email:null;if(o)try{await i.service.resendSignUpCode(o),r({type:"RESEND_CODE_OK"})}catch(e){i.observability.dispatch({type:"register_failure",error:e}),r({type:"RESEND_CODE_FAIL",error:eo(e,"Failed to resend code.")})}}};async function ei(e,t,r,i){try{var o;let n=await i.service.signUp({email:(o=e).emailAddress,password:o.password,firstName:o.firstName,lastName:o.lastName,homePhone:o.homePhone,newsletter:o.newsletter,privacyTerms:o.privacyTerms,signupUrl:o.signupUrl,userCountry:o.userCountry,theme:o.theme});if(n.status===v.RequiresEmailVerification)return void r({type:"SIGN_UP_NEEDS_VERIFICATION"});if(n.status===v.Confirmed&&n.user){i.session.completeAuth(n.user),i.observability.dispatch({type:"register_success"}),i.eventBus.emit({type:"sign_up_complete",user:n.user,newsletterConsent:t}),r({type:"SIGN_UP_OK",user:n.user});return}r({type:"SIGN_UP_INCOMPLETE"})}catch(e){i.observability.dispatch({type:"register_failure",error:e}),r({type:"SIGN_UP_FAIL",error:eo(e,"Something went wrong. Please try again.")})}}function eo(e,t="Something went wrong."){return j(e,t)}let en={step:"IDLE",email:null,pendingFields:null,error:null};function es(e){let{password:t,...r}=e;return r}function ea(e,t){if("RESET"===t.type)return en;switch(e.step){case"IDLE":if("SUBMIT_REGISTRATION"===t.type)return{step:"REGISTERING",email:t.params.emailAddress,pendingFields:es(t.params),pendingProps:t.params};return e;case"CONSENT_REQUIRED":switch(t.type){case"SUBMIT_CONSENT":return{step:"REGISTERING_AFTER_CONSENT",email:e.email,pendingFields:e.pendingFields,pendingProps:{...e.pendingProps,newsletter:t.newsletterConsent}};case"BACK":return{step:"IDLE",email:e.email,pendingFields:e.pendingFields,error:null};default:return e}case"REGISTERING":switch(t.type){case"SIGN_UP_OK":return{step:"COMPLETE",email:e.email};case"SIGN_UP_NEEDS_VERIFICATION":return{step:"AWAITING_VERIFICATION",email:e.email,pendingFields:e.pendingFields,pendingProps:e.pendingProps,error:null};case"SIGN_UP_INCOMPLETE":return{step:"IDLE",email:e.email,pendingFields:e.pendingFields,error:"Registration completed but auto-sign-in failed. Please sign in."};case"SIGN_UP_FAIL":return{step:"IDLE",email:e.email,pendingFields:e.pendingFields,error:t.error};case"BACK":return{step:"IDLE",email:e.email,pendingFields:null,error:null};default:return e}case"REGISTERING_AFTER_CONSENT":switch(t.type){case"SIGN_UP_OK":return{step:"COMPLETE",email:e.email};case"SIGN_UP_NEEDS_VERIFICATION":return{step:"AWAITING_VERIFICATION",email:e.email,pendingFields:e.pendingFields,pendingProps:e.pendingProps,error:null};case"SIGN_UP_INCOMPLETE":return{step:"IDLE",email:e.email,pendingFields:e.pendingFields,error:"Registration completed but auto-sign-in failed. Please sign in."};case"SIGN_UP_FAIL":return{step:"IDLE",email:e.email,pendingFields:e.pendingFields,error:t.error};case"CONSENT_FAIL":return{step:"CONSENT_REQUIRED",email:e.email,pendingFields:e.pendingFields,pendingProps:e.pendingProps,requiredFields:[{key:"consent",label:"Privacy & Terms"}],error:t.error};case"BACK":return{step:"IDLE",email:e.email,pendingFields:null,error:null};default:return e}case"AWAITING_VERIFICATION":switch(t.type){case"SUBMIT_VERIFICATION":return{step:"VERIFYING",email:e.email,pendingProps:e.pendingProps};case"RESEND_CODE_FAIL":return{...e,error:t.error};default:return e}case"VERIFYING":switch(t.type){case"VERIFICATION_OK":return{step:"COMPLETE",email:e.email};case"VERIFICATION_NEEDS_SIGN_IN":return{step:"SIGN_IN_REQUIRED",email:e.email,error:null};case"VERIFICATION_FAIL":return{step:"AWAITING_VERIFICATION",email:e.email,pendingFields:es(e.pendingProps),pendingProps:e.pendingProps,error:t.error};default:return e}case"COMPLETE":switch(t.type){case"SUBMIT_PHONE":return{step:"SUBMITTING_PHONE",email:e.email};case"BACK":return{step:"IDLE",email:e.email,pendingFields:null,error:null};default:return e}case"SUBMITTING_PHONE":switch(t.type){case"PHONE_OK":return{step:"COMPLETE",email:e.email};case"PHONE_FAIL":return{step:"SIGN_IN_REQUIRED",email:e.email,error:t.error};case"BACK":return{step:"IDLE",email:e.email,pendingFields:null,error:null};default:return e}case"SIGN_IN_REQUIRED":switch(t.type){case"SUBMIT_REGISTRATION":return{step:"REGISTERING",email:t.params.emailAddress,pendingFields:es(t.params),pendingProps:t.params};case"BACK":return{step:"IDLE",email:e.email,pendingFields:null,error:null};default:return e}default:return e}}function ec(e,t){return"SUBMIT_REGISTRATION"===t.type&&("IDLE"===e.step||"SIGN_IN_REQUIRED"===e.step)?{step:"CONSENT_REQUIRED",email:t.params.emailAddress,pendingFields:es(t.params),pendingProps:t.params,requiredFields:[{key:"consent",label:"Privacy & Terms"}],error:null}:ea(e,t)}let el={...er,SUBMIT_REGISTRATION:void 0};function eu(e,t){let r=t instanceof Error?t.message:"Something went wrong.";switch(e.type){case"SUBMIT_REGISTRATION":return{type:"SIGN_UP_FAIL",error:r};case"SUBMIT_CONSENT":return{type:"CONSENT_FAIL",error:r};case"SUBMIT_VERIFICATION":return{type:"VERIFICATION_FAIL",error:r};case"SUBMIT_PHONE":return{type:"PHONE_FAIL",error:r};case"RESEND_CODE":return{type:"RESEND_CODE_FAIL",error:r};default:return{type:"RESET"}}}e.s(["useSignUp",0,function(e){let t=K(),r=(0,B.useRef)(e);r.current=e;let[i,o]=W((0,B.useMemo)(()=>{let e={get consentRequired(){return r.current?.consentRequired},captureConsent:e=>r.current?.captureConsent?.(e)??Promise.resolve()};return{reducer:e.consentRequired?ec:ea,initialState:en,effects:e.consentRequired?el:er,deriveFailure:eu,deps:{service:t.internals.service,observability:t.internals.observability,eventBus:t.internals.eventBus,session:t,config:e}}},[t]));
3return{state:i,isLoading:function(e){switch(e.step){case"REGISTERING":case"REGISTERING_AFTER_CONSENT":case"VERIFYING":case"SUBMITTING_PHONE":return!0;default:return!1}}(i),dispatch:o,status:i.step,email:"email"in i?i.email:null,error:"error"in i?i.error:null,pendingFields:"pendingFields"in i?i.pendingFields:null,requiredFields:"requiredFields"in i?i.requiredFields:[],create:e=>o({type:"SUBMIT_REGISTRATION",params:e}),attemptVerification:e=>o({type:"SUBMIT_VERIFICATION",code:e.code}),submitRequiredFields:e=>{void 0!==e.consent?o({type:"SUBMIT_CONSENT",newsletterConsent:e.consent}):e.phone&&o({type:"SUBMIT_PHONE",phone:e.phone})},resendVerificationCode:()=>o({type:"RESEND_CODE"}),back:()=>o({type:"BACK"}),reset:()=>o({type:"RESET"})}}],950917),e.s(["useSessionGuard",0,function(){let{isSignedIn:e,supportedFeatures:t,refreshSession:r}=H(),i=(0,B.useRef)(null),o=t.requiresSessionGuard&&e;(0,B.useEffect)(()=>{if(!o){i.current&&(clearInterval(i.current),i.current=null);return}return r(),i.current=setInterval(()=>{r()},9e5),()=>{i.current&&(clearInterval(i.current),i.current=null)}},[o,r])}],736619),e.s(["useAuthEvent",0,function(e,t){let r=K(),i=(0,B.useRef)(t);i.current=t,(0,B.useEffect)(()=>r.internals.eventBus.on(e,e=>i.current(e)),[r,e])}],627592);let ed="user";function ep(e){return{id:e.id,firstName:e.firstName??e["first-name"],lastName:e.lastName??e["last-name"],homePhone:e.homePhone??e["home-phone"]??"",email:e.email,jwt:e.jwt,newsletter:e.newsletter,ssoProvider:e.ssoProvider??e["sso-provider"]??null,hasPassword:e.hasPassword??e["has-password"],hideImagelessListings:e.hideImagelessListings??e["hide-imageless-listings"]??!1,locale:e.locale??""}}e.s(["CookieSessionPersistence",0,class{cookies;cookieOptions;constructor(e,t){this.cookies=e,this.cookieOptions={expires:183,secure:t,sameSite:"lax"}}dispatch(e){switch(e.type){case"SAVE_USER":this.cookies.set(ed,JSON.stringify(e.user),this.cookieOptions);break;case"SAVE_JWT":this.cookies.set("jwt",e.jwt,this.cookieOptions);break;case"CLEAR":this.cookies.remove(ed),this.cookies.remove("jwt")}}loadUser(){let e=this.cookies.get(ed);if(!e)return null;try{let t=ep(JSON.parse(e));if(!t.jwt){let e=this.cookies.get("jwt");e&&(t.jwt=e)}return t}catch{return null}}},"deserializeUser",0,ep],65988);let eh="auth:pendingError",eg="auth:needsPhone",ef="auth:socialPending",eE="auth:socialProfile",em="auth:pendingUser";e.s(["SessionStorageAdapter",0,class{dispatch(e){switch(e.type){case"SET_PENDING_ERROR":this.write(eh,JSON.stringify(e.error));break;case"CLEAR_PENDING_ERROR":this.remove(eh);break;case"SET_NEEDS_PHONE":this.write(eg,"1");break;case"CLEAR_NEEDS_PHONE":this.remove(eg);break;case"SET_SOCIAL_PENDING":this.writeLocal(ef,JSON.stringify(e.state));break;case"CLEAR_SOCIAL_PENDING":this.removeLocal(ef);break;case"SET_SOCIAL_PROFILE":this.writeLocal(eE,JSON.stringify(e.profile));break;case"CLEAR_SOCIAL_PROFILE":this.removeLocal(eE);break;case"SET_PENDING_AUTH":this.writeLocal(em,JSON.stringify(e.user));break;case"CLEAR_PENDING_AUTH":this.removeLocal(em);break;case"CLEAR_ALL":this.remove(eh),this.remove(eg),this.removeLocal(ef),this.removeLocal(eE),this.removeLocal(em)}}getPendingError(){let e=this.read(eh);if(!e)return null;try{return JSON.parse(e)}catch(e){return console.warn("[auth] SessionStorageAdapter: failed to parse pending error",e),null}}getNeedsPhone(){return"1"===this.read(eg)}getSocialPending(){let e=this.readLocal(ef);if(!e)return null;try{return JSON.parse(e)}catch(e){return console.warn("[auth] SessionStorageAdapter: failed to parse social pending state",e),null}}getSocialProfile(){let e=this.readLocal(eE);if(!e)return null;try{return JSON.parse(e)}catch(e){return console.warn("[auth] SessionStorageAdapter: failed to parse social profile",e),null}}getPendingAuth(){let e=this.readLocal(em);if(!e)return null;try{return JSON.parse(e)}catch(e){return console.warn("[auth] SessionStorageAdapter: failed to parse pending auth",e),null}}read(e){try{return sessionStorage.getItem(e)}catch(e){return console.warn("[auth] SessionStorageAdapter: getItem failed",e),null}}write(e,t){try{sessionStorage.setItem(e,t)}catch(e){console.warn("[auth] SessionStorageAdapter: setItem failed",e)}}remove(e){try{sessionStorage.removeItem(e)}catch(e){console.warn("[auth] SessionStorageAdapter: removeItem failed",e)}}readLocal(e){try{return localStorage.getItem(e)}catch(e){return console.warn("[auth] SessionStorageAdapter: localStorage.getItem failed",e),null}}writeLocal(e,t){try{localStorage.setItem(e,t)}catch(e){console.warn("[auth] SessionStorageAdapter: localStorage.setItem failed",e)}}removeLocal(e){try{localStorage.removeItem(e)}catch(e){console.warn("[auth] SessionStorageAdapter: localStorage.removeItem failed",e)}}}],839616);class ey{log(e,t){console.debug(`%c[auth]%c ${e}`,"color: #00a8e8; font-weight: bold","color: inherit",t??"")}}class eS{log(){}}function eA(e){return e?new ey:new eS}e.s(["createAuthLogger",0,eA],427167);class eI{handlers=new Map;debug=!1;enableDebug(){this.debug=!0}on(e,t){let r=this.handlers.get(e);return r||(r=new Set,this.handlers.set(e,r)),r.add(t),()=>{r.delete(t)}}emit(e){this.debug&&console.debug(`%c[auth:event]%c ${e.type}`,"color: #7c3aed; font-weight: bold","color: inherit",e);let t=this.handlers.get(e.type);if(t&&0!==t.size)for(let r of t)try{r(e)}catch(t){console.error(`[auth:event] subscriber error for "${e.type}":`,t)}}}let ev={dispatch:()=>{}},ew={user:null,isLoaded:!1,isSignedIn:!1};function eC(e){if(!e)return null;try{let t=new URL(e,window.location.origin);if(t.origin!==window.location.origin)return null;let r=`${t.pathname}${t.search}${t.hash}`;
3if(!r.startsWith("/")||r.startsWith("//"))return null;return r}catch(e){return console.warn("[auth] sanitizeReturnTo: failed to parse URL",e),null}}function e_(e,t){let r,i=eC(e);i?t(i):window.location.pathname.startsWith("/auth/")?t("/"):((r=new URL(window.location.href)).searchParams.delete("code"),r.searchParams.delete("state"),r.searchParams.delete("error"),r.searchParams.delete("error_description"),window.history.replaceState(null,"",`${r.pathname}${r.search||""}${r.hash}`))}function eP(e,t,r){r.persistence.dispatch({type:"SAVE_USER",user:e}),e.jwt&&r.persistence.dispatch({type:"SAVE_JWT",jwt:e.jwt}),r.sessionStore.dispatch({type:"CLEAR_PENDING_ERROR"}),r.sessionStore.dispatch({type:"CLEAR_NEEDS_PHONE"}),r.sessionStore.dispatch({type:"CLEAR_SOCIAL_PROFILE"}),r.sessionStore.dispatch({type:"CLEAR_PENDING_AUTH"}),t({type:"AUTH_COMPLETE",user:e})}async function eR(e,t,r){let i=r.sessionStore.getPendingAuth();if(i){r.sessionStore.dispatch({type:"CLEAR_PENDING_AUTH"}),eP(i,t,r);return}e?await eT(e,t,r):t({type:"SESSION_LOADED",user:r.persistence.loadUser()})}async function eT(e,t,r){try{let e=await r.service.refreshSession();if(e?.user){r.persistence.dispatch({type:"SAVE_USER",user:e.user}),e.user.jwt&&r.persistence.dispatch({type:"SAVE_JWT",jwt:e.user.jwt}),t({type:"SESSION_LOADED",user:e.user});return}}catch(i){if(r.observability.dispatch({type:"bootstrap_failure",error:i}),!r.service.supportedFeatures.requiresSessionGuard)return void t({type:"SESSION_LOADED",user:e})}r.persistence.dispatch({type:"CLEAR"}),r.sessionStore.dispatch({type:"CLEAR_PENDING_ERROR"}),r.sessionStore.dispatch({type:"CLEAR_NEEDS_PHONE"}),r.sessionStore.dispatch({type:"CLEAR_SOCIAL_PROFILE"}),t({type:"SESSION_CLEARED"})}function eN(e,t,r){r.persistence.dispatch({type:"SAVE_USER",user:e}),e.jwt&&r.persistence.dispatch({type:"SAVE_JWT",jwt:e.jwt}),t({type:"USER_UPDATED",user:e})}async function eb(e,t,r){try{await r.service.signOut(e??window.location.href)}catch(e){r.observability.dispatch({type:"signout_failure",error:e}),r.logger.log(N.SignOutError,{error:e})}r.persistence.dispatch({type:"CLEAR"}),r.sessionStore.dispatch({type:"CLEAR_PENDING_ERROR"}),r.sessionStore.dispatch({type:"CLEAR_NEEDS_PHONE"}),r.sessionStore.dispatch({type:"CLEAR_SOCIAL_PROFILE"}),t({type:"SESSION_CLEARED"})}async function eU(e,t){try{let r=await t.service.refreshSession();if(r&&"needsPhone"in r&&r.needsPhone)return void t.observability.dispatch({type:"session_refresh_success"});if(r?.user){t.observability.dispatch({type:"session_refresh_success"}),eP(r.user,e,t);return}t.persistence.dispatch({type:"CLEAR"}),e({type:"SESSION_CLEARED"})}catch(r){t.observability.dispatch({type:"session_failure",error:r}),t.persistence.dispatch({type:"CLEAR"}),e({type:"SESSION_CLEARED"})}}class ex{getDeps;dispatch;getUser;constructor(e,t,r){this.getDeps=e,this.dispatch=t,this.getUser=r}async submitPhone(e,t){let r=this.getDeps(),i=this.getUser(),o=i?.id??"";try{let n=await r.service.submitPhone(o,e,t);if(n&&"user"in n&&n.user)return r.observability.dispatch({type:"submit_phone_success"}),this.emitPhoneCollectionComplete(n.user,r),eP(n.user,this.dispatch,r),{ok:!0};if(i)return r.sessionStore.dispatch({type:"CLEAR_PENDING_ERROR"}),r.sessionStore.dispatch({type:"CLEAR_NEEDS_PHONE"}),r.observability.dispatch({type:"submit_phone_success"}),eN({...i,homePhone:e},this.dispatch,r),{ok:!0};return{ok:!1,error:"Phone submitted but session could not be established."}}catch(e){return r.observability.dispatch({type:"submit_phone_failure",error:e}),{ok:!1,error:j(e)}}}async deleteAccount(){let e=this.getDeps(),t=null;try{await e.service.deleteAccount()}catch(e){t={error:e}}return(e.persistence.dispatch({type:"CLEAR"}),e.sessionStore.dispatch({type:"CLEAR_PENDING_ERROR"}),e.sessionStore.dispatch({type:"CLEAR_NEEDS_PHONE"}),this.dispatch({type:"SESSION_CLEARED"}),t)?(e.observability.dispatch({type:"delete_account_failure",error:t.error}),{ok:!1,error:j(t.error)}):(e.observability.dispatch({type:"delete_account_success"}),{ok:!0})}async changePassword(e,t){let r=this.getDeps();try{let i=await r.service.changePassword(e,t);if(i.error)return{ok:!1,error:i.error};return r.observability.dispatch({type:"change_password_success"}),{ok:!0}}catch(e){return r.observability.dispatch({type:"change_password_failure",error:e}),{ok:!1,error:j(e)}}}async updateProfile(e){let t=this.getDeps();return this.normalizeServiceResult(t.service.updateProfile(e))}async updateEmail(e,t,r,i,o){let n=this.getDeps();return this.normalizeServiceResult(n.service.updateEmail(e,t,r,i,o))}async confirmEmailUpdate(e){let t=this.getDeps();return this.normalizeServiceResult(t.service.confirmEmailUpdate(e))}async normalizeServiceResult(e){let t=await e;return"error"in t?{ok:!1,error:t.error}:{ok:!0}
3}emitPhoneCollectionComplete(e,t){let r=t.sessionStore.getSocialPending();r?.provider&&t.eventBus.emit({type:"social_phone_collection_complete",user:e,provider:r.provider})}}class eO{getSessionStore;constructor(e){this.getSessionStore=e}consume(){let e=this.peek();return e&&this.clear(),e}peek(){let e=this.getSessionStore(),t=e?.getPendingError();return t?{type:"error",message:t.message,code:t.code}:e?.getNeedsPhone()?{type:"collect_phone"}:null}clear(){let e=this.getSessionStore();e?.dispatch({type:"CLEAR_PENDING_ERROR"}),e?.dispatch({type:"CLEAR_NEEDS_PHONE"})}}class eF{deps;callbacks;timeoutId;constructor(e,t){this.deps=e,this.callbacks=t,this.timeoutId=null}begin(e,t){let r=t??eC(`${window.location.pathname}${window.location.search}${window.location.hash}`)??"/";this.savePending(e,r,"awaiting_redirect"),this.startTimeout(e),this.deps.service.idpRedirectSignIn(e,function(e){if(e)return encodeURIComponent(e)}(r)).catch(t=>this.handleInitError(t,e))}beginViaLogout(e){this.begin(e)}hasPendingAfterLogout(){return this.readPending()?.phase==="awaiting_post_logout_redirect"}resumeAfterLogout(){let e=this.readPending();e?.phase==="awaiting_post_logout_redirect"&&(this.deps.sessionStore.dispatch({type:"CLEAR_SOCIAL_PENDING"}),this.begin(e.provider,e.returnTo))}destroy(){this.cancelTimeout()}setSocialRedirectState(e){let t=function(e){try{return eC(decodeURIComponent(e))}catch(e){return console.warn("[auth] decodeReturnTo: failed to decode return-to value",e),null}}(e);if(!t)return;let r=this.readPending();r&&this.deps.sessionStore.dispatch({type:"SET_SOCIAL_PENDING",state:{...r,returnTo:t}})}cognitoSocialSignInComplete(){let e=this.readPending();(this.deps.sessionStore.dispatch({type:"CLEAR_SOCIAL_PENDING"}),e?.provider)?this.deps.service.authenticateAfterRedirect(e.provider).then(t=>this.resolve(t,e.returnTo,e.provider,{stagePending:!0})).catch(t=>this.reject(t,e.provider)):this.deps.logger.log(R.Ignored,{event:"HUB_COMPLETE"})}legacySdkSignInComplete(e){let t=this.readPending();this.deps.sessionStore.dispatch({type:"CLEAR_SOCIAL_PENDING"}),this.deps.service.legacySocialSignIn(e).then(r=>this.resolve(r,t?.returnTo??null,e.provider,{stagePending:!1})).catch(t=>this.reject(t,e.provider))}failSocialAuth(e){this.cancelTimeout(),this.deps.sessionStore.dispatch({type:"CLEAR_SOCIAL_PENDING"}),this.callbacks.onError(F.SocialSignInFailed,e),e_(null,this.deps.replaceLocation)}handleInitError(e,t){let r=e instanceof Error?e.message:"Social sign-in failed";console.error(`[auth] Social sign-in failed to start (${t}):`,r),this.deps.observability.dispatch({type:"social_signin_failure",error:e,provider:t}),this.callbacks.onError(F.SocialSignInFailed,r),e_(null,this.deps.replaceLocation)}resolve(e,t,r,i){if(this.cancelTimeout(),e.needsPhone){e.profile&&this.deps.sessionStore.dispatch({type:"SET_SOCIAL_PROFILE",profile:e.profile}),this.deps.eventBus.emit({type:"needs_phone",provider:r}),this.callbacks.onNeedsPhone(eC(t??null));return}if(e.user){this.deps.observability.dispatch({type:"social_signin_success",provider:r}),this.deps.eventBus.emit({type:"social_sign_in_complete",user:e.user,provider:r}),i.stagePending?this.deps.sessionStore.dispatch({type:"SET_PENDING_AUTH",user:e.user}):this.callbacks.onAuthComplete(e.user),e_(t??null,this.deps.replaceLocation);return}let o=Error("Authentication returned no result. Please try again.");this.deps.observability.dispatch({type:"social_signin_failure",error:o,provider:r}),this.callbacks.onError(F.SocialSignInFailed,o.message),e_(null,this.deps.replaceLocation)}reject(e,t){this.cancelTimeout();let r=e instanceof Error?e.message:"Social sign-in failed";this.deps.observability.dispatch({type:"social_signin_failure",error:e,provider:t});let i=e instanceof Error&&e.name===O.PrivateEmailExposed?F.PrivateEmailExposed:F.SocialSignInFailed;this.callbacks.onError(i,r),this.deps.service.clearStaleSession().catch(e=>{this.deps.observability.dispatch({type:"clear_stale_session_failure",error:e})}),e_(null,this.deps.replaceLocation)}startTimeout(e){this.cancelTimeout(),this.timeoutId=setTimeout(()=>{this.timeoutId=null,this.deps.sessionStore.dispatch({type:"CLEAR_SOCIAL_PENDING"}),this.callbacks.onError(F.SocialSignInFailed,"Sign-in timed out. Please try again."),this.deps.observability.dispatch({type:"social_signin_failure",error:Error("timeout"),provider:e})},9e4)}cancelTimeout(){null!==this.timeoutId&&(clearTimeout(this.timeoutId),this.timeoutId=null)}savePending(e,t,r){this.deps.sessionStore.dispatch({type:"SET_SOCIAL_PENDING",state:{provider:e,returnTo:t,phase:r}})}readPending(){let e=this.deps.sessionStore.getSocialPending();return e?e.provider&&e.phase?e:(this.deps.logger.log(R.MalformedPendingState,{raw:e}),null):null}}class eD{listeners=new Set;deps;social;account;eventBus=new eI;pendingActions;state;cachedSnapshot;dispatchAction=e=>{this.dispatch(e)};constructor(e){e.debug&&this.eventBus.enableDebug(),this.deps=this.buildInternalDeps(e),this.social=this.buildSocialCoordinator(),this.account=new ex(()=>this.deps,this.dispatchAction,()=>this.state.user),this.pendingActions=new eO(()=>this.deps.sessionStore),this.state={user:e.ssrUser??null,loaded:!1},this.cachedSnapshot=this.buildSnapshot(),eR(e.ssrUser,this.dispatchAction,this.deps)}get internals(){return{service:this.deps.service,observability:this.deps.observability,logger:this.deps.logger,eventBus:this.eventBus}}get supportedFeatures(){return this.deps.service.supportedFeatures}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.cachedSnapshot;getServerSnapshot=()=>ew;destroy(){this.social?.destroy()}completeAuth(e){eP(e,this.dispatchAction,this.deps)}async signOut(e){await eb(e,this.dispatchAction,this.deps)}setUser(e){eN(e,this.dispatchAction,this.deps)}async refreshSession(){await eU(this.dispatchAction,this.deps)}async getSignInProvider(){return this.deps.service.getSignInProvider()}getLogoutUrl(e){return this.deps.service.getLogoutUrl(e)}signInWithSocial(e){"idp_redirect"===this.supportedFeatures.socialSignInFlow&&this.social.beginViaLogout(e)}async legacySocialSignIn(e){let t=await this.deps.service.legacySocialSignIn(e);t.user&&(this.completeAuth(t.user),t.needsPhone&&this.eventBus.emit({type:"needs_phone_post_auth",provider:e.provider}))}hasPendingAfterLogout(){return this.social.hasPendingAfterLogout()}resumeAfterLogout(){this.social.resumeAfterLogout()}failSocialAuth(e){this.social.failSocialAuth(e)}setSocialRedirectState(e){this.social.setSocialRedirectState(e)}cognitoSocialSignInComplete(){this.social.cognitoSocialSignInComplete()}legacySdkSignInComplete(e){this.social.legacySdkSignInComplete(e)}async submitPhone(e,t){return this.account.submitPhone(e,t)}async deleteAccount(){return this.account.deleteAccount()}async changePassword(e,t){return this.account.changePassword(e,t)}async updateProfile(e){return this.account.updateProfile(e)}async updateEmail(e,t,r,i,o){return this.account.updateEmail(e,t,r,i,o)}async confirmEmailUpdate(e){return this.account.confirmEmailUpdate(e)}consumePendingAction(){return this.pendingActions.consume()}peekPendingAction(){return this.pendingActions.peek()}clearPendingAction(){this.pendingActions.clear()}getSocialProfile(){return this.deps.sessionStore.getSocialProfile()}async signIn(e,t){return this.deps.service.signIn(e,t)}async signUp(e){return this.deps.service.signUp(e)}async confirmSignUp(e,t){return this.deps.service.confirmSignUp(e,t)}async resendSignUpCode(e){return this.deps.service.resendSignUpCode(e)}async validateUser(e){return this.deps.service.validateUser(e)}async forgotPassword(e,t){return this.deps.service.forgotPassword(e,t)}async confirmForgotPassword(e,t,r,i){return this.deps.service.confirmForgotPassword(e,t,r,i)}dispatch(e){this.state=function(e,t){switch(t.type){case"AUTH_COMPLETE":case"SESSION_LOADED":return{...e,user:t.user,loaded:!0};case"USER_UPDATED":return{...e,user:t.user};case"SESSION_CLEARED":return{...e,user:null,loaded:!0};default:return e}}(this.state,e);let t=this.buildSnapshot(),r=this.cachedSnapshot;this.emitSessionEvent(e),(t.user!==r.user||t.isLoaded!==r.isLoaded||t.isSignedIn!==r.isSignedIn)&&(this.cachedSnapshot=t,this.listeners.forEac
3h(e=>e()))}emitSessionEvent(e){"AUTH_COMPLETE"===e.type&&e.user&&this.eventBus.emit({type:"auth_complete",user:e.user})}buildSnapshot(){return{user:this.state.user,isLoaded:this.state.loaded,isSignedIn:null!==this.state.user}}buildInternalDeps(e){return{service:e.authService,persistence:e.persistence,sessionStore:e.sessionStore,logger:eA(e.debug??!1),observability:e.observability??ev,eventBus:this.eventBus,replaceLocation:e.restoreReturnTo?t=>{e.restoreReturnTo(t)}:e=>{window.location.assign(e)}}}buildSocialCoordinator(){return new eF({service:this.deps.service,sessionStore:this.deps.sessionStore,observability:this.deps.observability,eventBus:this.eventBus,logger:this.deps.logger,replaceLocation:this.deps.replaceLocation},{onAuthComplete:e=>this.completeAuth(e),onNeedsPhone:e=>{this.deps.sessionStore.dispatch({type:"SET_NEEDS_PHONE"}),e_(e,this.deps.replaceLocation)},onError:(e,t)=>{this.deps.sessionStore.dispatch({type:"SET_PENDING_ERROR",error:{code:e,message:t}})}})}}e.s(["createAuthSession",0,function(e){return new eD(e)}],161097);class ek extends Error{status;code;constructor(e,t,r){super(t),this.name="HttpResponseError",this.status=e,this.code=r}}function eL(e){return{async request(t,r,i,o){let n,s=e.getBaseUrl(),a={method:r,headers:{...e.getDefaultHeaders(),...o}};i&&"GET"!==r&&(a.body=JSON.stringify(i));let c=await fetch(`${s}${t}`,a);if(204===c.status)return{};try{n=await c.json()}catch{if(!c.ok)throw new ek(c.status,`Request failed with status ${c.status}`);return{}}if(!c.ok){let e=function(e){if(!e||"object"!=typeof e)return{};let t="string"==typeof e.error?e.error:void 0,r="string"==typeof e.message?e.message:t;if(r)return{message:r,code:t};if(Array.isArray(e.errors)&&e.errors.length>0){let t=e.errors[0];if("object"==typeof t&&null!==t&&"string"==typeof t.title)return{message:t.title}}return{}}(n),t=e.message??`Request failed with status ${c.status}`;throw new ek(c.status,t,e.code)}return n}}}e.s(["HttpResponseError",0,ek,"createAuthHttpClient",0,eL],210650);var eM=e.i(350461),eV=e.i(982725);function eB(){let e={"Content-Type":"application/json","X-Zoocasa-Request-Source":"zoocasa.com","X-Zoocasa-Generation":"next"},i=void 0!==eM.default?"b6a4fff2-ec71-4ced-8f6c-0e794c435ad7":void 0;i&&(e["x-zoocasa-api-key"]=i);let o=function(){try{let e=eV.default.get("user");if(e===r)return t;if(r=e,!e)return t=void 0;let i=JSON.parse(e);return t=i?.jwt}catch(e){console.warn("[auth] cookie parse failure, proceeding without auth header",e),r=void 0,t=void 0;return}}();return o&&(e.Authorization=`Bearer ${o}`),e}function eG(){let e=eB();return delete e["X-Zoocasa-Request-Source"],delete e["X-Zoocasa-Generation"],e}function eq(e,t){let r=t??e??"";return()=>"localhost"===window.location.hostname?"":r}e.s(["buildHttpClients",0,function(e){let t=eq(e.clientAppHost),r=eq(e.clientAppHost,e.authApiHost);return{httpClient:eL({getBaseUrl:t,getDefaultHeaders:eB}),cognitoHttpClient:eL({getBaseUrl:r,getDefaultHeaders:eG})}}],720510),e.s([],640080);let eH=e=>`formError:${e}`,eK={INVALID_PASSWORD:eH("invalid_password"),INVALID_PASSWORD_FORMAT:eH("invalid_password_format"),INVALID_EMAIL:eH("invalid_email"),INVALID_CODE:eH("invalid_code"),INVALID_PHONE:eH("invalid_phone"),EXPIRED_CODE:eH("expired_code"),EMAIL_TAKEN:eH("email_taken"),OTHER:eH("other"),PASSWORD_CHANGED_SUCCESS:eH("password_changed_success"),PASSWORD_RESET_EMAIL_SENT:eH("password_reset_email_sent"),RESET_TOKEN_INVALID:eH("reset_token_invalid"),INFO_CHANGED_SUCCESS:eH("info_changed_success"),VALIDATION_REQUEST_FAILED:eH("validation_request_failed"),VALIDATION_ERROR_MESSAGE:eH("validation_error_message"),ACCOUNT_CONFIRMATION_FAILED:eH("account_confirmation_failed"),ACCOUNT_DELETE_FAILED:eH("account_delete_failed"),ACCOUNT_DELETED_SUCCESS:eH("account_deleted_success"),PRIVATE_EMAIL_EXPOSED:eH("private_email_exposed")};e.s(["AUTH_LOCALE_KEYS",0,eK],544211);let eW=new Set(["User not found","User does not exist by the provided email"]);async function ez(e,t){var r,i;let o,n=new URLSearchParams;t.email&&n.set("email",t.email),t.userId&&n.set("userId",t.userId),t.provider&&n.set("provider",t.provider);try{o=await e.request(`/services/api/v4/auth/next_steps?${n.toString()}`,"GET")}catch(e){if(r=e instanceof Error?e.message:String(e),eW.has(r))return{isExisting:!1,authMethods:[],firstName:"",themeData:{}};throw e}if("error"in o){if(i=o.error,eW.has(i))return{isExisting:!1,authMethods:[],firstName:"",themeData:{}};throw Error(o.error)}return{isExisting:o.auth.length>0,authMethods:o.auth,firstName:o.firstName,themeData:o.theme}}e.s(["fetchClientAppUserStatus",0,ez],781800);let e$={canUpdateProfile:!0,canUpdateEmail:!0,canChangePassword:!0,canDeleteAccount:!1,forgotPasswordFlow:"email_link",emailChangeConfirmation:"email_link",socialSignInFlow:"sdk_token",socialProviders:["google","facebook"],requiresSessionGuard:!1};e.s(["ClientAppAuthService",0,class{http;keys;t;themeName;sessionReader;observability;supportedFeatures=e$;constructor(e){this.http=e.http,this.keys=e.keys,this.t=e.translation.t,this.themeName=e.themeName,this.sessionReader=e.sessionReader,this.observability=e.observability}async checkClientAppUser(e){let t=await this.validateUser({email:e});return{exists:t.isExisting,firstName:t.firstName,authMethods:t.authMethods}}async checkCognitoUser(e){return"AccountReady"}async signIn(e,t){try{let r=await this.http.request("/services/api/v4/auth/login","POST",{email:e,password:t});if(r.data?.attributes)return{user:ep({id:r.data.id,...r.data.attributes})};throw Error(this.t(eK.INVALID_PASSWORD,{defaultValue:"Invalid Email / Password combination."}))}catch(t){let e=t instanceof Error?t:Error(this.t(eK.INVALID_PASSWORD,{defaultValue:"Invalid Email / Password combination."}));throw this.observability?.dispatch({type:"signin_failure",error:e}),e}}async signUp(e){try{let t=await this.http.request("/services/api/v4/auth","POST",{data:{type:"users",attributes:this.keys.dasherize(e)}});if(t.errors?.length){let e=t.errors.map(({source:e,title:t})=>{let r=this.keys.camelize((e?.pointer||"").replace("/data/attributes/",""));return`${r}: ${t}`});throw Error(e.join("; "))}let r=await this.signIn(e.email,e.password);if(!r.user)throw Error(this.t(eK.OTHER,{defaultValue:"Looks like something went wrong, please try again."}));return{status:v.Confirmed,user:r.user}}catch(t){let e=t instanceof Error?t:Error(this.t(eK.OTHER,{defaultValue:"Looks like something went wrong, please try again."}));throw this.observability?.dispatch({type:"register_failure",error:e}),e}}async confirmSignUp(e,t){return{status:v.Incomplete}}async resendSignUpCode(e){}async signOut(e){try{await this.http.request("/services/api/v3/users/logout","DELETE")}catch(e){this.observability?.dispatch({type:"signout_failure",error:e})}}async validateUser(e){try{return await ez(this.http,e)}catch(t){let e=t instanceof Error?t:Error(this.t(eK.VALIDATION_REQUEST_FAILED,{defaultValue:"Request failed"}));throw this.observability?.dispatch({type:"email_lookup_failure",error:e}),e}}async idpRedirectSignIn(e,t){throw Error("idpRedirectSignIn is not supported by ClientAppAuthService. Use legacySocialSignIn instead.")}async authenticateAfterRedirect(e){throw Error("authenticateAfterRedirect is not supported in the client-app bridge. Use legacySocialSignIn instead.")}async legacySocialSignIn(e){let t={provider:e.provider,email:e.email,userId:e.userId,accessToken:e.accessToken,firstName:e.firstName,lastName:e.lastName,homePhone:e.homePhone},r=async()=>{let e=await this.http.request("/services/api/v4/auth/login","POST",t);if(e.data?.attributes)return{user:ep({id:e.data.id,...e.data.attributes})};throw Error("SSO authentication failed")};try{try{return await r()}catch(i){if(!(i instanceof ek&&i.message.toLowerCase().includes("user cannot be found")))throw i;await this.socialSignUp(e);let t=await r();if(!e.homePhone)return{user:t.user,needsPhone:!0};return t}}catch(t){throw this.observability?.dispatch({type:"signin_failure",error:t,authMethod:e.provider}),t}}async socialSignUp(e){let t=this.keys.dasherize({provider:e.provider,email:e.email,userId:e.userId,accessToken:e.accessToken,firstName:e.firstName??"",lastName:e.lastName??"",privacyTerms:!0,theme:this.themeName,...e.homePhone?{homePhone:e.homePhone}:{}}),r=await this.http.request("/services/api/v4/auth","POST",{data:{type:"users",attributes:t}});if(r.errors?.length)throw Error(r.errors.map(({source:e,title:t})=>{let r=this.keys.camelize((e?.pointer||"").replace("/data/attributes/",""));return`${r}: ${t}`}).join("; "))}async forgotPassword(e,t){try{if((await this.http.request("/services/api/v3/users/password","POST",{email:e,theme:t})).error){let e=this.t(eK.INVALID_EMAIL,{defaultValue:"Invalid Email."});return this.observability?.dispatch({type:"signin_failure",error:Error(e)}),{error:e}}return{success:this.t(eK.PASSWORD_RESET_EMAIL_SENT,{defaultValue:"A message has been sent to reset your password. Please check your inbox."}),nextStep:"email_sent"}}catch(t){let e=this.t(eK.INVALID_EMAIL,{defaultValue:"Invalid Email."});return this.observability?.dispatch({type:"signin_failure",error:t}),{error:e}}}async changePassword(e,t){try{return await this.http.request("/services/api/v3/users/password","PATCH",{"current-password":e,password:t,"password-confirmation":t,theme:this.themeName}),{success:this.t(eK.PASSWORD_CHANGED_SUCCESS,{defaultValue:"Your password was changed successfully."})}}catch(e){return{error:e instanceof Error?e.message:this.t(eK.OTHER,{defaultValue:"Looks like something went wrong, please try again."})}}}async confirmForgotPassword(e,t,r,i){try{if((await this.http.request("/services/api/v3/users/password","PATCH",{password:r,passwordConfirmation:r,theme:i})).error){let e=this.t(eK.RESET_TOKEN_INVALID,{defaultValue:"Reset Password Token is invali
3d."});return this.observability?.dispatch({type:"signin_failure",error:Error(e)}),{error:e}}return{success:this.t(eK.PASSWORD_CHANGED_SUCCESS,{defaultValue:"Your password was changed successfully."})}}catch(t){let e=this.t(eK.RESET_TOKEN_INVALID,{defaultValue:"Reset Password Token is invalid."});return this.observability?.dispatch({type:"signin_failure",error:t}),{error:e}}}async confirmUser(e,t){try{let r=await this.http.request("/services/api/v3/users/confirmation","GET",{confirmationToken:e,theme:t});return{user:ep({id:r.data.id,...r.data.attributes})}}catch{throw Error(this.t(eK.ACCOUNT_CONFIRMATION_FAILED,{defaultValue:"Your account confirmation was not successful."}))}}async clearStaleSession(){}async deleteAccount(){try{await this.http.request("/services/api/v4/user/delete","DELETE")}catch(e){throw this.observability?.dispatch({type:"delete_account_failure",error:e}),e}}async submitPhone(e,t){try{await this.http.request(`/services/api/v3/users/${e}`,"PATCH",{data:{attributes:{"home-phone":t}}})}catch(e){throw this.observability?.dispatch({type:"signin_failure",error:e}),e}}async refreshSession(){let e=this.sessionReader.loadUser();return e?{user:e}:null}async getSignInProvider(){let e=this.sessionReader.loadUser(),t=e?.ssoProvider??null;return"password"===t?null:t}getLogoutUrl(e){return null}async updateProfile(e){try{return await this.http.request(`/services/api/v3/users/${e.id}`,"PATCH",{data:{attributes:this.keys.dasherize(e)}}),{success:!0}}catch(e){return{error:e instanceof Error?e.message:this.t(eK.OTHER,{defaultValue:"Looks like something went wrong, please try again."})}}}async updateEmail(e,t,r,i,o){try{let n={"current-email":e.email,email:t,"email-confirmation":r};return i&&(n.password=i),o&&(n["password-confirmation"]=o),await this.http.request("/services/api/v3/users/email","PATCH",{data:{attributes:n}}),{success:!0}}catch(e){return{error:e instanceof Error?e.message:this.t(eK.OTHER,{defaultValue:"Looks like something went wrong, please try again."})}}}async confirmEmailUpdate(e){return{error:"Email confirmation via code is not supported. Please check your email for a confirmation link."}}}],874275),e.s(["COGNITO_FEATURES",0,{canUpdateProfile:!0,canUpdateEmail:!0,canChangePassword:!0,canDeleteAccount:!0,forgotPasswordFlow:"confirm_in_app",emailChangeConfirmation:"verification_code",socialSignInFlow:"idp_redirect",socialProviders:["google","facebook","apple"],requiresSessionGuard:!0}],605486)},152492,136822,550781,741109,e=>{"use strict";(r=N||(N={})).ConcurrentModificationException="ConcurrentModificationException",r.ForbiddenException="ForbiddenException",r.InternalErrorException="InternalErrorException",r.InvalidParameterException="InvalidParameterException",r.NotAuthorizedException="NotAuthorizedException",r.ResourceNotFoundException="ResourceNotFoundException",r.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException",(i=b||(b={})).ForbiddenException="ForbiddenException",i.InternalErrorException="InternalErrorException",i.InvalidParameterException="InvalidParameterException",i.InvalidPasswordException="InvalidPasswordException",i.LimitExceededException="LimitExceededException",i.NotAuthorizedException="NotAuthorizedException",i.PasswordResetRequiredException="PasswordResetRequiredException",i.ResourceNotFoundException="ResourceNotFoundException",i.TooManyRequestsException="TooManyRequestsException",i.UserNotConfirmedException="UserNotConfirmedException",i.UserNotFoundException="UserNotFoundException",(o=U||(U={})).ForbiddenException="ForbiddenException",o.InternalErrorException="InternalErrorException",o.InvalidLambdaResponseException="InvalidLambdaResponseException",o.InvalidParameterException="InvalidParameterException",o.InvalidPasswordException="InvalidPasswordException",o.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",o.NotAuthorizedException="NotAuthorizedException",o.PasswordResetRequiredException="PasswordResetRequiredException",o.ResourceNotFoundException="ResourceNotFoundException",o.TooManyRequestsException="TooManyRequestsException",o.UsernameExistsException="UsernameExistsException",o.UserNotConfirmedException="UserNotConfirmedException",o.UserNotFoundException="UserNotFoundException",(n=x||(x={})).CodeMismatchException="CodeMismatchException",n.ExpiredCodeException="ExpiredCodeException",n.ForbiddenException="ForbiddenException",n.InternalErrorException="InternalErrorException",n.InvalidLambdaResponseException="InvalidLambdaResponseException",n.InvalidParameterException="InvalidParameterException",n.InvalidPasswordException="InvalidPasswordException",n.LimitExceededException="LimitExceededException",n.NotAuthorizedException="NotAuthorizedException",n.ResourceNotFoundException="ResourceNotFoundException",n.TooManyFailedAttemptsException="TooManyFailedAttemptsException",n.TooManyRequestsException="TooManyRequestsException",n.UnexpectedLambdaException="UnexpectedLambdaException",n.UserLambdaValidationException="UserLambdaValidationException",n.UserNotConfirmedException="UserNotConfirmedException",n.UserNotFoundException="UserNotFoundException",(s=O||(O={})).AliasExistsException="AliasExistsException",s.CodeMismatchException="CodeMismatchException",s.ExpiredCodeException="ExpiredCodeException",s.ForbiddenException="ForbiddenException",s.InternalErrorException="InternalErrorException",s.InvalidLambdaResponseException="InvalidLambdaResponseException",s.InvalidParameterException="InvalidParameterException",s.LimitExceededException="LimitExceededException",s.NotAuthorizedException="NotAuthorizedException",s.ResourceNotFoundException="ResourceNotFoundException",s.TooManyFailedAttemptsException="TooManyFailedAttemptsException",s.TooManyRequestsException="TooManyRequestsException",s.UnexpectedLambdaException="UnexpectedLambdaException",s.UserLambdaValidationException="UserLambdaValidationException",s.UserNotFoundException="UserNotFoundException",(a=F||(F={})).ForbiddenException="ForbiddenException",a.InternalErrorException="InternalErrorException",a.InvalidParameterException="InvalidParameterException",a.NotAuthorizedException="NotAuthorizedException",a.PasswordResetRequiredException="PasswordResetRequiredException",a.ResourceNotFoundException="ResourceNotFoundException",a.TooManyRequestsException="TooManyRequestsException",a.UserNotConfirmedException="UserNotConfirmedException",a.UserNotFoundException="UserNotFoundException",(c=D||(D={})).ForbiddenException="ForbiddenException",c.InternalErrorException="InternalErrorException",c.InvalidParameterException="InvalidParameterException",c.NotAuthorizedException="NotAuthorizedException",c.PasswordResetRequiredException="PasswordResetRequiredException",c.ResourceNotFoundException="ResourceNotFoundException",c.TooManyRequestsException="TooManyRequestsException",c.UserNotConfirmedException="UserNotConfirmedException",c.UserNotFoundException="UserNotFoundException",(l=k||(k={})).ForbiddenException="ForbiddenException",l.InternalErrorException="InternalErrorException",l.InvalidParameterException="InvalidParameterException",l.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",l.NotAuthorizedException="NotAuthorizedException",l.PasswordResetRequiredException="PasswordResetRequiredException",l.ResourceNotFoundException="ResourceNotFoundException",l.TooManyRequestsException="TooManyRequestsException",l.UserNotConfirmedException="UserNotConfirmedException",l.UserNotFoundException="UserNotFoundException",(u=L||(L={})).CodeDeliveryFailureException="CodeDeliveryFailureException",u.ForbiddenException="ForbiddenException",u.InternalErrorException="InternalErrorException",u.InvalidEmailRoleAccessPol
3icyException="InvalidEmailRoleAccessPolicyException",u.InvalidLambdaResponseException="InvalidLambdaResponseException",u.InvalidParameterException="InvalidParameterException",u.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",u.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",u.LimitExceededException="LimitExceededException",u.NotAuthorizedException="NotAuthorizedException",u.ResourceNotFoundException="ResourceNotFoundException",u.TooManyRequestsException="TooManyRequestsException",u.UnexpectedLambdaException="UnexpectedLambdaException",u.UserLambdaValidationException="UserLambdaValidationException",u.UserNotFoundException="UserNotFoundException",(d=M||(M={})).ForbiddenException="ForbiddenException",d.InternalErrorException="InternalErrorException",d.InvalidParameterException="InvalidParameterException",d.NotAuthorizedException="NotAuthorizedException",d.PasswordResetRequiredException="PasswordResetRequiredException",d.ResourceNotFoundException="ResourceNotFoundException",d.TooManyRequestsException="TooManyRequestsException",d.UserNotConfirmedException="UserNotConfirmedException",d.UserNotFoundException="UserNotFoundException",(p=V||(V={})).ExternalServiceException="ExternalServiceException",p.InternalErrorException="InternalErrorException",p.InvalidParameterException="InvalidParameterException",p.LimitExceededException="LimitExceededException",p.NotAuthorizedException="NotAuthorizedException",p.ResourceConflictException="ResourceConflictException",p.ResourceNotFoundException="ResourceNotFoundException",p.TooManyRequestsException="TooManyRequestsException",(h=B||(B={})).ExternalServiceException="ExternalServiceException",h.InternalErrorException="InternalErrorException",h.InvalidIdentityPoolConfigurationException="InvalidIdentityPoolConfigurationException",h.InvalidParameterException="InvalidParameterException",h.NotAuthorizedException="NotAuthorizedException",h.ResourceConflictException="ResourceConflictException",h.ResourceNotFoundException="ResourceNotFoundException",h.TooManyRequestsException="TooManyRequestsException",(g=G||(G={})).CodeDeliveryFailureException="CodeDeliveryFailureException",g.ForbiddenException="ForbiddenException",g.InternalErrorException="InternalErrorException",g.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",g.InvalidLambdaResponseException="InvalidLambdaResponseException",g.InvalidParameterException="InvalidParameterException",g.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",g.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",g.LimitExceededException="LimitExceededException",g.NotAuthorizedException="NotAuthorizedException",g.PasswordResetRequiredException="PasswordResetRequiredException",g.ResourceNotFoundException="ResourceNotFoundException",g.TooManyRequestsException="TooManyRequestsException",g.UnexpectedLambdaException="UnexpectedLambdaException",g.UserLambdaValidationException="UserLambdaValidationException",g.UserNotConfirmedException="UserNotConfirmedException",g.UserNotFoundException="UserNotFoundException",(f=q||(q={})).ForbiddenException="ForbiddenException",f.InternalErrorException="InternalErrorException",f.InvalidParameterException="InvalidParameterException",f.NotAuthorizedException="NotAuthorizedException",f.PasswordResetRequiredException="PasswordResetRequiredException",f.ResourceNotFoundException="ResourceNotFoundException",f.TooManyRequestsException="TooManyRequestsException",f.UserNotConfirmedException="UserNotConfirmedException",(E=H||(H={})).PasswordResetRequiredException="PasswordResetRequiredException",E.ForbiddenException="ForbiddenException",E.InternalErrorException="InternalErrorException",E.InvalidLambdaResponseException="InvalidLambdaResponseException",E.InvalidParameterException="InvalidParameterException",E.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",E.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",E.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",E.NotAuthorizedException="NotAuthorizedException",E.ResourceNotFoundException="ResourceNotFoundException",E.TooManyRequestsException="TooManyRequestsException",E.UnexpectedLambdaException="UnexpectedLambdaException",E.UserLambdaValidationException="UserLambdaValidationException",E.UserNotConfirmedException="UserNotConfirmedException",E.UserNotFoundException="UserNotFoundException",(m=K||(K={})).CodeDeliveryFailureException="CodeDeliveryFailureException",m.ForbiddenException="ForbiddenException",m.InternalErrorException="InternalErrorException",m.InvalidEmailRoleAccessPol
3icyException="InvalidEmailRoleAccessPolicyException",m.InvalidLambdaResponseException="InvalidLambdaResponseException",m.InvalidParameterException="InvalidParameterException",m.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",m.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",m.LimitExceededException="LimitExceededException",m.NotAuthorizedException="NotAuthorizedException",m.ResourceNotFoundException="ResourceNotFoundException",m.TooManyRequestsException="TooManyRequestsException",m.UnexpectedLambdaException="UnexpectedLambdaException",m.UserLambdaValidationException="UserLambdaValidationException",m.UserNotFoundException="UserNotFoundException",(y=W||(W={})).AliasExistsException="AliasExistsException",y.CodeMismatchException="CodeMismatchException",y.ExpiredCodeException="ExpiredCodeException",y.ForbiddenException="ForbiddenException",y.InternalErrorException="InternalErrorException",y.InvalidLambdaResponseException="InvalidLambdaResponseException",y.InvalidParameterException="InvalidParameterException",y.InvalidPasswordException="InvalidPasswordException",y.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",y.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",y.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",y.MFAMethodNotFoundException="MFAMethodNotFoundException",y.NotAuthorizedException="NotAuthorizedException",y.PasswordResetRequiredException="PasswordResetRequiredException",y.ResourceNotFoundException="ResourceNotFoundException",y.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException",y.TooManyRequestsException="TooManyRequestsException",y.UnexpectedLambdaException="UnexpectedLambdaException",y.UserLambdaValidationException="UserLambdaValidationException",y.UserNotConfirmedException="UserNotConfirmedException",y.UserNotFoundException="UserNotFoundException",(S=z||(z={})).ForbiddenException="ForbiddenException",S.InternalErrorException="InternalErrorException",S.InvalidParameterException="InvalidParameterException",S.NotAuthorizedException="NotAuthorizedException",S.PasswordResetRequiredException="PasswordResetRequiredException",S.ResourceNotFoundException="ResourceNotFoundException",S.UserNotConfirmedException="UserNotConfirmedException",S.UserNotFoundException="UserNotFoundException",(A=$||($={})).CodeDeliveryFailureException="CodeDeliveryFailureException",A.InternalErrorException="InternalErrorException",A.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",A.InvalidLambdaResponseException="InvalidLambdaResponseException",A.InvalidParameterException="InvalidParameterException",A.InvalidPasswordException="InvalidPasswordException",A.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",A.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",A.NotAuthorizedException="NotAuthorizedException",A.ResourceNotFoundException="ResourceNotFoundException",A.TooManyRequestsException="TooManyRequestsException",A.UnexpectedLambdaException="UnexpectedLambdaException",A.UserLambdaValidationException="UserLambdaValidationException",A.UsernameExistsException="UsernameExistsException",(I=j||(j={})).AliasExistsException="AliasExistsException",I.CodeDeliveryFailureException="CodeDeliveryFailureException",I.CodeMismatchException="CodeMismatchException",I.ExpiredCodeException="ExpiredCodeException",I.ForbiddenException="ForbiddenException",I.InternalErrorException="InternalErrorException",I.InvalidEmailRoleAccessPolicyException="InvalidEmailRoleAccessPolicyException",I.InvalidLambdaResponseException="InvalidLambdaResponseException",I.InvalidParameterException="InvalidParameterException",I.InvalidSmsRoleAccessPolicyException="InvalidSmsRoleAccessPolicyException",I.InvalidSmsRoleTrustRelationshipException="InvalidSmsRoleTrustRelationshipException",I.NotAuthorizedException="NotAuthorizedException",I.PasswordResetRequiredException="PasswordResetRequiredException",I.ResourceNotFoundException="ResourceNotFoundException",I.TooManyRequestsException="TooManyRequestsException",I.UnexpectedLambdaException="UnexpectedLambdaException",I.UserLambdaValidationException="UserLambdaValidationException",I.UserNotConfirmedException="UserNotConfirmedException",I.UserNotFoundException="UserNotFoundException",(v=Y||(Y={}
3)).CodeMismatchException="CodeMismatchException",v.EnableSoftwareTokenMFAException="EnableSoftwareTokenMFAException",v.ForbiddenException="ForbiddenException",v.InternalErrorException="InternalErrorException",v.InvalidParameterException="InvalidParameterException",v.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",v.NotAuthorizedException="NotAuthorizedException",v.PasswordResetRequiredException="PasswordResetRequiredException",v.ResourceNotFoundException="ResourceNotFoundException",v.SoftwareTokenMFANotFoundException="SoftwareTokenMFANotFoundException",v.TooManyRequestsException="TooManyRequestsException",v.UserNotConfirmedException="UserNotConfirmedException",v.UserNotFoundException="UserNotFoundException",(w=J||(J={})).AliasExistsException="AliasExistsException",w.CodeMismatchException="CodeMismatchException",w.ExpiredCodeException="ExpiredCodeException",w.ForbiddenException="ForbiddenException",w.InternalErrorException="InternalErrorException",w.InvalidParameterException="InvalidParameterException",w.LimitExceededException="LimitExceededException",w.NotAuthorizedException="NotAuthorizedException",w.PasswordResetRequiredException="PasswordResetRequiredException",w.ResourceNotFoundException="ResourceNotFoundException",w.TooManyRequestsException="TooManyRequestsException",w.UserNotConfirmedException="UserNotConfirmedException",w.UserNotFoundException="UserNotFoundException",(C=Q||(Q={})).ForbiddenException="ForbiddenException",C.InternalErrorException="InternalErrorException",C.InvalidParameterException="InvalidParameterException",C.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",C.NotAuthorizedException="NotAuthorizedException",C.PasswordResetRequiredException="PasswordResetRequiredException",C.ResourceNotFoundException="ResourceNotFoundException",C.TooManyRequestsException="TooManyRequestsException",C.UserNotConfirmedException="UserNotConfirmedException",C.UserNotFoundException="UserNotFoundException",(_=X||(X={})).ForbiddenException="ForbiddenException",_.InternalErrorException="InternalErrorException",_.InvalidParameterException="InvalidParameterException",_.InvalidUserPoolConfigurationException="InvalidUserPoolConfigurationException",_.NotAuthorizedException="NotAuthorizedException",_.PasswordResetRequiredException="PasswordResetRequiredException",_.ResourceNotFoundException="ResourceNotFoundException",_.TooManyRequestsException="TooManyRequestsException",_.UserNotConfirmedException="UserNotConfirmedException",_.UserNotFoundException="UserNotFoundException",e.s(["InitiateAuthException",0,H,"SignUpException",0,$],152492),(P=Z||(Z={})).EmptySignInUsername="EmptySignInUsername",P.EmptySignInPassword="EmptySignInPassword",P.CustomAuthSignInPassword="CustomAuthSignInPassword",P.EmptySignUpUsername="EmptySignUpUsername",P.EmptySignUpPassword="EmptySignUpPassword",P.EmptyConfirmSignUpUsername="EmptyConfirmSignUpUsername",P.EmptyConfirmSignUpCode="EmptyConfirmSignUpCode",P.EmptyResendSignUpCodeUsername="EmptyresendSignUpCodeUsername",P.EmptyChallengeResponse="EmptyChallengeResponse",P.EmptyConfirmResetPasswordUsername="EmptyConfirmResetPasswordUsername",P.EmptyConfirmResetPasswordNewPassword="EmptyConfirmResetPasswordNewPassword",P.EmptyConfirmResetPasswordConfirmationCode="EmptyConfirmResetPasswordConfirmationCode",P.EmptyResetPasswordUsername="EmptyResetPasswordUsername",P.EmptyVerifyTOTPSetupCode="EmptyVerifyTOTPSetupCode",P.EmptyConfirmUserAttributeCode="EmptyConfirmUserAttributeCode",P.IncorrectMFAMethod="IncorrectMFAMethod",P.EmptyUpdatePassword="EmptyUpdatePassword",P.InvalidPreferredChallenge="InvalidPreferredChallenge",e.s(["AuthValidationErrorCode",0,Z],136822);let t={[Z.EmptyChallengeResponse]:{message:"challengeResponse is required to confirmSignIn"},[Z.EmptyConfirmResetPasswordUsername]:{message:"username is required to confirmResetPassword"},[Z.EmptyConfirmSignUpCode]:{message:"code is required to confirmSignUp"},[Z.EmptyConfirmSignUpUsername]:{message:"username is required to confirmSignUp"},[Z.EmptyConfirmResetPasswordConfirmationCode]:{message:"confirmationCode is required to confirmResetPassword"},[Z.EmptyConfirmResetPasswordNewPassword]:{message:"newPassword is required to confirmResetPassword"},[Z.EmptyResendSignUpCodeUsername]:{message:"username is required to confirmSignUp"},[Z.EmptyResetPasswordUsername]:{message:"username is required to resetPassword"},[Z.EmptySignInPassword]:{message:"password is required to signIn"},[Z.EmptySignInUsername]:{message:"username is required to signIn"},[Z.EmptySignUpPassword]:{message:"password is required to signUp"},[Z.EmptySignUpUsername]:{message:"username is required to signUp"},[Z.CustomAuthSignInPassword]:{message:"A password is not needed when signing in with CUSTOM_WITHOUT_SRP",recoverySuggestion:"Do not include a password in your signIn call."},[Z.IncorrectMFAMethod]:{message:"Incorrect MFA method was chosen. It should be either SMS, TOTP, or EMAIL",recoverySuggestion:"Try to pass SMS, TOTP, or EMAIL as the challengeResponse"},[Z.EmptyVerifyTOTPSetupCode]:{message:"code is required to verifyTotpSetup"},[Z.EmptyUpdatePassword]:{message:"oldPassword and newPassword are required to changePassword"},[Z.EmptyConfirmUserAttributeCode]:{message:"confirmation code is required to confirmUserAttribute"},[Z.InvalidPreferredChallenge]:{message:"The preferred challenge is not enabled in your backend configuration",recoverySuggestion:"Ensure the authentication method is enabled in your Amplify backend configuration"}};(R=ee||(ee={}
3)).DEFAULT_MSG="Authentication Error",R.EMPTY_EMAIL="Email cannot be empty",R.EMPTY_PHONE="Phone number cannot be empty",R.EMPTY_USERNAME="Username cannot be empty",R.INVALID_USERNAME="The username should either be a string or one of the sign in types",R.EMPTY_PASSWORD="Password cannot be empty",R.EMPTY_CODE="Confirmation code cannot be empty",R.SIGN_UP_ERROR="Error creating account",R.NO_MFA="No valid MFA method provided",R.INVALID_MFA="Invalid MFA type",R.EMPTY_CHALLENGE="Challenge response cannot be empty",R.NO_USER_SESSION="Failed to get the session because the user is empty",R.NETWORK_ERROR="Network Error",R.DEVICE_CONFIG="Device tracking has not been configured in this User Pool",R.AUTOSIGNIN_ERROR="Please use your credentials to sign in",R.OAUTH_ERROR="Couldn't finish OAuth flow, check your User Pool HostedUI settings",(T=et||(et={})).SignInException="SignInException",T.OAuthSignInError="OAuthSignInException",e.s(["AuthErrorCodes",0,et,"AuthErrorStrings",0,ee,"validationErrorMap",0,t],550781);var r,i,o,n,s,a,c,l,u,d,p,h,g,f,E,m,y,S,A,I,v,w,C,_,P,R,T,N,b,U,x,O,F,D,k,L,M,V,B,G,q,H,K,W,z,$,j,Y,J,Q,X,Z,ee,et,er=e.i(555634);e.s(["assertValidationError",0,function(e,r){let{message:i,recoverySuggestion:o}=t[r];
3if(!e)throw new er.AuthError({name:r,message:i,recoverySuggestion:o})}],741109)},36861,e=>{"use strict";var t=e.i(757396),r=e.i(426377),i=e.i(565941);let o=async e=>{var t;let o=e.getConfig().Auth?.Cognito;(0,r.assertTokenProviderConfig)(o);let n=await e.Auth.getTokens({forceRefresh:!1});(0,i.assertAuthTokens)(n);let{"cognito:username":s,sub:a}=n.idToken?.payload??{},c={username:s,userId:a},l=(t=n,t?.signInDetails);return l&&(c.signInDetails=l),c},n=async()=>o(t.Amplify);e.s(["getCurrentUser",0,n],36861)},172205,e=>{"use strict";var t=e.i(726205),r=e.i(417777);e.s(["getAuthUserAgentValue",0,(e,i)=>(0,t.getAmplifyUserAgent)({category:r.Category.Auth,action:e,...i})])},709192,60156,338016,536130,e=>{"use strict";var t=e.i(420936),r=e.i(31783),i=e.i(190498),o=e.i(522488),n=e.i(774488);e.s(["createInitiateAuthClient",0,e=>(0,t.composeServiceApi)(o.cognitoUserPoolTransferHandler,(0,r.createUserPoolSerializer)("InitiateAuth"),(0,i.createUserPoolDeserializer)(),{...n.DEFAULT_SERVICE_CLIENT_API_CONFIG,...e})],709192),e.s(["createRespondToAuthChallengeClient",0,e=>(0,t.composeServiceApi)(o.cognitoUserPoolTransferHandler,(0,r.createUserPoolSerializer)("RespondToAuthChallenge"),(0,i.createUserPoolDeserializer)(),{...n.DEFAULT_SERVICE_CLIENT_API_CONFIG,...e})],60156),e.s(["createVerifySoftwareTokenClient",0,e=>(0,t.composeServiceApi)(o.cognitoUserPoolTransferHandler,(0,r.createUserPoolSerializer)("VerifySoftwareToken"),(0,i.createUserPoolDeserializer)(),{...n.DEFAULT_SERVICE_CLIENT_API_CONFIG,...e})],338016),e.s(["createAssociateSoftwareTokenClient",0,e=>(0,t.composeServiceApi)(o.cognitoUserPoolTransferHandler,(0,r.createUserPoolSerializer)("AssociateSoftwareToken"),(0,i.createUserPoolDeserializer)(),{...n.DEFAULT_SERVICE_CLIENT_API_CONFIG,...e})],536130)},230207,402524,799895,228239,508718,955374,919122,352015,856327,508640,662157,e=>{"use strict";let t,r,i,o,n;var s,a,c,l,u=e.i(757396),d=e.i(417777),p=e.i(426377),h=e.i(62242),g=e.i(555634),f=e.i(152492),E=e.i(550781),m=e.i(136822),y=e.i(741109),S=e.i(175836),A=e.i(36861),I=e.i(172205),v=e.i(709192),w=e.i(60156);e.i(338016);var C=e.i(536130),_=e.i(971532),P=e.i(973227),R=e.i(677865),T=e.i(996388);async function N(e){if(e.AccessToken){let t,r,i,o=(0,p.decodeJWT)(e.AccessToken),n=1e3*(o.payload.iat||0),s=new Date().getTime();e.RefreshToken&&(r=e.RefreshToken),e.IdToken&&(t=(0,p.decodeJWT)(e.IdToken)),e?.NewDeviceMetadata&&(i=e.NewDeviceMetadata);let a={accessToken:o,idToken:t,refreshToken:r,clockDrift:n>0?n-s:0,deviceMetadata:i,username:e.username};e?.signInDetails&&(a.signInDetails=e.signInDetails),await T.tokenOrchestrator.setTokens({tokens:a})}else throw new R.AmplifyError({message:"Invalid tokens",name:"InvalidTokens",recoverySuggestion:"Check Cognito UserPool settings"})}e.s(["cacheCognitoTokens",0,N],402524);var b=e.i(914505);let U=async()=>{try{b.Hub.dispatch("auth",{event:"signedIn",data:await (0,A.getCurrentUser)()},"Auth",b.AMPLIFY_SYMBOL)}catch(e){if(e.name===S.USER_UNAUTHENTICATED_EXCEPTION)throw new g.AuthError({name:S.UNEXPECTED_SIGN_IN_INTERRUPTION_EXCEPTION,message:"Unable to get user session following successful sign-in.",recoverySuggestion:"This most likely is due to auth tokens not being persisted. If you are using cookie store, please ensure cookies can be correctly set from your server."});throw e}};e.s(["dispatchSignedInHubEvent",0,U],799895);var x=e.i(438815);let O="CognitoSignInState",F={username:`${O}.username`,challengeName:`${O}.challengeName`,signInSession:`${O}.signInSession`,expiry:`${O}.expiry`},D=()=>{M.dispatch({type:"RESET_STATE"})},k=()=>{for(let e of Object.values(F))x.syncSessionStorage.removeItem(e)},L=()=>({username:void 0,challengeName:void 0,signInSession:void 0}),M=(o=(s=(e,t)=>{switch(t.type){case"SET_SIGN_IN_SESSION":return B({signInSession:t.value}),{...e,signInSession:t.value};case"SET_SIGN_IN_STATE":return B(t.value),{...t.value};case"SET_CHALLENGE_NAME":return B({challengeName:t.value}),{...e,challengeName:t.value};case"SET_USERNAME":return B({username:t.value}),{...e,username:t.value};case"SET_INITIAL_STATE":let r=x.syncSessionStorage.getItem(F.expiry);if(!r||Number(r)<=Date.now())return k(),L();return{username:x.syncSessionStorage.getItem(F.username)??void 0,challengeName:x.syncSessionStorage.getItem(F.challengeName)??void 0,signInSession:x.syncSessionStorage.getItem(F.signInSession)??void 0};case"RESET_STATE":return k(),L();default:return e}})(L(),{type:"SET_INITIAL_STATE"}
3),{getState:()=>o,dispatch:e=>{o=s(o,e)}});function V(e){M.dispatch({type:"SET_SIGN_IN_STATE",value:e})}let B=({challengeName:e,signInSession:t,username:r})=>{r&&x.syncSessionStorage.setItem(F.username,r),e&&x.syncSessionStorage.setItem(F.challengeName,e),t&&(x.syncSessionStorage.setItem(F.signInSession,t),x.syncSessionStorage.setItem(F.expiry,String(Date.now()+18e4)))};var G=e.i(135736),q=R;let H="Passkeys may not be supported on this device. Ensure your application is running in a secure context (HTTPS) and Web Authentication API is supported.";class K extends q.AmplifyError{constructor(e){super(e),this.constructor=K,Object.setPrototypeOf(this,K.prototype)}}(a=l||(l={})).PasskeyNotSupported="PasskeyNotSupported",a.PasskeyAlreadyExists="PasskeyAlreadyExists",a.InvalidPasskeyRegistrationOptions="InvalidPasskeyRegistrationOptions",a.InvalidPasskeyAuthenticationOptions="InvalidPasskeyAuthenticationOptions",a.RelyingPartyMismatch="RelyingPartyMismatch",a.PasskeyRegistrationFailed="PasskeyRegistrationFailed",a.PasskeyRetrievalFailed="PasskeyRetrievalFailed",a.PasskeyRegistrationCanceled="PasskeyRegistrationCanceled",a.PasskeyAuthenticationCanceled="PasskeyAuthenticationCanceled",a.PasskeyOperationAborted="PasskeyOperationAborted";let W="User may have canceled the ceremony or another interruption has occurred. Check underlying error for details.",z="Ensure your user pool is configured to support the WEB_AUTHN as an authentication factor.",$={[l.PasskeyNotSupported]:{message:"Passkeys may not be supported on this device.",recoverySuggestion:H},[l.InvalidPasskeyRegistrationOptions]:{message:"Invalid passkey registration options.",recoverySuggestion:z},[l.InvalidPasskeyAuthenticationOptions]:{message:"Invalid passkey authentication options.",recoverySuggestion:z},[l.PasskeyRegistrationFailed]:{message:"Device failed to create passkey.",recoverySuggestion:H},[l.PasskeyRetrievalFailed]:{message:"Device failed to retrieve passkey.",recoverySuggestion:"Passkeys may not be available on this device. Try an alternative authentication factor like PASSWORD, EMAIL_OTP, or SMS_OTP."},[l.PasskeyAlreadyExists]:{message:"Passkey already exists in authenticator.",recoverySuggestion:"Proceed with existing passkey or try again after deleting the credential."},[l.PasskeyRegistrationCanceled]:{message:"Passkey registration ceremony has been canceled.",recoverySuggestion:W},[l.PasskeyAuthenticationCanceled]:{message:"Passkey authentication ceremony has been canceled.",recoverySuggestion:W},[l.PasskeyOperationAborted]:{message:"Passkey operation has been aborted.",recoverySuggestion:W},[l.RelyingPartyMismatch]:{message:"Relying party does not match current domain.",recoverySuggestion:"Ensure relying party identifier matches current domain."}},j=(0,G.createAssertionFunction)($,K);var Y=e.i(320720),J=e.i(347344),Q=e.i(911476);let X={convert(e,t={urlSafe:!1,skipPadding:!1}){let r="string"==typeof e?e:Array.from(e,e=>String.fromCodePoint(e)).join(""),i=(0,Q.getBtoa)()(r);return t.urlSafe&&(i=i.replace(/\+/g,"-").replace(/\//g,"_")),t.skipPadding&&(i=i.replace(/=/g,"")),i}};e.s(["base64Encoder",0,X],228239);let Z=e=>X.convert(new Uint8Array(e),{urlSafe:!0,skipPadding:!0});var ee=e.i(874703);let et=e=>Uint8Array.from(ee.base64Decoder.convert(e,{urlSafe:!0}),e=>e.charCodeAt(0)).buffer,er=async e=>{try{let t,r,i,o,n=(0,J.isBrowser)()&&window.isSecureContext&&"credentials"in navigator&&"function"==typeof window.PublicKeyCredential;j(n,l.PasskeyNotSupported);let s=(t=et(e.challenge),r=(e.allowCredentials||[]).map(e=>({...e,id:et(e.id)})),{...e,challenge:t,allowCredentials:r}),a=await navigator.credentials.get({publicKey:s});return j(a&&a instanceof PublicKeyCredential&&a.response instanceof AuthenticatorAssertionResponse,l.PasskeyRetrievalFailed),i={clientDataJSON:Z(a.response.clientDataJSON),authenticatorData:Z(a.response.authenticatorData),signature:Z(a.response.signature)},a.response.userHandle&&(i.userHandle=Z(a.response.userHandle)),o={id:a.id,rawId:Z(a.rawId),type:a.type,clientExtensionResults:a.getClientExtensionResults(),response:i},a.authenticatorAttachment&&(o.authenticatorAttachment=a.authenticatorAttachment),o}catch(e){throw(e=>{if(e instanceof K)return e;if(e instanceof Error&&"NotAllowedError"===e.name){let{message:t,recoverySuggestion:r}=$[l.PasskeyAuthenticationCanceled];return new K({name:l.PasskeyAuthenticationCanceled,message:t,recoverySuggestion:r,underlyingError:e})}return(e=>{if(e instanceof Error){if("AbortError"===e.name){let{message:t,recoverySuggestion:r}=$[l.PasskeyOperationAborted];return new K({name:l.PasskeyOperationAborted,message:t,recoverySuggestion:r,underlyingError:e})}if("SecurityError"===e.name){let{message:t,recoverySuggestion:r}=$[l.RelyingPartyMismatch];return new K({name:l.RelyingPartyMismatch,message:t,recoverySuggestion:r,underlyingError:e})}}return new K({name:Y.AmplifyErrorCode.Unknown,message:"An unknown error has occurred.",underlyingError:e})})(e)})(e)}},ei=async()=>{let{userAgentData:e}=navigator;if(!e)return navigator.userAgent;let{platform:t="",platformVersion:r="",model:i="",architecture:o="",fullVersionList:n=[]}=await e.getHighEntropyValues(["platform","platformVersion","architecture","model","fullVersionList"]);return[t,r,o,i,t,n.map(e=>`${e.brand}/${e.version}`).join(";")].filter(e=>e).join(" ")||navigator.userAgent};var eo=e.i(420936),en=e.i(522488),es=e.i(31783),ea=e.i(190498),ec=e.i(774488);let el={convert:e=>new TextEncoder().encode(e)};function eu(e,t){null!=e&&this.fromString(e,t)}function ed(){return new eu(null,null)}let ep="u">typeof navigator;ep&&"Microsoft Internet Explorer"===navigator.appName?(eu.prototype.am=function(e,t,r,i,o,n){let s=32767&t,a=t>>15;for(;--n>=0;){let t=32767&this[e],n=this[e++]>>15,c=a*t+n*s;o=((t=s*t+((32767&c)<<15)+r[i]+(0x3fffffff&o))>>>30)+(c>>>15)+a*n+(o>>>30),r[i++]=0x3fffffff&t}return o},t=30):ep&&"Netscape"!==navigator.appName?(eu.prototype.am=function(e,t,r,i,o,n){for(;--n>=0;){let n=t*this[e++]+r[i]+o;o=Math.floor(n/0x4000000),r[i++]=0x3ffffff&n}return o},t=26):(eu.prototype.am=function(e,t,r,i,o,n){let s=16383&t,a=t>>14;for(;--n>=0;){let t=16383&this[e],n=this[e++]>>14,c=a*t+n*s;o=((t=s*t+((16383&c)<<14)+r[i]+o)>>28)+(c>>14)+a*n,r[i++]=0xfffffff&t}return o},t=28),eu.prototype.DB=t,eu.prototype.DM=(1<<t)-1,eu.prototype.DV=1<<t,eu.prototype.FV=0x10000000000000,eu.prototype.F1=52-t,eu.prototype.F2=2*t-52;let eh=[];for(i=0,r=48;i<=9;++i)eh[r++]=i;for(i=10,r=97;i<36;++i)eh[r++]=i;for(i=10,r=65;i<36;++i)eh[r++]=i;function eg(e){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(e)}function ef(e){let t=ed();return t.fromInt(e),t}function eE(e){let t,r=1;return 0!=(t=e>>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function em(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>
3>15,this.um=(1<<e.DB-15)-1,this.mt2=2*e.t}em.prototype.convert=function(e){let t=ed();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(eu.ZERO)>0&&this.m.subTo(t,t),t},em.prototype.revert=function(e){let t=ed();return e.copyTo(t),this.reduce(t),t},em.prototype.reduce=function(e){for(;e.t<=this.mt2;)e[e.t++]=0;for(let t=0;t<this.m.t;++t){let r=32767&e[t],i=r*this.mpl+((r*this.mph+(e[t]>>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e[r]+=this.m.am(0,i,e,t,0,this.m.t);e[r]>=e.DV;)e[r]-=e.DV,e[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},em.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},em.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},eu.prototype.copyTo=function(e){for(let t=this.t-1;t>=0;--t)e[t]=this[t];e.t=this.t,e.s=this.s},eu.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this[0]=e:e<-1?this[0]=e+this.DV:this.t=0},eu.prototype.fromString=function(e,t){let r;if(16===t)r=4;else if(8===t)r=3;else if(2===t)r=1;else if(32===t)r=5;else if(4===t)r=2;else throw Error("Only radix 2, 4, 8, 16, 32 are supported");this.t=0,this.s=0;let i=e.length,o=!1,n=0;for(;--i>=0;){let t=function(e,t){let r=eh[e.charCodeAt(t)];return null==r?-1:r}(e,i);if(t<0){"-"===e.charAt(i)&&(o=!0);continue}o=!1,0===n?this[this.t++]=t:n+r>this.DB?(this[this.t-1]|=(t&(1<<this.DB-n)-1)<<n,this[this.t++]=t>>this.DB-n):this[this.t-1]|=t<<n,(n+=r)>=this.DB&&(n-=this.DB)}this.clamp(),o&&eu.ZERO.subTo(this,this)},eu.prototype.clamp=function(){let e=this.s&this.DM;for(;this.t>0&&this[this.t-1]==e;)--this.t},eu.prototype.dlShiftTo=function(e,t){let r;for(r=this.t-1;r>=0;--r)t[r+e]=this[r];for(r=e-1;r>=0;--r)t[r]=0;t.t=this.t+e,t.s=this.s},eu.prototype.drShiftTo=function(e,t){for(let r=e;r<this.t;++r)t[r-e]=this[r];t.t=Math.max(this.t-e,0),t.s=this.s},eu.prototype.lShiftTo=function(e,t){let r,i=e%this.DB,o=this.DB-i,n=(1<<o)-1,s=Math.floor(e/this.DB),a=this.s<<i&this.DM;for(r=this.t-1;r>=0;--r)t[r+s+1]=this[r]>>o|a,a=(this[r]&n)<<i;for(r=s-1;r>=0;--r)t[r]=0;t[s]=a,t.t=this.t+s+1,t.s=this.s,t.clamp()},eu.prototype.rShiftTo=function(e,t){t.s=this.s;let r=Math.floor(e/this.DB);if(r>=this.t){t.t=0;return}let i=e%this.DB,o=this.DB-i,n=(1<<i)-1;t[0]=this[r]>>i;for(let e=r+1;e<this.t;++e)t[e-r-1]|=(this[e]&n)<<o,t[e-r]=this[e]>>i;i>0&&(t[this.t-r-1]|=(this.s&n)<<o),t.t=this.t-r,t.clamp()},eu.prototype.subTo=function(e,t){let r=0,i=0,o=Math.min(e.t,this.t);for(;r<o;)i+=this[r]-e[r],t[r++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i-=e.s;r<this.t;)i+=this[r],t[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<e.t;)i-=e[r],t[r++]=i&this.DM,i>>=this.DB;i-=e.s}t.s=i<0?-1:0,i<-1?t[r++]=this.DV+i:i>0&&(t[r++]=i),t.t=r,t.clamp()},eu.prototype.multiplyTo=function(e,t){let r=this.abs(),i=e.abs(),o=r.t;for(t.t=o+i.t;--o>=0;)t[o]=0;for(o=0;o<i.t;++o)t[o+r.t]=r.am(0,i[o],t,o,0,r.t);t.s=0,t.clamp(),this.s!==e.s&&eu.ZERO.subTo(t,t)},eu.prototype.squareTo=function(e){let t=this.abs(),r=e.t=2*t.t;for(;--r>=0;)e[r]=0;for(r=0;r<t.t-1;++r){let i=t.am(r,t[r],e,2*r,0,1);(e[r+t.t]+=t.am(r+1,2*t[r],e,2*r+1,i,t.t-r-1))>=t.DV&&(e[r+t.t]-=t.DV,e[r+t.t+1]=1)}e.t>0&&(e[e.t-1]+=t.am(r,t[r],e,2*r,0,1)),e.s=0,e.clamp()},eu.prototype.divRemTo=function(e,t,r){let i=e.abs();if(i.t<=0)return;let o=this.abs();if(o.t<i.t){null!=t&&t.fromInt(0),null!=r&&this.copyTo(r);return}null===r&&(r=ed());let n=ed(),s=this.s,a=e.s,c=this.DB-eE(i[i.t-1]);c>0?(i.lShiftTo(c,n),o.lShiftTo(c,r)):(i.copyTo(n),o.copyTo(r));let l=n.t,u=n[l-1];if(0===u)return;let d=u*(1<<this.F1)+(l>1?n[l-2]>>this.F2:0),p=this.FV/d,h=(1<<this.F1)/d,g=1<<this.F2,f=r.t,E=f-l,m=null===t?ed():t;for(n.dlShiftTo(E,m),r.compareTo(m)>=0&&(r[r.t++]=1,r.subTo(m,r)),eu.ONE.dlShiftTo(l,m),m.subTo(n,n);n.t<l;)n[n.t++]=0;for(;--E>=0;){let e=r[--f]===u?this.DM:Math.floor(r[f]*p+(r[f-1]+g)*h);if((r[f]+=n.am(0,e,r,E,0,l))<e)for(n.dlShiftTo(E,m),r.subTo(m,r);r[f]<--e;)r.subTo(m,r)}null!==t&&(r.drShiftTo(l,t),s!==a&&eu.ZERO.subTo(t,t)),r.t=l,r.clamp(),c>0&&r.rShiftTo(c,r),s<0&&eu.ZERO.subTo(r,r)},eu.prototype.invDigit=function(){if(this.t<1)return 0;let e=this[0];if((1&e)==0)return 0;let t=3&e;
3return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},eu.prototype.addTo=function(e,t){let r=0,i=0,o=Math.min(e.t,this.t);for(;r<o;)i+=this[r]+e[r],t[r++]=i&this.DM,i>>=this.DB;if(e.t<this.t){for(i+=e.s;r<this.t;)i+=this[r],t[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<e.t;)i+=e[r],t[r++]=i&this.DM,i>>=this.DB;i+=e.s}t.s=i<0?-1:0,i>0?t[r++]=i:i<-1&&(t[r++]=this.DV+i),t.t=r,t.clamp()},eu.prototype.toString=function(e){let t,r;if(this.s<0)return"-"+this.negate().toString(e);if(16==e)t=4;else if(8===e)t=3;else if(2===e)t=1;else if(32===e)t=5;else if(4===e)t=2;else throw Error("Only radix 2, 4, 8, 16, 32 are supported");let i=(1<<t)-1,o=!1,n="",s=this.t,a=this.DB-s*this.DB%t;if(s-- >0)for(a<this.DB&&(r=this[s]>>a)>0&&(o=!0,n=eg(r));s>=0;)a<t?r=(this[s]&(1<<a)-1)<<t-a|this[--s]>>(a+=this.DB-t):(r=this[s]>>(a-=t)&i,a<=0&&(a+=this.DB,--s)),r>0&&(o=!0),o&&(n+=eg(r));return o?n:"0"},eu.prototype.negate=function(){let e=ed();return eu.ZERO.subTo(this,e),e},eu.prototype.abs=function(){return this.s<0?this.negate():this},eu.prototype.compareTo=function(e){let t=this.s-e.s;if(0!=t)return t;let r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this[r]-e[r]))return t;return 0},eu.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+eE(this[this.t-1]^this.s&this.DM)},eu.prototype.mod=function(e){let t=ed();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(eu.ZERO)>0&&e.subTo(t,t),t},eu.prototype.equals=function(e){return 0===this.compareTo(e)},eu.prototype.add=function(e){let t=ed();return this.addTo(e,t),t},eu.prototype.subtract=function(e){let t=ed();return this.subTo(e,t),t},eu.prototype.multiply=function(e){let t=ed();return this.multiplyTo(e,t),t},eu.prototype.divide=function(e){let t=ed();return this.divRemTo(e,t,null),t},eu.prototype.modPow=function(e,t,r){let i,o,n,s=e.bitLength(),a=ef(1),c=new em(t);if(s<=0)return a;let l=[],u=3,d=(i=s<18?1:s<48?3:s<144?4:s<768?5:6)-1,p=(1<<i)-1;if(l[1]=c.convert(this),i>1){let e=ed();for(c.sqrTo(l[1],e);u<=p;)l[u]=ed(),c.mulTo(e,l[u-2],l[u]),u+=2}let h=e.t-1,g=!0,f=ed();for(s=eE(e[h])-1;h>=0;){for(s>=d?o=e[h]>>s-d&p:(o=(e[h]&(1<<s+1)-1)<<d-s,h>0&&(o|=e[h-1]>>this.DB+s-d)),u=i;(1&o)==0;)o>>=1,--u;if((s-=u)<0&&(s+=this.DB,--h),g)l[o].copyTo(a),g=!1;else{for(;u>1;)c.sqrTo(a,f),c.sqrTo(f,a),u-=2;u>0?c.sqrTo(a,f):(n=a,a=f,f=n),c.mulTo(f,l[o],a)}for(;h>=0&&(e[h]&1<<s)==0;)c.sqrTo(a,f),n=a,a=f,f=n,--s<0&&(s=this.DB-1,--h)}let E=c.revert(a);return r(null,E),E},eu.ZERO=ef(0),eu.ONE=ef(1);let ey=async({a:e,g:t,k:r,x:i,B:o,N:n,U:s})=>new Promise((a,c)=>{t.modPow(i,n,(t,l)=>{t?c(t):o.subtract(r.multiply(l)).modPow(e.add(s.multiply(i)),n,(e,t)=>{e?c(e):a(t.mod(n))})})}),eS={},eA={};for(let e=0;e<256;e++){let t=e.toString(16).toLowerCase();1===t.length&&(t=`0${t}`),eS[e]=t,eA[t]=e}let eI=e=>{if(e.length%2!=0)throw Error("Hex encoded strings must have an even number length");let t=new Uint8Array(e.length/2);for(let r=0;r<e.length;r+=2){let i=e.slice(r,r+2).toLowerCase();if(i in eA)t[r/2]=eA[i];else throw Error(`Cannot decode unrecognized sequence ${i} as hexadecimal`)}return t};e.i(79471);var ev=e.i(860781);let ew=e=>{let t="";for(let r=0;r<e.byteLength;r++)t+=eS[e[r]];return t},eC=e=>{let t=new ev.Sha256;t.update(e);let r=ew(t.digestSync());return Array(64-r.length).join("0")+r},e_=/^[89a-f]/i,eP=e=>{if(!(e instanceof eu))throw Error("Not a BigInteger");let t=0>e.compareTo(eu.ZERO),r=e.abs().toString(16);return r=r.length%2!=0?`0${r}`:r,r=e_.test(r)?`00${r}`:r,t&&(r=new eu(r.split("").map(e=>{let t=15&~parseInt(e,16);return"0123456789ABCDEF".charAt(t)}).join(""),16).add(eu.ONE).toString(16)).toUpperCase().startsWith("FF8")&&(r=r.substring(2)),r};class eR{constructor(e,t){this.words=[];let r=e;r=this.words=r||[],void 0!==t?this.sigBytes=t:this.sigBytes=4*r.length}random(e){let t=[];for(let r=0;r<e;r+=4)t.push((0,Q.getCrypto)().getRandomValues(new Uint32Array(1))[0]);return new eR(t,e)}toString(){return function(e){let{words:t}=e,{sigBytes:r}=e,i=[];for(let e=0;e<r;e++){let r=t[e>>>2]>>>24-e%4*8&255;i.push((r>>>4).toString(16)),i.push((15&r).toString(16))}return i.join("")}(this)}}let eT=e=>eI(new eR().random(e).toString());
3class eN{constructor({userPoolName:e,a:t,g:r,A:i,N:o}){this.encoder=el,this.userPoolName=e,this.a=t,this.g=r,this.A=i,this.N=o,this.k=new eu((e=>eC(eI(e)))(`${eP(o)}${eP(r)}`),16)}getRandomPassword(){if(!this.randomPassword)throw new g.AuthError({name:"EmptyBigIntegerRandomPassword",message:"random password is empty"});return this.randomPassword}getSaltToHashDevices(){if(!this.saltToHashDevices)throw new g.AuthError({name:"EmptyBigIntegersaltToHashDevices",message:"saltToHashDevices is empty"});return this.saltToHashDevices}getVerifierDevices(){if(!this.verifierDevices)throw new g.AuthError({name:"EmptyBigIntegerVerifierDevices",message:"verifyDevices is empty"});return this.verifierDevices}async generateHashDevice(e,t){this.randomPassword=X.convert(eT(40));let r=eC(`${e}${t}:${this.randomPassword}`),i=ew(eT(16));return this.saltToHashDevices=eP(new eu(i,16)),new Promise((e,t)=>{this.g.modPow(new eu(eC(eI(this.saltToHashDevices+r)),16),this.N,(r,i)=>{r?t(r):(this.verifierDevices=eP(i),e())})})}async getPasswordAuthenticationKey({username:e,password:t,serverBValue:r,salt:i}){var o,n;let s,a,c;if(r.mod(this.N).equals(eu.ZERO))throw Error("B cannot be zero.");let l=(({A:e,B:t})=>{let r=new eu(eC(eI(eP(e)+eP(t))),16);if(r.equals(eu.ZERO))throw Error("U cannot be zero.");return r})({A:this.A,B:r}),u=eC(`${this.userPoolName}${e}:${t}`),d=new eu(eC(eI(eP(i)+u)),16),p=await ey({a:this.a,g:this.g,k:this.k,x:d,B:r,N:this.N,U:l}),h=this.encoder.convert("Caldera Derived Key"),g=this.encoder.convert("\x01"),f=new Uint8Array(h.byteLength+g.byteLength);return f.set(h,0),f.set(g,h.byteLength),o=eI(eP(p)),n=eI(eP(l)),(s=new ev.Sha256(n)).update(o),a=s.digestSync(),(c=new ev.Sha256(a)).update(f),c.digestSync().slice(0,16)}}let eb=async({a:e,g:t,N:r})=>new Promise((i,o)=>{t.modPow(e,r,(e,t)=>{e?o(e):t.mod(r).equals(eu.ZERO)?o(Error("Illegal parameter. A mod N cannot be 0.")):i(t)})}),eU=async e=>{let t=new eu("FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF",16),r=new eu("2",16),i=ex(),o=await eb({a:i,g:r,N:t});return new eN({userPoolName:e,a:i,g:r,A:o,N:t})},ex=()=>new eu(ew(eT(128)),16);async function eO({userPoolId:e,userPoolEndpoint:t,newDeviceMetadata:r,accessToken:i}){if(!r)return;let o=e.split("_")[1]||"",n=await eU(o),s=r?.DeviceKey,a=r?.DeviceGroupKey;try{await n.generateHashDevice(a??"",s??"")}catch(e){return}let c={Salt:X.convert(eI(n.getSaltToHashDevices())),PasswordVerifier:X.convert(eI(n.getVerifierDevices()))},l=n.getRandomPassword();try{let o,n=(o={endpointResolver:(0,_.createCognitoUserPoolEndpointResolver)({endpointOverride:t})},(0,eo.composeServiceApi)(en.cognitoUserPoolTransferHandler,(0,es.createUserPoolSerializer)("ConfirmDevice"),(0,ea.createUserPoolDeserializer)(),{...ec.DEFAULT_SERVICE_CLIENT_API_CONFIG,...o}));return await n({region:(0,P.getRegionFromUserPoolId)(e)},{AccessToken:i,DeviceName:await ei(),DeviceKey:r?.DeviceKey,DeviceSecretVerifierConfig:c}),{deviceKey:s,deviceGroupKey:a,randomPassword:l}}catch(e){return}}async function eF(e){let t=u.Amplify.getConfig().Auth?.Cognito;(0,p.assertTokenProviderConfig)(t);let{username:r,signInSession:i,signInDetails:o,challengeName:n}=M.getState();if("WEB_AUTHN"!==n||!r)throw new g.AuthError({name:E.AuthErrorCodes.SignInException,message:"Unable to proceed due to invalid sign in state."});let{CREDENTIAL_REQUEST_OPTIONS:s}=e;j(!!s,l.InvalidPasskeyAuthenticationOptions);let a=await er(JSON.parse(s)),c=(0,w.createRespondToAuthChallengeClient)({endpointResolver:(0,_.createCognitoUserPoolEndpointResolver)({endpointOverride:t.userPoolEndpoint})}),{ChallengeName:h,ChallengeParameters:f,AuthenticationResult:m,Session:y}=await c({region:(0,P.getRegionFromUserPoolId)(t.userPoolId),userAgentValue:(0,I.getAuthUserAgentValue)(d.AuthAction.ConfirmSignIn)},{ChallengeName:"WEB_AUTHN",ChallengeResponses:{USERNAME:r,CREDENTIAL:JSON.stringify(a)},ClientId:t.userPoolClientId,Session:i});
3if(V({signInSession:y,username:r,challengeName:h,signInDetails:o}),m)return await N({...m,username:r,NewDeviceMetadata:await eO({userPoolId:t.userPoolId,userPoolEndpoint:t.userPoolEndpoint,newDeviceMetadata:m.NewDeviceMetadata,accessToken:m.AccessToken}),signInDetails:o}),M.dispatch({type:"RESET_STATE"}),await U(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}};if("WEB_AUTHN"===h)throw new g.AuthError({name:E.AuthErrorCodes.SignInException,message:"Sequential WEB_AUTHN challenges returned from underlying service cannot be handled."});return{challengeName:h,challengeParameters:f}}function eD({username:e,userPoolId:t,userPoolClientId:r}){if("u"<typeof window)return;let i=window.AmazonCognitoAdvancedSecurityData;if(void 0===i)return;let o=i.getData(e,t,r);return o?{EncodedData:o}:{}}let ek=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],eL=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],eM=()=>{let e=new Date,t=eL[e.getUTCDay()],r=ek[e.getUTCMonth()],i=e.getUTCDate(),o=e.getUTCHours();o<10&&(o=`0${o}`);let n=e.getUTCMinutes();n<10&&(n=`0${n}`);let s=e.getUTCSeconds();s<10&&(s=`0${s}`);let a=e.getUTCFullYear();return`${t} ${r} ${i} ${o}:${n}:${s} UTC ${a}`},eV=({userPoolName:e,username:t,challengeParameters:r,dateNow:i,hkdf:o})=>{let n=el.convert(e),s=el.convert(t),a=eB(r.SECRET_BLOCK),c=el.convert(i),l=new Uint8Array(n.byteLength+s.byteLength+a.byteLength+c.byteLength);l.set(n,0),l.set(s,n.byteLength),l.set(a,n.byteLength+s.byteLength),l.set(c,n.byteLength+s.byteLength+a.byteLength);let u=new ev.Sha256(o);u.update(l);let d=u.digestSync();return X.convert(d)},eB=e=>{let t="=".repeat((4-e.length%4)%4),r=(e+t).replace(/-/g,"+").replace(/_/g,"/"),i=ee.base64Decoder.convert(r),o=new Uint8Array(i.length);for(let e=0;e<i.length;++e)o[e]=i.charCodeAt(e);return o};var eG=e.i(565941);async function eq({username:e,config:t,clientMetadata:r,session:i,tokenOrchestrator:o}){let{userPoolId:n,userPoolEndpoint:s}=t,a=t.userPoolClientId,c=await o?.getDeviceMetadata(e);(0,eG.assertDeviceMetadata)(c);let l=await eU(c.deviceGroupKey),u={USERNAME:e,SRP_A:l.A.toString(16),DEVICE_KEY:c.deviceKey},d=(0,w.createRespondToAuthChallengeClient)({endpointResolver:(0,_.createCognitoUserPoolEndpointResolver)({endpointOverride:s})}),{ChallengeParameters:p,Session:h}=await d({region:(0,P.getRegionFromUserPoolId)(n)},{ChallengeName:"DEVICE_SRP_AUTH",ClientId:a,ChallengeResponses:u,ClientMetadata:r,Session:i});return eH(e,p,r,h,l,t,o)}async function eH(e,t,r,i,o,{userPoolId:n,userPoolClientId:s,userPoolEndpoint:a},c){let l=await c?.getDeviceMetadata(e);(0,eG.assertDeviceMetadata)(l);let u=new eu(t?.SRP_B,16),d=new eu(t?.SALT,16),{deviceKey:p}=l,{deviceGroupKey:h}=l,g=await o.getPasswordAuthenticationKey({username:l.deviceKey,password:l.randomPassword,serverBValue:u,salt:d}),f=eM(),E={USERNAME:t?.USERNAME??e,PASSWORD_CLAIM_SECRET_BLOCK:t?.SECRET_BLOCK,TIMESTAMP:f,PASSWORD_CLAIM_SIGNATURE:eV({username:p,userPoolName:h,challengeParameters:t,dateNow:f,hkdf:g}),DEVICE_KEY:p},m=eD({username:e,userPoolId:n,userPoolClientId:s});return(0,w.createRespondToAuthChallengeClient)({endpointResolver:(0,_.createCognitoUserPoolEndpointResolver)({endpointOverride:a})})({region:(0,P.getRegionFromUserPoolId)(n)},{ChallengeName:"DEVICE_PASSWORD_VERIFIER",ClientId:s,ChallengeResponses:E,Session:i,ClientMetadata:r,UserContextData:m})}async function eK(e,t,r,i,o,n,s){let{userPoolId:a,userPoolClientId:c,userPoolEndpoint:l}=n,u=a?.split("_")[1]||"",d=new eu(t?.SRP_B,16),p=new eu(t?.SALT,16),h=t?.USER_ID_FOR_SRP;if(!h)throw new g.AuthError({name:"EmptyUserIdForSRPException",message:"USER_ID_FOR_SRP was not found in challengeParameters"});let f=await o.getPasswordAuthenticationKey({username:h,password:e,serverBValue:d,salt:p}),E=eM(),m={USERNAME:h,PASSWORD_CLAIM_SECRET_BLOCK:t?.SECRET_BLOCK,TIMESTAMP:E,PASSWORD_CLAIM_SIGNATURE:eV({username:h,userPoolName:u,challengeParameters:t,dateNow:E,hkdf:f})},y=await s.getDeviceMetadata(h);y&&y.deviceKey&&(m.DEVICE_KEY=y.deviceKey);let S=eD({username:h,userPoolId:a,userPoolClientId:c}),A=(0,w.createRespondToAuthChallengeClient)({endpointResolver:(0,_.createCognitoUserPoolEndpointResolver)({endpointOverride:l})}),I=await A({region:(0,P.getRegionFromUserPoolId)(a)},{ChallengeName:"PASSWORD_VERIFIER",ChallengeResponses:m,ClientMetadata:r,Session:i,ClientId:c,UserContextData:S}
3);return"DEVICE_SRP_AUTH"===I.ChallengeName?eq({username:h,config:n,clientMetadata:r,session:I.Session,tokenOrchestrator:s}):I}async function eW(e,t,r,i){try{return await e(...t)}catch(o){if(o instanceof g.AuthError&&"ResourceNotFoundException"===o.name&&o.message.includes("Device does not exist."))return await i.clearDeviceMetadata(r),e(...t);throw o}}function ez(e){let{dispatch:t}=M;t({type:"SET_USERNAME",value:e})}async function e$({username:e,password:t,clientMetadata:r,config:i,tokenOrchestrator:o,authFlow:n,preferredChallenge:s}){let{userPoolId:a,userPoolClientId:c,userPoolEndpoint:l}=i,u=a?.split("_")[1]||"",p=await eU(u),h={USERNAME:e,SRP_A:p.A.toString(16)};"USER_AUTH"===n&&s&&(h.PREFERRED_CHALLENGE=s);let g=eD({username:e,userPoolId:a,userPoolClientId:c}),f=(0,v.createInitiateAuthClient)({endpointResolver:(0,_.createCognitoUserPoolEndpointResolver)({endpointOverride:l})}),E=await f({region:(0,P.getRegionFromUserPoolId)(a),userAgentValue:(0,I.getAuthUserAgentValue)(d.AuthAction.SignIn)},{AuthFlow:n,AuthParameters:h,ClientMetadata:r,ClientId:c,UserContextData:g}),{ChallengeParameters:m,Session:y}=E,S=m?.USERNAME??e;return(ez(S),"PASSWORD_VERIFIER"===E.ChallengeName)?eW(eK,[t,m,r,y,p,i,o],S,o):E}let ej="userAttributes.";async function eY(e,t,r,i,o){let{userPoolClientId:n,userPoolId:s,userPoolEndpoint:a}=i,c={USERNAME:e,PASSWORD:t},l=await o.getDeviceMetadata(e);l&&l.deviceKey&&(c.DEVICE_KEY=l.deviceKey);let u=eD({username:e,userPoolId:s,userPoolClientId:n}),p=(0,v.createInitiateAuthClient)({endpointResolver:(0,_.createCognitoUserPoolEndpointResolver)({endpointOverride:a})}),h=await p({region:(0,P.getRegionFromUserPoolId)(s),userAgentValue:(0,I.getAuthUserAgentValue)(d.AuthAction.SignIn)},{AuthFlow:"USER_PASSWORD_AUTH",AuthParameters:c,ClientMetadata:r,ClientId:n,UserContextData:u}),g=h.ChallengeParameters?.USERNAME??h.ChallengeParameters?.USER_ID_FOR_SRP??e;return(ez(g),"DEVICE_SRP_AUTH"===h.ChallengeName)?eq({username:g,config:i,clientMetadata:r,session:h.Session,tokenOrchestrator:o}):h}async function eJ(e,t,r,i,o){return e$({username:e,password:t,clientMetadata:r,config:i,tokenOrchestrator:o,authFlow:"USER_SRP_AUTH"})}async function eQ(e,t,r,i){let{userPoolClientId:o,userPoolId:n,userPoolEndpoint:s}=r,a={USERNAME:e},c=await i.getDeviceMetadata(e);c&&c.deviceKey&&(a.DEVICE_KEY=c.deviceKey);let l=eD({username:e,userPoolId:n,userPoolClientId:o}),u=(0,v.createInitiateAuthClient)({endpointResolver:(0,_.createCognitoUserPoolEndpointResolver)({endpointOverride:s})}),p=await u({region:(0,P.getRegionFromUserPoolId)(n),userAgentValue:(0,I.getAuthUserAgentValue)(d.AuthAction.SignIn)},{AuthFlow:"CUSTOM_AUTH",AuthParameters:a,ClientMetadata:t,ClientId:o,UserContextData:l}),h=p.ChallengeParameters?.USERNAME??e;return(ez(h),"DEVICE_SRP_AUTH"===p.ChallengeName)?eq({username:h,config:r,clientMetadata:t,session:p.Session,tokenOrchestrator:i}):p}async function eX(e,t,r,i,o){(0,p.assertTokenProviderConfig)(i);let{userPoolId:n,userPoolClientId:s,userPoolEndpoint:a}=i,c=n?.split("_")[1]||"",l=await eU(c),u={USERNAME:e,SRP_A:l.A.toString(16),CHALLENGE_NAME:"SRP_A"},h=eD({username:e,userPoolId:n,userPoolClientId:s}),g=(0,v.createInitiateAuthClient)({endpointResolver:(0,_.createCognitoUserPoolEndpointResolver)({endpointOverride:a})}),{ChallengeParameters:f,Session:E}=await g({region:(0,P.getRegionFromUserPoolId)(n),userAgentValue:(0,I.getAuthUserAgentValue)(d.AuthAction.SignIn)},{AuthFlow:"CUSTOM_AUTH",AuthParameters:u,ClientMetadata:r,ClientId:s,UserContextData:h}),m=f?.USERNAME??e;return ez(m),eW(eK,[t,f,r,E,l,i,o],m,o)}async function eZ(e){var t,r,i;let{challengeName:o,challengeParameters:n,availableChallenges:s}=e,a=u.Amplify.getConfig().Auth?.Cognito;switch((0,p.assertTokenProviderConfig)(a),o){case"CUSTOM_CHALLENGE":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE",additionalInfo:n}};case"MFA_SETUP":{let{signInSession:e,username:i}=M.getState(),o=e2(e5(n.MFAS_CAN_SETUP))||[],s=o.filter(e=>"EMAIL"===e||"TOTP"===e),c=s.includes("TOTP"),l=s.includes("EMAIL");if(c&&l)return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_MFA_SETUP_SELECTION",allowedMFATypes:s}};if(l)return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_EMAIL_SETUP"}};if(c){let o=(0,C.createAssociateSoftwareTokenClient)({endpointResolver:(0,_.createCognitoUserPoolEndpointResolver)({endpointOverride:a.userPoolEndpoint})}),{Session:n,SecretCode:s}=await o({region:(0,P.getRegionFromUserPoolId)(a.userPoolId)},{Session:e});return M.dispatch({type:"SET_SIGN_IN_SESSION",value:n}),{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_TOTP_SETUP",totpSetupDetails:(t=s,r=i,{sharedSecret:t,getSetupUri:(e,i)=>{let o=`otpauth://totp/${e}:${i??r}?secret=${t}&issuer=${e}`;return new h.AmplifyUrl(o)}})}}}throw new g.AuthError({name:E.AuthErrorCodes.SignInException,message:`Cannot initiate MFA setup from available types: ${o}`})}case"NEW_PASSWORD_REQUIRED":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED",missingAttributes:(i=n.requiredAttributes)?JSON.parse(i).map(e=>e.includes(ej)?e.replace(ej,""):e):[]}};case"SELECT_MFA_TYPE":return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_MFA_SELECTION",allowedMFATypes:e2(e5(n.MFAS_CAN_CHOOSE))}};case"SMS_OTP":case"SMS_MFA":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_SMS_CODE",codeDeliveryDetails:{deliveryMedium:n.CODE_DELIVERY_DELIVERY_MEDIUM,destination:n.CODE_DELIVERY_DESTINATION}}};case"SOFTWARE_TOKEN_MFA":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_TOTP_CODE"}};case"EMAIL_OTP":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_EMAIL_CODE",codeDeliveryDetails:{deliveryMedium:n.CODE_DELIVERY_DELIVERY_MEDIUM,destination:n.CODE_DELIVERY_DESTINATION}}};case"WEB_AUTHN":{let e=await eF(n);if("isSignedIn"in e&&"nextStep"in e)return e;return eZ(e)}case"PASSWORD":case"PASSWORD_SRP":return{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_IN_WITH_PASSWORD"}};case"SELECT_CHALLENGE":return{isSignedIn:!1,nextStep:{signInStep:"CONTINUE_SIGN_IN_WITH_FIRST_FACTOR_SELECTION",availableChallenges:s}}}throw new g.AuthError({name:E.AuthErrorCodes.SignInException,message:`An error occurred during the sign in process. ${o} challengeName returned by the underlying service was not addressed.`})}function e0(e){return e===f.InitiateAuthException.PasswordResetRequiredException?{isSignedIn:!1,nextStep:{signInStep:"RESET_PASSWORD"}}:e===f.InitiateAuthException.UserNotConfirmedException?{isSignedIn:!1,nextStep:{signInStep:"CONFIRM_SIGN_UP"}}
3:void 0}function e1(e){return"SMS_MFA"===e?"SMS":"SOFTWARE_TOKEN_MFA"===e?"TOTP":"EMAIL_OTP"===e?"EMAIL":void 0}function e2(e){if(e)return e.map(e1).filter(Boolean)}function e5(e){return e?JSON.parse(e):[]}async function e6(){let e;try{e=await (0,A.getCurrentUser)()}catch(e){}if(e&&e.userId&&e.username)throw new g.AuthError({name:S.USER_ALREADY_AUTHENTICATED_EXCEPTION,message:"There is already a signed in user.",recoverySuggestion:"Call signOut before calling signIn again."})}function e8(e){return M.getState().username??e}e.s(["assertUserNotAuthenticated",0,e6,"getActiveSignInUsername",0,e8,"getSignInResult",0,eZ,"getSignInResultFromError",0,e0,"handleCustomAuthFlowWithoutSRP",0,eQ,"handleCustomSRPAuthFlow",0,eX,"handleUserPasswordAuthFlow",0,eY,"handleUserSRPAuthFlow",0,eJ],508718);var e3=e.i(423299);async function e4(e){let t=u.Amplify.getConfig().Auth?.Cognito;(0,p.assertTokenProviderConfig)(t);let{username:r,password:i,options:o}=e,n={loginId:r,authFlowType:"CUSTOM_WITHOUT_SRP"},s=o?.clientMetadata;(0,y.assertValidationError)(!!r,m.AuthValidationErrorCode.EmptySignInUsername),(0,y.assertValidationError)(!i,m.AuthValidationErrorCode.CustomAuthSignInPassword);try{let{ChallengeName:e,ChallengeParameters:i,AuthenticationResult:o,Session:a}=await eW(eQ,[r,s,t,T.tokenOrchestrator],r,T.tokenOrchestrator),c=e8(r);if(V({signInSession:a,username:c,challengeName:e,signInDetails:n}),o)return await N({username:c,...o,NewDeviceMetadata:await eO({userPoolId:t.userPoolId,userPoolEndpoint:t.userPoolEndpoint,newDeviceMetadata:o.NewDeviceMetadata,accessToken:o.AccessToken}),signInDetails:n}),D(),await U(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}};return eZ({challengeName:e,challengeParameters:i})}catch(t){D(),(0,e3.assertServiceError)(t);let e=e0(t.name);if(e)return e;throw t}}async function e7(e){let{username:t,password:r,options:i}=e,o={loginId:t,authFlowType:"CUSTOM_WITH_SRP"},n=u.Amplify.getConfig().Auth?.Cognito;(0,p.assertTokenProviderConfig)(n);let s=i?.clientMetadata;(0,y.assertValidationError)(!!t,m.AuthValidationErrorCode.EmptySignInUsername),(0,y.assertValidationError)(!!r,m.AuthValidationErrorCode.EmptySignInPassword);try{let{ChallengeName:e,ChallengeParameters:i,AuthenticationResult:a,Session:c}=await eX(t,r,s,n,T.tokenOrchestrator),l=e8(t);if(V({signInSession:c,username:l,challengeName:e,signInDetails:o}),a)return await N({username:l,...a,NewDeviceMetadata:await eO({userPoolId:n.userPoolId,userPoolEndpoint:n.userPoolEndpoint,newDeviceMetadata:a.NewDeviceMetadata,accessToken:a.AccessToken}),signInDetails:o}),D(),await U(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}};return eZ({challengeName:e,challengeParameters:i})}catch(t){D(),(0,e3.assertServiceError)(t);let e=e0(t.name);if(e)return e;throw t}}function e9(){return{active:!1}}let te=(n=(c=(e,t)=>{switch(t.type){case"SET_USERNAME":return{...e,username:t.value};case"SET_SESSION":return{...e,session:t.value};case"START":return{...e,active:!0};case"RESET":return e9();default:return e}})(e9(),{type:"RESET"}),{getState:()=>n,dispatch:e=>{n=c(n,e)}});function tt(e){}function tr(e=!0){te.dispatch({type:"RESET"})}async function ti(e){let{username:t,password:r}=e,i=u.Amplify.getConfig().Auth?.Cognito,o={loginId:t,authFlowType:"USER_SRP_AUTH"};(0,p.assertTokenProviderConfig)(i);let n=e.options?.clientMetadata;(0,y.assertValidationError)(!!t,m.AuthValidationErrorCode.EmptySignInUsername),(0,y.assertValidationError)(!!r,m.AuthValidationErrorCode.EmptySignInPassword);try{let{ChallengeName:e,ChallengeParameters:s,AuthenticationResult:a,Session:c}=await eJ(t,r,n,i,T.tokenOrchestrator),l=e8(t);if(V({signInSession:c,username:l,challengeName:e,signInDetails:o}),a)return await N({username:l,...a,NewDeviceMetadata:await eO({userPoolId:i.userPoolId,userPoolEndpoint:i.userPoolEndpoint,newDeviceMetadata:a.NewDeviceMetadata,accessToken:a.AccessToken}),signInDetails:o}),D(),await U(),tr(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}};return eZ({challengeName:e,challengeParameters:s})}catch(t){D(),tr(),(0,e3.assertServiceError)(t);let e=e0(t.name);if(e)return e;throw t}}async function to(e){let{username:t,password:r,options:i}=e,o=u.Amplify.getConfig().Auth?.Cognito,n={loginId:t,authFlowType:"USER_PASSWORD_AUTH"};(0,p.assertTokenProviderConfig)(o);let s=i?.clientMetadata;(0,y.assertValidationError)(!!t,m.AuthValidationErrorCode.EmptySignInUsername),(0,y.assertValidationError)(!!r,m.AuthValidationErrorCode.EmptySignInPassword);try{let{ChallengeName:e,ChallengeParameters:i,AuthenticationResult:a,Session:c}=await eW(eY,[t,r,s,o,T.tokenOrchestrator],t,T.tokenOrchestrator),l=e8(t);
3if(V({signInSession:c,username:l,challengeName:e,signInDetails:n}),a)return await N({...a,username:l,NewDeviceMetadata:await eO({userPoolId:o.userPoolId,userPoolEndpoint:o.userPoolEndpoint,newDeviceMetadata:a.NewDeviceMetadata,accessToken:a.AccessToken}),signInDetails:n}),D(),await U(),tr(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}};return eZ({challengeName:e,challengeParameters:i})}catch(t){D(),tr(),(0,e3.assertServiceError)(t);let e=e0(t.name);if(e)return e;throw t}}async function tn({username:e,clientMetadata:t,config:r,tokenOrchestrator:i,preferredChallenge:o,password:n,session:s}){let{userPoolId:a,userPoolClientId:c,userPoolEndpoint:l}=r,u=eD({username:e,userPoolId:a,userPoolClientId:c}),p={USERNAME:e};if(o){if(r.passwordless&&(("EMAIL_OTP"!==o||r.passwordless.emailOtpEnabled)&&("SMS_OTP"!==o||r.passwordless.smsOtpEnabled)&&("WEB_AUTHN"!==o||r.passwordless.webAuthn)||(0,y.assertValidationError)(!1,m.AuthValidationErrorCode.InvalidPreferredChallenge)),"PASSWORD_SRP"===o)return(0,y.assertValidationError)(!!n,m.AuthValidationErrorCode.EmptySignInPassword),e$({username:e,password:n,clientMetadata:t,config:r,tokenOrchestrator:i,authFlow:"USER_AUTH",preferredChallenge:o});"PASSWORD"===o&&((0,y.assertValidationError)(!!n,m.AuthValidationErrorCode.EmptySignInPassword),p.PASSWORD=n),p.PREFERRED_CHALLENGE=o}let h={AuthFlow:"USER_AUTH",AuthParameters:p,ClientMetadata:t,ClientId:c,UserContextData:u};s&&(h.Session=s);let g=(0,v.createInitiateAuthClient)({endpointResolver:(0,_.createCognitoUserPoolEndpointResolver)({endpointOverride:l})}),f=await g({region:(0,P.getRegionFromUserPoolId)(a),userAgentValue:(0,I.getAuthUserAgentValue)(d.AuthAction.SignIn)},h);return ez(e),f}async function ts(e){let{username:t,password:r,options:i}=e,o=u.Amplify.getConfig().Auth?.Cognito,n={loginId:t,authFlowType:"USER_AUTH"};(0,p.assertTokenProviderConfig)(o);let s=i?.clientMetadata,a=i?.preferredChallenge??o?.passwordless?.preferredChallenge;(0,y.assertValidationError)(!!t,m.AuthValidationErrorCode.EmptySignInUsername);try{let e={username:t,config:o,tokenOrchestrator:T.tokenOrchestrator,clientMetadata:s,preferredChallenge:a,password:r},i=te.getState();i.active&&i.username===t&&(e.session=i.session);let c=await tn(e),l=e8(t);if(V({signInSession:c.Session,username:l,challengeName:c.ChallengeName,signInDetails:n}),c.AuthenticationResult)return await N({username:l,...c.AuthenticationResult,NewDeviceMetadata:await eO({userPoolId:o.userPoolId,userPoolEndpoint:o.userPoolEndpoint,newDeviceMetadata:c.AuthenticationResult.NewDeviceMetadata,accessToken:c.AuthenticationResult.AccessToken}),signInDetails:n}),D(),await U(),tr(),{isSignedIn:!0,nextStep:{signInStep:"DONE"}};return eZ({challengeName:c.ChallengeName,challengeParameters:c.ChallengeParameters,availableChallenges:"AvailableChallenges"in c?c.AvailableChallenges:void 0})}catch(t){D(),tr(),(0,e3.assertServiceError)(t);let e=e0(t.name);if(e)return e;throw t}}async function ta(e){tr(!1);let t=e.options?.authFlowType;switch(await e6(),t){case"USER_SRP_AUTH":default:return ti(e);case"USER_PASSWORD_AUTH":return to(e);case"CUSTOM_WITHOUT_SRP":return e4(e);case"CUSTOM_WITH_SRP":return e7(e);case"USER_AUTH":return ts(e)}}function tc(e){return Object.entries(e).map(([e,t])=>({Name:e,Value:t}))}function tl(e,t){let r;return i=>{r||e(...i),clearTimeout(r),r=setTimeout(()=>{r=void 0},t)}}e.s(["signIn",0,ta],230207),e.s(["toAttributeType",0,tc],955374);let tu=tl(function(e,t,r){let i=Date.now(),o=setInterval(async()=>{if(Date.now()-i>18e4)clearInterval(o),r(new g.AuthError({name:S.AUTO_SIGN_IN_EXCEPTION,message:"The account was not confirmed on time.",recoverySuggestion:"Try to verify your account by clicking the link sent your email or phone and then login manually."})),tr();else try{let r=await ta(e);"CONFIRM_SIGN_UP"!==r.nextStep.signInStep&&(t(r),clearInterval(o),tr())}catch(e){clearInterval(o),r(e),tr()}},5e3)},300),td=tl(tp,300);async function tp(e,t,r){try{let r=e?.options?.authFlowType==="USER_AUTH"?await ts(e):await ta(e);t(r),tr()}catch(e){r(e),tr()}}function th(e){return async()=>new Promise((t,r)=>{td([e,t,r])})}var tg=e.i(46384);async function tf(e){let t,{username:r,password:i,options:o}=e,n=u.Amplify.getConfig().Auth?.Cognito,s=n?.signUpVerificationMethod??"code",{clientMetadata:a,validationData:c,autoSignIn:l}=e.options??{};(0,p.assertTokenProviderConfig)(n),(0,y.assertValidationError)(!!r,m.AuthValidationErrorCode.EmptySignUpUsername);let h="boolean"!=typeof l?l:void 0,S={username:r,options:h};h?.authFlowType!=="CUSTOM_WITHOUT_SRP"&&(S.password=i);let{userPoolId:A,userPoolClientId:v,userPoolEndpoint:w}=n,C=(t={endpointResolver:(0,_.createCognitoUserPoolEndpointResolver)({endpointOverride:w})},(0,eo.composeServiceApi)(en.cognitoUserPoolTransferHandler,(0,es.createUserPoolSerializer)("SignUp"),async e=>{if(e.statusCode>=300){let t=await (0,tg.parseJsonError)(e);if((0,e3.assertServiceError)(t),t.name===f.SignUpException.InvalidParameterException&&/'password'/.test(t.message)&&/Member must not be null/.test(t.message)){let e=m.AuthValidationErrorCode.EmptySignUpPassword,{message:t,recoverySuggestion:r}=E.validationErrorMap[e];throw new g.AuthError({name:e,message:t,recoverySuggestion:r})}throw new g.AuthError({name:t.name,message:t.message})}return(0,tg.parseJsonBody)(e)},{...ec.DEFAULT_SERVICE_CLIENT_API_CONFIG,...t})),R={Username:r,Password:void 0,UserAttributes:o?.userAttributes&&tc(o?.userAttributes),ClientMetadata:a,ValidationData:c&&tc(c),ClientId:v,UserContextData:eD({username:r,userPoolId:A,userPoolClientId:v})};i&&(R.Password=i);let{UserSub:T,CodeDeliveryDetails:N,UserConfirmed:U,Session:x}=await C({region:(0,P.getRegionFromUserPoolId)(A),userAgentValue:(0,I.getAuthUserAgentValue)(d.AuthAction.SignUp)},R);(h||!0===l)&&(te.dispatch({type:"START"}),te.dispatch({type:"SET_USERNAME",value:r}),te.dispatch({type:"SET_SESSION",value:x}));let O={destination:N?.Destination,deliveryMedium:N?.DeliveryMedium,attributeName:N?.AttributeName},F=te.getState().active;if(U)return F?(tt(th(S)),{isSignUpComplete:!0,nextStep:{signUpStep:"COMPLETE_AUTO_SIGN_IN"},userId:T}):{isSignUpComplete:!0,nextStep:{signUpStep:"DONE"},userId:T};if(F){let e,t;if("link"===s)return tt(async()=>new Promise((e,t)=>
3{tu([S,e,t])})),{isSignUpComplete:!1,nextStep:{signUpStep:"COMPLETE_AUTO_SIGN_IN",codeDeliveryDetails:O},userId:T};e=b.HubInternal.listen("auth-internal",async({payload:t})=>{if("confirmSignUp"===t.event){let r=t.data;r?.isSignUpComplete&&(b.HubInternal.dispatch("auth-internal",{event:"autoSignIn"}),tt(th(S)),e())}}),t=setTimeout(()=>{e(),clearTimeout(t),tr()},18e4)}return{isSignUpComplete:!1,nextStep:{signUpStep:"CONFIRM_SIGN_UP",codeDeliveryDetails:O},userId:T}}async function tE(e){let t,{username:r,confirmationCode:i,options:o}=e,n=u.Amplify.getConfig().Auth?.Cognito;(0,p.assertTokenProviderConfig)(n);let{userPoolId:s,userPoolClientId:a,userPoolEndpoint:c}=n,l=o?.clientMetadata;(0,y.assertValidationError)(!!r,m.AuthValidationErrorCode.EmptyConfirmSignUpUsername),(0,y.assertValidationError)(!!i,m.AuthValidationErrorCode.EmptyConfirmSignUpCode);let h=eD({username:r,userPoolId:s,userPoolClientId:a}),g=(t={endpointResolver:(0,_.createCognitoUserPoolEndpointResolver)({endpointOverride:c})},(0,eo.composeServiceApi)(en.cognitoUserPoolTransferHandler,(0,es.createUserPoolSerializer)("ConfirmSignUp"),(0,ea.createUserPoolDeserializer)(),{...ec.DEFAULT_SERVICE_CLIENT_API_CONFIG,...t})),{Session:f}=await g({region:(0,P.getRegionFromUserPoolId)(n.userPoolId),userAgentValue:(0,I.getAuthUserAgentValue)(d.AuthAction.ConfirmSignUp)},{Username:r,ConfirmationCode:i,ClientMetadata:l,ForceAliasCreation:o?.forceAliasCreation,ClientId:n.userPoolClientId,UserContextData:h});return new Promise((e,t)=>{try{let t={isSignUpComplete:!0,nextStep:{signUpStep:"DONE"}},i=te.getState();if(!i.active||i.username!==r){e(t),tr();return}te.dispatch({type:"SET_SESSION",value:f});let o=b.HubInternal.listen("auth-internal",({payload:t})=>{"autoSignIn"===t.event&&(e({isSignUpComplete:!0,nextStep:{signUpStep:"COMPLETE_AUTO_SIGN_IN"}}),o())});b.HubInternal.dispatch("auth-internal",{event:"confirmSignUp",data:t})}catch(e){t(e)}})}async function tm(e){let t,{username:r}=e;(0,y.assertValidationError)(!!r,m.AuthValidationErrorCode.EmptySignUpUsername);let i=u.Amplify.getConfig().Auth?.Cognito;(0,p.assertTokenProviderConfig)(i);let{userPoolClientId:o,userPoolId:n,userPoolEndpoint:s}=i,a=e.options?.clientMetadata,c=eD({username:r,userPoolId:n,userPoolClientId:o}),l=(t={endpointResolver:(0,_.createCognitoUserPoolEndpointResolver)({endpointOverride:s})},(0,eo.composeServiceApi)(en.cognitoUserPoolTransferHandler,(0,es.createUserPoolSerializer)("ResendConfirmationCode"),(0,ea.createUserPoolDeserializer)(),{...ec.DEFAULT_SERVICE_CLIENT_API_CONFIG,...t})),{CodeDeliveryDetails:h}=await l({region:(0,P.getRegionFromUserPoolId)(i.userPoolId),userAgentValue:(0,I.getAuthUserAgentValue)(d.AuthAction.ResendSignUpCode)},{Username:r,ClientMetadata:a,ClientId:i.userPoolClientId,UserContextData:c}),{DeliveryMedium:g,AttributeName:f,Destination:E}={...h};return{destination:E,deliveryMedium:g,attributeName:f||void 0}}async function ty(e){let t,{username:r}=e;(0,y.assertValidationError)(!!r,m.AuthValidationErrorCode.EmptyResetPasswordUsername);let i=u.Amplify.getConfig().Auth?.Cognito;(0,p.assertTokenProviderConfig)(i);let{userPoolClientId:o,userPoolId:n,userPoolEndpoint:s}=i,a=e.options?.clientMetadata,c=eD({username:r,userPoolId:n,userPoolClientId:o}),l=(t={endpointResolver:(0,_.createCognitoUserPoolEndpointResolver)({endpointOverride:s})},(0,eo.composeServiceApi)(en.cognitoUserPoolTransferHandler,(0,es.createUserPoolSerializer)("ForgotPassword"),(0,ea.createUserPoolDeserializer)(),{...ec.DEFAULT_SERVICE_CLIENT_API_CONFIG,...t})),h=(await l({region:(0,P.getRegionFromUserPoolId)(n),userAgentValue:(0,I.getAuthUserAgentValue)(d.AuthAction.ResetPassword)},{Username:r,ClientMetadata:a,ClientId:o,UserContextData:c})).CodeDeliveryDetails;return{isPasswordReset:!1,nextStep:{resetPasswordStep:"CONFIRM_RESET_PASSWORD_WITH_CODE",codeDeliveryDetails:{deliveryMedium:h?.DeliveryMedium,destination:h?.Destination,attributeName:h?.AttributeName}}}}async function tS(e){let t,r=u.Amplify.getConfig().Auth?.Cognito;(0,p.assertTokenProviderConfig)(r);let{userPoolClientId:i,userPoolId:o,userPoolEndpoint:n}=r,{username:s,newPassword:a}=e;(0,y.assertValidationError)(!!s,m.AuthValidationErrorCode.EmptyConfirmResetPasswordUsername),(0,y.assertValidationError)(!!a,m.AuthValidationErrorCode.EmptyConfirmResetPasswordNewPassword);let c=e.confirmationCode;(0,y.assertValidationError)(!!c,m.AuthValidationErrorCode.EmptyConfirmResetPasswordConfirmationCode);let l=e.options?.clientMetadata,h=eD({username:s,userPoolId:o,userPoolClientId:i}),g=(t={endpointResolver:(0,_.createCognitoUserPoolEndpointResolver)({endpointOverride:n})},(0,eo.composeServiceApi)(en.cognitoUserPoolTransferHandler,(0,es.createUserPoolSerializer)("ConfirmForgotPassword"),(0,ea.createUserPoolDeserializer)(),{...ec.DEFAULT_SERVICE_CLIENT_API_CONFIG,...t}));await g({region:(0,P.getRegionFromUserPoolId)(r.userPoolId),userAgentValue:(0,I.getAuthUserAgentValue)(d.AuthAction.ConfirmResetPassword)},{Username:s,ConfirmationCode:c,Password:a,ClientMetadata:l,ClientId:r.userPoolClientId,UserContextData:h})}e.s(["signUp",0,tf],919122),e.s(["confirmSignUp",0,tE],352015),e.s(["resendSignUpCode",0,tm],856327),e.s(["resetPassword",0,ty],508640),e.s(["confirmResetPassword",0,tS],662157)},504328,504155,466234,e=>{"use strict";e.i(635470),e.i(244972),e.i(317138),e.i(785589),e.i(950917),e.i(736619),e.i(627592);var t,r,i,o,n,s=e.i(148462),a=e.i(982725),c=e.i(65988),l=e.i(839616),u=e.i(427167),d=e.i(161097);e.i(640080);var p=e.i(720510),h=e.i(142119),g=e.i(288002),f=e.i(874275),E=e.i(605486),m=e.i(230207),y=e.i(919122),S=e.i(352015),A=e.i(856327),I=e.i(508640),v=e.i(662157),w=e.i(757396),C=e.i(258768),_=e.i(426377),P=e.i(417777),R=e.i(136822),T=e.i(741109),N=e.i(973227),b=e.i(565941),U=e.i(172205),x=e.i(420936),O=e.i(522488),F=e.i(31783),D=e.i(190498),k=e.i(774488),L=e.i(971532);async function M(e){let t,r=w.Amplify.getConfig().Auth?.Cognito;(0,_.assertTokenProviderConfig)(r);let{userPoolEndpoint:i,userPoolId:o}=r,{oldPassword:n,newPassword:s}=e;(0,T.assertValidationError)(!!n,R.AuthValidationErrorCode.EmptyUpdatePassword),(0,T.assertValidationError)(!!s,R.AuthValidationErrorCode.EmptyUpdatePassword);let{tokens:a}=await (0,C.fetchAuthSession)({forceRefresh:!1});(0,b.assertAuthTokens)(a);let c=(t={endpointResolver:(0,L.createCognitoUserPoolEndpointResolver)({endpointOverride:i})},(0,x.composeServiceApi)(O.cognitoUserPoolTransferHandler,(0,F.createUserPoolSerializer)("ChangePassword"),(0,D.createUserPoolDeserializer)(),{...k.DEFAULT_SERVICE_CLIENT_API_CONFIG,...t}));await c({region:(0,N.getRegionFromUserPoolId)(o),userAgentValue:(0,U.getAuthUserAgentValue)(P.AuthAction.UpdatePassword)},{AccessToken:a.accessToken.toString(),PreviousPassword:n,ProposedPassword:s})}var V=e.i(791448);function B(){return w.Amplify.Auth.clearCredentials()}var G=e.i(914505),q=e.i(438815),H=e.i(555634),K=e.i(377138),W=e.i(996388);e.i(79471);let z=async e=>{await e.clearOAuthData(),W.tokenOrchestrator.clearTokens(),await B(),G.Hub.dispatch("auth",{event:"signedOut"},"Auth",G.AMPLIFY_SYMBOL)},$=async e=>{window?.location&&(window.location.href=e.replace("http://","https://"))};var j=e.i(175836);function Y(e,t){if(t){let r=e?.find(e=>e===t);if(!r)throw j.invalidPreferredRedirectUrlException;return r}{let t=e?.find(J)??e?.find(Q),r=e?.find(Z)??e?.find(X);if(t)return t;if(r)throw j.invalidOriginException;throw j.invalidRedirectException}}let J=e=>e.startsWith(String(window.location.origin+(window.location.pathname||"/"))),Q=e=>e.includes(String(window.location.hostname)),X=e=>e.startsWith("http://"),Z=e=>e.startsWith("https://"),ee=async(e,t=!1,r)=>{(0,_.assertOAuthConfig)(e);let{loginWith:i,userPoolClientId:o}=e,{domain:n,redirectSignOut:s}=i.oauth,a=Y(s,r);return $(`https://${n}/logout?${Object.entries({client_id:o,logout_uri:encodeURIComponent(a)}).map(([e,t])=>`${e}=${t}`).join("&")}`)},et=async(e,t,r,i)=>{let{isOAuthSignIn:o}=await t.loadOAuthSignIn(),n=await r.getOAuthMetadata();if(await z(t),o||n?.oauthSignIn)return ee(e,!1,i)},er=new V.ConsoleLogger("Auth");async function ei(e){let t,r=w.Amplify.getConfig().Auth?.Cognito;(0,_.assertTokenProviderConfig)(r),e?.global?await en(r):await eo(r);try{(0,_.assertOAuthConfig)(r),t=!0}catch(e){t=!1}if(t){let t=new K.DefaultOAuthStore(q.defaultStorage);t.setAuthConfig(r);let{type:i}=await et(r,t,W.tokenOrchestrator,e?.oauth?.redirectUrl)??{};if("error"===i)throw new H.AuthError({name:j.OAUTH_SIGNOUT_EXCEPTION,message:"An error occurred when attempting to log out from OAuth provider."})}else W.tokenOrchestrator.clearTokens(),await B(),G.Hub.dispatch("auth",{event:"signedOut"},"Auth",G.AMPLIFY_SYMBOL)}async function eo(e){try{let{userPoolEndpoint:t,userPoolId:r,userPoolClientId:i}=e,o=await W.tokenOrchestrator.getTokenStore().loadTokens();if((0,b.assertAuthTokensWithRefreshToken)(o),es(o.accessToken)){let e,n=(e={endpointResolver:(0,L.createCognitoUserPoolEndpointResolver)({endpointOverride:t})},(0,x.composeServiceApi)(O.cognitoUserPoolTransferHandler,(0,F.createUserPoolSerializer)("RevokeToken"),(0,D.createUserPoolDeserializer)(),{...k.DEFAULT_SERVICE_CLIENT_API_CONFIG,...e}));await n({region:(0,N.getRegionFromUserPoolId)(r),userAgentValue:(0,U.getAuthUserAgentValue)(P.AuthAction.SignOut)},{ClientId:i,Token:o.refreshToken})}}catch(e){er.debug("Client signOut error caught but will proceed with token removal")}}async function en(e){try{let t,{userPoolEndpoint:r,userPoolId:i}=e,o=await W.tokenOrchestrator.getTokenStore().loadTokens();(0,b.assertAuthTokens)(o);let n=(t={endpointResolver:(0,L.createCognitoUserPoolEndpointResolver)({endpointOverride:r})},(0,x.composeServiceApi)(O.cognitoUserPoolTransferHandler,(0,F.createUserPoolSerializer)("GlobalSignOut"),(0,D.createUserPoolDeserializer)(),{...k.DEFAULT_SERVICE_CLIENT_API_CONFIG,...t}));await n({region:(0,N.getRegionFromUserPoolId)(i),userAgentValue:(0,U.getAuthUserAgentValue)(P.AuthAction.SignOut)}
3,{AccessToken:o.accessToken.toString()})}catch(e){er.debug("Global signOut error caught but will proceed with token removal")}}let es=e=>!!e?.payload?.origin_jti;var ea=e.i(46384),ec=e.i(423299);async function el(){let e,t=w.Amplify.getConfig().Auth?.Cognito;(0,_.assertTokenProviderConfig)(t);let{userPoolEndpoint:r,userPoolId:i}=t,{tokens:o}=await (0,C.fetchAuthSession)();(0,b.assertAuthTokens)(o);let n=(e={endpointResolver:(0,L.createCognitoUserPoolEndpointResolver)({endpointOverride:r})},(0,x.composeServiceApi)(O.cognitoUserPoolTransferHandler,(0,F.createUserPoolSerializer)("DeleteUser"),async e=>{if(e.statusCode>=300){let t=await (0,ea.parseJsonError)(e);throw(0,ec.assertServiceError)(t),new H.AuthError({name:t.name,message:t.message})}},{...k.DEFAULT_SERVICE_CLIENT_API_CONFIG,...e}));await n({region:(0,N.getRegionFromUserPoolId)(i),userAgentValue:(0,U.getAuthUserAgentValue)(P.AuthAction.DeleteUser)},{AccessToken:o.accessToken.toString()}),await W.tokenOrchestrator.clearDeviceMetadata(),await ei()}var eu=e.i(347344),ed=e.i(845250),ep=e.i(121348),eh=e.i(62242),eg=e.i(553774),ef=e.i(402524),eE=e.i(799895),em=e.i(100498),ey=e.i(550781);new V.ConsoleLogger("AuthError");let eS={oauthSignInError:{message:ey.AuthErrorStrings.OAUTH_ERROR,log:"Make sure Cognito Hosted UI has been configured correctly"},noConfig:{message:ey.AuthErrorStrings.DEFAULT_MSG,log:`
4            Error: Amplify has not been configured correctly.
5            This error is typically caused by one of the following scenarios:
6
7            1. Make sure you're passing the awsconfig object to Amplify.configure() in your app's entry point
8                See https://aws-amplify.github.io/docs/js/authentication#configure-your-app for more information
9            
10            2. There might be multiple conflicting versions of amplify packages in your node_modules.
11				Refer to our docs site for help upgrading Amplify packages (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js)
12        `},missingAuthConfig:{message:ey.AuthErrorStrings.DEFAULT_MSG,log:`
13            Error: Amplify has not been configured correctly. 
14            The configuration object is missing required auth properties.
15            This error is typically caused by one of the following scenarios:
16
17            1. Did you run \`amplify push\` after adding auth via \`amplify add auth\`?
18                See https://aws-amplify.github.io/docs/js/authentication#amplify-project-setup for more information
19
20            2. This could also be caused by multiple conflicting versions of amplify packages, see (https://docs.amplify.aws/lib/troubleshooting/upgrading/q/platform/js) for help upgrading Amplify packages.
21        `},emptyUsername:{message:ey.AuthErrorStrings.EMPTY_USERNAME},invalidUsername:{message:ey.AuthErrorStrings.INVALID_USERNAME},emptyPassword:{message:ey.AuthErrorStrings.EMPTY_PASSWORD},emptyCode:{message:ey.AuthErrorStrings.EMPTY_CODE},signUpError:{message:ey.AuthErrorStrings.SIGN_UP_ERROR,log:"The first parameter should either be non-null string or object"},noMFA:{message:ey.AuthErrorStrings.NO_MFA},invalidMFA:{message:ey.AuthErrorStrings.INVALID_MFA},emptyChallengeResponse:{message:ey.AuthErrorStrings.EMPTY_CHALLENGE},noUserSession:{message:ey.AuthErrorStrings.NO_USER_SESSION},deviceConfig:{message:ey.AuthErrorStrings.DEVICE_CONFIG},networkError:{message:ey.AuthErrorStrings.NETWORK_ERROR},autoSignInError:{message:ey.AuthErrorStrings.AUTOSIGNIN_ERROR},default:{message:ey.AuthErrorStrings.DEFAULT_MSG}},eA=(e,t)=>new H.AuthError({message:e??"An error has occurred during the oauth process.",name:ey.AuthErrorCodes.OAuthSignInError,recoverySuggestion:t??eS.oauthSignInError.log});(t=n||(n={})).NoConfig="noConfig",t.MissingAuthConfig="missingAuthConfig",t.EmptyUsername="emptyUsername",t.InvalidUsername="invalidUsername",t.EmptyPassword="emptyPassword",t.EmptyCode="emptyCode",t.SignUpError="signUpError",t.NoMFA="noMFA",t.InvalidMFA="invalidMFA",t.EmptyChallengeResponse="emptyChallengeResponse",t.NoUserSession="noUserSession",t.Default="default",t.DeviceConfig="deviceConfig",t.NetworkError="networkError",t.AutoSignInError="autoSignInError",t.OAuthSignInError="oauthSignInError";let eI=async e=>{let t=await ep.oAuthStore.loadOAuthState(),r=e===t?t:void 0;if(!r)throw new H.AuthError({name:n.OAuthSignInError,message:null===e?"`signInWithRedirect` has been canceled.":"An error occurred while validating the state.",recoverySuggestion:null===e?void 0:"Try to initiate an OAuth flow from Amplify"});return r},ev=async({currentUrl:e,userAgentValue:t,clientId:r,redirectUri:i,responseType:o,domain:n,preferPrivateSession:s})=>{let a=new eh.AmplifyUrl(e),c=a.searchParams.get("error"),l=a.searchParams.get("error_description");if(c)throw eA(l??c);return"code"===o?ew({currentUrl:e,userAgentValue:t,clientId:r,redirectUri:i,domain:n,preferPrivateSession:s}):eC({currentUrl:e,redirectUri:i,preferPrivateSession:s})},ew=async({currentUrl:e,userAgentValue:t,clientId:r,redirectUri:i,domain:o,preferPrivateSession:n})=>{let s=new eh.AmplifyUrl(e),a=s.searchParams.get("code"),c=s.searchParams.get("state");if(!a||!c)throw eA("User cancelled OAuth flow.");let l=await eI(c),u=await ep.oAuthStore.loadPKCE(),d=Object.entries({grant_type:"authorization_code",code:a,client_id:r,redirect_uri:i,...u?{code_verifier:u}:{}}).map(([e,t])=>`${encodeURIComponent(e)}=${encodeURIComponent(t)}`).join("&"),{access_token:p,refresh_token:h,id_token:g,error:f,error_message:E,token_type:m,expires_in:y}=await (await fetch("https://"+o+"/oauth2/token",{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded",[eg.USER_AGENT_HEADER]:t},body:d})).json();if(f)throw eA(E??f);let S=(p&&(0,_.decodeJWT)(p).payload.username)??"username";return await (0,ef.cacheCognitoTokens)({username:S,AccessToken:p,IdToken:g,RefreshToken:h}),e_({redirectUri:i,state:l,preferPrivateSession:n})},eC=async({currentUrl:e,redirectUri:t,preferPrivateSession:r})=>{let{id_token:i,access_token:o,state:n,token_type:s,expires_in:a,error_description:c,error:l}=(new eh.AmplifyUrl(e).hash??"#").substring(1).split("&").map(e=>e.split("=")).reduce((e,[t,r])=>({...e,[t]:r}),{id_token:void 0,access_token:void 0,state:void 0,token_type:void 0,expires_in:void 0,error_description:void 0,error:void 0});if(l)throw eA(c??l);if(!o)throw eA("No access token returned from OAuth flow.");let u=await eI(n),d=(o&&(0,_.decodeJWT)(o).payload.username)??"username";return await (0,ef.cacheCognitoTokens)({username:d,AccessToken:o,IdToken:i}),e_({redirectUri:t,state:u,preferPrivateSession:r})},e_=async({redirectUri:e,state:t,preferPrivateSession:r})=>{await W.tokenOrchestrator.setOAuthMetadata({oauthSignIn:!0}),await ep.oAuthStore.clearOAuthData(),await ep.oAuthStore.storeOAuthSignIn(!0,r),(0,em.resolveAndClearInflightPromises)(),eT(e),eP(t)&&G.Hub.dispatch("auth",{event:"customOAuthState",data:(eR(t).match(/.{2}/g)||[]).map(e=>String.fromCharCode(parseInt(e,16))).join("")},"Auth",G.AMPLIFY_SYMBOL),G.Hub.dispatch("auth",{event:"signInWithRedirect"},"Auth",G.AMPLIFY_SYMBOL),await (0,eE.dispatchSignedInHubEvent)()},eP=e=>/-/.test(e),eR=e=>e.split("-").splice(1).join("-"),eT=e=>{"u">typeof window&&void 0!==window.history&&window.history.replaceState(window.history.state,"",e)},eN=async e=>{(0,em.resolveAndClearInflightPromises)(),await ep.oAuthStore.clearOAuthInflightData(),G.Hub.dispatch("auth",{event:"signInWithRedirect_failure",data:{error:e}},"Auth",G.AMPLIFY_SYMBOL)},eb=async e=>{try{(0,_.assertTokenProviderConfig)(e),(0,_.assertOAuthConfig)(e),ep.oAuthStore.setAuthConfig(e)}catch(e){return}if(await ep.oAuthStore.loadOAuthInFlight())try{let t=window.location.href,{loginWith:r,userPoolClientId:i}=e,{domain:o,redirectSignIn:n,responseType:s}=r.oauth,a=Y(n);await ev({currentUrl:t,clientId:i,domain:o,redirectUri:a,responseType:s,userAgentValue:(0,U.getAuthUserAgentValue)(P.AuthAction.SignInWithRedirect)})}catch(e){await eN(e)}};(0,eu.isBrowser)()&&w.Amplify[ed.ADD_OAUTH_LISTENER](eb);let eU={Google:"Google",Facebook:"Facebook",Amazon:"LoginWithAmazon",Apple:"Sign
21InWithApple"};var ex=e.i(508718),eO=e.i(860781),eF=e.i(911476),eD=e.i(228239);let ek="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";async function eL(e){let t,r=w.Amplify.getConfig().Auth?.Cognito;(0,_.assertTokenProviderConfig)(r),(0,_.assertOAuthConfig)(r),ep.oAuthStore.setAuthConfig(r),e?.options?.prompt||await (0,ex.assertUserNotAuthenticated)();let i="COGNITO";return"string"==typeof e?.provider?i=eU[e.provider]:e?.provider?.custom?i=e.provider.custom:e?.provider?.idpIdentifier&&({idpIdentifier:t}=e.provider),eM({oauthConfig:r.loginWith.oauth,clientId:r.userPoolClientId,provider:i,idpIdentifier:t,customState:e?.customState,preferPrivateSession:e?.options?.preferPrivateSession,options:{loginHint:e?.options?.loginHint,lang:e?.options?.lang,nonce:e?.options?.nonce,prompt:e?.options?.prompt},authSessionOpener:e?.options?.authSessionOpener})}let eM=async({oauthConfig:e,provider:t,idpIdentifier:r,clientId:i,customState:o,preferPrivateSession:n,options:s,authSessionOpener:a})=>{let{domain:c,redirectSignIn:l,responseType:u,scopes:d}=e,{loginHint:p,lang:h,nonce:g,prompt:f}=s??{},E=(e=>{let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=[],i=new Uint8Array(e);for(let e of((0,eF.getCrypto)().getRandomValues(i),i))r.push(t[e%t.length]);return r.join("")})(32),m=o?`${E}-${o.split("").map(e=>e.charCodeAt(0).toString(16).padStart(2,"0")).join("")}`:E,{value:y,method:S,toCodeChallenge:A}=(e=>{let t,r=new Uint8Array(e);(0,eF.getCrypto)().getRandomValues(r);let i="";for(let e of r)i+=ek.charAt(e%ek.length);return{value:i,method:"S256",toCodeChallenge:()=>{var e;let r;return t||(e=i,(r=new eO.Sha256).update(e),t=eD.base64Encoder.convert(r.digestSync(),{urlSafe:!0}).replace(/=/g,""))}}})(128),I=Y(e.redirectSignIn);(0,eu.isBrowser)()&&ep.oAuthStore.storeOAuthInFlight(!0),ep.oAuthStore.storeOAuthState(m),ep.oAuthStore.storePKCE(y);let v=new URLSearchParams;v.append("redirect_uri",I),v.append("response_type",u),v.append("client_id",i),r?v.append("idp_identifier",r):v.append("identity_provider",t),v.append("scope",d.join(" ")),p&&v.append("login_hint",p),h&&v.append("lang",h),g&&v.append("nonce",g),f&&v.append("prompt",f.toLowerCase()),v.append("state",m),"code"===u&&(v.append("code_challenge",A()),v.append("code_challenge_method",S));let w=`https://${c}
21/oauth2/authorize?${v.toString()}`;var C=ep.oAuthStore;async function _(e){if(e.persisted&&await C.loadOAuthInFlight()){let e=eA("User cancelled OAuth flow.");await eN(e)}window.removeEventListener("pageshow",_)}window.addEventListener("pageshow",_);let{type:R,error:T,url:N}=await (a||$)(w,l,n)??{};try{if("error"===R)throw eA(String(T));if("canceled"===R)throw eA(String(R));"success"===R&&N&&await ev({currentUrl:N,clientId:i,domain:c,redirectUri:I,responseType:u,userAgentValue:(0,U.getAuthUserAgentValue)(P.AuthAction.SignInWithRedirect),preferPrivateSession:n})}catch(e){throw await eN(e),e}};var eV=e.i(955374);let eB=async e=>{var t,r;let i,o,n,{userAttributes:s,options:a}=e,c=w.Amplify.getConfig().Auth?.Cognito,l=a?.clientMetadata;(0,_.assertTokenProviderConfig)(c);let{userPoolEndpoint:u,userPoolId:d}=c,{tokens:p}=await (0,C.fetchAuthSession)({forceRefresh:!1});(0,b.assertAuthTokens)(p);let h=(n={endpointResolver:(0,L.createCognitoUserPoolEndpointResolver)({endpointOverride:u})},(0,x.composeServiceApi)(O.cognitoUserPoolTransferHandler,(0,F.createUserPoolSerializer)("UpdateUserAttributes"),(0,D.createUserPoolDeserializer)(),{...k.DEFAULT_SERVICE_CLIENT_API_CONFIG,...n})),{CodeDeliveryDetailsList:g}=await h({region:(0,N.getRegionFromUserPoolId)(d),userAgentValue:(0,U.getAuthUserAgentValue)(P.AuthAction.UpdateUserAttributes)},{AccessToken:p.accessToken.toString(),ClientMetadata:l,UserAttributes:(0,eV.toAttributeType)(s)});return{...(t=s,i={},Object.keys(t)?.forEach(e=>{i[e]={isUpdated:!0,nextStep:{updateAttributeStep:"DONE"}}}),i),...(r=g,o={},r?.forEach(e=>{let{AttributeName:t,DeliveryMedium:r,Destination:i}=e;t&&(o[t]={isUpdated:!1,nextStep:{updateAttributeStep:"CONFIRM_ATTRIBUTE_WITH_CODE",codeDeliveryDetails:{attributeName:t,deliveryMedium:r,destination:i}}})}),o)}},eG=async e=>{let{userAttribute:{attributeKey:t,value:r},options:i}=e;return Object.values(await eB({userAttributes:{[t]:r},options:i}))[0]};async function eq(e){let t,r=w.Amplify.getConfig().Auth?.Cognito;(0,_.assertTokenProviderConfig)(r);let{userPoolEndpoint:i,userPoolId:o}=r,{confirmationCode:n,userAttributeKey:s}=e;(0,T.assertValidationError)(!!n,R.AuthValidationErrorCode.EmptyConfirmUserAttributeCode);let{tokens:a}=await (0,C.fetchAuthSession)({forceRefresh:!1});(0,b.assertAuthTokens)(a);let c=(t={endpointResolver:(0,L.createCognitoUserPoolEndpointResolver)({endpointOverride:i})},(0,x.composeServiceApi)(O.cognitoUserPoolTransferHandler,(0,F.createUserPoolSerializer)("VerifyUserAttribute"),(0,D.createUserPoolDeserializer)(),{...k.DEFAULT_SERVICE_CLIENT_API_CONFIG,...t}));await c({region:(0,N.getRegionFromUserPoolId)(o),userAgentValue:(0,U.getAuthUserAgentValue)(P.AuthAction.ConfirmUserAttribute)},{AccessToken:a.accessToken.toString(),AttributeName:s,Code:n})}class eH extends Error{email;constructor(e){super(`Email verification required for ${e}`),this.name=s.DomainErrorName.UserNotConfirmed,this.email=e}}class eK extends Error{email;constructor(e){super(`Password reset required for ${e}`),this.name=s.DomainErrorName.PasswordResetRequired,this.email=e}}class eW extends Error{constructor(){super("Apple Hide My Email cannot be used with an existing account"),this.name=s.DomainErrorName.PrivateEmailExposed}}var ez=((r={}).UserNotConfirmed="UserNotConfirmedException",r.NotAuthorized="NotAuthorizedException",r.UserNotFound="UserNotFoundException",r.PasswordResetRequired="PasswordResetRequiredException",r.UsernameExists="UsernameExistsException",r.InvalidPassword="InvalidPasswordException",r.InvalidParameter="InvalidParameterException",r.CodeMismatch="CodeMismatchException",r.ExpiredCode="ExpiredCodeException",r.LimitExceeded="LimitExceededException",r.TooManyRequests="TooManyRequestsException",r.UserAlreadyAuthenticated="UserAlreadyAuthenticatedException",r),e$=((i={}).ConfirmSignUp="CONFIRM_SIGN_UP",i.NewPasswordRequired="CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED",i),ej=((o={}).UserPasswordAuth="USER_PASSWORD_AUTH",o.UserSrpAuth="USER_SRP_AUTH",o);let eY={[ez.NotAuthorized]:s.LocaleKey.InvalidPassword,[ez.UserNotFound]:s.LocaleKey.InvalidPassword,[ez.UsernameExists]:s.LocaleKey.EmailTaken,[ez.InvalidPassword]:s.LocaleKey.InvalidPasswordFormat,[ez.CodeMismatch]:s.LocaleKey.InvalidCode,[ez.ExpiredCode]:s.LocaleKey.ExpiredCode};function eJ(e,t,r=s.LocaleKey.Other){if(e instanceof eH)throw e;let i=e?.name;if(i&&i in eY)throw Error(t(eY[i]));if(e instanceof Error)throw e;throw Error(t(r))}let eQ="signInWithRedirect",eX="signInWithRedirect_failure";class eZ{cognitoConfig;tenant;constructor(e,t){this.cognitoConfig=e,this.tenant=t}
21get clientMetadata(){let e={tenant:this.tenant};if("u">typeof document){let t=document.documentElement.lang;t&&(e.locale=t)}return e}async signIn(e,t){let r=(await (0,m.signIn)({username:e,password:t,options:{authFlowType:ej.UserPasswordAuth}})).nextStep.signInStep;return r===e$.ConfirmSignUp?{step:s.IdpSignInStep.RequiresEmailVerification}:r===e$.NewPasswordRequired?{step:s.IdpSignInStep.RequiresNewPassword}:{step:s.IdpSignInStep.SignInComplete}}async signUp(e,t,r){return{complete:(await (0,y.signUp)({username:e,password:t,options:{userAttributes:{email:r.email,given_name:r.givenName,family_name:r.familyName,...r.phoneNumber?{phone_number:r.phoneNumber}:{},"custom:tenant":this.tenant},clientMetadata:this.clientMetadata}})).isSignUpComplete}}async confirmSignUp(e,t){return{complete:(await (0,S.confirmSignUp)({username:e,confirmationCode:t,options:{clientMetadata:this.clientMetadata}})).isSignUpComplete}}async resendSignUpCode(e){await (0,A.resendSignUpCode)({username:e,options:{clientMetadata:this.clientMetadata}})}async resetPassword(e){await (0,I.resetPassword)({username:e,options:{clientMetadata:this.clientMetadata}})}async confirmResetPassword(e,t,r){await (0,v.confirmResetPassword)({username:e,confirmationCode:t,newPassword:r,options:{clientMetadata:this.clientMetadata}})}async updatePassword(e,t){await M({oldPassword:e,newPassword:t})}async signOut(e){await ei(e?{global:!1,oauth:{redirectUrl:e}}:{global:!1})}async signOutLocally(){let{tokenOrchestrator:e}=W.cognitoUserPoolsTokenProvider;e.clearTokens(),await B(),G.Hub.dispatch("auth",{event:"signedOut"},"Auth",G.AMPLIFY_SYMBOL)}async deleteUser(){await el()}async socialRedirect(e,t){await eL({provider:e,customState:t,options:"Google"===e?{prompt:"SELECT_ACCOUNT"}:void 0})}async getIdToken(){let e=await (0,C.fetchAuthSession)(),t=e.tokens?.idToken?.toString();if(!t)throw Error("No active session: ID token unavailable.");return t}async getTokenEmail(){try{let e=await (0,C.fetchAuthSession)(),t=e.tokens?.idToken?.payload?.email;return"string"==typeof t?t:null}catch{return null}}async getTokenProfile(){try{let e=await (0,C.fetchAuthSession)(),t=e.tokens?.idToken?.payload,r="string"==typeof t?.given_name?t.given_name:null,i="string"==typeof t?.family_name?t.family_name:null;return{firstName:r,lastName:i}}catch{return{firstName:null,lastName:null}}}async getSignInProvider(e){try{let t=await (0,C.fetchAuthSession)(),r=t.tokens?.idToken?.payload?.identities;if(Array.isArray(r)&&r.length>0){let t=r[0].providerName??null;return e?.log(s.IdpEvent.GetSignInProvider,{provider:t}),t}return e?.log(s.IdpEvent.GetSignInProvider,{provider:null}),null}catch{return e?.log(s.IdpEvent.GetSignInProviderNoSession),null}}async updateProfileAttributes(e){let t={};void 0!==e.givenName&&(t.given_name=e.givenName),void 0!==e.familyName&&(t.family_name=e.familyName),void 0!==e.phoneNumber&&(t.phone_number=e.phoneNumber),Object.keys(t).length>0&&await eB({userAttributes:t})}async updateEmailAttribute(e){await eG({userAttribute:{attributeKey:"email",value:e}})}async confirmEmailAttribute(e){await eq({userAttributeKey:"email",confirmationCode:e})}async probeUserStatus(e){let t=this.cognitoConfig;if(!t.region||!t.clientId)return s.ProbeStatus.AccountReady;let r=new Uint8Array(256);crypto.getRandomValues(r);let i=Array.from(r,e=>e.toString(16).padStart(2,"0")).join("");try{let r=await fetch(`https://cognito-idp.${t.region}.amazonaws.com/`,{method:"POST",headers:{"X-Amz-Target":"AWSCognitoIdentityProviderService.InitiateAuth","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify({AuthFlow:ej.UserSrpAuth,ClientId:t.clientId,AuthParameters:{USERNAME:e,SRP_A:i}})});if(!r.ok){let e=(await r.json().catch(()=>({}))).__type??"";if(e===ez.PasswordResetRequired)return s.ProbeStatus.RequiresPasswordReset;if(e===ez.UserNotConfirmed)return s.ProbeStatus.RequiresEmailVerification;if(e===ez.UserNotFound)return s.ProbeStatus.UserNotFound;return s.ProbeStatus.Unknown}return s.ProbeStatus.AccountReady}catch{return s.ProbeStatus.Unknown}}onOAuthRedirectComplete(e,t){let r=G.Hub.listen("auth",({payload:i})=>{if(i.event===eQ&&(r(),e()),i.event===eX){r();let e=i.data;t(e?.error?.message??"Social sign-in failed")}});return r}}var e0=e.i(210650);function e1(e){let t=e?.data?.attributes;
21if(!t)throw Error("Unable to exchange token: invalid token exchange response.");return{id:e.data.id,firstName:t["first-name"],lastName:t["last-name"],homePhone:t["home-phone"],email:t.email,jwt:t.jwt,newsletter:t.newsletter,ssoProvider:t["sso-provider"],hasPassword:t["has-password"],hideImagelessListings:t["hide-imageless-listings"]??!1,locale:t.locale??""}}async function e2(e,t,r,i){let o={};r?.phone&&(o.phone=r.phone),r?.profile&&(o["first-name"]=r.profile.firstName,o["last-name"]=r.profile.lastName);let n=!!(r&&(r.phone||r.profile));try{i?.log(s.TokenExchangeStep.Request,{hasFields:n});let r=await e.request("/services/api/v4/auth/token_exchange","POST",n?o:void 0,{Authorization:`Bearer ${t}`}),a=e1(r);return i?.log(s.TokenExchangeStep.Success,{userId:a.id,email:a.email,ssoProvider:a.ssoProvider}),{user:a,needsPhone:!1,idToken:t}}catch(r){if(r instanceof e0.HttpResponseError&&"registration_required"===r.code)return i?.log(s.TokenExchangeStep.RegistrationRequired),{needsPhone:!0,idToken:t};let e=r instanceof Error?r.message:String(r);throw i?.log(s.TokenExchangeStep.Error,{error:e}),r}}async function e5(e,t,r,i,o){o?.log(s.TokenExchangeStep.SubmitPhoneRequest,{phone:"***"});let n={phone:r};i&&(n["first-name"]=i.firstName,n["last-name"]=i.lastName);let a=e1(await e.request("/services/api/v4/auth/token_exchange","POST",n,{Authorization:`Bearer ${t}`}));return o?.log(s.TokenExchangeStep.SubmitPhoneSuccess,{userId:a.id,email:a.email}),a}async function e6(e,t,r,i,o,n,a,c=0){try{a?.log(s.IdpSignInStep.SignInAttempt,{email:r.replace(/(.{2}).*(@.*)/,"$1***$2")});let n=await e.signIn(r,i);if(n.step===s.IdpSignInStep.RequiresEmailVerification)throw new eH(r);if(n.step===s.IdpSignInStep.RequiresNewPassword)throw new eK(r);let c=await e.getIdToken(),l=await e2(t,c,o,a);if(l.needsPhone)return{needsPhone:!0};if(!l.user)throw Error("invalid token exchange response");return{user:l.user,needsPhone:!1}}catch(u){if(u instanceof eH||u instanceof eK)throw u;let l=u?.name;if(l===ez.UserNotConfirmed)throw new eH(r);if(l===ez.PasswordResetRequired)throw new eK(r);if(l===ez.UserAlreadyAuthenticated){c>=1&&eJ(u,n);try{await e.signOutLocally()}catch(e){a?.log(s.IdpSignInStep.ClearStaleSessionError,{error:e instanceof Error?e.message:String(e)})}return e6(e,t,r,i,o,n,a,c+1)}eJ(u,n)}}function e8(e){let t=e.replace(/\D/g,"");return 10===t.length?`+1${t}`:(11===t.length&&t.startsWith("1"),`+${t}`)}var e3=e.i(544211);async function e4(e,t,r,i){try{return await e.updatePassword(t,r),{success:i(e3.AUTH_LOCALE_KEYS.PASSWORD_CHANGED_SUCCESS)}}catch{return{error:i(e3.AUTH_LOCALE_KEYS.INVALID_PASSWORD)}}}async function e7(e,t,r){try{return await e.resetPassword(t),{success:r(e3.AUTH_LOCALE_KEYS.PASSWORD_RESET_EMAIL_SENT),nextStep:"confirm_in_app"}}catch{return{error:r(e3.AUTH_LOCALE_KEYS.INVALID_EMAIL)}}}async function e9(e,t,r,i,o){try{return await e.confirmResetPassword(t,r,i),{success:o(e3.AUTH_LOCALE_KEYS.PASSWORD_CHANGED_SUCCESS)}}catch{return{error:o(e3.AUTH_LOCALE_KEYS.RESET_TOKEN_INVALID)}}}function te(e){return e.toLowerCase().endsWith("@privaterelay.appleid.com")}e.s(["isPrivateRelayEmail",0,te],504155);let tt={google:"Google",facebook:"Facebook",apple:"Apple"};async function tr(e,t,r){await e.socialRedirect(tt[t],r)}async function ti(e,t,r,i){let o;i?.log(s.SocialFlowStatus.AuthenticateAfterRedirect,{provider:r});let n=await e.getIdToken(),{firstName:a,lastName:c}=await e.getTokenProfile();(a||c)&&(o={profile:{firstName:a??"",lastName:c??""}},i?.log(s.SocialFlowStatus.ProfileForwarded,{provider:r,hasFirstName:!!a,hasLastName:!!c}));let l=await e2(t,n,o,i);if(l.needsPhone)return{needsPhone:!0,profile:a||c?{firstName:a??"",lastName:c??""}:void 0};if(!l.user)throw Error("Unable to complete social authentication: missing user.");return"apple"===r&&await to(e,l.user.email,i),{user:l.user}}async function to(e,t,r){let i=await e.getTokenEmail();if(i&&te(i)&&i.toLowerCase()!==t.toLowerCase())throw r?.log(s.SocialFlowStatus.PrivateEmailExposed,{tokenEmail:i,responseEmail:t}),new eW}async function tn(e,t,r){let i;try{r?.log(s.SessionStep.Refresh),i=await e.getIdToken()}catch{return r?.log(s.SessionStep.RefreshNoSession),null}let o=await e2(t,i,void 0,r);if(o.needsPhone)return{needsPhone:!0};if(!o.user)throw Error("invalid token exchange response");return{user:o.user,needsPhone:!1}}async function ts(e,t,r,i){r?.log(s.SessionStep.SignOut);try{await e.signOut(i)}finally{try{await t.request("/services/api/v3/users/logout","DELETE")}catch(e){r?.log(s.SessionStep.SignOutError,{error:e instanceof Error?e.message:String(e)})}}}async function ta(e,t,r,i,o){o?.log(s.SessionStep.SubmitPhone);let n=await e.getIdToken();return{user:await e5(t,n,r,i,o)}}var tc=e.i(781800);async function tl(e,t,r){r?.log(s.DeleteAccountStep.Request);let i=await e.getIdToken();await t.request("/services/api/v4/auth/account","DELETE",void 0,{Authorization:`Bearer ${i}`}),await e.deleteUser(),r?.log(s.DeleteAccountStep.Success)}async function tu(e,t,r){let i=r.homePhone||void 0;return await e.updateProfileAttributes({givenName:r.firstName,familyName:r.lastName,phoneNumber:i?e8(i):void 0}),await t.request(`/services/api/v3/users/${r.id}`,"PATCH",{data:{attributes:(0,h.dasherizeKeys)(r)}}),{success:!0}}async function td(e,t,r,i,o,n,s){await e.updateEmailAttribute(i);let a={data:{type:"users",attributes:{currentEmail:r.email,email:i,emailConfirmation:o,password:n,passwordConfirmation:s}}};return await t.request("/services/api/v3/users/email","PATCH",a),{success:!0}}async function tp(e,t){return await e.confirmEmailAttribute(t),{success:!0}}class th{idp;http;clientAppHttp;t;logger;observability;signUpFlow;amplifyConfigured;cognitoConfig;supportedFeatures=E.COGNITO_FEATURES;constructor(e){this.cognitoConfig=e.cognitoConfig,this.amplifyConfigured=e.amplifyConfigured??!1,this.idp=new eZ(e.cognitoConfig,e.tenant),this.http=e.http,this.clientAppHttp=e.clientAppHttp,this.t=e.translation.t,this.logger=e.logger,this.observability=e.observability,this.signUpFlow=function(e,t,r,i){let o=null;return{async signUp(n){o=n;try{if(i?.log(s.SignUpStep.Attempt,{email:n.email.replace(/(.{2}).*(@.*)/,"$1***$2")}),!(await e.signUp(n.email,n.password,{email:n.email,givenName:n.firstName,familyName:n.lastName,phoneNumber:n.homePhone?e8(n.homePhone):void 0})).complete)return{status:s.SignUpStatus.RequiresEmailVerification};let o=await e6(e,t,n.email,n.password,{phone:n.homePhone,profile:{firstName:n.firstName,lastName:n.lastName}},r,i);if(o.user)return{status:s.SignUpStatus.Confirmed,user:o.user};return{status:s.SignUpStatus.Incomplete}}catch(o){if(o?.name===ez.UsernameExists)try{let o=await e6(e,t,n.email,n.password,{phone:n.homePhone,profile:{firstName:n.firstName,lastName:n.lastName}},r,i);if(o.user)return{status:s.SignUpStatus.Confirmed,user:o.user};return{status:s.SignUpStatus.Incomplete}}catch(t){if(t?.name===ez.UserNotConfirmed)return e.resendSignUpCode(n.email).catch(e=>{i?.log(s.SignUpStep.ResendCodeError,{error:e instanceof Error?e.message:String(e)})}),{status:s.SignUpStatus.RequiresEmailVerification};throw t}eJ(o,r)}},async confirmSignUp(n,a){try{if(i?.log(s.SignUpStep.Confirm,{email:n.replace(/(.{2}).*(@.*)/,"$1***$2")}),!(await e.confirmSignUp(n,a)).complete)return{status:s.SignUpStatus.RequiresEmailVerification};let c=o;if(c?.password){let a=await e6(e,t,n,c.password,{phone:c.homePhone,profile:{firstName:c.firstName,lastName:c.lastName}},r,i);if(a.user)return o=null,{status:s.SignUpStatus.Confirmed,user:a.user}}return o=null,{status:s.SignUpStatus.Incomplete}}catch(e){eJ(e,r)}},async resendSignUpCode(t){try{await e.resendSignUpCode(t)}catch(e){eJ(e,r)}}}}(this.idp,this.http,this.t,this.logger)}async checkClientAppUser(e){try{let t=await (0,tc.fetchClientAppUserStatus)(this.clientAppHttp,{email:e});return{exists:t.isExisting,firstName:t.firstName,authMethods:t.authMethods}}catch(e){return this.observability?.dispatch({type:"email_lookup_failure",error:e}),{exists:!1,firstName:"",authMethods:[]}}}async checkCognitoUser(e){try{switch(await this.idp.probeUserStatus(e)){case s.ProbeStatus.RequiresPasswordReset:return"PasswordResetRequiredException";case s.ProbeStatus.RequiresEmailVerification:return"UserNotConfirmedException";case s.ProbeStatus.UserNotFound:return"UserNotFoundException";case s.ProbeStatus.AccountReady:return"AccountReady";case s.ProbeStatus.Unknown:return this.observability?.dispatch({type:"idp_probe_failure",error:Error("Cognito probe returned unknown status")}),"AccountReady"}}catch(e){return this.observability?.dispatch({type:"idp_probe_failure",error:e}),"AccountReady"}}async signIn(e,t){try{let r=await e6(this.idp,this.http,e,t,void 0,this.t,this.logger);if(r.needsPhone)return{needsPhone:!0};return{user:r.user}}catch(e){throw this.observability?.dispatch({type:"signin_failure",error:e}),e}}async signUp(e){try{return await this.signUpFlow.signUp(e)}catch(e){throw this.observability?.dispatch({type:"register_failure",error:e}),e}}async confirmSignUp(e,t){try{return await this.signUpFlow.confirmSignUp(e,t)}catch(e){throw this.observability?.dispatch({type:"register_failure",error:e}),e}}async resendSignUpCode(e){try{return await this.signUpFlow.resendSignUpCode(e)}catch(e){throw this.observability?.dispatch({type:"register_failure",error:e}),e}}async signOut(e){try{return await ts(this.idp,this.clientAppHttp,this.logger,e)}catch(e){throw this.observability?.dispatch({type:"signout_failure",error:e}),e}}async validateUser(e){let t={isExisting:!1,authMethods:[],firstName:"",themeData:{}},r=null;try{r=await (0,tc.fetchClientAppUserStatus)(this.clientAppHttp,e)}catch(e){this.observability?.dispatch({type:"email_lookup_failure",error:e})}if(e.email)try{let i=await this.idp.probeUserStatus(e.email),o=r??t;switch(i){case s.ProbeStatus.RequiresPasswordReset:return{...o,isExisting:!0,authMethods:o.authMethods.length?o.authMethods:["password"],authFlow:s.AuthFlow.RequiresPasswordReset};case s.ProbeStatus.RequiresEmailVerification:return{...o,isExisting:!0,authFlow:s.AuthFlow.RequiresEmailVerification};case s.ProbeStatus.UserNotFound:return{...o,isExisting:!1};case s.ProbeStatus.AccountReady:return{...o,isExisting:!0,authMethods:o.authMethods.length?o.authMethods:["password"]};case s.ProbeStatus.Unknown:this.observability?.dispatch({type:"idp_probe_failure",error:Error("Cognito probe returned unknown status")})}}catch(e){this.observability?.dispatch({type:"idp_probe_failure",error:e})}return r||t}async idpRedirectSignIn(e,t){if(!this.amplifyConfigured)throw Error("Cognito is not configured (missing COGNITO_USER_POOL_ID / COGNITO_CLIENT_ID). Social sign-in is unavailable.");try{return await tr(this.idp,e,t)}catch(r){if(r?.name!==ez.UserAlreadyAuthenticated)throw r;return this.logger?.log(ez.UserAlreadyAuthenticated,{provider:e}),await this.idp.signOutLocally(),tr(this.idp,e,t)}}async legacySocialSignIn(){throw Error("legacySocialSignIn is not supported by CognitoAuthService. Use idpRedirectSignIn instead.")}async authenticateAfterRedirect(e){try{let t=await ti(this.idp,this.http,e,this.logger);if(t.needsPhone){let e="profile"in t?t.profile:void 0;return{needsPhone:!0,profile:e}}return{user:t.user}}catch(t){throw this.observability?.dispatch({type:"signin_failure",error:t,authMethod:e}),t}}async forgotPassword(e,t){try{let t=await e7(this.idp,e,this.t);return t.error&&this.observability?.dispatch({type:"signin_failure",error:Error(t.error)}),t}catch(e){throw this.observability?.dispatch({type:"signin_failure",error:e}),e}}async confirmForgotPassword(e,t,r,i){try{let i=await e9(this.idp,e,t,r,this.t);return i.error&&this.observability?.dispatch({type:"signin_failure",error:Error(i.error)}),i}catch(e){throw this.observability?.dispatch({type:"signin_failure",error:e}),e}}async changePassword(e,t){try{let r=await e4(this.idp,e,t,this.t);return r.error&&this.observability?.dispatch({type:"change_password_failure",error:Error(r.error)}),r}catch(e){throw this.observability?.dispatch({type:"change_password_failure",error:e}),e}}async confirmUser(e,t){try{let r=await this.clientAppHttp.request("/services/api/v3/users/confirmation","GET",{confirmationToken:e,theme:t});return{user:(0,c.deserializeUser)({id:r.data.id,...r.data.attributes})}}catch(e){throw this.observability?.dispatch({type:"signin_failure",error:e}),e}}async refreshSession(){return tn(this.idp,this.http,this.logger)}async getSignInProvider(){return this.idp.getSignInProvider(this.logger)}getLogoutUrl(e){let t=this.cognitoConfig.domain.replace(/\/$/,""),r=new URLSearchParams({client_id:this.cognitoConfig.clientId,logout_uri:this.cognitoConfig.redirectSignOut});return`${t}/logout?${r.toString()}`}async clearStaleSession(){try{await this.idp.signOutLocally()}catch(e){this.logger?.log(s.IdpSignInStep.ClearStaleSessionError,{error:e instanceof Error?e.message:String(e)}),this.observability?.dispatch({type:"clear_stale_session_failure",error:e})}}async deleteAccount(){try{await tl(this.idp,this.http,this.logger)}catch(e){throw this.observability?.dispatch({type:"delete_account_failure",error:e}),e}}async updateProfile(e){try{return await tu(this.idp,this.http,e)}catch(e){return this.observability?.dispatch({type:"update_profile_failure",error:e}),{error:this.t("errors.profile_update_failed",{defaultValue:"Failed to update profile. Please try again."})}}}async updateEmail(e,t,r,i,o){try{return await td(this.idp,this.http,e,t,r,i,o)}catch(e){return this.observability?.dispatch({type:"update_email_failure",error:e}),{error:this.t("errors.email_update_failed",{defaultValue:"Failed to update email. Please try again."})}}}async confirmEmailUpdate(e){try{return await tp(this.idp,e)}catch(e){return this.observability?.dispatch({type:"update_email_confirmation_failure",error:e}),{error:this.t("errors.email_confirm_failed",{defaultValue:"Invalid or expired verification code."})}}}onOAuthRedirectComplete(e,t){return this.idp.onOAuthRedirectComplete(e,t)}async submitPhone(e,t,r){try{return await ta(this.idp,this.http,t,r,this.logger)}catch(e){throw this.observability?.dispatch({type:"submit_phone_failure",error:e}),e}}}let tg=[{key:"userPoolId",label:"COGNITO_USER_POOL_ID"},{key:"clientId",label:"COGNITO_CLIENT_ID"},{key:"domain",label:"cognito domain (set in build-config.ts)"},{key:"region",label:"region (hardcoded us-east-1)"},{key:"redirectSignIn",label:"redirectSignIn (derived from config.host)"},{key:"redirectSignOut",label:"redirectSignOut (derived from config.host)"}],tf=!1,tE={dasherize:h.dasherizeKeys,camelize:g.camelize};var tm=e.i(893065);let ty=new Set([ez.NotAuthorized,ez.UserNotFound]),tS=new Set([ez.UserNotConfirmed,ez.UsernameExists,ez.InvalidParameter,ez.InvalidPassword,ez.PasswordResetRequired]),tA=new Set([ez.LimitExceeded,ez.TooManyRequests]),tI=new Set(["email","password","first_name","last_name","home_phone","firstName","lastName","homePhone"]);function tv(e,t){if(!e)return s.ErrorCategory.UnknownError;if("object"==typeof e&&null!==e&&"name"in e){let t=e.name;if("string"==typeof t&&t.length>0)return ty.has(t)?s.ErrorCategory.InvalidCredentials:tS.has(t)?s.ErrorCategory.V
21alidationRejected:tA.has(t)?s.ErrorCategory.ApiCallFailed:s.ErrorCategory.UnknownError}if("object"==typeof e&&null!==e&&"errors"in e&&Array.isArray(e.errors)){if("signin"===t)return s.ErrorCategory.InvalidCredentials;if("register"===t)return e.errors?.some(e=>{let t=e.source?.pointer?.toLowerCase()??"",r=(e.attribute??"").toLowerCase();return tI.has(r)||[...tI].some(e=>t.includes(e))})?s.ErrorCategory.ValidationRejected:s.ErrorCategory.ApiCallFailed}return s.ErrorCategory.UnknownError}let tw=new Set(["bootstrap_failure","session_failure","signout_failure","delete_account_failure","social_signin_failure","clear_stale_session_failure","register_failure","signin_failure","change_password_failure","submit_phone_failure","resend_code_failure","email_lookup_failure","idp_probe_failure","update_profile_failure","update_email_failure","update_email_confirmation_failure"]);class tC{trackEvent;constructor(e){this.trackEvent=e}dispatch(e){if(tw.has(e.type))switch(e.type){case"register_failure":this.trackEvent(s.ObservabilityEvent.RegisterFailed,{errorMessage:(0,tm.extractErrorMessage)(e.error),errorCategory:tv(e.error,"register"),authMethod:e.authMethod,severity:s.Severity.Critical});break;case"register_success":this.trackEvent(s.ObservabilityEvent.RegisterSucceeded,{authMethod:e.authMethod});break;case"signin_failure":this.trackEvent(s.ObservabilityEvent.SignInFailed,{errorMessage:(0,tm.extractErrorMessage)(e.error),errorCategory:tv(e.error,"signin"),authMethod:e.authMethod,severity:s.Severity.Critical});break;case"signin_success":this.trackEvent(s.ObservabilityEvent.SignInSucceeded,{authMethod:e.authMethod});break;case"social_signin_success":this.trackEvent(s.ObservabilityEvent.SocialSignInSucceeded,{provider:e.provider});break;case"social_signin_failure":this.trackEvent(s.ObservabilityEvent.SocialSignInFailed,{errorMessage:(0,tm.extractErrorMessage)(e.error),errorCategory:s.ErrorCategory.UnknownError,provider:e.provider,severity:s.Severity.Critical});break;case"change_password_success":this.trackEvent(s.ObservabilityEvent.ChangePasswordSucceeded);break;case"change_password_failure":this.trackEvent(s.ObservabilityEvent.ChangePasswordFailed,{errorMessage:(0,tm.extractErrorMessage)(e.error),errorCategory:s.ErrorCategory.UnknownError,severity:s.Severity.Critical});break;case"submit_phone_success":this.trackEvent(s.ObservabilityEvent.SubmitPhoneSucceeded);break;case"submit_phone_failure":this.trackEvent(s.ObservabilityEvent.SubmitPhoneFailed,{errorMessage:(0,tm.extractErrorMessage)(e.error),errorCategory:s.ErrorCategory.UnknownError,severity:s.Severity.Critical});break;case"session_refresh_success":this.trackEvent(s.ObservabilityEvent.SessionRefreshSucceeded);break;case"session_failure":this.trackEvent(s.ObservabilityEvent.SessionFailed,{errorMessage:(0,tm.extractErrorMessage)(e.error),errorCategory:s.ErrorCategory.UnknownError,severity:s.Severity.Critical});break;case"delete_account_success":this.trackEvent(s.ObservabilityEvent.DeleteAccountSucceeded);break;case"delete_account_failure":this.trackEvent(s.ObservabilityEvent.DeleteAccountFailed,{errorMessage:(0,tm.extractErrorMessage)(e.error),errorCategory:s.ErrorCategory.UnknownError,severity:s.Severity.Critical});break;case"email_lookup_failure":this.trackEvent(s.ObservabilityEvent.EmailLookupFailed,{errorMessage:(0,tm.extractErrorMessage)(e.error),errorCategory:s.ErrorCategory.ApiCallFailed,severity:s.Severity.Critical});break;case"idp_probe_failure":this.trackEvent(s.ObservabilityEvent.IdpProbeFailed,{errorMessage:(0,tm.extractErrorMessage)(e.error),errorCategory:s.ErrorCategory.ApiCallFailed,severity:s.Severity.Critical});break;case"signout_failure":this.trackEvent(s.ObservabilityEvent.SignOutFailed,{errorMessage:(0,tm.extractErrorMessage)(e.error),errorCategory:s.ErrorCategory.UnknownError,severity:s.Severity.Critical});break;case"resend_code_failure":this.trackEvent(s.ObservabilityEvent.ResendCodeFailed,{errorMessage:(0,tm.extractErrorMessage)(e.error),errorCategory:s.ErrorCategory.ApiCallFailed,email:e.email,severity:s.Severity.Critical});break;case"clear_stale_session_failure":this.trackEvent(s.ObservabilityEvent.ClearStaleSessionFailed,{errorMessage:(0,tm.extractErrorMessage)(e.error),errorCategory:s.ErrorCategory.UnknownError,severity:s.Severity.Critical});break;case"bootstrap_failure":this.trackEvent(s.ObservabilityEvent.BootstrapFailed,{errorMessage:(0,tm.extractErrorMessage)(e.error),errorCategory:s.ErrorCategory.UnknownError,severity:s.Severity.Critical});break;case"update_profile_failure":this.trackEvent(s.ObservabilityEvent.UpdateProfileFailed,{errorMessage:(0,tm.extractErrorMessage)(e.error),errorCategory:s.ErrorCategory.ApiCallFailed,severity:s.Severity.Critical});break;case"update_email_failure":this.trackEvent(s.ObservabilityEvent.UpdateEmailFailed,{errorMessage:(0,tm.extractErrorMessage)(e.error),errorCategory:s.ErrorCategory.ApiCallFailed,severity:s.Severity.Critical});break;case"update_email_confirmation_failure":this.trackEvent(s.ObservabilityEvent.UpdateEmailConfirmationFailed,{errorMessage:(0,tm.extractErrorMessage)(e.error),errorCategory:s.ErrorCategory.ApiCallFailed,severity:s.Severity.Critical})}}}e.s(["initAuth",0,function(e){let t=e.debug??!1,r=(0,u.createAuthLogger)(t),i=(0,p.buildHttpClients)(e),o=new c.CookieSessionPersistence(a.default,e.secureCookies??!0),n=new l.SessionStorageAdapter,h=e.trackEvent?new tC(e.trackEvent):void 0,g=null,{authService:E,amplifyConfigured:m}=function(e,t){let r=e.useCognitoAuth;if(r){var i;let t=(i=e.cognitoConfig,tg.filter(({key:e})=>!i?.[e]).map(({label:e})=>e));e.mergeAmplifyConfig||t.push("mergeAmplifyConfig"),t.length>0&&(console.error(`[auth] useCognitoAuth is ON but required config is missing: ${t.join(", ")}. Falling back to legacy auth. Add the missing env vars and rebuild.`),r=!1)}let o=!!r&&!!t.socialAuthListener&&!!e.cognitoConfig&&!!e.mergeAmplifyConfig&&function(e,t,r){if(tf)return!0;
21if(!e.userPoolId||!e.clientId)return console.error("[auth] Cognito auth is enabled but COGNITO_USER_POOL_ID / COGNITO_CLIENT_ID are missing. Social sign-in buttons will not work. Set these env vars and rebuild."),!1;let i=e.domain.replace(/^https?:\/\//,"");return t({Auth:{Cognito:{userPoolId:e.userPoolId,userPoolClientId:e.clientId,loginWith:{oauth:{domain:i,scopes:["openid","email","profile","aws.cognito.signin.user.admin"],redirectSignIn:[e.redirectSignIn],redirectSignOut:[e.redirectSignOut],responseType:"code",providers:["Google","Facebook","Apple"]}}}}}),tf=!0,G.Hub.listen("auth",({payload:e})=>{if(console.debug("[auth] Hub event:",e.event),"customOAuthState"===e.event&&r.setSocialRedirectState(String(e.data??"")),e.event===eQ&&r.cognitoSocialSignInComplete(),e.event===eX){let t=e.data;r.failSocialAuth(t?.error?.message??"Social sign-in failed")}}),!0}(e.cognitoConfig,e.mergeAmplifyConfig,t.socialAuthListener);return{authService:r?new th({http:t.clients.cognitoHttpClient,clientAppHttp:t.clients.httpClient,translation:e.translation,logger:t.logger,cognitoConfig:e.cognitoConfig,amplifyConfigured:o,observability:t.observability,tenant:e.themeName}):new f.ClientAppAuthService({http:t.clients.httpClient,keys:tE,translation:e.translation,themeName:e.themeName,sessionReader:{loadUser:()=>t.persistence.loadUser()},observability:t.observability}),amplifyConfigured:o}}({useCognitoAuth:e.useCognitoAuth,themeName:e.themeName,translation:e.translation,cognitoConfig:e.cognitoConfig,mergeAmplifyConfig:e.mergeAmplifyConfig},{clients:i,logger:r,persistence:o,observability:h,socialAuthListener:{setSocialRedirectState:e=>g.setSocialRedirectState(e),cognitoSocialSignInComplete:()=>g.cognitoSocialSignInComplete(),legacySdkSignInComplete:e=>g.legacySdkSignInComplete(e),failSocialAuth:e=>g.failSocialAuth(e)}}),y=(0,d.createAuthSession)({authService:E,persistence:o,sessionStore:n,ssrUser:e.ssrUser,debug:t,restoreReturnTo:e.restoreReturnTo,observability:h});return g=y,r.log(s.FactoryEvent.Assembled,{service:e.useCognitoAuth?"cognito":"client-app",amplifyConfigured:m,hasObservability:!!h,hasSsrUser:!!e.ssrUser}),y}],466234),s.ObservabilityEvent.RegisterFailed,s.ObservabilityEvent.SignInFailed,s.ErrorCategory.InvalidCredentials,s.ErrorCategory.ValidationRejected,s.ErrorCategory.ApiCallFailed,s.ErrorCategory.UnknownError,e.s([],504328)}]);
22
23//# sourceMappingURL=0_s~fbmn.4t08.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.