1import{R as v,s as Ee,Y as N,E as r,n as Ce}from"./index-DOrSqzg-.js";import{w as ye,b as ve}from"./router-compat-Ct9VCP1H.js";import{T as B,O as H}from"./OtpInput-BlT7uUaS.js";import{s as Se}from"./base-D7DRs1YA.js";import{B as R}from"./Button-B_nWyPik.js";/* empty css */import{S as we}from"./settings-layout-B4TiPUsJ.js";import{c as Re}from"./clipboard-BB-HQvQX.js";import{A as J}from"./arrow-right-DpQk9YD_.js";import{M as I}from"./projects.actions-DJmVz-Y0.js";import{E as xe}from"./eye-off-BVbCl7Nm.js";import{E as Ae}from"./eye-CwV9tLvf.js";import"./apiClient-BMbNrS_I.js";/* empty css */import"./index-DS64j4nc.js";import"./purify.es-JreRCqt3.js";import"./createLucideIcon-AhlYETAO.js";import"./project.service-DTRor1BT.js";import"./index-D6E7VwBG.js";import"./index-Chjiymov.js";import"./i18n-bicciaI7.js";import"./chevron-right-DY-ngaTc.js";var je=Object.defineProperty,_=Object.getOwnPropertySymbols,te=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable,q=(u,o,i)=>o in u?je(u,o,{enumerable:!0,configurable:!0,writable:!0,value:i}):u[o]=i,V=(u,o)=>{for(var i in o||(o={}))te.call(o,i)&&q(u,i,o[i]);if(_)for(var i of _(o))se.call(o,i)&&q(u,i,o[i]);return u},G=(u,o)=>{var i={};for(var l in u)te.call(u,l)&&o.indexOf(l)<0&&(i[l]=u[l]);if(u!=null&&_)for(var l of _(u))o.indexOf(l)<0&&se.call(u,l)&&(i[l]=u[l]);return i};var O;(u=>{const o=class b{constructor(e,s,t,n){if(this.version=e,this.errorCorrectionLevel=s,this.modules=[],this.isFunction=[],e<b.MIN_VERSION||e>b.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 a=[];for(let h=0;h<this.size;h++)a.push(!1);for(let h=0;h<this.size;h++)this.modules.push(a.slice()),this.isFunction.push(a.slice());this.drawFunctionPatterns();const f=this.addEccAndInterleave(t);if(this.drawCodewords(f),n==-1){let h=1e9;for(let g=0;g<8;g++){this.applyMask(g),this.drawFormatBits(g);const m=this.getPenaltyScore();m<h&&(n=g,h=m),this.applyMask(g)}}c(0<=n&&n<=7),this.mask=n,this.applyMask(n),this.drawFormatBits(n),this.isFunction=[]}static encodeText(e,s){const t=u.QrSegment.makeSegments(e);return b.encodeSegments(t,s)}static encodeBinary(e,s){const t=u.QrSegment.makeBytes(e);return b.encodeSegments([t],s)}static encodeSegments(e,s,t=1,n=40,a=-1,f=!0){if(!(b.MIN_VERSION<=t&&t<=n&&n<=b.MAX_VERSION)||a<-1||a>7)throw new RangeError("Invalid value");let h,g;for(h=t;;h++){const p=b.getNumDataCodewords(h,s)*8,S=E.getTotalBits(e,h);if(S<=p){g=S;break}if(h>=n)throw new RangeError("Data too long")}for(const p of[b.Ecc.MEDIUM,b.Ecc.QUARTILE,b.Ecc.HIGH])f&&g<=b.getNumDataCodewords(h,p)*8&&(s=p);let m=[];for(const p of e){i(p.mode.modeBits,4,m),i(p.numChars,p.mode.numCharCountBits(h),m);for(const S of p.getData())m.push(S)}c(m.length==g);const x=b.getNumDataCodewords(h,s)*8;c(m.length<=x),i(0,Math.min(4,x-m.length),m),i(0,(8-m.length%8)%8,m),c(m.length%8==0);for(let p=236;m.length<x;p^=253)i(p,8,m);let w=[];for(;w.length*8<m.length;)w.push(0);return m.forEach((p,S)=>w[S>>>3]|=p<<7-(S&7)),new b(h,s,w,a)}getModule(e,s){return 0<=e&&e<this.size&&0<=s&&s<this.size&&this.modules[s][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(),s=e.length;for(let t=0;t<s;t++)for(let n=0;n<s;n++)t==0&&n==0||t==0&&n==s-1||t==s-1&&n==0||this.drawAlignmentPattern(e[t],e[n]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){const s=this.errorCorrectionLevel.formatBits<<3|e;let t=s;for(let a=0;a<10;a++)t=t<<1^(t>>>9)*1335;const n=(s<<10|t)^21522;c(n>>>15==0);for(let a=0;a<=5;a++)this.setFunctionModule(8,a,l(n,a));this.setFunctionModule(8,7,l(n,6)),this.setFunctionModule(8,8,l(n,7)),this.setFunctionModule(7,8,l(n,8));for(let a=9;a<15;a++)this.setFunctionModule(14-a,8,l(n,a));for(let a=0;a<8;a++)this.setFunctionModule(this.size-1-a,8,l(n,a));for(let a=8;a<15;a++)this.setFunctionModule(8,this.size-15+a,l(n,a));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 s=this.version<<12|e;c(s>>>18==0);for(let t=0;t<18;t++){const n=l(s,t),a=this.size-11+t%3,f=Math.floor(t/3);this.setFunctionModule(a,f,n),this.setFunctionModule(f,a,n)}}
1drawFinderPattern(e,s){for(let t=-4;t<=4;t++)for(let n=-4;n<=4;n++){const a=Math.max(Math.abs(n),Math.abs(t)),f=e+n,h=s+t;0<=f&&f<this.size&&0<=h&&h<this.size&&this.setFunctionModule(f,h,a!=2&&a!=4)}}drawAlignmentPattern(e,s){for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)this.setFunctionModule(e+n,s+t,Math.max(Math.abs(n),Math.abs(t))!=1)}setFunctionModule(e,s,t){this.modules[s][e]=t,this.isFunction[s][e]=!0}addEccAndInterleave(e){const s=this.version,t=this.errorCorrectionLevel;if(e.length!=b.getNumDataCodewords(s,t))throw new RangeError("Invalid argument");const n=b.NUM_ERROR_CORRECTION_BLOCKS[t.ordinal][s],a=b.ECC_CODEWORDS_PER_BLOCK[t.ordinal][s],f=Math.floor(b.getNumRawDataModules(s)/8),h=n-f%n,g=Math.floor(f/n);let m=[];const x=b.reedSolomonComputeDivisor(a);for(let p=0,S=0;p<n;p++){let A=e.slice(S,S+g-a+(p<h?0:1));S+=A.length;const T=b.reedSolomonComputeRemainder(A,x);p<h&&A.push(0),m.push(A.concat(T))}let w=[];for(let p=0;p<m[0].length;p++)m.forEach((S,A)=>{(p!=g-a||A>=h)&&w.push(S[p])});return c(w.length==f),w}drawCodewords(e){if(e.length!=Math.floor(b.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let s=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 a=0;a<2;a++){const f=t-a,g=(t+1&2)==0?this.size-1-n:n;!this.isFunction[g][f]&&s<e.length*8&&(this.modules[g][f]=l(e[s>>>3],7-(s&7)),s++)}}c(s==e.length*8)}applyMask(e){if(e<0||e>7)throw new RangeError("Mask value out of range");for(let s=0;s<this.size;s++)for(let t=0;t<this.size;t++){let n;switch(e){case 0:n=(t+s)%2==0;break;case 1:n=s%2==0;break;case 2:n=t%3==0;break;case 3:n=(t+s)%3==0;break;case 4:n=(Math.floor(t/3)+Math.floor(s/2))%2==0;break;case 5:n=t*s%2+t*s%3==0;break;case 6:n=(t*s%2+t*s%3)%2==0;break;case 7:n=((t+s)%2+t*s%3)%2==0;break;default:throw new Error("Unreachable")}!this.isFunction[s][t]&&n&&(this.modules[s][t]=!this.modules[s][t])}}getPenaltyScore(){let e=0;for(let a=0;a<this.size;a++){let f=!1,h=0,g=[0,0,0,0,0,0,0];for(let m=0;m<this.size;m++)this.modules[a][m]==f?(h++,h==5?e+=b.PENALTY_N1:h>5&&e++):(this.finderPenaltyAddHistory(h,g),f||(e+=this.finderPenaltyCountPatterns(g)*b.PENALTY_N3),f=this.modules[a][m],h=1);e+=this.finderPenaltyTerminateAndCount(f,h,g)*b.PENALTY_N3}for(let a=0;a<this.size;a++){let f=!1,h=0,g=[0,0,0,0,0,0,0];for(let m=0;m<this.size;m++)this.modules[m][a]==f?(h++,h==5?e+=b.PENALTY_N1:h>5&&e++):(this.finderPenaltyAddHistory(h,g),f||(e+=this.finderPenaltyCountPatterns(g)*b.PENALTY_N3),f=this.modules[m][a],h=1);e+=this.finderPenaltyTerminateAndCount(f,h,g)*b.PENALTY_N3}for(let a=0;a<this.size-1;a++)for(let f=0;f<this.size-1;f++){const h=this.modules[a][f];h==this.modules[a][f+1]&&h==this.modules[a+1][f]&&h==this.modules[a+1][f+1]&&(e+=b.PENALTY_N2)}let s=0;for(const a of this.modules)s=a.reduce((f,h)=>f+(h?1:0),s);const t=this.size*this.size,n=Math.ceil(Math.abs(s*20-t*10)/t)-1;return c(0<=n&&n<=9),e+=n*b.PENALTY_N4,c(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{const e=Math.floor(this.version/7)+2,s=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-=s)t.splice(1,0,n);return t}}static getNumRawDataModules(e){if(e<b.MIN_VERSION||e>b.MAX_VERSION)throw new RangeError("Version number out of range");let s=(16*e+128)*e+64;if(e>=2){const t=Math.floor(e/7)+2;s-=(25*t-10)*t-55,e>=7&&(s-=36)}return c(208<=s&&s<=29648),s}static getNumDataCodewords(e,s){return Math.floor(b.getNumRawDataModules(e)/8)-b.ECC_CODEWORDS_PER_BLOCK[s.ordinal][e]*b.NUM_ERROR_CORRECTION_BLOCKS[s.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw new RangeError("Degree out of range");let s=[];for(let n=0;n<e-1;n++)s.push(0);s.push(1);let t=1;for(let n=0;n<e;n++){for(let a=0;a<s.length;a++)s[a]=b.reedSolomonMultiply(s[a],t),a+1<s.length&&(s[a]^=s[a+1]);t=b.reedSolomonMultiply(t,2)}return s}static reedSolomonComputeRemainder(e,s){let t=s.map(n=>0);for(const n of e){const a=n^t.shift();t.push(0),s.forEach((f,h)=>t[h]^=b.reedSolomonMultiply(f,a))}return t}static reedSolomonMultiply(e,s){if(e>>>8||s>>>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^=(s>>>n&1)*e;return c(t>>>8==0),t}finderPenaltyCountPatterns(e){const s=e[1];c(s<=this.size*3);const t=s>0&&e[2]==s&&e[3]==s*3&&e[4]==s&&e[5]==s;return(t&&e[0]>=s*4&&e[6]>=s?1:0)+(t&&e[6]>=s*4&&e[0]>=s?1:0)}finderPenaltyTerminateAndCount(e,s,t){return e&&(this.finderPenaltyAddHistory(s,t),s=0),s+=this.size,this.finderPenaltyAddHistory(s,t),this.finderPenaltyCountPatterns(t)}finderPenaltyAddHistory(e,s){s[0]==0&&(e+=this.size),s.pop(),s.unshift(e)}};o.MIN_VERSION=1,o.MAX_VERSION=40,o.PENALTY_N1=3,o.PENALTY_N2=3,o.PENALTY_N3=40,o.PENALTY_N4=10,o.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]],o.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=o;function i(C,e,s){if(e<0||e>31||C>>>e)throw new RangeError("Value out of range");for(let t=e-1;t>=0;t--)s.push(C>>>t&1)}function l(C,e){return(C>>>e&1)!=0}function c(C){if(!C)throw new Error("Assertion error")}const d=class y{constructor(e,s,t){if(this.mode=e,this.numChars=s,this.bitData=t,s<0)throw new RangeError("Invalid argument");this.bitData=t.slice()}static makeBytes(e){let s=[];for(const t of e)i(t,8,s);return new y(y.Mode.BYTE,e.length,s)}static makeNumeric(e){if(!y.isNumeric(e))throw new RangeError("String contains
1non-numeric characters");let s=[];for(let t=0;t<e.length;){const n=Math.min(e.length-t,3);i(parseInt(e.substring(t,t+n),10),n*3+1,s),t+=n}return new y(y.Mode.NUMERIC,e.length,s)}static makeAlphanumeric(e){if(!y.isAlphanumeric(e))throw new RangeError("String contains unencodable characters in alphanumeric mode");let s=[],t;for(t=0;t+2<=e.length;t+=2){let n=y.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t))*45;n+=y.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t+1)),i(n,11,s)}return t<e.length&&i(y.ALPHANUMERIC_CHARSET.indexOf(e.charAt(t)),6,s),new y(y.Mode.ALPHANUMERIC,e.length,s)}static makeSegments(e){return e==""?[]:y.isNumeric(e)?[y.makeNumeric(e)]:y.isAlphanumeric(e)?[y.makeAlphanumeric(e)]:[y.makeBytes(y.toUtf8ByteArray(e))]}static makeEci(e){let s=[];if(e<0)throw new RangeError("ECI assignment value out of range");if(e<128)i(e,8,s);else if(e<16384)i(2,2,s),i(e,14,s);else if(e<1e6)i(6,3,s),i(e,21,s);else throw new RangeError("ECI assignment value out of range");return new y(y.Mode.ECI,0,s)}static isNumeric(e){return y.NUMERIC_REGEX.test(e)}static isAlphanumeric(e){return y.ALPHANUMERIC_REGEX.test(e)}getData(){return this.bitData.slice()}static getTotalBits(e,s){let t=0;for(const n of e){const a=n.mode.numCharCountBits(s);if(n.numChars>=1<<a)return 1/0;t+=4+a+n.bitData.length}return t}static toUtf8ByteArray(e){e=encodeURI(e);let s=[];for(let t=0;t<e.length;t++)e.charAt(t)!="%"?s.push(e.charCodeAt(t)):(s.push(parseInt(e.substring(t+1,t+3),16)),t+=2);return s}};d.NUMERIC_REGEX=/^[0-9]*$/,d.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,d.ALPHANUMERIC_CHARSET="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:";let E=d;u.QrSegment=d})(O||(O={}));(u=>{(o=>{const i=class{constructor(c,d){this.ordinal=c,this.formatBits=d}};i.LOW=new i(0,1),i.MEDIUM=new i(1,0),i.QUARTILE=new i(2,3),i.HIGH=new i(3,2),o.Ecc=i})(u.QrCode||(u.QrCode={}))})(O||(O={}));(u=>{(o=>{const i=class{constructor(c,d){this.modeBits=c,this.numBitsCharCount=d}numCharCountBits(c){return this.numBitsCharCount[Math.floor((c+7)/17)]}};i.NUMERIC=new i(1,[10,12,14]),i.ALPHANUMERIC=new i(2,[9,11,13]),i.BYTE=new i(4,[8,16,16]),i.KANJI=new i(8,[8,10,12]),i.ECI=new i(7,[0,0,0]),o.Mode=i})(u.QrSegment||(u.QrSegment={}))})(O||(O={}));var L=O;var Me={L:L.QrCode.Ecc.LOW,M:L.QrCode.Ecc.MEDIUM,Q:L.QrCode.Ecc.QUARTILE,H:L.QrCode.Ecc.HIGH},re=128,ne="L",ie="#FFFFFF",oe="#000000",ae=!1,le=1,Ne=4,Pe=0,Oe=.1;function ce(u,o=0){const i=[];return u.forEach(function(l,c){let d=null;l.forEach(function(E,C){if(!E&&d!==null){i.push(`M${d+o} ${c+o}h${C-d}v1H${d+o}z`),d=null;return}if(C===l.length-1){if(!E)return;d===null?i.push(`M${C+o},${c+o} h1v1H${C+o}z`):i.push(`M${d+o},${c+o} h${C+1-d}v1H${d+o}z`);return}E&&d===null&&(d=C)})}),i.join("")}function de(u,o){return u.slice().map((i,l)=>l<o.y||l>=o.y+o.h?i:i.map((c,d)=>d<o.x||d>=o.x+o.w?c:!1))}function Ie(u,o,i,l){if(l==null)return null;const c=u.length+i*2,d=Math.floor(o*Oe),E=c/o,C=(l.width||d)*E,e=(l.height||d)*E,s=l.x==null?u.length/2-C/2:l.x*E,t=l.y==null?u.length/2-e/2:l.y*E,n=l.opacity==null?1:l.opacity;let a=null;if(l.excavate){let h=Math.floor(s),g=Math.floor(t),m=Math.ceil(C+s-h),x=Math.ceil(e+t-g);a={x:h,y:g,w:m,h:x}}const f=l.crossOrigin;return{x:s,y:t,h:e,w:C,excavation:a,opacity:n,crossOrigin:f}}function Le(u,o){return o!=null?Math.max(Math.floor(o),0):u?Ne:Pe}function he({value:u,level:o,minVersion:i,includeMargin:l,marginSize:c,imageSettings:d,size:E,boostLevel:C}){let e=v.useMemo(()=>{const h=(Array.isArray(u)?u:[u]).reduce((g,m)=>(g.push(...L.QrSegment.makeSegments(m)),g),[]);return L.QrCode.encodeSegments(h,Me[o],i,void 0,void 0,C)},[u,o,i,C]);const{cells:s,margin:t,numCells:n,calculatedImageSettings:a}=v.useMemo(()=>{let f=e.getModules();const h=Le(l,c),g=f.length+h*2,m=Ie(f,E,h,d);return{cells:f,margin:h,numCells:g,calculatedImageSettings:m}},[e,E,d,l,c]);return{qrcode:e,margin:t,cells:s,numCells:n,calculatedImageSettings:a}}var ke=(function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0})(),De=v.forwardRef(function(o,i){const l=o,{value:c,size:d=re,level:E=ne,bgColor:C=ie,fgColor:e=oe,includeMargin:s=ae,minVersion:t=le,boostLevel:n,marginSize:a,imageSettings:f}=l,g=G(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:m}=g,x=G(g,["style"]),w=f?.src,p=v.useRef(null),S=v.useRef(null),A=v.useCallback(P=>{p.current=P,typeof i=="function"?i(P):i&&(i.current=P)},[i]),[T,Y]=v.useState(!1),{margin:k,cells:z,numCells:Q,calculatedImageSettings:j}=he({value:c,level:E,minVersion:t,boostLevel:n,includeMargin:s,marginSize:a,imageSettings:f,size:d});v.useEffect(()=>{if(p.current!=null){const P=p.current,M=P.getContext("2d");if(!M)return;let X=z;const D=S.current,K=j!=null&&D!==null&&D.complete&&D.naturalHeight!==0&&D.naturalWi
1dth!==0;K&&j.excavation!=null&&(X=de(z,j.excavation));const W=window.devicePixelRatio||1;P.height=P.width=d*W;const Z=d/Q*W;M.scale(Z,Z),M.fillStyle=C,M.fillRect(0,0,Q,Q),M.fillStyle=e,ke?M.fill(new Path2D(ce(X,k))):z.forEach(function(me,pe){me.forEach(function(ge,be){ge&&M.fillRect(be+k,pe+k,1,1)})}),j&&(M.globalAlpha=j.opacity),K&&M.drawImage(D,j.x+k,j.y+k,j.w,j.h)}}),v.useEffect(()=>{Y(!1)},[w]);const fe=V({height:d,width:d},m);let $=null;return w!=null&&($=v.createElement("img",{src:w,key:w,style:{display:"none"},onLoad:()=>{Y(!0)},ref:S,crossOrigin:j?.crossOrigin})),v.createElement(v.Fragment,null,v.createElement("canvas",V({style:fe,height:d,width:d,ref:A,role:"img"},x)),$)});De.displayName="QRCodeCanvas";var ue=v.forwardRef(function(o,i){const l=o,{value:c,size:d=re,level:E=ne,bgColor:C=ie,fgColor:e=oe,includeMargin:s=ae,minVersion:t=le,boostLevel:n,title:a,marginSize:f,imageSettings:h}=l,g=G(l,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:m,cells:x,numCells:w,calculatedImageSettings:p}=he({value:c,level:E,minVersion:t,boostLevel:n,includeMargin:s,marginSize:f,imageSettings:h,size:d});let S=x,A=null;h!=null&&p!=null&&(p.excavation!=null&&(S=de(x,p.excavation)),A=v.createElement("image",{href:h.src,height:p.h,width:p.w,x:p.x+m,y:p.y+m,preserveAspectRatio:"none",opacity:p.opacity,crossOrigin:p.crossOrigin}));const T=ce(S,m);return v.createElement("svg",V({height:d,width:d,viewBox:`0 0 ${w} ${w}`,ref:i,role:"img"},g),!!a&&v.createElement("title",null,a),v.createElement("path",{fill:C,d:`M0,0 h${w}v${w}H0z`,shapeRendering:"crispEdges"}),v.createElement("path",{fill:e,d:T,shapeRendering:"crispEdges"}),A)});ue.displayName="QRCodeSVG";const F="scan",ee="confirm",U="recovery";class Fe extends v.Component{constructor(o){super(o),this.state={enrollOpen:!1,enrollStep:F,enrollLoading:!1,otpSecret:null,otpProvisioningUri:null,enrollCode:"",enrollError:null,recoveryCodes:[],recoveryAck:!1,disableOpen:!1,disableSubmitting:!1,disablePassword:"",disableCode:"",disableError:null,disablePasswordVisible:!1,regenOpen:!1,regenStep:"form",regenSubmitting:!1,regenCode:"",regenError:null,regenCodes:[],regenAck:!1},this.startEnroll=this.startEnroll.bind(this),this.cancelEnroll=this.cancelEnroll.bind(this),this.advanceFromScan=this.advanceFromScan.bind(this),this.submitEnroll=this.submitEnroll.bind(this),this.closeEnrollOnRecovery=this.closeEnrollOnRecovery.bind(this),this.openDisable=this.openDisable.bind(this),this.closeDisable=this.closeDisable.bind(this),this.submitDisable=this.submitDisable.bind(this),this.openRegen=this.openRegen.bind(this),this.closeRegen=this.closeRegen.bind(this),this.submitRegen=this.submitRegen.bind(this)}startEnroll(){this.setState({enrollOpen:!0,enrollStep:F,enrollLoading:!0,otpSecret:null,otpProvisioningUri:null,enrollCode:"",enrollError:null,recoveryCodes:[],recoveryAck:!1}),B.setup().then(o=>{const i=o.body||{};this.setState({enrollLoading:!1,otpSecret:i.otp_secret,otpProvisioningUri:i.otp_provisioning_uri})}).catch(o=>{const i=o&&o.status||o&&o.response&&o.response.status,l=o&&o.response&&o.response.body&&o.response.body.message||"";if(i===422&&/already enabled/i.test(l)){N.info("Two-factor authentication is already enabled."),this.setState({enrollOpen:!1,enrollLoading:!1}),this.refreshUser();return}N.error("Could not start 2FA setup, please try again."),this.setState({enrollOpen:!1,enrollLoading:!1})})}cancelEnroll(){if(this.state.enrollStep===U){if(!this.state.recoveryAck){N.warn("Please confirm you've saved your recovery codes before closing.");return}this.closeEnrollOnRecovery();return}this.setState({enrollOpen:!1,enrollStep:F,enrollLoading:!1,otpSecret:null,otpProvisioningUri:null,enrollCode:"",enrollError:null})}advanceFromScan(){this.setState({enrollStep:ee,enrollError:null,enrollCode:""})}submitEnroll(o,i){if(o&&o.preventDefault&&o.preventDefault(),this.state.enrollLoading)return;const l=((i!==void 0?i:this.state.enrollCode)||"").trim();if(!l){this.setState({enrollError:"Enter the code from your authenticator app."});return}this.setState({enrollLoading:!0,enrollError:null}),B.enable(l).then(c=>{const d=c.body&&c.body.recovery_codes||[];this.setState({enrollLoading:!1,enrollStep:U,recoveryCodes:d,recoveryAck:!1}),this.refreshUser()}).catch(c=>{const d=c&&c.status||c&&c.response&&c.response.status,E=c&&c.response&&c.response.body&&c.response.body.message||"";if(d===422&&/no pending enrollment/i.test(E)){this.setState({enrollLoading:!1}),N.error("Enrollment expired, please start again."),this.startEnroll();return}if(d===422&&/already enabled/i.test(E)){this.setState({enrollLoading:!1,enrollOpen:!1}),N.info("Two-factor authentication is already enabled."),this.refreshUser();return}this.setState({enrollLoading:!1,enrollError:d===422?E||"Invalid code":"Something went wrong, please try again."})})}closeEnrollOnRecovery(){this.setState({enrollOpen:!1,enrollStep:F,otpSecret:null,otpProvisioningUri:null,enrollCode:"",recoveryCodes:[],recoveryAck:!1})}openDisable(){this.setState({disableOpen:!0,disableSubmitting:!1,disablePassword:"",disableCode:"",disableError:null,disablePasswordVisible:!1})}closeDisable(){this.state.disableSubmitting||this.setState({disableOpen:!1,disablePassword:"",disableCode:"",disableError:null,disablePasswordVisible:!1})}submitDisable(o){if(o&&o.preventDefault&&o.preventDefault(),!this.state.disableSubmitting){if(!this.state.disablePassword||!this.state.disableCode){this.setState({disableError:"Both password and code are required."});return}this.setState({disableSubmitting:!0,disableError:null}),B.disable({password:this.state.disablePassword,mfa_code:this.state.disableCode.trim()}).then(()=>{this.setState({disableOpen:!1,disableSubmitting:!1,disablePassword:"",disableCode:""}),N.success("Two-factor authentication disabled."),this.refreshUser()}).catch(i=>{const l=i&&i.status||i&&i.response&&i.response.status;this.setState({disableSubmitting:!1,disableError:l===401?"Invalid credentials or code, try again.":"Something went wrong, please try again."})})}}openRegen(){this.setState({regenOpen:!0,regenStep:"form",regenSubmitting:!1,regenCode:"",regenError:null,regenCodes:[],regenAck:!1})}closeRegen(){if(!this.state.regenSubmitting){if(this.state.regenStep==="codes"&&!this.state.regenAck){N.warn("Please confirm you've saved your recovery codes before closing.");return}this.setState({regenOpen:!1,regenStep:"form",regenCode:"",regenCodes:[],regenAck:!1,regenError:null})}}submitRegen(o,i){if(o&&o.preventDefault&&o.preventDefault(),this.state.regenSubmitting)return;const l=((i!==void 0?i:this.state.regenCode)||"").trim();if(!l){this.setState({regenError:"Enter the code from your authenticator app."});return}this.setState({regenSubmitting:!0,regenError:null}),B.regenerateRecoveryCodes(l).then(c=>{const d=c.body&&c.body.recovery_codes||[];this.setState({regenSubmitting:!1,regenStep:"codes",regenCodes:d,regenAck:!1})}).catch(c=>{const d=c&&c.status||c&&c.response&&c.response.status;this.setState({regenSubmitting:!1,regenError:d===401?"Invalid code":"Something went wrong, please try again."})})}refreshUser(){this.props.currentUserActions&&this.props.currentUserActions.getCurrent&&this.props.currentUserActions.getCurrent()}copyCodes(o){const i=(o||[]).join(` 2`);Re(i).then(l=>{l?N.success("Recovery codes copied to clipboard."):N.error("Could not copy to clipboard.")})}downloadCodes(o){const i=(o||[]).join(` 3`)+` 4`,l=new Blob([i],{type:"text/plain"}),c=URL.createObjectURL(l),d=document.createElement("a");d.href=c,d.download="mailreach-recovery-codes.txt",document.body.appendChild(d),d.click(),document.body.removeChild(d),URL.revokeObjectURL(c)}renderRecoveryCodesBlock(o,i,l){const c=o||[];return r.jsxs("div",{className:"recovery-codes-block",children:[r.jsxs("div",{className:"recovery-codes-warning",children:[r.jsx("span",{className:"recovery-codes-warning__icon","aria-hidden":"true",children:"!"}),r.jsxs("div",{children:[r.jsx("strong",{children:"Save these now."})," This is the only time we'll show them. If you lose access to your authenticator app, you'll use one of these to sign in. Each code works once."]})]}),r.jsx("ul",{className:"recovery-codes-list",children:c.map((d,E)=>r.jsxs("li",{children:[r.jsx("span",{className:"recovery-codes-list__num",children:String(E+1).padStart(2,"0")}),r.jsx("span",{className:"recovery-codes-list__code",children:d})]},d+E))}),r.jsxs("div",{className:"recovery-codes-actions",children:[r.jsx(R,{variant:"outline",onClick:()=>this.copyCodes(c),children:r.jsx("span",{children:"Copy to clipboard"})}),r.jsx(R,{variant:"outline",onClick:()=>this.downloadCodes(c),children:r.jsx("span",{children:"Download as .txt"})})]}),r.jsxs("label",{className:"recovery-codes-ack",children:[r.jsx("input",{type:"checkbox",checked:i,onChange:d=>l(d.target.checked)}),r.jsx("span",{children:"I have saved my recovery codes in a safe place."})]})]})}render(){const o=this.props.match&&this.props.match.params&&this.props.match.params.project_id||"",i=!!(this.props.currentUser&&this.props.currentUser.otp_enabled);return r.jsxs(we,{projectId:o,page:"Security",children:[r.jsxs("div",{className:"section-title",children:[r.jsx("h3",{children:"Two-factor authentication"}),r.jsx("p",{children:"Add an extra layer of security to your account using an authenticator app."})]}),r.jsx("div",{className:"security-card",children:i?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"security-status security-status--on",children:[r.jsx("span",{className:"dot"}),r.jsx("span",{children:"Two-factor authentication is on."})]}),r.jsxs("div",{className:"security-actions",children:[r.jsx(R,{variant:"primary",onClick:this.openRegen,children:r.jsx("span",{children:"Generate new recovery codes"})}),r.jsx(R,{variant:"secondary",onClick:this.openDisable,children:r.jsx("span",{children:"Disable 2FA"})})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"security-status security-status--off",children:[r.jsx("span",{className:"dot"}),r.jsx("span",{children:"Two-factor authentication is off."})]}),r.jsx("div",{className:"security-actions",children:r.jsxs(R,{variant:"primary",onClick:this.startEnroll,children:[r.jsx("span",{children:"Enable two-factor authentication"}),r.jsx(J,{})]})})]})}),r.jsx(I,{className:"security-modal",show:this.state.enrollOpen,onHide:this.cancelEnroll,backdrop:this.state.enrollStep===U&&!this.state.recoveryAck?"static":!0,keyboard:!(this.state.enrollStep===U&&!this.state.recoveryAck),children:r.jsxs(I.Body,{children:[this.state.enrollStep===F&&r.jsxs(r.Fragment,{children:[r.jsx("h1",{children:"Step 1 â Scan the QR code"}),r.jsx("p",{children:"Open your authenticator app (1Password, Authy, Google Authenticator, â¦) and scan this code."}),r.jsx("div",{className:"qr-block",children:this.state.enrollLoading||!this.state.otpProvisioningUri?r.jsx("div",{className:"qr-placeholder",children:"Loadingâ¦"}):r.jsx(ue,{value:this.state.otpProvisioningUri,size:192,includeMargin:!0})}),this.state.otpSecret&&r.jsxs("div",{className:"manual-secret",children:[r.jsx("p",{className:"muted",children:"Can't scan? Enter this code manually:"}),r.jsx("code",{children:this.state.otpSecret})]}),r.jsxs("div",{className:"modal-actions",children:[r.jsx(R,{variant:"secondary",onClick:this.cancelEnroll,children:"Cancel"}),r.jsxs(R,{variant:"primary",onClick:this.advanceFromScan,disabled:this.state.enrollLoading,children:[r.jsx("span",{children:"Next"}),r.jsx(J,{})]})]})]}),this.state.enrollStep===ee&&r.jsxs("form",{onSubmit:this.submitEnroll,children:[r.jsx("h1",{children:"Step 2 â Confirm"}),r.jsx("p",{children:"Enter the 6-digit code your authenticator app shows for MailReach."}),r.jsx("div",{className:"otp-field",children:r.jsx(H,{length:6,value:this.state.enrollCode,onChange:l=>this.setState({enrollCode:l,enrollError:null}),onComplete:l=>this.submitEnroll(null,l),disabled:this.state.enrollLoading,hasError:!!this.state.enrollError,autoF
4ocus:!0})}),this.state.enrollError&&r.jsx("div",{className:"field-error",children:this.state.enrollError}),r.jsxs("div",{className:"modal-actions",children:[r.jsx(R,{variant:"outline",onClick:this.cancelEnroll,children:"Cancel"}),r.jsx(R,{variant:"primary",onClick:this.submitEnroll,disabled:this.state.enrollLoading,children:r.jsx("span",{children:this.state.enrollLoading?"Verifyingâ¦":"Verify and enable"})})]})]}),this.state.enrollStep===U&&r.jsxs(r.Fragment,{children:[r.jsx("h1",{children:"Step 3 â Save your recovery codes"}),this.renderRecoveryCodesBlock(this.state.recoveryCodes,this.state.recoveryAck,l=>this.setState({recoveryAck:l})),r.jsx("div",{className:"modal-actions",children:r.jsx(R,{variant:"primary",onClick:this.closeEnrollOnRecovery,disabled:!this.state.recoveryAck,children:r.jsx("span",{children:"Done"})})})]})]})}),r.jsx(I,{className:"security-modal",show:this.state.disableOpen,onHide:this.closeDisable,children:r.jsx(I.Body,{children:r.jsxs("form",{onSubmit:this.submitDisable,children:[r.jsx("h1",{children:"Disable two-factor authentication"}),r.jsx("p",{children:"Confirm with your password and current authenticator code."}),r.jsxs("div",{className:"field",children:[r.jsx("input",{type:this.state.disablePasswordVisible?"text":"password",name:"disable_password",autoComplete:"current-password",placeholder:"Current password",value:this.state.disablePassword,onChange:l=>this.setState({disablePassword:l.target.value,disableError:null})}),r.jsx("button",{type:"button",onClick:()=>this.setState({disablePasswordVisible:!this.state.disablePasswordVisible}),title:this.state.disablePasswordVisible?"Hide Password":"Show Password",children:this.state.disablePasswordVisible?r.jsx(xe,{}):r.jsx(Ae,{})})]}),r.jsxs("div",{className:"otp-field otp-field--labeled",children:[r.jsx("label",{className:"otp-field__label",children:"Verification code"}),r.jsx(H,{length:6,size:"sm",value:this.state.disableCode,onChange:l=>this.setState({disableCode:l,disableError:null}),disabled:this.state.disableSubmitting,hasError:!!this.state.disableError,autoFocus:!1})]}),this.state.disableError&&r.jsx("div",{className:"field-error",children:this.state.disableError}),r.jsxs("div",{className:"modal-actions",children:[r.jsx(R,{variant:"outline",onClick:this.closeDisable,disabled:this.state.disableSubmitting,children:"Cancel"}),r.jsx(R,{variant:"primary",onClick:this.submitDisable,disabled:this.state.disableSubmitting,children:r.jsx("span",{children:this.state.disableSubmitting?"Disablingâ¦":"Disable 2FA"})})]})]})})}),r.jsx(I,{className:"security-modal",show:this.state.regenOpen,onHide:this.closeRegen,backdrop:this.state.regenStep==="codes"&&!this.state.regenAck?"static":!0,keyboard:!(this.state.regenStep==="codes"&&!this.state.regenAck),children:r.jsxs(I.Body,{children:[this.state.regenStep==="form"&&r.jsxs("form",{onSubmit:this.submitRegen,children:[r.jsx("h1",{children:"Generate new recovery codes"}),r.jsx("p",{children:"Your old recovery codes will be invalidated immediately. Enter your current authenticator code to continue."}),r.jsx("div",{className:"otp-field",children:r.jsx(H,{length:6,value:this.state.regenCode,onChange:l=>this.setState({regenCode:l,regenError:null}),onComplete:l=>this.submitRegen(null,l),disabled:this.state.regenSubmitting,hasError:!!this.state.regenError,autoFocus:!0})}),this.state.regenError&&r.jsx("div",{className:"field-error",children:this.state.regenError}),r.jsxs("div",{className:"modal-actions",children:[r.jsx(R,{variant:"outline",onClick:this.closeRegen,disabled:this.state.regenSubmitting,children:"Cancel"}),r.jsx(R,{variant:"primary",onClick:this.submitRegen,disabled:this.state.regenSubmitting,children:r.jsx("span",{children:this.state.regenSubmitting?"Generatingâ¦":"Generate"})})]})]}),this.state.regenStep==="codes"&&r.jsxs(r.Fragment,{children:[r.jsx("h1",{children:"Save your new recovery codes"}),this.renderRecoveryCodesBlock(this.state.regenCodes,this.state.regenAck,l=>this.setState({regenAck:l})),r.jsx("div",{className:"modal-actions",children:r.jsx(R,{variant:"primary",onClick:this.closeRegen,disabled:!this.state.regenAck,children:r.jsx("span",{children:"Done"})})})]})]})})]})}}function Ue(u){return{errors:u.errors,currentUser:u.currentUser,currentProject:u.currentProject}}function Te(u){return{currentUserActions:Ce(Se,u)}}const ct=ye(Ee(Ue,Te)(ve()(Fe)));export{ct 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.