@stakekit/widget 0.0.286 → 0.0.288

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.
Files changed (89) hide show
  1. package/dist/bundle/Result-D66k67e4.js +3 -0
  2. package/dist/bundle/Schema-CnO1Nnkx.js +2 -0
  3. package/dist/bundle/{cardano-connector-Cg1NVNSz.js → cardano-connector-BdmhtPwK.js} +1 -1
  4. package/dist/{website/assets/configured-chains-C5lih9lm.js → bundle/configured-chains-BVaAJPl7.js} +1 -1
  5. package/dist/bundle/{cosmos-connector-meta-B3hXlZyj.js → cosmos-connector-meta-CsjY5xv_.js} +1 -1
  6. package/dist/bundle/{current-value-stream-sEIwrVMJ.js → current-value-stream-BphKxe9G.js} +1 -1
  7. package/dist/bundle/{esm-B8ixy8Ti.js → esm-BioWy-zm.js} +1 -1
  8. package/dist/bundle/index.bundle.css +1 -1
  9. package/dist/bundle/index.bundle.js +132 -100
  10. package/dist/bundle/{ledger-connector-ScKbHFK2.js → ledger-connector-BeFXqMQm.js} +2 -2
  11. package/dist/bundle/{network-DRjEa3NO.js → network-BR2dx0lQ.js} +1 -1
  12. package/dist/bundle/{polkadot-ledger-transaction-CSI9csNM.js → polkadot-ledger-transaction-CCpzhicj.js} +1 -1
  13. package/dist/bundle/{safe-connector-BuI_vM2N.js → safe-connector-BW8tBAGV.js} +1 -1
  14. package/dist/bundle/{solana-connector-BXIkWGi1.js → solana-connector-CEoNnJWx.js} +1 -1
  15. package/dist/bundle/{stellar-connector-D5G2p6aO.js → stellar-connector-C3GFN35d.js} +1 -1
  16. package/dist/bundle/{substrate-connector-AJ6EWjQP.js → substrate-connector-B7COXHL7.js} +1 -1
  17. package/dist/{website/assets/ton-connector-DWz2WVCw.js → bundle/ton-connector-DnPSYtXm.js} +1 -1
  18. package/dist/bundle/transaction-3CLRKFvX.js +1 -0
  19. package/dist/{website/assets/transaction-BJ3RmuAw.js → bundle/transaction-BDuN1rLk.js} +2 -2
  20. package/dist/bundle/{transaction-NX-vBbnh.js → transaction-DU8AaOQz.js} +1 -1
  21. package/dist/bundle/{tron-connector-nZfhLwx4.js → tron-connector-iA7bb0__.js} +1 -1
  22. package/dist/bundle/{utils-CfBIlQsz.js → utils-llPzGe7v.js} +1 -1
  23. package/dist/bundle/wagmi-connect-result-DOu6hDDM.js +11 -0
  24. package/dist/bundle/{wallet-errors-Bvwwydi9.js → wallet-errors-MrbcJr3I.js} +1 -1
  25. package/dist/bundle/{wallet-manager-C-MB05Qs.js → wallet-manager-D2AeCPRs.js} +2 -2
  26. package/dist/package/{Result-Cem4lYBf.js → Result-BA6lrqKV.js} +117 -49
  27. package/dist/package/{Schema-DFoi51wt.js → Schema-CUut1r-H.js} +1135 -1310
  28. package/dist/package/{cardano-connector-B9UToMFP.js → cardano-connector-ApyBIRYL.js} +3 -3
  29. package/dist/package/{configured-chains-BfQ8ESmR.js → configured-chains-CeRB7Tdy.js} +1 -1
  30. package/dist/package/{cosmos-connector-meta-UMFrkViG.js → cosmos-connector-meta-NNACISY5.js} +1 -1
  31. package/dist/package/{current-value-stream-BPaLLDf4.js → current-value-stream-Cs2IFPhP.js} +1 -1
  32. package/dist/package/{esm-89IrCtWy.js → esm-3BtHXmV9.js} +1 -1
  33. package/dist/package/index.package.css +21 -0
  34. package/dist/package/index.package.js +8469 -3828
  35. package/dist/package/{ledger-connector-B8D8xJOD.js → ledger-connector-ebEnv7IA.js} +9 -9
  36. package/dist/package/{network-DiYap-9L.js → network-Df21Fcdz.js} +1 -1
  37. package/dist/package/{polkadot-ledger-transaction-Bi14PyTF.js → polkadot-ledger-transaction-Cq_ImU8s.js} +1 -1
  38. package/dist/package/{safe-connector-lVCS_bS5.js → safe-connector-CMgopygU.js} +4 -4
  39. package/dist/package/{solana-connector-P-TqgNNC.js → solana-connector-B2Rf5Tyj.js} +3 -3
  40. package/dist/package/{stellar-connector-BMB2Cql4.js → stellar-connector-DdzqZgoG.js} +4 -4
  41. package/dist/package/{substrate-connector-a7SNpKjf.js → substrate-connector-DO7OAvZ9.js} +2 -2
  42. package/dist/package/{ton-connector-CMzOI2bi.js → ton-connector-CUtYVysK.js} +5 -5
  43. package/dist/package/{transaction-CmOScFm6.js → transaction-BjGgdyu0.js} +5 -5
  44. package/dist/package/{transaction-Do9wZHM8.js → transaction-MMiSjtGI.js} +1 -1
  45. package/dist/package/{transaction-C1e6h8J1.js → transaction-fIZimEky.js} +1 -1
  46. package/dist/package/{tron-connector-PLpMhB65.js → tron-connector-DT1NdAaP.js} +2 -2
  47. package/dist/package/{wagmi-connect-result-BJ91_jis.js → wagmi-connect-result-Bh6qH5iI.js} +593 -462
  48. package/dist/package/{wallet-errors-B4cGcGNy.js → wallet-errors-BMdJQ_kv.js} +1 -1
  49. package/dist/package/{wallet-manager-BsDss9DQ.js → wallet-manager-BbL7EBi6.js} +5 -5
  50. package/dist/types/domain/network/network.d.ts +2 -2
  51. package/dist/types/generated/api/legacy-schema.d.ts +3503 -1952
  52. package/dist/types/generated/api/yield-schema.d.ts +1492 -1113
  53. package/dist/types/public-api/types.d.ts +2 -2
  54. package/dist/website/assets/Result-D66k67e4.js +3 -0
  55. package/dist/website/assets/Schema-CnO1Nnkx.js +2 -0
  56. package/dist/website/assets/{cardano-connector-JluaLQJr.js → cardano-connector-DkgQsbib.js} +1 -1
  57. package/dist/{bundle/configured-chains-C5lih9lm.js → website/assets/configured-chains-BVaAJPl7.js} +1 -1
  58. package/dist/website/assets/{cosmos-connector-meta-B3hXlZyj.js → cosmos-connector-meta-CsjY5xv_.js} +1 -1
  59. package/dist/website/assets/{current-value-stream-sEIwrVMJ.js → current-value-stream-BphKxe9G.js} +1 -1
  60. package/dist/website/assets/{esm-DmRWC3up.js → esm-DJUTv1_r.js} +1 -1
  61. package/dist/website/assets/{index-CYwddl65.css → index-B_e-5cjt.css} +1 -1
  62. package/dist/website/assets/index-Ifmhd5nI.js +592 -0
  63. package/dist/website/assets/{ledger-connector-zHWvy_21.js → ledger-connector-CMFH1Z0M.js} +3 -3
  64. package/dist/website/assets/{network-DRjEa3NO.js → network-BR2dx0lQ.js} +1 -1
  65. package/dist/website/assets/{polkadot-ledger-transaction-CSI9csNM.js → polkadot-ledger-transaction-CCpzhicj.js} +1 -1
  66. package/dist/website/assets/{safe-connector-B_IWbdsx.js → safe-connector-BDc3OqKV.js} +1 -1
  67. package/dist/website/assets/{solana-connector-DUrUEFXI.js → solana-connector-Ij-Dm1HM.js} +1 -1
  68. package/dist/website/assets/{stellar-connector-D5G2p6aO.js → stellar-connector-C3GFN35d.js} +1 -1
  69. package/dist/website/assets/{substrate-connector-DxgYUQY4.js → substrate-connector-B-LTNtpz.js} +1 -1
  70. package/dist/{bundle/ton-connector-DWz2WVCw.js → website/assets/ton-connector-DnPSYtXm.js} +1 -1
  71. package/dist/{bundle/transaction-BJ3RmuAw.js → website/assets/transaction-BDuN1rLk.js} +2 -2
  72. package/dist/website/assets/{transaction-BIBBEBi6.js → transaction-Cth5mVGJ.js} +1 -1
  73. package/dist/website/assets/transaction-peV0IJTV.js +1 -0
  74. package/dist/website/assets/{tron-connector-C3nKPxdx.js → tron-connector-D_NeRPfc.js} +1 -1
  75. package/dist/website/assets/{utils-DVCp0qSW.js → utils-DOZR2zEE.js} +1 -1
  76. package/dist/website/assets/wagmi-connect-result-DOu6hDDM.js +11 -0
  77. package/dist/website/assets/{wallet-errors-Bvwwydi9.js → wallet-errors-MrbcJr3I.js} +1 -1
  78. package/dist/website/assets/{wallet-manager-9-XcN6SR.js → wallet-manager-DGQAWJIz.js} +3 -3
  79. package/dist/website/index.html +13 -13
  80. package/package.json +12 -11
  81. package/dist/bundle/Result-3MQjLy1V.js +0 -3
  82. package/dist/bundle/Schema-DgreXIef.js +0 -2
  83. package/dist/bundle/transaction-BnkP6nIP.js +0 -1
  84. package/dist/bundle/wagmi-connect-result-CqXaJhOa.js +0 -11
  85. package/dist/website/assets/Result-3MQjLy1V.js +0 -3
  86. package/dist/website/assets/Schema-DgreXIef.js +0 -2
  87. package/dist/website/assets/index-DtK-tGS5.js +0 -560
  88. package/dist/website/assets/transaction-Sqg4_vo7.js +0 -1
  89. package/dist/website/assets/wagmi-connect-result-CqXaJhOa.js +0 -11
@@ -1,4 +1,4 @@
1
- import{t as e}from"./rolldown-runtime-BcKkbAw3.js";import{c as t,d as n,i as r,l as i,r as a,t as o}from"./Result-3MQjLy1V.js";import{At as s,Fn as c,Gt as l,Pt as u,Wt as d,Zt as f,_t as p,en as m,n as h,sa as g,t as _,x as v}from"./wagmi-connect-result-CqXaJhOa.js";import{C as y,E as b,J as x,L as S,M as C,R as w,Ut as T,W as ee,l as E,st as D,v as O,w as te}from"./Schema-DgreXIef.js";import{C as ne,T as re,b as ie,c as ae,l as oe,n as se,s as ce,t as le,u as ue,x as de}from"./transaction-BnkP6nIP.js";import{r as fe}from"./assets-CaBpoNKF.js";import{a as pe,o as me}from"./network-DRjEa3NO.js";import{dn as he}from"./ccip-BxB3ZbpJ.js";import{r as k,t as A}from"./dist-KkMRwAp9.js";import{t as ge}from"./Transport-DCf5RHQn.js";import{a as _e}from"./wallet-errors-Bvwwydi9.js";import{t as ve}from"./current-value-stream-sEIwrVMJ.js";import{a as ye,i as be,n as xe}from"./transaction-BJ3RmuAw.js";var Se=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Ce=Math.ceil,we=Math.floor,Te=`[BigNumber Error] `,Ee=Te+`Number primitive has more than 15 significant digits: `,De=0x5af3107a4000,j=14,Oe=9007199254740991,ke=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,0xe8d4a51000,0x9184e72a000],Ae=1e7,M=1e9;function je(e){var t,n,r,i=v.prototype={constructor:v,toString:null,valueOf:null},a=new v(1),o=20,s=4,c=-7,l=21,u=-1e7,d=1e7,f=!1,p=1,m=0,h={prefix:``,groupSize:3,secondaryGroupSize:0,groupSeparator:`,`,decimalSeparator:`.`,fractionGroupSize:0,fractionGroupSeparator:`\xA0`,suffix:``},g=`0123456789abcdefghijklmnopqrstuvwxyz`,_=!0;function v(e,t){var i,a,c,l,f,p,m,h,y=this;if(!(y instanceof v))return new v(e,t);if(t==null){if(e&&e._isBigNumber===!0){y.s=e.s,!e.c||e.e>d?y.c=y.e=null:e.e<u?y.c=[y.e=0]:(y.e=e.e,y.c=e.c.slice());return}if((p=typeof e==`number`)&&e*0==0){if(y.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,f=e;f>=10;f/=10,l++);l>d?y.c=y.e=null:(y.e=l,y.c=[e]);return}h=String(e)}else{if(!Se.test(h=String(e)))return r(y,h,p);y.s=h.charCodeAt(0)==45?(h=h.slice(1),-1):1}(l=h.indexOf(`.`))>-1&&(h=h.replace(`.`,``)),(f=h.search(/e/i))>0?(l<0&&(l=f),l+=+h.slice(f+1),h=h.substring(0,f)):l<0&&(l=h.length)}else{if(N(t,2,g.length,`Base`),t==10&&_)return y=new v(e),S(y,o+y.e+1,s);if(h=String(e),p=typeof e==`number`){if(e*0!=0)return r(y,h,p,t);if(y.s=1/e<0?(h=h.slice(1),-1):1,v.DEBUG&&h.replace(/^0\.0*|\./,``).length>15)throw Error(Ee+e)}else y.s=h.charCodeAt(0)===45?(h=h.slice(1),-1):1;for(i=g.slice(0,t),l=f=0,m=h.length;f<m;f++)if(i.indexOf(a=h.charAt(f))<0){if(a==`.`){if(f>l){l=m;continue}}else if(!c&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){c=!0,f=-1,l=0;continue}return r(y,String(e),p,t)}p=!1,h=n(h,t,10,y.s),(l=h.indexOf(`.`))>-1?h=h.replace(`.`,``):l=h.length}for(f=0;h.charCodeAt(f)===48;f++);for(m=h.length;h.charCodeAt(--m)===48;);if(h=h.slice(f,++m)){if(m-=f,p&&v.DEBUG&&m>15&&(e>Oe||e!==we(e)))throw Error(Ee+y.s*e);if((l=l-f-1)>d)y.c=y.e=null;else if(l<u)y.c=[y.e=0];else{if(y.e=l,y.c=[],f=(l+1)%j,l<0&&(f+=j),f<m){for(f&&y.c.push(+h.slice(0,f)),m-=j;f<m;)y.c.push(+h.slice(f,f+=j));f=j-(h=h.slice(f)).length}else f-=m;for(;f--;h+=`0`);y.c.push(+h)}}else y.c=[y.e=0]}v.clone=je,v.ROUND_UP=0,v.ROUND_DOWN=1,v.ROUND_CEIL=2,v.ROUND_FLOOR=3,v.ROUND_HALF_UP=4,v.ROUND_HALF_DOWN=5,v.ROUND_HALF_EVEN=6,v.ROUND_HALF_CEIL=7,v.ROUND_HALF_FLOOR=8,v.EUCLID=9,v.config=v.set=function(e){var t,n;if(e!=null){if(typeof e==`object`){if(e.hasOwnProperty(t=`DECIMAL_PLACES`)&&(n=e[t],N(n,0,M,t),o=n),e.hasOwnProperty(t=`ROUNDING_MODE`)&&(n=e[t],N(n,0,8,t),s=n),e.hasOwnProperty(t=`EXPONENTIAL_AT`)&&(n=e[t],n&&n.pop?(N(n[0],-M,0,t),N(n[1],0,M,t),c=n[0],l=n[1]):(N(n,-M,M,t),c=-(l=n<0?-n:n))),e.hasOwnProperty(t=`RANGE`)){if(n=e[t],n&&n.pop)N(n[0],-M,-1,t),N(n[1],1,M,t),u=n[0],d=n[1];else if(N(n,-M,M,t),n)u=-(d=n<0?-n:n);else throw Error(Te+t+` cannot be zero: `+n)}if(e.hasOwnProperty(t=`CRYPTO`)){if(n=e[t],n===!!n){if(n){if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=n;else throw f=!n,Error(Te+`crypto unavailable`)}else f=n}else throw Error(Te+t+` not true or false: `+n)}if(e.hasOwnProperty(t=`MODULO_MODE`)&&(n=e[t],N(n,0,9,t),p=n),e.hasOwnProperty(t=`POW_PRECISION`)&&(n=e[t],N(n,0,M,t),m=n),e.hasOwnProperty(t=`FORMAT`)){if(n=e[t],typeof n==`object`)h=n;else throw Error(Te+t+` not an object: `+n)}if(e.hasOwnProperty(t=`ALPHABET`)){if(n=e[t],typeof n==`string`&&!/^.?$|[+\-.\s]|(.).*\1/.test(n))_=n.slice(0,10)==`0123456789`,g=n;else throw Error(Te+t+` invalid: `+n)}}else throw Error(Te+`Object expected: `+e)}return{DECIMAL_PLACES:o,ROUNDING_MODE:s,EXPONENTIAL_AT:[c,l],RANGE:[u,d],CRYPTO:f,MODULO_MODE:p,POW_PRECISION:m,FORMAT:h,ALPHABET:g}},v.isBigNumber=function(e){if(!e||e._isBigNumber!==!0)return!1;if(!v.DEBUG)return!0;var t,n,r=e.c,i=e.e,a=e.s;out:if({}.toString.call(r)==`[object Array]`){if((a===1||a===-1)&&i>=-M&&i<=M&&i===we(i)){if(r[0]===0){if(i===0&&r.length===1)return!0;break out}if(t=(i+1)%j,t<1&&(t+=j),String(r[0]).length==t){for(t=0;t<r.length;t++)if(n=r[t],n<0||n>=De||n!==we(n))break out;if(n!==0)return!0}}}else if(r===null&&i===null&&(a===null||a===1||a===-1))return!0;throw Error(Te+`Invalid BigNumber: `+e)},v.maximum=v.max=function(){return b(arguments,-1)},v.minimum=v.min=function(){return b(arguments,1)},v.random=(function(){var e=9007199254740992,t=Math.random()*e&2097151?function(){return we(Math.random()*e)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(e){var n,r,i,s,c,l=0,u=[],d=new v(a);if(e==null?e=o:N(e,0,M),s=Ce(e/j),f){if(crypto.getRandomValues){for(n=crypto.getRandomValues(new Uint32Array(s*=2));l<s;)c=n[l]*131072+(n[l+1]>>>11),c>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),n[l]=r[0],n[l+1]=r[1]):(u.push(c%0x5af3107a4000),l+=2);l=s/2}else if(crypto.randomBytes){for(n=crypto.randomBytes(s*=7);l<s;)c=(n[l]&31)*281474976710656+n[l+1]*1099511627776+n[l+2]*4294967296+n[l+3]*16777216+(n[l+4]<<16)+(n[l+5]<<8)+n[l+6],c>=9e15?crypto.randomBytes(7).copy(n,l):(u.push(c%0x5af3107a4000),l+=7);l=s/7}else throw f=!1,Error(Te+`crypto unavailable`)}if(!f)for(;l<s;)c=t(),c<9e15&&(u[l++]=c%0x5af3107a4000);for(s=u[--l],e%=j,s&&e&&(c=ke[j-e],u[l]=we(s/c)*c);u[l]===0;u.pop(),l--);if(l<0)u=[i=0];else{for(i=-1;u[0]===0;u.splice(0,1),i-=j);for(l=1,c=u[0];c>=10;c/=10,l++);l<j&&(i-=j-l)}return d.e=i,d.c=u,d}})(),v.sum=function(){for(var e=1,t=arguments,n=new v(t[0]);e<t.length;)n=n.plus(t[e++]);return n},n=(function(){var e=`0123456789`;function n(e,t,n,r){for(var i,a=[0],o,s=0,c=e.length;s<c;){for(o=a.length;o--;a[o]*=t);for(a[0]+=r.indexOf(e.charAt(s++)),i=0;i<a.length;i++)a[i]>n-1&&(a[i+1]??(a[i+1]=0),a[i+1]+=a[i]/n|0,a[i]%=n)}return a.reverse()}return function(r,i,a,c,l){var u,d,f,p,h,_,y,b,x=r.indexOf(`.`),S=o,C=s;for(x>=0&&(p=m,m=0,r=r.replace(`.`,``),b=new v(i),_=b.pow(r.length-x),m=p,b.c=n(Le(Ne(_.c),_.e,`0`),10,a,e),b.e=b.c.length),y=n(r,i,a,l?(u=g,e):(u=e,g)),f=p=y.length;y[--p]==0;y.pop());if(!y[0])return u.charAt(0);if(x<0?--f:(_.c=y,_.e=f,_.s=c,_=t(_,b,S,C,a),y=_.c,h=_.r,f=_.e),d=f+S+1,x=y[d],p=a/2,h=h||d<0||y[d+1]!=null,h=C<4?(x!=null||h)&&(C==0||C==(_.s<0?3:2)):x>p||x==p&&(C==4||h||C==6&&y[d-1]&1||C==(_.s<0?8:7)),d<1||!y[0])r=h?Le(u.charAt(1),-S,u.charAt(0)):u.charAt(0);else{if(y.length=d,h)for(--a;++y[--d]>a;)y[d]=0,d||(++f,y=[1].concat(y));for(p=y.length;!y[--p];);for(x=0,r=``;x<=p;r+=u.charAt(y[x++]));r=Le(r,f,u.charAt(0))}return r}})(),t=(function(){function e(e,t,n){var r,i,a,o,s=0,c=e.length,l=t%Ae,u=t/Ae|0;for(e=e.slice();c--;)a=e[c]%Ae,o=e[c]/Ae|0,r=u*a+o*l,i=l*a+r%Ae*Ae+s,s=(i/n|0)+(r/Ae|0)+u*o,e[c]=i%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=+(e[n]<t[n]),e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,i,a,o,s){var c,l,u,d,f,p,m,h,g,_,y,b,x,C,w,T,ee,E=r.s==i.s?1:-1,D=r.c,O=i.c;if(!D||!D[0]||!O||!O[0])return new v(!r.s||!i.s||(D?O&&D[0]==O[0]:!O)?NaN:D&&D[0]==0||!O?E*0:E/0);for(h=new v(E),g=h.c=[],l=r.e-i.e,E=a+l+1,s||(s=De,l=Me(r.e/j)-Me(i.e/j),E=E/j|0),u=0;O[u]==(D[u]||0);u++);if(O[u]>(D[u]||0)&&l--,E<0)g.push(1),d=!0;else{for(C=D.length,T=O.length,u=0,E+=2,f=we(s/(O[0]+1)),f>1&&(O=e(O,f,s),D=e(D,f,s),T=O.length,C=D.length),x=T,_=D.slice(0,T),y=_.length;y<T;_[y++]=0);ee=O.slice(),ee=[0].concat(ee),w=O[0],O[1]>=s/2&&w++;do{if(f=0,c=t(O,_,T,y),c<0){if(b=_[0],T!=y&&(b=b*s+(_[1]||0)),f=we(b/w),f>1)for(f>=s&&(f=s-1),p=e(O,f,s),m=p.length,y=_.length;t(p,_,m,y)==1;)f--,n(p,T<m?ee:O,m,s),m=p.length,c=1;else f==0&&(c=f=1),p=O.slice(),m=p.length;if(m<y&&(p=[0].concat(p)),n(_,p,y,s),y=_.length,c==-1)for(;t(O,_,T,y)<1;)f++,n(_,T<y?ee:O,y,s),y=_.length}else c===0&&(f++,_=[0]);g[u++]=f,_[0]?_[y++]=D[x]||0:(_=[D[x]],y=1)}while((x++<C||_[0]!=null)&&E--);d=_[0]!=null,g[0]||g.splice(0,1)}if(s==De){for(u=1,E=g[0];E>=10;E/=10,u++);S(h,a+(h.e=u+l*j-1)+1,o,d)}else h.e=l,h.r=+d;return h}})();function y(e,t,n,r){var i,a,o,u,d;if(n==null?n=s:N(n,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,t==null)d=Ne(e.c),d=r==1||r==2&&(o<=c||o>=l)?Ie(d,o):Le(d,o,`0`);else if(e=S(new v(e),t,n),a=e.e,d=Ne(e.c),u=d.length,r==1||r==2&&(t<=a||a<=c)){for(;u<t;d+=`0`,u++);d=Ie(d,a)}else if(t-=o+(r===2&&a>o),d=Le(d,a,`0`),a+1>u){if(--t>0)for(d+=`.`;t--;d+=`0`);}else if(t+=a-u,t>0)for(a+1==u&&(d+=`.`);t--;d+=`0`);return e.s<0&&i?`-`+d:d}function b(e,t){for(var n,r,i=1,a=new v(e[0]);i<e.length;i++)r=new v(e[i]),(!r.s||(n=Pe(a,r))===t||n===0&&a.s===t)&&(a=r);return a}function x(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*j-1)>d?e.c=e.e=null:n<u?e.c=[e.e=0]:(e.e=n,e.c=t),e}r=(function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,n=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(a,o,s,c){var l,u=s?o:o.replace(i,``);if(r.test(u))a.s=isNaN(u)?null:u<0?-1:1;else{if(!s&&(u=u.replace(e,function(e,t,n){return l=(n=n.toLowerCase())==`x`?16:n==`b`?2:8,!c||c==l?t:e}),c&&(l=c,u=u.replace(t,`$1`).replace(n,`0.$1`)),o!=u))return new v(u,l);if(v.DEBUG)throw Error(Te+`Not a`+(c?` base `+c:``)+` number: `+o);a.s=null}a.c=a.e=null}})();function S(e,t,n,r){var i,a,o,s,c,l,f,p=e.c,m=ke;if(p){out:{for(i=1,s=p[0];s>=10;s/=10,i++);if(a=t-i,a<0)a+=j,o=t,c=p[l=0],f=we(c/m[i-o-1]%10);else if(l=Ce((a+1)/j),l>=p.length){if(r){for(;p.length<=l;p.push(0));c=f=0,i=1,a%=j,o=a-j+1}else break out}else{for(c=s=p[l],i=1;s>=10;s/=10,i++);a%=j,o=a-j+i,f=o<0?0:we(c/m[i-o-1]%10)}if(r=r||t<0||p[l+1]!=null||(o<0?c:c%m[i-o-1]),r=n<4?(f||r)&&(n==0||n==(e.s<0?3:2)):f>5||f==5&&(n==4||r||n==6&&(a>0?o>0?c/m[i-o]:0:p[l-1])%10&1||n==(e.s<0?8:7)),t<1||!p[0])return p.length=0,r?(t-=e.e+1,p[0]=m[(j-t%j)%j],e.e=-t||0):p[0]=e.e=0,e;if(a==0?(p.length=l,s=1,l--):(p.length=l+1,s=m[j-a],p[l]=o>0?we(c/m[i-o]%m[o])*s:0),r)for(;;)if(l==0){for(a=1,o=p[0];o>=10;o/=10,a++);for(o=p[0]+=s,s=1;o>=10;o/=10,s++);a!=s&&(e.e++,p[0]==De&&(p[0]=1));break}else{if(p[l]+=s,p[l]!=De)break;p[l--]=0,s=1}for(a=p.length;p[--a]===0;p.pop());}e.e>d?e.c=e.e=null:e.e<u&&(e.c=[e.e=0])}return e}function C(e){var t,n=e.e;return n===null?e.toString():(t=Ne(e.c),t=n<=c||n>=l?Ie(t,n):Le(t,n,`0`),e.s<0?`-`+t:t)}return i.absoluteValue=i.abs=function(){var e=new v(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return Pe(this,new v(e,t))},i.decimalPlaces=i.dp=function(e,t){var n,r,i,a=this;if(e!=null)return N(e,0,M),t==null?t=s:N(t,0,8),S(new v(a),e+a.e+1,t);if(!(n=a.c))return null;if(r=((i=n.length-1)-Me(this.e/j))*j,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},i.dividedBy=i.div=function(e,n){return t(this,new v(e,n),o,s)},i.dividedToIntegerBy=i.idiv=function(e,n){return t(this,new v(e,n),0,1)},i.exponentiatedBy=i.pow=function(e,t){var n,r,i,o,c,l,u,d,f,p=this;if(e=new v(e),e.c&&!e.isInteger())throw Error(Te+`Exponent not an integer: `+C(e));if(t!=null&&(t=new v(t)),l=e.e>14,!p.c||!p.c[0]||p.c[0]==1&&!p.e&&p.c.length==1||!e.c||!e.c[0])return f=new v(C(p)**(l?e.s*(2-Fe(e)):+C(e))),t?f.mod(t):f;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new v(NaN);r=!u&&p.isInteger()&&t.isInteger(),r&&(p=p.mod(t))}else if(e.e>9&&(p.e>0||p.e<-1||(p.e==0?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return o=p.s<0&&Fe(e)?-0:0,p.e>-1&&(o=1/o),new v(u?1/o:o);else m&&(o=Ce(m/j+2));for(l?(n=new v(.5),u&&(e.s=1),d=Fe(e)):(i=Math.abs(+C(e)),d=i%2),f=new v(a);;){if(d){if(f=f.times(p),!f.c)break;o?f.c.length>o&&(f.c.length=o):r&&(f=f.mod(t))}if(i){if(i=we(i/2),i===0)break;d=i%2}else if(e=e.times(n),S(e,e.e+1,1),e.e>14)d=Fe(e);else{if(i=+C(e),i===0)break;d=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(t))}return r?f:(u&&(f=a.div(f)),t?f.mod(t):o?S(f,m,s,c):f)},i.integerValue=function(e){var t=new v(this);return e==null?e=s:N(e,0,8),S(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return Pe(this,new v(e,t))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return Pe(this,new v(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return(t=Pe(this,new v(e,t)))===1||t===0},i.isInteger=function(){return!!this.c&&Me(this.e/j)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return Pe(this,new v(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return(t=Pe(this,new v(e,t)))===-1||t===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(e,t){var n,r,i,a,o=this,c=o.s;if(e=new v(e,t),t=e.s,!c||!t)return new v(NaN);if(c!=t)return e.s=-t,o.plus(e);var l=o.e/j,u=e.e/j,d=o.c,f=e.c;if(!l||!u){if(!d||!f)return d?(e.s=-t,e):new v(f?o:NaN);if(!d[0]||!f[0])return f[0]?(e.s=-t,e):new v(d[0]?o:s==3?-0:0)}if(l=Me(l),u=Me(u),d=d.slice(),c=l-u){for((a=c<0)?(c=-c,i=d):(u=l,i=f),i.reverse(),t=c;t--;i.push(0));i.reverse()}else for(r=(a=(c=d.length)<(t=f.length))?c:t,c=t=0;t<r;t++)if(d[t]!=f[t]){a=d[t]<f[t];break}if(a&&(i=d,d=f,f=i,e.s=-e.s),t=(r=f.length)-(n=d.length),t>0)for(;t--;d[n++]=0);for(t=De-1;r>c;){if(d[--r]<f[r]){for(n=r;n&&!d[--n];d[n]=t);--d[n],d[r]+=De}d[r]-=f[r]}for(;d[0]==0;d.splice(0,1),--u);return d[0]?x(e,d,u):(e.s=s==3?-1:1,e.c=[e.e=0],e)},i.modulo=i.mod=function(e,n){var r,i,a=this;return e=new v(e,n),!a.c||!e.s||e.c&&!e.c[0]?new v(NaN):!e.c||a.c&&!a.c[0]?new v(a):(p==9?(i=e.s,e.s=1,r=t(a,e,0,3),e.s=i,r.s*=i):r=t(a,e,0,p),e=a.minus(r.times(e)),!e.c[0]&&p==1&&(e.s=a.s),e)},i.multipliedBy=i.times=function(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=this,y=_.c,b=(e=new v(e,t)).c;if(!y||!b||!y[0]||!b[0])return!_.s||!e.s||y&&!y[0]&&!b||b&&!b[0]&&!y?e.c=e.e=e.s=null:(e.s*=_.s,!y||!b?e.c=e.e=null:(e.c=[0],e.e=0)),e;for(r=Me(_.e/j)+Me(e.e/j),e.s*=_.s,c=y.length,d=b.length,c<d&&(m=y,y=b,b=m,i=c,c=d,d=i),i=c+d,m=[];i--;m.push(0));for(h=De,g=Ae,i=d;--i>=0;){for(n=0,f=b[i]%g,p=b[i]/g|0,o=c,a=i+o;a>i;)l=y[--o]%g,u=y[o]/g|0,s=p*l+u*f,l=f*l+s%g*g+m[a]+n,n=(l/h|0)+(s/g|0)+p*u,m[a--]=l%h;m[a]=n}return n?++r:m.splice(0,1),x(e,m,r)},i.negated=function(){var e=new v(this);return e.s=-e.s||null,e},i.plus=function(e,t){var n,r=this,i=r.s;if(e=new v(e,t),t=e.s,!i||!t)return new v(NaN);if(i!=t)return e.s=-t,r.minus(e);var a=r.e/j,o=e.e/j,s=r.c,c=e.c;if(!a||!o){if(!s||!c)return new v(i/0);if(!s[0]||!c[0])return c[0]?e:new v(s[0]?r:i*0)}if(a=Me(a),o=Me(o),s=s.slice(),i=a-o){for(i>0?(o=a,n=c):(i=-i,n=s),n.reverse();i--;n.push(0));n.reverse()}for(i=s.length,t=c.length,i-t<0&&(n=c,c=s,s=n,t=i),i=0;t;)i=(s[--t]=s[t]+c[t]+i)/De|0,s[t]=De===s[t]?0:s[t]%De;return i&&(s=[i].concat(s),++o),x(e,s,o)},i.precision=i.sd=function(e,t){var n,r,i,a=this;if(e!=null&&e!==!!e)return N(e,1,M),t==null?t=s:N(t,0,8),S(new v(a),e,t);if(!(n=a.c))return null;if(i=n.length-1,r=i*j+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&a.e+1>r&&(r=a.e+1),r},i.shiftedBy=function(e){return N(e,-Oe,Oe),this.times(`1e`+e)},i.squareRoot=i.sqrt=function(){var e,n,r,i,a,c=this,l=c.c,u=c.s,d=c.e,f=o+4,p=new v(`0.5`);if(u!==1||!l||!l[0])return new v(!u||u<0&&(!l||l[0])?NaN:l?c:1/0);if(u=Math.sqrt(+C(c)),u==0||u==1/0?(n=Ne(l),(n.length+d)%2==0&&(n+=`0`),u=Math.sqrt(+n),d=Me((d+1)/2)-(d<0||d%2),u==1/0?n=`5e`+d:(n=u.toExponential(),n=n.slice(0,n.indexOf(`e`)+1)+d),r=new v(n)):r=new v(u+``),r.c[0]){for(d=r.e,u=d+f,u<3&&(u=0);;)if(a=r,r=p.times(a.plus(t(c,a,f,1))),Ne(a.c).slice(0,u)===(n=Ne(r.c)).slice(0,u)){if(r.e<d&&--u,n=n.slice(u-3,u+1),n==`9999`||!i&&n==`4999`){if(!i&&(S(a,a.e+o+2,0),a.times(a).eq(c))){r=a;break}f+=4,u+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)==`5`)&&(S(r,r.e+o+2,1),e=!r.times(r).eq(c));break}}}return S(r,r.e+o+1,s,e)},i.toExponential=function(e,t){return e!=null&&(N(e,0,M),e++),y(this,e,t,1)},i.toFixed=function(e,t){return e!=null&&(N(e,0,M),e=e+this.e+1),y(this,e,t)},i.toFormat=function(e,t,n){var r,i=this;if(n==null)e!=null&&t&&typeof t==`object`?(n=t,t=null):e&&typeof e==`object`?(n=e,e=t=null):n=h;else if(typeof n!=`object`)throw Error(Te+`Argument not an object: `+n);if(r=i.toFixed(e,t),i.c){var a,o=r.split(`.`),s=+n.groupSize,c=+n.secondaryGroupSize,l=n.groupSeparator||``,u=o[0],d=o[1],f=i.s<0,p=f?u.slice(1):u,m=p.length;if(c&&(a=s,s=c,c=a,m-=a),s>0&&m>0){for(a=m%s||s,u=p.substr(0,a);a<m;a+=s)u+=l+p.substr(a,s);c>0&&(u+=l+p.slice(a)),f&&(u=`-`+u)}r=d?u+(n.decimalSeparator||``)+((c=+n.fractionGroupSize)?d.replace(RegExp(`\\d{`+c+`}\\B`,`g`),`$&`+(n.fractionGroupSeparator||``)):d):u}return(n.prefix||``)+r+(n.suffix||``)},i.toFraction=function(e){var n,r,i,o,c,l,u,f,p,m,h,g,_=this,y=_.c;if(e!=null&&(u=new v(e),!u.isInteger()&&(u.c||u.s!==1)||u.lt(a)))throw Error(Te+`Argument `+(u.isInteger()?`out of range: `:`not an integer: `)+C(u));if(!y)return new v(_);for(n=new v(a),p=r=new v(a),i=f=new v(a),g=Ne(y),c=n.e=g.length-_.e-1,n.c[0]=ke[(l=c%j)<0?j+l:l],e=!e||u.comparedTo(n)>0?c>0?n:p:u,l=d,d=1/0,u=new v(g),f.c[0]=0;m=t(u,n,0,1),o=r.plus(m.times(i)),o.comparedTo(e)!=1;)r=i,i=o,p=f.plus(m.times(o=p)),f=o,n=u.minus(m.times(o=n)),u=o;return o=t(e.minus(r),i,0,1),f=f.plus(o.times(p)),r=r.plus(o.times(i)),f.s=p.s=_.s,c*=2,h=t(p,i,c,s).minus(_).abs().comparedTo(t(f,r,c,s).minus(_).abs())<1?[p,i]:[f,r],d=l,h},i.toNumber=function(){return+C(this)},i.toPrecision=function(e,t){return e!=null&&N(e,1,M),y(this,e,t,2)},i.toString=function(e){var t,r=this,i=r.s,a=r.e;return a===null?i?(t=`Infinity`,i<0&&(t=`-`+t)):t=`NaN`:(e==null?t=a<=c||a>=l?Ie(Ne(r.c),a):Le(Ne(r.c),a,`0`):e===10&&_?(r=S(new v(r),o+a+1,s),t=Le(Ne(r.c),r.e,`0`)):(N(e,2,g.length,`Base`),t=n(Le(Ne(r.c),a,`0`),10,e,i,!0)),i<0&&r.c[0]&&(t=`-`+t)),t},i.valueOf=i.toJSON=function(){return C(this)},i._isBigNumber=!0,i[Symbol.toStringTag]=`BigNumber`,i[Symbol.for(`nodejs.util.inspect.custom`)]=i.valueOf,e!=null&&v.set(e),v}function Me(e){var t=e|0;return e>0||e===t?t:t-1}function Ne(e){for(var t,n,r=1,i=e.length,a=e[0]+``;r<i;){for(t=e[r++]+``,n=j-t.length;n--;t=`0`+t);a+=t}for(i=a.length;a.charCodeAt(--i)===48;);return a.slice(0,i+1||1)}function Pe(e,t){var n,r,i=e.c,a=t.c,o=e.s,s=t.s,c=e.e,l=t.e;if(!o||!s)return null;if(n=i&&!i[0],r=a&&!a[0],n||r)return n?r?0:-s:o;if(o!=s)return o;if(n=o<0,r=c==l,!i||!a)return r?0:!i^n?1:-1;if(!r)return c>l^n?1:-1;for(s=(c=i.length)<(l=a.length)?c:l,o=0;o<s;o++)if(i[o]!=a[o])return i[o]>a[o]^n?1:-1;return c==l?0:c>l^n?1:-1}function N(e,t,n,r){if(e<t||e>n||e!==we(e))throw Error(Te+(r||`Argument`)+(typeof e==`number`?e<t||e>n?` out of range: `:` not an integer: `:` not a primitive number: `)+String(e))}function Fe(e){var t=e.c.length-1;return Me(e.e/j)==t&&e.c[t]%2!=0}function Ie(e,t){return(e.length>1?e.charAt(0)+`.`+e.slice(1):e)+(t<0?`e`:`e+`)+t}function Le(e,t,n){var r,i;if(t<0){for(i=n+`.`;++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+`.`+e.slice(t));return e}var P=je();function Re({id:e,name:t,address:n,currency:r,balance:i,spendableBalance:a,blockHeight:o,lastSyncDate:s,parentAccountId:c,publicKey:l,readiness:u}){return{id:e,name:t,address:n,currency:r,balance:new P(i),spendableBalance:new P(a),blockHeight:o,lastSyncDate:new Date(s),parentAccountId:c,publicKey:l,readiness:u}}var ze;function F(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Be=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ve=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ze=globalThis).__zod_globalConfig??(ze.__zod_globalConfig={});var He=globalThis.__zod_globalConfig;function Ue(e){return e&&Object.assign(He,e),He}function We(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ge(e,t){return typeof t==`bigint`?t.toString():t}function Ke(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function qe(e){return e==null}function Je(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ye(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var Xe=Symbol(`evaluating`);function I(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Xe)return r===void 0&&(r=Xe,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ze(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Qe(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function $e(e){return JSON.stringify(e)}function et(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var tt=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function nt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var rt=Ke(()=>{if(He.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function it(e){if(nt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return nt(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function at(e){return it(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ot=new Set([`string`,`number`,`symbol`]);function st(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ct(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function L(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function lt(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ut={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function dt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return ct(e,Qe(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ze(this,`shape`,e),e},checks:[]}))}function ft(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return ct(e,Qe(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ze(this,`shape`,r),r},checks:[]}))}function pt(e,t){if(!it(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ct(e,Qe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ze(this,`shape`,n),n}}))}function mt(e,t){if(!it(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return ct(e,Qe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ze(this,`shape`,n),n}}))}function ht(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return ct(e,Qe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ze(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function gt(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return ct(t,Qe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Ze(this,`shape`,i),i},checks:[]}))}function _t(e,t,n){return ct(t,Qe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Ze(this,`shape`,i),i}}))}function vt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function yt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function bt(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function xt(e){return typeof e==`string`?e:e?.message}function St(e,t,n){let r=e.message?e.message:xt(e.inst?._zod.def?.error?.(e))??xt(t?.error?.(e))??xt(n.customError?.(e))??xt(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Ct(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function wt(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Tt=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ge,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Et=F(`$ZodError`,Tt),Dt=F(`$ZodError`,Tt,{Parent:Error});function Ot(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function kt(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var At=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Be;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>St(e,a,Ue())));throw tt(t,i?.callee),t}return o.value},jt=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>St(e,a,Ue())));throw tt(t,i?.callee),t}return o.value},Mt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Be;return a.issues.length?{success:!1,error:new(e??Et)(a.issues.map(e=>St(e,i,Ue())))}:{success:!0,data:a.value}},Nt=Mt(Dt),Pt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>St(e,i,Ue())))}:{success:!0,data:a.value}},Ft=Pt(Dt),It=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return At(e)(t,n,i)},Lt=e=>(t,n,r)=>At(e)(t,n,r),Rt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return jt(e)(t,n,i)},zt=e=>async(t,n,r)=>jt(e)(t,n,r),Bt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Mt(e)(t,n,i)},Vt=e=>(t,n,r)=>Mt(e)(t,n,r),Ht=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Pt(e)(t,n,i)},Ut=e=>async(t,n,r)=>Pt(e)(t,n,r),Wt=/^[cC][0-9a-z]{6,}$/,Gt=/^[0-9a-z]+$/,Kt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,qt=/^[0-9a-vA-V]{20}$/,Jt=/^[A-Za-z0-9]{27}$/,Yt=/^[a-zA-Z0-9_-]{21}$/,Xt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Zt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Qt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,$t=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,en=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function tn(){return new RegExp(en,`u`)}var nn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,an=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,on=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,sn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,cn=/^[A-Za-z0-9_-]*$/,ln=/^https?$/,un=/^\+[1-9]\d{6,14}$/,dn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,fn=RegExp(`^${dn}$`);function pn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function mn(e){return RegExp(`^${pn(e)}$`)}function hn(e){let t=pn({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${dn}T(?:${r})$`)}var gn=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},_n=/^-?\d+$/,vn=/^-?\d+(?:\.\d+)?$/,yn=/^(?:true|false)$/i,bn=/^null$/i,xn=/^undefined$/i,Sn=/^[^A-Z]*$/,Cn=/^[^a-z]*$/,wn=F(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Tn={number:`number`,bigint:`bigint`,object:`date`},En=F(`$ZodCheckLessThan`,(e,t)=>{wn.init(e,t);let n=Tn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Dn=F(`$ZodCheckGreaterThan`,(e,t)=>{wn.init(e,t);let n=Tn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),On=F(`$ZodCheckMultipleOf`,(e,t)=>{wn.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Ye(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),kn=F(`$ZodCheckNumberFormat`,(e,t)=>{wn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ut[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=_n)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),An=F(`$ZodCheckMaxLength`,(e,t)=>{var n;wn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!qe(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Ct(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),jn=F(`$ZodCheckMinLength`,(e,t)=>{var n;wn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!qe(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Ct(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Mn=F(`$ZodCheckLengthEquals`,(e,t)=>{var n;wn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!qe(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Ct(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Nn=F(`$ZodCheckStringFormat`,(e,t)=>{var n,r;wn.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Pn=F(`$ZodCheckRegex`,(e,t)=>{Nn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Fn=F(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Sn,Nn.init(e,t)}),In=F(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Cn,Nn.init(e,t)}),Ln=F(`$ZodCheckIncludes`,(e,t)=>{wn.init(e,t);let n=st(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Rn=F(`$ZodCheckStartsWith`,(e,t)=>{wn.init(e,t);let n=RegExp(`^${st(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),zn=F(`$ZodCheckEndsWith`,(e,t)=>{wn.init(e,t);let n=RegExp(`.*${st(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Bn=F(`$ZodCheckOverwrite`,(e,t)=>{wn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Vn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
1
+ import{t as e}from"./rolldown-runtime-BcKkbAw3.js";import{c as t,d as n,i as r,l as i,r as a,t as o}from"./Result-D66k67e4.js";import{At as s,Fn as c,Gt as l,Pt as u,Wt as d,Zt as f,_t as p,en as m,n as h,sa as g,t as _,x as v}from"./wagmi-connect-result-DOu6hDDM.js";import{C as y,E as b,J as x,Kt as S,L as C,M as w,R as T,W as ee,l as E,ot as D,v as O,w as te}from"./Schema-CnO1Nnkx.js";import{C as ne,T as re,b as ie,c as ae,l as oe,n as se,s as ce,t as le,u as ue,x as de}from"./transaction-3CLRKFvX.js";import{r as fe}from"./assets-CaBpoNKF.js";import{a as pe,o as me}from"./network-BR2dx0lQ.js";import{dn as he}from"./ccip-BxB3ZbpJ.js";import{r as k,t as A}from"./dist-KkMRwAp9.js";import{t as ge}from"./Transport-DCf5RHQn.js";import{a as _e}from"./wallet-errors-MrbcJr3I.js";import{t as ve}from"./current-value-stream-BphKxe9G.js";import{a as ye,i as be,n as xe}from"./transaction-BDuN1rLk.js";var Se=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,Ce=Math.ceil,we=Math.floor,Te=`[BigNumber Error] `,Ee=Te+`Number primitive has more than 15 significant digits: `,De=0x5af3107a4000,j=14,Oe=9007199254740991,ke=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,0xe8d4a51000,0x9184e72a000],Ae=1e7,M=1e9;function je(e){var t,n,r,i=v.prototype={constructor:v,toString:null,valueOf:null},a=new v(1),o=20,s=4,c=-7,l=21,u=-1e7,d=1e7,f=!1,p=1,m=0,h={prefix:``,groupSize:3,secondaryGroupSize:0,groupSeparator:`,`,decimalSeparator:`.`,fractionGroupSize:0,fractionGroupSeparator:`\xA0`,suffix:``},g=`0123456789abcdefghijklmnopqrstuvwxyz`,_=!0;function v(e,t){var i,a,c,l,f,p,m,h,y=this;if(!(y instanceof v))return new v(e,t);if(t==null){if(e&&e._isBigNumber===!0){y.s=e.s,!e.c||e.e>d?y.c=y.e=null:e.e<u?y.c=[y.e=0]:(y.e=e.e,y.c=e.c.slice());return}if((p=typeof e==`number`)&&e*0==0){if(y.s=1/e<0?(e=-e,-1):1,e===~~e){for(l=0,f=e;f>=10;f/=10,l++);l>d?y.c=y.e=null:(y.e=l,y.c=[e]);return}h=String(e)}else{if(!Se.test(h=String(e)))return r(y,h,p);y.s=h.charCodeAt(0)==45?(h=h.slice(1),-1):1}(l=h.indexOf(`.`))>-1&&(h=h.replace(`.`,``)),(f=h.search(/e/i))>0?(l<0&&(l=f),l+=+h.slice(f+1),h=h.substring(0,f)):l<0&&(l=h.length)}else{if(N(t,2,g.length,`Base`),t==10&&_)return y=new v(e),S(y,o+y.e+1,s);if(h=String(e),p=typeof e==`number`){if(e*0!=0)return r(y,h,p,t);if(y.s=1/e<0?(h=h.slice(1),-1):1,v.DEBUG&&h.replace(/^0\.0*|\./,``).length>15)throw Error(Ee+e)}else y.s=h.charCodeAt(0)===45?(h=h.slice(1),-1):1;for(i=g.slice(0,t),l=f=0,m=h.length;f<m;f++)if(i.indexOf(a=h.charAt(f))<0){if(a==`.`){if(f>l){l=m;continue}}else if(!c&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){c=!0,f=-1,l=0;continue}return r(y,String(e),p,t)}p=!1,h=n(h,t,10,y.s),(l=h.indexOf(`.`))>-1?h=h.replace(`.`,``):l=h.length}for(f=0;h.charCodeAt(f)===48;f++);for(m=h.length;h.charCodeAt(--m)===48;);if(h=h.slice(f,++m)){if(m-=f,p&&v.DEBUG&&m>15&&(e>Oe||e!==we(e)))throw Error(Ee+y.s*e);if((l=l-f-1)>d)y.c=y.e=null;else if(l<u)y.c=[y.e=0];else{if(y.e=l,y.c=[],f=(l+1)%j,l<0&&(f+=j),f<m){for(f&&y.c.push(+h.slice(0,f)),m-=j;f<m;)y.c.push(+h.slice(f,f+=j));f=j-(h=h.slice(f)).length}else f-=m;for(;f--;h+=`0`);y.c.push(+h)}}else y.c=[y.e=0]}v.clone=je,v.ROUND_UP=0,v.ROUND_DOWN=1,v.ROUND_CEIL=2,v.ROUND_FLOOR=3,v.ROUND_HALF_UP=4,v.ROUND_HALF_DOWN=5,v.ROUND_HALF_EVEN=6,v.ROUND_HALF_CEIL=7,v.ROUND_HALF_FLOOR=8,v.EUCLID=9,v.config=v.set=function(e){var t,n;if(e!=null){if(typeof e==`object`){if(e.hasOwnProperty(t=`DECIMAL_PLACES`)&&(n=e[t],N(n,0,M,t),o=n),e.hasOwnProperty(t=`ROUNDING_MODE`)&&(n=e[t],N(n,0,8,t),s=n),e.hasOwnProperty(t=`EXPONENTIAL_AT`)&&(n=e[t],n&&n.pop?(N(n[0],-M,0,t),N(n[1],0,M,t),c=n[0],l=n[1]):(N(n,-M,M,t),c=-(l=n<0?-n:n))),e.hasOwnProperty(t=`RANGE`)){if(n=e[t],n&&n.pop)N(n[0],-M,-1,t),N(n[1],1,M,t),u=n[0],d=n[1];else if(N(n,-M,M,t),n)u=-(d=n<0?-n:n);else throw Error(Te+t+` cannot be zero: `+n)}if(e.hasOwnProperty(t=`CRYPTO`)){if(n=e[t],n===!!n){if(n){if(typeof crypto<`u`&&crypto&&(crypto.getRandomValues||crypto.randomBytes))f=n;else throw f=!n,Error(Te+`crypto unavailable`)}else f=n}else throw Error(Te+t+` not true or false: `+n)}if(e.hasOwnProperty(t=`MODULO_MODE`)&&(n=e[t],N(n,0,9,t),p=n),e.hasOwnProperty(t=`POW_PRECISION`)&&(n=e[t],N(n,0,M,t),m=n),e.hasOwnProperty(t=`FORMAT`)){if(n=e[t],typeof n==`object`)h=n;else throw Error(Te+t+` not an object: `+n)}if(e.hasOwnProperty(t=`ALPHABET`)){if(n=e[t],typeof n==`string`&&!/^.?$|[+\-.\s]|(.).*\1/.test(n))_=n.slice(0,10)==`0123456789`,g=n;else throw Error(Te+t+` invalid: `+n)}}else throw Error(Te+`Object expected: `+e)}return{DECIMAL_PLACES:o,ROUNDING_MODE:s,EXPONENTIAL_AT:[c,l],RANGE:[u,d],CRYPTO:f,MODULO_MODE:p,POW_PRECISION:m,FORMAT:h,ALPHABET:g}},v.isBigNumber=function(e){if(!e||e._isBigNumber!==!0)return!1;if(!v.DEBUG)return!0;var t,n,r=e.c,i=e.e,a=e.s;out:if({}.toString.call(r)==`[object Array]`){if((a===1||a===-1)&&i>=-M&&i<=M&&i===we(i)){if(r[0]===0){if(i===0&&r.length===1)return!0;break out}if(t=(i+1)%j,t<1&&(t+=j),String(r[0]).length==t){for(t=0;t<r.length;t++)if(n=r[t],n<0||n>=De||n!==we(n))break out;if(n!==0)return!0}}}else if(r===null&&i===null&&(a===null||a===1||a===-1))return!0;throw Error(Te+`Invalid BigNumber: `+e)},v.maximum=v.max=function(){return b(arguments,-1)},v.minimum=v.min=function(){return b(arguments,1)},v.random=(function(){var e=9007199254740992,t=Math.random()*e&2097151?function(){return we(Math.random()*e)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(e){var n,r,i,s,c,l=0,u=[],d=new v(a);if(e==null?e=o:N(e,0,M),s=Ce(e/j),f){if(crypto.getRandomValues){for(n=crypto.getRandomValues(new Uint32Array(s*=2));l<s;)c=n[l]*131072+(n[l+1]>>>11),c>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),n[l]=r[0],n[l+1]=r[1]):(u.push(c%0x5af3107a4000),l+=2);l=s/2}else if(crypto.randomBytes){for(n=crypto.randomBytes(s*=7);l<s;)c=(n[l]&31)*281474976710656+n[l+1]*1099511627776+n[l+2]*4294967296+n[l+3]*16777216+(n[l+4]<<16)+(n[l+5]<<8)+n[l+6],c>=9e15?crypto.randomBytes(7).copy(n,l):(u.push(c%0x5af3107a4000),l+=7);l=s/7}else throw f=!1,Error(Te+`crypto unavailable`)}if(!f)for(;l<s;)c=t(),c<9e15&&(u[l++]=c%0x5af3107a4000);for(s=u[--l],e%=j,s&&e&&(c=ke[j-e],u[l]=we(s/c)*c);u[l]===0;u.pop(),l--);if(l<0)u=[i=0];else{for(i=-1;u[0]===0;u.splice(0,1),i-=j);for(l=1,c=u[0];c>=10;c/=10,l++);l<j&&(i-=j-l)}return d.e=i,d.c=u,d}})(),v.sum=function(){for(var e=1,t=arguments,n=new v(t[0]);e<t.length;)n=n.plus(t[e++]);return n},n=(function(){var e=`0123456789`;function n(e,t,n,r){for(var i,a=[0],o,s=0,c=e.length;s<c;){for(o=a.length;o--;a[o]*=t);for(a[0]+=r.indexOf(e.charAt(s++)),i=0;i<a.length;i++)a[i]>n-1&&(a[i+1]??(a[i+1]=0),a[i+1]+=a[i]/n|0,a[i]%=n)}return a.reverse()}return function(r,i,a,c,l){var u,d,f,p,h,_,y,b,x=r.indexOf(`.`),S=o,C=s;for(x>=0&&(p=m,m=0,r=r.replace(`.`,``),b=new v(i),_=b.pow(r.length-x),m=p,b.c=n(Le(Ne(_.c),_.e,`0`),10,a,e),b.e=b.c.length),y=n(r,i,a,l?(u=g,e):(u=e,g)),f=p=y.length;y[--p]==0;y.pop());if(!y[0])return u.charAt(0);if(x<0?--f:(_.c=y,_.e=f,_.s=c,_=t(_,b,S,C,a),y=_.c,h=_.r,f=_.e),d=f+S+1,x=y[d],p=a/2,h=h||d<0||y[d+1]!=null,h=C<4?(x!=null||h)&&(C==0||C==(_.s<0?3:2)):x>p||x==p&&(C==4||h||C==6&&y[d-1]&1||C==(_.s<0?8:7)),d<1||!y[0])r=h?Le(u.charAt(1),-S,u.charAt(0)):u.charAt(0);else{if(y.length=d,h)for(--a;++y[--d]>a;)y[d]=0,d||(++f,y=[1].concat(y));for(p=y.length;!y[--p];);for(x=0,r=``;x<=p;r+=u.charAt(y[x++]));r=Le(r,f,u.charAt(0))}return r}})(),t=(function(){function e(e,t,n){var r,i,a,o,s=0,c=e.length,l=t%Ae,u=t/Ae|0;for(e=e.slice();c--;)a=e[c]%Ae,o=e[c]/Ae|0,r=u*a+o*l,i=l*a+r%Ae*Ae+s,s=(i/n|0)+(r/Ae|0)+u*o,e[c]=i%n;return s&&(e=[s].concat(e)),e}function t(e,t,n,r){var i,a;if(n!=r)a=n>r?1:-1;else for(i=a=0;i<n;i++)if(e[i]!=t[i]){a=e[i]>t[i]?1:-1;break}return a}function n(e,t,n,r){for(var i=0;n--;)e[n]-=i,i=+(e[n]<t[n]),e[n]=i*r+e[n]-t[n];for(;!e[0]&&e.length>1;e.splice(0,1));}return function(r,i,a,o,s){var c,l,u,d,f,p,m,h,g,_,y,b,x,C,w,T,ee,E=r.s==i.s?1:-1,D=r.c,O=i.c;if(!D||!D[0]||!O||!O[0])return new v(!r.s||!i.s||(D?O&&D[0]==O[0]:!O)?NaN:D&&D[0]==0||!O?E*0:E/0);for(h=new v(E),g=h.c=[],l=r.e-i.e,E=a+l+1,s||(s=De,l=Me(r.e/j)-Me(i.e/j),E=E/j|0),u=0;O[u]==(D[u]||0);u++);if(O[u]>(D[u]||0)&&l--,E<0)g.push(1),d=!0;else{for(C=D.length,T=O.length,u=0,E+=2,f=we(s/(O[0]+1)),f>1&&(O=e(O,f,s),D=e(D,f,s),T=O.length,C=D.length),x=T,_=D.slice(0,T),y=_.length;y<T;_[y++]=0);ee=O.slice(),ee=[0].concat(ee),w=O[0],O[1]>=s/2&&w++;do{if(f=0,c=t(O,_,T,y),c<0){if(b=_[0],T!=y&&(b=b*s+(_[1]||0)),f=we(b/w),f>1)for(f>=s&&(f=s-1),p=e(O,f,s),m=p.length,y=_.length;t(p,_,m,y)==1;)f--,n(p,T<m?ee:O,m,s),m=p.length,c=1;else f==0&&(c=f=1),p=O.slice(),m=p.length;if(m<y&&(p=[0].concat(p)),n(_,p,y,s),y=_.length,c==-1)for(;t(O,_,T,y)<1;)f++,n(_,T<y?ee:O,y,s),y=_.length}else c===0&&(f++,_=[0]);g[u++]=f,_[0]?_[y++]=D[x]||0:(_=[D[x]],y=1)}while((x++<C||_[0]!=null)&&E--);d=_[0]!=null,g[0]||g.splice(0,1)}if(s==De){for(u=1,E=g[0];E>=10;E/=10,u++);S(h,a+(h.e=u+l*j-1)+1,o,d)}else h.e=l,h.r=+d;return h}})();function y(e,t,n,r){var i,a,o,u,d;if(n==null?n=s:N(n,0,8),!e.c)return e.toString();if(i=e.c[0],o=e.e,t==null)d=Ne(e.c),d=r==1||r==2&&(o<=c||o>=l)?Ie(d,o):Le(d,o,`0`);else if(e=S(new v(e),t,n),a=e.e,d=Ne(e.c),u=d.length,r==1||r==2&&(t<=a||a<=c)){for(;u<t;d+=`0`,u++);d=Ie(d,a)}else if(t-=o+(r===2&&a>o),d=Le(d,a,`0`),a+1>u){if(--t>0)for(d+=`.`;t--;d+=`0`);}else if(t+=a-u,t>0)for(a+1==u&&(d+=`.`);t--;d+=`0`);return e.s<0&&i?`-`+d:d}function b(e,t){for(var n,r,i=1,a=new v(e[0]);i<e.length;i++)r=new v(e[i]),(!r.s||(n=Pe(a,r))===t||n===0&&a.s===t)&&(a=r);return a}function x(e,t,n){for(var r=1,i=t.length;!t[--i];t.pop());for(i=t[0];i>=10;i/=10,r++);return(n=r+n*j-1)>d?e.c=e.e=null:n<u?e.c=[e.e=0]:(e.e=n,e.c=t),e}r=(function(){var e=/^(-?)0([xbo])(?=\w[\w.]*$)/i,t=/^([^.]+)\.$/,n=/^\.([^.]+)$/,r=/^-?(Infinity|NaN)$/,i=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(a,o,s,c){var l,u=s?o:o.replace(i,``);if(r.test(u))a.s=isNaN(u)?null:u<0?-1:1;else{if(!s&&(u=u.replace(e,function(e,t,n){return l=(n=n.toLowerCase())==`x`?16:n==`b`?2:8,!c||c==l?t:e}),c&&(l=c,u=u.replace(t,`$1`).replace(n,`0.$1`)),o!=u))return new v(u,l);if(v.DEBUG)throw Error(Te+`Not a`+(c?` base `+c:``)+` number: `+o);a.s=null}a.c=a.e=null}})();function S(e,t,n,r){var i,a,o,s,c,l,f,p=e.c,m=ke;if(p){out:{for(i=1,s=p[0];s>=10;s/=10,i++);if(a=t-i,a<0)a+=j,o=t,c=p[l=0],f=we(c/m[i-o-1]%10);else if(l=Ce((a+1)/j),l>=p.length){if(r){for(;p.length<=l;p.push(0));c=f=0,i=1,a%=j,o=a-j+1}else break out}else{for(c=s=p[l],i=1;s>=10;s/=10,i++);a%=j,o=a-j+i,f=o<0?0:we(c/m[i-o-1]%10)}if(r=r||t<0||p[l+1]!=null||(o<0?c:c%m[i-o-1]),r=n<4?(f||r)&&(n==0||n==(e.s<0?3:2)):f>5||f==5&&(n==4||r||n==6&&(a>0?o>0?c/m[i-o]:0:p[l-1])%10&1||n==(e.s<0?8:7)),t<1||!p[0])return p.length=0,r?(t-=e.e+1,p[0]=m[(j-t%j)%j],e.e=-t||0):p[0]=e.e=0,e;if(a==0?(p.length=l,s=1,l--):(p.length=l+1,s=m[j-a],p[l]=o>0?we(c/m[i-o]%m[o])*s:0),r)for(;;)if(l==0){for(a=1,o=p[0];o>=10;o/=10,a++);for(o=p[0]+=s,s=1;o>=10;o/=10,s++);a!=s&&(e.e++,p[0]==De&&(p[0]=1));break}else{if(p[l]+=s,p[l]!=De)break;p[l--]=0,s=1}for(a=p.length;p[--a]===0;p.pop());}e.e>d?e.c=e.e=null:e.e<u&&(e.c=[e.e=0])}return e}function C(e){var t,n=e.e;return n===null?e.toString():(t=Ne(e.c),t=n<=c||n>=l?Ie(t,n):Le(t,n,`0`),e.s<0?`-`+t:t)}return i.absoluteValue=i.abs=function(){var e=new v(this);return e.s<0&&(e.s=1),e},i.comparedTo=function(e,t){return Pe(this,new v(e,t))},i.decimalPlaces=i.dp=function(e,t){var n,r,i,a=this;if(e!=null)return N(e,0,M),t==null?t=s:N(t,0,8),S(new v(a),e+a.e+1,t);if(!(n=a.c))return null;if(r=((i=n.length-1)-Me(this.e/j))*j,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},i.dividedBy=i.div=function(e,n){return t(this,new v(e,n),o,s)},i.dividedToIntegerBy=i.idiv=function(e,n){return t(this,new v(e,n),0,1)},i.exponentiatedBy=i.pow=function(e,t){var n,r,i,o,c,l,u,d,f,p=this;if(e=new v(e),e.c&&!e.isInteger())throw Error(Te+`Exponent not an integer: `+C(e));if(t!=null&&(t=new v(t)),l=e.e>14,!p.c||!p.c[0]||p.c[0]==1&&!p.e&&p.c.length==1||!e.c||!e.c[0])return f=new v(C(p)**(l?e.s*(2-Fe(e)):+C(e))),t?f.mod(t):f;if(u=e.s<0,t){if(t.c?!t.c[0]:!t.s)return new v(NaN);r=!u&&p.isInteger()&&t.isInteger(),r&&(p=p.mod(t))}else if(e.e>9&&(p.e>0||p.e<-1||(p.e==0?p.c[0]>1||l&&p.c[1]>=24e7:p.c[0]<8e13||l&&p.c[0]<=9999975e7)))return o=p.s<0&&Fe(e)?-0:0,p.e>-1&&(o=1/o),new v(u?1/o:o);else m&&(o=Ce(m/j+2));for(l?(n=new v(.5),u&&(e.s=1),d=Fe(e)):(i=Math.abs(+C(e)),d=i%2),f=new v(a);;){if(d){if(f=f.times(p),!f.c)break;o?f.c.length>o&&(f.c.length=o):r&&(f=f.mod(t))}if(i){if(i=we(i/2),i===0)break;d=i%2}else if(e=e.times(n),S(e,e.e+1,1),e.e>14)d=Fe(e);else{if(i=+C(e),i===0)break;d=i%2}p=p.times(p),o?p.c&&p.c.length>o&&(p.c.length=o):r&&(p=p.mod(t))}return r?f:(u&&(f=a.div(f)),t?f.mod(t):o?S(f,m,s,c):f)},i.integerValue=function(e){var t=new v(this);return e==null?e=s:N(e,0,8),S(t,t.e+1,e)},i.isEqualTo=i.eq=function(e,t){return Pe(this,new v(e,t))===0},i.isFinite=function(){return!!this.c},i.isGreaterThan=i.gt=function(e,t){return Pe(this,new v(e,t))>0},i.isGreaterThanOrEqualTo=i.gte=function(e,t){return(t=Pe(this,new v(e,t)))===1||t===0},i.isInteger=function(){return!!this.c&&Me(this.e/j)>this.c.length-2},i.isLessThan=i.lt=function(e,t){return Pe(this,new v(e,t))<0},i.isLessThanOrEqualTo=i.lte=function(e,t){return(t=Pe(this,new v(e,t)))===-1||t===0},i.isNaN=function(){return!this.s},i.isNegative=function(){return this.s<0},i.isPositive=function(){return this.s>0},i.isZero=function(){return!!this.c&&this.c[0]==0},i.minus=function(e,t){var n,r,i,a,o=this,c=o.s;if(e=new v(e,t),t=e.s,!c||!t)return new v(NaN);if(c!=t)return e.s=-t,o.plus(e);var l=o.e/j,u=e.e/j,d=o.c,f=e.c;if(!l||!u){if(!d||!f)return d?(e.s=-t,e):new v(f?o:NaN);if(!d[0]||!f[0])return f[0]?(e.s=-t,e):new v(d[0]?o:s==3?-0:0)}if(l=Me(l),u=Me(u),d=d.slice(),c=l-u){for((a=c<0)?(c=-c,i=d):(u=l,i=f),i.reverse(),t=c;t--;i.push(0));i.reverse()}else for(r=(a=(c=d.length)<(t=f.length))?c:t,c=t=0;t<r;t++)if(d[t]!=f[t]){a=d[t]<f[t];break}if(a&&(i=d,d=f,f=i,e.s=-e.s),t=(r=f.length)-(n=d.length),t>0)for(;t--;d[n++]=0);for(t=De-1;r>c;){if(d[--r]<f[r]){for(n=r;n&&!d[--n];d[n]=t);--d[n],d[r]+=De}d[r]-=f[r]}for(;d[0]==0;d.splice(0,1),--u);return d[0]?x(e,d,u):(e.s=s==3?-1:1,e.c=[e.e=0],e)},i.modulo=i.mod=function(e,n){var r,i,a=this;return e=new v(e,n),!a.c||!e.s||e.c&&!e.c[0]?new v(NaN):!e.c||a.c&&!a.c[0]?new v(a):(p==9?(i=e.s,e.s=1,r=t(a,e,0,3),e.s=i,r.s*=i):r=t(a,e,0,p),e=a.minus(r.times(e)),!e.c[0]&&p==1&&(e.s=a.s),e)},i.multipliedBy=i.times=function(e,t){var n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_=this,y=_.c,b=(e=new v(e,t)).c;if(!y||!b||!y[0]||!b[0])return!_.s||!e.s||y&&!y[0]&&!b||b&&!b[0]&&!y?e.c=e.e=e.s=null:(e.s*=_.s,!y||!b?e.c=e.e=null:(e.c=[0],e.e=0)),e;for(r=Me(_.e/j)+Me(e.e/j),e.s*=_.s,c=y.length,d=b.length,c<d&&(m=y,y=b,b=m,i=c,c=d,d=i),i=c+d,m=[];i--;m.push(0));for(h=De,g=Ae,i=d;--i>=0;){for(n=0,f=b[i]%g,p=b[i]/g|0,o=c,a=i+o;a>i;)l=y[--o]%g,u=y[o]/g|0,s=p*l+u*f,l=f*l+s%g*g+m[a]+n,n=(l/h|0)+(s/g|0)+p*u,m[a--]=l%h;m[a]=n}return n?++r:m.splice(0,1),x(e,m,r)},i.negated=function(){var e=new v(this);return e.s=-e.s||null,e},i.plus=function(e,t){var n,r=this,i=r.s;if(e=new v(e,t),t=e.s,!i||!t)return new v(NaN);if(i!=t)return e.s=-t,r.minus(e);var a=r.e/j,o=e.e/j,s=r.c,c=e.c;if(!a||!o){if(!s||!c)return new v(i/0);if(!s[0]||!c[0])return c[0]?e:new v(s[0]?r:i*0)}if(a=Me(a),o=Me(o),s=s.slice(),i=a-o){for(i>0?(o=a,n=c):(i=-i,n=s),n.reverse();i--;n.push(0));n.reverse()}for(i=s.length,t=c.length,i-t<0&&(n=c,c=s,s=n,t=i),i=0;t;)i=(s[--t]=s[t]+c[t]+i)/De|0,s[t]=De===s[t]?0:s[t]%De;return i&&(s=[i].concat(s),++o),x(e,s,o)},i.precision=i.sd=function(e,t){var n,r,i,a=this;if(e!=null&&e!==!!e)return N(e,1,M),t==null?t=s:N(t,0,8),S(new v(a),e,t);if(!(n=a.c))return null;if(i=n.length-1,r=i*j+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return e&&a.e+1>r&&(r=a.e+1),r},i.shiftedBy=function(e){return N(e,-Oe,Oe),this.times(`1e`+e)},i.squareRoot=i.sqrt=function(){var e,n,r,i,a,c=this,l=c.c,u=c.s,d=c.e,f=o+4,p=new v(`0.5`);if(u!==1||!l||!l[0])return new v(!u||u<0&&(!l||l[0])?NaN:l?c:1/0);if(u=Math.sqrt(+C(c)),u==0||u==1/0?(n=Ne(l),(n.length+d)%2==0&&(n+=`0`),u=Math.sqrt(+n),d=Me((d+1)/2)-(d<0||d%2),u==1/0?n=`5e`+d:(n=u.toExponential(),n=n.slice(0,n.indexOf(`e`)+1)+d),r=new v(n)):r=new v(u+``),r.c[0]){for(d=r.e,u=d+f,u<3&&(u=0);;)if(a=r,r=p.times(a.plus(t(c,a,f,1))),Ne(a.c).slice(0,u)===(n=Ne(r.c)).slice(0,u)){if(r.e<d&&--u,n=n.slice(u-3,u+1),n==`9999`||!i&&n==`4999`){if(!i&&(S(a,a.e+o+2,0),a.times(a).eq(c))){r=a;break}f+=4,u+=4,i=1}else{(!+n||!+n.slice(1)&&n.charAt(0)==`5`)&&(S(r,r.e+o+2,1),e=!r.times(r).eq(c));break}}}return S(r,r.e+o+1,s,e)},i.toExponential=function(e,t){return e!=null&&(N(e,0,M),e++),y(this,e,t,1)},i.toFixed=function(e,t){return e!=null&&(N(e,0,M),e=e+this.e+1),y(this,e,t)},i.toFormat=function(e,t,n){var r,i=this;if(n==null)e!=null&&t&&typeof t==`object`?(n=t,t=null):e&&typeof e==`object`?(n=e,e=t=null):n=h;else if(typeof n!=`object`)throw Error(Te+`Argument not an object: `+n);if(r=i.toFixed(e,t),i.c){var a,o=r.split(`.`),s=+n.groupSize,c=+n.secondaryGroupSize,l=n.groupSeparator||``,u=o[0],d=o[1],f=i.s<0,p=f?u.slice(1):u,m=p.length;if(c&&(a=s,s=c,c=a,m-=a),s>0&&m>0){for(a=m%s||s,u=p.substr(0,a);a<m;a+=s)u+=l+p.substr(a,s);c>0&&(u+=l+p.slice(a)),f&&(u=`-`+u)}r=d?u+(n.decimalSeparator||``)+((c=+n.fractionGroupSize)?d.replace(RegExp(`\\d{`+c+`}\\B`,`g`),`$&`+(n.fractionGroupSeparator||``)):d):u}return(n.prefix||``)+r+(n.suffix||``)},i.toFraction=function(e){var n,r,i,o,c,l,u,f,p,m,h,g,_=this,y=_.c;if(e!=null&&(u=new v(e),!u.isInteger()&&(u.c||u.s!==1)||u.lt(a)))throw Error(Te+`Argument `+(u.isInteger()?`out of range: `:`not an integer: `)+C(u));if(!y)return new v(_);for(n=new v(a),p=r=new v(a),i=f=new v(a),g=Ne(y),c=n.e=g.length-_.e-1,n.c[0]=ke[(l=c%j)<0?j+l:l],e=!e||u.comparedTo(n)>0?c>0?n:p:u,l=d,d=1/0,u=new v(g),f.c[0]=0;m=t(u,n,0,1),o=r.plus(m.times(i)),o.comparedTo(e)!=1;)r=i,i=o,p=f.plus(m.times(o=p)),f=o,n=u.minus(m.times(o=n)),u=o;return o=t(e.minus(r),i,0,1),f=f.plus(o.times(p)),r=r.plus(o.times(i)),f.s=p.s=_.s,c*=2,h=t(p,i,c,s).minus(_).abs().comparedTo(t(f,r,c,s).minus(_).abs())<1?[p,i]:[f,r],d=l,h},i.toNumber=function(){return+C(this)},i.toPrecision=function(e,t){return e!=null&&N(e,1,M),y(this,e,t,2)},i.toString=function(e){var t,r=this,i=r.s,a=r.e;return a===null?i?(t=`Infinity`,i<0&&(t=`-`+t)):t=`NaN`:(e==null?t=a<=c||a>=l?Ie(Ne(r.c),a):Le(Ne(r.c),a,`0`):e===10&&_?(r=S(new v(r),o+a+1,s),t=Le(Ne(r.c),r.e,`0`)):(N(e,2,g.length,`Base`),t=n(Le(Ne(r.c),a,`0`),10,e,i,!0)),i<0&&r.c[0]&&(t=`-`+t)),t},i.valueOf=i.toJSON=function(){return C(this)},i._isBigNumber=!0,i[Symbol.toStringTag]=`BigNumber`,i[Symbol.for(`nodejs.util.inspect.custom`)]=i.valueOf,e!=null&&v.set(e),v}function Me(e){var t=e|0;return e>0||e===t?t:t-1}function Ne(e){for(var t,n,r=1,i=e.length,a=e[0]+``;r<i;){for(t=e[r++]+``,n=j-t.length;n--;t=`0`+t);a+=t}for(i=a.length;a.charCodeAt(--i)===48;);return a.slice(0,i+1||1)}function Pe(e,t){var n,r,i=e.c,a=t.c,o=e.s,s=t.s,c=e.e,l=t.e;if(!o||!s)return null;if(n=i&&!i[0],r=a&&!a[0],n||r)return n?r?0:-s:o;if(o!=s)return o;if(n=o<0,r=c==l,!i||!a)return r?0:!i^n?1:-1;if(!r)return c>l^n?1:-1;for(s=(c=i.length)<(l=a.length)?c:l,o=0;o<s;o++)if(i[o]!=a[o])return i[o]>a[o]^n?1:-1;return c==l?0:c>l^n?1:-1}function N(e,t,n,r){if(e<t||e>n||e!==we(e))throw Error(Te+(r||`Argument`)+(typeof e==`number`?e<t||e>n?` out of range: `:` not an integer: `:` not a primitive number: `)+String(e))}function Fe(e){var t=e.c.length-1;return Me(e.e/j)==t&&e.c[t]%2!=0}function Ie(e,t){return(e.length>1?e.charAt(0)+`.`+e.slice(1):e)+(t<0?`e`:`e+`)+t}function Le(e,t,n){var r,i;if(t<0){for(i=n+`.`;++t;i+=n);e=i+e}else if(r=e.length,++t>r){for(i=n,t-=r;--t;i+=n);e+=i}else t<r&&(e=e.slice(0,t)+`.`+e.slice(t));return e}var P=je();function Re({id:e,name:t,address:n,currency:r,balance:i,spendableBalance:a,blockHeight:o,lastSyncDate:s,parentAccountId:c,publicKey:l,readiness:u}){return{id:e,name:t,address:n,currency:r,balance:new P(i),spendableBalance:new P(a),blockHeight:o,lastSyncDate:new Date(s),parentAccountId:c,publicKey:l,readiness:u}}var ze;function F(e,t,n){function r(n,r){if(n._zod||Object.defineProperty(n,"_zod",{value:{def:r,constr:o,traits:new Set},enumerable:!1}),n._zod.traits.has(e))return;n._zod.traits.add(e),t(n,r);let i=o.prototype,a=Object.keys(i);for(let e=0;e<a.length;e++){let t=a[e];t in n||(n[t]=i[t].bind(n))}}let i=n?.Parent??Object;class a extends i{}Object.defineProperty(a,"name",{value:e});function o(e){var t;let i=n?.Parent?new a:this;r(i,e),(t=i._zod).deferred??(t.deferred=[]);for(let e of i._zod.deferred)e();return i}return Object.defineProperty(o,"init",{value:r}),Object.defineProperty(o,Symbol.hasInstance,{value:t=>n?.Parent&&t instanceof n.Parent?!0:t?._zod?.traits?.has(e)}),Object.defineProperty(o,"name",{value:e}),o}var Be=class extends Error{constructor(){super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`)}},Ve=class extends Error{constructor(e){super(`Encountered unidirectional transform during encode: ${e}`),this.name=`ZodEncodeError`}};(ze=globalThis).__zod_globalConfig??(ze.__zod_globalConfig={});var He=globalThis.__zod_globalConfig;function Ue(e){return e&&Object.assign(He,e),He}function We(e){let t=Object.values(e).filter(e=>typeof e==`number`);return Object.entries(e).filter(([e,n])=>t.indexOf(+e)===-1).map(([e,t])=>t)}function Ge(e,t){return typeof t==`bigint`?t.toString():t}function Ke(e){return{get value(){{let t=e();return Object.defineProperty(this,"value",{value:t}),t}}}}function qe(e){return e==null}function Je(e){let t=+!!e.startsWith(`^`),n=e.endsWith(`$`)?e.length-1:e.length;return e.slice(t,n)}function Ye(e,t){let n=e/t,r=Math.round(n),i=2**-52*Math.max(Math.abs(n),1);return Math.abs(n-r)<i?0:n-r}var Xe=Symbol(`evaluating`);function I(e,t,n){let r;Object.defineProperty(e,t,{get(){if(r!==Xe)return r===void 0&&(r=Xe,r=n()),r},set(n){Object.defineProperty(e,t,{value:n})},configurable:!0})}function Ze(e,t,n){Object.defineProperty(e,t,{value:n,writable:!0,enumerable:!0,configurable:!0})}function Qe(...e){let t={};for(let n of e){let e=Object.getOwnPropertyDescriptors(n);Object.assign(t,e)}return Object.defineProperties({},t)}function $e(e){return JSON.stringify(e)}function et(e){return e.toLowerCase().trim().replace(/[^\w\s-]/g,``).replace(/[\s_-]+/g,`-`).replace(/^-+|-+$/g,``)}var tt=`captureStackTrace`in Error?Error.captureStackTrace:(...e)=>{};function nt(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var rt=Ke(()=>{if(He.jitless||typeof navigator<`u`&&navigator?.userAgent?.includes(`Cloudflare`))return!1;try{return Function(``),!0}catch{return!1}});function it(e){if(nt(e)===!1)return!1;let t=e.constructor;if(t===void 0||typeof t!=`function`)return!0;let n=t.prototype;return nt(n)!==!1&&Object.prototype.hasOwnProperty.call(n,`isPrototypeOf`)!==!1}function at(e){return it(e)?{...e}:Array.isArray(e)?[...e]:e instanceof Map?new Map(e):e instanceof Set?new Set(e):e}var ot=new Set([`string`,`number`,`symbol`]);function st(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ct(e,t,n){let r=new e._zod.constr(t??e._zod.def);return(!t||n?.parent)&&(r._zod.parent=e),r}function L(e){let t=e;if(!t)return{};if(typeof t==`string`)return{error:()=>t};if(t?.message!==void 0){if(t?.error!==void 0)throw Error("Cannot specify both `message` and `error` params");t.error=t.message}return delete t.message,typeof t.error==`string`?{...t,error:()=>t.error}:t}function lt(e){return Object.keys(e).filter(t=>e[t]._zod.optin===`optional`&&e[t]._zod.optout===`optional`)}var ut={safeint:[-(2**53-1),2**53-1],int32:[-2147483648,2147483647],uint32:[0,4294967295],float32:[-34028234663852886e22,34028234663852886e22],float64:[-Number.MAX_VALUE,Number.MAX_VALUE]};function dt(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.pick() cannot be used on object schemas containing refinements`);return ct(e,Qe(e._zod.def,{get shape(){let e={};for(let r in t){if(!(r in n.shape))throw Error(`Unrecognized key: "${r}"`);t[r]&&(e[r]=n.shape[r])}return Ze(this,`shape`,e),e},checks:[]}))}function ft(e,t){let n=e._zod.def,r=n.checks;if(r&&r.length>0)throw Error(`.omit() cannot be used on object schemas containing refinements`);return ct(e,Qe(e._zod.def,{get shape(){let r={...e._zod.def.shape};for(let e in t){if(!(e in n.shape))throw Error(`Unrecognized key: "${e}"`);t[e]&&delete r[e]}return Ze(this,`shape`,r),r},checks:[]}))}function pt(e,t){if(!it(t))throw Error(`Invalid input to extend: expected a plain object`);let n=e._zod.def.checks;if(n&&n.length>0){let n=e._zod.def.shape;for(let e in t)if(Object.getOwnPropertyDescriptor(n,e)!==void 0)throw Error("Cannot overwrite keys on object schemas containing refinements. Use `.safeExtend()` instead.")}return ct(e,Qe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ze(this,`shape`,n),n}}))}function mt(e,t){if(!it(t))throw Error(`Invalid input to safeExtend: expected a plain object`);return ct(e,Qe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t};return Ze(this,`shape`,n),n}}))}function ht(e,t){if(e._zod.def.checks?.length)throw Error(`.merge() cannot be used on object schemas containing refinements. Use .safeExtend() instead.`);return ct(e,Qe(e._zod.def,{get shape(){let n={...e._zod.def.shape,...t._zod.def.shape};return Ze(this,`shape`,n),n},get catchall(){return t._zod.def.catchall},checks:t._zod.def.checks??[]}))}function gt(e,t,n){let r=t._zod.def.checks;if(r&&r.length>0)throw Error(`.partial() cannot be used on object schemas containing refinements`);return ct(t,Qe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in r))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t])}else for(let t in r)i[t]=e?new e({type:`optional`,innerType:r[t]}):r[t];return Ze(this,`shape`,i),i},checks:[]}))}function _t(e,t,n){return ct(t,Qe(t._zod.def,{get shape(){let r=t._zod.def.shape,i={...r};if(n)for(let t in n){if(!(t in i))throw Error(`Unrecognized key: "${t}"`);n[t]&&(i[t]=new e({type:`nonoptional`,innerType:r[t]}))}else for(let t in r)i[t]=new e({type:`nonoptional`,innerType:r[t]});return Ze(this,`shape`,i),i}}))}function vt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue!==!0)return!0;return!1}function yt(e,t=0){if(e.aborted===!0)return!0;for(let n=t;n<e.issues.length;n++)if(e.issues[n]?.continue===!1)return!0;return!1}function bt(e,t){return t.map(t=>{var n;return(n=t).path??(n.path=[]),t.path.unshift(e),t})}function xt(e){return typeof e==`string`?e:e?.message}function St(e,t,n){let r=e.message?e.message:xt(e.inst?._zod.def?.error?.(e))??xt(t?.error?.(e))??xt(n.customError?.(e))??xt(n.localeError?.(e))??`Invalid input`,{inst:i,continue:a,input:o,...s}=e;return s.path??=[],s.message=r,t?.reportInput&&(s.input=o),s}function Ct(e){return Array.isArray(e)?`array`:typeof e==`string`?`string`:`unknown`}function wt(...e){let[t,n,r]=e;return typeof t==`string`?{message:t,code:`custom`,input:n,inst:r}:{...t}}var Tt=(e,t)=>{e.name=`$ZodError`,Object.defineProperty(e,"_zod",{value:e._zod,enumerable:!1}),Object.defineProperty(e,"issues",{value:t,enumerable:!1}),e.message=JSON.stringify(t,Ge,2),Object.defineProperty(e,"toString",{value:()=>e.message,enumerable:!1})},Et=F(`$ZodError`,Tt),Dt=F(`$ZodError`,Tt,{Parent:Error});function Ot(e,t=e=>e.message){let n={},r=[];for(let i of e.issues)i.path.length>0?(n[i.path[0]]=n[i.path[0]]||[],n[i.path[0]].push(t(i))):r.push(t(i));return{formErrors:r,fieldErrors:n}}function kt(e,t=e=>e.message){let n={_errors:[]},r=(e,i=[])=>{for(let a of e.issues)if(a.code===`invalid_union`&&a.errors.length)a.errors.map(e=>r({issues:e},[...i,...a.path]));else if(a.code===`invalid_key`)r({issues:a.issues},[...i,...a.path]);else if(a.code===`invalid_element`)r({issues:a.issues},[...i,...a.path]);else{let e=[...i,...a.path];if(e.length===0)n._errors.push(t(a));else{let r=n,i=0;for(;i<e.length;){let n=e[i];i===e.length-1?(r[n]=r[n]||{_errors:[]},r[n]._errors.push(t(a))):r[n]=r[n]||{_errors:[]},r=r[n],i++}}}};return r(e),n}var At=e=>(t,n,r,i)=>{let a=r?{...r,async:!1}:{async:!1},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise)throw new Be;if(o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>St(e,a,Ue())));throw tt(t,i?.callee),t}return o.value},jt=e=>async(t,n,r,i)=>{let a=r?{...r,async:!0}:{async:!0},o=t._zod.run({value:n,issues:[]},a);if(o instanceof Promise&&(o=await o),o.issues.length){let t=new((i?.Err)??e)(o.issues.map(e=>St(e,a,Ue())));throw tt(t,i?.callee),t}return o.value},Mt=e=>(t,n,r)=>{let i=r?{...r,async:!1}:{async:!1},a=t._zod.run({value:n,issues:[]},i);if(a instanceof Promise)throw new Be;return a.issues.length?{success:!1,error:new(e??Et)(a.issues.map(e=>St(e,i,Ue())))}:{success:!0,data:a.value}},Nt=Mt(Dt),Pt=e=>async(t,n,r)=>{let i=r?{...r,async:!0}:{async:!0},a=t._zod.run({value:n,issues:[]},i);return a instanceof Promise&&(a=await a),a.issues.length?{success:!1,error:new e(a.issues.map(e=>St(e,i,Ue())))}:{success:!0,data:a.value}},Ft=Pt(Dt),It=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return At(e)(t,n,i)},Lt=e=>(t,n,r)=>At(e)(t,n,r),Rt=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return jt(e)(t,n,i)},zt=e=>async(t,n,r)=>jt(e)(t,n,r),Bt=e=>(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Mt(e)(t,n,i)},Vt=e=>(t,n,r)=>Mt(e)(t,n,r),Ht=e=>async(t,n,r)=>{let i=r?{...r,direction:`backward`}:{direction:`backward`};return Pt(e)(t,n,i)},Ut=e=>async(t,n,r)=>Pt(e)(t,n,r),Wt=/^[cC][0-9a-z]{6,}$/,Gt=/^[0-9a-z]+$/,Kt=/^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/,qt=/^[0-9a-vA-V]{20}$/,Jt=/^[A-Za-z0-9]{27}$/,Yt=/^[a-zA-Z0-9_-]{21}$/,Xt=/^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/,Zt=/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/,Qt=e=>e?RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${e}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`):/^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/,$t=/^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/,en=`^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$`;function tn(){return new RegExp(en,`u`)}var nn=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,rn=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/,an=/^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/,on=/^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,sn=/^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/,cn=/^[A-Za-z0-9_-]*$/,ln=/^https?$/,un=/^\+[1-9]\d{6,14}$/,dn=`(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))`,fn=RegExp(`^${dn}$`);function pn(e){let t=`(?:[01]\\d|2[0-3]):[0-5]\\d`;return typeof e.precision==`number`?e.precision===-1?`${t}`:e.precision===0?`${t}:[0-5]\\d`:`${t}:[0-5]\\d\\.\\d{${e.precision}}`:`${t}(?::[0-5]\\d(?:\\.\\d+)?)?`}function mn(e){return RegExp(`^${pn(e)}$`)}function hn(e){let t=pn({precision:e.precision}),n=[`Z`];e.local&&n.push(``),e.offset&&n.push(`([+-](?:[01]\\d|2[0-3]):[0-5]\\d)`);let r=`${t}(?:${n.join(`|`)})`;return RegExp(`^${dn}T(?:${r})$`)}var gn=e=>{let t=e?`[\\s\\S]{${e?.minimum??0},${e?.maximum??``}}`:`[\\s\\S]*`;return RegExp(`^${t}$`)},_n=/^-?\d+$/,vn=/^-?\d+(?:\.\d+)?$/,yn=/^(?:true|false)$/i,bn=/^null$/i,xn=/^undefined$/i,Sn=/^[^A-Z]*$/,Cn=/^[^a-z]*$/,wn=F(`$ZodCheck`,(e,t)=>{var n;e._zod??={},e._zod.def=t,(n=e._zod).onattach??(n.onattach=[])}),Tn={number:`number`,bigint:`bigint`,object:`date`},En=F(`$ZodCheckLessThan`,(e,t)=>{wn.init(e,t);let n=Tn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.maximum:n.exclusiveMaximum)??1/0;t.value<r&&(t.inclusive?n.maximum=t.value:n.exclusiveMaximum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value<=t.value:r.value<t.value)||r.issues.push({origin:n,code:`too_big`,maximum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),Dn=F(`$ZodCheckGreaterThan`,(e,t)=>{wn.init(e,t);let n=Tn[typeof t.value];e._zod.onattach.push(e=>{let n=e._zod.bag,r=(t.inclusive?n.minimum:n.exclusiveMinimum)??-1/0;t.value>r&&(t.inclusive?n.minimum=t.value:n.exclusiveMinimum=t.value)}),e._zod.check=r=>{(t.inclusive?r.value>=t.value:r.value>t.value)||r.issues.push({origin:n,code:`too_small`,minimum:typeof t.value==`object`?t.value.getTime():t.value,input:r.value,inclusive:t.inclusive,inst:e,continue:!t.abort})}}),On=F(`$ZodCheckMultipleOf`,(e,t)=>{wn.init(e,t),e._zod.onattach.push(e=>{var n;(n=e._zod.bag).multipleOf??(n.multipleOf=t.value)}),e._zod.check=n=>{if(typeof n.value!=typeof t.value)throw Error(`Cannot mix number and bigint in multiple_of check.`);(typeof n.value==`bigint`?n.value%t.value===BigInt(0):Ye(n.value,t.value)===0)||n.issues.push({origin:typeof n.value,code:`not_multiple_of`,divisor:t.value,input:n.value,inst:e,continue:!t.abort})}}),kn=F(`$ZodCheckNumberFormat`,(e,t)=>{wn.init(e,t),t.format=t.format||`float64`;let n=t.format?.includes(`int`),r=n?`int`:`number`,[i,a]=ut[t.format];e._zod.onattach.push(e=>{let r=e._zod.bag;r.format=t.format,r.minimum=i,r.maximum=a,n&&(r.pattern=_n)}),e._zod.check=o=>{let s=o.value;if(n){if(!Number.isInteger(s)){o.issues.push({expected:r,format:t.format,code:`invalid_type`,continue:!1,input:s,inst:e});return}if(!Number.isSafeInteger(s)){s>0?o.issues.push({input:s,code:`too_big`,maximum:2**53-1,note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort}):o.issues.push({input:s,code:`too_small`,minimum:-(2**53-1),note:`Integers must be within the safe integer range.`,inst:e,origin:r,inclusive:!0,continue:!t.abort});return}}s<i&&o.issues.push({origin:`number`,input:s,code:`too_small`,minimum:i,inclusive:!0,inst:e,continue:!t.abort}),s>a&&o.issues.push({origin:`number`,input:s,code:`too_big`,maximum:a,inclusive:!0,inst:e,continue:!t.abort})}}),An=F(`$ZodCheckMaxLength`,(e,t)=>{var n;wn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!qe(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.maximum??1/0;t.maximum<n&&(e._zod.bag.maximum=t.maximum)}),e._zod.check=n=>{let r=n.value;if(r.length<=t.maximum)return;let i=Ct(r);n.issues.push({origin:i,code:`too_big`,maximum:t.maximum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),jn=F(`$ZodCheckMinLength`,(e,t)=>{var n;wn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!qe(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag.minimum??-1/0;t.minimum>n&&(e._zod.bag.minimum=t.minimum)}),e._zod.check=n=>{let r=n.value;if(r.length>=t.minimum)return;let i=Ct(r);n.issues.push({origin:i,code:`too_small`,minimum:t.minimum,inclusive:!0,input:r,inst:e,continue:!t.abort})}}),Mn=F(`$ZodCheckLengthEquals`,(e,t)=>{var n;wn.init(e,t),(n=e._zod.def).when??(n.when=e=>{let t=e.value;return!qe(t)&&t.length!==void 0}),e._zod.onattach.push(e=>{let n=e._zod.bag;n.minimum=t.length,n.maximum=t.length,n.length=t.length}),e._zod.check=n=>{let r=n.value,i=r.length;if(i===t.length)return;let a=Ct(r),o=i>t.length;n.issues.push({origin:a,...o?{code:`too_big`,maximum:t.length}:{code:`too_small`,minimum:t.length},inclusive:!0,exact:!0,input:n.value,inst:e,continue:!t.abort})}}),Nn=F(`$ZodCheckStringFormat`,(e,t)=>{var n,r;wn.init(e,t),e._zod.onattach.push(e=>{let n=e._zod.bag;n.format=t.format,t.pattern&&(n.patterns??=new Set,n.patterns.add(t.pattern))}),t.pattern?(n=e._zod).check??(n.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:t.format,input:n.value,...t.pattern?{pattern:t.pattern.toString()}:{},inst:e,continue:!t.abort})}):(r=e._zod).check??(r.check=()=>{})}),Pn=F(`$ZodCheckRegex`,(e,t)=>{Nn.init(e,t),e._zod.check=n=>{t.pattern.lastIndex=0,!t.pattern.test(n.value)&&n.issues.push({origin:`string`,code:`invalid_format`,format:`regex`,input:n.value,pattern:t.pattern.toString(),inst:e,continue:!t.abort})}}),Fn=F(`$ZodCheckLowerCase`,(e,t)=>{t.pattern??=Sn,Nn.init(e,t)}),In=F(`$ZodCheckUpperCase`,(e,t)=>{t.pattern??=Cn,Nn.init(e,t)}),Ln=F(`$ZodCheckIncludes`,(e,t)=>{wn.init(e,t);let n=st(t.includes),r=new RegExp(typeof t.position==`number`?`^.{${t.position}}${n}`:n);t.pattern=r,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(r)}),e._zod.check=n=>{n.value.includes(t.includes,t.position)||n.issues.push({origin:`string`,code:`invalid_format`,format:`includes`,includes:t.includes,input:n.value,inst:e,continue:!t.abort})}}),Rn=F(`$ZodCheckStartsWith`,(e,t)=>{wn.init(e,t);let n=RegExp(`^${st(t.prefix)}.*`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.startsWith(t.prefix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`starts_with`,prefix:t.prefix,input:n.value,inst:e,continue:!t.abort})}}),zn=F(`$ZodCheckEndsWith`,(e,t)=>{wn.init(e,t);let n=RegExp(`.*${st(t.suffix)}$`);t.pattern??=n,e._zod.onattach.push(e=>{let t=e._zod.bag;t.patterns??=new Set,t.patterns.add(n)}),e._zod.check=n=>{n.value.endsWith(t.suffix)||n.issues.push({origin:`string`,code:`invalid_format`,format:`ends_with`,suffix:t.suffix,input:n.value,inst:e,continue:!t.abort})}}),Bn=F(`$ZodCheckOverwrite`,(e,t)=>{wn.init(e,t),e._zod.check=e=>{e.value=t.tx(e.value)}}),Vn=class{constructor(e=[]){this.content=[],this.indent=0,this&&(this.args=e)}indented(e){this.indent+=1,e(this),--this.indent}write(e){if(typeof e==`function`){e(this,{execution:`sync`}),e(this,{execution:`async`});return}let t=e.split(`
2
2
  `).filter(e=>e),n=Math.min(...t.map(e=>e.length-e.trimStart().length)),r=t.map(e=>e.slice(n)).map(e=>` `.repeat(this.indent*2)+e);for(let e of r)this.content.push(e)}compile(){let e=Function,t=this?.args,n=[...(this?.content??[``]).map(e=>` ${e}`)];return new e(...t,n.join(`
3
3
  `))}},Hn={major:4,minor:4,patch:3},R=F(`$ZodType`,(e,t)=>{var n;e??={},e._zod.def=t,e._zod.bag=e._zod.bag||{},e._zod.version=Hn;let r=[...e._zod.def.checks??[]];e._zod.traits.has(`$ZodCheck`)&&r.unshift(e);for(let t of r)for(let n of t._zod.onattach)n(e);if(r.length===0)(n=e._zod).deferred??(n.deferred=[]),e._zod.deferred?.push(()=>{e._zod.run=e._zod.parse});else{let t=(e,t,n)=>{let r=vt(e),i;for(let a of t){if(a._zod.def.when){if(yt(e)||!a._zod.def.when(e))continue}else if(r)continue;let t=e.issues.length,o=a._zod.check(e);if(o instanceof Promise&&n?.async===!1)throw new Be;if(i||o instanceof Promise)i=(i??Promise.resolve()).then(async()=>{await o,e.issues.length!==t&&(r||=vt(e,t))});else{if(e.issues.length===t)continue;r||=vt(e,t)}}return i?i.then(()=>e):e},n=(n,i,a)=>{if(vt(n))return n.aborted=!0,n;let o=t(i,r,a);if(o instanceof Promise){if(a.async===!1)throw new Be;return o.then(t=>e._zod.parse(t,a))}return e._zod.parse(o,a)};e._zod.run=(i,a)=>{if(a.skipChecks)return e._zod.parse(i,a);if(a.direction===`backward`){let t=e._zod.parse({value:i.value,issues:[]},{...a,skipChecks:!0});return t instanceof Promise?t.then(e=>n(e,i,a)):n(t,i,a)}let o=e._zod.parse(i,a);if(o instanceof Promise){if(a.async===!1)throw new Be;return o.then(e=>t(e,r,a))}return t(o,r,a)}}I(e,`~standard`,()=>({validate:t=>{try{let n=Nt(e,t);return n.success?{value:n.data}:{issues:n.error?.issues}}catch{return Ft(e,t).then(e=>e.success?{value:e.data}:{issues:e.error?.issues})}},vendor:`zod`,version:1}))}),Un=F(`$ZodString`,(e,t)=>{R.init(e,t),e._zod.pattern=[...e?._zod.bag?.patterns??[]].pop()??gn(e._zod.bag),e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=String(n.value)}catch{}return typeof n.value==`string`||n.issues.push({expected:`string`,code:`invalid_type`,input:n.value,inst:e}),n}}),z=F(`$ZodStringFormat`,(e,t)=>{Nn.init(e,t),Un.init(e,t)}),Wn=F(`$ZodGUID`,(e,t)=>{t.pattern??=Zt,z.init(e,t)}),Gn=F(`$ZodUUID`,(e,t)=>{if(t.version){let e={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,v7:7,v8:8}[t.version];if(e===void 0)throw Error(`Invalid UUID version: "${t.version}"`);t.pattern??=Qt(e)}else t.pattern??=Qt();z.init(e,t)}),Kn=F(`$ZodEmail`,(e,t)=>{t.pattern??=$t,z.init(e,t)}),qn=F(`$ZodURL`,(e,t)=>{z.init(e,t),e._zod.check=n=>{try{let r=n.value.trim();if(!t.normalize&&t.protocol?.source===ln.source&&!/^https?:\/\//i.test(r)){n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid URL format`,input:n.value,inst:e,continue:!t.abort});return}let i=new URL(r);t.hostname&&(t.hostname.lastIndex=0,t.hostname.test(i.hostname)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid hostname`,pattern:t.hostname.source,input:n.value,inst:e,continue:!t.abort})),t.protocol&&(t.protocol.lastIndex=0,t.protocol.test(i.protocol.endsWith(`:`)?i.protocol.slice(0,-1):i.protocol)||n.issues.push({code:`invalid_format`,format:`url`,note:`Invalid protocol`,pattern:t.protocol.source,input:n.value,inst:e,continue:!t.abort})),n.value=t.normalize?i.href:r;return}catch{n.issues.push({code:`invalid_format`,format:`url`,input:n.value,inst:e,continue:!t.abort})}}}),Jn=F(`$ZodEmoji`,(e,t)=>{t.pattern??=tn(),z.init(e,t)}),Yn=F(`$ZodNanoID`,(e,t)=>{t.pattern??=Yt,z.init(e,t)}),Xn=F(`$ZodCUID`,(e,t)=>{t.pattern??=Wt,z.init(e,t)}),Zn=F(`$ZodCUID2`,(e,t)=>{t.pattern??=Gt,z.init(e,t)}),Qn=F(`$ZodULID`,(e,t)=>{t.pattern??=Kt,z.init(e,t)}),$n=F(`$ZodXID`,(e,t)=>{t.pattern??=qt,z.init(e,t)}),er=F(`$ZodKSUID`,(e,t)=>{t.pattern??=Jt,z.init(e,t)}),tr=F(`$ZodISODateTime`,(e,t)=>{t.pattern??=hn(t),z.init(e,t)}),nr=F(`$ZodISODate`,(e,t)=>{t.pattern??=fn,z.init(e,t)}),rr=F(`$ZodISOTime`,(e,t)=>{t.pattern??=mn(t),z.init(e,t)}),ir=F(`$ZodISODuration`,(e,t)=>{t.pattern??=Xt,z.init(e,t)}),ar=F(`$ZodIPv4`,(e,t)=>{t.pattern??=nn,z.init(e,t),e._zod.bag.format=`ipv4`}),or=F(`$ZodIPv6`,(e,t)=>{t.pattern??=rn,z.init(e,t),e._zod.bag.format=`ipv6`,e._zod.check=n=>{try{new URL(`http://[${n.value}]`)}catch{n.issues.push({code:`invalid_format`,format:`ipv6`,input:n.value,inst:e,continue:!t.abort})}}}),sr=F(`$ZodCIDRv4`,(e,t)=>{t.pattern??=an,z.init(e,t)}),cr=F(`$ZodCIDRv6`,(e,t)=>{t.pattern??=on,z.init(e,t),e._zod.check=n=>{let r=n.value.split(`/`);try{if(r.length!==2)throw Error();let[e,t]=r;if(!t)throw Error();let n=Number(t);if(`${n}`!==t||n<0||n>128)throw Error();new URL(`http://[${e}]`)}catch{n.issues.push({code:`invalid_format`,format:`cidrv6`,input:n.value,inst:e,continue:!t.abort})}}});function lr(e){if(e===``)return!0;if(/\s/.test(e)||e.length%4!=0)return!1;try{return atob(e),!0}catch{return!1}}var ur=F(`$ZodBase64`,(e,t)=>{t.pattern??=sn,z.init(e,t),e._zod.bag.contentEncoding=`base64`,e._zod.check=n=>{lr(n.value)||n.issues.push({code:`invalid_format`,format:`base64`,input:n.value,inst:e,continue:!t.abort})}});function dr(e){if(!cn.test(e))return!1;let t=e.replace(/[-_]/g,e=>e===`-`?`+`:`/`);return lr(t.padEnd(Math.ceil(t.length/4)*4,`=`))}var fr=F(`$ZodBase64URL`,(e,t)=>{t.pattern??=cn,z.init(e,t),e._zod.bag.contentEncoding=`base64url`,e._zod.check=n=>{dr(n.value)||n.issues.push({code:`invalid_format`,format:`base64url`,input:n.value,inst:e,continue:!t.abort})}}),pr=F(`$ZodE164`,(e,t)=>{t.pattern??=un,z.init(e,t)});function mr(e,t=null){try{let n=e.split(`.`);if(n.length!==3)return!1;let[r]=n;if(!r)return!1;let i=JSON.parse(atob(r));return!(`typ`in i&&i?.typ!==`JWT`||!i.alg||t&&(!(`alg`in i)||i.alg!==t))}catch{return!1}}var hr=F(`$ZodJWT`,(e,t)=>{z.init(e,t),e._zod.check=n=>{mr(n.value,t.alg)||n.issues.push({code:`invalid_format`,format:`jwt`,input:n.value,inst:e,continue:!t.abort})}}),gr=F(`$ZodNumber`,(e,t)=>{R.init(e,t),e._zod.pattern=e._zod.bag.pattern??vn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=Number(n.value)}catch{}let i=n.value;if(typeof i==`number`&&!Number.isNaN(i)&&Number.isFinite(i))return n;let a=typeof i==`number`?Number.isNaN(i)?`NaN`:Number.isFinite(i)?void 0:`Infinity`:void 0;return n.issues.push({expected:`number`,code:`invalid_type`,input:i,inst:e,...a?{received:a}:{}}),n}}),_r=F(`$ZodNumberFormat`,(e,t)=>{kn.init(e,t),gr.init(e,t)}),vr=F(`$ZodBoolean`,(e,t)=>{R.init(e,t),e._zod.pattern=yn,e._zod.parse=(n,r)=>{if(t.coerce)try{n.value=!!n.value}catch{}let i=n.value;return typeof i==`boolean`||n.issues.push({expected:`boolean`,code:`invalid_type`,input:i,inst:e}),n}}),yr=F(`$ZodUndefined`,(e,t)=>{R.init(e,t),e._zod.pattern=xn,e._zod.values=new Set([void 0]),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`undefined`,code:`invalid_type`,input:r,inst:e}),t}}),br=F(`$ZodNull`,(e,t)=>{R.init(e,t),e._zod.pattern=bn,e._zod.values=new Set([null]),e._zod.parse=(t,n)=>{let r=t.value;return r===null||t.issues.push({expected:`null`,code:`invalid_type`,input:r,inst:e}),t}}),xr=F(`$ZodAny`,(e,t)=>{R.init(e,t),e._zod.parse=e=>e}),Sr=F(`$ZodUnknown`,(e,t)=>{R.init(e,t),e._zod.parse=e=>e}),Cr=F(`$ZodNever`,(e,t)=>{R.init(e,t),e._zod.parse=(t,n)=>(t.issues.push({expected:`never`,code:`invalid_type`,input:t.value,inst:e}),t)}),wr=F(`$ZodVoid`,(e,t)=>{R.init(e,t),e._zod.parse=(t,n)=>{let r=t.value;return r===void 0||t.issues.push({expected:`void`,code:`invalid_type`,input:r,inst:e}),t}});function Tr(e,t,n){e.issues.length&&t.issues.push(...bt(n,e.issues)),t.value[n]=e.value}var Er=F(`$ZodArray`,(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Array.isArray(i))return n.issues.push({expected:`array`,code:`invalid_type`,input:i,inst:e}),n;n.value=Array(i.length);let a=[];for(let e=0;e<i.length;e++){let o=i[e],s=t.element._zod.run({value:o,issues:[]},r);s instanceof Promise?a.push(s.then(t=>Tr(t,n,e))):Tr(s,n,e)}return a.length?Promise.all(a).then(()=>n):n}});function Dr(e,t,n,r,i,a){let o=n in r;if(e.issues.length){if(i&&a&&!o)return;t.issues.push(...bt(n,e.issues))}if(!o&&!i){e.issues.length||t.issues.push({code:`invalid_type`,expected:`nonoptional`,input:void 0,path:[n]});return}e.value===void 0?o&&(t.value[n]=void 0):t.value[n]=e.value}function Or(e){let t=Object.keys(e.shape);for(let n of t)if(!e.shape?.[n]?._zod?.traits?.has(`$ZodType`))throw Error(`Invalid element at key "${n}": expected a Zod schema`);let n=lt(e.shape);return{...e,keys:t,keySet:new Set(t),numKeys:t.length,optionalKeys:new Set(n)}}function kr(e,t,n,r,i,a){let o=[],s=i.keySet,c=i.catchall._zod,l=c.def.type,u=c.optin===`optional`,d=c.optout===`optional`;for(let i in t){if(i===`__proto__`||s.has(i))continue;if(l===`never`){o.push(i);continue}let a=c.run({value:t[i],issues:[]},r);a instanceof Promise?e.push(a.then(e=>Dr(e,n,i,t,u,d))):Dr(a,n,i,t,u,d)}return o.length&&n.issues.push({code:`unrecognized_keys`,keys:o,input:t,inst:a}),e.length?Promise.all(e).then(()=>n):n}var Ar=F(`$ZodObject`,(e,t)=>{if(R.init(e,t),!Object.getOwnPropertyDescriptor(t,`shape`)?.get){let e=t.shape;Object.defineProperty(t,"shape",{get:()=>{let n={...e};return Object.defineProperty(t,"shape",{value:n}),n}})}let n=Ke(()=>Or(t));I(e._zod,`propValues`,()=>{let e=t.shape,n={};for(let t in e){let r=e[t]._zod;if(r.values){n[t]??(n[t]=new Set);for(let e of r.values)n[t].add(e)}}return n});let r=nt,i=t.catchall,a;e._zod.parse=(t,o)=>{a??=n.value;let s=t.value;if(!r(s))return t.issues.push({expected:`object`,code:`invalid_type`,input:s,inst:e}),t;t.value={};let c=[],l=a.shape;for(let e of a.keys){let n=l[e],r=n._zod.optin===`optional`,i=n._zod.optout===`optional`,a=n._zod.run({value:s[e],issues:[]},o);a instanceof Promise?c.push(a.then(n=>Dr(n,t,e,s,r,i))):Dr(a,t,e,s,r,i)}return i?kr(c,s,t,o,n.value,e):c.length?Promise.all(c).then(()=>t):t}}),jr=F(`$ZodObjectJIT`,(e,t)=>{Ar.init(e,t);let n=e._zod.parse,r=Ke(()=>Or(t)),i=e=>{let t=new Vn([`shape`,`payload`,`ctx`]),n=r.value,i=e=>{let t=$e(e);return`shape[${t}]._zod.run({ value: input[${t}], issues: [] }, ctx)`};t.write(`const input = payload.value;`);let a=Object.create(null),o=0;for(let e of n.keys)a[e]=`key_${o++}`;t.write(`const newResult = {};`);for(let r of n.keys){let n=a[r],o=$e(r),s=e[r],c=s?._zod?.optin===`optional`,l=s?._zod?.optout===`optional`;t.write(`const ${n} = ${i(r)};`),c&&l?t.write(`
4
4
  if (${n}.issues.length) {
@@ -62,4 +62,4 @@ import{t as e}from"./rolldown-runtime-BcKkbAw3.js";import{c as t,d as n,i as r,l
62
62
  `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=nt,s=!He.jitless,c=s&&rt.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?kr([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function Mr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!vt(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>St(e,r,Ue())))}),t)}var Nr=F(`$ZodUnion`,(e,t)=>{R.init(e,t),I(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),I(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),I(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),I(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>Je(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>Mr(t,r,e,i)):Mr(o,r,e,i)}}),Pr=F(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Nr.init(e,t);let n=e._zod.parse;I(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=Ke(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!nt(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),Fr=F(`$ZodIntersection`,(e,t)=>{R.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Lr(e,t,n)):Lr(e,i,a)}});function Ir(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(it(e)&&it(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Ir(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Ir(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Lr(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),vt(e))return e;let o=Ir(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}var Rr=F(`$ZodRecord`,(e,t)=>{R.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!it(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>St(e,r,Ue())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...bt(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...bt(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&vn.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>St(e,r,Ue())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...bt(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...bt(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),zr=F(`$ZodEnum`,(e,t)=>{R.init(e,t);let n=We(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>ot.has(typeof e)).map(e=>typeof e==`string`?st(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Br=F(`$ZodLiteral`,(e,t)=>{if(R.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?st(e):e?st(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Vr=F(`$ZodTransform`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ve(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new Be;return n.value=i,n.fallback=!0,n}});function Hr(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}var Ur=F(`$ZodOptional`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,I(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),I(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Je(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Hr(e,r)):Hr(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Wr=F(`$ZodExactOptional`,(e,t)=>{Ur.init(e,t),I(e._zod,`values`,()=>t.innerType._zod.values),I(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Gr=F(`$ZodNullable`,(e,t)=>{R.init(e,t),I(e._zod,`optin`,()=>t.innerType._zod.optin),I(e._zod,`optout`,()=>t.innerType._zod.optout),I(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${Je(e.source)}|null)$`):void 0}),I(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Kr=F(`$ZodDefault`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,I(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>qr(e,t)):qr(r,t)}});function qr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}var Jr=F(`$ZodPrefault`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,I(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Yr=F(`$ZodNonOptional`,(e,t)=>{R.init(e,t),I(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Xr(t,e)):Xr(i,e)}});function Xr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}var Zr=F(`$ZodCatch`,(e,t)=>{R.init(e,t),e._zod.optin=`optional`,I(e._zod,`optout`,()=>t.innerType._zod.optout),I(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>St(e,n,Ue()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>St(e,n,Ue()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Qr=F(`$ZodPipe`,(e,t)=>{R.init(e,t),I(e._zod,`values`,()=>t.in._zod.values),I(e._zod,`optin`,()=>t.in._zod.optin),I(e._zod,`optout`,()=>t.out._zod.optout),I(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>$r(e,t.in,n)):$r(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>$r(e,t.out,n)):$r(r,t.out,n)}});function $r(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}var ei=F(`$ZodReadonly`,(e,t)=>{R.init(e,t),I(e._zod,`propValues`,()=>t.innerType._zod.propValues),I(e._zod,`values`,()=>t.innerType._zod.values),I(e._zod,`optin`,()=>t.innerType?._zod?.optin),I(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(ti):ti(r)}});function ti(e){return e.value=Object.freeze(e.value),e}var ni=F(`$ZodCustom`,(e,t)=>{wn.init(e,t),R.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>ri(t,n,r,e));ri(i,n,r,e)}});function ri(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(wt(e))}}var ii,ai=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function oi(){return new ai}(ii=globalThis).__zod_globalRegistry??(ii.__zod_globalRegistry=oi());var si=globalThis.__zod_globalRegistry;function ci(e,t){return new e({type:`string`,...L(t)})}function li(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...L(t)})}function ui(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...L(t)})}function di(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...L(t)})}function fi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...L(t)})}function pi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...L(t)})}function mi(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...L(t)})}function hi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...L(t)})}function gi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...L(t)})}function _i(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...L(t)})}function vi(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...L(t)})}function yi(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...L(t)})}function bi(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...L(t)})}function xi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...L(t)})}function Si(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...L(t)})}function Ci(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...L(t)})}function wi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...L(t)})}function Ti(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...L(t)})}function Ei(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...L(t)})}function Di(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...L(t)})}function Oi(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...L(t)})}function ki(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...L(t)})}function Ai(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...L(t)})}function ji(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...L(t)})}function Mi(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...L(t)})}function Ni(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...L(t)})}function Pi(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...L(t)})}function Fi(e,t){return new e({type:`number`,checks:[],...L(t)})}function Ii(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...L(t)})}function Li(e,t){return new e({type:`boolean`,...L(t)})}function Ri(e,t){return new e({type:`undefined`,...L(t)})}function zi(e,t){return new e({type:`null`,...L(t)})}function Bi(e){return new e({type:`any`})}function Vi(e){return new e({type:`unknown`})}function Hi(e,t){return new e({type:`never`,...L(t)})}function Ui(e,t){return new e({type:`void`,...L(t)})}function Wi(e,t){return new En({check:`less_than`,...L(t),value:e,inclusive:!1})}function Gi(e,t){return new En({check:`less_than`,...L(t),value:e,inclusive:!0})}function Ki(e,t){return new Dn({check:`greater_than`,...L(t),value:e,inclusive:!1})}function qi(e,t){return new Dn({check:`greater_than`,...L(t),value:e,inclusive:!0})}function Ji(e,t){return new On({check:`multiple_of`,...L(t),value:e})}function Yi(e,t){return new An({check:`max_length`,...L(t),maximum:e})}function Xi(e,t){return new jn({check:`min_length`,...L(t),minimum:e})}function Zi(e,t){return new Mn({check:`length_equals`,...L(t),length:e})}function Qi(e,t){return new Pn({check:`string_format`,format:`regex`,...L(t),pattern:e})}function $i(e){return new Fn({check:`string_format`,format:`lowercase`,...L(e)})}function ea(e){return new In({check:`string_format`,format:`uppercase`,...L(e)})}function ta(e,t){return new Ln({check:`string_format`,format:`includes`,...L(t),includes:e})}function na(e,t){return new Rn({check:`string_format`,format:`starts_with`,...L(t),prefix:e})}function ra(e,t){return new zn({check:`string_format`,format:`ends_with`,...L(t),suffix:e})}function ia(e){return new Bn({check:`overwrite`,tx:e})}function aa(e){return ia(t=>t.normalize(e))}function oa(){return ia(e=>e.trim())}function sa(){return ia(e=>e.toLowerCase())}function ca(){return ia(e=>e.toUpperCase())}function la(){return ia(e=>et(e))}function ua(e,t,n){return new e({type:`array`,element:t,...L(n)})}function da(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...L(n)})}function fa(e,t){let n=pa(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(wt(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(wt(r))}},e(t.value,t)),t);return n}function pa(e,t){let n=new wn({check:`custom`,...L(t)});return n._zod.check=e,n}function ma(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??si,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function B(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,B(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&_a(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function ha(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
63
63
 
64
64
  Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function ga(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e!==`$ref`&&e!==`allOf`&&(e in a||delete i[e]);if(s.$ref&&n.def)for(let e in i)e!==`$ref`&&e!==`allOf`&&e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e!==`$ref`&&e!==`allOf`&&e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,"~standard",{value:{...t[`~standard`],jsonSchema:{input:ya(t,`input`,e.processors),output:ya(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function _a(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return _a(r.element,n);if(r.type===`set`)return _a(r.valueType,n);if(r.type===`lazy`)return _a(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type==="default"||r.type===`prefault`)return _a(r.innerType,n);if(r.type===`intersection`)return _a(r.left,n)||_a(r.right,n);if(r.type===`record`||r.type===`map`)return _a(r.keyType,n)||_a(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:_a(r.in,n)||_a(r.out,n);if(r.type===`object`){for(let e in r.shape)if(_a(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(_a(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(_a(e,n))return!0;return!!(r.rest&&_a(r.rest,n))}return!1}var va=(e,t={})=>n=>{let r=ma({...n,processors:t});return B(e,r),ha(r,e),ga(r,e)},ya=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ma({...i??{},target:a,io:t,processors:n});return B(e,o),ha(o,e),ga(o,e)},ba={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},xa=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ba[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},Sa=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;i.type=typeof s==`string`&&s.includes(`int`)?`integer`:`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},Ca=(e,t,n,r)=>{n.type=`boolean`},wa=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},Ta=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Undefined cannot be represented in JSON Schema`)},Ea=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Void cannot be represented in JSON Schema`)},Da=(e,t,n,r)=>{n.not={}},Oa=(e,t,n,r)=>{let i=e._zod.def,a=We(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ka=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0){if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a}},Aa=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ja=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},Ma=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=B(a.element,t,{...r,path:[...r.path,`items`]})},Na=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=B(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=B(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Pa=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>B(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Fa=(e,t,n,r)=>{let i=e._zod.def,a=B(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=B(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Ia=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=B(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else(t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=B(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=B(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},La=(e,t,n,r)=>{let i=e._zod.def,a=B(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ra=(e,t,n,r)=>{let i=e._zod.def;B(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},za=(e,t,n,r)=>{let i=e._zod.def;B(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Ba=(e,t,n,r)=>{let i=e._zod.def;B(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Va=(e,t,n,r)=>{let i=e._zod.def;B(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Ha=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;B(o,t,r);let s=t.seen.get(e);s.ref=o},Ua=(e,t,n,r)=>{let i=e._zod.def;B(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Wa=(e,t,n,r)=>{let i=e._zod.def;B(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ga=F(`ZodISODateTime`,(e,t)=>{tr.init(e,t),U.init(e,t)});function Ka(e){return ji(Ga,e)}var qa=F(`ZodISODate`,(e,t)=>{nr.init(e,t),U.init(e,t)});function Ja(e){return Mi(qa,e)}var Ya=F(`ZodISOTime`,(e,t)=>{rr.init(e,t),U.init(e,t)});function Xa(e){return Ni(Ya,e)}var Za=F(`ZodISODuration`,(e,t)=>{ir.init(e,t),U.init(e,t)});function Qa(e){return Pi(Za,e)}var $a=(e,t)=>{Et.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>kt(e,t)},flatten:{value:t=>Ot(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,Ge,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,Ge,2)}},isEmpty:{get(){return e.issues.length===0}}})},eo=F(`ZodError`,$a),to=F(`ZodError`,$a,{Parent:Error}),no=At(to),ro=jt(to),io=Mt(to),ao=Pt(to),oo=It(to),so=Lt(to),co=Rt(to),lo=zt(to),uo=Bt(to),fo=Vt(to),po=Ht(to),mo=Ut(to),ho=new WeakMap;function go(e,t,n){let r=Object.getPrototypeOf(e),i=ho.get(r);if(i||(i=new Set,ho.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}var V=F(`ZodType`,(e,t)=>(R.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ya(e,`input`),output:ya(e,`output`)}}),e.toJSONSchema=va(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,"_def",{value:t}),e.parse=(t,n)=>no(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>io(e,t,n),e.parseAsync=async(t,n)=>ro(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>ao(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>oo(e,t,n),e.decode=(t,n)=>so(e,t,n),e.encodeAsync=async(t,n)=>co(e,t,n),e.decodeAsync=async(t,n)=>lo(e,t,n),e.safeEncode=(t,n)=>uo(e,t,n),e.safeDecode=(t,n)=>fo(e,t,n),e.safeEncodeAsync=async(t,n)=>po(e,t,n),e.safeDecodeAsync=async(t,n)=>mo(e,t,n),go(e,`ZodType`,{check(...e){let t=this.def;return this.clone(Qe(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return ct(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(Ms(e,t))},superRefine(e,t){return this.check(Ns(e,t))},overwrite(e){return this.check(ia(e))},optional(){return ms(this)},exactOptional(){return gs(this)},nullable(){return vs(this)},nullish(){return ms(vs(this))},nonoptional(e){return ws(this,e)},array(){return K(this)},or(e){return J([this,e])},and(e){return os(this,e)},transform(e){return Os(this,fs(e))},default(e){return bs(this,e)},prefault(e){return Ss(this,e)},catch(e){return Es(this,e)},pipe(e){return Os(this,e)},readonly(){return As(this)},describe(e){let t=this.clone();return si.add(t,{description:e}),t},meta(...e){if(e.length===0)return si.get(this);let t=this.clone();return si.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,"description",{get(){return si.get(e)?.description},configurable:!0}),e)),_o=F(`_ZodString`,(e,t)=>{Un.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xa(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,go(e,`_ZodString`,{regex(...e){return this.check(Qi(...e))},includes(...e){return this.check(ta(...e))},startsWith(...e){return this.check(na(...e))},endsWith(...e){return this.check(ra(...e))},min(...e){return this.check(Xi(...e))},max(...e){return this.check(Yi(...e))},length(...e){return this.check(Zi(...e))},nonempty(...e){return this.check(Xi(1,...e))},lowercase(e){return this.check($i(e))},uppercase(e){return this.check(ea(e))},trim(){return this.check(oa())},normalize(...e){return this.check(aa(...e))},toLowerCase(){return this.check(sa())},toUpperCase(){return this.check(ca())},slugify(){return this.check(la())}})}),vo=F(`ZodString`,(e,t)=>{Un.init(e,t),_o.init(e,t),e.email=t=>e.check(li(yo,t)),e.url=t=>e.check(hi(So,t)),e.jwt=t=>e.check(Ai(Lo,t)),e.emoji=t=>e.check(gi(Co,t)),e.guid=t=>e.check(ui(bo,t)),e.uuid=t=>e.check(di(xo,t)),e.uuidv4=t=>e.check(fi(xo,t)),e.uuidv6=t=>e.check(pi(xo,t)),e.uuidv7=t=>e.check(mi(xo,t)),e.nanoid=t=>e.check(_i(wo,t)),e.guid=t=>e.check(ui(bo,t)),e.cuid=t=>e.check(vi(To,t)),e.cuid2=t=>e.check(yi(Eo,t)),e.ulid=t=>e.check(bi(Do,t)),e.base64=t=>e.check(Di(Po,t)),e.base64url=t=>e.check(Oi(Fo,t)),e.xid=t=>e.check(xi(Oo,t)),e.ksuid=t=>e.check(Si(ko,t)),e.ipv4=t=>e.check(Ci(Ao,t)),e.ipv6=t=>e.check(wi(jo,t)),e.cidrv4=t=>e.check(Ti(Mo,t)),e.cidrv6=t=>e.check(Ei(No,t)),e.e164=t=>e.check(ki(Io,t)),e.datetime=t=>e.check(Ka(t)),e.date=t=>e.check(Ja(t)),e.time=t=>e.check(Xa(t)),e.duration=t=>e.check(Qa(t))});function H(e){return ci(vo,e)}var U=F(`ZodStringFormat`,(e,t)=>{z.init(e,t),_o.init(e,t)}),yo=F(`ZodEmail`,(e,t)=>{Kn.init(e,t),U.init(e,t)}),bo=F(`ZodGUID`,(e,t)=>{Wn.init(e,t),U.init(e,t)}),xo=F(`ZodUUID`,(e,t)=>{Gn.init(e,t),U.init(e,t)}),So=F(`ZodURL`,(e,t)=>{qn.init(e,t),U.init(e,t)}),Co=F(`ZodEmoji`,(e,t)=>{Jn.init(e,t),U.init(e,t)}),wo=F(`ZodNanoID`,(e,t)=>{Yn.init(e,t),U.init(e,t)}),To=F(`ZodCUID`,(e,t)=>{Xn.init(e,t),U.init(e,t)}),Eo=F(`ZodCUID2`,(e,t)=>{Zn.init(e,t),U.init(e,t)}),Do=F(`ZodULID`,(e,t)=>{Qn.init(e,t),U.init(e,t)}),Oo=F(`ZodXID`,(e,t)=>{$n.init(e,t),U.init(e,t)}),ko=F(`ZodKSUID`,(e,t)=>{er.init(e,t),U.init(e,t)}),Ao=F(`ZodIPv4`,(e,t)=>{ar.init(e,t),U.init(e,t)}),jo=F(`ZodIPv6`,(e,t)=>{or.init(e,t),U.init(e,t)}),Mo=F(`ZodCIDRv4`,(e,t)=>{sr.init(e,t),U.init(e,t)}),No=F(`ZodCIDRv6`,(e,t)=>{cr.init(e,t),U.init(e,t)}),Po=F(`ZodBase64`,(e,t)=>{ur.init(e,t),U.init(e,t)}),Fo=F(`ZodBase64URL`,(e,t)=>{fr.init(e,t),U.init(e,t)}),Io=F(`ZodE164`,(e,t)=>{pr.init(e,t),U.init(e,t)}),Lo=F(`ZodJWT`,(e,t)=>{hr.init(e,t),U.init(e,t)}),Ro=F(`ZodNumber`,(e,t)=>{gr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sa(e,t,n,r),go(e,`ZodNumber`,{gt(e,t){return this.check(Ki(e,t))},gte(e,t){return this.check(qi(e,t))},min(e,t){return this.check(qi(e,t))},lt(e,t){return this.check(Wi(e,t))},lte(e,t){return this.check(Gi(e,t))},max(e,t){return this.check(Gi(e,t))},int(e){return this.check(Bo(e))},safe(e){return this.check(Bo(e))},positive(e){return this.check(Ki(0,e))},nonnegative(e){return this.check(qi(0,e))},negative(e){return this.check(Wi(0,e))},nonpositive(e){return this.check(Gi(0,e))},multipleOf(e,t){return this.check(Ji(e,t))},step(e,t){return this.check(Ji(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function W(e){return Fi(Ro,e)}var zo=F(`ZodNumberFormat`,(e,t)=>{_r.init(e,t),Ro.init(e,t)});function Bo(e){return Ii(zo,e)}var Vo=F(`ZodBoolean`,(e,t)=>{vr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ca(e,t,n,r)});function Ho(e){return Li(Vo,e)}var Uo=F(`ZodUndefined`,(e,t)=>{yr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ta(e,t,n,r)});function Wo(e){return Ri(Uo,e)}var Go=F(`ZodNull`,(e,t)=>{br.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wa(e,t,n,r)});function G(e){return zi(Go,e)}var Ko=F(`ZodAny`,(e,t)=>{xr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function qo(){return Bi(Ko)}var Jo=F(`ZodUnknown`,(e,t)=>{Sr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function Yo(){return Vi(Jo)}var Xo=F(`ZodNever`,(e,t)=>{Cr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Da(e,t,n,r)});function Zo(e){return Hi(Xo,e)}var Qo=F(`ZodVoid`,(e,t)=>{wr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ea(e,t,n,r)});function $o(e){return Ui(Qo,e)}var es=F(`ZodArray`,(e,t)=>{Er.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ma(e,t,n,r),e.element=t.element,go(e,`ZodArray`,{min(e,t){return this.check(Xi(e,t))},nonempty(e){return this.check(Xi(1,e))},max(e,t){return this.check(Yi(e,t))},length(e,t){return this.check(Zi(e,t))},unwrap(){return this.element}})});function K(e,t){return ua(es,e,t)}var ts=F(`ZodObject`,(e,t)=>{jr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Na(e,t,n,r),I(e,`shape`,()=>t.shape),go(e,`ZodObject`,{keyof(){return Y(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:Yo()})},loose(){return this.clone({...this._zod.def,catchall:Yo()})},strict(){return this.clone({...this._zod.def,catchall:Zo()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return pt(this,e)},safeExtend(e){return mt(this,e)},merge(e){return ht(this,e)},pick(e){return dt(this,e)},omit(e){return ft(this,e)},partial(...e){return gt(ps,this,e[0])},required(...e){return _t(Cs,this,e[0])}})});function q(e,t){return new ts({type:`object`,shape:e??{},...L(t)})}var ns=F(`ZodUnion`,(e,t)=>{Nr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Pa(e,t,n,r),e.options=t.options});function J(e,t){return new ns({type:`union`,options:e,...L(t)})}var rs=F(`ZodDiscriminatedUnion`,(e,t)=>{ns.init(e,t),Pr.init(e,t)});function is(e,t,n){return new rs({type:`union`,options:t,discriminator:e,...L(n)})}var as=F(`ZodIntersection`,(e,t)=>{Fr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Fa(e,t,n,r)});function os(e,t){return new as({type:`intersection`,left:e,right:t})}var ss=F(`ZodRecord`,(e,t)=>{Rr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ia(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function cs(e,t,n){return!t||!t._zod?new ss({type:`record`,keyType:H(),valueType:e,...L(t)}):new ss({type:`record`,keyType:e,valueType:t,...L(n)})}var ls=F(`ZodEnum`,(e,t)=>{zr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oa(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new ls({...t,checks:[],...L(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new ls({...t,checks:[],...L(r),entries:i})}});function Y(e,t){return new ls({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...L(t)})}var us=F(`ZodLiteral`,(e,t)=>{Br.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ka(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,"value",{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function X(e,t){return new us({type:`literal`,values:Array.isArray(e)?e:[e],...L(t)})}var ds=F(`ZodTransform`,(e,t)=>{Vr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ja(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new Ve(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(wt(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(wt(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function fs(e){return new ds({type:`transform`,transform:e})}var ps=F(`ZodOptional`,(e,t)=>{Ur.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ms(e){return new ps({type:`optional`,innerType:e})}var hs=F(`ZodExactOptional`,(e,t)=>{Wr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Wa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gs(e){return new hs({type:`optional`,innerType:e})}var _s=F(`ZodNullable`,(e,t)=>{Gr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>La(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function vs(e){return new _s({type:`nullable`,innerType:e})}var ys=F(`ZodDefault`,(e,t)=>{Kr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>za(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function bs(e,t){return new ys({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():at(t)}})}var xs=F(`ZodPrefault`,(e,t)=>{Jr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ba(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ss(e,t){return new xs({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():at(t)}})}var Cs=F(`ZodNonOptional`,(e,t)=>{Yr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ra(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ws(e,t){return new Cs({type:`nonoptional`,innerType:e,...L(t)})}var Ts=F(`ZodCatch`,(e,t)=>{Zr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Va(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function Es(e,t){return new Ts({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}var Ds=F(`ZodPipe`,(e,t)=>{Qr.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ha(e,t,n,r),e.in=t.in,e.out=t.out});function Os(e,t){return new Ds({type:`pipe`,in:e,out:t})}var ks=F(`ZodReadonly`,(e,t)=>{ei.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ua(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function As(e){return new ks({type:`readonly`,innerType:e})}var js=F(`ZodCustom`,(e,t)=>{ni.init(e,t),V.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aa(e,t,n,r)});function Ms(e,t={}){return da(js,e,t)}function Ns(e,t){return fa(e,t)}var Ps=q({ready:Ho(),reason:H().min(1).optional()}),Fs=q({id:H(),name:H(),address:H(),currency:H(),balance:H(),spendableBalance:H(),blockHeight:J([W(),Wo()]),lastSyncDate:H(),parentAccountId:H().optional(),publicKey:H().optional(),readiness:Ps.optional()}),Is=Y([`CryptoCurrency`,`TokenCurrency`]),Ls=Y([`ERC20`]),Rs=q({color:H(),ticker:H(),id:H(),name:H(),decimals:W()}),zs=is(`type`,[Rs.extend({type:X(Is.enum.CryptoCurrency),family:H()}),Rs.extend({type:X(Is.enum.TokenCurrency),parent:H()}).extend({standard:Ls,contract:H()})]),Z=q({amount:H(),recipient:H()}),Q=Y(`aleo.algorand.aptos.bitcoin.cardano.casper.celo.crypto_org.cosmos.elrond.ethereum.filecoin.hedera.hypercore.internet_computer.kaspa.near.neo.polkadot.ripple.solana.stacks.stellar.sui.tezos.ton.tron.vechain`.split(`.`)),Bs=({family:e,mode:t,fees:n,assetId:r,memo:i,amount:a,recipient:o})=>({family:e,amount:a.toString(),recipient:o,fees:n?n.toString():void 0,memo:i,mode:t,assetId:r}),Vs=({family:e,mode:t,fees:n,assetId:r,memo:i,amount:a,recipient:o})=>({family:e,amount:new P(a),recipient:o,fees:n?new P(n):void 0,memo:i,mode:t,assetId:r}),Hs=({family:e,mode:t,fees:n,amount:r,recipient:i})=>({family:e,amount:r.toString(),recipient:i,fees:n?n.toString():void 0,mode:t}),Us=({family:e,mode:t,fees:n,amount:r,recipient:i})=>({family:e,amount:new P(r),recipient:i,fees:n?new P(n):void 0,mode:t});k();function Ws({family:e,amount:t,recipient:n,feePerByte:r,opReturnData:i,changeAddress:a}){return{family:e,amount:t.toString(),recipient:n,feePerByte:r?.toString(),opReturnDataHex:i?.toString(`hex`),changeAddress:a}}function Gs({family:e,amount:t,recipient:n,feePerByte:r,opReturnDataHex:i,changeAddress:a}){return{family:e,amount:new P(t),recipient:n,feePerByte:r?new P(r):void 0,opReturnData:i?A.from(i,`hex`):void 0,changeAddress:a}}function Ks({amount:e,family:t,fees:n=void 0,index:r=void 0,mode:i,recipient:a}){return{amount:e.toString(),family:t,fees:n?n.toString():void 0,index:r,mode:i,recipient:a}}function qs({amount:e,family:t,fees:n=void 0,index:r=void 0,mode:i,recipient:a}){return{amount:new P(e),family:t,fees:n?new P(n):void 0,index:r,mode:i,recipient:a}}var Js=({amount:e,recipient:t,family:n,mode:r,fees:i,gas:a,memo:o,sourceValidator:s,validators:c})=>({amount:e.toString(),recipient:t,family:n,mode:r,fees:i?i.toString():void 0,gas:a?a.toString():void 0,memo:o,sourceValidator:s??void 0,validators:c?c.map(e=>({...e,amount:e.amount.toString()})):void 0}),Ys=({amount:e,recipient:t,family:n,mode:r,fees:i,gas:a,memo:o,sourceValidator:s,validators:c})=>({amount:new P(e),recipient:t,family:n,mode:r,fees:i?new P(i):void 0,gas:a?new P(a):void 0,memo:o,sourceValidator:s??void 0,validators:c?c.map(e=>({...e,amount:new P(e.amount)})):void 0}),Xs=({family:e,mode:t,fees:n,amount:r,recipient:i})=>({family:e,amount:r.toString(),recipient:i,fees:n?n.toString():void 0,mode:t}),Zs=({family:e,mode:t,fees:n,amount:r,recipient:i})=>({family:e,amount:new P(r),recipient:i,fees:n?new P(n):void 0,mode:t});k();function Qs({family:e,amount:t,recipient:n,nonce:r,data:i,gasPrice:a,gasLimit:o,maxPriorityFeePerGas:s,maxFeePerGas:c,sponsored:l}){return{family:e,amount:t.toString(),recipient:n,nonce:r,data:i?i.toString(`hex`):void 0,gasPrice:a?a.toString():void 0,gasLimit:o?o.toString():void 0,maxPriorityFeePerGas:s?s.toString():void 0,maxFeePerGas:c?c.toString():void 0,sponsored:l}}function $s({family:e,amount:t,recipient:n,nonce:r,data:i,gasPrice:a,gasLimit:o,maxPriorityFeePerGas:s,maxFeePerGas:c,sponsored:l}){return{family:e,amount:new P(t),recipient:n,nonce:r,data:i?A.from(i,`hex`):void 0,gasPrice:a?new P(a):void 0,gasLimit:o?new P(o):void 0,maxPriorityFeePerGas:s?new P(s):void 0,maxFeePerGas:c?new P(c):void 0,sponsored:l}}function ec({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:e.toString(),recipient:t,family:n,mode:r,fees:i?.toString()}}function tc({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:new P(e),recipient:t,family:n,mode:r,fees:i?new P(i):void 0}}function nc({amount:e,family:t,memo:n=void 0,recipient:r}){return{amount:e.toString(),family:t,memo:n,recipient:r}}function rc({amount:e,family:t,memo:n=void 0,recipient:r}){return{amount:new P(e),family:t,memo:n,recipient:r}}function ic({family:e,amount:t,recipient:n,customFeeRate:r}){return{family:e,amount:t.toString(),recipient:n,customFeeRate:r?.toString()}}function ac({family:e,amount:t,recipient:n,customFeeRate:r}){return{family:e,amount:new P(t),recipient:n,customFeeRate:r?new P(r):void 0}}k();function oc({amount:e,data:t=void 0,family:n,method:r,nonce:i,params:a=void 0,gasLimit:o,gasFeeCap:s,gasPremium:c,recipient:l,version:u}){return{amount:e.toString(),data:t?t.toString(`hex`):void 0,family:n,gasLimit:o.toNumber(),gasFeeCap:s.toString(),gasPremium:c.toString(),method:r,nonce:i,params:a,recipient:l,version:u}}function sc({amount:e,data:t=void 0,family:n,method:r,nonce:i,params:a=void 0,gasLimit:o,gasFeeCap:s,gasPremium:c,recipient:l,version:u}){return{amount:new P(e),data:t?A.from(t,`hex`):void 0,family:n,gasLimit:new P(o),gasFeeCap:new P(s),gasPremium:new P(c),nonce:i,method:r,params:a,recipient:l,version:u}}function cc({amount:e,recipient:t,family:n}){return{amount:e.toString(),recipient:t,family:n}}function lc({amount:e,recipient:t,family:n}){return{amount:new P(e),recipient:t,family:n}}var uc=({amount:e,recipient:t,family:n,mode:r,fee:i,era:a,validators:o,numOfSlashingSpans:s,rewardDestination:c})=>({amount:e.toString(),recipient:t,family:n,mode:r,fee:i?i.toString():void 0,era:a,validators:o,numOfSlashingSpans:s,rewardDestination:c}),dc=({amount:e,recipient:t,family:n,mode:r,fee:i,era:a,validators:o,numOfSlashingSpans:s,rewardDestination:c})=>({amount:new P(e),recipient:t,family:n,mode:r,fee:i?new P(i):void 0,era:a,validators:o,numOfSlashingSpans:s,rewardDestination:c}),fc=({family:e,fee:t,tag:n,amount:r,recipient:i})=>({family:e,amount:r.toString(),recipient:i,fee:t?t.toString():void 0,tag:n}),pc=({family:e,fee:t,tag:n,amount:r,recipient:i})=>({family:e,amount:new P(r),recipient:i,fee:t?new P(t):void 0,tag:n}),mc=({amount:e,recipient:t,family:n,fees:r,memoType:i,memoValue:a})=>({amount:e.toString(),recipient:t,family:n,fees:r?r.toString():void 0,memoType:i,memoValue:a}),hc=({amount:e,recipient:t,family:n,fees:r,memoType:i,memoValue:a})=>({amount:new P(e),recipient:t,family:n,fees:r?new P(r):void 0,memoType:i,memoValue:a}),gc=({amount:e,recipient:t,family:n,mode:r,fees:i,gasLimit:a})=>({amount:e.toString(),recipient:t,family:n,mode:r,fees:i?i.toString():void 0,gasLimit:a?a.toString():void 0}),_c=({amount:e,recipient:t,family:n,mode:r,fees:i,gasLimit:a})=>({amount:new P(e),recipient:t,family:n,mode:r,fees:i?new P(i):void 0,gasLimit:a?new P(a):void 0}),vc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.inspectSymbol=void 0,e.inspectSymbol=Symbol.for(`nodejs.util.inspect.custom`)})),yc=e((e=>{k(),Object.defineProperty(e,"__esModule",{value:!0}),e.crc16=void 0;function t(e){let t=0,n=A.alloc(e.length+2);n.set(e);for(let e of n){let n=128;for(;n>0;)t<<=1,e&n&&(t+=1),n>>=1,t>65535&&(t&=65535,t^=4129)}return A.from([Math.floor(t/256),t%256])}e.crc16=t})),bc=e((e=>{k();var t;Object.defineProperty(e,"__esModule",{value:!0}),e.address=e.Address=void 0;var n=vc(),r=yc(),i=17,a=81,o=128;function s(e){if(typeof e==`string`&&!c.isFriendly(e))throw Error(`Unknown address type`);let t=A.isBuffer(e)?e:A.from(e,`base64`);if(t.length!==36)throw Error(`Unknown address type: byte length is not equal to 36`);let n=t.subarray(0,34),s=t.subarray(34,36),l=(0,r.crc16)(n);if(l[0]!==s[0]||l[1]!==s[1])throw Error(`Invalid checksum: `+e);let u=n[0],d=!1,f=!1;if(u&o&&(d=!0,u^=o),u!==i&&u!==a)throw`Unknown address tag`;f=u===i;let p=null;p=n[1]===255?-1:n[1];let m=n.subarray(2,34);return{isTestOnly:d,isBounceable:f,workchain:p,hashPart:m}}var c=class e{static isAddress(t){return t instanceof e}static isFriendly(e){return!(e.length!==48||!/^[A-Za-z0-9+/_-]+$/.test(e))}static isRaw(e){if(e.indexOf(`:`)===-1)return!1;let[t,n]=e.split(`:`);return!(!Number.isInteger(parseFloat(t))||!/[a-f0-9]+/.test(n.toLowerCase())||n.length!==64)}static normalize(t){return typeof t==`string`?e.parse(t).toString():t.toString()}static parse(t){if(e.isFriendly(t))return this.parseFriendly(t).address;if(e.isRaw(t))return this.parseRaw(t);throw Error(`Unknown address type: `+t)}static parseRaw(t){let n=parseInt(t.split(`:`)[0]),r=A.from(t.split(`:`)[1],`hex`);return new e(n,r)}static parseFriendly(t){if(A.isBuffer(t)){let n=s(t);return{isBounceable:n.isBounceable,isTestOnly:n.isTestOnly,address:new e(n.workchain,n.hashPart)}}{let n=s(t.replace(/\-/g,`+`).replace(/_/g,`/`));return{isBounceable:n.isBounceable,isTestOnly:n.isTestOnly,address:new e(n.workchain,n.hashPart)}}}constructor(e,n){if(this.toRawString=()=>this.workChain+`:`+this.hash.toString(`hex`),this.toRaw=()=>{let e=A.alloc(36);return e.set(this.hash),e.set([this.workChain,this.workChain,this.workChain,this.workChain],32),e},this.toStringBuffer=e=>{let t=e&&e.testOnly!==void 0?e.testOnly:!1,n=!(e&&e.bounceable!==void 0)||e.bounceable?i:a;t&&(n|=o);let s=A.alloc(34);s[0]=n,s[1]=this.workChain,s.set(this.hash,2);let c=A.alloc(36);return c.set(s),c.set((0,r.crc16)(s),34),c},this.toString=e=>{let t=e&&e.urlSafe!==void 0?e.urlSafe:!0,n=this.toStringBuffer(e);return t?n.toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`):n.toString(`base64`)},this[t]=()=>this.toString(),n.length!==32)throw Error(`Invalid address hash length: `+n.length);this.workChain=e,this.hash=n,Object.freeze(this)}equals(e){return e.workChain===this.workChain&&e.hash.equals(this.hash)}};e.Address=c,t=n.inspectSymbol;function l(e){return c.parse(e)}e.address=l})),xc=e((e=>{var t;Object.defineProperty(e,"__esModule",{value:!0}),e.ExternalAddress=void 0;var n=vc();e.ExternalAddress=class e{static isAddress(t){return t instanceof e}constructor(e,n){this[t]=()=>this.toString(),this.value=e,this.bits=n}toString(){return`External<${this.bits}:${this.value}>`}},t=n.inspectSymbol})),Sc=e((e=>{k(),Object.defineProperty(e,"__esModule",{value:!0}),e.base32Decode=e.base32Encode=void 0;var t=`abcdefghijklmnopqrstuvwxyz234567`;function n(e){let n=e.byteLength,r=0,i=0,a=``;for(let o=0;o<n;o++)for(i=i<<8|e[o],r+=8;r>=5;)a+=t[i>>>r-5&31],r-=5;return r>0&&(a+=t[i<<5-r&31]),a}e.base32Encode=n;function r(e,t){let n=e.indexOf(t);if(n===-1)throw Error(`Invalid character found: `+t);return n}function i(e){let n;n=e.toLowerCase();let{length:i}=n,a=0,o=0,s=0,c=A.alloc(i*5/8|0);for(let e=0;e<i;e++)o=o<<5|r(t,n[e]),a+=5,a>=8&&(c[s++]=o>>>a-8&255,a-=8);return c}e.base32Decode=i})),Cc=e((e=>{k();var t;Object.defineProperty(e,"__esModule",{value:!0}),e.ADNLAddress=void 0;var n=vc(),r=Sc(),i=yc();e.ADNLAddress=class e{static parseFriendly(t){if(t.length!==55)throw Error(`Invalid address`);t=`f`+t;let n=(0,r.base32Decode)(t);if(n[0]!==45)throw Error(`Invalid address`);let a=n.slice(33);if(!(0,i.crc16)(n.slice(0,33)).equals(a))throw Error(`Invalid address`);return new e(n.slice(1,33))}static parseRaw(t){let n=A.from(t,`base64`);return new e(n)}constructor(e){if(this.toRaw=()=>this.address.toString(`hex`).toUpperCase(),this.toString=()=>{let e=A.concat([A.from([45]),this.address]),t=(0,i.crc16)(e);return e=A.concat([e,t]),(0,r.base32Encode)(e).slice(1)},this[t]=()=>this.toString(),e.length!==32)throw Error(`Invalid address`);this.address=e}equals(e){return this.address.equals(e.address)}},t=n.inspectSymbol})),wc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.paddedBufferToBits=e.bitsToPaddedBuffer=void 0;var t=Ec(),n=Tc();function r(e){let n=new t.BitBuilder(Math.ceil(e.length/8)*8);n.writeBits(e);let r=Math.ceil(e.length/8)*8-e.length;for(let e=0;e<r;e++)e===0?n.writeBit(1):n.writeBit(0);return n.buffer()}e.bitsToPaddedBuffer=r;function i(e){let t=0;for(let n=e.length-1;n>=0;n--)if(e[n]!==0){let r=e[n],i=r&-r;i&1||(i=Math.log2(i)+1),n>0&&(t=n<<3),t+=8-i;break}return new n.BitString(e,0,t)}e.paddedBufferToBits=i})),Tc=e((e=>{k();var t;Object.defineProperty(e,"__esModule",{value:!0}),e.BitString=void 0;var n=wc(),r=vc(),i=class e{static isBitString(t){return t instanceof e}constructor(e,n,r){if(this[t]=()=>this.toString(),r<0)throw Error(`Length ${r} is out of bounds`);this._length=r,this._data=e,this._offset=n}get length(){return this._length}at(e){if(e>=this._length)throw Error(`Index ${e} > ${this._length} is out of bounds`);if(e<0)throw Error(`Index ${e} < 0 is out of bounds`);let t=this._offset+e>>3,n=7-(this._offset+e)%8;return!!(this._data[t]&1<<n)}substring(t,n){if(t>this._length)throw Error(`Offset(${t}) > ${this._length} is out of bounds`);if(t<0)throw Error(`Offset(${t}) < 0 is out of bounds`);if(n===0)return e.EMPTY;if(t+n>this._length)throw Error(`Offset ${t} + Length ${n} > ${this._length} is out of bounds`);return new e(this._data,this._offset+t,n)}subbuffer(e,t){if(e>this._length||e<0)throw Error(`Offset ${e} is out of bounds`);if(e+t>this._length)throw Error(`Offset + Length = ${e+t} is out of bounds`);if(t%8!=0||(this._offset+e)%8!=0)return null;let n=this._offset+e>>3,r=n+(t>>3);return this._data.subarray(n,r)}equals(e){if(this._length!==e._length)return!1;for(let t=0;t<this._length;t++)if(this.at(t)!==e.at(t))return!1;return!0}toString(){let e=(0,n.bitsToPaddedBuffer)(this);if(this._length%4==0){let t=e.subarray(0,Math.ceil(this._length/8)).toString(`hex`).toUpperCase();return this._length%8==0?t:t.substring(0,t.length-1)}{let t=e.toString(`hex`).toUpperCase();return this._length%8<=4?t.substring(0,t.length-1)+`_`:t+`_`}}};e.BitString=i,t=r.inspectSymbol,i.EMPTY=new i(A.alloc(0),0,0)})),Ec=e((e=>{k(),Object.defineProperty(e,"__esModule",{value:!0}),e.BitBuilder=void 0;var t=bc(),n=xc(),r=Tc();e.BitBuilder=class{constructor(e=1023){this._buffer=A.alloc(Math.ceil(e/8)),this._length=0}get length(){return this._length}writeBit(e){let t=this._length;if(t>this._buffer.length*8)throw Error(`BitBuilder overflow`);(typeof e==`boolean`&&e===!0||typeof e==`number`&&e>0)&&(this._buffer[t/8|0]|=1<<7-t%8),this._length++}writeBits(e){for(let t=0;t<e.length;t++)this.writeBit(e.at(t))}writeBuffer(e){if(this._length%8==0){if(this._length+e.length*8>this._buffer.length*8)throw Error(`BitBuilder overflow`);e.copy(this._buffer,this._length/8),this._length+=e.length*8}else for(let t=0;t<e.length;t++)this.writeUint(e[t],8)}writeUint(e,t){if(t<0||!Number.isSafeInteger(t))throw Error(`invalid bit length. Got ${t}`);let n=BigInt(e);if(t===0){if(n!==0n)throw Error(`value is not zero for ${t} bits. Got ${e}`);return}let r=1n<<BigInt(t);if(n<0||n>=r)throw Error(`bitLength is too small for a value ${e}. Got ${t}`);if(this._length+t>this._buffer.length*8)throw Error(`BitBuilder overflow`);let i=8-this._length%8;if(i>0){let e=Math.floor(this._length/8);if(t<i){let r=Number(n);this._buffer[e]|=r<<i-t,this._length+=t}else{let r=Number(n>>BigInt(t-i));this._buffer[e]|=r,this._length+=i}}for(t-=i;t>0;)t>=8?(this._buffer[this._length/8]=Number(n>>BigInt(t-8)&255n),this._length+=8,t-=8):(this._buffer[this._length/8]=Number(n<<BigInt(8-t)&255n),this._length+=t,t=0)}writeInt(e,t){let n=BigInt(e);if(t<0||!Number.isSafeInteger(t))throw Error(`invalid bit length. Got ${t}`);if(t===0){if(n!==0n)throw Error(`value is not zero for ${t} bits. Got ${e}`);return}if(t===1){if(n!==-1n&&n!==0n)throw Error(`value is not zero or -1 for ${t} bits. Got ${e}`);this.writeBit(n===-1n);return}let r=1n<<BigInt(t)-1n;if(n<-r||n>=r)throw Error(`value is out of range for ${t} bits. Got ${e}`);n<0?(this.writeBit(!0),n=r+n):this.writeBit(!1),this.writeUint(n,t-1)}writeVarUint(e,t){let n=BigInt(e);if(t<0||!Number.isSafeInteger(t))throw Error(`invalid bit length. Got ${t}`);if(n<0)throw Error(`value is negative. Got ${e}`);if(n===0n){this.writeUint(0,t);return}let r=Math.ceil(n.toString(2).length/8),i=r*8;this.writeUint(r,t),this.writeUint(n,i)}writeVarInt(e,t){let n=BigInt(e);if(t<0||!Number.isSafeInteger(t))throw Error(`invalid bit length. Got ${t}`);if(n===0n){this.writeUint(0,t);return}let r=n>0?n:-n,i=Math.ceil((r.toString(2).length+1)/8),a=i*8;this.writeUint(i,t),this.writeInt(n,a)}writeCoins(e){this.writeVarUint(e,4)}writeAddress(e){if(e==null){this.writeUint(0,2);return}if(t.Address.isAddress(e)){this.writeUint(2,2),this.writeUint(0,1),this.writeInt(e.workChain,8),this.writeBuffer(e.hash);return}if(n.ExternalAddress.isAddress(e)){this.writeUint(1,2),this.writeUint(e.bits,9),this.writeUint(e.value,e.bits);return}throw Error(`Invalid address. Got ${e}`)}build(){return new r.BitString(this._buffer,0,this._length)}buffer(){if(this._length%8!=0)throw Error(`BitBuilder buffer is not byte aligned`);return this._buffer.subarray(0,this._length/8)}}})),Dc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.CellType=void 0;var t;(function(e){e[e.Ordinary=-1]=`Ordinary`,e[e.PrunedBranch=1]=`PrunedBranch`,e[e.Library=2]=`Library`,e[e.MerkleProof=3]=`MerkleProof`,e[e.MerkleUpdate=4]=`MerkleUpdate`})(t||(e.CellType=t={}))})),Oc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.readUnaryLength=void 0;function t(e){let t=0;for(;e.loadBit();)t++;return t}e.readUnaryLength=t})),kc=e((e=>{k(),Object.defineProperty(e,"__esModule",{value:!0}),e.BitReader=void 0;var t=bc(),n=xc();e.BitReader=class e{constructor(e,t=0){this._checkpoints=[],this._bits=e,this._offset=t}get offset(){return this._offset}get remaining(){return this._bits.length-this._offset}skip(e){if(e<0||this._offset+e>this._bits.length)throw Error(`Index ${this._offset+e} is out of bounds`);this._offset+=e}reset(){this._offset=this._checkpoints.length>0?this._checkpoints.pop():0}save(){this._checkpoints.push(this._offset)}loadBit(){let e=this._bits.at(this._offset);return this._offset++,e}preloadBit(){return this._bits.at(this._offset)}loadBits(e){let t=this._bits.substring(this._offset,e);return this._offset+=e,t}preloadBits(e){return this._bits.substring(this._offset,e)}loadBuffer(e){let t=this._preloadBuffer(e,this._offset);return this._offset+=e*8,t}preloadBuffer(e){return this._preloadBuffer(e,this._offset)}loadUint(e){return this._toSafeInteger(this.loadUintBig(e),`loadUintBig`)}loadUintBig(e){let t=this.preloadUintBig(e);return this._offset+=e,t}preloadUint(e){return this._toSafeInteger(this._preloadUint(e,this._offset),`preloadUintBig`)}preloadUintBig(e){return this._preloadUint(e,this._offset)}loadInt(e){let t=this._preloadInt(e,this._offset);return this._offset+=e,this._toSafeInteger(t,`loadUintBig`)}loadIntBig(e){let t=this._preloadInt(e,this._offset);return this._offset+=e,t}preloadInt(e){return this._toSafeInteger(this._preloadInt(e,this._offset),`preloadIntBig`)}preloadIntBig(e){return this._preloadInt(e,this._offset)}loadVarUint(e){let t=Number(this.loadUint(e));return this._toSafeInteger(this.loadUintBig(t*8),`loadVarUintBig`)}loadVarUintBig(e){let t=Number(this.loadUint(e));return this.loadUintBig(t*8)}preloadVarUint(e){let t=Number(this._preloadUint(e,this._offset));return this._toSafeInteger(this._preloadUint(t*8,this._offset+e),`preloadVarUintBig`)}preloadVarUintBig(e){let t=Number(this._preloadUint(e,this._offset));return this._preloadUint(t*8,this._offset+e)}loadVarInt(e){let t=Number(this.loadUint(e));return this._toSafeInteger(this.loadIntBig(t*8),`loadVarIntBig`)}loadVarIntBig(e){let t=Number(this.loadUint(e));return this.loadIntBig(t*8)}preloadVarInt(e){let t=Number(this._preloadUint(e,this._offset));return this._toSafeInteger(this._preloadInt(t*8,this._offset+e),`preloadVarIntBig`)}preloadVarIntBig(e){let t=Number(this._preloadUint(e,this._offset));return this._preloadInt(t*8,this._offset+e)}loadCoins(){return this.loadVarUintBig(4)}preloadCoins(){return this.preloadVarUintBig(4)}loadAddress(){let e=Number(this._preloadUint(2,this._offset));if(e===2)return this._loadInternalAddress();throw Error(`Invalid address: `+e)}loadMaybeAddress(){let e=Number(this._preloadUint(2,this._offset));if(e===0)return this._offset+=2,null;if(e===2)return this._loadInternalAddress();throw Error(`Invalid address`)}loadExternalAddress(){if(Number(this._preloadUint(2,this._offset))===1)return this._loadExternalAddress();throw Error(`Invalid address`)}loadMaybeExternalAddress(){let e=Number(this._preloadUint(2,this._offset));if(e===0)return this._offset+=2,null;if(e===1)return this._loadExternalAddress();throw Error(`Invalid address`)}loadAddressAny(){let e=Number(this._preloadUint(2,this._offset));if(e===0)return this._offset+=2,null;if(e===2)return this._loadInternalAddress();if(e===1)return this._loadExternalAddress();throw Error(e===3?`Unsupported`:`Unreachable`)}loadPaddedBits(e){if(e%8!=0)throw Error(`Invalid number of bits`);let t=e;for(;;)if(this._bits.at(this._offset+t-1)){t--;break}else t--;let n=this._bits.substring(this._offset,t);return this._offset+=e,n}clone(){return new e(this._bits,this._offset)}_preloadInt(e,t){if(e==0)return 0n;let n=this._bits.at(t),r=0n;for(let n=0;n<e-1;n++)this._bits.at(t+1+n)&&(r+=1n<<BigInt(e-n-1-1));return n&&(r-=1n<<BigInt(e-1)),r}_preloadUint(e,t){if(e==0)return 0n;let n=0n;for(let r=0;r<e;r++)this._bits.at(t+r)&&(n+=1n<<BigInt(e-r-1));return n}_preloadBuffer(e,t){let n=this._bits.subbuffer(t,e*8);if(n)return n;let r=A.alloc(e);for(let n=0;n<e;n++)r[n]=Number(this._preloadUint(8,t+n*8));return r}_loadInternalAddress(){if(Number(this._preloadUint(2,this._offset))!==2)throw Error(`Invalid address`);let e,n;this._preloadUint(1,this._offset+2)!==0n&&(n=Number(this._preloadUint(5,this._offset+3)),e=this._preloadUint(n,this._offset+8),this._offset+=5+n);let r=Number(this._preloadInt(8,this._offset+3)),i=this._preloadBuffer(32,this._offset+11);if(n!==void 0&&e!==void 0){let t=Number(e),r=0,a=0,o=n;for(;o>0;){let e=Math.min(8-a,o),n=(1<<e)-1<<8-a-e,s=(t>>o-e&(1<<e)-1)<<8-a-e;i[r]=i[r]&~n|s,o-=e,a+=e,a===8&&(r++,a=0)}}return this._offset+=267,new t.Address(r,i)}_loadExternalAddress(){if(Number(this._preloadUint(2,this._offset))!==1)throw Error(`Invalid address`);let e=Number(this._preloadUint(9,this._offset+2)),t=this._preloadUint(e,this._offset+11);return this._offset+=11+e,new n.ExternalAddress(t,e)}_toSafeInteger(e,t){if(BigInt(2**53-1)<e||e<BigInt(-(2**53-1)))throw TypeError(`${e} is out of safe integer range. Use ${t} instead`);return Number(e)}}})),Ac=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.convertToMerkleProof=e.exoticMerkleProof=void 0;var t=kc(),n=$();function r(e,n){let r=new t.BitReader(e);if(e.length!==280)throw Error(`Merkle Proof cell must have exactly (8 + 256 + 16) bits, got "${e.length}"`);if(n.length!==1)throw Error(`Merkle Proof cell must have exactly 1 ref, got "${n.length}"`);let i=r.loadUint(8);if(i!==3)throw Error(`Merkle Proof cell must have type 3, got "${i}"`);let a=r.loadBuffer(32),o=r.loadUint(16),s=n[0].hash(0),c=n[0].depth(0);if(o!==c)throw Error(`Merkle Proof cell ref depth must be exactly "${o}", got "${c}"`);if(!a.equals(s))throw Error(`Merkle Proof cell ref hash must be exactly "${a.toString(`hex`)}", got "${s.toString(`hex`)}"`);return{proofDepth:o,proofHash:a}}e.exoticMerkleProof=r;function i(e){return(0,n.beginCell)().storeUint(3,8).storeBuffer(e.hash(0)).storeUint(e.depth(0),16).storeRef(e).endCell({exotic:!0})}e.convertToMerkleProof=i})),jc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.generateMerkleProof=e.generateMerkleProofDirect=void 0;var t=$(),n=Oc(),r=Ac();function i(e){return(0,t.beginCell)().storeUint(1,8).storeUint(1,8).storeBuffer(e.hash(0)).storeUint(e.depth(0),16).endCell({exotic:!0})}function a(e,r,o,s){let c=r.asCell();if(s.length==0)return i(c);let l=+!!r.loadBit(),u=0,d=e;if(l===0){u=(0,n.readUnaryLength)(r);for(let e=0;e<u;e++)d+=r.loadBit()?`1`:`0`}else if(+!!r.loadBit()==0){u=r.loadUint(Math.ceil(Math.log2(o+1)));for(let e=0;e<u;e++)d+=r.loadBit()?`1`:`0`}else{let e=r.loadBit()?`1`:`0`;u=r.loadUint(Math.ceil(Math.log2(o+1)));for(let t=0;t<u;t++)d+=e}if(o-u===0)return c;{let e=c.beginParse(),n=e.loadRef(),r=e.loadRef();if(!n.isExotic){let e=s.filter(e=>d+`0`===e.slice(0,d.length+1));n=a(d+`0`,n.beginParse(),o-u-1,e)}if(!r.isExotic){let e=s.filter(e=>d+`1`===e.slice(0,d.length+1));r=a(d+`1`,r.beginParse(),o-u-1,e)}return(0,t.beginCell)().storeSlice(e).storeRef(n).storeRef(r).endCell()}}function o(e,n,r){return n.forEach(t=>{if(!e.has(t))throw Error(`Trying to generate merkle proof for a missing key "${t}"`)}),a(``,(0,t.beginCell)().storeDictDirect(e).asSlice(),r.bits,n.map(e=>r.serialize(e).toString(2).padStart(r.bits,`0`)))}e.generateMerkleProofDirect=o;function s(e,t,n){return(0,r.convertToMerkleProof)(o(e,t,n))}e.generateMerkleProof=s})),Mc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.generateMerkleUpdate=void 0;var t=$(),n=jc();function r(e,n){return(0,t.beginCell)().storeUint(4,8).storeBuffer(e.hash(0)).storeBuffer(n.hash(0)).storeUint(e.depth(0),16).storeUint(n.depth(0),16).storeRef(e).storeRef(n).endCell({exotic:!0})}function i(e,t,i,a){let o=(0,n.generateMerkleProof)(e,[t],i).refs[0];e.set(t,a);let s=(0,n.generateMerkleProof)(e,[t],i).refs[0];return r(o,s)}e.generateMerkleUpdate=i})),Nc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseDict=void 0;function t(e){let t=0;for(;e.loadBit();)t++;return t}function n(e,r,i,a,o){let s=+!!r.loadBit(),c=0,l=e;if(s===0){c=t(r);for(let e=0;e<c;e++)l+=r.loadBit()?`1`:`0`}else if(+!!r.loadBit()==0){c=r.loadUint(Math.ceil(Math.log2(i+1)));for(let e=0;e<c;e++)l+=r.loadBit()?`1`:`0`}else{let e=r.loadBit()?`1`:`0`;c=r.loadUint(Math.ceil(Math.log2(i+1)));for(let t=0;t<c;t++)l+=e}if(i-c===0)a.set(BigInt(`0b`+l),o(r));else{let e=r.loadRef(),t=r.loadRef();e.isExotic||n(l+`0`,e.beginParse(),i-c-1,a,o),t.isExotic||n(l+`1`,t.beginParse(),i-c-1,a,o)}}function r(e,t,r){let i=new Map;return e&&n(``,e,t,i,r),i}e.parseDict=r})),Pc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.findCommonPrefix=void 0;function t(e,t=0){if(e.length===0)return``;let n=e[0].slice(t);for(let r=1;r<e.length;r++){let i=e[r];for(;i.indexOf(n,t)!==t;)if(n=n.substring(0,n.length-1),n===``)return n}return n}e.findCommonPrefix=t})),Fc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.serializeDict=e.detectLabelType=e.writeLabelSame=e.writeLabelLong=e.writeLabelShort=e.buildTree=void 0;var t=$(),n=Pc();function r(e,t){for(;e.length<t;)e=`0`+e;return e}function i(e,t){if(e.size===0)throw Error(`Internal inconsistency`);let n=new Map,r=new Map;for(let[i,a]of e.entries())i[t]===`0`?n.set(i,a):r.set(i,a);if(n.size===0)throw Error(`Internal inconsistency. Left emtpy.`);if(r.size===0)throw Error(`Internal inconsistency. Right emtpy.`);return{left:n,right:r}}function a(e,t){if(e.size===0)throw Error(`Internal inconsistency`);if(e.size===1)return{type:`leaf`,value:Array.from(e.values())[0]};let{left:n,right:r}=i(e,t);return{type:`fork`,left:o(n,t+1),right:o(r,t+1)}}function o(e,t=0){if(e.size===0)throw Error(`Internal inconsistency`);let r=(0,n.findCommonPrefix)(Array.from(e.keys()),t);return{label:r,node:a(e,r.length+t)}}function s(e,t){let n=new Map;for(let i of Array.from(e.keys())){let a=r(i.toString(2),t);n.set(a,e.get(i))}return o(n)}e.buildTree=s;function c(e,t){t.storeBit(0);for(let n=0;n<e.length;n++)t.storeBit(1);return t.storeBit(0),e.length>0&&t.storeUint(BigInt(`0b`+e),e.length),t}e.writeLabelShort=c;function l(e){return 1+e.length+1+e.length}function u(e,t,n){n.storeBit(1),n.storeBit(0);let r=Math.ceil(Math.log2(t+1));return n.storeUint(e.length,r),e.length>0&&n.storeUint(BigInt(`0b`+e),e.length),n}e.writeLabelLong=u;function d(e,t){return 2+Math.ceil(Math.log2(t+1))+e.length}function f(e,t,n,r){r.storeBit(1),r.storeBit(1),r.storeBit(e);let i=Math.ceil(Math.log2(n+1));r.storeUint(t,i)}e.writeLabelSame=f;function p(e){return 3+Math.ceil(Math.log2(e+1))}function m(e){if(e.length===0||e.length===1)return!0;for(let t=1;t<e.length;t++)if(e[t]!==e[0])return!1;return!0}function h(e,t){let n=`short`,r=l(e),i=d(e,t);if(i<r&&(r=i,n=`long`),m(e)){let e=p(t);e<r&&(r=e,n=`same`)}return n}e.detectLabelType=h;function g(e,t,n){let r=h(e,t);r===`short`?c(e,n):r===`long`?u(e,t,n):r===`same`&&f(e[0]===`1`,e.length,t,n)}function _(e,n,r,i){if(e.type===`leaf`&&r(e.value,i),e.type===`fork`){let a=(0,t.beginCell)(),o=(0,t.beginCell)();v(e.left,n-1,r,a),v(e.right,n-1,r,o),i.storeRef(a),i.storeRef(o)}}function v(e,t,n,r){g(e.label,t,r),_(e.node,t-e.label.length,n,r)}function y(e,t,n,r){v(s(e,t),t,n,r)}e.serializeDict=y})),Ic=e((e=>{k(),Object.defineProperty(e,"__esModule",{value:!0}),e.deserializeInternalKey=e.serializeInternalKey=void 0;var t=bc(),n=Tc(),r=wc();function i(e){if(typeof e==`number`){if(!Number.isSafeInteger(e))throw Error(`Invalid key type: not a safe integer: `+e);return`n:`+e.toString(10)}if(typeof e==`bigint`)return`b:`+e.toString(10);if(t.Address.isAddress(e))return`a:`+e.toString();if(A.isBuffer(e))return`f:`+e.toString(`hex`);if(n.BitString.isBitString(e))return`B:`+e.toString();throw Error(`Invalid key type`)}e.serializeInternalKey=i;function a(e){let i=e.slice(0,2),a=e.slice(2);if(i===`n:`)return parseInt(a,10);if(i===`b:`)return BigInt(a);if(i===`a:`)return t.Address.parse(a);if(i===`f:`)return A.from(a,`hex`);if(i===`B:`){let e=a.slice(-1)==`_`;if(e||a.length%2!=0){let t=e?a.length-1:a.length,i=a.substr(0,t)+`0`;return!e&&t&1?new n.BitString(A.from(i,`hex`),0,t<<2):(0,r.paddedBufferToBits)(A.from(i,`hex`))}return new n.BitString(A.from(a,`hex`),0,a.length<<2)}throw Error(`Invalid key type: `+i)}e.deserializeInternalKey=a})),Lc=e((e=>{k(),Object.defineProperty(e,"__esModule",{value:!0}),e.Dictionary=void 0;var t=bc(),n=$(),r=Zc(),i=Tc(),a=jc(),o=Mc(),s=Nc(),c=Fc(),l=Ic(),u=class e{static empty(t,n){return t&&n?new e(new Map,t,n):new e(new Map,null,null)}static load(t,n,i){let a;if(i instanceof r.Cell){if(i.isExotic)return e.empty(t,n);a=i.beginParse()}else a=i;let o=a.loadMaybeRef();return o&&!o.isExotic?e.loadDirect(t,n,o.beginParse()):e.empty(t,n)}static loadDirect(t,n,i){if(!i)return e.empty(t,n);let a;a=i instanceof r.Cell?i.beginParse():i;let o=(0,s.parseDict)(a,t.bits,n.parse),c=new Map;for(let[e,n]of o)c.set((0,l.serializeInternalKey)(t.parse(e)),n);return new e(c,t,n)}constructor(e,t,n){this._key=t,this._value=n,this._map=e}get size(){return this._map.size}get(e){return this._map.get((0,l.serializeInternalKey)(e))}has(e){return this._map.has((0,l.serializeInternalKey)(e))}set(e,t){return this._map.set((0,l.serializeInternalKey)(e),t),this}delete(e){let t=(0,l.serializeInternalKey)(e);return this._map.delete(t)}clear(){this._map.clear()}*[Symbol.iterator](){for(let[e,t]of this._map)yield[(0,l.deserializeInternalKey)(e),t]}keys(){return Array.from(this._map.keys()).map(e=>(0,l.deserializeInternalKey)(e))}values(){return Array.from(this._map.values())}store(e,t,r){if(this._map.size===0)e.storeBit(0);else{let i=this._key;t!=null&&(i=t);let a=this._value;if(r!=null&&(a=r),!i)throw Error(`Key serializer is not defined`);if(!a)throw Error(`Value serializer is not defined`);let o=new Map;for(let[e,t]of this._map)o.set(i.serialize((0,l.deserializeInternalKey)(e)),t);e.storeBit(1);let s=(0,n.beginCell)();(0,c.serializeDict)(o,i.bits,a.serialize,s),e.storeRef(s.endCell())}}storeDirect(e,t,n){if(this._map.size===0)throw Error(`Cannot store empty dictionary directly`);let r=this._key;t!=null&&(r=t);let i=this._value;if(n!=null&&(i=n),!r)throw Error(`Key serializer is not defined`);if(!i)throw Error(`Value serializer is not defined`);let a=new Map;for(let[e,t]of this._map)a.set(r.serialize((0,l.deserializeInternalKey)(e)),t);(0,c.serializeDict)(a,r.bits,i.serialize,e)}generateMerkleProof(e){return(0,a.generateMerkleProof)(this,e,this._key)}generateMerkleProofDirect(e){return(0,a.generateMerkleProofDirect)(this,e,this._key)}generateMerkleUpdate(e,t){return(0,o.generateMerkleUpdate)(this,e,this._key,t)}};e.Dictionary=u,u.Keys={Address:()=>d(),BigInt:e=>f(e),Int:e=>p(e),BigUint:e=>m(e),Uint:e=>h(e),Buffer:e=>g(e),BitString:e=>_(e)},u.Values={BigInt:e=>y(e),Int:e=>v(e),BigVarInt:e=>b(e),BigUint:e=>C(e),Uint:e=>S(e),BigVarUint:e=>x(e),Bool:()=>w(),Address:()=>T(),Cell:()=>ee(),Buffer:e=>D(e),BitString:e=>O(e),Dictionary:(e,t)=>E(e,t)};function d(){return{bits:267,serialize:e=>{if(!t.Address.isAddress(e))throw Error(`Key is not an address`);return(0,n.beginCell)().storeAddress(e).endCell().beginParse().preloadUintBig(267)},parse:e=>(0,n.beginCell)().storeUint(e,267).endCell().beginParse().loadAddress()}}function f(e){return{bits:e,serialize:t=>{if(typeof t!=`bigint`)throw Error(`Key is not a bigint`);return(0,n.beginCell)().storeInt(t,e).endCell().beginParse().loadUintBig(e)},parse:t=>(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadIntBig(e)}}function p(e){return{bits:e,serialize:t=>{if(typeof t!=`number`)throw Error(`Key is not a number`);if(!Number.isSafeInteger(t))throw Error(`Key is not a safe integer: `+t);return(0,n.beginCell)().storeInt(t,e).endCell().beginParse().loadUintBig(e)},parse:t=>(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadInt(e)}}function m(e){return{bits:e,serialize:t=>{if(typeof t!=`bigint`)throw Error(`Key is not a bigint`);if(t<0)throw Error(`Key is negative: `+t);return(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadUintBig(e)},parse:t=>(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadUintBig(e)}}function h(e){return{bits:e,serialize:t=>{if(typeof t!=`number`)throw Error(`Key is not a number`);if(!Number.isSafeInteger(t))throw Error(`Key is not a safe integer: `+t);if(t<0)throw Error(`Key is negative: `+t);return(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadUintBig(e)},parse:t=>Number((0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadUint(e))}}function g(e){return{bits:e*8,serialize:t=>{if(!A.isBuffer(t))throw Error(`Key is not a buffer`);return(0,n.beginCell)().storeBuffer(t).endCell().beginParse().loadUintBig(e*8)},parse:t=>(0,n.beginCell)().storeUint(t,e*8).endCell().beginParse().loadBuffer(e)}}function _(e){return{bits:e,serialize:t=>{if(!i.BitString.isBitString(t))throw Error(`Key is not a BitString`);return(0,n.beginCell)().storeBits(t).endCell().beginParse().loadUintBig(e)},parse:t=>(0,n.beginCell)().storeUint(t,e).endCell().beginParse().loadBits(e)}}function v(e){return{serialize:(t,n)=>{n.storeInt(t,e)},parse:t=>{let n=t.loadInt(e);return t.endParse(),n}}}function y(e){return{serialize:(t,n)=>{n.storeInt(t,e)},parse:t=>{let n=t.loadIntBig(e);return t.endParse(),n}}}function b(e){return{serialize:(t,n)=>{n.storeVarInt(t,e)},parse:t=>{let n=t.loadVarIntBig(e);return t.endParse(),n}}}function x(e){return{serialize:(t,n)=>{n.storeVarUint(t,e)},parse:t=>{let n=t.loadVarUintBig(e);return t.endParse(),n}}}function S(e){return{serialize:(t,n)=>{n.storeUint(t,e)},parse:t=>{let n=t.loadUint(e);return t.endParse(),n}}}function C(e){return{serialize:(t,n)=>{n.storeUint(t,e)},parse:t=>{let n=t.loadUintBig(e);return t.endParse(),n}}}function w(){return{serialize:(e,t)=>{t.storeBit(e)},parse:e=>{let t=e.loadBit();return e.endParse(),t}}}function T(){return{serialize:(e,t)=>{t.storeAddress(e)},parse:e=>{let t=e.loadAddress();return e.endParse(),t}}}function ee(){return{serialize:(e,t)=>{t.storeRef(e)},parse:e=>{let t=e.loadRef();return e.endParse(),t}}}function E(e,t){return{serialize:(e,t)=>{e.store(t)},parse:n=>{let r=u.load(e,t,n);return n.endParse(),r}}}function D(e){return{serialize:(t,n)=>{if(t.length!==e)throw Error(`Invalid buffer size`);n.storeBuffer(t)},parse:t=>{let n=t.loadBuffer(e);return t.endParse(),n}}}function O(e){return{serialize:(t,n)=>{if(t.length!==e)throw Error(`Invalid BitString size`);n.storeBits(t)},parse:t=>{let n=t.loadBits(e);return t.endParse(),n}}}})),Rc=e((e=>{k(),Object.defineProperty(e,"__esModule",{value:!0}),e.writeString=e.stringToCell=e.readString=void 0;var t=$();function n(e){if(e.remainingBits%8!=0)throw Error(`Invalid string length: ${e.remainingBits}`);if(e.remainingRefs!==0&&e.remainingRefs!==1)throw Error(`invalid number of refs: ${e.remainingRefs}`);let t;return t=e.remainingBits===0?A.alloc(0):e.loadBuffer(e.remainingBits/8),e.remainingRefs===1&&(t=A.concat([t,n(e.loadRef().beginParse())])),t}function r(e){return n(e).toString()}e.readString=r;function i(e,n){if(e.length>0){let r=Math.floor(n.availableBits/8);if(e.length>r){let a=e.subarray(0,r),o=e.subarray(r);n=n.storeBuffer(a);let s=(0,t.beginCell)();i(o,s),n=n.storeRef(s.endCell())}else n=n.storeBuffer(e)}}function a(e){let n=(0,t.beginCell)();return i(A.from(e),n),n.endCell()}e.stringToCell=a;function o(e,t){i(A.from(e),t)}e.writeString=o})),zc=e((e=>{var t;Object.defineProperty(e,"__esModule",{value:!0}),e.Slice=void 0;var n=vc(),r=Lc(),i=$(),a=Rc();e.Slice=class e{constructor(e,n){this[t]=()=>this.toString(),this._reader=e.clone(),this._refs=[...n],this._refsOffset=0}get remainingBits(){return this._reader.remaining}get offsetBits(){return this._reader.offset}get remainingRefs(){return this._refs.length-this._refsOffset}get offsetRefs(){return this._refsOffset}skip(e){return this._reader.skip(e),this}loadBit(){return this._reader.loadBit()}preloadBit(){return this._reader.preloadBit()}loadBoolean(){return this.loadBit()}loadMaybeBoolean(){return this.loadBit()?this.loadBoolean():null}loadBits(e){return this._reader.loadBits(e)}preloadBits(e){return this._reader.preloadBits(e)}loadUint(e){return this._reader.loadUint(e)}loadUintBig(e){return this._reader.loadUintBig(e)}preloadUint(e){return this._reader.preloadUint(e)}preloadUintBig(e){return this._reader.preloadUintBig(e)}loadMaybeUint(e){return this.loadBit()?this.loadUint(e):null}loadMaybeUintBig(e){return this.loadBit()?this.loadUintBig(e):null}loadInt(e){return this._reader.loadInt(e)}loadIntBig(e){return this._reader.loadIntBig(e)}preloadInt(e){return this._reader.preloadInt(e)}preloadIntBig(e){return this._reader.preloadIntBig(e)}loadMaybeInt(e){return this.loadBit()?this.loadInt(e):null}loadMaybeIntBig(e){return this.loadBit()?this.loadIntBig(e):null}loadVarUint(e){return this._reader.loadVarUint(e)}loadVarUintBig(e){return this._reader.loadVarUintBig(e)}preloadVarUint(e){return this._reader.preloadVarUint(e)}preloadVarUintBig(e){return this._reader.preloadVarUintBig(e)}loadVarInt(e){return this._reader.loadVarInt(e)}loadVarIntBig(e){return this._reader.loadVarIntBig(e)}preloadVarInt(e){return this._reader.preloadVarInt(e)}preloadVarIntBig(e){return this._reader.preloadVarIntBig(e)}loadCoins(){return this._reader.loadCoins()}preloadCoins(){return this._reader.preloadCoins()}loadMaybeCoins(){return this._reader.loadBit()?this._reader.loadCoins():null}loadAddress(){return this._reader.loadAddress()}loadMaybeAddress(){return this._reader.loadMaybeAddress()}loadExternalAddress(){return this._reader.loadExternalAddress()}loadMaybeExternalAddress(){return this._reader.loadMaybeExternalAddress()}loadAddressAny(){return this._reader.loadAddressAny()}loadRef(){if(this._refsOffset>=this._refs.length)throw Error(`No more references`);return this._refs[this._refsOffset++]}preloadRef(){if(this._refsOffset>=this._refs.length)throw Error(`No more references`);return this._refs[this._refsOffset]}loadMaybeRef(){return this.loadBit()?this.loadRef():null}preloadMaybeRef(){return this.preloadBit()?this.preloadRef():null}loadBuffer(e){return this._reader.loadBuffer(e)}preloadBuffer(e){return this._reader.preloadBuffer(e)}loadStringTail(){return(0,a.readString)(this)}loadMaybeStringTail(){return this.loadBit()?(0,a.readString)(this):null}loadStringRefTail(){return(0,a.readString)(this.loadRef().beginParse())}loadMaybeStringRefTail(){let e=this.loadMaybeRef();return e?(0,a.readString)(e.beginParse()):null}loadDict(e,t){return r.Dictionary.load(e,t,this)}loadDictDirect(e,t){return r.Dictionary.loadDirect(e,t,this)}endParse(){if(this.remainingBits>0||this.remainingRefs>0)throw Error(`Slice is not empty`)}asCell(){return(0,i.beginCell)().storeSlice(this).endCell()}asBuilder(){return(0,i.beginCell)().storeSlice(this)}clone(t=!1){if(t){let t=this._reader.clone();return t.reset(),new e(t,this._refs)}{let t=new e(this._reader,this._refs);return t._refsOffset=this._refsOffset,t}}toString(){return this.asCell().toString()}},t=n.inspectSymbol})),Bc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.exoticLibrary=void 0;var t=kc();function n(e,n){let r=new t.BitReader(e);if(e.length!==264)throw Error(`Library cell must have exactly (8 + 256) bits, got "${e.length}"`);let i=r.loadUint(8);if(i!==2)throw Error(`Library cell must have type 2, got "${i}"`);return{}}e.exoticLibrary=n})),Vc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.exoticMerkleUpdate=void 0;var t=kc();function n(e,n){let r=new t.BitReader(e);if(e.length!==552)throw Error(`Merkle Update cell must have exactly (8 + (2 * (256 + 16))) bits, got "${e.length}"`);if(n.length!==2)throw Error(`Merkle Update cell must have exactly 2 refs, got "${n.length}"`);let i=r.loadUint(8);if(i!==4)throw Error(`Merkle Update cell type must be exactly 4, got "${i}"`);let a=r.loadBuffer(32),o=r.loadBuffer(32),s=r.loadUint(16),c=r.loadUint(16);if(s!==n[0].depth(0))throw Error(`Merkle Update cell ref depth must be exactly "${s}", got "${n[0].depth(0)}"`);if(!a.equals(n[0].hash(0)))throw Error(`Merkle Update cell ref hash must be exactly "${a.toString(`hex`)}", got "${n[0].hash(0).toString(`hex`)}"`);if(c!==n[1].depth(0))throw Error(`Merkle Update cell ref depth must be exactly "${c}", got "${n[1].depth(0)}"`);if(!o.equals(n[1].hash(0)))throw Error(`Merkle Update cell ref hash must be exactly "${o.toString(`hex`)}", got "${n[1].hash(0).toString(`hex`)}"`);return{proofDepth1:s,proofDepth2:c,proofHash1:a,proofHash2:o}}e.exoticMerkleUpdate=n})),Hc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.LevelMask=void 0,e.LevelMask=class e{constructor(e=0){this._mask=0,this._mask=e,this._hashIndex=t(this._mask),this._hashCount=this._hashIndex+1}get value(){return this._mask}get level(){return 32-Math.clz32(this._mask)}get hashIndex(){return this._hashIndex}get hashCount(){return this._hashCount}apply(t){return new e(this._mask&(1<<t)-1)}isSignificant(e){return e===0||(this._mask>>e-1)%2!=0}};function t(e){return e-=e>>1&1431655765,e=(e&858993459)+(e>>2&858993459),(e+(e>>4)&252645135)*16843009>>24}})),Uc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.exoticPruned=void 0;var t=kc(),n=Hc();function r(e,r){let i=new t.BitReader(e),a=i.loadUint(8);if(a!==1)throw Error(`Pruned branch cell must have type 1, got "${a}"`);if(r.length!==0)throw Error(`Pruned Branch cell can't has refs, got "${r.length}"`);let o;if(e.length===280)o=new n.LevelMask(1);else{if(o=new n.LevelMask(i.loadUint(8)),o.level<1||o.level>3)throw Error(`Pruned Branch cell level must be >= 1 and <= 3, got "${o.level}/${o.value}"`);let t=16+o.apply(o.level-1).hashCount*272;if(e.length!==t)throw Error(`Pruned branch cell must have exactly ${t} bits, got "${e.length}"`)}let s=[],c=[],l=[];for(let e=0;e<o.level;e++)c.push(i.loadBuffer(32));for(let e=0;e<o.level;e++)l.push(i.loadUint(16));for(let e=0;e<o.level;e++)s.push({depth:l[e],hash:c[e]});return{mask:o.value,pruned:s}}e.exoticPruned=r})),Wc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.resolveExotic=void 0;var t=kc(),n=Dc(),r=Bc(),i=Ac(),a=Vc(),o=Uc(),s=Hc();function c(e,t){let r=(0,o.exoticPruned)(e,t),i=[],a=[],c=new s.LevelMask(r.mask);for(let e=0;e<r.pruned.length;e++)i.push(r.pruned[e].depth),a.push(r.pruned[e].hash);return{type:n.CellType.PrunedBranch,depths:i,hashes:a,mask:c}}function l(e,t){(0,r.exoticLibrary)(e,t);let i=[],a=[],o=new s.LevelMask;return{type:n.CellType.Library,depths:i,hashes:a,mask:o}}function u(e,t){(0,i.exoticMerkleProof)(e,t);let r=[],a=[],o=new s.LevelMask(t[0].level()>>1);return{type:n.CellType.MerkleProof,depths:r,hashes:a,mask:o}}function d(e,t){(0,a.exoticMerkleUpdate)(e,t);let r=[],i=[],o=new s.LevelMask((t[0].level()|t[1].level())>>1);return{type:n.CellType.MerkleUpdate,depths:r,hashes:i,mask:o}}function f(e,n){let r=new t.BitReader(e).preloadUint(8);if(r===1)return c(e,n);if(r===2)return l(e,n);if(r===3)return u(e,n);if(r===4)return d(e,n);throw Error(`Invalid exotic cell type: `+r)}e.resolveExotic=f})),Gc=e((e=>{k(),Object.defineProperty(e,"__esModule",{value:!0}),e.getRepr=e.getBitsDescriptor=e.getRefsDescriptor=void 0;var t=Dc(),n=wc();function r(e,n,r){return e.length+(r===t.CellType.Ordinary?0:1)*8+n*32}e.getRefsDescriptor=r;function i(e){let t=e.length;return Math.ceil(t/8)+Math.floor(t/8)}e.getBitsDescriptor=i;function a(e,a,o,s,c,l){let u=Math.ceil(a.length/8),d=A.alloc(2+u+34*o.length),f=0;d[f++]=r(o,c,l),d[f++]=i(e),(0,n.bitsToPaddedBuffer)(a).copy(d,f),f+=u;for(let e of o){let n;n=l==t.CellType.MerkleProof||l==t.CellType.MerkleUpdate?e.depth(s+1):e.depth(s),d[f++]=Math.floor(n/256),d[f++]=n%256}for(let e of o){let n;n=l==t.CellType.MerkleProof||l==t.CellType.MerkleUpdate?e.hash(s+1):e.hash(s),n.copy(d,f),f+=32}return d}e.getRepr=a})),Kc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.wonderCalculator=void 0;var t=Tc(),n=Dc(),r=Hc(),i=Uc(),a=Ac(),o=Gc(),s=ye(),c=Vc(),l=Bc();function u(e,u,d){let f,p=null;if(e===n.CellType.Ordinary){let e=0;for(let t of d)e|=t.mask.value;f=new r.LevelMask(e)}else if(e===n.CellType.PrunedBranch)p=(0,i.exoticPruned)(u,d),f=new r.LevelMask(p.mask);else if(e===n.CellType.MerkleProof)(0,a.exoticMerkleProof)(u,d),f=new r.LevelMask(d[0].mask.value>>1);else if(e===n.CellType.MerkleUpdate)(0,c.exoticMerkleUpdate)(u,d),f=new r.LevelMask((d[0].mask.value|d[1].mask.value)>>1);else if(e===n.CellType.Library)(0,l.exoticLibrary)(u,d),f=new r.LevelMask;else throw Error(`Unsupported exotic type`);let m=[],h=[],g=e===n.CellType.PrunedBranch?1:f.hashCount,_=f.hashCount-g;for(let r=0,i=0;r<=f.level;r++){if(!f.isSignificant(r))continue;if(i<_){i++;continue}let a;if(i===_){if(r!==0&&e!==n.CellType.PrunedBranch)throw Error(`Invalid`);a=u}else{if(r===0||e===n.CellType.PrunedBranch)throw Error(`Invalid: `+r+`, `+e);a=new t.BitString(h[i-_-1],0,256)}let c=0;for(let t of d){let i;i=e==n.CellType.MerkleProof||e==n.CellType.MerkleUpdate?t.depth(r+1):t.depth(r),c=Math.max(c,i)}d.length>0&&c++;let l=(0,o.getRepr)(u,a,d,r,f.apply(r).value,e),p=(0,s.sha256_sync)(l),g=i-_;m[g]=c,h[g]=p,i++}let v=[],y=[];if(p)for(let e=0;e<4;e++){let{hashIndex:t}=f.apply(e),{hashIndex:n}=f;t===n?(v.push(h[0]),y.push(m[0])):(v.push(p.pruned[t].hash),y.push(p.pruned[t].depth))}else for(let e=0;e<4;e++)v.push(h[f.apply(e).hashIndex]),y.push(m[f.apply(e).hashIndex]);return{mask:f,hashes:v,depths:y}}e.wonderCalculator=u})),qc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.topologicalSort=void 0;function t(e){let t=[e],n=new Map,r=new Set,i=[];for(;t.length>0;){let e=[...t];t=[];for(let i of e){let e=i.hash().toString(`hex`);if(!n.has(e)){r.add(e),n.set(e,{cell:i,refs:i.refs.map(e=>e.hash().toString(`hex`))});for(let e of i.refs)t.push(e)}}}let a=new Set;function o(e){if(!r.has(e))return;if(a.has(e))throw Error(`Not a DAG`);a.add(e);let t=n.get(e).refs;for(let e=t.length-1;e>=0;e--)o(t[e]);i.push(e),a.delete(e),r.delete(e)}for(;r.size>0;){let e=Array.from(r)[0];o(e)}let s=new Map;for(let e=0;e<i.length;e++)s.set(i[i.length-e-1],e);let c=[];for(let e=i.length-1;e>=0;e--){let t=i[e],r=n.get(t);c.push({cell:r.cell,refs:r.refs.map(e=>s.get(e))})}return c}e.topologicalSort=t})),Jc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.bitsForNumber=void 0;function t(e,t){let n=BigInt(e);if(t===`int`)return n===0n||n===-1n?1:(n>0?n:-n).toString(2).length+1;if(t===`uint`){if(n<0)throw Error(`value is negative. Got ${e}`);return n.toString(2).length}throw Error(`invalid mode. Got ${t}`)}e.bitsForNumber=t})),Yc=e((e=>{k(),Object.defineProperty(e,"__esModule",{value:!0}),e.crc32c=void 0;var t=2197175160;function n(e){let n=-1;for(let r=0;r<e.length;r++)n^=e[r],n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1,n=n&1?n>>>1^t:n>>>1;n^=4294967295;let r=A.alloc(4);return r.writeInt32LE(n),r}e.crc32c=n})),Xc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.serializeBoc=e.deserializeBoc=e.parseBoc=void 0;var t=kc(),n=Tc(),r=Zc(),i=qc(),a=Jc(),o=Ec(),s=Gc(),c=wc(),l=Yc();function u(e){return d(e&7)}function d(e){let t=0;for(let n=0;n<3;n++)t+=e&1,e>>=1;return t+1}function f(e,t){let r=e.loadUint(8),i=r%8,a=!!(r&8),o=e.loadUint(8),s=Math.ceil(o/2),c=!!(o%2),l=r>>5,d=!!(r&16),f=d?u(l)*32:0,p=d?u(l)*2:0;e.skip(f*8),e.skip(p*8);let m=n.BitString.EMPTY;s>0&&(m=c?e.loadPaddedBits(s*8):e.loadBits(s*8));let h=[];for(let n=0;n<i;n++)h.push(e.loadUint(t*8));return{bits:m,refs:h,exotic:a}}function p(e,t){return 2+Math.ceil(e.bits.length/8)+e.refs.length*t}function m(e){let r=new t.BitReader(new n.BitString(e,0,e.length*8)),i=r.loadUint(32);if(i===1761568243){let e=r.loadUint(8),t=r.loadUint(8),n=r.loadUint(e*8),i=r.loadUint(e*8),a=r.loadUint(e*8),o=r.loadUint(t*8);return{size:e,offBytes:t,cells:n,roots:i,absent:a,totalCellSize:o,index:r.loadBuffer(n*t),cellData:r.loadBuffer(o),root:[0]}}if(i===2898503464){let t=r.loadUint(8),n=r.loadUint(8),i=r.loadUint(t*8),a=r.loadUint(t*8),o=r.loadUint(t*8),s=r.loadUint(n*8),c=r.loadBuffer(i*n),u=r.loadBuffer(s),d=r.loadBuffer(4);if(!(0,l.crc32c)(e.subarray(0,e.length-4)).equals(d))throw Error(`Invalid CRC32C`);return{size:t,offBytes:n,cells:i,roots:a,absent:o,totalCellSize:s,index:c,cellData:u,root:[0]}}if(i===3052313714){let t=r.loadUint(1),n=r.loadUint(1);r.loadUint(1),r.loadUint(2);let i=r.loadUint(3),a=r.loadUint(8),o=r.loadUint(i*8),s=r.loadUint(i*8),c=r.loadUint(i*8),u=r.loadUint(a*8),d=[];for(let e=0;e<s;e++)d.push(r.loadUint(i*8));let f=null;t&&(f=r.loadBuffer(o*a));let p=r.loadBuffer(u);if(n){let t=r.loadBuffer(4);if(!(0,l.crc32c)(e.subarray(0,e.length-4)).equals(t))throw Error(`Invalid CRC32C`)}return{size:i,offBytes:a,cells:o,roots:s,absent:c,totalCellSize:u,index:f,cellData:p,root:d}}throw Error(`Invalid magic`)}e.parseBoc=m;function h(e){let i=m(e),a=new t.BitReader(new n.BitString(i.cellData,0,i.cellData.length*8)),o=[];for(let e=0;e<i.cells;e++){let e=f(a,i.size);o.push({...e,result:null})}for(let e=o.length-1;e>=0;e--){if(o[e].result)throw Error(`Impossible`);let t=[];for(let n of o[e].refs){if(!o[n].result)throw Error(`Invalid BOC file`);t.push(o[n].result)}o[e].result=new r.Cell({bits:o[e].bits,refs:t,exotic:o[e].exotic})}let s=[];for(let e=0;e<i.root.length;e++)s.push(o[i.root[e]].result);return s}e.deserializeBoc=h;function g(e,t,n,r){let i=(0,s.getRefsDescriptor)(e.refs,e.mask.value,e.type),a=(0,s.getBitsDescriptor)(e.bits);r.writeUint(i,8),r.writeUint(a,8),r.writeBuffer((0,c.bitsToPaddedBuffer)(e.bits));for(let e of t)r.writeUint(e,n*8)}function _(e,t){let n=(0,i.topologicalSort)(e),r=n.length,s=t.idx,c=t.crc32,u=Math.max(Math.ceil((0,a.bitsForNumber)(r,`uint`)/8),1),d=0,f=[];for(let e of n){let t=p(e.cell,u);d+=t,f.push(d)}let m=Math.max(Math.ceil((0,a.bitsForNumber)(d,`uint`)/8),1),h=(6+3*u+m+1*u+(s?r*m:0)+d+(c?4:0))*8,_=new o.BitBuilder(h);if(_.writeUint(3052313714,32),_.writeBit(s),_.writeBit(c),_.writeBit(!1),_.writeUint(0,2),_.writeUint(u,3),_.writeUint(m,8),_.writeUint(r,u*8),_.writeUint(1,u*8),_.writeUint(0,u*8),_.writeUint(d,m*8),_.writeUint(0,u*8),s)for(let e=0;e<r;e++)_.writeUint(f[e],m*8);for(let e=0;e<r;e++)g(n[e].cell,n[e].refs,u,_);if(c){let e=(0,l.crc32c)(_.buffer());_.writeBuffer(e)}let v=_.buffer();if(v.length!==h/8)throw Error(`Internal error`);return v}e.serializeBoc=_})),Zc=e((e=>{k();var t;Object.defineProperty(e,"__esModule",{value:!0}),e.Cell=void 0;var n=vc(),r=Tc(),i=Dc(),a=zc(),o=Wc(),s=Kc(),c=Xc(),l=kc(),u=$(),d=class e{static fromBoc(e){return(0,c.deserializeBoc)(e)}static fromBase64(t){let n=e.fromBoc(A.from(t,`base64`));if(n.length!==1)throw Error(`Deserialized more than one cell`);return n[0]}static fromHex(t){let n=e.fromBoc(A.from(t,`hex`));if(n.length!==1)throw Error(`Deserialized more than one cell`);return n[0]}constructor(e){this._hashes=[],this._depths=[],this.beginParse=(e=!1)=>{if(this.isExotic&&!e)throw Error(`Exotic cells cannot be parsed`);return new a.Slice(new l.BitReader(this.bits),this.refs)},this.hash=(e=3)=>this._hashes[Math.min(this._hashes.length-1,e)],this.depth=(e=3)=>this._depths[Math.min(this._depths.length-1,e)],this.level=()=>this.mask.level,this.equals=e=>this.hash().equals(e.hash()),this[t]=()=>this.toString();let n=r.BitString.EMPTY;e&&e.bits&&(n=e.bits);let c=[];e&&e.refs&&(c=[...e.refs]);let u,d,f,p=i.CellType.Ordinary;if(e&&e.exotic){let e=(0,o.resolveExotic)(n,c),t=(0,s.wonderCalculator)(e.type,n,c);f=t.mask,d=t.depths,u=t.hashes,p=e.type}else{if(c.length>4)throw Error(`Invalid number of references`);if(n.length>1023)throw Error(`Bits overflow: ${n.length} > 1023`);let e=(0,s.wonderCalculator)(i.CellType.Ordinary,n,c);f=e.mask,d=e.depths,u=e.hashes,p=i.CellType.Ordinary}this.type=p,this.bits=n,this.refs=c,this.mask=f,this._depths=d,this._hashes=u,Object.freeze(this),Object.freeze(this.refs),Object.freeze(this.bits),Object.freeze(this.mask),Object.freeze(this._depths),Object.freeze(this._hashes)}get isExotic(){return this.type!==i.CellType.Ordinary}toBoc(e){let t=e&&e.idx!==null&&e.idx!==void 0?e.idx:!1,n=e&&e.crc32!==null&&e.crc32!==void 0?e.crc32:!0;return(0,c.serializeBoc)(this,{idx:t,crc32:n})}toString(e){let t=e||``,n=`x`;this.isExotic&&(this.type===i.CellType.MerkleProof?n=`p`:this.type===i.CellType.MerkleUpdate?n=`u`:this.type===i.CellType.PrunedBranch&&(n=`p`));let r=t+(this.isExotic?n:`x`)+`{`+this.bits.toString()+`}`;for(let e in this.refs){let n=this.refs[e];r+=`
65
- `+n.toString(t+` `)}return r}asSlice(){return this.beginParse()}asBuilder(){return(0,u.beginCell)().storeSlice(this.asSlice())}};e.Cell=d,t=n.inspectSymbol,d.EMPTY=new d})),$=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Builder=e.beginCell=void 0;var t=Ec(),n=Zc(),r=Rc();function i(){return new a}e.beginCell=i;var a=class e{constructor(){this._bits=new t.BitBuilder,this._refs=[]}get bits(){return this._bits.length}get refs(){return this._refs.length}get availableBits(){return 1023-this.bits}get availableRefs(){return 4-this.refs}storeBit(e){return this._bits.writeBit(e),this}storeBits(e){return this._bits.writeBits(e),this}storeBuffer(e,t){if(t!=null&&e.length!==t)throw Error(`Buffer length ${e.length} is not equal to ${t}`);return this._bits.writeBuffer(e),this}storeMaybeBuffer(e,t){return e===null?this.storeBit(0):(this.storeBit(1),this.storeBuffer(e,t)),this}storeUint(e,t){return this._bits.writeUint(e,t),this}storeMaybeUint(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeUint(e,t)),this}storeInt(e,t){return this._bits.writeInt(e,t),this}storeMaybeInt(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeInt(e,t)),this}storeVarUint(e,t){return this._bits.writeVarUint(e,t),this}storeMaybeVarUint(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeVarUint(e,t)),this}storeVarInt(e,t){return this._bits.writeVarInt(e,t),this}storeMaybeVarInt(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeVarInt(e,t)),this}storeCoins(e){return this._bits.writeCoins(e),this}storeMaybeCoins(e){return e==null?this.storeBit(0):(this.storeBit(1),this.storeCoins(e)),this}storeAddress(e){return this._bits.writeAddress(e),this}storeRef(t){if(this._refs.length>=4)throw Error(`Too many references`);if(t instanceof n.Cell)this._refs.push(t);else if(t instanceof e)this._refs.push(t.endCell());else throw Error(`Invalid argument`);return this}storeMaybeRef(e){return e?(this.storeBit(1),this.storeRef(e)):this.storeBit(0),this}storeSlice(e){let t=e.clone();for(t.remainingBits>0&&this.storeBits(t.loadBits(t.remainingBits));t.remainingRefs>0;)this.storeRef(t.loadRef());return this}storeMaybeSlice(e){return e?(this.storeBit(1),this.storeSlice(e)):this.storeBit(0),this}storeBuilder(e){return this.storeSlice(e.endCell().beginParse())}storeMaybeBuilder(e){return e?(this.storeBit(1),this.storeBuilder(e)):this.storeBit(0),this}storeWritable(e){return typeof e==`object`?e.writeTo(this):e(this),this}storeMaybeWritable(e){return e?(this.storeBit(1),this.storeWritable(e)):this.storeBit(0),this}store(e){return this.storeWritable(e),this}storeStringTail(e){return(0,r.writeString)(e,this),this}storeMaybeStringTail(e){return e==null?this.storeBit(0):(this.storeBit(1),(0,r.writeString)(e,this)),this}storeStringRefTail(e){return this.storeRef(i().storeStringTail(e)),this}storeMaybeStringRefTail(e){return e==null?this.storeBit(0):(this.storeBit(1),this.storeStringRefTail(e)),this}storeDict(e,t,n){return e?e.store(this,t,n):this.storeBit(0),this}storeDictDirect(e,t,n){return e.storeDirect(this,t,n),this}endCell(e){return new n.Cell({bits:this._bits.build(),refs:this._refs,exotic:e?.exotic})}asCell(){return this.endCell()}asSlice(){return this.endCell().beginParse()}};e.Builder=a})),Qc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SimpleLibraryValue=e.storeSimpleLibrary=e.loadSimpleLibrary=void 0;function t(e){return{public:e.loadBit(),root:e.loadRef()}}e.loadSimpleLibrary=t;function n(e){return t=>{t.storeBit(e.public),t.storeRef(e.root)}}e.storeSimpleLibrary=n,e.SimpleLibraryValue={serialize(e,t){n(e)(t)},parse(e){return t(e)}}})),$c=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTickTock=e.loadTickTock=void 0;function t(e){return{tick:e.loadBit(),tock:e.loadBit()}}e.loadTickTock=t;function n(e){return t=>{t.storeBit(e.tick),t.storeBit(e.tock)}}e.storeTickTock=n})),el=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeStateInit=e.loadStateInit=void 0;var t=Lc(),n=Qc(),r=$c();function i(e){let i;e.loadBit()&&(i=e.loadUint(5));let a;e.loadBit()&&(a=(0,r.loadTickTock)(e));let o=e.loadMaybeRef(),s=e.loadMaybeRef(),c=e.loadDict(t.Dictionary.Keys.BigUint(256),n.SimpleLibraryValue);return c.size===0&&(c=void 0),{splitDepth:i,special:a,code:o,data:s,libraries:c}}e.loadStateInit=i;function a(e){return t=>{e.splitDepth!==null&&e.splitDepth!==void 0?(t.storeBit(!0),t.storeUint(e.splitDepth,5)):t.storeBit(!1),e.special!==null&&e.special!==void 0?(t.storeBit(!0),t.store((0,r.storeTickTock)(e.special))):t.storeBit(!1),t.storeMaybeRef(e.code),t.storeMaybeRef(e.data),t.storeDict(e.libraries)}}e.storeStateInit=a})),tl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contractAddress=void 0;var t=$(),n=el(),r=bc();function i(e,i){let a=(0,t.beginCell)().store((0,n.storeStateInit)(i)).endCell().hash();return new r.Address(e,a)}e.contractAddress=i})),nl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseTuple=e.serializeTuple=e.parseTupleItem=e.serializeTupleItem=void 0;var t=$(),n=BigInt(`-9223372036854775808`),r=BigInt(`9223372036854775807`);function i(e,a){if(e.type===`null`)a.storeUint(0,8);else if(e.type===`int`)e.value<=r&&e.value>=n?(a.storeUint(1,8),a.storeInt(e.value,64)):(a.storeUint(256,15),a.storeInt(e.value,257));else if(e.type===`nan`)a.storeInt(767,16);else if(e.type===`cell`)a.storeUint(3,8),a.storeRef(e.cell);else if(e.type===`slice`)a.storeUint(4,8),a.storeUint(0,10),a.storeUint(e.cell.bits.length,10),a.storeUint(0,3),a.storeUint(e.cell.refs.length,3),a.storeRef(e.cell);else if(e.type===`builder`)a.storeUint(5,8),a.storeRef(e.cell);else if(e.type===`tuple`){let n=null,r=null;for(let a=0;a<e.items.length;a++){let o=n;n=r,r=o,a>1&&(n=(0,t.beginCell)().storeRef(r).storeRef(n).endCell());let s=(0,t.beginCell)();i(e.items[a],s),r=s.endCell()}a.storeUint(7,8),a.storeUint(e.items.length,16),n&&a.storeRef(n),r&&a.storeRef(r)}else throw Error(`Invalid value`)}e.serializeTupleItem=i;function a(e){let n=e.loadUint(8);if(n===0)return{type:`null`};if(n===1)return{type:`int`,value:e.loadIntBig(64)};if(n===2)return e.loadUint(7)===0?{type:`int`,value:e.loadIntBig(257)}:(e.loadBit(),{type:`nan`});if(n===3)return{type:`cell`,cell:e.loadRef()};if(n===4){let n=e.loadUint(10),r=e.loadUint(10),i=e.loadUint(3),a=e.loadUint(3),o=e.loadRef().beginParse();o.skip(n);let s=o.loadBits(r-n),c=(0,t.beginCell)().storeBits(s);if(i<a){for(let e=0;e<i;e++)o.loadRef();for(let e=0;e<a-i;e++)c.storeRef(o.loadRef())}return{type:`slice`,cell:c.endCell()}}if(n===5)return{type:`builder`,cell:e.loadRef()};if(n===7){let t=e.loadUint(16),n=[];if(t>1){let r=e.loadRef().beginParse(),i=e.loadRef().beginParse();n.unshift(a(i));for(let e=0;e<t-2;e++){let e=r;r=e.loadRef().beginParse(),i=e.loadRef().beginParse(),n.unshift(a(i))}n.unshift(a(r))}else t===1&&n.push(a(e.loadRef().beginParse()));return{type:`tuple`,items:n}}throw Error(`Unsupported stack item`)}e.parseTupleItem=a;function o(e,n){if(e.length>0){let r=(0,t.beginCell)();o(e.slice(0,e.length-1),r),n.storeRef(r.endCell()),i(e[e.length-1],n)}}function s(e){let n=(0,t.beginCell)();return n.storeUint(e.length,24),o([...e],n),n.endCell()}e.serializeTuple=s;function c(e){let t=[],n=e.beginParse(),r=n.loadUint(24);for(let e=0;e<r;e++){let e=n.loadRef();t.unshift(a(n)),n=e.beginParse()}return t}e.parseTuple=c})),rl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TupleReader=void 0,e.TupleReader=class e{constructor(e){this.items=[...e]}get remaining(){return this.items.length}peek(){if(this.items.length===0)throw Error(`EOF`);return this.items[0]}pop(){if(this.items.length===0)throw Error(`EOF`);let e=this.items[0];return this.items.splice(0,1),e}skip(e=1){for(let t=0;t<e;t++)this.pop();return this}readBigNumber(){let e=this.pop();if(e.type!==`int`)throw Error(`Not a number`);return e.value}readBigNumberOpt(){let e=this.pop();if(e.type===`null`)return null;if(e.type!==`int`)throw Error(`Not a number`);return e.value}readNumber(){return Number(this.readBigNumber())}readNumberOpt(){let e=this.readBigNumberOpt();return e===null?null:Number(e)}readBoolean(){return this.readNumber()!==0}readBooleanOpt(){let e=this.readNumberOpt();return e===null?null:e!==0}readAddress(){let e=this.readCell().beginParse().loadAddress();if(e!==null)return e;throw Error(`Not an address`)}readAddressOpt(){let e=this.readCellOpt();return e===null?null:e.beginParse().loadMaybeAddress()}readCell(){let e=this.pop();if(e.type!==`cell`&&e.type!==`slice`&&e.type!==`builder`)throw Error(`Not a cell: `+e.type);return e.cell}readCellOpt(){let e=this.pop();if(e.type===`null`)return null;if(e.type!==`cell`&&e.type!==`slice`&&e.type!==`builder`)throw Error(`Not a cell`);return e.cell}readTuple(){let t=this.pop();if(t.type!==`tuple`)throw Error(`Not a tuple`);return new e(t.items)}readTupleOpt(){let t=this.pop();if(t.type===`null`)return null;if(t.type!==`tuple`)throw Error(`Not a tuple`);return new e(t.items)}static readLispList(e){let t=[],n=e;for(;n!==null;){var r=n.pop();if(n.items.length===0||n.items[0].type!==`tuple`&&n.items[0].type!==`null`)throw Error(`Lisp list consists only from (any, tuple) elements and ends with null`);n=n.readTupleOpt(),t.push(r)}return t}readLispListDirect(){return this.items.length===1&&this.items[0].type===`null`?[]:e.readLispList(this)}readLispList(){return e.readLispList(this.readTupleOpt())}readBuffer(){let e=this.readCell().beginParse();if(e.remainingRefs!==0||e.remainingBits%8!=0)throw Error(`Not a buffer`);return e.loadBuffer(e.remainingBits/8)}readBufferOpt(){let e=this.readCellOpt();if(e!==null){let t=e.beginParse();if(t.remainingRefs!==0||t.remainingBits%8!=0)throw Error(`Not a buffer`);return t.loadBuffer(t.remainingBits/8)}return null}readString(){return this.readCell().beginParse().loadStringTail()}readStringOpt(){let e=this.readCellOpt();return e===null?null:e.beginParse().loadStringTail()}}})),il=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TupleBuilder=void 0;var t=$(),n=Zc(),r=zc();e.TupleBuilder=class{constructor(){this._tuple=[]}writeNumber(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`int`,value:BigInt(e)})}writeBoolean(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`int`,value:e?-1n:0n})}writeBuffer(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`slice`,cell:(0,t.beginCell)().storeBuffer(e).endCell()})}writeString(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`slice`,cell:(0,t.beginCell)().storeStringTail(e).endCell()})}writeCell(e){e==null?this._tuple.push({type:`null`}):e instanceof n.Cell?this._tuple.push({type:`cell`,cell:e}):e instanceof r.Slice&&this._tuple.push({type:`cell`,cell:e.asCell()})}writeSlice(e){e==null?this._tuple.push({type:`null`}):e instanceof n.Cell?this._tuple.push({type:`slice`,cell:e}):e instanceof r.Slice&&this._tuple.push({type:`slice`,cell:e.asCell()})}writeBuilder(e){e==null?this._tuple.push({type:`null`}):e instanceof n.Cell?this._tuple.push({type:`builder`,cell:e}):e instanceof r.Slice&&this._tuple.push({type:`builder`,cell:e.asCell()})}writeTuple(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`tuple`,items:e})}writeAddress(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`slice`,cell:(0,t.beginCell)().storeAddress(e).endCell()})}build(){return[...this._tuple]}}})),al=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.fromNano=e.toNano=void 0;function t(e){if(typeof e==`bigint`)return e*1000000000n;{if(typeof e==`number`){if(!Number.isFinite(e))throw Error(`Invalid number`);if(Math.log10(e)<=6)e=e.toLocaleString(`en`,{minimumFractionDigits:9,useGrouping:!1});else if(e-Math.trunc(e)===0)e=e.toLocaleString(`en`,{maximumFractionDigits:0,useGrouping:!1});else throw Error(`Not enough precision for a number value. Use string value instead`)}let t=!1;for(;e.startsWith(`-`);)t=!t,e=e.slice(1);if(e===`.`)throw Error(`Invalid number`);let n=e.split(`.`);if(n.length>2)throw Error(`Invalid number`);let r=n[0],i=n[1];if(r||=`0`,i||=`0`,i.length>9)throw Error(`Invalid number`);for(;i.length<9;)i+=`0`;let a=BigInt(r)*1000000000n+BigInt(i);return t&&(a=-a),a}}e.toNano=t;function n(e){let t=BigInt(e),n=!1;t<0&&(n=!0,t=-t);let r=(t%1000000000n).toString();for(;r.length<9;)r=`0`+r;r=r.match(/^([0-9]*[1-9]|0)(0*)/)[1];let i=`${(t/1000000000n).toString()}${r===`0`?``:`.${r}`}`;return n&&(i=`-`+i),i}e.fromNano=n})),ol=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.packExtraCurrencyCell=e.packExtraCurrencyDict=e.storeExtraCurrency=e.loadMaybeExtraCurrency=e.loadExtraCurrency=void 0;var t=$(),n=Lc();function r(e){let t=e instanceof n.Dictionary?e:n.Dictionary.loadDirect(n.Dictionary.Keys.Uint(32),n.Dictionary.Values.BigVarUint(5),e),r={};for(let[e,n]of t)r[e]=n;return r}e.loadExtraCurrency=r;function i(e){let t=e.loadMaybeRef();return t===null?t:r(t)}e.loadMaybeExtraCurrency=i;function a(e){return t=>{t.storeDict(o(e))}}e.storeExtraCurrency=a;function o(e){let t=n.Dictionary.empty(n.Dictionary.Keys.Uint(32),n.Dictionary.Values.BigVarUint(5));return Object.entries(e).map(([e,n])=>t.set(Number(e),n)),t}e.packExtraCurrencyDict=o;function s(e){return(0,t.beginCell)().storeDictDirect(o(e)).endCell()}e.packExtraCurrencyCell=s})),sl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.comment=e.external=e.internal=void 0;var t=bc(),n=Zc(),r=$(),i=al(),a=ol();function o(e){let o=!0;e.bounce!==null&&e.bounce!==void 0&&(o=e.bounce);let s;if(typeof e.to==`string`)s=t.Address.parse(e.to);else if(t.Address.isAddress(e.to))s=e.to;else throw Error(`Invalid address ${e.to}`);let c;c=typeof e.value==`string`?(0,i.toNano)(e.value):e.value;let l;e.extracurrency&&(l=(0,a.packExtraCurrencyDict)(e.extracurrency));let u=n.Cell.EMPTY;return typeof e.body==`string`?u=(0,r.beginCell)().storeUint(0,32).storeStringTail(e.body).endCell():e.body&&(u=e.body),{info:{type:`internal`,dest:s,value:{coins:c,other:l},bounce:o,ihrDisabled:!0,bounced:!1,ihrFee:0n,forwardFee:0n,createdAt:0,createdLt:0n},init:e.init??void 0,body:u}}e.internal=o;function s(e){let r;if(typeof e.to==`string`)r=t.Address.parse(e.to);else if(t.Address.isAddress(e.to))r=e.to;else throw Error(`Invalid address ${e.to}`);return{info:{type:`external-in`,dest:r,importFee:0n},init:e.init??void 0,body:e.body||n.Cell.EMPTY}}e.external=s;function c(e){return(0,r.beginCell)().storeUint(0,32).storeStringTail(e).endCell()}e.comment=c})),cl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccountState=e.loadAccountState=void 0;var t=el();function n(e){return e.loadBit()?{type:`active`,state:(0,t.loadStateInit)(e)}:e.loadBit()?{type:`frozen`,stateHash:e.loadUintBig(256)}:{type:`uninit`}}e.loadAccountState=n;function r(e){return n=>{e.type===`active`?(n.storeBit(!0),n.store((0,t.storeStateInit)(e.state))):e.type===`frozen`?(n.storeBit(!1),n.storeBit(!0),n.storeUint(e.stateHash,256)):e.type===`uninit`&&(n.storeBit(!1),n.storeBit(!1))}}e.storeAccountState=r})),ll=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeCurrencyCollection=e.loadCurrencyCollection=void 0;var t=Lc();function n(e){let n=e.loadCoins(),r=e.loadDict(t.Dictionary.Keys.Uint(32),t.Dictionary.Values.BigVarUint(5));return r.size===0?{coins:n}:{other:r,coins:n}}e.loadCurrencyCollection=n;function r(e){return t=>{t.storeCoins(e.coins),e.other?t.storeDict(e.other):t.storeBit(0)}}e.storeCurrencyCollection=r})),ul=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccountStorage=e.loadAccountStorage=void 0;var t=cl(),n=ll();function r(e){return{lastTransLt:e.loadUintBig(64),balance:(0,n.loadCurrencyCollection)(e),state:(0,t.loadAccountState)(e)}}e.loadAccountStorage=r;function i(e){return r=>{r.storeUint(e.lastTransLt,64),r.store((0,n.storeCurrencyCollection)(e.balance)),r.store((0,t.storeAccountState)(e.state))}}e.storeAccountStorage=i})),dl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeStorageExtraInfo=e.loadStorageExtraInfo=void 0;function t(e){let t=e.loadUint(3);if(t===0)return null;if(t===1)return{dictHash:e.loadUintBig(256)};throw Error(`Invalid storage extra info header: ${t}`)}e.loadStorageExtraInfo=t;function n(e){return t=>{e==null?t.storeUint(0,3):(t.storeUint(1,3),t.storeUint(e.dictHash,256))}}e.storeStorageExtraInfo=n})),fl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeStorageUsed=e.loadStorageUsed=void 0;function t(e){return{cells:e.loadVarUintBig(3),bits:e.loadVarUintBig(3)}}e.loadStorageUsed=t;function n(e){return t=>{t.storeVarUint(e.cells,3),t.storeVarUint(e.bits,3)}}e.storeStorageUsed=n})),pl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeStorageInfo=e.loadStorageInfo=void 0;var t=dl(),n=fl();function r(e){return{used:(0,n.loadStorageUsed)(e),storageExtra:(0,t.loadStorageExtraInfo)(e),lastPaid:e.loadUint(32),duePayment:e.loadMaybeCoins()}}e.loadStorageInfo=r;function i(e){return r=>{r.store((0,n.storeStorageUsed)(e.used)),r.store((0,t.storeStorageExtraInfo)(e.storageExtra)),r.storeUint(e.lastPaid,32),r.storeMaybeCoins(e.duePayment)}}e.storeStorageInfo=i})),ml=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccount=e.loadAccount=void 0;var t=ul(),n=pl();function r(e){return{addr:e.loadAddress(),storageStats:(0,n.loadStorageInfo)(e),storage:(0,t.loadAccountStorage)(e)}}e.loadAccount=r;function i(e){return r=>{r.storeAddress(e.addr),r.store((0,n.storeStorageInfo)(e.storageStats)),r.store((0,t.storeAccountStorage)(e.storage))}}e.storeAccount=i})),hl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccountStatus=e.loadAccountStatus=void 0;function t(e){let t=e.loadUint(2);if(t===0)return`uninitialized`;if(t===1)return`frozen`;if(t===2)return`active`;if(t===3)return`non-existing`;throw Error(`Invalid data`)}e.loadAccountStatus=t;function n(e){return t=>{if(e===`uninitialized`)t.storeUint(0,2);else if(e===`frozen`)t.storeUint(1,2);else if(e===`active`)t.storeUint(2,2);else if(e===`non-existing`)t.storeUint(3,2);else throw Error(`Invalid data`);return t}}e.storeAccountStatus=n})),gl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccountStatusChange=e.loadAccountStatusChange=void 0;function t(e){return e.loadBit()?e.loadBit()?`deleted`:`frozen`:`unchanged`}e.loadAccountStatusChange=t;function n(e){return t=>{if(e==`unchanged`)t.storeBit(0);else if(e===`frozen`)t.storeBit(1),t.storeBit(0);else if(e===`deleted`)t.storeBit(1),t.storeBit(1);else throw Error(`Invalid account status change`)}}e.storeAccountStatusChange=n})),_l=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeCommonMessageInfoRelaxed=e.loadCommonMessageInfoRelaxed=void 0;var t=ll();function n(e){if(!e.loadBit())return{type:`internal`,ihrDisabled:e.loadBit(),bounce:e.loadBit(),bounced:e.loadBit(),src:e.loadMaybeAddress(),dest:e.loadAddress(),value:(0,t.loadCurrencyCollection)(e),ihrFee:e.loadCoins(),forwardFee:e.loadCoins(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)};if(!e.loadBit())throw Error(`External In message is not possible for CommonMessageInfoRelaxed`);return{type:`external-out`,src:e.loadMaybeAddress(),dest:e.loadMaybeExternalAddress(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)}}e.loadCommonMessageInfoRelaxed=n;function r(e){return n=>{if(e.type===`internal`)n.storeBit(0),n.storeBit(e.ihrDisabled),n.storeBit(e.bounce),n.storeBit(e.bounced),n.storeAddress(e.src),n.storeAddress(e.dest),n.store((0,t.storeCurrencyCollection)(e.value)),n.storeCoins(e.ihrFee),n.storeCoins(e.forwardFee),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else if(e.type===`external-out`)n.storeBit(1),n.storeBit(1),n.storeAddress(e.src),n.storeAddress(e.dest),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else throw Error(`Unknown CommonMessageInfo type`)}}e.storeCommonMessageInfoRelaxed=r})),vl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeMessageRelaxed=e.loadMessageRelaxed=void 0;var t=$(),n=_l(),r=el();function i(e){let t=(0,n.loadCommonMessageInfoRelaxed)(e),i=null;e.loadBit()&&(i=e.loadBit()?(0,r.loadStateInit)(e.loadRef().beginParse()):(0,r.loadStateInit)(e));let a=e.loadBit()?e.loadRef():e.asCell();return{info:t,init:i,body:a}}e.loadMessageRelaxed=i;function a(e,i){return a=>{if(a.store((0,n.storeCommonMessageInfoRelaxed)(e.info)),e.init){a.storeBit(!0);let n=(0,t.beginCell)().store((0,r.storeStateInit)(e.init)),o=!1;o=i&&i.forceRef?!0:!(a.availableBits-2>=n.bits),o?(a.storeBit(!0),a.storeRef(n)):(a.storeBit(!1),a.storeBuilder(n))}else a.storeBit(!1);let o=!1;o=i&&i.forceRef?!0:!(a.availableBits-1>=e.body.bits.length&&a.refs+e.body.refs.length<=4&&!e.body.isExotic),o?(a.storeBit(!0),a.storeRef(e.body)):(a.storeBit(!1),a.storeBuilder(e.body.asBuilder()))}}e.storeMessageRelaxed=a})),yl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeLibRef=e.loadLibRef=void 0;function t(e){return e.loadUint(1)===0?{type:`hash`,libHash:e.loadBuffer(32)}:{type:`ref`,library:e.loadRef()}}e.loadLibRef=t;function n(e){return t=>{e.type===`hash`?(t.storeUint(0,1),t.storeBuffer(e.libHash)):(t.storeUint(1,1),t.storeRef(e.library))}}e.storeLibRef=n})),bl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loadOutList=e.storeOutList=e.loadOutAction=e.storeOutAction=void 0;var t=vl(),n=$(),r=ll(),i=yl();function a(e){switch(e.type){case`sendMsg`:return s(e);case`setCode`:return l(e);case`reserve`:return d(e);case`changeLibrary`:return p(e);default:throw Error(`Unknown action type ${e.type}`)}}e.storeOutAction=a;var o=247711853;function s(e){return r=>{r.storeUint(o,32).storeUint(e.mode,8).storeRef((0,n.beginCell)().store((0,t.storeMessageRelaxed)(e.outMsg)).endCell())}}var c=2907562126;function l(e){return t=>{t.storeUint(c,32).storeRef(e.newCode)}}var u=921090057;function d(e){return t=>{t.storeUint(u,32).storeUint(e.mode,8).store((0,r.storeCurrencyCollection)(e.currency))}}var f=653925844;function p(e){return t=>{t.storeUint(f,32).storeUint(e.mode,7).store((0,i.storeLibRef)(e.libRef))}}function m(e){let n=e.loadUint(32);if(n===o)return{type:`sendMsg`,mode:e.loadUint(8),outMsg:(0,t.loadMessageRelaxed)(e.loadRef().beginParse())};if(n===c)return{type:`setCode`,newCode:e.loadRef()};if(n===u)return{type:`reserve`,mode:e.loadUint(8),currency:(0,r.loadCurrencyCollection)(e)};if(n===f)return{type:`changeLibrary`,mode:e.loadUint(7),libRef:(0,i.loadLibRef)(e)};throw Error(`Unknown out action tag 0x${n.toString(16)}`)}e.loadOutAction=m;function h(e){let t=e.reduce((e,t)=>(0,n.beginCell)().storeRef(e).store(a(t)).endCell(),(0,n.beginCell)().endCell());return e=>{e.storeSlice(t.beginParse())}}e.storeOutList=h;function g(e){let t=[];for(;e.remainingRefs;){let n=e.loadRef();t.push(m(e)),e=n.beginParse()}return t.reverse()}e.loadOutList=g})),xl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeCommonMessageInfo=e.loadCommonMessageInfo=void 0;var t=ll();function n(e){return e.loadBit()?e.loadBit()?{type:`external-out`,src:e.loadAddress(),dest:e.loadMaybeExternalAddress(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)}:{type:`external-in`,src:e.loadMaybeExternalAddress(),dest:e.loadAddress(),importFee:e.loadCoins()}:{type:`internal`,ihrDisabled:e.loadBit(),bounce:e.loadBit(),bounced:e.loadBit(),src:e.loadAddress(),dest:e.loadAddress(),value:(0,t.loadCurrencyCollection)(e),ihrFee:e.loadCoins(),forwardFee:e.loadCoins(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)}}e.loadCommonMessageInfo=n;function r(e){return n=>{if(e.type===`internal`)n.storeBit(0),n.storeBit(e.ihrDisabled),n.storeBit(e.bounce),n.storeBit(e.bounced),n.storeAddress(e.src),n.storeAddress(e.dest),n.store((0,t.storeCurrencyCollection)(e.value)),n.storeCoins(e.ihrFee),n.storeCoins(e.forwardFee),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else if(e.type===`external-in`)n.storeBit(1),n.storeBit(0),n.storeAddress(e.src),n.storeAddress(e.dest),n.storeCoins(e.importFee);else if(e.type===`external-out`)n.storeBit(1),n.storeBit(1),n.storeAddress(e.src),n.storeAddress(e.dest),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else throw Error(`Unknown CommonMessageInfo type`)}}e.storeCommonMessageInfo=r})),Sl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeComputeSkipReason=e.loadComputeSkipReason=void 0;function t(e){let t=e.loadUint(2);if(t===0)return`no-state`;if(t===1)return`bad-state`;if(t===2)return`no-gas`;throw Error(`Unknown ComputeSkipReason: ${t}`)}e.loadComputeSkipReason=t;function n(e){return t=>{if(e===`no-state`)t.storeUint(0,2);else if(e===`bad-state`)t.storeUint(1,2);else if(e===`no-gas`)t.storeUint(2,2);else throw Error(`Unknown ComputeSkipReason: ${e}`)}}e.storeComputeSkipReason=n})),Cl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeDepthBalanceInfo=e.loadDepthBalanceInfo=void 0;var t=ll();function n(e){return{splitDepth:e.loadUint(5),balance:(0,t.loadCurrencyCollection)(e)}}e.loadDepthBalanceInfo=n;function r(e){return n=>{n.storeUint(e.splitDepth,5),n.store((0,t.storeCurrencyCollection)(e.balance))}}e.storeDepthBalanceInfo=r})),wl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeHashUpdate=e.loadHashUpdate=void 0;function t(e){if(e.loadUint(8)!==114)throw Error(`Invalid data`);return{oldHash:e.loadBuffer(32),newHash:e.loadBuffer(32)}}e.loadHashUpdate=t;function n(e){return t=>{t.storeUint(114,8),t.storeBuffer(e.oldHash),t.storeBuffer(e.newHash)}}e.storeHashUpdate=n})),Tl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loadMasterchainStateExtra=void 0;var t=Lc(),n=ll();function r(e){if(e.loadUint(16)!==52262)throw Error(`Invalid data`);e.loadBit()&&e.loadRef();let r=e.loadUintBig(256);return{config:t.Dictionary.load(t.Dictionary.Keys.Int(32),t.Dictionary.Values.Cell(),e),configAddress:r,globalBalance:(0,n.loadCurrencyCollection)(e)}}e.loadMasterchainStateExtra=r})),El=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageValue=e.storeMessage=e.loadMessage=void 0;var t=$(),n=xl(),r=el();function i(e){let t=(0,n.loadCommonMessageInfo)(e),i=null;e.loadBit()&&(i=e.loadBit()?(0,r.loadStateInit)(e.loadRef().beginParse()):(0,r.loadStateInit)(e));let a=e.loadBit()?e.loadRef():e.asCell();return{info:t,init:i,body:a}}e.loadMessage=i;function a(e,i){return a=>{if(a.store((0,n.storeCommonMessageInfo)(e.info)),e.init){a.storeBit(!0);let n=(0,t.beginCell)().store((0,r.storeStateInit)(e.init)),o=!1;o=i&&i.forceRef?!0:a.availableBits-2<n.bits+e.body.bits.length,o?(a.storeBit(!0),a.storeRef(n)):(a.storeBit(!1),a.storeBuilder(n))}else a.storeBit(!1);let o=!1;o=i&&i.forceRef?!0:a.availableBits-1<e.body.bits.length||a.refs+e.body.refs.length>4,o?(a.storeBit(!0),a.storeRef(e.body)):(a.storeBit(!1),a.storeBuilder(e.body.asBuilder()))}}e.storeMessage=a,e.MessageValue={serialize(e,n){n.storeRef((0,t.beginCell)().store(a(e)))},parse(e){return i(e.loadRef().beginParse())}}})),Dl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SendMode=void 0;var t;(function(e){e[e.CARRY_ALL_REMAINING_BALANCE=128]=`CARRY_ALL_REMAINING_BALANCE`,e[e.CARRY_ALL_REMAINING_INCOMING_VALUE=64]=`CARRY_ALL_REMAINING_INCOMING_VALUE`,e[e.DESTROY_ACCOUNT_IF_ZERO=32]=`DESTROY_ACCOUNT_IF_ZERO`,e[e.PAY_GAS_SEPARATELY=1]=`PAY_GAS_SEPARATELY`,e[e.IGNORE_ERRORS=2]=`IGNORE_ERRORS`,e[e.NONE=0]=`NONE`})(t||(e.SendMode=t={}))})),Ol=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReserveMode=void 0;var t;(function(e){e[e.THIS_AMOUNT=0]=`THIS_AMOUNT`,e[e.LEAVE_THIS_AMOUNT=1]=`LEAVE_THIS_AMOUNT`,e[e.AT_MOST_THIS_AMOUNT=2]=`AT_MOST_THIS_AMOUNT`,e[e.LEAVE_MAX_THIS_AMOUNT=3]=`LEAVE_MAX_THIS_AMOUNT`,e[e.BEFORE_BALANCE_PLUS_THIS_AMOUNT=4]=`BEFORE_BALANCE_PLUS_THIS_AMOUNT`,e[e.LEAVE_BBALANCE_PLUS_THIS_AMOUNT=5]=`LEAVE_BBALANCE_PLUS_THIS_AMOUNT`,e[e.BEFORE_BALANCE_MINUS_THIS_AMOUNT=12]=`BEFORE_BALANCE_MINUS_THIS_AMOUNT`,e[e.LEAVE_BEFORE_BALANCE_MINUS_THIS_AMOUNT=13]=`LEAVE_BEFORE_BALANCE_MINUS_THIS_AMOUNT`})(t||(e.ReserveMode=t={}))})),kl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeShardAccount=e.loadShardAccount=void 0;var t=$(),n=ml();function r(e){let t=e.loadRef(),r;if(!t.isExotic){let e=t.beginParse();e.loadBit()&&(r=(0,n.loadAccount)(e))}return{account:r,lastTransactionHash:e.loadUintBig(256),lastTransactionLt:e.loadUintBig(64)}}e.loadShardAccount=r;function i(e){return r=>{e.account?r.storeRef((0,t.beginCell)().storeBit(!0).store((0,n.storeAccount)(e.account))):r.storeRef((0,t.beginCell)().storeBit(!1)),r.storeUint(e.lastTransactionHash,256),r.storeUint(e.lastTransactionLt,64)}}e.storeShardAccount=i})),Al=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeShardAccounts=e.loadShardAccounts=e.ShardAccountRefValue=void 0;var t=Lc(),n=Cl(),r=kl();e.ShardAccountRefValue={parse:e=>({depthBalanceInfo:(0,n.loadDepthBalanceInfo)(e),shardAccount:(0,r.loadShardAccount)(e)}),serialize(e,t){t.store((0,n.storeDepthBalanceInfo)(e.depthBalanceInfo)),t.store((0,r.storeShardAccount)(e.shardAccount))}};function i(n){return t.Dictionary.load(t.Dictionary.Keys.BigUint(256),e.ShardAccountRefValue,n)}e.loadShardAccounts=i;function a(e){return t=>{t.storeDict(e)}}e.storeShardAccounts=a})),jl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeShardIdent=e.loadShardIdent=void 0;function t(e){if(e.loadUint(2)!==0)throw Error(`Invalid data`);return{shardPrefixBits:e.loadUint(6),workchainId:e.loadInt(32),shardPrefix:e.loadUintBig(64)}}e.loadShardIdent=t;function n(e){return t=>{t.storeUint(0,2),t.storeUint(e.shardPrefixBits,6),t.storeInt(e.workchainId,32),t.storeUint(e.shardPrefix,64)}}e.storeShardIdent=n})),Ml=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loadShardStateUnsplit=void 0;var t=Tl(),n=Al(),r=jl();function i(e){if(e.loadUint(32)!==2418257890)throw Error(`Invalid data`);let i=e.loadInt(32),a=(0,r.loadShardIdent)(e),o=e.loadUint(32),s=e.loadUint(32),c=e.loadUint(32),l=e.loadUintBig(64),u=e.loadUint(32);e.loadRef();let d=e.loadBit(),f=e.loadRef(),p;f.isExotic||(p=(0,n.loadShardAccounts)(f.beginParse())),e.loadRef();let m=e.loadBit(),h=null;if(m){let n=e.loadRef();n.isExotic||(h=(0,t.loadMasterchainStateExtra)(n.beginParse()))}return{globalId:i,shardId:a,seqno:o,vertSeqNo:s,genUtime:c,genLt:l,minRefMcSeqno:u,beforeSplit:d,accounts:p,extras:h}}e.loadShardStateUnsplit=i})),Nl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeSplitMergeInfo=e.loadSplitMergeInfo=void 0;function t(e){return{currentShardPrefixLength:e.loadUint(6),accountSplitDepth:e.loadUint(6),thisAddress:e.loadUintBig(256),siblingAddress:e.loadUintBig(256)}}e.loadSplitMergeInfo=t;function n(e){return t=>{t.storeUint(e.currentShardPrefixLength,6),t.storeUint(e.accountSplitDepth,6),t.storeUint(e.thisAddress,256),t.storeUint(e.siblingAddress,256)}}e.storeSplitMergeInfo=n})),Pl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionActionPhase=e.loadTransactionActionPhase=void 0;var t=gl(),n=fl();function r(e){return{success:e.loadBit(),valid:e.loadBit(),noFunds:e.loadBit(),statusChange:(0,t.loadAccountStatusChange)(e),totalFwdFees:e.loadBit()?e.loadCoins():void 0,totalActionFees:e.loadBit()?e.loadCoins():void 0,resultCode:e.loadInt(32),resultArg:e.loadBit()?e.loadInt(32):void 0,totalActions:e.loadUint(16),specActions:e.loadUint(16),skippedActions:e.loadUint(16),messagesCreated:e.loadUint(16),actionListHash:e.loadUintBig(256),totalMessageSize:(0,n.loadStorageUsed)(e)}}e.loadTransactionActionPhase=r;function i(e){return r=>{r.storeBit(e.success),r.storeBit(e.valid),r.storeBit(e.noFunds),r.store((0,t.storeAccountStatusChange)(e.statusChange)),r.storeMaybeCoins(e.totalFwdFees),r.storeMaybeCoins(e.totalActionFees),r.storeInt(e.resultCode,32),r.storeMaybeInt(e.resultArg,32),r.storeUint(e.totalActions,16),r.storeUint(e.specActions,16),r.storeUint(e.skippedActions,16),r.storeUint(e.messagesCreated,16),r.storeUint(e.actionListHash,256),r.store((0,n.storeStorageUsed)(e.totalMessageSize))}}e.storeTransactionActionPhase=i})),Fl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionBouncePhase=e.loadTransactionBouncePhase=void 0;var t=fl();function n(e){return e.loadBit()?{type:`ok`,messageSize:(0,t.loadStorageUsed)(e),messageFees:e.loadCoins(),forwardFees:e.loadCoins()}:e.loadBit()?{type:`no-funds`,messageSize:(0,t.loadStorageUsed)(e),requiredForwardFees:e.loadCoins()}:{type:`negative-funds`}}e.loadTransactionBouncePhase=n;function r(e){return n=>{if(e.type===`ok`)n.storeBit(!0),n.store((0,t.storeStorageUsed)(e.messageSize)),n.storeCoins(e.messageFees),n.storeCoins(e.forwardFees);else if(e.type===`negative-funds`)n.storeBit(!1),n.storeBit(!1);else if(e.type===`no-funds`)n.storeBit(!1),n.storeBit(!0),n.store((0,t.storeStorageUsed)(e.messageSize)),n.storeCoins(e.requiredForwardFees);else throw Error(`Invalid TransactionBouncePhase type`)}}e.storeTransactionBouncePhase=r})),Il=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionComputePhase=e.loadTransactionComputePhase=void 0;var t=$(),n=Sl();function r(e){if(!e.loadBit())return{type:`skipped`,reason:(0,n.loadComputeSkipReason)(e)};let t=e.loadBit(),r=e.loadBit(),i=e.loadBit(),a=e.loadCoins(),o=e.loadRef().beginParse();return{type:`vm`,success:t,messageStateUsed:r,accountActivated:i,gasFees:a,gasUsed:o.loadVarUintBig(3),gasLimit:o.loadVarUintBig(3),gasCredit:o.loadBit()?o.loadVarUintBig(2):void 0,mode:o.loadUint(8),exitCode:o.loadInt(32),exitArg:o.loadBit()?o.loadInt(32):void 0,vmSteps:o.loadUint(32),vmInitStateHash:o.loadUintBig(256),vmFinalStateHash:o.loadUintBig(256)}}e.loadTransactionComputePhase=r;function i(e){return r=>{if(e.type===`skipped`){r.storeBit(0),r.store((0,n.storeComputeSkipReason)(e.reason));return}r.storeBit(1),r.storeBit(e.success),r.storeBit(e.messageStateUsed),r.storeBit(e.accountActivated),r.storeCoins(e.gasFees),r.storeRef((0,t.beginCell)().storeVarUint(e.gasUsed,3).storeVarUint(e.gasLimit,3).store(t=>e.gasCredit!==void 0&&e.gasCredit!==null?t.storeBit(1).storeVarUint(e.gasCredit,2):t.storeBit(0)).storeUint(e.mode,8).storeInt(e.exitCode,32).store(t=>e.exitArg!==void 0&&e.exitArg!==null?t.storeBit(1).storeInt(e.exitArg,32):t.storeBit(0)).storeUint(e.vmSteps,32).storeUint(e.vmInitStateHash,256).storeUint(e.vmFinalStateHash,256).endCell())}}e.storeTransactionComputePhase=i})),Ll=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionCreditPhase=e.loadTransactionCreditPhase=void 0;var t=ll();function n(e){return{dueFeesColelcted:e.loadBit()?e.loadCoins():void 0,credit:(0,t.loadCurrencyCollection)(e)}}e.loadTransactionCreditPhase=n;function r(e){return n=>{e.dueFeesColelcted===null||e.dueFeesColelcted===void 0?n.storeBit(!1):(n.storeBit(!0),n.storeCoins(e.dueFeesColelcted)),n.store((0,t.storeCurrencyCollection)(e.credit))}}e.storeTransactionCreditPhase=r})),Rl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionsStoragePhase=e.loadTransactionStoragePhase=void 0;var t=gl();function n(e){let n=e.loadCoins(),r;e.loadBit()&&(r=e.loadCoins());let i=(0,t.loadAccountStatusChange)(e);return{storageFeesCollected:n,storageFeesDue:r,statusChange:i}}e.loadTransactionStoragePhase=n;function r(e){return n=>{n.storeCoins(e.storageFeesCollected),e.storageFeesDue===null||e.storageFeesDue===void 0?n.storeBit(!1):(n.storeBit(!0),n.storeCoins(e.storageFeesDue)),n.store((0,t.storeAccountStatusChange)(e.statusChange))}}e.storeTransactionsStoragePhase=r})),zl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionDescription=e.loadTransactionDescription=void 0;var t=$(),n=Nl(),r=Bl(),i=Pl(),a=Fl(),o=Il(),s=Ll(),c=Rl();function l(e){let t=e.loadUint(4);if(t===0){let t=e.loadBit(),n;e.loadBit()&&(n=(0,c.loadTransactionStoragePhase)(e));let r;e.loadBit()&&(r=(0,s.loadTransactionCreditPhase)(e));let l=(0,o.loadTransactionComputePhase)(e),u;e.loadBit()&&(u=(0,i.loadTransactionActionPhase)(e.loadRef().beginParse()));let d=e.loadBit(),f;e.loadBit()&&(f=(0,a.loadTransactionBouncePhase)(e));let p=e.loadBit();return{type:`generic`,creditFirst:t,storagePhase:n,creditPhase:r,computePhase:l,actionPhase:u,bouncePhase:f,aborted:d,destroyed:p}}if(t===1)return{type:`storage`,storagePhase:(0,c.loadTransactionStoragePhase)(e)};if(t===2||t===3){let n=t===3,r=(0,c.loadTransactionStoragePhase)(e),a=(0,o.loadTransactionComputePhase)(e),s;e.loadBit()&&(s=(0,i.loadTransactionActionPhase)(e.loadRef().beginParse()));let l=e.loadBit(),u=e.loadBit();return{type:`tick-tock`,isTock:n,storagePhase:r,computePhase:a,actionPhase:s,aborted:l,destroyed:u}}if(t===4){let t=(0,n.loadSplitMergeInfo)(e),r;e.loadBit()&&(r=(0,c.loadTransactionStoragePhase)(e));let a=(0,o.loadTransactionComputePhase)(e),s;e.loadBit()&&(s=(0,i.loadTransactionActionPhase)(e.loadRef().beginParse()));let l=e.loadBit(),u=e.loadBit();return{type:`split-prepare`,splitInfo:t,storagePhase:r,computePhase:a,actionPhase:s,aborted:l,destroyed:u}}if(t===5)return{type:`split-install`,splitInfo:(0,n.loadSplitMergeInfo)(e),prepareTransaction:(0,r.loadTransaction)(e.loadRef().beginParse()),installed:e.loadBit()};throw Error(`Unsupported transaction description type ${t}`)}e.loadTransactionDescription=l;function u(e){return l=>{if(e.type===`generic`)l.storeUint(0,4),l.storeBit(e.creditFirst),e.storagePhase?(l.storeBit(!0),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase))):l.storeBit(!1),e.creditPhase?(l.storeBit(!0),l.store((0,s.storeTransactionCreditPhase)(e.creditPhase))):l.storeBit(!1),l.store((0,o.storeTransactionComputePhase)(e.computePhase)),e.actionPhase?(l.storeBit(!0),l.storeRef((0,t.beginCell)().store((0,i.storeTransactionActionPhase)(e.actionPhase)))):l.storeBit(!1),l.storeBit(e.aborted),e.bouncePhase?(l.storeBit(!0),l.store((0,a.storeTransactionBouncePhase)(e.bouncePhase))):l.storeBit(!1),l.storeBit(e.destroyed);else if(e.type===`storage`)l.storeUint(1,4),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase));else if(e.type===`tick-tock`)l.storeUint(e.isTock?3:2,4),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase)),l.store((0,o.storeTransactionComputePhase)(e.computePhase)),e.actionPhase?(l.storeBit(!0),l.storeRef((0,t.beginCell)().store((0,i.storeTransactionActionPhase)(e.actionPhase)))):l.storeBit(!1),l.storeBit(e.aborted),l.storeBit(e.destroyed);else if(e.type===`split-prepare`)l.storeUint(4,4),l.store((0,n.storeSplitMergeInfo)(e.splitInfo)),e.storagePhase?(l.storeBit(!0),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase))):l.storeBit(!1),l.store((0,o.storeTransactionComputePhase)(e.computePhase)),e.actionPhase?(l.storeBit(!0),l.store((0,i.storeTransactionActionPhase)(e.actionPhase))):l.storeBit(!1),l.storeBit(e.aborted),l.storeBit(e.destroyed);else if(e.type===`split-install`)l.storeUint(5,4),l.store((0,n.storeSplitMergeInfo)(e.splitInfo)),l.storeRef((0,t.beginCell)().store((0,r.storeTransaction)(e.prepareTransaction))),l.storeBit(e.installed);else throw Error(`Unsupported transaction description type ${e.type}`)}}e.storeTransactionDescription=u})),Bl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransaction=e.loadTransaction=void 0;var t=$(),n=Lc(),r=hl(),i=ll(),a=wl(),o=El(),s=zl();function c(e){let t=e.asCell();if(e.loadUint(4)!==7)throw Error(`Invalid data`);let c=e.loadUintBig(256),l=e.loadUintBig(64),u=e.loadUintBig(256),d=e.loadUintBig(64),f=e.loadUint(32),p=e.loadUint(15),m=(0,r.loadAccountStatus)(e),h=(0,r.loadAccountStatus)(e),g=e.loadRef().beginParse(),_=g.loadBit()?(0,o.loadMessage)(g.loadRef().beginParse()):void 0,v=g.loadDict(n.Dictionary.Keys.Uint(15),o.MessageValue);return g.endParse(),{address:c,lt:l,prevTransactionHash:u,prevTransactionLt:d,now:f,outMessagesCount:p,oldStatus:m,endStatus:h,inMessage:_,outMessages:v,totalFees:(0,i.loadCurrencyCollection)(e),stateUpdate:(0,a.loadHashUpdate)(e.loadRef().beginParse()),description:(0,s.loadTransactionDescription)(e.loadRef().beginParse()),raw:t,hash:()=>t.hash()}}e.loadTransaction=c;function l(e){return n=>{n.storeUint(7,4),n.storeUint(e.address,256),n.storeUint(e.lt,64),n.storeUint(e.prevTransactionHash,256),n.storeUint(e.prevTransactionLt,64),n.storeUint(e.now,32),n.storeUint(e.outMessagesCount,15),n.store((0,r.storeAccountStatus)(e.oldStatus)),n.store((0,r.storeAccountStatus)(e.endStatus));let c=(0,t.beginCell)();e.inMessage?(c.storeBit(!0),c.storeRef((0,t.beginCell)().store((0,o.storeMessage)(e.inMessage)))):c.storeBit(!1),c.storeDict(e.outMessages),n.storeRef(c),n.store((0,i.storeCurrencyCollection)(e.totalFees)),n.storeRef((0,t.beginCell)().store((0,a.storeHashUpdate)(e.stateUpdate))),n.storeRef((0,t.beginCell)().store((0,s.storeTransactionDescription)(e.description)))}}e.storeTransaction=l})),Vl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loadSimpleLibrary=e.loadShardStateUnsplit=e.storeShardIdent=e.loadShardIdent=e.storeShardAccounts=e.loadShardAccounts=e.ShardAccountRefValue=e.storeShardAccount=e.loadShardAccount=e.ReserveMode=e.SendMode=e.storeMessageRelaxed=e.loadMessageRelaxed=e.storeMessage=e.loadMessage=e.loadMasterchainStateExtra=e.storeHashUpdate=e.loadHashUpdate=e.storeExtraCurrency=e.loadMaybeExtraCurrency=e.loadExtraCurrency=e.packExtraCurrencyDict=e.packExtraCurrencyCell=e.storeDepthBalanceInfo=e.loadDepthBalanceInfo=e.storeCurrencyCollection=e.loadCurrencyCollection=e.storeComputeSkipReason=e.loadComputeSkipReason=e.storeCommonMessageInfoRelaxed=e.loadCommonMessageInfoRelaxed=e.storeCommonMessageInfo=e.loadCommonMessageInfo=e.storeOutList=e.loadOutList=e.storeOutAction=e.loadOutAction=e.storeAccountStorage=e.loadAccountStorage=e.storeAccountStatusChange=e.loadAccountStatusChange=e.storeAccountStatus=e.loadAccountStatus=e.storeAccountState=e.loadAccountState=e.storeAccount=e.loadAccount=e.comment=e.external=e.internal=void 0,e.storeTransactionsStoragePhase=e.loadTransactionStoragePhase=e.storeTransactionDescription=e.loadTransactionDescription=e.storeTransactionCreditPhase=e.loadTransactionCreditPhase=e.storeTransactionComputePhase=e.loadTransactionComputePhase=e.storeTransactionBouncePhase=e.loadTransactionBouncePhase=e.storeTransactionActionPhase=e.loadTransactionActionPhase=e.storeTransaction=e.loadTransaction=e.storeTickTock=e.loadTickTock=e.storeStorageUsed=e.loadStorageUsed=e.storeStorageInfo=e.loadStorageInfo=e.storeStateInit=e.loadStateInit=e.storeSplitMergeInfo=e.loadSplitMergeInfo=e.storeLibRef=e.loadLibRef=e.storeSimpleLibrary=void 0;var t=sl();Object.defineProperty(e,"internal",{enumerable:!0,get:function(){return t.internal}}),Object.defineProperty(e,"external",{enumerable:!0,get:function(){return t.external}}),Object.defineProperty(e,"comment",{enumerable:!0,get:function(){return t.comment}});var n=ml();Object.defineProperty(e,"loadAccount",{enumerable:!0,get:function(){return n.loadAccount}}),Object.defineProperty(e,"storeAccount",{enumerable:!0,get:function(){return n.storeAccount}});var r=cl();Object.defineProperty(e,"loadAccountState",{enumerable:!0,get:function(){return r.loadAccountState}}),Object.defineProperty(e,"storeAccountState",{enumerable:!0,get:function(){return r.storeAccountState}});var i=hl();Object.defineProperty(e,"loadAccountStatus",{enumerable:!0,get:function(){return i.loadAccountStatus}}),Object.defineProperty(e,"storeAccountStatus",{enumerable:!0,get:function(){return i.storeAccountStatus}});var a=gl();Object.defineProperty(e,"loadAccountStatusChange",{enumerable:!0,get:function(){return a.loadAccountStatusChange}}),Object.defineProperty(e,"storeAccountStatusChange",{enumerable:!0,get:function(){return a.storeAccountStatusChange}});var o=ul();Object.defineProperty(e,"loadAccountStorage",{enumerable:!0,get:function(){return o.loadAccountStorage}}),Object.defineProperty(e,"storeAccountStorage",{enumerable:!0,get:function(){return o.storeAccountStorage}});var s=bl();Object.defineProperty(e,"loadOutAction",{enumerable:!0,get:function(){return s.loadOutAction}}),Object.defineProperty(e,"storeOutAction",{enumerable:!0,get:function(){return s.storeOutAction}}),Object.defineProperty(e,"loadOutList",{enumerable:!0,get:function(){return s.loadOutList}}),Object.defineProperty(e,"storeOutList",{enumerable:!0,get:function(){return s.storeOutList}});var c=xl();Object.defineProperty(e,"loadCommonMessageInfo",{enumerable:!0,get:function(){return c.loadCommonMessageInfo}}),Object.defineProperty(e,"storeCommonMessageInfo",{enumerable:!0,get:function(){return c.storeCommonMessageInfo}});var l=_l();Object.defineProperty(e,"loadCommonMessageInfoRelaxed",{enumerable:!0,get:function(){return l.loadCommonMessageInfoRelaxed}}),Object.defineProperty(e,"storeCommonMessageInfoRelaxed",{enumerable:!0,get:function(){return l.storeCommonMessageInfoRelaxed}});var u=Sl();Object.defineProperty(e,"loadComputeSkipReason",{enumerable:!0,get:function(){return u.loadComputeSkipReason}}),Object.defineProperty(e,"storeComputeSkipReason",{enumerable:!0,get:function(){return u.storeComputeSkipReason}});var d=ll();Object.defineProperty(e,"loadCurrencyCollection",{enumerable:!0,get:function(){return d.loadCurrencyCollection}}),Object.defineProperty(e,"storeCurrencyCollection",{enumerable:!0,get:function(){return d.storeCurrencyCollection}});var f=Cl();Object.defineProperty(e,"loadDepthBalanceInfo",{enumerable:!0,get:function(){return f.loadDepthBalanceInfo}}),Object.defineProperty(e,"storeDepthBalanceInfo",{enumerable:!0,get:function(){return f.storeDepthBalanceInfo}});var p=ol();Object.defineProperty(e,"packExtraCurrencyCell",{enumerable:!0,get:function(){return p.packExtraCurrencyCell}}),Object.defineProperty(e,"packExtraCurrencyDict",{enumerable:!0,get:function(){return p.packExtraCurrencyDict}}),Object.defineProperty(e,"loadExtraCurrency",{enumerable:!0,get:function(){return p.loadExtraCurrency}}),Object.defineProperty(e,"loadMaybeExtraCurrency",{enumerable:!0,get:function(){return p.loadMaybeExtraCurrency}}),Object.defineProperty(e,"storeExtraCurrency",{enumerable:!0,get:function(){return p.storeExtraCurrency}});var m=wl();Object.defineProperty(e,"loadHashUpdate",{enumerable:!0,get:function(){return m.loadHashUpdate}}),Object.defineProperty(e,"storeHashUpdate",{enumerable:!0,get:function(){return m.storeHashUpdate}});var h=Tl();Object.defineProperty(e,"loadMasterchainStateExtra",{enumerable:!0,get:function(){return h.loadMasterchainStateExtra}});var g=El();Object.defineProperty(e,"loadMessage",{enumerable:!0,get:function(){return g.loadMessage}}),Object.defineProperty(e,"storeMessage",{enumerable:!0,get:function(){return g.storeMessage}});var _=vl();Object.defineProperty(e,"loadMessageRelaxed",{enumerable:!0,get:function(){return _.loadMessageRelaxed}}),Object.defineProperty(e,"storeMessageRelaxed",{enumerable:!0,get:function(){return _.storeMessageRelaxed}});var v=Dl();Object.defineProperty(e,"SendMode",{enumerable:!0,get:function(){return v.SendMode}});var y=Ol();Object.defineProperty(e,"ReserveMode",{enumerable:!0,get:function(){return y.ReserveMode}});var b=kl();Object.defineProperty(e,"loadShardAccount",{enumerable:!0,get:function(){return b.loadShardAccount}}),Object.defineProperty(e,"storeShardAccount",{enumerable:!0,get:function(){return b.storeShardAccount}});var x=Al();Object.defineProperty(e,"ShardAccountRefValue",{enumerable:!0,get:function(){return x.ShardAccountRefValue}}),Object.defineProperty(e,"loadShardAccounts",{enumerable:!0,get:function(){return x.loadShardAccounts}}),Object.defineProperty(e,"storeShardAccounts",{enumerable:!0,get:function(){return x.storeShardAccounts}});var S=jl();Object.defineProperty(e,"loadShardIdent",{enumerable:!0,get:function(){return S.loadShardIdent}}),Object.defineProperty(e,"storeShardIdent",{enumerable:!0,get:function(){return S.storeShardIdent}});var C=Ml();Object.defineProperty(e,"loadShardStateUnsplit",{enumerable:!0,get:function(){return C.loadShardStateUnsplit}});var w=Qc();Object.defineProperty(e,"loadSimpleLibrary",{enumerable:!0,get:function(){return w.loadSimpleLibrary}}),Object.defineProperty(e,"storeSimpleLibrary",{enumerable:!0,get:function(){return w.storeSimpleLibrary}});var T=yl();Object.defineProperty(e,"loadLibRef",{enumerable:!0,get:function(){return T.loadLibRef}}),Object.defineProperty(e,"storeLibRef",{enumerable:!0,get:function(){return T.storeLibRef}});var ee=Nl();Object.defineProperty(e,"loadSplitMergeInfo",{enumerable:!0,get:function(){return ee.loadSplitMergeInfo}}),Object.defineProperty(e,"storeSplitMergeInfo",{enumerable:!0,get:function(){return ee.storeSplitMergeInfo}});var E=el();Object.defineProperty(e,"loadStateInit",{enumerable:!0,get:function(){return E.loadStateInit}}),Object.defineProperty(e,"storeStateInit",{enumerable:!0,get:function(){return E.storeStateInit}});var D=pl();Object.defineProperty(e,"loadStorageInfo",{enumerable:!0,get:function(){return D.loadStorageInfo}}),Object.defineProperty(e,"storeStorageInfo",{enumerable:!0,get:function(){return D.storeStorageInfo}});var O=fl();Object.defineProperty(e,"loadStorageUsed",{enumerable:!0,get:function(){return O.loadStorageUsed}}),Object.defineProperty(e,"storeStorageUsed",{enumerable:!0,get:function(){return O.storeStorageUsed}});var te=$c();Object.defineProperty(e,"loadTickTock",{enumerable:!0,get:function(){return te.loadTickTock}}),Object.defineProperty(e,"storeTickTock",{enumerable:!0,get:function(){return te.storeTickTock}});var ne=Bl();Object.defineProperty(e,"loadTransaction",{enumerable:!0,get:function(){return ne.loadTransaction}}),Object.defineProperty(e,"storeTransaction",{enumerable:!0,get:function(){return ne.storeTransaction}});var re=Pl();Object.defineProperty(e,"loadTransactionActionPhase",{enumerable:!0,get:function(){return re.loadTransactionActionPhase}}),Object.defineProperty(e,"storeTransactionActionPhase",{enumerable:!0,get:function(){return re.storeTransactionActionPhase}});var ie=Fl();Object.defineProperty(e,"loadTransactionBouncePhase",{enumerable:!0,get:function(){return ie.loadTransactionBouncePhase}}),Object.defineProperty(e,"storeTransactionBouncePhase",{enumerable:!0,get:function(){return ie.storeTransactionBouncePhase}});var ae=Il();Object.defineProperty(e,"loadTransactionComputePhase",{enumerable:!0,get:function(){return ae.loadTransactionComputePhase}}),Object.defineProperty(e,"storeTransactionComputePhase",{enumerable:!0,get:function(){return ae.storeTransactionComputePhase}});var oe=Ll();Object.defineProperty(e,"loadTransactionCreditPhase",{enumerable:!0,get:function(){return oe.loadTransactionCreditPhase}}),Object.defineProperty(e,"storeTransactionCreditPhase",{enumerable:!0,get:function(){return oe.storeTransactionCreditPhase}});var se=zl();Object.defineProperty(e,"loadTransactionDescription",{enumerable:!0,get:function(){return se.loadTransactionDescription}}),Object.defineProperty(e,"storeTransactionDescription",{enumerable:!0,get:function(){return se.storeTransactionDescription}});var ce=Rl();Object.defineProperty(e,"loadTransactionStoragePhase",{enumerable:!0,get:function(){return ce.loadTransactionStoragePhase}}),Object.defineProperty(e,"storeTransactionsStoragePhase",{enumerable:!0,get:function(){return ce.storeTransactionsStoragePhase}})})),Hl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.openContract=void 0;var t=bc(),n=Zc();function r(e,r){let i,a=null;if(!t.Address.isAddress(e.address))throw Error(`Invalid address`);if(i=e.address,e.init){if(!(e.init.code instanceof n.Cell))throw Error(`Invalid init.code`);if(!(e.init.data instanceof n.Cell))throw Error(`Invalid init.data`);a=e.init}let o=r({address:i,init:a});return new Proxy(e,{get(e,t){let n=e[t];return typeof t==`string`&&(t.startsWith(`get`)||t.startsWith(`send`)||t.startsWith(`is`))&&typeof n==`function`?(...t)=>n.apply(e,[o,...t]):n}})}e.openContract=r})),Ul=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ComputeError=void 0,e.ComputeError=class e extends Error{constructor(t,n,r){super(t),this.exitCode=n,this.debugLogs=r&&r.debugLogs?r.debugLogs:null,this.logs=r&&r.logs?r.logs:null,Object.setPrototypeOf(this,e.prototype)}}})),Wl=e((e=>{k(),Object.defineProperty(e,"__esModule",{value:!0}),e.getMethodId=void 0;var t=new Int16Array([0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920]);function n(e){e instanceof A||(e=A.from(e));let n=0;for(let r=0;r<e.length;r++){let i=e[r];n=(t[(n>>8^i)&255]^n<<8)&65535}return n}function r(e){return n(e)&65535|65536}e.getMethodId=r})),Gl=e((e=>{k(),Object.defineProperty(e,"__esModule",{value:!0}),e.safeSignVerify=e.safeSign=void 0;var t=ye(),n=8,r=64;function i(e,i){let a=A.from(i);if(a.length>r)throw Error(`Seed can be longer than 64 bytes`);if(a.length<n)throw Error(`Seed must be at least 8 bytes`);return(0,t.sha256_sync)(A.concat([A.from([255,255]),a,e.hash()]))}function a(e,n,r=`ton-safe-sign-magic`){return(0,t.sign)(i(e,r),n)}e.safeSign=a;function o(e,n,r,a=`ton-safe-sign-magic`){return(0,t.signVerify)(i(e,a),n,r)}e.safeSignVerify=o})),Kl=e((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.safeSignVerify=e.safeSign=e.getMethodId=e.base32Encode=e.base32Decode=e.crc32c=e.crc16=e.fromNano=e.toNano=e.ComputeError=e.openContract=e.TupleBuilder=e.TupleReader=e.serializeTupleItem=e.parseTupleItem=e.serializeTuple=e.parseTuple=e.generateMerkleUpdate=e.generateMerkleProofDirect=e.generateMerkleProof=e.exoticPruned=e.exoticMerkleUpdate=e.convertToMerkleProof=e.exoticMerkleProof=e.Dictionary=e.Cell=e.CellType=e.Slice=e.beginCell=e.Builder=e.BitBuilder=e.BitReader=e.BitString=e.contractAddress=e.ADNLAddress=e.ExternalAddress=e.address=e.Address=void 0;var r=bc();Object.defineProperty(e,"Address",{enumerable:!0,get:function(){return r.Address}}),Object.defineProperty(e,"address",{enumerable:!0,get:function(){return r.address}});var i=xc();Object.defineProperty(e,"ExternalAddress",{enumerable:!0,get:function(){return i.ExternalAddress}});var a=Cc();Object.defineProperty(e,"ADNLAddress",{enumerable:!0,get:function(){return a.ADNLAddress}});var o=tl();Object.defineProperty(e,"contractAddress",{enumerable:!0,get:function(){return o.contractAddress}});var s=Tc();Object.defineProperty(e,"BitString",{enumerable:!0,get:function(){return s.BitString}});var c=kc();Object.defineProperty(e,"BitReader",{enumerable:!0,get:function(){return c.BitReader}});var l=Ec();Object.defineProperty(e,"BitBuilder",{enumerable:!0,get:function(){return l.BitBuilder}});var u=$();Object.defineProperty(e,"Builder",{enumerable:!0,get:function(){return u.Builder}}),Object.defineProperty(e,"beginCell",{enumerable:!0,get:function(){return u.beginCell}});var d=zc();Object.defineProperty(e,"Slice",{enumerable:!0,get:function(){return d.Slice}});var f=Dc();Object.defineProperty(e,"CellType",{enumerable:!0,get:function(){return f.CellType}});var p=Zc();Object.defineProperty(e,"Cell",{enumerable:!0,get:function(){return p.Cell}});var m=Lc();Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return m.Dictionary}});var h=Ac();Object.defineProperty(e,"exoticMerkleProof",{enumerable:!0,get:function(){return h.exoticMerkleProof}}),Object.defineProperty(e,"convertToMerkleProof",{enumerable:!0,get:function(){return h.convertToMerkleProof}});var g=Vc();Object.defineProperty(e,"exoticMerkleUpdate",{enumerable:!0,get:function(){return g.exoticMerkleUpdate}});var _=Uc();Object.defineProperty(e,"exoticPruned",{enumerable:!0,get:function(){return _.exoticPruned}});var v=jc();Object.defineProperty(e,"generateMerkleProof",{enumerable:!0,get:function(){return v.generateMerkleProof}}),Object.defineProperty(e,"generateMerkleProofDirect",{enumerable:!0,get:function(){return v.generateMerkleProofDirect}});var y=Mc();Object.defineProperty(e,"generateMerkleUpdate",{enumerable:!0,get:function(){return y.generateMerkleUpdate}});var b=nl();Object.defineProperty(e,"parseTuple",{enumerable:!0,get:function(){return b.parseTuple}}),Object.defineProperty(e,"serializeTuple",{enumerable:!0,get:function(){return b.serializeTuple}}),Object.defineProperty(e,"parseTupleItem",{enumerable:!0,get:function(){return b.parseTupleItem}}),Object.defineProperty(e,"serializeTupleItem",{enumerable:!0,get:function(){return b.serializeTupleItem}});var x=rl();Object.defineProperty(e,"TupleReader",{enumerable:!0,get:function(){return x.TupleReader}});var S=il();Object.defineProperty(e,"TupleBuilder",{enumerable:!0,get:function(){return S.TupleBuilder}}),n(Vl(),e);var C=Hl();Object.defineProperty(e,"openContract",{enumerable:!0,get:function(){return C.openContract}});var w=Ul();Object.defineProperty(e,"ComputeError",{enumerable:!0,get:function(){return w.ComputeError}});var T=al();Object.defineProperty(e,"toNano",{enumerable:!0,get:function(){return T.toNano}}),Object.defineProperty(e,"fromNano",{enumerable:!0,get:function(){return T.fromNano}});var ee=yc();Object.defineProperty(e,"crc16",{enumerable:!0,get:function(){return ee.crc16}});var E=Yc();Object.defineProperty(e,"crc32c",{enumerable:!0,get:function(){return E.crc32c}});var D=Sc();Object.defineProperty(e,"base32Decode",{enumerable:!0,get:function(){return D.base32Decode}}),Object.defineProperty(e,"base32Encode",{enumerable:!0,get:function(){return D.base32Encode}});var O=Wl();Object.defineProperty(e,"getMethodId",{enumerable:!0,get:function(){return O.getMethodId}});var te=Gl();Object.defineProperty(e,"safeSign",{enumerable:!0,get:function(){return te.safeSign}}),Object.defineProperty(e,"safeSignVerify",{enumerable:!0,get:function(){return te.safeSignVerify}})}));k();var ql=Kl(),Jl=({amount:e,recipient:t,family:n,fees:r,comment:i,payload:a})=>({amount:e.toString(),recipient:t,family:n,fees:r.toString(),comment:i,payload:a?Ql(a):void 0}),Yl=({amount:e,recipient:t,family:n,fees:r,comment:i,payload:a})=>({amount:new P(e),recipient:t,family:n,fees:new P(r),comment:i,payload:a?Zl(a):void 0}),Xl=e=>{try{return ql.Cell.fromBase64(e)}catch{return A.from(e,`hex`)}},Zl=e=>{switch(e.type){case`unsafe`:return{type:e.type,message:ql.Cell.fromBase64(e.message)};case`jetton-transfer`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,amount:BigInt(e.amount),destination:ql.Address.parse(e.destination),responseDestination:ql.Address.parse(e.responseDestination),customPayload:e.customPayload?ql.Cell.fromBase64(e.customPayload):null,forwardAmount:BigInt(e.forwardAmount),forwardPayload:e.forwardPayload?ql.Cell.fromBase64(e.forwardPayload):null,knownJetton:e.knownJetton};case`nft-transfer`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,newOwner:ql.Address.parse(e.newOwner),responseDestination:ql.Address.parse(e.responseDestination),customPayload:e.customPayload?ql.Cell.fromBase64(e.customPayload):null,forwardAmount:BigInt(e.forwardAmount),forwardPayload:e.forwardPayload?ql.Cell.fromBase64(e.forwardPayload):null};case`jetton-burn`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,amount:BigInt(e.amount),responseDestination:ql.Address.parse(e.responseDestination),customPayload:e.customPayload?Xl(e.customPayload):null};case`add-whitelist`:case`single-nominator-change-validator`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,address:ql.Address.parse(e.address)};case`single-nominator-withdraw`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,amount:BigInt(e.amount)};case`tonstakers-deposit`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,appId:e.appId?BigInt(e.appId):null};case`vote-for-proposal`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,votingAddress:ql.Address.parse(e.votingAddress),expirationDate:e.expirationDate,vote:e.vote,needConfirmation:e.needConfirmation};case`change-dns-record`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,record:e.record.type===`wallet`?{type:e.record.type,value:e.record.value?{address:ql.Address.parse(e.record.value.address),capabilities:e.record.value.capabilities}:null}:{type:e.record.type,key:A.from(e.record.key,`hex`),value:e.record.value?ql.Cell.fromBase64(e.record.value):null}};case`token-bridge-pay-swap`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,swapId:A.from(e.swapId,`hex`)};case`tonwhales-pool-deposit`:return{type:e.type,queryId:BigInt(e.queryId),gasLimit:BigInt(e.gasLimit)};case`tonwhales-pool-withdraw`:return{type:e.type,queryId:BigInt(e.queryId),gasLimit:BigInt(e.gasLimit),amount:BigInt(e.amount)};case`vesting-send-msg-comment`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,sendMode:e.sendMode,value:BigInt(e.value),destination:ql.Address.parse(e.destination),text:e.text};case`comment`:return e;default:return e}},Ql=e=>{switch(e.type){case`unsafe`:return{type:e.type,message:e.message.toBoc().toString(`base64`)};case`jetton-transfer`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,amount:e.amount.toString(),destination:e.destination.toRawString(),responseDestination:e.responseDestination.toRawString(),customPayload:e.customPayload?e.customPayload.toBoc().toString(`base64`):null,forwardAmount:e.forwardAmount.toString(),forwardPayload:e.forwardPayload?e.forwardPayload.toBoc().toString(`base64`):null,knownJetton:e.knownJetton};case`nft-transfer`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,newOwner:e.newOwner.toRawString(),responseDestination:e.responseDestination.toRawString(),customPayload:e.customPayload?e.customPayload.toBoc().toString(`base64`):null,forwardAmount:e.forwardAmount.toString(),forwardPayload:e.forwardPayload?e.forwardPayload.toBoc().toString(`base64`):null};case`jetton-burn`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,amount:e.amount.toString(),responseDestination:e.responseDestination.toRawString(),customPayload:e.customPayload&&`toBoc`in e.customPayload?e.customPayload.toBoc().toString(`base64`):e.customPayload?e.customPayload.toString(`hex`):null};case`add-whitelist`:case`single-nominator-change-validator`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,address:e.address.toRawString()};case`single-nominator-withdraw`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,amount:e.amount.toString()};case`tonstakers-deposit`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,appId:typeof e.appId==`bigint`?e.appId.toString():null};case`vote-for-proposal`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,votingAddress:e.votingAddress.toRawString(),expirationDate:e.expirationDate,vote:e.vote,needConfirmation:e.needConfirmation};case`change-dns-record`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,record:e.record.type===`wallet`?{type:e.record.type,value:e.record.value?{address:e.record.value.address.toRawString(),capabilities:e.record.value.capabilities}:null}:{type:e.record.type,key:e.record.key.toString(`hex`),value:e.record.value?e.record.value.toBoc().toString(`base64`):null}};case`token-bridge-pay-swap`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,swapId:e.swapId.toString(`hex`)};case`tonwhales-pool-deposit`:return{type:e.type,queryId:e.queryId.toString(),gasLimit:e.gasLimit.toString()};case`tonwhales-pool-withdraw`:return{type:e.type,queryId:e.queryId.toString(),gasLimit:e.gasLimit.toString(),amount:e.amount.toString()};case`vesting-send-msg-comment`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,sendMode:e.sendMode,value:e.value.toString(),destination:e.destination.toRawString(),text:e.text};case`comment`:return e;default:return e}},$l=({amount:e,recipient:t,family:n,mode:r,resource:i,duration:a,votes:o})=>({amount:e.toString(),recipient:t,family:n,mode:r,resource:i,duration:a,votes:o}),eu=({amount:e,recipient:t,family:n,mode:r,resource:i,duration:a,votes:o})=>({amount:new P(e),recipient:t,family:n,mode:r,resource:i,duration:a,votes:o});function tu({amount:e,data:t,family:n,fees:r,gasLimit:i,mode:a,recipient:o}){return{family:n,amount:e.toString(),recipient:o,mode:a,fees:r?r.toString():void 0,data:t,gasLimit:i}}function nu({amount:e,data:t,family:n,fees:r,gasLimit:i,mode:a,recipient:o}){return{family:n,mode:a,amount:new P(e),recipient:o,fees:r?new P(r):void 0,data:t,gasLimit:i}}function ru({amount:e,family:t,fees:n,memo:r,mode:i,recipient:a}){return{amount:e.toString(),family:t,fees:n?n.toString():void 0,memo:r,mode:i,recipient:a}}function iu({amount:e,family:t,fees:n,memo:r,mode:i,recipient:a}){return{amount:new P(e),family:t,fees:n?new P(n):void 0,memo:r,mode:i,recipient:a}}function au({amount:e,family:t,model:n,recipient:r,raw:i}){return{amount:e.toString(),family:t,model:JSON.stringify(n),recipient:r,raw:i}}function ou({family:e,amount:t,model:n,recipient:r,raw:i}){return{amount:new P(t),family:e,model:JSON.parse(n),recipient:r,raw:i}}var su=({amount:e,recipient:t,family:n,estimatedFees:r,body:i})=>({amount:e.toString(),recipient:t,family:n,estimatedFees:r,body:i}),cu=({amount:e,recipient:t,family:n,estimatedFees:r,body:i})=>({amount:new P(e),recipient:t,family:n,estimatedFees:r,body:i}),lu=({amount:e,recipient:t,family:n,fee:r,nonce:i,memo:a,network:o,anchorMode:s})=>({amount:e.toString(),recipient:t,family:n,fee:r?.toString(),nonce:i?.toString(),memo:a,network:o,anchorMode:s}),uu=({amount:e,recipient:t,family:n,fee:r,nonce:i,memo:a,network:o,anchorMode:s})=>({amount:new P(e),recipient:t,family:n,fee:r?new P(r):void 0,nonce:i?new P(i):void 0,memo:a,network:o===`mainnet`?o:`testnet`,anchorMode:s}),du=({amount:e,recipient:t,family:n,fees:r,memo:i})=>({amount:e.toFixed(),recipient:t,family:n,fees:r.toString(),memo:i}),fu=({amount:e,recipient:t,family:n,fees:r,memo:i})=>({amount:new P(e),recipient:t,family:n,fees:new P(r),memo:i}),pu=({amount:e,recipient:t,family:n,fees:r,transferId:i})=>({amount:e.toFixed(),recipient:t,family:n,fees:r.toString(),transferId:i}),mu=({amount:e,recipient:t,family:n,fees:r,transferId:i})=>({amount:new P(e),recipient:t,family:n,fees:new P(r),transferId:i});function hu({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:e.toString(),recipient:t,family:n,mode:r,fees:i?.toString()}}function gu({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:new P(e),recipient:t,family:n,mode:r,fees:i?new P(i):void 0}}function _u({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:e.toString(),recipient:t,family:n,mode:r,fees:i.toString()}}function vu({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:new P(e),recipient:t,family:n,mode:r,fees:new P(i)}}function yu(e){switch(e.family){case`ethereum`:return Qs(e);case`bitcoin`:return Ws(e);case`algorand`:return Bs(e);case`aptos`:return Hs(e);case`crypto_org`:return Xs(e);case`ripple`:return fc(e);case`celo`:return Ks(e);case`cosmos`:return Js(e);case`hedera`:return nc(e);case`kaspa`:return ic(e);case`filecoin`:return oc(e);case`tezos`:return gc(e);case`polkadot`:return uc(e);case`stellar`:return mc(e);case`ton`:return Jl(e);case`tron`:return $l(e);case`near`:return ec(e);case`neo`:return cc(e);case`elrond`:return tu(e);case`cardano`:return ru(e);case`solana`:return au(e);case`vechain`:return su(e);case`stacks`:return lu(e);case`internet_computer`:return du(e);case`casper`:return pu(e);case`sui`:return hu(e);case`aleo`:return _u(e);default:return e}}function bu(e){switch(e.family){case`ethereum`:return $s(e);case`bitcoin`:return Gs(e);case`algorand`:return Vs(e);case`aptos`:return Us(e);case`crypto_org`:return Zs(e);case`ripple`:return pc(e);case`celo`:return qs(e);case`cosmos`:return Ys(e);case`hedera`:return rc(e);case`kaspa`:return ac(e);case`filecoin`:return sc(e);case`tezos`:return _c(e);case`polkadot`:return dc(e);case`stellar`:return hc(e);case`ton`:return Yl(e);case`tron`:return eu(e);case`near`:return tc(e);case`neo`:return lc(e);case`elrond`:return nu(e);case`cardano`:return iu(e);case`solana`:return ou(e);case`vechain`:return cu(e);case`stacks`:return uu(e);case`internet_computer`:return fu(e);case`casper`:return mu(e);case`sui`:return gu(e);case`aleo`:return vu(e);default:return e}}var xu=Y([`send`,`optIn`,`claimReward`,`optOut`]),Su=Z.extend({family:X(Q.enum.algorand),mode:xu,fees:H().optional(),assetId:H().optional(),memo:H().optional()}),Cu=Y([`send`]),wu=Z.extend({family:X(Q.enum.aptos),mode:Cu,fees:H().optional()}),Tu=Z.extend({family:X(Q.enum.bitcoin),feePerByte:H().optional(),opReturnDataHex:H().max(160).optional(),changeAddress:H().optional()}),Eu=Y([`send`,`lock`,`unlock`,`withdraw`,`vote`,`revoke`,`activate`,`register`]),Du=Z.extend({family:X(Q.enum.celo),fees:H().optional().nullable(),mode:Eu,index:W().optional().nullable()}),Ou=Y([`send`,`delegate`,`undelegate`,`redelegate`,`claimReward`,`claimRewardCompound`]),ku=q({address:H(),amount:H()}),Au=Z.extend({family:X(Q.enum.cosmos),mode:Ou,fees:H().optional(),gas:H().optional(),memo:H().optional(),sourceValidator:H().optional(),validators:K(ku).optional()}),ju=Z.extend({family:X(Q.enum.crypto_org),mode:H(),fees:H().optional()}),Mu=Z.extend({family:X(Q.enum.ethereum),nonce:W().optional(),data:H().optional(),gasPrice:H().optional(),gasLimit:H().optional(),maxPriorityFeePerGas:H().optional(),maxFeePerGas:H().optional(),sponsored:Ho().optional()}),Nu=Z.extend({family:X(Q.enum.near),mode:H(),fees:H().optional()}),Pu=Z.extend({family:X(Q.enum.neo)}),Fu=Y([`send`,`bond`,`unbond`,`rebond`,`withdrawUnbonded`,`setController`,`nominate`,`chill`,`claimReward`]),Iu=Y([`Staked`,`Stash`,`Controller`,`Account`,`None`]),Lu=Z.extend({family:X(Q.enum.polkadot),mode:Fu,fee:H().optional(),era:W().optional(),validators:K(H()).optional(),rewardDestination:Iu.optional(),numOfSlashingSpans:W().optional()}),Ru=Z.extend({family:X(Q.enum.ripple),fee:H().optional(),tag:W()}),zu=Z.extend({family:X(Q.enum.solana),model:H(),raw:ms(H())}),Bu=Y([`MEMO_TEXT`,`MEMO_ID`,`MEMO_HASH`,`MEMO_RETURN`]),Vu=Z.extend({family:X(Q.enum.stellar),fees:H().optional(),memoType:Bu.optional(),memoValue:H().optional()}),Hu=Y([`send`,`delegate`,`undelegate`]),Uu=Z.extend({family:X(Q.enum.tezos),mode:Hu,fees:H().optional(),gasLimit:H().optional()}),Wu=q({isEncrypted:Ho(),text:H()}),Gu=q({type:X(`jetton-transfer`),queryId:J([H(),G()]),amount:H(),destination:H(),responseDestination:H(),customPayload:J([H(),G()]),forwardAmount:H(),forwardPayload:J([H(),G()]),knownJetton:J([q({jettonId:W(),workchain:W()}),G()])}),Ku=q({type:X(`nft-transfer`),queryId:J([H(),G()]),newOwner:H(),responseDestination:H(),customPayload:J([H(),G()]),forwardAmount:H(),forwardPayload:J([H(),G()])}),qu=J([q({type:X(`comment`),text:H()}),Gu,Ku,q({type:X(`unsafe`),message:H()}),q({type:X(`jetton-burn`),queryId:J([H(),G()]),amount:H(),responseDestination:H(),customPayload:J([H(),G()])}),q({type:X(`add-whitelist`),queryId:J([H(),G()]),address:H()}),q({type:X(`single-nominator-withdraw`),queryId:J([H(),G()]),amount:H()}),q({type:X(`single-nominator-change-validator`),queryId:J([H(),G()]),address:H()}),q({type:X(`tonstakers-deposit`),queryId:J([H(),G()]),appId:J([H(),G()])}),q({type:X(`vote-for-proposal`),queryId:J([H(),G()]),votingAddress:H(),expirationDate:W(),vote:Ho(),needConfirmation:Ho()}),q({type:X(`change-dns-record`),queryId:J([H(),G()]),record:J([q({type:X(`wallet`),value:J([q({address:H(),capabilities:J([q({isWallet:Ho()}),G()])}),G()])}),q({type:X(`unknown`),key:H(),value:J([H(),G()])})])}),q({type:X(`token-bridge-pay-swap`),queryId:J([H(),G()]),swapId:H()}),q({type:X(`tonwhales-pool-deposit`),queryId:H(),gasLimit:H()}),q({type:X(`tonwhales-pool-withdraw`),queryId:H(),gasLimit:H(),amount:H()}),q({type:X(`vesting-send-msg-comment`),queryId:J([H(),G()]),sendMode:W(),value:H(),destination:H(),text:H()})]),Ju=Z.extend({family:X(Q.enum.ton),fees:H(),comment:Wu,payload:qu.optional()}),Yu=Y([`send`,`freeze`,`unfreeze`,`vote`,`claimReward`,`withdrawExpireUnfreeze`,`unDelegateResource`,`legacyUnfreeze`]),Xu=Y([`BANDWIDTH`,`ENERGY`]),Zu=q({address:H(),voteCount:W()}),Qu=Z.extend({family:X(Q.enum.tron),mode:Yu,resource:Xu.optional(),duration:W().optional(),votes:K(Zu).default([])}),$u=Z.extend({family:X(Q.enum.hedera),memo:H().max(100).optional()}),ed=Z.extend({family:X(Q.enum.kaspa),customFeeRate:H().optional()}),td=Z.extend({data:H().optional(),family:X(Q.enum.filecoin),gasLimit:W(),gasFeeCap:H(),gasPremium:H(),method:W(),nonce:W(),params:H().optional(),version:W()});Y([`send`,`delegate`,`reDelegateRewards`,`unDelegate`,`claimRewards`,`withdraw`]);var nd=Z.extend({family:X(Q.enum.elrond),mode:J([X(`send`),X(`delegate`),X(`reDelegateRewards`),X(`unDelegate`),X(`claimRewards`),X(`withdraw`)]),fees:H().optional(),data:H().optional(),gasLimit:W()}),rd=Z.extend({family:X(Q.enum.cardano),fees:H().optional(),mode:H(),memo:H().optional()}),id=q({to:H().nullable(),value:J([H(),W()]),data:H(),comment:H().optional(),abi:H().optional()}),ad=q({chainTag:W(),blockRef:H(),expiration:W(),clauses:K(id),gasPriceCoef:W().optional(),gas:J([H(),W()]),dependsOn:H().nullable(),nonce:J([H(),W()]),maxFeePerGas:J([H(),W()]).optional(),maxPriorityFeePerGas:J([H(),W()]).optional(),reserved:q({features:W().optional(),unused:K(qo()).optional()}).optional()}),od=Z.extend({family:X(Q.enum.vechain),estimatedFees:H(),body:ad}),sd=Z.extend({family:X(Q.enum.stacks),fee:H().optional(),nonce:H().optional(),memo:H().optional(),network:H(),anchorMode:W()}),cd=Z.extend({family:X(Q.enum.internet_computer),fees:H(),memo:H().optional()}),ld=Z.extend({family:X(Q.enum.casper),fees:H(),transferId:H().optional()}),ud=Z.extend({family:X(Q.enum.sui),mode:H(),fees:H().optional()}),dd=Y([`transfer_public`]),fd=is(`family`,[Su,wu,Tu,Du,Au,ju,Mu,$u,ed,td,Nu,Pu,Lu,Ru,Vu,Uu,Ju,Qu,nd,rd,zu,od,sd,cd,ld,ud,Z.extend({family:X(Q.enum.aleo),mode:dd,fees:H()})]),pd=class{prefix=``;constructor(e){this.prefix=e?`[${e}] `:``}log(e,...t){}warn(e,...t){}debug(e,...t){}error(e,...t){}},md=new pd(`WindowMessage`),hd=class{target;logger;_onMessage;constructor(e=window,t=md){this.target=e,this.logger=t}connect=()=>{this.target.addEventListener(`message`,this._onMessageEvent,!1),this.target.document?.addEventListener(`message`,this._onMessageEvent,!1),this.logger.debug(`event listeners registered`)};disconnect=()=>{this.target.removeEventListener(`message`,this._onMessageEvent,!1),this.target.document?.removeEventListener(`message`,this._onMessageEvent,!1),this.logger.debug(`event listeners unregistered`)};_onMessageEvent=e=>{if(this._onMessage){if(this.logger.debug(`received message event`,e),e.data&&typeof e.data==`string`)try{let t=e.data;Date.now()>0?(this.logger.log(`received message`,t),this._onMessage(t)):this.logger.debug(`not a wallet API message`)}catch(e){this.logger.warn(`parse error`),e instanceof Error&&this._onMessage(e.message)}else this.logger.debug(`ignoring message same origin`)}else this.logger.debug(`no handler registered`)};set onMessage(e){this._onMessage=e}get onMessage(){return this._onMessage}send=e=>{try{this.target.ReactNativeWebView?(this.logger.log(`sending message (ReactNativeWebview)`,e),this.target.ReactNativeWebView.postMessage(e)):this.target.ElectronWebview?(this.logger.log(`sending message (ElectronWebview)`,e),this.target.ElectronWebview.postMessage(e)):(this.logger.log(`sending message`,e),this.target.top?.postMessage(e,`*`))}catch(e){throw this.logger.error(`unexpected error on send`,e),e}}},gd;(function(e){e.Slow=`slow`,e.Medium=`medium`,e.Fast=`fast`})(gd||={});var _d;(function(e){e.Blue=`blue`,e.NanoS=`nanoS`,e.NanoX=`nanoX`})(_d||={});var vd;(function(e){e[e.SWAP=0]=`SWAP`,e[e.SELL=1]=`SELL`,e[e.FUND=2]=`FUND`})(vd||={});var yd=Y([`NOT_IMPLEMENTED_BY_WALLET`,`ACCOUNT_NOT_FOUND`,`CURRENCY_NOT_FOUND`,`PERMISSION_DENIED`,`UNKNOWN_ERROR`,`UNAUTHORIZED_STORE`]),bd=q({code:X(yd.enum.NOT_IMPLEMENTED_BY_WALLET),message:H(),data:q({methodId:H()})}),xd=q({code:X(yd.enum.ACCOUNT_NOT_FOUND),message:H(),data:q({accountId:H()})}),Sd=q({code:X(yd.enum.CURRENCY_NOT_FOUND),message:H(),data:q({currencyId:H()})}),Cd=q({code:X(yd.enum.PERMISSION_DENIED),message:H(),data:q({methodId:H()})}),wd=q({name:H().optional(),message:H().optional(),stack:H().optional(),cause:Yo().optional(),code:H().optional()}),Td=is(`code`,[bd,xd,Sd,Cd,q({code:X(yd.enum.UNKNOWN_ERROR),message:H(),data:wd.passthrough()})]);function Ed(e){return{code:`UNKNOWN_ERROR`,message:`an unhandled error was thrown`,data:e}}var Dd=class extends Error{errorData;constructor(e){super(e.message),this.errorData=e}getCode(){return this.errorData.code}getData(){return this.errorData}};function Od(e){if(e instanceof Error){let t={name:e.name,message:e.message,stack:e.stack},{code:n,cause:r}=e;return typeof n==`string`&&(t.code=n),r!==void 0&&(t.cause=r),t}return typeof e==`string`?{message:e}:typeof e==`object`&&e?e:{}}function kd(e){if(!e||e.message===void 0&&e.name===void 0)return;let t=Error(e.message);return e.name&&(t.name=e.name),e.stack&&(t.stack=e.stack),e.code!==void 0&&(t.code=e.code),e.cause!==void 0&&(t.cause=e.cause),t}var Ad=class extends Error{err;constructor(e){super(e.message),this.err=e}getCode(){return this.err.code}getData(){return this.err.data}},jd;(function(e){e[e.PARSE_ERROR=-32700]=`PARSE_ERROR`,e[e.INVALID_REQUEST=-32600]=`INVALID_REQUEST`,e[e.METHOD_NOT_FOUND=-32601]=`METHOD_NOT_FOUND`,e[e.INVALID_PARAMS=-32602]=`INVALID_PARAMS`,e[e.INTERNAL_ERROR=-32603]=`INTERNAL_ERROR`,e[e.SERVER_ERROR=-32e3]=`SERVER_ERROR`})(jd||={});var Md=J([H(),W(),G()]),Nd=q({jsonrpc:X(`2.0`),method:H(),params:qo(),id:Md.optional()}).strict(),Pd=q({code:W(),message:H(),data:qo().optional()}).strict(),Fd=q({jsonrpc:X(`2.0`),id:Md,result:q({}).passthrough().optional()}).strict(),Id=J([Nd,J([q({jsonrpc:X(`2.0`),id:Md,error:Pd}).strict(),Fd])]);function Ld(e){try{let t=JSON.parse(e);return Id.parse(t)}catch(e){throw e instanceof SyntaxError?new Ad({code:jd.PARSE_ERROR,message:`parse error`}):e instanceof eo?new Ad({code:jd.INVALID_REQUEST,message:`invalid request`}):e}}function Rd(e){return{jsonrpc:`2.0`,...e}}var zd=class{transport;requestHandlers;ongoingRequests={};constructor(e,t){this.transport=e,this.requestHandlers=t,this.transport.onMessage=e=>{this.handleMessage(e)}}_request(e){return new Promise((t,n)=>{if(!e.id){n(Error(`requests need to have an id`));return}let r=e=>{if(`error`in e){if(e.error.code===jd.SERVER_ERROR){let t=Td.parse(e.error.data);if(t.code===`UNKNOWN_ERROR`){n(kd(t.data));return}n(new Dd(t));return}n(new Ad(e.error));return}t(e.result)};this.ongoingRequests[e.id]=r,this.transport.send(JSON.stringify(e))})}_notify(e){this.transport.send(JSON.stringify(e))}request(e,t){let n=crypto.randomUUID();return this._request({id:n,jsonrpc:`2.0`,method:e,params:t})}notify(e,t){return this._notify({jsonrpc:`2.0`,method:e,params:t})}async handleRpcRequest(e){try{let t=await this.onRequest(e);if(e.id){let n=Rd({id:e.id,result:t});this.transport.send(JSON.stringify(n))}}catch(e){throw e instanceof eo?new Ad({code:jd.INVALID_PARAMS,message:e.message,data:e.flatten()}):e instanceof Dd?new Ad({code:jd.SERVER_ERROR,message:`unexpected server error`,data:e.getData()}):e instanceof Ad?e:new Ad({code:jd.SERVER_ERROR,message:`unexpected server error`,data:Ed(Od(e))})}}async handleMessage(e){let t=!1,n;try{let r=Ld(e);n=r.id,`method`in r?await this.handleRpcRequest(r):(t=!0,this.handleRpcResponse(r))}catch(e){if(t)throw e;if(e instanceof Ad){let t=Rd({id:n??null,error:{code:e.getCode(),message:e.message,data:e.getData()}});this.transport.send(JSON.stringify(t));return}throw e}}handleRpcResponse(e){if(!e.id)return;let t=this.ongoingRequests[e.id];if(!t)throw Error(`no ongoingRequest ${e.id}`);t(e)}},Bd={params:q({accountId:H(),derivationPath:H().optional()}),result:q({publicKey:H()})},Vd={params:q({currencyIds:K(H()).optional()}).optional(),result:q({rawAccounts:K(Fs)})},Hd={params:q({accountId:H(),tokenCurrency:H().optional()}),result:q({address:H()})},Ud={params:q({currencyIds:K(H()).optional(),showAccountFilter:Ho().optional(),drawerConfiguration:q({assets:q({filter:H().optional(),leftElement:H().optional(),rightElement:H().optional()}).optional(),networks:q({leftElement:H().optional(),rightElement:H().optional()}).optional()}).optional(),useCase:H().optional(),uiUseCase:H().optional()}),result:q({rawAccount:Fs})},Wd={params:q({accountId:H(),derivationPath:H().optional()}),result:q({address:H()})},Gd={params:q({accountId:H(),intentions:K(Y([`payment`,`ordinal`])).optional()}),result:q({addresses:K(q({address:H(),publicKey:H().optional(),path:H().optional(),intention:H().optional()}))})},Kd={params:q({accountId:H(),derivationPath:H().optional()}),result:q({publicKey:H()})},qd={params:q({accountId:H()}),result:q({xPub:H()})},Jd={params:q({accountId:H(),psbt:H(),broadcast:Ho().optional()}),result:q({psbtSigned:H(),txHash:H().optional()})},Yd={params:q({currencyIds:K(H()).optional()}).optional(),result:q({currencies:K(zs)})},Xd=Y([`blue`,`nanoS`,`nanoSP`,`nanoX`,`stax`,`europa`,`apex`]),Zd={params:q({transportId:H()}),result:q({transportId:H()})},Qd={params:q({apduHex:H(),transportId:H()}),result:q({responseHex:H()})},$d={params:q({deviceId:H()}),result:q({transportId:H()})},ef={params:q({appName:H().optional(),allowManager:Ho().optional(),appVersionRange:H().optional(),firmwareVersionRange:H().optional(),seeded:Ho().optional(),devices:Xd.array().nonempty().optional()}),result:q({deviceId:H()})},tf={params:q({appName:H().optional(),allowManager:Ho().optional(),appVersionRange:H().optional(),firmwareVersionRange:H().optional(),seeded:Ho().optional(),devices:Xd.array().nonempty().optional()}),result:q({transportId:H()})},nf=Y([`SLOW`,`MEDIUM`,`FAST`,`CUSTOM`]),rf=q({provider:H(),fromAccountId:H(),rawTransaction:fd,hexBinaryPayload:H(),hexSignature:H(),feeStrategy:nf,tokenCurrency:H().optional()}),af={params:is(`exchangeType`,[rf.extend({exchangeType:X(`FUND`)}),rf.extend({exchangeType:X(`SELL`)}),rf.extend({exchangeType:X(`SWAP`),toAccountId:H(),swapId:H(),rate:W()})]),result:q({transactionHash:H()})},of={params:q({exchangeType:Y([`SWAP`,`SELL`,`FUND`,`SWAP_NG`,`SELL_NG`,`FUND_NG`])}),result:q({transactionId:H()})},sf=q({hwAppId:H().optional(),dependencies:K(H()).optional()}),cf={params:q({accountId:H(),hexMessage:H(),options:sf.optional(),meta:cs(H(),Yo()).optional()}),result:q({hexSignedMessage:H()})},lf={params:q({key:H().min(1),storeId:H().min(1).optional()}),result:q({value:H().optional()})},uf={params:q({key:H(),value:H(),storeId:H().optional()}),result:$o().optional()},df=q({hwAppId:H().optional(),dependencies:K(H()).optional()}),ff={params:q({accountId:H(),rawTransaction:fd,options:df.optional(),meta:cs(H(),Yo()).optional(),tokenCurrency:H().optional()}),result:q({signedTransactionHex:H()})},pf=q({hwAppId:H().optional(),dependencies:K(H()).optional()}),mf={params:q({accountId:H(),rawTransaction:fd,options:pf.optional(),meta:cs(H(),Yo()).optional(),tokenCurrency:H().optional()}),result:q({transactionHash:H()})},hf=q({hwAppId:H().optional(),dependencies:K(H()).optional()}),gf={params:q({accountId:H(),rawTransaction:H(),broadcast:Ho().optional(),options:hf.optional(),meta:cs(H(),Yo()).optional()}),result:q({signedTransactionHex:H(),transactionHash:H().optional()})},_f={params:q({}),result:q({methodIds:K(H())})},vf={params:q({}),result:q({tracking:Ho(),wallet:q({name:H(),version:H()})})},yf={params:q({}),result:q({userId:H()})};Y([`account.getPublicKey`,`account.list`,`account.receive`,`account.request`,`currency.list`,`device.close`,`device.exchange`,`device.transport`,`message.sign`,`transaction.sign`,`transaction.signRaw`,`transaction.signAndBroadcast`,`wallet.capabilities`,`wallet.info`,`wallet.userId`]),k();var bf=class e extends ge{walletApi;transportId;constructor(e,t){super(),this.transportId=t,this.walletApi=e}static isSupported=()=>Promise.resolve(!0);static list=()=>Promise.resolve([]);static listen=e=>({unsubscribe:()=>{}});static open({walletApi:t,transportId:n}){return Promise.resolve(new e(t,n))}async exchange(e){let t=e.toString(`hex`),n=await this.walletApi.request(`device.exchange`,{transportId:this.transportId,apduHex:t}),r=Qd.result.parse(n);return A.from(r.responseHex,`hex`)}setScrambleKey(){}async close(){let e=await this.walletApi.request(`device.close`,{transportId:this.transportId});Zd.result.parse(e)}},xf=class{client;constructor(e){this.client=e}async list(e){let t=await this.client.request(`account.list`,{currencyIds:e?.currencyIds});return Vd.result.parse(t).rawAccounts.map(Re)}async request(e){let t=await this.client.request(`account.request`,{currencyIds:e?.currencyIds,showAccountFilter:e?.showAccountFilter,drawerConfiguration:e?.drawerConfiguration,useCase:e?.useCase,uiUseCase:e?.uiUseCase});return Re(Ud.result.parse(t).rawAccount)}async receive(e){let t=await this.client.request(`account.receive`,{accountId:e});return Hd.result.parse(t).address}async getPublicKey(e,t){let n=await this.client.request(`account.getPublicKey`,{accountId:e,derivationPath:t});return Bd.result.parse(n).publicKey}},Sf=class{client;constructor(e){this.client=e}async getAddress(e,t){let n=await this.client.request(`bitcoin.getAddress`,{accountId:e,derivationPath:t});return Wd.result.parse(n).address}async getAddresses(e,t){let n=await this.client.request(`bitcoin.getAddresses`,{accountId:e,intentions:t});return Gd.result.parse(n).addresses}async getPublicKey(e,t){let n=await this.client.request(`bitcoin.getPublicKey`,{accountId:e,derivationPath:t});return Kd.result.parse(n).publicKey}async getXPub(e){let t=await this.client.request(`bitcoin.getXPub`,{accountId:e});return qd.result.parse(t).xPub}async signPsbt(e,t,n){let r=await this.client.request(`bitcoin.signPsbt`,{accountId:e,psbt:t,broadcast:n}),{psbtSigned:i,txHash:a}=Jd.result.parse(r);return{psbtSigned:i,txHash:a}}},Cf=class{client;constructor(e){this.client=e}async list(e){let t=await this.client.request(`currency.list`,{currencyIds:e?.currencyIds});return Yd.result.parse(t).currencies}},wf=class{client;constructor(e){this.client=e}async transport(e){let t=await this.client.request(`device.transport`,e),n=tf.result.parse(t);return bf.open({walletApi:this.client,transportId:n.transportId})}async open(e){let t=await this.client.request(`device.open`,e),n=$d.result.parse(t);return bf.open({walletApi:this.client,transportId:n.transportId})}async select(e){let t=await this.client.request(`device.select`,e);return ef.result.parse(t)}},Tf=class{client;constructor(e){this.client=e}async start(e){let t=await this.client.request(`exchange.start`,{exchangeType:e});return of.result.parse(t).transactionId}async completeSwap({provider:e,fromAccountId:t,toAccountId:n,swapId:r,rate:i,transaction:a,binaryPayload:o,signature:s,feeStrategy:c,tokenCurrency:l}){let u=await this.client.request(`exchange.complete`,{exchangeType:`SWAP`,provider:e,fromAccountId:t,toAccountId:n,swapId:r,rate:i,rawTransaction:yu(a),hexBinaryPayload:o.toString(`hex`),hexSignature:s.toString(`hex`),feeStrategy:c,tokenCurrency:l});return af.result.parse(u).transactionHash}async completeSell({provider:e,fromAccountId:t,transaction:n,binaryPayload:r,signature:i,feeStrategy:a}){let o=await this.client.request(`exchange.complete`,{exchangeType:`SELL`,provider:e,fromAccountId:t,rawTransaction:yu(n),hexBinaryPayload:r.toString(`hex`),hexSignature:i.toString(`hex`),feeStrategy:a});return af.result.parse(o).transactionHash}async completeFund({provider:e,fromAccountId:t,transaction:n,binaryPayload:r,signature:i,feeStrategy:a,tokenCurrency:o}){let s=await this.client.request(`exchange.complete`,{exchangeType:`FUND`,provider:e,fromAccountId:t,rawTransaction:yu(n),hexBinaryPayload:r.toString(`hex`),hexSignature:i.toString(`hex`),feeStrategy:a,tokenCurrency:o});return af.result.parse(s).transactionHash}};k();var Ef=class{client;constructor(e){this.client=e}async sign(e,t,n,r){let i=await this.client.request(`message.sign`,{accountId:e,hexMessage:t.toString(`hex`),options:n,meta:r}),a=cf.result.parse(i);return A.from(a.hexSignedMessage,`hex`)}},Df=class{client;constructor(e){this.client=e}async get(e,t){let n=await this.client.request(`storage.get`,{key:e,storeId:t});return lf.result.parse(n).value}async set(e,t,n){let r=await this.client.request(`storage.set`,{key:e,value:t,storeId:n});return uf.result.parse(r)}};k();var Of=class{client;constructor(e){this.client=e}async sign(e,t,n,r){let i=await this.client.request(`transaction.sign`,{accountId:e,rawTransaction:yu(t),options:n,meta:r}),a=ff.result.parse(i);return A.from(a.signedTransactionHex,`hex`)}async signRaw(e,t,n,r,i){let a=await this.client.request(`transaction.signRaw`,{accountId:e,rawTransaction:t,broadcast:n,options:r,meta:i});return gf.result.parse(a)}async signAndBroadcast(e,t,n,r){let i=await this.client.request(`transaction.signAndBroadcast`,{accountId:e,rawTransaction:yu(t),options:n,meta:r});return mf.result.parse(i).transactionHash}},kf=class{client;constructor(e){this.client=e}async userId(){let e=await this.client.request(`wallet.userId`,{});return yf.result.parse(e).userId}async info(){let e=await this.client.request(`wallet.info`,{});return vf.result.parse(e)}async capabilities(){let e=await this.client.request(`wallet.capabilities`,{});return _f.result.parse(e).methodIds}},Af=new pd(`Wallet-API-Client`),jf={"event.account.updated":e=>Promise.resolve()},Mf=class extends zd{account;bitcoin;currency;device;message;storage;transaction;wallet;exchange;custom;logger;constructor(e,t=Af,n,r={}){super(e,{...jf,...r}),this.logger=t,this.account=new xf(this),this.bitcoin=new Sf(this),this.currency=new Cf(this),this.device=new wf(this),this.message=new Ef(this),this.storage=new Df(this),this.transaction=new Of(this),this.wallet=new kf(this),this.exchange=new Tf(this),this.custom=n?n(this):{}}setEventHandlers(e){this.requestHandlers={...jf,...e}}onRequest(e){this.logger.log(e.method);let t=this.requestHandlers[e.method];if(!t)throw new Ad({code:jd.METHOD_NOT_FOUND,message:`method not found`});return t(e)}},Nf={near:{"*":{currencyId:`near`,family:`near`,network:`near`}},tezos:{"*":{currencyId:`tezos`,family:`tezos`,network:`tezos`}},solana:{"*":{currencyId:`solana`,family:`solana`,network:`solana`}},tron:{"*":{currencyId:`tron`,family:`tron`,network:`tron`}},ton:{"*":{currencyId:`ton`,family:`ton`,network:`ton`}},polkadot:{"*":{currencyId:`assethub_polkadot`,family:`polkadot`,network:`polkadot`}},celo:{"*":{currencyId:`celo`,family:`celo`,network:`celo`}},ethereum:{ethereum:{currencyId:`ethereum`,family:`ethereum`,network:`ethereum`},polygon:{currencyId:`polygon`,family:`ethereum`,network:`polygon`},arbitrum:{currencyId:`arbitrum`,family:`ethereum`,network:`arbitrum`},optimism:{currencyId:`optimism`,family:`ethereum`,network:`optimism`},avalanche_c_chain:{currencyId:`avalanche_c_chain`,family:`ethereum`,network:`avalanche-c`},ethereum_hoodi:{currencyId:`ethereum_hoodi`,family:`ethereum`,network:`ethereum-hoodi`},bsc:{currencyId:`bsc`,family:`ethereum`,network:`binance`}},cosmos:{cosmos:{currencyId:`cosmos`,family:`cosmos`,network:`cosmos`},crypto_org:{currencyId:`crypto_org`,family:`cosmos`,network:`cronos`},osmo:{currencyId:`osmo`,family:`cosmos`,network:`osmosis`},coreum:{currencyId:`coreum`,family:`cosmos`,network:`coreum`},axelar:{currencyId:`axelar`,family:`cosmos`,network:`axelar`},stargaze:{currencyId:`stargaze`,family:`cosmos`,network:`stargaze`},secret_network:{currencyId:`secret_network`,family:`cosmos`,network:`secret`},umee:{currencyId:`umee`,family:`cosmos`,network:`umee`},desmos:{currencyId:`desmos`,family:`cosmos`,network:`desmos`},onomy:{currencyId:`onomy`,family:`cosmos`,network:`onomy`},quicksilver:{currencyId:`quicksilver`,family:`cosmos`,network:`quicksilver`},persistence:{currencyId:`persistence`,family:`cosmos`,network:`persistence`},dydx:{currencyId:`dydx`,family:`cosmos`,network:`dydx`},injective:{currencyId:`injective`,family:`cosmos`,network:`injective`},sei:{currencyId:`sei`,family:`cosmos`,network:`sei`},mantra:{currencyId:`mantra`,family:`cosmos`,network:`mantra`}}},Pf=new Map([[`polkadot`,1],[`avalanche-c`,2],[`tron`,3],[`binance`,4],[`cronos`,5],[`polygon`,6]]);k();var Ff=be(),If=O(te({amount:D(O(y)),gasLimit:D(O(y)),token:D(O(te({decimals:E})))})),Lf=x(If),Rf=x(C),zf=new Set([`polygon`,`optimism`,`arbitrum`,`avalanche-c`,`core`]),Bf=(e,t)=>ee(e)(t).pipe(i(e=>e.message)),Vf=class extends b()(`LedgerTransactionPreparationError`,{message:y}){},Hf=e=>new Vf({message:e}),Uf=l(function*(){let e=yield*p(c({try:()=>import(`./polkadot-ledger-transaction-CSI9csNM.js`).then(e=>e.buildPolkadotLedgerTransaction),catch:()=>Hf(`Could not load Polkadot transaction support`)}));return({family:t,network:n,tx:r,txMeta:i})=>S(Rf)(r).pipe(m(()=>Hf(`Failed to parse tx`)),u(r=>n===`polkadot`?i?Wf({loadPolkadotBuilder:e,payload:r,txMeta:i}):s(Hf(`Missing classic transaction metadata`)):d(Gf({family:t,network:n,payload:r,txMeta:i})).pipe(m(Hf))))}),Wf=({loadPolkadotBuilder:e,payload:t,txMeta:n})=>d(Bf(se,t)).pipe(m(Hf),u(t=>e.pipe(u(e=>d(e({fee:ep(Qf(n.gasEstimate)).toString(),payload:t,txMeta:n})).pipe(m(Hf)))))),Gf=({family:e,network:r,payload:i,txMeta:s})=>{if(me(r))return Bf(e===`borrow`?ce:ae,i).pipe(t(e=>Kf({network:r,tx:e})));if(e===`borrow`)return o(`Unsupported Borrow network`);if(!s)return o(`Missing classic transaction metadata`);switch(r){case`tron`:return Bf(le,i).pipe(a(()=>Jf(s)));case`near`:return Yf(s);case`tezos`:return Xf(s);case`ton`:return Bf(xe,i).pipe(a(e=>Zf(e,s)));default:return pe(r)?qf(s):n(i)}},Kf=({network:e,tx:t})=>{let n={amount:(t.value??0n).toString(),recipient:t.to,family:`ethereum`,...t.nonce===void 0?{}:{nonce:t.nonce},gasLimit:t.gasLimit.toString(),data:A.from(he(t.data)).toString(`hex`)};return t.maxFeePerGas&&t.maxPriorityFeePerGas&&!zf.has(e)?(n.maxFeePerGas=t.maxFeePerGas.toString(),n.maxPriorityFeePerGas=t.maxPriorityFeePerGas.toString()):t.gasPrice&&(n.gasPrice=t.gasPrice.toString()),n},qf=e=>{let t=e.rawArguments?.validatorAddress,r=tp(e.txType),i=$f(e)??(np(r)?de():null);return!t||i===null?o(`Missing Cosmos Ledger arguments`):n({family:`cosmos`,mode:r,validators:[{address:t,amount:i.toString()}],amount:i.toString(),recipient:t,memo:`via StakeKit CID-1009`})},Jf=e=>{let r=$f(e),i=e.rawArguments?.tronResource,a=e.rawArguments?.validatorAddress??e.rawArguments?.validatorAddresses?.[0];return(()=>{switch(e.txType){case`FREEZE_BANDWIDTH`:case`FREEZE_ENERGY`:return!r||!i?o(`Missing Tron freeze arguments`):n({amount:r.toString(),recipient:e.address??``,family:`tron`,mode:`freeze`,resource:i});case`VOTE`:{let n=e.rawArguments?.validatorAddresses;return!r||!n?.length?o(`Missing Tron vote arguments`):ap({txMeta:e,validatorAddresses:n}).pipe(t(t=>({amount:r.toString(),recipient:e.address??``,family:`tron`,mode:`vote`,votes:t})))}case`UNDELEGATE_BANDWIDTH`:case`UNDELEGATE_ENERGY`:return!r||!i||!a?o(`Missing Tron undelegate arguments`):n({amount:r.toString(),recipient:String(a),family:`tron`,mode:`unDelegateResource`,resource:i});case`UNFREEZE_LEGACY_BANDWIDTH`:case`UNFREEZE_LEGACY_ENERGY`:return n({amount:`0`,recipient:``,family:`tron`,mode:`legacyUnfreeze`,resource:i});case`UNFREEZE_BANDWIDTH`:case`UNFREEZE_ENERGY`:return!r||!i?o(`Missing Tron unfreeze arguments`):n({amount:r.toString(),recipient:e.address??``,family:`tron`,mode:`unfreeze`,resource:i});case`CLAIM_REWARDS`:return n({amount:`0`,recipient:e.address??``,family:`tron`,mode:`claimReward`});default:return o(`Unsupported Tron Ledger transaction type: ${e.txType}`)}})().pipe(t(e=>({...e,votes:e.votes??[]})))},Yf=e=>{let t=e.rawArguments?.validatorAddress,r=$f(e);return!t||!r?o(`Missing Near Ledger arguments`):n({amount:r.toString(),recipient:t,family:`near`,mode:rp(e.txType),fees:ep(Qf(e.gasEstimate)).toString()})},Xf=e=>{let t=Qf(e.gasEstimate),r=e.txType===`UNSTAKE`,i=r?``:e.rawArguments?.validatorAddress;return!r&&!i?o(`Missing Tezos Ledger validator`):n({family:`tezos`,mode:r?`undelegate`:`delegate`,amount:`0`,recipient:i??``,fees:ep(t).toString(),gasLimit:String(t?.gasLimit??0)})},Zf=(e,t)=>{let r=Qf(t.gasEstimate);if(!(`message`in e)){let t=e[0];return t?n({family:`ton`,amount:t.amount,recipient:t.address,fees:ep(r).toString(),comment:{text:t.payload,isEncrypted:!1}}):o(`Unsupported Ton Ledger transaction payload`)}try{let t=(0,Ff.loadMessageRelaxed)(Ff.Cell.fromBase64(e.message).beginParse()),i=t.info;return n({family:`ton`,amount:i.value.coins.toString(),recipient:i.dest.toString(),fees:ep(r).toString(),comment:{text:t.body.toBoc().toString(`base64`),isEncrypted:!1}})}catch{return o(`Unsupported Ton Ledger transaction payload`)}},Qf=e=>e?w(Lf)(e).pipe(g):null,$f=e=>{if(e.amountRaw)return ie(e.amountRaw);let t=e.rawArguments?.amount??e.amount,n=e.inputToken?.decimals;return!t||n===void 0?null:ie(t).multipliedBy(ie(10).pow(n))},ep=e=>!e?.amount||!e.token?de():ie(e.amount).multipliedBy(ie(10).pow(e.token.decimals)),tp=e=>{switch(e){case`STAKE`:return`delegate`;case`UNSTAKE`:return`undelegate`;case`RESTAKE`:case`REBOND`:return`redelegate`;case`RESTAKE_REWARDS`:return`claimRewardCompound`;case`CLAIM_REWARDS`:return`claimReward`;default:return`delegate`}},np=e=>e===`claimReward`||e===`claimRewardCompound`,rp=e=>{switch(e){case`STAKE`:return`stake`;case`UNSTAKE`:return`unstake`;case`WITHDRAW`:case`CLAIM_UNSTAKED`:return`withdraw`;default:return`stake`}},ip=e=>{let t=e.rawArguments?.amount??e.amount;if(t)return ie(t);let n=e.inputToken?.decimals;return!e.amountRaw||n===void 0?null:ie(e.amountRaw).dividedBy(ie(10).pow(n))},ap=({txMeta:e,validatorAddresses:t})=>{let r=ip(e);if(!r)return o(`Missing Tron vote arguments`);let i=t.length,a=r.dividedToIntegerBy(i),s=r.modulo(i).integerValue(re.ROUND_FLOOR);if(!a.isFinite()||!s.isFinite()||a.isNegative()||s.isNegative())return o(`Invalid Tron vote count`);if(a.plus(1).gt(2**53-1))return o(`Tron vote count exceeds Ledger limits`);let c=ne(s);if(c==null)return o(`Invalid Tron vote count`);let l=t.map((e,t)=>{let n=ne(a.plus(+(t<c)));return n==null?null:{address:e,voteCount:n}});return l.some(e=>e==null)?o(`Invalid Tron vote count`):n(l.filter(e=>e!=null))},op=({accounts:e,ledgerCurrencies:t,enabledChainsMap:n})=>{let{accountsFamilies:r,accountsCurrencies:i}=e.reduce((e,n)=>{let r=t.get(n.currency);return r&&(e.accountsFamilies.add(r),e.accountsCurrencies.add(n.currency)),e},{accountsFamilies:new Set,accountsCurrencies:new Set}),a=T(Nf).reduce((e,[t,a])=>{let o=Object.keys(a).reduce((e,t)=>{let o=a[t];if(!o)return e;let s=n.evm[o.network]?.wagmiChain||n.cosmos[o.network]?.wagmiChain||n.misc[o.network]?.wagmiChain||n.substrate[o.network]?.wagmiChain;return s?r.has(o.family)&&(t===`*`||i.has(o.currencyId))?{...e,[t]:{...o,chain:s,enabled:!0}}:Pf.has(o.network)?{...e,[t]:{...o,chain:s,enabled:!1}}:e:e},{});return{...e,[t]:o}},{});return Object.keys(a).reduce((e,t)=>{let n=a[t],r=Object.keys(n).reduce((e,t)=>{let r=n[t];return r&&e.set(t,r),e},new Map);return e.set(t,r),e},new Map)},sp=e=>c({try:()=>e.currency.list({currencyIds:Object.values(Nf).flatMap(e=>Object.values(e).map(e=>e.currencyId))}),catch:e=>new _e({cause:e,message:`could not get currencies`,operation:`ledger-list-currencies`})}).pipe(f(e=>e.reduce((e,t)=>(t.type===`CryptoCurrency`?e.cryptoCurrency.set(t.id,t.family):e.tokenCurrency.push(t),e),{cryptoCurrency:new Map,tokenCurrency:[]})),f(e=>(e.tokenCurrency.forEach(t=>{let n=e.cryptoCurrency.get(t.parent);n&&e.cryptoCurrency.set(t.id,n)}),e.cryptoCurrency))),cp=({walletDetailsParams:e,enabledChainsMap:t,isLedgerDappBrowser:i,prepareTransaction:a,queryParams:s,runWalletEffect:u})=>h(d=>{let p=ve([]),m=ve([]),h=ve(void 0),g=h.changes.pipe(v(e=>e?.parentAccountId??e?.id)),y=[],b=ve([]),x=null,S=null,C=null,w=new hd;w.connect();let T=new Mf(w),ee=async e=>{d.emitter.emit(`message`,{type:`connecting`});let n=await u(sp(T)),i=await u(c({try:()=>T.account.list(),catch:e=>new _e({cause:e,message:`could not get accounts`,operation:`ledger-list-accounts`})}).pipe(f(e=>({accounts:e,accountsMap:new Map(e.map(e=>[e.id,e]))})),f(e=>e.accounts.map(t=>t.parentAccountId?(()=>{let n=e.accountsMap.get(t.parentAccountId);return n?{...t,currency:n.currency}:t})():t))));y=i.filter(e=>!e.parentAccountId);let a=op({ledgerCurrencies:n,accounts:y,enabledChainsMap:t});S=new Map([...a.values()].flatMap(e=>[...e.values()].map(e=>[e.chain.id,e.currencyId]))),C=a;let{enabled:o,disabled:l}=[...a.values()].reduce((e,t)=>(t.forEach(t=>{t.enabled?e.enabled.push(t.chain):e.disabled.push(t.chain)}),e),{enabled:[],disabled:[]});p.set([...o,...l]),m.set(l);let g=i.reduce((e,t)=>{let r=n.get(t.currency);if(!r)return e;let i=a.get(r);if(!r||!i)return e;let o=i.get(`*`)||i.get(t.currency);return o&&e.push({account:t,chainItem:o}),e},[]).sort((e,t)=>(Pf.get(e.chainItem.network)||999)-(Pf.get(t.chainItem.network)||999));if(!g.length){let t=a.get(`ethereum`)?.get(`ethereum`);if(!t)throw Error(`Default chain not found`);return b.set([]),x=t,D([`N/A`]),O(t.chain.id.toString()),_(e?.withCapabilities,[`N/A`],t.chain.id)}let v=s.accountId?s.accountId.startsWith(`js:`)?{type:`address`,address:s.accountId.split(`:`)[3]}:{type:`accountId`,accountId:s.accountId}:null,w=(v?g.find(e=>v.type===`address`?e.account.address===v.address:e.account.id===v.accountId):void 0)??(s.network?g.find(e=>e.chainItem.network===s.network):void 0)??g[0];if(!w)throw Error(`Account not found`);return h.set(w.account),x=w.chainItem,b.set(r(E())),D([w.account.address]),O(x.chain.id.toString()),_(e?.withCapabilities,[w.account.address],x.chain.id)},E=()=>x?n(y.filter(e=>e.currency===x?.currencyId)):o(Error(`Current chain not found`)),D=e=>{e.length===0?d.emitter.emit(`disconnect`):d.emitter.emit(`change`,{accounts:e})},O=e=>{d.emitter.emit(`change`,{chainId:oe(e)})},te=()=>{d.emitter.emit(`disconnect`)},ne=async()=>({}),re=async()=>i,ie=async()=>w.disconnect(),ae=async()=>{let e=x?.chain.id;if(!e)throw Error(`Chain not found`);return e},se=async()=>[h.get()?.address],ce=e=>{h.set(e),D([e.address])},le=e=>l(function*(){let t=S?.get(e.id);if(!t)return yield*new _e({message:`Chain not found`,operation:`ledger-request-account`});let n=yield*c({try:()=>T.account.request({currencyIds:[t]}),catch:e=>new _e({cause:e,message:`could not request account`,operation:`ledger-request-account`})});return y.push(n),p.set([...p.get(),e]),m.set(m.get().filter(t=>t.id!==e.id)),yield*c({try:()=>de({chainId:e.id}),catch:e=>new _e({cause:e,message:`failed to switch to new chain`,operation:`ledger-switch-chain`})})}),de=async({chainId:e})=>{let t=x;if(!t||!C)throw Error(`Chain not found`);let n=[...C.values()].flatMap(e=>[...e.values()]).find(t=>t.chain.id===e);if(!n)throw Error(`Chain not found`);if(t.chain.id!==n.chain.id||!h.get()){x=n;let e=r(E());b.set(e),h.set(e[0])}let i=h.get();if(!i)throw Error(`Account not found`);return O(e.toString()),D([i.address]),n.chain};return{...e,id:ue.id,name:ue.name,type:ue.type,connect:ee,onAccountsChanged:D,onChainChanged:O,onDisconnect:te,getProvider:ne,isAuthorized:re,getChainId:ae,disconnect:ie,switchChain:de,getAccounts:se,switchAccount:ce,requestAndSwitchAccount:le,walletApiClient:T,$accountsOnCurrentChain:b.changes,$filteredChains:p.changes,$currentAccountId:g,$disabledChains:m.changes,noAccountPlaceholder:`N/A`,deserializeTransaction:bu,prepareTransaction:a}}),lp=({enabledChainsMap:e,isLedgerDappBrowser:t,queryParams:n,runWalletEffect:r})=>l(function*(){let i=yield*Uf;return{groupName:`Ledger Live`,wallets:[()=>({id:ue.id,name:ue.name,iconUrl:fe.ledgerLogo,iconBackground:`#fff`,chainGroup:{id:ue.id,title:ue.name,iconUrl:fe.ledgerLogo},hidden:()=>!t,createConnector:a=>cp({walletDetailsParams:a,enabledChainsMap:e,isLedgerDappBrowser:t,prepareTransaction:i,queryParams:n,runWalletEffect:r})})]}});export{lp as ledgerLiveConnector};
65
+ `+n.toString(t+` `)}return r}asSlice(){return this.beginParse()}asBuilder(){return(0,u.beginCell)().storeSlice(this.asSlice())}};e.Cell=d,t=n.inspectSymbol,d.EMPTY=new d})),$=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Builder=e.beginCell=void 0;var t=Ec(),n=Zc(),r=Rc();function i(){return new a}e.beginCell=i;var a=class e{constructor(){this._bits=new t.BitBuilder,this._refs=[]}get bits(){return this._bits.length}get refs(){return this._refs.length}get availableBits(){return 1023-this.bits}get availableRefs(){return 4-this.refs}storeBit(e){return this._bits.writeBit(e),this}storeBits(e){return this._bits.writeBits(e),this}storeBuffer(e,t){if(t!=null&&e.length!==t)throw Error(`Buffer length ${e.length} is not equal to ${t}`);return this._bits.writeBuffer(e),this}storeMaybeBuffer(e,t){return e===null?this.storeBit(0):(this.storeBit(1),this.storeBuffer(e,t)),this}storeUint(e,t){return this._bits.writeUint(e,t),this}storeMaybeUint(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeUint(e,t)),this}storeInt(e,t){return this._bits.writeInt(e,t),this}storeMaybeInt(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeInt(e,t)),this}storeVarUint(e,t){return this._bits.writeVarUint(e,t),this}storeMaybeVarUint(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeVarUint(e,t)),this}storeVarInt(e,t){return this._bits.writeVarInt(e,t),this}storeMaybeVarInt(e,t){return e==null?this.storeBit(0):(this.storeBit(1),this.storeVarInt(e,t)),this}storeCoins(e){return this._bits.writeCoins(e),this}storeMaybeCoins(e){return e==null?this.storeBit(0):(this.storeBit(1),this.storeCoins(e)),this}storeAddress(e){return this._bits.writeAddress(e),this}storeRef(t){if(this._refs.length>=4)throw Error(`Too many references`);if(t instanceof n.Cell)this._refs.push(t);else if(t instanceof e)this._refs.push(t.endCell());else throw Error(`Invalid argument`);return this}storeMaybeRef(e){return e?(this.storeBit(1),this.storeRef(e)):this.storeBit(0),this}storeSlice(e){let t=e.clone();for(t.remainingBits>0&&this.storeBits(t.loadBits(t.remainingBits));t.remainingRefs>0;)this.storeRef(t.loadRef());return this}storeMaybeSlice(e){return e?(this.storeBit(1),this.storeSlice(e)):this.storeBit(0),this}storeBuilder(e){return this.storeSlice(e.endCell().beginParse())}storeMaybeBuilder(e){return e?(this.storeBit(1),this.storeBuilder(e)):this.storeBit(0),this}storeWritable(e){return typeof e==`object`?e.writeTo(this):e(this),this}storeMaybeWritable(e){return e?(this.storeBit(1),this.storeWritable(e)):this.storeBit(0),this}store(e){return this.storeWritable(e),this}storeStringTail(e){return(0,r.writeString)(e,this),this}storeMaybeStringTail(e){return e==null?this.storeBit(0):(this.storeBit(1),(0,r.writeString)(e,this)),this}storeStringRefTail(e){return this.storeRef(i().storeStringTail(e)),this}storeMaybeStringRefTail(e){return e==null?this.storeBit(0):(this.storeBit(1),this.storeStringRefTail(e)),this}storeDict(e,t,n){return e?e.store(this,t,n):this.storeBit(0),this}storeDictDirect(e,t,n){return e.storeDirect(this,t,n),this}endCell(e){return new n.Cell({bits:this._bits.build(),refs:this._refs,exotic:e?.exotic})}asCell(){return this.endCell()}asSlice(){return this.endCell().beginParse()}};e.Builder=a})),Qc=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SimpleLibraryValue=e.storeSimpleLibrary=e.loadSimpleLibrary=void 0;function t(e){return{public:e.loadBit(),root:e.loadRef()}}e.loadSimpleLibrary=t;function n(e){return t=>{t.storeBit(e.public),t.storeRef(e.root)}}e.storeSimpleLibrary=n,e.SimpleLibraryValue={serialize(e,t){n(e)(t)},parse(e){return t(e)}}})),$c=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTickTock=e.loadTickTock=void 0;function t(e){return{tick:e.loadBit(),tock:e.loadBit()}}e.loadTickTock=t;function n(e){return t=>{t.storeBit(e.tick),t.storeBit(e.tock)}}e.storeTickTock=n})),el=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeStateInit=e.loadStateInit=void 0;var t=Lc(),n=Qc(),r=$c();function i(e){let i;e.loadBit()&&(i=e.loadUint(5));let a;e.loadBit()&&(a=(0,r.loadTickTock)(e));let o=e.loadMaybeRef(),s=e.loadMaybeRef(),c=e.loadDict(t.Dictionary.Keys.BigUint(256),n.SimpleLibraryValue);return c.size===0&&(c=void 0),{splitDepth:i,special:a,code:o,data:s,libraries:c}}e.loadStateInit=i;function a(e){return t=>{e.splitDepth!==null&&e.splitDepth!==void 0?(t.storeBit(!0),t.storeUint(e.splitDepth,5)):t.storeBit(!1),e.special!==null&&e.special!==void 0?(t.storeBit(!0),t.store((0,r.storeTickTock)(e.special))):t.storeBit(!1),t.storeMaybeRef(e.code),t.storeMaybeRef(e.data),t.storeDict(e.libraries)}}e.storeStateInit=a})),tl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.contractAddress=void 0;var t=$(),n=el(),r=bc();function i(e,i){let a=(0,t.beginCell)().store((0,n.storeStateInit)(i)).endCell().hash();return new r.Address(e,a)}e.contractAddress=i})),nl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.parseTuple=e.serializeTuple=e.parseTupleItem=e.serializeTupleItem=void 0;var t=$(),n=BigInt(`-9223372036854775808`),r=BigInt(`9223372036854775807`);function i(e,a){if(e.type===`null`)a.storeUint(0,8);else if(e.type===`int`)e.value<=r&&e.value>=n?(a.storeUint(1,8),a.storeInt(e.value,64)):(a.storeUint(256,15),a.storeInt(e.value,257));else if(e.type===`nan`)a.storeInt(767,16);else if(e.type===`cell`)a.storeUint(3,8),a.storeRef(e.cell);else if(e.type===`slice`)a.storeUint(4,8),a.storeUint(0,10),a.storeUint(e.cell.bits.length,10),a.storeUint(0,3),a.storeUint(e.cell.refs.length,3),a.storeRef(e.cell);else if(e.type===`builder`)a.storeUint(5,8),a.storeRef(e.cell);else if(e.type===`tuple`){let n=null,r=null;for(let a=0;a<e.items.length;a++){let o=n;n=r,r=o,a>1&&(n=(0,t.beginCell)().storeRef(r).storeRef(n).endCell());let s=(0,t.beginCell)();i(e.items[a],s),r=s.endCell()}a.storeUint(7,8),a.storeUint(e.items.length,16),n&&a.storeRef(n),r&&a.storeRef(r)}else throw Error(`Invalid value`)}e.serializeTupleItem=i;function a(e){let n=e.loadUint(8);if(n===0)return{type:`null`};if(n===1)return{type:`int`,value:e.loadIntBig(64)};if(n===2)return e.loadUint(7)===0?{type:`int`,value:e.loadIntBig(257)}:(e.loadBit(),{type:`nan`});if(n===3)return{type:`cell`,cell:e.loadRef()};if(n===4){let n=e.loadUint(10),r=e.loadUint(10),i=e.loadUint(3),a=e.loadUint(3),o=e.loadRef().beginParse();o.skip(n);let s=o.loadBits(r-n),c=(0,t.beginCell)().storeBits(s);if(i<a){for(let e=0;e<i;e++)o.loadRef();for(let e=0;e<a-i;e++)c.storeRef(o.loadRef())}return{type:`slice`,cell:c.endCell()}}if(n===5)return{type:`builder`,cell:e.loadRef()};if(n===7){let t=e.loadUint(16),n=[];if(t>1){let r=e.loadRef().beginParse(),i=e.loadRef().beginParse();n.unshift(a(i));for(let e=0;e<t-2;e++){let e=r;r=e.loadRef().beginParse(),i=e.loadRef().beginParse(),n.unshift(a(i))}n.unshift(a(r))}else t===1&&n.push(a(e.loadRef().beginParse()));return{type:`tuple`,items:n}}throw Error(`Unsupported stack item`)}e.parseTupleItem=a;function o(e,n){if(e.length>0){let r=(0,t.beginCell)();o(e.slice(0,e.length-1),r),n.storeRef(r.endCell()),i(e[e.length-1],n)}}function s(e){let n=(0,t.beginCell)();return n.storeUint(e.length,24),o([...e],n),n.endCell()}e.serializeTuple=s;function c(e){let t=[],n=e.beginParse(),r=n.loadUint(24);for(let e=0;e<r;e++){let e=n.loadRef();t.unshift(a(n)),n=e.beginParse()}return t}e.parseTuple=c})),rl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TupleReader=void 0,e.TupleReader=class e{constructor(e){this.items=[...e]}get remaining(){return this.items.length}peek(){if(this.items.length===0)throw Error(`EOF`);return this.items[0]}pop(){if(this.items.length===0)throw Error(`EOF`);let e=this.items[0];return this.items.splice(0,1),e}skip(e=1){for(let t=0;t<e;t++)this.pop();return this}readBigNumber(){let e=this.pop();if(e.type!==`int`)throw Error(`Not a number`);return e.value}readBigNumberOpt(){let e=this.pop();if(e.type===`null`)return null;if(e.type!==`int`)throw Error(`Not a number`);return e.value}readNumber(){return Number(this.readBigNumber())}readNumberOpt(){let e=this.readBigNumberOpt();return e===null?null:Number(e)}readBoolean(){return this.readNumber()!==0}readBooleanOpt(){let e=this.readNumberOpt();return e===null?null:e!==0}readAddress(){let e=this.readCell().beginParse().loadAddress();if(e!==null)return e;throw Error(`Not an address`)}readAddressOpt(){let e=this.readCellOpt();return e===null?null:e.beginParse().loadMaybeAddress()}readCell(){let e=this.pop();if(e.type!==`cell`&&e.type!==`slice`&&e.type!==`builder`)throw Error(`Not a cell: `+e.type);return e.cell}readCellOpt(){let e=this.pop();if(e.type===`null`)return null;if(e.type!==`cell`&&e.type!==`slice`&&e.type!==`builder`)throw Error(`Not a cell`);return e.cell}readTuple(){let t=this.pop();if(t.type!==`tuple`)throw Error(`Not a tuple`);return new e(t.items)}readTupleOpt(){let t=this.pop();if(t.type===`null`)return null;if(t.type!==`tuple`)throw Error(`Not a tuple`);return new e(t.items)}static readLispList(e){let t=[],n=e;for(;n!==null;){var r=n.pop();if(n.items.length===0||n.items[0].type!==`tuple`&&n.items[0].type!==`null`)throw Error(`Lisp list consists only from (any, tuple) elements and ends with null`);n=n.readTupleOpt(),t.push(r)}return t}readLispListDirect(){return this.items.length===1&&this.items[0].type===`null`?[]:e.readLispList(this)}readLispList(){return e.readLispList(this.readTupleOpt())}readBuffer(){let e=this.readCell().beginParse();if(e.remainingRefs!==0||e.remainingBits%8!=0)throw Error(`Not a buffer`);return e.loadBuffer(e.remainingBits/8)}readBufferOpt(){let e=this.readCellOpt();if(e!==null){let t=e.beginParse();if(t.remainingRefs!==0||t.remainingBits%8!=0)throw Error(`Not a buffer`);return t.loadBuffer(t.remainingBits/8)}return null}readString(){return this.readCell().beginParse().loadStringTail()}readStringOpt(){let e=this.readCellOpt();return e===null?null:e.beginParse().loadStringTail()}}})),il=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.TupleBuilder=void 0;var t=$(),n=Zc(),r=zc();e.TupleBuilder=class{constructor(){this._tuple=[]}writeNumber(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`int`,value:BigInt(e)})}writeBoolean(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`int`,value:e?-1n:0n})}writeBuffer(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`slice`,cell:(0,t.beginCell)().storeBuffer(e).endCell()})}writeString(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`slice`,cell:(0,t.beginCell)().storeStringTail(e).endCell()})}writeCell(e){e==null?this._tuple.push({type:`null`}):e instanceof n.Cell?this._tuple.push({type:`cell`,cell:e}):e instanceof r.Slice&&this._tuple.push({type:`cell`,cell:e.asCell()})}writeSlice(e){e==null?this._tuple.push({type:`null`}):e instanceof n.Cell?this._tuple.push({type:`slice`,cell:e}):e instanceof r.Slice&&this._tuple.push({type:`slice`,cell:e.asCell()})}writeBuilder(e){e==null?this._tuple.push({type:`null`}):e instanceof n.Cell?this._tuple.push({type:`builder`,cell:e}):e instanceof r.Slice&&this._tuple.push({type:`builder`,cell:e.asCell()})}writeTuple(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`tuple`,items:e})}writeAddress(e){e==null?this._tuple.push({type:`null`}):this._tuple.push({type:`slice`,cell:(0,t.beginCell)().storeAddress(e).endCell()})}build(){return[...this._tuple]}}})),al=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.fromNano=e.toNano=void 0;function t(e){if(typeof e==`bigint`)return e*1000000000n;{if(typeof e==`number`){if(!Number.isFinite(e))throw Error(`Invalid number`);if(Math.log10(e)<=6)e=e.toLocaleString(`en`,{minimumFractionDigits:9,useGrouping:!1});else if(e-Math.trunc(e)===0)e=e.toLocaleString(`en`,{maximumFractionDigits:0,useGrouping:!1});else throw Error(`Not enough precision for a number value. Use string value instead`)}let t=!1;for(;e.startsWith(`-`);)t=!t,e=e.slice(1);if(e===`.`)throw Error(`Invalid number`);let n=e.split(`.`);if(n.length>2)throw Error(`Invalid number`);let r=n[0],i=n[1];if(r||=`0`,i||=`0`,i.length>9)throw Error(`Invalid number`);for(;i.length<9;)i+=`0`;let a=BigInt(r)*1000000000n+BigInt(i);return t&&(a=-a),a}}e.toNano=t;function n(e){let t=BigInt(e),n=!1;t<0&&(n=!0,t=-t);let r=(t%1000000000n).toString();for(;r.length<9;)r=`0`+r;r=r.match(/^([0-9]*[1-9]|0)(0*)/)[1];let i=`${(t/1000000000n).toString()}${r===`0`?``:`.${r}`}`;return n&&(i=`-`+i),i}e.fromNano=n})),ol=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.packExtraCurrencyCell=e.packExtraCurrencyDict=e.storeExtraCurrency=e.loadMaybeExtraCurrency=e.loadExtraCurrency=void 0;var t=$(),n=Lc();function r(e){let t=e instanceof n.Dictionary?e:n.Dictionary.loadDirect(n.Dictionary.Keys.Uint(32),n.Dictionary.Values.BigVarUint(5),e),r={};for(let[e,n]of t)r[e]=n;return r}e.loadExtraCurrency=r;function i(e){let t=e.loadMaybeRef();return t===null?t:r(t)}e.loadMaybeExtraCurrency=i;function a(e){return t=>{t.storeDict(o(e))}}e.storeExtraCurrency=a;function o(e){let t=n.Dictionary.empty(n.Dictionary.Keys.Uint(32),n.Dictionary.Values.BigVarUint(5));return Object.entries(e).map(([e,n])=>t.set(Number(e),n)),t}e.packExtraCurrencyDict=o;function s(e){return(0,t.beginCell)().storeDictDirect(o(e)).endCell()}e.packExtraCurrencyCell=s})),sl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.comment=e.external=e.internal=void 0;var t=bc(),n=Zc(),r=$(),i=al(),a=ol();function o(e){let o=!0;e.bounce!==null&&e.bounce!==void 0&&(o=e.bounce);let s;if(typeof e.to==`string`)s=t.Address.parse(e.to);else if(t.Address.isAddress(e.to))s=e.to;else throw Error(`Invalid address ${e.to}`);let c;c=typeof e.value==`string`?(0,i.toNano)(e.value):e.value;let l;e.extracurrency&&(l=(0,a.packExtraCurrencyDict)(e.extracurrency));let u=n.Cell.EMPTY;return typeof e.body==`string`?u=(0,r.beginCell)().storeUint(0,32).storeStringTail(e.body).endCell():e.body&&(u=e.body),{info:{type:`internal`,dest:s,value:{coins:c,other:l},bounce:o,ihrDisabled:!0,bounced:!1,ihrFee:0n,forwardFee:0n,createdAt:0,createdLt:0n},init:e.init??void 0,body:u}}e.internal=o;function s(e){let r;if(typeof e.to==`string`)r=t.Address.parse(e.to);else if(t.Address.isAddress(e.to))r=e.to;else throw Error(`Invalid address ${e.to}`);return{info:{type:`external-in`,dest:r,importFee:0n},init:e.init??void 0,body:e.body||n.Cell.EMPTY}}e.external=s;function c(e){return(0,r.beginCell)().storeUint(0,32).storeStringTail(e).endCell()}e.comment=c})),cl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccountState=e.loadAccountState=void 0;var t=el();function n(e){return e.loadBit()?{type:`active`,state:(0,t.loadStateInit)(e)}:e.loadBit()?{type:`frozen`,stateHash:e.loadUintBig(256)}:{type:`uninit`}}e.loadAccountState=n;function r(e){return n=>{e.type===`active`?(n.storeBit(!0),n.store((0,t.storeStateInit)(e.state))):e.type===`frozen`?(n.storeBit(!1),n.storeBit(!0),n.storeUint(e.stateHash,256)):e.type===`uninit`&&(n.storeBit(!1),n.storeBit(!1))}}e.storeAccountState=r})),ll=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeCurrencyCollection=e.loadCurrencyCollection=void 0;var t=Lc();function n(e){let n=e.loadCoins(),r=e.loadDict(t.Dictionary.Keys.Uint(32),t.Dictionary.Values.BigVarUint(5));return r.size===0?{coins:n}:{other:r,coins:n}}e.loadCurrencyCollection=n;function r(e){return t=>{t.storeCoins(e.coins),e.other?t.storeDict(e.other):t.storeBit(0)}}e.storeCurrencyCollection=r})),ul=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccountStorage=e.loadAccountStorage=void 0;var t=cl(),n=ll();function r(e){return{lastTransLt:e.loadUintBig(64),balance:(0,n.loadCurrencyCollection)(e),state:(0,t.loadAccountState)(e)}}e.loadAccountStorage=r;function i(e){return r=>{r.storeUint(e.lastTransLt,64),r.store((0,n.storeCurrencyCollection)(e.balance)),r.store((0,t.storeAccountState)(e.state))}}e.storeAccountStorage=i})),dl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeStorageExtraInfo=e.loadStorageExtraInfo=void 0;function t(e){let t=e.loadUint(3);if(t===0)return null;if(t===1)return{dictHash:e.loadUintBig(256)};throw Error(`Invalid storage extra info header: ${t}`)}e.loadStorageExtraInfo=t;function n(e){return t=>{e==null?t.storeUint(0,3):(t.storeUint(1,3),t.storeUint(e.dictHash,256))}}e.storeStorageExtraInfo=n})),fl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeStorageUsed=e.loadStorageUsed=void 0;function t(e){return{cells:e.loadVarUintBig(3),bits:e.loadVarUintBig(3)}}e.loadStorageUsed=t;function n(e){return t=>{t.storeVarUint(e.cells,3),t.storeVarUint(e.bits,3)}}e.storeStorageUsed=n})),pl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeStorageInfo=e.loadStorageInfo=void 0;var t=dl(),n=fl();function r(e){return{used:(0,n.loadStorageUsed)(e),storageExtra:(0,t.loadStorageExtraInfo)(e),lastPaid:e.loadUint(32),duePayment:e.loadMaybeCoins()}}e.loadStorageInfo=r;function i(e){return r=>{r.store((0,n.storeStorageUsed)(e.used)),r.store((0,t.storeStorageExtraInfo)(e.storageExtra)),r.storeUint(e.lastPaid,32),r.storeMaybeCoins(e.duePayment)}}e.storeStorageInfo=i})),ml=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccount=e.loadAccount=void 0;var t=ul(),n=pl();function r(e){return{addr:e.loadAddress(),storageStats:(0,n.loadStorageInfo)(e),storage:(0,t.loadAccountStorage)(e)}}e.loadAccount=r;function i(e){return r=>{r.storeAddress(e.addr),r.store((0,n.storeStorageInfo)(e.storageStats)),r.store((0,t.storeAccountStorage)(e.storage))}}e.storeAccount=i})),hl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccountStatus=e.loadAccountStatus=void 0;function t(e){let t=e.loadUint(2);if(t===0)return`uninitialized`;if(t===1)return`frozen`;if(t===2)return`active`;if(t===3)return`non-existing`;throw Error(`Invalid data`)}e.loadAccountStatus=t;function n(e){return t=>{if(e===`uninitialized`)t.storeUint(0,2);else if(e===`frozen`)t.storeUint(1,2);else if(e===`active`)t.storeUint(2,2);else if(e===`non-existing`)t.storeUint(3,2);else throw Error(`Invalid data`);return t}}e.storeAccountStatus=n})),gl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeAccountStatusChange=e.loadAccountStatusChange=void 0;function t(e){return e.loadBit()?e.loadBit()?`deleted`:`frozen`:`unchanged`}e.loadAccountStatusChange=t;function n(e){return t=>{if(e==`unchanged`)t.storeBit(0);else if(e===`frozen`)t.storeBit(1),t.storeBit(0);else if(e===`deleted`)t.storeBit(1),t.storeBit(1);else throw Error(`Invalid account status change`)}}e.storeAccountStatusChange=n})),_l=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeCommonMessageInfoRelaxed=e.loadCommonMessageInfoRelaxed=void 0;var t=ll();function n(e){if(!e.loadBit())return{type:`internal`,ihrDisabled:e.loadBit(),bounce:e.loadBit(),bounced:e.loadBit(),src:e.loadMaybeAddress(),dest:e.loadAddress(),value:(0,t.loadCurrencyCollection)(e),ihrFee:e.loadCoins(),forwardFee:e.loadCoins(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)};if(!e.loadBit())throw Error(`External In message is not possible for CommonMessageInfoRelaxed`);return{type:`external-out`,src:e.loadMaybeAddress(),dest:e.loadMaybeExternalAddress(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)}}e.loadCommonMessageInfoRelaxed=n;function r(e){return n=>{if(e.type===`internal`)n.storeBit(0),n.storeBit(e.ihrDisabled),n.storeBit(e.bounce),n.storeBit(e.bounced),n.storeAddress(e.src),n.storeAddress(e.dest),n.store((0,t.storeCurrencyCollection)(e.value)),n.storeCoins(e.ihrFee),n.storeCoins(e.forwardFee),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else if(e.type===`external-out`)n.storeBit(1),n.storeBit(1),n.storeAddress(e.src),n.storeAddress(e.dest),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else throw Error(`Unknown CommonMessageInfo type`)}}e.storeCommonMessageInfoRelaxed=r})),vl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeMessageRelaxed=e.loadMessageRelaxed=void 0;var t=$(),n=_l(),r=el();function i(e){let t=(0,n.loadCommonMessageInfoRelaxed)(e),i=null;e.loadBit()&&(i=e.loadBit()?(0,r.loadStateInit)(e.loadRef().beginParse()):(0,r.loadStateInit)(e));let a=e.loadBit()?e.loadRef():e.asCell();return{info:t,init:i,body:a}}e.loadMessageRelaxed=i;function a(e,i){return a=>{if(a.store((0,n.storeCommonMessageInfoRelaxed)(e.info)),e.init){a.storeBit(!0);let n=(0,t.beginCell)().store((0,r.storeStateInit)(e.init)),o=!1;o=i&&i.forceRef?!0:!(a.availableBits-2>=n.bits),o?(a.storeBit(!0),a.storeRef(n)):(a.storeBit(!1),a.storeBuilder(n))}else a.storeBit(!1);let o=!1;o=i&&i.forceRef?!0:!(a.availableBits-1>=e.body.bits.length&&a.refs+e.body.refs.length<=4&&!e.body.isExotic),o?(a.storeBit(!0),a.storeRef(e.body)):(a.storeBit(!1),a.storeBuilder(e.body.asBuilder()))}}e.storeMessageRelaxed=a})),yl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeLibRef=e.loadLibRef=void 0;function t(e){return e.loadUint(1)===0?{type:`hash`,libHash:e.loadBuffer(32)}:{type:`ref`,library:e.loadRef()}}e.loadLibRef=t;function n(e){return t=>{e.type===`hash`?(t.storeUint(0,1),t.storeBuffer(e.libHash)):(t.storeUint(1,1),t.storeRef(e.library))}}e.storeLibRef=n})),bl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loadOutList=e.storeOutList=e.loadOutAction=e.storeOutAction=void 0;var t=vl(),n=$(),r=ll(),i=yl();function a(e){switch(e.type){case`sendMsg`:return s(e);case`setCode`:return l(e);case`reserve`:return d(e);case`changeLibrary`:return p(e);default:throw Error(`Unknown action type ${e.type}`)}}e.storeOutAction=a;var o=247711853;function s(e){return r=>{r.storeUint(o,32).storeUint(e.mode,8).storeRef((0,n.beginCell)().store((0,t.storeMessageRelaxed)(e.outMsg)).endCell())}}var c=2907562126;function l(e){return t=>{t.storeUint(c,32).storeRef(e.newCode)}}var u=921090057;function d(e){return t=>{t.storeUint(u,32).storeUint(e.mode,8).store((0,r.storeCurrencyCollection)(e.currency))}}var f=653925844;function p(e){return t=>{t.storeUint(f,32).storeUint(e.mode,7).store((0,i.storeLibRef)(e.libRef))}}function m(e){let n=e.loadUint(32);if(n===o)return{type:`sendMsg`,mode:e.loadUint(8),outMsg:(0,t.loadMessageRelaxed)(e.loadRef().beginParse())};if(n===c)return{type:`setCode`,newCode:e.loadRef()};if(n===u)return{type:`reserve`,mode:e.loadUint(8),currency:(0,r.loadCurrencyCollection)(e)};if(n===f)return{type:`changeLibrary`,mode:e.loadUint(7),libRef:(0,i.loadLibRef)(e)};throw Error(`Unknown out action tag 0x${n.toString(16)}`)}e.loadOutAction=m;function h(e){let t=e.reduce((e,t)=>(0,n.beginCell)().storeRef(e).store(a(t)).endCell(),(0,n.beginCell)().endCell());return e=>{e.storeSlice(t.beginParse())}}e.storeOutList=h;function g(e){let t=[];for(;e.remainingRefs;){let n=e.loadRef();t.push(m(e)),e=n.beginParse()}return t.reverse()}e.loadOutList=g})),xl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeCommonMessageInfo=e.loadCommonMessageInfo=void 0;var t=ll();function n(e){return e.loadBit()?e.loadBit()?{type:`external-out`,src:e.loadAddress(),dest:e.loadMaybeExternalAddress(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)}:{type:`external-in`,src:e.loadMaybeExternalAddress(),dest:e.loadAddress(),importFee:e.loadCoins()}:{type:`internal`,ihrDisabled:e.loadBit(),bounce:e.loadBit(),bounced:e.loadBit(),src:e.loadAddress(),dest:e.loadAddress(),value:(0,t.loadCurrencyCollection)(e),ihrFee:e.loadCoins(),forwardFee:e.loadCoins(),createdLt:e.loadUintBig(64),createdAt:e.loadUint(32)}}e.loadCommonMessageInfo=n;function r(e){return n=>{if(e.type===`internal`)n.storeBit(0),n.storeBit(e.ihrDisabled),n.storeBit(e.bounce),n.storeBit(e.bounced),n.storeAddress(e.src),n.storeAddress(e.dest),n.store((0,t.storeCurrencyCollection)(e.value)),n.storeCoins(e.ihrFee),n.storeCoins(e.forwardFee),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else if(e.type===`external-in`)n.storeBit(1),n.storeBit(0),n.storeAddress(e.src),n.storeAddress(e.dest),n.storeCoins(e.importFee);else if(e.type===`external-out`)n.storeBit(1),n.storeBit(1),n.storeAddress(e.src),n.storeAddress(e.dest),n.storeUint(e.createdLt,64),n.storeUint(e.createdAt,32);else throw Error(`Unknown CommonMessageInfo type`)}}e.storeCommonMessageInfo=r})),Sl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeComputeSkipReason=e.loadComputeSkipReason=void 0;function t(e){let t=e.loadUint(2);if(t===0)return`no-state`;if(t===1)return`bad-state`;if(t===2)return`no-gas`;throw Error(`Unknown ComputeSkipReason: ${t}`)}e.loadComputeSkipReason=t;function n(e){return t=>{if(e===`no-state`)t.storeUint(0,2);else if(e===`bad-state`)t.storeUint(1,2);else if(e===`no-gas`)t.storeUint(2,2);else throw Error(`Unknown ComputeSkipReason: ${e}`)}}e.storeComputeSkipReason=n})),Cl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeDepthBalanceInfo=e.loadDepthBalanceInfo=void 0;var t=ll();function n(e){return{splitDepth:e.loadUint(5),balance:(0,t.loadCurrencyCollection)(e)}}e.loadDepthBalanceInfo=n;function r(e){return n=>{n.storeUint(e.splitDepth,5),n.store((0,t.storeCurrencyCollection)(e.balance))}}e.storeDepthBalanceInfo=r})),wl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeHashUpdate=e.loadHashUpdate=void 0;function t(e){if(e.loadUint(8)!==114)throw Error(`Invalid data`);return{oldHash:e.loadBuffer(32),newHash:e.loadBuffer(32)}}e.loadHashUpdate=t;function n(e){return t=>{t.storeUint(114,8),t.storeBuffer(e.oldHash),t.storeBuffer(e.newHash)}}e.storeHashUpdate=n})),Tl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loadMasterchainStateExtra=void 0;var t=Lc(),n=ll();function r(e){if(e.loadUint(16)!==52262)throw Error(`Invalid data`);e.loadBit()&&e.loadRef();let r=e.loadUintBig(256);return{config:t.Dictionary.load(t.Dictionary.Keys.Int(32),t.Dictionary.Values.Cell(),e),configAddress:r,globalBalance:(0,n.loadCurrencyCollection)(e)}}e.loadMasterchainStateExtra=r})),El=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.MessageValue=e.storeMessage=e.loadMessage=void 0;var t=$(),n=xl(),r=el();function i(e){let t=(0,n.loadCommonMessageInfo)(e),i=null;e.loadBit()&&(i=e.loadBit()?(0,r.loadStateInit)(e.loadRef().beginParse()):(0,r.loadStateInit)(e));let a=e.loadBit()?e.loadRef():e.asCell();return{info:t,init:i,body:a}}e.loadMessage=i;function a(e,i){return a=>{if(a.store((0,n.storeCommonMessageInfo)(e.info)),e.init){a.storeBit(!0);let n=(0,t.beginCell)().store((0,r.storeStateInit)(e.init)),o=!1;o=i&&i.forceRef?!0:a.availableBits-2<n.bits+e.body.bits.length,o?(a.storeBit(!0),a.storeRef(n)):(a.storeBit(!1),a.storeBuilder(n))}else a.storeBit(!1);let o=!1;o=i&&i.forceRef?!0:a.availableBits-1<e.body.bits.length||a.refs+e.body.refs.length>4,o?(a.storeBit(!0),a.storeRef(e.body)):(a.storeBit(!1),a.storeBuilder(e.body.asBuilder()))}}e.storeMessage=a,e.MessageValue={serialize(e,n){n.storeRef((0,t.beginCell)().store(a(e)))},parse(e){return i(e.loadRef().beginParse())}}})),Dl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.SendMode=void 0;var t;(function(e){e[e.CARRY_ALL_REMAINING_BALANCE=128]=`CARRY_ALL_REMAINING_BALANCE`,e[e.CARRY_ALL_REMAINING_INCOMING_VALUE=64]=`CARRY_ALL_REMAINING_INCOMING_VALUE`,e[e.DESTROY_ACCOUNT_IF_ZERO=32]=`DESTROY_ACCOUNT_IF_ZERO`,e[e.PAY_GAS_SEPARATELY=1]=`PAY_GAS_SEPARATELY`,e[e.IGNORE_ERRORS=2]=`IGNORE_ERRORS`,e[e.NONE=0]=`NONE`})(t||(e.SendMode=t={}))})),Ol=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ReserveMode=void 0;var t;(function(e){e[e.THIS_AMOUNT=0]=`THIS_AMOUNT`,e[e.LEAVE_THIS_AMOUNT=1]=`LEAVE_THIS_AMOUNT`,e[e.AT_MOST_THIS_AMOUNT=2]=`AT_MOST_THIS_AMOUNT`,e[e.LEAVE_MAX_THIS_AMOUNT=3]=`LEAVE_MAX_THIS_AMOUNT`,e[e.BEFORE_BALANCE_PLUS_THIS_AMOUNT=4]=`BEFORE_BALANCE_PLUS_THIS_AMOUNT`,e[e.LEAVE_BBALANCE_PLUS_THIS_AMOUNT=5]=`LEAVE_BBALANCE_PLUS_THIS_AMOUNT`,e[e.BEFORE_BALANCE_MINUS_THIS_AMOUNT=12]=`BEFORE_BALANCE_MINUS_THIS_AMOUNT`,e[e.LEAVE_BEFORE_BALANCE_MINUS_THIS_AMOUNT=13]=`LEAVE_BEFORE_BALANCE_MINUS_THIS_AMOUNT`})(t||(e.ReserveMode=t={}))})),kl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeShardAccount=e.loadShardAccount=void 0;var t=$(),n=ml();function r(e){let t=e.loadRef(),r;if(!t.isExotic){let e=t.beginParse();e.loadBit()&&(r=(0,n.loadAccount)(e))}return{account:r,lastTransactionHash:e.loadUintBig(256),lastTransactionLt:e.loadUintBig(64)}}e.loadShardAccount=r;function i(e){return r=>{e.account?r.storeRef((0,t.beginCell)().storeBit(!0).store((0,n.storeAccount)(e.account))):r.storeRef((0,t.beginCell)().storeBit(!1)),r.storeUint(e.lastTransactionHash,256),r.storeUint(e.lastTransactionLt,64)}}e.storeShardAccount=i})),Al=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeShardAccounts=e.loadShardAccounts=e.ShardAccountRefValue=void 0;var t=Lc(),n=Cl(),r=kl();e.ShardAccountRefValue={parse:e=>({depthBalanceInfo:(0,n.loadDepthBalanceInfo)(e),shardAccount:(0,r.loadShardAccount)(e)}),serialize(e,t){t.store((0,n.storeDepthBalanceInfo)(e.depthBalanceInfo)),t.store((0,r.storeShardAccount)(e.shardAccount))}};function i(n){return t.Dictionary.load(t.Dictionary.Keys.BigUint(256),e.ShardAccountRefValue,n)}e.loadShardAccounts=i;function a(e){return t=>{t.storeDict(e)}}e.storeShardAccounts=a})),jl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeShardIdent=e.loadShardIdent=void 0;function t(e){if(e.loadUint(2)!==0)throw Error(`Invalid data`);return{shardPrefixBits:e.loadUint(6),workchainId:e.loadInt(32),shardPrefix:e.loadUintBig(64)}}e.loadShardIdent=t;function n(e){return t=>{t.storeUint(0,2),t.storeUint(e.shardPrefixBits,6),t.storeInt(e.workchainId,32),t.storeUint(e.shardPrefix,64)}}e.storeShardIdent=n})),Ml=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loadShardStateUnsplit=void 0;var t=Tl(),n=Al(),r=jl();function i(e){if(e.loadUint(32)!==2418257890)throw Error(`Invalid data`);let i=e.loadInt(32),a=(0,r.loadShardIdent)(e),o=e.loadUint(32),s=e.loadUint(32),c=e.loadUint(32),l=e.loadUintBig(64),u=e.loadUint(32);e.loadRef();let d=e.loadBit(),f=e.loadRef(),p;f.isExotic||(p=(0,n.loadShardAccounts)(f.beginParse())),e.loadRef();let m=e.loadBit(),h=null;if(m){let n=e.loadRef();n.isExotic||(h=(0,t.loadMasterchainStateExtra)(n.beginParse()))}return{globalId:i,shardId:a,seqno:o,vertSeqNo:s,genUtime:c,genLt:l,minRefMcSeqno:u,beforeSplit:d,accounts:p,extras:h}}e.loadShardStateUnsplit=i})),Nl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeSplitMergeInfo=e.loadSplitMergeInfo=void 0;function t(e){return{currentShardPrefixLength:e.loadUint(6),accountSplitDepth:e.loadUint(6),thisAddress:e.loadUintBig(256),siblingAddress:e.loadUintBig(256)}}e.loadSplitMergeInfo=t;function n(e){return t=>{t.storeUint(e.currentShardPrefixLength,6),t.storeUint(e.accountSplitDepth,6),t.storeUint(e.thisAddress,256),t.storeUint(e.siblingAddress,256)}}e.storeSplitMergeInfo=n})),Pl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionActionPhase=e.loadTransactionActionPhase=void 0;var t=gl(),n=fl();function r(e){return{success:e.loadBit(),valid:e.loadBit(),noFunds:e.loadBit(),statusChange:(0,t.loadAccountStatusChange)(e),totalFwdFees:e.loadBit()?e.loadCoins():void 0,totalActionFees:e.loadBit()?e.loadCoins():void 0,resultCode:e.loadInt(32),resultArg:e.loadBit()?e.loadInt(32):void 0,totalActions:e.loadUint(16),specActions:e.loadUint(16),skippedActions:e.loadUint(16),messagesCreated:e.loadUint(16),actionListHash:e.loadUintBig(256),totalMessageSize:(0,n.loadStorageUsed)(e)}}e.loadTransactionActionPhase=r;function i(e){return r=>{r.storeBit(e.success),r.storeBit(e.valid),r.storeBit(e.noFunds),r.store((0,t.storeAccountStatusChange)(e.statusChange)),r.storeMaybeCoins(e.totalFwdFees),r.storeMaybeCoins(e.totalActionFees),r.storeInt(e.resultCode,32),r.storeMaybeInt(e.resultArg,32),r.storeUint(e.totalActions,16),r.storeUint(e.specActions,16),r.storeUint(e.skippedActions,16),r.storeUint(e.messagesCreated,16),r.storeUint(e.actionListHash,256),r.store((0,n.storeStorageUsed)(e.totalMessageSize))}}e.storeTransactionActionPhase=i})),Fl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionBouncePhase=e.loadTransactionBouncePhase=void 0;var t=fl();function n(e){return e.loadBit()?{type:`ok`,messageSize:(0,t.loadStorageUsed)(e),messageFees:e.loadCoins(),forwardFees:e.loadCoins()}:e.loadBit()?{type:`no-funds`,messageSize:(0,t.loadStorageUsed)(e),requiredForwardFees:e.loadCoins()}:{type:`negative-funds`}}e.loadTransactionBouncePhase=n;function r(e){return n=>{if(e.type===`ok`)n.storeBit(!0),n.store((0,t.storeStorageUsed)(e.messageSize)),n.storeCoins(e.messageFees),n.storeCoins(e.forwardFees);else if(e.type===`negative-funds`)n.storeBit(!1),n.storeBit(!1);else if(e.type===`no-funds`)n.storeBit(!1),n.storeBit(!0),n.store((0,t.storeStorageUsed)(e.messageSize)),n.storeCoins(e.requiredForwardFees);else throw Error(`Invalid TransactionBouncePhase type`)}}e.storeTransactionBouncePhase=r})),Il=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionComputePhase=e.loadTransactionComputePhase=void 0;var t=$(),n=Sl();function r(e){if(!e.loadBit())return{type:`skipped`,reason:(0,n.loadComputeSkipReason)(e)};let t=e.loadBit(),r=e.loadBit(),i=e.loadBit(),a=e.loadCoins(),o=e.loadRef().beginParse();return{type:`vm`,success:t,messageStateUsed:r,accountActivated:i,gasFees:a,gasUsed:o.loadVarUintBig(3),gasLimit:o.loadVarUintBig(3),gasCredit:o.loadBit()?o.loadVarUintBig(2):void 0,mode:o.loadUint(8),exitCode:o.loadInt(32),exitArg:o.loadBit()?o.loadInt(32):void 0,vmSteps:o.loadUint(32),vmInitStateHash:o.loadUintBig(256),vmFinalStateHash:o.loadUintBig(256)}}e.loadTransactionComputePhase=r;function i(e){return r=>{if(e.type===`skipped`){r.storeBit(0),r.store((0,n.storeComputeSkipReason)(e.reason));return}r.storeBit(1),r.storeBit(e.success),r.storeBit(e.messageStateUsed),r.storeBit(e.accountActivated),r.storeCoins(e.gasFees),r.storeRef((0,t.beginCell)().storeVarUint(e.gasUsed,3).storeVarUint(e.gasLimit,3).store(t=>e.gasCredit!==void 0&&e.gasCredit!==null?t.storeBit(1).storeVarUint(e.gasCredit,2):t.storeBit(0)).storeUint(e.mode,8).storeInt(e.exitCode,32).store(t=>e.exitArg!==void 0&&e.exitArg!==null?t.storeBit(1).storeInt(e.exitArg,32):t.storeBit(0)).storeUint(e.vmSteps,32).storeUint(e.vmInitStateHash,256).storeUint(e.vmFinalStateHash,256).endCell())}}e.storeTransactionComputePhase=i})),Ll=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionCreditPhase=e.loadTransactionCreditPhase=void 0;var t=ll();function n(e){return{dueFeesColelcted:e.loadBit()?e.loadCoins():void 0,credit:(0,t.loadCurrencyCollection)(e)}}e.loadTransactionCreditPhase=n;function r(e){return n=>{e.dueFeesColelcted===null||e.dueFeesColelcted===void 0?n.storeBit(!1):(n.storeBit(!0),n.storeCoins(e.dueFeesColelcted)),n.store((0,t.storeCurrencyCollection)(e.credit))}}e.storeTransactionCreditPhase=r})),Rl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionsStoragePhase=e.loadTransactionStoragePhase=void 0;var t=gl();function n(e){let n=e.loadCoins(),r;e.loadBit()&&(r=e.loadCoins());let i=(0,t.loadAccountStatusChange)(e);return{storageFeesCollected:n,storageFeesDue:r,statusChange:i}}e.loadTransactionStoragePhase=n;function r(e){return n=>{n.storeCoins(e.storageFeesCollected),e.storageFeesDue===null||e.storageFeesDue===void 0?n.storeBit(!1):(n.storeBit(!0),n.storeCoins(e.storageFeesDue)),n.store((0,t.storeAccountStatusChange)(e.statusChange))}}e.storeTransactionsStoragePhase=r})),zl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransactionDescription=e.loadTransactionDescription=void 0;var t=$(),n=Nl(),r=Bl(),i=Pl(),a=Fl(),o=Il(),s=Ll(),c=Rl();function l(e){let t=e.loadUint(4);if(t===0){let t=e.loadBit(),n;e.loadBit()&&(n=(0,c.loadTransactionStoragePhase)(e));let r;e.loadBit()&&(r=(0,s.loadTransactionCreditPhase)(e));let l=(0,o.loadTransactionComputePhase)(e),u;e.loadBit()&&(u=(0,i.loadTransactionActionPhase)(e.loadRef().beginParse()));let d=e.loadBit(),f;e.loadBit()&&(f=(0,a.loadTransactionBouncePhase)(e));let p=e.loadBit();return{type:`generic`,creditFirst:t,storagePhase:n,creditPhase:r,computePhase:l,actionPhase:u,bouncePhase:f,aborted:d,destroyed:p}}if(t===1)return{type:`storage`,storagePhase:(0,c.loadTransactionStoragePhase)(e)};if(t===2||t===3){let n=t===3,r=(0,c.loadTransactionStoragePhase)(e),a=(0,o.loadTransactionComputePhase)(e),s;e.loadBit()&&(s=(0,i.loadTransactionActionPhase)(e.loadRef().beginParse()));let l=e.loadBit(),u=e.loadBit();return{type:`tick-tock`,isTock:n,storagePhase:r,computePhase:a,actionPhase:s,aborted:l,destroyed:u}}if(t===4){let t=(0,n.loadSplitMergeInfo)(e),r;e.loadBit()&&(r=(0,c.loadTransactionStoragePhase)(e));let a=(0,o.loadTransactionComputePhase)(e),s;e.loadBit()&&(s=(0,i.loadTransactionActionPhase)(e.loadRef().beginParse()));let l=e.loadBit(),u=e.loadBit();return{type:`split-prepare`,splitInfo:t,storagePhase:r,computePhase:a,actionPhase:s,aborted:l,destroyed:u}}if(t===5)return{type:`split-install`,splitInfo:(0,n.loadSplitMergeInfo)(e),prepareTransaction:(0,r.loadTransaction)(e.loadRef().beginParse()),installed:e.loadBit()};throw Error(`Unsupported transaction description type ${t}`)}e.loadTransactionDescription=l;function u(e){return l=>{if(e.type===`generic`)l.storeUint(0,4),l.storeBit(e.creditFirst),e.storagePhase?(l.storeBit(!0),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase))):l.storeBit(!1),e.creditPhase?(l.storeBit(!0),l.store((0,s.storeTransactionCreditPhase)(e.creditPhase))):l.storeBit(!1),l.store((0,o.storeTransactionComputePhase)(e.computePhase)),e.actionPhase?(l.storeBit(!0),l.storeRef((0,t.beginCell)().store((0,i.storeTransactionActionPhase)(e.actionPhase)))):l.storeBit(!1),l.storeBit(e.aborted),e.bouncePhase?(l.storeBit(!0),l.store((0,a.storeTransactionBouncePhase)(e.bouncePhase))):l.storeBit(!1),l.storeBit(e.destroyed);else if(e.type===`storage`)l.storeUint(1,4),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase));else if(e.type===`tick-tock`)l.storeUint(e.isTock?3:2,4),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase)),l.store((0,o.storeTransactionComputePhase)(e.computePhase)),e.actionPhase?(l.storeBit(!0),l.storeRef((0,t.beginCell)().store((0,i.storeTransactionActionPhase)(e.actionPhase)))):l.storeBit(!1),l.storeBit(e.aborted),l.storeBit(e.destroyed);else if(e.type===`split-prepare`)l.storeUint(4,4),l.store((0,n.storeSplitMergeInfo)(e.splitInfo)),e.storagePhase?(l.storeBit(!0),l.store((0,c.storeTransactionsStoragePhase)(e.storagePhase))):l.storeBit(!1),l.store((0,o.storeTransactionComputePhase)(e.computePhase)),e.actionPhase?(l.storeBit(!0),l.store((0,i.storeTransactionActionPhase)(e.actionPhase))):l.storeBit(!1),l.storeBit(e.aborted),l.storeBit(e.destroyed);else if(e.type===`split-install`)l.storeUint(5,4),l.store((0,n.storeSplitMergeInfo)(e.splitInfo)),l.storeRef((0,t.beginCell)().store((0,r.storeTransaction)(e.prepareTransaction))),l.storeBit(e.installed);else throw Error(`Unsupported transaction description type ${e.type}`)}}e.storeTransactionDescription=u})),Bl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.storeTransaction=e.loadTransaction=void 0;var t=$(),n=Lc(),r=hl(),i=ll(),a=wl(),o=El(),s=zl();function c(e){let t=e.asCell();if(e.loadUint(4)!==7)throw Error(`Invalid data`);let c=e.loadUintBig(256),l=e.loadUintBig(64),u=e.loadUintBig(256),d=e.loadUintBig(64),f=e.loadUint(32),p=e.loadUint(15),m=(0,r.loadAccountStatus)(e),h=(0,r.loadAccountStatus)(e),g=e.loadRef().beginParse(),_=g.loadBit()?(0,o.loadMessage)(g.loadRef().beginParse()):void 0,v=g.loadDict(n.Dictionary.Keys.Uint(15),o.MessageValue);return g.endParse(),{address:c,lt:l,prevTransactionHash:u,prevTransactionLt:d,now:f,outMessagesCount:p,oldStatus:m,endStatus:h,inMessage:_,outMessages:v,totalFees:(0,i.loadCurrencyCollection)(e),stateUpdate:(0,a.loadHashUpdate)(e.loadRef().beginParse()),description:(0,s.loadTransactionDescription)(e.loadRef().beginParse()),raw:t,hash:()=>t.hash()}}e.loadTransaction=c;function l(e){return n=>{n.storeUint(7,4),n.storeUint(e.address,256),n.storeUint(e.lt,64),n.storeUint(e.prevTransactionHash,256),n.storeUint(e.prevTransactionLt,64),n.storeUint(e.now,32),n.storeUint(e.outMessagesCount,15),n.store((0,r.storeAccountStatus)(e.oldStatus)),n.store((0,r.storeAccountStatus)(e.endStatus));let c=(0,t.beginCell)();e.inMessage?(c.storeBit(!0),c.storeRef((0,t.beginCell)().store((0,o.storeMessage)(e.inMessage)))):c.storeBit(!1),c.storeDict(e.outMessages),n.storeRef(c),n.store((0,i.storeCurrencyCollection)(e.totalFees)),n.storeRef((0,t.beginCell)().store((0,a.storeHashUpdate)(e.stateUpdate))),n.storeRef((0,t.beginCell)().store((0,s.storeTransactionDescription)(e.description)))}}e.storeTransaction=l})),Vl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.loadSimpleLibrary=e.loadShardStateUnsplit=e.storeShardIdent=e.loadShardIdent=e.storeShardAccounts=e.loadShardAccounts=e.ShardAccountRefValue=e.storeShardAccount=e.loadShardAccount=e.ReserveMode=e.SendMode=e.storeMessageRelaxed=e.loadMessageRelaxed=e.storeMessage=e.loadMessage=e.loadMasterchainStateExtra=e.storeHashUpdate=e.loadHashUpdate=e.storeExtraCurrency=e.loadMaybeExtraCurrency=e.loadExtraCurrency=e.packExtraCurrencyDict=e.packExtraCurrencyCell=e.storeDepthBalanceInfo=e.loadDepthBalanceInfo=e.storeCurrencyCollection=e.loadCurrencyCollection=e.storeComputeSkipReason=e.loadComputeSkipReason=e.storeCommonMessageInfoRelaxed=e.loadCommonMessageInfoRelaxed=e.storeCommonMessageInfo=e.loadCommonMessageInfo=e.storeOutList=e.loadOutList=e.storeOutAction=e.loadOutAction=e.storeAccountStorage=e.loadAccountStorage=e.storeAccountStatusChange=e.loadAccountStatusChange=e.storeAccountStatus=e.loadAccountStatus=e.storeAccountState=e.loadAccountState=e.storeAccount=e.loadAccount=e.comment=e.external=e.internal=void 0,e.storeTransactionsStoragePhase=e.loadTransactionStoragePhase=e.storeTransactionDescription=e.loadTransactionDescription=e.storeTransactionCreditPhase=e.loadTransactionCreditPhase=e.storeTransactionComputePhase=e.loadTransactionComputePhase=e.storeTransactionBouncePhase=e.loadTransactionBouncePhase=e.storeTransactionActionPhase=e.loadTransactionActionPhase=e.storeTransaction=e.loadTransaction=e.storeTickTock=e.loadTickTock=e.storeStorageUsed=e.loadStorageUsed=e.storeStorageInfo=e.loadStorageInfo=e.storeStateInit=e.loadStateInit=e.storeSplitMergeInfo=e.loadSplitMergeInfo=e.storeLibRef=e.loadLibRef=e.storeSimpleLibrary=void 0;var t=sl();Object.defineProperty(e,"internal",{enumerable:!0,get:function(){return t.internal}}),Object.defineProperty(e,"external",{enumerable:!0,get:function(){return t.external}}),Object.defineProperty(e,"comment",{enumerable:!0,get:function(){return t.comment}});var n=ml();Object.defineProperty(e,"loadAccount",{enumerable:!0,get:function(){return n.loadAccount}}),Object.defineProperty(e,"storeAccount",{enumerable:!0,get:function(){return n.storeAccount}});var r=cl();Object.defineProperty(e,"loadAccountState",{enumerable:!0,get:function(){return r.loadAccountState}}),Object.defineProperty(e,"storeAccountState",{enumerable:!0,get:function(){return r.storeAccountState}});var i=hl();Object.defineProperty(e,"loadAccountStatus",{enumerable:!0,get:function(){return i.loadAccountStatus}}),Object.defineProperty(e,"storeAccountStatus",{enumerable:!0,get:function(){return i.storeAccountStatus}});var a=gl();Object.defineProperty(e,"loadAccountStatusChange",{enumerable:!0,get:function(){return a.loadAccountStatusChange}}),Object.defineProperty(e,"storeAccountStatusChange",{enumerable:!0,get:function(){return a.storeAccountStatusChange}});var o=ul();Object.defineProperty(e,"loadAccountStorage",{enumerable:!0,get:function(){return o.loadAccountStorage}}),Object.defineProperty(e,"storeAccountStorage",{enumerable:!0,get:function(){return o.storeAccountStorage}});var s=bl();Object.defineProperty(e,"loadOutAction",{enumerable:!0,get:function(){return s.loadOutAction}}),Object.defineProperty(e,"storeOutAction",{enumerable:!0,get:function(){return s.storeOutAction}}),Object.defineProperty(e,"loadOutList",{enumerable:!0,get:function(){return s.loadOutList}}),Object.defineProperty(e,"storeOutList",{enumerable:!0,get:function(){return s.storeOutList}});var c=xl();Object.defineProperty(e,"loadCommonMessageInfo",{enumerable:!0,get:function(){return c.loadCommonMessageInfo}}),Object.defineProperty(e,"storeCommonMessageInfo",{enumerable:!0,get:function(){return c.storeCommonMessageInfo}});var l=_l();Object.defineProperty(e,"loadCommonMessageInfoRelaxed",{enumerable:!0,get:function(){return l.loadCommonMessageInfoRelaxed}}),Object.defineProperty(e,"storeCommonMessageInfoRelaxed",{enumerable:!0,get:function(){return l.storeCommonMessageInfoRelaxed}});var u=Sl();Object.defineProperty(e,"loadComputeSkipReason",{enumerable:!0,get:function(){return u.loadComputeSkipReason}}),Object.defineProperty(e,"storeComputeSkipReason",{enumerable:!0,get:function(){return u.storeComputeSkipReason}});var d=ll();Object.defineProperty(e,"loadCurrencyCollection",{enumerable:!0,get:function(){return d.loadCurrencyCollection}}),Object.defineProperty(e,"storeCurrencyCollection",{enumerable:!0,get:function(){return d.storeCurrencyCollection}});var f=Cl();Object.defineProperty(e,"loadDepthBalanceInfo",{enumerable:!0,get:function(){return f.loadDepthBalanceInfo}}),Object.defineProperty(e,"storeDepthBalanceInfo",{enumerable:!0,get:function(){return f.storeDepthBalanceInfo}});var p=ol();Object.defineProperty(e,"packExtraCurrencyCell",{enumerable:!0,get:function(){return p.packExtraCurrencyCell}}),Object.defineProperty(e,"packExtraCurrencyDict",{enumerable:!0,get:function(){return p.packExtraCurrencyDict}}),Object.defineProperty(e,"loadExtraCurrency",{enumerable:!0,get:function(){return p.loadExtraCurrency}}),Object.defineProperty(e,"loadMaybeExtraCurrency",{enumerable:!0,get:function(){return p.loadMaybeExtraCurrency}}),Object.defineProperty(e,"storeExtraCurrency",{enumerable:!0,get:function(){return p.storeExtraCurrency}});var m=wl();Object.defineProperty(e,"loadHashUpdate",{enumerable:!0,get:function(){return m.loadHashUpdate}}),Object.defineProperty(e,"storeHashUpdate",{enumerable:!0,get:function(){return m.storeHashUpdate}});var h=Tl();Object.defineProperty(e,"loadMasterchainStateExtra",{enumerable:!0,get:function(){return h.loadMasterchainStateExtra}});var g=El();Object.defineProperty(e,"loadMessage",{enumerable:!0,get:function(){return g.loadMessage}}),Object.defineProperty(e,"storeMessage",{enumerable:!0,get:function(){return g.storeMessage}});var _=vl();Object.defineProperty(e,"loadMessageRelaxed",{enumerable:!0,get:function(){return _.loadMessageRelaxed}}),Object.defineProperty(e,"storeMessageRelaxed",{enumerable:!0,get:function(){return _.storeMessageRelaxed}});var v=Dl();Object.defineProperty(e,"SendMode",{enumerable:!0,get:function(){return v.SendMode}});var y=Ol();Object.defineProperty(e,"ReserveMode",{enumerable:!0,get:function(){return y.ReserveMode}});var b=kl();Object.defineProperty(e,"loadShardAccount",{enumerable:!0,get:function(){return b.loadShardAccount}}),Object.defineProperty(e,"storeShardAccount",{enumerable:!0,get:function(){return b.storeShardAccount}});var x=Al();Object.defineProperty(e,"ShardAccountRefValue",{enumerable:!0,get:function(){return x.ShardAccountRefValue}}),Object.defineProperty(e,"loadShardAccounts",{enumerable:!0,get:function(){return x.loadShardAccounts}}),Object.defineProperty(e,"storeShardAccounts",{enumerable:!0,get:function(){return x.storeShardAccounts}});var S=jl();Object.defineProperty(e,"loadShardIdent",{enumerable:!0,get:function(){return S.loadShardIdent}}),Object.defineProperty(e,"storeShardIdent",{enumerable:!0,get:function(){return S.storeShardIdent}});var C=Ml();Object.defineProperty(e,"loadShardStateUnsplit",{enumerable:!0,get:function(){return C.loadShardStateUnsplit}});var w=Qc();Object.defineProperty(e,"loadSimpleLibrary",{enumerable:!0,get:function(){return w.loadSimpleLibrary}}),Object.defineProperty(e,"storeSimpleLibrary",{enumerable:!0,get:function(){return w.storeSimpleLibrary}});var T=yl();Object.defineProperty(e,"loadLibRef",{enumerable:!0,get:function(){return T.loadLibRef}}),Object.defineProperty(e,"storeLibRef",{enumerable:!0,get:function(){return T.storeLibRef}});var ee=Nl();Object.defineProperty(e,"loadSplitMergeInfo",{enumerable:!0,get:function(){return ee.loadSplitMergeInfo}}),Object.defineProperty(e,"storeSplitMergeInfo",{enumerable:!0,get:function(){return ee.storeSplitMergeInfo}});var E=el();Object.defineProperty(e,"loadStateInit",{enumerable:!0,get:function(){return E.loadStateInit}}),Object.defineProperty(e,"storeStateInit",{enumerable:!0,get:function(){return E.storeStateInit}});var D=pl();Object.defineProperty(e,"loadStorageInfo",{enumerable:!0,get:function(){return D.loadStorageInfo}}),Object.defineProperty(e,"storeStorageInfo",{enumerable:!0,get:function(){return D.storeStorageInfo}});var O=fl();Object.defineProperty(e,"loadStorageUsed",{enumerable:!0,get:function(){return O.loadStorageUsed}}),Object.defineProperty(e,"storeStorageUsed",{enumerable:!0,get:function(){return O.storeStorageUsed}});var te=$c();Object.defineProperty(e,"loadTickTock",{enumerable:!0,get:function(){return te.loadTickTock}}),Object.defineProperty(e,"storeTickTock",{enumerable:!0,get:function(){return te.storeTickTock}});var ne=Bl();Object.defineProperty(e,"loadTransaction",{enumerable:!0,get:function(){return ne.loadTransaction}}),Object.defineProperty(e,"storeTransaction",{enumerable:!0,get:function(){return ne.storeTransaction}});var re=Pl();Object.defineProperty(e,"loadTransactionActionPhase",{enumerable:!0,get:function(){return re.loadTransactionActionPhase}}),Object.defineProperty(e,"storeTransactionActionPhase",{enumerable:!0,get:function(){return re.storeTransactionActionPhase}});var ie=Fl();Object.defineProperty(e,"loadTransactionBouncePhase",{enumerable:!0,get:function(){return ie.loadTransactionBouncePhase}}),Object.defineProperty(e,"storeTransactionBouncePhase",{enumerable:!0,get:function(){return ie.storeTransactionBouncePhase}});var ae=Il();Object.defineProperty(e,"loadTransactionComputePhase",{enumerable:!0,get:function(){return ae.loadTransactionComputePhase}}),Object.defineProperty(e,"storeTransactionComputePhase",{enumerable:!0,get:function(){return ae.storeTransactionComputePhase}});var oe=Ll();Object.defineProperty(e,"loadTransactionCreditPhase",{enumerable:!0,get:function(){return oe.loadTransactionCreditPhase}}),Object.defineProperty(e,"storeTransactionCreditPhase",{enumerable:!0,get:function(){return oe.storeTransactionCreditPhase}});var se=zl();Object.defineProperty(e,"loadTransactionDescription",{enumerable:!0,get:function(){return se.loadTransactionDescription}}),Object.defineProperty(e,"storeTransactionDescription",{enumerable:!0,get:function(){return se.storeTransactionDescription}});var ce=Rl();Object.defineProperty(e,"loadTransactionStoragePhase",{enumerable:!0,get:function(){return ce.loadTransactionStoragePhase}}),Object.defineProperty(e,"storeTransactionsStoragePhase",{enumerable:!0,get:function(){return ce.storeTransactionsStoragePhase}})})),Hl=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.openContract=void 0;var t=bc(),n=Zc();function r(e,r){let i,a=null;if(!t.Address.isAddress(e.address))throw Error(`Invalid address`);if(i=e.address,e.init){if(!(e.init.code instanceof n.Cell))throw Error(`Invalid init.code`);if(!(e.init.data instanceof n.Cell))throw Error(`Invalid init.data`);a=e.init}let o=r({address:i,init:a});return new Proxy(e,{get(e,t){let n=e[t];return typeof t==`string`&&(t.startsWith(`get`)||t.startsWith(`send`)||t.startsWith(`is`))&&typeof n==`function`?(...t)=>n.apply(e,[o,...t]):n}})}e.openContract=r})),Ul=e((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ComputeError=void 0,e.ComputeError=class e extends Error{constructor(t,n,r){super(t),this.exitCode=n,this.debugLogs=r&&r.debugLogs?r.debugLogs:null,this.logs=r&&r.logs?r.logs:null,Object.setPrototypeOf(this,e.prototype)}}})),Wl=e((e=>{k(),Object.defineProperty(e,"__esModule",{value:!0}),e.getMethodId=void 0;var t=new Int16Array([0,4129,8258,12387,16516,20645,24774,28903,33032,37161,41290,45419,49548,53677,57806,61935,4657,528,12915,8786,21173,17044,29431,25302,37689,33560,45947,41818,54205,50076,62463,58334,9314,13379,1056,5121,25830,29895,17572,21637,42346,46411,34088,38153,58862,62927,50604,54669,13907,9842,5649,1584,30423,26358,22165,18100,46939,42874,38681,34616,63455,59390,55197,51132,18628,22757,26758,30887,2112,6241,10242,14371,51660,55789,59790,63919,35144,39273,43274,47403,23285,19156,31415,27286,6769,2640,14899,10770,56317,52188,64447,60318,39801,35672,47931,43802,27814,31879,19684,23749,11298,15363,3168,7233,60846,64911,52716,56781,44330,48395,36200,40265,32407,28342,24277,20212,15891,11826,7761,3696,65439,61374,57309,53244,48923,44858,40793,36728,37256,33193,45514,41451,53516,49453,61774,57711,4224,161,12482,8419,20484,16421,28742,24679,33721,37784,41979,46042,49981,54044,58239,62302,689,4752,8947,13010,16949,21012,25207,29270,46570,42443,38312,34185,62830,58703,54572,50445,13538,9411,5280,1153,29798,25671,21540,17413,42971,47098,34713,38840,59231,63358,50973,55100,9939,14066,1681,5808,26199,30326,17941,22068,55628,51565,63758,59695,39368,35305,47498,43435,22596,18533,30726,26663,6336,2273,14466,10403,52093,56156,60223,64286,35833,39896,43963,48026,19061,23124,27191,31254,2801,6864,10931,14994,64814,60687,56684,52557,48554,44427,40424,36297,31782,27655,23652,19525,15522,11395,7392,3265,61215,65342,53085,57212,44955,49082,36825,40952,28183,32310,20053,24180,11923,16050,3793,7920]);function n(e){e instanceof A||(e=A.from(e));let n=0;for(let r=0;r<e.length;r++){let i=e[r];n=(t[(n>>8^i)&255]^n<<8)&65535}return n}function r(e){return n(e)&65535|65536}e.getMethodId=r})),Gl=e((e=>{k(),Object.defineProperty(e,"__esModule",{value:!0}),e.safeSignVerify=e.safeSign=void 0;var t=ye(),n=8,r=64;function i(e,i){let a=A.from(i);if(a.length>r)throw Error(`Seed can be longer than 64 bytes`);if(a.length<n)throw Error(`Seed must be at least 8 bytes`);return(0,t.sha256_sync)(A.concat([A.from([255,255]),a,e.hash()]))}function a(e,n,r=`ton-safe-sign-magic`){return(0,t.sign)(i(e,r),n)}e.safeSign=a;function o(e,n,r,a=`ton-safe-sign-magic`){return(0,t.signVerify)(i(e,a),n,r)}e.safeSignVerify=o})),Kl=e((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__exportStar||function(e,n){for(var r in e)r!=="default"&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,"__esModule",{value:!0}),e.safeSignVerify=e.safeSign=e.getMethodId=e.base32Encode=e.base32Decode=e.crc32c=e.crc16=e.fromNano=e.toNano=e.ComputeError=e.openContract=e.TupleBuilder=e.TupleReader=e.serializeTupleItem=e.parseTupleItem=e.serializeTuple=e.parseTuple=e.generateMerkleUpdate=e.generateMerkleProofDirect=e.generateMerkleProof=e.exoticPruned=e.exoticMerkleUpdate=e.convertToMerkleProof=e.exoticMerkleProof=e.Dictionary=e.Cell=e.CellType=e.Slice=e.beginCell=e.Builder=e.BitBuilder=e.BitReader=e.BitString=e.contractAddress=e.ADNLAddress=e.ExternalAddress=e.address=e.Address=void 0;var r=bc();Object.defineProperty(e,"Address",{enumerable:!0,get:function(){return r.Address}}),Object.defineProperty(e,"address",{enumerable:!0,get:function(){return r.address}});var i=xc();Object.defineProperty(e,"ExternalAddress",{enumerable:!0,get:function(){return i.ExternalAddress}});var a=Cc();Object.defineProperty(e,"ADNLAddress",{enumerable:!0,get:function(){return a.ADNLAddress}});var o=tl();Object.defineProperty(e,"contractAddress",{enumerable:!0,get:function(){return o.contractAddress}});var s=Tc();Object.defineProperty(e,"BitString",{enumerable:!0,get:function(){return s.BitString}});var c=kc();Object.defineProperty(e,"BitReader",{enumerable:!0,get:function(){return c.BitReader}});var l=Ec();Object.defineProperty(e,"BitBuilder",{enumerable:!0,get:function(){return l.BitBuilder}});var u=$();Object.defineProperty(e,"Builder",{enumerable:!0,get:function(){return u.Builder}}),Object.defineProperty(e,"beginCell",{enumerable:!0,get:function(){return u.beginCell}});var d=zc();Object.defineProperty(e,"Slice",{enumerable:!0,get:function(){return d.Slice}});var f=Dc();Object.defineProperty(e,"CellType",{enumerable:!0,get:function(){return f.CellType}});var p=Zc();Object.defineProperty(e,"Cell",{enumerable:!0,get:function(){return p.Cell}});var m=Lc();Object.defineProperty(e,"Dictionary",{enumerable:!0,get:function(){return m.Dictionary}});var h=Ac();Object.defineProperty(e,"exoticMerkleProof",{enumerable:!0,get:function(){return h.exoticMerkleProof}}),Object.defineProperty(e,"convertToMerkleProof",{enumerable:!0,get:function(){return h.convertToMerkleProof}});var g=Vc();Object.defineProperty(e,"exoticMerkleUpdate",{enumerable:!0,get:function(){return g.exoticMerkleUpdate}});var _=Uc();Object.defineProperty(e,"exoticPruned",{enumerable:!0,get:function(){return _.exoticPruned}});var v=jc();Object.defineProperty(e,"generateMerkleProof",{enumerable:!0,get:function(){return v.generateMerkleProof}}),Object.defineProperty(e,"generateMerkleProofDirect",{enumerable:!0,get:function(){return v.generateMerkleProofDirect}});var y=Mc();Object.defineProperty(e,"generateMerkleUpdate",{enumerable:!0,get:function(){return y.generateMerkleUpdate}});var b=nl();Object.defineProperty(e,"parseTuple",{enumerable:!0,get:function(){return b.parseTuple}}),Object.defineProperty(e,"serializeTuple",{enumerable:!0,get:function(){return b.serializeTuple}}),Object.defineProperty(e,"parseTupleItem",{enumerable:!0,get:function(){return b.parseTupleItem}}),Object.defineProperty(e,"serializeTupleItem",{enumerable:!0,get:function(){return b.serializeTupleItem}});var x=rl();Object.defineProperty(e,"TupleReader",{enumerable:!0,get:function(){return x.TupleReader}});var S=il();Object.defineProperty(e,"TupleBuilder",{enumerable:!0,get:function(){return S.TupleBuilder}}),n(Vl(),e);var C=Hl();Object.defineProperty(e,"openContract",{enumerable:!0,get:function(){return C.openContract}});var w=Ul();Object.defineProperty(e,"ComputeError",{enumerable:!0,get:function(){return w.ComputeError}});var T=al();Object.defineProperty(e,"toNano",{enumerable:!0,get:function(){return T.toNano}}),Object.defineProperty(e,"fromNano",{enumerable:!0,get:function(){return T.fromNano}});var ee=yc();Object.defineProperty(e,"crc16",{enumerable:!0,get:function(){return ee.crc16}});var E=Yc();Object.defineProperty(e,"crc32c",{enumerable:!0,get:function(){return E.crc32c}});var D=Sc();Object.defineProperty(e,"base32Decode",{enumerable:!0,get:function(){return D.base32Decode}}),Object.defineProperty(e,"base32Encode",{enumerable:!0,get:function(){return D.base32Encode}});var O=Wl();Object.defineProperty(e,"getMethodId",{enumerable:!0,get:function(){return O.getMethodId}});var te=Gl();Object.defineProperty(e,"safeSign",{enumerable:!0,get:function(){return te.safeSign}}),Object.defineProperty(e,"safeSignVerify",{enumerable:!0,get:function(){return te.safeSignVerify}})}));k();var ql=Kl(),Jl=({amount:e,recipient:t,family:n,fees:r,comment:i,payload:a})=>({amount:e.toString(),recipient:t,family:n,fees:r.toString(),comment:i,payload:a?Ql(a):void 0}),Yl=({amount:e,recipient:t,family:n,fees:r,comment:i,payload:a})=>({amount:new P(e),recipient:t,family:n,fees:new P(r),comment:i,payload:a?Zl(a):void 0}),Xl=e=>{try{return ql.Cell.fromBase64(e)}catch{return A.from(e,`hex`)}},Zl=e=>{switch(e.type){case`unsafe`:return{type:e.type,message:ql.Cell.fromBase64(e.message)};case`jetton-transfer`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,amount:BigInt(e.amount),destination:ql.Address.parse(e.destination),responseDestination:ql.Address.parse(e.responseDestination),customPayload:e.customPayload?ql.Cell.fromBase64(e.customPayload):null,forwardAmount:BigInt(e.forwardAmount),forwardPayload:e.forwardPayload?ql.Cell.fromBase64(e.forwardPayload):null,knownJetton:e.knownJetton};case`nft-transfer`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,newOwner:ql.Address.parse(e.newOwner),responseDestination:ql.Address.parse(e.responseDestination),customPayload:e.customPayload?ql.Cell.fromBase64(e.customPayload):null,forwardAmount:BigInt(e.forwardAmount),forwardPayload:e.forwardPayload?ql.Cell.fromBase64(e.forwardPayload):null};case`jetton-burn`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,amount:BigInt(e.amount),responseDestination:ql.Address.parse(e.responseDestination),customPayload:e.customPayload?Xl(e.customPayload):null};case`add-whitelist`:case`single-nominator-change-validator`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,address:ql.Address.parse(e.address)};case`single-nominator-withdraw`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,amount:BigInt(e.amount)};case`tonstakers-deposit`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,appId:e.appId?BigInt(e.appId):null};case`vote-for-proposal`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,votingAddress:ql.Address.parse(e.votingAddress),expirationDate:e.expirationDate,vote:e.vote,needConfirmation:e.needConfirmation};case`change-dns-record`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,record:e.record.type===`wallet`?{type:e.record.type,value:e.record.value?{address:ql.Address.parse(e.record.value.address),capabilities:e.record.value.capabilities}:null}:{type:e.record.type,key:A.from(e.record.key,`hex`),value:e.record.value?ql.Cell.fromBase64(e.record.value):null}};case`token-bridge-pay-swap`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,swapId:A.from(e.swapId,`hex`)};case`tonwhales-pool-deposit`:return{type:e.type,queryId:BigInt(e.queryId),gasLimit:BigInt(e.gasLimit)};case`tonwhales-pool-withdraw`:return{type:e.type,queryId:BigInt(e.queryId),gasLimit:BigInt(e.gasLimit),amount:BigInt(e.amount)};case`vesting-send-msg-comment`:return{type:e.type,queryId:e.queryId?BigInt(e.queryId):null,sendMode:e.sendMode,value:BigInt(e.value),destination:ql.Address.parse(e.destination),text:e.text};case`comment`:return e;default:return e}},Ql=e=>{switch(e.type){case`unsafe`:return{type:e.type,message:e.message.toBoc().toString(`base64`)};case`jetton-transfer`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,amount:e.amount.toString(),destination:e.destination.toRawString(),responseDestination:e.responseDestination.toRawString(),customPayload:e.customPayload?e.customPayload.toBoc().toString(`base64`):null,forwardAmount:e.forwardAmount.toString(),forwardPayload:e.forwardPayload?e.forwardPayload.toBoc().toString(`base64`):null,knownJetton:e.knownJetton};case`nft-transfer`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,newOwner:e.newOwner.toRawString(),responseDestination:e.responseDestination.toRawString(),customPayload:e.customPayload?e.customPayload.toBoc().toString(`base64`):null,forwardAmount:e.forwardAmount.toString(),forwardPayload:e.forwardPayload?e.forwardPayload.toBoc().toString(`base64`):null};case`jetton-burn`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,amount:e.amount.toString(),responseDestination:e.responseDestination.toRawString(),customPayload:e.customPayload&&`toBoc`in e.customPayload?e.customPayload.toBoc().toString(`base64`):e.customPayload?e.customPayload.toString(`hex`):null};case`add-whitelist`:case`single-nominator-change-validator`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,address:e.address.toRawString()};case`single-nominator-withdraw`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,amount:e.amount.toString()};case`tonstakers-deposit`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,appId:typeof e.appId==`bigint`?e.appId.toString():null};case`vote-for-proposal`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,votingAddress:e.votingAddress.toRawString(),expirationDate:e.expirationDate,vote:e.vote,needConfirmation:e.needConfirmation};case`change-dns-record`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,record:e.record.type===`wallet`?{type:e.record.type,value:e.record.value?{address:e.record.value.address.toRawString(),capabilities:e.record.value.capabilities}:null}:{type:e.record.type,key:e.record.key.toString(`hex`),value:e.record.value?e.record.value.toBoc().toString(`base64`):null}};case`token-bridge-pay-swap`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,swapId:e.swapId.toString(`hex`)};case`tonwhales-pool-deposit`:return{type:e.type,queryId:e.queryId.toString(),gasLimit:e.gasLimit.toString()};case`tonwhales-pool-withdraw`:return{type:e.type,queryId:e.queryId.toString(),gasLimit:e.gasLimit.toString(),amount:e.amount.toString()};case`vesting-send-msg-comment`:return{type:e.type,queryId:typeof e.queryId==`bigint`?e.queryId.toString():null,sendMode:e.sendMode,value:e.value.toString(),destination:e.destination.toRawString(),text:e.text};case`comment`:return e;default:return e}},$l=({amount:e,recipient:t,family:n,mode:r,resource:i,duration:a,votes:o})=>({amount:e.toString(),recipient:t,family:n,mode:r,resource:i,duration:a,votes:o}),eu=({amount:e,recipient:t,family:n,mode:r,resource:i,duration:a,votes:o})=>({amount:new P(e),recipient:t,family:n,mode:r,resource:i,duration:a,votes:o});function tu({amount:e,data:t,family:n,fees:r,gasLimit:i,mode:a,recipient:o}){return{family:n,amount:e.toString(),recipient:o,mode:a,fees:r?r.toString():void 0,data:t,gasLimit:i}}function nu({amount:e,data:t,family:n,fees:r,gasLimit:i,mode:a,recipient:o}){return{family:n,mode:a,amount:new P(e),recipient:o,fees:r?new P(r):void 0,data:t,gasLimit:i}}function ru({amount:e,family:t,fees:n,memo:r,mode:i,recipient:a}){return{amount:e.toString(),family:t,fees:n?n.toString():void 0,memo:r,mode:i,recipient:a}}function iu({amount:e,family:t,fees:n,memo:r,mode:i,recipient:a}){return{amount:new P(e),family:t,fees:n?new P(n):void 0,memo:r,mode:i,recipient:a}}function au({amount:e,family:t,model:n,recipient:r,raw:i}){return{amount:e.toString(),family:t,model:JSON.stringify(n),recipient:r,raw:i}}function ou({family:e,amount:t,model:n,recipient:r,raw:i}){return{amount:new P(t),family:e,model:JSON.parse(n),recipient:r,raw:i}}var su=({amount:e,recipient:t,family:n,estimatedFees:r,body:i})=>({amount:e.toString(),recipient:t,family:n,estimatedFees:r,body:i}),cu=({amount:e,recipient:t,family:n,estimatedFees:r,body:i})=>({amount:new P(e),recipient:t,family:n,estimatedFees:r,body:i}),lu=({amount:e,recipient:t,family:n,fee:r,nonce:i,memo:a,network:o,anchorMode:s})=>({amount:e.toString(),recipient:t,family:n,fee:r?.toString(),nonce:i?.toString(),memo:a,network:o,anchorMode:s}),uu=({amount:e,recipient:t,family:n,fee:r,nonce:i,memo:a,network:o,anchorMode:s})=>({amount:new P(e),recipient:t,family:n,fee:r?new P(r):void 0,nonce:i?new P(i):void 0,memo:a,network:o===`mainnet`?o:`testnet`,anchorMode:s}),du=({amount:e,recipient:t,family:n,fees:r,memo:i})=>({amount:e.toFixed(),recipient:t,family:n,fees:r.toString(),memo:i}),fu=({amount:e,recipient:t,family:n,fees:r,memo:i})=>({amount:new P(e),recipient:t,family:n,fees:new P(r),memo:i}),pu=({amount:e,recipient:t,family:n,fees:r,transferId:i})=>({amount:e.toFixed(),recipient:t,family:n,fees:r.toString(),transferId:i}),mu=({amount:e,recipient:t,family:n,fees:r,transferId:i})=>({amount:new P(e),recipient:t,family:n,fees:new P(r),transferId:i});function hu({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:e.toString(),recipient:t,family:n,mode:r,fees:i?.toString()}}function gu({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:new P(e),recipient:t,family:n,mode:r,fees:i?new P(i):void 0}}function _u({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:e.toString(),recipient:t,family:n,mode:r,fees:i.toString()}}function vu({amount:e,recipient:t,family:n,mode:r,fees:i}){return{amount:new P(e),recipient:t,family:n,mode:r,fees:new P(i)}}function yu(e){switch(e.family){case`ethereum`:return Qs(e);case`bitcoin`:return Ws(e);case`algorand`:return Bs(e);case`aptos`:return Hs(e);case`crypto_org`:return Xs(e);case`ripple`:return fc(e);case`celo`:return Ks(e);case`cosmos`:return Js(e);case`hedera`:return nc(e);case`kaspa`:return ic(e);case`filecoin`:return oc(e);case`tezos`:return gc(e);case`polkadot`:return uc(e);case`stellar`:return mc(e);case`ton`:return Jl(e);case`tron`:return $l(e);case`near`:return ec(e);case`neo`:return cc(e);case`elrond`:return tu(e);case`cardano`:return ru(e);case`solana`:return au(e);case`vechain`:return su(e);case`stacks`:return lu(e);case`internet_computer`:return du(e);case`casper`:return pu(e);case`sui`:return hu(e);case`aleo`:return _u(e);default:return e}}function bu(e){switch(e.family){case`ethereum`:return $s(e);case`bitcoin`:return Gs(e);case`algorand`:return Vs(e);case`aptos`:return Us(e);case`crypto_org`:return Zs(e);case`ripple`:return pc(e);case`celo`:return qs(e);case`cosmos`:return Ys(e);case`hedera`:return rc(e);case`kaspa`:return ac(e);case`filecoin`:return sc(e);case`tezos`:return _c(e);case`polkadot`:return dc(e);case`stellar`:return hc(e);case`ton`:return Yl(e);case`tron`:return eu(e);case`near`:return tc(e);case`neo`:return lc(e);case`elrond`:return nu(e);case`cardano`:return iu(e);case`solana`:return ou(e);case`vechain`:return cu(e);case`stacks`:return uu(e);case`internet_computer`:return fu(e);case`casper`:return mu(e);case`sui`:return gu(e);case`aleo`:return vu(e);default:return e}}var xu=Y([`send`,`optIn`,`claimReward`,`optOut`]),Su=Z.extend({family:X(Q.enum.algorand),mode:xu,fees:H().optional(),assetId:H().optional(),memo:H().optional()}),Cu=Y([`send`]),wu=Z.extend({family:X(Q.enum.aptos),mode:Cu,fees:H().optional()}),Tu=Z.extend({family:X(Q.enum.bitcoin),feePerByte:H().optional(),opReturnDataHex:H().max(160).optional(),changeAddress:H().optional()}),Eu=Y([`send`,`lock`,`unlock`,`withdraw`,`vote`,`revoke`,`activate`,`register`]),Du=Z.extend({family:X(Q.enum.celo),fees:H().optional().nullable(),mode:Eu,index:W().optional().nullable()}),Ou=Y([`send`,`delegate`,`undelegate`,`redelegate`,`claimReward`,`claimRewardCompound`]),ku=q({address:H(),amount:H()}),Au=Z.extend({family:X(Q.enum.cosmos),mode:Ou,fees:H().optional(),gas:H().optional(),memo:H().optional(),sourceValidator:H().optional(),validators:K(ku).optional()}),ju=Z.extend({family:X(Q.enum.crypto_org),mode:H(),fees:H().optional()}),Mu=Z.extend({family:X(Q.enum.ethereum),nonce:W().optional(),data:H().optional(),gasPrice:H().optional(),gasLimit:H().optional(),maxPriorityFeePerGas:H().optional(),maxFeePerGas:H().optional(),sponsored:Ho().optional()}),Nu=Z.extend({family:X(Q.enum.near),mode:H(),fees:H().optional()}),Pu=Z.extend({family:X(Q.enum.neo)}),Fu=Y([`send`,`bond`,`unbond`,`rebond`,`withdrawUnbonded`,`setController`,`nominate`,`chill`,`claimReward`]),Iu=Y([`Staked`,`Stash`,`Controller`,`Account`,`None`]),Lu=Z.extend({family:X(Q.enum.polkadot),mode:Fu,fee:H().optional(),era:W().optional(),validators:K(H()).optional(),rewardDestination:Iu.optional(),numOfSlashingSpans:W().optional()}),Ru=Z.extend({family:X(Q.enum.ripple),fee:H().optional(),tag:W()}),zu=Z.extend({family:X(Q.enum.solana),model:H(),raw:ms(H())}),Bu=Y([`MEMO_TEXT`,`MEMO_ID`,`MEMO_HASH`,`MEMO_RETURN`]),Vu=Z.extend({family:X(Q.enum.stellar),fees:H().optional(),memoType:Bu.optional(),memoValue:H().optional()}),Hu=Y([`send`,`delegate`,`undelegate`]),Uu=Z.extend({family:X(Q.enum.tezos),mode:Hu,fees:H().optional(),gasLimit:H().optional()}),Wu=q({isEncrypted:Ho(),text:H()}),Gu=q({type:X(`jetton-transfer`),queryId:J([H(),G()]),amount:H(),destination:H(),responseDestination:H(),customPayload:J([H(),G()]),forwardAmount:H(),forwardPayload:J([H(),G()]),knownJetton:J([q({jettonId:W(),workchain:W()}),G()])}),Ku=q({type:X(`nft-transfer`),queryId:J([H(),G()]),newOwner:H(),responseDestination:H(),customPayload:J([H(),G()]),forwardAmount:H(),forwardPayload:J([H(),G()])}),qu=J([q({type:X(`comment`),text:H()}),Gu,Ku,q({type:X(`unsafe`),message:H()}),q({type:X(`jetton-burn`),queryId:J([H(),G()]),amount:H(),responseDestination:H(),customPayload:J([H(),G()])}),q({type:X(`add-whitelist`),queryId:J([H(),G()]),address:H()}),q({type:X(`single-nominator-withdraw`),queryId:J([H(),G()]),amount:H()}),q({type:X(`single-nominator-change-validator`),queryId:J([H(),G()]),address:H()}),q({type:X(`tonstakers-deposit`),queryId:J([H(),G()]),appId:J([H(),G()])}),q({type:X(`vote-for-proposal`),queryId:J([H(),G()]),votingAddress:H(),expirationDate:W(),vote:Ho(),needConfirmation:Ho()}),q({type:X(`change-dns-record`),queryId:J([H(),G()]),record:J([q({type:X(`wallet`),value:J([q({address:H(),capabilities:J([q({isWallet:Ho()}),G()])}),G()])}),q({type:X(`unknown`),key:H(),value:J([H(),G()])})])}),q({type:X(`token-bridge-pay-swap`),queryId:J([H(),G()]),swapId:H()}),q({type:X(`tonwhales-pool-deposit`),queryId:H(),gasLimit:H()}),q({type:X(`tonwhales-pool-withdraw`),queryId:H(),gasLimit:H(),amount:H()}),q({type:X(`vesting-send-msg-comment`),queryId:J([H(),G()]),sendMode:W(),value:H(),destination:H(),text:H()})]),Ju=Z.extend({family:X(Q.enum.ton),fees:H(),comment:Wu,payload:qu.optional()}),Yu=Y([`send`,`freeze`,`unfreeze`,`vote`,`claimReward`,`withdrawExpireUnfreeze`,`unDelegateResource`,`legacyUnfreeze`]),Xu=Y([`BANDWIDTH`,`ENERGY`]),Zu=q({address:H(),voteCount:W()}),Qu=Z.extend({family:X(Q.enum.tron),mode:Yu,resource:Xu.optional(),duration:W().optional(),votes:K(Zu).default([])}),$u=Z.extend({family:X(Q.enum.hedera),memo:H().max(100).optional()}),ed=Z.extend({family:X(Q.enum.kaspa),customFeeRate:H().optional()}),td=Z.extend({data:H().optional(),family:X(Q.enum.filecoin),gasLimit:W(),gasFeeCap:H(),gasPremium:H(),method:W(),nonce:W(),params:H().optional(),version:W()});Y([`send`,`delegate`,`reDelegateRewards`,`unDelegate`,`claimRewards`,`withdraw`]);var nd=Z.extend({family:X(Q.enum.elrond),mode:J([X(`send`),X(`delegate`),X(`reDelegateRewards`),X(`unDelegate`),X(`claimRewards`),X(`withdraw`)]),fees:H().optional(),data:H().optional(),gasLimit:W()}),rd=Z.extend({family:X(Q.enum.cardano),fees:H().optional(),mode:H(),memo:H().optional()}),id=q({to:H().nullable(),value:J([H(),W()]),data:H(),comment:H().optional(),abi:H().optional()}),ad=q({chainTag:W(),blockRef:H(),expiration:W(),clauses:K(id),gasPriceCoef:W().optional(),gas:J([H(),W()]),dependsOn:H().nullable(),nonce:J([H(),W()]),maxFeePerGas:J([H(),W()]).optional(),maxPriorityFeePerGas:J([H(),W()]).optional(),reserved:q({features:W().optional(),unused:K(qo()).optional()}).optional()}),od=Z.extend({family:X(Q.enum.vechain),estimatedFees:H(),body:ad}),sd=Z.extend({family:X(Q.enum.stacks),fee:H().optional(),nonce:H().optional(),memo:H().optional(),network:H(),anchorMode:W()}),cd=Z.extend({family:X(Q.enum.internet_computer),fees:H(),memo:H().optional()}),ld=Z.extend({family:X(Q.enum.casper),fees:H(),transferId:H().optional()}),ud=Z.extend({family:X(Q.enum.sui),mode:H(),fees:H().optional()}),dd=Y([`transfer_public`]),fd=is(`family`,[Su,wu,Tu,Du,Au,ju,Mu,$u,ed,td,Nu,Pu,Lu,Ru,Vu,Uu,Ju,Qu,nd,rd,zu,od,sd,cd,ld,ud,Z.extend({family:X(Q.enum.aleo),mode:dd,fees:H()})]),pd=class{prefix=``;constructor(e){this.prefix=e?`[${e}] `:``}log(e,...t){}warn(e,...t){}debug(e,...t){}error(e,...t){}},md=new pd(`WindowMessage`),hd=class{target;logger;_onMessage;constructor(e=window,t=md){this.target=e,this.logger=t}connect=()=>{this.target.addEventListener(`message`,this._onMessageEvent,!1),this.target.document?.addEventListener(`message`,this._onMessageEvent,!1),this.logger.debug(`event listeners registered`)};disconnect=()=>{this.target.removeEventListener(`message`,this._onMessageEvent,!1),this.target.document?.removeEventListener(`message`,this._onMessageEvent,!1),this.logger.debug(`event listeners unregistered`)};_onMessageEvent=e=>{if(this._onMessage){if(this.logger.debug(`received message event`,e),e.data&&typeof e.data==`string`)try{let t=e.data;Date.now()>0?(this.logger.log(`received message`,t),this._onMessage(t)):this.logger.debug(`not a wallet API message`)}catch(e){this.logger.warn(`parse error`),e instanceof Error&&this._onMessage(e.message)}else this.logger.debug(`ignoring message same origin`)}else this.logger.debug(`no handler registered`)};set onMessage(e){this._onMessage=e}get onMessage(){return this._onMessage}send=e=>{try{this.target.ReactNativeWebView?(this.logger.log(`sending message (ReactNativeWebview)`,e),this.target.ReactNativeWebView.postMessage(e)):this.target.ElectronWebview?(this.logger.log(`sending message (ElectronWebview)`,e),this.target.ElectronWebview.postMessage(e)):(this.logger.log(`sending message`,e),this.target.top?.postMessage(e,`*`))}catch(e){throw this.logger.error(`unexpected error on send`,e),e}}},gd;(function(e){e.Slow=`slow`,e.Medium=`medium`,e.Fast=`fast`})(gd||={});var _d;(function(e){e.Blue=`blue`,e.NanoS=`nanoS`,e.NanoX=`nanoX`})(_d||={});var vd;(function(e){e[e.SWAP=0]=`SWAP`,e[e.SELL=1]=`SELL`,e[e.FUND=2]=`FUND`})(vd||={});var yd=Y([`NOT_IMPLEMENTED_BY_WALLET`,`ACCOUNT_NOT_FOUND`,`CURRENCY_NOT_FOUND`,`PERMISSION_DENIED`,`UNKNOWN_ERROR`,`UNAUTHORIZED_STORE`]),bd=q({code:X(yd.enum.NOT_IMPLEMENTED_BY_WALLET),message:H(),data:q({methodId:H()})}),xd=q({code:X(yd.enum.ACCOUNT_NOT_FOUND),message:H(),data:q({accountId:H()})}),Sd=q({code:X(yd.enum.CURRENCY_NOT_FOUND),message:H(),data:q({currencyId:H()})}),Cd=q({code:X(yd.enum.PERMISSION_DENIED),message:H(),data:q({methodId:H()})}),wd=q({name:H().optional(),message:H().optional(),stack:H().optional(),cause:Yo().optional(),code:H().optional()}),Td=is(`code`,[bd,xd,Sd,Cd,q({code:X(yd.enum.UNKNOWN_ERROR),message:H(),data:wd.passthrough()})]);function Ed(e){return{code:`UNKNOWN_ERROR`,message:`an unhandled error was thrown`,data:e}}var Dd=class extends Error{errorData;constructor(e){super(e.message),this.errorData=e}getCode(){return this.errorData.code}getData(){return this.errorData}};function Od(e){if(e instanceof Error){let t={name:e.name,message:e.message,stack:e.stack},{code:n,cause:r}=e;return typeof n==`string`&&(t.code=n),r!==void 0&&(t.cause=r),t}return typeof e==`string`?{message:e}:typeof e==`object`&&e?e:{}}function kd(e){if(!e||e.message===void 0&&e.name===void 0)return;let t=Error(e.message);return e.name&&(t.name=e.name),e.stack&&(t.stack=e.stack),e.code!==void 0&&(t.code=e.code),e.cause!==void 0&&(t.cause=e.cause),t}var Ad=class extends Error{err;constructor(e){super(e.message),this.err=e}getCode(){return this.err.code}getData(){return this.err.data}},jd;(function(e){e[e.PARSE_ERROR=-32700]=`PARSE_ERROR`,e[e.INVALID_REQUEST=-32600]=`INVALID_REQUEST`,e[e.METHOD_NOT_FOUND=-32601]=`METHOD_NOT_FOUND`,e[e.INVALID_PARAMS=-32602]=`INVALID_PARAMS`,e[e.INTERNAL_ERROR=-32603]=`INTERNAL_ERROR`,e[e.SERVER_ERROR=-32e3]=`SERVER_ERROR`})(jd||={});var Md=J([H(),W(),G()]),Nd=q({jsonrpc:X(`2.0`),method:H(),params:qo(),id:Md.optional()}).strict(),Pd=q({code:W(),message:H(),data:qo().optional()}).strict(),Fd=q({jsonrpc:X(`2.0`),id:Md,result:q({}).passthrough().optional()}).strict(),Id=J([Nd,J([q({jsonrpc:X(`2.0`),id:Md,error:Pd}).strict(),Fd])]);function Ld(e){try{let t=JSON.parse(e);return Id.parse(t)}catch(e){throw e instanceof SyntaxError?new Ad({code:jd.PARSE_ERROR,message:`parse error`}):e instanceof eo?new Ad({code:jd.INVALID_REQUEST,message:`invalid request`}):e}}function Rd(e){return{jsonrpc:`2.0`,...e}}var zd=class{transport;requestHandlers;ongoingRequests={};constructor(e,t){this.transport=e,this.requestHandlers=t,this.transport.onMessage=e=>{this.handleMessage(e)}}_request(e){return new Promise((t,n)=>{if(!e.id){n(Error(`requests need to have an id`));return}let r=e=>{if(`error`in e){if(e.error.code===jd.SERVER_ERROR){let t=Td.parse(e.error.data);if(t.code===`UNKNOWN_ERROR`){n(kd(t.data));return}n(new Dd(t));return}n(new Ad(e.error));return}t(e.result)};this.ongoingRequests[e.id]=r,this.transport.send(JSON.stringify(e))})}_notify(e){this.transport.send(JSON.stringify(e))}request(e,t){let n=crypto.randomUUID();return this._request({id:n,jsonrpc:`2.0`,method:e,params:t})}notify(e,t){return this._notify({jsonrpc:`2.0`,method:e,params:t})}async handleRpcRequest(e){try{let t=await this.onRequest(e);if(e.id){let n=Rd({id:e.id,result:t});this.transport.send(JSON.stringify(n))}}catch(e){throw e instanceof eo?new Ad({code:jd.INVALID_PARAMS,message:e.message,data:e.flatten()}):e instanceof Dd?new Ad({code:jd.SERVER_ERROR,message:`unexpected server error`,data:e.getData()}):e instanceof Ad?e:new Ad({code:jd.SERVER_ERROR,message:`unexpected server error`,data:Ed(Od(e))})}}async handleMessage(e){let t=!1,n;try{let r=Ld(e);n=r.id,`method`in r?await this.handleRpcRequest(r):(t=!0,this.handleRpcResponse(r))}catch(e){if(t)throw e;if(e instanceof Ad){let t=Rd({id:n??null,error:{code:e.getCode(),message:e.message,data:e.getData()}});this.transport.send(JSON.stringify(t));return}throw e}}handleRpcResponse(e){if(!e.id)return;let t=this.ongoingRequests[e.id];if(!t)throw Error(`no ongoingRequest ${e.id}`);t(e)}},Bd={params:q({accountId:H(),derivationPath:H().optional()}),result:q({publicKey:H()})},Vd={params:q({currencyIds:K(H()).optional()}).optional(),result:q({rawAccounts:K(Fs)})},Hd={params:q({accountId:H(),tokenCurrency:H().optional()}),result:q({address:H()})},Ud={params:q({currencyIds:K(H()).optional(),showAccountFilter:Ho().optional(),drawerConfiguration:q({assets:q({filter:H().optional(),leftElement:H().optional(),rightElement:H().optional()}).optional(),networks:q({leftElement:H().optional(),rightElement:H().optional()}).optional()}).optional(),useCase:H().optional(),uiUseCase:H().optional()}),result:q({rawAccount:Fs})},Wd={params:q({accountId:H(),derivationPath:H().optional()}),result:q({address:H()})},Gd={params:q({accountId:H(),intentions:K(Y([`payment`,`ordinal`])).optional()}),result:q({addresses:K(q({address:H(),publicKey:H().optional(),path:H().optional(),intention:H().optional()}))})},Kd={params:q({accountId:H(),derivationPath:H().optional()}),result:q({publicKey:H()})},qd={params:q({accountId:H()}),result:q({xPub:H()})},Jd={params:q({accountId:H(),psbt:H(),broadcast:Ho().optional()}),result:q({psbtSigned:H(),txHash:H().optional()})},Yd={params:q({currencyIds:K(H()).optional()}).optional(),result:q({currencies:K(zs)})},Xd=Y([`blue`,`nanoS`,`nanoSP`,`nanoX`,`stax`,`europa`,`apex`]),Zd={params:q({transportId:H()}),result:q({transportId:H()})},Qd={params:q({apduHex:H(),transportId:H()}),result:q({responseHex:H()})},$d={params:q({deviceId:H()}),result:q({transportId:H()})},ef={params:q({appName:H().optional(),allowManager:Ho().optional(),appVersionRange:H().optional(),firmwareVersionRange:H().optional(),seeded:Ho().optional(),devices:Xd.array().nonempty().optional()}),result:q({deviceId:H()})},tf={params:q({appName:H().optional(),allowManager:Ho().optional(),appVersionRange:H().optional(),firmwareVersionRange:H().optional(),seeded:Ho().optional(),devices:Xd.array().nonempty().optional()}),result:q({transportId:H()})},nf=Y([`SLOW`,`MEDIUM`,`FAST`,`CUSTOM`]),rf=q({provider:H(),fromAccountId:H(),rawTransaction:fd,hexBinaryPayload:H(),hexSignature:H(),feeStrategy:nf,tokenCurrency:H().optional()}),af={params:is(`exchangeType`,[rf.extend({exchangeType:X(`FUND`)}),rf.extend({exchangeType:X(`SELL`)}),rf.extend({exchangeType:X(`SWAP`),toAccountId:H(),swapId:H(),rate:W()})]),result:q({transactionHash:H()})},of={params:q({exchangeType:Y([`SWAP`,`SELL`,`FUND`,`SWAP_NG`,`SELL_NG`,`FUND_NG`])}),result:q({transactionId:H()})},sf=q({hwAppId:H().optional(),dependencies:K(H()).optional()}),cf={params:q({accountId:H(),hexMessage:H(),options:sf.optional(),meta:cs(H(),Yo()).optional()}),result:q({hexSignedMessage:H()})},lf={params:q({key:H().min(1),storeId:H().min(1).optional()}),result:q({value:H().optional()})},uf={params:q({key:H(),value:H(),storeId:H().optional()}),result:$o().optional()},df=q({hwAppId:H().optional(),dependencies:K(H()).optional()}),ff={params:q({accountId:H(),rawTransaction:fd,options:df.optional(),meta:cs(H(),Yo()).optional(),tokenCurrency:H().optional()}),result:q({signedTransactionHex:H()})},pf=q({hwAppId:H().optional(),dependencies:K(H()).optional()}),mf={params:q({accountId:H(),rawTransaction:fd,options:pf.optional(),meta:cs(H(),Yo()).optional(),tokenCurrency:H().optional()}),result:q({transactionHash:H()})},hf=q({hwAppId:H().optional(),dependencies:K(H()).optional()}),gf={params:q({accountId:H(),rawTransaction:H(),broadcast:Ho().optional(),options:hf.optional(),meta:cs(H(),Yo()).optional()}),result:q({signedTransactionHex:H(),transactionHash:H().optional()})},_f={params:q({}),result:q({methodIds:K(H())})},vf={params:q({}),result:q({tracking:Ho(),wallet:q({name:H(),version:H()})})},yf={params:q({}),result:q({userId:H()})};Y([`account.getPublicKey`,`account.list`,`account.receive`,`account.request`,`currency.list`,`device.close`,`device.exchange`,`device.transport`,`message.sign`,`transaction.sign`,`transaction.signRaw`,`transaction.signAndBroadcast`,`wallet.capabilities`,`wallet.info`,`wallet.userId`]),k();var bf=class e extends ge{walletApi;transportId;constructor(e,t){super(),this.transportId=t,this.walletApi=e}static isSupported=()=>Promise.resolve(!0);static list=()=>Promise.resolve([]);static listen=e=>({unsubscribe:()=>{}});static open({walletApi:t,transportId:n}){return Promise.resolve(new e(t,n))}async exchange(e){let t=e.toString(`hex`),n=await this.walletApi.request(`device.exchange`,{transportId:this.transportId,apduHex:t}),r=Qd.result.parse(n);return A.from(r.responseHex,`hex`)}setScrambleKey(){}async close(){let e=await this.walletApi.request(`device.close`,{transportId:this.transportId});Zd.result.parse(e)}},xf=class{client;constructor(e){this.client=e}async list(e){let t=await this.client.request(`account.list`,{currencyIds:e?.currencyIds});return Vd.result.parse(t).rawAccounts.map(Re)}async request(e){let t=await this.client.request(`account.request`,{currencyIds:e?.currencyIds,showAccountFilter:e?.showAccountFilter,drawerConfiguration:e?.drawerConfiguration,useCase:e?.useCase,uiUseCase:e?.uiUseCase});return Re(Ud.result.parse(t).rawAccount)}async receive(e){let t=await this.client.request(`account.receive`,{accountId:e});return Hd.result.parse(t).address}async getPublicKey(e,t){let n=await this.client.request(`account.getPublicKey`,{accountId:e,derivationPath:t});return Bd.result.parse(n).publicKey}},Sf=class{client;constructor(e){this.client=e}async getAddress(e,t){let n=await this.client.request(`bitcoin.getAddress`,{accountId:e,derivationPath:t});return Wd.result.parse(n).address}async getAddresses(e,t){let n=await this.client.request(`bitcoin.getAddresses`,{accountId:e,intentions:t});return Gd.result.parse(n).addresses}async getPublicKey(e,t){let n=await this.client.request(`bitcoin.getPublicKey`,{accountId:e,derivationPath:t});return Kd.result.parse(n).publicKey}async getXPub(e){let t=await this.client.request(`bitcoin.getXPub`,{accountId:e});return qd.result.parse(t).xPub}async signPsbt(e,t,n){let r=await this.client.request(`bitcoin.signPsbt`,{accountId:e,psbt:t,broadcast:n}),{psbtSigned:i,txHash:a}=Jd.result.parse(r);return{psbtSigned:i,txHash:a}}},Cf=class{client;constructor(e){this.client=e}async list(e){let t=await this.client.request(`currency.list`,{currencyIds:e?.currencyIds});return Yd.result.parse(t).currencies}},wf=class{client;constructor(e){this.client=e}async transport(e){let t=await this.client.request(`device.transport`,e),n=tf.result.parse(t);return bf.open({walletApi:this.client,transportId:n.transportId})}async open(e){let t=await this.client.request(`device.open`,e),n=$d.result.parse(t);return bf.open({walletApi:this.client,transportId:n.transportId})}async select(e){let t=await this.client.request(`device.select`,e);return ef.result.parse(t)}},Tf=class{client;constructor(e){this.client=e}async start(e){let t=await this.client.request(`exchange.start`,{exchangeType:e});return of.result.parse(t).transactionId}async completeSwap({provider:e,fromAccountId:t,toAccountId:n,swapId:r,rate:i,transaction:a,binaryPayload:o,signature:s,feeStrategy:c,tokenCurrency:l}){let u=await this.client.request(`exchange.complete`,{exchangeType:`SWAP`,provider:e,fromAccountId:t,toAccountId:n,swapId:r,rate:i,rawTransaction:yu(a),hexBinaryPayload:o.toString(`hex`),hexSignature:s.toString(`hex`),feeStrategy:c,tokenCurrency:l});return af.result.parse(u).transactionHash}async completeSell({provider:e,fromAccountId:t,transaction:n,binaryPayload:r,signature:i,feeStrategy:a}){let o=await this.client.request(`exchange.complete`,{exchangeType:`SELL`,provider:e,fromAccountId:t,rawTransaction:yu(n),hexBinaryPayload:r.toString(`hex`),hexSignature:i.toString(`hex`),feeStrategy:a});return af.result.parse(o).transactionHash}async completeFund({provider:e,fromAccountId:t,transaction:n,binaryPayload:r,signature:i,feeStrategy:a,tokenCurrency:o}){let s=await this.client.request(`exchange.complete`,{exchangeType:`FUND`,provider:e,fromAccountId:t,rawTransaction:yu(n),hexBinaryPayload:r.toString(`hex`),hexSignature:i.toString(`hex`),feeStrategy:a,tokenCurrency:o});return af.result.parse(s).transactionHash}};k();var Ef=class{client;constructor(e){this.client=e}async sign(e,t,n,r){let i=await this.client.request(`message.sign`,{accountId:e,hexMessage:t.toString(`hex`),options:n,meta:r}),a=cf.result.parse(i);return A.from(a.hexSignedMessage,`hex`)}},Df=class{client;constructor(e){this.client=e}async get(e,t){let n=await this.client.request(`storage.get`,{key:e,storeId:t});return lf.result.parse(n).value}async set(e,t,n){let r=await this.client.request(`storage.set`,{key:e,value:t,storeId:n});return uf.result.parse(r)}};k();var Of=class{client;constructor(e){this.client=e}async sign(e,t,n,r){let i=await this.client.request(`transaction.sign`,{accountId:e,rawTransaction:yu(t),options:n,meta:r}),a=ff.result.parse(i);return A.from(a.signedTransactionHex,`hex`)}async signRaw(e,t,n,r,i){let a=await this.client.request(`transaction.signRaw`,{accountId:e,rawTransaction:t,broadcast:n,options:r,meta:i});return gf.result.parse(a)}async signAndBroadcast(e,t,n,r){let i=await this.client.request(`transaction.signAndBroadcast`,{accountId:e,rawTransaction:yu(t),options:n,meta:r});return mf.result.parse(i).transactionHash}},kf=class{client;constructor(e){this.client=e}async userId(){let e=await this.client.request(`wallet.userId`,{});return yf.result.parse(e).userId}async info(){let e=await this.client.request(`wallet.info`,{});return vf.result.parse(e)}async capabilities(){let e=await this.client.request(`wallet.capabilities`,{});return _f.result.parse(e).methodIds}},Af=new pd(`Wallet-API-Client`),jf={"event.account.updated":e=>Promise.resolve()},Mf=class extends zd{account;bitcoin;currency;device;message;storage;transaction;wallet;exchange;custom;logger;constructor(e,t=Af,n,r={}){super(e,{...jf,...r}),this.logger=t,this.account=new xf(this),this.bitcoin=new Sf(this),this.currency=new Cf(this),this.device=new wf(this),this.message=new Ef(this),this.storage=new Df(this),this.transaction=new Of(this),this.wallet=new kf(this),this.exchange=new Tf(this),this.custom=n?n(this):{}}setEventHandlers(e){this.requestHandlers={...jf,...e}}onRequest(e){this.logger.log(e.method);let t=this.requestHandlers[e.method];if(!t)throw new Ad({code:jd.METHOD_NOT_FOUND,message:`method not found`});return t(e)}},Nf={near:{"*":{currencyId:`near`,family:`near`,network:`near`}},tezos:{"*":{currencyId:`tezos`,family:`tezos`,network:`tezos`}},solana:{"*":{currencyId:`solana`,family:`solana`,network:`solana`}},tron:{"*":{currencyId:`tron`,family:`tron`,network:`tron`}},ton:{"*":{currencyId:`ton`,family:`ton`,network:`ton`}},polkadot:{"*":{currencyId:`assethub_polkadot`,family:`polkadot`,network:`polkadot`}},celo:{"*":{currencyId:`celo`,family:`celo`,network:`celo`}},ethereum:{ethereum:{currencyId:`ethereum`,family:`ethereum`,network:`ethereum`},polygon:{currencyId:`polygon`,family:`ethereum`,network:`polygon`},arbitrum:{currencyId:`arbitrum`,family:`ethereum`,network:`arbitrum`},optimism:{currencyId:`optimism`,family:`ethereum`,network:`optimism`},avalanche_c_chain:{currencyId:`avalanche_c_chain`,family:`ethereum`,network:`avalanche-c`},ethereum_hoodi:{currencyId:`ethereum_hoodi`,family:`ethereum`,network:`ethereum-hoodi`},bsc:{currencyId:`bsc`,family:`ethereum`,network:`binance`}},cosmos:{cosmos:{currencyId:`cosmos`,family:`cosmos`,network:`cosmos`},crypto_org:{currencyId:`crypto_org`,family:`cosmos`,network:`cronos`},osmo:{currencyId:`osmo`,family:`cosmos`,network:`osmosis`},coreum:{currencyId:`coreum`,family:`cosmos`,network:`coreum`},axelar:{currencyId:`axelar`,family:`cosmos`,network:`axelar`},stargaze:{currencyId:`stargaze`,family:`cosmos`,network:`stargaze`},secret_network:{currencyId:`secret_network`,family:`cosmos`,network:`secret`},umee:{currencyId:`umee`,family:`cosmos`,network:`umee`},desmos:{currencyId:`desmos`,family:`cosmos`,network:`desmos`},onomy:{currencyId:`onomy`,family:`cosmos`,network:`onomy`},quicksilver:{currencyId:`quicksilver`,family:`cosmos`,network:`quicksilver`},persistence:{currencyId:`persistence`,family:`cosmos`,network:`persistence`},dydx:{currencyId:`dydx`,family:`cosmos`,network:`dydx`},injective:{currencyId:`injective`,family:`cosmos`,network:`injective`},sei:{currencyId:`sei`,family:`cosmos`,network:`sei`},mantra:{currencyId:`mantra`,family:`cosmos`,network:`mantra`}}},Pf=new Map([[`polkadot`,1],[`avalanche-c`,2],[`tron`,3],[`binance`,4],[`cronos`,5],[`polygon`,6]]);k();var Ff=be(),If=O(te({amount:D(O(y)),gasLimit:D(O(y)),token:D(O(te({decimals:E})))})),Lf=x(If),Rf=x(w),zf=new Set([`polygon`,`optimism`,`arbitrum`,`avalanche-c`,`core`]),Bf=(e,t)=>ee(e)(t).pipe(i(e=>e.message)),Vf=class extends b()(`LedgerTransactionPreparationError`,{message:y}){},Hf=e=>new Vf({message:e}),Uf=l(function*(){let e=yield*p(c({try:()=>import(`./polkadot-ledger-transaction-CCpzhicj.js`).then(e=>e.buildPolkadotLedgerTransaction),catch:()=>Hf(`Could not load Polkadot transaction support`)}));return({family:t,network:n,tx:r,txMeta:i})=>C(Rf)(r).pipe(m(()=>Hf(`Failed to parse tx`)),u(r=>n===`polkadot`?i?Wf({loadPolkadotBuilder:e,payload:r,txMeta:i}):s(Hf(`Missing classic transaction metadata`)):d(Gf({family:t,network:n,payload:r,txMeta:i})).pipe(m(Hf))))}),Wf=({loadPolkadotBuilder:e,payload:t,txMeta:n})=>d(Bf(se,t)).pipe(m(Hf),u(t=>e.pipe(u(e=>d(e({fee:ep(Qf(n.gasEstimate)).toString(),payload:t,txMeta:n})).pipe(m(Hf)))))),Gf=({family:e,network:r,payload:i,txMeta:s})=>{if(me(r))return Bf(e===`borrow`?ce:ae,i).pipe(t(e=>Kf({network:r,tx:e})));if(e===`borrow`)return o(`Unsupported Borrow network`);if(!s)return o(`Missing classic transaction metadata`);switch(r){case`tron`:return Bf(le,i).pipe(a(()=>Jf(s)));case`near`:return Yf(s);case`tezos`:return Xf(s);case`ton`:return Bf(xe,i).pipe(a(e=>Zf(e,s)));default:return pe(r)?qf(s):n(i)}},Kf=({network:e,tx:t})=>{let n={amount:(t.value??0n).toString(),recipient:t.to,family:`ethereum`,...t.nonce===void 0?{}:{nonce:t.nonce},gasLimit:t.gasLimit.toString(),data:A.from(he(t.data)).toString(`hex`)};return t.maxFeePerGas&&t.maxPriorityFeePerGas&&!zf.has(e)?(n.maxFeePerGas=t.maxFeePerGas.toString(),n.maxPriorityFeePerGas=t.maxPriorityFeePerGas.toString()):t.gasPrice&&(n.gasPrice=t.gasPrice.toString()),n},qf=e=>{let t=e.rawArguments?.validatorAddress,r=tp(e.txType),i=$f(e)??(np(r)?de():null);return!t||i===null?o(`Missing Cosmos Ledger arguments`):n({family:`cosmos`,mode:r,validators:[{address:t,amount:i.toString()}],amount:i.toString(),recipient:t,memo:`via StakeKit CID-1009`})},Jf=e=>{let r=$f(e),i=e.rawArguments?.tronResource,a=e.rawArguments?.validatorAddress??e.rawArguments?.validatorAddresses?.[0];return(()=>{switch(e.txType){case`FREEZE_BANDWIDTH`:case`FREEZE_ENERGY`:return!r||!i?o(`Missing Tron freeze arguments`):n({amount:r.toString(),recipient:e.address??``,family:`tron`,mode:`freeze`,resource:i});case`VOTE`:{let n=e.rawArguments?.validatorAddresses;return!r||!n?.length?o(`Missing Tron vote arguments`):ap({txMeta:e,validatorAddresses:n}).pipe(t(t=>({amount:r.toString(),recipient:e.address??``,family:`tron`,mode:`vote`,votes:t})))}case`UNDELEGATE_BANDWIDTH`:case`UNDELEGATE_ENERGY`:return!r||!i||!a?o(`Missing Tron undelegate arguments`):n({amount:r.toString(),recipient:String(a),family:`tron`,mode:`unDelegateResource`,resource:i});case`UNFREEZE_LEGACY_BANDWIDTH`:case`UNFREEZE_LEGACY_ENERGY`:return n({amount:`0`,recipient:``,family:`tron`,mode:`legacyUnfreeze`,resource:i});case`UNFREEZE_BANDWIDTH`:case`UNFREEZE_ENERGY`:return!r||!i?o(`Missing Tron unfreeze arguments`):n({amount:r.toString(),recipient:e.address??``,family:`tron`,mode:`unfreeze`,resource:i});case`CLAIM_REWARDS`:return n({amount:`0`,recipient:e.address??``,family:`tron`,mode:`claimReward`});default:return o(`Unsupported Tron Ledger transaction type: ${e.txType}`)}})().pipe(t(e=>({...e,votes:e.votes??[]})))},Yf=e=>{let t=e.rawArguments?.validatorAddress,r=$f(e);return!t||!r?o(`Missing Near Ledger arguments`):n({amount:r.toString(),recipient:t,family:`near`,mode:rp(e.txType),fees:ep(Qf(e.gasEstimate)).toString()})},Xf=e=>{let t=Qf(e.gasEstimate),r=e.txType===`UNSTAKE`,i=r?``:e.rawArguments?.validatorAddress;return!r&&!i?o(`Missing Tezos Ledger validator`):n({family:`tezos`,mode:r?`undelegate`:`delegate`,amount:`0`,recipient:i??``,fees:ep(t).toString(),gasLimit:String(t?.gasLimit??0)})},Zf=(e,t)=>{let r=Qf(t.gasEstimate);if(!(`message`in e)){let t=e[0];return t?n({family:`ton`,amount:t.amount,recipient:t.address,fees:ep(r).toString(),comment:{text:t.payload,isEncrypted:!1}}):o(`Unsupported Ton Ledger transaction payload`)}try{let t=(0,Ff.loadMessageRelaxed)(Ff.Cell.fromBase64(e.message).beginParse()),i=t.info;return n({family:`ton`,amount:i.value.coins.toString(),recipient:i.dest.toString(),fees:ep(r).toString(),comment:{text:t.body.toBoc().toString(`base64`),isEncrypted:!1}})}catch{return o(`Unsupported Ton Ledger transaction payload`)}},Qf=e=>e?T(Lf)(e).pipe(g):null,$f=e=>{if(e.amountRaw)return ie(e.amountRaw);let t=e.rawArguments?.amount??e.amount,n=e.inputToken?.decimals;return!t||n===void 0?null:ie(t).multipliedBy(ie(10).pow(n))},ep=e=>!e?.amount||!e.token?de():ie(e.amount).multipliedBy(ie(10).pow(e.token.decimals)),tp=e=>{switch(e){case`STAKE`:return`delegate`;case`UNSTAKE`:return`undelegate`;case`RESTAKE`:case`REBOND`:return`redelegate`;case`RESTAKE_REWARDS`:return`claimRewardCompound`;case`CLAIM_REWARDS`:return`claimReward`;default:return`delegate`}},np=e=>e===`claimReward`||e===`claimRewardCompound`,rp=e=>{switch(e){case`STAKE`:return`stake`;case`UNSTAKE`:return`unstake`;case`WITHDRAW`:case`CLAIM_UNSTAKED`:return`withdraw`;default:return`stake`}},ip=e=>{let t=e.rawArguments?.amount??e.amount;if(t)return ie(t);let n=e.inputToken?.decimals;return!e.amountRaw||n===void 0?null:ie(e.amountRaw).dividedBy(ie(10).pow(n))},ap=({txMeta:e,validatorAddresses:t})=>{let r=ip(e);if(!r)return o(`Missing Tron vote arguments`);let i=t.length,a=r.dividedToIntegerBy(i),s=r.modulo(i).integerValue(re.ROUND_FLOOR);if(!a.isFinite()||!s.isFinite()||a.isNegative()||s.isNegative())return o(`Invalid Tron vote count`);if(a.plus(1).gt(2**53-1))return o(`Tron vote count exceeds Ledger limits`);let c=ne(s);if(c==null)return o(`Invalid Tron vote count`);let l=t.map((e,t)=>{let n=ne(a.plus(+(t<c)));return n==null?null:{address:e,voteCount:n}});return l.some(e=>e==null)?o(`Invalid Tron vote count`):n(l.filter(e=>e!=null))},op=({accounts:e,ledgerCurrencies:t,enabledChainsMap:n})=>{let{accountsFamilies:r,accountsCurrencies:i}=e.reduce((e,n)=>{let r=t.get(n.currency);return r&&(e.accountsFamilies.add(r),e.accountsCurrencies.add(n.currency)),e},{accountsFamilies:new Set,accountsCurrencies:new Set}),a=S(Nf).reduce((e,[t,a])=>{let o=Object.keys(a).reduce((e,t)=>{let o=a[t];if(!o)return e;let s=n.evm[o.network]?.wagmiChain||n.cosmos[o.network]?.wagmiChain||n.misc[o.network]?.wagmiChain||n.substrate[o.network]?.wagmiChain;return s?r.has(o.family)&&(t===`*`||i.has(o.currencyId))?{...e,[t]:{...o,chain:s,enabled:!0}}:Pf.has(o.network)?{...e,[t]:{...o,chain:s,enabled:!1}}:e:e},{});return{...e,[t]:o}},{});return Object.keys(a).reduce((e,t)=>{let n=a[t],r=Object.keys(n).reduce((e,t)=>{let r=n[t];return r&&e.set(t,r),e},new Map);return e.set(t,r),e},new Map)},sp=e=>c({try:()=>e.currency.list({currencyIds:Object.values(Nf).flatMap(e=>Object.values(e).map(e=>e.currencyId))}),catch:e=>new _e({cause:e,message:`could not get currencies`,operation:`ledger-list-currencies`})}).pipe(f(e=>e.reduce((e,t)=>(t.type===`CryptoCurrency`?e.cryptoCurrency.set(t.id,t.family):e.tokenCurrency.push(t),e),{cryptoCurrency:new Map,tokenCurrency:[]})),f(e=>(e.tokenCurrency.forEach(t=>{let n=e.cryptoCurrency.get(t.parent);n&&e.cryptoCurrency.set(t.id,n)}),e.cryptoCurrency))),cp=({walletDetailsParams:e,enabledChainsMap:t,isLedgerDappBrowser:i,prepareTransaction:a,queryParams:s,runWalletEffect:u})=>h(d=>{let p=ve([]),m=ve([]),h=ve(void 0),g=h.changes.pipe(v(e=>e?.parentAccountId??e?.id)),y=[],b=ve([]),x=null,S=null,C=null,w=new hd;w.connect();let T=new Mf(w),ee=async e=>{d.emitter.emit(`message`,{type:`connecting`});let n=await u(sp(T)),i=await u(c({try:()=>T.account.list(),catch:e=>new _e({cause:e,message:`could not get accounts`,operation:`ledger-list-accounts`})}).pipe(f(e=>({accounts:e,accountsMap:new Map(e.map(e=>[e.id,e]))})),f(e=>e.accounts.map(t=>t.parentAccountId?(()=>{let n=e.accountsMap.get(t.parentAccountId);return n?{...t,currency:n.currency}:t})():t))));y=i.filter(e=>!e.parentAccountId);let a=op({ledgerCurrencies:n,accounts:y,enabledChainsMap:t});S=new Map([...a.values()].flatMap(e=>[...e.values()].map(e=>[e.chain.id,e.currencyId]))),C=a;let{enabled:o,disabled:l}=[...a.values()].reduce((e,t)=>(t.forEach(t=>{t.enabled?e.enabled.push(t.chain):e.disabled.push(t.chain)}),e),{enabled:[],disabled:[]});p.set([...o,...l]),m.set(l);let g=i.reduce((e,t)=>{let r=n.get(t.currency);if(!r)return e;let i=a.get(r);if(!r||!i)return e;let o=i.get(`*`)||i.get(t.currency);return o&&e.push({account:t,chainItem:o}),e},[]).sort((e,t)=>(Pf.get(e.chainItem.network)||999)-(Pf.get(t.chainItem.network)||999));if(!g.length){let t=a.get(`ethereum`)?.get(`ethereum`);if(!t)throw Error(`Default chain not found`);return b.set([]),x=t,D([`N/A`]),O(t.chain.id.toString()),_(e?.withCapabilities,[`N/A`],t.chain.id)}let v=s.accountId?s.accountId.startsWith(`js:`)?{type:`address`,address:s.accountId.split(`:`)[3]}:{type:`accountId`,accountId:s.accountId}:null,w=(v?g.find(e=>v.type===`address`?e.account.address===v.address:e.account.id===v.accountId):void 0)??(s.network?g.find(e=>e.chainItem.network===s.network):void 0)??g[0];if(!w)throw Error(`Account not found`);return h.set(w.account),x=w.chainItem,b.set(r(E())),D([w.account.address]),O(x.chain.id.toString()),_(e?.withCapabilities,[w.account.address],x.chain.id)},E=()=>x?n(y.filter(e=>e.currency===x?.currencyId)):o(Error(`Current chain not found`)),D=e=>{e.length===0?d.emitter.emit(`disconnect`):d.emitter.emit(`change`,{accounts:e})},O=e=>{d.emitter.emit(`change`,{chainId:oe(e)})},te=()=>{d.emitter.emit(`disconnect`)},ne=async()=>({}),re=async()=>i,ie=async()=>w.disconnect(),ae=async()=>{let e=x?.chain.id;if(!e)throw Error(`Chain not found`);return e},se=async()=>[h.get()?.address],ce=e=>{h.set(e),D([e.address])},le=e=>l(function*(){let t=S?.get(e.id);if(!t)return yield*new _e({message:`Chain not found`,operation:`ledger-request-account`});let n=yield*c({try:()=>T.account.request({currencyIds:[t]}),catch:e=>new _e({cause:e,message:`could not request account`,operation:`ledger-request-account`})});return y.push(n),p.set([...p.get(),e]),m.set(m.get().filter(t=>t.id!==e.id)),yield*c({try:()=>de({chainId:e.id}),catch:e=>new _e({cause:e,message:`failed to switch to new chain`,operation:`ledger-switch-chain`})})}),de=async({chainId:e})=>{let t=x;if(!t||!C)throw Error(`Chain not found`);let n=[...C.values()].flatMap(e=>[...e.values()]).find(t=>t.chain.id===e);if(!n)throw Error(`Chain not found`);if(t.chain.id!==n.chain.id||!h.get()){x=n;let e=r(E());b.set(e),h.set(e[0])}let i=h.get();if(!i)throw Error(`Account not found`);return O(e.toString()),D([i.address]),n.chain};return{...e,id:ue.id,name:ue.name,type:ue.type,connect:ee,onAccountsChanged:D,onChainChanged:O,onDisconnect:te,getProvider:ne,isAuthorized:re,getChainId:ae,disconnect:ie,switchChain:de,getAccounts:se,switchAccount:ce,requestAndSwitchAccount:le,walletApiClient:T,$accountsOnCurrentChain:b.changes,$filteredChains:p.changes,$currentAccountId:g,$disabledChains:m.changes,noAccountPlaceholder:`N/A`,deserializeTransaction:bu,prepareTransaction:a}}),lp=({enabledChainsMap:e,isLedgerDappBrowser:t,queryParams:n,runWalletEffect:r})=>l(function*(){let i=yield*Uf;return{groupName:`Ledger Live`,wallets:[()=>({id:ue.id,name:ue.name,iconUrl:fe.ledgerLogo,iconBackground:`#fff`,chainGroup:{id:ue.id,title:ue.name,iconUrl:fe.ledgerLogo},hidden:()=>!t,createConnector:a=>cp({walletDetailsParams:a,enabledChainsMap:e,isLedgerDappBrowser:t,prepareTransaction:i,queryParams:n,runWalletEffect:r})})]}});export{lp as ledgerLiveConnector};