@abtnode/blocklet-services 1.16.53-beta-20251014-110009-8220e324 → 1.16.54-beta-20251016-050817-2fc632b8

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 (125) hide show
  1. package/api/routes/access-key.js +10 -4
  2. package/dist/assets/{access-control-tkXiKu_B.js → access-control-C5AwSG3T.js} +1 -1
  3. package/dist/assets/{add-component-core-DZewqmQf.js → add-component-core-CrZWbFmf.js} +1 -1
  4. package/dist/assets/{add-resource-CFOC6fO8.js → add-resource-Brh4F6D2.js} +1 -1
  5. package/dist/assets/{addon-CAEOt-oM.js → addon-DMW6BcQH.js} +1 -1
  6. package/dist/assets/{advanced-BsPW8tKj.js → advanced-ykwSXzlQ.js} +1 -1
  7. package/dist/assets/{aigne-C6-afA57.js → aigne-DmDL-WLj.js} +1 -1
  8. package/dist/assets/{appearance-BZqg7Kkn.js → appearance-CwaUUdyp.js} +1 -1
  9. package/dist/assets/{arrow-down.svg-zOZF6XLO.js → arrow-down.svg-D3B8bxxx.js} +1 -1
  10. package/dist/assets/{audit-logs-aCVF7lhB.js → audit-logs-eJR1v94e.js} +1 -1
  11. package/dist/assets/{authorize-QCoPxe3U.js → authorize-CmneXxos.js} +1 -1
  12. package/dist/assets/{bind-account-C8pbYbtP.js → bind-account-B_UMGXib.js} +1 -1
  13. package/dist/assets/{branding-BxYz3fG3.js → branding-B_eCdYJK.js} +1 -1
  14. package/dist/assets/{branding-r2VAPR6q.js → branding-CHRz3wuZ.js} +1 -1
  15. package/dist/assets/{branding-CKEfz45I.js → branding-DETOdgiW.js} +1 -1
  16. package/dist/assets/{bundle-avatar-CRBdm-Kg.js → bundle-avatar-BFaxogKz.js} +1 -1
  17. package/dist/assets/{complete-B1ERhNgz.js → complete-Bqi3d0V1.js} +1 -1
  18. package/dist/assets/{component-D1imN4b5.js → component-CSPqPsOF.js} +2 -2
  19. package/dist/assets/{config-D9yLBkGc.js → config-BHZS65kz.js} +1 -1
  20. package/dist/assets/{config-dGkFpD36.js → config-BWSyA18z.js} +1 -1
  21. package/dist/assets/{config-CRH_AVvL.js → config-CPdtVTio.js} +1 -1
  22. package/dist/assets/{config-navigation-CkwpaFE2.js → config-navigation-BFsrGucq.js} +2 -2
  23. package/dist/assets/{config-space-DEqVeU5w.js → config-space-CSl6D7xo.js} +1 -1
  24. package/dist/assets/{confirm-DAMhAYR3.js → confirm-CEAKWDZJ.js} +1 -1
  25. package/dist/assets/{connect-BHzZ3O8m.js → connect-BVXqic92.js} +1 -1
  26. package/dist/assets/{connect-VhC_tOjl.js → connect-FvriLilq.js} +1 -1
  27. package/dist/assets/{connect-to-CnrptX8a.js → connect-to-dZwJX0bt.js} +1 -1
  28. package/dist/assets/{dashboard-C6gjCAD6.js → dashboard-DyYLnek8.js} +2 -2
  29. package/dist/assets/{delete-confirm-Ca3miSFM.js → delete-confirm-DpKJ9gtf.js} +1 -1
  30. package/dist/assets/{domain-DZJxjNTq.js → domain-Bq75ZuOm.js} +1 -1
  31. package/dist/assets/{domain-action-card-CPmR-n-P.js → domain-action-card-CRdL2PFv.js} +1 -1
  32. package/dist/assets/{domains-DH3UyJ8c.js → domains-BiIZZN7p.js} +1 -1
  33. package/dist/assets/{email-dNTq-UZN.js → email-OlQWpbtF.js} +1 -1
  34. package/dist/assets/engine-B1U2TY7M.js +1 -0
  35. package/dist/assets/{exchange-passport-C-tUCCyK.js → exchange-passport-DK4-g9my.js} +1 -1
  36. package/dist/assets/{form-BIXDp48N.js → form-C5dLovtO.js} +1 -1
  37. package/dist/assets/{fuel-_yedTm2I.js → fuel-DkqmEB8D.js} +1 -1
  38. package/dist/assets/{gen-access-key-DXoAyhBv.js → gen-access-key-BnCg2Wu1.js} +1 -1
  39. package/dist/assets/{gen-simple-access-key-BPpzmXdv.js → gen-simple-access-key-zOQbFtZ8.js} +1 -1
  40. package/dist/assets/{get-safe-url-94yHUMyk.js → get-safe-url-3Xj-tgXY.js} +1 -1
  41. package/dist/assets/{home-CgfBIBYo.js → home-DTXdAvXT.js} +1 -1
  42. package/dist/assets/{iframe-D73zp9VN.js → iframe-DAoobOBi.js} +1 -1
  43. package/dist/assets/{index-CmM1Fb8I.js → index-3yzleS_1.js} +4 -4
  44. package/dist/assets/{index-CtjgKQvS.js → index-B6a6aopU.js} +1 -1
  45. package/dist/assets/{index-9GU1U3uC.js → index-BJrVQ6ch.js} +1 -1
  46. package/dist/assets/{index-CT7MCvWf.js → index-BdHbrnpK.js} +1 -1
  47. package/dist/assets/{index-CWoGXO4Z.js → index-Bgt2qHLn.js} +1 -1
  48. package/dist/assets/{index-CeTnfded.js → index-C80JxCSn.js} +1 -1
  49. package/dist/assets/{index-B07KPoAU.js → index-CDCcuLh3.js} +1 -1
  50. package/dist/assets/{index-Dl5NP6ym.js → index-CZp06HHE.js} +1 -1
  51. package/dist/assets/{index-DGuACYX4.js → index-Cr5RxnHu.js} +1 -1
  52. package/dist/assets/{index-BdlpB2eR.js → index-Cs_I9KFa.js} +1 -1
  53. package/dist/assets/{index-Bsziwsc_.js → index-D1thq8eN.js} +1 -1
  54. package/dist/assets/{index-M4Y_gFoP.js → index-D6Y3sCzN.js} +2 -2
  55. package/dist/assets/{index-erYyAW7o.js → index-D9QTZSnh.js} +1 -1
  56. package/dist/assets/{index-DhLGB_2p.js → index-DFceGCP0.js} +1 -1
  57. package/dist/assets/{index-D2x0prGU.js → index-DHQkab_n.js} +1 -1
  58. package/dist/assets/{index-BV58Bk4h.js → index-DJj8GmQS.js} +1 -1
  59. package/dist/assets/{index-DJwvNiRa.js → index-DNGdj2R4.js} +3 -3
  60. package/dist/assets/{index-BO_K5qp8.js → index-D_HqsEfj.js} +1 -1
  61. package/dist/assets/{index-Dvkly5_Y.js → index-D_s4QOu7.js} +1 -1
  62. package/dist/assets/{index-J-Fwoozx.js → index-D_vhPpT2.js} +1 -1
  63. package/dist/assets/{index-DACE9NO5.js → index-DeVDiUjo.js} +1 -1
  64. package/dist/assets/{index-CoEkDRkg.js → index-Dfmjh5-5.js} +1 -1
  65. package/dist/assets/{index-CSjGSZvb.js → index-LeqLm9hN.js} +1 -1
  66. package/dist/assets/{index-gu-JSZcO.js → index-RD-gFG7U.js} +1 -1
  67. package/dist/assets/{index-3gh3KcSo.js → index-iOD1kOar.js} +1 -1
  68. package/dist/assets/{index-DwuQFnlr.js → index-rQAVknkX.js} +1 -1
  69. package/dist/assets/{index-xrCVFXc_.js → index-ve-p7nSZ.js} +1 -1
  70. package/dist/assets/{invitation-LkRqaKIR.js → invitation-P1aXUnIO.js} +1 -1
  71. package/dist/assets/{invitations-D0twFHTb.js → invitations-dPkgiFPr.js} +1 -1
  72. package/dist/assets/{invite-Bq02Wgwb.js → invite-Bz99qCDF.js} +1 -1
  73. package/dist/assets/{isURL-DAY9MZJJ.js → isURL-DYsELTMk.js} +1 -1
  74. package/dist/assets/{issue-passport-NpVrtTSF.js → issue-passport-DPyxNFLD.js} +1 -1
  75. package/dist/assets/{item-A9AxqmJb.js → item-B1UaStjk.js} +1 -1
  76. package/dist/assets/{landing-page-BBhzhyhU.js → landing-page-CkVnGimh.js} +1 -1
  77. package/dist/assets/{layout-CT8j1IGl.js → layout-fFNOz6Xe.js} +1 -1
  78. package/dist/assets/{list-DcrvvV8X.js → list-C-9EwvIL.js} +1 -1
  79. package/dist/assets/{list-CpdSyVlo.js → list-CX2Q1hbc.js} +1 -1
  80. package/dist/assets/{localization-BnjH2TLn.js → localization-DQioZq4I.js} +1 -1
  81. package/dist/assets/{log-CcKk7QZL.js → log-lPrpnnPZ.js} +1 -1
  82. package/dist/assets/{login-IMzJsMuG.js → login-63olb_gZ.js} +1 -1
  83. package/dist/assets/{login-oauth-callback-Df5gSERT.js → login-oauth-callback-DebmT1Db.js} +1 -1
  84. package/dist/assets/{logo-uploader-DI_6oB30.js → logo-uploader-3OpHGD1n.js} +1 -1
  85. package/dist/assets/{lost-passport-i0WRSJQt.js → lost-passport-xCmWuuxC.js} +1 -1
  86. package/dist/assets/{open-window-CrdkIvcc.js → open-window-CzYfI7l7.js} +1 -1
  87. package/dist/assets/{over-due-invoice-payment-Dairtuas.js → over-due-invoice-payment-C5fynimj.js} +1 -1
  88. package/dist/assets/{overview-D4hz1f04.js → overview-BFzvEbcq.js} +1 -1
  89. package/dist/assets/{passport-B2fL-0uN.js → passport-BLmrTDdo.js} +1 -1
  90. package/dist/assets/{passport-item-L7acCYqJ.js → passport-item-CBB6usyJ.js} +1 -1
  91. package/dist/assets/{permission-B7_8SVB9.js → permission-UeJPGiMm.js} +1 -1
  92. package/dist/assets/{preferences-BNy97I1g.js → preferences-Da8NATLw.js} +1 -1
  93. package/dist/assets/{profile-embed-hHsyn2Ki.js → profile-embed-9LLnCulK.js} +1 -1
  94. package/dist/assets/{publish-resource-urgBZEXm.js → publish-resource-Chyv1Trw.js} +1 -1
  95. package/dist/assets/{runtime-wNrz-OwM.js → runtime-iwxdTEke.js} +1 -1
  96. package/dist/assets/sdk-D4xzRwM9.js +1 -0
  97. package/dist/assets/{security-D5AcOcu2.js → security-D4Sx6wQO.js} +1 -1
  98. package/dist/assets/{session-BtQQCb_u.js → session-Dnp_ufkx.js} +1 -1
  99. package/dist/assets/{setup-PRcxWbhy.js → setup-DpBiTcjv.js} +1 -1
  100. package/dist/assets/{spaces-jHZOfRT3.js → spaces-Bu7-7u79.js} +1 -1
  101. package/dist/assets/{start-DyT2xbZe.js → start-B1qawsPb.js} +1 -1
  102. package/dist/assets/{starting-progress-Jn-4yF7_.js → starting-progress-BfM3wNuj.js} +1 -1
  103. package/dist/assets/{status-b40PyJnc.js → status-LEG00uGL.js} +1 -1
  104. package/dist/assets/{step-actions-BZmm0ei-.js → step-actions-BzwezgI2.js} +1 -1
  105. package/dist/assets/{studio-Dqjq8IDN.js → studio-Bk9PCaeS.js} +1 -1
  106. package/dist/assets/{team-DK_N0J3a.js → team-DmYSbFMF.js} +1 -1
  107. package/dist/assets/{traffic-BVT9gNf1.js → traffic-CzxoP9Vj.js} +1 -1
  108. package/dist/assets/{transfer-BGhQJnlc.js → transfer-CUe_bnhh.js} +1 -1
  109. package/dist/assets/{unsubscribe-DsNv3U7c.js → unsubscribe-5Z1xcJ3T.js} +1 -1
  110. package/dist/assets/{use-app-logo-BKyiSzxV.js → use-app-logo-0uziDh86.js} +1 -1
  111. package/dist/assets/{user-center-BcjjuRmk.js → user-center-u6FpYGow.js} +2 -2
  112. package/dist/assets/{user-follower-DgAPhBY5.js → user-follower-CyGK-1so.js} +1 -1
  113. package/dist/assets/{user-sessions-Bv46aXrx.js → user-sessions-4qrRIOb8.js} +1 -1
  114. package/dist/assets/{util-CxUMQb4N.js → util-CQfGbjyT.js} +1 -1
  115. package/dist/assets/{util-BLs2BnSw.js → util-DXaZWduO.js} +1 -1
  116. package/dist/assets/{wait-connect-D97I-PbQ.js → wait-connect-Rle27g9O.js} +1 -1
  117. package/dist/assets/{wizard-Bs0eTfDi.js → wizard-CewJTR0V.js} +1 -1
  118. package/dist/assets/{wizard-components-BwF9dBN2.js → wizard-components-B4yvBYZF.js} +1 -1
  119. package/dist/assets/{wrap-locale-D6EgWtG_.js → wrap-locale-qW2Nj5Kt.js} +1 -1
  120. package/dist/assets/{zh-Dp_c1E39.js → zh-Bg-a-bz5.js} +1 -1
  121. package/dist/index.html +1 -1
  122. package/dist/service-worker.js +1 -1
  123. package/package.json +23 -23
  124. package/dist/assets/engine-lkWYvtZC.js +0 -1
  125. package/dist/assets/sdk-mf5ixH6N.js +0 -1
