@abtnode/blocklet-services 1.16.45-beta-20250702-072658-6f6c82be → 1.16.45

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 (44) hide show
  1. package/dist/assets/access-control-5WGT2JfR.js +1 -1
  2. package/dist/assets/add-component-core-DehB4lvu.js +1 -1
  3. package/dist/assets/add-resource-DfqBSLDk.js +1 -1
  4. package/dist/assets/advanced-CJz1c7Eh.js +1 -1
  5. package/dist/assets/appearance-DsoglxbB.js +1 -1
  6. package/dist/assets/audit-logs-DKiQkfse.js +1 -1
  7. package/dist/assets/complete-Bi_BaBBl.js +1 -1
  8. package/dist/assets/component-CiFJ1vhL.js +1 -1
  9. package/dist/assets/config-JUGJKWP_.js +1 -1
  10. package/dist/assets/config-navigation-DZ54_nVv.js +1 -1
  11. package/dist/assets/connect-DhuiCF4g.js +1 -1
  12. package/dist/assets/dashboard-t9EszOna.js +2 -2
  13. package/dist/assets/domain-BaMcm6r6.js +1 -1
  14. package/dist/assets/email-0b_MYxBQ.js +1 -1
  15. package/dist/assets/exchange-passport-BnmyuwIs.js +1 -1
  16. package/dist/assets/fuel-DEqW116b.js +1 -1
  17. package/dist/assets/index-6I6juqjg.js +1 -1
  18. package/dist/assets/index-B4fH-l5R.js +1 -1
  19. package/dist/assets/index-B70kYOfj.js +1 -1
  20. package/dist/assets/index-B874LN5A.js +1 -1
  21. package/dist/assets/index-CD07vq9d.js +1 -1
  22. package/dist/assets/index-CkwXRCmN.js +1 -1
  23. package/dist/assets/index-CwUT0vPy.js +1 -1
  24. package/dist/assets/index-Dq1Rmjwf.js +1 -1
  25. package/dist/assets/index-I1i2Mc1k.js +1 -1
  26. package/dist/assets/index-YaLWfp9D.js +1 -1
  27. package/dist/assets/index-ZcD1N43m.js +1 -1
  28. package/dist/assets/invite-jaOwIvW9.js +1 -1
  29. package/dist/assets/issue-passport-DpSBB2L8.js +1 -1
  30. package/dist/assets/item-D-39k2FC.js +1 -1
  31. package/dist/assets/list-ZFC0mCy0.js +1 -1
  32. package/dist/assets/login-DbSs2lO2.js +1 -1
  33. package/dist/assets/lost-passport-Ce_WXcnR.js +1 -1
  34. package/dist/assets/open-window-hpzKFxn5.js +1 -1
  35. package/dist/assets/overview-C3aIT8Ro.js +1 -1
  36. package/dist/assets/publish-resource-CAZrBTdz.js +1 -1
  37. package/dist/assets/runtime-Drmh1-cb.js +1 -1
  38. package/dist/assets/security-BPd4v9z4.js +1 -1
  39. package/dist/assets/setup-Bo10IVJ4.js +2 -2
  40. package/dist/assets/start-C9Hvgbcz.js +1 -1
  41. package/dist/assets/step-actions-BNbc1l8F.js +1 -1
  42. package/dist/assets/table-tips-BzPqsKYQ.js +1 -1
  43. package/dist/assets/use-server-logo-UTr-CyJD.js +1 -1
  44. package/package.json +23 -23
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/log-BBUgs8Rd.js","assets/vendor-mui-core-Bq8gXTan.js","assets/vendor-react-DEoibe3W.js","assets/useLocalStorage-CaPDqrQ7.js","assets/vendor-ux-did-connect-pzpsrvqx.js","assets/vendor-utils-BfZ4tlod.js","assets/vendor-hooks-DqdmWCmo.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/index-CwUT0vPy.js","assets/vendor-arcblock-CwufDgLV.js","assets/index-DOq-_YXu.css","assets/Download-D4X39_9V.js","assets/bundle-avatar-UIbxwQif.js","assets/log-D33dFtt_.css","assets/index-YaLWfp9D.js","assets/ViewList-BOGcbymi.js","assets/index-BLfUtUpB.js","assets/did-address-NnOD1W_A.js","assets/permission-DQvXGutX.js","assets/session-BGdAM8zS.js","assets/click-to-copy-By4fgGR7.js","assets/index-DrTNV3tX.js","assets/vendor-mui-x-1nqAyytV.js","assets/AdapterDayjs-BRnJ9bMs.js","assets/index-8eXqqyHQ.js","assets/useAsync-C62uE2pS.js","assets/index-DPIWnhb5.js","assets/DeleteOutline-BKSMNwfT.js","assets/confirm-RvA9mFot.js","assets/util-BQAJqeb4.js","assets/base32-DUSifB4M.js","assets/sdk-BmeKtHic.js","assets/actions-DnTVXQ_Z.js","assets/MoreHoriz-ChJ3K52h.js","assets/shorten-label-BQvbtscf.js","assets/PlayArrow-BqVYRyLK.js","assets/get-safe-url-B0-S5PGZ.js","assets/use-blocklet-logo-4UB-MFD3.js","assets/InfoOutlined-BVWbftGI.js","assets/dot-4jhL56kz.js","assets/useSetState-CWq0AVWn.js","assets/use-mobile-CtTQsfXN.js","assets/index-Dq1Rmjwf.js","assets/use-mobile-DwzRjjku.js","assets/ExpandLess-CcLTbsdW.js","assets/table-tips-BzPqsKYQ.js","assets/index-CkwXRCmN.js","assets/Error-BAEKW7-e.js","assets/empty-spinner-BHwHZpq-.js","assets/list-header-C7gle0n0.js","assets/QuestionMarkCircle-jbhclAfX.js","assets/index-DVQCgvFb.js","assets/Launch-DFS3fgjy.js","assets/index-DEZojGsm.js","assets/api-C1S8LUld.js","assets/ChevronRight-BU9I7WD4.js","assets/react-beautiful-dnd.esm-02tdagHZ.js","assets/raf-schd.esm-B3j6BePR.js","assets/item-D-39k2FC.js","assets/Done-ASNftAOL.js","assets/delete-confirm-wTMDQFnr.js","assets/ArrowDropDown-DBJPIOl4.js","assets/index-CTlzm-Mc.js","assets/index-C0Iiqot3.css","assets/index-Bv7OAPJU.js","assets/overview-C3aIT8Ro.js","assets/keyboard-arrow-down-rounded-DadBVmpO.js","assets/status-f3Y-NXRP.js","assets/omit-Cao4GLS7.js","assets/spaces-DUkzPTBd.js","assets/domains-CxJF-JF_.js","assets/domain-action-card-BlPWBOAu.js","assets/util-BRPRFc9p.js","assets/CheckCircle-DUJmWceY.js","assets/index-ZcD1N43m.js","assets/passport-item-B3XIp0U4.js","assets/Google-C28yeMZW.js","assets/cloneDeep-CDl5kZTY.js","assets/EditIcon-DfiDnAsm.js","assets/LockIcon-BEG59s5q.js","assets/appearance-DsoglxbB.js","assets/audit-logs-DKiQkfse.js","assets/index-B4fH-l5R.js","assets/collapse-DAaiuAEY.js","assets/section-BDMQAX_r.js","assets/list-DDNORnll.js","assets/traffic-FNLLya21.js","assets/iframe-DFg8oeD0.js","assets/LaunchOutlined-C1x4Og4u.js","assets/ChevronLeft-BBJJJhVi.js","assets/index-B2NkqENf.js","assets/base-chart-CoApVzod.js","assets/index-w4f-mlFt.js","assets/config-navigation-DZ54_nVv.js","assets/index-BxJZWVOT.js","assets/slicedToArray-DFQjSbCD.js","assets/simple-select-0cjVFuay.js","assets/index-6I6juqjg.js","assets/connect-to-CxoBjkcK.js","assets/config-space-D6ScnWdA.js","assets/switch-control-Brwb8ptk.js","assets/index-CD07vq9d.js","assets/security-BPd4v9z4.js","assets/config-BZuiK8BP.js","assets/branding-CwYIeBi1.js","assets/sanitize-e0A8A-yt.js","assets/logo-uploader-BPSmPaZd.js","assets/advanced-CJz1c7Eh.js","assets/runtime-Drmh1-cb.js","assets/index-I1i2Mc1k.js","assets/Edit-CiTb-w5P.js","assets/list-ZFC0mCy0.js","assets/index-B70kYOfj.js","assets/component-CiFJ1vhL.js","assets/TuneOutlined-CKzi_VZZ.js","assets/add-component-core-DehB4lvu.js","assets/launch-result-message-AharZGq2.js","assets/page-header-DNvUdNpI.js","assets/index-Cwq0Io0K.js","assets/content-layout-BC2QkTYi.js","assets/search-4YYphs0l.js","assets/add-component-core-D-IRi6XF.css","assets/index-aAlnaECr.js"])))=>i.map(i=>d[i]);
2
- import{r as F,bd as fs,bb as Lt,be as ps,B as Dt,k as M,a8 as vn,a3 as Z,a as Y,at as ms,n as Hn,m as hs,d as gs,i as xs,aR as vs,D as Le,a1 as Pt,bf as ys,bg as bs,I as ws,F as Je,bh as js,_ as D,ax as Ss,a5 as _s}from"./vendor-ux-did-connect-pzpsrvqx.js";import{H as v,j as o,a9 as V,ah as G,I as Rt,at as Cs,ak as At,X as Mt,q as Is,b7 as Es,ab as re,b8 as ks,bw as Ts,T as H,bu as Ls,bs as yn,bv as bn,aa as _,bI as Ds,v as X,a7 as it,bJ as Ps,e as ee,ae as Rs,bf as As,ap as Se,bK as Bn,ad as Ee,bL as Ms,au as $s,ai as Os,bM as Fn,bN as Vn,bO as qn,E as ae,b6 as Wn,y as Ns,bh as Us}from"./vendor-mui-core-Bq8gXTan.js";import{r as x,L as Kn,f as Gn,g as zs,u as Hs,l as Bs}from"./vendor-react-DEoibe3W.js";import{D as at,f as N,E as ft,F as Fs,b as Vs,G as qs,H as Ws,I as Qn,y as me,J as Zn,K as Ks,k as ve,L as Gs,M as Qs,u as Zs,l as wn,Q as jn,g as Xs,j as Js,q as Ys,n as be,m as eo,o as to,P as no,O as ro,R as We,e as He,T as so,U as oo,V as io,N as ao,W as co,c as Sn}from"./index-CwUT0vPy.js";import{ag as lo,A as he,ah as uo,z as Xn,b as Ke,ai as fo}from"./vendor-utils-BfZ4tlod.js";import{_ as _n}from"./useLocalStorage-CaPDqrQ7.js";import{f as $t}from"./index-8eXqqyHQ.js";import{c as ce,u as Ye,p as po,h as et,f as Jn,e as mo,E as ho,g as go,H as xo,R as vo}from"./vendor-arcblock-CwufDgLV.js";import{C as Cn}from"./confirm-RvA9mFot.js";import{d as yo}from"./PlayArrow-BqVYRyLK.js";import{g as In}from"./get-safe-url-B0-S5PGZ.js";import{u as Yn}from"./session-BGdAM8zS.js";import{b as ge,x as bo}from"./vendor-hooks-DqdmWCmo.js";import{i as wo,u as jo,M as So,c as ke,s as tt,H as _o,a as Co}from"./use-blocklet-logo-4UB-MFD3.js";import{d as Io}from"./InfoOutlined-BVWbftGI.js";import{_ as er,D as Eo}from"./dot-4jhL56kz.js";import{_ as tr}from"./useSetState-CWq0AVWn.js";import{u as ko}from"./use-mobile-CtTQsfXN.js";const nr=x.createContext({});function Ot({children:e,type:t}){const[n,r]=x.useState([]),s=x.useRef([]),a=l=>{if(!s.current.includes(l)){const u=[...s.current,l];r(u),s.current=u}},i=l=>{if(s.current.includes(l)){const u=s.current.filter(d=>d!==l);r(u),s.current=u}},c=l=>{const u=n.filter(p=>l.find(f=>f===p));lo(u,n).forEach(p=>i(p))};return o.jsx(nr.Provider,{value:{type:t,deletingBlocklets:n,addDeletingDid:a,removeDeletingDid:i,matchDeletingDid:c},children:e})}Ot.propTypes={type:v.string,children:v.node.isRequired};Ot.defaultProps={type:"blocklets"};function Ll(){return x.useContext(nr)}var Nt={},To=V;Object.defineProperty(Nt,"__esModule",{value:!0});var rr=Nt.default=void 0,Lo=To(F()),Do=o;rr=Nt.default=(0,Lo.default)((0,Do.jsx)("path",{d:"M6 6h12v12H6z"}),"Stop");var Ut={},Po=V;Object.defineProperty(Ut,"__esModule",{value:!0});var sr=Ut.default=void 0,Ro=Po(F()),Ao=o;sr=Ut.default=(0,Ro.default)((0,Ao.jsx)("path",{d:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8"}),"Replay");var zt={},Mo=V;Object.defineProperty(zt,"__esModule",{value:!0});var or=zt.default=void 0,$o=Mo(F()),Oo=o;or=zt.default=(0,$o.default)((0,Oo.jsx)("path",{d:"M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6m6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26"}),"Autorenew");var Ht={},No=V;Object.defineProperty(Ht,"__esModule",{value:!0});var ir=Ht.default=void 0,Uo=No(F()),zo=o;ir=Ht.default=(0,Uo.default)((0,zo.jsx)("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}),"Settings");var Bt={},Ho=V;Object.defineProperty(Bt,"__esModule",{value:!0});var ar=Bt.default=void 0,Bo=Ho(F()),Fo=o;ar=Bt.default=(0,Bo.default)((0,Fo.jsx)("path",{d:"M18 17H6v-2h12zm0-4H6v-2h12zm0-4H6V7h12zM3 22l1.5-1.5L6 22l1.5-1.5L9 22l1.5-1.5L12 22l1.5-1.5L15 22l1.5-1.5L18 22l1.5-1.5L21 22V2l-1.5 1.5L18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2 4.5 3.5 3 2z"}),"Receipt");var Ft={},Vo=V;Object.defineProperty(Ft,"__esModule",{value:!0});var cr=Ft.default=void 0,qo=Vo(F()),Wo=o;cr=Ft.default=(0,qo.default)((0,Wo.jsx)("path",{d:"M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5"}),"Group");var Vt={},Ko=V;Object.defineProperty(Vt,"__esModule",{value:!0});var lr=Vt.default=void 0,Go=Ko(F()),Qo=o;lr=Vt.default=(0,Go.default)((0,Qo.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20m6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9"}),"NotInterested");var qt=function(e){return o.jsx("svg",{...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.32989 8.20744C11.2787 6.82349 13.6098 6.08 16 6.08C18.3902 6.08 20.7213 6.82349 22.6701 8.20744C24.6189 9.59139 26.089 11.5473 26.8766 13.804C27.6642 16.0607 27.7304 18.5066 27.0659 20.8026C26.4419 22.9587 25.2026 24.8823 23.5044 26.3404H8.49555C6.79735 24.8823 5.55809 22.9587 4.9341 20.8026C4.26961 18.5066 4.33575 16.0607 5.12337 13.804C5.91098 11.5473 7.38107 9.59139 9.32989 8.20744ZM16 3.52C13.0786 3.52 10.2295 4.42871 7.84764 6.1202C5.46575 7.81169 3.66898 10.2022 2.70634 12.9604C1.7437 15.7187 1.66286 18.708 2.47501 21.5143C3.28717 24.3205 4.95211 26.8046 7.23909 28.6224C7.46554 28.8024 7.74628 28.9004 8.03554 28.9004H23.9644C24.2537 28.9004 24.5344 28.8024 24.7609 28.6224C27.0479 26.8046 28.7128 24.3205 29.5249 21.5143C30.3371 18.708 30.2563 15.7187 29.2936 12.9604C28.331 10.2022 26.5342 7.81169 24.1523 6.1202C21.7704 4.42871 18.9214 3.52 16 3.52ZM21.8829 13.5921C22.3827 13.0923 22.3827 12.2818 21.8829 11.7819C21.383 11.2821 20.5725 11.2821 20.0727 11.7819L17.868 13.9866C17.3072 13.7012 16.6724 13.5404 16 13.5404C13.7221 13.5404 11.8755 15.3869 11.8755 17.6648C11.8755 19.9427 13.7221 21.7892 16 21.7892C18.2779 21.7892 20.1244 19.9427 20.1244 17.6648C20.1244 16.9924 19.9635 16.3576 19.6782 15.7968L21.8829 13.5921ZM14.4355 17.6648C14.4355 16.8008 15.136 16.1004 16 16.1004C16.864 16.1004 17.5644 16.8008 17.5644 17.6648C17.5644 18.5288 16.864 19.2292 16 19.2292C15.136 19.2292 14.4355 18.5288 14.4355 17.6648Z",fill:"currentColor"})})};qt.defaultProps={width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"};qt.displayName="dashboard";var Wt={},Zo=V;Object.defineProperty(Wt,"__esModule",{value:!0});var ur=Wt.default=void 0,Xo=Zo(F()),Jo=o;ur=Wt.default=(0,Xo.default)((0,Jo.jsx)("path",{d:"m18.25 7.6-5.5-3.18c-.46-.27-1.04-.27-1.5 0L5.75 7.6c-.46.27-.75.76-.75 1.3v6.35c0 .54.29 1.03.75 1.3l5.5 3.18c.46.27 1.04.27 1.5 0l5.5-3.18c.46-.27.75-.76.75-1.3V8.9c0-.54-.29-1.03-.75-1.3M7 14.96v-4.62l4 2.32v4.61zm5-4.03L8 8.61l4-2.31 4 2.31zm1 6.34v-4.61l4-2.32v4.62zM7 2H3.5C2.67 2 2 2.67 2 3.5V7h2V4h3zm10 0h3.5c.83 0 1.5.67 1.5 1.5V7h-2V4h-3zM7 22H3.5c-.83 0-1.5-.67-1.5-1.5V17h2v3h3zm10 0h3.5c.83 0 1.5-.67 1.5-1.5V17h-2v3h-3z"}),"ViewInAr");const pe={Start:yo,Stop:rr,Restart:sr,Reload:or,Remove:fs,Config:ir,Log:ar,Group:cr,Cancel:lr,Dashboard:qt,Overview:ur},Yo=(e,t)=>{if(!e)return"";if(!t)return e;const n=new URL(e),r=new URLSearchParams(n.searchParams),s=new URL(he(n.origin,t));return s.search=r.toString(),s.toString()},ei="internal",ti="external";function Kt({blocklet:e,onStart:t,onComplete:n,variant:r,hasPermission:s,getComponentUrl:a,useBlockletUrlEvaluation:i,...c}){const l=at(),[u,d]=x.useState(null),[p,f]=x.useState(null),[y,g]=x.useState(!1),[h,S]=x.useState(null),{t:m}=x.useContext(Lt),[C]=_n("skip-blocklet-setup",!1),{loading:w,recommendedUrl:L}=i(e),[R]=_n("blocklet-type-filter",ei),j=N.isInProgress(e.status),[k,E]=x.useState(!1);x.useEffect(()=>{var A,B;if(!(e!=null&&e.controller))return;E(((B=(A=e==null?void 0:e.controller)==null?void 0:A.status)==null?void 0:B.value)===ce.BLOCKLET_CONTROLLER_STATUS.suspended),(async()=>{var q,te,oe;try{const W=await l.api.getLauncherSession({input:{launcherSessionId:(q=e==null?void 0:e.controller)==null?void 0:q.launcherSessionId,launcherUrl:(te=e==null?void 0:e.controller)==null?void 0:te.launcherUrl}});if(W!=null&&W.error){console.error("get launcher session failed",W.error);return}E([M.LAUNCH_SESSION_STATUS.overdue,M.LAUNCH_SESSION_STATUS.canceled,M.LAUNCH_SESSION_STATUS.terminated].includes((oe=W==null?void 0:W.launcherSession)==null?void 0:oe.status))}catch(W){console.error("call getLauncherSession error",W)}})()},[]);const{inService:T}=l,I=(b,A,B=!1)=>async()=>{const q=async Ne=>{var ze;t({action:b,blocklet:e}),g(!0),f(b);let Ue=!1;try{if(b==="remove")await A(Ne);else if(b==="start"){if(!N.hasRunnableComponent(e)){Z.error(m("blocklet.noComponent"));return}if(!T&&!C&&!((ze=e.settings)!=null&&ze.initialized)&&e.mode!==ce.BLOCKLET_MODES.DEVELOPMENT){if(!L||!vn(L)){Z.error(m("blocklet.gotoVisitError"));return}const Q=Fs(l.info),xn=new URL(L);xn.searchParams.set("serverUrl",Q),window.open(In(xn.href,{allowDomains:null})),n({action:b,blocklet:e});return}const ie=e.children.filter(Q=>!N.isInProgress(Q.status)&&Q.status!=="running").map(Q=>Q.meta.did),fe={did:e.meta.did,componentDids:ie};await A({input:fe})}else if(["stop","restart","reload"].includes(b)){const ie=e.children.filter(Q=>Q.status==="running").map(Q=>Q.meta.did),fe={did:e.meta.did,componentDids:ie};await A({input:fe})}else{const ie={did:e.meta.did};await A({input:ie})}b==="remove"?Ue=!0:await Vs(1e3),b==="reload"&&Z.success(m("blocklet.reloadSuccess")),S(null),n({action:b,blocklet:e})}catch(ie){const fe=`Blocklet ${b} failed: ${$t(ie)}`;throw n({action:b,blocklet:e,error:new Error(fe)}),new Error(fe)}finally{Ue||g(!1)}},te=()=>{g(!1),S(null)},oe=N.getDisplayName(e,!0),W=e.mode===ce.BLOCKLET_MODES.DEVELOPMENT?{description:()=>o.jsx(H,{component:"div",children:o.jsx(H,{gutterBottom:!0,children:m("blocklet.action.removeApplicationDescription")})}),params:{removeType:"complete"}}:{description:(Ne,Ue)=>o.jsxs(H,{component:"div",children:[o.jsx(H,{gutterBottom:!0,children:m("blocklet.action.removeApplicationDescription")}),o.jsxs(Ls,{name:"removeType",value:Ne.removeType,onChange:ze=>Ue({...Ne,removeType:ze.target.value}),children:[o.jsx(yn,{value:"backup",control:o.jsx(bn,{}),label:m("blocklet.action.removeApplicationAfterBackup")}),o.jsx(yn,{value:"complete",control:o.jsx(bn,{}),label:m("blocklet.action.removeApplicationComplete")})]})]}),params:{removeType:"backup"}},ds={stop:{title:`${m("common.stop")} ${oe}`,description:m("blocklet.action.stopDescription"),confirm:m("blocklet.action.confirmStop"),cancel:m("common.cancel"),onConfirm:q,onCancel:te},restart:{title:`${m("common.restart")} ${oe}`,description:m("blocklet.action.restartDescription"),confirm:m("blocklet.action.confirmRestart"),cancel:m("common.cancel"),onConfirm:q,onCancel:te},remove:{title:`${m("common.remove")} ${oe}`,confirm:m("blocklet.action.confirmRemove"),cancel:m("common.cancel"),onConfirm:q,onCancel:te,...W},cancelDownload:{title:`${m("common.cancel")}`,description:m("blocklet.action.cancelDownloadDescription",{name:oe}),confirm:m("common.confirm"),cancel:m("common.cancel"),onConfirm:q,onCancel:te}};B?S(ds[b]):await q()},U=!!u,$=b=>{try{b.stopPropagation(),b.preventDefault()}catch{}d(b.currentTarget)},z=b=>{try{b.stopPropagation(),b.preventDefault()}catch{}d(null)},$e=async(b,A)=>{try{A.stopPropagation(),A.preventDefault()}catch{}if(typeof b.handler=="function")try{g(!0),f(b.action),await b.handler()}catch(B){console.error(`Blocklet ${b.name} failed: `,B)}finally{g(!1),d(null)}else d(null)},as=!T&&N.isDeletableBlocklet(e)?{action:"remove",icon:pe.Remove,name:m("common.remove"),handler:I("remove",async({removeType:b})=>{b==="backup"&&await l.api.backupBlocklet({input:{appDid:e.appDid,to:"disk"}}),await l.api.deleteBlocklet({input:{did:e.meta.did,keepData:!1}})},!0),disabled:j}:null,cs={action:"remove",icon:({sx:b,...A})=>o.jsx(pe.Cancel,{sx:{...b,paddingRight:"2px",zoom:.95},...A}),name:m("common.cancel"),handler:I("cancelDownload",l.api.cancelDownloadBlocklet,!0)},ls=N.getAppMissingConfigs(e),us=()=>{var q;const b=`/${e.mountPoint||"/"}`.replace(/\/+/g,"/"),A=a==null?void 0:a({mountPoint:b,blocklet:e});if(!A||!vn(A)){Z.error(m("blocklet.gotoVisitError"));return}const B=(q=e==null?void 0:e.site)==null?void 0:q.domainAliases;window.open(In(Yo(A,`${M.WELLKNOWN_SERVICE_PATH_PREFIX}/admin`),{allowDomains:B==null?void 0:B.map(te=>te.value)}))};let Oe=[{action:"start",icon:pe.Start,inExternal:!0,name:m("common.start"),handler:I("start",l.api.startBlocklet),disabled:k||e.children.every(b=>b.status==="running")||ft(e.status)||w||j},{action:"stop",icon:pe.Stop,inExternal:!0,name:m("common.stop"),handler:I("stop",l.api.stopBlocklet,!0),disabled:!["running","starting"].includes(e.status)},{action:"restart",inExternal:!0,icon:pe.Restart,name:m("common.restart"),handler:I("restart",l.api.restartBlocklet,!0),disabled:k||e.status!=="running"},ft(e.status)?cs:as,{separator:!0},T?null:{action:"dashboard",icon:({style:b,...A})=>o.jsx(pe.Dashboard,{...A,style:{...b,width:"26px",height:"26px",paddingRight:"3px"}}),name:m("sidebar.dashboard"),handler:us}].filter(Boolean);return R===ti&&(Oe=Oe.filter(b=>b.inExternal)),r==="menu"?o.jsxs(En,{"data-cy":"blocklet-actions",children:[o.jsx(Rt,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions","actions-blocklet-did":e.meta.did,onClick:$,size:"small",disabled:!s||!ft(e.status)&&y,children:o.jsx(ps,{})}),o.jsxs(Cs,{id:"actions-menu",anchorEl:u,keepMounted:!0,open:U,onClose:z,PaperProps:{},children:[ls.length>0&&o.jsxs(At,{style:{maxWidth:"400px"},severity:"error",children:[m("blocklet.config.missingRequired"),o.jsx("br",{}),o.jsx(Kn,{to:`/blocklets/${e.meta.did}/components`,children:m("blocklet.config.gotoFix")})]}),Oe.map((b,A)=>b.separator?o.jsx(Mt,{},`separator-${A}`):o.jsxs(Is,{dense:!0,onClick:B=>$e(b,B),disabled:y||b.disabled,"data-cy":`${b.action}-blocklet`,children:[o.jsx(Es,{style:{minWidth:24},children:p===b.action&&y?o.jsx(re,{size:16,sx:{marginRight:1}}):o.jsx(b.icon,{fontSize:"small"})}),o.jsx(ks,{primary:b.name})]},b.name))]}),h&&o.jsx(Cn,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]}):o.jsxs(En,{"data-cy":"blocklet-actions",...c,children:[o.jsx(Ts,{children:Oe.filter(b=>!b.separator&&!b.onlyInMenu).map(b=>o.jsxs(Dt,{title:b.name,"data-cy":`${b.action}-blocklet`,onClick:()=>$e(b),disabled:!!b.disabled||y,children:[p===b.action&&y?o.jsx(re,{size:16,sx:{marginRight:1}}):o.jsx(b.icon,{}),o.jsx("span",{className:"blocklet-action-text",children:b.name})]},b.name))}),h&&o.jsx(Cn,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}Kt.propTypes={getComponentUrl:v.func,blocklet:v.object.isRequired,onStart:v.func.isRequired,onComplete:v.func.isRequired,variant:v.oneOf(["menu","group"]),hasPermission:v.bool,useBlockletUrlEvaluation:v.func};Kt.defaultProps={getComponentUrl:null,variant:"menu",hasPermission:!1,useBlockletUrlEvaluation:()=>{var e;return{loading:!1,recommendedUrl:(e=window==null?void 0:window.location)==null?void 0:e.href}}};const En=G.div`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/log-BBUgs8Rd.js","assets/vendor-mui-core-Bq8gXTan.js","assets/vendor-react-DEoibe3W.js","assets/useLocalStorage-CaPDqrQ7.js","assets/vendor-ux-did-connect-pzpsrvqx.js","assets/vendor-utils-BfZ4tlod.js","assets/vendor-hooks-DqdmWCmo.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/index-CwUT0vPy.js","assets/vendor-arcblock-CwufDgLV.js","assets/index-DOq-_YXu.css","assets/Download-D4X39_9V.js","assets/bundle-avatar-UIbxwQif.js","assets/log-D33dFtt_.css","assets/index-YaLWfp9D.js","assets/ViewList-BOGcbymi.js","assets/index-BLfUtUpB.js","assets/did-address-NnOD1W_A.js","assets/permission-DQvXGutX.js","assets/session-BGdAM8zS.js","assets/click-to-copy-By4fgGR7.js","assets/index-DrTNV3tX.js","assets/vendor-mui-x-1nqAyytV.js","assets/AdapterDayjs-BRnJ9bMs.js","assets/index-8eXqqyHQ.js","assets/useAsync-C62uE2pS.js","assets/index-DPIWnhb5.js","assets/DeleteOutline-BKSMNwfT.js","assets/confirm-RvA9mFot.js","assets/util-BQAJqeb4.js","assets/base32-DUSifB4M.js","assets/sdk-BmeKtHic.js","assets/actions-DnTVXQ_Z.js","assets/MoreHoriz-ChJ3K52h.js","assets/shorten-label-BQvbtscf.js","assets/PlayArrow-BqVYRyLK.js","assets/get-safe-url-D5KSEAKZ.js","assets/use-blocklet-logo-4UB-MFD3.js","assets/InfoOutlined-BVWbftGI.js","assets/dot-4jhL56kz.js","assets/useSetState-CWq0AVWn.js","assets/use-mobile-DwzRjjku.js","assets/index-Dq1Rmjwf.js","assets/use-mobile-CtTQsfXN.js","assets/ExpandLess-CcLTbsdW.js","assets/table-tips-BzPqsKYQ.js","assets/index-CkwXRCmN.js","assets/Error-BAEKW7-e.js","assets/empty-spinner-BHwHZpq-.js","assets/list-header-C7gle0n0.js","assets/QuestionMarkCircle-jbhclAfX.js","assets/index-DVQCgvFb.js","assets/Launch-DFS3fgjy.js","assets/index-DEZojGsm.js","assets/api-C1S8LUld.js","assets/ChevronRight-BU9I7WD4.js","assets/react-beautiful-dnd.esm-02tdagHZ.js","assets/raf-schd.esm-B3j6BePR.js","assets/item-D-39k2FC.js","assets/Done-ASNftAOL.js","assets/delete-confirm-wTMDQFnr.js","assets/ArrowDropDown-DBJPIOl4.js","assets/index-CTlzm-Mc.js","assets/index-C0Iiqot3.css","assets/index-Bv7OAPJU.js","assets/overview-C3aIT8Ro.js","assets/keyboard-arrow-down-rounded-DadBVmpO.js","assets/status-f3Y-NXRP.js","assets/omit-Cao4GLS7.js","assets/spaces-DUkzPTBd.js","assets/domains-CxJF-JF_.js","assets/domain-action-card-BlPWBOAu.js","assets/util-BRPRFc9p.js","assets/CheckCircle-DUJmWceY.js","assets/index-ZcD1N43m.js","assets/passport-item-B3XIp0U4.js","assets/Google-C28yeMZW.js","assets/cloneDeep-CDl5kZTY.js","assets/EditIcon-DfiDnAsm.js","assets/LockIcon-BEG59s5q.js","assets/appearance-DsoglxbB.js","assets/audit-logs-DKiQkfse.js","assets/index-B4fH-l5R.js","assets/collapse-DAaiuAEY.js","assets/section-BDMQAX_r.js","assets/list-DDNORnll.js","assets/traffic-FNLLya21.js","assets/iframe-DFg8oeD0.js","assets/LaunchOutlined-C1x4Og4u.js","assets/ChevronLeft-BBJJJhVi.js","assets/index-B2NkqENf.js","assets/base-chart-CoApVzod.js","assets/index-w4f-mlFt.js","assets/config-navigation-DZ54_nVv.js","assets/index-BxJZWVOT.js","assets/slicedToArray-DFQjSbCD.js","assets/simple-select-0cjVFuay.js","assets/index-6I6juqjg.js","assets/connect-to-CxoBjkcK.js","assets/config-space-D6ScnWdA.js","assets/switch-control-Brwb8ptk.js","assets/index-CD07vq9d.js","assets/security-BPd4v9z4.js","assets/config-BZuiK8BP.js","assets/branding-CwYIeBi1.js","assets/sanitize-e0A8A-yt.js","assets/logo-uploader-BPSmPaZd.js","assets/advanced-CJz1c7Eh.js","assets/runtime-Drmh1-cb.js","assets/index-I1i2Mc1k.js","assets/Edit-CiTb-w5P.js","assets/list-ZFC0mCy0.js","assets/index-B70kYOfj.js","assets/component-CiFJ1vhL.js","assets/TuneOutlined-CKzi_VZZ.js","assets/add-component-core-DehB4lvu.js","assets/launch-result-message-AharZGq2.js","assets/page-header-DNvUdNpI.js","assets/index-Cwq0Io0K.js","assets/content-layout-BC2QkTYi.js","assets/search-4YYphs0l.js","assets/add-component-core-D-IRi6XF.css","assets/index-aAlnaECr.js"])))=>i.map(i=>d[i]);
2
+ import{r as F,bd as fs,bb as Lt,be as ps,B as Dt,k as M,a8 as vn,a3 as Z,a as Y,at as ms,n as Hn,m as hs,d as gs,i as xs,aR as vs,D as Le,a1 as Pt,bf as ys,bg as bs,I as ws,F as Je,bh as js,_ as D,ax as Ss,a5 as _s}from"./vendor-ux-did-connect-pzpsrvqx.js";import{H as v,j as o,a9 as V,ah as G,I as Rt,at as Cs,ak as At,X as Mt,q as Is,b7 as Es,ab as re,b8 as ks,bw as Ts,T as H,bu as Ls,bs as yn,bv as bn,aa as _,bI as Ds,v as X,a7 as it,bJ as Ps,e as ee,ae as Rs,bf as As,ap as Se,bK as Bn,ad as Ee,bL as Ms,au as $s,ai as Os,bM as Fn,bN as Vn,bO as qn,E as ae,b6 as Wn,y as Ns,bh as Us}from"./vendor-mui-core-Bq8gXTan.js";import{r as x,L as Kn,f as Gn,g as zs,u as Hs,l as Bs}from"./vendor-react-DEoibe3W.js";import{D as at,f as N,E as ft,F as Fs,b as Vs,G as qs,H as Ws,I as Qn,y as me,J as Zn,K as Ks,k as ve,L as Gs,M as Qs,u as Zs,l as wn,Q as jn,g as Xs,j as Js,q as Ys,n as be,m as eo,o as to,P as no,O as ro,R as We,e as He,T as so,U as oo,V as io,N as ao,W as co,c as Sn}from"./index-CwUT0vPy.js";import{ag as lo,A as he,ah as uo,z as Xn,b as Ke,ai as fo}from"./vendor-utils-BfZ4tlod.js";import{_ as _n}from"./useLocalStorage-CaPDqrQ7.js";import{f as $t}from"./index-8eXqqyHQ.js";import{c as ce,u as Ye,p as po,h as et,f as Jn,e as mo,E as ho,g as go,H as xo,R as vo}from"./vendor-arcblock-CwufDgLV.js";import{C as Cn}from"./confirm-RvA9mFot.js";import{d as yo}from"./PlayArrow-BqVYRyLK.js";import{g as In}from"./get-safe-url-D5KSEAKZ.js";import{u as Yn}from"./session-BGdAM8zS.js";import{b as ge,x as bo}from"./vendor-hooks-DqdmWCmo.js";import{i as wo,u as jo,M as So,c as ke,s as tt,H as _o,a as Co}from"./use-blocklet-logo-4UB-MFD3.js";import{d as Io}from"./InfoOutlined-BVWbftGI.js";import{_ as er,D as Eo}from"./dot-4jhL56kz.js";import{_ as tr}from"./useSetState-CWq0AVWn.js";import{u as ko}from"./use-mobile-DwzRjjku.js";const nr=x.createContext({});function Ot({children:e,type:t}){const[n,r]=x.useState([]),s=x.useRef([]),a=l=>{if(!s.current.includes(l)){const u=[...s.current,l];r(u),s.current=u}},i=l=>{if(s.current.includes(l)){const u=s.current.filter(d=>d!==l);r(u),s.current=u}},c=l=>{const u=n.filter(p=>l.find(f=>f===p));lo(u,n).forEach(p=>i(p))};return o.jsx(nr.Provider,{value:{type:t,deletingBlocklets:n,addDeletingDid:a,removeDeletingDid:i,matchDeletingDid:c},children:e})}Ot.propTypes={type:v.string,children:v.node.isRequired};Ot.defaultProps={type:"blocklets"};function Ll(){return x.useContext(nr)}var Nt={},To=V;Object.defineProperty(Nt,"__esModule",{value:!0});var rr=Nt.default=void 0,Lo=To(F()),Do=o;rr=Nt.default=(0,Lo.default)((0,Do.jsx)("path",{d:"M6 6h12v12H6z"}),"Stop");var Ut={},Po=V;Object.defineProperty(Ut,"__esModule",{value:!0});var sr=Ut.default=void 0,Ro=Po(F()),Ao=o;sr=Ut.default=(0,Ro.default)((0,Ao.jsx)("path",{d:"M12 5V1L7 6l5 5V7c3.31 0 6 2.69 6 6s-2.69 6-6 6-6-2.69-6-6H4c0 4.42 3.58 8 8 8s8-3.58 8-8-3.58-8-8-8"}),"Replay");var zt={},Mo=V;Object.defineProperty(zt,"__esModule",{value:!0});var or=zt.default=void 0,$o=Mo(F()),Oo=o;or=zt.default=(0,$o.default)((0,Oo.jsx)("path",{d:"M12 6v3l4-4-4-4v3c-4.42 0-8 3.58-8 8 0 1.57.46 3.03 1.24 4.26L6.7 14.8c-.45-.83-.7-1.79-.7-2.8 0-3.31 2.69-6 6-6m6.76 1.74L17.3 9.2c.44.84.7 1.79.7 2.8 0 3.31-2.69 6-6 6v-3l-4 4 4 4v-3c4.42 0 8-3.58 8-8 0-1.57-.46-3.03-1.24-4.26"}),"Autorenew");var Ht={},No=V;Object.defineProperty(Ht,"__esModule",{value:!0});var ir=Ht.default=void 0,Uo=No(F()),zo=o;ir=Ht.default=(0,Uo.default)((0,zo.jsx)("path",{d:"M19.14 12.94c.04-.3.06-.61.06-.94 0-.32-.02-.64-.07-.94l2.03-1.58c.18-.14.23-.41.12-.61l-1.92-3.32c-.12-.22-.37-.29-.59-.22l-2.39.96c-.5-.38-1.03-.7-1.62-.94l-.36-2.54c-.04-.24-.24-.41-.48-.41h-3.84c-.24 0-.43.17-.47.41l-.36 2.54c-.59.24-1.13.57-1.62.94l-2.39-.96c-.22-.08-.47 0-.59.22L2.74 8.87c-.12.21-.08.47.12.61l2.03 1.58c-.05.3-.09.63-.09.94s.02.64.07.94l-2.03 1.58c-.18.14-.23.41-.12.61l1.92 3.32c.12.22.37.29.59.22l2.39-.96c.5.38 1.03.7 1.62.94l.36 2.54c.05.24.24.41.48.41h3.84c.24 0 .44-.17.47-.41l.36-2.54c.59-.24 1.13-.56 1.62-.94l2.39.96c.22.08.47 0 .59-.22l1.92-3.32c.12-.22.07-.47-.12-.61zM12 15.6c-1.98 0-3.6-1.62-3.6-3.6s1.62-3.6 3.6-3.6 3.6 1.62 3.6 3.6-1.62 3.6-3.6 3.6"}),"Settings");var Bt={},Ho=V;Object.defineProperty(Bt,"__esModule",{value:!0});var ar=Bt.default=void 0,Bo=Ho(F()),Fo=o;ar=Bt.default=(0,Bo.default)((0,Fo.jsx)("path",{d:"M18 17H6v-2h12zm0-4H6v-2h12zm0-4H6V7h12zM3 22l1.5-1.5L6 22l1.5-1.5L9 22l1.5-1.5L12 22l1.5-1.5L15 22l1.5-1.5L18 22l1.5-1.5L21 22V2l-1.5 1.5L18 2l-1.5 1.5L15 2l-1.5 1.5L12 2l-1.5 1.5L9 2 7.5 3.5 6 2 4.5 3.5 3 2z"}),"Receipt");var Ft={},Vo=V;Object.defineProperty(Ft,"__esModule",{value:!0});var cr=Ft.default=void 0,qo=Vo(F()),Wo=o;cr=Ft.default=(0,qo.default)((0,Wo.jsx)("path",{d:"M16 11c1.66 0 2.99-1.34 2.99-3S17.66 5 16 5c-1.66 0-3 1.34-3 3s1.34 3 3 3m-8 0c1.66 0 2.99-1.34 2.99-3S9.66 5 8 5C6.34 5 5 6.34 5 8s1.34 3 3 3m0 2c-2.33 0-7 1.17-7 3.5V19h14v-2.5c0-2.33-4.67-3.5-7-3.5m8 0c-.29 0-.62.02-.97.05 1.16.84 1.97 1.97 1.97 3.45V19h6v-2.5c0-2.33-4.67-3.5-7-3.5"}),"Group");var Vt={},Ko=V;Object.defineProperty(Vt,"__esModule",{value:!0});var lr=Vt.default=void 0,Go=Ko(F()),Qo=o;lr=Vt.default=(0,Go.default)((0,Qo.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8 0-1.85.63-3.55 1.69-4.9L16.9 18.31C15.55 19.37 13.85 20 12 20m6.31-3.1L7.1 5.69C8.45 4.63 10.15 4 12 4c4.42 0 8 3.58 8 8 0 1.85-.63 3.55-1.69 4.9"}),"NotInterested");var qt=function(e){return o.jsx("svg",{...e,children:o.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.32989 8.20744C11.2787 6.82349 13.6098 6.08 16 6.08C18.3902 6.08 20.7213 6.82349 22.6701 8.20744C24.6189 9.59139 26.089 11.5473 26.8766 13.804C27.6642 16.0607 27.7304 18.5066 27.0659 20.8026C26.4419 22.9587 25.2026 24.8823 23.5044 26.3404H8.49555C6.79735 24.8823 5.55809 22.9587 4.9341 20.8026C4.26961 18.5066 4.33575 16.0607 5.12337 13.804C5.91098 11.5473 7.38107 9.59139 9.32989 8.20744ZM16 3.52C13.0786 3.52 10.2295 4.42871 7.84764 6.1202C5.46575 7.81169 3.66898 10.2022 2.70634 12.9604C1.7437 15.7187 1.66286 18.708 2.47501 21.5143C3.28717 24.3205 4.95211 26.8046 7.23909 28.6224C7.46554 28.8024 7.74628 28.9004 8.03554 28.9004H23.9644C24.2537 28.9004 24.5344 28.8024 24.7609 28.6224C27.0479 26.8046 28.7128 24.3205 29.5249 21.5143C30.3371 18.708 30.2563 15.7187 29.2936 12.9604C28.331 10.2022 26.5342 7.81169 24.1523 6.1202C21.7704 4.42871 18.9214 3.52 16 3.52ZM21.8829 13.5921C22.3827 13.0923 22.3827 12.2818 21.8829 11.7819C21.383 11.2821 20.5725 11.2821 20.0727 11.7819L17.868 13.9866C17.3072 13.7012 16.6724 13.5404 16 13.5404C13.7221 13.5404 11.8755 15.3869 11.8755 17.6648C11.8755 19.9427 13.7221 21.7892 16 21.7892C18.2779 21.7892 20.1244 19.9427 20.1244 17.6648C20.1244 16.9924 19.9635 16.3576 19.6782 15.7968L21.8829 13.5921ZM14.4355 17.6648C14.4355 16.8008 15.136 16.1004 16 16.1004C16.864 16.1004 17.5644 16.8008 17.5644 17.6648C17.5644 18.5288 16.864 19.2292 16 19.2292C15.136 19.2292 14.4355 18.5288 14.4355 17.6648Z",fill:"currentColor"})})};qt.defaultProps={width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"};qt.displayName="dashboard";var Wt={},Zo=V;Object.defineProperty(Wt,"__esModule",{value:!0});var ur=Wt.default=void 0,Xo=Zo(F()),Jo=o;ur=Wt.default=(0,Xo.default)((0,Jo.jsx)("path",{d:"m18.25 7.6-5.5-3.18c-.46-.27-1.04-.27-1.5 0L5.75 7.6c-.46.27-.75.76-.75 1.3v6.35c0 .54.29 1.03.75 1.3l5.5 3.18c.46.27 1.04.27 1.5 0l5.5-3.18c.46-.27.75-.76.75-1.3V8.9c0-.54-.29-1.03-.75-1.3M7 14.96v-4.62l4 2.32v4.61zm5-4.03L8 8.61l4-2.31 4 2.31zm1 6.34v-4.61l4-2.32v4.62zM7 2H3.5C2.67 2 2 2.67 2 3.5V7h2V4h3zm10 0h3.5c.83 0 1.5.67 1.5 1.5V7h-2V4h-3zM7 22H3.5c-.83 0-1.5-.67-1.5-1.5V17h2v3h3zm10 0h3.5c.83 0 1.5-.67 1.5-1.5V17h-2v3h-3z"}),"ViewInAr");const pe={Start:yo,Stop:rr,Restart:sr,Reload:or,Remove:fs,Config:ir,Log:ar,Group:cr,Cancel:lr,Dashboard:qt,Overview:ur},Yo=(e,t)=>{if(!e)return"";if(!t)return e;const n=new URL(e),r=new URLSearchParams(n.searchParams),s=new URL(he(n.origin,t));return s.search=r.toString(),s.toString()},ei="internal",ti="external";function Kt({blocklet:e,onStart:t,onComplete:n,variant:r,hasPermission:s,getComponentUrl:a,useBlockletUrlEvaluation:i,...c}){const l=at(),[u,d]=x.useState(null),[p,f]=x.useState(null),[y,g]=x.useState(!1),[h,S]=x.useState(null),{t:m}=x.useContext(Lt),[C]=_n("skip-blocklet-setup",!1),{loading:w,recommendedUrl:L}=i(e),[R]=_n("blocklet-type-filter",ei),j=N.isInProgress(e.status),[k,E]=x.useState(!1);x.useEffect(()=>{var A,B;if(!(e!=null&&e.controller))return;E(((B=(A=e==null?void 0:e.controller)==null?void 0:A.status)==null?void 0:B.value)===ce.BLOCKLET_CONTROLLER_STATUS.suspended),(async()=>{var q,te,oe;try{const W=await l.api.getLauncherSession({input:{launcherSessionId:(q=e==null?void 0:e.controller)==null?void 0:q.launcherSessionId,launcherUrl:(te=e==null?void 0:e.controller)==null?void 0:te.launcherUrl}});if(W!=null&&W.error){console.error("get launcher session failed",W.error);return}E([M.LAUNCH_SESSION_STATUS.overdue,M.LAUNCH_SESSION_STATUS.canceled,M.LAUNCH_SESSION_STATUS.terminated].includes((oe=W==null?void 0:W.launcherSession)==null?void 0:oe.status))}catch(W){console.error("call getLauncherSession error",W)}})()},[]);const{inService:T}=l,I=(b,A,B=!1)=>async()=>{const q=async Ne=>{var ze;t({action:b,blocklet:e}),g(!0),f(b);let Ue=!1;try{if(b==="remove")await A(Ne);else if(b==="start"){if(!N.hasRunnableComponent(e)){Z.error(m("blocklet.noComponent"));return}if(!T&&!C&&!((ze=e.settings)!=null&&ze.initialized)&&e.mode!==ce.BLOCKLET_MODES.DEVELOPMENT){if(!L||!vn(L)){Z.error(m("blocklet.gotoVisitError"));return}const Q=Fs(l.info),xn=new URL(L);xn.searchParams.set("serverUrl",Q),window.open(In(xn.href,{allowDomains:null})),n({action:b,blocklet:e});return}const ie=e.children.filter(Q=>!N.isInProgress(Q.status)&&Q.status!=="running").map(Q=>Q.meta.did),fe={did:e.meta.did,componentDids:ie};await A({input:fe})}else if(["stop","restart","reload"].includes(b)){const ie=e.children.filter(Q=>Q.status==="running").map(Q=>Q.meta.did),fe={did:e.meta.did,componentDids:ie};await A({input:fe})}else{const ie={did:e.meta.did};await A({input:ie})}b==="remove"?Ue=!0:await Vs(1e3),b==="reload"&&Z.success(m("blocklet.reloadSuccess")),S(null),n({action:b,blocklet:e})}catch(ie){const fe=`Blocklet ${b} failed: ${$t(ie)}`;throw n({action:b,blocklet:e,error:new Error(fe)}),new Error(fe)}finally{Ue||g(!1)}},te=()=>{g(!1),S(null)},oe=N.getDisplayName(e,!0),W=e.mode===ce.BLOCKLET_MODES.DEVELOPMENT?{description:()=>o.jsx(H,{component:"div",children:o.jsx(H,{gutterBottom:!0,children:m("blocklet.action.removeApplicationDescription")})}),params:{removeType:"complete"}}:{description:(Ne,Ue)=>o.jsxs(H,{component:"div",children:[o.jsx(H,{gutterBottom:!0,children:m("blocklet.action.removeApplicationDescription")}),o.jsxs(Ls,{name:"removeType",value:Ne.removeType,onChange:ze=>Ue({...Ne,removeType:ze.target.value}),children:[o.jsx(yn,{value:"backup",control:o.jsx(bn,{}),label:m("blocklet.action.removeApplicationAfterBackup")}),o.jsx(yn,{value:"complete",control:o.jsx(bn,{}),label:m("blocklet.action.removeApplicationComplete")})]})]}),params:{removeType:"backup"}},ds={stop:{title:`${m("common.stop")} ${oe}`,description:m("blocklet.action.stopDescription"),confirm:m("blocklet.action.confirmStop"),cancel:m("common.cancel"),onConfirm:q,onCancel:te},restart:{title:`${m("common.restart")} ${oe}`,description:m("blocklet.action.restartDescription"),confirm:m("blocklet.action.confirmRestart"),cancel:m("common.cancel"),onConfirm:q,onCancel:te},remove:{title:`${m("common.remove")} ${oe}`,confirm:m("blocklet.action.confirmRemove"),cancel:m("common.cancel"),onConfirm:q,onCancel:te,...W},cancelDownload:{title:`${m("common.cancel")}`,description:m("blocklet.action.cancelDownloadDescription",{name:oe}),confirm:m("common.confirm"),cancel:m("common.cancel"),onConfirm:q,onCancel:te}};B?S(ds[b]):await q()},U=!!u,$=b=>{try{b.stopPropagation(),b.preventDefault()}catch{}d(b.currentTarget)},z=b=>{try{b.stopPropagation(),b.preventDefault()}catch{}d(null)},$e=async(b,A)=>{try{A.stopPropagation(),A.preventDefault()}catch{}if(typeof b.handler=="function")try{g(!0),f(b.action),await b.handler()}catch(B){console.error(`Blocklet ${b.name} failed: `,B)}finally{g(!1),d(null)}else d(null)},as=!T&&N.isDeletableBlocklet(e)?{action:"remove",icon:pe.Remove,name:m("common.remove"),handler:I("remove",async({removeType:b})=>{b==="backup"&&await l.api.backupBlocklet({input:{appDid:e.appDid,to:"disk"}}),await l.api.deleteBlocklet({input:{did:e.meta.did,keepData:!1}})},!0),disabled:j}:null,cs={action:"remove",icon:({sx:b,...A})=>o.jsx(pe.Cancel,{sx:{...b,paddingRight:"2px",zoom:.95},...A}),name:m("common.cancel"),handler:I("cancelDownload",l.api.cancelDownloadBlocklet,!0)},ls=N.getAppMissingConfigs(e),us=()=>{var q;const b=`/${e.mountPoint||"/"}`.replace(/\/+/g,"/"),A=a==null?void 0:a({mountPoint:b,blocklet:e});if(!A||!vn(A)){Z.error(m("blocklet.gotoVisitError"));return}const B=(q=e==null?void 0:e.site)==null?void 0:q.domainAliases;window.open(In(Yo(A,`${M.WELLKNOWN_SERVICE_PATH_PREFIX}/admin`),{allowDomains:B==null?void 0:B.map(te=>te.value)}))};let Oe=[{action:"start",icon:pe.Start,inExternal:!0,name:m("common.start"),handler:I("start",l.api.startBlocklet),disabled:k||e.children.every(b=>b.status==="running")||ft(e.status)||w||j},{action:"stop",icon:pe.Stop,inExternal:!0,name:m("common.stop"),handler:I("stop",l.api.stopBlocklet,!0),disabled:!["running","starting"].includes(e.status)},{action:"restart",inExternal:!0,icon:pe.Restart,name:m("common.restart"),handler:I("restart",l.api.restartBlocklet,!0),disabled:k||e.status!=="running"},ft(e.status)?cs:as,{separator:!0},T?null:{action:"dashboard",icon:({style:b,...A})=>o.jsx(pe.Dashboard,{...A,style:{...b,width:"26px",height:"26px",paddingRight:"3px"}}),name:m("sidebar.dashboard"),handler:us}].filter(Boolean);return R===ti&&(Oe=Oe.filter(b=>b.inExternal)),r==="menu"?o.jsxs(En,{"data-cy":"blocklet-actions",children:[o.jsx(Rt,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions","actions-blocklet-did":e.meta.did,onClick:$,size:"small",disabled:!s||!ft(e.status)&&y,children:o.jsx(ps,{})}),o.jsxs(Cs,{id:"actions-menu",anchorEl:u,keepMounted:!0,open:U,onClose:z,PaperProps:{},children:[ls.length>0&&o.jsxs(At,{style:{maxWidth:"400px"},severity:"error",children:[m("blocklet.config.missingRequired"),o.jsx("br",{}),o.jsx(Kn,{to:`/blocklets/${e.meta.did}/components`,children:m("blocklet.config.gotoFix")})]}),Oe.map((b,A)=>b.separator?o.jsx(Mt,{},`separator-${A}`):o.jsxs(Is,{dense:!0,onClick:B=>$e(b,B),disabled:y||b.disabled,"data-cy":`${b.action}-blocklet`,children:[o.jsx(Es,{style:{minWidth:24},children:p===b.action&&y?o.jsx(re,{size:16,sx:{marginRight:1}}):o.jsx(b.icon,{fontSize:"small"})}),o.jsx(ks,{primary:b.name})]},b.name))]}),h&&o.jsx(Cn,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]}):o.jsxs(En,{"data-cy":"blocklet-actions",...c,children:[o.jsx(Ts,{children:Oe.filter(b=>!b.separator&&!b.onlyInMenu).map(b=>o.jsxs(Dt,{title:b.name,"data-cy":`${b.action}-blocklet`,onClick:()=>$e(b),disabled:!!b.disabled||y,children:[p===b.action&&y?o.jsx(re,{size:16,sx:{marginRight:1}}):o.jsx(b.icon,{}),o.jsx("span",{className:"blocklet-action-text",children:b.name})]},b.name))}),h&&o.jsx(Cn,{title:h.title,description:h.description,confirm:h.confirm,cancel:h.cancel,params:h.params,onConfirm:h.onConfirm,onCancel:h.onCancel})]})}Kt.propTypes={getComponentUrl:v.func,blocklet:v.object.isRequired,onStart:v.func.isRequired,onComplete:v.func.isRequired,variant:v.oneOf(["menu","group"]),hasPermission:v.bool,useBlockletUrlEvaluation:v.func};Kt.defaultProps={getComponentUrl:null,variant:"menu",hasPermission:!1,useBlockletUrlEvaluation:()=>{var e;return{loading:!1,recommendedUrl:(e=window==null?void 0:window.location)==null?void 0:e.href}}};const En=G.div`
3
3
  display: flex;
4
4
  align-items: center;
5
5
 
@@ -1,4 +1,4 @@
1
- import{j as o,aa as i,H as x,ah as k}from"./vendor-mui-core-Bq8gXTan.js";import{k as b,f as B,am as w,d as I}from"./index-CwUT0vPy.js";import{D as E,a as T,b as A}from"./domain-action-card-BlPWBOAu.js";import{bb as L}from"./vendor-ux-did-connect-pzpsrvqx.js";import{P as W}from"./page-header-DNvUdNpI.js";import{r,h as H}from"./vendor-react-DEoibe3W.js";import{_}from"./useSetState-CWq0AVWn.js";import{S as D}from"./button-D_ZVjN82.js";import{S as N}from"./layout-DEiEwPzB.js";import{S as $}from"./step-actions-BNbc1l8F.js";import"./vendor-utils-BfZ4tlod.js";import"./vendor-arcblock-CwufDgLV.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./ExpandLess-CcLTbsdW.js";import"./permission-DQvXGutX.js";import"./session-BGdAM8zS.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./confirm-RvA9mFot.js";import"./index-8eXqqyHQ.js";import"./actions-DnTVXQ_Z.js";import"./MoreHoriz-ChJ3K52h.js";import"./delete-confirm-wTMDQFnr.js";import"./click-to-copy-By4fgGR7.js";import"./util-BRPRFc9p.js";import"./InfoOutlined-BVWbftGI.js";import"./index-DPIWnhb5.js";import"./CheckCircle-DUJmWceY.js";import"./content-layout-BC2QkTYi.js";import"./use-mobile-CtTQsfXN.js";function d({onNext:s,onPrevious:S}){var h,f;const{t:n}=r.useContext(L),[j,p]=r.useState(!1),{blocklet:e}=b(),[c,y]=r.useState(""),P=(((e==null?void 0:e.site)||{}).domainAliases||[]).map(t=>B.replaceSlotToIp(t.value,c)),[a,m]=_({domain:"",invalidDNSDomain:null,type:"",addDomainState:{text:""}}),l=(f=(h=e.environments)==null?void 0:h.find(t=>t.key==="BLOCKLET_APP_PK"))==null?void 0:f.value,g=P.find(t=>w.isDidDomain(t)),[u,v]=H();return r.useEffect(()=>{I.get(`/dns-resolve?hostname=${window.location.hostname}`).then(({data:t})=>{y(t.address||"")}).catch(t=>{console.error(t.message)})},[]),o.jsxs(z,{children:[o.jsx(i,{className:"header",children:o.jsx(W,{title:n("setup.domain.title"),subTitle:n("setup.domain.subTitle"),onClickBack:S})}),o.jsxs(i,{className:"form",sx:{display:"flex",flexDirection:"column",gap:3,overflowY:"auto"},children:[o.jsxs(i,{children:[o.jsx(i,{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem",children:o.jsx(i,{display:"inline",children:`${n("setup.domain.buyOrConnect")} (${n("common.optional")})`})}),o.jsx(i,{mt:1,children:o.jsx(T,{blocklet:e,bugDidDomainProps:{appPk:l,appId:e.appPid,siteId:e.site.id,teamDid:e.meta.did,inBlockletSetup:!0},connectDomainProps:{autoFocus:!1,appPk:l,appId:e.appPid,siteId:e.site.id,teamDid:e.meta.did,cnameDomain:g,currentIp:c,inBlockletSetup:!0,shouldCheckDomain:!0,onInputDomain:t=>{m({domain:t.domain,type:t.type}),p(t.error)},onStateChange:t=>m({addDomainState:t}),onSuccess:t=>{const C={domain:t.domain,type:t.type,nftDid:t.nftDid,chainHost:t.chainHost};u.set("redirect",t.domain),v(u,{replace:!0}),m(C),s()},onError:p}})})]}),o.jsx(i,{children:o.jsx(A,{inSetup:!0,showAllDomains:!0,systemTips:o.jsx(i,{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem",mb:1,children:o.jsx(i,{display:"inline",children:n("setup.domain.skipDescription")})})})})]}),o.jsx($,{mt:8,disabled:!!a.addDomainState.text,blocklet:e,onStartNow:()=>s("complete"),children:a.domain?o.jsx(D,{variant:"contained",loading:!!a.addDomainState.text,disabled:j||!!a.addDomainState.text||!a.domain,onClick:()=>s(),children:a.addDomainState.text||n("setup.continue")}):o.jsx(D,{variant:"contained",disabled:!!a.addDomainState.text,onClick:()=>s(),children:n("setup.continue")})})]})}function jt(s){return o.jsx(E,{children:o.jsx(d,{...s})})}d.propTypes={onNext:x.func,onPrevious:x.func};d.defaultProps={onNext:()=>{},onPrevious:()=>{}};const z=k(N)`
1
+ import{j as o,aa as i,H as x,ah as k}from"./vendor-mui-core-Bq8gXTan.js";import{k as b,f as B,am as w,d as I}from"./index-CwUT0vPy.js";import{D as E,a as T,b as A}from"./domain-action-card-BlPWBOAu.js";import{bb as L}from"./vendor-ux-did-connect-pzpsrvqx.js";import{P as W}from"./page-header-DNvUdNpI.js";import{r,h as H}from"./vendor-react-DEoibe3W.js";import{_}from"./useSetState-CWq0AVWn.js";import{S as D}from"./button-D_ZVjN82.js";import{S as N}from"./layout-DEiEwPzB.js";import{S as $}from"./step-actions-BNbc1l8F.js";import"./vendor-utils-BfZ4tlod.js";import"./vendor-arcblock-CwufDgLV.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./ExpandLess-CcLTbsdW.js";import"./permission-DQvXGutX.js";import"./session-BGdAM8zS.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./confirm-RvA9mFot.js";import"./index-8eXqqyHQ.js";import"./actions-DnTVXQ_Z.js";import"./MoreHoriz-ChJ3K52h.js";import"./delete-confirm-wTMDQFnr.js";import"./click-to-copy-By4fgGR7.js";import"./util-BRPRFc9p.js";import"./InfoOutlined-BVWbftGI.js";import"./index-DPIWnhb5.js";import"./CheckCircle-DUJmWceY.js";import"./content-layout-BC2QkTYi.js";import"./use-mobile-DwzRjjku.js";function d({onNext:s,onPrevious:S}){var h,f;const{t:n}=r.useContext(L),[j,p]=r.useState(!1),{blocklet:e}=b(),[c,y]=r.useState(""),P=(((e==null?void 0:e.site)||{}).domainAliases||[]).map(t=>B.replaceSlotToIp(t.value,c)),[a,m]=_({domain:"",invalidDNSDomain:null,type:"",addDomainState:{text:""}}),l=(f=(h=e.environments)==null?void 0:h.find(t=>t.key==="BLOCKLET_APP_PK"))==null?void 0:f.value,g=P.find(t=>w.isDidDomain(t)),[u,v]=H();return r.useEffect(()=>{I.get(`/dns-resolve?hostname=${window.location.hostname}`).then(({data:t})=>{y(t.address||"")}).catch(t=>{console.error(t.message)})},[]),o.jsxs(z,{children:[o.jsx(i,{className:"header",children:o.jsx(W,{title:n("setup.domain.title"),subTitle:n("setup.domain.subTitle"),onClickBack:S})}),o.jsxs(i,{className:"form",sx:{display:"flex",flexDirection:"column",gap:3,overflowY:"auto"},children:[o.jsxs(i,{children:[o.jsx(i,{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem",children:o.jsx(i,{display:"inline",children:`${n("setup.domain.buyOrConnect")} (${n("common.optional")})`})}),o.jsx(i,{mt:1,children:o.jsx(T,{blocklet:e,bugDidDomainProps:{appPk:l,appId:e.appPid,siteId:e.site.id,teamDid:e.meta.did,inBlockletSetup:!0},connectDomainProps:{autoFocus:!1,appPk:l,appId:e.appPid,siteId:e.site.id,teamDid:e.meta.did,cnameDomain:g,currentIp:c,inBlockletSetup:!0,shouldCheckDomain:!0,onInputDomain:t=>{m({domain:t.domain,type:t.type}),p(t.error)},onStateChange:t=>m({addDomainState:t}),onSuccess:t=>{const C={domain:t.domain,type:t.type,nftDid:t.nftDid,chainHost:t.chainHost};u.set("redirect",t.domain),v(u,{replace:!0}),m(C),s()},onError:p}})})]}),o.jsx(i,{children:o.jsx(A,{inSetup:!0,showAllDomains:!0,systemTips:o.jsx(i,{color:"text.primary",fontWeight:"fontWeightBold",fontSize:"1.125rem",mb:1,children:o.jsx(i,{display:"inline",children:n("setup.domain.skipDescription")})})})})]}),o.jsx($,{mt:8,disabled:!!a.addDomainState.text,blocklet:e,onStartNow:()=>s("complete"),children:a.domain?o.jsx(D,{variant:"contained",loading:!!a.addDomainState.text,disabled:j||!!a.addDomainState.text||!a.domain,onClick:()=>s(),children:a.addDomainState.text||n("setup.continue")}):o.jsx(D,{variant:"contained",disabled:!!a.addDomainState.text,onClick:()=>s(),children:n("setup.continue")})})]})}function jt(s){return o.jsx(E,{children:o.jsx(d,{...s})})}d.propTypes={onNext:x.func,onPrevious:x.func};d.defaultProps={onNext:()=>{},onPrevious:()=>{}};const z=k(N)`
2
2
  height: 100%;
3
3
  overflow-y: hidden;
4
4
 
@@ -1,5 +1,5 @@
1
1
  const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-CPE8Apzb.js","assets/vendor-react-DEoibe3W.js"])))=>i.map(i=>d[i]);
2
- import{k as p,r as ee,a as te,p as se,_ as b,a3 as j,b6 as ne,a1 as ie,q as oe,aI as re,X as ae}from"./vendor-ux-did-connect-pzpsrvqx.js";import{a9 as ce,j as e,al as g,T as w,y as T,ap as le,aa as z,O as H,ab as ue,ah as de}from"./vendor-mui-core-Bq8gXTan.js";import{r as o,h as fe}from"./vendor-react-DEoibe3W.js";import{K as h}from"./vendor-utils-BfZ4tlod.js";import{u as me,d as M}from"./index-CwUT0vPy.js";import{H as pe}from"./vendor-arcblock-CwufDgLV.js";import{f as S}from"./index-8eXqqyHQ.js";import{d as ge}from"./CheckCircle-DUJmWceY.js";import{g as D}from"./get-safe-url-D5KSEAKZ.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";var N;(N=window.env)!=null&&N.groupPathPrefix;p.ROLES.ADMIN,p.ROLES.OWNER;const y=()=>{const{searchParams:u}=new URL(window.location.href);return u.get("fromWallet")==="1"};var P={},he=ce;Object.defineProperty(P,"__esModule",{value:!0});var F=P.default=void 0,ye=he(ee()),xe=e;F=P.default=(0,ye.default)((0,xe.jsx)("path",{d:"M12 19c0-3.87 3.13-7 7-7 1.08 0 2.09.25 3 .68V6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h8.08c-.05-.33-.08-.66-.08-1M4 6l8 5 8-5v2l-8 5-8-5zm13.34 16-3.54-3.54 1.41-1.41 2.12 2.12 4.24-4.24L23 16.34z"}),"MarkEmailRead");const Ee=de.form`
2
+ import{k as p,r as ee,a as te,p as se,_ as b,a3 as j,b6 as ne,a1 as ie,q as oe,aI as re,X as ae}from"./vendor-ux-did-connect-pzpsrvqx.js";import{a9 as ce,j as e,al as g,T as w,y as T,ap as le,aa as z,O as H,ab as ue,ah as de}from"./vendor-mui-core-Bq8gXTan.js";import{r as o,h as fe}from"./vendor-react-DEoibe3W.js";import{K as h}from"./vendor-utils-BfZ4tlod.js";import{u as me,d as M}from"./index-CwUT0vPy.js";import{H as pe}from"./vendor-arcblock-CwufDgLV.js";import{f as S}from"./index-8eXqqyHQ.js";import{d as ge}from"./CheckCircle-DUJmWceY.js";import{g as D}from"./get-safe-url-B0-S5PGZ.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";var N;(N=window.env)!=null&&N.groupPathPrefix;p.ROLES.ADMIN,p.ROLES.OWNER;const y=()=>{const{searchParams:u}=new URL(window.location.href);return u.get("fromWallet")==="1"};var P={},he=ce;Object.defineProperty(P,"__esModule",{value:!0});var F=P.default=void 0,ye=he(ee()),xe=e;F=P.default=(0,ye.default)((0,xe.jsx)("path",{d:"M12 19c0-3.87 3.13-7 7-7 1.08 0 2.09.25 3 .68V6c0-1.1-.9-2-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h8.08c-.05-.33-.08-.66-.08-1M4 6l8 5 8-5v2l-8 5-8-5zm13.34 16-3.54-3.54 1.41-1.41 2.12 2.12 4.24-4.24L23 16.34z"}),"MarkEmailRead");const Ee=de.form`
3
3
  display: flex;
4
4
  flex-direction: column;
5
5
  align-items: center;
@@ -1 +1 @@
1
- import{j as e,ab as C,aa as T}from"./vendor-mui-core-Bq8gXTan.js";import{r as k,f as W}from"./vendor-react-DEoibe3W.js";import{a as j,F as b,b6 as S,at as I,a3 as h,k as L,ba as R}from"./vendor-ux-did-connect-pzpsrvqx.js";import{w as U}from"./wrap-locale-ClbCNOs0.js";import{g as v}from"./get-safe-url-B0-S5PGZ.js";import{S as N,s as F,a as _}from"./index-CwUT0vPy.js";import"./vendor-utils-BfZ4tlod.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CwufDgLV.js";function B({SessionContext:a,webWalletUrl:n,onSuccess:s}){var d,g;const{api:t,session:i}=k.useContext(a),{t:o,locale:f}=j(),u=W(),{searchParams:l}=new URL(window.location.href),p=l.get("redirect"),w=async(r,E)=>{s(r,E),await i.refresh(),h.success(o("exchangePassport.success")),setTimeout(()=>{if(p){const c=decodeURIComponent(p);c.startsWith(L.WELLKNOWN_SERVICE_PATH_PREFIX)?u(c,{replace:!0}):window.location.href=v(c)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},P=r=>{h.error(r.message)},m={},x=l.get("componentId");return x&&(m.componentId=x),i.loading?e.jsx(b,{children:e.jsx(C,{})}):e.jsx(S,{did:((d=window==null?void 0:window.blocklet)==null?void 0:d.appPid)||((g=window==null?void 0:window.env)==null?void 0:g.appPid),children:e.jsx(T,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(I,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:t.get,checkTimeout:10*60*1e3,webWalletUrl:n,onSuccess:w,onError:P,locale:f,messages:{title:o("exchangePassport.dialog.title"),scan:o("exchangePassport.dialog.scan"),confirm:o("exchangePassport.dialog.confirm"),success:o("exchangePassport.dialog.success")},extraParams:m,extraContent:null,hideCloseButton:!0})})})}const A=U(B);function G(){const a=R(),n=(s,t)=>{s.sessionToken&&(F(t(s.sessionToken)),_(t(s.refreshToken)))};return e.jsx(A,{SessionContext:N,webWalletUrl:a,onSuccess:n})}export{G as default};
1
+ import{j as e,ab as C,aa as T}from"./vendor-mui-core-Bq8gXTan.js";import{r as k,f as W}from"./vendor-react-DEoibe3W.js";import{a as j,F as b,b6 as S,at as I,a3 as h,k as L,ba as R}from"./vendor-ux-did-connect-pzpsrvqx.js";import{w as U}from"./wrap-locale-ClbCNOs0.js";import{g as v}from"./get-safe-url-D5KSEAKZ.js";import{S as N,s as F,a as _}from"./index-CwUT0vPy.js";import"./vendor-utils-BfZ4tlod.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CwufDgLV.js";function B({SessionContext:a,webWalletUrl:n,onSuccess:s}){var d,g;const{api:t,session:i}=k.useContext(a),{t:o,locale:f}=j(),u=W(),{searchParams:l}=new URL(window.location.href),p=l.get("redirect"),w=async(r,E)=>{s(r,E),await i.refresh(),h.success(o("exchangePassport.success")),setTimeout(()=>{if(p){const c=decodeURIComponent(p);c.startsWith(L.WELLKNOWN_SERVICE_PATH_PREFIX)?u(c,{replace:!0}):window.location.href=v(c)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},P=r=>{h.error(r.message)},m={},x=l.get("componentId");return x&&(m.componentId=x),i.loading?e.jsx(b,{children:e.jsx(C,{})}):e.jsx(S,{did:((d=window==null?void 0:window.blocklet)==null?void 0:d.appPid)||((g=window==null?void 0:window.env)==null?void 0:g.appPid),children:e.jsx(T,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(I,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:t.get,checkTimeout:10*60*1e3,webWalletUrl:n,onSuccess:w,onError:P,locale:f,messages:{title:o("exchangePassport.dialog.title"),scan:o("exchangePassport.dialog.scan"),confirm:o("exchangePassport.dialog.confirm"),success:o("exchangePassport.dialog.success")},extraParams:m,extraContent:null,hideCloseButton:!0})})})}const A=U(B);function G(){const a=R(),n=(s,t)=>{s.sessionToken&&(F(t(s.sessionToken)),_(t(s.refreshToken)))};return e.jsx(A,{SessionContext:N,webWalletUrl:a,onSuccess:n})}export{G as default};
@@ -1,4 +1,4 @@
1
- import{j as e,aa as t,ab as P,ap as W,H as d,ah as B}from"./vendor-mui-core-Bq8gXTan.js";import{r as l}from"./vendor-react-DEoibe3W.js";import{A as v}from"./vendor-utils-BfZ4tlod.js";import{d as I}from"./Launch-DFS3fgjy.js";import{bb as L,at as $}from"./vendor-ux-did-connect-pzpsrvqx.js";import{W as A}from"./did-address-NnOD1W_A.js";import{P as E}from"./page-header-DNvUdNpI.js";import{k as T,u as z}from"./index-CwUT0vPy.js";import{S as D}from"./layout-DEiEwPzB.js";import{S as F}from"./step-actions-BNbc1l8F.js";import{S as m}from"./button-D_ZVjN82.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CwufDgLV.js";import"./content-layout-BC2QkTYi.js";import"./use-mobile-CtTQsfXN.js";function u({onNext:n,onPrevious:f}){const{locale:x,t:s}=l.useContext(L),{blocklet:a,gas:c,tokenInfo:h,actions:j}=T(),{api:y}=z(),[g,o]=l.useState(!1),{need:p="",current:b="",owe:r=99999,deficiency:k,symbol:C="",endpoint:i}=c||{},{origin:S="/"}=i?new URL(i):{};l.useEffect(()=>{const N=setInterval(()=>{j.refreshFuel()},2e3);return()=>{clearInterval(N)}},[]);const w=()=>{o(!1)};return c?e.jsxs(H,{children:[e.jsx("div",{className:"header",children:e.jsx(E,{title:s("setup.fuel.title"),onClickBack:f})}),e.jsxs(t,{className:"qr-body",children:[e.jsxs(t,{mb:6,className:"tip",children:[s("setup.fuel.tipStart").replace("slot",""),e.jsx("span",{className:"amount",children:`${p} ${C}`}),s("setup.fuel.tipEnd")]}),e.jsx(t,{fontSize:16,fontWeight:"fontWeightBold",mb:.5,children:s("setup.fuel.addressTitle")}),e.jsxs(t,{display:"flex",alignItems:"center",children:[e.jsx(A,{className:"address",did:a.appDid}),e.jsx(W,{style:{lineHeight:1},target:"_blank",href:v(S,"/explorer/accounts/",a.appDid),underline:"hover",children:e.jsx(I,{className:"icon-launch"})})]}),e.jsx(t,{my:2,children:e.jsx(m,{color:"primary",onClick:()=>o(!0),disabled:!r,children:s("setup.fuel.fuelApp")})}),e.jsx($,{popup:!0,open:g,action:"fuel",checkFn:y.get,checkTimeout:10*60*1e3,onSuccess:w,onClose:()=>o(!1),locale:x,messages:{title:s("setup.connect.title"),scan:s("setup.connect.scan"),confirm:s("setup.connect.confirm"),success:s("setup.connect.success")},extraParams:{amount:k,...h,endpoint:i}}),e.jsxs(t,{display:"flex",color:"text.secondary",children:[e.jsxs(t,{display:"flex",children:[e.jsxs(t,{children:[s("setup.fuel.need"),":"]}),e.jsx(t,{ml:.5,color:"primary.main",fontWeight:"fontWeightBold",children:p})]}),e.jsxs(t,{display:"flex",ml:3,children:[e.jsxs(t,{children:[s("setup.fuel.current"),":"]}),e.jsx(t,{ml:.5,color:r>0?"error.main":"primary.main",fontWeight:"fontWeightBold",children:b})]})]})]}),e.jsx(F,{mt:8,children:e.jsx(m,{disabled:r>0,onClick:()=>n(),children:s("setup.next")})})]}):e.jsx(t,{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",children:e.jsx(P,{})})}u.propTypes={onNext:d.func,onPrevious:d.func};u.defaultProps={onNext:()=>{},onPrevious:()=>{}};const H=B(D)`
1
+ import{j as e,aa as t,ab as P,ap as W,H as d,ah as B}from"./vendor-mui-core-Bq8gXTan.js";import{r as l}from"./vendor-react-DEoibe3W.js";import{A as v}from"./vendor-utils-BfZ4tlod.js";import{d as I}from"./Launch-DFS3fgjy.js";import{bb as L,at as $}from"./vendor-ux-did-connect-pzpsrvqx.js";import{W as A}from"./did-address-NnOD1W_A.js";import{P as E}from"./page-header-DNvUdNpI.js";import{k as T,u as z}from"./index-CwUT0vPy.js";import{S as D}from"./layout-DEiEwPzB.js";import{S as F}from"./step-actions-BNbc1l8F.js";import{S as m}from"./button-D_ZVjN82.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CwufDgLV.js";import"./content-layout-BC2QkTYi.js";import"./use-mobile-DwzRjjku.js";function u({onNext:n,onPrevious:f}){const{locale:x,t:s}=l.useContext(L),{blocklet:a,gas:c,tokenInfo:h,actions:j}=T(),{api:y}=z(),[g,o]=l.useState(!1),{need:p="",current:b="",owe:r=99999,deficiency:k,symbol:C="",endpoint:i}=c||{},{origin:S="/"}=i?new URL(i):{};l.useEffect(()=>{const N=setInterval(()=>{j.refreshFuel()},2e3);return()=>{clearInterval(N)}},[]);const w=()=>{o(!1)};return c?e.jsxs(H,{children:[e.jsx("div",{className:"header",children:e.jsx(E,{title:s("setup.fuel.title"),onClickBack:f})}),e.jsxs(t,{className:"qr-body",children:[e.jsxs(t,{mb:6,className:"tip",children:[s("setup.fuel.tipStart").replace("slot",""),e.jsx("span",{className:"amount",children:`${p} ${C}`}),s("setup.fuel.tipEnd")]}),e.jsx(t,{fontSize:16,fontWeight:"fontWeightBold",mb:.5,children:s("setup.fuel.addressTitle")}),e.jsxs(t,{display:"flex",alignItems:"center",children:[e.jsx(A,{className:"address",did:a.appDid}),e.jsx(W,{style:{lineHeight:1},target:"_blank",href:v(S,"/explorer/accounts/",a.appDid),underline:"hover",children:e.jsx(I,{className:"icon-launch"})})]}),e.jsx(t,{my:2,children:e.jsx(m,{color:"primary",onClick:()=>o(!0),disabled:!r,children:s("setup.fuel.fuelApp")})}),e.jsx($,{popup:!0,open:g,action:"fuel",checkFn:y.get,checkTimeout:10*60*1e3,onSuccess:w,onClose:()=>o(!1),locale:x,messages:{title:s("setup.connect.title"),scan:s("setup.connect.scan"),confirm:s("setup.connect.confirm"),success:s("setup.connect.success")},extraParams:{amount:k,...h,endpoint:i}}),e.jsxs(t,{display:"flex",color:"text.secondary",children:[e.jsxs(t,{display:"flex",children:[e.jsxs(t,{children:[s("setup.fuel.need"),":"]}),e.jsx(t,{ml:.5,color:"primary.main",fontWeight:"fontWeightBold",children:p})]}),e.jsxs(t,{display:"flex",ml:3,children:[e.jsxs(t,{children:[s("setup.fuel.current"),":"]}),e.jsx(t,{ml:.5,color:r>0?"error.main":"primary.main",fontWeight:"fontWeightBold",children:b})]})]})]}),e.jsx(F,{mt:8,children:e.jsx(m,{disabled:r>0,onClick:()=>n(),children:s("setup.next")})})]}):e.jsx(t,{display:"flex",justifyContent:"center",alignItems:"center",width:"100%",children:e.jsx(P,{})})}u.propTypes={onNext:d.func,onPrevious:d.func};u.defaultProps={onNext:()=>{},onPrevious:()=>{}};const H=B(D)`
2
2
  .qr-body {
3
3
  width: 580px;
4
4
  ${n=>n.theme.breakpoints.down("md")} {
@@ -1,4 +1,4 @@
1
- import{j as e,H as h,ah as Je,T as C,ab as A,e as Ze,cD as Z,ae as G,cE as Ge,aa as j,al as W,s as ge,ad as Se,ap as et,cF as ze,a9 as ye,q,b7 as Y,b8 as H,y as tt,at as st,as as Ae}from"./vendor-mui-core-Bq8gXTan.js";import{l as nt,i as Pe,b as fe}from"./vendor-hooks-DqdmWCmo.js";import{r as y,h as ot}from"./vendor-react-DEoibe3W.js";import{c as _,y as rt,W as at,J as it,X as ct,l as lt,w as dt,Y as ue,x as ut}from"./vendor-arcblock-CwufDgLV.js";import{a3 as B,a as T,bb as pt,k as R,bg as V,ac as mt,r as je,bF as ft,B as pe,at as ht,F as _e,ax as xt}from"./vendor-ux-did-connect-pzpsrvqx.js";import{G as O,D as M,y as E,a3 as gt,af as St,aF as yt}from"./index-CwUT0vPy.js";import{u as jt}from"./use-mobile-DwzRjjku.js";import{b as Q,d as Me,a8 as bt,I as Ct,E as Ue,A as he}from"./vendor-utils-BfZ4tlod.js";import"./api-C1S8LUld.js";import{u as Ne,C as kt,D as Dt,a as Bt}from"./connect-to-CxoBjkcK.js";import{b as wt,c as Et,d as Tt,i as It,e as xe,f as Rt,h as vt,j as At}from"./spaces-DUkzPTBd.js";import{f as X}from"./index-8eXqqyHQ.js";import{I as Ot}from"./index-DPIWnhb5.js";import{R as Lt}from"./index-w4f-mlFt.js";import{d as zt}from"./MoreHoriz-ChJ3K52h.js";import{c as Pt}from"./dashboard-t9EszOna.js";import{d as _t}from"./DeleteOutline-BKSMNwfT.js";import{g as Oe}from"./get-safe-url-B0-S5PGZ.js";import{S as Mt}from"./switch-control-Brwb8ptk.js";import{C as Ut,u as Nt}from"./config-space-D6ScnWdA.js";import{L as Le}from"./list-header-C7gle0n0.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-CaPDqrQ7.js";import"./confirm-RvA9mFot.js";import"./PlayArrow-BqVYRyLK.js";import"./session-BGdAM8zS.js";import"./use-blocklet-logo-4UB-MFD3.js";import"./InfoOutlined-BVWbftGI.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CtTQsfXN.js";async function Wt({blockletDid:t,nodeApi:r,spaceGateways:o}){let s=!1;const i=await Promise.all(o.map(async n=>{let{name:a}=n;const d=await wt(n.endpoint);return!Q(d)&&d!==a&&(a=d,s=!0),{...n,name:a}}));return s&&await Promise.all(i.filter(n=>n.did).map(n=>r.updateBlockletSpaceGateway({input:{did:t,where:{did:n.did},spaceGateway:{...n}}}))),i}function Ft({refresh:t}={}){var i;const{blocklet:r}=O(),o=(i=r==null?void 0:r.meta)==null?void 0:i.did,{api:s}=M();return nt(async()=>{if(!o)return[];const{spaceGateways:n}=await s.getBlockletSpaceGateways({input:{did:o}});return await Wt({blockletDid:o,nodeApi:s,spaceGateways:n})??[]},{refreshDeps:[o,t],onError(n){var a;(a=n==null?void 0:n.message)!=null&&a.includes("not logged")?console.warn(n):(console.error(n),B.error(X(n)))}})}function We({deps:t,setLoading:r,backupDate:o}={deps:[],setLoading:()=>{},backupDate:new Date}){var x;const{blocklet:s}=O(),[i,n]=y.useState([]),{api:a}=M(),[d,u]=y.useMemo(()=>o?[E(o).startOf("day").toISOString(),E(o).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[o]),c=Me(async()=>{try{if(r(!0),!s){n([]);return}const{backups:p}=await a.getBlockletBackups({input:{did:s.meta.did,startTime:d,endTime:u}});n(p??[])}catch(p){console.error(p),B.error(X(p))}finally{r(!1)}},1e3);return Pe(async()=>{c()},[(x=s==null?void 0:s.meta)==null?void 0:x.did].concat(t)),{backups:i}}function Kt({appDid:t}){const{backups:r}=We(),[o,s]=y.useState({message:"",progress:0,completed:!1}),i=M(),{ws:{useSubscription:n}}=i;return n(_.BlockletEvents.backupProgress,a=>{t===(a==null?void 0:a.appDid)&&s(()=>({...a}))},[t]),y.useEffect(()=>{var a;if(r!=null&&r.length&&bt((a=r[0])==null?void 0:a.status)){const[d]=r;s(()=>({message:d.message,progress:d.progress,completed:d.progress>=100}))}},[r]),o}function $t({deps:t=[],setLoading:r=()=>{}}={}){var d;const{blocklet:o}=O(),[s,i]=y.useState([]),{api:n}=M(),a=y.useCallback(Me(async()=>{var u;if(!n||!((u=o==null?void 0:o.meta)!=null&&u.did)){i([]);return}try{r(!0);const c=E(),x=c.subtract(1,"year"),{summary:p}=await n.getBlockletBackupSummary({input:{did:o.meta.did,startTime:x.toISOString(),endTime:c.toISOString()}});i(Array.isArray(p)?p:[])}catch(c){console.error("Failed to fetch backup summary:",c),B.error(X(c)),i([])}finally{r(!1)}},1e3),[]);return Pe(async()=>(await a(),()=>{a.cancel()}),[(d=o==null?void 0:o.meta)==null?void 0:d.did].concat(t)),{backupSummary:s}}const Fe=y.createContext({}),{Provider:qt,Consumer:Ws}=Fe;function be({children:t}){var K;const{t:r}=T(),{api:o}=M(),{blocklet:s}=O(),[i,n]=y.useState(null),[a,d]=y.useState(!1),{data:u,loading:c,mutate:x}=Ft({refresh:a}),p=Ct(u),g=Kt({appDid:s==null?void 0:s.appDid}),f=y.useMemo(()=>Et(s==null?void 0:s.environments),[s==null?void 0:s.environments]),[b,D]=y.useState(!1),[S,l]=y.useState(!1),{backups:te}=We({deps:[S,i],setLoading:D,backupDate:i}),[se,ne]=y.useState(!1),{backupSummary:oe}=$t({deps:[se]}),[U,z]=y.useState(u==null?void 0:u.find(m=>m.endpoint===f)),I=(K=s==null?void 0:s.settings)==null?void 0:K.autoBackup,v=()=>{d(m=>!m)},re=()=>{ne(m=>!m)},ae=()=>{l(m=>!m)},F=async m=>{await o.updateAutoBackup({input:{did:s.meta.did,autoBackup:m}})},J=async()=>{await o.abortBlockletBackup({input:{appPid:s.meta.did}})},ie=async(m,N)=>{try{x(w=>{const P=[...w];return P.push({...m,loading:!0}),P}),await o.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:m}}),f!==N&&await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:N}]}}),z(m),v(),B.success(r("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"}))}catch(w){throw console.error(w),x(P=>[...P].filter(de=>de.did!==m.did)),w}},ce=async m=>{m&&(m.endpoint===f&&(await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I!=null&&I.enabled&&await F({enabled:!1})),await o.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:m==null?void 0:m.did}}),x(N=>{const w=[...N];return w.splice(w.indexOf(m),1),w}),z(m),v())},le=async m=>{await Promise.all([o.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:m.did},spaceGateway:m}}),f!==m.endpoint&&o.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:m.endpoint}]}})]),B.success(r("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"})),v()},k=m=>(m==null?void 0:m.endpoint)===f;return e.jsx(qt,{value:{spaceGateways:u||[],selectedSpaceGateway:U,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:v,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:p,spaceGatewayIsSelected:k,updateAutoBackup:F,abortBlockletBackup:J,backupEndpoint:f,backupProgress:g,backups:te,backupSummary:oe,refreshBackupSummary:re,refreshBackups:ae,setBackupDate:n,backupsLoading:b,autoBackup:I},children:t})}be.propTypes={children:h.any.isRequired};be.defaultProps={};function L(){return y.useContext(Fe)}function ee({...t}){const{blocklet:r}=O(),{info:o}=M(),{t:s}=T(),i=Ne({blocklet:r}),n=gt(o),{spaceGateways:a,addSpaceGateway:d}=L(),u={checkFn:Ue.create({baseURL:he(window.location.origin,St())}).get,webWalletUrl:n,extraParams:{appPid:r.appPid,appDid:i.appDid,appName:i.appName,appDescription:i.appDescription,appUrl:i.appUrl,referrer:i.referrer,scopes:i.scopes,nodeDid:o.did}},c=async({endpoint:p,name:g,did:f})=>{const b=await Tt(p);if(!await It(b)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(a.some(l=>l.endpoint===p)){B.error(s("storage.spaces.gateway.add.duplicate",{name:g}));return}await d({name:g,did:f,url:b,endpoint:p},p)},x=async({spaceGateway:p})=>{try{await c(p)}catch(g){console.error(g),B.error(X(g))}};return e.jsx(rt,{...t,connectScope:"app",options:u,onSuccess:x})}ee.propTypes={};ee.defaultProps={};function Ke({...t}){const{t:r}=y.useContext(pt),{blocklet:o,loadingDiskInfo:s,actions:i}=O();if(y.useEffect(()=>{i==null||i.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),o.diskInfo){const n=(u,c,x)=>e.jsxs(C,{children:[u," ",e.jsx("strong",{children:c?yt(c):"empty"})]}),a=o.environments.reduce((u,c)=>(u[c.key]=c.value,u),{}),d=[{key:"appDir",name:r("blocklet.diskInfo.appDir"),value:n(a.BLOCKLET_APP_DIR,o.diskInfo.app)},{key:"dataDir",name:r("blocklet.diskInfo.dataDir"),value:n(a.BLOCKLET_DATA_DIR,o.diskInfo.data)},{key:"logDir",name:r("blocklet.diskInfo.logDir"),value:n(a.BLOCKLET_LOG_DIR,o.diskInfo.log)},{key:"cacheDir",name:r("blocklet.diskInfo.cacheDir"),value:n(a.BLOCKLET_CACHE_DIR,o.diskInfo.cache)}];return e.jsx(Yt,{component:"div",...t,children:d.map(u=>e.jsx(Ot,{valueComponent:"div",nameWidth:120,name:u.name,children:u.value},u.key))})}return s?e.jsx(A,{}):e.jsx(C,{children:r("blocklet.diskInfo.empty")})}const Yt=Je(C)``;function Ce(){const{t}=T(),{setBackupDate:r,backupSummary:o}=L(),s=at({key:"lg"}),i=y.useRef(null),n=Ze(),a=y.useCallback(c=>{r(c)},[r]),d=y.useMemo(()=>{const c=E().add(1,"day"),x=E().subtract(11,"month").startOf("month"),p=new Map(o.map(f=>[f.date,{date:f.date,successCount:f.successCount,errorCount:f.errorCount}])),g=[];for(let f=x.clone();E(f).isBefore(c);f=f.add(1,"day")){const b=f.format("YYYY-MM-DD");g.push(p.get(b)||{date:b,successCount:0,errorCount:0})}return g},[o]),u=y.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:b=>{const{date:D,successCount:S,errorCount:l}=d[b.dataIndex]||{date:b.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${D}</div>`,`<div>${t("common.succeeded")}: ${S}</div>`,`<div>${t("common.failed")}: ${l}</div>`].join(`
1
+ import{j as e,H as h,ah as Je,T as C,ab as A,e as Ze,cD as Z,ae as G,cE as Ge,aa as j,al as W,s as ge,ad as Se,ap as et,cF as ze,a9 as ye,q,b7 as Y,b8 as H,y as tt,at as st,as as Ae}from"./vendor-mui-core-Bq8gXTan.js";import{l as nt,i as Pe,b as fe}from"./vendor-hooks-DqdmWCmo.js";import{r as y,h as ot}from"./vendor-react-DEoibe3W.js";import{c as _,y as rt,W as at,J as it,X as ct,l as lt,w as dt,Y as ue,x as ut}from"./vendor-arcblock-CwufDgLV.js";import{a3 as B,a as T,bb as pt,k as R,bg as V,ac as mt,r as je,bF as ft,B as pe,at as ht,F as _e,ax as xt}from"./vendor-ux-did-connect-pzpsrvqx.js";import{G as O,D as M,y as E,a3 as gt,af as St,aF as yt}from"./index-CwUT0vPy.js";import{u as jt}from"./use-mobile-CtTQsfXN.js";import{b as Q,d as Me,a8 as bt,I as Ct,E as Ue,A as he}from"./vendor-utils-BfZ4tlod.js";import"./api-C1S8LUld.js";import{u as Ne,C as kt,D as Dt,a as Bt}from"./connect-to-CxoBjkcK.js";import{b as wt,c as Et,d as Tt,i as It,e as xe,f as Rt,h as vt,j as At}from"./spaces-DUkzPTBd.js";import{f as X}from"./index-8eXqqyHQ.js";import{I as Ot}from"./index-DPIWnhb5.js";import{R as Lt}from"./index-w4f-mlFt.js";import{d as zt}from"./MoreHoriz-ChJ3K52h.js";import{c as Pt}from"./dashboard-t9EszOna.js";import{d as _t}from"./DeleteOutline-BKSMNwfT.js";import{g as Oe}from"./get-safe-url-D5KSEAKZ.js";import{S as Mt}from"./switch-control-Brwb8ptk.js";import{C as Ut,u as Nt}from"./config-space-D6ScnWdA.js";import{L as Le}from"./list-header-C7gle0n0.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-CaPDqrQ7.js";import"./confirm-RvA9mFot.js";import"./PlayArrow-BqVYRyLK.js";import"./session-BGdAM8zS.js";import"./use-blocklet-logo-4UB-MFD3.js";import"./InfoOutlined-BVWbftGI.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DwzRjjku.js";async function Wt({blockletDid:t,nodeApi:r,spaceGateways:o}){let s=!1;const i=await Promise.all(o.map(async n=>{let{name:a}=n;const d=await wt(n.endpoint);return!Q(d)&&d!==a&&(a=d,s=!0),{...n,name:a}}));return s&&await Promise.all(i.filter(n=>n.did).map(n=>r.updateBlockletSpaceGateway({input:{did:t,where:{did:n.did},spaceGateway:{...n}}}))),i}function Ft({refresh:t}={}){var i;const{blocklet:r}=O(),o=(i=r==null?void 0:r.meta)==null?void 0:i.did,{api:s}=M();return nt(async()=>{if(!o)return[];const{spaceGateways:n}=await s.getBlockletSpaceGateways({input:{did:o}});return await Wt({blockletDid:o,nodeApi:s,spaceGateways:n})??[]},{refreshDeps:[o,t],onError(n){var a;(a=n==null?void 0:n.message)!=null&&a.includes("not logged")?console.warn(n):(console.error(n),B.error(X(n)))}})}function We({deps:t,setLoading:r,backupDate:o}={deps:[],setLoading:()=>{},backupDate:new Date}){var x;const{blocklet:s}=O(),[i,n]=y.useState([]),{api:a}=M(),[d,u]=y.useMemo(()=>o?[E(o).startOf("day").toISOString(),E(o).endOf("day").toISOString()]:[E().startOf("year").toISOString(),E().endOf("day").toISOString()],[o]),c=Me(async()=>{try{if(r(!0),!s){n([]);return}const{backups:p}=await a.getBlockletBackups({input:{did:s.meta.did,startTime:d,endTime:u}});n(p??[])}catch(p){console.error(p),B.error(X(p))}finally{r(!1)}},1e3);return Pe(async()=>{c()},[(x=s==null?void 0:s.meta)==null?void 0:x.did].concat(t)),{backups:i}}function Kt({appDid:t}){const{backups:r}=We(),[o,s]=y.useState({message:"",progress:0,completed:!1}),i=M(),{ws:{useSubscription:n}}=i;return n(_.BlockletEvents.backupProgress,a=>{t===(a==null?void 0:a.appDid)&&s(()=>({...a}))},[t]),y.useEffect(()=>{var a;if(r!=null&&r.length&&bt((a=r[0])==null?void 0:a.status)){const[d]=r;s(()=>({message:d.message,progress:d.progress,completed:d.progress>=100}))}},[r]),o}function $t({deps:t=[],setLoading:r=()=>{}}={}){var d;const{blocklet:o}=O(),[s,i]=y.useState([]),{api:n}=M(),a=y.useCallback(Me(async()=>{var u;if(!n||!((u=o==null?void 0:o.meta)!=null&&u.did)){i([]);return}try{r(!0);const c=E(),x=c.subtract(1,"year"),{summary:p}=await n.getBlockletBackupSummary({input:{did:o.meta.did,startTime:x.toISOString(),endTime:c.toISOString()}});i(Array.isArray(p)?p:[])}catch(c){console.error("Failed to fetch backup summary:",c),B.error(X(c)),i([])}finally{r(!1)}},1e3),[]);return Pe(async()=>(await a(),()=>{a.cancel()}),[(d=o==null?void 0:o.meta)==null?void 0:d.did].concat(t)),{backupSummary:s}}const Fe=y.createContext({}),{Provider:qt,Consumer:Ws}=Fe;function be({children:t}){var K;const{t:r}=T(),{api:o}=M(),{blocklet:s}=O(),[i,n]=y.useState(null),[a,d]=y.useState(!1),{data:u,loading:c,mutate:x}=Ft({refresh:a}),p=Ct(u),g=Kt({appDid:s==null?void 0:s.appDid}),f=y.useMemo(()=>Et(s==null?void 0:s.environments),[s==null?void 0:s.environments]),[b,D]=y.useState(!1),[S,l]=y.useState(!1),{backups:te}=We({deps:[S,i],setLoading:D,backupDate:i}),[se,ne]=y.useState(!1),{backupSummary:oe}=$t({deps:[se]}),[U,z]=y.useState(u==null?void 0:u.find(m=>m.endpoint===f)),I=(K=s==null?void 0:s.settings)==null?void 0:K.autoBackup,v=()=>{d(m=>!m)},re=()=>{ne(m=>!m)},ae=()=>{l(m=>!m)},F=async m=>{await o.updateAutoBackup({input:{did:s.meta.did,autoBackup:m}})},J=async()=>{await o.abortBlockletBackup({input:{appPid:s.meta.did}})},ie=async(m,N)=>{try{x(w=>{const P=[...w];return P.push({...m,loading:!0}),P}),await o.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:m}}),f!==N&&await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:N}]}}),z(m),v(),B.success(r("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"}))}catch(w){throw console.error(w),x(P=>[...P].filter(de=>de.did!==m.did)),w}},ce=async m=>{m&&(m.endpoint===f&&(await o.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I!=null&&I.enabled&&await F({enabled:!1})),await o.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:m==null?void 0:m.did}}),x(N=>{const w=[...N];return w.splice(w.indexOf(m),1),w}),z(m),v())},le=async m=>{await Promise.all([o.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:m.did},spaceGateway:m}}),f!==m.endpoint&&o.configBlocklet({input:{did:[s.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:m.endpoint}]}})]),B.success(r("storage.spaces.connectedWithName",{name:(m==null?void 0:m.name)??"DID Spaces"})),v()},k=m=>(m==null?void 0:m.endpoint)===f;return e.jsx(qt,{value:{spaceGateways:u||[],selectedSpaceGateway:U,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:v,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:p,spaceGatewayIsSelected:k,updateAutoBackup:F,abortBlockletBackup:J,backupEndpoint:f,backupProgress:g,backups:te,backupSummary:oe,refreshBackupSummary:re,refreshBackups:ae,setBackupDate:n,backupsLoading:b,autoBackup:I},children:t})}be.propTypes={children:h.any.isRequired};be.defaultProps={};function L(){return y.useContext(Fe)}function ee({...t}){const{blocklet:r}=O(),{info:o}=M(),{t:s}=T(),i=Ne({blocklet:r}),n=gt(o),{spaceGateways:a,addSpaceGateway:d}=L(),u={checkFn:Ue.create({baseURL:he(window.location.origin,St())}).get,webWalletUrl:n,extraParams:{appPid:r.appPid,appDid:i.appDid,appName:i.appName,appDescription:i.appDescription,appUrl:i.appUrl,referrer:i.referrer,scopes:i.scopes,nodeDid:o.did}},c=async({endpoint:p,name:g,did:f})=>{const b=await Tt(p);if(!await It(b)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(a.some(l=>l.endpoint===p)){B.error(s("storage.spaces.gateway.add.duplicate",{name:g}));return}await d({name:g,did:f,url:b,endpoint:p},p)},x=async({spaceGateway:p})=>{try{await c(p)}catch(g){console.error(g),B.error(X(g))}};return e.jsx(rt,{...t,connectScope:"app",options:u,onSuccess:x})}ee.propTypes={};ee.defaultProps={};function Ke({...t}){const{t:r}=y.useContext(pt),{blocklet:o,loadingDiskInfo:s,actions:i}=O();if(y.useEffect(()=>{i==null||i.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),o.diskInfo){const n=(u,c,x)=>e.jsxs(C,{children:[u," ",e.jsx("strong",{children:c?yt(c):"empty"})]}),a=o.environments.reduce((u,c)=>(u[c.key]=c.value,u),{}),d=[{key:"appDir",name:r("blocklet.diskInfo.appDir"),value:n(a.BLOCKLET_APP_DIR,o.diskInfo.app)},{key:"dataDir",name:r("blocklet.diskInfo.dataDir"),value:n(a.BLOCKLET_DATA_DIR,o.diskInfo.data)},{key:"logDir",name:r("blocklet.diskInfo.logDir"),value:n(a.BLOCKLET_LOG_DIR,o.diskInfo.log)},{key:"cacheDir",name:r("blocklet.diskInfo.cacheDir"),value:n(a.BLOCKLET_CACHE_DIR,o.diskInfo.cache)}];return e.jsx(Yt,{component:"div",...t,children:d.map(u=>e.jsx(Ot,{valueComponent:"div",nameWidth:120,name:u.name,children:u.value},u.key))})}return s?e.jsx(A,{}):e.jsx(C,{children:r("blocklet.diskInfo.empty")})}const Yt=Je(C)``;function Ce(){const{t}=T(),{setBackupDate:r,backupSummary:o}=L(),s=at({key:"lg"}),i=y.useRef(null),n=Ze(),a=y.useCallback(c=>{r(c)},[r]),d=y.useMemo(()=>{const c=E().add(1,"day"),x=E().subtract(11,"month").startOf("month"),p=new Map(o.map(f=>[f.date,{date:f.date,successCount:f.successCount,errorCount:f.errorCount}])),g=[];for(let f=x.clone();E(f).isBefore(c);f=f.add(1,"day")){const b=f.format("YYYY-MM-DD");g.push(p.get(b)||{date:b,successCount:0,errorCount:0})}return g},[o]),u=y.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:b=>{const{date:D,successCount:S,errorCount:l}=d[b.dataIndex]||{date:b.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${D}</div>`,`<div>${t("common.succeeded")}: ${S}</div>`,`<div>${t("common.failed")}: ${l}</div>`].join(`
2
2
  `)},backgroundColor:n.palette.background.paper,borderColor:n.palette.divider,textStyle:{color:n.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${n.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:Z[600]},{min:-9,max:-6,color:Z[500]},{min:-6,max:-3,color:Z[400]},{min:-3,max:-1,color:Z[300]},{min:0,max:0,color:n.palette.grey[200]},{min:1,max:3,color:G[300]},{min:3,max:6,color:G[400]},{min:6,max:9,color:G[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:G[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:n.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,color:n.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:n.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:n.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[E().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),E().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:d.map(b=>[b.date,b.errorCount?-b.errorCount:b.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:Ge[200],color:"inherit"}}}}),[d,t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(j,{ref:i,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(j,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(Lt,{option:u,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:c=>{c.componentType==="series"&&c.data&&a(c.data[0])}}})})}),e.jsx(j,{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2,children:e.jsxs(W,{direction:s?"column":"row",spacing:s?2:1,width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center",children:[e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.failed")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.without")})]}),e.jsxs(W,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(j,{width:32,height:12,borderRadius:.5,sx:{background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(C,{variant:"body2",color:"text.secondary",children:t("storage.spaces.backup.succeeded")})]})]})})]})}Ce.propTypes={};const Ht=ge(({className:t,...r})=>e.jsx(Se,{...r,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function ke({status:t,message:r,createdAt:o}){const{t:s}=T(),i=t===R.BACKUPS.STATUS.PROGRESS&&E().diff(o,"hours")>=R.BACKUPS.TIMEOUT_HOURS,n=i&&s("common.timeoutError"),a=t===R.BACKUPS.STATUS.PROGRESS&&!i,d=t===R.BACKUPS.STATUS.SUCCEEDED&&!i;return a?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(A,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):d?e.jsx(V,{type:"success",children:s("common.succeeded")}):e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(V,{type:"error",children:s("common.failed")}),"  ",e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:r||n,children:e.jsx(ze,{children:e.jsx(it,{style:{width:"24px",height:"24px"},color:"error"})})})]})}ke.propTypes={status:h.string.isRequired,message:h.string,createdAt:h.string.isRequired};ke.defaultProps={message:""};function De({metadata:t}){const{t:r}=T();if(Q(t))return e.jsx(V,{type:"success",children:r("common.succeeded")});const o=t.count||0,s=t.size||0,i=ct(s,{iec:!0}),n=e.jsxs(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:[e.jsxs(C,{variant:"body2",children:[r("common.fileCount"),": ",o]}),e.jsxs(C,{variant:"body2",children:[r("common.fileSize"),": ",i]})]});return e.jsxs(j,{display:"inline-flex",alignItems:"center",children:[e.jsx(V,{type:"success",children:r("common.succeeded")})," ",e.jsx(Ht,{title:n,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ze,{children:e.jsx(lt,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}De.propTypes={metadata:h.object};De.defaultProps={metadata:{}};function Be(){const{t,locale:r}=T(),{spaceGateways:o,backups:s,backupsLoading:i}=L(),n=y.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:d=>{var D;const{targetUrl:u,targetName:c,status:x,createdAt:p}=s[d],g=x===R.BACKUPS.STATUS.PROGRESS&&E().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,f=x===R.BACKUPS.STATUS.SUCCEEDED&&!g,b=c||((D=o.find(S=>u==null?void 0:u.includes(xe(S==null?void 0:S.endpoint))))==null?void 0:D.name)||"Unknown DID Space";return f?e.jsx(et,{fontSize:"16px",href:u,target:"_blank",children:b}):e.jsx(C,{variant:"body1",fontSize:"16px",children:b})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:d=>{const u=t(d===0?"common.auto":"common.manual");return e.jsx(V,{children:u})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:d=>E(d).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:d=>Q(d)?"":E(d).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:d=>{const u=(s==null?void 0:s[d])??{},{status:c,message:x,createdAt:p,metadata:g}=u,f=c===R.BACKUPS.STATUS.PROGRESS&&E().diff(p,"hours")>=R.BACKUPS.TIMEOUT_HOURS,b=c===R.BACKUPS.STATUS.PROGRESS&&!f,D=c===R.BACKUPS.STATUS.SUCCEEDED&&!f;return b?e.jsxs(C,{display:"inline-flex",alignItems:"center",fontSize:"14px",children:[e.jsx(A,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):D?e.jsx(De,{metadata:g}):e.jsx(ke,{status:c,message:x,createdAt:p})}}}],[s,o,t]),a=y.useMemo(()=>!(s!=null&&s.length),[s]);return e.jsx(e.Fragment,{children:a?e.jsx(j,{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px",children:t("storage.spaces.record.emptyData")}):e.jsx(mt,{title:"",loading:i,data:s,columns:n,emptyNode:t("storage.spaces.record.emptyData",r),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}Be.propTypes={};function $e(){const{t}=T();return e.jsxs(j,{children:[e.jsxs(j,{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"},children:[e.jsxs(j,{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240,children:[e.jsx(dt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(C,{my:2,sx:{textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(ee,{})]}),e.jsxs(j,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.spaces.backup.records")})}),e.jsx(Ce,{})]})]}),e.jsx(Be,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2,children:t("common.dataStorage")}),e.jsx(Ke,{})]})}$e.propTypes={};var we={},Vt=ye;Object.defineProperty(we,"__esModule",{value:!0});var qe=we.default=void 0,Qt=Vt(je()),Xt=e;qe=we.default=(0,Qt.default)((0,Xt.jsx)("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"}),"ArrowOutward");var Ee={},Jt=ye;Object.defineProperty(Ee,"__esModule",{value:!0});var Ye=Ee.default=void 0,Zt=Jt(je()),Gt=e;Ye=Ee.default=(0,Zt.default)((0,Gt.jsx)("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"}),"ElectricBoltOutlined");var Te={},es=ye;Object.defineProperty(Te,"__esModule",{value:!0});var He=Te.default=void 0,ts=es(je()),ss=e;He=Te.default=(0,ts.default)((0,ss.jsx)("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}),"FolderOutlined");function Ie({spaceGateway:t,onConfirm:r,onCancel:o}){const{t:s}=T(),[i,n]=y.useState(!1),[a,d]=y.useState(!1),u=(p,g)=>{p==null||p.preventDefault(),p==null||p.stopPropagation(),n(g)},c=async p=>{try{p==null||p.stopPropagation(),d(!0),await(r==null?void 0:r(t)),n(!1)}catch(g){console.error(g),B.error(`${s("storage.space.gateway.delete.failed")}: ${X(g)}`)}finally{n(!1),d(!1)}},x=p=>{u(p,!1),o==null||o(p)};return e.jsxs(e.Fragment,{children:[e.jsxs(q,{color:"red",onClick:p=>u(p,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx(_t,{fontSize:"small"})}),e.jsx(H,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(ft,{title:s("storage.spaces.gateway.delete.title"),open:i,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:a}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:a}},onConfirm:c,onCancel:x,children:e.jsx(C,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t==null?void 0:t.name}`})})})]})}Ie.propTypes={spaceGateway:h.shape({name:h.string.isRequired,url:h.string.isRequired,protected:h.bool}).isRequired,onConfirm:h.func,onCancel:h.func};Ie.defaultProps={onConfirm:()=>{},onCancel:()=>{}};function Re({spaceGateway:t,selected:r,onDelete:o,onConnect:s,enableSwitchToSpace:i,backupInProgress:n,...a}){const{abortBlockletBackup:d}=L(),[u,c]=y.useState(null),{t:x}=T(),[p,g]=y.useState(!1),f=(S,l)=>{S.stopPropagation(),S.preventDefault(),c(l&&S.currentTarget)},b=async S=>{try{g(!0),f(S,!1),await s(t)}catch(l){console.error(l),B.error(l.message)}finally{g(!1)}},D=async S=>{try{g(!0),f(S,!1),await d()}catch(l){console.error(l),B.error(l.message)}finally{g(!1)}};return e.jsxs(e.Fragment,{children:[p||t!=null&&t.loading?e.jsx(A,{sx:{ml:1},size:"24px"}):e.jsx(tt,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:S=>f(S,!0),...a,children:e.jsx(zt,{})}),e.jsxs(st,{id:"simple-menu",anchorEl:u,keepMounted:!0,open:!!u,onClose:S=>f(S,!1),children:[e.jsxs(q,{onClick:S=>{f(S,!1),window.open(Oe(t.endpoint?Rt(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(qe,{fontSize:"small"})}),e.jsx(H,{children:x("common.open")})]}),e.jsxs(q,{onClick:S=>{f(S,!1),window.open(Oe(vt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(He,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.strategy.viewBackupFiles")})]}),!r&&i&&e.jsxs(q,{onClick:b,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ye,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.connect.switchToSpace")})]}),n&&e.jsxs(q,{onClick:D,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Pt,{fontSize:"small"})}),e.jsx(H,{children:x("storage.spaces.connect.abortBlockletBackup")})]}),!n&&e.jsx(Ie,{spaceGateway:t,onConfirm:async()=>{c(null),await(o==null?void 0:o(t))},onCancel:()=>c(null)})]})]})}Re.propTypes={spaceGateway:h.shape({name:h.string.isRequired,url:h.string.isRequired,protected:h.bool,endpoint:h.string.isRequired,loading:h.bool}).isRequired,selected:h.bool.isRequired,enableSwitchToSpace:h.bool,onDelete:h.func,onConnect:h.func,backupInProgress:h.bool};Re.defaultProps={onDelete:()=>{},onConnect:()=>{},enableSwitchToSpace:!0,backupInProgress:!1};const ns=ge(({className:t,...r})=>e.jsx(Se,{...r,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function ve({spaceGateway:t,spaceStatus:r,selected:o,onConnected:s,onDeleted:i,onBackedUp:n}){const{t:a,locale:d}=T(),{blocklet:u}=O(),{api:c,info:{did:x}}=M(),{appDid:p,appName:g,appDescription:f,scopes:b,appUrl:D,referrer:S}=Ne({blocklet:u}),{backupProgress:l,updateSpaceGateway:te,deleteSpaceGateway:se,refreshBackupSummary:ne,refreshBackups:oe}=L(),[U,z]=y.useState(!1),[I,v]=y.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:a("storage.spaces.authorize.title",{appName:g},d),scan:a("storage.spaces.authorize.scan",{appName:g},d),confirm:"",success:e.jsx(C,{gutterBottom:!0,children:a("storage.spaces.authorize.success")})},onClose:()=>{v(k=>({...k,open:!1}))}}),re=o&&!U&&r===ue.DISCONNECTED,ae=o&&!U&&!t.loading&&r===ue.CONNECTED,F=o&&U&&r===ue.CONNECTED&&(l==null?void 0:l.progress)>=0,J=async()=>{try{if(await At(t==null?void 0:t.endpoint)){await c.configBlocklet({input:{did:[u.meta.did],configs:[{key:_.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(a("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s==null||s(null,t);return}}catch(k){console.error(k),s==null||s(k,t);return}v(k=>({...k,open:!0,prefix:he(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:Ue.create({baseURL:he(t.url,"space")}).get,extraParams:{appDid:p,appName:g,appDescription:f,scopes:b,appUrl:D,referrer:S,nodeDid:x,spaceDid:t.did}}))},ie=async(k,K)=>{const m=K(k.endpoint),N=xe(m),w=k.space?K(k.space):{};if(t.did&&N!==t.did){v(de=>({...de,open:!1}));const $=a("storage.spaces.gateway.switch.failedForMismatchSpace",{name:w!=null&&w.name?w.name:""});B.error($),s==null||s(new Error($),t);return}const P={...t,name:w.name??"DID Space",did:w.did??xe(m),endpoint:m};await te(P),v($=>({...$,open:!1})),s==null||s(null,P)},ce=async()=>{try{if(U)return;z(!0),await c.backupBlocklet({input:{appDid:u.appDid,to:"spaces"}})}catch(k){console.error(k),B.error(k.message),n==null||n(k,t)}finally{z(!0)}},le=async()=>{try{await se(t),B.success(a("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),i==null||i(null,t)}catch(k){console.error(k),i==null||i(k,t)}};return y.useEffect(()=>{l!=null&&l.completed?(o&&((l==null?void 0:l.progress)===100?(B.success(a("storage.spaces.backupSuccessfully")),n==null||n(null,t)):l.message&&(n==null||n(new Error(l==null?void 0:l.message),t)),l.progress=0,l.message=""),z(!1),setTimeout(()=>{ne(),oe()},1e3)):l.progress&&z(!0)},[l]),e.jsxs(e.Fragment,{children:[e.jsxs(j,{sx:{".action-btn":{borderRadius:1,marginLeft:1}},display:"flex",alignItems:"center",children:[ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:a("storage.spaces.strategy.backupNow")}),re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:J,children:a("storage.spaces.disconnected.reconnectNow")}),F&&e.jsx(ns,{title:(l==null?void 0:l.message)&&e.jsx(j,{p:1,sx:{color:"black",backgroundColor:"white"},borderRadius:1,boxShadow:2,children:e.jsx(C,{variant:"body2",children:l.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(A,{variant:"determinate",value:l==null?void 0:l.progress,size:14,sx:{mr:1}}),l==null?void 0:l.progress,"%"]})}),e.jsx(ht,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ie,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:d},"get-endpoint")]}),e.jsx(Re,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:o,onDelete:le,onConnect:J,enableSwitchToSpace:(l==null?void 0:l.completed)||Q(l==null?void 0:l.message),backupInProgress:F})]})}ve.propTypes={spaceGateway:h.shape({did:h.string.isRequired,name:h.string.isRequired,url:h.string.isRequired,endpoint:h.string.isRequired,protected:h.bool,loading:h.bool}).isRequired,spaceStatus:h.string.isRequired,selected:h.bool.isRequired,onConnected:h.func,onDeleted:h.func,onBackedUp:h.func};ve.defaultProps={onConnected:()=>{},onDeleted:()=>{},onBackedUp:()=>{}};function Ve({...t}){const{t:r}=T();return e.jsxs(j,{...t,children:[e.jsx(j,{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3,children:e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:r("storage.spaces.backup.records")})}),e.jsx(Ce,{}),e.jsx(Be,{})]})}Ve.propTypes={};function Qe({...t}){const{t:r}=T(),{autoBackup:o,updateAutoBackup:s}=L(),i=async()=>{try{const n=!(o!=null&&o.enabled);await s({enabled:n}),B.success(r(n?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(n){B.error(n.message)}};return e.jsx(Mt,{checked:!!(o!=null&&o.enabled),onChange:i,name:"enableWelcomePage",labelProps:{label:e.jsx(C,{marginRight:"8px",children:e.jsx("span",{children:r("storage.spaces.autoBackup.title")})})},style:{...t.style}})}Qe.propTypes={};function os(){const{t}=T(),{spaceGateways:r,spaceGatewaysLoading:o,spaceGatewayIsSelected:s}=L(),i=o&&!(r!=null&&r.length),n=({spaceGateway:a,spaceStatus:d,selected:u,refresh:c})=>e.jsx(ve,{spaceGateway:a,spaceStatus:d,selected:u,onConnected:()=>c(),onBackedUp:x=>x&&c()});return e.jsxs(j,{display:"flex",flexDirection:"column",children:[e.jsxs(j,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1,children:t("storage.spaces.connected.title")}),e.jsx(Qe,{}),e.jsx(ee,{})]}),e.jsx(j,{mt:2,children:i?e.jsx(j,{display:"flex",justifyContent:"center",children:e.jsx(A,{})}):e.jsx(Ae,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:r.map(a=>e.jsx(Ae,{item:!0,xs:12,md:6,children:e.jsx(ut,{endpoint:a.endpoint,selected:s(a),action:n},a.endpoint)},a.endpoint))})})}),e.jsx(Ve,{sx:{marginTop:"24px"}}),e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",mb:2,children:t("common.dataStorage")}),e.jsx(Ke,{})]})}function rs(){const{spaceGatewaysFirstLoading:t,spaceGateways:r}=L();return t?e.jsx(_e,{relative:"parent",children:e.jsx(A,{})}):Q(r)?e.jsx($e,{}):e.jsx(os,{})}function as(){return e.jsx(be,{children:e.jsx(rs,{})})}function is(){const{spaceGateway:t,settingStorageEndpoint:r,updateSpaceGateway:o,hasStorageEndpoint:s,loading:i,storageEndpoint:n}=Nt(),a=fe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return i?e.jsx(_e,{relative:"parent",children:e.jsx(A,{})}):e.jsxs(j,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(kt,{spaceGateway:t,settingStorageEndpoint:r}):e.jsx(Dt,{}),e.jsx(j,{sx:a,children:e.jsx(Bt,{onConnect:o,storageEndpoint:n})})]})}function cs(){const{t}=T();return e.jsxs(Ut,{children:[e.jsxs(W,{spacing:1,marginBottom:2,children:[e.jsx(C,{fontSize:"1.2rem",fontWeight:"bold",children:t("storage.appLevel.title")}),e.jsx(C,{color:"text.secondary",children:t("storage.appLevel.description")})]}),e.jsx(is,{})]})}function Xe({navOrientation:t,...r}){const{t:o,locale:s}=T(),{blocklet:i}=O(),n=jt({key:"md"}),[a,d]=ot(),u=a.get("tab")||"backup",c=n?"horizontal":t,x=fe(()=>{var l;const D=[{label:o("common.backup"),value:"backup"}],S=(l=i==null?void 0:i.capabilities)==null?void 0:l.didSpace;return(S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||S===_.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&D.push({label:o("common.storage"),value:"storage"}),D},[s,c]),g=fe(()=>({backup:e.jsx(as,{}),storage:e.jsx(cs,{})}))[u],f=D=>{d(S=>(D==="backup"?S.delete("tab"):S.set("tab",D),S))};if(x.length<=1)return e.jsx(me,{children:g});const b=e.jsx(xt,{tabs:x,current:u,orientation:c,onChange:f,sx:[{borderRight:1,height:"100%",borderColor:"divider"},c==="horizontal"&&{borderRight:0}]});if(c==="vertical")return e.jsx(j,{...r,children:e.jsxs(W,{direction:{md:"column",lg:"row"},gap:2,children:[e.jsx(j,{sx:{flexShrink:0},children:e.jsx(Le,{left:b})}),e.jsx(j,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:g})})]})});if(c==="horizontal")return e.jsxs(j,{...r,children:[e.jsx(Le,{left:b}),e.jsx(me,{sx:{mt:2},children:g})]})}Xe.propTypes={navOrientation:h.oneOf(["vertical","horizontal"])};Xe.defaultProps={navOrientation:"vertical"};const me=ge(j)`
3
3
  position: relative;
4
4
  min-height: 66vh;
@@ -1,4 +1,4 @@
1
- import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,j as e,aa as T,O as te,bs as ge,bt as We,bo as G,ad as xt,H as x,a9 as Je,T as ae,E as Xe,bz as gt,bQ as Ke,bR as qe,y as Le,b6 as Me,ab as bt,bI as jt,Y as vt,cn as yt,m as Ht,as as dt,br as Vt,bn as Gt,q as ut,bX as Yt,I as Jt}from"./vendor-mui-core-Bq8gXTan.js";import{J as St,z as Xt,A as Qt,e as fe,aB as ye,C as Zt}from"./vendor-utils-BfZ4tlod.js";import{y as es,a as re,ab as Ct,a3 as q,X as ke,c1 as ts,B as me,k as W,bb as ss,ax as wt,bg as ns,r as Qe,c2 as is,a2 as Tt,ac as Rt,bB as Oe,ar as Nt,$ as as,bI as rs}from"./vendor-ux-did-connect-pzpsrvqx.js";import{D as Ze,G as Et,aC as It,aD as Q,y as se,n as os,K as pt}from"./index-CwUT0vPy.js";import{a as Te,u as V,b as ce}from"./vendor-hooks-DqdmWCmo.js";import{a as et,b as ls}from"./dashboard-t9EszOna.js";import{f as $e,i as cs,d as ds}from"./use-blocklet-logo-4UB-MFD3.js";import{A as us,a as ps,d as fs,b as ms}from"./collapse-DAaiuAEY.js";import{S as ee}from"./section-BDMQAX_r.js";import{S as Re}from"./shorten-label-BQvbtscf.js";import{I as Ot}from"./index-DPIWnhb5.js";import{R as At,A as hs,S as xs,a as gs,b as bs,B as js}from"./list-DDNORnll.js";import{W as vs}from"./did-address-NnOD1W_A.js";import{p as Dt}from"./util-BQAJqeb4.js";import{D as ys,g as Ss}from"./traffic-FNLLya21.js";import{B as Lt}from"./bundle-avatar-UIbxwQif.js";import{u as Cs}from"./use-mobile-DwzRjjku.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CwufDgLV.js";import"./useLocalStorage-CaPDqrQ7.js";import"./index-8eXqqyHQ.js";import"./confirm-RvA9mFot.js";import"./PlayArrow-BqVYRyLK.js";import"./get-safe-url-B0-S5PGZ.js";import"./session-BGdAM8zS.js";import"./InfoOutlined-BVWbftGI.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CtTQsfXN.js";import"./index-DEZojGsm.js";import"./CheckCircle-DUJmWceY.js";import"./base32-DUSifB4M.js";import"./iframe-DFg8oeD0.js";import"./LaunchOutlined-C1x4Og4u.js";import"./ChevronLeft-BBJJJhVi.js";import"./ChevronRight-BU9I7WD4.js";import"./index-B2NkqENf.js";import"./base-chart-CoApVzod.js";import"./index-w4f-mlFt.js";import"./vendor-mui-x-1nqAyytV.js";import"./AdapterDayjs-BRnJ9bMs.js";var Ue={exports:{}},He={exports:{}},Ve={exports:{}};(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;function s(r){return r==null}n.exports=t.default,n.exports.default=t.default})(Ve,Ve.exports);var ws=Ve.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var s=o(es),r=o(ws);function o(h){return h&&h.__esModule?h:{default:h}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,y=/^[-+]?[0-9]+$/;function p(h,i){(0,s.default)(h),i=i||{};var O=i.allow_leading_zeroes===!1?l:y,A=!i.hasOwnProperty("min")||(0,r.default)(i.min)||h>=i.min,R=!i.hasOwnProperty("max")||(0,r.default)(i.max)||h<=i.max,S=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||h<i.lt,D=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||h>i.gt;return O.test(h)&&A&&R&&S&&D}n.exports=t.default,n.exports.default=t.default})(He,He.exports);var Ts=He.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var s=r(Ts);function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,s.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=t.default,n.exports.default=t.default})(Ue,Ue.exports);var Rs=Ue.exports;const Ns=Ut(Rs),Fe={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Es(){var N,E,P;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(N=t==null?void 0:t.meta)==null?void 0:N.did,y=Object.assign({...Fe},((P=(E=t==null?void 0:t.settings)==null?void 0:E.notification)==null?void 0:P.email)||{}),{handleSubmit:p,control:h,formState:i,watch:O,reset:A}=It({defaultValues:St(y,Object.keys(Fe))}),R=Te({testReceiver:"",testReceiverError:""}),S=O("enabled"),D=V(async(a,m,$=!0)=>{var U,oe;try{const{blocklet:le}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),pe=Object.assign({...Fe},((oe=(U=le==null?void 0:le.settings)==null?void 0:U.notification)==null?void 0:oe.email)||{});A(pe),$&&q.success(s("oauth.saveSuccess"))}catch(le){if($)q.error(le.message||s("oauth.saveFailed"));else throw le}}),Y=V(async(a,m,$)=>{try{i.isDirty&&await D(a,m,!1),await n.sendEmail({input:{did:l,receiver:$,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),q.success(s("notification.email.testSuccess"))}catch(U){q.error(U.message||s("notification.email.testfailed"))}}),z=V((a,m)=>{R.testReceiver="",R.testReceiverError="",r.open({title:s("notification.email.testSendEmail"),content:()=>e.jsx(T,{sx:{width:"300px"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.email.inputTestReceiver"),value:R.testReceiver,onChange:$=>{R.testReceiver=$.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm($){var oe;const U=(oe=R.testReceiver)==null?void 0:oe.trim();if(!U){R.testReceiverError=s("notification.email.receiverRequired");return}if(!ke(U)){R.testReceiverError=s("notification.email.receiverInvalid");return}R.testReceiverError="",await Y(a,m,U),$()}})}),B=V(a=>{const m=a==null?void 0:a.trim();return m?ke(m)?!0:s("notification.email.fromInvalid"):s("notification.email.fromRequired")}),_=V(a=>{const m=a==null?void 0:a.trim();return m?$e(m,{require_host:!1,protocols:[]})?!0:s("notification.email.hostInvalid"):s("notification.email.hostRequired")}),M=V(a=>a?Ns(a)?!0:s("notification.email.portInvalid"):s("notification.email.portRequired")),J=V(a=>a!=null&&a.trim()?!0:s("notification.email.userRequired")),ie=V(a=>a!=null&&a.trim()?!0:s("notification.email.passwordRequired")),c=V(a=>a!=null&&a.trim()&&!$e(a,{protocols:["http","https"],require_protocol:!0})?s("notification.email.linkInvalid"):!0),g=V(a=>a!=null&&a.trim()&&!ke(a)?s("notification.email.emailInvalid"):!0),j=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Is,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.email.enable"),my:2.5,children:e.jsx(Q,{name:"enabled",control:h,render:({field:a})=>e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a})})})}),e.jsx(ee,{title:s("notification.email.from"),children:e.jsx(Q,{name:"from",control:h,rules:{validate:S?B:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,label:s("notification.email.from"),error:!!i.errors[a.name],helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.host"),children:e.jsx(Q,{name:"host",control:h,rules:{validate:S?_:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.host"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.port"),children:e.jsx(Q,{name:"port",control:h,rules:{validate:S?M:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:s("notification.email.port"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.user"),children:e.jsx(Q,{name:"user",control:h,rules:{validate:S?J:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.user"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.password"),children:e.jsx(Q,{name:"password",control:h,rules:{validate:S?ie:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:s("notification.email.password"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.secure"),children:e.jsx(Q,{name:"secure",control:h,rules:{validate:j},render:({field:a})=>e.jsx(G,{fullWidth:!0,children:e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a,disabled:!S})})})})}),e.jsxs(us,{children:[e.jsxs(ps,{expandIcon:e.jsx(fs,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[s("notification.email.signature"),e.jsx(xt,{title:s("notification.email.signatureTooltip"),children:e.jsx(ts,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(ms,{children:[e.jsx(ee,{title:s("notification.email.companyName"),children:e.jsx(Q,{name:"companyName",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyName"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyLink"),children:e.jsx(Q,{name:"companyLink",control:h,rules:{validate:S?c:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyLink"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyAddress"),children:e.jsx(Q,{name:"companyAddress",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyAddress"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.supportEmail"),children:e.jsx(Q,{name:"supportEmail",control:h,rules:{validate:S?g:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:s("notification.email.supportEmail"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})})]})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(z),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Is=ue(ht)``,Be={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function Os(){var M,J,ie;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(M=t==null?void 0:t.meta)==null?void 0:M.did,y=Object.assign({...Be},((ie=(J=t==null?void 0:t.settings)==null?void 0:J.notification)==null?void 0:ie.pushKit)||{}),{handleSubmit:p,control:h,formState:i,watch:O,reset:A}=It({defaultValues:St(y,Object.keys(Be))}),R=Te({testReceiver:"",testReceiverError:""}),S=O("enabled"),D=V(async(c,g,j=!0)=>{var N,E;try{const{blocklet:P}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:c})}}),a=Object.assign({...Be},((E=(N=P==null?void 0:P.settings)==null?void 0:N.notification)==null?void 0:E.pushKit)||{});A(a),j&&q.success(s("oauth.saveSuccess"))}catch(P){if(j)q.error(P.message||s("oauth.saveFailed"));else throw P}}),Y=V(async(c,g)=>{var j,N,E;try{i.isDirty&&await D(c,g,!1);const P=(j=((t==null?void 0:t.configs)||[]).find($=>$.key==="BLOCKLET_APP_URL"))==null?void 0:j.value,a=Xt(Qt(P,W.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:(N=t==null?void 0:t.meta)==null?void 0:N.version,t:new Date((t==null?void 0:t.updatedAt)||0).getTime()}),m={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:t==null?void 0:t.appDid,fullName:(E=t==null?void 0:t.meta)==null?void 0:E.title,avatar:a}}}};await n.sendPush({input:{did:l,receiver:R.testReceiver,notification:JSON.stringify(m)}}),q.success(s("notification.pushKit.testSuccess"))}catch(P){q.error(P.message||s("notification.pushKit.testfailed"))}}),z=V((c,g)=>{R.testReceiverError="",r.open({title:s("notification.pushKit.testSend"),content:()=>e.jsx(T,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.pushKit.inputTestReceiver"),value:R.testReceiver,onChange:j=>{R.testReceiver=j.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(j){var E;if(!((E=R.testReceiver)==null?void 0:E.trim())){R.testReceiverError=s("notification.pushKit.receiverRequired");return}R.testReceiverError="",await Y(c,g),j()}})}),B=V(c=>{const g=c==null?void 0:c.trim();return g?$e(g)?!0:s("notification.pushKit.endpointInvalid"):s("notification.pushKit.endpointRequired")}),_=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(As,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.pushKit.enable"),my:2.5,children:e.jsx(Q,{name:"enabled",control:h,render:({field:c})=>e.jsx(ge,{control:e.jsx(We,{checked:c.value,...c})})})}),e.jsx(ee,{title:s("notification.pushKit.endpoint"),children:e.jsx(Q,{name:"endpoint",control:h,rules:{validate:S?B:_},render:({field:c})=>{var g;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",required:!0,label:s("notification.pushKit.endpoint"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})}),e.jsxs(ee,{title:s("notification.pushKit.customOptions"),children:[e.jsx(Q,{name:"did",control:h,render:({field:c})=>{var g;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.did"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}}),e.jsx(Q,{name:"pushPath",control:h,render:({field:c})=>{var g;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.pushPath"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(z),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const As=ue(ht)``,ft=[{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Push Kit"}),value:"pushKit"}];function Ds(){const[n,t]=C.useState(ft[0].value),{locale:s}=C.useContext(ss),r=ce(()=>({email:e.jsx(Es,{}),pushKit:e.jsx(Os,{})}),[s]),o=C.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(T,{children:[e.jsx(wt,{tabs:ft,current:n,onChange:t}),e.jsx(T,{style:o,children:r[n]})]})}const Pt=C.createContext({}),{Provider:Ls,Consumer:si}=Pt;function Ps({children:n,blocklet:t=""}){const{api:s,inService:r,ws:{useSubscription:o}}=Ze(),[l,y]=C.useState([]),[p,h]=C.useState({total:0,pageSize:20,pageCount:0,page:1}),i=ce(()=>{var c;return(c=t.meta)==null?void 0:c.did},[t]),[O,A]=C.useState([]),[R,S]=C.useState({}),D=ce(()=>l.length?new Set(l.map(c=>c.id)):new Set,[l]),Y=async({page:c=1,pageSize:g=20,...j}={})=>{if(!i)return[];try{const N={paging:{page:c,pageSize:g},...j,teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0},{dids:E,...P}=N;let a="";E&&E.includes("system")&&(a="system");const m=E?E.filter(oe=>oe!=="system"):[],$={...P,source:a,componentDids:m},U=await s.getNotificationSendLog({input:$});return S($),y(U.list),h(U.paging),U.list}catch(N){return q.error(N.message),[]}},z=async()=>{const c=await s.getNotificationComponents({input:{teamDid:i}});A(c.componentDids)},B=C.useCallback(c=>{const g=t.children.find(j=>{var N;return((N=j.meta)==null?void 0:N.did)===c});if(g)return g.ancestors=[t],g},[t]),_=async({notificationId:c,receivers:g,channels:j,...N})=>{await s.resendNotification({input:{teamDid:i,notificationId:c,receivers:g,channels:j.map(E=>E==="wallet"?W.NOTIFICATION_SEND_CHANNEL.WALLET:E==="pushKit"?W.NOTIFICATION_SEND_CHANNEL.PUSH:E),...N}})},M=C.useCallback(async c=>(await s.getUser({input:{teamDid:i,user:{did:c}}})).user,[s,i]),J=C.useCallback(async({page:c=1,pageSize:g=20,...j}={})=>{try{const N={paging:{page:c,pageSize:g},...j,userName:j.searchText||"",teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:N})}catch(N){throw q.error(N.message),N}},[s,i]);C.useEffect(()=>{i&&z()},[i]),o(W.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,c=>{D.has(c.notificationId)&&Y(R)},[D,R]),o(W.EVENTS.NOTIFICATION_BLOCKLET_CREATE,c=>{D.has(c.id)||Y(R)},[D,R]);const ie={fetch:Y,data:l,paging:p,blocklet:t,getComponent:B,resendNotification:_,getUser:M,componentDids:O,getReceivers:J,inService:r,teamDid:i};return e.jsx(Ls,{value:{notificationRecords:ie},children:n})}function tt(){const{notificationRecords:n}=C.useContext(Pt);return n}Ne.propTypes={severity:x.oneOf(Object.values(["info","success","error","warning"])).isRequired};const _s={info:"primary",success:"success",error:"error",warning:"warning"};function Ne({severity:n="info"}){return e.jsx(ns,{type:_s[n],children:n})}var st={},ks=Je;Object.defineProperty(st,"__esModule",{value:!0});var _t=st.default=void 0,Fs=ks(Qe()),Bs=e;_t=st.default=(0,Fs.default)((0,Bs.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var nt={},zs=Je;Object.defineProperty(nt,"__esModule",{value:!0});var kt=nt.default=void 0,Ws=zs(Qe()),Ks=e;kt=nt.default=(0,Ws.default)((0,Ks.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var it={},qs=Je;Object.defineProperty(it,"__esModule",{value:!0});var Ft=it.default=void 0,Ms=qs(Qe()),$s=e;Ft=it.default=(0,Ms.default)((0,$s.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Us=(n,t,s="")=>{if(!s||!t)return"";switch(s){case W.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return s}};function Bt(n,t,s={}){const{status:r,updatedAt:o,reason:l="",channel:y="wallet"}=s,p=o?n("notification.sendStatus.sentTime",{date:os(o,t)}):"",h=Us(n,y,l);return r===W.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:p,reason:h}:r===W.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:p}:{status:"pending",title:n("notification.sendStatus.pending"),reason:h,sentTime:p}}const Ge={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ye=["wallet","pushKit","email"],mt=["info","success","error","warning"],zt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.email)==null?void 0:r.enabled},Wt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.pushKit)==null?void 0:r.enabled},Hs=(n,t)=>{const s=fe(t,"extra.notifications.email",!0);return{available:zt(n),enabled:s}},Vs=(n,t)=>{const s=fe(t,"extra.notifications.push",!0);return{available:Wt(n),enabled:s}},Gs=n=>({enabled:fe(n,"extra.notifications.wallet",!0)}),Ys=n=>({enabled:fe(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(t=>{setTimeout(()=>{t()},n*1e3)}),Js=(n,t)=>t==="wallet"||t==="webhook"?[{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:t==="pushKit"||t==="email"?[{channel:t,type:"available",pass:n("notification.sendStatus.reason.available",{channel:t}),fail:n("notification.sendStatus.reason.unavailable",{channel:t})},{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:[],Ie=(n=[])=>{const t=se().startOf("day");return n.filter(s=>se(s.sendAt).isSame(t,"day")).length},Xs=(n,t="")=>{if(t&&Ye.includes(t)){const l=`${t}SendRecord`,y=fe(n,l,[]);return Ie(y)}const s=fe(n,"webhook",{}),r=Object.keys(s??{})??[];if(t&&r.includes(t)){const l=s[t]??[];return Ie(l)}const o={};return Ye.forEach(l=>{const y=`${l}SendRecord`,p=fe(n,y,[]),h=Ie(p);o[l]=h}),r.length>0&&r.forEach(l=>{const y=s[l]??[],p=Ie(y);o[l]=p}),o},Ae=(n,t,s)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[s].splice(t,1),n},De=(n,t)=>{if(!Array.isArray(t))throw new Error("filters must be an array");return t.length?!t.includes(n):!1},Qs=n=>{switch(n){case W.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case W.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case W.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case W.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Kt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function de({config:n,enableTooltip:t=!0,showTitle:s=!1,children:r}){const{status:o,title:l="",sentTime:y="",reason:p=""}=n,h=[l,p].filter(Boolean).join(", ");return e.jsx(xt,{title:t?e.jsxs(e.Fragment,{children:[e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:h}),e.jsx("span",{children:y})]}):null,arrow:!0,placement:"top",children:e.jsxs(T,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(T,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(T,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Ge[o],style:{opacity:.15}}),e.jsx(T,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Ge[o]})]}),e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:s?l:r})]})})}de.propTypes={config:x.object.isRequired,enableTooltip:x.bool,showTitle:x.bool,children:x.node};de.defaultProps={enableTooltip:!0,showTitle:!1,children:null};Se.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};Se.defaultProps={onDelete:()=>{}};function Se({list:n,label:t,onDelete:s}){const{t:r,locale:o}=re();return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(l=>{const y=Bt(r,o,{status:l});return e.jsx(Xe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(de,{config:y,enableTooltip:!1,children:y.title})}),onDelete:p=>s(p,l)},l)})]})}at.propTypes={filterList:x.array.isRequired,onChange:x.func.isRequired,index:x.number.isRequired,column:x.object.isRequired,filterValues:x.array.isRequired,label:x.string.isRequired,renderLabel:x.func.isRequired};function at({filterList:n,onChange:t,index:s,column:r,filterValues:o,label:l,renderLabel:y}){return e.jsxs(G,{className:"filter-container",children:[e.jsx(gt,{component:"legend",children:l}),e.jsx(Ke,{row:!0,children:o.map(p=>e.jsx(ge,{control:e.jsx(qe,{checked:n[s].indexOf(p.value??p)>-1,onChange:h=>{const i=[...n];h.target.checked?i[s]=[...i[s],p.value??p]:i[s]=i[s].filter(O=>O!==(p.value??p)),t(i[s],s,r)},name:p.value??p}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:y(p)})},p.value??p))})]})}function ze(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(de,{enableTooltip:!1,config:{status:t.status},children:t.label})})}ve.propTypes={status:x.number.isRequired,updatedAt:x.string.isRequired,reason:x.string,channel:x.string,onResend:x.func};function ve({status:n,updatedAt:t,reason:s="",channel:r="wallet",onResend:o}){const{t:l,locale:y}=re(),p=Bt(l,y,{status:n,updatedAt:t,reason:s,channel:r});return e.jsxs(T,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(de,{config:p,showTitle:!0}),p.status!=="success"&&e.jsx(Le,{className:"resend-btn",size:"small",startIcon:e.jsx(et,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}rt.propTypes={value:x.array.isRequired,onChange:x.func};function rt({value:n,onChange:t}){const{locale:s}=re(),r=se().toDate(),[o,l]=C.useState(null),y=C.useCallback(i=>{l(o?null:i.currentTarget)},[o]),p=!!o,h=C.useCallback(i=>{if(!i.startDate||!i.endDate){q.error("Please select a date range");return}if(se(i.startDate).isAfter(i.endDate)||!se(i.startDate).isValid()||!se(i.endDate).isValid()){q.error("Invalid date range");return}t([i.startDate,i.endDate]),l(null)},[t]);return e.jsxs("div",{children:[e.jsx(ae,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Le,{onClick:y,variant:"outlined",size:"small",color:"inherit",children:[pt(n[0],s)," - ",pt(n[1],s)]})}),e.jsx(Me,{open:p,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(ys,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:y,definedRanges:Ss(r),onChange:h})})]})}ot.propTypes={itemComponent:x.elementType.isRequired};function ot({itemComponent:n,...t}){var o;const{t:s}=re();return!((o=t==null?void 0:t.filterList)!=null&&o.filter(l=>l.length).length)?null:e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(is.TableFilterList,{...t,ItemComponent:n})})]})}function Pe({label:n,onDelete:t,canDelete:s=()=>!0,...r}){const o=t&&typeof t=="function"?t:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:n,...r})),e.jsx(Xe,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}Pe.propTypes={label:x.string.isRequired,onDelete:x.func,canDelete:x.func};Pe.defaultProps={canDelete:()=>!0};const Zs=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];lt.propTypes={loading:x.bool,onCancel:x.func,onConfirm:x.func};lt.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function lt({loading:n=!1,onCancel:t,onConfirm:s}){const{t:r}=re(),[o,l]=C.useState(Zs),[y,p]=C.useState(!0),h=(O,A)=>{A.checked=O.target.checked;const R=o.map(S=>({...S,checked:S.value===A.value?A.checked:S.checked}));l(R)},i=O=>{O.stopPropagation(),s({channels:o.filter(A=>A.checked).map(A=>A.value),isResendFailedOnly:y})};return e.jsxs(T,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ae,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(T,{className:"choose-channel",children:e.jsxs(G,{component:"fieldset",variant:"standard",children:[e.jsx(gt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Ke,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(O=>e.jsx(ge,{control:e.jsx(qe,{checked:O.checked,onChange:A=>h(A,O),name:O.value}),label:O.label},O.value))})]})}),e.jsx(T,{className:"resend-config-footer",children:e.jsx(Ke,{children:e.jsx(ge,{control:e.jsx(qe,{checked:y,onChange:O=>p(O.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(T,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Le,{onClick:O=>{O.stopPropagation(),t()},color:"inherit",children:r("common.cancel")}),e.jsxs(Le,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(bt,{size:16}),r("common.confirm")]})]})]})}qt.propTypes={notificationId:x.string.isRequired,handleResend:x.func,resending:x.bool};function qt({notificationId:n,handleResend:t,resending:s=!1}){const{t:r,locale:o}=re(),l=jt(),y=C.useMemo(()=>vt(l,Kt()),[l]),{getReceivers:p,inService:h,teamDid:i,getUser:O,blocklet:A}=tt(),[R,S]=C.useState(!1),[D,Y]=C.useState([]),z=Te({anchorEl:null,position:null}),B=Te({anchorEl:null,position:null}),[_,M]=C.useState(null),[J,ie]=C.useState({total:0,pageSize:10,pageCount:0,page:1}),[c,g]=C.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[se().subtract(1,"month").startOf("day").toDate(),se().endOf("day").toDate()]}),[j,N]=C.useState([]),E=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],P=async()=>{if(!R&&n)try{S(!0);const d=await p({notificationId:n,...c}),u=d.list.map(f=>({...f,receiverUser:{...f.receiverUser,avatar:Dt(f.receiverUser.avatar,i,h)}}));Y(u),ie(d.paging),S(!1)}catch(d){q.error(d.message),S(!1)}};C.useEffect(()=>{P()},[c]);const a=d=>{d.stopPropagation();const u=d.currentTarget;B.anchorEl=u;const f=u.getBoundingClientRect();B.position={top:f.top+window.scrollY,left:f.left+window.scrollX}},m=d=>d.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(me,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(et,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:r("notification.resend")})}):null,$={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:J.page-1,rowsPerPage:J.pageSize,count:J.total,searchText:c.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:j,onRowSelectionChange:(d,u)=>{N(u.map(f=>f.dataIndex))},customToolbarSelect:m},U=({page:d,rowsPerPage:u,searchText:f,filterList:L})=>{const[,K=[],Z=[],X=[]]=L;c.pageSize!==u?g(H=>({...H,pageSize:u,page:1})):c.page!==d+1?g(H=>({...H,page:d+1})):c.searchText!==f?g(H=>({...H,searchText:f,page:1})):ye(K,c.walletSendStatus)?ye(Z,c.pushKitSendStatus)?ye(X,c.emailSendStatus)||g(H=>({...H,emailSendStatus:X,page:1})):g(H=>({...H,pushKitSendStatus:Z,page:1})):g(H=>({...H,walletSendStatus:K,page:1}))},oe=C.useCallback(async(d,u)=>{if(!u)return!1;const f=await O(u);return f?d==="wallet"?Gs(f):d==="email"?Hs(A,f):d==="pushKit"?Vs(A,f):d==="webhook"?Ys(f):!0:!1},[O,A]),le=C.useCallback(d=>Js(r,d),[r]),pe=()=>{z.anchorEl=null,z.position=null,M(null)},be=()=>{B.anchorEl=null,B.position=null},je=async(d,u,f=!0,L="")=>{if(!(!u.length||!d.length))try{t(d,u,f,L),B.anchorEl||(await Ee(.5),pe())}catch(K){console.error("handleResend error",{error:K})}},v=async({channels:d,isResendFailedOnly:u})=>{const f=j.map(L=>D[L].receiver);await je(d,f,u),await Ee(.5),be(),N([])},b=async(d,u=[],f=!0)=>{try{await je(["webhook"],[d.receiver],f,u)}catch(L){q.error(L.response?L.response.statusText:L.message)}},w=async(d,u,f,L=[],K=!0)=>{if(d.stopPropagation(),Xs(u,f)>=4){q.warning(r("notification.resendLimit"));return}if(!Ye.includes(f)){await b(u,L,K);return}if(d){const X=d.currentTarget,H=X.getBoundingClientRect();z.anchorEl=X,z.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}M({channel:f});try{const X=await oe(f,u.receiver);await Ee(1),M({channel:f,result:X}),(typeof X=="boolean"&&X||Zt(X)&&Object.values(X).every(H=>!!H))&&(await t([f],[u.receiver],K),B.anchorEl||(await Ee(.5),pe()))}catch(X){q.error(X.message)}},I=d=>{g(u=>({...u,dateRange:d,page:1}))},k=(d,u,f,L)=>{d.stopPropagation();const K=f.filter(Z=>Z!==u);g(Z=>({...Z,[L]:K,page:1}))},F=ce(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:d=>{const{receiverUser:u,receiver:f}=D[d];return u?e.jsxs(T,{"data-cy":`member-name-${u.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(Tt,{src:`${u.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:f,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Re,{children:u.fullName})]},f):e.jsx(vs,{size:14,responsive:!1,compact:!0,copyable:!1,did:f})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:c.walletSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Wallet",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[1].options.filterList,"walletSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Wallet",filterList:d,onChange:u,index:f,column:L,filterValues:E})},customBodyRenderLite:d=>{const{walletSendStatus:u,walletSendAt:f,walletSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"wallet",onResend:K=>w(K,D[d],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{pushKitSendStatus:u,pushKitSendAt:f,pushKitSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"pushkit",onResend:K=>w(K,D[d],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:c.pushKitSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Push Kit",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[2].options.filterList,"pushKitSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Push Kit",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{emailSendStatus:u,emailSendAt:f,emailSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"email",onResend:K=>w(K,D[d],"email",[],!1)})},filter:!0,filterType:"custom",filterList:c.emailSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Email",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[3].options.filterList,"emailSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Email",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{webhook:u}=D[d];if(!u)return null;const f=Object.entries(u)[0];if(!f)return null;const[L,K]=f,Z=K[0];return e.jsx(T,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(T,{className:"webhook-item",fontSize:12,children:[e.jsx(Re,{maxLength:30,children:L},L),e.jsx(ve,{status:Z.status,updatedAt:Z.sendAt,reason:Z.failedReason,channel:"webhook",onResend:X=>w(X,D[d],"webhook",[L],!1)})]},L)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:d=>{const{createdAt:u}=D[d];return e.jsx(At,{value:u,locale:o,shouldUpdate:!0})}}}],[D,o,c,r]),ne=[e.jsx(rt,{value:c.dateRange,onChange:I},"date-picker"),e.jsx(me,{variant:"contained",size:"small",color:"primary",loading:R,startIcon:e.jsx(Ft,{}),onClick:()=>P(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(T,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(tn,{children:e.jsxs(yt,{theme:y,children:[e.jsx(Rt,{className:"receivers-table",locale:o,loading:R,columns:F,data:D,onChange:U,options:$,customButtons:ne,components:{TableFilterList:d=>e.jsx(ot,{...d,itemComponent:u=>e.jsx(Pe,{...u,canDelete:()=>!1})})}}),z.anchorEl&&e.jsx(Me,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:pe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(sn,{children:[e.jsxs(ae,{variant:"body1",component:"div",className:"check-title",children:[_==null?void 0:_.channel," Checking"]}),e.jsx(T,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:le(_==null?void 0:_.channel).map(d=>{var K,Z;const{type:u,pass:f,fail:L}=d;return!(_!=null&&_.result)||(K=_==null?void 0:_.result)!=null&&K[u]?e.jsxs(ae,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(Z=_==null?void 0:_.result)!=null&&Z[u]?Oe.success.main:"inherit"},children:[_!=null&&_.result?e.jsx(_t,{}):e.jsx(bt,{size:12,sx:{color:Oe.primary.main}}),e.jsx("span",{children:f})]},u):e.jsxs(ae,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:Oe.error.main},children:[e.jsx(kt,{}),e.jsx("span",{children:L})]},u)})})]})}),B.anchorEl&&e.jsx(Me,{open:!!B.anchorEl,anchorReference:"anchorPosition",anchorPosition:B.position,onClose:be,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(lt,{loading:s,onCancel:be,onConfirm:v})})]})})})}const en=C.memo(qt),tn=ue.div`
1
+ import{g as Ut,r as C}from"./vendor-react-DEoibe3W.js";import{ah as ue,al as ht,j as e,aa as T,O as te,bs as ge,bt as We,bo as G,ad as xt,H as x,a9 as Je,T as ae,E as Xe,bz as gt,bQ as Ke,bR as qe,y as Le,b6 as Me,ab as bt,bI as jt,Y as vt,cn as yt,m as Ht,as as dt,br as Vt,bn as Gt,q as ut,bX as Yt,I as Jt}from"./vendor-mui-core-Bq8gXTan.js";import{J as St,z as Xt,A as Qt,e as fe,aB as ye,C as Zt}from"./vendor-utils-BfZ4tlod.js";import{y as es,a as re,ab as Ct,a3 as q,X as ke,c1 as ts,B as me,k as W,bb as ss,ax as wt,bg as ns,r as Qe,c2 as is,a2 as Tt,ac as Rt,bB as Oe,ar as Nt,$ as as,bI as rs}from"./vendor-ux-did-connect-pzpsrvqx.js";import{D as Ze,G as Et,aC as It,aD as Q,y as se,n as os,K as pt}from"./index-CwUT0vPy.js";import{a as Te,u as V,b as ce}from"./vendor-hooks-DqdmWCmo.js";import{a as et,b as ls}from"./dashboard-t9EszOna.js";import{f as $e,i as cs,d as ds}from"./use-blocklet-logo-4UB-MFD3.js";import{A as us,a as ps,d as fs,b as ms}from"./collapse-DAaiuAEY.js";import{S as ee}from"./section-BDMQAX_r.js";import{S as Re}from"./shorten-label-BQvbtscf.js";import{I as Ot}from"./index-DPIWnhb5.js";import{R as At,A as hs,S as xs,a as gs,b as bs,B as js}from"./list-DDNORnll.js";import{W as vs}from"./did-address-NnOD1W_A.js";import{p as Dt}from"./util-BQAJqeb4.js";import{D as ys,g as Ss}from"./traffic-FNLLya21.js";import{B as Lt}from"./bundle-avatar-UIbxwQif.js";import{u as Cs}from"./use-mobile-CtTQsfXN.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CwufDgLV.js";import"./useLocalStorage-CaPDqrQ7.js";import"./index-8eXqqyHQ.js";import"./confirm-RvA9mFot.js";import"./PlayArrow-BqVYRyLK.js";import"./get-safe-url-D5KSEAKZ.js";import"./session-BGdAM8zS.js";import"./InfoOutlined-BVWbftGI.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DwzRjjku.js";import"./index-DEZojGsm.js";import"./CheckCircle-DUJmWceY.js";import"./base32-DUSifB4M.js";import"./iframe-DFg8oeD0.js";import"./LaunchOutlined-C1x4Og4u.js";import"./ChevronLeft-BBJJJhVi.js";import"./ChevronRight-BU9I7WD4.js";import"./index-B2NkqENf.js";import"./base-chart-CoApVzod.js";import"./index-w4f-mlFt.js";import"./vendor-mui-x-1nqAyytV.js";import"./AdapterDayjs-BRnJ9bMs.js";var Ue={exports:{}},He={exports:{}},Ve={exports:{}};(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=s;function s(r){return r==null}n.exports=t.default,n.exports.default=t.default})(Ve,Ve.exports);var ws=Ve.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=p;var s=o(es),r=o(ws);function o(h){return h&&h.__esModule?h:{default:h}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,y=/^[-+]?[0-9]+$/;function p(h,i){(0,s.default)(h),i=i||{};var O=i.allow_leading_zeroes===!1?l:y,A=!i.hasOwnProperty("min")||(0,r.default)(i.min)||h>=i.min,R=!i.hasOwnProperty("max")||(0,r.default)(i.max)||h<=i.max,S=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||h<i.lt,D=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||h>i.gt;return O.test(h)&&A&&R&&S&&D}n.exports=t.default,n.exports.default=t.default})(He,He.exports);var Ts=He.exports;(function(n,t){Object.defineProperty(t,"__esModule",{value:!0}),t.default=o;var s=r(Ts);function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,s.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=t.default,n.exports.default=t.default})(Ue,Ue.exports);var Rs=Ue.exports;const Ns=Ut(Rs),Fe={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Es(){var N,E,P;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(N=t==null?void 0:t.meta)==null?void 0:N.did,y=Object.assign({...Fe},((P=(E=t==null?void 0:t.settings)==null?void 0:E.notification)==null?void 0:P.email)||{}),{handleSubmit:p,control:h,formState:i,watch:O,reset:A}=It({defaultValues:St(y,Object.keys(Fe))}),R=Te({testReceiver:"",testReceiverError:""}),S=O("enabled"),D=V(async(a,m,$=!0)=>{var U,oe;try{const{blocklet:le}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),pe=Object.assign({...Fe},((oe=(U=le==null?void 0:le.settings)==null?void 0:U.notification)==null?void 0:oe.email)||{});A(pe),$&&q.success(s("oauth.saveSuccess"))}catch(le){if($)q.error(le.message||s("oauth.saveFailed"));else throw le}}),Y=V(async(a,m,$)=>{try{i.isDirty&&await D(a,m,!1),await n.sendEmail({input:{did:l,receiver:$,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification"})}}),q.success(s("notification.email.testSuccess"))}catch(U){q.error(U.message||s("notification.email.testfailed"))}}),z=V((a,m)=>{R.testReceiver="",R.testReceiverError="",r.open({title:s("notification.email.testSendEmail"),content:()=>e.jsx(T,{sx:{width:"300px"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.email.inputTestReceiver"),value:R.testReceiver,onChange:$=>{R.testReceiver=$.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm($){var oe;const U=(oe=R.testReceiver)==null?void 0:oe.trim();if(!U){R.testReceiverError=s("notification.email.receiverRequired");return}if(!ke(U)){R.testReceiverError=s("notification.email.receiverInvalid");return}R.testReceiverError="",await Y(a,m,U),$()}})}),B=V(a=>{const m=a==null?void 0:a.trim();return m?ke(m)?!0:s("notification.email.fromInvalid"):s("notification.email.fromRequired")}),_=V(a=>{const m=a==null?void 0:a.trim();return m?$e(m,{require_host:!1,protocols:[]})?!0:s("notification.email.hostInvalid"):s("notification.email.hostRequired")}),M=V(a=>a?Ns(a)?!0:s("notification.email.portInvalid"):s("notification.email.portRequired")),J=V(a=>a!=null&&a.trim()?!0:s("notification.email.userRequired")),ie=V(a=>a!=null&&a.trim()?!0:s("notification.email.passwordRequired")),c=V(a=>a!=null&&a.trim()&&!$e(a,{protocols:["http","https"],require_protocol:!0})?s("notification.email.linkInvalid"):!0),g=V(a=>a!=null&&a.trim()&&!ke(a)?s("notification.email.emailInvalid"):!0),j=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(Is,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.email.enable"),my:2.5,children:e.jsx(Q,{name:"enabled",control:h,render:({field:a})=>e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a})})})}),e.jsx(ee,{title:s("notification.email.from"),children:e.jsx(Q,{name:"from",control:h,rules:{validate:S?B:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,label:s("notification.email.from"),error:!!i.errors[a.name],helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.host"),children:e.jsx(Q,{name:"host",control:h,rules:{validate:S?_:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.host"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.port"),children:e.jsx(Q,{name:"port",control:h,rules:{validate:S?M:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:s("notification.email.port"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.user"),children:e.jsx(Q,{name:"user",control:h,rules:{validate:S?J:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:s("notification.email.user"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.password"),children:e.jsx(Q,{name:"password",control:h,rules:{validate:S?ie:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:s("notification.email.password"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.secure"),children:e.jsx(Q,{name:"secure",control:h,rules:{validate:j},render:({field:a})=>e.jsx(G,{fullWidth:!0,children:e.jsx(ge,{control:e.jsx(We,{checked:a.value,...a,disabled:!S})})})})}),e.jsxs(us,{children:[e.jsxs(ps,{expandIcon:e.jsx(fs,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[s("notification.email.signature"),e.jsx(xt,{title:s("notification.email.signatureTooltip"),children:e.jsx(ts,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(ms,{children:[e.jsx(ee,{title:s("notification.email.companyName"),children:e.jsx(Q,{name:"companyName",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyName"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyLink"),children:e.jsx(Q,{name:"companyLink",control:h,rules:{validate:S?c:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyLink"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.companyAddress"),children:e.jsx(Q,{name:"companyAddress",control:h,rules:{validate:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",error:!!i.errors[a.name],label:s("notification.email.companyAddress"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})}),e.jsx(ee,{title:s("notification.email.supportEmail"),children:e.jsx(Q,{name:"supportEmail",control:h,rules:{validate:S?g:j},render:({field:a})=>{var m;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:s("notification.email.supportEmail"),helperText:((m=i.errors[a.name])==null?void 0:m.message)||" ",disabled:!S})})}})})]})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(z),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const Is=ue(ht)``,Be={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function Os(){var M,J,ie;const{api:n}=Ze(),{blocklet:t}=Et(),{t:s}=re(),{confirmApi:r,confirmHolder:o}=Ct(),l=(M=t==null?void 0:t.meta)==null?void 0:M.did,y=Object.assign({...Be},((ie=(J=t==null?void 0:t.settings)==null?void 0:J.notification)==null?void 0:ie.pushKit)||{}),{handleSubmit:p,control:h,formState:i,watch:O,reset:A}=It({defaultValues:St(y,Object.keys(Be))}),R=Te({testReceiver:"",testReceiverError:""}),S=O("enabled"),D=V(async(c,g,j=!0)=>{var N,E;try{const{blocklet:P}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:c})}}),a=Object.assign({...Be},((E=(N=P==null?void 0:P.settings)==null?void 0:N.notification)==null?void 0:E.pushKit)||{});A(a),j&&q.success(s("oauth.saveSuccess"))}catch(P){if(j)q.error(P.message||s("oauth.saveFailed"));else throw P}}),Y=V(async(c,g)=>{var j,N,E;try{i.isDirty&&await D(c,g,!1);const P=(j=((t==null?void 0:t.configs)||[]).find($=>$.key==="BLOCKLET_APP_URL"))==null?void 0:j.value,a=Xt(Qt(P,W.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:(N=t==null?void 0:t.meta)==null?void 0:N.version,t:new Date((t==null?void 0:t.updatedAt)||0).getTime()}),m={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:t==null?void 0:t.appDid,fullName:(E=t==null?void 0:t.meta)==null?void 0:E.title,avatar:a}}}};await n.sendPush({input:{did:l,receiver:R.testReceiver,notification:JSON.stringify(m)}}),q.success(s("notification.pushKit.testSuccess"))}catch(P){q.error(P.message||s("notification.pushKit.testfailed"))}}),z=V((c,g)=>{R.testReceiverError="",r.open({title:s("notification.pushKit.testSend"),content:()=>e.jsx(T,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(te,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:s("notification.pushKit.inputTestReceiver"),value:R.testReceiver,onChange:j=>{R.testReceiver=j.target.value},error:!!R.testReceiverError,helperText:R.testReceiverError||" "})}),confirmButtonText:s("common.confirm"),cancelButtonText:s("common.cancel"),async onConfirm(j){var E;if(!((E=R.testReceiver)==null?void 0:E.trim())){R.testReceiverError=s("notification.pushKit.receiverRequired");return}R.testReceiverError="",await Y(c,g),j()}})}),B=V(c=>{const g=c==null?void 0:c.trim();return g?$e(g)?!0:s("notification.pushKit.endpointInvalid"):s("notification.pushKit.endpointRequired")}),_=V(()=>!0);return e.jsxs(T,{children:[e.jsxs(As,{component:"form",onSubmit:p(D),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(ee,{title:s("notification.pushKit.enable"),my:2.5,children:e.jsx(Q,{name:"enabled",control:h,render:({field:c})=>e.jsx(ge,{control:e.jsx(We,{checked:c.value,...c})})})}),e.jsx(ee,{title:s("notification.pushKit.endpoint"),children:e.jsx(Q,{name:"endpoint",control:h,rules:{validate:S?B:_},render:({field:c})=>{var g;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",required:!0,label:s("notification.pushKit.endpoint"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})}),e.jsxs(ee,{title:s("notification.pushKit.customOptions"),children:[e.jsx(Q,{name:"did",control:h,render:({field:c})=>{var g;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.did"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}}),e.jsx(Q,{name:"pushPath",control:h,render:({field:c})=>{var g;return e.jsx(G,{fullWidth:!0,children:e.jsx(te,{...c,size:"small",label:s("notification.pushKit.pushPath"),error:!!i.errors[c.name],helperText:((g=i.errors[c.name])==null?void 0:g.message)||" ",disabled:!S})})}})]}),e.jsxs(T,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(me,{variant:"outlined",color:"warning",onClick:p(z),disabled:!S,children:s("oauth.runTest")}),e.jsx(me,{type:"submit",variant:"contained",disabled:!i.isDirty,children:s("oauth.save")})]})]}),o]})}const As=ue(ht)``,ft=[{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Email"}),value:"email"},{label:e.jsx(T,{textAlign:"center",width:"100%",children:"Push Kit"}),value:"pushKit"}];function Ds(){const[n,t]=C.useState(ft[0].value),{locale:s}=C.useContext(ss),r=ce(()=>({email:e.jsx(Es,{}),pushKit:e.jsx(Os,{})}),[s]),o=C.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(T,{children:[e.jsx(wt,{tabs:ft,current:n,onChange:t}),e.jsx(T,{style:o,children:r[n]})]})}const Pt=C.createContext({}),{Provider:Ls,Consumer:si}=Pt;function Ps({children:n,blocklet:t=""}){const{api:s,inService:r,ws:{useSubscription:o}}=Ze(),[l,y]=C.useState([]),[p,h]=C.useState({total:0,pageSize:20,pageCount:0,page:1}),i=ce(()=>{var c;return(c=t.meta)==null?void 0:c.did},[t]),[O,A]=C.useState([]),[R,S]=C.useState({}),D=ce(()=>l.length?new Set(l.map(c=>c.id)):new Set,[l]),Y=async({page:c=1,pageSize:g=20,...j}={})=>{if(!i)return[];try{const N={paging:{page:c,pageSize:g},...j,teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0},{dids:E,...P}=N;let a="";E&&E.includes("system")&&(a="system");const m=E?E.filter(oe=>oe!=="system"):[],$={...P,source:a,componentDids:m},U=await s.getNotificationSendLog({input:$});return S($),y(U.list),h(U.paging),U.list}catch(N){return q.error(N.message),[]}},z=async()=>{const c=await s.getNotificationComponents({input:{teamDid:i}});A(c.componentDids)},B=C.useCallback(c=>{const g=t.children.find(j=>{var N;return((N=j.meta)==null?void 0:N.did)===c});if(g)return g.ancestors=[t],g},[t]),_=async({notificationId:c,receivers:g,channels:j,...N})=>{await s.resendNotification({input:{teamDid:i,notificationId:c,receivers:g,channels:j.map(E=>E==="wallet"?W.NOTIFICATION_SEND_CHANNEL.WALLET:E==="pushKit"?W.NOTIFICATION_SEND_CHANNEL.PUSH:E),...N}})},M=C.useCallback(async c=>(await s.getUser({input:{teamDid:i,user:{did:c}}})).user,[s,i]),J=C.useCallback(async({page:c=1,pageSize:g=20,...j}={})=>{try{const N={paging:{page:c,pageSize:g},...j,userName:j.searchText||"",teamDid:i,dateRange:j.dateRange?[se(j.dateRange[0]).toISOString(),se(j.dateRange[1]).toISOString()]:void 0};return await s.getReceivers({input:N})}catch(N){throw q.error(N.message),N}},[s,i]);C.useEffect(()=>{i&&z()},[i]),o(W.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,c=>{D.has(c.notificationId)&&Y(R)},[D,R]),o(W.EVENTS.NOTIFICATION_BLOCKLET_CREATE,c=>{D.has(c.id)||Y(R)},[D,R]);const ie={fetch:Y,data:l,paging:p,blocklet:t,getComponent:B,resendNotification:_,getUser:M,componentDids:O,getReceivers:J,inService:r,teamDid:i};return e.jsx(Ls,{value:{notificationRecords:ie},children:n})}function tt(){const{notificationRecords:n}=C.useContext(Pt);return n}Ne.propTypes={severity:x.oneOf(Object.values(["info","success","error","warning"])).isRequired};const _s={info:"primary",success:"success",error:"error",warning:"warning"};function Ne({severity:n="info"}){return e.jsx(ns,{type:_s[n],children:n})}var st={},ks=Je;Object.defineProperty(st,"__esModule",{value:!0});var _t=st.default=void 0,Fs=ks(Qe()),Bs=e;_t=st.default=(0,Fs.default)((0,Bs.jsx)("path",{d:"M16.59 7.58 10 14.17l-3.59-3.58L5 12l5 5 8-8zM12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m0 18c-4.42 0-8-3.58-8-8s3.58-8 8-8 8 3.58 8 8-3.58 8-8 8"}),"CheckCircleOutline");var nt={},zs=Je;Object.defineProperty(nt,"__esModule",{value:!0});var kt=nt.default=void 0,Ws=zs(Qe()),Ks=e;kt=nt.default=(0,Ws.default)((0,Ks.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M4 12c0-4.42 3.58-8 8-8 1.85 0 3.55.63 4.9 1.69L5.69 16.9C4.63 15.55 4 13.85 4 12m8 8c-1.85 0-3.55-.63-4.9-1.69L18.31 7.1C19.37 8.45 20 10.15 20 12c0 4.42-3.58 8-8 8"}),"Block");var it={},qs=Je;Object.defineProperty(it,"__esModule",{value:!0});var Ft=it.default=void 0,Ms=qs(Qe()),$s=e;Ft=it.default=(0,Ms.default)((0,$s.jsx)("path",{d:"M17.65 6.35C16.2 4.9 14.21 4 12 4c-4.42 0-7.99 3.58-7.99 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L13 11h7V4z"}),"Refresh");const Us=(n,t,s="")=>{if(!s||!t)return"";switch(s){case W.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:t});case W.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return s}};function Bt(n,t,s={}){const{status:r,updatedAt:o,reason:l="",channel:y="wallet"}=s,p=o?n("notification.sendStatus.sentTime",{date:os(o,t)}):"",h=Us(n,y,l);return r===W.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:p,reason:h}:r===W.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:p}:{status:"pending",title:n("notification.sendStatus.pending"),reason:h,sentTime:p}}const Ge={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ye=["wallet","pushKit","email"],mt=["info","success","error","warning"],zt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.email)==null?void 0:r.enabled},Wt=n=>{var s,r;const{settings:t}=n;return(r=(s=t==null?void 0:t.notification)==null?void 0:s.pushKit)==null?void 0:r.enabled},Hs=(n,t)=>{const s=fe(t,"extra.notifications.email",!0);return{available:zt(n),enabled:s}},Vs=(n,t)=>{const s=fe(t,"extra.notifications.push",!0);return{available:Wt(n),enabled:s}},Gs=n=>({enabled:fe(n,"extra.notifications.wallet",!0)}),Ys=n=>({enabled:fe(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(t=>{setTimeout(()=>{t()},n*1e3)}),Js=(n,t)=>t==="wallet"||t==="webhook"?[{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:t==="pushKit"||t==="email"?[{channel:t,type:"available",pass:n("notification.sendStatus.reason.available",{channel:t}),fail:n("notification.sendStatus.reason.unavailable",{channel:t})},{channel:t,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:t}),fail:n("notification.sendStatus.reason.disabled",{channel:t})}]:[],Ie=(n=[])=>{const t=se().startOf("day");return n.filter(s=>se(s.sendAt).isSame(t,"day")).length},Xs=(n,t="")=>{if(t&&Ye.includes(t)){const l=`${t}SendRecord`,y=fe(n,l,[]);return Ie(y)}const s=fe(n,"webhook",{}),r=Object.keys(s??{})??[];if(t&&r.includes(t)){const l=s[t]??[];return Ie(l)}const o={};return Ye.forEach(l=>{const y=`${l}SendRecord`,p=fe(n,y,[]),h=Ie(p);o[l]=h}),r.length>0&&r.forEach(l=>{const y=s[l]??[],p=Ie(y);o[l]=p}),o},Ae=(n,t,s)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[s].splice(t,1),n},De=(n,t)=>{if(!Array.isArray(t))throw new Error("filters must be an array");return t.length?!t.includes(n):!1},Qs=n=>{switch(n){case W.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case W.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case W.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case W.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Kt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function de({config:n,enableTooltip:t=!0,showTitle:s=!1,children:r}){const{status:o,title:l="",sentTime:y="",reason:p=""}=n,h=[l,p].filter(Boolean).join(", ");return e.jsx(xt,{title:t?e.jsxs(e.Fragment,{children:[e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:h}),e.jsx("span",{children:y})]}):null,arrow:!0,placement:"top",children:e.jsxs(T,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(T,{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center",children:[e.jsx(T,{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:Ge[o],style:{opacity:.15}}),e.jsx(T,{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:Ge[o]})]}),e.jsx(ae,{color:"inherit",sx:{fontSize:12},children:s?l:r})]})})}de.propTypes={config:x.object.isRequired,enableTooltip:x.bool,showTitle:x.bool,children:x.node};de.defaultProps={enableTooltip:!0,showTitle:!1,children:null};Se.propTypes={list:x.array.isRequired,label:x.string.isRequired,onDelete:x.func};Se.defaultProps={onDelete:()=>{}};function Se({list:n,label:t,onDelete:s}){const{t:r,locale:o}=re();return e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsxs(ae,{children:[t,": "]}),n.map(l=>{const y=Bt(r,o,{status:l});return e.jsx(Xe,{size:"small",label:e.jsx(T,{display:"flex",alignItems:"center",sx:{gap:"4px"},children:e.jsx(de,{config:y,enableTooltip:!1,children:y.title})}),onDelete:p=>s(p,l)},l)})]})}at.propTypes={filterList:x.array.isRequired,onChange:x.func.isRequired,index:x.number.isRequired,column:x.object.isRequired,filterValues:x.array.isRequired,label:x.string.isRequired,renderLabel:x.func.isRequired};function at({filterList:n,onChange:t,index:s,column:r,filterValues:o,label:l,renderLabel:y}){return e.jsxs(G,{className:"filter-container",children:[e.jsx(gt,{component:"legend",children:l}),e.jsx(Ke,{row:!0,children:o.map(p=>e.jsx(ge,{control:e.jsx(qe,{checked:n[s].indexOf(p.value??p)>-1,onChange:h=>{const i=[...n];h.target.checked?i[s]=[...i[s],p.value??p]:i[s]=i[s].filter(O=>O!==(p.value??p)),t(i[s],s,r)},name:p.value??p}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:y(p)})},p.value??p))})]})}function ze(n){return e.jsx(at,{...n,renderLabel:t=>e.jsx(de,{enableTooltip:!1,config:{status:t.status},children:t.label})})}ve.propTypes={status:x.number.isRequired,updatedAt:x.string.isRequired,reason:x.string,channel:x.string,onResend:x.func};function ve({status:n,updatedAt:t,reason:s="",channel:r="wallet",onResend:o}){const{t:l,locale:y}=re(),p=Bt(l,y,{status:n,updatedAt:t,reason:s,channel:r});return e.jsxs(T,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(de,{config:p,showTitle:!0}),p.status!=="success"&&e.jsx(Le,{className:"resend-btn",size:"small",startIcon:e.jsx(et,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}rt.propTypes={value:x.array.isRequired,onChange:x.func};function rt({value:n,onChange:t}){const{locale:s}=re(),r=se().toDate(),[o,l]=C.useState(null),y=C.useCallback(i=>{l(o?null:i.currentTarget)},[o]),p=!!o,h=C.useCallback(i=>{if(!i.startDate||!i.endDate){q.error("Please select a date range");return}if(se(i.startDate).isAfter(i.endDate)||!se(i.startDate).isValid()||!se(i.endDate).isValid()){q.error("Invalid date range");return}t([i.startDate,i.endDate]),l(null)},[t]);return e.jsxs("div",{children:[e.jsx(ae,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},mb:0,children:e.jsxs(Le,{onClick:y,variant:"outlined",size:"small",color:"inherit",children:[pt(n[0],s)," - ",pt(n[1],s)]})}),e.jsx(Me,{open:p,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(ys,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:y,definedRanges:Ss(r),onChange:h})})]})}ot.propTypes={itemComponent:x.elementType.isRequired};function ot({itemComponent:n,...t}){var o;const{t:s}=re();return!((o=t==null?void 0:t.filterList)!=null&&o.filter(l=>l.length).length)?null:e.jsxs(T,{display:"flex",gap:1,alignItems:"center",children:[e.jsx("div",{className:"toolbar-filter-title",children:s("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(is.TableFilterList,{...t,ItemComponent:n})})]})}function Pe({label:n,onDelete:t,canDelete:s=()=>!0,...r}){const o=t&&typeof t=="function"?t:void 0;let l=!0;return s&&typeof s=="function"&&(l=s({label:n,...r})),e.jsx(Xe,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}Pe.propTypes={label:x.string.isRequired,onDelete:x.func,canDelete:x.func};Pe.defaultProps={canDelete:()=>!0};const Zs=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];lt.propTypes={loading:x.bool,onCancel:x.func,onConfirm:x.func};lt.defaultProps={loading:!1,onCancel:()=>{},onConfirm:()=>{}};function lt({loading:n=!1,onCancel:t,onConfirm:s}){const{t:r}=re(),[o,l]=C.useState(Zs),[y,p]=C.useState(!0),h=(O,A)=>{A.checked=O.target.checked;const R=o.map(S=>({...S,checked:S.value===A.value?A.checked:S.checked}));l(R)},i=O=>{O.stopPropagation(),s({channels:o.filter(A=>A.checked).map(A=>A.value),isResendFailedOnly:y})};return e.jsxs(T,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ae,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(T,{className:"choose-channel",children:e.jsxs(G,{component:"fieldset",variant:"standard",children:[e.jsx(gt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(Ke,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(O=>e.jsx(ge,{control:e.jsx(qe,{checked:O.checked,onChange:A=>h(A,O),name:O.value}),label:O.label},O.value))})]})}),e.jsx(T,{className:"resend-config-footer",children:e.jsx(Ke,{children:e.jsx(ge,{control:e.jsx(qe,{checked:y,onChange:O=>p(O.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(T,{display:"flex",justifyContent:"flex-end",gap:1,className:"resend-config-footer-tip",children:[e.jsx(Le,{onClick:O=>{O.stopPropagation(),t()},color:"inherit",children:r("common.cancel")}),e.jsxs(Le,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(bt,{size:16}),r("common.confirm")]})]})]})}qt.propTypes={notificationId:x.string.isRequired,handleResend:x.func,resending:x.bool};function qt({notificationId:n,handleResend:t,resending:s=!1}){const{t:r,locale:o}=re(),l=jt(),y=C.useMemo(()=>vt(l,Kt()),[l]),{getReceivers:p,inService:h,teamDid:i,getUser:O,blocklet:A}=tt(),[R,S]=C.useState(!1),[D,Y]=C.useState([]),z=Te({anchorEl:null,position:null}),B=Te({anchorEl:null,position:null}),[_,M]=C.useState(null),[J,ie]=C.useState({total:0,pageSize:10,pageCount:0,page:1}),[c,g]=C.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[se().subtract(1,"month").startOf("day").toDate(),se().endOf("day").toDate()]}),[j,N]=C.useState([]),E=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],P=async()=>{if(!R&&n)try{S(!0);const d=await p({notificationId:n,...c}),u=d.list.map(f=>({...f,receiverUser:{...f.receiverUser,avatar:Dt(f.receiverUser.avatar,i,h)}}));Y(u),ie(d.paging),S(!1)}catch(d){q.error(d.message),S(!1)}};C.useEffect(()=>{P()},[c]);const a=d=>{d.stopPropagation();const u=d.currentTarget;B.anchorEl=u;const f=u.getBoundingClientRect();B.position={top:f.top+window.scrollY,left:f.left+window.scrollX}},m=d=>d.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(me,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(et,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:a,children:r("notification.resend")})}):null,$={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:J.page-1,rowsPerPage:J.pageSize,count:J.total,searchText:c.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:j,onRowSelectionChange:(d,u)=>{N(u.map(f=>f.dataIndex))},customToolbarSelect:m},U=({page:d,rowsPerPage:u,searchText:f,filterList:L})=>{const[,K=[],Z=[],X=[]]=L;c.pageSize!==u?g(H=>({...H,pageSize:u,page:1})):c.page!==d+1?g(H=>({...H,page:d+1})):c.searchText!==f?g(H=>({...H,searchText:f,page:1})):ye(K,c.walletSendStatus)?ye(Z,c.pushKitSendStatus)?ye(X,c.emailSendStatus)||g(H=>({...H,emailSendStatus:X,page:1})):g(H=>({...H,pushKitSendStatus:Z,page:1})):g(H=>({...H,walletSendStatus:K,page:1}))},oe=C.useCallback(async(d,u)=>{if(!u)return!1;const f=await O(u);return f?d==="wallet"?Gs(f):d==="email"?Hs(A,f):d==="pushKit"?Vs(A,f):d==="webhook"?Ys(f):!0:!1},[O,A]),le=C.useCallback(d=>Js(r,d),[r]),pe=()=>{z.anchorEl=null,z.position=null,M(null)},be=()=>{B.anchorEl=null,B.position=null},je=async(d,u,f=!0,L="")=>{if(!(!u.length||!d.length))try{t(d,u,f,L),B.anchorEl||(await Ee(.5),pe())}catch(K){console.error("handleResend error",{error:K})}},v=async({channels:d,isResendFailedOnly:u})=>{const f=j.map(L=>D[L].receiver);await je(d,f,u),await Ee(.5),be(),N([])},b=async(d,u=[],f=!0)=>{try{await je(["webhook"],[d.receiver],f,u)}catch(L){q.error(L.response?L.response.statusText:L.message)}},w=async(d,u,f,L=[],K=!0)=>{if(d.stopPropagation(),Xs(u,f)>=4){q.warning(r("notification.resendLimit"));return}if(!Ye.includes(f)){await b(u,L,K);return}if(d){const X=d.currentTarget,H=X.getBoundingClientRect();z.anchorEl=X,z.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}M({channel:f});try{const X=await oe(f,u.receiver);await Ee(1),M({channel:f,result:X}),(typeof X=="boolean"&&X||Zt(X)&&Object.values(X).every(H=>!!H))&&(await t([f],[u.receiver],K),B.anchorEl||(await Ee(.5),pe()))}catch(X){q.error(X.message)}},I=d=>{g(u=>({...u,dateRange:d,page:1}))},k=(d,u,f,L)=>{d.stopPropagation();const K=f.filter(Z=>Z!==u);g(Z=>({...Z,[L]:K,page:1}))},F=ce(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:d=>{const{receiverUser:u,receiver:f}=D[d];return u?e.jsxs(T,{"data-cy":`member-name-${u.fullName}`,display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start",children:[e.jsx(Tt,{src:`${u.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:f,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Re,{children:u.fullName})]},f):e.jsx(vs,{size:14,responsive:!1,compact:!0,copyable:!1,did:f})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:c.walletSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Wallet",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[1].options.filterList,"walletSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Wallet",filterList:d,onChange:u,index:f,column:L,filterValues:E})},customBodyRenderLite:d=>{const{walletSendStatus:u,walletSendAt:f,walletSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"wallet",onResend:K=>w(K,D[d],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{pushKitSendStatus:u,pushKitSendAt:f,pushKitSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"pushkit",onResend:K=>w(K,D[d],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:c.pushKitSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Push Kit",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[2].options.filterList,"pushKitSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Push Kit",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{emailSendStatus:u,emailSendAt:f,emailSendFailedReason:L}=D[d];return e.jsx(ve,{status:u,updatedAt:f,reason:L,channel:"email",onResend:K=>w(K,D[d],"email",[],!1)})},filter:!0,filterType:"custom",filterList:c.emailSendStatus??[],customFilterListOptions:{render:d=>e.jsx(Se,{list:d,label:"Email",onDelete:(u,f)=>{u.stopPropagation(),k(u,f,F[3].options.filterList,"emailSendStatus")}}),update:Ae},filterOptions:{names:E,fullWidth:!0,logic:De,display:(d,u,f,L)=>e.jsx(ze,{label:"Email",filterList:d,onChange:u,index:f,column:L,filterValues:E})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:d=>{const{webhook:u}=D[d];if(!u)return null;const f=Object.entries(u)[0];if(!f)return null;const[L,K]=f,Z=K[0];return e.jsx(T,{display:"flex",flexDirection:"column",gap:1,children:e.jsxs(T,{className:"webhook-item",fontSize:12,children:[e.jsx(Re,{maxLength:30,children:L},L),e.jsx(ve,{status:Z.status,updatedAt:Z.sendAt,reason:Z.failedReason,channel:"webhook",onResend:X=>w(X,D[d],"webhook",[L],!1)})]},L)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:d=>{const{createdAt:u}=D[d];return e.jsx(At,{value:u,locale:o,shouldUpdate:!0})}}}],[D,o,c,r]),ne=[e.jsx(rt,{value:c.dateRange,onChange:I},"date-picker"),e.jsx(me,{variant:"contained",size:"small",color:"primary",loading:R,startIcon:e.jsx(Ft,{}),onClick:()=>P(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(T,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(tn,{children:e.jsxs(yt,{theme:y,children:[e.jsx(Rt,{className:"receivers-table",locale:o,loading:R,columns:F,data:D,onChange:U,options:$,customButtons:ne,components:{TableFilterList:d=>e.jsx(ot,{...d,itemComponent:u=>e.jsx(Pe,{...u,canDelete:()=>!1})})}}),z.anchorEl&&e.jsx(Me,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:pe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs(sn,{children:[e.jsxs(ae,{variant:"body1",component:"div",className:"check-title",children:[_==null?void 0:_.channel," Checking"]}),e.jsx(T,{display:"flex",flexDirection:"column",sx:{gap:"4px"},children:le(_==null?void 0:_.channel).map(d=>{var K,Z;const{type:u,pass:f,fail:L}=d;return!(_!=null&&_.result)||(K=_==null?void 0:_.result)!=null&&K[u]?e.jsxs(ae,{variant:"body1",component:"div",className:"check-item",display:"flex",alignItems:"center",sx:{gap:"4px",color:(Z=_==null?void 0:_.result)!=null&&Z[u]?Oe.success.main:"inherit"},children:[_!=null&&_.result?e.jsx(_t,{}):e.jsx(bt,{size:12,sx:{color:Oe.primary.main}}),e.jsx("span",{children:f})]},u):e.jsxs(ae,{variant:"body1",component:"div",display:"flex",alignItems:"center",className:"check-item",sx:{gap:"4px",color:Oe.error.main},children:[e.jsx(kt,{}),e.jsx("span",{children:L})]},u)})})]})}),B.anchorEl&&e.jsx(Me,{open:!!B.anchorEl,anchorReference:"anchorPosition",anchorPosition:B.position,onClose:be,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(lt,{loading:s,onCancel:be,onConfirm:v})})]})})})}const en=C.memo(qt),tn=ue.div`
2
2
  td.MuiTableCell-footer {
3
3
  border: none !important;
4
4
  }
@@ -1 +1 @@
1
- import{r as m}from"./vendor-react-DEoibe3W.js";import{a as w,k as C,a2 as T,ax as P,b$ as R}from"./vendor-ux-did-connect-pzpsrvqx.js";import{l as v}from"./vendor-hooks-DqdmWCmo.js";import{j as e,aa as s,ab as y,ak as j,al as L,bo as M,br as W,bn as B,q as _,ap as A,I as D,y as z,H as F}from"./vendor-mui-core-Bq8gXTan.js";import{d as q}from"./Launch-DFS3fgjy.js";import{a as K}from"./api-C1S8LUld.js";import{T as N}from"./table-tips-BzPqsKYQ.js";import{D as k}from"./index-CwUT0vPy.js";import{u as U}from"./dashboard-t9EszOna.js";import"./vendor-utils-BfZ4tlod.js";import"./lottie-web-jYmAQWuC.js";import"./InfoOutlined-BVWbftGI.js";import"./use-mobile-DwzRjjku.js";import"./vendor-arcblock-CwufDgLV.js";import"./useLocalStorage-CaPDqrQ7.js";import"./index-8eXqqyHQ.js";import"./confirm-RvA9mFot.js";import"./PlayArrow-BqVYRyLK.js";import"./get-safe-url-B0-S5PGZ.js";import"./session-BGdAM8zS.js";import"./use-blocklet-logo-4UB-MFD3.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CtTQsfXN.js";function $({endpoint:n}){const[i,r]=m.useState("mcp-link"),h=k(),{api:g}=k(),{teamDid:p}=U(),{t:u,locale:d}=w(),{data:o,run:b,loading:x}=v(()=>g.createAccessKey({input:{teamDid:p,passport:C.SERVER_ROLES.ADMIN,authType:"simple",remark:"Generated by MCP Servers"}}),{manual:!0}),{imgPrefix:t}=h,a=m.useMemo(()=>[{icon:e.jsx(s,{sx:{width:20,height:20},children:"🔗"}),value:"mcp-link",label:"MCP Link"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/claude.webp`,alt:"Claude",sx:{width:20,height:20}}),value:"claude",label:"Claude"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/cursor.png`,alt:"Cursor",sx:{width:20,height:20}}),value:"cursor",label:"Cursor"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/cline.png`,alt:"Cline",sx:{width:20,height:20}}),value:"cline",label:"Cline"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/roocline.png`,alt:"Roo Cline",sx:{width:20,height:20}}),value:"roo-cline",label:"Roo Cline"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/windsurf.png`,alt:"Windsurf",sx:{width:20,height:20}}),value:"windsurf",label:"Windsurf"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/witsy.png`,alt:"Witsy",sx:{width:20,height:20}}),value:"witsy",label:"Witsy"}],[t]),l=a.find(c=>c.value===i),f=m.useMemo(()=>{var c;return(c=o==null?void 0:o.data)==null?void 0:c.accessKeySecret},[o]),S=m.useMemo(()=>!f&&i!=="mcp-link",[f,i]),I=c=>{const E=`npx @blocklet/install-mcp@latest i ${n} --client ${c} --streamableHTTP --oauth2Bearer ${f}`;switch(c){case"cursor":case"claude":case"cline":case"roo-cline":case"windsurf":case"witsy":return E;case"mcp-link":default:return n}};return e.jsxs(s,{children:[e.jsx(P,{tabs:a,current:i,onChange:r,scrollButtons:"auto",iconPosition:"start"}),e.jsxs(s,{children:[e.jsxs(s,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(s,{component:"h2",children:i==="mcp-link"?l==null?void 0:l.label:`${l==null?void 0:l.label} ${u("installCommand")}`}),i!=="mcp-link"&&e.jsx(A,{href:`https://www.arcblock.io/docs/blocklet-developer/${d}/mcp-${i}`,target:"_blank",rel:"noopener noreferrer",children:e.jsx(D,{size:"small",children:e.jsx(q,{})})})]}),e.jsxs(s,{position:"relative",sx:{"& .codeblock__inner":{overflow:"auto !important"}},children:[e.jsx(R,{code:I(i),language:"shell",style:{margin:0}}),S&&e.jsx(s,{position:"absolute",top:0,right:0,left:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",sx:{bgcolor:"action.active",backdropFilter:"blur(3px)",WebkitBackdropFilter:"blur(3px)",zIndex:1},children:x?e.jsx(y,{}):e.jsx(z,{variant:"contained",color:"primary",onClick:b,size:"small",children:`${u("common.generate")} ${u("command")}`})})]})]})]})}$.propTypes={endpoint:F.string.isRequired};function ge(){var x;const[n,i]=m.useState(null),{t:r,locale:h}=w(),g=`${(x=window==null?void 0:window.blocklet)==null?void 0:x.appUrl}${C.WELLKNOWN_SERVICE_PATH_PREFIX}/mcp/servers`,{data:p,loading:u,error:d}=v(()=>Promise.all([K.get(g)])),o=m.useMemo(()=>{var t,a;return((a=(t=p==null?void 0:p[0])==null?void 0:t.data)==null?void 0:a.servers)||[]},[p]);m.useEffect(()=>{o!=null&&o.length&&i(o.find(t=>{var a;return t.did===((a=window==null?void 0:window.blocklet)==null?void 0:a.did)})||o[0])},[o]);const b=t=>{const a=t.target.value;i(o.find(l=>l.did===a))};return u?e.jsx(s,{children:e.jsx(y,{})}):d?e.jsx(j,{color:"error",children:d==null?void 0:d.message}):o!=null&&o.length?e.jsxs(L,{gap:2,sx:{maxWidth:1200},children:[e.jsx(N,{title:r("mcp.listTitle"),tooltipTitle:r("mcp.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${h}/mcp-server`}),e.jsxs(M,{fullWidth:!0,children:[e.jsx(W,{id:"server-select-label",children:r("mcp.available")}),e.jsx(B,{labelId:"server-select-label",value:(n==null?void 0:n.did)||"",label:r("mcp.available"),onChange:b,children:o.map(t=>e.jsx(_,{value:t.did,children:e.jsxs(s,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(T,{variant:"rounded",shape:"square",did:t.did,src:t.logo,size:20}),e.jsx(s,{sx:{fontSize:14},children:t.name})]})},t.did))})]}),n&&e.jsx($,{endpoint:n.endpoint})]}):e.jsx(j,{color:"warning",children:r("mcp.noServer")})}export{ge as default};
1
+ import{r as m}from"./vendor-react-DEoibe3W.js";import{a as w,k as C,a2 as T,ax as P,b$ as R}from"./vendor-ux-did-connect-pzpsrvqx.js";import{l as v}from"./vendor-hooks-DqdmWCmo.js";import{j as e,aa as s,ab as y,ak as j,al as L,bo as M,br as W,bn as B,q as _,ap as A,I as D,y as z,H as F}from"./vendor-mui-core-Bq8gXTan.js";import{d as q}from"./Launch-DFS3fgjy.js";import{a as K}from"./api-C1S8LUld.js";import{T as N}from"./table-tips-BzPqsKYQ.js";import{D as k}from"./index-CwUT0vPy.js";import{u as U}from"./dashboard-t9EszOna.js";import"./vendor-utils-BfZ4tlod.js";import"./lottie-web-jYmAQWuC.js";import"./InfoOutlined-BVWbftGI.js";import"./use-mobile-CtTQsfXN.js";import"./vendor-arcblock-CwufDgLV.js";import"./useLocalStorage-CaPDqrQ7.js";import"./index-8eXqqyHQ.js";import"./confirm-RvA9mFot.js";import"./PlayArrow-BqVYRyLK.js";import"./get-safe-url-D5KSEAKZ.js";import"./session-BGdAM8zS.js";import"./use-blocklet-logo-4UB-MFD3.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DwzRjjku.js";function $({endpoint:n}){const[i,r]=m.useState("mcp-link"),h=k(),{api:g}=k(),{teamDid:p}=U(),{t:u,locale:d}=w(),{data:o,run:b,loading:x}=v(()=>g.createAccessKey({input:{teamDid:p,passport:C.SERVER_ROLES.ADMIN,authType:"simple",remark:"Generated by MCP Servers"}}),{manual:!0}),{imgPrefix:t}=h,a=m.useMemo(()=>[{icon:e.jsx(s,{sx:{width:20,height:20},children:"🔗"}),value:"mcp-link",label:"MCP Link"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/claude.webp`,alt:"Claude",sx:{width:20,height:20}}),value:"claude",label:"Claude"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/cursor.png`,alt:"Cursor",sx:{width:20,height:20}}),value:"cursor",label:"Cursor"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/cline.png`,alt:"Cline",sx:{width:20,height:20}}),value:"cline",label:"Cline"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/roocline.png`,alt:"Roo Cline",sx:{width:20,height:20}}),value:"roo-cline",label:"Roo Cline"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/windsurf.png`,alt:"Windsurf",sx:{width:20,height:20}}),value:"windsurf",label:"Windsurf"},{icon:e.jsx(s,{component:"img",src:`${t}/mcp/witsy.png`,alt:"Witsy",sx:{width:20,height:20}}),value:"witsy",label:"Witsy"}],[t]),l=a.find(c=>c.value===i),f=m.useMemo(()=>{var c;return(c=o==null?void 0:o.data)==null?void 0:c.accessKeySecret},[o]),S=m.useMemo(()=>!f&&i!=="mcp-link",[f,i]),I=c=>{const E=`npx @blocklet/install-mcp@latest i ${n} --client ${c} --streamableHTTP --oauth2Bearer ${f}`;switch(c){case"cursor":case"claude":case"cline":case"roo-cline":case"windsurf":case"witsy":return E;case"mcp-link":default:return n}};return e.jsxs(s,{children:[e.jsx(P,{tabs:a,current:i,onChange:r,scrollButtons:"auto",iconPosition:"start"}),e.jsxs(s,{children:[e.jsxs(s,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(s,{component:"h2",children:i==="mcp-link"?l==null?void 0:l.label:`${l==null?void 0:l.label} ${u("installCommand")}`}),i!=="mcp-link"&&e.jsx(A,{href:`https://www.arcblock.io/docs/blocklet-developer/${d}/mcp-${i}`,target:"_blank",rel:"noopener noreferrer",children:e.jsx(D,{size:"small",children:e.jsx(q,{})})})]}),e.jsxs(s,{position:"relative",sx:{"& .codeblock__inner":{overflow:"auto !important"}},children:[e.jsx(R,{code:I(i),language:"shell",style:{margin:0}}),S&&e.jsx(s,{position:"absolute",top:0,right:0,left:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",sx:{bgcolor:"action.active",backdropFilter:"blur(3px)",WebkitBackdropFilter:"blur(3px)",zIndex:1},children:x?e.jsx(y,{}):e.jsx(z,{variant:"contained",color:"primary",onClick:b,size:"small",children:`${u("common.generate")} ${u("command")}`})})]})]})]})}$.propTypes={endpoint:F.string.isRequired};function ge(){var x;const[n,i]=m.useState(null),{t:r,locale:h}=w(),g=`${(x=window==null?void 0:window.blocklet)==null?void 0:x.appUrl}${C.WELLKNOWN_SERVICE_PATH_PREFIX}/mcp/servers`,{data:p,loading:u,error:d}=v(()=>Promise.all([K.get(g)])),o=m.useMemo(()=>{var t,a;return((a=(t=p==null?void 0:p[0])==null?void 0:t.data)==null?void 0:a.servers)||[]},[p]);m.useEffect(()=>{o!=null&&o.length&&i(o.find(t=>{var a;return t.did===((a=window==null?void 0:window.blocklet)==null?void 0:a.did)})||o[0])},[o]);const b=t=>{const a=t.target.value;i(o.find(l=>l.did===a))};return u?e.jsx(s,{children:e.jsx(y,{})}):d?e.jsx(j,{color:"error",children:d==null?void 0:d.message}):o!=null&&o.length?e.jsxs(L,{gap:2,sx:{maxWidth:1200},children:[e.jsx(N,{title:r("mcp.listTitle"),tooltipTitle:r("mcp.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${h}/mcp-server`}),e.jsxs(M,{fullWidth:!0,children:[e.jsx(W,{id:"server-select-label",children:r("mcp.available")}),e.jsx(B,{labelId:"server-select-label",value:(n==null?void 0:n.did)||"",label:r("mcp.available"),onChange:b,children:o.map(t=>e.jsx(_,{value:t.did,children:e.jsxs(s,{display:"flex",alignItems:"center",gap:1,children:[e.jsx(T,{variant:"rounded",shape:"square",did:t.did,src:t.logo,size:20}),e.jsx(s,{sx:{fontSize:14},children:t.name})]})},t.did))})]}),n&&e.jsx($,{endpoint:n.endpoint})]}):e.jsx(j,{color:"warning",children:r("mcp.noServer")})}export{ge as default};
@@ -1,4 +1,4 @@
1
- import{j as t,ab as S,aa as c,H as d,ah as g}from"./vendor-mui-core-Bq8gXTan.js";import{r as y}from"./vendor-react-DEoibe3W.js";import{bb as v,F as w,B as m}from"./vendor-ux-did-connect-pzpsrvqx.js";import{P}from"./page-header-DNvUdNpI.js";import{G as T}from"./index-CwUT0vPy.js";import{u as b}from"./config-space-D6ScnWdA.js";import{C as B,D as E,a as D}from"./connect-to-CxoBjkcK.js";import{S as u}from"./step-actions-BNbc1l8F.js";import{S as G}from"./layout-DEiEwPzB.js";import"./vendor-utils-BfZ4tlod.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CwufDgLV.js";import"./spaces-DUkzPTBd.js";import"./api-C1S8LUld.js";import"./index-8eXqqyHQ.js";import"./DeleteOutline-BKSMNwfT.js";import"./use-mobile-CtTQsfXN.js";import"./content-layout-BC2QkTYi.js";function l({onNext:a,onPrevious:x}){var n,r,p;const{t:i}=y.useContext(v),{blocklet:e}=T(),{spaceGateway:f,settingStorageEndpoint:j,updateSpaceGateway:C,hasStorageEndpoint:h,loading:o,storageEndpoint:s}=b();return o?t.jsx(w,{relative:"parent",children:t.jsx(S,{})}):t.jsxs(N,{children:[t.jsx("div",{className:"header",children:t.jsx(P,{title:i("setup.didSpace.title"),subTitle:i("setup.didSpace.subTitle"),onClickBack:x})}),t.jsx(c,{sx:{width:"100%",maxWidth:"720px"},children:h?t.jsx(B,{spaceGateway:f,settingStorageEndpoint:j}):t.jsx(E,{})}),((n=e==null?void 0:e.capabilities)==null?void 0:n.didSpace)&&t.jsx(c,{display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"24px",children:t.jsx(D,{onConnect:C,storageEndpoint:s})}),((r=e==null?void 0:e.capabilities)==null?void 0:r.didSpace)==="required"&&t.jsx(u,{mt:8,children:t.jsx(m,{loading:o,variant:"contained",disabled:o||!s,onClick:()=>a(),children:i("setup.continue")})}),((p=e==null?void 0:e.capabilities)==null?void 0:p.didSpace)==="optional"&&t.jsx(u,{blocklet:e,onStartNow:()=>a("complete"),children:t.jsx(m,{className:"start-now",loading:o,variant:"contained",disabled:o,onClick:()=>a(),children:i(s?"setup.continue":"setup.skip")})})]})}l.propTypes={onNext:d.func,onPrevious:d.func};l.defaultProps={onNext:()=>{},onPrevious:()=>{}};const N=g(G)`
1
+ import{j as t,ab as S,aa as c,H as d,ah as g}from"./vendor-mui-core-Bq8gXTan.js";import{r as y}from"./vendor-react-DEoibe3W.js";import{bb as v,F as w,B as m}from"./vendor-ux-did-connect-pzpsrvqx.js";import{P}from"./page-header-DNvUdNpI.js";import{G as T}from"./index-CwUT0vPy.js";import{u as b}from"./config-space-D6ScnWdA.js";import{C as B,D as E,a as D}from"./connect-to-CxoBjkcK.js";import{S as u}from"./step-actions-BNbc1l8F.js";import{S as G}from"./layout-DEiEwPzB.js";import"./vendor-utils-BfZ4tlod.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CwufDgLV.js";import"./spaces-DUkzPTBd.js";import"./api-C1S8LUld.js";import"./index-8eXqqyHQ.js";import"./DeleteOutline-BKSMNwfT.js";import"./use-mobile-DwzRjjku.js";import"./content-layout-BC2QkTYi.js";function l({onNext:a,onPrevious:x}){var n,r,p;const{t:i}=y.useContext(v),{blocklet:e}=T(),{spaceGateway:f,settingStorageEndpoint:j,updateSpaceGateway:C,hasStorageEndpoint:h,loading:o,storageEndpoint:s}=b();return o?t.jsx(w,{relative:"parent",children:t.jsx(S,{})}):t.jsxs(N,{children:[t.jsx("div",{className:"header",children:t.jsx(P,{title:i("setup.didSpace.title"),subTitle:i("setup.didSpace.subTitle"),onClickBack:x})}),t.jsx(c,{sx:{width:"100%",maxWidth:"720px"},children:h?t.jsx(B,{spaceGateway:f,settingStorageEndpoint:j}):t.jsx(E,{})}),((n=e==null?void 0:e.capabilities)==null?void 0:n.didSpace)&&t.jsx(c,{display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"24px",children:t.jsx(D,{onConnect:C,storageEndpoint:s})}),((r=e==null?void 0:e.capabilities)==null?void 0:r.didSpace)==="required"&&t.jsx(u,{mt:8,children:t.jsx(m,{loading:o,variant:"contained",disabled:o||!s,onClick:()=>a(),children:i("setup.continue")})}),((p=e==null?void 0:e.capabilities)==null?void 0:p.didSpace)==="optional"&&t.jsx(u,{blocklet:e,onStartNow:()=>a("complete"),children:t.jsx(m,{className:"start-now",loading:o,variant:"contained",disabled:o,onClick:()=>a(),children:i(s?"setup.continue":"setup.skip")})})]})}l.propTypes={onNext:d.func,onPrevious:d.func};l.defaultProps={onNext:()=>{},onPrevious:()=>{}};const N=g(G)`
2
2
  height: 100%;
3
3
  overflow-y: auto;
4
4
  `;export{l as default};