@abtnode/blocklet-services 1.16.46 → 1.16.47-beta-20250710-123505-c50a3bdc

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 (109) hide show
  1. package/api/index.js +11 -0
  2. package/api/libs/image.js +1 -1
  3. package/dist/assets/{access-control-CMbWBbA-.js → access-control-D9ajNfrY.js} +1 -1
  4. package/dist/assets/{add-component-core-C_-47aWH.js → add-component-core-BUbtTpoW.js} +2 -2
  5. package/dist/assets/{add-resource-CF3PYVap.js → add-resource-CtM0iCKK.js} +1 -1
  6. package/dist/assets/{addon-BU6EtMS1.js → addon-DCIzT5_Z.js} +1 -1
  7. package/dist/assets/{advanced-BsXG5Uen.js → advanced-CC1tbROy.js} +1 -1
  8. package/dist/assets/{appearance-DnQKeY3-.js → appearance-CS0deqWb.js} +1 -1
  9. package/dist/assets/{arrow-down.svg-CaNNzVmj.js → arrow-down.svg-BykEFw6H.js} +1 -1
  10. package/dist/assets/{audit-logs-BdTL3Ee_.js → audit-logs-CYNqDQoO.js} +1 -1
  11. package/dist/assets/{authorize-D3GrNEeY.js → authorize-CXMrv2qg.js} +1 -1
  12. package/dist/assets/{branding-xOC7tV88.js → branding-BXu_IrWA.js} +2 -2
  13. package/dist/assets/{branding-DU4A47RN.js → branding-CerBGo3n.js} +1 -1
  14. package/dist/assets/{bundle-avatar-mX0oF7zo.js → bundle-avatar-BzV5PyCo.js} +1 -1
  15. package/dist/assets/{complete-DyNDIJOz.js → complete-Derz7Riq.js} +1 -1
  16. package/dist/assets/{component-DTQzu9Ux.js → component-D_LcLvga.js} +3 -3
  17. package/dist/assets/{config-DlVTbC3O.js → config-BZak2zrL.js} +1 -1
  18. package/dist/assets/{config-CLS5JN-Q.js → config-Bzod-0Gd.js} +1 -1
  19. package/dist/assets/{config-navigation-beAE71Co.js → config-navigation-BIPzVxTz.js} +3 -3
  20. package/dist/assets/{config-space-p8dvh7nV.js → config-space-bJO1Pq2d.js} +1 -1
  21. package/dist/assets/{confirm-CCJkd_GP.js → confirm-_x5prMc6.js} +1 -1
  22. package/dist/assets/{connect-CRMI4vhC.js → connect-DMnnk6Yx.js} +1 -1
  23. package/dist/assets/{connect-Bscwq6pz.js → connect-Du3HB8Ck.js} +1 -1
  24. package/dist/assets/{connect-to-DK_UHSXd.js → connect-to-CWHsYUA6.js} +1 -1
  25. package/dist/assets/{dashboard-EECTIwDT.js → dashboard-e9cJiXmU.js} +3 -3
  26. package/dist/assets/{delete-confirm-OwSiQs5a.js → delete-confirm-DBhhuh63.js} +1 -1
  27. package/dist/assets/{domain-Bqb4STve.js → domain-CouGHCP6.js} +1 -1
  28. package/dist/assets/{domain-action-card-78ZAvOXg.js → domain-action-card-BzjWIWJc.js} +1 -1
  29. package/dist/assets/{domains-Cc33cE6l.js → domains-BcqusidF.js} +1 -1
  30. package/dist/assets/{email-CW26NZg4.js → email-BxJbHVNF.js} +1 -1
  31. package/dist/assets/engine-CbuJOouR.js +1 -0
  32. package/dist/assets/{exchange-passport-ARTNldc_.js → exchange-passport-D7pdvAln.js} +1 -1
  33. package/dist/assets/{form-C7DadyRx.js → form-RlCPH3oL.js} +1 -1
  34. package/dist/assets/{fuel-CdmuLJ5m.js → fuel-BHhjNMAS.js} +1 -1
  35. package/dist/assets/{gen-access-key-DmGPdafH.js → gen-access-key-Cg9O2Wh7.js} +1 -1
  36. package/dist/assets/{get-safe-url-CFJ4a0MT.js → get-safe-url-70dNOHyP.js} +1 -1
  37. package/dist/assets/{home-DSXcBmq0.js → home-BMGT804L.js} +1 -1
  38. package/dist/assets/{iframe-CTQOWc1h.js → iframe-DnqoUNAW.js} +1 -1
  39. package/dist/assets/{index-DO3jlY1J.js → index--xoJi0Oj.js} +1 -1
  40. package/dist/assets/{index-DRCXfYI5.js → index-6xRm42_o.js} +1 -1
  41. package/dist/assets/{index-DjGGLSgp.js → index-B0stLJYN.js} +1 -1
  42. package/dist/assets/{index-DaWCw-fb.js → index-BCUaY7ta.js} +1 -1
  43. package/dist/assets/{index-MvpWBcrT.js → index-BE2l5xAg.js} +1 -1
  44. package/dist/assets/{index-Bk5yhzGt.js → index-BM8TdfbN.js} +1 -1
  45. package/dist/assets/{index-waZfnNlB.js → index-BWv4abon.js} +1 -1
  46. package/dist/assets/{index-Kcu6d0fi.js → index-BfqC3XQE.js} +1 -1
  47. package/dist/assets/{index-DJhjl40G.js → index-Bqnrq_qv.js} +1 -1
  48. package/dist/assets/{index-S9T-sBWO.js → index-CDq77s86.js} +4 -4
  49. package/dist/assets/{index-CzlSSzt5.js → index-CGAgz-tD.js} +1 -1
  50. package/dist/assets/{index-DMKmqbPb.js → index-CTVZqg23.js} +1 -1
  51. package/dist/assets/{index-Cs_Iwqc6.js → index-CV2-Ra10.js} +1 -1
  52. package/dist/assets/{index-n70kyMPo.js → index-Cj5h-Tfb.js} +1 -1
  53. package/dist/assets/{index-kQLw_ftN.js → index-D830QhSG.js} +1 -1
  54. package/dist/assets/{index-DYWITQqN.js → index-DAExpjL_.js} +1 -1
  55. package/dist/assets/{index-DhbrYLsW.js → index-DZZp9n8Q.js} +1 -1
  56. package/dist/assets/{index-C410XMZO.js → index-Dapt6sZR.js} +1 -1
  57. package/dist/assets/{index-DKdSMDX6.js → index-DhFdjB1D.js} +1 -1
  58. package/dist/assets/{index-BuCfItTx.js → index-T7E5JhUh.js} +3 -3
  59. package/dist/assets/{index-ClY8OPfZ.js → index-ZosxPaRN.js} +1 -1
  60. package/dist/assets/{index-CnZyhA37.js → index-glbEl-Pn.js} +1 -1
  61. package/dist/assets/{index-CHgWkvhM.js → index-tnuA-tTl.js} +4 -4
  62. package/dist/assets/{invitation-S4WXAiey.js → invitation-C6_hcRBi.js} +1 -1
  63. package/dist/assets/{invite-COY7brfc.js → invite-DLUpRfAh.js} +1 -1
  64. package/dist/assets/{issue-passport-BSa2KdpC.js → issue-passport-DCSyjcCc.js} +1 -1
  65. package/dist/assets/{item-C-9-K-dS.js → item-D9OLZ5b9.js} +1 -1
  66. package/dist/assets/{landing-page-C3ZqUsaQ.js → landing-page-C4ZUBLGU.js} +1 -1
  67. package/dist/assets/{layout-CFnEKAtz.js → layout-BcCpT3Sj.js} +1 -1
  68. package/dist/assets/{list-B7ZF5Ul0.js → list-BlDvw1so.js} +1 -1
  69. package/dist/assets/{list-Dvw6k9Fn.js → list-CJmxDpTz.js} +2 -2
  70. package/dist/assets/{localization-B4hOUoCq.js → localization-H6VEIn1X.js} +1 -1
  71. package/dist/assets/{log-CQyBD4pJ.js → log-Bo8H0pew.js} +1 -1
  72. package/dist/assets/{login-yfGJSAJb.js → login-COCCrN_2.js} +1 -1
  73. package/dist/assets/{login-oauth-callback-BXAgY8t2.js → login-oauth-callback-BBKbLyu-.js} +1 -1
  74. package/dist/assets/{logo-uploader-DL_O0r92.js → logo-uploader-CnbjQmUt.js} +2 -2
  75. package/dist/assets/{lost-passport-BeFjTnh-.js → lost-passport-DsXYEZzf.js} +1 -1
  76. package/dist/assets/{open-window-PnHF0kAn.js → open-window-LUOmt0hD.js} +1 -1
  77. package/dist/assets/{over-due-invoice-payment-COY8cvLu.js → over-due-invoice-payment-CuQ5h3hN.js} +1 -1
  78. package/dist/assets/{overview-Cd-vxOiy.js → overview-Cn9TZC8v.js} +1 -1
  79. package/dist/assets/{passport-item-DelVKtIt.js → passport-item-DmWZqcWM.js} +1 -1
  80. package/dist/assets/{permission-B4gBENoO.js → permission-3PNyBKZ2.js} +1 -1
  81. package/dist/assets/{preferences-CjO06ZIQ.js → preferences-DVGAbEme.js} +1 -1
  82. package/dist/assets/{profile-embed-BitC6ZoS.js → profile-embed-CI5k42bk.js} +1 -1
  83. package/dist/assets/{publish-resource-Ck5quuGX.js → publish-resource-EHXQz0a8.js} +1 -1
  84. package/dist/assets/{runtime-B-Viq2us.js → runtime-WlpSIzes.js} +1 -1
  85. package/dist/assets/sdk-6bZnDL_f.js +1 -0
  86. package/dist/assets/{security-J0LBanar.js → security-pXCcg1d2.js} +1 -1
  87. package/dist/assets/{session-CD-6TrlW.js → session-CvQ97dDY.js} +1 -1
  88. package/dist/assets/{setup-CpWZbzzi.js → setup-DNMNAWdA.js} +3 -3
  89. package/dist/assets/{spaces-Jt4I6QVN.js → spaces-DVGE8nur.js} +1 -1
  90. package/dist/assets/{start-DFxA6tPZ.js → start-CgAXib9j.js} +1 -1
  91. package/dist/assets/{status-B2xgYwSq.js → status-CxWCFwty.js} +1 -1
  92. package/dist/assets/{step-actions-BnfP6cxN.js → step-actions-Cmo-e1Kn.js} +1 -1
  93. package/dist/assets/{studio-CiSsKpFb.js → studio-BoYrF6Kl.js} +1 -1
  94. package/dist/assets/{traffic-C0Ugjtml.js → traffic-2Q6t1xaL.js} +1 -1
  95. package/dist/assets/{transfer-BrnC_C-u.js → transfer-B7bfp-Lw.js} +1 -1
  96. package/dist/assets/{unsubscribe-Df9woQco.js → unsubscribe-B1VOJ7QT.js} +1 -1
  97. package/dist/assets/{use-blocklet-logo-B1g1jSm8.js → use-blocklet-logo-C7qZcidt.js} +1 -1
  98. package/dist/assets/{user-center-lZ9ifkcH.js → user-center-BfW2lvH2.js} +3 -3
  99. package/dist/assets/{user-center-Dicuqlij.js → user-center-Cg8K5HLJ.js} +3 -3
  100. package/dist/assets/{user-sessions-DmuUfMxJ.js → user-sessions-DEwJRITu.js} +1 -1
  101. package/dist/assets/{util-Doke8P4Y.js → util-B-cMjJCC.js} +1 -1
  102. package/dist/assets/{util-BTNHVX94.js → util-CNKleiqU.js} +1 -1
  103. package/dist/assets/{wrap-locale-CfJqsNLW.js → wrap-locale-Bf1-s-bS.js} +1 -1
  104. package/dist/assets/{zh-DJzU8mmk.js → zh-CEmPmptr.js} +1 -1
  105. package/dist/index.html +1 -1
  106. package/dist/service-worker.js +1 -1
  107. package/package.json +23 -23
  108. package/dist/assets/engine-CcVO7RNx.js +0 -1
  109. package/dist/assets/sdk-Bg2mtU3m.js +0 -1