@@ -1,4 +1,4 @@
1
- import{j as e,y as Pt,bc as Pe,M as ie,ak as x,Q as H,W as u,J as pe,c1 as Rt,I as $,aN as It,T as I,aj as Tt,b5 as Le,P as Be,b6 as Q,a5 as We,z as Qe,A as Je,ci as At,bh as Mt,U as je,d9 as zt,da as Et,at as X,db as Lt,a6 as Z,n as ae,D as Bt,dc as Wt,ar as Oe,b1 as Re,dd as Ot,aX as Dt,am as Ce,bq as Nt,br as ye,a$ as $t,cW as Ft}from"./vendor-mui-core-BFPsXaTR.js";import{r as y,a as Ut,u as _t,j as qt}from"./vendor-react-Dvs43sk9.js";import{t as Xe,Z as Ht,a6 as Gt,R as De,D as Kt,C as le,n as V,A as Yt}from"./vendor-utils-OrZFrHBP.js";import{a as Vt,F as Zt,bu as Qt,c as Ie,Y as Jt,bv as Xt,aX as Te,W as xe,bg as er,bw as tr,a8 as rr,aZ as nr,a9 as or,bx as sr}from"./index-CmM1Fb8I.js";import{a as R,h as et,k as ee,g as G,b as L,j as ir}from"./vendor-hooks-DmThWyyG.js";import{l as tt}from"./arrow-down.svg-zOZF6XLO.js";import{s as Ae,a2 as O,V as W,aB as ar,z as rt,aC as lr,H as q,aD as cr,aE as dr,aF as Ne,v as ur,p as nt,u as Me,aG as pr,aH as M,O as xr,K as fr,$ as ot,aI as hr,aJ as gr,J as mr,o as ce,U as $e,x as br,a9 as Fe}from"./vendor-ux-CE4sOH7O.js";import{N as yr}from"./list-CpdSyVlo.js";import{d as vr}from"./search-4YYphs0l.js";import{B as Ue}from"./bundle-avatar-CRBdm-Kg.js";import{h as _e,T as wr}from"./team-DK_N0J3a.js";import{b as jr,d as Cr,a as Sr,c as kr,e as Pr,f as Rr,h as Ir,O as Tr}from"./user-center-BcjjuRmk.js";import{T as qe,O as Ar}from"./index-BV58Bk4h.js";import{c as Mr}from"./passport-B2fL-0uN.js";import{N as st,U as it}from"./index-xrCVFXc_.js";import{u as te}from"./use-mobile-Db5FIl07.js";import zr from"./index-J-Fwoozx.js";import{f as J}from"./index-DBs9Ljax.js";import{u as Se}from"./index-DlRa8Zeh.js";import{U as ve}from"./user-sessions-Bv46aXrx.js";import Er from"./index-Bsziwsc_.js";import{o as Lr}from"./vendor-arcblock-DGOH9a3F.js";import{c as Br,b as de,a as Wr,S as Or}from"./index-CWoGXO4Z.js";import"./index-Cd_Gml9C.js";import"./index-BojVbZw0.js";import{U as Dr}from"./user-follower-DgAPhBY5.js";import"./lottie-web-4koyQiv_.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-DACE9NO5.js";import"./util-CxUMQb4N.js";import"./base32-Cg02gOuu.js";import"./session-BtQQCb_u.js";import"./isURL-DAY9MZJJ.js";import"./use-app-logo-BKyiSzxV.js";import"./index-3gh3KcSo.js";import"./use-mobile-DLnLSQQq.js";import"./actions-C4-lIUPY.js";import"./index-IGBGBXd_.js";import"./form-text-input-AIMlcRaM.js";import"./required-BPzIdi1N.js";import"./form-wrapper-DINLdpTN.js";import"./edit.svg-DycWG9v3.js";import"./lock.svg-COUP8tyO.js";import"./index-D2x0prGU.js";import"./permission-B7_8SVB9.js";import"./confirm-DAMhAYR3.js";import"./click-to-copy-CK42VmRr.js";import"./invitations-D0twFHTb.js";import"./create-passport-svg-BsR3hKFq.js";import"./api-txzyyizM.js";import"./table-tips-BMq3WO_p.js";import"./passport-item-L7acCYqJ.js";import"./did-address-BQL5Zxlr.js";import"./index-CeTnfded.js";import"./vendor-mui-x-C6iZOJbV.js";import"./AdapterDayjs-DyE9ImrK.js";import"./delete-confirm-Ca3miSFM.js";import"./index-DRYJ0xIl.js";function Nr(){let t=new Map;function o({root:s,rootMargin:n,threshold:i}){let a=t.get(s);a||(a=new Map,t.set(s,a));let l=JSON.stringify({rootMargin:n,threshold:i}),p=a.get(l);if(!p){let r=new Map;p={observer:new IntersectionObserver(f=>{f.forEach(h=>{r.get(h.target)?.(h)})},{root:s,rootMargin:n,threshold:i}),entryCallbacks:r},a.set(l,p)}return{observe:(r,f)=>{p.entryCallbacks.set(r,f),p.observer.observe(r)},unobserve:r=>{p.entryCallbacks.delete(r),p.observer.unobserve(r)}}}return{getObserver:o}}var $r="0px",Fr=[0],Ur=Nr();function _r(t){let o=t?.rootMargin??$r,s=t?.threshold??Fr,n=y.useRef(null),i=y.useRef(null),a=y.useRef(null),[l,p]=y.useState(),r=y.useCallback(()=>{let C=n.current;if(!C){p(void 0);return}let v=Ur.getObserver({root:i.current,rootMargin:o,threshold:s});v.observe(C,c=>{p(c)}),a.current=v},[o,s]),f=y.useCallback(()=>{let C=a.current,v=n.current;v&&C?.unobserve(v),a.current=null},[]),h=y.useCallback(C=>{f(),n.current=C,r()},[r,f]),m=y.useCallback(C=>{f(),i.current=C,r()},[r,f]);return[h,{entry:l,rootRef:m}]}var qr=_r;function Hr(t){let[o,s]=qr(t),n=!!s.entry?.isIntersecting,[i,a]=y.useState(n);return n&&!i&&a(!0),[o,{...s,isVisible:n,wasEverVisible:i}]}var Gr=Hr,Kr=100;function Yr({loading:t,hasNextPage:o,onLoadMore:s,rootMargin:n,disabled:i,delayInMs:a=Kr}){let l=y.useRef(s),[p,{rootRef:r,isVisible:f}]=Gr({rootMargin:n});y.useEffect(()=>{l.current=s},[s]);let h=!i&&!t&&f&&o;return y.useEffect(()=>{if(h){let m=setTimeout(()=>{l.current()},a);return()=>{clearTimeout(m)}}},[h,a]),[p,{rootRef:r}]}var Vr=Yr;const we={info:"#3B82F6",success:"#10B981",warning:"#F59E0B",error:"#EF4444"};ue.propTypes={severity:u.oneOf(["info","success","warning","error",""]).isRequired,size:u.number};function ue({severity:t,size:o=8}){return we[t]?e.jsx(x,{component:"span",sx:{display:"inline-block",width:o,height:o,borderRadius:"50%",backgroundColor:we[t]||we.info}}):null}at.propTypes={theme:u.string,type:u.oneOf(["button","line","select"]),onSelectType:u.func,extra:u.node,loading:u.bool,currentTab:u.oneOf(["info","success","warning","error",""])};function at({theme:t="dark",type:o="button",onSelectType:s,extra:n=void 0,currentTab:i="",loading:a=!1,...l}){const{t:p}=y.useContext(Ae),r=[{label:p("notification.allSeverity"),value:""},{label:p("notification.severityType.info"),value:"info"},{label:p("notification.severityType.success"),value:"success"},{label:p("notification.severityType.warning"),value:"warning"},{label:p("notification.severityType.error"),value:"error"}],f=g=>{(g!==i||!a)&&s(g)},h=y.useMemo(()=>{const g={width:"100%",bgcolor:t==="dark"?"#F9FAFB":"",overflowY:"auto",paddingTop:o==="select"?"0":"5px",whiteSpace:"nowrap",borderRadius:0,display:"flex",justifyContent:"space-between",alignItems:"flex-end",flexWrap:"wrap",gap:"8px"};return o==="line"?Object.assign(g,{}):g},[o,t]),m=(g,S,T)=>e.jsx(H,{disabled:a,onClick:()=>f(g.value),className:`profile-button ${S?"active":""}`,...l,children:g.label},g.value||T),C=(g,S,T)=>e.jsx(H,{variant:"text",disabled:a,onClick:()=>f(g.value),className:`profile-line-button ${S?"active":""}`,...l,children:g.label},g.value||T),v=()=>r?.map((g,S)=>{const T=i===g?.value;return o==="line"?e.jsx(y.Fragment,{children:C(g,T,S)},g.value||S):e.jsx(y.Fragment,{children:m(g,T,S)},g.value||S)}),c=g=>{const{value:S}=g.target;f(S==="all"?"":S)};return o==="select"?e.jsx(Pt,{sx:{maxWidth:300},children:e.jsx(Pe,{value:i||"all",onChange:c,size:"small",label:"Severity",IconComponent:g=>e.jsx(tt,{...g,width:20,height:20}),MenuProps:{autoFocus:!1,PaperProps:{style:{maxHeight:400,overflowY:"auto",borderRadius:"8px",boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},variant:"outlined",sx:{fieldset:{border:"none"}},children:r.map((g,S)=>e.jsx(ie,{value:g.value||"all",children:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ue,{severity:g.value}),g.label]})},g.value||S))})}):e.jsxs(x,{className:"severity-tabs",sx:h,children:[e.jsx(x,{sx:{...o==="line"?{flex:1,borderBottom:"1px solid",borderColor:"grey.200"}:{display:"flex",gap:"24px"}},children:v()}),n]})}lt.propTypes={paging:u.objectOf(u.any).isRequired,loading:u.bool.isRequired,onChange:u.func.isRequired};function lt({loading:t,paging:o,onChange:s}){const{t:n}=y.useContext(Ae),i=pe(r=>r.breakpoints.down("md"));if(o.pageCount<=0||i)return null;const a=(r,f)=>{s({page:f+1})},l=r=>{const f=Number(r.target.value);s({page:1,pageSize:f})},p=o.page-1<=0?0:o.page-1;return e.jsx(x,{className:"notification-pagination",sx:{mt:2,display:"flex",justifyContent:"flex-end"},children:e.jsx(Rt,{component:"div",disabled:t,count:o.total,page:p,rowsPerPageOptions:[10,20,50,100],labelRowsPerPage:n("pagination.rowsPerPage"),labelDisplayedRows:({from:r,to:f,count:h})=>`${r}–${f} / ${h!==-1?h:`${n()}more than ${f}`}`,rowsPerPage:o.pageSize,onPageChange:a,onRowsPerPageChange:l})})}const Zr=y.memo(lt),Qr={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4h16v2.172a2 2 0 0 1-.586 1.414L15 12v7l-6 2v-8.5L4.52 7.572A2 2 0 0 1 4 6.227V4z"/>'},He=6,Ge={"& .MuiCheckbox-root":{padding:"4px"},"& .MuiCheckbox-root .MuiSvgIcon-root":{fontSize:"1.35rem"},"& .MuiCheckbox-root:not(.Mui-checked)":{color:"divider"},"& .MuiCheckbox-root.Mui-checked":{color:"primary.main"},"& .MuiCheckbox-root .css-i4bv87-MuiSvgIcon-root":{width:"1.1em",height:"1.1em"},"& .MuiCheckbox-root svg":{stroke:"divider",strokeWidth:.7}},Jr={border:"1px solid",borderColor:"divider",borderRadius:1,overflow:"hidden",backgroundColor:"background.paper",backgroundImage:"none",transition:"all 0.2s ease-in-out"},Ke=()=>({...Jr,width:"calc(50% - 8px)"});ct.propTypes={loading:u.bool,type:u.oneOf(["server","service"]),onFilterChange:u.func,blockletMap:u.object,filterType:u.oneOf(["component","entity"]),selectedId:u.array,severity:u.array,enableMarkAllAsRead:u.bool,unReadCount:u.number,onReadFilterChange:u.func,currentReadFilter:u.string};function ct({onFilterChange:t=()=>{},loading:o=!1,type:s="service",blockletMap:n={},filterType:i="component",selectedId:a=[],severity:l=[],enableMarkAllAsRead:p=!0,unReadCount:r=0,onReadFilterChange:f=()=>{},currentReadFilter:h="all"}){const{t:m}=y.useContext(Ae),[C,v]=y.useState(null),c=!!C,[g,S]=y.useState(a),[T,P]=y.useState(l),[b,E]=y.useState(!1),[z,U]=y.useState(""),[N,j]=y.useState([]);y.useEffect(()=>{S(a),P(l)},[a,l]);const k=[{label:m("notification.filterType.all"),value:"all"},{label:m("notification.filterType.unread"),value:"unread"}],D=d=>{(d!==h||!o)&&f(d)},K=[{label:m("notification.severityType.info"),value:"info"},{label:m("notification.severityType.success"),value:"success"},{label:m("notification.severityType.warning"),value:"warning"},{label:m("notification.severityType.error"),value:"error"}],re=d=>{v(d.currentTarget),U(""),E(!1)},he=()=>{v(null)},ne=d=>{const w=g.includes(d)?g.filter(A=>A!==d):[...g,d];S(w),t({id:w,severity:T})},oe=d=>{const w=T.includes(d)?T.filter(A=>A!==d):[...T,d];P(w),t({severity:w,id:g})},ge=d=>{U(d.target.value)},me=()=>{E(!b)},Y=Ut.useMemo(()=>{if(!n.size)return[];const d=[];return i==="component"&&d.push({label:m("notification.system"),id:"system"}),Array.from(n).forEach(([,w])=>{const A=w.did||w.meta?.did,B=w.title||w.meta?.title||"",_=w.appPid||w.appDid;(i==="component"&&_!==A||i==="entity"&&_===A)&&d.push({label:B,id:A,blocklet:w,ancestors:w.ancestors})}),d},[n,i,m]);y.useEffect(()=>{if(z.trim()==="")j(Y);else{const d=z.toLowerCase(),w=Y.filter(A=>A.label.toLowerCase().includes(d));j(w)}},[z,Y]);const be=z.trim()!==""||b?N:N.slice(0,He);return e.jsxs(x,{children:[e.jsxs(x,{sx:{display:"flex",justifyContent:p?"space-between":"flex-end",alignItems:"flex-start",flexWrap:"wrap",gap:1},children:[p&&e.jsx(x,{sx:{display:"flex",gap:1.5},children:k.map(d=>e.jsxs(H,{disabled:o,onClick:()=>D(d.value),className:`profile-button ${h===d.value?"active":""}`,sx:{...s==="service"&&h===d.value?{color:"secondary.main"}:{},color:"red",fontWeight:h===d.value?"bold":"normal"},children:[d.label,d.value==="unread"&&r>0&&` (${r})`]},d.value))}),e.jsxs(x,{sx:{display:"flex",justifyContent:"flex-end",gap:2},children:[e.jsx($,{size:"small",onClick:re,disabled:o,sx:{minWidth:"auto",borderRadius:1,border:"1px solid",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:e.jsx(O,{icon:Qr,hFlip:!0})}),e.jsx(It,{open:c,anchorEl:C,onClose:he,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{p:3,width:450,maxHeight:500,overflowY:"auto",backgroundColor:"background.paper",backgroundImage:"none",borderRadius:1,boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},children:e.jsxs(x,{children:[e.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,height:"28px"},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:"bold"},children:m("notification.severity")}),e.jsx(x,{sx:{minWidth:"60px",display:"flex",justifyContent:"flex-end"},children:(g.length>0||T.length>0)&&e.jsx(H,{size:"small",onClick:()=>{S([]),P([]),t({severity:[],id:[]})},startIcon:e.jsx(Tt,{fontSize:"small"}),sx:{color:"text.secondary",textTransform:"none",minWidth:"auto","&:hover":{backgroundColor:"transparent"},"& .MuiButton-startIcon":{marginRight:"2px"}},children:m("notification.clear")})})]}),e.jsx(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(Le,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,flex:1},children:K.map(d=>e.jsx(Be,{elevation:0,sx:Ke(T.includes(d.value)),children:e.jsx(Q,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{display:"flex",alignItems:"center",gap:1,fontSize:"0.875rem"},...Ge},control:e.jsx(We,{checked:T.includes(d.value),onChange:()=>oe(d.value),disabled:o,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5},children:[e.jsx(ue,{severity:d.value}),d.label]})})},d.value))})}),e.jsxs(x,{sx:{mb:2},children:[e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,mb:1.5},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:"bold",width:"calc(100% - 36px)"},children:m("notification.from")}),e.jsx(x,{sx:{display:"flex",alignItems:"center",width:"calc(100% - 36px)"},children:e.jsx(Qe,{size:"small",placeholder:"search",value:z,onChange:ge,sx:{width:"100%","& .MuiOutlinedInput-input":{padding:"6px 4px 6px 0"},".MuiOutlinedInput-root":{"&:hover":{fieldset:{borderColor:"divider"}},"&.Mui-focused":{fieldset:{borderColor:"divider"}}},fieldset:{borderColor:"divider"}},slotProps:{input:{size:"small",startAdornment:e.jsx(Je,{position:"start",sx:{marginRight:"2px"},children:e.jsx(O,{icon:vr})})}}})})]}),e.jsx(Le,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2},children:be.map(d=>e.jsx(Be,{elevation:0,sx:Ke(g.includes(d.id)),children:e.jsx(Q,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{fontSize:"0.875rem",width:"calc(100% - 36px)"},...Ge},control:e.jsx(We,{checked:g.includes(d.id),onChange:()=>ne(d.id),disabled:o,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,minWidth:0,width:"100%"},children:[d.blocklet&&e.jsx(Ue,{size:20,blocklet:d.blocklet,ancestors:d.ancestors,style:{borderRadius:4,flexShrink:0}}),e.jsx(I,{noWrap:!0,variant:"body2",component:"span",title:d.label,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:d.label})]})})},d.id))}),N.length>He&&z.trim()===""&&e.jsx(H,{fullWidth:!0,size:"small",onClick:me,sx:{mt:1},endIcon:b?e.jsx(At,{}):e.jsx(Mt,{})})]})]})})]})]}),g.length>0||T.length>0?e.jsxs(x,{className:"notification-filter-content",sx:{display:"flex",flexWrap:"wrap",gap:1,mt:2},children:[T.map(d=>{const w=K.find(A=>A.value===d);return e.jsx(je,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(ue,{severity:d}),w?w.label:d]}),onDelete:()=>oe(d),size:"small",variant:"outlined",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`severity-${d}`)}),g.map(d=>{const w=Y.find(A=>A.id===d);return e.jsx(je,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[w?.blocklet&&e.jsx(Ue,{size:16,blocklet:w.blocklet,ancestors:w.ancestors,style:{borderRadius:4,flexShrink:0}}),w?w.label:d]}),variant:"outlined",onDelete:()=>ne(d),size:"small",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`component-${d}`)})]}):null]})}const Xr=X(Lt)`
1
+ import{j as e,y as Pt,bc as Pe,M as ie,ak as x,Q as H,W as u,J as pe,c1 as Rt,I as $,aN as It,T as I,aj as Tt,b5 as Le,P as Be,b6 as Q,a5 as We,z as Qe,A as Je,ci as At,bh as Mt,U as je,d9 as zt,da as Et,at as X,db as Lt,a6 as Z,n as ae,D as Bt,dc as Wt,ar as Oe,b1 as Re,dd as Ot,aX as Dt,am as Ce,bq as Nt,br as ye,a$ as $t,cW as Ft}from"./vendor-mui-core-BFPsXaTR.js";import{r as y,a as Ut,u as _t,j as qt}from"./vendor-react-Dvs43sk9.js";import{t as Xe,Z as Ht,a6 as Gt,R as De,D as Kt,C as le,n as V,A as Yt}from"./vendor-utils-OrZFrHBP.js";import{a as Vt,F as Zt,bu as Qt,c as Ie,Y as Jt,bv as Xt,aX as Te,W as xe,bg as er,bw as tr,a8 as rr,aZ as nr,a9 as or,bx as sr}from"./index-3yzleS_1.js";import{a as R,h as et,k as ee,g as G,b as L,j as ir}from"./vendor-hooks-DmThWyyG.js";import{l as tt}from"./arrow-down.svg-D3B8bxxx.js";import{s as Ae,a2 as O,V as W,aB as ar,z as rt,aC as lr,H as q,aD as cr,aE as dr,aF as Ne,v as ur,p as nt,u as Me,aG as pr,aH as M,O as xr,K as fr,$ as ot,aI as hr,aJ as gr,J as mr,o as ce,U as $e,x as br,a9 as Fe}from"./vendor-ux-CE4sOH7O.js";import{N as yr}from"./list-CX2Q1hbc.js";import{d as vr}from"./search-4YYphs0l.js";import{B as Ue}from"./bundle-avatar-BFaxogKz.js";import{h as _e,T as wr}from"./team-DmYSbFMF.js";import{b as jr,d as Cr,a as Sr,c as kr,e as Pr,f as Rr,h as Ir,O as Tr}from"./user-center-u6FpYGow.js";import{T as qe,O as Ar}from"./index-DJj8GmQS.js";import{c as Mr}from"./passport-BLmrTDdo.js";import{N as st,U as it}from"./index-ve-p7nSZ.js";import{u as te}from"./use-mobile-Db5FIl07.js";import zr from"./index-D_vhPpT2.js";import{f as J}from"./index-DBs9Ljax.js";import{u as Se}from"./index-DlRa8Zeh.js";import{U as ve}from"./user-sessions-4qrRIOb8.js";import Er from"./index-D1thq8eN.js";import{o as Lr}from"./vendor-arcblock-DGOH9a3F.js";import{c as Br,b as de,a as Wr,S as Or}from"./index-Bgt2qHLn.js";import"./index-Cd_Gml9C.js";import"./index-BojVbZw0.js";import{U as Dr}from"./user-follower-CyGK-1so.js";import"./lottie-web-4koyQiv_.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-DeVDiUjo.js";import"./util-CQfGbjyT.js";import"./base32-Cg02gOuu.js";import"./session-Dnp_ufkx.js";import"./isURL-DYsELTMk.js";import"./use-app-logo-0uziDh86.js";import"./index-iOD1kOar.js";import"./use-mobile-DLnLSQQq.js";import"./actions-C4-lIUPY.js";import"./index-IGBGBXd_.js";import"./form-text-input-AIMlcRaM.js";import"./required-BPzIdi1N.js";import"./form-wrapper-DINLdpTN.js";import"./edit.svg-DycWG9v3.js";import"./lock.svg-COUP8tyO.js";import"./index-DHQkab_n.js";import"./permission-UeJPGiMm.js";import"./confirm-CEAKWDZJ.js";import"./click-to-copy-CK42VmRr.js";import"./invitations-dPkgiFPr.js";import"./create-passport-svg-BsR3hKFq.js";import"./api-txzyyizM.js";import"./table-tips-BMq3WO_p.js";import"./passport-item-CBB6usyJ.js";import"./did-address-BQL5Zxlr.js";import"./index-C80JxCSn.js";import"./vendor-mui-x-C6iZOJbV.js";import"./AdapterDayjs-DyE9ImrK.js";import"./delete-confirm-DpKJ9gtf.js";import"./index-DRYJ0xIl.js";function Nr(){let t=new Map;function o({root:s,rootMargin:n,threshold:i}){let a=t.get(s);a||(a=new Map,t.set(s,a));let l=JSON.stringify({rootMargin:n,threshold:i}),p=a.get(l);if(!p){let r=new Map;p={observer:new IntersectionObserver(f=>{f.forEach(h=>{r.get(h.target)?.(h)})},{root:s,rootMargin:n,threshold:i}),entryCallbacks:r},a.set(l,p)}return{observe:(r,f)=>{p.entryCallbacks.set(r,f),p.observer.observe(r)},unobserve:r=>{p.entryCallbacks.delete(r),p.observer.unobserve(r)}}}return{getObserver:o}}var $r="0px",Fr=[0],Ur=Nr();function _r(t){let o=t?.rootMargin??$r,s=t?.threshold??Fr,n=y.useRef(null),i=y.useRef(null),a=y.useRef(null),[l,p]=y.useState(),r=y.useCallback(()=>{let C=n.current;if(!C){p(void 0);return}let v=Ur.getObserver({root:i.current,rootMargin:o,threshold:s});v.observe(C,c=>{p(c)}),a.current=v},[o,s]),f=y.useCallback(()=>{let C=a.current,v=n.current;v&&C?.unobserve(v),a.current=null},[]),h=y.useCallback(C=>{f(),n.current=C,r()},[r,f]),m=y.useCallback(C=>{f(),i.current=C,r()},[r,f]);return[h,{entry:l,rootRef:m}]}var qr=_r;function Hr(t){let[o,s]=qr(t),n=!!s.entry?.isIntersecting,[i,a]=y.useState(n);return n&&!i&&a(!0),[o,{...s,isVisible:n,wasEverVisible:i}]}var Gr=Hr,Kr=100;function Yr({loading:t,hasNextPage:o,onLoadMore:s,rootMargin:n,disabled:i,delayInMs:a=Kr}){let l=y.useRef(s),[p,{rootRef:r,isVisible:f}]=Gr({rootMargin:n});y.useEffect(()=>{l.current=s},[s]);let h=!i&&!t&&f&&o;return y.useEffect(()=>{if(h){let m=setTimeout(()=>{l.current()},a);return()=>{clearTimeout(m)}}},[h,a]),[p,{rootRef:r}]}var Vr=Yr;const we={info:"#3B82F6",success:"#10B981",warning:"#F59E0B",error:"#EF4444"};ue.propTypes={severity:u.oneOf(["info","success","warning","error",""]).isRequired,size:u.number};function ue({severity:t,size:o=8}){return we[t]?e.jsx(x,{component:"span",sx:{display:"inline-block",width:o,height:o,borderRadius:"50%",backgroundColor:we[t]||we.info}}):null}at.propTypes={theme:u.string,type:u.oneOf(["button","line","select"]),onSelectType:u.func,extra:u.node,loading:u.bool,currentTab:u.oneOf(["info","success","warning","error",""])};function at({theme:t="dark",type:o="button",onSelectType:s,extra:n=void 0,currentTab:i="",loading:a=!1,...l}){const{t:p}=y.useContext(Ae),r=[{label:p("notification.allSeverity"),value:""},{label:p("notification.severityType.info"),value:"info"},{label:p("notification.severityType.success"),value:"success"},{label:p("notification.severityType.warning"),value:"warning"},{label:p("notification.severityType.error"),value:"error"}],f=g=>{(g!==i||!a)&&s(g)},h=y.useMemo(()=>{const g={width:"100%",bgcolor:t==="dark"?"#F9FAFB":"",overflowY:"auto",paddingTop:o==="select"?"0":"5px",whiteSpace:"nowrap",borderRadius:0,display:"flex",justifyContent:"space-between",alignItems:"flex-end",flexWrap:"wrap",gap:"8px"};return o==="line"?Object.assign(g,{}):g},[o,t]),m=(g,S,T)=>e.jsx(H,{disabled:a,onClick:()=>f(g.value),className:`profile-button ${S?"active":""}`,...l,children:g.label},g.value||T),C=(g,S,T)=>e.jsx(H,{variant:"text",disabled:a,onClick:()=>f(g.value),className:`profile-line-button ${S?"active":""}`,...l,children:g.label},g.value||T),v=()=>r?.map((g,S)=>{const T=i===g?.value;return o==="line"?e.jsx(y.Fragment,{children:C(g,T,S)},g.value||S):e.jsx(y.Fragment,{children:m(g,T,S)},g.value||S)}),c=g=>{const{value:S}=g.target;f(S==="all"?"":S)};return o==="select"?e.jsx(Pt,{sx:{maxWidth:300},children:e.jsx(Pe,{value:i||"all",onChange:c,size:"small",label:"Severity",IconComponent:g=>e.jsx(tt,{...g,width:20,height:20}),MenuProps:{autoFocus:!1,PaperProps:{style:{maxHeight:400,overflowY:"auto",borderRadius:"8px",boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},variant:"outlined",sx:{fieldset:{border:"none"}},children:r.map((g,S)=>e.jsx(ie,{value:g.value||"all",children:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(ue,{severity:g.value}),g.label]})},g.value||S))})}):e.jsxs(x,{className:"severity-tabs",sx:h,children:[e.jsx(x,{sx:{...o==="line"?{flex:1,borderBottom:"1px solid",borderColor:"grey.200"}:{display:"flex",gap:"24px"}},children:v()}),n]})}lt.propTypes={paging:u.objectOf(u.any).isRequired,loading:u.bool.isRequired,onChange:u.func.isRequired};function lt({loading:t,paging:o,onChange:s}){const{t:n}=y.useContext(Ae),i=pe(r=>r.breakpoints.down("md"));if(o.pageCount<=0||i)return null;const a=(r,f)=>{s({page:f+1})},l=r=>{const f=Number(r.target.value);s({page:1,pageSize:f})},p=o.page-1<=0?0:o.page-1;return e.jsx(x,{className:"notification-pagination",sx:{mt:2,display:"flex",justifyContent:"flex-end"},children:e.jsx(Rt,{component:"div",disabled:t,count:o.total,page:p,rowsPerPageOptions:[10,20,50,100],labelRowsPerPage:n("pagination.rowsPerPage"),labelDisplayedRows:({from:r,to:f,count:h})=>`${r}–${f} / ${h!==-1?h:`${n()}more than ${f}`}`,rowsPerPage:o.pageSize,onPageChange:a,onRowsPerPageChange:l})})}const Zr=y.memo(lt),Qr={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4h16v2.172a2 2 0 0 1-.586 1.414L15 12v7l-6 2v-8.5L4.52 7.572A2 2 0 0 1 4 6.227V4z"/>'},He=6,Ge={"& .MuiCheckbox-root":{padding:"4px"},"& .MuiCheckbox-root .MuiSvgIcon-root":{fontSize:"1.35rem"},"& .MuiCheckbox-root:not(.Mui-checked)":{color:"divider"},"& .MuiCheckbox-root.Mui-checked":{color:"primary.main"},"& .MuiCheckbox-root .css-i4bv87-MuiSvgIcon-root":{width:"1.1em",height:"1.1em"},"& .MuiCheckbox-root svg":{stroke:"divider",strokeWidth:.7}},Jr={border:"1px solid",borderColor:"divider",borderRadius:1,overflow:"hidden",backgroundColor:"background.paper",backgroundImage:"none",transition:"all 0.2s ease-in-out"},Ke=()=>({...Jr,width:"calc(50% - 8px)"});ct.propTypes={loading:u.bool,type:u.oneOf(["server","service"]),onFilterChange:u.func,blockletMap:u.object,filterType:u.oneOf(["component","entity"]),selectedId:u.array,severity:u.array,enableMarkAllAsRead:u.bool,unReadCount:u.number,onReadFilterChange:u.func,currentReadFilter:u.string};function ct({onFilterChange:t=()=>{},loading:o=!1,type:s="service",blockletMap:n={},filterType:i="component",selectedId:a=[],severity:l=[],enableMarkAllAsRead:p=!0,unReadCount:r=0,onReadFilterChange:f=()=>{},currentReadFilter:h="all"}){const{t:m}=y.useContext(Ae),[C,v]=y.useState(null),c=!!C,[g,S]=y.useState(a),[T,P]=y.useState(l),[b,E]=y.useState(!1),[z,U]=y.useState(""),[N,j]=y.useState([]);y.useEffect(()=>{S(a),P(l)},[a,l]);const k=[{label:m("notification.filterType.all"),value:"all"},{label:m("notification.filterType.unread"),value:"unread"}],D=d=>{(d!==h||!o)&&f(d)},K=[{label:m("notification.severityType.info"),value:"info"},{label:m("notification.severityType.success"),value:"success"},{label:m("notification.severityType.warning"),value:"warning"},{label:m("notification.severityType.error"),value:"error"}],re=d=>{v(d.currentTarget),U(""),E(!1)},he=()=>{v(null)},ne=d=>{const w=g.includes(d)?g.filter(A=>A!==d):[...g,d];S(w),t({id:w,severity:T})},oe=d=>{const w=T.includes(d)?T.filter(A=>A!==d):[...T,d];P(w),t({severity:w,id:g})},ge=d=>{U(d.target.value)},me=()=>{E(!b)},Y=Ut.useMemo(()=>{if(!n.size)return[];const d=[];return i==="component"&&d.push({label:m("notification.system"),id:"system"}),Array.from(n).forEach(([,w])=>{const A=w.did||w.meta?.did,B=w.title||w.meta?.title||"",_=w.appPid||w.appDid;(i==="component"&&_!==A||i==="entity"&&_===A)&&d.push({label:B,id:A,blocklet:w,ancestors:w.ancestors})}),d},[n,i,m]);y.useEffect(()=>{if(z.trim()==="")j(Y);else{const d=z.toLowerCase(),w=Y.filter(A=>A.label.toLowerCase().includes(d));j(w)}},[z,Y]);const be=z.trim()!==""||b?N:N.slice(0,He);return e.jsxs(x,{children:[e.jsxs(x,{sx:{display:"flex",justifyContent:p?"space-between":"flex-end",alignItems:"flex-start",flexWrap:"wrap",gap:1},children:[p&&e.jsx(x,{sx:{display:"flex",gap:1.5},children:k.map(d=>e.jsxs(H,{disabled:o,onClick:()=>D(d.value),className:`profile-button ${h===d.value?"active":""}`,sx:{...s==="service"&&h===d.value?{color:"secondary.main"}:{},color:"red",fontWeight:h===d.value?"bold":"normal"},children:[d.label,d.value==="unread"&&r>0&&` (${r})`]},d.value))}),e.jsxs(x,{sx:{display:"flex",justifyContent:"flex-end",gap:2},children:[e.jsx($,{size:"small",onClick:re,disabled:o,sx:{minWidth:"auto",borderRadius:1,border:"1px solid",borderColor:"divider","&:hover":{backgroundColor:"action.hover"}},children:e.jsx(O,{icon:Qr,hFlip:!0})}),e.jsx(It,{open:c,anchorEl:C,onClose:he,anchorOrigin:{vertical:"bottom",horizontal:"right"},transformOrigin:{vertical:"top",horizontal:"right"},slotProps:{paper:{sx:{p:3,width:450,maxHeight:500,overflowY:"auto",backgroundColor:"background.paper",backgroundImage:"none",borderRadius:1,boxShadow:"0px 6px 24px rgba(0, 0, 0, 0.15)"}}},children:e.jsxs(x,{children:[e.jsxs(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:2,height:"28px"},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:"bold"},children:m("notification.severity")}),e.jsx(x,{sx:{minWidth:"60px",display:"flex",justifyContent:"flex-end"},children:(g.length>0||T.length>0)&&e.jsx(H,{size:"small",onClick:()=>{S([]),P([]),t({severity:[],id:[]})},startIcon:e.jsx(Tt,{fontSize:"small"}),sx:{color:"text.secondary",textTransform:"none",minWidth:"auto","&:hover":{backgroundColor:"transparent"},"& .MuiButton-startIcon":{marginRight:"2px"}},children:m("notification.clear")})})]}),e.jsx(x,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(Le,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,flex:1},children:K.map(d=>e.jsx(Be,{elevation:0,sx:Ke(T.includes(d.value)),children:e.jsx(Q,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{display:"flex",alignItems:"center",gap:1,fontSize:"0.875rem"},...Ge},control:e.jsx(We,{checked:T.includes(d.value),onChange:()=>oe(d.value),disabled:o,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5},children:[e.jsx(ue,{severity:d.value}),d.label]})})},d.value))})}),e.jsxs(x,{sx:{mb:2},children:[e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2,mb:1.5},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:"bold",width:"calc(100% - 36px)"},children:m("notification.from")}),e.jsx(x,{sx:{display:"flex",alignItems:"center",width:"calc(100% - 36px)"},children:e.jsx(Qe,{size:"small",placeholder:"search",value:z,onChange:ge,sx:{width:"100%","& .MuiOutlinedInput-input":{padding:"6px 4px 6px 0"},".MuiOutlinedInput-root":{"&:hover":{fieldset:{borderColor:"divider"}},"&.Mui-focused":{fieldset:{borderColor:"divider"}}},fieldset:{borderColor:"divider"}},slotProps:{input:{size:"small",startAdornment:e.jsx(Je,{position:"start",sx:{marginRight:"2px"},children:e.jsx(O,{icon:vr})})}}})})]}),e.jsx(Le,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2},children:be.map(d=>e.jsx(Be,{elevation:0,sx:Ke(g.includes(d.id)),children:e.jsx(Q,{sx:{margin:0,padding:.5,width:"100%","& .MuiFormControlLabel-label":{fontSize:"0.875rem",width:"calc(100% - 36px)"},...Ge},control:e.jsx(We,{checked:g.includes(d.id),onChange:()=>ne(d.id),disabled:o,size:"small"}),label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",justifyContent:"flex-start",gap:.5,minWidth:0,width:"100%"},children:[d.blocklet&&e.jsx(Ue,{size:20,blocklet:d.blocklet,ancestors:d.ancestors,style:{borderRadius:4,flexShrink:0}}),e.jsx(I,{noWrap:!0,variant:"body2",component:"span",title:d.label,sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",maxWidth:"100%"},children:d.label})]})})},d.id))}),N.length>He&&z.trim()===""&&e.jsx(H,{fullWidth:!0,size:"small",onClick:me,sx:{mt:1},endIcon:b?e.jsx(At,{}):e.jsx(Mt,{})})]})]})})]})]}),g.length>0||T.length>0?e.jsxs(x,{className:"notification-filter-content",sx:{display:"flex",flexWrap:"wrap",gap:1,mt:2},children:[T.map(d=>{const w=K.find(A=>A.value===d);return e.jsx(je,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(ue,{severity:d}),w?w.label:d]}),onDelete:()=>oe(d),size:"small",variant:"outlined",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`severity-${d}`)}),g.map(d=>{const w=Y.find(A=>A.id===d);return e.jsx(je,{label:e.jsxs(x,{sx:{display:"flex",alignItems:"center",gap:.5},children:[w?.blocklet&&e.jsx(Ue,{size:16,blocklet:w.blocklet,ancestors:w.ancestors,style:{borderRadius:4,flexShrink:0}}),w?w.label:d]}),variant:"outlined",onDelete:()=>ne(d),size:"small",sx:{borderRadius:2,color:"text.secondary",borderColor:"divider","& .MuiChip-label":{display:"flex",alignItems:"center"}}},`component-${d}`)})]}):null]})}const Xr=X(Lt)`
2
2
  position: fixed;
3
3
  bottom: 20px;
4
4
  right: 20px;
@@ -1,4 +1,4 @@
1
- import{V as ee,H as O,a2 as X,ad as Ee,ae as Ue,af as We,ag as Ve,s as K,a9 as je,q as ke,B as Me,p as z,ah as _e,x as Ne,z as $e,A as Ie}from"./vendor-ux-CE4sOH7O.js";import{b as u,a as H,g as ae,c as He}from"./vendor-hooks-DmThWyyG.js";import{r as D}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as i,b6 as R,am as ce,y as B,z as F,Q as V,T as Y,I as le,a3 as oe,W as E,b1 as W,bb as qe,cb as Le,cE as Je,at as Fe,D as ye,ah as Be,cF as Oe,a6 as be,cG as Ze,a$ as Ke}from"./vendor-mui-core-BFPsXaTR.js";import{Z as N,ab as M,X as G,bg as se,c as ve,ba as Ge,aX as Ye,Y as Qe}from"./index-CmM1Fb8I.js";import{A as Z,Q as Xe,b as de,Z as et,n as Q,$ as tt,C as nt,a as st}from"./vendor-utils-OrZFrHBP.js";import{u as te,C as k,a as De}from"./index.esm-JPZAjt0x.js";import{S as ie}from"./switch-control-CRxlGq2g.js";import{S as y}from"./section-DOw43pby.js";import{d as ot}from"./keyboard-arrow-down-rounded-8U0_i9QO.js";import{u as at}from"./index-DlRa8Zeh.js";import{v as it}from"./index-IGBGBXd_.js";import{r as rt}from"./base32-Cg02gOuu.js";import{u as lt}from"./use-mobile-DLnLSQQq.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DGOH9a3F.js";import"./required-BPzIdi1N.js";const we={width:24,height:24,body:'<path fill="currentColor" d="M5 4v16V4v5v-5Zm3 10h2.675q.275-.575.638-1.075t.812-.925H8q-.425 0-.713.288T7 13q0 .425.288.713T8 14Zm0 4h2.075Q10 17.5 10 17t.075-1H8q-.425 0-.713.288T7 17q0 .425.288.713T8 18Zm-3 4q-.825 0-1.413-.588T3 20V4q0-.825.588-1.413T5 2h7.175q.4 0 .763.15t.637.425l4.85 4.85q.275.275.425.638t.15.762V10.3q-.475-.15-.975-.225T17 10V9h-4q-.425 0-.713-.288T12 8V4H5v16h5.675q.275.575.638 1.075t.812.925H5Zm12-10q2.075 0 3.538 1.463T22 17q0 2.075-1.463 3.538T17 22q-2.075 0-3.538-1.463T12 17q0-2.075 1.463-3.538T17 12Zm0 8q.275 0 .463-.188t.187-.462q0-.275-.187-.463T17 18.7q-.275 0-.463.188t-.187.462q0 .275.188.463T17 20Zm0-6q-.475 0-.875.238t-.65.637q-.1.15-.025.313t.25.237q.15.075.3 0t.275-.2q.125-.175.313-.275t.412-.1q.325 0 .563.213t.237.537q0 .275-.15.463t-.35.387q-.15.15-.313.3t-.287.35q-.075.15-.113.313t-.037.337q0 .225.125.413t.325.187q.2 0 .325-.15t.125-.35q0-.275.15-.488t.35-.412q.3-.275.525-.613t.225-.737q0-.675-.5-1.138T17 14Z"/>'},ue={enabled:!1,domain:"",clientId:"",clientSecret:""};function ct(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...ue},c?.settings?.oauth?.auth0||{}),{handleSubmit:x,control:a,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(ue))}),l=d("enabled"),j=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({auth0:s})}}),L=Object.assign({...ue},I?.settings?.oauth?.auth0||{});f(L),O.success(t("oauth.saveSuccess"))}catch(I){O.error(I.message||t("oauth.saveFailed"))}}),v=u(s=>s?.trim()?!0:t("oauth.auth0.domainDescription")),S=u(s=>s?.trim()?!0:t("oauth.auth0.clientIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.auth0.clientSecretDescription")),w=u(()=>!0),h=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-auth0":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-auth0",[n]);return e.jsx(i,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.auth0.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(i,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:h,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:a,render:({field:s})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.auth0.domain"),children:e.jsx(k,{name:"domain",control:a,rules:{validate:l?v:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.domain"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientId"),children:e.jsx(k,{name:"clientId",control:a,rules:{validate:l?S:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.clientId"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:a,rules:{validate:l?g:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.auth0.clientSecret"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const he={enabled:!1,clientId:"",clientSecret:""};function dt(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...he},c?.settings?.oauth?.github||{}),{handleSubmit:x,control:a,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(he))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({github:h})}}),I=Object.assign({...he},s?.settings?.oauth?.github||{});f(I),O.success(t("oauth.saveSuccess"))}catch(s){O.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.github.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.github.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-github":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-github",[n]);return e.jsx(i,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.github.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(i,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:a,sx:{alignItems:"center"},render:({field:h})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},size:"small",checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.github.clientId"),children:e.jsx(k,{name:"clientId",control:a,rules:{validate:l?v:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.github.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.github.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:a,rules:{validate:l?S:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.github.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const me={enabled:!1,clientId:"",clientSecret:""};function ut(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...me},c?.settings?.oauth?.google||{}),{handleSubmit:x,control:a,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(me))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({google:h})}}),I=Object.assign({...me},s?.settings?.oauth?.google||{});f(I),O.success(t("oauth.saveSuccess"))}catch(s){O.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.google.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.google.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-google":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-google",[n]);return e.jsx(i,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.google.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(i,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:a,render:({field:h})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.google.clientId"),children:e.jsx(k,{name:"clientId",control:a,rules:{validate:l?v:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.google.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.google.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:a,rules:{validate:l?S:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.google.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function ht(){const{api:b}=N(),{blocklet:c}=M(),{t}=ee(),n=c?.meta?.did,o=Object.assign({...pe},c?.settings?.oauth?.apple||{}),{handleSubmit:r,control:x,formState:a,watch:p,reset:d}=te({defaultValues:Z(o,Object.keys(pe))}),f=p("enabled"),l=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({apple:s})}}),L=Object.assign({...pe},I?.settings?.oauth?.apple||{});d(L),O.success(t("oauth.saveSuccess"))}catch(I){O.error(I.message||t("oauth.saveFailed"))}}),j=u(s=>s?.trim()?!0:t("oauth.apple.teamIdDescription")),v=u(s=>s?.trim()?!0:t("oauth.apple.serviceIdDescription")),S=u(s=>s?.trim()?!0:t("oauth.apple.keyIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.apple.authKeyDescription")),w=u(s=>s?.trim()?!0:t("oauth.apple.bundleIdDescription")),h=u(()=>!0);return e.jsx(i,{children:e.jsxs("form",{onSubmit:r(l),disabled:!0,children:[e.jsx(y,{title:t("oauth.apple.enable"),mb:2.5,children:e.jsx(k,{name:"enabled",control:x,render:({field:s})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.apple.teamId"),children:e.jsx(k,{name:"teamId",control:x,rules:{validate:f?j:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.teamId"),error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.bundleId"),children:e.jsx(k,{name:"bundleId",control:x,rules:{validate:f?w:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.bundleId"),error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.serviceId"),children:e.jsx(k,{name:"serviceId",control:x,rules:{validate:f?v:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.serviceId"),error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.keyId"),children:e.jsx(k,{name:"keyId",control:x,rules:{validate:f?S:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.keyId"),error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.authKey"),children:e.jsx(k,{name:"authKey",control:x,rules:{validate:f?g:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.apple.authKey"),multiline:!0,rows:4,error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:r(l),disabled:!a.isDirty,children:t("oauth.save")})]})})}const xe={enabled:!1,clientId:"",clientSecret:""};function mt(){const{api:b}=N(),{blocklet:c}=M(),{t}=ee(),n=c?.meta?.did,o=Object.assign({...xe},c?.settings?.oauth?.twitter||{}),{handleSubmit:r,control:x,formState:a,watch:p,reset:d}=te({defaultValues:Z(o,Object.keys(xe))}),f=p("enabled"),l=u(async g=>{try{const{blocklet:w}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({twitter:g})}}),h=Object.assign({...xe},w?.settings?.oauth?.twitter||{});d(h),O.success(t("oauth.saveSuccess"))}catch(w){O.error(w.message||t("oauth.saveFailed"))}}),j=u(g=>g?.trim()?!0:t("oauth.twitter.clientIdDescription")),v=u(g=>g?.trim()?!0:t("oauth.twitter.clientSecretDescription")),S=u(()=>!0);return e.jsx(i,{children:e.jsxs("form",{onSubmit:r(l),disabled:!0,children:[e.jsx(y,{title:e.jsx(i,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:t("oauth.twitter.enable")})}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:x,sx:{alignItems:"center"},render:({field:g})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},size:"small",checked:g.value,...g})})})}),e.jsx(y,{title:t("oauth.twitter.clientId"),children:e.jsx(k,{name:"clientId",control:x,rules:{validate:f?j:S},render:({field:g})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",label:t("oauth.twitter.clientId"),error:!!a.errors[g.name],helperText:a.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.twitter.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:x,rules:{validate:f?v:S},render:({field:g})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",type:"password",label:t("oauth.twitter.clientSecret"),error:!!a.errors[g.name],helperText:a.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:r(l),disabled:!a.isDirty,children:t("oauth.save")})]})})}const pt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function Re({id:b,title:c,children:t,index:n,onMove:o,defaultExpand:r=!1,onEnd:x,icon:a=null}){const[p,d]=D.useState(r),f=D.useRef(null),l=D.useRef(null),[{handlerId:j},v]=Ee({accept:"dragItem",collect(s){return{handlerId:s.getHandlerId()}},hover(s,I){if(!f.current)return;const L=s.index,m=n;if(L===m)return;const A=f.current?.getBoundingClientRect(),_=l.current?.getBoundingClientRect(),re=(_.bottom-_.top)/2,$=I.getClientOffset().y-A.top;L<m&&$<re||L>m&&$>re||(o(L,m),s.index=m)}}),[{isDragging:S},g]=Ue({item:{index:n,type:"dragItem"},collect:s=>({isDragging:s.isDragging()}),end:x});g(l),v(f);const w=S?.5:1,h=u(s=>{s.preventDefault(),s.stopPropagation(),d(!p)});return e.jsxs(i,{ref:f,children:[e.jsxs(i,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:l,"data-handler-id":j,children:[e.jsxs(i,{sx:{py:2,px:1,opacity:w,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:h,children:[e.jsx(i,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(X,{fontSize:20,icon:pt})}),e.jsx(i,{sx:{display:"flex",alignItems:"center",flexShrink:0,mr:.5,transform:"translateY(-1px)"},children:a}),e.jsx(Y,{sx:{flex:1},children:c}),e.jsx(le,{size:"small",sx:{pointerEvents:"auto",transform:p?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(X,{icon:ot,style:{transform:"scale(1.5)"}})})]}),e.jsx(oe,{})]}),e.jsx(i,{sx:{pl:4,py:2.5,display:p?"block":"none"},children:t})]})}Re.propTypes={title:E.string.isRequired,id:E.string.isRequired,children:E.node.isRequired,index:E.number.isRequired,onMove:E.func.isRequired,onEnd:E.func.isRequired,defaultExpand:E.bool,icon:E.any};const xt=[{name:"github",title:G.PROVIDER_NAME.github,icon:e.jsx(se,{provider:"github",sx:{width:20,height:20}}),component:e.jsx(dt,{})},{name:"google",title:G.PROVIDER_NAME.google,icon:e.jsx(se,{provider:"google",sx:{width:20,height:20}}),component:e.jsx(ut,{})},{name:"apple",title:G.PROVIDER_NAME.apple,icon:e.jsx(se,{provider:"apple",sx:{width:20,height:20}}),component:e.jsx(ht,{})},{name:"twitter",title:G.PROVIDER_NAME.twitter,icon:e.jsx(se,{provider:"twitter",sx:{width:20,height:20}}),component:e.jsx(mt,{})},{name:"auth0",title:G.PROVIDER_NAME.auth0,icon:e.jsx(se,{provider:"auth0",sx:{width:20,height:20}}),component:e.jsx(ct,{})}],ft=["github","google","apple","twitter","auth0"];function gt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=c?.settings?.oauth||{},o=Object.keys(n).sort((l,j)=>n[l]?.order!==void 0&&n[j]?.order!==void 0?n[l].order-n[j].order:n[l]?.order!==void 0?-1:1);for(const l of ft)o.includes(l)||o.push(l);const r=ae(o.reduce((l,j,v)=>Object.assign(l,{[j]:v}),{})),x=H(()=>{const l=[...xt];return l.sort((j,v)=>r[j.name]-r[v.name]),l.map(j=>({...j,enabled:n[j.name]?.enabled??!1}))},[r.auth0,r.github,r.google]),a={};typeof window<"u"&&(a.context=window);const p=u(async l=>{const j={};Object.keys(l).forEach(v=>{j[v]={order:l[v]}}),await b.configOAuth({input:{did:t,oauth:JSON.stringify(j)}})}),d=u((l,j)=>{const v=x[l],S=x[j];r[v.name]=j,r[S.name]=l}),f=u(async()=>{await p(r)});return e.jsx(i,{sx:{".section-left":{width:"180px"}},children:e.jsx(We,{backend:Ve,...a,children:x.map((l,j)=>e.jsx(Re,{index:j,id:l.name,title:l.title,icon:l.icon,onMove:d,onEnd:f,defaultExpand:l.enabled,children:l.component},l.name))})})}const J={ttl:ve.SESSION_TTL,cacheTtl:ve.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]},enableBlacklist:!1};function U(b){return e.jsx(at,{...b,sx:{transform:"scale(0.75)"}})}function fe(b,c=!1){const t=c?b.ttl*86400:b.ttl/86400;return{...b,ttl:t}}function jt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=Xe({},J,c?.settings?.session||{});de(n.ttl)&&(n.ttl=J.ttl),de(n.cacheTtl)&&(n.cacheTtl=J.cacheTtl),n.phone||(n.phone=J.phone),n.email||(n.email=J.email),de(n.enableBlacklist)&&(n.enableBlacklist=J.enableBlacklist);const{handleSubmit:o,control:r,formState:x,reset:a,watch:p}=te({defaultValues:Z(fe(n),["ttl","cacheTtl","email","phone","enableBlacklist"])}),{t:d}=ee(),f=p("email.enabled"),l=p("phone.enabled"),j=p("email.enableDomainBlackList"),v=p("email.enableDomainWhiteList"),{fields:S,append:g,remove:w}=De({control:r,name:"email.domainBlackList"}),{fields:h,append:s,remove:I}=De({control:r,name:"email.domainWhiteList"}),L=u(async m=>{try{const{blocklet:A}=await b.updateAppSessionConfig({input:{did:t,config:et(fe(m,!0),["phone"])}}),_=Object.assign({},J,Z(A?.settings?.session||{},["ttl","cacheTtl","email","phone","enableBlacklist"]));a(fe(_)),O.success(d("common.configSuccess"))}catch(A){O.error(A.message)}});return e.jsx(bt,{onSubmit:o(L),children:e.jsxs(W,{direction:"column",sx:{gap:6},children:[e.jsxs(i,{children:[e.jsxs(i,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.profile")}),e.jsx(i,{component:oe,sx:{my:3}})]}),e.jsxs(W,{sx:{gap:2},children:[e.jsx(y,{title:d("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enabled",control:r,render:({field:m})=>e.jsx(U,{...m,checked:m.value})})})}),f&&e.jsxs(W,{direction:"column",sx:{ml:2,gap:.5},children:[e.jsx(y,{title:d("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireVerified",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireUnique",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.trustOauthProviders",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainBlackList",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),j&&e.jsxs(i,{children:[S.map((m,A)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainBlackList.${A}`,control:r,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(le,{onClick:()=>w(A),children:e.jsx(qe,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(Le,{}),onClick:()=>g(""),children:d("blocklet.config.session.addDomain")})]}),e.jsx(y,{title:d("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainWhiteList",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),v&&e.jsxs(i,{children:[h.map((m,A)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainWhiteList.${A}`,control:r,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(le,{onClick:()=>I(A),children:e.jsx(qe,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(Le,{}),onClick:()=>s(""),children:d("blocklet.config.session.addDomain")})]})]}),e.jsxs(i,{sx:{display:"none"},children:[e.jsx(y,{title:d("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.enabled",control:r,disabled:!0,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),l&&e.jsxs(W,{direction:"column",sx:{ml:2,mt:1},children:[e.jsx(y,{title:d("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireVerified",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireUnique",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(i,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.period")}),e.jsx(i,{component:oe,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(k,{name:"ttl",control:r,rules:{min:1,max:30},render:({field:m})=>e.jsx(B,{fullWidth:!0,sx:{mb:2},children:e.jsx(y,{title:d("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{width:"100%",maxWidth:500,px:2},children:e.jsx(Je,{...m,defaultValue:7,step:1,marks:[{value:1,label:d("blocklet.config.session.day",{day:1})},{value:7,label:d("blocklet.config.session.days",{day:7})},{value:14,label:d("blocklet.config.session.days",{day:14})},{value:21,label:d("blocklet.config.session.days",{day:21})},{value:30,label:d("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsxs(i,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.experimentalSettings")}),e.jsx(i,{component:oe,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(y,{title:d("blocklet.config.session.enableBlacklist"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"enableBlacklist",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})})})]}),e.jsx(i,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!x.isDirty,children:d("oauth.save")})})]})})}const bt=Fe.form`
1
+ import{V as ee,H as O,a2 as X,ad as Ee,ae as Ue,af as We,ag as Ve,s as K,a9 as je,q as ke,B as Me,p as z,ah as _e,x as Ne,z as $e,A as Ie}from"./vendor-ux-CE4sOH7O.js";import{b as u,a as H,g as ae,c as He}from"./vendor-hooks-DmThWyyG.js";import{r as D}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as i,b6 as R,am as ce,y as B,z as F,Q as V,T as Y,I as le,a3 as oe,W as E,b1 as W,bb as qe,cb as Le,cE as Je,at as Fe,D as ye,ah as Be,cF as Oe,a6 as be,cG as Ze,a$ as Ke}from"./vendor-mui-core-BFPsXaTR.js";import{Z as N,ab as M,X as G,bg as se,c as ve,ba as Ge,aX as Ye,Y as Qe}from"./index-3yzleS_1.js";import{A as Z,Q as Xe,b as de,Z as et,n as Q,$ as tt,C as nt,a as st}from"./vendor-utils-OrZFrHBP.js";import{u as te,C as k,a as De}from"./index.esm-JPZAjt0x.js";import{S as ie}from"./switch-control-CRxlGq2g.js";import{S as y}from"./section-DOw43pby.js";import{d as ot}from"./keyboard-arrow-down-rounded-8U0_i9QO.js";import{u as at}from"./index-DlRa8Zeh.js";import{v as it}from"./index-IGBGBXd_.js";import{r as rt}from"./base32-Cg02gOuu.js";import{u as lt}from"./use-mobile-DLnLSQQq.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DGOH9a3F.js";import"./required-BPzIdi1N.js";const we={width:24,height:24,body:'<path fill="currentColor" d="M5 4v16V4v5v-5Zm3 10h2.675q.275-.575.638-1.075t.812-.925H8q-.425 0-.713.288T7 13q0 .425.288.713T8 14Zm0 4h2.075Q10 17.5 10 17t.075-1H8q-.425 0-.713.288T7 17q0 .425.288.713T8 18Zm-3 4q-.825 0-1.413-.588T3 20V4q0-.825.588-1.413T5 2h7.175q.4 0 .763.15t.637.425l4.85 4.85q.275.275.425.638t.15.762V10.3q-.475-.15-.975-.225T17 10V9h-4q-.425 0-.713-.288T12 8V4H5v16h5.675q.275.575.638 1.075t.812.925H5Zm12-10q2.075 0 3.538 1.463T22 17q0 2.075-1.463 3.538T17 22q-2.075 0-3.538-1.463T12 17q0-2.075 1.463-3.538T17 12Zm0 8q.275 0 .463-.188t.187-.462q0-.275-.187-.463T17 18.7q-.275 0-.463.188t-.187.462q0 .275.188.463T17 20Zm0-6q-.475 0-.875.238t-.65.637q-.1.15-.025.313t.25.237q.15.075.3 0t.275-.2q.125-.175.313-.275t.412-.1q.325 0 .563.213t.237.537q0 .275-.15.463t-.35.387q-.15.15-.313.3t-.287.35q-.075.15-.113.313t-.037.337q0 .225.125.413t.325.187q.2 0 .325-.15t.125-.35q0-.275.15-.488t.35-.412q.3-.275.525-.613t.225-.737q0-.675-.5-1.138T17 14Z"/>'},ue={enabled:!1,domain:"",clientId:"",clientSecret:""};function ct(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...ue},c?.settings?.oauth?.auth0||{}),{handleSubmit:x,control:a,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(ue))}),l=d("enabled"),j=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({auth0:s})}}),L=Object.assign({...ue},I?.settings?.oauth?.auth0||{});f(L),O.success(t("oauth.saveSuccess"))}catch(I){O.error(I.message||t("oauth.saveFailed"))}}),v=u(s=>s?.trim()?!0:t("oauth.auth0.domainDescription")),S=u(s=>s?.trim()?!0:t("oauth.auth0.clientIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.auth0.clientSecretDescription")),w=u(()=>!0),h=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-auth0":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-auth0",[n]);return e.jsx(i,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.auth0.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(i,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:h,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:a,render:({field:s})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.auth0.domain"),children:e.jsx(k,{name:"domain",control:a,rules:{validate:l?v:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.domain"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientId"),children:e.jsx(k,{name:"clientId",control:a,rules:{validate:l?S:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.auth0.clientId"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.auth0.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:a,rules:{validate:l?g:w},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.auth0.clientSecret"),error:!!p.errors[s.name],helperText:p.errors[s.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const he={enabled:!1,clientId:"",clientSecret:""};function dt(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...he},c?.settings?.oauth?.github||{}),{handleSubmit:x,control:a,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(he))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({github:h})}}),I=Object.assign({...he},s?.settings?.oauth?.github||{});f(I),O.success(t("oauth.saveSuccess"))}catch(s){O.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.github.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.github.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-github":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-github",[n]);return e.jsx(i,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.github.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(i,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:a,sx:{alignItems:"center"},render:({field:h})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},size:"small",checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.github.clientId"),children:e.jsx(k,{name:"clientId",control:a,rules:{validate:l?v:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.github.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.github.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:a,rules:{validate:l?S:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.github.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const me={enabled:!1,clientId:"",clientSecret:""};function ut(){const{api:b}=N(),{blocklet:c}=M(),{t,locale:n}=ee(),o=c?.meta?.did,r=Object.assign({...me},c?.settings?.oauth?.google||{}),{handleSubmit:x,control:a,formState:p,watch:d,reset:f}=te({defaultValues:Z(r,Object.keys(me))}),l=d("enabled"),j=u(async h=>{try{const{blocklet:s}=await b.configOAuth({input:{did:o,oauth:JSON.stringify({google:h})}}),I=Object.assign({...me},s?.settings?.oauth?.google||{});f(I),O.success(t("oauth.saveSuccess"))}catch(s){O.error(s.message||t("oauth.saveFailed"))}}),v=u(h=>h?.trim()?!0:t("oauth.google.clientIdDescription")),S=u(h=>h?.trim()?!0:t("oauth.google.clientSecretDescription")),g=u(()=>!0),w=H(()=>n==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-google":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-google",[n]);return e.jsx(i,{children:e.jsxs("form",{onSubmit:x(j),disabled:!0,children:[e.jsx(y,{title:e.jsxs(i,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:t("oauth.google.enable")}),e.jsx(ce,{title:t("oauth.viewDocument"),children:e.jsx(i,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:w,target:"_blank",rel:"noreferrer",children:e.jsx(X,{icon:we,fontSize:20})})})]}),mb:2.5,children:e.jsx(k,{name:"enabled",control:a,render:({field:h})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},checked:h.value,...h})})})}),e.jsx(y,{title:t("oauth.google.clientId"),children:e.jsx(k,{name:"clientId",control:a,rules:{validate:l?v:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",label:t("oauth.google.clientId"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(y,{title:t("oauth.google.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:a,rules:{validate:l?S:g},render:({field:h})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...h,size:"small",type:"password",label:t("oauth.google.clientSecret"),error:!!p.errors[h.name],helperText:p.errors[h.name]?.message||" ",disabled:!l})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:x(j),disabled:!p.isDirty,children:t("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function ht(){const{api:b}=N(),{blocklet:c}=M(),{t}=ee(),n=c?.meta?.did,o=Object.assign({...pe},c?.settings?.oauth?.apple||{}),{handleSubmit:r,control:x,formState:a,watch:p,reset:d}=te({defaultValues:Z(o,Object.keys(pe))}),f=p("enabled"),l=u(async s=>{try{const{blocklet:I}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({apple:s})}}),L=Object.assign({...pe},I?.settings?.oauth?.apple||{});d(L),O.success(t("oauth.saveSuccess"))}catch(I){O.error(I.message||t("oauth.saveFailed"))}}),j=u(s=>s?.trim()?!0:t("oauth.apple.teamIdDescription")),v=u(s=>s?.trim()?!0:t("oauth.apple.serviceIdDescription")),S=u(s=>s?.trim()?!0:t("oauth.apple.keyIdDescription")),g=u(s=>s?.trim()?!0:t("oauth.apple.authKeyDescription")),w=u(s=>s?.trim()?!0:t("oauth.apple.bundleIdDescription")),h=u(()=>!0);return e.jsx(i,{children:e.jsxs("form",{onSubmit:r(l),disabled:!0,children:[e.jsx(y,{title:t("oauth.apple.enable"),mb:2.5,children:e.jsx(k,{name:"enabled",control:x,render:({field:s})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},checked:s.value,...s})})})}),e.jsx(y,{title:t("oauth.apple.teamId"),children:e.jsx(k,{name:"teamId",control:x,rules:{validate:f?j:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.teamId"),error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.bundleId"),children:e.jsx(k,{name:"bundleId",control:x,rules:{validate:f?w:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.bundleId"),error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.serviceId"),children:e.jsx(k,{name:"serviceId",control:x,rules:{validate:f?v:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.serviceId"),error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.keyId"),children:e.jsx(k,{name:"keyId",control:x,rules:{validate:f?S:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",label:t("oauth.apple.keyId"),error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.apple.authKey"),children:e.jsx(k,{name:"authKey",control:x,rules:{validate:f?g:h},render:({field:s})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...s,size:"small",type:"password",label:t("oauth.apple.authKey"),multiline:!0,rows:4,error:!!a.errors[s.name],helperText:a.errors[s.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:r(l),disabled:!a.isDirty,children:t("oauth.save")})]})})}const xe={enabled:!1,clientId:"",clientSecret:""};function mt(){const{api:b}=N(),{blocklet:c}=M(),{t}=ee(),n=c?.meta?.did,o=Object.assign({...xe},c?.settings?.oauth?.twitter||{}),{handleSubmit:r,control:x,formState:a,watch:p,reset:d}=te({defaultValues:Z(o,Object.keys(xe))}),f=p("enabled"),l=u(async g=>{try{const{blocklet:w}=await b.configOAuth({input:{did:n,oauth:JSON.stringify({twitter:g})}}),h=Object.assign({...xe},w?.settings?.oauth?.twitter||{});d(h),O.success(t("oauth.saveSuccess"))}catch(w){O.error(w.message||t("oauth.saveFailed"))}}),j=u(g=>g?.trim()?!0:t("oauth.twitter.clientIdDescription")),v=u(g=>g?.trim()?!0:t("oauth.twitter.clientSecretDescription")),S=u(()=>!0);return e.jsx(i,{children:e.jsxs("form",{onSubmit:r(l),disabled:!0,children:[e.jsx(y,{title:e.jsx(i,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:t("oauth.twitter.enable")})}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(k,{name:"enabled",control:x,sx:{alignItems:"center"},render:({field:g})=>e.jsx(R,{control:e.jsx(ie,{sx:{ml:1},size:"small",checked:g.value,...g})})})}),e.jsx(y,{title:t("oauth.twitter.clientId"),children:e.jsx(k,{name:"clientId",control:x,rules:{validate:f?j:S},render:({field:g})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",label:t("oauth.twitter.clientId"),error:!!a.errors[g.name],helperText:a.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(y,{title:t("oauth.twitter.clientSecret"),children:e.jsx(k,{name:"clientSecret",control:x,rules:{validate:f?v:S},render:({field:g})=>e.jsx(B,{fullWidth:!0,children:e.jsx(F,{...g,size:"small",type:"password",label:t("oauth.twitter.clientSecret"),error:!!a.errors[g.name],helperText:a.errors[g.name]?.message||" ",disabled:!f})})})}),e.jsx(V,{type:"submit",variant:"contained",onSubmit:r(l),disabled:!a.isDirty,children:t("oauth.save")})]})})}const pt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function Re({id:b,title:c,children:t,index:n,onMove:o,defaultExpand:r=!1,onEnd:x,icon:a=null}){const[p,d]=D.useState(r),f=D.useRef(null),l=D.useRef(null),[{handlerId:j},v]=Ee({accept:"dragItem",collect(s){return{handlerId:s.getHandlerId()}},hover(s,I){if(!f.current)return;const L=s.index,m=n;if(L===m)return;const A=f.current?.getBoundingClientRect(),_=l.current?.getBoundingClientRect(),re=(_.bottom-_.top)/2,$=I.getClientOffset().y-A.top;L<m&&$<re||L>m&&$>re||(o(L,m),s.index=m)}}),[{isDragging:S},g]=Ue({item:{index:n,type:"dragItem"},collect:s=>({isDragging:s.isDragging()}),end:x});g(l),v(f);const w=S?.5:1,h=u(s=>{s.preventDefault(),s.stopPropagation(),d(!p)});return e.jsxs(i,{ref:f,children:[e.jsxs(i,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:l,"data-handler-id":j,children:[e.jsxs(i,{sx:{py:2,px:1,opacity:w,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:h,children:[e.jsx(i,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(X,{fontSize:20,icon:pt})}),e.jsx(i,{sx:{display:"flex",alignItems:"center",flexShrink:0,mr:.5,transform:"translateY(-1px)"},children:a}),e.jsx(Y,{sx:{flex:1},children:c}),e.jsx(le,{size:"small",sx:{pointerEvents:"auto",transform:p?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(X,{icon:ot,style:{transform:"scale(1.5)"}})})]}),e.jsx(oe,{})]}),e.jsx(i,{sx:{pl:4,py:2.5,display:p?"block":"none"},children:t})]})}Re.propTypes={title:E.string.isRequired,id:E.string.isRequired,children:E.node.isRequired,index:E.number.isRequired,onMove:E.func.isRequired,onEnd:E.func.isRequired,defaultExpand:E.bool,icon:E.any};const xt=[{name:"github",title:G.PROVIDER_NAME.github,icon:e.jsx(se,{provider:"github",sx:{width:20,height:20}}),component:e.jsx(dt,{})},{name:"google",title:G.PROVIDER_NAME.google,icon:e.jsx(se,{provider:"google",sx:{width:20,height:20}}),component:e.jsx(ut,{})},{name:"apple",title:G.PROVIDER_NAME.apple,icon:e.jsx(se,{provider:"apple",sx:{width:20,height:20}}),component:e.jsx(ht,{})},{name:"twitter",title:G.PROVIDER_NAME.twitter,icon:e.jsx(se,{provider:"twitter",sx:{width:20,height:20}}),component:e.jsx(mt,{})},{name:"auth0",title:G.PROVIDER_NAME.auth0,icon:e.jsx(se,{provider:"auth0",sx:{width:20,height:20}}),component:e.jsx(ct,{})}],ft=["github","google","apple","twitter","auth0"];function gt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=c?.settings?.oauth||{},o=Object.keys(n).sort((l,j)=>n[l]?.order!==void 0&&n[j]?.order!==void 0?n[l].order-n[j].order:n[l]?.order!==void 0?-1:1);for(const l of ft)o.includes(l)||o.push(l);const r=ae(o.reduce((l,j,v)=>Object.assign(l,{[j]:v}),{})),x=H(()=>{const l=[...xt];return l.sort((j,v)=>r[j.name]-r[v.name]),l.map(j=>({...j,enabled:n[j.name]?.enabled??!1}))},[r.auth0,r.github,r.google]),a={};typeof window<"u"&&(a.context=window);const p=u(async l=>{const j={};Object.keys(l).forEach(v=>{j[v]={order:l[v]}}),await b.configOAuth({input:{did:t,oauth:JSON.stringify(j)}})}),d=u((l,j)=>{const v=x[l],S=x[j];r[v.name]=j,r[S.name]=l}),f=u(async()=>{await p(r)});return e.jsx(i,{sx:{".section-left":{width:"180px"}},children:e.jsx(We,{backend:Ve,...a,children:x.map((l,j)=>e.jsx(Re,{index:j,id:l.name,title:l.title,icon:l.icon,onMove:d,onEnd:f,defaultExpand:l.enabled,children:l.component},l.name))})})}const J={ttl:ve.SESSION_TTL,cacheTtl:ve.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]},enableBlacklist:!1};function U(b){return e.jsx(at,{...b,sx:{transform:"scale(0.75)"}})}function fe(b,c=!1){const t=c?b.ttl*86400:b.ttl/86400;return{...b,ttl:t}}function jt(){const{api:b}=N(),{blocklet:c}=M(),t=c?.meta?.did,n=Xe({},J,c?.settings?.session||{});de(n.ttl)&&(n.ttl=J.ttl),de(n.cacheTtl)&&(n.cacheTtl=J.cacheTtl),n.phone||(n.phone=J.phone),n.email||(n.email=J.email),de(n.enableBlacklist)&&(n.enableBlacklist=J.enableBlacklist);const{handleSubmit:o,control:r,formState:x,reset:a,watch:p}=te({defaultValues:Z(fe(n),["ttl","cacheTtl","email","phone","enableBlacklist"])}),{t:d}=ee(),f=p("email.enabled"),l=p("phone.enabled"),j=p("email.enableDomainBlackList"),v=p("email.enableDomainWhiteList"),{fields:S,append:g,remove:w}=De({control:r,name:"email.domainBlackList"}),{fields:h,append:s,remove:I}=De({control:r,name:"email.domainWhiteList"}),L=u(async m=>{try{const{blocklet:A}=await b.updateAppSessionConfig({input:{did:t,config:et(fe(m,!0),["phone"])}}),_=Object.assign({},J,Z(A?.settings?.session||{},["ttl","cacheTtl","email","phone","enableBlacklist"]));a(fe(_)),O.success(d("common.configSuccess"))}catch(A){O.error(A.message)}});return e.jsx(bt,{onSubmit:o(L),children:e.jsxs(W,{direction:"column",sx:{gap:6},children:[e.jsxs(i,{children:[e.jsxs(i,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.profile")}),e.jsx(i,{component:oe,sx:{my:3}})]}),e.jsxs(W,{sx:{gap:2},children:[e.jsx(y,{title:d("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(U,{disabled:!0,checked:!0})})}),e.jsx(y,{title:d("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enabled",control:r,render:({field:m})=>e.jsx(U,{...m,checked:m.value})})})}),f&&e.jsxs(W,{direction:"column",sx:{ml:2,gap:.5},children:[e.jsx(y,{title:d("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireVerified",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.requireUnique",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.trustOauthProviders",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainBlackList",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),j&&e.jsxs(i,{children:[S.map((m,A)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainBlackList.${A}`,control:r,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(le,{onClick:()=>w(A),children:e.jsx(qe,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(Le,{}),onClick:()=>g(""),children:d("blocklet.config.session.addDomain")})]}),e.jsx(y,{title:d("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"email.enableDomainWhiteList",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),v&&e.jsxs(i,{children:[h.map((m,A)=>e.jsxs(W,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(k,{name:`email.domainWhiteList.${A}`,control:r,render:_=>e.jsx(F,{..._.field,size:"small",fullWidth:!0})}),e.jsx(le,{onClick:()=>I(A),children:e.jsx(qe,{})})]},m.id)),e.jsx(V,{startIcon:e.jsx(Le,{}),onClick:()=>s(""),children:d("blocklet.config.session.addDomain")})]})]}),e.jsxs(i,{sx:{display:"none"},children:[e.jsx(y,{title:d("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.enabled",control:r,disabled:!0,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),l&&e.jsxs(W,{direction:"column",sx:{ml:2,mt:1},children:[e.jsx(y,{title:d("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireVerified",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})}),e.jsx(y,{title:d("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"phone.requireUnique",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(i,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.period")}),e.jsx(i,{component:oe,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(k,{name:"ttl",control:r,rules:{min:1,max:30},render:({field:m})=>e.jsx(B,{fullWidth:!0,sx:{mb:2},children:e.jsx(y,{title:d("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{width:"100%",maxWidth:500,px:2},children:e.jsx(Je,{...m,defaultValue:7,step:1,marks:[{value:1,label:d("blocklet.config.session.day",{day:1})},{value:7,label:d("blocklet.config.session.days",{day:7})},{value:14,label:d("blocklet.config.session.days",{day:14})},{value:21,label:d("blocklet.config.session.days",{day:21})},{value:30,label:d("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsxs(i,{children:[e.jsx(Y,{variant:"h6",sx:{fontWeight:600},children:d("blocklet.config.session.experimentalSettings")}),e.jsx(i,{component:oe,sx:{my:3}}),e.jsx(W,{direction:"column",spacing:2,children:e.jsx(y,{title:d("blocklet.config.session.enableBlacklist"),sectionLeftSx:{width:"600px"},children:e.jsx(i,{sx:{alignSelf:"flex-start"},children:e.jsx(k,{name:"enableBlacklist",control:r,render:({field:m})=>e.jsx(R,{sx:{ml:0},control:e.jsx(U,{...m,checked:m.value})})})})})})]}),e.jsx(i,{children:e.jsx(V,{type:"submit",variant:"contained",disabled:!x.isDirty,children:d("oauth.save")})})]})})}const bt=Fe.form`
2
2
  max-width: 1536px;
3
3
 
4
4
  .advanced-config {
@@ -1,4 +1,4 @@
1
- import{g as Wt,r as v}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as y,z as Q,b6 as me,bg as qe,y as V,am as ut,d2 as Bt,bn as qt,at as ae,b1 as mt,W as h,T as ee,U as Je,d3 as pt,b5 as Ke,a5 as Me,Q as Fe,d4 as Ge,aN as Ue,a6 as ft,D as ht,d5 as Kt,ad as xt,d6 as Mt,d7 as Ut,c2 as st,n as Ht,x as $t,bc as Vt,M as it,cw as Jt,I as Gt,d8 as Yt}from"./vendor-mui-core-BFPsXaTR.js";import{A as gt,J as Xt,C as Qt,e as le,F as Zt,a3 as je}from"./vendor-utils-OrZFrHBP.js";import{V as te,H as M,p as ce,s as en,A as bt,a1 as tn,az as nn,m as jt,$ as vt,x as yt,aA as ke,q as St,U as sn,a8 as an}from"./vendor-ux-CE4sOH7O.js";import{aE as rn,Z as Ye,ab as Ct,aX as wt,J as _e,c as _,a0 as Z,o as on,aM as at}from"./index-CmM1Fb8I.js";import{g as ye,b as $,a as se}from"./vendor-hooks-DmThWyyG.js";import{u as Rt,C as Y}from"./index.esm-JPZAjt0x.js";import{i as He}from"./isURL-DAY9MZJJ.js";import{S as X}from"./section-DOw43pby.js";import{A as ln,a as cn,b as dn}from"./collapse-D7GlSZQp.js";import{S as Se}from"./shorten-label-C-X_7vr2.js";import{v as Tt}from"./index-IGBGBXd_.js";import{R as Nt,A as un,S as mn,a as pn,B as fn}from"./list-CpdSyVlo.js";import{j as hn,c as xn,N as gn}from"./team-DK_N0J3a.js";import{W as bn}from"./did-address-BQL5Zxlr.js";import{p as It}from"./util-CxUMQb4N.js";import{D as jn,g as vn}from"./traffic-BVT9gNf1.js";import{B as Et}from"./bundle-avatar-CRBdm-Kg.js";import{u as yn}from"./use-mobile-DLnLSQQq.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DGOH9a3F.js";import"./required-BPzIdi1N.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-DACE9NO5.js";import"./session-BtQQCb_u.js";import"./use-app-logo-BKyiSzxV.js";import"./base32-Cg02gOuu.js";import"./useAsyncRetry-Dyo5t1bq.js";import"./useAsync-1_z8P8M4.js";import"./iframe-D73zp9VN.js";import"./index-BcGECSaf.js";import"./index-DBs9Ljax.js";import"./base-chart-C_jLgGFD.js";import"./index-KpZGUssm.js";import"./vendor-mui-x-C6iZOJbV.js";import"./AdapterDayjs-DyE9ImrK.js";var Te={exports:{}},Ne={exports:{}},Ie={exports:{}},rt;function Sn(){return rt||(rt=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=t;function t(r){return r==null}n.exports=s.default,n.exports.default=s.default}(Ie,Ie.exports)),Ie.exports}var ot;function Cn(){return ot||(ot=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=u;var t=o(rn()),r=o(Sn());function o(p){return p&&p.__esModule?p:{default:p}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,b=/^[-+]?[0-9]+$/;function u(p,i){(0,t.default)(p),i=i||{};var N=i.allow_leading_zeroes===!1?l:b,I=!i.hasOwnProperty("min")||(0,r.default)(i.min)||p>=i.min,S=!i.hasOwnProperty("max")||(0,r.default)(i.max)||p<=i.max,j=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||p<i.lt,E=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||p>i.gt;return N.test(p)&&I&&S&&j&&E}n.exports=s.default,n.exports.default=s.default}(Ne,Ne.exports)),Ne.exports}var lt;function wn(){return lt||(lt=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=o;var t=r(Cn());function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,t.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=s.default,n.exports.default=s.default}(Te,Te.exports)),Te.exports}var Rn=wn();const Tn=Wt(Rn),ze={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Nn(){const{api:n}=Ye(),{blocklet:s}=Ct(),{t}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,b=Object.assign({...ze},s?.settings?.notification?.email||{}),{handleSubmit:u,control:p,formState:i,watch:N,reset:I}=Rt({defaultValues:gt(b,Object.keys(ze))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(a,T,O=!0)=>{try{const{blocklet:D}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),re=Object.assign({...ze},D?.settings?.notification?.email||{});I(re),O&&M.success(t("oauth.saveSuccess"))}catch(D){if(O)M.error(D.message||t("oauth.saveFailed"));else throw D}}),J=$(async(a,T,O)=>{try{i.isDirty&&await E(a,T,!1),await n.sendEmail({input:{did:l,receiver:O,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification",attachments:[{type:"link",data:{url:"https://community.arcblock.io",title:"Community",image:"https://community.arcblock.io/.well-known/service/blocklet/logo-rect-dark",utm:{campaign:"test-campaign"}}}],utm:{content:"test-email-button"}})}}),M.success(t("notification.email.testSuccess"))}catch(D){M.error(D.message||t("notification.email.testfailed"))}}),z=$((a,T)=>{S.testReceiver=localStorage.getItem("test-receiver")||"",S.testReceiverError="",r.open({title:t("notification.email.testSendEmail"),content:()=>e.jsx(y,{sx:{width:"300px"},children:e.jsx(Q,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.email.inputTestReceiver"),value:S.testReceiver,onChange:O=>{S.testReceiver=O.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(O){const D=S.testReceiver?.trim();if(!D){S.testReceiverError=t("notification.email.receiverRequired");return}if(!_e(D)){S.testReceiverError=t("notification.email.receiverInvalid");return}S.testReceiverError="",await J(a,T,D),O()}})}),F=$(a=>{const T=a?.trim();return T?_e(T)?!0:t("notification.email.fromInvalid"):t("notification.email.fromRequired")}),B=$(a=>{const T=a?.trim();return T?He(T,{require_host:!1,protocols:[]})?!0:t("notification.email.hostInvalid"):t("notification.email.hostRequired")}),w=$(a=>a?Tn(a)?!0:t("notification.email.portInvalid"):t("notification.email.portRequired")),q=$(a=>a?.trim()?!0:t("notification.email.userRequired")),K=$(a=>a?.trim()?!0:t("notification.email.passwordRequired")),f=$(a=>a?.trim()&&!He(a,{protocols:["http","https"],require_protocol:!0})?t("notification.email.linkInvalid"):!0),R=$(a=>a?.trim()&&!_e(a)?t("notification.email.emailInvalid"):!0),C=$(()=>!0);return e.jsxs(y,{children:[e.jsxs(In,{component:"form",onSubmit:u(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(X,{title:t("notification.email.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:p,render:({field:a})=>e.jsx(me,{control:e.jsx(qe,{checked:a.value,...a})})})}),e.jsx(X,{title:t("notification.email.from"),children:e.jsx(Y,{name:"from",control:p,rules:{validate:j?F:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,label:t("notification.email.from"),error:!!i.errors[a.name],helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.host"),children:e.jsx(Y,{name:"host",control:p,rules:{validate:j?B:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:t("notification.email.host"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.port"),children:e.jsx(Y,{name:"port",control:p,rules:{validate:j?w:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:t("notification.email.port"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.user"),children:e.jsx(Y,{name:"user",control:p,rules:{validate:j?q:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:t("notification.email.user"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.password"),children:e.jsx(Y,{name:"password",control:p,rules:{validate:j?K:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:t("notification.email.password"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.secure"),children:e.jsx(Y,{name:"secure",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(me,{control:e.jsx(qe,{checked:a.value,...a,disabled:!j})})})})}),e.jsxs(ln,{children:[e.jsxs(cn,{expandIcon:e.jsx(qt,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[t("notification.email.signature"),e.jsx(ut,{title:t("notification.email.signatureTooltip"),children:e.jsx(Bt,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(dn,{children:[e.jsx(X,{title:t("notification.email.companyName"),children:e.jsx(Y,{name:"companyName",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyName"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.companyLink"),children:e.jsx(Y,{name:"companyLink",control:p,rules:{validate:j?f:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyLink"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.companyAddress"),children:e.jsx(Y,{name:"companyAddress",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyAddress"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.supportEmail"),children:e.jsx(Y,{name:"supportEmail",control:p,rules:{validate:j?R:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:t("notification.email.supportEmail"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})})]})]}),e.jsxs(y,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(ce,{variant:"outlined",color:"warning",onClick:u(z),disabled:!j,children:t("oauth.runTest")}),e.jsx(ce,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),o]})}const In=ae(mt)``,We={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function En(){const{api:n}=Ye(),{blocklet:s}=Ct(),{t}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,b=Object.assign({...We},s?.settings?.notification?.pushKit||{}),{handleSubmit:u,control:p,formState:i,watch:N,reset:I}=Rt({defaultValues:gt(b,Object.keys(We))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(w,q,K=!0)=>{try{const{blocklet:f}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:w})}}),R=Object.assign({...We},f?.settings?.notification?.pushKit||{});I(R),K&&M.success(t("oauth.saveSuccess"))}catch(f){if(K)M.error(f.message||t("oauth.saveFailed"));else throw f}}),J=$(async(w,q)=>{try{i.isDirty&&await E(w,q,!1);const K=(s?.configs||[]).find(C=>C.key==="BLOCKLET_APP_URL")?.value,f=Xt(Qt(K,_.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:s?.meta?.version,t:new Date(s?.updatedAt||0).getTime()}),R={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:s?.appDid,fullName:s?.meta?.title,avatar:f}}}};await n.sendPush({input:{did:l,receiver:S.testReceiver,notification:JSON.stringify(R)}}),M.success(t("notification.pushKit.testSuccess"))}catch(K){M.error(K.message||t("notification.pushKit.testfailed"))}}),z=$((w,q)=>{S.testReceiverError="",r.open({title:t("notification.pushKit.testSend"),content:()=>e.jsx(y,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(Q,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.pushKit.inputTestReceiver"),value:S.testReceiver,onChange:K=>{S.testReceiver=K.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(K){if(!S.testReceiver?.trim()){S.testReceiverError=t("notification.pushKit.receiverRequired");return}S.testReceiverError="",await J(w,q),K()}})}),F=$(w=>{const q=w?.trim();return q?He(q)?!0:t("notification.pushKit.endpointInvalid"):t("notification.pushKit.endpointRequired")}),B=$(()=>!0);return e.jsxs(y,{children:[e.jsxs(An,{component:"form",onSubmit:u(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(X,{title:t("notification.pushKit.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:p,render:({field:w})=>e.jsx(me,{control:e.jsx(qe,{checked:w.value,...w})})})}),e.jsx(X,{title:t("notification.pushKit.endpoint"),children:e.jsx(Y,{name:"endpoint",control:p,rules:{validate:j?F:B},render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...w,size:"small",required:!0,label:t("notification.pushKit.endpoint"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})})}),e.jsxs(X,{title:t("notification.pushKit.customOptions"),children:[e.jsx(Y,{name:"did",control:p,render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...w,size:"small",label:t("notification.pushKit.did"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})}),e.jsx(Y,{name:"pushPath",control:p,render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...w,size:"small",label:t("notification.pushKit.pushPath"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})})]}),e.jsxs(y,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(ce,{variant:"outlined",color:"warning",onClick:u(z),disabled:!j,children:t("oauth.runTest")}),e.jsx(ce,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),o]})}const An=ae(mt)``,ct=[{label:e.jsx(y,{sx:{textAlign:"center",width:"100%"},children:"Email"}),value:"email"},{label:e.jsx(y,{sx:{textAlign:"center",width:"100%"},children:"Push Kit"}),value:"pushKit"}];function kn(){const[n,s]=v.useState(ct[0].value),{locale:t}=v.useContext(en),r=se(()=>({email:e.jsx(Nn,{}),pushKit:e.jsx(En,{})}),[t]),o=v.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(y,{children:[e.jsx(bt,{tabs:ct,current:n,onChange:s}),e.jsx(y,{style:o,children:r[n]})]})}const At=v.createContext({}),{Provider:On,Consumer:Ws}=At;function Dn({children:n,blocklet:s=""}){const{api:t,inService:r,ws:{useSubscription:o}}=Ye(),[l,b]=v.useState([]),[u,p]=v.useState({total:0,pageSize:20,pageCount:0,page:1}),i=se(()=>s.meta?.did,[s]),[N,I]=v.useState([]),[S,j]=v.useState({}),E=se(()=>l.length?new Set(l.map(f=>f.id)):new Set,[l]),J=async({page:f=1,pageSize:R=20,...C}={})=>{if(!i)return[];try{const a={paging:{page:f,pageSize:R},...C,teamDid:i,dateRange:C.dateRange?[Z(C.dateRange[0]).toISOString(),Z(C.dateRange[1]).toISOString()]:void 0},{dids:T,...O}=a;let D="";T&&T.includes("system")&&(D="system");const re=T?T.filter(pe=>pe!=="system"):[],ue={...O,source:D,componentDids:re},oe=await t.getNotificationSendLog({input:ue});return j(ue),b(oe.list),p(oe.paging),oe.list}catch(a){return M.error(a.message),[]}},z=async()=>{const f=await t.getNotificationComponents({input:{teamDid:i}});I(f.componentDids)},F=v.useCallback(f=>{const R=s.children.find(C=>C.meta?.did===f);if(R)return R.ancestors=[s],R},[s]),B=async({notificationId:f,receivers:R,channels:C,...a})=>{await t.resendNotification({input:{teamDid:i,notificationId:f,receivers:R,channels:C.map(T=>T==="wallet"?_.NOTIFICATION_SEND_CHANNEL.WALLET:T==="pushKit"?_.NOTIFICATION_SEND_CHANNEL.PUSH:T),...a}})},w=v.useCallback(async f=>(await t.getUser({input:{teamDid:i,user:{did:f},options:{enableConnectedAccount:!0}}})).user,[t,i]),q=v.useCallback(async({page:f=1,pageSize:R=20,...C}={})=>{try{const a={paging:{page:f,pageSize:R},...C,userName:C.searchText||"",teamDid:i,dateRange:C.dateRange?[Z(C.dateRange[0]).toISOString(),Z(C.dateRange[1]).toISOString()]:void 0};return await t.getReceivers({input:a})}catch(a){throw M.error(a.message),a}},[t,i]);v.useEffect(()=>{i&&z()},[i]),o(_.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,f=>{E.has(f.notificationId)&&J(S)},[E,S]),o(_.EVENTS.NOTIFICATION_BLOCKLET_CREATE,f=>{E.has(f.id)||J(S)},[E,S]);const K={fetch:J,data:l,paging:u,blocklet:s,getComponent:F,resendNotification:B,getUser:w,componentDids:N,getReceivers:q,inService:r,teamDid:i};return e.jsx(On,{value:{notificationRecords:K},children:n})}function Xe(){const{notificationRecords:n}=v.useContext(At);return n}Ce.propTypes={severity:h.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ln={info:"primary",success:"success",error:"error",warning:"warning"};function Ce({severity:n="info"}){return e.jsx(tn,{type:Ln[n],children:n})}const Pn=(n,s,t="")=>{if(!t||!s)return"";switch(t){case _.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return t}};function kt(n,s,t={}){const{status:r,updatedAt:o,reason:l="",channel:b="wallet"}=t,u=o?n("notification.sendStatus.sentTime",{date:on(o,s)}):"",p=Pn(n,b,l);return r===_.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:u,reason:p}:r===_.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:n("notification.sendStatus.pending"),reason:p,sentTime:u}}const $e={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ve=["wallet","pushKit","email"],dt=["info","success","error","warning"],Ot=n=>{const{settings:s}=n;return s?.notification?.email?.enabled},Dt=n=>{const{settings:s}=n;return s?.notification?.pushKit?.enabled},Fn=(n,s)=>{const t=le(s,"extra.notifications.email",!0);return{available:Ot(n),enabled:t}},_n=(n,s)=>{const t=le(s,"extra.notifications.push",!0);return{available:Dt(n),enabled:t}},zn=n=>({enabled:le(n,"extra.notifications.wallet",!0)}),Wn=n=>({enabled:le(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(s=>{setTimeout(()=>{s()},n*1e3)}),Bn=(n,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:s}),fail:n("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:n("notification.sendStatus.reason.available",{channel:s}),fail:n("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:s}),fail:n("notification.sendStatus.reason.disabled",{channel:s})}]:[],Ae=(n=[])=>{const s=Z().startOf("day");return n.filter(t=>Z(t.sendAt).isSame(s,"day")).length},qn=(n,s="")=>{if(s&&Ve.includes(s)){const l=`${s}SendRecord`,b=le(n,l,[]);return Ae(b)}const t=le(n,"webhook",{}),r=Object.keys(t??{})??[];if(s&&r.includes(s)){const l=t[s]??[];return Ae(l)}const o={};return Ve.forEach(l=>{const b=`${l}SendRecord`,u=le(n,b,[]),p=Ae(u);o[l]=p}),r.length>0&&r.forEach(l=>{const b=t[l]??[],u=Ae(b);o[l]=u}),o},Oe=(n,s,t)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[t].splice(s,1),n},De=(n,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(n):!1},Kn=n=>{switch(n){case _.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case _.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case _.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case _.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Lt=()=>({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:s=!0,showTitle:t=!1,children:r=null}){const{status:o,title:l="",sentTime:b="",reason:u=""}=n,p=[l,u].filter(Boolean).join(", ");return e.jsx(ut,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:p}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(y,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(y,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(y,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:$e[o]}}),e.jsx(y,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:$e[o]}})]}),e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:t?l:r})]})})}de.propTypes={config:h.object.isRequired,enableTooltip:h.bool,showTitle:h.bool,children:h.node};Le.propTypes={list:h.array.isRequired,label:h.string.isRequired,onDelete:h.func};function Le({list:n,label:s,onDelete:t=()=>{}}){const{t:r,locale:o}=te();return e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),n.map(l=>{const b=kt(r,o,{status:l});return e.jsx(Je,{size:"small",label:e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(de,{config:b,enableTooltip:!1,children:b.title})}),onDelete:u=>t(u,l)},l)})]})}Qe.propTypes={filterList:h.array.isRequired,onChange:h.func.isRequired,index:h.number.isRequired,column:h.object.isRequired,filterValues:h.array.isRequired,label:h.string.isRequired,renderLabel:h.func.isRequired};function Qe({filterList:n,onChange:s,index:t,column:r,filterValues:o,label:l,renderLabel:b}){return e.jsxs(V,{className:"filter-container",children:[e.jsx(pt,{component:"legend",children:l}),e.jsx(Ke,{row:!0,children:o.map(u=>e.jsx(me,{control:e.jsx(Me,{checked:n[t].indexOf(u.value??u)>-1,onChange:p=>{const i=[...n];p.target.checked?i[t]=[...i[t],u.value??u]:i[t]=i[t].filter(N=>N!==(u.value??u)),s(i[t],t,r)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(u)})},u.value??u))})]})}function Be(n){return e.jsx(Qe,{...n,renderLabel:s=>e.jsx(de,{enableTooltip:!1,config:{status:s.status},children:s.label})})}xe.propTypes={status:h.number.isRequired,updatedAt:h.string.isRequired,reason:h.string,channel:h.string,onResend:h.func};function xe({status:n,updatedAt:s,reason:t="",channel:r="wallet",onResend:o}){const{t:l,locale:b}=te(),u=kt(l,b,{status:n,updatedAt:s,reason:t,channel:r});return e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(de,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(Fe,{className:"resend-btn",size:"small",startIcon:e.jsx(Ge,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}Ze.propTypes={value:h.array.isRequired,onChange:h.func};function Ze({value:n,onChange:s}){const{locale:t}=te(),r=Z().toDate(),[o,l]=v.useState(null),b=v.useCallback(i=>{l(o?null:i.currentTarget)},[o]),u=!!o,p=v.useCallback(i=>{if(!i.startDate||!i.endDate){M.error("Please select a date range");return}if(Z(i.startDate).isAfter(i.endDate)||!Z(i.startDate).isValid()||!Z(i.endDate).isValid()){M.error("Invalid date range");return}s([i.startDate,i.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(ee,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Fe,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[at(n[0],t)," - ",at(n[1],t)]})}),e.jsx(Ue,{open:u,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(jn,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:b,definedRanges:vn(r),onChange:p})})]})}et.propTypes={itemComponent:h.elementType.isRequired};function et({itemComponent:n,...s}){const{t}=te();return!s?.filterList?.filter(o=>o.length).length?null:e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:t("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(nn.TableFilterList,{...s,ItemComponent:n})})]})}function tt({label:n,onDelete:s,canDelete:t=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let l=!0;return t&&typeof t=="function"&&(l=t({label:n,...r})),e.jsx(Je,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}tt.propTypes={label:h.string.isRequired,onDelete:h.func,canDelete:h.func};const Mn=[{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}];Pt.propTypes={loading:h.bool,onCancel:h.func,onConfirm:h.func};function Pt({loading:n=!1,onCancel:s=()=>{},onConfirm:t=()=>{}}){const{t:r}=te(),[o,l]=v.useState(Mn),[b,u]=v.useState(!0),p=(N,I)=>{I.checked=N.target.checked;const S=o.map(j=>({...j,checked:j.value===I.value?I.checked:j.checked}));l(S)},i=N=>{N.stopPropagation(),t({channels:o.filter(I=>I.checked).map(I=>I.value),isResendFailedOnly:b})};return e.jsxs(y,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ee,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(y,{className:"choose-channel",children:e.jsxs(V,{component:"fieldset",variant:"standard",children:[e.jsx(pt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Ke,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(N=>e.jsx(me,{control:e.jsx(Me,{checked:N.checked,onChange:I=>p(I,N),name:N.value}),label:N.label},N.value))})]})}),e.jsx(y,{className:"resend-config-footer",children:e.jsx(Ke,{children:e.jsx(me,{control:e.jsx(Me,{checked:b,onChange:N=>u(N.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(y,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Fe,{onClick:N=>{N.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Fe,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(ft,{size:16}),r("common.confirm")]})]})]})}Ft.propTypes={notificationId:h.string.isRequired,handleResend:h.func,resending:h.bool};function Ft({notificationId:n,handleResend:s,resending:t=!1}){const{t:r,locale:o}=te(),l=ht(),b=v.useMemo(()=>jt(l,Lt()),[l]),{getReceivers:u,inService:p,teamDid:i,getUser:N,blocklet:I}=Xe(),[S,j]=v.useState(!1),[E,J]=v.useState([]),z=ye({anchorEl:null,position:null}),F=ye({anchorEl:null,position:null}),[B,w]=v.useState(null),[q,K]=v.useState({total:0,pageSize:10,pageCount:0,page:1}),[f,R]=v.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[Z().subtract(1,"month").startOf("day").toDate(),Z().endOf("day").toDate()]}),[C,a]=v.useState([]),T=[{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"}],O=async()=>{if(!S&&n)try{j(!0);const c=await u({notificationId:n,...f}),d=c.list.map(m=>({...m,receiverUser:{...m.receiverUser,avatar:It(m.receiverUser.avatar,i,p)}}));J(d),K(c.paging),j(!1)}catch(c){M.error(c.message),j(!1)}};v.useEffect(()=>{O()},[f]);const D=c=>{c.stopPropagation();const d=c.currentTarget;F.anchorEl=d;const m=d.getBoundingClientRect();F.position={top:m.top+window.scrollY,left:m.left+window.scrollX}},re=c=>c.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(ce,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Ge,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:D,children:r("notification.resend")})}):null,ue={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:q.page-1,rowsPerPage:q.pageSize,count:q.total,searchText:f.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:C,onRowSelectionChange:(c,d)=>{a(d.map(m=>m.dataIndex))},customToolbarSelect:re},oe=({page:c,rowsPerPage:d,searchText:m,filterList:k})=>{const[,U=[],ne=[],G=[]]=k;f.pageSize!==d?R(H=>({...H,pageSize:d,page:1})):f.page!==c+1?R(H=>({...H,page:c+1})):f.searchText!==m?R(H=>({...H,searchText:m,page:1})):je(U,f.walletSendStatus)?je(ne,f.pushKitSendStatus)?je(G,f.emailSendStatus)||R(H=>({...H,emailSendStatus:G,page:1})):R(H=>({...H,pushKitSendStatus:ne,page:1})):R(H=>({...H,walletSendStatus:U,page:1}))},pe=v.useCallback(async(c,d)=>{if(!d)return!1;const m=await N(d);return m?c==="wallet"?zn(m):c==="email"?Fn(I,m):c==="pushKit"?_n(I,m):c==="webhook"?Wn(m):!0:!1},[N,I]),we=v.useCallback(c=>Bn(r,c),[r]),fe=()=>{z.anchorEl=null,z.position=null,w(null)},he=()=>{F.anchorEl=null,F.position=null},g=async(c,d,m=!0,k="")=>{if(!(!d.length||!c.length))try{s(c,d,m,k),F.anchorEl||(await Ee(.5),fe())}catch(U){console.error("handleResend error",{error:U})}},x=async({channels:c,isResendFailedOnly:d})=>{const m=C.map(k=>E[k].receiver);await g(c,m,d),await Ee(.5),he(),a([])},A=async(c,d=[],m=!0)=>{try{await g(["webhook"],[c.receiver],m,d)}catch(k){M.error(k.response?k.response.statusText:k.message)}},L=async(c,d,m,k=[],U=!0)=>{if(c.stopPropagation(),qn(d,m)>=4){M.warning(r("notification.resendLimit"));return}if(!Ve.includes(m)){await A(d,k,U);return}if(c){const G=c.currentTarget,H=G.getBoundingClientRect();z.anchorEl=G,z.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}w({channel:m});try{const G=await pe(m,d.receiver);await Ee(1),w({channel:m,result:G}),(typeof G=="boolean"&&G||Zt(G)&&Object.values(G).every(H=>!!H))&&(await s([m],[d.receiver],U),F.anchorEl||(await Ee(.5),fe()))}catch(G){M.error(G.message)}},W=c=>{R(d=>({...d,dateRange:c,page:1}))},P=(c,d,m,k)=>{c.stopPropagation();const U=m.filter(ne=>ne!==d);R(ne=>({...ne,[k]:U,page:1}))},ie=se(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:c=>{const{receiverUser:d,receiver:m}=E[c];return d?e.jsxs(y,{"data-cy":`member-name-${d.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(vt,{src:`${d.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:m,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Se,{children:d.fullName})]},m):e.jsx(bn,{size:14,responsive:!1,compact:!0,copyable:!1,did:m})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:f.walletSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Wallet",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[1].options.filterList,"walletSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,k)=>e.jsx(Be,{label:"Wallet",filterList:c,onChange:d,index:m,column:k,filterValues:T})},customBodyRenderLite:c=>{const{walletSendStatus:d,walletSendAt:m,walletSendFailedReason:k}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:k,channel:"wallet",onResend:U=>L(U,E[c],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{pushKitSendStatus:d,pushKitSendAt:m,pushKitSendFailedReason:k}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:k,channel:"pushkit",onResend:U=>L(U,E[c],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:f.pushKitSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Push Kit",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[2].options.filterList,"pushKitSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,k)=>e.jsx(Be,{label:"Push Kit",filterList:c,onChange:d,index:m,column:k,filterValues:T})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{emailSendStatus:d,emailSendAt:m,emailSendFailedReason:k}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:k,channel:"email",onResend:U=>L(U,E[c],"email",[],!1)})},filter:!0,filterType:"custom",filterList:f.emailSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Email",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[3].options.filterList,"emailSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,k)=>e.jsx(Be,{label:"Email",filterList:c,onChange:d,index:m,column:k,filterValues:T})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{webhook:d}=E[c];if(!d)return null;const m=Object.entries(d)[0];if(!m)return null;const[k,U]=m,ne=U[0];return e.jsx(y,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(y,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(Se,{maxLength:30,children:k},k),e.jsx(xe,{status:ne.status,updatedAt:ne.sendAt,reason:ne.failedReason,channel:"webhook",onResend:G=>L(G,E[c],"webhook",[k],!1)})]},k)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:c=>{const{createdAt:d}=E[c];return e.jsx(Nt,{value:d,locale:o,shouldUpdate:!0})}}}],[E,o,f,r]),Re=[e.jsx(Ze,{value:f.dateRange,onChange:W},"date-picker"),e.jsx(ce,{variant:"contained",size:"small",color:"primary",loading:S,startIcon:e.jsx(Kt,{}),onClick:()=>O(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(y,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(Hn,{children:e.jsxs(xt,{theme:b,children:[e.jsx(yt,{className:"receivers-table",locale:o,loading:S,columns:ie,data:E,onChange:oe,options:ue,customButtons:Re,components:{TableFilterList:c=>e.jsx(et,{...c,itemComponent:d=>e.jsx(tt,{...d,canDelete:()=>!1})})}}),z.anchorEl&&e.jsx(Ue,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:fe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs($n,{children:[e.jsxs(ee,{variant:"body1",component:"div",className:"check-title",children:[B?.channel," Checking"]}),e.jsx(y,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:we(B?.channel).map(c=>{const{type:d,pass:m,fail:k}=c;return!B?.result||B?.result?.[d]?e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:B?.result?.[d]?ke.success.main:"inherit"},children:[B?.result?e.jsx(Mt,{}):e.jsx(ft,{size:12,sx:{color:ke.primary.main}}),e.jsx("span",{children:m})]},d):e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:ke.error.main},children:[e.jsx(Ut,{}),e.jsx("span",{children:k})]},d)})})]})}),F.anchorEl&&e.jsx(Ue,{open:!!F.anchorEl,anchorReference:"anchorPosition",anchorPosition:F.position,onClose:he,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Pt,{loading:t,onCancel:he,onConfirm:x})})]})})})}const Un=v.memo(Ft),Hn=ae.div`
1
+ import{g as Wt,r as v}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as y,z as Q,b6 as me,bg as qe,y as V,am as ut,d2 as Bt,bn as qt,at as ae,b1 as mt,W as h,T as ee,U as Je,d3 as pt,b5 as Ke,a5 as Me,Q as Fe,d4 as Ge,aN as Ue,a6 as ft,D as ht,d5 as Kt,ad as xt,d6 as Mt,d7 as Ut,c2 as st,n as Ht,x as $t,bc as Vt,M as it,cw as Jt,I as Gt,d8 as Yt}from"./vendor-mui-core-BFPsXaTR.js";import{A as gt,J as Xt,C as Qt,e as le,F as Zt,a3 as je}from"./vendor-utils-OrZFrHBP.js";import{V as te,H as M,p as ce,s as en,A as bt,a1 as tn,az as nn,m as jt,$ as vt,x as yt,aA as ke,q as St,U as sn,a8 as an}from"./vendor-ux-CE4sOH7O.js";import{aE as rn,Z as Ye,ab as Ct,aX as wt,J as _e,c as _,a0 as Z,o as on,aM as at}from"./index-3yzleS_1.js";import{g as ye,b as $,a as se}from"./vendor-hooks-DmThWyyG.js";import{u as Rt,C as Y}from"./index.esm-JPZAjt0x.js";import{i as He}from"./isURL-DYsELTMk.js";import{S as X}from"./section-DOw43pby.js";import{A as ln,a as cn,b as dn}from"./collapse-D7GlSZQp.js";import{S as Se}from"./shorten-label-C-X_7vr2.js";import{v as Tt}from"./index-IGBGBXd_.js";import{R as Nt,A as un,S as mn,a as pn,B as fn}from"./list-CX2Q1hbc.js";import{j as hn,c as xn,N as gn}from"./team-DmYSbFMF.js";import{W as bn}from"./did-address-BQL5Zxlr.js";import{p as It}from"./util-CQfGbjyT.js";import{D as jn,g as vn}from"./traffic-CzxoP9Vj.js";import{B as Et}from"./bundle-avatar-BFaxogKz.js";import{u as yn}from"./use-mobile-DLnLSQQq.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DGOH9a3F.js";import"./required-BPzIdi1N.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-DeVDiUjo.js";import"./session-Dnp_ufkx.js";import"./use-app-logo-0uziDh86.js";import"./base32-Cg02gOuu.js";import"./useAsyncRetry-Dyo5t1bq.js";import"./useAsync-1_z8P8M4.js";import"./iframe-DAoobOBi.js";import"./index-BcGECSaf.js";import"./index-DBs9Ljax.js";import"./base-chart-C_jLgGFD.js";import"./index-KpZGUssm.js";import"./vendor-mui-x-C6iZOJbV.js";import"./AdapterDayjs-DyE9ImrK.js";var Te={exports:{}},Ne={exports:{}},Ie={exports:{}},rt;function Sn(){return rt||(rt=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=t;function t(r){return r==null}n.exports=s.default,n.exports.default=s.default}(Ie,Ie.exports)),Ie.exports}var ot;function Cn(){return ot||(ot=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=u;var t=o(rn()),r=o(Sn());function o(p){return p&&p.__esModule?p:{default:p}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,b=/^[-+]?[0-9]+$/;function u(p,i){(0,t.default)(p),i=i||{};var N=i.allow_leading_zeroes===!1?l:b,I=!i.hasOwnProperty("min")||(0,r.default)(i.min)||p>=i.min,S=!i.hasOwnProperty("max")||(0,r.default)(i.max)||p<=i.max,j=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||p<i.lt,E=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||p>i.gt;return N.test(p)&&I&&S&&j&&E}n.exports=s.default,n.exports.default=s.default}(Ne,Ne.exports)),Ne.exports}var lt;function wn(){return lt||(lt=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=o;var t=r(Cn());function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,t.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=s.default,n.exports.default=s.default}(Te,Te.exports)),Te.exports}var Rn=wn();const Tn=Wt(Rn),ze={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Nn(){const{api:n}=Ye(),{blocklet:s}=Ct(),{t}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,b=Object.assign({...ze},s?.settings?.notification?.email||{}),{handleSubmit:u,control:p,formState:i,watch:N,reset:I}=Rt({defaultValues:gt(b,Object.keys(ze))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(a,T,O=!0)=>{try{const{blocklet:D}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),re=Object.assign({...ze},D?.settings?.notification?.email||{});I(re),O&&M.success(t("oauth.saveSuccess"))}catch(D){if(O)M.error(D.message||t("oauth.saveFailed"));else throw D}}),J=$(async(a,T,O)=>{try{i.isDirty&&await E(a,T,!1),await n.sendEmail({input:{did:l,receiver:O,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification",attachments:[{type:"link",data:{url:"https://community.arcblock.io",title:"Community",image:"https://community.arcblock.io/.well-known/service/blocklet/logo-rect-dark",utm:{campaign:"test-campaign"}}}],utm:{content:"test-email-button"}})}}),M.success(t("notification.email.testSuccess"))}catch(D){M.error(D.message||t("notification.email.testfailed"))}}),z=$((a,T)=>{S.testReceiver=localStorage.getItem("test-receiver")||"",S.testReceiverError="",r.open({title:t("notification.email.testSendEmail"),content:()=>e.jsx(y,{sx:{width:"300px"},children:e.jsx(Q,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.email.inputTestReceiver"),value:S.testReceiver,onChange:O=>{S.testReceiver=O.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(O){const D=S.testReceiver?.trim();if(!D){S.testReceiverError=t("notification.email.receiverRequired");return}if(!_e(D)){S.testReceiverError=t("notification.email.receiverInvalid");return}S.testReceiverError="",await J(a,T,D),O()}})}),F=$(a=>{const T=a?.trim();return T?_e(T)?!0:t("notification.email.fromInvalid"):t("notification.email.fromRequired")}),B=$(a=>{const T=a?.trim();return T?He(T,{require_host:!1,protocols:[]})?!0:t("notification.email.hostInvalid"):t("notification.email.hostRequired")}),w=$(a=>a?Tn(a)?!0:t("notification.email.portInvalid"):t("notification.email.portRequired")),q=$(a=>a?.trim()?!0:t("notification.email.userRequired")),K=$(a=>a?.trim()?!0:t("notification.email.passwordRequired")),f=$(a=>a?.trim()&&!He(a,{protocols:["http","https"],require_protocol:!0})?t("notification.email.linkInvalid"):!0),R=$(a=>a?.trim()&&!_e(a)?t("notification.email.emailInvalid"):!0),C=$(()=>!0);return e.jsxs(y,{children:[e.jsxs(In,{component:"form",onSubmit:u(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(X,{title:t("notification.email.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:p,render:({field:a})=>e.jsx(me,{control:e.jsx(qe,{checked:a.value,...a})})})}),e.jsx(X,{title:t("notification.email.from"),children:e.jsx(Y,{name:"from",control:p,rules:{validate:j?F:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,label:t("notification.email.from"),error:!!i.errors[a.name],helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.host"),children:e.jsx(Y,{name:"host",control:p,rules:{validate:j?B:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:t("notification.email.host"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.port"),children:e.jsx(Y,{name:"port",control:p,rules:{validate:j?w:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:t("notification.email.port"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.user"),children:e.jsx(Y,{name:"user",control:p,rules:{validate:j?q:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:t("notification.email.user"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.password"),children:e.jsx(Y,{name:"password",control:p,rules:{validate:j?K:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:t("notification.email.password"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.secure"),children:e.jsx(Y,{name:"secure",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(me,{control:e.jsx(qe,{checked:a.value,...a,disabled:!j})})})})}),e.jsxs(ln,{children:[e.jsxs(cn,{expandIcon:e.jsx(qt,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[t("notification.email.signature"),e.jsx(ut,{title:t("notification.email.signatureTooltip"),children:e.jsx(Bt,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(dn,{children:[e.jsx(X,{title:t("notification.email.companyName"),children:e.jsx(Y,{name:"companyName",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyName"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.companyLink"),children:e.jsx(Y,{name:"companyLink",control:p,rules:{validate:j?f:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyLink"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.companyAddress"),children:e.jsx(Y,{name:"companyAddress",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyAddress"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.supportEmail"),children:e.jsx(Y,{name:"supportEmail",control:p,rules:{validate:j?R:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:t("notification.email.supportEmail"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})})]})]}),e.jsxs(y,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(ce,{variant:"outlined",color:"warning",onClick:u(z),disabled:!j,children:t("oauth.runTest")}),e.jsx(ce,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),o]})}const In=ae(mt)``,We={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function En(){const{api:n}=Ye(),{blocklet:s}=Ct(),{t}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,b=Object.assign({...We},s?.settings?.notification?.pushKit||{}),{handleSubmit:u,control:p,formState:i,watch:N,reset:I}=Rt({defaultValues:gt(b,Object.keys(We))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(w,q,K=!0)=>{try{const{blocklet:f}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:w})}}),R=Object.assign({...We},f?.settings?.notification?.pushKit||{});I(R),K&&M.success(t("oauth.saveSuccess"))}catch(f){if(K)M.error(f.message||t("oauth.saveFailed"));else throw f}}),J=$(async(w,q)=>{try{i.isDirty&&await E(w,q,!1);const K=(s?.configs||[]).find(C=>C.key==="BLOCKLET_APP_URL")?.value,f=Xt(Qt(K,_.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:s?.meta?.version,t:new Date(s?.updatedAt||0).getTime()}),R={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:s?.appDid,fullName:s?.meta?.title,avatar:f}}}};await n.sendPush({input:{did:l,receiver:S.testReceiver,notification:JSON.stringify(R)}}),M.success(t("notification.pushKit.testSuccess"))}catch(K){M.error(K.message||t("notification.pushKit.testfailed"))}}),z=$((w,q)=>{S.testReceiverError="",r.open({title:t("notification.pushKit.testSend"),content:()=>e.jsx(y,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(Q,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.pushKit.inputTestReceiver"),value:S.testReceiver,onChange:K=>{S.testReceiver=K.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(K){if(!S.testReceiver?.trim()){S.testReceiverError=t("notification.pushKit.receiverRequired");return}S.testReceiverError="",await J(w,q),K()}})}),F=$(w=>{const q=w?.trim();return q?He(q)?!0:t("notification.pushKit.endpointInvalid"):t("notification.pushKit.endpointRequired")}),B=$(()=>!0);return e.jsxs(y,{children:[e.jsxs(An,{component:"form",onSubmit:u(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(X,{title:t("notification.pushKit.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:p,render:({field:w})=>e.jsx(me,{control:e.jsx(qe,{checked:w.value,...w})})})}),e.jsx(X,{title:t("notification.pushKit.endpoint"),children:e.jsx(Y,{name:"endpoint",control:p,rules:{validate:j?F:B},render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...w,size:"small",required:!0,label:t("notification.pushKit.endpoint"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})})}),e.jsxs(X,{title:t("notification.pushKit.customOptions"),children:[e.jsx(Y,{name:"did",control:p,render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...w,size:"small",label:t("notification.pushKit.did"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})}),e.jsx(Y,{name:"pushPath",control:p,render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Q,{...w,size:"small",label:t("notification.pushKit.pushPath"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})})]}),e.jsxs(y,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(ce,{variant:"outlined",color:"warning",onClick:u(z),disabled:!j,children:t("oauth.runTest")}),e.jsx(ce,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),o]})}const An=ae(mt)``,ct=[{label:e.jsx(y,{sx:{textAlign:"center",width:"100%"},children:"Email"}),value:"email"},{label:e.jsx(y,{sx:{textAlign:"center",width:"100%"},children:"Push Kit"}),value:"pushKit"}];function kn(){const[n,s]=v.useState(ct[0].value),{locale:t}=v.useContext(en),r=se(()=>({email:e.jsx(Nn,{}),pushKit:e.jsx(En,{})}),[t]),o=v.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(y,{children:[e.jsx(bt,{tabs:ct,current:n,onChange:s}),e.jsx(y,{style:o,children:r[n]})]})}const At=v.createContext({}),{Provider:On,Consumer:Ws}=At;function Dn({children:n,blocklet:s=""}){const{api:t,inService:r,ws:{useSubscription:o}}=Ye(),[l,b]=v.useState([]),[u,p]=v.useState({total:0,pageSize:20,pageCount:0,page:1}),i=se(()=>s.meta?.did,[s]),[N,I]=v.useState([]),[S,j]=v.useState({}),E=se(()=>l.length?new Set(l.map(f=>f.id)):new Set,[l]),J=async({page:f=1,pageSize:R=20,...C}={})=>{if(!i)return[];try{const a={paging:{page:f,pageSize:R},...C,teamDid:i,dateRange:C.dateRange?[Z(C.dateRange[0]).toISOString(),Z(C.dateRange[1]).toISOString()]:void 0},{dids:T,...O}=a;let D="";T&&T.includes("system")&&(D="system");const re=T?T.filter(pe=>pe!=="system"):[],ue={...O,source:D,componentDids:re},oe=await t.getNotificationSendLog({input:ue});return j(ue),b(oe.list),p(oe.paging),oe.list}catch(a){return M.error(a.message),[]}},z=async()=>{const f=await t.getNotificationComponents({input:{teamDid:i}});I(f.componentDids)},F=v.useCallback(f=>{const R=s.children.find(C=>C.meta?.did===f);if(R)return R.ancestors=[s],R},[s]),B=async({notificationId:f,receivers:R,channels:C,...a})=>{await t.resendNotification({input:{teamDid:i,notificationId:f,receivers:R,channels:C.map(T=>T==="wallet"?_.NOTIFICATION_SEND_CHANNEL.WALLET:T==="pushKit"?_.NOTIFICATION_SEND_CHANNEL.PUSH:T),...a}})},w=v.useCallback(async f=>(await t.getUser({input:{teamDid:i,user:{did:f},options:{enableConnectedAccount:!0}}})).user,[t,i]),q=v.useCallback(async({page:f=1,pageSize:R=20,...C}={})=>{try{const a={paging:{page:f,pageSize:R},...C,userName:C.searchText||"",teamDid:i,dateRange:C.dateRange?[Z(C.dateRange[0]).toISOString(),Z(C.dateRange[1]).toISOString()]:void 0};return await t.getReceivers({input:a})}catch(a){throw M.error(a.message),a}},[t,i]);v.useEffect(()=>{i&&z()},[i]),o(_.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,f=>{E.has(f.notificationId)&&J(S)},[E,S]),o(_.EVENTS.NOTIFICATION_BLOCKLET_CREATE,f=>{E.has(f.id)||J(S)},[E,S]);const K={fetch:J,data:l,paging:u,blocklet:s,getComponent:F,resendNotification:B,getUser:w,componentDids:N,getReceivers:q,inService:r,teamDid:i};return e.jsx(On,{value:{notificationRecords:K},children:n})}function Xe(){const{notificationRecords:n}=v.useContext(At);return n}Ce.propTypes={severity:h.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ln={info:"primary",success:"success",error:"error",warning:"warning"};function Ce({severity:n="info"}){return e.jsx(tn,{type:Ln[n],children:n})}const Pn=(n,s,t="")=>{if(!t||!s)return"";switch(t){case _.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return t}};function kt(n,s,t={}){const{status:r,updatedAt:o,reason:l="",channel:b="wallet"}=t,u=o?n("notification.sendStatus.sentTime",{date:on(o,s)}):"",p=Pn(n,b,l);return r===_.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:u,reason:p}:r===_.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:n("notification.sendStatus.pending"),reason:p,sentTime:u}}const $e={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ve=["wallet","pushKit","email"],dt=["info","success","error","warning"],Ot=n=>{const{settings:s}=n;return s?.notification?.email?.enabled},Dt=n=>{const{settings:s}=n;return s?.notification?.pushKit?.enabled},Fn=(n,s)=>{const t=le(s,"extra.notifications.email",!0);return{available:Ot(n),enabled:t}},_n=(n,s)=>{const t=le(s,"extra.notifications.push",!0);return{available:Dt(n),enabled:t}},zn=n=>({enabled:le(n,"extra.notifications.wallet",!0)}),Wn=n=>({enabled:le(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(s=>{setTimeout(()=>{s()},n*1e3)}),Bn=(n,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:s}),fail:n("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:n("notification.sendStatus.reason.available",{channel:s}),fail:n("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:s}),fail:n("notification.sendStatus.reason.disabled",{channel:s})}]:[],Ae=(n=[])=>{const s=Z().startOf("day");return n.filter(t=>Z(t.sendAt).isSame(s,"day")).length},qn=(n,s="")=>{if(s&&Ve.includes(s)){const l=`${s}SendRecord`,b=le(n,l,[]);return Ae(b)}const t=le(n,"webhook",{}),r=Object.keys(t??{})??[];if(s&&r.includes(s)){const l=t[s]??[];return Ae(l)}const o={};return Ve.forEach(l=>{const b=`${l}SendRecord`,u=le(n,b,[]),p=Ae(u);o[l]=p}),r.length>0&&r.forEach(l=>{const b=t[l]??[],u=Ae(b);o[l]=u}),o},Oe=(n,s,t)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[t].splice(s,1),n},De=(n,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(n):!1},Kn=n=>{switch(n){case _.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case _.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case _.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case _.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Lt=()=>({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:s=!0,showTitle:t=!1,children:r=null}){const{status:o,title:l="",sentTime:b="",reason:u=""}=n,p=[l,u].filter(Boolean).join(", ");return e.jsx(ut,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:p}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(y,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(y,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(y,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:$e[o]}}),e.jsx(y,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:$e[o]}})]}),e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:t?l:r})]})})}de.propTypes={config:h.object.isRequired,enableTooltip:h.bool,showTitle:h.bool,children:h.node};Le.propTypes={list:h.array.isRequired,label:h.string.isRequired,onDelete:h.func};function Le({list:n,label:s,onDelete:t=()=>{}}){const{t:r,locale:o}=te();return e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),n.map(l=>{const b=kt(r,o,{status:l});return e.jsx(Je,{size:"small",label:e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(de,{config:b,enableTooltip:!1,children:b.title})}),onDelete:u=>t(u,l)},l)})]})}Qe.propTypes={filterList:h.array.isRequired,onChange:h.func.isRequired,index:h.number.isRequired,column:h.object.isRequired,filterValues:h.array.isRequired,label:h.string.isRequired,renderLabel:h.func.isRequired};function Qe({filterList:n,onChange:s,index:t,column:r,filterValues:o,label:l,renderLabel:b}){return e.jsxs(V,{className:"filter-container",children:[e.jsx(pt,{component:"legend",children:l}),e.jsx(Ke,{row:!0,children:o.map(u=>e.jsx(me,{control:e.jsx(Me,{checked:n[t].indexOf(u.value??u)>-1,onChange:p=>{const i=[...n];p.target.checked?i[t]=[...i[t],u.value??u]:i[t]=i[t].filter(N=>N!==(u.value??u)),s(i[t],t,r)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(u)})},u.value??u))})]})}function Be(n){return e.jsx(Qe,{...n,renderLabel:s=>e.jsx(de,{enableTooltip:!1,config:{status:s.status},children:s.label})})}xe.propTypes={status:h.number.isRequired,updatedAt:h.string.isRequired,reason:h.string,channel:h.string,onResend:h.func};function xe({status:n,updatedAt:s,reason:t="",channel:r="wallet",onResend:o}){const{t:l,locale:b}=te(),u=kt(l,b,{status:n,updatedAt:s,reason:t,channel:r});return e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(de,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(Fe,{className:"resend-btn",size:"small",startIcon:e.jsx(Ge,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}Ze.propTypes={value:h.array.isRequired,onChange:h.func};function Ze({value:n,onChange:s}){const{locale:t}=te(),r=Z().toDate(),[o,l]=v.useState(null),b=v.useCallback(i=>{l(o?null:i.currentTarget)},[o]),u=!!o,p=v.useCallback(i=>{if(!i.startDate||!i.endDate){M.error("Please select a date range");return}if(Z(i.startDate).isAfter(i.endDate)||!Z(i.startDate).isValid()||!Z(i.endDate).isValid()){M.error("Invalid date range");return}s([i.startDate,i.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(ee,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Fe,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[at(n[0],t)," - ",at(n[1],t)]})}),e.jsx(Ue,{open:u,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(jn,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:b,definedRanges:vn(r),onChange:p})})]})}et.propTypes={itemComponent:h.elementType.isRequired};function et({itemComponent:n,...s}){const{t}=te();return!s?.filterList?.filter(o=>o.length).length?null:e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:t("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(nn.TableFilterList,{...s,ItemComponent:n})})]})}function tt({label:n,onDelete:s,canDelete:t=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let l=!0;return t&&typeof t=="function"&&(l=t({label:n,...r})),e.jsx(Je,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}tt.propTypes={label:h.string.isRequired,onDelete:h.func,canDelete:h.func};const Mn=[{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}];Pt.propTypes={loading:h.bool,onCancel:h.func,onConfirm:h.func};function Pt({loading:n=!1,onCancel:s=()=>{},onConfirm:t=()=>{}}){const{t:r}=te(),[o,l]=v.useState(Mn),[b,u]=v.useState(!0),p=(N,I)=>{I.checked=N.target.checked;const S=o.map(j=>({...j,checked:j.value===I.value?I.checked:j.checked}));l(S)},i=N=>{N.stopPropagation(),t({channels:o.filter(I=>I.checked).map(I=>I.value),isResendFailedOnly:b})};return e.jsxs(y,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ee,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(y,{className:"choose-channel",children:e.jsxs(V,{component:"fieldset",variant:"standard",children:[e.jsx(pt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Ke,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(N=>e.jsx(me,{control:e.jsx(Me,{checked:N.checked,onChange:I=>p(I,N),name:N.value}),label:N.label},N.value))})]})}),e.jsx(y,{className:"resend-config-footer",children:e.jsx(Ke,{children:e.jsx(me,{control:e.jsx(Me,{checked:b,onChange:N=>u(N.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(y,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Fe,{onClick:N=>{N.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Fe,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(ft,{size:16}),r("common.confirm")]})]})]})}Ft.propTypes={notificationId:h.string.isRequired,handleResend:h.func,resending:h.bool};function Ft({notificationId:n,handleResend:s,resending:t=!1}){const{t:r,locale:o}=te(),l=ht(),b=v.useMemo(()=>jt(l,Lt()),[l]),{getReceivers:u,inService:p,teamDid:i,getUser:N,blocklet:I}=Xe(),[S,j]=v.useState(!1),[E,J]=v.useState([]),z=ye({anchorEl:null,position:null}),F=ye({anchorEl:null,position:null}),[B,w]=v.useState(null),[q,K]=v.useState({total:0,pageSize:10,pageCount:0,page:1}),[f,R]=v.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[Z().subtract(1,"month").startOf("day").toDate(),Z().endOf("day").toDate()]}),[C,a]=v.useState([]),T=[{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"}],O=async()=>{if(!S&&n)try{j(!0);const c=await u({notificationId:n,...f}),d=c.list.map(m=>({...m,receiverUser:{...m.receiverUser,avatar:It(m.receiverUser.avatar,i,p)}}));J(d),K(c.paging),j(!1)}catch(c){M.error(c.message),j(!1)}};v.useEffect(()=>{O()},[f]);const D=c=>{c.stopPropagation();const d=c.currentTarget;F.anchorEl=d;const m=d.getBoundingClientRect();F.position={top:m.top+window.scrollY,left:m.left+window.scrollX}},re=c=>c.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(ce,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Ge,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:D,children:r("notification.resend")})}):null,ue={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:q.page-1,rowsPerPage:q.pageSize,count:q.total,searchText:f.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:C,onRowSelectionChange:(c,d)=>{a(d.map(m=>m.dataIndex))},customToolbarSelect:re},oe=({page:c,rowsPerPage:d,searchText:m,filterList:k})=>{const[,U=[],ne=[],G=[]]=k;f.pageSize!==d?R(H=>({...H,pageSize:d,page:1})):f.page!==c+1?R(H=>({...H,page:c+1})):f.searchText!==m?R(H=>({...H,searchText:m,page:1})):je(U,f.walletSendStatus)?je(ne,f.pushKitSendStatus)?je(G,f.emailSendStatus)||R(H=>({...H,emailSendStatus:G,page:1})):R(H=>({...H,pushKitSendStatus:ne,page:1})):R(H=>({...H,walletSendStatus:U,page:1}))},pe=v.useCallback(async(c,d)=>{if(!d)return!1;const m=await N(d);return m?c==="wallet"?zn(m):c==="email"?Fn(I,m):c==="pushKit"?_n(I,m):c==="webhook"?Wn(m):!0:!1},[N,I]),we=v.useCallback(c=>Bn(r,c),[r]),fe=()=>{z.anchorEl=null,z.position=null,w(null)},he=()=>{F.anchorEl=null,F.position=null},g=async(c,d,m=!0,k="")=>{if(!(!d.length||!c.length))try{s(c,d,m,k),F.anchorEl||(await Ee(.5),fe())}catch(U){console.error("handleResend error",{error:U})}},x=async({channels:c,isResendFailedOnly:d})=>{const m=C.map(k=>E[k].receiver);await g(c,m,d),await Ee(.5),he(),a([])},A=async(c,d=[],m=!0)=>{try{await g(["webhook"],[c.receiver],m,d)}catch(k){M.error(k.response?k.response.statusText:k.message)}},L=async(c,d,m,k=[],U=!0)=>{if(c.stopPropagation(),qn(d,m)>=4){M.warning(r("notification.resendLimit"));return}if(!Ve.includes(m)){await A(d,k,U);return}if(c){const G=c.currentTarget,H=G.getBoundingClientRect();z.anchorEl=G,z.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}w({channel:m});try{const G=await pe(m,d.receiver);await Ee(1),w({channel:m,result:G}),(typeof G=="boolean"&&G||Zt(G)&&Object.values(G).every(H=>!!H))&&(await s([m],[d.receiver],U),F.anchorEl||(await Ee(.5),fe()))}catch(G){M.error(G.message)}},W=c=>{R(d=>({...d,dateRange:c,page:1}))},P=(c,d,m,k)=>{c.stopPropagation();const U=m.filter(ne=>ne!==d);R(ne=>({...ne,[k]:U,page:1}))},ie=se(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:c=>{const{receiverUser:d,receiver:m}=E[c];return d?e.jsxs(y,{"data-cy":`member-name-${d.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(vt,{src:`${d.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:m,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Se,{children:d.fullName})]},m):e.jsx(bn,{size:14,responsive:!1,compact:!0,copyable:!1,did:m})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:f.walletSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Wallet",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[1].options.filterList,"walletSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,k)=>e.jsx(Be,{label:"Wallet",filterList:c,onChange:d,index:m,column:k,filterValues:T})},customBodyRenderLite:c=>{const{walletSendStatus:d,walletSendAt:m,walletSendFailedReason:k}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:k,channel:"wallet",onResend:U=>L(U,E[c],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{pushKitSendStatus:d,pushKitSendAt:m,pushKitSendFailedReason:k}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:k,channel:"pushkit",onResend:U=>L(U,E[c],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:f.pushKitSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Push Kit",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[2].options.filterList,"pushKitSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,k)=>e.jsx(Be,{label:"Push Kit",filterList:c,onChange:d,index:m,column:k,filterValues:T})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{emailSendStatus:d,emailSendAt:m,emailSendFailedReason:k}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:k,channel:"email",onResend:U=>L(U,E[c],"email",[],!1)})},filter:!0,filterType:"custom",filterList:f.emailSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Email",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[3].options.filterList,"emailSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,k)=>e.jsx(Be,{label:"Email",filterList:c,onChange:d,index:m,column:k,filterValues:T})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{webhook:d}=E[c];if(!d)return null;const m=Object.entries(d)[0];if(!m)return null;const[k,U]=m,ne=U[0];return e.jsx(y,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(y,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(Se,{maxLength:30,children:k},k),e.jsx(xe,{status:ne.status,updatedAt:ne.sendAt,reason:ne.failedReason,channel:"webhook",onResend:G=>L(G,E[c],"webhook",[k],!1)})]},k)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:c=>{const{createdAt:d}=E[c];return e.jsx(Nt,{value:d,locale:o,shouldUpdate:!0})}}}],[E,o,f,r]),Re=[e.jsx(Ze,{value:f.dateRange,onChange:W},"date-picker"),e.jsx(ce,{variant:"contained",size:"small",color:"primary",loading:S,startIcon:e.jsx(Kt,{}),onClick:()=>O(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(y,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(Hn,{children:e.jsxs(xt,{theme:b,children:[e.jsx(yt,{className:"receivers-table",locale:o,loading:S,columns:ie,data:E,onChange:oe,options:ue,customButtons:Re,components:{TableFilterList:c=>e.jsx(et,{...c,itemComponent:d=>e.jsx(tt,{...d,canDelete:()=>!1})})}}),z.anchorEl&&e.jsx(Ue,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:fe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs($n,{children:[e.jsxs(ee,{variant:"body1",component:"div",className:"check-title",children:[B?.channel," Checking"]}),e.jsx(y,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:we(B?.channel).map(c=>{const{type:d,pass:m,fail:k}=c;return!B?.result||B?.result?.[d]?e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:B?.result?.[d]?ke.success.main:"inherit"},children:[B?.result?e.jsx(Mt,{}):e.jsx(ft,{size:12,sx:{color:ke.primary.main}}),e.jsx("span",{children:m})]},d):e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:ke.error.main},children:[e.jsx(Ut,{}),e.jsx("span",{children:k})]},d)})})]})}),F.anchorEl&&e.jsx(Ue,{open:!!F.anchorEl,anchorReference:"anchorPosition",anchorPosition:F.position,onClose:he,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Pt,{loading:t,onCancel:he,onConfirm:x})})]})})})}const Un=v.memo(Ft),Hn=ae.div`
2
2
  td.MuiTableCell-footer {
3
3
  border: none !important;
4
4
  }
@@ -1,4 +1,4 @@
1
- import{W as o,j as n,ak as h,f as y,bh as q,av as w,D as I}from"./vendor-mui-core-BFPsXaTR.js";import{r as $}from"./vendor-react-Dvs43sk9.js";import{l as k,aa as W,V as A,m as B,X as H}from"./vendor-ux-CE4sOH7O.js";import{aW as V,a_ as Y,a$ as P,b0 as C,k as X,b1 as Z,b2 as G,b3 as J,al as K,b4 as N,b5 as Q}from"./index-CmM1Fb8I.js";import{Y as U,I as ee,Z as ne}from"./vendor-utils-OrZFrHBP.js";import{a as oe}from"./vendor-hooks-DmThWyyG.js";function z({name:e="",logo:t="",description:i="",...c}){if(!e&&!t&&!i)return null;const d=$.isValidElement(t)?t:n.jsx("img",{src:t,alt:e});return n.jsxs(te,{...c,children:[n.jsxs("div",{children:[t&&n.jsx(h,{component:"a",href:"/",className:"footer-brand-logo",children:d}),e&&n.jsx("div",{className:"footer-brand-name",children:e})]}),i&&n.jsx("div",{className:"footer-brand-desc",children:i})]})}z.propTypes={name:o.node,logo:o.node,description:o.string};const te=k("div")`
1
+ import{W as o,j as n,ak as h,f as y,bh as q,av as w,D as I}from"./vendor-mui-core-BFPsXaTR.js";import{r as $}from"./vendor-react-Dvs43sk9.js";import{l as k,aa as W,V as A,m as B,X as H}from"./vendor-ux-CE4sOH7O.js";import{aW as V,a_ as Y,a$ as P,b0 as C,k as X,b1 as Z,b2 as G,b3 as J,al as K,b4 as N,b5 as Q}from"./index-3yzleS_1.js";import{Y as U,I as ee,Z as ne}from"./vendor-utils-OrZFrHBP.js";import{a as oe}from"./vendor-hooks-DmThWyyG.js";function z({name:e="",logo:t="",description:i="",...c}){if(!e&&!t&&!i)return null;const d=$.isValidElement(t)?t:n.jsx("img",{src:t,alt:e});return n.jsxs(te,{...c,children:[n.jsxs("div",{children:[t&&n.jsx(h,{component:"a",href:"/",className:"footer-brand-logo",children:d}),e&&n.jsx("div",{className:"footer-brand-name",children:e})]}),i&&n.jsx("div",{className:"footer-brand-desc",children:i})]})}z.propTypes={name:o.node,logo:o.node,description:o.string};const te=k("div")`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  font-size: 14px;
@@ -1 +1 @@
1
- import{j as t,ak as s,T as n,W as i}from"./vendor-mui-core-BFPsXaTR.js";import{V as f}from"./vendor-ux-CE4sOH7O.js";import{L as g,r as k}from"./vendor-react-Dvs43sk9.js";import"./index-CmM1Fb8I.js";import"./vendor-utils-OrZFrHBP.js";import"./vendor-hooks-DmThWyyG.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DGOH9a3F.js";const l=(e,o)=>[e,...Array.isArray(o)?o:[o]],a=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function p({sx:e={},...o}){const r=l({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}p.propTypes={sx:i.object};function w({icon:e}){const[o,r]=k.useState(!1);return!e||o?null:typeof e=="string"?t.jsx(s,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>r(!0)}):e}w.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function b({title:e,desc:o,extra:r,cover:c,icon:d,to:x,sx:h}){const m=l({position:"relative",flexBasis:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},maxWidth:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},mb:{xs:2,md:6},px:1},h);return t.jsx(s,{sx:m,children:t.jsx(s,{component:g,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:t.jsxs(s,{children:[t.jsxs(s,{sx:{position:"relative"},children:[c,d&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:d})})]}),t.jsx(n,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...a()},children:e}),o&&t.jsx(n,{variant:"body2",sx:{my:1,...a(),color:"text.secondary"},children:o}),r]})})})}b.propTypes={title:i.string.isRequired,desc:i.string.isRequired,extra:i.node.isRequired,cover:i.string.isRequired,icon:i.string.isRequired,to:i.string.isRequired,sx:i.object.isRequired};const j=""+window.__toCdnUrl("assets/doc-board-bg-DWZHV9Ng.png");function u({board:e,sx:o,...r}){return t.jsx(b,{date:e.createdAt,sx:o,to:e.link,title:e.title,desc:e.desc,cover:t.jsx(s,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:t.jsx(s,{component:"img",src:j,alt:"",sx:{position:"absolute",top:0,left:0,width:1,filter:c=>c.palette.mode==="dark"?"brightness(0.28) contrast(1.1)":"none"}})}),icon:e.icon,...r})}u.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function I(){const{locale:e}=f(),o=[{id:"1",title:"Blocklet Platform",desc:"Guide to understand and build on our blocklet platform",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/blocklet-developer/${e}/getting-started`},{id:"2",title:"Create Blocklet",desc:"Build blocklet with just one command line.",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/createblocklet/${e}/quick-start`},{id:"3",title:"Blocklet Launcher",desc:"Streamlining Blocklet Launching.",icon:"https://www.arcblock.io/docs/uploads/5a4f4716bc8061532a535fe816a9169c.png",link:`https://www.arcblock.io/docs/launcher/${e}/launcher-welcome`},{id:"4",title:"DID Spaces",desc:"Digital Spaces for Decentralized Identity (DID)",icon:"https://www.arcblock.io/docs/uploads/3a8b142d7c940c57eced71eddba2ff19.png",link:`https://www.arcblock.io/docs/did-spaces/${e}/did-spaces-getting-started`},{id:"5",title:"DID Wallet",desc:"DID Wallet Support docs",icon:"https://www.arcblock.io/docs/uploads/59ddb28f405ee670428e5fe1ff12d104.png",link:`https://www.arcblock.io/docs/did-wallet/${e}/get-started`},{id:"6",title:"DID Names",desc:"Naming Service based on NFT and verifiable credentials",icon:"https://www.didnames.io/favicon.ico?imageFilter=resize&w=32",link:`https://www.arcblock.io/docs/did-domain/${e}/did-domain-faq`},{id:"7",title:"Blockchain",desc:"The ledger for ArcBlock ecosystem",icon:"https://www.arcblock.io/docs/uploads/4a20c152faae0f104ed0815ff3b8b48b.png",link:`https://www.arcblock.io/docs/blockchain/${e}/blockchain-how-to-guides`},{id:"8",title:"DID Connect",desc:"The open protocol and development kit for connecting users and dapps",icon:"https://www.arcblock.io/docs/uploads/d189118f89b56e9d5b03ad5a0212a4ab.png",link:`https://www.arcblock.io/docs/did-connect/${e}/developer-guides`}];return t.jsx(p,{children:o.map(r=>t.jsx(u,{board:r},r.id))})}export{I as default};
1
+ import{j as t,ak as s,T as n,W as i}from"./vendor-mui-core-BFPsXaTR.js";import{V as f}from"./vendor-ux-CE4sOH7O.js";import{L as g,r as k}from"./vendor-react-Dvs43sk9.js";import"./index-3yzleS_1.js";import"./vendor-utils-OrZFrHBP.js";import"./vendor-hooks-DmThWyyG.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DGOH9a3F.js";const l=(e,o)=>[e,...Array.isArray(o)?o:[o]],a=(e=2)=>({overflow:"hidden",textOverflow:"ellipsis",wordBreak:"break-word",display:"-webkit-box",WebkitLineClamp:e,WebkitBoxOrient:"vertical"});function p({sx:e={},...o}){const r=l({display:"flex",flexWrap:"wrap",mx:-1},e);return t.jsx(s,{sx:r,...o})}p.propTypes={sx:i.object};function w({icon:e}){const[o,r]=k.useState(!1);return!e||o?null:typeof e=="string"?t.jsx(s,{component:"img",src:e,alt:"",sx:{width:1,height:1},onError:()=>r(!0)}):e}w.propTypes={icon:i.oneOfType([i.string,i.node]).isRequired};function b({title:e,desc:o,extra:r,cover:c,icon:d,to:x,sx:h}){const m=l({position:"relative",flexBasis:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},maxWidth:{xs:"100%",sm:"50%",md:"33.33%",lg:"25%"},mb:{xs:2,md:6},px:1},h);return t.jsx(s,{sx:m,children:t.jsx(s,{component:g,to:x,target:"_blank",sx:{display:"flex",flexDirection:"column",gap:1,height:1,pt:0,color:"inherit",textDecoration:"none",borderRadius:1,cursor:"pointer"},children:t.jsxs(s,{children:[t.jsxs(s,{sx:{position:"relative"},children:[c,d&&t.jsx(s,{sx:{position:"absolute",top:44,left:16,zIndex:1,width:56,height:56},children:t.jsx(w,{icon:d})})]}),t.jsx(n,{sx:{mt:1,fontSize:"1.25rem",fontWeight:600,...a()},children:e}),o&&t.jsx(n,{variant:"body2",sx:{my:1,...a(),color:"text.secondary"},children:o}),r]})})})}b.propTypes={title:i.string.isRequired,desc:i.string.isRequired,extra:i.node.isRequired,cover:i.string.isRequired,icon:i.string.isRequired,to:i.string.isRequired,sx:i.object.isRequired};const j=""+window.__toCdnUrl("assets/doc-board-bg-DWZHV9Ng.png");function u({board:e,sx:o,...r}){return t.jsx(b,{date:e.createdAt,sx:o,to:e.link,title:e.title,desc:e.desc,cover:t.jsx(s,{sx:{position:"relative",paddingTop:`${9/16*100}%`,border:1,borderColor:"divider",borderRadius:1,overflow:"hidden"},children:t.jsx(s,{component:"img",src:j,alt:"",sx:{position:"absolute",top:0,left:0,width:1,filter:c=>c.palette.mode==="dark"?"brightness(0.28) contrast(1.1)":"none"}})}),icon:e.icon,...r})}u.propTypes={board:i.object.isRequired,sx:i.object.isRequired};function I(){const{locale:e}=f(),o=[{id:"1",title:"Blocklet Platform",desc:"Guide to understand and build on our blocklet platform",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/blocklet-developer/${e}/getting-started`},{id:"2",title:"Create Blocklet",desc:"Build blocklet with just one command line.",icon:"https://www.arcblock.io/favicon.ico",link:`https://www.arcblock.io/docs/createblocklet/${e}/quick-start`},{id:"3",title:"Blocklet Launcher",desc:"Streamlining Blocklet Launching.",icon:"https://www.arcblock.io/docs/uploads/5a4f4716bc8061532a535fe816a9169c.png",link:`https://www.arcblock.io/docs/launcher/${e}/launcher-welcome`},{id:"4",title:"DID Spaces",desc:"Digital Spaces for Decentralized Identity (DID)",icon:"https://www.arcblock.io/docs/uploads/3a8b142d7c940c57eced71eddba2ff19.png",link:`https://www.arcblock.io/docs/did-spaces/${e}/did-spaces-getting-started`},{id:"5",title:"DID Wallet",desc:"DID Wallet Support docs",icon:"https://www.arcblock.io/docs/uploads/59ddb28f405ee670428e5fe1ff12d104.png",link:`https://www.arcblock.io/docs/did-wallet/${e}/get-started`},{id:"6",title:"DID Names",desc:"Naming Service based on NFT and verifiable credentials",icon:"https://www.didnames.io/favicon.ico?imageFilter=resize&w=32",link:`https://www.arcblock.io/docs/did-domain/${e}/did-domain-faq`},{id:"7",title:"Blockchain",desc:"The ledger for ArcBlock ecosystem",icon:"https://www.arcblock.io/docs/uploads/4a20c152faae0f104ed0815ff3b8b48b.png",link:`https://www.arcblock.io/docs/blockchain/${e}/blockchain-how-to-guides`},{id:"8",title:"DID Connect",desc:"The open protocol and development kit for connecting users and dapps",icon:"https://www.arcblock.io/docs/uploads/d189118f89b56e9d5b03ad5a0212a4ab.png",link:`https://www.arcblock.io/docs/did-connect/${e}/developer-guides`}];return t.jsx(p,{children:o.map(r=>t.jsx(u,{board:r},r.id))})}export{I as default};