Files
epusdt/src/www/assets/_trade_id-CN7o2QQi.js
T
line-6000 9c533a7ff8 feat(pay): switch checkout counter to SPA redirect + JSON API
- redirect `/pay/checkout-counter/:trade_id` to `/cashier/:trade_id`
- add `/pay/checkout-counter-resp/:trade_id` for checkout JSON payload
- remove embedded `static` release and keep `www` as the web bundle source
- regenerate PWA/www assets and move chain icons to `/www/images/chains`
2026-04-29 00:34:58 +08:00

1 line
34 KiB
JavaScript

import{Bc as e,C as t,Cd as n,Dd as r,S as i,T as a,_ as o,a as s,b as c,c as l,d as u,f as d,g as f,h as p,i as m,l as h,m as g,n as _,o as v,p as y,r as b,s as x,t as S,v as C,w,wd as T,x as ee,y as E}from"./messages-Bhh1Viqz.js";import{a as D,f as te}from"./auth-store-B0MXCdkM.js";import{t as ne}from"./useNavigate-BAxMzgsd.js";import{i as O,t as k}from"./button-CMgGM5Zo.js";import{a as A,i as j,n as M,r as N,t as P}from"./select-CiLcNbAG.js";import{t as F}from"./createLucideIcon-B033Mmf5.js";import{t as I}from"./check-BrSI5FnG.js";import{n as L,t as re}from"./copy-to-clipboard-BF7uZfYk.js";import{t as R}from"./loader-circle-USrlthPz.js";import{n as ie,t as ae}from"./_trade_id-Cy_8WDE7.js";import{t as oe}from"./x-ZpCeFU3T.js";import{n as z}from"./dist-bcH04SHd.js";var se=F(`badge-dollar-sign`,[[`path`,{d:`M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z`,key:`3c2336`}],[`path`,{d:`M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8`,key:`1h4pet`}],[`path`,{d:`M12 18V6`,key:`zqpxq5`}]]),ce=F(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),le=F(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),B=r(T()),ue=r(re(),1),de=5e3,fe=3e3,V=[10008,10013,404],pe=`Request failed`;function me(e){return{trade_id:e.trade_id,amount:e.amount,actual_amount:e.actual_amount,token:e.token?.toUpperCase(),currency:e.currency?.toUpperCase(),network:e.network,receive_address:e.receive_address,expiration_time:e.expiration_time,redirect_url:e.redirect_url,created_at:e.created_at,is_selected:e.is_selected}}function H(e){if(e!=null)return typeof e==`object`&&`data`in e?e.data:e}function he(e){return typeof e==`boolean`?e:typeof e==`number`?e!==0:[`1`,`true`,`yes`].includes(String(e??``).toLowerCase())}function U(e){if(e&&typeof e==`object`){if(`status_code`in e&&typeof e.status_code==`number`)return e.status_code;if(`code`in e&&typeof e.code==`number`)return e.code;if(`data`in e)return U(e.data)}}function ge(e){if(e==null||e===``)return null;if(typeof e==`number`||/^\d+$/.test(String(e))){let t=Number(e);return new Date(t<0xe8d4a51000?t*1e3:t)}let t=new Date(String(e));return Number.isNaN(t.getTime())?null:t}function W(e,t){return String(e??``).toLowerCase()===String(t??``).toLowerCase()}function _e(e){let t=Math.max(0,Math.min(1,e));return t>=.5?`#22c55e`:t>=.2?`#f97316`:`#ef4444`}function ve(e,t){return e.length===0?null:e.find(e=>W(e.network,t?.network)&&W(e.token,t?.token))||(e.find(e=>W(e.network,t?.network))??e.find(e=>W(e.token,t?.token))??e[0])}function ye(e){return e?.supports?.flatMap(e=>(e.tokens??[]).filter(t=>!!(t&&e.network)).map(t=>({network:e.network,token:t.toUpperCase()})))??[]}function be(e,t){return new Promise((n,r)=>{let i=window.setTimeout(n,e);t?.addEventListener(`abort`,()=>{window.clearTimeout(i),r(t.reason)},{once:!0})})}var xe=Object.defineProperty,G=Object.getOwnPropertySymbols,Se=Object.prototype.hasOwnProperty,Ce=Object.prototype.propertyIsEnumerable,we=(e,t,n)=>t in e?xe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,K=(e,t)=>{for(var n in t||={})Se.call(t,n)&&we(e,n,t[n]);if(G)for(var n of G(t))Ce.call(t,n)&&we(e,n,t[n]);return e},q=(e,t)=>{var n={};for(var r in e)Se.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&G)for(var r of G(e))t.indexOf(r)<0&&Ce.call(e,r)&&(n[r]=e[r]);return n},J;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(J||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(J||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(J||={});var Y=J,Te={L:Y.QrCode.Ecc.LOW,M:Y.QrCode.Ecc.MEDIUM,Q:Y.QrCode.Ecc.QUARTILE,H:Y.QrCode.Ecc.HIGH},Ee=128,De=`L`,Oe=`#FFFFFF`,ke=`#000000`,Ae=!1,je=1,Me=4,Ne=0,Pe=.1;function Fe(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function Ie(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function Le(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*Pe),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function Re(e,t){return t==null?e?Me:Ne:Math.max(Math.floor(t),0)}function ze({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=B.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...Y.QrSegment.makeSegments(t)),e),[]);return Y.QrCode.encodeSegments(r,Te[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=B.useMemo(()=>{let e=c.getModules(),t=Re(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:Le(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var Be=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Ve=B.forwardRef(function(e,t){let n=e,{value:r,size:i=Ee,level:a=De,bgColor:o=Oe,fgColor:s=ke,includeMargin:c=Ae,minVersion:l=je,boostLevel:u,marginSize:d,imageSettings:f}=n,p=q(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=q(p,[`style`]),g=f?.src,_=B.useRef(null),v=B.useRef(null),y=B.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=B.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=ze({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});B.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=Ie(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,Be?t.fill(new Path2D(Fe(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),B.useEffect(()=>{x(!1)},[g]);let ee=K({height:i,width:i},m),E=null;return g!=null&&(E=B.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),B.createElement(B.Fragment,null,B.createElement(`canvas`,K({style:ee,height:i,width:i,ref:y,role:`img`},h)),E)});Ve.displayName=`QRCodeCanvas`;var He=B.forwardRef(function(e,t){let n=e,{value:r,size:i=Ee,level:a=De,bgColor:o=Oe,fgColor:s=ke,includeMargin:c=Ae,minVersion:l=je,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=q(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=ze({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=Ie(g,v.excavation)),b=B.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=Fe(y,h);return B.createElement(`svg`,K({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&B.createElement(`title`,null,d),B.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),B.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});He.displayName=`QRCodeSVG`;var X=n(),Ue=1400,We=`https://cdn.jsdmirror.com/gh/atomiclabs/cryptocurrency-icons@1a63530/128/color/`,Ge={Ethereum:{aliases:[`evm`,`eth`,`ethereum`],bg:`hsla(0,0%,55%,0.16)`,color:`hsla(0,0%,68%,1)`,icon:`ethereum`,label:`Ethereum`},Solana:{aliases:[`sol`,`solana`],bg:`hsla(256,85%,65%,0.16)`,color:`hsla(256,85%,72%,1)`,icon:`solana`,label:`Solana`},BSC:{aliases:[`bsc`,`bnb`],bg:`hsla(46,91%,49%,0.16)`,color:`hsla(46,91%,55%,1)`,icon:`bsc`,label:`BSC`},Arbitrum:{aliases:[`arbitrum`,`arb`],bg:`hsla(202,100%,54%,0.16)`,color:`hsla(202,100%,64%,1)`,icon:`arbitrum`,label:`Arbitrum`},TRON:{aliases:[`tron`,`trx`],bg:`hsla(350,100%,47%,0.14)`,color:`hsla(350,100%,62%,1)`,icon:`tron`,label:`TRON`},Polygon:{aliases:[`polygon`,`matic`,`pol`],bg:`hsla(263,73%,56%,0.16)`,color:`hsla(263,73%,68%,1)`,icon:`polygon`,label:`Polygon`},Base:{aliases:[`base`],bg:`hsla(240,100%,61%,0.16)`,color:`hsla(240,100%,72%,1)`,icon:`base`,label:`Base`},OP:{aliases:[`op`,`optimism`],bg:`hsla(353,99%,51%,0.16)`,color:`hsla(353,99%,64%,1)`,icon:`op`,label:`OP`},HyperEVM:{aliases:[`hyperevm`,`hyperliquid`,`hype`],bg:`hsla(166,94%,79%,0.15)`,color:`hsla(166,94%,72%,1)`,icon:`hyperevm`,label:`HyperEVM`},Plasma:{aliases:[`plasma`,`xpl`],bg:`hsla(166,64%,32%,0.16)`,color:`hsla(166,64%,55%,1)`,icon:`plasma`,label:`Plasma`},Bitcoin:{aliases:[`bitcoin`,`btc`],bg:`hsla(33,93%,54%,0.16)`,color:`hsla(33,93%,60%,1)`,icon:`bitcoin`,label:`Bitcoin`},Binance:{aliases:[`binance`,`bnb_chain`],bg:`hsla(46,91%,49%,0.16)`,color:`hsla(46,91%,55%,1)`,icon:`binance`,label:`Binance`}};function Ke(e){let t=String(e??``).trim().toLowerCase();return Object.values(Ge).find(e=>e.label.toLowerCase()===t||e.aliases.includes(t))??null}function qe(e){let t=Ke(e);return t?`/images/chains/${t.icon}.png`:null}function Je(e){return Ke(e)?.label??e??`--`}function Ye(e){let t=e?.actual_amount??e?.amount,n=e?.actual_amount==null?e?.currency:e?.token;return t==null?`--`:`${t} ${n??``}`.trim()}function Xe(e){let t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60,i=e=>String(e).padStart(2,`0`);return t>0?`${i(t)}:${i(n)}:${i(r)}`:`${i(n)}:${i(r)}`}function Ze({network:e}){let t=qe(e);return(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[t?(0,X.jsx)(`img`,{alt:``,className:`size-4 rounded-full`,height:16,src:t,width:16}):null,(0,X.jsx)(`span`,{className:`truncate`,children:Je(e)})]})}function Qe({token:e}){return(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(`img`,{alt:``,className:O(`size-4 rounded-full`),height:16,src:`${We}${e.toLowerCase()}.png`,width:16}),(0,X.jsx)(`span`,{className:`truncate`,children:e})]})}function $e({className:e,onClick:t}){let[n,r]=(0,B.useState)(!1),i=(0,B.useRef)(void 0);return(0,B.useEffect)(()=>()=>{i.current!==void 0&&window.clearTimeout(i.current)},[]),(0,X.jsx)(k,{className:O(`mb-0.5 shrink-0`,e),onClick:()=>{if(i.current!==void 0&&window.clearTimeout(i.current),t()===!1){r(!1);return}r(!0),i.current=window.setTimeout(()=>{r(!1),i.current=void 0},Ue)},size:`icon-sm`,type:`button`,variant:`secondary`,children:n?(0,X.jsx)(I,{className:`text-emerald-600 dark:text-emerald-400`}):(0,X.jsx)(L,{})})}var et=2*Math.PI*20;function tt({onCopyAddress:e,onTransferred:n,order:r,remaining:i,timeColor:a,timerRatio:o,verifying:s}){let c=r?.receive_address??``;return(0,X.jsxs)(`section`,{className:`w-full pb-4`,children:[(0,X.jsxs)(`div`,{className:`mb-4 w-full overflow-hidden rounded-2xl border bg-card px-5 pt-5 pb-0 text-card-foreground shadow-md`,children:[(0,X.jsxs)(`div`,{className:`mb-3 flex items-center justify-between`,children:[(0,X.jsx)(`p`,{className:`font-semibold text-sm`,children:x()}),(0,X.jsxs)(`div`,{className:`relative size-10 shrink-0`,children:[(0,X.jsxs)(`svg`,{"aria-hidden":`true`,className:`absolute inset-0 size-10`,viewBox:`0 0 48 48`,children:[(0,X.jsx)(`circle`,{className:`text-border`,cx:`24`,cy:`24`,fill:`none`,r:`20`,stroke:`currentColor`,strokeWidth:`3`}),(0,X.jsx)(`circle`,{cx:`24`,cy:`24`,fill:`none`,r:`20`,stroke:a,strokeDasharray:et,strokeDashoffset:et*(1-o),strokeLinecap:`round`,strokeWidth:`3`,style:{transform:`rotate(-90deg)`,transformOrigin:`50% 50%`}})]}),(0,X.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center`,children:(0,X.jsx)(le,{className:`size-4 text-muted-foreground`})})]})]}),(0,X.jsx)(`p`,{className:`mb-4 text-center font-bold font-mono text-3xl leading-none`,style:{color:a},children:Xe(i)}),(0,X.jsx)(`div`,{className:`mb-4 flex justify-center`,children:(0,X.jsx)(`div`,{className:`rounded-xl border bg-white p-3.5 shadow-md`,children:c?(0,X.jsx)(He,{bgColor:`#ffffff`,fgColor:`#111111`,level:`M`,size:176,value:c}):(0,X.jsx)(`div`,{className:`flex size-44 items-center justify-center text-muted-foreground text-xs`,children:`--`})})}),(0,X.jsxs)(`div`,{className:`-mx-5 flex w-[calc(100%+2.5rem)] items-start gap-3 border-border/50 border-t px-5 py-3.5`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{className:`mb-0.5 font-semibold text-muted-foreground text-xs uppercase tracking-wider`,children:u()}),(0,X.jsx)(`p`,{className:`break-all font-medium text-card-foreground text-sm leading-relaxed`,children:r?.receive_address??`--`})]}),(0,X.jsx)($e,{className:`mt-0.5`,onClick:e})]})]}),(0,X.jsxs)(k,{className:`mb-3 h-12 w-full rounded-xl text-base`,disabled:s,onClick:n,type:`button`,children:[s?(0,X.jsx)(R,{className:`animate-spin`}):(0,X.jsx)(I,{}),s?S():_()]}),(0,X.jsxs)(`div`,{className:`flex items-center justify-center gap-1.5 py-1 text-muted-foreground`,children:[(0,X.jsx)(R,{className:`size-3.5 animate-spin`}),(0,X.jsx)(`span`,{className:`text-xs`,children:t()})]})]})}function nt({networkOptions:e,onConfirm:t,onNetworkChange:n,onTokenChange:r,selectedNetwork:a,selectedOption:o,selectedToken:s,submitting:l,tokenOptions:u}){return(0,X.jsxs)(`section`,{className:`w-full pb-4`,children:[(0,X.jsxs)(`div`,{className:`mb-4 flex gap-2`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{className:`mb-1.5 font-semibold text-muted-foreground text-xs uppercase tracking-wider`,children:f()}),(0,X.jsxs)(P,{disabled:e.length===0,onValueChange:n,value:a,children:[(0,X.jsx)(j,{className:`h-12.5 w-full rounded-xl bg-card`,children:(0,X.jsx)(A,{placeholder:(0,X.jsx)(Ze,{network:a})})}),(0,X.jsx)(M,{position:`popper`,children:e.map(e=>(0,X.jsx)(N,{value:e,children:(0,X.jsx)(Ze,{network:e})},e))})]})]}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsx)(`p`,{className:`mb-1.5 font-semibold text-muted-foreground text-xs uppercase tracking-wider`,children:c()}),(0,X.jsxs)(P,{disabled:u.length===0,onValueChange:r,value:s,children:[(0,X.jsx)(j,{className:`h-12.5 w-full rounded-xl bg-card`,children:(0,X.jsx)(A,{placeholder:(0,X.jsx)(Qe,{token:s})})}),(0,X.jsx)(M,{position:`popper`,children:u.map(e=>(0,X.jsx)(N,{value:e,children:(0,X.jsx)(Qe,{token:e})},e))})]})]})]}),(0,X.jsxs)(k,{className:`h-12 w-full rounded-xl text-base`,disabled:l||!o,onClick:t,type:`button`,children:[l?(0,X.jsx)(R,{className:`animate-spin`}):(0,X.jsx)(se,{}),i()]})]})}function Z({children:e,description:t,icon:n,title:r}){return(0,X.jsxs)(`section`,{"aria-live":`polite`,className:`flex min-h-96 w-full flex-col items-center justify-center rounded-2xl border bg-card px-6 py-10 text-center text-card-foreground shadow-md`,role:`status`,children:[(0,X.jsx)(`div`,{className:`mb-6 flex size-20 items-center justify-center rounded-full bg-muted`,children:n}),(0,X.jsx)(`p`,{className:`mb-2 font-bold text-xl`,children:r}),(0,X.jsx)(`p`,{className:`mb-6 text-muted-foreground text-sm`,children:t}),e]})}function rt(){return(0,X.jsx)(Z,{description:t(),icon:(0,X.jsx)(R,{className:`size-8 animate-spin text-muted-foreground`}),title:o()})}function it({redirecting:e}){return(0,X.jsx)(Z,{description:e?h():s(),icon:(0,X.jsx)(I,{className:`size-10 text-green-500`}),title:v(),children:e?(0,X.jsx)(R,{className:`size-6 animate-spin text-muted-foreground`}):null})}function at(){return(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsx)(Z,{description:C(),icon:(0,X.jsx)(oe,{className:`size-10 text-destructive`}),title:E()}),(0,X.jsx)(k,{className:`h-12 w-full rounded-xl`,onClick:()=>history.back(),type:`button`,variant:`outline`,children:w()})]})}function ot({onRetry:e}){return(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsx)(Z,{description:b(),icon:(0,X.jsx)(ie,{className:`size-10 text-orange-500`}),title:m()}),(0,X.jsxs)(`div`,{className:`flex gap-3`,children:[(0,X.jsx)(k,{className:`h-12 flex-1 rounded-xl`,onClick:()=>history.back(),type:`button`,variant:`outline`,children:w()}),(0,X.jsx)(k,{className:`h-12 flex-1 rounded-xl`,onClick:e,type:`button`,children:l()})]})]})}function st(){return(0,X.jsx)(Z,{description:g(),icon:(0,X.jsx)(ce,{className:`size-10 text-muted-foreground`}),title:p()})}function ct({networkOptions:e,onConfirmSelection:t,onCopyAddress:n,onNetworkChange:r,onRetry:i,onTokenChange:a,onTransferred:o,order:s,panel:c,remaining:l,selectedNetwork:u,selectedOption:d,selectedToken:f,submitting:p,timeColor:m,timerRatio:h,tokenOptions:g,verifying:_}){switch(c){case`loading`:return(0,X.jsx)(rt,{});case`select`:return(0,X.jsx)(nt,{networkOptions:e,onConfirm:t,onNetworkChange:r,onTokenChange:a,selectedNetwork:u,selectedOption:d,selectedToken:f,submitting:p,tokenOptions:g});case`payment`:return(0,X.jsx)(tt,{onCopyAddress:n,onTransferred:o,order:s,remaining:l,timeColor:m,timerRatio:h,verifying:_});case`success`:return(0,X.jsx)(it,{redirecting:!!s?.redirect_url});case`expired`:return(0,X.jsx)(at,{});case`timeout`:return(0,X.jsx)(ot,{onRetry:i});case`not-found`:return(0,X.jsx)(st,{});default:return null}}function lt({activeNetwork:e,onCopyAmount:t,order:n,tradeId:r}){let i=qe(e),o=Ke(e);return(0,X.jsxs)(`section`,{className:`mb-4 w-full rounded-2xl border bg-card px-6 pt-6 pb-5 text-card-foreground shadow-md`,children:[(0,X.jsx)(`p`,{className:`mb-1 font-medium text-muted-foreground text-sm`,children:a()}),(0,X.jsxs)(`div`,{className:`flex items-end justify-between gap-3`,children:[(0,X.jsx)(`span`,{className:`wrap-break-word min-w-0 font-bold font-nunito text-4xl leading-none`,children:Ye(n)}),(0,X.jsx)($e,{onClick:t})]}),(0,X.jsxs)(`div`,{className:`mt-2 flex items-center gap-1.5`,children:[i?(0,X.jsx)(`img`,{alt:``,className:`size-4 rounded-full`,height:16,src:i,width:16}):null,(0,X.jsx)(`span`,{className:`rounded-full px-2 py-0.5 font-semibold text-xs`,style:{background:o?.bg,color:o?.color},children:Je(e)})]}),(0,X.jsx)(`div`,{className:`mt-3 border-border/50 border-t pt-3`,children:(0,X.jsx)(`table`,{className:`w-full border-separate border-spacing-y-1 text-muted-foreground text-sm`,children:(0,X.jsxs)(`tbody`,{children:[(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`td`,{className:`w-px whitespace-nowrap pr-3`,children:y()}),(0,X.jsx)(`td`,{className:`break-all font-medium text-card-foreground`,children:n?.amount==null?`--`:`${n.amount} ${n.currency??``}`.trim()})]}),(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`td`,{className:`w-px whitespace-nowrap pr-3`,children:d()}),(0,X.jsx)(`td`,{className:`break-all font-medium text-card-foreground`,children:n?.trade_id??r})]})]})})})]})}function ut({panel:e}){let t=![`loading`,`timeout`].includes(e),n=[`payment`,`success`,`expired`].includes(e);return(0,X.jsxs)(`div`,{className:`mb-4 flex w-full items-center gap-2`,children:[(0,X.jsx)(`div`,{className:`h-1 flex-1 overflow-hidden rounded-full bg-foreground/10`,children:(0,X.jsx)(`div`,{className:O(`h-full rounded-full bg-foreground transition-all`,t?`w-full`:`w-0`)})}),(0,X.jsx)(`div`,{className:`h-1 flex-1 overflow-hidden rounded-full bg-foreground/10`,children:(0,X.jsx)(`div`,{className:O(`h-full rounded-full bg-foreground transition-all`,n?`w-full`:`w-0`)})})]})}var Q=new Set,$,dt=Date.now();function ft(e){return dt=Date.now(),Q.add(e),$===void 0&&($=window.setInterval(()=>{dt=Date.now();for(let e of Q)e()},1e3)),()=>{Q.delete(e),Q.size===0&&$!==void 0&&(window.clearInterval($),$=void 0)}}function pt(){return dt}function mt(e){return(0,B.useSyncExternalStore)(e?ft:()=>()=>void 0,pt,pt)}function ht({tradeId:t}){let n=ne(),r=D.useQuery(`get`,`/pay/checkout-counter-resp/{trade_id}`,{params:{path:{trade_id:t}}},{retry:!1}),i=(0,B.useMemo)(()=>{let e=H(r.data);return e?me(e):void 0},[r.data]),a=D.useMutation(`post`,`/pay/switch-network`),[o,s]=(0,B.useState)(),[c,l]=(0,B.useState)(),[u,d]=(0,B.useState)(null),f=c??i,p=!!(he(f?.is_selected)&&f?.receive_address),m=!!(f?.trade_id&&!p),h=D.useQuery(`get`,`/payments/gmpay/v1/supported-assets`,void 0,{enabled:m,retry:!1}),g=(0,B.useMemo)(()=>m?ye(H(h.data)):[],[h.data,m]),_=(0,B.useMemo)(()=>ve(g,f),[g,f]),v=u??_,y=v?.network??f?.network??``,b=v?.token??f?.token??``,x=(0,B.useMemo)(()=>ge(f?.expiration_time),[f?.expiration_time]),S=(0,B.useMemo)(()=>ge(f?.created_at),[f?.created_at]),C=S&&x&&S<x?Math.max(1,Math.round((x.getTime()-S.getTime())/1e3)):600,w=mt(!!(x&&f?.trade_id)),T=x?Math.max(0,Math.round((x.getTime()-w)/1e3)):0,E=`error`in r?r.error:void 0,O=`error`in h?h.error:void 0,k=(0,B.useMemo)(()=>{if(o)return o;if(r.isPending)return`loading`;if(E){let e=U(E);return V.includes(e??0)?`not-found`:`timeout`}if(!f?.trade_id)return`not-found`;if(T<=0&&x)return`expired`;if(!m)return`payment`;if(h.isPending)return`loading`;if(O){let e=U(O);return V.includes(e??0)?`not-found`:`timeout`}return p?`payment`:`select`},[x,p,m,f,E,r.isPending,T,O,h.isPending,o]),A=D.useQuery(`get`,`/pay/check-status/{trade_id}`,{params:{path:{trade_id:f?.trade_id??``}}},{enabled:k===`payment`&&!!f?.trade_id,refetchInterval:({state:e})=>k===`payment`&&e.fetchFailureCount<5?de:!1,retry:!1}),j=H(A.data)?.status,M=(0,B.useMemo)(()=>k===`payment`?j===2?`success`:j===3?`expired`:A.failureCount>=5?`timeout`:k:k,[k,j,A.failureCount]);te({queryKey:[`checkout-redirect`,f?.trade_id,f?.redirect_url],queryFn:async({signal:e})=>(await be(fe,e),window.location.href=f?.redirect_url,!0),enabled:M===`success`&&!!f?.redirect_url,retry:!1});let N=(0,B.useMemo)(()=>Array.from(new Set(g.map(e=>e.network))).filter(Boolean),[g]),P=(0,B.useMemo)(()=>Array.from(new Set(g.filter(e=>W(e.network,y)).map(e=>e.token))),[g,y]),F=C>0?Math.max(0,Math.min(1,T/C)):0,I=_e(F),L=t=>t==null||t===``?!1:(0,ue.default)(String(t))?(z.success(ee()),!0):(z.error(e()),!1);return(0,X.jsxs)(`main`,{className:`flex flex-1 flex-col justify-center`,children:[M===`not-found`?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ut,{panel:M}),(0,X.jsx)(lt,{activeNetwork:f?.network??y,onCopyAmount:()=>L(f?.actual_amount??f?.amount),order:f,tradeId:t})]}),(0,X.jsx)(ct,{networkOptions:N,onConfirmSelection:async()=>{if(v&&f?.trade_id)try{let e=H(await a.mutateAsync({body:{trade_id:f.trade_id,network:v.network.toLowerCase(),token:v.token.toLowerCase()}}));if(!e)throw Error(pe);let t=me(e);l({...f,...t,is_selected:t.is_selected??!0,network:t.network??v.network,token:t.token??v.token}),t.trade_id&&t.trade_id!==f.trade_id&&n({params:{trade_id:t.trade_id},replace:!0,to:`/cashier/$trade_id`}).catch(()=>void 0),s(void 0)}catch(e){let t=U(e);V.includes(t??0)?s(`not-found`):t===10010?s(`expired`):z.error(e instanceof Error?e.message:pe)}},onCopyAddress:()=>L(f?.receive_address),onNetworkChange:e=>{d(g.find(t=>W(t.network,e))??null)},onRetry:()=>{if(s(void 0),f?.trade_id&&f.receive_address){A.refetch();return}r.refetch(),(m||h.isError)&&h.refetch()},onTokenChange:e=>{d(g.find(t=>W(t.network,y)&&W(t.token,e))??null)},onTransferred:()=>{f?.trade_id&&A.refetch()},order:f,panel:M,remaining:T,selectedNetwork:y,selectedOption:v??void 0,selectedToken:b,submitting:a.isPending,timeColor:I,timerRatio:F,tokenOptions:P,verifying:A.isFetching})]})}function gt(){let{trade_id:e}=ae.useParams();return(0,X.jsx)(ht,{tradeId:e},e)}export{gt as component};