@abtnode/blocklet-services 1.16.45-beta-20250609-025419-7fd1f86c → 1.16.45-beta-20250609-111118-0d252ebe

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 (86) hide show
  1. package/dist/assets/{access-control-Bu9cwoFT.js → access-control-nyeEpwlF.js} +1 -1
  2. package/dist/assets/{add-component-core-CsW-bf6w.js → add-component-core-CaE3xcyT.js} +1 -1
  3. package/dist/assets/{add-resource-D1GK1xW7.js → add-resource-CG8u25Lv.js} +1 -1
  4. package/dist/assets/{advanced-BSxn1YDX.js → advanced-yrYBgA5T.js} +1 -1
  5. package/dist/assets/{appearance-rcoe4DP4.js → appearance-DB1QowgL.js} +1 -1
  6. package/dist/assets/{audit-logs-XAopC8XN.js → audit-logs-BamIXrWh.js} +1 -1
  7. package/dist/assets/{authorize-DNwNxF9-.js → authorize-B9LP0G9q.js} +1 -1
  8. package/dist/assets/{branding-DpIlP_xM.js → branding-C2Dm2Z1c.js} +1 -1
  9. package/dist/assets/{branding-moJCZl3a.js → branding-OlEgtAUT.js} +2 -2
  10. package/dist/assets/{bundle-avatar-D28BGkcC.js → bundle-avatar-C41ZXEbR.js} +1 -1
  11. package/dist/assets/{complete-C6_ojDUa.js → complete-gnnvUqGU.js} +1 -1
  12. package/dist/assets/{component-OYgpJSh4.js → component-ClWADDCr.js} +1 -1
  13. package/dist/assets/{config-C_hb7xhJ.js → config-2Sy6fCTJ.js} +1 -1
  14. package/dist/assets/{config-navigation-VPQM3i1K.js → config-navigation-CsVa3Hf0.js} +3 -3
  15. package/dist/assets/{config-space-CBoUabjP.js → config-space-B39Ur9Mf.js} +1 -1
  16. package/dist/assets/{confirm-BjCmRSAF.js → confirm-Bay3BcpN.js} +1 -1
  17. package/dist/assets/connect-B77rXeVL.js +5 -0
  18. package/dist/assets/{connect-CQ-AWW94.js → connect-T4cAO9om.js} +1 -1
  19. package/dist/assets/{connect-to-kM9lCXLX.js → connect-to-Dac7orQh.js} +1 -1
  20. package/dist/assets/{dashboard-B7qE-Md0.js → dashboard-k0XcV2m5.js} +3 -3
  21. package/dist/assets/{delete-confirm-Dow_C0jR.js → delete-confirm-B1F5wKdb.js} +1 -1
  22. package/dist/assets/domain-CEwb0Lyz.js +9 -0
  23. package/dist/assets/{domain-action-card-CCtkcxNz.js → domain-action-card-yyZstsWL.js} +1 -1
  24. package/dist/assets/domains-CRt4uYYF.js +1 -0
  25. package/dist/assets/dot-DR7_m3Np.js +7 -0
  26. package/dist/assets/{email-DDPCqu4Z.js → email-CYOorZ7K.js} +1 -1
  27. package/dist/assets/{exchange-passport-xdsOlfWE.js → exchange-passport-xHfEBrd8.js} +1 -1
  28. package/dist/assets/{fuel-D1fw-gpI.js → fuel-CtSAk9S3.js} +1 -1
  29. package/dist/assets/{gen-access-key-R0_DUG_D.js → gen-access-key-CoOxXtqa.js} +1 -1
  30. package/dist/assets/{index-DVLOAsDQ.js → index-8kcb4Nom.js} +1 -1
  31. package/dist/assets/{index-DQjZ74P0.js → index-B18R5SlV.js} +2 -2
  32. package/dist/assets/{index-CCrgDhTM.js → index-B1fP-8KR.js} +1 -1
  33. package/dist/assets/{index-B-K0Nvyz.js → index-B4wY8GsU.js} +1 -1
  34. package/dist/assets/{index-DWZfwLDs.js → index-B7qZ5OdP.js} +1 -1
  35. package/dist/assets/{index-BSiKOdsD.js → index-C5vFhD_w.js} +1 -1
  36. package/dist/assets/{index-BBuUqC0B.js → index-CI4cLtBE.js} +1 -1
  37. package/dist/assets/{index-BY-e9TG4.js → index-CTfYMqG2.js} +1 -1
  38. package/dist/assets/{index-DnDFazyx.js → index-CY9xLy04.js} +3 -3
  39. package/dist/assets/{index-BDw54V1q.js → index-Cx-ESLe9.js} +4 -4
  40. package/dist/assets/{index-NE1bWD-Q.js → index-CyS4mBmV.js} +1 -1
  41. package/dist/assets/{index-At5NExT-.js → index-DMSe2Qjx.js} +1 -1
  42. package/dist/assets/{index-B4FABIlz.js → index-DO-a7P7z.js} +1 -1
  43. package/dist/assets/{index-Drni9chH.js → index-DQl2QJod.js} +1 -1
  44. package/dist/assets/{index-Hs7lhrID.js → index-DaMn1fo9.js} +4 -4
  45. package/dist/assets/{index-By1VEzOz.js → index-j6UAnd8n.js} +1 -1
  46. package/dist/assets/{invitation-Sx6eoeir.js → invitation-BsuZg3B2.js} +1 -1
  47. package/dist/assets/{invite-CZ68j_lY.js → invite-YNiMO-nB.js} +1 -1
  48. package/dist/assets/{issue-passport-IkLenFGe.js → issue-passport-2R7-XHuR.js} +1 -1
  49. package/dist/assets/{item-RUDvbSOI.js → item-DHMVgmIa.js} +1 -1
  50. package/dist/assets/{layout-BCvTd67o.js → layout-BnunMkuP.js} +1 -1
  51. package/dist/assets/{list-BeFxJZxl.js → list-DZwgo-zf.js} +1 -1
  52. package/dist/assets/{list-DjvUHEwY.js → list-h4Ed_myi.js} +2 -2
  53. package/dist/assets/{log-BGQO-I2s.js → log-6M_J_pon.js} +1 -1
  54. package/dist/assets/{login-BF0iOJJn.js → login-C2ILZhOf.js} +1 -1
  55. package/dist/assets/{logo-uploader-BecsVnr8.js → logo-uploader-Dhh7Un4G.js} +2 -2
  56. package/dist/assets/{lost-passport-CaF7MO2m.js → lost-passport-JODD9Yck.js} +1 -1
  57. package/dist/assets/open-window-Dn44K3ur.js +1 -1
  58. package/dist/assets/{overview-DwmambxV.js → overview-Bjj9JLCV.js} +1 -1
  59. package/dist/assets/{passport-item-DEX2NwJD.js → passport-item-CoNRdRpk.js} +1 -1
  60. package/dist/assets/{publish-resource-Bk548CMo.js → publish-resource-AW43Z8jj.js} +1 -1
  61. package/dist/assets/{runtime-xdMFSsvP.js → runtime-1mGYl_p2.js} +1 -1
  62. package/dist/assets/{security-DCYPNDg3.js → security-C2l4SCkx.js} +1 -1
  63. package/dist/assets/setup-DxzbFXmd.js +30 -0
  64. package/dist/assets/{start-t5ebRJzD.js → start-BotjXVuZ.js} +1 -1
  65. package/dist/assets/{status-C4-MBX3k.js → status-DIJ9lK3F.js} +1 -1
  66. package/dist/assets/{step-actions-Brohu3S-.js → step-actions-DLZOEVat.js} +1 -1
  67. package/dist/assets/table-tips-Czrj7r52.js +1 -1
  68. package/dist/assets/{traffic-BI_ofO44.js → traffic-fPCLOWN3.js} +1 -1
  69. package/dist/assets/{transfer-SwfyIGYE.js → transfer-BqCYXmCB.js} +1 -1
  70. package/dist/assets/{unsubscribe-DFPfNrme.js → unsubscribe-BE77Etc2.js} +1 -1
  71. package/dist/assets/{use-blocklet-logo-6YMz11ob.js → use-blocklet-logo-DGSQQmh2.js} +1 -1
  72. package/dist/assets/use-server-logo-BbYHFDuK.js +1 -1
  73. package/dist/assets/useAsync-BMCqtJH2.js +1 -0
  74. package/dist/assets/useAsync-CBEJDwr0.js +1 -0
  75. package/dist/assets/{user-center-BjGMsOGg.js → user-center-olJmefSX.js} +1 -1
  76. package/dist/assets/{util-BBMAZSVn.js → util-xXGeezrD.js} +1 -1
  77. package/dist/assets/{wrap-locale-378mdIBS.js → wrap-locale-Byq7otyk.js} +1 -1
  78. package/dist/index.html +1 -1
  79. package/dist/service-worker.js +1 -1
  80. package/package.json +22 -22
  81. package/dist/assets/connect-B6S3YIgF.js +0 -5
  82. package/dist/assets/domain-B8NapX5o.js +0 -9
  83. package/dist/assets/domains-DzI4bWdK.js +0 -1
  84. package/dist/assets/dot-BID2dzD_.js +0 -7
  85. package/dist/assets/setup-CQ7O7nI0.js +0 -30
  86. package/dist/assets/useAsync-B6ZHbOEG.js +0 -1
