@abtnode/blocklet-services 1.16.52-beta-20250922-225859-f34775fa → 1.16.52-beta-20250924-135333-541024a8

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 (122) hide show
  1. package/api/index.js +1 -1
  2. package/api/middlewares/launcher-login.js +104 -89
  3. package/api/routes/user.js +31 -0
  4. package/dist/assets/{access-control-CUncF5eX.js → access-control-MtITiDMT.js} +1 -1
  5. package/dist/assets/{add-component-core-DTRxHh-8.js → add-component-core-DT871JXs.js} +1 -1
  6. package/dist/assets/{add-resource-YxBtdKAz.js → add-resource-BnQPv53-.js} +1 -1
  7. package/dist/assets/{addon-C-cTa3hU.js → addon-CAvqw8mm.js} +1 -1
  8. package/dist/assets/{advanced-Bc2FwW94.js → advanced-BeEKQmus.js} +1 -1
  9. package/dist/assets/{aigne-BmhUzMaB.js → aigne-DepLc7CZ.js} +1 -1
  10. package/dist/assets/{appearance-KZ98aKpU.js → appearance-CQM-3LPu.js} +1 -1
  11. package/dist/assets/{arrow-down.svg-DNHk5QBL.js → arrow-down.svg-VIKI4IBd.js} +1 -1
  12. package/dist/assets/{audit-logs-CToENzIH.js → audit-logs-B4nW0HQW.js} +1 -1
  13. package/dist/assets/{authorize-Cr07b2RV.js → authorize-DtR2q4pL.js} +1 -1
  14. package/dist/assets/{base32-9HlsUoU3.js → base32-dGIGRTeZ.js} +1 -1
  15. package/dist/assets/{bind-account-DGyijOaV.js → bind-account-DKu95GI-.js} +1 -1
  16. package/dist/assets/{branding-Bop5aLE8.js → branding-BxI7VSjI.js} +1 -1
  17. package/dist/assets/{branding-EXYczJqB.js → branding-DI8S4rKX.js} +1 -1
  18. package/dist/assets/{branding-rX1QvJVq.js → branding-DIltHBq0.js} +2 -2
  19. package/dist/assets/{bundle-avatar-BhNvlq8g.js → bundle-avatar-BvwlMY-v.js} +1 -1
  20. package/dist/assets/{complete-CE-9uScC.js → complete-BiA0H-F-.js} +1 -1
  21. package/dist/assets/{component-BGn03l-s.js → component-CcDcQA4R.js} +3 -3
  22. package/dist/assets/{config-CLkKQ7r7.js → config-7aDpCy1J.js} +1 -1
  23. package/dist/assets/{config-CiMC747A.js → config-BDmrqxia.js} +1 -1
  24. package/dist/assets/{config-Ce7mmKUy.js → config-CegNHv38.js} +1 -1
  25. package/dist/assets/{config-navigation-C_bXC3i-.js → config-navigation-DeVpCAhC.js} +3 -3
  26. package/dist/assets/{config-space-B1RlBsPr.js → config-space-D3NLSAOS.js} +1 -1
  27. package/dist/assets/{confirm-DUjUXcfn.js → confirm-BbY8YGyk.js} +1 -1
  28. package/dist/assets/{connect-DWVzC8Cs.js → connect-3UzkXBvk.js} +1 -1
  29. package/dist/assets/{connect-Cd4wFjvm.js → connect-NiZcQvBT.js} +1 -1
  30. package/dist/assets/{connect-to-DgA22hrU.js → connect-to-QQ3T-HpF.js} +1 -1
  31. package/dist/assets/{dashboard-q_CEWNOG.js → dashboard-C_xJDuQY.js} +3 -3
  32. package/dist/assets/{delete-confirm-BIF7Oky1.js → delete-confirm-ZcwDcAcQ.js} +1 -1
  33. package/dist/assets/{domain-action-card-BfXWszwh.js → domain-action-card-t81ZH6IT.js} +1 -1
  34. package/dist/assets/{domain-DXf6J0eN.js → domain-oUFlaLKy.js} +1 -1
  35. package/dist/assets/{domains-CbRUCl8I.js → domains-CMbykSQm.js} +1 -1
  36. package/dist/assets/{email-C99N-_0O.js → email-BfBsaQZc.js} +1 -1
  37. package/dist/assets/engine-BNoG81bE.js +1 -0
  38. package/dist/assets/{exchange-passport-iJ_WwErZ.js → exchange-passport-DHCCHO-N.js} +1 -1
  39. package/dist/assets/{form-B28GN43f.js → form-Csfi6zyX.js} +1 -1
  40. package/dist/assets/{fuel-BTDuZSSj.js → fuel-CUlDLjak.js} +1 -1
  41. package/dist/assets/{gen-access-key-naR-6zBu.js → gen-access-key-C3uuo9SI.js} +1 -1
  42. package/dist/assets/{gen-simple-access-key-C7ybjshX.js → gen-simple-access-key-CX90y0zh.js} +1 -1
  43. package/dist/assets/{get-safe-url-PVZ8sNva.js → get-safe-url-DKg8JLr1.js} +1 -1
  44. package/dist/assets/{hdkey-CcHIRiJU.js → hdkey-BgsbeAhG.js} +1 -1
  45. package/dist/assets/{home-BQG60l8o.js → home-BwyzLr74.js} +1 -1
  46. package/dist/assets/{iframe-sRTCxuKq.js → iframe-SCM7rlz3.js} +1 -1
  47. package/dist/assets/{index-D5Esor4q.js → index-BJbNz5vx.js} +4 -4
  48. package/dist/assets/{index-DANBSlDF.js → index-BPJUfDZY.js} +1 -1
  49. package/dist/assets/{index-BqyC8rPJ.js → index-BUiG3mKw.js} +1 -1
  50. package/dist/assets/{index-CKFVrVhW.js → index-BWAu1pEw.js} +1 -1
  51. package/dist/assets/{index-DL5x17V7.js → index-BwMsFaIR.js} +1 -1
  52. package/dist/assets/{index-CtG4EPx1.js → index-CB__aq5L.js} +1 -1
  53. package/dist/assets/{index-DIfIqZRw.js → index-CJWwSLdB.js} +3 -3
  54. package/dist/assets/{index-mK8LnyWX.js → index-CKOznUni.js} +1 -1
  55. package/dist/assets/{index-DbV_otyH.js → index-CKpQd8db.js} +4 -4
  56. package/dist/assets/{index-VDwida7T.js → index-CfHItWba.js} +1 -1
  57. package/dist/assets/{index-D_tcdsnn.js → index-Cn5TXl_L.js} +1 -1
  58. package/dist/assets/{index-BHu1ffJP.js → index-D-puzkw-.js} +1 -1
  59. package/dist/assets/{index-DhLCZYhn.js → index-D7zqBJdA.js} +1 -1
  60. package/dist/assets/{index-P7sOU3FB.js → index-DH4W6unN.js} +1 -1
  61. package/dist/assets/{index-BVZj6aBL.js → index-DS-40ZVK.js} +1 -1
  62. package/dist/assets/{index-BXOWDqXU.js → index-DTU7_GN0.js} +1 -1
  63. package/dist/assets/{index-De78rJ-L.js → index-Qx6e57-u.js} +1 -1
  64. package/dist/assets/{index-BT7jxh7R.js → index-VARWquqH.js} +1 -1
  65. package/dist/assets/{index-DP4_T7ss.js → index-c7w7Lgaw.js} +1 -1
  66. package/dist/assets/{index-B2Y1qZ07.js → index-g5_ozUJZ.js} +1 -1
  67. package/dist/assets/{index-Co6fM09o.js → index-sQzZNoGx.js} +1 -1
  68. package/dist/assets/{index-DDpL_qpY.js → index-uH_9YgA0.js} +1 -1
  69. package/dist/assets/{index-I4fObt9S.js → index-v50gyNUL.js} +1 -1
  70. package/dist/assets/{invitation-xW_qcQrB.js → invitation-GzoS6QSS.js} +1 -1
  71. package/dist/assets/{invite-5NmeedgR.js → invite-DDdJj6co.js} +1 -1
  72. package/dist/assets/{isURL-DZGsNcmL.js → isURL-CCV0esLR.js} +1 -1
  73. package/dist/assets/{issue-passport-CUjAU9Y6.js → issue-passport-PUK3HiX7.js} +1 -1
  74. package/dist/assets/{item-B-p0IMj0.js → item-DAL9Dho-.js} +1 -1
  75. package/dist/assets/{landing-page-RSi1tJUt.js → landing-page-CL9L_8lE.js} +1 -1
  76. package/dist/assets/{layout-BTKpH5C3.js → layout-CWE2T-JY.js} +1 -1
  77. package/dist/assets/{list-DM_X_DbX.js → list-B1IF52f7.js} +1 -1
  78. package/dist/assets/{list-C9HtsKYw.js → list-DNkyeHs7.js} +3 -3
  79. package/dist/assets/{localization-B-_Xdumv.js → localization-DWmiu7jH.js} +1 -1
  80. package/dist/assets/{log-ByUaGQDD.js → log-CH5xMfwF.js} +1 -1
  81. package/dist/assets/{login-B1S8adpO.js → login-C0H7ScpD.js} +1 -1
  82. package/dist/assets/{login-oauth-callback-CK2OuZQv.js → login-oauth-callback-yy8oOs-S.js} +1 -1
  83. package/dist/assets/{logo-uploader-DijYekzI.js → logo-uploader-BbYoAyD-.js} +2 -2
  84. package/dist/assets/{lost-passport-wz0F5eGp.js → lost-passport-CnWY_gqA.js} +1 -1
  85. package/dist/assets/{open-window-PMr3_tpx.js → open-window-2gqXwgFW.js} +1 -1
  86. package/dist/assets/{over-due-invoice-payment-CgKEpOv9.js → over-due-invoice-payment-D2yclQzx.js} +1 -1
  87. package/dist/assets/{overview-BPXQ5NOz.js → overview-B4sE3XPK.js} +1 -1
  88. package/dist/assets/{passport-item-CtgFdOsh.js → passport-item-CK1Zj4rm.js} +1 -1
  89. package/dist/assets/{permission-DO4jN8xJ.js → permission-CSIyJtvw.js} +1 -1
  90. package/dist/assets/{preferences-FO1x_0r1.js → preferences-BBghzBy7.js} +1 -1
  91. package/dist/assets/{profile-embed-BKg9ZugM.js → profile-embed-B2uhPkoV.js} +1 -1
  92. package/dist/assets/{publish-resource-CtlORU2W.js → publish-resource-DhuBgzO7.js} +1 -1
  93. package/dist/assets/{runtime-B0pQvnF3.js → runtime-B3mVl8w2.js} +1 -1
  94. package/dist/assets/sdk-B4j47QQf.js +1 -0
  95. package/dist/assets/{security-CQehWrjL.js → security-g0CzShNx.js} +1 -1
  96. package/dist/assets/{session-DGB-yOme.js → session-m3orzHBa.js} +1 -1
  97. package/dist/assets/{setup-neejBzI5.js → setup-D_impIE6.js} +1 -1
  98. package/dist/assets/{spaces-CZJwyRzV.js → spaces-p4zKSeyp.js} +1 -1
  99. package/dist/assets/{start-OOD_HRyM.js → start-BD7Kr8U-.js} +1 -1
  100. package/dist/assets/{status-5pZO2qoE.js → status-D1-G3QED.js} +1 -1
  101. package/dist/assets/{step-actions-C_A-deel.js → step-actions-RYL0A520.js} +1 -1
  102. package/dist/assets/{studio-DkZBruFV.js → studio-Bp-XDrgR.js} +1 -1
  103. package/dist/assets/{team-CGGZIbfh.js → team-B-jk7E5_.js} +1 -1
  104. package/dist/assets/{traffic-Bt0n-c6_.js → traffic-CInL395-.js} +1 -1
  105. package/dist/assets/{transfer-KpJ1sGgq.js → transfer-Z_9W88aQ.js} +1 -1
  106. package/dist/assets/{unsubscribe-CF4vy-ZY.js → unsubscribe-B07Ogw5q.js} +1 -1
  107. package/dist/assets/{use-app-logo-DxlfjGOQ.js → use-app-logo-D_gO-Dio.js} +1 -1
  108. package/dist/assets/{user-center-C7a4TtFt.js → user-center-DzijYiyQ.js} +3 -3
  109. package/dist/assets/{user-follower-Cs8st3w5.js → user-follower-DWn8bXG-.js} +1 -1
  110. package/dist/assets/{user-sessions-DN1hzt8P.js → user-sessions-CuXtk29w.js} +1 -1
  111. package/dist/assets/{util-CnXmjN2T.js → util-BYg7Nb7Z.js} +1 -1
  112. package/dist/assets/{util-CYsTlK2W.js → util-Bravn321.js} +1 -1
  113. package/dist/assets/{wait-connect-DxmVFheW.js → wait-connect-CgBXxzyb.js} +1 -1
  114. package/dist/assets/{wizard-BvaUZfHg.js → wizard-BEs2v6uI.js} +1 -1
  115. package/dist/assets/{wizard-components-BoWnBOyn.js → wizard-components-5FNqoPRf.js} +2 -2
  116. package/dist/assets/{wrap-locale-DU2DJaEg.js → wrap-locale-B5OsZl6Q.js} +1 -1
  117. package/dist/assets/{zh-CVf8x4U0.js → zh-NsxeedJj.js} +1 -1
  118. package/dist/index.html +1 -1
  119. package/dist/service-worker.js +1 -1
  120. package/package.json +23 -23
  121. package/dist/assets/engine-Cc4hAHgQ.js +0 -1
  122. package/dist/assets/sdk-C9i2DDEJ.js +0 -1
