1import{i as pe}from"./6KndmJbk.js";import{Ta as H,Vr as Ce,Yi as G,_a as z,aa as N,ba as W,io as Me,oo as we,ra as _,va as $,zi as ve}from"./CCK59u6I.js";import{f as Re}from"./e0LlMT3d.js";import{o as ye}from"./tIQ6FKNR.js";import{at as Ae,et as be,st as Pe}from"./BQH5TMbu.js";import{t as Y}from"./DHQpDpAV2.js";var M=pe(we()),xe=Object.defineProperty,k=Object.getOwnPropertySymbols,te=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable,ee=(u,a,s)=>a in u?xe(u,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):u[a]=s,X=(u,a)=>{for(var s in a||(a={}))te.call(a,s)&&ee(u,s,a[s]);if(k)for(var s of k(a))re.call(a,s)&&ee(u,s,a[s]);return u},K=(u,a)=>{var s={};for(var c in u)te.call(u,c)&&a.indexOf(c)<0&&(s[c]=u[c]);if(u!=null&&k)for(var c of k(u))a.indexOf(c)<0&&re.call(u,c)&&(s[c]=u[c]);return s},F;(u=>{const a=class m{constructor(e,r,t,n){if(this.version=e,this.errorCorrectionLevel=r,this.modules=[],this.isFunction=[],e<m.MIN_VERSION||e>m.MAX_VERSION)throw new RangeError("Version value out of range");if(n<-1||n>7)throw new RangeError("Mask value out of range");this.size=e*4+17;let o=[];for(let i=0;i<this.size;i++)o.push(!1);for(let i=0;i<this.size;i++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();const l=this.addEccAndInterleave(t);if(this.drawCodewords(l),n==-1){let i=1e9;for(let E=0;E<8;E++){this.applyMask(E),this.drawFormatBits(E);const d=this.getPenaltyScore();d<i&&(n=E,i=d),this.applyMask(E)}}g(0<=n&&n<=7),this.mask=n,this.applyMask(n),this.drawFormatBits(n),this.isFunction=[]}static encodeText(e,r){const t=u.QrSegment.makeSegments(e);return m.encodeSegments(t,r)}static encodeBinary(e,r){const t=u.QrSegment.makeBytes(e);return m.encodeSegments([t],r)}static encodeSegments(e,r,t=1,n=40,o=-1,l=!0){if(!(m.MIN_VERSION<=t&&t<=n&&n<=m.MAX_VERSION)||o<-1||o>7)throw new RangeError("Invalid value");let i,E;for(i=t;;i++){const f=m.getNumDataCodewords(i,r)*8,w=y.getTotalBits(e,i);if(w<=f){E=w;break}if(i>=n)throw new RangeError("Data too long")}for(const f of[m.Ecc.MEDIUM,m.Ecc.QUARTILE,m.Ecc.HIGH])l&&E<=m.getNumDataCodewords(i,f)*8&&(r=f);let d=[];for(const f of e){s(f.mode.modeBits,4,d),s(f.numChars,f.mode.numCharCountBits(i),d);for(const w of f.getData())d.push(w)}g(d.length==E);const b=m.getNumDataCodewords(i,r)*8;g(d.length<=b),s(0,Math.min(4,b-d.length),d),s(0,(8-d.length%8)%8,d),g(d.length%8==0);for(let f=236;d.length<b;f^=253)s(f,8,d);let A=[];for(;A.length*8<d.length;)A.push(0);return d.forEach((f,w)=>A[w>>>3]|=f<<7-(w&7)),new m(i,r,A,o)}getModule(e,r){return 0<=e&&e<this.size&&0<=r&&r<this.size&&this.modules[r][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let t=0;t<this.size;t++)this.setFunctionModule(6,t,t%2==0),this.setFunctionModule(t,6,t%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);const e=this.getAlignmentPatternPositions(),r=e.length;for(let t=0;t<r;t++)for(let n=0;n<r;n++)t==0&&n==0||t==0&&n==r-1||t==r-1&&n==0||this.drawAlignmentPattern(e[t],e[n]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){const r=this.errorCorrectionLevel.formatBits<<3|e;let t=r;for(let o=0;o<10;o++)t=t<<1^(t>>>9)*1335;const n=(r<<10|t)^21522;g(n>>>15==0);for(let o=0;o<=5;o++)this.setFunctionModule(8,o,c(n,o));this.setFunctionModule(8,7,c(n,6)),this.setFunctionModule(8,8,c(n,7)),this.setFunctionModule(7,8,c(n,8));for(let o=9;o<15;o++)this.setFunctionModule(14-o,8,c(n,o));for(let o=0;o<8;o++)this.setFunctionModule(this.size-1-o,8,c(n,o));for(let o=8;o<15;o++)this.setFunctionModule(8,this.size-15+o,c(n,o));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;const r=this.version<<12|e;g(r>>>18==0);for(let t=0;t<18;t++){const n=c(r,t),o=this.size-11+t%3,l=Math.floor(t/3);this.setFunctionModule(o,l,n),this.setFunctionModule(l,o,n)}}drawFinderPattern(e,r){for(let t=-4;t<=4;t++)for(let n=-4;n<=4;n++){const o=Math.max(Math.abs(n),Math.abs(t)),l=e+n,i=r+t;0<=l&&l<this.size&&0<=i&&i<this.size&&this.setFunctionModule(l,i,o!=2&&o!=4)}}drawAlignmentPattern(e,r){for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)this.setFunctionModule(e+n,r+t,Math.max(Math.abs(n),Math.abs(t))!=1)}setFunctionModule(e,r,t){this.modules[r][e]=t,this.isFunction[r][e]=!0}addEccAndInterleave(e){const r=this.version,t=this.errorCorrectionLevel;if(e.length!=m.getNumDataCodewords(r,t))throw new RangeError("Invalid argument");const n=m.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][r],o=m.ECC_CODEWORDS_PER_BLOCK[t.ordinal][r],l=Math.floor(m.getNumRawDataModules(r)/8),i=n-l%n,E=Math.floor(l/n);let d=[];const b=m.reedSolomonComputeDivisor(o);for(let f=0,w=0;f<n;f++){let S=e.slice(w,w+E-o+(f<i?0:1));w+=S.length;const I=m.reedSolomonComputeRemainder(S,b);
1f<i&&S.push(0),d.push(S.concat(I))}let A=[];for(let f=0;f<d[0].length;f++)d.forEach((w,S)=>{(f!=E-o||S>=i)&&A.push(w[f])});return g(A.length==l),A}drawCodewords(e){if(e.length!=Math.floor(m.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let r=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let n=0;n<this.size;n++)for(let o=0;o<2;o++){const l=t-o,i=(t+1&2)==0?this.size-1-n:n;!this.isFunction[i][l]&&r<e.length*8&&(this.modules[i][l]=c(e[r>>>3],7-(r&7)),r++)}}g(r==e.length*8)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let r=0;r<this.size;r++)for(let t=0;t<this.size;t++){let n;switch(e){case 0:n=(t+r)%2==0;break;case 1:n=r%2==0;break;case 2:n=t%3==0;break;case 3:n=(t+r)%3==0;break;case 4:n=(Math.floor(t/3)+Math.floor(r/2))%2==0;break;case 5:n=t*r%2+t*r%3==0;break;case 6:n=(t*r%2+t*r%3)%2==0;break;case 7:n=((t+r)%2+t*r%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[r][t]&&n&&(this.modules[r][t]=!this.modules[r][t])}}getPenaltyScore(){let e=0;for(let o=0;o<this.size;o++){let l=!1,i=0,E=[0,0,0,0,0,0,0];for(let d=0;d<this.size;d++)this.modules[o][d]==l?(i++,i==5?e+=m.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,E),l||(e+=this.finderPenaltyCountPatterns(E)*m.PENALTY_N3),l=this.modules[o][d],i=1);e+=this.finderPenaltyTerminateAndCount(l,i,E)*m.PENALTY_N3}for(let o=0;o<this.size;o++){let l=!1,i=0,E=[0,0,0,0,0,0,0];for(let d=0;d<this.size;d++)this.modules[d][o]==l?(i++,i==5?e+=m.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,E),l||(e+=this.finderPenaltyCountPatterns(E)*m.PENALTY_N3),l=this.modules[d][o],i=1);e+=this.finderPenaltyTerminateAndCount(l,i,E)*m.PENALTY_N3}for(let o=0;o<this.size-1;o++)for(let l=0;l<this.size-1;l++){const i=this.modules[o][l];i==this.modules[o][l+1]&&i==this.modules[o+1][l]&&i==this.modules[o+1][l+1]&&(e+=m.PENALTY_N2)}let r=0;for(const o of this.modules)r=o.reduce((l,i)=>l+(i?1:0),r);const t=this.size*this.size,n=Math.ceil(Math.abs(r*20-t*10)/t)-1;return g(0<=n&&n<=9),e+=n*m.PENALTY_N4,g(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{const e=Math.floor(this.version/7)+2,r=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2;let t=[6];for(let n=this.size-7;t.length<e;n-=r)t.splice(1,0,n);return t}}static getNumRawDataModules(e){if(e<m.MIN_VERSION||e>m.MAX_VERSION)throw new RangeError("Version number out of range");let r=(16*e+128)*e+64;if(e>=2){const t=Math.floor(e/7)+2;r-=(25*t-10)*t-55,e>=7&&(r-=36)}return g(208<=r&&r<=29648),r}static getNumDataCodewords(e,r){return Math.floor(m.getNumRawDataModules(e)/8)-m.ECC_CODEWORDS_PER_BLOCK[r.ordinal][e]*m.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw new RangeError("Degree out of range");let r=[];for(let n=0;n<e-1;n++)r.push(0);
1r.push(1);let t=1;for(let n=0;n<e;n++){for(let o=0;o<r.length;o++)r[o]=m.reedSolomonMultiply(r[o],t),o+1<r.length&&(r[o]^=r[o+1]);t=m.reedSolomonMultiply(t,2)}return r}static reedSolomonComputeRemainder(e,r){let t=r.map(n=>0);for(const n of e){const o=n^t.shift();t.push(0),r.forEach((l,i)=>t[i]^=m.reedSolomonMultiply(l,o))}return t}static reedSolomonMultiply(e,r){if(e>>>8||r>>>8)throw new RangeError("Byte out of range");let t=0;for(let n=7;n>=0;n--)t=t<<1^(t>>>7)*285,t^=(r>>>n&1)*e;return g(t>>>8==0),t}finderPenaltyCountPatterns(e){const r=e[1];g(r<=this.size*3);const t=r>0&&e[2]==r&&e[3]==r*3&&e[4]==r&&e[5]==r;return(t&&e[0]>=r*4&&e[6]>=r?1:0)+(t&&e[6]>=r*4&&e[0]>=r?1:0)}finderPenaltyTerminateAndCount(e,r,t){return e&&(this.finderPenaltyAddHistory(r,t),r=0),r+=this.size,this.finderPenaltyAddHistory(r,t),this.finderPenaltyCountPatterns(t)}finderPenaltyAddHistory(e,r){r[0]==0&&(e+=this.size),r.pop(),r.unshift(e)}};a.MIN_VERSION=1,a.MAX_VERSION=40,a.PENALTY_N1=3,a.PENALTY_N2=3,a.PENALTY_N3=40,a.PENALTY_N4=10,a.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],a.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],u.QrCode=a;function s(C,e,r){if(e<0||e>31||C>>>e)throw new RangeError("Value out of range");for(let t=e-1;t>=0;t--)r.push(C>>>t&1)}function c(C,e){return(C>>>e&1)!=0}function g(C){if(!C)throw new Error("Assertion error")}const h=class v{constructor(e,r,t){if(this.mode=e,this.numChars=r,this.bitData=t,r<0)throw new RangeError("Invalid argument");this.bitData=t.slice()}static makeBytes(e){let r=[];for(const t of e)s(t,8,r);return new v(v.Mode.BYTE,e.length,r)}static makeNumeric(e){if(!v.isNumeric(e))throw new RangeError("String contains non-numeric characters");let r=[];for(let t=0;t<e.length;){const n=Math.min(e.length-t,3);s(parseInt(e.substring(t,t+n),10),n*3+1,r),t+=n}return new v(v.Mode.NUMERIC,e.length,r)}static makeAlphanumeric(e){if(!v.isAlphanumeric(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");let r=[],t;for(t=0;t+2<=e.length;t+=2){let n=v.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t))*45;n+=v.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t+1)),s(n,11,r)}return t<e.length&&s(v.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)),6,r),new v(v.Mode.ALPHANUMERIC,e.length,r)}static makeSegments(e){return e==""?[]:v.isNumeric(e)?[v.makeNumeric(e)]:v.isAlphanumeric(e)?[v.makeAlphanumeric(e)]:[v.makeBytes(v.toUtf8ByteArray(e))]}static makeEci(e){let r=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)s(e,8,r);else if(e<16384)s(2,2,r),s(e,14,r);else if(e<1e6)s(6,3,r),s(e,21,r);else throw new RangeError("ECI assignment value out of range");return new v(v.Mode.ECI,0,r)}static isNumeric(e){return v.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return v.ALPHANUMERIC_REGEX.test(e)}getData(){return this.bitData.slice()}static getTotalBits(e,r){let t=0;for(const n of e){const o=n.mode.numCharCountBits(r);if(n.numChars>=1<<o)return 1/0;t+=4+o+n.bitData.length}return t}static toUtf8ByteArray(e){e=encodeURI(e);let r=[];for(let t=0;t<e.length;t++)e.charAt(t)!="%"?r.push(e.charCodeAt(t)):(r.push(parseInt(e.substring(t+1,t+3),16)),t+=2);return r}};h.NUMERIC_REGEX=/^[0-9]*$/,h.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,h.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let y=h;u.QrSegment=h}
1)(F||(F={}));(u=>{(a=>{const s=class{constructor(g,h){this.ordinal=g,this.formatBits=h}};s.LOW=new s(0,1),s.MEDIUM=new s(1,0),s.QUARTILE=new s(2,3),s.HIGH=new s(3,2),a.Ecc=s})(u.QrCode||(u.QrCode={}))})(F||(F={}));(u=>{(a=>{const s=class{constructor(g,h){this.modeBits=g,this.numBitsCharCount=h}numCharCountBits(g){return this.numBitsCharCount[Math.floor((g+7)/17)]}};s.NUMERIC=new s(1,[10,12,14]),s.ALPHANUMERIC=new s(2,[9,11,13]),s.BYTE=new s(4,[8,16,16]),s.KANJI=new s(8,[8,10,12]),s.ECI=new s(7,[0,0,0]),a.Mode=s})(u.QrSegment||(u.QrSegment={}))})(F||(F={}));var B=F,Se={L:B.QrCode.Ecc.LOW,M:B.QrCode.Ecc.MEDIUM,Q:B.QrCode.Ecc.QUARTILE,H:B.QrCode.Ecc.HIGH},ne=128,oe="L",se="#FFFFFF",ie="#000000",ae=!1,le=1,Ie=4,Ne=0,Le=.1;function ce(u,a=0){const s=[];return u.forEach(function(c,g){let h=null;c.forEach(function(y,C){if(!y&&h!==null){s.push(`M${h+a} ${g+a}h${C-h}v1H${h+a}z`),h=null;return}if(C===c.length-1){if(!y)return;h===null?s.push(`M${C+a},${g+a} h1v1H${C+a}z`):s.push(`M${h+a},${g+a} h${C+1-h}v1H${h+a}z`);return}y&&h===null&&(h=C)})}),s.join("")}function ue(u,a){return u.slice().map((s,c)=>c<a.y||c>=a.y+a.h?s:s.map((g,h)=>h<a.x||h>=a.x+a.w?g:!1))}function Fe(u,a,s,c){if(c==null)return null;const g=u.length+s*2,h=Math.floor(a*Le),y=g/a,C=(c.width||h)*y,e=(c.height||h)*y,r=c.x==null?u.length/2-C/2:c.x*y,t=c.y==null?u.length/2-e/2:c.y*y,n=c.op
1acity==null?1:c.opacity;let o=null;if(c.excavate){let i=Math.floor(r),E=Math.floor(t);o={x:i,y:E,w:Math.ceil(C+r-i),h:Math.ceil(e+t-E)}}const l=c.crossOrigin;return{x:r,y:t,h:e,w:C,excavation:o,opacity:n,crossOrigin:l}}function Oe(u,a){return a!=null?Math.max(Math.floor(a),0):u?Ie:Ne}function he({value:u,level:a,minVersion:s,includeMargin:c,marginSize:g,imageSettings:h,size:y,boostLevel:C}){let e=M.useMemo(()=>{const l=(Array.isArray(u)?u:[u]).reduce((i,E)=>(i.push(...B.QrSegment.makeSegments(E)),i),[]);return B.QrCode.encodeSegments(l,Se[a],s,void 0,void 0,C)},[u,a,s,C]);const{cells:r,margin:t,numCells:n,calculatedImageSettings:o}=M.useMemo(()=>{let l=e.getModules();const i=Oe(c,g);return{cells:l,margin:i,numCells:l.length+i*2,calculatedImageSettings:Fe(l,y,i,h)}},[e,y,h,c,g]);return{qrcode:e,margin:t,cells:r,numCells:n,calculatedImageSettings:o}}var Te=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),Be=M.forwardRef(function(a,s){const c=a,{value:g,size:h=ne,level:y=oe,bgColor:C=se,fgColor:e=ie,includeMargin:r=ae,minVersion:t=le,boostLevel:n,marginSize:o,imageSettings:l}=c,i=K(c,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:E}=i,d=K(i,["style"]),b=l?.src,A=M.useRef(null),f=M.useRef(null),w=M.useCallback(R=>{A.current=R,typeof s=="function"?s(R):s&&(s.current=R)},[s]),[S,I]=M.useState(!1),{margin:L,cells:O,numCells:D,calculatedImageSettings:P}=he({value:g,level:y,minVersion:t,boostLevel:n,includeMargin:r,marginSize:o,imageSettings:l,size:h});M.useEffect(()=>{if(A.current!=null){const R=A.current,x=R.getContext("2d");if(!x)return;let T=O;const j=f.current,Z=P!=null&&j!==null&&j.complete&&j.naturalHeight!==0&&j.naturalWidth!==0;Z&&P.excavation!=null&&(T=ue(O,P.excavation));const q=window.devicePixelRatio||1;R.height=R.width=h*q;const J=h/D*q;x.scale(J,J),x.fillStyle=C,x.fillRect(0,0,D,D),x.fillStyle=e,Te?x.fill(new Path2D(ce(T,L))):O.forEach(function(fe,me){fe.forEach(function(ge,Ee){ge&&x.fillRect(Ee+L,me+L,1,1)})}),P&&(x.globalAlpha=P.opacity),Z&&x.drawImage(j,P.x+L,P.y+L,P.w,P.h)}}),M.useEffect(()=>{I(!1)},[b]);const Q=X({height:h,width:h},E);let U=null;return b!=null&&(U=M.createElement("img",{src:b,key:b,style:{display:"none"},onLoad:()=>{I(!0)},ref:f,crossOrigin:P?.crossOrigin})),M.createElement(M.Fragment,null,M.createElement("canvas",X({style:Q,height:h,width:h,ref:w,role:"img"},d)),U)});Be.displayName="QRCodeCanvas";var de=M.forwardRef(function(a,s){const c=a,{value:g,size:h=ne,level:y=oe,bgColor:C=se,fgColor:e=ie,includeMargin:r=ae,minVersion:t=le,boostLevel:n,title:o,marginSize:l,imageSettings:i}=c,E=K(c,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:d,cells:b,numCells:A,calculatedImageSettings:f}=he({value:g,level:y,minVersion:t,boostLevel:n,includeMargin:r,marginSize:l,imageSettings:i,size:h});let w=b,S=null;i!=null&&f!=null&&(f.excavation!=null&&(w=ue(b,f.excavation)),S=M.createElement("image",{href:i.src,height:f.h,width:f.w,x:f.x+d,y:f.y+d,preserveAspectRatio:"none",opacity:f.opacity,crossOrigin:f.crossOrigin}));const I=ce(w,d);return M.createElement("svg",X({height:h,width:h,viewBox:`0 0 ${A} ${A}`,ref:s,role:"img"},E),!!o&&M.createElement("title",null,o),M.createElement("path",{fill:C,d:`M0,0 h${A}v${A}H0z`,shapeRendering:"crispEdges"}),M.createElement("path",{fill:e,d:I,shapeRendering:"crispEdges"}),S)});de.displayName="QRCodeSVG";var p=Me(),De=Re("MfaSetupPage"),V=6,We=()=>{const u=Ae(),[a]=Pe(),{needsTotpSetup:s,totpSetupUri:c,confirmTotp:g,setupTotp:h,confirmTotpEnrollment:y,isAuthenticated:C,userInfo:e,logout:r}=be(),[t,n]=(0,M.useState)(c),[o,l]=(0,M.useState)(""),[i,E]=(0,M.useState)(""),[d,b]=(0,M.useState)(!1),[A,f]=(0,M.useState)(!1),[w,S]=(0,M.useState)(!1),[I,L]=(0,M.useState)(!1);(0,M.useEffect)(()=>{let R=!1;if(s){n(c);return}return C&&!t&&(f(!0),(async()=>{try{const T=await ye();if(R)return;if(T.enabled?.includes("TOTP")){L(!0);return}}catch(T){De.warn("fetchMFAPreference failed, falling back to new secret enrollment",T)}const x=await h();R||n(x)})().catch(()=>{R||E("èªè¨¼ã¢ããªç»é²ç¨ã®æ
å ±ã®çæã«å¤±æãã¾ãããæéãããã¦å度ã試ããã ããã")}).finally(()=>{R||f(!1)})),()=>{R=!0}},[s,C]);const O=(0,M.useMemo)(()=>
1{if(!t)return"";try{return new URL(t).searchParams.get("secret")??""}catch{return""}},[t]),D=async R=>{R.preventDefault(),E(""),b(!0);try{s?await g(o):await y(o),u(Y(a.get("redirect")),{replace:!0})}catch(x){E((x instanceof Error?x.message:void 0)||"ã³ã¼ãã®æ¤è¨¼ã«å¤±æãã¾ãããèªè¨¼ã¢ããªã®ã³ã¼ãã確èªãã¦ãã ããã")}finally{b(!1)}},P=s||!!e?.mfaRequired,Q=P?"ãã°ã¢ã¦ããã¦æ»ã":"å¾ã§è¨å®ãã",U=async()=>{E(""),S(!0);try{P?(await r(),u("/login",{replace:!0})):u(Y(a.get("redirect")),{replace:!0})}catch(R){E((R instanceof Error?R.message:void 0)||"ãã£ã³ã»ã«ã«å¤±æãã¾ãããããä¸åº¦ã試ããã ããã"),S(!1)}};return!s&&!C?(0,p.jsx)(N,{sx:{minHeight:"100dvh",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"background.default"},children:(0,p.jsx)(G,{maxWidth:"sm",children:(0,p.jsxs)(H,{sx:{p:4},children:[(0,p.jsx)($,{severity:"error",children:"ãã®ç»é¢ã«ã¢ã¯ã»ã¹ããã«ã¯ãã¾ããã°ã¤ã³ãã¦ãã ããã"}),(0,p.jsx)(_,{fullWidth:!0,variant:"contained",onClick:()=>u("/login"),sx:{mt:2},children:"ãã°ã¤ã³ç»é¢ã¸"})]})})}):I?(0,p.jsx)(N,{sx:{minHeight:"100dvh",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"background.default"},children:(0,p.jsx)(G,{maxWidth:"sm",children:(0,p.jsxs)(H,{sx:{p:4,maxWidth:480,mx:"auto"},children:[(0,p.jsx)(z,{variant:"h1",gutterBottom:!0,children:"2è¦ç´ èªè¨¼ã®è¨å®"}),(0,p.jsx)($,{severity:"info",sx:{mb:2},children:"æ¢ã«èªè¨¼ã¢ããªï¼TOTPï¼ãç»é²æ¸ã¿ã§ããåè¨å®ã¯ä¸è¦ã§ãã"}),(0,p.jsx)(_,{fullWidth:!0,variant:"contained",onClick:()=>window.location.reload(),sx:{height:44,borderRadius:1},children:"åèªã¿è¾¼ã¿"}),(0,p.jsx)(_,{fullWidth:!0,variant:"text",onClick:()=>u(Y(a.get("redirect")),{replace:!0}),sx:{mt:1.5,height:44,borderRadius:1},children:"ãã¼ã ã¸"})]})})}):(0,p.jsx)(N,{sx:{minHeight:"100dvh",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"background.default"},children:(0,p.jsx)(G,{maxWidth:"sm",children:(0,p.jsxs)(H,{sx:{p:4,maxWidth:480,mx:"auto",bgcolor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:2},children:[(0,p.jsx)(z,{variant:"h1",gutterBottom:!0,children:"2è¦ç´ èªè¨¼ã®è¨å®"}),(0,p.jsx)(z,{variant:"body2",sx:{color:"text.secondary",mb:2},children:"èªè¨¼ã¢ããªï¼Google Authenticator / Microsoft Authenticator çï¼ã§ä»¥ä¸ã®QRã³ã¼ããèªã¿åãã 表示ããã6æ¡ã®ã³ã¼ããå
¥åãã¦ãã ããã"}),i&&(0,p.jsx)($,{severity:"error",sx:{mb:2},children:i}),A?(0,p.jsx)(N,{sx:{display:"flex",justifyContent:"center",my:3},children:(0,p.jsx)(W,{size:28})}):t&&(0,p.jsxs)(N,{sx:{mb:2},children:[(0,p.jsx)(N,{sx:{display:"flex",justifyContent:"center",p:2,bgcolor:"#FFFFFF",border:"1px solid",borderColor:"divider",borderRadius:1},children:(0,p.jsx)(de,{value:t,size:176,level:"M"})}),O&&(0,p.jsxs)(N,{sx:{mt:2},children:[(0,p.jsx)(z,{variant:"caption",sx:{color:"text.secondary"},children:"QR ãèªã¿åããªãå ´åã¯ã»ããã¢ãããã¼ãæåå
¥å"}),(0,p.jsx)(z,{variant:"body1",sx:{fontFamily:"monospace",fontWeight:500,letterSpacing:1,wordBreak:"break-all",bgcolor:"#F5F5F5",p:1.5,borderRadius:1,mt:.5},children:O})]})]}),(0,p.jsx)(ve,{sx:{my:2}}),(0,p.jsxs)(N,{component:"form",onSubmit:D,noValidate:!0,children:[(0,p.jsx)(Ce,{fullWidth:!0,label:"確èªã³ã¼ã",value:o,onChange:R=>l(R.target.value.replace(/\D/g,"").slice(0,V)),margin:"normal",autoComplete:"one-time-code",inputMode:"numeric",autoFocus:!0,required:!0,inputProps:{maxLength:V,pattern:"[0-9]*"}}),(0,p.jsx)(_,{fullWidth:!0,type:"submit",variant:"contained",disabled:d||w||o.length!==V||!t&&!s,sx:{mt:3,height:44,borderRadius:1},children:d?(0,p.jsx)(W,{size:24,sx:{color:"inherit"}}):"ç»é²ãã¦ç¶è¡"}),(0,p.jsx)(_,{fullWidth:!0,type:"button",variant:"text",onClick:U,disabled:d||w,sx:{mt:1.5,height:44,borderRadius:1},children:w?(0,p.jsx)(W,{size:20,sx:{color:"inherit"}}):Q})]})]})})})};export{We as default};
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.