@abtnode/blocklet-services 1.16.54-beta-20251021-070951-25e3083c → 1.16.54-beta-20251023-041534-36eec6b9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/api/routes/federated.js +24 -0
  2. package/api/routes/sign.js +12 -10
  3. package/dist/assets/{access-control-BoqKXv8e.js → access-control-BmkZggs1.js} +1 -1
  4. package/dist/assets/{add-component-core-sYAwjN9z.js → add-component-core-CidAYqFQ.js} +2 -2
  5. package/dist/assets/add-resource-BszfQD9Q.js +1 -0
  6. package/dist/assets/{addon-CS6YZSHC.js → addon-TGRc2Vdh.js} +1 -1
  7. package/dist/assets/{advanced-J_6wIjW2.js → advanced-z6hc2KCT.js} +1 -1
  8. package/dist/assets/{aigne-CxLs420v.js → aigne-BIQvWqOM.js} +1 -1
  9. package/dist/assets/{appearance-Bwlo2rIk.js → appearance-BzLdb4Sc.js} +1 -1
  10. package/dist/assets/{arrow-down.svg-D6V-7qfa.js → arrow-down.svg-MODRFVx5.js} +1 -1
  11. package/dist/assets/{audit-logs-drM5It_9.js → audit-logs-Cl-bNkcR.js} +2 -2
  12. package/dist/assets/{authorize-C2nAxV7L.js → authorize-BzeFkFJu.js} +1 -1
  13. package/dist/assets/{bind-account-BKkm4lat.js → bind-account-_0lZ55Wd.js} +1 -1
  14. package/dist/assets/{branding-BMzG8nKx.js → branding-B5oj0qeB.js} +4 -4
  15. package/dist/assets/{branding-ZGJRfDDo.js → branding-DoDUda2f.js} +1 -1
  16. package/dist/assets/{branding-LL49PkTZ.js → branding-Dqm4_pLp.js} +1 -1
  17. package/dist/assets/{bundle-avatar-DLTX9h1v.js → bundle-avatar-6vocOIEM.js} +1 -1
  18. package/dist/assets/{complete-D-B5H4ek.js → complete-6ncAuJRO.js} +2 -2
  19. package/dist/assets/{component-BRcD0ov6.js → component-CzrDGFhG.js} +2 -2
  20. package/dist/assets/{config-D_zbuwUO.js → config-B_1RoTD5.js} +2 -2
  21. package/dist/assets/{config-BBtGnVxO.js → config-CWk35jzL.js} +1 -1
  22. package/dist/assets/{config-Cbg3z3uP.js → config-cglRKVfL.js} +5 -5
  23. package/dist/assets/{config-navigation-C1GAik0L.js → config-navigation-BjZEBvGp.js} +2 -2
  24. package/dist/assets/{config-space-DAd9qYRh.js → config-space-ElduyMIL.js} +1 -1
  25. package/dist/assets/{confirm-G3RZHlkC.js → confirm-CCyde9UR.js} +1 -1
  26. package/dist/assets/{connect-BKAyVkDD.js → connect-B8LJC899.js} +1 -1
  27. package/dist/assets/{connect-BsaKZiRP.js → connect-d16VJhX0.js} +1 -1
  28. package/dist/assets/{connect-to-CEyhDVUe.js → connect-to-DFMCjDvl.js} +1 -1
  29. package/dist/assets/{dashboard-DmRLgkA_.js → dashboard-hUjcvjGc.js} +5 -5
  30. package/dist/assets/{delete-confirm-DfQxKTw0.js → delete-confirm-ByWYWBpJ.js} +1 -1
  31. package/dist/assets/{domain-BAM622YE.js → domain-CqmPBLqu.js} +1 -1
  32. package/dist/assets/{domain-action-card-CQGZ0jGR.js → domain-action-card-COLOBYv5.js} +2 -2
  33. package/dist/assets/{domains-CO0Aw1Yc.js → domains-7_Jcc0GV.js} +1 -1
  34. package/dist/assets/{email-Dl8yxP6V.js → email-DrO0w1g5.js} +1 -1
  35. package/dist/assets/engine-CLurioHW.js +1 -0
  36. package/dist/assets/{exchange-passport-D8yfPLJz.js → exchange-passport-B1ZA6rBu.js} +1 -1
  37. package/dist/assets/form-wpTsOG8s.js +16 -0
  38. package/dist/assets/{fuel-CplPFp5J.js → fuel-9IrEjTKa.js} +1 -1
  39. package/dist/assets/gen-access-key-DWpJ2PM3.js +1 -0
  40. package/dist/assets/{gen-simple-access-key-BtXjt6B3.js → gen-simple-access-key-C5t7cw8A.js} +1 -1
  41. package/dist/assets/{get-safe-url-BFcRpP-P.js → get-safe-url-D_AWm5Av.js} +1 -1
  42. package/dist/assets/{home-C4yo5X5x.js → home-BI8ZM8fe.js} +1 -1
  43. package/dist/assets/{iframe-BnDsbRZG.js → iframe-BLnlbwGJ.js} +1 -1
  44. package/dist/assets/{index-B4cuO9Xn.js → index--5OrdkOQ.js} +1 -1
  45. package/dist/assets/{index-CZin5K15.js → index-1Fl4YdzI.js} +1 -1
  46. package/dist/assets/{index-FASRIZyi.js → index-6LL6v88e.js} +82 -82
  47. package/dist/assets/{index-SEBP2NIP.js → index-B35nKjq_.js} +1 -1
  48. package/dist/assets/{index-DdsyasUE.js → index-BAQdLbt2.js} +1 -1
  49. package/dist/assets/{index-XxymBn5U.js → index-BBsl5ZA-.js} +3 -3
  50. package/dist/assets/{index-DOKjY-HO.js → index-BDZHkAtK.js} +4 -4
  51. package/dist/assets/{index-ClNZcPUD.js → index-BJuJR1d6.js} +1 -1
  52. package/dist/assets/{index-DGdrBC5v.js → index-BTYLNgIg.js} +1 -1
  53. package/dist/assets/{index-BXeml37I.js → index-BZt08NPA.js} +1 -1
  54. package/dist/assets/{index-C80zMKsC.js → index-Brw1ZqbM.js} +2 -2
  55. package/dist/assets/{index-C4jOkJlz.js → index-ByHRYHRi.js} +2 -2
  56. package/dist/assets/{index-CusWQN3w.js → index-C3uBHwNV.js} +2 -2
  57. package/dist/assets/{index-Bq0J1vuR.js → index-CVz4S2lR.js} +5 -5
  58. package/dist/assets/{index-CJ-XSW_L.js → index-CZ1Yx3jo.js} +2 -2
  59. package/dist/assets/{index-DPyXKBMU.js → index-C_VfTD7_.js} +1 -1
  60. package/dist/assets/{index-CBUhK5iP.js → index-Cq1G6V4o.js} +7 -7
  61. package/dist/assets/{index-C1Dar18k.js → index-D1kZimyP.js} +1 -1
  62. package/dist/assets/{index-Bg7omuZF.js → index-DMivv8mQ.js} +4 -4
  63. package/dist/assets/{index-DBAtORvP.js → index-DnCE0p-e.js} +1 -1
  64. package/dist/assets/{index-D1efASvL.js → index-DxtYTTQ8.js} +3 -3
  65. package/dist/assets/{index-CVsqBtJa.js → index-O3HjrK28.js} +1 -1
  66. package/dist/assets/{index-BnLQoeO-.js → index-Tj-TQRdt.js} +12 -12
  67. package/dist/assets/{index-BkN8Xhir.js → index-Vcmuw65p.js} +1 -1
  68. package/dist/assets/{index-B-TqDd4N.js → index-nLksTtQl.js} +2 -2
  69. package/dist/assets/{index-C2BTIEUf.js → index-sLWKw4-k.js} +4 -4
  70. package/dist/assets/{index-CjkeMMBV.js → index-z5QsHtdi.js} +2 -2
  71. package/dist/assets/{invitation-BUnl3HPw.js → invitation-DgdalJsP.js} +5 -5
  72. package/dist/assets/{invitations-C4hW9Ss3.js → invitations-DDhtDlDS.js} +2 -2
  73. package/dist/assets/{invite-C3ahxxD9.js → invite-CbGIM_fR.js} +1 -1
  74. package/dist/assets/{isURL-2pkMgw7e.js → isURL-QYZ6DN-H.js} +2 -2
  75. package/dist/assets/{issue-passport-Ciq2eM7I.js → issue-passport-Clnw75aG.js} +1 -1
  76. package/dist/assets/{item-O0rUCXMz.js → item-CQ92uUPm.js} +1 -1
  77. package/dist/assets/{landing-page-CG20_HOe.js → landing-page-BWuAhFDM.js} +1 -1
  78. package/dist/assets/{layout-1o45g_uH.js → layout-Bhte8u_h.js} +1 -1
  79. package/dist/assets/{list-C71-rjVf.js → list-BkhviwW7.js} +1 -1
  80. package/dist/assets/{list-DINgkvuD.js → list-RiAO6gAO.js} +1 -1
  81. package/dist/assets/{localization-DYkMU0eo.js → localization-DnNrkEg5.js} +1 -1
  82. package/dist/assets/{log-DqmR8QgI.js → log-BOyHTCdX.js} +1 -1
  83. package/dist/assets/{login-BI9XDtGo.js → login-2kXrDHWt.js} +1 -1
  84. package/dist/assets/{login-oauth-callback-DtnKE3JA.js → login-oauth-callback-oVImO8dN.js} +1 -1
  85. package/dist/assets/{logo-uploader-B4ZyAHbx.js → logo-uploader-DfUkJPxR.js} +1 -1
  86. package/dist/assets/{lost-passport-Bjk0xMLc.js → lost-passport-Bw_jEl_b.js} +2 -2
  87. package/dist/assets/{open-window-Dtxc-Syt.js → open-window-BxzYKico.js} +1 -1
  88. package/dist/assets/over-due-invoice-payment-CsPpOI2s.js +1 -0
  89. package/dist/assets/{overview-CknecGQX.js → overview-BTi13S1z.js} +2 -2
  90. package/dist/assets/{passport-C1l7yRXa.js → passport-SBkct7Jt.js} +1 -1
  91. package/dist/assets/{passport-item-Dysdq_0a.js → passport-item-D9cHe_dQ.js} +1 -1
  92. package/dist/assets/{permission-YVbPVhS_.js → permission-u25LanDC.js} +1 -1
  93. package/dist/assets/{preferences-BnD1O3qZ.js → preferences-BjrwkUUS.js} +1 -1
  94. package/dist/assets/{profile-embed-C-sTb3pJ.js → profile-embed-BHjA-MWv.js} +1 -1
  95. package/dist/assets/{publish-resource-DyVr3uUG.js → publish-resource-ChwvuWYP.js} +1 -1
  96. package/dist/assets/{runtime-CRB33yxr.js → runtime-BRt7d3Z2.js} +1 -1
  97. package/dist/assets/sdk-DYRnMi-y.js +1 -0
  98. package/dist/assets/{security-cMS5Z8Ta.js → security-DVMiopWt.js} +3 -3
  99. package/dist/assets/session-C2VeP2Dn.js +1 -0
  100. package/dist/assets/{setup-C01-2uXI.js → setup-Cf8Vk99f.js} +1 -1
  101. package/dist/assets/{simple-select-DN_9r-L2.js → simple-select-nZbZu-H6.js} +1 -1
  102. package/dist/assets/{spaces-BH2l_OkZ.js → spaces-C9G07rtA.js} +1 -1
  103. package/dist/assets/{start-BFh5jV0q.js → start-BrsxHvgJ.js} +1 -1
  104. package/dist/assets/{starting-progress-bX2MhHI_.js → starting-progress-CvdorBgk.js} +1 -1
  105. package/dist/assets/{status-Cchdz2Py.js → status-DdtUhbdl.js} +1 -1
  106. package/dist/assets/{step-actions-CcUwY5bt.js → step-actions-DJsm5fTL.js} +1 -1
  107. package/dist/assets/{studio-C0FYSJNq.js → studio-B4LIA7Jb.js} +1 -1
  108. package/dist/assets/{team-Bje0MaMX.js → team-DPdkokhk.js} +1 -1
  109. package/dist/assets/{traffic-CeSX-kN3.js → traffic-DWhRcWJE.js} +1 -1
  110. package/dist/assets/{transfer-Ja2mKjqd.js → transfer-DcJZ7Lnp.js} +1 -1
  111. package/dist/assets/{unsubscribe-Dmbg53P8.js → unsubscribe-g0X1OdQz.js} +1 -1
  112. package/dist/assets/use-app-logo-CmClyT44.js +1 -0
  113. package/dist/assets/{user-center-_0Nuo2NC.js → user-center-BOzwaiga.js} +5 -5
  114. package/dist/assets/{user-follower-rI_4OXB_.js → user-follower-CWzWNLhC.js} +1 -1
  115. package/dist/assets/{util-CVi4JaWM.js → util-Bl3AzodV.js} +1 -1
  116. package/dist/assets/{util-LPNcvj77.js → util-DiGoXrLh.js} +1 -1
  117. package/dist/assets/{wait-connect-DDuMthnp.js → wait-connect-C4aP5_2A.js} +1 -1
  118. package/dist/assets/{wizard-Boblk5Le.js → wizard-DCI1bZNe.js} +1 -1
  119. package/dist/assets/{wizard-components-DxHb4Zui.js → wizard-components-D-b0Baer.js} +2 -2
  120. package/dist/assets/{wrap-locale-DTDVuPVv.js → wrap-locale-BtqI4voa.js} +1 -1
  121. package/dist/assets/{zh-CeqvJ1eC.js → zh-D8HLkzym.js} +1 -1
  122. package/dist/index.html +1 -1
  123. package/dist/service-worker.js +1 -1
  124. package/package.json +36 -36
  125. package/dist/assets/add-resource-hzPcoJ0T.js +0 -1
  126. package/dist/assets/engine-9k0o50qZ.js +0 -1
  127. package/dist/assets/form-CNqHi73v.js +0 -16
  128. package/dist/assets/gen-access-key-BOCSj0Mk.js +0 -1
  129. package/dist/assets/over-due-invoice-payment-Bk50hmsa.js +0 -1
  130. package/dist/assets/sdk-Cl2zdl3A.js +0 -1
  131. package/dist/assets/session-Chl38-LD.js +0 -1
  132. package/dist/assets/use-app-logo-DhmCQsWv.js +0 -1
@@ -148,6 +148,28 @@ function syncUserProfile(user, { node, teamDid, dataDir }) {
148
148
  return syncSwitchProfile(user, { node, teamDid, dataDir, fields: [...SYNC_FIELDS, 'metadata', 'address'] });
149
149
  }
150
150
 
151
+ function banUser(user, { node, teamDid }) {
152
+ logger.info('Syncederated: ban user', { userDid: user.did, teamDid });
153
+ return node.updateUserApproval({
154
+ teamDid,
155
+ user: { did: user.did, approved: false },
156
+ options: {
157
+ includeFederated: false,
158
+ },
159
+ });
160
+ }
161
+
162
+ function unbanUser(user, { node, teamDid }) {
163
+ logger.info('Syncederated: unban user', { userDid: user.did, teamDid });
164
+ return node.updateUserApproval({
165
+ teamDid,
166
+ user: { did: user.did, approved: true },
167
+ options: {
168
+ includeFederated: false,
169
+ },
170
+ });
171
+ }
172
+
151
173
  /**
152
174
  * member 站点向 master 站点请求拉取一个用户信息
153
175
  */
@@ -161,6 +183,8 @@ const syncUserFnMaps = {
161
183
  disconnectAccount: syncDisconnectAccount,
162
184
  // 用户同步 profile
163
185
  syncProfile: syncUserProfile,
186
+ ban: banUser,
187
+ unban: unbanUser,
164
188
  };
165
189
 
