@abtnode/blocklet-services 1.16.44-beta-20250520-004606-6cd8a0d3 → 1.16.44-beta-20250520-104453-912ed737

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (139) hide show
  1. package/dist/assets/{AdapterDayjs-D2uo6EnV.js → AdapterDayjs-Bck9Dv3l.js} +1 -1
  2. package/dist/assets/{ArrowDropDown-PfUV1pZb.js → ArrowDropDown-BleCy3ti.js} +1 -1
  3. package/dist/assets/{CheckCircle-zHdz-yvJ.js → CheckCircle-XrJDG94y.js} +1 -1
  4. package/dist/assets/{ChevronLeft-3zBX65MM.js → ChevronLeft-BlDLI-Qo.js} +1 -1
  5. package/dist/assets/{ChevronRight-BXgoqDfE.js → ChevronRight-DkPaON7R.js} +1 -1
  6. package/dist/assets/{DeleteOutline-BFB4Yy3c.js → DeleteOutline-Cj7UhBbF.js} +1 -1
  7. package/dist/assets/{Done-DboXobnH.js → Done-UEZFWnHj.js} +1 -1
  8. package/dist/assets/{Download-X3XR698Z.js → Download-CsoZ8yOi.js} +1 -1
  9. package/dist/assets/{Edit-Cl3SK-FJ.js → Edit-Bj4m2hpD.js} +1 -1
  10. package/dist/assets/{Error-CPi5ht0i.js → Error-BwUoSWOt.js} +1 -1
  11. package/dist/assets/{ExpandLess-D7OENe4H.js → ExpandLess-CjIzahHO.js} +1 -1
  12. package/dist/assets/{Google-Bl_7h7C7.js → Google-BON6upKi.js} +1 -1
  13. package/dist/assets/{InfoOutlined-BGorl_CI.js → InfoOutlined-uoMMChNE.js} +1 -1
  14. package/dist/assets/{Launch-5hxRq_We.js → Launch-rj4Kr2rA.js} +1 -1
  15. package/dist/assets/{LaunchOutlined-DCxTlWgy.js → LaunchOutlined-0gUfY-5D.js} +1 -1
  16. package/dist/assets/{MoreHoriz-Bncapj_R.js → MoreHoriz-3SNxR36h.js} +1 -1
  17. package/dist/assets/{PlayArrow-B19IPFeo.js → PlayArrow-BHO_DqT2.js} +1 -1
  18. package/dist/assets/{TuneOutlined-OuRuIP5i.js → TuneOutlined-BvtfOd23.js} +1 -1
  19. package/dist/assets/{ViewList-Bj0HBob4.js → ViewList-BvucdDXZ.js} +1 -1
  20. package/dist/assets/{access-control-BVDJgnnG.js → access-control-C9ZsDLlM.js} +1 -1
  21. package/dist/assets/{actions-B2RmHKJh.js → actions-BWSNMC_c.js} +1 -1
  22. package/dist/assets/{add-component-core-BLsjc3lE.js → add-component-core-Dd9KPcvp.js} +1 -1
  23. package/dist/assets/{add-resource-B0dZoJA8.js → add-resource-BHmsfuUO.js} +1 -1
  24. package/dist/assets/{addon-y9ZXCN0H.js → addon-CaGk2PdY.js} +1 -1
  25. package/dist/assets/{advanced-5oQIoiUN.js → advanced-DlILcrRl.js} +1 -1
  26. package/dist/assets/{appearance-58f9Dbcn.js → appearance-D1sGjeMk.js} +1 -1
  27. package/dist/assets/{audit-logs-fYqimPuZ.js → audit-logs-DfXh1JQZ.js} +1 -1
  28. package/dist/assets/{authorize-DC-SAlai.js → authorize-mEHpiCQH.js} +1 -1
  29. package/dist/assets/{base32-B42OVABo.js → base32-BnPQ4q4v.js} +1 -1
  30. package/dist/assets/{branding-DwHt5TFQ.js → branding-BHziMdwk.js} +2 -2
  31. package/dist/assets/{branding-eOJeN-jW.js → branding-CbgACClH.js} +2 -2
  32. package/dist/assets/{bundle-avatar-BoczFLNt.js → bundle-avatar-D7QQIJpo.js} +1 -1
  33. package/dist/assets/{button-C6SqoOU8.js → button-DXOAf3Np.js} +1 -1
  34. package/dist/assets/{click-to-copy-ClNoTzk4.js → click-to-copy-DtGgy9Ua.js} +1 -1
  35. package/dist/assets/{collapse-Dz_izL9k.js → collapse-iOiHn4dy.js} +1 -1
  36. package/dist/assets/{complete-B4rMuRkI.js → complete-CKdswLjZ.js} +1 -1
  37. package/dist/assets/{component-BzBSZbVF.js → component-amc-22MQ.js} +1 -1
  38. package/dist/assets/{config-tQft4lvg.js → config-B_jIm01w.js} +1 -1
  39. package/dist/assets/{config-CPFIXwk-.js → config-D3UduD_R.js} +1 -1
  40. package/dist/assets/{config-navigation-DdXZFw0Z.js → config-navigation-PoVJgHNU.js} +3 -3
  41. package/dist/assets/{config-space-CSZvQTns.js → config-space-D-DWHYER.js} +1 -1
  42. package/dist/assets/{confirm-hm6dpNbC.js → confirm-DaR0Yx39.js} +1 -1
  43. package/dist/assets/{connect-wIDYWNYf.js → connect-CVfkW49h.js} +1 -1
  44. package/dist/assets/connect-CvEHPjqh.js +5 -0
  45. package/dist/assets/{connect-to-Dwm_wvvo.js → connect-to-DrhAN5Nn.js} +1 -1
  46. package/dist/assets/{dashboard-BwU59vns.js → dashboard-B_QqB4aw.js} +3 -3
  47. package/dist/assets/{delete-confirm-BRkmB2tO.js → delete-confirm-DHB0S_Co.js} +1 -1
  48. package/dist/assets/{did-address-Ddg6Is1P.js → did-address-mv0Qw7hC.js} +1 -1
  49. package/dist/assets/domain-BR9srj-p.js +9 -0
  50. package/dist/assets/{domain-action-card-BnxgZfnv.js → domain-action-card-DtwNOaxH.js} +1 -1
  51. package/dist/assets/domains-Bg_t1pz-.js +1 -0
  52. package/dist/assets/dot-D3X4DSlo.js +7 -0
  53. package/dist/assets/{email-DhpxVPpg.js → email-DiuMAA8U.js} +1 -1
  54. package/dist/assets/{exchange-passport-3R6TCPya.js → exchange-passport-Bcw--2wm.js} +1 -1
  55. package/dist/assets/{fuel-C3Ao9T8_.js → fuel-BitXgq2D.js} +1 -1
  56. package/dist/assets/{gen-access-key-B5etX4Ba.js → gen-access-key-CrHniwdW.js} +1 -1
  57. package/dist/assets/{get-safe-url-DP-rZc23.js → get-safe-url-BRocR2aJ.js} +1 -1
  58. package/dist/assets/{get-safe-url-XcLmS0yc.js → get-safe-url-DYtntqqo.js} +1 -1
  59. package/dist/assets/{home-DtuKHXKD.js → home-jh95SgT7.js} +1 -1
  60. package/dist/assets/{iframe-BHwYGTAS.js → iframe-BlPuY8Pu.js} +1 -1
  61. package/dist/assets/{index-CmOE3ceE.js → index-BDcuaL48.js} +1 -1
  62. package/dist/assets/{index-DaoLXOw4.js → index-BO7CJLK3.js} +1 -1
  63. package/dist/assets/{index-CVDucF7E.js → index-BWshat_T.js} +1 -1
  64. package/dist/assets/{index-B6jePIag.js → index-BXkKeWVW.js} +1 -1
  65. package/dist/assets/{index-ToeWiBUL.js → index-B_y3Xcdb.js} +1 -1
  66. package/dist/assets/{index-DBsI6F1Z.js → index-Bi-YrbEk.js} +3 -3
  67. package/dist/assets/{index-Cb7iBSvd.js → index-Bv8sds6g.js} +1 -1
  68. package/dist/assets/{index-BKdJfp9x.js → index-CZOVduSH.js} +1 -1
  69. package/dist/assets/{index-Cd3oZl-N.js → index-Cgdb1aGn.js} +4 -4
  70. package/dist/assets/{index-C61DBznM.js → index-CleFkLt8.js} +1 -1
  71. package/dist/assets/{index-CFtGBtAw.js → index-CqRVUIz0.js} +1 -1
  72. package/dist/assets/{index-Dm4t4XH1.js → index-D0TzEmpA.js} +1 -1
  73. package/dist/assets/{index-DAEEDx1o.js → index-D3Od1Ju7.js} +1 -1
  74. package/dist/assets/{index-ND58NXzr.js → index-DO4zGWKz.js} +1 -1
  75. package/dist/assets/{index-C5_3pYA_.js → index-DYlN9Brg.js} +1 -1
  76. package/dist/assets/{index-kszsTfNH.js → index-RDZtjGNC.js} +1 -1
  77. package/dist/assets/{index-BzItMezw.js → index-YuW8IExe.js} +4 -4
  78. package/dist/assets/{index-sAnn-Wqb.js → index-c0hdujdn.js} +1 -1
  79. package/dist/assets/{index-BULZWXKq.js → index-hjv3dFXZ.js} +1 -1
  80. package/dist/assets/{invitation-qFWETxSc.js → invitation-BtuI3wbb.js} +1 -1
  81. package/dist/assets/{invite-Bg2Azggi.js → invite-CelTXbxx.js} +1 -1
  82. package/dist/assets/{issue-passport-DtnZs7_A.js → issue-passport-DGinrMdr.js} +1 -1
  83. package/dist/assets/{item-BYt6Ny1o.js → item-BhN-qZd_.js} +1 -1
  84. package/dist/assets/{landing-page-BiznyWTw.js → landing-page-D_TLvQ3s.js} +1 -1
  85. package/dist/assets/{layout-DE99yYfx.js → layout-0pbi4f6l.js} +1 -1
  86. package/dist/assets/{list-BkVwpX1t.js → list-C_1TcitB.js} +1 -1
  87. package/dist/assets/{list-UaF9rEdO.js → list-DKIkIMue.js} +2 -2
  88. package/dist/assets/localization-CpjVJ6VE.js +1 -0
  89. package/dist/assets/{log-D-KC9F0b.js → log-DnUF9orj.js} +1 -1
  90. package/dist/assets/{logger-GX3OECJW.js → logger-jMgD3u5g.js} +1 -1
  91. package/dist/assets/{login-D5-7Lt94.js → login-Boq_S2S7.js} +1 -1
  92. package/dist/assets/{login-oauth-callback-PDI2Klq3.js → login-oauth-callback-CuSXnq1m.js} +1 -1
  93. package/dist/assets/{logo-uploader-BNZB1sug.js → logo-uploader-DtAT8iaJ.js} +4 -4
  94. package/dist/assets/{lost-passport-kNOXw46l.js → lost-passport-DuJeKcGu.js} +1 -1
  95. package/dist/assets/{open-window-BEzzIgKH.js → open-window-DXP1LoPD.js} +1 -1
  96. package/dist/assets/{overview-qlJHwq1E.js → overview-DHcHPq6g.js} +1 -1
  97. package/dist/assets/{page-header-D9UEVC59.js → page-header-PO_g4wSK.js} +1 -1
  98. package/dist/assets/{passport-item-C7W2OqHa.js → passport-item-NMGbWwTG.js} +1 -1
  99. package/dist/assets/{permission-KYy-A4oZ.js → permission-BfddnDBs.js} +1 -1
  100. package/dist/assets/{preferences-DXEo6kgA.js → preferences-Nt4L8Zgv.js} +1 -1
  101. package/dist/assets/{profile-embed-faK_BKhI.js → profile-embed-C9nHKFrf.js} +1 -1
  102. package/dist/assets/{publish-resource-D8YEMAlU.js → publish-resource-BL83FldI.js} +1 -1
  103. package/dist/assets/{react-beautiful-dnd.esm-vpuu2z51.js → react-beautiful-dnd.esm-0e7VDGmi.js} +1 -1
  104. package/dist/assets/{runtime-CKW1HKn_.js → runtime-FDEoUn52.js} +1 -1
  105. package/dist/assets/sdk-CytUSheP.js +1 -0
  106. package/dist/assets/{security-Dt3PKq-c.js → security-BuN2nUoZ.js} +1 -1
  107. package/dist/assets/{session-CSqVp1zS.js → session-DUt5rVEy.js} +1 -1
  108. package/dist/assets/{setup-BlQH2Z6r.js → setup-BB0XLqW9.js} +3 -3
  109. package/dist/assets/{spaces-rexKSkSX.js → spaces-MprwX1Iq.js} +1 -1
  110. package/dist/assets/{start-_8paEixr.js → start-C7CIzLBY.js} +1 -1
  111. package/dist/assets/{starting-progress-CvmzmBMV.js → starting-progress-BJCVRFkE.js} +1 -1
  112. package/dist/assets/{status-BDhcfo0L.js → status-Bo92foK0.js} +1 -1
  113. package/dist/assets/{step-actions-iPiCkXbU.js → step-actions-D__rjlW_.js} +1 -1
  114. package/dist/assets/{studio-A7rMh4Xk.js → studio-kVKG7W3n.js} +1 -1
  115. package/dist/assets/{switch-control-BmaFq4ZK.js → switch-control-BgwZFVCJ.js} +1 -1
  116. package/dist/assets/{table-tips-DnNYXRDB.js → table-tips-nPiIcvAy.js} +1 -1
  117. package/dist/assets/{traffic-BMZEqBnG.js → traffic-Cd92p-Xb.js} +1 -1
  118. package/dist/assets/{transfer-2aML1rIB.js → transfer-U9z5JNMl.js} +1 -1
  119. package/dist/assets/{unsubscribe-BuBJl9gX.js → unsubscribe-BmAshFCd.js} +1 -1
  120. package/dist/assets/{use-blocklet-logo-2Y2A06qi.js → use-blocklet-logo-3VH4RBTr.js} +1 -1
  121. package/dist/assets/useAsync-CDjYBiwf.js +1 -0
  122. package/dist/assets/useAsync-dC0jHVWO.js +1 -0
  123. package/dist/assets/{useLocalStorage-BFO9aBYY.js → useLocalStorage-DotMjDUB.js} +1 -1
  124. package/dist/assets/{user-center-gbex4PJG.js → user-center-8aoMSkJ_.js} +1 -1
  125. package/dist/assets/{util-DMDaTiE0.js → util-CiTimo-i.js} +1 -1
  126. package/dist/assets/{util-xFBxHmZK.js → util-CuK9uaNS.js} +1 -1
  127. package/dist/assets/{vendor-arcblock-C99E80cF.js → vendor-arcblock-Ca95GLVH.js} +8 -22
  128. package/dist/assets/{vendor-ux-did-connect-Qap4yrMu.js → vendor-ux-did-connect-D0L9YnHn.js} +5 -5
  129. package/dist/assets/{wrap-locale-C4cvZ4CE.js → wrap-locale-QBHz1ECC.js} +1 -1
  130. package/dist/index.html +3 -3
  131. package/dist/service-worker.js +1 -1
  132. package/package.json +31 -31
  133. package/dist/assets/connect-BeFPxq9a.js +0 -5
  134. package/dist/assets/domain-hqA29r7o.js +0 -9
  135. package/dist/assets/domains-BkjwRhdu.js +0 -1
  136. package/dist/assets/dot-CdVWOAIG.js +0 -7
  137. package/dist/assets/localization-CTcPOuKl.js +0 -1
  138. package/dist/assets/sdk-B_abqbXe.js +0 -1
  139. package/dist/assets/useAsync-JBeeXlrl.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as e,aa as t,ab as P,be as W,H as d,ah as B}from"./vendor-mui-core-Bh-qMRq3.js";import{r as l}from"./vendor-react-DEoibe3W.js";import{A as v}from"./vendor-utils-rHXShPKm.js";import{d as I}from"./Launch-5hxRq_We.js";import{b1 as L,am as $}from"./vendor-ux-did-connect-Qap4yrMu.js";import{W as A}from"./did-address-Ddg6Is1P.js";import{P as E}from"./page-header-D9UEVC59.js";import{o as T,u as z}from"./index-BzItMezw.js";import{S as D}from"./layout-DE99yYfx.js";import{S as F}from"./step-actions-iPiCkXbU.js";import{S as m}from"./button-C6SqoOU8.js";import"./vendor-hooks-DpwFseeF.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-C99E80cF.js";import"./content-layout--sy9JlYZ.js";import"./use-mobile-ZAS6Si4t.js";function u({onNext:n,onPrevious:f}){const{locale:x,t:s}=l.useContext(L),{blocklet:a,gas:c,tokenInfo:h,actions:j}=T(),{api:y}=z(),[g,o]=l.useState(!1),{need:p="",current:b="",owe:r=99999,deficiency:k,symbol:C="",endpoint:i}=c||{},{origin:S="/"}=i?new URL(i):{};l.useEffect(()=>{const N=setInterval(()=>{j.refreshFuel()},2e3);return()=>{clearInterval(N)}},[]);const w=()=>{o(!1)};return c?e.jsxs(H,{children:[e.jsx("div",{className:"header",children:e.jsx(E,{title:s("setup.fuel.title"),onClickBack:f})}),e.jsxs(t,{className:"qr-body",children:[e.jsxs(t,{mb:6,className:"tip",children:[s("setup.fuel.tipStart").replace("slot",""),e.jsx("span",{className:"amount",children:`${p} ${C}`}),s("setup.fuel.tipEnd")]}),e.jsx(t,{fontSize:16,fontWeight:"fontWeightBold",mb:.5,children:s("setup.fuel.addressTitle")}),e.jsxs(t,{display:"flex",alignItems:"center",children:[e.jsx(A,{className:"address",did:a.appDid}),e.jsx(W,{style:{lineHeight:1},target:"_blank",href:v(S,"/explorer/accounts/",a.appDid),underline:"hover",children:e.jsx(I,{className:"icon-launch"})})]}),e.jsx(t,{my:2,children:e.jsx(m,{color:"primary",onClick:()=>o(!0),disabled:!r,children:s("setup.fuel.fuelApp")})}),e.jsx($,{popup:!0,open:g,action:"fuel",checkFn:y.get,checkTimeout:10*60*1e3,onSuccess:w,onClose:()=>o(!1),locale:x,messages:{title:s("setup.connect.title"),scan:s("setup.connect.scan"),confirm:s("setup.connect.confirm"),success:s("setup.connect.success")},extraParams:{amount:k,...h,endpoint:i}}),e.jsxs(t,{display:"flex",color:"text.secondary",children:[e.jsxs(t,{display:"flex",children:[e.jsxs(t,{children:[s("setup.fuel.need"),":"]}),e.jsx(t,{ml:.5,color:"primary.main",fontWeight:"fontWeightBold",children:p})]}),e.jsxs(t,{display:"flex",ml:3,children:[e.jsxs(t,{children:[s("setup.fuel.current"),":"]}),e.jsx(t,{ml:.5,color:r>0?"error.main":"primary.main",fontWeight:"fontWeightBold",children:b})]})]})]}),e.jsx(F,{mt:8,children:e.jsx(m,{disabled:r>0,onClick:()=>n(),children:s("setup.next")})})]}):e.jsx(t,{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",children:e.jsx(P,{})})}u.propTypes={onNext:d.func,onPrevious:d.func};u.defaultProps={onNext:()=>{},onPrevious:()=>{}};const H=B(D)`
1
+ import{j as e,aa as t,ab as P,be as W,H as d,ah as B}from"./vendor-mui-core-Bh-qMRq3.js";import{r as l}from"./vendor-react-DEoibe3W.js";import{A as v}from"./vendor-utils-rHXShPKm.js";import{d as I}from"./Launch-rj4Kr2rA.js";import{b1 as L,am as $}from"./vendor-ux-did-connect-D0L9YnHn.js";import{W as A}from"./did-address-mv0Qw7hC.js";import{P as E}from"./page-header-PO_g4wSK.js";import{o as T,u as z}from"./index-YuW8IExe.js";import{S as D}from"./layout-0pbi4f6l.js";import{S as F}from"./step-actions-D__rjlW_.js";import{S as m}from"./button-DXOAf3Np.js";import"./vendor-hooks-DpwFseeF.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-Ca95GLVH.js";import"./content-layout--sy9JlYZ.js";import"./use-mobile-JEGQfLZ2.js";function u({onNext:n,onPrevious:f}){const{locale:x,t:s}=l.useContext(L),{blocklet:a,gas:c,tokenInfo:h,actions:j}=T(),{api:y}=z(),[g,o]=l.useState(!1),{need:p="",current:b="",owe:r=99999,deficiency:k,symbol:C="",endpoint:i}=c||{},{origin:S="/"}=i?new URL(i):{};l.useEffect(()=>{const N=setInterval(()=>{j.refreshFuel()},2e3);return()=>{clearInterval(N)}},[]);const w=()=>{o(!1)};return c?e.jsxs(H,{children:[e.jsx("div",{className:"header",children:e.jsx(E,{title:s("setup.fuel.title"),onClickBack:f})}),e.jsxs(t,{className:"qr-body",children:[e.jsxs(t,{mb:6,className:"tip",children:[s("setup.fuel.tipStart").replace("slot",""),e.jsx("span",{className:"amount",children:`${p} ${C}`}),s("setup.fuel.tipEnd")]}),e.jsx(t,{fontSize:16,fontWeight:"fontWeightBold",mb:.5,children:s("setup.fuel.addressTitle")}),e.jsxs(t,{display:"flex",alignItems:"center",children:[e.jsx(A,{className:"address",did:a.appDid}),e.jsx(W,{style:{lineHeight:1},target:"_blank",href:v(S,"/explorer/accounts/",a.appDid),underline:"hover",children:e.jsx(I,{className:"icon-launch"})})]}),e.jsx(t,{my:2,children:e.jsx(m,{color:"primary",onClick:()=>o(!0),disabled:!r,children:s("setup.fuel.fuelApp")})}),e.jsx($,{popup:!0,open:g,action:"fuel",checkFn:y.get,checkTimeout:10*60*1e3,onSuccess:w,onClose:()=>o(!1),locale:x,messages:{title:s("setup.connect.title"),scan:s("setup.connect.scan"),confirm:s("setup.connect.confirm"),success:s("setup.connect.success")},extraParams:{amount:k,...h,endpoint:i}}),e.jsxs(t,{display:"flex",color:"text.secondary",children:[e.jsxs(t,{display:"flex",children:[e.jsxs(t,{children:[s("setup.fuel.need"),":"]}),e.jsx(t,{ml:.5,color:"primary.main",fontWeight:"fontWeightBold",children:p})]}),e.jsxs(t,{display:"flex",ml:3,children:[e.jsxs(t,{children:[s("setup.fuel.current"),":"]}),e.jsx(t,{ml:.5,color:r>0?"error.main":"primary.main",fontWeight:"fontWeightBold",children:b})]})]})]}),e.jsx(F,{mt:8,children:e.jsx(m,{disabled:r>0,onClick:()=>n(),children:s("setup.next")})})]}):e.jsx(t,{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",children:e.jsx(P,{})})}u.propTypes={onNext:d.func,onPrevious:d.func};u.defaultProps={onNext:()=>{},onPrevious:()=>{}};const H=B(D)`
2
2
  .qr-body {
3
3
  width: 580px;
4
4
  ${n=>n.theme.breakpoints.down("md")} {
@@ -1,2 +1,2 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CPE8Apzb.js","assets/vendor-react-DEoibe3W.js"])))=>i.map(i=>d[i]);
2
- import{a9 as D,j as e,e as T,y as A,aa as l,T as d,ab as U}from"./vendor-mui-core-Bh-qMRq3.js";import{r as W,o as F,b1 as M,C as N,aX as z,bd as O,j as k}from"./vendor-ux-did-connect-Qap4yrMu.js";import{_ as q,R as m}from"./vendor-arcblock-C99E80cF.js";import{d as B}from"./CheckCircle-zHdz-yvJ.js";import{a as H,u as P}from"./vendor-hooks-DpwFseeF.js";import{r as a,f as X,h as K}from"./vendor-react-DEoibe3W.js";import{L as u}from"./landing-page-BiznyWTw.js";import{A as V}from"./vendor-utils-rHXShPKm.js";import{u as G}from"./index-BzItMezw.js";import"./lottie-web-jYmAQWuC.js";var f={},$=D;Object.defineProperty(f,"__esModule",{value:!0});var S=f.default=void 0,J=$(W()),Q=e;S=f.default=(0,J.default)((0,Q.jsx)("path",{d:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"}),"Home");function Y(){const o=F();return a.useCallback(()=>{if(o!=null&&o.wallet){q(()=>import("./index-CPE8Apzb.js").then(r=>r.i),__vite__mapDeps([0,1])).then(r=>{setTimeout(()=>{r.call("arcClosePage")},2e3)});return}setTimeout(()=>{window.close()},500)},[o==null?void 0:o.wallet])}function de(){var y,w,_,E;const o=X(),r=a.useRef(null),{t:s,locale:p}=a.useContext(M),{api:x,connectApi:h}=G(),[C]=K(),R=T(),b=Y(),t=H({ready:!1,success:!1,error:null,invalidSession:!1}),I=()=>{try{const n=new URL(window.location.href);if(n.hash.includes("invalid")){t.invalidSession=!0;return}const c=n.searchParams.get("__connect_url__"),L=z(c);if(!O(L))throw new Error("No token");t.ready=!0}catch{t.invalidSession=!0,o("#invalid",{replace:!0})}};a.useLayoutEffect(()=>I(),[]);const v=P(n=>{var c;t.error=n.message,(c=window.opener)==null||c.postMessage({type:"connect-endpoint-message",error:t.error},"*"),o("#invalid",{replace:!0})}),g=P(()=>{var n;(n=window.opener)==null||n.postMessage({type:"connect-endpoint-message",success:!0},"*"),t.success=!0}),i=C.get("source")||"Generate Access Key";a.useEffect(()=>{r.current&&t.ready&&h.open({locale:p,containerEl:r.current,action:"gen-access-key",extraParams:{remark:i},checkFn:x.get,saveConnect:!1,forceConnected:!1,className:"connect",popup:!1,baseUrl:window.location.origin,prefix:V(window.location.origin,k.WELLKNOWN_SERVICE_PATH_PREFIX,k.API_DID_PREFIX),messages:{title:s("connectCli.title"),scan:s("connectCli.scan"),confirm:s("auth.confirm"),success:s("connectCli.success")},onSuccess:g,onError:v},{locale:p})},[h,t.ready,x,v,g,p,s,i]);const j=e.jsx(A,{variant:"outlined",color:"primary",size:"small",startIcon:e.jsx(S,{}),href:"/",style:{borderRadius:4},children:s("connectCli.home")});if(t.invalidSession)return e.jsx(u,{did:(y=window.blocklet)==null?void 0:y.appPid,standalone:!0,children:e.jsx(m,{style:{backgroundColor:"transparent"},status:"error",title:s("connectCli.invalidSession"),description:s("connectCli.invalidSessionDesc"),extra:j})},"invalid");if(t.error){const n=t.error,c=j;return e.jsx(u,{did:(w=window.blocklet)==null?void 0:w.appPid,standalone:!0,children:e.jsx(m,{style:{backgroundColor:"transparent"},status:"error",title:s("connectCli.connectionError"),description:n,extra:c})},"error")}return t.success?(C.has("closeOnSuccess")&&b(),e.jsx(u,{did:(_=window.blocklet)==null?void 0:_.appPid,standalone:!0,children:e.jsx(m,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(B,{style:{color:R.palette.success.main,fontSize:72}}),title:s("connectCli.success",{source:i}),description:s("connectCli.successDesc",{source:i})})},"success")):t.ready?e.jsx(u,{did:(E=window.blocklet)==null?void 0:E.appPid,standalone:!0,children:e.jsxs(l,{sx:{maxWidth:"100%",height:"100%"},children:[e.jsxs(l,{sx:{mb:5},children:[e.jsx(d,{variant:"h4",component:"h1",sx:{mb:1,fontWeight:"bold",textAlign:"center"},children:s("connectCli.tips.title")}),e.jsxs(l,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"center"},children:[e.jsx(d,{sx:{color:"text.secondary"},children:s("connectCli.tips.item1")}),e.jsx(d,{sx:{color:"text.secondary"},children:s("connectCli.tips.item2")}),e.jsx(d,{sx:{color:"text.secondary"},children:s("connectCli.tips.item3")})]})]}),e.jsx(l,{sx:{display:"inline-block"},ref:r})]})},"ready"):e.jsx(N,{children:e.jsx(U,{})})}export{de as default};
2
+ import{a9 as D,j as e,e as T,y as A,aa as l,T as d,ab as U}from"./vendor-mui-core-Bh-qMRq3.js";import{r as W,o as F,b1 as M,C as N,aX as z,bd as O,j as k}from"./vendor-ux-did-connect-D0L9YnHn.js";import{_ as q,R as m}from"./vendor-arcblock-Ca95GLVH.js";import{d as B}from"./CheckCircle-XrJDG94y.js";import{a as H,u as P}from"./vendor-hooks-DpwFseeF.js";import{r as a,f as X,h as K}from"./vendor-react-DEoibe3W.js";import{L as u}from"./landing-page-D_TLvQ3s.js";import{A as V}from"./vendor-utils-rHXShPKm.js";import{u as G}from"./index-YuW8IExe.js";import"./lottie-web-jYmAQWuC.js";var f={},$=D;Object.defineProperty(f,"__esModule",{value:!0});var S=f.default=void 0,J=$(W()),Q=e;S=f.default=(0,J.default)((0,Q.jsx)("path",{d:"M10 20v-6h4v6h5v-8h3L12 3 2 12h3v8z"}),"Home");function Y(){const o=F();return a.useCallback(()=>{if(o!=null&&o.wallet){q(()=>import("./index-CPE8Apzb.js").then(r=>r.i),__vite__mapDeps([0,1])).then(r=>{setTimeout(()=>{r.call("arcClosePage")},2e3)});return}setTimeout(()=>{window.close()},500)},[o==null?void 0:o.wallet])}function de(){var y,w,_,E;const o=X(),r=a.useRef(null),{t:s,locale:p}=a.useContext(M),{api:x,connectApi:h}=G(),[C]=K(),R=T(),b=Y(),t=H({ready:!1,success:!1,error:null,invalidSession:!1}),I=()=>{try{const n=new URL(window.location.href);if(n.hash.includes("invalid")){t.invalidSession=!0;return}const c=n.searchParams.get("__connect_url__"),L=z(c);if(!O(L))throw new Error("No token");t.ready=!0}catch{t.invalidSession=!0,o("#invalid",{replace:!0})}};a.useLayoutEffect(()=>I(),[]);const v=P(n=>{var c;t.error=n.message,(c=window.opener)==null||c.postMessage({type:"connect-endpoint-message",error:t.error},"*"),o("#invalid",{replace:!0})}),g=P(()=>{var n;(n=window.opener)==null||n.postMessage({type:"connect-endpoint-message",success:!0},"*"),t.success=!0}),i=C.get("source")||"Generate Access Key";a.useEffect(()=>{r.current&&t.ready&&h.open({locale:p,containerEl:r.current,action:"gen-access-key",extraParams:{remark:i},checkFn:x.get,saveConnect:!1,forceConnected:!1,className:"connect",popup:!1,baseUrl:window.location.origin,prefix:V(window.location.origin,k.WELLKNOWN_SERVICE_PATH_PREFIX,k.API_DID_PREFIX),messages:{title:s("connectCli.title"),scan:s("connectCli.scan"),confirm:s("auth.confirm"),success:s("connectCli.success")},onSuccess:g,onError:v},{locale:p})},[h,t.ready,x,v,g,p,s,i]);const j=e.jsx(A,{variant:"outlined",color:"primary",size:"small",startIcon:e.jsx(S,{}),href:"/",style:{borderRadius:4},children:s("connectCli.home")});if(t.invalidSession)return e.jsx(u,{did:(y=window.blocklet)==null?void 0:y.appPid,standalone:!0,children:e.jsx(m,{style:{backgroundColor:"transparent"},status:"error",title:s("connectCli.invalidSession"),description:s("connectCli.invalidSessionDesc"),extra:j})},"invalid");if(t.error){const n=t.error,c=j;return e.jsx(u,{did:(w=window.blocklet)==null?void 0:w.appPid,standalone:!0,children:e.jsx(m,{style:{backgroundColor:"transparent"},status:"error",title:s("connectCli.connectionError"),description:n,extra:c})},"error")}return t.success?(C.has("closeOnSuccess")&&b(),e.jsx(u,{did:(_=window.blocklet)==null?void 0:_.appPid,standalone:!0,children:e.jsx(m,{style:{backgroundColor:"transparent"},status:"info",icon:e.jsx(B,{style:{color:R.palette.success.main,fontSize:72}}),title:s("connectCli.success",{source:i}),description:s("connectCli.successDesc",{source:i})})},"success")):t.ready?e.jsx(u,{did:(E=window.blocklet)==null?void 0:E.appPid,standalone:!0,children:e.jsxs(l,{sx:{maxWidth:"100%",height:"100%"},children:[e.jsxs(l,{sx:{mb:5},children:[e.jsx(d,{variant:"h4",component:"h1",sx:{mb:1,fontWeight:"bold",textAlign:"center"},children:s("connectCli.tips.title")}),e.jsxs(l,{sx:{display:"flex",flexDirection:"column",gap:1,alignItems:"center"},children:[e.jsx(d,{sx:{color:"text.secondary"},children:s("connectCli.tips.item1")}),e.jsx(d,{sx:{color:"text.secondary"},children:s("connectCli.tips.item2")}),e.jsx(d,{sx:{color:"text.secondary"},children:s("connectCli.tips.item3")})]})]}),e.jsx(l,{sx:{display:"inline-block"},ref:r})]})},"ready"):e.jsx(N,{children:e.jsx(U,{})})}export{de as default};
@@ -1 +1 @@
1
- import{bb as t,Y as o}from"./vendor-ux-did-connect-Qap4yrMu.js";function i(...e){try{return t(...e)}catch(r){throw o.error("Invalid redirect url"),console.error("Invalid redirect url",r),r}}export{i as g};
1
+ import{bb as t,Y as o}from"./vendor-ux-did-connect-D0L9YnHn.js";function i(...e){try{return t(...e)}catch(r){throw o.error("Invalid redirect url"),console.error("Invalid redirect url",r),r}}export{i as g};
@@ -1 +1 @@
1
- import{bb as t,Y as o}from"./vendor-ux-did-connect-Qap4yrMu.js";function i(...e){try{return t(...e)}catch(r){throw o.error("Invalid redirect url"),console.error("Invalid redirect url",r),r}}export{i as g};
1
+ import{bb as t,Y as o}from"./vendor-ux-did-connect-D0L9YnHn.js";function i(...e){try{return t(...e)}catch(r){throw o.error("Invalid redirect url"),console.error("Invalid redirect url",r),r}}export{i as g};
@@ -1 +1 @@
1
- import{j as o,al as n}from"./vendor-mui-core-Bh-qMRq3.js";import{L as r}from"./vendor-react-DEoibe3W.js";import{B as i,j as t}from"./vendor-ux-did-connect-Qap4yrMu.js";import{S as e}from"./studio-A7rMh4Xk.js";import"./vendor-utils-rHXShPKm.js";import"./vendor-hooks-DpwFseeF.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-C99E80cF.js";import"./TuneOutlined-OuRuIP5i.js";function L(){return o.jsx(e,{children:o.jsxs(n,{direction:"row",m:4,spacing:2,children:[o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/preferences`,size:"large",color:"primary",variant:"outlined",children:"Preference Builder"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/branding`,size:"large",color:"primary",variant:"outlined",children:"Branding Images"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/localization`,size:"large",color:"primary",variant:"outlined",children:"Localization"})]})})}export{L as default};
1
+ import{j as o,al as n}from"./vendor-mui-core-Bh-qMRq3.js";import{L as r}from"./vendor-react-DEoibe3W.js";import{B as i,j as t}from"./vendor-ux-did-connect-D0L9YnHn.js";import{S as e}from"./studio-kVKG7W3n.js";import"./vendor-utils-rHXShPKm.js";import"./vendor-hooks-DpwFseeF.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-Ca95GLVH.js";import"./TuneOutlined-BvtfOd23.js";function L(){return o.jsx(e,{children:o.jsxs(n,{direction:"row",m:4,spacing:2,children:[o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/preferences`,size:"large",color:"primary",variant:"outlined",children:"Preference Builder"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/branding`,size:"large",color:"primary",variant:"outlined",children:"Branding Images"}),o.jsx(i,{component:r,to:`${t.WELLKNOWN_SERVICE_PATH_PREFIX}/studio/localization`,size:"large",color:"primary",variant:"outlined",children:"Localization"})]})})}export{L as default};
@@ -1 +1 @@
1
- import{b as x}from"./vendor-react-DEoibe3W.js";import{B as E}from"./vendor-arcblock-C99E80cF.js";const L=({url:r,allowFullScreen:o,position:a,display:i,height:u,width:c,overflow:f,styles:y,onLoad:p,onMouseOver:m,onMouseOut:b,scrolling:w,id:d,frameBorder:n,ariaHidden:O,sandbox:s,allow:j,className:g,title:h,ariaLabel:k,ariaLabelledby:I,name:P,target:v,loading:A,importance:F,referrerpolicy:M,allowpaymentrequest:S,src:$,key:q})=>{const t=E({src:$||r,target:v||null,style:{position:a||null,display:i||"initial",overflow:f||null},scrolling:w||null,allowpaymentrequest:S||null,importance:F||null,sandbox:s&&[...s].join(" ")||null,loading:A||null,styles:y||null,name:P||null,className:g||null,allowFullScreen:"allowFullScreen",referrerpolicy:M||null,title:h||null,allow:j||null,id:d||null,"aria-labelledby":I||null,"aria-hidden":O||null,"aria-label":k||null,width:c||null,height:u||null,onLoad:p||null,onMouseOver:m||null,onMouseOut:b||null,key:q||"iframe"});let l=Object.create(null);for(let e of Object.keys(t))t[e]!=null&&(l[e]=t[e]);for(let e of Object.keys(l.style))l.style[e]==null&&delete l.style[e];if(l.styles)for(let e of Object.keys(l.styles))l.styles.hasOwnProperty(e)&&(l.style[e]=l.styles[e]),Object.keys(l.styles).pop()==e&&delete l.styles;if(o)if("allow"in l){const e=l.allow.replace("fullscreen","");l.allow=`fullscreen ${e.trim()}`.trim()}else l.allow="fullscreen";return n>=0&&(l.style.hasOwnProperty("border")||(l.style.border=n)),x.createElement("iframe",Object.assign({},l))},z=L;export{z as I};
1
+ import{b as x}from"./vendor-react-DEoibe3W.js";import{B as E}from"./vendor-arcblock-Ca95GLVH.js";const L=({url:r,allowFullScreen:o,position:a,display:i,height:u,width:c,overflow:f,styles:y,onLoad:p,onMouseOver:m,onMouseOut:b,scrolling:w,id:d,frameBorder:n,ariaHidden:O,sandbox:s,allow:j,className:g,title:h,ariaLabel:k,ariaLabelledby:I,name:P,target:v,loading:A,importance:F,referrerpolicy:M,allowpaymentrequest:S,src:$,key:q})=>{const t=E({src:$||r,target:v||null,style:{position:a||null,display:i||"initial",overflow:f||null},scrolling:w||null,allowpaymentrequest:S||null,importance:F||null,sandbox:s&&[...s].join(" ")||null,loading:A||null,styles:y||null,name:P||null,className:g||null,allowFullScreen:"allowFullScreen",referrerpolicy:M||null,title:h||null,allow:j||null,id:d||null,"aria-labelledby":I||null,"aria-hidden":O||null,"aria-label":k||null,width:c||null,height:u||null,onLoad:p||null,onMouseOver:m||null,onMouseOut:b||null,key:q||"iframe"});let l=Object.create(null);for(let e of Object.keys(t))t[e]!=null&&(l[e]=t[e]);for(let e of Object.keys(l.style))l.style[e]==null&&delete l.style[e];if(l.styles)for(let e of Object.keys(l.styles))l.styles.hasOwnProperty(e)&&(l.style[e]=l.styles[e]),Object.keys(l.styles).pop()==e&&delete l.styles;if(o)if("allow"in l){const e=l.allow.replace("fullscreen","");l.allow=`fullscreen ${e.trim()}`.trim()}else l.allow="fullscreen";return n>=0&&(l.style.hasOwnProperty("border")||(l.style.border=n)),x.createElement("iframe",Object.assign({},l))},z=L;export{z as I};
@@ -1,4 +1,4 @@
1
- import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,j as e,aa as T,O as te,bs as ge,bt as We,bo as Y,ad as xt,H as x,a9 as Je,T as ae,E as Qe,bz as gt,bQ as qe,bR as Ke,y as Le,b3 as Me,ab as bt,bI as jt,Y as vt,cp as yt,m as Ht,bb as dt,br as Vt,bn as Yt,q as ut,bY as Gt,I as Jt}from"./vendor-mui-core-Bh-qMRq3.js";import{J as St,z as Qt,A as Xt,e as fe,aB as ye,C as Zt}from"./vendor-utils-rHXShPKm.js";import{a as re,a4 as Ct,Y as K,bP as es,B as me,b1 as ts,aq as wt,j as W,b6 as ss,r as Xe,bQ as ns,X as Tt,a5 as Rt,bm as Ae,ak as Nt,V as is,bt as as}from"./vendor-ux-did-connect-Qap4yrMu.js";import{A as Ze,D as Et,ay as It,az as X,v as se,l as rs,H as pt}from"./index-BzItMezw.js";import{a as Te,u as V,f as ce}from"./vendor-hooks-DpwFseeF.js";import{a as et,b as os}from"./dashboard-BwU59vns.js";import{l as ls,v as ke}from"./vendor-arcblock-C99E80cF.js";import{f as $e,i as cs,d as ds}from"./use-blocklet-logo-2Y2A06qi.js";import{A as us,a as ps,d as fs,b as ms}from"./collapse-Dz_izL9k.js";import{S as ee}from"./section-C1TPQFRq.js";import{S as Re}from"./shorten-label-Bf7YQUd6.js";import{I as At}from"./index-Cb7iBSvd.js";import{R as Ot,A as hs,S as xs,a as gs,b as bs,B as js}from"./list-BkVwpX1t.js";import{W as vs}from"./did-address-Ddg6Is1P.js";import{p as Dt}from"./util-DMDaTiE0.js";import{D as ys,g as Ss}from"./traffic-BMZEqBnG.js";import{B as Lt}from"./bundle-avatar-BoczFLNt.js";import{u as Cs}from"./use-mobile-JEGQfLZ2.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BFO9aBYY.js";import"./index-8eXqqyHQ.js";import"./confirm-hm6dpNbC.js";import"./PlayArrow-B19IPFeo.js";import"./get-safe-url-XcLmS0yc.js";import"./session-CSqVp1zS.js";import"./InfoOutlined-BGorl_CI.js";import"./dot-CdVWOAIG.js";import"./useAsync-JBeeXlrl.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-ZAS6Si4t.js";import"./index-C849wD9b.js";import"./CheckCircle-zHdz-yvJ.js";import"./index-sAnn-Wqb.js";import"./Phone--BSu-btI.js";import"./Location-By12Z3Te.js";import"./Email-CdSNK0eA.js";import"./Timezone-YZ0dMUEr.js";import"./base32-B42OVABo.js";import"./iframe-BHwYGTAS.js";import"./LaunchOutlined-DCxTlWgy.js";import"./ChevronLeft-3zBX65MM.js";import"./ChevronRight-BXgoqDfE.js";import"./index-CmQOzzP8.js";import"./vendor-mui-x-CQTjfcpn.js";import"./AdapterDayjs-D2uo6EnV.js";var Ue={exports:{}},He={exports:{}},Ve={exports:{}};(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;function s(r){return r==null}n.exports=t.default,n.exports.default=t.default})(Ve,Ve.exports);var ws=Ve.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var s=o(ls),r=o(ws);function o(h){return h&&h.__esModule?h:{default:h}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,y=/^[-+]?[0-9]+$/;function p(h,i){(0,s.default)(h),i=i||{};var A=i.allow_leading_zeroes===!1?l:y,O=!i.hasOwnProperty("min")||(0,r.default)(i.min)||h>=i.min,R=!i.hasOwnProperty("max")||(0,r.default)(i.max)||h<=i.max,S=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||h<i.lt,D=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||h>i.gt;return A.test(h)&&O&&R&&S&&D}n.exports=t.default,n.exports.default=t.default})(He,He.exports);var Ts=He.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var s=r(Ts);function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,s.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=t.default,n.exports.default=t.default})(Ue,Ue.exports);var Rs=Ue.exports;const Ns=Ut(Rs),Fe={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Es(){var N,E,P;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(N=t==null?void 0:t.meta)==null?void 0:N.did,y=Object.assign({...Fe},((P=(E=t==null?void 0:t.settings)==null?void 0:E.notification)==null?void 0:P.email)||{}),{handleSubmit:p,control:h,formState:i,watch:A,reset:O}=It({defaultValues:St(y,Object.keys(Fe))}),R=Te({testReceiver:"",testReceiverError:""}),S=A("enabled"),D=V(async(a,m,$=!0)=>{var U,oe;try{const{blocklet:le}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),pe=Object.assign({...Fe},((oe=(U=le==null?void 0:le.settings)==null?void 0:U.notification)==null?void 0:oe.email)||{});O(pe),$&&K.success(s("oauth.saveSuccess"))}catch(le){if($)K.error(le.message||s("oauth.saveFailed"));else throw le}}),G=V(async(a,m,$)=>{try{i.isDirty&&await D(a,m,!1),await n.sendEmail({input:{did:l,receiver:$,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),K.success(s("notification.email.testSuccess"))}catch(U){K.error(U.message||s("notification.email.testfailed"))}}),B=V((a,m)=>{R.testReceiver="",R.testReceiverError="",r.open({title:s("notification.email.testSendEmail"),content:()=>e.jsx(T,{sx:{width:"300px"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.email.inputTestReceiver"),value:R.testReceiver,onChange:$=>{R.testReceiver=$.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm($){var oe;const U=(oe=R.testReceiver)==null?void 0:oe.trim();if(!U){R.testReceiverError=s("notification.email.receiverRequired");return}if(!ke(U)){R.testReceiverError=s("notification.email.receiverInvalid");return}R.testReceiverError="",await G(a,m,U),$()}})}),z=V(a=>{const m=a==null?void 0:a.trim();return m?ke(m)?!0:s("notification.email.fromInvalid"):s("notification.email.fromRequired")}),_=V(a=>{const m=a==null?void 0:a.trim();return m?$e(m,{require_host:!1,protocols:[]})?!0:s("notification.email.hostInvalid"):s("notification.email.hostRequired")}),M=V(a=>a?Ns(a)?!0:s("notification.email.portInvalid"):s("notification.email.portRequired")),J=V(a=>a!=null&&a.trim()?!0:s("notification.email.userRequired")),ie=V(a=>a!=null&&a.trim()?!0:s("notification.email.passwordRequired")),c=V(a=>a!=null&&a.trim()&&!$e(a,{protocols:["http","https"],require_protocol:!0})?s("notification.email.linkInvalid"):!0),g=V(a=>a!=null&&a.trim()&&!ke(a)?s("notification.email.emailInvalid"):!0),j=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Is,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.email.enable"),my:2.5,children:e.jsx(X,{name:"enabled",control:h,render:({field:a})=>e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a})})})}),e.jsx(ee,{title:s("notification.email.from"),children:e.jsx(X,{name:"from",control:h,rules:{validate:S?z:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,label:s("notification.email.from"),error:!!i.errors[a.name],helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.host"),children:e.jsx(X,{name:"host",control:h,rules:{validate:S?_:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.host"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.port"),children:e.jsx(X,{name:"port",control:h,rules:{validate:S?M:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:s("notification.email.port"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.user"),children:e.jsx(X,{name:"user",control:h,rules:{validate:S?J:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.user"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.password"),children:e.jsx(X,{name:"password",control:h,rules:{validate:S?ie:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:s("notification.email.password"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.secure"),children:e.jsx(X,{name:"secure",control:h,rules:{validate:j},render:({field:a})=>e.jsx(Y,{fullWidth:!0,children:e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a,disabled:!S})})})})}),e.jsxs(us,{children:[e.jsxs(ps,{expandIcon:e.jsx(fs,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[s("notification.email.signature"),e.jsx(xt,{title:s("notification.email.signatureTooltip"),children:e.jsx(es,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(ms,{children:[e.jsx(ee,{title:s("notification.email.companyName"),children:e.jsx(X,{name:"companyName",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyName"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyLink"),children:e.jsx(X,{name:"companyLink",control:h,rules:{validate:S?c:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyLink"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyAddress"),children:e.jsx(X,{name:"companyAddress",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyAddress"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.supportEmail"),children:e.jsx(X,{name:"supportEmail",control:h,rules:{validate:S?g:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:s("notification.email.supportEmail"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})})]})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(B),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Is=ue(ht)``,ze={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function As(){var M,J,ie;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(M=t==null?void 0:t.meta)==null?void 0:M.did,y=Object.assign({...ze},((ie=(J=t==null?void 0:t.settings)==null?void 0:J.notification)==null?void 0:ie.pushKit)||{}),{handleSubmit:p,control:h,formState:i,watch:A,reset:O}=It({defaultValues:St(y,Object.keys(ze))}),R=Te({testReceiver:"",testReceiverError:""}),S=A("enabled"),D=V(async(c,g,j=!0)=>{var N,E;try{const{blocklet:P}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:c})}}),a=Object.assign({...ze},((E=(N=P==null?void 0:P.settings)==null?void 0:N.notification)==null?void 0:E.pushKit)||{});O(a),j&&K.success(s("oauth.saveSuccess"))}catch(P){if(j)K.error(P.message||s("oauth.saveFailed"));else throw P}}),G=V(async(c,g)=>{var j,N,E;try{i.isDirty&&await D(c,g,!1);const P=(j=((t==null?void 0:t.configs)||[]).find($=>$.key==="BLOCKLET_APP_URL"))==null?void 0:j.value,a=Qt(Xt(P,"/.well-known/service/blocklet/logo"),{v:(N=t==null?void 0:t.meta)==null?void 0:N.version,t:new Date((t==null?void 0:t.updatedAt)||0).getTime()}),m={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:t==null?void 0:t.appDid,fullName:(E=t==null?void 0:t.meta)==null?void 0:E.title,avatar:a}}}};await n.sendPush({input:{did:l,receiver:R.testReceiver,notification:JSON.stringify(m)}}),K.success(s("notification.pushKit.testSuccess"))}catch(P){K.error(P.message||s("notification.pushKit.testfailed"))}}),B=V((c,g)=>{R.testReceiverError="",r.open({title:s("notification.pushKit.testSend"),content:()=>e.jsx(T,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.pushKit.inputTestReceiver"),value:R.testReceiver,onChange:j=>{R.testReceiver=j.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(j){var E;if(!((E=R.testReceiver)==null?void 0:E.trim())){R.testReceiverError=s("notification.pushKit.receiverRequired");return}R.testReceiverError="",await G(c,g),j()}})}),z=V(c=>{const g=c==null?void 0:c.trim();return g?$e(g)?!0:s("notification.pushKit.endpointInvalid"):s("notification.pushKit.endpointRequired")}),_=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Os,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.pushKit.enable"),my:2.5,children:e.jsx(X,{name:"enabled",control:h,render:({field:c})=>e.jsx(ge,{control:e.jsx(We,{checked:c.value,...c})})})}),e.jsx(ee,{title:s("notification.pushKit.endpoint"),children:e.jsx(X,{name:"endpoint",control:h,rules:{validate:S?z:_},render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",required:!0,label:s("notification.pushKit.endpoint"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})}),e.jsxs(ee,{title:s("notification.pushKit.customOptions"),children:[e.jsx(X,{name:"did",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.did"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}}),e.jsx(X,{name:"pushPath",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.pushPath"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(B),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Os=ue(ht)``,ft=[{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Push Kit"}),value:"pushKit"}];function Ds(){const[n,t]=C.useState(ft[0].value),{locale:s}=C.useContext(ts),r=ce(()=>({email:e.jsx(Es,{}),pushKit:e.jsx(As,{})}),[s]),o=C.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(T,{children:[e.jsx(wt,{tabs:ft,current:n,onChange:t}),e.jsx(T,{style:o,children:r[n]})]})}const Pt=C.createContext({}),{Provider:Ls,Consumer:ai}=Pt;function Ps({children:n,blocklet:t=""}){const{api:s,inService:r,ws:{useSubscription:o}}=Ze(),[l,y]=C.useState([]),[p,h]=C.useState({total:0,pageSize:20,pageCount:0,page:1}),i=ce(()=>{var c;return(c=t.meta)==null?void 0:c.did},[t]),[A,O]=C.useState([]),[R,S]=C.useState({}),D=ce(()=>l.length?new Set(l.map(c=>c.id)):new Set,[l]),G=async({page:c=1,pageSize:g=20,...j}={})=>{if(!i)return[];try{const N={paging:{page:c,pageSize:g},...j,teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0},{dids:E,...P}=N;let a="";E&&E.includes("system")&&(a="system");const m=E?E.filter(oe=>oe!=="system"):[],$={...P,source:a,componentDids:m},U=await s.getNotificationSendLog({input:$});return S($),y(U.list),h(U.paging),U.list}catch(N){return K.error(N.message),[]}},B=async()=>{const c=await s.getNotificationComponents({input:{teamDid:i}});O(c.componentDids)},z=C.useCallback(c=>{const g=t.children.find(j=>{var N;return((N=j.meta)==null?void 0:N.did)===c});if(g)return g.ancestors=[t],g},[t]),_=async({notificationId:c,receivers:g,channels:j,...N})=>{await s.resendNotification({input:{teamDid:i,notificationId:c,receivers:g,channels:j.map(E=>E==="wallet"?W.NOTIFICATION_SEND_CHANNEL.WALLET:E==="pushKit"?W.NOTIFICATION_SEND_CHANNEL.PUSH:E),...N}})},M=C.useCallback(async c=>(await s.getUser({input:{teamDid:i,user:{did:c}}})).user,[s,i]),J=C.useCallback(async({page:c=1,pageSize:g=20,...j}={})=>{try{const N={paging:{page:c,pageSize:g},...j,userName:j.searchText||"",teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:N})}catch(N){throw K.error(N.message),N}},[s,i]);C.useEffect(()=>{i&&B()},[i]),o(W.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,c=>{D.has(c.notificationId)&&G(R)},[D,R]),o(W.EVENTS.NOTIFICATION_BLOCKLET_CREATE,c=>{D.has(c.id)||G(R)},[D,R]);const ie={fetch:G,data:l,paging:p,blocklet:t,getComponent:z,resendNotification:_,getUser:M,componentDids:A,getReceivers:J,inService:r,teamDid:i};return e.jsx(Ls,{value:{notificationRecords:ie},children:n})}function tt(){const{notificationRecords:n}=C.useContext(Pt);return n}Ne.propTypes={severity:x.oneOf(Object.values(["info","success","error","warning"])).isRequired};const _s={info:"primary",success:"success",error:"error",warning:"warning"};function Ne({severity:n="info"}){return e.jsx(ss,{type:_s[n],children:n})}var st={},ks=Je;Object.defineProperty(st,"__esModule",{value:!0});var _t=st.default=void 0,Fs=ks(Xe()),zs=e;_t=st.default=(0,Fs.default)((0,zs.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var nt={},Bs=Je;Object.defineProperty(nt,"__esModule",{value:!0});var kt=nt.default=void 0,Ws=Bs(Xe()),qs=e;kt=nt.default=(0,Ws.default)((0,qs.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var it={},Ks=Je;Object.defineProperty(it,"__esModule",{value:!0});var Ft=it.default=void 0,Ms=Ks(Xe()),$s=e;Ft=it.default=(0,Ms.default)((0,$s.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Us=(n,t,s="")=>{if(!s||!t)return"";switch(s){case W.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return s}};function zt(n,t,s={}){const{status:r,updatedAt:o,reason:l="",channel:y="wallet"}=s,p=o?n("notification.sendStatus.sentTime",{date:rs(o,t)}):"",h=Us(n,y,l);return r===W.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:p,reason:h}:r===W.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:p}:{status:"pending",title:n("notification.sendStatus.pending"),reason:h,sentTime:p}}const Ye={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ge=["wallet","pushKit","email"],mt=["info","success","error","warning"],Bt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.email)==null?void 0:r.enabled},Wt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.pushKit)==null?void 0:r.enabled},Hs=(n,t)=>{const s=fe(t,"extra.notifications.email",!0);return{available:Bt(n),enabled:s}},Vs=(n,t)=>{const s=fe(t,"extra.notifications.push",!0);return{available:Wt(n),enabled:s}},Ys=n=>({enabled:fe(n,"extra.notifications.wallet",!0)}),Gs=n=>({enabled:fe(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(t=>{setTimeout(()=>{t()},n*1e3)}),Js=(n,t)=>t==="wallet"||t==="webhook"?[{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:t==="pushKit"||t==="email"?[{channel:t,type:"available",pass:n("notification.sendStatus.reason.available",{channel:t}),fail:n("notification.sendStatus.reason.unavailable",{channel:t})},{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:[],Ie=(n=[])=>{const t=se().startOf("day");return n.filter(s=>se(s.sendAt).isSame(t,"day")).length},Qs=(n,t="")=>{if(t&&Ge.includes(t)){const l=`${t}SendRecord`,y=fe(n,l,[]);return Ie(y)}const s=fe(n,"webhook",{}),r=Object.keys(s??{})??[];if(t&&r.includes(t)){const l=s[t]??[];return Ie(l)}const o={};return Ge.forEach(l=>{const y=`${l}SendRecord`,p=fe(n,y,[]),h=Ie(p);o[l]=h}),r.length>0&&r.forEach(l=>{const y=s[l]??[],p=Ie(y);o[l]=p}),o},Oe=(n,t,s)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[s].splice(t,1),n},De=(n,t)=>{if(!Array.isArray(t))throw new Error("filters must be an array");return t.length?!t.includes(n):!1},Xs=n=>{switch(n){case W.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case W.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case W.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case W.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},qt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function de({config:n,enableTooltip:t=!0,showTitle:s=!1,children:r}){const{status:o,title:l="",sentTime:y="",reason:p=""}=n,h=[l,p].filter(Boolean).join(", ");return e.jsx(xt,{title:t?e.jsxs(e.Fragment,{children:[e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:h}),e.jsx("span",{children:y})]}):null,arrow:!0,placement:"top",children:e.jsxs(T,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(T,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(T,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Ye[o],style:{opacity:.15}}),e.jsx(T,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Ye[o]})]}),e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:s?l:r})]})})}de.propTypes={config:x.object.isRequired,enableTooltip:x.bool,showTitle:x.bool,children:x.node};de.defaultProps={enableTooltip:!0,showTitle:!1,children:null};Se.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};Se.defaultProps={onDelete:()=>{}};function Se({list:n,label:t,onDelete:s}){const{t:r,locale:o}=re();return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(l=>{const y=zt(r,o,{status:l});return e.jsx(Qe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(de,{config:y,enableTooltip:!1,children:y.title})}),onDelete:p=>s(p,l)},l)})]})}at.propTypes={filterList:x.array.isRequired,onChange:x.func.isRequired,index:x.number.isRequired,column:x.object.isRequired,filterValues:x.array.isRequired,label:x.string.isRequired,renderLabel:x.func.isRequired};function at({filterList:n,onChange:t,index:s,column:r,filterValues:o,label:l,renderLabel:y}){return e.jsxs(Y,{className:"filter-container",children:[e.jsx(gt,{component:"legend",children:l}),e.jsx(qe,{row:!0,children:o.map(p=>e.jsx(ge,{control:e.jsx(Ke,{checked:n[s].indexOf(p.value??p)>-1,onChange:h=>{const i=[...n];h.target.checked?i[s]=[...i[s],p.value??p]:i[s]=i[s].filter(A=>A!==(p.value??p)),t(i[s],s,r)},name:p.value??p}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:y(p)})},p.value??p))})]})}function Be(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(de,{enableTooltip:!1,config:{status:t.status},children:t.label})})}ve.propTypes={status:x.number.isRequired,updatedAt:x.string.isRequired,reason:x.string,channel:x.string,onResend:x.func};function ve({status:n,updatedAt:t,reason:s="",channel:r="wallet",onResend:o}){const{t:l,locale:y}=re(),p=zt(l,y,{status:n,updatedAt:t,reason:s,channel:r});return e.jsxs(T,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(de,{config:p,showTitle:!0}),p.status!=="success"&&e.jsx(Le,{className:"resend-btn",size:"small",startIcon:e.jsx(et,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}rt.propTypes={value:x.array.isRequired,onChange:x.func};function rt({value:n,onChange:t}){const{locale:s}=re(),r=se().toDate(),[o,l]=C.useState(null),y=C.useCallback(i=>{l(o?null:i.currentTarget)},[o]),p=!!o,h=C.useCallback(i=>{if(!i.startDate||!i.endDate){K.error("Please select a date range");return}if(se(i.startDate).isAfter(i.endDate)||!se(i.startDate).isValid()||!se(i.endDate).isValid()){K.error("Invalid date range");return}t([i.startDate,i.endDate]),l(null)},[t]);return e.jsxs("div",{children:[e.jsx(ae,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Le,{onClick:y,variant:"outlined",size:"small",color:"inherit",children:[pt(n[0],s)," - ",pt(n[1],s)]})}),e.jsx(Me,{open:p,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(ys,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:y,definedRanges:Ss(r),onChange:h})})]})}ot.propTypes={itemComponent:x.elementType.isRequired};function ot({itemComponent:n,...t}){var o;const{t:s}=re();return!((o=t==null?void 0:t.filterList)!=null&&o.filter(l=>l.length).length)?null:e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(ns.TableFilterList,{...t,ItemComponent:n})})]})}function Pe({label:n,onDelete:t,canDelete:s=()=>!0,...r}){const o=t&&typeof t=="function"?t:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:n,...r})),e.jsx(Qe,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}Pe.propTypes={label:x.string.isRequired,onDelete:x.func,canDelete:x.func};Pe.defaultProps={canDelete:()=>!0};const Zs=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];lt.propTypes={loading:x.bool,onCancel:x.func,onConfirm:x.func};lt.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function lt({loading:n=!1,onCancel:t,onConfirm:s}){const{t:r}=re(),[o,l]=C.useState(Zs),[y,p]=C.useState(!0),h=(A,O)=>{O.checked=A.target.checked;const R=o.map(S=>({...S,checked:S.value===O.value?O.checked:S.checked}));l(R)},i=A=>{A.stopPropagation(),s({channels:o.filter(O=>O.checked).map(O=>O.value),isResendFailedOnly:y})};return e.jsxs(T,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ae,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(T,{className:"choose-channel",children:e.jsxs(Y,{component:"fieldset",variant:"standard",children:[e.jsx(gt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(A=>e.jsx(ge,{control:e.jsx(Ke,{checked:A.checked,onChange:O=>h(O,A),name:A.value}),label:A.label},A.value))})]})}),e.jsx(T,{className:"resend-config-footer",children:e.jsx(qe,{children:e.jsx(ge,{control:e.jsx(Ke,{checked:y,onChange:A=>p(A.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(T,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Le,{onClick:A=>{A.stopPropagation(),t()},color:"inherit",children:r("common.cancel")}),e.jsxs(Le,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(bt,{size:16}),r("common.confirm")]})]})]})}Kt.propTypes={notificationId:x.string.isRequired,handleResend:x.func,resending:x.bool};function Kt({notificationId:n,handleResend:t,resending:s=!1}){const{t:r,locale:o}=re(),l=jt(),y=C.useMemo(()=>vt(l,qt()),[l]),{getReceivers:p,inService:h,teamDid:i,getUser:A,blocklet:O}=tt(),[R,S]=C.useState(!1),[D,G]=C.useState([]),B=Te({anchorEl:null,position:null}),z=Te({anchorEl:null,position:null}),[_,M]=C.useState(null),[J,ie]=C.useState({total:0,pageSize:10,pageCount:0,page:1}),[c,g]=C.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[se().subtract(1,"month").startOf("day").toDate(),se().endOf("day").toDate()]}),[j,N]=C.useState([]),E=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],P=async()=>{if(!R&&n)try{S(!0);const d=await p({notificationId:n,...c}),u=d.list.map(f=>({...f,receiverUser:{...f.receiverUser,avatar:Dt(f.receiverUser.avatar,i,h)}}));G(u),ie(d.paging),S(!1)}catch(d){K.error(d.message),S(!1)}};C.useEffect(()=>{P()},[c]);const a=d=>{d.stopPropagation();const u=d.currentTarget;z.anchorEl=u;const f=u.getBoundingClientRect();z.position={top:f.top+window.scrollY,left:f.left+window.scrollX}},m=d=>d.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(me,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(et,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:r("notification.resend")})}):null,$={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:J.page-1,rowsPerPage:J.pageSize,count:J.total,searchText:c.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:j,onRowSelectionChange:(d,u)=>{N(u.map(f=>f.dataIndex))},customToolbarSelect:m},U=({page:d,rowsPerPage:u,searchText:f,filterList:L})=>{const[,q=[],Z=[],Q=[]]=L;c.pageSize!==u?g(H=>({...H,pageSize:u,page:1})):c.page!==d+1?g(H=>({...H,page:d+1})):c.searchText!==f?g(H=>({...H,searchText:f,page:1})):ye(q,c.walletSendStatus)?ye(Z,c.pushKitSendStatus)?ye(Q,c.emailSendStatus)||g(H=>({...H,emailSendStatus:Q,page:1})):g(H=>({...H,pushKitSendStatus:Z,page:1})):g(H=>({...H,walletSendStatus:q,page:1}))},oe=C.useCallback(async(d,u)=>{if(!u)return!1;const f=await A(u);return f?d==="wallet"?Ys(f):d==="email"?Hs(O,f):d==="pushKit"?Vs(O,f):d==="webhook"?Gs(f):!0:!1},[A,O]),le=C.useCallback(d=>Js(r,d),[r]),pe=()=>{B.anchorEl=null,B.position=null,M(null)},be=()=>{z.anchorEl=null,z.position=null},je=async(d,u,f=!0,L="")=>{if(!(!u.length||!d.length))try{t(d,u,f,L),z.anchorEl||(await Ee(.5),pe())}catch(q){console.error("handleResend error",{error:q})}},v=async({channels:d,isResendFailedOnly:u})=>{const f=j.map(L=>D[L].receiver);await je(d,f,u),await Ee(.5),be(),N([])},b=async(d,u=[],f=!0)=>{try{await je(["webhook"],[d.receiver],f,u)}catch(L){K.error(L.response?L.response.statusText:L.message)}},w=async(d,u,f,L=[],q=!0)=>{if(d.stopPropagation(),Qs(u,f)>=4){K.warning(r("notification.resendLimit"));return}if(!Ge.includes(f)){await b(u,L,q);return}if(d){const Q=d.currentTarget,H=Q.getBoundingClientRect();B.anchorEl=Q,B.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}M({channel:f});try{const Q=await oe(f,u.receiver);await Ee(1),M({channel:f,result:Q}),(typeof Q=="boolean"&&Q||Zt(Q)&&Object.values(Q).every(H=>!!H))&&(await t([f],[u.receiver],q),z.anchorEl||(await Ee(.5),pe()))}catch(Q){K.error(Q.message)}},I=d=>{g(u=>({...u,dateRange:d,page:1}))},k=(d,u,f,L)=>{d.stopPropagation();const q=f.filter(Z=>Z!==u);g(Z=>({...Z,[L]:q,page:1}))},F=ce(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:d=>{const{receiverUser:u,receiver:f}=D[d];return u?e.jsxs(T,{"data-cy":`member-name-${u.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(Tt,{src:`${u.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:f,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Re,{children:u.fullName})]},f):e.jsx(vs,{size:14,responsive:!1,compact:!0,copyable:!1,did:f})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:c.walletSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Wallet",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[1].options.filterList,"walletSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Wallet",filterList:d,onChange:u,index:f,column:L,filterValues:E})},customBodyRenderLite:d=>{const{walletSendStatus:u,walletSendAt:f,walletSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"wallet",onResend:q=>w(q,D[d],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{pushKitSendStatus:u,pushKitSendAt:f,pushKitSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"pushkit",onResend:q=>w(q,D[d],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:c.pushKitSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Push Kit",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[2].options.filterList,"pushKitSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Push Kit",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{emailSendStatus:u,emailSendAt:f,emailSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"email",onResend:q=>w(q,D[d],"email",[],!1)})},filter:!0,filterType:"custom",filterList:c.emailSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Email",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[3].options.filterList,"emailSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Email",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{webhook:u}=D[d];if(!u)return null;const f=Object.entries(u)[0];if(!f)return null;const[L,q]=f,Z=q[0];return e.jsx(T,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(T,{className:"webhook-item",fontSize:12,children:[e.jsx(Re,{maxLength:30,children:L},L),e.jsx(ve,{status:Z.status,updatedAt:Z.sendAt,reason:Z.failedReason,channel:"webhook",onResend:Q=>w(Q,D[d],"webhook",[L],!1)})]},L)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:d=>{const{createdAt:u}=D[d];return e.jsx(Ot,{value:u,locale:o,shouldUpdate:!0})}}}],[D,o,c,r]),ne=[e.jsx(rt,{value:c.dateRange,onChange:I},"date-picker"),e.jsx(me,{variant:"contained",size:"small",color:"primary",loading:R,startIcon:e.jsx(Ft,{}),onClick:()=>P(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(T,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(tn,{children:e.jsxs(yt,{theme:y,children:[e.jsx(Rt,{className:"receivers-table",locale:o,loading:R,columns:F,data:D,onChange:U,options:$,customButtons:ne,components:{TableFilterList:d=>e.jsx(ot,{...d,itemComponent:u=>e.jsx(Pe,{...u,canDelete:()=>!1})})}}),B.anchorEl&&e.jsx(Me,{open:!!B.anchorEl,anchorReference:"anchorPosition",anchorPosition:B.position,onClose:pe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(sn,{children:[e.jsxs(ae,{variant:"body1",component:"div",className:"check-title",children:[_==null?void 0:_.channel," Checking"]}),e.jsx(T,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:le(_==null?void 0:_.channel).map(d=>{var q,Z;const{type:u,pass:f,fail:L}=d;return!(_!=null&&_.result)||(q=_==null?void 0:_.result)!=null&&q[u]?e.jsxs(ae,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(Z=_==null?void 0:_.result)!=null&&Z[u]?Ae.success.main:"inherit"},children:[_!=null&&_.result?e.jsx(_t,{}):e.jsx(bt,{size:12,sx:{color:Ae.primary.main}}),e.jsx("span",{children:f})]},u):e.jsxs(ae,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:Ae.error.main},children:[e.jsx(kt,{}),e.jsx("span",{children:L})]},u)})})]})}),z.anchorEl&&e.jsx(Me,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:be,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(lt,{loading:s,onCancel:be,onConfirm:v})})]})})})}const en=C.memo(Kt),tn=ue.div`
1
+ import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,j as e,aa as T,O as te,bs as ge,bt as We,bo as Y,ad as xt,H as x,a9 as Je,T as ae,E as Qe,bz as gt,bQ as qe,bR as Ke,y as Le,b3 as Me,ab as bt,bI as jt,Y as vt,cp as yt,m as Ht,bb as dt,br as Vt,bn as Yt,q as ut,bY as Gt,I as Jt}from"./vendor-mui-core-Bh-qMRq3.js";import{J as St,z as Qt,A as Xt,e as fe,aB as ye,C as Zt}from"./vendor-utils-rHXShPKm.js";import{a as re,a4 as Ct,Y as K,bP as es,B as me,b1 as ts,aq as wt,j as W,b6 as ss,r as Xe,bQ as ns,X as Tt,a5 as Rt,bm as Ae,ak as Nt,V as is,bt as as}from"./vendor-ux-did-connect-D0L9YnHn.js";import{A as Ze,D as Et,ay as It,az as X,v as se,l as rs,H as pt}from"./index-YuW8IExe.js";import{a as Te,u as V,f as ce}from"./vendor-hooks-DpwFseeF.js";import{a as et,b as os}from"./dashboard-B_QqB4aw.js";import{l as ls,v as ke}from"./vendor-arcblock-Ca95GLVH.js";import{f as $e,i as cs,d as ds}from"./use-blocklet-logo-3VH4RBTr.js";import{A as us,a as ps,d as fs,b as ms}from"./collapse-iOiHn4dy.js";import{S as ee}from"./section-C1TPQFRq.js";import{S as Re}from"./shorten-label-Bf7YQUd6.js";import{I as At}from"./index-Bv8sds6g.js";import{R as Ot,A as hs,S as xs,a as gs,b as bs,B as js}from"./list-C_1TcitB.js";import{W as vs}from"./did-address-mv0Qw7hC.js";import{p as Dt}from"./util-CiTimo-i.js";import{D as ys,g as Ss}from"./traffic-Cd92p-Xb.js";import{B as Lt}from"./bundle-avatar-D7QQIJpo.js";import{u as Cs}from"./use-mobile-ZAS6Si4t.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-DotMjDUB.js";import"./index-8eXqqyHQ.js";import"./confirm-DaR0Yx39.js";import"./PlayArrow-BHO_DqT2.js";import"./get-safe-url-DYtntqqo.js";import"./session-DUt5rVEy.js";import"./InfoOutlined-uoMMChNE.js";import"./dot-D3X4DSlo.js";import"./useAsync-CDjYBiwf.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-JEGQfLZ2.js";import"./index-C849wD9b.js";import"./CheckCircle-XrJDG94y.js";import"./index-c0hdujdn.js";import"./Phone--BSu-btI.js";import"./Location-By12Z3Te.js";import"./Email-CdSNK0eA.js";import"./Timezone-YZ0dMUEr.js";import"./base32-BnPQ4q4v.js";import"./iframe-BlPuY8Pu.js";import"./LaunchOutlined-0gUfY-5D.js";import"./ChevronLeft-BlDLI-Qo.js";import"./ChevronRight-DkPaON7R.js";import"./index-CmQOzzP8.js";import"./vendor-mui-x-CQTjfcpn.js";import"./AdapterDayjs-Bck9Dv3l.js";var Ue={exports:{}},He={exports:{}},Ve={exports:{}};(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;function s(r){return r==null}n.exports=t.default,n.exports.default=t.default})(Ve,Ve.exports);var ws=Ve.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var s=o(ls),r=o(ws);function o(h){return h&&h.__esModule?h:{default:h}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,y=/^[-+]?[0-9]+$/;function p(h,i){(0,s.default)(h),i=i||{};var A=i.allow_leading_zeroes===!1?l:y,O=!i.hasOwnProperty("min")||(0,r.default)(i.min)||h>=i.min,R=!i.hasOwnProperty("max")||(0,r.default)(i.max)||h<=i.max,S=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||h<i.lt,D=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||h>i.gt;return A.test(h)&&O&&R&&S&&D}n.exports=t.default,n.exports.default=t.default})(He,He.exports);var Ts=He.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var s=r(Ts);function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,s.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=t.default,n.exports.default=t.default})(Ue,Ue.exports);var Rs=Ue.exports;const Ns=Ut(Rs),Fe={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Es(){var N,E,P;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(N=t==null?void 0:t.meta)==null?void 0:N.did,y=Object.assign({...Fe},((P=(E=t==null?void 0:t.settings)==null?void 0:E.notification)==null?void 0:P.email)||{}),{handleSubmit:p,control:h,formState:i,watch:A,reset:O}=It({defaultValues:St(y,Object.keys(Fe))}),R=Te({testReceiver:"",testReceiverError:""}),S=A("enabled"),D=V(async(a,m,$=!0)=>{var U,oe;try{const{blocklet:le}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),pe=Object.assign({...Fe},((oe=(U=le==null?void 0:le.settings)==null?void 0:U.notification)==null?void 0:oe.email)||{});O(pe),$&&K.success(s("oauth.saveSuccess"))}catch(le){if($)K.error(le.message||s("oauth.saveFailed"));else throw le}}),G=V(async(a,m,$)=>{try{i.isDirty&&await D(a,m,!1),await n.sendEmail({input:{did:l,receiver:$,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),K.success(s("notification.email.testSuccess"))}catch(U){K.error(U.message||s("notification.email.testfailed"))}}),B=V((a,m)=>{R.testReceiver="",R.testReceiverError="",r.open({title:s("notification.email.testSendEmail"),content:()=>e.jsx(T,{sx:{width:"300px"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.email.inputTestReceiver"),value:R.testReceiver,onChange:$=>{R.testReceiver=$.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm($){var oe;const U=(oe=R.testReceiver)==null?void 0:oe.trim();if(!U){R.testReceiverError=s("notification.email.receiverRequired");return}if(!ke(U)){R.testReceiverError=s("notification.email.receiverInvalid");return}R.testReceiverError="",await G(a,m,U),$()}})}),z=V(a=>{const m=a==null?void 0:a.trim();return m?ke(m)?!0:s("notification.email.fromInvalid"):s("notification.email.fromRequired")}),_=V(a=>{const m=a==null?void 0:a.trim();return m?$e(m,{require_host:!1,protocols:[]})?!0:s("notification.email.hostInvalid"):s("notification.email.hostRequired")}),M=V(a=>a?Ns(a)?!0:s("notification.email.portInvalid"):s("notification.email.portRequired")),J=V(a=>a!=null&&a.trim()?!0:s("notification.email.userRequired")),ie=V(a=>a!=null&&a.trim()?!0:s("notification.email.passwordRequired")),c=V(a=>a!=null&&a.trim()&&!$e(a,{protocols:["http","https"],require_protocol:!0})?s("notification.email.linkInvalid"):!0),g=V(a=>a!=null&&a.trim()&&!ke(a)?s("notification.email.emailInvalid"):!0),j=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Is,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.email.enable"),my:2.5,children:e.jsx(X,{name:"enabled",control:h,render:({field:a})=>e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a})})})}),e.jsx(ee,{title:s("notification.email.from"),children:e.jsx(X,{name:"from",control:h,rules:{validate:S?z:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,label:s("notification.email.from"),error:!!i.errors[a.name],helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.host"),children:e.jsx(X,{name:"host",control:h,rules:{validate:S?_:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.host"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.port"),children:e.jsx(X,{name:"port",control:h,rules:{validate:S?M:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:s("notification.email.port"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.user"),children:e.jsx(X,{name:"user",control:h,rules:{validate:S?J:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.user"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.password"),children:e.jsx(X,{name:"password",control:h,rules:{validate:S?ie:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:s("notification.email.password"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.secure"),children:e.jsx(X,{name:"secure",control:h,rules:{validate:j},render:({field:a})=>e.jsx(Y,{fullWidth:!0,children:e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a,disabled:!S})})})})}),e.jsxs(us,{children:[e.jsxs(ps,{expandIcon:e.jsx(fs,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[s("notification.email.signature"),e.jsx(xt,{title:s("notification.email.signatureTooltip"),children:e.jsx(es,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(ms,{children:[e.jsx(ee,{title:s("notification.email.companyName"),children:e.jsx(X,{name:"companyName",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyName"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyLink"),children:e.jsx(X,{name:"companyLink",control:h,rules:{validate:S?c:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyLink"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyAddress"),children:e.jsx(X,{name:"companyAddress",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyAddress"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.supportEmail"),children:e.jsx(X,{name:"supportEmail",control:h,rules:{validate:S?g:j},render:({field:a})=>{var m;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:s("notification.email.supportEmail"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})})]})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(B),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Is=ue(ht)``,ze={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function As(){var M,J,ie;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(M=t==null?void 0:t.meta)==null?void 0:M.did,y=Object.assign({...ze},((ie=(J=t==null?void 0:t.settings)==null?void 0:J.notification)==null?void 0:ie.pushKit)||{}),{handleSubmit:p,control:h,formState:i,watch:A,reset:O}=It({defaultValues:St(y,Object.keys(ze))}),R=Te({testReceiver:"",testReceiverError:""}),S=A("enabled"),D=V(async(c,g,j=!0)=>{var N,E;try{const{blocklet:P}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:c})}}),a=Object.assign({...ze},((E=(N=P==null?void 0:P.settings)==null?void 0:N.notification)==null?void 0:E.pushKit)||{});O(a),j&&K.success(s("oauth.saveSuccess"))}catch(P){if(j)K.error(P.message||s("oauth.saveFailed"));else throw P}}),G=V(async(c,g)=>{var j,N,E;try{i.isDirty&&await D(c,g,!1);const P=(j=((t==null?void 0:t.configs)||[]).find($=>$.key==="BLOCKLET_APP_URL"))==null?void 0:j.value,a=Qt(Xt(P,"/.well-known/service/blocklet/logo"),{v:(N=t==null?void 0:t.meta)==null?void 0:N.version,t:new Date((t==null?void 0:t.updatedAt)||0).getTime()}),m={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:t==null?void 0:t.appDid,fullName:(E=t==null?void 0:t.meta)==null?void 0:E.title,avatar:a}}}};await n.sendPush({input:{did:l,receiver:R.testReceiver,notification:JSON.stringify(m)}}),K.success(s("notification.pushKit.testSuccess"))}catch(P){K.error(P.message||s("notification.pushKit.testfailed"))}}),B=V((c,g)=>{R.testReceiverError="",r.open({title:s("notification.pushKit.testSend"),content:()=>e.jsx(T,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.pushKit.inputTestReceiver"),value:R.testReceiver,onChange:j=>{R.testReceiver=j.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(j){var E;if(!((E=R.testReceiver)==null?void 0:E.trim())){R.testReceiverError=s("notification.pushKit.receiverRequired");return}R.testReceiverError="",await G(c,g),j()}})}),z=V(c=>{const g=c==null?void 0:c.trim();return g?$e(g)?!0:s("notification.pushKit.endpointInvalid"):s("notification.pushKit.endpointRequired")}),_=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Os,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.pushKit.enable"),my:2.5,children:e.jsx(X,{name:"enabled",control:h,render:({field:c})=>e.jsx(ge,{control:e.jsx(We,{checked:c.value,...c})})})}),e.jsx(ee,{title:s("notification.pushKit.endpoint"),children:e.jsx(X,{name:"endpoint",control:h,rules:{validate:S?z:_},render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",required:!0,label:s("notification.pushKit.endpoint"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})}),e.jsxs(ee,{title:s("notification.pushKit.customOptions"),children:[e.jsx(X,{name:"did",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.did"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}}),e.jsx(X,{name:"pushPath",control:h,render:({field:c})=>{var g;return e.jsx(Y,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.pushPath"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(B),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Os=ue(ht)``,ft=[{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Push Kit"}),value:"pushKit"}];function Ds(){const[n,t]=C.useState(ft[0].value),{locale:s}=C.useContext(ts),r=ce(()=>({email:e.jsx(Es,{}),pushKit:e.jsx(As,{})}),[s]),o=C.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(T,{children:[e.jsx(wt,{tabs:ft,current:n,onChange:t}),e.jsx(T,{style:o,children:r[n]})]})}const Pt=C.createContext({}),{Provider:Ls,Consumer:ai}=Pt;function Ps({children:n,blocklet:t=""}){const{api:s,inService:r,ws:{useSubscription:o}}=Ze(),[l,y]=C.useState([]),[p,h]=C.useState({total:0,pageSize:20,pageCount:0,page:1}),i=ce(()=>{var c;return(c=t.meta)==null?void 0:c.did},[t]),[A,O]=C.useState([]),[R,S]=C.useState({}),D=ce(()=>l.length?new Set(l.map(c=>c.id)):new Set,[l]),G=async({page:c=1,pageSize:g=20,...j}={})=>{if(!i)return[];try{const N={paging:{page:c,pageSize:g},...j,teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0},{dids:E,...P}=N;let a="";E&&E.includes("system")&&(a="system");const m=E?E.filter(oe=>oe!=="system"):[],$={...P,source:a,componentDids:m},U=await s.getNotificationSendLog({input:$});return S($),y(U.list),h(U.paging),U.list}catch(N){return K.error(N.message),[]}},B=async()=>{const c=await s.getNotificationComponents({input:{teamDid:i}});O(c.componentDids)},z=C.useCallback(c=>{const g=t.children.find(j=>{var N;return((N=j.meta)==null?void 0:N.did)===c});if(g)return g.ancestors=[t],g},[t]),_=async({notificationId:c,receivers:g,channels:j,...N})=>{await s.resendNotification({input:{teamDid:i,notificationId:c,receivers:g,channels:j.map(E=>E==="wallet"?W.NOTIFICATION_SEND_CHANNEL.WALLET:E==="pushKit"?W.NOTIFICATION_SEND_CHANNEL.PUSH:E),...N}})},M=C.useCallback(async c=>(await s.getUser({input:{teamDid:i,user:{did:c}}})).user,[s,i]),J=C.useCallback(async({page:c=1,pageSize:g=20,...j}={})=>{try{const N={paging:{page:c,pageSize:g},...j,userName:j.searchText||"",teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:N})}catch(N){throw K.error(N.message),N}},[s,i]);C.useEffect(()=>{i&&B()},[i]),o(W.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,c=>{D.has(c.notificationId)&&G(R)},[D,R]),o(W.EVENTS.NOTIFICATION_BLOCKLET_CREATE,c=>{D.has(c.id)||G(R)},[D,R]);const ie={fetch:G,data:l,paging:p,blocklet:t,getComponent:z,resendNotification:_,getUser:M,componentDids:A,getReceivers:J,inService:r,teamDid:i};return e.jsx(Ls,{value:{notificationRecords:ie},children:n})}function tt(){const{notificationRecords:n}=C.useContext(Pt);return n}Ne.propTypes={severity:x.oneOf(Object.values(["info","success","error","warning"])).isRequired};const _s={info:"primary",success:"success",error:"error",warning:"warning"};function Ne({severity:n="info"}){return e.jsx(ss,{type:_s[n],children:n})}var st={},ks=Je;Object.defineProperty(st,"__esModule",{value:!0});var _t=st.default=void 0,Fs=ks(Xe()),zs=e;_t=st.default=(0,Fs.default)((0,zs.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var nt={},Bs=Je;Object.defineProperty(nt,"__esModule",{value:!0});var kt=nt.default=void 0,Ws=Bs(Xe()),qs=e;kt=nt.default=(0,Ws.default)((0,qs.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var it={},Ks=Je;Object.defineProperty(it,"__esModule",{value:!0});var Ft=it.default=void 0,Ms=Ks(Xe()),$s=e;Ft=it.default=(0,Ms.default)((0,$s.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Us=(n,t,s="")=>{if(!s||!t)return"";switch(s){case W.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return s}};function zt(n,t,s={}){const{status:r,updatedAt:o,reason:l="",channel:y="wallet"}=s,p=o?n("notification.sendStatus.sentTime",{date:rs(o,t)}):"",h=Us(n,y,l);return r===W.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:p,reason:h}:r===W.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:p}:{status:"pending",title:n("notification.sendStatus.pending"),reason:h,sentTime:p}}const Ye={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ge=["wallet","pushKit","email"],mt=["info","success","error","warning"],Bt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.email)==null?void 0:r.enabled},Wt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.pushKit)==null?void 0:r.enabled},Hs=(n,t)=>{const s=fe(t,"extra.notifications.email",!0);return{available:Bt(n),enabled:s}},Vs=(n,t)=>{const s=fe(t,"extra.notifications.push",!0);return{available:Wt(n),enabled:s}},Ys=n=>({enabled:fe(n,"extra.notifications.wallet",!0)}),Gs=n=>({enabled:fe(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(t=>{setTimeout(()=>{t()},n*1e3)}),Js=(n,t)=>t==="wallet"||t==="webhook"?[{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:t==="pushKit"||t==="email"?[{channel:t,type:"available",pass:n("notification.sendStatus.reason.available",{channel:t}),fail:n("notification.sendStatus.reason.unavailable",{channel:t})},{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:[],Ie=(n=[])=>{const t=se().startOf("day");return n.filter(s=>se(s.sendAt).isSame(t,"day")).length},Qs=(n,t="")=>{if(t&&Ge.includes(t)){const l=`${t}SendRecord`,y=fe(n,l,[]);return Ie(y)}const s=fe(n,"webhook",{}),r=Object.keys(s??{})??[];if(t&&r.includes(t)){const l=s[t]??[];return Ie(l)}const o={};return Ge.forEach(l=>{const y=`${l}SendRecord`,p=fe(n,y,[]),h=Ie(p);o[l]=h}),r.length>0&&r.forEach(l=>{const y=s[l]??[],p=Ie(y);o[l]=p}),o},Oe=(n,t,s)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[s].splice(t,1),n},De=(n,t)=>{if(!Array.isArray(t))throw new Error("filters must be an array");return t.length?!t.includes(n):!1},Xs=n=>{switch(n){case W.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case W.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case W.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case W.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},qt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function de({config:n,enableTooltip:t=!0,showTitle:s=!1,children:r}){const{status:o,title:l="",sentTime:y="",reason:p=""}=n,h=[l,p].filter(Boolean).join(", ");return e.jsx(xt,{title:t?e.jsxs(e.Fragment,{children:[e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:h}),e.jsx("span",{children:y})]}):null,arrow:!0,placement:"top",children:e.jsxs(T,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(T,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(T,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Ye[o],style:{opacity:.15}}),e.jsx(T,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Ye[o]})]}),e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:s?l:r})]})})}de.propTypes={config:x.object.isRequired,enableTooltip:x.bool,showTitle:x.bool,children:x.node};de.defaultProps={enableTooltip:!0,showTitle:!1,children:null};Se.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};Se.defaultProps={onDelete:()=>{}};function Se({list:n,label:t,onDelete:s}){const{t:r,locale:o}=re();return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(l=>{const y=zt(r,o,{status:l});return e.jsx(Qe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(de,{config:y,enableTooltip:!1,children:y.title})}),onDelete:p=>s(p,l)},l)})]})}at.propTypes={filterList:x.array.isRequired,onChange:x.func.isRequired,index:x.number.isRequired,column:x.object.isRequired,filterValues:x.array.isRequired,label:x.string.isRequired,renderLabel:x.func.isRequired};function at({filterList:n,onChange:t,index:s,column:r,filterValues:o,label:l,renderLabel:y}){return e.jsxs(Y,{className:"filter-container",children:[e.jsx(gt,{component:"legend",children:l}),e.jsx(qe,{row:!0,children:o.map(p=>e.jsx(ge,{control:e.jsx(Ke,{checked:n[s].indexOf(p.value??p)>-1,onChange:h=>{const i=[...n];h.target.checked?i[s]=[...i[s],p.value??p]:i[s]=i[s].filter(A=>A!==(p.value??p)),t(i[s],s,r)},name:p.value??p}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:y(p)})},p.value??p))})]})}function Be(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(de,{enableTooltip:!1,config:{status:t.status},children:t.label})})}ve.propTypes={status:x.number.isRequired,updatedAt:x.string.isRequired,reason:x.string,channel:x.string,onResend:x.func};function ve({status:n,updatedAt:t,reason:s="",channel:r="wallet",onResend:o}){const{t:l,locale:y}=re(),p=zt(l,y,{status:n,updatedAt:t,reason:s,channel:r});return e.jsxs(T,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(de,{config:p,showTitle:!0}),p.status!=="success"&&e.jsx(Le,{className:"resend-btn",size:"small",startIcon:e.jsx(et,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}rt.propTypes={value:x.array.isRequired,onChange:x.func};function rt({value:n,onChange:t}){const{locale:s}=re(),r=se().toDate(),[o,l]=C.useState(null),y=C.useCallback(i=>{l(o?null:i.currentTarget)},[o]),p=!!o,h=C.useCallback(i=>{if(!i.startDate||!i.endDate){K.error("Please select a date range");return}if(se(i.startDate).isAfter(i.endDate)||!se(i.startDate).isValid()||!se(i.endDate).isValid()){K.error("Invalid date range");return}t([i.startDate,i.endDate]),l(null)},[t]);return e.jsxs("div",{children:[e.jsx(ae,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Le,{onClick:y,variant:"outlined",size:"small",color:"inherit",children:[pt(n[0],s)," - ",pt(n[1],s)]})}),e.jsx(Me,{open:p,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(ys,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:y,definedRanges:Ss(r),onChange:h})})]})}ot.propTypes={itemComponent:x.elementType.isRequired};function ot({itemComponent:n,...t}){var o;const{t:s}=re();return!((o=t==null?void 0:t.filterList)!=null&&o.filter(l=>l.length).length)?null:e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(ns.TableFilterList,{...t,ItemComponent:n})})]})}function Pe({label:n,onDelete:t,canDelete:s=()=>!0,...r}){const o=t&&typeof t=="function"?t:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:n,...r})),e.jsx(Qe,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}Pe.propTypes={label:x.string.isRequired,onDelete:x.func,canDelete:x.func};Pe.defaultProps={canDelete:()=>!0};const Zs=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];lt.propTypes={loading:x.bool,onCancel:x.func,onConfirm:x.func};lt.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function lt({loading:n=!1,onCancel:t,onConfirm:s}){const{t:r}=re(),[o,l]=C.useState(Zs),[y,p]=C.useState(!0),h=(A,O)=>{O.checked=A.target.checked;const R=o.map(S=>({...S,checked:S.value===O.value?O.checked:S.checked}));l(R)},i=A=>{A.stopPropagation(),s({channels:o.filter(O=>O.checked).map(O=>O.value),isResendFailedOnly:y})};return e.jsxs(T,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ae,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(T,{className:"choose-channel",children:e.jsxs(Y,{component:"fieldset",variant:"standard",children:[e.jsx(gt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(A=>e.jsx(ge,{control:e.jsx(Ke,{checked:A.checked,onChange:O=>h(O,A),name:A.value}),label:A.label},A.value))})]})}),e.jsx(T,{className:"resend-config-footer",children:e.jsx(qe,{children:e.jsx(ge,{control:e.jsx(Ke,{checked:y,onChange:A=>p(A.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(T,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Le,{onClick:A=>{A.stopPropagation(),t()},color:"inherit",children:r("common.cancel")}),e.jsxs(Le,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(bt,{size:16}),r("common.confirm")]})]})]})}Kt.propTypes={notificationId:x.string.isRequired,handleResend:x.func,resending:x.bool};function Kt({notificationId:n,handleResend:t,resending:s=!1}){const{t:r,locale:o}=re(),l=jt(),y=C.useMemo(()=>vt(l,qt()),[l]),{getReceivers:p,inService:h,teamDid:i,getUser:A,blocklet:O}=tt(),[R,S]=C.useState(!1),[D,G]=C.useState([]),B=Te({anchorEl:null,position:null}),z=Te({anchorEl:null,position:null}),[_,M]=C.useState(null),[J,ie]=C.useState({total:0,pageSize:10,pageCount:0,page:1}),[c,g]=C.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[se().subtract(1,"month").startOf("day").toDate(),se().endOf("day").toDate()]}),[j,N]=C.useState([]),E=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],P=async()=>{if(!R&&n)try{S(!0);const d=await p({notificationId:n,...c}),u=d.list.map(f=>({...f,receiverUser:{...f.receiverUser,avatar:Dt(f.receiverUser.avatar,i,h)}}));G(u),ie(d.paging),S(!1)}catch(d){K.error(d.message),S(!1)}};C.useEffect(()=>{P()},[c]);const a=d=>{d.stopPropagation();const u=d.currentTarget;z.anchorEl=u;const f=u.getBoundingClientRect();z.position={top:f.top+window.scrollY,left:f.left+window.scrollX}},m=d=>d.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(me,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(et,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:r("notification.resend")})}):null,$={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:J.page-1,rowsPerPage:J.pageSize,count:J.total,searchText:c.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:j,onRowSelectionChange:(d,u)=>{N(u.map(f=>f.dataIndex))},customToolbarSelect:m},U=({page:d,rowsPerPage:u,searchText:f,filterList:L})=>{const[,q=[],Z=[],Q=[]]=L;c.pageSize!==u?g(H=>({...H,pageSize:u,page:1})):c.page!==d+1?g(H=>({...H,page:d+1})):c.searchText!==f?g(H=>({...H,searchText:f,page:1})):ye(q,c.walletSendStatus)?ye(Z,c.pushKitSendStatus)?ye(Q,c.emailSendStatus)||g(H=>({...H,emailSendStatus:Q,page:1})):g(H=>({...H,pushKitSendStatus:Z,page:1})):g(H=>({...H,walletSendStatus:q,page:1}))},oe=C.useCallback(async(d,u)=>{if(!u)return!1;const f=await A(u);return f?d==="wallet"?Ys(f):d==="email"?Hs(O,f):d==="pushKit"?Vs(O,f):d==="webhook"?Gs(f):!0:!1},[A,O]),le=C.useCallback(d=>Js(r,d),[r]),pe=()=>{B.anchorEl=null,B.position=null,M(null)},be=()=>{z.anchorEl=null,z.position=null},je=async(d,u,f=!0,L="")=>{if(!(!u.length||!d.length))try{t(d,u,f,L),z.anchorEl||(await Ee(.5),pe())}catch(q){console.error("handleResend error",{error:q})}},v=async({channels:d,isResendFailedOnly:u})=>{const f=j.map(L=>D[L].receiver);await je(d,f,u),await Ee(.5),be(),N([])},b=async(d,u=[],f=!0)=>{try{await je(["webhook"],[d.receiver],f,u)}catch(L){K.error(L.response?L.response.statusText:L.message)}},w=async(d,u,f,L=[],q=!0)=>{if(d.stopPropagation(),Qs(u,f)>=4){K.warning(r("notification.resendLimit"));return}if(!Ge.includes(f)){await b(u,L,q);return}if(d){const Q=d.currentTarget,H=Q.getBoundingClientRect();B.anchorEl=Q,B.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}M({channel:f});try{const Q=await oe(f,u.receiver);await Ee(1),M({channel:f,result:Q}),(typeof Q=="boolean"&&Q||Zt(Q)&&Object.values(Q).every(H=>!!H))&&(await t([f],[u.receiver],q),z.anchorEl||(await Ee(.5),pe()))}catch(Q){K.error(Q.message)}},I=d=>{g(u=>({...u,dateRange:d,page:1}))},k=(d,u,f,L)=>{d.stopPropagation();const q=f.filter(Z=>Z!==u);g(Z=>({...Z,[L]:q,page:1}))},F=ce(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:d=>{const{receiverUser:u,receiver:f}=D[d];return u?e.jsxs(T,{"data-cy":`member-name-${u.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(Tt,{src:`${u.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:f,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Re,{children:u.fullName})]},f):e.jsx(vs,{size:14,responsive:!1,compact:!0,copyable:!1,did:f})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:c.walletSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Wallet",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[1].options.filterList,"walletSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Wallet",filterList:d,onChange:u,index:f,column:L,filterValues:E})},customBodyRenderLite:d=>{const{walletSendStatus:u,walletSendAt:f,walletSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"wallet",onResend:q=>w(q,D[d],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{pushKitSendStatus:u,pushKitSendAt:f,pushKitSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"pushkit",onResend:q=>w(q,D[d],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:c.pushKitSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Push Kit",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[2].options.filterList,"pushKitSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Push Kit",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{emailSendStatus:u,emailSendAt:f,emailSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"email",onResend:q=>w(q,D[d],"email",[],!1)})},filter:!0,filterType:"custom",filterList:c.emailSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Email",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[3].options.filterList,"emailSendStatus")}}),update:Oe},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(Be,{label:"Email",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{webhook:u}=D[d];if(!u)return null;const f=Object.entries(u)[0];if(!f)return null;const[L,q]=f,Z=q[0];return e.jsx(T,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(T,{className:"webhook-item",fontSize:12,children:[e.jsx(Re,{maxLength:30,children:L},L),e.jsx(ve,{status:Z.status,updatedAt:Z.sendAt,reason:Z.failedReason,channel:"webhook",onResend:Q=>w(Q,D[d],"webhook",[L],!1)})]},L)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:d=>{const{createdAt:u}=D[d];return e.jsx(Ot,{value:u,locale:o,shouldUpdate:!0})}}}],[D,o,c,r]),ne=[e.jsx(rt,{value:c.dateRange,onChange:I},"date-picker"),e.jsx(me,{variant:"contained",size:"small",color:"primary",loading:R,startIcon:e.jsx(Ft,{}),onClick:()=>P(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(T,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(tn,{children:e.jsxs(yt,{theme:y,children:[e.jsx(Rt,{className:"receivers-table",locale:o,loading:R,columns:F,data:D,onChange:U,options:$,customButtons:ne,components:{TableFilterList:d=>e.jsx(ot,{...d,itemComponent:u=>e.jsx(Pe,{...u,canDelete:()=>!1})})}}),B.anchorEl&&e.jsx(Me,{open:!!B.anchorEl,anchorReference:"anchorPosition",anchorPosition:B.position,onClose:pe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(sn,{children:[e.jsxs(ae,{variant:"body1",component:"div",className:"check-title",children:[_==null?void 0:_.channel," Checking"]}),e.jsx(T,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:le(_==null?void 0:_.channel).map(d=>{var q,Z;const{type:u,pass:f,fail:L}=d;return!(_!=null&&_.result)||(q=_==null?void 0:_.result)!=null&&q[u]?e.jsxs(ae,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(Z=_==null?void 0:_.result)!=null&&Z[u]?Ae.success.main:"inherit"},children:[_!=null&&_.result?e.jsx(_t,{}):e.jsx(bt,{size:12,sx:{color:Ae.primary.main}}),e.jsx("span",{children:f})]},u):e.jsxs(ae,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:Ae.error.main},children:[e.jsx(kt,{}),e.jsx("span",{children:L})]},u)})})]})}),z.anchorEl&&e.jsx(Me,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:be,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(lt,{loading:s,onCancel:be,onConfirm:v})})]})})})}const en=C.memo(Kt),tn=ue.div`
2
2
  td.MuiTableCell-footer {
3
3
  border: none !important;
4
4
  }
@@ -1,4 +1,4 @@
1
- import{r as P,t as hn,g as xn,e as Ct,a as yn}from"./vendor-react-DEoibe3W.js";import{a9 as Et,j as e,aa as E,bo as Ue,br as Be,bn as Fe,q as be,T as Z,O as de,ab as oe,bx as ze,ak as re,H as b,ah as z,e as vn,ad as Ce,w as bn,y as Ot,b4 as Cn,b5 as jn,I as Sn,bh as wn,bs as Pn,bR as kn}from"./vendor-mui-core-Bh-qMRq3.js";import{B as jt,e as $e,$ as In,ay as Tn,n as St,A as Dn,b as An}from"./vendor-utils-rHXShPKm.js";import{r as Nt,aI as _t,bx as Rn,h as Ln,a as V,X as En,W as On,ak as te,B as M,e as Nn,am as _n,d as Un,b1 as pe,Y as X,bn as Bn,j as Y,_ as Ut,ag as Fn,I as $n,aq as Wn,V as We,b3 as Mn,a5 as Bt,a4 as Ft,bt as zn}from"./vendor-ux-did-connect-Qap4yrMu.js";import{c as Q,a as qn,Y as $t,O as je,I as Hn,Z as Vn}from"./vendor-arcblock-C99E80cF.js";import{d as Kn}from"./ViewList-Bj0HBob4.js";import{a0 as Zn,f as Yn,A as H,av as qe,l as me,a1 as Qn,T as ne,aw as Gn,D as Wt,ax as Mt,v as Xn,b as Jn}from"./index-BzItMezw.js";import{U as zt,C as qt,I as es}from"./index-sAnn-Wqb.js";import{k as ts,u as He,a as Ve,m as ns,f as ss}from"./vendor-hooks-DpwFseeF.js";import{l as rs}from"./index-C5_3pYA_.js";import{u as K,d as wt,W as Ht}from"./dashboard-BwU59vns.js";import{W as Ke}from"./did-address-Ddg6Is1P.js";import{P as G}from"./permission-KYy-A4oZ.js";import{C as ke}from"./click-to-copy-ClNoTzk4.js";import{T as Vt}from"./index-C61DBznM.js";import{f as J}from"./index-8eXqqyHQ.js";import{_ as os}from"./useAsync-JBeeXlrl.js";import{I as q}from"./index-Cb7iBSvd.js";import{d as is}from"./DeleteOutline-BFB4Yy3c.js";import{C as ue}from"./confirm-hm6dpNbC.js";import{u as fe}from"./session-CSqVp1zS.js";import{i as Kt,a as Se,p as Zt}from"./util-DMDaTiE0.js";import{b as as}from"./sdk-B_abqbXe.js";import{A as ls}from"./actions-B2RmHKJh.js";import{S as cs}from"./shorten-label-Bf7YQUd6.js";import"./lottie-web-jYmAQWuC.js";import"./Phone--BSu-btI.js";import"./Location-By12Z3Te.js";import"./Email-CdSNK0eA.js";import"./Timezone-YZ0dMUEr.js";import"./useLocalStorage-BFO9aBYY.js";import"./PlayArrow-B19IPFeo.js";import"./get-safe-url-XcLmS0yc.js";import"./use-blocklet-logo-2Y2A06qi.js";import"./InfoOutlined-BGorl_CI.js";import"./dot-CdVWOAIG.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-ZAS6Si4t.js";import"./vendor-mui-x-CQTjfcpn.js";import"./AdapterDayjs-D2uo6EnV.js";import"./base32-B42OVABo.js";import"./MoreHoriz-Bncapj_R.js";var Ze={},ds=Et;Object.defineProperty(Ze,"__esModule",{value:!0});var Yt=Ze.default=void 0,ms=ds(Nt()),ps=e;Yt=Ze.default=(0,ms.default)((0,ps.jsx)("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8m0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4z"}),"Loop");var Ye=function(t){return e.jsxs("svg",{...t,children:[e.jsx("g",{clipPath:"url(#clip0)",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.99997 1.59778C8.19071 1.59778 7.39961 1.83775 6.72673 2.28736C6.05385 2.73697 5.5294 3.37601 5.21971 4.12367C4.91001 4.87134 4.82898 5.69405 4.98686 6.48777C5.14474 7.28149 5.53444 8.01056 6.10668 8.5828C6.67892 9.15504 7.408 9.54474 8.20172 9.70262C8.99544 9.8605 9.81815 9.77947 10.5658 9.46978C11.3135 9.16009 11.9525 8.63564 12.4021 7.96276C12.8517 7.28987 13.0917 6.49878 13.0917 5.68951C13.0917 4.60432 12.6606 3.56357 11.8933 2.79622C11.1259 2.02887 10.0852 1.59778 8.99997 1.59778ZM7.27426 3.9638C7.73195 3.50611 8.35271 3.24899 8.99997 3.24899C9.48266 3.24899 9.95452 3.39212 10.3559 3.66029C10.7572 3.92846 11.07 4.30962 11.2547 4.75556C11.4394 5.20151 11.4878 5.69222 11.3936 6.16563C11.2994 6.63905 11.067 7.07391 10.7257 7.41522C10.3844 7.75654 9.94951 7.98897 9.4761 8.08314C9.00268 8.17731 8.51197 8.12898 8.06603 7.94426C7.62008 7.75954 7.23892 7.44674 6.97075 7.04539C6.70258 6.64405 6.55945 6.1722 6.55945 5.68951C6.55945 5.04224 6.81658 4.42149 7.27426 3.9638ZM7.36691 10.3075C6.28172 10.3075 5.24097 10.7385 4.47362 11.5059C3.70627 12.2732 3.27518 13.314 3.27518 14.3992V17.121C3.27518 17.2763 3.4011 17.4022 3.55643 17.4022H4.64514C4.80047 17.4022 4.92639 17.2763 4.92639 17.121V14.3992C4.92639 13.7519 5.18351 13.1312 5.6412 12.6735C6.09889 12.2158 6.71964 11.9587 7.36691 11.9587H10.633C10.9535 11.9587 11.2709 12.0218 11.567 12.1444C11.8631 12.2671 12.1321 12.4469 12.3588 12.6735C12.5854 12.9001 12.7651 13.1691 12.8878 13.4652C13.0104 13.7613 13.0736 14.0787 13.0736 14.3992V17.121C13.0736 17.2763 13.1995 17.4022 13.3548 17.4022H14.4435C14.5989 17.4022 14.7248 17.2763 14.7248 17.121V14.3992C14.7248 13.314 14.2937 12.2732 13.5263 11.5059C12.759 10.7385 11.7182 10.3075 10.633 10.3075H7.36691Z"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0",children:e.jsx("rect",{width:"18",height:"18",transform:"translate(0 0.5)"})})})]})};Ye.defaultProps={width:"18",height:"19",viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg"};Ye.displayName="person";const us=Ye;var Qe=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M1.25 2.7087C1.25 2.24826 1.62326 1.875 2.0837 1.875H14.339C14.7995 1.875 15.1727 2.24826 15.1727 2.7087V9.31574C15.1727 9.77618 14.7995 10.1494 14.339 10.1494C13.8786 10.1494 13.5053 9.77618 13.5053 9.31574V3.54239H2.91739V16.7565H6.53772H8.34788H9.32435C9.78479 16.7565 10.158 17.1297 10.158 17.5902C10.158 18.0506 9.78479 18.4239 9.32435 18.4239H8.34788H2.0837C1.62326 18.4239 1.25 18.0506 1.25 17.5902V2.7087Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.21129 7.91935C7.70481 7.91935 7.29422 8.32993 7.29422 8.83641C7.29422 9.34289 7.70481 9.75348 8.21129 9.75348C8.71777 9.75348 9.12836 9.34289 9.12836 8.83641C9.12836 8.32993 8.71777 7.91935 8.21129 7.91935ZM5.62683 8.83641C5.62683 7.40905 6.78393 6.25195 8.21129 6.25195C9.63865 6.25195 10.7957 7.40905 10.7957 8.83641C10.7957 10.2638 9.63865 11.4209 8.21129 11.4209C6.78393 11.4209 5.62683 10.2638 5.62683 8.83641Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.62683 13.2133C5.62683 12.7529 6.00009 12.3796 6.46053 12.3796H9.96205C10.4225 12.3796 10.7957 12.7529 10.7957 13.2133C10.7957 13.6737 10.4225 14.047 9.96205 14.047H6.46053C6.00009 14.047 5.62683 13.6737 5.62683 13.2133Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6406 11.3125C15.8547 11.3125 16.0503 11.434 16.145 11.626L17.1779 13.7184L19.4876 14.056C19.6994 14.087 19.8753 14.2355 19.9413 14.4391C20.0074 14.6427 19.9521 14.8662 19.7987 15.0156L18.1279 16.643L18.5222 18.9421C18.5584 19.1532 18.4716 19.3665 18.2984 19.4923C18.1252 19.6182 17.8955 19.6347 17.706 19.5351L15.6406 18.4489L13.5753 19.5351C13.3858 19.6347 13.1561 19.6182 12.9829 19.4923C12.8096 19.3665 12.7229 19.1532 12.7591 18.9421L13.1534 16.643L11.4825 15.0156C11.3292 14.8662 11.2739 14.6427 11.3399 14.4391C11.406 14.2355 11.5818 14.087 11.7937 14.056L14.1034 13.7184L15.1362 11.626C15.231 11.434 15.4265 11.3125 15.6406 11.3125ZM15.6406 13.1458L14.9815 14.4813C14.8996 14.6471 14.7414 14.7621 14.5584 14.7889L13.0835 15.0044L14.1503 16.0435C14.283 16.1727 14.3435 16.359 14.3122 16.5416L14.0606 18.0088L15.3788 17.3155C15.5427 17.2293 15.7386 17.2293 15.9025 17.3155L17.2207 18.0088L16.969 16.5416C16.9377 16.359 16.9983 16.1727 17.131 16.0435L18.1978 15.0044L16.7229 14.7889C16.5399 14.7621 16.3817 14.6471 16.2998 14.4813L15.6406 13.1458Z"})]})};Qe.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};Qe.displayName="external-issuer";const Qt=Qe;var ve={},fs=t=>encodeURIComponent(t).replace(/[!'()*]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),Gt="%[a-f0-9]{2}",Pt=new RegExp("("+Gt+")|([^%]+?)","gi"),kt=new RegExp("("+Gt+")+","gi");function Me(t,r){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;r=r||1;var l=t.slice(0,r),u=t.slice(r);return Array.prototype.concat.call([],Me(l),Me(u))}function gs(t){try{return decodeURIComponent(t)}catch{for(var r=t.match(Pt)||[],l=1;l<r.length;l++)t=Me(r,l).join(""),r=t.match(Pt)||[];return t}}function hs(t){for(var r={"%FE%FF":"��","%FF%FE":"��"},l=kt.exec(t);l;){try{r[l[0]]=decodeURIComponent(l[0])}catch{var u=gs(l[0]);u!==l[0]&&(r[l[0]]=u)}l=kt.exec(t)}r["%C2"]="�";for(var m=Object.keys(r),g=0;g<m.length;g++){var w=m[g];t=t.replace(new RegExp(w,"g"),r[w])}return t}var xs=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return hs(t)}},ys=(t,r)=>{if(!(typeof t=="string"&&typeof r=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(r==="")return[t];const l=t.indexOf(r);return l===-1?[t]:[t.slice(0,l),t.slice(l+r.length)]},vs=function(t,r){for(var l={},u=Object.keys(t),m=Array.isArray(r),g=0;g<u.length;g++){var w=u[g],p=t[w];(m?r.indexOf(w)!==-1:r(w,p,t))&&(l[w]=p)}return l};(function(t){const r=fs,l=xs,u=ys,m=vs,g=n=>n==null;function w(n){switch(n.arrayFormat){case"index":return s=>(a,c)=>{const x=a.length;return c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,[h(s,n),"[",x,"]"].join("")]:[...a,[h(s,n),"[",h(x,n),"]=",h(c,n)].join("")]};case"bracket":return s=>(a,c)=>c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,[h(s,n),"[]"].join("")]:[...a,[h(s,n),"[]=",h(c,n)].join("")];case"comma":case"separator":return s=>(a,c)=>c==null||c.length===0?a:a.length===0?[[h(s,n),"=",h(c,n)].join("")]:[[a,h(c,n)].join(n.arrayFormatSeparator)];default:return s=>(a,c)=>c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,h(s,n)]:[...a,[h(s,n),"=",h(c,n)].join("")]}}function p(n){let s;switch(n.arrayFormat){case"index":return(a,c,x)=>{if(s=/\[(\d*)\]$/.exec(a),a=a.replace(/\[\d*\]$/,""),!s){x[a]=c;return}x[a]===void 0&&(x[a]={}),x[a][s[1]]=c};case"bracket":return(a,c,x)=>{if(s=/(\[\])$/.exec(a),a=a.replace(/\[\]$/,""),!s){x[a]=c;return}if(x[a]===void 0){x[a]=[c];return}x[a]=[].concat(x[a],c)};case"comma":case"separator":return(a,c,x)=>{const v=typeof c=="string"&&c.includes(n.arrayFormatSeparator),S=typeof c=="string"&&!v&&i(c,n).includes(n.arrayFormatSeparator);c=S?i(c,n):c;const U=v||S?c.split(n.arrayFormatSeparator).map(F=>i(F,n)):c===null?c:i(c,n);x[a]=U};default:return(a,c,x)=>{if(x[a]===void 0){x[a]=c;return}x[a]=[].concat(x[a],c)}}}function y(n){if(typeof n!="string"||n.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function h(n,s){return s.encode?s.strict?r(n):encodeURIComponent(n):n}function i(n,s){return s.decode?l(n):n}function I(n){return Array.isArray(n)?n.sort():typeof n=="object"?I(Object.keys(n)).sort((s,a)=>Number(s)-Number(a)).map(s=>n[s]):n}function j(n){const s=n.indexOf("#");return s!==-1&&(n=n.slice(0,s)),n}function k(n){let s="";const a=n.indexOf("#");return a!==-1&&(s=n.slice(a)),s}function o(n){n=j(n);const s=n.indexOf("?");return s===-1?"":n.slice(s+1)}function T(n,s){return s.parseNumbers&&!Number.isNaN(Number(n))&&typeof n=="string"&&n.trim()!==""?n=Number(n):s.parseBooleans&&n!==null&&(n.toLowerCase()==="true"||n.toLowerCase()==="false")&&(n=n.toLowerCase()==="true"),n}function d(n,s){s=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},s),y(s.arrayFormatSeparator);const a=p(s),c=Object.create(null);if(typeof n!="string"||(n=n.trim().replace(/^[?#&]/,""),!n))return c;for(const x of n.split("&")){if(x==="")continue;let[v,S]=u(s.decode?x.replace(/\+/g," "):x,"=");S=S===void 0?null:["comma","separator"].includes(s.arrayFormat)?S:i(S,s),a(i(v,s),S,c)}for(const x of Object.keys(c)){const v=c[x];if(typeof v=="object"&&v!==null)for(const S of Object.keys(v))v[S]=T(v[S],s);else c[x]=T(v,s)}return s.sort===!1?c:(s.sort===!0?Object.keys(c).sort():Object.keys(c).sort(s.sort)).reduce((x,v)=>{const S=c[v];return S&&typeof S=="object"&&!Array.isArray(S)?x[v]=I(S):x[v]=S,x},Object.create(null))}t.extract=o,t.parse=d,t.stringify=(n,s)=>{if(!n)return"";s=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},s),y(s.arrayFormatSeparator);const a=S=>s.skipNull&&g(n[S])||s.skipEmptyString&&n[S]==="",c=w(s),x={};for(const S of Object.keys(n))a(S)||(x[S]=n[S]);const v=Object.keys(x);return s.sort!==!1&&v.sort(s.sort),v.map(S=>{const U=n[S];return U===void 0?"":U===null?h(S,s):Array.isArray(U)?U.reduce(c(S),[]).join("&"):h(S,s)+"="+h(U,s)}).filter(S=>S.length>0).join("&")},t.parseUrl=(n,s)=>{s=Object.assign({decode:!0},s);const[a,c]=u(n,"#");return Object.assign({url:a.split("?")[0]||"",query:d(o(n),s)},s&&s.parseFragmentIdentifier&&c?{fragmentIdentifier:i(c,s)}:{})},t.stringifyUrl=(n,s)=>{s=Object.assign({encode:!0,strict:!0},s);const a=j(n.url).split("?")[0]||"",c=t.extract(n.url),x=t.parse(c,{sort:!1}),v=Object.assign(x,n.query);let S=t.stringify(v,s);S&&(S=`?${S}`);let U=k(n.url);return n.fragmentIdentifier&&(U=`#${h(n.fragmentIdentifier,s)}`),`${a}${S}${U}`},t.pick=(n,s,a)=>{a=Object.assign({parseFragmentIdentifier:!0},a);const{url:c,query:x,fragmentIdentifier:v}=t.parseUrl(n,a);return t.stringifyUrl({url:c,query:m(x,s),fragmentIdentifier:v},a)},t.exclude=(n,s,a)=>{const c=Array.isArray(s)?x=>!s.includes(x):(x,v)=>!s(x,v);return t.pick(n,c,a)}})(ve);const ae=hn,bs={parseNumbers:!1,parseBooleans:!1},Cs={skipNull:!1,skipEmptyString:!1},js=(t,r)=>{var l,u;const{navigateMode:m="push",parseOptions:g,stringifyOptions:w}={},p=Object.assign(Object.assign({},bs),g),y=Object.assign(Object.assign({},Cs),w),h=ae.useLocation(),i=(l=ae.useHistory)===null||l===void 0?void 0:l.call(ae),I=(u=ae.useNavigate)===null||u===void 0?void 0:u.call(ae),j=ts(),k=P.useRef(typeof t=="function"?t():t||{}),o=P.useMemo(()=>ve.parse(h.search,p),[h.search]),T=P.useMemo(()=>Object.assign(Object.assign({},k.current),o),[o]);return[T,He(n=>{const s=typeof n=="function"?n(T):n;j(),i&&i[m]({hash:h.hash,search:ve.stringify(Object.assign(Object.assign({},o),s),y)||"?"},h.state),I&&I({hash:h.hash,search:ve.stringify(Object.assign(Object.assign({},o),s),y)||"?"},{replace:m==="replace",state:h.state})})]},Ss=js,ws=_t,Oe=Rn,Ne=Ln,Ps=rs,It={role:ws.types.RoleType.ROLE_APPLICATION},ks=(t,r,l,u)=>{let m=l||It;const g=(0,Ne.isEthereumType)((0,Ne.DidType)(l));if(g?m=(0,Oe.WalletType)(l):m=(0,Oe.WalletType)(It),!(0,Ne.isValid)(t)){let w="";try{return g?w=t.slice(0,66):w=t,(0,Oe.fromSecretKey)(w,m)}catch(p){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${p.message}`)}}if(!r)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,Ps.fromAppDid)(t,r,m,u||0)};var Is=ks,Xt=Ct&&Ct.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const le=Xt(Zn),Ts=_t,xe=Xt(Is),Ds=Yn,As=(t,r,{returnWallet:l=!0}={})=>{var F,A;if(!t||typeof t!="object"||!Array.isArray(t.environments)||!(0,le.default)(t,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:u,configs:m=[]}=t,g=[...m,...u],w=g.find(D=>D.key==="BLOCKLET_APP_DESCRIPTION"),p=g.find(D=>D.key==="BLOCKLET_PASSPORT_COLOR"),y=g.find(D=>D.key==="BLOCKLET_APP_URL"),h=g.find(D=>D.key==="BLOCKLET_APP_TENANT_MODE"),{did:i,version:I}=t.meta,j=(0,Ds.getDisplayName)(t),k=(0,le.default)(w,"value",t.meta.description),o=(0,le.default)(p,"value","auto"),T=(0,le.default)(y,"value",""),d=(0,le.default)(h,"value","");if(!l)return{did:i,version:I,name:j,description:k,passportColor:o,appUrl:T,secret:"",wallet:null,permanentWallet:null,tenantMode:d};const n=g.find(D=>D.key==="BLOCKLET_APP_SK"),s=g.find(D=>D.key==="BLOCKLET_APP_CHAIN_TYPE")||g.find(D=>D.key==="BLOCKLET_WALLET_TYPE"),a=g.find(D=>D.key==="BLOCKLET_APP_PSK");let c;s&&(s.value==="ethereum"||s.value==="eth")&&(c=s.value);let x=null,v=null;if(n&&n.value)x=(0,xe.default)(n.value,void 0,c),a&&a.value&&a.value!==n.value&&(v=(0,xe.default)(a.value,void 0,c));else{if(!r||typeof r!="string")throw new Error("Node secret key must be a string");s?x=(0,xe.default)(t.meta.did,r,c):x=(0,xe.default)(t.meta.did,r)}const S=((A=(F=t.settings)==null?void 0:F.session)==null?void 0:A.salt)||"",U=Ts.Hasher.SHA3.hash256(jt.concat([x.secretKey,x.address,S].filter(Boolean).map(D=>jt.from(D))));return{did:i,version:I,name:j,description:k,passportColor:o,appUrl:T,secret:U,wallet:x,permanentWallet:v||x,tenantMode:d}};var Rs=As;const Ls=xn(Rs);function Ge({teamDid:t,roles:r,apps:l,onCancel:u,onSuccess:m,onError:g,endpoint:w}){var T;const{api:p}=H(),{t:y,locale:h}=V(),i=Ve({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:l.length>0?l[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),I=async()=>{if(!i.role){i.error=y("team.member.error.passportEmpty");return}const d=i.remark.trim();i.error=null,i.loading=!0;try{let n=i.sourceAppPid??null;n===t&&(n=null);const s={teamDid:t,role:i.role,remark:d,sourceAppPid:n,passportExpireTime:i.passportExpireTime?i.passportExpireTime.toISOString():""};i.display&&(s.display={type:"url",content:i.display});const{inviteInfo:a}=await p.createMemberInvitation({input:s});i.inviteInfo=a,i.activeStep=1}catch(n){const s=J(n);i.error=s,g(n)}finally{i.loading=!1}},j=r.find(d=>d.name===i.role),o=[{body:e.jsxs(E,{sx:{display:"flex",flexDirection:"column",gap:3},children:[l.length>1?e.jsxs(Ue,{fullWidth:!0,children:[e.jsx(Be,{children:y("common.sourceApp")}),e.jsx(Fe,{value:i.sourceAppPid,onChange:d=>{i.error=null,i.sourceAppPid=d.target.value},fullWidth:!0,label:y("common.passport"),disabled:i.loading,children:l.map(d=>e.jsx(be,{value:d.appPid,children:e.jsxs(E,{sx:{display:"flex",justifyContent:"space-between",gap:2,width:"100%"},children:[e.jsxs(E,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(En,{did:d.appPid,size:28}),d.appName]}),e.jsx(On,{did:d.appPid,compact:!0,responsive:!1})]})},d.appPid))})]}):null,e.jsxs(Ue,{fullWidth:!0,variant:"outlined",children:[e.jsx(Be,{children:y("common.passport")}),e.jsx(Fe,{"data-cy":"invite-member-select-role",value:i.role,onChange:d=>{i.error=null,i.role=d.target.value},fullWidth:!0,label:y("common.passport"),disabled:i.loading,onKeyPress:d=>{d.key==="Enter"&&(d.preventDefault(),I())},children:r.filter(d=>d.name!=="owner").map(d=>e.jsx(be,{value:d.name,"data-cy":`invite-member-select-option-${d.name}`,children:e.jsxs(E,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(Z,{variant:"subtitle1",children:d.title||d.name}),e.jsx(Z,{variant:"caption",sx:{opacity:.7},children:d.description})]})},d.name))})]}),((T=j==null?void 0:j.extra)==null?void 0:T.display)==="custom"&&e.jsx(de,{label:y("common.display"),type:"url",value:i.display,onChange:d=>{i.error=null,i.display=d.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(de,{label:y("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.remark,onChange:d=>{i.error=null,i.remark=d.target.value},disabled:i.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Vt,{value:i.passportExpireTime,onChange:d=>{i.passportExpireTime=d}})]}),cancel:y("common.cancel"),confirm:y("team.member.inviteDialog.createInviteLink"),onCancel:u,onConfirm:I},{body:()=>{var n,s;const d=qe({inviteId:(n=i.inviteInfo)==null?void 0:n.inviteId,endpoint:w});return e.jsxs("div",{children:[e.jsx(E,{sx:{fontSize:16,fontWeight:"bold"},children:y("team.member.inviteDialog.createSuccessTip",{expireDate:me((s=i.inviteInfo)==null?void 0:s.expireDate,h)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(ke,{children:d})]})},confirm:y("common.confirm"),onConfirm:m}][i.activeStep];return e.jsxs(te,{title:y("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[o.cancel&&e.jsx(M,{onClick:o.onCancel,color:"inherit",children:o.cancel}),e.jsxs(M,{onClick:o.onConfirm,color:"primary",disabled:i.loading||!i.role,variant:"contained",autoFocus:!0,children:[i.loading&&e.jsx(oe,{size:16}),o.confirm]})]}),children:[e.jsx(ze,{component:"div",children:typeof o.body=="function"?o.body():o.body}),!!i.error&&e.jsx(re,{severity:"error",variant:"icon",children:i.error})]})}Ge.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,roles:b.array,apps:b.array,endpoint:b.string};Ge.defaultProps={onError:()=>{},roles:[],apps:[],endpoint:""};function Xe({teamDid:t,onCancel:r,onSuccess:l,onError:u,endpoint:m}){const{api:g,info:w}=H(),{api:p}=P.useContext(Nn),[y,h]=P.useState(!1),{t:i,locale:I}=V(),[j,k]=P.useState(""),[o,T]=P.useState(!1),[d,n]=P.useState(0),[s,a]=P.useState(""),[c,x]=P.useState(""),v=!!$e(w,"ownerNft.did"),S=os(async()=>{if(v){const{state:R}=await g.getDelegationState();return R}return{delegated:!0}});if(S.loading)return e.jsx(te,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:r,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(oe,{})})});if(S.error)return e.jsx(te,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:r,children:e.jsx(re,{severity:"error",variant:"icon",children:J(S.error)})});const U=async()=>{k(null),h(!0);try{const{inviteInfo:R}=await g.createTransferInvitation({input:{teamDid:t,role:"owner",remark:c.trim()}});a(R),n(D.length-1)}catch(R){const W=J(R);k(W),u(R)}finally{h(!1)}},F=()=>{T(!0),n(1)},A=()=>{T(!1),n(0)},D=[{body:e.jsxs(Z,{component:"div",children:[e.jsxs(re,{severity:"warning",children:[e.jsx(Z,{children:i("team.transferNode.inviteDialog.tips.progress")}),e.jsx(Z,{children:i("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(re,{severity:"warning",children:e.jsx(Z,{children:i("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(de,{label:i("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:c,onChange:R=>{k(null),x(R.target.value)},disabled:y,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:i("common.cancel"),confirm:i("team.transferNode.inviteDialog.createInviteLink"),onCancel:r,onConfirm:v&&!$e(S,"value.delegated")?F:U},{body:()=>e.jsx(_n,{action:"delegate-transfer-nft",open:o,locale:I,checkFn:p.get,onClose:A,onSuccess:U,checkTimeout:5*60*1e3,webWalletUrl:Qn(w),extraParams:{targetDID:w.did},messages:{title:i("team.transferNode.delegateDialog.title"),scan:i("team.transferNode.delegateDialog.scan"),confirm:i("team.transferNode.delegateDialog.confirm"),success:i("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const R=qe({inviteId:s.inviteId,endpoint:m});return e.jsxs("div",{children:[e.jsx(Es,{children:i("team.transferNode.inviteDialog.createSuccessTip",{expireDate:me(s.expireDate,I)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(ke,{children:R})]})},confirm:i("common.confirm"),onConfirm:l}],O=D[d];return e.jsxs(te,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[O.cancel&&e.jsx(M,{onClick:O.onCancel,color:"inherit",children:O.cancel}),e.jsxs(M,{onClick:O.onConfirm,color:"primary",disabled:y,variant:"contained",autoFocus:!0,children:[y&&e.jsx(oe,{size:16}),O.confirm]})]}),children:[e.jsx(ze,{component:"div",children:typeof O.body=="function"?O.body():O.body}),!!j&&e.jsx(re,{severity:"error",variant:"icon",children:j})]})}Xe.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,endpoint:b.string};Xe.defaultProps={onError:()=>{},endpoint:""};const Es=z.div`
1
+ import{r as P,t as hn,g as xn,e as Ct,a as yn}from"./vendor-react-DEoibe3W.js";import{a9 as Et,j as e,aa as E,bo as Ue,br as Be,bn as Fe,q as be,T as Z,O as de,ab as oe,bx as ze,ak as re,H as b,ah as z,e as vn,ad as Ce,w as bn,y as Ot,b4 as Cn,b5 as jn,I as Sn,bh as wn,bs as Pn,bR as kn}from"./vendor-mui-core-Bh-qMRq3.js";import{B as jt,e as $e,$ as In,ay as Tn,n as St,A as Dn,b as An}from"./vendor-utils-rHXShPKm.js";import{r as Nt,aI as _t,bx as Rn,h as Ln,a as V,X as En,W as On,ak as te,B as M,e as Nn,am as _n,d as Un,b1 as pe,Y as X,bn as Bn,j as Y,_ as Ut,ag as Fn,I as $n,aq as Wn,V as We,b3 as Mn,a5 as Bt,a4 as Ft,bt as zn}from"./vendor-ux-did-connect-D0L9YnHn.js";import{c as Q,a as qn,Y as $t,O as je,I as Hn,Z as Vn}from"./vendor-arcblock-Ca95GLVH.js";import{d as Kn}from"./ViewList-BvucdDXZ.js";import{a0 as Zn,f as Yn,A as H,av as qe,l as me,a1 as Qn,T as ne,aw as Gn,D as Wt,ax as Mt,v as Xn,b as Jn}from"./index-YuW8IExe.js";import{U as zt,C as qt,I as es}from"./index-c0hdujdn.js";import{k as ts,u as He,a as Ve,m as ns,f as ss}from"./vendor-hooks-DpwFseeF.js";import{l as rs}from"./index-DYlN9Brg.js";import{u as K,d as wt,W as Ht}from"./dashboard-B_QqB4aw.js";import{W as Ke}from"./did-address-mv0Qw7hC.js";import{P as G}from"./permission-BfddnDBs.js";import{C as ke}from"./click-to-copy-DtGgy9Ua.js";import{T as Vt}from"./index-CleFkLt8.js";import{f as J}from"./index-8eXqqyHQ.js";import{u as os}from"./useAsync-dC0jHVWO.js";import{I as q}from"./index-Bv8sds6g.js";import{d as is}from"./DeleteOutline-Cj7UhBbF.js";import{C as ue}from"./confirm-DaR0Yx39.js";import{u as fe}from"./session-DUt5rVEy.js";import{i as Kt,a as Se,p as Zt}from"./util-CiTimo-i.js";import{b as as}from"./sdk-CytUSheP.js";import{A as ls}from"./actions-BWSNMC_c.js";import{S as cs}from"./shorten-label-Bf7YQUd6.js";import"./lottie-web-jYmAQWuC.js";import"./Phone--BSu-btI.js";import"./Location-By12Z3Te.js";import"./Email-CdSNK0eA.js";import"./Timezone-YZ0dMUEr.js";import"./useLocalStorage-DotMjDUB.js";import"./PlayArrow-BHO_DqT2.js";import"./get-safe-url-DYtntqqo.js";import"./use-blocklet-logo-3VH4RBTr.js";import"./InfoOutlined-uoMMChNE.js";import"./dot-D3X4DSlo.js";import"./useAsync-CDjYBiwf.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-JEGQfLZ2.js";import"./vendor-mui-x-CQTjfcpn.js";import"./AdapterDayjs-Bck9Dv3l.js";import"./base32-BnPQ4q4v.js";import"./MoreHoriz-3SNxR36h.js";var Ze={},ds=Et;Object.defineProperty(Ze,"__esModule",{value:!0});var Yt=Ze.default=void 0,ms=ds(Nt()),ps=e;Yt=Ze.default=(0,ms.default)((0,ps.jsx)("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8m0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4z"}),"Loop");var Ye=function(t){return e.jsxs("svg",{...t,children:[e.jsx("g",{clipPath:"url(#clip0)",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.99997 1.59778C8.19071 1.59778 7.39961 1.83775 6.72673 2.28736C6.05385 2.73697 5.5294 3.37601 5.21971 4.12367C4.91001 4.87134 4.82898 5.69405 4.98686 6.48777C5.14474 7.28149 5.53444 8.01056 6.10668 8.5828C6.67892 9.15504 7.408 9.54474 8.20172 9.70262C8.99544 9.8605 9.81815 9.77947 10.5658 9.46978C11.3135 9.16009 11.9525 8.63564 12.4021 7.96276C12.8517 7.28987 13.0917 6.49878 13.0917 5.68951C13.0917 4.60432 12.6606 3.56357 11.8933 2.79622C11.1259 2.02887 10.0852 1.59778 8.99997 1.59778ZM7.27426 3.9638C7.73195 3.50611 8.35271 3.24899 8.99997 3.24899C9.48266 3.24899 9.95452 3.39212 10.3559 3.66029C10.7572 3.92846 11.07 4.30962 11.2547 4.75556C11.4394 5.20151 11.4878 5.69222 11.3936 6.16563C11.2994 6.63905 11.067 7.07391 10.7257 7.41522C10.3844 7.75654 9.94951 7.98897 9.4761 8.08314C9.00268 8.17731 8.51197 8.12898 8.06603 7.94426C7.62008 7.75954 7.23892 7.44674 6.97075 7.04539C6.70258 6.64405 6.55945 6.1722 6.55945 5.68951C6.55945 5.04224 6.81658 4.42149 7.27426 3.9638ZM7.36691 10.3075C6.28172 10.3075 5.24097 10.7385 4.47362 11.5059C3.70627 12.2732 3.27518 13.314 3.27518 14.3992V17.121C3.27518 17.2763 3.4011 17.4022 3.55643 17.4022H4.64514C4.80047 17.4022 4.92639 17.2763 4.92639 17.121V14.3992C4.92639 13.7519 5.18351 13.1312 5.6412 12.6735C6.09889 12.2158 6.71964 11.9587 7.36691 11.9587H10.633C10.9535 11.9587 11.2709 12.0218 11.567 12.1444C11.8631 12.2671 12.1321 12.4469 12.3588 12.6735C12.5854 12.9001 12.7651 13.1691 12.8878 13.4652C13.0104 13.7613 13.0736 14.0787 13.0736 14.3992V17.121C13.0736 17.2763 13.1995 17.4022 13.3548 17.4022H14.4435C14.5989 17.4022 14.7248 17.2763 14.7248 17.121V14.3992C14.7248 13.314 14.2937 12.2732 13.5263 11.5059C12.759 10.7385 11.7182 10.3075 10.633 10.3075H7.36691Z"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0",children:e.jsx("rect",{width:"18",height:"18",transform:"translate(0 0.5)"})})})]})};Ye.defaultProps={width:"18",height:"19",viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg"};Ye.displayName="person";const us=Ye;var Qe=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M1.25 2.7087C1.25 2.24826 1.62326 1.875 2.0837 1.875H14.339C14.7995 1.875 15.1727 2.24826 15.1727 2.7087V9.31574C15.1727 9.77618 14.7995 10.1494 14.339 10.1494C13.8786 10.1494 13.5053 9.77618 13.5053 9.31574V3.54239H2.91739V16.7565H6.53772H8.34788H9.32435C9.78479 16.7565 10.158 17.1297 10.158 17.5902C10.158 18.0506 9.78479 18.4239 9.32435 18.4239H8.34788H2.0837C1.62326 18.4239 1.25 18.0506 1.25 17.5902V2.7087Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.21129 7.91935C7.70481 7.91935 7.29422 8.32993 7.29422 8.83641C7.29422 9.34289 7.70481 9.75348 8.21129 9.75348C8.71777 9.75348 9.12836 9.34289 9.12836 8.83641C9.12836 8.32993 8.71777 7.91935 8.21129 7.91935ZM5.62683 8.83641C5.62683 7.40905 6.78393 6.25195 8.21129 6.25195C9.63865 6.25195 10.7957 7.40905 10.7957 8.83641C10.7957 10.2638 9.63865 11.4209 8.21129 11.4209C6.78393 11.4209 5.62683 10.2638 5.62683 8.83641Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.62683 13.2133C5.62683 12.7529 6.00009 12.3796 6.46053 12.3796H9.96205C10.4225 12.3796 10.7957 12.7529 10.7957 13.2133C10.7957 13.6737 10.4225 14.047 9.96205 14.047H6.46053C6.00009 14.047 5.62683 13.6737 5.62683 13.2133Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6406 11.3125C15.8547 11.3125 16.0503 11.434 16.145 11.626L17.1779 13.7184L19.4876 14.056C19.6994 14.087 19.8753 14.2355 19.9413 14.4391C20.0074 14.6427 19.9521 14.8662 19.7987 15.0156L18.1279 16.643L18.5222 18.9421C18.5584 19.1532 18.4716 19.3665 18.2984 19.4923C18.1252 19.6182 17.8955 19.6347 17.706 19.5351L15.6406 18.4489L13.5753 19.5351C13.3858 19.6347 13.1561 19.6182 12.9829 19.4923C12.8096 19.3665 12.7229 19.1532 12.7591 18.9421L13.1534 16.643L11.4825 15.0156C11.3292 14.8662 11.2739 14.6427 11.3399 14.4391C11.406 14.2355 11.5818 14.087 11.7937 14.056L14.1034 13.7184L15.1362 11.626C15.231 11.434 15.4265 11.3125 15.6406 11.3125ZM15.6406 13.1458L14.9815 14.4813C14.8996 14.6471 14.7414 14.7621 14.5584 14.7889L13.0835 15.0044L14.1503 16.0435C14.283 16.1727 14.3435 16.359 14.3122 16.5416L14.0606 18.0088L15.3788 17.3155C15.5427 17.2293 15.7386 17.2293 15.9025 17.3155L17.2207 18.0088L16.969 16.5416C16.9377 16.359 16.9983 16.1727 17.131 16.0435L18.1978 15.0044L16.7229 14.7889C16.5399 14.7621 16.3817 14.6471 16.2998 14.4813L15.6406 13.1458Z"})]})};Qe.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};Qe.displayName="external-issuer";const Qt=Qe;var ve={},fs=t=>encodeURIComponent(t).replace(/[!'()*]/g,r=>`%${r.charCodeAt(0).toString(16).toUpperCase()}`),Gt="%[a-f0-9]{2}",Pt=new RegExp("("+Gt+")|([^%]+?)","gi"),kt=new RegExp("("+Gt+")+","gi");function Me(t,r){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;r=r||1;var l=t.slice(0,r),u=t.slice(r);return Array.prototype.concat.call([],Me(l),Me(u))}function gs(t){try{return decodeURIComponent(t)}catch{for(var r=t.match(Pt)||[],l=1;l<r.length;l++)t=Me(r,l).join(""),r=t.match(Pt)||[];return t}}function hs(t){for(var r={"%FE%FF":"��","%FF%FE":"��"},l=kt.exec(t);l;){try{r[l[0]]=decodeURIComponent(l[0])}catch{var u=gs(l[0]);u!==l[0]&&(r[l[0]]=u)}l=kt.exec(t)}r["%C2"]="�";for(var m=Object.keys(r),g=0;g<m.length;g++){var w=m[g];t=t.replace(new RegExp(w,"g"),r[w])}return t}var xs=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return hs(t)}},ys=(t,r)=>{if(!(typeof t=="string"&&typeof r=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(r==="")return[t];const l=t.indexOf(r);return l===-1?[t]:[t.slice(0,l),t.slice(l+r.length)]},vs=function(t,r){for(var l={},u=Object.keys(t),m=Array.isArray(r),g=0;g<u.length;g++){var w=u[g],p=t[w];(m?r.indexOf(w)!==-1:r(w,p,t))&&(l[w]=p)}return l};(function(t){const r=fs,l=xs,u=ys,m=vs,g=n=>n==null;function w(n){switch(n.arrayFormat){case"index":return s=>(a,c)=>{const x=a.length;return c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,[h(s,n),"[",x,"]"].join("")]:[...a,[h(s,n),"[",h(x,n),"]=",h(c,n)].join("")]};case"bracket":return s=>(a,c)=>c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,[h(s,n),"[]"].join("")]:[...a,[h(s,n),"[]=",h(c,n)].join("")];case"comma":case"separator":return s=>(a,c)=>c==null||c.length===0?a:a.length===0?[[h(s,n),"=",h(c,n)].join("")]:[[a,h(c,n)].join(n.arrayFormatSeparator)];default:return s=>(a,c)=>c===void 0||n.skipNull&&c===null||n.skipEmptyString&&c===""?a:c===null?[...a,h(s,n)]:[...a,[h(s,n),"=",h(c,n)].join("")]}}function p(n){let s;switch(n.arrayFormat){case"index":return(a,c,x)=>{if(s=/\[(\d*)\]$/.exec(a),a=a.replace(/\[\d*\]$/,""),!s){x[a]=c;return}x[a]===void 0&&(x[a]={}),x[a][s[1]]=c};case"bracket":return(a,c,x)=>{if(s=/(\[\])$/.exec(a),a=a.replace(/\[\]$/,""),!s){x[a]=c;return}if(x[a]===void 0){x[a]=[c];return}x[a]=[].concat(x[a],c)};case"comma":case"separator":return(a,c,x)=>{const v=typeof c=="string"&&c.includes(n.arrayFormatSeparator),S=typeof c=="string"&&!v&&i(c,n).includes(n.arrayFormatSeparator);c=S?i(c,n):c;const U=v||S?c.split(n.arrayFormatSeparator).map(F=>i(F,n)):c===null?c:i(c,n);x[a]=U};default:return(a,c,x)=>{if(x[a]===void 0){x[a]=c;return}x[a]=[].concat(x[a],c)}}}function y(n){if(typeof n!="string"||n.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function h(n,s){return s.encode?s.strict?r(n):encodeURIComponent(n):n}function i(n,s){return s.decode?l(n):n}function I(n){return Array.isArray(n)?n.sort():typeof n=="object"?I(Object.keys(n)).sort((s,a)=>Number(s)-Number(a)).map(s=>n[s]):n}function j(n){const s=n.indexOf("#");return s!==-1&&(n=n.slice(0,s)),n}function k(n){let s="";const a=n.indexOf("#");return a!==-1&&(s=n.slice(a)),s}function o(n){n=j(n);const s=n.indexOf("?");return s===-1?"":n.slice(s+1)}function T(n,s){return s.parseNumbers&&!Number.isNaN(Number(n))&&typeof n=="string"&&n.trim()!==""?n=Number(n):s.parseBooleans&&n!==null&&(n.toLowerCase()==="true"||n.toLowerCase()==="false")&&(n=n.toLowerCase()==="true"),n}function d(n,s){s=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},s),y(s.arrayFormatSeparator);const a=p(s),c=Object.create(null);if(typeof n!="string"||(n=n.trim().replace(/^[?#&]/,""),!n))return c;for(const x of n.split("&")){if(x==="")continue;let[v,S]=u(s.decode?x.replace(/\+/g," "):x,"=");S=S===void 0?null:["comma","separator"].includes(s.arrayFormat)?S:i(S,s),a(i(v,s),S,c)}for(const x of Object.keys(c)){const v=c[x];if(typeof v=="object"&&v!==null)for(const S of Object.keys(v))v[S]=T(v[S],s);else c[x]=T(v,s)}return s.sort===!1?c:(s.sort===!0?Object.keys(c).sort():Object.keys(c).sort(s.sort)).reduce((x,v)=>{const S=c[v];return S&&typeof S=="object"&&!Array.isArray(S)?x[v]=I(S):x[v]=S,x},Object.create(null))}t.extract=o,t.parse=d,t.stringify=(n,s)=>{if(!n)return"";s=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},s),y(s.arrayFormatSeparator);const a=S=>s.skipNull&&g(n[S])||s.skipEmptyString&&n[S]==="",c=w(s),x={};for(const S of Object.keys(n))a(S)||(x[S]=n[S]);const v=Object.keys(x);return s.sort!==!1&&v.sort(s.sort),v.map(S=>{const U=n[S];return U===void 0?"":U===null?h(S,s):Array.isArray(U)?U.reduce(c(S),[]).join("&"):h(S,s)+"="+h(U,s)}).filter(S=>S.length>0).join("&")},t.parseUrl=(n,s)=>{s=Object.assign({decode:!0},s);const[a,c]=u(n,"#");return Object.assign({url:a.split("?")[0]||"",query:d(o(n),s)},s&&s.parseFragmentIdentifier&&c?{fragmentIdentifier:i(c,s)}:{})},t.stringifyUrl=(n,s)=>{s=Object.assign({encode:!0,strict:!0},s);const a=j(n.url).split("?")[0]||"",c=t.extract(n.url),x=t.parse(c,{sort:!1}),v=Object.assign(x,n.query);let S=t.stringify(v,s);S&&(S=`?${S}`);let U=k(n.url);return n.fragmentIdentifier&&(U=`#${h(n.fragmentIdentifier,s)}`),`${a}${S}${U}`},t.pick=(n,s,a)=>{a=Object.assign({parseFragmentIdentifier:!0},a);const{url:c,query:x,fragmentIdentifier:v}=t.parseUrl(n,a);return t.stringifyUrl({url:c,query:m(x,s),fragmentIdentifier:v},a)},t.exclude=(n,s,a)=>{const c=Array.isArray(s)?x=>!s.includes(x):(x,v)=>!s(x,v);return t.pick(n,c,a)}})(ve);const ae=hn,bs={parseNumbers:!1,parseBooleans:!1},Cs={skipNull:!1,skipEmptyString:!1},js=(t,r)=>{var l,u;const{navigateMode:m="push",parseOptions:g,stringifyOptions:w}={},p=Object.assign(Object.assign({},bs),g),y=Object.assign(Object.assign({},Cs),w),h=ae.useLocation(),i=(l=ae.useHistory)===null||l===void 0?void 0:l.call(ae),I=(u=ae.useNavigate)===null||u===void 0?void 0:u.call(ae),j=ts(),k=P.useRef(typeof t=="function"?t():t||{}),o=P.useMemo(()=>ve.parse(h.search,p),[h.search]),T=P.useMemo(()=>Object.assign(Object.assign({},k.current),o),[o]);return[T,He(n=>{const s=typeof n=="function"?n(T):n;j(),i&&i[m]({hash:h.hash,search:ve.stringify(Object.assign(Object.assign({},o),s),y)||"?"},h.state),I&&I({hash:h.hash,search:ve.stringify(Object.assign(Object.assign({},o),s),y)||"?"},{replace:m==="replace",state:h.state})})]},Ss=js,ws=_t,Oe=Rn,Ne=Ln,Ps=rs,It={role:ws.types.RoleType.ROLE_APPLICATION},ks=(t,r,l,u)=>{let m=l||It;const g=(0,Ne.isEthereumType)((0,Ne.DidType)(l));if(g?m=(0,Oe.WalletType)(l):m=(0,Oe.WalletType)(It),!(0,Ne.isValid)(t)){let w="";try{return g?w=t.slice(0,66):w=t,(0,Oe.fromSecretKey)(w,m)}catch(p){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${p.message}`)}}if(!r)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,Ps.fromAppDid)(t,r,m,u||0)};var Is=ks,Xt=Ct&&Ct.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const le=Xt(Zn),Ts=_t,xe=Xt(Is),Ds=Yn,As=(t,r,{returnWallet:l=!0}={})=>{var F,A;if(!t||typeof t!="object"||!Array.isArray(t.environments)||!(0,le.default)(t,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:u,configs:m=[]}=t,g=[...m,...u],w=g.find(D=>D.key==="BLOCKLET_APP_DESCRIPTION"),p=g.find(D=>D.key==="BLOCKLET_PASSPORT_COLOR"),y=g.find(D=>D.key==="BLOCKLET_APP_URL"),h=g.find(D=>D.key==="BLOCKLET_APP_TENANT_MODE"),{did:i,version:I}=t.meta,j=(0,Ds.getDisplayName)(t),k=(0,le.default)(w,"value",t.meta.description),o=(0,le.default)(p,"value","auto"),T=(0,le.default)(y,"value",""),d=(0,le.default)(h,"value","");if(!l)return{did:i,version:I,name:j,description:k,passportColor:o,appUrl:T,secret:"",wallet:null,permanentWallet:null,tenantMode:d};const n=g.find(D=>D.key==="BLOCKLET_APP_SK"),s=g.find(D=>D.key==="BLOCKLET_APP_CHAIN_TYPE")||g.find(D=>D.key==="BLOCKLET_WALLET_TYPE"),a=g.find(D=>D.key==="BLOCKLET_APP_PSK");let c;s&&(s.value==="ethereum"||s.value==="eth")&&(c=s.value);let x=null,v=null;if(n&&n.value)x=(0,xe.default)(n.value,void 0,c),a&&a.value&&a.value!==n.value&&(v=(0,xe.default)(a.value,void 0,c));else{if(!r||typeof r!="string")throw new Error("Node secret key must be a string");s?x=(0,xe.default)(t.meta.did,r,c):x=(0,xe.default)(t.meta.did,r)}const S=((A=(F=t.settings)==null?void 0:F.session)==null?void 0:A.salt)||"",U=Ts.Hasher.SHA3.hash256(jt.concat([x.secretKey,x.address,S].filter(Boolean).map(D=>jt.from(D))));return{did:i,version:I,name:j,description:k,passportColor:o,appUrl:T,secret:U,wallet:x,permanentWallet:v||x,tenantMode:d}};var Rs=As;const Ls=xn(Rs);function Ge({teamDid:t,roles:r,apps:l,onCancel:u,onSuccess:m,onError:g,endpoint:w}){var T;const{api:p}=H(),{t:y,locale:h}=V(),i=Ve({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:l.length>0?l[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),I=async()=>{if(!i.role){i.error=y("team.member.error.passportEmpty");return}const d=i.remark.trim();i.error=null,i.loading=!0;try{let n=i.sourceAppPid??null;n===t&&(n=null);const s={teamDid:t,role:i.role,remark:d,sourceAppPid:n,passportExpireTime:i.passportExpireTime?i.passportExpireTime.toISOString():""};i.display&&(s.display={type:"url",content:i.display});const{inviteInfo:a}=await p.createMemberInvitation({input:s});i.inviteInfo=a,i.activeStep=1}catch(n){const s=J(n);i.error=s,g(n)}finally{i.loading=!1}},j=r.find(d=>d.name===i.role),o=[{body:e.jsxs(E,{sx:{display:"flex",flexDirection:"column",gap:3},children:[l.length>1?e.jsxs(Ue,{fullWidth:!0,children:[e.jsx(Be,{children:y("common.sourceApp")}),e.jsx(Fe,{value:i.sourceAppPid,onChange:d=>{i.error=null,i.sourceAppPid=d.target.value},fullWidth:!0,label:y("common.passport"),disabled:i.loading,children:l.map(d=>e.jsx(be,{value:d.appPid,children:e.jsxs(E,{sx:{display:"flex",justifyContent:"space-between",gap:2,width:"100%"},children:[e.jsxs(E,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(En,{did:d.appPid,size:28}),d.appName]}),e.jsx(On,{did:d.appPid,compact:!0,responsive:!1})]})},d.appPid))})]}):null,e.jsxs(Ue,{fullWidth:!0,variant:"outlined",children:[e.jsx(Be,{children:y("common.passport")}),e.jsx(Fe,{"data-cy":"invite-member-select-role",value:i.role,onChange:d=>{i.error=null,i.role=d.target.value},fullWidth:!0,label:y("common.passport"),disabled:i.loading,onKeyPress:d=>{d.key==="Enter"&&(d.preventDefault(),I())},children:r.filter(d=>d.name!=="owner").map(d=>e.jsx(be,{value:d.name,"data-cy":`invite-member-select-option-${d.name}`,children:e.jsxs(E,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(Z,{variant:"subtitle1",children:d.title||d.name}),e.jsx(Z,{variant:"caption",sx:{opacity:.7},children:d.description})]})},d.name))})]}),((T=j==null?void 0:j.extra)==null?void 0:T.display)==="custom"&&e.jsx(de,{label:y("common.display"),type:"url",value:i.display,onChange:d=>{i.error=null,i.display=d.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(de,{label:y("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.remark,onChange:d=>{i.error=null,i.remark=d.target.value},disabled:i.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Vt,{value:i.passportExpireTime,onChange:d=>{i.passportExpireTime=d}})]}),cancel:y("common.cancel"),confirm:y("team.member.inviteDialog.createInviteLink"),onCancel:u,onConfirm:I},{body:()=>{var n,s;const d=qe({inviteId:(n=i.inviteInfo)==null?void 0:n.inviteId,endpoint:w});return e.jsxs("div",{children:[e.jsx(E,{sx:{fontSize:16,fontWeight:"bold"},children:y("team.member.inviteDialog.createSuccessTip",{expireDate:me((s=i.inviteInfo)==null?void 0:s.expireDate,h)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(ke,{children:d})]})},confirm:y("common.confirm"),onConfirm:m}][i.activeStep];return e.jsxs(te,{title:y("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[o.cancel&&e.jsx(M,{onClick:o.onCancel,color:"inherit",children:o.cancel}),e.jsxs(M,{onClick:o.onConfirm,color:"primary",disabled:i.loading||!i.role,variant:"contained",autoFocus:!0,children:[i.loading&&e.jsx(oe,{size:16}),o.confirm]})]}),children:[e.jsx(ze,{component:"div",children:typeof o.body=="function"?o.body():o.body}),!!i.error&&e.jsx(re,{severity:"error",variant:"icon",children:i.error})]})}Ge.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,roles:b.array,apps:b.array,endpoint:b.string};Ge.defaultProps={onError:()=>{},roles:[],apps:[],endpoint:""};function Xe({teamDid:t,onCancel:r,onSuccess:l,onError:u,endpoint:m}){const{api:g,info:w}=H(),{api:p}=P.useContext(Nn),[y,h]=P.useState(!1),{t:i,locale:I}=V(),[j,k]=P.useState(""),[o,T]=P.useState(!1),[d,n]=P.useState(0),[s,a]=P.useState(""),[c,x]=P.useState(""),v=!!$e(w,"ownerNft.did"),S=os(async()=>{if(v){const{state:R}=await g.getDelegationState();return R}return{delegated:!0}});if(S.loading)return e.jsx(te,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:r,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(oe,{})})});if(S.error)return e.jsx(te,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:r,children:e.jsx(re,{severity:"error",variant:"icon",children:J(S.error)})});const U=async()=>{k(null),h(!0);try{const{inviteInfo:R}=await g.createTransferInvitation({input:{teamDid:t,role:"owner",remark:c.trim()}});a(R),n(D.length-1)}catch(R){const W=J(R);k(W),u(R)}finally{h(!1)}},F=()=>{T(!0),n(1)},A=()=>{T(!1),n(0)},D=[{body:e.jsxs(Z,{component:"div",children:[e.jsxs(re,{severity:"warning",children:[e.jsx(Z,{children:i("team.transferNode.inviteDialog.tips.progress")}),e.jsx(Z,{children:i("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(re,{severity:"warning",children:e.jsx(Z,{children:i("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(de,{label:i("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:c,onChange:R=>{k(null),x(R.target.value)},disabled:y,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:i("common.cancel"),confirm:i("team.transferNode.inviteDialog.createInviteLink"),onCancel:r,onConfirm:v&&!$e(S,"value.delegated")?F:U},{body:()=>e.jsx(_n,{action:"delegate-transfer-nft",open:o,locale:I,checkFn:p.get,onClose:A,onSuccess:U,checkTimeout:5*60*1e3,webWalletUrl:Qn(w),extraParams:{targetDID:w.did},messages:{title:i("team.transferNode.delegateDialog.title"),scan:i("team.transferNode.delegateDialog.scan"),confirm:i("team.transferNode.delegateDialog.confirm"),success:i("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const R=qe({inviteId:s.inviteId,endpoint:m});return e.jsxs("div",{children:[e.jsx(Es,{children:i("team.transferNode.inviteDialog.createSuccessTip",{expireDate:me(s.expireDate,I)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(ke,{children:R})]})},confirm:i("common.confirm"),onConfirm:l}],O=D[d];return e.jsxs(te,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[O.cancel&&e.jsx(M,{onClick:O.onCancel,color:"inherit",children:O.cancel}),e.jsxs(M,{onClick:O.onConfirm,color:"primary",disabled:y,variant:"contained",autoFocus:!0,children:[y&&e.jsx(oe,{size:16}),O.confirm]})]}),children:[e.jsx(ze,{component:"div",children:typeof O.body=="function"?O.body():O.body}),!!j&&e.jsx(re,{severity:"error",variant:"icon",children:j})]})}Xe.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,endpoint:b.string};Xe.defaultProps={onError:()=>{},endpoint:""};const Es=z.div`
2
2
  font-size: 16px;
3
3
  font-weight: bold;
4
4
  `;var Je=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.88619 1.875C5.0541 1.875 4.24071 2.12174 3.54885 2.58402C2.857 3.0463 2.31777 3.70336 1.99934 4.47211C1.68092 5.24085 1.5976 6.08676 1.75994 6.90285C1.92227 7.71895 2.32295 8.46858 2.91133 9.05695C3.4997 9.64532 4.24933 10.046 5.06543 10.2083C5.88152 10.3707 6.72743 10.2874 7.49617 9.96893C8.26492 9.65051 8.92198 9.11128 9.38426 8.41942C9.84654 7.72757 10.0933 6.91417 10.0933 6.08209C10.0933 4.9663 9.65003 3.89621 8.86105 3.10723C8.07207 2.31825 7.00198 1.875 5.88619 1.875ZM4.11182 4.30773C4.58242 3.83714 5.22067 3.57276 5.88619 3.57276C6.38249 3.57276 6.86764 3.71993 7.2803 3.99566C7.69295 4.27139 8.01458 4.66329 8.20451 5.12181C8.39443 5.58033 8.44413 6.08487 8.3473 6.57164C8.25048 7.0584 8.01149 7.50552 7.66055 7.85645C7.30962 8.20739 6.8625 8.44638 6.37574 8.5432C5.88897 8.64003 5.38443 8.59033 4.92591 8.40041C4.46739 8.21048 4.07549 7.88885 3.79976 7.4762C3.52403 7.06354 3.37686 6.57839 3.37686 6.08209C3.37686 5.41657 3.64123 4.77832 4.11182 4.30773ZM4.20709 10.8302C3.0913 10.8302 2.02121 11.2735 1.23223 12.0624C0.443246 12.8514 0 13.9215 0 15.0373V17.8358C0 17.9955 0.12947 18.125 0.289179 18.125H1.40858C1.56829 18.125 1.69776 17.9955 1.69776 17.8358V15.0373C1.69776 14.3718 1.96214 13.7335 2.43273 13.2629C2.90332 12.7924 3.54157 12.528 4.20709 12.528H7.5653C7.89483 12.528 8.22113 12.5929 8.52558 12.719C8.83002 12.8451 9.10665 13.0299 9.33966 13.2629C9.57267 13.496 9.75751 13.7726 9.88361 14.077C10.0097 14.3815 10.0746 14.7078 10.0746 15.0373V17.8358C10.0746 17.9955 10.2041 18.125 10.3638 18.125H11.4832C11.6429 18.125 11.7724 17.9955 11.7724 17.8358V15.0373C11.7724 13.9215 11.3291 12.8514 10.5402 12.0624C9.75118 11.2735 8.68109 10.8302 7.5653 10.8302H4.20709Z"}),e.jsx("rect",{x:"12.5",y:"9.375",width:"7.5",height:"1.875",rx:"0.9375"})]})};Je.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};Je.displayName="forbid-login";const Jt=Je;var et=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.88619 1.875C5.0541 1.875 4.24071 2.12174 3.54885 2.58402C2.857 3.0463 2.31777 3.70336 1.99934 4.47211C1.68092 5.24085 1.5976 6.08676 1.75994 6.90285C1.92227 7.71895 2.32295 8.46858 2.91133 9.05695C3.4997 9.64532 4.24933 10.046 5.06543 10.2083C5.88152 10.3707 6.72743 10.2874 7.49617 9.96893C8.26492 9.65051 8.92198 9.11128 9.38426 8.41942C9.84654 7.72757 10.0933 6.91417 10.0933 6.08209C10.0933 4.9663 9.65003 3.89621 8.86105 3.10723C8.07207 2.31825 7.00198 1.875 5.88619 1.875ZM4.11182 4.30773C4.58242 3.83714 5.22067 3.57276 5.88619 3.57276C6.38249 3.57276 6.86764 3.71993 7.2803 3.99566C7.69295 4.27139 8.01458 4.66329 8.20451 5.12181C8.39443 5.58033 8.44413 6.08487 8.3473 6.57164C8.25048 7.0584 8.01149 7.50552 7.66055 7.85645C7.30962 8.20739 6.8625 8.44638 6.37574 8.5432C5.88897 8.64003 5.38443 8.59033 4.92591 8.40041C4.46739 8.21048 4.07549 7.88885 3.79976 7.4762C3.52403 7.06354 3.37686 6.57839 3.37686 6.08209C3.37686 5.41657 3.64123 4.77832 4.11182 4.30773ZM4.20709 10.8302C3.0913 10.8302 2.02121 11.2735 1.23223 12.0624C0.443246 12.8514 0 13.9215 0 15.0373V17.8358C0 17.9955 0.12947 18.125 0.289179 18.125H1.40858C1.56829 18.125 1.69776 17.9955 1.69776 17.8358V15.0373C1.69776 14.3718 1.96214 13.7335 2.43273 13.2629C2.90332 12.7924 3.54157 12.528 4.20709 12.528H7.5653C7.89483 12.528 8.22113 12.5929 8.52558 12.719C8.83002 12.8451 9.10665 13.0299 9.33966 13.2629C9.57267 13.496 9.75751 13.7726 9.88361 14.077C10.0097 14.3815 10.0746 14.7078 10.0746 15.0373V17.8358C10.0746 17.9955 10.2041 18.125 10.3638 18.125H11.4832C11.6429 18.125 11.7724 17.9955 11.7724 17.8358V15.0373C11.7724 13.9215 11.3291 12.8514 10.5402 12.0624C9.75118 11.2735 8.68109 10.8302 7.5653 10.8302H4.20709Z"}),e.jsx("rect",{x:"12.5",y:"9.375",width:"7.5",height:"1.875",rx:"0.9375"}),e.jsx("rect",{x:"15.3125",y:"14.0625",width:"7.5",height:"1.875",rx:"0.9375",transform:"rotate(-90 15.3125 14.0625)"})]})};et.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};et.displayName="allow-login";const en=et;function we(t){const{passport:r,onDelete:l,...u}=t;return e.jsxs(Os,{...u,children:[r.title||r.name," ",!!l&&e.jsx(Un,{"data-cy":"delete-issuance",className:"delete",onClick:l})]})}we.propTypes={passport:b.object.isRequired,onDelete:b.func};we.defaultProps={onDelete:null};const Os=z.span`
@@ -1,4 +1,4 @@
1
- import{r as b}from"./vendor-react-DEoibe3W.js";import{a as D,V as R,j as ie,B as L,b1 as be,ak as pe,bM as re,Y as je,az as Ce,bt as ke,c2 as Ke,b3 as ve,a5 as Te,_ as Ae}from"./vendor-ux-did-connect-Qap4yrMu.js";import{d as we}from"./Edit-Cl3SK-FJ.js";import{f as Se}from"./index-8eXqqyHQ.js";import{r as me}from"./passport-item-C7W2OqHa.js";import{A as B,l as M,aJ as De,D as Ie,f as Re}from"./index-BzItMezw.js";import{u as $}from"./dashboard-BwU59vns.js";import{j as e,H as x,bo as O,br as V,bn as H,q as G,aa as f,al as Q,O as E,ab as Be,bs as $e,bR as _e,ah as P,T as N,ad as ce,ak as Ne}from"./vendor-mui-core-Bh-qMRq3.js";import{O as Pe,a0 as Ue}from"./vendor-arcblock-C99E80cF.js";import{T as ue}from"./index-C61DBznM.js";import{C as xe}from"./confirm-hm6dpNbC.js";import{a0 as We}from"./vendor-utils-rHXShPKm.js";import{C as F}from"./click-to-copy-ClNoTzk4.js";import{D as qe}from"./delete-confirm-BRkmB2tO.js";import{P as ze}from"./permission-KYy-A4oZ.js";import{l as Le,y as Me}from"./vendor-hooks-DpwFseeF.js";import{U as Ee,C as Fe,I as Oe}from"./index-sAnn-Wqb.js";import{B as Ve}from"./bundle-avatar-BoczFLNt.js";import{p as He}from"./util-DMDaTiE0.js";import{W as le}from"./did-address-Ddg6Is1P.js";import{A as Ge}from"./actions-B2RmHKJh.js";import{u as Qe}from"./use-mobile-JEGQfLZ2.js";import{T as de}from"./table-tips-DnNYXRDB.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BFO9aBYY.js";import"./PlayArrow-B19IPFeo.js";import"./get-safe-url-XcLmS0yc.js";import"./session-CSqVp1zS.js";import"./use-blocklet-logo-2Y2A06qi.js";import"./InfoOutlined-BGorl_CI.js";import"./dot-CdVWOAIG.js";import"./useAsync-JBeeXlrl.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-ZAS6Si4t.js";import"./vendor-mui-x-CQTjfcpn.js";import"./AdapterDayjs-D2uo6EnV.js";import"./Phone--BSu-btI.js";import"./Location-By12Z3Te.js";import"./Email-CdSNK0eA.js";import"./Timezone-YZ0dMUEr.js";import"./base32-B42OVABo.js";import"./MoreHoriz-Bncapj_R.js";function J({value:t}){const{t:s,locale:m}=D(),l=new Date;return new Date(t)<l?e.jsxs("span",{style:{color:"red"},children:[e.jsx(R,{value:t,locale:m}),`${s("setting.accessKey.expired",{time:""})}`]}):e.jsx(R,{value:t,locale:m,type:"all"})}J.propTypes={value:x.string.isRequired};function Y({value:t,onChange:s,...m}){const{t:l}=D(),d=b.useMemo(()=>[{value:"signature",title:l("setting.accessKey.signature"),description:l("setting.accessKey.signatureDesc")},{value:"simple",title:l("setting.accessKey.simple"),description:l("setting.accessKey.simpleDesc")}],[l]);return e.jsxs(O,{style:{width:"100%"},variant:"outlined",...m,children:[e.jsx(V,{children:l("setting.accessKey.authType")}),e.jsx(H,{value:t,onChange:s,fullWidth:!0,label:l("setting.accessKey.authType"),children:d.map(o=>e.jsx(G,{value:o.value,children:e.jsxs(f,{children:[e.jsx("span",{children:o.title}),e.jsx(f,{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal",children:o.description})]})},o.value))})]})}Y.propTypes={value:x.string.isRequired,onChange:x.func.isRequired};const W=()=>{const t=ie.RBAC_CONFIG.roles.filter(d=>d.passport),{inService:s}=B(),{roles:m}=$(),l=[...t,...s?m:[]];return We(l,"name").filter(d=>d.name!==ie.ROLES.OWNER)};function X(t){const{remark:s,onCreate:m}=t,{api:l}=B(),{teamDid:d}=$(),{t:o}=D(),[k,j]=b.useState(!1),[c,h]=b.useState(null),y=W(),T=()=>{j(!1),h(null)},K=async a=>{const{remark:v,passport:r,authType:n}=a;j(!0);const u=await l.createAccessKey({input:{teamDid:d,remark:v.trim(),passport:r,expireAt:a.expireAt?new Date(a.expireAt).getTime():null,authType:n}}),{data:S}=u;m(S),h(null),j(!1)},g={title:`${o("common.create")} ${o("accessKey")}`,description:(a,v,r)=>e.jsxs(Q,{gap:3,children:[e.jsx(E,{label:o("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:a.remark,onChange:n=>{v({...a,remark:n.target.value,__disableConfirm:!a.passport||!n.target.value.trim()}),n.target.value.trim()?r(""):r(o("setting.accessKey.remarkInvalid"))}}),e.jsxs(O,{style:{width:"100%"},variant:"outlined",children:[e.jsx(V,{children:o("setting.accessKey.passport")}),e.jsx(H,{"data-cy":"create-access-key-select-passport",value:a.passport,onChange:n=>{const u=n.target.value;r(null),v({...a,passport:u,__disableConfirm:!a.remark||!u})},fullWidth:!0,label:o("setting.accessKey.passport"),disabled:k,children:y.map(n=>e.jsx(G,{value:n.name,"data-cy":`create-access-key-passport-option-${n.name}`,children:e.jsxs(f,{children:[e.jsx("span",{children:n.title||n.name}),e.jsx(f,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:n.description})]})},n.name))})]}),e.jsx(Y,{value:a.authType,onChange:n=>{v({...a,authType:n.target.value})}}),e.jsx(ue,{placeholder:o("setting.accessKey.expireTime"),value:a.expireAt,onChange:n=>{v({...a,expireAt:n,__disableConfirm:!a.passport||!a.remark||!n})}})]}),confirm:o("common.confirm"),cancel:o("common.cancel"),color:"primary",params:{remark:s,authType:"signature",__disableConfirm:!s.trim()},onConfirm:K,onCancel:T};return e.jsxs(e.Fragment,{children:[e.jsxs(L,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>h(g),className:"rule-action",children:[k?e.jsx(Be,{size:16}):e.jsx(Pe,{style:{fontSize:16}}),o("common.create")]}),c&&e.jsx(xe,{title:c.title,description:c.description,confirm:c.confirm,color:c.color,cancel:c.cancel,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}X.propTypes={remark:x.string,onCreate:x.func};X.defaultProps={onCreate:()=>{},remark:""};function Z(t){const{onConfirm:s,accessKeyId:m,accessKeySecret:l,hideSecret:d}=t,{t:o}=b.useContext(be),[k,j]=b.useState(!1),[c,h]=b.useState(()=>d),y=()=>{h(!c)},T=a=>{j(a.target.checked)},K=b.useMemo(()=>{var a;return d?`const Client = require('@abtnode/client');
1
+ import{r as b}from"./vendor-react-DEoibe3W.js";import{a as D,V as R,j as ie,B as L,b1 as be,ak as pe,bM as re,Y as je,az as Ce,bt as ke,c2 as Ke,b3 as ve,a5 as Te,_ as Ae}from"./vendor-ux-did-connect-D0L9YnHn.js";import{d as we}from"./Edit-Bj4m2hpD.js";import{f as Se}from"./index-8eXqqyHQ.js";import{r as me}from"./passport-item-NMGbWwTG.js";import{A as B,l as M,aJ as De,D as Ie,f as Re}from"./index-YuW8IExe.js";import{u as $}from"./dashboard-B_QqB4aw.js";import{j as e,H as x,bo as O,br as V,bn as H,q as G,aa as f,al as Q,O as E,ab as Be,bs as $e,bR as _e,ah as P,T as N,ad as ce,ak as Ne}from"./vendor-mui-core-Bh-qMRq3.js";import{O as Pe,a0 as Ue}from"./vendor-arcblock-Ca95GLVH.js";import{T as ue}from"./index-CleFkLt8.js";import{C as xe}from"./confirm-DaR0Yx39.js";import{a0 as We}from"./vendor-utils-rHXShPKm.js";import{C as F}from"./click-to-copy-DtGgy9Ua.js";import{D as qe}from"./delete-confirm-DHB0S_Co.js";import{P as ze}from"./permission-BfddnDBs.js";import{l as Le,y as Me}from"./vendor-hooks-DpwFseeF.js";import{U as Ee,C as Fe,I as Oe}from"./index-c0hdujdn.js";import{B as Ve}from"./bundle-avatar-D7QQIJpo.js";import{p as He}from"./util-CiTimo-i.js";import{W as le}from"./did-address-mv0Qw7hC.js";import{A as Ge}from"./actions-BWSNMC_c.js";import{u as Qe}from"./use-mobile-ZAS6Si4t.js";import{T as de}from"./table-tips-nPiIcvAy.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-DotMjDUB.js";import"./PlayArrow-BHO_DqT2.js";import"./get-safe-url-DYtntqqo.js";import"./session-DUt5rVEy.js";import"./use-blocklet-logo-3VH4RBTr.js";import"./InfoOutlined-uoMMChNE.js";import"./dot-D3X4DSlo.js";import"./useAsync-CDjYBiwf.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-JEGQfLZ2.js";import"./vendor-mui-x-CQTjfcpn.js";import"./AdapterDayjs-Bck9Dv3l.js";import"./Phone--BSu-btI.js";import"./Location-By12Z3Te.js";import"./Email-CdSNK0eA.js";import"./Timezone-YZ0dMUEr.js";import"./base32-BnPQ4q4v.js";import"./MoreHoriz-3SNxR36h.js";function J({value:t}){const{t:s,locale:m}=D(),l=new Date;return new Date(t)<l?e.jsxs("span",{style:{color:"red"},children:[e.jsx(R,{value:t,locale:m}),`${s("setting.accessKey.expired",{time:""})}`]}):e.jsx(R,{value:t,locale:m,type:"all"})}J.propTypes={value:x.string.isRequired};function Y({value:t,onChange:s,...m}){const{t:l}=D(),d=b.useMemo(()=>[{value:"signature",title:l("setting.accessKey.signature"),description:l("setting.accessKey.signatureDesc")},{value:"simple",title:l("setting.accessKey.simple"),description:l("setting.accessKey.simpleDesc")}],[l]);return e.jsxs(O,{style:{width:"100%"},variant:"outlined",...m,children:[e.jsx(V,{children:l("setting.accessKey.authType")}),e.jsx(H,{value:t,onChange:s,fullWidth:!0,label:l("setting.accessKey.authType"),children:d.map(o=>e.jsx(G,{value:o.value,children:e.jsxs(f,{children:[e.jsx("span",{children:o.title}),e.jsx(f,{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal",children:o.description})]})},o.value))})]})}Y.propTypes={value:x.string.isRequired,onChange:x.func.isRequired};const W=()=>{const t=ie.RBAC_CONFIG.roles.filter(d=>d.passport),{inService:s}=B(),{roles:m}=$(),l=[...t,...s?m:[]];return We(l,"name").filter(d=>d.name!==ie.ROLES.OWNER)};function X(t){const{remark:s,onCreate:m}=t,{api:l}=B(),{teamDid:d}=$(),{t:o}=D(),[k,j]=b.useState(!1),[c,h]=b.useState(null),y=W(),T=()=>{j(!1),h(null)},K=async a=>{const{remark:v,passport:r,authType:n}=a;j(!0);const u=await l.createAccessKey({input:{teamDid:d,remark:v.trim(),passport:r,expireAt:a.expireAt?new Date(a.expireAt).getTime():null,authType:n}}),{data:S}=u;m(S),h(null),j(!1)},g={title:`${o("common.create")} ${o("accessKey")}`,description:(a,v,r)=>e.jsxs(Q,{gap:3,children:[e.jsx(E,{label:o("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:a.remark,onChange:n=>{v({...a,remark:n.target.value,__disableConfirm:!a.passport||!n.target.value.trim()}),n.target.value.trim()?r(""):r(o("setting.accessKey.remarkInvalid"))}}),e.jsxs(O,{style:{width:"100%"},variant:"outlined",children:[e.jsx(V,{children:o("setting.accessKey.passport")}),e.jsx(H,{"data-cy":"create-access-key-select-passport",value:a.passport,onChange:n=>{const u=n.target.value;r(null),v({...a,passport:u,__disableConfirm:!a.remark||!u})},fullWidth:!0,label:o("setting.accessKey.passport"),disabled:k,children:y.map(n=>e.jsx(G,{value:n.name,"data-cy":`create-access-key-passport-option-${n.name}`,children:e.jsxs(f,{children:[e.jsx("span",{children:n.title||n.name}),e.jsx(f,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:n.description})]})},n.name))})]}),e.jsx(Y,{value:a.authType,onChange:n=>{v({...a,authType:n.target.value})}}),e.jsx(ue,{placeholder:o("setting.accessKey.expireTime"),value:a.expireAt,onChange:n=>{v({...a,expireAt:n,__disableConfirm:!a.passport||!a.remark||!n})}})]}),confirm:o("common.confirm"),cancel:o("common.cancel"),color:"primary",params:{remark:s,authType:"signature",__disableConfirm:!s.trim()},onConfirm:K,onCancel:T};return e.jsxs(e.Fragment,{children:[e.jsxs(L,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>h(g),className:"rule-action",children:[k?e.jsx(Be,{size:16}):e.jsx(Pe,{style:{fontSize:16}}),o("common.create")]}),c&&e.jsx(xe,{title:c.title,description:c.description,confirm:c.confirm,color:c.color,cancel:c.cancel,params:c.params,onConfirm:c.onConfirm,onCancel:c.onCancel})]})}X.propTypes={remark:x.string,onCreate:x.func};X.defaultProps={onCreate:()=>{},remark:""};function Z(t){const{onConfirm:s,accessKeyId:m,accessKeySecret:l,hideSecret:d}=t,{t:o}=b.useContext(be),[k,j]=b.useState(!1),[c,h]=b.useState(()=>d),y=()=>{h(!c)},T=a=>{j(a.target.checked)},K=b.useMemo(()=>{var a;return d?`const Client = require('@abtnode/client');
2
2
 
3
3
  const client = new Client(fullEndpoint);
4
4
  client.setAuthAccessKey({
@@ -1,4 +1,4 @@
1
- import{r as u}from"./vendor-react-DEoibe3W.js";import{H as o,j as e,aa as b,b3 as A,O as K,c1 as B,I as O,ab as M,ah as W}from"./vendor-mui-core-Bh-qMRq3.js";import{b1 as X,aM as $,d as H}from"./vendor-ux-did-connect-Qap4yrMu.js";import{d as G}from"./Done-DboXobnH.js";import{A as U,a as Y,d as J,b as Q}from"./collapse-Dz_izL9k.js";import{C as Z}from"./Google-Bl_7h7C7.js";import{ab as v,f as ee}from"./index-BzItMezw.js";import{R as ne,F as te,L as re}from"./logo-uploader-BNZB1sug.js";const S={description:o.string,editing:o.bool,onChange:o.func,required:o.bool,value:o.any,componentProps:o.object,render:o.func,renderFormItem:o.func};function T({editing:n,value:s,onChange:i}){const[a,d]=u.useState(!1),f=u.useRef(),m=u.useRef(s);u.useEffect(()=>{let l=null;return n&&(l=setTimeout(()=>{d(!0)},50)),()=>{clearTimeout(l)}},[n]);const x=l=>{m.current=l,i(l)},j=()=>{d(!1),i(m.current)},y=e.jsx(b,{className:"form-item-input slot",px:1,children:e.jsxs(b,{display:"flex",alignItems:"center",children:[s,s!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:s,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),p=e.jsxs(b,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:j,children:[e.jsx(b,{display:"flex",alignItems:"center",onClick:()=>d(!0),children:e.jsx("div",{ref:f,style:{flexShrink:0,marginLeft:"8px",backgroundColor:s,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:s==="auto"?"default":"pointer"}})}),e.jsx(A,{open:a,anchorEl:f.current,onClose:()=>d(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(Z,{color:s,onChange:l=>x(l.hex)})})]});return n?p:y}T.propTypes=S;function _({editing:n,description:s,value:i,onChange:a,componentProps:d,...f}){const{placeholder:m}=d,x=u.useRef(i),{t:j}=u.useContext(X),y=l=>{l.key==="Enter"&&a(x.current,"confirm")},p=l=>{x.current=l,a(l)};return n?e.jsx(K,{style:{flex:1},fullWidth:!0,value:i,onChange:l=>{l.persist(),p(l.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:s||m,onKeyDown:y,...f}):e.jsx(b,{px:1,className:"form-item-input slot",children:i||e.jsx("span",{className:"placeholder",children:j("common.requiredInputPlaceholder",{name:s||m})})})}_.propTypes=S;_.defaultProps={componentProps:{}};function D({editing:n,value:s,onChange:i,componentProps:a,...d}){const{blocklet:f}=a,m=s==="auto"?$.getPassportColorFromDid(f.appDid):s;return e.jsxs(b,{display:"flex",alignItems:"center",children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:v({title:"Owner",issuer:ee.getDisplayName(f),issuerDid:f.appDid,ownerName:"Your Name",ownerDid:f.appDid,preferredColor:s||"auto"})}}),e.jsx(T,{...d,editing:n,value:n?m:s,onChange:i,componentProps:a})]})}D.propTypes={...S,componentProps:o.shape({blocklet:o.object.isRequired}).isRequired};D.defaultProps={};const oe=B`
1
+ import{r as u}from"./vendor-react-DEoibe3W.js";import{H as o,j as e,aa as b,b3 as A,O as K,c1 as B,I as O,ab as M,ah as W}from"./vendor-mui-core-Bh-qMRq3.js";import{b1 as X,aM as $,d as H}from"./vendor-ux-did-connect-D0L9YnHn.js";import{d as G}from"./Done-UEZFWnHj.js";import{A as U,a as Y,d as J,b as Q}from"./collapse-iOiHn4dy.js";import{C as Z}from"./Google-BON6upKi.js";import{ab as v,f as ee}from"./index-YuW8IExe.js";import{R as ne,F as te,L as re}from"./logo-uploader-DtAT8iaJ.js";const S={description:o.string,editing:o.bool,onChange:o.func,required:o.bool,value:o.any,componentProps:o.object,render:o.func,renderFormItem:o.func};function T({editing:n,value:s,onChange:i}){const[a,d]=u.useState(!1),f=u.useRef(),m=u.useRef(s);u.useEffect(()=>{let l=null;return n&&(l=setTimeout(()=>{d(!0)},50)),()=>{clearTimeout(l)}},[n]);const x=l=>{m.current=l,i(l)},j=()=>{d(!1),i(m.current)},y=e.jsx(b,{className:"form-item-input slot",px:1,children:e.jsxs(b,{display:"flex",alignItems:"center",children:[s,s!=="auto"&&e.jsx("div",{style:{marginLeft:4,backgroundColor:s,width:"1em",height:"1em",borderRadius:"0.2em"}})]})}),p=e.jsxs(b,{display:"flex",flexGrow:1,alignItems:"center",height:"40px",onKeyDown:j,children:[e.jsx(b,{display:"flex",alignItems:"center",onClick:()=>d(!0),children:e.jsx("div",{ref:f,style:{flexShrink:0,marginLeft:"8px",backgroundColor:s,width:"32px",height:"32px",boxSizing:"border-box",borderRadius:"8px",border:"1px solid #eee",cursor:s==="auto"?"default":"pointer"}})}),e.jsx(A,{open:a,anchorEl:f.current,onClose:()=>d(!1),anchorOrigin:{vertical:"bottom",horizontal:"center"},transformOrigin:{vertical:"top",horizontal:"center"},children:e.jsx(Z,{color:s,onChange:l=>x(l.hex)})})]});return n?p:y}T.propTypes=S;function _({editing:n,description:s,value:i,onChange:a,componentProps:d,...f}){const{placeholder:m}=d,x=u.useRef(i),{t:j}=u.useContext(X),y=l=>{l.key==="Enter"&&a(x.current,"confirm")},p=l=>{x.current=l,a(l)};return n?e.jsx(K,{style:{flex:1},fullWidth:!0,value:i,onChange:l=>{l.persist(),p(l.target.value)},autoFocus:!0,size:"small",variant:"outlined",placeholder:s||m,onKeyDown:y,...f}):e.jsx(b,{px:1,className:"form-item-input slot",children:i||e.jsx("span",{className:"placeholder",children:j("common.requiredInputPlaceholder",{name:s||m})})})}_.propTypes=S;_.defaultProps={componentProps:{}};function D({editing:n,value:s,onChange:i,componentProps:a,...d}){const{blocklet:f}=a,m=s==="auto"?$.getPassportColorFromDid(f.appDid):s;return e.jsxs(b,{display:"flex",alignItems:"center",children:[e.jsx("div",{style:{width:96,marginRight:12},dangerouslySetInnerHTML:{__html:v({title:"Owner",issuer:ee.getDisplayName(f),issuerDid:f.appDid,ownerName:"Your Name",ownerDid:f.appDid,preferredColor:s||"auto"})}}),e.jsx(T,{...d,editing:n,value:n?m:s,onChange:i,componentProps:a})]})}D.propTypes={...S,componentProps:o.shape({blocklet:o.object.isRequired}).isRequired};D.defaultProps={};const oe=B`
2
2
  0%, 100% {
3
3
  transform: scale(1) translateX(0);
4
4
  }