@abtnode/blocklet-services 1.16.49-beta-20250821-102221-1b7283d6 → 1.16.49-beta-20250822-070545-6d3344cc

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 (139) hide show
  1. package/api/routes/env.js +0 -1
  2. package/dist/assets/{access-control-CKo7ApzQ.js → access-control-VF0jIUag.js} +1 -1
  3. package/dist/assets/{add-component-core-2s4YrHkE.js → add-component-core-DPxKUwJB.js} +1 -1
  4. package/dist/assets/{add-resource-B5ESeEdz.js → add-resource-DuOqQFR-.js} +1 -1
  5. package/dist/assets/{addon-Cbd_t8fg.js → addon-CosTdlat.js} +1 -1
  6. package/dist/assets/{advanced-Bgj7amLL.js → advanced-B9TR0x_M.js} +1 -1
  7. package/dist/assets/{aigne-D5HIKgzm.js → aigne-C7JPp9u1.js} +1 -1
  8. package/dist/assets/{appearance-_Bk4EnMK.js → appearance-Byekpih2.js} +1 -1
  9. package/dist/assets/{ar-BvKie2ZN.js → ar-fE5SSTrt.js} +1 -1
  10. package/dist/assets/{arrow-down.svg-DaFWY5aq.js → arrow-down.svg-lBR1lfm2.js} +1 -1
  11. package/dist/assets/{audit-logs-Bh4pY_tu.js → audit-logs-BTyQcfWp.js} +1 -1
  12. package/dist/assets/{authorize--3SKB1wC.js → authorize-BbCQomqp.js} +1 -1
  13. package/dist/assets/{base32-BkgeFkJa.js → base32-D7JDMggs.js} +1 -1
  14. package/dist/assets/{bind-account-CoQBu2J9.js → bind-account-B-fdpRuH.js} +1 -1
  15. package/dist/assets/{branding-Spk8WElf.js → branding-Bp4tsvug.js} +1 -1
  16. package/dist/assets/{branding-7dpJRuU0.js → branding-CXO5C9Lb.js} +1 -1
  17. package/dist/assets/{branding-CuAzEVpH.js → branding-DKOBu_eV.js} +2 -2
  18. package/dist/assets/{bundle-avatar-CopjjSKq.js → bundle-avatar-FLzOZWlh.js} +1 -1
  19. package/dist/assets/{complete-BJT8H_Qd.js → complete-CnjLDP7N.js} +1 -1
  20. package/dist/assets/{component-Ds8koLEG.js → component-Dogt0tzj.js} +3 -3
  21. package/dist/assets/{config-DE3v72_z.js → config-B5Y8LOpp.js} +1 -1
  22. package/dist/assets/{config-CPOsDUsI.js → config-BxiVjVAu.js} +1 -1
  23. package/dist/assets/{config-_-5NHvON.js → config-gL555Qh4.js} +1 -1
  24. package/dist/assets/{config-navigation-C-4ZP-lf.js → config-navigation-CveewaP3.js} +3 -3
  25. package/dist/assets/{config-space-CtK2sF5f.js → config-space-h6V3UKMc.js} +1 -1
  26. package/dist/assets/{confirm-Bax75YdO.js → confirm-C9tgdTJT.js} +1 -1
  27. package/dist/assets/{connect-DY6itK40.js → connect-CYT-S8fi.js} +1 -1
  28. package/dist/assets/{connect-Csks8pFO.js → connect-Cx2VNYgu.js} +1 -1
  29. package/dist/assets/{connect-to-DBq3ktB8.js → connect-to-DiEQlFbF.js} +1 -1
  30. package/dist/assets/{dashboard-CbwKTvVC.js → dashboard-D1d9MQbs.js} +3 -3
  31. package/dist/assets/{de-C9BQPFcm.js → de-Byq6SyWJ.js} +1 -1
  32. package/dist/assets/{delete-confirm-Db0zAWAY.js → delete-confirm-XVeEePxy.js} +1 -1
  33. package/dist/assets/{domain-CHD8k2pC.js → domain-CV6OAKYE.js} +1 -1
  34. package/dist/assets/{domain-action-card-DtOm7RPt.js → domain-action-card-BXYZu_pS.js} +1 -1
  35. package/dist/assets/{domains-CePn01LF.js → domains-DrF1lJas.js} +1 -1
  36. package/dist/assets/{email-B1F9_dDw.js → email-CniDyVLQ.js} +1 -1
  37. package/dist/assets/engine-hsJUTQxh.js +1 -0
  38. package/dist/assets/{es-DPjcV6cX.js → es-Q8J1CCMS.js} +1 -1
  39. package/dist/assets/{exchange-passport-B90C9g4T.js → exchange-passport-BnNDAYeY.js} +1 -1
  40. package/dist/assets/{form-o2cQtSfF.js → form-BndJ7ZnS.js} +1 -1
  41. package/dist/assets/{fr-ButkVdgL.js → fr-8njRrvuV.js} +1 -1
  42. package/dist/assets/{fuel-mxa8OZsa.js → fuel-BTh7B67H.js} +1 -1
  43. package/dist/assets/{gen-access-key-BgQp83Fx.js → gen-access-key-CbaepD9-.js} +1 -1
  44. package/dist/assets/{gen-simple-access-key-DbEHuHKs.js → gen-simple-access-key-mJK0zx1B.js} +1 -1
  45. package/dist/assets/{get-safe-url-BNFAIq84.js → get-safe-url-Bpq2IOGY.js} +1 -1
  46. package/dist/assets/{hdkey-Dszfv2Lm.js → hdkey-BpKJbkt5.js} +1 -1
  47. package/dist/assets/hi-JUTdfcRr.js +5 -0
  48. package/dist/assets/{home-C03NbY1T.js → home-BwLLSjzW.js} +1 -1
  49. package/dist/assets/{id-B6zyYCjr.js → id-CrtgRPeX.js} +1 -1
  50. package/dist/assets/{iframe-CZx2enRR.js → iframe-CbjzikLk.js} +1 -1
  51. package/dist/assets/{index-B5ss4uTe.js → index-0VNYJQln.js} +1 -1
  52. package/dist/assets/{index-TDbD3rO2.js → index-B5t6TkeL.js} +4 -4
  53. package/dist/assets/{index-B2R6qrmp.js → index-B9sHaKla.js} +1 -1
  54. package/dist/assets/{index-DQ5bllFt.js → index-BH6jQqKY.js} +1 -1
  55. package/dist/assets/{index-CrDQcn26.js → index-BKiTWpo1.js} +1 -1
  56. package/dist/assets/{index-R8yzPJ8-.js → index-BY2dcTa4.js} +1 -1
  57. package/dist/assets/{index-DGpFay7j.js → index-Bk02VaQE.js} +1 -1
  58. package/dist/assets/{index-D_t0hM3n.js → index-BtHQU9Nx.js} +1 -1
  59. package/dist/assets/{index-CJubEPJw.js → index-BxU3q403.js} +3 -3
  60. package/dist/assets/{index-BUlqbV5J.js → index-C4e0bu4c.js} +1 -1
  61. package/dist/assets/{index-CLmp-nsJ.js → index-Ca4b_pCt.js} +1 -1
  62. package/dist/assets/{index-MgFhlLet.js → index-Cd2DJL-w.js} +1 -1
  63. package/dist/assets/{index-CZjtHtZ4.js → index-CjfYhb8W.js} +1 -1
  64. package/dist/assets/{index-BF7bSwjJ.js → index-CuQBOJqN.js} +6 -6
  65. package/dist/assets/{index-BhhsbfbV.js → index-DEu06Btv.js} +1 -1
  66. package/dist/assets/{index-wKz_l66R.js → index-DzSOofQf.js} +1 -1
  67. package/dist/assets/{index-DO8dY30H.js → index-DzqNo2lD.js} +1 -1
  68. package/dist/assets/{index-_fIzCi4b.js → index-JixySlIT.js} +1 -1
  69. package/dist/assets/{index-DKALSagn.js → index-SbRD4xbu.js} +1 -1
  70. package/dist/assets/{index-CcHUYWYZ.js → index-ew1if2W6.js} +1 -1
  71. package/dist/assets/{index-D9F9PzFc.js → index-hXRVhE3g.js} +1 -1
  72. package/dist/assets/{index-DnMPdyj-.js → index-pAv7g5o_.js} +1 -1
  73. package/dist/assets/{index-CqAqyoyD.js → index-yi4PlkyH.js} +1 -1
  74. package/dist/assets/{invitation-Py8TsLWL.js → invitation-CsvJMPo7.js} +1 -1
  75. package/dist/assets/{invite-CrcJXNQ_.js → invite-DEEX5t_7.js} +1 -1
  76. package/dist/assets/{isURL-CH4qUEqk.js → isURL-Cuto2_sB.js} +1 -1
  77. package/dist/assets/{issue-passport-BrCzpb_k.js → issue-passport-BuT9-mlQ.js} +1 -1
  78. package/dist/assets/{item-pMF7ItdE.js → item-CEYjCEHD.js} +1 -1
  79. package/dist/assets/{ja-5mnOXG6B.js → ja-BDFhRccP.js} +1 -1
  80. package/dist/assets/{ko-Msmkvh9O.js → ko-Dde62QRb.js} +1 -1
  81. package/dist/assets/{landing-page-tr6cY26r.js → landing-page-CbZO5p-X.js} +1 -1
  82. package/dist/assets/{layout-BTWkyZIA.js → layout-BOMMbsdq.js} +1 -1
  83. package/dist/assets/{list-D9c57rY9.js → list-CIIZmkmF.js} +3 -3
  84. package/dist/assets/{list-u8QyXkOA.js → list-CcfeNfGu.js} +1 -1
  85. package/dist/assets/{localization-DiI2Nbuc.js → localization-DNJagVoT.js} +1 -1
  86. package/dist/assets/{log-atnf1Umh.js → log-CHaoSWXc.js} +1 -1
  87. package/dist/assets/{login-CKylUR0F.js → login-C0FSm4ep.js} +1 -1
  88. package/dist/assets/{login-oauth-callback-5DVKz_Jh.js → login-oauth-callback-DJxlMwXZ.js} +1 -1
  89. package/dist/assets/{logo-uploader-DbxANvEK.js → logo-uploader-C0ihL7E6.js} +2 -2
  90. package/dist/assets/{lost-passport-pzKFXIgF.js → lost-passport-BoAvHfI_.js} +1 -1
  91. package/dist/assets/{open-window-DM0S-jzk.js → open-window-BNY_OfK6.js} +1 -1
  92. package/dist/assets/{over-due-invoice-payment-CvZTMHvs.js → over-due-invoice-payment-DXbfRbJ6.js} +1 -1
  93. package/dist/assets/{overview-phdRvAI_.js → overview-DpF1loGs.js} +1 -1
  94. package/dist/assets/{passport-item-Ml3CykE7.js → passport-item-VXkf3FVk.js} +1 -1
  95. package/dist/assets/{permission-D9Anejwj.js → permission-DeQz9qFD.js} +1 -1
  96. package/dist/assets/{preferences-DClQtBed.js → preferences-C7TivEto.js} +1 -1
  97. package/dist/assets/{profile-embed-CIuOCLMD.js → profile-embed-Dzt59MHT.js} +1 -1
  98. package/dist/assets/pt-C4nfuExm.js +5 -0
  99. package/dist/assets/{publish-resource-DrVZkMgt.js → publish-resource-BSY6p0as.js} +1 -1
  100. package/dist/assets/ru-B4GtNlEa.js +5 -0
  101. package/dist/assets/{runtime-BfAbZoi3.js → runtime-B01d8fEk.js} +1 -1
  102. package/dist/assets/sdk-ZTxfQBV1.js +1 -0
  103. package/dist/assets/{security-DulYEnHf.js → security-sVehajDA.js} +1 -1
  104. package/dist/assets/{session-COCrt-qG.js → session-Bk6ebojT.js} +1 -1
  105. package/dist/assets/{setup-CHgFauXU.js → setup-B9yaqoQM.js} +1 -1
  106. package/dist/assets/{spaces-CvL1Uwkd.js → spaces-HwfT17d7.js} +1 -1
  107. package/dist/assets/{start-BhGEcDw9.js → start-4J_Dh_zH.js} +1 -1
  108. package/dist/assets/{status-v5BitGK5.js → status-B1AV3yPH.js} +1 -1
  109. package/dist/assets/{step-actions-C48J0mE1.js → step-actions-YjxSTbIE.js} +1 -1
  110. package/dist/assets/{studio-iYVCEWav.js → studio-Cx6j_6QU.js} +1 -1
  111. package/dist/assets/{team-BVaQVRGX.js → team-Dl23XmaY.js} +1 -1
  112. package/dist/assets/th-BkShd6jD.js +5 -0
  113. package/dist/assets/{traffic-CMbIGtyi.js → traffic-O-wVx65-.js} +1 -1
  114. package/dist/assets/{transfer-WHnS-w5n.js → transfer-gEq9B27K.js} +1 -1
  115. package/dist/assets/{unsubscribe-flFhRa0X.js → unsubscribe-vpGsla5T.js} +1 -1
  116. package/dist/assets/{use-app-logo-Cb6MS9by.js → use-app-logo-7cjs_pn8.js} +1 -1
  117. package/dist/assets/{user-center-BrV7Sqsj.js → user-center-DtJ32yjF.js} +3 -3
  118. package/dist/assets/{user-sessions-DMHiVE2_.js → user-sessions-CFxn5EHL.js} +1 -1
  119. package/dist/assets/{util-CmTchaCE.js → util-Ca2jlZN4.js} +1 -1
  120. package/dist/assets/{util-CU3dCXzc.js → util-o8U4JIlX.js} +1 -1
  121. package/dist/assets/vi-C1PSP5SP.js +5 -0
  122. package/dist/assets/{wait-connect-bu1NVn-9.js → wait-connect-DPAxcgcf.js} +1 -1
  123. package/dist/assets/{wizard-E9dqLz0c.js → wizard-072KuoFQ.js} +1 -1
  124. package/dist/assets/{wizard-components-DRUX-bqp.js → wizard-components-Dx5C9E35.js} +2 -2
  125. package/dist/assets/wrap-locale-BQM6_LkP.js +1 -0
  126. package/dist/assets/{zh-CwK2Wb9a.js → zh-C_fDhC3R.js} +1 -1
  127. package/dist/assets/{zh-BG6k4eXG.js → zh-gAK37O_Y.js} +1 -1
  128. package/dist/assets/{zh-tw-6SDy5fyY.js → zh-tw-BGfyObps.js} +1 -1
  129. package/dist/index.html +1 -1
  130. package/dist/service-worker.js +1 -1
  131. package/package.json +23 -23
  132. package/dist/assets/engine-UogTYMtu.js +0 -1
  133. package/dist/assets/hi-CLqQ4LHH.js +0 -5
  134. package/dist/assets/pt-D1bjCfHu.js +0 -5
  135. package/dist/assets/ru-DcnfcUY4.js +0 -5
  136. package/dist/assets/sdk-DkOKBbdA.js +0 -1
  137. package/dist/assets/th-C2mNGstJ.js +0 -5
  138. package/dist/assets/vi-C4AydA45.js +0 -5
  139. package/dist/assets/wrap-locale-C1S0zrtd.js +0 -1
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CJubEPJw.js","assets/index-BF7bSwjJ.js","assets/vendor-mui-core-B7zoO8f5.js","assets/vendor-react-Dvs43sk9.js","assets/vendor-ux-B7q8W4Pg.js","assets/vendor-utils-DtY42AM-.js","assets/vendor-hooks-BRXKH6Nb.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-B7AoUs4o.js","assets/index-DrVXX4fX.css","assets/index-BPy8_fa2.js","assets/index-DRYJ0xIl.js","assets/index-B5LvOF-F.css"])))=>i.map(i=>d[i]);
2
- import{r as I,a as Rr}from"./vendor-react-Dvs43sk9.js";import{r as Gt,a as Zt,b as Qt,c as er,d as ct,e as tr,f as rr,g as nr,h as lt,i as ir,j as sr,k as or,m as Ke,n as ar,o as cr,p as lr,q as je,s as ur,t as fr,u as dr,v as hr,am as Cr,b6 as Dr,T as Be,H as De,_ as Kr,$ as pr,a5 as Ce,ab as Nr,a9 as Ir}from"./vendor-ux-B7q8W4Pg.js";import{j as r,Y as ut,bB as ft,I as dt,aj as ht,$ as pt,b1 as me,T as X,ak as k,z as V,F as M,b7 as Lr,b5 as yr,b6 as mr,a5 as gr,a3 as yt,aX as br,R as _r,Q as He,a6 as mt,W as w,am as qr,ck as Sr,cl as Mr,c9 as Fr}from"./vendor-mui-core-B7zoO8f5.js";import{B as Wr,a as Vr,l as zr}from"./index-DO8dY30H.js";import{u as Yr}from"./useAsyncRetry-D4-sRZN-.js";import{w as Er,B as C,o as Xr,b as Jr,C as xt}from"./vendor-utils-DtY42AM-.js";import{r as Gr}from"./hdkey-Dszfv2Lm.js";import{Z as Pe,c as re,a8 as Zr}from"./index-BF7bSwjJ.js";import{u as $e}from"./team-BVaQVRGX.js";import{u as xr,C as z}from"./index.esm-JPZAjt0x.js";import{T as Qr}from"./index-MgFhlLet.js";import{E as en}from"./empty-spinner-BMVhld2Z.js";import{C as q}from"./click-to-copy-CVpUD4ji.js";import{D as tn}from"./delete-confirm-Db0zAWAY.js";import{a as rn}from"./passport-item-Ml3CykE7.js";import{A as nn}from"./actions-Bf4UKTeu.js";import{T as Tt}from"./table-tips-BP283GGZ.js";import{u as sn}from"./use-mobile-C_DcJ5SZ.js";import"./vendor-hooks-BRXKH6Nb.js";import"./lottie-web-4koyQiv_.js";import"./useAsync-BrMo9m7W.js";import"./vendor-arcblock-B7AoUs4o.js";import"./session-COCrt-qG.js";import"./isURL-CH4qUEqk.js";import"./use-app-logo-Cb6MS9by.js";import"./arrow-down.svg-DaFWY5aq.js";import"./vendor-mui-x-Qph0dQcg.js";import"./AdapterDayjs-VDBijwaM.js";import"./confirm-Bax75YdO.js";import"./index-DBs9Ljax.js";import"./did-address-CcsL3-Qm.js";import"./util-CmTchaCE.js";import"./base32-BkgeFkJa.js";var Ae={},ke={},Z={},Ht;function ne(){return Ht||(Ht=1,function(e){var a=Z&&Z.__createBinding||(Object.create?function(t,u,y,U){U===void 0&&(U=y);var x=Object.getOwnPropertyDescriptor(u,y);(!x||("get"in x?!u.__esModule:x.writable||x.configurable))&&(x={enumerable:!0,get:function(){return u[y]}}),Object.defineProperty(t,U,x)}:function(t,u,y,U){U===void 0&&(U=y),t[U]=u[y]}),i=Z&&Z.__setModuleDefault||(Object.create?function(t,u){Object.defineProperty(t,"default",{enumerable:!0,value:u})}:function(t,u){t.default=u}),d=Z&&Z.__importStar||function(t){if(t&&t.__esModule)return t;var u={};if(t!=null)for(var y in t)y!=="default"&&Object.prototype.hasOwnProperty.call(t,y)&&a(u,t,y);return i(u,t),u},c=Z&&Z.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.fromTokenToUnit=e.fromUnitToToken=e.numberToString=e.toHex=e.hexToBytes=e.bytesToHex=e.numberToHex=e.hexToNumber=e.hexToUtf8=e.utf8ToHex=e.toBN=e.isHex=e.isHexStrict=e.isBigNumber=e.isBN=e.stripHexPrefix=e.isHexPrefixed=e.numberToBN=e.rightPad=e.leftPad=e.BN=e.isBase58btc=void 0,e.isUint8Array=ge,e.UUID=Ge,e.isUUID=Ze,e.toUint8Array=be,e.toBuffer=Ue,e.toBase58=Qe,e.fromBase58=et,e.toBase64=tt,e.fromBase64=rt,e.toAddress=te,e.toDid=nt,e.isSameDid=it,e.formatTxType=st;const s=c(Gt),m=c(Zt),f=c(Qt),p=c(er),g=c(ct),n=c(tr),o=c(rr),l=c(nr);e.rightPad=l.default;const h=c(lt);e.leftPad=h.default;const E=c(ir()),b=c(sr()),_=c(Er());e.BN=_.default;const A=d(or()),R="did:abt:",H=new _.default(0),T=new _.default(-1),j={encode:t=>`z${E.default.encode(t)}`,decode:t=>E.default.decode(t.slice(1))},O=t=>{if(typeof t!="string")return!1;if(t[0]==="z")try{return j.decode(t),!0}catch{return!1}return!1};e.isBase58btc=O;const S=t=>{if(typeof t=="string"||typeof t=="number"){let u=new _.default(1);const y=String(t).toLowerCase().trim(),U=y.substr(0,2)==="0x"||y.substr(0,3)==="-0x";let x=(0,e.stripHexPrefix)(y);if(x.substr(0,1)==="-"&&(x=(0,e.stripHexPrefix)(x.slice(1)),u=new _.default(-1,10)),x=x===""?"0":x,!x.match(/^-?[0-9]+$/)&&x.match(/^[0-9A-Fa-f]+$/)||x.match(/^[a-fA-F]+$/)||U===!0&&x.match(/^[0-9A-Fa-f]+$/))return new _.default(x,16).mul(u);if((x.match(/^-?[0-9]+$/)||x==="")&&U===!1)return new _.default(x,10).mul(u)}if((0,e.isBN)(t))return new _.default(t.toString(10),10);throw new Error(`[number-to-bn] while converting number ${JSON.stringify(t)} to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported.`)};e.numberToBN=S;const v=t=>{if(typeof t!="string")throw new Error("[is-hex-prefixed] value must be type string");return t.slice(0,2).toLowerCase()==="0x"};e.isHexPrefixed=v;const P=t=>typeof t=="string"&&(0,e.isHexPrefixed)(t)?t.slice(2):t;e.stripHexPrefix=P;const B=t=>t instanceof _.default||t&&t.constructor&&t.constructor.name==="BN";e.isBN=B;const N=t=>t&&t.constructor&&t.constructor.name==="BigNumber";e.isBigNumber=N;const ee=t=>((0,m.default)(t)||(0,f.default)(t))&&/^(-)?0x[0-9a-f]*$/i.test(t);e.isHexStrict=ee;const Ne=t=>((0,m.default)(t)||(0,f.default)(t))&&/^(-0x|0x|0X|-0X)?[0-9a-f]*$/i.test(t);e.isHex=Ne;const Ie=(t,u=10)=>{try{if(typeof t=="number"&&t>0){const y=Number(t).toLocaleString("fullwide",{useGrouping:!1});return new _.default(y,u)}return(0,e.numberToBN)(t)}catch(y){throw new Error(`${y} Given value: "${t}"`)}};e.toBN=Ie;const Le=t=>{t=A.encode(t);let u="";t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join(""),t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join("");for(let y=0;y<t.length;y++){const x=t.charCodeAt(y).toString(16);u+=x.length<2?`0${x}`:x}return`0x${u}`};e.utf8ToHex=Le;const qe=t=>{if(!(0,e.isHexStrict)(t))throw new Error(`The parameter "${t}" must be a valid HEX string.`);let u="",y=0;t=t.replace(/^0x/i,""),t=t.replace(/^(?:00)*/,""),t=t.split("").reverse().join(""),t=t.replace(/^(?:00)*/,""),t=t.split("").reverse().join("");const U=t.length;for(let x=0;x<U;x+=2)y=parseInt(t.substr(x,2),16),u+=String.fromCharCode(y);return A.decode(u)};e.hexToUtf8=qe;const Me=t=>t?(0,e.toBN)(t).toNumber():0;e.hexToNumber=Me;const Fe=t=>{if((0,o.default)(t)||typeof t>"u")return t;if(!isFinite(t)&&!(0,e.isHex)(t))throw new Error(`Given input "${t}" is not a number.`);const u=(0,e.toBN)(t),y=u.toString(16);return u.lt(new _.default(0))?`-0x${y.substr(1)}`:`0x${y}`};e.numberToHex=Fe;const We=t=>{const u=[];for(let y=0;y<t.length;y++)u.push((t[y]>>>4).toString(16)),u.push((t[y]&15).toString(16));return`0x${u.join("")}`};e.bytesToHex=We;const Ve=t=>{if(t=t.toString(16),!(0,e.isHex)(t))throw new Error(`Given value "${t}" is not a valid hex string.`);t=t.replace(/^0x/i,""),t=t.length%2?`0${t}`:t;const u=[];for(let y=0;y<t.length;y+=2)u.push(parseInt(t.substr(y,2),16));return u};e.hexToBytes=Ve;const ze=(t,u=!1)=>ge(t)||C.isBuffer(t)?u?"bytes":(0,e.bytesToHex)(t):(0,e.isBase58btc)(t)?u?"bytes":(0,e.bytesToHex)(j.decode(t)):(0,s.default)(t)?u?"bool":t?"0x01":"0x00":(0,p.default)(t)&&!(0,e.isBigNumber)(t)&&!(0,e.isBN)(t)?u?"string":(0,e.utf8ToHex)(JSON.stringify(t)):typeof t=="string"?t.indexOf("-0x")===0||t.indexOf("-0X")===0?u?"int256":(0,e.numberToHex)(t):t.indexOf("0x")===0||t.indexOf("0X")===0?u?"bytes":t:u?"string":(0,e.utf8ToHex)(t):u?+t<0?"int256":"uint256":(0,e.numberToHex)(t);e.toHex=ze;const Ye=t=>{if(typeof t=="string"){if(!t.match(/^-?[0-9.]+$/))throw new Error(`Invalid value '${t}' while converting to string, should be a number matching (^-?[0-9.]+).`);return t}if(typeof t=="number")return Number.isInteger(t)&&t>0?Number(t).toLocaleString("fullwide",{useGrouping:!1}):String(t);if(typeof t=="object"&&t.toString&&(t.toTwos||t.dividedToIntegerBy))return t.toPrecision?String(t.toPrecision()):t.toString(10);throw new Error(`while converting number to string, invalid number value '${t}' type ${typeof t}.`)};e.numberToString=Ye;const Xe=(t,u=18,y={})=>{let U=(0,e.toBN)(t);const x=U.lt(H),F=(0,e.toBN)(`1${"0".repeat(u)}`,10),G=F.toString(10).length-1||1,K=y||{};x&&(U=U.mul(T));let $=U.mod(F).toString(10);for(;$.length<G;)$=`0${$}`;K.pad||($=$.match(/^([0-9]*[1-9]|0)(0*)/)[1]);let L=U.div(F).toString(10);K.commify&&(L=L.replace(/\B(?=(\d{3})+(?!\d))/g,","));let _e=`${L}${$==="0"?"":`.${$}`}`;return x&&(_e=`-${_e}`),_e};e.fromUnitToToken=Xe;const Je=(t,u=18)=>{let y=(0,e.numberToString)(t);const U=(0,e.toBN)(`1${"0".repeat(u)}`,10),x=U.toString(10).length-1||1,F=y.substring(0,1)==="-";if(F&&(y=y.substring(1)),y===".")throw new Error(`error converting token ${t} to unit, invalid value`);const G=y.split(".");if(G.length>2)throw new Error(`error converting token ${t} to unit, too many decimal points`);let K=G[0],$=G[1];if(K||(K="0"),$||($="0"),$.length>x)throw new Error(`error converting token ${t} to unit, too many decimal places`);for(;$.length<x;)$+="0";K=new _.default(K),$=new _.default($);let L=K.mul(U).add($);return F&&(L=L.mul(T)),new _.default(L.toString(10),10)};e.fromTokenToUnit=Je;function ge(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Ge(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const u=Math.random()*16|0;return(t==="x"?u:u&3|8).toString(16)})}function Ze(t){return/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.test(t)}function be(t){let u=null;if([null,void 0,""].includes(t))u=new Uint8Array;else if(C.isBuffer(t))u=new Uint8Array(t);else if((0,e.isHexStrict)(t))u=new Uint8Array((0,e.hexToBytes)(t));else if(ge(t))u=new Uint8Array(t);else if((0,e.isBase58btc)(t))u=new Uint8Array(j.decode(t));else if(typeof t=="string")u=new Uint8Array((0,e.hexToBytes)((0,e.toHex)(t)));else throw new Error(`Unsupported input type ${typeof t} detected for toBuffer, only Uint8Array/Buffer/Hex/Base58 are supported`);return u}function Ue(t){return C.from(be(t))}function Qe(t){const u=j.encode(be(t));return C.from(u).toString("utf-8")}function et(t){if((0,e.isBase58btc)(t)===!1)throw new Error("fromBase58 expect strict base58 encoded string as input");return C.from(j.decode(t))}function tt(t,u=!0){const y=b.default.encode(Ue(t));return u?b.default.escape(y):y}function rt(t){if(typeof t!="string")throw new Error("fromBase64 requires input to be a string");return C.from(b.default.unescape(t),"base64")}function te(t){return t.replace(R,"")}function nt(t){return`${R}${te(t)}`}function it(t,u){return te(t).toLowerCase()===te(u).toLowerCase()}function st(t){return(0,g.default)((0,n.default)(t))}}(Z)),Z}var jt;function ve(){if(jt)return ke;jt=1,Object.defineProperty(ke,"__esModule",{value:!0}),ke.encode=a;const e=ne();function a(i,d="hex"){return["hex","base16"].includes(d)?(0,e.toHex)(i):d==="base58"?(0,e.toBase58)(i):d==="base64"?(0,e.toBase64)(i):d==="Uint8Array"?(0,e.toUint8Array)(i):d==="buffer"?(0,e.toBuffer)(i):i}return ke}var ie={},vt;function on(){if(vt)return ie;vt=1;var e=ie&&ie.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ie,"__esModule",{value:!0}),ie.KeccakHasher=void 0;const a=e(Ke()),i=ne(),d=ve();class c{constructor(){[224,256,384,512].forEach(m=>{const f=`hash${m}`,p=n=>a.default[`keccak${m}`](n),g=(n,o)=>o===1?p(n):g(p(n),o-1);this[f]=(n,o=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const E=g(h,o);return(0,d.encode)(`0x${E}`,l)}})}}return ie.KeccakHasher=c,ie.default=new c,ie}var Se={},wt;function an(){if(wt)return Se;wt=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.Sha2Hasher=void 0;const e=ne(),a=ar(),i=ve(),d={sha224:a.sha224,sha256:a.sha256,sha384:a.sha384,sha512:a.sha512};class c{constructor(){[224,256,384,512].forEach(m=>{const f=`hash${m}`,p=d[`sha${m}`],g=(n,o)=>{let l=n;try{l=(0,e.toUint8Array)(n)}catch{}return o===1?`0x${p().update(l).digest("hex")}`:g(g(l,1),o-1)};this[f]=(n,o=2,l="hex")=>{const h=g(n,o);return(0,i.encode)(h,l)}})}}return Se.Sha2Hasher=c,Se.default=new c,Se}var se={},Ut;function cn(){if(Ut)return se;Ut=1;var e=se&&se.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(se,"__esModule",{value:!0}),se.Sha3Hasher=void 0;const a=e(Ke()),i=ne(),d=ve();class c{constructor(){[224,256,384,512].forEach(m=>{const f=`hash${m}`,p=a.default[`sha3_${m}`],g=(n,o)=>o===1?p(n):g(p(n),o-1);this[f]=(n,o=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const E=g(h,o);return(0,d.encode)(`0x${E}`,l)}})}}return se.Sha3Hasher=c,se.default=new c,se}var oe={},Ee={},At;function gt(){if(At)return Ee;At=1;var e=Ee&&Ee.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ee,"__esModule",{value:!0});const a=e(cr());return Ee.default=a.default.create("genKeyPair","getPublicKey","sign","verify"),Ee}var Ot;function ln(){if(Ot)return oe;Ot=1;var e=oe&&oe.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(oe,"__esModule",{value:!0}),oe.Ed25519Signer=void 0;const a=e(lr()),i=e(je()),d=ne(),c=e(gt()),s=ve(),m=a.default.sign;class f extends c.default{constructor(){super()}genKeyPair(g="hex",n){const o=n?(0,d.toUint8Array)(n):new Uint8Array((0,i.default)(32));if(o.byteLength!==32)throw new Error("Invalid seed to generate key pair");const l=m.keyPair.fromSeed(o);return l.publicKey=(0,s.encode)(l.publicKey,g),l.secretKey=(0,s.encode)(l.secretKey,g),l}getPublicKey(g,n="hex"){const o=(0,d.toUint8Array)(g),l=m.keyPair.fromSecretKey(o).publicKey;return(0,s.encode)(l,n)}sign(g,n,o="hex"){const l=(0,d.toUint8Array)(n),h=(0,d.toUint8Array)(g),E=m.detached(h,l);return(0,s.encode)(E,o)}verify(g,n,o){const l=(0,d.toUint8Array)(o),h=(0,d.toUint8Array)(g),E=(0,d.toUint8Array)(n);return m.detached.verify(h,E,l)}}return oe.Ed25519Signer=f,oe.default=new f,oe}var ae={},ce={},Bt;function Tr(){if(Bt)return ce;Bt=1;var e=ce&&ce.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(ce,"__esModule",{value:!0}),ce.Secp256k1Signer=void 0;const a=e(ur()),i=ne(),d=e(je()),c=e(gt()),s=ve(),m=a.default.ec,f=new m("secp256k1");class p extends c.default{constructor(){super(),this.pkHasFormatPrefix=!0,this.pkCompressed=!1}isValidSK(n){if(n.byteLength!==32)return!1;const o=new i.BN(n);return o.cmp(f.curve.n)<0&&!o.isZero()}genKeyPair(n="hex"){let o=null;do o=new Uint8Array((0,d.default)(32));while(!this.isValidSK(o));const l=this.getPublicKey((0,i.toHex)(o));return{secretKey:(0,s.encode)(o,n),publicKey:(0,s.encode)(l,n)}}getPublicKey(n,o="hex"){if(!this.isValidSK((0,i.toUint8Array)(n)))throw new Error("Invalid secret key");let l=f.keyFromPrivate((0,i.toBuffer)(n)).getPublic(this.pkCompressed,"hex");return this.pkHasFormatPrefix===!1&&(l=l.slice(2)),(0,s.encode)(`0x${l}`,o)}sign(n,o,l="hex"){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const E=f.keyFromPrivate((0,i.toBuffer)(o)).sign((0,i.stripHexPrefix)(h),{canonical:!0}).toDER("hex");return(0,s.encode)(`0x${E}`,l)}verify(n,o,l){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}let E=(0,i.toBuffer)(l);return this.pkHasFormatPrefix===!1&&E[0]!==4&&E.byteLength===64&&(E=C.concat([C.from([4]),E])),f.keyFromPublic(E).verify((0,i.stripHexPrefix)(h),(0,i.stripHexPrefix)((0,i.toHex)(o)))}}return ce.Secp256k1Signer=p,ce.default=new p,ce}var Pt;function un(){if(Pt)return ae;Pt=1;var e=ae&&ae.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(ae,"__esModule",{value:!0}),ae.EthereumSigner=void 0;const a=e(fr()),i=e(dr()),d=ne(),c=Tr();class s extends c.Secp256k1Signer{constructor(){super(),this.pkHasFormatPrefix=!1}ethHash(f){const p=(0,d.isHexStrict)(f)?f:(0,d.utf8ToHex)(f),g=(0,d.hexToBytes)(p),n=C.from(g),o=`Ethereum Signed Message:
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BxU3q403.js","assets/index-CuQBOJqN.js","assets/vendor-mui-core-B7zoO8f5.js","assets/vendor-react-Dvs43sk9.js","assets/vendor-ux-B7q8W4Pg.js","assets/vendor-utils-DtY42AM-.js","assets/vendor-hooks-BRXKH6Nb.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-B7AoUs4o.js","assets/index-DrVXX4fX.css","assets/index-BPy8_fa2.js","assets/index-DRYJ0xIl.js","assets/index-B5LvOF-F.css"])))=>i.map(i=>d[i]);
2
+ import{r as I,a as Rr}from"./vendor-react-Dvs43sk9.js";import{r as Gt,a as Zt,b as Qt,c as er,d as ct,e as tr,f as rr,g as nr,h as lt,i as ir,j as sr,k as or,m as Ke,n as ar,o as cr,p as lr,q as je,s as ur,t as fr,u as dr,v as hr,am as Cr,b6 as Dr,T as Be,H as De,_ as Kr,$ as pr,a5 as Ce,ab as Nr,a9 as Ir}from"./vendor-ux-B7q8W4Pg.js";import{j as r,Y as ut,bB as ft,I as dt,aj as ht,$ as pt,b1 as me,T as X,ak as k,z as V,F as M,b7 as Lr,b5 as yr,b6 as mr,a5 as gr,a3 as yt,aX as br,R as _r,Q as He,a6 as mt,W as w,am as qr,ck as Sr,cl as Mr,c9 as Fr}from"./vendor-mui-core-B7zoO8f5.js";import{B as Wr,a as Vr,l as zr}from"./index-DzqNo2lD.js";import{u as Yr}from"./useAsyncRetry-D4-sRZN-.js";import{w as Er,B as C,o as Xr,b as Jr,C as xt}from"./vendor-utils-DtY42AM-.js";import{r as Gr}from"./hdkey-BpKJbkt5.js";import{Z as Pe,c as re,a8 as Zr}from"./index-CuQBOJqN.js";import{u as $e}from"./team-Dl23XmaY.js";import{u as xr,C as z}from"./index.esm-JPZAjt0x.js";import{T as Qr}from"./index-Cd2DJL-w.js";import{E as en}from"./empty-spinner-BMVhld2Z.js";import{C as q}from"./click-to-copy-CVpUD4ji.js";import{D as tn}from"./delete-confirm-XVeEePxy.js";import{a as rn}from"./passport-item-VXkf3FVk.js";import{A as nn}from"./actions-Bf4UKTeu.js";import{T as Tt}from"./table-tips-BP283GGZ.js";import{u as sn}from"./use-mobile-C_DcJ5SZ.js";import"./vendor-hooks-BRXKH6Nb.js";import"./lottie-web-4koyQiv_.js";import"./useAsync-BrMo9m7W.js";import"./vendor-arcblock-B7AoUs4o.js";import"./session-Bk6ebojT.js";import"./isURL-Cuto2_sB.js";import"./use-app-logo-7cjs_pn8.js";import"./arrow-down.svg-lBR1lfm2.js";import"./vendor-mui-x-Qph0dQcg.js";import"./AdapterDayjs-VDBijwaM.js";import"./confirm-C9tgdTJT.js";import"./index-DBs9Ljax.js";import"./did-address-CcsL3-Qm.js";import"./util-Ca2jlZN4.js";import"./base32-D7JDMggs.js";var Ae={},ke={},Z={},Ht;function ne(){return Ht||(Ht=1,function(e){var a=Z&&Z.__createBinding||(Object.create?function(t,u,y,U){U===void 0&&(U=y);var x=Object.getOwnPropertyDescriptor(u,y);(!x||("get"in x?!u.__esModule:x.writable||x.configurable))&&(x={enumerable:!0,get:function(){return u[y]}}),Object.defineProperty(t,U,x)}:function(t,u,y,U){U===void 0&&(U=y),t[U]=u[y]}),i=Z&&Z.__setModuleDefault||(Object.create?function(t,u){Object.defineProperty(t,"default",{enumerable:!0,value:u})}:function(t,u){t.default=u}),d=Z&&Z.__importStar||function(t){if(t&&t.__esModule)return t;var u={};if(t!=null)for(var y in t)y!=="default"&&Object.prototype.hasOwnProperty.call(t,y)&&a(u,t,y);return i(u,t),u},c=Z&&Z.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.fromTokenToUnit=e.fromUnitToToken=e.numberToString=e.toHex=e.hexToBytes=e.bytesToHex=e.numberToHex=e.hexToNumber=e.hexToUtf8=e.utf8ToHex=e.toBN=e.isHex=e.isHexStrict=e.isBigNumber=e.isBN=e.stripHexPrefix=e.isHexPrefixed=e.numberToBN=e.rightPad=e.leftPad=e.BN=e.isBase58btc=void 0,e.isUint8Array=ge,e.UUID=Ge,e.isUUID=Ze,e.toUint8Array=be,e.toBuffer=Ue,e.toBase58=Qe,e.fromBase58=et,e.toBase64=tt,e.fromBase64=rt,e.toAddress=te,e.toDid=nt,e.isSameDid=it,e.formatTxType=st;const s=c(Gt),m=c(Zt),f=c(Qt),p=c(er),g=c(ct),n=c(tr),o=c(rr),l=c(nr);e.rightPad=l.default;const h=c(lt);e.leftPad=h.default;const E=c(ir()),b=c(sr()),_=c(Er());e.BN=_.default;const A=d(or()),R="did:abt:",H=new _.default(0),T=new _.default(-1),j={encode:t=>`z${E.default.encode(t)}`,decode:t=>E.default.decode(t.slice(1))},O=t=>{if(typeof t!="string")return!1;if(t[0]==="z")try{return j.decode(t),!0}catch{return!1}return!1};e.isBase58btc=O;const S=t=>{if(typeof t=="string"||typeof t=="number"){let u=new _.default(1);const y=String(t).toLowerCase().trim(),U=y.substr(0,2)==="0x"||y.substr(0,3)==="-0x";let x=(0,e.stripHexPrefix)(y);if(x.substr(0,1)==="-"&&(x=(0,e.stripHexPrefix)(x.slice(1)),u=new _.default(-1,10)),x=x===""?"0":x,!x.match(/^-?[0-9]+$/)&&x.match(/^[0-9A-Fa-f]+$/)||x.match(/^[a-fA-F]+$/)||U===!0&&x.match(/^[0-9A-Fa-f]+$/))return new _.default(x,16).mul(u);if((x.match(/^-?[0-9]+$/)||x==="")&&U===!1)return new _.default(x,10).mul(u)}if((0,e.isBN)(t))return new _.default(t.toString(10),10);throw new Error(`[number-to-bn] while converting number ${JSON.stringify(t)} to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported.`)};e.numberToBN=S;const v=t=>{if(typeof t!="string")throw new Error("[is-hex-prefixed] value must be type string");return t.slice(0,2).toLowerCase()==="0x"};e.isHexPrefixed=v;const P=t=>typeof t=="string"&&(0,e.isHexPrefixed)(t)?t.slice(2):t;e.stripHexPrefix=P;const B=t=>t instanceof _.default||t&&t.constructor&&t.constructor.name==="BN";e.isBN=B;const N=t=>t&&t.constructor&&t.constructor.name==="BigNumber";e.isBigNumber=N;const ee=t=>((0,m.default)(t)||(0,f.default)(t))&&/^(-)?0x[0-9a-f]*$/i.test(t);e.isHexStrict=ee;const Ne=t=>((0,m.default)(t)||(0,f.default)(t))&&/^(-0x|0x|0X|-0X)?[0-9a-f]*$/i.test(t);e.isHex=Ne;const Ie=(t,u=10)=>{try{if(typeof t=="number"&&t>0){const y=Number(t).toLocaleString("fullwide",{useGrouping:!1});return new _.default(y,u)}return(0,e.numberToBN)(t)}catch(y){throw new Error(`${y} Given value: "${t}"`)}};e.toBN=Ie;const Le=t=>{t=A.encode(t);let u="";t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join(""),t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join("");for(let y=0;y<t.length;y++){const x=t.charCodeAt(y).toString(16);u+=x.length<2?`0${x}`:x}return`0x${u}`};e.utf8ToHex=Le;const qe=t=>{if(!(0,e.isHexStrict)(t))throw new Error(`The parameter "${t}" must be a valid HEX string.`);let u="",y=0;t=t.replace(/^0x/i,""),t=t.replace(/^(?:00)*/,""),t=t.split("").reverse().join(""),t=t.replace(/^(?:00)*/,""),t=t.split("").reverse().join("");const U=t.length;for(let x=0;x<U;x+=2)y=parseInt(t.substr(x,2),16),u+=String.fromCharCode(y);return A.decode(u)};e.hexToUtf8=qe;const Me=t=>t?(0,e.toBN)(t).toNumber():0;e.hexToNumber=Me;const Fe=t=>{if((0,o.default)(t)||typeof t>"u")return t;if(!isFinite(t)&&!(0,e.isHex)(t))throw new Error(`Given input "${t}" is not a number.`);const u=(0,e.toBN)(t),y=u.toString(16);return u.lt(new _.default(0))?`-0x${y.substr(1)}`:`0x${y}`};e.numberToHex=Fe;const We=t=>{const u=[];for(let y=0;y<t.length;y++)u.push((t[y]>>>4).toString(16)),u.push((t[y]&15).toString(16));return`0x${u.join("")}`};e.bytesToHex=We;const Ve=t=>{if(t=t.toString(16),!(0,e.isHex)(t))throw new Error(`Given value "${t}" is not a valid hex string.`);t=t.replace(/^0x/i,""),t=t.length%2?`0${t}`:t;const u=[];for(let y=0;y<t.length;y+=2)u.push(parseInt(t.substr(y,2),16));return u};e.hexToBytes=Ve;const ze=(t,u=!1)=>ge(t)||C.isBuffer(t)?u?"bytes":(0,e.bytesToHex)(t):(0,e.isBase58btc)(t)?u?"bytes":(0,e.bytesToHex)(j.decode(t)):(0,s.default)(t)?u?"bool":t?"0x01":"0x00":(0,p.default)(t)&&!(0,e.isBigNumber)(t)&&!(0,e.isBN)(t)?u?"string":(0,e.utf8ToHex)(JSON.stringify(t)):typeof t=="string"?t.indexOf("-0x")===0||t.indexOf("-0X")===0?u?"int256":(0,e.numberToHex)(t):t.indexOf("0x")===0||t.indexOf("0X")===0?u?"bytes":t:u?"string":(0,e.utf8ToHex)(t):u?+t<0?"int256":"uint256":(0,e.numberToHex)(t);e.toHex=ze;const Ye=t=>{if(typeof t=="string"){if(!t.match(/^-?[0-9.]+$/))throw new Error(`Invalid value '${t}' while converting to string, should be a number matching (^-?[0-9.]+).`);return t}if(typeof t=="number")return Number.isInteger(t)&&t>0?Number(t).toLocaleString("fullwide",{useGrouping:!1}):String(t);if(typeof t=="object"&&t.toString&&(t.toTwos||t.dividedToIntegerBy))return t.toPrecision?String(t.toPrecision()):t.toString(10);throw new Error(`while converting number to string, invalid number value '${t}' type ${typeof t}.`)};e.numberToString=Ye;const Xe=(t,u=18,y={})=>{let U=(0,e.toBN)(t);const x=U.lt(H),F=(0,e.toBN)(`1${"0".repeat(u)}`,10),G=F.toString(10).length-1||1,K=y||{};x&&(U=U.mul(T));let $=U.mod(F).toString(10);for(;$.length<G;)$=`0${$}`;K.pad||($=$.match(/^([0-9]*[1-9]|0)(0*)/)[1]);let L=U.div(F).toString(10);K.commify&&(L=L.replace(/\B(?=(\d{3})+(?!\d))/g,","));let _e=`${L}${$==="0"?"":`.${$}`}`;return x&&(_e=`-${_e}`),_e};e.fromUnitToToken=Xe;const Je=(t,u=18)=>{let y=(0,e.numberToString)(t);const U=(0,e.toBN)(`1${"0".repeat(u)}`,10),x=U.toString(10).length-1||1,F=y.substring(0,1)==="-";if(F&&(y=y.substring(1)),y===".")throw new Error(`error converting token ${t} to unit, invalid value`);const G=y.split(".");if(G.length>2)throw new Error(`error converting token ${t} to unit, too many decimal points`);let K=G[0],$=G[1];if(K||(K="0"),$||($="0"),$.length>x)throw new Error(`error converting token ${t} to unit, too many decimal places`);for(;$.length<x;)$+="0";K=new _.default(K),$=new _.default($);let L=K.mul(U).add($);return F&&(L=L.mul(T)),new _.default(L.toString(10),10)};e.fromTokenToUnit=Je;function ge(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Ge(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const u=Math.random()*16|0;return(t==="x"?u:u&3|8).toString(16)})}function Ze(t){return/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.test(t)}function be(t){let u=null;if([null,void 0,""].includes(t))u=new Uint8Array;else if(C.isBuffer(t))u=new Uint8Array(t);else if((0,e.isHexStrict)(t))u=new Uint8Array((0,e.hexToBytes)(t));else if(ge(t))u=new Uint8Array(t);else if((0,e.isBase58btc)(t))u=new Uint8Array(j.decode(t));else if(typeof t=="string")u=new Uint8Array((0,e.hexToBytes)((0,e.toHex)(t)));else throw new Error(`Unsupported input type ${typeof t} detected for toBuffer, only Uint8Array/Buffer/Hex/Base58 are supported`);return u}function Ue(t){return C.from(be(t))}function Qe(t){const u=j.encode(be(t));return C.from(u).toString("utf-8")}function et(t){if((0,e.isBase58btc)(t)===!1)throw new Error("fromBase58 expect strict base58 encoded string as input");return C.from(j.decode(t))}function tt(t,u=!0){const y=b.default.encode(Ue(t));return u?b.default.escape(y):y}function rt(t){if(typeof t!="string")throw new Error("fromBase64 requires input to be a string");return C.from(b.default.unescape(t),"base64")}function te(t){return t.replace(R,"")}function nt(t){return`${R}${te(t)}`}function it(t,u){return te(t).toLowerCase()===te(u).toLowerCase()}function st(t){return(0,g.default)((0,n.default)(t))}}(Z)),Z}var jt;function ve(){if(jt)return ke;jt=1,Object.defineProperty(ke,"__esModule",{value:!0}),ke.encode=a;const e=ne();function a(i,d="hex"){return["hex","base16"].includes(d)?(0,e.toHex)(i):d==="base58"?(0,e.toBase58)(i):d==="base64"?(0,e.toBase64)(i):d==="Uint8Array"?(0,e.toUint8Array)(i):d==="buffer"?(0,e.toBuffer)(i):i}return ke}var ie={},vt;function on(){if(vt)return ie;vt=1;var e=ie&&ie.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ie,"__esModule",{value:!0}),ie.KeccakHasher=void 0;const a=e(Ke()),i=ne(),d=ve();class c{constructor(){[224,256,384,512].forEach(m=>{const f=`hash${m}`,p=n=>a.default[`keccak${m}`](n),g=(n,o)=>o===1?p(n):g(p(n),o-1);this[f]=(n,o=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const E=g(h,o);return(0,d.encode)(`0x${E}`,l)}})}}return ie.KeccakHasher=c,ie.default=new c,ie}var Se={},wt;function an(){if(wt)return Se;wt=1,Object.defineProperty(Se,"__esModule",{value:!0}),Se.Sha2Hasher=void 0;const e=ne(),a=ar(),i=ve(),d={sha224:a.sha224,sha256:a.sha256,sha384:a.sha384,sha512:a.sha512};class c{constructor(){[224,256,384,512].forEach(m=>{const f=`hash${m}`,p=d[`sha${m}`],g=(n,o)=>{let l=n;try{l=(0,e.toUint8Array)(n)}catch{}return o===1?`0x${p().update(l).digest("hex")}`:g(g(l,1),o-1)};this[f]=(n,o=2,l="hex")=>{const h=g(n,o);return(0,i.encode)(h,l)}})}}return Se.Sha2Hasher=c,Se.default=new c,Se}var se={},Ut;function cn(){if(Ut)return se;Ut=1;var e=se&&se.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(se,"__esModule",{value:!0}),se.Sha3Hasher=void 0;const a=e(Ke()),i=ne(),d=ve();class c{constructor(){[224,256,384,512].forEach(m=>{const f=`hash${m}`,p=a.default[`sha3_${m}`],g=(n,o)=>o===1?p(n):g(p(n),o-1);this[f]=(n,o=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const E=g(h,o);return(0,d.encode)(`0x${E}`,l)}})}}return se.Sha3Hasher=c,se.default=new c,se}var oe={},Ee={},At;function gt(){if(At)return Ee;At=1;var e=Ee&&Ee.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Ee,"__esModule",{value:!0});const a=e(cr());return Ee.default=a.default.create("genKeyPair","getPublicKey","sign","verify"),Ee}var Ot;function ln(){if(Ot)return oe;Ot=1;var e=oe&&oe.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(oe,"__esModule",{value:!0}),oe.Ed25519Signer=void 0;const a=e(lr()),i=e(je()),d=ne(),c=e(gt()),s=ve(),m=a.default.sign;class f extends c.default{constructor(){super()}genKeyPair(g="hex",n){const o=n?(0,d.toUint8Array)(n):new Uint8Array((0,i.default)(32));if(o.byteLength!==32)throw new Error("Invalid seed to generate key pair");const l=m.keyPair.fromSeed(o);return l.publicKey=(0,s.encode)(l.publicKey,g),l.secretKey=(0,s.encode)(l.secretKey,g),l}getPublicKey(g,n="hex"){const o=(0,d.toUint8Array)(g),l=m.keyPair.fromSecretKey(o).publicKey;return(0,s.encode)(l,n)}sign(g,n,o="hex"){const l=(0,d.toUint8Array)(n),h=(0,d.toUint8Array)(g),E=m.detached(h,l);return(0,s.encode)(E,o)}verify(g,n,o){const l=(0,d.toUint8Array)(o),h=(0,d.toUint8Array)(g),E=(0,d.toUint8Array)(n);return m.detached.verify(h,E,l)}}return oe.Ed25519Signer=f,oe.default=new f,oe}var ae={},ce={},Bt;function Tr(){if(Bt)return ce;Bt=1;var e=ce&&ce.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(ce,"__esModule",{value:!0}),ce.Secp256k1Signer=void 0;const a=e(ur()),i=ne(),d=e(je()),c=e(gt()),s=ve(),m=a.default.ec,f=new m("secp256k1");class p extends c.default{constructor(){super(),this.pkHasFormatPrefix=!0,this.pkCompressed=!1}isValidSK(n){if(n.byteLength!==32)return!1;const o=new i.BN(n);return o.cmp(f.curve.n)<0&&!o.isZero()}genKeyPair(n="hex"){let o=null;do o=new Uint8Array((0,d.default)(32));while(!this.isValidSK(o));const l=this.getPublicKey((0,i.toHex)(o));return{secretKey:(0,s.encode)(o,n),publicKey:(0,s.encode)(l,n)}}getPublicKey(n,o="hex"){if(!this.isValidSK((0,i.toUint8Array)(n)))throw new Error("Invalid secret key");let l=f.keyFromPrivate((0,i.toBuffer)(n)).getPublic(this.pkCompressed,"hex");return this.pkHasFormatPrefix===!1&&(l=l.slice(2)),(0,s.encode)(`0x${l}`,o)}sign(n,o,l="hex"){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const E=f.keyFromPrivate((0,i.toBuffer)(o)).sign((0,i.stripHexPrefix)(h),{canonical:!0}).toDER("hex");return(0,s.encode)(`0x${E}`,l)}verify(n,o,l){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}let E=(0,i.toBuffer)(l);return this.pkHasFormatPrefix===!1&&E[0]!==4&&E.byteLength===64&&(E=C.concat([C.from([4]),E])),f.keyFromPublic(E).verify((0,i.stripHexPrefix)(h),(0,i.stripHexPrefix)((0,i.toHex)(o)))}}return ce.Secp256k1Signer=p,ce.default=new p,ce}var Pt;function un(){if(Pt)return ae;Pt=1;var e=ae&&ae.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(ae,"__esModule",{value:!0}),ae.EthereumSigner=void 0;const a=e(fr()),i=e(dr()),d=ne(),c=Tr();class s extends c.Secp256k1Signer{constructor(){super(),this.pkHasFormatPrefix=!1}ethHash(f){const p=(0,d.isHexStrict)(f)?f:(0,d.utf8ToHex)(f),g=(0,d.hexToBytes)(p),n=C.from(g),o=`Ethereum Signed Message:
3
3
  ${g.length}`,l=C.from(o),h=C.concat([l,n]);return i.default.keccak256s(h)}ethSign(f,p){return a.default.sign(f,p)}ethRecover(f,p){return a.default.recover(f,p)}}return ae.EthereumSigner=s,ae.default=new s,ae}var le={},$t;function fn(){if($t)return le;$t=1;var e=le&&le.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(le,"__esModule",{value:!0}),le.PasskeySigner=void 0;const a=ne(),i=hr(),d=e(gt());class c extends d.default{constructor(){super()}genKeyPair(m="hex",f){throw new Error("Not supported")}getPublicKey(m,f="hex"){throw new Error("Not supported")}sign(m,f,p="hex"){throw new Error("Not supported")}async verify(m,f,p,g){const n=JSON.parse(g);if(!n.authenticatorData||!n.clientDataJSON)throw new Error("extra.authenticatorData or extra.clientDataJSON is required for passkey signature verification");const o=(0,a.toBuffer)((0,a.fromBase64)(n.authenticatorData)),l=await(0,i.toHash)(i.isoBase64URL.toBuffer(n.clientDataJSON));if((0,i.decodeClientDataJSON)(n.clientDataJSON).challenge!==(0,a.toBase64)(m))throw new Error("challenge mismatch for passkey signature");return(0,i.verifySignature)({signature:i.isoBase64URL.toBuffer(typeof f=="string"?f:(0,a.toBase64)(f)),data:i.isoUint8Array.concat([o,l]),credentialPublicKey:p})}}return le.PasskeySigner=c,le.default=new c,le}var kt;function dn(){return kt||(kt=1,function(e){var a=Ae&&Ae.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(e,"__esModule",{value:!0}),e.toTxHash=e.Hashers=e.Signers=e.types=e.Hasher=e.Signer=void 0,e.getSigner=o,e.getHasher=l,e.getRandomBytes=h;const i=a(je()),d=ve(),c=a(on()),s=a(an()),m=a(cn()),f=a(ln()),p=a(un()),g=a(Tr()),n=a(fn());e.Signer={Ed25519:f.default,Secp256k1:g.default,Ethereum:p.default,Passkey:n.default},e.Hasher={SHA2:s.default,SHA3:m.default,Keccak:c.default},e.types={KeyType:{ED25519:0,SECP256K1:1,ETHEREUM:2,PASSKEY:3},HashType:{KECCAK:0,SHA3:1,KECCAK_384:2,SHA3_384:3,KECCAK_512:4,SHA3_512:5,SHA2:6},RoleType:{ROLE_ACCOUNT:0,ROLE_NODE:1,ROLE_DEVICE:2,ROLE_APPLICATION:3,ROLE_SMART_CONTRACT:4,ROLE_BOT:5,ROLE_ASSET:6,ROLE_STAKE:7,ROLE_VALIDATOR:8,ROLE_GROUP:9,ROLE_TX:10,ROLE_TETHER:11,ROLE_SWAP:12,ROLE_DELEGATION:13,ROLE_VC:14,ROLE_BLOCKLET:15,ROLE_STORE:16,ROLE_TOKEN:17,ROLE_FACTORY:18,ROLE_ROLLUP:19,ROLE_STORAGE:20,ROLE_PROFILE:21,ROLE_PASSKEY:22,ROLE_TOKEN_FACTORY:23,ROLE_ANY:63},EncodingType:{BASE16:0,BASE58:1}};function o(b){if(typeof e.Signers[b]>"u")throw new Error(`Unsupported signer type: ${b}`);return e.Signers[b]}function l(b){if(typeof e.Hashers[b]>"u")throw new Error(`Unsupported hash type: ${b}`);return e.Hashers[b]}function h(b=32,_="hex"){return(0,d.encode)((0,i.default)(b),_)}e.Signers=Object.freeze({[e.types.KeyType.ED25519]:e.Signer.Ed25519,[e.types.KeyType.SECP256K1]:e.Signer.Secp256k1,[e.types.KeyType.ETHEREUM]:e.Signer.Ethereum,[e.types.KeyType.PASSKEY]:e.Signer.Passkey}),e.Hashers=Object.freeze({[e.types.HashType.KECCAK]:e.Hasher.Keccak.hash256,[e.types.HashType.KECCAK_384]:e.Hasher.Keccak.hash384,[e.types.HashType.KECCAK_512]:e.Hasher.Keccak.hash512,[e.types.HashType.SHA3]:e.Hasher.SHA3.hash256,[e.types.HashType.SHA3_384]:e.Hasher.SHA3.hash384,[e.types.HashType.SHA3_512]:e.Hasher.SHA3.hash512,[e.types.HashType.SHA2]:e.Hasher.SHA2.hash256});const E=b=>e.Hasher.SHA2.hash256(b,1,"hex").replace(/^0x/,"").toUpperCase();e.toTxHash=E}(Ae)),Ae}var Y={},Q={},Rt;function J(){return Rt||(Rt=1,function(e){var a=Q&&Q.__createBinding||(Object.create?function(t,u,y,U){U===void 0&&(U=y);var x=Object.getOwnPropertyDescriptor(u,y);(!x||("get"in x?!u.__esModule:x.writable||x.configurable))&&(x={enumerable:!0,get:function(){return u[y]}}),Object.defineProperty(t,U,x)}:function(t,u,y,U){U===void 0&&(U=y),t[U]=u[y]}),i=Q&&Q.__setModuleDefault||(Object.create?function(t,u){Object.defineProperty(t,"default",{enumerable:!0,value:u})}:function(t,u){t.default=u}),d=Q&&Q.__importStar||function(t){if(t&&t.__esModule)return t;var u={};if(t!=null)for(var y in t)y!=="default"&&Object.prototype.hasOwnProperty.call(t,y)&&a(u,t,y);return i(u,t),u},c=Q&&Q.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(e,"__esModule",{value:!0}),e.fromTokenToUnit=e.fromUnitToToken=e.numberToString=e.toHex=e.hexToBytes=e.bytesToHex=e.numberToHex=e.hexToNumber=e.hexToUtf8=e.utf8ToHex=e.toBN=e.isHex=e.isHexStrict=e.isBigNumber=e.isBN=e.stripHexPrefix=e.isHexPrefixed=e.numberToBN=e.rightPad=e.leftPad=e.BN=e.isBase58btc=void 0,e.isUint8Array=ge,e.UUID=Ge,e.isUUID=Ze,e.toUint8Array=be,e.toBuffer=Ue,e.toBase58=Qe,e.fromBase58=et,e.toBase64=tt,e.fromBase64=rt,e.toAddress=te,e.toDid=nt,e.isSameDid=it,e.formatTxType=st;const s=c(Gt),m=c(Zt),f=c(Qt),p=c(er),g=c(ct),n=c(tr),o=c(rr),l=c(nr);e.rightPad=l.default;const h=c(lt);e.leftPad=h.default;const E=c(ir()),b=c(sr()),_=c(Er());e.BN=_.default;const A=d(or()),R="did:abt:",H=new _.default(0),T=new _.default(-1),j={encode:t=>`z${E.default.encode(t)}`,decode:t=>E.default.decode(t.slice(1))},O=t=>{if(typeof t!="string")return!1;if(t[0]==="z")try{return j.decode(t),!0}catch{return!1}return!1};e.isBase58btc=O;const S=t=>{if(typeof t=="string"||typeof t=="number"){let u=new _.default(1);const y=String(t).toLowerCase().trim(),U=y.substr(0,2)==="0x"||y.substr(0,3)==="-0x";let x=(0,e.stripHexPrefix)(y);if(x.substr(0,1)==="-"&&(x=(0,e.stripHexPrefix)(x.slice(1)),u=new _.default(-1,10)),x=x===""?"0":x,!x.match(/^-?[0-9]+$/)&&x.match(/^[0-9A-Fa-f]+$/)||x.match(/^[a-fA-F]+$/)||U===!0&&x.match(/^[0-9A-Fa-f]+$/))return new _.default(x,16).mul(u);if((x.match(/^-?[0-9]+$/)||x==="")&&U===!1)return new _.default(x,10).mul(u)}if((0,e.isBN)(t))return new _.default(t.toString(10),10);throw new Error(`[number-to-bn] while converting number ${JSON.stringify(t)} to BN.js instance, error: invalid number value. Value must be an integer, hex string, BN or BigNumber instance. Note, decimals are not supported.`)};e.numberToBN=S;const v=t=>{if(typeof t!="string")throw new Error("[is-hex-prefixed] value must be type string");return t.slice(0,2).toLowerCase()==="0x"};e.isHexPrefixed=v;const P=t=>typeof t=="string"&&(0,e.isHexPrefixed)(t)?t.slice(2):t;e.stripHexPrefix=P;const B=t=>t instanceof _.default||t&&t.constructor&&t.constructor.name==="BN";e.isBN=B;const N=t=>t&&t.constructor&&t.constructor.name==="BigNumber";e.isBigNumber=N;const ee=t=>((0,m.default)(t)||(0,f.default)(t))&&/^(-)?0x[0-9a-f]*$/i.test(t);e.isHexStrict=ee;const Ne=t=>((0,m.default)(t)||(0,f.default)(t))&&/^(-0x|0x|0X|-0X)?[0-9a-f]*$/i.test(t);e.isHex=Ne;const Ie=(t,u=10)=>{try{if(typeof t=="number"&&t>0){const y=Number(t).toLocaleString("fullwide",{useGrouping:!1});return new _.default(y,u)}return(0,e.numberToBN)(t)}catch(y){throw new Error(`${y} Given value: "${t}"`)}};e.toBN=Ie;const Le=t=>{t=A.encode(t);let u="";t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join(""),t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join("");for(let y=0;y<t.length;y++){const x=t.charCodeAt(y).toString(16);u+=x.length<2?`0${x}`:x}return`0x${u}`};e.utf8ToHex=Le;const qe=t=>{if(!(0,e.isHexStrict)(t))throw new Error(`The parameter "${t}" must be a valid HEX string.`);let u="",y=0;t=t.replace(/^0x/i,""),t=t.replace(/^(?:00)*/,""),t=t.split("").reverse().join(""),t=t.replace(/^(?:00)*/,""),t=t.split("").reverse().join("");const U=t.length;for(let x=0;x<U;x+=2)y=parseInt(t.substr(x,2),16),u+=String.fromCharCode(y);return A.decode(u)};e.hexToUtf8=qe;const Me=t=>t?(0,e.toBN)(t).toNumber():0;e.hexToNumber=Me;const Fe=t=>{if((0,o.default)(t)||typeof t>"u")return t;if(!isFinite(t)&&!(0,e.isHex)(t))throw new Error(`Given input "${t}" is not a number.`);const u=(0,e.toBN)(t),y=u.toString(16);return u.lt(new _.default(0))?`-0x${y.substr(1)}`:`0x${y}`};e.numberToHex=Fe;const We=t=>{const u=[];for(let y=0;y<t.length;y++)u.push((t[y]>>>4).toString(16)),u.push((t[y]&15).toString(16));return`0x${u.join("")}`};e.bytesToHex=We;const Ve=t=>{if(t=t.toString(16),!(0,e.isHex)(t))throw new Error(`Given value "${t}" is not a valid hex string.`);t=t.replace(/^0x/i,""),t=t.length%2?`0${t}`:t;const u=[];for(let y=0;y<t.length;y+=2)u.push(parseInt(t.substr(y,2),16));return u};e.hexToBytes=Ve;const ze=(t,u=!1)=>ge(t)||C.isBuffer(t)?u?"bytes":(0,e.bytesToHex)(t):(0,e.isBase58btc)(t)?u?"bytes":(0,e.bytesToHex)(j.decode(t)):(0,s.default)(t)?u?"bool":t?"0x01":"0x00":(0,p.default)(t)&&!(0,e.isBigNumber)(t)&&!(0,e.isBN)(t)?u?"string":(0,e.utf8ToHex)(JSON.stringify(t)):typeof t=="string"?t.indexOf("-0x")===0||t.indexOf("-0X")===0?u?"int256":(0,e.numberToHex)(t):t.indexOf("0x")===0||t.indexOf("0X")===0?u?"bytes":t:u?"string":(0,e.utf8ToHex)(t):u?+t<0?"int256":"uint256":(0,e.numberToHex)(t);e.toHex=ze;const Ye=t=>{if(typeof t=="string"){if(!t.match(/^-?[0-9.]+$/))throw new Error(`Invalid value '${t}' while converting to string, should be a number matching (^-?[0-9.]+).`);return t}if(typeof t=="number")return Number.isInteger(t)&&t>0?Number(t).toLocaleString("fullwide",{useGrouping:!1}):String(t);if(typeof t=="object"&&t.toString&&(t.toTwos||t.dividedToIntegerBy))return t.toPrecision?String(t.toPrecision()):t.toString(10);throw new Error(`while converting number to string, invalid number value '${t}' type ${typeof t}.`)};e.numberToString=Ye;const Xe=(t,u=18,y={})=>{let U=(0,e.toBN)(t);const x=U.lt(H),F=(0,e.toBN)(`1${"0".repeat(u)}`,10),G=F.toString(10).length-1||1,K=y||{};x&&(U=U.mul(T));let $=U.mod(F).toString(10);for(;$.length<G;)$=`0${$}`;K.pad||($=$.match(/^([0-9]*[1-9]|0)(0*)/)[1]);let L=U.div(F).toString(10);K.commify&&(L=L.replace(/\B(?=(\d{3})+(?!\d))/g,","));let _e=`${L}${$==="0"?"":`.${$}`}`;return x&&(_e=`-${_e}`),_e};e.fromUnitToToken=Xe;const Je=(t,u=18)=>{let y=(0,e.numberToString)(t);const U=(0,e.toBN)(`1${"0".repeat(u)}`,10),x=U.toString(10).length-1||1,F=y.substring(0,1)==="-";if(F&&(y=y.substring(1)),y===".")throw new Error(`error converting token ${t} to unit, invalid value`);const G=y.split(".");if(G.length>2)throw new Error(`error converting token ${t} to unit, too many decimal points`);let K=G[0],$=G[1];if(K||(K="0"),$||($="0"),$.length>x)throw new Error(`error converting token ${t} to unit, too many decimal places`);for(;$.length<x;)$+="0";K=new _.default(K),$=new _.default($);let L=K.mul(U).add($);return F&&(L=L.mul(T)),new _.default(L.toString(10),10)};e.fromTokenToUnit=Je;function ge(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Ge(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const u=Math.random()*16|0;return(t==="x"?u:u&3|8).toString(16)})}function Ze(t){return/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.test(t)}function be(t){let u=null;if([null,void 0,""].includes(t))u=new Uint8Array;else if(C.isBuffer(t))u=new Uint8Array(t);else if((0,e.isHexStrict)(t))u=new Uint8Array((0,e.hexToBytes)(t));else if(ge(t))u=new Uint8Array(t);else if((0,e.isBase58btc)(t))u=new Uint8Array(j.decode(t));else if(typeof t=="string")u=new Uint8Array((0,e.hexToBytes)((0,e.toHex)(t)));else throw new Error(`Unsupported input type ${typeof t} detected for toBuffer, only Uint8Array/Buffer/Hex/Base58 are supported`);return u}function Ue(t){return C.from(be(t))}function Qe(t){const u=j.encode(be(t));return C.from(u).toString("utf-8")}function et(t){if((0,e.isBase58btc)(t)===!1)throw new Error("fromBase58 expect strict base58 encoded string as input");return C.from(j.decode(t))}function tt(t,u=!0){const y=b.default.encode(Ue(t));return u?b.default.escape(y):y}function rt(t){if(typeof t!="string")throw new Error("fromBase64 requires input to be a string");return C.from(b.default.unescape(t),"base64")}function te(t){return t.replace(R,"")}function nt(t){return`${R}${te(t)}`}function it(t,u){return te(t).toLowerCase()===te(u).toLowerCase()}function st(t){return(0,g.default)((0,n.default)(t))}}(Q)),Q}var Oe={},Re={},Ct;function we(){if(Ct)return Re;Ct=1,Object.defineProperty(Re,"__esModule",{value:!0}),Re.encode=a;const e=J();function a(i,d="hex"){return["hex","base16"].includes(d)?(0,e.toHex)(i):d==="base58"?(0,e.toBase58)(i):d==="base64"?(0,e.toBase64)(i):d==="Uint8Array"?(0,e.toUint8Array)(i):d==="buffer"?(0,e.toBuffer)(i):i}return Re}var ue={},Dt;function hn(){if(Dt)return ue;Dt=1;var e=ue&&ue.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ue,"__esModule",{value:!0}),ue.KeccakHasher=void 0;const a=e(Ke()),i=J(),d=we();class c{constructor(){[224,256,384,512].forEach(m=>{const f=`hash${m}`,p=n=>a.default[`keccak${m}`](n),g=(n,o)=>o===1?p(n):g(p(n),o-1);this[f]=(n,o=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const E=g(h,o);return(0,d.encode)(`0x${E}`,l)}})}}return ue.KeccakHasher=c,ue.default=new c,ue}var xe={},Kt;function pn(){if(Kt)return xe;Kt=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.Sha2Hasher=void 0;const e=J(),a=ar(),i=we(),d={sha224:a.sha224,sha256:a.sha256,sha384:a.sha384,sha512:a.sha512};class c{constructor(){[224,256,384,512].forEach(m=>{const f=`hash${m}`,p=d[`sha${m}`],g=(n,o)=>{let l=n;try{l=(0,e.toUint8Array)(n)}catch{}return o===1?`0x${p().update(l).digest("hex")}`:g(g(l,1),o-1)};this[f]=(n,o=2,l="hex")=>{const h=g(n,o);return(0,i.encode)(h,l)}})}}return xe.Sha2Hasher=c,xe.default=new c,xe}var fe={},Nt;function yn(){if(Nt)return fe;Nt=1;var e=fe&&fe.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(fe,"__esModule",{value:!0}),fe.Sha3Hasher=void 0;const a=e(Ke()),i=J(),d=we();class c{constructor(){[224,256,384,512].forEach(m=>{const f=`hash${m}`,p=a.default[`sha3_${m}`],g=(n,o)=>o===1?p(n):g(p(n),o-1);this[f]=(n,o=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const E=g(h,o);return(0,d.encode)(`0x${E}`,l)}})}}return fe.Sha3Hasher=c,fe.default=new c,fe}var de={},Te={},It;function bt(){if(It)return Te;It=1;var e=Te&&Te.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Te,"__esModule",{value:!0});const a=e(cr());return Te.default=a.default.create("genKeyPair","getPublicKey","sign","verify"),Te}var Lt;function mn(){if(Lt)return de;Lt=1;var e=de&&de.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(de,"__esModule",{value:!0}),de.Ed25519Signer=void 0;const a=e(lr()),i=e(je()),d=J(),c=e(bt()),s=we(),m=a.default.sign;class f extends c.default{constructor(){super()}genKeyPair(g="hex",n){const o=n?(0,d.toUint8Array)(n):new Uint8Array((0,i.default)(32));if(o.byteLength!==32)throw new Error("Invalid seed to generate key pair");const l=m.keyPair.fromSeed(o);return l.publicKey=(0,s.encode)(l.publicKey,g),l.secretKey=(0,s.encode)(l.secretKey,g),l}getPublicKey(g,n="hex"){const o=(0,d.toUint8Array)(g),l=m.keyPair.fromSecretKey(o).publicKey;return(0,s.encode)(l,n)}sign(g,n,o="hex"){const l=(0,d.toUint8Array)(n),h=(0,d.toUint8Array)(g),E=m.detached(h,l);return(0,s.encode)(E,o)}verify(g,n,o){const l=(0,d.toUint8Array)(o),h=(0,d.toUint8Array)(g),E=(0,d.toUint8Array)(n);return m.detached.verify(h,E,l)}}return de.Ed25519Signer=f,de.default=new f,de}var he={},pe={},qt;function Hr(){if(qt)return pe;qt=1;var e=pe&&pe.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(pe,"__esModule",{value:!0}),pe.Secp256k1Signer=void 0;const a=e(ur()),i=J(),d=e(je()),c=e(bt()),s=we(),m=a.default.ec,f=new m("secp256k1");class p extends c.default{constructor(){super(),this.pkHasFormatPrefix=!0,this.pkCompressed=!1}isValidSK(n){if(n.byteLength!==32)return!1;const o=new i.BN(n);return o.cmp(f.curve.n)<0&&!o.isZero()}genKeyPair(n="hex"){let o=null;do o=new Uint8Array((0,d.default)(32));while(!this.isValidSK(o));const l=this.getPublicKey((0,i.toHex)(o));return{secretKey:(0,s.encode)(o,n),publicKey:(0,s.encode)(l,n)}}getPublicKey(n,o="hex"){if(!this.isValidSK((0,i.toUint8Array)(n)))throw new Error("Invalid secret key");let l=f.keyFromPrivate((0,i.toBuffer)(n)).getPublic(this.pkCompressed,"hex");return this.pkHasFormatPrefix===!1&&(l=l.slice(2)),(0,s.encode)(`0x${l}`,o)}sign(n,o,l="hex"){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const E=f.keyFromPrivate((0,i.toBuffer)(o)).sign((0,i.stripHexPrefix)(h),{canonical:!0}).toDER("hex");return(0,s.encode)(`0x${E}`,l)}verify(n,o,l){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}let E=(0,i.toBuffer)(l);return this.pkHasFormatPrefix===!1&&E[0]!==4&&E.byteLength===64&&(E=C.concat([C.from([4]),E])),f.keyFromPublic(E).verify((0,i.stripHexPrefix)(h),(0,i.stripHexPrefix)((0,i.toHex)(o)))}}return pe.Secp256k1Signer=p,pe.default=new p,pe}var Mt;function gn(){if(Mt)return he;Mt=1;var e=he&&he.__importDefault||function(m){return m&&m.__esModule?m:{default:m}};Object.defineProperty(he,"__esModule",{value:!0}),he.EthereumSigner=void 0;const a=e(fr()),i=e(dr()),d=J(),c=Hr();class s extends c.Secp256k1Signer{constructor(){super(),this.pkHasFormatPrefix=!1}ethHash(f){const p=(0,d.isHexStrict)(f)?f:(0,d.utf8ToHex)(f),g=(0,d.hexToBytes)(p),n=C.from(g),o=`Ethereum Signed Message:
4
- ${g.length}`,l=C.from(o),h=C.concat([l,n]);return i.default.keccak256s(h)}ethSign(f,p){return a.default.sign(f,p)}ethRecover(f,p){return a.default.recover(f,p)}}return he.EthereumSigner=s,he.default=new s,he}var ye={},Ft;function bn(){if(Ft)return ye;Ft=1;var e=ye&&ye.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ye,"__esModule",{value:!0}),ye.PasskeySigner=void 0;const a=J(),i=hr(),d=e(bt());class c extends d.default{constructor(){super()}genKeyPair(m="hex",f){throw new Error("Not supported")}getPublicKey(m,f="hex"){throw new Error("Not supported")}sign(m,f,p="hex"){throw new Error("Not supported")}async verify(m,f,p,g){const n=JSON.parse(g);if(!n.authenticatorData||!n.clientDataJSON)throw new Error("extra.authenticatorData or extra.clientDataJSON is required for passkey signature verification");const o=(0,a.toBuffer)((0,a.fromBase64)(n.authenticatorData)),l=await(0,i.toHash)(i.isoBase64URL.toBuffer(n.clientDataJSON));if((0,i.decodeClientDataJSON)(n.clientDataJSON).challenge!==(0,a.toBase64)(m))throw new Error("challenge mismatch for passkey signature");return(0,i.verifySignature)({signature:i.isoBase64URL.toBuffer(typeof f=="string"?f:(0,a.toBase64)(f)),data:i.isoUint8Array.concat([o,l]),credentialPublicKey:p})}}return ye.PasskeySigner=c,ye.default=new c,ye}var Wt;function _t(){return Wt||(Wt=1,function(e){var a=Oe&&Oe.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(e,"__esModule",{value:!0}),e.toTxHash=e.Hashers=e.Signers=e.types=e.Hasher=e.Signer=void 0,e.getSigner=o,e.getHasher=l,e.getRandomBytes=h;const i=a(je()),d=we(),c=a(hn()),s=a(pn()),m=a(yn()),f=a(mn()),p=a(gn()),g=a(Hr()),n=a(bn());e.Signer={Ed25519:f.default,Secp256k1:g.default,Ethereum:p.default,Passkey:n.default},e.Hasher={SHA2:s.default,SHA3:m.default,Keccak:c.default},e.types={KeyType:{ED25519:0,SECP256K1:1,ETHEREUM:2,PASSKEY:3},HashType:{KECCAK:0,SHA3:1,KECCAK_384:2,SHA3_384:3,KECCAK_512:4,SHA3_512:5,SHA2:6},RoleType:{ROLE_ACCOUNT:0,ROLE_NODE:1,ROLE_DEVICE:2,ROLE_APPLICATION:3,ROLE_SMART_CONTRACT:4,ROLE_BOT:5,ROLE_ASSET:6,ROLE_STAKE:7,ROLE_VALIDATOR:8,ROLE_GROUP:9,ROLE_TX:10,ROLE_TETHER:11,ROLE_SWAP:12,ROLE_DELEGATION:13,ROLE_VC:14,ROLE_BLOCKLET:15,ROLE_STORE:16,ROLE_TOKEN:17,ROLE_FACTORY:18,ROLE_ROLLUP:19,ROLE_STORAGE:20,ROLE_PROFILE:21,ROLE_PASSKEY:22,ROLE_TOKEN_FACTORY:23,ROLE_ANY:63},EncodingType:{BASE16:0,BASE58:1}};function o(b){if(typeof e.Signers[b]>"u")throw new Error(`Unsupported signer type: ${b}`);return e.Signers[b]}function l(b){if(typeof e.Hashers[b]>"u")throw new Error(`Unsupported hash type: ${b}`);return e.Hashers[b]}function h(b=32,_="hex"){return(0,d.encode)((0,i.default)(b),_)}e.Signers=Object.freeze({[e.types.KeyType.ED25519]:e.Signer.Ed25519,[e.types.KeyType.SECP256K1]:e.Signer.Secp256k1,[e.types.KeyType.ETHEREUM]:e.Signer.Ethereum,[e.types.KeyType.PASSKEY]:e.Signer.Passkey}),e.Hashers=Object.freeze({[e.types.HashType.KECCAK]:e.Hasher.Keccak.hash256,[e.types.HashType.KECCAK_384]:e.Hasher.Keccak.hash384,[e.types.HashType.KECCAK_512]:e.Hasher.Keccak.hash512,[e.types.HashType.SHA3]:e.Hasher.SHA3.hash256,[e.types.HashType.SHA3_384]:e.Hasher.SHA3.hash384,[e.types.HashType.SHA3_512]:e.Hasher.SHA3.hash512,[e.types.HashType.SHA2]:e.Hasher.SHA2.hash256});const E=b=>e.Hasher.SHA2.hash256(b,1,"hex").replace(/^0x/,"").toUpperCase();e.toTxHash=E}(Oe)),Oe}var ot={},D={},W={},Vt;function jr(){if(Vt)return W;Vt=1;var e=W&&W.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(W,"__esModule",{value:!0}),W.toStrictHex=W.toBytes=W.toBits=W.DID_PREFIX=void 0;const a=e(lt),i=J(),d="did:abt:";W.DID_PREFIX=d;const c=f=>{try{if((0,i.isHexStrict)(f))return C.from((0,i.stripHexPrefix)(f),"hex");let p=(0,i.fromBase58)(f.replace(d,""));for(;p.length<26;)p=C.concat([C.from([0]),p]);return p}catch(p){throw new Error(`Cannot convert DID string to byte array: ${p.message}`)}};W.toBytes=c;const s=(f,p)=>(0,a.default)((0,i.toBN)(f).toString(2),p,"0");W.toBits=s;const m=(f,p)=>{const g=f.replace(/^0x/i,"");return typeof p=="number"&&p%2===0?(0,a.default)(f,p,"0"):g.length%2===0?g:`0${g}`};return W.toStrictHex=m,W}var zt;function _n(){if(zt)return D;zt=1;var e=D&&D.__importDefault||function(H){return H&&H.__esModule?H:{default:H}};Object.defineProperty(D,"__esModule",{value:!0}),D.toChecksumAddress=D.isEthereumDid=D.isEthereumType=D.toTypeInfoStr=D.toTypeInfo=D.fromTypeInfo=D.DID_TYPE_PASSKEY=D.DID_TYPE_ETHEREUM=D.DID_TYPE_ARCBLOCK=void 0,D.DidType=b;const a=J(),i=e(ct),d=e(Cr),c=e(Dr),s=_t(),m=jr(),f={pk:"key",address:"encoding"},p={role:s.types.RoleType.ROLE_ACCOUNT,pk:s.types.KeyType.ED25519,hash:s.types.HashType.SHA3,address:s.types.EncodingType.BASE58};D.DID_TYPE_ARCBLOCK=p;const g={role:s.types.RoleType.ROLE_PASSKEY,pk:s.types.KeyType.PASSKEY,hash:s.types.HashType.SHA2,address:s.types.EncodingType.BASE58};D.DID_TYPE_PASSKEY=g;const n={role:s.types.RoleType.ROLE_ACCOUNT,pk:s.types.KeyType.ETHEREUM,hash:s.types.HashType.KECCAK,address:s.types.EncodingType.BASE16};D.DID_TYPE_ETHEREUM=n;const o=H=>{const T=["pk","hash","address"];return(0,d.default)((0,c.default)(H,T),(0,c.default)(n,T))};D.isEthereumType=o;const l=H=>{const T=(0,a.toAddress)(H);return/^(0x)?[0-9a-f]{40}$/i.test(T)?/^(0x|0X)?[0-9a-f]{40}$/.test(T)||/^(0x|0X)?[0-9A-F]{40}$/.test(T)?!0:h(T):!1};D.isEthereumDid=l;const h=H=>{const T=H.replace(/^0x/i,""),j=s.Hasher.Keccak.hash256(T.toLowerCase()).replace(/^0x/i,"");for(let O=0;O<40;O++)if(parseInt(j[O],16)>7&&T[O].toUpperCase()!==T[O]||parseInt(j[O],16)<=7&&T[O].toLowerCase()!==T[O])return!1;return!0},E=H=>{if(typeof H>"u")return"";if(!/^(0x)?[0-9a-f]{40}$/i.test(H))throw new Error(`Given address "${H}" is not a valid Ethereum address.`);const T=H.toLowerCase().replace(/^0x/i,""),j=s.Hasher.Keccak.hash256(T).replace(/^0x/i,"");let O="0x";for(let S=0;S<T.length;S++)parseInt(j[S],16)>7?O+=T[S].toUpperCase():O+=T[S];return O};D.toChecksumAddress=E;function b(H={}){let T={};["default","arcblock"].includes(H)?T=p:["eth","ethereum"].includes(H)?T=n:["passkey"].includes(H)?T=g:T={...p,...H};const{role:j,pk:O,hash:S,address:v}=T;Object.keys(T).forEach(B=>{const N=(0,i.default)(`${f[B]||B}Type`);if(Object.values(s.types[N]).includes(T[B])===!1)throw new Error(`Unsupported ${B} type: ${T[B]}`)});const P={role:j,pk:O,hash:S,address:v};return o(P)===!1&&[s.types.RoleType.ROLE_NODE,s.types.RoleType.ROLE_VALIDATOR,s.types.RoleType.ROLE_TETHER,s.types.RoleType.ROLE_SWAP].includes(P.role)&&(P.hash=s.types.HashType.SHA2),P}b.toJSON=H=>Object.keys(H).reduce((T,j)=>{const O=(0,i.default)(`${f[j]||j}Type`),S=Object.keys(s.types[O]),v=Object.values(s.types[O]);return T[j]=S[v.indexOf(H[j])],T},{}),b.fromJSON=H=>Object.keys(H).reduce((T,j)=>{const O=(0,i.default)(`${f[j]||j}Type`),S=Object.keys(s.types[O]),v=Object.values(s.types[O]);return T[j]=v[S.indexOf(H[j])],T},{});const _=H=>{const T=b(H),j=(0,m.toBits)(T.role,6),O=(0,m.toBits)(T.pk,5),S=(0,m.toBits)(T.hash,5),v=`${j}${O}${S}`,P=(0,a.stripHexPrefix)((0,a.numberToHex)(parseInt(v,2)));return(0,m.toStrictHex)(P,4)};D.fromTypeInfo=_;const A=H=>{let T={};try{if(l(H))T=n;else{const O=(0,m.toBytes)(H).slice(0,2),S=(0,m.toStrictHex)(C.from(O).toString("hex")),v=(0,m.toBits)(new a.BN(S,16),16),P=v.slice(0,6),B=v.slice(6,11),N=v.slice(11,16);T={role:parseInt(P,2),pk:parseInt(B,2),hash:parseInt(N,2),address:(0,a.isHex)((0,a.toAddress)(H))?s.types.EncodingType.BASE16:s.types.EncodingType.BASE58}}return Object.keys(T).forEach(j=>{Object.values(s.types[`${(0,i.default)(f[j]||j)}Type`]).includes(T[j])===!1&&delete T[j]}),T}catch{return T}};D.toTypeInfo=A;const R=H=>{const T=A(H);return Object.keys(T).reduce((j,O)=>{const S=s.types[`${(0,i.default)(f[O]||O)}Type`];return j[O]=Object.keys(S).find(v=>S[v]===T[O]),j},{})};return D.toTypeInfoStr=R,D}var Yt;function Sn(){return Yt||(Yt=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DID_TYPE_PASSKEY=e.DID_TYPE_ETHEREUM=e.DID_TYPE_ARCBLOCK=e.DID_PREFIX=e.DidType=e.fromTypeInfo=e.toTypeInfoStr=e.toTypeInfo=e.isEthereumType=e.isEthereumDid=e.isValid=e.isFromPublicKey=e.toDid=e.toAddress=e.fromHash=e.fromPublicKeyHash=e.fromPublicKey=e.fromSecretKey=e.toStrictHex=e.types=void 0;const a=_t();Object.defineProperty(e,"types",{enumerable:!0,get:function(){return a.types}});const i=J();Object.defineProperty(e,"toAddress",{enumerable:!0,get:function(){return i.toAddress}}),Object.defineProperty(e,"toDid",{enumerable:!0,get:function(){return i.toDid}});const d=_n();Object.defineProperty(e,"DidType",{enumerable:!0,get:function(){return d.DidType}}),Object.defineProperty(e,"DID_TYPE_ARCBLOCK",{enumerable:!0,get:function(){return d.DID_TYPE_ARCBLOCK}}),Object.defineProperty(e,"DID_TYPE_ETHEREUM",{enumerable:!0,get:function(){return d.DID_TYPE_ETHEREUM}}),Object.defineProperty(e,"DID_TYPE_PASSKEY",{enumerable:!0,get:function(){return d.DID_TYPE_PASSKEY}}),Object.defineProperty(e,"fromTypeInfo",{enumerable:!0,get:function(){return d.fromTypeInfo}}),Object.defineProperty(e,"isEthereumDid",{enumerable:!0,get:function(){return d.isEthereumDid}}),Object.defineProperty(e,"isEthereumType",{enumerable:!0,get:function(){return d.isEthereumType}}),Object.defineProperty(e,"toTypeInfo",{enumerable:!0,get:function(){return d.toTypeInfo}}),Object.defineProperty(e,"toTypeInfoStr",{enumerable:!0,get:function(){return d.toTypeInfoStr}});const c=jr();Object.defineProperty(e,"DID_PREFIX",{enumerable:!0,get:function(){return c.DID_PREFIX}}),Object.defineProperty(e,"toStrictHex",{enumerable:!0,get:function(){return c.toStrictHex}});const s=(o,l)=>{const h=(0,d.DidType)(l),E=(0,a.getSigner)(h.pk).getPublicKey(o);return m(E.indexOf("0x")===0?E:`0x${E}`,h)};e.fromSecretKey=s;const m=(o,l)=>{const h=(0,d.DidType)(l),b=(0,a.getHasher)(h.hash)(o,1);return f(b,h)};e.fromPublicKey=m;const f=(o,l)=>{const h=(0,d.DidType)(l),E=(0,i.stripHexPrefix)(o).slice(0,40),b=(0,a.getHasher)(h.hash),_=(0,d.fromTypeInfo)(h),A=(0,i.stripHexPrefix)(b(`0x${_}${E}`,1)).slice(0,8),R=`0x${_}${E}${A}`;return(0,d.isEthereumType)(h)?(0,d.toChecksumAddress)(`0x${o.slice(-40)}`):h.address===a.types.EncodingType.BASE58?(0,i.toBase58)(R):R};e.fromPublicKeyHash=f;const p=(o,l=a.types.RoleType.ROLE_ACCOUNT)=>{const h=Object.keys(a.types.RoleType),E=Object.values(a.types.RoleType);if(E.indexOf(l)===-1)throw new Error(`Unsupported role type ${l} when gen ddi from hash`);const b=(0,d.DidType)({role:a.types.RoleType[h[E.indexOf(l)]]});return f(o,b)};e.fromHash=p;const g=(o,l)=>{if(n(o)===!1)return!1;const h=(0,d.toTypeInfo)(o),E=m(l,h),b=o.replace(c.DID_PREFIX,"");return E===b};e.isFromPublicKey=g;const n=o=>{if(!o)return!1;const l=(0,i.toAddress)(String(o)),{hash:h}=(0,d.toTypeInfo)(l);if(typeof h>"u")return!1;if((0,d.isEthereumDid)(l))return!0;const E=(0,a.getHasher)(h),b=(0,c.toBytes)(l),_=(0,c.toStrictHex)(C.from(b.slice(0,22)).toString("hex")),A=(0,c.toStrictHex)(C.from(b.slice(22,26)).toString("hex")),R=(0,i.stripHexPrefix)(E(`0x${_}`,1)).slice(0,8);return A===R};e.isValid=n}(ot)),ot}var Xt;function En(){if(Xt)return Y;Xt=1,Object.defineProperty(Y,"__esModule",{value:!0}),Y.WalletType=void 0,Y.Wallet=d,Y.fromSecretKey=c,Y.fromPublicKey=s,Y.fromAddress=m,Y.fromRandom=f,Y.fromJSON=p,Y.isValid=g;const e=J(),a=_t(),i=Sn();Y.WalletType=i.DidType;function d(n,o="default"){const l=(0,i.DidType)(o),h=(0,a.getSigner)(l.pk),E=(0,a.getHasher)(l.hash);return{type:l,secretKey:n.sk,publicKey:n.pk,address:n.pk?(0,i.fromPublicKey)(n.pk,l):n.address,hash(b,_=1,A="hex"){return E(b,_,A)},sign(b,_=!0,A="hex"){if(!n.sk)throw new Error("Cannot sign data without a secretKey");if(_){const R=E(b,1);return h.sign(R,n.sk,A)}return h.sign(b,n.sk,A)},async verify(b,_,A=!0,R){if(!n.pk)throw new Error("Cannot verify data without a publicKey");const H=A?E(b,1):b;return h.verify(H,_,n.pk,R)},ethHash(b){if(typeof h.ethHash!="function")throw new Error("ethHash is not supported by signer");return h.ethHash(b)},ethSign(b,_=!0){if(!n.sk)throw new Error("Cannot sign data without a secretKey");if(typeof h.ethHash!="function")throw new Error("ethSign is not supported by signer");return _?h.ethSign(h.ethHash(b),(0,e.toHex)(n.sk)):h.ethSign(b,(0,e.toHex)(n.sk))},ethVerify(b,_,A=!0){if(typeof h.ethHash!="function")throw new Error("ethVerify is not supported by signer");const R=A?h.ethHash(b):b;return h.ethRecover(R,_)===this.address},toAddress(){return n.pk?(0,i.fromPublicKey)(n.pk,l):n.address},toJSON(){return{type:i.DidType.toJSON(l),sk:(0,e.toHex)(n.sk),pk:(0,e.toHex)(n.pk),address:this.address}}}}function c(n,o="default"){const l=(0,i.DidType)(o),h={sk:n,pk:(0,a.getSigner)(l.pk).getPublicKey(n)};return d(h,l)}function s(n,o="default"){return d({pk:n},(0,i.DidType)(o))}function m(n){return d({address:(0,i.toAddress)(n)},(0,i.toTypeInfo)(n))}function f(n="default"){const o=(0,i.DidType)(n),h=(0,a.getSigner)(o.pk).genKeyPair();return d({sk:h.secretKey,pk:h.publicKey},o)}function p(n){const o=i.DidType.fromJSON(n.type);return d(n,o)}function g(n,o=!0){return!(!n||typeof n!="object"||typeof n.verify!="function"||typeof n.toAddress!="function"||typeof n.toJSON!="function"||!n.type||!n.publicKey||o&&(!n.secretKey||typeof n.sign!="function"))}return Y}var at,Jt;function xn(){if(Jt)return at;Jt=1;const e=Gr(),a=dn(),{fromSecretKey:i,WalletType:d}=En(),{isHexStrict:c,toHex:s,toBuffer:m,stripHexPrefix:f}=ne(),{types:p}=a;return at={fromAppDid:(n,o,l={role:p.RoleType.ROLE_ACCOUNT},h=0)=>{if(!o)throw new Error("Cannot get user wallet with empty root sk");const E=a.Hasher.SHA3.hash256(m(n)),b=f(E).slice(0,16),_=b.slice(0,8),A=b.slice(8,16),R=parseInt(+`0x${_}`,10)&2147483647,H=parseInt(+`0x${A}`,10)&2147483647,T=f(c(o)?o:s(o)),j=e.fromMasterSeed(C.from(T,"hex")),O=`m/44'/260'/${R}'/${H}'/${h}`,S=j.derive(O),v=d(l),{pk:P=p.KeyType.ED25519}=v;let B;return P===p.KeyType.ED25519?B=a.Signer.Ed25519.genKeyPair("hex",S.privateKey).secretKey:B=s(S.privateKey),P===p.KeyType.ETHEREUM&&(B=B.slice(0,66)),i(B,v)}},at}var vr=xn();const Tn={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function wr({onCreated:e,onClose:a}){const[i,d]=I.useState(!1),{t:c,locale:s}=Be(),{api:m}=Pe(),{teamDid:f}=$e(),{control:p,handleSubmit:g,formState:{errors:n},watch:o,setValue:l}=xr({defaultValues:Tn,mode:"onChange"}),h=o("scope"),E=_=>{_!=="profile:read"&&l("scope",h.includes(_)?h.filter(A=>A!==_):[...h,_])},b=async _=>{d(!0);try{const A={..._,redirectUris:_.redirectUris,contacts:_.contacts?_.contacts.split(",").map(R=>R.trim()):[],scope:_.scope.join(" ")};await m.createOAuthClient({input:{teamDid:f,input:Xr(A,Jr)}}),e(A)}catch(A){De.error(A.message||"Failed to create OAuth App")}finally{d(!1)}};return r.jsxs(ut,{open:!0,onClose:a,maxWidth:"md",fullWidth:!0,children:[r.jsxs(ft,{children:[c("oauth.client.register")," ",r.jsx(dt,{onClick:a,sx:{position:"absolute",right:8,top:8},children:r.jsx(ht,{})})]}),r.jsx(pt,{children:r.jsxs(me,{spacing:4,sx:{mt:2},children:[r.jsx(X,{variant:"h6",gutterBottom:!0,children:c("oauth.client.requiredInformation")}),r.jsx(k,{children:r.jsx(z,{name:"clientName",control:p,rules:{required:c("oauth.client.validate.clientName"),minLength:{value:3,message:c("oauth.client.validate.clientNameMinLength")}},render:({field:_})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",..._,label:c("oauth.client.name"),required:!0,fullWidth:!0,placeholder:c("oauth.client.input.clientNamePlaceholder"),error:!!n.clientName,helperText:n.clientName?.message}),r.jsx(M,{children:c("oauth.client.helperText.clientName")})]})})}),r.jsx(k,{children:r.jsx(z,{name:"clientUri",control:p,rules:{required:c("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:c("oauth.client.validate.clientUriInvalid")}},render:({field:_})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",..._,label:c("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:c("oauth.client.input.clientUriPlaceholder"),error:!!n.clientUri,helperText:n.clientUri?.message}),r.jsx(M,{children:c("oauth.client.helperText.clientUri")})]})})}),r.jsx(k,{children:r.jsx(z,{name:"redirectUris",control:p,rules:{required:c("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:c("oauth.client.validate.redirectUrisInvalid")}},render:({field:_})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",..._,label:c("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:c("oauth.client.input.redirectUrisPlaceholder"),error:!!n.redirectUris,helperText:n.redirectUris?.message}),r.jsxs(k,{sx:{display:"flex",gap:"2px"},children:[r.jsx(M,{children:c("oauth.client.helperText.redirectUris")}),r.jsx(M,{children:c("oauth.client.helperText.read")}),r.jsx(M,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${s}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:c("oauth.client.helperText.document")}),r.jsx(M,{children:c("oauth.client.helperText.more")})]})]})})}),r.jsxs(Lr,{variant:"outlined",sx:{p:2,display:"none"},children:[r.jsx(X,{variant:"subtitle2",gutterBottom:!0,children:c("oauth.client.input.permissions")}),r.jsx(k,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:r.jsx(yr,{children:Object.entries(re.OAUTH_SCOPES).map(([_,A])=>r.jsx(mr,{control:r.jsx(gr,{checked:h.includes(_),onChange:()=>E(_),disabled:_==="profile:read",color:"primary"}),label:r.jsx(k,{children:r.jsx(X,{variant:"body2",sx:{fontWeight:500},children:A})})},_))})})]}),r.jsx(yt,{}),r.jsx(X,{variant:"h6",gutterBottom:!0,children:c("oauth.client.optionalInformation")}),r.jsx(me,{children:r.jsx(z,{name:"contacts",control:p,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:c("oauth.client.validate.contacts")}},render:({field:_})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",..._,label:c("oauth.client.input.contacts"),fullWidth:!0,placeholder:c("oauth.client.input.contactsPlaceholder"),error:!!n.contacts,helperText:n.contacts?.message}),r.jsx(M,{children:c("oauth.client.helperText.contacts")})]})})}),r.jsxs(me,{direction:{xs:"column",sm:"row"},spacing:2,children:[r.jsx(z,{name:"tosUri",control:p,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:c("oauth.client.validate.tosUriInvalid")}},render:({field:_})=>r.jsxs(k,{sx:{width:"50%"},children:[r.jsx(V,{size:"small",..._,label:c("oauth.client.input.tosUri"),fullWidth:!0,placeholder:c("oauth.client.input.tosUriPlaceholder"),error:!!n.tosUri,helperText:n.tosUri?.message}),r.jsx(M,{children:c("oauth.client.helperText.tosUri")})]})}),r.jsx(z,{name:"policyUri",control:p,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:c("oauth.client.validate.policyUriInvalid")}},render:({field:_})=>r.jsxs(k,{sx:{width:"50%"},children:[r.jsx(V,{size:"small",..._,label:c("oauth.client.input.policyUri"),fullWidth:!0,placeholder:c("oauth.client.input.policyUriPlaceholder"),error:!!n.policyUri,helperText:n.policyUri?.message}),r.jsx(M,{children:c("oauth.client.helperText.policyUri")})]})})]}),n.error&&r.jsx(br,{severity:"error",children:n.error.message})]})}),r.jsxs(_r,{children:[r.jsx(He,{onClick:a,children:c("common.cancel")}),r.jsxs(He,{onClick:g(b),disabled:i,variant:"contained",color:"primary",children:[i?r.jsx(mt,{size:20,sx:{mr:1}}):null,c("oauth.client.registerButton")]})]})]})}wr.propTypes={onCreated:w.func.isRequired,onClose:w.func.isRequired};function St({scope:e="",...a}){if(!e)return null;const i=e.split(" ").filter(Boolean);return r.jsx(me,{direction:"row",...a,sx:[{flexWrap:"wrap",gap:1},...Array.isArray(a.sx)?a.sx:[a.sx]],children:i.map(d=>r.jsx(Rr.Fragment,{children:r.jsx(qr,{title:re.OAUTH_SCOPES[d],children:r.jsx(q,{children:d})})},d))})}St.propTypes={scope:w.string};const Et=e=>{const{prefix:a}=Pe(),{blocklet:i}=Zr(),d=xt(a,"/api/media/upload",i.appPid),c=I.useCallback(m=>m?m.startsWith("http")?m:`${xt(a,"/api/media/upload",i.appPid)}/${m}`:"",[a,i.appPid]);return{clientLogoUrl:I.useMemo(()=>c(e),[e,c]),apiPath:d,getClientLogoUrl:c}},Hn=I.lazy(()=>Kr(()=>import("./index-CJubEPJw.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(e=>({default:e.Uploader})));function Ur({client:e,onUpdate:a,onClose:i}){const[d,c]=I.useState(!1),{t:s,locale:m}=Be(),f=I.useRef(null),{api:p}=Pe(),{teamDid:g}=$e(),{control:n,handleSubmit:o,formState:{errors:l},watch:h,setValue:E,getValues:b}=xr({defaultValues:{clientName:e.clientName||"",clientUri:e.clientUri||"",redirectUris:Array.isArray(e.redirectUris)?e.redirectUris.join(","):"",scope:e.scope?e.scope.split(" "):["profile:read"],contacts:Array.isArray(e.contacts)?e.contacts.join(","):"",tosUri:e.tosUri||"",policyUri:e.policyUri||"",logoUri:e.logoUri||"",clientSecretExpiresAt:e.clientSecretExpiresAt||null},mode:"onChange"}),_=h("scope"),A=h("logoUri"),{clientLogoUrl:R,apiPath:H}=Et(A),T=S=>{S!=="profile:read"&&E("scope",_.includes(S)?_.filter(v=>v!==S):[..._,S])},j=async S=>{const v={clientId:e.clientId,clientName:S.clientName.trim(),clientUri:S.clientUri,redirectUris:S.redirectUris.split(",").map(P=>P.trim()).filter(Boolean),contacts:S.contacts?S.contacts.split(",").map(P=>P.trim()):[],scope:S.scope.join(" "),tosUri:S.tosUri,policyUri:S.policyUri,logoUri:S.logoUri,clientSecretExpiresAt:S.clientSecretExpiresAt?parseInt(S.clientSecretExpiresAt/1e3,10):null};await p.updateOAuthClient({input:{teamDid:g,input:v}})},O=async S=>{c(!0);try{await j(S),a(),i()}catch(v){De.error(v.message||s("oauth.client.updateFailed"))}finally{c(!1)}};return r.jsxs(ut,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[r.jsxs(ft,{children:[s("oauth.client.update")," ",r.jsx(dt,{onClick:i,sx:{position:"absolute",right:8,top:8},children:r.jsx(ht,{})})]}),r.jsx(pt,{children:r.jsxs(me,{spacing:3,sx:{mt:2},children:[r.jsxs(k,{sx:{mb:3},children:[r.jsx(X,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),r.jsxs(k,{children:[r.jsx(k,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:R?r.jsx(k,{children:r.jsx("img",{src:R,alt:"client-logo",style:{width:"100%",height:"100%"}})}):r.jsx(k,{onClick:()=>{f.current?.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:r.jsx(Sr,{sx:{fontSize:40,color:"common.white"}})})}),r.jsx(He,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{f.current?.open()},children:s(R?"common.change":"common.upload")})]}),r.jsx(k,{sx:{display:"flex",alignItems:"center"},children:r.jsx(I.Suspense,{fallback:r.jsx(en,{}),children:r.jsx(Hn,{ref:f,locale:m,popup:!0,onUploadFinish:S=>{E("logoUri",S.data.filename),j(b()).then(()=>{a()}).catch(v=>{De.error(v.message||s("oauth.client.updateFailed"))}).finally(()=>{f.current?.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:H,disableMediaKitPrefix:!0,disableAutoPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo")})})]}),r.jsx(X,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),r.jsx(V,{label:"Client Id",fullWidth:!0,value:e.clientId,disabled:!0}),r.jsx(k,{children:r.jsx(z,{name:"clientName",control:n,rules:{required:s("oauth.client.validate.clientName"),minLength:{value:3,message:s("oauth.client.validate.clientNameMinLength")}},render:({field:S})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...S,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!l.clientName,helperText:l.clientName?.message}),r.jsx(M,{children:s("oauth.client.helperText.clientName")})]})})}),r.jsx(k,{children:r.jsx(z,{name:"clientUri",control:n,rules:{required:s("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.clientUriInvalid")}},render:({field:S})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...S,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!l.clientUri,helperText:l.clientUri?.message}),r.jsx(M,{children:s("oauth.client.helperText.clientUri")})]})})}),r.jsx(k,{children:r.jsx(z,{name:"redirectUris",control:n,rules:{required:s("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.redirectUrisInvalid")}},render:({field:S})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...S,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!l.redirectUris,helperText:l.redirectUris?.message}),r.jsx(M,{children:s("oauth.client.helperText.redirectUris")})]})})}),r.jsx(z,{name:"clientSecretExpiresAt",control:n,render:({field:S})=>r.jsx(Qr,{placeholder:s("oauth.client.input.expireTime"),value:S.value*1e3,onChange:v=>{S.onChange(v)}})}),r.jsxs(k,{sx:{display:"none"},children:[r.jsx(X,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),r.jsx(k,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:r.jsx(yr,{children:Object.entries(re.OAUTH_SCOPES).map(([S,v])=>r.jsx(mr,{control:r.jsx(gr,{checked:_.includes(S),onChange:()=>T(S),disabled:S==="profile:read",color:"primary"}),label:r.jsx(k,{children:r.jsx(X,{variant:"body2",sx:{fontWeight:500},children:v})})},S))})})]}),r.jsx(yt,{}),r.jsx(X,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),r.jsx(k,{children:r.jsx(z,{name:"contacts",control:n,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:s("oauth.client.validate.contacts")}},render:({field:S})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...S,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!l.contacts,helperText:l.contacts?.message}),r.jsx(M,{children:s("oauth.client.helperText.contacts")})]})})}),r.jsxs(me,{direction:{xs:"column",sm:"row"},spacing:2,children:[r.jsx(z,{name:"tosUri",control:n,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.tosUriInvalid")}},render:({field:S})=>r.jsxs(k,{sx:{width:"50%"},children:[r.jsx(V,{...S,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!l.tosUri,helperText:l.tosUri?.message}),r.jsx(M,{children:s("oauth.client.helperText.tosUri")})]})}),r.jsx(z,{name:"policyUri",control:n,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.policyUriInvalid")}},render:({field:S})=>r.jsxs(k,{sx:{width:"50%"},children:[r.jsx(V,{...S,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!l.policyUri,helperText:l.policyUri?.message}),r.jsx(M,{children:s("oauth.client.helperText.policyUri")})]})})]}),l.error&&r.jsx(br,{severity:"error",children:l.error.message})]})}),r.jsxs(_r,{children:[r.jsx(He,{onClick:i,children:s("common.cancel")}),r.jsx(He,{onClick:o(O),disabled:d,variant:"contained",color:"primary",children:d?r.jsx(mt,{size:16}):s("common.update")})]})]})}Ur.propTypes={client:w.shape({clientId:w.string.isRequired,clientName:w.string.isRequired,clientUri:w.string,redirectUris:w.arrayOf(w.string),scope:w.string,contacts:w.arrayOf(w.string),tosUri:w.string,policyUri:w.string,logoUri:w.string,clientSecretExpiresAt:w.number}).isRequired,onUpdate:w.func.isRequired,onClose:w.func.isRequired};function Ar({client:e,onUpdate:a,onClose:i}){return r.jsx(Ur,{client:e,onUpdate:d=>a(d),onClose:i})}Ar.propTypes={client:w.shape({clientId:w.string.isRequired,clientName:w.string.isRequired,clientUri:w.string,redirectUris:w.arrayOf(w.string),scope:w.string,contacts:w.arrayOf(w.string),tosUri:w.string,policyUri:w.string,logoUri:w.string,clientSecretExpiresAt:w.number}).isRequired,onUpdate:w.func.isRequired,onClose:w.func.isRequired};function Or({clientId:e,clientName:a,onDelete:i=()=>{},onClose:d=()=>{}}){const{t:c}=Be(),{api:s}=Pe(),{teamDid:m}=$e(),f=()=>{d()},p=async()=>{try{await s.deleteOAuthClient({input:{teamDid:m,clientId:e}}),i()}catch(n){De.error(n?.message)}finally{f()}},g={keyName:a,title:c("oauth.client.delete.title"),description:c("oauth.client.delete.description",{name:`<b>${a}</b>`}),confirmPlaceholder:c("oauth.client.delete.description",{name:a}),confirm:c("common.delConfirm"),cancel:c("common.cancel"),onConfirm:p,onCancel:f};return r.jsx(tn,{keyName:g.keyName,title:g.title,description:g.description,confirmPlaceholder:g.confirmPlaceholder,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})}Or.propTypes={clientId:w.string.isRequired,clientName:w.string.isRequired,onDelete:w.func,onClose:w.func};function Br({title:e,items:a}){return r.jsxs(k,{sx:{mb:3},children:[r.jsx(X,{variant:"h6",sx:{mb:1.5},children:e}),r.jsx(me,{spacing:1.5,children:a.map(({label:i,value:d})=>r.jsxs(k,{sx:{display:"flex",alignItems:"center",gap:2},children:[r.jsx(X,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),r.jsx(X,{sx:{wordBreak:"break-all"},children:d||"-"})]},i))})]})}Br.propTypes={title:w.string.isRequired,items:w.arrayOf(w.shape({label:w.string.isRequired,value:w.any})).isRequired};function Pr({client:e,onClose:a}){const{t:i,locale:d}=Be(),{teamDid:c}=$e(),{clientName:s,clientId:m,clientSecret:f,redirectUris:p,scope:g,clientUri:n,logoUri:o,contacts:l,tosUri:h,policyUri:E,jwksUri:b,jwks:_,softwareId:A,softwareVersion:R,clientIdIssuedAt:H,clientSecretExpiresAt:T,updatedAt:j,createUser:O}=e,{clientLogoUrl:S}=Et(o),v=N=>{try{const ee=new URL(window.blocklet.appUrl);return ee.pathname=N,ee.toString()}catch{return"-"}},P=vr.fromAppDid(m,c),B=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:s},{label:i("oauth.client.logoUri"),value:r.jsx(pr,{variant:"rounded",shape:"square",src:S,did:P.address,size:64})},{label:i("oauth.client.clientUri"),value:n?r.jsx(q,{children:n}):"-"},{label:i("oauth.client.clientId"),value:r.jsx(q,{children:m})},{label:i("oauth.client.clientSecret"),value:r.jsx(q,{children:f})},{label:i("oauth.client.redirectUris"),value:r.jsx(q,{children:(p||[]).join(", ")})},{label:i("oauth.client.scope"),value:r.jsx(St,{scope:g})},{label:i("oauth.client.createUser"),value:O?rn(O,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:r.jsx(q,{children:v("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:r.jsx(q,{children:v(`${re.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:r.jsx(q,{children:v(`${re.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:r.jsx(q,{children:v(`${re.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:r.jsx(q,{children:v(`${re.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:r.jsx(q,{children:v(`${re.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:r.jsx(q,{children:v(`${re.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/logout`)})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:l.length?r.jsx(q,{children:(l||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:h?r.jsx(q,{children:h}):"-"},{label:i("oauth.client.policyUri"),value:E?r.jsx(q,{children:E}):"-"},{label:i("oauth.client.jwksUri"),value:b},{label:i("oauth.client.jwks"),value:_},{label:i("oauth.client.softwareId"),value:A},{label:i("oauth.client.softwareVersion"),value:R}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:H?r.jsx(Ce,{value:H*1e3,type:"all",locale:d}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:T?r.jsx(Ce,{value:T*1e3,type:"all",locale:d}):"-"},{label:i("common.updatedAt"),value:j?r.jsx(Ce,{value:j,type:"all",locale:d}):"-"}]}].filter(Boolean);return r.jsxs(ut,{open:!0,onClose:a,maxWidth:"lg",fullWidth:!0,children:[r.jsxs(ft,{children:[i("oauth.client.oauthAppDetails"),r.jsx(dt,{onClick:a,sx:{position:"absolute",right:8,top:8},children:r.jsx(ht,{})})]}),r.jsx(pt,{children:r.jsx(k,{sx:{mt:1},children:B.map((N,ee)=>r.jsxs(k,{children:[r.jsx(Br,{title:N.title,items:N.items}),ee!==B.length-1&&r.jsx(yt,{sx:{my:2}})]},N.title))})})]})}Pr.propTypes={client:w.object.isRequired,onClose:w.func.isRequired};function jn(e){return r.jsx(Ce,{value:e*1e3})}function $r({selected:e=null,onClose:a}){return e?r.jsx(Pr,{client:e,onClose:a}):null}$r.propTypes={selected:w.object,onClose:w.func.isRequired};function kr({open:e,onCreated:a,onClose:i}){return e?r.jsx(wr,{onCreated:a,onClose:i}):null}kr.propTypes={open:w.bool.isRequired,onCreated:w.func.isRequired,onClose:w.func.isRequired};function si(){const[e,a]=I.useState({searchText:"",pageSize:10,page:1}),[i,d]=I.useState(null),[c,s]=I.useState(!1),m=I.useRef(null),{t:f,locale:p}=Be(),{api:g}=Pe(),{teamDid:n}=$e(),[o,l]=I.useState(null),[h,E]=I.useState(null),b=sn(),{getClientLogoUrl:_}=Et(),A=Yr(async()=>await g.getOAuthClients({input:{teamDid:n,paging:{page:e.page,pageSize:e.pageSize}}}),[e.page,e.pageSize]),{loading:R}=A,H=I.useMemo(()=>A.value?.list||[],[A.value?.list]),T=I.useMemo(()=>e.searchText?H.filter(S=>S.clientName.toLowerCase().includes(e.searchText.toLowerCase())||S.clientId.toLowerCase().includes(e.searchText.toLowerCase())||S.scope.toLowerCase().includes(e.searchText.toLowerCase())):H,[e.searchText,H]),j=I.useMemo(()=>[{label:f("oauth.client.name"),name:"clientName",options:{customBodyRender:(S,{rowIndex:v})=>{const P=T[v],B=_(P.logoUri),N=vr.fromAppDid(P.clientId,n);return r.jsx(k,{sx:{display:"flex",alignItems:"center",gap:2},children:r.jsxs(k,{sx:{display:"flex",alignItems:"center",gap:2,cursor:"pointer"},children:[r.jsx(pr,{variant:"rounded",shape:"square",did:N.address,src:B,size:48}),r.jsxs(me,{sx:{gap:.5},children:[r.jsx(k,{sx:{color:"text.primary"},children:P.clientName}),r.jsx(k,{sx:{color:"text.secondary"},children:P.clientUri})]})]})})}}},{label:f("oauth.client.clientId"),name:"clientId"},{label:f("oauth.client.scope"),name:"scope",options:{customBodyRender:S=>r.jsx(St,{scope:S})}},{label:f("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:jn}},{label:f("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:S=>S?r.jsx(Wr,{showDid:!0,did:S,cardType:zr.Detailed,infoType:Vr.Minimal,sx:{border:0,padding:0}}):f("oauth.client.openRegistration")}},{label:f("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(S,{rowIndex:v})=>{const P=T[v];return r.jsx(nn,{actions:[{icon:r.jsx(Mr,{}),text:f("common.edit"),onClick:B=>{B.stopPropagation(),l(P)}},{icon:r.jsx(Fr,{}),text:f("common.delete"),onClick:B=>{B.stopPropagation(),E(P)}}]})}}}],[T,f,_,n,l,E]),O=({page:S,rowsPerPage:v,searchText:P})=>{e.pageSize!==v?a(B=>({...B,searchText:"",pageSize:v,page:1})):e.page!==S+1?a(B=>({...B,searchText:"",page:S+1})):e.searchText!==P&&a(B=>({...B,searchText:P,page:1}))};return r.jsxs(k,{ref:m,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[b?r.jsx(Tt,{title:f("oauth.client.listTitle"),tooltipTitle:f("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${p}/oauth-service`}):null,r.jsx(Nr,{data:T,columns:j,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:e.page-1,rowsPerPage:e.pageSize,count:T.length,searchDebounceTime:400,onRowClick(S,{dataIndex:v},P){if(m.current?.contains(P.target)){const B=T[v];d(B)}}},onChange:O,title:b?null:r.jsx(Tt,{title:f("oauth.client.listTitle"),tooltipTitle:f("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${p}/oauth-service`}),customButtons:[r.jsxs(He,{variant:"contained",size:"small",onClick:()=>s(!0),children:[R?r.jsx(mt,{size:16}):r.jsx(Sr,{style:{fontSize:16}}),f("common.create")]},"add")],loading:!1,emptyNode:r.jsx(Ir,{children:f("oauth.client.empty")})}),r.jsx($r,{selected:i,onClose:()=>d(null)}),r.jsx(kr,{open:c,onCreated:()=>{s(!1),A.retry()},onClose:()=>s(!1)}),o&&r.jsx(Ar,{client:o,onUpdate:A.retry,onClose:()=>l(null)}),h&&r.jsx(Or,{...h,onDelete:A.retry,onClose:()=>E(null)})]})}export{si as default};
4
+ ${g.length}`,l=C.from(o),h=C.concat([l,n]);return i.default.keccak256s(h)}ethSign(f,p){return a.default.sign(f,p)}ethRecover(f,p){return a.default.recover(f,p)}}return he.EthereumSigner=s,he.default=new s,he}var ye={},Ft;function bn(){if(Ft)return ye;Ft=1;var e=ye&&ye.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ye,"__esModule",{value:!0}),ye.PasskeySigner=void 0;const a=J(),i=hr(),d=e(bt());class c extends d.default{constructor(){super()}genKeyPair(m="hex",f){throw new Error("Not supported")}getPublicKey(m,f="hex"){throw new Error("Not supported")}sign(m,f,p="hex"){throw new Error("Not supported")}async verify(m,f,p,g){const n=JSON.parse(g);if(!n.authenticatorData||!n.clientDataJSON)throw new Error("extra.authenticatorData or extra.clientDataJSON is required for passkey signature verification");const o=(0,a.toBuffer)((0,a.fromBase64)(n.authenticatorData)),l=await(0,i.toHash)(i.isoBase64URL.toBuffer(n.clientDataJSON));if((0,i.decodeClientDataJSON)(n.clientDataJSON).challenge!==(0,a.toBase64)(m))throw new Error("challenge mismatch for passkey signature");return(0,i.verifySignature)({signature:i.isoBase64URL.toBuffer(typeof f=="string"?f:(0,a.toBase64)(f)),data:i.isoUint8Array.concat([o,l]),credentialPublicKey:p})}}return ye.PasskeySigner=c,ye.default=new c,ye}var Wt;function _t(){return Wt||(Wt=1,function(e){var a=Oe&&Oe.__importDefault||function(b){return b&&b.__esModule?b:{default:b}};Object.defineProperty(e,"__esModule",{value:!0}),e.toTxHash=e.Hashers=e.Signers=e.types=e.Hasher=e.Signer=void 0,e.getSigner=o,e.getHasher=l,e.getRandomBytes=h;const i=a(je()),d=we(),c=a(hn()),s=a(pn()),m=a(yn()),f=a(mn()),p=a(gn()),g=a(Hr()),n=a(bn());e.Signer={Ed25519:f.default,Secp256k1:g.default,Ethereum:p.default,Passkey:n.default},e.Hasher={SHA2:s.default,SHA3:m.default,Keccak:c.default},e.types={KeyType:{ED25519:0,SECP256K1:1,ETHEREUM:2,PASSKEY:3},HashType:{KECCAK:0,SHA3:1,KECCAK_384:2,SHA3_384:3,KECCAK_512:4,SHA3_512:5,SHA2:6},RoleType:{ROLE_ACCOUNT:0,ROLE_NODE:1,ROLE_DEVICE:2,ROLE_APPLICATION:3,ROLE_SMART_CONTRACT:4,ROLE_BOT:5,ROLE_ASSET:6,ROLE_STAKE:7,ROLE_VALIDATOR:8,ROLE_GROUP:9,ROLE_TX:10,ROLE_TETHER:11,ROLE_SWAP:12,ROLE_DELEGATION:13,ROLE_VC:14,ROLE_BLOCKLET:15,ROLE_STORE:16,ROLE_TOKEN:17,ROLE_FACTORY:18,ROLE_ROLLUP:19,ROLE_STORAGE:20,ROLE_PROFILE:21,ROLE_PASSKEY:22,ROLE_TOKEN_FACTORY:23,ROLE_ANY:63},EncodingType:{BASE16:0,BASE58:1}};function o(b){if(typeof e.Signers[b]>"u")throw new Error(`Unsupported signer type: ${b}`);return e.Signers[b]}function l(b){if(typeof e.Hashers[b]>"u")throw new Error(`Unsupported hash type: ${b}`);return e.Hashers[b]}function h(b=32,_="hex"){return(0,d.encode)((0,i.default)(b),_)}e.Signers=Object.freeze({[e.types.KeyType.ED25519]:e.Signer.Ed25519,[e.types.KeyType.SECP256K1]:e.Signer.Secp256k1,[e.types.KeyType.ETHEREUM]:e.Signer.Ethereum,[e.types.KeyType.PASSKEY]:e.Signer.Passkey}),e.Hashers=Object.freeze({[e.types.HashType.KECCAK]:e.Hasher.Keccak.hash256,[e.types.HashType.KECCAK_384]:e.Hasher.Keccak.hash384,[e.types.HashType.KECCAK_512]:e.Hasher.Keccak.hash512,[e.types.HashType.SHA3]:e.Hasher.SHA3.hash256,[e.types.HashType.SHA3_384]:e.Hasher.SHA3.hash384,[e.types.HashType.SHA3_512]:e.Hasher.SHA3.hash512,[e.types.HashType.SHA2]:e.Hasher.SHA2.hash256});const E=b=>e.Hasher.SHA2.hash256(b,1,"hex").replace(/^0x/,"").toUpperCase();e.toTxHash=E}(Oe)),Oe}var ot={},D={},W={},Vt;function jr(){if(Vt)return W;Vt=1;var e=W&&W.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(W,"__esModule",{value:!0}),W.toStrictHex=W.toBytes=W.toBits=W.DID_PREFIX=void 0;const a=e(lt),i=J(),d="did:abt:";W.DID_PREFIX=d;const c=f=>{try{if((0,i.isHexStrict)(f))return C.from((0,i.stripHexPrefix)(f),"hex");let p=(0,i.fromBase58)(f.replace(d,""));for(;p.length<26;)p=C.concat([C.from([0]),p]);return p}catch(p){throw new Error(`Cannot convert DID string to byte array: ${p.message}`)}};W.toBytes=c;const s=(f,p)=>(0,a.default)((0,i.toBN)(f).toString(2),p,"0");W.toBits=s;const m=(f,p)=>{const g=f.replace(/^0x/i,"");return typeof p=="number"&&p%2===0?(0,a.default)(f,p,"0"):g.length%2===0?g:`0${g}`};return W.toStrictHex=m,W}var zt;function _n(){if(zt)return D;zt=1;var e=D&&D.__importDefault||function(H){return H&&H.__esModule?H:{default:H}};Object.defineProperty(D,"__esModule",{value:!0}),D.toChecksumAddress=D.isEthereumDid=D.isEthereumType=D.toTypeInfoStr=D.toTypeInfo=D.fromTypeInfo=D.DID_TYPE_PASSKEY=D.DID_TYPE_ETHEREUM=D.DID_TYPE_ARCBLOCK=void 0,D.DidType=b;const a=J(),i=e(ct),d=e(Cr),c=e(Dr),s=_t(),m=jr(),f={pk:"key",address:"encoding"},p={role:s.types.RoleType.ROLE_ACCOUNT,pk:s.types.KeyType.ED25519,hash:s.types.HashType.SHA3,address:s.types.EncodingType.BASE58};D.DID_TYPE_ARCBLOCK=p;const g={role:s.types.RoleType.ROLE_PASSKEY,pk:s.types.KeyType.PASSKEY,hash:s.types.HashType.SHA2,address:s.types.EncodingType.BASE58};D.DID_TYPE_PASSKEY=g;const n={role:s.types.RoleType.ROLE_ACCOUNT,pk:s.types.KeyType.ETHEREUM,hash:s.types.HashType.KECCAK,address:s.types.EncodingType.BASE16};D.DID_TYPE_ETHEREUM=n;const o=H=>{const T=["pk","hash","address"];return(0,d.default)((0,c.default)(H,T),(0,c.default)(n,T))};D.isEthereumType=o;const l=H=>{const T=(0,a.toAddress)(H);return/^(0x)?[0-9a-f]{40}$/i.test(T)?/^(0x|0X)?[0-9a-f]{40}$/.test(T)||/^(0x|0X)?[0-9A-F]{40}$/.test(T)?!0:h(T):!1};D.isEthereumDid=l;const h=H=>{const T=H.replace(/^0x/i,""),j=s.Hasher.Keccak.hash256(T.toLowerCase()).replace(/^0x/i,"");for(let O=0;O<40;O++)if(parseInt(j[O],16)>7&&T[O].toUpperCase()!==T[O]||parseInt(j[O],16)<=7&&T[O].toLowerCase()!==T[O])return!1;return!0},E=H=>{if(typeof H>"u")return"";if(!/^(0x)?[0-9a-f]{40}$/i.test(H))throw new Error(`Given address "${H}" is not a valid Ethereum address.`);const T=H.toLowerCase().replace(/^0x/i,""),j=s.Hasher.Keccak.hash256(T).replace(/^0x/i,"");let O="0x";for(let S=0;S<T.length;S++)parseInt(j[S],16)>7?O+=T[S].toUpperCase():O+=T[S];return O};D.toChecksumAddress=E;function b(H={}){let T={};["default","arcblock"].includes(H)?T=p:["eth","ethereum"].includes(H)?T=n:["passkey"].includes(H)?T=g:T={...p,...H};const{role:j,pk:O,hash:S,address:v}=T;Object.keys(T).forEach(B=>{const N=(0,i.default)(`${f[B]||B}Type`);if(Object.values(s.types[N]).includes(T[B])===!1)throw new Error(`Unsupported ${B} type: ${T[B]}`)});const P={role:j,pk:O,hash:S,address:v};return o(P)===!1&&[s.types.RoleType.ROLE_NODE,s.types.RoleType.ROLE_VALIDATOR,s.types.RoleType.ROLE_TETHER,s.types.RoleType.ROLE_SWAP].includes(P.role)&&(P.hash=s.types.HashType.SHA2),P}b.toJSON=H=>Object.keys(H).reduce((T,j)=>{const O=(0,i.default)(`${f[j]||j}Type`),S=Object.keys(s.types[O]),v=Object.values(s.types[O]);return T[j]=S[v.indexOf(H[j])],T},{}),b.fromJSON=H=>Object.keys(H).reduce((T,j)=>{const O=(0,i.default)(`${f[j]||j}Type`),S=Object.keys(s.types[O]),v=Object.values(s.types[O]);return T[j]=v[S.indexOf(H[j])],T},{});const _=H=>{const T=b(H),j=(0,m.toBits)(T.role,6),O=(0,m.toBits)(T.pk,5),S=(0,m.toBits)(T.hash,5),v=`${j}${O}${S}`,P=(0,a.stripHexPrefix)((0,a.numberToHex)(parseInt(v,2)));return(0,m.toStrictHex)(P,4)};D.fromTypeInfo=_;const A=H=>{let T={};try{if(l(H))T=n;else{const O=(0,m.toBytes)(H).slice(0,2),S=(0,m.toStrictHex)(C.from(O).toString("hex")),v=(0,m.toBits)(new a.BN(S,16),16),P=v.slice(0,6),B=v.slice(6,11),N=v.slice(11,16);T={role:parseInt(P,2),pk:parseInt(B,2),hash:parseInt(N,2),address:(0,a.isHex)((0,a.toAddress)(H))?s.types.EncodingType.BASE16:s.types.EncodingType.BASE58}}return Object.keys(T).forEach(j=>{Object.values(s.types[`${(0,i.default)(f[j]||j)}Type`]).includes(T[j])===!1&&delete T[j]}),T}catch{return T}};D.toTypeInfo=A;const R=H=>{const T=A(H);return Object.keys(T).reduce((j,O)=>{const S=s.types[`${(0,i.default)(f[O]||O)}Type`];return j[O]=Object.keys(S).find(v=>S[v]===T[O]),j},{})};return D.toTypeInfoStr=R,D}var Yt;function Sn(){return Yt||(Yt=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DID_TYPE_PASSKEY=e.DID_TYPE_ETHEREUM=e.DID_TYPE_ARCBLOCK=e.DID_PREFIX=e.DidType=e.fromTypeInfo=e.toTypeInfoStr=e.toTypeInfo=e.isEthereumType=e.isEthereumDid=e.isValid=e.isFromPublicKey=e.toDid=e.toAddress=e.fromHash=e.fromPublicKeyHash=e.fromPublicKey=e.fromSecretKey=e.toStrictHex=e.types=void 0;const a=_t();Object.defineProperty(e,"types",{enumerable:!0,get:function(){return a.types}});const i=J();Object.defineProperty(e,"toAddress",{enumerable:!0,get:function(){return i.toAddress}}),Object.defineProperty(e,"toDid",{enumerable:!0,get:function(){return i.toDid}});const d=_n();Object.defineProperty(e,"DidType",{enumerable:!0,get:function(){return d.DidType}}),Object.defineProperty(e,"DID_TYPE_ARCBLOCK",{enumerable:!0,get:function(){return d.DID_TYPE_ARCBLOCK}}),Object.defineProperty(e,"DID_TYPE_ETHEREUM",{enumerable:!0,get:function(){return d.DID_TYPE_ETHEREUM}}),Object.defineProperty(e,"DID_TYPE_PASSKEY",{enumerable:!0,get:function(){return d.DID_TYPE_PASSKEY}}),Object.defineProperty(e,"fromTypeInfo",{enumerable:!0,get:function(){return d.fromTypeInfo}}),Object.defineProperty(e,"isEthereumDid",{enumerable:!0,get:function(){return d.isEthereumDid}}),Object.defineProperty(e,"isEthereumType",{enumerable:!0,get:function(){return d.isEthereumType}}),Object.defineProperty(e,"toTypeInfo",{enumerable:!0,get:function(){return d.toTypeInfo}}),Object.defineProperty(e,"toTypeInfoStr",{enumerable:!0,get:function(){return d.toTypeInfoStr}});const c=jr();Object.defineProperty(e,"DID_PREFIX",{enumerable:!0,get:function(){return c.DID_PREFIX}}),Object.defineProperty(e,"toStrictHex",{enumerable:!0,get:function(){return c.toStrictHex}});const s=(o,l)=>{const h=(0,d.DidType)(l),E=(0,a.getSigner)(h.pk).getPublicKey(o);return m(E.indexOf("0x")===0?E:`0x${E}`,h)};e.fromSecretKey=s;const m=(o,l)=>{const h=(0,d.DidType)(l),b=(0,a.getHasher)(h.hash)(o,1);return f(b,h)};e.fromPublicKey=m;const f=(o,l)=>{const h=(0,d.DidType)(l),E=(0,i.stripHexPrefix)(o).slice(0,40),b=(0,a.getHasher)(h.hash),_=(0,d.fromTypeInfo)(h),A=(0,i.stripHexPrefix)(b(`0x${_}${E}`,1)).slice(0,8),R=`0x${_}${E}${A}`;return(0,d.isEthereumType)(h)?(0,d.toChecksumAddress)(`0x${o.slice(-40)}`):h.address===a.types.EncodingType.BASE58?(0,i.toBase58)(R):R};e.fromPublicKeyHash=f;const p=(o,l=a.types.RoleType.ROLE_ACCOUNT)=>{const h=Object.keys(a.types.RoleType),E=Object.values(a.types.RoleType);if(E.indexOf(l)===-1)throw new Error(`Unsupported role type ${l} when gen ddi from hash`);const b=(0,d.DidType)({role:a.types.RoleType[h[E.indexOf(l)]]});return f(o,b)};e.fromHash=p;const g=(o,l)=>{if(n(o)===!1)return!1;const h=(0,d.toTypeInfo)(o),E=m(l,h),b=o.replace(c.DID_PREFIX,"");return E===b};e.isFromPublicKey=g;const n=o=>{if(!o)return!1;const l=(0,i.toAddress)(String(o)),{hash:h}=(0,d.toTypeInfo)(l);if(typeof h>"u")return!1;if((0,d.isEthereumDid)(l))return!0;const E=(0,a.getHasher)(h),b=(0,c.toBytes)(l),_=(0,c.toStrictHex)(C.from(b.slice(0,22)).toString("hex")),A=(0,c.toStrictHex)(C.from(b.slice(22,26)).toString("hex")),R=(0,i.stripHexPrefix)(E(`0x${_}`,1)).slice(0,8);return A===R};e.isValid=n}(ot)),ot}var Xt;function En(){if(Xt)return Y;Xt=1,Object.defineProperty(Y,"__esModule",{value:!0}),Y.WalletType=void 0,Y.Wallet=d,Y.fromSecretKey=c,Y.fromPublicKey=s,Y.fromAddress=m,Y.fromRandom=f,Y.fromJSON=p,Y.isValid=g;const e=J(),a=_t(),i=Sn();Y.WalletType=i.DidType;function d(n,o="default"){const l=(0,i.DidType)(o),h=(0,a.getSigner)(l.pk),E=(0,a.getHasher)(l.hash);return{type:l,secretKey:n.sk,publicKey:n.pk,address:n.pk?(0,i.fromPublicKey)(n.pk,l):n.address,hash(b,_=1,A="hex"){return E(b,_,A)},sign(b,_=!0,A="hex"){if(!n.sk)throw new Error("Cannot sign data without a secretKey");if(_){const R=E(b,1);return h.sign(R,n.sk,A)}return h.sign(b,n.sk,A)},async verify(b,_,A=!0,R){if(!n.pk)throw new Error("Cannot verify data without a publicKey");const H=A?E(b,1):b;return h.verify(H,_,n.pk,R)},ethHash(b){if(typeof h.ethHash!="function")throw new Error("ethHash is not supported by signer");return h.ethHash(b)},ethSign(b,_=!0){if(!n.sk)throw new Error("Cannot sign data without a secretKey");if(typeof h.ethHash!="function")throw new Error("ethSign is not supported by signer");return _?h.ethSign(h.ethHash(b),(0,e.toHex)(n.sk)):h.ethSign(b,(0,e.toHex)(n.sk))},ethVerify(b,_,A=!0){if(typeof h.ethHash!="function")throw new Error("ethVerify is not supported by signer");const R=A?h.ethHash(b):b;return h.ethRecover(R,_)===this.address},toAddress(){return n.pk?(0,i.fromPublicKey)(n.pk,l):n.address},toJSON(){return{type:i.DidType.toJSON(l),sk:(0,e.toHex)(n.sk),pk:(0,e.toHex)(n.pk),address:this.address}}}}function c(n,o="default"){const l=(0,i.DidType)(o),h={sk:n,pk:(0,a.getSigner)(l.pk).getPublicKey(n)};return d(h,l)}function s(n,o="default"){return d({pk:n},(0,i.DidType)(o))}function m(n){return d({address:(0,i.toAddress)(n)},(0,i.toTypeInfo)(n))}function f(n="default"){const o=(0,i.DidType)(n),h=(0,a.getSigner)(o.pk).genKeyPair();return d({sk:h.secretKey,pk:h.publicKey},o)}function p(n){const o=i.DidType.fromJSON(n.type);return d(n,o)}function g(n,o=!0){return!(!n||typeof n!="object"||typeof n.verify!="function"||typeof n.toAddress!="function"||typeof n.toJSON!="function"||!n.type||!n.publicKey||o&&(!n.secretKey||typeof n.sign!="function"))}return Y}var at,Jt;function xn(){if(Jt)return at;Jt=1;const e=Gr(),a=dn(),{fromSecretKey:i,WalletType:d}=En(),{isHexStrict:c,toHex:s,toBuffer:m,stripHexPrefix:f}=ne(),{types:p}=a;return at={fromAppDid:(n,o,l={role:p.RoleType.ROLE_ACCOUNT},h=0)=>{if(!o)throw new Error("Cannot get user wallet with empty root sk");const E=a.Hasher.SHA3.hash256(m(n)),b=f(E).slice(0,16),_=b.slice(0,8),A=b.slice(8,16),R=parseInt(+`0x${_}`,10)&2147483647,H=parseInt(+`0x${A}`,10)&2147483647,T=f(c(o)?o:s(o)),j=e.fromMasterSeed(C.from(T,"hex")),O=`m/44'/260'/${R}'/${H}'/${h}`,S=j.derive(O),v=d(l),{pk:P=p.KeyType.ED25519}=v;let B;return P===p.KeyType.ED25519?B=a.Signer.Ed25519.genKeyPair("hex",S.privateKey).secretKey:B=s(S.privateKey),P===p.KeyType.ETHEREUM&&(B=B.slice(0,66)),i(B,v)}},at}var vr=xn();const Tn={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function wr({onCreated:e,onClose:a}){const[i,d]=I.useState(!1),{t:c,locale:s}=Be(),{api:m}=Pe(),{teamDid:f}=$e(),{control:p,handleSubmit:g,formState:{errors:n},watch:o,setValue:l}=xr({defaultValues:Tn,mode:"onChange"}),h=o("scope"),E=_=>{_!=="profile:read"&&l("scope",h.includes(_)?h.filter(A=>A!==_):[...h,_])},b=async _=>{d(!0);try{const A={..._,redirectUris:_.redirectUris,contacts:_.contacts?_.contacts.split(",").map(R=>R.trim()):[],scope:_.scope.join(" ")};await m.createOAuthClient({input:{teamDid:f,input:Xr(A,Jr)}}),e(A)}catch(A){De.error(A.message||"Failed to create OAuth App")}finally{d(!1)}};return r.jsxs(ut,{open:!0,onClose:a,maxWidth:"md",fullWidth:!0,children:[r.jsxs(ft,{children:[c("oauth.client.register")," ",r.jsx(dt,{onClick:a,sx:{position:"absolute",right:8,top:8},children:r.jsx(ht,{})})]}),r.jsx(pt,{children:r.jsxs(me,{spacing:4,sx:{mt:2},children:[r.jsx(X,{variant:"h6",gutterBottom:!0,children:c("oauth.client.requiredInformation")}),r.jsx(k,{children:r.jsx(z,{name:"clientName",control:p,rules:{required:c("oauth.client.validate.clientName"),minLength:{value:3,message:c("oauth.client.validate.clientNameMinLength")}},render:({field:_})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",..._,label:c("oauth.client.name"),required:!0,fullWidth:!0,placeholder:c("oauth.client.input.clientNamePlaceholder"),error:!!n.clientName,helperText:n.clientName?.message}),r.jsx(M,{children:c("oauth.client.helperText.clientName")})]})})}),r.jsx(k,{children:r.jsx(z,{name:"clientUri",control:p,rules:{required:c("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:c("oauth.client.validate.clientUriInvalid")}},render:({field:_})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",..._,label:c("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:c("oauth.client.input.clientUriPlaceholder"),error:!!n.clientUri,helperText:n.clientUri?.message}),r.jsx(M,{children:c("oauth.client.helperText.clientUri")})]})})}),r.jsx(k,{children:r.jsx(z,{name:"redirectUris",control:p,rules:{required:c("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:c("oauth.client.validate.redirectUrisInvalid")}},render:({field:_})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",..._,label:c("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:c("oauth.client.input.redirectUrisPlaceholder"),error:!!n.redirectUris,helperText:n.redirectUris?.message}),r.jsxs(k,{sx:{display:"flex",gap:"2px"},children:[r.jsx(M,{children:c("oauth.client.helperText.redirectUris")}),r.jsx(M,{children:c("oauth.client.helperText.read")}),r.jsx(M,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${s}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:c("oauth.client.helperText.document")}),r.jsx(M,{children:c("oauth.client.helperText.more")})]})]})})}),r.jsxs(Lr,{variant:"outlined",sx:{p:2,display:"none"},children:[r.jsx(X,{variant:"subtitle2",gutterBottom:!0,children:c("oauth.client.input.permissions")}),r.jsx(k,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:r.jsx(yr,{children:Object.entries(re.OAUTH_SCOPES).map(([_,A])=>r.jsx(mr,{control:r.jsx(gr,{checked:h.includes(_),onChange:()=>E(_),disabled:_==="profile:read",color:"primary"}),label:r.jsx(k,{children:r.jsx(X,{variant:"body2",sx:{fontWeight:500},children:A})})},_))})})]}),r.jsx(yt,{}),r.jsx(X,{variant:"h6",gutterBottom:!0,children:c("oauth.client.optionalInformation")}),r.jsx(me,{children:r.jsx(z,{name:"contacts",control:p,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:c("oauth.client.validate.contacts")}},render:({field:_})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",..._,label:c("oauth.client.input.contacts"),fullWidth:!0,placeholder:c("oauth.client.input.contactsPlaceholder"),error:!!n.contacts,helperText:n.contacts?.message}),r.jsx(M,{children:c("oauth.client.helperText.contacts")})]})})}),r.jsxs(me,{direction:{xs:"column",sm:"row"},spacing:2,children:[r.jsx(z,{name:"tosUri",control:p,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:c("oauth.client.validate.tosUriInvalid")}},render:({field:_})=>r.jsxs(k,{sx:{width:"50%"},children:[r.jsx(V,{size:"small",..._,label:c("oauth.client.input.tosUri"),fullWidth:!0,placeholder:c("oauth.client.input.tosUriPlaceholder"),error:!!n.tosUri,helperText:n.tosUri?.message}),r.jsx(M,{children:c("oauth.client.helperText.tosUri")})]})}),r.jsx(z,{name:"policyUri",control:p,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:c("oauth.client.validate.policyUriInvalid")}},render:({field:_})=>r.jsxs(k,{sx:{width:"50%"},children:[r.jsx(V,{size:"small",..._,label:c("oauth.client.input.policyUri"),fullWidth:!0,placeholder:c("oauth.client.input.policyUriPlaceholder"),error:!!n.policyUri,helperText:n.policyUri?.message}),r.jsx(M,{children:c("oauth.client.helperText.policyUri")})]})})]}),n.error&&r.jsx(br,{severity:"error",children:n.error.message})]})}),r.jsxs(_r,{children:[r.jsx(He,{onClick:a,children:c("common.cancel")}),r.jsxs(He,{onClick:g(b),disabled:i,variant:"contained",color:"primary",children:[i?r.jsx(mt,{size:20,sx:{mr:1}}):null,c("oauth.client.registerButton")]})]})]})}wr.propTypes={onCreated:w.func.isRequired,onClose:w.func.isRequired};function St({scope:e="",...a}){if(!e)return null;const i=e.split(" ").filter(Boolean);return r.jsx(me,{direction:"row",...a,sx:[{flexWrap:"wrap",gap:1},...Array.isArray(a.sx)?a.sx:[a.sx]],children:i.map(d=>r.jsx(Rr.Fragment,{children:r.jsx(qr,{title:re.OAUTH_SCOPES[d],children:r.jsx(q,{children:d})})},d))})}St.propTypes={scope:w.string};const Et=e=>{const{prefix:a}=Pe(),{blocklet:i}=Zr(),d=xt(a,"/api/media/upload",i.appPid),c=I.useCallback(m=>m?m.startsWith("http")?m:`${xt(a,"/api/media/upload",i.appPid)}/${m}`:"",[a,i.appPid]);return{clientLogoUrl:I.useMemo(()=>c(e),[e,c]),apiPath:d,getClientLogoUrl:c}},Hn=I.lazy(()=>Kr(()=>import("./index-BxU3q403.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(e=>({default:e.Uploader})));function Ur({client:e,onUpdate:a,onClose:i}){const[d,c]=I.useState(!1),{t:s,locale:m}=Be(),f=I.useRef(null),{api:p}=Pe(),{teamDid:g}=$e(),{control:n,handleSubmit:o,formState:{errors:l},watch:h,setValue:E,getValues:b}=xr({defaultValues:{clientName:e.clientName||"",clientUri:e.clientUri||"",redirectUris:Array.isArray(e.redirectUris)?e.redirectUris.join(","):"",scope:e.scope?e.scope.split(" "):["profile:read"],contacts:Array.isArray(e.contacts)?e.contacts.join(","):"",tosUri:e.tosUri||"",policyUri:e.policyUri||"",logoUri:e.logoUri||"",clientSecretExpiresAt:e.clientSecretExpiresAt||null},mode:"onChange"}),_=h("scope"),A=h("logoUri"),{clientLogoUrl:R,apiPath:H}=Et(A),T=S=>{S!=="profile:read"&&E("scope",_.includes(S)?_.filter(v=>v!==S):[..._,S])},j=async S=>{const v={clientId:e.clientId,clientName:S.clientName.trim(),clientUri:S.clientUri,redirectUris:S.redirectUris.split(",").map(P=>P.trim()).filter(Boolean),contacts:S.contacts?S.contacts.split(",").map(P=>P.trim()):[],scope:S.scope.join(" "),tosUri:S.tosUri,policyUri:S.policyUri,logoUri:S.logoUri,clientSecretExpiresAt:S.clientSecretExpiresAt?parseInt(S.clientSecretExpiresAt/1e3,10):null};await p.updateOAuthClient({input:{teamDid:g,input:v}})},O=async S=>{c(!0);try{await j(S),a(),i()}catch(v){De.error(v.message||s("oauth.client.updateFailed"))}finally{c(!1)}};return r.jsxs(ut,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[r.jsxs(ft,{children:[s("oauth.client.update")," ",r.jsx(dt,{onClick:i,sx:{position:"absolute",right:8,top:8},children:r.jsx(ht,{})})]}),r.jsx(pt,{children:r.jsxs(me,{spacing:3,sx:{mt:2},children:[r.jsxs(k,{sx:{mb:3},children:[r.jsx(X,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),r.jsxs(k,{children:[r.jsx(k,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:R?r.jsx(k,{children:r.jsx("img",{src:R,alt:"client-logo",style:{width:"100%",height:"100%"}})}):r.jsx(k,{onClick:()=>{f.current?.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:r.jsx(Sr,{sx:{fontSize:40,color:"common.white"}})})}),r.jsx(He,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{f.current?.open()},children:s(R?"common.change":"common.upload")})]}),r.jsx(k,{sx:{display:"flex",alignItems:"center"},children:r.jsx(I.Suspense,{fallback:r.jsx(en,{}),children:r.jsx(Hn,{ref:f,locale:m,popup:!0,onUploadFinish:S=>{E("logoUri",S.data.filename),j(b()).then(()=>{a()}).catch(v=>{De.error(v.message||s("oauth.client.updateFailed"))}).finally(()=>{f.current?.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:H,disableMediaKitPrefix:!0,disableAutoPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo")})})]}),r.jsx(X,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),r.jsx(V,{label:"Client Id",fullWidth:!0,value:e.clientId,disabled:!0}),r.jsx(k,{children:r.jsx(z,{name:"clientName",control:n,rules:{required:s("oauth.client.validate.clientName"),minLength:{value:3,message:s("oauth.client.validate.clientNameMinLength")}},render:({field:S})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...S,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!l.clientName,helperText:l.clientName?.message}),r.jsx(M,{children:s("oauth.client.helperText.clientName")})]})})}),r.jsx(k,{children:r.jsx(z,{name:"clientUri",control:n,rules:{required:s("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.clientUriInvalid")}},render:({field:S})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...S,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!l.clientUri,helperText:l.clientUri?.message}),r.jsx(M,{children:s("oauth.client.helperText.clientUri")})]})})}),r.jsx(k,{children:r.jsx(z,{name:"redirectUris",control:n,rules:{required:s("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.redirectUrisInvalid")}},render:({field:S})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...S,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!l.redirectUris,helperText:l.redirectUris?.message}),r.jsx(M,{children:s("oauth.client.helperText.redirectUris")})]})})}),r.jsx(z,{name:"clientSecretExpiresAt",control:n,render:({field:S})=>r.jsx(Qr,{placeholder:s("oauth.client.input.expireTime"),value:S.value*1e3,onChange:v=>{S.onChange(v)}})}),r.jsxs(k,{sx:{display:"none"},children:[r.jsx(X,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),r.jsx(k,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:r.jsx(yr,{children:Object.entries(re.OAUTH_SCOPES).map(([S,v])=>r.jsx(mr,{control:r.jsx(gr,{checked:_.includes(S),onChange:()=>T(S),disabled:S==="profile:read",color:"primary"}),label:r.jsx(k,{children:r.jsx(X,{variant:"body2",sx:{fontWeight:500},children:v})})},S))})})]}),r.jsx(yt,{}),r.jsx(X,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),r.jsx(k,{children:r.jsx(z,{name:"contacts",control:n,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:s("oauth.client.validate.contacts")}},render:({field:S})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...S,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!l.contacts,helperText:l.contacts?.message}),r.jsx(M,{children:s("oauth.client.helperText.contacts")})]})})}),r.jsxs(me,{direction:{xs:"column",sm:"row"},spacing:2,children:[r.jsx(z,{name:"tosUri",control:n,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.tosUriInvalid")}},render:({field:S})=>r.jsxs(k,{sx:{width:"50%"},children:[r.jsx(V,{...S,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!l.tosUri,helperText:l.tosUri?.message}),r.jsx(M,{children:s("oauth.client.helperText.tosUri")})]})}),r.jsx(z,{name:"policyUri",control:n,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.policyUriInvalid")}},render:({field:S})=>r.jsxs(k,{sx:{width:"50%"},children:[r.jsx(V,{...S,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!l.policyUri,helperText:l.policyUri?.message}),r.jsx(M,{children:s("oauth.client.helperText.policyUri")})]})})]}),l.error&&r.jsx(br,{severity:"error",children:l.error.message})]})}),r.jsxs(_r,{children:[r.jsx(He,{onClick:i,children:s("common.cancel")}),r.jsx(He,{onClick:o(O),disabled:d,variant:"contained",color:"primary",children:d?r.jsx(mt,{size:16}):s("common.update")})]})]})}Ur.propTypes={client:w.shape({clientId:w.string.isRequired,clientName:w.string.isRequired,clientUri:w.string,redirectUris:w.arrayOf(w.string),scope:w.string,contacts:w.arrayOf(w.string),tosUri:w.string,policyUri:w.string,logoUri:w.string,clientSecretExpiresAt:w.number}).isRequired,onUpdate:w.func.isRequired,onClose:w.func.isRequired};function Ar({client:e,onUpdate:a,onClose:i}){return r.jsx(Ur,{client:e,onUpdate:d=>a(d),onClose:i})}Ar.propTypes={client:w.shape({clientId:w.string.isRequired,clientName:w.string.isRequired,clientUri:w.string,redirectUris:w.arrayOf(w.string),scope:w.string,contacts:w.arrayOf(w.string),tosUri:w.string,policyUri:w.string,logoUri:w.string,clientSecretExpiresAt:w.number}).isRequired,onUpdate:w.func.isRequired,onClose:w.func.isRequired};function Or({clientId:e,clientName:a,onDelete:i=()=>{},onClose:d=()=>{}}){const{t:c}=Be(),{api:s}=Pe(),{teamDid:m}=$e(),f=()=>{d()},p=async()=>{try{await s.deleteOAuthClient({input:{teamDid:m,clientId:e}}),i()}catch(n){De.error(n?.message)}finally{f()}},g={keyName:a,title:c("oauth.client.delete.title"),description:c("oauth.client.delete.description",{name:`<b>${a}</b>`}),confirmPlaceholder:c("oauth.client.delete.description",{name:a}),confirm:c("common.delConfirm"),cancel:c("common.cancel"),onConfirm:p,onCancel:f};return r.jsx(tn,{keyName:g.keyName,title:g.title,description:g.description,confirmPlaceholder:g.confirmPlaceholder,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})}Or.propTypes={clientId:w.string.isRequired,clientName:w.string.isRequired,onDelete:w.func,onClose:w.func};function Br({title:e,items:a}){return r.jsxs(k,{sx:{mb:3},children:[r.jsx(X,{variant:"h6",sx:{mb:1.5},children:e}),r.jsx(me,{spacing:1.5,children:a.map(({label:i,value:d})=>r.jsxs(k,{sx:{display:"flex",alignItems:"center",gap:2},children:[r.jsx(X,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),r.jsx(X,{sx:{wordBreak:"break-all"},children:d||"-"})]},i))})]})}Br.propTypes={title:w.string.isRequired,items:w.arrayOf(w.shape({label:w.string.isRequired,value:w.any})).isRequired};function Pr({client:e,onClose:a}){const{t:i,locale:d}=Be(),{teamDid:c}=$e(),{clientName:s,clientId:m,clientSecret:f,redirectUris:p,scope:g,clientUri:n,logoUri:o,contacts:l,tosUri:h,policyUri:E,jwksUri:b,jwks:_,softwareId:A,softwareVersion:R,clientIdIssuedAt:H,clientSecretExpiresAt:T,updatedAt:j,createUser:O}=e,{clientLogoUrl:S}=Et(o),v=N=>{try{const ee=new URL(window.blocklet.appUrl);return ee.pathname=N,ee.toString()}catch{return"-"}},P=vr.fromAppDid(m,c),B=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:s},{label:i("oauth.client.logoUri"),value:r.jsx(pr,{variant:"rounded",shape:"square",src:S,did:P.address,size:64})},{label:i("oauth.client.clientUri"),value:n?r.jsx(q,{children:n}):"-"},{label:i("oauth.client.clientId"),value:r.jsx(q,{children:m})},{label:i("oauth.client.clientSecret"),value:r.jsx(q,{children:f})},{label:i("oauth.client.redirectUris"),value:r.jsx(q,{children:(p||[]).join(", ")})},{label:i("oauth.client.scope"),value:r.jsx(St,{scope:g})},{label:i("oauth.client.createUser"),value:O?rn(O,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:r.jsx(q,{children:v("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:r.jsx(q,{children:v(`${re.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:r.jsx(q,{children:v(`${re.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:r.jsx(q,{children:v(`${re.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:r.jsx(q,{children:v(`${re.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:r.jsx(q,{children:v(`${re.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:r.jsx(q,{children:v(`${re.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/logout`)})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:l.length?r.jsx(q,{children:(l||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:h?r.jsx(q,{children:h}):"-"},{label:i("oauth.client.policyUri"),value:E?r.jsx(q,{children:E}):"-"},{label:i("oauth.client.jwksUri"),value:b},{label:i("oauth.client.jwks"),value:_},{label:i("oauth.client.softwareId"),value:A},{label:i("oauth.client.softwareVersion"),value:R}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:H?r.jsx(Ce,{value:H*1e3,type:"all",locale:d}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:T?r.jsx(Ce,{value:T*1e3,type:"all",locale:d}):"-"},{label:i("common.updatedAt"),value:j?r.jsx(Ce,{value:j,type:"all",locale:d}):"-"}]}].filter(Boolean);return r.jsxs(ut,{open:!0,onClose:a,maxWidth:"lg",fullWidth:!0,children:[r.jsxs(ft,{children:[i("oauth.client.oauthAppDetails"),r.jsx(dt,{onClick:a,sx:{position:"absolute",right:8,top:8},children:r.jsx(ht,{})})]}),r.jsx(pt,{children:r.jsx(k,{sx:{mt:1},children:B.map((N,ee)=>r.jsxs(k,{children:[r.jsx(Br,{title:N.title,items:N.items}),ee!==B.length-1&&r.jsx(yt,{sx:{my:2}})]},N.title))})})]})}Pr.propTypes={client:w.object.isRequired,onClose:w.func.isRequired};function jn(e){return r.jsx(Ce,{value:e*1e3})}function $r({selected:e=null,onClose:a}){return e?r.jsx(Pr,{client:e,onClose:a}):null}$r.propTypes={selected:w.object,onClose:w.func.isRequired};function kr({open:e,onCreated:a,onClose:i}){return e?r.jsx(wr,{onCreated:a,onClose:i}):null}kr.propTypes={open:w.bool.isRequired,onCreated:w.func.isRequired,onClose:w.func.isRequired};function si(){const[e,a]=I.useState({searchText:"",pageSize:10,page:1}),[i,d]=I.useState(null),[c,s]=I.useState(!1),m=I.useRef(null),{t:f,locale:p}=Be(),{api:g}=Pe(),{teamDid:n}=$e(),[o,l]=I.useState(null),[h,E]=I.useState(null),b=sn(),{getClientLogoUrl:_}=Et(),A=Yr(async()=>await g.getOAuthClients({input:{teamDid:n,paging:{page:e.page,pageSize:e.pageSize}}}),[e.page,e.pageSize]),{loading:R}=A,H=I.useMemo(()=>A.value?.list||[],[A.value?.list]),T=I.useMemo(()=>e.searchText?H.filter(S=>S.clientName.toLowerCase().includes(e.searchText.toLowerCase())||S.clientId.toLowerCase().includes(e.searchText.toLowerCase())||S.scope.toLowerCase().includes(e.searchText.toLowerCase())):H,[e.searchText,H]),j=I.useMemo(()=>[{label:f("oauth.client.name"),name:"clientName",options:{customBodyRender:(S,{rowIndex:v})=>{const P=T[v],B=_(P.logoUri),N=vr.fromAppDid(P.clientId,n);return r.jsx(k,{sx:{display:"flex",alignItems:"center",gap:2},children:r.jsxs(k,{sx:{display:"flex",alignItems:"center",gap:2,cursor:"pointer"},children:[r.jsx(pr,{variant:"rounded",shape:"square",did:N.address,src:B,size:48}),r.jsxs(me,{sx:{gap:.5},children:[r.jsx(k,{sx:{color:"text.primary"},children:P.clientName}),r.jsx(k,{sx:{color:"text.secondary"},children:P.clientUri})]})]})})}}},{label:f("oauth.client.clientId"),name:"clientId"},{label:f("oauth.client.scope"),name:"scope",options:{customBodyRender:S=>r.jsx(St,{scope:S})}},{label:f("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:jn}},{label:f("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:S=>S?r.jsx(Wr,{showDid:!0,did:S,cardType:zr.Detailed,infoType:Vr.Minimal,sx:{border:0,padding:0}}):f("oauth.client.openRegistration")}},{label:f("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(S,{rowIndex:v})=>{const P=T[v];return r.jsx(nn,{actions:[{icon:r.jsx(Mr,{}),text:f("common.edit"),onClick:B=>{B.stopPropagation(),l(P)}},{icon:r.jsx(Fr,{}),text:f("common.delete"),onClick:B=>{B.stopPropagation(),E(P)}}]})}}}],[T,f,_,n,l,E]),O=({page:S,rowsPerPage:v,searchText:P})=>{e.pageSize!==v?a(B=>({...B,searchText:"",pageSize:v,page:1})):e.page!==S+1?a(B=>({...B,searchText:"",page:S+1})):e.searchText!==P&&a(B=>({...B,searchText:P,page:1}))};return r.jsxs(k,{ref:m,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[b?r.jsx(Tt,{title:f("oauth.client.listTitle"),tooltipTitle:f("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${p}/oauth-service`}):null,r.jsx(Nr,{data:T,columns:j,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:e.page-1,rowsPerPage:e.pageSize,count:T.length,searchDebounceTime:400,onRowClick(S,{dataIndex:v},P){if(m.current?.contains(P.target)){const B=T[v];d(B)}}},onChange:O,title:b?null:r.jsx(Tt,{title:f("oauth.client.listTitle"),tooltipTitle:f("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${p}/oauth-service`}),customButtons:[r.jsxs(He,{variant:"contained",size:"small",onClick:()=>s(!0),children:[R?r.jsx(mt,{size:16}):r.jsx(Sr,{style:{fontSize:16}}),f("common.create")]},"add")],loading:!1,emptyNode:r.jsx(Ir,{children:f("oauth.client.empty")})}),r.jsx($r,{selected:i,onClose:()=>d(null)}),r.jsx(kr,{open:c,onCreated:()=>{s(!1),A.retry()},onClose:()=>s(!1)}),o&&r.jsx(Ar,{client:o,onUpdate:A.retry,onClose:()=>l(null)}),h&&r.jsx(Or,{...h,onDelete:A.retry,onClose:()=>E(null)})]})}export{si as default};
@@ -1,4 +1,4 @@
1
- import{r as o}from"./vendor-react-Dvs43sk9.js";import{j as t,b4 as _,W as n,D as F,n as xe,b0 as ye,cw as be,cx as ve,cy as je,cz as we,ak as g,T as q,Q as ke,a$ as te,a3 as Ie,s as Me,J as Re,I as Ce,at as Ae}from"./vendor-mui-core-B7zoO8f5.js";import{a as D,b as O,h as Te}from"./vendor-hooks-BRXKH6Nb.js";import{T as Q,a5 as Ne,aa as ne,G as re,a7 as Se}from"./vendor-ux-B7q8W4Pg.js";import{t as $e}from"./server-logo-notext.svg-CKQB0tIp.js";import{B as ze}from"./bundle-avatar-CopjjSKq.js";import{a as Le,g as se,i as ie,b as oe,c as V,M as ae,d as Ee,m as De,e as Be,f as Pe,h as qe,j as Ve,k as _e,l as Fe,n as Oe,N as He}from"./team-BVaQVRGX.js";import{R as Ue,J as We,C as G,a as H}from"./vendor-utils-DtY42AM-.js";import{c as Qe,Z as Ge}from"./index-BF7bSwjJ.js";import{B as Je,a as Ke,l as Xe}from"./index-DO8dY30H.js";import{p as Ye}from"./util-CmTchaCE.js";function le({blocklet:e,style:r={},size:s=40,...i}){const l=Le({blocklet:e,square:!0}),{variant:u}=i;return t.jsx(_,{variant:u||"square",style:Object.assign({backgroundColor:"transparent",width:s,height:s,borderRadius:10},r),...i,children:t.jsx("img",{src:l,alt:"",style:{width:s}})})}le.propTypes={blocklet:n.object.isRequired,style:n.object,size:n.oneOfType([n.number,n.string])};function Ze(e){return e.includes(" ")?new Date(e.replace(" ","T").replace(" ","")).getTime():new Date(e).getTime()}function J({value:e="",shouldUpdate:r=!1,...s}){const{locale:i}=Q(),[l,u]=o.useState(0);if(o.useEffect(()=>{let d;if(r){const p=new Date(e).getTime(),y=Date.now(),v=Math.abs(Math.floor((p-y)/1e3)),b=()=>{u(k=>{const C=Math.random()*1e3;return parseFloat((k+C).toFixed(4))})};v<60?d=setInterval(b,1e3):v<60*60?d=setInterval(b,6e4):d=setInterval(b,36e5)}return()=>{clearInterval(d)}},[e,l,r]),!e)return"-";const m=Ze(e);return t.jsx(Ne,{value:m,locale:i,...s})}J.propTypes={value:n.any,shouldUpdate:n.bool};const et={error:je,warning:ve,info:be,success:ye};ce.propTypes={severity:n.oneOf(["error","warning","info","success"]).isRequired,size:n.number};function ce({severity:e="info",size:r=32}){const s=F(),l=D(()=>({error:s.palette.error.main,warning:s.palette.warning.main,info:s.palette.info.main,success:s.palette.success.main}))[e],u=et[e],m=xe(l,.1);return t.jsx(_,{sx:{width:r,height:r,bgcolor:m,color:l},children:t.jsx(u,{fontSize:"small"})})}const tt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M5.821 4.91c3.898-2.765 9.469-2.539 13.073.536c3.667 3.127 4.168 8.238 1.152 11.897c-2.842 3.447-7.965 4.583-12.231 2.805l-.232-.101l-4.375.931l-.075.013l-.11.009l-.113-.004l-.044-.005l-.11-.02l-.105-.034l-.1-.044l-.076-.042l-.108-.077l-.081-.074l-.073-.083l-.053-.075l-.065-.115l-.042-.106l-.031-.113l-.013-.075l-.009-.11l.004-.113l.005-.044l.02-.11l.022-.072l1.15-3.451l-.022-.036C.969 12.45 1.97 7.805 5.59 5.079l.23-.168z"/></g>'},nt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M12 2a5 5 0 1 1-5 5l.005-.217A5 5 0 0 1 12 2zm2 12a5 5 0 0 1 5 5v1a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-1a5 5 0 0 1 5-5h4z"/></g>'},rt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M17 3.34A10 10 0 1 1 2 12l.005-.324A10 10 0 0 1 17 3.34zM12 6a1 1 0 0 0-1 1a3 3 0 1 0 0 6v2a1.024 1.024 0 0 1-.866-.398l-.068-.101a1 1 0 0 0-1.732.998a3 3 0 0 0 2.505 1.5H11a1 1 0 0 0 .883.994L12 18a1 1 0 0 0 1-1l.176-.005A3 3 0 0 0 13 11V9c.358-.012.671.14.866.398l.068.101a1 1 0 0 0 1.732-.998A3 3 0 0 0 13.161 7H13a1 1 0 0 0-1-1zm1 7a1 1 0 0 1 0 2v-2zm-2-4v2a1 1 0 0 1 0-2z"/></g>'},st={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M8 12a4 4 0 1 0 8 0a4 4 0 1 0-8 0"/><path d="M16 12v1.5a2.5 2.5 0 0 0 5 0V12a9 9 0 1 0-5.5 8.28"/></g>'},it={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m15 10l-4 4l6 6l4-16l-18 7l4 2l2 6l3-4"/>'},Z={comment:{icon:tt,bgColor:"rgba(239, 246, 255, 1)",color:"rgba(43, 127, 255, 1)"},like:{icon:"👍",bgColor:"rgba(244, 244, 245, 1)",color:"yellow",renderType:"emoji"},follow:{icon:nt,bgColor:"rgba(238, 242, 255, 1)",color:"rgba(97, 95, 255, 1)"},tips:{icon:rt,bgColor:"rgba(254, 252, 232, 1)",color:"rgba(240, 177, 0, 1)"},mention:{icon:st,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"},assign:{icon:it,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"}};de.propTypes={activity:n.oneOf(["comment","like","follow","tips","mention","assign"]).isRequired,size:n.number};function de({activity:e,size:r=32}){const s=Z[e]||Z.comment,i=s.icon;return t.jsx(_,{sx:{bgcolor:s.bgColor,color:s.color,width:r,height:r},children:s.renderType==="emoji"?t.jsx("span",{style:{fontSize:"14px"},children:i}):t.jsx(ne,{icon:i})})}const U={avatar:n.string,fullName:n.string,did:n.string};function W({actor:e,size:r,teamDid:s="",inService:i=!1,showName:l=!1}){const u=D(()=>({...e,avatar:e?.avatar?Ye(e.avatar,s,i):null}),[e,s,i]),m=d=>{e&&(d.stopPropagation(),window.open(We(G(Qe.WELLKNOWN_SERVICE_PATH_PREFIX,"user"),{did:e.did}),"_blank"),d.customPreventRedirect=!0)};return t.jsxs(g,{onClick:m,role:"button",style:{cursor:"pointer"},title:e?.fullName||"",sx:{display:"flex",alignItems:"center",gap:1},children:[u.avatar?t.jsx(Je,{user:u,showDid:!0,cardType:Xe.AvatarOnly,infoType:Ke.Minimal,avatarSize:r,shape:"circle",sx:{width:r,height:r,borderRadius:"100%",overflow:"hidden",transition:"transform 0.2s ease-in-out","&:hover":{transform:"scale(1.1)"}}}):t.jsx(_,{sx:{width:r,height:r}}),l&&t.jsx("span",{children:e?.fullName})]})}W.propTypes={actor:n.shape(U).isRequired,size:n.number.isRequired,teamDid:n.string,inService:n.bool,showName:n.bool};K.propTypes={actors:n.oneOfType([n.shape(U),n.arrayOf(n.shape(U))]).isRequired,size:n.number,maxDisplay:n.number,teamDid:n.string,inService:n.bool,showName:n.bool,avatarFallback:n.node};function K({actors:e,size:r=32,maxDisplay:s=9,teamDid:i="",inService:l=!0,showName:u=!1,avatarFallback:m=null}){const d=D(()=>{const p=Array.isArray(e)?e:[e];return Ue(p,"did").filter(Boolean)},[e]);return d.length===1||!d.length?t.jsx(W,{actor:d[0],size:r,teamDid:i,inService:l,showName:u}):t.jsx(we,{total:d.length,renderSurplus:p=>p<100?t.jsxs("span",{children:["+",p]}):t.jsx("span",{children:"99+"}),max:s,sx:{justifyContent:"flex-end",height:`${r}px`,".MuiAvatar-root":{width:`${r}px`,height:`${r}px`,fontSize:`${r/2.5}px`,border:0,zIndex:2}},children:d.map((p,y)=>p?.avatar?t.jsx(W,{actor:p,size:r,teamDid:i,inService:l},p?.did||y):m)})}const ee=3;pe.propTypes={notification:n.object.isRequired,isMultiple:n.bool,blocklet:n.object,mountPoint:n.string,avatarFallback:n.node};ue.propTypes={notification:n.object.isRequired,mountPoint:n.string};he.propTypes={items:n.array.isRequired,activity:n.object.isRequired,blocklet:n.object,mountPoint:n.string,viewMoreLink:n.string,avatarFallback:n.node};function ue({notification:e,mountPoint:r=""}){const{activity:s}=e,{type:i,meta:l={}}=s||{},u=oe({activity:s,users:[e?.actorInfo],actors:[e?.activity?.actor],mountPoint:r});return H(s)||!s.type||!s.actor||H(s.target)?null:t.jsxs(g,{children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:.5},children:u}),l?t.jsx(ae,{meta:l,type:i}):null]})}function he({items:e,activity:r,blocklet:s,mountPoint:i="",viewMoreLink:l="",avatarFallback:u=null}){const m=F(),{t:d}=Q(),p=D(()=>s?.did||s?.meta?.did||"",[s]),{locale:y}=o.useContext(re),v=D(()=>!H(r.meta)&&Object.values(r.meta).some(a=>a!=null),[r]),b=oe({activity:r,users:e.map(a=>a?.actorInfo),actors:e.map(a=>a?.activity?.actor),mountPoint:i}),k=O(a=>{if(!a.activity)return null;const x=se(a.activity);return x?.metaLink?ie(x?.metaLink)?x?.metaLink:G(i,x.metaLink):null}),C=O((a,x)=>{if(!x)return;const h=k(x);h&&(window.open(h,"_blank"),a.customPreventRedirect=!0)}),S=e.length>ee,w=e.slice(0,ee);return t.jsxs(g,{sx:{width:"100%"},children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:3},children:b}),v?t.jsxs(g,{className:"sub-content",sx:{display:"flex",flexDirection:"column",gap:3},children:[w.map(a=>t.jsxs(g,{onClick:x=>C(x,a),sx:{display:"flex",flexDirection:"column",gap:1},children:[t.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[V(a)?t.jsx(K,{actors:a.actorInfo,size:32,teamDid:p}):u,t.jsx(q,{variant:"subtitle1",sx:{color:"text.primary"},children:V(a)?a?.actorInfo?.fullName:"System"})," ","·",t.jsx(J,{value:a.createdAt,locale:y,shouldUpdate:!0,style:{color:m.palette.text.secondary,fontSize:"0.875rem",minWidth:"50px",whiteSpace:"nowrap"}})]}),a.activity.meta?t.jsx(g,{sx:{pl:5},children:t.jsx(ae,{meta:a.activity.meta,type:a.activity.type})}):null]},a.id)),S&&l?t.jsx(g,{sx:{mt:1,display:"flex",justifyContent:"center"},children:t.jsxs(ke,{size:"large",variant:"text",component:te,href:l,target:"_blank",rel:"noopener noreferrer",onClick:a=>{a.customPreventRedirect=!0},children:[d("notification.viewMore")," ",t.jsx(ne,{icon:Ee,style:{marginLeft:4}})]})}):null]}):null]})}function pe({notification:e,isMultiple:r=!1,blocklet:s,mountPoint:i="",avatarFallback:l}){const u=D(()=>{if(!e.activity)return null;const m=se(e.activity);return m?.targetLink?ie(m?.targetLink)?m?.targetLink:G(i,m.targetLink):null},[e.activity,i]);return r?t.jsx(he,{items:e.items,activity:e.activity,blocklet:s,mountPoint:i,viewMoreLink:u,avatarFallback:l}):t.jsx(ue,{notification:e,mountPoint:i})}function me({notification:e}){const r=o.useMemo(()=>{const{actions:s,action:i}=e;let l=s??[];return!l.length&&i&&(l=[{name:"Visit",link:i}]),l},[e]);return r.length?t.jsx(g,{sx:{display:"flex",justifyContent:"start",flexWrap:"wrap",alignItems:"center",gap:1},children:r.map((s,i)=>t.jsxs(o.Fragment,{children:[t.jsx(te,{href:s.link,target:"_blank",className:"link",rel:"noopener noreferrer",sx:{fontSize:"15px"},onClick:l=>{l.customPreventRedirect=!0},children:s.name},s.link),i<r.length-1?t.jsx(Ie,{orientation:"vertical",sx:{height:12,borderWidth:"1px"}}):null]},s.link))}):null}me.propTypes={notification:n.object.isRequired};const ot=Me(g)`
1
+ import{r as o}from"./vendor-react-Dvs43sk9.js";import{j as t,b4 as _,W as n,D as F,n as xe,b0 as ye,cw as be,cx as ve,cy as je,cz as we,ak as g,T as q,Q as ke,a$ as te,a3 as Ie,s as Me,J as Re,I as Ce,at as Ae}from"./vendor-mui-core-B7zoO8f5.js";import{a as D,b as O,h as Te}from"./vendor-hooks-BRXKH6Nb.js";import{T as Q,a5 as Ne,aa as ne,G as re,a7 as Se}from"./vendor-ux-B7q8W4Pg.js";import{t as $e}from"./server-logo-notext.svg-CKQB0tIp.js";import{B as ze}from"./bundle-avatar-FLzOZWlh.js";import{a as Le,g as se,i as ie,b as oe,c as V,M as ae,d as Ee,m as De,e as Be,f as Pe,h as qe,j as Ve,k as _e,l as Fe,n as Oe,N as He}from"./team-Dl23XmaY.js";import{R as Ue,J as We,C as G,a as H}from"./vendor-utils-DtY42AM-.js";import{c as Qe,Z as Ge}from"./index-CuQBOJqN.js";import{B as Je,a as Ke,l as Xe}from"./index-DzqNo2lD.js";import{p as Ye}from"./util-Ca2jlZN4.js";function le({blocklet:e,style:r={},size:s=40,...i}){const l=Le({blocklet:e,square:!0}),{variant:u}=i;return t.jsx(_,{variant:u||"square",style:Object.assign({backgroundColor:"transparent",width:s,height:s,borderRadius:10},r),...i,children:t.jsx("img",{src:l,alt:"",style:{width:s}})})}le.propTypes={blocklet:n.object.isRequired,style:n.object,size:n.oneOfType([n.number,n.string])};function Ze(e){return e.includes(" ")?new Date(e.replace(" ","T").replace(" ","")).getTime():new Date(e).getTime()}function J({value:e="",shouldUpdate:r=!1,...s}){const{locale:i}=Q(),[l,u]=o.useState(0);if(o.useEffect(()=>{let d;if(r){const p=new Date(e).getTime(),y=Date.now(),v=Math.abs(Math.floor((p-y)/1e3)),b=()=>{u(k=>{const C=Math.random()*1e3;return parseFloat((k+C).toFixed(4))})};v<60?d=setInterval(b,1e3):v<60*60?d=setInterval(b,6e4):d=setInterval(b,36e5)}return()=>{clearInterval(d)}},[e,l,r]),!e)return"-";const m=Ze(e);return t.jsx(Ne,{value:m,locale:i,...s})}J.propTypes={value:n.any,shouldUpdate:n.bool};const et={error:je,warning:ve,info:be,success:ye};ce.propTypes={severity:n.oneOf(["error","warning","info","success"]).isRequired,size:n.number};function ce({severity:e="info",size:r=32}){const s=F(),l=D(()=>({error:s.palette.error.main,warning:s.palette.warning.main,info:s.palette.info.main,success:s.palette.success.main}))[e],u=et[e],m=xe(l,.1);return t.jsx(_,{sx:{width:r,height:r,bgcolor:m,color:l},children:t.jsx(u,{fontSize:"small"})})}const tt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M5.821 4.91c3.898-2.765 9.469-2.539 13.073.536c3.667 3.127 4.168 8.238 1.152 11.897c-2.842 3.447-7.965 4.583-12.231 2.805l-.232-.101l-4.375.931l-.075.013l-.11.009l-.113-.004l-.044-.005l-.11-.02l-.105-.034l-.1-.044l-.076-.042l-.108-.077l-.081-.074l-.073-.083l-.053-.075l-.065-.115l-.042-.106l-.031-.113l-.013-.075l-.009-.11l.004-.113l.005-.044l.02-.11l.022-.072l1.15-3.451l-.022-.036C.969 12.45 1.97 7.805 5.59 5.079l.23-.168z"/></g>'},nt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M12 2a5 5 0 1 1-5 5l.005-.217A5 5 0 0 1 12 2zm2 12a5 5 0 0 1 5 5v1a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-1a5 5 0 0 1 5-5h4z"/></g>'},rt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M17 3.34A10 10 0 1 1 2 12l.005-.324A10 10 0 0 1 17 3.34zM12 6a1 1 0 0 0-1 1a3 3 0 1 0 0 6v2a1.024 1.024 0 0 1-.866-.398l-.068-.101a1 1 0 0 0-1.732.998a3 3 0 0 0 2.505 1.5H11a1 1 0 0 0 .883.994L12 18a1 1 0 0 0 1-1l.176-.005A3 3 0 0 0 13 11V9c.358-.012.671.14.866.398l.068.101a1 1 0 0 0 1.732-.998A3 3 0 0 0 13.161 7H13a1 1 0 0 0-1-1zm1 7a1 1 0 0 1 0 2v-2zm-2-4v2a1 1 0 0 1 0-2z"/></g>'},st={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M8 12a4 4 0 1 0 8 0a4 4 0 1 0-8 0"/><path d="M16 12v1.5a2.5 2.5 0 0 0 5 0V12a9 9 0 1 0-5.5 8.28"/></g>'},it={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m15 10l-4 4l6 6l4-16l-18 7l4 2l2 6l3-4"/>'},Z={comment:{icon:tt,bgColor:"rgba(239, 246, 255, 1)",color:"rgba(43, 127, 255, 1)"},like:{icon:"👍",bgColor:"rgba(244, 244, 245, 1)",color:"yellow",renderType:"emoji"},follow:{icon:nt,bgColor:"rgba(238, 242, 255, 1)",color:"rgba(97, 95, 255, 1)"},tips:{icon:rt,bgColor:"rgba(254, 252, 232, 1)",color:"rgba(240, 177, 0, 1)"},mention:{icon:st,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"},assign:{icon:it,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"}};de.propTypes={activity:n.oneOf(["comment","like","follow","tips","mention","assign"]).isRequired,size:n.number};function de({activity:e,size:r=32}){const s=Z[e]||Z.comment,i=s.icon;return t.jsx(_,{sx:{bgcolor:s.bgColor,color:s.color,width:r,height:r},children:s.renderType==="emoji"?t.jsx("span",{style:{fontSize:"14px"},children:i}):t.jsx(ne,{icon:i})})}const U={avatar:n.string,fullName:n.string,did:n.string};function W({actor:e,size:r,teamDid:s="",inService:i=!1,showName:l=!1}){const u=D(()=>({...e,avatar:e?.avatar?Ye(e.avatar,s,i):null}),[e,s,i]),m=d=>{e&&(d.stopPropagation(),window.open(We(G(Qe.WELLKNOWN_SERVICE_PATH_PREFIX,"user"),{did:e.did}),"_blank"),d.customPreventRedirect=!0)};return t.jsxs(g,{onClick:m,role:"button",style:{cursor:"pointer"},title:e?.fullName||"",sx:{display:"flex",alignItems:"center",gap:1},children:[u.avatar?t.jsx(Je,{user:u,showDid:!0,cardType:Xe.AvatarOnly,infoType:Ke.Minimal,avatarSize:r,shape:"circle",sx:{width:r,height:r,borderRadius:"100%",overflow:"hidden",transition:"transform 0.2s ease-in-out","&:hover":{transform:"scale(1.1)"}}}):t.jsx(_,{sx:{width:r,height:r}}),l&&t.jsx("span",{children:e?.fullName})]})}W.propTypes={actor:n.shape(U).isRequired,size:n.number.isRequired,teamDid:n.string,inService:n.bool,showName:n.bool};K.propTypes={actors:n.oneOfType([n.shape(U),n.arrayOf(n.shape(U))]).isRequired,size:n.number,maxDisplay:n.number,teamDid:n.string,inService:n.bool,showName:n.bool,avatarFallback:n.node};function K({actors:e,size:r=32,maxDisplay:s=9,teamDid:i="",inService:l=!0,showName:u=!1,avatarFallback:m=null}){const d=D(()=>{const p=Array.isArray(e)?e:[e];return Ue(p,"did").filter(Boolean)},[e]);return d.length===1||!d.length?t.jsx(W,{actor:d[0],size:r,teamDid:i,inService:l,showName:u}):t.jsx(we,{total:d.length,renderSurplus:p=>p<100?t.jsxs("span",{children:["+",p]}):t.jsx("span",{children:"99+"}),max:s,sx:{justifyContent:"flex-end",height:`${r}px`,".MuiAvatar-root":{width:`${r}px`,height:`${r}px`,fontSize:`${r/2.5}px`,border:0,zIndex:2}},children:d.map((p,y)=>p?.avatar?t.jsx(W,{actor:p,size:r,teamDid:i,inService:l},p?.did||y):m)})}const ee=3;pe.propTypes={notification:n.object.isRequired,isMultiple:n.bool,blocklet:n.object,mountPoint:n.string,avatarFallback:n.node};ue.propTypes={notification:n.object.isRequired,mountPoint:n.string};he.propTypes={items:n.array.isRequired,activity:n.object.isRequired,blocklet:n.object,mountPoint:n.string,viewMoreLink:n.string,avatarFallback:n.node};function ue({notification:e,mountPoint:r=""}){const{activity:s}=e,{type:i,meta:l={}}=s||{},u=oe({activity:s,users:[e?.actorInfo],actors:[e?.activity?.actor],mountPoint:r});return H(s)||!s.type||!s.actor||H(s.target)?null:t.jsxs(g,{children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:.5},children:u}),l?t.jsx(ae,{meta:l,type:i}):null]})}function he({items:e,activity:r,blocklet:s,mountPoint:i="",viewMoreLink:l="",avatarFallback:u=null}){const m=F(),{t:d}=Q(),p=D(()=>s?.did||s?.meta?.did||"",[s]),{locale:y}=o.useContext(re),v=D(()=>!H(r.meta)&&Object.values(r.meta).some(a=>a!=null),[r]),b=oe({activity:r,users:e.map(a=>a?.actorInfo),actors:e.map(a=>a?.activity?.actor),mountPoint:i}),k=O(a=>{if(!a.activity)return null;const x=se(a.activity);return x?.metaLink?ie(x?.metaLink)?x?.metaLink:G(i,x.metaLink):null}),C=O((a,x)=>{if(!x)return;const h=k(x);h&&(window.open(h,"_blank"),a.customPreventRedirect=!0)}),S=e.length>ee,w=e.slice(0,ee);return t.jsxs(g,{sx:{width:"100%"},children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:3},children:b}),v?t.jsxs(g,{className:"sub-content",sx:{display:"flex",flexDirection:"column",gap:3},children:[w.map(a=>t.jsxs(g,{onClick:x=>C(x,a),sx:{display:"flex",flexDirection:"column",gap:1},children:[t.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[V(a)?t.jsx(K,{actors:a.actorInfo,size:32,teamDid:p}):u,t.jsx(q,{variant:"subtitle1",sx:{color:"text.primary"},children:V(a)?a?.actorInfo?.fullName:"System"})," ","·",t.jsx(J,{value:a.createdAt,locale:y,shouldUpdate:!0,style:{color:m.palette.text.secondary,fontSize:"0.875rem",minWidth:"50px",whiteSpace:"nowrap"}})]}),a.activity.meta?t.jsx(g,{sx:{pl:5},children:t.jsx(ae,{meta:a.activity.meta,type:a.activity.type})}):null]},a.id)),S&&l?t.jsx(g,{sx:{mt:1,display:"flex",justifyContent:"center"},children:t.jsxs(ke,{size:"large",variant:"text",component:te,href:l,target:"_blank",rel:"noopener noreferrer",onClick:a=>{a.customPreventRedirect=!0},children:[d("notification.viewMore")," ",t.jsx(ne,{icon:Ee,style:{marginLeft:4}})]})}):null]}):null]})}function pe({notification:e,isMultiple:r=!1,blocklet:s,mountPoint:i="",avatarFallback:l}){const u=D(()=>{if(!e.activity)return null;const m=se(e.activity);return m?.targetLink?ie(m?.targetLink)?m?.targetLink:G(i,m.targetLink):null},[e.activity,i]);return r?t.jsx(he,{items:e.items,activity:e.activity,blocklet:s,mountPoint:i,viewMoreLink:u,avatarFallback:l}):t.jsx(ue,{notification:e,mountPoint:i})}function me({notification:e}){const r=o.useMemo(()=>{const{actions:s,action:i}=e;let l=s??[];return!l.length&&i&&(l=[{name:"Visit",link:i}]),l},[e]);return r.length?t.jsx(g,{sx:{display:"flex",justifyContent:"start",flexWrap:"wrap",alignItems:"center",gap:1},children:r.map((s,i)=>t.jsxs(o.Fragment,{children:[t.jsx(te,{href:s.link,target:"_blank",className:"link",rel:"noopener noreferrer",sx:{fontSize:"15px"},onClick:l=>{l.customPreventRedirect=!0},children:s.name},s.link),i<r.length-1?t.jsx(Ie,{orientation:"vertical",sx:{height:12,borderWidth:"1px"}}):null]},s.link))}):null}me.propTypes={notification:n.object.isRequired};const ot=Me(g)`
2
2
  display: flex;
3
3
  justify-content: center;
4
4
  align-items: center;
@@ -1 +1 @@
1
- import{j as o}from"./vendor-mui-core-B7zoO8f5.js";import"./vendor-react-Dvs43sk9.js";import{S as t}from"./studio-iYVCEWav.js";import"./vendor-ux-B7q8W4Pg.js";import"./vendor-utils-DtY42AM-.js";import"./vendor-hooks-BRXKH6Nb.js";import"./lottie-web-4koyQiv_.js";import"./index-wKz_l66R.js";import"./index-BF7bSwjJ.js";import"./vendor-arcblock-B7AoUs4o.js";function f(){return o.jsx(t,{children:"Coming soon..."})}export{f as default};
1
+ import{j as o}from"./vendor-mui-core-B7zoO8f5.js";import"./vendor-react-Dvs43sk9.js";import{S as t}from"./studio-Cx6j_6QU.js";import"./vendor-ux-B7q8W4Pg.js";import"./vendor-utils-DtY42AM-.js";import"./vendor-hooks-BRXKH6Nb.js";import"./lottie-web-4koyQiv_.js";import"./index-DzSOofQf.js";import"./index-CuQBOJqN.js";import"./vendor-arcblock-B7AoUs4o.js";function f(){return o.jsx(t,{children:"Coming soon..."})}export{f as default};
@@ -1,4 +1,4 @@
1
- import{at as _e,j as Y,W as te,J as Ge,bg as Ye,Q as Xe,ak as ue,a6 as ke,cN as Je,y as He,bb as Fe,M as We,cn as Ze,z as Qe}from"./vendor-mui-core-B7zoO8f5.js";import{u as et}from"./useLocalStorage-DqhgzGNT.js";import{p as Le,a as tt,d as it,g as Ue,r as ne}from"./vendor-react-Dvs43sk9.js";import{d as st,n as De}from"./vendor-utils-DtY42AM-.js";import{aC as rt,Z as Ne,ao as nt}from"./index-BF7bSwjJ.js";import{T as ot,D as Re,F as at,H as ht}from"./vendor-ux-B7q8W4Pg.js";import{B as lt}from"./bundle-avatar-CopjjSKq.js";import"./vendor-arcblock-B7AoUs4o.js";import"./vendor-hooks-BRXKH6Nb.js";import"./lottie-web-4koyQiv_.js";var we={exports:{}},Ae;function ct(){return Ae||(Ae=1,function(G,V){(function($,q){G.exports=q()})(globalThis,()=>(()=>{var $={4567:function(R,r,o){var c=this&&this.__decorate||function(e,s,a,f){var p,g=arguments.length,l=g<3?s:f===null?f=Object.getOwnPropertyDescriptor(s,a):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,s,a,f);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(l=(g<3?p(l):g>3?p(s,a,l):p(s,a))||l);return g>3&&l&&Object.defineProperty(s,a,l),l},_=this&&this.__param||function(e,s){return function(a,f){s(a,f,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const n=o(9042),d=o(9924),u=o(844),v=o(4725),h=o(2585),t=o(3656);let i=r.AccessibilityManager=class extends u.Disposable{constructor(e,s,a,f){super(),this._terminal=e,this._coreBrowserService=a,this._renderService=f,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let p=0;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);if(this._topBoundaryFocusListener=p=>this._handleBoundaryFocus(p,0),this._bottomBoundaryFocusListener=p=>this._handleBoundaryFocus(p,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new d.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(p=>this._handleResize(p.rows))),this.register(this._terminal.onRender(p=>this._refreshRows(p.start,p.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(p=>this._handleChar(p))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
1
+ import{at as _e,j as Y,W as te,J as Ge,bg as Ye,Q as Xe,ak as ue,a6 as ke,cN as Je,y as He,bb as Fe,M as We,cn as Ze,z as Qe}from"./vendor-mui-core-B7zoO8f5.js";import{u as et}from"./useLocalStorage-DqhgzGNT.js";import{p as Le,a as tt,d as it,g as Ue,r as ne}from"./vendor-react-Dvs43sk9.js";import{d as st,n as De}from"./vendor-utils-DtY42AM-.js";import{aC as rt,Z as Ne,ao as nt}from"./index-CuQBOJqN.js";import{T as ot,D as Re,F as at,H as ht}from"./vendor-ux-B7q8W4Pg.js";import{B as lt}from"./bundle-avatar-FLzOZWlh.js";import"./vendor-arcblock-B7AoUs4o.js";import"./vendor-hooks-BRXKH6Nb.js";import"./lottie-web-4koyQiv_.js";var we={exports:{}},Ae;function ct(){return Ae||(Ae=1,function(G,V){(function($,q){G.exports=q()})(globalThis,()=>(()=>{var $={4567:function(R,r,o){var c=this&&this.__decorate||function(e,s,a,f){var p,g=arguments.length,l=g<3?s:f===null?f=Object.getOwnPropertyDescriptor(s,a):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,s,a,f);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(l=(g<3?p(l):g>3?p(s,a,l):p(s,a))||l);return g>3&&l&&Object.defineProperty(s,a,l),l},_=this&&this.__param||function(e,s){return function(a,f){s(a,f,e)}};Object.defineProperty(r,"__esModule",{value:!0}),r.AccessibilityManager=void 0;const n=o(9042),d=o(9924),u=o(844),v=o(4725),h=o(2585),t=o(3656);let i=r.AccessibilityManager=class extends u.Disposable{constructor(e,s,a,f){super(),this._terminal=e,this._coreBrowserService=a,this._renderService=f,this._rowColumns=new WeakMap,this._liveRegionLineCount=0,this._charsToConsume=[],this._charsToAnnounce="",this._accessibilityContainer=this._coreBrowserService.mainDocument.createElement("div"),this._accessibilityContainer.classList.add("xterm-accessibility"),this._rowContainer=this._coreBrowserService.mainDocument.createElement("div"),this._rowContainer.setAttribute("role","list"),this._rowContainer.classList.add("xterm-accessibility-tree"),this._rowElements=[];for(let p=0;p<this._terminal.rows;p++)this._rowElements[p]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[p]);if(this._topBoundaryFocusListener=p=>this._handleBoundaryFocus(p,0),this._bottomBoundaryFocusListener=p=>this._handleBoundaryFocus(p,1),this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions(),this._accessibilityContainer.appendChild(this._rowContainer),this._liveRegion=this._coreBrowserService.mainDocument.createElement("div"),this._liveRegion.classList.add("live-region"),this._liveRegion.setAttribute("aria-live","assertive"),this._accessibilityContainer.appendChild(this._liveRegion),this._liveRegionDebouncer=this.register(new d.TimeBasedDebouncer(this._renderRows.bind(this))),!this._terminal.element)throw new Error("Cannot enable accessibility before Terminal.open");this._terminal.element.insertAdjacentElement("afterbegin",this._accessibilityContainer),this.register(this._terminal.onResize(p=>this._handleResize(p.rows))),this.register(this._terminal.onRender(p=>this._refreshRows(p.start,p.end))),this.register(this._terminal.onScroll(()=>this._refreshRows())),this.register(this._terminal.onA11yChar(p=>this._handleChar(p))),this.register(this._terminal.onLineFeed(()=>this._handleChar(`
2
2
  `))),this.register(this._terminal.onA11yTab(p=>this._handleTab(p))),this.register(this._terminal.onKey(p=>this._handleKey(p.key))),this.register(this._terminal.onBlur(()=>this._clearLiveRegion())),this.register(this._renderService.onDimensionsChange(()=>this._refreshRowsDimensions())),this.register((0,t.addDisposableDomListener)(document,"selectionchange",()=>this._handleSelectionChange())),this.register(this._coreBrowserService.onDprChange(()=>this._refreshRowsDimensions())),this._refreshRows(),this.register((0,u.toDisposable)(()=>{this._accessibilityContainer.remove(),this._rowElements.length=0}))}_handleTab(e){for(let s=0;s<e;s++)this._handleChar(" ")}_handleChar(e){this._liveRegionLineCount<21&&(this._charsToConsume.length>0?this._charsToConsume.shift()!==e&&(this._charsToAnnounce+=e):this._charsToAnnounce+=e,e===`
3
3
  `&&(this._liveRegionLineCount++,this._liveRegionLineCount===21&&(this._liveRegion.textContent+=n.tooMuchOutput)))}_clearLiveRegion(){this._liveRegion.textContent="",this._liveRegionLineCount=0}_handleKey(e){this._clearLiveRegion(),new RegExp("\\p{Control}","u").test(e)||this._charsToConsume.push(e)}_refreshRows(e,s){this._liveRegionDebouncer.refresh(e,s,this._terminal.rows)}_renderRows(e,s){const a=this._terminal.buffer,f=a.lines.length.toString();for(let p=e;p<=s;p++){const g=a.lines.get(a.ydisp+p),l=[],m=g?.translateToString(!0,void 0,void 0,l)||"",E=(a.ydisp+p+1).toString(),x=this._rowElements[p];x&&(m.length===0?(x.innerText=" ",this._rowColumns.set(x,[0,1])):(x.textContent=m,this._rowColumns.set(x,l)),x.setAttribute("aria-posinset",E),x.setAttribute("aria-setsize",f))}this._announceCharacters()}_announceCharacters(){this._charsToAnnounce.length!==0&&(this._liveRegion.textContent+=this._charsToAnnounce,this._charsToAnnounce="")}_handleBoundaryFocus(e,s){const a=e.target,f=this._rowElements[s===0?1:this._rowElements.length-2];if(a.getAttribute("aria-posinset")===(s===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==f)return;let p,g;if(s===0?(p=a,g=this._rowElements.pop(),this._rowContainer.removeChild(g)):(p=this._rowElements.shift(),g=a,this._rowContainer.removeChild(p)),p.removeEventListener("focus",this._topBoundaryFocusListener),g.removeEventListener("focus",this._bottomBoundaryFocusListener),s===0){const l=this._createAccessibilityTreeNode();this._rowElements.unshift(l),this._rowContainer.insertAdjacentElement("afterbegin",l)}else{const l=this._createAccessibilityTreeNode();this._rowElements.push(l),this._rowContainer.appendChild(l)}this._rowElements[0].addEventListener("focus",this._topBoundaryFocusListener),this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._terminal.scrollLines(s===0?-1:1),this._rowElements[s===0?1:this._rowElements.length-2].focus(),e.preventDefault(),e.stopImmediatePropagation()}_handleSelectionChange(){if(this._rowElements.length===0)return;const e=document.getSelection();if(!e)return;if(e.isCollapsed)return void(this._rowContainer.contains(e.anchorNode)&&this._terminal.clearSelection());if(!e.anchorNode||!e.focusNode)return void console.error("anchorNode and/or focusNode are null");let s={node:e.anchorNode,offset:e.anchorOffset},a={node:e.focusNode,offset:e.focusOffset};if((s.node.compareDocumentPosition(a.node)&Node.DOCUMENT_POSITION_PRECEDING||s.node===a.node&&s.offset>a.offset)&&([s,a]=[a,s]),s.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(s={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(s.node))return;const f=this._rowElements.slice(-1)[0];if(a.node.compareDocumentPosition(f)&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_PRECEDING)&&(a={node:f,offset:f.textContent?.length??0}),!this._rowContainer.contains(a.node))return;const p=({node:m,offset:E})=>{const x=m instanceof Text?m.parentNode:m;let L=parseInt(x?.getAttribute("aria-posinset"),10)-1;if(isNaN(L))return console.warn("row is invalid. Race condition?"),null;const b=this._rowColumns.get(x);if(!b)return console.warn("columns is null. Race condition?"),null;let A=E<b.length?b[E]:b.slice(-1)[0]+1;return A>=this._terminal.cols&&(++L,A=0),{row:L,column:A}},g=p(s),l=p(a);if(g&&l){if(g.row>l.row||g.row===l.row&&g.column>=l.column)throw new Error("invalid range");this._terminal.select(g.column,g.row,(l.row-g.row)*this._terminal.cols-g.column+l.column)}}_handleResize(e){this._rowElements[this._rowElements.length-1].removeEventListener("focus",this._bottomBoundaryFocusListener);for(let s=this._rowContainer.children.length;s<this._terminal.rows;s++)this._rowElements[s]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[s]);for(;this._rowElements.length>e;)this._rowContainer.removeChild(this._rowElements.pop());this._rowElements[this._rowElements.length-1].addEventListener("focus",this._bottomBoundaryFocusListener),this._refreshRowsDimensions()}_createAccessibilityTreeNode(){const e=this._coreBrowserService.mainDocument.createElement("div");return e.setAttribute("role","listitem"),e.tabIndex=-1,this._refreshRowDimensions(e),e}_refreshRowsDimensions(){if(this._renderService.dimensions.css.cell.height){this._accessibilityContainer.style.width=`${this._renderService.dimensions.css.canvas.width}px`,this._rowElements.length!==this._terminal.rows&&this._handleResize(this._terminal.rows);for(let e=0;e<this._terminal.rows;e++)this._refreshRowDimensions(this._rowElements[e])}}_refreshRowDimensions(e){e.style.height=`${this._renderService.dimensions.css.cell.height}px`}};r.AccessibilityManager=i=c([_(1,h.IInstantiationService),_(2,v.ICoreBrowserService),_(3,v.IRenderService)],i)},3614:(R,r)=>{function o(d){return d.replace(/\r?\n/g,"\r")}function c(d,u){return u?"\x1B[200~"+d+"\x1B[201~":d}function _(d,u,v,h){d=c(d=o(d),v.decPrivateModes.bracketedPasteMode&&h.rawOptions.ignoreBracketedPasteMode!==!0),v.triggerDataEvent(d,!0),u.value=""}function n(d,u,v){const h=v.getBoundingClientRect(),t=d.clientX-h.left-10,i=d.clientY-h.top-10;u.style.width="20px",u.style.height="20px",u.style.left=`${t}px`,u.style.top=`${i}px`,u.style.zIndex="1000",u.focus()}Object.defineProperty(r,"__esModule",{value:!0}),r.rightClickHandler=r.moveTextAreaUnderMouseCursor=r.paste=r.handlePasteEvent=r.copyHandler=r.bracketTextForPaste=r.prepareTextForTerminal=void 0,r.prepareTextForTerminal=o,r.bracketTextForPaste=c,r.copyHandler=function(d,u){d.clipboardData&&d.clipboardData.setData("text/plain",u.selectionText),d.preventDefault()},r.handlePasteEvent=function(d,u,v,h){d.stopPropagation(),d.clipboardData&&_(d.clipboardData.getData("text/plain"),u,v,h)},r.paste=_,r.moveTextAreaUnderMouseCursor=n,r.rightClickHandler=function(d,u,v,h,t){n(d,u,v),t&&h.rightClickSelect(d),u.value=h.selectionText,u.select()}},7239:(R,r,o)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.ColorContrastCache=void 0;const c=o(1505);r.ColorContrastCache=class{constructor(){this._color=new c.TwoKeyMap,this._css=new c.TwoKeyMap}setCss(_,n,d){this._css.set(_,n,d)}getCss(_,n){return this._css.get(_,n)}setColor(_,n,d){this._color.set(_,n,d)}getColor(_,n){return this._color.get(_,n)}clear(){this._color.clear(),this._css.clear()}}},3656:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.addDisposableDomListener=void 0,r.addDisposableDomListener=function(o,c,_,n){o.addEventListener(c,_,n);let d=!1;return{dispose:()=>{d||(d=!0,o.removeEventListener(c,_,n))}}}},3551:function(R,r,o){var c=this&&this.__decorate||function(i,e,s,a){var f,p=arguments.length,g=p<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,s):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(i,e,s,a);else for(var l=i.length-1;l>=0;l--)(f=i[l])&&(g=(p<3?f(g):p>3?f(e,s,g):f(e,s))||g);return p>3&&g&&Object.defineProperty(e,s,g),g},_=this&&this.__param||function(i,e){return function(s,a){e(s,a,i)}};Object.defineProperty(r,"__esModule",{value:!0}),r.Linkifier=void 0;const n=o(3656),d=o(8460),u=o(844),v=o(2585),h=o(4725);let t=r.Linkifier=class extends u.Disposable{get currentLink(){return this._currentLink}constructor(i,e,s,a,f){super(),this._element=i,this._mouseService=e,this._renderService=s,this._bufferService=a,this._linkProviderService=f,this._linkCacheDisposables=[],this._isMouseOut=!0,this._wasResized=!1,this._activeLine=-1,this._onShowLinkUnderline=this.register(new d.EventEmitter),this.onShowLinkUnderline=this._onShowLinkUnderline.event,this._onHideLinkUnderline=this.register(new d.EventEmitter),this.onHideLinkUnderline=this._onHideLinkUnderline.event,this.register((0,u.getDisposeArrayDisposable)(this._linkCacheDisposables)),this.register((0,u.toDisposable)(()=>{this._lastMouseEvent=void 0,this._activeProviderReplies?.clear()})),this.register(this._bufferService.onResize(()=>{this._clearCurrentLink(),this._wasResized=!0})),this.register((0,n.addDisposableDomListener)(this._element,"mouseleave",()=>{this._isMouseOut=!0,this._clearCurrentLink()})),this.register((0,n.addDisposableDomListener)(this._element,"mousemove",this._handleMouseMove.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mousedown",this._handleMouseDown.bind(this))),this.register((0,n.addDisposableDomListener)(this._element,"mouseup",this._handleMouseUp.bind(this)))}_handleMouseMove(i){this._lastMouseEvent=i;const e=this._positionFromMouseEvent(i,this._element,this._mouseService);if(!e)return;this._isMouseOut=!1;const s=i.composedPath();for(let a=0;a<s.length;a++){const f=s[a];if(f.classList.contains("xterm"))break;if(f.classList.contains("xterm-hover"))return}this._lastBufferCell&&e.x===this._lastBufferCell.x&&e.y===this._lastBufferCell.y||(this._handleHover(e),this._lastBufferCell=e)}_handleHover(i){if(this._activeLine!==i.y||this._wasResized)return this._clearCurrentLink(),this._askForLink(i,!1),void(this._wasResized=!1);this._currentLink&&this._linkAtPosition(this._currentLink.link,i)||(this._clearCurrentLink(),this._askForLink(i,!0))}_askForLink(i,e){this._activeProviderReplies&&e||(this._activeProviderReplies?.forEach(a=>{a?.forEach(f=>{f.link.dispose&&f.link.dispose()})}),this._activeProviderReplies=new Map,this._activeLine=i.y);let s=!1;for(const[a,f]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(a)&&(s=this._checkLinkProviderResult(a,i,s)):f.provideLinks(i.y,p=>{if(this._isMouseOut)return;const g=p?.map(l=>({link:l}));this._activeProviderReplies?.set(a,g),s=this._checkLinkProviderResult(a,i,s),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(i.y,this._activeProviderReplies)})}_removeIntersectingLinks(i,e){const s=new Set;for(let a=0;a<e.size;a++){const f=e.get(a);if(f)for(let p=0;p<f.length;p++){const g=f[p],l=g.link.range.start.y<i?0:g.link.range.start.x,m=g.link.range.end.y>i?this._bufferService.cols:g.link.range.end.x;for(let E=l;E<=m;E++){if(s.has(E)){f.splice(p--,1);break}s.add(E)}}}}_checkLinkProviderResult(i,e,s){if(!this._activeProviderReplies)return s;const a=this._activeProviderReplies.get(i);let f=!1;for(let p=0;p<i;p++)this._activeProviderReplies.has(p)&&!this._activeProviderReplies.get(p)||(f=!0);if(!f&&a){const p=a.find(g=>this._linkAtPosition(g.link,e));p&&(s=!0,this._handleNewLink(p))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!s)for(let p=0;p<this._activeProviderReplies.size;p++){const g=this._activeProviderReplies.get(p)?.find(l=>this._linkAtPosition(l.link,e));if(g){s=!0,this._handleNewLink(g);break}}return s}_handleMouseDown(){this._mouseDownLink=this._currentLink}_handleMouseUp(i){if(!this._currentLink)return;const e=this._positionFromMouseEvent(i,this._element,this._mouseService);e&&this._mouseDownLink===this._currentLink&&this._linkAtPosition(this._currentLink.link,e)&&this._currentLink.link.activate(i,this._currentLink.link.text)}_clearCurrentLink(i,e){this._currentLink&&this._lastMouseEvent&&(!i||!e||this._currentLink.link.range.start.y>=i&&this._currentLink.link.range.end.y<=e)&&(this._linkLeave(this._element,this._currentLink.link,this._lastMouseEvent),this._currentLink=void 0,(0,u.disposeArray)(this._linkCacheDisposables))}_handleNewLink(i){if(!this._lastMouseEvent)return;const e=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);e&&this._linkAtPosition(i.link,e)&&(this._currentLink=i,this._currentLink.state={decorations:{underline:i.link.decorations===void 0||i.link.decorations.underline,pointerCursor:i.link.decorations===void 0||i.link.decorations.pointerCursor},isHovered:!0},this._linkHover(this._element,i.link,this._lastMouseEvent),i.link.decorations={},Object.defineProperties(i.link.decorations,{pointerCursor:{get:()=>this._currentLink?.state?.decorations.pointerCursor,set:s=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==s&&(this._currentLink.state.decorations.pointerCursor=s,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",s))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:s=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==s&&(this._currentLink.state.decorations.underline=s,this._currentLink.state.isHovered&&this._fireUnderlineEvent(i.link,s))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(s=>{if(!this._currentLink)return;const a=s.start===0?0:s.start+1+this._bufferService.buffer.ydisp,f=this._bufferService.buffer.ydisp+1+s.end;if(this._currentLink.link.range.start.y>=a&&this._currentLink.link.range.end.y<=f&&(this._clearCurrentLink(a,f),this._lastMouseEvent)){const p=this._positionFromMouseEvent(this._lastMouseEvent,this._element,this._mouseService);p&&this._askForLink(p,!1)}})))}_linkHover(i,e,s){this._currentLink?.state&&(this._currentLink.state.isHovered=!0,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!0),this._currentLink.state.decorations.pointerCursor&&i.classList.add("xterm-cursor-pointer")),e.hover&&e.hover(s,e.text)}_fireUnderlineEvent(i,e){const s=i.range,a=this._bufferService.buffer.ydisp,f=this._createLinkUnderlineEvent(s.start.x-1,s.start.y-a-1,s.end.x,s.end.y-a-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(f)}_linkLeave(i,e,s){this._currentLink?.state&&(this._currentLink.state.isHovered=!1,this._currentLink.state.decorations.underline&&this._fireUnderlineEvent(e,!1),this._currentLink.state.decorations.pointerCursor&&i.classList.remove("xterm-cursor-pointer")),e.leave&&e.leave(s,e.text)}_linkAtPosition(i,e){const s=i.range.start.y*this._bufferService.cols+i.range.start.x,a=i.range.end.y*this._bufferService.cols+i.range.end.x,f=e.y*this._bufferService.cols+e.x;return s<=f&&f<=a}_positionFromMouseEvent(i,e,s){const a=s.getCoords(i,e,this._bufferService.cols,this._bufferService.rows);if(a)return{x:a[0],y:a[1]+this._bufferService.buffer.ydisp}}_createLinkUnderlineEvent(i,e,s,a,f){return{x1:i,y1:e,x2:s,y2:a,cols:this._bufferService.cols,fg:f}}};r.Linkifier=t=c([_(1,h.IMouseService),_(2,h.IRenderService),_(3,v.IBufferService),_(4,h.ILinkProviderService)],t)},9042:(R,r)=>{Object.defineProperty(r,"__esModule",{value:!0}),r.tooMuchOutput=r.promptLabel=void 0,r.promptLabel="Terminal input",r.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(R,r,o){var c=this&&this.__decorate||function(h,t,i,e){var s,a=arguments.length,f=a<3?t:e===null?e=Object.getOwnPropertyDescriptor(t,i):e;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")f=Reflect.decorate(h,t,i,e);else for(var p=h.length-1;p>=0;p--)(s=h[p])&&(f=(a<3?s(f):a>3?s(t,i,f):s(t,i))||f);return a>3&&f&&Object.defineProperty(t,i,f),f},_=this&&this.__param||function(h,t){return function(i,e){t(i,e,h)}};Object.defineProperty(r,"__esModule",{value:!0}),r.OscLinkProvider=void 0;const n=o(511),d=o(2585);let u=r.OscLinkProvider=class{constructor(h,t,i){this._bufferService=h,this._optionsService=t,this._oscLinkService=i}provideLinks(h,t){const i=this._bufferService.buffer.lines.get(h-1);if(!i)return void t(void 0);const e=[],s=this._optionsService.rawOptions.linkHandler,a=new n.CellData,f=i.getTrimmedLength();let p=-1,g=-1,l=!1;for(let m=0;m<f;m++)if(g!==-1||i.hasContent(m)){if(i.loadCell(m,a),a.hasExtendedAttrs()&&a.extended.urlId){if(g===-1){g=m,p=a.extended.urlId;continue}l=a.extended.urlId!==p}else g!==-1&&(l=!0);if(l||g!==-1&&m===f-1){const E=this._oscLinkService.getLinkData(p)?.uri;if(E){const x={start:{x:g+1,y:h},end:{x:m+(l||m!==f-1?0:1),y:h}};let L=!1;if(!s?.allowNonHttpProtocols)try{const b=new URL(E);["http:","https:"].includes(b.protocol)||(L=!0)}catch{L=!0}L||e.push({text:E,range:x,activate:(b,A)=>s?s.activate(b,A,x):v(0,A),hover:(b,A)=>s?.hover?.(b,A,x),leave:(b,A)=>s?.leave?.(b,A,x)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(g=m,p=a.extended.urlId):(g=-1,p=-1)}}t(e)}};function v(h,t){if(confirm(`Do you want to navigate to ${t}?
4
4
 
@@ -1 +1 @@
1
- import{j as e,ak as p,T as I,W as c,am as Q,Q as F,bG as de,a6 as pe}from"./vendor-mui-core-B7zoO8f5.js";import{f as fe,a as ue,b as ge,h as me}from"./vendor-hooks-BRXKH6Nb.js";import{r as J,i as he}from"./vendor-react-Dvs43sk9.js";import{a as we,a4 as xe,T as ye,c as L,ap as Pe,H as O,s as ke,b as ve,aq as $,ar as je,as as be}from"./index-BF7bSwjJ.js";import{C as W,b as _,J as Ie,c as Te}from"./vendor-utils-DtY42AM-.js";import{o as Ce}from"./vendor-arcblock-B7AoUs4o.js";import{$ as Le,J as _e,T as X,Z as B,I as Re,a0 as We,a1 as Ae,H as M,B as Ee,a2 as z}from"./vendor-ux-B7q8W4Pg.js";import{u as Ne}from"./use-passport-id-B-b-_oYF.js";import{g as V}from"./get-safe-url-BNFAIq84.js";import{d as R}from"./logger-yrkSQn8c.js";import"./lottie-web-4koyQiv_.js";function G({blocklet:a=window.blocklet}){return e.jsxs(p,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(Le,{variant:"rounded",shape:"square",did:a.appPid,src:a.appLogo,size:80}),e.jsx(I,{component:"h2",variant:"h6",children:a.appName}),e.jsx(_e,{did:a.appPid})]})}const Se=J.memo(G);G.propTypes={blocklet:c.shape({appName:c.string,appLogo:c.string,appPid:c.string})};const Ue=()=>window.blocklet?.componentMountPoints?.find(s=>s.did==="z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk")?.mountPoint;function Z({children:a=null,cta:s=null,...i}){return e.jsxs(p,{...i,children:[a?e.jsx(p,{sx:{maxHeight:"50vh",overflow:"hidden",position:"relative",":after":{content:'""',position:"absolute",left:0,right:0,bottom:0,height:"80%",background:"linear-gradient(transparent, #fff 85%)"}},children:a}):null,s?e.jsx(p,{sx:{display:"flex",flexDirection:"column",alignItems:"center",py:4,borderRadius:2},children:s}):null]})}Z.propTypes={children:c.node,cta:c.node};function Y({passports:a=[],onConnect:s=()=>{},redirect:i,...y}){const{t:f}=X(),P=Ue(),k=l=>{const g=l?.payable;return P&&g?W(P,`/api/redirect/checkout/${g}?redirect=${i}`):null};return e.jsxs(p,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,minHeight:"100vh",maxWidth:"400px",margin:"auto",paddingBottom:{sx:0,md:15}},children:[e.jsx(Se,{}),e.jsx(Z,{...y,cta:e.jsxs(e.Fragment,{children:[e.jsx(I,{variant:"h4",sx:{mx:2,textAlign:"center",fontWeight:"bold",color:"warning.main"},children:f("login.accessLimit.title")}),e.jsx(I,{variant:"body1",sx:{maxWidth:620,mt:2,mx:2,textAlign:"center",color:"gray"},children:f("login.accessLimit.description")}),e.jsx(p,{sx:{display:"flex",flexWrap:"wrap",justifyContent:"center",gap:1,mt:5},children:a?.map(l=>{const g=k(l);return g?e.jsx(Q,{title:f("login.accessLimit.buyPassport"),arrow:!0,placement:"top",children:e.jsx(F,{color:"primary",variant:"contained",endIcon:e.jsx(de,{}),href:g,target:"_blank",children:l.title||l.name})},l.name):e.jsx(Q,{title:f("login.connectWithPassport"),arrow:!0,placement:"top",children:e.jsx(F,{color:"inherit",variant:"contained",onClick:s,children:l.title||l.name})},l.name)})}),e.jsxs(I,{variant:"body1",sx:{mt:2,color:"grey.400"},children:[e.jsx(p,{component:"span",sx:{display:"inline-block",mr:1},children:f("login.accessLimit.alreadyHavePassport")}),e.jsx(p,{component:"span",sx:{textDecoration:"underline",cursor:"pointer",color:"primary.main"},onClick:s,children:f("common.connect")})]})]})})]})}Y.propTypes={passports:c.arrayOf(c.shape({name:c.string.isRequired,title:c.string,payable:c.string})),onConnect:c.func,onClose:c.func,redirect:c.string.isRequired};function Ve(){const a=J.useRef(null),{session:s}=we(),{t:i,locale:y}=X(),{getPassportId:f}=Ne(),P=he(),k=B(),l=Re(),{encryptKey:g,decrypt:ee}=xe(),v=fe(s),{searchParams:o}=new URL(window.location.href),m={passportId:f()},A=o.get("componentId"),E=o.get("authenticated"),ne=o.get("sessionToken"),te=o.get("refreshToken"),oe=o.get("requiredRoles"),u=o.get("redirect"),d=o.get("forceConnected"),j=o.get("sourceAppPid"),T=o.get("origin"),N=o.get("autoConnectWebview"),S=o.get("popup"),U=o.get("showQuickConnect");let h=o.get("inviter");if(!h&&u)try{h=(u.startsWith("http")?new URL(u):new URL(u,window.location.origin)).searchParams.get("inviter")}catch{}h=h||localStorage.getItem("inviter"),A&&(m.componentId=A),k&&(m.visitorId=k),h&&(m.inviter=h),Te(j)||(j==="null"?m.sourceAppPid=null:j!==null&&(m.sourceAppPid=j));let D=[];try{D=JSON.parse(oe)}catch{}const ie=async n=>{const t=o.get("fromWallet");R("login page notifyWallet",{data:n,fromWallet:t,"browser.wallet":l.wallet}),n&&String(t)==="1"&&l.wallet&&await Promise.any([z.asyncCall("arcSetToken",n),$(3e3)])},C=n=>o.get("encrypted")?ee(n):n,q=async n=>{n&&await ie(n),setTimeout(()=>{if(u){const t=decodeURIComponent(u);t.startsWith(L.WELLKNOWN_SERVICE_PATH_PREFIX)?P(t,{replace:!0}):window.location.replace(V(t))}else window.location.replace(window.env.pathPrefix||"/")},50)},se=n=>{const t={did:n.user.did,host:window.location.host,appPid:window.blocklet.appPid,visitorId:B(),sourceAppPid:n.user.sourceAppPid,fullName:n.user.fullName};R("bridge callArc: onLogin",t),z.callArc("onLogin",t)},H=async(n,t)=>{const w=t(n.sessionToken),b=t(n.refreshToken),x=t(n.visitorId);R("login page onLogin",{result:n,decodeSessionToken:w,decodeRefreshToken:b,decodeVisitorId:x}),ke(w),ve(b),n.visitorId&&Ee(x),await s.refresh(),await $(100),se(v.current);const r={};o.get("saveConnect")?(r.connected_did=v.current.user.did,r.connected_pk=v.current.user.pk,r.connected_wallet_os=v.current.walletOS,r.connected_app=je()):(r.connected_did=o.get("connected_did"),r.connected_pk=o.get("connected_pk"),r.connected_app=o.get("connected_app"),r.connected_wallet_os=o.get("connected_wallet_os")),be(r,!0),q({sessionToken:w,refreshToken:b,visitorId:x})},re=ue(()=>T==="switch-did"?d&&typeof d=="string"?{title:i("login.switchSpecifiedDid.title"),scan:i("login.switchSpecifiedDid.scan",{did:d}),confirm:i("login.switchSpecifiedDid.confirm"),success:i("login.switchSpecifiedDid.success")}:{title:i("login.switchDid.title"),scan:i("login.switchDid.scan"),confirm:i("login.switchDid.confirm"),success:i("login.switchDid.success")}:{title:i("login.connect.title"),scan:i("login.connect.scan"),confirm:i("login.connect.confirm"),success:i("login.connect.success")},[d,T,i]),K=ge(()=>{const n=window?.blocklet,t={className:"connect",popup:!1,action:"login",passkeyBehavior:"both",onSuccess:H,onError:ce,locale:y,messages:re,extraParams:m,baseUrl:window.location.origin,prefix:W(window.location.origin,L.WELLKNOWN_SERVICE_PATH_PREFIX,ye)};d&&(t.forceConnected=d,t.extraParams.enableSwitchApp=!1,t.extraParams.forceConnected=d),t.options||(t.options={}),T==="switch-did"?t.options.showQuickConnect=!0:_(U)||([!1,"false"].includes(U)?t.options.showQuickConnect=!1:t.options.showQuickConnect=!0);const w=We();Ae()&&(t.extraParams.sourceAppPid=w.appPid);const x=W(window.location.origin,L.WELLKNOWN_SERVICE_PATH_PREFIX,"connect"),r={params:Pe(encodeURIComponent(JSON.stringify(t))),appPid:n?.appPid,appName:n?.appName,locale:y,redirect:window.location.href,_ek_:g};_(N)||(r.autoConnectWebview=N),_(S)||(r.popup=S),r.disableClose=!0;const le=V(Ie(x,r),{allowDomains:null});window.location.href=le});me(()=>{if(o.get("sessionToken")){const n=o.get("visitorId");if(!n){M.error("Unexpected login response from server: visitorId is required");return}H({sessionToken:C(ne),refreshToken:C(te),visitorId:C(n)},t=>t)}else!s.user||d&&s.user.did!==d?K():!E&&!o.get("sessionToken")&&q()});const ce=n=>{M.error(n.message)},ae=o.has("popup");if(s.loading||s.user){if(!E||o.get("sessionToken"))return e.jsxs(e.Fragment,{children:[e.jsx(O,{children:e.jsx("title",{children:i("pageTitle.login")})}),e.jsx(Ce,{children:ae?null:e.jsx(pe,{})})]});const n=u?new URL(u,window.location.origin).href:window.location.href;return e.jsx(Y,{onConnect:K,passports:D,redirect:n})}return e.jsxs(e.Fragment,{children:[e.jsx(O,{children:e.jsx("title",{children:i("pageTitle.login")})}),e.jsx(p,{sx:{"box-sizing":"border-box",width:"100%",height:"100vh",position:"relative",display:"flex","flex-direction":"column",".connect":{background:"#fafafa"}},ref:a})]})}export{Ve as default};
1
+ import{j as e,ak as p,T as I,W as c,am as Q,Q as F,bG as de,a6 as pe}from"./vendor-mui-core-B7zoO8f5.js";import{f as fe,a as ue,b as ge,h as me}from"./vendor-hooks-BRXKH6Nb.js";import{r as J,i as he}from"./vendor-react-Dvs43sk9.js";import{a as we,a4 as xe,T as ye,c as L,ap as Pe,H as O,s as ke,b as ve,aq as $,ar as je,as as be}from"./index-CuQBOJqN.js";import{C as W,b as _,J as Ie,c as Te}from"./vendor-utils-DtY42AM-.js";import{o as Ce}from"./vendor-arcblock-B7AoUs4o.js";import{$ as Le,J as _e,T as X,Z as B,I as Re,a0 as We,a1 as Ae,H as M,B as Ee,a2 as z}from"./vendor-ux-B7q8W4Pg.js";import{u as Ne}from"./use-passport-id-B-b-_oYF.js";import{g as V}from"./get-safe-url-Bpq2IOGY.js";import{d as R}from"./logger-yrkSQn8c.js";import"./lottie-web-4koyQiv_.js";function G({blocklet:a=window.blocklet}){return e.jsxs(p,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"space-between"},children:[e.jsx(Le,{variant:"rounded",shape:"square",did:a.appPid,src:a.appLogo,size:80}),e.jsx(I,{component:"h2",variant:"h6",children:a.appName}),e.jsx(_e,{did:a.appPid})]})}const Se=J.memo(G);G.propTypes={blocklet:c.shape({appName:c.string,appLogo:c.string,appPid:c.string})};const Ue=()=>window.blocklet?.componentMountPoints?.find(s=>s.did==="z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk")?.mountPoint;function Z({children:a=null,cta:s=null,...i}){return e.jsxs(p,{...i,children:[a?e.jsx(p,{sx:{maxHeight:"50vh",overflow:"hidden",position:"relative",":after":{content:'""',position:"absolute",left:0,right:0,bottom:0,height:"80%",background:"linear-gradient(transparent, #fff 85%)"}},children:a}):null,s?e.jsx(p,{sx:{display:"flex",flexDirection:"column",alignItems:"center",py:4,borderRadius:2},children:s}):null]})}Z.propTypes={children:c.node,cta:c.node};function Y({passports:a=[],onConnect:s=()=>{},redirect:i,...y}){const{t:f}=X(),P=Ue(),k=l=>{const g=l?.payable;return P&&g?W(P,`/api/redirect/checkout/${g}?redirect=${i}`):null};return e.jsxs(p,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,minHeight:"100vh",maxWidth:"400px",margin:"auto",paddingBottom:{sx:0,md:15}},children:[e.jsx(Se,{}),e.jsx(Z,{...y,cta:e.jsxs(e.Fragment,{children:[e.jsx(I,{variant:"h4",sx:{mx:2,textAlign:"center",fontWeight:"bold",color:"warning.main"},children:f("login.accessLimit.title")}),e.jsx(I,{variant:"body1",sx:{maxWidth:620,mt:2,mx:2,textAlign:"center",color:"gray"},children:f("login.accessLimit.description")}),e.jsx(p,{sx:{display:"flex",flexWrap:"wrap",justifyContent:"center",gap:1,mt:5},children:a?.map(l=>{const g=k(l);return g?e.jsx(Q,{title:f("login.accessLimit.buyPassport"),arrow:!0,placement:"top",children:e.jsx(F,{color:"primary",variant:"contained",endIcon:e.jsx(de,{}),href:g,target:"_blank",children:l.title||l.name})},l.name):e.jsx(Q,{title:f("login.connectWithPassport"),arrow:!0,placement:"top",children:e.jsx(F,{color:"inherit",variant:"contained",onClick:s,children:l.title||l.name})},l.name)})}),e.jsxs(I,{variant:"body1",sx:{mt:2,color:"grey.400"},children:[e.jsx(p,{component:"span",sx:{display:"inline-block",mr:1},children:f("login.accessLimit.alreadyHavePassport")}),e.jsx(p,{component:"span",sx:{textDecoration:"underline",cursor:"pointer",color:"primary.main"},onClick:s,children:f("common.connect")})]})]})})]})}Y.propTypes={passports:c.arrayOf(c.shape({name:c.string.isRequired,title:c.string,payable:c.string})),onConnect:c.func,onClose:c.func,redirect:c.string.isRequired};function Ve(){const a=J.useRef(null),{session:s}=we(),{t:i,locale:y}=X(),{getPassportId:f}=Ne(),P=he(),k=B(),l=Re(),{encryptKey:g,decrypt:ee}=xe(),v=fe(s),{searchParams:o}=new URL(window.location.href),m={passportId:f()},A=o.get("componentId"),E=o.get("authenticated"),ne=o.get("sessionToken"),te=o.get("refreshToken"),oe=o.get("requiredRoles"),u=o.get("redirect"),d=o.get("forceConnected"),j=o.get("sourceAppPid"),T=o.get("origin"),N=o.get("autoConnectWebview"),S=o.get("popup"),U=o.get("showQuickConnect");let h=o.get("inviter");if(!h&&u)try{h=(u.startsWith("http")?new URL(u):new URL(u,window.location.origin)).searchParams.get("inviter")}catch{}h=h||localStorage.getItem("inviter"),A&&(m.componentId=A),k&&(m.visitorId=k),h&&(m.inviter=h),Te(j)||(j==="null"?m.sourceAppPid=null:j!==null&&(m.sourceAppPid=j));let D=[];try{D=JSON.parse(oe)}catch{}const ie=async n=>{const t=o.get("fromWallet");R("login page notifyWallet",{data:n,fromWallet:t,"browser.wallet":l.wallet}),n&&String(t)==="1"&&l.wallet&&await Promise.any([z.asyncCall("arcSetToken",n),$(3e3)])},C=n=>o.get("encrypted")?ee(n):n,q=async n=>{n&&await ie(n),setTimeout(()=>{if(u){const t=decodeURIComponent(u);t.startsWith(L.WELLKNOWN_SERVICE_PATH_PREFIX)?P(t,{replace:!0}):window.location.replace(V(t))}else window.location.replace(window.env.pathPrefix||"/")},50)},se=n=>{const t={did:n.user.did,host:window.location.host,appPid:window.blocklet.appPid,visitorId:B(),sourceAppPid:n.user.sourceAppPid,fullName:n.user.fullName};R("bridge callArc: onLogin",t),z.callArc("onLogin",t)},H=async(n,t)=>{const w=t(n.sessionToken),b=t(n.refreshToken),x=t(n.visitorId);R("login page onLogin",{result:n,decodeSessionToken:w,decodeRefreshToken:b,decodeVisitorId:x}),ke(w),ve(b),n.visitorId&&Ee(x),await s.refresh(),await $(100),se(v.current);const r={};o.get("saveConnect")?(r.connected_did=v.current.user.did,r.connected_pk=v.current.user.pk,r.connected_wallet_os=v.current.walletOS,r.connected_app=je()):(r.connected_did=o.get("connected_did"),r.connected_pk=o.get("connected_pk"),r.connected_app=o.get("connected_app"),r.connected_wallet_os=o.get("connected_wallet_os")),be(r,!0),q({sessionToken:w,refreshToken:b,visitorId:x})},re=ue(()=>T==="switch-did"?d&&typeof d=="string"?{title:i("login.switchSpecifiedDid.title"),scan:i("login.switchSpecifiedDid.scan",{did:d}),confirm:i("login.switchSpecifiedDid.confirm"),success:i("login.switchSpecifiedDid.success")}:{title:i("login.switchDid.title"),scan:i("login.switchDid.scan"),confirm:i("login.switchDid.confirm"),success:i("login.switchDid.success")}:{title:i("login.connect.title"),scan:i("login.connect.scan"),confirm:i("login.connect.confirm"),success:i("login.connect.success")},[d,T,i]),K=ge(()=>{const n=window?.blocklet,t={className:"connect",popup:!1,action:"login",passkeyBehavior:"both",onSuccess:H,onError:ce,locale:y,messages:re,extraParams:m,baseUrl:window.location.origin,prefix:W(window.location.origin,L.WELLKNOWN_SERVICE_PATH_PREFIX,ye)};d&&(t.forceConnected=d,t.extraParams.enableSwitchApp=!1,t.extraParams.forceConnected=d),t.options||(t.options={}),T==="switch-did"?t.options.showQuickConnect=!0:_(U)||([!1,"false"].includes(U)?t.options.showQuickConnect=!1:t.options.showQuickConnect=!0);const w=We();Ae()&&(t.extraParams.sourceAppPid=w.appPid);const x=W(window.location.origin,L.WELLKNOWN_SERVICE_PATH_PREFIX,"connect"),r={params:Pe(encodeURIComponent(JSON.stringify(t))),appPid:n?.appPid,appName:n?.appName,locale:y,redirect:window.location.href,_ek_:g};_(N)||(r.autoConnectWebview=N),_(S)||(r.popup=S),r.disableClose=!0;const le=V(Ie(x,r),{allowDomains:null});window.location.href=le});me(()=>{if(o.get("sessionToken")){const n=o.get("visitorId");if(!n){M.error("Unexpected login response from server: visitorId is required");return}H({sessionToken:C(ne),refreshToken:C(te),visitorId:C(n)},t=>t)}else!s.user||d&&s.user.did!==d?K():!E&&!o.get("sessionToken")&&q()});const ce=n=>{M.error(n.message)},ae=o.has("popup");if(s.loading||s.user){if(!E||o.get("sessionToken"))return e.jsxs(e.Fragment,{children:[e.jsx(O,{children:e.jsx("title",{children:i("pageTitle.login")})}),e.jsx(Ce,{children:ae?null:e.jsx(pe,{})})]});const n=u?new URL(u,window.location.origin).href:window.location.href;return e.jsx(Y,{onConnect:K,passports:D,redirect:n})}return e.jsxs(e.Fragment,{children:[e.jsx(O,{children:e.jsx("title",{children:i("pageTitle.login")})}),e.jsx(p,{sx:{"box-sizing":"border-box",width:"100%",height:"100vh",position:"relative",display:"flex","flex-direction":"column",".connect":{background:"#fafafa"}},ref:a})]})}export{Ve as default};
@@ -1 +1 @@
1
- import{j as e,av as d,ak as r,T as m,aX as p,Q as u}from"./vendor-mui-core-B7zoO8f5.js";import{g as x,j as f,h}from"./vendor-hooks-BRXKH6Nb.js";import{u as c}from"./vendor-react-Dvs43sk9.js";import{g as j,c as y,k as w,u as C}from"./index-BF7bSwjJ.js";import{T as v}from"./vendor-ux-B7q8W4Pg.js";import{C as k}from"./vendor-utils-DtY42AM-.js";import"./vendor-arcblock-B7AoUs4o.js";import"./lottie-web-4koyQiv_.js";const M="authorization_response",A=j();function L(){const{t:s}=v(),[n]=c(),a=()=>{window.close()};return h(()=>{const i=n.get("state"),l=n.get("code"),t={type:M,response:{code:l}};if(window.opener)try{const o=new URL(i);window.opener.postMessage(t,o.origin),setTimeout(()=>{window.close()},2e3)}catch(o){console.error("Invalid login caller",o)}}),e.jsx(p,{severity:"success",children:e.jsxs(r,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignContent:"center",gap:1},children:[s("login.needManualClose"),e.jsx(r,{sx:{textAlign:"center"},children:e.jsx(u,{variant:"outlined",size:"small",onClick:a,children:s("login.closeWindow")})})]})})}function b(){const{blocklet:s}=window,[n]=c(),a=n.get("error"),i=n.get("error_description"),l=n.get("state"),t=x({errorMesage:"",loading:!0});f(async()=>{if(a)t.errorMesage=i,t.loading=!1;else try{const g=new URL(l);(await A.federated.getTrustedDomains()).includes(g.hostname)||(t.errorMesage="Invalid login caller")}catch{t.errorMesage="Invalid login caller"}finally{t.loading=!1}},[a,i,l]);const o=k(y.WELLKNOWN_SERVICE_PATH_PREFIX,`/blocklet/logo?&version=${s?.meta?.version||""}`);return e.jsx(d,{sx:{display:"flex",flexDirection:"column",minHeight:"100vh",justifyContent:"center",alignContent:"center"},children:e.jsxs(r,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,minHeight:"100vh",margin:"auto",paddingBottom:{sx:0,md:15}},children:[e.jsxs(r,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.5},children:[e.jsx(r,{component:"img",src:o,alt:`${s?.appName||"site"} logo`,sx:{width:80}}),e.jsx(m,{variant:"h6",component:"p",children:s?.appName})]}),t.loading?t.errorMesage?e.jsx(w,{error:{message:t.errorMesage}}):e.jsx(L,{}):null,e.jsx(C,{sx:{mt:4}})]})})}export{b as default};
1
+ import{j as e,av as d,ak as r,T as m,aX as p,Q as u}from"./vendor-mui-core-B7zoO8f5.js";import{g as x,j as f,h}from"./vendor-hooks-BRXKH6Nb.js";import{u as c}from"./vendor-react-Dvs43sk9.js";import{g as j,c as y,k as w,u as C}from"./index-CuQBOJqN.js";import{T as v}from"./vendor-ux-B7q8W4Pg.js";import{C as k}from"./vendor-utils-DtY42AM-.js";import"./vendor-arcblock-B7AoUs4o.js";import"./lottie-web-4koyQiv_.js";const M="authorization_response",A=j();function L(){const{t:s}=v(),[n]=c(),a=()=>{window.close()};return h(()=>{const i=n.get("state"),l=n.get("code"),t={type:M,response:{code:l}};if(window.opener)try{const o=new URL(i);window.opener.postMessage(t,o.origin),setTimeout(()=>{window.close()},2e3)}catch(o){console.error("Invalid login caller",o)}}),e.jsx(p,{severity:"success",children:e.jsxs(r,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignContent:"center",gap:1},children:[s("login.needManualClose"),e.jsx(r,{sx:{textAlign:"center"},children:e.jsx(u,{variant:"outlined",size:"small",onClick:a,children:s("login.closeWindow")})})]})})}function b(){const{blocklet:s}=window,[n]=c(),a=n.get("error"),i=n.get("error_description"),l=n.get("state"),t=x({errorMesage:"",loading:!0});f(async()=>{if(a)t.errorMesage=i,t.loading=!1;else try{const g=new URL(l);(await A.federated.getTrustedDomains()).includes(g.hostname)||(t.errorMesage="Invalid login caller")}catch{t.errorMesage="Invalid login caller"}finally{t.loading=!1}},[a,i,l]);const o=k(y.WELLKNOWN_SERVICE_PATH_PREFIX,`/blocklet/logo?&version=${s?.meta?.version||""}`);return e.jsx(d,{sx:{display:"flex",flexDirection:"column",minHeight:"100vh",justifyContent:"center",alignContent:"center"},children:e.jsxs(r,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:2,minHeight:"100vh",margin:"auto",paddingBottom:{sx:0,md:15}},children:[e.jsxs(r,{sx:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:.5},children:[e.jsx(r,{component:"img",src:o,alt:`${s?.appName||"site"} logo`,sx:{width:80}}),e.jsx(m,{variant:"h6",component:"p",children:s?.appName})]}),t.loading?t.errorMesage?e.jsx(w,{error:{message:t.errorMesage}}):e.jsx(L,{}):null,e.jsx(C,{sx:{mt:4}})]})})}export{b as default};
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CJubEPJw.js","assets/index-BF7bSwjJ.js","assets/vendor-mui-core-B7zoO8f5.js","assets/vendor-react-Dvs43sk9.js","assets/vendor-ux-B7q8W4Pg.js","assets/vendor-utils-DtY42AM-.js","assets/vendor-hooks-BRXKH6Nb.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-B7AoUs4o.js","assets/index-DrVXX4fX.css","assets/index-BPy8_fa2.js","assets/index-DRYJ0xIl.js","assets/index-B5LvOF-F.css"])))=>i.map(i=>d[i]);
2
- import{T as O,O as _,_ as k}from"./vendor-ux-B7q8W4Pg.js";import{r as m}from"./vendor-react-Dvs43sk9.js";import{j as o,ak as u,at as q,W as e}from"./vendor-mui-core-B7zoO8f5.js";import{n as d,C as z}from"./vendor-utils-DtY42AM-.js";const C=m.lazy(()=>k(()=>import("./index-CJubEPJw.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader}))),F="/blocklet/logo/upload",c=[".png",".jpg",".jpeg",".webp",".bmp",".ico"];function U({url:t,height:f=80,width:g="auto",enabled:s=!0,allowSVG:h=!0,type:r,did:a,prefix:b,headers:x=d,aspectRatio:n=1,minWidth:P=256,minHeight:R=256,onUploaded:j=d,children:l=null}){const{t:v,locale:w}=O(),i=m.useRef(null),p=()=>{i.current?.open()},y=()=>{j(),i.current?.close()},E={cursor:s?"pointer":"default","&::after":{content:`"${v("common.switch")}"`}};return o.jsxs(S,{id:`uploader-${a}-${r}`,children:[o.jsx(C,{ref:i,locale:w,popup:!0,onUploadFinish:y,plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:z(b,F,r,a),disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:h?[...c,".svg"]:c,maxFileSize:1024*1024*5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:n,initialAspectRatio:n,croppedCanvasOptions:{minWidth:P,minHeight:R}}},tusProps:{headers:x}}),l?o.jsx(u,{onClick:p,children:l}):o.jsx(u,{className:_("uploader-wrapper",s&&"enabled"),sx:E,onClick:p,children:o.jsx("img",{alt:r,src:t,style:{width:g,height:f}})})]},`uploader-${a}-${r}`)}U.propTypes={url:e.string.isRequired,type:e.oneOf(["square","rect","favicon","splash-portrait","splash-landscape","og-image"]).isRequired,did:e.string.isRequired,prefix:e.string.isRequired,headers:e.func,onUploaded:e.func,height:e.number,width:e.any,enabled:e.bool,allowSVG:e.bool,aspectRatio:e.number,minWidth:e.number,minHeight:e.number,children:e.node};const S=q.div`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BxU3q403.js","assets/index-CuQBOJqN.js","assets/vendor-mui-core-B7zoO8f5.js","assets/vendor-react-Dvs43sk9.js","assets/vendor-ux-B7q8W4Pg.js","assets/vendor-utils-DtY42AM-.js","assets/vendor-hooks-BRXKH6Nb.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-B7AoUs4o.js","assets/index-DrVXX4fX.css","assets/index-BPy8_fa2.js","assets/index-DRYJ0xIl.js","assets/index-B5LvOF-F.css"])))=>i.map(i=>d[i]);
2
+ import{T as O,O as _,_ as k}from"./vendor-ux-B7q8W4Pg.js";import{r as m}from"./vendor-react-Dvs43sk9.js";import{j as o,ak as u,at as q,W as e}from"./vendor-mui-core-B7zoO8f5.js";import{n as d,C as z}from"./vendor-utils-DtY42AM-.js";const C=m.lazy(()=>k(()=>import("./index-BxU3q403.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(t=>({default:t.Uploader}))),F="/blocklet/logo/upload",c=[".png",".jpg",".jpeg",".webp",".bmp",".ico"];function U({url:t,height:f=80,width:g="auto",enabled:s=!0,allowSVG:h=!0,type:r,did:a,prefix:b,headers:x=d,aspectRatio:n=1,minWidth:P=256,minHeight:R=256,onUploaded:j=d,children:l=null}){const{t:v,locale:w}=O(),i=m.useRef(null),p=()=>{i.current?.open()},y=()=>{j(),i.current?.close()},E={cursor:s?"pointer":"default","&::after":{content:`"${v("common.switch")}"`}};return o.jsxs(S,{id:`uploader-${a}-${r}`,children:[o.jsx(C,{ref:i,locale:w,popup:!0,onUploadFinish:y,plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:z(b,F,r,a),disableMediaKitPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileExts:h?[...c,".svg"]:c,maxFileSize:1024*1024*5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,autoCropArea:1,aspectRatio:n,initialAspectRatio:n,croppedCanvasOptions:{minWidth:P,minHeight:R}}},tusProps:{headers:x}}),l?o.jsx(u,{onClick:p,children:l}):o.jsx(u,{className:_("uploader-wrapper",s&&"enabled"),sx:E,onClick:p,children:o.jsx("img",{alt:r,src:t,style:{width:g,height:f}})})]},`uploader-${a}-${r}`)}U.propTypes={url:e.string.isRequired,type:e.oneOf(["square","rect","favicon","splash-portrait","splash-landscape","og-image"]).isRequired,did:e.string.isRequired,prefix:e.string.isRequired,headers:e.func,onUploaded:e.func,height:e.number,width:e.any,enabled:e.bool,allowSVG:e.bool,aspectRatio:e.number,minWidth:e.number,minHeight:e.number,children:e.node};const S=q.div`
3
3
  .uploader-wrapper {
4
4
  display: inline-flex;
5
5
  position: relative;
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CgdhTqWX.js","assets/vendor-react-Dvs43sk9.js"])))=>i.map(i=>d[i]);
2
- import{j as e,at as $,W as v,J as R,ak as r,b4 as U,b0 as z,T as N,bH as F,bI as X,bJ as H,a$ as J,av as B,bE as G,bK as V,bL as K}from"./vendor-mui-core-B7zoO8f5.js";import{G as O,I as Q,D as I,_ as q,P as Y,T as Z}from"./vendor-ux-B7q8W4Pg.js";import{r as d}from"./vendor-react-Dvs43sk9.js";import{g as ee,n as te}from"./vendor-hooks-BRXKH6Nb.js";import{v as D,J as L,H as se,d as oe,S as ae,s as ne,b as re}from"./index-BF7bSwjJ.js";import{T as ie}from"./vendor-utils-DtY42AM-.js";import{N as ce}from"./index-DnMPdyj-.js";import{W as le}from"./did-address-CcsL3-Qm.js";import{w as pe}from"./wrap-locale-C1S0zrtd.js";import{u as de}from"./use-passport-id-B-b-_oYF.js";import{g as me}from"./get-safe-url-BNFAIq84.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-B7AoUs4o.js";function W({list:s=[],width:l=300,height:m=400,cardSpace:p=40,onSelect:i=()=>{},defaultIndex:k=0}){const[u,h]=d.useState(0),[o,x]=d.useState(0),b=d.useRef(null),f=n=>{if(n<0||n>s.length-1)return;h(n);const c=b.current.clientWidth;x(n*(l+p)-(c-l)/2+p*.5),i(n)};d.useEffect(()=>{f(k);const n=c=>c.preventDefault();b.current.addEventListener("touchmove",n,{passive:!1})},[]);let a;const j=n=>{a=n.touches[0].clientX},y=n=>{const c=n.changedTouches[0],w=a-c.clientX;Math.abs(w)>60&&(w>0?f(u+1):f(u-1))};return e.jsx(ue,{ref:b,onTouchStart:j,onTouchEnd:y,children:e.jsx("div",{className:"card-container",style:{transform:`translate(${-o}px, 0)`},children:s.map((n,c)=>e.jsx("div",{className:`card-item ${c===u?"selected":""}`,style:{width:l,height:m,margin:p/2},onClick:()=>f(c),children:n.display?e.jsx("div",{className:"card-content",children:e.jsx(ce,{data:n.display,style:{width:"100%",height:"100%"}})}):e.jsx("div",{className:"card-content",dangerouslySetInnerHTML:{__html:n.src}})},n.id))})})}const ue=$.div`
2
+ import{j as e,at as $,W as v,J as R,ak as r,b4 as U,b0 as z,T as N,bH as F,bI as X,bJ as H,a$ as J,av as B,bE as G,bK as V,bL as K}from"./vendor-mui-core-B7zoO8f5.js";import{G as O,I as Q,D as I,_ as q,P as Y,T as Z}from"./vendor-ux-B7q8W4Pg.js";import{r as d}from"./vendor-react-Dvs43sk9.js";import{g as ee,n as te}from"./vendor-hooks-BRXKH6Nb.js";import{v as D,J as L,H as se,d as oe,S as ae,s as ne,b as re}from"./index-CuQBOJqN.js";import{T as ie}from"./vendor-utils-DtY42AM-.js";import{N as ce}from"./index-pAv7g5o_.js";import{W as le}from"./did-address-CcsL3-Qm.js";import{w as pe}from"./wrap-locale-BQM6_LkP.js";import{u as de}from"./use-passport-id-B-b-_oYF.js";import{g as me}from"./get-safe-url-Bpq2IOGY.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-B7AoUs4o.js";function W({list:s=[],width:l=300,height:m=400,cardSpace:p=40,onSelect:i=()=>{},defaultIndex:k=0}){const[u,h]=d.useState(0),[o,x]=d.useState(0),b=d.useRef(null),f=n=>{if(n<0||n>s.length-1)return;h(n);const c=b.current.clientWidth;x(n*(l+p)-(c-l)/2+p*.5),i(n)};d.useEffect(()=>{f(k);const n=c=>c.preventDefault();b.current.addEventListener("touchmove",n,{passive:!1})},[]);let a;const j=n=>{a=n.touches[0].clientX},y=n=>{const c=n.changedTouches[0],w=a-c.clientX;Math.abs(w)>60&&(w>0?f(u+1):f(u-1))};return e.jsx(ue,{ref:b,onTouchStart:j,onTouchEnd:y,children:e.jsx("div",{className:"card-container",style:{transform:`translate(${-o}px, 0)`},children:s.map((n,c)=>e.jsx("div",{className:`card-item ${c===u?"selected":""}`,style:{width:l,height:m,margin:p/2},onClick:()=>f(c),children:n.display?e.jsx("div",{className:"card-content",children:e.jsx(ce,{data:n.display,style:{width:"100%",height:"100%"}})}):e.jsx("div",{className:"card-content",dangerouslySetInnerHTML:{__html:n.src}})},n.id))})})}const ue=$.div`
3
3
  overflow: hidden;
4
4
  mask-image: linear-gradient(to left, transparent, black 3%, black 97%, transparent);
5
5
  overflow: hidden;
@@ -1 +1 @@
1
- import{j as s}from"./vendor-mui-core-B7zoO8f5.js";import{r as e}from"./vendor-react-Dvs43sk9.js";import{g as m}from"./get-safe-url-BNFAIq84.js";import"./index-BF7bSwjJ.js";import"./vendor-ux-B7q8W4Pg.js";import"./vendor-utils-DtY42AM-.js";import"./vendor-hooks-BRXKH6Nb.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-B7AoUs4o.js";function S(){const r=e.useRef(null),n=e.useRef(Date.now());return e.useEffect(()=>{const t=`open-window-url-${new URLSearchParams(window.location.search).get("key")}`;return r.current=setInterval(()=>{if(Date.now()-n.current>10*1e3){localStorage.removeItem(t),clearInterval(r.current);return}const o=localStorage.getItem(t);if(o)try{const{url:a,time:i}=JSON.parse(o);localStorage.removeItem(t),Date.now()-i<10*1e3&&(window.location.href=m(a,{allowDomains:null}))}catch{}},200),()=>clearInterval(r.current)},[]),s.jsx("div",{})}export{S as default};
1
+ import{j as s}from"./vendor-mui-core-B7zoO8f5.js";import{r as e}from"./vendor-react-Dvs43sk9.js";import{g as m}from"./get-safe-url-Bpq2IOGY.js";import"./index-CuQBOJqN.js";import"./vendor-ux-B7q8W4Pg.js";import"./vendor-utils-DtY42AM-.js";import"./vendor-hooks-BRXKH6Nb.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-B7AoUs4o.js";function S(){const r=e.useRef(null),n=e.useRef(Date.now());return e.useEffect(()=>{const t=`open-window-url-${new URLSearchParams(window.location.search).get("key")}`;return r.current=setInterval(()=>{if(Date.now()-n.current>10*1e3){localStorage.removeItem(t),clearInterval(r.current);return}const o=localStorage.getItem(t);if(o)try{const{url:a,time:i}=JSON.parse(o);localStorage.removeItem(t),Date.now()-i<10*1e3&&(window.location.href=m(a,{allowDomains:null}))}catch{}},200),()=>clearInterval(r.current)},[]),s.jsx("div",{})}export{S as default};