166
190
  module.exports = {
@@ -133,9 +133,13 @@ function formatMessageForAudit(message) {
133
133
 
134
134
  function getWalletFromBlocklet({ blocklet, options = {} }) {
135
135
  const env = blocklet?.environmentObj || {};
136
- const appSk = env.BLOCKLET_APP_SK;
136
+
137
+ // Support keyType parameter ('sk' | 'psk'), default to 'sk'
138
+ const keyType = options.keyType || 'sk';
139
+ const appSk = keyType === 'psk' ? env.BLOCKLET_APP_PSK : env.BLOCKLET_APP_SK;
140
+
137
141
  if (!appSk) {
138
- throw new Error('BLOCKLET_APP_SK not found for blocklet');
142
+ throw new Error(`BLOCKLET_APP_${keyType.toUpperCase()} not found for blocklet`);
139
143
  }
140
144
 
141
145
  const type = options.type || env.BLOCKLET_APP_CHAIN_TYPE || env.BLOCKLET_WALLET_TYPE;
@@ -168,16 +172,17 @@ module.exports = {
168
172
  async (req, res) => {
169
173
  try {
170
174
  const { blocklet } = req;
171
- const { payload } = req.body || {};
175
+ const { payload, options } = req.body || {};
172
176
 
173
177
  if (payload === undefined) {
174
178
  res.status(400).json({ error: 'Payload is required' });
175
179
  return;
176
180
  }
177
181
 
178
- const wallet = getWalletFromBlocklet({ blocklet });
182
+ const wallet = getWalletFromBlocklet({ blocklet, options });
179
183
  const message = toSignablePayload(payload);
180
- const signature = await wallet.sign(message);
184
+ // Pass through additional sign parameters (encoding, hashBeforeSign)
185
+ const signature = await wallet.sign(message, options?.hashBeforeSign, options?.encoding);
181
186
 
182
187
  // Create audit log asynchronously (don't block response)
183
188
  const componentId = req.headers['x-component-did'];
@@ -285,6 +290,7 @@ module.exports = {
285
290
  return;
286
291
  }
287
292
 
293
+ // Pass options to getWalletFromBlocklet (already supports keyType)
288
294
  const wallet = getWalletFromBlocklet({ blocklet, options });
289
295
  const signature = await wallet.ethSign(data, hashBeforeSign);
290
296
 
@@ -369,11 +375,7 @@ module.exports = {
369
375
  })
370
376
  .catch((err) => logger.error('create remoteDeriveWallet audit log failed', { error: err }));
371
377
 
372
- res.json({
373
- address: userWallet.address,
374
- publicKey: userWallet.publicKey,
375
- type: userWallet.type,
376
- });
378
+ res.json(userWallet.toJSON());
377
379
  } catch (error) {
378
380
  logger.error('Failed to create wallet from app DID', {
379
381
  error,
@@ -1,4 +1,4 @@
1
- import{D as E,j as e,ak as l,y as h,bq as A,b6 as g,br as L,at as N,W as y}from"./vendor-mui-core-CnXrAOs3.js";import{r as m}from"./vendor-react-Dvs43sk9.js";import{V as I,H as j}from"./vendor-ux-DtnxszG_.js";import{A as b}from"./config-BBtGnVxO.js";import{a as O}from"./page-header-DCvzRay5.js";import{l as v,e as R,c as o,f as T}from"./index-FASRIZyi.js";import{S as Y}from"./layout-1o45g_uH.js";import{S as D}from"./step-actions-CcUwY5bt.js";import{S as P}from"./button-9InonP1B.js";import"./vendor-utils-cJEl_UEd.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DVRwGBYP.js";import"./content-layout-oyz1EqNZ.js";import"./use-mobile-DCNBsOlH.js";function W({onNext:a=()=>{}}){const C=E(),{t:n,locale:p}=I(),[i,c]=m.useState(!1),[S,d]=m.useState(""),{blocklet:r}=v();m.useEffect(()=>{const t=R.findServiceFromMeta(r.meta,o.NODE_SERVICES.AUTH);d(t?.config?.whoCanAccess||o.WHO_CAN_ACCESS.ALL)},[r]);const f=async t=>{let s=o.ACCESS_POLICY_PUBLIC;t===o.WHO_CAN_ACCESS.ALL?s=o.ACCESS_POLICY_PUBLIC:t===o.WHO_CAN_ACCESS.INVITED?s=o.ACCESS_POLICY_INVITED_ONLY:t===o.WHO_CAN_ACCESS.OWNER?s=o.ACCESS_POLICY_OWNER_ONLY:t===o.WHO_CAN_ACCESS.ADMIN&&(s=o.ACCESS_POLICY_ADMIN_ONLY);try{c(!0),await T.updateBlockletSecurityRule({input:{did:r.meta.did,data:{id:o.SECURITY_RULE_DEFAULT_ID,accessPolicyId:s}}}),c(!1)}catch(_){c(!1),j.error(_.message)}},x=async t=>{i||(d(t.target.value),await f(t.target.value))},u={marginRight:4,fontSize:18,verticalAlign:"text-bottom",color:C.palette.text.secondary};return e.jsxs(k,{children:[e.jsx(l,{className:"header",children:e.jsx(O,{title:n("blocklet.config.access.title"),subTitle:n("blocklet.config.access.description")})}),e.jsx(l,{className:"form-container",children:e.jsx(h,{component:"fieldset",children:e.jsx(A,{name:"inherit",value:S,onChange:x,children:b.map(t=>e.jsxs(l,{sx:{mb:2,"&:last-child":{mb:0}},children:[e.jsx(g,{value:t.value,control:e.jsx(L,{size:"small",color:"primary"}),label:e.jsxs("span",{style:{display:"flex",alignItems:"center",position:"relative"},children:[e.jsx(t.icon,{style:u}),e.jsx("span",{style:{marginTop:2},children:t.title[p]})]})}),e.jsx(l,{className:"tip",children:t.description[p]})]},t.value))})})}),e.jsx(D,{mt:8,disabled:i,blocklet:r,onStartNow:()=>a("complete"),children:e.jsx(P,{loading:i,variant:"contained",disabled:i,onClick:()=>a(),children:n("setup.continue")})})]})}W.propTypes={onNext:y.func};const k=N(Y)`
1
+ import{D as E,j as e,ak as l,y as h,bq as A,b6 as g,br as L,at as N,W as y}from"./vendor-mui-core-CnXrAOs3.js";import{r as m}from"./vendor-react-Dvs43sk9.js";import{V as I,H as j}from"./vendor-ux-DtnxszG_.js";import{A as b}from"./config-CWk35jzL.js";import{a as O}from"./page-header-DCvzRay5.js";import{l as v,e as R,c as o,f as T}from"./index-6LL6v88e.js";import{S as Y}from"./layout-Bhte8u_h.js";import{S as D}from"./step-actions-DJsm5fTL.js";import{S as P}from"./button-9InonP1B.js";import"./vendor-utils-cJEl_UEd.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DVRwGBYP.js";import"./content-layout-oyz1EqNZ.js";import"./use-mobile-DCNBsOlH.js";function W({onNext:a=()=>{}}){const C=E(),{t:n,locale:p}=I(),[i,c]=m.useState(!1),[S,d]=m.useState(""),{blocklet:r}=v();m.useEffect(()=>{const t=R.findServiceFromMeta(r.meta,o.NODE_SERVICES.AUTH);d(t?.config?.whoCanAccess||o.WHO_CAN_ACCESS.ALL)},[r]);const f=async t=>{let s=o.ACCESS_POLICY_PUBLIC;t===o.WHO_CAN_ACCESS.ALL?s=o.ACCESS_POLICY_PUBLIC:t===o.WHO_CAN_ACCESS.INVITED?s=o.ACCESS_POLICY_INVITED_ONLY:t===o.WHO_CAN_ACCESS.OWNER?s=o.ACCESS_POLICY_OWNER_ONLY:t===o.WHO_CAN_ACCESS.ADMIN&&(s=o.ACCESS_POLICY_ADMIN_ONLY);try{c(!0),await T.updateBlockletSecurityRule({input:{did:r.meta.did,data:{id:o.SECURITY_RULE_DEFAULT_ID,accessPolicyId:s}}}),c(!1)}catch(_){c(!1),j.error(_.message)}},x=async t=>{i||(d(t.target.value),await f(t.target.value))},u={marginRight:4,fontSize:18,verticalAlign:"text-bottom",color:C.palette.text.secondary};return e.jsxs(k,{children:[e.jsx(l,{className:"header",children:e.jsx(O,{title:n("blocklet.config.access.title"),subTitle:n("blocklet.config.access.description")})}),e.jsx(l,{className:"form-container",children:e.jsx(h,{component:"fieldset",children:e.jsx(A,{name:"inherit",value:S,onChange:x,children:b.map(t=>e.jsxs(l,{sx:{mb:2,"&:last-child":{mb:0}},children:[e.jsx(g,{value:t.value,control:e.jsx(L,{size:"small",color:"primary"}),label:e.jsxs("span",{style:{display:"flex",alignItems:"center",position:"relative"},children:[e.jsx(t.icon,{style:u}),e.jsx("span",{style:{marginTop:2},children:t.title[p]})]})}),e.jsx(l,{className:"tip",children:t.description[p]})]},t.value))})})}),e.jsx(D,{mt:8,disabled:i,blocklet:r,onStartNow:()=>a("complete"),children:e.jsx(P,{loading:i,variant:"contained",disabled:i,onClick:()=>a(),children:n("setup.continue")})})]})}W.propTypes={onNext:y.func};const k=N(Y)`
2
2
  height: 100%;
3
3
  overflow-y: auto;
4
4
  .header {
@@ -1,4 +1,4 @@
1
- import{W as B,j as l,a6 as Tt,at as tt,ak as te,D as Ut,T as je,J as Yt,b6 as ei,a5 as ti,I as No,bV as Ao,S as Do,bb as va,dR as ya,aP as Mo,F as ba,z as Hn,bP as xa,bQ as wa,bR as Sa,bD as Ea,aX as Bo,V as ka,aO as Ta,cY as ja,cZ as Oa,bB as Ca,bE as Ia,M as ni,am as Fo,aq as Ra,b1 as lt,b7 as Pa,dM as La,a8 as $o,ad as Uo,aV as _a,aj as qo,Q as jn,Y as Na,bw as Wo,o as zo,aU as Aa,ar as Xt,c7 as Da,c6 as Ma,c2 as ki,U as Ti,ah as Ba,dO as Fa,O as $a,K as Ua,P as qa,ai as Wa,an as Vo,A as ji,aI as za,dJ as Va}from"./vendor-mui-core-CnXrAOs3.js";import{r as q,g as ri,u as Ka,i as Ga,p as Ha,e as Xa,a as $t,d as Ya,f as Rn,j as Ja}from"./vendor-react-Dvs43sk9.js";import{r as ii,S as Qa,s as Ko,A as Za}from"./item-O0rUCXMz.js";import{n as vt,b as oi,e as Go,V as xt,U as yt,a6 as el,r as tl,O as Xn,H as Yn,aE as Oi,l as Qt,o as Ho,$ as Vn,w as Xo,c as nl,j as rl,A as Fr,aX as il}from"./vendor-ux-DtnxszG_.js";import{Z as dn,e as Ft,c as ol,c6 as sl,b7 as al,bT as Yo,c7 as ll,c8 as cl,c9 as ul,ca as dl,a7 as hl,X as Mt,bC as fl,v as Jo,aL as pl,cb as ml,F as gl,cc as vl,ab as Jn,cd as Qo,bj as Zo,k as Qn,U as Ci,ce as yl,ap as bl,cf as xl,cg as wl,ch as Pn,ci as Ii,b8 as Sl}from"./index-FASRIZyi.js";import{j as Ri,o as El,T as kl,L as Tl,P as jl}from"./vendor-arcblock-DVRwGBYP.js";import{u as Pi}from"./launch-result-message-DWeUg9rM.js";import{a as $r}from"./page-header-DCvzRay5.js";import{e as gt,B as Ol,C as rn,J as Zn,D as Li,R as es,Q as Cl,a8 as Il,A as Rl,o as sr,V as Pl,al as Ll,am as _l,an as Nl,a as xn,S as Al,b as Dl}from"./vendor-utils-cJEl_UEd.js";import{f as Ur}from"./index-DBs9Ljax.js";import{e as Ml}from"./engine-9k0o50qZ.js";import{u as Bl,C as Fl}from"./config-space-DAd9qYRh.js";import{R as Ln}from"./required-BGaDOGrj.js";import{S as $l}from"./index-C1Dar18k.js";import{a as ts,h as Ul,w as ql,f as Wl,b as zl,d as Vl,e as Kl,M as Gl}from"./index-De-Vgsb6.js";import{k as On,a as Hl,b as Xl,u as ns,g as Yl,q as Jl}from"./vendor-hooks-CjESGRlR.js";import{g as Ql}from"./get-safe-url-BFcRpP-P.js";import{r as rs,A as Zl}from"./config-Cbg3z3uP.js";import{r as ec}from"./index-BPy8_fa2.js";import{r as tc}from"./cloneDeep-C6qewg0C.js";import{u as si}from"./useLocalStorage-BIH12-5o.js";import{v as _i}from"./index-B-Z_6Rom.js";import{u as nc}from"./session-Chl38-LD.js";import{W as rc}from"./did-address-CZak4Nzl.js";import{a as Ni}from"./api-Btn0Tp3W.js";import{v as ic,e as oc}from"./util-CVi4JaWM.js";import{u as is}from"./use-mobile-maRlSUwU.js";import{C as sc}from"./content-layout-oyz1EqNZ.js";import{C as ac,D as lc,a as cc}from"./connect-to-CEyhDVUe.js";import{d as ar}from"./search-4YYphs0l.js";const Lf="blocklet-add-component-registry",_f="server-add-registry",Nf=e=>`resource-${e}-add-registry`;function os(e){const{info:t}=dn();return q.useMemo(()=>!e||!e.docker?.image||e.docker?.image&&e.docker?.runBaseScript?!0:window.blocklet?window.blocklet.enableDocker&&window.blocklet.enableDockerNetwork:t.enableDocker&&t.enableDockerNetwork,[e,t])}function ss({disabled:e=!1,children:t,onConfirm:r}){return q.useEffect(()=>{if(e)return()=>{};const i=s=>{s.code==="Enter"&&(s.metaKey===!0||s.ctrlKey===!0)&&(s.preventDefault(),s.stopPropagation(),r())};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}},[e,r]),t}ss.propTypes={disabled:B.bool,children:B.any.isRequired,onConfirm:B.func.isRequired};function as({onContinue:e,nextDisabled:t=!1,launching:r=!1,texts:i={listenName:"",launchingText:"",buttonNext:""},description:s=""}){const[n,o]=q.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx(uc,{children:l.jsxs(ss,{disabled:t,onConfirm:e,children:[l.jsx("div",{className:"eula-trigger",onClick:()=>o(a=>!a),children:i.listenName}),l.jsx(vt,{disabled:t,color:"primary",variant:"contained",className:"next-button",onClick:e,children:r?l.jsxs(l.Fragment,{children:[l.jsx(Tt,{size:14}),i.launchingText]}):i.buttonNext})]})}),l.jsx(oi,{open:n,title:i.listenName,onClose:()=>o(!1),children:s})]})}as.propTypes={onContinue:B.func.isRequired,nextDisabled:B.bool,launching:B.bool,description:B.any,texts:B.object};const uc=tt.div`
1
+ import{W as B,j as l,a6 as Tt,at as tt,ak as te,D as Ut,T as je,J as Yt,b6 as ei,a5 as ti,I as No,bV as Ao,S as Do,bb as va,dR as ya,aP as Mo,F as ba,z as Hn,bP as xa,bQ as wa,bR as Sa,bD as Ea,aX as Bo,V as ka,aO as Ta,cY as ja,cZ as Oa,bB as Ca,bE as Ia,M as ni,am as Fo,aq as Ra,b1 as lt,b7 as Pa,dM as La,a8 as $o,ad as Uo,aV as _a,aj as qo,Q as jn,Y as Na,bw as Wo,o as zo,aU as Aa,ar as Xt,c7 as Da,c6 as Ma,c2 as ki,U as Ti,ah as Ba,dO as Fa,O as $a,K as Ua,P as qa,ai as Wa,an as Vo,A as ji,aI as za,dJ as Va}from"./vendor-mui-core-CnXrAOs3.js";import{r as q,g as ri,u as Ka,i as Ga,p as Ha,e as Xa,a as $t,d as Ya,f as Rn,j as Ja}from"./vendor-react-Dvs43sk9.js";import{r as ii,S as Qa,s as Ko,A as Za}from"./item-CQ92uUPm.js";import{n as vt,b as oi,e as Go,V as xt,U as yt,a6 as el,r as tl,O as Xn,H as Yn,aE as Oi,l as Qt,o as Ho,$ as Vn,w as Xo,c as nl,j as rl,A as Fr,aX as il}from"./vendor-ux-DtnxszG_.js";import{_ as dn,e as Ft,c as ol,c7 as sl,b8 as al,bU as Yo,c8 as ll,c9 as cl,ca as ul,cb as dl,a8 as hl,Y as Mt,bD as fl,v as Jo,aM as pl,cc as ml,G as gl,cd as vl,ac as Jn,ce as Qo,bk as Zo,k as Qn,V as Ci,cf as yl,aq as bl,cg as xl,ch as wl,ci as Pn,cj as Ii,b9 as Sl}from"./index-6LL6v88e.js";import{j as Ri,o as El,T as kl,L as Tl,P as jl}from"./vendor-arcblock-DVRwGBYP.js";import{u as Pi}from"./launch-result-message-DWeUg9rM.js";import{a as $r}from"./page-header-DCvzRay5.js";import{e as gt,B as Ol,C as rn,J as Zn,D as Li,R as es,Q as Cl,a8 as Il,A as Rl,o as sr,V as Pl,al as Ll,am as _l,an as Nl,a as xn,S as Al,b as Dl}from"./vendor-utils-cJEl_UEd.js";import{f as Ur}from"./index-DBs9Ljax.js";import{e as Ml}from"./engine-CLurioHW.js";import{u as Bl,C as Fl}from"./config-space-ElduyMIL.js";import{R as Ln}from"./required-BGaDOGrj.js";import{S as $l}from"./index-D1kZimyP.js";import{a as ts,h as Ul,w as ql,f as Wl,b as zl,d as Vl,e as Kl,M as Gl}from"./index-De-Vgsb6.js";import{k as On,a as Hl,b as Xl,u as ns,g as Yl,q as Jl}from"./vendor-hooks-CjESGRlR.js";import{g as Ql}from"./get-safe-url-D_AWm5Av.js";import{r as rs,A as Zl}from"./config-cglRKVfL.js";import{r as ec}from"./index-BPy8_fa2.js";import{r as tc}from"./cloneDeep-C6qewg0C.js";import{u as si}from"./useLocalStorage-BIH12-5o.js";import{v as _i}from"./index-B-Z_6Rom.js";import{u as nc}from"./session-C2VeP2Dn.js";import{W as rc}from"./did-address-CZak4Nzl.js";import{a as Ni}from"./api-Btn0Tp3W.js";import{v as ic,e as oc}from"./util-Bl3AzodV.js";import{u as is}from"./use-mobile-maRlSUwU.js";import{C as sc}from"./content-layout-oyz1EqNZ.js";import{C as ac,D as lc,a as cc}from"./connect-to-DFMCjDvl.js";import{d as ar}from"./search-4YYphs0l.js";const Lf="blocklet-add-component-registry",_f="server-add-registry",Nf=e=>`resource-${e}-add-registry`;function os(e){const{info:t}=dn();return q.useMemo(()=>!e||!e.docker?.image||e.docker?.image&&e.docker?.runBaseScript?!0:window.blocklet?window.blocklet.enableDocker&&window.blocklet.enableDockerNetwork:t.enableDocker&&t.enableDockerNetwork,[e,t])}function ss({disabled:e=!1,children:t,onConfirm:r}){return q.useEffect(()=>{if(e)return()=>{};const i=s=>{s.code==="Enter"&&(s.metaKey===!0||s.ctrlKey===!0)&&(s.preventDefault(),s.stopPropagation(),r())};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}},[e,r]),t}ss.propTypes={disabled:B.bool,children:B.any.isRequired,onConfirm:B.func.isRequired};function as({onContinue:e,nextDisabled:t=!1,launching:r=!1,texts:i={listenName:"",launchingText:"",buttonNext:""},description:s=""}){const[n,o]=q.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx(uc,{children:l.jsxs(ss,{disabled:t,onConfirm:e,children:[l.jsx("div",{className:"eula-trigger",onClick:()=>o(a=>!a),children:i.listenName}),l.jsx(vt,{disabled:t,color:"primary",variant:"contained",className:"next-button",onClick:e,children:r?l.jsxs(l.Fragment,{children:[l.jsx(Tt,{size:14}),i.launchingText]}):i.buttonNext})]})}),l.jsx(oi,{open:n,title:i.listenName,onClose:()=>o(!1),children:s})]})}as.propTypes={onContinue:B.func.isRequired,nextDisabled:B.bool,launching:B.bool,description:B.any,texts:B.object};const uc=tt.div`
2
2
  margin: 0 auto;
3
3
  display: flex;
4
4
  justify-content: space-between;
@@ -217,7 +217,7 @@ A valid navigation id is should follow the rules of javascript variables, such a
217
217
  - foo123
218
218
 
219
219
  see detail in https://www.npmjs.com/package/is-var-name
220
- `),O=c.string().trim().min(1).custom(V=>{if(E(V)>u.MAX_TITLE_LENGTH)throw new Error(`title length should not exceed ${u.MAX_TITLE_LENGTH} (see: https://www.npmjs.com/package/cjk-length)`);return V}).meta({className:"TTitle"});ae.titleSchema=O;const w=c.string().trim().min(3).max(160).meta({className:"TDescription"});ae.descriptionSchema=w;const R=c.string().trim().min(3).max(20).messages({"*":"Title length must be between 3 and 20 characters"}).meta({className:"TInstallBlockletTitle"});ae.installBlockletTitleSchema=R;const F=c.string().trim().min(3).max(80).messages({"*":"Description length must be between 3 and 80 characters"}).meta({className:"TInstallBlockletDescription"});ae.installBlockletDescriptionSchema=F;const D=c.string().uri({scheme:["http","https"],allowRelative:!0}).allow("").custom((V,he)=>V.includes(a.WELLKNOWN_BLOCKLET_LOGO_PATH)?he.message(`logo url should not include ${a.WELLKNOWN_BLOCKLET_LOGO_PATH}`):V).meta({className:"TLogo"});ae.logoSchema=D;const ne=c.string().trim().min(1),Y=ne.meta({className:"TMountPoint"}).custom((V,he)=>(0,S.isValidUrlPath)(V)?V:he.message(`mountPoint cannot contain such characters space $*+~()'"!:@\\`));ae.mountPointSchema=Y;const W=ne.meta({className:"TUpdateMountPoint"}).custom(V=>(0,S.urlPathFriendly)(V));ae.updateMountPointSchema=W;const U=c.string().custom(V=>((0,m.validateName)(V),V)).meta({className:"TBlockletName"});ae.blockletNameSchema=U;const H=[],A=c.string().trim().min(1).max(50).required().custom((V,he)=>V.startsWith("BLOCKLET")&&!H.includes(V)?he.message("Env name can not start with BLOCKLET_"):V.startsWith("COMPONENT")?he.message("Env name can not start with COMPONENT_"):V.startsWith("ABTNODE")?he.message("Env name can not start with ABTNODE_"):/[^\w]/.test(V)?he.message('Env name can include only numbers or letters or "_"'):V).meta({className:"TEnvironmentName",unknownType:"any"});ae.environmentNameSchema=A;const J=c.object({name:A.required(),description:c.string().trim().required(),default:c.string().optional().allow("").default(""),required:c.boolean().default(!1),secure:c.boolean().default(!1),validation:c.string().optional(),shared:c.boolean().default(V=>V.secure?!1:void 0)}).custom((V,he)=>V.secure&&V.default?he.message(`Cannot declare default value for secure env ${V.name}`):V).meta({className:"TEnvironment",unknownType:"any"});ae.environmentSchema=J;const M=c.object({dev:c.string().trim().min(1),e2eDev:c.string().trim().min(1),preFlight:c.string().trim().min(1),preInstall:c.string().trim().min(1),postInstall:c.string().trim().min(1),preStart:c.string().trim().min(1),postStart:c.string().trim().min(1),preStop:c.string().trim().min(1),preUninstall:c.string().trim().min(1),preConfig:c.string().trim().min(1)}).rename("pre-flight","preFlight").rename("pre-install","preInstall").rename("post-install","postInstall").rename("pre-start","preStart").rename("post-start","postStart").rename("pre-stop","preStop").rename("pre-uninstall","preUninstall").rename("pre-config","preConfig").optional().meta({className:"TScripts",unknownType:"any"});ae.scriptsSchema=M;const ue=c.object({name:c.string().required().trim(),config:c.object().optional().default({})}).unknown(!0).meta({className:"TService",unknownType:"any"});ae.serviceSchema=ue;const Ie=c.object({type:c.string().trim(!0).min(1).required(),path:c.string().required(),meta:c.object({vcType:c.string(),payable:c.boolean(),params:c.array().items({name:c.string().required().trim(),description:c.string().required().trim()})})}).meta({className:"TEndpoint",unknownType:"any"});ae.endpointSchema=Ie;const K=c.string().trim().custom((V,he)=>{const De=V.split("/").filter(Boolean);return De.length===0?he.message("cacheable path must be a valid pathname that is not /"):`/${De.join("/")}`}).meta({className:"TPathPrefix",unknownType:"any"});ae.cacheableSchema=K;const Ee=c.object({type:c.string().lowercase().valid(...u.BLOCKLET_INTERFACE_TYPES).required(),name:c.string().trim().required(),path:c.string().trim().default("/"),prefix:c.string().trim().min(1).default(u.BLOCKLET_DYNAMIC_PATH_PREFIX),containerPort:c.number().port().optional(),hostIP:c.string().trim().ip({version:["ipv4","ipv6"]}).optional(),protocol:c.string().lowercase().valid(...u.BLOCKLET_INTERFACE_PROTOCOLS).default("http"),port:c.alternatives().try(c.string().uppercase().default(u.BLOCKLET_DEFAULT_PORT_NAME),c.object({internal:c.string().uppercase().required(),external:c.number().port().required()})).default(u.BLOCKLET_DEFAULT_PORT_NAME),cacheable:c.array().items(K).unique(),services:c.array().items(ue).unique("name"),endpoints:c.array().items(Ie).unique("type"),pageGroups:c.array().items(c.string().min(1).max(255).trim()).unique(),proxyBehavior:c.string().valid("service","direct").default("service").optional()}).meta({className:"TInterface",unknownType:"any"});ae.interfaceSchema=Ee;const ce=c.alternatives().try(c.string().required(),c.object({url:c.string().uri({scheme:["http","https","file"]}).required(),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid())}),c.object({store:c.string().uri({scheme:["http","https"]}).required(),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid()).default("latest")})),Me=c.object({platform:c.string().valid(...u.BLOCKLET_PLATFORMS).optional(),interpreter:c.string().valid("binary","node","blocklet","bun").default("node"),source:ce,args:c.array().items(c.string()).optional().default([])}).meta({className:"TEngine",unknownType:"any"});ae.engineSchema=Me;const me=c.object({name:c.string().min(1).required(),email:c.string().email({tlds:!1}).optional(),url:c.string().uri().optional()}).meta({className:"TPerson",unknownType:"any"});ae.personSchema=me;const Oe=c.object({tarball:c.alternatives().try(c.string().uri(),c.string()).required(),integrity:c.string().required(),size:c.number().optional()}).meta({className:"TDist",unknownType:"any"});ae.distSchema=Oe;const Pe=c.object({downloads:c.number().integer().greater(-1),star:c.number().default(0),purchases:c.number().default(0)}).meta({className:"TStats",unknownType:"any"});ae.statsSchema=Pe;const ut={source:c.alternatives().try(c.object({url:c.alternatives().try(c.string().uri(),c.array().items(c.string().uri()).min(1)).required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid())}),c.object({store:c.string().uri({scheme:["http","https"]}),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid()).default("latest")})).required(),required:c.boolean(),title:O,description:w,mountPoint:Y,name:U},ft=(V,he)=>c.object(V).custom((De,Xe)=>!he&&De.source&&De.source.name&&!De.source.store?Xe.message(`missing 'store' in source of component ${De.name}`):De),rt=ft(ut).meta({className:"TComponent",unknownType:"any"});ae.componentSchema=rt;const we=ft(ut,!0),de=({checkStore:V}={})=>{const he=[rt,we];return c.array().items(V?he[0]:he[1]).optional().default([])},ge=c.object({type:c.string().required(),name:c.string().required(),signer:c.string().required(),pk:c.string().required(),created:c.string().isoDate().required(),sig:c.string().required(),excludes:c.array().items(c.string()).optional(),appended:c.array().items(c.string()).optional(),delegatee:c.string(),delegateePk:c.string(),delegation:c.string()}).meta({className:"TSignature",unknownType:"any"});ae.signatureSchema=ge;const Fe=["en","zh","fr","ru","ar","es","de","pt","ja","hi"],$e={id:c.string().custom($),title:c.alternatives().try(c.string().min(1).max(u.MAX_TITLE_LENGTH),c.object().min(1).pattern(c.string().valid(...Fe),c.string().min(1).max(u.MAX_TITLE_LENGTH))).required(),description:c.alternatives().try(c.string().min(1).max(u.MAX_DESCRIPTION_LENGTH),c.object().min(1).pattern(c.string().valid(...Fe),c.string().min(1).max(u.MAX_DESCRIPTION_LENGTH))),link:c.alternatives().try(c.string().custom(N),c.object().min(1).pattern(c.string().valid(...Fe),c.string().custom(N))),component:c.string().min(1),section:c.array().items(c.string().min(1)).single(),role:c.array().items(c.string().min(1)).single(),icon:c.string().min(1),visible:c.boolean(),private:c.boolean()},jt=c.object({...$e,items:c.array().items(c.object({...$e}).rename("child","component"))}).rename("child","component").meta({className:"TNavigationItem",unknownType:"any"});ae.navigationItemSchema=jt;const Ae=c.array().items(jt).unique((V,he)=>V.id&&he.id?V.id===he.id:!1).meta({className:"TNavigation",unknownType:"any"});ae.navigationSchema=Ae;const Et=c.object({background:c.alternatives().try(c.string().min(1),c.object({header:c.string().min(1),footer:c.string().min(1),default:c.string().min(1)}).min(1))}).meta({className:"TTheme",unknownType:"any"});ae.themeSchema=Et;const Ot=c.object({whoCanAccess:c.string().valid("owner","invited","all"),profileFields:c.array().items(c.string().valid("fullName","email","avatar","phone")).unique(),ignoreUrls:c.array().items(c.string().min(1)),allowSwitchProfile:c.boolean(),blockUnauthenticated:c.boolean(),blockUnauthorized:c.boolean()}).options({stripUnknown:!0}).meta({className:"TAuthConfig",unknownType:"any"});ae.authConfigSchema=Ot;const Ct=c.object({type:c.string().trim().min(1).required(),description:c.string().trim().min(1)}),It=c.object({did:c.DID().trim().required(),type:c.string().trim().min(1).required(),public:c.boolean()}).meta({className:"TResourceBundle",unknownType:"any"});ae.resourceBundleSchema=It;const Ve=c.array().items(c.object({type:c.string().trim().min(1).max(128).pattern(/^(?!blocklet\.)[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/).message('Event type must be in format of "[noun.]verb" like "post.published" or "post.comment.published", and prefix "blocklet." is reserved').required(),description:c.string().trim().min(1).max(256).required()})).unique("type").meta({className:"TEvent",unknownType:"any"});ae.eventsSchema=Ve;const Rt={did:c.DID().trim().required(),version:c.semver().valid().required(),name:c.string().optional(),description:w.required(),group:c.string().valid(...u.BLOCKLET_GROUPS),main:c.string().trim(),title:O.optional().allow(""),logo:c.string().trim().optional(),specVersion:c.semver().valid().gte("1.0.0").optional(),author:me.optional(),contributors:c.array().items(me).optional(),maintainers:c.array().items(me).optional(),community:c.string().uri().optional().allow("").default(""),documentation:c.string().uri().optional().allow("").default(""),homepage:c.string().uri().optional().allow("").default(""),license:c.string().optional().allow("").default(""),support:c.alternatives().try(c.string().uri(),c.string().email({tlds:!1})).optional(),nftFactory:c.DID().optional().allow("").default(""),payment:c.object({price:c.array().max(1).items(c.object({value:c.number().greater(0).required(),address:c.DID().required()})).default([]),share:c.array().max(4).items(c.object({name:c.string().required(),address:c.DID().required(),value:c.number().greater(0).max(1).required()})).default([]).custom(V=>{if(V.length===0)return V;const he=V.reduce((De,Xe)=>De+Xe.value,0);if(he!==1)throw new Error(`Invalid blocklet payment share config: total share must be 1, got ${he}`);return V},"invalid blocklet share"),componentPrice:c.array().items(c.object({parentPriceRange:c.array().items(c.number()).custom((V,he)=>V.length!==2?he.message("length of range should be 2"):V[0]<0?he.message("the first value should not less than 0 in range"):V[1]<=V[0]?he.message("the second value should greater than the first value in range"):V),type:c.string().valid("fixed","percentage").required(),value:c.number().greater(0).required()})).single()}).default({price:[],share:[]}),keywords:c.alternatives().try(c.string().trim().min(1),c.array().items(c.string().min(1))).optional(),tags:c.alternatives().try(c.string().trim().min(1),c.array().items(c.string().min(1))).optional(),gitHash:c.string().optional().allow(""),repository:c.alternatives().try(c.string().min(1),c.object({type:c.string().valid("git","https","svn").required(),url:c.string().uri().required(),directory:c.string()})).optional(),timeout:c.object({start:c.number().min(10).max(600),script:c.number().min(1).max(1800)}).default({start:60}),requirements:c.object({abtnode:c.semverRange().valid(),server:c.semverRange().valid(),os:c.alternatives().try(c.string().valid("*",...u.BLOCKLET_PLATFORMS),c.array().items(c.string().valid(...u.BLOCKLET_PLATFORMS)).min(1)),cpu:c.alternatives().try(c.string().valid("*",...u.BLOCKLET_ARCHITECTURES),c.array().items(c.string().valid(...u.BLOCKLET_ARCHITECTURES)).min(1)),fuels:c.array().items(c.object({endpoint:c.string().trim().required(),address:c.string().trim(),value:c.string().trim().required(),reason:c.string().trim().required()})),nodejs:c.semverRange().valid(),aigne:c.boolean().optional()}).default({server:u.BLOCKLET_LATEST_REQUIREMENT_SERVER,os:"*",cpu:"*",nodejs:"*"}),interfaces:c.array().items(Ee).unique("name").custom((V,he)=>{if(V.filter(it=>it.type===u.BLOCKLET_INTERFACE_TYPE_WEB).length>1)return he.message(`Only one ${u.BLOCKLET_INTERFACE_TYPE_WEB} interface can be declared`);const Xe=V.filter(it=>it.type===u.BLOCKLET_INTERFACE_TYPE_WELLKNOWN);for(const it of Xe)if(!it.prefix.startsWith(C))return he.message(`Wellknown path prefix must start with: ${C}`);return V}).default([]),environments:c.array().items(J).default([]).optional().custom((V,he)=>{if(V&&V.length){const De=V.filter((Xe,it)=>V.findIndex(wt=>wt.name===Xe.name)!==it);if(De.length)return he.message(`find duplicate environment names ${De.map(Xe=>Xe.name).join(", ")}`)}return V}),scripts:M,capabilities:c.object({clusterMode:c.boolean(),didSpace:c.string().valid(...Object.values(u.BLOCKLET_APP_SPACE_REQUIREMENT)).optional(),navigation:c.boolean().default(!0),serverless:c.boolean().optional(),component:c.boolean(),sitemap:c.boolean().optional(),mcp:c.boolean().optional(),singleton:c.boolean().optional()}).default({}),files:c.array().items(c.string().trim()).optional(),resource:c.object({exportApi:c.string().trim(),bundles:c.array().items(It),types:c.array().items(Ct).max(10)}),engine:c.alternatives().try(Me,c.array().items(Me)).optional(),screenshots:c.array().items(c.string().min(1)).optional().default([]),videos:c.array().items(c.string().pattern(/^https:\/\/(www\.)?(youtube\.com|youtu\.be|vimeo\.com)\/[\w\-/?&=]+/).message("Each video URL must be a valid YouTube or Vimeo link")).max(3).optional(),logoUrl:c.string().optional().allow(""),dist:Oe.optional(),stats:Pe.optional(),htmlAst:c.any().optional(),path:c.string().optional(),signatures:c.array().items(ge).optional(),lastPublishedAt:c.string().isoDate().optional().allow(null),components:de(),navigation:Ae,theme:Et,copyright:c.object({owner:c.string().min(1),year:c.alternatives().try(c.string(),c.number())}),bundleName:c.string(),bundleDid:c.DID().trim(),storeId:c.string(),events:Ve.optional()},pt=c.object(Rt).options({stripUnknown:!0,noDefaults:!1}).meta({className:"TBlockletMeta",unknownType:"any"});ae.blockletMetaSchema=pt;const st=(V,{ensureFiles:he=!1,ensureDist:De=!1,ensureComponentStore:Xe=!0,ensureName:it=!1,skipValidateDidName:wt=!1,...qt}={})=>((!V||!t.default.existsSync(V))&&(he=!1),c.object({...Rt,owner:c.object({avatar:c.string().optional(),did:c.DID().trim().required(),fullName:c.string().trim().required(),email:c.string().optional().allow(null).empty("").default("")}).optional(),logo:he?c.file().trim().exists({baseDir:V}).optional():c.string().trim().optional(),files:c.array().items(he?c.file().exists({baseDir:V,canSkip:(Ue,L)=>[u.BLOCKLET_ENTRY_FILE,u.BLOCKLET_BUNDLE_FILE].includes(L)||(0,s.default)(L)}):c.string().trim()).optional(),dist:De?Oe.required():Oe.optional(),components:de({checkStore:Xe}),name:it?c.string().optional():c.string().required(),egress:c.boolean().optional().default(!0),docker:h.dockerSchema}).options({stripUnknown:!0,noDefaults:!1,...qt}).rename("children","components").custom((Ue,L)=>{const{did:re,name:ve,docker:Re}=Ue;if(Re){const{image:b,dockerfile:k,network:_}=Re;if(!b&&!k)return L.message("Image or dockerfile must be set");if(b&&k)return L.message("Image and dockerfile cannot be set at the same time");if(_)return L.message("ExportPorts and network cannot be set at the same time");k&&(Ue.files||(Ue.files=[]),Ue.files.push(k))}let p;if((0,d.isValid)(re))try{return(0,m.validateNewDid)(re),Ue}catch(b){p=b}if(ve){(0,m.validateName)(ve,{checkDid:!wt});const b=(0,f.toBlockletDid)(ve);return b!==re?L.message(`The did of name "${ve}" should be "${b}"`):Ue}return p?L.message(p.message):Ue}));return ae.createBlockletSchema=st,ae.default={blockletNameSchema:U,componentSchema:rt,endpointSchema:Ie,serviceSchema:ue,createBlockletSchema:st,interfaceSchema:Ee,environmentSchema:J,environmentNameSchema:A,scriptsSchema:M,personSchema:me,distSchema:Oe,titleSchema:O,descriptionSchema:w,logoSchema:D,navigationSchema:Ae,themeSchema:Et,mountPointSchema:Y,updateMountPointSchema:W,authConfigSchema:Ot,resourceBundleSchema:It,installBlockletTitleSchema:R,installBlockletDescriptionSchema:F,eventsSchema:Ve,Joi:c},ae}var ht={},so;function lu(){if(so)return ht;so=1;var e=ht&&ht.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(ht,"__esModule",{value:!0}),ht.setService=ht.findService=ht.getDefaultServiceConfig=ht.getServiceConfig=void 0;const t=e(tc),r=gs(),i={},s=h=>{i[h.name]={validate:h.schema.validate.bind(h.schema),defaultConfig:h.default}};ht.setService=s,s({name:"auth",schema:r.authConfigSchema,default:{}});const n=h=>{if(!h)throw new Error("service name should not be empty");const u=i[h];if(!u)throw new Error(`service ${h} does not exist`);return u},o=(h,u,{validate:f}={})=>{const j=n(h),m=(0,t.default)(u||{}),{value:S,error:E}=j.validate(m);if(f&&E)throw new Error(`Invalid blocklet service config: ${E.details.map(C=>C.message).join(", ")}`);return S};ht.getServiceConfig=o;const a=h=>{const{defaultConfig:u}=n(h);return u};ht.getDefaultServiceConfig=a;const d=(h,u)=>{const f=[u];return(h||[]).find(j=>f.includes(j.name))};return ht.findService=d,ht.default={getServiceConfig:o,getDefaultServiceConfig:a,findService:d,setService:s},ht}var ao;function cu(){if(ao)return Gt;ao=1,Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.fixAndValidateService=Gt.validateMeta=void 0;const e=gs(),t=lu(),r=s=>(!s.interfaces||!s.interfaces.length||s.interfaces.forEach(n=>{n.services&&n.services.length&&n.services.forEach(o=>{o.config=(0,t.getServiceConfig)(o.name,o.config,{validate:!0})})}),s);Gt.fixAndValidateService=r;const i=(s,{ensureFiles:n=!1,ensureDist:o=!1,ensureComponentStore:a=!0,ensureName:d=!1,skipValidateDidName:h=!1,schemaOptions:u={}}={})=>{const f=(0,e.createBlockletSchema)(null,{ensureFiles:n,ensureDist:o,ensureComponentStore:a,ensureName:d,skipValidateDidName:h,...u}),{value:j,error:m}=f.validate(s);if(m)throw new Error(`Invalid blocklet meta: ${m.details.map(S=>S.message).join(", ")}`);return j};return Gt.validateMeta=i,Gt.default=i,Gt}var lo;function uu(){return lo||(lo=1,function(e){var t=kt&&kt.__createBinding||(Object.create?function(w,R,F,D){D===void 0&&(D=F);var ne=Object.getOwnPropertyDescriptor(R,F);(!ne||("get"in ne?!R.__esModule:ne.writable||ne.configurable))&&(ne={enumerable:!0,get:function(){return R[F]}}),Object.defineProperty(w,D,ne)}:function(w,R,F,D){D===void 0&&(D=F),w[D]=R[F]}),r=kt&&kt.__setModuleDefault||(Object.create?function(w,R){Object.defineProperty(w,"default",{enumerable:!0,value:R})}:function(w,R){w.default=R}),i=kt&&kt.__importStar||function(){var w=function(R){return w=Object.getOwnPropertyNames||function(F){var D=[];for(var ne in F)Object.prototype.hasOwnProperty.call(F,ne)&&(D[D.length]=ne);return D},w(R)};return function(R){if(R&&R.__esModule)return R;var F={};if(R!=null)for(var D=w(R),ne=0;ne<D.length;ne++)D[ne]!=="default"&&t(F,R,D[ne]);return r(F,R),F}}(),s=kt&&kt.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(e,"__esModule",{value:!0}),e.fixService=e.fixInterfaces=e.parsePerson=e.formatPerson=e.fixName=e.fixTags=e.fixPerson=e.fixKeywords=e.fixFiles=e.fixRepository=e.fixRequired=void 0;const n=s(cl),o=i(Gc()),a=Yo(),d=cu();Object.defineProperty(e,"fixService",{enumerable:!0,get:function(){return d.fixAndValidateService}});const h=ms(),u=(w,R)=>{w.description||(w.description=`Blocklet from ${R}`),w.version||(w.version=a.BLOCKLET_DEFAULT_VERSION)};e.fixRequired=u;const f=w=>{if(w.repository&&(typeof w.repository=="string"&&(w.repository={type:"git",url:w.repository}),w.repository.url)){const R=o.fromUrl(w.repository.url);R&&(w.repository.url=R.getDefaultRepresentation()==="shortcut"?R.https():R.toString())}};e.fixRepository=f;const j=w=>{Array.isArray(w.files)?w.files&&(w.files=w.files.filter(R=>!(!R||typeof R!="string"))):delete w.files};e.fixFiles=j;const m=w=>{typeof w.keywords=="string"&&(w.keywords=w.keywords.split(/,\s+/)),w.keywords&&!Array.isArray(w.keywords)?delete w.keywords:w.keywords&&(w.keywords=w.keywords.filter(R=>!(typeof R!="string"||!R)))};e.fixKeywords=m;const S=w=>{typeof w.tags=="string"&&(w.tags=w.tags.split(/,\s+/)),w.tags&&!Array.isArray(w.tags)?delete w.tags:w.tags&&(w.tags=w.tags.filter(R=>!(typeof R!="string"||!R)))};e.fixTags=S;const E=(w,R)=>(w.author&&(w.author=R(w.author)),["maintainers","contributors"].forEach(F=>{Array.isArray(w[F])&&(w[F]=w[F].map(R))}),w),C=w=>{if(!w)return"";if(typeof w=="string")return w;const R=w.name||"",F=w.url||w.web,D=F?` (${F})`:"",ne=w.email||w.mail,Y=ne?` <${ne}>`:"";return R+Y+D};e.formatPerson=C;const c=w=>{if(typeof w!="string")return w;const R=w.match(/^([^(<]+)/),F=w.match(/\(([^)]+)\)/),D=w.match(/<([^>]+)>/),ne={};return R&&R[0].trim()&&(ne.name=R[0].trim()),D&&([,ne.email]=D),F&&([,ne.url]=F),ne};e.parsePerson=c;const N=w=>(E(w,C),E(w,c),w);e.fixPerson=N;const $=(w,R=!0)=>{if(Array.isArray(w.interfaces)||(w.interfaces=[]),w.interfaces.length)return w.interfaces.forEach(Y=>{Y.type===a.BLOCKLET_INTERFACE_TYPE_WEB&&(Y.protocol="http")}),w;const D=(0,n.default)(w,"capabilities.dynamicPathPrefix",!0)?a.BLOCKLET_DYNAMIC_PATH_PREFIX:"/",ne=({type:Y="web",name:W,path:U="/",protocol:H="http",port:A=a.BLOCKLET_DEFAULT_PORT_NAME})=>{w.interfaces.push({type:Y,name:W,path:U,prefix:D,port:A,protocol:H})};return[a.BLOCKLET_INTERFACE_PUBLIC].forEach(Y=>{w[Y]&&ne({name:Y,path:w[Y]})}),Array.isArray(w.exposeServices)&&w.exposeServices.forEach(Y=>{ne({type:"service",name:Y.protocol,protocol:Y.protocol,port:{internal:`BLOCKLET_${Y.protocol}_PORT`.toUpperCase(),external:Y.port}})}),R&&(delete w.publicUrl,delete w.adminUrl,delete w.configUrl,delete w.docUrl,delete w.exposeServices,w.capabilities&&delete w.capabilities.dynamicPathPrefix),w};e.fixInterfaces=$;const O=w=>{const{did:R}=w;try{(0,h.validateNewDid)(R),w.name=R}catch{}return w};e.fixName=O,e.default={fixRequired:u,fixRepository:f,fixFiles:j,fixKeywords:m,fixPerson:N,fixTags:S,fixName:O,formatPerson:C,parsePerson:c,fixInterfaces:$,fixService:d.fixAndValidateService}}(kt)),kt}var du=uu();function vs({owner:e,locale:t}){return l.jsxs(te,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.fullName,e.did?l.jsx(Go,{sx:{lineHeight:"initial","&::before":{content:'"("'},"&::after":{content:'")"'}},did:e.did,compact:!0,size:14,locale:t}):null]})}vs.propTypes={owner:B.object.isRequired,locale:B.string.isRequired};const hu="install-blocklet-from-URL",ys=()=>{const[e,t]=si(hu,"[]",{raw:!0}),r=s=>{const n=s.trim(),o=JSON.parse(e),a=o.findIndex(d=>d===n);a!==0&&(a>0&&o.splice(a,1),o.length>=10&&o.splice(9),o.unshift(n),t(JSON.stringify(o)))},i=s=>{if(!s)return;const n=JSON.parse(e),o=s.trim(),a=n.findIndex(d=>d===o);a>-1&&(n.splice(a,1),t(JSON.stringify(n)))};return{urls:e?JSON.parse(e):[],addUrlRecord:r,removeUrlRecord:i}};function bs({value:e="",onValueChange:t=()=>{},children:r=null,helperText:i=""}){const{urls:s,removeUrlRecord:n}=ys(),o=(a,d)=>{a.preventDefault(),a.stopPropagation(),n(d)};return l.jsxs(te,{children:[l.jsx(Ao,{freeSolo:!0,options:s,inputValue:e,onInputChange:(a,d)=>{t(d)},disableClearable:!0,popupIcon:null,renderInput:a=>$t.cloneElement(r,{...a}),renderOption:(a,d)=>q.createElement(Do,{...a,key:d,secondaryAction:l.jsx(No,{edge:"end","aria-label":"delete",onClick:h=>o(h,d),children:l.jsx(va,{})})},l.jsx(ya,{role:void 0,dense:!0,sx:{paddingLeft:0,paddingRight:30,"&:hover":{backgroundColor:"transparent"}},children:l.jsx(Mo,{primary:d,sx:{"& span":{display:"block",width:"100%",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}})})),slotProps:{listbox:{sx:{maxHeight:300,overflow:"auto"}}}}),l.jsx(ba,{style:{margin:0},children:i})]})}bs.propTypes={onValueChange:B.func,children:B.node,value:B.string,helperText:B.string};function xs({onClick:e}){const{t}=xt();return l.jsx(ul,{title:t("launchBlocklet.withoutWallet"),icon:l.jsx(yt,{icon:dl,fontSize:"1em"}),onClick:e})}xs.propTypes={onClick:B.func.isRequired};function ws({defaultUrl:e="",onCancel:t,onSuccess:r,onError:i=()=>{},mode:s="install",handleText:n={}}){const{api:o}=dn(),{api:a,session:d}=nc(),[h,u]=q.useState(!1),[f,j]=q.useState(""),{t:m,locale:S}=xt(),E={dist:{}},{encryptKey:C}=hl(),[c,N]=q.useState(e),[$,O]=q.useState(e?1:0),[w,R]=q.useState(E),[F,D]=q.useState(!1),[ne,Y]=q.useState(""),[W]=si("instant-blocklet-install",!1),[U,H]=q.useState({}),A=s==="component",J=A?!0:!e,{addUrlRecord:M}=ys(),ue=q.useMemo(()=>(d.user?.connectedAccounts||[]).some(Fe=>Fe.provider===Mt.LOGIN_PROVIDER.WALLET),[d.user]),Ie=q.useMemo(()=>{let de=c.trim();return!de.startsWith("https://")&&!de.startsWith("http://")&&!de.startsWith("file://")&&(de=`file://${de}`),de},[c]),K=async()=>{R(E),j(null),u(!0);const de=Ie;try{const ge=decodeURIComponent(de);try{new URL(ge)}catch{throw new Error("Invalid URL")}const{meta:Fe,inStore:$e,registryUrl:jt}=await o.getBlockletMetaFromUrl({input:{url:ge}});R(Fe),H({inStore:$e,registryUrl:jt,inputUrl:de}),M(de)}catch(ge){console.error(ge);const Fe=`Blocklet Install failed: ${Ur(ge)}`;j(Fe),i(ge)}finally{u(!1)}},Ee=()=>{if(A){r({meta:w,...U}),t();return}if(W){u(!0),D(!0);return}const de=rn(window?.env?.apiPrefix??"/","/launch-blocklet/install");window.location.href=Zn(de,{blocklet_meta_url:decodeURIComponent(Ie.trim()),from:"url"})},ce=()=>{u(!1),D(!1),r({meta:w,...U}),t()},Me=()=>{u(!1),D(!1)};q.useEffect(()=>{e&&K()},[e]);const me=q.useMemo(()=>({title:w.title,wt:fl(w),blockletMetaUrl:decodeURIComponent(c.trim())}),[w,c]),Oe=q.useCallback(async()=>{if(ue||W){Y("");return}const de=new URL(window.location.href);de.pathname=rn(window?.env?.apiPrefix??"/","/api/did/launch-free-blocklet-by-session/token"),de.searchParams.set("_ek_",C),Object.keys(me).forEach(Fe=>{de.searchParams.set(Fe,me[Fe])});const{data:ge}=await a.get(de.href);ge.url?Y(ge.url):Y("")},[ue,me,a,C,W]);q.useEffect(()=>{Oe()},[Oe]);const Pe=q.useMemo(()=>ue&&ne?{...me,nw:ne,skipMigrateAccount:!0}:me,[me,ne,ue]),nt=[{name:m("common.name"),value:Ft.getDisplayName({meta:w},!0)},{name:m("common.version"),value:w.version},{name:m("common.did"),value:w.did?l.jsx(rc,{did:w.did}):null},{name:m("common.author"),value:w.owner?l.jsx(vs,{owner:w.owner,locale:S}):du.formatPerson(w.author)},{name:m("blocklet.dist.downloadLink"),value:w.dist.tarball}],ut=()=>h?l.jsx("div",{style:{height:200,width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:l.jsx(Tt,{})}):w.did?l.jsx("div",{style:{paddingLeft:"10%"},children:nt.map(de=>de.name===m("common.did")?l.jsx(_i,{valueComponent:"div",nameWidth:120,name:de.name,nameFormatter:()=>m("common.did"),children:de.value},de.name):l.jsx(_i,{valueComponent:"div",nameWidth:120,name:de.name,children:de.value},de.name))}):null,ft=Xl(async()=>{let de=w.title;d.user&&(de=`${d.user.fullName}'s ${w.title}`);try{ce(),await o.launchBlockletWithoutWallet({input:{title:de,blockletMetaUrl:decodeURIComponent(c.trim()),type:"store",storeUrl:U.registryUrl,onlyRequired:!0}})}catch(ge){console.error("launchBlockletWithoutWallet error:",ge),Yn.error(Ur(ge),{autoHideDuration:3e3})}}),rt=[{label:m("blocklet.fromUrl.step0"),body:l.jsx(je,{component:"div",children:l.jsx(bs,{style:{marginBottom:32},value:c,helperText:m("blocklet.fromUrl.description"),onValueChange:de=>{j(null),N(de)},children:l.jsx(Hn,{label:m("blocklet.fromUrl.label"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"blocklet-url-input",fullWidth:!0,autoFocus:!0,margin:"dense",value:c,onChange:de=>{j(null),N(de.target.value)},disabled:h,onKeyPress:de=>{de.key==="Enter"&&(de.preventDefault(),K(),O(1))}})})}),cancel:m("common.cancel"),confirm:m("common.next"),onCancel:t,onConfirm:()=>{K(),O(1)}},{label:m("blocklet.fromUrl.step1"),body:ut(),cancel:m(J?"common.pre":"common.cancel"),confirm:n?.confirm||m("blocklet.fromUrl.confirm"),onCancel:()=>{J?O(de=>de-1):t()},onConfirm:()=>{Ee()}}],we=rt[$];return l.jsxs(l.Fragment,{children:[l.jsxs(oi,{title:n?.title||m("blocklet.fromUrl.title"),fullWidth:!0,maxWidth:"md",onClose:()=>we.onCancel(),showCloseButton:$===0,disableEscapeKeyDown:!0,open:!0,actions:l.jsxs(l.Fragment,{children:[we.cancel&&l.jsx(vt,{onClick:de=>{de.stopPropagation(),j(null),we.onCancel()},color:"inherit",children:we.cancel||m("common.cancel")}),l.jsxs(vt,{onClick:de=>{de.stopPropagation(),we.onConfirm()},color:"primary","data-cy":"install-blocklet-next-step",disabled:h||!c||f,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[h&&$===0&&l.jsx(Tt,{size:16}),we.confirm]})]}),children:[J&&l.jsx(xa,{alternativeLabel:!0,activeStep:$,children:rt.map(({label:de})=>l.jsx(wa,{children:l.jsx(Sa,{children:de})},de))}),l.jsx(Ea,{component:"div",style:{marginTop:24},children:we.body}),!!f&&l.jsx(Bo,{severity:"error",style:{width:"100%",marginTop:8},children:f})]}),w&&F&&l.jsx(Jo,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:!ue&&!W?"bind-wallet":"launch-free-blocklet-by-session",checkFn:a.get,checkTimeout:5*60*1e3,onSuccess:ce,extraParams:Pe,messages:{title:m("setup.keyPair.title"),scan:m("setup.keyPair.scan"),confirm:m("setup.keyPair.confirm"),success:m("setup.keyPair.success")},onClose:Me,customItems:W?[]:[l.jsx(xs,{onClick:ft})]})]})}ws.propTypes={defaultUrl:B.string,onCancel:B.func.isRequired,onSuccess:B.func.isRequired,onError:B.func,mode:B.oneOf(["install","component"]),handleText:B.object};const fu={meta:B.object.isRequired,onCancel:B.func.isRequired};function Ss({action:e,onSelect:t,onNext:r}){const{t:i}=xt(),s=[{action:"purchase",title:i("store.purchase.purchase.title"),description:i("store.purchase.purchase.description")},{action:"verify",title:i("store.purchase.verify.title"),description:i("store.purchase.verify.description")}];return l.jsxs(l.Fragment,{children:[l.jsx(ka,{children:s.map(n=>l.jsxs(Do,{button:!0,selected:e===n.action,onClick:()=>t(n.action),children:[l.jsx(Ta,{sx:{minWidth:48},children:n.action==="purchase"?l.jsx(ja,{style:{color:e==="purchase"?Oi.primary.main:"#AAA",fontSize:32}}):l.jsx(Oa,{style:{color:e==="verify"?Oi.primary.main:"#AAA",fontSize:32}})}),l.jsx(Mo,{primary:n.title,secondary:n.description})]},n.action))}),r&&l.jsx(vt,{fullWidth:!0,disabled:!e,variant:"contained",color:"primary",style:{marginTop:16},onClick:r,children:i("common.next")})]})}Ss.propTypes={action:B.oneOf(["both","purchase","verify"]).isRequired,onSelect:B.func.isRequired,onNext:B.func.isRequired};function Es({meta:e,onCancel:t,mode:r,handlePaySuccess:i=()=>{}}){const{t:s,locale:n}=xt(),{info:o}=dn(),a=pl(o),[d,h]=q.useState(null),u=new URL(e?.registryUrl).origin,f=Ft.getDisplayName({meta:e}),j=async(S,E)=>{const C=({downloadTokenList:$})=>{i({downloadTokenList:$})},c=$=>{Yn.error($),t($)};function N($){return gl(()=>Ni.get($).then(async({data:O})=>{const w=O?.downloadTokenList;if(O.status==="succeed"){if(w&&w.length)await C({downloadTokenList:w});else return await c(s("blocklet.component.missDownloadTokenTip")),!0;return!0}return O.status==="error"?(console.error("vc error: ",O),await c(O?.error),!0):!1}),{interval:1e3})}if(r==="purchase"&&d){const{statusUrl:$}=ml(d);await N($)}else await C({downloadTokenList:S.downloadTokenList&&E(S.downloadTokenList)})};if(q.useEffect(()=>{if(r==="purchase"){const S=new URL(u);S.pathname="/api/did/verify-purchase-blocklet/token",S.searchParams.set("serverDid",o.did),S.searchParams.set("blockletDid",e?.did);try{Ni.get(S.href).then(({data:E})=>{const C=`${E.url}`;h(C)})}catch(E){console.error("get next workflow url error: ",E)}}return()=>{h(null)}},[r]),r==="purchase"&&!d)return"";const m={verify:{action:"verify-purchase-blocklet",checkFn:Li.create({baseURL:u}).get,extraParams:{serverDid:o.did,blockletDid:e?.did},messages:{title:s("store.purchase.verify.auth.title",{name:f}),scan:s("store.purchase.verify.auth.scan"),confirm:s("store.purchase.verify.auth.confirm"),success:s("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:Li.create({baseURL:rn(u,"/store")}).get,extraParams:{factory:e.nftFactory,nw:d},messages:{title:s("store.purchase.auth.title",{name:f}),scan:s("store.purchase.auth.scan"),confirm:s("store.purchase.auth.confirm"),success:l.jsxs(l.Fragment,{children:[l.jsx("p",{children:s("store.purchase.auth.success")}),l.jsx("p",{children:s("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return l.jsx(Jo,{open:!0,locale:n,popup:!1,saveConnect:!1,className:"connect",baseUrl:u,onSuccess:j,cancelWhenScanned:t,onClose:t,checkTimeout:60*5e3,webWalletUrl:a,disableClose:!0,showDownload:!1,...m[r]})}Es.propTypes={...fu,handlePaySuccess:B.func,mode:B.oneOf(["verify","purchase"]).isRequired};function ks({ref:e=null,mode:t,...r}){const[i,s]=q.useState(t!=="both"?t:"verify"),[n,o]=q.useState(t!=="both"?2:1),a=h=>{h!==i&&s(h)},d=()=>{i&&n!==2&&o(2)};return q.useImperativeHandle(e,()=>({onNext:d,getCurrentStep:()=>n})),n===1?l.jsx("div",{style:{maxWidth:520},children:l.jsx(Ss,{action:i,onNext:null,onSelect:a})}):l.jsx(Es,{...r,mode:i})}ks.propTypes={mode:B.oneOf(["both","verify","purchase"]).isRequired,ref:B.any};function pu({...e}){return l.jsx(vt,{className:"bottom-button",variant:"contained",color:"primary",...e})}function Ts({blocklet:e=null,onStartNow:t=()=>{},children:r=null,disabled:i=!1}){const{t:s}=xt(),n=is();return!e||vl(e.meta)?l.jsx(mu,{children:r}):l.jsxs(gu,{isMobile:n,children:[l.jsx(pu,{className:"start-now",variant:"contained",color:"primary",disabled:i,onClick:()=>t(),children:s("setup.startNow")}),l.jsx(te,{sx:{display:"flex",alignItems:"center"},children:r})]})}Ts.propTypes={blocklet:B.object,onStartNow:B.func,children:B.any,disabled:B.bool};const mu=tt(te)`
220
+ `),O=c.string().trim().min(1).custom(V=>{if(E(V)>u.MAX_TITLE_LENGTH)throw new Error(`title length should not exceed ${u.MAX_TITLE_LENGTH} (see: https://www.npmjs.com/package/cjk-length)`);return V}).meta({className:"TTitle"});ae.titleSchema=O;const w=c.string().trim().min(3).max(160).meta({className:"TDescription"});ae.descriptionSchema=w;const R=c.string().trim().min(3).max(20).messages({"*":"Title length must be between 3 and 20 characters"}).meta({className:"TInstallBlockletTitle"});ae.installBlockletTitleSchema=R;const F=c.string().trim().min(3).max(80).messages({"*":"Description length must be between 3 and 80 characters"}).meta({className:"TInstallBlockletDescription"});ae.installBlockletDescriptionSchema=F;const D=c.string().uri({scheme:["http","https"],allowRelative:!0}).allow("").custom((V,he)=>V.includes(a.WELLKNOWN_BLOCKLET_LOGO_PATH)?he.message(`logo url should not include ${a.WELLKNOWN_BLOCKLET_LOGO_PATH}`):V).meta({className:"TLogo"});ae.logoSchema=D;const ne=c.string().trim().min(1),Y=ne.meta({className:"TMountPoint"}).custom((V,he)=>(0,S.isValidUrlPath)(V)?V:he.message(`mountPoint cannot contain such characters space $*+~()'"!:@\\`));ae.mountPointSchema=Y;const W=ne.meta({className:"TUpdateMountPoint"}).custom(V=>(0,S.urlPathFriendly)(V));ae.updateMountPointSchema=W;const U=c.string().custom(V=>((0,m.validateName)(V),V)).meta({className:"TBlockletName"});ae.blockletNameSchema=U;const H=[],A=c.string().trim().min(1).max(50).required().custom((V,he)=>V.startsWith("BLOCKLET")&&!H.includes(V)?he.message("Env name can not start with BLOCKLET_"):V.startsWith("COMPONENT")?he.message("Env name can not start with COMPONENT_"):V.startsWith("ABTNODE")?he.message("Env name can not start with ABTNODE_"):/[^\w]/.test(V)?he.message('Env name can include only numbers or letters or "_"'):V).meta({className:"TEnvironmentName",unknownType:"any"});ae.environmentNameSchema=A;const J=c.object({name:A.required(),description:c.string().trim().required(),default:c.string().optional().allow("").default(""),required:c.boolean().default(!1),secure:c.boolean().default(!1),validation:c.string().optional(),shared:c.boolean().default(V=>V.secure?!1:void 0)}).custom((V,he)=>V.secure&&V.default?he.message(`Cannot declare default value for secure env ${V.name}`):V).meta({className:"TEnvironment",unknownType:"any"});ae.environmentSchema=J;const M=c.object({dev:c.string().trim().min(1),e2eDev:c.string().trim().min(1),preFlight:c.string().trim().min(1),preInstall:c.string().trim().min(1),postInstall:c.string().trim().min(1),preStart:c.string().trim().min(1),postStart:c.string().trim().min(1),preStop:c.string().trim().min(1),preUninstall:c.string().trim().min(1),preConfig:c.string().trim().min(1)}).rename("pre-flight","preFlight").rename("pre-install","preInstall").rename("post-install","postInstall").rename("pre-start","preStart").rename("post-start","postStart").rename("pre-stop","preStop").rename("pre-uninstall","preUninstall").rename("pre-config","preConfig").optional().meta({className:"TScripts",unknownType:"any"});ae.scriptsSchema=M;const ue=c.object({name:c.string().required().trim(),config:c.object().optional().default({})}).unknown(!0).meta({className:"TService",unknownType:"any"});ae.serviceSchema=ue;const Ie=c.object({type:c.string().trim(!0).min(1).required(),path:c.string().required(),meta:c.object({vcType:c.string(),payable:c.boolean(),params:c.array().items({name:c.string().required().trim(),description:c.string().required().trim()})})}).meta({className:"TEndpoint",unknownType:"any"});ae.endpointSchema=Ie;const K=c.string().trim().custom((V,he)=>{const De=V.split("/").filter(Boolean);return De.length===0?he.message("cacheable path must be a valid pathname that is not /"):`/${De.join("/")}`}).meta({className:"TPathPrefix",unknownType:"any"});ae.cacheableSchema=K;const Ee=c.object({type:c.string().lowercase().valid(...u.BLOCKLET_INTERFACE_TYPES).required(),name:c.string().trim().required(),path:c.string().trim().default("/"),prefix:c.string().trim().min(1).default(u.BLOCKLET_DYNAMIC_PATH_PREFIX),containerPort:c.number().port().optional(),hostIP:c.string().trim().ip({version:["ipv4","ipv6"]}).optional(),protocol:c.string().lowercase().valid(...u.BLOCKLET_INTERFACE_PROTOCOLS).default("http"),port:c.alternatives().try(c.string().uppercase().default(u.BLOCKLET_DEFAULT_PORT_NAME),c.object({internal:c.string().uppercase().required(),external:c.number().port().required()})).default(u.BLOCKLET_DEFAULT_PORT_NAME),cacheable:c.array().items(K).unique(),services:c.array().items(ue).unique("name"),endpoints:c.array().items(Ie).unique("type"),pageGroups:c.array().items(c.string().min(1).max(255).trim()).unique(),proxyBehavior:c.string().valid("service","direct").default("service").optional()}).meta({className:"TInterface",unknownType:"any"});ae.interfaceSchema=Ee;const ce=c.alternatives().try(c.string().required(),c.object({url:c.string().uri({scheme:["http","https","file"]}).required(),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid())}),c.object({store:c.string().uri({scheme:["http","https"]}).required(),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid()).default("latest")})),Me=c.object({platform:c.string().valid(...u.BLOCKLET_PLATFORMS).optional(),interpreter:c.string().valid("binary","node","blocklet","bun").default("node"),source:ce,args:c.array().items(c.string()).optional().default([])}).meta({className:"TEngine",unknownType:"any"});ae.engineSchema=Me;const me=c.object({name:c.string().min(1).required(),email:c.string().email({tlds:!1}).optional(),url:c.string().uri().optional()}).meta({className:"TPerson",unknownType:"any"});ae.personSchema=me;const Oe=c.object({tarball:c.alternatives().try(c.string().uri(),c.string()).required(),integrity:c.string().required(),size:c.number().optional()}).meta({className:"TDist",unknownType:"any"});ae.distSchema=Oe;const Pe=c.object({downloads:c.number().integer().greater(-1),star:c.number().default(0),purchases:c.number().default(0)}).meta({className:"TStats",unknownType:"any"});ae.statsSchema=Pe;const ut={source:c.alternatives().try(c.object({url:c.alternatives().try(c.string().uri(),c.array().items(c.string().uri()).min(1)).required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid())}),c.object({store:c.string().uri({scheme:["http","https"]}),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid()).default("latest")})).required(),required:c.boolean(),title:O,description:w,mountPoint:Y,name:U},ft=(V,he)=>c.object(V).custom((De,Xe)=>!he&&De.source&&De.source.name&&!De.source.store?Xe.message(`missing 'store' in source of component ${De.name}`):De),rt=ft(ut).meta({className:"TComponent",unknownType:"any"});ae.componentSchema=rt;const we=ft(ut,!0),de=({checkStore:V}={})=>{const he=[rt,we];return c.array().items(V?he[0]:he[1]).optional().default([])},ge=c.object({type:c.string().required(),name:c.string().required(),signer:c.string().required(),pk:c.string().required(),created:c.string().isoDate().required(),sig:c.string().required(),excludes:c.array().items(c.string()).optional(),appended:c.array().items(c.string()).optional(),delegatee:c.string(),delegateePk:c.string(),delegation:c.string()}).meta({className:"TSignature",unknownType:"any"});ae.signatureSchema=ge;const Fe=["en","zh","fr","ru","ar","es","de","pt","ja","hi"],$e={id:c.string().custom($),title:c.alternatives().try(c.string().min(1).max(u.MAX_TITLE_LENGTH),c.object().min(1).pattern(c.string().valid(...Fe),c.string().min(1).max(u.MAX_TITLE_LENGTH))).required(),description:c.alternatives().try(c.string().min(1).max(u.MAX_DESCRIPTION_LENGTH),c.object().min(1).pattern(c.string().valid(...Fe),c.string().min(1).max(u.MAX_DESCRIPTION_LENGTH))),link:c.alternatives().try(c.string().custom(N),c.object().min(1).pattern(c.string().valid(...Fe),c.string().custom(N))),component:c.string().min(1),section:c.array().items(c.string().valid("header","footer","bottom","social","dashboard","sessionManager","userCenter","bottomNavigation")).single(),role:c.array().items(c.string().min(1)).single(),icon:c.string().min(1),visible:c.boolean(),private:c.boolean()},jt=c.object({...$e,items:c.array().items(c.object({...$e}).rename("child","component"))}).rename("child","component").meta({className:"TNavigationItem",unknownType:"any"});ae.navigationItemSchema=jt;const Ae=c.array().items(jt).unique((V,he)=>V.id&&he.id?V.id===he.id:!1).meta({className:"TNavigation",unknownType:"any"});ae.navigationSchema=Ae;const Et=c.object({background:c.alternatives().try(c.string().min(1),c.object({header:c.string().min(1),footer:c.string().min(1),default:c.string().min(1)}).min(1))}).meta({className:"TTheme",unknownType:"any"});ae.themeSchema=Et;const Ot=c.object({whoCanAccess:c.string().valid("owner","invited","all"),profileFields:c.array().items(c.string().valid("fullName","email","avatar","phone")).unique(),ignoreUrls:c.array().items(c.string().min(1)),allowSwitchProfile:c.boolean(),blockUnauthenticated:c.boolean(),blockUnauthorized:c.boolean()}).options({stripUnknown:!0}).meta({className:"TAuthConfig",unknownType:"any"});ae.authConfigSchema=Ot;const Ct=c.object({type:c.string().trim().min(1).required(),description:c.string().trim().min(1)}),It=c.object({did:c.DID().trim().required(),type:c.string().trim().min(1).required(),public:c.boolean()}).meta({className:"TResourceBundle",unknownType:"any"});ae.resourceBundleSchema=It;const Ve=c.array().items(c.object({type:c.string().trim().min(1).max(128).pattern(/^(?!blocklet\.)[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/).message('Event type must be in format of "[noun.]verb" like "post.published" or "post.comment.published", and prefix "blocklet." is reserved').required(),description:c.string().trim().min(1).max(256).required()})).unique("type").meta({className:"TEvent",unknownType:"any"});ae.eventsSchema=Ve;const Rt={did:c.DID().trim().required(),version:c.semver().valid().required(),name:c.string().optional(),description:w.required(),group:c.string().valid(...u.BLOCKLET_GROUPS),main:c.string().trim(),title:O.optional().allow(""),logo:c.string().trim().optional(),specVersion:c.semver().valid().gte("1.0.0").optional(),author:me.optional(),contributors:c.array().items(me).optional(),maintainers:c.array().items(me).optional(),community:c.string().uri().optional().allow("").default(""),documentation:c.string().uri().optional().allow("").default(""),homepage:c.string().uri().optional().allow("").default(""),license:c.string().optional().allow("").default(""),support:c.alternatives().try(c.string().uri(),c.string().email({tlds:!1})).optional(),nftFactory:c.DID().optional().allow("").default(""),payment:c.object({price:c.array().max(1).items(c.object({value:c.number().greater(0).required(),address:c.DID().required()})).default([]),share:c.array().max(4).items(c.object({name:c.string().required(),address:c.DID().required(),value:c.number().greater(0).max(1).required()})).default([]).custom(V=>{if(V.length===0)return V;const he=V.reduce((De,Xe)=>De+Xe.value,0);if(he!==1)throw new Error(`Invalid blocklet payment share config: total share must be 1, got ${he}`);return V},"invalid blocklet share"),componentPrice:c.array().items(c.object({parentPriceRange:c.array().items(c.number()).custom((V,he)=>V.length!==2?he.message("length of range should be 2"):V[0]<0?he.message("the first value should not less than 0 in range"):V[1]<=V[0]?he.message("the second value should greater than the first value in range"):V),type:c.string().valid("fixed","percentage").required(),value:c.number().greater(0).required()})).single()}).default({price:[],share:[]}),keywords:c.alternatives().try(c.string().trim().min(1),c.array().items(c.string().min(1))).optional(),tags:c.alternatives().try(c.string().trim().min(1),c.array().items(c.string().min(1))).optional(),gitHash:c.string().optional().allow(""),repository:c.alternatives().try(c.string().min(1),c.object({type:c.string().valid("git","https","svn").required(),url:c.string().uri().required(),directory:c.string()})).optional(),timeout:c.object({start:c.number().min(10).max(600),script:c.number().min(1).max(1800)}).default({start:60}),requirements:c.object({abtnode:c.semverRange().valid(),server:c.semverRange().valid(),os:c.alternatives().try(c.string().valid("*",...u.BLOCKLET_PLATFORMS),c.array().items(c.string().valid(...u.BLOCKLET_PLATFORMS)).min(1)),cpu:c.alternatives().try(c.string().valid("*",...u.BLOCKLET_ARCHITECTURES),c.array().items(c.string().valid(...u.BLOCKLET_ARCHITECTURES)).min(1)),fuels:c.array().items(c.object({endpoint:c.string().trim().required(),address:c.string().trim(),value:c.string().trim().required(),reason:c.string().trim().required()})),nodejs:c.semverRange().valid(),aigne:c.boolean().optional()}).default({server:u.BLOCKLET_LATEST_REQUIREMENT_SERVER,os:"*",cpu:"*",nodejs:"*"}),interfaces:c.array().items(Ee).unique("name").custom((V,he)=>{if(V.filter(it=>it.type===u.BLOCKLET_INTERFACE_TYPE_WEB).length>1)return he.message(`Only one ${u.BLOCKLET_INTERFACE_TYPE_WEB} interface can be declared`);const Xe=V.filter(it=>it.type===u.BLOCKLET_INTERFACE_TYPE_WELLKNOWN);for(const it of Xe)if(!it.prefix.startsWith(C))return he.message(`Wellknown path prefix must start with: ${C}`);return V}).default([]),environments:c.array().items(J).default([]).optional().custom((V,he)=>{if(V&&V.length){const De=V.filter((Xe,it)=>V.findIndex(wt=>wt.name===Xe.name)!==it);if(De.length)return he.message(`find duplicate environment names ${De.map(Xe=>Xe.name).join(", ")}`)}return V}),scripts:M,capabilities:c.object({clusterMode:c.boolean(),didSpace:c.string().valid(...Object.values(u.BLOCKLET_APP_SPACE_REQUIREMENT)).optional(),navigation:c.boolean().default(!0),serverless:c.boolean().optional(),component:c.boolean(),sitemap:c.boolean().optional(),mcp:c.boolean().optional(),singleton:c.boolean().optional()}).default({}),files:c.array().items(c.string().trim()).optional(),resource:c.object({exportApi:c.string().trim(),bundles:c.array().items(It),types:c.array().items(Ct).max(10)}),engine:c.alternatives().try(Me,c.array().items(Me)).optional(),screenshots:c.array().items(c.string().min(1)).optional().default([]),videos:c.array().items(c.string().pattern(/^https:\/\/(www\.)?(youtube\.com|youtu\.be|vimeo\.com)\/[\w\-/?&=]+/).message("Each video URL must be a valid YouTube or Vimeo link")).max(3).optional(),logoUrl:c.string().optional().allow(""),dist:Oe.optional(),stats:Pe.optional(),htmlAst:c.any().optional(),path:c.string().optional(),signatures:c.array().items(ge).optional(),lastPublishedAt:c.string().isoDate().optional().allow(null),components:de(),navigation:Ae,theme:Et,copyright:c.object({owner:c.string().min(1),year:c.alternatives().try(c.string(),c.number())}),bundleName:c.string(),bundleDid:c.DID().trim(),storeId:c.string(),events:Ve.optional()},pt=c.object(Rt).options({stripUnknown:!0,noDefaults:!1}).meta({className:"TBlockletMeta",unknownType:"any"});ae.blockletMetaSchema=pt;const st=(V,{ensureFiles:he=!1,ensureDist:De=!1,ensureComponentStore:Xe=!0,ensureName:it=!1,skipValidateDidName:wt=!1,...qt}={})=>((!V||!t.default.existsSync(V))&&(he=!1),c.object({...Rt,owner:c.object({avatar:c.string().optional(),did:c.DID().trim().required(),fullName:c.string().trim().required(),email:c.string().optional().allow(null).empty("").default("")}).optional(),logo:he?c.file().trim().exists({baseDir:V}).optional():c.string().trim().optional(),files:c.array().items(he?c.file().exists({baseDir:V,canSkip:(Ue,L)=>[u.BLOCKLET_ENTRY_FILE,u.BLOCKLET_BUNDLE_FILE].includes(L)||(0,s.default)(L)}):c.string().trim()).optional(),dist:De?Oe.required():Oe.optional(),components:de({checkStore:Xe}),name:it?c.string().optional():c.string().required(),egress:c.boolean().optional().default(!0),docker:h.dockerSchema}).options({stripUnknown:!0,noDefaults:!1,...qt}).rename("children","components").custom((Ue,L)=>{const{did:re,name:ve,docker:Re}=Ue;if(Re){const{image:b,dockerfile:k,network:_}=Re;if(!b&&!k)return L.message("Image or dockerfile must be set");if(b&&k)return L.message("Image and dockerfile cannot be set at the same time");if(_)return L.message("ExportPorts and network cannot be set at the same time");k&&(Ue.files||(Ue.files=[]),Ue.files.push(k))}let p;if((0,d.isValid)(re))try{return(0,m.validateNewDid)(re),Ue}catch(b){p=b}if(ve){(0,m.validateName)(ve,{checkDid:!wt});const b=(0,f.toBlockletDid)(ve);return b!==re?L.message(`The did of name "${ve}" should be "${b}"`):Ue}return p?L.message(p.message):Ue}));return ae.createBlockletSchema=st,ae.default={blockletNameSchema:U,componentSchema:rt,endpointSchema:Ie,serviceSchema:ue,createBlockletSchema:st,interfaceSchema:Ee,environmentSchema:J,environmentNameSchema:A,scriptsSchema:M,personSchema:me,distSchema:Oe,titleSchema:O,descriptionSchema:w,logoSchema:D,navigationSchema:Ae,themeSchema:Et,mountPointSchema:Y,updateMountPointSchema:W,authConfigSchema:Ot,resourceBundleSchema:It,installBlockletTitleSchema:R,installBlockletDescriptionSchema:F,eventsSchema:Ve,Joi:c},ae}var ht={},so;function lu(){if(so)return ht;so=1;var e=ht&&ht.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(ht,"__esModule",{value:!0}),ht.setService=ht.findService=ht.getDefaultServiceConfig=ht.getServiceConfig=void 0;const t=e(tc),r=gs(),i={},s=h=>{i[h.name]={validate:h.schema.validate.bind(h.schema),defaultConfig:h.default}};ht.setService=s,s({name:"auth",schema:r.authConfigSchema,default:{}});const n=h=>{if(!h)throw new Error("service name should not be empty");const u=i[h];if(!u)throw new Error(`service ${h} does not exist`);return u},o=(h,u,{validate:f}={})=>{const j=n(h),m=(0,t.default)(u||{}),{value:S,error:E}=j.validate(m);if(f&&E)throw new Error(`Invalid blocklet service config: ${E.details.map(C=>C.message).join(", ")}`);return S};ht.getServiceConfig=o;const a=h=>{const{defaultConfig:u}=n(h);return u};ht.getDefaultServiceConfig=a;const d=(h,u)=>{const f=[u];return(h||[]).find(j=>f.includes(j.name))};return ht.findService=d,ht.default={getServiceConfig:o,getDefaultServiceConfig:a,findService:d,setService:s},ht}var ao;function cu(){if(ao)return Gt;ao=1,Object.defineProperty(Gt,"__esModule",{value:!0}),Gt.fixAndValidateService=Gt.validateMeta=void 0;const e=gs(),t=lu(),r=s=>(!s.interfaces||!s.interfaces.length||s.interfaces.forEach(n=>{n.services&&n.services.length&&n.services.forEach(o=>{o.config=(0,t.getServiceConfig)(o.name,o.config,{validate:!0})})}),s);Gt.fixAndValidateService=r;const i=(s,{ensureFiles:n=!1,ensureDist:o=!1,ensureComponentStore:a=!0,ensureName:d=!1,skipValidateDidName:h=!1,schemaOptions:u={}}={})=>{const f=(0,e.createBlockletSchema)(null,{ensureFiles:n,ensureDist:o,ensureComponentStore:a,ensureName:d,skipValidateDidName:h,...u}),{value:j,error:m}=f.validate(s);if(m)throw new Error(`Invalid blocklet meta: ${m.details.map(S=>S.message).join(", ")}`);return j};return Gt.validateMeta=i,Gt.default=i,Gt}var lo;function uu(){return lo||(lo=1,function(e){var t=kt&&kt.__createBinding||(Object.create?function(w,R,F,D){D===void 0&&(D=F);var ne=Object.getOwnPropertyDescriptor(R,F);(!ne||("get"in ne?!R.__esModule:ne.writable||ne.configurable))&&(ne={enumerable:!0,get:function(){return R[F]}}),Object.defineProperty(w,D,ne)}:function(w,R,F,D){D===void 0&&(D=F),w[D]=R[F]}),r=kt&&kt.__setModuleDefault||(Object.create?function(w,R){Object.defineProperty(w,"default",{enumerable:!0,value:R})}:function(w,R){w.default=R}),i=kt&&kt.__importStar||function(){var w=function(R){return w=Object.getOwnPropertyNames||function(F){var D=[];for(var ne in F)Object.prototype.hasOwnProperty.call(F,ne)&&(D[D.length]=ne);return D},w(R)};return function(R){if(R&&R.__esModule)return R;var F={};if(R!=null)for(var D=w(R),ne=0;ne<D.length;ne++)D[ne]!=="default"&&t(F,R,D[ne]);return r(F,R),F}}(),s=kt&&kt.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(e,"__esModule",{value:!0}),e.fixService=e.fixInterfaces=e.parsePerson=e.formatPerson=e.fixName=e.fixTags=e.fixPerson=e.fixKeywords=e.fixFiles=e.fixRepository=e.fixRequired=void 0;const n=s(cl),o=i(Gc()),a=Yo(),d=cu();Object.defineProperty(e,"fixService",{enumerable:!0,get:function(){return d.fixAndValidateService}});const h=ms(),u=(w,R)=>{w.description||(w.description=`Blocklet from ${R}`),w.version||(w.version=a.BLOCKLET_DEFAULT_VERSION)};e.fixRequired=u;const f=w=>{if(w.repository&&(typeof w.repository=="string"&&(w.repository={type:"git",url:w.repository}),w.repository.url)){const R=o.fromUrl(w.repository.url);R&&(w.repository.url=R.getDefaultRepresentation()==="shortcut"?R.https():R.toString())}};e.fixRepository=f;const j=w=>{Array.isArray(w.files)?w.files&&(w.files=w.files.filter(R=>!(!R||typeof R!="string"))):delete w.files};e.fixFiles=j;const m=w=>{typeof w.keywords=="string"&&(w.keywords=w.keywords.split(/,\s+/)),w.keywords&&!Array.isArray(w.keywords)?delete w.keywords:w.keywords&&(w.keywords=w.keywords.filter(R=>!(typeof R!="string"||!R)))};e.fixKeywords=m;const S=w=>{typeof w.tags=="string"&&(w.tags=w.tags.split(/,\s+/)),w.tags&&!Array.isArray(w.tags)?delete w.tags:w.tags&&(w.tags=w.tags.filter(R=>!(typeof R!="string"||!R)))};e.fixTags=S;const E=(w,R)=>(w.author&&(w.author=R(w.author)),["maintainers","contributors"].forEach(F=>{Array.isArray(w[F])&&(w[F]=w[F].map(R))}),w),C=w=>{if(!w)return"";if(typeof w=="string")return w;const R=w.name||"",F=w.url||w.web,D=F?` (${F})`:"",ne=w.email||w.mail,Y=ne?` <${ne}>`:"";return R+Y+D};e.formatPerson=C;const c=w=>{if(typeof w!="string")return w;const R=w.match(/^([^(<]+)/),F=w.match(/\(([^)]+)\)/),D=w.match(/<([^>]+)>/),ne={};return R&&R[0].trim()&&(ne.name=R[0].trim()),D&&([,ne.email]=D),F&&([,ne.url]=F),ne};e.parsePerson=c;const N=w=>(E(w,C),E(w,c),w);e.fixPerson=N;const $=(w,R=!0)=>{if(Array.isArray(w.interfaces)||(w.interfaces=[]),w.interfaces.length)return w.interfaces.forEach(Y=>{Y.type===a.BLOCKLET_INTERFACE_TYPE_WEB&&(Y.protocol="http")}),w;const D=(0,n.default)(w,"capabilities.dynamicPathPrefix",!0)?a.BLOCKLET_DYNAMIC_PATH_PREFIX:"/",ne=({type:Y="web",name:W,path:U="/",protocol:H="http",port:A=a.BLOCKLET_DEFAULT_PORT_NAME})=>{w.interfaces.push({type:Y,name:W,path:U,prefix:D,port:A,protocol:H})};return[a.BLOCKLET_INTERFACE_PUBLIC].forEach(Y=>{w[Y]&&ne({name:Y,path:w[Y]})}),Array.isArray(w.exposeServices)&&w.exposeServices.forEach(Y=>{ne({type:"service",name:Y.protocol,protocol:Y.protocol,port:{internal:`BLOCKLET_${Y.protocol}_PORT`.toUpperCase(),external:Y.port}})}),R&&(delete w.publicUrl,delete w.adminUrl,delete w.configUrl,delete w.docUrl,delete w.exposeServices,w.capabilities&&delete w.capabilities.dynamicPathPrefix),w};e.fixInterfaces=$;const O=w=>{const{did:R}=w;try{(0,h.validateNewDid)(R),w.name=R}catch{}return w};e.fixName=O,e.default={fixRequired:u,fixRepository:f,fixFiles:j,fixKeywords:m,fixPerson:N,fixTags:S,fixName:O,formatPerson:C,parsePerson:c,fixInterfaces:$,fixService:d.fixAndValidateService}}(kt)),kt}var du=uu();function vs({owner:e,locale:t}){return l.jsxs(te,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.fullName,e.did?l.jsx(Go,{sx:{lineHeight:"initial","&::before":{content:'"("'},"&::after":{content:'")"'}},did:e.did,compact:!0,size:14,locale:t}):null]})}vs.propTypes={owner:B.object.isRequired,locale:B.string.isRequired};const hu="install-blocklet-from-URL",ys=()=>{const[e,t]=si(hu,"[]",{raw:!0}),r=s=>{const n=s.trim(),o=JSON.parse(e),a=o.findIndex(d=>d===n);a!==0&&(a>0&&o.splice(a,1),o.length>=10&&o.splice(9),o.unshift(n),t(JSON.stringify(o)))},i=s=>{if(!s)return;const n=JSON.parse(e),o=s.trim(),a=n.findIndex(d=>d===o);a>-1&&(n.splice(a,1),t(JSON.stringify(n)))};return{urls:e?JSON.parse(e):[],addUrlRecord:r,removeUrlRecord:i}};function bs({value:e="",onValueChange:t=()=>{},children:r=null,helperText:i=""}){const{urls:s,removeUrlRecord:n}=ys(),o=(a,d)=>{a.preventDefault(),a.stopPropagation(),n(d)};return l.jsxs(te,{children:[l.jsx(Ao,{freeSolo:!0,options:s,inputValue:e,onInputChange:(a,d)=>{t(d)},disableClearable:!0,popupIcon:null,renderInput:a=>$t.cloneElement(r,{...a}),renderOption:(a,d)=>q.createElement(Do,{...a,key:d,secondaryAction:l.jsx(No,{edge:"end","aria-label":"delete",onClick:h=>o(h,d),children:l.jsx(va,{})})},l.jsx(ya,{role:void 0,dense:!0,sx:{paddingLeft:0,paddingRight:30,"&:hover":{backgroundColor:"transparent"}},children:l.jsx(Mo,{primary:d,sx:{"& span":{display:"block",width:"100%",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}})})),slotProps:{listbox:{sx:{maxHeight:300,overflow:"auto"}}}}),l.jsx(ba,{style:{margin:0},children:i})]})}bs.propTypes={onValueChange:B.func,children:B.node,value:B.string,helperText:B.string};function xs({onClick:e}){const{t}=xt();return l.jsx(ul,{title:t("launchBlocklet.withoutWallet"),icon:l.jsx(yt,{icon:dl,fontSize:"1em"}),onClick:e})}xs.propTypes={onClick:B.func.isRequired};function ws({defaultUrl:e="",onCancel:t,onSuccess:r,onError:i=()=>{},mode:s="install",handleText:n={}}){const{api:o}=dn(),{api:a,session:d}=nc(),[h,u]=q.useState(!1),[f,j]=q.useState(""),{t:m,locale:S}=xt(),E={dist:{}},{encryptKey:C}=hl(),[c,N]=q.useState(e),[$,O]=q.useState(e?1:0),[w,R]=q.useState(E),[F,D]=q.useState(!1),[ne,Y]=q.useState(""),[W]=si("instant-blocklet-install",!1),[U,H]=q.useState({}),A=s==="component",J=A?!0:!e,{addUrlRecord:M}=ys(),ue=q.useMemo(()=>(d.user?.connectedAccounts||[]).some(Fe=>Fe.provider===Mt.LOGIN_PROVIDER.WALLET),[d.user]),Ie=q.useMemo(()=>{let de=c.trim();return!de.startsWith("https://")&&!de.startsWith("http://")&&!de.startsWith("file://")&&(de=`file://${de}`),de},[c]),K=async()=>{R(E),j(null),u(!0);const de=Ie;try{const ge=decodeURIComponent(de);try{new URL(ge)}catch{throw new Error("Invalid URL")}const{meta:Fe,inStore:$e,registryUrl:jt}=await o.getBlockletMetaFromUrl({input:{url:ge}});R(Fe),H({inStore:$e,registryUrl:jt,inputUrl:de}),M(de)}catch(ge){console.error(ge);const Fe=`Blocklet Install failed: ${Ur(ge)}`;j(Fe),i(ge)}finally{u(!1)}},Ee=()=>{if(A){r({meta:w,...U}),t();return}if(W){u(!0),D(!0);return}const de=rn(window?.env?.apiPrefix??"/","/launch-blocklet/install");window.location.href=Zn(de,{blocklet_meta_url:decodeURIComponent(Ie.trim()),from:"url"})},ce=()=>{u(!1),D(!1),r({meta:w,...U}),t()},Me=()=>{u(!1),D(!1)};q.useEffect(()=>{e&&K()},[e]);const me=q.useMemo(()=>({title:w.title,wt:fl(w),blockletMetaUrl:decodeURIComponent(c.trim())}),[w,c]),Oe=q.useCallback(async()=>{if(ue||W){Y("");return}const de=new URL(window.location.href);de.pathname=rn(window?.env?.apiPrefix??"/","/api/did/launch-free-blocklet-by-session/token"),de.searchParams.set("_ek_",C),Object.keys(me).forEach(Fe=>{de.searchParams.set(Fe,me[Fe])});const{data:ge}=await a.get(de.href);ge.url?Y(ge.url):Y("")},[ue,me,a,C,W]);q.useEffect(()=>{Oe()},[Oe]);const Pe=q.useMemo(()=>ue&&ne?{...me,nw:ne,skipMigrateAccount:!0}:me,[me,ne,ue]),nt=[{name:m("common.name"),value:Ft.getDisplayName({meta:w},!0)},{name:m("common.version"),value:w.version},{name:m("common.did"),value:w.did?l.jsx(rc,{did:w.did}):null},{name:m("common.author"),value:w.owner?l.jsx(vs,{owner:w.owner,locale:S}):du.formatPerson(w.author)},{name:m("blocklet.dist.downloadLink"),value:w.dist.tarball}],ut=()=>h?l.jsx("div",{style:{height:200,width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:l.jsx(Tt,{})}):w.did?l.jsx("div",{style:{paddingLeft:"10%"},children:nt.map(de=>de.name===m("common.did")?l.jsx(_i,{valueComponent:"div",nameWidth:120,name:de.name,nameFormatter:()=>m("common.did"),children:de.value},de.name):l.jsx(_i,{valueComponent:"div",nameWidth:120,name:de.name,children:de.value},de.name))}):null,ft=Xl(async()=>{let de=w.title;d.user&&(de=`${d.user.fullName}'s ${w.title}`);try{ce(),await o.launchBlockletWithoutWallet({input:{title:de,blockletMetaUrl:decodeURIComponent(c.trim()),type:"store",storeUrl:U.registryUrl,onlyRequired:!0}})}catch(ge){console.error("launchBlockletWithoutWallet error:",ge),Yn.error(Ur(ge),{autoHideDuration:3e3})}}),rt=[{label:m("blocklet.fromUrl.step0"),body:l.jsx(je,{component:"div",children:l.jsx(bs,{style:{marginBottom:32},value:c,helperText:m("blocklet.fromUrl.description"),onValueChange:de=>{j(null),N(de)},children:l.jsx(Hn,{label:m("blocklet.fromUrl.label"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"blocklet-url-input",fullWidth:!0,autoFocus:!0,margin:"dense",value:c,onChange:de=>{j(null),N(de.target.value)},disabled:h,onKeyPress:de=>{de.key==="Enter"&&(de.preventDefault(),K(),O(1))}})})}),cancel:m("common.cancel"),confirm:m("common.next"),onCancel:t,onConfirm:()=>{K(),O(1)}},{label:m("blocklet.fromUrl.step1"),body:ut(),cancel:m(J?"common.pre":"common.cancel"),confirm:n?.confirm||m("blocklet.fromUrl.confirm"),onCancel:()=>{J?O(de=>de-1):t()},onConfirm:()=>{Ee()}}],we=rt[$];return l.jsxs(l.Fragment,{children:[l.jsxs(oi,{title:n?.title||m("blocklet.fromUrl.title"),fullWidth:!0,maxWidth:"md",onClose:()=>we.onCancel(),showCloseButton:$===0,disableEscapeKeyDown:!0,open:!0,actions:l.jsxs(l.Fragment,{children:[we.cancel&&l.jsx(vt,{onClick:de=>{de.stopPropagation(),j(null),we.onCancel()},color:"inherit",children:we.cancel||m("common.cancel")}),l.jsxs(vt,{onClick:de=>{de.stopPropagation(),we.onConfirm()},color:"primary","data-cy":"install-blocklet-next-step",disabled:h||!c||f,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[h&&$===0&&l.jsx(Tt,{size:16}),we.confirm]})]}),children:[J&&l.jsx(xa,{alternativeLabel:!0,activeStep:$,children:rt.map(({label:de})=>l.jsx(wa,{children:l.jsx(Sa,{children:de})},de))}),l.jsx(Ea,{component:"div",style:{marginTop:24},children:we.body}),!!f&&l.jsx(Bo,{severity:"error",style:{width:"100%",marginTop:8},children:f})]}),w&&F&&l.jsx(Jo,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:!ue&&!W?"bind-wallet":"launch-free-blocklet-by-session",checkFn:a.get,checkTimeout:5*60*1e3,onSuccess:ce,extraParams:Pe,messages:{title:m("setup.keyPair.title"),scan:m("setup.keyPair.scan"),confirm:m("setup.keyPair.confirm"),success:m("setup.keyPair.success")},onClose:Me,customItems:W?[]:[l.jsx(xs,{onClick:ft})]})]})}ws.propTypes={defaultUrl:B.string,onCancel:B.func.isRequired,onSuccess:B.func.isRequired,onError:B.func,mode:B.oneOf(["install","component"]),handleText:B.object};const fu={meta:B.object.isRequired,onCancel:B.func.isRequired};function Ss({action:e,onSelect:t,onNext:r}){const{t:i}=xt(),s=[{action:"purchase",title:i("store.purchase.purchase.title"),description:i("store.purchase.purchase.description")},{action:"verify",title:i("store.purchase.verify.title"),description:i("store.purchase.verify.description")}];return l.jsxs(l.Fragment,{children:[l.jsx(ka,{children:s.map(n=>l.jsxs(Do,{button:!0,selected:e===n.action,onClick:()=>t(n.action),children:[l.jsx(Ta,{sx:{minWidth:48},children:n.action==="purchase"?l.jsx(ja,{style:{color:e==="purchase"?Oi.primary.main:"#AAA",fontSize:32}}):l.jsx(Oa,{style:{color:e==="verify"?Oi.primary.main:"#AAA",fontSize:32}})}),l.jsx(Mo,{primary:n.title,secondary:n.description})]},n.action))}),r&&l.jsx(vt,{fullWidth:!0,disabled:!e,variant:"contained",color:"primary",style:{marginTop:16},onClick:r,children:i("common.next")})]})}Ss.propTypes={action:B.oneOf(["both","purchase","verify"]).isRequired,onSelect:B.func.isRequired,onNext:B.func.isRequired};function Es({meta:e,onCancel:t,mode:r,handlePaySuccess:i=()=>{}}){const{t:s,locale:n}=xt(),{info:o}=dn(),a=pl(o),[d,h]=q.useState(null),u=new URL(e?.registryUrl).origin,f=Ft.getDisplayName({meta:e}),j=async(S,E)=>{const C=({downloadTokenList:$})=>{i({downloadTokenList:$})},c=$=>{Yn.error($),t($)};function N($){return gl(()=>Ni.get($).then(async({data:O})=>{const w=O?.downloadTokenList;if(O.status==="succeed"){if(w&&w.length)await C({downloadTokenList:w});else return await c(s("blocklet.component.missDownloadTokenTip")),!0;return!0}return O.status==="error"?(console.error("vc error: ",O),await c(O?.error),!0):!1}),{interval:1e3})}if(r==="purchase"&&d){const{statusUrl:$}=ml(d);await N($)}else await C({downloadTokenList:S.downloadTokenList&&E(S.downloadTokenList)})};if(q.useEffect(()=>{if(r==="purchase"){const S=new URL(u);S.pathname="/api/did/verify-purchase-blocklet/token",S.searchParams.set("serverDid",o.did),S.searchParams.set("blockletDid",e?.did);try{Ni.get(S.href).then(({data:E})=>{const C=`${E.url}`;h(C)})}catch(E){console.error("get next workflow url error: ",E)}}return()=>{h(null)}},[r]),r==="purchase"&&!d)return"";const m={verify:{action:"verify-purchase-blocklet",checkFn:Li.create({baseURL:u}).get,extraParams:{serverDid:o.did,blockletDid:e?.did},messages:{title:s("store.purchase.verify.auth.title",{name:f}),scan:s("store.purchase.verify.auth.scan"),confirm:s("store.purchase.verify.auth.confirm"),success:s("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:Li.create({baseURL:rn(u,"/store")}).get,extraParams:{factory:e.nftFactory,nw:d},messages:{title:s("store.purchase.auth.title",{name:f}),scan:s("store.purchase.auth.scan"),confirm:s("store.purchase.auth.confirm"),success:l.jsxs(l.Fragment,{children:[l.jsx("p",{children:s("store.purchase.auth.success")}),l.jsx("p",{children:s("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return l.jsx(Jo,{open:!0,locale:n,popup:!1,saveConnect:!1,className:"connect",baseUrl:u,onSuccess:j,cancelWhenScanned:t,onClose:t,checkTimeout:60*5e3,webWalletUrl:a,disableClose:!0,showDownload:!1,...m[r]})}Es.propTypes={...fu,handlePaySuccess:B.func,mode:B.oneOf(["verify","purchase"]).isRequired};function ks({ref:e=null,mode:t,...r}){const[i,s]=q.useState(t!=="both"?t:"verify"),[n,o]=q.useState(t!=="both"?2:1),a=h=>{h!==i&&s(h)},d=()=>{i&&n!==2&&o(2)};return q.useImperativeHandle(e,()=>({onNext:d,getCurrentStep:()=>n})),n===1?l.jsx("div",{style:{maxWidth:520},children:l.jsx(Ss,{action:i,onNext:null,onSelect:a})}):l.jsx(Es,{...r,mode:i})}ks.propTypes={mode:B.oneOf(["both","verify","purchase"]).isRequired,ref:B.any};function pu({...e}){return l.jsx(vt,{className:"bottom-button",variant:"contained",color:"primary",...e})}function Ts({blocklet:e=null,onStartNow:t=()=>{},children:r=null,disabled:i=!1}){const{t:s}=xt(),n=is();return!e||vl(e.meta)?l.jsx(mu,{children:r}):l.jsxs(gu,{isMobile:n,children:[l.jsx(pu,{className:"start-now",variant:"contained",color:"primary",disabled:i,onClick:()=>t(),children:s("setup.startNow")}),l.jsx(te,{sx:{display:"flex",alignItems:"center"},children:r})]})}Ts.propTypes={blocklet:B.object,onStartNow:B.func,children:B.any,disabled:B.bool};const mu=tt(te)`
221
221
  width: 100%;
222
222
  margin-top: auto;
223
223
  padding-top: 24px;
@@ -0,0 +1 @@
1
+ import{J as v,j as l}from"./vendor-mui-core-CnXrAOs3.js";import{j as B,r}from"./vendor-react-Dvs43sk9.js";import{C as W,D as L}from"./vendor-utils-cJEl_UEd.js";import{V as O,b as A}from"./vendor-ux-DtnxszG_.js";import{h as d,b as T,m as _}from"./vendor-hooks-CjESGRlR.js";import{A as $,S as F}from"./add-component-core-CidAYqFQ.js";import{l as K,I as z}from"./index-6LL6v88e.js";import"./lottie-web-4koyQiv_.js";import"./item-CQ92uUPm.js";import"./index-DBs9Ljax.js";import"./delete-confirm-ByWYWBpJ.js";import"./click-to-copy-C1mF6WNf.js";import"./confirm-CCyde9UR.js";import"./session-C2VeP2Dn.js";import"./get-safe-url-D_AWm5Av.js";import"./did-address-CZak4Nzl.js";import"./wait-connect-C4aP5_2A.js";import"./vendor-arcblock-DVRwGBYP.js";import"./launch-result-message-DWeUg9rM.js";import"./page-header-DCvzRay5.js";import"./engine-CLurioHW.js";import"./config-space-ElduyMIL.js";import"./spaces-C9G07rtA.js";import"./api-Btn0Tp3W.js";import"./required-BGaDOGrj.js";import"./index-D1kZimyP.js";import"./Google-BqikEiR8.js";import"./cloneDeep-C6qewg0C.js";import"./create-passport-svg-_Jak4aT3.js";import"./form-wrapper-C8oo_Fdy.js";import"./logo-uploader-DfUkJPxR.js";import"./collapse-BMy0GGFk.js";import"./index-De-Vgsb6.js";import"./config-cglRKVfL.js";import"./isURL-QYZ6DN-H.js";import"./section-C75bzkkL.js";import"./form-text-input-BAs2p7bF.js";import"./edit.svg-DycWG9v3.js";import"./index-BPy8_fa2.js";import"./index-B35nKjq_.js";import"./useLocalStorage-BIH12-5o.js";import"./index-B-Z_6Rom.js";import"./util-Bl3AzodV.js";import"./use-mobile-maRlSUwU.js";import"./content-layout-oyz1EqNZ.js";import"./connect-to-DFMCjDvl.js";import"./index-BBsl5ZA-.js";import"./index-DRYJ0xIl.js";import"./index-BojVbZw0.js";import"./index-KLDWx9Xh.js";import"./search-4YYphs0l.js";function Ft(){const{t:u}=O(),{blocklet:h}=K(),{componentDid:s}=B(),w=v(t=>t.breakpoints.down("md")),e=new URL(window.location.href),f=e.searchParams.get("mode")==="dialog",n=e.searchParams.get("resourceType")||"",m=e.searchParams.get("resourceDid")||s,g=e.searchParams.get("store")||"",C=e.searchParams.get("showFromUrl")!=="false",R=e.searchParams.get("showResourcesSwitch")!=="false",b=e.searchParams.get("enableRunBackground")!=="false",S=e.searchParams.get("showCategory")!=="false",a=h?.meta?.did,i=g.split(",").filter(Boolean).map(t=>{try{return new URL(t.startsWith("http")?t:`https://${t}`).origin}catch(o){return console.error(o),null}}).filter(Boolean),[y,E]=r.useState(i.map(t=>({url:t,name:t.replace("https://","")}))),[P,D]=r.useState(null),[U,j]=r.useState("");r.useEffect(()=>{(async()=>{try{const t=await Promise.all(i.map(async o=>{const x=W(o,"/api/store.json"),{data:M}=await L.get(x);return{url:o,name:M.name}}));E(t||[])}catch(t){console.error(t)}})()},[i.join(",")]);const k=()=>{window.parent.postMessage({event:"resourceDialog.close",componentDid:s},"*")};r.useEffect(()=>{const t=z();return a&&t.connect(),()=>{a&&t.isConnected()&&t.disconnect()}},[a]),d(()=>{window.parent.postMessage({event:"resourceDialog.loaded",componentDid:s},"*")});const c=T(t=>{t.data?.event==="resourceDialog.select"&&t.data?.componentDid===s&&(D(t.data.data),j(t.data.storeUrl))});d(()=>{window.addEventListener("message",c)}),_(()=>{window.removeEventListener("message",c)});const p=({inDialog:t=!0}={})=>l.jsx($,{stores:y,selectedMeta:P,storeUrl:U,resourceType:n,resourceDid:m,mode:"embed",inDialog:t,storageKey:F(`${n}+${m}`),showResourcesSwitch:R,showFromUrl:C,enableRunBackground:b,showCategory:S});return f?l.jsx(A,{className:"resource-dialog",title:u("blocklet.publish.addResource"),maxWidth:!1,fullWidth:!1,PaperProps:{style:w?{width:"100%",height:window.innerHeight}:{maxWidth:1350,minWidth:930,width:"80%"}},onClose:(t,o)=>{o!=="backdropClick"&&k()},showCloseButton:!0,disableEscapeKeyDown:!0,open:!0,children:p()}):p({inDialog:!1})}export{Ft as default};
@@ -1,4 +1,4 @@
1
- import{r as t,k as x}from"./vendor-react-Dvs43sk9.js";import{j as e,I as u,at as C,W as o}from"./vendor-mui-core-CnXrAOs3.js";import{p as M,Y as f,f as b}from"./vendor-ux-DtnxszG_.js";import{ak as H}from"./index-FASRIZyi.js";import{t as Z}from"./question-mark-circle.svg-B4stD6SS.js";const g=s=>t.createElement("svg",{width:21,height:20,viewBox:"0 0 21 20",xmlns:"http://www.w3.org/2000/svg",...s},t.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.60567 17.3203C7.38971 16.9661 7.19606 16.5686 7.02468 16.1402C6.86016 15.7289 6.7127 15.2804 6.58436 14.801C6.01415 15.0849 5.48171 15.439 4.99946 15.855C5.7556 16.5015 6.63848 17.004 7.60567 17.3203ZM8.26264 15.645C8.10246 15.2446 7.95842 14.7971 7.83425 14.3104C8.53612 14.104 9.26539 13.9991 9.9998 14H10.0015C10.7359 13.9991 11.4652 14.104 12.167 14.3104C12.0429 14.7971 11.8988 15.2446 11.7386 15.645C11.4556 16.3525 11.1353 16.8804 10.8137 17.2204C10.4935 17.559 10.2185 17.6667 10.0006 17.6667C9.78281 17.6667 9.50783 17.559 9.18757 17.2204C8.86599 16.8804 8.54566 16.3525 8.26264 15.645ZM10.0007 12.6667C10.8258 12.6657 11.6453 12.7785 12.4365 13.0005C12.5533 12.274 12.6295 11.49 12.6565 10.6666H7.34483C7.37175 11.49 7.448 12.274 7.56482 13.0006C8.35599 12.7785 9.17556 12.6657 10.0007 12.6667ZM7.34483 9.33331C7.37175 8.50999 7.448 7.72596 7.56482 6.99945C8.35598 7.22152 9.17556 7.33433 10.0007 7.33334C10.8258 7.33433 11.6453 7.22153 12.4365 6.99947C12.5533 7.72597 12.6295 8.51 12.6565 9.33331H7.34483ZM13.9905 10.6666C13.9603 11.6495 13.8639 12.5916 13.7104 13.4645C14.5207 13.8311 15.2715 14.3159 15.9385 14.9026C16.9065 13.7315 17.5347 12.2691 17.6722 10.6666H13.9905ZM17.6721 9.33331H13.9904C13.9603 8.35043 13.8639 7.40842 13.7104 6.5355C14.5207 6.16891 15.2715 5.68412 15.9385 5.09743C16.9065 6.26854 17.5347 7.73084 17.6721 9.33331ZM19.0006 10.0017C18.9997 14.9715 14.9706 19 10.0006 19H10.0006C5.03005 19 1.00061 14.9706 1.00061 10C1.00061 9.99999 1.00061 9.99999 1.00061 9.99998C1.00062 5.02943 5.03005 1 10.0006 1C14.9712 1 19.0006 5.02944 19.0006 10C19.0006 10.0006 19.0006 10.0011 19.0006 10.0017ZM2.32907 9.33331C2.46651 7.73082 3.09476 6.2685 4.0628 5.09738C4.72975 5.68407 5.48055 6.16888 6.29084 6.53548C6.13742 7.40841 6.041 8.35042 6.01083 9.33331H2.32907ZM2.32907 10.6666H6.01083C6.04099 11.6496 6.13742 12.5916 6.29084 13.4645C5.48055 13.8311 4.72975 14.3159 4.06281 14.9026C3.09475 13.7315 2.46649 12.2692 2.32907 10.6666ZM12.9766 16.1402C13.1411 15.7289 13.2886 15.2804 13.4169 14.8009C13.9871 15.0849 14.5196 15.4389 15.0018 15.8549C14.2457 16.5014 13.3628 17.004 12.3956 17.3202C12.6116 16.9661 12.8052 16.5686 12.9766 16.1402ZM12.3956 2.67976C13.3628 2.996 14.2457 3.49858 15.0018 4.14508C14.5196 4.56106 13.9871 4.91516 13.4169 5.19908C13.2886 4.71963 13.1411 4.2711 12.9766 3.85979C12.8052 3.43137 12.6116 3.03387 12.3956 2.67976ZM11.7386 4.355C11.8988 4.75545 12.0429 5.20292 12.167 5.68962C11.4652 5.89603 10.7359 6.00096 10.0015 6.00001H9.9998C9.26539 6.00096 8.53612 5.89602 7.83424 5.68961C7.95841 5.20291 8.10246 4.75544 8.26264 4.355C8.54566 3.64747 8.86599 3.11964 9.18757 2.7796C9.50783 2.44096 9.78281 2.33333 10.0006 2.33333C10.2185 2.33333 10.4935 2.44096 10.8137 2.7796C11.1353 3.11964 11.4556 3.64747 11.7386 4.355ZM7.02468 3.85979C6.86015 4.2711 6.71269 4.71961 6.58436 5.19906C6.01414 4.91513 5.4817 4.56103 4.99945 4.14504C5.7556 3.49854 6.63848 2.99596 7.60567 2.67973C7.38971 3.03385 7.19606 3.43136 7.02468 3.85979Z",fill:"currentColor"}));function k({SessionContext:s,extraItems:n=[],showLocale:r=!0,showHelper:l=!0,showSessionManager:c=!0,sessionManagerProps:i={}}){const{session:d}=t.useContext(s),{locale:p}=t.useContext(M),w=x(),h=()=>{if(w.pathname.indexOf("/store")>-1){window.open("https://www.arcblock.io/content/docs/createblocklet","_blank");return}window.open("https://www.arcblock.io/content/docs/blocklet-developer","_blank")};return e.jsxs(e.Fragment,{children:[n.map((a,m)=>t.cloneElement(a,{key:m})),r&&e.jsx(v,{"data-cy":"locale-addon",icon:g,size:23,showText:!1,className:"locale-addon"}),e.jsx(H,{}),l&&e.jsx(u,{onClick:h,children:e.jsx(Z,{})}),c&&e.jsx(j,{locale:p,session:d,size:24,showRole:!0,...i,showManageBlocklet:!1})]})}k.propTypes={SessionContext:o.object.isRequired,extraItems:o.array,showLocale:o.bool,showSessionManager:o.bool,showHelper:o.bool,sessionManagerProps:o.object};const j=C(b)`
1
+ import{r as t,k as x}from"./vendor-react-Dvs43sk9.js";import{j as e,I as u,at as C,W as o}from"./vendor-mui-core-CnXrAOs3.js";import{p as M,Y as f,f as b}from"./vendor-ux-DtnxszG_.js";import{al as H}from"./index-6LL6v88e.js";import{t as Z}from"./question-mark-circle.svg-B4stD6SS.js";const g=s=>t.createElement("svg",{width:21,height:20,viewBox:"0 0 21 20",xmlns:"http://www.w3.org/2000/svg",...s},t.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M7.60567 17.3203C7.38971 16.9661 7.19606 16.5686 7.02468 16.1402C6.86016 15.7289 6.7127 15.2804 6.58436 14.801C6.01415 15.0849 5.48171 15.439 4.99946 15.855C5.7556 16.5015 6.63848 17.004 7.60567 17.3203ZM8.26264 15.645C8.10246 15.2446 7.95842 14.7971 7.83425 14.3104C8.53612 14.104 9.26539 13.9991 9.9998 14H10.0015C10.7359 13.9991 11.4652 14.104 12.167 14.3104C12.0429 14.7971 11.8988 15.2446 11.7386 15.645C11.4556 16.3525 11.1353 16.8804 10.8137 17.2204C10.4935 17.559 10.2185 17.6667 10.0006 17.6667C9.78281 17.6667 9.50783 17.559 9.18757 17.2204C8.86599 16.8804 8.54566 16.3525 8.26264 15.645ZM10.0007 12.6667C10.8258 12.6657 11.6453 12.7785 12.4365 13.0005C12.5533 12.274 12.6295 11.49 12.6565 10.6666H7.34483C7.37175 11.49 7.448 12.274 7.56482 13.0006C8.35599 12.7785 9.17556 12.6657 10.0007 12.6667ZM7.34483 9.33331C7.37175 8.50999 7.448 7.72596 7.56482 6.99945C8.35598 7.22152 9.17556 7.33433 10.0007 7.33334C10.8258 7.33433 11.6453 7.22153 12.4365 6.99947C12.5533 7.72597 12.6295 8.51 12.6565 9.33331H7.34483ZM13.9905 10.6666C13.9603 11.6495 13.8639 12.5916 13.7104 13.4645C14.5207 13.8311 15.2715 14.3159 15.9385 14.9026C16.9065 13.7315 17.5347 12.2691 17.6722 10.6666H13.9905ZM17.6721 9.33331H13.9904C13.9603 8.35043 13.8639 7.40842 13.7104 6.5355C14.5207 6.16891 15.2715 5.68412 15.9385 5.09743C16.9065 6.26854 17.5347 7.73084 17.6721 9.33331ZM19.0006 10.0017C18.9997 14.9715 14.9706 19 10.0006 19H10.0006C5.03005 19 1.00061 14.9706 1.00061 10C1.00061 9.99999 1.00061 9.99999 1.00061 9.99998C1.00062 5.02943 5.03005 1 10.0006 1C14.9712 1 19.0006 5.02944 19.0006 10C19.0006 10.0006 19.0006 10.0011 19.0006 10.0017ZM2.32907 9.33331C2.46651 7.73082 3.09476 6.2685 4.0628 5.09738C4.72975 5.68407 5.48055 6.16888 6.29084 6.53548C6.13742 7.40841 6.041 8.35042 6.01083 9.33331H2.32907ZM2.32907 10.6666H6.01083C6.04099 11.6496 6.13742 12.5916 6.29084 13.4645C5.48055 13.8311 4.72975 14.3159 4.06281 14.9026C3.09475 13.7315 2.46649 12.2692 2.32907 10.6666ZM12.9766 16.1402C13.1411 15.7289 13.2886 15.2804 13.4169 14.8009C13.9871 15.0849 14.5196 15.4389 15.0018 15.8549C14.2457 16.5014 13.3628 17.004 12.3956 17.3202C12.6116 16.9661 12.8052 16.5686 12.9766 16.1402ZM12.3956 2.67976C13.3628 2.996 14.2457 3.49858 15.0018 4.14508C14.5196 4.56106 13.9871 4.91516 13.4169 5.19908C13.2886 4.71963 13.1411 4.2711 12.9766 3.85979C12.8052 3.43137 12.6116 3.03387 12.3956 2.67976ZM11.7386 4.355C11.8988 4.75545 12.0429 5.20292 12.167 5.68962C11.4652 5.89603 10.7359 6.00096 10.0015 6.00001H9.9998C9.26539 6.00096 8.53612 5.89602 7.83424 5.68961C7.95841 5.20291 8.10246 4.75544 8.26264 4.355C8.54566 3.64747 8.86599 3.11964 9.18757 2.7796C9.50783 2.44096 9.78281 2.33333 10.0006 2.33333C10.2185 2.33333 10.4935 2.44096 10.8137 2.7796C11.1353 3.11964 11.4556 3.64747 11.7386 4.355ZM7.02468 3.85979C6.86015 4.2711 6.71269 4.71961 6.58436 5.19906C6.01414 4.91513 5.4817 4.56103 4.99945 4.14504C5.7556 3.49854 6.63848 2.99596 7.60567 2.67973C7.38971 3.03385 7.19606 3.43136 7.02468 3.85979Z",fill:"currentColor"}));function k({SessionContext:s,extraItems:n=[],showLocale:r=!0,showHelper:l=!0,showSessionManager:c=!0,sessionManagerProps:i={}}){const{session:d}=t.useContext(s),{locale:p}=t.useContext(M),w=x(),h=()=>{if(w.pathname.indexOf("/store")>-1){window.open("https://www.arcblock.io/content/docs/createblocklet","_blank");return}window.open("https://www.arcblock.io/content/docs/blocklet-developer","_blank")};return e.jsxs(e.Fragment,{children:[n.map((a,m)=>t.cloneElement(a,{key:m})),r&&e.jsx(v,{"data-cy":"locale-addon",icon:g,size:23,showText:!1,className:"locale-addon"}),e.jsx(H,{}),l&&e.jsx(u,{onClick:h,children:e.jsx(Z,{})}),c&&e.jsx(j,{locale:p,session:d,size:24,showRole:!0,...i,showManageBlocklet:!1})]})}k.propTypes={SessionContext:o.object.isRequired,extraItems:o.array,showLocale:o.bool,showSessionManager:o.bool,showHelper:o.bool,sessionManagerProps:o.object};const j=C(b)`
2
2
  .user-addon {
3
3
  .user-avatar {
4
4
  width: 28px;
@@ -1,4 +1,4 @@
1
- import{r as z}from"./vendor-react-Dvs43sk9.js";import{j as k,a6 as ce,ak as T,Q as Me,cB as Pe,T as te,W as J,b6 as Ne,a5 as Fe,bD as ze,aX as Je,at as ke,U as Be,b1 as ie,z as Ue,A as Ve,cC as Se,bg as Y,a3 as V,cD as We,am as ge,bf as ye}from"./vendor-mui-core-CnXrAOs3.js";import{Z as re,ab as Ke,v as Re,e as He,W as Ge,ba as Ze,o as Ye,b5 as Qe,c as Xe,aT as be,B as Oe,$ as Ae,X as Z,bb as et}from"./index-FASRIZyi.js";import{w as ue,P as tt}from"./permission-YVbPVhS_.js";import{V as le,n as G,H as W,b as Ee,a5 as rt,a6 as st,O as nt,x as H,e as ve,p as at}from"./vendor-ux-DtnxszG_.js";import{l as Ce}from"./vendor-hooks-CjESGRlR.js";import{C as me}from"./confirm-G3RZHlkC.js";import{f as oe}from"./index-DBs9Ljax.js";import{u as it}from"./useSetState-DFuQZPPV.js";import{u as De}from"./session-Chl38-LD.js";import{S as U}from"./section-C75bzkkL.js";import{C as ot}from"./click-to-copy-C1mF6WNf.js";import{u as Ie}from"./team-Bje0MaMX.js";import{v as lt,U as ct}from"./vendor-utils-cJEl_UEd.js";import{v as ut}from"./index-B-Z_6Rom.js";import{W as ft}from"./did-address-CZak4Nzl.js";import{V as dt}from"./status-Cchdz2Py.js";import{F as _e}from"./form-text-input-BAs2p7bF.js";import"./vendor-arcblock-DVRwGBYP.js";import"./lottie-web-4koyQiv_.js";import"./required-BGaDOGrj.js";import"./isURL-2pkMgw7e.js";import"./use-app-logo-DhmCQsWv.js";import"./omit-hhiOJGRf.js";import"./form-wrapper-C8oo_Fdy.js";import"./edit.svg-DycWG9v3.js";const mt=localStorage.getItem("enableDebug")==="true";function ht({teamDid:$,size:q="small",...P}){const{t:C}=le(),{api:j}=re(),[w,p]=z.useState(!1),[o,g]=z.useState(null),m=()=>{p(!1),g(null)},f=async()=>{try{p(!0);const a=await j.clearCache({input:{teamDid:$}});W.success(C("blocklet.config.clearCache.success",{count:a.removed?.length||0}))}catch(a){W.error(oe(a))}finally{p(!1),g(null)}},e={title:C("blocklet.config.clearCache.title"),description:C("blocklet.config.clearCache.description"),confirm:C("common.confirm"),cancel:C("common.cancel"),onConfirm:f,onCancel:m};return k.jsxs("div",{...P,children:[k.jsxs(G,{onClick:()=>g(e),color:"error",variant:"outlined",size:q,children:[w?k.jsx(ce,{size:16,style:{marginRight:5}}):null,C("blocklet.config.clearCache.action")]}),o&&k.jsx(me,{title:o.title,description:o.description,confirm:o.confirm,cancel:o.cancel,onConfirm:o.onConfirm,onCancel:o.onCancel})]})}function Te({onChange:$=()=>{},disabled:q=!1,loading:P=!1,inService:C=!1}){const{t:j}=le(),{api:w,session:p}=De(),{blocklet:o}=Ke(),[g,m]=it({newAppSk:"",isConnectOpen:!1,confirmDialogOpen:!1}),f=()=>m({isConnectOpen:!1}),e=()=>{if(He.isInProgress(o.status)){W.error(j("blocklet.error.isInProgress"));return}m({confirmDialogOpen:!0})};return k.jsxs(k.Fragment,{children:[k.jsx(U,{title:j("blocklet.config.migrate.button"),desc:j("blocklet.config.migrate.description"),children:k.jsx(T,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:k.jsxs(Me,{style:{flexShrink:0},variant:"contained",color:"primary",size:"small","data-cy":"config-did",disabled:q||P,onClick:e,children:[k.jsx(Pe,{style:{fontSize:"1.3em",marginRight:4}}),j("blocklet.config.migrate.button")]})})}),k.jsxs(k.Fragment,{children:[g.isConnectOpen&&k.jsx(Re,{popup:!0,open:g.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:w.get,checkTimeout:5*60*1e3,onSuccess:()=>{$(),C&&p.logout(),f()},extraParams:{appDid:o.appDid},messages:{title:j("setup.keyPair.title"),scan:j("setup.keyPair.scan"),confirm:j("setup.keyPair.confirm"),success:j("setup.keyPair.success")},onClose:f}),g.confirmDialogOpen&&k.jsx(me,{title:k.jsx(te,{sx:{fontSize:"20px",fontWeight:"500"},children:j("blocklet.config.migrate.title")}),description:k.jsx(te,{sx:{fontSize:"14px",color:"#9397A1"},children:j("blocklet.config.migrate.confirm")}),confirm:j("common.confirm"),cancel:j("common.cancel"),onConfirm:()=>m({confirmDialogOpen:!1,isConnectOpen:!0}),onCancel:()=>m({confirmDialogOpen:!1})})]})]})}Te.propTypes={onChange:J.func,disabled:J.bool,loading:J.bool,inService:J.bool};function Le({onCancel:$,onSuccess:q,onError:P=()=>{}}){const{api:C}=z.useContext(Ge),[j,w]=z.useState(!1),{t:p,locale:o}=le(),[g,m]=z.useState(""),[f,e]=z.useState(!1),[a,n]=z.useState(0),[r,t]=z.useState(""),{endpoint:l}=Ie(),[s,i]=z.useState(!1),u=c=>{m(null),w(!0);try{t(c.result),n(_.length-1)}catch(h){const b=oe(h);m(b),P(h)}finally{w(!1)}},d=()=>{e(!0),n(1)},y=()=>{e(!1),n(0)},_=[{body:k.jsxs(T,{children:[k.jsx(te,{children:p("team.transferApp.transferDialog.tips.progress")}),k.jsx(te,{sx:{mt:3,mb:2},children:p("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:p("common.cancel"),confirm:p("team.transferApp.transferDialog.createTransferLink"),onCancel:$,onConfirm:d},{cancel:p("common.cancel"),confirm:p("team.transferApp.transferDialog.createTransferLink"),body:()=>k.jsx(Re,{action:"transfer-app-owner",open:f,locale:o,checkFn:C.get,onClose:y,onSuccess:u,checkTimeout:5*60*1e3,extraParams:{},messages:{title:p("team.transferApp.connectDialog.title"),scan:p("team.transferApp.connectDialog.scan"),confirm:p("team.transferApp.connectDialog.confirm"),success:p("team.transferApp.connectDialog.success")},popup:!0})},{body:()=>{const c=Ze({transferId:r.transferId,endpoint:l});return k.jsxs(k.Fragment,{children:[k.jsx(T,{component:Q,dangerouslySetInnerHTML:{__html:p("team.transferApp.transferDialog.createSuccessTip1")}}),k.jsx(T,{component:Q,sx:{mt:2},children:k.jsx(Q,{children:p("team.transferApp.transferDialog.createSuccessTip3")})}),k.jsxs(T,{children:[k.jsx(T,{component:Q,sx:{mt:2},children:k.jsx(Q,{children:p("team.transferApp.transferDialog.createSuccessTip2",{expireDate:Ye(r.expireDate,o)})})}),k.jsx(T,{sx:{my:1},children:k.jsx(ot,{children:c})})]}),k.jsx("div",{children:k.jsx(Ne,{value:"end",control:k.jsx(Fe,{checked:s,onChange:h=>i(h.target.checked)}),label:p("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:p("common.confirm"),onConfirm:q}],v=_[a];return k.jsxs(Ee,{title:k.jsx(Q,{className:"title",children:p("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:k.jsxs(k.Fragment,{children:[v.cancel&&k.jsx(G,{onClick:v.onCancel,color:"inherit",children:v.cancel}),k.jsxs(G,{onClick:v.onConfirm,color:"error",disabled:j||a===_.length-1&&!s,variant:"contained",autoFocus:!0,children:[j&&k.jsx(ce,{size:16}),v.confirm]})]}),children:[k.jsx(ze,{component:"div",children:typeof v.body=="function"?v.body():v.body}),!!g&&k.jsx(Je,{severity:"error",variant:"icon",children:g})]})}Le.propTypes={onCancel:J.func.isRequired,onSuccess:J.func.isRequired,onError:J.func};const Q=ke.div`
1
+ import{r as z}from"./vendor-react-Dvs43sk9.js";import{j as k,a6 as ce,ak as T,Q as Me,cB as Pe,T as te,W as J,b6 as Ne,a5 as Fe,bD as ze,aX as Je,at as ke,U as Be,b1 as ie,z as Ue,A as Ve,cC as Se,bg as Y,a3 as V,cD as We,am as ge,bf as ye}from"./vendor-mui-core-CnXrAOs3.js";import{_ as re,ac as Ke,v as Re,e as He,X as Ge,bb as Ze,o as Ye,b6 as Qe,c as Xe,aU as be,B as Oe,a0 as Ae,Y as Z,bc as et}from"./index-6LL6v88e.js";import{w as ue,P as tt}from"./permission-u25LanDC.js";import{V as le,n as G,H as W,b as Ee,a5 as rt,a6 as st,O as nt,x as H,e as ve,p as at}from"./vendor-ux-DtnxszG_.js";import{l as Ce}from"./vendor-hooks-CjESGRlR.js";import{C as me}from"./confirm-CCyde9UR.js";import{f as oe}from"./index-DBs9Ljax.js";import{u as it}from"./useSetState-DFuQZPPV.js";import{u as De}from"./session-C2VeP2Dn.js";import{S as U}from"./section-C75bzkkL.js";import{C as ot}from"./click-to-copy-C1mF6WNf.js";import{u as Ie}from"./team-DPdkokhk.js";import{v as lt,U as ct}from"./vendor-utils-cJEl_UEd.js";import{v as ut}from"./index-B-Z_6Rom.js";import{W as ft}from"./did-address-CZak4Nzl.js";import{V as dt}from"./status-DdtUhbdl.js";import{F as _e}from"./form-text-input-BAs2p7bF.js";import"./vendor-arcblock-DVRwGBYP.js";import"./lottie-web-4koyQiv_.js";import"./required-BGaDOGrj.js";import"./isURL-QYZ6DN-H.js";import"./use-app-logo-CmClyT44.js";import"./omit-hhiOJGRf.js";import"./form-wrapper-C8oo_Fdy.js";import"./edit.svg-DycWG9v3.js";const mt=localStorage.getItem("enableDebug")==="true";function ht({teamDid:$,size:q="small",...P}){const{t:C}=le(),{api:j}=re(),[w,p]=z.useState(!1),[o,g]=z.useState(null),m=()=>{p(!1),g(null)},f=async()=>{try{p(!0);const a=await j.clearCache({input:{teamDid:$}});W.success(C("blocklet.config.clearCache.success",{count:a.removed?.length||0}))}catch(a){W.error(oe(a))}finally{p(!1),g(null)}},e={title:C("blocklet.config.clearCache.title"),description:C("blocklet.config.clearCache.description"),confirm:C("common.confirm"),cancel:C("common.cancel"),onConfirm:f,onCancel:m};return k.jsxs("div",{...P,children:[k.jsxs(G,{onClick:()=>g(e),color:"error",variant:"outlined",size:q,children:[w?k.jsx(ce,{size:16,style:{marginRight:5}}):null,C("blocklet.config.clearCache.action")]}),o&&k.jsx(me,{title:o.title,description:o.description,confirm:o.confirm,cancel:o.cancel,onConfirm:o.onConfirm,onCancel:o.onCancel})]})}function Te({onChange:$=()=>{},disabled:q=!1,loading:P=!1,inService:C=!1}){const{t:j}=le(),{api:w,session:p}=De(),{blocklet:o}=Ke(),[g,m]=it({newAppSk:"",isConnectOpen:!1,confirmDialogOpen:!1}),f=()=>m({isConnectOpen:!1}),e=()=>{if(He.isInProgress(o.status)){W.error(j("blocklet.error.isInProgress"));return}m({confirmDialogOpen:!0})};return k.jsxs(k.Fragment,{children:[k.jsx(U,{title:j("blocklet.config.migrate.button"),desc:j("blocklet.config.migrate.description"),children:k.jsx(T,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:k.jsxs(Me,{style:{flexShrink:0},variant:"contained",color:"primary",size:"small","data-cy":"config-did",disabled:q||P,onClick:e,children:[k.jsx(Pe,{style:{fontSize:"1.3em",marginRight:4}}),j("blocklet.config.migrate.button")]})})}),k.jsxs(k.Fragment,{children:[g.isConnectOpen&&k.jsx(Re,{popup:!0,open:g.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:w.get,checkTimeout:5*60*1e3,onSuccess:()=>{$(),C&&p.logout(),f()},extraParams:{appDid:o.appDid},messages:{title:j("setup.keyPair.title"),scan:j("setup.keyPair.scan"),confirm:j("setup.keyPair.confirm"),success:j("setup.keyPair.success")},onClose:f}),g.confirmDialogOpen&&k.jsx(me,{title:k.jsx(te,{sx:{fontSize:"20px",fontWeight:"500"},children:j("blocklet.config.migrate.title")}),description:k.jsx(te,{sx:{fontSize:"14px",color:"#9397A1"},children:j("blocklet.config.migrate.confirm")}),confirm:j("common.confirm"),cancel:j("common.cancel"),onConfirm:()=>m({confirmDialogOpen:!1,isConnectOpen:!0}),onCancel:()=>m({confirmDialogOpen:!1})})]})]})}Te.propTypes={onChange:J.func,disabled:J.bool,loading:J.bool,inService:J.bool};function Le({onCancel:$,onSuccess:q,onError:P=()=>{}}){const{api:C}=z.useContext(Ge),[j,w]=z.useState(!1),{t:p,locale:o}=le(),[g,m]=z.useState(""),[f,e]=z.useState(!1),[a,n]=z.useState(0),[r,t]=z.useState(""),{endpoint:l}=Ie(),[s,i]=z.useState(!1),u=c=>{m(null),w(!0);try{t(c.result),n(_.length-1)}catch(h){const b=oe(h);m(b),P(h)}finally{w(!1)}},d=()=>{e(!0),n(1)},y=()=>{e(!1),n(0)},_=[{body:k.jsxs(T,{children:[k.jsx(te,{children:p("team.transferApp.transferDialog.tips.progress")}),k.jsx(te,{sx:{mt:3,mb:2},children:p("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:p("common.cancel"),confirm:p("team.transferApp.transferDialog.createTransferLink"),onCancel:$,onConfirm:d},{cancel:p("common.cancel"),confirm:p("team.transferApp.transferDialog.createTransferLink"),body:()=>k.jsx(Re,{action:"transfer-app-owner",open:f,locale:o,checkFn:C.get,onClose:y,onSuccess:u,checkTimeout:5*60*1e3,extraParams:{},messages:{title:p("team.transferApp.connectDialog.title"),scan:p("team.transferApp.connectDialog.scan"),confirm:p("team.transferApp.connectDialog.confirm"),success:p("team.transferApp.connectDialog.success")},popup:!0})},{body:()=>{const c=Ze({transferId:r.transferId,endpoint:l});return k.jsxs(k.Fragment,{children:[k.jsx(T,{component:Q,dangerouslySetInnerHTML:{__html:p("team.transferApp.transferDialog.createSuccessTip1")}}),k.jsx(T,{component:Q,sx:{mt:2},children:k.jsx(Q,{children:p("team.transferApp.transferDialog.createSuccessTip3")})}),k.jsxs(T,{children:[k.jsx(T,{component:Q,sx:{mt:2},children:k.jsx(Q,{children:p("team.transferApp.transferDialog.createSuccessTip2",{expireDate:Ye(r.expireDate,o)})})}),k.jsx(T,{sx:{my:1},children:k.jsx(ot,{children:c})})]}),k.jsx("div",{children:k.jsx(Ne,{value:"end",control:k.jsx(Fe,{checked:s,onChange:h=>i(h.target.checked)}),label:p("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:p("common.confirm"),onConfirm:q}],v=_[a];return k.jsxs(Ee,{title:k.jsx(Q,{className:"title",children:p("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:k.jsxs(k.Fragment,{children:[v.cancel&&k.jsx(G,{onClick:v.onCancel,color:"inherit",children:v.cancel}),k.jsxs(G,{onClick:v.onConfirm,color:"error",disabled:j||a===_.length-1&&!s,variant:"contained",autoFocus:!0,children:[j&&k.jsx(ce,{size:16}),v.confirm]})]}),children:[k.jsx(ze,{component:"div",children:typeof v.body=="function"?v.body():v.body}),!!g&&k.jsx(Je,{severity:"error",variant:"icon",children:g})]})}Le.propTypes={onCancel:J.func.isRequired,onSuccess:J.func.isRequired,onError:J.func};const Q=ke.div`
2
2
  font-size: 16px;
3
3
  font-weight: bold;
4
4
  &.title {
@@ -1,4 +1,4 @@
1
- import{j as t,ak as d,Q as p,at as x,W as u}from"./vendor-mui-core-CnXrAOs3.js";import{r as o}from"./vendor-react-Dvs43sk9.js";import{p as g}from"./vendor-ux-DtnxszG_.js";import{a as h}from"./page-header-DCvzRay5.js";import{ab as b}from"./index-FASRIZyi.js";import{A as j}from"./config-Cbg3z3uP.js";import{S as k}from"./step-actions-CcUwY5bt.js";import{S}from"./layout-1o45g_uH.js";import"./vendor-utils-cJEl_UEd.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DVRwGBYP.js";import"./isURL-2pkMgw7e.js";import"./section-C75bzkkL.js";import"./required-BGaDOGrj.js";import"./form-wrapper-C8oo_Fdy.js";import"./form-text-input-BAs2p7bF.js";import"./edit.svg-DycWG9v3.js";import"./wait-connect-DDuMthnp.js";import"./get-safe-url-BFcRpP-P.js";import"./index-BPy8_fa2.js";import"./index-DBs9Ljax.js";import"./index-SEBP2NIP.js";import"./use-mobile-DCNBsOlH.js";import"./content-layout-oyz1EqNZ.js";function y({onNext:s=()=>{},onPrevious:l=()=>{}}){const{t:r}=o.useContext(g),{blocklet:e}=b(),i=o.useMemo(()=>e?.meta?.requirements,[e]),n=o.useRef(null),[a,m]=o.useState(!1),f=async()=>{try{m(!0),(await n.current.onSubmit()||!i?.aigne)&&s()}catch(c){console.error("error",c)}finally{m(!1)}};return t.jsxs(C,{children:[t.jsx("div",{className:"header",children:t.jsx(h,{title:r("setting.aigne.config"),onClickBack:l})}),t.jsx(d,{className:"form-container",children:t.jsx(j,{orientation:"vertical",hideSubmitButton:!0,hideDivider:!0,ref:n,source:"setup",forceValidate:i?.aigne})}),t.jsxs(k,{blocklet:e,children:[!i?.aigne&&t.jsx(p,{className:"bottom-button-skip",sx:{mr:1},onClick:()=>s(),children:r("setup.skip")}),t.jsx(p,{className:"start-now bottom-button",loading:a,variant:"contained",disabled:a,onClick:f,children:r("setup.continue")})]})]})}y.propTypes={onNext:u.func,onPrevious:u.func};const C=x(S)`
1
+ import{j as t,ak as d,Q as p,at as x,W as u}from"./vendor-mui-core-CnXrAOs3.js";import{r as o}from"./vendor-react-Dvs43sk9.js";import{p as g}from"./vendor-ux-DtnxszG_.js";import{a as h}from"./page-header-DCvzRay5.js";import{ac as j}from"./index-6LL6v88e.js";import{A as b}from"./config-cglRKVfL.js";import{S as k}from"./step-actions-DJsm5fTL.js";import{S}from"./layout-Bhte8u_h.js";import"./vendor-utils-cJEl_UEd.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DVRwGBYP.js";import"./isURL-QYZ6DN-H.js";import"./section-C75bzkkL.js";import"./required-BGaDOGrj.js";import"./form-wrapper-C8oo_Fdy.js";import"./form-text-input-BAs2p7bF.js";import"./edit.svg-DycWG9v3.js";import"./wait-connect-C4aP5_2A.js";import"./get-safe-url-D_AWm5Av.js";import"./index-BPy8_fa2.js";import"./index-DBs9Ljax.js";import"./index-B35nKjq_.js";import"./use-mobile-DCNBsOlH.js";import"./content-layout-oyz1EqNZ.js";function y({onNext:s=()=>{},onPrevious:l=()=>{}}){const{t:r}=o.useContext(g),{blocklet:e}=j(),i=o.useMemo(()=>e?.meta?.requirements,[e]),n=o.useRef(null),[a,m]=o.useState(!1),f=async()=>{try{m(!0),(await n.current.onSubmit()||!i?.aigne)&&s()}catch(c){console.error("error",c)}finally{m(!1)}};return t.jsxs(C,{children:[t.jsx("div",{className:"header",children:t.jsx(h,{title:r("setting.aigne.config"),onClickBack:l})}),t.jsx(d,{className:"form-container",children:t.jsx(b,{orientation:"vertical",hideSubmitButton:!0,hideDivider:!0,ref:n,source:"setup",forceValidate:i?.aigne})}),t.jsxs(k,{blocklet:e,children:[!i?.aigne&&t.jsx(p,{className:"bottom-button-skip",sx:{mr:1},onClick:()=>s(),children:r("setup.skip")}),t.jsx(p,{className:"start-now bottom-button",loading:a,variant:"contained",disabled:a,onClick:f,children:r("setup.continue")})]})]})}y.propTypes={onNext:u.func,onPrevious:u.func};const C=x(S)`
2
2
  height: 100%;
3
3
  overflow-y: auto;
4
4
 
@@ -1 +1 @@
1
- import{C as E,A as k}from"./vendor-utils-cJEl_UEd.js";import{Z as T,ab as j,c as M}from"./index-FASRIZyi.js";import{r as e}from"./vendor-react-Dvs43sk9.js";import{V as B}from"./vendor-ux-DtnxszG_.js";import{u as D}from"./use-mobile-maRlSUwU.js";import{D as H,j as o,ak as w,a6 as I}from"./vendor-mui-core-CnXrAOs3.js";import"./vendor-arcblock-DVRwGBYP.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";function K(){const{info:x,inService:g}=T(),{blocklet:y}=j(),{locale:u}=B(),f=e.useRef(null),r=H(),[L,R]=e.useState(0),m=D(),[t,S]=e.useState(!0),s=e.useRef(null);let a="";g?a=M.WELLKNOWN_SERVICE_PATH_PREFIX:a=x.routing.adminPath;const c=new URLSearchParams;g?c.set("appUrl",window.location.origin):c.set("authKey","__sst"),c.set("schemaKey",E(window.location.origin,a,`/api/theme?id=${encodeURIComponent(y.meta.did)}`));const l=e.useCallback(()=>{if(s.current){const n=k(JSON.parse(JSON.stringify(r)),["palette","typography","shape","direction","breakpoints","mixins","shadows","transitions","zIndex"]);s.current.contentWindow.postMessage({type:"SEND_THEME",payload:n},window.location.origin)}},[r]),d=e.useCallback(()=>{s.current&&s.current.contentWindow.postMessage({type:"SEND_LOCALE",payload:u},window.location.origin)},[u]);return e.useEffect(()=>{const n=i=>{i.origin===window.location.origin&&(i.data.type==="REQUEST_THEME"&&l(),i.data.type==="THEME_BUILDER_LOADED"&&(d(),S(!1)))};return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}},[l,d]),e.useEffect(()=>{t===!1&&l()},[r,t,l]),e.useEffect(()=>{t===!1&&d()},[u,t,d]),e.useEffect(()=>{const n=document.querySelector("#arc__dashboard-main"),i=document.querySelector(".dashboard-content"),p=()=>{if(f.current){const{height:b}=n.getBoundingClientRect(),{top:C}=i.getBoundingClientRect(),{top:_}=f.current.getBoundingClientRect();let h=b-_+C-(m?108:164);m&&(h=Math.min(h,600)),R(h)}};return p(),window.addEventListener("resize",p),()=>{window.removeEventListener("resize",p)}},[m,r]),o.jsxs(o.Fragment,{children:[o.jsx(w,{ref:f}),t&&o.jsx(w,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px"},children:o.jsx(I,{})}),o.jsx("iframe",{title:"Theme Builder",ref:s,src:`${E(window.location.origin,a,"/hosted/theme-builder/")}?${c.toString()}`,style:{border:0,width:"100%",height:`${L}px`,display:t?"none":"block"}})]})}export{K as default};
1
+ import{C as E,A as k}from"./vendor-utils-cJEl_UEd.js";import{_ as T,ac as j,c as M}from"./index-6LL6v88e.js";import{r as e}from"./vendor-react-Dvs43sk9.js";import{V as B}from"./vendor-ux-DtnxszG_.js";import{u as D}from"./use-mobile-maRlSUwU.js";import{D as H,j as o,ak as w,a6 as I}from"./vendor-mui-core-CnXrAOs3.js";import"./vendor-arcblock-DVRwGBYP.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";function K(){const{info:x,inService:g}=T(),{blocklet:y}=j(),{locale:u}=B(),f=e.useRef(null),r=H(),[L,R]=e.useState(0),m=D(),[t,S]=e.useState(!0),s=e.useRef(null);let a="";g?a=M.WELLKNOWN_SERVICE_PATH_PREFIX:a=x.routing.adminPath;const c=new URLSearchParams;g?c.set("appUrl",window.location.origin):c.set("authKey","__sst"),c.set("schemaKey",E(window.location.origin,a,`/api/theme?id=${encodeURIComponent(y.meta.did)}`));const l=e.useCallback(()=>{if(s.current){const n=k(JSON.parse(JSON.stringify(r)),["palette","typography","shape","direction","breakpoints","mixins","shadows","transitions","zIndex"]);s.current.contentWindow.postMessage({type:"SEND_THEME",payload:n},window.location.origin)}},[r]),d=e.useCallback(()=>{s.current&&s.current.contentWindow.postMessage({type:"SEND_LOCALE",payload:u},window.location.origin)},[u]);return e.useEffect(()=>{const n=i=>{i.origin===window.location.origin&&(i.data.type==="REQUEST_THEME"&&l(),i.data.type==="THEME_BUILDER_LOADED"&&(d(),S(!1)))};return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}},[l,d]),e.useEffect(()=>{t===!1&&l()},[r,t,l]),e.useEffect(()=>{t===!1&&d()},[u,t,d]),e.useEffect(()=>{const n=document.querySelector("#arc__dashboard-main"),i=document.querySelector(".dashboard-content"),p=()=>{if(f.current){const{height:C}=n.getBoundingClientRect(),{top:_}=i.getBoundingClientRect(),{top:b}=f.current.getBoundingClientRect();let h=C-b+_-(m?108:164);m&&(h=Math.min(h,600)),R(h)}};return p(),window.addEventListener("resize",p),()=>{window.removeEventListener("resize",p)}},[m,r]),o.jsxs(o.Fragment,{children:[o.jsx(w,{ref:f}),t&&o.jsx(w,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px"},children:o.jsx(I,{})}),o.jsx("iframe",{title:"Theme Builder",ref:s,src:`${E(window.location.origin,a,"/hosted/theme-builder/")}?${c.toString()}`,style:{border:0,width:"100%",height:`${L}px`,display:t?"none":"block"}})]})}export{K as default};
@@ -1 +1 @@
1
- import{cv as o,cw as l,cx as r,cy as n}from"./index-FASRIZyi.js";import{r as e}from"./vendor-react-Dvs43sk9.js";const i=Object.freeze(Object.defineProperty({__proto__:null,default:o},Symbol.toStringTag,{value:"Module"})),u=Object.freeze(Object.defineProperty({__proto__:null,default:l},Symbol.toStringTag,{value:"Module"})),d=Object.freeze(Object.defineProperty({__proto__:null,default:r},Symbol.toStringTag,{value:"Module"})),s=Object.freeze(Object.defineProperty({__proto__:null,default:n},Symbol.toStringTag,{value:"Module"})),f=t=>e.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.0608 6.75011L11.5304 7.28044L8.70722 10.1036C8.31669 10.4942 7.68353 10.4942 7.293 10.1036L4.46978 7.28044L3.93945 6.75011L5.00011 5.68945L5.53044 6.21978L8.00011 8.68945L10.4698 6.21978L11.0001 5.68945L12.0608 6.75011Z",fill:"currentColor"}));export{d as E,u as L,i as P,s as T,f as l};
1
+ import{cw as o,cx as l,cy as r,cz as n}from"./index-6LL6v88e.js";import{r as e}from"./vendor-react-Dvs43sk9.js";const i=Object.freeze(Object.defineProperty({__proto__:null,default:o},Symbol.toStringTag,{value:"Module"})),u=Object.freeze(Object.defineProperty({__proto__:null,default:l},Symbol.toStringTag,{value:"Module"})),d=Object.freeze(Object.defineProperty({__proto__:null,default:r},Symbol.toStringTag,{value:"Module"})),s=Object.freeze(Object.defineProperty({__proto__:null,default:n},Symbol.toStringTag,{value:"Module"})),f=t=>e.createElement("svg",{width:16,height:16,viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",...t},e.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.0608 6.75011L11.5304 7.28044L8.70722 10.1036C8.31669 10.4942 7.68353 10.4942 7.293 10.1036L4.46978 7.28044L3.93945 6.75011L5.00011 5.68945L5.53044 6.21978L8.00011 8.68945L10.4698 6.21978L11.0001 5.68945L12.0608 6.75011Z",fill:"currentColor"}));export{d as E,u as L,i as P,s as T,f as l};
@@ -1,4 +1,4 @@
1
- import{H as U,V as A,z as H,S as F,P as Z,j as G,Q as K}from"./vendor-ux-DtnxszG_.js";import{Z as W,c as _}from"./index-FASRIZyi.js";import{j as e,D as I,ak as g,b4 as Q,T as $,am as B,bf as X,I as D,b$ as J,c0 as q,J as Y,a6 as ee,y as te,x as ne,bc as oe,M as se,c1 as re,at as ae}from"./vendor-mui-core-CnXrAOs3.js";import{r as i,L as ie}from"./vendor-react-Dvs43sk9.js";import{p as le}from"./util-LPNcvj77.js";import{u as ce}from"./useLocalStorage-BIH12-5o.js";import{M as T}from"./index-De-Vgsb6.js";import{d as de,e as M}from"./vendor-utils-cJEl_UEd.js";import{S as V}from"./shorten-label-RqvHqcC3.js";import{r as O}from"./index-D5TNmV3K.js";import{u as ue}from"./team-Bje0MaMX.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DVRwGBYP.js";import"./base32-ka8Vb9QP.js";import"./session-Chl38-LD.js";import"./isURL-2pkMgw7e.js";import"./use-app-logo-DhmCQsWv.js";const N=i.createContext({}),{Provider:pe,Consumer:Be}=N;function fe(){return localStorage.getItem("audit-log-page-size")&&Number(localStorage.getItem("audit-log-page-size"))||10}function me({children:t,scope:c="",categories:o=[],showScope:l,scopeFormatter:p,blocklets:x}){const{api:h,info:v}=W(),[C,f]=i.useState([]),[m,y]=i.useState({total:0,pageSize:fe(),pageCount:0,page:1}),[L,s]=i.useState(!1),[w,a]=i.useState(""),[d,n]=ce(`audit-log-category-${c}`,"all"),j=[{value:"all",label:"All",description:""},{value:"blocklet",label:"Blocklet Management",description:""},{value:"server",label:"Server Management",description:""},{value:"team",label:"Team Management",description:""},{value:"security",label:"Security",description:""},{value:"certificates",label:"Certificate Management",description:""},{value:"integrations",label:"Integration Management",description:""},{value:"gateway",label:"Gateway",description:""}].filter(P=>o.length?P.value==="all"||o.includes(P.value):!0),b=async({page:P=1,pageSize:r=20,silent:z=!0}={})=>{if(!L){z||s(!0);try{const S=await h.getAuditLogs({input:{paging:{page:P,pageSize:r},category:d==="all"?"":d,scope:c,actionOrContent:w}});l&&(S.list||[]).forEach(E=>{E.scope!==v.did&&(E.link=`/blocklets/${E.scope}/components`)}),f(S.list),y(S.paging),s(!1)}catch(S){U.error(S.message),s(!1)}}};i.useEffect(()=>{localStorage.setItem("audit-log-page-size",m.pageSize)},[m.pageSize]),i.useEffect(()=>{b({page:1,pageSize:m.pageSize,silent:!1})},[]),i.useEffect(()=>{b({page:1,pageSize:m.pageSize,silent:!1})},[d,w]);const k={loading:L,fetch:b,filter:{category:d,scope:c},categories:j,blocklets:x,setCategory:n,data:C,paging:m,setPaging:y,showScope:l,scopeFormatter:p,actionOrContent:w,setActionOrContent:a};return e.jsx(pe,{value:{auditLogs:k},children:t})}function R(){const{auditLogs:t}=i.useContext(N);return t}function ge(t){if(!t)return[];const c=/\[([^\]]+)\]\(([^)]+)\)/g,o=[];let l;for(;(l=c.exec(t))!==null;)o.push({text:l[1],url:l[2]});return o}const xe=`
1
+ import{H as U,V as _,z as H,S as F,P as Z,j as G,Q as K}from"./vendor-ux-DtnxszG_.js";import{_ as W,c as A}from"./index-6LL6v88e.js";import{j as e,D as I,ak as g,b4 as Q,T as $,am as B,bf as X,I as D,b$ as J,c0 as q,J as Y,a6 as ee,y as te,x as ne,bc as oe,M as se,c1 as re,at as ae}from"./vendor-mui-core-CnXrAOs3.js";import{r as i,L as ie}from"./vendor-react-Dvs43sk9.js";import{p as le}from"./util-DiGoXrLh.js";import{u as ce}from"./useLocalStorage-BIH12-5o.js";import{M as T}from"./index-De-Vgsb6.js";import{d as de,e as M}from"./vendor-utils-cJEl_UEd.js";import{S as V}from"./shorten-label-RqvHqcC3.js";import{r as O}from"./index-D5TNmV3K.js";import{u as ue}from"./team-DPdkokhk.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DVRwGBYP.js";import"./base32-ka8Vb9QP.js";import"./session-C2VeP2Dn.js";import"./isURL-QYZ6DN-H.js";import"./use-app-logo-CmClyT44.js";const N=i.createContext({}),{Provider:pe,Consumer:Be}=N;function fe(){return localStorage.getItem("audit-log-page-size")&&Number(localStorage.getItem("audit-log-page-size"))||10}function me({children:t,scope:c="",categories:o=[],showScope:l,scopeFormatter:p,blocklets:x}){const{api:h,info:v}=W(),[C,f]=i.useState([]),[m,y]=i.useState({total:0,pageSize:fe(),pageCount:0,page:1}),[L,s]=i.useState(!1),[w,a]=i.useState(""),[d,n]=ce(`audit-log-category-${c}`,"all"),j=[{value:"all",label:"All",description:""},{value:"blocklet",label:"Blocklet Management",description:""},{value:"server",label:"Server Management",description:""},{value:"team",label:"Team Management",description:""},{value:"security",label:"Security",description:""},{value:"certificates",label:"Certificate Management",description:""},{value:"integrations",label:"Integration Management",description:""},{value:"gateway",label:"Gateway",description:""}].filter(P=>o.length?P.value==="all"||o.includes(P.value):!0),b=async({page:P=1,pageSize:r=20,silent:z=!0}={})=>{if(!L){z||s(!0);try{const S=await h.getAuditLogs({input:{paging:{page:P,pageSize:r},category:d==="all"?"":d,scope:c,actionOrContent:w}});l&&(S.list||[]).forEach(E=>{E.scope!==v.did&&(E.link=`/blocklets/${E.scope}/components`)}),f(S.list),y(S.paging),s(!1)}catch(S){U.error(S.message),s(!1)}}};i.useEffect(()=>{localStorage.setItem("audit-log-page-size",m.pageSize)},[m.pageSize]),i.useEffect(()=>{b({page:1,pageSize:m.pageSize,silent:!1})},[]),i.useEffect(()=>{b({page:1,pageSize:m.pageSize,silent:!1})},[d,w]);const k={loading:L,fetch:b,filter:{category:d,scope:c},categories:j,blocklets:x,setCategory:n,data:C,paging:m,setPaging:y,showScope:l,scopeFormatter:p,actionOrContent:w,setActionOrContent:a};return e.jsx(pe,{value:{auditLogs:k},children:t})}function R(){const{auditLogs:t}=i.useContext(N);return t}function ge(t){if(!t)return[];const c=/\[([^\]]+)\]\(([^)]+)\)/g,o=[];let l;for(;(l=c.exec(t))!==null;)o.push({text:l[1],url:l[2]});return o}const xe=`
2
2
  <svg style="width:38px;height:38px;" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
3
3
  <path fill-rule="evenodd" clip-rule="evenodd" d="M50.152 10.6417L31.72 0L13.288 10.6417V24.7942L1 31.8887V53.1722L19.432 63.8139L31.6902 56.7366L31.72 56.7538L31.7498 56.7366L44.008 63.8139L62.44 53.1722V31.8887L50.152 24.7942V10.6417ZM60.52 32.9972L48.232 25.9027V11.7502L31.72 2.21703L15.208 11.7502V25.9028L2.92 32.9972V52.0636L19.432 61.5968L31.6902 54.5196L31.72 54.5368L31.7498 54.5196L44.008 61.5968L60.52 52.0636V32.9972Z" fill="url(#paint0_linear_606_96)"/>
4
4
  <path fill-rule="evenodd" clip-rule="evenodd" d="M50.1521 24.8307L31.7201 14.189L13.2881 24.8307V46.1141L31.7201 56.7558L50.1521 46.1141V24.8307ZM15.2081 25.9392L31.7201 16.406L48.2321 25.9392V45.0056L31.7201 54.5388L15.2081 45.0056V25.9392ZM28.5464 23.0464C28.6641 22.6342 29.0408 22.3501 29.4695 22.3501H33.9707C34.3993 22.3501 34.776 22.6342 34.8938 23.0464L35.7504 26.0447L37.8696 27.2681L40.8945 26.5109C41.3103 26.4068 41.7447 26.591 41.959 26.9622L44.2096 30.8604C44.424 31.2316 44.3662 31.6998 44.0682 32.0079L41.8999 34.2489V36.6959L44.0682 38.9369C44.3662 39.245 44.424 39.7133 44.2096 40.0845L41.959 43.9827C41.7447 44.3539 41.3103 44.538 40.8945 44.4339L37.8696 43.6767L35.7504 44.9002L34.8938 47.8984C34.776 48.3106 34.3993 48.5947 33.9707 48.5947H29.4695C29.0408 48.5947 28.6641 48.3106 28.5464 47.8984L27.6897 44.9002L25.5706 43.6767L22.5457 44.4339C22.1299 44.538 21.6955 44.3539 21.4812 43.9827L19.2305 40.0845C19.0162 39.7133 19.0739 39.245 19.372 38.9369L21.5402 36.6959V34.2489L19.372 32.0079C19.0739 31.6998 19.0162 31.2316 19.2305 30.8604L21.4812 26.9622C21.6955 26.591 22.1299 26.4068 22.5457 26.5109L25.5706 27.2681L27.6897 26.0447L28.5464 23.0464ZM28.9861 27.5132C29.2018 27.3887 29.3607 27.1851 29.4292 26.9456L30.1936 24.2701H33.2466L34.011 26.9456C34.0794 27.1851 34.2383 27.3887 34.4541 27.5132L37.2459 29.1251C37.4617 29.2497 37.7174 29.2855 37.9591 29.225L40.6583 28.5493L42.1848 31.1932L40.25 33.193C40.0768 33.372 39.9799 33.6114 39.9799 33.8605V37.0843C39.9799 37.3334 40.0768 37.5728 40.25 37.7518L42.1848 39.7516L40.6583 42.3955L37.9591 41.7198C37.7174 41.6593 37.4617 41.6951 37.2459 41.8197L34.4541 43.4316C34.2383 43.5561 34.0794 43.7597 34.011 43.9992L33.2466 46.6747H30.1936L29.4292 43.9992C29.3607 43.7597 29.2018 43.5561 28.9861 43.4316L26.1942 41.8197C25.9785 41.6951 25.7228 41.6593 25.4811 41.7198L22.7819 42.3955L21.2554 39.7516L23.1902 37.7518C23.3634 37.5728 23.4602 37.3334 23.4602 37.0843V33.8605C23.4602 33.6114 23.3634 33.372 23.1902 33.193L21.2554 31.1932L22.7819 28.5493L25.4811 29.225C25.7228 29.2855 25.9785 29.2497 26.1942 29.1251L28.9861 27.5132ZM31.7201 41.6407C28.3134 41.6407 25.5517 38.8791 25.5517 35.4724C25.5517 32.0657 28.3134 29.3041 31.7201 29.3041C35.1268 29.3041 37.8884 32.0657 37.8884 35.4724C37.8884 38.8791 35.1268 41.6407 31.7201 41.6407ZM35.9684 35.4724C35.9684 37.8187 34.0664 39.7207 31.7201 39.7207C29.3738 39.7207 27.4717 37.8187 27.4717 35.4724C27.4717 33.1261 29.3738 31.2241 31.7201 31.2241C34.0664 31.2241 35.9684 33.1261 35.9684 35.4724Z" fill="url(#paint1_linear_606_96)"/>
@@ -15,7 +15,7 @@ import{H as U,V as A,z as H,S as F,P as Z,j as G,Q as K}from"./vendor-ux-DtnxszG
15
15
  </linearGradient>
16
16
  </defs>
17
17
  </svg>
18
- `;function he({title:t,subTitle:c,titleInfo:o,action:l,createdAt:p,content:x,isLast:h,titleLink:v,avatarUrl:C,inService:f,renderTag:m}){const{locale:y}=A(),{palette:L}=I(),[s,w]=i.useState(!1),[a,d]=i.useState(!1),[n,u]=i.useState(window.innerWidth),j=i.useRef(null),b=()=>{const r=j.current?.mdp?.current;r&&d(r.scrollHeight>r.offsetHeight)};i.useEffect(()=>{const r=de(()=>{u(window.innerWidth)},100);return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),i.useEffect(()=>{b()},[n,x]);const k=i.useMemo(()=>Object.entries(o).map(([r,z])=>({key:r,value:z})).filter(r=>!!r.value),[o]),P=i.useMemo(()=>{let r=x;return f&&ge(x).forEach(S=>{/^(?:\/[^/]+)*\/blocklets\/[^/]+\/members$/.test(S.url)&&(r=r.replace(S.url,`${_.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/did-connect/members`))}),r},[x,f]);return e.jsx(g,{"data-cy":"log-entry",sx:{borderBottom:h?"none":`1px solid ${L.divider}`,padding:2},children:e.jsxs(g,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,width:"100%"},children:[e.jsx(g,{sx:{mt:.5},className:"log-author",children:C?e.jsx(Q,{src:C,size:36,shape:"circle"}):e.jsx("div",{dangerouslySetInnerHTML:{__html:xe}})}),e.jsxs(g,{sx:{width:240},children:[e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx($,{color:"textSecondary",component:"p",sx:{display:"flex"},children:v?e.jsx(ie,{to:v,target:"_blank",children:e.jsx(V,{maxLength:26,children:t})}):e.jsx(V,{maxLength:26,children:t})}),typeof m=="function"&&m()]}),e.jsx(B,{"aria-label":"Audit device info",title:e.jsx(g,{sx:{color:"#fff",display:"flex",flexDirection:"column",fontSize:12},children:k?.map(r=>e.jsx($,{sx:{fontSize:12,color:"#fff"},children:`${r.key}: ${r.value}`},r.key))}),children:e.jsxs($,{component:"span",color:"textSecondary",sx:{fontSize:13},children:[c,e.jsx(X,{sx:{ml:.5,fontSize:12,verticalAlign:"middle"}})]})})]}),e.jsxs(g,{sx:{width:200},children:[e.jsx($,{sx:{fontSize:"16px",color:L.text.primary,backgroundColor:L.background.default,fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'"},children:l}),e.jsx($,{component:"span",color:"textSecondary",children:e.jsx(H,{value:p,locale:y,type:"all",disableTimezone:!0,sx:{fontSize:12}})})]}),e.jsx(g,{sx:{flex:1,".wmde-markdown":{bgcolor:"background.default",color:"text.primary",".code-highlight":{"white-space":"pre-wrap;","word-break":"break-all"}}},children:a&&s?e.jsx($,{className:"log-content",color:"textPrimary",component:"div","data-color-mode":"light",gutterBottom:!0,sx:{maxWidth:"lg"},children:e.jsx(T,{source:P,rehypePlugins:[[O,{target:"_blank"}]]})}):e.jsx($,{className:"log-content",color:"textPrimary",component:"div","data-color-mode":"light",gutterBottom:!0,sx:{maxWidth:"lg",display:s?"block":"-webkit-box",WebkitLineClamp:s?"none":2,WebkitBoxOrient:"vertical",overflow:s?"visible":"hidden",wordBreak:"break-word"},children:e.jsx(T,{ref:j,source:P,rehypePlugins:[[O,{target:"_blank"}]]})})}),e.jsxs(g,{children:[a&&e.jsx(D,{size:"small",onClick:()=>w(!s),children:s?e.jsx(J,{sx:{fontSize:22}}):e.jsx(q,{sx:{fontSize:22}})}),e.jsx(D,{size:"small",children:e.jsx(F,{sx:{fontSize:22},content:x})})]})]})})}const Le=({log:t,info:c,inService:o})=>o?`${_.WELLKNOWN_BLOCKLET_ADMIN_PATH}/members?did=${t.actor.did}`:t.scope===c.did?`/team/members?did=${t.actor.did}`:`/blocklets/${t.scope}/members?did=${t.actor.did}`;function be({log:t,isLast:c}){const{inService:o,info:l}=W(),{t:p}=A(),{teamDid:x}=ue(),{showScope:h,scopeFormatter:v=a=>a,blocklets:C}=R(),f=i.useMemo(()=>{const a=t?.componentDid,d=t?.scope;if(!a)return null;if(o)return(window.blocklet?.componentMountPoints??[]).find(({did:k})=>k===a)||null;const n=C.find(({appPid:b,appDid:k})=>[b,k].includes(d));return n&&(n.children??[]).find(({meta:b})=>b?.did===a)?.meta||null},[C,o,t?.componentDid,t?.scope]);if(!t.actor.did)return null;const m=!["blocklet",""].includes(t.actor.role),y=()=>{if(f){const n=f.title??f.name??"",u=h?` - ${v(t.scope)}`:"";return`${n}${u}`}const a=t.actor.fullName??"",d=h?v(t.scope):"";return a?h?`${a} - ${d}`:a:d},L=h?t.link:Le({log:t,inService:o,info:l}),s=()=>{if(f)return`${o?`${_.WELLKNOWN_SERVICE_PATH_PREFIX}/blocklet/logo-bundle/${t.componentDid}`:`/blocklet/logo-bundle/${t.scope}/${t.componentDid}`}?v=${f?.version}`;const{avatar:a,source:d}=t.actor||{};return a?le(a,x,o,d==="server"):""},w=()=>f?e.jsx(B,{title:t.componentDid,children:e.jsx(K,{type:"success",children:"SDK"},"source")}):"";return e.jsx(he,{isLast:c,isUser:m,avatarDid:t.actor.did,avatarUrl:s(),title:y()||p("common.unrecordedUser"),renderTag:w,titleLink:L,subTitle:t.actor.role?t.actor.role:"guest",content:t.content,action:t.action,inService:o,titleInfo:{IP:t.ip,OS:`${M(t,"env.os.name","")}${M(t,"env.os.version","")}`,Client:`${M(t,"env.browser.name","")}${M(t,"env.browser.Version","")}`},createdAt:t.createdAt})}function ve(){const{t}=A(),{palette:c}=I(),{data:o,loading:l,paging:p,setPaging:x,filter:h,categories:v,setCategory:C,fetch:f,actionOrContent:m,setActionOrContent:y}=R(),L=I(),s=Y(L.breakpoints.down("sm")),w=i.useMemo(()=>({flexDirection:s?"column":"row",alignItems:s?"flex-start":"center",justifyContent:s?"flex-start":"space-between","& > div":s?{width:"100%",flex:1,".toolbar-search-area":{width:"100% !important",flex:"1 !important"}}:{}}),[s]),a=n=>{const u=Number(n.target.value);x({...p,pageSize:u}),f({page:1,pageSize:u,silent:!1})},d=n=>{x({...p,page:n+1}),f({page:n+1,pageSize:p.pageSize,silent:!1})};return l&&o.length===0?e.jsx("div",{style:{textAlign:"center",marginTop:"50px"},children:e.jsx(ee,{})}):e.jsxs(Ce,{"data-cy":"audit-logs",children:[e.jsxs(g,{className:"audit-logs-toolbar",sx:{display:"flex",flexDirection:s?"column":"row",gap:2,alignItems:s?"flex-start":"center",justifyContent:s?"flex-start":"space-between",...w},children:[e.jsxs(te,{sx:s?{width:"100%",flex:1}:{width:240,flexShrink:0},variant:"outlined",children:[e.jsx(ne,{children:t("common.filter")}),e.jsx(oe,{size:"small","data-cy":"filter-by-category-trigger",value:h.category,onChange:n=>C(n.target.value),fullWidth:!0,sx:{borderRadius:1},label:t("common.category"),disabled:l,children:v.map(n=>e.jsx(se,{value:n.value,"data-cy":`filter-by-category-${n.value}`,children:e.jsx(g,{children:e.jsx("span",{children:n.label})})},n.label))})]}),e.jsx(Z,{options:{searchPlaceholder:t("common.auditLogsSearch"),searchDebounceTime:600},search:m,searchText:m,searchTextUpdate:y,searchClose:()=>y(""),onSearchOpen:()=>{}})]}),o.length===0&&e.jsx(G,{children:t("common.empty")}),e.jsx(g,{sx:{mt:2,border:o?.length>0?`1px solid ${c.divider}`:"none",borderRadius:1},children:o.length>0&&o.map((n,u)=>e.jsx(be,{log:n,isLast:u===o.length-1},n.id))}),e.jsx(g,{sx:{display:"flex",justifyContent:"flex-end",mt:2},children:e.jsx(re,{disabled:l,page:p.page-1,count:p.total,rowsPerPage:p.pageSize,rowsPerPageOptions:[10,20,50,100],labelRowsPerPage:t("pagination.rowsPerPage"),labelDisplayedRows:({from:n,to:u,count:j})=>`${n}–${u} / ${j!==-1?j:`${t()}more than ${u}`}`,onPageChange:(n,u)=>d(u),onRowsPerPageChange:a})})]})}function Ne({scope:t,categories:c,showScope:o,scopeFormatter:l,blocklets:p}){return e.jsx(me,{scope:t,categories:c,showScope:o,scopeFormatter:l,blocklets:p,children:e.jsx(ve,{})})}const Ce=ae.div`
18
+ `;function he({title:t,subTitle:c,titleInfo:o,action:l,createdAt:p,content:x,isLast:h,titleLink:v,avatarUrl:C,inService:f,renderTag:m}){const{locale:y}=_(),{palette:L}=I(),[s,w]=i.useState(!1),[a,d]=i.useState(!1),[n,u]=i.useState(window.innerWidth),j=i.useRef(null),b=()=>{const r=j.current?.mdp?.current;r&&d(r.scrollHeight>r.offsetHeight)};i.useEffect(()=>{const r=de(()=>{u(window.innerWidth)},100);return window.addEventListener("resize",r),()=>window.removeEventListener("resize",r)},[]),i.useEffect(()=>{b()},[n,x]);const k=i.useMemo(()=>Object.entries(o).map(([r,z])=>({key:r,value:z})).filter(r=>!!r.value),[o]),P=i.useMemo(()=>{let r=x;return f&&ge(x).forEach(S=>{/^(?:\/[^/]+)*\/blocklets\/[^/]+\/members$/.test(S.url)&&(r=r.replace(S.url,`${A.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/did-connect/members`))}),r},[x,f]);return e.jsx(g,{"data-cy":"log-entry",sx:{borderBottom:h?"none":`1px solid ${L.divider}`,padding:2},children:e.jsxs(g,{sx:{display:"flex",flexDirection:"row",flexWrap:"wrap",gap:2,width:"100%"},children:[e.jsx(g,{sx:{mt:.5},className:"log-author",children:C?e.jsx(Q,{src:C,size:36,shape:"circle"}):e.jsx("div",{dangerouslySetInnerHTML:{__html:xe}})}),e.jsxs(g,{sx:{width:240},children:[e.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:.5},children:[e.jsx($,{color:"textSecondary",component:"p",sx:{display:"flex"},children:v?e.jsx(ie,{to:v,target:"_blank",children:e.jsx(V,{maxLength:26,children:t})}):e.jsx(V,{maxLength:26,children:t})}),typeof m=="function"&&m()]}),e.jsx(B,{"aria-label":"Audit device info",title:e.jsx(g,{sx:{color:"#fff",display:"flex",flexDirection:"column",fontSize:12},children:k?.map(r=>e.jsx($,{sx:{fontSize:12,color:"#fff"},children:`${r.key}: ${r.value}`},r.key))}),children:e.jsxs($,{component:"span",color:"textSecondary",sx:{fontSize:13},children:[c,e.jsx(X,{sx:{ml:.5,fontSize:12,verticalAlign:"middle"}})]})})]}),e.jsxs(g,{sx:{width:200},children:[e.jsx($,{sx:{fontSize:"16px",color:L.text.primary,backgroundColor:L.background.default,fontFamily:"-apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'"},children:l}),e.jsx($,{component:"span",color:"textSecondary",children:e.jsx(H,{value:p,locale:y,type:"all",disableTimezone:!0,sx:{fontSize:12}})})]}),e.jsx(g,{sx:{flex:1,".wmde-markdown":{bgcolor:"background.default",color:"text.primary",".code-highlight":{"white-space":"pre-wrap;","word-break":"break-all"}}},children:a&&s?e.jsx($,{className:"log-content",color:"textPrimary",component:"div","data-color-mode":"light",gutterBottom:!0,sx:{maxWidth:"lg"},children:e.jsx(T,{source:P,rehypePlugins:[[O,{target:"_blank"}]]})}):e.jsx($,{className:"log-content",color:"textPrimary",component:"div","data-color-mode":"light",gutterBottom:!0,sx:{maxWidth:"lg",display:s?"block":"-webkit-box",WebkitLineClamp:s?"none":2,WebkitBoxOrient:"vertical",overflow:s?"visible":"hidden",wordBreak:"break-word"},children:e.jsx(T,{ref:j,source:P,rehypePlugins:[[O,{target:"_blank"}]]})})}),e.jsxs(g,{children:[a&&e.jsx(D,{size:"small",onClick:()=>w(!s),children:s?e.jsx(J,{sx:{fontSize:22}}):e.jsx(q,{sx:{fontSize:22}})}),e.jsx(D,{size:"small",children:e.jsx(F,{sx:{fontSize:22},content:x})})]})]})})}const Le=({log:t,info:c,inService:o})=>o?`${A.WELLKNOWN_BLOCKLET_ADMIN_PATH}/members?did=${t.actor.did}`:t.scope===c.did?`/team/members?did=${t.actor.did}`:`/blocklets/${t.scope}/members?did=${t.actor.did}`;function be({log:t,isLast:c}){const{inService:o,info:l}=W(),{t:p}=_(),{teamDid:x}=ue(),{showScope:h,scopeFormatter:v=a=>a,blocklets:C}=R(),f=i.useMemo(()=>{const a=t?.componentDid,d=t?.scope;if(!a)return null;if(o)return(window.blocklet?.componentMountPoints??[]).find(({did:k})=>k===a)||null;const n=C.find(({appPid:b,appDid:k})=>[b,k].includes(d));return n&&(n.children??[]).find(({meta:b})=>b?.did===a)?.meta||null},[C,o,t?.componentDid,t?.scope]);if(!t.actor.did)return null;const m=!["blocklet",""].includes(t.actor.role),y=()=>{if(f){const n=f.title??f.name??"",u=h?` - ${v(t.scope)}`:"";return`${n}${u}`}const a=t.actor.fullName??"",d=h?v(t.scope):"";return a?h?`${a} - ${d}`:a:d},L=h?t.link:Le({log:t,inService:o,info:l}),s=()=>{if(f)return`${o?`${A.WELLKNOWN_SERVICE_PATH_PREFIX}/blocklet/logo-bundle/${t.componentDid}`:`/blocklet/logo-bundle/${t.scope}/${t.componentDid}`}?v=${f?.version}`;const{avatar:a,source:d}=t.actor||{};return a?le(a,x,o,d==="server"):""},w=()=>f?e.jsx(B,{title:t.componentDid,children:e.jsx(K,{type:"success",children:"SDK"},"source")}):"";return e.jsx(he,{isLast:c,isUser:m,avatarDid:t.actor.did,avatarUrl:s(),title:y()||p("common.unrecordedUser"),renderTag:w,titleLink:L,subTitle:t.actor.role?t.actor.role:"guest",content:t.content,action:t.action,inService:o,titleInfo:{IP:t.ip,OS:`${M(t,"env.os.name","")}${M(t,"env.os.version","")}`,Client:`${M(t,"env.browser.name","")}${M(t,"env.browser.Version","")}`},createdAt:t.createdAt})}function ve(){const{t}=_(),{palette:c}=I(),{data:o,loading:l,paging:p,setPaging:x,filter:h,categories:v,setCategory:C,fetch:f,actionOrContent:m,setActionOrContent:y}=R(),L=I(),s=Y(L.breakpoints.down("sm")),w=i.useMemo(()=>({flexDirection:s?"column":"row",alignItems:s?"flex-start":"center",justifyContent:s?"flex-start":"space-between","& > div":s?{width:"100%",flex:1,".toolbar-search-area":{width:"100% !important",flex:"1 !important"}}:{}}),[s]),a=n=>{const u=Number(n.target.value);x({...p,pageSize:u}),f({page:1,pageSize:u,silent:!1})},d=n=>{x({...p,page:n+1}),f({page:n+1,pageSize:p.pageSize,silent:!1})};return l&&o.length===0?e.jsx("div",{style:{textAlign:"center",marginTop:"50px"},children:e.jsx(ee,{})}):e.jsxs(Ce,{"data-cy":"audit-logs",children:[e.jsxs(g,{className:"audit-logs-toolbar",sx:{display:"flex",flexDirection:s?"column":"row",gap:2,alignItems:s?"flex-start":"center",justifyContent:s?"flex-start":"space-between",...w},children:[e.jsxs(te,{sx:s?{width:"100%",flex:1}:{width:240,flexShrink:0},variant:"outlined",children:[e.jsx(ne,{children:t("common.filter")}),e.jsx(oe,{size:"small","data-cy":"filter-by-category-trigger",value:h.category,onChange:n=>C(n.target.value),fullWidth:!0,sx:{borderRadius:1},label:t("common.category"),disabled:l,children:v.map(n=>e.jsx(se,{value:n.value,"data-cy":`filter-by-category-${n.value}`,children:e.jsx(g,{children:e.jsx("span",{children:n.label})})},n.label))})]}),e.jsx(Z,{options:{searchPlaceholder:t("common.auditLogsSearch"),searchDebounceTime:600},search:m,searchText:m,searchTextUpdate:y,searchClose:()=>y(""),onSearchOpen:()=>{}})]}),o.length===0&&e.jsx(G,{children:t("common.empty")}),e.jsx(g,{sx:{mt:2,border:o?.length>0?`1px solid ${c.divider}`:"none",borderRadius:1},children:o.length>0&&o.map((n,u)=>e.jsx(be,{log:n,isLast:u===o.length-1},n.id))}),e.jsx(g,{sx:{display:"flex",justifyContent:"flex-end",mt:2},children:e.jsx(re,{disabled:l,page:p.page-1,count:p.total,rowsPerPage:p.pageSize,rowsPerPageOptions:[10,20,50,100],labelRowsPerPage:t("pagination.rowsPerPage"),labelDisplayedRows:({from:n,to:u,count:j})=>`${n}–${u} / ${j!==-1?j:`${t()}more than ${u}`}`,onPageChange:(n,u)=>d(u),onRowsPerPageChange:a})})]})}function Ne({scope:t,categories:c,showScope:o,scopeFormatter:l,blocklets:p}){return e.jsx(me,{scope:t,categories:c,showScope:o,scopeFormatter:l,blocklets:p,children:e.jsx(ve,{})})}const Ce=ae.div`
19
19
  .log-content {
20
20
  p {
21
21
  margin-bottom: 4px;
@@ -1 +1 @@
1
- import{J as A,j as e,ak as t,a6 as E,Q as l,b3 as W,T as o,b4 as z,am as I,b5 as R,b6 as L,a5 as O,a3 as T,a$ as f,b1 as F}from"./vendor-mui-core-CnXrAOs3.js";import{r as x}from"./vendor-react-Dvs43sk9.js";import{l as D}from"./vendor-hooks-CjESGRlR.js";import{C as b}from"./vendor-utils-cJEl_UEd.js";import{a as B,c as u,t as H,H as U,K,d as M}from"./index-FASRIZyi.js";import{K as p}from"./landing-page-CG20_HOe.js";import{V as Q,M as y}from"./vendor-ux-DtnxszG_.js";import{W as V}from"./did-address-CZak4Nzl.js";import"./vendor-arcblock-DVRwGBYP.js";import"./lottie-web-4koyQiv_.js";function re(){const{searchParams:r}=new URL(window.location.href),{session:d}=B(),{t:c}=Q(),m=r.get("client_id"),_=r.get("scope")||"profile:read",[g,w]=x.useState(_.split(" ").filter(Boolean)),v=A("(max-width: 600px)"),k=b(window.location.origin,u.WELLKNOWN_SERVICE_PATH_PREFIX,"/oauth/authorize"),C=x.useCallback(i=>i?i.startsWith("http")?i:`${b(u.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/media/upload",window.blocklet.appPid)}/${i}`:"",[]),[h,j]=D({client:null,loading:!0});x.useEffect(()=>{(async()=>{const{data:n}=await M.get("/oauth/client",{params:{clientId:m}});j({client:n,loading:!1})})()},[m,j]);const S=i=>{i!=="profile:read"&&w(n=>n.includes(i)?n.filter(P=>P!==i):[...n,i])};if(h.loading||!d?.user)return e.jsx(p,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(t,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsx(E,{})})});if(!h.client)return e.jsx(p,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(t,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsx(H,{style:{backgroundColor:"transparent"},status:"error",title:c("notFoundOauthClient"),extra:e.jsx(l,{variant:"outlined",color:"primary",size:"small",startIcon:e.jsx(W,{}),href:"/",style:{borderRadius:4},children:c("connectCli.home")})})})});const{client:s}=h,{user:a}=d,N=(s.scope||"").split(" ");return e.jsxs(p,{did:window.blocklet?.appPid,standalone:!0,children:[e.jsx(U,{children:e.jsxs("title",{children:[c("oauth.authorize")," | ",window.blocklet?.appName]})}),e.jsx(K,{hideCloseButton:!0,children:e.jsxs(t,{sx:{display:"flex",flexDirection:"column",p:{xs:2,lg:3,xl:4},pt:{xs:3,xl:4},bgcolor:"background.paper"},className:"page-authorize",children:[e.jsxs(t,{sx:{textAlign:"center",mb:2},children:[e.jsxs(t,{sx:{display:"flex",alignItems:"center",justifyContent:"center",mb:2},children:[e.jsx(y,{src:window.blocklet?.appLogo,alt:"Server",width:48,height:48}),e.jsxs(t,{sx:{mx:2,display:"flex",alignItems:"center","& .dot":{width:8,height:8,borderRadius:"50%",bgcolor:"divider",mx:.5}},children:[e.jsx(t,{className:"dot"}),e.jsx(t,{className:"dot"}),e.jsx(t,{className:"dot"})]}),e.jsx(y,{src:C(s.logo_uri),alt:s.client_name,width:48,height:48})]}),e.jsxs(o,{sx:{mb:1,fontSize:"1.2rem","& .app-name":{color:"primary.main"}},children:["Authorize ",e.jsx("span",{className:"app-name",children:s.client_name})]})]}),e.jsxs(t,{sx:{display:"flex",alignItems:"center",width:"100%",overflow:"hidden",mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},className:"info",children:[e.jsx(z,{src:a.avatar,style:{width:48,height:48,backgroundColor:"transparent",marginRight:16}}),e.jsxs(t,{sx:{flex:1,overflow:"hidden"},children:[e.jsx(I,{title:a.fullName,children:e.jsx(t,{className:"name",sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:a.fullName})}),e.jsx(t,{className:"did",children:e.jsx(V,{compact:!0,responsive:!1,did:a.did,showQrcode:!v})})]})]}),e.jsxs(o,{variant:"subtitle1",sx:{mb:2,fontWeight:500},children:["Allow ",s.client_name," to do the following on your behalf:"]}),e.jsxs(t,{sx:{border:"1px solid",borderColor:"divider",borderRadius:2,overflow:"hidden"},children:[e.jsx(t,{sx:{p:2},children:e.jsx(R,{children:Object.entries(u.OAUTH_SCOPES).filter(([i])=>N.includes(i)).map(([i,n])=>e.jsx(L,{control:e.jsx(O,{checked:g.includes(i),onChange:()=>S(i),disabled:i==="profile:read"||["blocklet:read","blocklet:write"].includes(i)&&!["owner","admin","member"].includes(a.role),color:"primary",sx:{"&.Mui-checked":{color:"success.main"}}}),label:e.jsx(t,{children:e.jsx(o,{variant:"body1",sx:{fontWeight:500},children:n})}),sx:{mb:0}},i))})}),(s.tos_uri||s.policy_uri)&&e.jsxs(e.Fragment,{children:[e.jsx(T,{}),e.jsx(t,{sx:{height:1,bgcolor:"divider"}}),e.jsx(t,{sx:{p:2,color:"text.secondary"},children:e.jsxs(o,{variant:"body2",children:["By authorize the access, you also agree with the"," ",!!s.tos_uri&&e.jsx(f,{href:s.tos_uri,target:"_blank",children:"Terms of Use"}),!!s.tos_uri&&!!s.policy_uri&&" and ",!!s.policy_uri&&e.jsx(f,{href:s.policy_uri,target:"_blank",children:"Privacy Policy"})]})})]})]}),e.jsxs("form",{method:"POST",action:k,children:[r.get("client_id")&&e.jsx("input",{type:"hidden",name:"client_id",value:r.get("client_id")}),r.get("response_type")&&e.jsx("input",{type:"hidden",name:"response_type",value:r.get("response_type")}),r.get("redirect_uri")&&e.jsx("input",{type:"hidden",name:"redirect_uri",value:r.get("redirect_uri")}),r.get("code_challenge")&&e.jsx("input",{type:"hidden",name:"code_challenge",value:r.get("code_challenge")}),r.get("code_challenge_method")&&e.jsx("input",{type:"hidden",name:"code_challenge_method",value:r.get("code_challenge_method")}),r.get("state")&&e.jsx("input",{type:"hidden",name:"state",value:r.get("state")}),e.jsx("input",{type:"hidden",name:"scope",value:g.join(" ")}),e.jsx(t,{sx:{mt:"auto",pt:3},children:e.jsxs(F,{direction:"row",spacing:2,children:[e.jsx(l,{variant:"outlined",size:"large",fullWidth:!0,type:"submit",name:"action",value:"deny",children:"Cancel"}),e.jsx(l,{variant:"contained",size:"large",fullWidth:!0,type:"submit",name:"action",value:"allow",children:"Authorize"})]})}),r.get("redirect_uri")&&e.jsxs(t,{sx:{mt:3,textAlign:"center"},children:[e.jsx(o,{variant:"body2",sx:{color:"text.secondary"},children:"You will be redirected to"}),e.jsx(o,{variant:"body2",sx:{color:"text.secondary",wordBreak:"break-all"},children:r.get("redirect_uri")})]}),e.jsx(t,{sx:{mt:2,textAlign:"center"},children:e.jsxs(o,{variant:"body2",children:["Not you?"," ",e.jsx(l,{variant:"text",color:"primary",onClick:()=>d.switchDid(),sx:{p:0,minWidth:"auto",textTransform:"none",verticalAlign:"baseline",fontWeight:"inherit",fontSize:"inherit","&:hover":{background:"none",textDecoration:"underline"}},children:"Use another account"})]})})]})]})})]})}export{re as default};
1
+ import{J as A,j as e,ak as t,a6 as E,Q as l,b3 as W,T as o,b4 as z,am as I,b5 as R,b6 as L,a5 as O,a3 as T,a$ as f,b1 as F}from"./vendor-mui-core-CnXrAOs3.js";import{r as x}from"./vendor-react-Dvs43sk9.js";import{l as D}from"./vendor-hooks-CjESGRlR.js";import{C as b}from"./vendor-utils-cJEl_UEd.js";import{a as B,c as u,t as H,H as U,M,d as K}from"./index-6LL6v88e.js";import{K as p}from"./landing-page-BWuAhFDM.js";import{V as Q,M as y}from"./vendor-ux-DtnxszG_.js";import{W as V}from"./did-address-CZak4Nzl.js";import"./vendor-arcblock-DVRwGBYP.js";import"./lottie-web-4koyQiv_.js";function re(){const{searchParams:r}=new URL(window.location.href),{session:d}=B(),{t:c}=Q(),m=r.get("client_id"),_=r.get("scope")||"profile:read",[g,w]=x.useState(_.split(" ").filter(Boolean)),v=A("(max-width: 600px)"),k=b(window.location.origin,u.WELLKNOWN_SERVICE_PATH_PREFIX,"/oauth/authorize"),C=x.useCallback(i=>i?i.startsWith("http")?i:`${b(u.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/media/upload",window.blocklet.appPid)}/${i}`:"",[]),[h,j]=D({client:null,loading:!0});x.useEffect(()=>{(async()=>{const{data:n}=await K.get("/oauth/client",{params:{clientId:m}});j({client:n,loading:!1})})()},[m,j]);const S=i=>{i!=="profile:read"&&w(n=>n.includes(i)?n.filter(P=>P!==i):[...n,i])};if(h.loading||!d?.user)return e.jsx(p,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(t,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsx(E,{})})});if(!h.client)return e.jsx(p,{did:window.blocklet?.appPid,standalone:!0,children:e.jsx(t,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsx(H,{style:{backgroundColor:"transparent"},status:"error",title:c("notFoundOauthClient"),extra:e.jsx(l,{variant:"outlined",color:"primary",size:"small",startIcon:e.jsx(W,{}),href:"/",style:{borderRadius:4},children:c("connectCli.home")})})})});const{client:s}=h,{user:a}=d,N=(s.scope||"").split(" ");return e.jsxs(p,{did:window.blocklet?.appPid,standalone:!0,children:[e.jsx(U,{children:e.jsxs("title",{children:[c("oauth.authorize")," | ",window.blocklet?.appName]})}),e.jsx(M,{hideCloseButton:!0,children:e.jsxs(t,{sx:{display:"flex",flexDirection:"column",p:{xs:2,lg:3,xl:4},pt:{xs:3,xl:4},bgcolor:"background.paper"},className:"page-authorize",children:[e.jsxs(t,{sx:{textAlign:"center",mb:2},children:[e.jsxs(t,{sx:{display:"flex",alignItems:"center",justifyContent:"center",mb:2},children:[e.jsx(y,{src:window.blocklet?.appLogo,alt:"Server",width:48,height:48}),e.jsxs(t,{sx:{mx:2,display:"flex",alignItems:"center","& .dot":{width:8,height:8,borderRadius:"50%",bgcolor:"divider",mx:.5}},children:[e.jsx(t,{className:"dot"}),e.jsx(t,{className:"dot"}),e.jsx(t,{className:"dot"})]}),e.jsx(y,{src:C(s.logo_uri),alt:s.client_name,width:48,height:48})]}),e.jsxs(o,{sx:{mb:1,fontSize:"1.2rem","& .app-name":{color:"primary.main"}},children:["Authorize ",e.jsx("span",{className:"app-name",children:s.client_name})]})]}),e.jsxs(t,{sx:{display:"flex",alignItems:"center",width:"100%",overflow:"hidden",mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},className:"info",children:[e.jsx(z,{src:a.avatar,style:{width:48,height:48,backgroundColor:"transparent",marginRight:16}}),e.jsxs(t,{sx:{flex:1,overflow:"hidden"},children:[e.jsx(I,{title:a.fullName,children:e.jsx(t,{className:"name",sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:a.fullName})}),e.jsx(t,{className:"did",children:e.jsx(V,{compact:!0,responsive:!1,did:a.did,showQrcode:!v})})]})]}),e.jsxs(o,{variant:"subtitle1",sx:{mb:2,fontWeight:500},children:["Allow ",s.client_name," to do the following on your behalf:"]}),e.jsxs(t,{sx:{border:"1px solid",borderColor:"divider",borderRadius:2,overflow:"hidden"},children:[e.jsx(t,{sx:{p:2},children:e.jsx(R,{children:Object.entries(u.OAUTH_SCOPES).filter(([i])=>N.includes(i)).map(([i,n])=>e.jsx(L,{control:e.jsx(O,{checked:g.includes(i),onChange:()=>S(i),disabled:i==="profile:read"||["blocklet:read","blocklet:write"].includes(i)&&!["owner","admin","member"].includes(a.role),color:"primary",sx:{"&.Mui-checked":{color:"success.main"}}}),label:e.jsx(t,{children:e.jsx(o,{variant:"body1",sx:{fontWeight:500},children:n})}),sx:{mb:0}},i))})}),(s.tos_uri||s.policy_uri)&&e.jsxs(e.Fragment,{children:[e.jsx(T,{}),e.jsx(t,{sx:{height:1,bgcolor:"divider"}}),e.jsx(t,{sx:{p:2,color:"text.secondary"},children:e.jsxs(o,{variant:"body2",children:["By authorize the access, you also agree with the"," ",!!s.tos_uri&&e.jsx(f,{href:s.tos_uri,target:"_blank",children:"Terms of Use"}),!!s.tos_uri&&!!s.policy_uri&&" and ",!!s.policy_uri&&e.jsx(f,{href:s.policy_uri,target:"_blank",children:"Privacy Policy"})]})})]})]}),e.jsxs("form",{method:"POST",action:k,children:[r.get("client_id")&&e.jsx("input",{type:"hidden",name:"client_id",value:r.get("client_id")}),r.get("response_type")&&e.jsx("input",{type:"hidden",name:"response_type",value:r.get("response_type")}),r.get("redirect_uri")&&e.jsx("input",{type:"hidden",name:"redirect_uri",value:r.get("redirect_uri")}),r.get("code_challenge")&&e.jsx("input",{type:"hidden",name:"code_challenge",value:r.get("code_challenge")}),r.get("code_challenge_method")&&e.jsx("input",{type:"hidden",name:"code_challenge_method",value:r.get("code_challenge_method")}),r.get("state")&&e.jsx("input",{type:"hidden",name:"state",value:r.get("state")}),e.jsx("input",{type:"hidden",name:"scope",value:g.join(" ")}),e.jsx(t,{sx:{mt:"auto",pt:3},children:e.jsxs(F,{direction:"row",spacing:2,children:[e.jsx(l,{variant:"outlined",size:"large",fullWidth:!0,type:"submit",name:"action",value:"deny",children:"Cancel"}),e.jsx(l,{variant:"contained",size:"large",fullWidth:!0,type:"submit",name:"action",value:"allow",children:"Authorize"})]})}),r.get("redirect_uri")&&e.jsxs(t,{sx:{mt:3,textAlign:"center"},children:[e.jsx(o,{variant:"body2",sx:{color:"text.secondary"},children:"You will be redirected to"}),e.jsx(o,{variant:"body2",sx:{color:"text.secondary",wordBreak:"break-all"},children:r.get("redirect_uri")})]}),e.jsx(t,{sx:{mt:2,textAlign:"center"},children:e.jsxs(o,{variant:"body2",children:["Not you?"," ",e.jsx(l,{variant:"text",color:"primary",onClick:()=>d.switchDid(),sx:{p:0,minWidth:"auto",textTransform:"none",verticalAlign:"baseline",fontWeight:"inherit",fontSize:"inherit","&:hover":{background:"none",textDecoration:"underline"}},children:"Use another account"})]})})]})]})})]})}export{re as default};