@@ -1,4 +1,4 @@
1
- import{g as Wt,r as v}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as y,z as Z,b6 as me,be as Ke,y as V,am as ut,c_ as Bt,bm as Kt,at as ae,b1 as mt,W as h,T as ee,U as Ge,c$ as pt,b5 as qe,a5 as Me,Q as Fe,d0 as Je,aN as Ue,a6 as ft,D as ht,d1 as qt,ad as xt,d2 as Mt,d3 as Ut,c1 as st,n as Ht,x as $t,bb as Vt,M as it,cv as Gt,I as Jt,d4 as Yt}from"./vendor-mui-core-CmD-NPnl.js";import{A as gt,J as Xt,C as Zt,e as le,F as Qt,a3 as je}from"./vendor-utils-DQK0pEML.js";import{T as te,H as M,D as ce,G as en,L as bt,al as tn,aK as nn,y as jt,$ as vt,ac as yt,aL as Ae,F as St,a6 as sn,ai as an}from"./vendor-ux-pYOhjQLA.js";import{aF as rn,Z as Ye,a8 as Ct,aZ as wt,M as _e,c as _,ap as Q,p as on,aO as at}from"./index-D5Esor4q.js";import{g as ye,b as $,a as se}from"./vendor-hooks-DLNZ8kxG.js";import{u as Rt,C as Y}from"./index.esm-JPZAjt0x.js";import{i as He}from"./isURL-DZGsNcmL.js";import{S as X}from"./section-CndbjVtx.js";import{A as ln,a as cn,b as dn}from"./collapse-GMtfQlRs.js";import{S as Se}from"./shorten-label-Cbu8wo9m.js";import{v as Tt}from"./index-DzI9kX_C.js";import{R as Nt,A as un,S as mn,a as pn,B as fn}from"./list-DM_X_DbX.js";import{j as hn,c as xn,N as gn}from"./team-CGGZIbfh.js";import{W as bn}from"./did-address-CNnw4_bl.js";import{p as It}from"./util-CYsTlK2W.js";import{D as jn,g as vn}from"./traffic-Bt0n-c6_.js";import{B as Et}from"./bundle-avatar-BhNvlq8g.js";import{u as yn}from"./use-mobile-D93Bk2Ru.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DEa0A9MF.js";import"./required-B2SKELXR.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-DDpL_qpY.js";import"./session-DGB-yOme.js";import"./use-app-logo-DxlfjGOQ.js";import"./base32-9HlsUoU3.js";import"./useAsyncRetry-6TjWJyO6.js";import"./useAsync-CNAYLnLm.js";import"./iframe-sRTCxuKq.js";import"./index-CNvRrWdA.js";import"./index-DBs9Ljax.js";import"./base-chart-BntWHeFy.js";import"./index-DO9UDa6G.js";import"./vendor-mui-x--K2rEM1j.js";import"./AdapterDayjs-Ch1GqpK7.js";var Te={exports:{}},Ne={exports:{}},Ie={exports:{}},rt;function Sn(){return rt||(rt=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=t;function t(r){return r==null}n.exports=s.default,n.exports.default=s.default}(Ie,Ie.exports)),Ie.exports}var ot;function Cn(){return ot||(ot=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=u;var t=o(rn()),r=o(Sn());function o(p){return p&&p.__esModule?p:{default:p}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,b=/^[-+]?[0-9]+$/;function u(p,i){(0,t.default)(p),i=i||{};var N=i.allow_leading_zeroes===!1?l:b,I=!i.hasOwnProperty("min")||(0,r.default)(i.min)||p>=i.min,S=!i.hasOwnProperty("max")||(0,r.default)(i.max)||p<=i.max,j=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||p<i.lt,E=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||p>i.gt;return N.test(p)&&I&&S&&j&&E}n.exports=s.default,n.exports.default=s.default}(Ne,Ne.exports)),Ne.exports}var lt;function wn(){return lt||(lt=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=o;var t=r(Cn());function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,t.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=s.default,n.exports.default=s.default}(Te,Te.exports)),Te.exports}var Rn=wn();const Tn=Wt(Rn),ze={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Nn(){const{api:n}=Ye(),{blocklet:s}=Ct(),{t}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,b=Object.assign({...ze},s?.settings?.notification?.email||{}),{handleSubmit:u,control:p,formState:i,watch:N,reset:I}=Rt({defaultValues:gt(b,Object.keys(ze))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(a,T,O=!0)=>{try{const{blocklet:D}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),re=Object.assign({...ze},D?.settings?.notification?.email||{});I(re),O&&M.success(t("oauth.saveSuccess"))}catch(D){if(O)M.error(D.message||t("oauth.saveFailed"));else throw D}}),G=$(async(a,T,O)=>{try{i.isDirty&&await E(a,T,!1),await n.sendEmail({input:{did:l,receiver:O,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification",attachments:[{type:"link",data:{url:"https://community.arcblock.io",title:"Community",image:"https://community.arcblock.io/.well-known/service/blocklet/logo-rect-dark",utm:{campaign:"test-campaign"}}}],utm:{content:"test-email-button"}})}}),M.success(t("notification.email.testSuccess"))}catch(D){M.error(D.message||t("notification.email.testfailed"))}}),z=$((a,T)=>{S.testReceiver=localStorage.getItem("test-receiver")||"",S.testReceiverError="",r.open({title:t("notification.email.testSendEmail"),content:()=>e.jsx(y,{sx:{width:"300px"},children:e.jsx(Z,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.email.inputTestReceiver"),value:S.testReceiver,onChange:O=>{S.testReceiver=O.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(O){const D=S.testReceiver?.trim();if(!D){S.testReceiverError=t("notification.email.receiverRequired");return}if(!_e(D)){S.testReceiverError=t("notification.email.receiverInvalid");return}S.testReceiverError="",await G(a,T,D),O()}})}),F=$(a=>{const T=a?.trim();return T?_e(T)?!0:t("notification.email.fromInvalid"):t("notification.email.fromRequired")}),B=$(a=>{const T=a?.trim();return T?He(T,{require_host:!1,protocols:[]})?!0:t("notification.email.hostInvalid"):t("notification.email.hostRequired")}),w=$(a=>a?Tn(a)?!0:t("notification.email.portInvalid"):t("notification.email.portRequired")),K=$(a=>a?.trim()?!0:t("notification.email.userRequired")),q=$(a=>a?.trim()?!0:t("notification.email.passwordRequired")),f=$(a=>a?.trim()&&!He(a,{protocols:["http","https"],require_protocol:!0})?t("notification.email.linkInvalid"):!0),R=$(a=>a?.trim()&&!_e(a)?t("notification.email.emailInvalid"):!0),C=$(()=>!0);return e.jsxs(y,{children:[e.jsxs(In,{component:"form",onSubmit:u(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(X,{title:t("notification.email.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:p,render:({field:a})=>e.jsx(me,{control:e.jsx(Ke,{checked:a.value,...a})})})}),e.jsx(X,{title:t("notification.email.from"),children:e.jsx(Y,{name:"from",control:p,rules:{validate:j?F:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,label:t("notification.email.from"),error:!!i.errors[a.name],helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.host"),children:e.jsx(Y,{name:"host",control:p,rules:{validate:j?B:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:t("notification.email.host"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.port"),children:e.jsx(Y,{name:"port",control:p,rules:{validate:j?w:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:t("notification.email.port"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.user"),children:e.jsx(Y,{name:"user",control:p,rules:{validate:j?K:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:t("notification.email.user"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.password"),children:e.jsx(Y,{name:"password",control:p,rules:{validate:j?q:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:t("notification.email.password"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.secure"),children:e.jsx(Y,{name:"secure",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(me,{control:e.jsx(Ke,{checked:a.value,...a,disabled:!j})})})})}),e.jsxs(ln,{children:[e.jsxs(cn,{expandIcon:e.jsx(Kt,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[t("notification.email.signature"),e.jsx(ut,{title:t("notification.email.signatureTooltip"),children:e.jsx(Bt,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(dn,{children:[e.jsx(X,{title:t("notification.email.companyName"),children:e.jsx(Y,{name:"companyName",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyName"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.companyLink"),children:e.jsx(Y,{name:"companyLink",control:p,rules:{validate:j?f:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyLink"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.companyAddress"),children:e.jsx(Y,{name:"companyAddress",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyAddress"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.supportEmail"),children:e.jsx(Y,{name:"supportEmail",control:p,rules:{validate:j?R:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:t("notification.email.supportEmail"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})})]})]}),e.jsxs(y,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(ce,{variant:"outlined",color:"warning",onClick:u(z),disabled:!j,children:t("oauth.runTest")}),e.jsx(ce,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),o]})}const In=ae(mt)``,We={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function En(){const{api:n}=Ye(),{blocklet:s}=Ct(),{t}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,b=Object.assign({...We},s?.settings?.notification?.pushKit||{}),{handleSubmit:u,control:p,formState:i,watch:N,reset:I}=Rt({defaultValues:gt(b,Object.keys(We))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(w,K,q=!0)=>{try{const{blocklet:f}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:w})}}),R=Object.assign({...We},f?.settings?.notification?.pushKit||{});I(R),q&&M.success(t("oauth.saveSuccess"))}catch(f){if(q)M.error(f.message||t("oauth.saveFailed"));else throw f}}),G=$(async(w,K)=>{try{i.isDirty&&await E(w,K,!1);const q=(s?.configs||[]).find(C=>C.key==="BLOCKLET_APP_URL")?.value,f=Xt(Zt(q,_.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:s?.meta?.version,t:new Date(s?.updatedAt||0).getTime()}),R={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:s?.appDid,fullName:s?.meta?.title,avatar:f}}}};await n.sendPush({input:{did:l,receiver:S.testReceiver,notification:JSON.stringify(R)}}),M.success(t("notification.pushKit.testSuccess"))}catch(q){M.error(q.message||t("notification.pushKit.testfailed"))}}),z=$((w,K)=>{S.testReceiverError="",r.open({title:t("notification.pushKit.testSend"),content:()=>e.jsx(y,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(Z,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.pushKit.inputTestReceiver"),value:S.testReceiver,onChange:q=>{S.testReceiver=q.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(q){if(!S.testReceiver?.trim()){S.testReceiverError=t("notification.pushKit.receiverRequired");return}S.testReceiverError="",await G(w,K),q()}})}),F=$(w=>{const K=w?.trim();return K?He(K)?!0:t("notification.pushKit.endpointInvalid"):t("notification.pushKit.endpointRequired")}),B=$(()=>!0);return e.jsxs(y,{children:[e.jsxs(kn,{component:"form",onSubmit:u(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(X,{title:t("notification.pushKit.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:p,render:({field:w})=>e.jsx(me,{control:e.jsx(Ke,{checked:w.value,...w})})})}),e.jsx(X,{title:t("notification.pushKit.endpoint"),children:e.jsx(Y,{name:"endpoint",control:p,rules:{validate:j?F:B},render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...w,size:"small",required:!0,label:t("notification.pushKit.endpoint"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})})}),e.jsxs(X,{title:t("notification.pushKit.customOptions"),children:[e.jsx(Y,{name:"did",control:p,render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...w,size:"small",label:t("notification.pushKit.did"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})}),e.jsx(Y,{name:"pushPath",control:p,render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...w,size:"small",label:t("notification.pushKit.pushPath"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})})]}),e.jsxs(y,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(ce,{variant:"outlined",color:"warning",onClick:u(z),disabled:!j,children:t("oauth.runTest")}),e.jsx(ce,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),o]})}const kn=ae(mt)``,ct=[{label:e.jsx(y,{sx:{textAlign:"center",width:"100%"},children:"Email"}),value:"email"},{label:e.jsx(y,{sx:{textAlign:"center",width:"100%"},children:"Push Kit"}),value:"pushKit"}];function An(){const[n,s]=v.useState(ct[0].value),{locale:t}=v.useContext(en),r=se(()=>({email:e.jsx(Nn,{}),pushKit:e.jsx(En,{})}),[t]),o=v.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(y,{children:[e.jsx(bt,{tabs:ct,current:n,onChange:s}),e.jsx(y,{style:o,children:r[n]})]})}const kt=v.createContext({}),{Provider:On,Consumer:Ws}=kt;function Dn({children:n,blocklet:s=""}){const{api:t,inService:r,ws:{useSubscription:o}}=Ye(),[l,b]=v.useState([]),[u,p]=v.useState({total:0,pageSize:20,pageCount:0,page:1}),i=se(()=>s.meta?.did,[s]),[N,I]=v.useState([]),[S,j]=v.useState({}),E=se(()=>l.length?new Set(l.map(f=>f.id)):new Set,[l]),G=async({page:f=1,pageSize:R=20,...C}={})=>{if(!i)return[];try{const a={paging:{page:f,pageSize:R},...C,teamDid:i,dateRange:C.dateRange?[Q(C.dateRange[0]).toISOString(),Q(C.dateRange[1]).toISOString()]:void 0},{dids:T,...O}=a;let D="";T&&T.includes("system")&&(D="system");const re=T?T.filter(pe=>pe!=="system"):[],ue={...O,source:D,componentDids:re},oe=await t.getNotificationSendLog({input:ue});return j(ue),b(oe.list),p(oe.paging),oe.list}catch(a){return M.error(a.message),[]}},z=async()=>{const f=await t.getNotificationComponents({input:{teamDid:i}});I(f.componentDids)},F=v.useCallback(f=>{const R=s.children.find(C=>C.meta?.did===f);if(R)return R.ancestors=[s],R},[s]),B=async({notificationId:f,receivers:R,channels:C,...a})=>{await t.resendNotification({input:{teamDid:i,notificationId:f,receivers:R,channels:C.map(T=>T==="wallet"?_.NOTIFICATION_SEND_CHANNEL.WALLET:T==="pushKit"?_.NOTIFICATION_SEND_CHANNEL.PUSH:T),...a}})},w=v.useCallback(async f=>(await t.getUser({input:{teamDid:i,user:{did:f},options:{enableConnectedAccount:!0}}})).user,[t,i]),K=v.useCallback(async({page:f=1,pageSize:R=20,...C}={})=>{try{const a={paging:{page:f,pageSize:R},...C,userName:C.searchText||"",teamDid:i,dateRange:C.dateRange?[Q(C.dateRange[0]).toISOString(),Q(C.dateRange[1]).toISOString()]:void 0};return await t.getReceivers({input:a})}catch(a){throw M.error(a.message),a}},[t,i]);v.useEffect(()=>{i&&z()},[i]),o(_.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,f=>{E.has(f.notificationId)&&G(S)},[E,S]),o(_.EVENTS.NOTIFICATION_BLOCKLET_CREATE,f=>{E.has(f.id)||G(S)},[E,S]);const q={fetch:G,data:l,paging:u,blocklet:s,getComponent:F,resendNotification:B,getUser:w,componentDids:N,getReceivers:K,inService:r,teamDid:i};return e.jsx(On,{value:{notificationRecords:q},children:n})}function Xe(){const{notificationRecords:n}=v.useContext(kt);return n}Ce.propTypes={severity:h.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ln={info:"primary",success:"success",error:"error",warning:"warning"};function Ce({severity:n="info"}){return e.jsx(tn,{type:Ln[n],children:n})}const Pn=(n,s,t="")=>{if(!t||!s)return"";switch(t){case _.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return t}};function At(n,s,t={}){const{status:r,updatedAt:o,reason:l="",channel:b="wallet"}=t,u=o?n("notification.sendStatus.sentTime",{date:on(o,s)}):"",p=Pn(n,b,l);return r===_.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:u,reason:p}:r===_.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:n("notification.sendStatus.pending"),reason:p,sentTime:u}}const $e={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ve=["wallet","pushKit","email"],dt=["info","success","error","warning"],Ot=n=>{const{settings:s}=n;return s?.notification?.email?.enabled},Dt=n=>{const{settings:s}=n;return s?.notification?.pushKit?.enabled},Fn=(n,s)=>{const t=le(s,"extra.notifications.email",!0);return{available:Ot(n),enabled:t}},_n=(n,s)=>{const t=le(s,"extra.notifications.push",!0);return{available:Dt(n),enabled:t}},zn=n=>({enabled:le(n,"extra.notifications.wallet",!0)}),Wn=n=>({enabled:le(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(s=>{setTimeout(()=>{s()},n*1e3)}),Bn=(n,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:s}),fail:n("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:n("notification.sendStatus.reason.available",{channel:s}),fail:n("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:s}),fail:n("notification.sendStatus.reason.disabled",{channel:s})}]:[],ke=(n=[])=>{const s=Q().startOf("day");return n.filter(t=>Q(t.sendAt).isSame(s,"day")).length},Kn=(n,s="")=>{if(s&&Ve.includes(s)){const l=`${s}SendRecord`,b=le(n,l,[]);return ke(b)}const t=le(n,"webhook",{}),r=Object.keys(t??{})??[];if(s&&r.includes(s)){const l=t[s]??[];return ke(l)}const o={};return Ve.forEach(l=>{const b=`${l}SendRecord`,u=le(n,b,[]),p=ke(u);o[l]=p}),r.length>0&&r.forEach(l=>{const b=t[l]??[],u=ke(b);o[l]=u}),o},Oe=(n,s,t)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[t].splice(s,1),n},De=(n,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(n):!1},qn=n=>{switch(n){case _.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case _.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case _.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case _.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Lt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function de({config:n,enableTooltip:s=!0,showTitle:t=!1,children:r=null}){const{status:o,title:l="",sentTime:b="",reason:u=""}=n,p=[l,u].filter(Boolean).join(", ");return e.jsx(ut,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:p}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(y,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(y,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(y,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:$e[o]}}),e.jsx(y,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:$e[o]}})]}),e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:t?l:r})]})})}de.propTypes={config:h.object.isRequired,enableTooltip:h.bool,showTitle:h.bool,children:h.node};Le.propTypes={list:h.array.isRequired,label:h.string.isRequired,onDelete:h.func};function Le({list:n,label:s,onDelete:t=()=>{}}){const{t:r,locale:o}=te();return e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),n.map(l=>{const b=At(r,o,{status:l});return e.jsx(Ge,{size:"small",label:e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(de,{config:b,enableTooltip:!1,children:b.title})}),onDelete:u=>t(u,l)},l)})]})}Ze.propTypes={filterList:h.array.isRequired,onChange:h.func.isRequired,index:h.number.isRequired,column:h.object.isRequired,filterValues:h.array.isRequired,label:h.string.isRequired,renderLabel:h.func.isRequired};function Ze({filterList:n,onChange:s,index:t,column:r,filterValues:o,label:l,renderLabel:b}){return e.jsxs(V,{className:"filter-container",children:[e.jsx(pt,{component:"legend",children:l}),e.jsx(qe,{row:!0,children:o.map(u=>e.jsx(me,{control:e.jsx(Me,{checked:n[t].indexOf(u.value??u)>-1,onChange:p=>{const i=[...n];p.target.checked?i[t]=[...i[t],u.value??u]:i[t]=i[t].filter(N=>N!==(u.value??u)),s(i[t],t,r)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(u)})},u.value??u))})]})}function Be(n){return e.jsx(Ze,{...n,renderLabel:s=>e.jsx(de,{enableTooltip:!1,config:{status:s.status},children:s.label})})}xe.propTypes={status:h.number.isRequired,updatedAt:h.string.isRequired,reason:h.string,channel:h.string,onResend:h.func};function xe({status:n,updatedAt:s,reason:t="",channel:r="wallet",onResend:o}){const{t:l,locale:b}=te(),u=At(l,b,{status:n,updatedAt:s,reason:t,channel:r});return e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(de,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(Fe,{className:"resend-btn",size:"small",startIcon:e.jsx(Je,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}Qe.propTypes={value:h.array.isRequired,onChange:h.func};function Qe({value:n,onChange:s}){const{locale:t}=te(),r=Q().toDate(),[o,l]=v.useState(null),b=v.useCallback(i=>{l(o?null:i.currentTarget)},[o]),u=!!o,p=v.useCallback(i=>{if(!i.startDate||!i.endDate){M.error("Please select a date range");return}if(Q(i.startDate).isAfter(i.endDate)||!Q(i.startDate).isValid()||!Q(i.endDate).isValid()){M.error("Invalid date range");return}s([i.startDate,i.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(ee,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Fe,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[at(n[0],t)," - ",at(n[1],t)]})}),e.jsx(Ue,{open:u,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(jn,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:b,definedRanges:vn(r),onChange:p})})]})}et.propTypes={itemComponent:h.elementType.isRequired};function et({itemComponent:n,...s}){const{t}=te();return!s?.filterList?.filter(o=>o.length).length?null:e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:t("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(nn.TableFilterList,{...s,ItemComponent:n})})]})}function tt({label:n,onDelete:s,canDelete:t=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let l=!0;return t&&typeof t=="function"&&(l=t({label:n,...r})),e.jsx(Ge,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}tt.propTypes={label:h.string.isRequired,onDelete:h.func,canDelete:h.func};const Mn=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Pt.propTypes={loading:h.bool,onCancel:h.func,onConfirm:h.func};function Pt({loading:n=!1,onCancel:s=()=>{},onConfirm:t=()=>{}}){const{t:r}=te(),[o,l]=v.useState(Mn),[b,u]=v.useState(!0),p=(N,I)=>{I.checked=N.target.checked;const S=o.map(j=>({...j,checked:j.value===I.value?I.checked:j.checked}));l(S)},i=N=>{N.stopPropagation(),t({channels:o.filter(I=>I.checked).map(I=>I.value),isResendFailedOnly:b})};return e.jsxs(y,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ee,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(y,{className:"choose-channel",children:e.jsxs(V,{component:"fieldset",variant:"standard",children:[e.jsx(pt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(N=>e.jsx(me,{control:e.jsx(Me,{checked:N.checked,onChange:I=>p(I,N),name:N.value}),label:N.label},N.value))})]})}),e.jsx(y,{className:"resend-config-footer",children:e.jsx(qe,{children:e.jsx(me,{control:e.jsx(Me,{checked:b,onChange:N=>u(N.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(y,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Fe,{onClick:N=>{N.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Fe,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(ft,{size:16}),r("common.confirm")]})]})]})}Ft.propTypes={notificationId:h.string.isRequired,handleResend:h.func,resending:h.bool};function Ft({notificationId:n,handleResend:s,resending:t=!1}){const{t:r,locale:o}=te(),l=ht(),b=v.useMemo(()=>jt(l,Lt()),[l]),{getReceivers:u,inService:p,teamDid:i,getUser:N,blocklet:I}=Xe(),[S,j]=v.useState(!1),[E,G]=v.useState([]),z=ye({anchorEl:null,position:null}),F=ye({anchorEl:null,position:null}),[B,w]=v.useState(null),[K,q]=v.useState({total:0,pageSize:10,pageCount:0,page:1}),[f,R]=v.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[Q().subtract(1,"month").startOf("day").toDate(),Q().endOf("day").toDate()]}),[C,a]=v.useState([]),T=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],O=async()=>{if(!S&&n)try{j(!0);const c=await u({notificationId:n,...f}),d=c.list.map(m=>({...m,receiverUser:{...m.receiverUser,avatar:It(m.receiverUser.avatar,i,p)}}));G(d),q(c.paging),j(!1)}catch(c){M.error(c.message),j(!1)}};v.useEffect(()=>{O()},[f]);const D=c=>{c.stopPropagation();const d=c.currentTarget;F.anchorEl=d;const m=d.getBoundingClientRect();F.position={top:m.top+window.scrollY,left:m.left+window.scrollX}},re=c=>c.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(ce,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Je,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:D,children:r("notification.resend")})}):null,ue={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:K.page-1,rowsPerPage:K.pageSize,count:K.total,searchText:f.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:C,onRowSelectionChange:(c,d)=>{a(d.map(m=>m.dataIndex))},customToolbarSelect:re},oe=({page:c,rowsPerPage:d,searchText:m,filterList:A})=>{const[,U=[],ne=[],J=[]]=A;f.pageSize!==d?R(H=>({...H,pageSize:d,page:1})):f.page!==c+1?R(H=>({...H,page:c+1})):f.searchText!==m?R(H=>({...H,searchText:m,page:1})):je(U,f.walletSendStatus)?je(ne,f.pushKitSendStatus)?je(J,f.emailSendStatus)||R(H=>({...H,emailSendStatus:J,page:1})):R(H=>({...H,pushKitSendStatus:ne,page:1})):R(H=>({...H,walletSendStatus:U,page:1}))},pe=v.useCallback(async(c,d)=>{if(!d)return!1;const m=await N(d);return m?c==="wallet"?zn(m):c==="email"?Fn(I,m):c==="pushKit"?_n(I,m):c==="webhook"?Wn(m):!0:!1},[N,I]),we=v.useCallback(c=>Bn(r,c),[r]),fe=()=>{z.anchorEl=null,z.position=null,w(null)},he=()=>{F.anchorEl=null,F.position=null},g=async(c,d,m=!0,A="")=>{if(!(!d.length||!c.length))try{s(c,d,m,A),F.anchorEl||(await Ee(.5),fe())}catch(U){console.error("handleResend error",{error:U})}},x=async({channels:c,isResendFailedOnly:d})=>{const m=C.map(A=>E[A].receiver);await g(c,m,d),await Ee(.5),he(),a([])},k=async(c,d=[],m=!0)=>{try{await g(["webhook"],[c.receiver],m,d)}catch(A){M.error(A.response?A.response.statusText:A.message)}},L=async(c,d,m,A=[],U=!0)=>{if(c.stopPropagation(),Kn(d,m)>=4){M.warning(r("notification.resendLimit"));return}if(!Ve.includes(m)){await k(d,A,U);return}if(c){const J=c.currentTarget,H=J.getBoundingClientRect();z.anchorEl=J,z.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}w({channel:m});try{const J=await pe(m,d.receiver);await Ee(1),w({channel:m,result:J}),(typeof J=="boolean"&&J||Qt(J)&&Object.values(J).every(H=>!!H))&&(await s([m],[d.receiver],U),F.anchorEl||(await Ee(.5),fe()))}catch(J){M.error(J.message)}},W=c=>{R(d=>({...d,dateRange:c,page:1}))},P=(c,d,m,A)=>{c.stopPropagation();const U=m.filter(ne=>ne!==d);R(ne=>({...ne,[A]:U,page:1}))},ie=se(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:c=>{const{receiverUser:d,receiver:m}=E[c];return d?e.jsxs(y,{"data-cy":`member-name-${d.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(vt,{src:`${d.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:m,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Se,{children:d.fullName})]},m):e.jsx(bn,{size:14,responsive:!1,compact:!0,copyable:!1,did:m})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:f.walletSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Wallet",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[1].options.filterList,"walletSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,A)=>e.jsx(Be,{label:"Wallet",filterList:c,onChange:d,index:m,column:A,filterValues:T})},customBodyRenderLite:c=>{const{walletSendStatus:d,walletSendAt:m,walletSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"wallet",onResend:U=>L(U,E[c],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{pushKitSendStatus:d,pushKitSendAt:m,pushKitSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"pushkit",onResend:U=>L(U,E[c],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:f.pushKitSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Push Kit",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[2].options.filterList,"pushKitSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,A)=>e.jsx(Be,{label:"Push Kit",filterList:c,onChange:d,index:m,column:A,filterValues:T})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{emailSendStatus:d,emailSendAt:m,emailSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"email",onResend:U=>L(U,E[c],"email",[],!1)})},filter:!0,filterType:"custom",filterList:f.emailSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Email",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[3].options.filterList,"emailSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,A)=>e.jsx(Be,{label:"Email",filterList:c,onChange:d,index:m,column:A,filterValues:T})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{webhook:d}=E[c];if(!d)return null;const m=Object.entries(d)[0];if(!m)return null;const[A,U]=m,ne=U[0];return e.jsx(y,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(y,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(Se,{maxLength:30,children:A},A),e.jsx(xe,{status:ne.status,updatedAt:ne.sendAt,reason:ne.failedReason,channel:"webhook",onResend:J=>L(J,E[c],"webhook",[A],!1)})]},A)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:c=>{const{createdAt:d}=E[c];return e.jsx(Nt,{value:d,locale:o,shouldUpdate:!0})}}}],[E,o,f,r]),Re=[e.jsx(Qe,{value:f.dateRange,onChange:W},"date-picker"),e.jsx(ce,{variant:"contained",size:"small",color:"primary",loading:S,startIcon:e.jsx(qt,{}),onClick:()=>O(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(y,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(Hn,{children:e.jsxs(xt,{theme:b,children:[e.jsx(yt,{className:"receivers-table",locale:o,loading:S,columns:ie,data:E,onChange:oe,options:ue,customButtons:Re,components:{TableFilterList:c=>e.jsx(et,{...c,itemComponent:d=>e.jsx(tt,{...d,canDelete:()=>!1})})}}),z.anchorEl&&e.jsx(Ue,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:fe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs($n,{children:[e.jsxs(ee,{variant:"body1",component:"div",className:"check-title",children:[B?.channel," Checking"]}),e.jsx(y,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:we(B?.channel).map(c=>{const{type:d,pass:m,fail:A}=c;return!B?.result||B?.result?.[d]?e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:B?.result?.[d]?Ae.success.main:"inherit"},children:[B?.result?e.jsx(Mt,{}):e.jsx(ft,{size:12,sx:{color:Ae.primary.main}}),e.jsx("span",{children:m})]},d):e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:Ae.error.main},children:[e.jsx(Ut,{}),e.jsx("span",{children:A})]},d)})})]})}),F.anchorEl&&e.jsx(Ue,{open:!!F.anchorEl,anchorReference:"anchorPosition",anchorPosition:F.position,onClose:he,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Pt,{loading:t,onCancel:he,onConfirm:x})})]})})})}const Un=v.memo(Ft),Hn=ae.div`
1
+ import{g as Wt,r as v}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as y,z as Z,b6 as me,be as Ke,y as V,am as ut,c_ as Bt,bm as Kt,at as ae,b1 as mt,W as h,T as ee,U as Ge,c$ as pt,b5 as qe,a5 as Me,Q as Fe,d0 as Je,aN as Ue,a6 as ft,D as ht,d1 as qt,ad as xt,d2 as Mt,d3 as Ut,c1 as st,n as Ht,x as $t,bb as Vt,M as it,cv as Gt,I as Jt,d4 as Yt}from"./vendor-mui-core-CmD-NPnl.js";import{A as gt,J as Xt,C as Zt,e as le,F as Qt,a3 as je}from"./vendor-utils-DQK0pEML.js";import{T as te,H as M,D as ce,G as en,L as bt,al as tn,aK as nn,y as jt,$ as vt,ac as yt,aL as Ae,F as St,a6 as sn,ai as an}from"./vendor-ux-pYOhjQLA.js";import{aF as rn,Z as Ye,a8 as Ct,aZ as wt,M as _e,c as _,ap as Q,p as on,aO as at}from"./index-BJbNz5vx.js";import{g as ye,b as $,a as se}from"./vendor-hooks-DLNZ8kxG.js";import{u as Rt,C as Y}from"./index.esm-JPZAjt0x.js";import{i as He}from"./isURL-CCV0esLR.js";import{S as X}from"./section-CndbjVtx.js";import{A as ln,a as cn,b as dn}from"./collapse-GMtfQlRs.js";import{S as Se}from"./shorten-label-Cbu8wo9m.js";import{v as Tt}from"./index-DzI9kX_C.js";import{R as Nt,A as un,S as mn,a as pn,B as fn}from"./list-B1IF52f7.js";import{j as hn,c as xn,N as gn}from"./team-B-jk7E5_.js";import{W as bn}from"./did-address-CNnw4_bl.js";import{p as It}from"./util-Bravn321.js";import{D as jn,g as vn}from"./traffic-CInL395-.js";import{B as Et}from"./bundle-avatar-BvwlMY-v.js";import{u as yn}from"./use-mobile-D93Bk2Ru.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DEa0A9MF.js";import"./required-B2SKELXR.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./index-uH_9YgA0.js";import"./session-m3orzHBa.js";import"./use-app-logo-D_gO-Dio.js";import"./base32-dGIGRTeZ.js";import"./useAsyncRetry-6TjWJyO6.js";import"./useAsync-CNAYLnLm.js";import"./iframe-SCM7rlz3.js";import"./index-CNvRrWdA.js";import"./index-DBs9Ljax.js";import"./base-chart-BntWHeFy.js";import"./index-DO9UDa6G.js";import"./vendor-mui-x--K2rEM1j.js";import"./AdapterDayjs-Ch1GqpK7.js";var Te={exports:{}},Ne={exports:{}},Ie={exports:{}},rt;function Sn(){return rt||(rt=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=t;function t(r){return r==null}n.exports=s.default,n.exports.default=s.default}(Ie,Ie.exports)),Ie.exports}var ot;function Cn(){return ot||(ot=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=u;var t=o(rn()),r=o(Sn());function o(p){return p&&p.__esModule?p:{default:p}}var l=/^(?:[-+]?(?:0|[1-9][0-9]*))$/,b=/^[-+]?[0-9]+$/;function u(p,i){(0,t.default)(p),i=i||{};var N=i.allow_leading_zeroes===!1?l:b,I=!i.hasOwnProperty("min")||(0,r.default)(i.min)||p>=i.min,S=!i.hasOwnProperty("max")||(0,r.default)(i.max)||p<=i.max,j=!i.hasOwnProperty("lt")||(0,r.default)(i.lt)||p<i.lt,E=!i.hasOwnProperty("gt")||(0,r.default)(i.gt)||p>i.gt;return N.test(p)&&I&&S&&j&&E}n.exports=s.default,n.exports.default=s.default}(Ne,Ne.exports)),Ne.exports}var lt;function wn(){return lt||(lt=1,function(n,s){Object.defineProperty(s,"__esModule",{value:!0}),s.default=o;var t=r(Cn());function r(l){return l&&l.__esModule?l:{default:l}}function o(l){return(0,t.default)(l,{allow_leading_zeroes:!1,min:0,max:65535})}n.exports=s.default,n.exports.default=s.default}(Te,Te.exports)),Te.exports}var Rn=wn();const Tn=Wt(Rn),ze={enabled:!1,secure:!1,from:"",host:"",port:"",user:"",password:"",companyName:"",companyLink:"",companyAddress:"",supportEmail:""};function Nn(){const{api:n}=Ye(),{blocklet:s}=Ct(),{t}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,b=Object.assign({...ze},s?.settings?.notification?.email||{}),{handleSubmit:u,control:p,formState:i,watch:N,reset:I}=Rt({defaultValues:gt(b,Object.keys(ze))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(a,T,O=!0)=>{try{const{blocklet:D}=await n.configNotification({input:{did:l,notification:JSON.stringify({email:a})}}),re=Object.assign({...ze},D?.settings?.notification?.email||{});I(re),O&&M.success(t("oauth.saveSuccess"))}catch(D){if(O)M.error(D.message||t("oauth.saveFailed"));else throw D}}),G=$(async(a,T,O)=>{try{i.isDirty&&await E(a,T,!1),await n.sendEmail({input:{did:l,receiver:O,email:JSON.stringify({body:"Your SMTP configuration is correct!",title:"Test email",type:"notification",attachments:[{type:"link",data:{url:"https://community.arcblock.io",title:"Community",image:"https://community.arcblock.io/.well-known/service/blocklet/logo-rect-dark",utm:{campaign:"test-campaign"}}}],utm:{content:"test-email-button"}})}}),M.success(t("notification.email.testSuccess"))}catch(D){M.error(D.message||t("notification.email.testfailed"))}}),z=$((a,T)=>{S.testReceiver=localStorage.getItem("test-receiver")||"",S.testReceiverError="",r.open({title:t("notification.email.testSendEmail"),content:()=>e.jsx(y,{sx:{width:"300px"},children:e.jsx(Z,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.email.inputTestReceiver"),value:S.testReceiver,onChange:O=>{S.testReceiver=O.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(O){const D=S.testReceiver?.trim();if(!D){S.testReceiverError=t("notification.email.receiverRequired");return}if(!_e(D)){S.testReceiverError=t("notification.email.receiverInvalid");return}S.testReceiverError="",await G(a,T,D),O()}})}),F=$(a=>{const T=a?.trim();return T?_e(T)?!0:t("notification.email.fromInvalid"):t("notification.email.fromRequired")}),B=$(a=>{const T=a?.trim();return T?He(T,{require_host:!1,protocols:[]})?!0:t("notification.email.hostInvalid"):t("notification.email.hostRequired")}),w=$(a=>a?Tn(a)?!0:t("notification.email.portInvalid"):t("notification.email.portRequired")),K=$(a=>a?.trim()?!0:t("notification.email.userRequired")),q=$(a=>a?.trim()?!0:t("notification.email.passwordRequired")),f=$(a=>a?.trim()&&!He(a,{protocols:["http","https"],require_protocol:!0})?t("notification.email.linkInvalid"):!0),R=$(a=>a?.trim()&&!_e(a)?t("notification.email.emailInvalid"):!0),C=$(()=>!0);return e.jsxs(y,{children:[e.jsxs(In,{component:"form",onSubmit:u(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(X,{title:t("notification.email.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:p,render:({field:a})=>e.jsx(me,{control:e.jsx(Ke,{checked:a.value,...a})})})}),e.jsx(X,{title:t("notification.email.from"),children:e.jsx(Y,{name:"from",control:p,rules:{validate:j?F:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,label:t("notification.email.from"),error:!!i.errors[a.name],helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.host"),children:e.jsx(Y,{name:"host",control:p,rules:{validate:j?B:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:t("notification.email.host"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.port"),children:e.jsx(Y,{name:"port",control:p,rules:{validate:j?w:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,type:"number",error:!!i.errors[a.name],label:t("notification.email.port"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.user"),children:e.jsx(Y,{name:"user",control:p,rules:{validate:j?K:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,error:!!i.errors[a.name],label:t("notification.email.user"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.password"),children:e.jsx(Y,{name:"password",control:p,rules:{validate:j?q:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",required:!0,type:"password",error:!!i.errors[a.name],label:t("notification.email.password"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.secure"),children:e.jsx(Y,{name:"secure",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(me,{control:e.jsx(Ke,{checked:a.value,...a,disabled:!j})})})})}),e.jsxs(ln,{children:[e.jsxs(cn,{expandIcon:e.jsx(Kt,{fontSize:"small"}),"aria-controls":"panel1-content",id:"panel1-header",children:[t("notification.email.signature"),e.jsx(ut,{title:t("notification.email.signatureTooltip"),children:e.jsx(Bt,{fontSize:"small",sx:{ml:1,cursor:"help"}})})]}),e.jsxs(dn,{children:[e.jsx(X,{title:t("notification.email.companyName"),children:e.jsx(Y,{name:"companyName",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyName"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.companyLink"),children:e.jsx(Y,{name:"companyLink",control:p,rules:{validate:j?f:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyLink"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.companyAddress"),children:e.jsx(Y,{name:"companyAddress",control:p,rules:{validate:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",error:!!i.errors[a.name],label:t("notification.email.companyAddress"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})}),e.jsx(X,{title:t("notification.email.supportEmail"),children:e.jsx(Y,{name:"supportEmail",control:p,rules:{validate:j?R:C},render:({field:a})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...a,size:"small",type:"email",error:!!i.errors[a.name],label:t("notification.email.supportEmail"),helperText:i.errors[a.name]?.message||" ",disabled:!j})})})})]})]}),e.jsxs(y,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(ce,{variant:"outlined",color:"warning",onClick:u(z),disabled:!j,children:t("oauth.runTest")}),e.jsx(ce,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),o]})}const In=ae(mt)``,We={enabled:!1,endpoint:"",did:void 0,pushPath:void 0};function En(){const{api:n}=Ye(),{blocklet:s}=Ct(),{t}=te(),{confirmApi:r,confirmHolder:o}=wt(),l=s?.meta?.did,b=Object.assign({...We},s?.settings?.notification?.pushKit||{}),{handleSubmit:u,control:p,formState:i,watch:N,reset:I}=Rt({defaultValues:gt(b,Object.keys(We))}),S=ye({testReceiver:"",testReceiverError:""}),j=N("enabled"),E=$(async(w,K,q=!0)=>{try{const{blocklet:f}=await n.configNotification({input:{did:l,notification:JSON.stringify({pushKit:w})}}),R=Object.assign({...We},f?.settings?.notification?.pushKit||{});I(R),q&&M.success(t("oauth.saveSuccess"))}catch(f){if(q)M.error(f.message||t("oauth.saveFailed"));else throw f}}),G=$(async(w,K)=>{try{i.isDirty&&await E(w,K,!1);const q=(s?.configs||[]).find(C=>C.key==="BLOCKLET_APP_URL")?.value,f=Xt(Zt(q,_.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),{v:s?.meta?.version,t:new Date(s?.updatedAt||0).getTime()}),R={type:"passthrough",passthroughType:"messageStatus",data:{message:{title:"Test push-kit notification",body:"This is message from push-kit config test",sender:{did:s?.appDid,fullName:s?.meta?.title,avatar:f}}}};await n.sendPush({input:{did:l,receiver:S.testReceiver,notification:JSON.stringify(R)}}),M.success(t("notification.pushKit.testSuccess"))}catch(q){M.error(q.message||t("notification.pushKit.testfailed"))}}),z=$((w,K)=>{S.testReceiverError="",r.open({title:t("notification.pushKit.testSend"),content:()=>e.jsx(y,{sx:{width:"450px",maxWidth:"100%"},children:e.jsx(Z,{sx:{mt:1},fullWidth:!0,name:"testReceiver",label:t("notification.pushKit.inputTestReceiver"),value:S.testReceiver,onChange:q=>{S.testReceiver=q.target.value},error:!!S.testReceiverError,helperText:S.testReceiverError||" "})}),confirmButtonText:t("common.confirm"),cancelButtonText:t("common.cancel"),async onConfirm(q){if(!S.testReceiver?.trim()){S.testReceiverError=t("notification.pushKit.receiverRequired");return}S.testReceiverError="",await G(w,K),q()}})}),F=$(w=>{const K=w?.trim();return K?He(K)?!0:t("notification.pushKit.endpointInvalid"):t("notification.pushKit.endpointRequired")}),B=$(()=>!0);return e.jsxs(y,{children:[e.jsxs(kn,{component:"form",onSubmit:u(E),disabled:!0,sx:{".section-left":{width:"160px"}},children:[e.jsx(X,{title:t("notification.pushKit.enable"),my:2.5,children:e.jsx(Y,{name:"enabled",control:p,render:({field:w})=>e.jsx(me,{control:e.jsx(Ke,{checked:w.value,...w})})})}),e.jsx(X,{title:t("notification.pushKit.endpoint"),children:e.jsx(Y,{name:"endpoint",control:p,rules:{validate:j?F:B},render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...w,size:"small",required:!0,label:t("notification.pushKit.endpoint"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})})}),e.jsxs(X,{title:t("notification.pushKit.customOptions"),children:[e.jsx(Y,{name:"did",control:p,render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...w,size:"small",label:t("notification.pushKit.did"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})}),e.jsx(Y,{name:"pushPath",control:p,render:({field:w})=>e.jsx(V,{fullWidth:!0,children:e.jsx(Z,{...w,size:"small",label:t("notification.pushKit.pushPath"),error:!!i.errors[w.name],helperText:i.errors[w.name]?.message||" ",disabled:!j})})})]}),e.jsxs(y,{sx:{display:"flex",justifyContent:"flex-end",gap:2,mt:3},children:[e.jsx(ce,{variant:"outlined",color:"warning",onClick:u(z),disabled:!j,children:t("oauth.runTest")}),e.jsx(ce,{type:"submit",variant:"contained",disabled:!i.isDirty,children:t("oauth.save")})]})]}),o]})}const kn=ae(mt)``,ct=[{label:e.jsx(y,{sx:{textAlign:"center",width:"100%"},children:"Email"}),value:"email"},{label:e.jsx(y,{sx:{textAlign:"center",width:"100%"},children:"Push Kit"}),value:"pushKit"}];function An(){const[n,s]=v.useState(ct[0].value),{locale:t}=v.useContext(en),r=se(()=>({email:e.jsx(Nn,{}),pushKit:e.jsx(En,{})}),[t]),o=v.useMemo(()=>({padding:"10px 0"}),[]);return e.jsxs(y,{children:[e.jsx(bt,{tabs:ct,current:n,onChange:s}),e.jsx(y,{style:o,children:r[n]})]})}const kt=v.createContext({}),{Provider:On,Consumer:Ws}=kt;function Dn({children:n,blocklet:s=""}){const{api:t,inService:r,ws:{useSubscription:o}}=Ye(),[l,b]=v.useState([]),[u,p]=v.useState({total:0,pageSize:20,pageCount:0,page:1}),i=se(()=>s.meta?.did,[s]),[N,I]=v.useState([]),[S,j]=v.useState({}),E=se(()=>l.length?new Set(l.map(f=>f.id)):new Set,[l]),G=async({page:f=1,pageSize:R=20,...C}={})=>{if(!i)return[];try{const a={paging:{page:f,pageSize:R},...C,teamDid:i,dateRange:C.dateRange?[Q(C.dateRange[0]).toISOString(),Q(C.dateRange[1]).toISOString()]:void 0},{dids:T,...O}=a;let D="";T&&T.includes("system")&&(D="system");const re=T?T.filter(pe=>pe!=="system"):[],ue={...O,source:D,componentDids:re},oe=await t.getNotificationSendLog({input:ue});return j(ue),b(oe.list),p(oe.paging),oe.list}catch(a){return M.error(a.message),[]}},z=async()=>{const f=await t.getNotificationComponents({input:{teamDid:i}});I(f.componentDids)},F=v.useCallback(f=>{const R=s.children.find(C=>C.meta?.did===f);if(R)return R.ancestors=[s],R},[s]),B=async({notificationId:f,receivers:R,channels:C,...a})=>{await t.resendNotification({input:{teamDid:i,notificationId:f,receivers:R,channels:C.map(T=>T==="wallet"?_.NOTIFICATION_SEND_CHANNEL.WALLET:T==="pushKit"?_.NOTIFICATION_SEND_CHANNEL.PUSH:T),...a}})},w=v.useCallback(async f=>(await t.getUser({input:{teamDid:i,user:{did:f},options:{enableConnectedAccount:!0}}})).user,[t,i]),K=v.useCallback(async({page:f=1,pageSize:R=20,...C}={})=>{try{const a={paging:{page:f,pageSize:R},...C,userName:C.searchText||"",teamDid:i,dateRange:C.dateRange?[Q(C.dateRange[0]).toISOString(),Q(C.dateRange[1]).toISOString()]:void 0};return await t.getReceivers({input:a})}catch(a){throw M.error(a.message),a}},[t,i]);v.useEffect(()=>{i&&z()},[i]),o(_.EVENTS.NOTIFICATION_BLOCKLET_UPDATE,f=>{E.has(f.notificationId)&&G(S)},[E,S]),o(_.EVENTS.NOTIFICATION_BLOCKLET_CREATE,f=>{E.has(f.id)||G(S)},[E,S]);const q={fetch:G,data:l,paging:u,blocklet:s,getComponent:F,resendNotification:B,getUser:w,componentDids:N,getReceivers:K,inService:r,teamDid:i};return e.jsx(On,{value:{notificationRecords:q},children:n})}function Xe(){const{notificationRecords:n}=v.useContext(kt);return n}Ce.propTypes={severity:h.oneOf(Object.values(["info","success","error","warning"])).isRequired};const Ln={info:"primary",success:"success",error:"error",warning:"warning"};function Ce({severity:n="info"}){return e.jsx(tn,{type:Ln[n],children:n})}const Pn=(n,s,t="")=>{if(!t||!s)return"";switch(t){case _.NOTIFICATION_SEND_FAILED_REASON.USER_DISABLED:return n("notification.sendStatus.reason.disabled",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_UNAVAILABLE:return n("notification.sendStatus.reason.unavailable",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.CHANNEL_DISABLED:return n("notification.sendStatus.reason.notSent",{channel:s});case _.NOTIFICATION_SEND_FAILED_REASON.NOT_ONLINE:return n("notification.sendStatus.reason.offline");default:return t}};function At(n,s,t={}){const{status:r,updatedAt:o,reason:l="",channel:b="wallet"}=t,u=o?n("notification.sendStatus.sentTime",{date:on(o,s)}):"",p=Pn(n,b,l);return r===_.NOTIFICATION_SEND_STATUS.FAILED?{status:"failed",title:n("notification.sendStatus.failed"),sentTime:u,reason:p}:r===_.NOTIFICATION_SEND_STATUS.SENT?{status:"success",title:n("notification.sendStatus.success"),sentTime:u}:{status:"pending",title:n("notification.sendStatus.pending"),reason:p,sentTime:u}}const $e={pending:"#aaaaaa",success:"#34BE74",failed:"#D0021B"},Ve=["wallet","pushKit","email"],dt=["info","success","error","warning"],Ot=n=>{const{settings:s}=n;return s?.notification?.email?.enabled},Dt=n=>{const{settings:s}=n;return s?.notification?.pushKit?.enabled},Fn=(n,s)=>{const t=le(s,"extra.notifications.email",!0);return{available:Ot(n),enabled:t}},_n=(n,s)=>{const t=le(s,"extra.notifications.push",!0);return{available:Dt(n),enabled:t}},zn=n=>({enabled:le(n,"extra.notifications.wallet",!0)}),Wn=n=>({enabled:le(n,"extra.webhooks",[]).length>0}),Ee=(n=3)=>new Promise(s=>{setTimeout(()=>{s()},n*1e3)}),Bn=(n,s)=>s==="wallet"||s==="webhook"?[{channel:s,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:s}),fail:n("notification.sendStatus.reason.disabled",{channel:s})}]:s==="pushKit"||s==="email"?[{channel:s,type:"available",pass:n("notification.sendStatus.reason.available",{channel:s}),fail:n("notification.sendStatus.reason.unavailable",{channel:s})},{channel:s,type:"enabled",pass:n("notification.sendStatus.reason.enabled",{channel:s}),fail:n("notification.sendStatus.reason.disabled",{channel:s})}]:[],ke=(n=[])=>{const s=Q().startOf("day");return n.filter(t=>Q(t.sendAt).isSame(s,"day")).length},Kn=(n,s="")=>{if(s&&Ve.includes(s)){const l=`${s}SendRecord`,b=le(n,l,[]);return ke(b)}const t=le(n,"webhook",{}),r=Object.keys(t??{})??[];if(s&&r.includes(s)){const l=t[s]??[];return ke(l)}const o={};return Ve.forEach(l=>{const b=`${l}SendRecord`,u=le(n,b,[]),p=ke(u);o[l]=p}),r.length>0&&r.forEach(l=>{const b=t[l]??[],u=ke(b);o[l]=u}),o},Oe=(n,s,t)=>{if(!Array.isArray(n))throw new Error("Invalid filterList or index");return n[t].splice(s,1),n},De=(n,s)=>{if(!Array.isArray(s))throw new Error("filters must be an array");return s.length?!s.includes(n):!1},qn=n=>{switch(n){case _.NOTIFICATION_SEND_CHANNEL.WALLET:return"Wallet";case _.NOTIFICATION_SEND_CHANNEL.PUSH:return"Push Kit";case _.NOTIFICATION_SEND_CHANNEL.EMAIL:return"Email";case _.NOTIFICATION_SEND_CHANNEL.WEBHOOK:return"Webhook";default:return""}},Lt=()=>({components:{MUIDataTableFilter:{styleOverrides:{header:{marginBottom:0,p:{margin:0}},root:{"& .MuiGrid-container":{marginTop:0,"& .MuiGrid-item":{paddingTop:0}}}}},MuiPopover:{styleOverrides:{root:{"&.MuiPopover-root":{"& .MuiPaper-root:has(.filter-container)":{width:"420px"}}}}}}});function de({config:n,enableTooltip:s=!0,showTitle:t=!1,children:r=null}){const{status:o,title:l="",sentTime:b="",reason:u=""}=n,p=[l,u].filter(Boolean).join(", ");return e.jsx(ut,{title:s?e.jsxs(e.Fragment,{children:[e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:p}),e.jsx("span",{children:b})]}):null,arrow:!0,placement:"top",children:e.jsxs(y,{sx:{display:"flex",flexDirection:"row",alignItems:"center",gap:"4px"},children:[e.jsxs(y,{sx:{position:"relative",minHeight:14,minWidth:14,display:"flex",alignItems:"center",justifyContent:"center"},children:[e.jsx(y,{style:{opacity:.15},sx:{position:"absolute",width:"100%",height:"100%",borderRadius:"50%",bgcolor:$e[o]}}),e.jsx(y,{sx:{position:"absolute",width:"55%",height:"55%",borderRadius:"50%",bgcolor:$e[o]}})]}),e.jsx(ee,{color:"inherit",sx:{fontSize:12},children:t?l:r})]})})}de.propTypes={config:h.object.isRequired,enableTooltip:h.bool,showTitle:h.bool,children:h.node};Le.propTypes={list:h.array.isRequired,label:h.string.isRequired,onDelete:h.func};function Le({list:n,label:s,onDelete:t=()=>{}}){const{t:r,locale:o}=te();return e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsxs(ee,{children:[s,": "]}),n.map(l=>{const b=At(r,o,{status:l});return e.jsx(Ge,{size:"small",label:e.jsx(y,{sx:{display:"flex",alignItems:"center",gap:"4px"},children:e.jsx(de,{config:b,enableTooltip:!1,children:b.title})}),onDelete:u=>t(u,l)},l)})]})}Ze.propTypes={filterList:h.array.isRequired,onChange:h.func.isRequired,index:h.number.isRequired,column:h.object.isRequired,filterValues:h.array.isRequired,label:h.string.isRequired,renderLabel:h.func.isRequired};function Ze({filterList:n,onChange:s,index:t,column:r,filterValues:o,label:l,renderLabel:b}){return e.jsxs(V,{className:"filter-container",children:[e.jsx(pt,{component:"legend",children:l}),e.jsx(qe,{row:!0,children:o.map(u=>e.jsx(me,{control:e.jsx(Me,{checked:n[t].indexOf(u.value??u)>-1,onChange:p=>{const i=[...n];p.target.checked?i[t]=[...i[t],u.value??u]:i[t]=i[t].filter(N=>N!==(u.value??u)),s(i[t],t,r)},name:u.value??u}),label:e.jsx("span",{style:{display:"flex",alignItems:"center"},children:b(u)})},u.value??u))})]})}function Be(n){return e.jsx(Ze,{...n,renderLabel:s=>e.jsx(de,{enableTooltip:!1,config:{status:s.status},children:s.label})})}xe.propTypes={status:h.number.isRequired,updatedAt:h.string.isRequired,reason:h.string,channel:h.string,onResend:h.func};function xe({status:n,updatedAt:s,reason:t="",channel:r="wallet",onResend:o}){const{t:l,locale:b}=te(),u=At(l,b,{status:n,updatedAt:s,reason:t,channel:r});return e.jsxs(y,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(de,{config:u,showTitle:!0}),u.status!=="success"&&e.jsx(Fe,{className:"resend-btn",size:"small",startIcon:e.jsx(Je,{}),sx:{fontSize:12,color:"rgba(0, 0, 0, 0.87)",fontWeight:400,".MuiButton-startIcon":{mr:"2px"}},onClick:o,children:l("notification.resend")})]})}Qe.propTypes={value:h.array.isRequired,onChange:h.func};function Qe({value:n,onChange:s}){const{locale:t}=te(),r=Q().toDate(),[o,l]=v.useState(null),b=v.useCallback(i=>{l(o?null:i.currentTarget)},[o]),u=!!o,p=v.useCallback(i=>{if(!i.startDate||!i.endDate){M.error("Please select a date range");return}if(Q(i.startDate).isAfter(i.endDate)||!Q(i.startDate).isValid()||!Q(i.endDate).isValid()){M.error("Invalid date range");return}s([i.startDate,i.endDate]),l(null)},[s]);return e.jsxs("div",{children:[e.jsx(ee,{component:"div",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:0},children:e.jsxs(Fe,{onClick:b,variant:"outlined",size:"small",color:"inherit",children:[at(n[0],t)," - ",at(n[1],t)]})}),e.jsx(Ue,{open:u,anchorEl:o,onClose:()=>{l(null)},anchorOrigin:{vertical:"bottom",horizontal:"left"},children:e.jsx(jn,{open:!0,maxDate:r,initialDateRange:{startDate:n[0],endDate:n[1]},toggle:b,definedRanges:vn(r),onChange:p})})]})}et.propTypes={itemComponent:h.elementType.isRequired};function et({itemComponent:n,...s}){const{t}=te();return!s?.filterList?.filter(o=>o.length).length?null:e.jsxs(y,{sx:{display:"flex",gap:1,alignItems:"center"},children:[e.jsx("div",{className:"toolbar-filter-title",children:t("notification.filter")}),e.jsx("div",{className:"toolbar-filter-content",children:e.jsx(nn.TableFilterList,{...s,ItemComponent:n})})]})}function tt({label:n,onDelete:s,canDelete:t=()=>!0,...r}){const o=s&&typeof s=="function"?s:void 0;let l=!0;return t&&typeof t=="function"&&(l=t({label:n,...r})),e.jsx(Ge,{label:n,variant:"outlined",...o&&l?{onDelete:o}:{}})}tt.propTypes={label:h.string.isRequired,onDelete:h.func,canDelete:h.func};const Mn=[{label:"Wallet",value:"app",checked:!0},{label:"Email",value:"email",checked:!0},{label:"Push Kit",value:"push",checked:!0},{label:"Webhook",value:"webhook",checked:!0}];Pt.propTypes={loading:h.bool,onCancel:h.func,onConfirm:h.func};function Pt({loading:n=!1,onCancel:s=()=>{},onConfirm:t=()=>{}}){const{t:r}=te(),[o,l]=v.useState(Mn),[b,u]=v.useState(!0),p=(N,I)=>{I.checked=N.target.checked;const S=o.map(j=>({...j,checked:j.value===I.value?I.checked:j.checked}));l(S)},i=N=>{N.stopPropagation(),t({channels:o.filter(I=>I.checked).map(I=>I.value),isResendFailedOnly:b})};return e.jsxs(y,{className:"resend-config",sx:{padding:"16px 24px"},children:[e.jsx(ee,{variant:"body1",component:"div",className:"check-title",sx:{fontWeight:700,mb:1},children:r("notification.config")}),e.jsx(y,{className:"choose-channel",children:e.jsxs(V,{component:"fieldset",variant:"standard",children:[e.jsx(pt,{component:"legend",children:r("notification.selectChannels")}),e.jsx(qe,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:1},children:o.map(N=>e.jsx(me,{control:e.jsx(Me,{checked:N.checked,onChange:I=>p(I,N),name:N.value}),label:N.label},N.value))})]})}),e.jsx(y,{className:"resend-config-footer",children:e.jsx(qe,{children:e.jsx(me,{control:e.jsx(Me,{checked:b,onChange:N=>u(N.target.checked)}),label:r("notification.resendFailedOnly")})})}),e.jsxs(y,{className:"resend-config-footer-tip",sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[e.jsx(Fe,{onClick:N=>{N.stopPropagation(),s()},color:"inherit",children:r("common.cancel")}),e.jsxs(Fe,{onClick:i,color:"primary",disabled:n,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[n&&e.jsx(ft,{size:16}),r("common.confirm")]})]})]})}Ft.propTypes={notificationId:h.string.isRequired,handleResend:h.func,resending:h.bool};function Ft({notificationId:n,handleResend:s,resending:t=!1}){const{t:r,locale:o}=te(),l=ht(),b=v.useMemo(()=>jt(l,Lt()),[l]),{getReceivers:u,inService:p,teamDid:i,getUser:N,blocklet:I}=Xe(),[S,j]=v.useState(!1),[E,G]=v.useState([]),z=ye({anchorEl:null,position:null}),F=ye({anchorEl:null,position:null}),[B,w]=v.useState(null),[K,q]=v.useState({total:0,pageSize:10,pageCount:0,page:1}),[f,R]=v.useState({searchText:"",page:1,pageSize:10,walletSendStatus:[],pushKitSendStatus:[],emailSendStatus:[],dateRange:[Q().subtract(1,"month").startOf("day").toDate(),Q().endOf("day").toDate()]}),[C,a]=v.useState([]),T=[{label:r("notification.sendStatus.pending"),value:0,status:"pending"},{label:r("notification.sendStatus.success"),value:1,status:"success"},{label:r("notification.sendStatus.failed"),value:2,status:"failed"}],O=async()=>{if(!S&&n)try{j(!0);const c=await u({notificationId:n,...f}),d=c.list.map(m=>({...m,receiverUser:{...m.receiverUser,avatar:It(m.receiverUser.avatar,i,p)}}));G(d),q(c.paging),j(!1)}catch(c){M.error(c.message),j(!1)}};v.useEffect(()=>{O()},[f]);const D=c=>{c.stopPropagation();const d=c.currentTarget;F.anchorEl=d;const m=d.getBoundingClientRect();F.position={top:m.top+window.scrollY,left:m.left+window.scrollX}},re=c=>c.data.length?e.jsx("div",{style:{display:"flex",alignItems:"center",padding:"10px"},children:e.jsx(ce,{className:"resend-btn",size:"small",color:"primary",variant:"contained",startIcon:e.jsx(Je,{}),sx:{".MuiButton-startIcon":{mr:"2px"}},onClick:D,children:r("notification.resend")})}):null,ue={sort:!1,download:!1,print:!1,selectableRows:"multiple",searchPlaceholder:r("common.search"),searchAlwaysOpen:!1,filterType:"checkbox",searchDebounceTime:300,page:K.page-1,rowsPerPage:K.pageSize,count:K.total,searchText:f.searchText,tableBodyMaxHeight:"calc(80vh - 260px)",rowsSelected:C,onRowSelectionChange:(c,d)=>{a(d.map(m=>m.dataIndex))},customToolbarSelect:re},oe=({page:c,rowsPerPage:d,searchText:m,filterList:A})=>{const[,U=[],ne=[],J=[]]=A;f.pageSize!==d?R(H=>({...H,pageSize:d,page:1})):f.page!==c+1?R(H=>({...H,page:c+1})):f.searchText!==m?R(H=>({...H,searchText:m,page:1})):je(U,f.walletSendStatus)?je(ne,f.pushKitSendStatus)?je(J,f.emailSendStatus)||R(H=>({...H,emailSendStatus:J,page:1})):R(H=>({...H,pushKitSendStatus:ne,page:1})):R(H=>({...H,walletSendStatus:U,page:1}))},pe=v.useCallback(async(c,d)=>{if(!d)return!1;const m=await N(d);return m?c==="wallet"?zn(m):c==="email"?Fn(I,m):c==="pushKit"?_n(I,m):c==="webhook"?Wn(m):!0:!1},[N,I]),we=v.useCallback(c=>Bn(r,c),[r]),fe=()=>{z.anchorEl=null,z.position=null,w(null)},he=()=>{F.anchorEl=null,F.position=null},g=async(c,d,m=!0,A="")=>{if(!(!d.length||!c.length))try{s(c,d,m,A),F.anchorEl||(await Ee(.5),fe())}catch(U){console.error("handleResend error",{error:U})}},x=async({channels:c,isResendFailedOnly:d})=>{const m=C.map(A=>E[A].receiver);await g(c,m,d),await Ee(.5),he(),a([])},k=async(c,d=[],m=!0)=>{try{await g(["webhook"],[c.receiver],m,d)}catch(A){M.error(A.response?A.response.statusText:A.message)}},L=async(c,d,m,A=[],U=!0)=>{if(c.stopPropagation(),Kn(d,m)>=4){M.warning(r("notification.resendLimit"));return}if(!Ve.includes(m)){await k(d,A,U);return}if(c){const J=c.currentTarget,H=J.getBoundingClientRect();z.anchorEl=J,z.position={top:H.top+window.scrollY,left:H.left+window.scrollX}}w({channel:m});try{const J=await pe(m,d.receiver);await Ee(1),w({channel:m,result:J}),(typeof J=="boolean"&&J||Qt(J)&&Object.values(J).every(H=>!!H))&&(await s([m],[d.receiver],U),F.anchorEl||(await Ee(.5),fe()))}catch(J){M.error(J.message)}},W=c=>{R(d=>({...d,dateRange:c,page:1}))},P=(c,d,m,A)=>{c.stopPropagation();const U=m.filter(ne=>ne!==d);R(ne=>({...ne,[A]:U,page:1}))},ie=se(()=>[{label:r("notification.receiver"),name:"receiver",width:200,options:{filter:!1,customBodyRenderLite:c=>{const{receiverUser:d,receiver:m}=E[c];return d?e.jsxs(y,{"data-cy":`member-name-${d.fullName}`,sx:{display:"flex",alignItems:"center",gap:1,justifyContent:"flex-start"},children:[e.jsx(vt,{src:`${d.avatar}?imageFilter=resize&w=48&h=48`,size:32,did:m,shape:"circle",style:{borderRadius:"100%",overflow:"hidden"}}),e.jsx(Se,{children:d.fullName})]},m):e.jsx(bn,{size:14,responsive:!1,compact:!0,copyable:!1,did:m})}}},{label:"Wallet",name:"walletSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),filter:!0,filterType:"custom",filterList:f.walletSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Wallet",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[1].options.filterList,"walletSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,A)=>e.jsx(Be,{label:"Wallet",filterList:c,onChange:d,index:m,column:A,filterValues:T})},customBodyRenderLite:c=>{const{walletSendStatus:d,walletSendAt:m,walletSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"wallet",onResend:U=>L(U,E[c],"wallet",[],!1)})}}},{label:"Push Kit",name:"pushKitSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{pushKitSendStatus:d,pushKitSendAt:m,pushKitSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"pushkit",onResend:U=>L(U,E[c],"pushKit",[],!1)})},filter:!0,filterType:"custom",filterList:f.pushKitSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Push Kit",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[2].options.filterList,"pushKitSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,A)=>e.jsx(Be,{label:"Push Kit",filterList:c,onChange:d,index:m,column:A,filterValues:T})}}},{label:"Email",name:"emailSendStatus",width:200,options:{setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{emailSendStatus:d,emailSendAt:m,emailSendFailedReason:A}=E[c];return e.jsx(xe,{status:d,updatedAt:m,reason:A,channel:"email",onResend:U=>L(U,E[c],"email",[],!1)})},filter:!0,filterType:"custom",filterList:f.emailSendStatus??[],customFilterListOptions:{render:c=>e.jsx(Le,{list:c,label:"Email",onDelete:(d,m)=>{d.stopPropagation(),P(d,m,ie[3].options.filterList,"emailSendStatus")}}),update:Oe},filterOptions:{names:T,fullWidth:!0,logic:De,display:(c,d,m,A)=>e.jsx(Be,{label:"Email",filterList:c,onChange:d,index:m,column:A,filterValues:T})}}},{label:"Webhook",name:"webhook",width:200,options:{filter:!1,setCellProps:()=>({className:"sent-status-cell"}),customBodyRenderLite:c=>{const{webhook:d}=E[c];if(!d)return null;const m=Object.entries(d)[0];if(!m)return null;const[A,U]=m,ne=U[0];return e.jsx(y,{sx:{display:"flex",flexDirection:"column",gap:1},children:e.jsxs(y,{className:"webhook-item",sx:{fontSize:12},children:[e.jsx(Se,{maxLength:30,children:A},A),e.jsx(xe,{status:ne.status,updatedAt:ne.sendAt,reason:ne.failedReason,channel:"webhook",onResend:J=>L(J,E[c],"webhook",[A],!1)})]},A)})}}},{label:r("common.createdAt"),name:"createdAt",width:100,options:{filter:!1,customBodyRenderLite:c=>{const{createdAt:d}=E[c];return e.jsx(Nt,{value:d,locale:o,shouldUpdate:!0})}}}],[E,o,f,r]),Re=[e.jsx(Qe,{value:f.dateRange,onChange:W},"date-picker"),e.jsx(ce,{variant:"contained",size:"small",color:"primary",loading:S,startIcon:e.jsx(qt,{}),onClick:()=>O(),sx:{".MuiButton-startIcon":{mr:"2px"}},style:{marginLeft:8},children:r("common.refresh")},"refresh")];return e.jsx(y,{sx:{overflow:"auto",".MuiTableCell-head":{whiteSpace:"nowrap",fontWeight:"bold"},".MuiTableCell-root":{paddingRight:"8px",whiteSpace:"nowrap"}},children:e.jsx(Hn,{children:e.jsxs(xt,{theme:b,children:[e.jsx(yt,{className:"receivers-table",locale:o,loading:S,columns:ie,data:E,onChange:oe,options:ue,customButtons:Re,components:{TableFilterList:c=>e.jsx(et,{...c,itemComponent:d=>e.jsx(tt,{...d,canDelete:()=>!1})})}}),z.anchorEl&&e.jsx(Ue,{open:!!z.anchorEl,anchorReference:"anchorPosition",anchorPosition:z.position,onClose:fe,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsxs($n,{children:[e.jsxs(ee,{variant:"body1",component:"div",className:"check-title",children:[B?.channel," Checking"]}),e.jsx(y,{sx:{display:"flex",flexDirection:"column",gap:"4px"},children:we(B?.channel).map(c=>{const{type:d,pass:m,fail:A}=c;return!B?.result||B?.result?.[d]?e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:B?.result?.[d]?Ae.success.main:"inherit"},children:[B?.result?e.jsx(Mt,{}):e.jsx(ft,{size:12,sx:{color:Ae.primary.main}}),e.jsx("span",{children:m})]},d):e.jsxs(ee,{variant:"body1",component:"div",className:"check-item",sx:{display:"flex",alignItems:"center",gap:"4px",color:Ae.error.main},children:[e.jsx(Ut,{}),e.jsx("span",{children:A})]},d)})})]})}),F.anchorEl&&e.jsx(Ue,{open:!!F.anchorEl,anchorReference:"anchorPosition",anchorPosition:F.position,onClose:he,anchorOrigin:{vertical:"center",horizontal:"right"},transformOrigin:{vertical:"center",horizontal:"left"},children:e.jsx(Pt,{loading:t,onCancel:he,onConfirm:x})})]})})})}const Un=v.memo(Ft),Hn=ae.div`
2
2
  td.MuiTableCell-footer {
3
3
  border: none !important;
4
4
  }
@@ -1,4 +1,4 @@
1
- import{D as A1,J as Et,j as d,Y as mt,$ as yt,I as gt,dP as At,ar as S1,ak as te,a$ as Ee,cS as B1,b1 as St,am as D1,T as me,bC as Bt,z as Dt,co as wt,a6 as bt,Q as It}from"./vendor-mui-core-CmD-NPnl.js";import{C as N,a as Ht,ag as w1,J as fe,c as Tt,w as Ot,B as U,I as vt,F as xt}from"./vendor-utils-DQK0pEML.js";import{T as Ft,a5 as b1,J as Lt,a7 as se,l as Ut,r as kt,a as Rt,b as Nt,c as Pt,d as I1,e as Mt,f as jt,g as Vt,h as H1,i as Jt,j as Kt,k as _t,m as T1,n as Zt,o as Qt,p as Gt,q as Le,s as Xt,t as zt,u as Yt,v as qt,an as Wt,b9 as $t,F as e6,D as Pe,ba as Me}from"./vendor-ux-pYOhjQLA.js";import{r as s}from"./vendor-react-Dvs43sk9.js";import{k as O1,b as v1,a as Ie}from"./vendor-hooks-DLNZ8kxG.js";import{bl as Ue,Y as ke,cf as x1,cg as t6,v as r6,bu as n6,bw as i6}from"./index-D5Esor4q.js";import{x as s6}from"./index-DRYJ0xIl.js";import{f as a6}from"./index-BojVbZw0.js";import{v as je}from"./index-Ck6n4b0a.js";const ye=Ue({});function o6({key:e}={key:"md"}){const r=A1();return Et(r.breakpoints.down(e))}var L=(e=>(e[e.NETWORK_ERROR=1001]="NETWORK_ERROR",e[e.UNAUTHORIZED=1002]="UNAUTHORIZED",e[e.EXPIRED=1003]="EXPIRED",e[e.PAST_DUE=1004]="PAST_DUE",e[e.INVALID=1005]="INVALID",e[e.UNIT_LIMIT=1006]="UNIT_LIMIT",e[e.CORS_BLOCKED=1007]="CORS_BLOCKED",e[e.INCOMPATIBLE=1008]="INCOMPATIBLE",e))(L||{}),F1=(e=>(e.DEFAULT="default",e.SUCCEEDED="succeeded",e.FAILED="failed",e.PENDING="pending",e))(F1||{}),K=(e=>(e.APP_DISCONNECTED="app-disconnected",e.APP_RESTORE="app-restore",e.APP_BACKUP="app-backup",e.APP_CONNECTED="app-connected",e.APP_OBJECTS_SYNC="app-objects-sync",e))(K||{});function c6({endpoint:e,deps:r=[]}){return O1(async()=>{if(!ke(e))return;const{headers:n}=await ye.head(e,{timeout:1e3*30,params:{withExtras:!0}}),[i,c,a,f,u,p,E,o,l,C]=[n["x-space-name"],n["x-subscription-id"],n["x-listable"]==="true",n["x-readable"]==="true",n["x-writeable"]==="true",n["x-space-version"],n["x-space-owner-did"],n["x-space-is-available"],n["x-error-code"],n["x-is-site-admin"]],h=i?decodeURIComponent(i):"";if(o===void 0||l===void 0){const g=a&&f&&u;return{version:p,name:h,subscriptionId:c,ownerDid:E||"",isAvailable:g,errorCode:g?0:L.UNAUTHORIZED,isSiteAdmin:C==="true"}}return{version:p,name:h,subscriptionId:c,ownerDid:E,isAvailable:o==="true",errorCode:parseInt(l,10),isSiteAdmin:C==="true"}},{refreshDeps:[e].concat(r),onError(n){console.error(n)}})}const u6=x1.flatten({common:{cancel:"Cancel",confirm:"Confirm",delete:"Delete",error:"Error",open:"Open",unknown:"Unknown",invalidUrl:"Invalid url: {url}",upgrade:"Upgrade",viewMore:"View More"},storage:{spaces:{authorize:{title:"Connect {appName} to DID Spaces",scan:"Use your DID Wallet to scan the QR code below to allow the app {appName} to connect to DID Spaces",success:"Connected successfully"},connect:{reconnect:"Reconnect Now",useSpaceGateway:"Connect using the DID Spaces gateway",useWallet:"Connect to DID Spaces",howToGetGatewayUrl:"How to get the url of did spaces",providerForStorage:"Please connect your DID Spaces"},connected:{title:"Connected DID Spaces",tag:"Connected"},disconnected:{tag:"Disconnected"},error:{tag:"Need Attention",blockedByCors:"Access blocked by CORS",unreachable:"DID Space is unreachable",expired:"DID Spaces has expired, click this link to re-subscribe",pastDue:"DID Spaces has unpaid bills, click this link to complete payment",invalid:"DID Spaces subscription anomaly, click this link to check",unitLimit:"DID Spaces free quota has been used up, click this link to pay for the upgrade",cors:`The connection request may fail due to CORS restrictions:
1
+ import{D as A1,J as Et,j as d,Y as mt,$ as yt,I as gt,dP as At,ar as S1,ak as te,a$ as Ee,cS as B1,b1 as St,am as D1,T as me,bC as Bt,z as Dt,co as wt,a6 as bt,Q as It}from"./vendor-mui-core-CmD-NPnl.js";import{C as N,a as Ht,ag as w1,J as fe,c as Tt,w as Ot,B as U,I as vt,F as xt}from"./vendor-utils-DQK0pEML.js";import{T as Ft,a5 as b1,J as Lt,a7 as se,l as Ut,r as kt,a as Rt,b as Nt,c as Pt,d as I1,e as Mt,f as jt,g as Vt,h as H1,i as Jt,j as Kt,k as _t,m as T1,n as Zt,o as Qt,p as Gt,q as Le,s as Xt,t as zt,u as Yt,v as qt,an as Wt,b9 as $t,F as e6,D as Pe,ba as Me}from"./vendor-ux-pYOhjQLA.js";import{r as s}from"./vendor-react-Dvs43sk9.js";import{k as O1,b as v1,a as Ie}from"./vendor-hooks-DLNZ8kxG.js";import{bl as Ue,Y as ke,cf as x1,cg as t6,v as r6,bu as n6,bw as i6}from"./index-BJbNz5vx.js";import{x as s6}from"./index-DRYJ0xIl.js";import{f as a6}from"./index-BojVbZw0.js";import{v as je}from"./index-Ck6n4b0a.js";const ye=Ue({});function o6({key:e}={key:"md"}){const r=A1();return Et(r.breakpoints.down(e))}var L=(e=>(e[e.NETWORK_ERROR=1001]="NETWORK_ERROR",e[e.UNAUTHORIZED=1002]="UNAUTHORIZED",e[e.EXPIRED=1003]="EXPIRED",e[e.PAST_DUE=1004]="PAST_DUE",e[e.INVALID=1005]="INVALID",e[e.UNIT_LIMIT=1006]="UNIT_LIMIT",e[e.CORS_BLOCKED=1007]="CORS_BLOCKED",e[e.INCOMPATIBLE=1008]="INCOMPATIBLE",e))(L||{}),F1=(e=>(e.DEFAULT="default",e.SUCCEEDED="succeeded",e.FAILED="failed",e.PENDING="pending",e))(F1||{}),K=(e=>(e.APP_DISCONNECTED="app-disconnected",e.APP_RESTORE="app-restore",e.APP_BACKUP="app-backup",e.APP_CONNECTED="app-connected",e.APP_OBJECTS_SYNC="app-objects-sync",e))(K||{});function c6({endpoint:e,deps:r=[]}){return O1(async()=>{if(!ke(e))return;const{headers:n}=await ye.head(e,{timeout:1e3*30,params:{withExtras:!0}}),[i,c,a,f,u,p,E,o,l,C]=[n["x-space-name"],n["x-subscription-id"],n["x-listable"]==="true",n["x-readable"]==="true",n["x-writeable"]==="true",n["x-space-version"],n["x-space-owner-did"],n["x-space-is-available"],n["x-error-code"],n["x-is-site-admin"]],h=i?decodeURIComponent(i):"";if(o===void 0||l===void 0){const g=a&&f&&u;return{version:p,name:h,subscriptionId:c,ownerDid:E||"",isAvailable:g,errorCode:g?0:L.UNAUTHORIZED,isSiteAdmin:C==="true"}}return{version:p,name:h,subscriptionId:c,ownerDid:E,isAvailable:o==="true",errorCode:parseInt(l,10),isSiteAdmin:C==="true"}},{refreshDeps:[e].concat(r),onError(n){console.error(n)}})}const u6=x1.flatten({common:{cancel:"Cancel",confirm:"Confirm",delete:"Delete",error:"Error",open:"Open",unknown:"Unknown",invalidUrl:"Invalid url: {url}",upgrade:"Upgrade",viewMore:"View More"},storage:{spaces:{authorize:{title:"Connect {appName} to DID Spaces",scan:"Use your DID Wallet to scan the QR code below to allow the app {appName} to connect to DID Spaces",success:"Connected successfully"},connect:{reconnect:"Reconnect Now",useSpaceGateway:"Connect using the DID Spaces gateway",useWallet:"Connect to DID Spaces",howToGetGatewayUrl:"How to get the url of did spaces",providerForStorage:"Please connect your DID Spaces"},connected:{title:"Connected DID Spaces",tag:"Connected"},disconnected:{tag:"Disconnected"},error:{tag:"Need Attention",blockedByCors:"Access blocked by CORS",unreachable:"DID Space is unreachable",expired:"DID Spaces has expired, click this link to re-subscribe",pastDue:"DID Spaces has unpaid bills, click this link to complete payment",invalid:"DID Spaces subscription anomaly, click this link to check",unitLimit:"DID Spaces free quota has been used up, click this link to pay for the upgrade",cors:`The connection request may fail due to CORS restrictions:
2
2
  1. Please contact the DID Space administrator to verify the relevant configuration.
3
3
  2. If you are the administrator, click the link below to view the detailed setup guide and resolve the issue.`,networkError:"DID Space is currently unreachable due to potential server issues, network problems, or maintenance. Please click the link to visit the homepage and check its status.",incompatible:`The current connection of DID Spaces version ({spaceVersion}) is not compatible with the component version ({expectVersion}). Please contact the administrator for adjustments.
4
4
  If you are the administrator, you can click the link below to take action.`},gateway:{add:{invalidUrl:"Invalid DID Spaces gateway url",label:"Enter the url of the DID Spaces",title:"Add DID Spaces"}},provideNFT:{title:"Please show the DID Spaces NFT for {appName}",scan:"Use your DID Wallet to scan the QR code below to allow the app {appName} show DID Spaces NFT",success:"Connected successfully"},helperText:{fixCorsError:"Fixing CORS Errors When Connecting to DID Spaces"}}},auditLog:{backup:{description:"A backup operation was completed {relativeTime}"},restore:{description:"A restore operation was completed {relativeTime}"},connected:{description:"A connection was established {relativeTime}"},disconnected:{description:"The connection was disconnected {relativeTime}"},objectsSync:{description:"{totalCount} objects ({size}) were synchronized {relativeTime}"}}}),l6=x1.flatten({common:{cancel:"取消",confirm:"确认",delete:"删除",error:"错误",open:"打开",unknown:"未知",invalidUrl:"无效的 url: {url}",upgrade:"升级",viewMore:"查看更多"},storage:{spaces:{authorize:{title:"连接 {appName} 至 DID Spaces",scan:"使用你的 DID Wallet 扫描下面的二维码以允许应用 {appName} 连接至 DID Spaces",success:"连接成功"},connect:{reconnect:"立即重连",useSpaceGateway:"使用 DID Spaces 网关连接",useWallet:"连接至 DID Spaces",howToGetGatewayUrl:"如何获取 DID Spaces 的网关地址",providerForStorage:"请连接您的 DID Spaces"},connected:{title:"已连接的 DID Spaces",tag:"已连接"},disconnected:{tag:"连接已断开"},error:{tag:"需要关注",blockedByCors:"因 CORS 限制,访问被阻止",unreachable:"DID Space 无法访问",expired:"DID Spaces 已过期,点击此链接重新订阅",pastDue:"DID Spaces 有未支付账单,点击此链接完成支付",invalid:"DID Spaces 订阅异常,点击此链接检查",unitLimit:"DID Spaces 免费额度已用完,点击此链接付费升级",cors:`连接请求可能因 CORS 限制而失败:
@@ -1,4 +1,4 @@
1
- import{r as y,t as fr,g as hr,e as gr}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as O,y as Me,x as _e,bb as We,M as Ce,T as X,z as pe,bC as Ze,aX as ie,a6 as ae,W as b,at as z,aj as xr,aI as yr,D as vr,cf as je,bp as br,b6 as Pt,bq as Cr,am as fe,bZ as dt,P as jr,Q as It,bW as Sr,ds as wr,ch as kr,aO as Pr,aP as Ir,dt as Tr,I as Er,dn as Ar,bL as Dr,du as Rr,a5 as Lr}from"./vendor-mui-core-CmD-NPnl.js";import{B as qe,e as $e,K as Or,ad as Nr,n as ut,C as Ur,a as Fr}from"./vendor-utils-DQK0pEML.js";import{T as Z,$ as Br,J as Mr,H as Y,F as re,D as $,G as ge,O as Tt,ab as _r,L as Wr,a6 as ze,ac as Et,ai as qr}from"./vendor-ux-pYOhjQLA.js";import{bd as Qe,aA as At,av as $r,aB as zr,bS as Hr,bT as Kr,Z as K,bU as Se,p as he,ap as He,W as Vr,v as Zr,aM as Qr,B as ne,bV as Yr,bW as Gr,a8 as Dt,c as te,b9 as Xr,a5 as Jr,X as se,bX as Rt,ar as es,aZ as Lt,bY as ts}from"./index-D5Esor4q.js";import{B as Ot,o as rs,l as Nt}from"./index-DDpL_qpY.js";import{x as ss,b as Ye,g as ke,c as ns,h as os,a as is}from"./vendor-hooks-DLNZ8kxG.js";import{C as Ut,P as as}from"./user-sessions-DN1hzt8P.js";import{r as ls}from"./hdkey-CcHIRiJU.js";import{W as Ft}from"./dashboard-q_CEWNOG.js";import{W as Ge}from"./did-address-CNnw4_bl.js";import{u as Q}from"./team-CGGZIbfh.js";import{u as le}from"./session-DGB-yOme.js";import{P as J}from"./permission-DO4jN8xJ.js";import{C as Pe}from"./click-to-copy-Dqmzk5Lh.js";import{T as Bt}from"./index-DL5x17V7.js";import{f as ee}from"./index-DBs9Ljax.js";import{u as cs}from"./useAsync-DZevTxbv.js";import{v as H}from"./index-DzI9kX_C.js";import{C as xe}from"./confirm-DUjUXcfn.js";import{N as ds}from"./index-BVZj6aBL.js";import{i as Mt,a as we,p as _t}from"./util-CYsTlK2W.js";import{b as us}from"./sdk-C9i2DDEJ.js";import{U as ms}from"./user-follower-Cs8st3w5.js";import{A as ps}from"./actions-CL4xTGOh.js";import{S as fs}from"./shorten-label-Cbu8wo9m.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DEa0A9MF.js";import"./useLocalStorage-CiLfInVV.js";import"./get-safe-url-PVZ8sNva.js";import"./useAsyncRetry-6TjWJyO6.js";import"./useAsync-CNAYLnLm.js";import"./useSetState-DFuQZPPV.js";import"./index-DhLCZYhn.js";import"./over-due-invoice-payment-CgKEpOv9.js";import"./use-mobile-CQ7Tw4aD.js";import"./isURL-DZGsNcmL.js";import"./use-app-logo-DxlfjGOQ.js";import"./arrow-down.svg-DNHk5QBL.js";import"./vendor-mui-x--K2rEM1j.js";import"./AdapterDayjs-Ch1GqpK7.js";import"./base32-9HlsUoU3.js";import"./use-mobile-D93Bk2Ru.js";const Wt=t=>y.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("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"}),y.createElement("rect",{x:12.5,y:9.375,width:7.5,height:1.875,rx:.9375}),y.createElement("rect",{x:15.3125,y:14.0625,width:7.5,height:1.875,rx:.9375,transform:"rotate(-90 15.3125 14.0625)"})),qt=t=>y.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("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"}),y.createElement("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"}),y.createElement("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"}),y.createElement("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"})),$t=t=>y.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("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"}),y.createElement("rect",{x:12.5,y:9.375,width:7.5,height:1.875,rx:.9375})),hs=t=>y.createElement("svg",{width:18,height:19,viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("g",{clipPath:"url(#clip0)"},y.createElement("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"})),y.createElement("defs",null,y.createElement("clipPath",{id:"clip0"},y.createElement("rect",{width:18,height:18,transform:"translate(0 0.5)"}))));var Ee={},Ae,mt;function gs(){return mt||(mt=1,Ae=t=>encodeURIComponent(t).replace(/[!'()*]/g,m=>`%${m.charCodeAt(0).toString(16).toUpperCase()}`)),Ae}var De,pt;function xs(){if(pt)return De;pt=1;var t="%[a-f0-9]{2}",m=new RegExp("("+t+")|([^%]+?)","gi"),p=new RegExp("("+t+")+","gi");function v(a,i){try{return[decodeURIComponent(a.join(""))]}catch{}if(a.length===1)return a;i=i||1;var o=a.slice(0,i),h=a.slice(i);return Array.prototype.concat.call([],v(o),v(h))}function C(a){try{return decodeURIComponent(a)}catch{for(var i=a.match(m)||[],o=1;o<i.length;o++)a=v(i,o).join(""),i=a.match(m)||[];return a}}function x(a){for(var i={"%FE%FF":"��","%FF%FE":"��"},o=p.exec(a);o;){try{i[o[0]]=decodeURIComponent(o[0])}catch{var h=C(o[0]);h!==o[0]&&(i[o[0]]=h)}o=p.exec(a)}i["%C2"]="�";for(var n=Object.keys(i),S=0;S<n.length;S++){var P=n[S];a=a.replace(new RegExp(P,"g"),i[P])}return a}return De=function(a){if(typeof a!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof a+"`");try{return a=a.replace(/\+/g," "),decodeURIComponent(a)}catch{return x(a)}},De}var Re,ft;function ys(){return ft||(ft=1,Re=(t,m)=>{if(!(typeof t=="string"&&typeof m=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(m==="")return[t];const p=t.indexOf(m);return p===-1?[t]:[t.slice(0,p),t.slice(p+m.length)]}),Re}var Le,ht;function vs(){return ht||(ht=1,Le=function(t,m){for(var p={},v=Object.keys(t),C=Array.isArray(m),x=0;x<v.length;x++){var a=v[x],i=t[a];(C?m.indexOf(a)!==-1:m(a,i,t))&&(p[a]=i)}return p}),Le}var gt;function bs(){return gt||(gt=1,function(t){const m=gs(),p=xs(),v=ys(),C=vs(),x=r=>r==null;function a(r){switch(r.arrayFormat){case"index":return s=>(d,l)=>{const u=d.length;return l===void 0||r.skipNull&&l===null||r.skipEmptyString&&l===""?d:l===null?[...d,[h(s,r),"[",u,"]"].join("")]:[...d,[h(s,r),"[",h(u,r),"]=",h(l,r)].join("")]};case"bracket":return s=>(d,l)=>l===void 0||r.skipNull&&l===null||r.skipEmptyString&&l===""?d:l===null?[...d,[h(s,r),"[]"].join("")]:[...d,[h(s,r),"[]=",h(l,r)].join("")];case"comma":case"separator":return s=>(d,l)=>l==null||l.length===0?d:d.length===0?[[h(s,r),"=",h(l,r)].join("")]:[[d,h(l,r)].join(r.arrayFormatSeparator)];default:return s=>(d,l)=>l===void 0||r.skipNull&&l===null||r.skipEmptyString&&l===""?d:l===null?[...d,h(s,r)]:[...d,[h(s,r),"=",h(l,r)].join("")]}}function i(r){let s;switch(r.arrayFormat){case"index":return(d,l,u)=>{if(s=/\[(\d*)\]$/.exec(d),d=d.replace(/\[\d*\]$/,""),!s){u[d]=l;return}u[d]===void 0&&(u[d]={}),u[d][s[1]]=l};case"bracket":return(d,l,u)=>{if(s=/(\[\])$/.exec(d),d=d.replace(/\[\]$/,""),!s){u[d]=l;return}if(u[d]===void 0){u[d]=[l];return}u[d]=[].concat(u[d],l)};case"comma":case"separator":return(d,l,u)=>{const T=typeof l=="string"&&l.includes(r.arrayFormatSeparator),w=typeof l=="string"&&!T&&n(l,r).includes(r.arrayFormatSeparator);l=w?n(l,r):l;const R=T||w?l.split(r.arrayFormatSeparator).map(M=>n(M,r)):l===null?l:n(l,r);u[d]=R};default:return(d,l,u)=>{if(u[d]===void 0){u[d]=l;return}u[d]=[].concat(u[d],l)}}}function o(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function h(r,s){return s.encode?s.strict?m(r):encodeURIComponent(r):r}function n(r,s){return s.decode?p(r):r}function S(r){return Array.isArray(r)?r.sort():typeof r=="object"?S(Object.keys(r)).sort((s,d)=>Number(s)-Number(d)).map(s=>r[s]):r}function P(r){const s=r.indexOf("#");return s!==-1&&(r=r.slice(0,s)),r}function g(r){let s="";const d=r.indexOf("#");return d!==-1&&(s=r.slice(d)),s}function k(r){r=P(r);const s=r.indexOf("?");return s===-1?"":r.slice(s+1)}function c(r,s){return s.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?r=Number(r):s.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")&&(r=r.toLowerCase()==="true"),r}function f(r,s){s=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},s),o(s.arrayFormatSeparator);const d=i(s),l=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return l;for(const u of r.split("&")){if(u==="")continue;let[T,w]=v(s.decode?u.replace(/\+/g," "):u,"=");w=w===void 0?null:["comma","separator"].includes(s.arrayFormat)?w:n(w,s),d(n(T,s),w,l)}for(const u of Object.keys(l)){const T=l[u];if(typeof T=="object"&&T!==null)for(const w of Object.keys(T))T[w]=c(T[w],s);else l[u]=c(T,s)}return s.sort===!1?l:(s.sort===!0?Object.keys(l).sort():Object.keys(l).sort(s.sort)).reduce((u,T)=>{const w=l[T];return w&&typeof w=="object"&&!Array.isArray(w)?u[T]=S(w):u[T]=w,u},Object.create(null))}t.extract=k,t.parse=f,t.stringify=(r,s)=>{if(!r)return"";s=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},s),o(s.arrayFormatSeparator);const d=w=>s.skipNull&&x(r[w])||s.skipEmptyString&&r[w]==="",l=a(s),u={};for(const w of Object.keys(r))d(w)||(u[w]=r[w]);const T=Object.keys(u);return s.sort!==!1&&T.sort(s.sort),T.map(w=>{const R=r[w];return R===void 0?"":R===null?h(w,s):Array.isArray(R)?R.reduce(l(w),[]).join("&"):h(w,s)+"="+h(R,s)}).filter(w=>w.length>0).join("&")},t.parseUrl=(r,s)=>{s=Object.assign({decode:!0},s);const[d,l]=v(r,"#");return Object.assign({url:d.split("?")[0]||"",query:f(k(r),s)},s&&s.parseFragmentIdentifier&&l?{fragmentIdentifier:n(l,s)}:{})},t.stringifyUrl=(r,s)=>{s=Object.assign({encode:!0,strict:!0},s);const d=P(r.url).split("?")[0]||"",l=t.extract(r.url),u=t.parse(l,{sort:!1}),T=Object.assign(u,r.query);let w=t.stringify(T,s);w&&(w=`?${w}`);let R=g(r.url);return r.fragmentIdentifier&&(R=`#${h(r.fragmentIdentifier,s)}`),`${d}${w}${R}`},t.pick=(r,s,d)=>{d=Object.assign({parseFragmentIdentifier:!0},d);const{url:l,query:u,fragmentIdentifier:T}=t.parseUrl(r,d);return t.stringifyUrl({url:l,query:C(u,s),fragmentIdentifier:T},d)},t.exclude=(r,s,d)=>{const l=Array.isArray(s)?u=>!s.includes(u):(u,T)=>!s(u,T);return t.pick(r,l,d)}}(Ee)),Ee}var Oe=bs();const de=fr,Cs={parseNumbers:!1,parseBooleans:!1},js={skipNull:!1,skipEmptyString:!1},Ss=(t,m)=>{var p,v;const{navigateMode:C="push",parseOptions:x,stringifyOptions:a}={},i=Object.assign(Object.assign({},Cs),x),o=Object.assign(Object.assign({},js),a),h=de.useLocation(),n=(p=de.useHistory)===null||p===void 0?void 0:p.call(de),S=(v=de.useNavigate)===null||v===void 0?void 0:v.call(de),P=ss(),g=y.useRef(typeof t=="function"?t():t||{}),k=y.useMemo(()=>Oe.parse(h.search,i),[h.search]),c=y.useMemo(()=>Object.assign(Object.assign({},g.current),k),[k]);return[c,Ye(r=>{const s=typeof r=="function"?r(c):r;P(),n&&n[C]({hash:h.hash,search:Oe.stringify(Object.assign(Object.assign({},k),s),o)||"?"},h.state),S&&S({hash:h.hash,search:Oe.stringify(Object.assign(Object.assign({},k),s),o)||"?"},{replace:C==="replace",state:h.state})})]};var Ne,xt;function ws(){if(xt)return Ne;xt=1;const t=ls(),m=Qe(),{fromSecretKey:p,WalletType:v}=At(),{isHexStrict:C,toHex:x,toBuffer:a,stripHexPrefix:i}=$r(),{types:o}=m;return Ne={fromAppDid:(n,S,P={role:o.RoleType.ROLE_ACCOUNT},g=0)=>{if(!S)throw new Error("Cannot get user wallet with empty root sk");const k=m.Hasher.SHA3.hash256(a(n)),c=i(k).slice(0,16),f=c.slice(0,8),r=c.slice(8,16),s=parseInt(+`0x${f}`,10)&2147483647,d=parseInt(+`0x${r}`,10)&2147483647,l=i(C(S)?S:x(S)),u=t.fromMasterSeed(qe.from(l,"hex")),T=`m/44'/260'/${s}'/${d}'/${g}`,w=u.derive(T),R=v(P),{pk:M=o.KeyType.ED25519}=R;let F;return M===o.KeyType.ED25519?F=m.Signer.Ed25519.genKeyPair("hex",w.privateKey).secretKey:F=x(w.privateKey),M===o.KeyType.ETHEREUM&&(F=F.slice(0,66)),p(F,R)}},Ne}var Ue,yt;function ks(){if(yt)return Ue;yt=1;const t=Qe(),m=At(),p=zr(),v=ws(),C={role:t.types.RoleType.ROLE_APPLICATION};return Ue=(a,i,o,h)=>{let n=o||C;const S=(0,p.isEthereumType)((0,p.DidType)(o));if(S?n=(0,m.WalletType)(o):n=(0,m.WalletType)(C),!(0,p.isValid)(a)){let P="";try{return S?P=a.slice(0,66):P=a,(0,m.fromSecretKey)(P,n)}catch(g){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${g.message}`)}}if(!i)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,v.fromAppDid)(a,i,n,h||0)},Ue}var ue,vt;function Ps(){if(vt)return ue;vt=1;var t=ue&&ue.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};const m=t(Hr),p=Qe(),v=t(ks()),C=Kr();return ue=(a,i,{returnWallet:o=!0}={})=>{if(!a||typeof a!="object"||!Array.isArray(a.environments)||!(0,m.default)(a,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:h,configs:n=[]}=a,S=[...n,...h],P=S.find(N=>N.key==="BLOCKLET_APP_DESCRIPTION"),g=S.find(N=>N.key==="BLOCKLET_PASSPORT_COLOR"),k=S.find(N=>N.key==="BLOCKLET_APP_URL"),c=S.find(N=>N.key==="BLOCKLET_APP_TENANT_MODE"),{did:f,version:r}=a.meta,s=(0,C.getDisplayName)(a),d=(0,m.default)(P,"value",a.meta.description),l=(0,m.default)(g,"value","auto"),u=(0,m.default)(k,"value",""),T=(0,m.default)(c,"value","");if(!o)return{did:f,version:r,name:s,description:d,passportColor:l,appUrl:u,secret:"",wallet:null,permanentWallet:null,tenantMode:T};const w=S.find(N=>N.key==="BLOCKLET_APP_SK"),R=S.find(N=>N.key==="BLOCKLET_APP_CHAIN_TYPE")||S.find(N=>N.key==="BLOCKLET_WALLET_TYPE"),M=S.find(N=>N.key==="BLOCKLET_APP_PSK");let F;R&&(R.value==="ethereum"||R.value==="eth")&&(F=R.value);let W=null,E=null;if(w&&w.value)W=(0,v.default)(w.value,void 0,F),M&&M.value&&M.value!==w.value&&(E=(0,v.default)(M.value,void 0,F));else{if(!i||typeof i!="string")throw new Error("Node secret key must be a string");R?W=(0,v.default)(a.meta.did,i,F):W=(0,v.default)(a.meta.did,i)}const D=a.settings?.session?.salt||"",U=p.Hasher.SHA3.hash256(qe.concat([W.secretKey,W.address,D].filter(Boolean).map(N=>qe.from(N))));return{did:f,version:r,name:s,description:d,passportColor:l,appUrl:u,secret:U,wallet:W,permanentWallet:E||W,tenantMode:T}},ue}var Is=Ps();const Ts=hr(Is);var Es={};function zt({teamDid:t,roles:m=[],apps:p=[],onCancel:v,onSuccess:C,onError:x=()=>{},endpoint:a=""}){const{api:i}=K(),{t:o,locale:h}=Z(),n=ke({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:p.length>0?p[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),S=async()=>{if(!n.role){n.error=o("team.member.error.passportEmpty");return}if(n.passportExpireTime&&He(n.passportExpireTime).isBefore(He())){n.error=o("team.passport.customExpireTimeIsInvalid");return}const f=n.remark.trim();n.error=null,n.loading=!0;try{let r=n.sourceAppPid??null;r===t&&(r=null);const s={teamDid:t,role:n.role,remark:f,sourceAppPid:r,passportExpireTime:n.passportExpireTime?n.passportExpireTime.toISOString():""};n.display&&(s.display={type:"url",content:n.display});const{inviteInfo:d}=await i.createMemberInvitation({input:s});n.inviteInfo=d,n.activeStep=1}catch(r){const s=ee(r);n.error=s,x(r)}finally{n.loading=!1}},P=m.find(f=>f.name===n.role),g=m.filter(f=>f.name!=="owner"),c=[{body:e.jsxs(O,{sx:{display:"flex",flexDirection:"column",gap:3},children:[p.length>1?e.jsxs(Me,{fullWidth:!0,children:[e.jsx(_e,{children:o("common.sourceApp")}),e.jsx(We,{value:n.sourceAppPid,onChange:f=>{n.error=null,n.sourceAppPid=f.target.value},fullWidth:!0,label:o("common.passport"),disabled:n.loading,children:p.map(f=>e.jsx(Ce,{value:f.appPid,children:e.jsxs(O,{sx:{display:"flex",justifyContent:"space-between",gap:2,width:"100%"},children:[e.jsxs(O,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Br,{did:f.appPid,size:28}),f.appName]}),e.jsx(Mr,{did:f.appPid,compact:!0,responsive:!1})]})},f.appPid))})]}):null,e.jsxs(Me,{fullWidth:!0,variant:"outlined",children:[e.jsx(_e,{children:o("common.passport")}),e.jsx(We,{"data-cy":"invite-member-select-role",value:n.role,onChange:f=>{n.error=null,n.role=f.target.value},fullWidth:!0,label:o("common.passport"),disabled:n.loading,onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),S())},children:g.map(f=>e.jsx(Ce,{value:f.name,"data-cy":`invite-member-select-option-${f.name}`,children:e.jsxs(O,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(X,{variant:"subtitle1",children:f.title||f.name}),e.jsx(X,{variant:"caption",sx:{opacity:.7},children:f.description})]})},f.name))})]}),P?.extra?.display==="custom"&&e.jsx(pe,{label:o("common.display"),type:"url",value:n.display,onChange:f=>{n.error=null,n.display=f.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(pe,{label:o("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:n.remark,onChange:f=>{n.error=null,n.remark=f.target.value},disabled:n.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Bt,{value:n.passportExpireTime,onChange:f=>{n.error=null,n.passportExpireTime=f},showError:!1})]}),cancel:o("common.cancel"),confirm:o("team.member.inviteDialog.createInviteLink"),onCancel:v,onConfirm:S},{body:()=>{const f=Se({inviteId:n.inviteInfo?.inviteId,endpoint:a});return e.jsxs("div",{children:[e.jsx(O,{sx:{fontSize:16,fontWeight:"bold"},children:o("team.member.inviteDialog.createSuccessTip",{expireDate:he(n.inviteInfo?.expireDate,h)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Pe,{children:f})]})},confirm:o("common.copy"),onConfirm:()=>{const f=Se({inviteId:n.inviteInfo?.inviteId,endpoint:a});if(["1","true"].includes(Es.IS_E2E)){C();return}ns(f),Y.success(o("common.copied")),C()},cancel:o("common.cancel"),onCancel:v}][n.activeStep];return e.jsxs(re,{title:o("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[c.cancel&&e.jsx($,{onClick:c.onCancel,color:"inherit",children:c.cancel}),e.jsxs($,{onClick:c.onConfirm,color:"primary",disabled:n.loading||!n.role,variant:"contained",autoFocus:!0,children:[n.loading&&e.jsx(ae,{size:16}),c.confirm]})]}),children:[e.jsx(Ze,{component:"div",children:typeof c.body=="function"?c.body():c.body}),!!n.error&&e.jsx(ie,{severity:"error",sx:{mt:2},children:n.error})]})}zt.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,roles:b.array,apps:b.array,endpoint:b.string};function Ht({teamDid:t,onCancel:m,onSuccess:p,onError:v=()=>{},endpoint:C=""}){const{api:x,info:a}=K(),{api:i}=y.useContext(Vr),[o,h]=y.useState(!1),{t:n,locale:S}=Z(),[P,g]=y.useState(""),[k,c]=y.useState(!1),[f,r]=y.useState(0),[s,d]=y.useState(""),[l,u]=y.useState(""),T=!!$e(a,"ownerNft.did"),w=cs(async()=>{if(T){const{state:D}=await x.getDelegationState();return D}return{delegated:!0}});if(w.loading)return e.jsx(re,{title:n("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:m,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(ae,{})})});if(w.error)return e.jsx(re,{title:n("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:m,children:e.jsx(ie,{severity:"error",children:ee(w.error)})});const R=async()=>{g(null),h(!0);try{const{inviteInfo:D}=await x.createTransferInvitation({input:{teamDid:t,role:"owner",remark:l.trim()}});d(D),r(W.length-1)}catch(D){const U=ee(D);g(U),v(D)}finally{h(!1)}},M=()=>{c(!0),r(1)},F=()=>{c(!1),r(0)},W=[{body:e.jsxs(X,{component:"div",children:[e.jsxs(ie,{severity:"warning",children:[e.jsx(X,{children:n("team.transferNode.inviteDialog.tips.progress")}),e.jsx(X,{children:n("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(ie,{severity:"warning",children:e.jsx(X,{children:n("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(pe,{label:n("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:l,onChange:D=>{g(null),u(D.target.value)},disabled:o,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:n("common.cancel"),confirm:n("team.transferNode.inviteDialog.createInviteLink"),onCancel:m,onConfirm:T&&!$e(w,"value.delegated")?M:R},{body:()=>e.jsx(Zr,{action:"delegate-transfer-nft",open:k,locale:S,checkFn:i.get,onClose:F,onSuccess:R,checkTimeout:5*60*1e3,webWalletUrl:Qr(a),extraParams:{targetDID:a.did},messages:{title:n("team.transferNode.delegateDialog.title"),scan:n("team.transferNode.delegateDialog.scan"),confirm:n("team.transferNode.delegateDialog.confirm"),success:n("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const D=Se({inviteId:s.inviteId,endpoint:C});return e.jsxs("div",{children:[e.jsx(As,{children:n("team.transferNode.inviteDialog.createSuccessTip",{expireDate:he(s.expireDate,S)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Pe,{children:D})]})},confirm:n("common.confirm"),onConfirm:p}],E=W[f];return e.jsxs(re,{title:n("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[E.cancel&&e.jsx($,{onClick:E.onCancel,color:"inherit",children:E.cancel}),e.jsxs($,{onClick:E.onConfirm,color:"primary",disabled:o,variant:"contained",autoFocus:!0,children:[o&&e.jsx(ae,{size:16}),E.confirm]})]}),children:[e.jsx(Ze,{component:"div",children:typeof E.body=="function"?E.body():E.body}),!!P&&e.jsx(ie,{severity:"error",children:P})]})}Ht.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,endpoint:b.string};const As=z.div`
1
+ import{r as y,t as fr,g as hr,e as gr}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as O,y as Me,x as _e,bb as We,M as Ce,T as X,z as pe,bC as Ze,aX as ie,a6 as ae,W as b,at as z,aj as xr,aI as yr,D as vr,cf as je,bp as br,b6 as Pt,bq as Cr,am as fe,bZ as dt,P as jr,Q as It,bW as Sr,ds as wr,ch as kr,aO as Pr,aP as Ir,dt as Tr,I as Er,dn as Ar,bL as Dr,du as Rr,a5 as Lr}from"./vendor-mui-core-CmD-NPnl.js";import{B as qe,e as $e,K as Or,ad as Nr,n as ut,C as Ur,a as Fr}from"./vendor-utils-DQK0pEML.js";import{T as Z,$ as Br,J as Mr,H as Y,F as re,D as $,G as ge,O as Tt,ab as _r,L as Wr,a6 as ze,ac as Et,ai as qr}from"./vendor-ux-pYOhjQLA.js";import{bd as Qe,aA as At,av as $r,aB as zr,bS as Hr,bT as Kr,Z as K,bU as Se,p as he,ap as He,W as Vr,v as Zr,aM as Qr,B as ne,bV as Yr,bW as Gr,a8 as Dt,c as te,b9 as Xr,a5 as Jr,X as se,bX as Rt,ar as es,aZ as Lt,bY as ts}from"./index-BJbNz5vx.js";import{B as Ot,o as rs,l as Nt}from"./index-uH_9YgA0.js";import{x as ss,b as Ye,g as ke,c as ns,h as os,a as is}from"./vendor-hooks-DLNZ8kxG.js";import{C as Ut,P as as}from"./user-sessions-CuXtk29w.js";import{r as ls}from"./hdkey-BgsbeAhG.js";import{W as Ft}from"./dashboard-C_xJDuQY.js";import{W as Ge}from"./did-address-CNnw4_bl.js";import{u as Q}from"./team-B-jk7E5_.js";import{u as le}from"./session-m3orzHBa.js";import{P as J}from"./permission-CSIyJtvw.js";import{C as Pe}from"./click-to-copy-Dqmzk5Lh.js";import{T as Bt}from"./index-BwMsFaIR.js";import{f as ee}from"./index-DBs9Ljax.js";import{u as cs}from"./useAsync-DZevTxbv.js";import{v as H}from"./index-DzI9kX_C.js";import{C as xe}from"./confirm-BbY8YGyk.js";import{N as ds}from"./index-DS-40ZVK.js";import{i as Mt,a as we,p as _t}from"./util-Bravn321.js";import{b as us}from"./sdk-B4j47QQf.js";import{U as ms}from"./user-follower-DWn8bXG-.js";import{A as ps}from"./actions-CL4xTGOh.js";import{S as fs}from"./shorten-label-Cbu8wo9m.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DEa0A9MF.js";import"./useLocalStorage-CiLfInVV.js";import"./get-safe-url-DKg8JLr1.js";import"./useAsyncRetry-6TjWJyO6.js";import"./useAsync-CNAYLnLm.js";import"./useSetState-DFuQZPPV.js";import"./index-D7zqBJdA.js";import"./over-due-invoice-payment-D2yclQzx.js";import"./use-mobile-CQ7Tw4aD.js";import"./isURL-CCV0esLR.js";import"./use-app-logo-D_gO-Dio.js";import"./arrow-down.svg-VIKI4IBd.js";import"./vendor-mui-x--K2rEM1j.js";import"./AdapterDayjs-Ch1GqpK7.js";import"./base32-dGIGRTeZ.js";import"./use-mobile-D93Bk2Ru.js";const Wt=t=>y.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("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"}),y.createElement("rect",{x:12.5,y:9.375,width:7.5,height:1.875,rx:.9375}),y.createElement("rect",{x:15.3125,y:14.0625,width:7.5,height:1.875,rx:.9375,transform:"rotate(-90 15.3125 14.0625)"})),qt=t=>y.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("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"}),y.createElement("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"}),y.createElement("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"}),y.createElement("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"})),$t=t=>y.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("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"}),y.createElement("rect",{x:12.5,y:9.375,width:7.5,height:1.875,rx:.9375})),hs=t=>y.createElement("svg",{width:18,height:19,viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg",...t},y.createElement("g",{clipPath:"url(#clip0)"},y.createElement("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"})),y.createElement("defs",null,y.createElement("clipPath",{id:"clip0"},y.createElement("rect",{width:18,height:18,transform:"translate(0 0.5)"}))));var Ee={},Ae,mt;function gs(){return mt||(mt=1,Ae=t=>encodeURIComponent(t).replace(/[!'()*]/g,m=>`%${m.charCodeAt(0).toString(16).toUpperCase()}`)),Ae}var De,pt;function xs(){if(pt)return De;pt=1;var t="%[a-f0-9]{2}",m=new RegExp("("+t+")|([^%]+?)","gi"),p=new RegExp("("+t+")+","gi");function v(a,i){try{return[decodeURIComponent(a.join(""))]}catch{}if(a.length===1)return a;i=i||1;var o=a.slice(0,i),h=a.slice(i);return Array.prototype.concat.call([],v(o),v(h))}function C(a){try{return decodeURIComponent(a)}catch{for(var i=a.match(m)||[],o=1;o<i.length;o++)a=v(i,o).join(""),i=a.match(m)||[];return a}}function x(a){for(var i={"%FE%FF":"��","%FF%FE":"��"},o=p.exec(a);o;){try{i[o[0]]=decodeURIComponent(o[0])}catch{var h=C(o[0]);h!==o[0]&&(i[o[0]]=h)}o=p.exec(a)}i["%C2"]="�";for(var n=Object.keys(i),S=0;S<n.length;S++){var P=n[S];a=a.replace(new RegExp(P,"g"),i[P])}return a}return De=function(a){if(typeof a!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof a+"`");try{return a=a.replace(/\+/g," "),decodeURIComponent(a)}catch{return x(a)}},De}var Re,ft;function ys(){return ft||(ft=1,Re=(t,m)=>{if(!(typeof t=="string"&&typeof m=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(m==="")return[t];const p=t.indexOf(m);return p===-1?[t]:[t.slice(0,p),t.slice(p+m.length)]}),Re}var Le,ht;function vs(){return ht||(ht=1,Le=function(t,m){for(var p={},v=Object.keys(t),C=Array.isArray(m),x=0;x<v.length;x++){var a=v[x],i=t[a];(C?m.indexOf(a)!==-1:m(a,i,t))&&(p[a]=i)}return p}),Le}var gt;function bs(){return gt||(gt=1,function(t){const m=gs(),p=xs(),v=ys(),C=vs(),x=r=>r==null;function a(r){switch(r.arrayFormat){case"index":return s=>(d,l)=>{const u=d.length;return l===void 0||r.skipNull&&l===null||r.skipEmptyString&&l===""?d:l===null?[...d,[h(s,r),"[",u,"]"].join("")]:[...d,[h(s,r),"[",h(u,r),"]=",h(l,r)].join("")]};case"bracket":return s=>(d,l)=>l===void 0||r.skipNull&&l===null||r.skipEmptyString&&l===""?d:l===null?[...d,[h(s,r),"[]"].join("")]:[...d,[h(s,r),"[]=",h(l,r)].join("")];case"comma":case"separator":return s=>(d,l)=>l==null||l.length===0?d:d.length===0?[[h(s,r),"=",h(l,r)].join("")]:[[d,h(l,r)].join(r.arrayFormatSeparator)];default:return s=>(d,l)=>l===void 0||r.skipNull&&l===null||r.skipEmptyString&&l===""?d:l===null?[...d,h(s,r)]:[...d,[h(s,r),"=",h(l,r)].join("")]}}function i(r){let s;switch(r.arrayFormat){case"index":return(d,l,u)=>{if(s=/\[(\d*)\]$/.exec(d),d=d.replace(/\[\d*\]$/,""),!s){u[d]=l;return}u[d]===void 0&&(u[d]={}),u[d][s[1]]=l};case"bracket":return(d,l,u)=>{if(s=/(\[\])$/.exec(d),d=d.replace(/\[\]$/,""),!s){u[d]=l;return}if(u[d]===void 0){u[d]=[l];return}u[d]=[].concat(u[d],l)};case"comma":case"separator":return(d,l,u)=>{const T=typeof l=="string"&&l.includes(r.arrayFormatSeparator),w=typeof l=="string"&&!T&&n(l,r).includes(r.arrayFormatSeparator);l=w?n(l,r):l;const R=T||w?l.split(r.arrayFormatSeparator).map(M=>n(M,r)):l===null?l:n(l,r);u[d]=R};default:return(d,l,u)=>{if(u[d]===void 0){u[d]=l;return}u[d]=[].concat(u[d],l)}}}function o(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function h(r,s){return s.encode?s.strict?m(r):encodeURIComponent(r):r}function n(r,s){return s.decode?p(r):r}function S(r){return Array.isArray(r)?r.sort():typeof r=="object"?S(Object.keys(r)).sort((s,d)=>Number(s)-Number(d)).map(s=>r[s]):r}function P(r){const s=r.indexOf("#");return s!==-1&&(r=r.slice(0,s)),r}function g(r){let s="";const d=r.indexOf("#");return d!==-1&&(s=r.slice(d)),s}function k(r){r=P(r);const s=r.indexOf("?");return s===-1?"":r.slice(s+1)}function c(r,s){return s.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?r=Number(r):s.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")&&(r=r.toLowerCase()==="true"),r}function f(r,s){s=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},s),o(s.arrayFormatSeparator);const d=i(s),l=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return l;for(const u of r.split("&")){if(u==="")continue;let[T,w]=v(s.decode?u.replace(/\+/g," "):u,"=");w=w===void 0?null:["comma","separator"].includes(s.arrayFormat)?w:n(w,s),d(n(T,s),w,l)}for(const u of Object.keys(l)){const T=l[u];if(typeof T=="object"&&T!==null)for(const w of Object.keys(T))T[w]=c(T[w],s);else l[u]=c(T,s)}return s.sort===!1?l:(s.sort===!0?Object.keys(l).sort():Object.keys(l).sort(s.sort)).reduce((u,T)=>{const w=l[T];return w&&typeof w=="object"&&!Array.isArray(w)?u[T]=S(w):u[T]=w,u},Object.create(null))}t.extract=k,t.parse=f,t.stringify=(r,s)=>{if(!r)return"";s=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},s),o(s.arrayFormatSeparator);const d=w=>s.skipNull&&x(r[w])||s.skipEmptyString&&r[w]==="",l=a(s),u={};for(const w of Object.keys(r))d(w)||(u[w]=r[w]);const T=Object.keys(u);return s.sort!==!1&&T.sort(s.sort),T.map(w=>{const R=r[w];return R===void 0?"":R===null?h(w,s):Array.isArray(R)?R.reduce(l(w),[]).join("&"):h(w,s)+"="+h(R,s)}).filter(w=>w.length>0).join("&")},t.parseUrl=(r,s)=>{s=Object.assign({decode:!0},s);const[d,l]=v(r,"#");return Object.assign({url:d.split("?")[0]||"",query:f(k(r),s)},s&&s.parseFragmentIdentifier&&l?{fragmentIdentifier:n(l,s)}:{})},t.stringifyUrl=(r,s)=>{s=Object.assign({encode:!0,strict:!0},s);const d=P(r.url).split("?")[0]||"",l=t.extract(r.url),u=t.parse(l,{sort:!1}),T=Object.assign(u,r.query);let w=t.stringify(T,s);w&&(w=`?${w}`);let R=g(r.url);return r.fragmentIdentifier&&(R=`#${h(r.fragmentIdentifier,s)}`),`${d}${w}${R}`},t.pick=(r,s,d)=>{d=Object.assign({parseFragmentIdentifier:!0},d);const{url:l,query:u,fragmentIdentifier:T}=t.parseUrl(r,d);return t.stringifyUrl({url:l,query:C(u,s),fragmentIdentifier:T},d)},t.exclude=(r,s,d)=>{const l=Array.isArray(s)?u=>!s.includes(u):(u,T)=>!s(u,T);return t.pick(r,l,d)}}(Ee)),Ee}var Oe=bs();const de=fr,Cs={parseNumbers:!1,parseBooleans:!1},js={skipNull:!1,skipEmptyString:!1},Ss=(t,m)=>{var p,v;const{navigateMode:C="push",parseOptions:x,stringifyOptions:a}={},i=Object.assign(Object.assign({},Cs),x),o=Object.assign(Object.assign({},js),a),h=de.useLocation(),n=(p=de.useHistory)===null||p===void 0?void 0:p.call(de),S=(v=de.useNavigate)===null||v===void 0?void 0:v.call(de),P=ss(),g=y.useRef(typeof t=="function"?t():t||{}),k=y.useMemo(()=>Oe.parse(h.search,i),[h.search]),c=y.useMemo(()=>Object.assign(Object.assign({},g.current),k),[k]);return[c,Ye(r=>{const s=typeof r=="function"?r(c):r;P(),n&&n[C]({hash:h.hash,search:Oe.stringify(Object.assign(Object.assign({},k),s),o)||"?"},h.state),S&&S({hash:h.hash,search:Oe.stringify(Object.assign(Object.assign({},k),s),o)||"?"},{replace:C==="replace",state:h.state})})]};var Ne,xt;function ws(){if(xt)return Ne;xt=1;const t=ls(),m=Qe(),{fromSecretKey:p,WalletType:v}=At(),{isHexStrict:C,toHex:x,toBuffer:a,stripHexPrefix:i}=$r(),{types:o}=m;return Ne={fromAppDid:(n,S,P={role:o.RoleType.ROLE_ACCOUNT},g=0)=>{if(!S)throw new Error("Cannot get user wallet with empty root sk");const k=m.Hasher.SHA3.hash256(a(n)),c=i(k).slice(0,16),f=c.slice(0,8),r=c.slice(8,16),s=parseInt(+`0x${f}`,10)&2147483647,d=parseInt(+`0x${r}`,10)&2147483647,l=i(C(S)?S:x(S)),u=t.fromMasterSeed(qe.from(l,"hex")),T=`m/44'/260'/${s}'/${d}'/${g}`,w=u.derive(T),R=v(P),{pk:M=o.KeyType.ED25519}=R;let F;return M===o.KeyType.ED25519?F=m.Signer.Ed25519.genKeyPair("hex",w.privateKey).secretKey:F=x(w.privateKey),M===o.KeyType.ETHEREUM&&(F=F.slice(0,66)),p(F,R)}},Ne}var Ue,yt;function ks(){if(yt)return Ue;yt=1;const t=Qe(),m=At(),p=zr(),v=ws(),C={role:t.types.RoleType.ROLE_APPLICATION};return Ue=(a,i,o,h)=>{let n=o||C;const S=(0,p.isEthereumType)((0,p.DidType)(o));if(S?n=(0,m.WalletType)(o):n=(0,m.WalletType)(C),!(0,p.isValid)(a)){let P="";try{return S?P=a.slice(0,66):P=a,(0,m.fromSecretKey)(P,n)}catch(g){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${g.message}`)}}if(!i)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,v.fromAppDid)(a,i,n,h||0)},Ue}var ue,vt;function Ps(){if(vt)return ue;vt=1;var t=ue&&ue.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};const m=t(Hr),p=Qe(),v=t(ks()),C=Kr();return ue=(a,i,{returnWallet:o=!0}={})=>{if(!a||typeof a!="object"||!Array.isArray(a.environments)||!(0,m.default)(a,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:h,configs:n=[]}=a,S=[...n,...h],P=S.find(N=>N.key==="BLOCKLET_APP_DESCRIPTION"),g=S.find(N=>N.key==="BLOCKLET_PASSPORT_COLOR"),k=S.find(N=>N.key==="BLOCKLET_APP_URL"),c=S.find(N=>N.key==="BLOCKLET_APP_TENANT_MODE"),{did:f,version:r}=a.meta,s=(0,C.getDisplayName)(a),d=(0,m.default)(P,"value",a.meta.description),l=(0,m.default)(g,"value","auto"),u=(0,m.default)(k,"value",""),T=(0,m.default)(c,"value","");if(!o)return{did:f,version:r,name:s,description:d,passportColor:l,appUrl:u,secret:"",wallet:null,permanentWallet:null,tenantMode:T};const w=S.find(N=>N.key==="BLOCKLET_APP_SK"),R=S.find(N=>N.key==="BLOCKLET_APP_CHAIN_TYPE")||S.find(N=>N.key==="BLOCKLET_WALLET_TYPE"),M=S.find(N=>N.key==="BLOCKLET_APP_PSK");let F;R&&(R.value==="ethereum"||R.value==="eth")&&(F=R.value);let W=null,E=null;if(w&&w.value)W=(0,v.default)(w.value,void 0,F),M&&M.value&&M.value!==w.value&&(E=(0,v.default)(M.value,void 0,F));else{if(!i||typeof i!="string")throw new Error("Node secret key must be a string");R?W=(0,v.default)(a.meta.did,i,F):W=(0,v.default)(a.meta.did,i)}const D=a.settings?.session?.salt||"",U=p.Hasher.SHA3.hash256(qe.concat([W.secretKey,W.address,D].filter(Boolean).map(N=>qe.from(N))));return{did:f,version:r,name:s,description:d,passportColor:l,appUrl:u,secret:U,wallet:W,permanentWallet:E||W,tenantMode:T}},ue}var Is=Ps();const Ts=hr(Is);var Es={};function zt({teamDid:t,roles:m=[],apps:p=[],onCancel:v,onSuccess:C,onError:x=()=>{},endpoint:a=""}){const{api:i}=K(),{t:o,locale:h}=Z(),n=ke({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:p.length>0?p[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),S=async()=>{if(!n.role){n.error=o("team.member.error.passportEmpty");return}if(n.passportExpireTime&&He(n.passportExpireTime).isBefore(He())){n.error=o("team.passport.customExpireTimeIsInvalid");return}const f=n.remark.trim();n.error=null,n.loading=!0;try{let r=n.sourceAppPid??null;r===t&&(r=null);const s={teamDid:t,role:n.role,remark:f,sourceAppPid:r,passportExpireTime:n.passportExpireTime?n.passportExpireTime.toISOString():""};n.display&&(s.display={type:"url",content:n.display});const{inviteInfo:d}=await i.createMemberInvitation({input:s});n.inviteInfo=d,n.activeStep=1}catch(r){const s=ee(r);n.error=s,x(r)}finally{n.loading=!1}},P=m.find(f=>f.name===n.role),g=m.filter(f=>f.name!=="owner"),c=[{body:e.jsxs(O,{sx:{display:"flex",flexDirection:"column",gap:3},children:[p.length>1?e.jsxs(Me,{fullWidth:!0,children:[e.jsx(_e,{children:o("common.sourceApp")}),e.jsx(We,{value:n.sourceAppPid,onChange:f=>{n.error=null,n.sourceAppPid=f.target.value},fullWidth:!0,label:o("common.passport"),disabled:n.loading,children:p.map(f=>e.jsx(Ce,{value:f.appPid,children:e.jsxs(O,{sx:{display:"flex",justifyContent:"space-between",gap:2,width:"100%"},children:[e.jsxs(O,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Br,{did:f.appPid,size:28}),f.appName]}),e.jsx(Mr,{did:f.appPid,compact:!0,responsive:!1})]})},f.appPid))})]}):null,e.jsxs(Me,{fullWidth:!0,variant:"outlined",children:[e.jsx(_e,{children:o("common.passport")}),e.jsx(We,{"data-cy":"invite-member-select-role",value:n.role,onChange:f=>{n.error=null,n.role=f.target.value},fullWidth:!0,label:o("common.passport"),disabled:n.loading,onKeyPress:f=>{f.key==="Enter"&&(f.preventDefault(),S())},children:g.map(f=>e.jsx(Ce,{value:f.name,"data-cy":`invite-member-select-option-${f.name}`,children:e.jsxs(O,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(X,{variant:"subtitle1",children:f.title||f.name}),e.jsx(X,{variant:"caption",sx:{opacity:.7},children:f.description})]})},f.name))})]}),P?.extra?.display==="custom"&&e.jsx(pe,{label:o("common.display"),type:"url",value:n.display,onChange:f=>{n.error=null,n.display=f.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(pe,{label:o("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:n.remark,onChange:f=>{n.error=null,n.remark=f.target.value},disabled:n.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Bt,{value:n.passportExpireTime,onChange:f=>{n.error=null,n.passportExpireTime=f},showError:!1})]}),cancel:o("common.cancel"),confirm:o("team.member.inviteDialog.createInviteLink"),onCancel:v,onConfirm:S},{body:()=>{const f=Se({inviteId:n.inviteInfo?.inviteId,endpoint:a});return e.jsxs("div",{children:[e.jsx(O,{sx:{fontSize:16,fontWeight:"bold"},children:o("team.member.inviteDialog.createSuccessTip",{expireDate:he(n.inviteInfo?.expireDate,h)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Pe,{children:f})]})},confirm:o("common.copy"),onConfirm:()=>{const f=Se({inviteId:n.inviteInfo?.inviteId,endpoint:a});if(["1","true"].includes(Es.IS_E2E)){C();return}ns(f),Y.success(o("common.copied")),C()},cancel:o("common.cancel"),onCancel:v}][n.activeStep];return e.jsxs(re,{title:o("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[c.cancel&&e.jsx($,{onClick:c.onCancel,color:"inherit",children:c.cancel}),e.jsxs($,{onClick:c.onConfirm,color:"primary",disabled:n.loading||!n.role,variant:"contained",autoFocus:!0,children:[n.loading&&e.jsx(ae,{size:16}),c.confirm]})]}),children:[e.jsx(Ze,{component:"div",children:typeof c.body=="function"?c.body():c.body}),!!n.error&&e.jsx(ie,{severity:"error",sx:{mt:2},children:n.error})]})}zt.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,roles:b.array,apps:b.array,endpoint:b.string};function Ht({teamDid:t,onCancel:m,onSuccess:p,onError:v=()=>{},endpoint:C=""}){const{api:x,info:a}=K(),{api:i}=y.useContext(Vr),[o,h]=y.useState(!1),{t:n,locale:S}=Z(),[P,g]=y.useState(""),[k,c]=y.useState(!1),[f,r]=y.useState(0),[s,d]=y.useState(""),[l,u]=y.useState(""),T=!!$e(a,"ownerNft.did"),w=cs(async()=>{if(T){const{state:D}=await x.getDelegationState();return D}return{delegated:!0}});if(w.loading)return e.jsx(re,{title:n("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:m,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(ae,{})})});if(w.error)return e.jsx(re,{title:n("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:m,children:e.jsx(ie,{severity:"error",children:ee(w.error)})});const R=async()=>{g(null),h(!0);try{const{inviteInfo:D}=await x.createTransferInvitation({input:{teamDid:t,role:"owner",remark:l.trim()}});d(D),r(W.length-1)}catch(D){const U=ee(D);g(U),v(D)}finally{h(!1)}},M=()=>{c(!0),r(1)},F=()=>{c(!1),r(0)},W=[{body:e.jsxs(X,{component:"div",children:[e.jsxs(ie,{severity:"warning",children:[e.jsx(X,{children:n("team.transferNode.inviteDialog.tips.progress")}),e.jsx(X,{children:n("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(ie,{severity:"warning",children:e.jsx(X,{children:n("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(pe,{label:n("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:l,onChange:D=>{g(null),u(D.target.value)},disabled:o,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:n("common.cancel"),confirm:n("team.transferNode.inviteDialog.createInviteLink"),onCancel:m,onConfirm:T&&!$e(w,"value.delegated")?M:R},{body:()=>e.jsx(Zr,{action:"delegate-transfer-nft",open:k,locale:S,checkFn:i.get,onClose:F,onSuccess:R,checkTimeout:5*60*1e3,webWalletUrl:Qr(a),extraParams:{targetDID:a.did},messages:{title:n("team.transferNode.delegateDialog.title"),scan:n("team.transferNode.delegateDialog.scan"),confirm:n("team.transferNode.delegateDialog.confirm"),success:n("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const D=Se({inviteId:s.inviteId,endpoint:C});return e.jsxs("div",{children:[e.jsx(As,{children:n("team.transferNode.inviteDialog.createSuccessTip",{expireDate:he(s.expireDate,S)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Pe,{children:D})]})},confirm:n("common.confirm"),onConfirm:p}],E=W[f];return e.jsxs(re,{title:n("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[E.cancel&&e.jsx($,{onClick:E.onCancel,color:"inherit",children:E.cancel}),e.jsxs($,{onClick:E.onConfirm,color:"primary",disabled:o,variant:"contained",autoFocus:!0,children:[o&&e.jsx(ae,{size:16}),E.confirm]})]}),children:[e.jsx(Ze,{component:"div",children:typeof E.body=="function"?E.body():E.body}),!!P&&e.jsx(ie,{severity:"error",children:P})]})}Ht.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,endpoint:b.string};const As=z.div`
2
2
  font-size: 16px;
3
3
  font-weight: bold;
4
4
  `;function Ke({passport:t,onDelete:m=null,...p}){return e.jsxs(Ds,{...p,children:[t.title||t.name," ",!!m&&e.jsx(xr,{"data-cy":"delete-issuance",className:"delete",onClick:m})]})}Ke.propTypes={passport:b.object.isRequired,onDelete:b.func};const Ds=z.span`
@@ -1 +1 @@
1
- import{j as e,ak as u,D as C,P as y}from"./vendor-mui-core-CmD-NPnl.js";import{r as c}from"./vendor-react-Dvs43sk9.js";import{aP as j,aQ as w,aR as b,aS as P,aT as A}from"./index-D5Esor4q.js";import{C as m,$ as D}from"./vendor-ux-pYOhjQLA.js";var t=(r=>(r.AvatarOnly="AvatarOnly",r.Detailed="Detailed",r))(t||{}),h=(r=>(r.Minimal="Minimal",r.Basic="Basic",r))(h||{});function R(r){const{user:a,infoType:i,avatarSize:s=48,shouldShowHoverCard:n=!1,renderCardContent:o,...p}=r;return e.jsx(j,{user:a,avatarSize:s,shouldShowHoverCard:n,renderCardContent:o,...p})}function T({...r}){const{user:a,avatarSize:i=40,renderCustomContent:s,infoType:n=h.Minimal,renderFields:o,popupRenderFields:p,...l}=r;return e.jsxs(u,{sx:{display:"flex",flexDirection:"column",width:"100%",flex:1,height:"100%"},children:[e.jsx(w,{user:a,avatarSize:i,...l}),n===h.Basic&&e.jsx(b,{user:a,renderFields:o}),e.jsx(u,{className:"user-card__footer",children:s&&e.jsx(u,{sx:{mt:1.5},children:s()})})]})}function v({...r}){return e.jsx(T,{...r})}function z({children:r,sx:a={}}){const i=C();return e.jsx(u,{sx:m({p:2,backgroundColor:i.palette.background.paper,border:"1px solid",borderColor:"divider",borderRadius:1,maxWidth:500,minWidth:320,display:"flex"},a||null),children:r})}function F({children:r,cardType:a=t.Detailed,variant:i="box",containerRef:s=void 0,sx:n={}}){const o={minWidth:320,p:2,borderRadius:1,...a===t.Detailed?{border:"1px solid",borderColor:"divider"}:{}};return i==="paper"?e.jsx(y,{ref:s,elevation:0,sx:o,children:r}):e.jsx(u,{ref:s,sx:m(o,{display:"flex",alignItems:a===t.AvatarOnly?"center":"flex-start",gap:2},n||null),children:r})}function O(r){const{cardType:a=t.Detailed,showHoverCard:i}=r,s=i!==void 0?i:a===t.AvatarOnly,n=c.useRef(null),[o,p]=c.useState(()=>r.user||null);c.useEffect(()=>{let d=!0;return r.user?p(r.user):r.did&&P(r.did)&&!r.user&&A(r.did).then(x=>{d&&p(x||{fullName:"Anonymous",did:r.did,avatar:""})}),()=>{d=!1}},[r.did,r.user]);const l=c.useMemo(()=>{if(!o)return null;const{avatar:d="",...x}=o;if(d){const S=d.split("?")[1]||"";return{...x,avatar:S?d:`${d}?imageFilter=resize&w=48&h=48`}}return o},[o]);if(!l)return e.jsx(D,{did:r.did,size:r.avatarSize,useProxyFallback:!0,...r.avatarProps});const f=()=>e.jsx(z,{sx:r.popupSx,children:e.jsx(v,{...r,shouldShowHoverCard:!1,user:l,avatarProps:r.popupAvatarProps,shortenLabelProps:r.popupShortenLabelProps||r.shortenLabelProps,renderFields:r.popupRenderFields,renderName:r.popupRenderName,infoType:r.popupInfoType||r.infoType,didProps:r.popupDidProps||r.didProps,showDid:r.popupShowDid||r.showDid,showSocialActions:r.popupShowSocialActions===void 0?r.showSocialActions:r.popupShowSocialActions})});return a===t.AvatarOnly?e.jsx(R,{...r,shouldShowHoverCard:s,renderCardContent:f,user:l}):e.jsx(F,{containerRef:n,cardType:a,sx:r.sx,children:e.jsx(v,{...r,shouldShowHoverCard:s,renderCardContent:f,user:l})})}export{O as B,t as l,h as o};
1
+ import{j as e,ak as u,D as C,P as y}from"./vendor-mui-core-CmD-NPnl.js";import{r as c}from"./vendor-react-Dvs43sk9.js";import{aP as j,aQ as w,aR as b,aS as P,aT as A}from"./index-BJbNz5vx.js";import{C as m,$ as D}from"./vendor-ux-pYOhjQLA.js";var t=(r=>(r.AvatarOnly="AvatarOnly",r.Detailed="Detailed",r))(t||{}),h=(r=>(r.Minimal="Minimal",r.Basic="Basic",r))(h||{});function R(r){const{user:a,infoType:i,avatarSize:s=48,shouldShowHoverCard:n=!1,renderCardContent:o,...p}=r;return e.jsx(j,{user:a,avatarSize:s,shouldShowHoverCard:n,renderCardContent:o,...p})}function T({...r}){const{user:a,avatarSize:i=40,renderCustomContent:s,infoType:n=h.Minimal,renderFields:o,popupRenderFields:p,...l}=r;return e.jsxs(u,{sx:{display:"flex",flexDirection:"column",width:"100%",flex:1,height:"100%"},children:[e.jsx(w,{user:a,avatarSize:i,...l}),n===h.Basic&&e.jsx(b,{user:a,renderFields:o}),e.jsx(u,{className:"user-card__footer",children:s&&e.jsx(u,{sx:{mt:1.5},children:s()})})]})}function v({...r}){return e.jsx(T,{...r})}function z({children:r,sx:a={}}){const i=C();return e.jsx(u,{sx:m({p:2,backgroundColor:i.palette.background.paper,border:"1px solid",borderColor:"divider",borderRadius:1,maxWidth:500,minWidth:320,display:"flex"},a||null),children:r})}function F({children:r,cardType:a=t.Detailed,variant:i="box",containerRef:s=void 0,sx:n={}}){const o={minWidth:320,p:2,borderRadius:1,...a===t.Detailed?{border:"1px solid",borderColor:"divider"}:{}};return i==="paper"?e.jsx(y,{ref:s,elevation:0,sx:o,children:r}):e.jsx(u,{ref:s,sx:m(o,{display:"flex",alignItems:a===t.AvatarOnly?"center":"flex-start",gap:2},n||null),children:r})}function O(r){const{cardType:a=t.Detailed,showHoverCard:i}=r,s=i!==void 0?i:a===t.AvatarOnly,n=c.useRef(null),[o,p]=c.useState(()=>r.user||null);c.useEffect(()=>{let d=!0;return r.user?p(r.user):r.did&&P(r.did)&&!r.user&&A(r.did).then(x=>{d&&p(x||{fullName:"Anonymous",did:r.did,avatar:""})}),()=>{d=!1}},[r.did,r.user]);const l=c.useMemo(()=>{if(!o)return null;const{avatar:d="",...x}=o;if(d){const S=d.split("?")[1]||"";return{...x,avatar:S?d:`${d}?imageFilter=resize&w=48&h=48`}}return o},[o]);if(!l)return e.jsx(D,{did:r.did,size:r.avatarSize,useProxyFallback:!0,...r.avatarProps});const f=()=>e.jsx(z,{sx:r.popupSx,children:e.jsx(v,{...r,shouldShowHoverCard:!1,user:l,avatarProps:r.popupAvatarProps,shortenLabelProps:r.popupShortenLabelProps||r.shortenLabelProps,renderFields:r.popupRenderFields,renderName:r.popupRenderName,infoType:r.popupInfoType||r.infoType,didProps:r.popupDidProps||r.didProps,showDid:r.popupShowDid||r.showDid,showSocialActions:r.popupShowSocialActions===void 0?r.showSocialActions:r.popupShowSocialActions})});return a===t.AvatarOnly?e.jsx(R,{...r,shouldShowHoverCard:s,renderCardContent:f,user:l}):e.jsx(F,{containerRef:n,cardType:a,sx:r.sx,children:e.jsx(v,{...r,shouldShowHoverCard:s,renderCardContent:f,user:l})})}export{O as B,t as l,h as o};
@@ -1,4 +1,4 @@
1
- import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k as re}from"./vendor-hooks-DLNZ8kxG.js";import{j as e,ak as g,at as q,b1 as ee,a6 as M,aX as _e,am as Y,cs as ft,U as xt,T as E,a3 as ht,W as T,z as $,M as ae,I as W,cC as $e,cf as me,A as gt,x as Oe,c2 as We,c3 as X,bv as qe,F as He,bC as yt,b6 as jt,a5 as vt,J as Ct,Q as bt,bb as St,s as Tt}from"./vendor-mui-core-CmD-NPnl.js";import{T as F,F as H,L as wt,ac as fe,a6 as le,H as R,D as L,O as xe,aa as Ue,al as Dt,E as Ie,a9 as It,ai as Pt}from"./vendor-ux-pYOhjQLA.js";import{Z as k,p as Rt,ap as Ge,c as U,B as J,a8 as kt,aK as At,f as Ft,X as Nt,ar as se,be as Ve,bf as Lt,bi as Ke}from"./index-D5Esor4q.js";import{W as he}from"./did-address-CNnw4_bl.js";import{u as _}from"./team-CGGZIbfh.js";import{r as ge,a as ye,b as je,c as Ye,d as ne,e as Bt,u as zt,f as Et}from"./passport-item-CtgFdOsh.js";import{p as Ze}from"./util-CYsTlK2W.js";import{u as Mt}from"./use-mobile-D93Bk2Ru.js";import{v as Q}from"./index-Ck6n4b0a.js";import{w as G,P as Je}from"./permission-DO4jN8xJ.js";import{C as _t}from"./Google-CZPwmMCG.js";import{A as $t}from"./vendor-arcblock-DEa0A9MF.js";import{G as Z,$ as Ot,H as Wt}from"./vendor-utils-DQK0pEML.js";import{e as oe}from"./edit.svg-DycWG9v3.js";import{C as ve}from"./confirm-DUjUXcfn.js";import{L as Qe}from"./list-header-CoFZp82R.js";import{f as te}from"./index-DBs9Ljax.js";import{u as qt}from"./useSetState-DFuQZPPV.js";import{C as Ht}from"./lock.svg-COUP8tyO.js";import"./lottie-web-4koyQiv_.js";import"./session-DGB-yOme.js";import"./isURL-DZGsNcmL.js";import"./use-app-logo-DxlfjGOQ.js";import"./index-DDpL_qpY.js";import"./base32-9HlsUoU3.js";import"./cloneDeep-sSKmkjV3.js";const ie=u=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...u},C.createElement("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"})),Pe="info";function Xe({createPassportSvg:u,passport:o,onCancel:i,onSwitchPassport:p=()=>{}}){const{t:m}=F(),l=mt({tab:Pe}),h={info:{label:m("common.basicInfo"),value:Pe,component:()=>e.jsx(et,{passport:o,createPassportSvg:u})},logs:{label:m("common.logs"),value:"logs",component:()=>e.jsx(rt,{passport:o})},related:{label:m("team.passport.related"),value:"related",component:()=>e.jsx(at,{passport:o,onSwitchPassport:p})}},a=Object.values(h).map(({label:r,value:t})=>({label:r,value:t})).filter(r=>r.value==="related"?o.parentDid:!0),f=h[l.tab]||h.info,s=r=>{l.tab=r};return e.jsx(H,{title:m("common.passport"),onClose:i,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Ut,{children:[e.jsx(g,{className:"tabs",children:e.jsx(wt,{tabs:a,current:l.tab,onChange:s,scrollButtons:"auto"})}),e.jsx(g,{className:"body",children:e.jsx(f.component,{})})]})})}Xe.propTypes={createPassportSvg:T.func.isRequired,passport:T.object.isRequired,onCancel:T.func.isRequired,onSwitchPassport:T.func};const Ut=q(g)`
1
+ import{r as C,g as Me,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k as re}from"./vendor-hooks-DLNZ8kxG.js";import{j as e,ak as g,at as q,b1 as ee,a6 as M,aX as _e,am as Y,cs as ft,U as xt,T as E,a3 as ht,W as T,z as $,M as ae,I as W,cC as $e,cf as me,A as gt,x as Oe,c2 as We,c3 as X,bv as qe,F as He,bC as yt,b6 as jt,a5 as vt,J as Ct,Q as bt,bb as St,s as Tt}from"./vendor-mui-core-CmD-NPnl.js";import{T as F,F as H,L as wt,ac as fe,a6 as le,H as R,D as L,O as xe,aa as Ue,al as Dt,E as Ie,a9 as It,ai as Pt}from"./vendor-ux-pYOhjQLA.js";import{Z as k,p as Rt,ap as Ge,c as U,B as J,a8 as kt,aK as At,f as Ft,X as Nt,ar as se,be as Ve,bf as Lt,bi as Ke}from"./index-BJbNz5vx.js";import{W as he}from"./did-address-CNnw4_bl.js";import{u as _}from"./team-B-jk7E5_.js";import{r as ge,a as ye,b as je,c as Ye,d as ne,e as Bt,u as zt,f as Et}from"./passport-item-CK1Zj4rm.js";import{p as Ze}from"./util-Bravn321.js";import{u as Mt}from"./use-mobile-D93Bk2Ru.js";import{v as Q}from"./index-Ck6n4b0a.js";import{w as G,P as Je}from"./permission-CSIyJtvw.js";import{C as _t}from"./Google-CZPwmMCG.js";import{A as $t}from"./vendor-arcblock-DEa0A9MF.js";import{G as Z,$ as Ot,H as Wt}from"./vendor-utils-DQK0pEML.js";import{e as oe}from"./edit.svg-DycWG9v3.js";import{C as ve}from"./confirm-BbY8YGyk.js";import{L as Qe}from"./list-header-CoFZp82R.js";import{f as te}from"./index-DBs9Ljax.js";import{u as qt}from"./useSetState-DFuQZPPV.js";import{C as Ht}from"./lock.svg-COUP8tyO.js";import"./lottie-web-4koyQiv_.js";import"./session-m3orzHBa.js";import"./isURL-CCV0esLR.js";import"./use-app-logo-D_gO-Dio.js";import"./index-uH_9YgA0.js";import"./base32-dGIGRTeZ.js";import"./cloneDeep-sSKmkjV3.js";const ie=u=>C.createElement("svg",{width:24,height:24,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",...u},C.createElement("path",{d:"M8.4375 4.3125H8.25C8.35313 4.3125 8.4375 4.22812 8.4375 4.125V4.3125H15.5625V4.125C15.5625 4.22812 15.6469 4.3125 15.75 4.3125H15.5625V6H17.25V4.125C17.25 3.29766 16.5773 2.625 15.75 2.625H8.25C7.42266 2.625 6.75 3.29766 6.75 4.125V6H8.4375V4.3125ZM20.25 6H3.75C3.33516 6 3 6.33516 3 6.75V7.5C3 7.60313 3.08437 7.6875 3.1875 7.6875H4.60312L5.18203 19.9453C5.21953 20.7445 5.88047 21.375 6.67969 21.375H17.3203C18.1219 21.375 18.7805 20.7469 18.818 19.9453L19.3969 7.6875H20.8125C20.9156 7.6875 21 7.60313 21 7.5V6.75C21 6.33516 20.6648 6 20.25 6ZM17.1398 19.6875H6.86016L6.29297 7.6875H17.707L17.1398 19.6875Z"})),Pe="info";function Xe({createPassportSvg:u,passport:o,onCancel:i,onSwitchPassport:p=()=>{}}){const{t:m}=F(),l=mt({tab:Pe}),h={info:{label:m("common.basicInfo"),value:Pe,component:()=>e.jsx(et,{passport:o,createPassportSvg:u})},logs:{label:m("common.logs"),value:"logs",component:()=>e.jsx(rt,{passport:o})},related:{label:m("team.passport.related"),value:"related",component:()=>e.jsx(at,{passport:o,onSwitchPassport:p})}},a=Object.values(h).map(({label:r,value:t})=>({label:r,value:t})).filter(r=>r.value==="related"?o.parentDid:!0),f=h[l.tab]||h.info,s=r=>{l.tab=r};return e.jsx(H,{title:m("common.passport"),onClose:i,open:!0,PaperProps:{style:{maxWidth:800,minHeight:"80vh"}},fullWidth:!0,children:e.jsxs(Ut,{children:[e.jsx(g,{className:"tabs",children:e.jsx(wt,{tabs:a,current:l.tab,onChange:s,scrollButtons:"auto"})}),e.jsx(g,{className:"body",children:e.jsx(f.component,{})})]})})}Xe.propTypes={createPassportSvg:T.func.isRequired,passport:T.object.isRequired,onCancel:T.func.isRequired,onSwitchPassport:T.func};const Ut=q(g)`
2
2
  margin-top: -16px;
3
3
 
4
4
  .tabs {
@@ -1,4 +1,4 @@
1
- import{j as i,ca as N,at as x,W as t,ak as h,b0 as I,a6 as S,s as E}from"./vendor-mui-core-CmD-NPnl.js";import{g as z,h as Z,b as w,k as $}from"./vendor-hooks-DLNZ8kxG.js";import{ap as T,T as D,c as A,aU as U,aV as j,aW as L,t as q}from"./index-D5Esor4q.js";import{r as s}from"./vendor-react-Dvs43sk9.js";import{G as F,F as W,D as O,T as _,$ as B}from"./vendor-ux-pYOhjQLA.js";import{N as Y}from"./index-BVZj6aBL.js";import{C as G}from"./vendor-utils-DQK0pEML.js";import{u as J}from"./use-passport-id-B-b-_oYF.js";import{u as K}from"./session-DGB-yOme.js";import{b as X}from"./sdk-C9i2DDEJ.js";import{w as Q}from"./wrap-locale-DU2DJaEg.js";function H({invitation:e,createPassportSvg:a,passportColor:p="auto"}){const[d,o]=s.useState(!1),{t:r}=s.useContext(F),l=s.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),C=s.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||p,extra:e.passportExpireTime?{key:"Exp",value:T(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,l]),u=s.useCallback(()=>{o(!0)},[]),c=s.useCallback(()=>{o(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(e2,{children:i.jsxs("div",{className:"invite-passport__card",onClick:u,children:[!!e.display&&i.jsx(Y,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&i.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:C}})]})}),i.jsx(W,{open:d,title:r("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:c,children:e.role.permissions&&e.role.permissions.length>0?i.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(n=>i.jsx("li",{style:{listStyle:"circle"},children:n.description},n.name))}):i.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[i.jsx(N,{style:{width:"30px",height:"30px"}}),i.jsx("div",{children:r("invite.emptyPermission")})]})})]})}H.propTypes={invitation:t.object.isRequired,createPassportSvg:t.func.isRequired,passportColor:t.string};const e2=x.div`
1
+ import{j as i,ca as N,at as x,W as t,ak as h,b0 as I,a6 as S,s as E}from"./vendor-mui-core-CmD-NPnl.js";import{g as z,h as Z,b as w,k as $}from"./vendor-hooks-DLNZ8kxG.js";import{ap as T,T as D,c as A,aU as U,aV as j,aW as L,t as q}from"./index-BJbNz5vx.js";import{r as s}from"./vendor-react-Dvs43sk9.js";import{G as F,F as W,D as O,T as _,$ as B}from"./vendor-ux-pYOhjQLA.js";import{N as Y}from"./index-DS-40ZVK.js";import{C as G}from"./vendor-utils-DQK0pEML.js";import{u as J}from"./use-passport-id-B-b-_oYF.js";import{u as K}from"./session-m3orzHBa.js";import{b as X}from"./sdk-B4j47QQf.js";import{w as Q}from"./wrap-locale-B5OsZl6Q.js";function H({invitation:e,createPassportSvg:a,passportColor:p="auto"}){const[d,o]=s.useState(!1),{t:r}=s.useContext(F),l=s.useMemo(()=>(e.role.title||e.role.name).toUpperCase(),[e.role.title,e.role.name]),C=s.useMemo(()=>a({title:l,issuer:e.info.name,issuerDid:e.info.appDid,ownerName:"Your Name",ownerDid:e.info.appDid,preferredColor:e.info.passportColor||p,extra:e.passportExpireTime?{key:"Exp",value:T(e.passportExpireTime).format("YYYY-MM-DD HH:mm:ss")}:void 0}),[e,l]),u=s.useCallback(()=>{o(!0)},[]),c=s.useCallback(()=>{o(!1)},[]);return i.jsxs(i.Fragment,{children:[i.jsx(e2,{children:i.jsxs("div",{className:"invite-passport__card",onClick:u,children:[!!e.display&&i.jsx(Y,{data:e.display,style:{width:"100%",height:"100%"}}),!e.display&&i.jsx("div",{className:"invite-passport__cover",dangerouslySetInnerHTML:{__html:C}})]})}),i.jsx(W,{open:d,title:r("invite.viewPermission"),PaperProps:{style:{minHeight:"auto",paddingBottom:"20px"}},onClose:c,children:e.role.permissions&&e.role.permissions.length>0?i.jsx("ul",{style:{listStyle:"circle",padding:"0 20px"},children:e.role.permissions.map(n=>i.jsx("li",{style:{listStyle:"circle"},children:n.description},n.name))}):i.jsxs("div",{style:{color:"#999",textAlign:"center"},children:[i.jsx(N,{style:{width:"30px",height:"30px"}}),i.jsx("div",{children:r("invite.emptyPermission")})]})})]})}H.propTypes={invitation:t.object.isRequired,createPassportSvg:t.func.isRequired,passportColor:t.string};const e2=x.div`
2
2
  display: flex;
3
3
  max-width: 350px;
4
4
  margin: 30px auto;
@@ -1 +1 @@
1
- import{j as i,ak as l}from"./vendor-mui-core-CmD-NPnl.js";import{i as x,r as w}from"./vendor-react-Dvs43sk9.js";import{b as g}from"./vendor-hooks-DLNZ8kxG.js";import{I as v}from"./invitation-xW_qcQrB.js";import{K as u}from"./landing-page-RSi1tJUt.js";import{T as I,B as k}from"./vendor-ux-pYOhjQLA.js";import{a as S,e as T,s as E,b as j,c as P,H as R,d as W}from"./index-D5Esor4q.js";import{g as b}from"./get-safe-url-PVZ8sNva.js";import"./vendor-utils-DQK0pEML.js";import"./index-BVZj6aBL.js";import"./use-passport-id-B-b-_oYF.js";import"./session-DGB-yOme.js";import"./sdk-C9i2DDEJ.js";import"./wrap-locale-DU2DJaEg.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DEa0A9MF.js";function X(n){const c=x(),{searchParams:s}=new URL(window.location.href),{api:p,session:m}=S(),{t:d}=I(),a=s.get("inviteId"),r=s.get("redirect"),f=w.useCallback(async()=>{const{data:t}=await T.get("invitation",{params:{inviteId:a}});return t},[a]),h=g(async(t,o=e=>e)=>{t&&(E(o(t.sessionToken)),j(o(t.refreshToken)),t.visitorId&&k(o(t.visitorId))),await m.refresh(),setTimeout(()=>{if(r){const e=decodeURIComponent(r);e.startsWith(P.WELLKNOWN_SERVICE_PATH_PREFIX)?c(e,{replace:!0}):window.location.href=b(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(u,{did:window.blocklet?.appPid,children:[i.jsx(R,{children:i.jsxs("title",{children:[d("pageTitle.invite")," | ",window.blocklet?.appName]})}),i.jsx(l,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(v,{...n,getDataFn:f,checkFn:p.get,createPassportSvg:t=>W({...t}),onLoginSuccess:h,inService:!0})})]})}export{X as default};
1
+ import{j as i,ak as l}from"./vendor-mui-core-CmD-NPnl.js";import{i as x,r as w}from"./vendor-react-Dvs43sk9.js";import{b as g}from"./vendor-hooks-DLNZ8kxG.js";import{I as v}from"./invitation-GzoS6QSS.js";import{K as u}from"./landing-page-CL9L_8lE.js";import{T as I,B as k}from"./vendor-ux-pYOhjQLA.js";import{a as S,e as T,s as E,b as j,c as P,H as R,d as W}from"./index-BJbNz5vx.js";import{g as b}from"./get-safe-url-DKg8JLr1.js";import"./vendor-utils-DQK0pEML.js";import"./index-DS-40ZVK.js";import"./use-passport-id-B-b-_oYF.js";import"./session-m3orzHBa.js";import"./sdk-B4j47QQf.js";import"./wrap-locale-B5OsZl6Q.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DEa0A9MF.js";function X(n){const c=x(),{searchParams:s}=new URL(window.location.href),{api:p,session:m}=S(),{t:d}=I(),a=s.get("inviteId"),r=s.get("redirect"),f=w.useCallback(async()=>{const{data:t}=await T.get("invitation",{params:{inviteId:a}});return t},[a]),h=g(async(t,o=e=>e)=>{t&&(E(o(t.sessionToken)),j(o(t.refreshToken)),t.visitorId&&k(o(t.visitorId))),await m.refresh(),setTimeout(()=>{if(r){const e=decodeURIComponent(r);e.startsWith(P.WELLKNOWN_SERVICE_PATH_PREFIX)?c(e,{replace:!0}):window.location.href=b(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return i.jsxs(u,{did:window.blocklet?.appPid,children:[i.jsx(R,{children:i.jsxs("title",{children:[d("pageTitle.invite")," | ",window.blocklet?.appName]})}),i.jsx(l,{sx:{width:"560px",maxWidth:"100%",height:"100%"},className:"page-invite",children:i.jsx(v,{...n,getDataFn:f,checkFn:p.get,createPassportSvg:t=>W({...t}),onLoginSuccess:h,inService:!0})})]})}export{X as default};
@@ -1,2 +1,2 @@
1
- import{g as F}from"./vendor-react-Dvs43sk9.js";import{aF as H,aG as P,aH as E,aI as $,aJ as N}from"./index-D5Esor4q.js";var h={exports:{}},p={exports:{}},I;function Q(){return I||(I=1,function(c,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var v=function(d,y){return d.indexOf(y)!==-1};n.default=v,c.exports=n.default,c.exports.default=n.default}(p,p.exports)),p.exports}var A;function G(){return A||(A=1,function(c,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=T;var v=o(H()),g=o(E()),d=o(Q()),y=o(N()),w=o($()),S=o(P());function o(e){return e&&e.__esModule?e:{default:e}}function R(e,r){return U(e)||O(e,r)||L(e,r)||j()}function j(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
1
+ import{g as F}from"./vendor-react-Dvs43sk9.js";import{aF as H,aG as P,aH as E,aI as $,aJ as N}from"./index-BJbNz5vx.js";var h={exports:{}},p={exports:{}},I;function Q(){return I||(I=1,function(c,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var v=function(d,y){return d.indexOf(y)!==-1};n.default=v,c.exports=n.default,c.exports.default=n.default}(p,p.exports)),p.exports}var A;function G(){return A||(A=1,function(c,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=T;var v=o(H()),g=o(E()),d=o(Q()),y=o(N()),w=o($()),S=o(P());function o(e){return e&&e.__esModule?e:{default:e}}function R(e,r){return U(e)||O(e,r)||L(e,r)||j()}function j(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
2
2
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function L(e,r){if(e){if(typeof e=="string")return b(e,r);var l={}.toString.call(e).slice(8,-1);return l==="Object"&&e.constructor&&(l=e.constructor.name),l==="Map"||l==="Set"?Array.from(e):l==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(l)?b(e,r):void 0}}function b(e,r){(r==null||r>e.length)&&(r=e.length);for(var l=0,u=Array(r);l<r;l++)u[l]=e[l];return u}function O(e,r){var l=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(l!=null){var u,a,_,s,i=[],t=!0,f=!1;try{if(_=(l=l.call(e)).next,r!==0)for(;!(t=(u=_.call(l)).done)&&(i.push(u.value),i.length!==r);t=!0);}catch(m){f=!0,a=m}finally{try{if(!t&&l.return!=null&&(s=l.return(),Object(s)!==s))return}finally{if(f)throw a}}return i}}function U(e){if(Array.isArray(e))return e}var k={protocols:["http","https","ftp"],require_tld:!0,require_protocol:!1,require_host:!0,require_port:!1,require_valid_protocol:!0,allow_underscores:!1,allow_trailing_dot:!1,allow_protocol_relative_urls:!1,allow_fragments:!0,allow_query_components:!0,validate_length:!0,max_allowed_length:2084},M=/^\[([^\]]+)\](?::([0-9]+))?$/;function T(e,r){if((0,v.default)(e),!e||/[\s<>]/.test(e)||e.indexOf("mailto:")===0||(r=(0,S.default)(r,k),r.validate_length&&e.length>r.max_allowed_length)||!r.allow_fragments&&(0,d.default)(e,"#")||!r.allow_query_components&&((0,d.default)(e,"?")||(0,d.default)(e,"&")))return!1;var l,u,a,_,s,i,t,f;if(t=e.split("#"),e=t.shift(),t=e.split("?"),e=t.shift(),t=e.split("://"),t.length>1){if(l=t.shift().toLowerCase(),r.require_valid_protocol&&r.protocols.indexOf(l)===-1)return!1}else{if(r.require_protocol)return!1;if(e.slice(0,2)==="//"){if(!r.allow_protocol_relative_urls)return!1;t[0]=e.slice(2)}}if(e=t.join("://"),e==="")return!1;if(t=e.split("/"),e=t.shift(),e===""&&!r.require_host)return!0;if(t=e.split("@"),t.length>1){if(r.disallow_auth||t[0]===""||(u=t.shift(),u.indexOf(":")>=0&&u.split(":").length>2))return!1;var m=u.split(":"),x=R(m,2),C=x[0],D=x[1];if(C===""&&D==="")return!1}_=t.join("@"),i=null,f=null;var q=_.match(M);if(q?(a="",f=q[1],i=q[2]||null):(t=_.split(":"),a=t.shift(),t.length&&(i=t.join(":"))),i!==null&&i.length>0){if(s=parseInt(i,10),!/^[0-9]+$/.test(i)||s<=0||s>65535)return!1}else if(r.require_port)return!1;return r.host_whitelist?(0,g.default)(a,r.host_whitelist):a===""&&!r.require_host?!0:!(!(0,w.default)(a)&&!(0,y.default)(a,r)&&(!f||!(0,w.default)(f,6))||(a=a||f,r.host_blacklist&&(0,g.default)(a,r.host_blacklist)))}c.exports=n.default,c.exports.default=n.default}(h,h.exports)),h.exports}var J=G();const B=F(J);export{B as i};
@@ -1 +1 @@
1
- import{j as s,a6 as w,ak as x}from"./vendor-mui-core-CmD-NPnl.js";import{g as v,k,b as p}from"./vendor-hooks-DLNZ8kxG.js";import{I as T}from"./invitation-xW_qcQrB.js";import{K as I}from"./landing-page-RSi1tJUt.js";import{T as P,B as j}from"./vendor-ux-pYOhjQLA.js";import{a as R,s as S,b as E,c as N,H as W,d as b}from"./index-D5Esor4q.js";import{g as C}from"./get-safe-url-PVZ8sNva.js";import{i as F}from"./vendor-react-Dvs43sk9.js";import"./vendor-utils-DQK0pEML.js";import"./index-BVZj6aBL.js";import"./use-passport-id-B-b-_oYF.js";import"./session-DGB-yOme.js";import"./sdk-C9i2DDEJ.js";import"./wrap-locale-DU2DJaEg.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DEa0A9MF.js";function J(m){const{searchParams:r}=new URL(window.location.href),{api:a,session:d}=R(),f=F(),{t:h}=P(),n=r.get("id"),c=r.get("redirect"),u=v({state:""}),o=k(async()=>{if(!n)return null;const{data:t}=await a.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),l=p(()=>{if(o.error)throw o.error;return o?.data}),g=p(async(t,i=e=>e)=>{t&&(t.sessionToken&&S(i(t.sessionToken)),t.refreshToken&&E(i(t.refreshToken)),t.visitorId&&j(i(t.visitorId)),await d.refresh()),setTimeout(()=>{if(c){const e=decodeURIComponent(c);e.startsWith(N.WELLKNOWN_SERVICE_PATH_PREFIX)?f(e,{replace:!0}):window.location.href=C(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return o.loading?s.jsx(w,{}):s.jsxs(I,{did:window.blocklet?.appPid,children:[s.jsx(W,{children:s.jsxs("title",{children:[h("pageTitle.issuePassport")," | ",window.blocklet?.appName]})}),s.jsx(x,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:s.jsx(T,{...m,action:"issue-passport",getDataFn:l,checkFn:a.get,createPassportSvg:b,onLoginSuccess:g,inService:!0,status:u.state})})]})}export{J as default};
1
+ import{j as s,a6 as w,ak as x}from"./vendor-mui-core-CmD-NPnl.js";import{g as v,k,b as p}from"./vendor-hooks-DLNZ8kxG.js";import{I as T}from"./invitation-GzoS6QSS.js";import{K as I}from"./landing-page-CL9L_8lE.js";import{T as P,B as j}from"./vendor-ux-pYOhjQLA.js";import{a as R,s as S,b as E,c as N,H as W,d as b}from"./index-BJbNz5vx.js";import{g as C}from"./get-safe-url-DKg8JLr1.js";import{i as F}from"./vendor-react-Dvs43sk9.js";import"./vendor-utils-DQK0pEML.js";import"./index-DS-40ZVK.js";import"./use-passport-id-B-b-_oYF.js";import"./session-m3orzHBa.js";import"./sdk-B4j47QQf.js";import"./wrap-locale-B5OsZl6Q.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DEa0A9MF.js";function J(m){const{searchParams:r}=new URL(window.location.href),{api:a,session:d}=R(),f=F(),{t:h}=P(),n=r.get("id"),c=r.get("redirect"),u=v({state:""}),o=k(async()=>{if(!n)return null;const{data:t}=await a.get("/api/invitation",{params:{inviteId:n,mode:"issue-passport"}});return t}),l=p(()=>{if(o.error)throw o.error;return o?.data}),g=p(async(t,i=e=>e)=>{t&&(t.sessionToken&&S(i(t.sessionToken)),t.refreshToken&&E(i(t.refreshToken)),t.visitorId&&j(i(t.visitorId)),await d.refresh()),setTimeout(()=>{if(c){const e=decodeURIComponent(c);e.startsWith(N.WELLKNOWN_SERVICE_PATH_PREFIX)?f(e,{replace:!0}):window.location.href=C(e)}else window.location.href=window.env.pathPrefix||"/"},50)});return o.loading?s.jsx(w,{}):s.jsxs(I,{did:window.blocklet?.appPid,children:[s.jsx(W,{children:s.jsxs("title",{children:[h("pageTitle.issuePassport")," | ",window.blocklet?.appName]})}),s.jsx(x,{className:"page-invite",sx:{width:"560px",maxWidth:"100%",height:"100%"},children:s.jsx(T,{...m,action:"issue-passport",getDataFn:l,checkFn:a.get,createPassportSvg:b,onLoginSuccess:g,inService:!0,status:u.state})})]})}export{J as default};