@abtnode/blocklet-services 1.16.52-beta-20250916-025146-35d976f4 → 1.16.52-beta-20250918-114058-f5efc10b

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 (146) hide show
  1. package/api/routes/mcp.js +237 -1
  2. package/api/routes/oauth/server.js +4 -4
  3. package/api/services/mcp/server.js +1 -1
  4. package/dist/assets/{AdapterDayjs-CRMDLq6K.js → AdapterDayjs-Ch1GqpK7.js} +1 -1
  5. package/dist/assets/{Google-Co0ES_Ef.js → Google-CZPwmMCG.js} +1 -1
  6. package/dist/assets/{access-control-CXa4XdTR.js → access-control-CUncF5eX.js} +1 -1
  7. package/dist/assets/{add-component-core-C8Wvhlwd.js → add-component-core-DTRxHh-8.js} +1 -1
  8. package/dist/assets/{add-resource-CKVcDfq1.js → add-resource-YxBtdKAz.js} +1 -1
  9. package/dist/assets/{addon-CGYbwnAQ.js → addon-C-cTa3hU.js} +2 -2
  10. package/dist/assets/{advanced-BHQ085Rc.js → advanced-Bc2FwW94.js} +1 -1
  11. package/dist/assets/{aigne-CSzB6EAi.js → aigne-BmhUzMaB.js} +1 -1
  12. package/dist/assets/{appearance-wlMh61hK.js → appearance-KZ98aKpU.js} +1 -1
  13. package/dist/assets/{arrow-down.svg-2NUXhc9M.js → arrow-down.svg-DNHk5QBL.js} +1 -1
  14. package/dist/assets/{audit-logs-OiH-ZCCu.js → audit-logs-CToENzIH.js} +1 -1
  15. package/dist/assets/{authorize-C1p1aX84.js → authorize-Cr07b2RV.js} +1 -1
  16. package/dist/assets/{base32-Bs5DmmgZ.js → base32-9HlsUoU3.js} +1 -1
  17. package/dist/assets/{bind-account-CnWbtI8I.js → bind-account-DGyijOaV.js} +1 -1
  18. package/dist/assets/{branding-C1lgysY6.js → branding-Bop5aLE8.js} +1 -1
  19. package/dist/assets/{branding-BnhQzGq_.js → branding-EXYczJqB.js} +1 -1
  20. package/dist/assets/{branding-Bk8D93gd.js → branding-rX1QvJVq.js} +2 -2
  21. package/dist/assets/{bundle-avatar-CF-8YjIk.js → bundle-avatar-BhNvlq8g.js} +1 -1
  22. package/dist/assets/{button-bUtVfsu_.js → button-D5GaRQPz.js} +1 -1
  23. package/dist/assets/{click-to-copy-BWrdBff2.js → click-to-copy-Dqmzk5Lh.js} +1 -1
  24. package/dist/assets/{complete-C_JNPzD5.js → complete-CE-9uScC.js} +1 -1
  25. package/dist/assets/{component-IFve4dXC.js → component-BGn03l-s.js} +3 -3
  26. package/dist/assets/{config-DBzwJyqc.js → config-CLkKQ7r7.js} +1 -1
  27. package/dist/assets/{config-CKpqEH5r.js → config-Ce7mmKUy.js} +1 -1
  28. package/dist/assets/{config-BPieGs6J.js → config-CiMC747A.js} +1 -1
  29. package/dist/assets/{config-navigation-pmywYpni.js → config-navigation-C_bXC3i-.js} +3 -3
  30. package/dist/assets/{config-space-Da0MmMPn.js → config-space-B1RlBsPr.js} +1 -1
  31. package/dist/assets/{confirm-BSaR4_fO.js → confirm-DUjUXcfn.js} +1 -1
  32. package/dist/assets/{connect-9m4Nmfes.js → connect-Cd4wFjvm.js} +1 -1
  33. package/dist/assets/{connect-BuRk8HoH.js → connect-DWVzC8Cs.js} +1 -1
  34. package/dist/assets/{connect-to-DhIpK6hj.js → connect-to-DgA22hrU.js} +1 -1
  35. package/dist/assets/{createClass-BFCNnTU0.js → createClass-CDs8uNCX.js} +1 -1
  36. package/dist/assets/{dashboard-DgmOVZgS.js → dashboard-q_CEWNOG.js} +3 -3
  37. package/dist/assets/{delete-confirm-BR2z4Ljn.js → delete-confirm-BIF7Oky1.js} +1 -1
  38. package/dist/assets/{did-address-D6qV21Cc.js → did-address-CNnw4_bl.js} +1 -1
  39. package/dist/assets/{domain-CkwVqsGZ.js → domain-DXf6J0eN.js} +1 -1
  40. package/dist/assets/{domain-action-card-DmX4ipuD.js → domain-action-card-BfXWszwh.js} +1 -1
  41. package/dist/assets/{domains-IK6JBOMk.js → domains-CbRUCl8I.js} +1 -1
  42. package/dist/assets/{email-C7dt-OoA.js → email-C99N-_0O.js} +1 -1
  43. package/dist/assets/engine-Cc4hAHgQ.js +1 -0
  44. package/dist/assets/{exchange-passport-BlpeYXD-.js → exchange-passport-iJ_WwErZ.js} +1 -1
  45. package/dist/assets/{form-BoRGzdQH.js → form-B28GN43f.js} +1 -1
  46. package/dist/assets/{form-text-input-qFGxuulC.js → form-text-input-xNlMjrH6.js} +1 -1
  47. package/dist/assets/{fuel-DPqYXNcT.js → fuel-BTDuZSSj.js} +1 -1
  48. package/dist/assets/{gen-access-key-DTf8XM_B.js → gen-access-key-naR-6zBu.js} +1 -1
  49. package/dist/assets/{gen-simple-access-key-BHpsJW1z.js → gen-simple-access-key-C7ybjshX.js} +1 -1
  50. package/dist/assets/get-safe-url-PVZ8sNva.js +1 -0
  51. package/dist/assets/{hdkey-iF7Zd5Mt.js → hdkey-CcHIRiJU.js} +1 -1
  52. package/dist/assets/{home-Bq8Kaby6.js → home-BQG60l8o.js} +1 -1
  53. package/dist/assets/{iframe-BZdurKlN.js → iframe-sRTCxuKq.js} +1 -1
  54. package/dist/assets/{index-DEdn8u__.js → index-B06oP6vd.js} +1 -1
  55. package/dist/assets/{index-ptPisY0K.js → index-B2Y1qZ07.js} +2 -2
  56. package/dist/assets/{index-DGBu1iXZ.js → index-BHu1ffJP.js} +1 -1
  57. package/dist/assets/{index-DIzco3bK.js → index-BT7jxh7R.js} +1 -1
  58. package/dist/assets/{index-VRhIKoNb.js → index-BVZj6aBL.js} +1 -1
  59. package/dist/assets/{index-C91ORskB.js → index-BXOWDqXU.js} +1 -1
  60. package/dist/assets/{index-BTbAsTsB.js → index-BqyC8rPJ.js} +1 -1
  61. package/dist/assets/{index-DVNnjX93.js → index-CKFVrVhW.js} +1 -1
  62. package/dist/assets/{index-CGdAaiDX.js → index-CNvRrWdA.js} +1 -1
  63. package/dist/assets/{index-BUKvf-Yt.js → index-Ck6n4b0a.js} +1 -1
  64. package/dist/assets/{index-BJftyOWK.js → index-Co6fM09o.js} +1 -1
  65. package/dist/assets/{index-0r-rUxmD.js → index-CtG4EPx1.js} +1 -1
  66. package/dist/assets/{index-6k6hDX7K.js → index-D5Esor4q.js} +55 -55
  67. package/dist/assets/{index-klWBrV7H.js → index-DANBSlDF.js} +1 -1
  68. package/dist/assets/{index-BE6_aQqm.js → index-DDpL_qpY.js} +1 -1
  69. package/dist/assets/{index-CvK2LB0C.js → index-DIfIqZRw.js} +3 -3
  70. package/dist/assets/{index-DlbJhxX4.js → index-DL5x17V7.js} +1 -1
  71. package/dist/assets/{index-BioPPNyR.js → index-DP4_T7ss.js} +1 -1
  72. package/dist/assets/{index-DzHxtRuX.js → index-D_tcdsnn.js} +1 -1
  73. package/dist/assets/{index-D0zr5fnU.js → index-DbV_otyH.js} +4 -4
  74. package/dist/assets/{index-C7WNgxRc.js → index-De78rJ-L.js} +1 -1
  75. package/dist/assets/{index-BxgIheOv.js → index-DhLCZYhn.js} +1 -1
  76. package/dist/assets/{index-1BANSka2.js → index-DzI9kX_C.js} +1 -1
  77. package/dist/assets/{index-BcOGe7jx.js → index-I4fObt9S.js} +1 -1
  78. package/dist/assets/{index-ZScchkNG.js → index-P7sOU3FB.js} +1 -1
  79. package/dist/assets/{index-Cw5ltvNg.js → index-VDwida7T.js} +1 -1
  80. package/dist/assets/{index-DtDqVnOd.js → index-mK8LnyWX.js} +1 -1
  81. package/dist/assets/{invitation-BbSlWYAY.js → invitation-xW_qcQrB.js} +1 -1
  82. package/dist/assets/{invite-DKkAcNxp.js → invite-5NmeedgR.js} +1 -1
  83. package/dist/assets/{isURL-BOLVWN6q.js → isURL-DZGsNcmL.js} +1 -1
  84. package/dist/assets/{issue-passport-kvrsHOXO.js → issue-passport-CUjAU9Y6.js} +1 -1
  85. package/dist/assets/{item-CRpPGQS5.js → item-B-p0IMj0.js} +1 -1
  86. package/dist/assets/{landing-page-Bb2t2ubc.js → landing-page-RSi1tJUt.js} +1 -1
  87. package/dist/assets/{layout-O4FRf5d2.js → layout-BTKpH5C3.js} +1 -1
  88. package/dist/assets/{list-BeJAd6oJ.js → list-C9HtsKYw.js} +3 -3
  89. package/dist/assets/{list-BmwWshfg.js → list-DM_X_DbX.js} +1 -1
  90. package/dist/assets/localization-B-_Xdumv.js +1 -0
  91. package/dist/assets/{log-DwbFr2nR.js → log-ByUaGQDD.js} +1 -1
  92. package/dist/assets/logger-Cror7fb1.js +1 -0
  93. package/dist/assets/{login-D2_PE9lX.js → login-B1S8adpO.js} +1 -1
  94. package/dist/assets/{login-oauth-callback-BQNBl6bZ.js → login-oauth-callback-CK2OuZQv.js} +1 -1
  95. package/dist/assets/{logo-uploader-vRfbxowv.js → logo-uploader-DijYekzI.js} +2 -2
  96. package/dist/assets/{lost-passport-pY1dhWDO.js → lost-passport-wz0F5eGp.js} +1 -1
  97. package/dist/assets/{open-window-C0eYx4_v.js → open-window-PMr3_tpx.js} +1 -1
  98. package/dist/assets/{over-due-invoice-payment-OBj9thMb.js → over-due-invoice-payment-CgKEpOv9.js} +1 -1
  99. package/dist/assets/{overview-Rpt1OYCM.js → overview-BPXQ5NOz.js} +1 -1
  100. package/dist/assets/{passport-item-Bq1c8VJl.js → passport-item-CtgFdOsh.js} +1 -1
  101. package/dist/assets/{permission-Doi0-9cF.js → permission-DO4jN8xJ.js} +1 -1
  102. package/dist/assets/{preferences-zYe_BxLJ.js → preferences-FO1x_0r1.js} +1 -1
  103. package/dist/assets/profile-embed-BKg9ZugM.js +1 -0
  104. package/dist/assets/{publish-resource-CnXtK3LB.js → publish-resource-CtlORU2W.js} +1 -1
  105. package/dist/assets/{react-beautiful-dnd.esm-5xsARSNi.js → react-beautiful-dnd.esm-DPZZJVHP.js} +1 -1
  106. package/dist/assets/{runtime-DjdnpZoh.js → runtime-B0pQvnF3.js} +1 -1
  107. package/dist/assets/sdk-C9i2DDEJ.js +1 -0
  108. package/dist/assets/{security-Bdj-FYH4.js → security-CQehWrjL.js} +1 -1
  109. package/dist/assets/{session-D-9YOhAy.js → session-DGB-yOme.js} +1 -1
  110. package/dist/assets/{setup-CYAJarl4.js → setup-neejBzI5.js} +1 -1
  111. package/dist/assets/{spaces-Cq_dfNLt.js → spaces-CZJwyRzV.js} +1 -1
  112. package/dist/assets/{start-EO_1F43S.js → start-OOD_HRyM.js} +1 -1
  113. package/dist/assets/{starting-progress-Ck9Thp6d.js → starting-progress-C6OFR0oi.js} +1 -1
  114. package/dist/assets/{status-DJWbsb5u.js → status-5pZO2qoE.js} +1 -1
  115. package/dist/assets/{step-actions-C91dncKW.js → step-actions-C_A-deel.js} +1 -1
  116. package/dist/assets/{studio-B3QjabKr.js → studio-DkZBruFV.js} +1 -1
  117. package/dist/assets/{switch-control-o8fDOnJX.js → switch-control-XooTt-i6.js} +1 -1
  118. package/dist/assets/{table-tips-B7dQ0Rgb.js → table-tips-CgCabdgD.js} +1 -1
  119. package/dist/assets/{team-RDmDo4cZ.js → team-CGGZIbfh.js} +1 -1
  120. package/dist/assets/{traffic-BUIhb2HS.js → traffic-Bt0n-c6_.js} +1 -1
  121. package/dist/assets/{transfer-Dfbnhl7y.js → transfer-KpJ1sGgq.js} +1 -1
  122. package/dist/assets/{unsubscribe-Xjc5jAJO.js → unsubscribe-CF4vy-ZY.js} +1 -1
  123. package/dist/assets/{use-app-logo-DesKuFha.js → use-app-logo-DxlfjGOQ.js} +1 -1
  124. package/dist/assets/{use-window-close-CN9L863w.js → use-window-close-toR_SRTv.js} +1 -1
  125. package/dist/assets/{useLocalStorage-vyIYLydJ.js → useLocalStorage-CiLfInVV.js} +1 -1
  126. package/dist/assets/{user-center-DdBnHKdX.js → user-center-C7a4TtFt.js} +3 -3
  127. package/dist/assets/{user-follower-DuL1BMYz.js → user-follower-Cs8st3w5.js} +1 -1
  128. package/dist/assets/{user-sessions-SImh8rHV.js → user-sessions-DN1hzt8P.js} +1 -1
  129. package/dist/assets/{util-CHZLxs1T.js → util-CYsTlK2W.js} +1 -1
  130. package/dist/assets/{util-BlUZ4Q2D.js → util-CnXmjN2T.js} +1 -1
  131. package/dist/assets/{vendor-arcblock-C-xQV6LY.js → vendor-arcblock-DEa0A9MF.js} +1 -1
  132. package/dist/assets/{vendor-ux-ESjuHpb6.js → vendor-ux-pYOhjQLA.js} +1 -1
  133. package/dist/assets/{wait-connect-zz_yxj4x.js → wait-connect-DxmVFheW.js} +1 -1
  134. package/dist/assets/{wizard-CRrvtL2U.js → wizard-BvaUZfHg.js} +1 -1
  135. package/dist/assets/{wizard-components-CR8h5HCI.js → wizard-components-BoWnBOyn.js} +2 -2
  136. package/dist/assets/{wrap-locale-BraEpa0W.js → wrap-locale-DU2DJaEg.js} +1 -1
  137. package/dist/assets/{zh-DQDxmpdl.js → zh-CVf8x4U0.js} +1 -1
  138. package/dist/index.html +3 -3
  139. package/dist/service-worker.js +1 -1
  140. package/package.json +37 -37
  141. package/dist/assets/engine-B4t4bO94.js +0 -1
  142. package/dist/assets/get-safe-url-C5Vpma4S.js +0 -1
  143. package/dist/assets/localization-EdFO66I_.js +0 -1
  144. package/dist/assets/logger-DHvXC8jl.js +0 -1
  145. package/dist/assets/profile-embed-BqOWDoBR.js +0 -1
  146. package/dist/assets/sdk-ChXfsb2q.js +0 -1
