Contractless-Web3-Wallets/extension/dist/chrome/popup.js

9 lines
65 KiB
JavaScript
Raw Normal View History

2026-08-03 06:05:16 +00:00
import"./chunks/modulepreload-polyfill-B5Qt9EMX.js";import{c as Gt}from"./chunks/core-D2IK1U91.js";function bn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var de={},Ue,Et;function kn(){return Et||(Et=1,Ue=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Ue}var De={},ee={},bt;function se(){if(bt)return ee;bt=1;let e;const t=[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];return ee.getSymbolSize=function(o){if(!o)throw new Error('"version" cannot be null or undefined');if(o<1||o>40)throw new Error('"version" should be in range from 1 to 40');return o*4+17},ee.getSymbolTotalCodewords=function(o){return t[o]},ee.getBCHDigit=function(n){let o=0;for(;n!==0;)o++,n>>>=1;return o},ee.setToSJISFunction=function(o){if(typeof o!="function")throw new Error('"toSJISFunc" is not a valid function.');e=o},ee.isKanjiModeEnabled=function(){return typeof e<"u"},ee.toSJIS=function(o){return e(o)},ee}var qe={},kt;function dt(){return kt||(kt=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+n)}}e.isValid=function(o){return o&&typeof o.bit<"u"&&o.bit>=0&&o.bit<4},e.from=function(o,r){if(e.isValid(o))return o;try{return t(o)}catch{return r}}})(qe)),qe}var Fe,At;function An(){if(At)return Fe;At=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const n=Math.floor(t/8);return(this.buffer[n]>>>7-t%8&1)===1},put:function(t,n){for(let o=0;o<n;o++)this.putBit((t>>>n-o-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),t&&(this.buffer[n]|=128>>>this.length%8),this.length++}},Fe=e,Fe}var Ve,Nt;function Nn(){if(Nt)return Ve;Nt=1;function e(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)}return e.prototype.set=function(t,n,o,r){const i=t*this.size+n;this.data[i]=o,r&&(this.reservedBit[i]=!0)},e.prototype.get=function(t,n){return this.data[t*this.size+n]},e.prototype.xor=function(t,n,o){this.data[t*this.size+n]^=o},e.prototype.isReserved=function(t,n){return this.reservedBit[t*this.size+n]},Ve=e,Ve}var Ke={},Lt;function Ln(){return Lt||(Lt=1,(function(e){const t=se().getSymbolSize;e.getRowColCoords=function(o){if(o===1)return[];const r=Math.floor(o/7)+2,i=t(o),a=i===145?26:Math.ceil((i-13)/(2*r-2))*2,l=[i-7];for(let s=1;s<r-1;s++)l[s]=l[s-1]-a;return l.push(6),l.reverse()},e.getPositions=function(o){const r=[],i=e.getRowColCoords(o),a=i.length;for(let l=0;l<a;l++)for(let s=0;s<a;s++)l===0&&s===0||l===0&&s===a-1||l===a-1&&s===0||r.push([i[l],i[s]]);return r}})(Ke)),Ke}var je={},St;function Sn(){if(St)return je;St=1;const e=se().getSymbolSize,t=7;return je.getPositions=function(o){const r=e(o);return[[0,0],[r-t,0],[0,r-t]]},je}var ze={},Tt;function Tn(){return Tt||(Tt=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(r){return r!=null&&r!==""&&!isNaN(r)&&r>=0&&r<=7},e.from=function(r){return e.isValid(r)?parseInt(r,10):void 0},e.getPenaltyN1=function(r){const i=r.size;let a=0,l=0,s=0,d=null,u=null;for(let f=0;f<i;f++){l=s=0,d=u=null;for(let g=0;g<i;g++){let p=r.get(f,g);p===d?l++:(l>=5&&(a+=t.N1+(l-5)),d=p,l=1),p=r.get(g,f),p===u?s++:(s>=5&&(a+=t.N1+(s-5)),u=p,s=1)}l>=5&&(a+=t.N1+(l-5)),s>=5&&(a+=t.N1+(s-5))}return a},e.getPenaltyN2=function(r){const i=r.size;let a=0;for(let l=0;l<i-1;l++)for(let s=0;s<i-1;s++){const d=r.get(l,s)+r.get(l,s+1)+r.get(l+1,s)+r.get(l+1,s+1);(d===4||d===0)&&a++}
2026-08-03 05:31:44 +00:00
]))+`;O.KANJI=new RegExp(n,"g"),O.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),O.BYTE=new RegExp(o,"g"),O.NUMERIC=new RegExp(e,"g"),O.ALPHANUMERIC=new RegExp(t,"g");const r=new RegExp("^"+n+"$"),i=new RegExp("^"+e+"$"),a=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return O.testKanji=function(s){return r.test(s)},O.testNumeric=function(s){return i.test(s)},O.testAlphanumeric=function(s){return a.test(s)},O}var Mt;function ce(){return Mt||(Mt=1,(function(e){const t=Zt(),n=Xt();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(i,a){if(!i.ccBits)throw new Error("Invalid mode: "+i);if(!t.isValid(a))throw new Error("Invalid version: "+a);return a>=1&&a<10?i.ccBits[0]:a<27?i.ccBits[1]:i.ccBits[2]},e.getBestModeForData=function(i){return n.testNumeric(i)?e.NUMERIC:n.testAlphanumeric(i)?e.ALPHANUMERIC:n.testKanji(i)?e.KANJI:e.BYTE},e.toString=function(i){if(i&&i.id)return i.id;throw new Error("Invalid mode")},e.isValid=function(i){return i&&i.bit&&i.ccBits};function o(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+r)}}e.from=function(i,a){if(e.isValid(i))return i;try{return o(i)}catch{return a}}})(He)),He}var $t;function xn(){return $t||($t=1,(function(e){const t=se(),n=Qt(),o=dt(),r=ce(),i=Zt(),a=7973,l=t.getBCHDigit(a);function s(g,p,h){for(let w=1;w<=40;w++)if(p<=e.getCapacity(w,h,g))return w}function d(g,p){return r.getCharCountIndicator(g,p)+4}function u(g,p){let h=0;return g.forEach(function(w){const x=d(w.mode,p);h+=x+w.getBitsLength()}),h}function f(g,p){for(let h=1;h<=40;h++)if(u(g,h)<=e.getCapacity(h,p,r.MIXED))return h}e.from=function(p,h){return i.isValid(p)?parseInt(p,10):h},e.getCapacity=function(p,h,w){if(!i.isValid(p))throw new Error("Invalid QR Code version");typeof w>"u"&&(w=r.BYTE);const x=t.getSymbolTotalCodewords(p),C=n.getTotalCodewordsCount(p,h),B=(x-C)*8;if(w===r.MIXED)return B;const E=B-d(w,p);switch(w){case r.NUMERIC:return Math.floor(E/10*3);case r.ALPHANUMERIC:return Math.floor(E/11*2);case r.KANJI:return Math.floor(E/13);case r.BYTE:default:return Math.floor(E/8)}},e.getBestVersionForData=function(p,h){let w;const x=o.from(h,o.M);if(Array.isArray(p)){if(p.length>1)return f(p,x);if(p.length===0)return 1;w=p[0]}else w=p;return s(w.mode,w.getLength(),x)},e.getEncodedBits=function(p){if(!i.isValid(p)||p<7)throw new Error("Invalid QR Code version");let h=p<<12;for(;t.getBCHDigit(h)-l>=0;)h^=a<<t.getBCHDigit(h)-l;return p<<12|h}})(We)),We}var Ge={},Ut;function In(){if(Ut)return Ge;Ut=1;const e=se(),t=1335,n=21522,o=e.getBCHDigit(t);return Ge.getEncodedBits=function(i,a){const l=i.bit<<3|a;let s=l<<10;for(;e.getBCHDigit(s)-o>=0;)s^=t<<e.getBCHDigit(s)-o;return(l<<10|s)^n},Ge}var Qe={},Ze,Dt;function Pn(){if(Dt)return Ze;Dt=1;const e=ce();function t(n){this.mode=e.NUMERIC,this.data=n.toString()}return t.getBitsLength=function(o){return 10*Math.floor(o/3)+(o%3?o%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(o){let r,i,a;for(r=0;r+3<=this.data.length;r+=3)i=this.data.substr(r,3),a=parseInt(i,10),o.put(a,10);const l=this.data.length-r;l>0&&(i=this.data.substr(r),a=parseInt(i,10),o.put(a,l*3+1))},Ze=t,Ze}var Xe,qt;function Mn(){if(qt)return Xe;qt=1;const e=ce(),t=["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 n(o){this.mode=e.ALPHANUMERIC,this.data=o}return n.getBitsLength=function(r){return 11*Math.floor(r/2)+6*(r%2)},n.prototype.getLength=function(){return this.data.length},n.prototype.getBitsLength=function(){return n.getBitsLength(this.data.length)}
2026-08-03 06:05:16 +00:00
Make sure your charset is UTF-8`);i=(i>>>8&255)*192+(i&255),o.put(i,13)}},tt=n,tt}var nt={exports:{}},Kt;function Dn(){return Kt||(Kt=1,(function(e){var t={single_source_shortest_paths:function(n,o,r){var i={},a={};a[o]=0;var l=t.PriorityQueue.make();l.push(o,0);for(var s,d,u,f,g,p,h,w,x;!l.empty();){s=l.pop(),d=s.value,f=s.cost,g=n[d]||{};for(u in g)g.hasOwnProperty(u)&&(p=g[u],h=f+p,w=a[u],x=typeof a[u]>"u",(x||w>h)&&(a[u]=h,l.push(u,h),i[u]=d))}if(typeof r<"u"&&typeof a[r]>"u"){var C=["Could not find a path from ",o," to ",r,"."].join("");throw new Error(C)}return i},extract_shortest_path_from_predecessor_list:function(n,o){for(var r=[],i=o;i;)r.push(i),n[i],i=n[i];return r.reverse(),r},find_path:function(n,o,r){var i=t.single_source_shortest_paths(n,o,r);return t.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(n){var o=t.PriorityQueue,r={},i;n=n||{};for(i in o)o.hasOwnProperty(i)&&(r[i]=o[i]);return r.queue=[],r.sorter=n.sorter||o.default_sorter,r},default_sorter:function(n,o){return n.cost-o.cost},push:function(n,o){var r={value:n,cost:o};this.queue.push(r),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(nt)),nt.exports}var jt;function qn(){return jt||(jt=1,(function(e){const t=ce(),n=Pn(),o=Mn(),r=$n(),i=Un(),a=Xt(),l=se(),s=Dn();function d(C){return unescape(encodeURIComponent(C)).length}function u(C,B,E){const S=[];let U;for(;(U=C.exec(E))!==null;)S.push({data:U[0],index:U.index,mode:B,length:U[0].length});return S}function f(C){const B=u(a.NUMERIC,t.NUMERIC,C),E=u(a.ALPHANUMERIC,t.ALPHANUMERIC,C);let S,U;return l.isKanjiModeEnabled()?(S=u(a.BYTE,t.BYTE,C),U=u(a.KANJI,t.KANJI,C)):(S=u(a.BYTE_KANJI,t.BYTE,C),U=[]),B.concat(E,S,U).sort(function(N,A){return N.index-A.index}).map(function(N){return{data:N.data,mode:N.mode,length:N.length}})}function g(C,B){switch(B){case t.NUMERIC:return n.getBitsLength(C);case t.ALPHANUMERIC:return o.getBitsLength(C);case t.KANJI:return i.getBitsLength(C);case t.BYTE:return r.getBitsLength(C)}}function p(C){return C.reduce(function(B,E){const S=B.length-1>=0?B[B.length-1]:null;return S&&S.mode===E.mode?(B[B.length-1].data+=E.data,B):(B.push(E),B)},[])}function h(C){const B=[];for(let E=0;E<C.length;E++){const S=C[E];switch(S.mode){case t.NUMERIC:B.push([S,{data:S.data,mode:t.ALPHANUMERIC,length:S.length},{data:S.data,mode:t.BYTE,length:S.length}]);break;case t.ALPHANUMERIC:B.push([S,{data:S.data,mode:t.BYTE,length:S.length}]);break;case t.KANJI:B.push([S,{data:S.data,mode:t.BYTE,length:d(S.data)}]);break;case t.BYTE:B.push([{data:S.data,mode:t.BYTE,length:d(S.data)}])}}return B}function w(C,B){const E={},S={start:{}};let U=["start"];for(let y=0;y<C.length;y++){const N=C[y],A=[];for(let v=0;v<N.length;v++){const T=N[v],b=""+y+v;A.push(b),E[b]={node:T,lastCount:0},S[b]={};for(let L=0;L<U.length;L++){const k=U[L];E[k]&&E[k].node.mode===T.mode?(S[k][b]=g(E[k].lastCount+T.length,T.mode)-g(E[k].lastCount,T.mode),E[k].lastCount+=T.length):(E[k]&&(E[k].lastCount=T.length),S[k][b]=g(T.length,T.mode)+4+t.getCharCountIndicator(T.mode,B))}}U=A}for(let y=0;y<U.length;y++)S[U[y]].end=0;return{map:S,table:E}}function x(C,B){let E;const S=t.getBestModeForData(C);if(E=t.from(B,S),E!==t.BYTE&&E.bit<S.bit)throw new Error('"'+C+'" cannot be encoded with mode '+t.toString(E)+`.
Suggested mode is: `+t.toString(S));switch(E===t.KANJI&&!l.isKanjiModeEnabled()&&(E=t.BYTE),E){case t.NUMERIC:return new n(C);case t.ALPHANUMERIC:return new o(C);case t.KANJI:return new i(C);case t.BYTE:return new r(C)}}e.fromArray=function(B){return B.reduce(function(E,S){return typeof S=="string"?E.push(x(S,null)):S.data&&E.push(x(S.data,S.mode)),E},[])},e.fromString=function(B,E){const S=f(B,l.isKanjiModeEnabled()),U=h(S),y=w(U,E),N=s.find_path(y.map,"start","end"),A=[];for(let v=1;v<N.length-1;v++)A.push(y.table[N[v]].node);return e.fromArray(p(A))},e.rawSplit=function(B){return e.fromArray(f(B,l.isKanjiModeEnabled()))}})(Qe)),Qe}var zt;function Fn(){if(zt)return De;zt=1;const e=se(),t=dt(),n=An(),o=Nn(),r=Ln(),i=Sn(),a=Tn(),l=Qt(),s=Rn(),d=xn(),u=In(),f=ce(),g=qn();function p(y,N){const A=y.size,v=i.getPositions(N);for(let T=0;T<v.length;T++){const b=v[T][0],L=v[T][1];for(let k=-1;k<=7;k++)if(!(b+k<=-1||A<=b+k))for(let _=-1;_<=7;_++)L+_<=-1||A<=L+_||(k>=0&&k<=6&&(_===0||_===6)||_>=0&&_<=6&&(k===0||k===6)||k>=2&&k<=4&&_>=2&&_<=4?y.set(b+k,L+_,!0,!0):y.set(b+k,L+_,!1,!0))}}function h(y){const N=y.size;for(let A=8;A<N-8;A++){const v=A%2===0;y.set(A,6,v,!0),y.set(6,A,v,!0)}}function w(y,N){const A=r.getPositions(N);for(let v=0;v<A.length;v++){const T=A[v][0],b=A[v][1];for(let L=-2;L<=2;L++)for(let k=-2;k<=2;k++)L===-2||L===2||k===-2||k===2||L===0&&k===0?y.set(T+L,b+k,!0,!0):y.set(T+L,b+k,!1,!0)}}function x(y,N){const A=y.size,v=d.getEncodedBits(N);let T,b,L;for(let k=0;k<18;k++)T=Math.floor(k/3),b=k%3+A-8-3,L=(v>>k&1)===1,y.set(T,b,L,!0),y.set(b,T,L,!0)}function C(y,N,A){const v=y.size,T=u.getEncodedBits(N,A);let b,L;for(b=0;b<15;b++)L=(T>>b&1)===1,b<6?y.set(b,8,L,!0):b<8?y.set(b+1,8,L,!0):y.set(v-15+b,8,L,!0),b<8?y.set(8,v-b-1,L,!0):b<9?y.set(8,15-b-1+1,L,!0):y.set(8,15-b-1,L,!0);y.set(v-8,8,1,!0)}function B(y,N){const A=y.size;let v=-1,T=A-1,b=7,L=0;for(let k=A-1;k>0;k-=2)for(k===6&&k--;;){for(let _=0;_<2;_++)if(!y.isReserved(T,k-_)){let X=!1;L<N.length&&(X=(N[L]>>>b&1)===1),y.set(T,k-_,X),b--,b===-1&&(L++,b=7)}if(T+=v,T<0||A<=T){T-=v,v=-v;break}}}function E(y,N,A){const v=new n;A.forEach(function(_){v.put(_.mode.bit,4),v.put(_.getLength(),f.getCharCountIndicator(_.mode,y)),_.write(v)});const T=e.getSymbolTotalCodewords(y),b=l.getTotalCodewordsCount(y,N),L=(T-b)*8;for(v.getLengthInBits()+4<=L&&v.put(0,4);v.getLengthInBits()%8!==0;)v.putBit(0);const k=(L-v.getLengthInBits())/8;for(let _=0;_<k;_++)v.put(_%2?17:236,8);return S(v,y,N)}function S(y,N,A){const v=e.getSymbolTotalCodewords(N),T=l.getTotalCodewordsCount(N,A),b=v-T,L=l.getBlocksCount(N,A),k=v%L,_=L-k,X=Math.floor(v/L),me=Math.floor(b/L),yn=me+1,vt=X-me,Cn=new s(vt);let Ie=0;const Ae=new Array(L),yt=new Array(L);let Pe=0;const En=new Uint8Array(y.buffer);for(let le=0;le<L;le++){const $e=le<_?me:yn;Ae[le]=En.slice(Ie,Ie+$e),yt[le]=Cn.encode(Ae[le]),Ie+=$e,Pe=Math.max(Pe,$e)}const Me=new Uint8Array(v);let Ct=0,J,W;for(J=0;J<Pe;J++)for(W=0;W<L;W++)J<Ae[W].length&&(Me[Ct++]=Ae[W][J]);for(J=0;J<vt;J++)for(W=0;W<L;W++)Me[Ct++]=yt[W][J];return Me}function U(y,N,A,v){let T;if(Array.isArray(y))T=g.fromArray(y);else if(typeof y=="string"){let X=N;if(!X){const me=g.rawSplit(y);X=d.getBestVersionForData(me,A)}T=g.fromString(y,X||40)}else throw new Error("Invalid data");const b=d.getBestVersionForData(T,A);if(!b)throw new Error("The amount of data is too big to be stored in a QR Code");if(!N)N=b;else if(N<b)throw new Error(`
The chosen QR Code version cannot contain this amount of data.
Minimum version required to store current data is: `+b+`.
2026-08-03 06:05:16 +00:00
`);const L=E(N,A,T),k=e.getSymbolSize(N),_=new o(k);return p(_,N),h(_),w(_,N),C(_,A,0),N>=7&&x(_,N),B(_,L),isNaN(v)&&(v=a.getBestMask(_,C.bind(null,_,A))),a.applyMask(v,_),C(_,A,v),{modules:_,version:N,errorCorrectionLevel:A,maskPattern:v,segments:T}}return De.create=function(N,A){if(typeof N>"u"||N==="")throw new Error("No input text");let v=t.M,T,b;return typeof A<"u"&&(v=t.from(A.errorCorrectionLevel,t.M),T=d.from(A.version),b=a.from(A.maskPattern),A.toSJISFunc&&e.setToSJISFunction(A.toSJISFunc)),U(N,T,v,b)},De}var rt={},ot={},Ot;function en(){return Ot||(Ot=1,(function(e){function t(n){if(typeof n=="number"&&(n=n.toString()),typeof n!="string")throw new Error("Color should be defined as hex string");let o=n.slice().replace("#","").split("");if(o.length<3||o.length===5||o.length>8)throw new Error("Invalid hex color: "+n);(o.length===3||o.length===4)&&(o=Array.prototype.concat.apply([],o.map(function(i){return[i,i]}))),o.length===6&&o.push("F","F");const r=parseInt(o.join(""),16);return{r:r>>24&255,g:r>>16&255,b:r>>8&255,a:r&255,hex:"#"+o.slice(0,6).join("")}}e.getOptions=function(o){o||(o={}),o.color||(o.color={});const r=typeof o.margin>"u"||o.margin===null||o.margin<0?4:o.margin,i=o.width&&o.width>=21?o.width:void 0,a=o.scale||4;return{width:i,scale:i?4:a,margin:r,color:{dark:t(o.color.dark||"#000000ff"),light:t(o.color.light||"#ffffffff")},type:o.type,rendererOpts:o.rendererOpts||{}}},e.getScale=function(o,r){return r.width&&r.width>=o+r.margin*2?r.width/(o+r.margin*2):r.scale},e.getImageWidth=function(o,r){const i=e.getScale(o,r);return Math.floor((o+r.margin*2)*i)},e.qrToImageData=function(o,r,i){const a=r.modules.size,l=r.modules.data,s=e.getScale(a,i),d=Math.floor((a+i.margin*2)*s),u=i.margin*s,f=[i.color.light,i.color.dark];for(let g=0;g<d;g++)for(let p=0;p<d;p++){let h=(g*d+p)*4,w=i.color.light;if(g>=u&&p>=u&&g<d-u&&p<d-u){const x=Math.floor((g-u)/s),C=Math.floor((p-u)/s);w=f[l[x*a+C]?1:0]}o[h++]=w.r,o[h++]=w.g,o[h++]=w.b,o[h]=w.a}}})(ot)),ot}var Jt;function Vn(){return Jt||(Jt=1,(function(e){const t=en();function n(r,i,a){r.clearRect(0,0,i.width,i.height),i.style||(i.style={}),i.height=a,i.width=a,i.style.height=a+"px",i.style.width=a+"px"}function o(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(i,a,l){let s=l,d=a;typeof s>"u"&&(!a||!a.getContext)&&(s=a,a=void 0),a||(d=o()),s=t.getOptions(s);const u=t.getImageWidth(i.modules.size,s),f=d.getContext("2d"),g=f.createImageData(u,u);return t.qrToImageData(g.data,i,s),n(f,d,u),f.putImageData(g,0,0),d},e.renderToDataURL=function(i,a,l){let s=l;typeof s>"u"&&(!a||!a.getContext)&&(s=a,a=void 0),s||(s={});const d=e.render(i,a,s),u=s.type||"image/png",f=s.rendererOpts||{};return d.toDataURL(u,f.quality)}})(rt)),rt}var it={},Wt;function Kn(){if(Wt)return it;Wt=1;const e=en();function t(r,i){const a=r.a/255,l=i+'="'+r.hex+'"';return a<1?l+" "+i+'-opacity="'+a.toFixed(2).slice(1)+'"':l}function n(r,i,a){let l=r+i;return typeof a<"u"&&(l+=" "+a),l}function o(r,i,a){let l="",s=0,d=!1,u=0;for(let f=0;f<r.length;f++){const g=Math.floor(f%i),p=Math.floor(f/i);!g&&!d&&(d=!0),r[f]?(u++,f>0&&g>0&&r[f-1]||(l+=d?n("M",g+a,.5+p+a):n("m",s,0),s=0,d=!1),g+1<i&&r[f+1]||(l+=n("h",u),u=0)):s++}return l}return it.render=function(i,a,l){const s=e.getOptions(a),d=i.modules.size,u=i.modules.data,f=d+s.margin*2,g=s.color.light.a?"<path "+t(s.color.light,"fill")+' d="M0 0h'+f+"v"+f+'H0z"/>':"",p="<path "+t(s.color.dark,"stroke")+' d="'+o(u,d,s.margin)+'"/>',h='viewBox="0 0 '+f+" "+f+'"',x='<svg xmlns="http://www.w3.org/2000/svg" '+(s.width?'width="'+s.width+'" height="'+s.width+'" ':"")+h+' shape-rendering="crispEdges">'+g+p+`</svg>
`;return typeof l=="function"&&l(null,x),x},it}var Ht;function jn(){if(Ht)return de;Ht=1;const e=kn(),t=Fn(),n=Vn(),o=Kn();function r(i,a,l,s,d){const u=[].slice.call(arguments,1),f=u.length,g=typeof u[f-1]=="function";if(!g&&!e())throw new Error("Callback required as last argument");if(g){if(f<2)throw new Error("Too few arguments provided");f===2?(d=l,l=a,a=s=void 0):f===3&&(a.getContext&&typeof d>"u"?(d=s,s=void 0):(d=s,s=l,l=a,a=void 0))}else{if(f<1)throw new Error("Too few arguments provided");return f===1?(l=a,a=s=void 0):f===2&&!a.getContext&&(s=l,l=a,a=void 0),new Promise(function(p,h){try{const w=t.create(l,s);p(i(w,a,s))}catch(w){h(w)}})}try{const p=t.create(l,s);d(null,i(p,a,s))}catch(p){d(p)}}return de.create=t.create,de.toCanvas=r.bind(null,n.render),de.toDataURL=r.bind(null,n.renderToDataURL),de.toString=r.bind(null,function(i,a,l){return o.render(i,l)}),de}var zn=jn();const On=bn(zn),c=e=>document.getElementById(e),Jn=Array.from(document.querySelectorAll(".screen")),M=c("notice"),tn=navigator.userAgent.includes("Firefox");let Te="",fe="",ge="",ie="",m,ut,_e="held",K=1,ae=0;const we=8;let R,H=[],Z,P,Be,nn="activity",G,ve="",oe="";const he=20,Wn=15e3;let at=!1;const Hn={1:"Mining Reward",2:"Transfer",3:"Token Creation",4:"NFT/RWA Creation",5:"Marketing",6:"Swap",7:"Loan",8:"Loan Payment",9:"Collateral Claim",10:"Asset Burn",11:"Token Issuance",12:"Vanity Address",100:"Storage Key",101:"Data Storage Bool",102:"Data Storage U8",103:"Data Storage U16",104:"Data Storage U32",105:"Data Storage U64",106:"Data Storage U128",107:"Data Storage String",108:"Data Storage I8",109:"Data Storage I16",110:"Data Storage I32",111:"Data Storage I64",112:"Data Storage I128",113:"Delete Stored Data",200:"Proposal",201:"Proposal Vote",202:"Activation Vote"};async function $(e,t={}){const n=await chrome.runtime.sendMessage({type:e,...t});if(!(n!=null&&n.ok))throw new Error((n==null?void 0:n.error)??"Wallet request failed.");return n.result}function I(e,t=!0){Jn.forEach(n=>{n.hidden=n.id!==e}),t&&(M.textContent="")}function V(e){m=e;const t=e.networkName,n=e.networkSymbol;document.querySelectorAll("[data-network-name]").forEach(o=>{o.textContent=t}),document.querySelectorAll("[data-network-symbol]").forEach(o=>{o.textContent=n}),c("base-asset-name").textContent=`Contractless ${t}`,c("wallet-address").textContent=e.address??"",c("wallet-address-short").textContent=e.address?`${e.address.slice(0,6)}...${e.address.slice(-6)}`:"Account",c("settings-testnet-api-url").value=e.testnetApiUrl,c("settings-mainnet-api-url").value=e.mainnetApiUrl,document.querySelectorAll("[data-select-network]").forEach(o=>{const r=o.dataset.selectNetwork===e.selectedNetwork;o.classList.toggle("active",r),o.setAttribute("aria-pressed",String(r))}),c("settings-lock-timeout").value=String(e.autoLockMinutes),nr(e),e.exists?e.unlocked?st().then(o=>{o||(I("dashboard-screen"),be())}):I("locked-screen"):I("create-screen")}function Yn(e,t){return e==="contractless_connect"?"Connect application":e==="contractless_signMessage"?"Sign text message":e==="contractless_sendTransaction"||e==="contractless_signDualTransaction"?`Sign ${String(t.transaction_type??"transaction")}`:"Review request"}function j(e,t,n){const o=document.createElement("dt");o.textContent=t.replaceAll("_"," ");const r=document.createElement("dd");r.textContent=typeof n=="object"?JSON.stringify(n,null,2):String(n),e.append(o,r)}function te(e,t,n,o){const r=re(e[t]),i=String(e[n]??"").trim().toUpperCase(),a=Number(e[o]??0);return`${r} ${i}${a>0?` #${a}`:""}`}function Yt(e,t,n){const o=n===1?2:1,r=(m==null?void 0:m.networkSymbol)??"CLTC";j(e,"Your miner tip",te(t,`tip${n}`,`ticker${n}`,`nft_series${n}`)),j(e,"Your transaction fee",`${re(t[`txfee${n}`])} ${r}`),j(e,"Other party miner tip",te(t,`tip${o}`,`ticker${o}`,`nft_series${o}`)),j(e,"Other party transaction fee",`${re(t[`txfee${o}`])} ${r}`)}function Gn(e,t){var a;const n=((a=m==null?void 0:m.address)==null?void 0:a.trim().toLowerCase())??"",o=String(t.sender1??"").trim().toLowerCase(),r=String(t.sender2??"").trim().toLowerCase(),i=n===o?1:n===r?2:0