@@ -1 +1 @@
1
- import{j as e,T as v,a$ as b,J as I,O as P,ak as t}from"./vendor-mui-core-p6jGoroc.js";import{q as T,g as B,O as E,$ as j,P as O}from"./vendor-ux-TkkDR0Gn.js";import{a as $}from"./vendor-hooks-zCCbpt45.js";import{a8 as A}from"./index-S9T-sBWO.js";function C({linkProps:s=void 0,showExtra:o=!1,...n}){return e.jsxs(v,{...n,children:["Powered by"," ",e.jsx(b,{href:"https://www.arcblock.io",target:"_blank",...s,children:"ArcBlock"}),"'s"," ",e.jsx(b,{href:"https://www.blocklet.io",target:"_blank",...s,children:"Blocklet Technology"}),o?", the decentralized web engine.":null]})}function W({did:s,children:o,title:n=void 0,description:a=void 0,actions:m=void 0,logo:i=void 0,logoSize:d=50,poweredBy:x=void 0,termsOfUse:g=void 0,standalone:y=!1}){const r=globalThis?.blocklet||globalThis?.env||{},{palette:f}=I(),c=P(l=>l.breakpoints.down("lg")),w=A({meta:r}),k=$(()=>{const l=r.appPid,u=T.isEthereumDid(l),D=u?void 0:B(l);return u?E(l):D.color},[r?.appPid]);if(!s)return o;n===void 0&&(n=r.appName),a===void 0&&(a=r.appDescription),i===void 0&&(i=w||""),typeof i=="string"&&(i?i=e.jsx(t,{sx:{height:d,maxHeight:d,objectFit:"contain"},component:"img",src:i,alt:`${r.appName}'s logo`}):i=e.jsx(j,{size:d,did:s,src:i,variant:"rounded"})),x===void 0&&(x=e.jsx(C,{linkProps:{color:f.text.secondary,sx:{"&:hover":{textDecoration:"underline"}}},showExtra:!c,sx:{textAlign:"center",fontSize:"12px",color:"text.secondary"}}));let p=o;!o&&!c&&(p=e.jsx(t,{sx:{filter:"blur(180px)",display:"flex"},children:e.jsx(j,{size:210,did:s,variant:"rounded"})}));const z=!!o;let h=!y;return c&&(h=!z),e.jsxs(t,{sx:{width:"100%",minHeight:"100vh",display:"flex",justifyContent:"center",alignItems:"center",px:{xs:2,sm:4,md:8},pt:{xs:2,sm:4,md:6},pb:{xs:5,md:8},background:`radial-gradient(circle at bottom right, ${O(k,.3)} 10%, ${f.background.default} 50%)`,position:"relative"},children:[e.jsxs(t,{sx:{maxWidth:1200,display:"flex",alignItems:"center",justifyContent:[h,p].filter(Boolean).length>1?"space-between":"center",width:"100%",margin:"auto"},children:[h?e.jsxs(t,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[e.jsx(t,{sx:{display:"flex",alignItems:"center"},children:i}),e.jsx(v,{variant:"h2",sx:{fontWeight:"bold",fontSize:{sm:"2.25rem",md:"2.75rem",xl:"3.5rem"}},children:n}),a?e.jsx(t,{sx:{mb:2,color:"text.secondary"},children:a}):null,m?e.jsx(t,{sx:{mt:8},children:m}):null,g?e.jsx(t,{sx:{mt:-1,color:"grey"},children:g}):null]}):null,p]}),e.jsx(t,{sx:{position:"absolute",zIndex:10,bottom:10,left:10,right:10,textAlign:"center"},children:x})]})}export{W as K};
1
+ import{j as e,T as v,a$ as b,J as I,O as P,ak as t}from"./vendor-mui-core-p6jGoroc.js";import{q as T,g as B,O as E,$ as j,P as O}from"./vendor-ux-TkkDR0Gn.js";import{a as $}from"./vendor-hooks-zCCbpt45.js";import{a8 as A}from"./index-CDq77s86.js";function C({linkProps:s=void 0,showExtra:o=!1,...n}){return e.jsxs(v,{...n,children:["Powered by"," ",e.jsx(b,{href:"https://www.arcblock.io",target:"_blank",...s,children:"ArcBlock"}),"'s"," ",e.jsx(b,{href:"https://www.blocklet.io",target:"_blank",...s,children:"Blocklet Technology"}),o?", the decentralized web engine.":null]})}function W({did:s,children:o,title:n=void 0,description:a=void 0,actions:m=void 0,logo:i=void 0,logoSize:d=50,poweredBy:x=void 0,termsOfUse:g=void 0,standalone:y=!1}){const r=globalThis?.blocklet||globalThis?.env||{},{palette:f}=I(),c=P(l=>l.breakpoints.down("lg")),w=A({meta:r}),k=$(()=>{const l=r.appPid,u=T.isEthereumDid(l),D=u?void 0:B(l);return u?E(l):D.color},[r?.appPid]);if(!s)return o;n===void 0&&(n=r.appName),a===void 0&&(a=r.appDescription),i===void 0&&(i=w||""),typeof i=="string"&&(i?i=e.jsx(t,{sx:{height:d,maxHeight:d,objectFit:"contain"},component:"img",src:i,alt:`${r.appName}'s logo`}):i=e.jsx(j,{size:d,did:s,src:i,variant:"rounded"})),x===void 0&&(x=e.jsx(C,{linkProps:{color:f.text.secondary,sx:{"&:hover":{textDecoration:"underline"}}},showExtra:!c,sx:{textAlign:"center",fontSize:"12px",color:"text.secondary"}}));let p=o;!o&&!c&&(p=e.jsx(t,{sx:{filter:"blur(180px)",display:"flex"},children:e.jsx(j,{size:210,did:s,variant:"rounded"})}));const z=!!o;let h=!y;return c&&(h=!z),e.jsxs(t,{sx:{width:"100%",minHeight:"100vh",display:"flex",justifyContent:"center",alignItems:"center",px:{xs:2,sm:4,md:8},pt:{xs:2,sm:4,md:6},pb:{xs:5,md:8},background:`radial-gradient(circle at bottom right, ${O(k,.3)} 10%, ${f.background.default} 50%)`,position:"relative"},children:[e.jsxs(t,{sx:{maxWidth:1200,display:"flex",alignItems:"center",justifyContent:[h,p].filter(Boolean).length>1?"space-between":"center",width:"100%",margin:"auto"},children:[h?e.jsxs(t,{sx:{display:"flex",flexDirection:"column",gap:1.5},children:[e.jsx(t,{sx:{display:"flex",alignItems:"center"},children:i}),e.jsx(v,{variant:"h2",sx:{fontWeight:"bold",fontSize:{sm:"2.25rem",md:"2.75rem",xl:"3.5rem"}},children:n}),a?e.jsx(t,{sx:{mb:2,color:"text.secondary"},children:a}):null,m?e.jsx(t,{sx:{mt:8},children:m}):null,g?e.jsx(t,{sx:{mt:-1,color:"grey"},children:g}):null]}):null,p]}),e.jsx(t,{sx:{position:"absolute",zIndex:10,bottom:10,left:10,right:10,textAlign:"center"},children:x})]})}export{W as K};
@@ -1,4 +1,4 @@
1
- import{j as a,at as m}from"./vendor-mui-core-p6jGoroc.js";import{C as p}from"./content-layout-BFy-gp0u.js";import{T as c,H as s}from"./vendor-ux-TkkDR0Gn.js";import{W as d,M as i}from"./index-S9T-sBWO.js";const u=m(p)`
1
+ import{j as a,at as m}from"./vendor-mui-core-p6jGoroc.js";import{C as p}from"./content-layout-BFy-gp0u.js";import{T as c,H as s}from"./vendor-ux-TkkDR0Gn.js";import{W as d,M as i}from"./index-CDq77s86.js";const u=m(p)`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  width: 100%;
@@ -1,4 +1,4 @@
1
- import{r as o}from"./vendor-react-x2lQvn4m.js";import{j as t,b4 as _,$ as n,J as O,n as xe,b0 as ye,cy as be,cz as ve,cA as je,cB as we,ak as g,T as q,V as ke,a$ as te,a7 as Ie,s as Me,O as Re,I as Ce,at as Ae}from"./vendor-mui-core-p6jGoroc.js";import{a as D,b as F,h as Te}from"./vendor-hooks-zCCbpt45.js";import{T as J,A as Ne,I as ne,b as re,S as $e}from"./vendor-ux-TkkDR0Gn.js";import{t as Se}from"./server-logo-notext.svg-BqCXmsOm.js";import{B as ze}from"./bundle-avatar-mX0oF7zo.js";import{a as Le,g as se,i as ie,b as oe,d as V,M as ae,e as Ee,m as De,f as Be,h as Pe,c as qe,j as Ve,k as _e,l as Oe,n as Fe,N as He}from"./use-blocklet-logo-B1g1jSm8.js";import{R as Ue,J as We,C as K,a as H}from"./vendor-utils-CtD44yV-.js";import{c as Je,_ as Ke}from"./index-S9T-sBWO.js";import{g as Qe,a as Xe,l as Ge}from"./index-DKdSMDX6.js";import{p as Ye}from"./util-Doke8P4Y.js";function le({blocklet:e,style:r={},size:s=40,...i}){const l=Le({blocklet:e,square:!0}),{variant:u}=i;return t.jsx(_,{variant:u||"square",style:Object.assign({backgroundColor:"transparent",width:s,height:s,borderRadius:10},r),...i,children:t.jsx("img",{src:l,alt:"",style:{width:s}})})}le.propTypes={blocklet:n.object.isRequired,style:n.object,size:n.oneOfType([n.number,n.string])};function Ze(e){return e.includes(" ")?new Date(e.replace(" ","T").replace(" ","")).getTime():new Date(e).getTime()}function Q({value:e="",shouldUpdate:r=!1,...s}){const{locale:i}=J(),[l,u]=o.useState(0);if(o.useEffect(()=>{let d;if(r){const p=new Date(e).getTime(),y=Date.now(),v=Math.abs(Math.floor((p-y)/1e3)),b=()=>{u(k=>{const C=Math.random()*1e3;return parseFloat((k+C).toFixed(4))})};v<60?d=setInterval(b,1e3):v<60*60?d=setInterval(b,6e4):d=setInterval(b,36e5)}return()=>{clearInterval(d)}},[e,l,r]),!e)return"-";const m=Ze(e);return t.jsx(Ne,{value:m,locale:i,...s})}Q.propTypes={value:n.any,shouldUpdate:n.bool};const et={error:je,warning:ve,info:be,success:ye};ce.propTypes={severity:n.oneOf(["error","warning","info","success"]).isRequired,size:n.number};function ce({severity:e="info",size:r=32}){const s=O(),l=D(()=>({error:s.palette.error.main,warning:s.palette.warning.main,info:s.palette.info.main,success:s.palette.success.main}))[e],u=et[e],m=xe(l,.1);return t.jsx(_,{sx:{width:r,height:r,bgcolor:m,color:l},children:t.jsx(u,{fontSize:"small"})})}const tt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M5.821 4.91c3.898-2.765 9.469-2.539 13.073.536c3.667 3.127 4.168 8.238 1.152 11.897c-2.842 3.447-7.965 4.583-12.231 2.805l-.232-.101l-4.375.931l-.075.013l-.11.009l-.113-.004l-.044-.005l-.11-.02l-.105-.034l-.1-.044l-.076-.042l-.108-.077l-.081-.074l-.073-.083l-.053-.075l-.065-.115l-.042-.106l-.031-.113l-.013-.075l-.009-.11l.004-.113l.005-.044l.02-.11l.022-.072l1.15-3.451l-.022-.036C.969 12.45 1.97 7.805 5.59 5.079l.23-.168z"/></g>'},nt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M12 2a5 5 0 1 1-5 5l.005-.217A5 5 0 0 1 12 2zm2 12a5 5 0 0 1 5 5v1a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-1a5 5 0 0 1 5-5h4z"/></g>'},rt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M17 3.34A10 10 0 1 1 2 12l.005-.324A10 10 0 0 1 17 3.34zM12 6a1 1 0 0 0-1 1a3 3 0 1 0 0 6v2a1.024 1.024 0 0 1-.866-.398l-.068-.101a1 1 0 0 0-1.732.998a3 3 0 0 0 2.505 1.5H11a1 1 0 0 0 .883.994L12 18a1 1 0 0 0 1-1l.176-.005A3 3 0 0 0 13 11V9c.358-.012.671.14.866.398l.068.101a1 1 0 0 0 1.732-.998A3 3 0 0 0 13.161 7H13a1 1 0 0 0-1-1zm1 7a1 1 0 0 1 0 2v-2zm-2-4v2a1 1 0 0 1 0-2z"/></g>'},st={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M8 12a4 4 0 1 0 8 0a4 4 0 1 0-8 0"/><path d="M16 12v1.5a2.5 2.5 0 0 0 5 0V12a9 9 0 1 0-5.5 8.28"/></g>'},it={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m15 10l-4 4l6 6l4-16l-18 7l4 2l2 6l3-4"/>'},Z={comment:{icon:tt,bgColor:"rgba(239, 246, 255, 1)",color:"rgba(43, 127, 255, 1)"},like:{icon:"👍",bgColor:"rgba(244, 244, 245, 1)",color:"yellow",renderType:"emoji"},follow:{icon:nt,bgColor:"rgba(238, 242, 255, 1)",color:"rgba(97, 95, 255, 1)"},tips:{icon:rt,bgColor:"rgba(254, 252, 232, 1)",color:"rgba(240, 177, 0, 1)"},mention:{icon:st,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"},assign:{icon:it,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"}};de.propTypes={activity:n.oneOf(["comment","like","follow","tips","mention","assign"]).isRequired,size:n.number};function de({activity:e,size:r=32}){const s=Z[e]||Z.comment,i=s.icon;return t.jsx(_,{sx:{bgcolor:s.bgColor,color:s.color,width:r,height:r},children:s.renderType==="emoji"?t.jsx("span",{style:{fontSize:"14px"},children:i}):t.jsx(ne,{icon:i})})}const U={avatar:n.string,fullName:n.string,did:n.string};function W({actor:e,size:r,teamDid:s="",inService:i=!1,showName:l=!1}){const u=D(()=>({...e,avatar:e?.avatar?Ye(e.avatar,s,i):null}),[e,s,i]),m=d=>{e&&(d.stopPropagation(),window.open(We(K(Je.WELLKNOWN_SERVICE_PATH_PREFIX,"user"),{did:e.did}),"_blank"),d.customPreventRedirect=!0)};return t.jsxs(g,{onClick:m,role:"button",style:{cursor:"pointer"},title:e?.fullName||"",sx:{display:"flex",alignItems:"center",gap:1},children:[u.avatar?t.jsx(Qe,{user:u,showDid:!0,cardType:Ge.AvatarOnly,infoType:Xe.Minimal,avatarSize:r,shape:"circle",sx:{width:r,height:r,borderRadius:"100%",overflow:"hidden",transition:"transform 0.2s ease-in-out","&:hover":{transform:"scale(1.1)"}}}):t.jsx(_,{sx:{width:r,height:r}}),l&&t.jsx("span",{children:e?.fullName})]})}W.propTypes={actor:n.shape(U).isRequired,size:n.number.isRequired,teamDid:n.string,inService:n.bool,showName:n.bool};X.propTypes={actors:n.oneOfType([n.shape(U),n.arrayOf(n.shape(U))]).isRequired,size:n.number,maxDisplay:n.number,teamDid:n.string,inService:n.bool,showName:n.bool,avatarFallback:n.node};function X({actors:e,size:r=32,maxDisplay:s=9,teamDid:i="",inService:l=!0,showName:u=!1,avatarFallback:m=null}){const d=D(()=>{const p=Array.isArray(e)?e:[e];return Ue(p,"did").filter(Boolean)},[e]);return d.length===1||!d.length?t.jsx(W,{actor:d[0],size:r,teamDid:i,inService:l,showName:u}):t.jsx(we,{total:d.length,renderSurplus:p=>p<100?t.jsxs("span",{children:["+",p]}):t.jsx("span",{children:"99+"}),max:s,sx:{justifyContent:"flex-end",height:`${r}px`,".MuiAvatar-root":{width:`${r}px`,height:`${r}px`,fontSize:`${r/2.5}px`,border:0,zIndex:2}},children:d.map((p,y)=>p?.avatar?t.jsx(W,{actor:p,size:r,teamDid:i,inService:l},p?.did||y):m)})}const ee=3;pe.propTypes={notification:n.object.isRequired,isMultiple:n.bool,blocklet:n.object,mountPoint:n.string,avatarFallback:n.node};ue.propTypes={notification:n.object.isRequired,mountPoint:n.string};he.propTypes={items:n.array.isRequired,activity:n.object.isRequired,blocklet:n.object,mountPoint:n.string,viewMoreLink:n.string,avatarFallback:n.node};function ue({notification:e,mountPoint:r=""}){const{activity:s}=e,{type:i,meta:l={}}=s||{},u=oe({activity:s,users:[e?.actorInfo],actors:[e?.activity?.actor],mountPoint:r});return H(s)||!s.type||!s.actor||H(s.target)?null:t.jsxs(g,{children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:.5},children:u}),l?t.jsx(ae,{meta:l,type:i}):null]})}function he({items:e,activity:r,blocklet:s,mountPoint:i="",viewMoreLink:l="",avatarFallback:u=null}){const m=O(),{t:d}=J(),p=D(()=>s?.did||s?.meta?.did||"",[s]),{locale:y}=o.useContext(re),v=D(()=>!H(r.meta)&&Object.values(r.meta).some(a=>a!=null),[r]),b=oe({activity:r,users:e.map(a=>a?.actorInfo),actors:e.map(a=>a?.activity?.actor),mountPoint:i}),k=F(a=>{if(!a.activity)return null;const x=se(a.activity);return x?.metaLink?ie(x?.metaLink)?x?.metaLink:K(i,x.metaLink):null}),C=F((a,x)=>{if(!x)return;const h=k(x);h&&(window.open(h,"_blank"),a.customPreventRedirect=!0)}),$=e.length>ee,w=e.slice(0,ee);return t.jsxs(g,{sx:{width:"100%"},children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:3},children:b}),v?t.jsxs(g,{className:"sub-content",sx:{display:"flex",flexDirection:"column",gap:3},children:[w.map(a=>t.jsxs(g,{onClick:x=>C(x,a),sx:{display:"flex",flexDirection:"column",gap:1},children:[t.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[V(a)?t.jsx(X,{actors:a.actorInfo,size:32,teamDid:p}):u,t.jsx(q,{variant:"subtitle1",sx:{color:"text.primary"},children:V(a)?a?.actorInfo?.fullName:"System"})," ","·",t.jsx(Q,{value:a.createdAt,locale:y,shouldUpdate:!0,style:{color:m.palette.text.secondary,fontSize:"0.875rem",minWidth:"50px",whiteSpace:"nowrap"}})]}),a.activity.meta?t.jsx(g,{sx:{pl:5},children:t.jsx(ae,{meta:a.activity.meta,type:a.activity.type})}):null]},a.id)),$&&l?t.jsx(g,{sx:{mt:1,display:"flex",justifyContent:"center"},children:t.jsxs(ke,{size:"large",variant:"text",component:te,href:l,target:"_blank",rel:"noopener noreferrer",onClick:a=>{a.customPreventRedirect=!0},children:[d("notification.viewMore")," ",t.jsx(ne,{icon:Ee,style:{marginLeft:4}})]})}):null]}):null]})}function pe({notification:e,isMultiple:r=!1,blocklet:s,mountPoint:i="",avatarFallback:l}){const u=D(()=>{if(!e.activity)return null;const m=se(e.activity);return m?.targetLink?ie(m?.targetLink)?m?.targetLink:K(i,m.targetLink):null},[e.activity,i]);return r?t.jsx(he,{items:e.items,activity:e.activity,blocklet:s,mountPoint:i,viewMoreLink:u,avatarFallback:l}):t.jsx(ue,{notification:e,mountPoint:i})}function me({notification:e}){const r=o.useMemo(()=>{const{actions:s,action:i}=e;let l=s??[];return!l.length&&i&&(l=[{name:"Visit",link:i}]),l},[e]);return r.length?t.jsx(g,{sx:{display:"flex",justifyContent:"start",flexWrap:"wrap",alignItems:"center",gap:1,mt:1.5},children:r.map((s,i)=>t.jsxs(o.Fragment,{children:[t.jsx(te,{href:s.link,target:"_blank",className:"link",rel:"noopener noreferrer",sx:{fontSize:"15px"},onClick:l=>{l.customPreventRedirect=!0},children:s.name},s.link),i<r.length-1?t.jsx(Ie,{orientation:"vertical",sx:{height:12,borderWidth:"1px"}}):null]},s.link))}):null}me.propTypes={notification:n.object.isRequired};const ot=Me(g)`
1
+ import{r as o}from"./vendor-react-x2lQvn4m.js";import{j as t,b4 as _,$ as n,J as O,n as xe,b0 as ye,cy as be,cz as ve,cA as je,cB as we,ak as g,T as q,V as ke,a$ as te,a7 as Ie,s as Me,O as Re,I as Ce,at as Ae}from"./vendor-mui-core-p6jGoroc.js";import{a as D,b as F,h as Te}from"./vendor-hooks-zCCbpt45.js";import{T as J,A as Ne,I as ne,b as re,S as $e}from"./vendor-ux-TkkDR0Gn.js";import{t as Se}from"./server-logo-notext.svg-BqCXmsOm.js";import{B as ze}from"./bundle-avatar-BzV5PyCo.js";import{a as Le,g as se,i as ie,b as oe,d as V,M as ae,e as Ee,m as De,f as Be,h as Pe,c as qe,j as Ve,k as _e,l as Oe,n as Fe,N as He}from"./use-blocklet-logo-C7qZcidt.js";import{R as Ue,J as We,C as K,a as H}from"./vendor-utils-CtD44yV-.js";import{c as Je,_ as Ke}from"./index-CDq77s86.js";import{g as Qe,a as Xe,l as Ge}from"./index-DhFdjB1D.js";import{p as Ye}from"./util-B-cMjJCC.js";function le({blocklet:e,style:r={},size:s=40,...i}){const l=Le({blocklet:e,square:!0}),{variant:u}=i;return t.jsx(_,{variant:u||"square",style:Object.assign({backgroundColor:"transparent",width:s,height:s,borderRadius:10},r),...i,children:t.jsx("img",{src:l,alt:"",style:{width:s}})})}le.propTypes={blocklet:n.object.isRequired,style:n.object,size:n.oneOfType([n.number,n.string])};function Ze(e){return e.includes(" ")?new Date(e.replace(" ","T").replace(" ","")).getTime():new Date(e).getTime()}function Q({value:e="",shouldUpdate:r=!1,...s}){const{locale:i}=J(),[l,u]=o.useState(0);if(o.useEffect(()=>{let d;if(r){const p=new Date(e).getTime(),y=Date.now(),v=Math.abs(Math.floor((p-y)/1e3)),b=()=>{u(k=>{const C=Math.random()*1e3;return parseFloat((k+C).toFixed(4))})};v<60?d=setInterval(b,1e3):v<60*60?d=setInterval(b,6e4):d=setInterval(b,36e5)}return()=>{clearInterval(d)}},[e,l,r]),!e)return"-";const m=Ze(e);return t.jsx(Ne,{value:m,locale:i,...s})}Q.propTypes={value:n.any,shouldUpdate:n.bool};const et={error:je,warning:ve,info:be,success:ye};ce.propTypes={severity:n.oneOf(["error","warning","info","success"]).isRequired,size:n.number};function ce({severity:e="info",size:r=32}){const s=O(),l=D(()=>({error:s.palette.error.main,warning:s.palette.warning.main,info:s.palette.info.main,success:s.palette.success.main}))[e],u=et[e],m=xe(l,.1);return t.jsx(_,{sx:{width:r,height:r,bgcolor:m,color:l},children:t.jsx(u,{fontSize:"small"})})}const tt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M5.821 4.91c3.898-2.765 9.469-2.539 13.073.536c3.667 3.127 4.168 8.238 1.152 11.897c-2.842 3.447-7.965 4.583-12.231 2.805l-.232-.101l-4.375.931l-.075.013l-.11.009l-.113-.004l-.044-.005l-.11-.02l-.105-.034l-.1-.044l-.076-.042l-.108-.077l-.081-.074l-.073-.083l-.053-.075l-.065-.115l-.042-.106l-.031-.113l-.013-.075l-.009-.11l.004-.113l.005-.044l.02-.11l.022-.072l1.15-3.451l-.022-.036C.969 12.45 1.97 7.805 5.59 5.079l.23-.168z"/></g>'},nt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M12 2a5 5 0 1 1-5 5l.005-.217A5 5 0 0 1 12 2zm2 12a5 5 0 0 1 5 5v1a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-1a5 5 0 0 1 5-5h4z"/></g>'},rt={width:24,height:24,body:'<g fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M0 0h24v24H0z"/><path fill="currentColor" d="M17 3.34A10 10 0 1 1 2 12l.005-.324A10 10 0 0 1 17 3.34zM12 6a1 1 0 0 0-1 1a3 3 0 1 0 0 6v2a1.024 1.024 0 0 1-.866-.398l-.068-.101a1 1 0 0 0-1.732.998a3 3 0 0 0 2.505 1.5H11a1 1 0 0 0 .883.994L12 18a1 1 0 0 0 1-1l.176-.005A3 3 0 0 0 13 11V9c.358-.012.671.14.866.398l.068.101a1 1 0 0 0 1.732-.998A3 3 0 0 0 13.161 7H13a1 1 0 0 0-1-1zm1 7a1 1 0 0 1 0 2v-2zm-2-4v2a1 1 0 0 1 0-2z"/></g>'},st={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M8 12a4 4 0 1 0 8 0a4 4 0 1 0-8 0"/><path d="M16 12v1.5a2.5 2.5 0 0 0 5 0V12a9 9 0 1 0-5.5 8.28"/></g>'},it={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m15 10l-4 4l6 6l4-16l-18 7l4 2l2 6l3-4"/>'},Z={comment:{icon:tt,bgColor:"rgba(239, 246, 255, 1)",color:"rgba(43, 127, 255, 1)"},like:{icon:"👍",bgColor:"rgba(244, 244, 245, 1)",color:"yellow",renderType:"emoji"},follow:{icon:nt,bgColor:"rgba(238, 242, 255, 1)",color:"rgba(97, 95, 255, 1)"},tips:{icon:rt,bgColor:"rgba(254, 252, 232, 1)",color:"rgba(240, 177, 0, 1)"},mention:{icon:st,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"},assign:{icon:it,bgColor:"rgba(244, 244, 245, 1)",color:"rgba(43, 127, 255, 1)"}};de.propTypes={activity:n.oneOf(["comment","like","follow","tips","mention","assign"]).isRequired,size:n.number};function de({activity:e,size:r=32}){const s=Z[e]||Z.comment,i=s.icon;return t.jsx(_,{sx:{bgcolor:s.bgColor,color:s.color,width:r,height:r},children:s.renderType==="emoji"?t.jsx("span",{style:{fontSize:"14px"},children:i}):t.jsx(ne,{icon:i})})}const U={avatar:n.string,fullName:n.string,did:n.string};function W({actor:e,size:r,teamDid:s="",inService:i=!1,showName:l=!1}){const u=D(()=>({...e,avatar:e?.avatar?Ye(e.avatar,s,i):null}),[e,s,i]),m=d=>{e&&(d.stopPropagation(),window.open(We(K(Je.WELLKNOWN_SERVICE_PATH_PREFIX,"user"),{did:e.did}),"_blank"),d.customPreventRedirect=!0)};return t.jsxs(g,{onClick:m,role:"button",style:{cursor:"pointer"},title:e?.fullName||"",sx:{display:"flex",alignItems:"center",gap:1},children:[u.avatar?t.jsx(Qe,{user:u,showDid:!0,cardType:Ge.AvatarOnly,infoType:Xe.Minimal,avatarSize:r,shape:"circle",sx:{width:r,height:r,borderRadius:"100%",overflow:"hidden",transition:"transform 0.2s ease-in-out","&:hover":{transform:"scale(1.1)"}}}):t.jsx(_,{sx:{width:r,height:r}}),l&&t.jsx("span",{children:e?.fullName})]})}W.propTypes={actor:n.shape(U).isRequired,size:n.number.isRequired,teamDid:n.string,inService:n.bool,showName:n.bool};X.propTypes={actors:n.oneOfType([n.shape(U),n.arrayOf(n.shape(U))]).isRequired,size:n.number,maxDisplay:n.number,teamDid:n.string,inService:n.bool,showName:n.bool,avatarFallback:n.node};function X({actors:e,size:r=32,maxDisplay:s=9,teamDid:i="",inService:l=!0,showName:u=!1,avatarFallback:m=null}){const d=D(()=>{const p=Array.isArray(e)?e:[e];return Ue(p,"did").filter(Boolean)},[e]);return d.length===1||!d.length?t.jsx(W,{actor:d[0],size:r,teamDid:i,inService:l,showName:u}):t.jsx(we,{total:d.length,renderSurplus:p=>p<100?t.jsxs("span",{children:["+",p]}):t.jsx("span",{children:"99+"}),max:s,sx:{justifyContent:"flex-end",height:`${r}px`,".MuiAvatar-root":{width:`${r}px`,height:`${r}px`,fontSize:`${r/2.5}px`,border:0,zIndex:2}},children:d.map((p,y)=>p?.avatar?t.jsx(W,{actor:p,size:r,teamDid:i,inService:l},p?.did||y):m)})}const ee=3;pe.propTypes={notification:n.object.isRequired,isMultiple:n.bool,blocklet:n.object,mountPoint:n.string,avatarFallback:n.node};ue.propTypes={notification:n.object.isRequired,mountPoint:n.string};he.propTypes={items:n.array.isRequired,activity:n.object.isRequired,blocklet:n.object,mountPoint:n.string,viewMoreLink:n.string,avatarFallback:n.node};function ue({notification:e,mountPoint:r=""}){const{activity:s}=e,{type:i,meta:l={}}=s||{},u=oe({activity:s,users:[e?.actorInfo],actors:[e?.activity?.actor],mountPoint:r});return H(s)||!s.type||!s.actor||H(s.target)?null:t.jsxs(g,{children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:.5},children:u}),l?t.jsx(ae,{meta:l,type:i}):null]})}function he({items:e,activity:r,blocklet:s,mountPoint:i="",viewMoreLink:l="",avatarFallback:u=null}){const m=O(),{t:d}=J(),p=D(()=>s?.did||s?.meta?.did||"",[s]),{locale:y}=o.useContext(re),v=D(()=>!H(r.meta)&&Object.values(r.meta).some(a=>a!=null),[r]),b=oe({activity:r,users:e.map(a=>a?.actorInfo),actors:e.map(a=>a?.activity?.actor),mountPoint:i}),k=F(a=>{if(!a.activity)return null;const x=se(a.activity);return x?.metaLink?ie(x?.metaLink)?x?.metaLink:K(i,x.metaLink):null}),C=F((a,x)=>{if(!x)return;const h=k(x);h&&(window.open(h,"_blank"),a.customPreventRedirect=!0)}),$=e.length>ee,w=e.slice(0,ee);return t.jsxs(g,{sx:{width:"100%"},children:[t.jsx(q,{variant:"body1",sx:{color:"text.secondary",mb:3},children:b}),v?t.jsxs(g,{className:"sub-content",sx:{display:"flex",flexDirection:"column",gap:3},children:[w.map(a=>t.jsxs(g,{onClick:x=>C(x,a),sx:{display:"flex",flexDirection:"column",gap:1},children:[t.jsxs(g,{sx:{display:"flex",alignItems:"center",gap:1},children:[V(a)?t.jsx(X,{actors:a.actorInfo,size:32,teamDid:p}):u,t.jsx(q,{variant:"subtitle1",sx:{color:"text.primary"},children:V(a)?a?.actorInfo?.fullName:"System"})," ","·",t.jsx(Q,{value:a.createdAt,locale:y,shouldUpdate:!0,style:{color:m.palette.text.secondary,fontSize:"0.875rem",minWidth:"50px",whiteSpace:"nowrap"}})]}),a.activity.meta?t.jsx(g,{sx:{pl:5},children:t.jsx(ae,{meta:a.activity.meta,type:a.activity.type})}):null]},a.id)),$&&l?t.jsx(g,{sx:{mt:1,display:"flex",justifyContent:"center"},children:t.jsxs(ke,{size:"large",variant:"text",component:te,href:l,target:"_blank",rel:"noopener noreferrer",onClick:a=>{a.customPreventRedirect=!0},children:[d("notification.viewMore")," ",t.jsx(ne,{icon:Ee,style:{marginLeft:4}})]})}):null]}):null]})}function pe({notification:e,isMultiple:r=!1,blocklet:s,mountPoint:i="",avatarFallback:l}){const u=D(()=>{if(!e.activity)return null;const m=se(e.activity);return m?.targetLink?ie(m?.targetLink)?m?.targetLink:K(i,m.targetLink):null},[e.activity,i]);return r?t.jsx(he,{items:e.items,activity:e.activity,blocklet:s,mountPoint:i,viewMoreLink:u,avatarFallback:l}):t.jsx(ue,{notification:e,mountPoint:i})}function me({notification:e}){const r=o.useMemo(()=>{const{actions:s,action:i}=e;let l=s??[];return!l.length&&i&&(l=[{name:"Visit",link:i}]),l},[e]);return r.length?t.jsx(g,{sx:{display:"flex",justifyContent:"start",flexWrap:"wrap",alignItems:"center",gap:1,mt:1.5},children:r.map((s,i)=>t.jsxs(o.Fragment,{children:[t.jsx(te,{href:s.link,target:"_blank",className:"link",rel:"noopener noreferrer",sx:{fontSize:"15px"},onClick:l=>{l.customPreventRedirect=!0},children:s.name},s.link),i<r.length-1?t.jsx(Ie,{orientation:"vertical",sx:{height:12,borderWidth:"1px"}}):null]},s.link))}):null}me.propTypes={notification:n.object.isRequired};const ot=Me(g)`
2
2
  display: flex;
3
3
  justify-content: center;
4
4
  align-items: center;
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BuCfItTx.js","assets/index-S9T-sBWO.js","assets/vendor-mui-core-p6jGoroc.js","assets/vendor-react-x2lQvn4m.js","assets/vendor-ux-TkkDR0Gn.js","assets/vendor-utils-CtD44yV-.js","assets/vendor-hooks-zCCbpt45.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-BndcJjQO.js","assets/index-DrVXX4fX.css","assets/index-MGxe3V9B.js","assets/index-DRYJ0xIl.js","assets/index-B5LvOF-F.css"])))=>i.map(i=>d[i]);
2
- import{r as b,a as be}from"./vendor-react-x2lQvn4m.js";import{T as z,H,_ as ye,$ as re,A as V,D as Ce,C as ve}from"./vendor-ux-TkkDR0Gn.js";import{j as e,a1 as M,bB as K,I as X,aj as G,a3 as Y,b1 as q,T as I,ak as c,G as w,F as v,b7 as Te,b5 as le,b6 as ne,C as oe,a7 as J,aX as se,W as ae,V as D,p as Q,$ as n,am as we,cf as ce,cg as Se,c9 as Ie}from"./vendor-mui-core-p6jGoroc.js";import{g as Re,a as Ee,l as Ae}from"./index-DKdSMDX6.js";import{u as ke}from"./dot-DWse_kXZ.js";import{r as We}from"./index-waZfnNlB.js";import{_ as B,c as k,Y as Ne}from"./index-S9T-sBWO.js";import{u as $}from"./dashboard-EECTIwDT.js";import{u as ue,C as S}from"./index.esm-BONQrRCU.js";import{o as Pe,b as qe,C as te}from"./vendor-utils-CtD44yV-.js";import{T as Oe}from"./index-DJhjl40G.js";import{E as Le}from"./empty-spinner-CpvmEmwT.js";import{C}from"./click-to-copy-DlFJrA7H.js";import{D as _e}from"./delete-confirm-OwSiQs5a.js";import{a as De}from"./passport-item-DelVKtIt.js";import{A as Fe}from"./actions-CXdeSIgp.js";import{T as ie}from"./table-tips-sgNXbhRZ.js";import{u as ze}from"./use-mobile-B8-JPkft.js";import"./vendor-hooks-zCCbpt45.js";import"./lottie-web-4koyQiv_.js";import"./useAsync-C8Ma6muj.js";import"./vendor-arcblock-BndcJjQO.js";import"./useLocalStorage-DHCQcCRn.js";import"./index-DBs9Ljax.js";import"./confirm-CCJkd_GP.js";import"./get-safe-url-CFJ4a0MT.js";import"./session-CD-6TrlW.js";import"./use-blocklet-logo-B1g1jSm8.js";import"./useSetState-BWrXo9eH.js";import"./index-CnZyhA37.js";import"./over-due-invoice-payment-COY8cvLu.js";import"./use-mobile-DpkDXDwi.js";import"./arrow-down.svg-CaNNzVmj.js";import"./vendor-mui-x-CkcHHKbJ.js";import"./AdapterDayjs-DiKE7R2w.js";import"./did-address-BdvYNOBf.js";import"./util-Doke8P4Y.js";import"./base32-6sm6N7JR.js";var de=We();const Be={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function pe({onCreated:r,onClose:a}){const[i,h]=b.useState(!1),{t:l,locale:o}=z(),{api:f}=B(),{teamDid:d}=$(),{control:y,handleSubmit:g,formState:{errors:u},watch:W,setValue:m}=ue({defaultValues:Be,mode:"onChange"}),T=W("scope"),R=s=>{s!=="profile:read"&&m("scope",T.includes(s)?T.filter(x=>x!==s):[...T,s])},N=async s=>{h(!0);try{const x={...s,redirectUris:s.redirectUris,contacts:s.contacts?s.contacts.split(",").map(A=>A.trim()):[],scope:s.scope.join(" ")};await f.createOAuthClient({input:{teamDid:d,input:Pe(x,qe)}}),r(x)}catch(x){H.error(x.message||"Failed to create OAuth App")}finally{h(!1)}};return e.jsxs(M,{open:!0,onClose:a,maxWidth:"md",fullWidth:!0,children:[e.jsxs(K,{children:[l("oauth.client.register")," ",e.jsx(X,{onClick:a,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(Y,{children:e.jsxs(q,{spacing:4,sx:{mt:2},children:[e.jsx(I,{variant:"h6",gutterBottom:!0,children:l("oauth.client.requiredInformation")}),e.jsx(c,{children:e.jsx(S,{name:"clientName",control:y,rules:{required:l("oauth.client.validate.clientName"),minLength:{value:3,message:l("oauth.client.validate.clientNameMinLength")}},render:({field:s})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.name"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientNamePlaceholder"),error:!!u.clientName,helperText:u.clientName?.message}),e.jsx(v,{children:l("oauth.client.helperText.clientName")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"clientUri",control:y,rules:{required:l("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.clientUriInvalid")}},render:({field:s})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientUriPlaceholder"),error:!!u.clientUri,helperText:u.clientUri?.message}),e.jsx(v,{children:l("oauth.client.helperText.clientUri")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"redirectUris",control:y,rules:{required:l("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.redirectUrisInvalid")}},render:({field:s})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.redirectUrisPlaceholder"),error:!!u.redirectUris,helperText:u.redirectUris?.message}),e.jsxs(c,{sx:{display:"flex",gap:"2px"},children:[e.jsx(v,{children:l("oauth.client.helperText.redirectUris")}),e.jsx(v,{children:l("oauth.client.helperText.read")}),e.jsx(v,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${o}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:l("oauth.client.helperText.document")}),e.jsx(v,{children:l("oauth.client.helperText.more")})]})]})})}),e.jsxs(Te,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(I,{variant:"subtitle2",gutterBottom:!0,children:l("oauth.client.input.permissions")}),e.jsx(c,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(le,{children:Object.entries(k.OAUTH_SCOPES).map(([s,x])=>e.jsx(ne,{control:e.jsx(oe,{checked:T.includes(s),onChange:()=>R(s),disabled:s==="profile:read",color:"primary"}),label:e.jsx(c,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:x})})},s))})})]}),e.jsx(J,{}),e.jsx(I,{variant:"h6",gutterBottom:!0,children:l("oauth.client.optionalInformation")}),e.jsx(q,{children:e.jsx(S,{name:"contacts",control:y,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:l("oauth.client.validate.contacts")}},render:({field:s})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.input.contacts"),fullWidth:!0,placeholder:l("oauth.client.input.contactsPlaceholder"),error:!!u.contacts,helperText:u.contacts?.message}),e.jsx(v,{children:l("oauth.client.helperText.contacts")})]})})}),e.jsxs(q,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.tosUriInvalid")}},render:({field:s})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.input.tosUri"),fullWidth:!0,placeholder:l("oauth.client.input.tosUriPlaceholder"),error:!!u.tosUri,helperText:u.tosUri?.message}),e.jsx(v,{children:l("oauth.client.helperText.tosUri")})]})}),e.jsx(S,{name:"policyUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.policyUriInvalid")}},render:({field:s})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.input.policyUri"),fullWidth:!0,placeholder:l("oauth.client.input.policyUriPlaceholder"),error:!!u.policyUri,helperText:u.policyUri?.message}),e.jsx(v,{children:l("oauth.client.helperText.policyUri")})]})})]}),u.error&&e.jsx(se,{severity:"error",children:u.error.message})]})}),e.jsxs(ae,{children:[e.jsx(D,{onClick:a,children:l("common.cancel")}),e.jsxs(D,{onClick:g(N),disabled:i,variant:"contained",color:"primary",children:[i?e.jsx(Q,{size:20,sx:{mr:1}}):null,l("oauth.client.registerButton")]})]})]})}pe.propTypes={onCreated:n.func.isRequired,onClose:n.func.isRequired};function Z({scope:r="",...a}){if(!r)return null;const i=r.split(" ").filter(Boolean);return e.jsx(q,{direction:"row",...a,sx:[{flexWrap:"wrap",gap:1},...Array.isArray(a.sx)?a.sx:[a.sx]],children:i.map(h=>e.jsx(be.Fragment,{children:e.jsx(we,{title:k.OAUTH_SCOPES[h],children:e.jsx(C,{children:h})})},h))})}Z.propTypes={scope:n.string};const ee=r=>{const{prefix:a}=B(),{blocklet:i}=Ne(),h=te(a,"/api/media/upload",i.appPid),l=b.useCallback(f=>f?f.startsWith("http")?f:`${te(a,"/api/media/upload",i.appPid)}/${f}`:"",[a,i.appPid]);return{clientLogoUrl:b.useMemo(()=>l(r),[r,l]),apiPath:h,getClientLogoUrl:l}},$e=b.lazy(()=>ye(()=>import("./index-BuCfItTx.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(r=>({default:r.Uploader})));function he({client:r,onUpdate:a,onClose:i}){const[h,l]=b.useState(!1),{t:o,locale:f}=z(),d=b.useRef(null),{api:y}=B(),{teamDid:g}=$(),{control:u,handleSubmit:W,formState:{errors:m},watch:T,setValue:R,getValues:N}=ue({defaultValues:{clientName:r.clientName||"",clientUri:r.clientUri||"",redirectUris:Array.isArray(r.redirectUris)?r.redirectUris.join(","):"",scope:r.scope?r.scope.split(" "):["profile:read"],contacts:Array.isArray(r.contacts)?r.contacts.join(","):"",tosUri:r.tosUri||"",policyUri:r.policyUri||"",logoUri:r.logoUri||"",clientSecretExpiresAt:r.clientSecretExpiresAt||null},mode:"onChange"}),s=T("scope"),x=T("logoUri"),{clientLogoUrl:A,apiPath:P}=ee(x),E=t=>{t!=="profile:read"&&R("scope",s.includes(t)?s.filter(p=>p!==t):[...s,t])},O=async t=>{const p={clientId:r.clientId,clientName:t.clientName.trim(),clientUri:t.clientUri,redirectUris:t.redirectUris.split(",").map(j=>j.trim()).filter(Boolean),contacts:t.contacts?t.contacts.split(",").map(j=>j.trim()):[],scope:t.scope.join(" "),tosUri:t.tosUri,policyUri:t.policyUri,logoUri:t.logoUri,clientSecretExpiresAt:t.clientSecretExpiresAt?parseInt(t.clientSecretExpiresAt/1e3,10):null};await y.updateOAuthClient({input:{teamDid:g,input:p}})},_=async t=>{l(!0);try{await O(t),a(),i()}catch(p){H.error(p.message||o("oauth.client.updateFailed"))}finally{l(!1)}};return e.jsxs(M,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[e.jsxs(K,{children:[o("oauth.client.update")," ",e.jsx(X,{onClick:i,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(Y,{children:e.jsxs(q,{spacing:3,sx:{mt:2},children:[e.jsxs(c,{sx:{mb:3},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:o("oauth.client.logo")}),e.jsxs(c,{children:[e.jsx(c,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:A?e.jsx(c,{children:e.jsx("img",{src:A,alt:"client-logo",style:{width:"100%",height:"100%"}})}):e.jsx(c,{onClick:()=>{d.current?.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:e.jsx(ce,{sx:{fontSize:40,color:"common.white"}})})}),e.jsx(D,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{d.current?.open()},children:o(A?"common.change":"common.upload")})]}),e.jsx(c,{sx:{display:"flex",alignItems:"center"},children:e.jsx(b.Suspense,{fallback:e.jsx(Le,{}),children:e.jsx($e,{ref:d,locale:f,popup:!0,onUploadFinish:t=>{R("logoUri",t.data.filename),O(N()).then(()=>{a()}).catch(p=>{H.error(p.message||o("oauth.client.updateFailed"))}).finally(()=>{d.current?.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:P,disableMediaKitPrefix:!0,disableAutoPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo")})})]}),e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500},children:o("oauth.client.requiredInformation")}),e.jsx(w,{label:"Client Id",fullWidth:!0,value:r.clientId,disabled:!0}),e.jsx(c,{children:e.jsx(S,{name:"clientName",control:u,rules:{required:o("oauth.client.validate.clientName"),minLength:{value:3,message:o("oauth.client.validate.clientNameMinLength")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:o("oauth.client.name"),required:!0,fullWidth:!0,error:!!m.clientName,helperText:m.clientName?.message}),e.jsx(v,{children:o("oauth.client.helperText.clientName")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"clientUri",control:u,rules:{required:o("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:o("oauth.client.validate.clientUriInvalid")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:o("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!m.clientUri,helperText:m.clientUri?.message}),e.jsx(v,{children:o("oauth.client.helperText.clientUri")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"redirectUris",control:u,rules:{required:o("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:o("oauth.client.validate.redirectUrisInvalid")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:o("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!m.redirectUris,helperText:m.redirectUris?.message}),e.jsx(v,{children:o("oauth.client.helperText.redirectUris")})]})})}),e.jsx(S,{name:"clientSecretExpiresAt",control:u,render:({field:t})=>e.jsx(Oe,{placeholder:o("oauth.client.input.expireTime"),value:t.value*1e3,onChange:p=>{t.onChange(p)}})}),e.jsxs(c,{sx:{display:"none"},children:[e.jsx(I,{variant:"subtitle2",sx:{mb:1},children:o("oauth.client.input.permissions")}),e.jsx(c,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(le,{children:Object.entries(k.OAUTH_SCOPES).map(([t,p])=>e.jsx(ne,{control:e.jsx(oe,{checked:s.includes(t),onChange:()=>E(t),disabled:t==="profile:read",color:"primary"}),label:e.jsx(c,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:p})})},t))})})]}),e.jsx(J,{}),e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500},children:o("oauth.client.optionalInformation")}),e.jsx(c,{children:e.jsx(S,{name:"contacts",control:u,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:o("oauth.client.validate.contacts")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:o("oauth.client.input.contacts"),fullWidth:!0,error:!!m.contacts,helperText:m.contacts?.message}),e.jsx(v,{children:o("oauth.client.helperText.contacts")})]})})}),e.jsxs(q,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:u,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:o("oauth.client.validate.tosUriInvalid")}},render:({field:t})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{...t,label:o("oauth.client.input.tosUri"),fullWidth:!0,error:!!m.tosUri,helperText:m.tosUri?.message}),e.jsx(v,{children:o("oauth.client.helperText.tosUri")})]})}),e.jsx(S,{name:"policyUri",control:u,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:o("oauth.client.validate.policyUriInvalid")}},render:({field:t})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{...t,label:o("oauth.client.input.policyUri"),fullWidth:!0,error:!!m.policyUri,helperText:m.policyUri?.message}),e.jsx(v,{children:o("oauth.client.helperText.policyUri")})]})})]}),m.error&&e.jsx(se,{severity:"error",children:m.error.message})]})}),e.jsxs(ae,{children:[e.jsx(D,{onClick:i,children:o("common.cancel")}),e.jsx(D,{onClick:W(_),disabled:h,variant:"contained",color:"primary",children:h?e.jsx(Q,{size:16}):o("common.update")})]})]})}he.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string,clientSecretExpiresAt:n.number}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function me({client:r,onUpdate:a,onClose:i}){return e.jsx(he,{client:r,onUpdate:h=>a(h),onClose:i})}me.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string,clientSecretExpiresAt:n.number}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function xe({clientId:r,clientName:a,onDelete:i=()=>{},onClose:h=()=>{}}){const{t:l}=z(),{api:o}=B(),{teamDid:f}=$(),d=()=>{h()},y=async()=>{try{await o.deleteOAuthClient({input:{teamDid:f,clientId:r}}),i()}catch(u){H.error(u?.message)}finally{d()}},g={keyName:a,title:l("oauth.client.delete.title"),description:l("oauth.client.delete.description",{name:`<b>${a}</b>`}),confirmPlaceholder:l("oauth.client.delete.description",{name:a}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:y,onCancel:d};return e.jsx(_e,{keyName:g.keyName,title:g.title,description:g.description,confirmPlaceholder:g.confirmPlaceholder,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})}xe.propTypes={clientId:n.string.isRequired,clientName:n.string.isRequired,onDelete:n.func,onClose:n.func};function je({title:r,items:a}){return e.jsxs(c,{sx:{mb:3},children:[e.jsx(I,{variant:"h6",sx:{mb:1.5},children:r}),e.jsx(q,{spacing:1.5,children:a.map(({label:i,value:h})=>e.jsxs(c,{sx:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(I,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),e.jsx(I,{sx:{wordBreak:"break-all"},children:h||"-"})]},i))})]})}je.propTypes={title:n.string.isRequired,items:n.arrayOf(n.shape({label:n.string.isRequired,value:n.any})).isRequired};function ge({client:r,onClose:a}){const{t:i,locale:h}=z(),{teamDid:l}=$(),{clientName:o,clientId:f,clientSecret:d,redirectUris:y,scope:g,clientUri:u,logoUri:W,contacts:m,tosUri:T,policyUri:R,jwksUri:N,jwks:s,softwareId:x,softwareVersion:A,clientIdIssuedAt:P,clientSecretExpiresAt:E,updatedAt:O,createUser:_}=r,{clientLogoUrl:t}=ee(W),p=L=>{try{const F=new URL(window.blocklet.appUrl);return F.pathname=L,F.toString()}catch{return"-"}},j=de.fromAppDid(f,l),U=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:o},{label:i("oauth.client.logoUri"),value:e.jsx(re,{variant:"rounded",shape:"square",src:t,did:j.address,size:64})},{label:i("oauth.client.clientUri"),value:u?e.jsx(C,{children:u}):"-"},{label:i("oauth.client.clientId"),value:e.jsx(C,{children:f})},{label:i("oauth.client.clientSecret"),value:e.jsx(C,{children:d})},{label:i("oauth.client.redirectUris"),value:e.jsx(C,{children:(y||[]).join(", ")})},{label:i("oauth.client.scope"),value:e.jsx(Z,{scope:g})},{label:i("oauth.client.createUser"),value:_?De(_,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:e.jsx(C,{children:p("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/logout`)})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:m.length?e.jsx(C,{children:(m||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:T?e.jsx(C,{children:T}):"-"},{label:i("oauth.client.policyUri"),value:R?e.jsx(C,{children:R}):"-"},{label:i("oauth.client.jwksUri"),value:N},{label:i("oauth.client.jwks"),value:s},{label:i("oauth.client.softwareId"),value:x},{label:i("oauth.client.softwareVersion"),value:A}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:P?e.jsx(V,{value:P*1e3,type:"all",locale:h}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:E?e.jsx(V,{value:E*1e3,type:"all",locale:h}):"-"},{label:i("common.updatedAt"),value:O?e.jsx(V,{value:O,type:"all",locale:h}):"-"}]}].filter(Boolean);return e.jsxs(M,{open:!0,onClose:a,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(K,{children:[i("oauth.client.oauthAppDetails"),e.jsx(X,{onClick:a,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(Y,{children:e.jsx(c,{sx:{mt:1},children:U.map((L,F)=>e.jsxs(c,{children:[e.jsx(je,{title:L.title,items:L.items}),F!==U.length-1&&e.jsx(J,{sx:{my:2}})]},L.title))})})]})}ge.propTypes={client:n.object.isRequired,onClose:n.func.isRequired};function Ve(r){return e.jsx(V,{value:r*1e3})}function fe({selected:r=null,onClose:a}){return r?e.jsx(ge,{client:r,onClose:a}):null}fe.propTypes={selected:n.object,onClose:n.func.isRequired};function Ue({open:r,onCreated:a,onClose:i}){return r?e.jsx(pe,{onCreated:a,onClose:i}):null}Ue.propTypes={open:n.bool.isRequired,onCreated:n.func.isRequired,onClose:n.func.isRequired};function Et(){const[r,a]=b.useState({searchText:"",pageSize:10,page:1}),[i,h]=b.useState(null),[l,o]=b.useState(!1),f=b.useRef(null),{t:d,locale:y}=z(),{api:g}=B(),{teamDid:u}=$(),[W,m]=b.useState(null),[T,R]=b.useState(null),N=ze(),{getClientLogoUrl:s}=ee(),x=ke(async()=>await g.getOAuthClients({input:{teamDid:u,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:A}=x,P=b.useMemo(()=>x.value?.list||[],[x.value?.list]),E=b.useMemo(()=>r.searchText?P.filter(t=>t.clientName.toLowerCase().includes(r.searchText.toLowerCase())||t.clientId.toLowerCase().includes(r.searchText.toLowerCase())||t.scope.toLowerCase().includes(r.searchText.toLowerCase())):P,[r.searchText,P]),O=b.useMemo(()=>[{label:d("oauth.client.name"),name:"clientName",options:{customBodyRender:(t,{rowIndex:p})=>{const j=E[p],U=s(j.logoUri),L=de.fromAppDid(j.clientId,u);return e.jsx(c,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(c,{sx:{display:"flex",alignItems:"center",gap:2,cursor:"pointer"},children:[e.jsx(re,{variant:"rounded",shape:"square",did:L.address,src:U,size:48}),e.jsxs(q,{sx:{gap:.5},children:[e.jsx(c,{sx:{color:"text.primary"},children:j.clientName}),e.jsx(c,{sx:{color:"text.secondary"},children:j.clientUri})]})]})})}}},{label:d("oauth.client.clientId"),name:"clientId"},{label:d("oauth.client.scope"),name:"scope",options:{customBodyRender:t=>e.jsx(Z,{scope:t})}},{label:d("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:Ve}},{label:d("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:t=>t?e.jsx(Re,{showDid:!0,did:t,cardType:Ae.Detailed,infoType:Ee.Minimal,sx:{border:0,padding:0}}):d("oauth.client.openRegistration")}},{label:d("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(t,{rowIndex:p})=>{const j=E[p];return e.jsx(Fe,{actions:[{icon:e.jsx(Se,{}),text:d("common.edit"),onClick:U=>{U.stopPropagation(),m(j)}},{icon:e.jsx(Ie,{}),text:d("common.delete"),onClick:U=>{U.stopPropagation(),R(j)}}]})}}}],[E,d,s,u,m,R]),_=({page:t,rowsPerPage:p,searchText:j})=>{r.pageSize!==p?a(U=>({...U,searchText:"",pageSize:p,page:1})):r.page!==t+1?a(U=>({...U,searchText:"",page:t+1})):r.searchText!==j&&a(U=>({...U,searchText:j,page:1}))};return e.jsxs(c,{ref:f,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[N?e.jsx(ie,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}):null,e.jsx(Ce,{data:E,columns:O,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:E.length,searchDebounceTime:400,onRowClick(t,{dataIndex:p},j){if(f.current?.contains(j.target)){const U=E[p];h(U)}}},onChange:_,title:N?null:e.jsx(ie,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}),customButtons:[e.jsxs(D,{variant:"contained",size:"small",onClick:()=>o(!0),children:[A?e.jsx(Q,{size:16}):e.jsx(ce,{style:{fontSize:16}}),d("common.create")]},"add")],loading:!1,emptyNode:e.jsx(ve,{children:d("oauth.client.empty")})}),e.jsx(fe,{selected:i,onClose:()=>h(null)}),e.jsx(Ue,{open:l,onCreated:()=>{o(!1),x.retry()},onClose:()=>o(!1)}),W&&e.jsx(me,{client:W,onUpdate:x.retry,onClose:()=>m(null)}),T&&e.jsx(xe,{...T,onDelete:x.retry,onClose:()=>R(null)})]})}export{Et as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-T7E5JhUh.js","assets/index-CDq77s86.js","assets/vendor-mui-core-p6jGoroc.js","assets/vendor-react-x2lQvn4m.js","assets/vendor-ux-TkkDR0Gn.js","assets/vendor-utils-CtD44yV-.js","assets/vendor-hooks-zCCbpt45.js","assets/lottie-web-4koyQiv_.js","assets/vendor-ux-DYcPPYq2.css","assets/vendor-arcblock-BndcJjQO.js","assets/index-DrVXX4fX.css","assets/index-MGxe3V9B.js","assets/index-DRYJ0xIl.js","assets/index-B5LvOF-F.css"])))=>i.map(i=>d[i]);
2
+ import{r as b,a as be}from"./vendor-react-x2lQvn4m.js";import{T as z,H,_ as ye,$ as re,A as V,D as Ce,C as ve}from"./vendor-ux-TkkDR0Gn.js";import{j as e,a1 as M,bB as K,I as X,aj as G,a3 as Y,b1 as q,T as I,ak as c,G as w,F as v,b7 as Te,b5 as le,b6 as ne,C as oe,a7 as J,aX as se,W as ae,V as D,p as Q,$ as n,am as we,cf as ce,cg as Se,c9 as Ie}from"./vendor-mui-core-p6jGoroc.js";import{g as Re,a as Ee,l as Ae}from"./index-DhFdjB1D.js";import{u as ke}from"./dot-DWse_kXZ.js";import{r as We}from"./index-BWv4abon.js";import{_ as B,c as k,Y as Ne}from"./index-CDq77s86.js";import{u as $}from"./dashboard-e9cJiXmU.js";import{u as ue,C as S}from"./index.esm-BONQrRCU.js";import{o as Pe,b as qe,C as te}from"./vendor-utils-CtD44yV-.js";import{T as Oe}from"./index-Bqnrq_qv.js";import{E as Le}from"./empty-spinner-CpvmEmwT.js";import{C}from"./click-to-copy-DlFJrA7H.js";import{D as _e}from"./delete-confirm-DBhhuh63.js";import{a as De}from"./passport-item-DmWZqcWM.js";import{A as Fe}from"./actions-CXdeSIgp.js";import{T as ie}from"./table-tips-sgNXbhRZ.js";import{u as ze}from"./use-mobile-B8-JPkft.js";import"./vendor-hooks-zCCbpt45.js";import"./lottie-web-4koyQiv_.js";import"./useAsync-C8Ma6muj.js";import"./vendor-arcblock-BndcJjQO.js";import"./useLocalStorage-DHCQcCRn.js";import"./index-DBs9Ljax.js";import"./confirm-_x5prMc6.js";import"./get-safe-url-70dNOHyP.js";import"./session-CvQ97dDY.js";import"./use-blocklet-logo-C7qZcidt.js";import"./useSetState-BWrXo9eH.js";import"./index-glbEl-Pn.js";import"./over-due-invoice-payment-CuQ5h3hN.js";import"./use-mobile-DpkDXDwi.js";import"./arrow-down.svg-BykEFw6H.js";import"./vendor-mui-x-CkcHHKbJ.js";import"./AdapterDayjs-DiKE7R2w.js";import"./did-address-BdvYNOBf.js";import"./util-B-cMjJCC.js";import"./base32-6sm6N7JR.js";var de=We();const Be={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function pe({onCreated:r,onClose:a}){const[i,h]=b.useState(!1),{t:l,locale:o}=z(),{api:f}=B(),{teamDid:d}=$(),{control:y,handleSubmit:g,formState:{errors:u},watch:W,setValue:m}=ue({defaultValues:Be,mode:"onChange"}),T=W("scope"),R=s=>{s!=="profile:read"&&m("scope",T.includes(s)?T.filter(x=>x!==s):[...T,s])},N=async s=>{h(!0);try{const x={...s,redirectUris:s.redirectUris,contacts:s.contacts?s.contacts.split(",").map(A=>A.trim()):[],scope:s.scope.join(" ")};await f.createOAuthClient({input:{teamDid:d,input:Pe(x,qe)}}),r(x)}catch(x){H.error(x.message||"Failed to create OAuth App")}finally{h(!1)}};return e.jsxs(M,{open:!0,onClose:a,maxWidth:"md",fullWidth:!0,children:[e.jsxs(K,{children:[l("oauth.client.register")," ",e.jsx(X,{onClick:a,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(Y,{children:e.jsxs(q,{spacing:4,sx:{mt:2},children:[e.jsx(I,{variant:"h6",gutterBottom:!0,children:l("oauth.client.requiredInformation")}),e.jsx(c,{children:e.jsx(S,{name:"clientName",control:y,rules:{required:l("oauth.client.validate.clientName"),minLength:{value:3,message:l("oauth.client.validate.clientNameMinLength")}},render:({field:s})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.name"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientNamePlaceholder"),error:!!u.clientName,helperText:u.clientName?.message}),e.jsx(v,{children:l("oauth.client.helperText.clientName")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"clientUri",control:y,rules:{required:l("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.clientUriInvalid")}},render:({field:s})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.clientUriPlaceholder"),error:!!u.clientUri,helperText:u.clientUri?.message}),e.jsx(v,{children:l("oauth.client.helperText.clientUri")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"redirectUris",control:y,rules:{required:l("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:l("oauth.client.validate.redirectUrisInvalid")}},render:({field:s})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:l("oauth.client.input.redirectUrisPlaceholder"),error:!!u.redirectUris,helperText:u.redirectUris?.message}),e.jsxs(c,{sx:{display:"flex",gap:"2px"},children:[e.jsx(v,{children:l("oauth.client.helperText.redirectUris")}),e.jsx(v,{children:l("oauth.client.helperText.read")}),e.jsx(v,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${o}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:l("oauth.client.helperText.document")}),e.jsx(v,{children:l("oauth.client.helperText.more")})]})]})})}),e.jsxs(Te,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(I,{variant:"subtitle2",gutterBottom:!0,children:l("oauth.client.input.permissions")}),e.jsx(c,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(le,{children:Object.entries(k.OAUTH_SCOPES).map(([s,x])=>e.jsx(ne,{control:e.jsx(oe,{checked:T.includes(s),onChange:()=>R(s),disabled:s==="profile:read",color:"primary"}),label:e.jsx(c,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:x})})},s))})})]}),e.jsx(J,{}),e.jsx(I,{variant:"h6",gutterBottom:!0,children:l("oauth.client.optionalInformation")}),e.jsx(q,{children:e.jsx(S,{name:"contacts",control:y,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:l("oauth.client.validate.contacts")}},render:({field:s})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.input.contacts"),fullWidth:!0,placeholder:l("oauth.client.input.contactsPlaceholder"),error:!!u.contacts,helperText:u.contacts?.message}),e.jsx(v,{children:l("oauth.client.helperText.contacts")})]})})}),e.jsxs(q,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.tosUriInvalid")}},render:({field:s})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.input.tosUri"),fullWidth:!0,placeholder:l("oauth.client.input.tosUriPlaceholder"),error:!!u.tosUri,helperText:u.tosUri?.message}),e.jsx(v,{children:l("oauth.client.helperText.tosUri")})]})}),e.jsx(S,{name:"policyUri",control:y,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:l("oauth.client.validate.policyUriInvalid")}},render:({field:s})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...s,label:l("oauth.client.input.policyUri"),fullWidth:!0,placeholder:l("oauth.client.input.policyUriPlaceholder"),error:!!u.policyUri,helperText:u.policyUri?.message}),e.jsx(v,{children:l("oauth.client.helperText.policyUri")})]})})]}),u.error&&e.jsx(se,{severity:"error",children:u.error.message})]})}),e.jsxs(ae,{children:[e.jsx(D,{onClick:a,children:l("common.cancel")}),e.jsxs(D,{onClick:g(N),disabled:i,variant:"contained",color:"primary",children:[i?e.jsx(Q,{size:20,sx:{mr:1}}):null,l("oauth.client.registerButton")]})]})]})}pe.propTypes={onCreated:n.func.isRequired,onClose:n.func.isRequired};function Z({scope:r="",...a}){if(!r)return null;const i=r.split(" ").filter(Boolean);return e.jsx(q,{direction:"row",...a,sx:[{flexWrap:"wrap",gap:1},...Array.isArray(a.sx)?a.sx:[a.sx]],children:i.map(h=>e.jsx(be.Fragment,{children:e.jsx(we,{title:k.OAUTH_SCOPES[h],children:e.jsx(C,{children:h})})},h))})}Z.propTypes={scope:n.string};const ee=r=>{const{prefix:a}=B(),{blocklet:i}=Ne(),h=te(a,"/api/media/upload",i.appPid),l=b.useCallback(f=>f?f.startsWith("http")?f:`${te(a,"/api/media/upload",i.appPid)}/${f}`:"",[a,i.appPid]);return{clientLogoUrl:b.useMemo(()=>l(r),[r,l]),apiPath:h,getClientLogoUrl:l}},$e=b.lazy(()=>ye(()=>import("./index-T7E5JhUh.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(r=>({default:r.Uploader})));function he({client:r,onUpdate:a,onClose:i}){const[h,l]=b.useState(!1),{t:o,locale:f}=z(),d=b.useRef(null),{api:y}=B(),{teamDid:g}=$(),{control:u,handleSubmit:W,formState:{errors:m},watch:T,setValue:R,getValues:N}=ue({defaultValues:{clientName:r.clientName||"",clientUri:r.clientUri||"",redirectUris:Array.isArray(r.redirectUris)?r.redirectUris.join(","):"",scope:r.scope?r.scope.split(" "):["profile:read"],contacts:Array.isArray(r.contacts)?r.contacts.join(","):"",tosUri:r.tosUri||"",policyUri:r.policyUri||"",logoUri:r.logoUri||"",clientSecretExpiresAt:r.clientSecretExpiresAt||null},mode:"onChange"}),s=T("scope"),x=T("logoUri"),{clientLogoUrl:A,apiPath:P}=ee(x),E=t=>{t!=="profile:read"&&R("scope",s.includes(t)?s.filter(p=>p!==t):[...s,t])},O=async t=>{const p={clientId:r.clientId,clientName:t.clientName.trim(),clientUri:t.clientUri,redirectUris:t.redirectUris.split(",").map(j=>j.trim()).filter(Boolean),contacts:t.contacts?t.contacts.split(",").map(j=>j.trim()):[],scope:t.scope.join(" "),tosUri:t.tosUri,policyUri:t.policyUri,logoUri:t.logoUri,clientSecretExpiresAt:t.clientSecretExpiresAt?parseInt(t.clientSecretExpiresAt/1e3,10):null};await y.updateOAuthClient({input:{teamDid:g,input:p}})},_=async t=>{l(!0);try{await O(t),a(),i()}catch(p){H.error(p.message||o("oauth.client.updateFailed"))}finally{l(!1)}};return e.jsxs(M,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[e.jsxs(K,{children:[o("oauth.client.update")," ",e.jsx(X,{onClick:i,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(Y,{children:e.jsxs(q,{spacing:3,sx:{mt:2},children:[e.jsxs(c,{sx:{mb:3},children:[e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:o("oauth.client.logo")}),e.jsxs(c,{children:[e.jsx(c,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:A?e.jsx(c,{children:e.jsx("img",{src:A,alt:"client-logo",style:{width:"100%",height:"100%"}})}):e.jsx(c,{onClick:()=>{d.current?.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:e.jsx(ce,{sx:{fontSize:40,color:"common.white"}})})}),e.jsx(D,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{d.current?.open()},children:o(A?"common.change":"common.upload")})]}),e.jsx(c,{sx:{display:"flex",alignItems:"center"},children:e.jsx(b.Suspense,{fallback:e.jsx(Le,{}),children:e.jsx($e,{ref:d,locale:f,popup:!0,onUploadFinish:t=>{R("logoUri",t.data.filename),O(N()).then(()=>{a()}).catch(p=>{H.error(p.message||o("oauth.client.updateFailed"))}).finally(()=>{d.current?.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:P,disableMediaKitPrefix:!0,disableAutoPrefix:!0,disableMediaKitStatus:!0},coreProps:{restrictions:{allowedFileTypes:["image/png","image/jpeg","image/webp","image/svg+xml"],maxFileSize:1024*1024*.5,maxNumberOfFiles:1}},dashboardProps:{autoOpen:"imageEditor"},imageEditorProps:{actions:{revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!1,cropWidescreen:!1,cropWidescreenVertical:!1},cropperOptions:{autoCrop:!0,aspectRatio:1,initialAspectRatio:1,autoCropArea:1,croppedCanvasOptions:{minWidth:256,minHeight:256}}}},"uploader-logo")})})]}),e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500},children:o("oauth.client.requiredInformation")}),e.jsx(w,{label:"Client Id",fullWidth:!0,value:r.clientId,disabled:!0}),e.jsx(c,{children:e.jsx(S,{name:"clientName",control:u,rules:{required:o("oauth.client.validate.clientName"),minLength:{value:3,message:o("oauth.client.validate.clientNameMinLength")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:o("oauth.client.name"),required:!0,fullWidth:!0,error:!!m.clientName,helperText:m.clientName?.message}),e.jsx(v,{children:o("oauth.client.helperText.clientName")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"clientUri",control:u,rules:{required:o("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:o("oauth.client.validate.clientUriInvalid")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:o("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!m.clientUri,helperText:m.clientUri?.message}),e.jsx(v,{children:o("oauth.client.helperText.clientUri")})]})})}),e.jsx(c,{children:e.jsx(S,{name:"redirectUris",control:u,rules:{required:o("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:o("oauth.client.validate.redirectUrisInvalid")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:o("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!m.redirectUris,helperText:m.redirectUris?.message}),e.jsx(v,{children:o("oauth.client.helperText.redirectUris")})]})})}),e.jsx(S,{name:"clientSecretExpiresAt",control:u,render:({field:t})=>e.jsx(Oe,{placeholder:o("oauth.client.input.expireTime"),value:t.value*1e3,onChange:p=>{t.onChange(p)}})}),e.jsxs(c,{sx:{display:"none"},children:[e.jsx(I,{variant:"subtitle2",sx:{mb:1},children:o("oauth.client.input.permissions")}),e.jsx(c,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(le,{children:Object.entries(k.OAUTH_SCOPES).map(([t,p])=>e.jsx(ne,{control:e.jsx(oe,{checked:s.includes(t),onChange:()=>E(t),disabled:t==="profile:read",color:"primary"}),label:e.jsx(c,{children:e.jsx(I,{variant:"body2",sx:{fontWeight:500},children:p})})},t))})})]}),e.jsx(J,{}),e.jsx(I,{variant:"subtitle1",sx:{fontWeight:500},children:o("oauth.client.optionalInformation")}),e.jsx(c,{children:e.jsx(S,{name:"contacts",control:u,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:o("oauth.client.validate.contacts")}},render:({field:t})=>e.jsxs(e.Fragment,{children:[e.jsx(w,{...t,label:o("oauth.client.input.contacts"),fullWidth:!0,error:!!m.contacts,helperText:m.contacts?.message}),e.jsx(v,{children:o("oauth.client.helperText.contacts")})]})})}),e.jsxs(q,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:u,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:o("oauth.client.validate.tosUriInvalid")}},render:({field:t})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{...t,label:o("oauth.client.input.tosUri"),fullWidth:!0,error:!!m.tosUri,helperText:m.tosUri?.message}),e.jsx(v,{children:o("oauth.client.helperText.tosUri")})]})}),e.jsx(S,{name:"policyUri",control:u,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:o("oauth.client.validate.policyUriInvalid")}},render:({field:t})=>e.jsxs(c,{sx:{width:"50%"},children:[e.jsx(w,{...t,label:o("oauth.client.input.policyUri"),fullWidth:!0,error:!!m.policyUri,helperText:m.policyUri?.message}),e.jsx(v,{children:o("oauth.client.helperText.policyUri")})]})})]}),m.error&&e.jsx(se,{severity:"error",children:m.error.message})]})}),e.jsxs(ae,{children:[e.jsx(D,{onClick:i,children:o("common.cancel")}),e.jsx(D,{onClick:W(_),disabled:h,variant:"contained",color:"primary",children:h?e.jsx(Q,{size:16}):o("common.update")})]})]})}he.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string,clientSecretExpiresAt:n.number}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function me({client:r,onUpdate:a,onClose:i}){return e.jsx(he,{client:r,onUpdate:h=>a(h),onClose:i})}me.propTypes={client:n.shape({clientId:n.string.isRequired,clientName:n.string.isRequired,clientUri:n.string,redirectUris:n.arrayOf(n.string),scope:n.string,contacts:n.arrayOf(n.string),tosUri:n.string,policyUri:n.string,logoUri:n.string,clientSecretExpiresAt:n.number}).isRequired,onUpdate:n.func.isRequired,onClose:n.func.isRequired};function xe({clientId:r,clientName:a,onDelete:i=()=>{},onClose:h=()=>{}}){const{t:l}=z(),{api:o}=B(),{teamDid:f}=$(),d=()=>{h()},y=async()=>{try{await o.deleteOAuthClient({input:{teamDid:f,clientId:r}}),i()}catch(u){H.error(u?.message)}finally{d()}},g={keyName:a,title:l("oauth.client.delete.title"),description:l("oauth.client.delete.description",{name:`<b>${a}</b>`}),confirmPlaceholder:l("oauth.client.delete.description",{name:a}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:y,onCancel:d};return e.jsx(_e,{keyName:g.keyName,title:g.title,description:g.description,confirmPlaceholder:g.confirmPlaceholder,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel})}xe.propTypes={clientId:n.string.isRequired,clientName:n.string.isRequired,onDelete:n.func,onClose:n.func};function je({title:r,items:a}){return e.jsxs(c,{sx:{mb:3},children:[e.jsx(I,{variant:"h6",sx:{mb:1.5},children:r}),e.jsx(q,{spacing:1.5,children:a.map(({label:i,value:h})=>e.jsxs(c,{sx:{display:"flex",alignItems:"center",gap:2},children:[e.jsx(I,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),e.jsx(I,{sx:{wordBreak:"break-all"},children:h||"-"})]},i))})]})}je.propTypes={title:n.string.isRequired,items:n.arrayOf(n.shape({label:n.string.isRequired,value:n.any})).isRequired};function ge({client:r,onClose:a}){const{t:i,locale:h}=z(),{teamDid:l}=$(),{clientName:o,clientId:f,clientSecret:d,redirectUris:y,scope:g,clientUri:u,logoUri:W,contacts:m,tosUri:T,policyUri:R,jwksUri:N,jwks:s,softwareId:x,softwareVersion:A,clientIdIssuedAt:P,clientSecretExpiresAt:E,updatedAt:O,createUser:_}=r,{clientLogoUrl:t}=ee(W),p=L=>{try{const F=new URL(window.blocklet.appUrl);return F.pathname=L,F.toString()}catch{return"-"}},j=de.fromAppDid(f,l),U=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:o},{label:i("oauth.client.logoUri"),value:e.jsx(re,{variant:"rounded",shape:"square",src:t,did:j.address,size:64})},{label:i("oauth.client.clientUri"),value:u?e.jsx(C,{children:u}):"-"},{label:i("oauth.client.clientId"),value:e.jsx(C,{children:f})},{label:i("oauth.client.clientSecret"),value:e.jsx(C,{children:d})},{label:i("oauth.client.redirectUris"),value:e.jsx(C,{children:(y||[]).join(", ")})},{label:i("oauth.client.scope"),value:e.jsx(Z,{scope:g})},{label:i("oauth.client.createUser"),value:_?De(_,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:e.jsx(C,{children:p("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:e.jsx(C,{children:p(`${k.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/logout`)})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:m.length?e.jsx(C,{children:(m||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:T?e.jsx(C,{children:T}):"-"},{label:i("oauth.client.policyUri"),value:R?e.jsx(C,{children:R}):"-"},{label:i("oauth.client.jwksUri"),value:N},{label:i("oauth.client.jwks"),value:s},{label:i("oauth.client.softwareId"),value:x},{label:i("oauth.client.softwareVersion"),value:A}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:P?e.jsx(V,{value:P*1e3,type:"all",locale:h}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:E?e.jsx(V,{value:E*1e3,type:"all",locale:h}):"-"},{label:i("common.updatedAt"),value:O?e.jsx(V,{value:O,type:"all",locale:h}):"-"}]}].filter(Boolean);return e.jsxs(M,{open:!0,onClose:a,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(K,{children:[i("oauth.client.oauthAppDetails"),e.jsx(X,{onClick:a,sx:{position:"absolute",right:8,top:8},children:e.jsx(G,{})})]}),e.jsx(Y,{children:e.jsx(c,{sx:{mt:1},children:U.map((L,F)=>e.jsxs(c,{children:[e.jsx(je,{title:L.title,items:L.items}),F!==U.length-1&&e.jsx(J,{sx:{my:2}})]},L.title))})})]})}ge.propTypes={client:n.object.isRequired,onClose:n.func.isRequired};function Ve(r){return e.jsx(V,{value:r*1e3})}function fe({selected:r=null,onClose:a}){return r?e.jsx(ge,{client:r,onClose:a}):null}fe.propTypes={selected:n.object,onClose:n.func.isRequired};function Ue({open:r,onCreated:a,onClose:i}){return r?e.jsx(pe,{onCreated:a,onClose:i}):null}Ue.propTypes={open:n.bool.isRequired,onCreated:n.func.isRequired,onClose:n.func.isRequired};function Et(){const[r,a]=b.useState({searchText:"",pageSize:10,page:1}),[i,h]=b.useState(null),[l,o]=b.useState(!1),f=b.useRef(null),{t:d,locale:y}=z(),{api:g}=B(),{teamDid:u}=$(),[W,m]=b.useState(null),[T,R]=b.useState(null),N=ze(),{getClientLogoUrl:s}=ee(),x=ke(async()=>await g.getOAuthClients({input:{teamDid:u,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:A}=x,P=b.useMemo(()=>x.value?.list||[],[x.value?.list]),E=b.useMemo(()=>r.searchText?P.filter(t=>t.clientName.toLowerCase().includes(r.searchText.toLowerCase())||t.clientId.toLowerCase().includes(r.searchText.toLowerCase())||t.scope.toLowerCase().includes(r.searchText.toLowerCase())):P,[r.searchText,P]),O=b.useMemo(()=>[{label:d("oauth.client.name"),name:"clientName",options:{customBodyRender:(t,{rowIndex:p})=>{const j=E[p],U=s(j.logoUri),L=de.fromAppDid(j.clientId,u);return e.jsx(c,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(c,{sx:{display:"flex",alignItems:"center",gap:2,cursor:"pointer"},children:[e.jsx(re,{variant:"rounded",shape:"square",did:L.address,src:U,size:48}),e.jsxs(q,{sx:{gap:.5},children:[e.jsx(c,{sx:{color:"text.primary"},children:j.clientName}),e.jsx(c,{sx:{color:"text.secondary"},children:j.clientUri})]})]})})}}},{label:d("oauth.client.clientId"),name:"clientId"},{label:d("oauth.client.scope"),name:"scope",options:{customBodyRender:t=>e.jsx(Z,{scope:t})}},{label:d("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:Ve}},{label:d("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:t=>t?e.jsx(Re,{showDid:!0,did:t,cardType:Ae.Detailed,infoType:Ee.Minimal,sx:{border:0,padding:0}}):d("oauth.client.openRegistration")}},{label:d("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(t,{rowIndex:p})=>{const j=E[p];return e.jsx(Fe,{actions:[{icon:e.jsx(Se,{}),text:d("common.edit"),onClick:U=>{U.stopPropagation(),m(j)}},{icon:e.jsx(Ie,{}),text:d("common.delete"),onClick:U=>{U.stopPropagation(),R(j)}}]})}}}],[E,d,s,u,m,R]),_=({page:t,rowsPerPage:p,searchText:j})=>{r.pageSize!==p?a(U=>({...U,searchText:"",pageSize:p,page:1})):r.page!==t+1?a(U=>({...U,searchText:"",page:t+1})):r.searchText!==j&&a(U=>({...U,searchText:j,page:1}))};return e.jsxs(c,{ref:f,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[N?e.jsx(ie,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}):null,e.jsx(Ce,{data:E,columns:O,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:E.length,searchDebounceTime:400,onRowClick(t,{dataIndex:p},j){if(f.current?.contains(j.target)){const U=E[p];h(U)}}},onChange:_,title:N?null:e.jsx(ie,{title:d("oauth.client.listTitle"),tooltipTitle:d("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${y}/oauth-service`}),customButtons:[e.jsxs(D,{variant:"contained",size:"small",onClick:()=>o(!0),children:[A?e.jsx(Q,{size:16}):e.jsx(ce,{style:{fontSize:16}}),d("common.create")]},"add")],loading:!1,emptyNode:e.jsx(ve,{children:d("oauth.client.empty")})}),e.jsx(fe,{selected:i,onClose:()=>h(null)}),e.jsx(Ue,{open:l,onCreated:()=>{o(!1),x.retry()},onClose:()=>o(!1)}),W&&e.jsx(me,{client:W,onUpdate:x.retry,onClose:()=>m(null)}),T&&e.jsx(xe,{...T,onDelete:x.retry,onClose:()=>R(null)})]})}export{Et as default};
@@ -1 +1 @@
1
- import{j as o}from"./vendor-mui-core-p6jGoroc.js";import"./vendor-react-x2lQvn4m.js";import{S as t}from"./studio-CiSsKpFb.js";import"./vendor-ux-TkkDR0Gn.js";import"./vendor-utils-CtD44yV-.js";import"./vendor-hooks-zCCbpt45.js";import"./lottie-web-4koyQiv_.js";import"./index-CnZyhA37.js";import"./index-S9T-sBWO.js";import"./vendor-arcblock-BndcJjQO.js";function f(){return o.jsx(t,{children:"Coming soon..."})}export{f as default};
1
+ import{j as o}from"./vendor-mui-core-p6jGoroc.js";import"./vendor-react-x2lQvn4m.js";import{S as t}from"./studio-BoYrF6Kl.js";import"./vendor-ux-TkkDR0Gn.js";import"./vendor-utils-CtD44yV-.js";import"./vendor-hooks-zCCbpt45.js";import"./lottie-web-4koyQiv_.js";import"./index-glbEl-Pn.js";import"./index-CDq77s86.js";import"./vendor-arcblock-BndcJjQO.js";function f(){return o.jsx(t,{children:"Coming soon..."})}export{f as default};