@@ -1 +1 @@
1
- import{j as e,T as v,a$ as b,D as I,J as T,ak as t}from"./vendor-mui-core-CmD-NPnl.js";import{W as B,w as E,X as P,$ as j,Z as $}from"./vendor-ux-ESjuHpb6.js";import{a as A}from"./vendor-hooks-DLNZ8kxG.js";import{ak as C}from"./index-6k6hDX7K.js";function M({linkProps:s=void 0,showExtra:o=!1,...n}){return e.jsxs(v,{...n,children:["Powered by"," ",e.jsx(b,{href:"https://www.arcblock.io",target:"_blank",...s,children:"ArcBlock"}),"'s"," ",e.jsx(b,{href:"https://www.blocklet.io",target:"_blank",...s,children:"Blocklet Technology"}),o?", the decentralized web engine.":null]})}function N({did:s,children:o,title:n=void 0,description:a=void 0,actions:m=void 0,logo:i=void 0,logoSize:d=50,poweredBy:x=void 0,termsOfUse:g=void 0,standalone:y=!1}){const r=globalThis?.blocklet||globalThis?.env||{},{palette:f}=I(),c=T(l=>l.breakpoints.down("lg")),w=C({meta:r}),k=A(()=>{const l=r.appPid,u=B.isEthereumDid(l),D=u?void 0:E(l);return u?P(l):D.color},[r?.appPid]);if(!s)return o;n===void 0&&(n=r.appName),a===void 0&&(a=r.appDescription),i===void 0&&(i=w||""),typeof i=="string"&&(i?i=e.jsx(t,{sx:{height:d,maxHeight:d,objectFit:"contain"},component:"img",src:i,alt:`${r.appName}'s logo`}):i=e.jsx(j,{size:d,did:s,src:i,variant:"rounded"})),x===void 0&&(x=e.jsx(M,{linkProps:{color:f.text.secondary,sx:{"&:hover":{textDecoration:"underline"}}},showExtra:!c,sx:{textAlign:"center",fontSize:"12px",color:"text.secondary"}}));let p=o;!o&&!c&&(p=e.jsx(t,{sx:{filter:"blur(180px)",display:"flex"},children:e.jsx(j,{size:210,did:s,variant:"rounded"})}));const z=!!o;let h=!y;return c&&(h=!z),e.jsxs(t,{sx:{width:"100%",minHeight:"100vh",display:"flex",justifyContent:"center",alignItems:"center",px:{xs:2,sm:4,md:8},pt:{xs:2,sm:4,md:6},pb:{xs:5,md:8},background:`radial-gradient(circle at bottom right, ${$(k,.3)} 10%, ${f.background.default} 50%)`,position:"relative"},children:[e.jsxs(t,{sx:{maxWidth:1200,display:"flex",alignItems:"center",justifyContent:[h,p].filter(Boolean).length>1?"space-between":"center",width:"100%",margin:"auto"},children:[h?e.jsxs(t,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[e.jsx(t,{sx:{display:"flex",alignItems:"center"},children:i}),e.jsx(v,{variant:"h2",sx:{fontWeight:"bold",fontSize:{sm:"2.25rem",md:"2.75rem",xl:"3.5rem"}},children:n}),a?e.jsx(t,{sx:{mb:2,color:"text.secondary"},children:a}):null,m?e.jsx(t,{sx:{mt:8},children:m}):null,g?e.jsx(t,{sx:{mt:-1,color:"grey"},children:g}):null]}):null,p]}),e.jsx(t,{sx:{position:"absolute",zIndex:10,bottom:10,left:10,right:10,textAlign:"center"},children:x})]})}export{N as K};
1
+ import{j as e,T as v,a$ as b,D as I,J as T,ak as t}from"./vendor-mui-core-CmD-NPnl.js";import{W as B,w as E,X as P,$ as j,Z as $}from"./vendor-ux-pYOhjQLA.js";import{a as A}from"./vendor-hooks-DLNZ8kxG.js";import{ak as C}from"./index-D5Esor4q.js";function M({linkProps:s=void 0,showExtra:o=!1,...n}){return e.jsxs(v,{...n,children:["Powered by"," ",e.jsx(b,{href:"https://www.arcblock.io",target:"_blank",...s,children:"ArcBlock"}),"'s"," ",e.jsx(b,{href:"https://www.blocklet.io",target:"_blank",...s,children:"Blocklet Technology"}),o?", the decentralized web engine.":null]})}function N({did:s,children:o,title:n=void 0,description:a=void 0,actions:m=void 0,logo:i=void 0,logoSize:d=50,poweredBy:x=void 0,termsOfUse:g=void 0,standalone:y=!1}){const r=globalThis?.blocklet||globalThis?.env||{},{palette:f}=I(),c=T(l=>l.breakpoints.down("lg")),w=C({meta:r}),k=A(()=>{const l=r.appPid,u=B.isEthereumDid(l),D=u?void 0:E(l);return u?P(l):D.color},[r?.appPid]);if(!s)return o;n===void 0&&(n=r.appName),a===void 0&&(a=r.appDescription),i===void 0&&(i=w||""),typeof i=="string"&&(i?i=e.jsx(t,{sx:{height:d,maxHeight:d,objectFit:"contain"},component:"img",src:i,alt:`${r.appName}'s logo`}):i=e.jsx(j,{size:d,did:s,src:i,variant:"rounded"})),x===void 0&&(x=e.jsx(M,{linkProps:{color:f.text.secondary,sx:{"&:hover":{textDecoration:"underline"}}},showExtra:!c,sx:{textAlign:"center",fontSize:"12px",color:"text.secondary"}}));let p=o;!o&&!c&&(p=e.jsx(t,{sx:{filter:"blur(180px)",display:"flex"},children:e.jsx(j,{size:210,did:s,variant:"rounded"})}));const z=!!o;let h=!y;return c&&(h=!z),e.jsxs(t,{sx:{width:"100%",minHeight:"100vh",display:"flex",justifyContent:"center",alignItems:"center",px:{xs:2,sm:4,md:8},pt:{xs:2,sm:4,md:6},pb:{xs:5,md:8},background:`radial-gradient(circle at bottom right, ${$(k,.3)} 10%, ${f.background.default} 50%)`,position:"relative"},children:[e.jsxs(t,{sx:{maxWidth:1200,display:"flex",alignItems:"center",justifyContent:[h,p].filter(Boolean).length>1?"space-between":"center",width:"100%",margin:"auto"},children:[h?e.jsxs(t,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[e.jsx(t,{sx:{display:"flex",alignItems:"center"},children:i}),e.jsx(v,{variant:"h2",sx:{fontWeight:"bold",fontSize:{sm:"2.25rem",md:"2.75rem",xl:"3.5rem"}},children:n}),a?e.jsx(t,{sx:{mb:2,color:"text.secondary"},children:a}):null,m?e.jsx(t,{sx:{mt:8},children:m}):null,g?e.jsx(t,{sx:{mt:-1,color:"grey"},children:g}):null]}):null,p]}),e.jsx(t,{sx:{position:"absolute",zIndex:10,bottom:10,left:10,right:10,textAlign:"center"},children:x})]})}export{N as K};
@@ -1,4 +1,4 @@
1
- import{j as a,at as m}from"./vendor-mui-core-CmD-NPnl.js";import{C as p}from"./content-layout-DYZYIlLo.js";import{T as c,H as s}from"./vendor-ux-ESjuHpb6.js";import{a6 as d,X as i}from"./index-6k6hDX7K.js";const u=m(p)`
1
+ import{j as a,at as m}from"./vendor-mui-core-CmD-NPnl.js";import{C as p}from"./content-layout-DYZYIlLo.js";import{T as c,H as s}from"./vendor-ux-pYOhjQLA.js";import{a6 as d,X as i}from"./index-D5Esor4q.js";const u=m(p)`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CvK2LB0C.js","assets/index-6k6hDX7K.js","assets/vendor-mui-core-CmD-NPnl.js","assets/vendor-react-Dvs43sk9.js","assets/vendor-ux-ESjuHpb6.js","assets/vendor-utils-DQK0pEML.js","assets/vendor-hooks-DLNZ8kxG.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-C-xQV6LY.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 Kr}from"./vendor-react-Dvs43sk9.js";import{r as tr,a as rr,b as nr,c as ir,d as ut,e as sr,f as or,g as ar,h as ft,i as cr,j as lr,k as ur,m as Ie,n as fr,o as dr,p as hr,q as ve,s as pr,t as yr,u as mr,v as gr,an as Ir,b9 as Lr,T as $e,H as Ke,_ as qr,$ as _r,a6 as Ne,ac as Mr,O as Fr}from"./vendor-ux-ESjuHpb6.js";import{j as r,Y as dt,bB as ht,I as pt,aj as yt,$ as mt,b1 as _e,T as X,ak as R,z as V,F as M,b7 as Wr,b5 as br,b6 as Sr,a5 as Er,a3 as gt,aX as xr,R as Tr,Q as je,a6 as _t,W as w,am as Vr,cf as Hr,cg as zr,ch as Yr}from"./vendor-mui-core-CmD-NPnl.js";import{B as Xr,o as Jr,l as Gr}from"./index-BE6_aQqm.js";import{u as Zr}from"./useAsyncRetry-6TjWJyO6.js";import{w as Br,B as C,o as Qr,b as en,C as Ht}from"./vendor-utils-DQK0pEML.js";import{r as tn}from"./hdkey-iF7Zd5Mt.js";import{Z as Re,c as ie,a8 as rn}from"./index-6k6hDX7K.js";import{u as ke}from"./team-RDmDo4cZ.js";import{u as jr,C as z}from"./index.esm-JPZAjt0x.js";import{T as nn}from"./index-DlbJhxX4.js";import{E as sn}from"./empty-spinner-DCC7mgEb.js";import{C as q}from"./click-to-copy-BWrdBff2.js";import{D as on}from"./delete-confirm-BR2z4Ljn.js";import{a as an}from"./passport-item-Bq1c8VJl.js";import{A as cn}from"./actions-CL4xTGOh.js";import{T as Bt}from"./table-tips-B7dQ0Rgb.js";import{u as ln}from"./use-mobile-D93Bk2Ru.js";import"./vendor-hooks-DLNZ8kxG.js";import"./lottie-web-4koyQiv_.js";import"./useAsync-CNAYLnLm.js";import"./vendor-arcblock-C-xQV6LY.js";import"./session-D-9YOhAy.js";import"./isURL-BOLVWN6q.js";import"./use-app-logo-DesKuFha.js";import"./arrow-down.svg-2NUXhc9M.js";import"./vendor-mui-x--K2rEM1j.js";import"./AdapterDayjs-CRMDLq6K.js";import"./confirm-BSaR4_fO.js";import"./index-DBs9Ljax.js";import"./did-address-D6qV21Cc.js";import"./util-CHZLxs1T.js";import"./base32-Bs5DmmgZ.js";var Ae={},Ce={},Z={},re={},jt;function un(){if(jt)return re;jt=1;var e=re&&re.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(re,"__esModule",{value:!0}),re.BaseBN=re.BN=void 0;const o=e(Br());re.BaseBN=o.default;class i extends o.default{constructor(a,s,p){super(a===null?"0":a,s,p)}}return re.BN=i,re}var vt;function se(){return vt||(vt=1,function(e){var o=Z&&Z.__createBinding||(Object.create?function(t,f,m,U){U===void 0&&(U=m);var E=Object.getOwnPropertyDescriptor(f,m);(!E||("get"in E?!f.__esModule:E.writable||E.configurable))&&(E={enumerable:!0,get:function(){return f[m]}}),Object.defineProperty(t,U,E)}:function(t,f,m,U){U===void 0&&(U=m),t[U]=f[m]}),i=Z&&Z.__setModuleDefault||(Object.create?function(t,f){Object.defineProperty(t,"default",{enumerable:!0,value:f})}:function(t,f){t.default=f}),u=Z&&Z.__importStar||function(t){if(t&&t.__esModule)return t;var f={};if(t!=null)for(var m in t)m!=="default"&&Object.prototype.hasOwnProperty.call(t,m)&&o(f,t,m);return i(f,t),f},a=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=be,e.UUID=Qe,e.isUUID=et,e.toUint8Array=Se,e.toBuffer=Oe,e.toBase58=tt,e.fromBase58=rt,e.toBase64=nt,e.fromBase64=it,e.toAddress=te,e.toDid=st,e.isSameDid=ot,e.formatTxType=at;const s=a(tr),p=a(rr),d=a(nr),y=a(ir),g=a(ut),n=a(sr),c=a(or),l=a(ar);e.rightPad=l.default;const h=a(ft);e.leftPad=h.default;const S=a(cr()),_=a(lr()),H=u(ur()),x=un();Object.defineProperty(e,"BN",{enumerable:!0,get:function(){return x.BN}});const k="did:abt:",B=new x.BN(0),T=new x.BN(-1),j={encode:t=>`z${S.default.encode(t)}`,decode:t=>S.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 b=t=>{if(typeof t=="string"||typeof t=="number"){let f=new x.BN(1);const m=String(t).toLowerCase().trim(),U=m.substr(0,2)==="0x"||m.substr(0,3)==="-0x";let E=(0,e.stripHexPrefix)(m);if(E.substr(0,1)==="-"&&(E=(0,e.stripHexPrefix)(E.slice(1)),f=new x.BN(-1,10)),E=E===""?"0":E,!E.match(/^-?[0-9]+$/)&&E.match(/^[0-9A-Fa-f]+$/)||E.match(/^[a-fA-F]+$/)||U===!0&&E.match(/^[0-9A-Fa-f]+$/))return new x.BN(E,16).mul(f);if((E.match(/^-?[0-9]+$/)||E==="")&&U===!1)return new x.BN(E,10).mul(f)}if((0,e.isBN)(t))return new x.BN(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=b;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 A=t=>t instanceof x.BN||t instanceof x.BaseBN||t&&t.constructor&&t.constructor.name==="BN";e.isBN=A;const K=t=>t&&t.constructor&&t.constructor.name==="BigNumber";e.isBigNumber=K;const ee=t=>((0,p.default)(t)||(0,d.default)(t))&&/^(-)?0x[0-9a-f]*$/i.test(t);e.isHexStrict=ee;const Le=t=>((0,p.default)(t)||(0,d.default)(t))&&/^(-0x|0x|0X|-0X)?[0-9a-f]*$/i.test(t);e.isHex=Le;const qe=(t,f=10)=>{try{if(typeof t=="number"&&t>0){const m=Number(t).toLocaleString("fullwide",{useGrouping:!1});return new x.BN(m,f)}return(0,e.numberToBN)(t)}catch(m){throw new Error(`${m} Given value: "${t}"`)}};e.toBN=qe;const Me=t=>{t=H.encode(t);let f="";t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join(""),t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join("");for(let m=0;m<t.length;m++){const E=t.charCodeAt(m).toString(16);f+=E.length<2?`0${E}`:E}return`0x${f}`};e.utf8ToHex=Me;const Fe=t=>{if(!(0,e.isHexStrict)(t))throw new Error(`The parameter "${t}" must be a valid HEX string.`);let f="",m=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 E=0;E<U;E+=2)m=parseInt(t.substr(E,2),16),f+=String.fromCharCode(m);return H.decode(f)};e.hexToUtf8=Fe;const We=t=>t?(0,e.toBN)(t).toNumber():0;e.hexToNumber=We;const Ve=t=>{if((0,c.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 f=(0,e.toBN)(t),m=f.toString(16);return f.lt(new x.BN(0))?`-0x${m.substr(1)}`:`0x${m}`};e.numberToHex=Ve;const ze=t=>{const f=[];for(let m=0;m<t.length;m++)f.push((t[m]>>>4).toString(16)),f.push((t[m]&15).toString(16));return`0x${f.join("")}`};e.bytesToHex=ze;const Ye=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 f=[];for(let m=0;m<t.length;m+=2)f.push(parseInt(t.substr(m,2),16));return f};e.hexToBytes=Ye;const Xe=(t,f=!1)=>be(t)||C.isBuffer(t)?f?"bytes":(0,e.bytesToHex)(t):(0,e.isBase58btc)(t)?f?"bytes":(0,e.bytesToHex)(j.decode(t)):(0,s.default)(t)?f?"bool":t?"0x01":"0x00":(0,y.default)(t)&&!(0,e.isBigNumber)(t)&&!(0,e.isBN)(t)?f?"string":(0,e.utf8ToHex)(JSON.stringify(t)):typeof t=="string"?t.indexOf("-0x")===0||t.indexOf("-0X")===0?f?"int256":(0,e.numberToHex)(t):t.indexOf("0x")===0||t.indexOf("0X")===0?f?"bytes":t:f?"string":(0,e.utf8ToHex)(t):f?+t<0?"int256":"uint256":(0,e.numberToHex)(t);e.toHex=Xe;const Je=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=Je;const Ge=(t,f=18,m={})=>{let U=(0,e.toBN)(t);const E=U.lt(B),F=(0,e.toBN)(`1${"0".repeat(f)}`,10),G=F.toString(10).length-1||1,N=m||{};E&&(U=U.mul(T));let $=U.mod(F).toString(10);for(;$.length<G;)$=`0${$}`;N.pad||($=$.match(/^([0-9]*[1-9]|0)(0*)/)[1]);let L=U.div(F).toString(10);N.commify&&(L=L.replace(/\B(?=(\d{3})+(?!\d))/g,","));let Ee=`${L}${$==="0"?"":`.${$}`}`;return E&&(Ee=`-${Ee}`),Ee};e.fromUnitToToken=Ge;const Ze=(t,f=18)=>{let m=(0,e.numberToString)(t);const U=(0,e.toBN)(`1${"0".repeat(f)}`,10),E=U.toString(10).length-1||1,F=m.substring(0,1)==="-";if(F&&(m=m.substring(1)),m===".")throw new Error(`error converting token ${t} to unit, invalid value`);const G=m.split(".");if(G.length>2)throw new Error(`error converting token ${t} to unit, too many decimal points`);let N=G[0],$=G[1];if(N||(N="0"),$||($="0"),$.length>E)throw new Error(`error converting token ${t} to unit, too many decimal places`);for(;$.length<E;)$+="0";N=new x.BN(N),$=new x.BN($);let L=N.mul(U).add($);return F&&(L=L.mul(T)),new x.BN(L.toString(10),10)};e.fromTokenToUnit=Ze;function be(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Qe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const f=Math.random()*16|0;return(t==="x"?f:f&3|8).toString(16)})}function et(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 Se(t){let f=null;if([null,void 0,""].includes(t))f=new Uint8Array;else if(C.isBuffer(t))f=new Uint8Array(t);else if((0,e.isHexStrict)(t))f=new Uint8Array((0,e.hexToBytes)(t));else if(be(t))f=new Uint8Array(t);else if((0,e.isBase58btc)(t))f=new Uint8Array(j.decode(t));else if(typeof t=="string")f=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 f}function Oe(t){return C.from(Se(t))}function tt(t){const f=j.encode(Se(t));return C.from(f).toString("utf-8")}function rt(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 nt(t,f=!0){const m=_.default.encode(Oe(t));return f?_.default.escape(m):m}function it(t){if(typeof t!="string")throw new Error("fromBase64 requires input to be a string");return C.from(_.default.unescape(t),"base64")}function te(t){return t.replace(k,"")}function st(t){return`${k}${te(t)}`}function ot(t,f){return te(t).toLowerCase()===te(f).toLowerCase()}function at(t){return(0,g.default)((0,n.default)(t))}}(Z)),Z}var wt;function we(){if(wt)return Ce;wt=1,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.encode=o;const e=se();function o(i,u="hex"){return["hex","base16"].includes(u)?(0,e.toHex)(i):u==="base58"?(0,e.toBase58)(i):u==="base64"?(0,e.toBase64)(i):u==="Uint8Array"?(0,e.toUint8Array)(i):u==="buffer"?(0,e.toBuffer)(i):i}return Ce}var oe={},Ut;function fn(){if(Ut)return oe;Ut=1;var e=oe&&oe.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(oe,"__esModule",{value:!0}),oe.KeccakHasher=void 0;const o=e(Ie()),i=se(),u=we();class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=n=>o.default[`keccak${p}`](n),g=(n,c)=>c===1?y(n):g(y(n),c-1);this[d]=(n,c=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=g(h,c);return(0,u.encode)(`0x${S}`,l)}})}}return oe.KeccakHasher=a,oe.default=new a,oe}var xe={},Ot;function dn(){if(Ot)return xe;Ot=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.Sha2Hasher=void 0;const e=se(),o=fr(),i=we(),u={sha224:o.sha224,sha256:o.sha256,sha384:o.sha384,sha512:o.sha512};class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=u[`sha${p}`],g=(n,c)=>{let l=n;try{l=(0,e.toUint8Array)(n)}catch{}return c===1?`0x${y().update(l).digest("hex")}`:g(g(l,1),c-1)};this[d]=(n,c=2,l="hex")=>{const h=g(n,c);return(0,i.encode)(h,l)}})}}return xe.Sha2Hasher=a,xe.default=new a,xe}var ae={},At;function hn(){if(At)return ae;At=1;var e=ae&&ae.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ae,"__esModule",{value:!0}),ae.Sha3Hasher=void 0;const o=e(Ie()),i=se(),u=we();class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=o.default[`sha3_${p}`],g=(n,c)=>c===1?y(n):g(y(n),c-1);this[d]=(n,c=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=g(h,c);return(0,u.encode)(`0x${S}`,l)}})}}return ae.Sha3Hasher=a,ae.default=new a,ae}var ce={},Te={},Pt;function bt(){if(Pt)return Te;Pt=1;var e=Te&&Te.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Te,"__esModule",{value:!0});const o=e(dr());return Te.default=o.default.create("genKeyPair","getPublicKey","sign","verify"),Te}var $t;function pn(){if($t)return ce;$t=1;var e=ce&&ce.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(ce,"__esModule",{value:!0}),ce.Ed25519Signer=void 0;const o=e(hr()),i=e(ve()),u=se(),a=e(bt()),s=we(),p=o.default.sign;class d extends a.default{constructor(){super()}genKeyPair(g="hex",n){const c=n?(0,u.toUint8Array)(n):new Uint8Array((0,i.default)(32));if(c.byteLength!==32)throw new Error("Invalid seed to generate key pair");const l=p.keyPair.fromSeed(c);return l.publicKey=(0,s.encode)(l.publicKey,g),l.secretKey=(0,s.encode)(l.secretKey,g),l}getPublicKey(g,n="hex"){const c=(0,u.toUint8Array)(g),l=p.keyPair.fromSecretKey(c).publicKey;return(0,s.encode)(l,n)}sign(g,n,c="hex"){const l=(0,u.toUint8Array)(n),h=(0,u.toUint8Array)(g),S=p.detached(h,l);return(0,s.encode)(S,c)}verify(g,n,c){const l=(0,u.toUint8Array)(c),h=(0,u.toUint8Array)(g),S=(0,u.toUint8Array)(n);return p.detached.verify(h,S,l)}}return ce.Ed25519Signer=d,ce.default=new d,ce}var le={},ue={},Rt;function vr(){if(Rt)return ue;Rt=1;var e=ue&&ue.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(ue,"__esModule",{value:!0}),ue.Secp256k1Signer=void 0;const o=e(pr()),i=se(),u=e(ve()),a=e(bt()),s=we(),p=o.default.ec,d=new p("secp256k1");class y extends a.default{constructor(){super(),this.pkHasFormatPrefix=!0,this.pkCompressed=!1}isValidSK(n){if(n.byteLength!==32)return!1;const c=new i.BN(n);return c.cmp(d.curve.n)<0&&!c.isZero()}genKeyPair(n="hex"){let c=null;do c=new Uint8Array((0,u.default)(32));while(!this.isValidSK(c));const l=this.getPublicKey((0,i.toHex)(c));return{secretKey:(0,s.encode)(c,n),publicKey:(0,s.encode)(l,n)}}getPublicKey(n,c="hex"){if(!this.isValidSK((0,i.toUint8Array)(n)))throw new Error("Invalid secret key");let l=d.keyFromPrivate((0,i.toBuffer)(n)).getPublic(this.pkCompressed,"hex");return this.pkHasFormatPrefix===!1&&(l=l.slice(2)),(0,s.encode)(`0x${l}`,c)}sign(n,c,l="hex"){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=d.keyFromPrivate((0,i.toBuffer)(c)).sign((0,i.stripHexPrefix)(h),{canonical:!0}).toDER("hex");return(0,s.encode)(`0x${S}`,l)}verify(n,c,l){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}let S=(0,i.toBuffer)(l);return this.pkHasFormatPrefix===!1&&S[0]!==4&&S.byteLength===64&&(S=C.concat([C.from([4]),S])),d.keyFromPublic(S).verify((0,i.stripHexPrefix)(h),(0,i.stripHexPrefix)((0,i.toHex)(c)))}}return ue.Secp256k1Signer=y,ue.default=new y,ue}var kt;function yn(){if(kt)return le;kt=1;var e=le&&le.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(le,"__esModule",{value:!0}),le.EthereumSigner=void 0;const o=e(yr()),i=e(mr()),u=se(),a=vr();class s extends a.Secp256k1Signer{constructor(){super(),this.pkHasFormatPrefix=!1}ethHash(d){const y=(0,u.isHexStrict)(d)?d:(0,u.utf8ToHex)(d),g=(0,u.hexToBytes)(y),n=C.from(g),c=`Ethereum Signed Message:
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DIfIqZRw.js","assets/index-D5Esor4q.js","assets/vendor-mui-core-CmD-NPnl.js","assets/vendor-react-Dvs43sk9.js","assets/vendor-ux-pYOhjQLA.js","assets/vendor-utils-DQK0pEML.js","assets/vendor-hooks-DLNZ8kxG.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-DEa0A9MF.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 Kr}from"./vendor-react-Dvs43sk9.js";import{r as tr,a as rr,b as nr,c as ir,d as ut,e as sr,f as or,g as ar,h as ft,i as cr,j as lr,k as ur,m as Ie,n as fr,o as dr,p as hr,q as ve,s as pr,t as yr,u as mr,v as gr,an as Ir,b9 as Lr,T as $e,H as Ke,_ as qr,$ as _r,a6 as Ne,ac as Mr,O as Fr}from"./vendor-ux-pYOhjQLA.js";import{j as r,Y as dt,bB as ht,I as pt,aj as yt,$ as mt,b1 as _e,T as X,ak as R,z as V,F as M,b7 as Wr,b5 as br,b6 as Sr,a5 as Er,a3 as gt,aX as xr,R as Tr,Q as je,a6 as _t,W as w,am as Vr,cf as Hr,cg as zr,ch as Yr}from"./vendor-mui-core-CmD-NPnl.js";import{B as Xr,o as Jr,l as Gr}from"./index-DDpL_qpY.js";import{u as Zr}from"./useAsyncRetry-6TjWJyO6.js";import{w as Br,B as C,o as Qr,b as en,C as Ht}from"./vendor-utils-DQK0pEML.js";import{r as tn}from"./hdkey-CcHIRiJU.js";import{Z as Re,c as ie,a8 as rn}from"./index-D5Esor4q.js";import{u as ke}from"./team-CGGZIbfh.js";import{u as jr,C as z}from"./index.esm-JPZAjt0x.js";import{T as nn}from"./index-DL5x17V7.js";import{E as sn}from"./empty-spinner-DCC7mgEb.js";import{C as q}from"./click-to-copy-Dqmzk5Lh.js";import{D as on}from"./delete-confirm-BIF7Oky1.js";import{a as an}from"./passport-item-CtgFdOsh.js";import{A as cn}from"./actions-CL4xTGOh.js";import{T as Bt}from"./table-tips-CgCabdgD.js";import{u as ln}from"./use-mobile-D93Bk2Ru.js";import"./vendor-hooks-DLNZ8kxG.js";import"./lottie-web-4koyQiv_.js";import"./useAsync-CNAYLnLm.js";import"./vendor-arcblock-DEa0A9MF.js";import"./session-DGB-yOme.js";import"./isURL-DZGsNcmL.js";import"./use-app-logo-DxlfjGOQ.js";import"./arrow-down.svg-DNHk5QBL.js";import"./vendor-mui-x--K2rEM1j.js";import"./AdapterDayjs-Ch1GqpK7.js";import"./confirm-DUjUXcfn.js";import"./index-DBs9Ljax.js";import"./did-address-CNnw4_bl.js";import"./util-CYsTlK2W.js";import"./base32-9HlsUoU3.js";var Ae={},Ce={},Z={},re={},jt;function un(){if(jt)return re;jt=1;var e=re&&re.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(re,"__esModule",{value:!0}),re.BaseBN=re.BN=void 0;const o=e(Br());re.BaseBN=o.default;class i extends o.default{constructor(a,s,p){super(a===null?"0":a,s,p)}}return re.BN=i,re}var vt;function se(){return vt||(vt=1,function(e){var o=Z&&Z.__createBinding||(Object.create?function(t,f,m,U){U===void 0&&(U=m);var E=Object.getOwnPropertyDescriptor(f,m);(!E||("get"in E?!f.__esModule:E.writable||E.configurable))&&(E={enumerable:!0,get:function(){return f[m]}}),Object.defineProperty(t,U,E)}:function(t,f,m,U){U===void 0&&(U=m),t[U]=f[m]}),i=Z&&Z.__setModuleDefault||(Object.create?function(t,f){Object.defineProperty(t,"default",{enumerable:!0,value:f})}:function(t,f){t.default=f}),u=Z&&Z.__importStar||function(t){if(t&&t.__esModule)return t;var f={};if(t!=null)for(var m in t)m!=="default"&&Object.prototype.hasOwnProperty.call(t,m)&&o(f,t,m);return i(f,t),f},a=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=be,e.UUID=Qe,e.isUUID=et,e.toUint8Array=Se,e.toBuffer=Oe,e.toBase58=tt,e.fromBase58=rt,e.toBase64=nt,e.fromBase64=it,e.toAddress=te,e.toDid=st,e.isSameDid=ot,e.formatTxType=at;const s=a(tr),p=a(rr),d=a(nr),y=a(ir),g=a(ut),n=a(sr),c=a(or),l=a(ar);e.rightPad=l.default;const h=a(ft);e.leftPad=h.default;const S=a(cr()),_=a(lr()),H=u(ur()),x=un();Object.defineProperty(e,"BN",{enumerable:!0,get:function(){return x.BN}});const k="did:abt:",B=new x.BN(0),T=new x.BN(-1),j={encode:t=>`z${S.default.encode(t)}`,decode:t=>S.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 b=t=>{if(typeof t=="string"||typeof t=="number"){let f=new x.BN(1);const m=String(t).toLowerCase().trim(),U=m.substr(0,2)==="0x"||m.substr(0,3)==="-0x";let E=(0,e.stripHexPrefix)(m);if(E.substr(0,1)==="-"&&(E=(0,e.stripHexPrefix)(E.slice(1)),f=new x.BN(-1,10)),E=E===""?"0":E,!E.match(/^-?[0-9]+$/)&&E.match(/^[0-9A-Fa-f]+$/)||E.match(/^[a-fA-F]+$/)||U===!0&&E.match(/^[0-9A-Fa-f]+$/))return new x.BN(E,16).mul(f);if((E.match(/^-?[0-9]+$/)||E==="")&&U===!1)return new x.BN(E,10).mul(f)}if((0,e.isBN)(t))return new x.BN(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=b;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 A=t=>t instanceof x.BN||t instanceof x.BaseBN||t&&t.constructor&&t.constructor.name==="BN";e.isBN=A;const K=t=>t&&t.constructor&&t.constructor.name==="BigNumber";e.isBigNumber=K;const ee=t=>((0,p.default)(t)||(0,d.default)(t))&&/^(-)?0x[0-9a-f]*$/i.test(t);e.isHexStrict=ee;const Le=t=>((0,p.default)(t)||(0,d.default)(t))&&/^(-0x|0x|0X|-0X)?[0-9a-f]*$/i.test(t);e.isHex=Le;const qe=(t,f=10)=>{try{if(typeof t=="number"&&t>0){const m=Number(t).toLocaleString("fullwide",{useGrouping:!1});return new x.BN(m,f)}return(0,e.numberToBN)(t)}catch(m){throw new Error(`${m} Given value: "${t}"`)}};e.toBN=qe;const Me=t=>{t=H.encode(t);let f="";t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join(""),t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join("");for(let m=0;m<t.length;m++){const E=t.charCodeAt(m).toString(16);f+=E.length<2?`0${E}`:E}return`0x${f}`};e.utf8ToHex=Me;const Fe=t=>{if(!(0,e.isHexStrict)(t))throw new Error(`The parameter "${t}" must be a valid HEX string.`);let f="",m=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 E=0;E<U;E+=2)m=parseInt(t.substr(E,2),16),f+=String.fromCharCode(m);return H.decode(f)};e.hexToUtf8=Fe;const We=t=>t?(0,e.toBN)(t).toNumber():0;e.hexToNumber=We;const Ve=t=>{if((0,c.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 f=(0,e.toBN)(t),m=f.toString(16);return f.lt(new x.BN(0))?`-0x${m.substr(1)}`:`0x${m}`};e.numberToHex=Ve;const ze=t=>{const f=[];for(let m=0;m<t.length;m++)f.push((t[m]>>>4).toString(16)),f.push((t[m]&15).toString(16));return`0x${f.join("")}`};e.bytesToHex=ze;const Ye=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 f=[];for(let m=0;m<t.length;m+=2)f.push(parseInt(t.substr(m,2),16));return f};e.hexToBytes=Ye;const Xe=(t,f=!1)=>be(t)||C.isBuffer(t)?f?"bytes":(0,e.bytesToHex)(t):(0,e.isBase58btc)(t)?f?"bytes":(0,e.bytesToHex)(j.decode(t)):(0,s.default)(t)?f?"bool":t?"0x01":"0x00":(0,y.default)(t)&&!(0,e.isBigNumber)(t)&&!(0,e.isBN)(t)?f?"string":(0,e.utf8ToHex)(JSON.stringify(t)):typeof t=="string"?t.indexOf("-0x")===0||t.indexOf("-0X")===0?f?"int256":(0,e.numberToHex)(t):t.indexOf("0x")===0||t.indexOf("0X")===0?f?"bytes":t:f?"string":(0,e.utf8ToHex)(t):f?+t<0?"int256":"uint256":(0,e.numberToHex)(t);e.toHex=Xe;const Je=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=Je;const Ge=(t,f=18,m={})=>{let U=(0,e.toBN)(t);const E=U.lt(B),F=(0,e.toBN)(`1${"0".repeat(f)}`,10),G=F.toString(10).length-1||1,N=m||{};E&&(U=U.mul(T));let $=U.mod(F).toString(10);for(;$.length<G;)$=`0${$}`;N.pad||($=$.match(/^([0-9]*[1-9]|0)(0*)/)[1]);let L=U.div(F).toString(10);N.commify&&(L=L.replace(/\B(?=(\d{3})+(?!\d))/g,","));let Ee=`${L}${$==="0"?"":`.${$}`}`;return E&&(Ee=`-${Ee}`),Ee};e.fromUnitToToken=Ge;const Ze=(t,f=18)=>{let m=(0,e.numberToString)(t);const U=(0,e.toBN)(`1${"0".repeat(f)}`,10),E=U.toString(10).length-1||1,F=m.substring(0,1)==="-";if(F&&(m=m.substring(1)),m===".")throw new Error(`error converting token ${t} to unit, invalid value`);const G=m.split(".");if(G.length>2)throw new Error(`error converting token ${t} to unit, too many decimal points`);let N=G[0],$=G[1];if(N||(N="0"),$||($="0"),$.length>E)throw new Error(`error converting token ${t} to unit, too many decimal places`);for(;$.length<E;)$+="0";N=new x.BN(N),$=new x.BN($);let L=N.mul(U).add($);return F&&(L=L.mul(T)),new x.BN(L.toString(10),10)};e.fromTokenToUnit=Ze;function be(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Qe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const f=Math.random()*16|0;return(t==="x"?f:f&3|8).toString(16)})}function et(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 Se(t){let f=null;if([null,void 0,""].includes(t))f=new Uint8Array;else if(C.isBuffer(t))f=new Uint8Array(t);else if((0,e.isHexStrict)(t))f=new Uint8Array((0,e.hexToBytes)(t));else if(be(t))f=new Uint8Array(t);else if((0,e.isBase58btc)(t))f=new Uint8Array(j.decode(t));else if(typeof t=="string")f=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 f}function Oe(t){return C.from(Se(t))}function tt(t){const f=j.encode(Se(t));return C.from(f).toString("utf-8")}function rt(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 nt(t,f=!0){const m=_.default.encode(Oe(t));return f?_.default.escape(m):m}function it(t){if(typeof t!="string")throw new Error("fromBase64 requires input to be a string");return C.from(_.default.unescape(t),"base64")}function te(t){return t.replace(k,"")}function st(t){return`${k}${te(t)}`}function ot(t,f){return te(t).toLowerCase()===te(f).toLowerCase()}function at(t){return(0,g.default)((0,n.default)(t))}}(Z)),Z}var wt;function we(){if(wt)return Ce;wt=1,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.encode=o;const e=se();function o(i,u="hex"){return["hex","base16"].includes(u)?(0,e.toHex)(i):u==="base58"?(0,e.toBase58)(i):u==="base64"?(0,e.toBase64)(i):u==="Uint8Array"?(0,e.toUint8Array)(i):u==="buffer"?(0,e.toBuffer)(i):i}return Ce}var oe={},Ut;function fn(){if(Ut)return oe;Ut=1;var e=oe&&oe.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(oe,"__esModule",{value:!0}),oe.KeccakHasher=void 0;const o=e(Ie()),i=se(),u=we();class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=n=>o.default[`keccak${p}`](n),g=(n,c)=>c===1?y(n):g(y(n),c-1);this[d]=(n,c=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=g(h,c);return(0,u.encode)(`0x${S}`,l)}})}}return oe.KeccakHasher=a,oe.default=new a,oe}var xe={},Ot;function dn(){if(Ot)return xe;Ot=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.Sha2Hasher=void 0;const e=se(),o=fr(),i=we(),u={sha224:o.sha224,sha256:o.sha256,sha384:o.sha384,sha512:o.sha512};class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=u[`sha${p}`],g=(n,c)=>{let l=n;try{l=(0,e.toUint8Array)(n)}catch{}return c===1?`0x${y().update(l).digest("hex")}`:g(g(l,1),c-1)};this[d]=(n,c=2,l="hex")=>{const h=g(n,c);return(0,i.encode)(h,l)}})}}return xe.Sha2Hasher=a,xe.default=new a,xe}var ae={},At;function hn(){if(At)return ae;At=1;var e=ae&&ae.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ae,"__esModule",{value:!0}),ae.Sha3Hasher=void 0;const o=e(Ie()),i=se(),u=we();class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=o.default[`sha3_${p}`],g=(n,c)=>c===1?y(n):g(y(n),c-1);this[d]=(n,c=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=g(h,c);return(0,u.encode)(`0x${S}`,l)}})}}return ae.Sha3Hasher=a,ae.default=new a,ae}var ce={},Te={},Pt;function bt(){if(Pt)return Te;Pt=1;var e=Te&&Te.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Te,"__esModule",{value:!0});const o=e(dr());return Te.default=o.default.create("genKeyPair","getPublicKey","sign","verify"),Te}var $t;function pn(){if($t)return ce;$t=1;var e=ce&&ce.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(ce,"__esModule",{value:!0}),ce.Ed25519Signer=void 0;const o=e(hr()),i=e(ve()),u=se(),a=e(bt()),s=we(),p=o.default.sign;class d extends a.default{constructor(){super()}genKeyPair(g="hex",n){const c=n?(0,u.toUint8Array)(n):new Uint8Array((0,i.default)(32));if(c.byteLength!==32)throw new Error("Invalid seed to generate key pair");const l=p.keyPair.fromSeed(c);return l.publicKey=(0,s.encode)(l.publicKey,g),l.secretKey=(0,s.encode)(l.secretKey,g),l}getPublicKey(g,n="hex"){const c=(0,u.toUint8Array)(g),l=p.keyPair.fromSecretKey(c).publicKey;return(0,s.encode)(l,n)}sign(g,n,c="hex"){const l=(0,u.toUint8Array)(n),h=(0,u.toUint8Array)(g),S=p.detached(h,l);return(0,s.encode)(S,c)}verify(g,n,c){const l=(0,u.toUint8Array)(c),h=(0,u.toUint8Array)(g),S=(0,u.toUint8Array)(n);return p.detached.verify(h,S,l)}}return ce.Ed25519Signer=d,ce.default=new d,ce}var le={},ue={},Rt;function vr(){if(Rt)return ue;Rt=1;var e=ue&&ue.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(ue,"__esModule",{value:!0}),ue.Secp256k1Signer=void 0;const o=e(pr()),i=se(),u=e(ve()),a=e(bt()),s=we(),p=o.default.ec,d=new p("secp256k1");class y extends a.default{constructor(){super(),this.pkHasFormatPrefix=!0,this.pkCompressed=!1}isValidSK(n){if(n.byteLength!==32)return!1;const c=new i.BN(n);return c.cmp(d.curve.n)<0&&!c.isZero()}genKeyPair(n="hex"){let c=null;do c=new Uint8Array((0,u.default)(32));while(!this.isValidSK(c));const l=this.getPublicKey((0,i.toHex)(c));return{secretKey:(0,s.encode)(c,n),publicKey:(0,s.encode)(l,n)}}getPublicKey(n,c="hex"){if(!this.isValidSK((0,i.toUint8Array)(n)))throw new Error("Invalid secret key");let l=d.keyFromPrivate((0,i.toBuffer)(n)).getPublic(this.pkCompressed,"hex");return this.pkHasFormatPrefix===!1&&(l=l.slice(2)),(0,s.encode)(`0x${l}`,c)}sign(n,c,l="hex"){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=d.keyFromPrivate((0,i.toBuffer)(c)).sign((0,i.stripHexPrefix)(h),{canonical:!0}).toDER("hex");return(0,s.encode)(`0x${S}`,l)}verify(n,c,l){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}let S=(0,i.toBuffer)(l);return this.pkHasFormatPrefix===!1&&S[0]!==4&&S.byteLength===64&&(S=C.concat([C.from([4]),S])),d.keyFromPublic(S).verify((0,i.stripHexPrefix)(h),(0,i.stripHexPrefix)((0,i.toHex)(c)))}}return ue.Secp256k1Signer=y,ue.default=new y,ue}var kt;function yn(){if(kt)return le;kt=1;var e=le&&le.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(le,"__esModule",{value:!0}),le.EthereumSigner=void 0;const o=e(yr()),i=e(mr()),u=se(),a=vr();class s extends a.Secp256k1Signer{constructor(){super(),this.pkHasFormatPrefix=!1}ethHash(d){const y=(0,u.isHexStrict)(d)?d:(0,u.utf8ToHex)(d),g=(0,u.hexToBytes)(y),n=C.from(g),c=`Ethereum Signed Message:
3
3
  ${g.length}`,l=C.from(c),h=C.concat([l,n]);return i.default.keccak256s(h)}ethSign(d,y){return o.default.sign(d,y)}ethRecover(d,y){return o.default.recover(d,y)}}return le.EthereumSigner=s,le.default=new s,le}var fe={},Ct;function mn(){if(Ct)return fe;Ct=1;var e=fe&&fe.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(fe,"__esModule",{value:!0}),fe.PasskeySigner=void 0;const o=se(),i=gr(),u=e(bt());class a extends u.default{constructor(){super()}genKeyPair(p="hex",d){throw new Error("Not supported")}getPublicKey(p,d="hex"){throw new Error("Not supported")}sign(p,d,y="hex"){throw new Error("Not supported")}async verify(p,d,y,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 c=(0,o.toBuffer)((0,o.fromBase64)(n.authenticatorData)),l=await(0,i.toHash)(i.isoBase64URL.toBuffer(n.clientDataJSON));if((0,i.decodeClientDataJSON)(n.clientDataJSON).challenge!==(0,o.toBase64)(p))throw new Error("challenge mismatch for passkey signature");return(0,i.verifySignature)({signature:i.isoBase64URL.toBuffer(typeof d=="string"?d:(0,o.toBase64)(d)),data:i.isoUint8Array.concat([c,l]),credentialPublicKey:y})}}return fe.PasskeySigner=a,fe.default=new a,fe}var Dt;function gn(){return Dt||(Dt=1,function(e){var o=Ae&&Ae.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(e,"__esModule",{value:!0}),e.toTxHash=e.Hashers=e.Signers=e.types=e.Hasher=e.Signer=void 0,e.getSigner=c,e.getHasher=l,e.getRandomBytes=h;const i=o(ve()),u=we(),a=o(fn()),s=o(dn()),p=o(hn()),d=o(pn()),y=o(yn()),g=o(vr()),n=o(mn());e.Signer={Ed25519:d.default,Secp256k1:g.default,Ethereum:y.default,Passkey:n.default},e.Hasher={SHA2:s.default,SHA3:p.default,Keccak:a.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 c(_){if(typeof e.Signers[_]>"u")throw new Error(`Unsupported signer type: ${_}`);return e.Signers[_]}function l(_){if(typeof e.Hashers[_]>"u")throw new Error(`Unsupported hash type: ${_}`);return e.Hashers[_]}function h(_=32,H="hex"){return(0,u.encode)((0,i.default)(_),H)}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 S=_=>e.Hasher.SHA2.hash256(_,1,"hex").replace(/^0x/,"").toUpperCase();e.toTxHash=S}(Ae)),Ae}var Y={},Q={},ne={},Nt;function _n(){if(Nt)return ne;Nt=1;var e=ne&&ne.__importDefault||function(u){return u&&u.__esModule?u:{default:u}};Object.defineProperty(ne,"__esModule",{value:!0}),ne.BaseBN=ne.BN=void 0;const o=e(Br());ne.BaseBN=o.default;class i extends o.default{constructor(a,s,p){super(a===null?"0":a,s,p)}}return ne.BN=i,ne}var Kt;function J(){return Kt||(Kt=1,function(e){var o=Q&&Q.__createBinding||(Object.create?function(t,f,m,U){U===void 0&&(U=m);var E=Object.getOwnPropertyDescriptor(f,m);(!E||("get"in E?!f.__esModule:E.writable||E.configurable))&&(E={enumerable:!0,get:function(){return f[m]}}),Object.defineProperty(t,U,E)}:function(t,f,m,U){U===void 0&&(U=m),t[U]=f[m]}),i=Q&&Q.__setModuleDefault||(Object.create?function(t,f){Object.defineProperty(t,"default",{enumerable:!0,value:f})}:function(t,f){t.default=f}),u=Q&&Q.__importStar||function(t){if(t&&t.__esModule)return t;var f={};if(t!=null)for(var m in t)m!=="default"&&Object.prototype.hasOwnProperty.call(t,m)&&o(f,t,m);return i(f,t),f},a=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=be,e.UUID=Qe,e.isUUID=et,e.toUint8Array=Se,e.toBuffer=Oe,e.toBase58=tt,e.fromBase58=rt,e.toBase64=nt,e.fromBase64=it,e.toAddress=te,e.toDid=st,e.isSameDid=ot,e.formatTxType=at;const s=a(tr),p=a(rr),d=a(nr),y=a(ir),g=a(ut),n=a(sr),c=a(or),l=a(ar);e.rightPad=l.default;const h=a(ft);e.leftPad=h.default;const S=a(cr()),_=a(lr()),H=u(ur()),x=_n();Object.defineProperty(e,"BN",{enumerable:!0,get:function(){return x.BN}});const k="did:abt:",B=new x.BN(0),T=new x.BN(-1),j={encode:t=>`z${S.default.encode(t)}`,decode:t=>S.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 b=t=>{if(typeof t=="string"||typeof t=="number"){let f=new x.BN(1);const m=String(t).toLowerCase().trim(),U=m.substr(0,2)==="0x"||m.substr(0,3)==="-0x";let E=(0,e.stripHexPrefix)(m);if(E.substr(0,1)==="-"&&(E=(0,e.stripHexPrefix)(E.slice(1)),f=new x.BN(-1,10)),E=E===""?"0":E,!E.match(/^-?[0-9]+$/)&&E.match(/^[0-9A-Fa-f]+$/)||E.match(/^[a-fA-F]+$/)||U===!0&&E.match(/^[0-9A-Fa-f]+$/))return new x.BN(E,16).mul(f);if((E.match(/^-?[0-9]+$/)||E==="")&&U===!1)return new x.BN(E,10).mul(f)}if((0,e.isBN)(t))return new x.BN(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=b;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 A=t=>t instanceof x.BN||t instanceof x.BaseBN||t&&t.constructor&&t.constructor.name==="BN";e.isBN=A;const K=t=>t&&t.constructor&&t.constructor.name==="BigNumber";e.isBigNumber=K;const ee=t=>((0,p.default)(t)||(0,d.default)(t))&&/^(-)?0x[0-9a-f]*$/i.test(t);e.isHexStrict=ee;const Le=t=>((0,p.default)(t)||(0,d.default)(t))&&/^(-0x|0x|0X|-0X)?[0-9a-f]*$/i.test(t);e.isHex=Le;const qe=(t,f=10)=>{try{if(typeof t=="number"&&t>0){const m=Number(t).toLocaleString("fullwide",{useGrouping:!1});return new x.BN(m,f)}return(0,e.numberToBN)(t)}catch(m){throw new Error(`${m} Given value: "${t}"`)}};e.toBN=qe;const Me=t=>{t=H.encode(t);let f="";t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join(""),t=t.replace(/^(?:\u0000)*/,""),t=t.split("").reverse().join("");for(let m=0;m<t.length;m++){const E=t.charCodeAt(m).toString(16);f+=E.length<2?`0${E}`:E}return`0x${f}`};e.utf8ToHex=Me;const Fe=t=>{if(!(0,e.isHexStrict)(t))throw new Error(`The parameter "${t}" must be a valid HEX string.`);let f="",m=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 E=0;E<U;E+=2)m=parseInt(t.substr(E,2),16),f+=String.fromCharCode(m);return H.decode(f)};e.hexToUtf8=Fe;const We=t=>t?(0,e.toBN)(t).toNumber():0;e.hexToNumber=We;const Ve=t=>{if((0,c.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 f=(0,e.toBN)(t),m=f.toString(16);return f.lt(new x.BN(0))?`-0x${m.substr(1)}`:`0x${m}`};e.numberToHex=Ve;const ze=t=>{const f=[];for(let m=0;m<t.length;m++)f.push((t[m]>>>4).toString(16)),f.push((t[m]&15).toString(16));return`0x${f.join("")}`};e.bytesToHex=ze;const Ye=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 f=[];for(let m=0;m<t.length;m+=2)f.push(parseInt(t.substr(m,2),16));return f};e.hexToBytes=Ye;const Xe=(t,f=!1)=>be(t)||C.isBuffer(t)?f?"bytes":(0,e.bytesToHex)(t):(0,e.isBase58btc)(t)?f?"bytes":(0,e.bytesToHex)(j.decode(t)):(0,s.default)(t)?f?"bool":t?"0x01":"0x00":(0,y.default)(t)&&!(0,e.isBigNumber)(t)&&!(0,e.isBN)(t)?f?"string":(0,e.utf8ToHex)(JSON.stringify(t)):typeof t=="string"?t.indexOf("-0x")===0||t.indexOf("-0X")===0?f?"int256":(0,e.numberToHex)(t):t.indexOf("0x")===0||t.indexOf("0X")===0?f?"bytes":t:f?"string":(0,e.utf8ToHex)(t):f?+t<0?"int256":"uint256":(0,e.numberToHex)(t);e.toHex=Xe;const Je=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=Je;const Ge=(t,f=18,m={})=>{let U=(0,e.toBN)(t);const E=U.lt(B),F=(0,e.toBN)(`1${"0".repeat(f)}`,10),G=F.toString(10).length-1||1,N=m||{};E&&(U=U.mul(T));let $=U.mod(F).toString(10);for(;$.length<G;)$=`0${$}`;N.pad||($=$.match(/^([0-9]*[1-9]|0)(0*)/)[1]);let L=U.div(F).toString(10);N.commify&&(L=L.replace(/\B(?=(\d{3})+(?!\d))/g,","));let Ee=`${L}${$==="0"?"":`.${$}`}`;return E&&(Ee=`-${Ee}`),Ee};e.fromUnitToToken=Ge;const Ze=(t,f=18)=>{let m=(0,e.numberToString)(t);const U=(0,e.toBN)(`1${"0".repeat(f)}`,10),E=U.toString(10).length-1||1,F=m.substring(0,1)==="-";if(F&&(m=m.substring(1)),m===".")throw new Error(`error converting token ${t} to unit, invalid value`);const G=m.split(".");if(G.length>2)throw new Error(`error converting token ${t} to unit, too many decimal points`);let N=G[0],$=G[1];if(N||(N="0"),$||($="0"),$.length>E)throw new Error(`error converting token ${t} to unit, too many decimal places`);for(;$.length<E;)$+="0";N=new x.BN(N),$=new x.BN($);let L=N.mul(U).add($);return F&&(L=L.mul(T)),new x.BN(L.toString(10),10)};e.fromTokenToUnit=Ze;function be(t){return Object.prototype.toString.call(t)==="[object Uint8Array]"}function Qe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const f=Math.random()*16|0;return(t==="x"?f:f&3|8).toString(16)})}function et(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 Se(t){let f=null;if([null,void 0,""].includes(t))f=new Uint8Array;else if(C.isBuffer(t))f=new Uint8Array(t);else if((0,e.isHexStrict)(t))f=new Uint8Array((0,e.hexToBytes)(t));else if(be(t))f=new Uint8Array(t);else if((0,e.isBase58btc)(t))f=new Uint8Array(j.decode(t));else if(typeof t=="string")f=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 f}function Oe(t){return C.from(Se(t))}function tt(t){const f=j.encode(Se(t));return C.from(f).toString("utf-8")}function rt(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 nt(t,f=!0){const m=_.default.encode(Oe(t));return f?_.default.escape(m):m}function it(t){if(typeof t!="string")throw new Error("fromBase64 requires input to be a string");return C.from(_.default.unescape(t),"base64")}function te(t){return t.replace(k,"")}function st(t){return`${k}${te(t)}`}function ot(t,f){return te(t).toLowerCase()===te(f).toLowerCase()}function at(t){return(0,g.default)((0,n.default)(t))}}(Q)),Q}var Pe={},De={},It;function Ue(){if(It)return De;It=1,Object.defineProperty(De,"__esModule",{value:!0}),De.encode=o;const e=J();function o(i,u="hex"){return["hex","base16"].includes(u)?(0,e.toHex)(i):u==="base58"?(0,e.toBase58)(i):u==="base64"?(0,e.toBase64)(i):u==="Uint8Array"?(0,e.toUint8Array)(i):u==="buffer"?(0,e.toBuffer)(i):i}return De}var de={},Lt;function bn(){if(Lt)return de;Lt=1;var e=de&&de.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(de,"__esModule",{value:!0}),de.KeccakHasher=void 0;const o=e(Ie()),i=J(),u=Ue();class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=n=>o.default[`keccak${p}`](n),g=(n,c)=>c===1?y(n):g(y(n),c-1);this[d]=(n,c=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=g(h,c);return(0,u.encode)(`0x${S}`,l)}})}}return de.KeccakHasher=a,de.default=new a,de}var He={},qt;function Sn(){if(qt)return He;qt=1,Object.defineProperty(He,"__esModule",{value:!0}),He.Sha2Hasher=void 0;const e=J(),o=fr(),i=Ue(),u={sha224:o.sha224,sha256:o.sha256,sha384:o.sha384,sha512:o.sha512};class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=u[`sha${p}`],g=(n,c)=>{let l=n;try{l=(0,e.toUint8Array)(n)}catch{}return c===1?`0x${y().update(l).digest("hex")}`:g(g(l,1),c-1)};this[d]=(n,c=2,l="hex")=>{const h=g(n,c);return(0,i.encode)(h,l)}})}}return He.Sha2Hasher=a,He.default=new a,He}var he={},Mt;function En(){if(Mt)return he;Mt=1;var e=he&&he.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(he,"__esModule",{value:!0}),he.Sha3Hasher=void 0;const o=e(Ie()),i=J(),u=Ue();class a{constructor(){[224,256,384,512].forEach(p=>{const d=`hash${p}`,y=o.default[`sha3_${p}`],g=(n,c)=>c===1?y(n):g(y(n),c-1);this[d]=(n,c=1,l="hex")=>{let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=g(h,c);return(0,u.encode)(`0x${S}`,l)}})}}return he.Sha3Hasher=a,he.default=new a,he}var pe={},Be={},Ft;function St(){if(Ft)return Be;Ft=1;var e=Be&&Be.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty(Be,"__esModule",{value:!0});const o=e(dr());return Be.default=o.default.create("genKeyPair","getPublicKey","sign","verify"),Be}var Wt;function xn(){if(Wt)return pe;Wt=1;var e=pe&&pe.__importDefault||function(y){return y&&y.__esModule?y:{default:y}};Object.defineProperty(pe,"__esModule",{value:!0}),pe.Ed25519Signer=void 0;const o=e(hr()),i=e(ve()),u=J(),a=e(St()),s=Ue(),p=o.default.sign;class d extends a.default{constructor(){super()}genKeyPair(g="hex",n){const c=n?(0,u.toUint8Array)(n):new Uint8Array((0,i.default)(32));if(c.byteLength!==32)throw new Error("Invalid seed to generate key pair");const l=p.keyPair.fromSeed(c);return l.publicKey=(0,s.encode)(l.publicKey,g),l.secretKey=(0,s.encode)(l.secretKey,g),l}getPublicKey(g,n="hex"){const c=(0,u.toUint8Array)(g),l=p.keyPair.fromSecretKey(c).publicKey;return(0,s.encode)(l,n)}sign(g,n,c="hex"){const l=(0,u.toUint8Array)(n),h=(0,u.toUint8Array)(g),S=p.detached(h,l);return(0,s.encode)(S,c)}verify(g,n,c){const l=(0,u.toUint8Array)(c),h=(0,u.toUint8Array)(g),S=(0,u.toUint8Array)(n);return p.detached.verify(h,S,l)}}return pe.Ed25519Signer=d,pe.default=new d,pe}var ye={},me={},Vt;function wr(){if(Vt)return me;Vt=1;var e=me&&me.__importDefault||function(g){return g&&g.__esModule?g:{default:g}};Object.defineProperty(me,"__esModule",{value:!0}),me.Secp256k1Signer=void 0;const o=e(pr()),i=J(),u=e(ve()),a=e(St()),s=Ue(),p=o.default.ec,d=new p("secp256k1");class y extends a.default{constructor(){super(),this.pkHasFormatPrefix=!0,this.pkCompressed=!1}isValidSK(n){if(n.byteLength!==32)return!1;const c=new i.BN(n);return c.cmp(d.curve.n)<0&&!c.isZero()}genKeyPair(n="hex"){let c=null;do c=new Uint8Array((0,u.default)(32));while(!this.isValidSK(c));const l=this.getPublicKey((0,i.toHex)(c));return{secretKey:(0,s.encode)(c,n),publicKey:(0,s.encode)(l,n)}}getPublicKey(n,c="hex"){if(!this.isValidSK((0,i.toUint8Array)(n)))throw new Error("Invalid secret key");let l=d.keyFromPrivate((0,i.toBuffer)(n)).getPublic(this.pkCompressed,"hex");return this.pkHasFormatPrefix===!1&&(l=l.slice(2)),(0,s.encode)(`0x${l}`,c)}sign(n,c,l="hex"){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}const S=d.keyFromPrivate((0,i.toBuffer)(c)).sign((0,i.stripHexPrefix)(h),{canonical:!0}).toDER("hex");return(0,s.encode)(`0x${S}`,l)}verify(n,c,l){let h=n;try{h=(0,i.toUint8Array)(n)}catch{}let S=(0,i.toBuffer)(l);return this.pkHasFormatPrefix===!1&&S[0]!==4&&S.byteLength===64&&(S=C.concat([C.from([4]),S])),d.keyFromPublic(S).verify((0,i.stripHexPrefix)(h),(0,i.stripHexPrefix)((0,i.toHex)(c)))}}return me.Secp256k1Signer=y,me.default=new y,me}var zt;function Tn(){if(zt)return ye;zt=1;var e=ye&&ye.__importDefault||function(p){return p&&p.__esModule?p:{default:p}};Object.defineProperty(ye,"__esModule",{value:!0}),ye.EthereumSigner=void 0;const o=e(yr()),i=e(mr()),u=J(),a=wr();class s extends a.Secp256k1Signer{constructor(){super(),this.pkHasFormatPrefix=!1}ethHash(d){const y=(0,u.isHexStrict)(d)?d:(0,u.utf8ToHex)(d),g=(0,u.hexToBytes)(y),n=C.from(g),c=`Ethereum Signed Message:
4
- ${g.length}`,l=C.from(c),h=C.concat([l,n]);return i.default.keccak256s(h)}ethSign(d,y){return o.default.sign(d,y)}ethRecover(d,y){return o.default.recover(d,y)}}return ye.EthereumSigner=s,ye.default=new s,ye}var ge={},Yt;function Hn(){if(Yt)return ge;Yt=1;var e=ge&&ge.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ge,"__esModule",{value:!0}),ge.PasskeySigner=void 0;const o=J(),i=gr(),u=e(St());class a extends u.default{constructor(){super()}genKeyPair(p="hex",d){throw new Error("Not supported")}getPublicKey(p,d="hex"){throw new Error("Not supported")}sign(p,d,y="hex"){throw new Error("Not supported")}async verify(p,d,y,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 c=(0,o.toBuffer)((0,o.fromBase64)(n.authenticatorData)),l=await(0,i.toHash)(i.isoBase64URL.toBuffer(n.clientDataJSON));if((0,i.decodeClientDataJSON)(n.clientDataJSON).challenge!==(0,o.toBase64)(p))throw new Error("challenge mismatch for passkey signature");return(0,i.verifySignature)({signature:i.isoBase64URL.toBuffer(typeof d=="string"?d:(0,o.toBase64)(d)),data:i.isoUint8Array.concat([c,l]),credentialPublicKey:y})}}return ge.PasskeySigner=a,ge.default=new a,ge}var Xt;function Et(){return Xt||(Xt=1,function(e){var o=Pe&&Pe.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(e,"__esModule",{value:!0}),e.toTxHash=e.Hashers=e.Signers=e.types=e.Hasher=e.Signer=void 0,e.getSigner=c,e.getHasher=l,e.getRandomBytes=h;const i=o(ve()),u=Ue(),a=o(bn()),s=o(Sn()),p=o(En()),d=o(xn()),y=o(Tn()),g=o(wr()),n=o(Hn());e.Signer={Ed25519:d.default,Secp256k1:g.default,Ethereum:y.default,Passkey:n.default},e.Hasher={SHA2:s.default,SHA3:p.default,Keccak:a.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 c(_){if(typeof e.Signers[_]>"u")throw new Error(`Unsupported signer type: ${_}`);return e.Signers[_]}function l(_){if(typeof e.Hashers[_]>"u")throw new Error(`Unsupported hash type: ${_}`);return e.Hashers[_]}function h(_=32,H="hex"){return(0,u.encode)((0,i.default)(_),H)}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 S=_=>e.Hasher.SHA2.hash256(_,1,"hex").replace(/^0x/,"").toUpperCase();e.toTxHash=S}(Pe)),Pe}var ct={},D={},W={},Jt;function Ur(){if(Jt)return W;Jt=1;var e=W&&W.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(W,"__esModule",{value:!0}),W.toStrictHex=W.toBytes=W.toBits=W.DID_PREFIX=void 0;const o=e(ft),i=J(),u="did:abt:";W.DID_PREFIX=u;const a=d=>{try{if((0,i.isHexStrict)(d))return C.from((0,i.stripHexPrefix)(d),"hex");let y=(0,i.fromBase58)(d.replace(u,""));for(;y.length<26;)y=C.concat([C.from([0]),y]);return y}catch(y){throw new Error(`Cannot convert DID string to byte array: ${y.message}`)}};W.toBytes=a;const s=(d,y)=>(0,o.default)((0,i.toBN)(d).toString(2),y,"0");W.toBits=s;const p=(d,y)=>{const g=d.replace(/^0x/i,"");return typeof y=="number"&&y%2===0?(0,o.default)(d,y,"0"):g.length%2===0?g:`0${g}`};return W.toStrictHex=p,W}var Gt;function Bn(){if(Gt)return D;Gt=1;var e=D&&D.__importDefault||function(B){return B&&B.__esModule?B:{default:B}};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=_;const o=J(),i=e(ut),u=e(Ir),a=e(Lr),s=Et(),p=Ur(),d={pk:"key",address:"encoding"},y={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=y;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 c=B=>{const T=["pk","hash","address"];return(0,u.default)((0,a.default)(B,T),(0,a.default)(n,T))};D.isEthereumType=c;const l=B=>{const T=(0,o.toAddress)(B);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=B=>{const T=B.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},S=B=>{if(typeof B>"u")return"";if(!/^(0x)?[0-9a-f]{40}$/i.test(B))throw new Error(`Given address "${B}" is not a valid Ethereum address.`);const T=B.toLowerCase().replace(/^0x/i,""),j=s.Hasher.Keccak.hash256(T).replace(/^0x/i,"");let O="0x";for(let b=0;b<T.length;b++)parseInt(j[b],16)>7?O+=T[b].toUpperCase():O+=T[b];return O};D.toChecksumAddress=S;function _(B={}){let T={};["default","arcblock"].includes(B)?T=y:["eth","ethereum"].includes(B)?T=n:["passkey"].includes(B)?T=g:T={...y,...B};const{role:j,pk:O,hash:b,address:v}=T;Object.keys(T).forEach(A=>{const K=(0,i.default)(`${d[A]||A}Type`);if(Object.values(s.types[K]).includes(T[A])===!1)throw new Error(`Unsupported ${A} type: ${T[A]}`)});const P={role:j,pk:O,hash:b,address:v};return c(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}_.toJSON=B=>Object.keys(B).reduce((T,j)=>{const O=(0,i.default)(`${d[j]||j}Type`),b=Object.keys(s.types[O]),v=Object.values(s.types[O]);return T[j]=b[v.indexOf(B[j])],T},{}),_.fromJSON=B=>Object.keys(B).reduce((T,j)=>{const O=(0,i.default)(`${d[j]||j}Type`),b=Object.keys(s.types[O]),v=Object.values(s.types[O]);return T[j]=v[b.indexOf(B[j])],T},{});const H=B=>{const T=_(B),j=(0,p.toBits)(T.role,6),O=(0,p.toBits)(T.pk,5),b=(0,p.toBits)(T.hash,5),v=`${j}${O}${b}`,P=(0,o.stripHexPrefix)((0,o.numberToHex)(parseInt(v,2)));return(0,p.toStrictHex)(P,4)};D.fromTypeInfo=H;const x=B=>{let T={};try{if(l(B))T=n;else{const O=(0,p.toBytes)(B).slice(0,2),b=(0,p.toStrictHex)(C.from(O).toString("hex")),v=(0,p.toBits)(new o.BN(b,16),16),P=v.slice(0,6),A=v.slice(6,11),K=v.slice(11,16);T={role:parseInt(P,2),pk:parseInt(A,2),hash:parseInt(K,2),address:(0,o.isHex)((0,o.toAddress)(B))?s.types.EncodingType.BASE16:s.types.EncodingType.BASE58}}return Object.keys(T).forEach(j=>{Object.values(s.types[`${(0,i.default)(d[j]||j)}Type`]).includes(T[j])===!1&&delete T[j]}),T}catch{return T}};D.toTypeInfo=x;const k=B=>{const T=x(B);return Object.keys(T).reduce((j,O)=>{const b=s.types[`${(0,i.default)(d[O]||O)}Type`];return j[O]=Object.keys(b).find(v=>b[v]===T[O]),j},{})};return D.toTypeInfoStr=k,D}var Zt;function jn(){return Zt||(Zt=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 o=Et();Object.defineProperty(e,"types",{enumerable:!0,get:function(){return o.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 u=Bn();Object.defineProperty(e,"DidType",{enumerable:!0,get:function(){return u.DidType}}),Object.defineProperty(e,"DID_TYPE_ARCBLOCK",{enumerable:!0,get:function(){return u.DID_TYPE_ARCBLOCK}}),Object.defineProperty(e,"DID_TYPE_ETHEREUM",{enumerable:!0,get:function(){return u.DID_TYPE_ETHEREUM}}),Object.defineProperty(e,"DID_TYPE_PASSKEY",{enumerable:!0,get:function(){return u.DID_TYPE_PASSKEY}}),Object.defineProperty(e,"fromTypeInfo",{enumerable:!0,get:function(){return u.fromTypeInfo}}),Object.defineProperty(e,"isEthereumDid",{enumerable:!0,get:function(){return u.isEthereumDid}}),Object.defineProperty(e,"isEthereumType",{enumerable:!0,get:function(){return u.isEthereumType}}),Object.defineProperty(e,"toTypeInfo",{enumerable:!0,get:function(){return u.toTypeInfo}}),Object.defineProperty(e,"toTypeInfoStr",{enumerable:!0,get:function(){return u.toTypeInfoStr}});const a=Ur();Object.defineProperty(e,"DID_PREFIX",{enumerable:!0,get:function(){return a.DID_PREFIX}}),Object.defineProperty(e,"toStrictHex",{enumerable:!0,get:function(){return a.toStrictHex}});const s=(c,l)=>{const h=(0,u.DidType)(l),S=(0,o.getSigner)(h.pk).getPublicKey(c);return p(S.indexOf("0x")===0?S:`0x${S}`,h)};e.fromSecretKey=s;const p=(c,l)=>{const h=(0,u.DidType)(l),_=(0,o.getHasher)(h.hash)(c,1);return d(_,h)};e.fromPublicKey=p;const d=(c,l)=>{const h=(0,u.DidType)(l),S=(0,i.stripHexPrefix)(c).slice(0,40),_=(0,o.getHasher)(h.hash),H=(0,u.fromTypeInfo)(h),x=(0,i.stripHexPrefix)(_(`0x${H}${S}`,1)).slice(0,8),k=`0x${H}${S}${x}`;return(0,u.isEthereumType)(h)?(0,u.toChecksumAddress)(`0x${c.slice(-40)}`):h.address===o.types.EncodingType.BASE58?(0,i.toBase58)(k):k};e.fromPublicKeyHash=d;const y=(c,l=o.types.RoleType.ROLE_ACCOUNT)=>{const h=Object.keys(o.types.RoleType),S=Object.values(o.types.RoleType);if(S.indexOf(l)===-1)throw new Error(`Unsupported role type ${l} when gen ddi from hash`);const _=(0,u.DidType)({role:o.types.RoleType[h[S.indexOf(l)]]});return d(c,_)};e.fromHash=y;const g=(c,l)=>{if(n(c)===!1)return!1;const h=(0,u.toTypeInfo)(c),S=p(l,h),_=c.replace(a.DID_PREFIX,"");return S===_};e.isFromPublicKey=g;const n=c=>{if(!c)return!1;const l=(0,i.toAddress)(String(c)),{hash:h}=(0,u.toTypeInfo)(l);if(typeof h>"u")return!1;if((0,u.isEthereumDid)(l))return!0;const S=(0,o.getHasher)(h),_=(0,a.toBytes)(l),H=(0,a.toStrictHex)(C.from(_.slice(0,22)).toString("hex")),x=(0,a.toStrictHex)(C.from(_.slice(22,26)).toString("hex")),k=(0,i.stripHexPrefix)(S(`0x${H}`,1)).slice(0,8);return x===k};e.isValid=n}(ct)),ct}var Qt;function vn(){if(Qt)return Y;Qt=1,Object.defineProperty(Y,"__esModule",{value:!0}),Y.WalletType=void 0,Y.Wallet=u,Y.fromSecretKey=a,Y.fromPublicKey=s,Y.fromAddress=p,Y.fromRandom=d,Y.fromJSON=y,Y.isValid=g;const e=J(),o=Et(),i=jn();Y.WalletType=i.DidType;function u(n,c="default"){const l=(0,i.DidType)(c),h=(0,o.getSigner)(l.pk),S=(0,o.getHasher)(l.hash);return{type:l,secretKey:n.sk,publicKey:n.pk,address:n.pk?(0,i.fromPublicKey)(n.pk,l):n.address,hash(_,H=1,x="hex"){return S(_,H,x)},sign(_,H=!0,x="hex"){if(!n.sk)throw new Error("Cannot sign data without a secretKey");if(H){const k=S(_,1);return h.sign(k,n.sk,x)}return h.sign(_,n.sk,x)},async verify(_,H,x=!0,k){if(!n.pk)throw new Error("Cannot verify data without a publicKey");const B=x?S(_,1):_;return h.verify(B,H,n.pk,k)},ethHash(_){if(typeof h.ethHash!="function")throw new Error("ethHash is not supported by signer");return h.ethHash(_)},ethSign(_,H=!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?h.ethSign(h.ethHash(_),(0,e.toHex)(n.sk)):h.ethSign(_,(0,e.toHex)(n.sk))},ethVerify(_,H,x=!0){if(typeof h.ethHash!="function")throw new Error("ethVerify is not supported by signer");const k=x?h.ethHash(_):_;return h.ethRecover(k,H)===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 a(n,c="default"){const l=(0,i.DidType)(c),h={sk:n,pk:(0,o.getSigner)(l.pk).getPublicKey(n)};return u(h,l)}function s(n,c="default"){return u({pk:n},(0,i.DidType)(c))}function p(n){return u({address:(0,i.toAddress)(n)},(0,i.toTypeInfo)(n))}function d(n="default"){const c=(0,i.DidType)(n),h=(0,o.getSigner)(c.pk).genKeyPair();return u({sk:h.secretKey,pk:h.publicKey},c)}function y(n){const c=i.DidType.fromJSON(n.type);return u(n,c)}function g(n,c=!0){return!(!n||typeof n!="object"||typeof n.verify!="function"||typeof n.toAddress!="function"||typeof n.toJSON!="function"||!n.type||!n.publicKey||c&&(!n.secretKey||typeof n.sign!="function"))}return Y}var lt,er;function wn(){if(er)return lt;er=1;const e=tn(),o=gn(),{fromSecretKey:i,WalletType:u}=vn(),{isHexStrict:a,toHex:s,toBuffer:p,stripHexPrefix:d}=se(),{types:y}=o;return lt={fromAppDid:(n,c,l={role:y.RoleType.ROLE_ACCOUNT},h=0)=>{if(!c)throw new Error("Cannot get user wallet with empty root sk");const S=o.Hasher.SHA3.hash256(p(n)),_=d(S).slice(0,16),H=_.slice(0,8),x=_.slice(8,16),k=parseInt(+`0x${H}`,10)&2147483647,B=parseInt(+`0x${x}`,10)&2147483647,T=d(a(c)?c:s(c)),j=e.fromMasterSeed(C.from(T,"hex")),O=`m/44'/260'/${k}'/${B}'/${h}`,b=j.derive(O),v=u(l),{pk:P=y.KeyType.ED25519}=v;let A;return P===y.KeyType.ED25519?A=o.Signer.Ed25519.genKeyPair("hex",b.privateKey).secretKey:A=s(b.privateKey),P===y.KeyType.ETHEREUM&&(A=A.slice(0,66)),i(A,v)}},lt}var Or=wn();const Un={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function Ar({onCreated:e,onClose:o}){const[i,u]=I.useState(!1),{t:a,locale:s}=$e(),{api:p}=Re(),{teamDid:d}=ke(),{control:y,handleSubmit:g,formState:{errors:n},watch:c,setValue:l}=jr({defaultValues:Un,mode:"onChange"}),h=c("scope"),S=H=>{H!=="profile:read"&&l("scope",h.includes(H)?h.filter(x=>x!==H):[...h,H])},_=async H=>{u(!0);try{const x={...H,redirectUris:H.redirectUris,contacts:H.contacts?H.contacts.split(",").map(k=>k.trim()):[],scope:H.scope.join(" ")};await p.createOAuthClient({input:{teamDid:d,input:Qr(x,en)}}),e(x)}catch(x){Ke.error(x.message||"Failed to create OAuth App")}finally{u(!1)}};return r.jsxs(dt,{open:!0,onClose:o,maxWidth:"md",fullWidth:!0,children:[r.jsxs(ht,{children:[a("oauth.client.register")," ",r.jsx(pt,{onClick:o,sx:{position:"absolute",right:8,top:8},children:r.jsx(yt,{})})]}),r.jsx(mt,{children:r.jsxs(_e,{spacing:4,sx:{mt:2},children:[r.jsx(X,{variant:"h6",gutterBottom:!0,children:a("oauth.client.requiredInformation")}),r.jsx(R,{children:r.jsx(z,{name:"clientName",control:y,rules:{required:a("oauth.client.validate.clientName"),minLength:{value:3,message:a("oauth.client.validate.clientNameMinLength")}},render:({field:H})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.name"),required:!0,fullWidth:!0,placeholder:a("oauth.client.input.clientNamePlaceholder"),error:!!n.clientName,helperText:n.clientName?.message}),r.jsx(M,{children:a("oauth.client.helperText.clientName")})]})})}),r.jsx(R,{children:r.jsx(z,{name:"clientUri",control:y,rules:{required:a("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:a("oauth.client.validate.clientUriInvalid")}},render:({field:H})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:a("oauth.client.input.clientUriPlaceholder"),error:!!n.clientUri,helperText:n.clientUri?.message}),r.jsx(M,{children:a("oauth.client.helperText.clientUri")})]})})}),r.jsx(R,{children:r.jsx(z,{name:"redirectUris",control:y,rules:{required:a("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:a("oauth.client.validate.redirectUrisInvalid")}},render:({field:H})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:a("oauth.client.input.redirectUrisPlaceholder"),error:!!n.redirectUris,helperText:n.redirectUris?.message}),r.jsxs(R,{sx:{display:"flex",gap:"2px"},children:[r.jsx(M,{children:a("oauth.client.helperText.redirectUris")}),r.jsx(M,{children:a("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:a("oauth.client.helperText.document")}),r.jsx(M,{children:a("oauth.client.helperText.more")})]})]})})}),r.jsxs(Wr,{variant:"outlined",sx:{p:2,display:"none"},children:[r.jsx(X,{variant:"subtitle2",gutterBottom:!0,children:a("oauth.client.input.permissions")}),r.jsx(R,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:r.jsx(br,{children:Object.entries(ie.OAUTH_SCOPES).map(([H,x])=>r.jsx(Sr,{control:r.jsx(Er,{checked:h.includes(H),onChange:()=>S(H),disabled:H==="profile:read",color:"primary"}),label:r.jsx(R,{children:r.jsx(X,{variant:"body2",sx:{fontWeight:500},children:x})})},H))})})]}),r.jsx(gt,{}),r.jsx(X,{variant:"h6",gutterBottom:!0,children:a("oauth.client.optionalInformation")}),r.jsx(_e,{children:r.jsx(z,{name:"contacts",control:y,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:a("oauth.client.validate.contacts")}},render:({field:H})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.contacts"),fullWidth:!0,placeholder:a("oauth.client.input.contactsPlaceholder"),error:!!n.contacts,helperText:n.contacts?.message}),r.jsx(M,{children:a("oauth.client.helperText.contacts")})]})})}),r.jsxs(_e,{direction:{xs:"column",sm:"row"},spacing:2,children:[r.jsx(z,{name:"tosUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:a("oauth.client.validate.tosUriInvalid")}},render:({field:H})=>r.jsxs(R,{sx:{width:"50%"},children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.tosUri"),fullWidth:!0,placeholder:a("oauth.client.input.tosUriPlaceholder"),error:!!n.tosUri,helperText:n.tosUri?.message}),r.jsx(M,{children:a("oauth.client.helperText.tosUri")})]})}),r.jsx(z,{name:"policyUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:a("oauth.client.validate.policyUriInvalid")}},render:({field:H})=>r.jsxs(R,{sx:{width:"50%"},children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.policyUri"),fullWidth:!0,placeholder:a("oauth.client.input.policyUriPlaceholder"),error:!!n.policyUri,helperText:n.policyUri?.message}),r.jsx(M,{children:a("oauth.client.helperText.policyUri")})]})})]}),n.error&&r.jsx(xr,{severity:"error",children:n.error.message})]})}),r.jsxs(Tr,{children:[r.jsx(je,{onClick:o,children:a("common.cancel")}),r.jsxs(je,{onClick:g(_),disabled:i,variant:"contained",color:"primary",children:[i?r.jsx(_t,{size:20,sx:{mr:1}}):null,a("oauth.client.registerButton")]})]})]})}Ar.propTypes={onCreated:w.func.isRequired,onClose:w.func.isRequired};function xt({scope:e="",...o}){if(!e)return null;const i=e.split(" ").filter(Boolean);return r.jsx(_e,{direction:"row",...o,sx:[{flexWrap:"wrap",gap:1},...Array.isArray(o.sx)?o.sx:[o.sx]],children:i.map(u=>r.jsx(Kr.Fragment,{children:r.jsx(Vr,{title:ie.OAUTH_SCOPES[u],children:r.jsx(q,{children:u})})},u))})}xt.propTypes={scope:w.string};const Tt=e=>{const{prefix:o}=Re(),{blocklet:i}=rn(),u=Ht(o,"/api/media/upload",i.appPid),a=I.useCallback(p=>p?p.startsWith("http")?p:`${Ht(o,"/api/media/upload",i.appPid)}/${p}`:"",[o,i.appPid]);return{clientLogoUrl:I.useMemo(()=>a(e),[e,a]),apiPath:u,getClientLogoUrl:a}},On=I.lazy(()=>qr(()=>import("./index-CvK2LB0C.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(e=>({default:e.Uploader})));function Pr({client:e,onUpdate:o,onClose:i}){const[u,a]=I.useState(!1),{t:s,locale:p}=$e(),d=I.useRef(null),{api:y}=Re(),{teamDid:g}=ke(),{control:n,handleSubmit:c,formState:{errors:l},watch:h,setValue:S,getValues:_}=jr({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=h("scope"),x=h("logoUri"),{clientLogoUrl:k,apiPath:B}=Tt(x),T=b=>{b!=="profile:read"&&S("scope",H.includes(b)?H.filter(v=>v!==b):[...H,b])},j=async b=>{const v={clientId:e.clientId,clientName:b.clientName.trim(),clientUri:b.clientUri,redirectUris:b.redirectUris.split(",").map(P=>P.trim()).filter(Boolean),contacts:b.contacts?b.contacts.split(",").map(P=>P.trim()):[],scope:b.scope.join(" "),tosUri:b.tosUri,policyUri:b.policyUri,logoUri:b.logoUri,clientSecretExpiresAt:b.clientSecretExpiresAt?parseInt(b.clientSecretExpiresAt/1e3,10):null};await y.updateOAuthClient({input:{teamDid:g,input:v}})},O=async b=>{a(!0);try{await j(b),o(),i()}catch(v){Ke.error(v.message||s("oauth.client.updateFailed"))}finally{a(!1)}};return r.jsxs(dt,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[r.jsxs(ht,{children:[s("oauth.client.update")," ",r.jsx(pt,{onClick:i,sx:{position:"absolute",right:8,top:8},children:r.jsx(yt,{})})]}),r.jsx(mt,{children:r.jsxs(_e,{spacing:3,sx:{mt:2},children:[r.jsxs(R,{sx:{mb:3},children:[r.jsx(X,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),r.jsxs(R,{children:[r.jsx(R,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:k?r.jsx(R,{children:r.jsx("img",{src:k,alt:"client-logo",style:{width:"100%",height:"100%"}})}):r.jsx(R,{onClick:()=>{d.current?.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:r.jsx(Hr,{sx:{fontSize:40,color:"common.white"}})})}),r.jsx(je,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{d.current?.open()},children:s(k?"common.change":"common.upload")})]}),r.jsx(R,{sx:{display:"flex",alignItems:"center"},children:r.jsx(I.Suspense,{fallback:r.jsx(sn,{}),children:r.jsx(On,{ref:d,locale:p,popup:!0,onUploadFinish:b=>{S("logoUri",b.data.filename),j(_()).then(()=>{o()}).catch(v=>{Ke.error(v.message||s("oauth.client.updateFailed"))}).finally(()=>{d.current?.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:B,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(R,{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:b})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...b,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(R,{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:b})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...b,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(R,{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:b})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...b,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:b})=>r.jsx(nn,{placeholder:s("oauth.client.input.expireTime"),value:b.value*1e3,onChange:v=>{b.onChange(v)}})}),r.jsxs(R,{sx:{display:"none"},children:[r.jsx(X,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),r.jsx(R,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:r.jsx(br,{children:Object.entries(ie.OAUTH_SCOPES).map(([b,v])=>r.jsx(Sr,{control:r.jsx(Er,{checked:H.includes(b),onChange:()=>T(b),disabled:b==="profile:read",color:"primary"}),label:r.jsx(R,{children:r.jsx(X,{variant:"body2",sx:{fontWeight:500},children:v})})},b))})})]}),r.jsx(gt,{}),r.jsx(X,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),r.jsx(R,{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:b})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...b,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(_e,{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:b})=>r.jsxs(R,{sx:{width:"50%"},children:[r.jsx(V,{...b,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:b})=>r.jsxs(R,{sx:{width:"50%"},children:[r.jsx(V,{...b,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(xr,{severity:"error",children:l.error.message})]})}),r.jsxs(Tr,{children:[r.jsx(je,{onClick:i,children:s("common.cancel")}),r.jsx(je,{onClick:c(O),disabled:u,variant:"contained",color:"primary",children:u?r.jsx(_t,{size:16}):s("common.update")})]})]})}Pr.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 $r({client:e,onUpdate:o,onClose:i}){return r.jsx(Pr,{client:e,onUpdate:u=>o(u),onClose:i})}$r.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 Rr({clientId:e,clientName:o,onDelete:i=()=>{},onClose:u=()=>{}}){const{t:a}=$e(),{api:s}=Re(),{teamDid:p}=ke(),d=()=>{u()},y=async()=>{try{await s.deleteOAuthClient({input:{teamDid:p,clientId:e}}),i()}catch(n){Ke.error(n?.message)}finally{d()}},g={keyName:o,title:a("oauth.client.delete.title"),description:a("oauth.client.delete.description",{name:`<b>${o}</b>`}),confirmPlaceholder:a("oauth.client.delete.description",{name:o}),confirm:a("common.delConfirm"),cancel:a("common.cancel"),onConfirm:y,onCancel:d};return r.jsx(on,{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})}Rr.propTypes={clientId:w.string.isRequired,clientName:w.string.isRequired,onDelete:w.func,onClose:w.func};function kr({title:e,items:o}){return r.jsxs(R,{sx:{mb:3},children:[r.jsx(X,{variant:"h6",sx:{mb:1.5},children:e}),r.jsx(_e,{spacing:1.5,children:o.map(({label:i,value:u})=>r.jsxs(R,{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:u||"-"})]},i))})]})}kr.propTypes={title:w.string.isRequired,items:w.arrayOf(w.shape({label:w.string.isRequired,value:w.any})).isRequired};function Cr({client:e,onClose:o}){const{t:i,locale:u}=$e(),{teamDid:a}=ke(),{clientName:s,clientId:p,clientSecret:d,redirectUris:y,scope:g,clientUri:n,logoUri:c,contacts:l,tosUri:h,policyUri:S,jwksUri:_,jwks:H,softwareId:x,softwareVersion:k,clientIdIssuedAt:B,clientSecretExpiresAt:T,updatedAt:j,createUser:O}=e,{clientLogoUrl:b}=Tt(c),v=K=>{try{const ee=new URL(window.blocklet.appUrl);return ee.pathname=K,ee.toString()}catch{return"-"}},P=Or.fromAppDid(p,a),A=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:s},{label:i("oauth.client.logoUri"),value:r.jsx(_r,{variant:"rounded",shape:"square",src:b,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:p})},{label:i("oauth.client.clientSecret"),value:r.jsx(q,{children:d})},{label:i("oauth.client.redirectUris"),value:r.jsx(q,{children:(y||[]).join(", ")})},{label:i("oauth.client.scope"),value:r.jsx(xt,{scope:g})},{label:i("oauth.client.createUser"),value:O?an(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(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:r.jsx(q,{children:v(`${ie.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:S?r.jsx(q,{children:S}):"-"},{label:i("oauth.client.jwksUri"),value:_},{label:i("oauth.client.jwks"),value:H},{label:i("oauth.client.softwareId"),value:x},{label:i("oauth.client.softwareVersion"),value:k}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:B?r.jsx(Ne,{value:B*1e3,type:"all",locale:u}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:T?r.jsx(Ne,{value:T*1e3,type:"all",locale:u}):"-"},{label:i("common.updatedAt"),value:j?r.jsx(Ne,{value:j,type:"all",locale:u}):"-"}]}].filter(Boolean);return r.jsxs(dt,{open:!0,onClose:o,maxWidth:"lg",fullWidth:!0,children:[r.jsxs(ht,{children:[i("oauth.client.oauthAppDetails"),r.jsx(pt,{onClick:o,sx:{position:"absolute",right:8,top:8},children:r.jsx(yt,{})})]}),r.jsx(mt,{children:r.jsx(R,{sx:{mt:1},children:A.map((K,ee)=>r.jsxs(R,{children:[r.jsx(kr,{title:K.title,items:K.items}),ee!==A.length-1&&r.jsx(gt,{sx:{my:2}})]},K.title))})})]})}Cr.propTypes={client:w.object.isRequired,onClose:w.func.isRequired};function An(e){return r.jsx(Ne,{value:e*1e3})}function Dr({selected:e=null,onClose:o}){return e?r.jsx(Cr,{client:e,onClose:o}):null}Dr.propTypes={selected:w.object,onClose:w.func.isRequired};function Nr({open:e,onCreated:o,onClose:i}){return e?r.jsx(Ar,{onCreated:o,onClose:i}):null}Nr.propTypes={open:w.bool.isRequired,onCreated:w.func.isRequired,onClose:w.func.isRequired};function fi(){const[e,o]=I.useState({searchText:"",pageSize:10,page:1}),[i,u]=I.useState(null),[a,s]=I.useState(!1),p=I.useRef(null),{t:d,locale:y}=$e(),{api:g}=Re(),{teamDid:n}=ke(),[c,l]=I.useState(null),[h,S]=I.useState(null),_=ln(),{getClientLogoUrl:H}=Tt(),x=Zr(async()=>await g.getOAuthClients({input:{teamDid:n,paging:{page:e.page,pageSize:e.pageSize}}}),[e.page,e.pageSize]),{loading:k}=x,B=I.useMemo(()=>x.value?.list||[],[x.value?.list]),T=I.useMemo(()=>e.searchText?B.filter(b=>b.clientName.toLowerCase().includes(e.searchText.toLowerCase())||b.clientId.toLowerCase().includes(e.searchText.toLowerCase())||b.scope.toLowerCase().includes(e.searchText.toLowerCase())):B,[e.searchText,B]),j=I.useMemo(()=>[{label:d("oauth.client.name"),name:"clientName",options:{customBodyRender:(b,{rowIndex:v})=>{const P=T[v],A=H(P.logoUri),K=Or.fromAppDid(P.clientId,n);return r.jsx(R,{sx:{display:"flex",alignItems:"center",gap:2},children:r.jsxs(R,{sx:{display:"flex",alignItems:"center",gap:2,cursor:"pointer"},children:[r.jsx(_r,{variant:"rounded",shape:"square",did:K.address,src:A,size:48}),r.jsxs(_e,{sx:{gap:.5},children:[r.jsx(R,{sx:{color:"text.primary"},children:P.clientName}),r.jsx(R,{sx:{color:"text.secondary"},children:P.clientUri})]})]})})}}},{label:d("oauth.client.clientId"),name:"clientId"},{label:d("oauth.client.scope"),name:"scope",options:{customBodyRender:b=>r.jsx(xt,{scope:b})}},{label:d("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:An}},{label:d("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:b=>b?r.jsx(Xr,{showDid:!0,did:b,cardType:Gr.Detailed,infoType:Jr.Minimal,sx:{border:0,padding:0}}):d("oauth.client.openRegistration")}},{label:d("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(b,{rowIndex:v})=>{const P=T[v];return r.jsx(cn,{actions:[{icon:r.jsx(zr,{}),text:d("common.edit"),onClick:A=>{A.stopPropagation(),l(P)}},{icon:r.jsx(Yr,{}),text:d("common.delete"),onClick:A=>{A.stopPropagation(),S(P)}}]})}}}],[T,d,H,n,l,S]),O=({page:b,rowsPerPage:v,searchText:P})=>{e.pageSize!==v?o(A=>({...A,searchText:"",pageSize:v,page:1})):e.page!==b+1?o(A=>({...A,searchText:"",page:b+1})):e.searchText!==P&&o(A=>({...A,searchText:P,page:1}))};return r.jsxs(R,{ref:p,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[_?r.jsx(Bt,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}):null,r.jsx(Mr,{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(b,{dataIndex:v},P){if(p.current?.contains(P.target)){const A=T[v];u(A)}}},onChange:O,title:_?null:r.jsx(Bt,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}),customButtons:[r.jsxs(je,{variant:"contained",size:"small",onClick:()=>s(!0),children:[k?r.jsx(_t,{size:16}):r.jsx(Hr,{style:{fontSize:16}}),d("common.create")]},"add")],loading:!1,emptyNode:r.jsx(Fr,{children:d("oauth.client.empty")})}),r.jsx(Dr,{selected:i,onClose:()=>u(null)}),r.jsx(Nr,{open:a,onCreated:()=>{s(!1),x.retry()},onClose:()=>s(!1)}),c&&r.jsx($r,{client:c,onUpdate:x.retry,onClose:()=>l(null)}),h&&r.jsx(Rr,{...h,onDelete:x.retry,onClose:()=>S(null)})]})}export{fi as default};
4
+ ${g.length}`,l=C.from(c),h=C.concat([l,n]);return i.default.keccak256s(h)}ethSign(d,y){return o.default.sign(d,y)}ethRecover(d,y){return o.default.recover(d,y)}}return ye.EthereumSigner=s,ye.default=new s,ye}var ge={},Yt;function Hn(){if(Yt)return ge;Yt=1;var e=ge&&ge.__importDefault||function(s){return s&&s.__esModule?s:{default:s}};Object.defineProperty(ge,"__esModule",{value:!0}),ge.PasskeySigner=void 0;const o=J(),i=gr(),u=e(St());class a extends u.default{constructor(){super()}genKeyPair(p="hex",d){throw new Error("Not supported")}getPublicKey(p,d="hex"){throw new Error("Not supported")}sign(p,d,y="hex"){throw new Error("Not supported")}async verify(p,d,y,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 c=(0,o.toBuffer)((0,o.fromBase64)(n.authenticatorData)),l=await(0,i.toHash)(i.isoBase64URL.toBuffer(n.clientDataJSON));if((0,i.decodeClientDataJSON)(n.clientDataJSON).challenge!==(0,o.toBase64)(p))throw new Error("challenge mismatch for passkey signature");return(0,i.verifySignature)({signature:i.isoBase64URL.toBuffer(typeof d=="string"?d:(0,o.toBase64)(d)),data:i.isoUint8Array.concat([c,l]),credentialPublicKey:y})}}return ge.PasskeySigner=a,ge.default=new a,ge}var Xt;function Et(){return Xt||(Xt=1,function(e){var o=Pe&&Pe.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(e,"__esModule",{value:!0}),e.toTxHash=e.Hashers=e.Signers=e.types=e.Hasher=e.Signer=void 0,e.getSigner=c,e.getHasher=l,e.getRandomBytes=h;const i=o(ve()),u=Ue(),a=o(bn()),s=o(Sn()),p=o(En()),d=o(xn()),y=o(Tn()),g=o(wr()),n=o(Hn());e.Signer={Ed25519:d.default,Secp256k1:g.default,Ethereum:y.default,Passkey:n.default},e.Hasher={SHA2:s.default,SHA3:p.default,Keccak:a.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 c(_){if(typeof e.Signers[_]>"u")throw new Error(`Unsupported signer type: ${_}`);return e.Signers[_]}function l(_){if(typeof e.Hashers[_]>"u")throw new Error(`Unsupported hash type: ${_}`);return e.Hashers[_]}function h(_=32,H="hex"){return(0,u.encode)((0,i.default)(_),H)}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 S=_=>e.Hasher.SHA2.hash256(_,1,"hex").replace(/^0x/,"").toUpperCase();e.toTxHash=S}(Pe)),Pe}var ct={},D={},W={},Jt;function Ur(){if(Jt)return W;Jt=1;var e=W&&W.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(W,"__esModule",{value:!0}),W.toStrictHex=W.toBytes=W.toBits=W.DID_PREFIX=void 0;const o=e(ft),i=J(),u="did:abt:";W.DID_PREFIX=u;const a=d=>{try{if((0,i.isHexStrict)(d))return C.from((0,i.stripHexPrefix)(d),"hex");let y=(0,i.fromBase58)(d.replace(u,""));for(;y.length<26;)y=C.concat([C.from([0]),y]);return y}catch(y){throw new Error(`Cannot convert DID string to byte array: ${y.message}`)}};W.toBytes=a;const s=(d,y)=>(0,o.default)((0,i.toBN)(d).toString(2),y,"0");W.toBits=s;const p=(d,y)=>{const g=d.replace(/^0x/i,"");return typeof y=="number"&&y%2===0?(0,o.default)(d,y,"0"):g.length%2===0?g:`0${g}`};return W.toStrictHex=p,W}var Gt;function Bn(){if(Gt)return D;Gt=1;var e=D&&D.__importDefault||function(B){return B&&B.__esModule?B:{default:B}};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=_;const o=J(),i=e(ut),u=e(Ir),a=e(Lr),s=Et(),p=Ur(),d={pk:"key",address:"encoding"},y={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=y;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 c=B=>{const T=["pk","hash","address"];return(0,u.default)((0,a.default)(B,T),(0,a.default)(n,T))};D.isEthereumType=c;const l=B=>{const T=(0,o.toAddress)(B);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=B=>{const T=B.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},S=B=>{if(typeof B>"u")return"";if(!/^(0x)?[0-9a-f]{40}$/i.test(B))throw new Error(`Given address "${B}" is not a valid Ethereum address.`);const T=B.toLowerCase().replace(/^0x/i,""),j=s.Hasher.Keccak.hash256(T).replace(/^0x/i,"");let O="0x";for(let b=0;b<T.length;b++)parseInt(j[b],16)>7?O+=T[b].toUpperCase():O+=T[b];return O};D.toChecksumAddress=S;function _(B={}){let T={};["default","arcblock"].includes(B)?T=y:["eth","ethereum"].includes(B)?T=n:["passkey"].includes(B)?T=g:T={...y,...B};const{role:j,pk:O,hash:b,address:v}=T;Object.keys(T).forEach(A=>{const K=(0,i.default)(`${d[A]||A}Type`);if(Object.values(s.types[K]).includes(T[A])===!1)throw new Error(`Unsupported ${A} type: ${T[A]}`)});const P={role:j,pk:O,hash:b,address:v};return c(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}_.toJSON=B=>Object.keys(B).reduce((T,j)=>{const O=(0,i.default)(`${d[j]||j}Type`),b=Object.keys(s.types[O]),v=Object.values(s.types[O]);return T[j]=b[v.indexOf(B[j])],T},{}),_.fromJSON=B=>Object.keys(B).reduce((T,j)=>{const O=(0,i.default)(`${d[j]||j}Type`),b=Object.keys(s.types[O]),v=Object.values(s.types[O]);return T[j]=v[b.indexOf(B[j])],T},{});const H=B=>{const T=_(B),j=(0,p.toBits)(T.role,6),O=(0,p.toBits)(T.pk,5),b=(0,p.toBits)(T.hash,5),v=`${j}${O}${b}`,P=(0,o.stripHexPrefix)((0,o.numberToHex)(parseInt(v,2)));return(0,p.toStrictHex)(P,4)};D.fromTypeInfo=H;const x=B=>{let T={};try{if(l(B))T=n;else{const O=(0,p.toBytes)(B).slice(0,2),b=(0,p.toStrictHex)(C.from(O).toString("hex")),v=(0,p.toBits)(new o.BN(b,16),16),P=v.slice(0,6),A=v.slice(6,11),K=v.slice(11,16);T={role:parseInt(P,2),pk:parseInt(A,2),hash:parseInt(K,2),address:(0,o.isHex)((0,o.toAddress)(B))?s.types.EncodingType.BASE16:s.types.EncodingType.BASE58}}return Object.keys(T).forEach(j=>{Object.values(s.types[`${(0,i.default)(d[j]||j)}Type`]).includes(T[j])===!1&&delete T[j]}),T}catch{return T}};D.toTypeInfo=x;const k=B=>{const T=x(B);return Object.keys(T).reduce((j,O)=>{const b=s.types[`${(0,i.default)(d[O]||O)}Type`];return j[O]=Object.keys(b).find(v=>b[v]===T[O]),j},{})};return D.toTypeInfoStr=k,D}var Zt;function jn(){return Zt||(Zt=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 o=Et();Object.defineProperty(e,"types",{enumerable:!0,get:function(){return o.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 u=Bn();Object.defineProperty(e,"DidType",{enumerable:!0,get:function(){return u.DidType}}),Object.defineProperty(e,"DID_TYPE_ARCBLOCK",{enumerable:!0,get:function(){return u.DID_TYPE_ARCBLOCK}}),Object.defineProperty(e,"DID_TYPE_ETHEREUM",{enumerable:!0,get:function(){return u.DID_TYPE_ETHEREUM}}),Object.defineProperty(e,"DID_TYPE_PASSKEY",{enumerable:!0,get:function(){return u.DID_TYPE_PASSKEY}}),Object.defineProperty(e,"fromTypeInfo",{enumerable:!0,get:function(){return u.fromTypeInfo}}),Object.defineProperty(e,"isEthereumDid",{enumerable:!0,get:function(){return u.isEthereumDid}}),Object.defineProperty(e,"isEthereumType",{enumerable:!0,get:function(){return u.isEthereumType}}),Object.defineProperty(e,"toTypeInfo",{enumerable:!0,get:function(){return u.toTypeInfo}}),Object.defineProperty(e,"toTypeInfoStr",{enumerable:!0,get:function(){return u.toTypeInfoStr}});const a=Ur();Object.defineProperty(e,"DID_PREFIX",{enumerable:!0,get:function(){return a.DID_PREFIX}}),Object.defineProperty(e,"toStrictHex",{enumerable:!0,get:function(){return a.toStrictHex}});const s=(c,l)=>{const h=(0,u.DidType)(l),S=(0,o.getSigner)(h.pk).getPublicKey(c);return p(S.indexOf("0x")===0?S:`0x${S}`,h)};e.fromSecretKey=s;const p=(c,l)=>{const h=(0,u.DidType)(l),_=(0,o.getHasher)(h.hash)(c,1);return d(_,h)};e.fromPublicKey=p;const d=(c,l)=>{const h=(0,u.DidType)(l),S=(0,i.stripHexPrefix)(c).slice(0,40),_=(0,o.getHasher)(h.hash),H=(0,u.fromTypeInfo)(h),x=(0,i.stripHexPrefix)(_(`0x${H}${S}`,1)).slice(0,8),k=`0x${H}${S}${x}`;return(0,u.isEthereumType)(h)?(0,u.toChecksumAddress)(`0x${c.slice(-40)}`):h.address===o.types.EncodingType.BASE58?(0,i.toBase58)(k):k};e.fromPublicKeyHash=d;const y=(c,l=o.types.RoleType.ROLE_ACCOUNT)=>{const h=Object.keys(o.types.RoleType),S=Object.values(o.types.RoleType);if(S.indexOf(l)===-1)throw new Error(`Unsupported role type ${l} when gen ddi from hash`);const _=(0,u.DidType)({role:o.types.RoleType[h[S.indexOf(l)]]});return d(c,_)};e.fromHash=y;const g=(c,l)=>{if(n(c)===!1)return!1;const h=(0,u.toTypeInfo)(c),S=p(l,h),_=c.replace(a.DID_PREFIX,"");return S===_};e.isFromPublicKey=g;const n=c=>{if(!c)return!1;const l=(0,i.toAddress)(String(c)),{hash:h}=(0,u.toTypeInfo)(l);if(typeof h>"u")return!1;if((0,u.isEthereumDid)(l))return!0;const S=(0,o.getHasher)(h),_=(0,a.toBytes)(l),H=(0,a.toStrictHex)(C.from(_.slice(0,22)).toString("hex")),x=(0,a.toStrictHex)(C.from(_.slice(22,26)).toString("hex")),k=(0,i.stripHexPrefix)(S(`0x${H}`,1)).slice(0,8);return x===k};e.isValid=n}(ct)),ct}var Qt;function vn(){if(Qt)return Y;Qt=1,Object.defineProperty(Y,"__esModule",{value:!0}),Y.WalletType=void 0,Y.Wallet=u,Y.fromSecretKey=a,Y.fromPublicKey=s,Y.fromAddress=p,Y.fromRandom=d,Y.fromJSON=y,Y.isValid=g;const e=J(),o=Et(),i=jn();Y.WalletType=i.DidType;function u(n,c="default"){const l=(0,i.DidType)(c),h=(0,o.getSigner)(l.pk),S=(0,o.getHasher)(l.hash);return{type:l,secretKey:n.sk,publicKey:n.pk,address:n.pk?(0,i.fromPublicKey)(n.pk,l):n.address,hash(_,H=1,x="hex"){return S(_,H,x)},sign(_,H=!0,x="hex"){if(!n.sk)throw new Error("Cannot sign data without a secretKey");if(H){const k=S(_,1);return h.sign(k,n.sk,x)}return h.sign(_,n.sk,x)},async verify(_,H,x=!0,k){if(!n.pk)throw new Error("Cannot verify data without a publicKey");const B=x?S(_,1):_;return h.verify(B,H,n.pk,k)},ethHash(_){if(typeof h.ethHash!="function")throw new Error("ethHash is not supported by signer");return h.ethHash(_)},ethSign(_,H=!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?h.ethSign(h.ethHash(_),(0,e.toHex)(n.sk)):h.ethSign(_,(0,e.toHex)(n.sk))},ethVerify(_,H,x=!0){if(typeof h.ethHash!="function")throw new Error("ethVerify is not supported by signer");const k=x?h.ethHash(_):_;return h.ethRecover(k,H)===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 a(n,c="default"){const l=(0,i.DidType)(c),h={sk:n,pk:(0,o.getSigner)(l.pk).getPublicKey(n)};return u(h,l)}function s(n,c="default"){return u({pk:n},(0,i.DidType)(c))}function p(n){return u({address:(0,i.toAddress)(n)},(0,i.toTypeInfo)(n))}function d(n="default"){const c=(0,i.DidType)(n),h=(0,o.getSigner)(c.pk).genKeyPair();return u({sk:h.secretKey,pk:h.publicKey},c)}function y(n){const c=i.DidType.fromJSON(n.type);return u(n,c)}function g(n,c=!0){return!(!n||typeof n!="object"||typeof n.verify!="function"||typeof n.toAddress!="function"||typeof n.toJSON!="function"||!n.type||!n.publicKey||c&&(!n.secretKey||typeof n.sign!="function"))}return Y}var lt,er;function wn(){if(er)return lt;er=1;const e=tn(),o=gn(),{fromSecretKey:i,WalletType:u}=vn(),{isHexStrict:a,toHex:s,toBuffer:p,stripHexPrefix:d}=se(),{types:y}=o;return lt={fromAppDid:(n,c,l={role:y.RoleType.ROLE_ACCOUNT},h=0)=>{if(!c)throw new Error("Cannot get user wallet with empty root sk");const S=o.Hasher.SHA3.hash256(p(n)),_=d(S).slice(0,16),H=_.slice(0,8),x=_.slice(8,16),k=parseInt(+`0x${H}`,10)&2147483647,B=parseInt(+`0x${x}`,10)&2147483647,T=d(a(c)?c:s(c)),j=e.fromMasterSeed(C.from(T,"hex")),O=`m/44'/260'/${k}'/${B}'/${h}`,b=j.derive(O),v=u(l),{pk:P=y.KeyType.ED25519}=v;let A;return P===y.KeyType.ED25519?A=o.Signer.Ed25519.genKeyPair("hex",b.privateKey).secretKey:A=s(b.privateKey),P===y.KeyType.ETHEREUM&&(A=A.slice(0,66)),i(A,v)}},lt}var Or=wn();const Un={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function Ar({onCreated:e,onClose:o}){const[i,u]=I.useState(!1),{t:a,locale:s}=$e(),{api:p}=Re(),{teamDid:d}=ke(),{control:y,handleSubmit:g,formState:{errors:n},watch:c,setValue:l}=jr({defaultValues:Un,mode:"onChange"}),h=c("scope"),S=H=>{H!=="profile:read"&&l("scope",h.includes(H)?h.filter(x=>x!==H):[...h,H])},_=async H=>{u(!0);try{const x={...H,redirectUris:H.redirectUris,contacts:H.contacts?H.contacts.split(",").map(k=>k.trim()):[],scope:H.scope.join(" ")};await p.createOAuthClient({input:{teamDid:d,input:Qr(x,en)}}),e(x)}catch(x){Ke.error(x.message||"Failed to create OAuth App")}finally{u(!1)}};return r.jsxs(dt,{open:!0,onClose:o,maxWidth:"md",fullWidth:!0,children:[r.jsxs(ht,{children:[a("oauth.client.register")," ",r.jsx(pt,{onClick:o,sx:{position:"absolute",right:8,top:8},children:r.jsx(yt,{})})]}),r.jsx(mt,{children:r.jsxs(_e,{spacing:4,sx:{mt:2},children:[r.jsx(X,{variant:"h6",gutterBottom:!0,children:a("oauth.client.requiredInformation")}),r.jsx(R,{children:r.jsx(z,{name:"clientName",control:y,rules:{required:a("oauth.client.validate.clientName"),minLength:{value:3,message:a("oauth.client.validate.clientNameMinLength")}},render:({field:H})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.name"),required:!0,fullWidth:!0,placeholder:a("oauth.client.input.clientNamePlaceholder"),error:!!n.clientName,helperText:n.clientName?.message}),r.jsx(M,{children:a("oauth.client.helperText.clientName")})]})})}),r.jsx(R,{children:r.jsx(z,{name:"clientUri",control:y,rules:{required:a("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:a("oauth.client.validate.clientUriInvalid")}},render:({field:H})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:a("oauth.client.input.clientUriPlaceholder"),error:!!n.clientUri,helperText:n.clientUri?.message}),r.jsx(M,{children:a("oauth.client.helperText.clientUri")})]})})}),r.jsx(R,{children:r.jsx(z,{name:"redirectUris",control:y,rules:{required:a("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:a("oauth.client.validate.redirectUrisInvalid")}},render:({field:H})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:a("oauth.client.input.redirectUrisPlaceholder"),error:!!n.redirectUris,helperText:n.redirectUris?.message}),r.jsxs(R,{sx:{display:"flex",gap:"2px"},children:[r.jsx(M,{children:a("oauth.client.helperText.redirectUris")}),r.jsx(M,{children:a("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:a("oauth.client.helperText.document")}),r.jsx(M,{children:a("oauth.client.helperText.more")})]})]})})}),r.jsxs(Wr,{variant:"outlined",sx:{p:2,display:"none"},children:[r.jsx(X,{variant:"subtitle2",gutterBottom:!0,children:a("oauth.client.input.permissions")}),r.jsx(R,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:r.jsx(br,{children:Object.entries(ie.OAUTH_SCOPES).map(([H,x])=>r.jsx(Sr,{control:r.jsx(Er,{checked:h.includes(H),onChange:()=>S(H),disabled:H==="profile:read",color:"primary"}),label:r.jsx(R,{children:r.jsx(X,{variant:"body2",sx:{fontWeight:500},children:x})})},H))})})]}),r.jsx(gt,{}),r.jsx(X,{variant:"h6",gutterBottom:!0,children:a("oauth.client.optionalInformation")}),r.jsx(_e,{children:r.jsx(z,{name:"contacts",control:y,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:a("oauth.client.validate.contacts")}},render:({field:H})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.contacts"),fullWidth:!0,placeholder:a("oauth.client.input.contactsPlaceholder"),error:!!n.contacts,helperText:n.contacts?.message}),r.jsx(M,{children:a("oauth.client.helperText.contacts")})]})})}),r.jsxs(_e,{direction:{xs:"column",sm:"row"},spacing:2,children:[r.jsx(z,{name:"tosUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:a("oauth.client.validate.tosUriInvalid")}},render:({field:H})=>r.jsxs(R,{sx:{width:"50%"},children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.tosUri"),fullWidth:!0,placeholder:a("oauth.client.input.tosUriPlaceholder"),error:!!n.tosUri,helperText:n.tosUri?.message}),r.jsx(M,{children:a("oauth.client.helperText.tosUri")})]})}),r.jsx(z,{name:"policyUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:a("oauth.client.validate.policyUriInvalid")}},render:({field:H})=>r.jsxs(R,{sx:{width:"50%"},children:[r.jsx(V,{size:"small",...H,label:a("oauth.client.input.policyUri"),fullWidth:!0,placeholder:a("oauth.client.input.policyUriPlaceholder"),error:!!n.policyUri,helperText:n.policyUri?.message}),r.jsx(M,{children:a("oauth.client.helperText.policyUri")})]})})]}),n.error&&r.jsx(xr,{severity:"error",children:n.error.message})]})}),r.jsxs(Tr,{children:[r.jsx(je,{onClick:o,children:a("common.cancel")}),r.jsxs(je,{onClick:g(_),disabled:i,variant:"contained",color:"primary",children:[i?r.jsx(_t,{size:20,sx:{mr:1}}):null,a("oauth.client.registerButton")]})]})]})}Ar.propTypes={onCreated:w.func.isRequired,onClose:w.func.isRequired};function xt({scope:e="",...o}){if(!e)return null;const i=e.split(" ").filter(Boolean);return r.jsx(_e,{direction:"row",...o,sx:[{flexWrap:"wrap",gap:1},...Array.isArray(o.sx)?o.sx:[o.sx]],children:i.map(u=>r.jsx(Kr.Fragment,{children:r.jsx(Vr,{title:ie.OAUTH_SCOPES[u],children:r.jsx(q,{children:u})})},u))})}xt.propTypes={scope:w.string};const Tt=e=>{const{prefix:o}=Re(),{blocklet:i}=rn(),u=Ht(o,"/api/media/upload",i.appPid),a=I.useCallback(p=>p?p.startsWith("http")?p:`${Ht(o,"/api/media/upload",i.appPid)}/${p}`:"",[o,i.appPid]);return{clientLogoUrl:I.useMemo(()=>a(e),[e,a]),apiPath:u,getClientLogoUrl:a}},On=I.lazy(()=>qr(()=>import("./index-DIfIqZRw.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(e=>({default:e.Uploader})));function Pr({client:e,onUpdate:o,onClose:i}){const[u,a]=I.useState(!1),{t:s,locale:p}=$e(),d=I.useRef(null),{api:y}=Re(),{teamDid:g}=ke(),{control:n,handleSubmit:c,formState:{errors:l},watch:h,setValue:S,getValues:_}=jr({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=h("scope"),x=h("logoUri"),{clientLogoUrl:k,apiPath:B}=Tt(x),T=b=>{b!=="profile:read"&&S("scope",H.includes(b)?H.filter(v=>v!==b):[...H,b])},j=async b=>{const v={clientId:e.clientId,clientName:b.clientName.trim(),clientUri:b.clientUri,redirectUris:b.redirectUris.split(",").map(P=>P.trim()).filter(Boolean),contacts:b.contacts?b.contacts.split(",").map(P=>P.trim()):[],scope:b.scope.join(" "),tosUri:b.tosUri,policyUri:b.policyUri,logoUri:b.logoUri,clientSecretExpiresAt:b.clientSecretExpiresAt?parseInt(b.clientSecretExpiresAt/1e3,10):null};await y.updateOAuthClient({input:{teamDid:g,input:v}})},O=async b=>{a(!0);try{await j(b),o(),i()}catch(v){Ke.error(v.message||s("oauth.client.updateFailed"))}finally{a(!1)}};return r.jsxs(dt,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[r.jsxs(ht,{children:[s("oauth.client.update")," ",r.jsx(pt,{onClick:i,sx:{position:"absolute",right:8,top:8},children:r.jsx(yt,{})})]}),r.jsx(mt,{children:r.jsxs(_e,{spacing:3,sx:{mt:2},children:[r.jsxs(R,{sx:{mb:3},children:[r.jsx(X,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),r.jsxs(R,{children:[r.jsx(R,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:k?r.jsx(R,{children:r.jsx("img",{src:k,alt:"client-logo",style:{width:"100%",height:"100%"}})}):r.jsx(R,{onClick:()=>{d.current?.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:r.jsx(Hr,{sx:{fontSize:40,color:"common.white"}})})}),r.jsx(je,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{d.current?.open()},children:s(k?"common.change":"common.upload")})]}),r.jsx(R,{sx:{display:"flex",alignItems:"center"},children:r.jsx(I.Suspense,{fallback:r.jsx(sn,{}),children:r.jsx(On,{ref:d,locale:p,popup:!0,onUploadFinish:b=>{S("logoUri",b.data.filename),j(_()).then(()=>{o()}).catch(v=>{Ke.error(v.message||s("oauth.client.updateFailed"))}).finally(()=>{d.current?.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:B,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(R,{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:b})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...b,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(R,{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:b})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...b,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(R,{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:b})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...b,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:b})=>r.jsx(nn,{placeholder:s("oauth.client.input.expireTime"),value:b.value*1e3,onChange:v=>{b.onChange(v)}})}),r.jsxs(R,{sx:{display:"none"},children:[r.jsx(X,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),r.jsx(R,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:r.jsx(br,{children:Object.entries(ie.OAUTH_SCOPES).map(([b,v])=>r.jsx(Sr,{control:r.jsx(Er,{checked:H.includes(b),onChange:()=>T(b),disabled:b==="profile:read",color:"primary"}),label:r.jsx(R,{children:r.jsx(X,{variant:"body2",sx:{fontWeight:500},children:v})})},b))})})]}),r.jsx(gt,{}),r.jsx(X,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),r.jsx(R,{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:b})=>r.jsxs(r.Fragment,{children:[r.jsx(V,{...b,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(_e,{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:b})=>r.jsxs(R,{sx:{width:"50%"},children:[r.jsx(V,{...b,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:b})=>r.jsxs(R,{sx:{width:"50%"},children:[r.jsx(V,{...b,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(xr,{severity:"error",children:l.error.message})]})}),r.jsxs(Tr,{children:[r.jsx(je,{onClick:i,children:s("common.cancel")}),r.jsx(je,{onClick:c(O),disabled:u,variant:"contained",color:"primary",children:u?r.jsx(_t,{size:16}):s("common.update")})]})]})}Pr.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 $r({client:e,onUpdate:o,onClose:i}){return r.jsx(Pr,{client:e,onUpdate:u=>o(u),onClose:i})}$r.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 Rr({clientId:e,clientName:o,onDelete:i=()=>{},onClose:u=()=>{}}){const{t:a}=$e(),{api:s}=Re(),{teamDid:p}=ke(),d=()=>{u()},y=async()=>{try{await s.deleteOAuthClient({input:{teamDid:p,clientId:e}}),i()}catch(n){Ke.error(n?.message)}finally{d()}},g={keyName:o,title:a("oauth.client.delete.title"),description:a("oauth.client.delete.description",{name:`<b>${o}</b>`}),confirmPlaceholder:a("oauth.client.delete.description",{name:o}),confirm:a("common.delConfirm"),cancel:a("common.cancel"),onConfirm:y,onCancel:d};return r.jsx(on,{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})}Rr.propTypes={clientId:w.string.isRequired,clientName:w.string.isRequired,onDelete:w.func,onClose:w.func};function kr({title:e,items:o}){return r.jsxs(R,{sx:{mb:3},children:[r.jsx(X,{variant:"h6",sx:{mb:1.5},children:e}),r.jsx(_e,{spacing:1.5,children:o.map(({label:i,value:u})=>r.jsxs(R,{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:u||"-"})]},i))})]})}kr.propTypes={title:w.string.isRequired,items:w.arrayOf(w.shape({label:w.string.isRequired,value:w.any})).isRequired};function Cr({client:e,onClose:o}){const{t:i,locale:u}=$e(),{teamDid:a}=ke(),{clientName:s,clientId:p,clientSecret:d,redirectUris:y,scope:g,clientUri:n,logoUri:c,contacts:l,tosUri:h,policyUri:S,jwksUri:_,jwks:H,softwareId:x,softwareVersion:k,clientIdIssuedAt:B,clientSecretExpiresAt:T,updatedAt:j,createUser:O}=e,{clientLogoUrl:b}=Tt(c),v=K=>{try{const ee=new URL(window.blocklet.appUrl);return ee.pathname=K,ee.toString()}catch{return"-"}},P=Or.fromAppDid(p,a),A=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:s},{label:i("oauth.client.logoUri"),value:r.jsx(_r,{variant:"rounded",shape:"square",src:b,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:p})},{label:i("oauth.client.clientSecret"),value:r.jsx(q,{children:d})},{label:i("oauth.client.redirectUris"),value:r.jsx(q,{children:(y||[]).join(", ")})},{label:i("oauth.client.scope"),value:r.jsx(xt,{scope:g})},{label:i("oauth.client.createUser"),value:O?an(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(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:r.jsx(q,{children:v(`${ie.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:r.jsx(q,{children:v(`${ie.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:S?r.jsx(q,{children:S}):"-"},{label:i("oauth.client.jwksUri"),value:_},{label:i("oauth.client.jwks"),value:H},{label:i("oauth.client.softwareId"),value:x},{label:i("oauth.client.softwareVersion"),value:k}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:B?r.jsx(Ne,{value:B*1e3,type:"all",locale:u}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:T?r.jsx(Ne,{value:T*1e3,type:"all",locale:u}):"-"},{label:i("common.updatedAt"),value:j?r.jsx(Ne,{value:j,type:"all",locale:u}):"-"}]}].filter(Boolean);return r.jsxs(dt,{open:!0,onClose:o,maxWidth:"lg",fullWidth:!0,children:[r.jsxs(ht,{children:[i("oauth.client.oauthAppDetails"),r.jsx(pt,{onClick:o,sx:{position:"absolute",right:8,top:8},children:r.jsx(yt,{})})]}),r.jsx(mt,{children:r.jsx(R,{sx:{mt:1},children:A.map((K,ee)=>r.jsxs(R,{children:[r.jsx(kr,{title:K.title,items:K.items}),ee!==A.length-1&&r.jsx(gt,{sx:{my:2}})]},K.title))})})]})}Cr.propTypes={client:w.object.isRequired,onClose:w.func.isRequired};function An(e){return r.jsx(Ne,{value:e*1e3})}function Dr({selected:e=null,onClose:o}){return e?r.jsx(Cr,{client:e,onClose:o}):null}Dr.propTypes={selected:w.object,onClose:w.func.isRequired};function Nr({open:e,onCreated:o,onClose:i}){return e?r.jsx(Ar,{onCreated:o,onClose:i}):null}Nr.propTypes={open:w.bool.isRequired,onCreated:w.func.isRequired,onClose:w.func.isRequired};function fi(){const[e,o]=I.useState({searchText:"",pageSize:10,page:1}),[i,u]=I.useState(null),[a,s]=I.useState(!1),p=I.useRef(null),{t:d,locale:y}=$e(),{api:g}=Re(),{teamDid:n}=ke(),[c,l]=I.useState(null),[h,S]=I.useState(null),_=ln(),{getClientLogoUrl:H}=Tt(),x=Zr(async()=>await g.getOAuthClients({input:{teamDid:n,paging:{page:e.page,pageSize:e.pageSize}}}),[e.page,e.pageSize]),{loading:k}=x,B=I.useMemo(()=>x.value?.list||[],[x.value?.list]),T=I.useMemo(()=>e.searchText?B.filter(b=>b.clientName.toLowerCase().includes(e.searchText.toLowerCase())||b.clientId.toLowerCase().includes(e.searchText.toLowerCase())||b.scope.toLowerCase().includes(e.searchText.toLowerCase())):B,[e.searchText,B]),j=I.useMemo(()=>[{label:d("oauth.client.name"),name:"clientName",options:{customBodyRender:(b,{rowIndex:v})=>{const P=T[v],A=H(P.logoUri),K=Or.fromAppDid(P.clientId,n);return r.jsx(R,{sx:{display:"flex",alignItems:"center",gap:2},children:r.jsxs(R,{sx:{display:"flex",alignItems:"center",gap:2,cursor:"pointer"},children:[r.jsx(_r,{variant:"rounded",shape:"square",did:K.address,src:A,size:48}),r.jsxs(_e,{sx:{gap:.5},children:[r.jsx(R,{sx:{color:"text.primary"},children:P.clientName}),r.jsx(R,{sx:{color:"text.secondary"},children:P.clientUri})]})]})})}}},{label:d("oauth.client.clientId"),name:"clientId"},{label:d("oauth.client.scope"),name:"scope",options:{customBodyRender:b=>r.jsx(xt,{scope:b})}},{label:d("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:An}},{label:d("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:b=>b?r.jsx(Xr,{showDid:!0,did:b,cardType:Gr.Detailed,infoType:Jr.Minimal,sx:{border:0,padding:0}}):d("oauth.client.openRegistration")}},{label:d("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(b,{rowIndex:v})=>{const P=T[v];return r.jsx(cn,{actions:[{icon:r.jsx(zr,{}),text:d("common.edit"),onClick:A=>{A.stopPropagation(),l(P)}},{icon:r.jsx(Yr,{}),text:d("common.delete"),onClick:A=>{A.stopPropagation(),S(P)}}]})}}}],[T,d,H,n,l,S]),O=({page:b,rowsPerPage:v,searchText:P})=>{e.pageSize!==v?o(A=>({...A,searchText:"",pageSize:v,page:1})):e.page!==b+1?o(A=>({...A,searchText:"",page:b+1})):e.searchText!==P&&o(A=>({...A,searchText:P,page:1}))};return r.jsxs(R,{ref:p,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[_?r.jsx(Bt,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}):null,r.jsx(Mr,{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(b,{dataIndex:v},P){if(p.current?.contains(P.target)){const A=T[v];u(A)}}},onChange:O,title:_?null:r.jsx(Bt,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}),customButtons:[r.jsxs(je,{variant:"contained",size:"small",onClick:()=>s(!0),children:[k?r.jsx(_t,{size:16}):r.jsx(Hr,{style:{fontSize:16}}),d("common.create")]},"add")],loading:!1,emptyNode:r.jsx(Fr,{children:d("oauth.client.empty")})}),r.jsx(Dr,{selected:i,onClose:()=>u(null)}),r.jsx(Nr,{open:a,onCreated:()=>{s(!1),x.retry()},onClose:()=>s(!1)}),c&&r.jsx($r,{client:c,onUpdate:x.retry,onClose:()=>l(null)}),h&&r.jsx(Rr,{...h,onDelete:x.retry,onClose:()=>S(null)})]})}export{fi 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,cs as be,ct as ve,cu as je,cv 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-CmD-NPnl.js";import{a as D,b as O,h as Te}from"./vendor-hooks-DLNZ8kxG.js";import{T as Q,a6 as Ne,ab as ne,G as re,a9 as $e}from"./vendor-ux-ESjuHpb6.js";import{t as Se}from"./server-logo-notext.svg-CKQB0tIp.js";import{B as Le}from"./bundle-avatar-CF-8YjIk.js";import{a as ze,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-RDmDo4cZ.js";import{R as Ue,J as We,C as G,a as H}from"./vendor-utils-DQK0pEML.js";import{c as Qe,Z as Ge}from"./index-6k6hDX7K.js";import{B as Je,o as Ke,l as Xe}from"./index-BE6_aQqm.js";import{p as Ye}from"./util-CHZLxs1T.js";function le({blocklet:e,style:r={},size:s=40,...i}){const l=ze({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,wordBreak:"break-all"},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)}),$=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)),$&&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,cs as be,ct as ve,cu as je,cv 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-CmD-NPnl.js";import{a as D,b as O,h as Te}from"./vendor-hooks-DLNZ8kxG.js";import{T as Q,a6 as Ne,ab as ne,G as re,a9 as $e}from"./vendor-ux-pYOhjQLA.js";import{t as Se}from"./server-logo-notext.svg-CKQB0tIp.js";import{B as Le}from"./bundle-avatar-BhNvlq8g.js";import{a as ze,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-CGGZIbfh.js";import{R as Ue,J as We,C as G,a as H}from"./vendor-utils-DQK0pEML.js";import{c as Qe,Z as Ge}from"./index-D5Esor4q.js";import{B as Je,o as Ke,l as Xe}from"./index-DDpL_qpY.js";import{p as Ye}from"./util-CYsTlK2W.js";function le({blocklet:e,style:r={},size:s=40,...i}){const l=ze({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,wordBreak:"break-all"},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)}),$=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)),$&&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;
@@ -0,0 +1 @@
1
+ import{j as o}from"./vendor-mui-core-CmD-NPnl.js";import"./vendor-react-Dvs43sk9.js";import{S as t}from"./studio-DkZBruFV.js";import"./vendor-ux-pYOhjQLA.js";import"./vendor-utils-DQK0pEML.js";import"./vendor-hooks-DLNZ8kxG.js";import"./lottie-web-4koyQiv_.js";import"./index-DhLCZYhn.js";import"./index-D5Esor4q.js";import"./vendor-arcblock-DEa0A9MF.js";function f(){return o.jsx(t,{children:"Coming soon..."})}export{f as default};
@@ -1,4 +1,4 @@
1
- import{at as fe,j as Y,W as te,J as Ye,bg as Xe,Q as Je,ak as _e,a6 as Le,cK as Ze,y as Fe,bb as We,M as Ue,cj as Qe,z as et}from"./vendor-mui-core-CmD-NPnl.js";import{u as tt}from"./useLocalStorage-vyIYLydJ.js";import{p as De,a as it,d as rt,g as Ne,r as oe}from"./vendor-react-Dvs43sk9.js";import{d as st,n as Re}from"./vendor-utils-DQK0pEML.js";import{aC as nt,Z as $e,ap as ot}from"./index-6k6hDX7K.js";import{T as at,D as Ae,F as ht,H as lt}from"./vendor-ux-ESjuHpb6.js";import{B as ct}from"./bundle-avatar-CF-8YjIk.js";import"./vendor-arcblock-C-xQV6LY.js";import"./vendor-hooks-DLNZ8kxG.js";import"./lottie-web-4koyQiv_.js";var ye={exports:{}},Be;function dt(){return Be||(Be=1,function(G,V){(function(j,K){G.exports=K()})(globalThis,()=>(()=>{var j={4567:function(R,s,o){var c=this&&this.__decorate||function(e,r,a,f){var p,g=arguments.length,l=g<3?r:f===null?f=Object.getOwnPropertyDescriptor(r,a):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,r,a,f);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(l=(g<3?p(l):g>3?p(r,a,l):p(r,a))||l);return g>3&&l&&Object.defineProperty(r,a,l),l},_=this&&this.__param||function(e,r){return function(a,f){r(a,f,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;const n=o(9042),d=o(9924),u=o(844),v=o(4725),h=o(2585),t=o(3656);let i=s.AccessibilityManager=class extends u.Disposable{constructor(e,r,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 fe,j as Y,W as te,J as Ye,bg as Xe,Q as Je,ak as _e,a6 as Le,cK as Ze,y as Fe,bb as We,M as Ue,cj as Qe,z as et}from"./vendor-mui-core-CmD-NPnl.js";import{u as tt}from"./useLocalStorage-CiLfInVV.js";import{p as De,a as it,d as rt,g as Ne,r as oe}from"./vendor-react-Dvs43sk9.js";import{d as st,n as Re}from"./vendor-utils-DQK0pEML.js";import{aC as nt,Z as $e,ap as ot}from"./index-D5Esor4q.js";import{T as at,D as Ae,F as ht,H as lt}from"./vendor-ux-pYOhjQLA.js";import{B as ct}from"./bundle-avatar-BhNvlq8g.js";import"./vendor-arcblock-DEa0A9MF.js";import"./vendor-hooks-DLNZ8kxG.js";import"./lottie-web-4koyQiv_.js";var ye={exports:{}},Be;function dt(){return Be||(Be=1,function(G,V){(function(j,K){G.exports=K()})(globalThis,()=>(()=>{var j={4567:function(R,s,o){var c=this&&this.__decorate||function(e,r,a,f){var p,g=arguments.length,l=g<3?r:f===null?f=Object.getOwnPropertyDescriptor(r,a):f;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")l=Reflect.decorate(e,r,a,f);else for(var m=e.length-1;m>=0;m--)(p=e[m])&&(l=(g<3?p(l):g>3?p(r,a,l):p(r,a))||l);return g>3&&l&&Object.defineProperty(r,a,l),l},_=this&&this.__param||function(e,r){return function(a,f){r(a,f,e)}};Object.defineProperty(s,"__esModule",{value:!0}),s.AccessibilityManager=void 0;const n=o(9042),d=o(9924),u=o(844),v=o(4725),h=o(2585),t=o(3656);let i=s.AccessibilityManager=class extends u.Disposable{constructor(e,r,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 r=0;r<e;r++)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,r){this._liveRegionDebouncer.refresh(e,r,this._terminal.rows)}_renderRows(e,r){const a=this._terminal.buffer,f=a.lines.length.toString();for(let p=e;p<=r;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,r){const a=e.target,f=this._rowElements[r===0?1:this._rowElements.length-2];if(a.getAttribute("aria-posinset")===(r===0?"1":`${this._terminal.buffer.lines.length}`)||e.relatedTarget!==f)return;let p,g;if(r===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),r===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(r===0?-1:1),this._rowElements[r===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 r={node:e.anchorNode,offset:e.anchorOffset},a={node:e.focusNode,offset:e.focusOffset};if((r.node.compareDocumentPosition(a.node)&Node.DOCUMENT_POSITION_PRECEDING||r.node===a.node&&r.offset>a.offset)&&([r,a]=[a,r]),r.node.compareDocumentPosition(this._rowElements[0])&(Node.DOCUMENT_POSITION_CONTAINED_BY|Node.DOCUMENT_POSITION_FOLLOWING)&&(r={node:this._rowElements[0].childNodes[0],offset:0}),!this._rowContainer.contains(r.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(r),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 r=this._rowContainer.children.length;r<this._terminal.rows;r++)this._rowElements[r]=this._createAccessibilityTreeNode(),this._rowContainer.appendChild(this._rowElements[r]);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`}};s.AccessibilityManager=i=c([_(1,h.IInstantiationService),_(2,v.ICoreBrowserService),_(3,v.IRenderService)],i)},3614:(R,s)=>{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(s,"__esModule",{value:!0}),s.rightClickHandler=s.moveTextAreaUnderMouseCursor=s.paste=s.handlePasteEvent=s.copyHandler=s.bracketTextForPaste=s.prepareTextForTerminal=void 0,s.prepareTextForTerminal=o,s.bracketTextForPaste=c,s.copyHandler=function(d,u){d.clipboardData&&d.clipboardData.setData("text/plain",u.selectionText),d.preventDefault()},s.handlePasteEvent=function(d,u,v,h){d.stopPropagation(),d.clipboardData&&_(d.clipboardData.getData("text/plain"),u,v,h)},s.paste=_,s.moveTextAreaUnderMouseCursor=n,s.rightClickHandler=function(d,u,v,h,t){n(d,u,v),t&&h.rightClickSelect(d),u.value=h.selectionText,u.select()}},7239:(R,s,o)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.ColorContrastCache=void 0;const c=o(1505);s.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,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.addDisposableDomListener=void 0,s.addDisposableDomListener=function(o,c,_,n){o.addEventListener(c,_,n);let d=!1;return{dispose:()=>{d||(d=!0,o.removeEventListener(c,_,n))}}}},3551:function(R,s,o){var c=this&&this.__decorate||function(i,e,r,a){var f,p=arguments.length,g=p<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,r):a;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")g=Reflect.decorate(i,e,r,a);else for(var l=i.length-1;l>=0;l--)(f=i[l])&&(g=(p<3?f(g):p>3?f(e,r,g):f(e,r))||g);return p>3&&g&&Object.defineProperty(e,r,g),g},_=this&&this.__param||function(i,e){return function(r,a){e(r,a,i)}};Object.defineProperty(s,"__esModule",{value:!0}),s.Linkifier=void 0;const n=o(3656),d=o(8460),u=o(844),v=o(2585),h=o(4725);let t=s.Linkifier=class extends u.Disposable{get currentLink(){return this._currentLink}constructor(i,e,r,a,f){super(),this._element=i,this._mouseService=e,this._renderService=r,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 r=i.composedPath();for(let a=0;a<r.length;a++){const f=r[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 r=!1;for(const[a,f]of this._linkProviderService.linkProviders.entries())e?this._activeProviderReplies?.get(a)&&(r=this._checkLinkProviderResult(a,i,r)):f.provideLinks(i.y,p=>{if(this._isMouseOut)return;const g=p?.map(l=>({link:l}));this._activeProviderReplies?.set(a,g),r=this._checkLinkProviderResult(a,i,r),this._activeProviderReplies?.size===this._linkProviderService.linkProviders.length&&this._removeIntersectingLinks(i.y,this._activeProviderReplies)})}_removeIntersectingLinks(i,e){const r=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(r.has(E)){f.splice(p--,1);break}r.add(E)}}}}_checkLinkProviderResult(i,e,r){if(!this._activeProviderReplies)return r;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&&(r=!0,this._handleNewLink(p))}if(this._activeProviderReplies.size===this._linkProviderService.linkProviders.length&&!r)for(let p=0;p<this._activeProviderReplies.size;p++){const g=this._activeProviderReplies.get(p)?.find(l=>this._linkAtPosition(l.link,e));if(g){r=!0,this._handleNewLink(g);break}}return r}_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:r=>{this._currentLink?.state&&this._currentLink.state.decorations.pointerCursor!==r&&(this._currentLink.state.decorations.pointerCursor=r,this._currentLink.state.isHovered&&this._element.classList.toggle("xterm-cursor-pointer",r))}},underline:{get:()=>this._currentLink?.state?.decorations.underline,set:r=>{this._currentLink?.state&&this._currentLink?.state?.decorations.underline!==r&&(this._currentLink.state.decorations.underline=r,this._currentLink.state.isHovered&&this._fireUnderlineEvent(i.link,r))}}}),this._linkCacheDisposables.push(this._renderService.onRenderedViewportChange(r=>{if(!this._currentLink)return;const a=r.start===0?0:r.start+1+this._bufferService.buffer.ydisp,f=this._bufferService.buffer.ydisp+1+r.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,r){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(r,e.text)}_fireUnderlineEvent(i,e){const r=i.range,a=this._bufferService.buffer.ydisp,f=this._createLinkUnderlineEvent(r.start.x-1,r.start.y-a-1,r.end.x,r.end.y-a-1,void 0);(e?this._onShowLinkUnderline:this._onHideLinkUnderline).fire(f)}_linkLeave(i,e,r){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(r,e.text)}_linkAtPosition(i,e){const r=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 r<=f&&f<=a}_positionFromMouseEvent(i,e,r){const a=r.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,r,a,f){return{x1:i,y1:e,x2:r,y2:a,cols:this._bufferService.cols,fg:f}}};s.Linkifier=t=c([_(1,h.IMouseService),_(2,h.IRenderService),_(3,v.IBufferService),_(4,h.ILinkProviderService)],t)},9042:(R,s)=>{Object.defineProperty(s,"__esModule",{value:!0}),s.tooMuchOutput=s.promptLabel=void 0,s.promptLabel="Terminal input",s.tooMuchOutput="Too much output to announce, navigate to rows manually to read"},3730:function(R,s,o){var c=this&&this.__decorate||function(h,t,i,e){var r,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--)(r=h[p])&&(f=(a<3?r(f):a>3?r(t,i,f):r(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(s,"__esModule",{value:!0}),s.OscLinkProvider=void 0;const n=o(511),d=o(2585);let u=s.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=[],r=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(!r?.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)=>r?r.activate(b,A,x):v(0,A),hover:(b,A)=>r?.hover?.(b,A,x),leave:(b,A)=>r?.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
 
@@ -0,0 +1 @@
1
+ import{z as e,A as s}from"./vendor-ux-pYOhjQLA.js";const c=e("blocklet-services");s("blocklet-services");export{c as d};
@@ -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-CmD-NPnl.js";import{f as fe,a as ue,b as ge,h as me}from"./vendor-hooks-DLNZ8kxG.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,aq as Pe,H as O,s as ke,b as ve,ar as $,as as je,at as be}from"./index-6k6hDX7K.js";import{C as W,b as _,J as Ie,c as Te}from"./vendor-utils-DQK0pEML.js";import{o as Ce}from"./vendor-arcblock-C-xQV6LY.js";import{$ as Le,J as _e,T as X,a0 as B,I as Re,a1 as We,a2 as Ae,H as M,B as Ee,a3 as z}from"./vendor-ux-ESjuHpb6.js";import{u as Ne}from"./use-passport-id-B-b-_oYF.js";import{g as V}from"./get-safe-url-C5Vpma4S.js";import{d as R}from"./logger-DHvXC8jl.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 Y({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]})}Y.propTypes={children:c.node,cta:c.node};function Z({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(Y,{...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")})]})]})})]})}Z.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(Z,{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-CmD-NPnl.js";import{f as fe,a as ue,b as ge,h as me}from"./vendor-hooks-DLNZ8kxG.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,aq as Pe,H as O,s as ke,b as ve,ar as $,as as je,at as be}from"./index-D5Esor4q.js";import{C as W,b as _,J as Ie,c as Te}from"./vendor-utils-DQK0pEML.js";import{o as Ce}from"./vendor-arcblock-DEa0A9MF.js";import{$ as Le,J as _e,T as X,a0 as B,I as Re,a1 as We,a2 as Ae,H as M,B as Ee,a3 as z}from"./vendor-ux-pYOhjQLA.js";import{u as Ne}from"./use-passport-id-B-b-_oYF.js";import{g as V}from"./get-safe-url-PVZ8sNva.js";import{d as R}from"./logger-Cror7fb1.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 Y({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]})}Y.propTypes={children:c.node,cta:c.node};function Z({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(Y,{...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")})]})]})})]})}Z.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(Z,{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-CmD-NPnl.js";import{g as x,j as f,h}from"./vendor-hooks-DLNZ8kxG.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-6k6hDX7K.js";import{T as v}from"./vendor-ux-ESjuHpb6.js";import{C as k}from"./vendor-utils-DQK0pEML.js";import"./vendor-arcblock-C-xQV6LY.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-CmD-NPnl.js";import{g as x,j as f,h}from"./vendor-hooks-DLNZ8kxG.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-D5Esor4q.js";import{T as v}from"./vendor-ux-pYOhjQLA.js";import{C as k}from"./vendor-utils-DQK0pEML.js";import"./vendor-arcblock-DEa0A9MF.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-CvK2LB0C.js","assets/index-6k6hDX7K.js","assets/vendor-mui-core-CmD-NPnl.js","assets/vendor-react-Dvs43sk9.js","assets/vendor-ux-ESjuHpb6.js","assets/vendor-utils-DQK0pEML.js","assets/vendor-hooks-DLNZ8kxG.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-C-xQV6LY.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,P as _,_ as k}from"./vendor-ux-ESjuHpb6.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-CmD-NPnl.js";import{n as d,C as z}from"./vendor-utils-DQK0pEML.js";const C=m.lazy(()=>k(()=>import("./index-CvK2LB0C.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-DIfIqZRw.js","assets/index-D5Esor4q.js","assets/vendor-mui-core-CmD-NPnl.js","assets/vendor-react-Dvs43sk9.js","assets/vendor-ux-pYOhjQLA.js","assets/vendor-utils-DQK0pEML.js","assets/vendor-hooks-DLNZ8kxG.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-DEa0A9MF.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,P as _,_ as k}from"./vendor-ux-pYOhjQLA.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-CmD-NPnl.js";import{n as d,C as z}from"./vendor-utils-DQK0pEML.js";const C=m.lazy(()=>k(()=>import("./index-DIfIqZRw.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;