@abtnode/blocklet-services 1.16.47-beta-20250729-133234-77359596 → 1.16.47-beta-20250730-070104-87a128a5
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.
- package/api/libs/auth/adapters/twitter.js +1 -1
- package/api/routes/oauth/client.js +9 -2
- package/dist/assets/{access-control-DYSDECUw.js → access-control-FYs8JoGO.js} +1 -1
- package/dist/assets/{add-component-core-ofLBd0tu.js → add-component-core-BB6rCC8n.js} +1 -1
- package/dist/assets/{add-resource-BJEI6PbV.js → add-resource-BlKrIrw0.js} +1 -1
- package/dist/assets/{addon-yoa0x6-0.js → addon-g3Lz4kfk.js} +1 -1
- package/dist/assets/{advanced-C40fcsMj.js → advanced-DyVpf_DB.js} +1 -1
- package/dist/assets/{aigne-CO_-YbPk.js → aigne-B2kmHT_s.js} +1 -1
- package/dist/assets/{appearance-ChoNlV7r.js → appearance-D0WJqn3Y.js} +1 -1
- package/dist/assets/{arrow-down.svg-CW9W9wI1.js → arrow-down.svg-CH8Xzna_.js} +1 -1
- package/dist/assets/{audit-logs-DjxskWcd.js → audit-logs-BLZ_FXya.js} +1 -1
- package/dist/assets/{authorize-u1RPtGlb.js → authorize-DqbV7Yj5.js} +1 -1
- package/dist/assets/{branding-Da8E_HdC.js → branding-B_9Ik1Ul.js} +1 -1
- package/dist/assets/{branding-M86FUBw6.js → branding-CbIhan7S.js} +2 -2
- package/dist/assets/{bundle-avatar-JsO8Rdzw.js → bundle-avatar-DzIGEDbC.js} +1 -1
- package/dist/assets/{complete-D_rU8GhU.js → complete-Cx5YFdNr.js} +1 -1
- package/dist/assets/{component-CYmSwtxC.js → component-99-uAXc0.js} +3 -3
- package/dist/assets/{config-Bel7KIi4.js → config-B4lheVsX.js} +1 -1
- package/dist/assets/{config-BICnV2kA.js → config-Dr0r0k-g.js} +1 -1
- package/dist/assets/{config-navigation-D8OXRCt9.js → config-navigation-ToPhdOjg.js} +3 -3
- package/dist/assets/{config-space-ODrN5Rt0.js → config-space-CT21iR_2.js} +1 -1
- package/dist/assets/config-yxcrU66X.js +26 -0
- package/dist/assets/{confirm-CXK9v894.js → confirm-5e46DDlz.js} +1 -1
- package/dist/assets/{connect-yrGsuleV.js → connect-BHDDk939.js} +1 -1
- package/dist/assets/{connect-ig-5oJbW.js → connect-hooMfIaO.js} +1 -1
- package/dist/assets/{connect-to-BpYFEl7i.js → connect-to-DfxSuVNx.js} +1 -1
- package/dist/assets/{dashboard-VE3KX6Hk.js → dashboard-DaKd1daE.js} +3 -3
- package/dist/assets/{delete-confirm-CpZStjie.js → delete-confirm-Bim07gVu.js} +1 -1
- package/dist/assets/{domain-DbJ3kJI3.js → domain-D_RRXHNv.js} +1 -1
- package/dist/assets/{domain-action-card-2vqk_Ni_.js → domain-action-card-BTosQrln.js} +1 -1
- package/dist/assets/{domains-BsCL1ViY.js → domains-BV1O_rDN.js} +1 -1
- package/dist/assets/{email-D_7GvtZA.js → email-BCDbiSlJ.js} +1 -1
- package/dist/assets/engine-BVHpout7.js +1 -0
- package/dist/assets/{exchange-passport-BGTYcBca.js → exchange-passport-DIp9EJVY.js} +1 -1
- package/dist/assets/{form-CjYT8hk5.js → form-BVnHvgNl.js} +1 -1
- package/dist/assets/{fuel-CBt1g8zp.js → fuel-Fh-ifxfq.js} +1 -1
- package/dist/assets/{gen-access-key-DPNQGDvj.js → gen-access-key-BZufQ91-.js} +1 -1
- package/dist/assets/{gen-simple-access-key-Ctn_w0mo.js → gen-simple-access-key-DlPE_0y2.js} +1 -1
- package/dist/assets/{get-safe-url-oiWXWYvc.js → get-safe-url-D9ZX2qFm.js} +1 -1
- package/dist/assets/{home-USnWZhK5.js → home-B6em2u64.js} +1 -1
- package/dist/assets/{iframe-Ci5Ay1y2.js → iframe-Dl-5xRyx.js} +1 -1
- package/dist/assets/{index-PcQgNtUn.js → index-1-P2gWGZ.js} +1 -1
- package/dist/assets/{index-Bgm1cW2N.js → index-467tNKTx.js} +1 -1
- package/dist/assets/{index-DHLC0F8S.js → index-7fdKVdEw.js} +1 -1
- package/dist/assets/{index-cdAwhti6.js → index-B6RoOcNF.js} +1 -1
- package/dist/assets/{index-CoPcipTj.js → index-B88jr6sm.js} +1 -1
- package/dist/assets/{index-CwdidKu0.js → index-B_JPa3k-.js} +1 -1
- package/dist/assets/{index-Bz6T9WJi.js → index-BituGg_i.js} +1 -1
- package/dist/assets/{index-NhYP56dI.js → index-CC1_0xzr.js} +4 -4
- package/dist/assets/{index-Bg6_NsC_.js → index-Ca2q4nT6.js} +1 -1
- package/dist/assets/{index-FrAYP-A_.js → index-D6YhMyoB.js} +4 -4
- package/dist/assets/{index-DAg_a68C.js → index-D6ZAoKh5.js} +1 -1
- package/dist/assets/{index-Bnhg3YZe.js → index-DIeXMLLs.js} +1 -1
- package/dist/assets/{index-MJKS-RJU.js → index-DTuL5S3g.js} +1 -1
- package/dist/assets/{index-B8KTykXs.js → index-DZFL6rrK.js} +1 -1
- package/dist/assets/{index-BdKTdgAu.js → index-DiW2Y89J.js} +1 -1
- package/dist/assets/{index-CE07Exux.js → index-DmgU5YEy.js} +1 -1
- package/dist/assets/{index-D9r0lvN6.js → index-DraljbB7.js} +1 -1
- package/dist/assets/{index-CZiEDWpM.js → index-DscHS5BG.js} +1 -1
- package/dist/assets/{index-BkSX50ri.js → index-Eagwj9HU.js} +1 -1
- package/dist/assets/{index-D_g21v0z.js → index-W7Vsgxmq.js} +3 -3
- package/dist/assets/{index-Bga8wqEa.js → index-YhHgNT9f.js} +1 -1
- package/dist/assets/{index-IMquU8ZG.js → index-ckUPtmoF.js} +1 -1
- package/dist/assets/{index-CGHTnzaK.js → index-h4nZrNlX.js} +1 -1
- package/dist/assets/{index-BwxOZ_PS.js → index-pvfQRiIz.js} +1 -1
- package/dist/assets/{invitation-DRsYGsRz.js → invitation-ygFxiD0p.js} +1 -1
- package/dist/assets/{invite-NVVbFYlq.js → invite-DMpU1WKR.js} +1 -1
- package/dist/assets/{isURL-BKM8U6hZ.js → isURL-CTW__dzu.js} +1 -1
- package/dist/assets/{issue-passport-7Rfhc8hs.js → issue-passport-CH_GIDha.js} +1 -1
- package/dist/assets/{item-DMRC_0Pl.js → item-BpwJ2QYy.js} +1 -1
- package/dist/assets/{landing-page-Dc4hRNuW.js → landing-page-Cd61UT7Z.js} +1 -1
- package/dist/assets/{layout-BGLUR5z_.js → layout-Bf7XRYSR.js} +1 -1
- package/dist/assets/{list-X2F1RKzQ.js → list-A-6ZKqgn.js} +1 -1
- package/dist/assets/{list-DgH58u4D.js → list-BHhWPWs4.js} +2 -2
- package/dist/assets/{localization-sp8DBpxc.js → localization-D1S2pks-.js} +1 -1
- package/dist/assets/{log-EgLjQcxJ.js → log-ryKQFCdM.js} +1 -1
- package/dist/assets/{login-BrQzzFXX.js → login-CYXIFDX8.js} +1 -1
- package/dist/assets/{login-oauth-callback-DaVwf7V2.js → login-oauth-callback-DAKrg2Ne.js} +1 -1
- package/dist/assets/{logo-uploader-DgSolZrp.js → logo-uploader-DDncXmM_.js} +2 -2
- package/dist/assets/{lost-passport-DEW2BulR.js → lost-passport-DEoDgh2I.js} +1 -1
- package/dist/assets/{open-window-CcbW4k1o.js → open-window-eYnS4Amh.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-Ba3rEZjM.js → over-due-invoice-payment-CnaSUbBp.js} +1 -1
- package/dist/assets/{overview-CS6bfsq0.js → overview-BbhCPjub.js} +1 -1
- package/dist/assets/{passport-item-BniPqqnO.js → passport-item-CPGYYOeu.js} +1 -1
- package/dist/assets/{permission-w0BesrB_.js → permission-B0EjzZOA.js} +1 -1
- package/dist/assets/{preferences-YUKuGDai.js → preferences-CoP65AxI.js} +1 -1
- package/dist/assets/{profile-embed-D8T7nOel.js → profile-embed-CdAkuRfH.js} +1 -1
- package/dist/assets/{publish-resource-DAqbWOIX.js → publish-resource-O6nixlJ9.js} +1 -1
- package/dist/assets/{runtime-CYnDo-HU.js → runtime-lAc0mbn0.js} +1 -1
- package/dist/assets/sdk-CiRRFKs0.js +1 -0
- package/dist/assets/{security-DLgKehuW.js → security-DzpCKO8Z.js} +1 -1
- package/dist/assets/{session-Ci_4G0CP.js → session-fyUi2EvV.js} +1 -1
- package/dist/assets/{setup-Cq1C8BeD.js → setup-BtNJlN-g.js} +3 -3
- package/dist/assets/{spaces-C1LV9UvU.js → spaces-Ci_JwPPC.js} +1 -1
- package/dist/assets/{start-CaaDhsmK.js → start-CvpuRdlI.js} +1 -1
- package/dist/assets/{status-BeqBWyAi.js → status-BYn5dcxB.js} +1 -1
- package/dist/assets/{step-actions-C8wc4rOR.js → step-actions-vNi6kxQk.js} +1 -1
- package/dist/assets/{studio-C-1N3D23.js → studio-CU2xUA6B.js} +1 -1
- package/dist/assets/{team-CD3vKVPJ.js → team-Bxi69lmr.js} +1 -1
- package/dist/assets/{traffic-h7MLT42d.js → traffic-5kSM9zFo.js} +1 -1
- package/dist/assets/{transfer-BgDlNRZV.js → transfer-1mPm3DHh.js} +1 -1
- package/dist/assets/{unsubscribe-DmHvwVjR.js → unsubscribe-BHRGSL9f.js} +1 -1
- package/dist/assets/{use-promise-window-open-ecxT8x1I.js → use-promise-window-open-DzOXAig9.js} +1 -1
- package/dist/assets/{user-center-Cveaoeez.js → user-center-D7U8E_9U.js} +3 -3
- package/dist/assets/{user-sessions-D9ZCFiu3.js → user-sessions-CFuRw6Kk.js} +1 -1
- package/dist/assets/{util-Bgqx2flh.js → util-CxrGdmDd.js} +1 -1
- package/dist/assets/{util-CJadXi8V.js → util-DhFzZqQY.js} +1 -1
- package/dist/assets/{wrap-locale-B4B-XHcF.js → wrap-locale-CnZSJgmv.js} +1 -1
- package/dist/assets/{zh-DOMhcyY9.js → zh-IccOJN0P.js} +1 -1
- package/dist/index.html +1 -1
- package/dist/service-worker.js +1 -1
- package/package.json +23 -23
- package/dist/assets/config-Dh0hZZiY.js +0 -26
- package/dist/assets/engine-Ch-5kOUZ.js +0 -1
- package/dist/assets/sdk-DAF46Tln.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as x,t as or,g as ar,e as lr}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as D,y as Fe,x as Me,bb as We,M as ye,T as G,z as de,bC as He,aX as se,a6 as ie,W as b,at as $,aj as cr,aI as dr,D as mr,cg as ve,bp as ur,b6 as Ct,bq as pr,am as me,bZ as it,P as fr,Q as jt,bW as gr,dt as hr,ca as xr,aO as yr,aP as vr,du as br,I as Cr,d1 as jr,bL as Sr,dv as wr,a5 as kr}from"./vendor-mui-core-CcrDM-5l.js";import{B as ot,e as _e,K as Ir,ae as Pr,n as at,C as Ar,a as Rr}from"./vendor-utils-BOkrEpKO.js";import{a3 as St,D as Tr,T as Z,$ as Er,e as Dr,H as Y,a as te,n as q,b as pe,G as wt,I as Lr,h as Or,B as qe,J as kt,W as Nr}from"./vendor-ux-CUBj5GXM.js";import{av as Ur,bM as Br,bN as Fr,U as H,bO as be,p as ue,Q as Mr,v as Wr,aI as _r,ap as ne,bP as qr,bQ as $r,a1 as It,c as ee,b2 as zr,_ as Hr,R as re,bR as Pt,ad as Vr,af as Kr,aN as At,bS as Zr}from"./index-FrAYP-A_.js";import{B as Rt,a as Qr,l as Tt}from"./index-Bg6_NsC_.js";import{w as Yr,b as Ve,g as je,c as Gr,h as Jr,a as Xr}from"./vendor-hooks-DTeIFVkk.js";import{C as Et,A as en}from"./user-sessions-D9ZCFiu3.js";import{r as tn}from"./index-Bga8wqEa.js";import{W as Dt}from"./dashboard-VE3KX6Hk.js";import{W as Ke}from"./did-address-DrmEnz9K.js";import{u as Q}from"./team-CD3vKVPJ.js";import{P as J}from"./permission-w0BesrB_.js";import{C as Se}from"./click-to-copy-C43vd7DG.js";import{T as Lt}from"./index-DHLC0F8S.js";import{f as X}from"./index-DBs9Ljax.js";import{u as rn}from"./useAsync-DgPr_To1.js";import{v as z}from"./index-DEDOywis.js";import{C as fe}from"./confirm-CXK9v894.js";import{u as ge}from"./session-Ci_4G0CP.js";import{N as nn}from"./index-MJKS-RJU.js";import{i as Ot,a as Ce,p as Nt}from"./util-CJadXi8V.js";import{b as sn}from"./sdk-DAF46Tln.js";import{A as on}from"./actions-DvIZNF27.js";import{S as an}from"./shorten-label-C8Cay9FW.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BnbwP1kf.js";import"./useLocalStorage-Dgwq5dGM.js";import"./get-safe-url-oiWXWYvc.js";import"./dot-BaR-8Dj-.js";import"./useAsync-BdgUavMa.js";import"./useSetState-DFuQZPPV.js";import"./index-CoPcipTj.js";import"./over-due-invoice-payment-Ba3rEZjM.js";import"./use-mobile-BC9t6zmM.js";import"./isURL-BKM8U6hZ.js";import"./arrow-down.svg-CW9W9wI1.js";import"./vendor-mui-x-BVRWKjdg.js";import"./AdapterDayjs-BEkLDdDJ.js";import"./base32-B9yl211y.js";const Ut=t=>x.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},x.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"}),x.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"}),x.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"}),x.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"})),Bt=t=>x.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},x.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"}),x.createElement("rect",{x:12.5,y:9.375,width:7.5,height:1.875,rx:.9375}),x.createElement("rect",{x:15.3125,y:14.0625,width:7.5,height:1.875,rx:.9375,transform:"rotate(-90 15.3125 14.0625)"})),Ft=t=>x.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},x.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"}),x.createElement("rect",{x:12.5,y:9.375,width:7.5,height:1.875,rx:.9375})),ln=t=>x.createElement("svg",{width:18,height:19,viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg",...t},x.createElement("g",{clipPath:"url(#clip0)"},x.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"})),x.createElement("defs",null,x.createElement("clipPath",{id:"clip0"},x.createElement("rect",{width:18,height:18,transform:"translate(0 0.5)"}))));var Re={},Te,lt;function cn(){return lt||(lt=1,Te=t=>encodeURIComponent(t).replace(/[!'()*]/g,p=>`%${p.charCodeAt(0).toString(16).toUpperCase()}`)),Te}var Ee,ct;function dn(){if(ct)return Ee;ct=1;var t="%[a-f0-9]{2}",p=new RegExp("("+t+")|([^%]+?)","gi"),f=new RegExp("("+t+")+","gi");function y(i,c){try{return[decodeURIComponent(i.join(""))]}catch{}if(i.length===1)return i;c=c||1;var o=i.slice(0,c),u=i.slice(c);return Array.prototype.concat.call([],y(o),y(u))}function C(i){try{return decodeURIComponent(i)}catch{for(var c=i.match(p)||[],o=1;o<c.length;o++)i=y(c,o).join(""),c=i.match(p)||[];return i}}function g(i){for(var c={"%FE%FF":"��","%FF%FE":"��"},o=f.exec(i);o;){try{c[o[0]]=decodeURIComponent(o[0])}catch{var u=C(o[0]);u!==o[0]&&(c[o[0]]=u)}o=f.exec(i)}c["%C2"]="�";for(var s=Object.keys(c),S=0;S<s.length;S++){var v=s[S];i=i.replace(new RegExp(v,"g"),c[v])}return i}return Ee=function(i){if(typeof i!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof i+"`");try{return i=i.replace(/\+/g," "),decodeURIComponent(i)}catch{return g(i)}},Ee}var De,dt;function mn(){return dt||(dt=1,De=(t,p)=>{if(!(typeof t=="string"&&typeof p=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(p==="")return[t];const f=t.indexOf(p);return f===-1?[t]:[t.slice(0,f),t.slice(f+p.length)]}),De}var Le,mt;function un(){return mt||(mt=1,Le=function(t,p){for(var f={},y=Object.keys(t),C=Array.isArray(p),g=0;g<y.length;g++){var i=y[g],c=t[i];(C?p.indexOf(i)!==-1:p(i,c,t))&&(f[i]=c)}return f}),Le}var ut;function pn(){return ut||(ut=1,function(t){const p=cn(),f=dn(),y=mn(),C=un(),g=r=>r==null;function i(r){switch(r.arrayFormat){case"index":return n=>(l,d)=>{const m=l.length;return d===void 0||r.skipNull&&d===null||r.skipEmptyString&&d===""?l:d===null?[...l,[u(n,r),"[",m,"]"].join("")]:[...l,[u(n,r),"[",u(m,r),"]=",u(d,r)].join("")]};case"bracket":return n=>(l,d)=>d===void 0||r.skipNull&&d===null||r.skipEmptyString&&d===""?l:d===null?[...l,[u(n,r),"[]"].join("")]:[...l,[u(n,r),"[]=",u(d,r)].join("")];case"comma":case"separator":return n=>(l,d)=>d==null||d.length===0?l:l.length===0?[[u(n,r),"=",u(d,r)].join("")]:[[l,u(d,r)].join(r.arrayFormatSeparator)];default:return n=>(l,d)=>d===void 0||r.skipNull&&d===null||r.skipEmptyString&&d===""?l:d===null?[...l,u(n,r)]:[...l,[u(n,r),"=",u(d,r)].join("")]}}function c(r){let n;switch(r.arrayFormat){case"index":return(l,d,m)=>{if(n=/\[(\d*)\]$/.exec(l),l=l.replace(/\[\d*\]$/,""),!n){m[l]=d;return}m[l]===void 0&&(m[l]={}),m[l][n[1]]=d};case"bracket":return(l,d,m)=>{if(n=/(\[\])$/.exec(l),l=l.replace(/\[\]$/,""),!n){m[l]=d;return}if(m[l]===void 0){m[l]=[d];return}m[l]=[].concat(m[l],d)};case"comma":case"separator":return(l,d,m)=>{const P=typeof d=="string"&&d.includes(r.arrayFormatSeparator),w=typeof d=="string"&&!P&&s(d,r).includes(r.arrayFormatSeparator);d=w?s(d,r):d;const L=P||w?d.split(r.arrayFormatSeparator).map(T=>s(T,r)):d===null?d:s(d,r);m[l]=L};default:return(l,d,m)=>{if(m[l]===void 0){m[l]=d;return}m[l]=[].concat(m[l],d)}}}function o(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function u(r,n){return n.encode?n.strict?p(r):encodeURIComponent(r):r}function s(r,n){return n.decode?f(r):r}function S(r){return Array.isArray(r)?r.sort():typeof r=="object"?S(Object.keys(r)).sort((n,l)=>Number(n)-Number(l)).map(n=>r[n]):r}function v(r){const n=r.indexOf("#");return n!==-1&&(r=r.slice(0,n)),r}function k(r){let n="";const l=r.indexOf("#");return l!==-1&&(n=r.slice(l)),n}function a(r){r=v(r);const n=r.indexOf("?");return n===-1?"":r.slice(n+1)}function h(r,n){return n.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?r=Number(r):n.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")&&(r=r.toLowerCase()==="true"),r}function I(r,n){n=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},n),o(n.arrayFormatSeparator);const l=c(n),d=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return d;for(const m of r.split("&")){if(m==="")continue;let[P,w]=y(n.decode?m.replace(/\+/g," "):m,"=");w=w===void 0?null:["comma","separator"].includes(n.arrayFormat)?w:s(w,n),l(s(P,n),w,d)}for(const m of Object.keys(d)){const P=d[m];if(typeof P=="object"&&P!==null)for(const w of Object.keys(P))P[w]=h(P[w],n);else d[m]=h(P,n)}return n.sort===!1?d:(n.sort===!0?Object.keys(d).sort():Object.keys(d).sort(n.sort)).reduce((m,P)=>{const w=d[P];return w&&typeof w=="object"&&!Array.isArray(w)?m[P]=S(w):m[P]=w,m},Object.create(null))}t.extract=a,t.parse=I,t.stringify=(r,n)=>{if(!r)return"";n=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},n),o(n.arrayFormatSeparator);const l=w=>n.skipNull&&g(r[w])||n.skipEmptyString&&r[w]==="",d=i(n),m={};for(const w of Object.keys(r))l(w)||(m[w]=r[w]);const P=Object.keys(m);return n.sort!==!1&&P.sort(n.sort),P.map(w=>{const L=r[w];return L===void 0?"":L===null?u(w,n):Array.isArray(L)?L.reduce(d(w),[]).join("&"):u(w,n)+"="+u(L,n)}).filter(w=>w.length>0).join("&")},t.parseUrl=(r,n)=>{n=Object.assign({decode:!0},n);const[l,d]=y(r,"#");return Object.assign({url:l.split("?")[0]||"",query:I(a(r),n)},n&&n.parseFragmentIdentifier&&d?{fragmentIdentifier:s(d,n)}:{})},t.stringifyUrl=(r,n)=>{n=Object.assign({encode:!0,strict:!0},n);const l=v(r.url).split("?")[0]||"",d=t.extract(r.url),m=t.parse(d,{sort:!1}),P=Object.assign(m,r.query);let w=t.stringify(P,n);w&&(w=`?${w}`);let L=k(r.url);return r.fragmentIdentifier&&(L=`#${u(r.fragmentIdentifier,n)}`),`${l}${w}${L}`},t.pick=(r,n,l)=>{l=Object.assign({parseFragmentIdentifier:!0},l);const{url:d,query:m,fragmentIdentifier:P}=t.parseUrl(r,l);return t.stringifyUrl({url:d,query:C(m,n),fragmentIdentifier:P},l)},t.exclude=(r,n,l)=>{const d=Array.isArray(n)?m=>!n.includes(m):(m,P)=>!n(m,P);return t.pick(r,d,l)}}(Re)),Re}var Oe=pn();const ae=or,fn={parseNumbers:!1,parseBooleans:!1},gn={skipNull:!1,skipEmptyString:!1},hn=(t,p)=>{var f,y;const{navigateMode:C="push",parseOptions:g,stringifyOptions:i}={},c=Object.assign(Object.assign({},fn),g),o=Object.assign(Object.assign({},gn),i),u=ae.useLocation(),s=(f=ae.useHistory)===null||f===void 0?void 0:f.call(ae),S=(y=ae.useNavigate)===null||y===void 0?void 0:y.call(ae),v=Yr(),k=x.useRef(typeof t=="function"?t():t||{}),a=x.useMemo(()=>Oe.parse(u.search,c),[u.search]),h=x.useMemo(()=>Object.assign(Object.assign({},k.current),a),[a]);return[h,Ve(r=>{const n=typeof r=="function"?r(h):r;v(),s&&s[C]({hash:u.hash,search:Oe.stringify(Object.assign(Object.assign({},a),n),o)||"?"},u.state),S&&S({hash:u.hash,search:Oe.stringify(Object.assign(Object.assign({},a),n),o)||"?"},{replace:C==="replace",state:u.state})})]};var Ne,pt;function xn(){if(pt)return Ne;pt=1;const t=St(),p=Ur(),f=Tr(),y=tn(),C={role:t.types.RoleType.ROLE_APPLICATION};return Ne=(i,c,o,u)=>{let s=o||C;const S=(0,f.isEthereumType)((0,f.DidType)(o));if(S?s=(0,p.WalletType)(o):s=(0,p.WalletType)(C),!(0,f.isValid)(i)){let v="";try{return S?v=i.slice(0,66):v=i,(0,p.fromSecretKey)(v,s)}catch(k){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${k.message}`)}}if(!c)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,y.fromAppDid)(i,c,s,u||0)},Ne}var le,ft;function yn(){if(ft)return le;ft=1;var t=le&&le.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};const p=t(Br),f=St(),y=t(xn()),C=Fr();return le=(i,c,{returnWallet:o=!0}={})=>{if(!i||typeof i!="object"||!Array.isArray(i.environments)||!(0,p.default)(i,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:u,configs:s=[]}=i,S=[...s,...u],v=S.find(U=>U.key==="BLOCKLET_APP_DESCRIPTION"),k=S.find(U=>U.key==="BLOCKLET_PASSPORT_COLOR"),a=S.find(U=>U.key==="BLOCKLET_APP_URL"),h=S.find(U=>U.key==="BLOCKLET_APP_TENANT_MODE"),{did:I,version:r}=i.meta,n=(0,C.getDisplayName)(i),l=(0,p.default)(v,"value",i.meta.description),d=(0,p.default)(k,"value","auto"),m=(0,p.default)(a,"value",""),P=(0,p.default)(h,"value","");if(!o)return{did:I,version:r,name:n,description:l,passportColor:d,appUrl:m,secret:"",wallet:null,permanentWallet:null,tenantMode:P};const w=S.find(U=>U.key==="BLOCKLET_APP_SK"),L=S.find(U=>U.key==="BLOCKLET_APP_CHAIN_TYPE")||S.find(U=>U.key==="BLOCKLET_WALLET_TYPE"),T=S.find(U=>U.key==="BLOCKLET_APP_PSK");let E;L&&(L.value==="ethereum"||L.value==="eth")&&(E=L.value);let N=null,F=null;if(w&&w.value)N=(0,y.default)(w.value,void 0,E),T&&T.value&&T.value!==w.value&&(F=(0,y.default)(T.value,void 0,E));else{if(!c||typeof c!="string")throw new Error("Node secret key must be a string");L?N=(0,y.default)(i.meta.did,c,E):N=(0,y.default)(i.meta.did,c)}const W=i.settings?.session?.salt||"",V=f.Hasher.SHA3.hash256(ot.concat([N.secretKey,N.address,W].filter(Boolean).map(U=>ot.from(U))));return{did:I,version:r,name:n,description:l,passportColor:d,appUrl:m,secret:V,wallet:N,permanentWallet:F||N,tenantMode:P}},le}var vn=yn();const bn=ar(vn);function Mt({teamDid:t,roles:p=[],apps:f=[],onCancel:y,onSuccess:C,onError:g=()=>{},endpoint:i=""}){const{api:c}=H(),{t:o,locale:u}=Z(),s=je({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:f.length>0?f[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),S=async()=>{if(!s.role){s.error=o("team.member.error.passportEmpty");return}const h=s.remark.trim();s.error=null,s.loading=!0;try{let I=s.sourceAppPid??null;I===t&&(I=null);const r={teamDid:t,role:s.role,remark:h,sourceAppPid:I,passportExpireTime:s.passportExpireTime?s.passportExpireTime.toISOString():""};s.display&&(r.display={type:"url",content:s.display});const{inviteInfo:n}=await c.createMemberInvitation({input:r});s.inviteInfo=n,s.activeStep=1}catch(I){const r=X(I);s.error=r,g(I)}finally{s.loading=!1}},v=p.find(h=>h.name===s.role),a=[{body:e.jsxs(D,{sx:{display:"flex",flexDirection:"column",gap:3},children:[f.length>1?e.jsxs(Fe,{fullWidth:!0,children:[e.jsx(Me,{children:o("common.sourceApp")}),e.jsx(We,{value:s.sourceAppPid,onChange:h=>{s.error=null,s.sourceAppPid=h.target.value},fullWidth:!0,label:o("common.passport"),disabled:s.loading,children:f.map(h=>e.jsx(ye,{value:h.appPid,children:e.jsxs(D,{sx:{display:"flex",justifyContent:"space-between",gap:2,width:"100%"},children:[e.jsxs(D,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Er,{did:h.appPid,size:28}),h.appName]}),e.jsx(Dr,{did:h.appPid,compact:!0,responsive:!1})]})},h.appPid))})]}):null,e.jsxs(Fe,{fullWidth:!0,variant:"outlined",children:[e.jsx(Me,{children:o("common.passport")}),e.jsx(We,{"data-cy":"invite-member-select-role",value:s.role,onChange:h=>{s.error=null,s.role=h.target.value},fullWidth:!0,label:o("common.passport"),disabled:s.loading,onKeyPress:h=>{h.key==="Enter"&&(h.preventDefault(),S())},children:p.filter(h=>h.name!=="owner").map(h=>e.jsx(ye,{value:h.name,"data-cy":`invite-member-select-option-${h.name}`,children:e.jsxs(D,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(G,{variant:"subtitle1",children:h.title||h.name}),e.jsx(G,{variant:"caption",sx:{opacity:.7},children:h.description})]})},h.name))})]}),v?.extra?.display==="custom"&&e.jsx(de,{label:o("common.display"),type:"url",value:s.display,onChange:h=>{s.error=null,s.display=h.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(de,{label:o("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.remark,onChange:h=>{s.error=null,s.remark=h.target.value},disabled:s.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Lt,{value:s.passportExpireTime,onChange:h=>{s.passportExpireTime=h}})]}),cancel:o("common.cancel"),confirm:o("team.member.inviteDialog.createInviteLink"),onCancel:y,onConfirm:S},{body:()=>{const h=be({inviteId:s.inviteInfo?.inviteId,endpoint:i});return e.jsxs("div",{children:[e.jsx(D,{sx:{fontSize:16,fontWeight:"bold"},children:o("team.member.inviteDialog.createSuccessTip",{expireDate:ue(s.inviteInfo?.expireDate,u)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Se,{children:h})]})},confirm:o("common.copy"),onConfirm:()=>{const h=be({inviteId:s.inviteInfo?.inviteId,endpoint:i});Gr(h),Y.success(o("common.copied")),C()},cancel:o("common.cancel"),onCancel:y}][s.activeStep];return e.jsxs(te,{title:o("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[a.cancel&&e.jsx(q,{onClick:a.onCancel,color:"inherit",children:a.cancel}),e.jsxs(q,{onClick:a.onConfirm,color:"primary",disabled:s.loading||!s.role,variant:"contained",autoFocus:!0,children:[s.loading&&e.jsx(ie,{size:16}),a.confirm]})]}),children:[e.jsx(He,{component:"div",children:typeof a.body=="function"?a.body():a.body}),!!s.error&&e.jsx(se,{severity:"error",variant:"icon",children:s.error})]})}Mt.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 Wt({teamDid:t,onCancel:p,onSuccess:f,onError:y=()=>{},endpoint:C=""}){const{api:g,info:i}=H(),{api:c}=x.useContext(Mr),[o,u]=x.useState(!1),{t:s,locale:S}=Z(),[v,k]=x.useState(""),[a,h]=x.useState(!1),[I,r]=x.useState(0),[n,l]=x.useState(""),[d,m]=x.useState(""),P=!!_e(i,"ownerNft.did"),w=rn(async()=>{if(P){const{state:W}=await g.getDelegationState();return W}return{delegated:!0}});if(w.loading)return e.jsx(te,{title:s("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:p,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(ie,{})})});if(w.error)return e.jsx(te,{title:s("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:p,children:e.jsx(se,{severity:"error",variant:"icon",children:X(w.error)})});const L=async()=>{k(null),u(!0);try{const{inviteInfo:W}=await g.createTransferInvitation({input:{teamDid:t,role:"owner",remark:d.trim()}});l(W),r(N.length-1)}catch(W){const V=X(W);k(V),y(W)}finally{u(!1)}},T=()=>{h(!0),r(1)},E=()=>{h(!1),r(0)},N=[{body:e.jsxs(G,{component:"div",children:[e.jsxs(se,{severity:"warning",children:[e.jsx(G,{children:s("team.transferNode.inviteDialog.tips.progress")}),e.jsx(G,{children:s("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(se,{severity:"warning",children:e.jsx(G,{children:s("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(de,{label:s("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:d,onChange:W=>{k(null),m(W.target.value)},disabled:o,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:s("common.cancel"),confirm:s("team.transferNode.inviteDialog.createInviteLink"),onCancel:p,onConfirm:P&&!_e(w,"value.delegated")?T:L},{body:()=>e.jsx(Wr,{action:"delegate-transfer-nft",open:a,locale:S,checkFn:c.get,onClose:E,onSuccess:L,checkTimeout:5*60*1e3,webWalletUrl:_r(i),extraParams:{targetDID:i.did},messages:{title:s("team.transferNode.delegateDialog.title"),scan:s("team.transferNode.delegateDialog.scan"),confirm:s("team.transferNode.delegateDialog.confirm"),success:s("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const W=be({inviteId:n.inviteId,endpoint:C});return e.jsxs("div",{children:[e.jsx(Cn,{children:s("team.transferNode.inviteDialog.createSuccessTip",{expireDate:ue(n.expireDate,S)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Se,{children:W})]})},confirm:s("common.confirm"),onConfirm:f}],F=N[I];return e.jsxs(te,{title:s("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[F.cancel&&e.jsx(q,{onClick:F.onCancel,color:"inherit",children:F.cancel}),e.jsxs(q,{onClick:F.onConfirm,color:"primary",disabled:o,variant:"contained",autoFocus:!0,children:[o&&e.jsx(ie,{size:16}),F.confirm]})]}),children:[e.jsx(He,{component:"div",children:typeof F.body=="function"?F.body():F.body}),!!v&&e.jsx(se,{severity:"error",variant:"icon",children:v})]})}Wt.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,endpoint:b.string};const Cn=$.div`
|
|
1
|
+
import{r as x,t as or,g as ar,e as lr}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as D,y as Fe,x as Me,bb as We,M as ye,T as G,z as de,bC as He,aX as se,a6 as ie,W as b,at as $,aj as cr,aI as dr,D as mr,cg as ve,bp as ur,b6 as Ct,bq as pr,am as me,bZ as it,P as fr,Q as jt,bW as gr,dt as hr,ca as xr,aO as yr,aP as vr,du as br,I as Cr,d1 as jr,bL as Sr,dv as wr,a5 as kr}from"./vendor-mui-core-CcrDM-5l.js";import{B as ot,e as _e,K as Ir,ae as Pr,n as at,C as Ar,a as Rr}from"./vendor-utils-BOkrEpKO.js";import{a3 as St,D as Tr,T as Z,$ as Er,e as Dr,H as Y,a as te,n as q,b as pe,G as wt,I as Lr,h as Or,B as qe,J as kt,W as Nr}from"./vendor-ux-CUBj5GXM.js";import{av as Ur,bM as Br,bN as Fr,U as H,bO as be,p as ue,Q as Mr,v as Wr,aI as _r,ap as ne,bP as qr,bQ as $r,a1 as It,c as ee,b2 as zr,_ as Hr,R as re,bR as Pt,ad as Vr,af as Kr,aN as At,bS as Zr}from"./index-D6YhMyoB.js";import{B as Rt,a as Qr,l as Tt}from"./index-Ca2q4nT6.js";import{w as Yr,b as Ve,g as je,c as Gr,h as Jr,a as Xr}from"./vendor-hooks-DTeIFVkk.js";import{C as Et,A as en}from"./user-sessions-CFuRw6Kk.js";import{r as tn}from"./index-YhHgNT9f.js";import{W as Dt}from"./dashboard-DaKd1daE.js";import{W as Ke}from"./did-address-DrmEnz9K.js";import{u as Q}from"./team-Bxi69lmr.js";import{P as J}from"./permission-B0EjzZOA.js";import{C as Se}from"./click-to-copy-C43vd7DG.js";import{T as Lt}from"./index-7fdKVdEw.js";import{f as X}from"./index-DBs9Ljax.js";import{u as rn}from"./useAsync-DgPr_To1.js";import{v as z}from"./index-DEDOywis.js";import{C as fe}from"./confirm-5e46DDlz.js";import{u as ge}from"./session-fyUi2EvV.js";import{N as nn}from"./index-DTuL5S3g.js";import{i as Ot,a as Ce,p as Nt}from"./util-DhFzZqQY.js";import{b as sn}from"./sdk-CiRRFKs0.js";import{A as on}from"./actions-DvIZNF27.js";import{S as an}from"./shorten-label-C8Cay9FW.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BnbwP1kf.js";import"./useLocalStorage-Dgwq5dGM.js";import"./get-safe-url-D9ZX2qFm.js";import"./dot-BaR-8Dj-.js";import"./useAsync-BdgUavMa.js";import"./useSetState-DFuQZPPV.js";import"./index-B88jr6sm.js";import"./over-due-invoice-payment-CnaSUbBp.js";import"./use-mobile-BC9t6zmM.js";import"./isURL-CTW__dzu.js";import"./arrow-down.svg-CH8Xzna_.js";import"./vendor-mui-x-BVRWKjdg.js";import"./AdapterDayjs-BEkLDdDJ.js";import"./base32-B9yl211y.js";const Ut=t=>x.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},x.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"}),x.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"}),x.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"}),x.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"})),Bt=t=>x.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},x.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"}),x.createElement("rect",{x:12.5,y:9.375,width:7.5,height:1.875,rx:.9375}),x.createElement("rect",{x:15.3125,y:14.0625,width:7.5,height:1.875,rx:.9375,transform:"rotate(-90 15.3125 14.0625)"})),Ft=t=>x.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...t},x.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"}),x.createElement("rect",{x:12.5,y:9.375,width:7.5,height:1.875,rx:.9375})),ln=t=>x.createElement("svg",{width:18,height:19,viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg",...t},x.createElement("g",{clipPath:"url(#clip0)"},x.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"})),x.createElement("defs",null,x.createElement("clipPath",{id:"clip0"},x.createElement("rect",{width:18,height:18,transform:"translate(0 0.5)"}))));var Re={},Te,lt;function cn(){return lt||(lt=1,Te=t=>encodeURIComponent(t).replace(/[!'()*]/g,p=>`%${p.charCodeAt(0).toString(16).toUpperCase()}`)),Te}var Ee,ct;function dn(){if(ct)return Ee;ct=1;var t="%[a-f0-9]{2}",p=new RegExp("("+t+")|([^%]+?)","gi"),f=new RegExp("("+t+")+","gi");function y(i,c){try{return[decodeURIComponent(i.join(""))]}catch{}if(i.length===1)return i;c=c||1;var o=i.slice(0,c),u=i.slice(c);return Array.prototype.concat.call([],y(o),y(u))}function C(i){try{return decodeURIComponent(i)}catch{for(var c=i.match(p)||[],o=1;o<c.length;o++)i=y(c,o).join(""),c=i.match(p)||[];return i}}function g(i){for(var c={"%FE%FF":"��","%FF%FE":"��"},o=f.exec(i);o;){try{c[o[0]]=decodeURIComponent(o[0])}catch{var u=C(o[0]);u!==o[0]&&(c[o[0]]=u)}o=f.exec(i)}c["%C2"]="�";for(var s=Object.keys(c),S=0;S<s.length;S++){var v=s[S];i=i.replace(new RegExp(v,"g"),c[v])}return i}return Ee=function(i){if(typeof i!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof i+"`");try{return i=i.replace(/\+/g," "),decodeURIComponent(i)}catch{return g(i)}},Ee}var De,dt;function mn(){return dt||(dt=1,De=(t,p)=>{if(!(typeof t=="string"&&typeof p=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(p==="")return[t];const f=t.indexOf(p);return f===-1?[t]:[t.slice(0,f),t.slice(f+p.length)]}),De}var Le,mt;function un(){return mt||(mt=1,Le=function(t,p){for(var f={},y=Object.keys(t),C=Array.isArray(p),g=0;g<y.length;g++){var i=y[g],c=t[i];(C?p.indexOf(i)!==-1:p(i,c,t))&&(f[i]=c)}return f}),Le}var ut;function pn(){return ut||(ut=1,function(t){const p=cn(),f=dn(),y=mn(),C=un(),g=r=>r==null;function i(r){switch(r.arrayFormat){case"index":return n=>(l,d)=>{const m=l.length;return d===void 0||r.skipNull&&d===null||r.skipEmptyString&&d===""?l:d===null?[...l,[u(n,r),"[",m,"]"].join("")]:[...l,[u(n,r),"[",u(m,r),"]=",u(d,r)].join("")]};case"bracket":return n=>(l,d)=>d===void 0||r.skipNull&&d===null||r.skipEmptyString&&d===""?l:d===null?[...l,[u(n,r),"[]"].join("")]:[...l,[u(n,r),"[]=",u(d,r)].join("")];case"comma":case"separator":return n=>(l,d)=>d==null||d.length===0?l:l.length===0?[[u(n,r),"=",u(d,r)].join("")]:[[l,u(d,r)].join(r.arrayFormatSeparator)];default:return n=>(l,d)=>d===void 0||r.skipNull&&d===null||r.skipEmptyString&&d===""?l:d===null?[...l,u(n,r)]:[...l,[u(n,r),"=",u(d,r)].join("")]}}function c(r){let n;switch(r.arrayFormat){case"index":return(l,d,m)=>{if(n=/\[(\d*)\]$/.exec(l),l=l.replace(/\[\d*\]$/,""),!n){m[l]=d;return}m[l]===void 0&&(m[l]={}),m[l][n[1]]=d};case"bracket":return(l,d,m)=>{if(n=/(\[\])$/.exec(l),l=l.replace(/\[\]$/,""),!n){m[l]=d;return}if(m[l]===void 0){m[l]=[d];return}m[l]=[].concat(m[l],d)};case"comma":case"separator":return(l,d,m)=>{const P=typeof d=="string"&&d.includes(r.arrayFormatSeparator),w=typeof d=="string"&&!P&&s(d,r).includes(r.arrayFormatSeparator);d=w?s(d,r):d;const L=P||w?d.split(r.arrayFormatSeparator).map(T=>s(T,r)):d===null?d:s(d,r);m[l]=L};default:return(l,d,m)=>{if(m[l]===void 0){m[l]=d;return}m[l]=[].concat(m[l],d)}}}function o(r){if(typeof r!="string"||r.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function u(r,n){return n.encode?n.strict?p(r):encodeURIComponent(r):r}function s(r,n){return n.decode?f(r):r}function S(r){return Array.isArray(r)?r.sort():typeof r=="object"?S(Object.keys(r)).sort((n,l)=>Number(n)-Number(l)).map(n=>r[n]):r}function v(r){const n=r.indexOf("#");return n!==-1&&(r=r.slice(0,n)),r}function k(r){let n="";const l=r.indexOf("#");return l!==-1&&(n=r.slice(l)),n}function a(r){r=v(r);const n=r.indexOf("?");return n===-1?"":r.slice(n+1)}function h(r,n){return n.parseNumbers&&!Number.isNaN(Number(r))&&typeof r=="string"&&r.trim()!==""?r=Number(r):n.parseBooleans&&r!==null&&(r.toLowerCase()==="true"||r.toLowerCase()==="false")&&(r=r.toLowerCase()==="true"),r}function I(r,n){n=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},n),o(n.arrayFormatSeparator);const l=c(n),d=Object.create(null);if(typeof r!="string"||(r=r.trim().replace(/^[?#&]/,""),!r))return d;for(const m of r.split("&")){if(m==="")continue;let[P,w]=y(n.decode?m.replace(/\+/g," "):m,"=");w=w===void 0?null:["comma","separator"].includes(n.arrayFormat)?w:s(w,n),l(s(P,n),w,d)}for(const m of Object.keys(d)){const P=d[m];if(typeof P=="object"&&P!==null)for(const w of Object.keys(P))P[w]=h(P[w],n);else d[m]=h(P,n)}return n.sort===!1?d:(n.sort===!0?Object.keys(d).sort():Object.keys(d).sort(n.sort)).reduce((m,P)=>{const w=d[P];return w&&typeof w=="object"&&!Array.isArray(w)?m[P]=S(w):m[P]=w,m},Object.create(null))}t.extract=a,t.parse=I,t.stringify=(r,n)=>{if(!r)return"";n=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},n),o(n.arrayFormatSeparator);const l=w=>n.skipNull&&g(r[w])||n.skipEmptyString&&r[w]==="",d=i(n),m={};for(const w of Object.keys(r))l(w)||(m[w]=r[w]);const P=Object.keys(m);return n.sort!==!1&&P.sort(n.sort),P.map(w=>{const L=r[w];return L===void 0?"":L===null?u(w,n):Array.isArray(L)?L.reduce(d(w),[]).join("&"):u(w,n)+"="+u(L,n)}).filter(w=>w.length>0).join("&")},t.parseUrl=(r,n)=>{n=Object.assign({decode:!0},n);const[l,d]=y(r,"#");return Object.assign({url:l.split("?")[0]||"",query:I(a(r),n)},n&&n.parseFragmentIdentifier&&d?{fragmentIdentifier:s(d,n)}:{})},t.stringifyUrl=(r,n)=>{n=Object.assign({encode:!0,strict:!0},n);const l=v(r.url).split("?")[0]||"",d=t.extract(r.url),m=t.parse(d,{sort:!1}),P=Object.assign(m,r.query);let w=t.stringify(P,n);w&&(w=`?${w}`);let L=k(r.url);return r.fragmentIdentifier&&(L=`#${u(r.fragmentIdentifier,n)}`),`${l}${w}${L}`},t.pick=(r,n,l)=>{l=Object.assign({parseFragmentIdentifier:!0},l);const{url:d,query:m,fragmentIdentifier:P}=t.parseUrl(r,l);return t.stringifyUrl({url:d,query:C(m,n),fragmentIdentifier:P},l)},t.exclude=(r,n,l)=>{const d=Array.isArray(n)?m=>!n.includes(m):(m,P)=>!n(m,P);return t.pick(r,d,l)}}(Re)),Re}var Oe=pn();const ae=or,fn={parseNumbers:!1,parseBooleans:!1},gn={skipNull:!1,skipEmptyString:!1},hn=(t,p)=>{var f,y;const{navigateMode:C="push",parseOptions:g,stringifyOptions:i}={},c=Object.assign(Object.assign({},fn),g),o=Object.assign(Object.assign({},gn),i),u=ae.useLocation(),s=(f=ae.useHistory)===null||f===void 0?void 0:f.call(ae),S=(y=ae.useNavigate)===null||y===void 0?void 0:y.call(ae),v=Yr(),k=x.useRef(typeof t=="function"?t():t||{}),a=x.useMemo(()=>Oe.parse(u.search,c),[u.search]),h=x.useMemo(()=>Object.assign(Object.assign({},k.current),a),[a]);return[h,Ve(r=>{const n=typeof r=="function"?r(h):r;v(),s&&s[C]({hash:u.hash,search:Oe.stringify(Object.assign(Object.assign({},a),n),o)||"?"},u.state),S&&S({hash:u.hash,search:Oe.stringify(Object.assign(Object.assign({},a),n),o)||"?"},{replace:C==="replace",state:u.state})})]};var Ne,pt;function xn(){if(pt)return Ne;pt=1;const t=St(),p=Ur(),f=Tr(),y=tn(),C={role:t.types.RoleType.ROLE_APPLICATION};return Ne=(i,c,o,u)=>{let s=o||C;const S=(0,f.isEthereumType)((0,f.DidType)(o));if(S?s=(0,p.WalletType)(o):s=(0,p.WalletType)(C),!(0,f.isValid)(i)){let v="";try{return S?v=i.slice(0,66):v=i,(0,p.fromSecretKey)(v,s)}catch(k){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${k.message}`)}}if(!c)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,y.fromAppDid)(i,c,s,u||0)},Ne}var le,ft;function yn(){if(ft)return le;ft=1;var t=le&&le.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};const p=t(Br),f=St(),y=t(xn()),C=Fr();return le=(i,c,{returnWallet:o=!0}={})=>{if(!i||typeof i!="object"||!Array.isArray(i.environments)||!(0,p.default)(i,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:u,configs:s=[]}=i,S=[...s,...u],v=S.find(U=>U.key==="BLOCKLET_APP_DESCRIPTION"),k=S.find(U=>U.key==="BLOCKLET_PASSPORT_COLOR"),a=S.find(U=>U.key==="BLOCKLET_APP_URL"),h=S.find(U=>U.key==="BLOCKLET_APP_TENANT_MODE"),{did:I,version:r}=i.meta,n=(0,C.getDisplayName)(i),l=(0,p.default)(v,"value",i.meta.description),d=(0,p.default)(k,"value","auto"),m=(0,p.default)(a,"value",""),P=(0,p.default)(h,"value","");if(!o)return{did:I,version:r,name:n,description:l,passportColor:d,appUrl:m,secret:"",wallet:null,permanentWallet:null,tenantMode:P};const w=S.find(U=>U.key==="BLOCKLET_APP_SK"),L=S.find(U=>U.key==="BLOCKLET_APP_CHAIN_TYPE")||S.find(U=>U.key==="BLOCKLET_WALLET_TYPE"),T=S.find(U=>U.key==="BLOCKLET_APP_PSK");let E;L&&(L.value==="ethereum"||L.value==="eth")&&(E=L.value);let N=null,F=null;if(w&&w.value)N=(0,y.default)(w.value,void 0,E),T&&T.value&&T.value!==w.value&&(F=(0,y.default)(T.value,void 0,E));else{if(!c||typeof c!="string")throw new Error("Node secret key must be a string");L?N=(0,y.default)(i.meta.did,c,E):N=(0,y.default)(i.meta.did,c)}const W=i.settings?.session?.salt||"",V=f.Hasher.SHA3.hash256(ot.concat([N.secretKey,N.address,W].filter(Boolean).map(U=>ot.from(U))));return{did:I,version:r,name:n,description:l,passportColor:d,appUrl:m,secret:V,wallet:N,permanentWallet:F||N,tenantMode:P}},le}var vn=yn();const bn=ar(vn);function Mt({teamDid:t,roles:p=[],apps:f=[],onCancel:y,onSuccess:C,onError:g=()=>{},endpoint:i=""}){const{api:c}=H(),{t:o,locale:u}=Z(),s=je({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:f.length>0?f[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),S=async()=>{if(!s.role){s.error=o("team.member.error.passportEmpty");return}const h=s.remark.trim();s.error=null,s.loading=!0;try{let I=s.sourceAppPid??null;I===t&&(I=null);const r={teamDid:t,role:s.role,remark:h,sourceAppPid:I,passportExpireTime:s.passportExpireTime?s.passportExpireTime.toISOString():""};s.display&&(r.display={type:"url",content:s.display});const{inviteInfo:n}=await c.createMemberInvitation({input:r});s.inviteInfo=n,s.activeStep=1}catch(I){const r=X(I);s.error=r,g(I)}finally{s.loading=!1}},v=p.find(h=>h.name===s.role),a=[{body:e.jsxs(D,{sx:{display:"flex",flexDirection:"column",gap:3},children:[f.length>1?e.jsxs(Fe,{fullWidth:!0,children:[e.jsx(Me,{children:o("common.sourceApp")}),e.jsx(We,{value:s.sourceAppPid,onChange:h=>{s.error=null,s.sourceAppPid=h.target.value},fullWidth:!0,label:o("common.passport"),disabled:s.loading,children:f.map(h=>e.jsx(ye,{value:h.appPid,children:e.jsxs(D,{sx:{display:"flex",justifyContent:"space-between",gap:2,width:"100%"},children:[e.jsxs(D,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(Er,{did:h.appPid,size:28}),h.appName]}),e.jsx(Dr,{did:h.appPid,compact:!0,responsive:!1})]})},h.appPid))})]}):null,e.jsxs(Fe,{fullWidth:!0,variant:"outlined",children:[e.jsx(Me,{children:o("common.passport")}),e.jsx(We,{"data-cy":"invite-member-select-role",value:s.role,onChange:h=>{s.error=null,s.role=h.target.value},fullWidth:!0,label:o("common.passport"),disabled:s.loading,onKeyPress:h=>{h.key==="Enter"&&(h.preventDefault(),S())},children:p.filter(h=>h.name!=="owner").map(h=>e.jsx(ye,{value:h.name,"data-cy":`invite-member-select-option-${h.name}`,children:e.jsxs(D,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(G,{variant:"subtitle1",children:h.title||h.name}),e.jsx(G,{variant:"caption",sx:{opacity:.7},children:h.description})]})},h.name))})]}),v?.extra?.display==="custom"&&e.jsx(de,{label:o("common.display"),type:"url",value:s.display,onChange:h=>{s.error=null,s.display=h.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),e.jsx(de,{label:o("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:s.remark,onChange:h=>{s.error=null,s.remark=h.target.value},disabled:s.loading,"data-cy":"invite-member-input-remark"}),e.jsx(Lt,{value:s.passportExpireTime,onChange:h=>{s.passportExpireTime=h}})]}),cancel:o("common.cancel"),confirm:o("team.member.inviteDialog.createInviteLink"),onCancel:y,onConfirm:S},{body:()=>{const h=be({inviteId:s.inviteInfo?.inviteId,endpoint:i});return e.jsxs("div",{children:[e.jsx(D,{sx:{fontSize:16,fontWeight:"bold"},children:o("team.member.inviteDialog.createSuccessTip",{expireDate:ue(s.inviteInfo?.expireDate,u)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Se,{children:h})]})},confirm:o("common.copy"),onConfirm:()=>{const h=be({inviteId:s.inviteInfo?.inviteId,endpoint:i});Gr(h),Y.success(o("common.copied")),C()},cancel:o("common.cancel"),onCancel:y}][s.activeStep];return e.jsxs(te,{title:o("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[a.cancel&&e.jsx(q,{onClick:a.onCancel,color:"inherit",children:a.cancel}),e.jsxs(q,{onClick:a.onConfirm,color:"primary",disabled:s.loading||!s.role,variant:"contained",autoFocus:!0,children:[s.loading&&e.jsx(ie,{size:16}),a.confirm]})]}),children:[e.jsx(He,{component:"div",children:typeof a.body=="function"?a.body():a.body}),!!s.error&&e.jsx(se,{severity:"error",variant:"icon",children:s.error})]})}Mt.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 Wt({teamDid:t,onCancel:p,onSuccess:f,onError:y=()=>{},endpoint:C=""}){const{api:g,info:i}=H(),{api:c}=x.useContext(Mr),[o,u]=x.useState(!1),{t:s,locale:S}=Z(),[v,k]=x.useState(""),[a,h]=x.useState(!1),[I,r]=x.useState(0),[n,l]=x.useState(""),[d,m]=x.useState(""),P=!!_e(i,"ownerNft.did"),w=rn(async()=>{if(P){const{state:W}=await g.getDelegationState();return W}return{delegated:!0}});if(w.loading)return e.jsx(te,{title:s("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:p,children:e.jsx("div",{style:{display:"flex",justifyContent:"center"},children:e.jsx(ie,{})})});if(w.error)return e.jsx(te,{title:s("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:p,children:e.jsx(se,{severity:"error",variant:"icon",children:X(w.error)})});const L=async()=>{k(null),u(!0);try{const{inviteInfo:W}=await g.createTransferInvitation({input:{teamDid:t,role:"owner",remark:d.trim()}});l(W),r(N.length-1)}catch(W){const V=X(W);k(V),y(W)}finally{u(!1)}},T=()=>{h(!0),r(1)},E=()=>{h(!1),r(0)},N=[{body:e.jsxs(G,{component:"div",children:[e.jsxs(se,{severity:"warning",children:[e.jsx(G,{children:s("team.transferNode.inviteDialog.tips.progress")}),e.jsx(G,{children:s("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),e.jsx(se,{severity:"warning",children:e.jsx(G,{children:s("team.transferNode.inviteDialog.tips.revoke")})}),e.jsx("div",{style:{marginTop:20,marginBottom:10}}),e.jsx(de,{label:s("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:d,onChange:W=>{k(null),m(W.target.value)},disabled:o,"data-cy":"transfer-node-input-remark"}),e.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:s("common.cancel"),confirm:s("team.transferNode.inviteDialog.createInviteLink"),onCancel:p,onConfirm:P&&!_e(w,"value.delegated")?T:L},{body:()=>e.jsx(Wr,{action:"delegate-transfer-nft",open:a,locale:S,checkFn:c.get,onClose:E,onSuccess:L,checkTimeout:5*60*1e3,webWalletUrl:_r(i),extraParams:{targetDID:i.did},messages:{title:s("team.transferNode.delegateDialog.title"),scan:s("team.transferNode.delegateDialog.scan"),confirm:s("team.transferNode.delegateDialog.confirm"),success:s("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const W=be({inviteId:n.inviteId,endpoint:C});return e.jsxs("div",{children:[e.jsx(Cn,{children:s("team.transferNode.inviteDialog.createSuccessTip",{expireDate:ue(n.expireDate,S)})}),e.jsx("div",{style:{marginTop:"40px"}}),e.jsx(Se,{children:W})]})},confirm:s("common.confirm"),onConfirm:f}],F=N[I];return e.jsxs(te,{title:s("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:e.jsxs(e.Fragment,{children:[F.cancel&&e.jsx(q,{onClick:F.onCancel,color:"inherit",children:F.cancel}),e.jsxs(q,{onClick:F.onConfirm,color:"primary",disabled:o,variant:"contained",autoFocus:!0,children:[o&&e.jsx(ie,{size:16}),F.confirm]})]}),children:[e.jsx(He,{component:"div",children:typeof F.body=="function"?F.body():F.body}),!!v&&e.jsx(se,{severity:"error",variant:"icon",children:v})]})}Wt.propTypes={teamDid:b.string.isRequired,onCancel:b.func.isRequired,onSuccess:b.func.isRequired,onError:b.func,endpoint:b.string};const Cn=$.div`
|
|
2
2
|
font-size: 16px;
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
`;function $e({passport:t,onDelete:p=null,...f}){return e.jsxs(jn,{...f,children:[t.title||t.name," ",!!p&&e.jsx(cr,{"data-cy":"delete-issuance",className:"delete",onClick:p})]})}$e.propTypes={passport:b.object.isRequired,onDelete:b.func};const jn=$.span`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l}from"./vendor-react-Dvs43sk9.js";import{T as C,$ as E,h as W,j as M}from"./vendor-ux-CUBj5GXM.js";import{k as y}from"./vendor-hooks-DTeIFVkk.js";import{j as e,ak as s,a6 as $,aX as w,b1 as P,y as L,x as _,bb as B,M as z,T as A,a$ as D,I as K,bc as F,Q as N,W as U}from"./vendor-mui-core-CcrDM-5l.js";import{c as S,U as k}from"./index-
|
|
1
|
+
import{r as l}from"./vendor-react-Dvs43sk9.js";import{T as C,$ as E,h as W,j as M}from"./vendor-ux-CUBj5GXM.js";import{k as y}from"./vendor-hooks-DTeIFVkk.js";import{j as e,ak as s,a6 as $,aX as w,b1 as P,y as L,x as _,bb as B,M as z,T as A,a$ as D,I as K,bc as F,Q as N,W as U}from"./vendor-mui-core-CcrDM-5l.js";import{c as S,U as k}from"./index-D6YhMyoB.js";import{a as q}from"./api-Rnh95Dt4.js";import{T as V}from"./table-tips-3_n5uR-X.js";import{u as G}from"./team-Bxi69lmr.js";import{u as H}from"./session-fyUi2EvV.js";import"./vendor-utils-BOkrEpKO.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BnbwP1kf.js";import"./use-mobile-B9FM-UBY.js";import"./isURL-CTW__dzu.js";function T({endpoint:i}){const[t,a]=l.useState("mcp-link"),x=k(),{api:h}=k(),{teamDid:m}=G(),{t:c,locale:p}=C(),{session:n}=H(),{data:u,run:o,loading:g}=y(()=>{const f={owner:S.SERVER_ROLES.ADMIN}[n?.user?.role]||n?.user?.role;return h.createAccessKey({input:{teamDid:m,passport:f,authType:"simple",remark:"Generated by MCP Servers"}})},{manual:!0}),{imgPrefix:r}=x,j=l.useMemo(()=>[{icon:e.jsx(s,{sx:{width:20,height:20},children:"🔗"}),value:"mcp-link",label:"MCP Link"},{icon:e.jsx(s,{component:"img",src:`${r}/mcp/claude.webp`,alt:"Claude",sx:{width:20,height:20}}),value:"claude",label:"Claude"},{icon:e.jsx(s,{component:"img",src:`${r}/mcp/cursor.png`,alt:"Cursor",sx:{width:20,height:20}}),value:"cursor",label:"Cursor"},{icon:e.jsx(s,{component:"img",src:`${r}/mcp/cline.png`,alt:"Cline",sx:{width:20,height:20}}),value:"cline",label:"Cline"},{icon:e.jsx(s,{component:"img",src:`${r}/mcp/roocline.png`,alt:"Roo Cline",sx:{width:20,height:20}}),value:"roo-cline",label:"Roo Cline"},{icon:e.jsx(s,{component:"img",src:`${r}/mcp/windsurf.png`,alt:"Windsurf",sx:{width:20,height:20}}),value:"windsurf",label:"Windsurf"},{icon:e.jsx(s,{component:"img",src:`${r}/mcp/witsy.png`,alt:"Witsy",sx:{width:20,height:20}}),value:"witsy",label:"Witsy"}],[r]),v=j.find(d=>d.value===t),b=l.useMemo(()=>u?.data?.accessKeySecret,[u]),R=l.useMemo(()=>!b&&t!=="mcp-link",[b,t]),I=d=>{const f=`npx @blocklet/install-mcp@latest i ${i} --client ${d} --streamableHTTP --oauth2Bearer ${b}`;switch(d){case"cursor":case"claude":case"cline":case"roo-cline":case"windsurf":case"witsy":return f;case"mcp-link":default:return i}};return e.jsxs(s,{children:[e.jsx(W,{tabs:j,current:t,onChange:a,scrollButtons:"auto",iconPosition:"start"}),e.jsxs(s,{children:[e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx(A,{component:"span",variant:"h6",sx:{fontWeight:"bold",my:2},children:t==="mcp-link"?v?.label:`${v?.label} ${c("installCommand")}`}),t!=="mcp-link"&&e.jsx(D,{href:`https://www.arcblock.io/docs/blocklet-developer/${p}/mcp-${t}`,target:"_blank",rel:"noopener noreferrer",children:e.jsx(K,{size:"small",children:e.jsx(F,{fontSize:"small"})})})]}),e.jsxs(s,{className:"mcp-servers-codeblock",sx:{maxWidth:1100,position:"relative","& pre":{borderRadius:1},"& .codeblock__inner":{overflow:"auto !important",borderRadius:1}},children:[e.jsx(M,{code:I(t),language:"shell",style:{margin:0}}),R&&e.jsx(s,{sx:{position:"absolute",top:0,right:0,left:0,bottom:0,display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"action.active",backdropFilter:"blur(3px)",WebkitBackdropFilter:"blur(3px)",zIndex:1},children:g?e.jsx($,{}):e.jsx(N,{variant:"contained",color:"primary",onClick:o,size:"small",children:`${c("common.generate")} ${c("command")}`})})]})]})]})}T.propTypes={endpoint:U.string.isRequired};function ie(){const[i,t]=l.useState(null),{t:a,locale:x}=C(),h=`${window?.blocklet?.appUrl}${S.WELLKNOWN_SERVICE_PATH_PREFIX}/mcp/servers`,{data:m,loading:c,error:p}=y(()=>Promise.all([q.get(h)])),n=l.useMemo(()=>m?.[0]?.data?.servers||[],[m]);l.useEffect(()=>{n?.length&&t(n.find(o=>o.did===window?.blocklet?.did)||n[0])},[n]);const u=o=>{const g=o.target.value;t(n.find(r=>r.did===g))};return c?e.jsx(s,{children:e.jsx($,{})}):p?e.jsx(w,{color:"error",children:p?.message}):n?.length?e.jsxs(P,{sx:{gap:2,maxWidth:1200},children:[e.jsx(V,{title:a("mcp.listTitle"),tooltipTitle:a("mcp.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${x}/mcp-server`}),e.jsxs(L,{fullWidth:!0,children:[e.jsx(_,{id:"server-select-label",children:a("mcp.available")}),e.jsx(B,{labelId:"server-select-label",value:i?.did||"",label:a("mcp.available"),onChange:u,children:n.map(o=>e.jsx(z,{value:o.did,children:e.jsxs(s,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(E,{variant:"rounded",shape:"square",did:o.did,src:o.logo,size:20}),e.jsx(s,{sx:{fontSize:14},children:o.name})]})},o.did))})]}),i&&e.jsx(T,{endpoint:i.endpoint})]}):e.jsx(w,{color:"warning",children:a("mcp.noServer")})}export{ie as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as C,g as _e,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k as re}from"./vendor-hooks-DTeIFVkk.js";import{j as e,ak as g,at as q,b1 as ee,a6 as _,aX as Me,am as K,cw as ft,U as xt,T as E,a3 as ht,W as T,z as $,M as ae,I as W,cF as $e,cg 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-CcrDM-5l.js";import{T as F,a as H,h as wt,J as fe,B as le,H as R,n as L,G as xe,F as Ue,s as Ge,a0 as Dt,a9 as Ie,S as It,W as Pt}from"./vendor-ux-CUBj5GXM.js";import{U as k,p as Rt,ad as Ve,c as U,ap as J,a1 as kt,aE as At,f as Ft,R as Nt,af as se,b6 as Lt,b9 as Ye}from"./index-
|
|
1
|
+
import{r as C,g as _e,a as ut}from"./vendor-react-Dvs43sk9.js";import{g as mt,k as re}from"./vendor-hooks-DTeIFVkk.js";import{j as e,ak as g,at as q,b1 as ee,a6 as _,aX as Me,am as K,cw as ft,U as xt,T as E,a3 as ht,W as T,z as $,M as ae,I as W,cF as $e,cg 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-CcrDM-5l.js";import{T as F,a as H,h as wt,J as fe,B as le,H as R,n as L,G as xe,F as Ue,s as Ge,a0 as Dt,a9 as Ie,S as It,W as Pt}from"./vendor-ux-CUBj5GXM.js";import{U as k,p as Rt,ad as Ve,c as U,ap as J,a1 as kt,aE as At,f as Ft,R as Nt,af as se,b6 as Lt,b9 as Ye}from"./index-D6YhMyoB.js";import{W as he}from"./did-address-DrmEnz9K.js";import{u as M}from"./team-Bxi69lmr.js";import{a as ge,r as ye,b as je,c as Ke,d as ne,e as Bt,u as zt,f as Et}from"./passport-item-CPGYYOeu.js";import{p as Ze}from"./util-DhFzZqQY.js";import{u as _t}from"./use-mobile-B9FM-UBY.js";import{v as Q}from"./index-D8gGAVdB.js";import{w as G,P as Je}from"./permission-B0EjzZOA.js";import{C as Mt}from"./Google-kE2qbn1K.js";import{A as $t}from"./vendor-arcblock-BnbwP1kf.js";import{G as Z,a0 as Ot,H as Wt}from"./vendor-utils-BOkrEpKO.js";import{e as oe}from"./edit.svg-DycWG9v3.js";import{C as ve}from"./confirm-5e46DDlz.js";import{L as Qe}from"./list-header-X0CL-_hO.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-fyUi2EvV.js";import"./isURL-CTW__dzu.js";import"./index-Ca2q4nT6.js";import"./base32-B9yl211y.js";import"./cloneDeep-DwV-xVQF.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 e,W as u,a6 as z,T as j,at as Ne,D as _e,cG as X,ao as V,cH as We,ak as S,b1 as K,a$ as Ke,s as xe,cI as be,cw as Ge,am as ge,cs as Fe,M as F,aO as Y,bW as Ye,aP as $,Q as $e,bh as qe,aR as He,cJ as Qe,cK as Je,cL as Xe,cM as Ve,c1 as he}from"./vendor-mui-core-CcrDM-5l.js";import{k as Ze,j as ke,a as ue}from"./vendor-hooks-DTeIFVkk.js";import{r as h,u as et}from"./vendor-react-Dvs43sk9.js";import{a1 as O,U as N,ad as D,R as M,aI as tt,aJ as st,ax as nt,c as I,v as ot}from"./index-
|
|
1
|
+
import{j as e,W as u,a6 as z,T as j,at as Ne,D as _e,cG as X,ao as V,cH as We,ak as S,b1 as K,a$ as Ke,s as xe,cI as be,cw as Ge,am as ge,cs as Fe,M as F,aO as Y,bW as Ye,aP as $,Q as $e,bh as qe,aR as He,cJ as Qe,cK as Je,cL as Xe,cM as Ve,c1 as he}from"./vendor-mui-core-CcrDM-5l.js";import{k as Ze,j as ke,a as ue}from"./vendor-hooks-DTeIFVkk.js";import{r as h,u as et}from"./vendor-react-Dvs43sk9.js";import{a1 as O,U as N,ad as D,R as M,aI as tt,aJ as st,ax as nt,c as I,v as ot}from"./index-D6YhMyoB.js";import{H as B,T as E,b as at,a0 as q,J as rt,K as it,n as le,h as ct}from"./vendor-ux-CUBj5GXM.js";import{u as lt}from"./use-mobile-B9FM-UBY.js";import{a as H,d as je,a1 as dt,c as pt,D as Ce,C as me}from"./vendor-utils-BOkrEpKO.js";import{o as we}from"./vendor-arcblock-BnbwP1kf.js";import{b as ut,u as mt,D as ft,c as de,a as xt}from"./index-ckUPtmoF.js";import"./index-D8gGAVdB.js";import"./index-BojVbZw0.js";import"./api-Rnh95Dt4.js";import{u as Be,C as gt,D as ht,a as St}from"./connect-to-DfxSuVNx.js";import{b as yt,c as bt,d as kt,i as jt,e as fe,f as Ct,h as wt,j as Bt}from"./spaces-Ci_JwPPC.js";import{f as Q}from"./index-DBs9Ljax.js";import{v as Dt}from"./index-DEDOywis.js";import{E as Et}from"./index-DLDRrQJH.js";import{x as Tt}from"./index-DRYJ0xIl.js";import{g as Se}from"./get-safe-url-D9ZX2qFm.js";import{S as It}from"./switch-control-Cd3JbWWV.js";import{C as Rt,u as Pt}from"./config-space-CT21iR_2.js";import{L as ye}from"./list-header-X0CL-_hO.js";import"./lottie-web-4koyQiv_.js";import"./index-CkuzlAat.js";async function vt({blockletDid:t,nodeApi:o,spaceGateways:a}){let s=!1;const i=await Promise.all(a.map(async n=>{let{name:r}=n;const l=await yt(n.endpoint);return!H(l)&&l!==r&&(r=l,s=!0),{...n,name:r}}));return s&&await Promise.all(i.filter(n=>n.did).map(n=>o.updateBlockletSpaceGateway({input:{did:t,where:{did:n.did},spaceGateway:{...n}}}))),i}function At({refresh:t}={}){const{blocklet:o}=O(),a=o?.meta?.did,{api:s}=N();return Ze(async()=>{if(!a)return[];const{spaceGateways:i}=await s.getBlockletSpaceGateways({input:{did:a}});return await vt({blockletDid:a,nodeApi:s,spaceGateways:i})??[]},{refreshDeps:[a,t],onError(i){i?.message?.includes("not logged")?console.warn(i):(console.error(i),B.error(Q(i)))}})}function De({deps:t,setLoading:o,backupDate:a}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:s}=O(),[i,n]=h.useState([]),{api:r}=N(),[l,d]=h.useMemo(()=>a?[D(a).startOf("day").toISOString(),D(a).endOf("day").toISOString()]:[D().startOf("year").toISOString(),D().endOf("day").toISOString()],[a]),c=je(async()=>{try{if(o(!0),!s){n([]);return}const{backups:m}=await r.getBlockletBackups({input:{did:s.meta.did,startTime:l,endTime:d}});n(m??[])}catch(m){console.error(m),B.error(Q(m))}finally{o(!1)}},1e3);return ke(async()=>{c()},[s?.meta?.did].concat(t)),{backups:i}}function zt({appDid:t}){const{backups:o}=De(),[a,s]=h.useState({message:"",progress:0,completed:!1}),i=N(),{ws:{useSubscription:n}}=i;return n(M.BlockletEvents.backupProgress,r=>{t===r?.appDid&&s(()=>({...r}))},[t]),h.useEffect(()=>{if(o?.length&&dt(o[0]?.status)){const[r]=o;s(()=>({message:r.message,progress:r.progress,completed:r.progress>=100}))}},[o]),a}function Ot({deps:t=[],setLoading:o=()=>{}}={}){const{blocklet:a}=O(),[s,i]=h.useState([]),{api:n}=N(),r=h.useCallback(je(async()=>{if(!n||!a?.meta?.did){i([]);return}try{o(!0);const l=D(),d=l.subtract(1,"year"),{summary:c}=await n.getBlockletBackupSummary({input:{did:a.meta.did,startTime:d.toISOString(),endTime:l.toISOString()}});i(Array.isArray(c)?c:[])}catch(l){console.error("Failed to fetch backup summary:",l),B.error(Q(l)),i([])}finally{o(!1)}},1e3),[]);return ke(async()=>(await r(),()=>{r.cancel()}),[a?.meta?.did].concat(t)),{backupSummary:s}}const Ee=h.createContext({}),{Provider:Ut,Consumer:ys}=Ee;function Te({children:t}){const{t:o}=E(),{api:a}=N(),{blocklet:s}=O(),[i,n]=h.useState(null),[r,l]=h.useState(!1),{data:d,loading:c,mutate:m}=At({refresh:r}),g=pt(d),f=zt({appDid:s?.appDid}),p=h.useMemo(()=>bt(s?.environments),[s?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(!1),{backups:Z}=De({deps:[y,i],setLoading:w,backupDate:i}),[ee,te]=h.useState(!1),{backupSummary:se}=Ot({deps:[ee]}),[_,L]=h.useState(d?.find(x=>x.endpoint===p)),T=s?.settings?.autoBackup,P=()=>{l(x=>!x)},ne=()=>{te(x=>!x)},oe=()=>{b(x=>!x)},G=async x=>{await a.updateAutoBackup({input:{did:s.meta.did,autoBackup:x}})},J=async()=>{await a.abortBlockletBackup({input:{appPid:s.meta.did}})},ae=async(x,A)=>{try{m(R=>{const v=[...R];return v.push({...x,loading:!0}),v}),await a.addBlockletSpaceGateway({input:{did:s.meta.did,spaceGateway:x}}),p!==A&&await a.configBlocklet({input:{did:[s.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:A}]}}),L(x),P(),B.success(o("storage.spaces.connectedWithName",{name:x?.name??"DID Spaces"}))}catch(R){throw console.error(R),m(v=>[...v].filter(W=>W.did!==x.did)),R}},re=async x=>{x&&(x.endpoint===p&&(await a.configBlocklet({input:{did:[s.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),T?.enabled&&await G({enabled:!1})),await a.deleteBlockletSpaceGateway({input:{did:s.meta.did,spaceGatewayDid:x?.did}}),m(A=>{const R=[...A];return R.splice(R.indexOf(x),1),R}),L(x),P())},ie=async x=>{await Promise.all([a.updateBlockletSpaceGateway({input:{did:s.meta.did,where:{did:x.did},spaceGateway:x}}),p!==x.endpoint&&a.configBlocklet({input:{did:[s.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:x.endpoint}]}})]),B.success(o("storage.spaces.connectedWithName",{name:x?.name??"DID Spaces"})),P()},C=x=>x?.endpoint===p;return e.jsx(Ut,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ae,deleteSpaceGateway:re,updateSpaceGateway:ie,refreshSpaceGateways:P,spaceGatewaysLoading:c,spaceGatewaysFirstLoading:g,spaceGatewayIsSelected:C,updateAutoBackup:G,abortBlockletBackup:J,backupEndpoint:p,backupProgress:f,backups:Z,backupSummary:se,refreshBackupSummary:ne,refreshBackups:oe,setBackupDate:n,backupsLoading:k,autoBackup:T},children:t})}Te.propTypes={children:u.any.isRequired};function U(){return h.useContext(Ee)}function Ie({...t}){const{blocklet:o}=O(),{info:a}=N(),{t:s}=E(),i=Be({blocklet:o}),n=tt(a),{spaceGateways:r,addSpaceGateway:l}=U(),d={checkFn:Ce.create({baseURL:me(window.location.origin,st())}).get,webWalletUrl:n,extraParams:{appPid:o.appPid,appDid:i.appDid,appName:i.appName,appDescription:i.appDescription,appUrl:i.appUrl,referrer:i.referrer,scopes:i.scopes,nodeDid:a.did}},c=async({endpoint:g,name:f,did:p})=>{const k=await kt(g);if(!await jt(k)){B.error(s("storage.spaces.gateway.add.invalidUrl"));return}if(r.some(b=>b.endpoint===g)){B.error(s("storage.spaces.gateway.add.duplicate",{name:f}));return}await l({name:f,did:p,url:k,endpoint:g},g)},m=async({spaceGateway:g})=>{try{await c(g)}catch(f){console.error(f),B.error(Q(f))}};return e.jsx(ut,{...t,connectScope:"app",options:d,onSuccess:m})}function Re({...t}){const{t:o}=h.useContext(at),{blocklet:a,loadingDiskInfo:s,actions:i}=O();if(h.useEffect(()=>{i?.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),a.diskInfo){const n=(d,c,m)=>e.jsxs(j,{children:[d," ",e.jsx("strong",{children:c?nt(c):"empty"})]}),r=a.environments.reduce((d,c)=>(d[c.key]=c.value,d),{}),l=[{key:"appDir",name:o("blocklet.diskInfo.appDir"),value:n(r.BLOCKLET_APP_DIR,a.diskInfo.app)},{key:"dataDir",name:o("blocklet.diskInfo.dataDir"),value:n(r.BLOCKLET_DATA_DIR,a.diskInfo.data)},{key:"logDir",name:o("blocklet.diskInfo.logDir"),value:n(r.BLOCKLET_LOG_DIR,a.diskInfo.log)},{key:"cacheDir",name:o("blocklet.diskInfo.cacheDir"),value:n(r.BLOCKLET_CACHE_DIR,a.diskInfo.cache)}];return e.jsx(Lt,{component:"div",...t,children:l.map(d=>e.jsx(Dt,{valueComponent:"div",nameWidth:120,name:d.name,children:d.value},d.key))})}return s?e.jsx(z,{}):e.jsx(j,{children:o("blocklet.diskInfo.empty")})}const Lt=Ne(j)``;function Pe(){const{t}=E(),{setBackupDate:o,backupSummary:a}=U(),s=mt({key:"lg"}),i=h.useRef(null),n=_e(),r=h.useCallback(c=>{o(c)},[o]),l=h.useMemo(()=>{const c=D().add(1,"day"),m=D().subtract(11,"month").startOf("month"),g=new Map(a.map(p=>[p.date,{date:p.date,successCount:p.successCount,errorCount:p.errorCount}])),f=[];for(let p=m.clone();D(p).isBefore(c);p=p.add(1,"day")){const k=p.format("YYYY-MM-DD");f.push(g.get(k)||{date:k,successCount:0,errorCount:0})}return f},[a]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=l[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</div>`].join(`
|
|
2
2
|
`)},backgroundColor:n.palette.background.paper,borderColor:n.palette.divider,textStyle:{color:n.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${n.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:X[600]},{min:-9,max:-6,color:X[500]},{min:-6,max:-3,color:X[400]},{min:-3,max:-1,color:X[300]},{min:0,max:0,color:n.palette.grey[200]},{min:1,max:3,color:V[300]},{min:3,max:6,color:V[400]},{min:6,max:9,color:V[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:V[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:n.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,color:n.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:n.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:n.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[D().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),D().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:l.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:n.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:We[200],color:"inherit"}}}}),[l,t,n]);return e.jsxs(e.Fragment,{children:[e.jsx(S,{ref:i,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(S,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(Et,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:c=>{c.componentType==="series"&&c.data&&r(c.data[0])}}})})}),e.jsx(S,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:s?2:5,mb:2},children:e.jsxs(K,{direction:s?"column":"row",spacing:s?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:s?"flex-start":"center"},children:[e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.failed")})]}),e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.without")})]}),e.jsxs(K,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.succeeded")})]})]})})]})}const Mt=xe(({className:t,...o})=>e.jsx(ge,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function ve({status:t,message:o="",createdAt:a}){const{t:s}=E(),i=t===I.BACKUPS.STATUS.PROGRESS&&D().diff(a,"hours")>=I.BACKUPS.TIMEOUT_HOURS,n=i&&s("common.timeoutError"),r=t===I.BACKUPS.STATUS.PROGRESS&&!i,l=t===I.BACKUPS.STATUS.SUCCEEDED&&!i;return r?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),s("common.progress")]}):l?e.jsx(q,{type:"success",children:s("common.succeeded")}):e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"error",children:s("common.failed")}),e.jsx(ge,{style:{display:"flex",alignItems:"center",flexShrink:0},title:o||n,children:e.jsx(be,{children:e.jsx(Fe,{style:{width:"24px",height:"24px"},color:"error"})})})]})}ve.propTypes={status:u.string.isRequired,message:u.string,createdAt:u.string.isRequired};function Ae({metadata:t={}}){const{t:o}=E();if(H(t))return e.jsx(q,{type:"success",children:o("common.succeeded")});const a=t.count||0,s=t.size||0,i=Tt(s,{iec:!0}),n=e.jsxs(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[o("common.fileCount"),": ",a]}),e.jsxs(j,{variant:"body2",children:[o("common.fileSize"),": ",i]})]});return e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(q,{type:"success",children:o("common.succeeded")}),e.jsx(Mt,{title:n,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(be,{children:e.jsx(Ge,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}Ae.propTypes={metadata:u.object};function ze(){const{t,locale:o}=E(),{spaceGateways:a,backups:s,backupsLoading:i}=U(),n=h.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:l=>{const{targetUrl:d,targetName:c,status:m,createdAt:g}=s[l],f=m===I.BACKUPS.STATUS.PROGRESS&&D().diff(g,"hours")>=I.BACKUPS.TIMEOUT_HOURS,p=m===I.BACKUPS.STATUS.SUCCEEDED&&!f,k=c||a.find(w=>d?.includes(fe(w?.endpoint)))?.name||"Unknown DID Space";return p?e.jsx(Ke,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:l=>{const d=t(l===0?"common.auto":"common.manual");return e.jsx(q,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:l=>D(l).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:l=>H(l)?"":D(l).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:l=>{const d=s?.[l]??{},{status:c,message:m,createdAt:g,metadata:f}=d,p=c===I.BACKUPS.STATUS.PROGRESS&&D().diff(g,"hours")>=I.BACKUPS.TIMEOUT_HOURS,k=c===I.BACKUPS.STATUS.PROGRESS&&!p,w=c===I.BACKUPS.STATUS.SUCCEEDED&&!p;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(z,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(Ae,{metadata:f}):e.jsx(ve,{status:c,message:m,createdAt:g})}}}],[s,a,t]),r=h.useMemo(()=>!s?.length,[s]);return e.jsx(e.Fragment,{children:r?e.jsx(S,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(rt,{title:"",loading:i,data:s,columns:n,emptyNode:t("storage.spaces.record.emptyData",o),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function Nt(){const{t}=E();return e.jsxs(S,{children:[e.jsxs(S,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(ft,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(Ie,{})]}),e.jsxs(S,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.spaces.backup.records")})}),e.jsx(Pe,{})]})]}),e.jsx(ze,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(Re,{})]})}function Oe({spaceGateway:t,onConfirm:o=()=>{},onCancel:a=()=>{}}){const{t:s}=E(),[i,n]=h.useState(!1),[r,l]=h.useState(!1),d=(g,f)=>{g?.preventDefault(),g?.stopPropagation(),n(f)},c=async g=>{try{g?.stopPropagation(),l(!0),await o?.(t),n(!1)}catch(f){console.error(f),B.error(`${s("storage.space.gateway.delete.failed")}: ${Q(f)}`)}finally{n(!1),l(!1)}},m=g=>{d(g,!1),a?.(g)};return e.jsxs(e.Fragment,{children:[e.jsxs(F,{color:"red",onClick:g=>d(g,!0),children:[e.jsx(Y,{style:{minWidth:24,color:"red"},children:e.jsx(Ye,{fontSize:"small"})}),e.jsx($,{style:{color:"red"},children:s("common.disconnect")})]}),e.jsx(it,{title:s("storage.spaces.gateway.delete.title"),open:i,confirmButton:{text:s("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:r}},cancelButton:{text:s("common.cancel"),props:{size:"small",variant:"outlined",disabled:r}},onConfirm:c,onCancel:m,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:s("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Oe.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool}).isRequired,onConfirm:u.func,onCancel:u.func};function Ue({spaceGateway:t,selected:o,onDelete:a=()=>{},onConnect:s=()=>{},enableSwitchToSpace:i=!0,backupInProgress:n=!1,...r}){const{abortBlockletBackup:l}=U(),[d,c]=h.useState(null),{t:m}=E(),[g,f]=h.useState(!1),p=(y,b)=>{y.stopPropagation(),y.preventDefault(),c(b&&y.currentTarget)},k=async y=>{try{f(!0),p(y,!1),await s(t)}catch(b){console.error(b),B.error(b.message)}finally{f(!1)}},w=async y=>{try{f(!0),p(y,!1),await l()}catch(b){console.error(b),B.error(b.message)}finally{f(!1)}};return e.jsxs(e.Fragment,{children:[g||t?.loading?e.jsx(z,{sx:{ml:1},size:"24px"}):e.jsx($e,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:y=>p(y,!0),...r,children:e.jsx(qe,{})}),e.jsxs(He,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>p(y,!1),children:[e.jsxs(F,{onClick:y=>{p(y,!1),window.open(Se(t.endpoint?Ct(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Qe,{fontSize:"small"})}),e.jsx($,{children:m("common.open")})]}),e.jsxs(F,{onClick:y=>{p(y,!1),window.open(Se(wt(t.endpoint),{allowDomains:null}))},children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Je,{fontSize:"small"})}),e.jsx($,{children:m("storage.spaces.strategy.viewBackupFiles")})]}),!o&&i&&e.jsxs(F,{onClick:k,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Xe,{fontSize:"small"})}),e.jsx($,{children:m("storage.spaces.connect.switchToSpace")})]}),n&&e.jsxs(F,{onClick:w,children:[e.jsx(Y,{style:{minWidth:24},children:e.jsx(Ve,{fontSize:"small"})}),e.jsx($,{children:m("storage.spaces.connect.abortBlockletBackup")})]}),!n&&e.jsx(Oe,{spaceGateway:t,onConfirm:async()=>{c(null),await a?.(t)},onCancel:()=>c(null)})]})]})}Ue.propTypes={spaceGateway:u.shape({name:u.string.isRequired,url:u.string.isRequired,protected:u.bool,endpoint:u.string.isRequired,loading:u.bool}).isRequired,selected:u.bool.isRequired,enableSwitchToSpace:u.bool,onDelete:u.func,onConnect:u.func,backupInProgress:u.bool};const _t=xe(({className:t,...o})=>e.jsx(ge,{...o,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Le({spaceGateway:t,spaceStatus:o,selected:a,onConnected:s=()=>{},onDeleted:i=()=>{},onBackedUp:n=()=>{}}){const{t:r,locale:l}=E(),{blocklet:d}=O(),{api:c,info:{did:m}}=N(),{appDid:g,appName:f,appDescription:p,scopes:k,appUrl:w,referrer:y}=Be({blocklet:d}),{backupProgress:b,updateSpaceGateway:Z,deleteSpaceGateway:ee,refreshBackupSummary:te,refreshBackups:se}=U(),[_,L]=h.useState(!1),[T,P]=h.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:r("storage.spaces.authorize.title",{appName:f},l),scan:r("storage.spaces.authorize.scan",{appName:f},l),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:r("storage.spaces.authorize.success")})},onClose:()=>{P(C=>({...C,open:!1}))}}),ne=a&&!_&&o===de.DISCONNECTED,oe=a&&!_&&!t.loading&&o===de.CONNECTED,G=a&&_&&o===de.CONNECTED&&b?.progress>=0,J=async()=>{try{if(await Bt(t?.endpoint)){await c.configBlocklet({input:{did:[d.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(r("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),s?.(null,t);return}}catch(C){console.error(C),s?.(C,t);return}P(C=>({...C,open:!0,prefix:me(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:Ce.create({baseURL:me(t.url,"space")}).get,extraParams:{appDid:g,appName:f,appDescription:p,scopes:k,appUrl:w,referrer:y,nodeDid:m,spaceDid:t.did}}))},ae=async(C,x)=>{const A=x(C.endpoint),R=fe(A),v=C.space?x(C.space):{};if(t.did&&R!==t.did){P(Me=>({...Me,open:!1}));const W=r("storage.spaces.gateway.switch.failedForMismatchSpace",{name:v?.name?v.name:""});B.error(W),s?.(new Error(W),t);return}const ce={...t,name:v.name??"DID Space",did:v.did??fe(A),endpoint:A};await Z(ce),P(W=>({...W,open:!1})),s?.(null,ce)},re=async()=>{try{if(_)return;L(!0),await c.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),n?.(C,t)}finally{L(!0)}},ie=async()=>{try{await ee(t),B.success(r("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),i?.(null,t)}catch(C){console.error(C),i?.(C,t)}};return h.useEffect(()=>{b?.completed?(a&&(b?.progress===100?(B.success(r("storage.spaces.backupSuccessfully")),n?.(null,t)):b.message&&n?.(new Error(b?.message),t),b.progress=0,b.message=""),L(!1),setTimeout(()=>{te(),se()},1e3)):b.progress&&L(!0)},[b]),e.jsxs(e.Fragment,{children:[e.jsxs(S,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[oe&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:re,children:r("storage.spaces.strategy.backupNow")}),ne&&e.jsx(le,{className:"action-btn",variant:"outlined",size:"small",onClick:J,children:r("storage.spaces.disconnected.reconnectNow")}),G&&e.jsx(_t,{title:b?.message&&e.jsx(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:b.message})}),children:e.jsxs(le,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(z,{variant:"determinate",value:b?.progress,size:14,sx:{mr:1}}),b?.progress,"%"]})}),e.jsx(ot,{forceConnected:!1,saveConnect:!1,prefix:T.prefix,open:T.open,popup:!0,action:T.action,baseUrl:T.baseUrl,checkFn:T.checkFn,onSuccess:ae,onClose:T.onClose,checkTimeout:T.checkTimeout,extraParams:T.extraParams,messages:T.messages,locale:l},"get-endpoint")]}),e.jsx(Ue,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:a,onDelete:ie,onConnect:J,enableSwitchToSpace:b?.completed||H(b?.message),backupInProgress:G})]})}Le.propTypes={spaceGateway:u.shape({did:u.string.isRequired,name:u.string.isRequired,url:u.string.isRequired,endpoint:u.string.isRequired,protected:u.bool,loading:u.bool}).isRequired,spaceStatus:u.string.isRequired,selected:u.bool.isRequired,onConnected:u.func,onDeleted:u.func,onBackedUp:u.func};function Wt({...t}){const{t:o}=E();return e.jsxs(S,{...t,children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:o("storage.spaces.backup.records")})}),e.jsx(Pe,{}),e.jsx(ze,{})]})}function Kt({...t}){const{t:o}=E(),{autoBackup:a,updateAutoBackup:s}=U(),i=async()=>{try{const n=!a?.enabled;await s({enabled:n}),B.success(o(n?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(n){B.error(n.message)}};return e.jsx(It,{checked:!!a?.enabled,onChange:i,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:o("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function Gt(){const{t}=E(),{spaceGateways:o,spaceGatewaysLoading:a,spaceGatewayIsSelected:s}=U(),i=a&&!o?.length,n=({spaceGateway:r,spaceStatus:l,selected:d,refresh:c})=>e.jsx(Le,{spaceGateway:r,spaceStatus:l,selected:d,onConnected:()=>c(),onBackedUp:m=>m&&c()});return e.jsxs(S,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1},children:t("storage.spaces.connected.title")}),e.jsx(Kt,{}),e.jsx(Ie,{})]}),e.jsx(S,{sx:{mt:2},children:i?e.jsx(S,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(z,{})}):e.jsx(he,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:o.map(r=>e.jsx(he,{size:{xs:12,md:6},children:e.jsx(xt,{endpoint:r.endpoint,selected:s(r),action:n},r.endpoint)},r.endpoint))})})}),e.jsx(Wt,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(Re,{})]})}function Ft(){const{spaceGatewaysFirstLoading:t,spaceGateways:o}=U();return t?e.jsx(we,{relative:"parent",children:e.jsx(z,{})}):H(o)?e.jsx(Nt,{}):e.jsx(Gt,{})}function Yt(){return e.jsx(Te,{children:e.jsx(Ft,{})})}function $t(){const{spaceGateway:t,settingStorageEndpoint:o,updateSpaceGateway:a,hasStorageEndpoint:s,loading:i,storageEndpoint:n}=Pt(),r=ue(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return i?e.jsx(we,{relative:"parent",children:e.jsx(z,{})}):e.jsxs(S,{sx:{maxWidth:"md",position:"relative"},children:[s?e.jsx(gt,{spaceGateway:t,settingStorageEndpoint:o}):e.jsx(ht,{}),e.jsx(S,{sx:r,children:e.jsx(St,{onConnect:a,storageEndpoint:n})})]})}function qt(){const{t}=E();return e.jsxs(Rt,{children:[e.jsxs(K,{spacing:1,sx:{marginBottom:2},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.appLevel.title")}),e.jsx(j,{sx:{color:"text.secondary"},children:t("storage.appLevel.description")})]}),e.jsx($t,{})]})}function Ht({navOrientation:t="vertical",...o}){const{t:a,locale:s}=E(),{blocklet:i}=O(),n=lt({key:"md"}),[r,l]=et(),d=r.get("tab")||"backup",c=n?"horizontal":t,m=ue(()=>{const w=[{label:a("common.backup"),value:"backup"}],y=i?.capabilities?.didSpace;return(y===M.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||y===M.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:a("common.storage"),value:"storage"}),w},[s,c]),f=ue(()=>({backup:e.jsx(Yt,{}),storage:e.jsx(qt,{})}))[d],p=w=>{l(y=>(w==="backup"?y.delete("tab"):y.set("tab",w),y))};if(m.length<=1)return e.jsx(pe,{children:f});const k=e.jsx(ct,{tabs:m,current:d,orientation:c,onChange:p,sx:[{borderRight:1,height:"100%",borderColor:"divider"},c==="horizontal"&&{borderRight:0}]});if(c==="vertical")return e.jsx(S,{...o,children:e.jsxs(K,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(S,{sx:{flexShrink:0},children:e.jsx(ye,{left:k})}),e.jsx(S,{sx:{flexGrow:1,minWidth:0},children:e.jsx(pe,{sx:{mt:1},children:f})})]})});if(c==="horizontal")return e.jsxs(S,{...o,children:[e.jsx(ye,{left:k}),e.jsx(pe,{sx:{mt:2},children:f})]})}Ht.propTypes={navOrientation:u.oneOf(["vertical","horizontal"])};const pe=xe(S)`
|
|
3
3
|
position: relative;
|
|
4
4
|
min-height: 66vh;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{T as M,H as q,I as N,j as J,G as ve,J as Ce,W as Se}from"./vendor-ux-CUBj5GXM.js";import{s as Te,k as le,t as Ie}from"./vendor-hooks-DTeIFVkk.js";import{r as E,a as ae}from"./vendor-react-Dvs43sk9.js";import{j as e,Y as Re,bB as We,$ as ze,ak as p,z as se,T as C,a6 as F,aX as te,R as De,Q as H,b6 as ne,am as P,bd as _,a5 as Y,V as X,S as Z,b4 as Oe,U as L,I as B,cm as Ae,bf as Pe,a7 as $e,F as qe,W as t,b1 as R,a3 as ce,c1 as ee,cn as Le,aO as Me,aP as Be,co as Fe,cp as He,cq as Ne,s as oe,aU as Ue,aj as _e,J as Ke,cr as Ve,aZ as Je,ch as Ye,ca as Qe,cg as Ge}from"./vendor-mui-core-CcrDM-5l.js";import{B as de,a as pe,l as ue}from"./index-Bg6_NsC_.js";import{U as K,c as xe,ad as Xe,a1 as Ze,b1 as Q}from"./index-FrAYP-A_.js";import{u as V}from"./team-CD3vKVPJ.js";import{u as et}from"./use-mobile-B9FM-UBY.js";import{u as tt,C as G}from"./index.esm-JPZAjt0x.js";import{C as he,a as me,J as ot}from"./vendor-utils-BOkrEpKO.js";import{C as st}from"./confirm-CXK9v894.js";import{A as nt}from"./actions-DvIZNF27.js";import{T as ie}from"./table-tips-3_n5uR-X.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BnbwP1kf.js";import"./session-Ci_4G0CP.js";import"./isURL-BKM8U6hZ.js";import"./index-DBs9Ljax.js";const it=i=>{const[u,c]=E.useState(null),[b,r]=E.useState(!0),[w,x]=E.useState(null),j=window.blocklet?.appUrl,l=E.useMemo(()=>{const g={};return u&&(u.sources.forEach(y=>{g[y.did]={source:y,events:[],count:0}}),u.events.forEach(y=>{g[y.source]&&(g[y.source].events.push(y),g[y.source].count+=1)})),g},[u]),f=async()=>{try{if(r(!0),!j)return;const y=await(await fetch(he(j,xe.WELLKNOWN_SERVICE_PATH_PREFIX,"/openevent.json"))).json();c(y),x(null)}catch(g){x(g instanceof Error?g:new Error(String(g)))}finally{r(!1)}};return E.useEffect(()=>{f()},[j]),{openEvent:u,setOpenEvent:c,eventsBySource:l,loading:b,error:w,loadData:f}};function ge({eventsBySource:i,selectedEvents:u,setSelectedEvents:c,error:b=null}){const{t:r}=M(),[w,x]=E.useState({}),j=E.useMemo(()=>{const n={};return Object.entries(i).forEach(([a,{events:m}])=>{const v=m.filter(S=>u[`${S.type}-${S.source}`]).length;n[a]=v}),n},[i,u]),l=E.useMemo(()=>Object.values(j).reduce((n,a)=>n+a,0),[j]),f=E.useMemo(()=>Object.values(i).reduce((n,{events:a})=>n+a.length,0),[i]),g=(n,a)=>{a.stopPropagation(),x({...w,[n]:!w[n]})},y=n=>{const a=`${n.type}-${n.source}`;c(m=>({...m,[a]:!m[a]}))},z=(n,a)=>{const m={};n.forEach(v=>{const S=`${v.type}-${v.source}`;m[S]=!a}),c(v=>({...v,...m}))},T=n=>{const a={};Object.values(i).forEach(({events:m})=>{m.forEach(v=>{const S=`${v.type}-${v.source}`;a[S]=n.target.checked})}),c(a)};return e.jsxs(p,{sx:{width:"100%"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ne,{control:e.jsx(Y,{onChange:T,checked:l>0&&l===f}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[r("webhookEndpoint.selectAllEvents"),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx(P,{title:r("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(_,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(C,{variant:"body2",color:"primary",sx:{ml:"auto"},children:r("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(p,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(X,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(i).map(([n,{source:a,events:m,count:v}],S)=>{const D=j[n]>0,I=j[n]===m.length&&m.length>0,O=w[n];return e.jsxs(ae.Fragment,{children:[e.jsx(Z,{sx:{borderBottom:({palette:o})=>S<Object.keys(i).length-1?`1px solid ${o.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(p,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:o=>{o.target.closest(".MuiFormControlLabel-root")||g(n,o)},children:[e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:m.length>0&&e.jsx(ne,{control:e.jsx(Y,{checked:I,indeterminate:D&&!I,onChange:o=>{o.stopPropagation(),z(m,I)}}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[a.logo&&e.jsx(Oe,{src:a.logo,sx:{width:24,height:24}}),e.jsx(p,{children:a.title||n}),D&&e.jsx(L,{label:r("webhookEndpoint.selectedCount",{count:j[n]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:o=>`${o.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(p,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(C,{variant:"body2",sx:{color:"text.secondary",mr:1},children:r("webhookEndpoint.eventsCount",{count:v})}),m.length>0&&e.jsx(B,{size:"small",edge:"end",children:O?e.jsx(Ae,{}):e.jsx(Pe,{})})]})]})}),m.length>0&&e.jsx($e,{in:O,timeout:"auto",unmountOnExit:!0,children:e.jsx(X,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:m.map(o=>{const d=`${o.type}-${o.source}`,s=!!u[d];return e.jsx(Z,{dense:!0,sx:{py:.75},onClick:()=>y(o),children:e.jsxs(p,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(Y,{checked:s,sx:{mr:1}}),e.jsxs(p,{children:[e.jsx(C,{variant:"body1",sx:{cursor:"pointer",color:"text.primary"},children:o.type}),e.jsx(C,{variant:"caption",sx:{color:"text.secondary",display:"block",cursor:"pointer"},children:o.description})]})]})},d)})})})]},n)})})}),b&&e.jsx(qe,{error:!0,sx:{mt:1},children:b})]})}ge.propTypes={eventsBySource:t.objectOf(t.shape({source:t.shape({did:t.string.isRequired,title:t.string,description:t.string,version:t.string,logo:t.string}).isRequired,events:t.arrayOf(t.shape({type:t.string.isRequired,description:t.string.isRequired,source:t.string.isRequired})).isRequired,count:t.number.isRequired})).isRequired,selectedEvents:t.objectOf(t.bool).isRequired,setSelectedEvents:t.func.isRequired,error:t.string};function fe({id:i=null,url:u="",description:c="",enabledEvents:b=[],onSubmit:r,onClose:w=()=>{}}){const{t:x}=M(),[j,l]=E.useState({}),{teamDid:f}=V(),{api:g}=K(),{loading:y,error:z,eventsBySource:T}=it(),{control:n,handleSubmit:a,formState:{errors:m},reset:v,setValue:S,trigger:D}=tt({defaultValues:{url:"",description:""}});E.useEffect(()=>{const o=Object.values(j).some(d=>d);S("selectedEvents",o?"valid":""),D("selectedEvents")},[j,S,D]);const I=()=>{l({}),v(),w()},O=async o=>{const d=Object.keys(j).filter(h=>j[h]),s={url:o.url,description:o.description,enabledEvents:d.map(h=>{const[k,W]=h.split("-");return!k||!W?null:{type:k,source:W}}).filter(Boolean)};try{if(i){const h=await g.updateWebhookEndpoint({input:{teamDid:f,id:i,data:s}});q.success(`${x("webhookEndpoint.updateWebhook")} ${x("webhookEndpoint.success")}`),r(h)}else{const h=await g.createWebhookEndpoint({input:{teamDid:f,input:s}});q.success(`${x("webhookEndpoint.createWebhook")} ${x("webhookEndpoint.success")}`),r(h)}}catch(h){q.error(h?.message)}I()};return E.useEffect(()=>{v({url:u,description:c}),l(b.reduce((o,d)=>(o[`${d.type}-${d.source}`]=!0,o),{}))},[v,l,u,c,b]),e.jsx(Re,{open:!0,onClose:I,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:a(O),children:[e.jsx(We,{children:x(i?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(ze,{children:e.jsxs(p,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(G,{name:"url",control:n,rules:{required:x("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:x("webhookEndpoint.validation.urlInvalid")}},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.url.label"),fullWidth:!0,error:!!m.url,helperText:m.url?.message})}),e.jsx(G,{name:"description",control:n,rules:{required:x("webhookEndpoint.validation.descriptionRequired")},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!m.description,helperText:m.description?.message})}),e.jsx(G,{name:"selectedEvents",control:n,rules:{required:x("webhookEndpoint.validation.eventRequired")},render:({field:o})=>e.jsx("input",{type:"hidden",...o})}),!y&&T&&Object.keys(T).length>0&&e.jsx(ge,{eventsBySource:T,selectedEvents:j,setSelectedEvents:l,error:m.selectedEvents?.message}),!y&&(!T||Object.keys(T).length===0)&&e.jsx(C,{sx:{color:"text.secondary"},children:x("webhookEndpoint.noAvailableEvents")}),y&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(F,{size:20})}),z&&e.jsx(te,{severity:"error",children:x("webhookEndpoint.loadingError",{message:z?.message})})]})}),e.jsxs(De,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:I,children:x("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:x(i?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}fe.propTypes={onSubmit:t.func.isRequired,id:t.string,url:t.string,description:t.string,enabledEvents:t.arrayOf(t.shape({type:t.string.isRequired,source:t.string.isRequired})),onClose:t.func};function be(i){switch(i){case"enabled":return"success";case"disabled":default:return"default"}}const rt=(i="en")=>i==="tw"?"zh":i;function U(i,u="YYYY-MM-DD HH:mm:ss",c="en"){return i?Xe(i).locale(rt(c)).format(u):"-"}function lt(i){return typeof i=="number"?!1:me(i)}function at(i){return i>=200&&i<300}function A({value:i,label:u,tip:c="",divider:b=!1}){const r=lt(i);return e.jsxs(e.Fragment,{children:[e.jsxs(R,{direction:"column",alignItems:"flex-start",children:[e.jsxs(C,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[u,!!c&&e.jsx(P,{title:c,children:e.jsx(_,{fontSize:"small"})})]}),e.jsx(C,{component:"div",variant:"body1",color:r?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:r?"-":i})]}),b&&e.jsx(ce,{orientation:"vertical",flexItem:!0})]})}A.propTypes={label:t.oneOfType([t.string,t.node]).isRequired,value:t.oneOfType([t.string,t.node]).isRequired,tip:t.oneOfType([t.string,t.node]),divider:t.bool};function je({title:i,children:u=null,mb:c=1.5,mt:b=1.5}){return e.jsxs(R,{className:"section-header",direction:"row",sx:{justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,mb:c,mt:b,pb:1},children:[e.jsx(C,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:i}),u]})}je.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};const ct={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>'},dt=i=>{const u={};return i.forEach(c=>{const b=new Date(c.createdAt).toLocaleDateString();u[b]||(u[b]=[]),u[b]?.push(c)}),u};function ye({eventId:i="",webhookEndpointId:u="",event:c=null}){const{api:b,ws:{useSubscription:r}}=K(),{t:w}=M(),{teamDid:x}=V(),{blocklet:j}=Ze(),{data:l,loadMore:f,loadingMore:g,loading:y,mutate:z}=Te(s=>{const k=s?Math.ceil(s.list.length/15)+1:1;return b.getWebhookAttempts({input:{teamDid:x,input:{eventId:i,webhookId:u},paging:{page:k,pageSize:15}}})},{reloadDeps:[i,u]}),T=l?.list||[],[n,a]=E.useState(null),[m,v]=E.useState(!1),S=dt(T);if(E.useEffect(()=>{!n&&l?.list.length&&a(l.list[0])},[l?.list.length,n]),r(xe.EVENTS.WEBHOOK_ATTEMPT,s=>{z(h=>{if(h.list.find(W=>W.id===s.id)){const W=h.list.map($=>$.id===s.id?{...$,...s}:$);return{...h,list:W}}return s.endpoint=h.list[0]?.endpoint,s.event=h.list[0]?.event,{...h,list:[s,...h.list]}})},[]),y)return e.jsx(F,{});const D=l&&l.list.length<l.paging.total,I=async()=>{n&&(v(!0),await b.retryWebhookAttempt({input:{teamDid:x,eventId:n.event.id,webhookId:u,attemptId:n.id}}).finally(()=>{setTimeout(()=>{v(!1)},1e3)}))},O=s=>{if(s.responseBody&&s.responseBody?.sessionId&&s.responseBody?.projectId&&s.responseBody?.agentId){const h=j?.site?.domainAliases[0]?.value,k=(j.children||[]).find($=>$?.meta?.name==="ai-studio"),W=ot(he(`https://${h}`,k?.mountPoint||"","projects",s.responseBody.projectId,"logs/main"),{sessionId:s.responseBody.sessionId,agentId:s.responseBody.agentId});return e.jsx(B,{sx:{fontSize:20},onClick:()=>window.open(W,"_blank"),children:e.jsx(p,{component:N,icon:Q})})}return null},o=s=>s.status==="pending"?e.jsx(Fe,{color:"warning"}):at(s.responseStatus)?e.jsx(He,{color:"success"}):e.jsx(Ne,{color:"error"}),d=n?.triggeredFrom&&(l?.list||[]).find(s=>s.id===n.triggeredFrom);return e.jsxs(pt,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(ee,{size:{xs:12,md:4},sx:{height:1},children:me(Object.keys(S))?e.jsx(C,{sx:{color:"text.secondary"},children:w("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(X,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(S).map(([s,h])=>e.jsxs(ae.Fragment,{children:[e.jsx(Le,{sx:{p:0},children:s}),h.map(k=>e.jsxs(Z,{sx:{cursor:"pointer",px:1},onClick:()=>a(k),selected:n&&n?.id===k?.id,secondaryAction:e.jsx(C,{sx:{color:"text.secondary"},children:U(k.createdAt,"HH:mm:ss")}),children:[e.jsx(Me,{sx:{minWidth:0,mr:1.5},children:o(k)}),e.jsx(Be,{primary:e.jsx(C,{sx:{color:"text.primary"},children:k.event.type})})]},k.id))]},s))}),D&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:1},children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:f,disabled:g,sx:{color:s=>s.palette.text.disabled},children:w(g?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(ee,{size:{xs:12,md:8},sx:{height:1},children:[n&&e.jsxs(R,{direction:"column",spacing:2,sx:{height:1,overflow:"auto",pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"h4",children:w(`common.${n.status}`)}),e.jsx(p,{children:O(n)})]}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[d&&e.jsx(P,{placement:"left",title:e.jsxs(R,{onClick:()=>a(d),sx:{gap:1,cursor:"pointer",".did-address-text":{color:"common.white"}},children:[e.jsx(de,{showDid:!0,did:n.triggeredBy,cardType:ue.Detailed,infoType:pe.Minimal,sx:{border:0,padding:0,minWidth:0,".MuiTypography-root":{color:"common.white",fontWeight:400}}}),e.jsx(ce,{}),e.jsxs(p,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(C,{variant:"body2",sx:{color:"primary.main"},children:w("webhookEndpoint.triggeredFrom")}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"body2",children:n.id}),e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:Q,sx:{fontSize:16,color:"common.white"}})})]})]})]}),slotProps:{tooltip:{sx:{maxWidth:400}}},children:e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:Q,sx:{fontSize:16}})})}),e.jsxs(H,{variant:"outlined",color:"primary",size:"small",onClick:I,disabled:m,children:[e.jsx(p,{component:N,icon:ct,sx:{fontSize:16,animation:m?"spin 1s linear infinite":"none",mr:.5}}),w("notification.resend")]})]})]}),e.jsxs(p,{children:[e.jsxs(C,{variant:"h6",children:[w("webhookEndpoint.response")," (",n.responseStatus,")"]}),e.jsx(J,{language:"json",children:JSON.stringify(n.responseBody,null,2)})]}),e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.request")})}),e.jsx(J,{language:"json",sx:{margin:0},children:JSON.stringify(n.event,null,2)})]})]}),l?.list.length===0&&c&&e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.eventData")})}),e.jsx(J,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}ye.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};const pt=oe(ee)`
|
|
1
|
+
import{T as M,H as q,I as N,j as J,G as ve,J as Ce,W as Se}from"./vendor-ux-CUBj5GXM.js";import{s as Te,k as le,t as Ie}from"./vendor-hooks-DTeIFVkk.js";import{r as E,a as ae}from"./vendor-react-Dvs43sk9.js";import{j as e,Y as Re,bB as We,$ as ze,ak as p,z as se,T as C,a6 as F,aX as te,R as De,Q as H,b6 as ne,am as P,bd as _,a5 as Y,V as X,S as Z,b4 as Oe,U as L,I as B,cm as Ae,bf as Pe,a7 as $e,F as qe,W as t,b1 as R,a3 as ce,c1 as ee,cn as Le,aO as Me,aP as Be,co as Fe,cp as He,cq as Ne,s as oe,aU as Ue,aj as _e,J as Ke,cr as Ve,aZ as Je,ch as Ye,ca as Qe,cg as Ge}from"./vendor-mui-core-CcrDM-5l.js";import{B as de,a as pe,l as ue}from"./index-Ca2q4nT6.js";import{U as K,c as xe,ad as Xe,a1 as Ze,b1 as Q}from"./index-D6YhMyoB.js";import{u as V}from"./team-Bxi69lmr.js";import{u as et}from"./use-mobile-B9FM-UBY.js";import{u as tt,C as G}from"./index.esm-JPZAjt0x.js";import{C as he,a as me,J as ot}from"./vendor-utils-BOkrEpKO.js";import{C as st}from"./confirm-5e46DDlz.js";import{A as nt}from"./actions-DvIZNF27.js";import{T as ie}from"./table-tips-3_n5uR-X.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-BnbwP1kf.js";import"./session-fyUi2EvV.js";import"./isURL-CTW__dzu.js";import"./index-DBs9Ljax.js";const it=i=>{const[u,c]=E.useState(null),[b,r]=E.useState(!0),[w,x]=E.useState(null),j=window.blocklet?.appUrl,l=E.useMemo(()=>{const g={};return u&&(u.sources.forEach(y=>{g[y.did]={source:y,events:[],count:0}}),u.events.forEach(y=>{g[y.source]&&(g[y.source].events.push(y),g[y.source].count+=1)})),g},[u]),f=async()=>{try{if(r(!0),!j)return;const y=await(await fetch(he(j,xe.WELLKNOWN_SERVICE_PATH_PREFIX,"/openevent.json"))).json();c(y),x(null)}catch(g){x(g instanceof Error?g:new Error(String(g)))}finally{r(!1)}};return E.useEffect(()=>{f()},[j]),{openEvent:u,setOpenEvent:c,eventsBySource:l,loading:b,error:w,loadData:f}};function ge({eventsBySource:i,selectedEvents:u,setSelectedEvents:c,error:b=null}){const{t:r}=M(),[w,x]=E.useState({}),j=E.useMemo(()=>{const n={};return Object.entries(i).forEach(([a,{events:m}])=>{const v=m.filter(S=>u[`${S.type}-${S.source}`]).length;n[a]=v}),n},[i,u]),l=E.useMemo(()=>Object.values(j).reduce((n,a)=>n+a,0),[j]),f=E.useMemo(()=>Object.values(i).reduce((n,{events:a})=>n+a.length,0),[i]),g=(n,a)=>{a.stopPropagation(),x({...w,[n]:!w[n]})},y=n=>{const a=`${n.type}-${n.source}`;c(m=>({...m,[a]:!m[a]}))},z=(n,a)=>{const m={};n.forEach(v=>{const S=`${v.type}-${v.source}`;m[S]=!a}),c(v=>({...v,...m}))},T=n=>{const a={};Object.values(i).forEach(({events:m})=>{m.forEach(v=>{const S=`${v.type}-${v.source}`;a[S]=n.target.checked})}),c(a)};return e.jsxs(p,{sx:{width:"100%"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",mb:1,mt:1},children:[e.jsx(ne,{control:e.jsx(Y,{onChange:T,checked:l>0&&l===f}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",cursor:"pointer"},children:[r("webhookEndpoint.selectAllEvents"),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx(P,{title:r("webhookEndpoint.selectAllEventsTooltip"),placement:"right",children:e.jsx(_,{fontSize:"small",sx:{ml:.5,cursor:"help"}})})})]}),sx:{m:0}}),l>0&&e.jsx(C,{variant:"body2",color:"primary",sx:{ml:"auto"},children:r("webhookEndpoint.selectedEventsCount",{count:l})})]}),e.jsx(p,{sx:{maxHeight:"50vh",overflow:"auto"},children:e.jsx(X,{disablePadding:!0,sx:{border:"1px solid",borderColor:"divider",borderRadius:"4px"},children:Object.entries(i).map(([n,{source:a,events:m,count:v}],S)=>{const D=j[n]>0,I=j[n]===m.length&&m.length>0,O=w[n];return e.jsxs(ae.Fragment,{children:[e.jsx(Z,{sx:{borderBottom:({palette:o})=>S<Object.keys(i).length-1?`1px solid ${o.divider}`:"none",px:2,py:1.5,"&:hover":{bgcolor:"rgba(0, 0, 0, 0.02)"}},children:e.jsxs(p,{sx:{display:"flex",width:"100%",justifyContent:"space-between",alignItems:"center"},onClick:o=>{o.target.closest(".MuiFormControlLabel-root")||g(n,o)},children:[e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:m.length>0&&e.jsx(ne,{control:e.jsx(Y,{checked:I,indeterminate:D&&!I,onChange:o=>{o.stopPropagation(),z(m,I)}}),label:e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[a.logo&&e.jsx(Oe,{src:a.logo,sx:{width:24,height:24}}),e.jsx(p,{children:a.title||n}),D&&e.jsx(L,{label:r("webhookEndpoint.selectedCount",{count:j[n]}),size:"small",sx:{mt:"2px",height:"20px",fontSize:"12px",bgcolor:o=>`${o.palette.primary.main}20`,color:"primary.main",fontWeight:500}})]}),sx:{m:0,"& .MuiFormControlLabel-label":{flex:1}}})}),e.jsxs(p,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(C,{variant:"body2",sx:{color:"text.secondary",mr:1},children:r("webhookEndpoint.eventsCount",{count:v})}),m.length>0&&e.jsx(B,{size:"small",edge:"end",children:O?e.jsx(Ae,{}):e.jsx(Pe,{})})]})]})}),m.length>0&&e.jsx($e,{in:O,timeout:"auto",unmountOnExit:!0,children:e.jsx(X,{disablePadding:!0,sx:{pl:2,pr:2,py:1,bgcolor:"rgba(0, 0, 0, 0.01)"},children:m.map(o=>{const d=`${o.type}-${o.source}`,s=!!u[d];return e.jsx(Z,{dense:!0,sx:{py:.75},onClick:()=>y(o),children:e.jsxs(p,{sx:{display:"flex",alignItems:"flex-start",width:"100%"},children:[e.jsx(Y,{checked:s,sx:{mr:1}}),e.jsxs(p,{children:[e.jsx(C,{variant:"body1",sx:{cursor:"pointer",color:"text.primary"},children:o.type}),e.jsx(C,{variant:"caption",sx:{color:"text.secondary",display:"block",cursor:"pointer"},children:o.description})]})]})},d)})})})]},n)})})}),b&&e.jsx(qe,{error:!0,sx:{mt:1},children:b})]})}ge.propTypes={eventsBySource:t.objectOf(t.shape({source:t.shape({did:t.string.isRequired,title:t.string,description:t.string,version:t.string,logo:t.string}).isRequired,events:t.arrayOf(t.shape({type:t.string.isRequired,description:t.string.isRequired,source:t.string.isRequired})).isRequired,count:t.number.isRequired})).isRequired,selectedEvents:t.objectOf(t.bool).isRequired,setSelectedEvents:t.func.isRequired,error:t.string};function fe({id:i=null,url:u="",description:c="",enabledEvents:b=[],onSubmit:r,onClose:w=()=>{}}){const{t:x}=M(),[j,l]=E.useState({}),{teamDid:f}=V(),{api:g}=K(),{loading:y,error:z,eventsBySource:T}=it(),{control:n,handleSubmit:a,formState:{errors:m},reset:v,setValue:S,trigger:D}=tt({defaultValues:{url:"",description:""}});E.useEffect(()=>{const o=Object.values(j).some(d=>d);S("selectedEvents",o?"valid":""),D("selectedEvents")},[j,S,D]);const I=()=>{l({}),v(),w()},O=async o=>{const d=Object.keys(j).filter(h=>j[h]),s={url:o.url,description:o.description,enabledEvents:d.map(h=>{const[k,W]=h.split("-");return!k||!W?null:{type:k,source:W}}).filter(Boolean)};try{if(i){const h=await g.updateWebhookEndpoint({input:{teamDid:f,id:i,data:s}});q.success(`${x("webhookEndpoint.updateWebhook")} ${x("webhookEndpoint.success")}`),r(h)}else{const h=await g.createWebhookEndpoint({input:{teamDid:f,input:s}});q.success(`${x("webhookEndpoint.createWebhook")} ${x("webhookEndpoint.success")}`),r(h)}}catch(h){q.error(h?.message)}I()};return E.useEffect(()=>{v({url:u,description:c}),l(b.reduce((o,d)=>(o[`${d.type}-${d.source}`]=!0,o),{}))},[v,l,u,c,b]),e.jsx(Re,{open:!0,onClose:I,maxWidth:"lg",fullWidth:!0,sx:{"& .MuiDialog-paper":{minHeight:600}},children:e.jsxs("form",{onSubmit:a(O),children:[e.jsx(We,{children:x(i?"webhookEndpoint.editWebhookTitle":"webhookEndpoint.createWebhookTitle")}),e.jsx(ze,{children:e.jsxs(p,{sx:{display:"flex",flexDirection:"column",gap:2,mt:2},children:[e.jsx(G,{name:"url",control:n,rules:{required:x("webhookEndpoint.validation.urlRequired"),pattern:{value:/^(http|https):\/\/[^ "]+$/,message:x("webhookEndpoint.validation.urlInvalid")}},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.url.label"),fullWidth:!0,error:!!m.url,helperText:m.url?.message})}),e.jsx(G,{name:"description",control:n,rules:{required:x("webhookEndpoint.validation.descriptionRequired")},render:({field:o})=>e.jsx(se,{...o,label:x("webhookEndpoint.description.label"),fullWidth:!0,multiline:!0,minRows:2,maxRows:4,error:!!m.description,helperText:m.description?.message})}),e.jsx(G,{name:"selectedEvents",control:n,rules:{required:x("webhookEndpoint.validation.eventRequired")},render:({field:o})=>e.jsx("input",{type:"hidden",...o})}),!y&&T&&Object.keys(T).length>0&&e.jsx(ge,{eventsBySource:T,selectedEvents:j,setSelectedEvents:l,error:m.selectedEvents?.message}),!y&&(!T||Object.keys(T).length===0)&&e.jsx(C,{sx:{color:"text.secondary"},children:x("webhookEndpoint.noAvailableEvents")}),y&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px",width:"100%"},children:e.jsx(F,{size:20})}),z&&e.jsx(te,{severity:"error",children:x("webhookEndpoint.loadingError",{message:z?.message})})]})}),e.jsxs(De,{sx:{p:"8px 24px 24px"},children:[e.jsx(H,{onClick:I,children:x("common.cancel")}),e.jsx(H,{type:"submit",variant:"contained",color:"primary",children:x(i?"webhookEndpoint.updateWebhook":"webhookEndpoint.saveWebhook")})]})]})})}fe.propTypes={onSubmit:t.func.isRequired,id:t.string,url:t.string,description:t.string,enabledEvents:t.arrayOf(t.shape({type:t.string.isRequired,source:t.string.isRequired})),onClose:t.func};function be(i){switch(i){case"enabled":return"success";case"disabled":default:return"default"}}const rt=(i="en")=>i==="tw"?"zh":i;function U(i,u="YYYY-MM-DD HH:mm:ss",c="en"){return i?Xe(i).locale(rt(c)).format(u):"-"}function lt(i){return typeof i=="number"?!1:me(i)}function at(i){return i>=200&&i<300}function A({value:i,label:u,tip:c="",divider:b=!1}){const r=lt(i);return e.jsxs(e.Fragment,{children:[e.jsxs(R,{direction:"column",alignItems:"flex-start",children:[e.jsxs(C,{component:"div",variant:"body1",mb:1,color:"text.primary",sx:{fontWeight:500},children:[u,!!c&&e.jsx(P,{title:c,children:e.jsx(_,{fontSize:"small"})})]}),e.jsx(C,{component:"div",variant:"body1",color:r?"text.disabled":"text.secondary",sx:{width:"100%",minHeight:"24px"},children:r?"-":i})]}),b&&e.jsx(ce,{orientation:"vertical",flexItem:!0})]})}A.propTypes={label:t.oneOfType([t.string,t.node]).isRequired,value:t.oneOfType([t.string,t.node]).isRequired,tip:t.oneOfType([t.string,t.node]),divider:t.bool};function je({title:i,children:u=null,mb:c=1.5,mt:b=1.5}){return e.jsxs(R,{className:"section-header",direction:"row",sx:{justifyContent:"space-between",alignItems:"center",flexWrap:"wrap",gap:1,mb:c,mt:b,pb:1},children:[e.jsx(C,{variant:"h3",sx:{fontSize:{xs:"18px",md:"1.09375rem"}},component:"div",children:i}),u]})}je.propTypes={title:t.oneOfType([t.string,t.node]).isRequired,children:t.node,mb:t.number,mt:t.number};const ct={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4m-4 4a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/>'},dt=i=>{const u={};return i.forEach(c=>{const b=new Date(c.createdAt).toLocaleDateString();u[b]||(u[b]=[]),u[b]?.push(c)}),u};function ye({eventId:i="",webhookEndpointId:u="",event:c=null}){const{api:b,ws:{useSubscription:r}}=K(),{t:w}=M(),{teamDid:x}=V(),{blocklet:j}=Ze(),{data:l,loadMore:f,loadingMore:g,loading:y,mutate:z}=Te(s=>{const k=s?Math.ceil(s.list.length/15)+1:1;return b.getWebhookAttempts({input:{teamDid:x,input:{eventId:i,webhookId:u},paging:{page:k,pageSize:15}}})},{reloadDeps:[i,u]}),T=l?.list||[],[n,a]=E.useState(null),[m,v]=E.useState(!1),S=dt(T);if(E.useEffect(()=>{!n&&l?.list.length&&a(l.list[0])},[l?.list.length,n]),r(xe.EVENTS.WEBHOOK_ATTEMPT,s=>{z(h=>{if(h.list.find(W=>W.id===s.id)){const W=h.list.map($=>$.id===s.id?{...$,...s}:$);return{...h,list:W}}return s.endpoint=h.list[0]?.endpoint,s.event=h.list[0]?.event,{...h,list:[s,...h.list]}})},[]),y)return e.jsx(F,{});const D=l&&l.list.length<l.paging.total,I=async()=>{n&&(v(!0),await b.retryWebhookAttempt({input:{teamDid:x,eventId:n.event.id,webhookId:u,attemptId:n.id}}).finally(()=>{setTimeout(()=>{v(!1)},1e3)}))},O=s=>{if(s.responseBody&&s.responseBody?.sessionId&&s.responseBody?.projectId&&s.responseBody?.agentId){const h=j?.site?.domainAliases[0]?.value,k=(j.children||[]).find($=>$?.meta?.name==="ai-studio"),W=ot(he(`https://${h}`,k?.mountPoint||"","projects",s.responseBody.projectId,"logs/main"),{sessionId:s.responseBody.sessionId,agentId:s.responseBody.agentId});return e.jsx(B,{sx:{fontSize:20},onClick:()=>window.open(W,"_blank"),children:e.jsx(p,{component:N,icon:Q})})}return null},o=s=>s.status==="pending"?e.jsx(Fe,{color:"warning"}):at(s.responseStatus)?e.jsx(He,{color:"success"}):e.jsx(Ne,{color:"error"}),d=n?.triggeredFrom&&(l?.list||[]).find(s=>s.id===n.triggeredFrom);return e.jsxs(pt,{container:!0,spacing:{xs:0,md:1},sx:{height:1},children:[e.jsx(ee,{size:{xs:12,md:4},sx:{height:1},children:me(Object.keys(S))?e.jsx(C,{sx:{color:"text.secondary"},children:w("webhookEndpoint.waitingForEvents")}):e.jsxs(e.Fragment,{children:[e.jsx(X,{sx:{maxHeight:"calc(100% - 40px)",py:0,overflowY:"auto"},children:Object.entries(S).map(([s,h])=>e.jsxs(ae.Fragment,{children:[e.jsx(Le,{sx:{p:0},children:s}),h.map(k=>e.jsxs(Z,{sx:{cursor:"pointer",px:1},onClick:()=>a(k),selected:n&&n?.id===k?.id,secondaryAction:e.jsx(C,{sx:{color:"text.secondary"},children:U(k.createdAt,"HH:mm:ss")}),children:[e.jsx(Me,{sx:{minWidth:0,mr:1.5},children:o(k)}),e.jsx(Be,{primary:e.jsx(C,{sx:{color:"text.primary"},children:k.event.type})})]},k.id))]},s))}),D&&e.jsx(p,{sx:{display:"flex",justifyContent:"center",alignItems:"center",width:1},children:e.jsx(H,{variant:"text",type:"button",color:"inherit",onClick:f,disabled:g,sx:{color:s=>s.palette.text.disabled},children:w(g?"webhookEndpoint.loadingMore":"webhookEndpoint.loadMore")})})]})}),e.jsxs(ee,{size:{xs:12,md:8},sx:{height:1},children:[n&&e.jsxs(R,{direction:"column",spacing:2,sx:{height:1,overflow:"auto",pl:{xs:0,md:1},mt:{xs:2,md:0},borderLeft:{xs:"none"}},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"h4",children:w(`common.${n.status}`)}),e.jsx(p,{children:O(n)})]}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[d&&e.jsx(P,{placement:"left",title:e.jsxs(R,{onClick:()=>a(d),sx:{gap:1,cursor:"pointer",".did-address-text":{color:"common.white"}},children:[e.jsx(de,{showDid:!0,did:n.triggeredBy,cardType:ue.Detailed,infoType:pe.Minimal,sx:{border:0,padding:0,minWidth:0,".MuiTypography-root":{color:"common.white",fontWeight:400}}}),e.jsx(ce,{}),e.jsxs(p,{sx:{display:"flex",flexDirection:"column"},children:[e.jsx(C,{variant:"body2",sx:{color:"primary.main"},children:w("webhookEndpoint.triggeredFrom")}),e.jsxs(p,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx(C,{variant:"body2",children:n.id}),e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:Q,sx:{fontSize:16,color:"common.white"}})})]})]})]}),slotProps:{tooltip:{sx:{maxWidth:400}}},children:e.jsx(B,{onClick:()=>a(d),children:e.jsx(p,{component:N,icon:Q,sx:{fontSize:16}})})}),e.jsxs(H,{variant:"outlined",color:"primary",size:"small",onClick:I,disabled:m,children:[e.jsx(p,{component:N,icon:ct,sx:{fontSize:16,animation:m?"spin 1s linear infinite":"none",mr:.5}}),w("notification.resend")]})]})]}),e.jsxs(p,{children:[e.jsxs(C,{variant:"h6",children:[w("webhookEndpoint.response")," (",n.responseStatus,")"]}),e.jsx(J,{language:"json",children:JSON.stringify(n.responseBody,null,2)})]}),e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.request")})}),e.jsx(J,{language:"json",sx:{margin:0},children:JSON.stringify(n.event,null,2)})]})]}),l?.list.length===0&&c&&e.jsxs(p,{children:[e.jsx(R,{direction:"row",spacing:1,sx:{alignItems:"center"},children:e.jsx(C,{variant:"h6",children:w("webhookEndpoint.eventData")})}),e.jsx(J,{language:"json",sx:{margin:0},children:JSON.stringify(c.data,null,2)})]})]})]})}ye.propTypes={eventId:t.string,webhookEndpointId:t.string,event:t.shape({type:t.string,data:t.object,request:t.object,requestInfo:t.object})};const pt=oe(ee)`
|
|
2
2
|
@keyframes spin {
|
|
3
3
|
to {
|
|
4
4
|
transform: rotate(360deg);
|