(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2d0e6487"],{"97a4":function(t,e,r){"use strict";r.r(e),r.d(e,"amplify_radio_button",(function(){return y})),r.d(e,"amplify_toast",(function(){return w})),r.d(e,"amplify_totp_setup",(function(){return Se}));var n=r("6260"),o=r("36de"),i=r("2482"),a=r("7a37"),u=r("bf82"),s=r("6c18"),f=r("1e35"),c=r("b212"),h=r("b2cf"),l=r("1c35"),d=r.n(l),g=function(t,e,r,n){function o(t){return t instanceof r?t:new r((function(e){e(t)}))}return new(r||(r=Promise))((function(r,i){function a(t){try{s(n.next(t))}catch(e){i(e)}}function u(t){try{s(n["throw"](t))}catch(e){i(e)}}function s(t){t.done?r(t.value):o(t.value).then(a,u)}s((n=n.apply(t,e||[])).next())}))},p=function(t,e){var r,n,o,i,a={label:0,sent:function(){if(1&o[0])throw o[1];return o[1]},trys:[],ops:[]};return i={next:u(0),throw:u(1),return:u(2)},"function"===typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function u(t){return function(e){return s([t,e])}}function s(i){if(r)throw new TypeError("Generator is already executing.");while(a)try{if(r=1,n&&(o=2&i[0]?n["return"]:i[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,i[1])).done)return o;switch(n=0,o&&(i=[2&i[0],o.value]),i[0]){case 0:case 1:o=i;break;case 4:return a.label++,{value:i[1],done:!1};case 5:a.label++,n=i[1],i=[0];continue;case 7:i=a.ops.pop(),a.trys.pop();continue;default:if(o=a.trys,!(o=o.length>0&&o[o.length-1])&&(6===i[0]||2===i[0])){a=0;continue}if(3===i[0]&&(!o||i[1]>o[0]&&i[1]=P)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+P.toString(16)+" bytes");return 0|t}function R(t){return t!==t}function I(t,e){var r;return C.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=C.prototype):(r=t,null===r&&(r=new C(e)),r.length=e),r}function _(t,e){var r=I(t,e<0?0:0|B(e));if(!C.TYPED_ARRAY_SUPPORT)for(var n=0;n55295&&r<57344){if(!o){if(r>56319){(e-=3)>-1&&i.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&i.push(239,191,189);continue}o=r;continue}if(r<56320){(e-=3)>-1&&i.push(239,191,189),o=r;continue}r=65536+(o-55296<<10|r-56320)}else o&&(e-=3)>-1&&i.push(239,191,189);if(o=null,r<128){if((e-=1)<0)break;i.push(r)}else if(r<2048){if((e-=2)<0)break;i.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;i.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;i.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return i}function L(t){if(C.isBuffer(t))return t.length;if("undefined"!==typeof ArrayBuffer&&"function"===typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!==typeof t&&(t=""+t);var e=t.length;return 0===e?0:k(t).length}function O(t,e,r,n){for(var o=0;o=e.length||o>=t.length)break;e[o+r]=t[o]}return o}function U(t,e,r,n){return O(k(e,t.length-r),t,r,n)}function j(t,e,r,n){if("number"===typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!==typeof ArrayBuffer&&e instanceof ArrayBuffer?N(t,e,r,n):"string"===typeof e?M(t,e):S(t,e)}C.TYPED_ARRAY_SUPPORT&&(C.prototype.__proto__=Uint8Array.prototype,C.__proto__=Uint8Array,"undefined"!==typeof Symbol&&Symbol.species&&C[Symbol.species]===C&&Object.defineProperty(C,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1})),C.prototype.write=function(t,e,r){void 0===e||void 0===r&&"string"===typeof e?(r=this.length,e=0):isFinite(e)&&(e|=0,isFinite(r)?r|=0:r=void 0);var n=this.length-e;if((void 0===r||r>n)&&(r=n),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");return U(this,t,e,r)},C.prototype.slice=function(t,e){var r,n=this.length;if(t=~~t,e=void 0===e?n:~~e,t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),e=t.length&&(e=t.length),e||(e=0),n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e=0;--o)t[o+e]=this[o+r];else if(i<1e3||!C.TYPED_ARRAY_SUPPORT)for(o=0;o>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"===typeof t)for(o=e;o40)throw new Error('"version" should be in range from 1 to 40');return 4*t+17},K=function(t){return H[t]},q=function(t){var e=0;while(0!==t)e++,t>>>=1;return e},V=function(t){if("function"!==typeof t)throw new Error('"toSJISFunc" is not a valid function.');Y=t},Q=function(){return"undefined"!==typeof Y},$=function(t){return Y(t)},X={getSymbolSize:J,getSymbolTotalCodewords:K,getBCHDigit:q,setToSJISFunction:V,isKanjiModeEnabled:Q,toSJIS:$};function Z(t,e,r){return r={path:e,exports:{},require:function(t,e){return G()}},t(r,r.exports),r.exports}function G(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}var W=Z((function(t,e){function r(t){if("string"!==typeof t)throw new Error("Param is not a string");var r=t.toLowerCase();switch(r){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+t)}}e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2},e.isValid=function(t){return t&&"undefined"!==typeof t.bit&&t.bit>=0&&t.bit<4},e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch(o){return n}}}));function tt(){this.buffer=[],this.length=0}tt.prototype={get:function(t){var e=Math.floor(t/8);return 1===(this.buffer[e]>>>7-t%8&1)},put:function(t,e){for(var r=0;r>>e-r-1&1))},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var et=tt;function rt(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=F.alloc(t*t),this.reservedBit=F.alloc(t*t)}rt.prototype.set=function(t,e,r,n){var o=t*this.size+e;this.data[o]=r,n&&(this.reservedBit[o]=!0)},rt.prototype.get=function(t,e){return this.data[t*this.size+e]},rt.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r},rt.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var nt=rt,ot=Z((function(t,e){var r=X.getSymbolSize;e.getRowColCoords=function(t){if(1===t)return[];for(var e=Math.floor(t/7)+2,n=r(t),o=145===n?26:2*Math.ceil((n-13)/(2*e-2)),i=[n-7],a=1;a=0&&t<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(t){for(var e=t.size,n=0,o=0,i=0,a=null,u=null,s=0;s=5&&(n+=r.N1+(o-5)),a=c,o=1),c=t.get(f,s),c===u?i++:(i>=5&&(n+=r.N1+(i-5)),u=c,i=1)}o>=5&&(n+=r.N1+(o-5)),i>=5&&(n+=r.N1+(i-5))}return n},e.getPenaltyN2=function(t){for(var e=t.size,n=0,o=0;o=10&&(1488===o||93===o)&&n++,i=i<<1&2047|t.get(u,a),u>=10&&(1488===i||93===i)&&n++}return n*r.N3},e.getPenaltyN4=function(t){for(var e=0,n=t.data.length,o=0;o=0){for(var n=r[0],o=0;o0){var i=F.alloc(this.degree);return n.copy(i,o),i}return n};var Pt=At,Ct=function(t){return!isNaN(t)&&t>=1&&t<=40},Bt={isValid:Ct},Rt="[0-9]+",It="[A-Z $%*+\\-./:]+",_t="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";_t=_t.replace(/u/g,"\\u");var Mt="(?:(?![A-Z0-9 $%*+\\-./:]|"+_t+")(?:.|[\r\n]))+",xt=new RegExp(_t,"g"),Nt=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),St=new RegExp(Mt,"g"),kt=new RegExp(Rt,"g"),Lt=new RegExp(It,"g"),Ot=new RegExp("^"+_t+"$"),Ut=new RegExp("^"+Rt+"$"),jt=new RegExp("^[A-Z0-9 $%*+\\-./:]+$"),Yt=function(t){return Ot.test(t)},Dt=function(t){return Ut.test(t)},zt=function(t){return jt.test(t)},Ft={KANJI:xt,BYTE_KANJI:Nt,BYTE:St,NUMERIC:kt,ALPHANUMERIC:Lt,testKanji:Yt,testNumeric:Dt,testAlphanumeric:zt},Ht=Z((function(t,e){function r(t){if("string"!==typeof t)throw new Error("Param is not a string");var r=t.toLowerCase();switch(r){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+t)}}e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(t,e){if(!t.ccBits)throw new Error("Invalid mode: "+t);if(!Bt.isValid(e))throw new Error("Invalid version: "+e);return e>=1&&e<10?t.ccBits[0]:e<27?t.ccBits[1]:t.ccBits[2]},e.getBestModeForData=function(t){return Ft.testNumeric(t)?e.NUMERIC:Ft.testAlphanumeric(t)?e.ALPHANUMERIC:Ft.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(t){if(t&&t.id)return t.id;throw new Error("Invalid mode")},e.isValid=function(t){return t&&t.bit&&t.ccBits},e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch(o){return n}}})),Jt=Z((function(t,e){var r=7973,n=X.getBCHDigit(r);function o(t,r,n){for(var o=1;o<=40;o++)if(r<=e.getCapacity(o,n,t))return o}function i(t,e){return Ht.getCharCountIndicator(t,e)+4}function a(t,e){var r=0;return t.forEach((function(t){var n=i(t.mode,e);r+=n+t.getBitsLength()})),r}function u(t,r){for(var n=1;n<=40;n++){var o=a(t,n);if(o<=e.getCapacity(n,r,Ht.MIXED))return n}}e.from=function(t,e){return Bt.isValid(t)?parseInt(t,10):e},e.getCapacity=function(t,e,r){if(!Bt.isValid(t))throw new Error("Invalid QR Code version");"undefined"===typeof r&&(r=Ht.BYTE);var n=X.getSymbolTotalCodewords(t),o=gt.getTotalCodewordsCount(t,e),a=8*(n-o);if(r===Ht.MIXED)return a;var u=a-i(r,t);switch(r){case Ht.NUMERIC:return Math.floor(u/10*3);case Ht.ALPHANUMERIC:return Math.floor(u/11*2);case Ht.KANJI:return Math.floor(u/13);case Ht.BYTE:default:return Math.floor(u/8)}},e.getBestVersionForData=function(t,e){var r,n=W.from(e,W.M);if(T(t)){if(t.length>1)return u(t,n);if(0===t.length)return 1;r=t[0]}else r=t;return o(r.mode,r.getLength(),n)},e.getEncodedBits=function(t){if(!Bt.isValid(t)||t<7)throw new Error("Invalid QR Code version");var e=t<<12;while(X.getBCHDigit(e)-n>=0)e^=r<=0)n^=Kt<0&&(r=this.data.substr(e),n=parseInt(r,10),t.put(n,3*o+1))};var Zt=Xt,Gt=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function Wt(t){this.mode=Ht.ALPHANUMERIC,this.data=t}Wt.getBitsLength=function(t){return 11*Math.floor(t/2)+t%2*6},Wt.prototype.getLength=function(){return this.data.length},Wt.prototype.getBitsLength=function(){return Wt.getBitsLength(this.data.length)},Wt.prototype.write=function(t){var e;for(e=0;e+2<=this.data.length;e+=2){var r=45*Gt.indexOf(this.data[e]);r+=Gt.indexOf(this.data[e+1]),t.put(r,11)}this.data.length%2&&t.put(Gt.indexOf(this.data[e]),6)};var te=Wt;function ee(t){this.mode=Ht.BYTE,this.data=F.from(t)}ee.getBitsLength=function(t){return 8*t},ee.prototype.getLength=function(){return this.data.length},ee.prototype.getBitsLength=function(){return ee.getBitsLength(this.data.length)},ee.prototype.write=function(t){for(var e=0,r=this.data.length;e=33088&&r<=40956)r-=33088;else{if(!(r>=57408&&r<=60351))throw new Error("Invalid SJIS character: "+this.data[e]+"\nMake sure your charset is UTF-8");r-=49472}r=192*(r>>>8&255)+(255&r),t.put(r,13)}};var oe=ne,ie=Z((function(t){var e={single_source_shortest_paths:function(t,r,n){var o={},i={};i[r]=0;var a,u,s,f,c,h,l,d,g,p=e.PriorityQueue.make();p.push(r,0);while(!p.empty())for(s in a=p.pop(),u=a.value,f=a.cost,c=t[u]||{},c)c.hasOwnProperty(s)&&(h=c[s],l=f+h,d=i[s],g="undefined"===typeof i[s],(g||d>l)&&(i[s]=l,p.push(s,l),o[s]=u));if("undefined"!==typeof n&&"undefined"===typeof i[n]){var v=["Could not find a path from ",r," to ",n,"."].join("");throw new Error(v)}return o},extract_shortest_path_from_predecessor_list:function(t,e){var r=[],n=e;while(n)r.push(n),n=t[n];return r.reverse(),r},find_path:function(t,r,n){var o=e.single_source_shortest_paths(t,r,n);return e.extract_shortest_path_from_predecessor_list(o,n)},PriorityQueue:{make:function(t){var r,n=e.PriorityQueue,o={};for(r in t=t||{},n)n.hasOwnProperty(r)&&(o[r]=n[r]);return o.queue=[],o.sorter=t.sorter||n.default_sorter,o},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var r={value:t,cost:e};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return 0===this.queue.length}}};t.exports=e})),ae=Z((function(t,e){function r(t){return unescape(encodeURIComponent(t)).length}function n(t,e,r){var n,o=[];while(null!==(n=t.exec(r)))o.push({data:n[0],index:n.index,mode:e,length:n[0].length});return o}function o(t){var e,r,o=n(Ft.NUMERIC,Ht.NUMERIC,t),i=n(Ft.ALPHANUMERIC,Ht.ALPHANUMERIC,t);X.isKanjiModeEnabled()?(e=n(Ft.BYTE,Ht.BYTE,t),r=n(Ft.KANJI,Ht.KANJI,t)):(e=n(Ft.BYTE_KANJI,Ht.BYTE,t),r=[]);var a=o.concat(i,e,r);return a.sort((function(t,e){return t.index-e.index})).map((function(t){return{data:t.data,mode:t.mode,length:t.length}}))}function i(t,e){switch(e){case Ht.NUMERIC:return Zt.getBitsLength(t);case Ht.ALPHANUMERIC:return te.getBitsLength(t);case Ht.KANJI:return oe.getBitsLength(t);case Ht.BYTE:return re.getBitsLength(t)}}function a(t){return t.reduce((function(t,e){var r=t.length-1>=0?t[t.length-1]:null;return r&&r.mode===e.mode?(t[t.length-1].data+=e.data,t):(t.push(e),t)}),[])}function u(t){for(var e=[],n=0;n=0&&u<=6&&(0===s||6===s)||s>=0&&s<=6&&(0===u||6===u)||u>=2&&u<=4&&s>=2&&s<=4?t.set(i+u,a+s,!0,!0):t.set(i+u,a+s,!1,!0))}function se(t){for(var e=t.size,r=8;r>u&1),t.set(r,n,o,!0),t.set(n,r,o,!0)}function he(t,e,r){var n,o,i=t.size,a=$t.getEncodedBits(e,r);for(n=0;n<15;n++)o=1===(a>>n&1),n<6?t.set(n,8,o,!0):n<8?t.set(n+1,8,o,!0):t.set(i-15+n,8,o,!0),n<8?t.set(8,i-n-1,o,!0):n<9?t.set(8,15-n-1+1,o,!0):t.set(8,15-n-1,o,!0);t.set(i-8,8,1,!0)}function le(t,e){for(var r=t.size,n=-1,o=r-1,i=7,a=0,u=r-1;u>0;u-=2){6===u&&u--;while(1){for(var s=0;s<2;s++)if(!t.isReserved(o,u-s)){var f=!1;a>>i&1)),t.set(o,u-s,f),i--,-1===i&&(a++,i=7)}if(o+=n,o<0||r<=o){o-=n,n=-n;break}}}}function de(t,e,r){var n=new et;r.forEach((function(e){n.put(e.mode.bit,4),n.put(e.getLength(),Ht.getCharCountIndicator(e.mode,t)),e.write(n)}));var o=X.getSymbolTotalCodewords(t),i=gt.getTotalCodewordsCount(t,e),a=8*(o-i);n.getLengthInBits()+4<=a&&n.put(0,4);while(n.getLengthInBits()%8!==0)n.putBit(0);for(var u=(a-n.getLengthInBits())/8,s=0;s=7&&ce(c,e),le(c,s),isNaN(n)&&(n=ft.getBestMask(c,he.bind(null,c,r))),ft.applyMask(n,c),he(c,r,n),{modules:c,version:e,errorCorrectionLevel:r,maskPattern:n,segments:o}}var ve=function(t,e){if("undefined"===typeof t||""===t)throw new Error("No input text");var r,n,o=W.M;return"undefined"!==typeof e&&(o=W.from(e.errorCorrectionLevel,W.M),r=Jt.from(e.version),n=ft.from(e.maskPattern),e.toSJISFunc&&X.setToSJISFunction(e.toSJISFunc)),pe(t,r,o,n)},ye={create:ve},me=Z((function(t,e){function r(t){if("number"===typeof t&&(t=t.toString()),"string"!==typeof t)throw new Error("Color should be defined as hex string");var e=t.slice().replace("#","").split("");if(e.length<3||5===e.length||e.length>8)throw new Error("Invalid hex color: "+t);3!==e.length&&4!==e.length||(e=Array.prototype.concat.apply([],e.map((function(t){return[t,t]})))),6===e.length&&e.push("F","F");var r=parseInt(e.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:255&r,hex:"#"+e.slice(0,6).join("")}}e.getOptions=function(t){t||(t={}),t.color||(t.color={});var e="undefined"===typeof t.margin||null===t.margin||t.margin<0?4:t.margin,n=t.width&&t.width>=21?t.width:void 0,o=t.scale||4;return{width:n,scale:n?4:o,margin:e,color:{dark:r(t.color.dark||"#000000ff"),light:r(t.color.light||"#ffffffff")},type:t.type,rendererOpts:t.rendererOpts||{}}},e.getScale=function(t,e){return e.width&&e.width>=t+2*e.margin?e.width/(t+2*e.margin):e.scale},e.getImageWidth=function(t,r){var n=e.getScale(t,r);return Math.floor((t+2*r.margin)*n)},e.qrToImageData=function(t,r,n){for(var o=r.modules.size,i=r.modules.data,a=e.getScale(o,n),u=Math.floor((o+2*n.margin)*a),s=n.margin*a,f=[n.color.light,n.color.dark],c=0;c=s&&h>=s&&c0&&s>0&&t[u-1]||(n+=i?Ee("M",s+r,.5+f+r):Ee("m",o,0),o=0,i=!1),s+1':"",s="',f='viewBox="0 0 '+a+" "+a+'"',c=n.width?'width="'+n.width+'" height="'+n.width+'" ':"",h=''+u+s+"\n";return"function"===typeof r&&r(null,h),h},Pe={render:Ae};function Ce(t,e,r,n,o){var i=[].slice.call(arguments,1),a=i.length,u="function"===typeof i[a-1];if(!u&&!b())throw new Error("Callback required as last argument");if(!u){if(a<1)throw new Error("Too few arguments provided");return 1===a?(r=e,e=n=void 0):2!==a||e.getContext||(n=r,r=e,e=void 0),new Promise((function(o,i){try{var a=ye.create(r,n);o(t(a,e,n))}catch(u){i(u)}}))}if(a<2)throw new Error("Too few arguments provided");2===a?(o=r,r=e,e=n=void 0):3===a&&(e.getContext&&"undefined"===typeof o?(o=n,n=void 0):(o=n,n=r,r=e,e=void 0));try{var s=ye.create(r,n);o(null,t(s,e,n))}catch(f){o(f)}}var Be=ye.create,Re=Ce.bind(null,we.render),Ie=Ce.bind(null,we.renderToDataURL),_e=Ce.bind(null,(function(t,e,r){return Pe.render(t,r)})),Me={create:Be,toCanvas:Re,toDataURL:Ie,toString:_e},xe=".totp-setup{text-align:center;margin-bottom:30px}.totp-setup img{height:128px;width:128px}",Ne=new o["a"]("TOTP"),Se=function(){function t(t){Object(n["k"])(this,t),this.inputProps={autoFocus:!0},this.handleAuthStateChange=c["d"],this.headerText=s["a"].TOTP_HEADER_TEXT,this.issuer=s["a"].TOTP_ISSUER,this.handleComplete=this.onTOTPEvent,this.standalone=!1,this.code=null,this.setupMessage=null,this.qrCodeInput=null,this.loading=!1}return t.prototype.componentWillLoad=function(){return g(this,void 0,void 0,(function(){var t=this;return p(this,(function(e){switch(e.label){case 0:return this.standalone||(this.removeHubListener=Object(c["i"])((function(e){e===a["a"].TOTPSetup&&t.setup()}))),[4,this.setup()];case 1:return e.sent(),[2]}}))}))},t.prototype.handleUserChange=function(){this.standalone&&this.setup()},t.prototype.disconnectedCallback=function(){this.removeHubListener&&this.removeHubListener()},t.prototype.buildOtpAuthPath=function(t,e,r){return"otpauth://totp/"+e+":"+t.username+"?secret="+r+"&issuer="+e},t.prototype.onTOTPEvent=function(t){return g(this,void 0,void 0,(function(){return p(this,(function(e){switch(e.label){case 0:return Ne.debug("on totp event"),[4,Object(h["a"])(t,this.handleAuthStateChange)];case 1:return e.sent(),[2]}}))}))},t.prototype.handleTotpInputChange=function(t){this.setupMessage=null,this.qrCodeInput=t.target.value},t.prototype.generateQRCode=function(t){return g(this,void 0,void 0,(function(){var e,r;return p(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),e=this,[4,Me.toDataURL(t)];case 1:return e.qrCodeImageSource=n.sent(),[3,3];case 2:return r=n.sent(),Object(c["a"])(r),[3,3];case 3:return[2]}}))}))},t.prototype.setup=function(){return g(this,void 0,void 0,(function(){var t,e,r;return p(this,(function(n){switch(n.label){case 0:if(this.code||this.loading)return Ne.debug("setup was attempted while another is in progress, skipping setup."),[2];if(!this.user||!this.user.associateSoftwareToken)return Ne.debug("setup was attempted with invalid `user`, skipping setup.",this.user),[2];if(!u["a"]||"function"!==typeof u["a"].setupTOTP)throw new Error(f["d"]);this.setupMessage=null,t=encodeURI(i["a"].get(this.issuer)),this.loading=!0,n.label=1;case 1:return n.trys.push([1,3,4,5]),[4,u["a"].setupTOTP(this.user)];case 2:return e=n.sent(),Ne.debug("secret key",e),this.code=this.buildOtpAuthPath(this.user,t,e),this.generateQRCode(this.code),[3,5];case 3:return r=n.sent(),Object(c["a"])(r),Ne.debug(i["a"].get(s["a"].TOTP_SETUP_FAILURE),r),[3,5];case 4:return this.loading=!1,[7];case 5:return[2]}}))}))},t.prototype.verifyTotpToken=function(t){return g(this,void 0,void 0,(function(){var e,r;return p(this,(function(n){switch(n.label){case 0:if(t&&t.preventDefault(),!this.qrCodeInput)return Ne.debug("No TOTP Code provided"),[2];if(e=this.user,!u["a"]||"function"!==typeof u["a"].verifyTotpToken||"function"!==typeof u["a"].setPreferredMFA)throw new Error(f["d"]);n.label=1;case 1:return n.trys.push([1,5,,6]),[4,u["a"].verifyTotpToken(e,this.qrCodeInput)];case 2:return n.sent(),[4,u["a"].setPreferredMFA(e,a["c"].TOTP)];case 3:return n.sent(),this.setupMessage=i["a"].get(s["a"].TOTP_SUCCESS_MESSAGE),Ne.debug(i["a"].get(s["a"].TOTP_SUCCESS_MESSAGE)),[4,this.handleComplete(e)];case 4:return n.sent(),[3,6];case 5:return r=n.sent(),this.setupMessage=i["a"].get(s["a"].TOTP_SETUP_FAILURE),Ne.error(r),[3,6];case 6:return[2]}}))}))},t.prototype.render=function(){var t=this;return Object(n["i"])(n["b"],null,Object(n["i"])("amplify-form-section",{headerText:i["a"].get(this.headerText),submitButtonText:i["a"].get(s["a"].TOTP_SUBMIT_BUTTON_TEXT),handleSubmit:function(e){return t.verifyTotpToken(e)},loading:this.loading},Object(n["i"])("div",{class:"totp-setup"},this.qrCodeImageSource&&Object(n["i"])("img",{src:this.qrCodeImageSource,alt:i["a"].get(s["a"].QR_CODE_ALT)}),Object(n["i"])("amplify-form-field",{label:i["a"].get(s["a"].TOTP_LABEL),inputProps:this.inputProps,fieldId:"totpCode",name:"totpCode",handleInputChange:function(e){return t.handleTotpInputChange(e)}}))))},Object.defineProperty(t,"watchers",{get:function(){return{user:["handleUserChange"]}},enumerable:!1,configurable:!0}),t}();Se.style=xe}}]); //# sourceMappingURL=chunk-2d0e6487.0beae9ea.js.map