@naculus/connect-appkit-ui 0.8.1 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
"use strict";var ra=Object.create;var
|
|
2
|
-
]))+`;Re.KANJI=new RegExp(
|
|
3
|
-
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),t.put(n,13)}};_o.exports=
|
|
4
|
-
Suggested mode is: `+
|
|
1
|
+
"use strict";var ra=Object.create;var Tt=Object.defineProperty;var aa=Object.getOwnPropertyDescriptor;var sa=Object.getOwnPropertyNames;var ia=Object.getPrototypeOf,la=Object.prototype.hasOwnProperty;var W=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),ca=(t,e)=>{for(var n in e)Tt(t,n,{get:e[n],enumerable:!0})},Qn=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of sa(e))!la.call(t,r)&&r!==n&&Tt(t,r,{get:()=>e[r],enumerable:!(o=aa(e,r))||o.enumerable});return t};var tn=(t,e,n)=>(n=t!=null?ra(ia(t)):{},Qn(e||!t||!t.__esModule?Tt(n,"default",{value:t,enumerable:!0}):n,t)),da=t=>Qn(Tt({},"__esModule",{value:!0}),t);var lo=W((mi,io)=>{"use strict";io.exports=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}});var Pe=W(We=>{"use strict";var an,ya=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];We.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};We.getSymbolTotalCodewords=function(e){return ya[e]};We.getBCHDigit=function(t){let e=0;for(;t!==0;)e++,t>>>=1;return e};We.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');an=e};We.isKanjiModeEnabled=function(){return typeof an<"u"};We.toSJIS=function(e){return an(e)}});var Mt=W(me=>{"use strict";me.L={bit:1};me.M={bit:0};me.Q={bit:3};me.H={bit:2};function va(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"l":case"low":return me.L;case"m":case"medium":return me.M;case"q":case"quartile":return me.Q;case"h":case"high":return me.H;default:throw new Error("Unknown EC Level: "+t)}}me.isValid=function(e){return e&&typeof e.bit<"u"&&e.bit>=0&&e.bit<4};me.from=function(e,n){if(me.isValid(e))return e;try{return va(e)}catch{return n}}});var mo=W((gi,uo)=>{"use strict";function co(){this.buffer=[],this.length=0}co.prototype={get:function(t){let e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(let n=0;n<e;n++)this.putBit((t>>>e-n-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){let e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};uo.exports=co});var fo=W((hi,po)=>{"use strict";function gt(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}gt.prototype.set=function(t,e,n,o){let r=t*this.size+e;this.data[r]=n,o&&(this.reservedBit[r]=!0)};gt.prototype.get=function(t,e){return this.data[t*this.size+e]};gt.prototype.xor=function(t,e,n){this.data[t*this.size+e]^=n};gt.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};po.exports=gt});var go=W(zt=>{"use strict";var Ca=Pe().getSymbolSize;zt.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,o=Ca(e),r=o===145?26:Math.ceil((o-13)/(2*n-2))*2,a=[o-7];for(let s=1;s<n-1;s++)a[s]=a[s-1]-r;return a.push(6),a.reverse()};zt.getPositions=function(e){let n=[],o=zt.getRowColCoords(e),r=o.length;for(let a=0;a<r;a++)for(let s=0;s<r;s++)a===0&&s===0||a===0&&s===r-1||a===r-1&&s===0||n.push([o[a],o[s]]);return n}});var xo=W(bo=>{"use strict";var Na=Pe().getSymbolSize,ho=7;bo.getPositions=function(e){let n=Na(e);return[[0,0],[n-ho,0],[0,n-ho]]}});var yo=W(H=>{"use strict";H.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var Ve={N1:3,N2:3,N3:40,N4:10};H.isValid=function(e){return e!=null&&e!==""&&!isNaN(e)&&e>=0&&e<=7};H.from=function(e){return H.isValid(e)?parseInt(e,10):void 0};H.getPenaltyN1=function(e){let n=e.size,o=0,r=0,a=0,s=null,i=null;for(let l=0;l<n;l++){r=a=0,s=i=null;for(let c=0;c<n;c++){let u=e.get(l,c);u===s?r++:(r>=5&&(o+=Ve.N1+(r-5)),s=u,r=1),u=e.get(c,l),u===i?a++:(a>=5&&(o+=Ve.N1+(a-5)),i=u,a=1)}r>=5&&(o+=Ve.N1+(r-5)),a>=5&&(o+=Ve.N1+(a-5))}return o};H.getPenaltyN2=function(e){let n=e.size,o=0;for(let r=0;r<n-1;r++)for(let a=0;a<n-1;a++){let s=e.get(r,a)+e.get(r,a+1)+e.get(r+1,a)+e.get(r+1,a+1);(s===4||s===0)&&o++}return o*Ve.N2};H.getPenaltyN3=function(e){let n=e.size,o=0,r=0,a=0;for(let s=0;s<n;s++){r=a=0;for(let i=0;i<n;i++)r=r<<1&2047|e.get(s,i),i>=10&&(r===1488||r===93)&&o++,a=a<<1&2047|e.get(i,s),i>=10&&(a===1488||a===93)&&o++}return o*Ve.N3};H.getPenaltyN4=function(e){let n=0,o=e.data.length;for(let a=0;a<o;a++)n+=e.data[a];return Math.abs(Math.ceil(n*100/o/5)-10)*Ve.N4};function wa(t,e,n){switch(t){case H.Patterns.PATTERN000:return(e+n)%2===0;case H.Patterns.PATTERN001:return e%2===0;case H.Patterns.PATTERN010:return n%3===0;case H.Patterns.PATTERN011:return(e+n)%3===0;case H.Patterns.PATTERN100:return(Math.floor(e/2)+Math.floor(n/3))%2===0;case H.Patterns.PATTERN101:return e*n%2+e*n%3===0;case H.Patterns.PATTERN110:return(e*n%2+e*n%3)%2===0;case H.Patterns.PATTERN111:return(e*n%3+(e+n)%2)%2===0;default:throw new Error("bad maskPattern:"+t)}}H.applyMask=function(e,n){let o=n.size;for(let r=0;r<o;r++)for(let a=0;a<o;a++)n.isReserved(a,r)||n.xor(a,r,wa(e,a,r))};H.getBestMask=function(e,n){let o=Object.keys(H.Patterns).length,r=0,a=1/0;for(let s=0;s<o;s++){n(s),H.applyMask(s,e);let i=H.getPenaltyN1(e)+H.getPenaltyN2(e)+H.getPenaltyN3(e)+H.getPenaltyN4(e);H.applyMask(s,e),i<a&&(a=i,r=s)}return r}});var ln=W(sn=>{"use strict";var Ae=Mt(),It=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],Lt=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];sn.getBlocksCount=function(e,n){switch(n){case Ae.L:return It[(e-1)*4+0];case Ae.M:return It[(e-1)*4+1];case Ae.Q:return It[(e-1)*4+2];case Ae.H:return It[(e-1)*4+3];default:return}};sn.getTotalCodewordsCount=function(e,n){switch(n){case Ae.L:return Lt[(e-1)*4+0];case Ae.M:return Lt[(e-1)*4+1];case Ae.Q:return Lt[(e-1)*4+2];case Ae.H:return Lt[(e-1)*4+3];default:return}}});var vo=W(Vt=>{"use strict";var ht=new Uint8Array(512),Wt=new Uint8Array(256);(function(){let e=1;for(let n=0;n<255;n++)ht[n]=e,Wt[e]=n,e<<=1,e&256&&(e^=285);for(let n=255;n<512;n++)ht[n]=ht[n-255]})();Vt.log=function(e){if(e<1)throw new Error("log("+e+")");return Wt[e]};Vt.exp=function(e){return ht[e]};Vt.mul=function(e,n){return e===0||n===0?0:ht[Wt[e]+Wt[n]]}});var Co=W(bt=>{"use strict";var cn=vo();bt.mul=function(e,n){let o=new Uint8Array(e.length+n.length-1);for(let r=0;r<e.length;r++)for(let a=0;a<n.length;a++)o[r+a]^=cn.mul(e[r],n[a]);return o};bt.mod=function(e,n){let o=new Uint8Array(e);for(;o.length-n.length>=0;){let r=o[0];for(let s=0;s<n.length;s++)o[s]^=cn.mul(n[s],r);let a=0;for(;a<o.length&&o[a]===0;)a++;o=o.slice(a)}return o};bt.generateECPolynomial=function(e){let n=new Uint8Array([1]);for(let o=0;o<e;o++)n=bt.mul(n,new Uint8Array([1,cn.exp(o)]));return n}});var ko=W((wi,wo)=>{"use strict";var No=Co();function dn(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}dn.prototype.initialize=function(e){this.degree=e,this.genPoly=No.generateECPolynomial(this.degree)};dn.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");let n=new Uint8Array(e.length+this.degree);n.set(e);let o=No.mod(n,this.genPoly),r=this.degree-o.length;if(r>0){let a=new Uint8Array(this.degree);return a.set(o,r),a}return o};wo.exports=dn});var un=W(Ro=>{"use strict";Ro.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}});var mn=W(Re=>{"use strict";var So="[0-9]+",ka="[A-Z $%*+\\-./:]+",xt="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";xt=xt.replace(/u/g,"\\u");var Ra="(?:(?![A-Z0-9 $%*+\\-./:]|"+xt+`)(?:.|[\r
|
|
2
|
+
]))+`;Re.KANJI=new RegExp(xt,"g");Re.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");Re.BYTE=new RegExp(Ra,"g");Re.NUMERIC=new RegExp(So,"g");Re.ALPHANUMERIC=new RegExp(ka,"g");var Sa=new RegExp("^"+xt+"$"),Ta=new RegExp("^"+So+"$"),Ba=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Re.testKanji=function(e){return Sa.test(e)};Re.testNumeric=function(e){return Ta.test(e)};Re.testAlphanumeric=function(e){return Ba.test(e)}});var Ee=W(ee=>{"use strict";var Pa=un(),pn=mn();ee.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]};ee.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]};ee.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]};ee.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]};ee.MIXED={bit:-1};ee.getCharCountIndicator=function(e,n){if(!e.ccBits)throw new Error("Invalid mode: "+e);if(!Pa.isValid(n))throw new Error("Invalid version: "+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]};ee.getBestModeForData=function(e){return pn.testNumeric(e)?ee.NUMERIC:pn.testAlphanumeric(e)?ee.ALPHANUMERIC:pn.testKanji(e)?ee.KANJI:ee.BYTE};ee.toString=function(e){if(e&&e.id)return e.id;throw new Error("Invalid mode")};ee.isValid=function(e){return e&&e.bit&&e.ccBits};function Aa(t){if(typeof t!="string")throw new Error("Param is not a string");switch(t.toLowerCase()){case"numeric":return ee.NUMERIC;case"alphanumeric":return ee.ALPHANUMERIC;case"kanji":return ee.KANJI;case"byte":return ee.BYTE;default:throw new Error("Unknown mode: "+t)}}ee.from=function(e,n){if(ee.isValid(e))return e;try{return Aa(e)}catch{return n}}});var Eo=W(Ue=>{"use strict";var Ut=Pe(),Ea=ln(),To=Mt(),De=Ee(),fn=un(),Po=7973,Bo=Ut.getBCHDigit(Po);function Da(t,e,n){for(let o=1;o<=40;o++)if(e<=Ue.getCapacity(o,n,t))return o}function Ao(t,e){return De.getCharCountIndicator(t,e)+4}function Ma(t,e){let n=0;return t.forEach(function(o){let r=Ao(o.mode,e);n+=r+o.getBitsLength()}),n}function za(t,e){for(let n=1;n<=40;n++)if(Ma(t,n)<=Ue.getCapacity(n,e,De.MIXED))return n}Ue.from=function(e,n){return fn.isValid(e)?parseInt(e,10):n};Ue.getCapacity=function(e,n,o){if(!fn.isValid(e))throw new Error("Invalid QR Code version");typeof o>"u"&&(o=De.BYTE);let r=Ut.getSymbolTotalCodewords(e),a=Ea.getTotalCodewordsCount(e,n),s=(r-a)*8;if(o===De.MIXED)return s;let i=s-Ao(o,e);switch(o){case De.NUMERIC:return Math.floor(i/10*3);case De.ALPHANUMERIC:return Math.floor(i/11*2);case De.KANJI:return Math.floor(i/13);case De.BYTE:default:return Math.floor(i/8)}};Ue.getBestVersionForData=function(e,n){let o,r=To.from(n,To.M);if(Array.isArray(e)){if(e.length>1)return za(e,r);if(e.length===0)return 1;o=e[0]}else o=e;return Da(o.mode,o.getLength(),r)};Ue.getEncodedBits=function(e){if(!fn.isValid(e)||e<7)throw new Error("Invalid QR Code version");let n=e<<12;for(;Ut.getBCHDigit(n)-Bo>=0;)n^=Po<<Ut.getBCHDigit(n)-Bo;return e<<12|n}});var Io=W(zo=>{"use strict";var gn=Pe(),Mo=1335,Ia=21522,Do=gn.getBCHDigit(Mo);zo.getEncodedBits=function(e,n){let o=e.bit<<3|n,r=o<<10;for(;gn.getBCHDigit(r)-Do>=0;)r^=Mo<<gn.getBCHDigit(r)-Do;return(o<<10|r)^Ia}});var Wo=W((Pi,Lo)=>{"use strict";var La=Ee();function Ze(t){this.mode=La.NUMERIC,this.data=t.toString()}Ze.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};Ze.prototype.getLength=function(){return this.data.length};Ze.prototype.getBitsLength=function(){return Ze.getBitsLength(this.data.length)};Ze.prototype.write=function(e){let n,o,r;for(n=0;n+3<=this.data.length;n+=3)o=this.data.substr(n,3),r=parseInt(o,10),e.put(r,10);let a=this.data.length-n;a>0&&(o=this.data.substr(n),r=parseInt(o,10),e.put(r,a*3+1))};Lo.exports=Ze});var Uo=W((Ai,Vo)=>{"use strict";var Wa=Ee(),hn=["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 et(t){this.mode=Wa.ALPHANUMERIC,this.data=t}et.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};et.prototype.getLength=function(){return this.data.length};et.prototype.getBitsLength=function(){return et.getBitsLength(this.data.length)};et.prototype.write=function(e){let n;for(n=0;n+2<=this.data.length;n+=2){let o=hn.indexOf(this.data[n])*45;o+=hn.indexOf(this.data[n+1]),e.put(o,11)}this.data.length%2&&e.put(hn.indexOf(this.data[n]),6)};Vo.exports=et});var Oo=W((Ei,Ho)=>{"use strict";var Va=Ee();function tt(t){this.mode=Va.BYTE,typeof t=="string"?this.data=new TextEncoder().encode(t):this.data=new Uint8Array(t)}tt.getBitsLength=function(e){return e*8};tt.prototype.getLength=function(){return this.data.length};tt.prototype.getBitsLength=function(){return tt.getBitsLength(this.data.length)};tt.prototype.write=function(t){for(let e=0,n=this.data.length;e<n;e++)t.put(this.data[e],8)};Ho.exports=tt});var Fo=W((Di,_o)=>{"use strict";var Ua=Ee(),Ha=Pe();function nt(t){this.mode=Ua.KANJI,this.data=t}nt.getBitsLength=function(e){return e*13};nt.prototype.getLength=function(){return this.data.length};nt.prototype.getBitsLength=function(){return nt.getBitsLength(this.data.length)};nt.prototype.write=function(t){let e;for(e=0;e<this.data.length;e++){let n=Ha.toSJIS(this.data[e]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
|
|
3
|
+
Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),t.put(n,13)}};_o.exports=nt});var Ko=W((Mi,bn)=>{"use strict";var yt={single_source_shortest_paths:function(t,e,n){var o={},r={};r[e]=0;var a=yt.PriorityQueue.make();a.push(e,0);for(var s,i,l,c,u,d,p,h,x;!a.empty();){s=a.pop(),i=s.value,c=s.cost,u=t[i]||{};for(l in u)u.hasOwnProperty(l)&&(d=u[l],p=c+d,h=r[l],x=typeof r[l]>"u",(x||h>p)&&(r[l]=p,a.push(l,p),o[l]=i))}if(typeof n<"u"&&typeof r[n]>"u"){var m=["Could not find a path from ",e," to ",n,"."].join("");throw new Error(m)}return o},extract_shortest_path_from_predecessor_list:function(t,e){for(var n=[],o=e,r;o;)n.push(o),r=t[o],o=t[o];return n.reverse(),n},find_path:function(t,e,n){var o=yt.single_source_shortest_paths(t,e,n);return yt.extract_shortest_path_from_predecessor_list(o,n)},PriorityQueue:{make:function(t){var e=yt.PriorityQueue,n={},o;t=t||{};for(o in e)e.hasOwnProperty(o)&&(n[o]=e[o]);return n.queue=[],n.sorter=t.sorter||e.default_sorter,n},default_sorter:function(t,e){return t.cost-e.cost},push:function(t,e){var n={value:t,cost:e};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};typeof bn<"u"&&(bn.exports=yt)});var Xo=W(ot=>{"use strict";var z=Ee(),Qo=Wo(),$o=Uo(),Go=Oo(),Yo=Fo(),vt=mn(),Ht=Pe(),Oa=Ko();function qo(t){return unescape(encodeURIComponent(t)).length}function Ct(t,e,n){let o=[],r;for(;(r=t.exec(n))!==null;)o.push({data:r[0],index:r.index,mode:e,length:r[0].length});return o}function Jo(t){let e=Ct(vt.NUMERIC,z.NUMERIC,t),n=Ct(vt.ALPHANUMERIC,z.ALPHANUMERIC,t),o,r;return Ht.isKanjiModeEnabled()?(o=Ct(vt.BYTE,z.BYTE,t),r=Ct(vt.KANJI,z.KANJI,t)):(o=Ct(vt.BYTE_KANJI,z.BYTE,t),r=[]),e.concat(n,o,r).sort(function(s,i){return s.index-i.index}).map(function(s){return{data:s.data,mode:s.mode,length:s.length}})}function xn(t,e){switch(e){case z.NUMERIC:return Qo.getBitsLength(t);case z.ALPHANUMERIC:return $o.getBitsLength(t);case z.KANJI:return Yo.getBitsLength(t);case z.BYTE:return Go.getBitsLength(t)}}function _a(t){return t.reduce(function(e,n){let o=e.length-1>=0?e[e.length-1]:null;return o&&o.mode===n.mode?(e[e.length-1].data+=n.data,e):(e.push(n),e)},[])}function Fa(t){let e=[];for(let n=0;n<t.length;n++){let o=t[n];switch(o.mode){case z.NUMERIC:e.push([o,{data:o.data,mode:z.ALPHANUMERIC,length:o.length},{data:o.data,mode:z.BYTE,length:o.length}]);break;case z.ALPHANUMERIC:e.push([o,{data:o.data,mode:z.BYTE,length:o.length}]);break;case z.KANJI:e.push([o,{data:o.data,mode:z.BYTE,length:qo(o.data)}]);break;case z.BYTE:e.push([{data:o.data,mode:z.BYTE,length:qo(o.data)}])}}return e}function Ka(t,e){let n={},o={start:{}},r=["start"];for(let a=0;a<t.length;a++){let s=t[a],i=[];for(let l=0;l<s.length;l++){let c=s[l],u=""+a+l;i.push(u),n[u]={node:c,lastCount:0},o[u]={};for(let d=0;d<r.length;d++){let p=r[d];n[p]&&n[p].node.mode===c.mode?(o[p][u]=xn(n[p].lastCount+c.length,c.mode)-xn(n[p].lastCount,c.mode),n[p].lastCount+=c.length):(n[p]&&(n[p].lastCount=c.length),o[p][u]=xn(c.length,c.mode)+4+z.getCharCountIndicator(c.mode,e))}}r=i}for(let a=0;a<r.length;a++)o[r[a]].end=0;return{map:o,table:n}}function jo(t,e){let n,o=z.getBestModeForData(t);if(n=z.from(e,o),n!==z.BYTE&&n.bit<o.bit)throw new Error('"'+t+'" cannot be encoded with mode '+z.toString(n)+`.
|
|
4
|
+
Suggested mode is: `+z.toString(o));switch(n===z.KANJI&&!Ht.isKanjiModeEnabled()&&(n=z.BYTE),n){case z.NUMERIC:return new Qo(t);case z.ALPHANUMERIC:return new $o(t);case z.KANJI:return new Yo(t);case z.BYTE:return new Go(t)}}ot.fromArray=function(e){return e.reduce(function(n,o){return typeof o=="string"?n.push(jo(o,null)):o.data&&n.push(jo(o.data,o.mode)),n},[])};ot.fromString=function(e,n){let o=Jo(e,Ht.isKanjiModeEnabled()),r=Fa(o),a=Ka(r,n),s=Oa.find_path(a.map,"start","end"),i=[];for(let l=1;l<s.length-1;l++)i.push(a.table[s[l]].node);return ot.fromArray(_a(i))};ot.rawSplit=function(e){return ot.fromArray(Jo(e,Ht.isKanjiModeEnabled()))}});var er=W(Zo=>{"use strict";var _t=Pe(),yn=Mt(),qa=mo(),ja=fo(),Qa=go(),$a=xo(),Nn=yo(),wn=ln(),Ga=ko(),Ot=Eo(),Ya=Io(),Ja=Ee(),vn=Xo();function Xa(t,e){let n=t.size,o=$a.getPositions(e);for(let r=0;r<o.length;r++){let a=o[r][0],s=o[r][1];for(let i=-1;i<=7;i++)if(!(a+i<=-1||n<=a+i))for(let l=-1;l<=7;l++)s+l<=-1||n<=s+l||(i>=0&&i<=6&&(l===0||l===6)||l>=0&&l<=6&&(i===0||i===6)||i>=2&&i<=4&&l>=2&&l<=4?t.set(a+i,s+l,!0,!0):t.set(a+i,s+l,!1,!0))}}function Za(t){let e=t.size;for(let n=8;n<e-8;n++){let o=n%2===0;t.set(n,6,o,!0),t.set(6,n,o,!0)}}function es(t,e){let n=Qa.getPositions(e);for(let o=0;o<n.length;o++){let r=n[o][0],a=n[o][1];for(let s=-2;s<=2;s++)for(let i=-2;i<=2;i++)s===-2||s===2||i===-2||i===2||s===0&&i===0?t.set(r+s,a+i,!0,!0):t.set(r+s,a+i,!1,!0)}}function ts(t,e){let n=t.size,o=Ot.getEncodedBits(e),r,a,s;for(let i=0;i<18;i++)r=Math.floor(i/3),a=i%3+n-8-3,s=(o>>i&1)===1,t.set(r,a,s,!0),t.set(a,r,s,!0)}function Cn(t,e,n){let o=t.size,r=Ya.getEncodedBits(e,n),a,s;for(a=0;a<15;a++)s=(r>>a&1)===1,a<6?t.set(a,8,s,!0):a<8?t.set(a+1,8,s,!0):t.set(o-15+a,8,s,!0),a<8?t.set(8,o-a-1,s,!0):a<9?t.set(8,15-a-1+1,s,!0):t.set(8,15-a-1,s,!0);t.set(o-8,8,1,!0)}function ns(t,e){let n=t.size,o=-1,r=n-1,a=7,s=0;for(let i=n-1;i>0;i-=2)for(i===6&&i--;;){for(let l=0;l<2;l++)if(!t.isReserved(r,i-l)){let c=!1;s<e.length&&(c=(e[s]>>>a&1)===1),t.set(r,i-l,c),a--,a===-1&&(s++,a=7)}if(r+=o,r<0||n<=r){r-=o,o=-o;break}}}function os(t,e,n){let o=new qa;n.forEach(function(l){o.put(l.mode.bit,4),o.put(l.getLength(),Ja.getCharCountIndicator(l.mode,t)),l.write(o)});let r=_t.getSymbolTotalCodewords(t),a=wn.getTotalCodewordsCount(t,e),s=(r-a)*8;for(o.getLengthInBits()+4<=s&&o.put(0,4);o.getLengthInBits()%8!==0;)o.putBit(0);let i=(s-o.getLengthInBits())/8;for(let l=0;l<i;l++)o.put(l%2?17:236,8);return rs(o,t,e)}function rs(t,e,n){let o=_t.getSymbolTotalCodewords(e),r=wn.getTotalCodewordsCount(e,n),a=o-r,s=wn.getBlocksCount(e,n),i=o%s,l=s-i,c=Math.floor(o/s),u=Math.floor(a/s),d=u+1,p=c-u,h=new Ga(p),x=0,m=new Array(s),f=new Array(s),S=0,g=new Uint8Array(t.buffer);for(let E=0;E<s;E++){let we=E<l?u:d;m[E]=g.slice(x,x+we),f[E]=h.encode(m[E]),x+=we,S=Math.max(S,we)}let w=new Uint8Array(o),A=0,T,J;for(T=0;T<S;T++)for(J=0;J<s;J++)T<m[J].length&&(w[A++]=m[J][T]);for(T=0;T<p;T++)for(J=0;J<s;J++)w[A++]=f[J][T];return w}function as(t,e,n,o){let r;if(Array.isArray(t))r=vn.fromArray(t);else if(typeof t=="string"){let c=e;if(!c){let u=vn.rawSplit(t);c=Ot.getBestVersionForData(u,n)}r=vn.fromString(t,c||40)}else throw new Error("Invalid data");let a=Ot.getBestVersionForData(r,n);if(!a)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=a;else if(e<a)throw new Error(`
|
|
5
5
|
The chosen QR Code version cannot contain this amount of data.
|
|
6
6
|
Minimum version required to store current data is: `+a+`.
|
|
7
|
-
`);let
|
|
8
|
-
`;return typeof o=="function"&&o(null,f),f}});var ir=L(Nt=>{"use strict";var ds=lo(),Tn=er(),sr=nr(),us=ar();function Bn(t,e,n,o,r){let a=[].slice.call(arguments,1),i=a.length,s=typeof a[i-1]=="function";if(!s&&!ds())throw new Error("Callback required as last argument");if(s){if(i<2)throw new Error("Too few arguments provided");i===2?(r=n,n=e,e=o=void 0):i===3&&(e.getContext&&typeof r>"u"?(r=o,o=void 0):(r=o,o=n,n=e,e=void 0))}else{if(i<1)throw new Error("Too few arguments provided");return i===1?(n=e,e=o=void 0):i===2&&!e.getContext&&(o=n,n=e,e=void 0),new Promise(function(l,c){try{let u=Tn.create(n,o);l(t(u,e,o))}catch(u){c(u)}})}try{let l=Tn.create(n,o);r(null,t(l,e,o))}catch(l){r(l)}}Nt.create=Tn.create;Nt.toCanvas=Bn.bind(null,sr.render);Nt.toDataURL=Bn.bind(null,sr.renderToDataURL);Nt.toString=Bn.bind(null,function(t,e,n){return us.render(t,n)})});var qs={};ca(qs,{AccountButton:()=>Et,AccountSelector:()=>Cr,AccountSelectorView:()=>zn,AddressWarningDialog:()=>Lr,AppKit:()=>Hn,AppKitButton:()=>On,AppKitChainSelector:()=>_n,AuthorizationConsent:()=>_r,AuthorizationList:()=>Fr,ChainSelector:()=>Oe,ConnectButton:()=>Be,ErrorBoundary:()=>at,PasskeySetup:()=>Tr,PasskeySetupView:()=>Vn,PassphraseDialog:()=>Sr,PassphraseDialogView:()=>Wn,PaymentReceipt:()=>qr,QRCodeModal:()=>ot,RouteSelector:()=>Er,SeedPhraseBackup:()=>rt,SignInButton:()=>Kt,SmartWalletSettings:()=>zr,SmartWalletToggle:()=>Mr,ThemeProvider:()=>qt,WalletConnectProvider:()=>Tt,WalletPicker:()=>Wr,WalletSecurityPanel:()=>kr,WalletSecurityPanelView:()=>In,Web3ComponentProvider:()=>Qt,Web3ConnectUI:()=>ct,cn:()=>v,useAppKit:()=>Un,useComponent:()=>hr,useComponentRegistry:()=>T,useDetectionMode:()=>fr,useEIP6963:()=>Qe,useIsMobile:()=>$e,useTheme:()=>Dn,useThemeVariable:()=>ur,useWalletConnect:()=>Gn,useWalletConnectOptional:()=>Bt});module.exports=da(qs);var ge=require("react"),Jn=require("@naculus/connect-appkit-react");var G=require("react"),$n=require("@naculus/connect-appkit-react"),Yn=require("react/jsx-runtime"),nn=(0,G.createContext)(null);function Tt({children:t}){let e=(0,$n.useWeb3)(),[n,o]=(0,G.useState)(null),[r,a]=(0,G.useState)(!1),[i,s]=(0,G.useState)("idle"),[l,c]=(0,G.useState)(null),u=(0,G.useRef)(0),d=(0,G.useRef)(null);(0,G.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]);let f=(0,G.useCallback)(()=>{u.current+=1,e.cancelPairing?.(),d.current&&(clearTimeout(d.current),d.current=null),o(null),a(!1),s("cancelled"),c(null)},[e]),b=(0,G.useRef)(void 0);b.current=async()=>{if(!e.startPairing||!e.completePairing){c("WalletConnect pairing not available"),s("error");return}let p=++u.current,k=()=>u.current===p;s("loading"),c(null),a(!0);try{let A=await e.startPairing();if(!k())return;o(A),s("ready");try{if(await e.completePairing(),!k())return;d.current=setTimeout(()=>{d.current=null,k()&&(a(!1),o(null),s("idle"))},1e3)}catch(S){if(!k())return;s("error"),c(S instanceof Error?S.message:"Connection failed")}}catch(A){if(!k())return;s("error"),c(A instanceof Error?A.message:"Failed to generate QR code")}};let g=(0,G.useCallback)(async()=>{await b.current?.()},[]),m=(0,G.useCallback)(()=>{o(null),c(null),s("loading"),b.current?.()},[]),C=(0,G.useMemo)(()=>({qrUri:n,showQR:r,qrStatus:i,error:l}),[n,r,i,l]),B=(0,G.useMemo)(()=>({state:C,connectWalletConnect:g,cancelQR:f,retryQR:m}),[C,g,f,m]);return(0,Yn.jsx)(nn.Provider,{value:B,children:t})}function Gn(){let t=(0,G.useContext)(nn);if(!t)throw new Error("useWalletConnect must be used within a WalletConnectProvider");return t}function Bt(){return(0,G.useContext)(nn)}var Le=require("react");function Qe(){let[t,e]=(0,Le.useState)([]),[n,o]=(0,Le.useState)(!0),r=(0,Le.useRef)(new Set);return(0,Le.useEffect)(()=>{r.current.clear(),o(!0);let a=c=>{let u=c.detail,d=u?.info,f=u?.provider;!d?.rdns||r.current.has(d.rdns)||(r.current.add(d.rdns),e(b=>b.find(g=>g.id===d.rdns)?b:[...b,{id:d.rdns,name:d.name||d.rdns,icon:d.icon||"",rdns:d.rdns,provider:f}]))};window.addEventListener("eip6963:announceProvider",a);let i=window,s=(c,u,d)=>{r.current.has(c)||(r.current.add(c),e(f=>f.some(b=>b.id===c)?f:[...f,{id:c,name:u,icon:"",rdns:c,provider:d}]))};i.ethereum?.isMetaMask&&s("io.metamask","MetaMask",i.ethereum),i.phantom?s("app.phantom","Phantom",i.phantom):i.solana?.isPhantom&&s("app.phantom","Phantom",i.solana),window.dispatchEvent(new Event("eip6963:requestProvider"));let l=setTimeout(()=>o(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",a),clearTimeout(l)}},[]),{wallets:t,isDetecting:n,hasWallets:t.length>0}}var Pt=require("react");function $e(){let[t,e]=(0,Pt.useState)(!1);return(0,Pt.useEffect)(()=>{if(typeof navigator>"u"||typeof window>"u")return;let n=navigator.userAgent.toLowerCase();e(/(iphone|ipad|ipod|android|mobile)/i.test(n))},[]),t}var on=require("react/jsx-runtime");function Be({className:t,isConnected:e,isConnecting:n,onConnect:o,onDisconnect:r,onMobileDeepLink:a,mobileWalletName:i,startPairing:s,completePairing:l,address:c,balance:u,balanceSymbol:d,tokenBalances:f,isBalanceLoading:b,explorerUrl:g,explorerLabel:m}){let C=Bt(),{wallets:B}=Qe(),p=$e(),k=JSON.stringify(B.map(({id:te,name:xe,icon:re,rdns:je})=>({id:te,name:xe,icon:re,rdns:je}))),[A,S]=(0,ge.useState)(null),[$,V]=(0,ge.useState)(!1),[we,oe]=(0,ge.useState)(null),ce=(0,ge.useRef)({aborted:!1}),pt=(0,ge.useCallback)(()=>{ce.current.aborted=!0,C?.cancelQR(),V(!1),S(null),oe(null)},[C]);(0,ge.useEffect)(()=>{if(!C)return;let{qrStatus:te,qrUri:xe,error:re}=C.state;te==="loading"?(V(!0),S(null),oe(null)):te==="ready"&&xe?(V(!1),S(xe),oe(null)):te==="error"?(V(!1),oe(re)):(te==="idle"||te==="cancelled")&&(V(!1),S(null),oe(null))},[C?.state?.qrStatus,C?.state?.qrUri,C?.state?.error]);let ke=(0,ge.useCallback)((te,xe)=>{if(te==="walletconnect"){if(C){C.connectWalletConnect();return}if(s&&l){V(!0),oe(null),ce.current.aborted=!1,s().then(re=>{ce.current.aborted||(S(re),V(!1),l().then(()=>{ce.current.aborted||S(null)}).catch(je=>{ce.current.aborted||oe(je instanceof Error?je.message:"Connection failed")}))}).catch(re=>{ce.current.aborted||(V(!1),oe(re instanceof Error?re.message:"Connection failed"))});return}}o?.(te,()=>{},xe)},[C,s,l,o]);return(0,on.jsx)("div",{className:t,children:(0,on.jsx)(Jn.AppkitConnectButton,{connected:e??!1,connecting:n??!1,address:c??"",balance:u??null,balanceSymbol:d??"",isBalanceLoading:b??!1,tokenBalancesJson:JSON.stringify(f??[]),explorerUrl:g??"",explorerLabel:m??"",walletsJson:k,isMobile:p,mobileWalletName:i??"",qrUri:A,qrLoading:$,qrError:we,onAppkitConnect:te=>{ke(te.detail.kind,te.detail.walletId)},onAppkitDisconnect:()=>r?.(),onAppkitStartPairing:()=>ke("walletconnect"),onAppkitRetry:()=>{ce.current.aborted=!0,oe(null),S(null),ke("walletconnect")},onAppkitCancelPairing:pt,onAppkitMobileDeepLink:()=>a?.(),onAppkitCopyAddress:te=>{navigator.clipboard?.writeText(te.detail).catch(()=>{})}})})}var xr=require("@naculus/connect-core"),ut=require("react"),$t=require("@naculus/connect-appkit-react");var Xn=require("clsx"),Zn=require("tailwind-merge");function v(...t){return(0,Zn.twMerge)((0,Xn.clsx)(t))}var eo='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 0l-.26.97v28.15l.26.26 13.07-7.72L12 0z" fill="#8C8C8C"/><path d="M12 0L-.87 21.69l12.87 7.72V0z" fill="#3C3C3B"/><path d="M12 31.88l-.16.2v10.55l.16.47 13.08-18.42L12 31.88z" fill="#8C8C8C"/><path d="M12 42.9V31.88L-.87 24.68 12 42.9z" fill="#3C3C3B"/><path d="M12 28.41l13.07-7.72L12 14.09v14.32z" fill="#141414"/><path d="M-.87 20.69L12 28.41V14.09l-12.87 6.6z" fill="#393939"/></svg>',ua='<svg viewBox="0 0 24 22" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15 12.3l-3.7 2.2-3.8-2.2V7.9L11.3 5.7 15 7.9v2.7l-2.2 1.3-1.5-.9v-2l1.5.9 2.2-1.3V7.9L11.3 4 6 7.9v6.3l5.3 3.1 5.3-3.1-1.6-2.8z" fill="#6C00F6"/></svg>',ma='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#F0B90B"/><path d="M12 4l2.7 1.6L14.7 7 12 5.4 9.3 7l-.7-.4L12 4zm4.7 2.7l-2.7 1.6V10l4 2.3v4.7L16 18.7v-4l-1.3-.7v4L12 20l-2.7-1.6v-4L8 14.7v4l-1.3-.7V12.3l4-2.3V8.3l-2.7-1.6.7-.4L12 8l2.7-1.7.7.4z" fill="white"/></svg>',pa='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 1.5c.3 0 .6.1.8.2l8.8 5.1c.5.3.9.9.9 1.5v10.2c0 .6-.3 1.2-.9 1.5l-8.8 5.1c-.3.2-.6.2-.8.2s-.6-.1-.8-.2l-8.8-5.1c-.5-.3-.9-.9-.9-1.5V8.3c0-.6.3-1.2.9-1.5l8.8-5.1c.3-.2.6-.2.8-.2z" fill="#213147"/><path d="M14.7 13.8l-1.2 3.2c0 .1 0 .2.1.3l2 5.5 2.3-1.3-2.8-7.6c-.1-.2-.3-.2-.4-.1z" fill="#12AAFF"/><path d="M16.3 8.5c0-.2-.3-.2-.4 0l-1.1 3.2c0 .1 0 .2.1.3l3.3 9 2.3-1.3-4.2-9.1v-.1z" fill="#12AAFF"/><path d="M12 3.5c.1 0 .2 0 .3.1l8.8 5.1c.1.1.2.2.2.3v10.2c0 .1-.1.2-.2.3l-8.8 5.1c-.1 0-.2.1-.3.1s-.2 0-.3-.1l-8.8-5.1c-.1-.1-.2-.2-.2-.3V9c0-.1.1-.2.2-.3l8.8-5.1c.1 0 .2-.1.3-.1z" fill="#9DCCED" fill-opacity="0.3"/><path d="M13.3 6.2h-2.2c-.2 0-.3.1-.4.3L5.9 19.6l2.3 1.3L13 6.5c0-.1-.1-.3-.2-.3h.4z" fill="white"/><path d="M15.2 6.2H13c-.2 0-.3.1-.4.3L8.1 21.4l2.3 1.3 6-16.4c0-.1-.1-.3-.2-.3v.2z" fill="white"/></svg>',fa='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#FF0420"/><path d="M8.5 16c-.5 0-.9-.1-1.3-.3-.4-.2-.7-.5-1-.8-.3-.4-.4-.8-.4-1.3V10c0-.5.1-1 .4-1.4.3-.4.6-.7 1-.9.4-.2.8-.3 1.3-.3.4 0 .8.1 1.2.2.3.2.6.4.8.7l-1 1c-.2-.2-.4-.3-.6-.4-.2-.1-.5-.2-.8-.2-.3 0-.6.1-.9.2-.3.2-.5.4-.6.7-.1.3-.2.6-.2 1v3.5c0 .3.1.6.2.9.1.3.3.5.6.6.3.2.6.2.9.2.3 0 .6-.1.8-.2.2-.1.4-.3.6-.5l1 1c-.2.3-.5.5-.8.7-.4.2-.9.3-1.4.3z" fill="white"/><path d="M15.5 16c-.5 0-.9-.1-1.3-.3-.4-.2-.7-.5-1-.8-.2-.4-.4-.8-.4-1.3V10c0-.5.1-1 .4-1.4.2-.4.5-.7.9-.9.4-.2.8-.3 1.3-.3.5 0 1 .1 1.4.3.4.2.7.5.9.9.2.4.3.9.3 1.4v.7h-2.9v-1.1c0-.3-.1-.6-.2-.9-.1-.3-.3-.5-.5-.6-.2-.1-.5-.2-.8-.2-.3 0-.6.1-.8.2-.3.2-.5.4-.6.7-.1.3-.2.6-.2 1v3.5c0 .3.1.6.2.8.1.3.3.5.6.6.2.2.5.2.8.2.3 0 .6-.1.8-.2.2-.1.4-.3.5-.6.1-.3.2-.6.2-1v-1.1h2.9v.7c0 .5-.1 1-.3 1.4-.2.4-.5.7-.9.9-.4.2-.9.3-1.4.3z" fill="white"/></svg>',ga='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#E84142"/><path d="M8.6 16.8H6.3c-.5 0-.8-.1-1-.3-.2-.2-.3-.5-.3-.8 0-.2 0-.4.1-.6l5.8-10.7c.2-.4.5-.7.8-.8.3-.1.5-.1.7 0 .2.1.5.3.7.8l1.2 2.1.1.2c.3.5.5.9.5 1.3.1.4.1.8 0 1.1-.1.4-.3.8-.6 1.3l-3 5.4c-.2.5-.5.8-.8 1-.4.2-.7.2-1.2.2z" fill="white"/><path d="M14.5 16.8h3.3c.5 0 .7-.1 1-.3.2-.2.3-.5.3-.8 0-.2-.1-.4-.3-.7l-1.7-3-.2-.3c-.2-.4-.4-.7-.6-.8-.2-.1-.4-.1-.6 0-.2.1-.4.3-.6.8l-1.6 3c-.2.4-.4.7-.4.9 0 .2.1.5.3.7.1.1.4.3.9.3z" fill="white"/></svg>',ha='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#1969FF"/><path d="M11.3 3.8c.4-.2 1-.2 1.4 0l4.1 2.2c.2.1.4.3.4.5h0v10.9c0 .2-.1.4-.4.6l-4.1 2.2c-.4.2-1 .2-1.4 0l-4.1-2.2c-.3-.1-.4-.4-.4-.6V6.5c0-.2.1-.4.4-.5l4.1-2.2zm5.3 8.7l-3.9 2c-.4.2-1 .2-1.4 0l-3.9-2v4.8l3.9 2c.2.1.5.2.7.2.2 0 .5-.1.7-.2l3.9-2v-4.8z" fill="white"/></svg>',ba={"eip155:1":eo,"eip155:137":ua,"eip155:56":ma,"eip155:42161":pa,"eip155:10":fa,"eip155:43114":ga,"eip155:250":ha,"eip155:11155111":eo};function At(t){return ba[t]}var dt=require("react");var oo=require("lucide-react");var Ye=require("react/jsx-runtime");function U({className:t,variant:e,size:n,type:o="button",...r}){return(0,Ye.jsx)("button",{type:o,className:v("inline-flex items-center justify-center gap-2 rounded-lg border px-4 py-2 text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",e==="outline"?"border-input bg-transparent hover:bg-accent":e==="ghost"?"border-transparent bg-transparent hover:bg-accent":"border-primary bg-primary text-primary-foreground hover:bg-primary/90",n==="sm"?"h-9 px-3":n==="icon"?"h-10 w-10 p-0":"h-10",t),...r})}function ve({className:t,...e}){return(0,Ye.jsx)("div",{className:v("rounded-xl border border-border bg-card text-card-foreground shadow-sm",t),...e})}function Ge({className:t,variant:e,...n}){return(0,Ye.jsx)("span",{className:v("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium",t),...n})}function to(t){return(0,Ye.jsx)("input",{...t})}function no({className:t,...e}){return(0,Ye.jsx)("hr",{className:v("h-px bg-border",t),...e})}var he=require("react/jsx-runtime");function ya({children:t}){return(0,he.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary text-primary-foreground",children:t})}function Et({className:t,showAddress:e=!0,showBalance:n=!1,address:o,balance:r,balanceSymbol:a,onConnect:i}){let l=T().Button??U;if(!o)return(0,he.jsxs)(l,{"aria-label":"Connect Wallet",onClick:i,className:t,children:[(0,he.jsx)(oo.Wallet,{size:18,className:"shrink-0"}),"Connect Wallet"]});let c=o.includes(":")?o.split(":").pop():o,u=c.slice(0,6)+"..."+c.slice(-4),d=r!=null?parseFloat(r).toLocaleString(void 0,{maximumFractionDigits:4})+(a?` ${a}`:""):null;return(0,he.jsxs)(l,{className:t,children:[(0,he.jsx)(ya,{children:"W"}),(0,he.jsxs)("div",{className:"flex flex-col items-start gap-0",children:[e&&(0,he.jsx)("span",{className:"font-mono text-xs",children:u}),n&&d&&(0,he.jsx)("span",{className:"text-xs text-muted-foreground",children:d}),n&&!d&&r===null&&(0,he.jsx)("span",{className:"text-xs text-muted-foreground",children:"Loading..."})]})]})}var be=require("react"),pe=require("lucide-react");var rn=require("react");var ro=require("lucide-react"),ue=require("react/jsx-runtime");function Je({open:t,onClose:e,children:n,closable:o,className:r,title:a}){return(0,rn.useEffect)(()=>{if(!t)return;let i=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=i}},[t]),(0,rn.useEffect)(()=>{if(!t||!e)return;let i=s=>{s.key==="Escape"&&e()};return window.addEventListener("keydown",i),()=>window.removeEventListener("keydown",i)},[t,e]),t?(0,ue.jsxs)("div",{className:v("naculus-dialog-viewport fixed inset-0 z-50 flex items-center justify-center p-4",r),style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",padding:"1rem"},children:[(0,ue.jsx)("div",{className:"absolute inset-0 bg-black/80","aria-hidden":"true",onClick:e,style:{position:"absolute",inset:0,background:"rgb(0 0 0 / 0.8)"}}),(0,ue.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":a??"Dialog",className:"naculus-dialog-surface relative z-10 flex w-full max-w-lg flex-col overflow-y-auto rounded-xl border bg-card p-6 text-card-foreground shadow-2xl",style:{position:"relative",zIndex:10,width:"100%",maxWidth:"32rem",overflowY:"auto",borderRadius:"0.75rem",padding:"1.5rem",background:"hsl(var(--card, 0 0% 100%))",color:"hsl(var(--card-foreground, 222.2 84% 4.9%))",boxShadow:"0 25px 50px -12px rgb(0 0 0 / 0.4)"},children:[o&&e&&(0,ue.jsx)("button",{onClick:e,type:"button","aria-label":"Close modal",className:"absolute right-4 top-4 z-20 rounded-md p-1 text-muted-foreground hover:text-foreground",style:{position:"absolute",right:"1rem",top:"1rem",zIndex:20,border:0,background:"transparent",cursor:"pointer",color:"inherit"},children:(0,ue.jsx)("svg",{"aria-hidden":"true",className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,ue.jsx)("path",{d:"M18 6 6 18M6 6l12 12","data-testid":"x-icon"})})}),n]})]}):null}function ao({title:t,onClose:e,showCloseButton:n=!0}){return(0,ue.jsxs)("div",{className:"sticky top-0 z-10 -mx-1 mb-4 flex items-center justify-between bg-card px-1 py-1",children:[(0,ue.jsx)("h2",{className:"text-lg font-semibold m-0",children:t}),n&&e&&(0,ue.jsx)("button",{onClick:e,type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-all duration-200","aria-label":"Close",children:(0,ue.jsx)(ro.X,{size:16})})]})}function so({children:t,className:e=""}){return(0,ue.jsx)("div",{className:v("flex flex-col gap-4",e),children:t})}var D=require("react/jsx-runtime");async function ms(t,e){let n=await Promise.resolve().then(()=>tn(ir(),1)),r=(n.default??n).toCanvas??n.toCanvas;if(typeof r!="function")throw new Error("qrcode.toCanvas is unavailable");return new Promise((a,i)=>{r(t,e,{width:280,margin:2},s=>{s?i(s):a()})})}function ot({uri:t,open:e,onClose:n,onDeepLink:o,onRetry:r,status:a="pending",showDeepLink:i,timeoutMs:s=300*1e3,title:l="Scan with WalletConnect",description:c="Open your wallet app and scan this QR code to connect.",className:u}){let d=(0,be.useRef)(null),[f,b]=(0,be.useState)(null),[g,m]=(0,be.useState)(0),C=$e(),B=T(),p=B.Button,k=i??C,A=(0,be.useRef)(null);(0,be.useEffect)(()=>{!e||!t||!d.current||(b(null),ms(d.current,t).catch(re=>{b(re instanceof Error?re.message:"Unable to render QR code")}))},[e,t]),(0,be.useEffect)(()=>{if(!e||a!=="pending"){A.current&&(clearInterval(A.current),A.current=null),m(0);return}let re=Date.now();return A.current=setInterval(()=>m(Date.now()-re),1e3),()=>{A.current&&clearInterval(A.current)}},[e,a,s]);let S=g>=s&&a==="pending",$=S||a==="expired"||a==="error",V=Math.max(0,Math.ceil((s-g)/1e3)),we=Math.floor(V/60),oe=V%60,ce=Math.min(g/s,1),pt=(0,be.useCallback)(()=>{t&&o&&o(t)},[t,o]),ke=t&&!S&&a==="pending"?f?(0,D.jsxs)("div",{className:"w-[280px] h-[280px] flex flex-col items-center justify-center bg-muted rounded-lg gap-2",children:[(0,D.jsx)(pe.AlertCircle,{size:24,className:"text-muted-foreground"}),(0,D.jsx)("span",{className:"text-sm text-muted-foreground",children:"Failed to render QR code"})]}):(0,D.jsx)("canvas",{ref:d,width:280,height:280,role:"img","aria-label":"WalletConnect pairing QR code",className:"rounded-lg border border-border"}):(0,D.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 bg-muted rounded-lg w-[280px] h-[280px]",children:[a==="scanned"?(0,D.jsx)(pe.CheckCircle2,{size:48,className:"text-[hsl(var(--primary))]"}):(0,D.jsx)(pe.AlertCircle,{size:48,className:"text-destructive"}),(0,D.jsx)("span",{className:"text-sm text-muted-foreground","data-testid":"status-label",children:a==="scanned"?"QR code scanned! Connecting...":S||a==="expired"?"Connection timed out.":"Something went wrong. Try again."})]}),xe=B.Modal??Je;return(0,D.jsx)(xe,{open:e,onClose:n,closable:!0,title:l,className:u,children:(0,D.jsxs)("div",{className:"p-6",children:[(0,D.jsxs)("div",{className:"sticky top-0 z-10 -mx-1 mb-5 bg-card px-1 py-1 text-center",children:[(0,D.jsx)("div",{className:"flex justify-center mb-3",children:a==="pending"&&!S&&(0,D.jsx)(pe.Loader2,{size:20,className:"animate-spin text-primary","data-testid":"loader-icon-inline"})}),(0,D.jsx)("h3",{className:"text-lg font-semibold m-0 text-foreground",children:l}),c&&(0,D.jsx)("p",{className:"text-sm text-muted-foreground mt-1.5 mb-0",children:c})]}),(0,D.jsx)("div",{className:"flex justify-center mb-4",children:ke}),a==="pending"&&!S&&(0,D.jsxs)("div",{className:"mb-3",children:[(0,D.jsx)("div",{className:"h-1 bg-muted rounded-full overflow-hidden",role:"progressbar","aria-valuenow":Math.round((1-ce)*100),"aria-valuemin":0,"aria-valuemax":100,children:(0,D.jsx)("div",{className:"h-full bg-primary rounded-full transition-all duration-1000",style:{width:`${(1-ce)*100}%`}})}),(0,D.jsxs)("p",{"data-testid":"countdown",className:"text-xs text-muted-foreground text-center mt-1.5 mb-0",children:["Expires in ",we,":",oe.toString().padStart(2,"0")]})]}),(0,D.jsxs)("div",{"data-dialog-actions":!0,className:"sticky bottom-0 z-10 -mx-1 flex flex-col gap-2 border-t border-border bg-card px-1 pb-[max(0rem,env(safe-area-inset-bottom))] pt-3",children:[k&&t&&a==="pending"&&!S&&(0,D.jsxs)("button",{type:"button",onClick:pt,className:"inline-flex items-center justify-center gap-2 w-full rounded-lg border border-input bg-card px-4 py-2.5 text-sm font-medium text-foreground hover:bg-accent hover:text-accent-foreground transition-all duration-200 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[(0,D.jsx)(pe.Smartphone,{size:16})," Open in Wallet App"]}),$&&r&&(p?(0,D.jsxs)(p,{onClick:r,variant:"default",size:"default",className:"w-full",children:[(0,D.jsx)(pe.RefreshCw,{size:16})," Generate New QR Code"]}):(0,D.jsxs)("button",{type:"button",onClick:r,className:"inline-flex items-center justify-center gap-2 w-full rounded-lg bg-primary text-primary-foreground px-4 py-2.5 text-sm font-medium hover:bg-primary/90 transition-all duration-200 cursor-pointer border-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[(0,D.jsx)(pe.RefreshCw,{size:16})," Generate New QR Code"]})),p?(0,D.jsx)(p,{onClick:n,variant:"outline",size:"default",className:"w-full",children:"Cancel"}):(0,D.jsx)("button",{type:"button",onClick:n,className:"inline-flex items-center justify-center w-full rounded-lg border border-input bg-transparent px-4 py-2.5 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all duration-200 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:"Cancel"})]})]})})}var Ft=require("react"),se=require("lucide-react");var w=require("react/jsx-runtime");function Kt({className:t,isSignedIn:e=!1,isSigningIn:n=!1,result:o=null,error:r=null,onSignIn:a,onClearError:i,children:s}){let[l,c]=(0,Ft.useState)(!1),[u,d]=(0,Ft.useState)(!1),[f,b]=(0,Ft.useState)(!1),g=T(),m=g.Button??U,C=g.Dialog,B=g.DialogContent,p=g.DialogHeader,k=g.DialogTitle,A=async()=>{if(o?.signature)try{await navigator.clipboard.writeText(o.signature),b(!1),d(!0),setTimeout(()=>d(!1),2e3)}catch{d(!1),b(!0)}};return!e&&!n&&!r?(0,w.jsx)(m,{onClick:a,className:t,"aria-label":"Sign In",children:(0,w.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,w.jsx)(se.LogIn,{size:16}),s??"Sign In"]})}):n?(0,w.jsx)(m,{disabled:!0,className:t,"aria-label":"Signing In",children:(0,w.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,w.jsx)(se.Loader2,{size:16,className:"animate-spin"}),"Signing In..."]})}):r&&!e?(0,w.jsxs)("div",{style:{position:"relative",display:"inline-flex",flexDirection:"column"},children:[(0,w.jsx)(m,{onClick:a,className:t,"aria-label":"Retry Sign In",children:(0,w.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,w.jsx)(se.AlertCircle,{size:16,style:{color:"var(--destructive, #ef4444)"}}),s??"Retry Sign In"]})}),(0,w.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--destructive, #ef4444)",padding:"0.25rem 0.5rem",borderRadius:"0.375rem",background:"var(--destructive-foreground, #fef2f2)",marginTop:"2px",wordBreak:"break-word",maxWidth:"100%",lineHeight:1.4},children:r.message})]}):(0,w.jsxs)("div",{style:{position:"relative",display:"inline-block"},children:[(0,w.jsx)(m,{onClick:()=>c(S=>!S),className:t,children:(0,w.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,w.jsx)(se.CheckCircle2,{size:16,style:{color:"#22c55e"}}),(0,w.jsx)("span",{style:{fontSize:"0.875rem",fontWeight:500},children:"Signed In"})]})}),l&&(C&&B?(0,w.jsx)(C,{open:!0,onOpenChange:S=>{S||c(!1)},children:(0,w.jsx)(B,{children:p&&k?(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(p,{children:(0,w.jsx)(k,{children:"Sign-In Details"})}),(0,w.jsx)(Pn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:f,onCopy:A})]}):(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)("div",{style:{fontWeight:600,fontSize:"1.125rem",marginBottom:"0.75rem"},children:"Sign-In Details"}),(0,w.jsx)(Pn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:f,onCopy:A})]})})}):l&&(0,w.jsx)("div",{style:{position:"absolute",top:"calc(100% + 8px)",right:0,zIndex:100,width:"340px",maxWidth:"90vw",background:"var(--card, #fff)",border:"1px solid var(--border, #e2e8f0)",borderRadius:"0.75rem",boxShadow:"0 10px 25px rgba(0,0,0,0.1)",padding:"1rem"},children:(0,w.jsx)(Pn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:f,onCopy:A})}))]})}function Pn({result:t,onClose:e,copiedSign:n,onCopy:o,copyFailed:r}){let i=T().Button??U;if(!t)return(0,w.jsxs)("div",{style:{textAlign:"center",padding:"1rem 0"},children:[(0,w.jsx)(se.CheckCircle2,{size:32,style:{color:"#22c55e",margin:"0 auto 0.75rem"}}),(0,w.jsx)("p",{style:{fontSize:"0.875rem",color:"var(--muted-foreground, #64748b)"},children:"Authenticated successfully"}),(0,w.jsx)(i,{variant:"outline",size:"sm",onClick:e,children:"Close"})]});let{message:s,signature:l}=t,c=l.length>20?l.slice(0,14)+"..."+l.slice(-6):l;return(0,w.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[(0,w.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,w.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[(0,w.jsx)(se.CheckCircle2,{size:18,color:"#22c55e"}),(0,w.jsx)("span",{style:{fontWeight:600,fontSize:"0.9375rem"},children:"Signed In"})]}),(0,w.jsx)(i,{variant:"ghost",size:"icon",onClick:e,children:(0,w.jsx)(se.X,{size:16})})]}),(0,w.jsxs)("div",{style:{display:"grid",gap:"0.375rem"},children:[(0,w.jsxs)("div",{children:[(0,w.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Domain"}),(0,w.jsx)("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem"},children:s.domain})]}),(0,w.jsxs)("div",{children:[(0,w.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Address"}),(0,w.jsx)("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem",wordBreak:"break-all"},children:s.address})]}),(0,w.jsxs)("div",{children:[(0,w.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Chain"}),(0,w.jsx)("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem"},children:s.chainId})]})]}),s.statement&&(0,w.jsx)("div",{style:{padding:"0.5rem 0.625rem",borderRadius:"0.375rem",background:"var(--muted, #f1f5f9)",fontSize:"0.8125rem",lineHeight:1.5},children:s.statement}),(0,w.jsxs)("div",{children:[(0,w.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.25rem"},children:[(0,w.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Signature"}),(0,w.jsx)(i,{variant:"ghost",size:"icon",onClick:o,title:r?"This browser refused the clipboard \u2014 select the signature and copy it":"Copy signature","aria-label":r?"Copy failed":"Copy signature",children:n?(0,w.jsx)(se.Check,{size:12,color:"#22c55e"}):(0,w.jsx)(se.Copy,{size:12})})]}),(0,w.jsx)("p",{style:{fontSize:"0.75rem",fontFamily:"monospace",wordBreak:"break-all",lineHeight:1.4,color:"var(--muted-foreground, #64748b)",background:"var(--muted, #f1f5f9)",padding:"0.375rem 0.5rem",borderRadius:"0.375rem"},children:c})]}),(0,w.jsx)(i,{variant:"outline",className:"w-full",onClick:e,children:"Close"})]})}var X=require("react"),F=require("lucide-react");var h=require("react/jsx-runtime");function ps(t){let e=Math.floor(4294967296/t)*t,n=new Uint32Array(1),o;do crypto.getRandomValues(n),o=n[0];while(o>=e);return o%t}function An(t){let e=[...t];for(let n=e.length-1;n>0;n--){let o=ps(n+1);[e[n],e[o]]=[e[o],e[n]]}return e}function lr(t,e=3){let n=t.trim().split(/\s+/);return An(n.map((r,a)=>a)).slice(0,Math.min(e,n.length)).map(r=>{let a=n[r],i=n.filter((c,u)=>u!==r),s=An(i).slice(0,3),l=An([a,...s]);return{index:r,correct:a,options:l}})}function rt({seedPhrase:t,onConfirm:e,onSkip:n,onExportPrivateKey:o,className:r,wordCount:a,inline:i=!1,open:s=!0,onOpenChange:l}){let c=T(),u=c.Button??U,d=c.Dialog,f=c.DialogContent,b=c.DialogHeader,g=c.DialogTitle,[m,C]=(0,X.useState)("reveal"),[B,p]=(0,X.useState)(!1),[k,A]=(0,X.useState)(!1),[S,$]=(0,X.useState)(!1),[V,we]=(0,X.useState)(()=>lr(t,3)),[oe,ce]=(0,X.useState)({}),[pt,ke]=(0,X.useState)([]),[te,xe]=(0,X.useState)(!1),[re,je]=(0,X.useState)(null),qn=(0,X.useMemo)(()=>t.trim().split(/\s+/),[t]),jr=(0,X.useMemo)(()=>{let _=new Map;return qn.map(ae=>{let de=_.get(ae)??0;return _.set(ae,de+1),{word:ae,key:`${ae}-${de}`}})},[qn]),Qr=(0,X.useCallback)(()=>p(!0),[]),$r=(0,X.useCallback)(async()=>{try{await navigator.clipboard.writeText(t),$(!1),A(!0),setTimeout(()=>A(!1),2e3)}catch{A(!1),$(!0)}},[t]),Gr=(0,X.useCallback)(()=>{we(lr(t,3)),ce({}),ke([]),C("confirm")},[t]),Yr=(0,X.useCallback)((_,ae)=>{ce(de=>({...de,[_]:ae})),ke(de=>de.filter(en=>en!==_))},[]),Jr=(0,X.useCallback)(()=>{let _=[];for(let ae of V)oe[ae.index]!==ae.correct&&_.push(ae.index);if(_.length>0){ke(_);return}C("done"),e()},[V,oe,e]),jn=(0,X.useCallback)(()=>{n?.()},[n]),Xr=(0,X.useCallback)(()=>{if(o){let _=o();je(_),xe(!0)}},[o]),Zr=V.every(_=>oe[_.index]!==void 0),ea=(0,h.jsxs)("div",{className:"space-y-4",children:[(0,h.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/30 px-4 py-3",children:(0,h.jsxs)("div",{className:"flex items-start gap-2",children:[(0,h.jsx)(F.AlertTriangle,{size:16,className:"mt-0.5 shrink-0 text-amber-600 dark:text-amber-400"}),(0,h.jsx)("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:"Write down these words in order and store them somewhere safe. Never share them with anyone. If you lose your seed phrase, your funds cannot be recovered."})]})}),B?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4",children:jr.map(({word:_,key:ae},de)=>(0,h.jsxs)("div",{className:"flex items-center gap-1.5 rounded-md border bg-card px-2.5 py-1.5 text-sm",children:[(0,h.jsx)("span",{className:"text-xs text-muted-foreground w-5 shrink-0 text-right",children:de+1}),(0,h.jsx)("span",{className:"font-mono font-medium",children:_})]},ae))}),(0,h.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,h.jsxs)(u,{onClick:$r,variant:"outline",size:"sm",children:[k?(0,h.jsx)(F.Check,{size:14}):(0,h.jsx)(F.Copy,{size:14}),k?"Copied":S?"Copy failed":"Copy"]}),o&&(0,h.jsxs)(u,{onClick:Xr,variant:"outline",size:"sm",children:[(0,h.jsx)(F.Download,{size:14}),"Export Private Key"]})]}),S&&(0,h.jsx)("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:"This browser would not let the page write to your clipboard. Nothing was copied \u2014 select the words above and copy them yourself, or write them down."}),te&&re&&(0,h.jsxs)("div",{className:"rounded-lg border border-border bg-muted p-3 space-y-2",children:[(0,h.jsxs)("div",{className:"flex items-center gap-2",children:[(0,h.jsx)(F.EyeOff,{size:14,className:"text-muted-foreground"}),(0,h.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Private Key (keep secret!)"})]}),(0,h.jsx)("p",{className:"font-mono text-xs break-all select-all",children:re})]}),(0,h.jsxs)("div",{"data-dialog-actions":!0,className:"sticky bottom-0 z-10 -mx-1 flex min-h-14 flex-col gap-2 border-t border-border bg-card px-1 pb-[max(0rem,env(safe-area-inset-bottom))] pt-3 sm:flex-row sm:justify-between",children:[(0,h.jsxs)(u,{onClick:Gr,variant:"default",children:["I've Saved It",(0,h.jsx)(F.ArrowRight,{size:16})]}),n&&(0,h.jsxs)(u,{onClick:jn,variant:"ghost",size:"sm",children:[(0,h.jsx)(F.SkipForward,{size:14}),"Skip Backup"]})]})]}):(0,h.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6",children:[(0,h.jsx)(F.Shield,{size:40,className:"text-muted-foreground"}),(0,h.jsx)("p",{className:"text-sm text-muted-foreground text-center",children:"Click the button below to reveal your seed phrase. Make sure no one is watching your screen."}),(0,h.jsxs)(u,{onClick:Qr,variant:"default",children:[(0,h.jsx)(F.Eye,{size:16}),"Reveal Seed Phrase"]})]})]}),ta=(0,h.jsxs)("div",{className:"space-y-4",children:[(0,h.jsx)("p",{className:"text-sm text-muted-foreground",children:"Verify your backup by selecting the correct word for each position."}),V.map(_=>{let ae=pt.includes(_.index);return(0,h.jsxs)("div",{className:"space-y-2",children:[(0,h.jsxs)("p",{className:v("text-sm font-medium",ae?"text-destructive":"text-foreground"),children:["Word #",_.index+1,ae&&(0,h.jsx)("span",{className:"ml-2 text-xs text-destructive",children:"(incorrect)"})]}),(0,h.jsx)("div",{className:"grid grid-cols-2 gap-2",children:_.options.map(de=>{let en=oe[_.index]===de;return(0,h.jsx)("button",{type:"button",onClick:()=>Yr(_.index,de),className:v("rounded-md border px-3 py-2 text-sm font-mono transition-all duration-200 cursor-pointer text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",en?"border-primary bg-primary/10 text-primary font-medium":ae?"border-destructive/50 bg-destructive/5":"border-border bg-card hover:border-primary/50"),children:de},`${_.index}-${de}`)})})]},_.index)}),(0,h.jsxs)("div",{"data-dialog-actions":!0,className:"sticky bottom-0 z-10 -mx-1 flex min-h-14 flex-col gap-2 border-t border-border bg-card px-1 pb-[max(0rem,env(safe-area-inset-bottom))] pt-3 sm:flex-row sm:justify-between",children:[(0,h.jsxs)(u,{onClick:Jr,variant:"default",disabled:!Zr,children:[(0,h.jsx)(F.Check,{size:16}),"Verify & Confirm"]}),(0,h.jsxs)("div",{className:"flex gap-2",children:[(0,h.jsxs)(u,{onClick:()=>C("reveal"),variant:"ghost",size:"sm",children:[(0,h.jsx)(F.ArrowLeft,{size:14}),"Back"]}),n&&(0,h.jsxs)(u,{onClick:jn,variant:"ghost",size:"sm",children:[(0,h.jsx)(F.SkipForward,{size:14}),"Skip"]})]})]})]}),na={reveal:ea,confirm:ta,done:(0,h.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6 text-center",children:[(0,h.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/30",children:(0,h.jsx)(F.Check,{size:24,className:"text-green-600 dark:text-green-400"})}),(0,h.jsx)("p",{className:"font-medium text-foreground",children:"Backup Confirmed"}),(0,h.jsx)("p",{className:"text-sm text-muted-foreground",children:"Your seed phrase has been backed up successfully."})]})},oa={reveal:"Backup Seed Phrase",confirm:"Verify Backup",done:"Backup Complete"},Rt=na[m],ft=oa[m];return i?(0,h.jsxs)("div",{className:v("space-y-4",r),children:[m!=="done"&&(0,h.jsx)("h3",{className:"text-lg font-semibold",children:ft}),Rt]}):s?d&&f?(0,h.jsx)(d,{open:!0,onOpenChange:_=>{_||l?.(!1)},children:(0,h.jsx)(f,{className:"naculus-dialog-surface flex w-full max-w-lg flex-col overflow-y-auto",children:b&&g?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(b,{children:(0,h.jsx)(g,{children:ft})}),(0,h.jsx)("div",{className:"mt-2 max-h-[55vh] overflow-y-auto",children:Rt})]}):(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("div",{className:"mb-3 text-lg font-semibold",children:ft}),(0,h.jsx)("div",{className:"max-h-[55vh] overflow-y-auto",children:Rt})]})})}):(0,h.jsxs)(Je,{open:!0,onClose:()=>l?.(!1),title:ft,children:[(0,h.jsxs)("div",{className:"sticky top-0 z-10 -mx-1 mb-4 flex items-center justify-between bg-card px-1 py-1",children:[(0,h.jsx)("h2",{className:"text-lg font-semibold m-0",children:ft}),l&&(0,h.jsx)("button",{onClick:()=>l(!1),type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-all duration-200 cursor-pointer border-none bg-transparent","aria-label":"Close",children:(0,h.jsx)(F.X,{size:16})})]}),Rt]}):null}var cr=tn(require("react"),1);var z=require("react/jsx-runtime");function fs({error:t,reset:e,dismiss:n,retryLabel:o="Try Again"}){let r=T(),a=r.Button??U,i=r.Dialog,s=r.DialogContent,l=r.DialogHeader,c=r.DialogTitle;if(i&&s)return(0,z.jsx)(i,{open:!0,onOpenChange:()=>{},children:(0,z.jsx)(s,{className:"naculus-dialog-surface flex w-full max-w-lg flex-col overflow-y-auto",children:l&&c?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(l,{children:(0,z.jsx)(c,{children:"Something went wrong"})}),(0,z.jsxs)("div",{style:{marginTop:"0.5rem"},children:[(0,z.jsx)("p",{style:{color:"var(--muted-foreground, #666)",fontSize:"0.875rem",lineHeight:"1.5",margin:0},children:t.message||"An unexpected error occurred while connecting your wallet."}),(0,z.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&(0,z.jsx)(a,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),(0,z.jsx)(a,{variant:"default",size:"default",onClick:e,children:o})]})]})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)("div",{style:{fontWeight:600,fontSize:"1.125rem",marginBottom:"0.75rem"},children:"Something went wrong"}),(0,z.jsx)("p",{style:{color:"var(--muted-foreground, #666)",fontSize:"0.875rem",lineHeight:"1.5",margin:0},children:t.message||"An unexpected error occurred while connecting your wallet."}),(0,z.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&(0,z.jsx)(a,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),(0,z.jsx)(a,{variant:"default",size:"default",onClick:e,children:o})]})]})})});let u=!0,d=n??void 0;return(0,z.jsxs)(Je,{open:u,onClose:d,title:"Something went wrong",children:[(0,z.jsx)(ao,{title:"Something went wrong",onClose:d,showCloseButton:!!n}),(0,z.jsxs)(so,{children:[(0,z.jsx)("p",{style:{color:"var(--muted-foreground, #666)",fontSize:"0.875rem",lineHeight:"1.5",margin:0},children:t.message||"An unexpected error occurred while connecting your wallet."}),(0,z.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&(0,z.jsx)(a,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),(0,z.jsx)(a,{variant:"default",size:"default",onClick:e,children:o})]})]})]})}var at=class extends cr.default.Component{constructor(e){super(e),this.state={hasError:!1,error:null,dismissed:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e,dismissed:!1}}componentDidCatch(e,n){this.props.onError?.(e,n)}handleReset=()=>{this.setState({hasError:!1,error:null,dismissed:!1}),this.props.onReset?.()};handleDismiss=()=>{this.setState(e=>({...e,dismissed:!0})),this.props.onDismiss?.()};render(){return this.state.dismissed?this.props.children:this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback({error:this.state.error,reset:this.handleReset}):(0,z.jsx)(fs,{error:this.state.error,reset:this.handleReset,dismiss:this.props.onDismiss?this.handleDismiss:void 0,retryLabel:this.props.retryLabel}):this.props.children}};var lt=require("react"),mr=require("@naculus/connect-appkit-react");var Z=require("react");var st={primary:{name:"--primary",fallback:"221.2 83.2% 53.3%"},"primary-foreground":{name:"--primary-foreground",fallback:"210 40% 98%"},background:{name:"--background",fallback:"0 0% 100%"},foreground:{name:"--foreground",fallback:"222.2 84% 4.9%"},card:{name:"--card",fallback:"0 0% 100%"},"card-foreground":{name:"--card-foreground",fallback:"222.2 84% 4.9%"},popover:{name:"--popover",fallback:"0 0% 100%"},"popover-foreground":{name:"--popover-foreground",fallback:"222.2 84% 4.9%"},secondary:{name:"--secondary",fallback:"210 40% 96.1%"},"secondary-foreground":{name:"--secondary-foreground",fallback:"222.2 47.4% 11.2%"},muted:{name:"--muted",fallback:"210 40% 96.1%"},"muted-foreground":{name:"--muted-foreground",fallback:"215.4 16.3% 46.9%"},accent:{name:"--accent",fallback:"210 40% 96.1%"},"accent-foreground":{name:"--accent-foreground",fallback:"222.2 47.4% 11.2%"},destructive:{name:"--destructive",fallback:"0 84.2% 60.2%"},border:{name:"--border",fallback:"214.3 31.8% 91.4%"},input:{name:"--input",fallback:"214.3 31.8% 91.4%"},ring:{name:"--ring",fallback:"221.2 83.2% 53.3%"},radius:{name:"--radius",fallback:"0.5rem"}},gs=new Map;function En(){gs.clear()}var jt=require("react/jsx-runtime"),dr=(0,Z.createContext)({theme:{},isDark:!1,setTheme:()=>{},toggleDarkMode:()=>{}}),hs=/[;{}<>\r\n\\]/;function bs(t){let e=[];for(let[n,o]of Object.entries(t)){let r=st[n];r&&o&&!hs.test(String(o))&&e.push(" "+r.name+": "+o+";")}return e.length===0?"":`:root {
|
|
7
|
+
`);let s=os(e,n,r),i=_t.getSymbolSize(e),l=new ja(i);return Xa(l,e),Za(l),es(l,e),Cn(l,n,0),e>=7&&ts(l,e),ns(l,s),isNaN(o)&&(o=Nn.getBestMask(l,Cn.bind(null,l,n))),Nn.applyMask(o,l),Cn(l,n,o),{modules:l,version:e,errorCorrectionLevel:n,maskPattern:o,segments:r}}Zo.create=function(e,n){if(typeof e>"u"||e==="")throw new Error("No input text");let o=yn.M,r,a;return typeof n<"u"&&(o=yn.from(n.errorCorrectionLevel,yn.M),r=Ot.from(n.version),a=Nn.from(n.maskPattern),n.toSJISFunc&&_t.setToSJISFunction(n.toSJISFunc)),as(e,r,o,a)}});var kn=W(He=>{"use strict";function tr(t){if(typeof t=="number"&&(t=t.toString()),typeof t!="string")throw new Error("Color should be defined as hex string");let e=t.slice().replace("#","").split("");if(e.length<3||e.length===5||e.length>8)throw new Error("Invalid hex color: "+t);(e.length===3||e.length===4)&&(e=Array.prototype.concat.apply([],e.map(function(o){return[o,o]}))),e.length===6&&e.push("F","F");let n=parseInt(e.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:"#"+e.slice(0,6).join("")}}He.getOptions=function(e){e||(e={}),e.color||(e.color={});let n=typeof e.margin>"u"||e.margin===null||e.margin<0?4:e.margin,o=e.width&&e.width>=21?e.width:void 0,r=e.scale||4;return{width:o,scale:o?4:r,margin:n,color:{dark:tr(e.color.dark||"#000000ff"),light:tr(e.color.light||"#ffffffff")},type:e.type,rendererOpts:e.rendererOpts||{}}};He.getScale=function(e,n){return n.width&&n.width>=e+n.margin*2?n.width/(e+n.margin*2):n.scale};He.getImageWidth=function(e,n){let o=He.getScale(e,n);return Math.floor((e+n.margin*2)*o)};He.qrToImageData=function(e,n,o){let r=n.modules.size,a=n.modules.data,s=He.getScale(r,o),i=Math.floor((r+o.margin*2)*s),l=o.margin*s,c=[o.color.light,o.color.dark];for(let u=0;u<i;u++)for(let d=0;d<i;d++){let p=(u*i+d)*4,h=o.color.light;if(u>=l&&d>=l&&u<i-l&&d<i-l){let x=Math.floor((u-l)/s),m=Math.floor((d-l)/s);h=c[a[x*r+m]?1:0]}e[p++]=h.r,e[p++]=h.g,e[p++]=h.b,e[p]=h.a}}});var nr=W(Ft=>{"use strict";var Rn=kn();function ss(t,e,n){t.clearRect(0,0,e.width,e.height),e.style||(e.style={}),e.height=n,e.width=n,e.style.height=n+"px",e.style.width=n+"px"}function is(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}Ft.render=function(e,n,o){let r=o,a=n;typeof r>"u"&&(!n||!n.getContext)&&(r=n,n=void 0),n||(a=is()),r=Rn.getOptions(r);let s=Rn.getImageWidth(e.modules.size,r),i=a.getContext("2d"),l=i.createImageData(s,s);return Rn.qrToImageData(l.data,e,r),ss(i,a,s),i.putImageData(l,0,0),a};Ft.renderToDataURL=function(e,n,o){let r=o;typeof r>"u"&&(!n||!n.getContext)&&(r=n,n=void 0),r||(r={});let a=Ft.render(e,n,r),s=r.type||"image/png",i=r.rendererOpts||{};return a.toDataURL(s,i.quality)}});var ar=W(rr=>{"use strict";var ls=kn();function or(t,e){let n=t.a/255,o=e+'="'+t.hex+'"';return n<1?o+" "+e+'-opacity="'+n.toFixed(2).slice(1)+'"':o}function Sn(t,e,n){let o=t+e;return typeof n<"u"&&(o+=" "+n),o}function cs(t,e,n){let o="",r=0,a=!1,s=0;for(let i=0;i<t.length;i++){let l=Math.floor(i%e),c=Math.floor(i/e);!l&&!a&&(a=!0),t[i]?(s++,i>0&&l>0&&t[i-1]||(o+=a?Sn("M",l+n,.5+c+n):Sn("m",r,0),r=0,a=!1),l+1<e&&t[i+1]||(o+=Sn("h",s),s=0)):r++}return o}rr.render=function(e,n,o){let r=ls.getOptions(n),a=e.modules.size,s=e.modules.data,i=a+r.margin*2,l=r.color.light.a?"<path "+or(r.color.light,"fill")+' d="M0 0h'+i+"v"+i+'H0z"/>':"",c="<path "+or(r.color.dark,"stroke")+' d="'+cs(s,a,r.margin)+'"/>',u='viewBox="0 0 '+i+" "+i+'"',p='<svg xmlns="http://www.w3.org/2000/svg" '+(r.width?'width="'+r.width+'" height="'+r.width+'" ':"")+u+' shape-rendering="crispEdges">'+l+c+`</svg>
|
|
8
|
+
`;return typeof o=="function"&&o(null,p),p}});var ir=W(Nt=>{"use strict";var ds=lo(),Tn=er(),sr=nr(),us=ar();function Bn(t,e,n,o,r){let a=[].slice.call(arguments,1),s=a.length,i=typeof a[s-1]=="function";if(!i&&!ds())throw new Error("Callback required as last argument");if(i){if(s<2)throw new Error("Too few arguments provided");s===2?(r=n,n=e,e=o=void 0):s===3&&(e.getContext&&typeof r>"u"?(r=o,o=void 0):(r=o,o=n,n=e,e=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(n=e,e=o=void 0):s===2&&!e.getContext&&(o=n,n=e,e=void 0),new Promise(function(l,c){try{let u=Tn.create(n,o);l(t(u,e,o))}catch(u){c(u)}})}try{let l=Tn.create(n,o);r(null,t(l,e,o))}catch(l){r(l)}}Nt.create=Tn.create;Nt.toCanvas=Bn.bind(null,sr.render);Nt.toDataURL=Bn.bind(null,sr.renderToDataURL);Nt.toString=Bn.bind(null,function(t,e,n){return us.render(t,n)})});var qs={};ca(qs,{AccountButton:()=>Dt,AccountSelector:()=>Cr,AccountSelectorView:()=>zn,AddressWarningDialog:()=>Lr,AppKit:()=>Hn,AppKitButton:()=>On,AppKitChainSelector:()=>_n,AuthorizationConsent:()=>_r,AuthorizationList:()=>Fr,ChainSelector:()=>Oe,ConnectButton:()=>Be,ErrorBoundary:()=>st,PasskeySetup:()=>Tr,PasskeySetupView:()=>Vn,PassphraseDialog:()=>Sr,PassphraseDialogView:()=>Wn,PaymentReceipt:()=>qr,QRCodeModal:()=>rt,RouteSelector:()=>Er,SeedPhraseBackup:()=>at,SignInButton:()=>qt,SmartWalletSettings:()=>zr,SmartWalletToggle:()=>Mr,ThemeProvider:()=>jt,WalletConnectProvider:()=>Bt,WalletPicker:()=>Wr,WalletSecurityPanel:()=>kr,WalletSecurityPanelView:()=>In,Web3ComponentProvider:()=>$t,Web3ConnectUI:()=>dt,cn:()=>C,useAppKit:()=>Un,useComponent:()=>hr,useComponentRegistry:()=>B,useDetectionMode:()=>fr,useEIP6963:()=>$e,useIsMobile:()=>Ge,useTheme:()=>Dn,useThemeVariable:()=>ur,useWalletConnect:()=>Gn,useWalletConnectOptional:()=>Pt});module.exports=da(qs);var ge=require("react"),Jn=require("@naculus/connect-appkit-react");var $=require("react"),$n=require("@naculus/connect-appkit-react"),Yn=require("react/jsx-runtime"),nn=(0,$.createContext)(null);function Bt({children:t}){let e=(0,$n.useWeb3)(),[n,o]=(0,$.useState)(null),[r,a]=(0,$.useState)(!1),[s,i]=(0,$.useState)("idle"),[l,c]=(0,$.useState)(null),u=(0,$.useRef)(0),d=(0,$.useRef)(null);(0,$.useEffect)(()=>()=>{d.current&&clearTimeout(d.current)},[]);let p=(0,$.useCallback)(()=>{u.current+=1,e.cancelPairing?.(),d.current&&(clearTimeout(d.current),d.current=null),o(null),a(!1),i("cancelled"),c(null)},[e]),h=(0,$.useRef)(void 0);h.current=async()=>{if(!e.startPairing||!e.completePairing){c("WalletConnect pairing not available"),i("error");return}let g=++u.current,w=()=>u.current===g;i("loading"),c(null),a(!0);try{let A=await e.startPairing();if(!w())return;o(A),i("ready");try{if(await e.completePairing(),!w())return;d.current=setTimeout(()=>{d.current=null,w()&&(a(!1),o(null),i("idle"))},1e3)}catch(T){if(!w())return;i("error"),c(T instanceof Error?T.message:"Connection failed")}}catch(A){if(!w())return;i("error"),c(A instanceof Error?A.message:"Failed to generate QR code")}};let x=(0,$.useCallback)(async()=>{await h.current?.()},[]),m=(0,$.useCallback)(()=>{o(null),c(null),i("loading"),h.current?.()},[]),f=(0,$.useMemo)(()=>({qrUri:n,showQR:r,qrStatus:s,error:l}),[n,r,s,l]),S=(0,$.useMemo)(()=>({state:f,connectWalletConnect:x,cancelQR:p,retryQR:m}),[f,x,p,m]);return(0,Yn.jsx)(nn.Provider,{value:S,children:t})}function Gn(){let t=(0,$.useContext)(nn);if(!t)throw new Error("useWalletConnect must be used within a WalletConnectProvider");return t}function Pt(){return(0,$.useContext)(nn)}var Le=require("react");function $e(){let[t,e]=(0,Le.useState)([]),[n,o]=(0,Le.useState)(!0),r=(0,Le.useRef)(new Set);return(0,Le.useEffect)(()=>{r.current.clear(),o(!0);let a=c=>{let u=c.detail,d=u?.info,p=u?.provider;!d?.rdns||r.current.has(d.rdns)||(r.current.add(d.rdns),e(h=>h.find(x=>x.id===d.rdns)?h:[...h,{id:d.rdns,name:d.name||d.rdns,icon:d.icon||"",rdns:d.rdns,provider:p}]))};window.addEventListener("eip6963:announceProvider",a);let s=window,i=(c,u,d)=>{r.current.has(c)||(r.current.add(c),e(p=>p.some(h=>h.id===c)?p:[...p,{id:c,name:u,icon:"",rdns:c,provider:d}]))};s.ethereum?.isMetaMask&&i("io.metamask","MetaMask",s.ethereum),s.phantom?i("app.phantom","Phantom",s.phantom):s.solana?.isPhantom&&i("app.phantom","Phantom",s.solana),window.dispatchEvent(new Event("eip6963:requestProvider"));let l=setTimeout(()=>o(!1),500);return()=>{window.removeEventListener("eip6963:announceProvider",a),clearTimeout(l)}},[]),{wallets:t,isDetecting:n,hasWallets:t.length>0}}var At=require("react");function Ge(){let[t,e]=(0,At.useState)(!1);return(0,At.useEffect)(()=>{if(typeof navigator>"u"||typeof window>"u")return;let n=navigator.userAgent.toLowerCase();e(/(iphone|ipad|ipod|android|mobile)/i.test(n))},[]),t}var on=require("react/jsx-runtime");function Be({className:t,isConnected:e,isConnecting:n,onConnect:o,onDisconnect:r,onMobileDeepLink:a,mobileWalletName:s,startPairing:i,completePairing:l,address:c,balance:u,balanceSymbol:d,tokenBalances:p,isBalanceLoading:h,explorerUrl:x,explorerLabel:m}){let f=Pt(),{wallets:S}=$e(),g=Ge(),w=JSON.stringify(S.map(({id:te,name:ye,icon:re,rdns:Qe})=>({id:te,name:ye,icon:re,rdns:Qe}))),[A,T]=(0,ge.useState)(null),[J,E]=(0,ge.useState)(!1),[we,oe]=(0,ge.useState)(null),ce=(0,ge.useRef)({aborted:!1}),pt=(0,ge.useCallback)(()=>{ce.current.aborted=!0,f?.cancelQR(),E(!1),T(null),oe(null)},[f]);(0,ge.useEffect)(()=>{if(!f)return;let{qrStatus:te,qrUri:ye,error:re}=f.state;te==="loading"?(E(!0),T(null),oe(null)):te==="ready"&&ye?(E(!1),T(ye),oe(null)):te==="error"?(E(!1),oe(re)):(te==="idle"||te==="cancelled")&&(E(!1),T(null),oe(null))},[f?.state?.qrStatus,f?.state?.qrUri,f?.state?.error]);let ke=(0,ge.useCallback)((te,ye)=>{if(te==="walletconnect"){if(f){f.connectWalletConnect();return}if(i&&l){E(!0),oe(null),ce.current.aborted=!1,i().then(re=>{ce.current.aborted||(T(re),E(!1),l().then(()=>{ce.current.aborted||T(null)}).catch(Qe=>{ce.current.aborted||oe(Qe instanceof Error?Qe.message:"Connection failed")}))}).catch(re=>{ce.current.aborted||(E(!1),oe(re instanceof Error?re.message:"Connection failed"))});return}}o?.(te,()=>{},ye)},[f,i,l,o]);return(0,on.jsx)("div",{className:t,children:(0,on.jsx)(Jn.AppkitConnectButton,{connected:e??!1,connecting:n??!1,address:c??"",balance:u??null,balanceSymbol:d??"",isBalanceLoading:h??!1,tokenBalancesJson:JSON.stringify(p??[]),explorerUrl:x??"",explorerLabel:m??"",walletsJson:w,isMobile:g,mobileWalletName:s??"",qrUri:A,qrLoading:J,qrError:we,onAppkitConnect:te=>{ke(te.detail.kind,te.detail.walletId)},onAppkitDisconnect:()=>r?.(),onAppkitStartPairing:()=>ke("walletconnect"),onAppkitRetry:()=>{ce.current.aborted=!0,oe(null),T(null),ke("walletconnect")},onAppkitCancelPairing:pt,onAppkitMobileDeepLink:()=>a?.(),onAppkitCopyAddress:te=>{navigator.clipboard?.writeText(te.detail).catch(()=>{})}})})}var yr=require("@naculus/connect-core"),mt=require("react"),Gt=require("@naculus/connect-appkit-react");var Xn=require("clsx"),Zn=require("tailwind-merge");function C(...t){return(0,Zn.twMerge)((0,Xn.clsx)(t))}var eo='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 0l-.26.97v28.15l.26.26 13.07-7.72L12 0z" fill="#8C8C8C"/><path d="M12 0L-.87 21.69l12.87 7.72V0z" fill="#3C3C3B"/><path d="M12 31.88l-.16.2v10.55l.16.47 13.08-18.42L12 31.88z" fill="#8C8C8C"/><path d="M12 42.9V31.88L-.87 24.68 12 42.9z" fill="#3C3C3B"/><path d="M12 28.41l13.07-7.72L12 14.09v14.32z" fill="#141414"/><path d="M-.87 20.69L12 28.41V14.09l-12.87 6.6z" fill="#393939"/></svg>',ua='<svg viewBox="0 0 24 22" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M15 12.3l-3.7 2.2-3.8-2.2V7.9L11.3 5.7 15 7.9v2.7l-2.2 1.3-1.5-.9v-2l1.5.9 2.2-1.3V7.9L11.3 4 6 7.9v6.3l5.3 3.1 5.3-3.1-1.6-2.8z" fill="#6C00F6"/></svg>',ma='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#F0B90B"/><path d="M12 4l2.7 1.6L14.7 7 12 5.4 9.3 7l-.7-.4L12 4zm4.7 2.7l-2.7 1.6V10l4 2.3v4.7L16 18.7v-4l-1.3-.7v4L12 20l-2.7-1.6v-4L8 14.7v4l-1.3-.7V12.3l4-2.3V8.3l-2.7-1.6.7-.4L12 8l2.7-1.7.7.4z" fill="white"/></svg>',pa='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12 1.5c.3 0 .6.1.8.2l8.8 5.1c.5.3.9.9.9 1.5v10.2c0 .6-.3 1.2-.9 1.5l-8.8 5.1c-.3.2-.6.2-.8.2s-.6-.1-.8-.2l-8.8-5.1c-.5-.3-.9-.9-.9-1.5V8.3c0-.6.3-1.2.9-1.5l8.8-5.1c.3-.2.6-.2.8-.2z" fill="#213147"/><path d="M14.7 13.8l-1.2 3.2c0 .1 0 .2.1.3l2 5.5 2.3-1.3-2.8-7.6c-.1-.2-.3-.2-.4-.1z" fill="#12AAFF"/><path d="M16.3 8.5c0-.2-.3-.2-.4 0l-1.1 3.2c0 .1 0 .2.1.3l3.3 9 2.3-1.3-4.2-9.1v-.1z" fill="#12AAFF"/><path d="M12 3.5c.1 0 .2 0 .3.1l8.8 5.1c.1.1.2.2.2.3v10.2c0 .1-.1.2-.2.3l-8.8 5.1c-.1 0-.2.1-.3.1s-.2 0-.3-.1l-8.8-5.1c-.1-.1-.2-.2-.2-.3V9c0-.1.1-.2.2-.3l8.8-5.1c.1 0 .2-.1.3-.1z" fill="#9DCCED" fill-opacity="0.3"/><path d="M13.3 6.2h-2.2c-.2 0-.3.1-.4.3L5.9 19.6l2.3 1.3L13 6.5c0-.1-.1-.3-.2-.3h.4z" fill="white"/><path d="M15.2 6.2H13c-.2 0-.3.1-.4.3L8.1 21.4l2.3 1.3 6-16.4c0-.1-.1-.3-.2-.3v.2z" fill="white"/></svg>',fa='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#FF0420"/><path d="M8.5 16c-.5 0-.9-.1-1.3-.3-.4-.2-.7-.5-1-.8-.3-.4-.4-.8-.4-1.3V10c0-.5.1-1 .4-1.4.3-.4.6-.7 1-.9.4-.2.8-.3 1.3-.3.4 0 .8.1 1.2.2.3.2.6.4.8.7l-1 1c-.2-.2-.4-.3-.6-.4-.2-.1-.5-.2-.8-.2-.3 0-.6.1-.9.2-.3.2-.5.4-.6.7-.1.3-.2.6-.2 1v3.5c0 .3.1.6.2.9.1.3.3.5.6.6.3.2.6.2.9.2.3 0 .6-.1.8-.2.2-.1.4-.3.6-.5l1 1c-.2.3-.5.5-.8.7-.4.2-.9.3-1.4.3z" fill="white"/><path d="M15.5 16c-.5 0-.9-.1-1.3-.3-.4-.2-.7-.5-1-.8-.2-.4-.4-.8-.4-1.3V10c0-.5.1-1 .4-1.4.2-.4.5-.7.9-.9.4-.2.8-.3 1.3-.3.5 0 1 .1 1.4.3.4.2.7.5.9.9.2.4.3.9.3 1.4v.7h-2.9v-1.1c0-.3-.1-.6-.2-.9-.1-.3-.3-.5-.5-.6-.2-.1-.5-.2-.8-.2-.3 0-.6.1-.8.2-.3.2-.5.4-.6.7-.1.3-.2.6-.2 1v3.5c0 .3.1.6.2.8.1.3.3.5.6.6.2.2.5.2.8.2.3 0 .6-.1.8-.2.2-.1.4-.3.5-.6.1-.3.2-.6.2-1v-1.1h2.9v.7c0 .5-.1 1-.3 1.4-.2.4-.5.7-.9.9-.4.2-.9.3-1.4.3z" fill="white"/></svg>',ga='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#E84142"/><path d="M8.6 16.8H6.3c-.5 0-.8-.1-1-.3-.2-.2-.3-.5-.3-.8 0-.2 0-.4.1-.6l5.8-10.7c.2-.4.5-.7.8-.8.3-.1.5-.1.7 0 .2.1.5.3.7.8l1.2 2.1.1.2c.3.5.5.9.5 1.3.1.4.1.8 0 1.1-.1.4-.3.8-.6 1.3l-3 5.4c-.2.5-.5.8-.8 1-.4.2-.7.2-1.2.2z" fill="white"/><path d="M14.5 16.8h3.3c.5 0 .7-.1 1-.3.2-.2.3-.5.3-.8 0-.2-.1-.4-.3-.7l-1.7-3-.2-.3c-.2-.4-.4-.7-.6-.8-.2-.1-.4-.1-.6 0-.2.1-.4.3-.6.8l-1.6 3c-.2.4-.4.7-.4.9 0 .2.1.5.3.7.1.1.4.3.9.3z" fill="white"/></svg>',ha='<svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="#1969FF"/><path d="M11.3 3.8c.4-.2 1-.2 1.4 0l4.1 2.2c.2.1.4.3.4.5h0v10.9c0 .2-.1.4-.4.6l-4.1 2.2c-.4.2-1 .2-1.4 0l-4.1-2.2c-.3-.1-.4-.4-.4-.6V6.5c0-.2.1-.4.4-.5l4.1-2.2zm5.3 8.7l-3.9 2c-.4.2-1 .2-1.4 0l-3.9-2v4.8l3.9 2c.2.1.5.2.7.2.2 0 .5-.1.7-.2l3.9-2v-4.8z" fill="white"/></svg>',ba={"eip155:1":eo,"eip155:137":ua,"eip155:56":ma,"eip155:42161":pa,"eip155:10":fa,"eip155:43114":ga,"eip155:250":ha,"eip155:11155111":eo};function Et(t){return ba[t]}var ut=require("react");var oo=require("lucide-react");var Je=require("react/jsx-runtime");function U({className:t,variant:e,size:n,type:o="button",...r}){return(0,Je.jsx)("button",{type:o,className:C("inline-flex items-center justify-center gap-2 rounded-lg border px-4 py-2 text-sm font-medium transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",e==="outline"?"border-input bg-transparent hover:bg-accent":e==="ghost"?"border-transparent bg-transparent hover:bg-accent":"border-primary bg-primary text-primary-foreground hover:bg-primary/90",n==="sm"?"h-9 px-3":n==="icon"?"h-10 w-10 p-0":"h-10",t),...r})}function ve({className:t,...e}){return(0,Je.jsx)("div",{className:C("rounded-xl border border-border bg-card text-card-foreground shadow-sm",t),...e})}function Ye({className:t,variant:e,...n}){return(0,Je.jsx)("span",{className:C("inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium",t),...n})}function to(t){return(0,Je.jsx)("input",{...t})}function no({className:t,...e}){return(0,Je.jsx)("hr",{className:C("h-px bg-border",t),...e})}var he=require("react/jsx-runtime");function xa({children:t}){return(0,he.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary text-primary-foreground",children:t})}function Dt({className:t,showAddress:e=!0,showBalance:n=!1,address:o,balance:r,balanceSymbol:a,onConnect:s}){let l=B().Button??U;if(!o)return(0,he.jsxs)(l,{"aria-label":"Connect Wallet",onClick:s,className:t,children:[(0,he.jsx)(oo.Wallet,{size:18,className:"shrink-0"}),"Connect Wallet"]});let c=o.includes(":")?o.split(":").pop():o,u=c.slice(0,6)+"..."+c.slice(-4),d=r!=null?parseFloat(r).toLocaleString(void 0,{maximumFractionDigits:4})+(a?` ${a}`:""):null;return(0,he.jsxs)(l,{className:t,children:[(0,he.jsx)(xa,{children:"W"}),(0,he.jsxs)("div",{className:"flex flex-col items-start gap-0",children:[e&&(0,he.jsx)("span",{className:"font-mono text-xs",children:u}),n&&d&&(0,he.jsx)("span",{className:"text-xs text-muted-foreground",children:d}),n&&!d&&r===null&&(0,he.jsx)("span",{className:"text-xs text-muted-foreground",children:"Loading..."})]})]})}var be=require("react"),pe=require("lucide-react");var rn=require("react");var ro=require("lucide-react"),ue=require("react/jsx-runtime");function Xe({open:t,onClose:e,children:n,closable:o,className:r,title:a}){return(0,rn.useEffect)(()=>{if(!t)return;let s=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=s}},[t]),(0,rn.useEffect)(()=>{if(!t||!e)return;let s=i=>{i.key==="Escape"&&e()};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[t,e]),t?(0,ue.jsxs)("div",{className:C("naculus-dialog-viewport fixed inset-0 z-50 flex items-center justify-center p-4",r),style:{position:"fixed",inset:0,zIndex:50,display:"flex",alignItems:"center",justifyContent:"center",padding:"1rem"},children:[(0,ue.jsx)("div",{className:"absolute inset-0 bg-black/80","aria-hidden":"true",onClick:e,style:{position:"absolute",inset:0,background:"rgb(0 0 0 / 0.8)"}}),(0,ue.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":a??"Dialog",className:"naculus-dialog-surface relative z-10 flex w-full max-w-lg flex-col overflow-y-auto rounded-xl border bg-card p-6 text-card-foreground shadow-2xl",style:{position:"relative",zIndex:10,width:"100%",maxWidth:"32rem",overflowY:"auto",borderRadius:"0.75rem",padding:"1.5rem",background:"hsl(var(--card, 0 0% 100%))",color:"hsl(var(--card-foreground, 222.2 84% 4.9%))",boxShadow:"0 25px 50px -12px rgb(0 0 0 / 0.4)"},children:[o&&e&&(0,ue.jsx)("button",{onClick:e,type:"button","aria-label":"Close modal",className:"absolute right-4 top-4 z-20 rounded-md p-1 text-muted-foreground hover:text-foreground",style:{position:"absolute",right:"1rem",top:"1rem",zIndex:20,border:0,background:"transparent",cursor:"pointer",color:"inherit"},children:(0,ue.jsx)("svg",{"aria-hidden":"true",className:"h-4 w-4",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,ue.jsx)("path",{d:"M18 6 6 18M6 6l12 12","data-testid":"x-icon"})})}),n]})]}):null}function ao({title:t,onClose:e,showCloseButton:n=!0}){return(0,ue.jsxs)("div",{className:"sticky top-0 z-10 -mx-1 mb-4 flex items-center justify-between bg-card px-1 py-1",children:[(0,ue.jsx)("h2",{className:"text-lg font-semibold m-0",children:t}),n&&e&&(0,ue.jsx)("button",{onClick:e,type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-all duration-200","aria-label":"Close",children:(0,ue.jsx)(ro.X,{size:16})})]})}function so({children:t,className:e=""}){return(0,ue.jsx)("div",{className:C("flex flex-col gap-4",e),children:t})}var M=require("react/jsx-runtime");async function ms(t,e){let n=await Promise.resolve().then(()=>tn(ir(),1)),r=(n.default??n).toCanvas??n.toCanvas;if(typeof r!="function")throw new Error("qrcode.toCanvas is unavailable");return new Promise((a,s)=>{r(t,e,{width:280,margin:2},i=>{i?s(i):a()})})}function rt({uri:t,open:e,onClose:n,onDeepLink:o,onRetry:r,status:a="pending",showDeepLink:s,timeoutMs:i=300*1e3,title:l="Scan with WalletConnect",description:c="Open your wallet app and scan this QR code to connect.",className:u}){let d=(0,be.useRef)(null),[p,h]=(0,be.useState)(null),[x,m]=(0,be.useState)(0),f=Ge(),S=B(),g=S.Button,w=s??f,A=(0,be.useRef)(null);(0,be.useEffect)(()=>{!e||!t||!d.current||(h(null),ms(d.current,t).catch(re=>{h(re instanceof Error?re.message:"Unable to render QR code")}))},[e,t]),(0,be.useEffect)(()=>{if(!e||a!=="pending"){A.current&&(clearInterval(A.current),A.current=null),m(0);return}let re=Date.now();return A.current=setInterval(()=>m(Date.now()-re),1e3),()=>{A.current&&clearInterval(A.current)}},[e,a,i]);let T=x>=i&&a==="pending",J=T||a==="expired"||a==="error",E=Math.max(0,Math.ceil((i-x)/1e3)),we=Math.floor(E/60),oe=E%60,ce=Math.min(x/i,1),pt=(0,be.useCallback)(()=>{t&&o&&o(t)},[t,o]),ke=t&&!T&&a==="pending"?p?(0,M.jsxs)("div",{className:"w-[280px] h-[280px] flex flex-col items-center justify-center bg-muted rounded-lg gap-2",children:[(0,M.jsx)(pe.AlertCircle,{size:24,className:"text-muted-foreground"}),(0,M.jsx)("span",{className:"text-sm text-muted-foreground",children:"Failed to render QR code"})]}):(0,M.jsx)("canvas",{ref:d,width:280,height:280,role:"img","aria-label":"WalletConnect pairing QR code",className:"rounded-lg border border-border"}):(0,M.jsxs)("div",{className:"flex flex-col items-center justify-center gap-3 bg-muted rounded-lg w-[280px] h-[280px]",children:[a==="scanned"?(0,M.jsx)(pe.CheckCircle2,{size:48,className:"text-[hsl(var(--primary))]"}):(0,M.jsx)(pe.AlertCircle,{size:48,className:"text-destructive"}),(0,M.jsx)("span",{className:"text-sm text-muted-foreground","data-testid":"status-label",children:a==="scanned"?"QR code scanned! Connecting...":T||a==="expired"?"Connection timed out.":"Something went wrong. Try again."})]}),ye=S.Modal??Xe;return(0,M.jsx)(ye,{open:e,onClose:n,closable:!0,title:l,className:u,children:(0,M.jsxs)("div",{className:"p-6",children:[(0,M.jsxs)("div",{className:"sticky top-0 z-10 -mx-1 mb-5 bg-card px-1 py-1 text-center",children:[(0,M.jsx)("div",{className:"flex justify-center mb-3",children:a==="pending"&&!T&&(0,M.jsx)(pe.Loader2,{size:20,className:"animate-spin text-primary","data-testid":"loader-icon-inline"})}),(0,M.jsx)("h3",{className:"text-lg font-semibold m-0 text-foreground",children:l}),c&&(0,M.jsx)("p",{className:"text-sm text-muted-foreground mt-1.5 mb-0",children:c})]}),(0,M.jsx)("div",{className:"flex justify-center mb-4",children:ke}),a==="pending"&&!T&&(0,M.jsxs)("div",{className:"mb-3",children:[(0,M.jsx)("div",{className:"h-1 bg-muted rounded-full overflow-hidden",role:"progressbar","aria-valuenow":Math.round((1-ce)*100),"aria-valuemin":0,"aria-valuemax":100,children:(0,M.jsx)("div",{className:"h-full bg-primary rounded-full transition-all duration-1000",style:{width:`${(1-ce)*100}%`}})}),(0,M.jsxs)("p",{"data-testid":"countdown",className:"text-xs text-muted-foreground text-center mt-1.5 mb-0",children:["Expires in ",we,":",oe.toString().padStart(2,"0")]})]}),(0,M.jsxs)("div",{"data-dialog-actions":!0,className:"sticky bottom-0 z-10 -mx-1 flex flex-col gap-2 border-t border-border bg-card px-1 pb-[max(0rem,env(safe-area-inset-bottom))] pt-3",children:[w&&t&&a==="pending"&&!T&&(0,M.jsxs)("button",{type:"button",onClick:pt,className:"inline-flex items-center justify-center gap-2 w-full rounded-lg border border-input bg-card px-4 py-2.5 text-sm font-medium text-foreground hover:bg-accent hover:text-accent-foreground transition-all duration-200 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[(0,M.jsx)(pe.Smartphone,{size:16})," Open in Wallet App"]}),J&&r&&(g?(0,M.jsxs)(g,{onClick:r,variant:"default",size:"default",className:"w-full",children:[(0,M.jsx)(pe.RefreshCw,{size:16})," Generate New QR Code"]}):(0,M.jsxs)("button",{type:"button",onClick:r,className:"inline-flex items-center justify-center gap-2 w-full rounded-lg bg-primary text-primary-foreground px-4 py-2.5 text-sm font-medium hover:bg-primary/90 transition-all duration-200 cursor-pointer border-0 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:[(0,M.jsx)(pe.RefreshCw,{size:16})," Generate New QR Code"]})),g?(0,M.jsx)(g,{onClick:n,variant:"outline",size:"default",className:"w-full",children:"Cancel"}):(0,M.jsx)("button",{type:"button",onClick:n,className:"inline-flex items-center justify-center w-full rounded-lg border border-input bg-transparent px-4 py-2.5 text-sm text-muted-foreground hover:bg-accent hover:text-accent-foreground transition-all duration-200 cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",children:"Cancel"})]})]})})}var Kt=require("react"),se=require("lucide-react");var k=require("react/jsx-runtime");function qt({className:t,isSignedIn:e=!1,isSigningIn:n=!1,result:o=null,error:r=null,onSignIn:a,onClearError:s,children:i}){let[l,c]=(0,Kt.useState)(!1),[u,d]=(0,Kt.useState)(!1),[p,h]=(0,Kt.useState)(!1),x=B(),m=x.Button??U,f=x.Dialog,S=x.DialogContent,g=x.DialogHeader,w=x.DialogTitle,A=async()=>{if(o?.signature)try{await navigator.clipboard.writeText(o.signature),h(!1),d(!0),setTimeout(()=>d(!1),2e3)}catch{d(!1),h(!0)}};return!e&&!n&&!r?(0,k.jsx)(m,{onClick:a,className:t,"aria-label":"Sign In",children:(0,k.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,k.jsx)(se.LogIn,{size:16}),i??"Sign In"]})}):n?(0,k.jsx)(m,{disabled:!0,className:t,"aria-label":"Signing In",children:(0,k.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,k.jsx)(se.Loader2,{size:16,className:"animate-spin"}),"Signing In..."]})}):r&&!e?(0,k.jsxs)("div",{style:{position:"relative",display:"inline-flex",flexDirection:"column"},children:[(0,k.jsx)(m,{onClick:a,className:t,"aria-label":"Retry Sign In",children:(0,k.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,k.jsx)(se.AlertCircle,{size:16,style:{color:"var(--destructive, #ef4444)"}}),i??"Retry Sign In"]})}),(0,k.jsx)("div",{style:{fontSize:"0.75rem",color:"var(--destructive, #ef4444)",padding:"0.25rem 0.5rem",borderRadius:"0.375rem",background:"var(--destructive-foreground, #fef2f2)",marginTop:"2px",wordBreak:"break-word",maxWidth:"100%",lineHeight:1.4},children:r.message})]}):(0,k.jsxs)("div",{style:{position:"relative",display:"inline-block"},children:[(0,k.jsx)(m,{onClick:()=>c(T=>!T),className:t,children:(0,k.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:"0.5rem"},children:[(0,k.jsx)(se.CheckCircle2,{size:16,style:{color:"#22c55e"}}),(0,k.jsx)("span",{style:{fontSize:"0.875rem",fontWeight:500},children:"Signed In"})]})}),l&&(f&&S?(0,k.jsx)(f,{open:!0,onOpenChange:T=>{T||c(!1)},children:(0,k.jsx)(S,{children:g&&w?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(g,{children:(0,k.jsx)(w,{children:"Sign-In Details"})}),(0,k.jsx)(Pn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:p,onCopy:A})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)("div",{style:{fontWeight:600,fontSize:"1.125rem",marginBottom:"0.75rem"},children:"Sign-In Details"}),(0,k.jsx)(Pn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:p,onCopy:A})]})})}):l&&(0,k.jsx)("div",{style:{position:"absolute",top:"calc(100% + 8px)",right:0,zIndex:100,width:"340px",maxWidth:"90vw",background:"var(--card, #fff)",border:"1px solid var(--border, #e2e8f0)",borderRadius:"0.75rem",boxShadow:"0 10px 25px rgba(0,0,0,0.1)",padding:"1rem"},children:(0,k.jsx)(Pn,{result:o,onClose:()=>c(!1),copiedSign:u,copyFailed:p,onCopy:A})}))]})}function Pn({result:t,onClose:e,copiedSign:n,onCopy:o,copyFailed:r}){let s=B().Button??U;if(!t)return(0,k.jsxs)("div",{style:{textAlign:"center",padding:"1rem 0"},children:[(0,k.jsx)(se.CheckCircle2,{size:32,style:{color:"#22c55e",margin:"0 auto 0.75rem"}}),(0,k.jsx)("p",{style:{fontSize:"0.875rem",color:"var(--muted-foreground, #64748b)"},children:"Authenticated successfully"}),(0,k.jsx)(s,{variant:"outline",size:"sm",onClick:e,children:"Close"})]});let{message:i,signature:l}=t,c=l.length>20?l.slice(0,14)+"..."+l.slice(-6):l;return(0,k.jsxs)("div",{style:{display:"flex",flexDirection:"column",gap:"0.75rem"},children:[(0,k.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[(0,k.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:"0.5rem"},children:[(0,k.jsx)(se.CheckCircle2,{size:18,color:"#22c55e"}),(0,k.jsx)("span",{style:{fontWeight:600,fontSize:"0.9375rem"},children:"Signed In"})]}),(0,k.jsx)(s,{variant:"ghost",size:"icon",onClick:e,children:(0,k.jsx)(se.X,{size:16})})]}),(0,k.jsxs)("div",{style:{display:"grid",gap:"0.375rem"},children:[(0,k.jsxs)("div",{children:[(0,k.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Domain"}),(0,k.jsx)("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem"},children:i.domain})]}),(0,k.jsxs)("div",{children:[(0,k.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Address"}),(0,k.jsx)("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem",wordBreak:"break-all"},children:i.address})]}),(0,k.jsxs)("div",{children:[(0,k.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Chain"}),(0,k.jsx)("p",{style:{fontSize:"0.8125rem",fontFamily:"monospace",marginTop:"0.125rem"},children:i.chainId})]})]}),i.statement&&(0,k.jsx)("div",{style:{padding:"0.5rem 0.625rem",borderRadius:"0.375rem",background:"var(--muted, #f1f5f9)",fontSize:"0.8125rem",lineHeight:1.5},children:i.statement}),(0,k.jsxs)("div",{children:[(0,k.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"0.25rem"},children:[(0,k.jsx)("span",{className:"text-xs uppercase tracking-wider text-muted-foreground",children:"Signature"}),(0,k.jsx)(s,{variant:"ghost",size:"icon",onClick:o,title:r?"This browser refused the clipboard \u2014 select the signature and copy it":"Copy signature","aria-label":r?"Copy failed":"Copy signature",children:n?(0,k.jsx)(se.Check,{size:12,color:"#22c55e"}):(0,k.jsx)(se.Copy,{size:12})})]}),(0,k.jsx)("p",{style:{fontSize:"0.75rem",fontFamily:"monospace",wordBreak:"break-all",lineHeight:1.4,color:"var(--muted-foreground, #64748b)",background:"var(--muted, #f1f5f9)",padding:"0.375rem 0.5rem",borderRadius:"0.375rem"},children:c})]}),(0,k.jsx)(s,{variant:"outline",className:"w-full",onClick:e,children:"Close"})]})}var X=require("react"),F=require("lucide-react");var b=require("react/jsx-runtime");function ps(t){let e=Math.floor(4294967296/t)*t,n=new Uint32Array(1),o;do crypto.getRandomValues(n),o=n[0];while(o>=e);return o%t}function An(t){let e=[...t];for(let n=e.length-1;n>0;n--){let o=ps(n+1);[e[n],e[o]]=[e[o],e[n]]}return e}function lr(t,e=3){let n=t.trim().split(/\s+/);return An(n.map((r,a)=>a)).slice(0,Math.min(e,n.length)).map(r=>{let a=n[r],s=n.filter((c,u)=>u!==r),i=An(s).slice(0,3),l=An([a,...i]);return{index:r,correct:a,options:l}})}function at({seedPhrase:t,onConfirm:e,onSkip:n,onExportPrivateKey:o,className:r,wordCount:a,inline:s=!1,open:i=!0,onOpenChange:l}){let c=B(),u=c.Button??U,d=c.Dialog,p=c.DialogContent,h=c.DialogHeader,x=c.DialogTitle,[m,f]=(0,X.useState)("reveal"),[S,g]=(0,X.useState)(!1),[w,A]=(0,X.useState)(!1),[T,J]=(0,X.useState)(!1),[E,we]=(0,X.useState)(()=>lr(t,3)),[oe,ce]=(0,X.useState)({}),[pt,ke]=(0,X.useState)([]),[te,ye]=(0,X.useState)(!1),[re,Qe]=(0,X.useState)(null),qn=(0,X.useMemo)(()=>t.trim().split(/\s+/),[t]),jr=(0,X.useMemo)(()=>{let _=new Map;return qn.map(ae=>{let de=_.get(ae)??0;return _.set(ae,de+1),{word:ae,key:`${ae}-${de}`}})},[qn]),Qr=(0,X.useCallback)(()=>g(!0),[]),$r=(0,X.useCallback)(async()=>{try{await navigator.clipboard.writeText(t),J(!1),A(!0),setTimeout(()=>A(!1),2e3)}catch{A(!1),J(!0)}},[t]),Gr=(0,X.useCallback)(()=>{we(lr(t,3)),ce({}),ke([]),f("confirm")},[t]),Yr=(0,X.useCallback)((_,ae)=>{ce(de=>({...de,[_]:ae})),ke(de=>de.filter(en=>en!==_))},[]),Jr=(0,X.useCallback)(()=>{let _=[];for(let ae of E)oe[ae.index]!==ae.correct&&_.push(ae.index);if(_.length>0){ke(_);return}f("done"),e()},[E,oe,e]),jn=(0,X.useCallback)(()=>{n?.()},[n]),Xr=(0,X.useCallback)(()=>{if(o){let _=o();Qe(_),ye(!0)}},[o]),Zr=E.every(_=>oe[_.index]!==void 0),ea=(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)("div",{className:"rounded-lg border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950/30 px-4 py-3",children:(0,b.jsxs)("div",{className:"flex items-start gap-2",children:[(0,b.jsx)(F.AlertTriangle,{size:16,className:"mt-0.5 shrink-0 text-amber-600 dark:text-amber-400"}),(0,b.jsx)("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:"Write down these words in order and store them somewhere safe. Never share them with anyone. If you lose your seed phrase, your funds cannot be recovered."})]})}),S?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4",children:jr.map(({word:_,key:ae},de)=>(0,b.jsxs)("div",{className:"flex items-center gap-1.5 rounded-md border bg-card px-2.5 py-1.5 text-sm",children:[(0,b.jsx)("span",{className:"text-xs text-muted-foreground w-5 shrink-0 text-right",children:de+1}),(0,b.jsx)("span",{className:"font-mono font-medium",children:_})]},ae))}),(0,b.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,b.jsxs)(u,{onClick:$r,variant:"outline",size:"sm",children:[w?(0,b.jsx)(F.Check,{size:14}):(0,b.jsx)(F.Copy,{size:14}),w?"Copied":T?"Copy failed":"Copy"]}),o&&(0,b.jsxs)(u,{onClick:Xr,variant:"outline",size:"sm",children:[(0,b.jsx)(F.Download,{size:14}),"Export Private Key"]})]}),T&&(0,b.jsx)("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:"This browser would not let the page write to your clipboard. Nothing was copied \u2014 select the words above and copy them yourself, or write them down."}),te&&re&&(0,b.jsxs)("div",{className:"rounded-lg border border-border bg-muted p-3 space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(F.EyeOff,{size:14,className:"text-muted-foreground"}),(0,b.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:"Private Key (keep secret!)"})]}),(0,b.jsx)("p",{className:"font-mono text-xs break-all select-all",children:re})]}),(0,b.jsxs)("div",{"data-dialog-actions":!0,className:"sticky bottom-0 z-10 -mx-1 flex min-h-14 flex-col gap-2 border-t border-border bg-card px-1 pb-[max(0rem,env(safe-area-inset-bottom))] pt-3 sm:flex-row sm:justify-between",children:[(0,b.jsxs)(u,{onClick:Gr,variant:"default",children:["I've Saved It",(0,b.jsx)(F.ArrowRight,{size:16})]}),n&&(0,b.jsxs)(u,{onClick:jn,variant:"ghost",size:"sm",children:[(0,b.jsx)(F.SkipForward,{size:14}),"Skip Backup"]})]})]}):(0,b.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6",children:[(0,b.jsx)(F.Shield,{size:40,className:"text-muted-foreground"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground text-center",children:"Click the button below to reveal your seed phrase. Make sure no one is watching your screen."}),(0,b.jsxs)(u,{onClick:Qr,variant:"default",children:[(0,b.jsx)(F.Eye,{size:16}),"Reveal Seed Phrase"]})]})]}),ta=(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"Verify your backup by selecting the correct word for each position."}),E.map(_=>{let ae=pt.includes(_.index);return(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsxs)("p",{className:C("text-sm font-medium",ae?"text-destructive":"text-foreground"),children:["Word #",_.index+1,ae&&(0,b.jsx)("span",{className:"ml-2 text-xs text-destructive",children:"(incorrect)"})]}),(0,b.jsx)("div",{className:"grid grid-cols-2 gap-2",children:_.options.map(de=>{let en=oe[_.index]===de;return(0,b.jsx)("button",{type:"button",onClick:()=>Yr(_.index,de),className:C("rounded-md border px-3 py-2 text-sm font-mono transition-all duration-200 cursor-pointer text-left focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",en?"border-primary bg-primary/10 text-primary font-medium":ae?"border-destructive/50 bg-destructive/5":"border-border bg-card hover:border-primary/50"),children:de},`${_.index}-${de}`)})})]},_.index)}),(0,b.jsxs)("div",{"data-dialog-actions":!0,className:"sticky bottom-0 z-10 -mx-1 flex min-h-14 flex-col gap-2 border-t border-border bg-card px-1 pb-[max(0rem,env(safe-area-inset-bottom))] pt-3 sm:flex-row sm:justify-between",children:[(0,b.jsxs)(u,{onClick:Jr,variant:"default",disabled:!Zr,children:[(0,b.jsx)(F.Check,{size:16}),"Verify & Confirm"]}),(0,b.jsxs)("div",{className:"flex gap-2",children:[(0,b.jsxs)(u,{onClick:()=>f("reveal"),variant:"ghost",size:"sm",children:[(0,b.jsx)(F.ArrowLeft,{size:14}),"Back"]}),n&&(0,b.jsxs)(u,{onClick:jn,variant:"ghost",size:"sm",children:[(0,b.jsx)(F.SkipForward,{size:14}),"Skip"]})]})]})]}),na={reveal:ea,confirm:ta,done:(0,b.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6 text-center",children:[(0,b.jsx)("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/30",children:(0,b.jsx)(F.Check,{size:24,className:"text-green-600 dark:text-green-400"})}),(0,b.jsx)("p",{className:"font-medium text-foreground",children:"Backup Confirmed"}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:"Your seed phrase has been backed up successfully."})]})},oa={reveal:"Backup Seed Phrase",confirm:"Verify Backup",done:"Backup Complete"},St=na[m],ft=oa[m];return s?(0,b.jsxs)("div",{className:C("space-y-4",r),children:[m!=="done"&&(0,b.jsx)("h3",{className:"text-lg font-semibold",children:ft}),St]}):i?d&&p?(0,b.jsx)(d,{open:!0,onOpenChange:_=>{_||l?.(!1)},children:(0,b.jsx)(p,{className:"naculus-dialog-surface flex w-full max-w-lg flex-col overflow-y-auto",children:h&&x?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(h,{children:(0,b.jsx)(x,{children:ft})}),(0,b.jsx)("div",{className:"mt-2 max-h-[55vh] overflow-y-auto",children:St})]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("div",{className:"mb-3 text-lg font-semibold",children:ft}),(0,b.jsx)("div",{className:"max-h-[55vh] overflow-y-auto",children:St})]})})}):(0,b.jsxs)(Xe,{open:!0,onClose:()=>l?.(!1),title:ft,children:[(0,b.jsxs)("div",{className:"sticky top-0 z-10 -mx-1 mb-4 flex items-center justify-between bg-card px-1 py-1",children:[(0,b.jsx)("h2",{className:"text-lg font-semibold m-0",children:ft}),l&&(0,b.jsx)("button",{onClick:()=>l(!1),type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-all duration-200 cursor-pointer border-none bg-transparent","aria-label":"Close",children:(0,b.jsx)(F.X,{size:16})})]}),St]}):null}var cr=tn(require("react"),1);var I=require("react/jsx-runtime");function fs({error:t,reset:e,dismiss:n,retryLabel:o="Try Again"}){let r=B(),a=r.Button??U,s=r.Dialog,i=r.DialogContent,l=r.DialogHeader,c=r.DialogTitle;if(s&&i)return(0,I.jsx)(s,{open:!0,onOpenChange:()=>{},children:(0,I.jsx)(i,{className:"naculus-dialog-surface flex w-full max-w-lg flex-col overflow-y-auto",children:l&&c?(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(l,{children:(0,I.jsx)(c,{children:"Something went wrong"})}),(0,I.jsxs)("div",{style:{marginTop:"0.5rem"},children:[(0,I.jsx)("p",{style:{color:"var(--muted-foreground, #666)",fontSize:"0.875rem",lineHeight:"1.5",margin:0},children:t.message||"An unexpected error occurred while connecting your wallet."}),(0,I.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&(0,I.jsx)(a,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),(0,I.jsx)(a,{variant:"default",size:"default",onClick:e,children:o})]})]})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)("div",{style:{fontWeight:600,fontSize:"1.125rem",marginBottom:"0.75rem"},children:"Something went wrong"}),(0,I.jsx)("p",{style:{color:"var(--muted-foreground, #666)",fontSize:"0.875rem",lineHeight:"1.5",margin:0},children:t.message||"An unexpected error occurred while connecting your wallet."}),(0,I.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&(0,I.jsx)(a,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),(0,I.jsx)(a,{variant:"default",size:"default",onClick:e,children:o})]})]})})});let u=!0,d=n??void 0;return(0,I.jsxs)(Xe,{open:u,onClose:d,title:"Something went wrong",children:[(0,I.jsx)(ao,{title:"Something went wrong",onClose:d,showCloseButton:!!n}),(0,I.jsxs)(so,{children:[(0,I.jsx)("p",{style:{color:"var(--muted-foreground, #666)",fontSize:"0.875rem",lineHeight:"1.5",margin:0},children:t.message||"An unexpected error occurred while connecting your wallet."}),(0,I.jsxs)("div",{style:{display:"flex",gap:"0.5rem",marginTop:"0.5rem"},children:[n&&(0,I.jsx)(a,{variant:"outline",size:"default",onClick:n,children:"Dismiss"}),(0,I.jsx)(a,{variant:"default",size:"default",onClick:e,children:o})]})]})]})}var st=class extends cr.default.Component{constructor(e){super(e),this.state={hasError:!1,error:null,dismissed:!1}}static getDerivedStateFromError(e){return{hasError:!0,error:e,dismissed:!1}}componentDidCatch(e,n){this.props.onError?.(e,n)}handleReset=()=>{this.setState({hasError:!1,error:null,dismissed:!1}),this.props.onReset?.()};handleDismiss=()=>{this.setState(e=>({...e,dismissed:!0})),this.props.onDismiss?.()};render(){return this.state.dismissed?this.props.children:this.state.hasError&&this.state.error?this.props.fallback?this.props.fallback({error:this.state.error,reset:this.handleReset}):(0,I.jsx)(fs,{error:this.state.error,reset:this.handleReset,dismiss:this.props.onDismiss?this.handleDismiss:void 0,retryLabel:this.props.retryLabel}):this.props.children}};var ct=require("react"),mr=require("@naculus/connect-appkit-react");var Z=require("react");var it={primary:{name:"--primary",fallback:"221.2 83.2% 53.3%"},"primary-foreground":{name:"--primary-foreground",fallback:"210 40% 98%"},background:{name:"--background",fallback:"0 0% 100%"},foreground:{name:"--foreground",fallback:"222.2 84% 4.9%"},card:{name:"--card",fallback:"0 0% 100%"},"card-foreground":{name:"--card-foreground",fallback:"222.2 84% 4.9%"},popover:{name:"--popover",fallback:"0 0% 100%"},"popover-foreground":{name:"--popover-foreground",fallback:"222.2 84% 4.9%"},secondary:{name:"--secondary",fallback:"210 40% 96.1%"},"secondary-foreground":{name:"--secondary-foreground",fallback:"222.2 47.4% 11.2%"},muted:{name:"--muted",fallback:"210 40% 96.1%"},"muted-foreground":{name:"--muted-foreground",fallback:"215.4 16.3% 46.9%"},accent:{name:"--accent",fallback:"210 40% 96.1%"},"accent-foreground":{name:"--accent-foreground",fallback:"222.2 47.4% 11.2%"},destructive:{name:"--destructive",fallback:"0 84.2% 60.2%"},border:{name:"--border",fallback:"214.3 31.8% 91.4%"},input:{name:"--input",fallback:"214.3 31.8% 91.4%"},ring:{name:"--ring",fallback:"221.2 83.2% 53.3%"},radius:{name:"--radius",fallback:"0.5rem"}},gs=new Map;function En(){gs.clear()}var Qt=require("react/jsx-runtime"),dr=(0,Z.createContext)({theme:{},isDark:!1,setTheme:()=>{},toggleDarkMode:()=>{}}),hs=/[;{}<>\r\n\\]/;function bs(t){let e=[];for(let[n,o]of Object.entries(t)){let r=it[n];r&&o&&!hs.test(String(o))&&e.push(" "+r.name+": "+o+";")}return e.length===0?"":`:root {
|
|
9
9
|
`+e.join(`
|
|
10
10
|
`)+`
|
|
11
|
-
}`}function ys(t){let e=new Set;if(t!=="computed"||typeof document>"u")return e;for(let n of Object.keys(st)){let o=st[n],r=getComputedStyle(document.documentElement).getPropertyValue(o.name).trim();r&&r!==o.fallback&&e.add(n)}return e}function qt({children:t,theme:e={},defaultDark:n=!1,priority:o="fallback"}){let[r,a]=(0,Z.useState)(e),[i,s]=(0,Z.useState)(n);(0,Z.useEffect)(()=>{En()},[r]);let[l,c]=(0,Z.useState)(new Set);(0,Z.useEffect)(()=>{c(ys(o))},[o]);let u=(0,Z.useMemo)(()=>{if(o==="fallback"||l.size===0)return r;let m={};for(let[C,B]of Object.entries(r))!l.has(C)&&B&&(m[C]=B);return m},[r,o,l]),d=(0,Z.useMemo)(()=>bs(u),[u]);(0,Z.useEffect)(()=>{if(typeof document>"u")return;let m=document.documentElement;i?m.classList.add("dark"):m.classList.remove("dark"),En()},[i]);let f=(0,Z.useMemo)(()=>"w3c-theme-"+Math.random().toString(36).slice(2,9),[]),b=(0,Z.useCallback)(()=>s(m=>!m),[]),g=(0,Z.useMemo)(()=>({theme:r,isDark:i,setTheme:a,toggleDarkMode:b}),[r,i,b]);return(0,jt.jsxs)(dr.Provider,{value:g,children:[d?(0,jt.jsx)("style",{id:f,children:d}):null,t]})}function Dn(){return(0,Z.useContext)(dr)}function ur(t){let{theme:e}=Dn(),[n,o]=(0,Z.useState)("");return(0,Z.useEffect)(()=>{let r=st[t];if(!r)return;let a=e[t];if(a){o(a);return}if(typeof document>"u"){o(r.fallback);return}let i=getComputedStyle(document.documentElement).getPropertyValue(r.name).trim();o(i||r.fallback)},[t,e]),n||st[t]?.fallback||""}var it=require("react/jsx-runtime"),pr=(0,lt.createContext)({mode:"walletconnect"});function fr(){return(0,lt.useContext)(pr)}function ct({config:t,children:e,autoConnect:n=!1,detectionMode:o="walletconnect",theme:r,defaultDark:a=!1,themePriority:i="computed"}){let s=(0,lt.useMemo)(()=>({mode:o}),[o]),l=o==="walletconnect"||o==="auto";return(0,it.jsx)(pr.Provider,{value:s,children:(0,it.jsx)(qt,{theme:r,defaultDark:a,priority:i,children:(0,it.jsx)(Qt,{components:{QRCodeModal:ot},children:(0,it.jsx)(mr.Web3ConnectProvider,{config:t,autoConnect:n,children:l?(0,it.jsx)(Tt,{children:e}):e})})})})}var br=require("react/jsx-runtime"),Mn={Button:U,ConnectButton:Be,AccountButton:Et,ChainSelector:Oe,QRCodeModal:ot,SignInButton:Kt,SeedPhraseBackup:rt,ErrorBoundary:at,Web3ConnectUI:ct},gr=(0,dt.createContext)({});function Qt({children:t,components:e={}}){let n=(0,dt.useMemo)(()=>({...Mn,...e}),[e]);return(0,br.jsx)(gr.Provider,{value:n,children:t})}function T(){return(0,dt.useContext)(gr)}function hr(t){return T()[t]}var K=require("react/jsx-runtime");function yr(t){let e=t&&typeof t=="object"&&"details"in t?t.details:void 0,n=e instanceof Error?`${e.name}: ${e.message}`:e;xr.logger.error("ui/ChainSelector","switchChain failed",t,n)}function wt({chainId:t,className:e}){let n=At(t);return n?(0,K.jsx)("span",{className:v("inline-flex items-center justify-center shrink-0",e),dangerouslySetInnerHTML:{__html:n}}):null}function Oe({className:t,showLabel:e=!0,variant:n="dropdown"}){let{currentChain:o,availableChains:r,switchChain:a}=(0,$t.useChain)(),{isConnected:i}=(0,$t.useWallet)(),[s,l]=(0,ut.useState)(!1),u=T().Button??U,d=(0,ut.useRef)(null);if((0,ut.useEffect)(()=>{function g(m){d.current&&!d.current.contains(m.target)&&l(!1)}return document.addEventListener("mousedown",g),()=>document.removeEventListener("mousedown",g)},[]),!i)return null;let f=o?.name??"Unknown Chain",b=r.length>1;return n==="minimal"?(0,K.jsxs)("div",{className:v("inline-flex items-center gap-1.5 text-xs text-muted-foreground",t),children:[o&&(0,K.jsx)(wt,{chainId:o.caip2,className:"h-3.5 w-3.5"}),f]}):n==="buttons"?(0,K.jsx)("div",{className:v("flex flex-wrap gap-2",t),children:r.map(g=>{let m=g.caip2,C=m===o?.caip2;return(0,K.jsxs)(u,{className:C?v("bg-accent","border-primary"):"",onClick:()=>{C||a(m).catch(yr)},children:[(0,K.jsx)(wt,{chainId:m,className:"h-4 w-4"}),g.name,g.token&&(0,K.jsx)("span",{className:"text-xs opacity-60",children:g.token})]},m)})}):b?(0,K.jsxs)("div",{ref:d,className:v("relative inline-block",t),children:[(0,K.jsxs)(u,{onClick:()=>l(!s),children:[o&&(0,K.jsx)(wt,{chainId:o.caip2,className:"h-4 w-4"}),f,(0,K.jsx)("svg",{"aria-hidden":"true",className:v("h-3 w-3 transition-transform",s&&"rotate-180"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,K.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),s&&(0,K.jsxs)("div",{className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] rounded-lg border bg-card p-1 shadow-lg animate-in fade-in zoom-in-95 duration-200",children:[e&&(0,K.jsx)("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Switch Network"}),r.map(g=>{let m=g.caip2,C=m===o?.caip2;return(0,K.jsxs)(u,{onClick:()=>{C||a(m).catch(yr),l(!1)},className:v("flex w-full items-center gap-2 rounded-md px-2 py-2 text-sm transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",C?"bg-accent font-medium":"hover:bg-accent/50"),children:[(0,K.jsx)(wt,{chainId:m,className:"h-4 w-4"}),(0,K.jsx)("span",{className:"flex-1 text-left",children:g.name}),g.token&&(0,K.jsx)("span",{className:"text-xs text-muted-foreground",children:g.token}),C&&(0,K.jsx)("svg",{"aria-hidden":"true",className:"h-4 w-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,K.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},m)})]})]}):(0,K.jsxs)("div",{className:v("inline-flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm opacity-60 cursor-default",t),children:[o&&(0,K.jsx)(wt,{chainId:o.caip2,className:"h-4 w-4"}),f]})}var vr=require("@naculus/connect-appkit-react"),Se=require("lucide-react"),Me=require("react");var Y=require("react/jsx-runtime"),vs={eip155:{name:"Ethereum & EVM",detail:"One address across Ethereum, Polygon, Arbitrum and every EVM chain"},solana:{name:"Solana",detail:"A separate key on a different curve"}};function Cs(t){return t.length<=12?t:`${t.slice(0,6)}...${t.slice(-4)}`}function Ns({account:t,isActive:e,onSelect:n}){let[o,r]=(0,Me.useState)(!1),a=vs[t.namespace]??{name:t.namespace,detail:""},i=(0,Me.useCallback)(s=>{s.stopPropagation();let l=navigator?.clipboard?.writeText;l&&l.call(navigator.clipboard,t.address).then(()=>{r(!0),setTimeout(()=>r(!1),1500)},()=>{})},[t.address]);return(0,Y.jsxs)("div",{role:"radio",tabIndex:0,"aria-checked":e,onClick:n,onKeyDown:s=>{s.target===s.currentTarget&&(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),n())},className:v("flex w-full items-center gap-3 rounded-md border px-3 py-2.5 text-left text-sm transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e?"border-primary bg-accent":"border-border hover:bg-accent/50"),children:[(0,Y.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,Y.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[a.name,e&&(0,Y.jsx)("span",{className:"rounded-sm bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-primary",children:"Signing"})]}),(0,Y.jsx)("span",{className:"truncate font-mono text-xs text-muted-foreground",children:Cs(t.address)})]}),(0,Y.jsx)("button",{type:"button","aria-label":`Copy ${a.name} address`,onClick:i,className:"naculus-hit-target shrink-0 rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:o?(0,Y.jsx)(Se.Check,{size:14}):(0,Y.jsx)(Se.Copy,{size:14})}),e&&(0,Y.jsx)(Se.Check,{size:16,className:"shrink-0 text-primary"})]})}function zn({className:t,hideBackfill:e=!1,onSelect:n,accounts:o,activeNamespace:r,canDerive:a,setActiveNamespace:i,backfillAccounts:s}){let[l,c]=(0,Me.useState)(!1),[u,d]=(0,Me.useState)(null),f=(0,Me.useCallback)(m=>{if(m!==r)try{i(m),d(null),n?.(m)}catch(C){d(C instanceof Error?C.message:"Could not switch account")}},[r,i,n]),b=(0,Me.useCallback)(async()=>{c(!0),d(null);try{await s()}catch(m){d(m instanceof Error?m.message:"Could not derive accounts")}finally{c(!1)}},[s]);if(o.length===0)return null;let g=!e&&a;return(0,Y.jsxs)("div",{className:v("flex flex-col gap-2",t),children:[(0,Y.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,Y.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Accounts"}),(0,Y.jsx)("span",{className:"text-[11px] text-muted-foreground",children:"Chooses the signing key, not the network"})]}),(0,Y.jsx)("div",{role:"radiogroup","aria-label":"Wallet accounts",className:"flex flex-col gap-1.5",children:o.map(m=>(0,Y.jsx)(Ns,{account:m,isActive:m.namespace===r,onSelect:()=>f(m.namespace)},m.namespace))}),g&&(0,Y.jsxs)("button",{type:"button",onClick:b,disabled:l,className:v("flex items-center justify-center gap-2 rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground","hover:bg-accent/50 disabled:opacity-60"),children:[l?(0,Y.jsx)(Se.Loader2,{size:14,className:"animate-spin"}):(0,Y.jsx)(Se.Plus,{size:14}),l?"Deriving\u2026":"Show accounts this phrase already owns"]}),u&&(0,Y.jsx)("p",{role:"alert",className:"text-xs text-destructive",children:u})]})}function Cr(t){let{wallet:e,accounts:n,activeNamespace:o,setActiveNamespace:r,backfillAccounts:a}=(0,vr.useEmbeddedWallet)();return e?(0,Y.jsx)(zn,{...t,accounts:n,activeNamespace:o,canDerive:e.recoveryAvailable&&n.length<2,setActiveNamespace:r,backfillAccounts:a}):null}var Te=require("lucide-react"),wr=require("@naculus/connect-appkit-react");var O=require("react/jsx-runtime"),ws={critical:Te.ShieldAlert,warning:Te.AlertTriangle,info:Te.Info},ks={critical:"text-destructive",warning:"text-amber-600 dark:text-amber-500",info:"text-muted-foreground"};function Nr(t){return t>=90?"text-emerald-600 dark:text-emerald-500":t>=70?"text-amber-600 dark:text-amber-500":"text-destructive"}function Rs({finding:t}){let e=ws[t.severity]??Te.Info;return(0,O.jsxs)("li",{className:"flex gap-2.5 rounded-md border border-border px-3 py-2.5",children:[(0,O.jsx)(e,{size:16,className:v("mt-0.5 shrink-0",ks[t.severity])}),(0,O.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,O.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,O.jsx)("span",{className:"text-sm font-medium",children:t.title}),t.deduction>0&&(0,O.jsxs)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:["\u2212",t.deduction]})]}),(0,O.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:t.detail}),t.remedy&&(0,O.jsxs)("p",{className:"text-xs leading-relaxed",children:[(0,O.jsx)("span",{className:"font-medium",children:"What helps: "}),(0,O.jsx)("span",{className:"text-muted-foreground",children:t.remedy})]})]})]})}function In({className:t,hideInformational:e=!1,report:n}){if(!n)return null;let{score:o,level:r,findings:a,encrypted:i,backend:s,unlock:l}=n,c=e?a.filter(d=>d.deduction>0):a,u=a.every(d=>d.deduction===0);return(0,O.jsxs)("div",{className:v("flex flex-col gap-3",t),children:[(0,O.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border px-4 py-3",children:[(0,O.jsx)(Te.ShieldCheck,{size:22,className:v("shrink-0",Nr(o))}),(0,O.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,O.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,O.jsx)("span",{className:v("text-2xl font-semibold tabular-nums",Nr(o)),children:o}),(0,O.jsx)("span",{className:"text-sm text-muted-foreground",children:"/ 100"}),(0,O.jsxs)("span",{className:"ml-auto text-xs text-muted-foreground",children:["Tier ",r]})]}),(0,O.jsxs)("span",{className:"text-xs text-muted-foreground",children:[s==="localStorage"?"localStorage":"IndexedDB",i?" \xB7 encrypted":" \xB7 not encrypted",l.sealedWith?.includes("prf")?" \xB7 passkey":""]})]})]}),u?(0,O.jsx)("p",{className:"text-xs text-muted-foreground",children:"Nothing is holding this score down."}):(0,O.jsx)("p",{className:"text-xs text-muted-foreground",children:"Scored against this SDK's own published rubric, not an external standard. Each item below names the points it costs."}),(0,O.jsx)("ul",{className:"flex flex-col gap-1.5",children:c.map(d=>(0,O.jsx)(Rs,{finding:d},d.id))})]})}function kr(t){let{securityReport:e}=(0,wr.useEmbeddedWallet)();return(0,O.jsx)(In,{...t,report:e})}var Ce=require("react"),ze=require("lucide-react"),Rr=require("@naculus/connect-appkit-react");var I=require("react/jsx-runtime"),Ln=8,Ss=12;function Wn({className:t,request:e,submit:n,cancel:o}){let[r,a]=(0,Ce.useState)(""),[i,s]=(0,Ce.useState)(""),[l,c]=(0,Ce.useState)(!1),u=(0,Ce.useRef)(null),d=e?.intent==="create";(0,Ce.useEffect)(()=>{if(!e){a(""),s(""),c(!1);return}a(""),s(""),u.current?.focus()},[e]);let f=d&&r.length>0&&r.length<Ln,b=d&&i.length>0&&i!==r,g=d?r.length>=Ln&&i===r:r.length>0,m=(0,Ce.useCallback)(C=>{C.preventDefault(),g&&n(r)},[g,n,r]);return e?(0,I.jsx)("div",{className:"naculus-dialog-viewport fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",role:"presentation",children:(0,I.jsxs)("form",{role:"dialog","aria-modal":"true","aria-label":d?"Choose a passphrase":"Unlock your wallet",onSubmit:m,className:v("naculus-dialog-surface flex w-full max-w-lg flex-col gap-4 overflow-y-auto rounded-lg border border-border bg-card p-5 shadow-lg",t),children:[(0,I.jsxs)("div",{className:"sticky top-0 z-10 -mx-1 flex items-center gap-2 bg-card px-1 py-1",children:[(0,I.jsx)(ze.KeyRound,{size:18,className:"shrink-0 text-primary"}),(0,I.jsx)("h2",{className:"text-base font-semibold",children:d?"Choose a passphrase":"Unlock your wallet"})]}),e.previousError&&(0,I.jsx)("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:e.previousError}),(0,I.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:d?"This encrypts your wallet on this device. Without it, anything that can run script on this page can read your keys.":"Your wallet is encrypted on this device. Enter the passphrase you chose to open it."}),(0,I.jsxs)("label",{className:"flex flex-col gap-1.5",children:[(0,I.jsx)("span",{className:"text-xs font-medium",children:"Passphrase"}),(0,I.jsxs)("span",{className:"relative flex items-center",children:[(0,I.jsx)("input",{ref:u,type:l?"text":"password",value:r,onChange:C=>a(C.target.value),autoComplete:d?"new-password":"current-password",autoFocus:!0,className:"w-full rounded-md border border-border bg-background px-3 py-2 pr-9 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"}),(0,I.jsx)("button",{type:"button","aria-label":l?"Hide passphrase":"Show passphrase",onClick:()=>c(C=>!C),className:"naculus-hit-target absolute right-2 text-muted-foreground hover:text-foreground",children:l?(0,I.jsx)(ze.EyeOff,{size:15}):(0,I.jsx)(ze.Eye,{size:15})})]})]}),d&&(0,I.jsxs)("label",{className:"flex flex-col gap-1.5",children:[(0,I.jsx)("span",{className:"text-xs font-medium",children:"Type it again"}),(0,I.jsx)("input",{type:l?"text":"password",value:i,onChange:C=>s(C.target.value),autoComplete:"new-password",className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),f&&(0,I.jsxs)("p",{role:"alert",className:"text-xs text-destructive",children:["At least ",Ln," characters."]}),b&&(0,I.jsx)("p",{role:"alert",className:"text-xs text-destructive",children:"These do not match."}),d&&!f&&r.length>0&&r.length<Ss&&(0,I.jsx)("p",{className:"text-xs text-muted-foreground",children:"Short. Several ordinary words are far harder to guess than a short one with symbols in it."}),d&&(0,I.jsxs)("p",{className:"flex gap-2 rounded-md bg-amber-500/10 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:text-amber-500",children:[(0,I.jsx)(ze.ShieldAlert,{size:14,className:"mt-0.5 shrink-0"}),(0,I.jsx)("span",{children:"If you forget this, nothing can open this copy of the wallet \u2014 not us, not your browser. Your recovery phrase is the only thing that gets it back."})]}),(0,I.jsxs)("div",{"data-dialog-actions":!0,className:"sticky bottom-0 z-10 -mx-5 flex min-h-14 justify-end gap-2 border-t border-border bg-card px-5 pb-[max(0rem,env(safe-area-inset-bottom))] pt-3",children:[(0,I.jsx)("button",{type:"button",onClick:()=>o(),className:"rounded-md border border-border px-3 py-2 text-sm hover:bg-accent",children:"Cancel"}),(0,I.jsx)("button",{type:"submit",disabled:!g,className:"rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:d?"Encrypt wallet":"Unlock"})]})]})}):null}function Sr(t){let{request:e,submit:n,cancel:o}=(0,Rr.usePassphraseGate)();return(0,I.jsx)(Wn,{...t,request:e,submit:n,cancel:o})}var _e=require("react"),fe=require("lucide-react"),Gt=require("@naculus/connect-appkit-react");var q=require("react/jsx-runtime");function Vn({className:t,passkeys:e,unlock:n,onRegistered:o}){let[r,a]=(0,_e.useState)(!1),[i,s]=(0,_e.useState)(null),[l,c]=(0,_e.useState)(!1),u=!!e?.hasCredential?.()||l,d=(0,_e.useCallback)(async()=>{if(e){a(!0),s(null);try{await e.createPasskey(),c(!0),await o?.()}catch(m){s(m instanceof Error?m.message:"Could not register a passkey")}finally{a(!1)}}},[e,o]);if(!e)return null;let f=n?.sealedWith?.includes("prf")??!1,b=null;if(u)switch(n?.prf){case"available":b=f?{tone:"good",icon:(0,q.jsx)(fe.ShieldCheck,{size:16}),title:"Your passkey unlocks this wallet",detail:"Opening it needs your fingerprint or face, not a value a script on this page can supply."}:{tone:"warn",icon:(0,q.jsx)(fe.TriangleAlert,{size:16}),title:"Registered, but not applied yet",detail:"This device can produce the key material. The next time the wallet is saved, the record is sealed under it."};break;case"unavailable":b={tone:"bad",icon:(0,q.jsx)(fe.ShieldAlert,{size:16}),title:"This passkey cannot unlock the wallet",detail:"The authenticator did not return the key material. Firefox does not implement the extension, and a passkey created before it was requested cannot have it added afterwards \u2014 a new one has to be registered on a browser that supports it."};break;default:b={tone:"neutral",icon:(0,q.jsx)(fe.Fingerprint,{size:16}),title:"A passkey is registered",detail:"Whether it can unlock this wallet is not known until the wallet is opened once. It will be used if it works."};break}let g={good:"text-emerald-600 dark:text-emerald-500",warn:"text-amber-600 dark:text-amber-500",bad:"text-destructive",neutral:"text-muted-foreground"};return(0,q.jsxs)("div",{className:v("flex flex-col gap-3",t),children:[b?(0,q.jsxs)("div",{className:"flex gap-2.5 rounded-md border border-border px-3 py-2.5",children:[(0,q.jsx)("span",{className:v("mt-0.5 shrink-0",g[b.tone]),children:b.icon}),(0,q.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[(0,q.jsx)("span",{className:"text-sm font-medium",children:b.title}),(0,q.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:b.detail})]})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"A passkey raises what it takes to read your stored keys from \u201Cany script on this page\u201D to your fingerprint or face. The passphrase keeps working, so a broken or replaced authenticator does not cost you this copy."}),(0,q.jsxs)("p",{className:"flex gap-2 rounded-md bg-amber-500/10 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:text-amber-500",children:[(0,q.jsx)(fe.ShieldAlert,{size:14,className:"mt-0.5 shrink-0"}),(0,q.jsx)("span",{children:"This protects the copy on this device. It does not back up your wallet \u2014 the recovery phrase is still the only thing that survives losing this device."})]}),(0,q.jsxs)("button",{type:"button",onClick:d,disabled:r,className:"flex items-center justify-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-60",children:[r?(0,q.jsx)(fe.Loader2,{size:15,className:"animate-spin"}):(0,q.jsx)(fe.Fingerprint,{size:15}),r?"Waiting for your device\u2026":"Protect with a passkey"]})]}),i&&(0,q.jsx)("p",{role:"alert",className:"text-xs text-destructive",children:i})]})}function Tr(t){let{client:e}=(0,Gt.useWeb3)(),{securityReport:n,hasWallet:o}=(0,Gt.useEmbeddedWallet)(),r=(0,_e.useCallback)(async()=>{let a=e?.embeddedConnector;a&&o&&await a.save()},[e,o]);return(0,q.jsx)(Vn,{...t,passkeys:e?.passkeysConnector??null,unlock:n?.unlock,onRegistered:r})}var ie=require("@naculus/connect-appkit-react"),ne=require("react");var ye=require("react/jsx-runtime"),Br=(0,ne.createContext)(null);function Un(){let t=(0,ne.useContext)(Br);if(!t)throw new Error("useAppKit must be used within an <AppKit> component");return t}function Hn({projectId:t,metadata:e,enableEmbedded:n=!1,enablePasskeys:o=!1,chains:r,embeddedConfig:a,encryptionKey:i,siwx:s,children:l,className:c,autoConnect:u=!1,theme:d,defaultDark:f=!1,themePriority:b="computed",detectionMode:g="auto"}){let[m,C]=(0,ne.useState)(!1),[B,p]=(0,ne.useState)(!1),k=(0,ne.useMemo)(()=>({projectId:t,metadata:e,enableEmbedded:n,enablePasskeys:o,chains:r,embeddedConfig:a,encryptionKey:i,siwx:s}),[t,e,n,o,r,a,i,s]);return(0,ye.jsx)(ct,{config:k,autoConnect:u,detectionMode:g,theme:d,defaultDark:f,themePriority:b,children:(0,ye.jsx)(Ts,{className:c,open:m,setOpen:C,backupOpen:B,setBackupOpen:p,children:l})})}function Ts({children:t,className:e,open:n,setOpen:o,backupOpen:r,setBackupOpen:a}){let{isConnected:i,isConnecting:s}=(0,ie.useWallet)(),{primaryAccount:l}=(0,ie.useAccount)(),{currentChain:c,availableChains:u,switchChain:d}=(0,ie.useChain)(),f=(0,ie.useEmbeddedWallet)(),{disconnect:b}=(0,ie.useDisconnect)(),{wallets:g,hasWallets:m}=Qe(),{formatted:C}=(0,ie.useBalance)(),B=C??null,p=(0,ne.useCallback)(async()=>{await b()},[b]),k=(0,ne.useCallback)(()=>{f.confirmBackup(),a(!1)},[f,a]),A=(0,ne.useCallback)(()=>{f.confirmBackup(),a(!1)},[f,a]),S=(0,ne.useCallback)(()=>f.getPrivateKey(),[f]),$=(0,ne.useMemo)(()=>({connect:()=>o(!0),disconnect:p,isConnected:i,isConnecting:s,address:l,balance:B,balanceSymbol:c?.token??null,chainName:c?.name??null,availableChains:u.map(V=>({caip2:V.caip2,name:V.name,token:V.token})),switchChain:d,wallets:g,hasWallets:m,backupPending:f.backupPending,seedPhrase:f.seedPhrase,confirmBackup:k,skipBackup:A,open:n,setOpen:o}),[i,s,l,B,c,u,d,g,m,f.backupPending,f.seedPhrase,k,A,p,n,o]);return(0,ne.useEffect)(()=>{f.seedPhrase&&f.backupPending&&a(!0)},[f.seedPhrase,f.backupPending,a]),(0,ye.jsxs)(Br.Provider,{value:$,children:[t,f.seedPhrase&&r&&(0,ye.jsx)(rt,{seedPhrase:f.seedPhrase,onConfirm:k,onSkip:A,onExportPrivateKey:S,open:r,onOpenChange:a})]})}function On({className:t}){let e=Un(),{connectInjected:n}=(0,ie.useWeb3)(),{primaryAccount:o}=(0,ie.useAccount)(),{disconnect:r}=(0,ie.useDisconnect)(),a=(0,ne.useCallback)(async(i,s,l)=>{i==="injected"&&(await n(l),s())},[n]);return e.isConnected&&o?(0,ye.jsxs)("div",{className:v("inline-flex items-center gap-2",t),children:[(0,ye.jsx)(Oe,{variant:"minimal"}),(0,ye.jsx)(Be,{isConnected:e.isConnected,address:o,balance:e.balance,balanceSymbol:e.balanceSymbol??void 0,onDisconnect:r,onConnect:a,className:t})]}):(0,ye.jsx)(Be,{isConnected:e.isConnected,isConnecting:e.isConnecting,address:o,balance:e.balance,balanceSymbol:e.balanceSymbol??void 0,onDisconnect:r,onConnect:a,className:t})}function _n({className:t,variant:e="dropdown"}){return(0,ye.jsx)(Oe,{className:t,variant:e})}try{let t=Mn;t&&Object.assign(t,{AppKit:Hn,AppKitButton:On,AppKitChainSelector:_n})}catch{}var le=require("lucide-react");var y=require("react/jsx-runtime");function Bs(t){if(t<1e3)return"<1s";if(t<6e4)return`~${Math.round(t/1e3)}s`;let e=Math.floor(t/6e4),n=Math.round(t%6e4/1e3);return n>0?`~${e}m ${n}s`:`~${e}m`}function Pr(t){return t.symbol||"UNKNOWN"}function Ps(t){let e=t.toLowerCase();return e.includes("lifi")?"default":e.includes("axelar")?"secondary":"outline"}function As(t){return t.length>12?`${t.slice(0,6)}...${t.slice(-6)}`:t}function Es({route:t,onSelect:e}){let n=T(),o=n.Button??U,r=n.Badge,a=t.provider??"Route";return(0,y.jsxs)("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border p-4 transition-colors hover:bg-accent/30",children:[(0,y.jsxs)("div",{className:"flex flex-col gap-1.5 min-w-0",children:[(0,y.jsxs)("div",{className:"flex items-center gap-2",children:[r?(0,y.jsx)(r,{variant:Ps(a),children:a}):(0,y.jsx)("span",{className:"inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium",children:a}),t.steps.length>1&&(0,y.jsxs)("span",{className:"text-xs text-muted-foreground",children:[t.steps.length," steps"]})]}),(0,y.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-sm",children:[(0,y.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[(0,y.jsx)(le.DollarSign,{className:"h-3.5 w-3.5"}),"$",t.gasCosts.totalUsd]}),(0,y.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[(0,y.jsx)(le.Clock,{className:"h-3.5 w-3.5"}),Bs(t.steps.reduce((i,s)=>{let l=t.estimatedTime>0?15e3:0;return i+l},0))]}),(0,y.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[t.gasCosts.totalUsd," cost"]})]})]}),(0,y.jsx)(o,{variant:"outline",size:"sm",onClick:e,children:"Select"})]})}function Ds(){let e=T().Skeleton;return(0,y.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"route-selector-loading",children:[(0,y.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,y.jsx)(le.Loader2,{className:"h-4 w-4 animate-spin"}),(0,y.jsx)("span",{children:"Fetching best routes..."})]}),[1,2,3].map(n=>(0,y.jsxs)("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border p-4",children:[(0,y.jsx)("div",{className:"flex flex-col gap-2 flex-1",children:e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(e,{className:"h-4 w-24"}),(0,y.jsx)(e,{className:"h-3 w-48"})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"h-4 w-24 animate-pulse rounded bg-muted"}),(0,y.jsx)("div",{className:"h-3 w-48 animate-pulse rounded bg-muted"})]})}),e?(0,y.jsx)(e,{className:"h-8 w-20 rounded-md"}):(0,y.jsx)("div",{className:"h-8 w-20 animate-pulse rounded-md bg-muted"})]},n))]})}function Ms(){return(0,y.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground","data-testid":"route-selector-empty",children:[(0,y.jsx)(le.AlertCircle,{className:"h-8 w-8 opacity-40"}),(0,y.jsx)("span",{children:"No routes found for this pair"}),(0,y.jsx)("span",{className:"text-xs",children:"Try a different token or amount"})]})}function zs({error:t,onRetry:e}){let o=T().Button??U;return(0,y.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-6","data-testid":"route-selector-error",children:[(0,y.jsx)(le.XCircle,{className:"h-8 w-8 text-destructive"}),(0,y.jsx)("p",{className:"text-sm text-destructive font-medium",children:"Failed to fetch routes"}),(0,y.jsx)("p",{className:"text-xs text-muted-foreground max-w-xs text-center",children:t}),e&&(0,y.jsx)(o,{variant:"outline",size:"sm",onClick:e,children:"Retry"})]})}function Is(){let e=T().Progress;return(0,y.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6","data-testid":"route-selector-executing",children:[(0,y.jsx)(le.Loader2,{className:"h-6 w-6 animate-spin text-primary"}),(0,y.jsx)("p",{className:"text-sm font-medium",children:"Executing route..."}),(0,y.jsx)("p",{className:"text-xs text-muted-foreground",children:"Please confirm the transaction in your wallet"}),e?(0,y.jsx)(e,{value:50,className:"w-48 h-1.5"}):(0,y.jsx)("div",{className:"h-1.5 w-48 rounded-full bg-muted",children:(0,y.jsx)("div",{className:"h-full w-1/2 rounded-full bg-primary animate-pulse"})})]})}function Ls({txHash:t}){return(0,y.jsxs)("div",{className:"flex flex-col items-center gap-2 py-6","data-testid":"route-selector-success",children:[(0,y.jsx)(le.CheckCircle2,{className:"h-8 w-8 text-green-500"}),(0,y.jsx)("p",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:"Route executed successfully!"}),(0,y.jsxs)("p",{className:"text-xs text-muted-foreground font-mono",children:["TX: ",As(t)]})]})}function Ar({chainId:t,className:e}){let n=At(`eip155:${t}`);return n?(0,y.jsx)("span",{className:v("inline-flex items-center justify-center shrink-0",e),dangerouslySetInnerHTML:{__html:n}}):null}function Er({inputToken:t,outputToken:e,amount:n,routes:o=[],loading:r=!1,executing:a=!1,onRouteSelected:i,onCancel:s,successTxHash:l,error:c,className:u}){let d=T(),f=d.Card,b=d.Button??U;if(l)return(0,y.jsx)("div",{className:v("rounded-lg border border-border",u),children:(0,y.jsx)(Ls,{txHash:l})});if(a)return(0,y.jsx)("div",{className:v("rounded-lg border border-border",u),children:(0,y.jsx)(Is,{})});return f?(0,y.jsxs)(f,{className:v("p-4",u),children:[m(),C(),B()]}):(0,y.jsxs)("div",{className:v("rounded-lg border border-border p-4",u),children:[m(),C(),B()]});function m(){return!t&&!e?null:(0,y.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-2 text-sm",children:[t&&(0,y.jsxs)("span",{className:"inline-flex items-center gap-1.5 font-medium",children:[(0,y.jsx)(Ar,{chainId:t.chainId,className:"h-4 w-4"}),n?`${n.toString()} `:"",Pr(t)]}),t&&e&&(0,y.jsx)(le.ArrowRight,{className:"h-3.5 w-3.5 text-muted-foreground"}),e&&(0,y.jsxs)("span",{className:"inline-flex items-center gap-1.5 font-medium",children:[(0,y.jsx)(Ar,{chainId:e.chainId,className:"h-4 w-4"}),Pr(e)]})]})}function C(){return r?(0,y.jsx)(Ds,{}):c?(0,y.jsx)(zs,{error:c}):o.length===0?(0,y.jsx)(Ms,{}):(0,y.jsx)("div",{className:"flex flex-col gap-2","data-testid":"route-selector-routes",children:o.map((p,k)=>(0,y.jsx)(Es,{route:p,onSelect:()=>i?.(p)},`${p.fromChain}-${p.toChain}-${p.gasCosts.totalUsd}-${k}`))})}function B(){return!r&&o.length===0&&!c?null:(0,y.jsx)("div",{className:"mt-4 flex justify-end",children:(0,y.jsx)(b,{variant:"ghost",size:"sm",onClick:s,children:"Cancel"})})}}var Dr=tn(require("react"),1),j=require("lucide-react");var N=require("react/jsx-runtime");function Ws(t){let e=Number(t)/1e18;return e<.001?`~${e.toFixed(6)} ETH`:`~${e.toFixed(3)} ETH`}function Mr({isDeployed:t=!1,isDeploying:e=!1,estimatedGas:n,error:o=null,onUpgrade:r,onShowSettings:a,onRetry:i}){let s=T(),l=s.Button??U,c=s.Card??ve,u=s.Badge??Ge,d=a?(0,N.jsxs)(l,{variant:"outline",className:"w-full",onClick:a,children:[(0,N.jsx)(j.Settings,{size:15})," Advanced Settings ",(0,N.jsx)(j.ChevronRight,{size:14,className:"text-muted-foreground"})]}):null;return t?(0,N.jsxs)(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[(0,N.jsx)("div",{className:"flex items-start justify-between",children:(0,N.jsxs)("div",{className:"flex items-center gap-3",children:[(0,N.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-green-500/10",children:(0,N.jsx)(j.ShieldCheck,{size:22,className:"text-green-500"})}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)("span",{className:"text-base font-semibold text-foreground",children:"Smart Wallet"}),(0,N.jsxs)(u,{variant:"secondary",className:"rounded-full bg-green-500/10 px-2 py-0 text-xs font-medium text-green-500",children:[(0,N.jsx)(j.CheckCircle2,{size:12,className:"mr-0.5 inline"})," Deployed"]})]}),(0,N.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Your wallet has been upgraded to a smart wallet"})]})]})}),(0,N.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[[j.Fuel,"Gas Sponsorship","Enabled"],[j.RefreshCw,"Recovery","Enabled"]].map(([f,b,g])=>(0,N.jsxs)("div",{className:"rounded-lg bg-muted/50 p-3",children:[(0,N.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[Dr.default.createElement(f,{size:14}),(0,N.jsx)("span",{children:b})]}),(0,N.jsx)("div",{className:"mt-1 text-sm font-medium text-foreground",children:g})]},b))}),a&&(0,N.jsx)("div",{className:"mt-4",children:d})]}):e?(0,N.jsx)(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:(0,N.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,N.jsx)("div",{className:"mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-primary/10",children:(0,N.jsx)(j.LoaderCircle,{size:28,className:"animate-spin text-primary"})}),(0,N.jsx)("h3",{className:"mb-1 text-base font-semibold text-foreground",children:"Deploying Smart Wallet..."}),(0,N.jsx)("p",{className:"mb-4 text-sm text-muted-foreground",children:"Please wait, contract deployment may take a few seconds"}),(0,N.jsx)("div",{className:"h-2 w-full max-w-[200px] overflow-hidden rounded-full bg-muted",children:(0,N.jsx)("div",{className:"h-full w-full animate-pulse rounded-full bg-primary",style:{animationDuration:"1.5s"}})})]})}):o?(0,N.jsxs)(c,{className:"w-full rounded-xl border border-destructive/30 bg-destructive/5 p-5 shadow-sm",children:[(0,N.jsxs)("div",{className:"flex items-start gap-3",children:[(0,N.jsx)("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-destructive/10",children:(0,N.jsx)(j.AlertCircle,{size:18,className:"text-destructive"})}),(0,N.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,N.jsx)("h4",{className:"text-sm font-semibold text-destructive",children:"Deployment Failed"}),(0,N.jsx)("p",{className:"mt-1 text-xs text-destructive/80 break-words",children:o}),i&&(0,N.jsxs)(l,{variant:"outline",size:"sm",className:"mt-3 border-destructive/30 text-destructive hover:bg-destructive/10",onClick:i,children:[(0,N.jsx)(j.RotateCcw,{size:13})," Retry"]})]})]}),a&&(0,N.jsx)("div",{className:"mt-3",children:d})]}):(0,N.jsxs)(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[(0,N.jsxs)("div",{className:"flex items-center gap-3",children:[(0,N.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-500/10",children:(0,N.jsx)(j.Shield,{size:20,className:"text-amber-500"})}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)("span",{className:"text-base font-semibold text-foreground",children:"Smart Wallet"}),(0,N.jsx)("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground",children:"Not Upgraded"})]}),(0,N.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Upgrade to a smart wallet for more features"})]})]}),(0,N.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,N.jsx)(Fn,{icon:j.Zap,color:"text-green-500",text:"No ETH needed for transactions \u2014 pay gas with USDC/USDT"}),(0,N.jsx)(Fn,{icon:j.Fuel,color:"text-blue-500",text:"Optional dApp sponsorship, zero-cost transactions"}),(0,N.jsx)(Fn,{icon:j.ShieldCheck,color:"text-purple-500",text:"Secure recovery mechanism, no fear of losing keys"})]}),r&&(0,N.jsxs)(l,{className:"mt-4 w-full",onClick:r,children:["Upgrade Now",n!==void 0&&(0,N.jsxs)("span",{className:"ml-1 text-xs opacity-80",children:["(Estimated gas fee: ",Ws(n),")"]})]}),a&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)("div",{className:"mt-4 mb-3 flex items-center gap-2",children:[(0,N.jsx)("div",{className:"h-px flex-1 bg-border"}),(0,N.jsx)("span",{className:"text-xs text-muted-foreground",children:"or"}),(0,N.jsx)("div",{className:"h-px flex-1 bg-border"})]}),d]})]})}function Fn({icon:t,color:e,text:n}){return(0,N.jsxs)("div",{className:"flex items-center gap-2.5 text-sm text-foreground/80",children:[(0,N.jsx)(t,{size:14,className:`shrink-0 ${e}`}),(0,N.jsx)("span",{children:n})]})}var Fe=require("react"),J=require("lucide-react");var x=require("react/jsx-runtime"),Vs=[{value:"simple",label:"Single Sign (default)",description:"Single key control, simple and secure",icon:(0,x.jsx)(J.Shield,{size:16})},{value:"multi-sig",label:"Multi-Sign (2-of-3)",description:"Requires multiple signers to authorize transactions",icon:(0,x.jsx)(J.Users,{size:16})},{value:"social-recovery",label:"Social Recovery",description:"Set guardian accounts to help recover",icon:(0,x.jsx)(J.KeyRound,{size:16})}],Us=[{value:"self",label:"Pay Self (ETH)",description:"Pay gas fees with ETH"},{value:"sponsor",label:"Sponsored by dApp",description:"dApp covers your gas fees"},{value:"erc20",label:"Pay with USDC/USDT",description:"Use ERC-20 tokens for gas"},{value:"custom",label:"Custom Paymaster URL",description:"Use a custom paymaster service"}],Hs=[{value:"pimlico",label:"Pimlico",description:"High-performance bundler service"},{value:"stackup",label:"Stackup",description:"Decentralized bundler network"},{value:"alchemy",label:"Alchemy",description:"Alchemy AA infrastructure"},{value:"custom",label:"Custom Bundler URL",description:"Use custom bundler endpoint"}];function Os(){return{accountType:"simple",paymasterType:"self",customPaymasterUrl:"",bundlerPreset:"pimlico",customBundlerUrl:"",guardians:[],threshold:2}}function zr({currentConfig:t,onSave:e,onBack:n}){let o=T(),r=o.Button??U,a=o.Input??to,i=o.Card??ve,s=o.Separator??no,[l,c]=(0,Fe.useState)({...Os(),...t}),[u,d]=(0,Fe.useState)(""),[f,b]=(0,Fe.useState)(!1),g=p=>v("flex cursor-pointer items-center gap-3 rounded-lg border px-4 py-3 transition-all duration-200",p?"border-primary bg-primary/5":"border-border hover:bg-accent"),m="w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:border-ring focus:ring-2 focus:ring-ring focus:ring-offset-2 transition-all duration-200",C=(0,Fe.useCallback)(()=>{e?.(l),b(!0),setTimeout(()=>b(!1),2e3)},[l,e]),B=(0,Fe.useCallback)(()=>{let p=u.trim();!p||l.guardians.includes(p)||(c(k=>({...k,guardians:[...k.guardians,p]})),d(""))},[u,l.guardians]);return(0,x.jsxs)(i,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[(0,x.jsx)("div",{className:"flex items-center justify-between mb-5",children:(0,x.jsxs)("div",{className:"flex items-center gap-2",children:[n&&(0,x.jsxs)(r,{variant:"ghost",size:"sm",onClick:n,children:[(0,x.jsx)(J.ArrowLeft,{size:15}),"Back"]}),(0,x.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:"Smart Wallet Settings"})]})}),(0,x.jsxs)("section",{className:"mb-6",children:[(0,x.jsxs)("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,x.jsx)(J.Shield,{size:15})," Verification Method"]}),(0,x.jsx)("div",{className:"space-y-2",children:Vs.map(p=>(0,x.jsxs)("label",{className:g(l.accountType===p.value),children:[(0,x.jsx)("input",{type:"radio",name:"accountType",value:p.value,checked:l.accountType===p.value,onChange:()=>c(k=>({...k,accountType:p.value})),className:"h-4 w-4 text-primary accent-primary"}),(0,x.jsx)("div",{className:"flex items-center gap-2 text-foreground",children:p.icon}),(0,x.jsxs)("div",{children:[(0,x.jsx)("div",{className:"text-sm font-medium text-foreground",children:p.label}),(0,x.jsx)("div",{className:"text-xs text-muted-foreground",children:p.description})]})]},p.value))})]}),l.accountType==="social-recovery"&&(0,x.jsxs)("section",{className:"mb-6 rounded-lg border border-border bg-muted/30 p-4",children:[(0,x.jsxs)("h4",{className:"mb-2 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,x.jsx)(J.KeyRound,{size:14})," Guardian Addresses"]}),(0,x.jsx)("p",{className:"mb-3 text-xs text-muted-foreground",children:"Set at least one guardian to help recover your wallet if you lose your key"}),l.guardians.length>0&&(0,x.jsx)("div",{className:"mb-3 space-y-1.5",children:l.guardians.map(p=>(0,x.jsxs)("div",{className:"flex items-center justify-between rounded-md bg-card px-3 py-2 text-sm",children:[(0,x.jsxs)("span",{className:"font-mono text-xs text-foreground",children:[p.slice(0,8),"...",p.slice(-6)]}),(0,x.jsx)(r,{variant:"ghost",size:"icon",onClick:()=>c(k=>({...k,guardians:k.guardians.filter(A=>A!==p)})),children:(0,x.jsx)(J.X,{size:14})})]},p))}),(0,x.jsxs)("div",{className:"flex gap-2",children:[(0,x.jsx)(a,{type:"text",placeholder:"Enter guardian address (0x...)",value:u,onChange:p=>d(p.target.value),onKeyDown:p=>{p.key==="Enter"&&(p.preventDefault(),B())},className:"flex-1"}),(0,x.jsxs)(r,{size:"sm",onClick:B,disabled:!u.trim(),children:[(0,x.jsx)(J.Plus,{size:14})," Add"]})]})]}),l.accountType==="multi-sig"&&(0,x.jsxs)("section",{className:"mb-6 rounded-lg border border-border bg-muted/30 p-4",children:[(0,x.jsxs)("h4",{className:"mb-2 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,x.jsx)(J.Users,{size:14})," Signing Threshold"]}),(0,x.jsx)("p",{className:"mb-3 text-xs text-muted-foreground",children:"Set how many signers are needed to authorize a transaction"}),(0,x.jsx)("div",{className:"flex items-center gap-3",children:[1,2,3].map(p=>(0,x.jsxs)("label",{className:g(l.threshold===p),children:[(0,x.jsx)("input",{type:"radio",name:"threshold",value:p,checked:l.threshold===p,onChange:()=>c(k=>({...k,threshold:p})),className:"sr-only"}),p,"-of-3"]},p))})]}),(0,x.jsx)(s,{className:"my-4"}),(0,x.jsxs)("section",{className:"mb-6",children:[(0,x.jsxs)("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,x.jsx)(J.Fuel,{size:15})," Gas Fees"]}),(0,x.jsx)("div",{className:"space-y-2",children:Us.map(p=>(0,x.jsxs)("label",{className:g(l.paymasterType===p.value),children:[(0,x.jsx)("input",{type:"radio",name:"paymasterType",value:p.value,checked:l.paymasterType===p.value,onChange:()=>c(k=>({...k,paymasterType:p.value})),className:"h-4 w-4 text-primary accent-primary"}),(0,x.jsxs)("div",{className:"flex-1",children:[(0,x.jsx)("div",{className:"text-sm font-medium text-foreground",children:p.label}),(0,x.jsx)("div",{className:"text-xs text-muted-foreground",children:p.description})]})]},p.value))}),l.paymasterType==="custom"&&(0,x.jsx)("div",{className:"mt-3",children:(0,x.jsx)("input",{type:"text",placeholder:"Custom Paymaster URL",value:l.customPaymasterUrl,onChange:p=>c(k=>({...k,customPaymasterUrl:p.target.value})),className:m})})]}),(0,x.jsx)(s,{className:"my-4"}),(0,x.jsxs)("section",{className:"mb-6",children:[(0,x.jsxs)("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,x.jsx)(J.Wrench,{size:15})," Bundler"]}),(0,x.jsx)("div",{className:"space-y-2",children:Hs.map(p=>(0,x.jsxs)("label",{className:g(l.bundlerPreset===p.value),children:[(0,x.jsx)("input",{type:"radio",name:"bundlerPreset",value:p.value,checked:l.bundlerPreset===p.value,onChange:()=>c(k=>({...k,bundlerPreset:p.value})),className:"h-4 w-4 text-primary accent-primary"}),(0,x.jsxs)("div",{className:"flex-1",children:[(0,x.jsx)("div",{className:"text-sm font-medium text-foreground",children:p.label}),(0,x.jsx)("div",{className:"text-xs text-muted-foreground",children:p.description})]})]},p.value))}),l.bundlerPreset==="custom"&&(0,x.jsx)("div",{className:"mt-3",children:(0,x.jsx)("input",{type:"text",placeholder:"Custom Bundler URL",value:l.customBundlerUrl,onChange:p=>c(k=>({...k,customBundlerUrl:p.target.value})),className:m})})]}),(0,x.jsxs)("div",{className:"flex items-center gap-3",children:[(0,x.jsxs)(r,{className:"flex-1",onClick:C,children:[(0,x.jsx)(J.Save,{size:15}),f?"Saved \u2713":"Save Settings"]}),n&&(0,x.jsxs)(r,{variant:"outline",onClick:n,children:[(0,x.jsx)(J.ArrowLeft,{size:15}),"\u2190 Back to Simple Mode"]})]})]})}var Ie=require("lucide-react");var Ir=require("@naculus/connect-appkit-react"),W=require("react/jsx-runtime"),_s={ok:{icon:(0,W.jsx)(Ie.CheckCircle,{size:20}),label:"No problem found",colorClass:"text-muted-foreground",bgClass:"bg-muted",buttonVariant:"default"},warning:{icon:(0,W.jsx)(Ie.AlertTriangle,{size:20}),label:"Warning",colorClass:"text-[hsl(var(--warning,38_92%_50%))]",bgClass:"bg-[hsl(var(--warning)/0.1)]",buttonVariant:"default"},blocked:{icon:(0,W.jsx)(Ie.ShieldAlert,{size:20}),label:"Blocked",colorClass:"text-destructive",bgClass:"bg-destructive/10",buttonVariant:"destructive"}};function Lr({address:t,open:e,onClose:n,onProceed:o}){let r=T(),a=r.Button,i=r.Dialog,s=r.DialogContent,l=r.DialogHeader,c=r.DialogTitle,{validation:u}=(0,Ir.useValidateDestination)({address:t}),{level:d,warning:f}=u,b=_s[d],g=d==="blocked",m=t.length>12?`${t.slice(0,6)}...${t.slice(-4)}`:t,C=p=>v("inline-flex items-center justify-center whitespace-nowrap rounded-lg","text-sm font-medium transition-all duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50","h-10 px-4 py-2",p==="outline"&&"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",p==="destructive"&&"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm",p==="default"&&"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm"),B=(0,W.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,W.jsxs)("div",{className:v("flex items-center gap-3 rounded-lg p-4",b.bgClass),children:[(0,W.jsx)("span",{className:b.colorClass,children:b.icon}),(0,W.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,W.jsx)("span",{className:v("text-sm font-semibold",b.colorClass),children:b.label}),(0,W.jsx)("span",{className:"text-xs text-muted-foreground break-all font-mono",children:m})]})]}),f&&(0,W.jsx)("p",{className:"text-sm text-muted-foreground m-0",children:f}),(0,W.jsxs)("div",{"data-dialog-actions":!0,className:"sticky bottom-0 z-10 -mx-1 flex min-h-14 justify-end gap-2 border-t border-border bg-card px-1 pb-[max(0rem,env(safe-area-inset-bottom))] pt-3",children:[a?(0,W.jsx)(a,{onClick:n,variant:"outline",className:"w-full sm:w-auto",children:"Cancel"}):(0,W.jsx)("button",{type:"button",onClick:n,className:v(C("outline"),"w-full sm:w-auto"),children:"Cancel"}),o&&(a?(0,W.jsx)(a,{onClick:o,variant:g?"destructive":"default",disabled:g,className:"w-full sm:w-auto",children:"Proceed anyway"}):(0,W.jsx)("button",{type:"button",onClick:o,disabled:g,className:v(C(g?"destructive":"default"),"w-full sm:w-auto"),children:"Proceed anyway"}))]})]});return i&&s&&l&&c?(0,W.jsx)(i,{open:e,onOpenChange:p=>{p||n()},children:(0,W.jsxs)(s,{className:"naculus-dialog-surface flex w-full max-w-lg flex-col overflow-y-auto",children:[(0,W.jsx)(l,{children:(0,W.jsx)(c,{children:"Address Warning"})}),B]})}):e?(0,W.jsxs)("div",{className:"naculus-dialog-viewport fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,W.jsx)("div",{className:"absolute inset-0 bg-black/80","aria-hidden":"true",onClick:n}),(0,W.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Address warning",className:"naculus-dialog-surface relative z-10 flex w-full max-w-lg flex-col overflow-y-auto rounded-xl border bg-card p-6 text-card-foreground shadow-2xl",children:[(0,W.jsxs)("div",{className:"sticky top-0 z-10 -mx-1 mb-4 flex items-center justify-between bg-card px-1 py-1",children:[(0,W.jsx)("h2",{className:"text-lg font-semibold m-0",children:"Address Warning"}),(0,W.jsx)("button",{onClick:n,type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close",children:(0,W.jsx)(Ie.X,{size:16})})]}),B]})]}):null}var kt=require("lucide-react");var Q=require("react/jsx-runtime");function Wr({wallets:t,onSelect:e,loading:n=!1,error:o=null}){let a=T().Card,i=s=>a?(0,Q.jsx)(a,{className:"p-4",children:s}):(0,Q.jsx)("div",{className:"rounded-xl border bg-card text-card-foreground shadow-sm p-4",children:s});return n?i((0,Q.jsxs)("div",{className:"flex flex-col gap-3",children:[Array.from({length:3}).map((s,l)=>(0,Q.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg animate-pulse",children:[(0,Q.jsx)("div",{className:"h-10 w-10 rounded-full bg-muted"}),(0,Q.jsx)("div",{className:"h-4 w-32 rounded bg-muted"})]},l)),(0,Q.jsx)("p",{className:"text-xs text-muted-foreground text-center m-0",children:"Detecting wallets..."})]})):o?i((0,Q.jsxs)("div",{className:"flex flex-col items-center gap-3 py-4",children:[(0,Q.jsx)(kt.AlertCircle,{size:24,className:"text-destructive"}),(0,Q.jsx)("p",{className:"text-sm text-destructive m-0 font-medium",children:o})]})):t.length===0?i((0,Q.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6",children:[(0,Q.jsx)(kt.Wallet,{size:32,className:"text-muted-foreground"}),(0,Q.jsxs)("p",{className:"text-sm text-muted-foreground m-0 text-center",children:["No wallets detected.",(0,Q.jsx)("br",{}),"Install a browser wallet extension to get started."]})]})):(0,Q.jsx)("div",{className:"flex flex-col gap-2",children:t.map(s=>(0,Q.jsxs)("button",{type:"button",onClick:()=>e(s),className:v("flex items-center gap-3 w-full p-3 rounded-lg","border border-input bg-card hover:bg-accent hover:text-accent-foreground","transition-all duration-200 cursor-pointer","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[s.icon?(0,Q.jsx)("img",{src:s.icon,alt:s.name,className:"h-10 w-10 rounded-full object-cover shrink-0",onError:l=>{l.target.style.display="none"}}):(0,Q.jsx)("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center shrink-0",children:(0,Q.jsx)(kt.Wallet,{size:18,className:"text-muted-foreground"})}),(0,Q.jsxs)("div",{className:"flex flex-col items-start gap-0.5 text-left min-w-0",children:[(0,Q.jsx)("span",{className:"text-sm font-medium truncate w-full",children:s.name}),(0,Q.jsx)("span",{className:"text-xs text-muted-foreground truncate w-full",children:s.rdns})]})]},s.id))})}var Or=require("@naculus/connect-appkit-core"),mt=require("lucide-react");var Vr=require("@naculus/connect-appkit-core"),Yt=require("lucide-react"),Ur=require("react");var Ke=require("react/jsx-runtime");function Fs(t){return t.length<=18?t:`${t.slice(0,8)}\u2026${t.slice(-8)}`}function qe({value:t}){let n=T().Button??U,[o,r]=(0,Ur.useState)(!1),a=async()=>{await navigator.clipboard?.writeText(t),r(!0)};return(0,Ke.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,Ke.jsx)("span",{className:"min-w-0 break-all font-mono text-xs",title:t,children:Fs(t)}),(0,Ke.jsx)(n,{variant:"ghost",size:"icon",className:"naculus-hit-target h-8 w-8 shrink-0 p-0","aria-label":o?`Copied ${t}`:`Copy ${t}`,onClick:()=>{a()},children:o?(0,Ke.jsx)(Yt.Check,{"aria-hidden":!0,size:14}):(0,Ke.jsx)(Yt.Copy,{"aria-hidden":!0,size:14})})]})}function Hr(t,e,n){if(t===null)return"Amount not reported";let o=e?n[e]:void 0;return/^\d+$/.test(String(t))?(0,Vr.formatAuthorizationAmount)(BigInt(t),o).formatted:`${t.toString()} base units`}function Jt(t,e=!1){return v("border",t?"border-emerald-700 bg-emerald-50 text-emerald-900 dark:border-emerald-500 dark:bg-emerald-950 dark:text-emerald-100":e?"border-destructive/60 bg-destructive/10 text-foreground":"border-border bg-muted text-foreground")}var R=require("react/jsx-runtime");function Ks(t){return"expiry"in t}function _r({authorization:t,assets:e={},locale:n,now:o,requester:r,preview:a,onApprove:i,onDecline:s,busy:l=!1,className:c}){let u=Ks(t)?t:(0,Or.describeAuthorization)(t,{assets:e,locale:n,now:o}),d=T(),f=d.Button??U,b=d.Card??ve;return(0,R.jsxs)("section",{"aria-labelledby":"authorization-consent-title",className:v("naculus-payment-surface naculus-authorization-consent mx-auto flex w-full max-w-lg flex-col gap-4 overflow-y-auto text-foreground",c),onKeyDown:g=>{g.key==="Escape"&&s()},children:[(0,R.jsxs)("header",{className:"naculus-consent-requester flex min-w-0 items-center gap-3",children:[r.icon?(0,R.jsx)("img",{className:"h-11 w-11 shrink-0 rounded-xl object-cover",src:r.icon,alt:""}):(0,R.jsx)("span",{"aria-hidden":!0,className:"grid h-11 w-11 shrink-0 place-items-center rounded-xl bg-muted text-lg font-semibold",children:r.name.slice(0,1).toUpperCase()}),(0,R.jsxs)("div",{className:"min-w-0",children:[(0,R.jsxs)("h2",{id:"authorization-consent-title",className:"truncate text-lg font-semibold",children:["Allow ",r.name," to pay?"]}),r.origin&&(0,R.jsx)("p",{className:"break-all text-xs text-muted-foreground",children:r.origin})]})]}),u.warnings.map(g=>(0,R.jsxs)("div",{role:"alert",className:"naculus-consent-summary flex gap-2 rounded-lg border border-amber-700 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-500 dark:bg-amber-950 dark:text-amber-100",children:[(0,R.jsx)(mt.AlertTriangle,{"aria-hidden":!0,className:"mt-0.5 shrink-0",size:18}),(0,R.jsx)("strong",{children:g})]},g)),a&&(0,R.jsxs)("div",{className:v("naculus-consent-summary flex gap-2 rounded-lg p-3 text-sm",Jt(a.allowed,!a.allowed)),children:[a.allowed?(0,R.jsx)(mt.ShieldCheck,{"aria-hidden":!0,size:18}):(0,R.jsx)(mt.ShieldX,{"aria-hidden":!0,size:18}),(0,R.jsxs)("p",{children:[(0,R.jsxs)("strong",{children:[a.allowed?"Allowed":"Blocked","."]})," ",a.sentence]})]}),(0,R.jsx)("div",{className:"naculus-consent-grants flex flex-col gap-3",children:u.grants.map(g=>(0,R.jsxs)(b,{className:"min-w-0 p-4",children:[(0,R.jsx)("h3",{className:"break-all text-sm font-semibold",children:g.assetLabel}),(0,R.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-3",children:[(0,R.jsxs)("div",{children:[(0,R.jsx)("p",{className:"text-xs text-muted-foreground",children:"Per payment"}),(0,R.jsx)("p",{className:"break-words text-xl font-semibold tabular-nums",children:g.perPayment.formatted})]}),(0,R.jsxs)("div",{children:[(0,R.jsx)("p",{className:"text-xs text-muted-foreground",children:"Total limit"}),(0,R.jsx)("p",{className:"break-words text-xl font-semibold tabular-nums",children:g.total.formatted})]})]}),(0,R.jsxs)("dl",{className:"mt-4 grid gap-3 text-sm",children:[(0,R.jsxs)("div",{children:[(0,R.jsx)("dt",{className:"font-medium",children:"Recipients"}),(0,R.jsx)("dd",{className:"mt-1 flex flex-col gap-1",children:g.recipients.length?g.recipients.map(m=>(0,R.jsx)(qe,{value:m.full},m.full)):(0,R.jsx)("span",{className:"font-semibold text-destructive",children:"No recipient restriction is displayed"})})]}),(0,R.jsxs)("div",{children:[(0,R.jsx)("dt",{className:"font-medium",children:"Payment count"}),(0,R.jsx)("dd",{className:"text-muted-foreground",children:g.count===null?"No count limit":`Up to ${g.count}`})]}),(0,R.jsxs)("div",{children:[(0,R.jsx)("dt",{className:"font-medium",children:"Payment methods"}),(0,R.jsx)("dd",{className:"mt-1 flex flex-wrap gap-1.5",children:g.rails.map(m=>(0,R.jsx)("span",{className:"rounded-full border border-border bg-muted px-2 py-1 text-xs",children:m},m))})]})]})]},`${g.asset}:${g.recipients.map(m=>m.full).join(",")}:${g.perPayment.formatted}:${g.total.formatted}`))}),(0,R.jsxs)("div",{className:"naculus-consent-expiry rounded-lg bg-muted p-3 text-sm",children:[(0,R.jsxs)("p",{className:"font-medium",children:["Expires ",u.expiry.relative]}),(0,R.jsx)("time",{className:"text-xs text-muted-foreground",dateTime:new Date(u.expiry.timestamp*1e3).toISOString(),children:u.expiry.absolute})]}),(0,R.jsxs)("div",{"data-payment-actions":!0,className:"naculus-sticky-actions sticky bottom-0 z-10 -mx-1 grid min-h-14 grid-cols-2 gap-3 border-t border-border bg-background px-1 pb-[max(0rem,env(safe-area-inset-bottom))] pt-3",children:[(0,R.jsx)(f,{variant:"outline",onClick:s,children:"Decline"}),(0,R.jsx)(f,{disabled:l,"aria-busy":l,onClick:i,children:l?"Approving\u2026":"Approve"})]})]})}var Xt=require("@naculus/connect-appkit-core"),Zt=require("lucide-react"),Kn=require("react");var P=require("react/jsx-runtime");function Fr({entries:t,assets:e={},onRevoke:n,revokingId:o,locale:r,className:a}){let i=Array.isArray(t)?t:t.entries,[s,l]=(0,Kn.useState)(null),[c,u]=(0,Kn.useState)(new Set),d=T(),f=d.Button??U,b=d.Card??ve,g=d.Badge??Ge;return i.length===0?(0,P.jsxs)("section",{className:v("rounded-xl border border-dashed border-border p-8 text-center",a),children:[(0,P.jsx)(Zt.Ban,{"aria-hidden":!0,className:"mx-auto mb-2 text-muted-foreground"}),(0,P.jsx)("h2",{className:"font-semibold",children:"No payment authorizations"}),(0,P.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Approvals you create will appear here."})]}):(0,P.jsxs)("section",{"aria-labelledby":"authorization-list-title",className:v("naculus-payment-surface flex w-full max-w-lg flex-col gap-3",a),children:[(0,P.jsx)("h2",{id:"authorization-list-title",className:"text-lg font-semibold",children:"Payment authorizations"}),i.map(m=>{let C=(0,Xt.describeAuthorization)(m,{assets:e,locale:r}),B=o===m.keyId;return(0,P.jsxs)(b,{className:"flex min-h-full min-w-0 flex-col overflow-y-auto p-4",children:[(0,P.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[(0,P.jsxs)("div",{className:"min-w-0",children:[(0,P.jsx)("h3",{className:"break-all font-semibold",children:C.label??C.grants.map(p=>p.assetLabel).join(", ")}),(0,P.jsx)("p",{className:"text-xs text-muted-foreground",children:{"evm-session":"EVM session key","solana-session":"Solana session key","mpp-voucher":"MPP channel key"}[m.enforcer]??m.enforcer.replaceAll("-"," ")})]}),(0,P.jsx)(g,{className:v("capitalize",m.status==="active"&&"bg-primary text-primary-foreground",m.status==="pending"&&"border border-border bg-background",(m.status==="revoked"||m.status==="expired")&&"bg-muted text-muted-foreground"),children:m.status})]}),(0,P.jsx)("div",{className:"mt-3 flex flex-col gap-3",children:C.grants.map(p=>{let k=m.spent?.[p.asset],A=m.grants.find($=>$.asset===p.asset)?.maxTotal,S=k!==void 0&&A&&A>0n?Number(k*100n/A):null;return(0,P.jsxs)("div",{className:"min-w-0 rounded-lg bg-muted p-3",children:[C.label&&(0,P.jsx)("p",{className:"break-all text-sm font-medium",children:p.assetLabel}),(0,P.jsx)("div",{className:"mt-1 flex flex-col gap-1",children:p.recipients.map($=>(0,P.jsx)(qe,{value:$.full},$.full))}),k!==void 0&&(0,P.jsxs)("div",{className:"mt-3",children:[(0,P.jsxs)("div",{className:"flex justify-between gap-2 text-xs",children:[(0,P.jsxs)("span",{children:["Spent"," ",(0,Xt.formatAuthorizationAmount)(k,e[p.asset]).formatted]}),(0,P.jsxs)("span",{children:["Total ",p.total.formatted]})]}),(0,P.jsx)("div",{role:"progressbar","aria-label":`${p.assetLabel} spent`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.min(S??0,100),className:"mt-1 h-2 overflow-hidden rounded-full bg-background",children:(0,P.jsx)("span",{className:"block h-full bg-primary",style:{width:`${Math.min(S??0,100)}%`}})})]})]},p.asset)})}),(0,P.jsxs)("p",{className:"mt-3 text-xs text-muted-foreground",title:new Date(C.expiry.timestamp*1e3).toISOString(),children:[m.status==="expired"?"Expired":m.status==="revoked"?"Revoked":`Expires ${C.expiry.relative}`," \xB7 ",C.expiry.absolute]}),C.warnings.map(p=>(0,P.jsxs)("p",{role:"alert",className:"mt-2 flex gap-2 rounded-md border border-amber-700 bg-amber-50 p-2 text-sm text-amber-950 dark:border-amber-500 dark:bg-amber-950 dark:text-amber-100",children:[(0,P.jsx)(Zt.AlertTriangle,{"aria-hidden":!0,className:"shrink-0",size:16}),p]},p)),c.has(m.keyId)&&(0,P.jsx)("p",{role:"status",className:"mt-2 rounded-md border border-amber-700 p-2 text-sm font-medium",children:"Local access is revoked. Complete the on-chain revocation to stop this authorization on chain."}),m.status==="active"||m.status==="pending"?(0,P.jsx)("div",{"data-payment-actions":!0,className:"naculus-sticky-actions sticky bottom-0 z-10 -mx-1 mt-3 flex min-h-14 justify-end gap-2 border-t border-border bg-card px-1 pb-[max(0rem,env(safe-area-inset-bottom))] pt-3",children:s===m.keyId?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(f,{variant:"ghost",onClick:()=>l(null),children:"Cancel"}),(0,P.jsx)(f,{className:"min-w-32",disabled:B,"aria-busy":B,onClick:()=>{Promise.resolve(n(m)).then(p=>{l(null),p.onChainRevocationRequired&&u(k=>new Set(k).add(m.keyId))})},children:B?"Revoking\u2026":"Confirm revoke"})]}):(0,P.jsx)(f,{variant:"outline",onClick:()=>l(m.keyId),children:"Revoke"})}):null]},m.keyId)})]})}var Ne=require("lucide-react");var E=require("react/jsx-runtime"),Kr={unverified:["Unverified","Reported by the server, not yet checked."],pending:["Checking","Checking on chain."],verified:["Verified","Verified on chain."],mismatch:["Mismatch","The on-chain settlement does not match this payment."],failed:["Verification failed","The settlement could not be verified."],unavailable:["Verification unavailable","On-chain checking is unavailable. Retry later."]};function qr({record:t,assets:e={},explorerUrl:n,className:o}){let r=T(),a=r.Card??ve,i=r.Badge??Ge,s=t.verification.status,l=s==="verified",c=s==="mismatch"||s==="failed",u=l?Ne.CheckCircle2:s==="pending"?Ne.LoaderCircle:c?Ne.AlertCircle:Ne.ShieldQuestion,d=n?.(t);return(0,E.jsxs)(a,{"data-verification":s,className:v("naculus-payment-surface mx-auto flex h-full w-full max-w-lg min-w-0 flex-col overflow-hidden p-5",o),children:[(0,E.jsxs)("header",{className:"text-center",children:[(0,E.jsx)("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Payment receipt"}),(0,E.jsx)("h2",{className:"mt-2 break-words text-3xl font-semibold tabular-nums",children:Hr(t.amount,t.asset,e)}),(0,E.jsx)("p",{className:"mt-1 break-all text-sm text-muted-foreground",children:t.asset?e[t.asset]?.symbol??t.asset:"Asset not reported"})]}),(0,E.jsxs)("div",{"aria-live":"polite",className:v("mt-5 flex min-h-[9rem] gap-2 rounded-lg p-3",Jt(l,c)),children:[(0,E.jsx)(u,{"aria-hidden":!0,className:v("mt-0.5 shrink-0",s==="pending"&&"animate-spin"),size:18}),(0,E.jsxs)("div",{children:[(0,E.jsx)(i,{className:"mb-1",children:Kr[s][0]}),(0,E.jsx)("p",{className:"text-sm",children:Kr[s][1]}),t.verification.reason&&(0,E.jsxs)("p",{className:"mt-1 break-words text-sm font-medium",children:["Reason: ",t.verification.reason]})]})]}),(0,E.jsxs)("dl",{className:"mt-5 grid gap-4 text-sm",children:[(0,E.jsxs)("div",{children:[(0,E.jsx)("dt",{className:"text-xs text-muted-foreground",children:"Recipient"}),(0,E.jsx)("dd",{children:t.payTo?(0,E.jsx)(qe,{value:t.payTo}):"Not reported"})]}),(0,E.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,E.jsxs)("div",{children:[(0,E.jsx)("dt",{className:"text-xs text-muted-foreground",children:"Protocol"}),(0,E.jsx)("dd",{children:t.protocol==="mpp"?"MPP":t.protocol})]}),(0,E.jsxs)("div",{children:[(0,E.jsx)("dt",{className:"text-xs text-muted-foreground",children:"Time"}),(0,E.jsx)("dd",{children:"Not recorded"})]})]}),(0,E.jsxs)("div",{children:[(0,E.jsx)("dt",{className:"text-xs text-muted-foreground",children:"Settlement reference"}),(0,E.jsx)("dd",{className:"mt-1",children:t.reference?(0,E.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,E.jsx)(qe,{value:t.reference}),d&&(0,E.jsxs)("a",{className:"naculus-hit-target relative inline-flex items-center gap-1 rounded text-xs font-medium underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",href:d,target:"_blank",rel:"noreferrer",children:["View on explorer ",(0,E.jsx)(Ne.ExternalLink,{"aria-hidden":!0,size:13})]})]}):"Not reported"})]})]})]})}0&&(module.exports={AccountButton,AccountSelector,AccountSelectorView,AddressWarningDialog,AppKit,AppKitButton,AppKitChainSelector,AuthorizationConsent,AuthorizationList,ChainSelector,ConnectButton,ErrorBoundary,PasskeySetup,PasskeySetupView,PassphraseDialog,PassphraseDialogView,PaymentReceipt,QRCodeModal,RouteSelector,SeedPhraseBackup,SignInButton,SmartWalletSettings,SmartWalletToggle,ThemeProvider,WalletConnectProvider,WalletPicker,WalletSecurityPanel,WalletSecurityPanelView,Web3ComponentProvider,Web3ConnectUI,cn,useAppKit,useComponent,useComponentRegistry,useDetectionMode,useEIP6963,useIsMobile,useTheme,useThemeVariable,useWalletConnect,useWalletConnectOptional});
|
|
11
|
+
}`}function xs(t){let e=new Set;if(t!=="computed"||typeof document>"u")return e;for(let n of Object.keys(it)){let o=it[n],r=getComputedStyle(document.documentElement).getPropertyValue(o.name).trim();r&&r!==o.fallback&&e.add(n)}return e}function jt({children:t,theme:e={},defaultDark:n=!1,priority:o="fallback"}){let[r,a]=(0,Z.useState)(e),[s,i]=(0,Z.useState)(n);(0,Z.useEffect)(()=>{En()},[r]);let[l,c]=(0,Z.useState)(new Set);(0,Z.useEffect)(()=>{c(xs(o))},[o]);let u=(0,Z.useMemo)(()=>{if(o==="fallback"||l.size===0)return r;let m={};for(let[f,S]of Object.entries(r))!l.has(f)&&S&&(m[f]=S);return m},[r,o,l]),d=(0,Z.useMemo)(()=>bs(u),[u]);(0,Z.useEffect)(()=>{if(typeof document>"u")return;let m=document.documentElement;s?m.classList.add("dark"):m.classList.remove("dark"),En()},[s]);let p=(0,Z.useMemo)(()=>"w3c-theme-"+Math.random().toString(36).slice(2,9),[]),h=(0,Z.useCallback)(()=>i(m=>!m),[]),x=(0,Z.useMemo)(()=>({theme:r,isDark:s,setTheme:a,toggleDarkMode:h}),[r,s,h]);return(0,Qt.jsxs)(dr.Provider,{value:x,children:[d?(0,Qt.jsx)("style",{id:p,children:d}):null,t]})}function Dn(){return(0,Z.useContext)(dr)}function ur(t){let{theme:e}=Dn(),[n,o]=(0,Z.useState)("");return(0,Z.useEffect)(()=>{let r=it[t];if(!r)return;let a=e[t];if(a){o(a);return}if(typeof document>"u"){o(r.fallback);return}let s=getComputedStyle(document.documentElement).getPropertyValue(r.name).trim();o(s||r.fallback)},[t,e]),n||it[t]?.fallback||""}var lt=require("react/jsx-runtime"),pr=(0,ct.createContext)({mode:"walletconnect"});function fr(){return(0,ct.useContext)(pr)}function dt({config:t,children:e,autoConnect:n=!1,detectionMode:o="walletconnect",theme:r,defaultDark:a=!1,themePriority:s="computed"}){let i=(0,ct.useMemo)(()=>({mode:o}),[o]),l=o==="walletconnect"||o==="auto";return(0,lt.jsx)(pr.Provider,{value:i,children:(0,lt.jsx)(jt,{theme:r,defaultDark:a,priority:s,children:(0,lt.jsx)($t,{components:{QRCodeModal:rt},children:(0,lt.jsx)(mr.Web3ConnectProvider,{config:t,autoConnect:n,children:l?(0,lt.jsx)(Bt,{children:e}):e})})})})}var br=require("react/jsx-runtime"),Mn={Button:U,ConnectButton:Be,AccountButton:Dt,ChainSelector:Oe,QRCodeModal:rt,SignInButton:qt,SeedPhraseBackup:at,ErrorBoundary:st,Web3ConnectUI:dt},gr=(0,ut.createContext)({});function $t({children:t,components:e={}}){let n=(0,ut.useMemo)(()=>({...Mn,...e}),[e]);return(0,br.jsx)(gr.Provider,{value:n,children:t})}function B(){return(0,ut.useContext)(gr)}function hr(t){return B()[t]}var K=require("react/jsx-runtime");function xr(t){let e=t&&typeof t=="object"&&"details"in t?t.details:void 0,n=e instanceof Error?`${e.name}: ${e.message}`:e;yr.logger.error("ui/ChainSelector","switchChain failed",t,n)}function wt({chainId:t,className:e}){let n=Et(t);return n?(0,K.jsx)("span",{className:C("inline-flex items-center justify-center shrink-0",e),dangerouslySetInnerHTML:{__html:n}}):null}function Oe({className:t,showLabel:e=!0,variant:n="dropdown"}){let{currentChain:o,availableChains:r,switchChain:a}=(0,Gt.useChain)(),{isConnected:s}=(0,Gt.useWallet)(),[i,l]=(0,mt.useState)(!1),u=B().Button??U,d=(0,mt.useRef)(null);if((0,mt.useEffect)(()=>{function x(m){d.current&&!d.current.contains(m.target)&&l(!1)}return document.addEventListener("mousedown",x),()=>document.removeEventListener("mousedown",x)},[]),!s)return null;let p=o?.name??"Unknown Chain",h=r.length>1;return n==="minimal"?(0,K.jsxs)("div",{className:C("inline-flex items-center gap-1.5 text-xs text-muted-foreground",t),children:[o&&(0,K.jsx)(wt,{chainId:o.caip2,className:"h-3.5 w-3.5"}),p]}):n==="buttons"?(0,K.jsx)("div",{className:C("flex flex-wrap gap-2",t),children:r.map(x=>{let m=x.caip2,f=m===o?.caip2;return(0,K.jsxs)(u,{className:f?C("bg-accent","border-primary"):"",onClick:()=>{f||a(m).catch(xr)},children:[(0,K.jsx)(wt,{chainId:m,className:"h-4 w-4"}),x.name,x.token&&(0,K.jsx)("span",{className:"text-xs opacity-60",children:x.token})]},m)})}):h?(0,K.jsxs)("div",{ref:d,className:C("relative inline-block",t),children:[(0,K.jsxs)(u,{onClick:()=>l(!i),children:[o&&(0,K.jsx)(wt,{chainId:o.caip2,className:"h-4 w-4"}),p,(0,K.jsx)("svg",{"aria-hidden":"true",className:C("h-3 w-3 transition-transform",i&&"rotate-180"),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,K.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]}),i&&(0,K.jsxs)("div",{className:"absolute left-0 top-full mt-1 z-50 min-w-[180px] rounded-lg border bg-card p-1 shadow-lg animate-in fade-in zoom-in-95 duration-200",children:[e&&(0,K.jsx)("div",{className:"px-2 py-1.5 text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Switch Network"}),r.map(x=>{let m=x.caip2,f=m===o?.caip2;return(0,K.jsxs)(u,{onClick:()=>{f||a(m).catch(xr),l(!1)},className:C("flex w-full items-center gap-2 rounded-md px-2 py-2 text-sm transition-all duration-200 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",f?"bg-accent font-medium":"hover:bg-accent/50"),children:[(0,K.jsx)(wt,{chainId:m,className:"h-4 w-4"}),(0,K.jsx)("span",{className:"flex-1 text-left",children:x.name}),x.token&&(0,K.jsx)("span",{className:"text-xs text-muted-foreground",children:x.token}),f&&(0,K.jsx)("svg",{"aria-hidden":"true",className:"h-4 w-4 text-primary",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,K.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})]},m)})]})]}):(0,K.jsxs)("div",{className:C("inline-flex items-center gap-2 rounded-md border border-border px-3 py-2 text-sm opacity-60 cursor-default",t),children:[o&&(0,K.jsx)(wt,{chainId:o.caip2,className:"h-4 w-4"}),p]})}var vr=require("@naculus/connect-appkit-react"),Se=require("lucide-react"),Me=require("react");var G=require("react/jsx-runtime"),vs={eip155:{name:"Ethereum & EVM",detail:"One address across Ethereum, Polygon, Arbitrum and every EVM chain"},solana:{name:"Solana",detail:"A separate key on a different curve"}};function Cs(t){return t.length<=12?t:`${t.slice(0,6)}...${t.slice(-4)}`}function Ns({account:t,isActive:e,onSelect:n}){let[o,r]=(0,Me.useState)(!1),a=vs[t.namespace]??{name:t.namespace,detail:""},s=(0,Me.useCallback)(i=>{i.stopPropagation();let l=navigator?.clipboard?.writeText;l&&l.call(navigator.clipboard,t.address).then(()=>{r(!0),setTimeout(()=>r(!1),1500)},()=>{})},[t.address]);return(0,G.jsxs)("div",{role:"radio",tabIndex:0,"aria-checked":e,onClick:n,onKeyDown:i=>{i.target===i.currentTarget&&(i.key==="Enter"||i.key===" ")&&(i.preventDefault(),n())},className:C("flex w-full items-center gap-3 rounded-md border px-3 py-2.5 text-left text-sm transition-colors","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e?"border-primary bg-accent":"border-border hover:bg-accent/50"),children:[(0,G.jsxs)("span",{className:"flex min-w-0 flex-1 flex-col",children:[(0,G.jsxs)("span",{className:"flex items-center gap-2 font-medium",children:[a.name,e&&(0,G.jsx)("span",{className:"rounded-sm bg-primary/10 px-1.5 py-0.5 text-[10px] font-medium uppercase tracking-wide text-primary",children:"Signing"})]}),(0,G.jsx)("span",{className:"truncate font-mono text-xs text-muted-foreground",children:Cs(t.address)})]}),(0,G.jsx)("button",{type:"button","aria-label":`Copy ${a.name} address`,onClick:s,className:"naculus-hit-target shrink-0 rounded p-1 text-muted-foreground hover:bg-accent hover:text-foreground",children:o?(0,G.jsx)(Se.Check,{size:14}):(0,G.jsx)(Se.Copy,{size:14})}),e&&(0,G.jsx)(Se.Check,{size:16,className:"shrink-0 text-primary"})]})}function zn({className:t,hideBackfill:e=!1,onSelect:n,accounts:o,activeNamespace:r,canDerive:a,setActiveNamespace:s,backfillAccounts:i}){let[l,c]=(0,Me.useState)(!1),[u,d]=(0,Me.useState)(null),p=(0,Me.useCallback)(m=>{if(m!==r)try{s(m),d(null),n?.(m)}catch(f){d(f instanceof Error?f.message:"Could not switch account")}},[r,s,n]),h=(0,Me.useCallback)(async()=>{c(!0),d(null);try{await i()}catch(m){d(m instanceof Error?m.message:"Could not derive accounts")}finally{c(!1)}},[i]);if(o.length===0)return null;let x=!e&&a;return(0,G.jsxs)("div",{className:C("flex flex-col gap-2",t),children:[(0,G.jsxs)("div",{className:"flex items-baseline justify-between",children:[(0,G.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Accounts"}),(0,G.jsx)("span",{className:"text-[11px] text-muted-foreground",children:"Chooses the signing key, not the network"})]}),(0,G.jsx)("div",{role:"radiogroup","aria-label":"Wallet accounts",className:"flex flex-col gap-1.5",children:o.map(m=>(0,G.jsx)(Ns,{account:m,isActive:m.namespace===r,onSelect:()=>p(m.namespace)},m.namespace))}),x&&(0,G.jsxs)("button",{type:"button",onClick:h,disabled:l,className:C("flex items-center justify-center gap-2 rounded-md border border-dashed border-border px-3 py-2 text-xs text-muted-foreground","hover:bg-accent/50 disabled:opacity-60"),children:[l?(0,G.jsx)(Se.Loader2,{size:14,className:"animate-spin"}):(0,G.jsx)(Se.Plus,{size:14}),l?"Deriving\u2026":"Show accounts this phrase already owns"]}),u&&(0,G.jsx)("p",{role:"alert",className:"text-xs text-destructive",children:u})]})}function Cr(t){let{wallet:e,accounts:n,activeNamespace:o,setActiveNamespace:r,backfillAccounts:a}=(0,vr.useEmbeddedWallet)();return e?(0,G.jsx)(zn,{...t,accounts:n,activeNamespace:o,canDerive:e.recoveryAvailable&&n.length<2,setActiveNamespace:r,backfillAccounts:a}):null}var Te=require("lucide-react"),wr=require("@naculus/connect-appkit-react");var O=require("react/jsx-runtime"),ws={critical:Te.ShieldAlert,warning:Te.AlertTriangle,info:Te.Info},ks={critical:"text-destructive",warning:"text-amber-600 dark:text-amber-500",info:"text-muted-foreground"};function Nr(t){return t>=90?"text-emerald-600 dark:text-emerald-500":t>=70?"text-amber-600 dark:text-amber-500":"text-destructive"}function Rs({finding:t}){let e=ws[t.severity]??Te.Info;return(0,O.jsxs)("li",{className:"flex gap-2.5 rounded-md border border-border px-3 py-2.5",children:[(0,O.jsx)(e,{size:16,className:C("mt-0.5 shrink-0",ks[t.severity])}),(0,O.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,O.jsxs)("div",{className:"flex items-baseline justify-between gap-2",children:[(0,O.jsx)("span",{className:"text-sm font-medium",children:t.title}),t.deduction>0&&(0,O.jsxs)("span",{className:"shrink-0 font-mono text-xs text-muted-foreground",children:["\u2212",t.deduction]})]}),(0,O.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:t.detail}),t.remedy&&(0,O.jsxs)("p",{className:"text-xs leading-relaxed",children:[(0,O.jsx)("span",{className:"font-medium",children:"What helps: "}),(0,O.jsx)("span",{className:"text-muted-foreground",children:t.remedy})]})]})]})}function In({className:t,hideInformational:e=!1,report:n}){if(!n)return null;let{score:o,level:r,findings:a,encrypted:s,backend:i,unlock:l}=n,c=e?a.filter(d=>d.deduction>0):a,u=a.every(d=>d.deduction===0);return(0,O.jsxs)("div",{className:C("flex flex-col gap-3",t),children:[(0,O.jsxs)("div",{className:"flex items-center gap-3 rounded-lg border border-border px-4 py-3",children:[(0,O.jsx)(Te.ShieldCheck,{size:22,className:C("shrink-0",Nr(o))}),(0,O.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col",children:[(0,O.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,O.jsx)("span",{className:C("text-2xl font-semibold tabular-nums",Nr(o)),children:o}),(0,O.jsx)("span",{className:"text-sm text-muted-foreground",children:"/ 100"}),(0,O.jsxs)("span",{className:"ml-auto text-xs text-muted-foreground",children:["Tier ",r]})]}),(0,O.jsxs)("span",{className:"text-xs text-muted-foreground",children:[i==="localStorage"?"localStorage":"IndexedDB",s?" \xB7 encrypted":" \xB7 not encrypted",l.sealedWith?.includes("prf")?" \xB7 passkey":""]})]})]}),u?(0,O.jsx)("p",{className:"text-xs text-muted-foreground",children:"Nothing is holding this score down."}):(0,O.jsx)("p",{className:"text-xs text-muted-foreground",children:"Scored against this SDK's own published rubric, not an external standard. Each item below names the points it costs."}),(0,O.jsx)("ul",{className:"flex flex-col gap-1.5",children:c.map(d=>(0,O.jsx)(Rs,{finding:d},d.id))})]})}function kr(t){let{securityReport:e}=(0,wr.useEmbeddedWallet)();return(0,O.jsx)(In,{...t,report:e})}var Ce=require("react"),ze=require("lucide-react"),Rr=require("@naculus/connect-appkit-react");var L=require("react/jsx-runtime"),Ln=8,Ss=12;function Wn({className:t,request:e,submit:n,cancel:o}){let[r,a]=(0,Ce.useState)(""),[s,i]=(0,Ce.useState)(""),[l,c]=(0,Ce.useState)(!1),u=(0,Ce.useRef)(null),d=e?.intent==="create";(0,Ce.useEffect)(()=>{if(!e){a(""),i(""),c(!1);return}a(""),i(""),u.current?.focus()},[e]);let p=d&&r.length>0&&r.length<Ln,h=d&&s.length>0&&s!==r,x=d?r.length>=Ln&&s===r:r.length>0,m=(0,Ce.useCallback)(f=>{f.preventDefault(),x&&n(r)},[x,n,r]);return e?(0,L.jsx)("div",{className:"naculus-dialog-viewport fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4",role:"presentation",children:(0,L.jsxs)("form",{role:"dialog","aria-modal":"true","aria-label":d?"Choose a passphrase":"Unlock your wallet",onSubmit:m,className:C("naculus-dialog-surface flex w-full max-w-lg flex-col gap-4 overflow-y-auto rounded-lg border border-border bg-card p-5 shadow-lg",t),children:[(0,L.jsxs)("div",{className:"sticky top-0 z-10 -mx-1 flex items-center gap-2 bg-card px-1 py-1",children:[(0,L.jsx)(ze.KeyRound,{size:18,className:"shrink-0 text-primary"}),(0,L.jsx)("h2",{className:"text-base font-semibold",children:d?"Choose a passphrase":"Unlock your wallet"})]}),e.previousError&&(0,L.jsx)("p",{role:"alert",className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:e.previousError}),(0,L.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:d?"This encrypts your wallet on this device. Without it, anything that can run script on this page can read your keys.":"Your wallet is encrypted on this device. Enter the passphrase you chose to open it."}),(0,L.jsxs)("label",{className:"flex flex-col gap-1.5",children:[(0,L.jsx)("span",{className:"text-xs font-medium",children:"Passphrase"}),(0,L.jsxs)("span",{className:"relative flex items-center",children:[(0,L.jsx)("input",{ref:u,type:l?"text":"password",value:r,onChange:f=>a(f.target.value),autoComplete:d?"new-password":"current-password",autoFocus:!0,className:"w-full rounded-md border border-border bg-background px-3 py-2 pr-9 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"}),(0,L.jsx)("button",{type:"button","aria-label":l?"Hide passphrase":"Show passphrase",onClick:()=>c(f=>!f),className:"naculus-hit-target absolute right-2 text-muted-foreground hover:text-foreground",children:l?(0,L.jsx)(ze.EyeOff,{size:15}):(0,L.jsx)(ze.Eye,{size:15})})]})]}),d&&(0,L.jsxs)("label",{className:"flex flex-col gap-1.5",children:[(0,L.jsx)("span",{className:"text-xs font-medium",children:"Type it again"}),(0,L.jsx)("input",{type:l?"text":"password",value:s,onChange:f=>i(f.target.value),autoComplete:"new-password",className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"})]}),p&&(0,L.jsxs)("p",{role:"alert",className:"text-xs text-destructive",children:["At least ",Ln," characters."]}),h&&(0,L.jsx)("p",{role:"alert",className:"text-xs text-destructive",children:"These do not match."}),d&&!p&&r.length>0&&r.length<Ss&&(0,L.jsx)("p",{className:"text-xs text-muted-foreground",children:"Short. Several ordinary words are far harder to guess than a short one with symbols in it."}),d&&(0,L.jsxs)("p",{className:"flex gap-2 rounded-md bg-amber-500/10 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:text-amber-500",children:[(0,L.jsx)(ze.ShieldAlert,{size:14,className:"mt-0.5 shrink-0"}),(0,L.jsx)("span",{children:"If you forget this, nothing can open this copy of the wallet \u2014 not us, not your browser. Your recovery phrase is the only thing that gets it back."})]}),(0,L.jsxs)("div",{"data-dialog-actions":!0,className:"sticky bottom-0 z-10 -mx-5 flex min-h-14 justify-end gap-2 border-t border-border bg-card px-5 pb-[max(0rem,env(safe-area-inset-bottom))] pt-3",children:[(0,L.jsx)("button",{type:"button",onClick:()=>o(),className:"rounded-md border border-border px-3 py-2 text-sm hover:bg-accent",children:"Cancel"}),(0,L.jsx)("button",{type:"submit",disabled:!x,className:"rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-50",children:d?"Encrypt wallet":"Unlock"})]})]})}):null}function Sr(t){let{request:e,submit:n,cancel:o}=(0,Rr.usePassphraseGate)();return(0,L.jsx)(Wn,{...t,request:e,submit:n,cancel:o})}var _e=require("react"),fe=require("lucide-react"),Yt=require("@naculus/connect-appkit-react");var q=require("react/jsx-runtime");function Vn({className:t,passkeys:e,unlock:n,onRegistered:o}){let[r,a]=(0,_e.useState)(!1),[s,i]=(0,_e.useState)(null),[l,c]=(0,_e.useState)(!1),u=!!e?.hasCredential?.()||l,d=(0,_e.useCallback)(async()=>{if(e){a(!0),i(null);try{await e.createPasskey(),c(!0),await o?.()}catch(m){i(m instanceof Error?m.message:"Could not register a passkey")}finally{a(!1)}}},[e,o]);if(!e)return null;let p=n?.sealedWith?.includes("prf")??!1,h=null;if(u)switch(n?.prf){case"available":h=p?{tone:"good",icon:(0,q.jsx)(fe.ShieldCheck,{size:16}),title:"Your passkey unlocks this wallet",detail:"Opening it needs your fingerprint or face, not a value a script on this page can supply."}:{tone:"warn",icon:(0,q.jsx)(fe.TriangleAlert,{size:16}),title:"Registered, but not applied yet",detail:"This device can produce the key material. The next time the wallet is saved, the record is sealed under it."};break;case"unavailable":h={tone:"bad",icon:(0,q.jsx)(fe.ShieldAlert,{size:16}),title:"This passkey cannot unlock the wallet",detail:"The authenticator did not return the key material. Firefox does not implement the extension, and a passkey created before it was requested cannot have it added afterwards \u2014 a new one has to be registered on a browser that supports it."};break;default:h={tone:"neutral",icon:(0,q.jsx)(fe.Fingerprint,{size:16}),title:"A passkey is registered",detail:"Whether it can unlock this wallet is not known until the wallet is opened once. It will be used if it works."};break}let x={good:"text-emerald-600 dark:text-emerald-500",warn:"text-amber-600 dark:text-amber-500",bad:"text-destructive",neutral:"text-muted-foreground"};return(0,q.jsxs)("div",{className:C("flex flex-col gap-3",t),children:[h?(0,q.jsxs)("div",{className:"flex gap-2.5 rounded-md border border-border px-3 py-2.5",children:[(0,q.jsx)("span",{className:C("mt-0.5 shrink-0",x[h.tone]),children:h.icon}),(0,q.jsxs)("div",{className:"flex min-w-0 flex-col gap-1",children:[(0,q.jsx)("span",{className:"text-sm font-medium",children:h.title}),(0,q.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:h.detail})]})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)("p",{className:"text-xs leading-relaxed text-muted-foreground",children:"A passkey raises what it takes to read your stored keys from \u201Cany script on this page\u201D to your fingerprint or face. The passphrase keeps working, so a broken or replaced authenticator does not cost you this copy."}),(0,q.jsxs)("p",{className:"flex gap-2 rounded-md bg-amber-500/10 px-3 py-2 text-xs leading-relaxed text-amber-700 dark:text-amber-500",children:[(0,q.jsx)(fe.ShieldAlert,{size:14,className:"mt-0.5 shrink-0"}),(0,q.jsx)("span",{children:"This protects the copy on this device. It does not back up your wallet \u2014 the recovery phrase is still the only thing that survives losing this device."})]}),(0,q.jsxs)("button",{type:"button",onClick:d,disabled:r,className:"flex items-center justify-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground disabled:opacity-60",children:[r?(0,q.jsx)(fe.Loader2,{size:15,className:"animate-spin"}):(0,q.jsx)(fe.Fingerprint,{size:15}),r?"Waiting for your device\u2026":"Protect with a passkey"]})]}),s&&(0,q.jsx)("p",{role:"alert",className:"text-xs text-destructive",children:s})]})}function Tr(t){let{client:e}=(0,Yt.useWeb3)(),{securityReport:n,hasWallet:o}=(0,Yt.useEmbeddedWallet)(),r=(0,_e.useCallback)(async()=>{let a=e?.embeddedConnector;a&&o&&await a.save()},[e,o]);return(0,q.jsx)(Vn,{...t,passkeys:e?.passkeysConnector??null,unlock:n?.unlock,onRegistered:r})}var ie=require("@naculus/connect-appkit-react"),ne=require("react");var xe=require("react/jsx-runtime"),Br=(0,ne.createContext)(null);function Un(){let t=(0,ne.useContext)(Br);if(!t)throw new Error("useAppKit must be used within an <AppKit> component");return t}function Hn({projectId:t,metadata:e,enableEmbedded:n=!1,enablePasskeys:o=!1,chains:r,embeddedConfig:a,encryptionKey:s,siwx:i,children:l,className:c,autoConnect:u=!1,theme:d,defaultDark:p=!1,themePriority:h="computed",detectionMode:x="auto"}){let[m,f]=(0,ne.useState)(!1),[S,g]=(0,ne.useState)(!1),w=(0,ne.useMemo)(()=>({projectId:t,metadata:e,enableEmbedded:n,enablePasskeys:o,chains:r,embeddedConfig:a,encryptionKey:s,siwx:i}),[t,e,n,o,r,a,s,i]);return(0,xe.jsx)(dt,{config:w,autoConnect:u,detectionMode:x,theme:d,defaultDark:p,themePriority:h,children:(0,xe.jsx)(Ts,{className:c,open:m,setOpen:f,backupOpen:S,setBackupOpen:g,children:l})})}function Ts({children:t,className:e,open:n,setOpen:o,backupOpen:r,setBackupOpen:a}){let{isConnected:s,isConnecting:i}=(0,ie.useWallet)(),{primaryAccount:l}=(0,ie.useAccount)(),{currentChain:c,availableChains:u,switchChain:d}=(0,ie.useChain)(),p=(0,ie.useEmbeddedWallet)(),{disconnect:h}=(0,ie.useDisconnect)(),{wallets:x,hasWallets:m}=$e(),{formatted:f}=(0,ie.useBalance)(),S=f??null,g=(0,ne.useCallback)(async()=>{await h()},[h]),w=(0,ne.useCallback)(()=>{p.confirmBackup(),a(!1)},[p,a]),A=(0,ne.useCallback)(()=>{p.confirmBackup(),a(!1)},[p,a]),T=(0,ne.useCallback)(()=>p.getPrivateKey(),[p]),J=(0,ne.useMemo)(()=>({connect:()=>o(!0),disconnect:g,isConnected:s,isConnecting:i,address:l,balance:S,balanceSymbol:c?.token??null,chainName:c?.name??null,availableChains:u.map(E=>({caip2:E.caip2,name:E.name,token:E.token})),switchChain:d,wallets:x,hasWallets:m,backupPending:p.backupPending,seedPhrase:p.seedPhrase,confirmBackup:w,skipBackup:A,open:n,setOpen:o}),[s,i,l,S,c,u,d,x,m,p.backupPending,p.seedPhrase,w,A,g,n,o]);return(0,ne.useEffect)(()=>{p.seedPhrase&&p.backupPending&&a(!0)},[p.seedPhrase,p.backupPending,a]),(0,xe.jsxs)(Br.Provider,{value:J,children:[t,p.seedPhrase&&r&&(0,xe.jsx)(at,{seedPhrase:p.seedPhrase,onConfirm:w,onSkip:A,onExportPrivateKey:T,open:r,onOpenChange:a})]})}function On({className:t}){let e=Un(),{connectInjected:n}=(0,ie.useWeb3)(),{primaryAccount:o}=(0,ie.useAccount)(),{disconnect:r}=(0,ie.useDisconnect)(),a=(0,ne.useCallback)(async(s,i,l)=>{s==="injected"&&(await n(l),i())},[n]);return e.isConnected&&o?(0,xe.jsxs)("div",{className:C("inline-flex items-center gap-2",t),children:[(0,xe.jsx)(Oe,{variant:"minimal"}),(0,xe.jsx)(Be,{isConnected:e.isConnected,address:o,balance:e.balance,balanceSymbol:e.balanceSymbol??void 0,onDisconnect:r,onConnect:a,className:t})]}):(0,xe.jsx)(Be,{isConnected:e.isConnected,isConnecting:e.isConnecting,address:o,balance:e.balance,balanceSymbol:e.balanceSymbol??void 0,onDisconnect:r,onConnect:a,className:t})}function _n({className:t,variant:e="dropdown"}){return(0,xe.jsx)(Oe,{className:t,variant:e})}try{let t=Mn;t&&Object.assign(t,{AppKit:Hn,AppKitButton:On,AppKitChainSelector:_n})}catch{}var le=require("lucide-react");var y=require("react/jsx-runtime");function Bs(t){if(t<1e3)return"<1s";if(t<6e4)return`~${Math.round(t/1e3)}s`;let e=Math.floor(t/6e4),n=Math.round(t%6e4/1e3);return n>0?`~${e}m ${n}s`:`~${e}m`}function Pr(t){return t.symbol||"UNKNOWN"}function Ps(t){let e=t.toLowerCase();return e.includes("lifi")?"default":e.includes("axelar")?"secondary":"outline"}function As(t){return t.length>12?`${t.slice(0,6)}...${t.slice(-6)}`:t}function Es({route:t,onSelect:e}){let n=B(),o=n.Button??U,r=n.Badge,a=t.provider??"Route";return(0,y.jsxs)("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border p-4 transition-colors hover:bg-accent/30",children:[(0,y.jsxs)("div",{className:"flex flex-col gap-1.5 min-w-0",children:[(0,y.jsxs)("div",{className:"flex items-center gap-2",children:[r?(0,y.jsx)(r,{variant:Ps(a),children:a}):(0,y.jsx)("span",{className:"inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-medium",children:a}),t.steps.length>1&&(0,y.jsxs)("span",{className:"text-xs text-muted-foreground",children:[t.steps.length," steps"]})]}),(0,y.jsxs)("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 text-sm",children:[(0,y.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[(0,y.jsx)(le.DollarSign,{className:"h-3.5 w-3.5"}),"$",t.gasCosts.totalUsd]}),(0,y.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[(0,y.jsx)(le.Clock,{className:"h-3.5 w-3.5"}),Bs(t.steps.reduce((s,i)=>{let l=t.estimatedTime>0?15e3:0;return s+l},0))]}),(0,y.jsxs)("span",{className:"inline-flex items-center gap-1 text-muted-foreground",children:[t.gasCosts.totalUsd," cost"]})]})]}),(0,y.jsx)(o,{variant:"outline",size:"sm",onClick:e,children:"Select"})]})}function Ds(){let e=B().Skeleton;return(0,y.jsxs)("div",{className:"flex flex-col gap-3","data-testid":"route-selector-loading",children:[(0,y.jsxs)("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[(0,y.jsx)(le.Loader2,{className:"h-4 w-4 animate-spin"}),(0,y.jsx)("span",{children:"Fetching best routes..."})]}),[1,2,3].map(n=>(0,y.jsxs)("div",{className:"flex items-center justify-between gap-4 rounded-lg border border-border p-4",children:[(0,y.jsx)("div",{className:"flex flex-col gap-2 flex-1",children:e?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(e,{className:"h-4 w-24"}),(0,y.jsx)(e,{className:"h-3 w-48"})]}):(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)("div",{className:"h-4 w-24 animate-pulse rounded bg-muted"}),(0,y.jsx)("div",{className:"h-3 w-48 animate-pulse rounded bg-muted"})]})}),e?(0,y.jsx)(e,{className:"h-8 w-20 rounded-md"}):(0,y.jsx)("div",{className:"h-8 w-20 animate-pulse rounded-md bg-muted"})]},n))]})}function Ms(){return(0,y.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-8 text-sm text-muted-foreground","data-testid":"route-selector-empty",children:[(0,y.jsx)(le.AlertCircle,{className:"h-8 w-8 opacity-40"}),(0,y.jsx)("span",{children:"No routes found for this pair"}),(0,y.jsx)("span",{className:"text-xs",children:"Try a different token or amount"})]})}function zs({error:t,onRetry:e}){let o=B().Button??U;return(0,y.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-6","data-testid":"route-selector-error",children:[(0,y.jsx)(le.XCircle,{className:"h-8 w-8 text-destructive"}),(0,y.jsx)("p",{className:"text-sm text-destructive font-medium",children:"Failed to fetch routes"}),(0,y.jsx)("p",{className:"text-xs text-muted-foreground max-w-xs text-center",children:t}),e&&(0,y.jsx)(o,{variant:"outline",size:"sm",onClick:e,children:"Retry"})]})}function Is(){let e=B().Progress;return(0,y.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6","data-testid":"route-selector-executing",children:[(0,y.jsx)(le.Loader2,{className:"h-6 w-6 animate-spin text-primary"}),(0,y.jsx)("p",{className:"text-sm font-medium",children:"Executing route..."}),(0,y.jsx)("p",{className:"text-xs text-muted-foreground",children:"Please confirm the transaction in your wallet"}),e?(0,y.jsx)(e,{value:50,className:"w-48 h-1.5"}):(0,y.jsx)("div",{className:"h-1.5 w-48 rounded-full bg-muted",children:(0,y.jsx)("div",{className:"h-full w-1/2 rounded-full bg-primary animate-pulse"})})]})}function Ls({txHash:t}){return(0,y.jsxs)("div",{className:"flex flex-col items-center gap-2 py-6","data-testid":"route-selector-success",children:[(0,y.jsx)(le.CheckCircle2,{className:"h-8 w-8 text-green-500"}),(0,y.jsx)("p",{className:"text-sm font-medium text-green-600 dark:text-green-400",children:"Route executed successfully!"}),(0,y.jsxs)("p",{className:"text-xs text-muted-foreground font-mono",children:["TX: ",As(t)]})]})}function Ar({chainId:t,className:e}){let n=Et(`eip155:${t}`);return n?(0,y.jsx)("span",{className:C("inline-flex items-center justify-center shrink-0",e),dangerouslySetInnerHTML:{__html:n}}):null}function Er({inputToken:t,outputToken:e,amount:n,routes:o=[],loading:r=!1,executing:a=!1,onRouteSelected:s,onCancel:i,successTxHash:l,error:c,className:u}){let d=B(),p=d.Card,h=d.Button??U;if(l)return(0,y.jsx)("div",{className:C("rounded-lg border border-border",u),children:(0,y.jsx)(Ls,{txHash:l})});if(a)return(0,y.jsx)("div",{className:C("rounded-lg border border-border",u),children:(0,y.jsx)(Is,{})});return p?(0,y.jsxs)(p,{className:C("p-4",u),children:[m(),f(),S()]}):(0,y.jsxs)("div",{className:C("rounded-lg border border-border p-4",u),children:[m(),f(),S()]});function m(){return!t&&!e?null:(0,y.jsxs)("div",{className:"mb-4 flex flex-wrap items-center gap-2 text-sm",children:[t&&(0,y.jsxs)("span",{className:"inline-flex items-center gap-1.5 font-medium",children:[(0,y.jsx)(Ar,{chainId:t.chainId,className:"h-4 w-4"}),n?`${n.toString()} `:"",Pr(t)]}),t&&e&&(0,y.jsx)(le.ArrowRight,{className:"h-3.5 w-3.5 text-muted-foreground"}),e&&(0,y.jsxs)("span",{className:"inline-flex items-center gap-1.5 font-medium",children:[(0,y.jsx)(Ar,{chainId:e.chainId,className:"h-4 w-4"}),Pr(e)]})]})}function f(){return r?(0,y.jsx)(Ds,{}):c?(0,y.jsx)(zs,{error:c}):o.length===0?(0,y.jsx)(Ms,{}):(0,y.jsx)("div",{className:"flex flex-col gap-2","data-testid":"route-selector-routes",children:o.map((g,w)=>(0,y.jsx)(Es,{route:g,onSelect:()=>s?.(g)},`${g.fromChain}-${g.toChain}-${g.gasCosts.totalUsd}-${w}`))})}function S(){return!r&&o.length===0&&!c?null:(0,y.jsx)("div",{className:"mt-4 flex justify-end",children:(0,y.jsx)(h,{variant:"ghost",size:"sm",onClick:i,children:"Cancel"})})}}var Dr=tn(require("react"),1),j=require("lucide-react");var N=require("react/jsx-runtime");function Ws(t){let e=Number(t)/1e18;return e<.001?`~${e.toFixed(6)} ETH`:`~${e.toFixed(3)} ETH`}function Mr({isDeployed:t=!1,isDeploying:e=!1,estimatedGas:n,error:o=null,onUpgrade:r,onShowSettings:a,onRetry:s}){let i=B(),l=i.Button??U,c=i.Card??ve,u=i.Badge??Ye,d=a?(0,N.jsxs)(l,{variant:"outline",className:"w-full",onClick:a,children:[(0,N.jsx)(j.Settings,{size:15})," Advanced Settings ",(0,N.jsx)(j.ChevronRight,{size:14,className:"text-muted-foreground"})]}):null;return t?(0,N.jsxs)(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[(0,N.jsx)("div",{className:"flex items-start justify-between",children:(0,N.jsxs)("div",{className:"flex items-center gap-3",children:[(0,N.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-green-500/10",children:(0,N.jsx)(j.ShieldCheck,{size:22,className:"text-green-500"})}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)("span",{className:"text-base font-semibold text-foreground",children:"Smart Wallet"}),(0,N.jsxs)(u,{variant:"secondary",className:"rounded-full bg-green-500/10 px-2 py-0 text-xs font-medium text-green-500",children:[(0,N.jsx)(j.CheckCircle2,{size:12,className:"mr-0.5 inline"})," Deployed"]})]}),(0,N.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Your wallet has been upgraded to a smart wallet"})]})]})}),(0,N.jsx)("div",{className:"mt-4 grid grid-cols-2 gap-3",children:[[j.Fuel,"Gas Sponsorship","Enabled"],[j.RefreshCw,"Recovery","Enabled"]].map(([p,h,x])=>(0,N.jsxs)("div",{className:"rounded-lg bg-muted/50 p-3",children:[(0,N.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[Dr.default.createElement(p,{size:14}),(0,N.jsx)("span",{children:h})]}),(0,N.jsx)("div",{className:"mt-1 text-sm font-medium text-foreground",children:x})]},h))}),a&&(0,N.jsx)("div",{className:"mt-4",children:d})]}):e?(0,N.jsx)(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:(0,N.jsxs)("div",{className:"flex flex-col items-center text-center",children:[(0,N.jsx)("div",{className:"mb-4 flex h-14 w-14 items-center justify-center rounded-full bg-primary/10",children:(0,N.jsx)(j.LoaderCircle,{size:28,className:"animate-spin text-primary"})}),(0,N.jsx)("h3",{className:"mb-1 text-base font-semibold text-foreground",children:"Deploying Smart Wallet..."}),(0,N.jsx)("p",{className:"mb-4 text-sm text-muted-foreground",children:"Please wait, contract deployment may take a few seconds"}),(0,N.jsx)("div",{className:"h-2 w-full max-w-[200px] overflow-hidden rounded-full bg-muted",children:(0,N.jsx)("div",{className:"h-full w-full animate-pulse rounded-full bg-primary",style:{animationDuration:"1.5s"}})})]})}):o?(0,N.jsxs)(c,{className:"w-full rounded-xl border border-destructive/30 bg-destructive/5 p-5 shadow-sm",children:[(0,N.jsxs)("div",{className:"flex items-start gap-3",children:[(0,N.jsx)("div",{className:"mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-destructive/10",children:(0,N.jsx)(j.AlertCircle,{size:18,className:"text-destructive"})}),(0,N.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,N.jsx)("h4",{className:"text-sm font-semibold text-destructive",children:"Deployment Failed"}),(0,N.jsx)("p",{className:"mt-1 text-xs text-destructive/80 break-words",children:o}),s&&(0,N.jsxs)(l,{variant:"outline",size:"sm",className:"mt-3 border-destructive/30 text-destructive hover:bg-destructive/10",onClick:s,children:[(0,N.jsx)(j.RotateCcw,{size:13})," Retry"]})]})]}),a&&(0,N.jsx)("div",{className:"mt-3",children:d})]}):(0,N.jsxs)(c,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[(0,N.jsxs)("div",{className:"flex items-center gap-3",children:[(0,N.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-amber-500/10",children:(0,N.jsx)(j.Shield,{size:20,className:"text-amber-500"})}),(0,N.jsxs)("div",{children:[(0,N.jsxs)("div",{className:"flex items-center gap-2",children:[(0,N.jsx)("span",{className:"text-base font-semibold text-foreground",children:"Smart Wallet"}),(0,N.jsx)("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground",children:"Not Upgraded"})]}),(0,N.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Upgrade to a smart wallet for more features"})]})]}),(0,N.jsxs)("div",{className:"mt-4 space-y-2",children:[(0,N.jsx)(Fn,{icon:j.Zap,color:"text-green-500",text:"No ETH needed for transactions \u2014 pay gas with USDC/USDT"}),(0,N.jsx)(Fn,{icon:j.Fuel,color:"text-blue-500",text:"Optional dApp sponsorship, zero-cost transactions"}),(0,N.jsx)(Fn,{icon:j.ShieldCheck,color:"text-purple-500",text:"Secure recovery mechanism, no fear of losing keys"})]}),r&&(0,N.jsxs)(l,{className:"mt-4 w-full",onClick:r,children:["Upgrade Now",n!==void 0&&(0,N.jsxs)("span",{className:"ml-1 text-xs opacity-80",children:["(Estimated gas fee: ",Ws(n),")"]})]}),a&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)("div",{className:"mt-4 mb-3 flex items-center gap-2",children:[(0,N.jsx)("div",{className:"h-px flex-1 bg-border"}),(0,N.jsx)("span",{className:"text-xs text-muted-foreground",children:"or"}),(0,N.jsx)("div",{className:"h-px flex-1 bg-border"})]}),d]})]})}function Fn({icon:t,color:e,text:n}){return(0,N.jsxs)("div",{className:"flex items-center gap-2.5 text-sm text-foreground/80",children:[(0,N.jsx)(t,{size:14,className:`shrink-0 ${e}`}),(0,N.jsx)("span",{children:n})]})}var Fe=require("react"),Y=require("lucide-react");var v=require("react/jsx-runtime"),Vs=[{value:"simple",label:"Single Sign (default)",description:"Single key control, simple and secure",icon:(0,v.jsx)(Y.Shield,{size:16})},{value:"multi-sig",label:"Multi-Sign (2-of-3)",description:"Requires multiple signers to authorize transactions",icon:(0,v.jsx)(Y.Users,{size:16})},{value:"social-recovery",label:"Social Recovery",description:"Set guardian accounts to help recover",icon:(0,v.jsx)(Y.KeyRound,{size:16})}],Us=[{value:"self",label:"Pay Self (ETH)",description:"Pay gas fees with ETH"},{value:"sponsor",label:"Sponsored by dApp",description:"dApp covers your gas fees"},{value:"erc20",label:"Pay with USDC/USDT",description:"Use ERC-20 tokens for gas"},{value:"custom",label:"Custom Paymaster URL",description:"Use a custom paymaster service"}],Hs=[{value:"pimlico",label:"Pimlico",description:"High-performance bundler service"},{value:"stackup",label:"Stackup",description:"Decentralized bundler network"},{value:"alchemy",label:"Alchemy",description:"Alchemy AA infrastructure"},{value:"custom",label:"Custom Bundler URL",description:"Use custom bundler endpoint"}];function Os(){return{accountType:"simple",paymasterType:"self",customPaymasterUrl:"",bundlerPreset:"pimlico",customBundlerUrl:"",guardians:[],threshold:2}}function zr({currentConfig:t,onSave:e,onBack:n}){let o=B(),r=o.Button??U,a=o.Input??to,s=o.Card??ve,i=o.Separator??no,[l,c]=(0,Fe.useState)({...Os(),...t}),[u,d]=(0,Fe.useState)(""),[p,h]=(0,Fe.useState)(!1),x=g=>C("flex cursor-pointer items-center gap-3 rounded-lg border px-4 py-3 transition-all duration-200",g?"border-primary bg-primary/5":"border-border hover:bg-accent"),m="w-full rounded-lg border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground outline-none focus:border-ring focus:ring-2 focus:ring-ring focus:ring-offset-2 transition-all duration-200",f=(0,Fe.useCallback)(()=>{e?.(l),h(!0),setTimeout(()=>h(!1),2e3)},[l,e]),S=(0,Fe.useCallback)(()=>{let g=u.trim();!g||l.guardians.includes(g)||(c(w=>({...w,guardians:[...w.guardians,g]})),d(""))},[u,l.guardians]);return(0,v.jsxs)(s,{className:"w-full rounded-xl border border-border bg-card p-5 shadow-sm",children:[(0,v.jsx)("div",{className:"flex items-center justify-between mb-5",children:(0,v.jsxs)("div",{className:"flex items-center gap-2",children:[n&&(0,v.jsxs)(r,{variant:"ghost",size:"sm",onClick:n,children:[(0,v.jsx)(Y.ArrowLeft,{size:15}),"Back"]}),(0,v.jsx)("h2",{className:"text-lg font-semibold text-foreground",children:"Smart Wallet Settings"})]})}),(0,v.jsxs)("section",{className:"mb-6",children:[(0,v.jsxs)("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,v.jsx)(Y.Shield,{size:15})," Verification Method"]}),(0,v.jsx)("div",{className:"space-y-2",children:Vs.map(g=>(0,v.jsxs)("label",{className:x(l.accountType===g.value),children:[(0,v.jsx)("input",{type:"radio",name:"accountType",value:g.value,checked:l.accountType===g.value,onChange:()=>c(w=>({...w,accountType:g.value})),className:"h-4 w-4 text-primary accent-primary"}),(0,v.jsx)("div",{className:"flex items-center gap-2 text-foreground",children:g.icon}),(0,v.jsxs)("div",{children:[(0,v.jsx)("div",{className:"text-sm font-medium text-foreground",children:g.label}),(0,v.jsx)("div",{className:"text-xs text-muted-foreground",children:g.description})]})]},g.value))})]}),l.accountType==="social-recovery"&&(0,v.jsxs)("section",{className:"mb-6 rounded-lg border border-border bg-muted/30 p-4",children:[(0,v.jsxs)("h4",{className:"mb-2 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,v.jsx)(Y.KeyRound,{size:14})," Guardian Addresses"]}),(0,v.jsx)("p",{className:"mb-3 text-xs text-muted-foreground",children:"Set at least one guardian to help recover your wallet if you lose your key"}),l.guardians.length>0&&(0,v.jsx)("div",{className:"mb-3 space-y-1.5",children:l.guardians.map(g=>(0,v.jsxs)("div",{className:"flex items-center justify-between rounded-md bg-card px-3 py-2 text-sm",children:[(0,v.jsxs)("span",{className:"font-mono text-xs text-foreground",children:[g.slice(0,8),"...",g.slice(-6)]}),(0,v.jsx)(r,{variant:"ghost",size:"icon",onClick:()=>c(w=>({...w,guardians:w.guardians.filter(A=>A!==g)})),children:(0,v.jsx)(Y.X,{size:14})})]},g))}),(0,v.jsxs)("div",{className:"flex gap-2",children:[(0,v.jsx)(a,{type:"text",placeholder:"Enter guardian address (0x...)",value:u,onChange:g=>d(g.target.value),onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),S())},className:"flex-1"}),(0,v.jsxs)(r,{size:"sm",onClick:S,disabled:!u.trim(),children:[(0,v.jsx)(Y.Plus,{size:14})," Add"]})]})]}),l.accountType==="multi-sig"&&(0,v.jsxs)("section",{className:"mb-6 rounded-lg border border-border bg-muted/30 p-4",children:[(0,v.jsxs)("h4",{className:"mb-2 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,v.jsx)(Y.Users,{size:14})," Signing Threshold"]}),(0,v.jsx)("p",{className:"mb-3 text-xs text-muted-foreground",children:"Set how many signers are needed to authorize a transaction"}),(0,v.jsx)("div",{className:"flex items-center gap-3",children:[1,2,3].map(g=>(0,v.jsxs)("label",{className:x(l.threshold===g),children:[(0,v.jsx)("input",{type:"radio",name:"threshold",value:g,checked:l.threshold===g,onChange:()=>c(w=>({...w,threshold:g})),className:"sr-only"}),g,"-of-3"]},g))})]}),(0,v.jsx)(i,{className:"my-4"}),(0,v.jsxs)("section",{className:"mb-6",children:[(0,v.jsxs)("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,v.jsx)(Y.Fuel,{size:15})," Gas Fees"]}),(0,v.jsx)("div",{className:"space-y-2",children:Us.map(g=>(0,v.jsxs)("label",{className:x(l.paymasterType===g.value),children:[(0,v.jsx)("input",{type:"radio",name:"paymasterType",value:g.value,checked:l.paymasterType===g.value,onChange:()=>c(w=>({...w,paymasterType:g.value})),className:"h-4 w-4 text-primary accent-primary"}),(0,v.jsxs)("div",{className:"flex-1",children:[(0,v.jsx)("div",{className:"text-sm font-medium text-foreground",children:g.label}),(0,v.jsx)("div",{className:"text-xs text-muted-foreground",children:g.description})]})]},g.value))}),l.paymasterType==="custom"&&(0,v.jsx)("div",{className:"mt-3",children:(0,v.jsx)("input",{type:"text",placeholder:"Custom Paymaster URL",value:l.customPaymasterUrl,onChange:g=>c(w=>({...w,customPaymasterUrl:g.target.value})),className:m})})]}),(0,v.jsx)(i,{className:"my-4"}),(0,v.jsxs)("section",{className:"mb-6",children:[(0,v.jsxs)("h3",{className:"mb-3 flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[(0,v.jsx)(Y.Wrench,{size:15})," Bundler"]}),(0,v.jsx)("div",{className:"space-y-2",children:Hs.map(g=>(0,v.jsxs)("label",{className:x(l.bundlerPreset===g.value),children:[(0,v.jsx)("input",{type:"radio",name:"bundlerPreset",value:g.value,checked:l.bundlerPreset===g.value,onChange:()=>c(w=>({...w,bundlerPreset:g.value})),className:"h-4 w-4 text-primary accent-primary"}),(0,v.jsxs)("div",{className:"flex-1",children:[(0,v.jsx)("div",{className:"text-sm font-medium text-foreground",children:g.label}),(0,v.jsx)("div",{className:"text-xs text-muted-foreground",children:g.description})]})]},g.value))}),l.bundlerPreset==="custom"&&(0,v.jsx)("div",{className:"mt-3",children:(0,v.jsx)("input",{type:"text",placeholder:"Custom Bundler URL",value:l.customBundlerUrl,onChange:g=>c(w=>({...w,customBundlerUrl:g.target.value})),className:m})})]}),(0,v.jsxs)("div",{className:"flex items-center gap-3",children:[(0,v.jsxs)(r,{className:"flex-1",onClick:f,children:[(0,v.jsx)(Y.Save,{size:15}),p?"Saved \u2713":"Save Settings"]}),n&&(0,v.jsxs)(r,{variant:"outline",onClick:n,children:[(0,v.jsx)(Y.ArrowLeft,{size:15}),"\u2190 Back to Simple Mode"]})]})]})}var Ie=require("lucide-react");var Ir=require("@naculus/connect-appkit-react"),V=require("react/jsx-runtime"),_s={ok:{icon:(0,V.jsx)(Ie.CheckCircle,{size:20}),label:"No problem found",colorClass:"text-muted-foreground",bgClass:"bg-muted",buttonVariant:"default"},warning:{icon:(0,V.jsx)(Ie.AlertTriangle,{size:20}),label:"Warning",colorClass:"text-[hsl(var(--warning,38_92%_50%))]",bgClass:"bg-[hsl(var(--warning)/0.1)]",buttonVariant:"default"},blocked:{icon:(0,V.jsx)(Ie.ShieldAlert,{size:20}),label:"Blocked",colorClass:"text-destructive",bgClass:"bg-destructive/10",buttonVariant:"destructive"}};function Lr({address:t,open:e,onClose:n,onProceed:o}){let r=B(),a=r.Button,s=r.Dialog,i=r.DialogContent,l=r.DialogHeader,c=r.DialogTitle,{validation:u}=(0,Ir.useValidateDestination)({address:t}),{level:d,warning:p}=u,h=_s[d],x=d==="blocked",m=t.length>12?`${t.slice(0,6)}...${t.slice(-4)}`:t,f=g=>C("inline-flex items-center justify-center whitespace-nowrap rounded-lg","text-sm font-medium transition-all duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","disabled:pointer-events-none disabled:opacity-50","h-10 px-4 py-2",g==="outline"&&"border border-input bg-transparent hover:bg-accent hover:text-accent-foreground",g==="destructive"&&"bg-destructive text-destructive-foreground hover:bg-destructive/90 shadow-sm",g==="default"&&"bg-primary text-primary-foreground hover:bg-primary/90 shadow-sm"),S=(0,V.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,V.jsxs)("div",{className:C("flex items-center gap-3 rounded-lg p-4",h.bgClass),children:[(0,V.jsx)("span",{className:h.colorClass,children:h.icon}),(0,V.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,V.jsx)("span",{className:C("text-sm font-semibold",h.colorClass),children:h.label}),(0,V.jsx)("span",{className:"text-xs text-muted-foreground break-all font-mono",children:m})]})]}),p&&(0,V.jsx)("p",{className:"text-sm text-muted-foreground m-0",children:p}),(0,V.jsxs)("div",{"data-dialog-actions":!0,className:"sticky bottom-0 z-10 -mx-1 flex min-h-14 justify-end gap-2 border-t border-border bg-card px-1 pb-[max(0rem,env(safe-area-inset-bottom))] pt-3",children:[a?(0,V.jsx)(a,{onClick:n,variant:"outline",className:"w-full sm:w-auto",children:"Cancel"}):(0,V.jsx)("button",{type:"button",onClick:n,className:C(f("outline"),"w-full sm:w-auto"),children:"Cancel"}),o&&(a?(0,V.jsx)(a,{onClick:o,variant:x?"destructive":"default",disabled:x,className:"w-full sm:w-auto",children:"Proceed anyway"}):(0,V.jsx)("button",{type:"button",onClick:o,disabled:x,className:C(f(x?"destructive":"default"),"w-full sm:w-auto"),children:"Proceed anyway"}))]})]});return s&&i&&l&&c?(0,V.jsx)(s,{open:e,onOpenChange:g=>{g||n()},children:(0,V.jsxs)(i,{className:"naculus-dialog-surface flex w-full max-w-lg flex-col overflow-y-auto",children:[(0,V.jsx)(l,{children:(0,V.jsx)(c,{children:"Address Warning"})}),S]})}):e?(0,V.jsxs)("div",{className:"naculus-dialog-viewport fixed inset-0 z-50 flex items-center justify-center p-4",children:[(0,V.jsx)("div",{className:"absolute inset-0 bg-black/80","aria-hidden":"true",onClick:n}),(0,V.jsxs)("div",{role:"dialog","aria-modal":"true","aria-label":"Address warning",className:"naculus-dialog-surface relative z-10 flex w-full max-w-lg flex-col overflow-y-auto rounded-xl border bg-card p-6 text-card-foreground shadow-2xl",children:[(0,V.jsxs)("div",{className:"sticky top-0 z-10 -mx-1 mb-4 flex items-center justify-between bg-card px-1 py-1",children:[(0,V.jsx)("h2",{className:"text-lg font-semibold m-0",children:"Address Warning"}),(0,V.jsx)("button",{onClick:n,type:"button",className:"rounded-md p-1 text-muted-foreground hover:text-foreground transition-colors","aria-label":"Close",children:(0,V.jsx)(Ie.X,{size:16})})]}),S]})]}):null}var kt=require("lucide-react");var Q=require("react/jsx-runtime");function Wr({wallets:t,onSelect:e,loading:n=!1,error:o=null}){let a=B().Card,s=i=>a?(0,Q.jsx)(a,{className:"p-4",children:i}):(0,Q.jsx)("div",{className:"rounded-xl border bg-card text-card-foreground shadow-sm p-4",children:i});return n?s((0,Q.jsxs)("div",{className:"flex flex-col gap-3",children:[Array.from({length:3}).map((i,l)=>(0,Q.jsxs)("div",{className:"flex items-center gap-3 p-3 rounded-lg animate-pulse",children:[(0,Q.jsx)("div",{className:"h-10 w-10 rounded-full bg-muted"}),(0,Q.jsx)("div",{className:"h-4 w-32 rounded bg-muted"})]},l)),(0,Q.jsx)("p",{className:"text-xs text-muted-foreground text-center m-0",children:"Detecting wallets..."})]})):o?s((0,Q.jsxs)("div",{className:"flex flex-col items-center gap-3 py-4",children:[(0,Q.jsx)(kt.AlertCircle,{size:24,className:"text-destructive"}),(0,Q.jsx)("p",{className:"text-sm text-destructive m-0 font-medium",children:o})]})):t.length===0?s((0,Q.jsxs)("div",{className:"flex flex-col items-center gap-3 py-6",children:[(0,Q.jsx)(kt.Wallet,{size:32,className:"text-muted-foreground"}),(0,Q.jsxs)("p",{className:"text-sm text-muted-foreground m-0 text-center",children:["No wallets detected.",(0,Q.jsx)("br",{}),"Install a browser wallet extension to get started."]})]})):(0,Q.jsx)("div",{className:"flex flex-col gap-2",children:t.map(i=>(0,Q.jsxs)("button",{type:"button",onClick:()=>e(i),className:C("flex items-center gap-3 w-full p-3 rounded-lg","border border-input bg-card hover:bg-accent hover:text-accent-foreground","transition-all duration-200 cursor-pointer","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2"),children:[i.icon?(0,Q.jsx)("img",{src:i.icon,alt:i.name,className:"h-10 w-10 rounded-full object-cover shrink-0",onError:l=>{l.target.style.display="none"}}):(0,Q.jsx)("div",{className:"h-10 w-10 rounded-full bg-muted flex items-center justify-center shrink-0",children:(0,Q.jsx)(kt.Wallet,{size:18,className:"text-muted-foreground"})}),(0,Q.jsxs)("div",{className:"flex flex-col items-start gap-0.5 text-left min-w-0",children:[(0,Q.jsx)("span",{className:"text-sm font-medium truncate w-full",children:i.name}),(0,Q.jsx)("span",{className:"text-xs text-muted-foreground truncate w-full",children:i.rdns})]})]},i.id))})}var Or=require("@naculus/connect-appkit-core"),je=require("lucide-react");var Vr=require("@naculus/connect-appkit-core"),Jt=require("lucide-react"),Ur=require("react");var Ke=require("react/jsx-runtime");function Fs(t){return t.length<=18?t:`${t.slice(0,8)}\u2026${t.slice(-8)}`}function qe({value:t}){let n=B().Button??U,[o,r]=(0,Ur.useState)(!1),a=async()=>{await navigator.clipboard?.writeText(t),r(!0)};return(0,Ke.jsxs)("span",{className:"flex min-w-0 items-center gap-1.5",children:[(0,Ke.jsx)("span",{className:"min-w-0 break-all font-mono text-xs",title:t,children:Fs(t)}),(0,Ke.jsx)(n,{variant:"ghost",size:"icon",className:"naculus-hit-target h-8 w-8 shrink-0 p-0","aria-label":o?`Copied ${t}`:`Copy ${t}`,onClick:()=>{a()},children:o?(0,Ke.jsx)(Jt.Check,{"aria-hidden":!0,size:14}):(0,Ke.jsx)(Jt.Copy,{"aria-hidden":!0,size:14})})]})}function Hr(t,e,n){if(t===null)return"Amount not reported";let o=e?n[e]:void 0;return/^\d+$/.test(String(t))?(0,Vr.formatAuthorizationAmount)(BigInt(t),o).formatted:`${t.toString()} base units`}function Xt(t,e=!1){return C("border",t?"border-emerald-700 bg-emerald-50 text-emerald-900 dark:border-emerald-500 dark:bg-emerald-950 dark:text-emerald-100":e?"border-destructive/60 bg-destructive/10 text-foreground":"border-border bg-muted text-foreground")}var R=require("react/jsx-runtime");function Ks(t){return"expiry"in t}function _r({authorization:t,assets:e={},trustedAssets:n,locale:o,now:r,requester:a,preview:s,onApprove:i,onDecline:l,busy:c=!1,className:u}){let d=Ks(t)?t:(0,Or.describeAuthorization)(t,{assets:e,trustedAssets:n,locale:o,now:r}),p=B(),h=p.Button??U,x=p.Card??ve;return(0,R.jsxs)("section",{"aria-labelledby":"authorization-consent-title",className:C("naculus-payment-surface naculus-authorization-consent mx-auto flex w-full max-w-lg flex-col gap-4 overflow-y-auto text-foreground",u),onKeyDown:m=>{m.key==="Escape"&&l()},children:[(0,R.jsxs)("header",{className:"naculus-consent-requester flex min-w-0 items-center gap-3",children:[a.icon?(0,R.jsx)("img",{className:"h-11 w-11 shrink-0 rounded-xl object-cover",src:a.icon,alt:""}):(0,R.jsx)("span",{"aria-hidden":!0,className:"grid h-11 w-11 shrink-0 place-items-center rounded-xl bg-muted text-lg font-semibold",children:a.name.slice(0,1).toUpperCase()}),(0,R.jsxs)("div",{className:"min-w-0",children:[(0,R.jsxs)("h2",{id:"authorization-consent-title",className:"truncate text-lg font-semibold",children:["Allow ",a.name," to pay?"]}),a.origin&&(0,R.jsx)("p",{className:"break-all text-xs text-muted-foreground",children:a.origin})]})]}),d.warnings.map(m=>(0,R.jsxs)("div",{role:"alert",className:"naculus-consent-summary flex gap-2 rounded-lg border border-amber-700 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-500 dark:bg-amber-950 dark:text-amber-100",children:[(0,R.jsx)(je.AlertTriangle,{"aria-hidden":!0,className:"mt-0.5 shrink-0",size:18}),(0,R.jsx)("strong",{children:m})]},m)),s&&(0,R.jsxs)("div",{className:C("naculus-consent-summary flex gap-2 rounded-lg p-3 text-sm",Xt(s.allowed,!s.allowed)),children:[s.allowed?(0,R.jsx)(je.ShieldCheck,{"aria-hidden":!0,size:18}):(0,R.jsx)(je.ShieldX,{"aria-hidden":!0,size:18}),(0,R.jsxs)("p",{children:[(0,R.jsxs)("strong",{children:[s.allowed?"Allowed":"Blocked","."]})," ",s.sentence]})]}),(0,R.jsx)("div",{className:"naculus-consent-grants flex flex-col gap-3",children:d.grants.map(m=>(0,R.jsxs)(x,{className:"min-w-0 p-4",children:[(0,R.jsx)("h3",{className:"break-all text-sm font-semibold",children:m.assetLabel}),m.assetTrust==="unverified"&&(0,R.jsxs)("div",{role:"alert",className:"mt-3 flex gap-2 rounded-lg border border-amber-700 bg-amber-50 p-3 text-sm text-amber-950 dark:border-amber-500 dark:bg-amber-950 dark:text-amber-100",children:[(0,R.jsx)(je.AlertTriangle,{"aria-hidden":!0,className:"shrink-0",size:18}),(0,R.jsx)("strong",{children:"Unverified token \u2014 not on the trusted list"})]}),(0,R.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-3",children:[(0,R.jsxs)("div",{children:[(0,R.jsx)("p",{className:"text-xs text-muted-foreground",children:"Per payment"}),(0,R.jsx)("p",{className:"break-words text-xl font-semibold tabular-nums",children:m.perPayment.formatted})]}),(0,R.jsxs)("div",{children:[(0,R.jsx)("p",{className:"text-xs text-muted-foreground",children:"Total limit"}),(0,R.jsx)("p",{className:"break-words text-xl font-semibold tabular-nums",children:m.total.formatted})]})]}),(0,R.jsxs)("dl",{className:"mt-4 grid gap-3 text-sm",children:[(0,R.jsxs)("div",{children:[(0,R.jsx)("dt",{className:"font-medium",children:"Recipients"}),(0,R.jsx)("dd",{className:"mt-1 flex flex-col gap-1",children:m.recipients.length?m.recipients.map(f=>(0,R.jsx)(qe,{value:f.full},f.full)):(0,R.jsx)("span",{className:"font-semibold text-destructive",children:"No recipient restriction is displayed"})})]}),(0,R.jsxs)("div",{children:[(0,R.jsx)("dt",{className:"font-medium",children:"Payment count"}),(0,R.jsx)("dd",{className:"text-muted-foreground",children:m.count===null?"No count limit":`Up to ${m.count}`})]}),(0,R.jsxs)("div",{children:[(0,R.jsx)("dt",{className:"font-medium",children:"Payment methods"}),(0,R.jsx)("dd",{className:"mt-1 flex flex-wrap gap-1.5",children:m.rails.map(f=>(0,R.jsx)("span",{className:"rounded-full border border-border bg-muted px-2 py-1 text-xs",children:f},f))})]})]})]},`${m.asset}:${m.recipients.map(f=>f.full).join(",")}:${m.perPayment.formatted}:${m.total.formatted}`))}),(0,R.jsxs)("div",{className:"naculus-consent-expiry rounded-lg bg-muted p-3 text-sm",children:[(0,R.jsxs)("p",{className:"font-medium",children:["Expires ",d.expiry.relative]}),(0,R.jsx)("time",{className:"text-xs text-muted-foreground",dateTime:new Date(d.expiry.timestamp*1e3).toISOString(),children:d.expiry.absolute})]}),(0,R.jsxs)("div",{"data-payment-actions":!0,className:"naculus-sticky-actions sticky bottom-0 z-10 -mx-1 grid min-h-14 grid-cols-2 gap-3 border-t border-border bg-background px-1 pb-[max(0rem,env(safe-area-inset-bottom))] pt-3",children:[(0,R.jsx)(h,{variant:"outline",onClick:l,children:"Decline"}),(0,R.jsx)(h,{disabled:c,"aria-busy":c,onClick:i,children:c?"Approving\u2026":"Approve"})]})]})}var Zt=require("@naculus/connect-appkit-core"),Rt=require("lucide-react"),Kn=require("react");var P=require("react/jsx-runtime");function Fr({entries:t,assets:e={},trustedAssets:n,onRevoke:o,revokingId:r,locale:a,className:s}){let i=Array.isArray(t)?t:t.entries,[l,c]=(0,Kn.useState)(null),[u,d]=(0,Kn.useState)(new Set),p=B(),h=p.Button??U,x=p.Card??ve,m=p.Badge??Ye;return i.length===0?(0,P.jsxs)("section",{className:C("rounded-xl border border-dashed border-border p-8 text-center",s),children:[(0,P.jsx)(Rt.Ban,{"aria-hidden":!0,className:"mx-auto mb-2 text-muted-foreground"}),(0,P.jsx)("h2",{className:"font-semibold",children:"No payment authorizations"}),(0,P.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:"Approvals you create will appear here."})]}):(0,P.jsxs)("section",{"aria-labelledby":"authorization-list-title",className:C("naculus-payment-surface flex w-full max-w-lg flex-col gap-3",s),children:[(0,P.jsx)("h2",{id:"authorization-list-title",className:"text-lg font-semibold",children:"Payment authorizations"}),i.map(f=>{let S=(0,Zt.describeAuthorization)(f,{assets:e,trustedAssets:n,locale:a}),g=r===f.keyId;return(0,P.jsxs)(x,{className:"flex min-h-full min-w-0 flex-col overflow-y-auto p-4",children:[(0,P.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[(0,P.jsxs)("div",{className:"min-w-0",children:[(0,P.jsx)("h3",{className:"break-all font-semibold",children:S.label??S.grants.map(w=>w.assetLabel).join(", ")}),(0,P.jsx)("p",{className:"text-xs text-muted-foreground",children:{"evm-session":"EVM session key","solana-session":"Solana session key","mpp-voucher":"MPP channel key"}[f.enforcer]??f.enforcer.replaceAll("-"," ")})]}),(0,P.jsx)(m,{className:C("capitalize",f.status==="active"&&"bg-primary text-primary-foreground",f.status==="pending"&&"border border-border bg-background",(f.status==="revoked"||f.status==="expired")&&"bg-muted text-muted-foreground"),children:f.status})]}),(0,P.jsx)("div",{className:"mt-3 flex flex-col gap-3",children:S.grants.map(w=>{let A=f.spent?.[w.asset],T=f.grants.find(E=>E.asset===w.asset)?.maxTotal,J=A!==void 0&&T&&T>0n?Number(A*100n/T):null;return(0,P.jsxs)("div",{className:"min-w-0 rounded-lg bg-muted p-3",children:[S.label&&(0,P.jsx)("p",{className:"break-all text-sm font-medium",children:w.assetLabel}),w.assetTrust==="unverified"&&(0,P.jsxs)("p",{role:"alert",className:"mt-2 flex gap-2 rounded-md border border-amber-700 bg-amber-50 p-2 text-sm text-amber-950 dark:border-amber-500 dark:bg-amber-950 dark:text-amber-100",children:[(0,P.jsx)(Rt.AlertTriangle,{"aria-hidden":!0,className:"shrink-0",size:16}),"Unverified token \u2014 not on the trusted list"]}),(0,P.jsx)("div",{className:"mt-1 flex flex-col gap-1",children:w.recipients.map(E=>(0,P.jsx)(qe,{value:E.full},E.full))}),A!==void 0&&(0,P.jsxs)("div",{className:"mt-3",children:[(0,P.jsxs)("div",{className:"flex justify-between gap-2 text-xs",children:[(0,P.jsxs)("span",{children:["Spent"," ",(0,Zt.formatAuthorizationAmount)(A,w.assetTrust==="unverified"?void 0:e[w.asset]).formatted]}),(0,P.jsxs)("span",{children:["Total ",w.total.formatted]})]}),(0,P.jsx)("div",{role:"progressbar","aria-label":`${w.assetLabel} spent`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Math.min(J??0,100),className:"mt-1 h-2 overflow-hidden rounded-full bg-background",children:(0,P.jsx)("span",{className:"block h-full bg-primary",style:{width:`${Math.min(J??0,100)}%`}})})]})]},w.asset)})}),(0,P.jsxs)("p",{className:"mt-3 text-xs text-muted-foreground",title:new Date(S.expiry.timestamp*1e3).toISOString(),children:[f.status==="expired"?"Expired":f.status==="revoked"?"Revoked":`Expires ${S.expiry.relative}`," ","\xB7 ",S.expiry.absolute]}),S.warnings.map(w=>(0,P.jsxs)("p",{role:"alert",className:"mt-2 flex gap-2 rounded-md border border-amber-700 bg-amber-50 p-2 text-sm text-amber-950 dark:border-amber-500 dark:bg-amber-950 dark:text-amber-100",children:[(0,P.jsx)(Rt.AlertTriangle,{"aria-hidden":!0,className:"shrink-0",size:16}),w]},w)),u.has(f.keyId)&&(0,P.jsx)("p",{role:"status",className:"mt-2 rounded-md border border-amber-700 p-2 text-sm font-medium",children:"Local access is revoked. Complete the on-chain revocation to stop this authorization on chain."}),f.status==="active"||f.status==="pending"?(0,P.jsx)("div",{"data-payment-actions":!0,className:"naculus-sticky-actions sticky bottom-0 z-10 -mx-1 mt-3 flex min-h-14 justify-end gap-2 border-t border-border bg-card px-1 pb-[max(0rem,env(safe-area-inset-bottom))] pt-3",children:l===f.keyId?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(h,{variant:"ghost",onClick:()=>c(null),children:"Cancel"}),(0,P.jsx)(h,{className:"min-w-32",disabled:g,"aria-busy":g,onClick:()=>{Promise.resolve(o(f)).then(w=>{c(null),w.onChainRevocationRequired&&d(A=>new Set(A).add(f.keyId))})},children:g?"Revoking\u2026":"Confirm revoke"})]}):(0,P.jsx)(h,{variant:"outline",onClick:()=>c(f.keyId),children:"Revoke"})}):null]},f.keyId)})]})}var Ne=require("lucide-react");var D=require("react/jsx-runtime"),Kr={unverified:["Unverified","Reported by the server, not yet checked."],pending:["Checking","Checking on chain."],verified:["Verified","Verified on chain."],mismatch:["Mismatch","The on-chain settlement does not match this payment."],failed:["Verification failed","The settlement could not be verified."],unavailable:["Verification unavailable","On-chain checking is unavailable. Retry later."]};function qr({record:t,assets:e={},explorerUrl:n,className:o}){let r=B(),a=r.Card??ve,s=r.Badge??Ye,i=t.verification.status,l=i==="verified",c=i==="mismatch"||i==="failed",u=l?Ne.CheckCircle2:i==="pending"?Ne.LoaderCircle:c?Ne.AlertCircle:Ne.ShieldQuestion,d=n?.(t);return(0,D.jsxs)(a,{"data-verification":i,className:C("naculus-payment-surface mx-auto flex h-full w-full max-w-lg min-w-0 flex-col overflow-hidden p-5",o),children:[(0,D.jsxs)("header",{className:"text-center",children:[(0,D.jsx)("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Payment receipt"}),(0,D.jsx)("h2",{className:"mt-2 break-words text-3xl font-semibold tabular-nums",children:Hr(t.amount,t.asset,e)}),(0,D.jsx)("p",{className:"mt-1 break-all text-sm text-muted-foreground",children:t.asset?e[t.asset]?.symbol??t.asset:"Asset not reported"})]}),(0,D.jsxs)("div",{"aria-live":"polite",className:C("mt-5 flex min-h-[9rem] gap-2 rounded-lg p-3",Xt(l,c)),children:[(0,D.jsx)(u,{"aria-hidden":!0,className:C("mt-0.5 shrink-0",i==="pending"&&"animate-spin"),size:18}),(0,D.jsxs)("div",{children:[(0,D.jsx)(s,{className:"mb-1",children:Kr[i][0]}),(0,D.jsx)("p",{className:"text-sm",children:Kr[i][1]}),t.verification.reason&&(0,D.jsxs)("p",{className:"mt-1 break-words text-sm font-medium",children:["Reason: ",t.verification.reason]})]})]}),(0,D.jsxs)("dl",{className:"mt-5 grid gap-4 text-sm",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("dt",{className:"text-xs text-muted-foreground",children:"Recipient"}),(0,D.jsx)("dd",{children:t.payTo?(0,D.jsx)(qe,{value:t.payTo}):"Not reported"})]}),(0,D.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,D.jsxs)("div",{children:[(0,D.jsx)("dt",{className:"text-xs text-muted-foreground",children:"Protocol"}),(0,D.jsx)("dd",{children:t.protocol==="mpp"?"MPP":t.protocol})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("dt",{className:"text-xs text-muted-foreground",children:"Time"}),(0,D.jsx)("dd",{children:"Not recorded"})]})]}),(0,D.jsxs)("div",{children:[(0,D.jsx)("dt",{className:"text-xs text-muted-foreground",children:"Settlement reference"}),(0,D.jsx)("dd",{className:"mt-1",children:t.reference?(0,D.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,D.jsx)(qe,{value:t.reference}),d&&(0,D.jsxs)("a",{className:"naculus-hit-target relative inline-flex items-center gap-1 rounded text-xs font-medium underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",href:d,target:"_blank",rel:"noreferrer",children:["View on explorer ",(0,D.jsx)(Ne.ExternalLink,{"aria-hidden":!0,size:13})]})]}):"Not reported"})]})]})]})}0&&(module.exports={AccountButton,AccountSelector,AccountSelectorView,AddressWarningDialog,AppKit,AppKitButton,AppKitChainSelector,AuthorizationConsent,AuthorizationList,ChainSelector,ConnectButton,ErrorBoundary,PasskeySetup,PasskeySetupView,PassphraseDialog,PassphraseDialogView,PaymentReceipt,QRCodeModal,RouteSelector,SeedPhraseBackup,SignInButton,SmartWalletSettings,SmartWalletToggle,ThemeProvider,WalletConnectProvider,WalletPicker,WalletSecurityPanel,WalletSecurityPanelView,Web3ComponentProvider,Web3ConnectUI,cn,useAppKit,useComponent,useComponentRegistry,useDetectionMode,useEIP6963,useIsMobile,useTheme,useThemeVariable,useWalletConnect,useWalletConnectOptional});
|
|
12
12
|
//# sourceMappingURL=index.cjs.map
|