@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
@@ -1 +1 @@
1
- import{j as t,b1 as b,b4 as k,T as m,am as M,W as s,s as T,U as $,ak as g,bH as f,bI as x,bJ as q,bK as N,bL as L,bM as R,bN as B}from"./vendor-mui-core-CnXrAOs3.js";import{V as h,z as F,A as S}from"./vendor-ux-DtnxszG_.js";import{B as E,o as P,l as V}from"./index-SEBP2NIP.js";import{U as H}from"./ua-parser-DP5omx3I.js";import{a as w}from"./vendor-react-Dvs43sk9.js";import{a as G}from"./vendor-hooks-CjESGRlR.js";import{W as j}from"./did-address-CZak4Nzl.js";import{p as J}from"./util-LPNcvj77.js";import{u as K}from"./team-Bje0MaMX.js";function Y(e){return!e||typeof e!="string"?"break-all":e.includes(" ")?"break-word":"break-all"}function z({logo:e="",name:r="",description:n="",size:l=40,variant:a="rounded",sx:d={},className:p="",logoName:u="",tooltip:o=null}){const i={width:l,height:l,...d},y=typeof r=="string"?r:e,v=t.jsxs(b,{direction:"row",spacing:1,className:`info-card-wrapper ${p}`,sx:{alignItems:"center",cursor:o?"pointer":"default"},children:[e?t.jsx(k,{src:e,alt:u??y,variant:a,sx:i}):t.jsx(k,{variant:a,sx:i,children:y?.slice(0,1)}),t.jsxs(b,{direction:"column",sx:{alignItems:"flex-start",justifyContent:"space-around",wordBreak:Y(r),minWidth:{xs:100,sm:140}},children:[t.jsx(m,{variant:"body1",component:"div",sx:{color:"text.primary"},children:r}),n&&t.jsx(m,{variant:"subtitle1",sx:{color:"text.secondary"},children:n})]})]});return o?t.jsx(M,{title:o,placement:"top-start",slotProps:{tooltip:{sx:{bgcolor:c=>c.palette.mode==="dark"?"#2a2e37":"#ffffff",color:c=>c.palette.mode==="dark"?"#ffffff":c.palette.text.primary,boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",borderRadius:2,padding:"10px 16px",fontSize:14,maxWidth:400,minWidth:240,wordBreak:"break-word",border:c=>c.palette.mode==="dark"?"1px solid #3a3f48":"1px solid #e0e0e0","& .MuiTooltip-arrow":{color:c=>c.palette.mode==="dark"?"#2a2e37":"#ffffff","&::before":{border:c=>c.palette.mode==="dark"?"1px solid #3a3f48":"1px solid #e0e0e0",backgroundColor:c=>c.palette.mode==="dark"?"#2a2e37":"#ffffff"}}}}},children:v}):v}z.propTypes={logo:s.string,name:s.oneOfType([s.string,s.node]).isRequired,description:s.oneOfType([s.string,s.node]),size:s.oneOfType([s.number,s.string]),variant:s.oneOf(["square","rounded","circular"]),sx:s.object,className:s.string,logoName:s.string,tooltip:s.oneOfType([s.string,s.node])};function _(e){try{if(!e.trim())return{device:{icon:t.jsx(x,{fontSize:"small"}),text:"Unknown Device"},os:{icon:null,text:"Unknown OS"},browser:{icon:t.jsx(f,{fontSize:"small"}),text:"Unknown Browser"}};const n=new H(e).getResult();let l="";const a=e.split(/\s+/).find(o=>o.startsWith("arcwallet"));if(a){const o=a.split("/");o.length>1&&S.coerce(o[1])&&(l=S.coerce(o[1]).version)}const d=(()=>{const{type:o="",model:i=""}=n.device;return o==="mobile"?{icon:t.jsx(q,{fontSize:"small"}),text:i||"Mobile Device"}:o==="tablet"?{icon:t.jsx(N,{fontSize:"small"}),text:i||"Tablet"}:{icon:t.jsx(L,{fontSize:"small"}),text:i||"Desktop"}})(),p=(()=>{const{name:o="",version:i=""}=n.os;return o.toLowerCase().includes("mac")?{icon:t.jsx(R,{fontSize:"small"}),text:`${o} ${i}`}:o.toLowerCase().includes("ios")?{icon:t.jsx(R,{fontSize:"small"}),text:`${o} ${i}`}:o.toLowerCase().includes("android")?{icon:t.jsx(B,{fontSize:"small"}),text:`${o} ${i}`}:o.toLowerCase().includes("windows")?{icon:t.jsx(x,{fontSize:"small"}),text:`${o} ${i}`}:{icon:null,text:o?`${o} ${i}`:"Unknown OS"}})(),u=(()=>{const{name:o="",version:i=""}=n.browser;return{icon:t.jsx(f,{fontSize:"small"}),text:o?`${o} ${i}`:"Unknown Browser"}})();return{device:d,os:p,browser:u,...l?{walletVersion:{icon:null,text:l}}:{}}}catch(r){return console.error("Error parsing user agent:",r),{device:{icon:t.jsx(x,{fontSize:"small"}),text:"Unknown Device"},os:{icon:null,text:"Unknown OS"},browser:{icon:t.jsx(f,{fontSize:"small"}),text:"Unknown Browser"}}}}function C({ua:e}){const r=_(e);return t.jsx(b,{spacing:1,children:Object.entries(r).map(([n,{icon:l,text:a}])=>t.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[t.jsx(g,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:l}),t.jsx(m,{variant:"body2",sx:{display:"flex"},children:a})]},n))})}C.propTypes={ua:s.string.isRequired};const Q=()=>{const{t:e}=h(),r={$all:e("common.all"),owner:"Owner",admin:"Admin",member:"Member",guest:"Guest"};return{SYSTEM_ROLES:r,formatRoleName:l=>{const a=(l||"").toLowerCase();return a.startsWith("$")?r[a]||a.slice(1):r[a]||a}}},X=(e,r=!1)=>{const n=r?1:.6;switch(e){case"owner":return`rgba(232, 222, 255, ${n})`;case"admin":return`rgba(227, 242, 253, ${n})`;case"member":return`rgba(232, 245, 233, ${n})`;case"guest":return`rgba(245, 245, 245, ${n})`;default:return`rgba(245, 245, 245, ${n})`}},Z=T($)(({role:e})=>({backgroundColor:X(e.toLowerCase()),color:"#000000"})),ee=e=>{switch(e){case"valid":return r=>r.palette.success.light;case"expired":return r=>r.palette.text.disabled;case"revoked":return r=>r.palette.error.light;default:return r=>r.palette.warning.light}},re=T($)(({theme:e,status:r})=>({backgroundColor:ee(r)(e),color:"#FFFFFF"}));function U({did:e}){return t.jsx(j,{size:14,responsive:!1,compact:!0,copyable:!1,did:e})}U.propTypes={did:s.string.isRequired};function I({timestamp:e,locale:r}){return t.jsx(g,{sx:{minWidth:"100px"},children:t.jsx(F,{value:e,locale:r})})}I.propTypes={timestamp:s.number.isRequired,locale:s.string.isRequired};function W({name:e="",role:r}){const{formatRoleName:n}=Q();return t.jsx(Z,{label:n(e||r),size:"small",role:e||r,sx:{borderRadius:1}})}W.propTypes={role:s.string.isRequired,name:s.string};function O({status:e}){const{t:r}=h();return t.jsx(re,{label:r(`team.passport.statusMap.${e}`),size:"small",status:e,sx:{borderRadius:1}})}O.propTypes={status:s.string.isRequired};function A({source:e}){const{t:r}=h();return e?r(`team.passport.sourceMaps.${e}`):"-"}A.propTypes={source:s.string.isRequired};function D({user:e,size:r="default",tooltip:n=!1,inService:l=!1}){const{teamDid:a}=K(),d=w.useMemo(()=>J(e.avatar,a,l),[e.avatar,a,l]),p=w.useMemo(()=>t.jsx(j,{did:e?.did,compact:!0,responsive:!1,sx:{whiteSpace:"nowrap"},size:12}),[e?.did]),u=G(()=>({...e,avatar:d}),[e,d]);return r==="small"?t.jsx(z,{variant:"circular",logo:d,name:t.jsx(m,{sx:{maxWidth:320,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},className:"customer-link-name",children:e.fullName||e.email}),...r==="small"?{tooltip:n?t.jsx(j,{did:e?.did}):!1,size:24}:{description:p,size:36}}):t.jsx(E,{user:u,avatarSize:r==="small"?24:36,cardType:V.Detailed,infoType:P.Minimal,sx:{padding:0,border:"none"},showDid:!0,didProps:{compact:!0,responsive:!1},showHoverCard:!1})}D.propTypes={user:s.object.isRequired,size:s.string,tooltip:s.bool,inService:s.bool};const te=w.memo(D),ue=e=>t.jsx(U,{did:e}),me=(e,r)=>t.jsx(W,{name:e,role:r}),fe=e=>t.jsx(O,{status:e}),xe=(e,r)=>t.jsx(I,{timestamp:e,locale:r}),be=e=>t.jsx(A,{source:e}),ge=(e,r=!1)=>t.jsx(te,{user:e,inService:r}),we=e=>t.jsx(C,{ua:e});export{me as a,fe as b,xe as c,be as d,we as e,ue as f,ge as r,Q as u};
1
+ import{j as t,b1 as b,b4 as k,T as m,am as M,W as s,s as T,U as $,ak as g,bH as f,bI as x,bJ as q,bK as N,bL as L,bM as R,bN as B}from"./vendor-mui-core-CnXrAOs3.js";import{V as h,z as F,A as S}from"./vendor-ux-DtnxszG_.js";import{B as E,o as P,l as V}from"./index-B35nKjq_.js";import{U as H}from"./ua-parser-DP5omx3I.js";import{a as w}from"./vendor-react-Dvs43sk9.js";import{a as G}from"./vendor-hooks-CjESGRlR.js";import{W as j}from"./did-address-CZak4Nzl.js";import{p as J}from"./util-DiGoXrLh.js";import{u as K}from"./team-DPdkokhk.js";function Y(e){return!e||typeof e!="string"?"break-all":e.includes(" ")?"break-word":"break-all"}function z({logo:e="",name:r="",description:n="",size:l=40,variant:a="rounded",sx:d={},className:p="",logoName:u="",tooltip:o=null}){const i={width:l,height:l,...d},y=typeof r=="string"?r:e,v=t.jsxs(b,{direction:"row",spacing:1,className:`info-card-wrapper ${p}`,sx:{alignItems:"center",cursor:o?"pointer":"default"},children:[e?t.jsx(k,{src:e,alt:u??y,variant:a,sx:i}):t.jsx(k,{variant:a,sx:i,children:y?.slice(0,1)}),t.jsxs(b,{direction:"column",sx:{alignItems:"flex-start",justifyContent:"space-around",wordBreak:Y(r),minWidth:{xs:100,sm:140}},children:[t.jsx(m,{variant:"body1",component:"div",sx:{color:"text.primary"},children:r}),n&&t.jsx(m,{variant:"subtitle1",sx:{color:"text.secondary"},children:n})]})]});return o?t.jsx(M,{title:o,placement:"top-start",slotProps:{tooltip:{sx:{bgcolor:c=>c.palette.mode==="dark"?"#2a2e37":"#ffffff",color:c=>c.palette.mode==="dark"?"#ffffff":c.palette.text.primary,boxShadow:"0 2px 10px rgba(0, 0, 0, 0.15)",borderRadius:2,padding:"10px 16px",fontSize:14,maxWidth:400,minWidth:240,wordBreak:"break-word",border:c=>c.palette.mode==="dark"?"1px solid #3a3f48":"1px solid #e0e0e0","& .MuiTooltip-arrow":{color:c=>c.palette.mode==="dark"?"#2a2e37":"#ffffff","&::before":{border:c=>c.palette.mode==="dark"?"1px solid #3a3f48":"1px solid #e0e0e0",backgroundColor:c=>c.palette.mode==="dark"?"#2a2e37":"#ffffff"}}}}},children:v}):v}z.propTypes={logo:s.string,name:s.oneOfType([s.string,s.node]).isRequired,description:s.oneOfType([s.string,s.node]),size:s.oneOfType([s.number,s.string]),variant:s.oneOf(["square","rounded","circular"]),sx:s.object,className:s.string,logoName:s.string,tooltip:s.oneOfType([s.string,s.node])};function _(e){try{if(!e.trim())return{device:{icon:t.jsx(x,{fontSize:"small"}),text:"Unknown Device"},os:{icon:null,text:"Unknown OS"},browser:{icon:t.jsx(f,{fontSize:"small"}),text:"Unknown Browser"}};const n=new H(e).getResult();let l="";const a=e.split(/\s+/).find(o=>o.startsWith("arcwallet"));if(a){const o=a.split("/");o.length>1&&S.coerce(o[1])&&(l=S.coerce(o[1]).version)}const d=(()=>{const{type:o="",model:i=""}=n.device;return o==="mobile"?{icon:t.jsx(q,{fontSize:"small"}),text:i||"Mobile Device"}:o==="tablet"?{icon:t.jsx(N,{fontSize:"small"}),text:i||"Tablet"}:{icon:t.jsx(L,{fontSize:"small"}),text:i||"Desktop"}})(),p=(()=>{const{name:o="",version:i=""}=n.os;return o.toLowerCase().includes("mac")?{icon:t.jsx(R,{fontSize:"small"}),text:`${o} ${i}`}:o.toLowerCase().includes("ios")?{icon:t.jsx(R,{fontSize:"small"}),text:`${o} ${i}`}:o.toLowerCase().includes("android")?{icon:t.jsx(B,{fontSize:"small"}),text:`${o} ${i}`}:o.toLowerCase().includes("windows")?{icon:t.jsx(x,{fontSize:"small"}),text:`${o} ${i}`}:{icon:null,text:o?`${o} ${i}`:"Unknown OS"}})(),u=(()=>{const{name:o="",version:i=""}=n.browser;return{icon:t.jsx(f,{fontSize:"small"}),text:o?`${o} ${i}`:"Unknown Browser"}})();return{device:d,os:p,browser:u,...l?{walletVersion:{icon:null,text:l}}:{}}}catch(r){return console.error("Error parsing user agent:",r),{device:{icon:t.jsx(x,{fontSize:"small"}),text:"Unknown Device"},os:{icon:null,text:"Unknown OS"},browser:{icon:t.jsx(f,{fontSize:"small"}),text:"Unknown Browser"}}}}function C({ua:e}){const r=_(e);return t.jsx(b,{spacing:1,children:Object.entries(r).map(([n,{icon:l,text:a}])=>t.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[t.jsx(g,{sx:{display:"flex",alignItems:"center",justifyContent:"center"},children:l}),t.jsx(m,{variant:"body2",sx:{display:"flex"},children:a})]},n))})}C.propTypes={ua:s.string.isRequired};const Q=()=>{const{t:e}=h(),r={$all:e("common.all"),owner:"Owner",admin:"Admin",member:"Member",guest:"Guest"};return{SYSTEM_ROLES:r,formatRoleName:l=>{const a=(l||"").toLowerCase();return a.startsWith("$")?r[a]||a.slice(1):r[a]||a}}},X=(e,r=!1)=>{const n=r?1:.6;switch(e){case"owner":return`rgba(232, 222, 255, ${n})`;case"admin":return`rgba(227, 242, 253, ${n})`;case"member":return`rgba(232, 245, 233, ${n})`;case"guest":return`rgba(245, 245, 245, ${n})`;default:return`rgba(245, 245, 245, ${n})`}},Z=T($)(({role:e})=>({backgroundColor:X(e.toLowerCase()),color:"#000000"})),ee=e=>{switch(e){case"valid":return r=>r.palette.success.light;case"expired":return r=>r.palette.text.disabled;case"revoked":return r=>r.palette.error.light;default:return r=>r.palette.warning.light}},re=T($)(({theme:e,status:r})=>({backgroundColor:ee(r)(e),color:"#FFFFFF"}));function U({did:e}){return t.jsx(j,{size:14,responsive:!1,compact:!0,copyable:!1,did:e})}U.propTypes={did:s.string.isRequired};function I({timestamp:e,locale:r}){return t.jsx(g,{sx:{minWidth:"100px"},children:t.jsx(F,{value:e,locale:r})})}I.propTypes={timestamp:s.number.isRequired,locale:s.string.isRequired};function W({name:e="",role:r}){const{formatRoleName:n}=Q();return t.jsx(Z,{label:n(e||r),size:"small",role:e||r,sx:{borderRadius:1}})}W.propTypes={role:s.string.isRequired,name:s.string};function O({status:e}){const{t:r}=h();return t.jsx(re,{label:r(`team.passport.statusMap.${e}`),size:"small",status:e,sx:{borderRadius:1}})}O.propTypes={status:s.string.isRequired};function A({source:e}){const{t:r}=h();return e?r(`team.passport.sourceMaps.${e}`):"-"}A.propTypes={source:s.string.isRequired};function D({user:e,size:r="default",tooltip:n=!1,inService:l=!1}){const{teamDid:a}=K(),d=w.useMemo(()=>J(e.avatar,a,l),[e.avatar,a,l]),p=w.useMemo(()=>t.jsx(j,{did:e?.did,compact:!0,responsive:!1,sx:{whiteSpace:"nowrap"},size:12}),[e?.did]),u=G(()=>({...e,avatar:d}),[e,d]);return r==="small"?t.jsx(z,{variant:"circular",logo:d,name:t.jsx(m,{sx:{maxWidth:320,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},className:"customer-link-name",children:e.fullName||e.email}),...r==="small"?{tooltip:n?t.jsx(j,{did:e?.did}):!1,size:24}:{description:p,size:36}}):t.jsx(E,{user:u,avatarSize:r==="small"?24:36,cardType:V.Detailed,infoType:P.Minimal,sx:{padding:0,border:"none"},showDid:!0,didProps:{compact:!0,responsive:!1},showHoverCard:!1})}D.propTypes={user:s.object.isRequired,size:s.string,tooltip:s.bool,inService:s.bool};const te=w.memo(D),ue=e=>t.jsx(U,{did:e}),me=(e,r)=>t.jsx(W,{name:e,role:r}),fe=e=>t.jsx(O,{status:e}),xe=(e,r)=>t.jsx(I,{timestamp:e,locale:r}),be=e=>t.jsx(A,{source:e}),ge=(e,r=!1)=>t.jsx(te,{user:e,inService:r}),we=e=>t.jsx(C,{ua:e});export{me as a,fe as b,xe as c,be as d,we as e,ue as f,ge as r,Q as u};
@@ -1 +1 @@
1
- import{j as l,W as n}from"./vendor-mui-core-CnXrAOs3.js";import{u as m}from"./session-Chl38-LD.js";function c({permission:i="",role:t="",component:e=null,children:o=null}){const{session:r}=m();let s=!0;const u=[].concat(i).filter(Boolean),f=[].concat(t).filter(Boolean);if(u.length){const p=r.user&&r.user.permissions||[];s=u.some(a=>p.includes(a))}return s&&f.length&&(s=f.includes(r.user.role)),typeof e=="function"?e(s):typeof o=="function"?o(s):s&&(e||o)||null}function x(i,t,e){return function(r){return l.jsx(c,{permission:t,role:e,children:s=>l.jsx(i,{...r,hasPermission:s})})}}c.propTypes={permission:n.oneOfType([n.string,n.arrayOf(n.string)]),role:n.oneOfType([n.string,n.arrayOf(n.string)]),component:n.oneOfType([n.func,n.node]),children:n.oneOfType([n.func,n.node])};export{c as P,x as w};
1
+ import{j as l,W as n}from"./vendor-mui-core-CnXrAOs3.js";import{u as m}from"./session-C2VeP2Dn.js";function c({permission:i="",role:t="",component:e=null,children:o=null}){const{session:r}=m();let s=!0;const u=[].concat(i).filter(Boolean),f=[].concat(t).filter(Boolean);if(u.length){const p=r.user&&r.user.permissions||[];s=u.some(a=>p.includes(a))}return s&&f.length&&(s=f.includes(r.user.role)),typeof e=="function"?e(s):typeof o=="function"?o(s):s&&(e||o)||null}function x(i,t,e){return function(r){return l.jsx(c,{permission:t,role:e,children:s=>l.jsx(i,{...r,hasPermission:s})})}}c.propTypes={permission:n.oneOfType([n.string,n.arrayOf(n.string)]),role:n.oneOfType([n.string,n.arrayOf(n.string)]),component:n.oneOfType([n.func,n.node]),children:n.oneOfType([n.func,n.node])};export{c as P,x as w};
@@ -1 +1 @@
1
- import{j as o}from"./vendor-mui-core-CnXrAOs3.js";import{C as t}from"./vendor-utils-cJEl_UEd.js";import{I as s}from"./iframe-BnDsbRZG.js";import{c as e}from"./index-FASRIZyi.js";import{S as m}from"./studio-C0FYSJNq.js";import"./vendor-react-Dvs43sk9.js";import"./vendor-ux-DtnxszG_.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DVRwGBYP.js";import"./index-CjkeMMBV.js";function L(){const r=new URLSearchParams;r.set("title","Preference Builder"),r.set("schemaKey",t(window.location.origin,e.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/studio/preferences"));const i=`${t(window.location.origin,e.WELLKNOWN_SERVICE_PATH_PREFIX,"/hosted/form-builder/")}?${r.toString()}`;return o.jsx(m,{children:o.jsx(s,{url:i,width:"100%",height:"100%",frameBorder:0,styles:{border:0}})})}export{L as default};
1
+ import{j as o}from"./vendor-mui-core-CnXrAOs3.js";import{C as t}from"./vendor-utils-cJEl_UEd.js";import{I as s}from"./iframe-BLnlbwGJ.js";import{c as e}from"./index-6LL6v88e.js";import{S as m}from"./studio-B4LIA7Jb.js";import"./vendor-react-Dvs43sk9.js";import"./vendor-ux-DtnxszG_.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DVRwGBYP.js";import"./index-z5QsHtdi.js";function L(){const r=new URLSearchParams;r.set("title","Preference Builder"),r.set("schemaKey",t(window.location.origin,e.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/studio/preferences"));const i=`${t(window.location.origin,e.WELLKNOWN_SERVICE_PATH_PREFIX,"/hosted/form-builder/")}?${r.toString()}`;return o.jsx(m,{children:o.jsx(s,{url:i,width:"100%",height:"100%",frameBorder:0,styles:{border:0}})})}export{L as default};
@@ -1 +1 @@
1
- import{j as r}from"./vendor-mui-core-CnXrAOs3.js";import{O as o}from"./user-center-_0Nuo2NC.js";import{H as i}from"./index-FASRIZyi.js";import{V as e}from"./vendor-ux-DtnxszG_.js";import"./vendor-react-Dvs43sk9.js";import"./vendor-hooks-CjESGRlR.js";import"./vendor-utils-cJEl_UEd.js";import"./index-D1efASvL.js";import"./arrow-down.svg-D6V-7qfa.js";import"./revoke.svg-CmffMlcP.js";import"./index-BXeml37I.js";import"./index-DsXcQxrF.js";import"./vendor-arcblock-DVRwGBYP.js";import"./index-XxymBn5U.js";import"./index-DRYJ0xIl.js";import"./index-BojVbZw0.js";import"./index-KLDWx9Xh.js";import"./lottie-web-4koyQiv_.js";function O(){const{t}=e();return r.jsxs(r.Fragment,{children:[r.jsx(i,{children:r.jsx("title",{children:t("pageTitle.userCenter")})}),r.jsx(o,{onlyProfile:!0,currentTab:"",disableAutoRedirect:!0})]})}export{O as default};
1
+ import{j as r}from"./vendor-mui-core-CnXrAOs3.js";import{O as o}from"./user-center-BOzwaiga.js";import{H as i}from"./index-6LL6v88e.js";import{V as e}from"./vendor-ux-DtnxszG_.js";import"./vendor-react-Dvs43sk9.js";import"./vendor-hooks-CjESGRlR.js";import"./vendor-utils-cJEl_UEd.js";import"./index-DxtYTTQ8.js";import"./arrow-down.svg-MODRFVx5.js";import"./revoke.svg-CmffMlcP.js";import"./index-BZt08NPA.js";import"./index-DsXcQxrF.js";import"./vendor-arcblock-DVRwGBYP.js";import"./index-BBsl5ZA-.js";import"./index-DRYJ0xIl.js";import"./index-BojVbZw0.js";import"./index-KLDWx9Xh.js";import"./lottie-web-4koyQiv_.js";function O(){const{t}=e();return r.jsxs(r.Fragment,{children:[r.jsx(i,{children:r.jsx("title",{children:t("pageTitle.userCenter")})}),r.jsx(o,{onlyProfile:!0,currentTab:"",disableAutoRedirect:!0})]})}export{O as default};
@@ -1 +1 @@
1
- import{J as n,j as i,ak as l}from"./vendor-mui-core-CnXrAOs3.js";import{j as d,r as c}from"./vendor-react-Dvs43sk9.js";import{V as u,b as h}from"./vendor-ux-DtnxszG_.js";import g from"./index-BnLQoeO-.js";import"./vendor-utils-cJEl_UEd.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";import"./index-FASRIZyi.js";import"./vendor-arcblock-DVRwGBYP.js";import"./confirm-G3RZHlkC.js";import"./index-DBs9Ljax.js";import"./session-Chl38-LD.js";import"./did-address-CZak4Nzl.js";import"./empty-spinner-DYOzicuy.js";import"./bundle-avatar-DLTX9h1v.js";import"./shorten-label-RqvHqcC3.js";import"./list-header-BE2kzda_.js";import"./click-to-copy-C1mF6WNf.js";import"./question-mark-circle.svg-B4stD6SS.js";import"./useSetState-DFuQZPPV.js";import"./engine-9k0o50qZ.js";import"./api-Btn0Tp3W.js";import"./vendor-mui-x-bJ5idfMH.js";import"./react-beautiful-dnd.esm-sCK871VJ.js";import"./raf-schd.esm-CHNehTG3.js";import"./wait-connect-DDuMthnp.js";import"./get-safe-url-BFcRpP-P.js";import"./item-O0rUCXMz.js";import"./delete-confirm-DfQxKTw0.js";import"./index-DsXcQxrF.js";import"./index-De-Vgsb6.js";import"./index-D5TNmV3K.js";const r=new URL(window.location.href),s=r.searchParams.get("mode")==="dialog",w=s?"":r.searchParams.get("padding")||"";function T(){const{t:p}=u(),{componentDid:o}=d(),m=n(t=>t.breakpoints.down("md")),a=t=>{t.stopPropagation(),window.parent.postMessage({event:"resourceDialog.close",componentDid:o},"*")};c.useEffect(()=>{window.parent.postMessage({event:"resourceDialog.loaded",componentDid:o},"*")},[o]);const e=i.jsx(g,{padding:w,initUrl:r});return s?i.jsx(h,{className:"studio-dialog",title:p("blocklet.publish.blockletStudio"),maxWidth:!1,fullWidth:!1,PaperProps:{style:m?{width:"100%",height:window.innerHeight}:{maxWidth:1350,minWidth:930,width:"80%"}},onClose:a,showCloseButton:!0,disableEscapeKeyDown:!0,open:!0,children:i.jsx(l,{sx:{height:"72vh",overflow:"auto",position:"relative"},children:e})}):e}export{T as default};
1
+ import{J as n,j as i,ak as l}from"./vendor-mui-core-CnXrAOs3.js";import{j as d,r as c}from"./vendor-react-Dvs43sk9.js";import{V as u,b as h}from"./vendor-ux-DtnxszG_.js";import g from"./index-Tj-TQRdt.js";import"./vendor-utils-cJEl_UEd.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";import"./index-6LL6v88e.js";import"./vendor-arcblock-DVRwGBYP.js";import"./confirm-CCyde9UR.js";import"./index-DBs9Ljax.js";import"./session-C2VeP2Dn.js";import"./did-address-CZak4Nzl.js";import"./empty-spinner-DYOzicuy.js";import"./bundle-avatar-6vocOIEM.js";import"./shorten-label-RqvHqcC3.js";import"./list-header-BE2kzda_.js";import"./click-to-copy-C1mF6WNf.js";import"./question-mark-circle.svg-B4stD6SS.js";import"./useSetState-DFuQZPPV.js";import"./engine-CLurioHW.js";import"./api-Btn0Tp3W.js";import"./vendor-mui-x-bJ5idfMH.js";import"./react-beautiful-dnd.esm-sCK871VJ.js";import"./raf-schd.esm-CHNehTG3.js";import"./wait-connect-C4aP5_2A.js";import"./get-safe-url-D_AWm5Av.js";import"./item-CQ92uUPm.js";import"./delete-confirm-ByWYWBpJ.js";import"./index-DsXcQxrF.js";import"./index-De-Vgsb6.js";import"./index-D5TNmV3K.js";const r=new URL(window.location.href),s=r.searchParams.get("mode")==="dialog",w=s?"":r.searchParams.get("padding")||"";function T(){const{t:p}=u(),{componentDid:o}=d(),m=n(t=>t.breakpoints.down("md")),a=t=>{t.stopPropagation(),window.parent.postMessage({event:"resourceDialog.close",componentDid:o},"*")};c.useEffect(()=>{window.parent.postMessage({event:"resourceDialog.loaded",componentDid:o},"*")},[o]);const e=i.jsx(g,{padding:w,initUrl:r});return s?i.jsx(h,{className:"studio-dialog",title:p("blocklet.publish.blockletStudio"),maxWidth:!1,fullWidth:!1,PaperProps:{style:m?{width:"100%",height:window.innerHeight}:{maxWidth:1350,minWidth:930,width:"80%"}},onClose:a,showCloseButton:!0,disableEscapeKeyDown:!0,open:!0,children:i.jsx(l,{sx:{height:"72vh",overflow:"auto",position:"relative"},children:e})}):e}export{T as default};
@@ -1 +1 @@
1
- import{r as v}from"./vendor-react-Dvs43sk9.js";import{D as M,n as B,j as t,W as r,ak as h,T as b,c2 as k,at as T,am as $,c3 as O,c4 as q}from"./vendor-mui-core-CnXrAOs3.js";import{B as V,p as Z}from"./dashboard-DmRLgkA_.js";import{V as D,j as _,U as J,h as K}from"./vendor-ux-DtnxszG_.js";import{aC as w,aD as C,Z as Q,ab as N,e as f,aE as X}from"./index-FASRIZyi.js";import{W as Y}from"./vendor-utils-cJEl_UEd.js";import{x as P}from"./index-DRYJ0xIl.js";import{B as S}from"./base-chart-C-Raz4Q-.js";import{B as ee}from"./bundle-avatar-DLTX9h1v.js";import"./vendor-arcblock-DVRwGBYP.js";import"./vendor-hooks-CjESGRlR.js";import"./useLocalStorage-BIH12-5o.js";import"./index-DBs9Ljax.js";import"./confirm-G3RZHlkC.js";import"./get-safe-url-BFcRpP-P.js";import"./session-Chl38-LD.js";import"./team-Bje0MaMX.js";import"./isURL-2pkMgw7e.js";import"./use-app-logo-DhmCQsWv.js";import"./passport-C1l7yRXa.js";import"./create-passport-svg-_Jak4aT3.js";import"./useAsyncRetry-DwwEjrjs.js";import"./useAsync-cZ_FPf9k.js";import"./useSetState-DFuQZPPV.js";import"./index-CjkeMMBV.js";import"./over-due-invoice-payment-Bk50hmsa.js";import"./use-mobile-DCNBsOlH.js";import"./lottie-web-4koyQiv_.js";import"./index-NomqB6Iy.js";function U({title:i="",cpus:y=[],currentLoad:s=0,history:p=[],empty:l=null,onHover:u=()=>{},hoverIndex:a=null}){const{t:d,locale:x}=D(),e=M(),n=`${i||d("common.cpu")} (${Math.floor(s||0)}%)`,o=100,m=80,c=H=>`${H}%`,L=[{max:m,color:B(e.palette.primary.main,e.palette.mode==="dark"?.15:.08)},{min:m,max:100,color:B(e.palette.warning.main,e.palette.mode==="dark"?.18:.12)},{min:100,color:B(e.palette.error.main,e.palette.mode==="dark"?.25:.18)}],j={silent:!0,symbol:["none","none"],data:[{yAxis:100,lineStyle:{color:e.palette.error.main,type:"dashed",width:1.5},label:{formatter:`${c(100)}`,position:"insideEndTop",color:e.palette.text.secondary,padding:[2,4],borderRadius:2}},{yAxis:m,lineStyle:{color:e.palette.warning.light,type:"dashed",width:1.5},label:{formatter:`${c(m)}`,position:"insideEndTop",color:e.palette.text.secondary,padding:[2,4],borderRadius:2}}]},I=t.jsx("span",{children:`${d("system.cores")}: ${y?.length||0}`}),R=H=>w(Number(H),"HH:mm",x);return t.jsx(S,{title:n,total:o,history:p,valueFn:c,xAxisFormat:R,visualMapPieces:L,markLineData:j,extraInfo:I,empty:l,onHover:u,hoverIndex:a})}U.propTypes={title:r.string,cpus:r.array,currentLoad:r.number,history:r.array,empty:r.node,onHover:r.func,hoverIndex:r.number};function z({instanceCount:i=null,title:y="",total:s=null,used:p=null,history:l=[],empty:u=null,onHover:a=()=>{},hoverIndex:d=null}){const{t:x,locale:e}=D(),n=M(),o=!!s,m=s-p,c=o?`(${C(p)}, ${Math.floor(p/s*100)}%)`:"",L=`${y||x("common.memory")} ${c}`,j=Math.ceil(s*.8),I=g=>P(g,{short:!0,iec:!0}),R=[];i&&R.push({title:x("system.instances"),metric:i}),o&&R.push({title:x("system.free"),metric:I(m)});const H=[{max:j,color:B(n.palette.primary.main,n.palette.mode==="dark"?.15:.08)},{min:j,max:s,color:B(n.palette.warning.main,n.palette.mode==="dark"?.18:.12)},{min:s,color:B(n.palette.error.main,n.palette.mode==="dark"?.25:.18)}],F={silent:!0,symbol:["none","none"],data:[{yAxis:s,lineStyle:{color:n.palette.error.main,type:"dashed",width:1.5},label:{formatter:`${I(s)}`,position:"insideEndTop",color:n.palette.text.secondary,padding:[2,4],borderRadius:2}},{yAxis:j,lineStyle:{color:n.palette.warning.light,type:"dashed",width:1.5},label:{formatter:`${I(j)}`,position:"insideEndTop",color:n.palette.text.secondary,padding:[2,4],borderRadius:2}}]},A=t.jsx(t.Fragment,{children:R.map((g,G)=>t.jsxs(h,{sx:{marginLeft:G===0?0:1,display:"inline-flex"},children:[g.title,": ",g.metric]},g.title))}),W=g=>w(Number(g),"HH:mm",e);return t.jsx(S,{title:L,total:s,history:l,valueFn:I,xAxisFormat:W,visualMapPieces:H,markLineData:F,extraInfo:A,empty:u,onHover:a,hoverIndex:d})}z.propTypes={title:r.string,instanceCount:r.number,total:r.number,used:r.number,history:r.array,empty:r.node,onHover:r.func,hoverIndex:r.number};function E({blocklet:i,cpuHistory:y=[],memoryHistory:s=[],...p}){const{t:l}=D(),{info:u}=Q(),{runtimeHistory:a}=N(),[d,x]=v.useState(null),e=v.useCallback(o=>i.status!=="running"?t.jsx(b,{children:l("blocklet.runtimeInfo.noRunning")}):o.length?null:t.jsx(_,{children:l("common.empty")}),[i.status,l]),n=v.useCallback(o=>{x(o)},[]);return a.length===0?t.jsx(b,{children:l("blocklet.runtimeInfo.noRunning")}):t.jsxs(te,{component:"div",...p,memoryHistory:s,cpuHistory:y,children:[t.jsxs(k,{className:"page-metrics",container:!0,spacing:5,children:[t.jsx(k,{sx:{pt:"16px !important"},size:12,children:t.jsx(b,{sx:{fontSize:"16px",fontWeight:"bold"},children:"CPU"})}),a?.map(o=>t.jsx(k,{sx:{pt:"16px !important"},size:{lg:4,md:6,sm:6,xs:12},children:t.jsx(U,{title:`${o.name} CPU`,empty:e(o.cpu),currentLoad:o.appRuntimeInfo?.cpuUsage||0,cpus:o.appRuntimeInfo?.cpus||[],history:o.cpu,onHover:n,hoverIndex:d,style:{height:150}})},`${o.key}-cpu`))]}),t.jsxs(k,{className:"page-metrics",container:!0,spacing:5,sx:{mt:1},children:[t.jsx(k,{sx:{pt:"16px !important"},size:12,children:t.jsx(b,{sx:{fontSize:"16px",fontWeight:"bold"},children:"Memory"})}),a?.map(o=>t.jsx(k,{sx:{pt:"16px !important"},size:{lg:4,md:6,sm:6,xs:12},children:t.jsx(z,{title:`${o.name} Memory`,empty:e(o.memory),total:u.runtimeConfig?.blockletMaxMemoryLimit?P.parseSize(`${u.runtimeConfig.blockletMaxMemoryLimit*(o.key===i?.meta?.did?a.length-1:1)}MiB`):0,used:o.appRuntimeInfo?.memoryUsage||0,history:o.memory,onHover:n,hoverIndex:d,style:{height:150}})},`${o.key}-memory`))]})]})}E.propTypes={blocklet:r.object.isRequired,cpuHistory:r.arrayOf(r.shape({date:r.number,value:r.number})),memoryHistory:r.arrayOf(r.shape({date:r.number,value:r.number}))};const te=T(b)``;function we(){const{t:i,locale:y}=D(),[s,p]=v.useState(6),{blocklet:l,actions:{refreshBlocklet:u}}=N(),a=v.useMemo(()=>{const e=[];return f.forEachBlockletSync(l,(n,{ancestors:o,id:m,level:c})=>{n?.meta?.did&&n.meta.did!==l.meta.did&&e.push({type:"blocklet",groupId:l.meta.did,groupName:f.getDisplayName(l),id:m,name:f.getDisplayName(n,!0),blocklet:l,component:n,level:c-1>=0?c-1:0,runtimeInfo:n.runtimeInfo,ancestors:o})}),e},[l]);v.useEffect(()=>{u({hours:s});const e=setInterval(()=>{u({hours:s})},1e3*10);return()=>{clearInterval(e)}},[s]);const d=e=>Z(Number(e||0),{locale:X(y)}),x=[{label:i("common.name"),name:"name",options:{customBodyRenderLite(e){const{name:n,component:o,level:m,ancestors:c}=a[e];return t.jsxs(h,{sx:{display:"flex",alignItems:"center",pl:m*2},children:[t.jsx(ee,{size:20,blocklet:o,ancestors:c}),t.jsx(h,{sx:{ml:1},children:n}),t.jsx(V,{variant:"pin",style:{marginLeft:8},status:f.isBlockletRunning(o)?"running":o.status,source:o.source,progress:o.progress})]})}}},{label:i("common.uptime"),name:"runtimeInfo.uptime",options:{customBodyRenderLite(e){const{runtimeInfo:n,component:o}=a[e];return f.isBlockletRunning(o)?d(n?.uptime):t.jsx($,{title:i("common.noData"),children:"--"})}}},{label:i("blocklet.runtimeInfo.memoryUsage"),name:"runtimeInfo.memoryUsage",options:{customBodyRenderLite(e){const{runtimeInfo:n,component:o}=a[e];return f.isBlockletRunning(o)?C(n?.memoryUsage||0):t.jsx($,{title:i("common.noData"),children:"--"})}}},{label:i("blocklet.runtimeInfo.cpuUsage"),name:"runtimeInfo.cpuUsage",options:{customBodyRenderLite(e){const{runtimeInfo:n,component:o}=a[e];return f.isBlockletRunning(o)?`${(n?.cpuUsage||0).toFixed(1)}%`:t.jsx($,{title:i("common.noData"),children:"--"})}}},{label:i("analytics.runtime"),name:"runtimeInfo.runtime",options:{customBodyRenderLite(e){const{runtimeInfo:n}=a[e];return n?.uptime?t.jsxs(h,{sx:{display:"flex",alignItems:"center"},children:[t.jsx(J,{icon:n?.runningDocker?"catppuccin:docker-ignore":"logos:nodejs-icon"}),t.jsx(h,{sx:{ml:1},children:n?.runningDocker?"Docker":"Nodejs"})]}):null}}},{label:i("blocklet.runtimeInfo.processId"),name:"runtimeInfo.pid",options:{customBodyRenderLite(e){const{runtimeInfo:n,component:o}=a[e];return f.isBlockletRunning(o)?n?.pid:t.jsx($,{title:i("common.noData"),children:"--"})}}},{label:i("blocklet.runtimeInfo.port"),name:"runtimeInfo.port",options:{customBodyRenderLite(e){const{runtimeInfo:n,component:o}=a[e];return f.isBlockletRunning(o)?n?.port:t.jsx($,{title:i("common.noData"),children:"--"})}}}];return t.jsxs(ne,{component:"div",children:[t.jsxs(h,{sx:{display:"flex",justifyContent:"space-between",flexDirection:"row",mb:2},children:[t.jsx(b,{component:"h3",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:2},children:i("analytics.trend")}),t.jsx(O,{size:"small",exclusive:!0,value:s,onChange:(e,n)=>{Y(n)&&p(n)},children:[1,3,6,12,24].map(e=>t.jsxs(q,{value:e,children:[e,"H"]},e))})]}),t.jsx(h,{children:t.jsx(E,{blocklet:l})}),t.jsx(h,{sx:{mt:3},children:t.jsx(K,{title:i("analytics.detail"),className:"monitor-table",locale:y,data:a,columns:x,options:{search:!1,download:!1,filter:!1,print:!1,viewColumns:!1,pagination:!1,rowsPerPage:100}})})]})}const ne=T(b)``;export{we as default};
1
+ import{r as v}from"./vendor-react-Dvs43sk9.js";import{D as M,n as B,j as t,W as r,ak as h,T as b,c2 as k,at as T,am as $,c3 as O,c4 as _}from"./vendor-mui-core-CnXrAOs3.js";import{B as q,p as V}from"./dashboard-hUjcvjGc.js";import{V as D,j as J,U as K,h as Q}from"./vendor-ux-DtnxszG_.js";import{aD as w,aE as C,_ as X,ac as N,e as f,aF as Y}from"./index-6LL6v88e.js";import{W as Z}from"./vendor-utils-cJEl_UEd.js";import{x as P}from"./index-DRYJ0xIl.js";import{B as S}from"./base-chart-C-Raz4Q-.js";import{B as ee}from"./bundle-avatar-6vocOIEM.js";import"./vendor-arcblock-DVRwGBYP.js";import"./vendor-hooks-CjESGRlR.js";import"./useLocalStorage-BIH12-5o.js";import"./index-DBs9Ljax.js";import"./confirm-CCyde9UR.js";import"./get-safe-url-D_AWm5Av.js";import"./session-C2VeP2Dn.js";import"./team-DPdkokhk.js";import"./isURL-QYZ6DN-H.js";import"./use-app-logo-CmClyT44.js";import"./passport-SBkct7Jt.js";import"./create-passport-svg-_Jak4aT3.js";import"./useAsyncRetry-DwwEjrjs.js";import"./useAsync-cZ_FPf9k.js";import"./useSetState-DFuQZPPV.js";import"./index-z5QsHtdi.js";import"./over-due-invoice-payment-CsPpOI2s.js";import"./use-mobile-DCNBsOlH.js";import"./lottie-web-4koyQiv_.js";import"./index-NomqB6Iy.js";function U({title:i="",cpus:y=[],currentLoad:s=0,history:p=[],empty:l=null,onHover:u=()=>{},hoverIndex:a=null}){const{t:d,locale:x}=D(),e=M(),n=`${i||d("common.cpu")} (${Math.floor(s||0)}%)`,o=100,m=80,c=H=>`${H}%`,L=[{max:m,color:B(e.palette.primary.main,e.palette.mode==="dark"?.15:.08)},{min:m,max:100,color:B(e.palette.warning.main,e.palette.mode==="dark"?.18:.12)},{min:100,color:B(e.palette.error.main,e.palette.mode==="dark"?.25:.18)}],j={silent:!0,symbol:["none","none"],data:[{yAxis:100,lineStyle:{color:e.palette.error.main,type:"dashed",width:1.5},label:{formatter:`${c(100)}`,position:"insideEndTop",color:e.palette.text.secondary,padding:[2,4],borderRadius:2}},{yAxis:m,lineStyle:{color:e.palette.warning.light,type:"dashed",width:1.5},label:{formatter:`${c(m)}`,position:"insideEndTop",color:e.palette.text.secondary,padding:[2,4],borderRadius:2}}]},I=t.jsx("span",{children:`${d("system.cores")}: ${y?.length||0}`}),R=H=>w(Number(H),"HH:mm",x);return t.jsx(S,{title:n,total:o,history:p,valueFn:c,xAxisFormat:R,visualMapPieces:L,markLineData:j,extraInfo:I,empty:l,onHover:u,hoverIndex:a})}U.propTypes={title:r.string,cpus:r.array,currentLoad:r.number,history:r.array,empty:r.node,onHover:r.func,hoverIndex:r.number};function z({instanceCount:i=null,title:y="",total:s=null,used:p=null,history:l=[],empty:u=null,onHover:a=()=>{},hoverIndex:d=null}){const{t:x,locale:e}=D(),n=M(),o=!!s,m=s-p,c=o?`(${C(p)}, ${Math.floor(p/s*100)}%)`:"",L=`${y||x("common.memory")} ${c}`,j=Math.ceil(s*.8),I=g=>P(g,{short:!0,iec:!0}),R=[];i&&R.push({title:x("system.instances"),metric:i}),o&&R.push({title:x("system.free"),metric:I(m)});const H=[{max:j,color:B(n.palette.primary.main,n.palette.mode==="dark"?.15:.08)},{min:j,max:s,color:B(n.palette.warning.main,n.palette.mode==="dark"?.18:.12)},{min:s,color:B(n.palette.error.main,n.palette.mode==="dark"?.25:.18)}],F={silent:!0,symbol:["none","none"],data:[{yAxis:s,lineStyle:{color:n.palette.error.main,type:"dashed",width:1.5},label:{formatter:`${I(s)}`,position:"insideEndTop",color:n.palette.text.secondary,padding:[2,4],borderRadius:2}},{yAxis:j,lineStyle:{color:n.palette.warning.light,type:"dashed",width:1.5},label:{formatter:`${I(j)}`,position:"insideEndTop",color:n.palette.text.secondary,padding:[2,4],borderRadius:2}}]},A=t.jsx(t.Fragment,{children:R.map((g,G)=>t.jsxs(h,{sx:{marginLeft:G===0?0:1,display:"inline-flex"},children:[g.title,": ",g.metric]},g.title))}),W=g=>w(Number(g),"HH:mm",e);return t.jsx(S,{title:L,total:s,history:l,valueFn:I,xAxisFormat:W,visualMapPieces:H,markLineData:F,extraInfo:A,empty:u,onHover:a,hoverIndex:d})}z.propTypes={title:r.string,instanceCount:r.number,total:r.number,used:r.number,history:r.array,empty:r.node,onHover:r.func,hoverIndex:r.number};function E({blocklet:i,cpuHistory:y=[],memoryHistory:s=[],...p}){const{t:l}=D(),{info:u}=X(),{runtimeHistory:a}=N(),[d,x]=v.useState(null),e=v.useCallback(o=>i.status!=="running"?t.jsx(b,{children:l("blocklet.runtimeInfo.noRunning")}):o.length?null:t.jsx(J,{children:l("common.empty")}),[i.status,l]),n=v.useCallback(o=>{x(o)},[]);return a.length===0?t.jsx(b,{children:l("blocklet.runtimeInfo.noRunning")}):t.jsxs(te,{component:"div",...p,memoryHistory:s,cpuHistory:y,children:[t.jsxs(k,{className:"page-metrics",container:!0,spacing:5,children:[t.jsx(k,{sx:{pt:"16px !important"},size:12,children:t.jsx(b,{sx:{fontSize:"16px",fontWeight:"bold"},children:"CPU"})}),a?.map(o=>t.jsx(k,{sx:{pt:"16px !important"},size:{lg:4,md:6,sm:6,xs:12},children:t.jsx(U,{title:`${o.name} CPU`,empty:e(o.cpu),currentLoad:o.appRuntimeInfo?.cpuUsage||0,cpus:o.appRuntimeInfo?.cpus||[],history:o.cpu,onHover:n,hoverIndex:d,style:{height:150}})},`${o.key}-cpu`))]}),t.jsxs(k,{className:"page-metrics",container:!0,spacing:5,sx:{mt:1},children:[t.jsx(k,{sx:{pt:"16px !important"},size:12,children:t.jsx(b,{sx:{fontSize:"16px",fontWeight:"bold"},children:"Memory"})}),a?.map(o=>t.jsx(k,{sx:{pt:"16px !important"},size:{lg:4,md:6,sm:6,xs:12},children:t.jsx(z,{title:`${o.name} Memory`,empty:e(o.memory),total:u.runtimeConfig?.blockletMaxMemoryLimit?P.parseSize(`${u.runtimeConfig.blockletMaxMemoryLimit*(o.key===i?.meta?.did?a.length-1:1)}MiB`):0,used:o.appRuntimeInfo?.memoryUsage||0,history:o.memory,onHover:n,hoverIndex:d,style:{height:150}})},`${o.key}-memory`))]})]})}E.propTypes={blocklet:r.object.isRequired,cpuHistory:r.arrayOf(r.shape({date:r.number,value:r.number})),memoryHistory:r.arrayOf(r.shape({date:r.number,value:r.number}))};const te=T(b)``;function we(){const{t:i,locale:y}=D(),[s,p]=v.useState(6),{blocklet:l,actions:{refreshBlocklet:u}}=N(),a=v.useMemo(()=>{const e=[];return f.forEachBlockletSync(l,(n,{ancestors:o,id:m,level:c})=>{n?.meta?.did&&n.meta.did!==l.meta.did&&e.push({type:"blocklet",groupId:l.meta.did,groupName:f.getDisplayName(l),id:m,name:f.getDisplayName(n,!0),blocklet:l,component:n,level:c-1>=0?c-1:0,runtimeInfo:n.runtimeInfo,ancestors:o})}),e},[l]);v.useEffect(()=>{u({hours:s});const e=setInterval(()=>{u({hours:s})},1e3*10);return()=>{clearInterval(e)}},[s]);const d=e=>V(Number(e||0),{locale:Y(y)}),x=[{label:i("common.name"),name:"name",options:{customBodyRenderLite(e){const{name:n,component:o,level:m,ancestors:c}=a[e];return t.jsxs(h,{sx:{display:"flex",alignItems:"center",pl:m*2},children:[t.jsx(ee,{size:20,blocklet:o,ancestors:c}),t.jsx(h,{sx:{ml:1},children:n}),t.jsx(q,{variant:"pin",style:{marginLeft:8},status:f.isBlockletRunning(o)?"running":o.status,source:o.source,progress:o.progress})]})}}},{label:i("common.uptime"),name:"runtimeInfo.uptime",options:{customBodyRenderLite(e){const{runtimeInfo:n,component:o}=a[e];return f.isBlockletRunning(o)?d(n?.uptime):t.jsx($,{title:i("common.noData"),children:"--"})}}},{label:i("blocklet.runtimeInfo.memoryUsage"),name:"runtimeInfo.memoryUsage",options:{customBodyRenderLite(e){const{runtimeInfo:n,component:o}=a[e];return f.isBlockletRunning(o)?C(n?.memoryUsage||0):t.jsx($,{title:i("common.noData"),children:"--"})}}},{label:i("blocklet.runtimeInfo.cpuUsage"),name:"runtimeInfo.cpuUsage",options:{customBodyRenderLite(e){const{runtimeInfo:n,component:o}=a[e];return f.isBlockletRunning(o)?`${(n?.cpuUsage||0).toFixed(1)}%`:t.jsx($,{title:i("common.noData"),children:"--"})}}},{label:i("analytics.runtime"),name:"runtimeInfo.runtime",options:{customBodyRenderLite(e){const{runtimeInfo:n}=a[e];return n?.uptime?t.jsxs(h,{sx:{display:"flex",alignItems:"center"},children:[t.jsx(K,{icon:n?.runningDocker?"catppuccin:docker-ignore":"logos:nodejs-icon"}),t.jsx(h,{sx:{ml:1},children:n?.runningDocker?"Docker":"Nodejs"})]}):null}}},{label:i("blocklet.runtimeInfo.processId"),name:"runtimeInfo.pid",options:{customBodyRenderLite(e){const{runtimeInfo:n,component:o}=a[e];return f.isBlockletRunning(o)?n?.pid:t.jsx($,{title:i("common.noData"),children:"--"})}}},{label:i("blocklet.runtimeInfo.port"),name:"runtimeInfo.port",options:{customBodyRenderLite(e){const{runtimeInfo:n,component:o}=a[e];return f.isBlockletRunning(o)?n?.port:t.jsx($,{title:i("common.noData"),children:"--"})}}}];return t.jsxs(ne,{component:"div",children:[t.jsxs(h,{sx:{display:"flex",justifyContent:"space-between",flexDirection:"row",mb:2},children:[t.jsx(b,{component:"h3",variant:"h5",color:"textPrimary",style:{fontSize:18,fontWeight:"bold"},sx:{mb:2},children:i("analytics.trend")}),t.jsx(O,{size:"small",exclusive:!0,value:s,onChange:(e,n)=>{Z(n)&&p(n)},children:[1,3,6,12,24].map(e=>t.jsxs(_,{value:e,children:[e,"H"]},e))})]}),t.jsx(h,{children:t.jsx(E,{blocklet:l})}),t.jsx(h,{sx:{mt:3},children:t.jsx(Q,{title:i("analytics.detail"),className:"monitor-table",locale:y,data:a,columns:x,options:{search:!1,download:!1,filter:!1,print:!1,viewColumns:!1,pagination:!1,rowsPerPage:100}})})]})}const ne=T(b)``;export{we as default};
@@ -0,0 +1 @@
1
+ import{g as o}from"./index-6LL6v88e.js";const e=o();export{e as b};
@@ -1,12 +1,12 @@
1
- import{V as Z,U as O,p as ee,H as E,b as ae,n as de,h as ue,k as De}from"./vendor-ux-DtnxszG_.js";import{g as oe,k as K,b as w,a as me,h as ve}from"./vendor-hooks-CjESGRlR.js";import{r as k}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as P,am as q,I as N,bg as Y,W as v,D as te,z as _,A as We,Q as X,T as Fe,cP as Ne,cQ as Le,M as Ve,y as L,b5 as J,b6 as V,a5 as G,F as Me,U as Ue,b7 as Ze,a7 as $e,b9 as Xe,bq as ge,br as Ce,b1 as Ge,at as Ke}from"./vendor-mui-core-CnXrAOs3.js";import{ab as se,Z as re,c as T,av as fe,bd as Pe}from"./index-FASRIZyi.js";import{n as U,a1 as Q,Z as $,a2 as Ye,C as Je,G as be,a3 as ye,c as M,o as je}from"./vendor-utils-cJEl_UEd.js";import{u as pe,C as F}from"./index.esm-JPZAjt0x.js";import{S as le}from"./simple-select-DN_9r-L2.js";import{u as Se}from"./team-Bje0MaMX.js";import{l as Qe}from"./arrow-down.svg-D6V-7qfa.js";import{A as we}from"./config-BBtGnVxO.js";import{u as eo}from"./use-mobile-maRlSUwU.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DVRwGBYP.js";import"./session-Chl38-LD.js";import"./isURL-2pkMgw7e.js";import"./use-app-logo-DhmCQsWv.js";const oo={width:24,height:24,body:'<path fill="currentColor" d="M11 14.2V6q0-.425.288-.713T12 5q.425 0 .713.288T13 6v8.2l2.9-2.9q.275-.275.7-.275t.7.275q.275.275.275.7t-.275.7l-4.6 4.6q-.3.3-.7.3t-.7-.3l-4.6-4.6q-.275-.275-.275-.7t.275-.7q.275-.275.7-.275t.7.275l2.9 2.9Z"/>'},to={width:24,height:24,body:'<path fill="currentColor" d="m11 8.8l-2.9 2.9q-.275.275-.7.275t-.7-.275q-.275-.275-.275-.7t.275-.7l4.6-4.6q.3-.3.7-.3t.7.3l4.6 4.6q.275.275.275.7t-.275.7q-.275.275-.7.275t-.7-.275L13 8.8V17q0 .425-.288.713T12 18q-.425 0-.713-.288T11 17V8.8Z"/>'},he={width:24,height:24,body:'<path fill="currentColor" d="M7 21q-.825 0-1.413-.588T5 19V6q-.425 0-.713-.288T4 5q0-.425.288-.713T5 4h4q0-.425.288-.713T10 3h4q.425 0 .713.288T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6v13q0 .825-.588 1.413T17 21H7Zm2-4h2V8H9v9Zm4 0h2V8h-2v9Z"/>'},xe={width:24,height:24,body:'<path fill="currentColor" d="M4 21q-.425 0-.713-.288T3 20v-2.425q0-.4.15-.763t.425-.637L16.2 3.575q.3-.275.663-.425t.762-.15q.4 0 .775.15t.65.45L20.425 5q.3.275.437.65T21 6.4q0 .4-.138.763t-.437.662l-12.6 12.6q-.275.275-.638.425t-.762.15H4ZM17.6 7.8L19 6.4L17.6 5l-1.4 1.4l1.4 1.4Z"/>'};function He({enabled:o,showUp:t=!0,showDown:c=!0,showSwitch:n=!0,showDelete:s=!0,showEdit:i=!0,disableEdit:d=!1,disableSwitch:u=!1,onClickUp:l=()=>{},onClickDown:r=()=>{},onClickSwitch:f=()=>{},onClickDelete:h=()=>{},onClickEdit:H=()=>{}}){const{t:x}=Z();return e.jsxs(P,{sx:{display:"flex",alignItems:"center",gap:0},onClick:I=>I.stopPropagation(),children:[i?e.jsx(q,{title:x("common.edit"),children:e.jsx(N,{size:"small",onClick:H,color:"success",disabled:d,children:e.jsx(O,{icon:xe,fontSize:18})})}):null,s?e.jsx(q,{title:x("common.delete"),children:e.jsx(N,{size:"small",onClick:h,color:"error",children:e.jsx(O,{icon:he,fontSize:18})})}):null,n?e.jsx(q,{title:x(o?"common.enabled":"common.disabled"),children:e.jsx(Y,{size:"small",checked:o,onClick:f,disabled:u})}):null,t?e.jsx(q,{title:x("common.moveUp"),children:e.jsx(N,{size:"small",onClick:l,disabled:d,children:e.jsx(O,{icon:to,fontSize:20})})}):null,c?e.jsx(q,{title:x("common.moveDown"),children:e.jsx(N,{size:"small",onClick:r,disabled:d,children:e.jsx(O,{icon:oo,fontSize:20})})}):null]})}He.propTypes={enabled:v.bool.isRequired,showUp:v.bool,showDown:v.bool,showSwitch:v.bool,showDelete:v.bool,showEdit:v.bool,disableEdit:v.bool,disableSwitch:v.bool,onClickUp:v.func,onClickDown:v.func,onClickSwitch:v.func,onClickDelete:v.func,onClickEdit:v.func};function Re({ref:o=null}){const{t}=k.useContext(ee),{blocklet:c}=se(),{api:n}=re(),s=c?.meta?.did,d=te()?.transitions?.duration?.leavingScreen||300,u=oe({mode:"add",show:!1,isDefaultRule:!1,callback:U,get dialogTitle(){return this.mode==="edit"?t("securityRule.edit"):this.mode==="view"?t("securityRule.view"):t("securityRule.add")}}),l=K(async()=>{const{accessPolicies:y}=await n.getBlockletAccessPolicies({input:{did:s}});return Q(y,C=>C.isProtected?1:0)},{manual:!0}),r=K(async()=>{const{responseHeaderPolicies:y}=await n.getBlockletResponseHeaderPolicies({input:{did:s}});return Q(y,C=>C.isProtected?1:0)},{manual:!0}),{handleSubmit:f,control:h,watch:H,setValue:x,getValues:I,reset:B,formState:{errors:A}}=pe({mode:"onChange",defaultValues:{componentDid:"",pathPattern:"",responseHeaderPolicyId:"",accessPolicyId:"",remark:""}}),D=w(()=>{B(),u.mode="add"}),S=w(()=>{u.show=!1,setTimeout(()=>{D()},d)}),b=w((y,C=null)=>{u.show=!0,C&&(u.isDefaultRule=C.id===T.SECURITY_RULE_DEFAULT_ID,u.mode="edit",x("componentDid",C.componentDid),x("pathPattern",C.pathPattern),x("responseHeaderPolicyId",C.responseHeaderPolicyId),x("accessPolicyId",C.accessPolicyId),x("remark",C.remark||"")),y?u.callback=y:u.mode="view",l.run(),r.run()});k.useImperativeHandle(o,()=>({open:b,close:S}),[b,S]);const m=w(()=>{const[y,C]=I(["accessPolicyId","responseHeaderPolicyId"]);return!y&&!C?t("securityRule.form.accessPolicyOrResponseHeaderPolicyRequired"):!0}),a=w(y=>{const C=m();if(C===!0){const ne=u.isDefaultRule?$(y,"componentDid"):y;u.callback(ne,S)}else E.error(C)}),j=H("componentDid"),z=w(y=>{const C=y?.trim();if(!C)return t("common.requiredErrorText",{name:t("securityRule.form.pathPattern")});if(j){if(C.startsWith("/"))return t("securityRule.form.pathPatternErrorText")}else if(!C.startsWith("/")&&C!=="*")return t("securityRule.form.pathPatternErrorText");return!0}),p=w(y=>y?.trim()?!0:t("common.requiredErrorText",{name:t("securityRule.form.accessPolicy")})),g=w(y=>y?.trim()?!0:t("common.requiredErrorText",{name:t("securityRule.form.responseHeaderPolicy")})),R=me(()=>{const C=(c?.children||[]).find(ne=>ne.meta.did===j);return C?.mountPoint?Ye(C.mountPoint):null},[c,j]);return e.jsx(ae,{open:u.show,title:u.dialogTitle,onClose:S,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(de,{color:"primary",autoFocus:!0,variant:"contained",onClick:f(a),children:t("common.confirm")}),children:e.jsxs("form",{noValidate:!0,autoComplete:"off",children:[u.isDefaultRule?null:e.jsx(F,{name:"componentDid",control:h,render:({field:y})=>e.jsx(le,{fullWidth:!0,margin:"dense",size:"small",label:t("securityRule.form.component"),placeholer:t("securityRule.form.componentPlaceholder"),options:c.children.map(C=>({title:C.meta.title,value:C.meta.did,description:C.mountPoint})),error:!!A?.componentDid?.message,helperText:A?.componentDid?.message||"Choose belong to component",...$(y,"ref"),readOnly:u.mode==="view"})}),e.jsx(F,{name:"pathPattern",control:h,rules:{validate:z},render:({field:y})=>e.jsx(_,{fullWidth:!0,required:!0,margin:"dense",size:"small",placeholder:t("securityRule.form.pathPatternPlaceholder"),label:t("securityRule.form.pathPattern"),error:!!A?.pathPattern?.message,helperText:A?.pathPattern?.message||"/abc/bcd or /abc or /abc/*",...y,disabled:u.isDefaultRule||u.mode==="view",slotProps:{input:{startAdornment:R?e.jsx(We,{position:"start",children:R}):null}}})}),e.jsx(F,{name:"accessPolicyId",control:h,rules:{validate:u.isDefaultRule?p:U},render:({field:y})=>e.jsx(le,{fullWidth:!0,required:u.isDefaultRule,margin:"dense",size:"small",label:t("securityRule.form.accessPolicy"),placeholer:t("securityRule.form.accessPolicyPlaceholder"),options:(l.data||[]).map(C=>({value:C.id,title:C.name,description:C.description})),error:!!A?.accessPolicyId?.message,helperText:A?.accessPolicyId?.message||t("securityRule.form.accessPolicyHelperText"),...$(y,"ref"),disabled:u.mode==="view"})}),e.jsx(F,{name:"responseHeaderPolicyId",control:h,rules:{validate:u.isDefaultRule?g:U},render:({field:y})=>e.jsx(le,{fullWidth:!0,required:u.isDefaultRule,margin:"dense",size:"small",label:t("securityRule.form.responseHeaderPolicy"),placeholer:t("securityRule.form.responseHeaderPolicyPlaceholder"),options:(r.data||[]).map(C=>({title:C.name,value:C.id,description:C.description})),error:!!A?.responseHeaderPolicyId?.message,helperText:A?.responseHeaderPolicyId?.message||t("securityRule.form.responseHeaderPolicyHelperText"),...$(y,"ref"),disabled:u.mode==="view"})}),e.jsx(F,{name:"remark",control:h,render:({field:y})=>e.jsx(_,{fullWidth:!0,multiline:!0,minRows:3,maxRows:7,size:"small",margin:"dense",placeholder:t("securityRule.form.remarkPlaceholder"),label:t("securityRule.form.remark"),helperText:A?.message,...y,disabled:u.mode==="view"})})]})})}Re.propTypes={ref:v.any};const W=async(o,t="Failed to saved")=>{try{await o()}catch(c){E.error(c?.message||t)}};function so(){const{t:o,locale:t}=Z(),{blocklet:c}=se(),{api:n}=re(),s=c?.meta?.did,i=te(),d=k.useRef(null),u=k.useRef(null),{confirmApi:l,confirmHolder:r}=fe(),f=K(async()=>{const{securityRules:p}=await n.getBlockletSecurityRules({input:{did:s,includeDisabled:!0}});return p}),h=p=>p.id===T.SECURITY_RULE_DEFAULT_ID,H=w(p=>(c?.children||[]).find(R=>R.meta.did===p)?.mountPoint),x=(f.data||[]).map(p=>{if(p.componentDid){const g=H(p.componentDid);p._disabled=g===void 0}return p}),I=x.filter(p=>!h(p)),B=(p,g)=>{W(async()=>{const R=p.target.checked;await n.updateBlockletSecurityRule({input:{did:s,data:{id:g.id,enabled:R}}}),E.success(o("common.succeeded")),f.run()})},A=(p,g,R)=>{W(async()=>{const y=R-1,C=x[y];await Promise.all([n.updateBlockletSecurityRule({input:{did:s,data:{id:g.id,priority:C.priority}}}),n.updateBlockletSecurityRule({input:{did:s,data:{id:C.id,priority:g.priority}}})]),E.success(o("common.succeeded")),f.run()})},D=(p,g,R)=>{W(async()=>{const y=R+1,C=x[y];await Promise.all([n.updateBlockletSecurityRule({input:{did:s,data:{id:g.id,priority:C.priority}}}),n.updateBlockletSecurityRule({input:{did:s,data:{id:C.id,priority:g.priority}}})]),E.success(o("common.succeeded")),f.run()})},S=()=>{d.current.open((p,g)=>{W(async()=>{await n.addBlockletSecurityRule({input:{did:s,data:p}}),E.success(o("common.succeeded")),f.run(),g()})})},b=(p,g)=>{d.current.open((R,y)=>{W(async()=>{await n.updateBlockletSecurityRule({input:{did:s,data:{...R,id:g.id}}}),E.success(o("common.succeeded")),f.run(),y()})},g)},m=(p,g)=>{l.open({title:o("securityRule.delete.title"),content:o("securityRule.delete.description"),confirmButtonText:o("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:o("common.cancel"),onConfirm(R){W(async()=>{await n.deleteBlockletSecurityRule({input:{did:s,id:g.id}}),E.success(o("common.succeeded")),f.run(),R()})}})},a={sort:!1,download:!1,filter:!1,print:!1,search:!1,viewColumns:!1,expandableRowsOnClick:!0,searchDebounceTime:600,onRowClick(p,{dataIndex:g},R){if(u.current?.contains(R.target)){const y=x[g];d.current.open(void 0,y)}},setRowProps:(p,g)=>x[g]._disabled?{title:o("securityRule.useless"),style:{backgroundColor:i.palette.action.disabledBackground,cursor:"default"}}:{}},j=[e.jsx(X,{size:"small",variant:"outlined",onClick:()=>{f.run()},sx:{mr:1},children:o("common.refresh")},"refresh"),e.jsx(X,{size:"small",variant:"contained",onClick:S,children:o("common.add")})],z=[{label:o("securityRule.form.pathPattern"),name:"pathPattern",options:{customBodyRenderLite(p){const g=x[p];return e.jsx(P,{sx:{whiteSpace:"nowrap"},children:g.id===T.SECURITY_RULE_DEFAULT_ID?"Default":Je(H(g.componentDid),g.pathPattern)})}}},{label:o("responseHeaderPolicy.title"),name:"responseHeaderPolicy",options:{customBodyRenderLite(p){return x[p].responseHeaderPolicy?.name}}},{label:o("accessPolicy.title"),name:"accessPolicyId",options:{customBodyRenderLite(p){return x[p].accessPolicy?.name}}},{label:o("securityRule.form.remark"),name:"remark"},{label:o("common.actions"),name:"",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite(p){const g=x[p],R=h(g);return e.jsx(He,{disableEdit:g._disabled,disableSwitch:g._disabled,enabled:g.enabled,showSwitch:!R,showDelete:!R,showUp:p>0&&!R,showDown:p<I.length-1&&!R,onClickSwitch:y=>{B(y,g)},onClickUp:y=>{A(y,g,p)},onClickDown:y=>{D(y,g,p)},onClickEdit:y=>{b(y,g)},onClickDelete:y=>{m(y,g)}})}}}].filter(Boolean);return e.jsxs(P,{sx:{display:"flex",flexDirection:"column",gap:2},ref:u,children:[e.jsx(ue,{verticalKeyWidth:100,locale:t,title:e.jsxs(P,{sx:{display:"flex",alignItems:"center",gap:1},children:[o("securityRule.title")," ",e.jsx(Fe,{variant:"body2",children:o("securityRule.sortByDescription")})]}),data:x,columns:z,customButtons:j,options:a,loading:f.loading}),e.jsx(Re,{ref:d}),r]})}const Te={width:24,height:24,body:'<path fill="currentColor" d="M5 21q-.825 0-1.413-.588T3 19V5q0-.825.588-1.413T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.588 1.413T19 21H5Zm0-2h14V7H5v12Zm7-2q-2.05 0-3.663-1.113T6 13q.725-1.775 2.337-2.888T12 9q2.05 0 3.663 1.113T18 13q-.725 1.775-2.337 2.888T12 17Zm0-2.5q-.625 0-1.063-.438T10.5 13q0-.625.438-1.063T12 11.5q.625 0 1.063.438T13.5 13q0 .625-.438 1.063T12 14.5Zm0 1q1.05 0 1.775-.725T14.5 13q0-1.05-.725-1.775T12 10.5q-1.05 0-1.775.725T9.5 13q0 1.05.725 1.775T12 15.5Z"/>'};function ke({value:o,onChange:t,...c}){const n="roles",s="roles_reverse",{t:i,locale:d}=Z(),u=[...we,{value:n,icon:Ne,title:{zh:"指定通行证可访问",en:"Accessible to selected passports"},description:{zh:"只有指定的通行证可以访问",en:"Only specified passports can access"}},{value:s,icon:Le,title:{zh:"指定通行证不可以访问",en:"Accessible to not selected passports"},description:{zh:"只有指定的通行证不可以访问",en:"Only specified passports can't access"}}];return e.jsx(_,{...c,label:i("blocklet.config.access.description"),select:!0,fullWidth:!0,value:o,onChange:t,sx:{"& .MuiInputBase-input":{width:"calc(100% - 46px)","& > .MuiBox-root:first-of-type":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},slotProps:{select:{renderValue:l=>{const r=u.find(f=>f.value===l);return r?e.jsxs(P,{children:[e.jsx(P,{component:r.icon,sx:{mr:1,fontSize:18,verticalAlign:"text-bottom",color:"text.secondary"}}),r.title[d]||r.title.en]}):null},IconComponent:l=>e.jsx(Qe,{...l,width:20,height:20})}},children:u.map(l=>e.jsxs(Ve,{value:l.value,sx:{display:"block","& .tip":{fontSize:"12px",color:`${({theme:r})=>r.palette.text.secondary}`}},children:[e.jsxs(P,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(P,{component:l.icon,sx:{mr:1,fontSize:18,verticalAlign:"text-bottom",color:"text.secondary"}}),e.jsx(P,{children:l.title[d]||l.title.en})]}),e.jsx(P,{className:"tip",children:l.description[d]||l.description.en})]}))})}ke.propTypes={value:v.string,onChange:v.func};const Ae=o=>{const t={name:o.name,description:o.description},{roles:c=null,reverse:n}=o;return c===null?n===!1&&(t.whoCanAccess=T.WHO_CAN_ACCESS.ALL,t.roles=null):c.length===0&&n===!0?(t.whoCanAccess=T.WHO_CAN_ACCESS.INVITED,t.roles=[]):ye(c,[T.WHO_CAN_ACCESS.OWNER])&&n===!1?(t.whoCanAccess=T.WHO_CAN_ACCESS.OWNER,t.roles=[T.WHO_CAN_ACCESS.OWNER]):ye(c,[T.WHO_CAN_ACCESS.OWNER,T.WHO_CAN_ACCESS.ADMIN])&&n===!1?(t.whoCanAccess=T.WHO_CAN_ACCESS.ADMIN,t.roles=[T.WHO_CAN_ACCESS.OWNER,T.WHO_CAN_ACCESS.ADMIN]):(t.whoCanAccess=n?"roles_reverse":"roles",t.roles=c),t},ro=o=>{const t={name:o.name,description:o.description},{roles:c=null,whoCanAccess:n}=o;return n==="roles"?(t.roles=c,t.reverse=!1):n==="roles_reverse"?(t.roles=c,t.reverse=!0):n===T.WHO_CAN_ACCESS.ALL?(t.roles=null,t.reverse=!1):n===T.WHO_CAN_ACCESS.INVITED?(t.roles=[],t.reverse=!0):n===T.WHO_CAN_ACCESS.OWNER?(t.roles=[T.WHO_CAN_ACCESS.OWNER],t.reverse=!1):n===T.WHO_CAN_ACCESS.ADMIN&&(t.roles=[T.WHO_CAN_ACCESS.OWNER,T.WHO_CAN_ACCESS.ADMIN],t.reverse=!1),t},no=o=>o instanceof Object?{origin:o.origin?{override:o.origin?.override??!0,value:o.origin?.value?.join(`
1
+ import{V as Z,U as O,p as ee,H as E,b as ae,n as de,h as ue,k as De}from"./vendor-ux-DtnxszG_.js";import{g as oe,k as K,b as w,a as me,h as ge}from"./vendor-hooks-CjESGRlR.js";import{r as k}from"./vendor-react-Dvs43sk9.js";import{j as e,ak as P,am as q,I as N,bg as Y,W as g,D as te,z as _,A as We,Q as X,T as Fe,cP as Ne,cQ as Le,M as Ve,y as L,b5 as J,b6 as V,a5 as G,F as Me,U as Ue,b7 as Ze,a7 as $e,b9 as Xe,bq as ve,br as Ce,b1 as Ge,at as Ke}from"./vendor-mui-core-CnXrAOs3.js";import{ac as se,_ as re,c as T,aw as fe,be as Pe}from"./index-6LL6v88e.js";import{n as U,a1 as Q,Z as $,a2 as Ye,C as Je,G as be,a3 as ye,c as M,o as je}from"./vendor-utils-cJEl_UEd.js";import{u as pe,C as F}from"./index.esm-JPZAjt0x.js";import{S as le}from"./simple-select-nZbZu-H6.js";import{u as Se}from"./team-DPdkokhk.js";import{l as Qe}from"./arrow-down.svg-MODRFVx5.js";import{A as we}from"./config-CWk35jzL.js";import{u as eo}from"./use-mobile-maRlSUwU.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-DVRwGBYP.js";import"./session-C2VeP2Dn.js";import"./isURL-QYZ6DN-H.js";import"./use-app-logo-CmClyT44.js";const oo={width:24,height:24,body:'<path fill="currentColor" d="M11 14.2V6q0-.425.288-.713T12 5q.425 0 .713.288T13 6v8.2l2.9-2.9q.275-.275.7-.275t.7.275q.275.275.275.7t-.275.7l-4.6 4.6q-.3.3-.7.3t-.7-.3l-4.6-4.6q-.275-.275-.275-.7t.275-.7q.275-.275.7-.275t.7.275l2.9 2.9Z"/>'},to={width:24,height:24,body:'<path fill="currentColor" d="m11 8.8l-2.9 2.9q-.275.275-.7.275t-.7-.275q-.275-.275-.275-.7t.275-.7l4.6-4.6q.3-.3.7-.3t.7.3l4.6 4.6q.275.275.275.7t-.275.7q-.275.275-.7.275t-.7-.275L13 8.8V17q0 .425-.288.713T12 18q-.425 0-.713-.288T11 17V8.8Z"/>'},he={width:24,height:24,body:'<path fill="currentColor" d="M7 21q-.825 0-1.413-.588T5 19V6q-.425 0-.713-.288T4 5q0-.425.288-.713T5 4h4q0-.425.288-.713T10 3h4q.425 0 .713.288T15 4h4q.425 0 .713.288T20 5q0 .425-.288.713T19 6v13q0 .825-.588 1.413T17 21H7Zm2-4h2V8H9v9Zm4 0h2V8h-2v9Z"/>'},xe={width:24,height:24,body:'<path fill="currentColor" d="M4 21q-.425 0-.713-.288T3 20v-2.425q0-.4.15-.763t.425-.637L16.2 3.575q.3-.275.663-.425t.762-.15q.4 0 .775.15t.65.45L20.425 5q.3.275.437.65T21 6.4q0 .4-.138.763t-.437.662l-12.6 12.6q-.275.275-.638.425t-.762.15H4ZM17.6 7.8L19 6.4L17.6 5l-1.4 1.4l1.4 1.4Z"/>'};function He({enabled:o,showUp:t=!0,showDown:c=!0,showSwitch:n=!0,showDelete:s=!0,showEdit:i=!0,disableEdit:d=!1,disableSwitch:u=!1,onClickUp:l=()=>{},onClickDown:r=()=>{},onClickSwitch:f=()=>{},onClickDelete:h=()=>{},onClickEdit:H=()=>{}}){const{t:x}=Z();return e.jsxs(P,{sx:{display:"flex",alignItems:"center",gap:0},onClick:I=>I.stopPropagation(),children:[i?e.jsx(q,{title:x("common.edit"),children:e.jsx(N,{size:"small",onClick:H,color:"success",disabled:d,children:e.jsx(O,{icon:xe,fontSize:18})})}):null,s?e.jsx(q,{title:x("common.delete"),children:e.jsx(N,{size:"small",onClick:h,color:"error",children:e.jsx(O,{icon:he,fontSize:18})})}):null,n?e.jsx(q,{title:x(o?"common.enabled":"common.disabled"),children:e.jsx(Y,{size:"small",checked:o,onClick:f,disabled:u})}):null,t?e.jsx(q,{title:x("common.moveUp"),children:e.jsx(N,{size:"small",onClick:l,disabled:d,children:e.jsx(O,{icon:to,fontSize:20})})}):null,c?e.jsx(q,{title:x("common.moveDown"),children:e.jsx(N,{size:"small",onClick:r,disabled:d,children:e.jsx(O,{icon:oo,fontSize:20})})}):null]})}He.propTypes={enabled:g.bool.isRequired,showUp:g.bool,showDown:g.bool,showSwitch:g.bool,showDelete:g.bool,showEdit:g.bool,disableEdit:g.bool,disableSwitch:g.bool,onClickUp:g.func,onClickDown:g.func,onClickSwitch:g.func,onClickDelete:g.func,onClickEdit:g.func};function Re({ref:o=null}){const{t}=k.useContext(ee),{blocklet:c}=se(),{api:n}=re(),s=c?.meta?.did,d=te()?.transitions?.duration?.leavingScreen||300,u=oe({mode:"add",show:!1,isDefaultRule:!1,callback:U,get dialogTitle(){return this.mode==="edit"?t("securityRule.edit"):this.mode==="view"?t("securityRule.view"):t("securityRule.add")}}),l=K(async()=>{const{accessPolicies:y}=await n.getBlockletAccessPolicies({input:{did:s}});return Q(y,C=>C.isProtected?1:0)},{manual:!0}),r=K(async()=>{const{responseHeaderPolicies:y}=await n.getBlockletResponseHeaderPolicies({input:{did:s}});return Q(y,C=>C.isProtected?1:0)},{manual:!0}),{handleSubmit:f,control:h,watch:H,setValue:x,getValues:I,reset:B,formState:{errors:A}}=pe({mode:"onChange",defaultValues:{componentDid:"",pathPattern:"",responseHeaderPolicyId:"",accessPolicyId:"",remark:""}}),D=w(()=>{B(),u.mode="add"}),S=w(()=>{u.show=!1,setTimeout(()=>{D()},d)}),b=w((y,C=null)=>{u.show=!0,C&&(u.isDefaultRule=C.id===T.SECURITY_RULE_DEFAULT_ID,u.mode="edit",x("componentDid",C.componentDid),x("pathPattern",C.pathPattern),x("responseHeaderPolicyId",C.responseHeaderPolicyId),x("accessPolicyId",C.accessPolicyId),x("remark",C.remark||"")),y?u.callback=y:u.mode="view",l.run(),r.run()});k.useImperativeHandle(o,()=>({open:b,close:S}),[b,S]);const m=w(()=>{const[y,C]=I(["accessPolicyId","responseHeaderPolicyId"]);return!y&&!C?t("securityRule.form.accessPolicyOrResponseHeaderPolicyRequired"):!0}),a=w(y=>{const C=m();if(C===!0){const ne=u.isDefaultRule?$(y,"componentDid"):y;u.callback(ne,S)}else E.error(C)}),j=H("componentDid"),z=w(y=>{const C=y?.trim();if(!C)return t("common.requiredErrorText",{name:t("securityRule.form.pathPattern")});if(j){if(C.startsWith("/"))return t("securityRule.form.pathPatternErrorText")}else if(!C.startsWith("/")&&C!=="*")return t("securityRule.form.pathPatternErrorText");return!0}),p=w(y=>y?.trim()?!0:t("common.requiredErrorText",{name:t("securityRule.form.accessPolicy")})),v=w(y=>y?.trim()?!0:t("common.requiredErrorText",{name:t("securityRule.form.responseHeaderPolicy")})),R=me(()=>{const C=(c?.children||[]).find(ne=>ne.meta.did===j);return C?.mountPoint?Ye(C.mountPoint):null},[c,j]);return e.jsx(ae,{open:u.show,title:u.dialogTitle,onClose:S,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(de,{color:"primary",autoFocus:!0,variant:"contained",onClick:f(a),children:t("common.confirm")}),children:e.jsxs("form",{noValidate:!0,autoComplete:"off",children:[u.isDefaultRule?null:e.jsx(F,{name:"componentDid",control:h,render:({field:y})=>e.jsx(le,{fullWidth:!0,margin:"dense",size:"small",label:t("securityRule.form.component"),placeholer:t("securityRule.form.componentPlaceholder"),options:c.children.map(C=>({title:C.meta.title,value:C.meta.did,description:C.mountPoint})),error:!!A?.componentDid?.message,helperText:A?.componentDid?.message||"Choose belong to component",...$(y,"ref"),readOnly:u.mode==="view"})}),e.jsx(F,{name:"pathPattern",control:h,rules:{validate:z},render:({field:y})=>e.jsx(_,{fullWidth:!0,required:!0,margin:"dense",size:"small",placeholder:t("securityRule.form.pathPatternPlaceholder"),label:t("securityRule.form.pathPattern"),error:!!A?.pathPattern?.message,helperText:A?.pathPattern?.message||"/abc/bcd or /abc or /abc/*",...y,disabled:u.isDefaultRule||u.mode==="view",slotProps:{input:{startAdornment:R?e.jsx(We,{position:"start",children:R}):null}}})}),e.jsx(F,{name:"accessPolicyId",control:h,rules:{validate:u.isDefaultRule?p:U},render:({field:y})=>e.jsx(le,{fullWidth:!0,required:u.isDefaultRule,margin:"dense",size:"small",label:t("securityRule.form.accessPolicy"),placeholer:t("securityRule.form.accessPolicyPlaceholder"),options:(l.data||[]).map(C=>({value:C.id,title:C.name,description:C.description})),error:!!A?.accessPolicyId?.message,helperText:A?.accessPolicyId?.message||t("securityRule.form.accessPolicyHelperText"),...$(y,"ref"),disabled:u.mode==="view"})}),e.jsx(F,{name:"responseHeaderPolicyId",control:h,rules:{validate:u.isDefaultRule?v:U},render:({field:y})=>e.jsx(le,{fullWidth:!0,required:u.isDefaultRule,margin:"dense",size:"small",label:t("securityRule.form.responseHeaderPolicy"),placeholer:t("securityRule.form.responseHeaderPolicyPlaceholder"),options:(r.data||[]).map(C=>({title:C.name,value:C.id,description:C.description})),error:!!A?.responseHeaderPolicyId?.message,helperText:A?.responseHeaderPolicyId?.message||t("securityRule.form.responseHeaderPolicyHelperText"),...$(y,"ref"),disabled:u.mode==="view"})}),e.jsx(F,{name:"remark",control:h,render:({field:y})=>e.jsx(_,{fullWidth:!0,multiline:!0,minRows:3,maxRows:7,size:"small",margin:"dense",placeholder:t("securityRule.form.remarkPlaceholder"),label:t("securityRule.form.remark"),helperText:A?.message,...y,disabled:u.mode==="view"})})]})})}Re.propTypes={ref:g.any};const W=async(o,t="Failed to saved")=>{try{await o()}catch(c){E.error(c?.message||t)}};function so(){const{t:o,locale:t}=Z(),{blocklet:c}=se(),{api:n}=re(),s=c?.meta?.did,i=te(),d=k.useRef(null),u=k.useRef(null),{confirmApi:l,confirmHolder:r}=fe(),f=K(async()=>{const{securityRules:p}=await n.getBlockletSecurityRules({input:{did:s,includeDisabled:!0}});return p}),h=p=>p.id===T.SECURITY_RULE_DEFAULT_ID,H=w(p=>(c?.children||[]).find(R=>R.meta.did===p)?.mountPoint),x=(f.data||[]).map(p=>{if(p.componentDid){const v=H(p.componentDid);p._disabled=v===void 0}return p}),I=x.filter(p=>!h(p)),B=(p,v)=>{W(async()=>{const R=p.target.checked;await n.updateBlockletSecurityRule({input:{did:s,data:{id:v.id,enabled:R}}}),E.success(o("common.succeeded")),f.run()})},A=(p,v,R)=>{W(async()=>{const y=R-1,C=x[y];await Promise.all([n.updateBlockletSecurityRule({input:{did:s,data:{id:v.id,priority:C.priority}}}),n.updateBlockletSecurityRule({input:{did:s,data:{id:C.id,priority:v.priority}}})]),E.success(o("common.succeeded")),f.run()})},D=(p,v,R)=>{W(async()=>{const y=R+1,C=x[y];await Promise.all([n.updateBlockletSecurityRule({input:{did:s,data:{id:v.id,priority:C.priority}}}),n.updateBlockletSecurityRule({input:{did:s,data:{id:C.id,priority:v.priority}}})]),E.success(o("common.succeeded")),f.run()})},S=()=>{d.current.open((p,v)=>{W(async()=>{await n.addBlockletSecurityRule({input:{did:s,data:p}}),E.success(o("common.succeeded")),f.run(),v()})})},b=(p,v)=>{d.current.open((R,y)=>{W(async()=>{await n.updateBlockletSecurityRule({input:{did:s,data:{...R,id:v.id}}}),E.success(o("common.succeeded")),f.run(),y()})},v)},m=(p,v)=>{l.open({title:o("securityRule.delete.title"),content:o("securityRule.delete.description"),confirmButtonText:o("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:o("common.cancel"),onConfirm(R){W(async()=>{await n.deleteBlockletSecurityRule({input:{did:s,id:v.id}}),E.success(o("common.succeeded")),f.run(),R()})}})},a={sort:!1,download:!1,filter:!1,print:!1,search:!1,viewColumns:!1,expandableRowsOnClick:!0,searchDebounceTime:600,onRowClick(p,{dataIndex:v},R){if(u.current?.contains(R.target)){const y=x[v];d.current.open(void 0,y)}},setRowProps:(p,v)=>x[v]._disabled?{title:o("securityRule.useless"),style:{backgroundColor:i.palette.action.disabledBackground,cursor:"default"}}:{}},j=[e.jsx(X,{size:"small",variant:"outlined",onClick:()=>{f.run()},sx:{mr:1},children:o("common.refresh")},"refresh"),e.jsx(X,{size:"small",variant:"contained",onClick:S,children:o("common.add")})],z=[{label:o("securityRule.form.pathPattern"),name:"pathPattern",options:{customBodyRenderLite(p){const v=x[p];return e.jsx(P,{sx:{whiteSpace:"nowrap"},children:v.id===T.SECURITY_RULE_DEFAULT_ID?"Default":Je(H(v.componentDid),v.pathPattern)})}}},{label:o("responseHeaderPolicy.title"),name:"responseHeaderPolicy",options:{customBodyRenderLite(p){return x[p].responseHeaderPolicy?.name}}},{label:o("accessPolicy.title"),name:"accessPolicyId",options:{customBodyRenderLite(p){return x[p].accessPolicy?.name}}},{label:o("securityRule.form.remark"),name:"remark"},{label:o("common.actions"),name:"",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite(p){const v=x[p],R=h(v);return e.jsx(He,{disableEdit:v._disabled,disableSwitch:v._disabled,enabled:v.enabled,showSwitch:!R,showDelete:!R,showUp:p>0&&!R,showDown:p<I.length-1&&!R,onClickSwitch:y=>{B(y,v)},onClickUp:y=>{A(y,v,p)},onClickDown:y=>{D(y,v,p)},onClickEdit:y=>{b(y,v)},onClickDelete:y=>{m(y,v)}})}}}].filter(Boolean);return e.jsxs(P,{sx:{display:"flex",flexDirection:"column",gap:2},ref:u,children:[e.jsx(ue,{verticalKeyWidth:100,locale:t,title:e.jsxs(P,{sx:{display:"flex",alignItems:"center",gap:1},children:[o("securityRule.title")," ",e.jsx(Fe,{variant:"body2",children:o("securityRule.sortByDescription")})]}),data:x,columns:z,customButtons:j,options:a,loading:f.loading}),e.jsx(Re,{ref:d}),r]})}const Te={width:24,height:24,body:'<path fill="currentColor" d="M5 21q-.825 0-1.413-.588T3 19V5q0-.825.588-1.413T5 3h14q.825 0 1.413.588T21 5v14q0 .825-.588 1.413T19 21H5Zm0-2h14V7H5v12Zm7-2q-2.05 0-3.663-1.113T6 13q.725-1.775 2.337-2.888T12 9q2.05 0 3.663 1.113T18 13q-.725 1.775-2.337 2.888T12 17Zm0-2.5q-.625 0-1.063-.438T10.5 13q0-.625.438-1.063T12 11.5q.625 0 1.063.438T13.5 13q0 .625-.438 1.063T12 14.5Zm0 1q1.05 0 1.775-.725T14.5 13q0-1.05-.725-1.775T12 10.5q-1.05 0-1.775.725T9.5 13q0 1.05.725 1.775T12 15.5Z"/>'};function ke({value:o,onChange:t,...c}){const n="roles",s="roles_reverse",{t:i,locale:d}=Z(),u=[...we,{value:n,icon:Ne,title:{zh:"指定通行证可访问",en:"Accessible to selected passports"},description:{zh:"只有指定的通行证可以访问",en:"Only specified passports can access"}},{value:s,icon:Le,title:{zh:"指定通行证不可以访问",en:"Accessible to not selected passports"},description:{zh:"只有指定的通行证不可以访问",en:"Only specified passports can't access"}}];return e.jsx(_,{...c,label:i("blocklet.config.access.description"),select:!0,fullWidth:!0,value:o,onChange:t,sx:{"& .MuiInputBase-input":{width:"calc(100% - 46px)","& > .MuiBox-root:first-of-type":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},slotProps:{select:{renderValue:l=>{const r=u.find(f=>f.value===l);return r?e.jsxs(P,{children:[e.jsx(P,{component:r.icon,sx:{mr:1,fontSize:18,verticalAlign:"text-bottom",color:"text.secondary"}}),r.title[d]||r.title.en]}):null},IconComponent:l=>e.jsx(Qe,{...l,width:20,height:20})}},children:u.map(l=>e.jsxs(Ve,{value:l.value,sx:{display:"block","& .tip":{fontSize:"12px",color:`${({theme:r})=>r.palette.text.secondary}`}},children:[e.jsxs(P,{sx:{display:"flex",alignItems:"center"},children:[e.jsx(P,{component:l.icon,sx:{mr:1,fontSize:18,verticalAlign:"text-bottom",color:"text.secondary"}}),e.jsx(P,{children:l.title[d]||l.title.en})]}),e.jsx(P,{className:"tip",children:l.description[d]||l.description.en})]}))})}ke.propTypes={value:g.string,onChange:g.func};const Ae=o=>{const t={name:o.name,description:o.description},{roles:c=null,reverse:n}=o;return c===null?n===!1&&(t.whoCanAccess=T.WHO_CAN_ACCESS.ALL,t.roles=null):c.length===0&&n===!0?(t.whoCanAccess=T.WHO_CAN_ACCESS.INVITED,t.roles=[]):ye(c,[T.WHO_CAN_ACCESS.OWNER])&&n===!1?(t.whoCanAccess=T.WHO_CAN_ACCESS.OWNER,t.roles=[T.WHO_CAN_ACCESS.OWNER]):ye(c,[T.WHO_CAN_ACCESS.OWNER,T.WHO_CAN_ACCESS.ADMIN])&&n===!1?(t.whoCanAccess=T.WHO_CAN_ACCESS.ADMIN,t.roles=[T.WHO_CAN_ACCESS.OWNER,T.WHO_CAN_ACCESS.ADMIN]):(t.whoCanAccess=n?"roles_reverse":"roles",t.roles=c),t},ro=o=>{const t={name:o.name,description:o.description},{roles:c=null,whoCanAccess:n}=o;return n==="roles"?(t.roles=c,t.reverse=!1):n==="roles_reverse"?(t.roles=c,t.reverse=!0):n===T.WHO_CAN_ACCESS.ALL?(t.roles=null,t.reverse=!1):n===T.WHO_CAN_ACCESS.INVITED?(t.roles=[],t.reverse=!0):n===T.WHO_CAN_ACCESS.OWNER?(t.roles=[T.WHO_CAN_ACCESS.OWNER],t.reverse=!1):n===T.WHO_CAN_ACCESS.ADMIN&&(t.roles=[T.WHO_CAN_ACCESS.OWNER,T.WHO_CAN_ACCESS.ADMIN],t.reverse=!1),t},no=o=>o instanceof Object?{origin:o.origin?{override:o.origin?.override??!0,value:o.origin?.value?.join(`
2
2
  `),smart:o.origin?.smart??!0}:void 0,methods:o.methods,allowedHeaders:o.allowedHeaders?{override:o.allowedHeaders?.override??!0,value:o.allowedHeaders?.value?.join(`
3
3
  `)}:void 0,exposedHeaders:o.exposedHeaders?{override:o.exposedHeaders?.override??!0,value:o.exposedHeaders?.value?.join(`
4
4
  `)}:void 0,maxAge:o.maxAge,optionsSuccessStatus:o.optionsSuccessStatus,preflightContinue:o.preflightContinue,credentials:o.credentials}:void 0,lo=o=>o instanceof Object?{origin:{override:o.origin?.override,value:o.origin?.value?.split(`
5
5
  `).filter(c=>c),smart:o.origin?.smart},methods:o.methods,allowedHeaders:{override:o.allowedHeaders?.override,value:o.allowedHeaders?.value?.split(`
6
6
  `).filter(c=>c)},exposedHeaders:{override:o.exposedHeaders?.override,value:o.exposedHeaders?.value?.split(`
7
- `).filter(c=>c)},maxAge:o.maxAge,optionsSuccessStatus:o.optionsSuccessStatus,preflightContinue:o.preflightContinue,credentials:o.credentials}:void 0,io=o=>o instanceof Object?{contentSecurityPolicy:o.contentSecurityPolicy,referrerPolicy:o.referrerPolicy,xFrameOptions:o.xFrameOptions,xPoweredBy:o.xPoweredBy,xXssProtection:o.xXssProtection}:void 0,co=o=>o instanceof Object?{contentSecurityPolicy:o.contentSecurityPolicy,referrerPolicy:o.referrerPolicy,xFrameOptions:o.xFrameOptions,xPoweredBy:o.xPoweredBy,xXssProtection:o.xXssProtection}:void 0,ao=o=>{const t=be(o);if(o.securityHeader)try{t.securityHeader=JSON.parse(o.securityHeader)}catch{t.securityHeader=null}if(o.cors)try{t.cors=JSON.parse(o.cors)}catch{t.cors=null}return t};function qe({ref:o=null}){const{t}=k.useContext(ee),{roles:c}=Se(),s=te()?.transitions?.duration?.leavingScreen||300,i=oe({mode:"add",show:!1,callback:U,get dialogTitle(){return this.mode==="edit"?t("accessPolicy.edit"):this.mode==="view"?t("accessPolicy.view"):t("accessPolicy.add")}}),{handleSubmit:d,control:u,watch:l,setValue:r,reset:f,formState:{errors:h}}=pe({mode:"onChange",defaultValues:{name:"",description:"",roles:null,whoCanAccess:"all"}}),H=w(()=>{f(),i.mode="add"}),x=w(()=>{i.show=!1,setTimeout(()=>{H()},s)}),I=w((a=U,j=null)=>{if(i.callback=a,i.show=!0,j){j.id?i.mode="edit":i.mode="view";const z=Ae(j);r("name",z.name),r("description",z.description),r("roles",z.roles),r("whoCanAccess",z.whoCanAccess)}});k.useImperativeHandle(o,()=>({open:I,close:x}),[I,x]);const B=w(a=>{i.callback(ro(a),x)}),A=w(a=>a?.trim()?!0:t("common.requiredErrorText",{name:t("accessPolicy.form.name")})),D=l("whoCanAccess"),S=i.mode==="view",b=w(a=>["roles","roles_reverse"].includes(D)&&(!a||a?.length===0)?t("common.requiredErrorText",{name:t("accessPolicy.form.roles")}):!0),m=w(a=>a?.trim()?!0:t("common.requiredErrorText",{name:t("accessPolicy.form.accessType")}));return e.jsx(ae,{open:i.show,title:i.dialogTitle,onClose:x,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(de,{color:"primary",autoFocus:!0,variant:"contained",onClick:d(B),children:t("common.confirm")}),children:e.jsxs("form",{noValidate:!0,autoComplete:"off",children:[e.jsx(F,{name:"name",control:u,rules:{validate:A},render:({field:a})=>e.jsx(_,{fullWidth:!0,required:!0,margin:"dense",size:"small",disabled:S,placeholder:t("accessPolicy.form.namePlaceholder"),label:t("accessPolicy.form.name"),error:!!h?.name?.message,helperText:h?.name?.message||" ",...a})}),e.jsx(F,{name:"whoCanAccess",control:u,rules:{validate:m},render:({field:a})=>e.jsx(ke,{required:!0,size:"small",margin:"dense",disabled:S,error:!!h?.whoCanAccess?.message,helperText:h?.whoCanAccess?.message||" ",...a})}),["roles","roles_reverse"].includes(D)?e.jsx(F,{name:"roles",rules:{validate:b},control:u,render:({field:a})=>e.jsxs(L,{variant:"standard",error:!!h?.roles?.message,children:[e.jsx(J,{sx:{display:"flex",flexDirection:"row",mt:-3},children:c.map(j=>e.jsx(V,{control:e.jsx(G,{disabled:S,size:"small",checked:a.value?.includes(j.name),sx:{p:.75},onChange:(z,p)=>{const g=a.value||[];p?a.onChange([...g,j.name]):a.onChange(g.filter(R=>R!==j.name))}}),label:j.title},j.name))}),e.jsx(Me,{sx:{transform:"translateY(-8px)"},children:h?.roles?.message||" "})]})}):null,e.jsx(F,{name:"description",control:u,render:({field:a})=>e.jsx(_,{fullWidth:!0,multiline:!0,disabled:S,minRows:3,maxRows:7,margin:"dense",size:"small",placeholder:t("accessPolicy.form.descriptionPlaceholder"),label:t("accessPolicy.form.description"),helperText:h?.message,...a})})]})})}qe.propTypes={ref:v.any};function uo(){const{t:o,locale:t}=Z(),{blocklet:c}=se(),{api:n}=re(),{roles:s}=Se(),i=c?.meta?.did,d=k.useRef(null),u=k.useRef(null),{confirmApi:l,confirmHolder:r}=fe(),f=()=>{},h=K(async()=>{const{accessPolicies:m}=await n.getBlockletAccessPolicies({input:{did:i}});return Q(m,a=>a.isProtected?1:0)}),H=h.data||[],x=w(()=>{u.current.open((m,a)=>{W(async()=>{await n.addBlockletAccessPolicy({input:{did:i,data:m}}),E.success(o("common.succeeded")),h.run(),a()})})}),I=w(m=>{u.current.open((a,j)=>{W(async()=>{await n.updateBlockletAccessPolicy({input:{did:i,data:{...a,id:m.id}}}),E.success(o("common.succeeded")),h.run(),j()})},m)}),B=w(m=>{u.current.open((a,j)=>{j()},$(m,["id"]))}),A=w(m=>{l.open({title:o("accessPolicy.delete.title"),content:o("accessPolicy.delete.description"),confirmButtonText:o("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:o("common.cancel"),onConfirm(a){W(async()=>{await n.deleteBlockletAccessPolicy({input:{did:i,id:m.id}}),E.success(o("common.succeeded")),h.run(),a()})}})}),D={sort:!1,download:!1,filter:!1,print:!1,search:!1,viewColumns:!1,expandableRowsOnClick:!0,searchDebounceTime:600,onRowClick(m,{dataIndex:a},j){if(d.current?.contains(j.target)){const z=H[a];B(z)}}},S=[e.jsx(X,{size:"small",variant:"outlined",onClick:()=>{h.run()},sx:{mr:1},children:o("common.refresh")},"refresh"),e.jsx(X,{size:"small",variant:"contained",onClick:x,children:o("common.add")})],b=[{label:o("accessPolicy.form.name"),name:"name",options:{customBodyRenderLite(m){const a=H[m],j=a.isProtected?e.jsx(q,{title:"Built-in policy, can't edit",children:e.jsx(P,{component:O,icon:Pe,sx:{fontSize:16}})}):null;return e.jsxs(P,{sx:{display:"flex",alignItems:"center",gap:.5},children:[j," ",a.name]})}}},{label:o("accessPolicy.form.roles"),name:"roles",options:{customBodyRenderLite(m){const a=H[m],j=Ae(a);if([T.WHO_CAN_ACCESS.ALL,T.WHO_CAN_ACCESS.INVITED].includes(j.whoCanAccess)){const p=we.find(g=>g.value===j.whoCanAccess);return p.title?.[t]||p.title?.en}const z=s.filter(p=>a.reverse?!j.roles?.includes(p.name):j.roles?.includes(p.name));return e.jsx(P,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:z.map(p=>e.jsx(q,{title:p.description,children:e.jsx(Ue,{size:"small",label:p.title},p.name)}))})}}},{label:o("accessPolicy.form.description"),name:"description"},{label:o("common.actions"),name:"",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite(m){const a=H[m];return e.jsxs(P,{sx:{display:"flex",alignItems:"center",gap:0},onClick:j=>j.stopPropagation(),children:[a.isProtected?e.jsx(q,{title:o("common.view"),children:e.jsx(N,{size:"small",onClick:()=>{B(a,m)},children:e.jsx(O,{icon:Te,fontSize:18})})}):null,a.isProtected?null:e.jsx(q,{title:o("common.edit"),children:e.jsx(N,{size:"small",onClick:()=>{I(a,m)},color:"success",children:e.jsx(O,{icon:xe,fontSize:18})})}),a.isProtected?null:e.jsx(q,{title:o("common.delete"),children:e.jsx(N,{size:"small",onClick:()=>{A(a,m)},color:"error",children:e.jsx(O,{icon:he,fontSize:18})})})]})}}}].filter(Boolean);return e.jsxs(P,{sx:{display:"flex",flexDirection:"column",gap:2},ref:d,children:[e.jsx(ue,{verticalKeyWidth:100,locale:t,title:o("accessPolicy.title"),data:H,columns:b,customButtons:S,options:D,loading:h.loading,onChange:f}),e.jsx(qe,{ref:u}),r]})}const mo={width:24,height:24,body:'<path fill="currentColor" d="m12 15.375l-6-6l1.4-1.4l4.6 4.6l4.6-4.6l1.4 1.4l-6 6Z"/>'};function ie({title:o,actions:t,children:c=null,defaultValue:n=!0,value:s,onChange:i,showExpand:d=!0}){const u=!M(s),l=oe({open:n}),r=me(()=>u?s:l.open,[s,u,l.open]),f=w(()=>{u?i(!r):l.open=!l.open});return e.jsxs(Ze,{variant:"outlined",children:[e.jsxs(P,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",px:2,py:1,backgroundColor:"grey.50"},onClick:f,children:[e.jsx(P,{sx:{fontWeight:"bold"},children:o}),e.jsxs(P,{sx:{display:"flex",alignItems:"center"},children:[t,d?e.jsx(P,{component:O,icon:mo,sx:{transform:r?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease",fontSize:"2rem"}}):null]})]}),e.jsx($e,{in:r,children:e.jsx(Xe,{children:c})})]})}ie.propTypes={title:v.string.isRequired,defaultValue:v.bool,value:v.bool,actions:v.node,children:v.node,onChange:v.func,showExpand:v.bool};const ce={width:24,height:24,body:'<path fill="currentColor" d="M11.95 18q.525 0 .888-.363t.362-.887q0-.525-.362-.888t-.888-.362q-.525 0-.887.363t-.363.887q0 .525.363.888t.887.362Zm.05 4q-2.075 0-3.9-.788t-3.175-2.137q-1.35-1.35-2.137-3.175T2 12q0-2.075.788-3.9t2.137-3.175q1.35-1.35 3.175-2.137T12 2q2.075 0 3.9.788t3.175 2.137q1.35 1.35 2.138 3.175T22 12q0 2.075-.788 3.9t-2.137 3.175q-1.35 1.35-3.175 2.138T12 22Zm0-2q3.35 0 5.675-2.325T20 12q0-3.35-2.325-5.675T12 4Q8.65 4 6.325 6.325T4 12q0 3.35 2.325 5.675T12 20Zm0-8Zm.1-4.3q.625 0 1.088.4t.462 1q0 .55-.337.975t-.763.8q-.575.5-1.012 1.1t-.438 1.35q0 .35.263.588t.612.237q.375 0 .638-.25t.337-.625q.1-.525.45-.938t.75-.787q.575-.55.988-1.2t.412-1.45q0-1.275-1.038-2.087T12.1 6q-.95 0-1.812.4T8.975 7.625q-.175.3-.113.638t.338.512q.35.2.725.125t.625-.425q.275-.375.688-.575t.862-.2Z"/>'};function Ie({config:o={},onChange:t=()=>{},disabled:c=!1}){const n=["GET","HEAD","POST","PUT","DELETE","OPTIONS","PATCH"],s={origin:{override:!1,value:"*",smart:!0},methods:{override:!1,value:[...n]},allowedHeaders:{override:!1,value:"*"},exposedHeaders:{override:!1,value:"*"},maxAge:{override:!1,value:void 0},optionsSuccessStatus:{override:!1,value:204},preflightContinue:{override:!1,value:!1},credentials:{override:!1,value:!1},...je(o,M)},{t:i}=Z(),d=(r,{override:f,value:h,smart:H})=>{const x={...s?.[r]};!M(H)&&r==="origin"&&(x.smart=H),M(f)||(x.override=f),M(h)||(x.value=h),t({...s,[r]:x})},u=[{title:i("responseHeaderPolicy.form.cors.origin"),override:s.origin.override,smart:s.origin.smart,name:"origin",required:!0,value:s.origin.value,content:e.jsx(L,{fullWidth:!0,sx:{mt:.75,"& .MuiFormHelperText-root":{mx:0}},children:e.jsx(_,{multiline:!0,minRows:4,maxRows:10,disabled:c,variant:"outlined",size:"small",placeholder:i("responseHeaderPolicy.form.cors.originPlaceholder"),helperText:i("responseHeaderPolicy.form.cors.originHelperText"),value:s.origin.value,onChange:r=>{d("origin",{value:r.target.value})}})})},{title:i("responseHeaderPolicy.form.cors.methods"),name:"methods",override:s.methods.override,required:!0,value:s.methods.value,content:e.jsx(J,{sx:{flexDirection:"row"},children:n.map(r=>e.jsx(V,{control:e.jsx(G,{size:"small",disabled:c,checked:s.methods.value.includes(r),onChange:(f,h)=>{d("methods",{value:h?[...s.methods.value,r]:s.methods.value.filter(H=>H!==r)})}}),label:r},r))})},{title:i("responseHeaderPolicy.form.cors.allowedHeaders"),override:s.allowedHeaders.override,name:"allowedHeaders",value:s.allowedHeaders.value,content:e.jsx(L,{fullWidth:!0,sx:{mt:.75,"& .MuiFormHelperText-root":{mx:0}},children:e.jsx(_,{multiline:!0,minRows:3,maxRows:7,disabled:c,variant:"outlined",size:"small",placeholder:i("responseHeaderPolicy.form.cors.allowedHeadersPlaceholder"),helperText:i("responseHeaderPolicy.form.cors.allowedHeadersHelperText"),value:s.allowedHeaders.value,onChange:r=>{d("allowedHeaders",{value:r.target.value})}})})},{title:i("responseHeaderPolicy.form.cors.exposedHeaders"),override:s.exposedHeaders.override,name:"exposedHeaders",value:s.exposedHeaders.value,content:e.jsx(L,{fullWidth:!0,sx:{mt:.75,"& .MuiFormHelperText-root":{mx:0}},children:e.jsx(_,{multiline:!0,minRows:3,maxRows:7,disabled:c,variant:"outlined",size:"small",placeholder:i("responseHeaderPolicy.form.cors.exposedHeadersPlaceholder"),helperText:i("responseHeaderPolicy.form.cors.exposedHeadersHelperText"),value:s.exposedHeaders.value,onChange:r=>{d("exposedHeaders",{value:r.target.value})}})})},{title:i("responseHeaderPolicy.form.cors.maxAge"),override:s.maxAge.override,name:"maxAge",value:s.maxAge.value,content:e.jsx(L,{fullWidth:!0,sx:{mt:.75,"& .MuiFormHelperText-root":{mx:0}},children:e.jsx(_,{type:"number",variant:"outlined",size:"small",disabled:c,value:s.maxAge.value,onChange:r=>{d("maxAge",{value:r.target.value})},helperText:i("responseHeaderPolicy.form.cors.maxAgeHelperText")})})},{title:i("responseHeaderPolicy.form.cors.optionsSuccessStatus"),override:s.optionsSuccessStatus.override,name:"optionsSuccessStatus",value:s.optionsSuccessStatus.value,content:e.jsx(L,{fullWidth:!0,sx:{mt:.75,"& .MuiFormHelperText-root":{mx:0}},children:e.jsx(_,{type:"number",variant:"outlined",size:"small",disabled:c,value:s.optionsSuccessStatus.value,onChange:r=>{d("optionsSuccessStatus",{value:r.target.value})}})})},{title:i("responseHeaderPolicy.form.cors.preflightContinue"),override:s.preflightContinue.override,name:"preflightContinue",value:s.preflightContinue.value,control:e.jsx(Y,{size:"small",disabled:c,checked:s.preflightContinue.value,onChange:(r,f)=>{d("preflightContinue",{value:f})}})},{title:i("responseHeaderPolicy.form.cors.credentials"),override:s.credentials.override,name:"credentials",value:s.credentials.value,control:e.jsx(Y,{size:"small",disabled:c,checked:s.credentials.value,onChange:(r,f)=>{d("credentials",{value:f})}})}];ve(()=>{t(s)});const l={".PrivateSwitchBase-input+svg":{fontSize:"1rem"},".MuiCheckbox-sizeSmall":{p:.75},".MuiFormControlLabel-label":{fontSize:"0.8rem"}};return e.jsx(J,{children:u.map((r,f)=>e.jsxs(k.Fragment,{children:[e.jsxs(P,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(V,{sx:{mt:f===0?0:1},control:r.control||e.jsx(P,{sx:{pl:1.35}}),label:r.title,required:r.required},`${r.name}_form`),e.jsxs(P,{children:[r.name==="origin"?e.jsx(V,{control:e.jsx(G,{size:"small",checked:r.smart,color:"primary",disabled:c,onChange:()=>{d(r.name,{smart:!r.smart})}}),label:e.jsxs(e.Fragment,{children:[i("responseHeaderPolicy.form.cors.smartMode"),e.jsx(q,{title:i("responseHeaderPolicy.form.cors.smartModeHelperText"),children:e.jsx(P,{component:O,icon:ce,sx:{cursor:"pointer",color:"grey",ml:.5,fontSize:"1.1em"}})})]}),sx:l},`${r.name}_smart`):null,e.jsx(V,{control:e.jsx(G,{size:"small",checked:r.override,color:"warning",disabled:c,onChange:()=>{d(r.name,{override:!r.override})}}),label:e.jsxs(e.Fragment,{children:[i("responseHeaderPolicy.form.originOverride"),e.jsx(q,{title:i("responseHeaderPolicy.form.originOverrideHelperText"),children:e.jsx(P,{component:O,icon:ce,sx:{cursor:"pointer",color:"grey",ml:.5,fontSize:"1.1em"}})})]}),sx:{...l,mr:0}},`${r.name}_override`)]})]}),r.content?e.jsx(P,{sx:{ml:3.5},children:r.content},`${r.name}_content`):null]},r.name))})}Ie.propTypes={config:v.object,onChange:v.func,disabled:v.bool};function Oe({value:o,onChange:t=()=>{},disabled:c=!1}){const n="sameorigin",s=[{label:"DENY",value:"deny"},{label:"SAMEORIGIN (default)",value:"sameorigin"}],i=d=>{t({action:d.target.value})};return k.useEffect(()=>{o===!0&&t({action:n})},[o]),e.jsx(P,{children:e.jsx(L,{children:e.jsx(ge,{row:!0,children:s.map(d=>e.jsx(V,{value:d.value,control:e.jsx(Ce,{size:"small",disabled:c,checked:d.value===o?.action,onChange:i,sx:{p:.75}}),label:d.label},d.value))})})})}Oe.propTypes={value:v.oneOfType([v.string,v.bool]).isRequired,onChange:v.func,disabled:v.bool};function Be({value:o,onChange:t=()=>{},disabled:c=!1}){const n="strict-origin-when-cross-origin",s=[{label:"no-referrer",value:"no-referrer"},{label:"no-referrer-when-downgrade",value:"no-referrer-when-downgrade"},{label:"origin",value:"origin"},{label:"origin-when-cross-origin",value:"origin-when-cross-origin"},{label:"same-origin",value:"same-origin"},{label:"strict-origin",value:"strict-origin"},{label:"strict-origin-when-cross-origin (default)",value:"strict-origin-when-cross-origin"},{label:"unsafe-url",value:"unsafe-url"}],i=d=>{t({policy:d.target.value})};return k.useEffect(()=>{o===!0&&t({policy:n})},[o]),e.jsx(P,{children:e.jsx(L,{children:e.jsx(ge,{children:s.map(d=>e.jsx(V,{value:d.value,control:e.jsx(Ce,{size:"small",disabled:c,checked:d.value===o?.policy,onChange:i,sx:{p:.75}}),label:d.label},d.value))})})})}Be.propTypes={value:v.oneOfType([v.string,v.bool]).isRequired,onChange:v.func,disabled:v.func};function Ee({value:o,onChange:t=()=>{},disabled:c=!1}){const n={"default-src":["'self'"],"base-uri":["'self'"],"font-src":["'self'","https:","data:"],"form-action":["'self'"],"frame-ancestors":["'self'"],"img-src":["'self'","data:"],"object-src":["'none'"],"script-src":["'self'"],"script-src-attr":["'none'"],"style-src":["'self'","https:","'unsafe-inline'"],"upgrade-insecure-requests":[]};function s(r){return Object.keys(r).map(f=>[f,r[f].filter(Boolean).join(" ")].filter(Boolean).join(" ")).filter(Boolean).join(`
7
+ `).filter(c=>c)},maxAge:o.maxAge,optionsSuccessStatus:o.optionsSuccessStatus,preflightContinue:o.preflightContinue,credentials:o.credentials}:void 0,io=o=>o instanceof Object?{contentSecurityPolicy:o.contentSecurityPolicy,referrerPolicy:o.referrerPolicy,xFrameOptions:o.xFrameOptions,xPoweredBy:o.xPoweredBy,xXssProtection:o.xXssProtection}:void 0,co=o=>o instanceof Object?{contentSecurityPolicy:o.contentSecurityPolicy,referrerPolicy:o.referrerPolicy,xFrameOptions:o.xFrameOptions,xPoweredBy:o.xPoweredBy,xXssProtection:o.xXssProtection}:void 0,ao=o=>{const t=be(o);if(o.securityHeader)try{t.securityHeader=JSON.parse(o.securityHeader)}catch{t.securityHeader=null}if(o.cors)try{t.cors=JSON.parse(o.cors)}catch{t.cors=null}return t};function qe({ref:o=null}){const{t}=k.useContext(ee),{roles:c}=Se(),s=te()?.transitions?.duration?.leavingScreen||300,i=oe({mode:"add",show:!1,callback:U,get dialogTitle(){return this.mode==="edit"?t("accessPolicy.edit"):this.mode==="view"?t("accessPolicy.view"):t("accessPolicy.add")}}),{handleSubmit:d,control:u,watch:l,setValue:r,reset:f,formState:{errors:h}}=pe({mode:"onChange",defaultValues:{name:"",description:"",roles:null,whoCanAccess:"all"}}),H=w(()=>{f(),i.mode="add"}),x=w(()=>{i.show=!1,setTimeout(()=>{H()},s)}),I=w((a=U,j=null)=>{if(i.callback=a,i.show=!0,j){j.id?i.mode="edit":i.mode="view";const z=Ae(j);r("name",z.name),r("description",z.description),r("roles",z.roles),r("whoCanAccess",z.whoCanAccess)}});k.useImperativeHandle(o,()=>({open:I,close:x}),[I,x]);const B=w(a=>{i.callback(ro(a),x)}),A=w(a=>a?.trim()?!0:t("common.requiredErrorText",{name:t("accessPolicy.form.name")})),D=l("whoCanAccess"),S=i.mode==="view",b=w(a=>["roles","roles_reverse"].includes(D)&&(!a||a?.length===0)?t("common.requiredErrorText",{name:t("accessPolicy.form.roles")}):!0),m=w(a=>a?.trim()?!0:t("common.requiredErrorText",{name:t("accessPolicy.form.accessType")}));return e.jsx(ae,{open:i.show,title:i.dialogTitle,onClose:x,PaperProps:{style:{minHeight:"unset"}},actions:e.jsx(de,{color:"primary",autoFocus:!0,variant:"contained",onClick:d(B),children:t("common.confirm")}),children:e.jsxs("form",{noValidate:!0,autoComplete:"off",children:[e.jsx(F,{name:"name",control:u,rules:{validate:A},render:({field:a})=>e.jsx(_,{fullWidth:!0,required:!0,margin:"dense",size:"small",disabled:S,placeholder:t("accessPolicy.form.namePlaceholder"),label:t("accessPolicy.form.name"),error:!!h?.name?.message,helperText:h?.name?.message||" ",...a})}),e.jsx(F,{name:"whoCanAccess",control:u,rules:{validate:m},render:({field:a})=>e.jsx(ke,{required:!0,size:"small",margin:"dense",disabled:S,error:!!h?.whoCanAccess?.message,helperText:h?.whoCanAccess?.message||" ",...a})}),["roles","roles_reverse"].includes(D)?e.jsx(F,{name:"roles",rules:{validate:b},control:u,render:({field:a})=>e.jsxs(L,{variant:"standard",error:!!h?.roles?.message,children:[e.jsx(J,{sx:{display:"flex",flexDirection:"row",mt:-3},children:c.map(j=>e.jsx(V,{control:e.jsx(G,{disabled:S,size:"small",checked:a.value?.includes(j.name),sx:{p:.75},onChange:(z,p)=>{const v=a.value||[];p?a.onChange([...v,j.name]):a.onChange(v.filter(R=>R!==j.name))}}),label:j.title},j.name))}),e.jsx(Me,{sx:{transform:"translateY(-8px)"},children:h?.roles?.message||" "})]})}):null,e.jsx(F,{name:"description",control:u,render:({field:a})=>e.jsx(_,{fullWidth:!0,multiline:!0,disabled:S,minRows:3,maxRows:7,margin:"dense",size:"small",placeholder:t("accessPolicy.form.descriptionPlaceholder"),label:t("accessPolicy.form.description"),helperText:h?.message,...a})})]})})}qe.propTypes={ref:g.any};function uo(){const{t:o,locale:t}=Z(),{blocklet:c}=se(),{api:n}=re(),{roles:s}=Se(),i=c?.meta?.did,d=k.useRef(null),u=k.useRef(null),{confirmApi:l,confirmHolder:r}=fe(),f=()=>{},h=K(async()=>{const{accessPolicies:m}=await n.getBlockletAccessPolicies({input:{did:i}});return Q(m,a=>a.isProtected?1:0)}),H=h.data||[],x=w(()=>{u.current.open((m,a)=>{W(async()=>{await n.addBlockletAccessPolicy({input:{did:i,data:m}}),E.success(o("common.succeeded")),h.run(),a()})})}),I=w(m=>{u.current.open((a,j)=>{W(async()=>{await n.updateBlockletAccessPolicy({input:{did:i,data:{...a,id:m.id}}}),E.success(o("common.succeeded")),h.run(),j()})},m)}),B=w(m=>{u.current.open((a,j)=>{j()},$(m,["id"]))}),A=w(m=>{l.open({title:o("accessPolicy.delete.title"),content:o("accessPolicy.delete.description"),confirmButtonText:o("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:o("common.cancel"),onConfirm(a){W(async()=>{await n.deleteBlockletAccessPolicy({input:{did:i,id:m.id}}),E.success(o("common.succeeded")),h.run(),a()})}})}),D={sort:!1,download:!1,filter:!1,print:!1,search:!1,viewColumns:!1,expandableRowsOnClick:!0,searchDebounceTime:600,onRowClick(m,{dataIndex:a},j){if(d.current?.contains(j.target)){const z=H[a];B(z)}}},S=[e.jsx(X,{size:"small",variant:"outlined",onClick:()=>{h.run()},sx:{mr:1},children:o("common.refresh")},"refresh"),e.jsx(X,{size:"small",variant:"contained",onClick:x,children:o("common.add")})],b=[{label:o("accessPolicy.form.name"),name:"name",options:{customBodyRenderLite(m){const a=H[m],j=a.isProtected?e.jsx(q,{title:"Built-in policy, can't edit",children:e.jsx(P,{component:O,icon:Pe,sx:{fontSize:16}})}):null;return e.jsxs(P,{sx:{display:"flex",alignItems:"center",gap:.5},children:[j," ",a.name]})}}},{label:o("accessPolicy.form.roles"),name:"roles",options:{customBodyRenderLite(m){const a=H[m],j=Ae(a);if([T.WHO_CAN_ACCESS.ALL,T.WHO_CAN_ACCESS.INVITED].includes(j.whoCanAccess)){const p=we.find(v=>v.value===j.whoCanAccess);return p.title?.[t]||p.title?.en}const z=s.filter(p=>a.reverse?!j.roles?.includes(p.name):j.roles?.includes(p.name));return e.jsx(P,{sx:{display:"flex",gap:1,flexWrap:"wrap"},children:z.map(p=>e.jsx(q,{title:p.description,children:e.jsx(Ue,{size:"small",label:p.title},p.name)}))})}}},{label:o("accessPolicy.form.description"),name:"description"},{label:o("common.actions"),name:"",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite(m){const a=H[m];return e.jsxs(P,{sx:{display:"flex",alignItems:"center",gap:0},onClick:j=>j.stopPropagation(),children:[a.isProtected?e.jsx(q,{title:o("common.view"),children:e.jsx(N,{size:"small",onClick:()=>{B(a,m)},children:e.jsx(O,{icon:Te,fontSize:18})})}):null,a.isProtected?null:e.jsx(q,{title:o("common.edit"),children:e.jsx(N,{size:"small",onClick:()=>{I(a,m)},color:"success",children:e.jsx(O,{icon:xe,fontSize:18})})}),a.isProtected?null:e.jsx(q,{title:o("common.delete"),children:e.jsx(N,{size:"small",onClick:()=>{A(a,m)},color:"error",children:e.jsx(O,{icon:he,fontSize:18})})})]})}}}].filter(Boolean);return e.jsxs(P,{sx:{display:"flex",flexDirection:"column",gap:2},ref:d,children:[e.jsx(ue,{verticalKeyWidth:100,locale:t,title:o("accessPolicy.title"),data:H,columns:b,customButtons:S,options:D,loading:h.loading,onChange:f}),e.jsx(qe,{ref:u}),r]})}const mo={width:24,height:24,body:'<path fill="currentColor" d="m12 15.375l-6-6l1.4-1.4l4.6 4.6l4.6-4.6l1.4 1.4l-6 6Z"/>'};function ie({title:o,actions:t,children:c=null,defaultValue:n=!0,value:s,onChange:i,showExpand:d=!0}){const u=!M(s),l=oe({open:n}),r=me(()=>u?s:l.open,[s,u,l.open]),f=w(()=>{u?i(!r):l.open=!l.open});return e.jsxs(Ze,{variant:"outlined",children:[e.jsxs(P,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",cursor:"pointer",px:2,py:1,backgroundColor:"grey.50"},onClick:f,children:[e.jsx(P,{sx:{fontWeight:"bold"},children:o}),e.jsxs(P,{sx:{display:"flex",alignItems:"center"},children:[t,d?e.jsx(P,{component:O,icon:mo,sx:{transform:r?"rotate(180deg)":"rotate(0deg)",transition:"transform 0.2s ease",fontSize:"2rem"}}):null]})]}),e.jsx($e,{in:r,children:e.jsx(Xe,{children:c})})]})}ie.propTypes={title:g.string.isRequired,defaultValue:g.bool,value:g.bool,actions:g.node,children:g.node,onChange:g.func,showExpand:g.bool};const ce={width:24,height:24,body:'<path fill="currentColor" d="M11.95 18q.525 0 .888-.363t.362-.887q0-.525-.362-.888t-.888-.362q-.525 0-.887.363t-.363.887q0 .525.363.888t.887.362Zm.05 4q-2.075 0-3.9-.788t-3.175-2.137q-1.35-1.35-2.137-3.175T2 12q0-2.075.788-3.9t2.137-3.175q1.35-1.35 3.175-2.137T12 2q2.075 0 3.9.788t3.175 2.137q1.35 1.35 2.138 3.175T22 12q0 2.075-.788 3.9t-2.137 3.175q-1.35 1.35-3.175 2.138T12 22Zm0-2q3.35 0 5.675-2.325T20 12q0-3.35-2.325-5.675T12 4Q8.65 4 6.325 6.325T4 12q0 3.35 2.325 5.675T12 20Zm0-8Zm.1-4.3q.625 0 1.088.4t.462 1q0 .55-.337.975t-.763.8q-.575.5-1.012 1.1t-.438 1.35q0 .35.263.588t.612.237q.375 0 .638-.25t.337-.625q.1-.525.45-.938t.75-.787q.575-.55.988-1.2t.412-1.45q0-1.275-1.038-2.087T12.1 6q-.95 0-1.812.4T8.975 7.625q-.175.3-.113.638t.338.512q.35.2.725.125t.625-.425q.275-.375.688-.575t.862-.2Z"/>'};function Ie({config:o={},onChange:t=()=>{},disabled:c=!1}){const n=["GET","HEAD","POST","PUT","DELETE","OPTIONS","PATCH"],s={origin:{override:!1,value:"*",smart:!0},methods:{override:!1,value:[...n]},allowedHeaders:{override:!1,value:"*"},exposedHeaders:{override:!1,value:"*"},maxAge:{override:!1,value:void 0},optionsSuccessStatus:{override:!1,value:204},preflightContinue:{override:!1,value:!1},credentials:{override:!1,value:!1},...je(o,M)},{t:i}=Z(),d=(r,{override:f,value:h,smart:H})=>{const x={...s?.[r]};!M(H)&&r==="origin"&&(x.smart=H),M(f)||(x.override=f),M(h)||(x.value=h),t({...s,[r]:x})},u=[{title:i("responseHeaderPolicy.form.cors.origin"),override:s.origin.override,smart:s.origin.smart,name:"origin",required:!0,value:s.origin.value,content:e.jsx(L,{fullWidth:!0,sx:{mt:.75,"& .MuiFormHelperText-root":{mx:0}},children:e.jsx(_,{multiline:!0,minRows:4,maxRows:10,disabled:c,variant:"outlined",size:"small",placeholder:i("responseHeaderPolicy.form.cors.originPlaceholder"),helperText:i("responseHeaderPolicy.form.cors.originHelperText"),value:s.origin.value,onChange:r=>{d("origin",{value:r.target.value})}})})},{title:i("responseHeaderPolicy.form.cors.methods"),name:"methods",override:s.methods.override,required:!0,value:s.methods.value,content:e.jsx(J,{sx:{flexDirection:"row"},children:n.map(r=>e.jsx(V,{control:e.jsx(G,{size:"small",disabled:c,checked:s.methods.value.includes(r),onChange:(f,h)=>{d("methods",{value:h?[...s.methods.value,r]:s.methods.value.filter(H=>H!==r)})}}),label:r},r))})},{title:i("responseHeaderPolicy.form.cors.allowedHeaders"),override:s.allowedHeaders.override,name:"allowedHeaders",value:s.allowedHeaders.value,content:e.jsx(L,{fullWidth:!0,sx:{mt:.75,"& .MuiFormHelperText-root":{mx:0}},children:e.jsx(_,{multiline:!0,minRows:3,maxRows:7,disabled:c,variant:"outlined",size:"small",placeholder:i("responseHeaderPolicy.form.cors.allowedHeadersPlaceholder"),helperText:i("responseHeaderPolicy.form.cors.allowedHeadersHelperText"),value:s.allowedHeaders.value,onChange:r=>{d("allowedHeaders",{value:r.target.value})}})})},{title:i("responseHeaderPolicy.form.cors.exposedHeaders"),override:s.exposedHeaders.override,name:"exposedHeaders",value:s.exposedHeaders.value,content:e.jsx(L,{fullWidth:!0,sx:{mt:.75,"& .MuiFormHelperText-root":{mx:0}},children:e.jsx(_,{multiline:!0,minRows:3,maxRows:7,disabled:c,variant:"outlined",size:"small",placeholder:i("responseHeaderPolicy.form.cors.exposedHeadersPlaceholder"),helperText:i("responseHeaderPolicy.form.cors.exposedHeadersHelperText"),value:s.exposedHeaders.value,onChange:r=>{d("exposedHeaders",{value:r.target.value})}})})},{title:i("responseHeaderPolicy.form.cors.maxAge"),override:s.maxAge.override,name:"maxAge",value:s.maxAge.value,content:e.jsx(L,{fullWidth:!0,sx:{mt:.75,"& .MuiFormHelperText-root":{mx:0}},children:e.jsx(_,{type:"number",variant:"outlined",size:"small",disabled:c,value:s.maxAge.value,onChange:r=>{d("maxAge",{value:r.target.value})},helperText:i("responseHeaderPolicy.form.cors.maxAgeHelperText")})})},{title:i("responseHeaderPolicy.form.cors.optionsSuccessStatus"),override:s.optionsSuccessStatus.override,name:"optionsSuccessStatus",value:s.optionsSuccessStatus.value,content:e.jsx(L,{fullWidth:!0,sx:{mt:.75,"& .MuiFormHelperText-root":{mx:0}},children:e.jsx(_,{type:"number",variant:"outlined",size:"small",disabled:c,value:s.optionsSuccessStatus.value,onChange:r=>{d("optionsSuccessStatus",{value:r.target.value})}})})},{title:i("responseHeaderPolicy.form.cors.preflightContinue"),override:s.preflightContinue.override,name:"preflightContinue",value:s.preflightContinue.value,control:e.jsx(Y,{size:"small",disabled:c,checked:s.preflightContinue.value,onChange:(r,f)=>{d("preflightContinue",{value:f})}})},{title:i("responseHeaderPolicy.form.cors.credentials"),override:s.credentials.override,name:"credentials",value:s.credentials.value,control:e.jsx(Y,{size:"small",disabled:c,checked:s.credentials.value,onChange:(r,f)=>{d("credentials",{value:f})}})}];ge(()=>{t(s)});const l={".PrivateSwitchBase-input+svg":{fontSize:"1rem"},".MuiCheckbox-sizeSmall":{p:.75},".MuiFormControlLabel-label":{fontSize:"0.8rem"}};return e.jsx(J,{children:u.map((r,f)=>e.jsxs(k.Fragment,{children:[e.jsxs(P,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(V,{sx:{mt:f===0?0:1},control:r.control||e.jsx(P,{sx:{pl:1.35}}),label:r.title,required:r.required},`${r.name}_form`),e.jsxs(P,{children:[r.name==="origin"?e.jsx(V,{control:e.jsx(G,{size:"small",checked:r.smart,color:"primary",disabled:c,onChange:()=>{d(r.name,{smart:!r.smart})}}),label:e.jsxs(e.Fragment,{children:[i("responseHeaderPolicy.form.cors.smartMode"),e.jsx(q,{title:i("responseHeaderPolicy.form.cors.smartModeHelperText"),children:e.jsx(P,{component:O,icon:ce,sx:{cursor:"pointer",color:"grey",ml:.5,fontSize:"1.1em"}})})]}),sx:l},`${r.name}_smart`):null,e.jsx(V,{control:e.jsx(G,{size:"small",checked:r.override,color:"warning",disabled:c,onChange:()=>{d(r.name,{override:!r.override})}}),label:e.jsxs(e.Fragment,{children:[i("responseHeaderPolicy.form.originOverride"),e.jsx(q,{title:i("responseHeaderPolicy.form.originOverrideHelperText"),children:e.jsx(P,{component:O,icon:ce,sx:{cursor:"pointer",color:"grey",ml:.5,fontSize:"1.1em"}})})]}),sx:{...l,mr:0}},`${r.name}_override`)]})]}),r.content?e.jsx(P,{sx:{ml:3.5},children:r.content},`${r.name}_content`):null]},r.name))})}Ie.propTypes={config:g.object,onChange:g.func,disabled:g.bool};function Oe({value:o,onChange:t=()=>{},disabled:c=!1}){const n="sameorigin",s=[{label:"DENY",value:"deny"},{label:"SAMEORIGIN (default)",value:"sameorigin"}],i=d=>{t({action:d.target.value})};return k.useEffect(()=>{o===!0&&t({action:n})},[o]),e.jsx(P,{children:e.jsx(L,{children:e.jsx(ve,{row:!0,children:s.map(d=>e.jsx(V,{value:d.value,control:e.jsx(Ce,{size:"small",disabled:c,checked:d.value===o?.action,onChange:i,sx:{p:.75}}),label:d.label},d.value))})})})}Oe.propTypes={value:g.oneOfType([g.string,g.bool]).isRequired,onChange:g.func,disabled:g.bool};function Be({value:o,onChange:t=()=>{},disabled:c=!1}){const n="strict-origin-when-cross-origin",s=[{label:"no-referrer",value:"no-referrer"},{label:"no-referrer-when-downgrade",value:"no-referrer-when-downgrade"},{label:"origin",value:"origin"},{label:"origin-when-cross-origin",value:"origin-when-cross-origin"},{label:"same-origin",value:"same-origin"},{label:"strict-origin",value:"strict-origin"},{label:"strict-origin-when-cross-origin (default)",value:"strict-origin-when-cross-origin"},{label:"unsafe-url",value:"unsafe-url"}],i=d=>{t({policy:d.target.value})};return k.useEffect(()=>{o===!0&&t({policy:n})},[o]),e.jsx(P,{children:e.jsx(L,{children:e.jsx(ve,{children:s.map(d=>e.jsx(V,{value:d.value,control:e.jsx(Ce,{size:"small",disabled:c,checked:d.value===o?.policy,onChange:i,sx:{p:.75}}),label:d.label},d.value))})})})}Be.propTypes={value:g.oneOfType([g.string,g.bool]).isRequired,onChange:g.func,disabled:g.func};function Ee({value:o,onChange:t=()=>{},disabled:c=!1}){const n={"default-src":["'self'"],"base-uri":["'self'"],"font-src":["'self'","https:","data:"],"form-action":["'self'"],"frame-ancestors":["'self'"],"img-src":["'self'","data:"],"object-src":["'none'"],"script-src":["'self'"],"script-src-attr":["'none'"],"style-src":["'self'","https:","'unsafe-inline'"],"upgrade-insecure-requests":[]};function s(r){return Object.keys(r).map(f=>[f,r[f].filter(Boolean).join(" ")].filter(Boolean).join(" ")).filter(Boolean).join(`
8
8
  `)}const i=s(o?.directives||n),[d,u]=k.useState(i),l=r=>{u(r.target.value);const f=r.target.value.split(`
9
- `).reduce((h,H)=>{const[x,...I]=H.split(" ");return h[x]=I.filter(B=>B!==""),h},{});t({useDefaults:!1,directives:f})};return k.useEffect(()=>{o===!0&&(t({useDefaults:!1,directives:n}),u(s(n)))},[o]),e.jsx(P,{sx:{mt:1},children:e.jsx(L,{fullWidth:!0,children:e.jsx(_,{fullWidth:!0,multiline:!0,disabled:c,rows:12,size:"small",value:d,onChange:l})})})}Ee.propTypes={value:v.oneOfType([v.object,v.bool]).isRequired,onChange:v.func,disabled:v.bool};function ze({config:o={},onChange:t=()=>{},disabled:c=!1}){const n={contentSecurityPolicy:{override:!1,value:!1},referrerPolicy:{override:!1,value:!1},xFrameOptions:{override:!1,value:!1},xPoweredBy:{override:!1,value:!0},xXssProtection:{override:!1,value:!1},...je(o,M)},{t:s}=Z(),i=(l,{override:r,value:f})=>{const h={...n?.[l]};M(r)||(h.override=r),M(f)||(h.value=f),t({...n,[l]:h})},d=[{title:"Content-Security-Policy",name:"contentSecurityPolicy",override:n.contentSecurityPolicy.override,value:!!n.contentSecurityPolicy.value,content:e.jsx(Ee,{disabled:c,value:n.contentSecurityPolicy.value,onChange:l=>{i("contentSecurityPolicy",{value:l})}}),onChange(l){i("contentSecurityPolicy",{value:l})}},{title:"Referrer-Policy",name:"referrerPolicy",override:n.referrerPolicy.override,value:!!n.referrerPolicy.value,content:e.jsx(Be,{disabled:c,value:n.referrerPolicy.value,onChange:l=>{i("referrerPolicy",{value:l})}}),onChange(l){i("referrerPolicy",{value:l})}},{title:"X-Frame-Options",name:"xFrameOptions",override:n.xFrameOptions.override,value:!!n.xFrameOptions.value,content:e.jsx(Oe,{disabled:c,value:n.xFrameOptions.value,onChange:l=>{i("xFrameOptions",{value:l})}}),onChange(l){i("xFrameOptions",{value:l})}},{title:"Disable X-Powered-By",name:"xPoweredBy",override:n.xPoweredBy.override,value:n.xPoweredBy.value,content:null,onChange(l){i("xPoweredBy",{value:l})}},{title:"X-XSS-Protection",name:"xXssProtection",override:n.xXssProtection.override,value:n.xXssProtection.value,content:null,onChange(l){i("xXssProtection",{value:l})}}];ve(()=>{t(n)});const u={".PrivateSwitchBase-input+svg":{fontSize:"1rem"},".MuiCheckbox-sizeSmall":{p:.75},".MuiFormControlLabel-label":{fontSize:"0.8rem"}};return e.jsx(J,{children:d.map((l,r)=>e.jsxs(k.Fragment,{children:[e.jsxs(P,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(V,{sx:{mt:r===0?0:1},control:e.jsx(Y,{size:"small",disabled:c,checked:l.value,onChange:()=>{l.onChange(!l.value)}},`${l.name}_switch`),label:l.title},`${l.name}_form`),l.value?e.jsx(V,{control:e.jsx(G,{size:"small",checked:l.override,color:"warning",disabled:c,onChange:()=>{i(l.name,{override:!l.override})}}),label:e.jsxs(e.Fragment,{children:[s("responseHeaderPolicy.form.originOverride"),e.jsx(q,{title:s("responseHeaderPolicy.form.originOverrideHelperText"),children:e.jsx(P,{component:O,icon:ce,sx:{cursor:"pointer",color:"grey",ml:.5,fontSize:"1.1em"}})})]}),sx:{...u,mr:0}}):null]}),l.value&&l.content?e.jsx(P,{sx:{ml:3.7},children:l.content},`${l.name}_content`):null]},l.name))})}ze.propTypes={config:v.object,onChange:v.func,disabled:v.bool};function _e({ref:o=null}){const{t}=k.useContext(ee),n=te()?.transitions?.duration?.leavingScreen||300,s=oe({mode:"add",show:!1,callback:U,get dialogTitle(){return this.mode==="edit"?t("responseHeaderPolicy.edit"):this.mode==="view"?t("responseHeaderPolicy.view"):t("responseHeaderPolicy.add")},cors:null,securityHeader:null,enableCORS:!1}),{handleSubmit:i,control:d,setValue:u,reset:l,formState:{errors:r}}=pe({mode:"onChange",defaultValues:{name:"",description:""}}),f=w(()=>{l(),s.mode="add",s.enableCORS=!1,s.cors=null,s.securityHeader=null}),h=w(()=>{s.show=!1,setTimeout(()=>{f()},n)}),H=w((S=U,b=null)=>{s.callback=S,s.show=!0,b&&(b.id?s.mode="edit":s.mode="view",u("name",b.name),u("description",b.description),s.cors=no(b.cors),s.securityHeader=io(b.securityHeader),s.enableCORS=!!b.cors)});k.useImperativeHandle(o,()=>({open:H,close:h}),[H,h]);const x=s.mode==="view",I=w(S=>{const b=lo(s.cors),m=co(s.securityHeader),a=be({...S,cors:s.enableCORS?JSON.stringify(b):null,securityHeader:JSON.stringify(m)});s.callback(a,h)}),B=w(S=>S?.trim()?!0:t("common.requiredErrorText",{name:t("accessPolicy.form.name")})),A=S=>{s.securityHeader=S},D=S=>{s.cors=S};return e.jsx(ae,{open:s.show,title:s.dialogTitle,onClose:h,PaperProps:{style:{minHeight:"unset",width:900,maxWidth:"100%"}},actions:e.jsx(de,{color:"primary",autoFocus:!0,variant:"contained",onClick:i(I),children:t("common.confirm")}),children:e.jsxs("form",{noValidate:!0,autoComplete:"off",children:[e.jsx(F,{name:"name",control:d,rules:{validate:B},render:({field:S})=>e.jsx(_,{fullWidth:!0,required:!0,size:"small",margin:"dense",disabled:x,placeholder:t("accessPolicy.form.namePlaceholder"),label:t("accessPolicy.form.name"),error:!!r?.name?.message,helperText:r?.name?.message||" ",...S})}),e.jsx(F,{name:"description",control:d,render:({field:S})=>e.jsx(_,{fullWidth:!0,multiline:!0,size:"small",margin:"dense",disabled:x,minRows:3,maxRows:7,placeholder:"Description",label:"Description",helperText:r?.description?.message||" ",...S})}),e.jsx(ie,{title:"Cross-origin resource sharing (CORS)",value:s.enableCORS,onChange:S=>{x||(s.enableCORS=S)},showExpand:!1,actions:e.jsx(Y,{size:"small",disabled:x,checked:s.enableCORS}),children:e.jsx(Ie,{config:s.cors,onChange:D,disabled:x})}),e.jsx("br",{}),e.jsx(ie,{title:"Security Headers",children:e.jsx(ze,{config:s.securityHeader,onChange:A,disabled:x})})]})})}_e.propTypes={ref:v.any};function fo(){const{t:o,locale:t}=Z(),{blocklet:c}=se(),{api:n}=re(),s=c?.meta?.did,i=k.useRef(null),d=k.useRef(null),{confirmApi:u,confirmHolder:l}=fe(),r=()=>{},f=K(async()=>{const{responseHeaderPolicies:b}=await n.getBlockletResponseHeaderPolicies({input:{did:s}});return Q(b.map(m=>ao(m)),m=>m.isProtected?1:0)}),h=f.data||[],H=w(()=>{i.current.open((b,m)=>{W(async()=>{await n.addBlockletResponseHeaderPolicy({input:{did:s,data:b}}),E.success(o("common.succeeded")),f.run(),m()})})}),x=w(b=>{i.current.open((m,a)=>{a()},$(b,["id"]))}),I=w(b=>{i.current.open((m,a)=>{W(async()=>{await n.updateBlockletResponseHeaderPolicy({input:{did:s,data:{...m,id:b.id}}}),E.success(o("common.succeeded")),f.run(),a()})},b)}),B=w(b=>{u.open({title:o("responseHeaderPolicy.delete.title"),content:o("responseHeaderPolicy.delete.description"),confirmButtonText:o("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:o("common.cancel"),onConfirm(m){W(async()=>{await n.deleteBlockletResponseHeaderPolicy({input:{did:s,id:b.id}}),E.success(o("common.succeeded")),f.run(),m()})}})}),A={sort:!1,download:!1,filter:!1,print:!1,search:!1,viewColumns:!1,expandableRowsOnClick:!0,searchDebounceTime:600,onRowClick(b,{dataIndex:m},a){if(d.current?.contains(a.target)){const j=h[m];x(j)}}},D=[e.jsx(X,{size:"small",variant:"outlined",onClick:()=>{f.run()},sx:{mr:1},children:o("common.refresh")},"refresh"),e.jsx(X,{size:"small",variant:"contained",onClick:H,children:o("common.add")},"add")],S=[{label:o("common.name"),name:"name",options:{customBodyRenderLite(b){const m=h[b],a=m.isProtected?e.jsx(q,{title:"Built-in policy, can't edit",children:e.jsx(P,{component:O,icon:Pe,sx:{fontSize:16}})}):null;return e.jsxs(P,{sx:{display:"flex",alignItems:"center",gap:.5},children:[a," ",m.name]})}}},{label:o("common.description"),name:"description"},{label:o("common.actions"),name:"",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite(b){const m=h[b];return e.jsxs(P,{sx:{display:"flex",alignItems:"center",gap:0},onClick:a=>a.stopPropagation(),children:[m.isProtected?e.jsx(q,{title:o("common.view"),children:e.jsx(N,{size:"small",onClick:()=>{x(m,b)},children:e.jsx(O,{icon:Te,fontSize:18})})}):null,m.isProtected?null:e.jsx(q,{title:o("common.edit"),children:e.jsx(N,{size:"small",onClick:()=>{I(m,b)},color:"success",children:e.jsx(O,{icon:xe,fontSize:18})})}),m.isProtected?null:e.jsx(q,{title:o("common.delete"),children:e.jsx(N,{size:"small",onClick:()=>{B(m,b)},color:"error",children:e.jsx(O,{icon:he,fontSize:18})})})]})}}}].filter(Boolean);return e.jsxs(P,{sx:{display:"flex",flexDirection:"column",gap:2},ref:d,children:[e.jsx(ue,{verticalKeyWidth:100,locale:t,title:o("responseHeaderPolicy.title"),data:h,columns:S,customButtons:D,options:A,loading:f.loading,onChange:r}),e.jsx(_e,{ref:i}),l]})}function Io(){const{t:o}=k.useContext(ee),t=eo({key:"lg"}),c=[{label:e.jsx(P,{sx:{textAlign:"center",width:"100%"},children:o("securityRule.title")}),value:"security"},{label:e.jsx(P,{sx:{textAlign:"center",width:"100%"},children:o("accessPolicy.title")}),value:"accessPolicy"},{label:e.jsx(P,{sx:{textAlign:"center",width:"100%"},children:o("responseHeaderPolicy.title")}),value:"responseHeaderPolicy"}],[n,s]=k.useState(c[0].value),i=me(()=>({security:e.jsx(so,{}),accessPolicy:e.jsx(uo,{}),responseHeaderPolicy:e.jsx(fo,{})}),[o]);return e.jsx(po,{children:e.jsxs(Ge,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(P,{sx:{minWidth:"240px",flexShrink:0},children:e.jsx(De,{tabs:c,current:n,orientation:t?"horizontal":"vertical",onChange:s,sx:{borderRight:t?0:1,height:"100%",borderColor:"divider"}})}),e.jsx(P,{sx:{flexGrow:1,minWidth:0},children:e.jsx(P,{children:i[n]})})]})})}const po=Ke.div`
9
+ `).reduce((h,H)=>{const[x,...I]=H.split(" ");return h[x]=I.filter(B=>B!==""),h},{});t({useDefaults:!1,directives:f})};return k.useEffect(()=>{o===!0&&(t({useDefaults:!1,directives:n}),u(s(n)))},[o]),e.jsx(P,{sx:{mt:1},children:e.jsx(L,{fullWidth:!0,children:e.jsx(_,{fullWidth:!0,multiline:!0,disabled:c,rows:12,size:"small",value:d,onChange:l})})})}Ee.propTypes={value:g.oneOfType([g.object,g.bool]).isRequired,onChange:g.func,disabled:g.bool};function ze({config:o={},onChange:t=()=>{},disabled:c=!1}){const n={contentSecurityPolicy:{override:!1,value:!1},referrerPolicy:{override:!1,value:!1},xFrameOptions:{override:!1,value:!1},xPoweredBy:{override:!1,value:!0},xXssProtection:{override:!1,value:!1},...je(o,M)},{t:s}=Z(),i=(l,{override:r,value:f})=>{const h={...n?.[l]};M(r)||(h.override=r),M(f)||(h.value=f),t({...n,[l]:h})},d=[{title:"Content-Security-Policy",name:"contentSecurityPolicy",override:n.contentSecurityPolicy.override,value:!!n.contentSecurityPolicy.value,content:e.jsx(Ee,{disabled:c,value:n.contentSecurityPolicy.value,onChange:l=>{i("contentSecurityPolicy",{value:l})}}),onChange(l){i("contentSecurityPolicy",{value:l})}},{title:"Referrer-Policy",name:"referrerPolicy",override:n.referrerPolicy.override,value:!!n.referrerPolicy.value,content:e.jsx(Be,{disabled:c,value:n.referrerPolicy.value,onChange:l=>{i("referrerPolicy",{value:l})}}),onChange(l){i("referrerPolicy",{value:l})}},{title:"X-Frame-Options",name:"xFrameOptions",override:n.xFrameOptions.override,value:!!n.xFrameOptions.value,content:e.jsx(Oe,{disabled:c,value:n.xFrameOptions.value,onChange:l=>{i("xFrameOptions",{value:l})}}),onChange(l){i("xFrameOptions",{value:l})}},{title:"Disable X-Powered-By",name:"xPoweredBy",override:n.xPoweredBy.override,value:n.xPoweredBy.value,content:null,onChange(l){i("xPoweredBy",{value:l})}},{title:"X-XSS-Protection",name:"xXssProtection",override:n.xXssProtection.override,value:n.xXssProtection.value,content:null,onChange(l){i("xXssProtection",{value:l})}}];ge(()=>{t(n)});const u={".PrivateSwitchBase-input+svg":{fontSize:"1rem"},".MuiCheckbox-sizeSmall":{p:.75},".MuiFormControlLabel-label":{fontSize:"0.8rem"}};return e.jsx(J,{children:d.map((l,r)=>e.jsxs(k.Fragment,{children:[e.jsxs(P,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[e.jsx(V,{sx:{mt:r===0?0:1},control:e.jsx(Y,{size:"small",disabled:c,checked:l.value,onChange:()=>{l.onChange(!l.value)}},`${l.name}_switch`),label:l.title},`${l.name}_form`),l.value?e.jsx(V,{control:e.jsx(G,{size:"small",checked:l.override,color:"warning",disabled:c,onChange:()=>{i(l.name,{override:!l.override})}}),label:e.jsxs(e.Fragment,{children:[s("responseHeaderPolicy.form.originOverride"),e.jsx(q,{title:s("responseHeaderPolicy.form.originOverrideHelperText"),children:e.jsx(P,{component:O,icon:ce,sx:{cursor:"pointer",color:"grey",ml:.5,fontSize:"1.1em"}})})]}),sx:{...u,mr:0}}):null]}),l.value&&l.content?e.jsx(P,{sx:{ml:3.7},children:l.content},`${l.name}_content`):null]},l.name))})}ze.propTypes={config:g.object,onChange:g.func,disabled:g.bool};function _e({ref:o=null}){const{t}=k.useContext(ee),n=te()?.transitions?.duration?.leavingScreen||300,s=oe({mode:"add",show:!1,callback:U,get dialogTitle(){return this.mode==="edit"?t("responseHeaderPolicy.edit"):this.mode==="view"?t("responseHeaderPolicy.view"):t("responseHeaderPolicy.add")},cors:null,securityHeader:null,enableCORS:!1}),{handleSubmit:i,control:d,setValue:u,reset:l,formState:{errors:r}}=pe({mode:"onChange",defaultValues:{name:"",description:""}}),f=w(()=>{l(),s.mode="add",s.enableCORS=!1,s.cors=null,s.securityHeader=null}),h=w(()=>{s.show=!1,setTimeout(()=>{f()},n)}),H=w((S=U,b=null)=>{s.callback=S,s.show=!0,b&&(b.id?s.mode="edit":s.mode="view",u("name",b.name),u("description",b.description),s.cors=no(b.cors),s.securityHeader=io(b.securityHeader),s.enableCORS=!!b.cors)});k.useImperativeHandle(o,()=>({open:H,close:h}),[H,h]);const x=s.mode==="view",I=w(S=>{const b=lo(s.cors),m=co(s.securityHeader),a=be({...S,cors:s.enableCORS?JSON.stringify(b):null,securityHeader:JSON.stringify(m)});s.callback(a,h)}),B=w(S=>S?.trim()?!0:t("common.requiredErrorText",{name:t("accessPolicy.form.name")})),A=S=>{s.securityHeader=S},D=S=>{s.cors=S};return e.jsx(ae,{open:s.show,title:s.dialogTitle,onClose:h,PaperProps:{style:{minHeight:"unset",width:900,maxWidth:"100%"}},actions:e.jsx(de,{color:"primary",autoFocus:!0,variant:"contained",onClick:i(I),children:t("common.confirm")}),children:e.jsxs("form",{noValidate:!0,autoComplete:"off",children:[e.jsx(F,{name:"name",control:d,rules:{validate:B},render:({field:S})=>e.jsx(_,{fullWidth:!0,required:!0,size:"small",margin:"dense",disabled:x,placeholder:t("accessPolicy.form.namePlaceholder"),label:t("accessPolicy.form.name"),error:!!r?.name?.message,helperText:r?.name?.message||" ",...S})}),e.jsx(F,{name:"description",control:d,render:({field:S})=>e.jsx(_,{fullWidth:!0,multiline:!0,size:"small",margin:"dense",disabled:x,minRows:3,maxRows:7,placeholder:"Description",label:"Description",helperText:r?.description?.message||" ",...S})}),e.jsx(ie,{title:"Cross-origin resource sharing (CORS)",value:s.enableCORS,onChange:S=>{x||(s.enableCORS=S)},showExpand:!1,actions:e.jsx(Y,{size:"small",disabled:x,checked:s.enableCORS}),children:e.jsx(Ie,{config:s.cors,onChange:D,disabled:x})}),e.jsx("br",{}),e.jsx(ie,{title:"Security Headers",children:e.jsx(ze,{config:s.securityHeader,onChange:A,disabled:x})})]})})}_e.propTypes={ref:g.any};function fo(){const{t:o,locale:t}=Z(),{blocklet:c}=se(),{api:n}=re(),s=c?.meta?.did,i=k.useRef(null),d=k.useRef(null),{confirmApi:u,confirmHolder:l}=fe(),r=()=>{},f=K(async()=>{const{responseHeaderPolicies:b}=await n.getBlockletResponseHeaderPolicies({input:{did:s}});return Q(b.map(m=>ao(m)),m=>m.isProtected?1:0)}),h=f.data||[],H=w(()=>{i.current.open((b,m)=>{W(async()=>{await n.addBlockletResponseHeaderPolicy({input:{did:s,data:b}}),E.success(o("common.succeeded")),f.run(),m()})})}),x=w(b=>{i.current.open((m,a)=>{a()},$(b,["id"]))}),I=w(b=>{i.current.open((m,a)=>{W(async()=>{await n.updateBlockletResponseHeaderPolicy({input:{did:s,data:{...m,id:b.id}}}),E.success(o("common.succeeded")),f.run(),a()})},b)}),B=w(b=>{u.open({title:o("responseHeaderPolicy.delete.title"),content:o("responseHeaderPolicy.delete.description"),confirmButtonText:o("common.confirm"),confirmButtonProps:{color:"error"},cancelButtonText:o("common.cancel"),onConfirm(m){W(async()=>{await n.deleteBlockletResponseHeaderPolicy({input:{did:s,id:b.id}}),E.success(o("common.succeeded")),f.run(),m()})}})}),A={sort:!1,download:!1,filter:!1,print:!1,search:!1,viewColumns:!1,expandableRowsOnClick:!0,searchDebounceTime:600,onRowClick(b,{dataIndex:m},a){if(d.current?.contains(a.target)){const j=h[m];x(j)}}},D=[e.jsx(X,{size:"small",variant:"outlined",onClick:()=>{f.run()},sx:{mr:1},children:o("common.refresh")},"refresh"),e.jsx(X,{size:"small",variant:"contained",onClick:H,children:o("common.add")},"add")],S=[{label:o("common.name"),name:"name",options:{customBodyRenderLite(b){const m=h[b],a=m.isProtected?e.jsx(q,{title:"Built-in policy, can't edit",children:e.jsx(P,{component:O,icon:Pe,sx:{fontSize:16}})}):null;return e.jsxs(P,{sx:{display:"flex",alignItems:"center",gap:.5},children:[a," ",m.name]})}}},{label:o("common.description"),name:"description"},{label:o("common.actions"),name:"",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite(b){const m=h[b];return e.jsxs(P,{sx:{display:"flex",alignItems:"center",gap:0},onClick:a=>a.stopPropagation(),children:[m.isProtected?e.jsx(q,{title:o("common.view"),children:e.jsx(N,{size:"small",onClick:()=>{x(m,b)},children:e.jsx(O,{icon:Te,fontSize:18})})}):null,m.isProtected?null:e.jsx(q,{title:o("common.edit"),children:e.jsx(N,{size:"small",onClick:()=>{I(m,b)},color:"success",children:e.jsx(O,{icon:xe,fontSize:18})})}),m.isProtected?null:e.jsx(q,{title:o("common.delete"),children:e.jsx(N,{size:"small",onClick:()=>{B(m,b)},color:"error",children:e.jsx(O,{icon:he,fontSize:18})})})]})}}}].filter(Boolean);return e.jsxs(P,{sx:{display:"flex",flexDirection:"column",gap:2},ref:d,children:[e.jsx(ue,{verticalKeyWidth:100,locale:t,title:o("responseHeaderPolicy.title"),data:h,columns:S,customButtons:D,options:A,loading:f.loading,onChange:r}),e.jsx(_e,{ref:i}),l]})}function Io(){const{t:o}=k.useContext(ee),t=eo({key:"lg"}),c=[{label:e.jsx(P,{sx:{textAlign:"center",width:"100%"},children:o("securityRule.title")}),value:"security"},{label:e.jsx(P,{sx:{textAlign:"center",width:"100%"},children:o("accessPolicy.title")}),value:"accessPolicy"},{label:e.jsx(P,{sx:{textAlign:"center",width:"100%"},children:o("responseHeaderPolicy.title")}),value:"responseHeaderPolicy"}],[n,s]=k.useState(c[0].value),i=me(()=>({security:e.jsx(so,{}),accessPolicy:e.jsx(uo,{}),responseHeaderPolicy:e.jsx(fo,{})}),[o]);return e.jsx(po,{children:e.jsxs(Ge,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(P,{sx:{minWidth:"240px",flexShrink:0},children:e.jsx(De,{tabs:c,current:n,orientation:t?"horizontal":"vertical",onChange:s,sx:{borderRight:t?0:1,height:"100%",borderColor:"divider"}})}),e.jsx(P,{sx:{flexGrow:1,minWidth:0},children:e.jsx(P,{children:i[n]})})]})})}const po=Ke.div`
10
10
  .MuiTab-root {
11
11
  text-align: left;
12
12
  align-items: flex-start;
@@ -0,0 +1 @@
1
+ import{r as o}from"./vendor-react-Dvs43sk9.js";import{X as t}from"./index-6LL6v88e.js";function s(){return o.useContext(t)}export{s as u};
@@ -1,4 +1,4 @@
1
- import{D as h,j as t,aY as u,aT as f,at as g,ak as j}from"./vendor-mui-core-CnXrAOs3.js";import{c as S,N as y,e as E,S as N}from"./index-FASRIZyi.js";import{C as P}from"./config-space-DAd9qYRh.js";import{H as b}from"./addon-CS6YZSHC.js";import{P as W,L as v}from"./vendor-arcblock-DVRwGBYP.js";import{u as L,W as k}from"./wizard-components-DxHb4Zui.js";import"./vendor-react-Dvs43sk9.js";import"./vendor-ux-DtnxszG_.js";import"./vendor-utils-cJEl_UEd.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";import"./spaces-BH2l_OkZ.js";import"./api-Btn0Tp3W.js";import"./question-mark-circle.svg-B4stD6SS.js";import"./get-safe-url-BFcRpP-P.js";import"./use-server-logo-n_aaKVoZ.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./use-mobile-maRlSUwU.js";function Q(){const s=h(),a=`${S.WELLKNOWN_SERVICE_PATH_PREFIX}/setup`,{meta:e,blocklet:o,launcherSession:r,steps:i,stepIndex:l,totalSteps:p,logoUrl:n,logo:m,t:d,onNext:c,onPrevious:x}=L(a);return t.jsx(W,{steps:p,children:t.jsx(y,{children:t.jsxs(P,{children:[t.jsx(u,{styles:w}),t.jsx(C,{children:t.jsx(v,{locale:"zh",loading:!1,blockletMeta:{...e,title:E.getDisplayName({...o,meta:e})},navLogo:m,pcWidth:"80%",style:{height:"100%"},logoUrl:n,useOfSkeleton:!1,extraNav:null,headerEndAddons:t.jsx(b,{SessionContext:N,sessionManagerProps:{disableLogout:!0}}),theme:s,launchingText:d("setup.title"),children:t.jsx(k,{blocklet:o,stepIndex:l,steps:i,onNext:c,onPrevious:x,launcherSession:r})})})]})})})}const w=f`
1
+ import{D as h,j as t,aY as u,aT as f,at as g,ak as j}from"./vendor-mui-core-CnXrAOs3.js";import{c as S,N as y,e as E,S as N}from"./index-6LL6v88e.js";import{C as P}from"./config-space-ElduyMIL.js";import{H as b}from"./addon-TGRc2Vdh.js";import{P as W,L as v}from"./vendor-arcblock-DVRwGBYP.js";import{u as L,W as k}from"./wizard-components-D-b0Baer.js";import"./vendor-react-Dvs43sk9.js";import"./vendor-ux-DtnxszG_.js";import"./vendor-utils-cJEl_UEd.js";import"./vendor-hooks-CjESGRlR.js";import"./lottie-web-4koyQiv_.js";import"./spaces-C9G07rtA.js";import"./api-Btn0Tp3W.js";import"./question-mark-circle.svg-B4stD6SS.js";import"./get-safe-url-D_AWm5Av.js";import"./use-server-logo-n_aaKVoZ.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./use-mobile-maRlSUwU.js";function Q(){const s=h(),a=`${S.WELLKNOWN_SERVICE_PATH_PREFIX}/setup`,{meta:e,blocklet:o,launcherSession:r,steps:i,stepIndex:l,totalSteps:p,logoUrl:n,logo:m,t:d,onNext:c,onPrevious:x}=L(a);return t.jsx(W,{steps:p,children:t.jsx(y,{children:t.jsxs(P,{children:[t.jsx(u,{styles:w}),t.jsx(C,{children:t.jsx(v,{locale:"zh",loading:!1,blockletMeta:{...e,title:E.getDisplayName({...o,meta:e})},navLogo:m,pcWidth:"80%",style:{height:"100%"},logoUrl:n,useOfSkeleton:!1,extraNav:null,headerEndAddons:t.jsx(b,{SessionContext:N,sessionManagerProps:{disableLogout:!0}}),theme:s,launchingText:d("setup.title"),children:t.jsx(k,{blocklet:o,stepIndex:l,steps:i,onNext:c,onPrevious:x,launcherSession:r})})})]})})})}const w=f`
2
2
  html,
3
3
  body,
4
4
  #app,
@@ -1 +1 @@
1
- import{j as e,y,x as S,bc as I,M as c,ak as n,U as O,T as f,bw as T,F as W,W as r}from"./vendor-mui-core-CnXrAOs3.js";import{l as z}from"./arrow-down.svg-D6V-7qfa.js";function M({fullWidth:m=!1,multiple:a=!1,required:o=!1,label:d="",placeholer:j="",options:t=[],helperText:b="",error:v=!1,margin:p="",size:u,...h}){const g=t.find(l=>l.value===h.value)?.title;return e.jsxs(y,{margin:p,fullWidth:m,error:v,children:[e.jsx(S,{size:u,children:`${d}${o?"*":""}`}),e.jsxs(I,{multiple:a,sx:{"& .MuiInputBase-input":{width:"calc(100% - 46px)","& > .MuiBox-root:first-of-type":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},input:e.jsx(T,{defaultValue:g,sx:{flex:1},required:o,label:d,inputProps:{margin:p},size:u}),renderValue:l=>{if(a)return e.jsx(n,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:l.map(i=>{const x=t.find(w=>w.value===i);return x&&x.title&&e.jsx(O,{size:"small",label:x.title},i)})});const s=t.find(i=>i.value===l);return s&&s.title&&e.jsxs(n,{children:[e.jsx(f,{component:"span",children:s.title}),e.jsx(f,{component:"span",variant:"body2",sx:{marginLeft:1,color:"text.secondary"},children:s.description})]})},IconComponent:l=>e.jsx(z,{...l,width:20,height:20}),...h,children:[e.jsx(c,{disabled:!0,children:e.jsx("em",{children:j})}),!o&&!a&&e.jsx(c,{value:"",children:"None"}),t.map(l=>l&&l.value&&e.jsx(c,{value:l.value,children:e.jsxs(n,{children:[e.jsx("span",{children:l.title}),l.description&&e.jsx(n,{sx:{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal"},children:l.description})]})},l.value))]}),e.jsx(W,{children:b})]})}M.propTypes={error:r.bool,required:r.bool,multiple:r.bool,fullWidth:r.bool,label:r.string,placeholer:r.string,options:r.array,helperText:r.string,margin:r.string,size:r.string,textDirection:r.oneOf("row","column")};export{M as S};
1
+ import{j as e,y,x as S,bc as I,M as c,ak as n,U as O,T as f,bw as T,F as W,W as r}from"./vendor-mui-core-CnXrAOs3.js";import{l as z}from"./arrow-down.svg-MODRFVx5.js";function M({fullWidth:m=!1,multiple:a=!1,required:o=!1,label:d="",placeholer:j="",options:t=[],helperText:b="",error:v=!1,margin:p="",size:u,...h}){const g=t.find(l=>l.value===h.value)?.title;return e.jsxs(y,{margin:p,fullWidth:m,error:v,children:[e.jsx(S,{size:u,children:`${d}${o?"*":""}`}),e.jsxs(I,{multiple:a,sx:{"& .MuiInputBase-input":{width:"calc(100% - 46px)","& > .MuiBox-root:first-of-type":{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}}},input:e.jsx(T,{defaultValue:g,sx:{flex:1},required:o,label:d,inputProps:{margin:p},size:u}),renderValue:l=>{if(a)return e.jsx(n,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:l.map(i=>{const x=t.find(w=>w.value===i);return x&&x.title&&e.jsx(O,{size:"small",label:x.title},i)})});const s=t.find(i=>i.value===l);return s&&s.title&&e.jsxs(n,{children:[e.jsx(f,{component:"span",children:s.title}),e.jsx(f,{component:"span",variant:"body2",sx:{marginLeft:1,color:"text.secondary"},children:s.description})]})},IconComponent:l=>e.jsx(z,{...l,width:20,height:20}),...h,children:[e.jsx(c,{disabled:!0,children:e.jsx("em",{children:j})}),!o&&!a&&e.jsx(c,{value:"",children:"None"}),t.map(l=>l&&l.value&&e.jsx(c,{value:l.value,children:e.jsxs(n,{children:[e.jsx("span",{children:l.title}),l.description&&e.jsx(n,{sx:{maxWidth:510,fontSize:12,color:"#999",whiteSpace:"normal"},children:l.description})]})},l.value))]}),e.jsx(W,{children:b})]})}M.propTypes={error:r.bool,required:r.bool,multiple:r.bool,fullWidth:r.bool,label:r.string,placeholer:r.string,options:r.array,helperText:r.string,margin:r.string,size:r.string,textDirection:r.oneOf("row","column")};export{M as S};
@@ -1 +1 @@
1
- import{X as u,Y as i}from"./index-FASRIZyi.js";import{I as l,C as s,J as f,F as m}from"./vendor-utils-cJEl_UEd.js";import{a as o}from"./api-Btn0Tp3W.js";function P(t){const e=t.replace(/\/api\/space\/.+/,""),a=t.replace(/\/$/,"").split("/"),r=a.at(-4),n=a.at(-2);return s(e,"space",r,"apps",n,`explorer?key=/apps/${n}/.did-objects/${n}/`)}function U(t){const e=t.replace(/\/api\/space\/.+/,""),r=t.replace(/\/$/,"").split("/").at(-4);return s(e,"space",r)}function h(t){return t.replace(/\/$/,"").split("/").at(-4)}async function L(t){try{if(!i(t))return!1;const{headers:e}=await o.head(t,{timeout:5e3});return e["x-listable"]==="true"&&e["x-readable"]==="true"&&e["x-writeable"]==="true"}catch(e){return console.error(e),!1}}function _(t){return t?.find(e=>e.key===u.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT)?.value||""}function y(t){return t?.replace(/\/api\/space\/.+/,"")}function E(t){const e=new URL(t);return s(e.origin,e.pathname)}async function A(t){try{if(!i(t))return!1;const e=E(t),a=s(e,"space/api/did/one-click-authorization/token"),{status:r,data:n}=await o.get(a,{timeout:5e3});return r===200&&m(n)}catch(e){return console.error(e),!1}}async function w(t,{timeout:e}={timeout:3e3}){try{if(!i(t))return"";const{headers:a}=await o.head(t,{timeout:e}),r=a["x-space-name"];return r?decodeURIComponent(r):""}catch(a){return console.error(a),""}}const k=t=>t?.configs?.find(e=>e.key===u.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT)?.value||null;async function x(t){const e={};return e.did=h(t),e.name=await w(t),e.url=y(t),e.endpoint=t,e}async function B(t,e={timeout:3e4,withSearchParams:!0}){if(!l(t))throw new Error(`url(${t}) must be a string`);const a=t.startsWith("http")?t:`https://${t}`,r=new URL(a),{data:n}=await o.get(s(r.origin,"/__blocklet__.js?type=json"),{timeout:e.timeout}),c=n.componentMountPoints.findLast(d=>d.did==="z8iZnaYxnkMD5AKRjTKiCb8pQr1ut8UantAcf")?.mountPoint;if(!c)throw new Error(`MountPoint(${c}) not found`);const p=s(r.origin,c);return e.withSearchParams&&r.searchParams.get("spaceDid")?f(p,{spaceDid:r.searchParams.get("spaceDid")}):p}export{x as a,w as b,_ as c,B as d,h as e,U as f,k as g,P as h,A as i,L as j};
1
+ import{Y as u,Z as i}from"./index-6LL6v88e.js";import{I as l,C as s,J as f,F as m}from"./vendor-utils-cJEl_UEd.js";import{a as o}from"./api-Btn0Tp3W.js";function P(t){const e=t.replace(/\/api\/space\/.+/,""),a=t.replace(/\/$/,"").split("/"),r=a.at(-4),n=a.at(-2);return s(e,"space",r,"apps",n,`explorer?key=/apps/${n}/.did-objects/${n}/`)}function U(t){const e=t.replace(/\/api\/space\/.+/,""),r=t.replace(/\/$/,"").split("/").at(-4);return s(e,"space",r)}function h(t){return t.replace(/\/$/,"").split("/").at(-4)}async function L(t){try{if(!i(t))return!1;const{headers:e}=await o.head(t,{timeout:5e3});return e["x-listable"]==="true"&&e["x-readable"]==="true"&&e["x-writeable"]==="true"}catch(e){return console.error(e),!1}}function _(t){return t?.find(e=>e.key===u.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT)?.value||""}function y(t){return t?.replace(/\/api\/space\/.+/,"")}function E(t){const e=new URL(t);return s(e.origin,e.pathname)}async function A(t){try{if(!i(t))return!1;const e=E(t),a=s(e,"space/api/did/one-click-authorization/token"),{status:r,data:n}=await o.get(a,{timeout:5e3});return r===200&&m(n)}catch(e){return console.error(e),!1}}async function w(t,{timeout:e}={timeout:3e3}){try{if(!i(t))return"";const{headers:a}=await o.head(t,{timeout:e}),r=a["x-space-name"];return r?decodeURIComponent(r):""}catch(a){return console.error(a),""}}const k=t=>t?.configs?.find(e=>e.key===u.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT)?.value||null;async function x(t){const e={};return e.did=h(t),e.name=await w(t),e.url=y(t),e.endpoint=t,e}async function B(t,e={timeout:3e4,withSearchParams:!0}){if(!l(t))throw new Error(`url(${t}) must be a string`);const a=t.startsWith("http")?t:`https://${t}`,r=new URL(a),{data:n}=await o.get(s(r.origin,"/__blocklet__.js?type=json"),{timeout:e.timeout}),c=n.componentMountPoints.findLast(d=>d.did==="z8iZnaYxnkMD5AKRjTKiCb8pQr1ut8UantAcf")?.mountPoint;if(!c)throw new Error(`MountPoint(${c}) not found`);const p=s(r.origin,c);return e.withSearchParams&&r.searchParams.get("spaceDid")?f(p,{spaceDid:r.searchParams.get("spaceDid")}):p}export{x as a,w as b,_ as c,B as d,h as e,U as f,k as g,P as h,A as i,L as j};
@@ -1,4 +1,4 @@
1
- import{D as V,J as q,j as t,a6 as G,aY as X,ak as c,aZ as Q,at as z,aT as J,P as Y,a_ as Z,a$ as ee,W as w}from"./vendor-mui-core-CnXrAOs3.js";import{r as f,L as H}from"./vendor-react-Dvs43sk9.js";import{l as te,a as N}from"./vendor-hooks-CjESGRlR.js";import{C as E}from"./vendor-utils-cJEl_UEd.js";import{V as F,H as U,o as ne,n as _,$ as oe,M as re}from"./vendor-ux-DtnxszG_.js";import{W as se}from"./did-address-CZak4Nzl.js";import{o as ie,s as ae}from"./vendor-arcblock-DVRwGBYP.js";import{d as L,e as g,f as B,h as le,i as ce,j as D,S as de,c as T,a as pe,l as me,m as he,n as ue,P as ge,o as P,p as fe,q as W}from"./index-FASRIZyi.js";import{H as xe}from"./addon-CS6YZSHC.js";import{u as be}from"./use-server-logo-n_aaKVoZ.js";import{g as A}from"./get-safe-url-BFcRpP-P.js";import{O as ke}from"./over-due-invoice-payment-Bk50hmsa.js";import{p as je,S as ye,P as we}from"./starting-progress-bX2MhHI_.js";import"./lottie-web-4koyQiv_.js";import"./question-mark-circle.svg-B4stD6SS.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./use-mobile-maRlSUwU.js";function K({appInfo:e,...r}){const[n,s]=f.useState(!1),l=q(x=>x.breakpoints.down("md"))?32:48;return n?t.jsx(oe,{did:e.publisher,size:l}):t.jsx(re,{src:e.icon,alt:e.title,width:l,height:l,...r,onError:()=>s(!0)})}K.propTypes={appInfo:w.object.isRequired};const M=(e,r)=>g.findComponentByIdV2(e,r)||e;function Fe(){const{t:e,locale:r}=F(),[n,s]=te({blocklet:null,component:null,launcherSession:null,loading:!1,starting:!1,manageSubscriptionURL:"",restart:!1}),a=localStorage.getItem("blocklet-server-url"),l=be({onClick:()=>{a&&window.open(A(a,{allowDomains:null}))}}),x=new URL(window.location.href),v=x.searchParams.get("componentId"),$=V(),y=q(o=>o.breakpoints.down("md")),b=()=>{const o=x.searchParams.get("redirect")||"/";window.location.href=A(decodeURIComponent(o))},k=()=>{const o=setInterval(()=>{L.get("/blocklet/detail?nocache=1").then(({data:i})=>{s(R=>({...R,blocklet:i}));const d=M(i,v);if(g.isBlockletRunning(d)){b();return}d.status!=="starting"&&!n.restart&&(s({blocklet:i,starting:!1}),i!==d&&s({component:d}),clearInterval(o))}).catch(i=>{s({loading:!1,restart:!1}),U.error(i.message)})},3e3)},C=()=>{s({restart:!0,starting:!0,loading:!0}),setTimeout(()=>{k()},10)};f.useEffect(()=>{s({loading:!0}),L.get("/blocklet/detail?nocache=1").then(({data:o})=>{const i=M(o,v);if(s({blocklet:o,loading:!1}),g.isBlockletRunning(i)){b();return}s({blocklet:o}),o!==i&&s({component:i}),i.status==="starting"&&(s({starting:!0}),k())}).catch(o=>{s({loading:!1}),U.error(o.message)})},[]);const h=f.useCallback(()=>{s({loading:!0,starting:!0});const o=n.blocklet;if(!o)return;const i={did:o?.meta.did};o.children.length>0&&(i.componentDids=o.children.map(d=>d.meta.did)),B.startBlocklet({input:i}).then(({blocklet:d})=>{s(R=>({...R,blocklet:d})),k()}).catch(d=>{U.error(d.message),s({loading:!1,starting:!1})})},[n.component,n.blocklet]);f.useEffect(()=>{n.blocklet?.controller&&(le({launcherUrl:n.blocklet.controller.launcherUrl,launcherSessionId:n.blocklet.controller.launcherSessionId,locale:r}).then(o=>{s({manageSubscriptionURL:o})}).catch(o=>{console.error("get manage subscription url error",o)}),B.getLauncherSession({input:{launcherSessionId:n.blocklet.controller.launcherSessionId,launcherUrl:n.blocklet.controller.launcherUrl}}).then(o=>{s({launcherSession:o.launcherSession})}).catch(o=>{console.error("get launcher session error",o)}))},[n.blocklet?.controller]);const p=N(()=>n.blocklet?.children?.length,[n.blocklet]),m=N(()=>n.blocklet?.children?.filter(o=>g.isBlockletRunning(o))?.length||0,[n.blocklet]),j=N(()=>p?m?Math.round(Math.max(m/p,.15)*100):5:0,[m,p]);if(!n.blocklet)return t.jsx(ie,{children:t.jsx(G,{})});const u={icon:`${T.WELLKNOWN_SERVICE_PATH_PREFIX}/blocklet/logo`,title:g.getDisplayName(n.blocklet),publisher:n.blocklet.appDid},I=ne(je,n.starting?{width:`${j}%`,"&::after":{width:`${j}%`},"&::before":{width:`${j}%`,animation:"shimmer 1s infinite cubic-bezier(0.4, 0.0, 0.2, 1)","@keyframes shimmer":{"0%":{width:0},"100%":{width:`${j}%`}}}}:{}),S=ce(n.blocklet)||D(n.launcherSession);return t.jsxs(Se,{children:[t.jsx(X,{styles:ve}),t.jsxs("header",{className:"root-header",children:[y?null:t.jsx("div",{className:"left",children:l}),t.jsx(ae,{sx:{background:y?$.palette.background.default:"transparent",display:"flex",alignItems:"center",justifyContent:"flex-end"},children:t.jsx(xe,{SessionContext:de})})]}),t.jsxs(Pe,{elevation:0,children:[t.jsxs(_e,{children:[t.jsx(K,{appInfo:u}),t.jsxs("div",{className:"app-info_content",children:[t.jsx(c,{className:"app-info_name",children:u.title}),t.jsx(se,{size:14,className:"app-info_did",did:u.publisher})]})]}),(n.restart||!S)&&t.jsxs(t.Fragment,{children:[t.jsxs(c,{className:"title-box",children:[t.jsx(c,{className:"icon",children:t.jsx(Q,{})}),t.jsx(c,{className:"title",children:e("blocklet.startApplication")})]}),t.jsx(c,{className:"sub-title",children:n.starting?t.jsx(ye,{blocklets:n.blocklet?.children??[]}):e("blocklet.startDescription",{name:n.component?g.getDisplayName(n.component,!0):g.getDisplayName(n.blocklet)})}),t.jsx(c,{sx:{mt:8,display:"flex",flexDirection:"column",alignItems:"center",gap:1},children:t.jsx(we,{blocklets:n.blocklet?.children??[],status:n.starting?"starting":"",children:t.jsx(_,{sx:I,disabled:n.loading||n.starting,variant:"contained",color:"primary",size:"large",loading:n.starting,onClick:()=>h(),children:t.jsx("span",{style:{position:"relative",zIndex:2},children:n.starting?`(${m}/${p}) ${e("blocklet.starting")}`:e("blocklet.start")})})})})]}),S&&!n.restart&&t.jsx(O,{blocklet:n.blocklet,launcherSession:n.launcherSession,manageSubscriptionURL:n.manageSubscriptionURL,handleRestart:C}),t.jsx(c,{sx:{mt:5},children:t.jsx(H,{className:"footer-link",to:`${T.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/overview`,children:e("blocklet.dashboard")})})]})]})}function O({blocklet:e,launcherSession:r,manageSubscriptionURL:n,handleRestart:s}){const{t:a,locale:l}=F(),{connectApi:x,session:v}=pe(),{refreshSubscription:$}=me(),[y,b]=f.useState(!1),[k,C]=f.useState("");if(f.useEffect(()=>{if(e?.controller?.launcherUrl&&D(r)){const j=E(e.controller.launcherUrl,"__blocklet__.js?type=json");fetch(j).then(u=>u.json()).then(u=>{const I=u.componentMountPoints?.find(o=>o.did==="z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk")?.mountPoint,S=E(e.controller.launcherUrl,I);C(S)})}},[e?.controller?.launcherUrl,r]),!e||!r)return"";const h=D(r),p=!h&&he(e,r),m=!h&&ue(e,r);return!p&&!m&&!h?"":t.jsxs(t.Fragment,{children:[y&&k&&r&&t.jsx(ge,{session:v,connect:x,baseUrl:k,authToken:r.subscription.authToken,children:t.jsx(ke,{dialogProps:{open:y,onClose:()=>b(!1)},subscriptionId:r.subscription.id,successToast:!0,onPaid:()=>{L.post("/blocklet/start?fromSetup=1"),$(),s(),b(!1)}})}),t.jsxs(c,{className:"title-box",children:[t.jsx(Z,{className:"icon-error"}),t.jsxs(c,{className:"title error",children:[p&&a("blocklet.suspended"),m&&a("blocklet.terminated"),h&&a("blocklet.suspended")]})]}),t.jsxs(c,{className:"sub-title",children:[p&&a("blocklet.suspendedCausedByExpired",{deadline:P(r?.reservedUntil,l),canceledAt:P((r?.subscription?.canceled_at||0)*1e3,l)}),m&&a("blocklet.suspendedCausedByTerminated",{canceledAt:P(r?.terminatedAt,l),deadline:fe(r?.terminatedAt,l)}),h&&a("blocklet.suspendedCausedByPastDue",{deadline:P(r?.reservedUntil,l)})]}),t.jsxs(c,{sx:{mt:8},children:[h&&!W(r)&&t.jsx(_,{style:{minWidth:200},variant:"contained",color:"primary",size:"large",onClick:()=>b(!0),children:a("blocklet.payNow")}),(p||W(r))&&t.jsx(_,{component:ee,style:{minWidth:200},variant:"contained",color:"primary",size:"large",target:"_blank",href:n||"#",children:a("blocklet.manageSubscription")}),m&&t.jsx(_,{component:H,to:E(T.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin/did-spaces"),style:{minWidth:200},variant:"contained",color:"primary",size:"large",children:a("common.backup")})]})]})}O.propTypes={blocklet:w.object.isRequired,launcherSession:w.object.isRequired,manageSubscriptionURL:w.string.isRequired,handleRestart:w.func.isRequired};const ve=J`
1
+ import{D as V,J as q,j as t,a6 as G,aY as X,ak as c,aZ as Q,at as z,aT as J,P as Y,a_ as Z,a$ as ee,W as w}from"./vendor-mui-core-CnXrAOs3.js";import{r as f,L as H}from"./vendor-react-Dvs43sk9.js";import{l as te,a as N}from"./vendor-hooks-CjESGRlR.js";import{C as E}from"./vendor-utils-cJEl_UEd.js";import{V as F,H as U,o as ne,n as _,$ as oe,M as re}from"./vendor-ux-DtnxszG_.js";import{W as se}from"./did-address-CZak4Nzl.js";import{o as ie,s as ae}from"./vendor-arcblock-DVRwGBYP.js";import{d as L,e as g,f as B,h as le,i as ce,j as D,S as de,c as T,a as pe,l as me,m as he,n as ue,P as ge,o as P,p as fe,q as W}from"./index-6LL6v88e.js";import{H as xe}from"./addon-TGRc2Vdh.js";import{u as be}from"./use-server-logo-n_aaKVoZ.js";import{g as A}from"./get-safe-url-D_AWm5Av.js";import{O as ke}from"./over-due-invoice-payment-CsPpOI2s.js";import{p as je,S as ye,P as we}from"./starting-progress-CvdorBgk.js";import"./lottie-web-4koyQiv_.js";import"./question-mark-circle.svg-B4stD6SS.js";import"./server-logo-notext.svg-CKQB0tIp.js";import"./use-mobile-maRlSUwU.js";function K({appInfo:e,...r}){const[n,s]=f.useState(!1),l=q(x=>x.breakpoints.down("md"))?32:48;return n?t.jsx(oe,{did:e.publisher,size:l}):t.jsx(re,{src:e.icon,alt:e.title,width:l,height:l,...r,onError:()=>s(!0)})}K.propTypes={appInfo:w.object.isRequired};const M=(e,r)=>g.findComponentByIdV2(e,r)||e;function Fe(){const{t:e,locale:r}=F(),[n,s]=te({blocklet:null,component:null,launcherSession:null,loading:!1,starting:!1,manageSubscriptionURL:"",restart:!1}),a=localStorage.getItem("blocklet-server-url"),l=be({onClick:()=>{a&&window.open(A(a,{allowDomains:null}))}}),x=new URL(window.location.href),v=x.searchParams.get("componentId"),$=V(),y=q(o=>o.breakpoints.down("md")),b=()=>{const o=x.searchParams.get("redirect")||"/";window.location.href=A(decodeURIComponent(o))},k=()=>{const o=setInterval(()=>{L.get("/blocklet/detail?nocache=1").then(({data:i})=>{s(R=>({...R,blocklet:i}));const d=M(i,v);if(g.isBlockletRunning(d)){b();return}d.status!=="starting"&&!n.restart&&(s({blocklet:i,starting:!1}),i!==d&&s({component:d}),clearInterval(o))}).catch(i=>{s({loading:!1,restart:!1}),U.error(i.message)})},3e3)},C=()=>{s({restart:!0,starting:!0,loading:!0}),setTimeout(()=>{k()},10)};f.useEffect(()=>{s({loading:!0}),L.get("/blocklet/detail?nocache=1").then(({data:o})=>{const i=M(o,v);if(s({blocklet:o,loading:!1}),g.isBlockletRunning(i)){b();return}s({blocklet:o}),o!==i&&s({component:i}),i.status==="starting"&&(s({starting:!0}),k())}).catch(o=>{s({loading:!1}),U.error(o.message)})},[]);const h=f.useCallback(()=>{s({loading:!0,starting:!0});const o=n.blocklet;if(!o)return;const i={did:o?.meta.did};o.children.length>0&&(i.componentDids=o.children.map(d=>d.meta.did)),B.startBlocklet({input:i}).then(({blocklet:d})=>{s(R=>({...R,blocklet:d})),k()}).catch(d=>{U.error(d.message),s({loading:!1,starting:!1})})},[n.component,n.blocklet]);f.useEffect(()=>{n.blocklet?.controller&&(le({launcherUrl:n.blocklet.controller.launcherUrl,launcherSessionId:n.blocklet.controller.launcherSessionId,locale:r}).then(o=>{s({manageSubscriptionURL:o})}).catch(o=>{console.error("get manage subscription url error",o)}),B.getLauncherSession({input:{launcherSessionId:n.blocklet.controller.launcherSessionId,launcherUrl:n.blocklet.controller.launcherUrl}}).then(o=>{s({launcherSession:o.launcherSession})}).catch(o=>{console.error("get launcher session error",o)}))},[n.blocklet?.controller]);const p=N(()=>n.blocklet?.children?.length,[n.blocklet]),m=N(()=>n.blocklet?.children?.filter(o=>g.isBlockletRunning(o))?.length||0,[n.blocklet]),j=N(()=>p?m?Math.round(Math.max(m/p,.15)*100):5:0,[m,p]);if(!n.blocklet)return t.jsx(ie,{children:t.jsx(G,{})});const u={icon:`${T.WELLKNOWN_SERVICE_PATH_PREFIX}/blocklet/logo`,title:g.getDisplayName(n.blocklet),publisher:n.blocklet.appDid},I=ne(je,n.starting?{width:`${j}%`,"&::after":{width:`${j}%`},"&::before":{width:`${j}%`,animation:"shimmer 1s infinite cubic-bezier(0.4, 0.0, 0.2, 1)","@keyframes shimmer":{"0%":{width:0},"100%":{width:`${j}%`}}}}:{}),S=ce(n.blocklet)||D(n.launcherSession);return t.jsxs(Se,{children:[t.jsx(X,{styles:ve}),t.jsxs("header",{className:"root-header",children:[y?null:t.jsx("div",{className:"left",children:l}),t.jsx(ae,{sx:{background:y?$.palette.background.default:"transparent",display:"flex",alignItems:"center",justifyContent:"flex-end"},children:t.jsx(xe,{SessionContext:de})})]}),t.jsxs(Pe,{elevation:0,children:[t.jsxs(_e,{children:[t.jsx(K,{appInfo:u}),t.jsxs("div",{className:"app-info_content",children:[t.jsx(c,{className:"app-info_name",children:u.title}),t.jsx(se,{size:14,className:"app-info_did",did:u.publisher})]})]}),(n.restart||!S)&&t.jsxs(t.Fragment,{children:[t.jsxs(c,{className:"title-box",children:[t.jsx(c,{className:"icon",children:t.jsx(Q,{})}),t.jsx(c,{className:"title",children:e("blocklet.startApplication")})]}),t.jsx(c,{className:"sub-title",children:n.starting?t.jsx(ye,{blocklets:n.blocklet?.children??[]}):e("blocklet.startDescription",{name:n.component?g.getDisplayName(n.component,!0):g.getDisplayName(n.blocklet)})}),t.jsx(c,{sx:{mt:8,display:"flex",flexDirection:"column",alignItems:"center",gap:1},children:t.jsx(we,{blocklets:n.blocklet?.children??[],status:n.starting?"starting":"",children:t.jsx(_,{sx:I,disabled:n.loading||n.starting,variant:"contained",color:"primary",size:"large",loading:n.starting,onClick:()=>h(),children:t.jsx("span",{style:{position:"relative",zIndex:2},children:n.starting?`(${m}/${p}) ${e("blocklet.starting")}`:e("blocklet.start")})})})})]}),S&&!n.restart&&t.jsx(O,{blocklet:n.blocklet,launcherSession:n.launcherSession,manageSubscriptionURL:n.manageSubscriptionURL,handleRestart:C}),t.jsx(c,{sx:{mt:5},children:t.jsx(H,{className:"footer-link",to:`${T.WELLKNOWN_SERVICE_PATH_PREFIX}/admin/overview`,children:e("blocklet.dashboard")})})]})]})}function O({blocklet:e,launcherSession:r,manageSubscriptionURL:n,handleRestart:s}){const{t:a,locale:l}=F(),{connectApi:x,session:v}=pe(),{refreshSubscription:$}=me(),[y,b]=f.useState(!1),[k,C]=f.useState("");if(f.useEffect(()=>{if(e?.controller?.launcherUrl&&D(r)){const j=E(e.controller.launcherUrl,"__blocklet__.js?type=json");fetch(j).then(u=>u.json()).then(u=>{const I=u.componentMountPoints?.find(o=>o.did==="z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk")?.mountPoint,S=E(e.controller.launcherUrl,I);C(S)})}},[e?.controller?.launcherUrl,r]),!e||!r)return"";const h=D(r),p=!h&&he(e,r),m=!h&&ue(e,r);return!p&&!m&&!h?"":t.jsxs(t.Fragment,{children:[y&&k&&r&&t.jsx(ge,{session:v,connect:x,baseUrl:k,authToken:r.subscription.authToken,children:t.jsx(ke,{dialogProps:{open:y,onClose:()=>b(!1)},subscriptionId:r.subscription.id,successToast:!0,onPaid:()=>{L.post("/blocklet/start?fromSetup=1"),$(),s(),b(!1)}})}),t.jsxs(c,{className:"title-box",children:[t.jsx(Z,{className:"icon-error"}),t.jsxs(c,{className:"title error",children:[p&&a("blocklet.suspended"),m&&a("blocklet.terminated"),h&&a("blocklet.suspended")]})]}),t.jsxs(c,{className:"sub-title",children:[p&&a("blocklet.suspendedCausedByExpired",{deadline:P(r?.reservedUntil,l),canceledAt:P((r?.subscription?.canceled_at||0)*1e3,l)}),m&&a("blocklet.suspendedCausedByTerminated",{canceledAt:P(r?.terminatedAt,l),deadline:fe(r?.terminatedAt,l)}),h&&a("blocklet.suspendedCausedByPastDue",{deadline:P(r?.reservedUntil,l)})]}),t.jsxs(c,{sx:{mt:8},children:[h&&!W(r)&&t.jsx(_,{style:{minWidth:200},variant:"contained",color:"primary",size:"large",onClick:()=>b(!0),children:a("blocklet.payNow")}),(p||W(r))&&t.jsx(_,{component:ee,style:{minWidth:200},variant:"contained",color:"primary",size:"large",target:"_blank",href:n||"#",children:a("blocklet.manageSubscription")}),m&&t.jsx(_,{component:H,to:E(T.WELLKNOWN_SERVICE_PATH_PREFIX,"/admin/did-spaces"),style:{minWidth:200},variant:"contained",color:"primary",size:"large",children:a("common.backup")})]})]})}O.propTypes={blocklet:w.object.isRequired,launcherSession:w.object.isRequired,manageSubscriptionURL:w.string.isRequired,handleRestart:w.func.isRequired};const ve=J`
2
2
  html,
3
3
  body,
4
4
  #app,
@@ -1,4 +1,4 @@
1
- import{j as o,b1 as f,at as w,ao as R,T as S,W as d}from"./vendor-mui-core-CnXrAOs3.js";import{r as a}from"./vendor-react-Dvs43sk9.js";import{a as m,h as j}from"./vendor-hooks-CjESGRlR.js";import{V as h}from"./vendor-ux-DtnxszG_.js";import{e as C}from"./index-FASRIZyi.js";const I=1e3;function x({blocklet:t}){const{meta:u}=t,{t:i}=h(),[l,s]=a.useState("starting"),[p,e]=a.useState(t.status),r=m(()=>{const c=u.title||u.name;return{starting:i("blocklet.startingProgress.starting",{name:c}),running:i("blocklet.startingProgress.success",{name:c}),stopped:i("blocklet.startingProgress.failed",{name:c}),error:i("blocklet.startingProgress.failed",{name:c})}},[i,u]);a.useEffect(()=>{p!==t.status&&(s(t.status),e(""))},[t.status,p]),j(()=>{e(t.status),C.isBlockletRunning(t)&&s(t.status)});const n=m(()=>l==="running"?R[600]:["stopped","error"].includes(l)?"error":"primary",[l]);return o.jsx(S,{display:"flex",alignItems:"center",fontSize:14,lineHeight:1,gap:1,color:n,children:r[l]})}x.propTypes={blocklet:d.object.isRequired};function P({blocklets:t=[],children:u,debounce:i=!0,status:l=""}){const[s,p]=a.useState(null),[e,r]=a.useState(0),n=a.useRef(null),c=a.useRef(!1);a.useEffect(()=>{if(s&&n.current){const g=n.current.style.display;n.current.style.display="flex",r(n.current.offsetHeight),n.current.style.display=g}},[s,t]);const b=a.useMemo(()=>l==="starting"?o.jsx(f,{ref:n,display:"flex",flexDirection:"column",gap:.5,maxHeight:200,sx:{overflowY:"auto",p:2,display:s?"flex":"none",position:"fixed",top:s?s.getBoundingClientRect().top-10-e:0,left:s?s.getBoundingClientRect().left+s.offsetWidth/2:0,transform:"translateX(-50%)",backgroundColor:"white",boxShadow:"0px 2px 4px rgba(0,0,0,0.1)",borderRadius:"4px",zIndex:1300},children:t.map(g=>o.jsx(x,{blocklet:g},g.meta.did))}):null,[t,s,e,l]),y=g=>{(c.current||!i)&&(p(g.currentTarget),c.current=!1)},v=()=>{p(null),l==="starting"&&(c.current=!0)};return o.jsxs(o.Fragment,{children:[o.jsx("span",{onMouseEnter:y,onMouseLeave:v,style:{cursor:"pointer"},children:u}),b]})}P.propTypes={blocklets:d.array.isRequired,children:d.node.isRequired,debounce:d.bool,status:d.string};function E({blocklets:t=[]}){const{t:u}=h(),[i,l]=a.useState(0),s=m(()=>t.length===0?[]:t.map(e=>{const r=e.meta.title||e.meta.name;return e.status==="running"?null:`${u("blocklet.startingProgress.starting",{name:r})}`}).filter(Boolean),[t,u]);if(a.useEffect(()=>{if(!s.length)return;let e=0;const r=setInterval(()=>{e++,e>=s.length&&(e=0),l(e)},I);return()=>{clearInterval(r)}},[s]),t.length===0)return null;const p=e=>{let r="message-before";return i===e?r="show-message":i<e&&(r="message-after"),r};return o.jsx(z,{direction:"column",alignItems:"center",justifyContent:"center",gap:1,children:o.jsx("div",{className:"waiter-message",children:s.map((e,r)=>{const n=p(r);return o.jsxs("div",{children:[o.jsx("span",{className:`message-block ${n}`,children:e}),o.jsx("span",{className:`placeholder-message ${n}`,children:e})]},r)})})})}E.propTypes={blocklets:d.array.isRequired};const z=w(f)`
1
+ import{j as o,b1 as f,at as w,ao as R,T as S,W as d}from"./vendor-mui-core-CnXrAOs3.js";import{r as a}from"./vendor-react-Dvs43sk9.js";import{a as m,h as j}from"./vendor-hooks-CjESGRlR.js";import{V as h}from"./vendor-ux-DtnxszG_.js";import{e as C}from"./index-6LL6v88e.js";const I=1e3;function x({blocklet:t}){const{meta:u}=t,{t:i}=h(),[l,s]=a.useState("starting"),[p,e]=a.useState(t.status),r=m(()=>{const c=u.title||u.name;return{starting:i("blocklet.startingProgress.starting",{name:c}),running:i("blocklet.startingProgress.success",{name:c}),stopped:i("blocklet.startingProgress.failed",{name:c}),error:i("blocklet.startingProgress.failed",{name:c})}},[i,u]);a.useEffect(()=>{p!==t.status&&(s(t.status),e(""))},[t.status,p]),j(()=>{e(t.status),C.isBlockletRunning(t)&&s(t.status)});const n=m(()=>l==="running"?R[600]:["stopped","error"].includes(l)?"error":"primary",[l]);return o.jsx(S,{display:"flex",alignItems:"center",fontSize:14,lineHeight:1,gap:1,color:n,children:r[l]})}x.propTypes={blocklet:d.object.isRequired};function P({blocklets:t=[],children:u,debounce:i=!0,status:l=""}){const[s,p]=a.useState(null),[e,r]=a.useState(0),n=a.useRef(null),c=a.useRef(!1);a.useEffect(()=>{if(s&&n.current){const g=n.current.style.display;n.current.style.display="flex",r(n.current.offsetHeight),n.current.style.display=g}},[s,t]);const b=a.useMemo(()=>l==="starting"?o.jsx(f,{ref:n,display:"flex",flexDirection:"column",gap:.5,maxHeight:200,sx:{overflowY:"auto",p:2,display:s?"flex":"none",position:"fixed",top:s?s.getBoundingClientRect().top-10-e:0,left:s?s.getBoundingClientRect().left+s.offsetWidth/2:0,transform:"translateX(-50%)",backgroundColor:"white",boxShadow:"0px 2px 4px rgba(0,0,0,0.1)",borderRadius:"4px",zIndex:1300},children:t.map(g=>o.jsx(x,{blocklet:g},g.meta.did))}):null,[t,s,e,l]),y=g=>{(c.current||!i)&&(p(g.currentTarget),c.current=!1)},v=()=>{p(null),l==="starting"&&(c.current=!0)};return o.jsxs(o.Fragment,{children:[o.jsx("span",{onMouseEnter:y,onMouseLeave:v,style:{cursor:"pointer"},children:u}),b]})}P.propTypes={blocklets:d.array.isRequired,children:d.node.isRequired,debounce:d.bool,status:d.string};function E({blocklets:t=[]}){const{t:u}=h(),[i,l]=a.useState(0),s=m(()=>t.length===0?[]:t.map(e=>{const r=e.meta.title||e.meta.name;return e.status==="running"?null:`${u("blocklet.startingProgress.starting",{name:r})}`}).filter(Boolean),[t,u]);if(a.useEffect(()=>{if(!s.length)return;let e=0;const r=setInterval(()=>{e++,e>=s.length&&(e=0),l(e)},I);return()=>{clearInterval(r)}},[s]),t.length===0)return null;const p=e=>{let r="message-before";return i===e?r="show-message":i<e&&(r="message-after"),r};return o.jsx(z,{direction:"column",alignItems:"center",justifyContent:"center",gap:1,children:o.jsx("div",{className:"waiter-message",children:s.map((e,r)=>{const n=p(r);return o.jsxs("div",{children:[o.jsx("span",{className:`message-block ${n}`,children:e}),o.jsx("span",{className:`placeholder-message ${n}`,children:e})]},r)})})})}E.propTypes={blocklets:d.array.isRequired};const z=w(f)`
2
2
  .waiter-message {
3
3
  position: relative;
4
4
  width: 100%;
@@ -1 +1 @@
1
- import{r as b}from"./vendor-react-Dvs43sk9.js";import{j as p,a6 as P,am as w,bZ as j,b_ as k,W as $}from"./vendor-mui-core-CnXrAOs3.js";import{l as q}from"./vendor-hooks-CjESGRlR.js";import{B as d}from"./vendor-utils-cJEl_UEd.js";import{r as x}from"./omit-hhiOJGRf.js";import{aA as V,aB as R}from"./index-FASRIZyi.js";import{O as E,V as D}from"./vendor-ux-DtnxszG_.js";var s={},h;function I(){if(h)return s;h=1;var u=s&&s.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(s,"__esModule",{value:!0}),s.signResponse=l,s.verifyResponse=_,s.verifyVault=S;const m=u(x),v=u(V()),n=R(),a=E();async function l(r,c){const o=(0,v.default)(r),y=await c.sign(o);return{...r,$signature:y}}function _(r,c){return r.$signature?c.verify((0,v.default)((0,m.default)(r,"$signature")),r.$signature):Promise.resolve(!1)}async function S(r,c,o=!1){if(!Array.isArray(r)||r.length===0){if(o)throw new Error("vaults list is empty");return""}for(let t=1;t<r.length;t++)if(r[t].at<=r[t-1].at){if(o)throw new Error("vaults are not in ascending order");return""}if(new Set(r.map(t=>t.did)).size!==r.length){if(o)throw new Error("vaults list has duplicate vaults");return""}for(let t=0;t<r.length;t++){const e=r[t];if(!(0,a.isFromPublicKey)(e.did,e.pk)){if(o)throw new Error(`vault did and pk mismatch: ${e.did}(${e.pk})`);return""}let f=d.from(`vault:${c}`);for(let i=0;i<=t;i++)f=d.concat([f,d.from(`:${r[i].did}`)]);if(!e.approverSig){if(o)throw new Error(`vault approve signature missing for ${e.did}`);return""}try{let i;if(t>0){const g=r[t-1];i=(0,n.fromPublicKey)(g.pk,(0,a.toTypeInfo)(g.did))}else{if(!e.approverPk||!e.approverDid||!(0,a.isFromPublicKey)(e.approverDid,e.approverPk)){if(o)throw new Error(`approver config missing for ${e.did}`);return""}i=(0,n.fromPublicKey)(e.approverPk,(0,a.toTypeInfo)(e.approverDid))}if(await i.verify(f,e.approverSig)===!1){if(o)throw new Error(`signature verify failed for ${e.did}`);return""}}catch(i){if(console.error(i),o)throw new Error(`vault approve verify failed: ${i.message}`);return""}if(!e.sig){if(o)throw new Error(`vault commit signature missing for ${e.did}`);return""}try{const i=(0,n.fromPublicKey)(e.pk,(0,a.toTypeInfo)(e.did));if(e.approverSig&&(f=d.concat([f,d.from(`:${e.approverSig}`)])),await i.verify(f,e.sig)===!1){if(o)throw new Error(`commit signature verify failed for ${e.did}`);return""}}catch(i){if(console.error(i),o)throw new Error(`vault commit verify failed: ${i.message}`);return""}}return r[r.length-1].did}return s}var K=I();function T({vaults:u,appPid:m}){const{t:v}=D(),[n,a]=q({verified:!1,verifying:!0,error:""});return b.useEffect(()=>{K.verifyVault(u,m,!0).then(l=>{a({verified:!!l,verifying:!1})}).catch(l=>{a({verified:!1,verifying:!1,error:l.message})})},[u,m,a]),n.verifying?p.jsx(P,{}):n.verified?p.jsx(w,{title:v("blocklet.config.vault.verified"),children:p.jsx(j,{fontSize:"small",color:"success"})}):p.jsx(w,{title:n.error,children:p.jsx(k,{color:"error"})})}T.propTypes={vaults:$.array.isRequired,appPid:$.string.isRequired};export{T as V};
1
+ import{r as b}from"./vendor-react-Dvs43sk9.js";import{j as p,a6 as P,am as w,bZ as j,b_ as k,W as $}from"./vendor-mui-core-CnXrAOs3.js";import{l as q}from"./vendor-hooks-CjESGRlR.js";import{B as d}from"./vendor-utils-cJEl_UEd.js";import{r as x}from"./omit-hhiOJGRf.js";import{aB as V,aC as R}from"./index-6LL6v88e.js";import{O as E,V as D}from"./vendor-ux-DtnxszG_.js";var s={},h;function I(){if(h)return s;h=1;var u=s&&s.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(s,"__esModule",{value:!0}),s.signResponse=l,s.verifyResponse=_,s.verifyVault=S;const m=u(x),v=u(V()),n=R(),a=E();async function l(r,c){const o=(0,v.default)(r),y=await c.sign(o);return{...r,$signature:y}}function _(r,c){return r.$signature?c.verify((0,v.default)((0,m.default)(r,"$signature")),r.$signature):Promise.resolve(!1)}async function S(r,c,o=!1){if(!Array.isArray(r)||r.length===0){if(o)throw new Error("vaults list is empty");return""}for(let t=1;t<r.length;t++)if(r[t].at<=r[t-1].at){if(o)throw new Error("vaults are not in ascending order");return""}if(new Set(r.map(t=>t.did)).size!==r.length){if(o)throw new Error("vaults list has duplicate vaults");return""}for(let t=0;t<r.length;t++){const e=r[t];if(!(0,a.isFromPublicKey)(e.did,e.pk)){if(o)throw new Error(`vault did and pk mismatch: ${e.did}(${e.pk})`);return""}let f=d.from(`vault:${c}`);for(let i=0;i<=t;i++)f=d.concat([f,d.from(`:${r[i].did}`)]);if(!e.approverSig){if(o)throw new Error(`vault approve signature missing for ${e.did}`);return""}try{let i;if(t>0){const g=r[t-1];i=(0,n.fromPublicKey)(g.pk,(0,a.toTypeInfo)(g.did))}else{if(!e.approverPk||!e.approverDid||!(0,a.isFromPublicKey)(e.approverDid,e.approverPk)){if(o)throw new Error(`approver config missing for ${e.did}`);return""}i=(0,n.fromPublicKey)(e.approverPk,(0,a.toTypeInfo)(e.approverDid))}if(await i.verify(f,e.approverSig)===!1){if(o)throw new Error(`signature verify failed for ${e.did}`);return""}}catch(i){if(console.error(i),o)throw new Error(`vault approve verify failed: ${i.message}`);return""}if(!e.sig){if(o)throw new Error(`vault commit signature missing for ${e.did}`);return""}try{const i=(0,n.fromPublicKey)(e.pk,(0,a.toTypeInfo)(e.did));if(e.approverSig&&(f=d.concat([f,d.from(`:${e.approverSig}`)])),await i.verify(f,e.sig)===!1){if(o)throw new Error(`commit signature verify failed for ${e.did}`);return""}}catch(i){if(console.error(i),o)throw new Error(`vault commit verify failed: ${i.message}`);return""}}return r[r.length-1].did}return s}var K=I();function T({vaults:u,appPid:m}){const{t:v}=D(),[n,a]=q({verified:!1,verifying:!0,error:""});return b.useEffect(()=>{K.verifyVault(u,m,!0).then(l=>{a({verified:!!l,verifying:!1})}).catch(l=>{a({verified:!1,verifying:!1,error:l.message})})},[u,m,a]),n.verifying?p.jsx(P,{}):n.verified?p.jsx(w,{title:v("blocklet.config.vault.verified"),children:p.jsx(j,{fontSize:"small",color:"success"})}):p.jsx(w,{title:n.error,children:p.jsx(k,{color:"error"})})}T.propTypes={vaults:$.array.isRequired,appPid:$.string.isRequired};export{T as V};
@@ -1,4 +1,4 @@
1
- import{j as e,ak as a,at as r,W as o}from"./vendor-mui-core-CnXrAOs3.js";import{u as p}from"./use-mobile-DCNBsOlH.js";import{aa as m}from"./index-FASRIZyi.js";function d({blocklet:t=null,children:n=null}){const i=p();return!t||m(t.meta)?e.jsx(s,{isMobile:i,children:n}):e.jsx(s,{isMobile:i,children:e.jsx(a,{variant:"contained",sx:{display:"flex",color:"primary",alignItems:"center",marginLeft:"32px"},children:n})})}d.propTypes={blocklet:o.object,children:o.any};const s=r(a)`
1
+ import{j as e,ak as a,at as r,W as o}from"./vendor-mui-core-CnXrAOs3.js";import{u as p}from"./use-mobile-DCNBsOlH.js";import{ab as m}from"./index-6LL6v88e.js";function d({blocklet:t=null,children:n=null}){const i=p();return!t||m(t.meta)?e.jsx(s,{isMobile:i,children:n}):e.jsx(s,{isMobile:i,children:e.jsx(a,{variant:"contained",sx:{display:"flex",color:"primary",alignItems:"center",marginLeft:"32px"},children:n})})}d.propTypes={blocklet:o.object,children:o.any};const s=r(a)`
2
2
  padding-top: 24px;
3
3
  margin-top: auto;
4
4
  width: 100%;