@@ -1,4 +1,4 @@
1
- import{r as P,t as yn,g as vn,e as jt,a as bn}from"./vendor-react-DEoibe3W.js";import{a9 as Ot,j as e,aa as E,bp as Fe,bs as $e,bo as We,q as je,T as Q,O as me,ab as ie,by as He,ak as oe,H as v,ah as z,e as Cn,ad as ue,w as jn,y as Nt,b8 as Sn,b9 as wn,I as Pn,bi as kn,bt as In,bS as Tn}from"./vendor-mui-core-wlbruq2I.js";import{B as St,e as ze,a0 as Dn,ay as An,n as wt,A as Rn,b as Ln}from"./vendor-utils-B3iZkn2R.js";import{r as _t,aR as Ut,bK as En,i as On,a as V,a2 as Nn,a1 as _n,a3 as Y,ar as se,B as W,f as Un,at as Bn,d as Fn,bb as fe,bB as $n,k as J,a5 as Bt,an as Wn,bs as Ft,bt as $t,bu as zn,I as Mn,ax as qn,$ as Me,bd as Hn,ac as Wt,ab as zt,bH as Vn}from"./vendor-ux-did-connect-CX7qG3_M.js";import{c as X,a as Kn,G as Mt,v as Se,n as Zn,I as Yn}from"./vendor-arcblock-B4hgrXYM.js";import{d as Gn}from"./ViewList-ColSGL1_.js";import{a2 as Qn,f as Jn,D as q,ay as we,n as pe,a3 as Xn,V as re,az as es,G as qt,aA as Ht,y as ts,b as ns,aB as ss}from"./index-DQjZ74P0.js";import{k as rs,u as Ve,a as Ke,c as os,m as is,b as as}from"./vendor-hooks-BCm626KH.js";import{l as ls}from"./index-CZgWTJXl.js";import{u as K,d as Pt,W as Vt}from"./dashboard-B7qE-Md0.js";import{W as Ze}from"./did-address-bJAfhuZx.js";import{P as ee}from"./permission-B7ZHEOJv.js";import{C as Te}from"./click-to-copy-BUVqg1RQ.js";import{T as Kt}from"./index-B4FABIlz.js";import{f as te}from"./index-8eXqqyHQ.js";import{_ as cs}from"./useAsync-B6ZHbOEG.js";import{I as M}from"./index-BnR8uU0R.js";import{d as ds}from"./DeleteOutline-1-hBNY1U.js";import{C as ge}from"./confirm-BjCmRSAF.js";import{u as he}from"./session-1k8BRnYA.js";import{i as Zt,a as Pe,p as Yt}from"./util-CS4PqVkK.js";import{b as ms}from"./sdk-BJQcHaGO.js";import{A as us}from"./actions-DtL6bYnA.js";import{S as ps}from"./shorten-label-CTSJhlwO.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BF3BqN1O.js";import"./PlayArrow-B_ZNrQDa.js";import"./get-safe-url-BWDUV79Q.js";import"./use-blocklet-logo-6YMz11ob.js";import"./InfoOutlined-CLiL5VeK.js";import"./dot-BID2dzD_.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CXU9YBvX.js";import"./vendor-mui-x-BKgL6hAa.js";import"./AdapterDayjs-BXVfASrK.js";import"./base32-CmYq1ikq.js";import"./MoreHoriz-9E3q8aHi.js";var Ye={},fs=Ot;Object.defineProperty(Ye,"__esModule",{value:!0});var Gt=Ye.default=void 0,gs=fs(_t()),hs=e;Gt=Ye.default=(0,gs.default)((0,hs.jsx)("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8m0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4z"}),"Loop");var Ge=function(t){return e.jsxs("svg",{...t,children:[e.jsx("g",{clipPath:"url(#clip0)",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.99997 1.59778C8.19071 1.59778 7.39961 1.83775 6.72673 2.28736C6.05385 2.73697 5.5294 3.37601 5.21971 4.12367C4.91001 4.87134 4.82898 5.69405 4.98686 6.48777C5.14474 7.28149 5.53444 8.01056 6.10668 8.5828C6.67892 9.15504 7.408 9.54474 8.20172 9.70262C8.99544 9.8605 9.81815 9.77947 10.5658 9.46978C11.3135 9.16009 11.9525 8.63564 12.4021 7.96276C12.8517 7.28987 13.0917 6.49878 13.0917 5.68951C13.0917 4.60432 12.6606 3.56357 11.8933 2.79622C11.1259 2.02887 10.0852 1.59778 8.99997 1.59778ZM7.27426 3.9638C7.73195 3.50611 8.35271 3.24899 8.99997 3.24899C9.48266 3.24899 9.95452 3.39212 10.3559 3.66029C10.7572 3.92846 11.07 4.30962 11.2547 4.75556C11.4394 5.20151 11.4878 5.69222 11.3936 6.16563C11.2994 6.63905 11.067 7.07391 10.7257 7.41522C10.3844 7.75654 9.94951 7.98897 9.4761 8.08314C9.00268 8.17731 8.51197 8.12898 8.06603 7.94426C7.62008 7.75954 7.23892 7.44674 6.97075 7.04539C6.70258 6.64405 6.55945 6.1722 6.55945 5.68951C6.55945 5.04224 6.81658 4.42149 7.27426 3.9638ZM7.36691 10.3075C6.28172 10.3075 5.24097 10.7385 4.47362 11.5059C3.70627 12.2732 3.27518 13.314 3.27518 14.3992V17.121C3.27518 17.2763 3.4011 17.4022 3.55643 17.4022H4.64514C4.80047 17.4022 4.92639 17.2763 4.92639 17.121V14.3992C4.92639 13.7519 5.18351 13.1312 5.6412 12.6735C6.09889 12.2158 6.71964 11.9587 7.36691 11.9587H10.633C10.9535 11.9587 11.2709 12.0218 11.567 12.1444C11.8631 12.2671 12.1321 12.4469 12.3588 12.6735C12.5854 12.9001 12.7651 13.1691 12.8878 13.4652C13.0104 13.7613 13.0736 14.0787 13.0736 14.3992V17.121C13.0736 17.2763 13.1995 17.4022 13.3548 17.4022H14.4435C14.5989 17.4022 14.7248 17.2763 14.7248 17.121V14.3992C14.7248 13.314 14.2937 12.2732 13.5263 11.5059C12.759 10.7385 11.7182 10.3075 10.633 10.3075H7.36691Z"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0",children:e.jsx("rect",{width:"18",height:"18",transform:"translate(0 0.5)"})})})]})};Ge.defaultProps={width:"18",height:"19",viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg"};Ge.displayName="person";const xs=Ge;var Qe=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M1.25 2.7087C1.25 2.24826 1.62326 1.875 2.0837 1.875H14.339C14.7995 1.875 15.1727 2.24826 15.1727 2.7087V9.31574C15.1727 9.77618 14.7995 10.1494 14.339 10.1494C13.8786 10.1494 13.5053 9.77618 13.5053 9.31574V3.54239H2.91739V16.7565H6.53772H8.34788H9.32435C9.78479 16.7565 10.158 17.1297 10.158 17.5902C10.158 18.0506 9.78479 18.4239 9.32435 18.4239H8.34788H2.0837C1.62326 18.4239 1.25 18.0506 1.25 17.5902V2.7087Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.21129 7.91935C7.70481 7.91935 7.29422 8.32993 7.29422 8.83641C7.29422 9.34289 7.70481 9.75348 8.21129 9.75348C8.71777 9.75348 9.12836 9.34289 9.12836 8.83641C9.12836 8.32993 8.71777 7.91935 8.21129 7.91935ZM5.62683 8.83641C5.62683 7.40905 6.78393 6.25195 8.21129 6.25195C9.63865 6.25195 10.7957 7.40905 10.7957 8.83641C10.7957 10.2638 9.63865 11.4209 8.21129 11.4209C6.78393 11.4209 5.62683 10.2638 5.62683 8.83641Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.62683 13.2133C5.62683 12.7529 6.00009 12.3796 6.46053 12.3796H9.96205C10.4225 12.3796 10.7957 12.7529 10.7957 13.2133C10.7957 13.6737 10.4225 14.047 9.96205 14.047H6.46053C6.00009 14.047 5.62683 13.6737 5.62683 13.2133Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6406 11.3125C15.8547 11.3125 16.0503 11.434 16.145 11.626L17.1779 13.7184L19.4876 14.056C19.6994 14.087 19.8753 14.2355 19.9413 14.4391C20.0074 14.6427 19.9521 14.8662 19.7987 15.0156L18.1279 16.643L18.5222 18.9421C18.5584 19.1532 18.4716 19.3665 18.2984 19.4923C18.1252 19.6182 17.8955 19.6347 17.706 19.5351L15.6406 18.4489L13.5753 19.5351C13.3858 19.6347 13.1561 19.6182 12.9829 19.4923C12.8096 19.3665 12.7229 19.1532 12.7591 18.9421L13.1534 16.643L11.4825 15.0156C11.3292 14.8662 11.2739 14.6427 11.3399 14.4391C11.406 14.2355 11.5818 14.087 11.7937 14.056L14.1034 13.7184L15.1362 11.626C15.231 11.434 15.4265 11.3125 15.6406 11.3125ZM15.6406 13.1458L14.9815 14.4813C14.8996 14.6471 14.7414 14.7621 14.5584 14.7889L13.0835 15.0044L14.1503 16.0435C14.283 16.1727 14.3435 16.359 14.3122 16.5416L14.0606 18.0088L15.3788 17.3155C15.5427 17.2293 15.7386 17.2293 15.9025 17.3155L17.2207 18.0088L16.969 16.5416C16.9377 16.359 16.9983 16.1727 17.131 16.0435L18.1978 15.0044L16.7229 14.7889C16.5399 14.7621 16.3817 14.6471 16.2998 14.4813L15.6406 13.1458Z"})]})};Qe.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};Qe.displayName="external-issuer";const Qt=Qe;var Ce={},ys=t=>encodeURIComponent(t).replace(/[!'()*]/g,o=>`%${o.charCodeAt(0).toString(16).toUpperCase()}`),Jt="%[a-f0-9]{2}",kt=new RegExp("("+Jt+")|([^%]+?)","gi"),It=new RegExp("("+Jt+")+","gi");function qe(t,o){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;o=o||1;var c=t.slice(0,o),u=t.slice(o);return Array.prototype.concat.call([],qe(c),qe(u))}function vs(t){try{return decodeURIComponent(t)}catch{for(var o=t.match(kt)||[],c=1;c<o.length;c++)t=qe(o,c).join(""),o=t.match(kt)||[];return t}}function bs(t){for(var o={"%FE%FF":"��","%FF%FE":"��"},c=It.exec(t);c;){try{o[c[0]]=decodeURIComponent(c[0])}catch{var u=vs(c[0]);u!==c[0]&&(o[c[0]]=u)}c=It.exec(t)}o["%C2"]="�";for(var d=Object.keys(o),h=0;h<d.length;h++){var S=d[h];t=t.replace(new RegExp(S,"g"),o[S])}return t}var Cs=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return bs(t)}},js=(t,o)=>{if(!(typeof t=="string"&&typeof o=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(o==="")return[t];const c=t.indexOf(o);return c===-1?[t]:[t.slice(0,c),t.slice(c+o.length)]},Ss=function(t,o){for(var c={},u=Object.keys(t),d=Array.isArray(o),h=0;h<u.length;h++){var S=u[h],p=t[S];(d?o.indexOf(S)!==-1:o(S,p,t))&&(c[S]=p)}return c};(function(t){const o=ys,c=Cs,u=js,d=Ss,h=n=>n==null;function S(n){switch(n.arrayFormat){case"index":return s=>(l,r)=>{const x=l.length;return r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,[g(s,n),"[",x,"]"].join("")]:[...l,[g(s,n),"[",g(x,n),"]=",g(r,n)].join("")]};case"bracket":return s=>(l,r)=>r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,[g(s,n),"[]"].join("")]:[...l,[g(s,n),"[]=",g(r,n)].join("")];case"comma":case"separator":return s=>(l,r)=>r==null||r.length===0?l:l.length===0?[[g(s,n),"=",g(r,n)].join("")]:[[l,g(r,n)].join(n.arrayFormatSeparator)];default:return s=>(l,r)=>r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,g(s,n)]:[...l,[g(s,n),"=",g(r,n)].join("")]}}function p(n){let s;switch(n.arrayFormat){case"index":return(l,r,x)=>{if(s=/\[(\d*)\]$/.exec(l),l=l.replace(/\[\d*\]$/,""),!s){x[l]=r;return}x[l]===void 0&&(x[l]={}),x[l][s[1]]=r};case"bracket":return(l,r,x)=>{if(s=/(\[\])$/.exec(l),l=l.replace(/\[\]$/,""),!s){x[l]=r;return}if(x[l]===void 0){x[l]=[r];return}x[l]=[].concat(x[l],r)};case"comma":case"separator":return(l,r,x)=>{const y=typeof r=="string"&&r.includes(n.arrayFormatSeparator),w=typeof r=="string"&&!y&&i(r,n).includes(n.arrayFormatSeparator);r=w?i(r,n):r;const _=y||w?r.split(n.arrayFormatSeparator).map(F=>i(F,n)):r===null?r:i(r,n);x[l]=_};default:return(l,r,x)=>{if(x[l]===void 0){x[l]=r;return}x[l]=[].concat(x[l],r)}}}function b(n){if(typeof n!="string"||n.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function g(n,s){return s.encode?s.strict?o(n):encodeURIComponent(n):n}function i(n,s){return s.decode?c(n):n}function T(n){return Array.isArray(n)?n.sort():typeof n=="object"?T(Object.keys(n)).sort((s,l)=>Number(s)-Number(l)).map(s=>n[s]):n}function C(n){const s=n.indexOf("#");return s!==-1&&(n=n.slice(0,s)),n}function k(n){let s="";const l=n.indexOf("#");return l!==-1&&(s=n.slice(l)),s}function a(n){n=C(n);const s=n.indexOf("?");return s===-1?"":n.slice(s+1)}function I(n,s){return s.parseNumbers&&!Number.isNaN(Number(n))&&typeof n=="string"&&n.trim()!==""?n=Number(n):s.parseBooleans&&n!==null&&(n.toLowerCase()==="true"||n.toLowerCase()==="false")&&(n=n.toLowerCase()==="true"),n}function m(n,s){s=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},s),b(s.arrayFormatSeparator);const l=p(s),r=Object.create(null);if(typeof n!="string"||(n=n.trim().replace(/^[?#&]/,""),!n))return r;for(const x of n.split("&")){if(x==="")continue;let[y,w]=u(s.decode?x.replace(/\+/g," "):x,"=");w=w===void 0?null:["comma","separator"].includes(s.arrayFormat)?w:i(w,s),l(i(y,s),w,r)}for(const x of Object.keys(r)){const y=r[x];if(typeof y=="object"&&y!==null)for(const w of Object.keys(y))y[w]=I(y[w],s);else r[x]=I(y,s)}return s.sort===!1?r:(s.sort===!0?Object.keys(r).sort():Object.keys(r).sort(s.sort)).reduce((x,y)=>{const w=r[y];return w&&typeof w=="object"&&!Array.isArray(w)?x[y]=T(w):x[y]=w,x},Object.create(null))}t.extract=a,t.parse=m,t.stringify=(n,s)=>{if(!n)return"";s=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},s),b(s.arrayFormatSeparator);const l=w=>s.skipNull&&h(n[w])||s.skipEmptyString&&n[w]==="",r=S(s),x={};for(const w of Object.keys(n))l(w)||(x[w]=n[w]);const y=Object.keys(x);return s.sort!==!1&&y.sort(s.sort),y.map(w=>{const _=n[w];return _===void 0?"":_===null?g(w,s):Array.isArray(_)?_.reduce(r(w),[]).join("&"):g(w,s)+"="+g(_,s)}).filter(w=>w.length>0).join("&")},t.parseUrl=(n,s)=>{s=Object.assign({decode:!0},s);const[l,r]=u(n,"#");return Object.assign({url:l.split("?")[0]||"",query:m(a(n),s)},s&&s.parseFragmentIdentifier&&r?{fragmentIdentifier:i(r,s)}:{})},t.stringifyUrl=(n,s)=>{s=Object.assign({encode:!0,strict:!0},s);const l=C(n.url).split("?")[0]||"",r=t.extract(n.url),x=t.parse(r,{sort:!1}),y=Object.assign(x,n.query);let w=t.stringify(y,s);w&&(w=`?${w}`);let _=k(n.url);return n.fragmentIdentifier&&(_=`#${g(n.fragmentIdentifier,s)}`),`${l}${w}${_}`},t.pick=(n,s,l)=>{l=Object.assign({parseFragmentIdentifier:!0},l);const{url:r,query:x,fragmentIdentifier:y}=t.parseUrl(n,l);return t.stringifyUrl({url:r,query:d(x,s),fragmentIdentifier:y},l)},t.exclude=(n,s,l)=>{const r=Array.isArray(s)?x=>!s.includes(x):(x,y)=>!s(x,y);return t.pick(n,r,l)}})(Ce);const le=yn,ws={parseNumbers:!1,parseBooleans:!1},Ps={skipNull:!1,skipEmptyString:!1},ks=(t,o)=>{var c,u;const{navigateMode:d="push",parseOptions:h,stringifyOptions:S}={},p=Object.assign(Object.assign({},ws),h),b=Object.assign(Object.assign({},Ps),S),g=le.useLocation(),i=(c=le.useHistory)===null||c===void 0?void 0:c.call(le),T=(u=le.useNavigate)===null||u===void 0?void 0:u.call(le),C=rs(),k=P.useRef(typeof t=="function"?t():t||{}),a=P.useMemo(()=>Ce.parse(g.search,p),[g.search]),I=P.useMemo(()=>Object.assign(Object.assign({},k.current),a),[a]);return[I,Ve(n=>{const s=typeof n=="function"?n(I):n;C(),i&&i[d]({hash:g.hash,search:Ce.stringify(Object.assign(Object.assign({},a),s),b)||"?"},g.state),T&&T({hash:g.hash,search:Ce.stringify(Object.assign(Object.assign({},a),s),b)||"?"},{replace:d==="replace",state:g.state})})]},Is=ks,Ts=Ut,_e=En,Ue=On,Ds=ls,Tt={role:Ts.types.RoleType.ROLE_APPLICATION},As=(t,o,c,u)=>{let d=c||Tt;const h=(0,Ue.isEthereumType)((0,Ue.DidType)(c));if(h?d=(0,_e.WalletType)(c):d=(0,_e.WalletType)(Tt),!(0,Ue.isValid)(t)){let S="";try{return h?S=t.slice(0,66):S=t,(0,_e.fromSecretKey)(S,d)}catch(p){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${p.message}`)}}if(!o)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,Ds.fromAppDid)(t,o,d,u||0)};var Rs=As,Xt=jt&&jt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const ce=Xt(Qn),Ls=Ut,ve=Xt(Rs),Es=Jn,Os=(t,o,{returnWallet:c=!0}={})=>{var F,R;if(!t||typeof t!="object"||!Array.isArray(t.environments)||!(0,ce.default)(t,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:u,configs:d=[]}=t,h=[...d,...u],S=h.find(D=>D.key==="BLOCKLET_APP_DESCRIPTION"),p=h.find(D=>D.key==="BLOCKLET_PASSPORT_COLOR"),b=h.find(D=>D.key==="BLOCKLET_APP_URL"),g=h.find(D=>D.key==="BLOCKLET_APP_TENANT_MODE"),{did:i,version:T}=t.meta,C=(0,Es.getDisplayName)(t),k=(0,ce.default)(S,"value",t.meta.description),a=(0,ce.default)(p,"value","auto"),I=(0,ce.default)(b,"value",""),m=(0,ce.default)(g,"value","");if(!c)return{did:i,version:T,name:C,description:k,passportColor:a,appUrl:I,secret:"",wallet:null,permanentWallet:null,tenantMode:m};const n=h.find(D=>D.key==="BLOCKLET_APP_SK"),s=h.find(D=>D.key==="BLOCKLET_APP_CHAIN_TYPE")||h.find(D=>D.key==="BLOCKLET_WALLET_TYPE"),l=h.find(D=>D.key==="BLOCKLET_APP_PSK");let r;s&&(s.value==="ethereum"||s.value==="eth")&&(r=s.value);let x=null,y=null;if(n&&n.value)x=(0,ve.default)(n.value,void 0,r),l&&l.value&&l.value!==n.value&&(y=(0,ve.default)(l.value,void 0,r));else{if(!o||typeof o!="string")throw new Error("Node secret key must be a string");s?x=(0,ve.default)(t.meta.did,o,r):x=(0,ve.default)(t.meta.did,o)}const w=((R=(F=t.settings)==null?void 0:F.session)==null?void 0:R.salt)||"",_=Ls.Hasher.SHA3.hash256(St.concat([x.secretKey,x.address,w].filter(Boolean).map(D=>St.from(D))));return{did:i,version:T,name:C,description:k,passportColor:a,appUrl:I,secret:_,wallet:x,permanentWallet:y||x,tenantMode:m}};var Ns=Os;const _s=vn(Ns);function Je({teamDid:t,roles:o,apps:c,onCancel:u,onSuccess:d,onError:h,endpoint:S}){var I;const{api:p}=q(),{t:b,locale:g}=V(),i=Ke({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:c.length>0?c[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),T=async()=>{if(!i.role){i.error=b("team.member.error.passportEmpty");return}const m=i.remark.trim();i.error=null,i.loading=!0;try{let n=i.sourceAppPid??null;n===t&&(n=null);const s={teamDid:t,role:i.role,remark:m,sourceAppPid:n,passportExpireTime:i.passportExpireTime?i.passportExpireTime.toISOString():""};i.display&&(s.display={type:"url",content:i.display});const{inviteInfo:l}=await p.createMemberInvitation({input:s});i.inviteInfo=l,i.activeStep=1}catch(n){const s=te(n);i.error=s,h(n)}finally{i.loading=!1}},C=o.find(m=>m.name===i.role),a=[{body:e.jsxs(E,{sx:{display:"flex",flexDirection:"column",gap:3},children:[c.length>1?e.jsxs(Fe,{fullWidth:!0,children:[e.jsx($e,{children:b("common.sourceApp")}),e.jsx(We,{value:i.sourceAppPid,onChange:m=>{i.error=null,i.sourceAppPid=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:i.loading,children:c.map(m=>e.jsx(je,{value:m.appPid,children:e.jsxs(E,{sx:{display:"flex",justifyContent:"space-between",gap:2,width:"100%"},children:[e.jsxs(E,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Nn,{did:m.appPid,size:28}),m.appName]}),e.jsx(_n,{did:m.appPid,compact:!0,responsive:!1})]})},m.appPid))})]}):null,e.jsxs(Fe,{fullWidth:!0,variant:"outlined",children:[e.jsx($e,{children:b("common.passport")}),e.jsx(We,{"data-cy":"invite-member-select-role",value:i.role,onChange:m=>{i.error=null,i.role=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:i.loading,onKeyPress:m=>{m.key==="Enter"&&(m.preventDefault(),T())},children:o.filter(m=>m.name!=="owner").map(m=>e.jsx(je,{value:m.name,"data-cy":`invite-member-select-option-${m.name}`,children:e.jsxs(E,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(Q,{variant:"subtitle1",children:m.title||m.name}),e.jsx(Q,{variant:"caption",sx:{opacity:.7},children:m.description})]})},m.name))})]}),((I=C==null?void 0:C.extra)==null?void 0:I.display)==="custom"&&e.jsx(me,{label:b("common.display"),type:"url",value:i.display,onChange:m=>{i.error=null,i.display=m.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(me,{label:b("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.remark,onChange:m=>{i.error=null,i.remark=m.target.value},disabled:i.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Kt,{value:i.passportExpireTime,onChange:m=>{i.passportExpireTime=m}})]}),cancel:b("common.cancel"),confirm:b("team.member.inviteDialog.createInviteLink"),onCancel:u,onConfirm:T},{body:()=>{var n,s;const m=we({inviteId:(n=i.inviteInfo)==null?void 0:n.inviteId,endpoint:S});return e.jsxs("div",{children:[e.jsx(E,{sx:{fontSize:16,fontWeight:"bold"},children:b("team.member.inviteDialog.createSuccessTip",{expireDate:pe((s=i.inviteInfo)==null?void 0:s.expireDate,g)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Te,{children:m})]})},confirm:b("common.copy"),onConfirm:()=>{var n;const m=we({inviteId:(n=i.inviteInfo)==null?void 0:n.inviteId,endpoint:S});os(m),Y.success(b("common.copied")),d()},cancel:b("common.cancel"),onCancel:u}][i.activeStep];return e.jsxs(se,{title:b("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[a.cancel&&e.jsx(W,{onClick:a.onCancel,color:"inherit",children:a.cancel}),e.jsxs(W,{onClick:a.onConfirm,color:"primary",disabled:i.loading||!i.role,variant:"contained",autoFocus:!0,children:[i.loading&&e.jsx(ie,{size:16}),a.confirm]})]}),children:[e.jsx(He,{component:"div",children:typeof a.body=="function"?a.body():a.body}),!!i.error&&e.jsx(oe,{severity:"error",variant:"icon",children:i.error})]})}Je.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,roles:v.array,apps:v.array,endpoint:v.string};Je.defaultProps={onError:()=>{},roles:[],apps:[],endpoint:""};function Xe({teamDid:t,onCancel:o,onSuccess:c,onError:u,endpoint:d}){const{api:h,info:S}=q(),{api:p}=P.useContext(Un),[b,g]=P.useState(!1),{t:i,locale:T}=V(),[C,k]=P.useState(""),[a,I]=P.useState(!1),[m,n]=P.useState(0),[s,l]=P.useState(""),[r,x]=P.useState(""),y=!!ze(S,"ownerNft.did"),w=cs(async()=>{if(y){const{state:A}=await h.getDelegationState();return A}return{delegated:!0}});if(w.loading)return e.jsx(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:o,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(ie,{})})});if(w.error)return e.jsx(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:o,children:e.jsx(oe,{severity:"error",variant:"icon",children:te(w.error)})});const _=async()=>{k(null),g(!0);try{const{inviteInfo:A}=await h.createTransferInvitation({input:{teamDid:t,role:"owner",remark:r.trim()}});l(A),n(D.length-1)}catch(A){const H=te(A);k(H),u(A)}finally{g(!1)}},F=()=>{I(!0),n(1)},R=()=>{I(!1),n(0)},D=[{body:e.jsxs(Q,{component:"div",children:[e.jsxs(oe,{severity:"warning",children:[e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.progress")}),e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(oe,{severity:"warning",children:e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(me,{label:i("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:r,onChange:A=>{k(null),x(A.target.value)},disabled:b,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:i("common.cancel"),confirm:i("team.transferNode.inviteDialog.createInviteLink"),onCancel:o,onConfirm:y&&!ze(w,"value.delegated")?F:_},{body:()=>e.jsx(Bn,{action:"delegate-transfer-nft",open:a,locale:T,checkFn:p.get,onClose:R,onSuccess:_,checkTimeout:5*60*1e3,webWalletUrl:Xn(S),extraParams:{targetDID:S.did},messages:{title:i("team.transferNode.delegateDialog.title"),scan:i("team.transferNode.delegateDialog.scan"),confirm:i("team.transferNode.delegateDialog.confirm"),success:i("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const A=we({inviteId:s.inviteId,endpoint:d});return e.jsxs("div",{children:[e.jsx(Us,{children:i("team.transferNode.inviteDialog.createSuccessTip",{expireDate:pe(s.expireDate,T)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Te,{children:A})]})},confirm:i("common.confirm"),onConfirm:c}],O=D[m];return e.jsxs(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[O.cancel&&e.jsx(W,{onClick:O.onCancel,color:"inherit",children:O.cancel}),e.jsxs(W,{onClick:O.onConfirm,color:"primary",disabled:b,variant:"contained",autoFocus:!0,children:[b&&e.jsx(ie,{size:16}),O.confirm]})]}),children:[e.jsx(He,{component:"div",children:typeof O.body=="function"?O.body():O.body}),!!C&&e.jsx(oe,{severity:"error",variant:"icon",children:C})]})}Xe.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,endpoint:v.string};Xe.defaultProps={onError:()=>{},endpoint:""};const Us=z.div`
1
+ import{r as P,t as yn,g as vn,e as jt,a as bn}from"./vendor-react-DEoibe3W.js";import{a9 as Ot,j as e,aa as E,bp as Fe,bs as $e,bo as We,q as je,T as Q,O as me,ab as ie,by as He,ak as oe,H as v,ah as z,e as Cn,ad as ue,w as jn,y as Nt,b8 as Sn,b9 as wn,I as Pn,bi as kn,bt as In,bS as Tn}from"./vendor-mui-core-wlbruq2I.js";import{B as St,e as ze,a0 as Dn,ay as An,n as wt,A as Rn,b as Ln}from"./vendor-utils-B3iZkn2R.js";import{r as Ut,aR as _t,bK as En,i as On,a as V,a2 as Nn,a1 as Un,a3 as Y,ar as se,B as W,f as _n,at as Bn,d as Fn,bb as fe,bB as $n,k as J,a5 as Bt,an as Wn,bs as Ft,bt as $t,bu as zn,I as Mn,ax as qn,$ as Me,bd as Hn,ac as Wt,ab as zt,bH as Vn}from"./vendor-ux-did-connect-CX7qG3_M.js";import{c as X,a as Kn,G as Mt,v as Se,n as Zn,I as Yn}from"./vendor-arcblock-B4hgrXYM.js";import{d as Gn}from"./ViewList-ColSGL1_.js";import{a2 as Qn,f as Jn,D as q,ay as we,n as pe,a3 as Xn,V as re,az as es,G as qt,aA as Ht,y as ts,b as ns,aB as ss}from"./index-B18R5SlV.js";import{k as rs,u as Ve,a as Ke,c as os,m as is,b as as}from"./vendor-hooks-BCm626KH.js";import{l as ls}from"./index-CZgWTJXl.js";import{u as K,d as Pt,W as Vt}from"./dashboard-k0XcV2m5.js";import{W as Ze}from"./did-address-bJAfhuZx.js";import{P as ee}from"./permission-B7ZHEOJv.js";import{C as Te}from"./click-to-copy-BUVqg1RQ.js";import{T as Kt}from"./index-DO-a7P7z.js";import{f as te}from"./index-8eXqqyHQ.js";import{u as cs}from"./useAsync-CBEJDwr0.js";import{I as M}from"./index-BnR8uU0R.js";import{d as ds}from"./DeleteOutline-1-hBNY1U.js";import{C as ge}from"./confirm-Bay3BcpN.js";import{u as he}from"./session-1k8BRnYA.js";import{i as Zt,a as Pe,p as Yt}from"./util-CS4PqVkK.js";import{b as ms}from"./sdk-BJQcHaGO.js";import{A as us}from"./actions-DtL6bYnA.js";import{S as ps}from"./shorten-label-CTSJhlwO.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BF3BqN1O.js";import"./PlayArrow-B_ZNrQDa.js";import"./get-safe-url-CwT4-jkw.js";import"./use-blocklet-logo-DGSQQmh2.js";import"./InfoOutlined-CLiL5VeK.js";import"./dot-DR7_m3Np.js";import"./useAsync-BMCqtJH2.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CiFFAdJf.js";import"./vendor-mui-x-BKgL6hAa.js";import"./AdapterDayjs-BXVfASrK.js";import"./base32-CmYq1ikq.js";import"./MoreHoriz-9E3q8aHi.js";var Ye={},fs=Ot;Object.defineProperty(Ye,"__esModule",{value:!0});var Gt=Ye.default=void 0,gs=fs(Ut()),hs=e;Gt=Ye.default=(0,gs.default)((0,hs.jsx)("path",{d:"M12 4V1L8 5l4 4V6c3.31 0 6 2.69 6 6 0 1.01-.25 1.97-.7 2.8l1.46 1.46C19.54 15.03 20 13.57 20 12c0-4.42-3.58-8-8-8m0 14c-3.31 0-6-2.69-6-6 0-1.01.25-1.97.7-2.8L5.24 7.74C4.46 8.97 4 10.43 4 12c0 4.42 3.58 8 8 8v3l4-4-4-4z"}),"Loop");var Ge=function(t){return e.jsxs("svg",{...t,children:[e.jsx("g",{clipPath:"url(#clip0)",children:e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.99997 1.59778C8.19071 1.59778 7.39961 1.83775 6.72673 2.28736C6.05385 2.73697 5.5294 3.37601 5.21971 4.12367C4.91001 4.87134 4.82898 5.69405 4.98686 6.48777C5.14474 7.28149 5.53444 8.01056 6.10668 8.5828C6.67892 9.15504 7.408 9.54474 8.20172 9.70262C8.99544 9.8605 9.81815 9.77947 10.5658 9.46978C11.3135 9.16009 11.9525 8.63564 12.4021 7.96276C12.8517 7.28987 13.0917 6.49878 13.0917 5.68951C13.0917 4.60432 12.6606 3.56357 11.8933 2.79622C11.1259 2.02887 10.0852 1.59778 8.99997 1.59778ZM7.27426 3.9638C7.73195 3.50611 8.35271 3.24899 8.99997 3.24899C9.48266 3.24899 9.95452 3.39212 10.3559 3.66029C10.7572 3.92846 11.07 4.30962 11.2547 4.75556C11.4394 5.20151 11.4878 5.69222 11.3936 6.16563C11.2994 6.63905 11.067 7.07391 10.7257 7.41522C10.3844 7.75654 9.94951 7.98897 9.4761 8.08314C9.00268 8.17731 8.51197 8.12898 8.06603 7.94426C7.62008 7.75954 7.23892 7.44674 6.97075 7.04539C6.70258 6.64405 6.55945 6.1722 6.55945 5.68951C6.55945 5.04224 6.81658 4.42149 7.27426 3.9638ZM7.36691 10.3075C6.28172 10.3075 5.24097 10.7385 4.47362 11.5059C3.70627 12.2732 3.27518 13.314 3.27518 14.3992V17.121C3.27518 17.2763 3.4011 17.4022 3.55643 17.4022H4.64514C4.80047 17.4022 4.92639 17.2763 4.92639 17.121V14.3992C4.92639 13.7519 5.18351 13.1312 5.6412 12.6735C6.09889 12.2158 6.71964 11.9587 7.36691 11.9587H10.633C10.9535 11.9587 11.2709 12.0218 11.567 12.1444C11.8631 12.2671 12.1321 12.4469 12.3588 12.6735C12.5854 12.9001 12.7651 13.1691 12.8878 13.4652C13.0104 13.7613 13.0736 14.0787 13.0736 14.3992V17.121C13.0736 17.2763 13.1995 17.4022 13.3548 17.4022H14.4435C14.5989 17.4022 14.7248 17.2763 14.7248 17.121V14.3992C14.7248 13.314 14.2937 12.2732 13.5263 11.5059C12.759 10.7385 11.7182 10.3075 10.633 10.3075H7.36691Z"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"clip0",children:e.jsx("rect",{width:"18",height:"18",transform:"translate(0 0.5)"})})})]})};Ge.defaultProps={width:"18",height:"19",viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg"};Ge.displayName="person";const xs=Ge;var Qe=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{d:"M1.25 2.7087C1.25 2.24826 1.62326 1.875 2.0837 1.875H14.339C14.7995 1.875 15.1727 2.24826 15.1727 2.7087V9.31574C15.1727 9.77618 14.7995 10.1494 14.339 10.1494C13.8786 10.1494 13.5053 9.77618 13.5053 9.31574V3.54239H2.91739V16.7565H6.53772H8.34788H9.32435C9.78479 16.7565 10.158 17.1297 10.158 17.5902C10.158 18.0506 9.78479 18.4239 9.32435 18.4239H8.34788H2.0837C1.62326 18.4239 1.25 18.0506 1.25 17.5902V2.7087Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.21129 7.91935C7.70481 7.91935 7.29422 8.32993 7.29422 8.83641C7.29422 9.34289 7.70481 9.75348 8.21129 9.75348C8.71777 9.75348 9.12836 9.34289 9.12836 8.83641C9.12836 8.32993 8.71777 7.91935 8.21129 7.91935ZM5.62683 8.83641C5.62683 7.40905 6.78393 6.25195 8.21129 6.25195C9.63865 6.25195 10.7957 7.40905 10.7957 8.83641C10.7957 10.2638 9.63865 11.4209 8.21129 11.4209C6.78393 11.4209 5.62683 10.2638 5.62683 8.83641Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.62683 13.2133C5.62683 12.7529 6.00009 12.3796 6.46053 12.3796H9.96205C10.4225 12.3796 10.7957 12.7529 10.7957 13.2133C10.7957 13.6737 10.4225 14.047 9.96205 14.047H6.46053C6.00009 14.047 5.62683 13.6737 5.62683 13.2133Z"}),e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6406 11.3125C15.8547 11.3125 16.0503 11.434 16.145 11.626L17.1779 13.7184L19.4876 14.056C19.6994 14.087 19.8753 14.2355 19.9413 14.4391C20.0074 14.6427 19.9521 14.8662 19.7987 15.0156L18.1279 16.643L18.5222 18.9421C18.5584 19.1532 18.4716 19.3665 18.2984 19.4923C18.1252 19.6182 17.8955 19.6347 17.706 19.5351L15.6406 18.4489L13.5753 19.5351C13.3858 19.6347 13.1561 19.6182 12.9829 19.4923C12.8096 19.3665 12.7229 19.1532 12.7591 18.9421L13.1534 16.643L11.4825 15.0156C11.3292 14.8662 11.2739 14.6427 11.3399 14.4391C11.406 14.2355 11.5818 14.087 11.7937 14.056L14.1034 13.7184L15.1362 11.626C15.231 11.434 15.4265 11.3125 15.6406 11.3125ZM15.6406 13.1458L14.9815 14.4813C14.8996 14.6471 14.7414 14.7621 14.5584 14.7889L13.0835 15.0044L14.1503 16.0435C14.283 16.1727 14.3435 16.359 14.3122 16.5416L14.0606 18.0088L15.3788 17.3155C15.5427 17.2293 15.7386 17.2293 15.9025 17.3155L17.2207 18.0088L16.969 16.5416C16.9377 16.359 16.9983 16.1727 17.131 16.0435L18.1978 15.0044L16.7229 14.7889C16.5399 14.7621 16.3817 14.6471 16.2998 14.4813L15.6406 13.1458Z"})]})};Qe.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};Qe.displayName="external-issuer";const Qt=Qe;var Ce={},ys=t=>encodeURIComponent(t).replace(/[!'()*]/g,o=>`%${o.charCodeAt(0).toString(16).toUpperCase()}`),Jt="%[a-f0-9]{2}",kt=new RegExp("("+Jt+")|([^%]+?)","gi"),It=new RegExp("("+Jt+")+","gi");function qe(t,o){try{return[decodeURIComponent(t.join(""))]}catch{}if(t.length===1)return t;o=o||1;var c=t.slice(0,o),u=t.slice(o);return Array.prototype.concat.call([],qe(c),qe(u))}function vs(t){try{return decodeURIComponent(t)}catch{for(var o=t.match(kt)||[],c=1;c<o.length;c++)t=qe(o,c).join(""),o=t.match(kt)||[];return t}}function bs(t){for(var o={"%FE%FF":"��","%FF%FE":"��"},c=It.exec(t);c;){try{o[c[0]]=decodeURIComponent(c[0])}catch{var u=vs(c[0]);u!==c[0]&&(o[c[0]]=u)}c=It.exec(t)}o["%C2"]="�";for(var d=Object.keys(o),h=0;h<d.length;h++){var S=d[h];t=t.replace(new RegExp(S,"g"),o[S])}return t}var Cs=function(t){if(typeof t!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof t+"`");try{return t=t.replace(/\+/g," "),decodeURIComponent(t)}catch{return bs(t)}},js=(t,o)=>{if(!(typeof t=="string"&&typeof o=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(o==="")return[t];const c=t.indexOf(o);return c===-1?[t]:[t.slice(0,c),t.slice(c+o.length)]},Ss=function(t,o){for(var c={},u=Object.keys(t),d=Array.isArray(o),h=0;h<u.length;h++){var S=u[h],p=t[S];(d?o.indexOf(S)!==-1:o(S,p,t))&&(c[S]=p)}return c};(function(t){const o=ys,c=Cs,u=js,d=Ss,h=n=>n==null;function S(n){switch(n.arrayFormat){case"index":return s=>(l,r)=>{const x=l.length;return r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,[g(s,n),"[",x,"]"].join("")]:[...l,[g(s,n),"[",g(x,n),"]=",g(r,n)].join("")]};case"bracket":return s=>(l,r)=>r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,[g(s,n),"[]"].join("")]:[...l,[g(s,n),"[]=",g(r,n)].join("")];case"comma":case"separator":return s=>(l,r)=>r==null||r.length===0?l:l.length===0?[[g(s,n),"=",g(r,n)].join("")]:[[l,g(r,n)].join(n.arrayFormatSeparator)];default:return s=>(l,r)=>r===void 0||n.skipNull&&r===null||n.skipEmptyString&&r===""?l:r===null?[...l,g(s,n)]:[...l,[g(s,n),"=",g(r,n)].join("")]}}function p(n){let s;switch(n.arrayFormat){case"index":return(l,r,x)=>{if(s=/\[(\d*)\]$/.exec(l),l=l.replace(/\[\d*\]$/,""),!s){x[l]=r;return}x[l]===void 0&&(x[l]={}),x[l][s[1]]=r};case"bracket":return(l,r,x)=>{if(s=/(\[\])$/.exec(l),l=l.replace(/\[\]$/,""),!s){x[l]=r;return}if(x[l]===void 0){x[l]=[r];return}x[l]=[].concat(x[l],r)};case"comma":case"separator":return(l,r,x)=>{const y=typeof r=="string"&&r.includes(n.arrayFormatSeparator),w=typeof r=="string"&&!y&&i(r,n).includes(n.arrayFormatSeparator);r=w?i(r,n):r;const U=y||w?r.split(n.arrayFormatSeparator).map(F=>i(F,n)):r===null?r:i(r,n);x[l]=U};default:return(l,r,x)=>{if(x[l]===void 0){x[l]=r;return}x[l]=[].concat(x[l],r)}}}function b(n){if(typeof n!="string"||n.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function g(n,s){return s.encode?s.strict?o(n):encodeURIComponent(n):n}function i(n,s){return s.decode?c(n):n}function T(n){return Array.isArray(n)?n.sort():typeof n=="object"?T(Object.keys(n)).sort((s,l)=>Number(s)-Number(l)).map(s=>n[s]):n}function C(n){const s=n.indexOf("#");return s!==-1&&(n=n.slice(0,s)),n}function k(n){let s="";const l=n.indexOf("#");return l!==-1&&(s=n.slice(l)),s}function a(n){n=C(n);const s=n.indexOf("?");return s===-1?"":n.slice(s+1)}function I(n,s){return s.parseNumbers&&!Number.isNaN(Number(n))&&typeof n=="string"&&n.trim()!==""?n=Number(n):s.parseBooleans&&n!==null&&(n.toLowerCase()==="true"||n.toLowerCase()==="false")&&(n=n.toLowerCase()==="true"),n}function m(n,s){s=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},s),b(s.arrayFormatSeparator);const l=p(s),r=Object.create(null);if(typeof n!="string"||(n=n.trim().replace(/^[?#&]/,""),!n))return r;for(const x of n.split("&")){if(x==="")continue;let[y,w]=u(s.decode?x.replace(/\+/g," "):x,"=");w=w===void 0?null:["comma","separator"].includes(s.arrayFormat)?w:i(w,s),l(i(y,s),w,r)}for(const x of Object.keys(r)){const y=r[x];if(typeof y=="object"&&y!==null)for(const w of Object.keys(y))y[w]=I(y[w],s);else r[x]=I(y,s)}return s.sort===!1?r:(s.sort===!0?Object.keys(r).sort():Object.keys(r).sort(s.sort)).reduce((x,y)=>{const w=r[y];return w&&typeof w=="object"&&!Array.isArray(w)?x[y]=T(w):x[y]=w,x},Object.create(null))}t.extract=a,t.parse=m,t.stringify=(n,s)=>{if(!n)return"";s=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},s),b(s.arrayFormatSeparator);const l=w=>s.skipNull&&h(n[w])||s.skipEmptyString&&n[w]==="",r=S(s),x={};for(const w of Object.keys(n))l(w)||(x[w]=n[w]);const y=Object.keys(x);return s.sort!==!1&&y.sort(s.sort),y.map(w=>{const U=n[w];return U===void 0?"":U===null?g(w,s):Array.isArray(U)?U.reduce(r(w),[]).join("&"):g(w,s)+"="+g(U,s)}).filter(w=>w.length>0).join("&")},t.parseUrl=(n,s)=>{s=Object.assign({decode:!0},s);const[l,r]=u(n,"#");return Object.assign({url:l.split("?")[0]||"",query:m(a(n),s)},s&&s.parseFragmentIdentifier&&r?{fragmentIdentifier:i(r,s)}:{})},t.stringifyUrl=(n,s)=>{s=Object.assign({encode:!0,strict:!0},s);const l=C(n.url).split("?")[0]||"",r=t.extract(n.url),x=t.parse(r,{sort:!1}),y=Object.assign(x,n.query);let w=t.stringify(y,s);w&&(w=`?${w}`);let U=k(n.url);return n.fragmentIdentifier&&(U=`#${g(n.fragmentIdentifier,s)}`),`${l}${w}${U}`},t.pick=(n,s,l)=>{l=Object.assign({parseFragmentIdentifier:!0},l);const{url:r,query:x,fragmentIdentifier:y}=t.parseUrl(n,l);return t.stringifyUrl({url:r,query:d(x,s),fragmentIdentifier:y},l)},t.exclude=(n,s,l)=>{const r=Array.isArray(s)?x=>!s.includes(x):(x,y)=>!s(x,y);return t.pick(n,r,l)}})(Ce);const le=yn,ws={parseNumbers:!1,parseBooleans:!1},Ps={skipNull:!1,skipEmptyString:!1},ks=(t,o)=>{var c,u;const{navigateMode:d="push",parseOptions:h,stringifyOptions:S}={},p=Object.assign(Object.assign({},ws),h),b=Object.assign(Object.assign({},Ps),S),g=le.useLocation(),i=(c=le.useHistory)===null||c===void 0?void 0:c.call(le),T=(u=le.useNavigate)===null||u===void 0?void 0:u.call(le),C=rs(),k=P.useRef(typeof t=="function"?t():t||{}),a=P.useMemo(()=>Ce.parse(g.search,p),[g.search]),I=P.useMemo(()=>Object.assign(Object.assign({},k.current),a),[a]);return[I,Ve(n=>{const s=typeof n=="function"?n(I):n;C(),i&&i[d]({hash:g.hash,search:Ce.stringify(Object.assign(Object.assign({},a),s),b)||"?"},g.state),T&&T({hash:g.hash,search:Ce.stringify(Object.assign(Object.assign({},a),s),b)||"?"},{replace:d==="replace",state:g.state})})]},Is=ks,Ts=_t,Ue=En,_e=On,Ds=ls,Tt={role:Ts.types.RoleType.ROLE_APPLICATION},As=(t,o,c,u)=>{let d=c||Tt;const h=(0,_e.isEthereumType)((0,_e.DidType)(c));if(h?d=(0,Ue.WalletType)(c):d=(0,Ue.WalletType)(Tt),!(0,_e.isValid)(t)){let S="";try{return h?S=t.slice(0,66):S=t,(0,Ue.fromSecretKey)(S,d)}catch(p){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${p.message}`)}}if(!o)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,Ds.fromAppDid)(t,o,d,u||0)};var Rs=As,Xt=jt&&jt.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const ce=Xt(Qn),Ls=_t,ve=Xt(Rs),Es=Jn,Os=(t,o,{returnWallet:c=!0}={})=>{var F,R;if(!t||typeof t!="object"||!Array.isArray(t.environments)||!(0,ce.default)(t,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:u,configs:d=[]}=t,h=[...d,...u],S=h.find(D=>D.key==="BLOCKLET_APP_DESCRIPTION"),p=h.find(D=>D.key==="BLOCKLET_PASSPORT_COLOR"),b=h.find(D=>D.key==="BLOCKLET_APP_URL"),g=h.find(D=>D.key==="BLOCKLET_APP_TENANT_MODE"),{did:i,version:T}=t.meta,C=(0,Es.getDisplayName)(t),k=(0,ce.default)(S,"value",t.meta.description),a=(0,ce.default)(p,"value","auto"),I=(0,ce.default)(b,"value",""),m=(0,ce.default)(g,"value","");if(!c)return{did:i,version:T,name:C,description:k,passportColor:a,appUrl:I,secret:"",wallet:null,permanentWallet:null,tenantMode:m};const n=h.find(D=>D.key==="BLOCKLET_APP_SK"),s=h.find(D=>D.key==="BLOCKLET_APP_CHAIN_TYPE")||h.find(D=>D.key==="BLOCKLET_WALLET_TYPE"),l=h.find(D=>D.key==="BLOCKLET_APP_PSK");let r;s&&(s.value==="ethereum"||s.value==="eth")&&(r=s.value);let x=null,y=null;if(n&&n.value)x=(0,ve.default)(n.value,void 0,r),l&&l.value&&l.value!==n.value&&(y=(0,ve.default)(l.value,void 0,r));else{if(!o||typeof o!="string")throw new Error("Node secret key must be a string");s?x=(0,ve.default)(t.meta.did,o,r):x=(0,ve.default)(t.meta.did,o)}const w=((R=(F=t.settings)==null?void 0:F.session)==null?void 0:R.salt)||"",U=Ls.Hasher.SHA3.hash256(St.concat([x.secretKey,x.address,w].filter(Boolean).map(D=>St.from(D))));return{did:i,version:T,name:C,description:k,passportColor:a,appUrl:I,secret:U,wallet:x,permanentWallet:y||x,tenantMode:m}};var Ns=Os;const Us=vn(Ns);function Je({teamDid:t,roles:o,apps:c,onCancel:u,onSuccess:d,onError:h,endpoint:S}){var I;const{api:p}=q(),{t:b,locale:g}=V(),i=Ke({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:c.length>0?c[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),T=async()=>{if(!i.role){i.error=b("team.member.error.passportEmpty");return}const m=i.remark.trim();i.error=null,i.loading=!0;try{let n=i.sourceAppPid??null;n===t&&(n=null);const s={teamDid:t,role:i.role,remark:m,sourceAppPid:n,passportExpireTime:i.passportExpireTime?i.passportExpireTime.toISOString():""};i.display&&(s.display={type:"url",content:i.display});const{inviteInfo:l}=await p.createMemberInvitation({input:s});i.inviteInfo=l,i.activeStep=1}catch(n){const s=te(n);i.error=s,h(n)}finally{i.loading=!1}},C=o.find(m=>m.name===i.role),a=[{body:e.jsxs(E,{sx:{display:"flex",flexDirection:"column",gap:3},children:[c.length>1?e.jsxs(Fe,{fullWidth:!0,children:[e.jsx($e,{children:b("common.sourceApp")}),e.jsx(We,{value:i.sourceAppPid,onChange:m=>{i.error=null,i.sourceAppPid=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:i.loading,children:c.map(m=>e.jsx(je,{value:m.appPid,children:e.jsxs(E,{sx:{display:"flex",justifyContent:"space-between",gap:2,width:"100%"},children:[e.jsxs(E,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Nn,{did:m.appPid,size:28}),m.appName]}),e.jsx(Un,{did:m.appPid,compact:!0,responsive:!1})]})},m.appPid))})]}):null,e.jsxs(Fe,{fullWidth:!0,variant:"outlined",children:[e.jsx($e,{children:b("common.passport")}),e.jsx(We,{"data-cy":"invite-member-select-role",value:i.role,onChange:m=>{i.error=null,i.role=m.target.value},fullWidth:!0,label:b("common.passport"),disabled:i.loading,onKeyPress:m=>{m.key==="Enter"&&(m.preventDefault(),T())},children:o.filter(m=>m.name!=="owner").map(m=>e.jsx(je,{value:m.name,"data-cy":`invite-member-select-option-${m.name}`,children:e.jsxs(E,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(Q,{variant:"subtitle1",children:m.title||m.name}),e.jsx(Q,{variant:"caption",sx:{opacity:.7},children:m.description})]})},m.name))})]}),((I=C==null?void 0:C.extra)==null?void 0:I.display)==="custom"&&e.jsx(me,{label:b("common.display"),type:"url",value:i.display,onChange:m=>{i.error=null,i.display=m.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(me,{label:b("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:i.remark,onChange:m=>{i.error=null,i.remark=m.target.value},disabled:i.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Kt,{value:i.passportExpireTime,onChange:m=>{i.passportExpireTime=m}})]}),cancel:b("common.cancel"),confirm:b("team.member.inviteDialog.createInviteLink"),onCancel:u,onConfirm:T},{body:()=>{var n,s;const m=we({inviteId:(n=i.inviteInfo)==null?void 0:n.inviteId,endpoint:S});return e.jsxs("div",{children:[e.jsx(E,{sx:{fontSize:16,fontWeight:"bold"},children:b("team.member.inviteDialog.createSuccessTip",{expireDate:pe((s=i.inviteInfo)==null?void 0:s.expireDate,g)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Te,{children:m})]})},confirm:b("common.copy"),onConfirm:()=>{var n;const m=we({inviteId:(n=i.inviteInfo)==null?void 0:n.inviteId,endpoint:S});os(m),Y.success(b("common.copied")),d()},cancel:b("common.cancel"),onCancel:u}][i.activeStep];return e.jsxs(se,{title:b("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[a.cancel&&e.jsx(W,{onClick:a.onCancel,color:"inherit",children:a.cancel}),e.jsxs(W,{onClick:a.onConfirm,color:"primary",disabled:i.loading||!i.role,variant:"contained",autoFocus:!0,children:[i.loading&&e.jsx(ie,{size:16}),a.confirm]})]}),children:[e.jsx(He,{component:"div",children:typeof a.body=="function"?a.body():a.body}),!!i.error&&e.jsx(oe,{severity:"error",variant:"icon",children:i.error})]})}Je.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,roles:v.array,apps:v.array,endpoint:v.string};Je.defaultProps={onError:()=>{},roles:[],apps:[],endpoint:""};function Xe({teamDid:t,onCancel:o,onSuccess:c,onError:u,endpoint:d}){const{api:h,info:S}=q(),{api:p}=P.useContext(_n),[b,g]=P.useState(!1),{t:i,locale:T}=V(),[C,k]=P.useState(""),[a,I]=P.useState(!1),[m,n]=P.useState(0),[s,l]=P.useState(""),[r,x]=P.useState(""),y=!!ze(S,"ownerNft.did"),w=cs(async()=>{if(y){const{state:A}=await h.getDelegationState();return A}return{delegated:!0}});if(w.loading)return e.jsx(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:o,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(ie,{})})});if(w.error)return e.jsx(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:o,children:e.jsx(oe,{severity:"error",variant:"icon",children:te(w.error)})});const U=async()=>{k(null),g(!0);try{const{inviteInfo:A}=await h.createTransferInvitation({input:{teamDid:t,role:"owner",remark:r.trim()}});l(A),n(D.length-1)}catch(A){const H=te(A);k(H),u(A)}finally{g(!1)}},F=()=>{I(!0),n(1)},R=()=>{I(!1),n(0)},D=[{body:e.jsxs(Q,{component:"div",children:[e.jsxs(oe,{severity:"warning",children:[e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.progress")}),e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(oe,{severity:"warning",children:e.jsx(Q,{children:i("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(me,{label:i("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:r,onChange:A=>{k(null),x(A.target.value)},disabled:b,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:i("common.cancel"),confirm:i("team.transferNode.inviteDialog.createInviteLink"),onCancel:o,onConfirm:y&&!ze(w,"value.delegated")?F:U},{body:()=>e.jsx(Bn,{action:"delegate-transfer-nft",open:a,locale:T,checkFn:p.get,onClose:R,onSuccess:U,checkTimeout:5*60*1e3,webWalletUrl:Xn(S),extraParams:{targetDID:S.did},messages:{title:i("team.transferNode.delegateDialog.title"),scan:i("team.transferNode.delegateDialog.scan"),confirm:i("team.transferNode.delegateDialog.confirm"),success:i("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const A=we({inviteId:s.inviteId,endpoint:d});return e.jsxs("div",{children:[e.jsx(_s,{children:i("team.transferNode.inviteDialog.createSuccessTip",{expireDate:pe(s.expireDate,T)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Te,{children:A})]})},confirm:i("common.confirm"),onConfirm:c}],O=D[m];return e.jsxs(se,{title:i("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[O.cancel&&e.jsx(W,{onClick:O.onCancel,color:"inherit",children:O.cancel}),e.jsxs(W,{onClick:O.onConfirm,color:"primary",disabled:b,variant:"contained",autoFocus:!0,children:[b&&e.jsx(ie,{size:16}),O.confirm]})]}),children:[e.jsx(He,{component:"div",children:typeof O.body=="function"?O.body():O.body}),!!C&&e.jsx(oe,{severity:"error",variant:"icon",children:C})]})}Xe.propTypes={teamDid:v.string.isRequired,onCancel:v.func.isRequired,onSuccess:v.func.isRequired,onError:v.func,endpoint:v.string};Xe.defaultProps={onError:()=>{},endpoint:""};const _s=z.div`
2
2
  font-size: 16px;
3
3
  font-weight: bold;
4
4
  `;var et=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.88619 1.875C5.0541 1.875 4.24071 2.12174 3.54885 2.58402C2.857 3.0463 2.31777 3.70336 1.99934 4.47211C1.68092 5.24085 1.5976 6.08676 1.75994 6.90285C1.92227 7.71895 2.32295 8.46858 2.91133 9.05695C3.4997 9.64532 4.24933 10.046 5.06543 10.2083C5.88152 10.3707 6.72743 10.2874 7.49617 9.96893C8.26492 9.65051 8.92198 9.11128 9.38426 8.41942C9.84654 7.72757 10.0933 6.91417 10.0933 6.08209C10.0933 4.9663 9.65003 3.89621 8.86105 3.10723C8.07207 2.31825 7.00198 1.875 5.88619 1.875ZM4.11182 4.30773C4.58242 3.83714 5.22067 3.57276 5.88619 3.57276C6.38249 3.57276 6.86764 3.71993 7.2803 3.99566C7.69295 4.27139 8.01458 4.66329 8.20451 5.12181C8.39443 5.58033 8.44413 6.08487 8.3473 6.57164C8.25048 7.0584 8.01149 7.50552 7.66055 7.85645C7.30962 8.20739 6.8625 8.44638 6.37574 8.5432C5.88897 8.64003 5.38443 8.59033 4.92591 8.40041C4.46739 8.21048 4.07549 7.88885 3.79976 7.4762C3.52403 7.06354 3.37686 6.57839 3.37686 6.08209C3.37686 5.41657 3.64123 4.77832 4.11182 4.30773ZM4.20709 10.8302C3.0913 10.8302 2.02121 11.2735 1.23223 12.0624C0.443246 12.8514 0 13.9215 0 15.0373V17.8358C0 17.9955 0.12947 18.125 0.289179 18.125H1.40858C1.56829 18.125 1.69776 17.9955 1.69776 17.8358V15.0373C1.69776 14.3718 1.96214 13.7335 2.43273 13.2629C2.90332 12.7924 3.54157 12.528 4.20709 12.528H7.5653C7.89483 12.528 8.22113 12.5929 8.52558 12.719C8.83002 12.8451 9.10665 13.0299 9.33966 13.2629C9.57267 13.496 9.75751 13.7726 9.88361 14.077C10.0097 14.3815 10.0746 14.7078 10.0746 15.0373V17.8358C10.0746 17.9955 10.2041 18.125 10.3638 18.125H11.4832C11.6429 18.125 11.7724 17.9955 11.7724 17.8358V15.0373C11.7724 13.9215 11.3291 12.8514 10.5402 12.0624C9.75118 11.2735 8.68109 10.8302 7.5653 10.8302H4.20709Z"}),e.jsx("rect",{x:"12.5",y:"9.375",width:"7.5",height:"1.875",rx:"0.9375"})]})};et.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};et.displayName="forbid-login";const en=et;var tt=function(t){return e.jsxs("svg",{...t,children:[e.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.88619 1.875C5.0541 1.875 4.24071 2.12174 3.54885 2.58402C2.857 3.0463 2.31777 3.70336 1.99934 4.47211C1.68092 5.24085 1.5976 6.08676 1.75994 6.90285C1.92227 7.71895 2.32295 8.46858 2.91133 9.05695C3.4997 9.64532 4.24933 10.046 5.06543 10.2083C5.88152 10.3707 6.72743 10.2874 7.49617 9.96893C8.26492 9.65051 8.92198 9.11128 9.38426 8.41942C9.84654 7.72757 10.0933 6.91417 10.0933 6.08209C10.0933 4.9663 9.65003 3.89621 8.86105 3.10723C8.07207 2.31825 7.00198 1.875 5.88619 1.875ZM4.11182 4.30773C4.58242 3.83714 5.22067 3.57276 5.88619 3.57276C6.38249 3.57276 6.86764 3.71993 7.2803 3.99566C7.69295 4.27139 8.01458 4.66329 8.20451 5.12181C8.39443 5.58033 8.44413 6.08487 8.3473 6.57164C8.25048 7.0584 8.01149 7.50552 7.66055 7.85645C7.30962 8.20739 6.8625 8.44638 6.37574 8.5432C5.88897 8.64003 5.38443 8.59033 4.92591 8.40041C4.46739 8.21048 4.07549 7.88885 3.79976 7.4762C3.52403 7.06354 3.37686 6.57839 3.37686 6.08209C3.37686 5.41657 3.64123 4.77832 4.11182 4.30773ZM4.20709 10.8302C3.0913 10.8302 2.02121 11.2735 1.23223 12.0624C0.443246 12.8514 0 13.9215 0 15.0373V17.8358C0 17.9955 0.12947 18.125 0.289179 18.125H1.40858C1.56829 18.125 1.69776 17.9955 1.69776 17.8358V15.0373C1.69776 14.3718 1.96214 13.7335 2.43273 13.2629C2.90332 12.7924 3.54157 12.528 4.20709 12.528H7.5653C7.89483 12.528 8.22113 12.5929 8.52558 12.719C8.83002 12.8451 9.10665 13.0299 9.33966 13.2629C9.57267 13.496 9.75751 13.7726 9.88361 14.077C10.0097 14.3815 10.0746 14.7078 10.0746 15.0373V17.8358C10.0746 17.9955 10.2041 18.125 10.3638 18.125H11.4832C11.6429 18.125 11.7724 17.9955 11.7724 17.8358V15.0373C11.7724 13.9215 11.3291 12.8514 10.5402 12.0624C9.75118 11.2735 8.68109 10.8302 7.5653 10.8302H4.20709Z"}),e.jsx("rect",{x:"12.5",y:"9.375",width:"7.5",height:"1.875",rx:"0.9375"}),e.jsx("rect",{x:"15.3125",y:"14.0625",width:"7.5",height:"1.875",rx:"0.9375",transform:"rotate(-90 15.3125 14.0625)"})]})};tt.defaultProps={width:"20",height:"20",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"};tt.displayName="allow-login";const tn=tt;function ke(t){const{passport:o,onDelete:c,...u}=t;return e.jsxs(Bs,{...u,children:[o.title||o.name," ",!!c&&e.jsx(Fn,{"data-cy":"delete-issuance",className:"delete",onClick:c})]})}ke.propTypes={passport:v.object.isRequired,onDelete:v.func};ke.defaultProps={onDelete:null};const Bs=z.span`
@@ -114,7 +114,7 @@ import{r as P,t as yn,g as vn,e as jt,a as bn}from"./vendor-react-DEoibe3W.js";i
114
114
  margin-left: 0.4em;
115
115
  }
116
116
  }
117
- `;function Ie({action:t,passport:o}){const{t:c}=V(),{roles:u}=K(),d=u.find(h=>h.name===o.role);return e.jsxs("div",{children:[e.jsx("div",{children:c(t==="enable"?"team.member.enablePassportDescription":"team.member.revokePassportDescription")}),d&&e.jsx(E,{mt:3,fontWeight:"bold",children:c("team.member.passportPermissionTitle")}),d&&e.jsx(E,{mt:1,children:d.description})]})}Ie.propTypes={action:v.string.isRequired,passport:v.object.isRequired};Ie.defaultProps={};function rt({user:t,onCreate:o,createPassportSvg:c}){var Z;const u=Cn(),{t:d}=V(),{session:h}=he(),{roles:S,teamDid:p,teamIssuerDid:b,refresh:g,enablePassportIssuance:i,trustedPassports:T,passportColor:C,blocklet:k}=K(),{appIdList:a}=qt(),{api:I,inService:m}=q(),[n,s]=P.useState(!1),[l,r]=P.useState(null),[x,y]=P.useState(!1),[w,_]=P.useState(""),F=[b,...a||[]].filter(Boolean),R=(ze(t,"passports")||[]).map(L=>({...L,revoked:L.status===J.PASSPORT_STATUS.REVOKED})),D=async L=>{if(!n){s(!0);try{const B=L.status===J.PASSPORT_STATUS.REVOKED?"enableUserPassport":"revokeUserPassport";await I[B]({input:{teamDid:p,userDid:t.did,passportId:L.id}}),g()}catch(B){Y.error(te(B))}finally{s(!1),r(null)}}},O=L=>L.status===J.PASSPORT_STATUS.REVOKED?r({title:d("team.member.enablePassport"),description:e.jsx(Ie,{action:"enable",passport:L}),confirm:d("common.enable"),cancel:d("common.cancel"),onConfirm:()=>{D(L)},onCancel:()=>{s(!1),r(null)},color:"primary"}):r({title:d("team.member.revokePassport"),description:e.jsx(Ie,{action:"revoke",passport:L}),confirm:d("common.revoke"),cancel:d("common.cancel"),onConfirm:()=>{D(L)},onCancel:()=>{s(!1),r(null)}}),A=(L,B)=>t.did===h.user.did&&h.user.passportId&&h.user.passportId===B.id?{revokable:!1,message:d("team.passport.shouldNotDeleteCurrent")}:L?p===B.issuer.id&&B.name==="owner"?{revokable:!1,message:d("team.passport.noPermission")}:{revokable:!0}:{revokable:!1,message:d("team.passport.noPermission")},H=R.filter(L=>!w||L.title.includes(w)||L.name.includes(w)),G=(L,B)=>B.status===J.PASSPORT_STATUS.EXPIRED?e.jsx(W,{variant:"outlined",disabled:!0,children:d("common.expired")}):A(L,B).revokable?e.jsxs(W,{variant:"outlined",color:B.revoked?"primary":"secondary",onClick:()=>O(B),children:[B.revoked?e.jsx(Se,{style:{fontSize:16,marginRight:4}}):e.jsx(Mt,{style:{height:16,marginRight:4}}),B.revoked?d("common.enable"):d("common.revoke")]}):e.jsx(ue,{title:A(L,B).message,children:e.jsx(Pt,{style:{color:u.palette.grey[600]}})});return e.jsxs(Gs,{children:[e.jsxs(Zs,{children:[e.jsx("div",{className:"left",children:e.jsx(Vs,{placeholder:d("team.passport.search"),value:w,onChange:L=>_(L.target.value)})}),e.jsx("div",{className:"right",children:i&&!!t.approved&&e.jsx(ee,{permission:m?"":"mutate_team",role:m?re:[],children:e.jsxs(W,{variant:"contained",color:"primary","data-cy":"issue-passport",onClick:()=>y(!0),children:[e.jsx(Se,{style:{fontSize:16,marginRight:4}}),d("team.passport.issue")]})})})]}),e.jsxs(E,{children:[H.map(L=>e.jsx(ee,{permission:m?"":"mutate_team",role:m?re:[],children:B=>e.jsxs(E,{className:"passport-item",display:"flex",justifyContent:"space-between",alignItems:"center",mt:3,children:[e.jsx(st,{passport:L,user:t,color:C,createPassportSvg:c,icon:F.length&&!F.includes(L.issuer.id)?e.jsx(Qt,{}):null,children:!!F.length&&!F.includes(L.issuer.id)&&e.jsxs("div",{className:"tip",children:[L.issuer.id!==b&&!T.some(Le=>Le.issuerDid===L.issuer.id)&&e.jsx(ue,{title:d("team.passport.notTrustedIssuerTip"),children:e.jsx(E,{component:Pt,style:{fontSize:"1.3em"},color:"error.main",mr:.5})}),e.jsx("span",{children:d("team.passport.issueBy",{name:L.issuer.name})})]})}),e.jsx(E,{children:G(B,L)})]})},L.id)),!H.length&&e.jsx(Bt,{children:d("common.empty")})]}),x&&e.jsx(Ae,{teamDid:p,ownerDid:t.did,needReceive:nn(t)===t.did,roles:S,onCancel:()=>y(!1),onSuccess:()=>{o(),y(!1)},showOwnerPassport:k&&!((Z=k.settings)!=null&&Z.owner)}),l&&e.jsx(ge,{title:l.title,description:l.description,confirm:l.confirm,cancel:l.cancel,params:l.params,onConfirm:l.onConfirm,onCancel:l.onCancel,color:l.color})]})}rt.propTypes={user:v.object.isRequired,createPassportSvg:v.func.isRequired,onCreate:v.func};rt.defaultProps={onCreate:()=>{}};const Gs=z.div`
117
+ `;function Ie({action:t,passport:o}){const{t:c}=V(),{roles:u}=K(),d=u.find(h=>h.name===o.role);return e.jsxs("div",{children:[e.jsx("div",{children:c(t==="enable"?"team.member.enablePassportDescription":"team.member.revokePassportDescription")}),d&&e.jsx(E,{mt:3,fontWeight:"bold",children:c("team.member.passportPermissionTitle")}),d&&e.jsx(E,{mt:1,children:d.description})]})}Ie.propTypes={action:v.string.isRequired,passport:v.object.isRequired};Ie.defaultProps={};function rt({user:t,onCreate:o,createPassportSvg:c}){var Z;const u=Cn(),{t:d}=V(),{session:h}=he(),{roles:S,teamDid:p,teamIssuerDid:b,refresh:g,enablePassportIssuance:i,trustedPassports:T,passportColor:C,blocklet:k}=K(),{appIdList:a}=qt(),{api:I,inService:m}=q(),[n,s]=P.useState(!1),[l,r]=P.useState(null),[x,y]=P.useState(!1),[w,U]=P.useState(""),F=[b,...a||[]].filter(Boolean),R=(ze(t,"passports")||[]).map(L=>({...L,revoked:L.status===J.PASSPORT_STATUS.REVOKED})),D=async L=>{if(!n){s(!0);try{const B=L.status===J.PASSPORT_STATUS.REVOKED?"enableUserPassport":"revokeUserPassport";await I[B]({input:{teamDid:p,userDid:t.did,passportId:L.id}}),g()}catch(B){Y.error(te(B))}finally{s(!1),r(null)}}},O=L=>L.status===J.PASSPORT_STATUS.REVOKED?r({title:d("team.member.enablePassport"),description:e.jsx(Ie,{action:"enable",passport:L}),confirm:d("common.enable"),cancel:d("common.cancel"),onConfirm:()=>{D(L)},onCancel:()=>{s(!1),r(null)},color:"primary"}):r({title:d("team.member.revokePassport"),description:e.jsx(Ie,{action:"revoke",passport:L}),confirm:d("common.revoke"),cancel:d("common.cancel"),onConfirm:()=>{D(L)},onCancel:()=>{s(!1),r(null)}}),A=(L,B)=>t.did===h.user.did&&h.user.passportId&&h.user.passportId===B.id?{revokable:!1,message:d("team.passport.shouldNotDeleteCurrent")}:L?p===B.issuer.id&&B.name==="owner"?{revokable:!1,message:d("team.passport.noPermission")}:{revokable:!0}:{revokable:!1,message:d("team.passport.noPermission")},H=R.filter(L=>!w||L.title.includes(w)||L.name.includes(w)),G=(L,B)=>B.status===J.PASSPORT_STATUS.EXPIRED?e.jsx(W,{variant:"outlined",disabled:!0,children:d("common.expired")}):A(L,B).revokable?e.jsxs(W,{variant:"outlined",color:B.revoked?"primary":"secondary",onClick:()=>O(B),children:[B.revoked?e.jsx(Se,{style:{fontSize:16,marginRight:4}}):e.jsx(Mt,{style:{height:16,marginRight:4}}),B.revoked?d("common.enable"):d("common.revoke")]}):e.jsx(ue,{title:A(L,B).message,children:e.jsx(Pt,{style:{color:u.palette.grey[600]}})});return e.jsxs(Gs,{children:[e.jsxs(Zs,{children:[e.jsx("div",{className:"left",children:e.jsx(Vs,{placeholder:d("team.passport.search"),value:w,onChange:L=>U(L.target.value)})}),e.jsx("div",{className:"right",children:i&&!!t.approved&&e.jsx(ee,{permission:m?"":"mutate_team",role:m?re:[],children:e.jsxs(W,{variant:"contained",color:"primary","data-cy":"issue-passport",onClick:()=>y(!0),children:[e.jsx(Se,{style:{fontSize:16,marginRight:4}}),d("team.passport.issue")]})})})]}),e.jsxs(E,{children:[H.map(L=>e.jsx(ee,{permission:m?"":"mutate_team",role:m?re:[],children:B=>e.jsxs(E,{className:"passport-item",display:"flex",justifyContent:"space-between",alignItems:"center",mt:3,children:[e.jsx(st,{passport:L,user:t,color:C,createPassportSvg:c,icon:F.length&&!F.includes(L.issuer.id)?e.jsx(Qt,{}):null,children:!!F.length&&!F.includes(L.issuer.id)&&e.jsxs("div",{className:"tip",children:[L.issuer.id!==b&&!T.some(Le=>Le.issuerDid===L.issuer.id)&&e.jsx(ue,{title:d("team.passport.notTrustedIssuerTip"),children:e.jsx(E,{component:Pt,style:{fontSize:"1.3em"},color:"error.main",mr:.5})}),e.jsx("span",{children:d("team.passport.issueBy",{name:L.issuer.name})})]})}),e.jsx(E,{children:G(B,L)})]})},L.id)),!H.length&&e.jsx(Bt,{children:d("common.empty")})]}),x&&e.jsx(Ae,{teamDid:p,ownerDid:t.did,needReceive:nn(t)===t.did,roles:S,onCancel:()=>y(!1),onSuccess:()=>{o(),y(!1)},showOwnerPassport:k&&!((Z=k.settings)!=null&&Z.owner)}),l&&e.jsx(ge,{title:l.title,description:l.description,confirm:l.confirm,cancel:l.cancel,params:l.params,onConfirm:l.onConfirm,onCancel:l.onCancel,color:l.color})]})}rt.propTypes={user:v.object.isRequired,createPassportSvg:v.func.isRequired,onCreate:v.func};rt.defaultProps={onCreate:()=>{}};const Gs=z.div`
118
118
  .passport-item {
119
119
  .MuiButton-outlinedSecondary {
120
120
  color: #f16e6e;
@@ -126,7 +126,7 @@ import{r as P,t as yn,g as vn,e as jt,a as bn}from"./vendor-react-DEoibe3W.js";i
126
126
  }
127
127
  }
128
128
  }
129
- `,Qs=bn(An),Dt=Qs,{ROLES:Js,PASSPORT_STATUS:on}=J,Xs=t=>((t==null?void 0:t.passports)||[]).some(o=>o.role===Js.OWNER&&o.status===on.VALID),er=(t,o=[])=>{const c=u=>u.status!==on.VALID||!o.includes(u.issuer.id)?!1:!(u.expirationDate&&Date.now()>new Date(u.expirationDate).getTime());return Dt((t.passports||[]).filter(u=>!u.display).filter(c),"name").concat(Dt((t.passports||[]).filter(u=>u.display).filter(c),"display.content"))};var an={hasActiveOwnerPassport:Xs,getActivePassports:er};function Re({user:t,onCancel:o,onSuccess:c,onError:u,children:d}){const{api:h,info:S,inService:p}=q(),{session:b}=he(),{teamDid:g,refresh:i}=K(),{t:T}=V(),[C,k]=P.useState(!1),[a,I]=P.useState(!1),m=()=>I(!0),n=async r=>{const{did:x,approved:y}=r;if(!C){k(!0);try{await h.updateUserApproval({input:{teamDid:g,user:{did:x,approved:!y}}}),I(!1),c(),i()}catch(w){Y.error(te(w)),u()}finally{k(!1)}}},s={title:t.approved?T("team.member.blockAccess"):T("team.member.allowAccess"),description:t.approved?T("team.member.blockAccessDescription"):T("team.member.allowAccessDescription"),confirm:T("common.confirm"),cancel:T("common.cancel"),onConfirm:()=>{n(t)},onCancel:()=>{k(!1),I(!1),o()},color:t.approved?"error":"primary"};let l;return an.hasActiveOwnerPassport(t)?l=!1:p?l=!Pe(b.user,t.did):l=S.nodeOwner&&!Zt(S,t.did)&&!Pe(b.user,t.did),l?e.jsxs(e.Fragment,{children:[typeof d=="function"?d({can:l,open:m}):d,a?e.jsx(ge,{title:s.title,description:s.description,confirm:s.confirm,cancel:s.cancel,params:s.params,onConfirm:s.onConfirm,onCancel:s.onCancel,color:s.color}):null]}):null}Re.propTypes={user:v.object,onSuccess:v.func,onCancel:v.func,onError:v.func,children:v.oneOfType([v.object,v.func])};Re.defaultProps={user:{},onSuccess:()=>{},onCancel:()=>{},onError:()=>{},children:null};function ot({user:t,onCancel:o,onSuccess:c,onError:u,children:d}){const{api:h,info:S,inService:p}=q(),{session:b}=he(),{teamDid:g}=K(),{t:i}=V(),[T,C]=P.useState(!1),[k,a]=P.useState(!1),I=()=>a(!0),m=async l=>{const{did:r}=l;if(!T){C(!0);try{await h.removeUser({input:{teamDid:g,user:{did:r}}}),a(!1),c(),Y.success(i("team.member.removeUserSuccess")),setTimeout(()=>{window.location.reload()},1e3)}catch(x){Y.error(te(x)),u()}finally{C(!1)}}},n={title:i("team.member.removeUser"),description:i("team.member.removeUserDescription",{did:t.did}),confirm:i("common.confirm"),cancel:i("common.cancel"),onConfirm:()=>{m(t)},onCancel:()=>{C(!1),a(!1),o()},color:"error"};let s;return an.hasActiveOwnerPassport(t)?s=!1:p?s=!Pe(b.user,t.did):s=S.nodeOwner&&!Zt(S,t.did)&&!Pe(b.user,t.did),s?e.jsxs(e.Fragment,{children:[typeof d=="function"?d({can:s,open:I}):d,k?e.jsx(ge,{title:n.title,description:n.description,confirm:n.confirm,cancel:n.cancel,params:n.params,onConfirm:n.onConfirm,onCancel:n.onCancel,color:n.color}):null]}):null}ot.propTypes={user:v.object,onSuccess:v.func,onCancel:v.func,onError:v.func,children:v.oneOfType([v.object,v.func])};ot.defaultProps={user:{},onSuccess:()=>{},onCancel:()=>{},onError:()=>{},children:null};function it({hasPasskey:t}){const{isNodeTeam:o}=K();return o?e.jsx(Wn,{behavior:"only-new",action:"connect",createMode:"connect",createButtonText:t?"Add New Passkey":"Add Passkey",onSuccess:wt,onError:wt,dense:!0}):null}it.propTypes={hasPasskey:v.bool};it.defaultProps={hasPasskey:!1};function at({user:t,onChangeUser:o}){const c=t.connectedAccounts||[],{t:u}=V(),{session:d}=he(),{disconnectPasskey:h}=d.usePasskey(),S=c.some(p=>p.provider===X.LOGIN_PROVIDER.PASSKEY&&p.did);return e.jsxs("div",{children:[c.map(p=>e.jsxs("div",{children:[e.jsx(M,{style:{alignItems:"flex-start",cursor:"pointer"},valueComponent:"div",nameWidth:120,name:p.provider,onClick:()=>{const b=document.getElementById(`account-details-${p.did}`);b&&(b.style.display=b.style.display==="none"?"block":"none")},children:e.jsx(Ze,{did:p.did,showQrcode:!0})},p.did),e.jsxs(jn,{id:`account-details-${p.did}`,sx:{display:"none",mt:-1,mb:1,pt:1,pl:1,pr:1,boxShadow:"none",border:"1px solid #e0e0e0"},children:[p.did&&e.jsx(M,{nameWidth:120,name:"DID",children:p.did}),p.pk&&e.jsx(M,{nameWidth:120,name:"PublicKey",children:p.pk}),p.id&&e.jsx(M,{nameWidth:120,name:"ID",children:p.id}),p.sub&&e.jsx(M,{nameWidth:120,name:"Sub",children:p.sub}),p.lastLoginAt&&e.jsx(M,{nameWidth:120,name:"Last Login",children:p.lastLoginAt}),p.counter&&e.jsx(M,{nameWidth:120,name:"Counter",children:p.counter}),p.userInfo&&e.jsx(M,{nameWidth:120,name:"User Info",children:e.jsx("pre",{style:{margin:0,fontSize:12},children:JSON.stringify(p.userInfo,null,2)})}),p.extra&&e.jsx(M,{nameWidth:120,name:"Extra",children:e.jsx("pre",{style:{margin:0,fontSize:12},children:JSON.stringify(p.extra,null,2)})}),p.provider===X.LOGIN_PROVIDER.PASSKEY&&e.jsx(Nt,{size:"small",variant:"contained",color:"error",sx:{mb:1},onClick:async()=>{await h({session:d,connectedAccount:p}),await o(t)},children:u("common.disconnect")})]})]},p.did)),e.jsx(it,{hasPasskey:S})]})}at.propTypes={user:v.object.isRequired,onChangeUser:v.func};at.defaultProps={onChangeUser:()=>{}};function At({info:t,verified:o}){return e.jsxs(E,{display:"flex",alignItems:"center",children:[t,o&&e.jsx(Zn,{color:"success",style:{fontSize:16,marginLeft:4}})]})}v.string.isRequired;const de="info";function lt({userDid:t,onCancel:o,initTab:c,createPassportSvg:u}){var F;const{api:d,ws:{useSubscription:h},inService:S}=q(),{session:p}=he(),{roles:b,teamDid:g,isNodeTeam:i,enablePassportIssuance:T}=K(),{t:C,locale:k}=V(),a=Ke({user:null,issuances:null,tab:c||de}),[I,m]=P.useState(""),n=async(R,D)=>{try{const O=await d.doBatchQuery({getUser:{input:{teamDid:R,user:{did:D},options:{includeTags:!0}}},getPassportIssuances:{input:{teamDid:R,ownerDid:D}}});O.getUser.user&&(O.getUser.user.avatar=Yt(O.getUser.user.avatar,R,S),O.getUser.user.passports=(O.getUser.user.passports||[]).filter(A=>A.issuer)),a.user=O.getUser.user||{},a.issuances=O.getPassportIssuances.list||[]}catch(O){Y.error(te(O))}};P.useEffect(()=>{g&&n(g,t)},[t,g]);const s=R=>{R.teamDid===g&&R.user&&R.user.did===t&&n(g,t)};h(X.TeamEvents.userUpdated,s,[t,g]),P.useEffect(()=>{a.issuances&&!a.issuances.length&&a.tab==="issuances"&&(a.tab=de)},[a.issuances]),P.useEffect(()=>{var R;ms.user.getProfileUrl({did:(R=a.user)==null?void 0:R.did,locale:k}).then(m)},[(F=a.user)==null?void 0:F.did,k]);const l=async R=>{await n(g,R.did),a.tab=a.tab||de},r=()=>{var D,O;return(a.user?[{name:C("team.member.name"),value:a.user.fullName},{name:C("common.email"),value:a.user.email?e.jsx(At,{info:a.user.email,verified:a.user.emailVerified}):"-"},{name:C("common.phone"),value:a.user.phone?e.jsx(At,{info:a.user.phone,verified:a.user.phoneVerified}):"-"},{name:C("team.member.source"),value:e.jsx(E,{display:"flex",alignItems:"center",children:X.PROVIDER_NAME[((D=a.user)==null?void 0:D.sourceProvider)||J.USER_TYPE.WALLET]||((O=a.user)==null?void 0:O.sourceProvider)})},{name:C("team.member.allowAccess"),value:a.user.approved?C("common.yes"):C("common.no")},{name:C("common.createdAt"),value:a.user.createdAt?e.jsx(Me,{value:a.user.createdAt,type:"all",locale:k}):"-"},{name:C("team.member.lastLogin"),value:a.user.lastLoginAt?e.jsx(Me,{value:a.user.lastLoginAt,type:"all",locale:k}):"-"},{name:C("team.member.lastLoginIp"),value:a.user.lastLoginIp||""},{name:C("common.remark"),value:a.user.remark||"-"},{name:C("team.invite.inviter"),value:a.user.inviter?e.jsx(Ze,{compact:!0,responsive:!0,did:a.user.inviter,showQrcode:!0}):"-"},Array.isArray(a.user.tags)&&a.user.tags.length>0?{name:C("common.tags"),value:a.user.tags.map(A=>e.jsx(Vt,{style:{background:A.color,color:Ht(A.color),marginRight:4},children:A.title},A.id))}:null].filter(Boolean):[]).map(A=>A.name===C("common.did")?e.jsx(M,{valueComponent:"div",nameWidth:120,name:A.name,nameFormatter:()=>C("common.did"),children:A.value},A.name):e.jsx(M,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:A.name,children:A.value},A.name))},x={info:{label:C("common.basicInfo"),value:de,component:r},oauth:{label:C("team.member.connectedAccounts"),value:"oauth",component:()=>e.jsx(at,{user:a.user,onChangeUser:l})},passports:{label:C("common.passport"),value:"passports",component:()=>e.jsx(rt,{user:a.user,teamDid:g,roles:b,createPassportSvg:u,onCreate:()=>{n(g,t).then(()=>{T&&a.issuances&&a.issuances.length&&(a.tab="issuances")})},onRefresh:()=>{n(g,t)}})},issuances:{label:C("team.passport.issuance.pending"),value:"issuances",component:()=>e.jsx(nt,{issuances:a.issuances||[],teamDid:g,onRefresh:()=>n(g,t)})}},y=Object.values(x).map(({label:R,value:D})=>({label:R,value:D})).filter(R=>{var D,O;return R.value==="issuances"?T&&a.issuances&&!!a.issuances.length:R.value==="oauth"?i&&((D=p.user)==null?void 0:D.did)===t?!0:(((O=a.user)==null?void 0:O.connectedAccounts)||[]).find(H=>{var G;return H.did!==((G=a.user)==null?void 0:G.did)}):!0}),w=x[a.tab]||x.info,_=R=>{a.tab=R};return e.jsx(se,{title:C("common.member"),onClose:o,open:!0,PaperProps:{style:{maxWidth:632,minHeight:"80vh"}},fullWidth:!0,actions:a.user&&e.jsxs(ee,{permission:S?"":"mutate_team",role:S?re:[],children:[e.jsx(Re,{user:a.user,children:({open:R})=>e.jsxs(Rt,{onClick:R,children:[a.user.approved?e.jsx(en,{style:{fontSize:"1.2em",marginRight:"0.4em"}}):e.jsx(tn,{style:{fontSize:"1.2em",marginRight:"0.4em"}}),a.user.approved?C("team.member.blockAccess"):C("team.member.allowAccess")]})}),e.jsx(ot,{user:a.user,onSuccess:o,children:({open:R})=>e.jsxs(Rt,{onClick:R,children:[e.jsx(ds,{style:{fontSize:"1.2em",marginRight:"0.4em"}}),C("team.member.removeUser")]})})]}),children:e.jsxs(tr,{children:[!a.user&&e.jsx(nr,{children:e.jsx(ie,{})}),a.user&&e.jsxs("div",{children:[e.jsxs(E,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",overflow:"hidden"},children:[e.jsx(E,{sx:{display:"flex",alignItems:"center",width:"100%",overflow:"hidden"},className:"info",children:e.jsx(Ft,{user:a.user,cardType:$t.Detailed,infoType:zn.Minimal,avatarSize:48,sx:{padding:0,border:"none"},showDid:!0,didProps:{compact:!0,responsive:!1,showQrcode:!0}})}),!!S&&e.jsx(E,{href:I,target:"_blank",rel:"noreferrer",component:"a",sx:{flexShrink:0},children:e.jsxs(Nt,{variant:"contained",color:"primary","data-cy":"issue-passport",children:[e.jsx(Mn,{icon:"majesticons:open-line",style:{fontSize:16,marginRight:4}}),C("team.member.openProfile")]})})]}),e.jsx(E,{mx:3,className:"tabs",children:e.jsx(qn,{tabs:y,current:a.tab,onChange:_,scrollButtons:"auto"})}),e.jsx("div",{className:"body",children:e.jsx(w.component,{})})]})]})})}lt.propTypes={userDid:v.string.isRequired,onCancel:v.func.isRequired,createPassportSvg:v.func.isRequired,initTab:v.string};lt.defaultProps={initTab:de};const tr=z.div`
129
+ `,Qs=bn(An),Dt=Qs,{ROLES:Js,PASSPORT_STATUS:on}=J,Xs=t=>((t==null?void 0:t.passports)||[]).some(o=>o.role===Js.OWNER&&o.status===on.VALID),er=(t,o=[])=>{const c=u=>u.status!==on.VALID||!o.includes(u.issuer.id)?!1:!(u.expirationDate&&Date.now()>new Date(u.expirationDate).getTime());return Dt((t.passports||[]).filter(u=>!u.display).filter(c),"name").concat(Dt((t.passports||[]).filter(u=>u.display).filter(c),"display.content"))};var an={hasActiveOwnerPassport:Xs,getActivePassports:er};function Re({user:t,onCancel:o,onSuccess:c,onError:u,children:d}){const{api:h,info:S,inService:p}=q(),{session:b}=he(),{teamDid:g,refresh:i}=K(),{t:T}=V(),[C,k]=P.useState(!1),[a,I]=P.useState(!1),m=()=>I(!0),n=async r=>{const{did:x,approved:y}=r;if(!C){k(!0);try{await h.updateUserApproval({input:{teamDid:g,user:{did:x,approved:!y}}}),I(!1),c(),i()}catch(w){Y.error(te(w)),u()}finally{k(!1)}}},s={title:t.approved?T("team.member.blockAccess"):T("team.member.allowAccess"),description:t.approved?T("team.member.blockAccessDescription"):T("team.member.allowAccessDescription"),confirm:T("common.confirm"),cancel:T("common.cancel"),onConfirm:()=>{n(t)},onCancel:()=>{k(!1),I(!1),o()},color:t.approved?"error":"primary"};let l;return an.hasActiveOwnerPassport(t)?l=!1:p?l=!Pe(b.user,t.did):l=S.nodeOwner&&!Zt(S,t.did)&&!Pe(b.user,t.did),l?e.jsxs(e.Fragment,{children:[typeof d=="function"?d({can:l,open:m}):d,a?e.jsx(ge,{title:s.title,description:s.description,confirm:s.confirm,cancel:s.cancel,params:s.params,onConfirm:s.onConfirm,onCancel:s.onCancel,color:s.color}):null]}):null}Re.propTypes={user:v.object,onSuccess:v.func,onCancel:v.func,onError:v.func,children:v.oneOfType([v.object,v.func])};Re.defaultProps={user:{},onSuccess:()=>{},onCancel:()=>{},onError:()=>{},children:null};function ot({user:t,onCancel:o,onSuccess:c,onError:u,children:d}){const{api:h,info:S,inService:p}=q(),{session:b}=he(),{teamDid:g}=K(),{t:i}=V(),[T,C]=P.useState(!1),[k,a]=P.useState(!1),I=()=>a(!0),m=async l=>{const{did:r}=l;if(!T){C(!0);try{await h.removeUser({input:{teamDid:g,user:{did:r}}}),a(!1),c(),Y.success(i("team.member.removeUserSuccess")),setTimeout(()=>{window.location.reload()},1e3)}catch(x){Y.error(te(x)),u()}finally{C(!1)}}},n={title:i("team.member.removeUser"),description:i("team.member.removeUserDescription",{did:t.did}),confirm:i("common.confirm"),cancel:i("common.cancel"),onConfirm:()=>{m(t)},onCancel:()=>{C(!1),a(!1),o()},color:"error"};let s;return an.hasActiveOwnerPassport(t)?s=!1:p?s=!Pe(b.user,t.did):s=S.nodeOwner&&!Zt(S,t.did)&&!Pe(b.user,t.did),s?e.jsxs(e.Fragment,{children:[typeof d=="function"?d({can:s,open:I}):d,k?e.jsx(ge,{title:n.title,description:n.description,confirm:n.confirm,cancel:n.cancel,params:n.params,onConfirm:n.onConfirm,onCancel:n.onCancel,color:n.color}):null]}):null}ot.propTypes={user:v.object,onSuccess:v.func,onCancel:v.func,onError:v.func,children:v.oneOfType([v.object,v.func])};ot.defaultProps={user:{},onSuccess:()=>{},onCancel:()=>{},onError:()=>{},children:null};function it({hasPasskey:t}){const{isNodeTeam:o}=K();return o?e.jsx(Wn,{behavior:"only-new",action:"connect",createMode:"connect",createButtonText:t?"Add New Passkey":"Add Passkey",onSuccess:wt,onError:wt,dense:!0}):null}it.propTypes={hasPasskey:v.bool};it.defaultProps={hasPasskey:!1};function at({user:t,onChangeUser:o}){const c=t.connectedAccounts||[],{t:u}=V(),{session:d}=he(),{disconnectPasskey:h}=d.usePasskey(),S=c.some(p=>p.provider===X.LOGIN_PROVIDER.PASSKEY&&p.did);return e.jsxs("div",{children:[c.map(p=>e.jsxs("div",{children:[e.jsx(M,{style:{alignItems:"flex-start",cursor:"pointer"},valueComponent:"div",nameWidth:120,name:p.provider,onClick:()=>{const b=document.getElementById(`account-details-${p.did}`);b&&(b.style.display=b.style.display==="none"?"block":"none")},children:e.jsx(Ze,{did:p.did,showQrcode:!0})},p.did),e.jsxs(jn,{id:`account-details-${p.did}`,sx:{display:"none",mt:-1,mb:1,pt:1,pl:1,pr:1,boxShadow:"none",border:"1px solid #e0e0e0"},children:[p.did&&e.jsx(M,{nameWidth:120,name:"DID",children:p.did}),p.pk&&e.jsx(M,{nameWidth:120,name:"PublicKey",children:p.pk}),p.id&&e.jsx(M,{nameWidth:120,name:"ID",children:p.id}),p.sub&&e.jsx(M,{nameWidth:120,name:"Sub",children:p.sub}),p.lastLoginAt&&e.jsx(M,{nameWidth:120,name:"Last Login",children:p.lastLoginAt}),p.counter&&e.jsx(M,{nameWidth:120,name:"Counter",children:p.counter}),p.userInfo&&e.jsx(M,{nameWidth:120,name:"User Info",children:e.jsx("pre",{style:{margin:0,fontSize:12},children:JSON.stringify(p.userInfo,null,2)})}),p.extra&&e.jsx(M,{nameWidth:120,name:"Extra",children:e.jsx("pre",{style:{margin:0,fontSize:12},children:JSON.stringify(p.extra,null,2)})}),p.provider===X.LOGIN_PROVIDER.PASSKEY&&e.jsx(Nt,{size:"small",variant:"contained",color:"error",sx:{mb:1},onClick:async()=>{await h({session:d,connectedAccount:p}),await o(t)},children:u("common.disconnect")})]})]},p.did)),e.jsx(it,{hasPasskey:S})]})}at.propTypes={user:v.object.isRequired,onChangeUser:v.func};at.defaultProps={onChangeUser:()=>{}};function At({info:t,verified:o}){return e.jsxs(E,{display:"flex",alignItems:"center",children:[t,o&&e.jsx(Zn,{color:"success",style:{fontSize:16,marginLeft:4}})]})}v.string.isRequired;const de="info";function lt({userDid:t,onCancel:o,initTab:c,createPassportSvg:u}){var F;const{api:d,ws:{useSubscription:h},inService:S}=q(),{session:p}=he(),{roles:b,teamDid:g,isNodeTeam:i,enablePassportIssuance:T}=K(),{t:C,locale:k}=V(),a=Ke({user:null,issuances:null,tab:c||de}),[I,m]=P.useState(""),n=async(R,D)=>{try{const O=await d.doBatchQuery({getUser:{input:{teamDid:R,user:{did:D},options:{includeTags:!0}}},getPassportIssuances:{input:{teamDid:R,ownerDid:D}}});O.getUser.user&&(O.getUser.user.avatar=Yt(O.getUser.user.avatar,R,S),O.getUser.user.passports=(O.getUser.user.passports||[]).filter(A=>A.issuer)),a.user=O.getUser.user||{},a.issuances=O.getPassportIssuances.list||[]}catch(O){Y.error(te(O))}};P.useEffect(()=>{g&&n(g,t)},[t,g]);const s=R=>{R.teamDid===g&&R.user&&R.user.did===t&&n(g,t)};h(X.TeamEvents.userUpdated,s,[t,g]),P.useEffect(()=>{a.issuances&&!a.issuances.length&&a.tab==="issuances"&&(a.tab=de)},[a.issuances]),P.useEffect(()=>{var R;ms.user.getProfileUrl({did:(R=a.user)==null?void 0:R.did,locale:k}).then(m)},[(F=a.user)==null?void 0:F.did,k]);const l=async R=>{await n(g,R.did),a.tab=a.tab||de},r=()=>{var D,O;return(a.user?[{name:C("team.member.name"),value:a.user.fullName},{name:C("common.email"),value:a.user.email?e.jsx(At,{info:a.user.email,verified:a.user.emailVerified}):"-"},{name:C("common.phone"),value:a.user.phone?e.jsx(At,{info:a.user.phone,verified:a.user.phoneVerified}):"-"},{name:C("team.member.source"),value:e.jsx(E,{display:"flex",alignItems:"center",children:X.PROVIDER_NAME[((D=a.user)==null?void 0:D.sourceProvider)||J.USER_TYPE.WALLET]||((O=a.user)==null?void 0:O.sourceProvider)})},{name:C("team.member.allowAccess"),value:a.user.approved?C("common.yes"):C("common.no")},{name:C("common.createdAt"),value:a.user.createdAt?e.jsx(Me,{value:a.user.createdAt,type:"all",locale:k}):"-"},{name:C("team.member.lastLogin"),value:a.user.lastLoginAt?e.jsx(Me,{value:a.user.lastLoginAt,type:"all",locale:k}):"-"},{name:C("team.member.lastLoginIp"),value:a.user.lastLoginIp||""},{name:C("common.remark"),value:a.user.remark||"-"},{name:C("team.invite.inviter"),value:a.user.inviter?e.jsx(Ze,{compact:!0,responsive:!0,did:a.user.inviter,showQrcode:!0}):"-"},Array.isArray(a.user.tags)&&a.user.tags.length>0?{name:C("common.tags"),value:a.user.tags.map(A=>e.jsx(Vt,{style:{background:A.color,color:Ht(A.color),marginRight:4},children:A.title},A.id))}:null].filter(Boolean):[]).map(A=>A.name===C("common.did")?e.jsx(M,{valueComponent:"div",nameWidth:120,name:A.name,nameFormatter:()=>C("common.did"),children:A.value},A.name):e.jsx(M,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:A.name,children:A.value},A.name))},x={info:{label:C("common.basicInfo"),value:de,component:r},oauth:{label:C("team.member.connectedAccounts"),value:"oauth",component:()=>e.jsx(at,{user:a.user,onChangeUser:l})},passports:{label:C("common.passport"),value:"passports",component:()=>e.jsx(rt,{user:a.user,teamDid:g,roles:b,createPassportSvg:u,onCreate:()=>{n(g,t).then(()=>{T&&a.issuances&&a.issuances.length&&(a.tab="issuances")})},onRefresh:()=>{n(g,t)}})},issuances:{label:C("team.passport.issuance.pending"),value:"issuances",component:()=>e.jsx(nt,{issuances:a.issuances||[],teamDid:g,onRefresh:()=>n(g,t)})}},y=Object.values(x).map(({label:R,value:D})=>({label:R,value:D})).filter(R=>{var D,O;return R.value==="issuances"?T&&a.issuances&&!!a.issuances.length:R.value==="oauth"?i&&((D=p.user)==null?void 0:D.did)===t?!0:(((O=a.user)==null?void 0:O.connectedAccounts)||[]).find(H=>{var G;return H.did!==((G=a.user)==null?void 0:G.did)}):!0}),w=x[a.tab]||x.info,U=R=>{a.tab=R};return e.jsx(se,{title:C("common.member"),onClose:o,open:!0,PaperProps:{style:{maxWidth:632,minHeight:"80vh"}},fullWidth:!0,actions:a.user&&e.jsxs(ee,{permission:S?"":"mutate_team",role:S?re:[],children:[e.jsx(Re,{user:a.user,children:({open:R})=>e.jsxs(Rt,{onClick:R,children:[a.user.approved?e.jsx(en,{style:{fontSize:"1.2em",marginRight:"0.4em"}}):e.jsx(tn,{style:{fontSize:"1.2em",marginRight:"0.4em"}}),a.user.approved?C("team.member.blockAccess"):C("team.member.allowAccess")]})}),e.jsx(ot,{user:a.user,onSuccess:o,children:({open:R})=>e.jsxs(Rt,{onClick:R,children:[e.jsx(ds,{style:{fontSize:"1.2em",marginRight:"0.4em"}}),C("team.member.removeUser")]})})]}),children:e.jsxs(tr,{children:[!a.user&&e.jsx(nr,{children:e.jsx(ie,{})}),a.user&&e.jsxs("div",{children:[e.jsxs(E,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",overflow:"hidden"},children:[e.jsx(E,{sx:{display:"flex",alignItems:"center",width:"100%",overflow:"hidden"},className:"info",children:e.jsx(Ft,{user:a.user,cardType:$t.Detailed,infoType:zn.Minimal,avatarSize:48,sx:{padding:0,border:"none"},showDid:!0,didProps:{compact:!0,responsive:!1,showQrcode:!0}})}),!!S&&e.jsx(E,{href:I,target:"_blank",rel:"noreferrer",component:"a",sx:{flexShrink:0},children:e.jsxs(Nt,{variant:"contained",color:"primary","data-cy":"issue-passport",children:[e.jsx(Mn,{icon:"majesticons:open-line",style:{fontSize:16,marginRight:4}}),C("team.member.openProfile")]})})]}),e.jsx(E,{mx:3,className:"tabs",children:e.jsx(qn,{tabs:y,current:a.tab,onChange:U,scrollButtons:"auto"})}),e.jsx("div",{className:"body",children:e.jsx(w.component,{})})]})]})})}lt.propTypes={userDid:v.string.isRequired,onCancel:v.func.isRequired,createPassportSvg:v.func.isRequired,initTab:v.string};lt.defaultProps={initTab:de};const tr=z.div`
130
130
  .info {
131
131
  .name {
132
132
  font-weight: 400;
@@ -167,7 +167,7 @@ import{r as P,t as yn,g as vn,e as jt,a as bn}from"./vendor-react-DEoibe3W.js";i
167
167
  fill: #999;
168
168
  `;function ct(){const{api:t,inService:o}=q(),{t:c,locale:u}=P.useContext(fe),{teamDid:d,invitations:h,refresh:S,endpoint:p,roles:b}=K(),[g,i]=P.useState(null),[T,C]=P.useState(!1),k=async({inviteId:n})=>{if(!T){C(!0);try{await t.deleteInvitation({input:{teamDid:d,inviteId:n}}),S(),await ns(800)}catch(s){console.error(s)}finally{C(!1),i(null)}}},a=()=>{C(!1),i(null)},I=n=>p?we({inviteId:n.inviteId,endpoint:p}):"",m=[{label:c("team.inviting.link"),name:"inviteId",options:{sort:!1,customBodyRenderLite:n=>{const s=h[n];return p?e.jsx(Te,{children:I(s)}):e.jsx(ie,{size:16})}}},{label:c("common.role"),name:"role",widtn:70,options:{sort:!1,customBodyRender:n=>{const s=b.find(l=>l.name===n);return s!=null&&s.title?e.jsx(ue,{title:n,children:s.title}):n||"--"}}},{label:c("common.remark"),name:"remark",options:{sort:!1,customBodyRender:n=>n||"--"}},{label:c("team.inviting.inviter"),name:"inviter.fullName",options:{sort:!1,customBodyRender:(n,{rowIndex:s})=>{var r;const l=h[s];return(r=l==null?void 0:l.inviter)==null?void 0:r.fullName}}},{label:c("common.expires"),name:"expireDate",options:{sort:!1,customBodyRender:n=>e.jsx(E,{children:ts(n).format("YYYY-MM-DD HH:mm")})}},{label:c("common.actions"),name:"",width:100,align:"center",options:{sort:!1,customBodyRenderLite:n=>{const s=h[n];return e.jsx(ee,{permission:o?"":"mutate_team",role:o?re:[],children:e.jsxs(W,{onClick:()=>i({title:c("team.inviting.delete.title"),description:c("team.inviting.delete.description",{link:I(s)}),confirm:c("common.delConfirm"),cancel:c("common.cancel"),onConfirm:()=>k(s),onCancel:a}),size:"small",color:"error",variant:"text",children:[e.jsx(Hn,{style:{fontSize:"1.2em"}}),c("common.delete")]})})}}}];return e.jsxs(sr,{children:[h.length?e.jsx(Wt,{locale:u,data:[...h],columns:m,verticalKeyWidth:100,options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}}):e.jsx(Bt,{sx:{minHeight:200},children:c("common.empty")}),g&&e.jsx(ge,{title:g.title,description:g.description,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})]})}const sr=z.div`
169
169
  margin-top: -20px;
170
- `;ct.propTypes={};ct.defaultProps={};var dt={},rr=Ot;Object.defineProperty(dt,"__esModule",{value:!0});var ln=dt.default=void 0,or=rr(_t()),ir=e;ln=dt.default=(0,or.default)((0,ir.jsx)("path",{d:"m17 7-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4z"}),"Logout");function mt({type:t,user:o,onIssuePassport:c,onRefresh:u}){const{teamDid:d,roles:h}=K(),{confirmHolder:S,confirmApi:p}=zt(),{t:b}=P.useContext(fe),[g,i]=P.useState(!1),{api:T}=q(),C=Ve(async()=>{await T.logoutUser({input:{teamDid:d,appPid:d,userDid:o.did}})});return e.jsxs(e.Fragment,{children:[S,e.jsx(us,{"data-cy":"member-actions",actions:[{icon:e.jsx(Se,{fontSize:"small"}),text:b("team.passport.issue"),"data-cy":"action-issue-passport",onClick:k=>{k.stopPropagation(),i(!0)}},({close:k})=>e.jsx(Re,{user:o,children:({open:a})=>e.jsxs(je,{dense:!0,onClick:I=>{I.stopPropagation(),k(),a(I)},"data-cy":"action-toggle-block",children:[e.jsx(Sn,{style:{minWidth:24,marginRight:8},children:o.approved?e.jsx(en,{}):e.jsx(tn,{})}),e.jsx(wn,{primary:o.approved?b("team.member.blockAccess"):b("team.member.allowAccess")})]})},"toggle-approval"),t==="blocklet"&&{icon:e.jsx(ln,{fontSize:"small"}),text:b("team.member.forceLogout"),onClick:k=>{k.stopPropagation(),p.open({title:b("team.member.forceLogout"),content:b("team.member.forceLogoutDescription"),confirmButtonText:b("common.confirm"),cancelButtonText:b("common.cancel"),onClick:a=>a.stopPropagation(),onConfirm:async()=>{await C(),await p.close(),u()}})}}].filter(Boolean)}),g&&e.jsx(Ae,{teamDid:d,ownerDid:o.did,needReceive:nn(o)===o.did,roles:h,onCancel:()=>i(!1),onSuccess:()=>{c(),i(!1)}})]})}mt.propTypes={type:v.oneOf(["server","blocklet"]).isRequired,user:v.object.isRequired,onIssuePassport:v.func,onRefresh:v.func};mt.defaultProps={onIssuePassport:()=>{},onRefresh:()=>{}};const Be="$all",Lt="$none",Et="$blocked",be=(t,o)=>{const c=t.find(u=>u.key===o);return(c==null?void 0:c.value)||0},ar=(t,o)=>{const c=t.passports||[];return c.length?!c.some(u=>{var d;return o.includes((d=u.issuer)==null?void 0:d.id)}):!1};function cn({user:t}){const{t:o}=P.useContext(fe),c=as(()=>({...t,avatar:`${t.avatar}?imageFilter=resize&w=48&h=48`}),[t]),u=e.jsxs("div",{className:"member-block",children:[e.jsxs("div",{className:"member-avatar",children:[e.jsx(Ft,{user:c,avatarSize:32,cardType:$t.AvatarOnly,showHoverCard:!1}),!t.approved&&e.jsx("did",{className:"badge-block"}),t.isFromExternal&&e.jsx(ue,{title:o("team.passport.externalPassport"),children:e.jsx(E,{ml:1,className:"icon",children:e.jsx(Qt,{})})})]}),e.jsxs("div",{className:"member-meta",children:[e.jsx("div",{className:"member-text",children:e.jsx(ps,{children:t.fullName})}),Array.isArray(t.tags)&&t.tags.length>0&&e.jsx("div",{className:"member-tags",children:t.tags.map(d=>e.jsx(Vt,{style:{background:d.color,color:Ht(d.color),marginRight:4},children:d.title},d.id))})]})]});return t.approved?u:e.jsx(E,{display:"flex",alignItems:"center",children:e.jsx(ue,{title:o("team.member.blockAccessDescription"),children:u})})}cn.propTypes={user:v.object.isRequired};function lr({type:t,createPassportSvg:o}){var yt,vt,bt,Ct;const{confirmApi:c,confirmHolder:u}=zt({sx:{".MuiDialog-paper":{borderRadius:2,maxWidth:1e3},".ux-dialog_title":{fontWeight:600},".ux-dialog_closeButton":{p:1},".MuiDialogActions-root":{display:{xs:"none",md:"flex"}}}}),{appIdList:d=[],blocklet:h}=qt(),{teamDid:S,invitations:p,teamIssuerDid:b,roles:g,refresh:i,enablePassportIssuance:T,endpoint:C,api:k}=K(),{api:a,inService:I,ws:{useSubscription:m},info:n}=q(),s=[],l=S===n.did?"":ss({blocklet:h});if(h){const f=(((vt=(yt=h.settings)==null?void 0:yt.federated)==null?void 0:vt.sites)||[]).find(N=>N.isMaster!==!1),j=(((Ct=(bt=h.settings)==null?void 0:bt.federated)==null?void 0:Ct.sites)||[]).find(N=>N.appId===h.appDid);if((j==null?void 0:j.status)==="approved"&&s.push({appId:f==null?void 0:f.appId,appName:f==null?void 0:f.appName,appDescription:f==null?void 0:f.appDescription,appLogo:f==null?void 0:f.appLogo,appPid:f==null?void 0:f.appPid,appUrl:f==null?void 0:f.appUrl,version:f==null?void 0:f.version,sourceAppPid:f==null?void 0:f.appPid,provider:"wallet"}),j)s.push({appId:(j==null?void 0:j.appId)||h.appDid,appName:j==null?void 0:j.appName,appDescription:j==null?void 0:j.appDescription,appLogo:j==null?void 0:j.appLogo,appPid:j==null?void 0:j.appPid,appUrl:j==null?void 0:j.appUrl,version:j==null?void 0:j.version,sourceAppPid:null,provider:"wallet"});else{const N=_s(h,void 0,{returnWallet:!1});s.push({appId:N.did,appName:N.name,appDescription:N.description,appLogo:Rn(N.appUrl,J.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),appPid:h==null?void 0:h.appPid,appUrl:N.appUrl,version:N.version,sourceAppPid:null,provider:"wallet"})}}const{t:r,locale:x}=P.useContext(fe),[y,w]=P.useState(!1),[_,F]=P.useState(!1),[R,D]=P.useState(!1),[O,A]=P.useState(!1),[H,G]=P.useState(!1),[Z,L]=P.useState([]),[B,Le]=P.useState(),[xe,dn]=P.useState([]),[ut]=Is({did:void 0}),pt=`members-${S}`,ft=Vn(pt),[U,ae]=P.useState({role:Be,searchText:ft.searchText||"",hideBlocked:!1,pageSize:ft.rowsPerPage||10,page:1});is(async()=>{if(ut.did){const{user:f}=await k.getUser({did:ut.did});f&&A(f)}});const ye=(g||[]).map(f=>({name:f.name,title:f.title,num:be(xe,f.name)}));ye.unshift({name:Be,title:"All Members",num:be(xe,Be)}),ye.push({name:Lt,title:"Other",num:be(xe,Lt)}),ye.push({name:Et,title:"Blocked",num:be(xe,Et)});const gt=()=>{const f={includeTags:!0,includeUserSessions:t==="blocklet"};U.hideBlocked&&(f.approved=!0),f.role=U.role,U.searchText&&(f.search=U.searchText),G(!0),k.getUsers({query:f,paging:{page:U.page,pageSize:U.pageSize}}).then(j=>{G(!1),(j.users||[]).forEach(N=>{N.isFromExternal=ar(N,Ln(d)?[b]:d),N.avatar=Yt(N.avatar,S,I),N.passports=(N.passports||[]).filter($=>$.issuer)}),L(j.users||[]),Le(j.paging.total)}).catch(j=>{G(!1),Y.error(j.message)})},ht=()=>{k.getUsersCountPerRole().then(f=>{dn(f.counts||[])}).catch(f=>{Y.error(f.message)})},Ee=f=>{f.teamDid===S&&(gt(),ht())};P.useEffect(()=>{gt()},[`${U.hideBlocked}-${U.role}-${U.page}-${U.pageSize}-${U.searchText}`]),P.useEffect(()=>{ht()},[]),m(X.TeamEvents.userUpdated,Ee,[U]),m(X.TeamEvents.userAdded,Ee,[U]);const mn=T,un=Ve(f=>{const j=async({page:N=1,pageSize:$=10,status:Ne}={})=>await a.getUserSessions({input:{teamDid:S,query:{userDid:f.did,appPid:S,status:Ne},paging:{pageSize:$,page:N}}});c.open({title:"User Sessions",content:e.jsx(Yn,{user:f,showAction:!1,showUser:!1,showOffline:!0,getUserSessions:j}),onConfirm(){c.close()},confirmButtonText:r("common.close"),showCancelButton:!1})}),pn=[{label:r("common.name"),name:"fullName",options:{customBodyRenderLite:f=>{const j=Z[f];return e.jsx("div",{"data-cy":`member-name-${j.fullName}`,children:e.jsx(cn,{user:j})},j.did)}}},{label:r("common.address"),name:"did",options:{customBodyRender:f=>e.jsx(Ze,{size:14,responsive:!1,compact:!0,copyable:!1,did:f})}},{label:r("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:f=>e.jsx(E,{sx:{minWidth:"100px"},children:e.jsx(Me,{value:f,locale:x})})}},{label:r("team.member.lastLoginIp"),name:"lastLoginIp",options:{customBodyRender:f=>f||"-"}},{label:r("team.member.source"),name:"sourceProvider",options:{customBodyRenderLite:f=>{const j=Z[f],N=j.sourceProvider||J.USER_TYPE.WALLET,$=X.PROVIDER_NAME[N]||N;return j.sourceAppPid?`${$} (${r("team.member.federated")})`:$}}},t==="blocklet"&&{label:r("team.member.activeUserSessions"),name:"userSessions",options:{customBodyRenderLite:f=>{const j=Z[f];return e.jsx(Pn,{onClick:N=>{N.stopPropagation(),un(j)},children:e.jsx(kn,{badgeContent:j==null?void 0:j.userSessionsCount,color:(j==null?void 0:j.userSessionsCount)>0?"primary":"default",sx:(j==null?void 0:j.userSessionsCount)>0?{}:{".MuiBadge-badge":{backgroundColor:"grey",color:"white"}},showZero:!0,children:e.jsx(Gn,{})})})}}},{label:r("common.actions"),name:"",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite:f=>{const j=Z[f];return e.jsx(ee,{permission:I?"":"mutate_team",role:I?re:[],children:e.jsx(mt,{type:t,user:j,onIssuePassport:()=>A({...j,initTab:"issuances"}),onRefresh:()=>Ee({teamDid:S})})})}}}].filter(Boolean),Oe=[];mn&&(Oe.push(e.jsxs(W,{variant:"outlined",style:{flexShrink:0,marginRight:16},color:"primary",size:"small",onClick:()=>{D(!0)},children:[e.jsx(xs,{style:{height:"1em",marginRight:4}}),r("common.inviting"),p.length?` (${p.length})`:""]}),e.jsx(ee,{permission:I?"":"mutate_team",role:I?re:[],children:e.jsxs(W,{style:{flexShrink:0,marginRight:16},variant:"contained",edge:"end",color:"primary",size:"small","data-cy":"invite-member",onClick:()=>w(!0),children:[e.jsx(Se,{style:{fontSize:"1.3em",marginRight:4}}),r("team.invite.action")]})})),t==="server"&&Oe.push(e.jsx(ee,{role:"owner",children:e.jsxs(W,{style:{flexShrink:0},variant:"contained",edge:"end",color:"error",size:"small","data-cy":"invite-member",onClick:()=>F(!0),children:[e.jsx(Gt,{style:{fontSize:"1.3em",marginRight:4}}),r("team.transferNode.name")]})})));const fn=f=>{H||ae(j=>({...j,role:f,hideBlocked:!1,searchText:"",page:1}))},gn=f=>{ae(j=>({...j,hideBlocked:f,page:1}))},hn=({page:f,rowsPerPage:j,searchText:N})=>{U.pageSize!==j?ae($=>({...$,pageSize:j,page:1})):U.page!==f+1?ae($=>({...$,page:f+1})):U.searchText!==N&&ae($=>({...$,searchText:N,page:1}))},xt=P.useRef(null),xn={sort:!1,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(f,{dataIndex:j},N){var $;if(($=xt.current)!=null&&$.contains(N.target)){const Ne=Z[j];A(Ne)}},page:U.page-1,rowsPerPage:U.pageSize,count:B,searchDebounceTime:600};return e.jsxs(cr,{children:[u,e.jsxs(E,{className:"main",display:"flex",gap:3,children:[e.jsx("div",{className:"left",children:e.jsx("div",{className:"tabs",children:ye.map(f=>e.jsxs("div",{className:`tab ${U.role===f.name?"active":""}`,onClick:()=>fn(f.name),children:[e.jsx("span",{className:"text",children:f.title}),e.jsx(E,{sx:{color:"text.secondary"},children:f.num})]},f.name))})}),e.jsx("div",{ref:xt,className:"right",children:e.jsx(Wt,{className:"main-table",verticalKeyWidth:100,locale:x,durable:pt,durableKeys:["page","rowsPerPage"],title:e.jsx("div",{className:"table-toolbar-left",children:e.jsx(In,{control:e.jsx(Tn,{sx:{display:"flex !important"},disabled:H,color:"primary",checked:U.hideBlocked,onChange:f=>gn(f.target.checked)}),label:r("team.member.onlyApprovedMember")})}),data:Z,columns:pn,customButtons:Oe,options:xn,loading:H,onChange:hn})})]}),e.jsx(se,{title:r("common.inviting"),onClose:()=>D(!1),open:R,maxWidth:"lg",fullWidth:!0,children:e.jsx(ct,{})}),O&&e.jsx(lt,{onCancel:()=>A(null),userDid:O.did,createPassportSvg:o,initTab:O.initTab}),y&&e.jsx(Je,{teamDid:S,endpoint:l||C,roles:g,apps:s,onCancel:()=>w(!1),onSuccess:()=>{i(),w(!1)}}),_&&e.jsx(Xe,{teamDid:S,endpoint:l||C,roles:g,onCancel:()=>F(!1),onSuccess:()=>{i(),F(!1)}})]})}const cr=z.div`
170
+ `;ct.propTypes={};ct.defaultProps={};var dt={},rr=Ot;Object.defineProperty(dt,"__esModule",{value:!0});var ln=dt.default=void 0,or=rr(Ut()),ir=e;ln=dt.default=(0,or.default)((0,ir.jsx)("path",{d:"m17 7-1.41 1.41L18.17 11H8v2h10.17l-2.58 2.58L17 17l5-5zM4 5h8V3H4c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h8v-2H4z"}),"Logout");function mt({type:t,user:o,onIssuePassport:c,onRefresh:u}){const{teamDid:d,roles:h}=K(),{confirmHolder:S,confirmApi:p}=zt(),{t:b}=P.useContext(fe),[g,i]=P.useState(!1),{api:T}=q(),C=Ve(async()=>{await T.logoutUser({input:{teamDid:d,appPid:d,userDid:o.did}})});return e.jsxs(e.Fragment,{children:[S,e.jsx(us,{"data-cy":"member-actions",actions:[{icon:e.jsx(Se,{fontSize:"small"}),text:b("team.passport.issue"),"data-cy":"action-issue-passport",onClick:k=>{k.stopPropagation(),i(!0)}},({close:k})=>e.jsx(Re,{user:o,children:({open:a})=>e.jsxs(je,{dense:!0,onClick:I=>{I.stopPropagation(),k(),a(I)},"data-cy":"action-toggle-block",children:[e.jsx(Sn,{style:{minWidth:24,marginRight:8},children:o.approved?e.jsx(en,{}):e.jsx(tn,{})}),e.jsx(wn,{primary:o.approved?b("team.member.blockAccess"):b("team.member.allowAccess")})]})},"toggle-approval"),t==="blocklet"&&{icon:e.jsx(ln,{fontSize:"small"}),text:b("team.member.forceLogout"),onClick:k=>{k.stopPropagation(),p.open({title:b("team.member.forceLogout"),content:b("team.member.forceLogoutDescription"),confirmButtonText:b("common.confirm"),cancelButtonText:b("common.cancel"),onClick:a=>a.stopPropagation(),onConfirm:async()=>{await C(),await p.close(),u()}})}}].filter(Boolean)}),g&&e.jsx(Ae,{teamDid:d,ownerDid:o.did,needReceive:nn(o)===o.did,roles:h,onCancel:()=>i(!1),onSuccess:()=>{c(),i(!1)}})]})}mt.propTypes={type:v.oneOf(["server","blocklet"]).isRequired,user:v.object.isRequired,onIssuePassport:v.func,onRefresh:v.func};mt.defaultProps={onIssuePassport:()=>{},onRefresh:()=>{}};const Be="$all",Lt="$none",Et="$blocked",be=(t,o)=>{const c=t.find(u=>u.key===o);return(c==null?void 0:c.value)||0},ar=(t,o)=>{const c=t.passports||[];return c.length?!c.some(u=>{var d;return o.includes((d=u.issuer)==null?void 0:d.id)}):!1};function cn({user:t}){const{t:o}=P.useContext(fe),c=as(()=>({...t,avatar:`${t.avatar}?imageFilter=resize&w=48&h=48`}),[t]),u=e.jsxs("div",{className:"member-block",children:[e.jsxs("div",{className:"member-avatar",children:[e.jsx(Ft,{user:c,avatarSize:32,cardType:$t.AvatarOnly,showHoverCard:!1}),!t.approved&&e.jsx("did",{className:"badge-block"}),t.isFromExternal&&e.jsx(ue,{title:o("team.passport.externalPassport"),children:e.jsx(E,{ml:1,className:"icon",children:e.jsx(Qt,{})})})]}),e.jsxs("div",{className:"member-meta",children:[e.jsx("div",{className:"member-text",children:e.jsx(ps,{children:t.fullName})}),Array.isArray(t.tags)&&t.tags.length>0&&e.jsx("div",{className:"member-tags",children:t.tags.map(d=>e.jsx(Vt,{style:{background:d.color,color:Ht(d.color),marginRight:4},children:d.title},d.id))})]})]});return t.approved?u:e.jsx(E,{display:"flex",alignItems:"center",children:e.jsx(ue,{title:o("team.member.blockAccessDescription"),children:u})})}cn.propTypes={user:v.object.isRequired};function lr({type:t,createPassportSvg:o}){var yt,vt,bt,Ct;const{confirmApi:c,confirmHolder:u}=zt({sx:{".MuiDialog-paper":{borderRadius:2,maxWidth:1e3},".ux-dialog_title":{fontWeight:600},".ux-dialog_closeButton":{p:1},".MuiDialogActions-root":{display:{xs:"none",md:"flex"}}}}),{appIdList:d=[],blocklet:h}=qt(),{teamDid:S,invitations:p,teamIssuerDid:b,roles:g,refresh:i,enablePassportIssuance:T,endpoint:C,api:k}=K(),{api:a,inService:I,ws:{useSubscription:m},info:n}=q(),s=[],l=S===n.did?"":ss({blocklet:h});if(h){const f=(((vt=(yt=h.settings)==null?void 0:yt.federated)==null?void 0:vt.sites)||[]).find(N=>N.isMaster!==!1),j=(((Ct=(bt=h.settings)==null?void 0:bt.federated)==null?void 0:Ct.sites)||[]).find(N=>N.appId===h.appDid);if((j==null?void 0:j.status)==="approved"&&s.push({appId:f==null?void 0:f.appId,appName:f==null?void 0:f.appName,appDescription:f==null?void 0:f.appDescription,appLogo:f==null?void 0:f.appLogo,appPid:f==null?void 0:f.appPid,appUrl:f==null?void 0:f.appUrl,version:f==null?void 0:f.version,sourceAppPid:f==null?void 0:f.appPid,provider:"wallet"}),j)s.push({appId:(j==null?void 0:j.appId)||h.appDid,appName:j==null?void 0:j.appName,appDescription:j==null?void 0:j.appDescription,appLogo:j==null?void 0:j.appLogo,appPid:j==null?void 0:j.appPid,appUrl:j==null?void 0:j.appUrl,version:j==null?void 0:j.version,sourceAppPid:null,provider:"wallet"});else{const N=Us(h,void 0,{returnWallet:!1});s.push({appId:N.did,appName:N.name,appDescription:N.description,appLogo:Rn(N.appUrl,J.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),appPid:h==null?void 0:h.appPid,appUrl:N.appUrl,version:N.version,sourceAppPid:null,provider:"wallet"})}}const{t:r,locale:x}=P.useContext(fe),[y,w]=P.useState(!1),[U,F]=P.useState(!1),[R,D]=P.useState(!1),[O,A]=P.useState(!1),[H,G]=P.useState(!1),[Z,L]=P.useState([]),[B,Le]=P.useState(),[xe,dn]=P.useState([]),[ut]=Is({did:void 0}),pt=`members-${S}`,ft=Vn(pt),[_,ae]=P.useState({role:Be,searchText:ft.searchText||"",hideBlocked:!1,pageSize:ft.rowsPerPage||10,page:1});is(async()=>{if(ut.did){const{user:f}=await k.getUser({did:ut.did});f&&A(f)}});const ye=(g||[]).map(f=>({name:f.name,title:f.title,num:be(xe,f.name)}));ye.unshift({name:Be,title:"All Members",num:be(xe,Be)}),ye.push({name:Lt,title:"Other",num:be(xe,Lt)}),ye.push({name:Et,title:"Blocked",num:be(xe,Et)});const gt=()=>{const f={includeTags:!0,includeUserSessions:t==="blocklet"};_.hideBlocked&&(f.approved=!0),f.role=_.role,_.searchText&&(f.search=_.searchText),G(!0),k.getUsers({query:f,paging:{page:_.page,pageSize:_.pageSize}}).then(j=>{G(!1),(j.users||[]).forEach(N=>{N.isFromExternal=ar(N,Ln(d)?[b]:d),N.avatar=Yt(N.avatar,S,I),N.passports=(N.passports||[]).filter($=>$.issuer)}),L(j.users||[]),Le(j.paging.total)}).catch(j=>{G(!1),Y.error(j.message)})},ht=()=>{k.getUsersCountPerRole().then(f=>{dn(f.counts||[])}).catch(f=>{Y.error(f.message)})},Ee=f=>{f.teamDid===S&&(gt(),ht())};P.useEffect(()=>{gt()},[`${_.hideBlocked}-${_.role}-${_.page}-${_.pageSize}-${_.searchText}`]),P.useEffect(()=>{ht()},[]),m(X.TeamEvents.userUpdated,Ee,[_]),m(X.TeamEvents.userAdded,Ee,[_]);const mn=T,un=Ve(f=>{const j=async({page:N=1,pageSize:$=10,status:Ne}={})=>await a.getUserSessions({input:{teamDid:S,query:{userDid:f.did,appPid:S,status:Ne},paging:{pageSize:$,page:N}}});c.open({title:"User Sessions",content:e.jsx(Yn,{user:f,showAction:!1,showUser:!1,showOffline:!0,getUserSessions:j}),onConfirm(){c.close()},confirmButtonText:r("common.close"),showCancelButton:!1})}),pn=[{label:r("common.name"),name:"fullName",options:{customBodyRenderLite:f=>{const j=Z[f];return e.jsx("div",{"data-cy":`member-name-${j.fullName}`,children:e.jsx(cn,{user:j})},j.did)}}},{label:r("common.address"),name:"did",options:{customBodyRender:f=>e.jsx(Ze,{size:14,responsive:!1,compact:!0,copyable:!1,did:f})}},{label:r("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:f=>e.jsx(E,{sx:{minWidth:"100px"},children:e.jsx(Me,{value:f,locale:x})})}},{label:r("team.member.lastLoginIp"),name:"lastLoginIp",options:{customBodyRender:f=>f||"-"}},{label:r("team.member.source"),name:"sourceProvider",options:{customBodyRenderLite:f=>{const j=Z[f],N=j.sourceProvider||J.USER_TYPE.WALLET,$=X.PROVIDER_NAME[N]||N;return j.sourceAppPid?`${$} (${r("team.member.federated")})`:$}}},t==="blocklet"&&{label:r("team.member.activeUserSessions"),name:"userSessions",options:{customBodyRenderLite:f=>{const j=Z[f];return e.jsx(Pn,{onClick:N=>{N.stopPropagation(),un(j)},children:e.jsx(kn,{badgeContent:j==null?void 0:j.userSessionsCount,color:(j==null?void 0:j.userSessionsCount)>0?"primary":"default",sx:(j==null?void 0:j.userSessionsCount)>0?{}:{".MuiBadge-badge":{backgroundColor:"grey",color:"white"}},showZero:!0,children:e.jsx(Gn,{})})})}}},{label:r("common.actions"),name:"",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite:f=>{const j=Z[f];return e.jsx(ee,{permission:I?"":"mutate_team",role:I?re:[],children:e.jsx(mt,{type:t,user:j,onIssuePassport:()=>A({...j,initTab:"issuances"}),onRefresh:()=>Ee({teamDid:S})})})}}}].filter(Boolean),Oe=[];mn&&(Oe.push(e.jsxs(W,{variant:"outlined",style:{flexShrink:0,marginRight:16},color:"primary",size:"small",onClick:()=>{D(!0)},children:[e.jsx(xs,{style:{height:"1em",marginRight:4}}),r("common.inviting"),p.length?` (${p.length})`:""]}),e.jsx(ee,{permission:I?"":"mutate_team",role:I?re:[],children:e.jsxs(W,{style:{flexShrink:0,marginRight:16},variant:"contained",edge:"end",color:"primary",size:"small","data-cy":"invite-member",onClick:()=>w(!0),children:[e.jsx(Se,{style:{fontSize:"1.3em",marginRight:4}}),r("team.invite.action")]})})),t==="server"&&Oe.push(e.jsx(ee,{role:"owner",children:e.jsxs(W,{style:{flexShrink:0},variant:"contained",edge:"end",color:"error",size:"small","data-cy":"invite-member",onClick:()=>F(!0),children:[e.jsx(Gt,{style:{fontSize:"1.3em",marginRight:4}}),r("team.transferNode.name")]})})));const fn=f=>{H||ae(j=>({...j,role:f,hideBlocked:!1,searchText:"",page:1}))},gn=f=>{ae(j=>({...j,hideBlocked:f,page:1}))},hn=({page:f,rowsPerPage:j,searchText:N})=>{_.pageSize!==j?ae($=>({...$,pageSize:j,page:1})):_.page!==f+1?ae($=>({...$,page:f+1})):_.searchText!==N&&ae($=>({...$,searchText:N,page:1}))},xt=P.useRef(null),xn={sort:!1,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(f,{dataIndex:j},N){var $;if(($=xt.current)!=null&&$.contains(N.target)){const Ne=Z[j];A(Ne)}},page:_.page-1,rowsPerPage:_.pageSize,count:B,searchDebounceTime:600};return e.jsxs(cr,{children:[u,e.jsxs(E,{className:"main",display:"flex",gap:3,children:[e.jsx("div",{className:"left",children:e.jsx("div",{className:"tabs",children:ye.map(f=>e.jsxs("div",{className:`tab ${_.role===f.name?"active":""}`,onClick:()=>fn(f.name),children:[e.jsx("span",{className:"text",children:f.title}),e.jsx(E,{sx:{color:"text.secondary"},children:f.num})]},f.name))})}),e.jsx("div",{ref:xt,className:"right",children:e.jsx(Wt,{className:"main-table",verticalKeyWidth:100,locale:x,durable:pt,durableKeys:["page","rowsPerPage"],title:e.jsx("div",{className:"table-toolbar-left",children:e.jsx(In,{control:e.jsx(Tn,{sx:{display:"flex !important"},disabled:H,color:"primary",checked:_.hideBlocked,onChange:f=>gn(f.target.checked)}),label:r("team.member.onlyApprovedMember")})}),data:Z,columns:pn,customButtons:Oe,options:xn,loading:H,onChange:hn})})]}),e.jsx(se,{title:r("common.inviting"),onClose:()=>D(!1),open:R,maxWidth:"lg",fullWidth:!0,children:e.jsx(ct,{})}),O&&e.jsx(lt,{onCancel:()=>A(null),userDid:O.did,createPassportSvg:o,initTab:O.initTab}),y&&e.jsx(Je,{teamDid:S,endpoint:l||C,roles:g,apps:s,onCancel:()=>w(!1),onSuccess:()=>{i(),w(!1)}}),U&&e.jsx(Xe,{teamDid:S,endpoint:l||C,roles:g,onCancel:()=>F(!1),onSuccess:()=>{i(),F(!1)}})]})}const cr=z.div`
171
171
  .main {
172
172
  .left {
173
173
  width: 256px;
@@ -1,4 +1,4 @@
1
- import{r as k}from"./vendor-react-DEoibe3W.js";import{a as D,$ as R,k as L,B as z,bb as ke,ar as pe,b_ as M,a3 as Ke,aI as re,bs as me,bt as ue,bu as xe,bH as Te,cf as ve,bd as Ae,ac as we,a5 as Se}from"./vendor-ux-did-connect-CX7qG3_M.js";import{d as De}from"./Edit-hd-cDU5C.js";import{f as Ie}from"./index-8eXqqyHQ.js";import{r as ye}from"./passport-item-DEX2NwJD.js";import{D as _,n as F,aN as Re,G as $e,f as Be}from"./index-DQjZ74P0.js";import{u as N}from"./dashboard-B7qE-Md0.js";import{j as e,H as u,bp as V,bs as G,bo as X,q as Q,aa as y,al as J,O as H,ab as _e,bt as Ne,bS as Ee,ah as E,T as B,ad as le,ak as Pe}from"./vendor-mui-core-wlbruq2I.js";import{v as Le,K as We}from"./vendor-arcblock-B4hgrXYM.js";import{T as fe}from"./index-B4FABIlz.js";import{C as he}from"./confirm-BjCmRSAF.js";import{a1 as qe}from"./vendor-utils-B3iZkn2R.js";import{C as O}from"./click-to-copy-BUVqg1RQ.js";import{D as Ue}from"./delete-confirm-Dow_C0jR.js";import{P as ze}from"./permission-B7ZHEOJv.js";import{B as Me}from"./bundle-avatar-D28BGkcC.js";import{W as Fe}from"./did-address-bJAfhuZx.js";import{A as He}from"./actions-DtL6bYnA.js";import{u as Oe}from"./use-mobile-CiFFAdJf.js";import{T as de}from"./table-tips-Czrj7r52.js";import{y as Ve}from"./vendor-hooks-BCm626KH.js";import"./lottie-web-jYmAQWuC.js";import"./util-CS4PqVkK.js";import"./base32-CmYq1ikq.js";import"./useLocalStorage-BF3BqN1O.js";import"./PlayArrow-B_ZNrQDa.js";import"./get-safe-url-BWDUV79Q.js";import"./session-1k8BRnYA.js";import"./use-blocklet-logo-6YMz11ob.js";import"./InfoOutlined-CLiL5VeK.js";import"./dot-BID2dzD_.js";import"./useAsync-B6ZHbOEG.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CXU9YBvX.js";import"./vendor-mui-x-BKgL6hAa.js";import"./AdapterDayjs-BXVfASrK.js";import"./MoreHoriz-9E3q8aHi.js";function Y({value:t}){const{t:s,locale:l}=D(),c=new Date;return new Date(t)<c?e.jsxs("span",{style:{color:"red"},children:[e.jsx(R,{value:t,locale:l}),`${s("setting.accessKey.expired",{time:""})}`]}):e.jsx(R,{value:t,locale:l,type:"all"})}Y.propTypes={value:u.string.isRequired};function Z({value:t,onChange:s,...l}){const{t:c}=D(),d=k.useMemo(()=>[{value:"signature",title:c("setting.accessKey.signature"),description:c("setting.accessKey.signatureDesc")},{value:"simple",title:c("setting.accessKey.simple"),description:c("setting.accessKey.simpleDesc")}],[c]);return e.jsxs(V,{style:{width:"100%"},variant:"outlined",...l,children:[e.jsx(G,{children:c("setting.accessKey.authType")}),e.jsx(X,{value:t,onChange:s,fullWidth:!0,label:c("setting.accessKey.authType"),children:d.map(n=>e.jsx(Q,{value:n.value,children:e.jsxs(y,{children:[e.jsx("span",{children:n.title}),e.jsx(y,{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal",children:n.description})]})},n.value))})]})}Z.propTypes={value:u.string.isRequired,onChange:u.func.isRequired};const W=()=>{const t=L.RBAC_CONFIG.roles.filter(d=>d.passport),{inService:s}=_(),{roles:l}=N(),c=[...t,...s?l:[]];return qe(c,"name").filter(d=>d.name!==L.ROLES.OWNER)};function ee(t){const{remark:s,onCreate:l}=t,{api:c}=_(),{teamDid:d}=N(),{t:n}=D(),[K,j]=k.useState(!1),[x,C]=k.useState(null),p=W(),f=()=>{j(!1),C(null)},g=async i=>{const{remark:v,passport:h,authType:o}=i;j(!0);const m=await c.createAccessKey({input:{teamDid:d,remark:v.trim(),passport:h,expireAt:i.expireAt?new Date(i.expireAt).getTime():null,authType:o}}),{data:S}=m;l(S),C(null),j(!1)},b={title:`${n("common.create")} ${n("accessKey")}`,description:(i,v,h)=>e.jsxs(J,{gap:3,children:[e.jsx(H,{label:n("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:i.remark,onChange:o=>{v({...i,remark:o.target.value,__disableConfirm:!i.passport||!o.target.value.trim()}),o.target.value.trim()?h(""):h(n("setting.accessKey.remarkInvalid"))}}),e.jsxs(V,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:n("setting.accessKey.passport")}),e.jsx(X,{"data-cy":"create-access-key-select-passport",value:i.passport,onChange:o=>{const m=o.target.value;h(null),v({...i,passport:m,__disableConfirm:!i.remark||!m})},fullWidth:!0,label:n("setting.accessKey.passport"),disabled:K,children:p.map(o=>e.jsx(Q,{value:o.name,"data-cy":`create-access-key-passport-option-${o.name}`,children:e.jsxs(y,{children:[e.jsx("span",{children:o.title||o.name}),e.jsx(y,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:o.description})]})},o.name))})]}),e.jsx(Z,{value:i.authType,onChange:o=>{v({...i,authType:o.target.value})}}),e.jsx(fe,{placeholder:n("setting.accessKey.expireTime"),value:i.expireAt,onChange:o=>{v({...i,expireAt:o,__disableConfirm:!i.passport||!i.remark||!o})}})]}),confirm:n("common.confirm"),cancel:n("common.cancel"),color:"primary",params:{remark:s,authType:"signature",__disableConfirm:!s.trim()},onConfirm:g,onCancel:f};return e.jsxs(e.Fragment,{children:[e.jsxs(z,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>C(b),className:"rule-action",children:[K?e.jsx(_e,{size:16}):e.jsx(Le,{style:{fontSize:16}}),n("common.create")]}),x&&e.jsx(he,{title:x.title,description:x.description,confirm:x.confirm,color:x.color,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}ee.propTypes={remark:u.string,onCreate:u.func};ee.defaultProps={onCreate:()=>{},remark:""};function te(t){const{onConfirm:s,accessKeyId:l,accessKeySecret:c,hideSecret:d}=t,{t:n}=k.useContext(ke),[K,j]=k.useState(!1),[x,C]=k.useState(()=>d),p=()=>{C(!x)},f=i=>{j(i.target.checked)},g=k.useMemo(()=>{var i,v,h,o;return d?`const Client = require('@abtnode/client');
1
+ import{r as k}from"./vendor-react-DEoibe3W.js";import{a as D,$ as R,k as L,B as z,bb as ke,ar as pe,b_ as M,a3 as Ke,aI as re,bs as me,bt as ue,bu as xe,bH as Te,cf as ve,bd as Ae,ac as we,a5 as Se}from"./vendor-ux-did-connect-CX7qG3_M.js";import{d as De}from"./Edit-hd-cDU5C.js";import{f as Ie}from"./index-8eXqqyHQ.js";import{r as ye}from"./passport-item-CoNRdRpk.js";import{D as _,n as F,aN as Re,G as $e,f as Be}from"./index-B18R5SlV.js";import{u as N}from"./dashboard-k0XcV2m5.js";import{j as e,H as u,bp as V,bs as G,bo as X,q as Q,aa as y,al as J,O as H,ab as _e,bt as Ne,bS as Ee,ah as E,T as B,ad as le,ak as Pe}from"./vendor-mui-core-wlbruq2I.js";import{v as Le,K as We}from"./vendor-arcblock-B4hgrXYM.js";import{T as fe}from"./index-DO-a7P7z.js";import{C as he}from"./confirm-Bay3BcpN.js";import{a1 as qe}from"./vendor-utils-B3iZkn2R.js";import{C as O}from"./click-to-copy-BUVqg1RQ.js";import{D as Ue}from"./delete-confirm-B1F5wKdb.js";import{P as ze}from"./permission-B7ZHEOJv.js";import{B as Me}from"./bundle-avatar-C41ZXEbR.js";import{W as Fe}from"./did-address-bJAfhuZx.js";import{A as He}from"./actions-DtL6bYnA.js";import{u as Oe}from"./use-mobile-CXU9YBvX.js";import{T as de}from"./table-tips-Czrj7r52.js";import{y as Ve}from"./vendor-hooks-BCm626KH.js";import"./lottie-web-jYmAQWuC.js";import"./util-CS4PqVkK.js";import"./base32-CmYq1ikq.js";import"./useLocalStorage-BF3BqN1O.js";import"./PlayArrow-B_ZNrQDa.js";import"./get-safe-url-CwT4-jkw.js";import"./session-1k8BRnYA.js";import"./use-blocklet-logo-DGSQQmh2.js";import"./InfoOutlined-CLiL5VeK.js";import"./dot-DR7_m3Np.js";import"./useAsync-BMCqtJH2.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CiFFAdJf.js";import"./vendor-mui-x-BKgL6hAa.js";import"./AdapterDayjs-BXVfASrK.js";import"./MoreHoriz-9E3q8aHi.js";function Y({value:t}){const{t:s,locale:l}=D(),c=new Date;return new Date(t)<c?e.jsxs("span",{style:{color:"red"},children:[e.jsx(R,{value:t,locale:l}),`${s("setting.accessKey.expired",{time:""})}`]}):e.jsx(R,{value:t,locale:l,type:"all"})}Y.propTypes={value:u.string.isRequired};function Z({value:t,onChange:s,...l}){const{t:c}=D(),d=k.useMemo(()=>[{value:"signature",title:c("setting.accessKey.signature"),description:c("setting.accessKey.signatureDesc")},{value:"simple",title:c("setting.accessKey.simple"),description:c("setting.accessKey.simpleDesc")}],[c]);return e.jsxs(V,{style:{width:"100%"},variant:"outlined",...l,children:[e.jsx(G,{children:c("setting.accessKey.authType")}),e.jsx(X,{value:t,onChange:s,fullWidth:!0,label:c("setting.accessKey.authType"),children:d.map(n=>e.jsx(Q,{value:n.value,children:e.jsxs(y,{children:[e.jsx("span",{children:n.title}),e.jsx(y,{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal",children:n.description})]})},n.value))})]})}Z.propTypes={value:u.string.isRequired,onChange:u.func.isRequired};const W=()=>{const t=L.RBAC_CONFIG.roles.filter(d=>d.passport),{inService:s}=_(),{roles:l}=N(),c=[...t,...s?l:[]];return qe(c,"name").filter(d=>d.name!==L.ROLES.OWNER)};function ee(t){const{remark:s,onCreate:l}=t,{api:c}=_(),{teamDid:d}=N(),{t:n}=D(),[K,j]=k.useState(!1),[x,C]=k.useState(null),p=W(),f=()=>{j(!1),C(null)},g=async i=>{const{remark:v,passport:h,authType:o}=i;j(!0);const m=await c.createAccessKey({input:{teamDid:d,remark:v.trim(),passport:h,expireAt:i.expireAt?new Date(i.expireAt).getTime():null,authType:o}}),{data:S}=m;l(S),C(null),j(!1)},b={title:`${n("common.create")} ${n("accessKey")}`,description:(i,v,h)=>e.jsxs(J,{gap:3,children:[e.jsx(H,{label:n("setting.accessKey.tip"),autoComplete:"off",variant:"outlined",name:"remark",inputProps:{"data-cy":"remark-input"},fullWidth:!0,autoFocus:!0,margin:"dense",value:i.remark,onChange:o=>{v({...i,remark:o.target.value,__disableConfirm:!i.passport||!o.target.value.trim()}),o.target.value.trim()?h(""):h(n("setting.accessKey.remarkInvalid"))}}),e.jsxs(V,{style:{width:"100%"},variant:"outlined",children:[e.jsx(G,{children:n("setting.accessKey.passport")}),e.jsx(X,{"data-cy":"create-access-key-select-passport",value:i.passport,onChange:o=>{const m=o.target.value;h(null),v({...i,passport:m,__disableConfirm:!i.remark||!m})},fullWidth:!0,label:n("setting.accessKey.passport"),disabled:K,children:p.map(o=>e.jsx(Q,{value:o.name,"data-cy":`create-access-key-passport-option-${o.name}`,children:e.jsxs(y,{children:[e.jsx("span",{children:o.title||o.name}),e.jsx(y,{maxWidth:440,fontSize:12,color:"#999",whiteSpace:"normal",textAlign:"justify",children:o.description})]})},o.name))})]}),e.jsx(Z,{value:i.authType,onChange:o=>{v({...i,authType:o.target.value})}}),e.jsx(fe,{placeholder:n("setting.accessKey.expireTime"),value:i.expireAt,onChange:o=>{v({...i,expireAt:o,__disableConfirm:!i.passport||!i.remark||!o})}})]}),confirm:n("common.confirm"),cancel:n("common.cancel"),color:"primary",params:{remark:s,authType:"signature",__disableConfirm:!s.trim()},onConfirm:g,onCancel:f};return e.jsxs(e.Fragment,{children:[e.jsxs(z,{sx:{color:"common.white"},edge:"end",variant:"contained",color:"primary","data-cy":"add-access-key-btn",onClick:()=>C(b),className:"rule-action",children:[K?e.jsx(_e,{size:16}):e.jsx(Le,{style:{fontSize:16}}),n("common.create")]}),x&&e.jsx(he,{title:x.title,description:x.description,confirm:x.confirm,color:x.color,cancel:x.cancel,params:x.params,onConfirm:x.onConfirm,onCancel:x.onCancel})]})}ee.propTypes={remark:u.string,onCreate:u.func};ee.defaultProps={onCreate:()=>{},remark:""};function te(t){const{onConfirm:s,accessKeyId:l,accessKeySecret:c,hideSecret:d}=t,{t:n}=k.useContext(ke),[K,j]=k.useState(!1),[x,C]=k.useState(()=>d),p=()=>{C(!x)},f=i=>{j(i.target.checked)},g=k.useMemo(()=>{var i,v,h,o;return d?`const Client = require('@abtnode/client');
2
2
  const ensureServerEndpoint = require('@abtnode/util/lib/ensure-server-endpoint');
3
3
  const { joinURL } = require('ufo');
4
4
 
@@ -1,4 +1,4 @@
1
- import{a as se,a3 as _,cc as Me,cd as Ve,I as K,ca as $e,cb as Ne,ai as He,ah as Je,ce as Ke,bd as Ce,k as oe,r as Ae,bb as G,cf as xe,ar as ge,B as z,b_ as Ge,ab as Ze,cg as Xe,ac as Ye,a8 as Qe,a5 as et,ax as De}from"./vendor-ux-did-connect-CX7qG3_M.js";import{u as p,a as ae,b as te,c as tt}from"./vendor-hooks-BCm626KH.js";import{r as P}from"./vendor-react-DEoibe3W.js";import{j as e,aa as u,bt as U,bp as E,O,y as $,H,T as ne,I as ie,X as le,ah as Oe,al as V,cG as nt,a9 as Be,e as je,ab as fe,a7 as ze,ad as st,ap as at}from"./vendor-mui-core-wlbruq2I.js";import{Z as rt,v as qe,B as ot,c as it}from"./vendor-arcblock-B4hgrXYM.js";import{J as Y,a9 as lt,c as Fe,D as ct,n as X,aJ as dt,A as ut,b as mt}from"./vendor-utils-B3iZkn2R.js";import{D as J,G as N,aC as re,aD as I,aL as Re}from"./index-DQjZ74P0.js";import{S as ce}from"./switch-control-CzaI2YNK.js";import{S as C}from"./section-Bb547IGJ.js";import{K as pt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as ht}from"./index-BnR8uU0R.js";import{b as xt}from"./base32-CmYq1ikq.js";import{u as ft}from"./use-mobile-CiFFAdJf.js";import"./lottie-web-jYmAQWuC.js";const de={enabled:!1,domain:"",clientId:"",clientSecret:""};function gt(){var v,S,i;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(v=o==null?void 0:o.meta)==null?void 0:v.did,w=Object.assign({...de},((i=(S=o==null?void 0:o.settings)==null?void 0:S.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async r=>{var L,a;try{const{blocklet:b}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:r})}}),m=Object.assign({...de},((a=(L=b==null?void 0:b.settings)==null?void 0:L.oauth)==null?void 0:a.auth0)||{});l(m),_.success(n("oauth.saveSuccess"))}catch(b){_.error(b.message||n("oauth.saveFailed"))}}),T=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.domainDescription")),x=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientSecretDescription")),y=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:r})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:r.value,...r})})})}),e.jsx(C,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?T:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?x:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?g:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,clientId:"",clientSecret:""};function jt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...ue},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),b=Object.assign({...ue},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.github)||{});l(b),_.success(n("oauth.saveSuccess"))}catch(a){_.error(a.message||n("oauth.saveFailed"))}}),T=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.github.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.github.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const me={enabled:!1,clientId:"",clientSecret:""};function bt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...me},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(me))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),b=Object.assign({...me},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.google)||{});l(b),_.success(n("oauth.saveSuccess"))}catch(a){_.error(a.message||n("oauth.saveFailed"))}}),T=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.google.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.google.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function vt(){var i,r,L;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(i=o==null?void 0:o.meta)==null?void 0:i.did,w=Object.assign({...pe},((L=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:L.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(pe))}),d=h("enabled"),k=p(async a=>{var b,m;try{const{blocklet:R}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({apple:a})}}),A=Object.assign({...pe},((m=(b=R==null?void 0:R.settings)==null?void 0:b.oauth)==null?void 0:m.apple)||{});l(A),_.success(n("oauth.saveSuccess"))}catch(R){_.error(R.message||n("oauth.saveFailed"))}}),T=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.keyIdDescription")),y=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.authKeyDescription")),v=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.bundleIdDescription")),S=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:a})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(C,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?T:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.bundleId"),children:e.jsx(I,{name:"bundleId",control:f,rules:{validate:d?v:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.serviceId"),children:e.jsx(I,{name:"serviceId",control:f,rules:{validate:d?x:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.keyId"),children:e.jsx(I,{name:"keyId",control:f,rules:{validate:d?g:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.authKey"),children:e.jsx(I,{name:"authKey",control:f,rules:{validate:d?y:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const yt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function be({title:j,id:o,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=P.useState(t),l=P.useRef(null),d=P.useRef(null),[{handlerId:k},T]=Me({accept:"dragItem",collect(S){return{handlerId:S.getHandlerId()}},hover(S,i){var M,Q;if(!l.current)return;const r=S.index,L=s;if(r===L)return;const a=(M=l.current)==null?void 0:M.getBoundingClientRect(),b=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),m=(b.bottom-b.top)/2,A=i.getClientOffset().y-a.top;r<L&&A<m||r>L&&A>m||(w(r,L),S.index=L)}}),[{isDragging:x},g]=Ve({item:{index:s,type:"dragItem"},collect:S=>({isDragging:S.isDragging()}),end:f});g(d),T(l);const y=x?.5:1,v=p(S=>{S.preventDefault(),S.stopPropagation(),h(!c)});return e.jsxs(u,{ref:l,children:[e.jsxs(u,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(u,{sx:{py:2,px:1,opacity:y,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:v,children:[e.jsx(u,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:yt})}),e.jsx(ne,{sx:{flex:1},children:j}),e.jsx(ie,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:pt,style:{transform:"scale(1.5)"}})})]}),e.jsx(le,{})]}),e.jsx(u,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:H.string.isRequired,id:H.string.isRequired,children:H.node.isRequired,index:H.number.isRequired,onMove:H.func.isRequired,onEnd:H.func.isRequired,defaultExpand:H.bool};be.defaultProps={defaultExpand:!1};const St=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:rt}),component:e.jsx(jt,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:He}),component:e.jsx(bt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:Je}),component:e.jsx(vt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ke}),component:e.jsx(gt,{})}],wt=["github","google","apple","auth0"];function kt(){var k,T;const{api:j}=J(),{blocklet:o}=N(),n=(k=o==null?void 0:o.meta)==null?void 0:k.did,s=((T=o==null?void 0:o.settings)==null?void 0:T.oauth)||{},w=Object.keys(s).sort((x,g)=>{var y,v,S;return((y=s[x])==null?void 0:y.order)!==void 0&&((v=s[g])==null?void 0:v.order)!==void 0?s[x].order-s[g].order:((S=s[x])==null?void 0:S.order)!==void 0?-1:1});for(const x of wt)w.includes(x)||w.push(x);const t=ae(w.reduce((x,g,y)=>Object.assign(x,{[g]:y}),{})),f=te(()=>{const x=[...St];return x.sort((g,y)=>t[g.name]-t[y.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(y=>{g[y]={order:x[y]}}),await j.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const y=f[x],v=f[g];t[y.name]=g,t[v.name]=x}),d=p(async()=>{await h(t)});return e.jsx(u,{sx:{".section-left":{width:"160px"}},children:e.jsx($e,{backend:Ne,...c,children:f.map((x,g)=>e.jsx(be,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const Z={ttl:oe.SESSION_TTL,cacheTtl:oe.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]}};function W(j){return e.jsx(ot,{...j,sx:{transform:"scale(0.75)"}})}function he(j,o=!1){const n=o?j.ttl*86400:j.ttl/86400;return{...j,ttl:n}}function Lt(){var a,b;const{api:j}=J(),{blocklet:o}=N(),n=(a=o==null?void 0:o.meta)==null?void 0:a.did,s=lt({},Z,((b=o==null?void 0:o.settings)==null?void 0:b.session)||{});Fe(s.ttl)&&(s.ttl=Z.ttl),Fe(s.cacheTtl)&&(s.cacheTtl=Z.cacheTtl),s.phone||(s.phone=Z.phone),s.email||(s.email=Z.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=re({defaultValues:Y(he(s),["ttl","cacheTtl","email","phone"])}),{t:l}=se(),d=h("email.enabled"),k=h("phone.enabled"),T=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:y,remove:v}=Re({control:t,name:"email.domainBlackList"}),{fields:S,append:i,remove:r}=Re({control:t,name:"email.domainWhiteList"}),L=p(async m=>{var R;try{const{blocklet:A}=await j.updateAppSessionConfig({input:{did:n,config:ct(he(m,!0),["phone"])}}),M=Object.assign({},Z,Y(((R=A==null?void 0:A.settings)==null?void 0:R.session)||{},["ttl","cacheTtl","email","phone"]));c(he(M)),_.success(l("common.configSuccess"))}catch(A){_.error(A.message)}});return e.jsx(Tt,{onSubmit:w(L),children:e.jsxs(V,{direction:"column",gap:6,children:[e.jsxs(u,{children:[e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(u,{component:le,my:3})]}),e.jsxs(V,{gap:2,children:[e.jsx(C,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:m})=>e.jsx(W,{...m,checked:m.value})})})}),d&&e.jsxs(V,{direction:"column",ml:2,children:[e.jsx(C,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),T&&e.jsxs(u,{children:[g.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainBlackList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>v(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>y(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(C,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),x&&e.jsxs(u,{children:[S.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainWhiteList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>r(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(C,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),k&&e.jsxs(V,{direction:"column",ml:2,mt:1,children:[e.jsx(C,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:m})=>e.jsx(U,{control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:m})=>e.jsx(U,{control:e.jsx(W,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(u,{component:le,my:3}),e.jsx(V,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:m})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(C,{title:l("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{width:"100%",maxWidth:500,px:1.5},children:e.jsx(nt,{...m,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsx(u,{children:e.jsx($,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const Tt=Oe.form`
1
+ import{a as se,a3 as _,cc as Me,cd as Ve,I as K,ca as $e,cb as Ne,ai as He,ah as Je,ce as Ke,bd as Ce,k as oe,r as Ae,bb as G,cf as xe,ar as ge,B as z,b_ as Ge,ab as Ze,cg as Xe,ac as Ye,a8 as Qe,a5 as et,ax as De}from"./vendor-ux-did-connect-CX7qG3_M.js";import{u as p,a as ae,b as te,c as tt}from"./vendor-hooks-BCm626KH.js";import{r as P}from"./vendor-react-DEoibe3W.js";import{j as e,aa as u,bt as U,bp as E,O,y as $,H,T as ne,I as ie,X as le,ah as Oe,al as V,cG as nt,a9 as Be,e as je,ab as fe,a7 as ze,ad as st,ap as at}from"./vendor-mui-core-wlbruq2I.js";import{Z as rt,v as qe,B as ot,c as it}from"./vendor-arcblock-B4hgrXYM.js";import{J as Y,a9 as lt,c as Fe,D as ct,n as X,aJ as dt,A as ut,b as mt}from"./vendor-utils-B3iZkn2R.js";import{D as J,G as N,aC as re,aD as I,aL as Re}from"./index-B18R5SlV.js";import{S as ce}from"./switch-control-CzaI2YNK.js";import{S as C}from"./section-Bb547IGJ.js";import{K as pt}from"./keyboard-arrow-down-rounded-DadBVmpO.js";import{I as ht}from"./index-BnR8uU0R.js";import{b as xt}from"./base32-CmYq1ikq.js";import{u as ft}from"./use-mobile-CXU9YBvX.js";import"./lottie-web-jYmAQWuC.js";const de={enabled:!1,domain:"",clientId:"",clientSecret:""};function gt(){var v,S,i;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(v=o==null?void 0:o.meta)==null?void 0:v.did,w=Object.assign({...de},((i=(S=o==null?void 0:o.settings)==null?void 0:S.oauth)==null?void 0:i.auth0)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(de))}),d=h("enabled"),k=p(async r=>{var L,a;try{const{blocklet:b}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({auth0:r})}}),m=Object.assign({...de},((a=(L=b==null?void 0:b.settings)==null?void 0:L.oauth)==null?void 0:a.auth0)||{});l(m),_.success(n("oauth.saveSuccess"))}catch(b){_.error(b.message||n("oauth.saveFailed"))}}),T=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.domainDescription")),x=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientIdDescription")),g=p(r=>r!=null&&r.trim()?!0:n("oauth.auth0.clientSecretDescription")),y=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.auth0.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:r})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:r.value,...r})})})}),e.jsx(C,{title:n("oauth.auth0.domain"),children:e.jsx(I,{name:"domain",control:f,rules:{validate:d?T:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.domain"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?x:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",label:n("oauth.auth0.clientId"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.auth0.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?g:y},render:({field:r})=>{var L;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...r,size:"small",type:"password",label:n("oauth.auth0.clientSecret"),error:!!c.errors[r.name],helperText:((L=c.errors[r.name])==null?void 0:L.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const ue={enabled:!1,clientId:"",clientSecret:""};function jt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...ue},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.github)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(ue))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({github:i})}}),b=Object.assign({...ue},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.github)||{});l(b),_.success(n("oauth.saveSuccess"))}catch(a){_.error(a.message||n("oauth.saveFailed"))}}),T=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.github.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.github.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.github.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.github.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.github.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.github.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const me={enabled:!1,clientId:"",clientSecret:""};function bt(){var y,v,S;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(y=o==null?void 0:o.meta)==null?void 0:y.did,w=Object.assign({...me},((S=(v=o==null?void 0:o.settings)==null?void 0:v.oauth)==null?void 0:S.google)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(me))}),d=h("enabled"),k=p(async i=>{var r,L;try{const{blocklet:a}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({google:i})}}),b=Object.assign({...me},((L=(r=a==null?void 0:a.settings)==null?void 0:r.oauth)==null?void 0:L.google)||{});l(b),_.success(n("oauth.saveSuccess"))}catch(a){_.error(a.message||n("oauth.saveFailed"))}}),T=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientIdDescription")),x=p(i=>i!=null&&i.trim()?!0:n("oauth.google.clientSecretDescription")),g=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.google.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:i})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(C,{title:n("oauth.google.clientId"),children:e.jsx(I,{name:"clientId",control:f,rules:{validate:d?T:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",label:n("oauth.google.clientId"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.google.clientSecret"),children:e.jsx(I,{name:"clientSecret",control:f,rules:{validate:d?x:g},render:({field:i})=>{var r;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...i,size:"small",type:"password",label:n("oauth.google.clientSecret"),error:!!c.errors[i.name],helperText:((r=c.errors[i.name])==null?void 0:r.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const pe={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function vt(){var i,r,L;const{api:j}=J(),{blocklet:o}=N(),{t:n}=se(),s=(i=o==null?void 0:o.meta)==null?void 0:i.did,w=Object.assign({...pe},((L=(r=o==null?void 0:o.settings)==null?void 0:r.oauth)==null?void 0:L.apple)||{}),{handleSubmit:t,control:f,formState:c,watch:h,reset:l}=re({defaultValues:Y(w,Object.keys(pe))}),d=h("enabled"),k=p(async a=>{var b,m;try{const{blocklet:R}=await j.configOAuth({input:{did:s,oauth:JSON.stringify({apple:a})}}),A=Object.assign({...pe},((m=(b=R==null?void 0:R.settings)==null?void 0:b.oauth)==null?void 0:m.apple)||{});l(A),_.success(n("oauth.saveSuccess"))}catch(R){_.error(R.message||n("oauth.saveFailed"))}}),T=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.teamIdDescription")),x=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.serviceIdDescription")),g=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.keyIdDescription")),y=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.authKeyDescription")),v=p(a=>a!=null&&a.trim()?!0:n("oauth.apple.bundleIdDescription")),S=p(()=>!0);return e.jsx(u,{children:e.jsxs("form",{onSubmit:t(k),disabled:!0,children:[e.jsx(C,{title:n("oauth.apple.enable"),mb:2.5,children:e.jsx(I,{name:"enabled",control:f,render:({field:a})=>e.jsx(U,{control:e.jsx(ce,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(C,{title:n("oauth.apple.teamId"),children:e.jsx(I,{name:"teamId",control:f,rules:{validate:d?T:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.teamId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.bundleId"),children:e.jsx(I,{name:"bundleId",control:f,rules:{validate:d?v:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.bundleId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.serviceId"),children:e.jsx(I,{name:"serviceId",control:f,rules:{validate:d?x:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.serviceId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.keyId"),children:e.jsx(I,{name:"keyId",control:f,rules:{validate:d?g:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",label:n("oauth.apple.keyId"),error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx(C,{title:n("oauth.apple.authKey"),children:e.jsx(I,{name:"authKey",control:f,rules:{validate:d?y:S},render:({field:a})=>{var b;return e.jsx(E,{fullWidth:!0,children:e.jsx(O,{...a,size:"small",type:"password",label:n("oauth.apple.authKey"),multiline:!0,rows:4,error:!!c.errors[a.name],helperText:((b=c.errors[a.name])==null?void 0:b.message)||" ",disabled:!d})})}})}),e.jsx($,{type:"submit",variant:"contained",onSubmit:t(k),disabled:!c.isDirty,children:n("oauth.save")})]})})}const yt={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function be({title:j,id:o,children:n,index:s,onMove:w,defaultExpand:t,onEnd:f}){const[c,h]=P.useState(t),l=P.useRef(null),d=P.useRef(null),[{handlerId:k},T]=Me({accept:"dragItem",collect(S){return{handlerId:S.getHandlerId()}},hover(S,i){var M,Q;if(!l.current)return;const r=S.index,L=s;if(r===L)return;const a=(M=l.current)==null?void 0:M.getBoundingClientRect(),b=(Q=d.current)==null?void 0:Q.getBoundingClientRect(),m=(b.bottom-b.top)/2,A=i.getClientOffset().y-a.top;r<L&&A<m||r>L&&A>m||(w(r,L),S.index=L)}}),[{isDragging:x},g]=Ve({item:{index:s,type:"dragItem"},collect:S=>({isDragging:S.isDragging()}),end:f});g(d),T(l);const y=x?.5:1,v=p(S=>{S.preventDefault(),S.stopPropagation(),h(!c)});return e.jsxs(u,{ref:l,children:[e.jsxs(u,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:d,"data-handler-id":k,children:[e.jsxs(u,{sx:{py:2,px:1,opacity:y,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:v,children:[e.jsx(u,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(K,{fontSize:20,icon:yt})}),e.jsx(ne,{sx:{flex:1},children:j}),e.jsx(ie,{size:"small",sx:{pointerEvents:"auto",transform:c?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(K,{icon:pt,style:{transform:"scale(1.5)"}})})]}),e.jsx(le,{})]}),e.jsx(u,{sx:{pl:4,py:2.5,display:c?"block":"none"},children:n})]})}be.propTypes={title:H.string.isRequired,id:H.string.isRequired,children:H.node.isRequired,index:H.number.isRequired,onMove:H.func.isRequired,onEnd:H.func.isRequired,defaultExpand:H.bool};be.defaultProps={defaultExpand:!1};const St=[{name:"github",title:"GitHub",icon:e.jsx(K,{icon:rt}),component:e.jsx(jt,{})},{name:"google",title:"Google",icon:e.jsx(K,{icon:He}),component:e.jsx(bt,{})},{name:"apple",title:"Apple",icon:e.jsx(K,{icon:Je}),component:e.jsx(vt,{})},{name:"auth0",title:"Auth0",icon:e.jsx(K,{icon:Ke}),component:e.jsx(gt,{})}],wt=["github","google","apple","auth0"];function kt(){var k,T;const{api:j}=J(),{blocklet:o}=N(),n=(k=o==null?void 0:o.meta)==null?void 0:k.did,s=((T=o==null?void 0:o.settings)==null?void 0:T.oauth)||{},w=Object.keys(s).sort((x,g)=>{var y,v,S;return((y=s[x])==null?void 0:y.order)!==void 0&&((v=s[g])==null?void 0:v.order)!==void 0?s[x].order-s[g].order:((S=s[x])==null?void 0:S.order)!==void 0?-1:1});for(const x of wt)w.includes(x)||w.push(x);const t=ae(w.reduce((x,g,y)=>Object.assign(x,{[g]:y}),{})),f=te(()=>{const x=[...St];return x.sort((g,y)=>t[g.name]-t[y.name]),x},[t.auth0,t.github,t.google]),c={};typeof window<"u"&&(c.context=window);const h=p(async x=>{const g={};Object.keys(x).forEach(y=>{g[y]={order:x[y]}}),await j.configOAuth({input:{did:n,oauth:JSON.stringify(g)}})}),l=p((x,g)=>{const y=f[x],v=f[g];t[y.name]=g,t[v.name]=x}),d=p(async()=>{await h(t)});return e.jsx(u,{sx:{".section-left":{width:"160px"}},children:e.jsx($e,{backend:Ne,...c,children:f.map((x,g)=>e.jsx(be,{index:g,id:x.name,title:x.title,icon:x.icon,onMove:l,onEnd:d,defaultExpand:x.enabled,children:x.component},x.name))})})}const Z={ttl:oe.SESSION_TTL,cacheTtl:oe.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]}};function W(j){return e.jsx(ot,{...j,sx:{transform:"scale(0.75)"}})}function he(j,o=!1){const n=o?j.ttl*86400:j.ttl/86400;return{...j,ttl:n}}function Lt(){var a,b;const{api:j}=J(),{blocklet:o}=N(),n=(a=o==null?void 0:o.meta)==null?void 0:a.did,s=lt({},Z,((b=o==null?void 0:o.settings)==null?void 0:b.session)||{});Fe(s.ttl)&&(s.ttl=Z.ttl),Fe(s.cacheTtl)&&(s.cacheTtl=Z.cacheTtl),s.phone||(s.phone=Z.phone),s.email||(s.email=Z.email);const{handleSubmit:w,control:t,formState:f,reset:c,watch:h}=re({defaultValues:Y(he(s),["ttl","cacheTtl","email","phone"])}),{t:l}=se(),d=h("email.enabled"),k=h("phone.enabled"),T=h("email.enableDomainBlackList"),x=h("email.enableDomainWhiteList"),{fields:g,append:y,remove:v}=Re({control:t,name:"email.domainBlackList"}),{fields:S,append:i,remove:r}=Re({control:t,name:"email.domainWhiteList"}),L=p(async m=>{var R;try{const{blocklet:A}=await j.updateAppSessionConfig({input:{did:n,config:ct(he(m,!0),["phone"])}}),M=Object.assign({},Z,Y(((R=A==null?void 0:A.settings)==null?void 0:R.session)||{},["ttl","cacheTtl","email","phone"]));c(he(M)),_.success(l("common.configSuccess"))}catch(A){_.error(A.message)}});return e.jsx(Tt,{onSubmit:w(L),children:e.jsxs(V,{direction:"column",gap:6,children:[e.jsxs(u,{children:[e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.profile")}),e.jsx(u,{component:le,my:3})]}),e.jsxs(V,{gap:2,children:[e.jsx(C,{title:l("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(W,{disabled:!0,checked:!0})})}),e.jsx(C,{title:l("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enabled",control:t,render:({field:m})=>e.jsx(W,{...m,checked:m.value})})})}),d&&e.jsxs(V,{direction:"column",ml:2,children:[e.jsx(C,{title:l("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireVerified",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.requireUnique",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.trustOauthProviders",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainBlackList",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),T&&e.jsxs(u,{children:[g.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainBlackList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>v(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>y(""),children:l("blocklet.config.session.addDomain")})]}),e.jsx(C,{title:l("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"email.enableDomainWhiteList",control:t,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),x&&e.jsxs(u,{children:[S.map((m,R)=>e.jsxs(V,{direction:"row",alignItems:"center",my:1,maxWidth:"720px",children:[e.jsx(I,{name:`email.domainWhiteList.${R}`,control:t,render:A=>e.jsx(O,{...A.field,size:"small",fullWidth:!0})}),e.jsx(ie,{onClick:()=>r(R),children:e.jsx(Ce,{})})]},m.id)),e.jsx($,{startIcon:e.jsx(qe,{}),onClick:()=>i(""),children:l("blocklet.config.session.addDomain")})]})]}),e.jsxs(u,{sx:{display:"none"},children:[e.jsx(C,{title:l("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.enabled",control:t,disabled:!0,render:({field:m})=>e.jsx(U,{sx:{mt:1},control:e.jsx(W,{...m,checked:m.value})})})})}),k&&e.jsxs(V,{direction:"column",ml:2,mt:1,children:[e.jsx(C,{title:l("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireVerified",control:t,render:({field:m})=>e.jsx(U,{control:e.jsx(W,{...m,checked:m.value})})})})}),e.jsx(C,{title:l("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{alignSelf:"flex-start"},children:e.jsx(I,{name:"phone.requireUnique",control:t,render:({field:m})=>e.jsx(U,{control:e.jsx(W,{...m,checked:m.value})})})})})]})]})]})]}),e.jsxs(u,{children:[e.jsx(ne,{variant:"h6",fontWeight:600,children:l("blocklet.config.session.period")}),e.jsx(u,{component:le,my:3}),e.jsx(V,{direction:"column",spacing:2,children:e.jsx(I,{name:"ttl",control:t,rules:{min:1,max:30},render:({field:m})=>e.jsx(E,{fullWidth:!0,sx:{mb:2},children:e.jsx(C,{title:l("blocklet.config.session.ttl",{day:m.value}),sectionLeftSx:{width:"600px"},children:e.jsx(u,{sx:{width:"100%",maxWidth:500,px:1.5},children:e.jsx(nt,{...m,defaultValue:7,step:1,marks:[{value:1,label:l("blocklet.config.session.day",{day:1})},{value:7,label:l("blocklet.config.session.days",{day:7})},{value:14,label:l("blocklet.config.session.days",{day:14})},{value:21,label:l("blocklet.config.session.days",{day:21})},{value:30,label:l("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsx(u,{children:e.jsx($,{type:"submit",variant:"contained",disabled:!f.isDirty,children:l("oauth.save")})})]})})}const Tt=Oe.form`
2
2
  max-width: 1536px;
3
3
 
4
4
  .advanced-config {
@@ -1 +1 @@
1
- import{r as h}from"./vendor-react-DEoibe3W.js";import{H as e,j as a,bp as Y,br as w,O as S,q as j,aa as v}from"./vendor-mui-core-wlbruq2I.js";import{y as s}from"./index-DQjZ74P0.js";import{a as H}from"./vendor-ux-did-connect-CX7qG3_M.js";import{A as M}from"./vendor-arcblock-B4hgrXYM.js";import{b as _}from"./vendor-hooks-BCm626KH.js";import{L as A,D as y}from"./vendor-mui-x-BKgL6hAa.js";import{A as C}from"./AdapterDayjs-BXVfASrK.js";function x({value:r,onChange:i,error:m,helperText:u,label:t,timezone:n}){const d=n?s().tz(n):s(),p=_(()=>{let l=s();return r&&(l=n?s(r).tz(n):s(r)),l.format("YYYY-MM-DD[T]HH:mm")},[r,n]),D=l=>{const T=n?s(l).tz(n).format("YYYY-MM-DD HH:mm:00"):s(l).format("YYYY-MM-DD HH:mm:00");i(new Date(T))};return a.jsx(A,{dateAdapter:C,children:a.jsxs(Y,{fullWidth:!0,error:m,children:[a.jsx(y,{label:t,minDateTime:d,value:s(p),onChange:D,slotProps:{textField:{error:m,helperText:m?u:""}},format:"YYYY-MM-DD HH:mm"}),u&&a.jsx(w,{children:u})]})})}x.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,error:e.bool,helperText:e.string,label:e.string,timezone:e.string};x.defaultProps={value:null,error:!1,helperText:"",label:"",timezone:""};function E(r){return a.jsx(M,{...r,width:20,height:20})}const c={MINUTES_30:30*60*1e3,HOUR_1:60*60*1e3,HOURS_3:3*60*60*1e3,DAY_1:24*60*60*1e3,DAYS_7:7*24*60*60*1e3,DAYS_30:30*24*60*60*1e3};function b({placeholder:r,value:i,onChange:m,timezone:u}){const{t}=H(),[n,d]=h.useState(i||""),[p,D]=h.useState(null),l=h.useMemo(()=>[{value:new Date(Date.now()+c.MINUTES_30),label:`30 ${t("common.minutes")}`},{value:new Date(Date.now()+c.HOUR_1),label:`1 ${t("common.hour")}`},{value:new Date(Date.now()+c.HOURS_3),label:`3 ${t("common.hours")}`},{value:new Date(Date.now()+c.DAY_1),label:`1 ${t("common.day")}`},{value:new Date(Date.now()+c.DAYS_7),label:`7 ${t("common.days")}`},{value:new Date(Date.now()+c.DAYS_30),label:`30 ${t("common.days")}`},{value:"custom",label:t("common.custom")}],[t]),T=o=>{if(d(o),o==="custom"){const f=s().toDate();D(f),m(f)}else m(o)},g=o=>{D(o),m(o)};return h.useEffect(()=>{i&&(l.find(f=>s(f.value).isSame(i))||(d("custom"),D(i)))},[]),a.jsxs(a.Fragment,{children:[a.jsx(Y,{fullWidth:!0,children:a.jsx(S,{select:!0,value:n,label:r||t("team.passport.passportExpireTime"),onChange:o=>T(o.target.value),variant:"outlined",SelectProps:{IconComponent:E},children:l.map(o=>a.jsx(j,{value:o.value,children:o.label},o.value))})}),n==="custom"&&a.jsx(v,{children:a.jsx(x,{value:p,onChange:g,label:t("team.passport.customExpireTime"),timezone:u,error:!p,helperText:p?void 0:t("team.passport.customExpireTime")})})]})}b.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,timezone:e.string,placeholder:e.string};b.defaultProps={value:"",timezone:"",placeholder:""};export{b as T};
1
+ import{r as h}from"./vendor-react-DEoibe3W.js";import{H as e,j as a,bp as Y,br as w,O as S,q as j,aa as v}from"./vendor-mui-core-wlbruq2I.js";import{y as s}from"./index-B18R5SlV.js";import{a as H}from"./vendor-ux-did-connect-CX7qG3_M.js";import{A as M}from"./vendor-arcblock-B4hgrXYM.js";import{b as _}from"./vendor-hooks-BCm626KH.js";import{L as A,D as y}from"./vendor-mui-x-BKgL6hAa.js";import{A as C}from"./AdapterDayjs-BXVfASrK.js";function x({value:r,onChange:i,error:m,helperText:u,label:t,timezone:n}){const d=n?s().tz(n):s(),p=_(()=>{let l=s();return r&&(l=n?s(r).tz(n):s(r)),l.format("YYYY-MM-DD[T]HH:mm")},[r,n]),D=l=>{const T=n?s(l).tz(n).format("YYYY-MM-DD HH:mm:00"):s(l).format("YYYY-MM-DD HH:mm:00");i(new Date(T))};return a.jsx(A,{dateAdapter:C,children:a.jsxs(Y,{fullWidth:!0,error:m,children:[a.jsx(y,{label:t,minDateTime:d,value:s(p),onChange:D,slotProps:{textField:{error:m,helperText:m?u:""}},format:"YYYY-MM-DD HH:mm"}),u&&a.jsx(w,{children:u})]})})}x.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,error:e.bool,helperText:e.string,label:e.string,timezone:e.string};x.defaultProps={value:null,error:!1,helperText:"",label:"",timezone:""};function E(r){return a.jsx(M,{...r,width:20,height:20})}const c={MINUTES_30:30*60*1e3,HOUR_1:60*60*1e3,HOURS_3:3*60*60*1e3,DAY_1:24*60*60*1e3,DAYS_7:7*24*60*60*1e3,DAYS_30:30*24*60*60*1e3};function b({placeholder:r,value:i,onChange:m,timezone:u}){const{t}=H(),[n,d]=h.useState(i||""),[p,D]=h.useState(null),l=h.useMemo(()=>[{value:new Date(Date.now()+c.MINUTES_30),label:`30 ${t("common.minutes")}`},{value:new Date(Date.now()+c.HOUR_1),label:`1 ${t("common.hour")}`},{value:new Date(Date.now()+c.HOURS_3),label:`3 ${t("common.hours")}`},{value:new Date(Date.now()+c.DAY_1),label:`1 ${t("common.day")}`},{value:new Date(Date.now()+c.DAYS_7),label:`7 ${t("common.days")}`},{value:new Date(Date.now()+c.DAYS_30),label:`30 ${t("common.days")}`},{value:"custom",label:t("common.custom")}],[t]),T=o=>{if(d(o),o==="custom"){const f=s().toDate();D(f),m(f)}else m(o)},g=o=>{D(o),m(o)};return h.useEffect(()=>{i&&(l.find(f=>s(f.value).isSame(i))||(d("custom"),D(i)))},[]),a.jsxs(a.Fragment,{children:[a.jsx(Y,{fullWidth:!0,children:a.jsx(S,{select:!0,value:n,label:r||t("team.passport.passportExpireTime"),onChange:o=>T(o.target.value),variant:"outlined",SelectProps:{IconComponent:E},children:l.map(o=>a.jsx(j,{value:o.value,children:o.label},o.value))})}),n==="custom"&&a.jsx(v,{children:a.jsx(x,{value:p,onChange:g,label:t("team.passport.customExpireTime"),timezone:u,error:!p,helperText:p?void 0:t("team.passport.customExpireTime")})})]})}b.propTypes={value:e.oneOfType([e.string,e.instanceOf(Date)]),onChange:e.func.isRequired,timezone:e.string,placeholder:e.string};b.defaultProps={value:"",timezone:"",placeholder:""};export{b as T};
@@ -1,4 +1,4 @@
1
- import{a as _,a3 as q,k as ve,r as se,bs as Ee,bt as Ce,bu as Se,I as U,bZ as Q,b_ as X,a5 as Me,ac as Le,bH as _e}from"./vendor-ux-did-connect-CX7qG3_M.js";import{t as Be,l as Te,j as He}from"./vendor-hooks-BCm626KH.js";import{r as C,b as ie}from"./vendor-react-DEoibe3W.js";import{d as re}from"./InfoOutlined-CLiL5VeK.js";import{i as Fe,v as Ne}from"./vendor-arcblock-B4hgrXYM.js";import{D as V,aC as Ue,aD as Z,G as Ie,y as Ke}from"./index-DQjZ74P0.js";import{u as Y}from"./dashboard-B7qE-Md0.js";import{u as Ve}from"./use-mobile-CiFFAdJf.js";import{H as o,j as e,D as Ye,aj as Je,t as Ge,aa as d,O as je,T as S,ab as F,ak as le,z as Qe,y as N,bt as ye,bS as ee,ad as $,L as te,A as oe,aq as Xe,E as M,I as H,C as Ze,br as et,al as D,cg as tt,X as Re,a9 as ae,s as de,as as ne,bq as ot,b8 as nt,b9 as st,an as it,c0 as rt,v as lt,ch as at,ci as dt,cj as ct,ck as ut}from"./vendor-mui-core-wlbruq2I.js";import{d as pt}from"./ExpandLess-Fb-uW6u_.js";import{b as De,z as ht,A as xt}from"./vendor-utils-B3iZkn2R.js";import{C as mt}from"./confirm-BjCmRSAF.js";import{A as ft}from"./actions-DtL6bYnA.js";import{T as we}from"./table-tips-Czrj7r52.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BF3BqN1O.js";import"./index-8eXqqyHQ.js";import"./PlayArrow-B_ZNrQDa.js";import"./get-safe-url-BWDUV79Q.js";import"./session-1k8BRnYA.js";import"./use-blocklet-logo-6YMz11ob.js";import"./dot-BID2dzD_.js";import"./useAsync-B6ZHbOEG.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CXU9YBvX.js";import"./MoreHoriz-9E3q8aHi.js";const gt=s=>{var b,T;const[c,p]=C.useState(null),[v,l]=C.useState(!s),[k,u]=C.useState(null),{blocklet:f}=Ie(),i=(T=(b=f==null?void 0:f.site)==null?void 0:b.domainAliases[0])==null?void 0:T.value,y=C.useMemo(()=>{const j={};return c&&(c.sources.forEach(n=>{j[n.did]={source:n,events:[],count:0}}),c.events.forEach(n=>{j[n.source]&&(j[n.source].events.push(n),j[n.source].count+=1)})),j},[c]),w=async()=>{try{if(l(!0),!i)return;const n=await(await fetch(`https://${i}${ve.WELLKNOWN_SERVICE_PATH_PREFIX}/openevent.json`)).json();p(n),u(null)}catch(j){u(j instanceof Error?j:new Error(String(j)))}finally{l(!1)}};return C.useEffect(()=>{w()},[i]),{openEvent:c,setOpenEvent:p,eventsBySource:y,loading:v,error:k,loadData:w}};function ce({eventsBySource:s,selectedEvents:c,setSelectedEvents:p,error:v}){const{t:l}=_(),[k,u]=C.useState({}),f=C.useMemo(()=>{const n={};return Object.entries(s).forEach(([h,{events:x}])=>{const E=x.filter(I=>c[`${I.type}-${I.source}`]).length;n[h]=E}),n},[s,c]),i=C.useMemo(()=>Object.values(f).reduce((n,h)=>n+h,0),[f]),y=C.useMemo(()=>Object.values(s).reduce((n,{events:h})=>n+h.length,0),[s]),w=(n,h)=>{h.stopPropagation(),u({...k,[n]:!k[n]})},b=n=>{const h=`${n.type}-${n.source}`;p(x=>({...x,[h]:!x[h]}))},T=(n,h)=>{const x={};n.forEach(E=>{const I=`${E.type}-${E.source}`;x[I]=!h}),p(E=>({...E,...x}))},j=n=>{const h={};Object.values(s).forEach(({events:x})=>{x.forEach(E=>{const I=`${E.type}-${E.source}`;h[I]=n.target.checked})}),p(h)};return e.jsxs(d,{sx:{width:"100%"},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ye,{control:e.jsx(ee,{onChange:j,checked:i>0&&i===y}),label:e.jsxs(d,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[l("webhookEndpoint.selectAllEvents"),e.jsx(d,{sx:{display:"flex",alignItems:"center"},children:e.jsx($,{title:l("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(re,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),i>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:l("webhookEndpoint.selectedEventsCount",{count:i})})]}),e.jsx(d,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(te,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(s).map(([n,{source:h,events:x,count:E}],I)=>{const O=f[n]>0,R=f[n]===x.length&&x.length>0,A=k[n];return e.jsxs(ie.Fragment,{children:[e.jsx(oe,{sx:{borderBottom:({palette:r})=>I<Object.keys(s).length-1?`1px solid ${r.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(d,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:r=>{r.target.closest(".MuiFormControlLabel-root")||w(n,r)},children:[e.jsx(d,{sx:{display:"flex",alignItems:"center"},children:x.length>0&&e.jsx(ye,{control:e.jsx(ee,{checked:R,indeterminate:O&&!R,onChange:r=>{r.stopPropagation(),T(x,R)}}),label:e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[h.logo&&e.jsx(Xe,{src:h.logo,sx:{width:24,height:24}}),e.jsx(d,{children:h.title||n}),O&&e.jsx(M,{label:l("webhookEndpoint.selectedCount",{count:f[n]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:r=>`${r.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(d,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:l("webhookEndpoint.eventsCount",{count:E})}),x.length>0&&e.jsx(H,{size:"small",edge:"end",children:A?e.jsx(pt,{}):e.jsx(Fe,{})})]})]})}),x.length>0&&e.jsx(Ze,{in:A,timeout:"auto",unmountOnExit:!0,children:e.jsx(te,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:x.map(r=>{const a=`${r.type}-${r.source}`,t=!!c[a];return e.jsx(oe,{dense:!0,sx:{py:.75},onClick:()=>b(r),children:e.jsxs(d,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(ee,{checked:t,sx:{mr:1}}),e.jsxs(d,{children:[e.jsx(S,{variant:"body1",sx:{cursor:"pointer",color:"text.primary"},children:r.type}),e.jsx(S,{variant:"caption",color:"text.secondary",sx:{display:"block",cursor:"pointer"},children:r.description})]})]})},a)})})})]},n)})})}),v&&e.jsx(et,{error:!0,sx:{mt:1},children:v})]})}ce.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};ce.defaultProps={error:null};function ue({id:s,url:c,description:p,enabledEvents:v,onSubmit:l,onClose:k}){var r;const{t:u}=_(),[f,i]=C.useState({}),{teamDid:y}=Y(),{api:w}=V(),{loading:b,error:T,eventsBySource:j}=gt(),{control:n,handleSubmit:h,formState:{errors:x},reset:E,setValue:I,trigger:O}=Ue({defaultValues:{url:"",description:""}});C.useEffect(()=>{const a=Object.values(f).some(t=>t);I("selectedEvents",a?"valid":""),O("selectedEvents")},[f,I,O]);const R=()=>{i({}),E(),k()},A=async a=>{const t=Object.keys(f).filter(m=>f[m]),g={url:a.url,description:a.description,enabledEvents:t.map(m=>{const[P,z]=m.split("-");return!P||!z?null:{type:P,source:z}}).filter(Boolean)};try{if(s){const m=await w.updateWebhookEndpoint({input:{teamDid:y,id:s,data:g}});q.success(`${u("webhookEndpoint.updateWebhook")} ${u("webhookEndpoint.success")}`),l(m)}else{const m=await w.createWebhookEndpoint({input:{teamDid:y,input:g}});q.success(`${u("webhookEndpoint.createWebhook")} ${u("webhookEndpoint.success")}`),l(m)}}catch(m){q.error(m==null?void 0:m.message)}R()};return C.useEffect(()=>{E({url:c,description:p}),i(v.reduce((a,t)=>(a[`${t.type}-${t.source}`]=!0,a),{}))},[E,i,c,p,v]),e.jsx(Ye,{open:!0,onClose:R,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:h(A),children:[e.jsx(Je,{children:u(s?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(Ge,{children:e.jsxs(d,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(Z,{name:"url",control:n,rules:{required:u("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:u("webhookEndpoint.validation.urlInvalid")}},render:({field:a})=>{var t;return e.jsx(je,{...a,label:u("webhookEndpoint.url.label"),fullWidth:!0,error:!!x.url,helperText:(t=x.url)==null?void 0:t.message})}}),e.jsx(Z,{name:"description",control:n,rules:{required:u("webhookEndpoint.validation.descriptionRequired")},render:({field:a})=>{var t;return e.jsx(je,{...a,label:u("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!x.description,helperText:(t=x.description)==null?void 0:t.message})}}),e.jsx(Z,{name:"selectedEvents",control:n,rules:{required:u("webhookEndpoint.validation.eventRequired")},render:({field:a})=>e.jsx("input",{type:"hidden",...a})}),!b&&j&&Object.keys(j).length>0&&e.jsx(ce,{eventsBySource:j,selectedEvents:f,setSelectedEvents:i,error:(r=x.selectedEvents)==null?void 0:r.message}),!b&&(!j||Object.keys(j).length===0)&&e.jsx(S,{color:"text.secondary",children:u("webhookEndpoint.noAvailableEvents")}),b&&e.jsx(d,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(F,{size:20})}),T&&e.jsx(le,{severity:"error",children:u("webhookEndpoint.loadingError",{message:T==null?void 0:T.message})})]})}),e.jsxs(Qe,{sx:{p:"8px 24px 24px"},children:[e.jsx(N,{onClick:R,children:u("common.cancel")}),e.jsx(N,{type:"submit",variant:"contained",color:"primary",children:u(s?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}ue.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};ue.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function Pe(s){switch(s){case"enabled":return"success";case"disabled":default:return"default"}}const bt=(s="en")=>s==="tw"?"zh":s;function K(s,c="YYYY-MM-DD HH:mm:ss",p="en"){return s?Ke(s).locale(bt(p)).format(c):"-"}function jt(s){return typeof s=="number"?!1:De(s)}function yt(s){return s>=200&&s<300}function W(s){const c=jt(s.value);return e.jsxs(e.Fragment,{children:[e.jsxs(D,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[s.label,!!s.tip&&e.jsx($,{title:s.tip,children:e.jsx(tt,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:c?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:c?"-":s.value})]}),s.divider&&e.jsx(Re,{orientation:"vertical",flexItem:!0})]})}W.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};W.defaultProps={tip:"",divider:!1};function pe(s){return e.jsxs(D,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:s.mb,mt:s.mt,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:s.title}),s.children]})}pe.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};pe.defaultProps={children:null,mb:1.5,mt:1.5};var he={},wt=ae;Object.defineProperty(he,"__esModule",{value:!0});var ze=he.default=void 0,kt=wt(se()),vt=e;ze=he.default=(0,kt.default)((0,vt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M7 13.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5"}),"Pending");var xe={},Et=ae;Object.defineProperty(xe,"__esModule",{value:!0});var Oe=xe.default=void 0,Ct=Et(se()),St=e;Oe=xe.default=(0,Ct.default)((0,St.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.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined");var me={},Tt=ae;Object.defineProperty(me,"__esModule",{value:!0});var We=me.default=void 0,It=Tt(se()),Rt=e;We=me.default=(0,It.default)((0,Rt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"ErrorOutlined");const Dt={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>'},Pt=s=>{const c={};return s.forEach(p=>{var l;const v=new Date(p.createdAt).toLocaleDateString();c[v]||(c[v]=[]),(l=c[v])==null||l.push(p)}),c};function fe({eventId:s,webhookEndpointId:c,event:p}){const{api:v,ws:{useSubscription:l}}=V(),{t:k}=_(),{teamDid:u}=Y(),{blocklet:f}=Ie(),{data:i,loadMore:y,loadingMore:w,loading:b,mutate:T}=Be(t=>{const m=t?Math.ceil(t.list.length/15)+1:1;return v.getWebhookAttempts({input:{teamDid:u,input:{eventId:s,webhookId:c},paging:{page:m,pageSize:15}}})},{reloadDeps:[s,c]}),j=(i==null?void 0:i.list)||[],[n,h]=C.useState(null),[x,E]=C.useState(!1),I=Pt(j);if(C.useEffect(()=>{!n&&(i!=null&&i.list.length)&&h(i.list[0])},[i==null?void 0:i.list.length,n]),l(ve.EVENTS.WEBHOOK_ATTEMPT,t=>{T(g=>{var P,z;if(g.list.find(L=>L.id===t.id)){const L=g.list.map(B=>B.id===t.id?{...B,...t}:B);return{...g,list:L}}return t.endpoint=(P=g.list[0])==null?void 0:P.endpoint,t.event=(z=g.list[0])==null?void 0:z.event,{...g,list:[t,...g.list]}})},[]),b)return e.jsx(F,{});const O=i&&i.list.length<i.paging.total,R=async()=>{n&&(E(!0),await v.retryWebhookAttempt({input:{teamDid:u,eventId:n.event.id,webhookId:c,attemptId:n.id}}).finally(()=>{setTimeout(()=>{E(!1)},1e3)}))},A=t=>{var g,m,P,z,L;if(t.responseBody&&((g=t.responseBody)!=null&&g.sessionId)&&((m=t.responseBody)!=null&&m.projectId)&&((P=t.responseBody)!=null&&P.agentId)){const B=(L=(z=f==null?void 0:f.site)==null?void 0:z.domainAliases[0])==null?void 0:L.value,J=(f.children||[]).find(G=>{var be;return((be=G==null?void 0:G.meta)==null?void 0:be.name)==="ai-studio"}),qe=ht(xt(`https://${B}`,(J==null?void 0:J.mountPoint)||"","projects",t.responseBody.projectId,"logs/main"),{sessionId:t.responseBody.sessionId,agentId:t.responseBody.agentId});return e.jsx(H,{sx:{fontSize:20},onClick:()=>window.open(qe,"_blank"),children:e.jsx(d,{component:U,icon:Q})})}return null},r=t=>t.status==="pending"?e.jsx(ze,{color:"warning"}):yt(t.responseStatus)?e.jsx(Oe,{color:"success"}):e.jsx(We,{color:"error"}),a=(n==null?void 0:n.triggeredFrom)&&((i==null?void 0:i.list)||[]).find(t=>t.id===n.triggeredFrom);return e.jsxs(zt,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(ne,{item:!0,xs:12,md:4,height:1,children:De(Object.keys(I))?e.jsx(S,{color:"text.secondary",children:k("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(te,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(I).map(([t,g])=>e.jsxs(ie.Fragment,{children:[e.jsx(ot,{sx:{p:0},children:t}),g.map(m=>e.jsxs(oe,{sx:{cursor:"pointer",px:1},onClick:()=>h(m),selected:n&&(n==null?void 0:n.id)===(m==null?void 0:m.id),secondaryAction:e.jsx(S,{color:"text.secondary",children:K(m.createdAt,"HH:mm:ss")}),children:[e.jsx(nt,{sx:{minWidth:0,mr:1.5},children:r(m)}),e.jsx(st,{primary:e.jsx(S,{color:"text.primary",children:m.event.type})})]},m.id))]},t))}),O&&e.jsx(d,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(N,{variant:"text",type:"button",color:"inherit",onClick:y,disabled:w,sx:{color:t=>t.palette.text.disabled},children:k(w?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(ne,{item:!0,xs:12,md:8,height:1,children:[n&&e.jsxs(D,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h4",children:k(`common.${n.status}`)}),e.jsx(d,{children:A(n)})]}),e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[a&&e.jsx($,{componentsProps:{tooltip:{sx:{maxWidth:400}}},placement:"left",title:e.jsxs(D,{gap:1,sx:{cursor:"pointer",".did-address-text":{color:"common.white"}},onClick:()=>h(a),children:[e.jsx(Ee,{showDid:!0,did:n.triggeredBy,cardType:Ce.Detailed,infoType:Se.Minimal,sx:{border:0,padding:0,minWidth:0,".MuiTypography-root":{color:"common.white",fontWeight:400}}}),e.jsx(Re,{}),e.jsxs(d,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(S,{variant:"body2",sx:{color:"primary.main"},children:k("webhookEndpoint.triggeredFrom")}),e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"body2",children:n.id}),e.jsx(H,{onClick:()=>h(a),children:e.jsx(d,{component:U,icon:Q,sx:{fontSize:16,color:"common.white"}})})]})]})]}),children:e.jsx(H,{onClick:()=>h(a),children:e.jsx(d,{component:U,icon:Q,sx:{fontSize:16}})})}),e.jsxs(N,{variant:"outlined",color:"primary",size:"small",onClick:R,disabled:x,children:[e.jsx(d,{component:U,icon:Dt,sx:{fontSize:16,animation:x?"spin 1s linear infinite":"none",mr:.5}}),k("notification.resend")]})]})]}),e.jsxs(d,{children:[e.jsxs(S,{variant:"h6",children:[k("webhookEndpoint.response")," (",n.responseStatus,")"]}),e.jsx(X,{language:"json",children:JSON.stringify(n.responseBody,null,2)})]}),e.jsxs(d,{children:[e.jsx(D,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:k("webhookEndpoint.request")})}),e.jsx(X,{language:"json",sx:{margin:0},children:JSON.stringify(n.event,null,2)})]})]}),(i==null?void 0:i.list.length)===0&&p&&e.jsxs(d,{children:[e.jsx(D,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:k("webhookEndpoint.eventData")})}),e.jsx(X,{language:"json",sx:{margin:0},children:JSON.stringify(p.data,null,2)})]})]})]})}fe.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};fe.defaultProps={eventId:"",webhookEndpointId:"",event:null};const zt=de(ne)`
1
+ import{a as _,a3 as q,k as ve,r as se,bs as Ee,bt as Ce,bu as Se,I as U,bZ as Q,b_ as X,a5 as Me,ac as Le,bH as _e}from"./vendor-ux-did-connect-CX7qG3_M.js";import{t as Be,l as Te,j as He}from"./vendor-hooks-BCm626KH.js";import{r as C,b as ie}from"./vendor-react-DEoibe3W.js";import{d as re}from"./InfoOutlined-CLiL5VeK.js";import{i as Fe,v as Ne}from"./vendor-arcblock-B4hgrXYM.js";import{D as V,aC as Ue,aD as Z,G as Ie,y as Ke}from"./index-B18R5SlV.js";import{u as Y}from"./dashboard-k0XcV2m5.js";import{u as Ve}from"./use-mobile-CXU9YBvX.js";import{H as o,j as e,D as Ye,aj as Je,t as Ge,aa as d,O as je,T as S,ab as F,ak as le,z as Qe,y as N,bt as ye,bS as ee,ad as $,L as te,A as oe,aq as Xe,E as M,I as H,C as Ze,br as et,al as D,cg as tt,X as Re,a9 as ae,s as de,as as ne,bq as ot,b8 as nt,b9 as st,an as it,c0 as rt,v as lt,ch as at,ci as dt,cj as ct,ck as ut}from"./vendor-mui-core-wlbruq2I.js";import{d as pt}from"./ExpandLess-Fb-uW6u_.js";import{b as De,z as ht,A as xt}from"./vendor-utils-B3iZkn2R.js";import{C as mt}from"./confirm-Bay3BcpN.js";import{A as ft}from"./actions-DtL6bYnA.js";import{T as we}from"./table-tips-Czrj7r52.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BF3BqN1O.js";import"./index-8eXqqyHQ.js";import"./PlayArrow-B_ZNrQDa.js";import"./get-safe-url-CwT4-jkw.js";import"./session-1k8BRnYA.js";import"./use-blocklet-logo-DGSQQmh2.js";import"./dot-DR7_m3Np.js";import"./useAsync-BMCqtJH2.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CiFFAdJf.js";import"./MoreHoriz-9E3q8aHi.js";const gt=s=>{var b,T;const[c,p]=C.useState(null),[v,l]=C.useState(!s),[k,u]=C.useState(null),{blocklet:f}=Ie(),i=(T=(b=f==null?void 0:f.site)==null?void 0:b.domainAliases[0])==null?void 0:T.value,y=C.useMemo(()=>{const j={};return c&&(c.sources.forEach(n=>{j[n.did]={source:n,events:[],count:0}}),c.events.forEach(n=>{j[n.source]&&(j[n.source].events.push(n),j[n.source].count+=1)})),j},[c]),w=async()=>{try{if(l(!0),!i)return;const n=await(await fetch(`https://${i}${ve.WELLKNOWN_SERVICE_PATH_PREFIX}/openevent.json`)).json();p(n),u(null)}catch(j){u(j instanceof Error?j:new Error(String(j)))}finally{l(!1)}};return C.useEffect(()=>{w()},[i]),{openEvent:c,setOpenEvent:p,eventsBySource:y,loading:v,error:k,loadData:w}};function ce({eventsBySource:s,selectedEvents:c,setSelectedEvents:p,error:v}){const{t:l}=_(),[k,u]=C.useState({}),f=C.useMemo(()=>{const n={};return Object.entries(s).forEach(([h,{events:x}])=>{const E=x.filter(I=>c[`${I.type}-${I.source}`]).length;n[h]=E}),n},[s,c]),i=C.useMemo(()=>Object.values(f).reduce((n,h)=>n+h,0),[f]),y=C.useMemo(()=>Object.values(s).reduce((n,{events:h})=>n+h.length,0),[s]),w=(n,h)=>{h.stopPropagation(),u({...k,[n]:!k[n]})},b=n=>{const h=`${n.type}-${n.source}`;p(x=>({...x,[h]:!x[h]}))},T=(n,h)=>{const x={};n.forEach(E=>{const I=`${E.type}-${E.source}`;x[I]=!h}),p(E=>({...E,...x}))},j=n=>{const h={};Object.values(s).forEach(({events:x})=>{x.forEach(E=>{const I=`${E.type}-${E.source}`;h[I]=n.target.checked})}),p(h)};return e.jsxs(d,{sx:{width:"100%"},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ye,{control:e.jsx(ee,{onChange:j,checked:i>0&&i===y}),label:e.jsxs(d,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[l("webhookEndpoint.selectAllEvents"),e.jsx(d,{sx:{display:"flex",alignItems:"center"},children:e.jsx($,{title:l("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(re,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),i>0&&e.jsx(S,{variant:"body2",color:"primary",sx:{ml:"auto"},children:l("webhookEndpoint.selectedEventsCount",{count:i})})]}),e.jsx(d,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(te,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(s).map(([n,{source:h,events:x,count:E}],I)=>{const O=f[n]>0,R=f[n]===x.length&&x.length>0,A=k[n];return e.jsxs(ie.Fragment,{children:[e.jsx(oe,{sx:{borderBottom:({palette:r})=>I<Object.keys(s).length-1?`1px solid ${r.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(d,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:r=>{r.target.closest(".MuiFormControlLabel-root")||w(n,r)},children:[e.jsx(d,{sx:{display:"flex",alignItems:"center"},children:x.length>0&&e.jsx(ye,{control:e.jsx(ee,{checked:R,indeterminate:O&&!R,onChange:r=>{r.stopPropagation(),T(x,R)}}),label:e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[h.logo&&e.jsx(Xe,{src:h.logo,sx:{width:24,height:24}}),e.jsx(d,{children:h.title||n}),O&&e.jsx(M,{label:l("webhookEndpoint.selectedCount",{count:f[n]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:r=>`${r.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(d,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(S,{variant:"body2",color:"text.secondary",sx:{mr:1},children:l("webhookEndpoint.eventsCount",{count:E})}),x.length>0&&e.jsx(H,{size:"small",edge:"end",children:A?e.jsx(pt,{}):e.jsx(Fe,{})})]})]})}),x.length>0&&e.jsx(Ze,{in:A,timeout:"auto",unmountOnExit:!0,children:e.jsx(te,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:x.map(r=>{const a=`${r.type}-${r.source}`,t=!!c[a];return e.jsx(oe,{dense:!0,sx:{py:.75},onClick:()=>b(r),children:e.jsxs(d,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(ee,{checked:t,sx:{mr:1}}),e.jsxs(d,{children:[e.jsx(S,{variant:"body1",sx:{cursor:"pointer",color:"text.primary"},children:r.type}),e.jsx(S,{variant:"caption",color:"text.secondary",sx:{display:"block",cursor:"pointer"},children:r.description})]})]})},a)})})})]},n)})})}),v&&e.jsx(et,{error:!0,sx:{mt:1},children:v})]})}ce.propTypes={eventsBySource:o.objectOf(o.shape({source:o.shape({did:o.string.isRequired,title:o.string,description:o.string,version:o.string,logo:o.string}).isRequired,events:o.arrayOf(o.shape({type:o.string.isRequired,description:o.string.isRequired,source:o.string.isRequired})).isRequired,count:o.number.isRequired})).isRequired,selectedEvents:o.objectOf(o.bool).isRequired,setSelectedEvents:o.func.isRequired,error:o.string};ce.defaultProps={error:null};function ue({id:s,url:c,description:p,enabledEvents:v,onSubmit:l,onClose:k}){var r;const{t:u}=_(),[f,i]=C.useState({}),{teamDid:y}=Y(),{api:w}=V(),{loading:b,error:T,eventsBySource:j}=gt(),{control:n,handleSubmit:h,formState:{errors:x},reset:E,setValue:I,trigger:O}=Ue({defaultValues:{url:"",description:""}});C.useEffect(()=>{const a=Object.values(f).some(t=>t);I("selectedEvents",a?"valid":""),O("selectedEvents")},[f,I,O]);const R=()=>{i({}),E(),k()},A=async a=>{const t=Object.keys(f).filter(m=>f[m]),g={url:a.url,description:a.description,enabledEvents:t.map(m=>{const[P,z]=m.split("-");return!P||!z?null:{type:P,source:z}}).filter(Boolean)};try{if(s){const m=await w.updateWebhookEndpoint({input:{teamDid:y,id:s,data:g}});q.success(`${u("webhookEndpoint.updateWebhook")} ${u("webhookEndpoint.success")}`),l(m)}else{const m=await w.createWebhookEndpoint({input:{teamDid:y,input:g}});q.success(`${u("webhookEndpoint.createWebhook")} ${u("webhookEndpoint.success")}`),l(m)}}catch(m){q.error(m==null?void 0:m.message)}R()};return C.useEffect(()=>{E({url:c,description:p}),i(v.reduce((a,t)=>(a[`${t.type}-${t.source}`]=!0,a),{}))},[E,i,c,p,v]),e.jsx(Ye,{open:!0,onClose:R,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:h(A),children:[e.jsx(Je,{children:u(s?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(Ge,{children:e.jsxs(d,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(Z,{name:"url",control:n,rules:{required:u("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:u("webhookEndpoint.validation.urlInvalid")}},render:({field:a})=>{var t;return e.jsx(je,{...a,label:u("webhookEndpoint.url.label"),fullWidth:!0,error:!!x.url,helperText:(t=x.url)==null?void 0:t.message})}}),e.jsx(Z,{name:"description",control:n,rules:{required:u("webhookEndpoint.validation.descriptionRequired")},render:({field:a})=>{var t;return e.jsx(je,{...a,label:u("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!x.description,helperText:(t=x.description)==null?void 0:t.message})}}),e.jsx(Z,{name:"selectedEvents",control:n,rules:{required:u("webhookEndpoint.validation.eventRequired")},render:({field:a})=>e.jsx("input",{type:"hidden",...a})}),!b&&j&&Object.keys(j).length>0&&e.jsx(ce,{eventsBySource:j,selectedEvents:f,setSelectedEvents:i,error:(r=x.selectedEvents)==null?void 0:r.message}),!b&&(!j||Object.keys(j).length===0)&&e.jsx(S,{color:"text.secondary",children:u("webhookEndpoint.noAvailableEvents")}),b&&e.jsx(d,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(F,{size:20})}),T&&e.jsx(le,{severity:"error",children:u("webhookEndpoint.loadingError",{message:T==null?void 0:T.message})})]})}),e.jsxs(Qe,{sx:{p:"8px 24px 24px"},children:[e.jsx(N,{onClick:R,children:u("common.cancel")}),e.jsx(N,{type:"submit",variant:"contained",color:"primary",children:u(s?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}ue.propTypes={onSubmit:o.func.isRequired,id:o.string,url:o.string,description:o.string,enabledEvents:o.arrayOf(o.shape({type:o.string.isRequired,source:o.string.isRequired})),onClose:o.func};ue.defaultProps={id:null,url:"",description:"",enabledEvents:[],onClose:()=>{}};function Pe(s){switch(s){case"enabled":return"success";case"disabled":default:return"default"}}const bt=(s="en")=>s==="tw"?"zh":s;function K(s,c="YYYY-MM-DD HH:mm:ss",p="en"){return s?Ke(s).locale(bt(p)).format(c):"-"}function jt(s){return typeof s=="number"?!1:De(s)}function yt(s){return s>=200&&s<300}function W(s){const c=jt(s.value);return e.jsxs(e.Fragment,{children:[e.jsxs(D,{direction:"column",alignItems:"flex-start",children:[e.jsxs(S,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[s.label,!!s.tip&&e.jsx($,{title:s.tip,children:e.jsx(tt,{fontSize:"small"})})]}),e.jsx(S,{component:"div",variant:"body1",color:c?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:c?"-":s.value})]}),s.divider&&e.jsx(Re,{orientation:"vertical",flexItem:!0})]})}W.propTypes={label:o.oneOfType([o.string,o.node]).isRequired,value:o.oneOfType([o.string,o.node]).isRequired,tip:o.oneOfType([o.string,o.node]),divider:o.bool};W.defaultProps={tip:"",divider:!1};function pe(s){return e.jsxs(D,{className:"section-header",direction:"row",justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,sx:{mb:s.mb,mt:s.mt,pb:1},children:[e.jsx(S,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:s.title}),s.children]})}pe.propTypes={title:o.oneOfType([o.string,o.node]).isRequired,children:o.node,mb:o.number,mt:o.number};pe.defaultProps={children:null,mb:1.5,mt:1.5};var he={},wt=ae;Object.defineProperty(he,"__esModule",{value:!0});var ze=he.default=void 0,kt=wt(se()),vt=e;ze=he.default=(0,kt.default)((0,vt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2M7 13.5c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5m5 0c-.83 0-1.5-.67-1.5-1.5s.67-1.5 1.5-1.5 1.5.67 1.5 1.5-.67 1.5-1.5 1.5"}),"Pending");var xe={},Et=ae;Object.defineProperty(xe,"__esModule",{value:!0});var Oe=xe.default=void 0,Ct=Et(se()),St=e;Oe=xe.default=(0,Ct.default)((0,St.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.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m4.59-12.42L10 14.17l-2.59-2.58L6 13l4 4 8-8z"}),"CheckCircleOutlined");var me={},Tt=ae;Object.defineProperty(me,"__esModule",{value:!0});var We=me.default=void 0,It=Tt(se()),Rt=e;We=me.default=(0,It.default)((0,Rt.jsx)("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2m1 15h-2v-2h2zm0-4h-2V7h2z"}),"ErrorOutlined");const Dt={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>'},Pt=s=>{const c={};return s.forEach(p=>{var l;const v=new Date(p.createdAt).toLocaleDateString();c[v]||(c[v]=[]),(l=c[v])==null||l.push(p)}),c};function fe({eventId:s,webhookEndpointId:c,event:p}){const{api:v,ws:{useSubscription:l}}=V(),{t:k}=_(),{teamDid:u}=Y(),{blocklet:f}=Ie(),{data:i,loadMore:y,loadingMore:w,loading:b,mutate:T}=Be(t=>{const m=t?Math.ceil(t.list.length/15)+1:1;return v.getWebhookAttempts({input:{teamDid:u,input:{eventId:s,webhookId:c},paging:{page:m,pageSize:15}}})},{reloadDeps:[s,c]}),j=(i==null?void 0:i.list)||[],[n,h]=C.useState(null),[x,E]=C.useState(!1),I=Pt(j);if(C.useEffect(()=>{!n&&(i!=null&&i.list.length)&&h(i.list[0])},[i==null?void 0:i.list.length,n]),l(ve.EVENTS.WEBHOOK_ATTEMPT,t=>{T(g=>{var P,z;if(g.list.find(L=>L.id===t.id)){const L=g.list.map(B=>B.id===t.id?{...B,...t}:B);return{...g,list:L}}return t.endpoint=(P=g.list[0])==null?void 0:P.endpoint,t.event=(z=g.list[0])==null?void 0:z.event,{...g,list:[t,...g.list]}})},[]),b)return e.jsx(F,{});const O=i&&i.list.length<i.paging.total,R=async()=>{n&&(E(!0),await v.retryWebhookAttempt({input:{teamDid:u,eventId:n.event.id,webhookId:c,attemptId:n.id}}).finally(()=>{setTimeout(()=>{E(!1)},1e3)}))},A=t=>{var g,m,P,z,L;if(t.responseBody&&((g=t.responseBody)!=null&&g.sessionId)&&((m=t.responseBody)!=null&&m.projectId)&&((P=t.responseBody)!=null&&P.agentId)){const B=(L=(z=f==null?void 0:f.site)==null?void 0:z.domainAliases[0])==null?void 0:L.value,J=(f.children||[]).find(G=>{var be;return((be=G==null?void 0:G.meta)==null?void 0:be.name)==="ai-studio"}),qe=ht(xt(`https://${B}`,(J==null?void 0:J.mountPoint)||"","projects",t.responseBody.projectId,"logs/main"),{sessionId:t.responseBody.sessionId,agentId:t.responseBody.agentId});return e.jsx(H,{sx:{fontSize:20},onClick:()=>window.open(qe,"_blank"),children:e.jsx(d,{component:U,icon:Q})})}return null},r=t=>t.status==="pending"?e.jsx(ze,{color:"warning"}):yt(t.responseStatus)?e.jsx(Oe,{color:"success"}):e.jsx(We,{color:"error"}),a=(n==null?void 0:n.triggeredFrom)&&((i==null?void 0:i.list)||[]).find(t=>t.id===n.triggeredFrom);return e.jsxs(zt,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(ne,{item:!0,xs:12,md:4,height:1,children:De(Object.keys(I))?e.jsx(S,{color:"text.secondary",children:k("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(te,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(I).map(([t,g])=>e.jsxs(ie.Fragment,{children:[e.jsx(ot,{sx:{p:0},children:t}),g.map(m=>e.jsxs(oe,{sx:{cursor:"pointer",px:1},onClick:()=>h(m),selected:n&&(n==null?void 0:n.id)===(m==null?void 0:m.id),secondaryAction:e.jsx(S,{color:"text.secondary",children:K(m.createdAt,"HH:mm:ss")}),children:[e.jsx(nt,{sx:{minWidth:0,mr:1.5},children:r(m)}),e.jsx(st,{primary:e.jsx(S,{color:"text.primary",children:m.event.type})})]},m.id))]},t))}),O&&e.jsx(d,{display:"flex",justifyContent:"center",alignItems:"center",width:1,children:e.jsx(N,{variant:"text",type:"button",color:"inherit",onClick:y,disabled:w,sx:{color:t=>t.palette.text.disabled},children:k(w?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(ne,{item:!0,xs:12,md:8,height:1,children:[n&&e.jsxs(D,{height:1,overflow:"auto",direction:"column",spacing:2,sx:{pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"h4",children:k(`common.${n.status}`)}),e.jsx(d,{children:A(n)})]}),e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[a&&e.jsx($,{componentsProps:{tooltip:{sx:{maxWidth:400}}},placement:"left",title:e.jsxs(D,{gap:1,sx:{cursor:"pointer",".did-address-text":{color:"common.white"}},onClick:()=>h(a),children:[e.jsx(Ee,{showDid:!0,did:n.triggeredBy,cardType:Ce.Detailed,infoType:Se.Minimal,sx:{border:0,padding:0,minWidth:0,".MuiTypography-root":{color:"common.white",fontWeight:400}}}),e.jsx(Re,{}),e.jsxs(d,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(S,{variant:"body2",sx:{color:"primary.main"},children:k("webhookEndpoint.triggeredFrom")}),e.jsxs(d,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(S,{variant:"body2",children:n.id}),e.jsx(H,{onClick:()=>h(a),children:e.jsx(d,{component:U,icon:Q,sx:{fontSize:16,color:"common.white"}})})]})]})]}),children:e.jsx(H,{onClick:()=>h(a),children:e.jsx(d,{component:U,icon:Q,sx:{fontSize:16}})})}),e.jsxs(N,{variant:"outlined",color:"primary",size:"small",onClick:R,disabled:x,children:[e.jsx(d,{component:U,icon:Dt,sx:{fontSize:16,animation:x?"spin 1s linear infinite":"none",mr:.5}}),k("notification.resend")]})]})]}),e.jsxs(d,{children:[e.jsxs(S,{variant:"h6",children:[k("webhookEndpoint.response")," (",n.responseStatus,")"]}),e.jsx(X,{language:"json",children:JSON.stringify(n.responseBody,null,2)})]}),e.jsxs(d,{children:[e.jsx(D,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:k("webhookEndpoint.request")})}),e.jsx(X,{language:"json",sx:{margin:0},children:JSON.stringify(n.event,null,2)})]})]}),(i==null?void 0:i.list.length)===0&&p&&e.jsxs(d,{children:[e.jsx(D,{direction:"row",alignItems:"center",spacing:1,children:e.jsx(S,{variant:"h6",children:k("webhookEndpoint.eventData")})}),e.jsx(X,{language:"json",sx:{margin:0},children:JSON.stringify(p.data,null,2)})]})]})]})}fe.propTypes={eventId:o.string,webhookEndpointId:o.string,event:o.shape({type:o.string,data:o.object,request:o.object,requestInfo:o.object})};fe.defaultProps={eventId:"",webhookEndpointId:"",event:null};const zt=de(ne)`
2
2
  @keyframes spin {
3
3
  to {
4
4
  transform: rotate(360deg);