PageSourceSearch

https://cdn.azfans.com/react/v110/chunks/TwoFactorAuthPage.js

js azfans.com collected 2026-10-02 12:42:29 UTC 23,315 bytes, 1 lines download raw bytes

1import{R as N,r as A,o as me,j as g,a as T,M as _,T as Q,E as ge,m as pe,v as we}from"../app.js";import{s as Ee}from"./authActions.js";import{S as O}from"./sentry.js";import"./profileHelpers.js";import{M as Ce}from"./MfaCodeModal.js";var ye=Object.defineProperty,k=Object.getOwnPropertySymbols,Z=Object.prototype.hasOwnProperty,J=Object.prototype.propertyIsEnumerable,W=(h,i,n)=>i in h?ye(h,i,{enumerable:!0,configurable:!0,writable:!0,value:n}):h[i]=n,H=(h,i)=>{for(var n in i||(i={}))Z.call(i,n)&&W(h,n,i[n]);if(k)for(var n of k(i))J.call(i,n)&&W(h,n,i[n]);return h},V=(h,i)=>{var n={};for(var c in h)Z.call(h,c)&&i.indexOf(c)<0&&(n[c]=h[c]);if(h!=null&&k)for(var c of k(h))i.indexOf(c)<0&&J.call(h,c)&&(n[c]=h[c]);return n};var D;(h=>{const i=class w{constructor(e,r,t,s){if(this.version=e,this.errorCorrectionLevel=r,this.modules=[],this.isFunction=[],e<w.MIN_VERSION||e>w.MAX_VERSION)throw new RangeError("Version value out of range");if(s<-1||s>7)throw new RangeError("Mask value out of range");this.size=e*4+17;let o=[];for(let a=0;a<this.size;a++)o.push(!1);for(let a=0;a<this.size;a++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();const l=this.addEccAndInterleave(t);if(this.drawCodewords(l),s==-1){let a=1e9;for(let u=0;u<8;u++){this.applyMask(u),this.drawFormatBits(u);const f=this.getPenaltyScore();f<a&&(s=u,a=f),this.applyMask(u)}}p(0<=s&&s<=7),this.mask=s,this.applyMask(s),this.drawFormatBits(s),this.isFunction=[]}static encodeText(e,r){const t=h.QrSegment.makeSegments(e);return w.encodeSegments(t,r)}static encodeBinary(e,r){const t=h.QrSegment.makeBytes(e);return w.encodeSegments([t],r)}static encodeSegments(e,r,t=1,s=40,o=-1,l=!0){if(!(w.MIN_VERSION<=t&&t<=s&&s<=w.MAX_VERSION)||o<-1||o>7)throw new RangeError("Invalid value");let a,u;for(a=t;;a++){const m=w.getNumDataCodewords(a,r)*8,b=M.getTotalBits(e,a);if(b<=m){u=b;break}if(a>=s)throw new RangeError("Data too long")}for(const m of[w.Ecc.MEDIUM,w.Ecc.QUARTILE,w.Ecc.HIGH])l&&u<=w.getNumDataCodewords(a,m)*8&&(r=m);let f=[];for(const m of e){n(m.mode.modeBits,4,f),n(m.numChars,m.mode.numCharCountBits(a),f);for(const b of m.getData())f.push(b)}p(f.length==u);const v=w.getNumDataCodewords(a,r)*8;p(f.length<=v),n(0,Math.min(4,v-f.length),f),n(0,(8-f.length%8)%8,f),p(f.length%8==0);for(let m=236;f.length<v;m^=253)n(m,8,f);let C=[];for(;C.length*8<f.length;)C.push(0);return f.forEach((m,b)=>C[b>>>3]|=m<<7-(b&7)),new w(a,r,C,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 s=0;s<r;s++)t==0&&s==0||t==0&&s==r-1||t==r-1&&s==0||this.drawAlignmentPattern(e[t],e[s]);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 s=(r<<10|t)^21522;p(s>>>15==0);for(let o=0;o<=5;o++)this.setFunctionModule(8,o,c(s,o));this.setFunctionModule(8,7,c(s,6)),this.setFunctionModule(8,8,c(s,7)),this.setFunctionModule(7,8,c(s,8));for(let o=9;o<15;o++)this.setFunctionModule(14-o,8,c(s,o));for(let o=0;o<8;o++)this.setFunctionModule(this.size-1-o,8,c(s,o));for(let o=8;o<15;o++)this.setFunctionModule(8,this.size-15+o,c(s,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;p(r>>>18==0);for(let t=0;t<18;t++){const s=c(r,t),o=this.size-11+t%3,l=Math.floor(t/3);this.setFunctionModule(o,l,s),this.setFunctionModule(l,o,s)}}drawFinderPattern(e,r){for(let t=-4;t<=4;t++)for(let s=-4;s<=4;s++){const o=Math.max(Math.abs(s),Math.abs(t)),l=e+s,a=r+t;0<=l&&l<this.size&&0<=a&&a<this.size&&this.setFunctionModule(l,a,o!=2&&o!=4)}}drawAlignmentPattern(e,r){for(let t=-2;t<=2;t++)for(let s=-2;s<=2;s++)this.setFunctionModule(e+s,r+t,Math.max(Math.abs(s),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!=w.getNumDataCodewords(r,t))throw new RangeError("Invalid argument");const s=w.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][r],o=w.ECC_CODEWORDS_PER_BLOCK[t.ordinal][r],l=Math.floor(w.getNumRawDataModules(r)/8),a=s-l%s,u=Math.floor(l/s);let f=[];const v=w.reedSolomonComputeDivisor(o);for(let m=0,b=0;m<s;m++){let x=e.slice(b,b+u-o+(m<a?0:1));b+=x.length;const y=w.reedSolomonComputeRemainder(x,v);m<a&&x.push(0),f.push(x.concat(y))}let C=[];for(let m=0;m<f[0].length;m++)f.forEach((b,x)=>{(m!=u-o||x>=a)&&C.push(b[m])});return p(C.length==l),C}drawCodewords(e){if(e.length!=Math.floor(w.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 s=0;s<this.size;s++)for(let o=0;o<2;o++){const l=t-o,u=(t+1&2)==0?this.size-1-s:s;!this.isFunction[u][l]&&r<e.length*8&&(this.modules[u][l]=c(e[r>>>3],7-(r&7)),r++)}}p(r==e.length*8)}
1applyMask(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 s;switch(e){case 0:s=(t+r)%2==0;break;case 1:s=r%2==0;break;case 2:s=t%3==0;break;case 3:s=(t+r)%3==0;break;case 4:s=(Math.floor(t/3)+Math.floor(r/2))%2==0;break;case 5:s=t*r%2+t*r%3==0;break;case 6:s=(t*r%2+t*r%3)%2==0;break;case 7:s=((t+r)%2+t*r%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[r][t]&&s&&(this.modules[r][t]=!this.modules[r][t])}}getPenaltyScore(){let e=0;for(let o=0;o<this.size;o++){let l=!1,a=0,u=[0,0,0,0,0,0,0];for(let f=0;f<this.size;f++)this.modules[o][f]==l?(a++,a==5?e+=w.PENALTY_N1:a>5&&e++):(this.finderPenaltyAddHistory(a,u),l||(e+=this.finderPenaltyCountPatterns(u)*w.PENALTY_N3),l=this.modules[o][f],a=1);e+=this.finderPenaltyTerminateAndCount(l,a,u)*w.PENALTY_N3}for(let o=0;o<this.size;o++){let l=!1,a=0,u=[0,0,0,0,0,0,0];for(let f=0;f<this.size;f++)this.modules[f][o]==l?(a++,a==5?e+=w.PENALTY_N1:a>5&&e++):(this.finderPenaltyAddHistory(a,u),l||(e+=this.finderPenaltyCountPatterns(u)*w.PENALTY_N3),l=this.modules[f][o],a=1);e+=this.finderPenaltyTerminateAndCount(l,a,u)*w.PENALTY_N3}for(let o=0;o<this.size-1;o++)for(let l=0;l<this.size-1;l++){const a=this.modules[o][l];a==this.modules[o][l+1]&&a==this.modules[o+1][l]&&a==this.modules[o+1][l+1]&&(e+=w.PENALTY_N2)}let r=0;for(const o of this.modules)r=o.reduce((l,a)=>l+(a?1:0),r);const t=this.size*this.size,s=Math.ceil(Math.abs(r*20-t*10)/t)-1;return p(0<=s&&s<=9),e+=s*w.PENALTY_N4,p(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 s=this.size-7;t.length<e;s-=r)t.splice(1,0,s);return t}}static getNumRawDataModules(e){if(e<w.MIN_VERSION||e>w.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 p(208<=r&&r<=29648),r}static getNumDataCodewords(e,r){return Math.floor(w.getNumRawDataModules(e)/8)-w.ECC_CODEWORDS_PER_BLOCK[r.ordinal][e]*w.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 s=0;s<e-1;s++)r.push(0);
1r.push(1);let t=1;for(let s=0;s<e;s++){for(let o=0;o<r.length;o++)r[o]=w.reedSolomonMultiply(r[o],t),o+1<r.length&&(r[o]^=r[o+1]);t=w.reedSolomonMultiply(t,2)}return r}static reedSolomonComputeRemainder(e,r){let t=r.map(s=>0);for(const s of e){const o=s^t.shift();t.push(0),r.forEach((l,a)=>t[a]^=w.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 s=7;s>=0;s--)t=t<<1^(t>>>7)*285,t^=(r>>>s&1)*e;return p(t>>>8==0),t}finderPenaltyCountPatterns(e){const r=e[1];p(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)}};i.MIN_VERSION=1,i.MAX_VERSION=40,i.PENALTY_N1=3,i.PENALTY_N2=3,i.PENALTY_N3=40,i.PENALTY_N4=10,i.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]],i.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]],h.QrCode=i;function n(E,e,r){if(e<0||e>31||E>>>e)throw new RangeError("Value out of range");for(let t=e-1;t>=0;t--)r.push(E>>>t&1)}function c(E,e){return(E>>>e&1)!=0}function p(E){if(!E)throw new Error("Assertion error")}const d=class R{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)n(t,8,r);return new R(R.Mode.BYTE,e.length,r)}static makeNumeric(e){if(!R.isNumeric(e))throw new RangeError("String contains non-numeric characters");let r=[];for(let t=0;t<e.length;){const s=Math.min(e.length-t,3);n(parseInt(e.substring(t,t+s),10),s*3+1,r),t+=s}return new R(R.Mode.NUMERIC,e.length,r)}static makeAlphanumeric(e){if(!R.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 s=R.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t))*45;s+=R.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t+1)),n(s,11,r)}return t<e.length&&n(R.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)),6,r),new R(R.Mode.ALPHANUMERIC,e.length,r)}static makeSegments(e){return e==""?[]:R.isNumeric(e)?[R.makeNumeric(e)]:R.isAlphanumeric(e)?[R.makeAlphanumeric(e)]:[R.makeBytes(R.toUtf8ByteArray(e))]}static makeEci(e){let r=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)n(e,8,r);else if(e<16384)n(2,2,r),n(e,14,r);else if(e<1e6)n(6,3,r),n(e,21,r);else throw new RangeError("ECI assignment value out of range");return new R(R.Mode.ECI,0,r)}static isNumeric(e){return R.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return R.ALPHANUMERIC_REGEX.test(e)}getData(){return this.bitData.slice()}static getTotalBits(e,r){let t=0;for(const s of e){const o=s.mode.numCharCountBits(r);if(s.numChars>=1<<o)return 1/0;t+=4+o+s.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}};d.NUMERIC_REGEX=/^[0-9]*$/,d.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,d.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let M=d;h.QrSegment=d})(D||(D={}));(h=>{(i=>{const n=class{constructor(p,d){this.ordinal=p,this.formatBits=d}};n.LOW=new n(0,1),n.MEDIUM=new n(1,0),n.QUARTILE=new n(2,3),n.HIGH=new n(3,2),i.Ecc=n})(h.QrCode||(h.QrCode={}))})(D||(D={}));(h=>{(i=>{const n=class{constructor(p,d){this.modeBits=p,this.numBitsCharCount=d}numCharCountBits(p){return this.numBitsCharCount[Math.floor((p+7)/17)]}};n.NUMERIC=new n(1,[10,12,14]),n.ALPHANUMERIC=new n(2,[9,11,13]),n.BYTE=new n(4,[8,16,16]),n.KANJI=new n(8,[8,10,12]),n.ECI=new n(7,[0,0,0]),i.Mode=n})(h.QrSegment||(h.QrSegment={}))})(D||(D={}));var B=D;var Me={L:B.QrCode.Ecc.LOW,M:B.QrCode.Ecc.MEDIUM,Q:B.QrCode.Ecc.QUARTILE,H:B.QrCode.Ecc.HIGH},q=128,ee="L",te="#FFFFFF",re="#000000",se=!1,oe=1,ve=4,be=0,Re=.1;function ne(h,i=0){const n=[];return h.forEach(function(c,p){let d=null;
1c.forEach(function(M,E){if(!M&&d!==null){n.push(`M${d+i} ${p+i}h${E-d}v1H${d+i}z`),d=null;return}if(E===c.length-1){if(!M)return;d===null?n.push(`M${E+i},${p+i} h1v1H${E+i}z`):n.push(`M${d+i},${p+i} h${E+1-d}v1H${d+i}z`);return}M&&d===null&&(d=E)})}),n.join("")}function ae(h,i){return h.slice().map((n,c)=>c<i.y||c>=i.y+i.h?n:n.map((p,d)=>d<i.x||d>=i.x+i.w?p:!1))}function Ae(h,i,n,c){if(c==null)return null;const p=h.length+n*2,d=Math.floor(i*Re),M=p/i,E=(c.width||d)*M,e=(c.height||d)*M,r=c.x==null?h.length/2-E/2:c.x*M,t=c.y==null?h.length/2-e/2:c.y*M,s=c.opacity==null?1:c.opacity;let o=null;if(c.excavate){let a=Math.floor(r),u=Math.floor(t),f=Math.ceil(E+r-a),v=Math.ceil(e+t-u);o={x:a,y:u,w:f,h:v}}const l=c.crossOrigin;return{x:r,y:t,h:e,w:E,excavation:o,opacity:s,crossOrigin:l}}function Ne(h,i){return i!=null?Math.max(Math.floor(i),0):h?ve:be}function ie({value:h,level:i,minVersion:n,includeMargin:c,marginSize:p,imageSettings:d,size:M,boostLevel:E}){let e=N.useMemo(()=>{const a=(Array.isArray(h)?h:[h]).reduce((u,f)=>(u.push(...B.QrSegment.makeSegments(f)),u),[]);return B.QrCode.encodeSegments(a,Me[i],n,void 0,void 0,E)},[h,i,n,E]);const{cells:r,margin:t,numCells:s,calculatedImageSettings:o}=N.useMemo(()=>{let l=e.getModules();const a=Ne(c,p),u=l.length+a*2,f=Ae(l,M,a,d);return{cells:l,margin:a,numCells:u,calculatedImageSettings:f}},[e,M,d,c,p]);return{qrcode:e,margin:t,cells:r,numCells:s,calculatedImageSettings:o}}var Se=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),le=N.forwardRef(function(i,n){const c=i,{value:p,size:d=q,level:M=ee,bgColor:E=te,fgColor:e=re,includeMargin:r=se,minVersion:t=oe,boostLevel:s,marginSize:o,imageSettings:l}=c,u=V(c,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:f}=u,v=V(u,["style"]),C=l?.src,m=N.useRef(null),b=N.useRef(null),x=N.useCallback(U=>{m.current=U,typeof n=="function"?n(U):n&&(n.current=U)},[n]),[y,S]=N.useState(!1),{margin:F,cells:I,numCells:j,calculatedImageSettings:P}=ie({value:p,level:M,minVersion:t,boostLevel:s,includeMargin:r,marginSize:o,imageSettings:l,size:d});N.useEffect(()=>{if(m.current!=null){const U=m.current,L=U.getContext("2d");if(!L)return;let $=I;const z=b.current,Y=P!=null&&z!==null&&z.complete&&z.naturalHeight!==0&&z.naturalWidth!==0;Y&&P.excavation!=null&&($=ae(I,P.excavation));const X=window.devicePixelRatio||1;U.height=U.width=d*X;const K=d/j*X;L.scale(K,K),L.fillStyle=E,L.fillRect(0,0,j,j),L.fillStyle=e,Se?L.fill(new Path2D(ne($,F))):I.forEach(function(ue,he){ue.forEach(function(de,fe){de&&L.fillRect(fe+F,he+F,1,1)})}),P&&(L.globalAlpha=P.opacity),Y&&L.drawImage(z,P.x+F,P.y+F,P.w,P.h)}}),N.useEffect(()=>{S(!1)},[C]);const ce=H({height:d,width:d},f);let G=null;return C!=null&&(G=N.createElement("img",{src:C,key:C,style:{display:"none"},onLoad:()=>{S(!0)},ref:b,crossOrigin:P?.crossOrigin})),N.createElement(N.Fragment,null,N.createElement("canvas",H({style:ce,height:d,width:d,ref:x,role:"img"},v)),G)});le.displayName="QRCodeCanvas";var xe=N.forwardRef(function(i,n){const c=i,{value:p,size:d=q,level:M=ee,bgColor:E=te,fgColor:e=re,includeMargin:r=se,minVersion:t=oe,boostLevel:s,title:o,marginSize:l,imageSettings:a}=c,u=V(c,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:f,cells:v,numCells:C,calculatedImageSettings:m}=ie({value:p,level:M,minVersion:t,boostLevel:s,includeMargin:r,marginSize:l,imageSettings:a,size:d});let b=v,x=null;a!=null&&m!=null&&(m.excavation!=null&&(b=ae(v,m.excavation)),x=N.createElement("image",{href:a.src,height:m.h,width:m.w,x:m.x+f,y:m.y+f,preserveAspectRatio:"none",opacity:m.opacity,crossOrigin:m.crossOrigin}));const y=ne(b,f);return N.createElement("svg",H({height:d,width:d,viewBox:`0 0 ${C} ${C}`,ref:n,role:"img"},u),!!o&&N.createElement("title",null,o),N.createElement("path",{fill:E,d:`M0,0 h${C}v${C}H0z`,shapeRendering:"crispEdges"}),N.createElement("path",{fill:e,d:y,shapeRendering:"crispEdges"}),x)});xe.displayName="QRCodeSVG";function Pe({isOpen:h,onClose:i}){const[n,c]=A.useState(""),[p,d]=A.useState(""),[M,E]=A.useState(!1),[e,r]=A.useState(!1),[t,s]=A.useState(null),o=A.useRef(null);if(A.useEffect(()=>{h&&(c(""),d(""),E(!1),r(!1),setTimeout(()=>
1o.current?.focus(),100))},[h]),!h)return null;const l=async()=>{if(!n)return d("Please enter your password first.");E(!0),d("");const u=T.currentUser,f=ge.credential(u.email,n);try{await pe(u,f),window.location.reload()}catch(v){if(v.code==="auth/wrong-password")d("The password you entered is invalid, are you sure you used the correct password?");else if(v.code==="auth/multi-factor-auth-required"){const C=we(T,v);s(C),r(!0)}else{try{O.captureException(v,{tags:{area:"2fa",op:"reauthenticate"}})}catch{}d("An error occurred.")}E(!1)}},a=async(u,f)=>{if(!t)return;const v=Q.assertionForSignIn(t.hints[0].uid,u);try{await t.resolveSignIn(v);const C=_(T.currentUser).enrolledFactors;for(const m of C)m.factorId==="totp"&&await _(T.currentUser).unenroll(m.uid);window.location.reload()}catch(C){try{O.captureException(C,{tags:{area:"2fa",op:"resolveSignIn"}})}catch{}f("Invalid or expired OTP. Please try again.")}};return g.jsxs(g.Fragment,{children:[g.jsx("div",{className:"modal-overlay",children:g.jsxs("div",{className:"modal-box",style:{maxWidth:460},children:[g.jsxs("div",{className:"modal-box-header",children:[g.jsx("h3",{className:"!mb-0",children:"Re-authenticate"}),g.jsx("button",{className:"bg-transparent border-none text-white opacity-80 cursor-pointer text-2xl leading-none p-0 hover:opacity-100",onClick:i,children:"×"})]}),g.jsxs("div",{className:"modal-box-body",children:[p&&g.jsx("div",{className:"px-3 py-2 mb-3.5 bg-red-500/10 border border-red-500/30 rounded text-red-500 text-[13px]",children:p}),g.jsx("p",{className:"mb-3.5",children:"Please enter your password to continue."}),g.jsxs("div",{children:[g.jsx("label",{htmlFor:"reauth-password",children:"Password"}),g.jsx("input",{ref:o,id:"reauth-password",name:"reauth-password",type:"password",className:"form-input-dark",value:n,onChange:u=>c(u.target.value),onKeyDown:u=>{u.key==="Enter"&&l()},placeholder:"Your password",autoComplete:"current-password"})]})]}),g.jsxs("div",{className:"modal-box-footer",children:[g.jsx("button",{className:"btn-ghost",onClick:i,disabled:M,children:"Cancel"}),g.jsx("button",{className:"btn-primary-tw",onClick:l,disabled:M,children:M?"Verifying...":"Submit"})]})]})}),g.jsx(Ce,{isOpen:e,onConfirm:a,onClose:()=>r(!1)})]})}function Ie(){const[h,i]=A.useState(!0),[n,c]=A.useState(""),[p,d]=A.useState(!1),[M,E]=A.useState(null),[e,r]=A.useState(""),[t,s]=A.useState(""),[o,l]=A.useState(""),[a,u]=A.useState(!1),[f,v]=A.useState(!1),C=A.useCallback(y=>c(y),[]),m=A.useCallback(()=>c(""),[]);A.useEffect(()=>{const y=me(T,async S=>{try{if(!S){try{O.setUser(null)}catch{}window.location.href="/signin.html?next="+encodeURI(window.location.href);return}try{const I=await S.getIdTokenResult(!0);O.setUser({id:S.uid||void 0,email:S.email||void 0}),O.setContext("firebaseClaims",I?.claims||{})}catch(I){try{O.captureException(I,{tags:{area:"auth",op:"getIdTokenResult"}})}catch{}}if(!S.emailVerified){window.location.href="/profile.html#settings";return}const F=await S.getIdTokenResult(!0);if(F.claims.isBanned){try{O.addBreadcrumb({category:"auth",message:"User is banned, signing out",level:"info"})}catch{}return localStorage.removeItem("azn_id"),Ee(T)}if(F.claims.firebase.sign_in_second_factor==="totp")d(!0);else{const I=await _(T.currentUser).getSession(),j=await Q.generateSecret(I),P=j.generateQrCodeUrl(T.currentUser.email,"AZNude");E(j),r(P),s(j.secretKey)}i(!1)}catch(F){if(F.code==="auth/requires-recent-login")v(!0),i(!1);else try{O.captureException(F,{tags:{area:"2fa",op:"onAuthStateChanged"}})}catch{}}});return()=>y()},[]);const b=async()=>{if(m(),!o)return C("Please enter the 6-digit code.");u(!0);try{const y=Q.assertionForEnrollment(M,o);await _(T.currentUser).enroll(y,"Authenticator"),window.location.href="/profile.html?opted-in=true"}catch(y){if(y.code==="auth/invalid-verification-code")C("Invalid or expired OTP. Please try again.");else{try{O.captureException(y,{tags:{area:"2fa",op:"verify-enroll"}})}catch{}C("An error occurred.")}u(!1)}},x=async()=>{m(),u(!0);try{const y=_(T.currentUser).enrolledFactors;for(const S of y)S.factorId==="totp"&&await _(T.currentUser).unenroll(S.uid);window.location.href="/profile.html?opted-out=true"}catch(y){if(y.code==="auth/requires-recent-login")v(!0);else{try{O.captureException(y,{tags:{area:"2fa",op:"disable"}})}catch{}C("An error occurred.")}u(!1)}};return h?g.jsx("div",{className:"max-w-[1400px] mx-auto px-[15px]",children:g.jsx("div",{className:"flex justify-center py-15",children:g.jsx("div",{className:"spinner"})})}):g.jsxs("div",{className:"max-w-[1400px] mx-auto px-[15px]",children:[g.jsxs("div",{className:"card-dark",style:{maxWidth:600,margin:"0 auto"},children:[g.jsx("h1",{className:"text-center mb-6 text-2xl font-bold",children:"TWO-FACTOR AUTHENTICATION"}),n&&g.jsxs("div",{className:"alert-bar mb-4",children:[g.jsx("div",{className:"flex-1",dangerouslySetInnerHTML:{__html:n}}),g.jsx("button",{onClick:m,className:"alert-bar-close","aria-label":"Dismiss",children:"×"})]}),p?g.jsxs("div",{children:[g.jsxs("p",{className:"mb-5",children:["Two-factor authentication is currently ",g.jsx("strong",{children:"enabled"})," on your account."]}),g.jsx("button",{className:"btn-danger-tw w-full",onClick:x,disabled:a,children:a?"Disabling...":"Disable Two-Factor Authentication"})]}):g.jsxs("div",{children:[g.jsx("p",{className:"mb-4",children:"Scan the QR code below with your authenticator app (Google Authenticator, Authy, etc.):"}),e&&g.jsx("div",{className:"flex justify-center mb-4",children:g.jsx(le,{value:e,size:200,bgColor:"#ffffff",fgColor:"#000000"})}),t&&g.jsxs("div",{className:"mb-5",children:[g.jsx("label",{children:"Setup Key (manual entry)"}),g.jsx("input",{type:"text",className:"form-input-dark",value:t,readOnly:!0,onClick:y=>{y.target.select(),navigator.clipboard?.writeText(t)}
1,style:{cursor:"pointer"}}),g.jsx("p",{className:"text-xs mt-1",style:{color:"#888"},children:"Click to copy"})]}),g.jsxs("div",{className:"mb-5",children:[g.jsx("label",{children:"Verification Code"}),g.jsx("input",{type:"text",className:"form-input-dark",value:o,onChange:y=>l(y.target.value.replace(/\D/g,"").slice(0,6)),onKeyDown:y=>{y.key==="Enter"&&b()},placeholder:"XXXXXX",maxLength:6,autoComplete:"off"})]}),g.jsx("button",{className:"btn-primary-tw w-full",onClick:b,disabled:a,children:a?"Verifying...":"Enable Two-Factor Authentication"})]})]}),g.jsx(Pe,{isOpen:f,onClose:()=>v(!1)})]})}function _e(){return g.jsx(Ie,{})}export{_e 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.