herald-exchange-offramp-widget 1.0.1 → 1.0.3
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/Readme.md +10 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/components/SellAdminCryptoAccount.tsx +7 -5
package/Readme.md
CHANGED
@@ -40,10 +40,16 @@ Initialize the widget:
|
|
40
40
|
|
41
41
|
---
|
42
42
|
|
43
|
-
> **Note:**
|
44
|
-
>
|
45
|
-
> In
|
46
|
-
>
|
43
|
+
> **Note:**
|
44
|
+
>
|
45
|
+
> - In development mode, the widget operates on **testnet** and runs in a sandbox environment.
|
46
|
+
> - Transactions are simulated based on the fromAmount value:
|
47
|
+
> - 100 → Success
|
48
|
+
> - 200 → Failure
|
49
|
+
> - Any other value → Initiated
|
50
|
+
> - In development mode, when you'll be manually entering a transaction hash, ensure the hash is valid, and that the amount and currency match the transaction. If they don’t, the simulation will fail.
|
51
|
+
> - In production mode, the widget uses **mainnet** to process real transactions.
|
52
|
+
> - ⚠️ Ensure your application is deployed in a **production environment** when going live to enable accurate transaction tracking and wallet interactions.
|
47
53
|
|
48
54
|
## 🔧 Props
|
49
55
|
|
package/dist/index.js
CHANGED
@@ -20,5 +20,5 @@
|
|
20
20
|
* @license qrcode.react
|
21
21
|
* Copyright (c) Paul O'Shannessy
|
22
22
|
* SPDX-License-Identifier: ISC
|
23
|
-
*/function xo(e,t=0){const n=[];return e.forEach((function(e,i){let o=null;e.forEach((function(s,r){if(!s&&null!==o)return n.push(`M${o+t} ${i+t}h${r-o}v1H${o+t}z`),void(o=null);if(r!==e.length-1)s&&null===o&&(o=r);else{if(!s)return;null===o?n.push(`M${r+t},${i+t} h1v1H${r+t}z`):n.push(`M${o+t},${i+t} h${r+1-o}v1H${o+t}z`)}}))})),n.join("")}function _o(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))))}function Go({value:t,level:n,minVersion:i,includeMargin:o,marginSize:s,imageSettings:r,size:a,boostLevel:l}){let c=e.useMemo((()=>{const e=(Array.isArray(t)?t:[t]).reduce(((e,t)=>(e.push(...mo.QrSegment.makeSegments(t)),e)),[]);return mo.QrCode.encodeSegments(e,bo[n],i,void 0,void 0,l)}),[t,n,i,l]);const{cells:d,margin:u,numCells:p,calculatedImageSettings:m}=e.useMemo((()=>{let e=c.getModules();const t=function(e,t){return null!=t?Math.max(Math.floor(t),0):e?4:0}(o,s),n=e.length+2*t,i=function(e,t,n,i){if(null==i)return null;const o=e.length+2*n,s=Math.floor(.1*t),r=o/t,a=(i.width||s)*r,l=(i.height||s)*r,c=null==i.x?e.length/2-a/2:i.x*r,d=null==i.y?e.length/2-l/2:i.y*r,u=null==i.opacity?1:i.opacity;let p=null;if(i.excavate){let e=Math.floor(c),t=Math.floor(d);p={x:e,y:t,w:Math.ceil(a+c-e),h:Math.ceil(l+d-t)}}return{x:c,y:d,h:l,w:a,excavation:p,opacity:u,crossOrigin:i.crossOrigin}}(e,a,t,r);return{cells:e,margin:t,numCells:n,calculatedImageSettings:i}}),[c,a,r,o,s]);return{qrcode:c,margin:u,cells:d,numCells:p,calculatedImageSettings:m}}var Co=function(){try{(new Path2D).addPath(new Path2D)}catch(e){return!1}return!0}(),Bo=e.forwardRef((function(t,n){const i=t,{value:o,size:s=go,level:r=fo,bgColor:a=ho,fgColor:l=Io,includeMargin:c=vo,minVersion:d=yo,boostLevel:u,marginSize:p,imageSettings:m}=i,b=po(i,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:g}=b,f=po(b,["style"]),h=null==m?void 0:m.src,I=e.useRef(null),v=e.useRef(null),y=e.useCallback((e=>{I.current=e,"function"==typeof n?n(e):n&&(n.current=e)}),[n]),[x,_]=e.useState(!1),{margin:G,cells:C,numCells:B,calculatedImageSettings:w}=Go({value:o,level:r,minVersion:d,boostLevel:u,includeMargin:c,marginSize:p,imageSettings:m,size:s});e.useEffect((()=>{if(null!=I.current){const e=I.current,t=e.getContext("2d");if(!t)return;let n=C;const i=v.current,o=null!=w&&null!==i&&i.complete&&0!==i.naturalHeight&&0!==i.naturalWidth;o&&null!=w.excavation&&(n=_o(C,w.excavation));const r=window.devicePixelRatio||1;e.height=e.width=s*r;const c=s/B*r;t.scale(c,c),t.fillStyle=a,t.fillRect(0,0,B,B),t.fillStyle=l,Co?t.fill(new Path2D(xo(n,G))):C.forEach((function(e,n){e.forEach((function(e,i){e&&t.fillRect(i+G,n+G,1,1)}))})),w&&(t.globalAlpha=w.opacity),o&&t.drawImage(i,w.x+G,w.y+G,w.w,w.h)}})),e.useEffect((()=>{_(!1)}),[h]);const F=uo({height:s,width:s},g);let Z=null;return null!=h&&(Z=e.createElement("img",{src:h,key:h,style:{display:"none"},onLoad:()=>{_(!0)},ref:v,crossOrigin:null==w?void 0:w.crossOrigin})),e.createElement(e.Fragment,null,e.createElement("canvas",uo({style:F,height:s,width:s,ref:y,role:"img"},f)),Z)}));Bo.displayName="QRCodeCanvas";var wo,Fo,Zo,Qo=e.forwardRef((function(t,n){const i=t,{value:o,size:s=go,level:r=fo,bgColor:a=ho,fgColor:l=Io,includeMargin:c=vo,minVersion:d=yo,boostLevel:u,title:p,marginSize:m,imageSettings:b}=i,g=po(i,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:f,cells:h,numCells:I,calculatedImageSettings:v}=Go({value:o,level:r,minVersion:d,boostLevel:u,includeMargin:c,marginSize:m,imageSettings:b,size:s});let y=h,x=null;null!=b&&null!=v&&(null!=v.excavation&&(y=_o(h,v.excavation)),x=e.createElement("image",{href:b.src,height:v.h,width:v.w,x:v.x+f,y:v.y+f,preserveAspectRatio:"none",opacity:v.opacity,crossOrigin:v.crossOrigin}));const _=xo(y,f);return e.createElement("svg",uo({height:s,width:s,viewBox:`0 0 ${I} ${I}`,ref:n,role:"img"},g),!!p&&e.createElement("title",null,p),e.createElement("path",{fill:a,d:`M0,0 h${I}v${I}H0z`,shapeRendering:"crispEdges"}),e.createElement("path",{fill:l,d:_,shapeRendering:"crispEdges"}),x)}));function Ro(e){var t,n,i,o,s,r=e.mode,a=e.token;return"development"===r?(i={BNB:97,BUSD:97,ETH:11155111,USDT:11155111,BITCOIN:10001,AVAX:43113,MATIC:84432,SOL:102,XRP:2,POLYGON_AMOY:84432,NILE:3,TRX:1},(t={})[(s={ETHEREUM:11155111,MATIC:84432,BINANCE:97,BITCOIN:10001,AVAX:43113,SOLANA:102,RIPPLE:2,POLYGON_AMOY:84432,NILE:3,TRX:1}).ETHEREUM]="https://api-sepolia.etherscan.io",t[s.MATIC]="https://api-amoy.polygonscan.com",t[s.BINANCE]="https://api-testnet.bscscan.com",t[s.SOLANA]="https://api.devnet.solana.com",t[s.POLYGON_AMOY]="https://api-amoy.polygonscan.com",t[s.NILE]="https://nile.trongrid.io",t[s.TRX]="https://api.shasta.trongrid.io",o=t):(i={BNB:56,ETH:1,BITCOIN:10001,AVAX:43113,MATIC:137,SOL:101,TRX:2},(n={})[(s={ETHEREUM:1,POLYGON:137,BINANCE:56,BITCOIN:10001,AVAX:43113,SOLANA:101,TRX:2}).ETHEREUM]="https://api.etherscan.io",n[s.MATIC]="https://api.polygonscan.com",n[s.BINANCE]="https://api.bscscan.com",n[s.SOLANA]="https://api.mainnet-beta.solana.com",n[s.POLYGON_AMOY]="https://api.polygonscan.com",n[s.TRX]="https://api.trongrid.io",o=n),o[i[a]]}Qo.displayName="QRCodeSVG","production"!=process.env.NODE_ENV?((wo={})[(Zo={ETHEREUM:11155111,MATIC:84432,BINANCE:97,BITCOIN:10001,AVAX:43113,SOLANA:102,RIPPLE:2,POLYGON_AMOY:84432,NILE:3,TRX:1}).ETHEREUM]="https://api-sepolia.etherscan.io",wo[Zo.MATIC]="https://api-amoy.polygonscan.com",wo[Zo.BINANCE]="https://api-testnet.bscscan.com",wo[Zo.SOLANA]="https://api.devnet.solana.com",wo[Zo.POLYGON_AMOY]="https://api-amoy.polygonscan.com",wo[Zo.NILE]="https://nile.trongrid.io",wo[Zo.TRX]="https://api.shasta.trongrid.io"):((Fo={})[(Zo={ETHEREUM:1,POLYGON:137,BINANCE:56,BITCOIN:10001,AVAX:43113,SOLANA:101,TRX:1}).ETHEREUM]="https://api.etherscan.io",Fo[Zo.MATIC]="https://api.polygonscan.com",Fo[Zo.BINANCE]="https://api.bscscan.com",Fo[Zo.SOLANA]="https://api.mainnet-beta.solana.com",Fo[Zo.POLYGON_AMOY]="https://api.polygonscan.com",Fo[Zo.TRX]="https://api.trongrid.io");var Ao=function(t){var n,i,o=t.tokenSellData,s=t.setTokenSellData,r=t.apiKey,a=t.setStep,l=t.clientReferenceID,c=t.mode,d=Ji().addToast,f=e.useState(!1),h=f[0],I=f[1],v=e.useState(!0),y=v[0],x=v[1],_=e.useState(!1),G=_[0];_[1];var C=e.useState(""),B=C[0],w=C[1],F=e.useState(!0),Z=F[0],Q=F[1],R=e.useState(!0),A=R[0],X=R[1],k=e.useState(!1),N=k[0],W=k[1],L=e.useState(null),D=L[0],V=L[1],U=e.useState(""),E=U[0],Y=U[1],S=e.useState(!1),O=S[0],M=S[1],H=e.useState(null),T=H[0],J=H[1],j=e.useRef(null),z=e.useRef(null),P=e.useState(o.network_type||""),K=P[0];P[1],e.useEffect((function(){window.scrollTo(0,0),ee()}),[]);var q=function(){te(m(m({},o),{transaction_hash:E}))};e.useEffect((function(){if(!y&&D){var e=D,t=["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto;$(e,t,o.selectedCrypto)}x(!1)}),[D,o]);var $=function(e,t,n){return b(void 0,void 0,void 0,(function(){var i,s,r;return g(this,(function(a){return i="TRX"===t?"tron":"SOL"===t?"solana":"ethereum",["TRX","SOL"].includes(t)||["USDC","USDT"].includes(n),s=o.from_amount.toString(),r="".concat(i,":").concat(e,"?amount=").concat(s,"&label=").concat(encodeURIComponent("HeraldExchangeSell")),w(r),[2]}))}))},ee=function(){return b(void 0,void 0,void 0,(function(){var e;return g(this,(function(t){return e=$i(c),W(!0),ji({url:"".concat(e,"/api/offramp/wallet_address"),headers:{"Content-Type":"application/json","X-API-KEY":r,"User-Id":l},onSuccess:function(e){var t,n,i;if(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.wallet_address){var s=(["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto).toLowerCase(),r=["eth","bnb","matic"].includes(s)?null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.wallet_address.evm:["evm","trx","sol"].includes(s)?null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.wallet_address[s]:"";V(r),W(!1)}},onError:function(){d("Error fetching exchange rate","error"),W(!1)}}),[2]}))}))},te=function(e){return b(void 0,void 0,void 0,(function(){var t,n,i;return g(this,(function(u){return M(!0),t=$i(c),(n=new FormData).append("from",o.selectedCrypto),n.append("to",o.selectedFiat),["USDT","USDC"].includes(o.selectedCrypto)&&n.append("network_type",o.network_type),n.append("value",o.from_amount),n.append("initial_exchange_rate",null===(i=o.exchange_rate)||void 0===i?void 0:i.toString()),n.append("transaction_hash",e.transaction_hash),n.append("bank_account",o.selectedBeneficiary),ji({url:"".concat(t,"/api/offramp/transactions"),headers:{"X-API-KEY":r,"User-Id":l},method:"POST",body:n,onSuccess:function(e){(null==e?void 0:e.success)?(J({data:null==e?void 0:e.data}),I(!0),s(m(m({},o),{response:null==e?void 0:e.data})),M(!1),d("".concat(null==e?void 0:e.message),"success"),a(4)):(d("".concat(null==e?void 0:e.message),"error"),I(!1),M(!1))},onError:function(e){d(" ".concat(e),"error"),I(!1),M(!1)}}),[2]}))}))};e.useEffect((function(){if(!y&&D&&Z){var e=D,t=["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto,n=o.selectedCrypto,i=o.from_amount;if(e){var s=Date.now();j.current=setInterval((function(){["USDT","USDC"].includes(n)&&K?oe({currency:n,token:K,walletAddress:e,startTimestamp:s,expected_amount:i}):ne(t,e,s,i)}),1e4)}}return x(!1),function(){j.current&&clearInterval(j.current)}}),[D,o,Z]);var ne=function(e,t,n,i){return b(void 0,void 0,void 0,(function(){var o,s,r;return g(this,(function(a){switch(a.label){case 0:if(o="",s=Ro({mode:c,token:e}),"ETH"===e)o="".concat(s,"/api?module=account&action=txlist&address=").concat(t,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat("B34RQKNPZUV8IM6866DQ58WCS2Q6SWAP8V");else if("BNB"===e)o="".concat(s,"/api?module=account&action=txlist&address=").concat(t,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat("876A7KYGBE2TVBBNY33I4GZPXE1Q4QH3QA");else if("MATIC"===e||"POLYGON"===e||"POLYGON_AMOY"===e)o="".concat(s,"/api?module=account&action=txlist&address=").concat(t,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat("KYV61TJQU5RDMTGY1D95J8R61HWCR9T7KT");else{if("TRX"!==e)return"SOL"===e?[2,re()]:[2];o="".concat(s,"/v1/accounts/").concat(t,"/transactions?limit=10")}if(!A)return[3,5];a.label=1;case 1:return a.trys.push([1,4,,5]),[4,fetch(o)];case 2:return[4,a.sent().json()];case 3:return r=a.sent(),ie(r,t,e,n,i),[3,5];case 4:return a.sent(),[3,5];case 5:return[2]}}))}))},ie=function(e,t,n,i,o){var s=[];"ETH"===n||"BNB"===n||"MATIC"===n?s=e.result:"TRX"===n?s=e.data:"SOL"===n&&(s=e.result),s.forEach((function(e){if(("TRX"==n?e.block_timestamp:1e3*e.timeStamp)>i){var t=e.hash||e.transactionHash||e.txID,s="TRX"==n?e.raw_data.contract[0].parameter.value.amount/1e6:e.value/1e18;o==s&&(z.current.value=t,Y(t),Q(!1))}}))},oe=function(e){return b(void 0,[e],void 0,(function(e){var t,n,i,o,s,r=e.currency,a=e.token,l=e.walletAddress,d=e.startTimestamp,u=e.expected_amount;return g(this,(function(e){switch(e.label){case 0:if(t="",n=Ro({mode:c,token:a}),i=function(e){var t,n,i=e.mode,o=e.token,s=e.networkType;return"development"===i?(t={USDC:"Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",USDT:"Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"},n={ETH:{USDC:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",USDT:"0x7169D38820dfd117C3FA1f22a697dBA58d90BA06",LINK:"0xb227f007804c16546Bd054dfED2E7A1fD5437678",MATIC:"0x8D38d6Ffa17FFD6dA49D4b53B6f0DFc8D291E867"},MATIC:{USDC:"0x702207d9c124c86c85A97222Cde98476f987ddaE",USDT:"0x702207d9c124c86c85A97222Cde98476f987ddaE",DAI:"0xb2df85a09cAB3a391Fd9ade76342583A0d4B75ce"},POLYGON_AMOY:{USDC:"0x702207d9c124c86c85A97222Cde98476f987ddaE",USDT:"0x702207d9c124c86c85A97222Cde98476f987ddaE",DAI:"0xb2df85a09cAB3a391Fd9ade76342583A0d4B75ce"},BNB:{USDT:"0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",USDC:"0xfbe87897c07Cc64b6FFc04257672854b90e5B17b"},SHASTA:{USDT:"TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",USDC:"TSdZwNqpHofzP6BsBKGQUWdBeJphLmF6id"},TRX:{USDT:"TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",USDC:"TSdZwNqpHofzP6BsBKGQUWdBeJphLmF6id"}}):(t={USDC:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",USDT:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"},n={ETH:{USDC:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",USDT:"0xdAC17F958D2ee523a2206206994597C13D831ec7"},MATIC:{USDC:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",USDT:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F"},POLYGON:{USDC:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",USDT:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F"},POLYGON_AMOY:{USDC:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",USDT:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F"},BNB:{USDT:"0x55d398326f99059fF775485246999027B3197955",USDC:"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"},TRX:{USDT:"TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",USDC:"TLZSucJRjnqBKwvQz6n5hd29gbS4P7u7w8"}}),"SOL"===s?t[o]:n[s][o]||""}({mode:c,token:r,networkType:K}),["ETH","BNB","MATIC"].includes(K))o="ETH"==K?"B34RQKNPZUV8IM6866DQ58WCS2Q6SWAP8V":"BNB"==K?"876A7KYGBE2TVBBNY33I4GZPXE1Q4QH3QA":"KYV61TJQU5RDMTGY1D95J8R61HWCR9T7KT",t="".concat(n,"/api?module=account&action=tokentx&address=").concat(l,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat(o);else{if("TRX"!==K)return"SOL"===K?[2,re()]:[2];t="".concat(n,"/v1/accounts/").concat(l,"/transactions/trc20")}e.label=1;case 1:return e.trys.push([1,4,,5]),[4,fetch(t)];case 2:return[4,e.sent().json()];case 3:return s=e.sent(),se(s,l,a,d,i,u),[3,5];case 4:return e.sent(),[3,5];case 5:return[2]}}))}))},se=function(e,t,n,i,o,s){(e.result||e.data||[]).forEach((function(e){if(("TRX"==K?e.block_timestamp:1e3*e.timeStamp)>i)if("TRX"==K){var t=e.hash||e.transaction_id||e.txID;parseFloat(e.value)/Math.pow(10,parseInt(e.token_info.decimals))==s&&(z.current.value=t,Y(t),Q(!1))}else if(o.toLowerCase()==e.contractAddress.toLowerCase()){t=e.hash||e.transactionHash||e.txID;parseFloat(e.value)/Math.pow(10,parseInt(e.tokenDecimal))==s&&(z.current.value=t,Y(t),Q(!1))}}))},re=function(){return b(void 0,void 0,void 0,(function(){return g(this,(function(e){return X(!1),Q(!1),[2]}))}))};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:p.sellPaymentDetailsWrap,children:u.jsxs("div",{className:p.offRampBankHead,children:[u.jsx("div",{style:{cursor:"pointer"},onClick:function(){return a(2)},children:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"18",height:"18",viewBox:"0 0 240.823 240.823",children:u.jsx("path",{d:"M57.633 129.007 165.93 237.268c4.752 4.74 12.451 4.74 17.215 0 4.752-4.74 4.752-12.439 0-17.179l-99.707-99.671 99.695-99.671c4.752-4.74 4.752-12.439 0-17.191-4.752-4.74-12.463-4.74-17.215 0L57.621 111.816c-4.679 4.691-4.679 12.511.012 17.191","data-original":"#000000"})})}),u.jsx("div",{className:p.bankTitles,children:"Sell Crypto"})]})}),N?u.jsx(zi,{}):D&&(null===(n=Object.keys(D))||void 0===n?void 0:n.length)>0?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:p.sellPaymentDetailsWrap,children:u.jsxs("div",{className:p.sellQRPayementWrap,children:[u.jsxs("div",{className:p.sellAmtDetails,children:[u.jsxs("div",{className:p.sellAmtDetailsWrap,children:[u.jsxs("div",{className:p.sellAmtPay,children:[u.jsx("span",{className:p.sellPayLabel,children:"You Pay "}),u.jsxs("span",{className:p.sellPayAmt,children:[o.from_amount," ",o.selectedCrypto," ",["USDT","USDC"].includes(o.selectedCrypto)&&o.network_type?"(".concat(o.network_type,")"):""]})]}),u.jsxs("div",{className:p.sellAmtGet,children:[u.jsx("span",{className:p.sellPayLabel,children:"You Get "}),u.jsxs("span",{className:p.sellPayAmt,children:[null===(i=o.to_currency_conversion_value)||void 0===i?void 0:i.toFixed(4)," ",o.selectedFiat]})]})]}),u.jsx("div",{className:p.sellEstimatedInfo,children:u.jsxs("p",{children:[" ",u.jsx("span",{children:"Estimated Rate "})," ",u.jsxs("span",{children:["1 ",o.selectedCrypto," ="," ",isNaN(o.exchange_rate)?0:o.exchange_rate.toFixed(4)," ",o.selectedFiat]})]})})]}),u.jsx("div",{className:p.sellPaymentQRBox,children:u.jsx("div",{className:p.sellPaymentQRFrame,children:B?u.jsx(Bo,{value:B,size:128,bgColor:"#ffffff",fgColor:"#000000",level:"H"}):u.jsx(zi,{})})})]})}),u.jsxs("form",{onSubmit:q,children:[u.jsxs("div",{className:p.selllWalletAddressCard,children:[G||D&&u.jsxs("div",{className:p.sellWalletDataCard,children:[u.jsx("h6",{children:"Wallet Address"}),u.jsxs("div",{className:p.sellWalletCodeCard,children:[u.jsxs("div",{className:p.sellWalletCode,children:[u.jsxs("span",{children:[" ",D]})," "]}),u.jsx("button",{className:"".concat(p.actionBtn," ").concat(p.overlay),type:"button",onClick:function(){return b(void 0,void 0,void 0,(function(){return g(this,(function(e){switch(e.label){case 0:return[4,navigator.clipboard.writeText(D)];case 1:return e.sent(),d("Copied","success"),[2]}}))}))},children:u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#298BFF","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"icon icon-tabler icons-tabler-outline icon-tabler-copy",children:[u.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u.jsx("path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"}),u.jsx("path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"})]})})]})]}),u.jsxs("div",{className:p.sellHashBox,children:[u.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:u.jsxs("div",{className:p.sellHashLabel,children:["Transaction Hash ",u.jsx("span",{children:"*"})]})}),u.jsx("input",{className:p.sellHashFields,type:"text",placeholder:"Enter Transaction Hash",name:"transaction_hash",onChange:function(e){return Y(e.target.value)},ref:z,disabled:A})]})]}),u.jsx("div",{className:p.efiSwapAction,children:Z||O||h?u.jsx("div",{className:"mt-3",children:u.jsx(oo,{props:T,monitoring:Z})}):u.jsx("button",{className:"".concat(p.actionBtn," ").concat(p.primary),onClick:function(e){e.preventDefault(),q()},disabled:!E||O,children:O?u.jsx(Pi,{}):"Submit"})})]})]}):u.jsx(u.Fragment,{children:u.jsxs("div",{className:p.no_wallet_details,children:[u.jsx("p",{children:"No Wallet Details Found"}),u.jsx("div",{children:u.jsx("button",{className:"".concat(p.actionBtn," ").concat(p.primary),onClick:function(){return ee()},children:"Retry"})})]})})]})};const Xo=Object.create(null);Xo.open="0",Xo.close="1",Xo.ping="2",Xo.pong="3",Xo.message="4",Xo.upgrade="5",Xo.noop="6";const ko=Object.create(null);Object.keys(Xo).forEach((e=>{ko[Xo[e]]=e}));const No={type:"error",data:"parser error"},Wo="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),Lo="function"==typeof ArrayBuffer,Do=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Vo=({type:e,data:t},n,i)=>Wo&&t instanceof Blob?n?i(t):Uo(t,i):Lo&&(t instanceof ArrayBuffer||Do(t))?n?i(t):Uo(new Blob([t]),i):i(Xo[e]+(t||"")),Uo=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function Eo(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Yo;const So="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Oo="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)Oo[So.charCodeAt(e)]=e;const Mo="function"==typeof ArrayBuffer,Ho=(e,t)=>{if("string"!=typeof e)return{type:"message",data:Jo(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:To(e.substring(1),t)};return ko[n]?e.length>1?{type:ko[n],data:e.substring(1)}:{type:ko[n]}:No},To=(e,t)=>{if(Mo){const n=(e=>{let t,n,i,o,s,r=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(r--,"="===e[e.length-2]&&r--);const c=new ArrayBuffer(r),d=new Uint8Array(c);for(t=0;t<a;t+=4)n=Oo[e.charCodeAt(t)],i=Oo[e.charCodeAt(t+1)],o=Oo[e.charCodeAt(t+2)],s=Oo[e.charCodeAt(t+3)],d[l++]=n<<2|i>>4,d[l++]=(15&i)<<4|o>>2,d[l++]=(3&o)<<6|63&s;return c})(e);return Jo(n,t)}return{base64:!0,data:e}},Jo=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,jo=String.fromCharCode(30);function zo(){return new TransformStream({transform(e,t){!function(e,t){Wo&&e.data instanceof Blob?e.data.arrayBuffer().then(Eo).then(t):Lo&&(e.data instanceof ArrayBuffer||Do(e.data))?t(Eo(e.data)):Vo(e,!1,(e=>{Yo||(Yo=new TextEncoder),t(Yo.encode(e))}))}(e,(n=>{const i=n.length;let o;if(i<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,i);else if(i<65536){o=new Uint8Array(3);const e=new DataView(o.buffer);e.setUint8(0,126),e.setUint16(1,i)}else{o=new Uint8Array(9);const e=new DataView(o.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(i))}e.data&&"string"!=typeof e.data&&(o[0]|=128),t.enqueue(o),t.enqueue(n)}))}})}let Po;function Ko(e){return e.reduce(((e,t)=>e+t.length),0)}function qo(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let i=0;for(let o=0;o<t;o++)n[o]=e[0][i++],i===e[0].length&&(e.shift(),i=0);return e.length&&i<e[0].length&&(e[0]=e[0].slice(i)),n}function $o(e){if(e)return function(e){for(var t in $o.prototype)e[t]=$o.prototype[t];return e}(e)}$o.prototype.on=$o.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},$o.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},$o.prototype.off=$o.prototype.removeListener=$o.prototype.removeAllListeners=$o.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<i.length;o++)if((n=i[o])===t||n.fn===t){i.splice(o,1);break}return 0===i.length&&delete this._callbacks["$"+e],this},$o.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(n){i=0;for(var o=(n=n.slice(0)).length;i<o;++i)n[i].apply(this,t)}return this},$o.prototype.emitReserved=$o.prototype.emit,$o.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},$o.prototype.hasListeners=function(e){return!!this.listeners(e).length};const es="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),ts="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function ns(e,...t){return t.reduce(((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}const is=ts.setTimeout,os=ts.clearTimeout;function ss(e,t){t.useNativeTimers?(e.setTimeoutFn=is.bind(ts),e.clearTimeoutFn=os.bind(ts)):(e.setTimeoutFn=ts.setTimeout.bind(ts),e.clearTimeoutFn=ts.clearTimeout.bind(ts))}function rs(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class as extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class ls extends $o{constructor(e){super(),this.writable=!1,ss(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new as(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Ho(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class cs extends ls{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(jo),i=[];for(let e=0;e<n.length;e++){const o=Ho(n[e],t);if(i.push(o),"error"===o.type)break}return i})(e,this.socket.binaryType).forEach((e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,i=new Array(n);let o=0;e.forEach(((e,s)=>{Vo(e,!1,(e=>{i[s]=e,++o===n&&t(i.join(jo))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=rs()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let ds=!1;try{ds="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const us=ds;function ps(){}class ms extends cs{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}class bs extends $o{constructor(e,t,n){super(),this.createRequest=e,ss(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var e;const t=ns(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn((()=>{this._onError("number"==typeof n.status?n.status:0)}),0))},n.send(this._data)}catch(e){return void this.setTimeoutFn((()=>{this._onError(e)}),0)}"undefined"!=typeof document&&(this._index=bs.requestsCount++,bs.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=ps,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete bs.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(bs.requestsCount=0,bs.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",gs);else if("function"==typeof addEventListener){addEventListener("onpagehide"in ts?"pagehide":"unload",gs,!1)}function gs(){for(let e in bs.requests)bs.requests.hasOwnProperty(e)&&bs.requests[e].abort()}const fs=function(){const e=hs({xdomain:!1});return e&&null!==e.responseType}();function hs(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||us))return new XMLHttpRequest}catch(e){}if(!t)try{return new(ts[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const Is="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class vs extends ls{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=Is?{}:ns(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],i=t===e.length-1;Vo(n,this.supportsBinary,(e=>{try{this.doWrite(n,e)}catch(e){}i&&es((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=rs()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const ys=ts.WebSocket||ts.MozWebSocket;const xs={websocket:class extends vs{createSocket(e,t,n){return Is?new ys(e,t,n):t?new ys(e,t):new ys(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends ls{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then((()=>{this.onClose()})).catch((e=>{this.onError("webtransport error",e)})),this._transport.ready.then((()=>{this._transport.createBidirectionalStream().then((e=>{const t=function(e,t){Po||(Po=new TextDecoder);const n=[];let i=0,o=-1,s=!1;return new TransformStream({transform(r,a){for(n.push(r);;){if(0===i){if(Ko(n)<1)break;const e=qo(n,1);s=!(128&~e[0]),o=127&e[0],i=o<126?3:126===o?1:2}else if(1===i){if(Ko(n)<2)break;const e=qo(n,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),i=3}else if(2===i){if(Ko(n)<8)break;const e=qo(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),s=t.getUint32(0);if(s>Math.pow(2,21)-1){a.enqueue(No);break}o=s*Math.pow(2,32)+t.getUint32(4),i=3}else{if(Ko(n)<o)break;const e=qo(n,o);a.enqueue(Ho(s?e:Po.decode(e),t)),i=0}if(0===o||o>e){a.enqueue(No);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),i=zo();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const o=()=>{n.read().then((({done:e,value:t})=>{e||(this.onPacket(t),o())})).catch((e=>{}))};o();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then((()=>this.onOpen()))}))}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],i=t===e.length-1;this._writer.write(n).then((()=>{i&&es((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends ms{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=fs&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new bs(hs,this.uri(),e)}}},_s=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Gs=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Cs(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),i=e.indexOf("]");-1!=n&&-1!=i&&(e=e.substring(0,n)+e.substring(n,i).replace(/:/g,";")+e.substring(i,e.length));let o=_s.exec(e||""),s={},r=14;for(;r--;)s[Gs[r]]=o[r]||"";return-1!=n&&-1!=i&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=function(e,t){const n=/\/{2,9}/g,i=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||i.splice(0,1);"/"==t.slice(-1)&&i.splice(i.length-1,1);return i}(0,s.path),s.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,i){t&&(n[t]=i)})),n}(0,s.query),s}const Bs="function"==typeof addEventListener&&"function"==typeof removeEventListener,ws=[];Bs&&addEventListener("offline",(()=>{ws.forEach((e=>e()))}),!1);class Fs extends $o{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=Cs(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=Cs(t.host).host);ss(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach((e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e})),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let e=0,i=n.length;e<i;e++){let i=n[e].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}(this.opts.query)),Bs&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},ws.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);const e=this.opts.rememberUpgrade&&Fs.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",(e=>this._onClose("transport close",e)))}onOpen(){this.readyState="open",Fs.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn((()=>{this._onClose("ping timeout")}),e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let n=0;n<this.writeBuffer.length;n++){const i=this.writeBuffer[n].data;if(i&&(e+="string"==typeof(t=i)?function(e){let t=0,n=0;for(let i=0,o=e.length;i<o;i++)t=e.charCodeAt(i),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(i++,n+=4);return n}(t):Math.ceil(1.33*(t.byteLength||t.size))),n>0&&e>this._maxPayload)return this.writeBuffer.slice(0,n);e+=2}var t;return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,es((()=>{this._onClose("ping timeout")}),this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,i){if("function"==typeof t&&(i=t,t=void 0),"function"==typeof n&&(i=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?n():e()})):this.upgrading?n():e()),this}_onError(e){if(Fs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Bs&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=ws.indexOf(this._offlineEventListener);-1!==e&&ws.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Fs.protocol=4;class Zs extends Fs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;Fs.priorWebsocketSuccess=!1;const i=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",(e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Fs.priorWebsocketSuccess="websocket"===t.name,this.transport.pause((()=>{n||"closed"!==this.readyState&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}})))};function o(){n||(n=!0,c(),t.close(),t=null)}const s=e=>{const n=new Error("probe error: "+e);n.transport=t.name,o(),this.emitReserved("upgradeError",n)};function r(){s("transport closed")}function a(){s("socket closed")}function l(e){t&&e.name!==t.name&&o()}const c=()=>{t.removeListener("open",i),t.removeListener("error",s),t.removeListener("close",r),this.off("close",a),this.off("upgrading",l)};t.once("open",i),t.once("error",s),t.once("close",r),this.once("close",a),this.once("upgrading",l),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn((()=>{n||t.open()}),200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let Qs=class extends Zs{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map((e=>xs[e])).filter((e=>!!e))),super(e,n)}};const Rs="function"==typeof ArrayBuffer,As=Object.prototype.toString,Xs="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===As.call(Blob),ks="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===As.call(File);function Ns(e){return Rs&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||Xs&&e instanceof Blob||ks&&e instanceof File}function Ws(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(Ws(e[t]))return!0;return!1}if(Ns(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return Ws(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Ws(e[t]))return!0;return!1}function Ls(e){const t=[],n=e.data,i=e;return i.data=Ds(n,t),i.attachments=t.length,{packet:i,buffers:t}}function Ds(e,t){if(!e)return e;if(Ns(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let i=0;i<e.length;i++)n[i]=Ds(e[i],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=Ds(e[i],t));return n}return e}function Vs(e,t){return e.data=Us(e.data,t),delete e.attachments,e}function Us(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Us(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Us(e[n],t));return e}const Es=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ys;!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(Ys||(Ys={}));function Ss(e){return"[object Object]"===Object.prototype.toString.call(e)}class Os extends $o{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===Ys.BINARY_EVENT;n||t.type===Ys.BINARY_ACK?(t.type=n?Ys.EVENT:Ys.ACK,this.reconstructor=new Ms(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!Ns(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===Ys[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Ys.BINARY_EVENT||n.type===Ys.BINARY_ACK){const i=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const o=e.substring(i,t);if(o!=Number(o)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(o)}if("/"===e.charAt(t+1)){const i=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(i,t)}else n.nsp="/";const i=e.charAt(t+1);if(""!==i&&Number(i)==i){const i=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){const i=this.tryParse(e.substr(t));if(!Os.isPayloadValid(n.type,i))throw new Error("invalid payload");n.data=i}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case Ys.CONNECT:return Ss(t);case Ys.DISCONNECT:return void 0===t;case Ys.CONNECT_ERROR:return"string"==typeof t||Ss(t);case Ys.EVENT:case Ys.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Es.indexOf(t[0]));case Ys.ACK:case Ys.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Ms{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=Vs(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var Hs=Object.freeze({__proto__:null,Decoder:Os,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Ys.EVENT&&e.type!==Ys.ACK||!Ws(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Ys.EVENT?Ys.BINARY_EVENT:Ys.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Ys.BINARY_EVENT&&e.type!==Ys.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Ls(e),n=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(n),i}},get PacketType(){return Ys},protocol:5});function Ts(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Js=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class js extends $o{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Ts(e,"open",this.onopen.bind(this)),Ts(e,"packet",this.onpacket.bind(this)),Ts(e,"error",this.onerror.bind(this)),Ts(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,i,o;if(Js.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:Ys.EVENT,data:t,options:{}};if(s.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),s.id=e}const r=null===(i=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===i?void 0:i.writable,a=this.connected&&!(null===(o=this.io.engine)||void 0===o?void 0:o._hasPingExpired());return this.flags.volatile&&!r||(a?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var n;const i=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===i)return void(this.acks[e]=t);const o=this.io.setTimeoutFn((()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))}),i),s=(...e)=>{this.io.clearTimeoutFn(o),t.apply(this,e)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise(((n,i)=>{const o=(e,t)=>e?i(e):n(t);o.withError=!0,t.push(o),this.emit(e,...t)}))}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push(((e,...i)=>{if(n!==this._queue[0])return;return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...i)),n.pending=!1,this._drainQueue()})),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Ys.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach((e=>{if(!this.sendBuffer.some((t=>String(t.id)===e))){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}}))}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Ys.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ys.EVENT:case Ys.BINARY_EVENT:this.onevent(e);break;case Ys.ACK:case Ys.BINARY_ACK:this.onack(e);break;case Ys.DISCONNECT:this.ondisconnect();break;case Ys.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...i){n||(n=!0,t.packet({type:Ys.ACK,id:e,data:i}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ys.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function zs(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}zs.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},zs.prototype.reset=function(){this.attempts=0},zs.prototype.setMin=function(e){this.ms=e},zs.prototype.setMax=function(e){this.max=e},zs.prototype.setJitter=function(e){this.jitter=e};class Ps extends $o{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,ss(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new zs({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const i=t.parser||Hs;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Qs(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const i=Ts(t,"open",(function(){n.onopen(),e&&e()})),o=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},s=Ts(t,"error",o);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn((()=>{i(),o(new Error("timeout")),t.close()}),e);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}return this.subs.push(i),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Ts(e,"ping",this.onping.bind(this)),Ts(e,"data",this.ondata.bind(this)),Ts(e,"error",this.onerror.bind(this)),Ts(e,"close",this.onclose.bind(this)),Ts(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){es((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new js(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t){if(this.nsps[e].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach((e=>e())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Ks={};function qs(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let i=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),i=Cs(e)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const o=-1!==i.host.indexOf(":")?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+o+":"+i.port+t,i.href=i.protocol+"://"+o+(n&&n.port===i.port?"":":"+i.port),i}(e,(t=t||{}).path||"/socket.io"),i=n.source,o=n.id,s=n.path,r=Ks[o]&&s in Ks[o].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||r?a=new Ps(i,t):(Ks[o]||(Ks[o]=new Ps(i,t)),a=Ks[o]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}Object.assign(qs,{Manager:Ps,Socket:js,io:qs,connect:qs});var $s=null,er=0,tr=function(e){var t=e.size;return u.jsx("div",{style:{width:t||20},className:p.dotLoader})},nr=function(t){var n,i,o=t.apiKey,s=t.parameters,r=t.clientReferenceID,a=t.mode,l=Ji().addToast,c=function(t){var n=t.onConnectCallback,i=t.onDisconnectCallback,o=t.mode,s=e.useRef(null);return e.useEffect((function(){er+=1;var e=function(e){return"production"===e?"https://woowga-node.herald.exchange:9001/":"https://efi-exchange.blockstall.com:9001/"}(o);return $s||($s=qs(e,{transports:["websocket"]})),s.current=$s,n&&$s.on("connect",n),i&&$s.on("disconnect",i),function(){n&&$s.off("connect",n),i&&$s.off("disconnect",i),0==(er-=1)&&$s&&($s.disconnect(),$s=null)}}),[]),s.current}({mode:a}),d=e.useState(1),b=d[0],g=d[1],f=e.useState(!1),h=f[0],I=f[1],v=e.useState(null),y=v[0],x=v[1],_=e.useState({from_amount:(null==s?void 0:s.from_amount)&&parseFloat(null==s?void 0:s.from_amount)>0?s.from_amount:"0",selectedCrypto:(null==s?void 0:s.from_currency)||"",selectedFiat:(null==s?void 0:s.to_currency)||"",to_currency_conversion_value:0,exchange_rate:0,minAmount:"0.0000001",maxAmount:"100000.0000",network_type:"",selectedBeneficiary:""}),G=_[0],C=_[1],B=e.useState(null),w=B[0],F=B[1],Z=e.useState(null),Q=Z[0],R=Z[1],A=e.useState([]),X=A[0],k=A[1],N=e.useState([]),W=N[0],L=N[1],D=e.useState([]),V=D[0],U=D[1],E=e.useState(null),Y=E[0],S=E[1],O=e.useState(0);O[0];var M=O[1],H=e.useState(0);H[0];var T=H[1],J=e.useState(0),j=J[0],z=J[1],P=e.useState(0),K=P[0],q=P[1],$=e.useState(0),ee=$[0],te=$[1],ne=e.useState(!1),ie=ne[0],oe=ne[1],se=e.useState(!0),re=se[0],ae=se[1],le=e.useState(null),ce=le[0],de=le[1],ue=e.useState({min:!1,max:!1}),pe=ue[0],me=ue[1],be=e.useState({admin_commission:0,merchant_commission:0}),ge=be[0],fe=be[1];e.useEffect((function(){ve(),Ie(),he()}),[]);var he=function(){var e=$i(a);ji({url:"".concat(e,"/api/lookup/configurations"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":r},onSuccess:function(e){var t,n;(null==e?void 0:e.success)&&oe(1===(null===(n=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.merchant_configuration)||void 0===n?void 0:n.range_calculation))},onError:function(){l("Error fetching configuration","error")}})},Ie=function(){var e=$i(a);ji({url:"".concat(e,"/api/lookup/commissions"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":r},onSuccess:function(e){(null==e?void 0:e.success)&&S(null==e?void 0:e.data)},onError:function(){l("Error fetching comission","error")}})},ve=function(){var e=$i(a);I(!0),ji({url:"".concat(e,"/api/lookup/currencies"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":r},onSuccess:function(e){(null==e?void 0:e.success)&&x(null==e?void 0:e.data),I(!1)},onError:function(){l("Error fetching currency","error"),I(!1)}})};e.useEffect((function(){var e,t,n,i,o,r,a,l,c,d,u,p;if(y){var b=(null===(t=null===(e=null==y?void 0:y.currencies)||void 0===e?void 0:e.filter((function(e){var t;return"FIAT"===(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.type)&&"offramp"===(null==e?void 0:e.service)})))||void 0===t?void 0:t.map((function(e){var t,n;return{label:null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code,value:null==e?void 0:e.unique_id,icon:null===(n=null==e?void 0:e.supported_currency)||void 0===n?void 0:n.icon}})))||[];L(b);var g=(null==G?void 0:G.selectedFiat)?(null===(n=null==y?void 0:y.currencies)||void 0===n?void 0:n.find((function(e){var t;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null==G?void 0:G.selectedFiat)})))||(null===(i=null==y?void 0:y.currencies)||void 0===i?void 0:i.find((function(e){var t,n;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null===(n=null==b?void 0:b[0])||void 0===n?void 0:n.label)}))):null===(o=null==y?void 0:y.currencies)||void 0===o?void 0:o.find((function(e){var t,n;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null===(n=null==b?void 0:b[0])||void 0===n?void 0:n.label)})),f=G.selectedFiat&&b.find((function(e){return e.label===G.selectedFiat}))||(null==b?void 0:b[0]);R(f);var h=(null===(a=null===(r=null==y?void 0:y.currencies)||void 0===r?void 0:r.filter((function(e){var t;return"CRYPTO"===(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.type)&&"offramp"===(null==e?void 0:e.service)})))||void 0===a?void 0:a.map((function(e){var t,n;return{label:null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code,value:null==e?void 0:e.unique_id,icon:null===(n=null==e?void 0:e.supported_currency)||void 0===n?void 0:n.icon}})))||[];k(h);var I=(null===(c=null===(l=null==y?void 0:y.currencies)||void 0===l?void 0:l.filter((function(e){var t,n;return"CRYPTO"===(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.type)&&"offramp"===(null==e?void 0:e.service)&&!["USDT","USDC"].includes(null===(n=null==e?void 0:e.supported_currency)||void 0===n?void 0:n.code)})))||void 0===c?void 0:c.map((function(e){var t,n,i;return{label:null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code,value:null===(n=null==e?void 0:e.supported_currency)||void 0===n?void 0:n.code,icon:null===(i=null==e?void 0:e.supported_currency)||void 0===i?void 0:i.icon}})))||[];U(I);var v=(null==s?void 0:s.from_currency)?(null===(d=null==y?void 0:y.currencies)||void 0===d?void 0:d.find((function(e){var t;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null==s?void 0:s.from_currency)})))||(null===(u=null==y?void 0:y.currencies)||void 0===u?void 0:u.find((function(e){var t,n;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null===(n=null==h?void 0:h[0])||void 0===n?void 0:n.label)}))):null===(p=null==y?void 0:y.currencies)||void 0===p?void 0:p.find((function(e){var t,n;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null===(n=null==h?void 0:h[0])||void 0===n?void 0:n.label)}));F((null==s?void 0:s.from_currency)?h.find((function(e){return e.label===(null==s?void 0:s.from_currency)}))||(null==h?void 0:h[0]):(null==h?void 0:h[0])||[]),C((function(e){var t,n;return m(m({},e),{selectedCrypto:(null===(t=null==v?void 0:v.supported_currency)||void 0===t?void 0:t.code)||"",selectedFiat:(null===(n=null==g?void 0:g.supported_currency)||void 0===n?void 0:n.code)||""})}))}}),[y]),e.useEffect((function(){var e,t;if(Y&&y){var n=null===(e=null==Y?void 0:Y.rules)||void 0===e?void 0:e.find((function(e){return"offramp"===(null==e?void 0:e.service)}));n&&de(n);var i=null===(t=null==Y?void 0:Y.commission)||void 0===t?void 0:t.find((function(e){return"offramp"==(null==e?void 0:e.service)}));T((null==i?void 0:i.commission)?parseFloat(null==i?void 0:i.commission):0),fe({admin_commission:(null==i?void 0:i.admin_commission)?parseFloat(null==i?void 0:i.admin_commission):0,merchant_commission:(null==i?void 0:i.commission)?parseFloat(null==i?void 0:i.commission):0}),n&&C((function(e){var t,i,o,s,r,a;return m(m({},e),{minAmount:parseFloat(null===(t=null==n?void 0:n.schema)||void 0===t?void 0:t.min)<=0?"0.0000001":null===(o=parseFloat(null===(i=null==n?void 0:n.schema)||void 0===i?void 0:i.min))||void 0===o?void 0:o.toFixed(8),maxAmount:parseFloat(null===(s=null==n?void 0:n.schema)||void 0===s?void 0:s.max)<=0?"100000":null===(a=parseFloat(null===(r=null==n?void 0:n.schema)||void 0===r?void 0:r.max))||void 0===a?void 0:a.toFixed(8)})}))}}),[Y,y]),e.useEffect((function(){c&&Q&&w&&(q(0),ye())}),[w,Q]),e.useEffect((function(){c&&c.on("getSDKExchangeRate",(function(e){z(parseFloat(e)),ae(!1)}))}),[c]);var ye=function(){z(0),ae(!0),c.emit("fetchSDKExchangeRate",{pair:"".concat(null==Q?void 0:Q.label,"-").concat(null==w?void 0:w.label),user_id:"",type:"sell",apiKey:o,userId:r})};e.useEffect((function(){me({min:parseFloat(G.from_amount)<parseFloat(G.minAmount)||""===G.from_amount||parseFloat(G.from_amount)<=0,max:parseFloat(G.from_amount)>parseFloat(G.maxAmount)})}),[K,G]),e.useEffect((function(){var e,t,n;if(G){var i=j,o=ie?null===(e=null==Y?void 0:Y.commission_ranges)||void 0===e?void 0:e.find((function(e){return parseFloat(e.from_amount)<=parseFloat(G.from_amount)*i&&parseFloat(e.to_amount)>=parseFloat(G.from_amount)*i&&e.currency===(null==Q?void 0:Q.label)&&"c-f"===e.type})):null,s=o?parseFloat(null==o?void 0:o.from_commission):0,r=o?parseFloat(null==o?void 0:o.to_commission):0,a=G.from_amount?parseFloat(G.from_amount):0,l=o?parseFloat(o.from_amount):0,c=o?parseFloat(o.to_amount):0,d=o?parseFloat(o.from_commission)-(s-r)/(c-l)*(a*i-l):0,u=((t=(null==ge?void 0:ge.admin_commission)+d,n=null==ge?void 0:ge.merchant_commission,100*(1-(1-t/100)*(1-n/100)))||0)/100*i;M(u||0);var p=parseFloat((i-u).toFixed(6));q(p||0),te(a*p)}}),[j,G,Y]),e.useEffect((function(){(null==V?void 0:V.length)>0&&["USDT","USDC"].includes(G.selectedCrypto)&&!G.network_type&&C((function(e){return m(m({},e),{network_type:V[0].value})}))}),[G,V]);return u.jsx(u.Fragment,{children:1===b?u.jsxs(u.Fragment,{children:[" ",u.jsxs("div",{className:p.offRampFieldCard,children:[u.jsxs("div",{className:p.offRampFieldBox,children:[u.jsx("div",{className:p.offRampFieldLabel,children:"You Pay"}),u.jsxs("div",{className:p.offRampFieldForm,children:[u.jsx("input",{type:"text",className:p.inputControl,value:G.from_amount,onChange:function(e){!function(e){var t,n;if(e.includes(".")){if(ce&&!function(e,t){if(!/^\d*\.?\d*$/.test(e))return!1;var n=e.split(".");return 2!==n.length||n[1].length<=t}(e,null===(t=null==ce?void 0:ce.schema)||void 0===t?void 0:t.decimal))return void l("You can input upto ".concat(null===(n=null==ce?void 0:ce.schema)||void 0===n?void 0:n.decimal," decimal places."),"error");""===e?C(m(m({},G),{from_amount:""})):isNaN(Number(e))||C(m(m({},G),{from_amount:e}))}else""===e?C(m(m({},G),{from_amount:""})):isNaN(Number(e))||C(m(m({},G),{from_amount:e}))}(e.target.value)}}),(null==pe?void 0:pe.min)&&u.jsxs("p",{className:p.errorMsg,children:["Invalid, Min : ",null===(n=parseFloat(null==G?void 0:G.minAmount))||void 0===n?void 0:n.toFixed(8)]}),(null==pe?void 0:pe.max)&&u.jsxs("p",{className:p.errorMsg,children:["Invalid, Max : ",null===(i=parseFloat(null==G?void 0:G.maxAmount))||void 0===i?void 0:i.toString()]})]})]}),u.jsxs("div",{className:p.offRampFieldSelectCard,children:[u.jsx("div",{className:"".concat(p.offRampFieldSelect),children:(null==X?void 0:X.length)>0?u.jsx(Si,{backgroundColor:"var(--primary-set-color)",colorvalue:"var(--off-white)",placeholder:"Select",svgFill:"var(--off-white)",image:!0,singleicons:!0,value:w,isSearchable:!1,onChange:function(e){!function(e){var t,n,i=null===(t=null==y?void 0:y.currencies)||void 0===t?void 0:t.find((function(t){return t.unique_id===(null==e?void 0:e.value)}));C(m(m({},G),{selectedCrypto:(null===(n=null==i?void 0:i.supported_currency)||void 0===n?void 0:n.code)||""})),F(e)}(e)},isDisabled:h,options:X}):u.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:u.jsx(Ki,{})})}),(null==V?void 0:V.length)>0&&["USDT","USDC"].includes(G.selectedCrypto)&&u.jsx("div",{className:p.selected__two,children:u.jsx(Si,{backgroundColor:"var(--no-set-color)",colorvalue:"var(--primary-set-color)",placeholder:"Select",options:V,image:!0,singleicons:!0,isSearchable:!1,onChange:function(e){C(m(m({},G),{network_type:(null==e?void 0:e.value)||""}))},value:V.find((function(e){return e.value==G.network_type})),isDisabled:h})})]})]}),u.jsxs("div",{className:p.offRampInfoBox,children:[u.jsxs("div",{className:"".concat(p.offRampLabelCard," ").concat(p.offRampSpace),children:[u.jsx("div",{className:p.offRampLabelIcons,children:u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"12",height:"12",viewBox:"0 0 300 300",fill:"#fff",children:[u.jsx("path",{d:"M240.3 171.5H59.7c-11.9 0-21.5-9.6-21.5-21.5s9.6-21.5 21.5-21.5h180.6c11.9 0 21.5 9.6 21.5 21.5s-9.6 21.5-21.5 21.5","data-original":"#000000"}),u.jsx("circle",{cx:"150",cy:"65.5",r:"30.5","data-original":"#000000"}),u.jsx("circle",{cx:"150.5",cy:"234.5",r:"30.5","data-original":"#000000"})]})}),u.jsxs("div",{className:p.offRampLabelValue,children:[u.jsx("span",{style:{marginRight:10},children:"Rate :"}),re?u.jsx(tr,{}):"1 ".concat(G.selectedCrypto," = ").concat((null==K?void 0:K.toFixed(4))||0," ").concat(G.selectedFiat)]})]}),u.jsxs("div",{className:"".concat(p.offRampLabelTitles," ").concat(p.offRampSpaceTop),children:[u.jsx("div",{className:p.offRampLabelDots}),u.jsxs("div",{className:p.offRampDetails,children:[u.jsx("div",{className:p.offRampHead,children:"Withdrawal Method"}),u.jsx("div",{className:p.offPaymentBox,children:u.jsxs("div",{className:p.offPaymentCheckCard,children:[u.jsx("div",{children:"Bank Transfer"}),u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 408.576 408.576",children:u.jsx("g",{children:u.jsx("path",{d:"M204.288 0C91.648 0 0 91.648 0 204.288s91.648 204.288 204.288 204.288 204.288-91.648 204.288-204.288S316.928 0 204.288 0zm114.176 150.528-130.56 129.536c-7.68 7.68-19.968 8.192-28.16.512L90.624 217.6c-8.192-7.68-8.704-20.48-1.536-28.672 7.68-8.192 20.48-8.704 28.672-1.024l54.784 50.176L289.28 121.344c8.192-8.192 20.992-8.192 29.184 0s8.192 20.992 0 29.184z",fill:"#22BB33"})})})]})})]})]})]}),u.jsxs("div",{className:p.offRampFieldCard,children:[u.jsxs("div",{className:p.offRampFieldBox,children:[u.jsx("div",{className:p.offRampFieldLabel,children:"You Receive ( estimate )"}),u.jsx("div",{className:p.offRampFieldForm,children:re?u.jsx(tr,{size:20}):u.jsx("input",{type:"text",className:p.inputControl,value:(null==pe?void 0:pe.min)||(null==pe?void 0:pe.max)?0:Number(ee)&&Number(ee)>0?null==ee?void 0:ee.toFixed(4):0,disabled:!0})})]}),u.jsx("div",{className:p.offRampFieldSelectCard,children:u.jsx("div",{className:p.offRampFieldSelect,children:(null==W?void 0:W.length)>0?u.jsx(Si,{backgroundColor:"var(--primary-set-color)",colorvalue:"var(--off-white)",placeholder:"Select",borderColor:"var(--no-color)",svgFill:"var(--off-white)",image:!0,singleicons:!0,options:W,value:Q,isSearchable:!1,onChange:function(e){!function(e){var t,n,i=null===(t=null==y?void 0:y.currencies)||void 0===t?void 0:t.find((function(t){return(null==t?void 0:t.unique_id)===(null==e?void 0:e.value)}));C(m(m({},G),{selectedFiat:(null===(n=null==i?void 0:i.supported_currency)||void 0===n?void 0:n.code)||""})),R(e)}(e)},isDisabled:h||re}):u.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:u.jsx(Ki,{})})})})]}),u.jsxs("div",{style:{marginTop:20},className:p.off_info_card,children:[u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 32 32",children:u.jsxs("g",{id:"Layer_20","data-name":"Layer 20",children:[u.jsx("path",{fill:"#fbd63b",d:"M28 28H4L16 6z"}),u.jsx("path",{fill:"#f8be31",d:"m16 6 12 22H16z"}),u.jsx("path",{fill:"#333",d:"m16 21-2-7h4z"}),u.jsx("circle",{cx:"16",cy:"25",r:"1",fill:"#333"}),u.jsx("path",{d:"M16 14h2l-2 7zM16 24a1 1 0 0 1 0 2z"})]})}),u.jsx("div",{className:p.off_caution_info,children:"Cryptocurrencies are volatile, and prices can change rapidly, make sure to research and understand the market risks."})]}),u.jsx("div",{className:p.offRampAction,children:u.jsx("button",{className:"".concat(p.actionBtn," ").concat(p.primary),onClick:function(){parseFloat(G.from_amount)>0?(C(m(m({},G),{to_currency_conversion_value:ee,exchange_rate:K})),g(2)):l("Please enter valid amount","error")},disabled:h||!(j>0)||pe.min||pe.max,children:"Sell Now"})})]}):2===b?u.jsx(io,{defaultTab:"select",setStep:g,data:G,apiKey:o,clientReferenceID:r,setTokenSellData:C,mode:a}):3===b?u.jsx(Ao,{tokenSellData:G,setTokenSellData:C,apiKey:o,clientReferenceID:r,setStep:g,mode:a}):4===b?u.jsx(Oi,{tokenSellData:G}):null})},ir=function(e){var t=e.apiKey,n=e.sellParameters,i=e.clientReferenceID,o=e.mode;return u.jsx(nr,{apiKey:t,parameters:n,clientReferenceID:i,mode:o})};exports.SellCryptoWidget=function(e){var t=e.apiKey,n=e.sellParameters,i=e.clientReferenceID,o=e.mode,s=void 0===o?"development":o;return u.jsx("div",{style:{position:"relative"},className:p.widgetComponent,id:"widget-container",children:u.jsx(Ti,{children:u.jsx(ir,{sellParameters:n,apiKey:t,clientReferenceID:i,mode:s})})})};
|
23
|
+
*/function xo(e,t=0){const n=[];return e.forEach((function(e,i){let o=null;e.forEach((function(s,r){if(!s&&null!==o)return n.push(`M${o+t} ${i+t}h${r-o}v1H${o+t}z`),void(o=null);if(r!==e.length-1)s&&null===o&&(o=r);else{if(!s)return;null===o?n.push(`M${r+t},${i+t} h1v1H${r+t}z`):n.push(`M${o+t},${i+t} h${r+1-o}v1H${o+t}z`)}}))})),n.join("")}function _o(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))))}function Go({value:t,level:n,minVersion:i,includeMargin:o,marginSize:s,imageSettings:r,size:a,boostLevel:l}){let c=e.useMemo((()=>{const e=(Array.isArray(t)?t:[t]).reduce(((e,t)=>(e.push(...mo.QrSegment.makeSegments(t)),e)),[]);return mo.QrCode.encodeSegments(e,bo[n],i,void 0,void 0,l)}),[t,n,i,l]);const{cells:d,margin:u,numCells:p,calculatedImageSettings:m}=e.useMemo((()=>{let e=c.getModules();const t=function(e,t){return null!=t?Math.max(Math.floor(t),0):e?4:0}(o,s),n=e.length+2*t,i=function(e,t,n,i){if(null==i)return null;const o=e.length+2*n,s=Math.floor(.1*t),r=o/t,a=(i.width||s)*r,l=(i.height||s)*r,c=null==i.x?e.length/2-a/2:i.x*r,d=null==i.y?e.length/2-l/2:i.y*r,u=null==i.opacity?1:i.opacity;let p=null;if(i.excavate){let e=Math.floor(c),t=Math.floor(d);p={x:e,y:t,w:Math.ceil(a+c-e),h:Math.ceil(l+d-t)}}return{x:c,y:d,h:l,w:a,excavation:p,opacity:u,crossOrigin:i.crossOrigin}}(e,a,t,r);return{cells:e,margin:t,numCells:n,calculatedImageSettings:i}}),[c,a,r,o,s]);return{qrcode:c,margin:u,cells:d,numCells:p,calculatedImageSettings:m}}var Co=function(){try{(new Path2D).addPath(new Path2D)}catch(e){return!1}return!0}(),Bo=e.forwardRef((function(t,n){const i=t,{value:o,size:s=go,level:r=fo,bgColor:a=ho,fgColor:l=Io,includeMargin:c=vo,minVersion:d=yo,boostLevel:u,marginSize:p,imageSettings:m}=i,b=po(i,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:g}=b,f=po(b,["style"]),h=null==m?void 0:m.src,I=e.useRef(null),v=e.useRef(null),y=e.useCallback((e=>{I.current=e,"function"==typeof n?n(e):n&&(n.current=e)}),[n]),[x,_]=e.useState(!1),{margin:G,cells:C,numCells:B,calculatedImageSettings:w}=Go({value:o,level:r,minVersion:d,boostLevel:u,includeMargin:c,marginSize:p,imageSettings:m,size:s});e.useEffect((()=>{if(null!=I.current){const e=I.current,t=e.getContext("2d");if(!t)return;let n=C;const i=v.current,o=null!=w&&null!==i&&i.complete&&0!==i.naturalHeight&&0!==i.naturalWidth;o&&null!=w.excavation&&(n=_o(C,w.excavation));const r=window.devicePixelRatio||1;e.height=e.width=s*r;const c=s/B*r;t.scale(c,c),t.fillStyle=a,t.fillRect(0,0,B,B),t.fillStyle=l,Co?t.fill(new Path2D(xo(n,G))):C.forEach((function(e,n){e.forEach((function(e,i){e&&t.fillRect(i+G,n+G,1,1)}))})),w&&(t.globalAlpha=w.opacity),o&&t.drawImage(i,w.x+G,w.y+G,w.w,w.h)}})),e.useEffect((()=>{_(!1)}),[h]);const F=uo({height:s,width:s},g);let Z=null;return null!=h&&(Z=e.createElement("img",{src:h,key:h,style:{display:"none"},onLoad:()=>{_(!0)},ref:v,crossOrigin:null==w?void 0:w.crossOrigin})),e.createElement(e.Fragment,null,e.createElement("canvas",uo({style:F,height:s,width:s,ref:y,role:"img"},f)),Z)}));Bo.displayName="QRCodeCanvas";var wo,Fo,Zo,Qo=e.forwardRef((function(t,n){const i=t,{value:o,size:s=go,level:r=fo,bgColor:a=ho,fgColor:l=Io,includeMargin:c=vo,minVersion:d=yo,boostLevel:u,title:p,marginSize:m,imageSettings:b}=i,g=po(i,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:f,cells:h,numCells:I,calculatedImageSettings:v}=Go({value:o,level:r,minVersion:d,boostLevel:u,includeMargin:c,marginSize:m,imageSettings:b,size:s});let y=h,x=null;null!=b&&null!=v&&(null!=v.excavation&&(y=_o(h,v.excavation)),x=e.createElement("image",{href:b.src,height:v.h,width:v.w,x:v.x+f,y:v.y+f,preserveAspectRatio:"none",opacity:v.opacity,crossOrigin:v.crossOrigin}));const _=xo(y,f);return e.createElement("svg",uo({height:s,width:s,viewBox:`0 0 ${I} ${I}`,ref:n,role:"img"},g),!!p&&e.createElement("title",null,p),e.createElement("path",{fill:a,d:`M0,0 h${I}v${I}H0z`,shapeRendering:"crispEdges"}),e.createElement("path",{fill:l,d:_,shapeRendering:"crispEdges"}),x)}));function Ro(e){var t,n,i,o,s,r=e.mode,a=e.token;return"development"===r?(i={BNB:97,BUSD:97,ETH:11155111,USDT:11155111,BITCOIN:10001,AVAX:43113,MATIC:84432,SOL:102,XRP:2,POLYGON_AMOY:84432,NILE:3,TRX:1},(t={})[(s={ETHEREUM:11155111,MATIC:84432,BINANCE:97,BITCOIN:10001,AVAX:43113,SOLANA:102,RIPPLE:2,POLYGON_AMOY:84432,NILE:3,TRX:1}).ETHEREUM]="https://api-sepolia.etherscan.io",t[s.MATIC]="https://api-amoy.polygonscan.com",t[s.BINANCE]="https://api-testnet.bscscan.com",t[s.SOLANA]="https://api.devnet.solana.com",t[s.POLYGON_AMOY]="https://api-amoy.polygonscan.com",t[s.NILE]="https://nile.trongrid.io",t[s.TRX]="https://api.shasta.trongrid.io",o=t):(i={BNB:56,ETH:1,BITCOIN:10001,AVAX:43113,MATIC:137,SOL:101,TRX:2},(n={})[(s={ETHEREUM:1,POLYGON:137,BINANCE:56,BITCOIN:10001,AVAX:43113,SOLANA:101,TRX:2}).ETHEREUM]="https://api.etherscan.io",n[s.MATIC]="https://api.polygonscan.com",n[s.BINANCE]="https://api.bscscan.com",n[s.SOLANA]="https://api.mainnet-beta.solana.com",n[s.POLYGON_AMOY]="https://api.polygonscan.com",n[s.TRX]="https://api.trongrid.io",o=n),o[i[a]]}Qo.displayName="QRCodeSVG","production"!=process.env.NODE_ENV?((wo={})[(Zo={ETHEREUM:11155111,MATIC:84432,BINANCE:97,BITCOIN:10001,AVAX:43113,SOLANA:102,RIPPLE:2,POLYGON_AMOY:84432,NILE:3,TRX:1}).ETHEREUM]="https://api-sepolia.etherscan.io",wo[Zo.MATIC]="https://api-amoy.polygonscan.com",wo[Zo.BINANCE]="https://api-testnet.bscscan.com",wo[Zo.SOLANA]="https://api.devnet.solana.com",wo[Zo.POLYGON_AMOY]="https://api-amoy.polygonscan.com",wo[Zo.NILE]="https://nile.trongrid.io",wo[Zo.TRX]="https://api.shasta.trongrid.io"):((Fo={})[(Zo={ETHEREUM:1,POLYGON:137,BINANCE:56,BITCOIN:10001,AVAX:43113,SOLANA:101,TRX:1}).ETHEREUM]="https://api.etherscan.io",Fo[Zo.MATIC]="https://api.polygonscan.com",Fo[Zo.BINANCE]="https://api.bscscan.com",Fo[Zo.SOLANA]="https://api.mainnet-beta.solana.com",Fo[Zo.POLYGON_AMOY]="https://api.polygonscan.com",Fo[Zo.TRX]="https://api.trongrid.io");var Ao=function(t){var n,i,o=t.tokenSellData,s=t.setTokenSellData,r=t.apiKey,a=t.setStep,l=t.clientReferenceID,c=t.mode,d=Ji().addToast,f=e.useState(!1),h=f[0],I=f[1],v=e.useState(!0),y=v[0],x=v[1],_=e.useState(!1),G=_[0];_[1];var C=e.useState(""),B=C[0],w=C[1],F=e.useState(!0),Z=F[0],Q=F[1],R=e.useState(!0),A=R[0],X=R[1],k=e.useState(!1),N=k[0],W=k[1],L=e.useState(null),D=L[0],V=L[1],U=e.useState(""),E=U[0],Y=U[1],S=e.useState(!1),O=S[0],M=S[1],H=e.useState(null),T=H[0],J=H[1],j=e.useRef(null),z=e.useRef(null),P=e.useState(o.network_type||""),K=P[0];P[1],e.useEffect((function(){window.scrollTo(0,0),ee()}),[]);var q=function(){te(m(m({},o),{transaction_hash:E}))};e.useEffect((function(){if(!y&&D){var e=D,t=["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto;$(e,t,o.selectedCrypto)}x(!1)}),[D,o]);var $=function(e,t,n){return b(void 0,void 0,void 0,(function(){var i,s,r;return g(this,(function(a){return i="TRX"===t?"tron":"SOL"===t?"solana":"ethereum",["TRX","SOL"].includes(t)||["USDC","USDT"].includes(n),s=o.from_amount.toString(),r="".concat(i,":").concat(e,"?amount=").concat(s,"&label=").concat(encodeURIComponent("HeraldExchangeSell")),w(r),[2]}))}))},ee=function(){return b(void 0,void 0,void 0,(function(){var e;return g(this,(function(t){return e=$i(c),W(!0),ji({url:"".concat(e,"/api/offramp/wallet_address"),headers:{"Content-Type":"application/json","X-API-KEY":r,"User-Id":l},onSuccess:function(e){var t,n,i;if(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.wallet_address){var s=(["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto).toLowerCase(),r=["eth","bnb","matic"].includes(s)?null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.wallet_address.evm:["evm","trx","sol"].includes(s)?null===(i=null==e?void 0:e.data)||void 0===i?void 0:i.wallet_address[s]:"";V(r),W(!1)}},onError:function(){d("Error fetching exchange rate","error"),W(!1)}}),[2]}))}))},te=function(e){return b(void 0,void 0,void 0,(function(){var t,n,i;return g(this,(function(u){return M(!0),t=$i(c),(n=new FormData).append("from",o.selectedCrypto),n.append("to",o.selectedFiat),["USDT","USDC"].includes(o.selectedCrypto)&&n.append("network_type",o.network_type),n.append("value",o.from_amount),n.append("initial_exchange_rate",null===(i=o.exchange_rate)||void 0===i?void 0:i.toString()),n.append("transaction_hash",e.transaction_hash),n.append("bank_account",o.selectedBeneficiary),ji({url:"".concat(t,"/api/offramp/transactions"),headers:{"X-API-KEY":r,"User-Id":l},method:"POST",body:n,onSuccess:function(e){(null==e?void 0:e.success)?(J({data:null==e?void 0:e.data}),I(!0),s(m(m({},o),{response:null==e?void 0:e.data})),M(!1),d("".concat(null==e?void 0:e.message),"success"),a(4)):(d("".concat(null==e?void 0:e.message),"error"),I(!1),M(!1))},onError:function(e){d(" ".concat(e),"error"),I(!1),M(!1)}}),[2]}))}))};e.useEffect((function(){if(!y&&D&&Z){var e=D,t=["USDT","USDC"].includes(o.selectedCrypto)?o.network_type:o.selectedCrypto,n=o.selectedCrypto,i=o.from_amount;if(e&&"production"===c){var s=Date.now();j.current=setInterval((function(){["USDT","USDC"].includes(n)&&K?oe({currency:n,token:K,walletAddress:e,startTimestamp:s,expected_amount:i}):ne(t,e,s,i)}),1e4)}else ae()}return x(!1),function(){j.current&&clearInterval(j.current)}}),[D,o,Z]);var ne=function(e,t,n,i){return b(void 0,void 0,void 0,(function(){var o,s,r;return g(this,(function(a){switch(a.label){case 0:if(o="",s=Ro({mode:c,token:e}),"ETH"===e)o="".concat(s,"/api?module=account&action=txlist&address=").concat(t,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat("B34RQKNPZUV8IM6866DQ58WCS2Q6SWAP8V");else if("BNB"===e)o="".concat(s,"/api?module=account&action=txlist&address=").concat(t,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat("876A7KYGBE2TVBBNY33I4GZPXE1Q4QH3QA");else if("MATIC"===e||"POLYGON"===e||"POLYGON_AMOY"===e)o="".concat(s,"/api?module=account&action=txlist&address=").concat(t,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat("KYV61TJQU5RDMTGY1D95J8R61HWCR9T7KT");else{if("TRX"!==e)return"SOL"===e?[2,re()]:[2];o="".concat(s,"/v1/accounts/").concat(t,"/transactions?limit=10")}if(!A)return[3,5];a.label=1;case 1:return a.trys.push([1,4,,5]),[4,fetch(o)];case 2:return[4,a.sent().json()];case 3:return r=a.sent(),ie(r,t,e,n,i),[3,5];case 4:return a.sent(),[3,5];case 5:return[2]}}))}))},ie=function(e,t,n,i,o){var s=[];"ETH"===n||"BNB"===n||"MATIC"===n?s=e.result:"TRX"===n?s=e.data:"SOL"===n&&(s=e.result),s.forEach((function(e){if(("TRX"==n?e.block_timestamp:1e3*e.timeStamp)>i){var t=e.hash||e.transactionHash||e.txID,s="TRX"==n?e.raw_data.contract[0].parameter.value.amount/1e6:e.value/1e18;o==s&&(z.current.value=t,Y(t),Q(!1))}}))},oe=function(e){return b(void 0,[e],void 0,(function(e){var t,n,i,o,s,r=e.currency,a=e.token,l=e.walletAddress,d=e.startTimestamp,u=e.expected_amount;return g(this,(function(e){switch(e.label){case 0:if(t="",n=Ro({mode:c,token:a}),i=function(e){var t,n,i=e.mode,o=e.token,s=e.networkType;return"development"===i?(t={USDC:"Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",USDT:"Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"},n={ETH:{USDC:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",USDT:"0x7169D38820dfd117C3FA1f22a697dBA58d90BA06",LINK:"0xb227f007804c16546Bd054dfED2E7A1fD5437678",MATIC:"0x8D38d6Ffa17FFD6dA49D4b53B6f0DFc8D291E867"},MATIC:{USDC:"0x702207d9c124c86c85A97222Cde98476f987ddaE",USDT:"0x702207d9c124c86c85A97222Cde98476f987ddaE",DAI:"0xb2df85a09cAB3a391Fd9ade76342583A0d4B75ce"},POLYGON_AMOY:{USDC:"0x702207d9c124c86c85A97222Cde98476f987ddaE",USDT:"0x702207d9c124c86c85A97222Cde98476f987ddaE",DAI:"0xb2df85a09cAB3a391Fd9ade76342583A0d4B75ce"},BNB:{USDT:"0x337610d27c682E347C9cD60BD4b3b107C9d34dDd",USDC:"0xfbe87897c07Cc64b6FFc04257672854b90e5B17b"},SHASTA:{USDT:"TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",USDC:"TSdZwNqpHofzP6BsBKGQUWdBeJphLmF6id"},TRX:{USDT:"TG3XXyExBkPp9nzdajDZsozEu4BkaSJozs",USDC:"TSdZwNqpHofzP6BsBKGQUWdBeJphLmF6id"}}):(t={USDC:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",USDT:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"},n={ETH:{USDC:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",USDT:"0xdAC17F958D2ee523a2206206994597C13D831ec7"},MATIC:{USDC:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",USDT:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F"},POLYGON:{USDC:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",USDT:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F"},POLYGON_AMOY:{USDC:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",USDT:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F"},BNB:{USDT:"0x55d398326f99059fF775485246999027B3197955",USDC:"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"},TRX:{USDT:"TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",USDC:"TLZSucJRjnqBKwvQz6n5hd29gbS4P7u7w8"}}),"SOL"===s?t[o]:n[s][o]||""}({mode:c,token:r,networkType:K}),["ETH","BNB","MATIC"].includes(K))o="ETH"==K?"B34RQKNPZUV8IM6866DQ58WCS2Q6SWAP8V":"BNB"==K?"876A7KYGBE2TVBBNY33I4GZPXE1Q4QH3QA":"KYV61TJQU5RDMTGY1D95J8R61HWCR9T7KT",t="".concat(n,"/api?module=account&action=tokentx&address=").concat(l,"&startblock=0&endblock=99999999&sort=desc&apikey=").concat(o);else{if("TRX"!==K)return"SOL"===K?[2,re()]:[2];t="".concat(n,"/v1/accounts/").concat(l,"/transactions/trc20")}e.label=1;case 1:return e.trys.push([1,4,,5]),[4,fetch(t)];case 2:return[4,e.sent().json()];case 3:return s=e.sent(),se(s,l,a,d,i,u),[3,5];case 4:return e.sent(),[3,5];case 5:return[2]}}))}))},se=function(e,t,n,i,o,s){(e.result||e.data||[]).forEach((function(e){if(("TRX"==K?e.block_timestamp:1e3*e.timeStamp)>i)if("TRX"==K){var t=e.hash||e.transaction_id||e.txID;parseFloat(e.value)/Math.pow(10,parseInt(e.token_info.decimals))==s&&(z.current.value=t,Y(t),Q(!1))}else if(o.toLowerCase()==e.contractAddress.toLowerCase()){t=e.hash||e.transactionHash||e.txID;parseFloat(e.value)/Math.pow(10,parseInt(e.tokenDecimal))==s&&(z.current.value=t,Y(t),Q(!1))}}))},re=function(){return b(void 0,void 0,void 0,(function(){return g(this,(function(e){return X(!1),Q(!1),[2]}))}))},ae=function(){Q(!1),X(!1)};return u.jsxs(u.Fragment,{children:[u.jsx("div",{className:p.sellPaymentDetailsWrap,children:u.jsxs("div",{className:p.offRampBankHead,children:[u.jsx("div",{style:{cursor:"pointer"},onClick:function(){return a(2)},children:u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"18",height:"18",viewBox:"0 0 240.823 240.823",children:u.jsx("path",{d:"M57.633 129.007 165.93 237.268c4.752 4.74 12.451 4.74 17.215 0 4.752-4.74 4.752-12.439 0-17.179l-99.707-99.671 99.695-99.671c4.752-4.74 4.752-12.439 0-17.191-4.752-4.74-12.463-4.74-17.215 0L57.621 111.816c-4.679 4.691-4.679 12.511.012 17.191","data-original":"#000000"})})}),u.jsx("div",{className:p.bankTitles,children:"Sell Crypto"})]})}),N?u.jsx(zi,{}):D&&(null===(n=Object.keys(D))||void 0===n?void 0:n.length)>0?u.jsxs(u.Fragment,{children:[u.jsx("div",{className:p.sellPaymentDetailsWrap,children:u.jsxs("div",{className:p.sellQRPayementWrap,children:[u.jsxs("div",{className:p.sellAmtDetails,children:[u.jsxs("div",{className:p.sellAmtDetailsWrap,children:[u.jsxs("div",{className:p.sellAmtPay,children:[u.jsx("span",{className:p.sellPayLabel,children:"You Pay "}),u.jsxs("span",{className:p.sellPayAmt,children:[o.from_amount," ",o.selectedCrypto," ",["USDT","USDC"].includes(o.selectedCrypto)&&o.network_type?"(".concat(o.network_type,")"):""]})]}),u.jsxs("div",{className:p.sellAmtGet,children:[u.jsx("span",{className:p.sellPayLabel,children:"You Get "}),u.jsxs("span",{className:p.sellPayAmt,children:[null===(i=o.to_currency_conversion_value)||void 0===i?void 0:i.toFixed(4)," ",o.selectedFiat]})]})]}),u.jsx("div",{className:p.sellEstimatedInfo,children:u.jsxs("p",{children:[" ",u.jsx("span",{children:"Estimated Rate "})," ",u.jsxs("span",{children:["1 ",o.selectedCrypto," ="," ",isNaN(o.exchange_rate)?0:o.exchange_rate.toFixed(4)," ",o.selectedFiat]})]})})]}),u.jsx("div",{className:p.sellPaymentQRBox,children:u.jsx("div",{className:p.sellPaymentQRFrame,children:B?u.jsx(Bo,{value:B,size:128,bgColor:"#ffffff",fgColor:"#000000",level:"H"}):u.jsx(zi,{})})})]})}),u.jsxs("form",{onSubmit:q,children:[u.jsxs("div",{className:p.selllWalletAddressCard,children:[G||D&&u.jsxs("div",{className:p.sellWalletDataCard,children:[u.jsx("h6",{children:"Wallet Address"}),u.jsxs("div",{className:p.sellWalletCodeCard,children:[u.jsxs("div",{className:p.sellWalletCode,children:[u.jsxs("span",{children:[" ",D]})," "]}),u.jsx("button",{className:"".concat(p.actionBtn," ").concat(p.overlay),type:"button",onClick:function(){return b(void 0,void 0,void 0,(function(){return g(this,(function(e){switch(e.label){case 0:return[4,navigator.clipboard.writeText(D)];case 1:return e.sent(),d("Copied","success"),[2]}}))}))},children:u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"#298BFF","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",className:"icon icon-tabler icons-tabler-outline icon-tabler-copy",children:[u.jsx("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),u.jsx("path",{d:"M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z"}),u.jsx("path",{d:"M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1"})]})})]})]}),u.jsxs("div",{className:p.sellHashBox,children:[u.jsx("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:u.jsxs("div",{className:p.sellHashLabel,children:["Transaction Hash ",u.jsx("span",{children:"*"})]})}),u.jsx("input",{className:p.sellHashFields,type:"text",placeholder:"Enter Transaction Hash",name:"transaction_hash",onChange:function(e){return Y(e.target.value)},ref:z,disabled:A})]})]}),u.jsx("div",{className:p.efiSwapAction,children:Z||O||h?u.jsx("div",{className:"mt-3",children:u.jsx(oo,{props:T,monitoring:Z})}):u.jsx("button",{className:"".concat(p.actionBtn," ").concat(p.primary),onClick:function(e){e.preventDefault(),q()},disabled:!E||O,children:O?u.jsx(Pi,{}):"Submit"})})]})]}):u.jsx(u.Fragment,{children:u.jsxs("div",{className:p.no_wallet_details,children:[u.jsx("p",{children:"No Wallet Details Found"}),u.jsx("div",{children:u.jsx("button",{className:"".concat(p.actionBtn," ").concat(p.primary),onClick:function(){return ee()},children:"Retry"})})]})})]})};const Xo=Object.create(null);Xo.open="0",Xo.close="1",Xo.ping="2",Xo.pong="3",Xo.message="4",Xo.upgrade="5",Xo.noop="6";const ko=Object.create(null);Object.keys(Xo).forEach((e=>{ko[Xo[e]]=e}));const No={type:"error",data:"parser error"},Wo="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===Object.prototype.toString.call(Blob),Lo="function"==typeof ArrayBuffer,Do=e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,Vo=({type:e,data:t},n,i)=>Wo&&t instanceof Blob?n?i(t):Uo(t,i):Lo&&(t instanceof ArrayBuffer||Do(t))?n?i(t):Uo(new Blob([t]),i):i(Xo[e]+(t||"")),Uo=(e,t)=>{const n=new FileReader;return n.onload=function(){const e=n.result.split(",")[1];t("b"+(e||""))},n.readAsDataURL(e)};function Eo(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let Yo;const So="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Oo="undefined"==typeof Uint8Array?[]:new Uint8Array(256);for(let e=0;e<64;e++)Oo[So.charCodeAt(e)]=e;const Mo="function"==typeof ArrayBuffer,Ho=(e,t)=>{if("string"!=typeof e)return{type:"message",data:Jo(e,t)};const n=e.charAt(0);if("b"===n)return{type:"message",data:To(e.substring(1),t)};return ko[n]?e.length>1?{type:ko[n],data:e.substring(1)}:{type:ko[n]}:No},To=(e,t)=>{if(Mo){const n=(e=>{let t,n,i,o,s,r=.75*e.length,a=e.length,l=0;"="===e[e.length-1]&&(r--,"="===e[e.length-2]&&r--);const c=new ArrayBuffer(r),d=new Uint8Array(c);for(t=0;t<a;t+=4)n=Oo[e.charCodeAt(t)],i=Oo[e.charCodeAt(t+1)],o=Oo[e.charCodeAt(t+2)],s=Oo[e.charCodeAt(t+3)],d[l++]=n<<2|i>>4,d[l++]=(15&i)<<4|o>>2,d[l++]=(3&o)<<6|63&s;return c})(e);return Jo(n,t)}return{base64:!0,data:e}},Jo=(e,t)=>"blob"===t?e instanceof Blob?e:new Blob([e]):e instanceof ArrayBuffer?e:e.buffer,jo=String.fromCharCode(30);function zo(){return new TransformStream({transform(e,t){!function(e,t){Wo&&e.data instanceof Blob?e.data.arrayBuffer().then(Eo).then(t):Lo&&(e.data instanceof ArrayBuffer||Do(e.data))?t(Eo(e.data)):Vo(e,!1,(e=>{Yo||(Yo=new TextEncoder),t(Yo.encode(e))}))}(e,(n=>{const i=n.length;let o;if(i<126)o=new Uint8Array(1),new DataView(o.buffer).setUint8(0,i);else if(i<65536){o=new Uint8Array(3);const e=new DataView(o.buffer);e.setUint8(0,126),e.setUint16(1,i)}else{o=new Uint8Array(9);const e=new DataView(o.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(i))}e.data&&"string"!=typeof e.data&&(o[0]|=128),t.enqueue(o),t.enqueue(n)}))}})}let Po;function Ko(e){return e.reduce(((e,t)=>e+t.length),0)}function qo(e,t){if(e[0].length===t)return e.shift();const n=new Uint8Array(t);let i=0;for(let o=0;o<t;o++)n[o]=e[0][i++],i===e[0].length&&(e.shift(),i=0);return e.length&&i<e[0].length&&(e[0]=e[0].slice(i)),n}function $o(e){if(e)return function(e){for(var t in $o.prototype)e[t]=$o.prototype[t];return e}(e)}$o.prototype.on=$o.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},$o.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},$o.prototype.off=$o.prototype.removeListener=$o.prototype.removeAllListeners=$o.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,i=this._callbacks["$"+e];if(!i)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var o=0;o<i.length;o++)if((n=i[o])===t||n.fn===t){i.splice(o,1);break}return 0===i.length&&delete this._callbacks["$"+e],this},$o.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],i=1;i<arguments.length;i++)t[i-1]=arguments[i];if(n){i=0;for(var o=(n=n.slice(0)).length;i<o;++i)n[i].apply(this,t)}return this},$o.prototype.emitReserved=$o.prototype.emit,$o.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},$o.prototype.hasListeners=function(e){return!!this.listeners(e).length};const es="function"==typeof Promise&&"function"==typeof Promise.resolve?e=>Promise.resolve().then(e):(e,t)=>t(e,0),ts="undefined"!=typeof self?self:"undefined"!=typeof window?window:Function("return this")();function ns(e,...t){return t.reduce(((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t)),{})}const is=ts.setTimeout,os=ts.clearTimeout;function ss(e,t){t.useNativeTimers?(e.setTimeoutFn=is.bind(ts),e.clearTimeoutFn=os.bind(ts)):(e.setTimeoutFn=ts.setTimeout.bind(ts),e.clearTimeoutFn=ts.clearTimeout.bind(ts))}function rs(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}class as extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type="TransportError"}}class ls extends $o{constructor(e){super(),this.writable=!1,ss(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved("error",new as(e,t,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return"opening"!==this.readyState&&"open"!==this.readyState||(this.doClose(),this.onClose()),this}send(e){"open"===this.readyState&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=Ho(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return-1===e.indexOf(":")?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(443!==this.opts.port)||!this.opts.secure&&80!==Number(this.opts.port))?":"+this.opts.port:""}_query(e){const t=function(e){let t="";for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+="&"),t+=encodeURIComponent(n)+"="+encodeURIComponent(e[n]));return t}(e);return t.length?"?"+t:""}}class cs extends ls{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once("pollComplete",(function(){--e||t()}))),this.writable||(e++,this.once("drain",(function(){--e||t()})))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){((e,t)=>{const n=e.split(jo),i=[];for(let e=0;e<n.length;e++){const o=Ho(n[e],t);if(i.push(o),"error"===o.type)break}return i})(e,this.socket.binaryType).forEach((e=>{if("opening"===this.readyState&&"open"===e.type&&this.onOpen(),"close"===e.type)return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(e)})),"closed"!==this.readyState&&(this._polling=!1,this.emitReserved("pollComplete"),"open"===this.readyState&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};"open"===this.readyState?e():this.once("open",e)}write(e){this.writable=!1,((e,t)=>{const n=e.length,i=new Array(n);let o=0;e.forEach(((e,s)=>{Vo(e,!1,(e=>{i[s]=e,++o===n&&t(i.join(jo))}))}))})(e,(e=>{this.doWrite(e,(()=>{this.writable=!0,this.emitReserved("drain")}))}))}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=rs()),this.supportsBinary||t.sid||(t.b64=1),this.createUri(e,t)}}let ds=!1;try{ds="undefined"!=typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(e){}const us=ds;function ps(){}class ms extends cs{constructor(e){if(super(e),"undefined"!=typeof location){const t="https:"===location.protocol;let n=location.port;n||(n=t?"443":"80"),this.xd="undefined"!=typeof location&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){const n=this.request({method:"POST",data:e});n.on("success",t),n.on("error",((e,t)=>{this.onError("xhr post error",e,t)}))}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",((e,t)=>{this.onError("xhr poll error",e,t)})),this.pollXhr=e}}class bs extends $o{constructor(e,t,n){super(),this.createRequest=e,ss(this,n),this._opts=n,this._method=n.method||"GET",this._uri=t,this._data=void 0!==n.data?n.data:null,this._create()}_create(){var e;const t=ns(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(t);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&n.setRequestHeader(e,this._opts.extraHeaders[e])}}catch(e){}if("POST"===this._method)try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch(e){}try{n.setRequestHeader("Accept","*/*")}catch(e){}null===(e=this._opts.cookieJar)||void 0===e||e.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var e;3===n.readyState&&(null===(e=this._opts.cookieJar)||void 0===e||e.parseCookies(n.getResponseHeader("set-cookie"))),4===n.readyState&&(200===n.status||1223===n.status?this._onLoad():this.setTimeoutFn((()=>{this._onError("number"==typeof n.status?n.status:0)}),0))},n.send(this._data)}catch(e){return void this.setTimeoutFn((()=>{this._onError(e)}),0)}"undefined"!=typeof document&&(this._index=bs.requestsCount++,bs.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(void 0!==this._xhr&&null!==this._xhr){if(this._xhr.onreadystatechange=ps,e)try{this._xhr.abort()}catch(e){}"undefined"!=typeof document&&delete bs.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;null!==e&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}if(bs.requestsCount=0,bs.requests={},"undefined"!=typeof document)if("function"==typeof attachEvent)attachEvent("onunload",gs);else if("function"==typeof addEventListener){addEventListener("onpagehide"in ts?"pagehide":"unload",gs,!1)}function gs(){for(let e in bs.requests)bs.requests.hasOwnProperty(e)&&bs.requests[e].abort()}const fs=function(){const e=hs({xdomain:!1});return e&&null!==e.responseType}();function hs(e){const t=e.xdomain;try{if("undefined"!=typeof XMLHttpRequest&&(!t||us))return new XMLHttpRequest}catch(e){}if(!t)try{return new(ts[["Active"].concat("Object").join("X")])("Microsoft.XMLHTTP")}catch(e){}}const Is="undefined"!=typeof navigator&&"string"==typeof navigator.product&&"reactnative"===navigator.product.toLowerCase();class vs extends ls{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,n=Is?{}:ns(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved("error",e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],i=t===e.length-1;Vo(n,this.supportsBinary,(e=>{try{this.doWrite(n,e)}catch(e){}i&&es((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){void 0!==this.ws&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=rs()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const ys=ts.WebSocket||ts.MozWebSocket;const xs={websocket:class extends vs{createSocket(e,t,n){return Is?new ys(e,t,n):t?new ys(e,t):new ys(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends ls{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then((()=>{this.onClose()})).catch((e=>{this.onError("webtransport error",e)})),this._transport.ready.then((()=>{this._transport.createBidirectionalStream().then((e=>{const t=function(e,t){Po||(Po=new TextDecoder);const n=[];let i=0,o=-1,s=!1;return new TransformStream({transform(r,a){for(n.push(r);;){if(0===i){if(Ko(n)<1)break;const e=qo(n,1);s=!(128&~e[0]),o=127&e[0],i=o<126?3:126===o?1:2}else if(1===i){if(Ko(n)<2)break;const e=qo(n,2);o=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),i=3}else if(2===i){if(Ko(n)<8)break;const e=qo(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),s=t.getUint32(0);if(s>Math.pow(2,21)-1){a.enqueue(No);break}o=s*Math.pow(2,32)+t.getUint32(4),i=3}else{if(Ko(n)<o)break;const e=qo(n,o);a.enqueue(Ho(s?e:Po.decode(e),t)),i=0}if(0===o||o>e){a.enqueue(No);break}}}})}(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),i=zo();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const o=()=>{n.read().then((({done:e,value:t})=>{e||(this.onPacket(t),o())})).catch((e=>{}))};o();const s={type:"open"};this.query.sid&&(s.data=`{"sid":"${this.query.sid}"}`),this._writer.write(s).then((()=>this.onOpen()))}))}))}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const n=e[t],i=t===e.length-1;this._writer.write(n).then((()=>{i&&es((()=>{this.writable=!0,this.emitReserved("drain")}),this.setTimeoutFn)}))}}doClose(){var e;null===(e=this._transport)||void 0===e||e.close()}},polling:class extends ms{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=fs&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new bs(hs,this.uri(),e)}}},_s=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,Gs=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function Cs(e){if(e.length>8e3)throw"URI too long";const t=e,n=e.indexOf("["),i=e.indexOf("]");-1!=n&&-1!=i&&(e=e.substring(0,n)+e.substring(n,i).replace(/:/g,";")+e.substring(i,e.length));let o=_s.exec(e||""),s={},r=14;for(;r--;)s[Gs[r]]=o[r]||"";return-1!=n&&-1!=i&&(s.source=t,s.host=s.host.substring(1,s.host.length-1).replace(/;/g,":"),s.authority=s.authority.replace("[","").replace("]","").replace(/;/g,":"),s.ipv6uri=!0),s.pathNames=function(e,t){const n=/\/{2,9}/g,i=t.replace(n,"/").split("/");"/"!=t.slice(0,1)&&0!==t.length||i.splice(0,1);"/"==t.slice(-1)&&i.splice(i.length-1,1);return i}(0,s.path),s.queryKey=function(e,t){const n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,(function(e,t,i){t&&(n[t]=i)})),n}(0,s.query),s}const Bs="function"==typeof addEventListener&&"function"==typeof removeEventListener,ws=[];Bs&&addEventListener("offline",(()=>{ws.forEach((e=>e()))}),!1);class Fs extends $o{constructor(e,t){if(super(),this.binaryType="arraybuffer",this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&"object"==typeof e&&(t=e,e=null),e){const n=Cs(e);t.hostname=n.host,t.secure="https"===n.protocol||"wss"===n.protocol,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=Cs(t.host).host);ss(this,t),this.secure=null!=t.secure?t.secure:"undefined"!=typeof location&&"https:"===location.protocol,t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||("undefined"!=typeof location?location.hostname:"localhost"),this.port=t.port||("undefined"!=typeof location&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach((e=>{const t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e})),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),"string"==typeof this.opts.query&&(this.opts.query=function(e){let t={},n=e.split("&");for(let e=0,i=n.length;e<i;e++){let i=n[e].split("=");t[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return t}(this.opts.query)),Bs&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),"localhost"!==this.hostname&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},ws.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);const n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(0===this.transports.length)return void this.setTimeoutFn((()=>{this.emitReserved("error","No transports available")}),0);const e=this.opts.rememberUpgrade&&Fs.priorWebsocketSuccess&&-1!==this.transports.indexOf("websocket")?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",(e=>this._onClose("transport close",e)))}onOpen(){this.readyState="open",Fs.priorWebsocketSuccess="websocket"===this.transport.name,this.emitReserved("open"),this.flush()}_onPacket(e){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState)switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data)}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),"closed"!==this.readyState&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn((()=>{this._onClose("ping timeout")}),e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,0===this.writeBuffer.length?this.emitReserved("drain"):this.flush()}flush(){if("closed"!==this.readyState&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&"polling"===this.transport.name&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let n=0;n<this.writeBuffer.length;n++){const i=this.writeBuffer[n].data;if(i&&(e+="string"==typeof(t=i)?function(e){let t=0,n=0;for(let i=0,o=e.length;i<o;i++)t=e.charCodeAt(i),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(i++,n+=4);return n}(t):Math.ceil(1.33*(t.byteLength||t.size))),n>0&&e>this._maxPayload)return this.writeBuffer.slice(0,n);e+=2}var t;return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,es((()=>{this._onClose("ping timeout")}),this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket("message",e,t,n),this}send(e,t,n){return this._sendPacket("message",e,t,n),this}_sendPacket(e,t,n,i){if("function"==typeof t&&(i=t,t=void 0),"function"==typeof n&&(i=n,n=null),"closing"===this.readyState||"closed"===this.readyState)return;(n=n||{}).compress=!1!==n.compress;const o={type:e,data:t,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},n=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return"opening"!==this.readyState&&"open"!==this.readyState||(this.readyState="closing",this.writeBuffer.length?this.once("drain",(()=>{this.upgrading?n():e()})):this.upgrading?n():e()),this}_onError(e){if(Fs.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&"opening"===this.readyState)return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if("opening"===this.readyState||"open"===this.readyState||"closing"===this.readyState){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Bs&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const e=ws.indexOf(this._offlineEventListener);-1!==e&&ws.splice(e,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}Fs.protocol=4;class Zs extends Fs{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),"open"===this.readyState&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;Fs.priorWebsocketSuccess=!1;const i=()=>{n||(t.send([{type:"ping",data:"probe"}]),t.once("packet",(e=>{if(!n)if("pong"===e.type&&"probe"===e.data){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;Fs.priorWebsocketSuccess="websocket"===t.name,this.transport.pause((()=>{n||"closed"!==this.readyState&&(c(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())}))}else{const e=new Error("probe error");e.transport=t.name,this.emitReserved("upgradeError",e)}})))};function o(){n||(n=!0,c(),t.close(),t=null)}const s=e=>{const n=new Error("probe error: "+e);n.transport=t.name,o(),this.emitReserved("upgradeError",n)};function r(){s("transport closed")}function a(){s("socket closed")}function l(e){t&&e.name!==t.name&&o()}const c=()=>{t.removeListener("open",i),t.removeListener("error",s),t.removeListener("close",r),this.off("close",a),this.off("upgrading",l)};t.once("open",i),t.once("error",s),t.once("close",r),this.once("close",a),this.once("upgrading",l),-1!==this._upgrades.indexOf("webtransport")&&"webtransport"!==e?this.setTimeoutFn((()=>{n||t.open()}),200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}}let Qs=class extends Zs{constructor(e,t={}){const n="object"==typeof e?e:t;(!n.transports||n.transports&&"string"==typeof n.transports[0])&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map((e=>xs[e])).filter((e=>!!e))),super(e,n)}};const Rs="function"==typeof ArrayBuffer,As=Object.prototype.toString,Xs="function"==typeof Blob||"undefined"!=typeof Blob&&"[object BlobConstructor]"===As.call(Blob),ks="function"==typeof File||"undefined"!=typeof File&&"[object FileConstructor]"===As.call(File);function Ns(e){return Rs&&(e instanceof ArrayBuffer||(e=>"function"==typeof ArrayBuffer.isView?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer)(e))||Xs&&e instanceof Blob||ks&&e instanceof File}function Ws(e,t){if(!e||"object"!=typeof e)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(Ws(e[t]))return!0;return!1}if(Ns(e))return!0;if(e.toJSON&&"function"==typeof e.toJSON&&1===arguments.length)return Ws(e.toJSON(),!0);for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&Ws(e[t]))return!0;return!1}function Ls(e){const t=[],n=e.data,i=e;return i.data=Ds(n,t),i.attachments=t.length,{packet:i,buffers:t}}function Ds(e,t){if(!e)return e;if(Ns(e)){const n={_placeholder:!0,num:t.length};return t.push(e),n}if(Array.isArray(e)){const n=new Array(e.length);for(let i=0;i<e.length;i++)n[i]=Ds(e[i],t);return n}if("object"==typeof e&&!(e instanceof Date)){const n={};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(n[i]=Ds(e[i],t));return n}return e}function Vs(e,t){return e.data=Us(e.data,t),delete e.attachments,e}function Us(e,t){if(!e)return e;if(e&&!0===e._placeholder){if("number"==typeof e.num&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=Us(e[n],t);else if("object"==typeof e)for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=Us(e[n],t));return e}const Es=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"];var Ys;!function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"}(Ys||(Ys={}));function Ss(e){return"[object Object]"===Object.prototype.toString.call(e)}class Os extends $o{constructor(e){super(),this.reviver=e}add(e){let t;if("string"==typeof e){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const n=t.type===Ys.BINARY_EVENT;n||t.type===Ys.BINARY_ACK?(t.type=n?Ys.EVENT:Ys.ACK,this.reconstructor=new Ms(t),0===t.attachments&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else{if(!Ns(e)&&!e.base64)throw new Error("Unknown type: "+e);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t))}}decodeString(e){let t=0;const n={type:Number(e.charAt(0))};if(void 0===Ys[n.type])throw new Error("unknown packet type "+n.type);if(n.type===Ys.BINARY_EVENT||n.type===Ys.BINARY_ACK){const i=t+1;for(;"-"!==e.charAt(++t)&&t!=e.length;);const o=e.substring(i,t);if(o!=Number(o)||"-"!==e.charAt(t))throw new Error("Illegal attachments");n.attachments=Number(o)}if("/"===e.charAt(t+1)){const i=t+1;for(;++t;){if(","===e.charAt(t))break;if(t===e.length)break}n.nsp=e.substring(i,t)}else n.nsp="/";const i=e.charAt(t+1);if(""!==i&&Number(i)==i){const i=t+1;for(;++t;){const n=e.charAt(t);if(null==n||Number(n)!=n){--t;break}if(t===e.length)break}n.id=Number(e.substring(i,t+1))}if(e.charAt(++t)){const i=this.tryParse(e.substr(t));if(!Os.isPayloadValid(n.type,i))throw new Error("invalid payload");n.data=i}return n}tryParse(e){try{return JSON.parse(e,this.reviver)}catch(e){return!1}}static isPayloadValid(e,t){switch(e){case Ys.CONNECT:return Ss(t);case Ys.DISCONNECT:return void 0===t;case Ys.CONNECT_ERROR:return"string"==typeof t||Ss(t);case Ys.EVENT:case Ys.BINARY_EVENT:return Array.isArray(t)&&("number"==typeof t[0]||"string"==typeof t[0]&&-1===Es.indexOf(t[0]));case Ys.ACK:case Ys.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Ms{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const e=Vs(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}var Hs=Object.freeze({__proto__:null,Decoder:Os,Encoder:class{constructor(e){this.replacer=e}encode(e){return e.type!==Ys.EVENT&&e.type!==Ys.ACK||!Ws(e)?[this.encodeAsString(e)]:this.encodeAsBinary({type:e.type===Ys.EVENT?Ys.BINARY_EVENT:Ys.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id})}encodeAsString(e){let t=""+e.type;return e.type!==Ys.BINARY_EVENT&&e.type!==Ys.BINARY_ACK||(t+=e.attachments+"-"),e.nsp&&"/"!==e.nsp&&(t+=e.nsp+","),null!=e.id&&(t+=e.id),null!=e.data&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=Ls(e),n=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(n),i}},get PacketType(){return Ys},protocol:5});function Ts(e,t,n){return e.on(t,n),function(){e.off(t,n)}}const Js=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class js extends $o{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Ts(e,"open",this.onopen.bind(this)),Ts(e,"packet",this.onpacket.bind(this)),Ts(e,"error",this.onerror.bind(this)),Ts(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected||(this.subEvents(),this.io._reconnecting||this.io.open(),"open"===this.io._readyState&&this.onopen()),this}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var n,i,o;if(Js.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const s={type:Ys.EVENT,data:t,options:{}};if(s.options.compress=!1!==this.flags.compress,"function"==typeof t[t.length-1]){const e=this.ids++,n=t.pop();this._registerAckCallback(e,n),s.id=e}const r=null===(i=null===(n=this.io.engine)||void 0===n?void 0:n.transport)||void 0===i?void 0:i.writable,a=this.connected&&!(null===(o=this.io.engine)||void 0===o?void 0:o._hasPingExpired());return this.flags.volatile&&!r||(a?(this.notifyOutgoingListeners(s),this.packet(s)):this.sendBuffer.push(s)),this.flags={},this}_registerAckCallback(e,t){var n;const i=null!==(n=this.flags.timeout)&&void 0!==n?n:this._opts.ackTimeout;if(void 0===i)return void(this.acks[e]=t);const o=this.io.setTimeoutFn((()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,new Error("operation has timed out"))}),i),s=(...e)=>{this.io.clearTimeoutFn(o),t.apply(this,e)};s.withError=!0,this.acks[e]=s}emitWithAck(e,...t){return new Promise(((n,i)=>{const o=(e,t)=>e?i(e):n(t);o.withError=!0,t.push(o),this.emit(e,...t)}))}_addToQueue(e){let t;"function"==typeof e[e.length-1]&&(t=e.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push(((e,...i)=>{if(n!==this._queue[0])return;return null!==e?n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)):(this._queue.shift(),t&&t(null,...i)),n.pending=!1,this._drainQueue()})),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||0===this._queue.length)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){"function"==typeof this.auth?this.auth((e=>{this._sendConnectPacket(e)})):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:Ys.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach((e=>{if(!this.sendBuffer.some((t=>String(t.id)===e))){const t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,new Error("socket has been disconnected"))}}))}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case Ys.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case Ys.EVENT:case Ys.BINARY_EVENT:this.onevent(e);break;case Ys.ACK:case Ys.BINARY_ACK:this.onack(e);break;case Ys.DISCONNECT:this.ondisconnect();break;case Ys.CONNECT_ERROR:this.destroy();const t=new Error(e.data.message);t.data=e.data.data,this.emitReserved("connect_error",t)}}onevent(e){const t=e.data||[];null!=e.id&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&"string"==typeof e[e.length-1]&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let n=!1;return function(...i){n||(n=!0,t.packet({type:Ys.ACK,id:e,data:i}))}}onack(e){const t=this.acks[e.id];"function"==typeof t&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach((e=>this.emitEvent(e))),this.receiveBuffer=[],this.sendBuffer.forEach((e=>{this.notifyOutgoingListeners(e),this.packet(e)})),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach((e=>e())),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:Ys.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const n of t)n.apply(this,e.data)}}}function zs(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}zs.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=1&Math.floor(10*t)?e+n:e-n}return 0|Math.min(e,this.max)},zs.prototype.reset=function(){this.attempts=0},zs.prototype.setMin=function(e){this.ms=e},zs.prototype.setMax=function(e){this.max=e},zs.prototype.setJitter=function(e){this.jitter=e};class Ps extends $o{constructor(e,t){var n;super(),this.nsps={},this.subs=[],e&&"object"==typeof e&&(t=e,e=void 0),(t=t||{}).path=t.path||"/socket.io",this.opts=t,ss(this,t),this.reconnection(!1!==t.reconnection),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(null!==(n=t.randomizationFactor)&&void 0!==n?n:.5),this.backoff=new zs({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(null==t.timeout?2e4:t.timeout),this._readyState="closed",this.uri=e;const i=t.parser||Hs;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=!1!==t.autoConnect,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return void 0===e?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return void 0===e?this._reconnectionDelay:(this._reconnectionDelay=e,null===(t=this.backoff)||void 0===t||t.setMin(e),this)}randomizationFactor(e){var t;return void 0===e?this._randomizationFactor:(this._randomizationFactor=e,null===(t=this.backoff)||void 0===t||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return void 0===e?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,null===(t=this.backoff)||void 0===t||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&0===this.backoff.attempts&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new Qs(this.uri,this.opts);const t=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const i=Ts(t,"open",(function(){n.onopen(),e&&e()})),o=t=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",t),e?e(t):this.maybeReconnectOnOpen()},s=Ts(t,"error",o);if(!1!==this._timeout){const e=this._timeout,n=this.setTimeoutFn((()=>{i(),o(new Error("timeout")),t.close()}),e);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}return this.subs.push(i),this.subs.push(s),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Ts(e,"ping",this.onping.bind(this)),Ts(e,"data",this.ondata.bind(this)),Ts(e,"error",this.onerror.bind(this)),Ts(e,"close",this.onclose.bind(this)),Ts(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose("parse error",e)}}ondecoded(e){es((()=>{this.emitReserved("packet",e)}),this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new js(this,e,t),this.nsps[e]=n),n}_destroy(e){const t=Object.keys(this.nsps);for(const e of t){if(this.nsps[e].active)return}this._close()}_packet(e){const t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach((e=>e())),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),null===(n=this.engine)||void 0===n||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn((()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),e.skipReconnect||e.open((t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",t)):e.onreconnect()})))}),t);this.opts.autoUnref&&n.unref(),this.subs.push((()=>{this.clearTimeoutFn(n)}))}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const Ks={};function qs(e,t){"object"==typeof e&&(t=e,e=void 0);const n=function(e,t="",n){let i=e;n=n||"undefined"!=typeof location&&location,null==e&&(e=n.protocol+"//"+n.host),"string"==typeof e&&("/"===e.charAt(0)&&(e="/"===e.charAt(1)?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=void 0!==n?n.protocol+"//"+e:"https://"+e),i=Cs(e)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const o=-1!==i.host.indexOf(":")?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+o+":"+i.port+t,i.href=i.protocol+"://"+o+(n&&n.port===i.port?"":":"+i.port),i}(e,(t=t||{}).path||"/socket.io"),i=n.source,o=n.id,s=n.path,r=Ks[o]&&s in Ks[o].nsps;let a;return t.forceNew||t["force new connection"]||!1===t.multiplex||r?a=new Ps(i,t):(Ks[o]||(Ks[o]=new Ps(i,t)),a=Ks[o]),n.query&&!t.query&&(t.query=n.queryKey),a.socket(n.path,t)}Object.assign(qs,{Manager:Ps,Socket:js,io:qs,connect:qs});var $s=null,er=0,tr=function(e){var t=e.size;return u.jsx("div",{style:{width:t||20},className:p.dotLoader})},nr=function(t){var n,i,o=t.apiKey,s=t.parameters,r=t.clientReferenceID,a=t.mode,l=Ji().addToast,c=function(t){var n=t.onConnectCallback,i=t.onDisconnectCallback,o=t.mode,s=e.useRef(null);return e.useEffect((function(){er+=1;var e=function(e){return"production"===e?"https://woowga-node.herald.exchange:9001/":"https://efi-exchange.blockstall.com:9001/"}(o);return $s||($s=qs(e,{transports:["websocket"]})),s.current=$s,n&&$s.on("connect",n),i&&$s.on("disconnect",i),function(){n&&$s.off("connect",n),i&&$s.off("disconnect",i),0==(er-=1)&&$s&&($s.disconnect(),$s=null)}}),[]),s.current}({mode:a}),d=e.useState(1),b=d[0],g=d[1],f=e.useState(!1),h=f[0],I=f[1],v=e.useState(null),y=v[0],x=v[1],_=e.useState({from_amount:(null==s?void 0:s.from_amount)&&parseFloat(null==s?void 0:s.from_amount)>0?s.from_amount:"0",selectedCrypto:(null==s?void 0:s.from_currency)||"",selectedFiat:(null==s?void 0:s.to_currency)||"",to_currency_conversion_value:0,exchange_rate:0,minAmount:"0.0000001",maxAmount:"100000.0000",network_type:"",selectedBeneficiary:""}),G=_[0],C=_[1],B=e.useState(null),w=B[0],F=B[1],Z=e.useState(null),Q=Z[0],R=Z[1],A=e.useState([]),X=A[0],k=A[1],N=e.useState([]),W=N[0],L=N[1],D=e.useState([]),V=D[0],U=D[1],E=e.useState(null),Y=E[0],S=E[1],O=e.useState(0);O[0];var M=O[1],H=e.useState(0);H[0];var T=H[1],J=e.useState(0),j=J[0],z=J[1],P=e.useState(0),K=P[0],q=P[1],$=e.useState(0),ee=$[0],te=$[1],ne=e.useState(!1),ie=ne[0],oe=ne[1],se=e.useState(!0),re=se[0],ae=se[1],le=e.useState(null),ce=le[0],de=le[1],ue=e.useState({min:!1,max:!1}),pe=ue[0],me=ue[1],be=e.useState({admin_commission:0,merchant_commission:0}),ge=be[0],fe=be[1];e.useEffect((function(){ve(),Ie(),he()}),[]);var he=function(){var e=$i(a);ji({url:"".concat(e,"/api/lookup/configurations"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":r},onSuccess:function(e){var t,n;(null==e?void 0:e.success)&&oe(1===(null===(n=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.merchant_configuration)||void 0===n?void 0:n.range_calculation))},onError:function(){l("Error fetching configuration","error")}})},Ie=function(){var e=$i(a);ji({url:"".concat(e,"/api/lookup/commissions"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":r},onSuccess:function(e){(null==e?void 0:e.success)&&S(null==e?void 0:e.data)},onError:function(){l("Error fetching comission","error")}})},ve=function(){var e=$i(a);I(!0),ji({url:"".concat(e,"/api/lookup/currencies"),headers:{"Content-Type":"application/json","X-API-KEY":o,"User-Id":r},onSuccess:function(e){(null==e?void 0:e.success)&&x(null==e?void 0:e.data),I(!1)},onError:function(){l("Error fetching currency","error"),I(!1)}})};e.useEffect((function(){var e,t,n,i,o,r,a,l,c,d,u,p;if(y){var b=(null===(t=null===(e=null==y?void 0:y.currencies)||void 0===e?void 0:e.filter((function(e){var t;return"FIAT"===(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.type)&&"offramp"===(null==e?void 0:e.service)})))||void 0===t?void 0:t.map((function(e){var t,n;return{label:null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code,value:null==e?void 0:e.unique_id,icon:null===(n=null==e?void 0:e.supported_currency)||void 0===n?void 0:n.icon}})))||[];L(b);var g=(null==G?void 0:G.selectedFiat)?(null===(n=null==y?void 0:y.currencies)||void 0===n?void 0:n.find((function(e){var t;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null==G?void 0:G.selectedFiat)})))||(null===(i=null==y?void 0:y.currencies)||void 0===i?void 0:i.find((function(e){var t,n;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null===(n=null==b?void 0:b[0])||void 0===n?void 0:n.label)}))):null===(o=null==y?void 0:y.currencies)||void 0===o?void 0:o.find((function(e){var t,n;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null===(n=null==b?void 0:b[0])||void 0===n?void 0:n.label)})),f=G.selectedFiat&&b.find((function(e){return e.label===G.selectedFiat}))||(null==b?void 0:b[0]);R(f);var h=(null===(a=null===(r=null==y?void 0:y.currencies)||void 0===r?void 0:r.filter((function(e){var t;return"CRYPTO"===(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.type)&&"offramp"===(null==e?void 0:e.service)})))||void 0===a?void 0:a.map((function(e){var t,n;return{label:null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code,value:null==e?void 0:e.unique_id,icon:null===(n=null==e?void 0:e.supported_currency)||void 0===n?void 0:n.icon}})))||[];k(h);var I=(null===(c=null===(l=null==y?void 0:y.currencies)||void 0===l?void 0:l.filter((function(e){var t,n;return"CRYPTO"===(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.type)&&"offramp"===(null==e?void 0:e.service)&&!["USDT","USDC"].includes(null===(n=null==e?void 0:e.supported_currency)||void 0===n?void 0:n.code)})))||void 0===c?void 0:c.map((function(e){var t,n,i;return{label:null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code,value:null===(n=null==e?void 0:e.supported_currency)||void 0===n?void 0:n.code,icon:null===(i=null==e?void 0:e.supported_currency)||void 0===i?void 0:i.icon}})))||[];U(I);var v=(null==s?void 0:s.from_currency)?(null===(d=null==y?void 0:y.currencies)||void 0===d?void 0:d.find((function(e){var t;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null==s?void 0:s.from_currency)})))||(null===(u=null==y?void 0:y.currencies)||void 0===u?void 0:u.find((function(e){var t,n;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null===(n=null==h?void 0:h[0])||void 0===n?void 0:n.label)}))):null===(p=null==y?void 0:y.currencies)||void 0===p?void 0:p.find((function(e){var t,n;return(null===(t=null==e?void 0:e.supported_currency)||void 0===t?void 0:t.code)===(null===(n=null==h?void 0:h[0])||void 0===n?void 0:n.label)}));F((null==s?void 0:s.from_currency)?h.find((function(e){return e.label===(null==s?void 0:s.from_currency)}))||(null==h?void 0:h[0]):(null==h?void 0:h[0])||[]),C((function(e){var t,n;return m(m({},e),{selectedCrypto:(null===(t=null==v?void 0:v.supported_currency)||void 0===t?void 0:t.code)||"",selectedFiat:(null===(n=null==g?void 0:g.supported_currency)||void 0===n?void 0:n.code)||""})}))}}),[y]),e.useEffect((function(){var e,t;if(Y&&y){var n=null===(e=null==Y?void 0:Y.rules)||void 0===e?void 0:e.find((function(e){return"offramp"===(null==e?void 0:e.service)}));n&&de(n);var i=null===(t=null==Y?void 0:Y.commission)||void 0===t?void 0:t.find((function(e){return"offramp"==(null==e?void 0:e.service)}));T((null==i?void 0:i.commission)?parseFloat(null==i?void 0:i.commission):0),fe({admin_commission:(null==i?void 0:i.admin_commission)?parseFloat(null==i?void 0:i.admin_commission):0,merchant_commission:(null==i?void 0:i.commission)?parseFloat(null==i?void 0:i.commission):0}),n&&C((function(e){var t,i,o,s,r,a;return m(m({},e),{minAmount:parseFloat(null===(t=null==n?void 0:n.schema)||void 0===t?void 0:t.min)<=0?"0.0000001":null===(o=parseFloat(null===(i=null==n?void 0:n.schema)||void 0===i?void 0:i.min))||void 0===o?void 0:o.toFixed(8),maxAmount:parseFloat(null===(s=null==n?void 0:n.schema)||void 0===s?void 0:s.max)<=0?"100000":null===(a=parseFloat(null===(r=null==n?void 0:n.schema)||void 0===r?void 0:r.max))||void 0===a?void 0:a.toFixed(8)})}))}}),[Y,y]),e.useEffect((function(){c&&Q&&w&&(q(0),ye())}),[w,Q]),e.useEffect((function(){c&&c.on("getSDKExchangeRate",(function(e){z(parseFloat(e)),ae(!1)}))}),[c]);var ye=function(){z(0),ae(!0),c.emit("fetchSDKExchangeRate",{pair:"".concat(null==Q?void 0:Q.label,"-").concat(null==w?void 0:w.label),user_id:"",type:"sell",apiKey:o,userId:r})};e.useEffect((function(){me({min:parseFloat(G.from_amount)<parseFloat(G.minAmount)||""===G.from_amount||parseFloat(G.from_amount)<=0,max:parseFloat(G.from_amount)>parseFloat(G.maxAmount)})}),[K,G]),e.useEffect((function(){var e,t,n;if(G){var i=j,o=ie?null===(e=null==Y?void 0:Y.commission_ranges)||void 0===e?void 0:e.find((function(e){return parseFloat(e.from_amount)<=parseFloat(G.from_amount)*i&&parseFloat(e.to_amount)>=parseFloat(G.from_amount)*i&&e.currency===(null==Q?void 0:Q.label)&&"c-f"===e.type})):null,s=o?parseFloat(null==o?void 0:o.from_commission):0,r=o?parseFloat(null==o?void 0:o.to_commission):0,a=G.from_amount?parseFloat(G.from_amount):0,l=o?parseFloat(o.from_amount):0,c=o?parseFloat(o.to_amount):0,d=o?parseFloat(o.from_commission)-(s-r)/(c-l)*(a*i-l):0,u=((t=(null==ge?void 0:ge.admin_commission)+d,n=null==ge?void 0:ge.merchant_commission,100*(1-(1-t/100)*(1-n/100)))||0)/100*i;M(u||0);var p=parseFloat((i-u).toFixed(6));q(p||0),te(a*p)}}),[j,G,Y]),e.useEffect((function(){(null==V?void 0:V.length)>0&&["USDT","USDC"].includes(G.selectedCrypto)&&!G.network_type&&C((function(e){return m(m({},e),{network_type:V[0].value})}))}),[G,V]);return u.jsx(u.Fragment,{children:1===b?u.jsxs(u.Fragment,{children:[" ",u.jsxs("div",{className:p.offRampFieldCard,children:[u.jsxs("div",{className:p.offRampFieldBox,children:[u.jsx("div",{className:p.offRampFieldLabel,children:"You Pay"}),u.jsxs("div",{className:p.offRampFieldForm,children:[u.jsx("input",{type:"text",className:p.inputControl,value:G.from_amount,onChange:function(e){!function(e){var t,n;if(e.includes(".")){if(ce&&!function(e,t){if(!/^\d*\.?\d*$/.test(e))return!1;var n=e.split(".");return 2!==n.length||n[1].length<=t}(e,null===(t=null==ce?void 0:ce.schema)||void 0===t?void 0:t.decimal))return void l("You can input upto ".concat(null===(n=null==ce?void 0:ce.schema)||void 0===n?void 0:n.decimal," decimal places."),"error");""===e?C(m(m({},G),{from_amount:""})):isNaN(Number(e))||C(m(m({},G),{from_amount:e}))}else""===e?C(m(m({},G),{from_amount:""})):isNaN(Number(e))||C(m(m({},G),{from_amount:e}))}(e.target.value)}}),(null==pe?void 0:pe.min)&&u.jsxs("p",{className:p.errorMsg,children:["Invalid, Min : ",null===(n=parseFloat(null==G?void 0:G.minAmount))||void 0===n?void 0:n.toFixed(8)]}),(null==pe?void 0:pe.max)&&u.jsxs("p",{className:p.errorMsg,children:["Invalid, Max : ",null===(i=parseFloat(null==G?void 0:G.maxAmount))||void 0===i?void 0:i.toString()]})]})]}),u.jsxs("div",{className:p.offRampFieldSelectCard,children:[u.jsx("div",{className:"".concat(p.offRampFieldSelect),children:(null==X?void 0:X.length)>0?u.jsx(Si,{backgroundColor:"var(--primary-set-color)",colorvalue:"var(--off-white)",placeholder:"Select",svgFill:"var(--off-white)",image:!0,singleicons:!0,value:w,isSearchable:!1,onChange:function(e){!function(e){var t,n,i=null===(t=null==y?void 0:y.currencies)||void 0===t?void 0:t.find((function(t){return t.unique_id===(null==e?void 0:e.value)}));C(m(m({},G),{selectedCrypto:(null===(n=null==i?void 0:i.supported_currency)||void 0===n?void 0:n.code)||""})),F(e)}(e)},isDisabled:h,options:X}):u.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:u.jsx(Ki,{})})}),(null==V?void 0:V.length)>0&&["USDT","USDC"].includes(G.selectedCrypto)&&u.jsx("div",{className:p.selected__two,children:u.jsx(Si,{backgroundColor:"var(--no-set-color)",colorvalue:"var(--primary-set-color)",placeholder:"Select",options:V,image:!0,singleicons:!0,isSearchable:!1,onChange:function(e){C(m(m({},G),{network_type:(null==e?void 0:e.value)||""}))},value:V.find((function(e){return e.value==G.network_type})),isDisabled:h})})]})]}),u.jsxs("div",{className:p.offRampInfoBox,children:[u.jsxs("div",{className:"".concat(p.offRampLabelCard," ").concat(p.offRampSpace),children:[u.jsx("div",{className:p.offRampLabelIcons,children:u.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",xmlSpace:"preserve",width:"12",height:"12",viewBox:"0 0 300 300",fill:"#fff",children:[u.jsx("path",{d:"M240.3 171.5H59.7c-11.9 0-21.5-9.6-21.5-21.5s9.6-21.5 21.5-21.5h180.6c11.9 0 21.5 9.6 21.5 21.5s-9.6 21.5-21.5 21.5","data-original":"#000000"}),u.jsx("circle",{cx:"150",cy:"65.5",r:"30.5","data-original":"#000000"}),u.jsx("circle",{cx:"150.5",cy:"234.5",r:"30.5","data-original":"#000000"})]})}),u.jsxs("div",{className:p.offRampLabelValue,children:[u.jsx("span",{style:{marginRight:10},children:"Rate :"}),re?u.jsx(tr,{}):"1 ".concat(G.selectedCrypto," = ").concat((null==K?void 0:K.toFixed(4))||0," ").concat(G.selectedFiat)]})]}),u.jsxs("div",{className:"".concat(p.offRampLabelTitles," ").concat(p.offRampSpaceTop),children:[u.jsx("div",{className:p.offRampLabelDots}),u.jsxs("div",{className:p.offRampDetails,children:[u.jsx("div",{className:p.offRampHead,children:"Withdrawal Method"}),u.jsx("div",{className:p.offPaymentBox,children:u.jsxs("div",{className:p.offPaymentCheckCard,children:[u.jsx("div",{children:"Bank Transfer"}),u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 408.576 408.576",children:u.jsx("g",{children:u.jsx("path",{d:"M204.288 0C91.648 0 0 91.648 0 204.288s91.648 204.288 204.288 204.288 204.288-91.648 204.288-204.288S316.928 0 204.288 0zm114.176 150.528-130.56 129.536c-7.68 7.68-19.968 8.192-28.16.512L90.624 217.6c-8.192-7.68-8.704-20.48-1.536-28.672 7.68-8.192 20.48-8.704 28.672-1.024l54.784 50.176L289.28 121.344c8.192-8.192 20.992-8.192 29.184 0s8.192 20.992 0 29.184z",fill:"#22BB33"})})})]})})]})]})]}),u.jsxs("div",{className:p.offRampFieldCard,children:[u.jsxs("div",{className:p.offRampFieldBox,children:[u.jsx("div",{className:p.offRampFieldLabel,children:"You Receive ( estimate )"}),u.jsx("div",{className:p.offRampFieldForm,children:re?u.jsx(tr,{size:20}):u.jsx("input",{type:"text",className:p.inputControl,value:(null==pe?void 0:pe.min)||(null==pe?void 0:pe.max)?0:Number(ee)&&Number(ee)>0?null==ee?void 0:ee.toFixed(4):0,disabled:!0})})]}),u.jsx("div",{className:p.offRampFieldSelectCard,children:u.jsx("div",{className:p.offRampFieldSelect,children:(null==W?void 0:W.length)>0?u.jsx(Si,{backgroundColor:"var(--primary-set-color)",colorvalue:"var(--off-white)",placeholder:"Select",borderColor:"var(--no-color)",svgFill:"var(--off-white)",image:!0,singleicons:!0,options:W,value:Q,isSearchable:!1,onChange:function(e){!function(e){var t,n,i=null===(t=null==y?void 0:y.currencies)||void 0===t?void 0:t.find((function(t){return(null==t?void 0:t.unique_id)===(null==e?void 0:e.value)}));C(m(m({},G),{selectedFiat:(null===(n=null==i?void 0:i.supported_currency)||void 0===n?void 0:n.code)||""})),R(e)}(e)},isDisabled:h||re}):u.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center"},children:u.jsx(Ki,{})})})})]}),u.jsxs("div",{style:{marginTop:20},className:p.off_info_card,children:[u.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"30",height:"30",viewBox:"0 0 32 32",children:u.jsxs("g",{id:"Layer_20","data-name":"Layer 20",children:[u.jsx("path",{fill:"#fbd63b",d:"M28 28H4L16 6z"}),u.jsx("path",{fill:"#f8be31",d:"m16 6 12 22H16z"}),u.jsx("path",{fill:"#333",d:"m16 21-2-7h4z"}),u.jsx("circle",{cx:"16",cy:"25",r:"1",fill:"#333"}),u.jsx("path",{d:"M16 14h2l-2 7zM16 24a1 1 0 0 1 0 2z"})]})}),u.jsx("div",{className:p.off_caution_info,children:"Cryptocurrencies are volatile, and prices can change rapidly, make sure to research and understand the market risks."})]}),u.jsx("div",{className:p.offRampAction,children:u.jsx("button",{className:"".concat(p.actionBtn," ").concat(p.primary),onClick:function(){parseFloat(G.from_amount)>0?(C(m(m({},G),{to_currency_conversion_value:ee,exchange_rate:K})),g(2)):l("Please enter valid amount","error")},disabled:h||!(j>0)||pe.min||pe.max,children:"Sell Now"})})]}):2===b?u.jsx(io,{defaultTab:"select",setStep:g,data:G,apiKey:o,clientReferenceID:r,setTokenSellData:C,mode:a}):3===b?u.jsx(Ao,{tokenSellData:G,setTokenSellData:C,apiKey:o,clientReferenceID:r,setStep:g,mode:a}):4===b?u.jsx(Oi,{tokenSellData:G}):null})},ir=function(e){var t=e.apiKey,n=e.sellParameters,i=e.clientReferenceID,o=e.mode;return u.jsx(nr,{apiKey:t,parameters:n,clientReferenceID:i,mode:o})};exports.SellCryptoWidget=function(e){var t=e.apiKey,n=e.sellParameters,i=e.clientReferenceID,o=e.mode,s=void 0===o?"development":o;return u.jsx("div",{style:{position:"relative"},className:p.widgetComponent,id:"widget-container",children:u.jsx(Ti,{children:u.jsx(ir,{sellParameters:n,apiKey:t,clientReferenceID:i,mode:s})})})};
|
24
24
|
//# sourceMappingURL=index.js.map
|