@abtnode/blocklet-services 1.16.45-beta-20250610-112229-2eb0face → 1.16.45-beta-20250612-231219-481217be

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 (159) hide show
  1. package/api/cache.js +36 -21
  2. package/api/libs/connect/session.js +2 -2
  3. package/api/middlewares/proxy-to-daemon.js +6 -2
  4. package/api/routes/blocklet.js +25 -5
  5. package/api/routes/dns-resolver.js +1 -1
  6. package/api/routes/env.js +2 -1
  7. package/api/services/auth/connect/invite.js +1 -1
  8. package/api/services/auth/connect/issue-passport.js +1 -1
  9. package/api/services/auth/connect/verify-destroy.js +3 -6
  10. package/api/services/auth/connect/verify-elevated.js +8 -9
  11. package/api/services/auth/session.js +1 -1
  12. package/api/services/oauth/server.js +2 -1
  13. package/api/socket/channel/did.js +2 -2
  14. package/dist/assets/{AdapterDayjs-Dvf_tKNm.js → AdapterDayjs-BzjU9O7t.js} +1 -1
  15. package/dist/assets/{ArrowDropDown-w902LDz5.js → ArrowDropDown-CrJjI_sT.js} +1 -1
  16. package/dist/assets/{CheckCircle-DKLAiayP.js → CheckCircle-BcPSvH2E.js} +1 -1
  17. package/dist/assets/{ChevronLeft-DoQQtCAX.js → ChevronLeft-Ch9iK6fF.js} +1 -1
  18. package/dist/assets/{ChevronRight-Ch_6RLsY.js → ChevronRight-DclARA5k.js} +1 -1
  19. package/dist/assets/{DeleteOutline-CPVsjCvJ.js → DeleteOutline-CnS2XiM1.js} +1 -1
  20. package/dist/assets/{Done-C5C8-4SV.js → Done-C9LPqADS.js} +1 -1
  21. package/dist/assets/{Download-DqajrKRK.js → Download-D9LfWoxF.js} +1 -1
  22. package/dist/assets/{Edit-D_qzRYqq.js → Edit-rPlryssW.js} +1 -1
  23. package/dist/assets/{Error-KxELF1Nr.js → Error-q_AhSCeT.js} +1 -1
  24. package/dist/assets/{ExpandLess-JVHHKQQZ.js → ExpandLess-Da2Rv9Ox.js} +1 -1
  25. package/dist/assets/{Google-BBqC-Muc.js → Google-Buu8u6PW.js} +1 -1
  26. package/dist/assets/{Home-DD-eYV7C.js → Home-DkCBzKe9.js} +1 -1
  27. package/dist/assets/{InfoOutlined-CEh25_NY.js → InfoOutlined-C8ZBPUhD.js} +1 -1
  28. package/dist/assets/{Launch-Cs8Cmdb_.js → Launch-Nu8TBDKk.js} +1 -1
  29. package/dist/assets/{LaunchOutlined-CH9e3hkq.js → LaunchOutlined-DQZ7S23O.js} +1 -1
  30. package/dist/assets/{MoreHoriz-Cpg0a_lm.js → MoreHoriz-Ba9rYlyz.js} +1 -1
  31. package/dist/assets/{PlayArrow-Hu915_DX.js → PlayArrow-RVSfCmrB.js} +1 -1
  32. package/dist/assets/{TuneOutlined-DRDP7kDe.js → TuneOutlined-CwV20zYf.js} +1 -1
  33. package/dist/assets/{ViewList-DN8B89Ry.js → ViewList-D1BI4ac9.js} +1 -1
  34. package/dist/assets/{access-control-MsBNowAW.js → access-control-C-kFaf9T.js} +1 -1
  35. package/dist/assets/{actions-CcWHhKZq.js → actions-DYQW2ChM.js} +1 -1
  36. package/dist/assets/{add-component-core-C3s0hRWv.js → add-component-core-UeQfX1b1.js} +34 -34
  37. package/dist/assets/{add-resource-LwzRr27k.js → add-resource-BdL-oJxe.js} +1 -1
  38. package/dist/assets/{addon-Dju3pjTL.js → addon-DMedfvRj.js} +1 -1
  39. package/dist/assets/{advanced-DYaxCBlN.js → advanced-BZZToP_j.js} +2 -2
  40. package/dist/assets/api-87p2GGd0.js +1 -0
  41. package/dist/assets/{appearance-A-FJhFPq.js → appearance-CYop22yw.js} +1 -1
  42. package/dist/assets/{audit-logs-Cs45RZoE.js → audit-logs-BtBk6uAY.js} +1 -1
  43. package/dist/assets/{authorize-fdrPc1Nd.js → authorize-CQZkUNyV.js} +1 -1
  44. package/dist/assets/{base-chart-DIErGYHN.js → base-chart-C2FJuVG1.js} +1 -1
  45. package/dist/assets/{base32-Do9iD28a.js → base32-DEjena1X.js} +1 -1
  46. package/dist/assets/{branding-CT66qulY.js → branding-7ppDxFZf.js} +2 -2
  47. package/dist/assets/{branding-OfbhdEgY.js → branding-gXMozCeI.js} +1 -1
  48. package/dist/assets/{bundle-avatar-LAkmelll.js → bundle-avatar-B5-ypzmO.js} +1 -1
  49. package/dist/assets/{button-B_vgCyye.js → button-YPMo8IwK.js} +1 -1
  50. package/dist/assets/{click-to-copy-BfYfYud0.js → click-to-copy-BMX2P5UB.js} +1 -1
  51. package/dist/assets/{cloneDeep-ro06l5HL.js → cloneDeep-Jl_OPbSo.js} +1 -1
  52. package/dist/assets/{collapse-DRY-fGId.js → collapse-9taxUXec.js} +1 -1
  53. package/dist/assets/{complete-kFFCUlMp.js → complete-C8T0HN-B.js} +1 -1
  54. package/dist/assets/{component-DkUWDmEA.js → component-D6hOmRzO.js} +1 -1
  55. package/dist/assets/{config-Dw2MWXp7.js → config-DcwlSddI.js} +1 -1
  56. package/dist/assets/{config-WtCW9USL.js → config-Sq1CUTiJ.js} +1 -1
  57. package/dist/assets/{config-navigation-DxvpF5im.js → config-navigation-IR_yUgmM.js} +3 -3
  58. package/dist/assets/{config-space-CU10Rw2i.js → config-space-C3fS58cn.js} +1 -1
  59. package/dist/assets/{confirm-Vh9bFw1L.js → confirm-DApmnpvm.js} +1 -1
  60. package/dist/assets/{connect-lFo0rnUJ.js → connect-BF4GoRL-.js} +1 -1
  61. package/dist/assets/{connect-Cg0d_ebx.js → connect-Bf8y7fMm.js} +1 -1
  62. package/dist/assets/{connect-to-1dd-PxCa.js → connect-to-Bwfa2hMr.js} +1 -1
  63. package/dist/assets/{dashboard-BS4bpY03.js → dashboard-B2X6c8E8.js} +3 -3
  64. package/dist/assets/{delete-confirm-CzUZlQMV.js → delete-confirm-BsEqJQRY.js} +1 -1
  65. package/dist/assets/{did-address-Ca4O6-Gb.js → did-address-L54dTMrT.js} +1 -1
  66. package/dist/assets/{domain-CcapWTGW.js → domain-BGh0GDuZ.js} +1 -1
  67. package/dist/assets/{domain-action-card-BxEOdRG6.js → domain-action-card-DWqnvzry.js} +1 -1
  68. package/dist/assets/domains-CdwErmIF.js +1 -0
  69. package/dist/assets/{dot-ClH4jhsr.js → dot-iw3hN9HL.js} +1 -1
  70. package/dist/assets/{email-BKF-qRvM.js → email-By_nAv9m.js} +1 -1
  71. package/dist/assets/{exchange-passport-C05YacXz.js → exchange-passport-BsgMfRJS.js} +1 -1
  72. package/dist/assets/{fuel-D5i0LwEE.js → fuel-RMmgm9AQ.js} +1 -1
  73. package/dist/assets/{gen-access-key-OYE9vkTV.js → gen-access-key-4teK8Dys.js} +1 -1
  74. package/dist/assets/{get-safe-url-CJuFtnAD.js → get-safe-url-B8xlSMyD.js} +1 -1
  75. package/dist/assets/{get-safe-url-ClddTGUv.js → get-safe-url-t1C0E5Ux.js} +1 -1
  76. package/dist/assets/{home-DR0M74FO.js → home-CmHUXg5q.js} +1 -1
  77. package/dist/assets/{iframe-CymxKzen.js → iframe-Dj9NLHp2.js} +1 -1
  78. package/dist/assets/{index-BpvW-cUy.js → index-BCtTVvHw.js} +1 -1
  79. package/dist/assets/{index-BtF2_mmu.js → index-Bb7iSrGO.js} +1 -1
  80. package/dist/assets/{index-BSIauQNZ.js → index-Be8E3hiQ.js} +1 -1
  81. package/dist/assets/{index-DqYKLMVq.js → index-BeE0KRva.js} +1 -1
  82. package/dist/assets/{index-DJmmHgxv.js → index-BzZuK-66.js} +1 -1
  83. package/dist/assets/{index-BJQsWjyx.js → index-C8uNNoMb.js} +1 -1
  84. package/dist/assets/{index-DGclkoMp.js → index-CCOwwQoc.js} +1 -1
  85. package/dist/assets/{index-iO-8g74B.js → index-CJQbYw9E.js} +1 -1
  86. package/dist/assets/{index-Dntq1ezd.js → index-CKY4HT0P.js} +1 -1
  87. package/dist/assets/{index-6_wWEItq.js → index-CMYalRl2.js} +5 -5
  88. package/dist/assets/{index-B354cP6P.js → index-Cs3-IS09.js} +1 -1
  89. package/dist/assets/{index-BbupHZzB.js → index-DXeoVV9Y.js} +1 -1
  90. package/dist/assets/{index-DZfl-BHr.js → index-DaM-GRtb.js} +1 -1
  91. package/dist/assets/{index-Cphaf-Ek.js → index-Dfw2EDXA.js} +4 -4
  92. package/dist/assets/{index-BTKm4T5J.js → index-Dgsq6V-N.js} +1 -1
  93. package/dist/assets/{index--zVoF7lp.js → index-DtZg53T9.js} +1 -1
  94. package/dist/assets/{index-CRe5KsOj.js → index-F85lIJcp.js} +1 -1
  95. package/dist/assets/{index-Hgoqly4p.js → index-Inc_KF9k.js} +3 -3
  96. package/dist/assets/{index-CaercczO.js → index-Mzv6hCex.js} +1 -1
  97. package/dist/assets/{index-CMXod_BF.js → index-NnUiYa0L.js} +1 -1
  98. package/dist/assets/{index-D5uPwJ6o.js → index-SX_KWrQh.js} +1 -1
  99. package/dist/assets/{invitation-CHKJRReb.js → invitation-Ck_kq3Tr.js} +1 -1
  100. package/dist/assets/{invite-BIyTLjFG.js → invite-89aeW4Ho.js} +1 -1
  101. package/dist/assets/{issue-passport-D_1dgjgm.js → issue-passport-4udVYVdq.js} +1 -1
  102. package/dist/assets/{item-Cvm3RZ4-.js → item-D0U5vYXJ.js} +1 -1
  103. package/dist/assets/{layout-7LZ3RpDb.js → layout-CQb1lhEv.js} +1 -1
  104. package/dist/assets/{list-CqGQfIx9.js → list-BOdwWlS0.js} +2 -2
  105. package/dist/assets/{list-Bz8uJNpj.js → list-KVxvPXZu.js} +1 -1
  106. package/dist/assets/localization-OxVxEhoS.js +1 -0
  107. package/dist/assets/{log-CEcMfPWb.js → log-DOIh9luu.js} +1 -1
  108. package/dist/assets/{logger-DMlN-IbM.js → logger-Dhaq1LDX.js} +1 -1
  109. package/dist/assets/{login-y0a0ypm7.js → login-J6Bsrh3B.js} +1 -1
  110. package/dist/assets/{login-oauth-callback-CnAgJXgp.js → login-oauth-callback-BRmEibAb.js} +1 -1
  111. package/dist/assets/{logo-uploader-BAsVxZ3U.js → logo-uploader-Dzebv-rF.js} +3 -3
  112. package/dist/assets/{lost-passport-D-GKwrh2.js → lost-passport-p5ZuXjnG.js} +1 -1
  113. package/dist/assets/{omit-O1pUD7ku.js → omit-BlzmxIB5.js} +1 -1
  114. package/dist/assets/{open-window-B-GejaY2.js → open-window-Byi7CkW_.js} +1 -1
  115. package/dist/assets/{overview-V76wvba7.js → overview-ClOSCvvh.js} +1 -1
  116. package/dist/assets/{page-header-huQjTQSw.js → page-header-C_KAJILy.js} +1 -1
  117. package/dist/assets/{passport-item-tcnz8j0r.js → passport-item-Du8-xENr.js} +1 -1
  118. package/dist/assets/{permission-BfejVUva.js → permission-ClRym5FB.js} +1 -1
  119. package/dist/assets/{preferences-6lvT1ugx.js → preferences-B6Y0XpLo.js} +1 -1
  120. package/dist/assets/{profile-embed-BqPZ87OZ.js → profile-embed-C_hd_hMh.js} +1 -1
  121. package/dist/assets/publish-resource-kHaYkbDE.js +1 -0
  122. package/dist/assets/{react-beautiful-dnd.esm-Btnab_OF.js → react-beautiful-dnd.esm-CHsohizU.js} +1 -1
  123. package/dist/assets/{runtime-qegegcsI.js → runtime-D5P_2uNM.js} +1 -1
  124. package/dist/assets/{sanitize-DbZs1H_T.js → sanitize-B18rcrOf.js} +1 -1
  125. package/dist/assets/sdk-CbugbTkF.js +1 -0
  126. package/dist/assets/{security-Cxiq1ziT.js → security-CXewZHyS.js} +1 -1
  127. package/dist/assets/{session-CwC5SgVz.js → session-Bkvl2PSP.js} +1 -1
  128. package/dist/assets/{setup-Dilg0too.js → setup-TPtYDnBB.js} +3 -3
  129. package/dist/assets/{spaces-Cgazj3bm.js → spaces-C1lh7et6.js} +1 -1
  130. package/dist/assets/{start-FFKcgzTb.js → start-BgSlMXsE.js} +1 -1
  131. package/dist/assets/{starting-progress-CKWusmmh.js → starting-progress-BikYigPA.js} +1 -1
  132. package/dist/assets/{status-D98jk27v.js → status-DDvFiBxA.js} +1 -1
  133. package/dist/assets/{step-actions-Cp7vl1Uh.js → step-actions-_23FIn8v.js} +1 -1
  134. package/dist/assets/{studio-CvtVT5aS.js → studio-Db5oA_Tx.js} +1 -1
  135. package/dist/assets/{switch-control-DCl96cpf.js → switch-control-BYqb8MZf.js} +1 -1
  136. package/dist/assets/{table-tips-DdnbF0LB.js → table-tips-BW6G2sKO.js} +1 -1
  137. package/dist/assets/{traffic-Bf1b6xSQ.js → traffic-CUSLm0PX.js} +1 -1
  138. package/dist/assets/{transfer-ChzHdW_I.js → transfer-CSsXAviu.js} +1 -1
  139. package/dist/assets/{unsubscribe-CRSsqbPw.js → unsubscribe-BA46-fTa.js} +1 -1
  140. package/dist/assets/{use-blocklet-logo-D73B-sw0.js → use-blocklet-logo-CTCMbFiC.js} +1 -1
  141. package/dist/assets/{useAsync-B6ZHbOEG.js → useAsync-DVHp96Uu.js} +1 -1
  142. package/dist/assets/{useLocalStorage-B85cd9HR.js → useLocalStorage-DyVGBDlt.js} +1 -1
  143. package/dist/assets/{user-center-h3PNeVcw.js → user-center-Cap4mg5H.js} +3 -3
  144. package/dist/assets/{util-SfP61JNJ.js → util-DlS4tWs9.js} +1 -1
  145. package/dist/assets/{util-B5wObXV8.js → util-M3UFXQFT.js} +1 -1
  146. package/dist/assets/{vendor-arcblock-qCd0o3Hz.js → vendor-arcblock-DiSm3oUX.js} +5 -5
  147. package/dist/assets/{vendor-hooks-BCm626KH.js → vendor-hooks-BFlOfe0M.js} +1 -1
  148. package/dist/assets/vendor-utils-BotmZdBm.js +208 -0
  149. package/dist/assets/{vendor-ux-did-connect-dVrbSJfQ.js → vendor-ux-did-connect-DVX9lQ8a.js} +60 -60
  150. package/dist/assets/{wrap-locale-C5884ev0.js → wrap-locale-B8EvOR-l.js} +1 -1
  151. package/dist/index.html +5 -5
  152. package/dist/service-worker.js +1 -1
  153. package/package.json +33 -33
  154. package/dist/assets/api-CQoRx33p.js +0 -1
  155. package/dist/assets/domains-C9MeMLdA.js +0 -1
  156. package/dist/assets/localization-gg0fgyqC.js +0 -1
  157. package/dist/assets/publish-resource-BqdiC6O1.js +0 -1
  158. package/dist/assets/sdk-DOmS9lyP.js +0 -1
  159. package/dist/assets/vendor-utils-B3iZkn2R.js +0 -208
@@ -1,4 +1,4 @@
1
- import{j as r,ah as m}from"./vendor-mui-core-Bq8gXTan.js";import{C as c}from"./content-layout-BC2QkTYi.js";import{a as p,a3 as s}from"./vendor-ux-did-connect-dVrbSJfQ.js";import{c as i}from"./vendor-arcblock-qCd0o3Hz.js";import{L as u}from"./index-6_wWEItq.js";const d=m(c)`
1
+ import{j as r,ah as m}from"./vendor-mui-core-Bq8gXTan.js";import{C as c}from"./content-layout-BC2QkTYi.js";import{a as p,a3 as s}from"./vendor-ux-did-connect-DVX9lQ8a.js";import{c as i}from"./vendor-arcblock-DiSm3oUX.js";import{L as u}from"./index-CMYalRl2.js";const d=m(c)`
2
2
  display: flex;
3
3
  flex-direction: column;
4
4
  width: 100%;
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Hgoqly4p.js","assets/vendor-ux-did-connect-dVrbSJfQ.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-B3iZkn2R.js","assets/vendor-mui-core-Bq8gXTan.js","assets/vendor-hooks-BCm626KH.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-qCd0o3Hz.js","assets/index-BpvW-cUy.js","assets/index-6_wWEItq.js","assets/index-DOq-_YXu.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
2
- import{r as b,b as Ue}from"./vendor-react-DEoibe3W.js";import{a as F,d as K,k as W,a3 as H,_ as ye,a2 as ne,$ as V,br as ve,bs as Ce,bt as Te,bd as we,ac as Se,a5 as Ie}from"./vendor-ux-did-connect-dVrbSJfQ.js";import{H as o,j as e,D as X,aj as G,I as Q,t as J,al as L,T as R,aa as p,O as w,bq as v,bK as Re,bQ as oe,bs as se,bR as ae,X as Y,ak as ce,z as de,y as z,ab as Z,ad as Ee}from"./vendor-mui-core-Bq8gXTan.js";import{v as ue}from"./vendor-arcblock-qCd0o3Hz.js";import{d as Ae}from"./Edit-D_qzRYqq.js";import{_ as ke}from"./dot-ClH4jhsr.js";import{l as pe}from"./index-CaercczO.js";import{D as $,aC as he,aD as S,G as Pe}from"./index-6_wWEItq.js";import{u as B}from"./dashboard-BS4bpY03.js";import{o as Ne,c as We,A as re}from"./vendor-utils-B3iZkn2R.js";import{T as qe}from"./index-BTKm4T5J.js";import{E as Oe}from"./empty-spinner-BHwHZpq-.js";import{C as y}from"./click-to-copy-BfYfYud0.js";import{D as Le}from"./delete-confirm-CzUZlQMV.js";import{b as _e}from"./passport-item-tcnz8j0r.js";import{A as De}from"./actions-CcWHhKZq.js";import{T as le}from"./table-tips-DdnbF0LB.js";import{u as ze}from"./use-mobile-DwzRjjku.js";import"./vendor-hooks-BCm626KH.js";import"./lottie-web-jYmAQWuC.js";import"./useAsync-B6ZHbOEG.js";import"./useLocalStorage-B85cd9HR.js";import"./index-8eXqqyHQ.js";import"./confirm-Vh9bFw1L.js";import"./PlayArrow-Hu915_DX.js";import"./get-safe-url-ClddTGUv.js";import"./session-CwC5SgVz.js";import"./use-blocklet-logo-D73B-sw0.js";import"./InfoOutlined-CEh25_NY.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CtTQsfXN.js";import"./vendor-mui-x-1nqAyytV.js";import"./AdapterDayjs-Dvf_tKNm.js";import"./did-address-Ca4O6-Gb.js";import"./util-B5wObXV8.js";import"./base32-Do9iD28a.js";import"./MoreHoriz-Cpg0a_lm.js";const Fe={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function me({onCreated:r,onClose:u}){const[i,m]=b.useState(!1),{t:n,locale:s}=F(),{api:g}=$(),{teamDid:h}=B(),{control:f,handleSubmit:k,formState:{errors:a},watch:I,setValue:x}=he({defaultValues:Fe,mode:"onChange"}),T=I("scope"),E=c=>{c!=="profile:read"&&x("scope",T.includes(c)?T.filter(d=>d!==c):[...T,c])},q=async c=>{m(!0);try{const d={...c,redirectUris:c.redirectUris,contacts:c.contacts?c.contacts.split(",").map(P=>P.trim()):[],scope:c.scope.join(" ")};await g.createOAuthClient({input:{teamDid:h,input:Ne(d,We)}}),r(d)}catch(d){H.error(d.message||"Failed to create OAuth App")}finally{m(!1)}};return e.jsxs(X,{open:!0,onClose:u,maxWidth:"md",fullWidth:!0,children:[e.jsxs(G,{children:[n("oauth.client.register")," ",e.jsx(Q,{onClick:u,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsxs(L,{spacing:4,sx:{mt:2},children:[e.jsx(R,{variant:"h6",gutterBottom:!0,children:n("oauth.client.requiredInformation")}),e.jsx(p,{children:e.jsx(S,{name:"clientName",control:f,rules:{required:n("oauth.client.validate.clientName"),minLength:{value:3,message:n("oauth.client.validate.clientNameMinLength")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.name"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.clientNamePlaceholder"),error:!!a.clientName,helperText:(d=a.clientName)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.clientName")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"clientUri",control:f,rules:{required:n("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:n("oauth.client.validate.clientUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.clientUriPlaceholder"),error:!!a.clientUri,helperText:(d=a.clientUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.clientUri")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"redirectUris",control:f,rules:{required:n("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:n("oauth.client.validate.redirectUrisInvalid")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.redirectUrisPlaceholder"),error:!!a.redirectUris,helperText:(d=a.redirectUris)==null?void 0:d.message}),e.jsxs(p,{sx:{display:"flex",gap:"2px"},children:[e.jsx(v,{children:n("oauth.client.helperText.redirectUris")}),e.jsx(v,{children:n("oauth.client.helperText.read")}),e.jsx(v,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${s}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:n("oauth.client.helperText.document")}),e.jsx(v,{children:n("oauth.client.helperText.more")})]})]})}})}),e.jsxs(Re,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(R,{variant:"subtitle2",gutterBottom:!0,children:n("oauth.client.input.permissions")}),e.jsx(p,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(oe,{children:Object.entries(W.OAUTH_SCOPES).map(([c,d])=>e.jsx(se,{control:e.jsx(ae,{checked:T.includes(c),onChange:()=>E(c),disabled:c==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(R,{variant:"body2",sx:{fontWeight:500},children:d})})},c))})})]}),e.jsx(Y,{}),e.jsx(R,{variant:"h6",gutterBottom:!0,children:n("oauth.client.optionalInformation")}),e.jsx(L,{children:e.jsx(S,{name:"contacts",control:f,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:n("oauth.client.validate.contacts")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.contacts"),fullWidth:!0,placeholder:n("oauth.client.input.contactsPlaceholder"),error:!!a.contacts,helperText:(d=a.contacts)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.contacts")})]})}})}),e.jsxs(L,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:n("oauth.client.validate.tosUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.tosUri"),fullWidth:!0,placeholder:n("oauth.client.input.tosUriPlaceholder"),error:!!a.tosUri,helperText:(d=a.tosUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:n("oauth.client.validate.policyUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.policyUri"),fullWidth:!0,placeholder:n("oauth.client.input.policyUriPlaceholder"),error:!!a.policyUri,helperText:(d=a.policyUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.policyUri")})]})}})]}),a.error&&e.jsx(ce,{severity:"error",children:a.error.message})]})}),e.jsxs(de,{children:[e.jsx(z,{onClick:u,children:n("common.cancel")}),e.jsxs(z,{onClick:k(q),disabled:i,variant:"contained",color:"primary",children:[i?e.jsx(Z,{size:20,sx:{mr:1}}):null,n("oauth.client.registerButton")]})]})]})}me.propTypes={onCreated:o.func.isRequired,onClose:o.func.isRequired};function M({scope:r,...u}){if(!r)return null;const i=r.split(" ").filter(Boolean);return e.jsx(L,{direction:"row",flexWrap:"wrap",gap:1,...u,children:i.map(m=>e.jsx(Ue.Fragment,{children:e.jsx(Ee,{title:W.OAUTH_SCOPES[m],children:e.jsx(y,{children:m})})},m))})}M.propTypes={scope:o.string};M.defaultProps={scope:""};const ee=r=>{const{prefix:u}=$(),{blocklet:i}=Pe(),m=re(u,"/api/media/upload",i.appPid),n=b.useCallback(g=>g?g.startsWith("http")?g:`${re(u,"/api/media/upload",i.appPid)}/${g}`:"",[u,i.appPid]);return{clientLogoUrl:b.useMemo(()=>n(r),[r,n]),apiPath:m,getClientLogoUrl:n}},$e=b.lazy(()=>ye(()=>import("./index-Hgoqly4p.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(r=>({default:r.Uploader})));function xe({client:r,onUpdate:u,onClose:i}){const[m,n]=b.useState(!1),{t:s,locale:g}=F(),h=b.useRef(null),{api:f}=$(),{teamDid:k}=B(),{control:a,handleSubmit:I,formState:{errors:x},watch:T,setValue:E,getValues:q}=he({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"}),c=T("scope"),d=T("logoUri"),{clientLogoUrl:P,apiPath:O}=ee(d),A=l=>{l!=="profile:read"&&E("scope",c.includes(l)?c.filter(t=>t!==l):[...c,l])},_=async l=>{const t={clientId:r.clientId,clientName:l.clientName.trim(),clientUri:l.clientUri,redirectUris:l.redirectUris.split(",").map(C=>C.trim()).filter(Boolean),contacts:l.contacts?l.contacts.split(",").map(C=>C.trim()):[],scope:l.scope.join(" "),tosUri:l.tosUri,policyUri:l.policyUri,logoUri:l.logoUri,clientSecretExpiresAt:l.clientSecretExpiresAt?parseInt(l.clientSecretExpiresAt/1e3,10):null};await f.updateOAuthClient({input:{teamDid:k,input:t}})},D=async l=>{n(!0);try{await _(l),u(),i()}catch(t){H.error(t.message||s("oauth.client.updateFailed"))}finally{n(!1)}};return e.jsxs(X,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[e.jsxs(G,{children:[s("oauth.client.update")," ",e.jsx(Q,{onClick:i,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsxs(L,{spacing:3,sx:{mt:2},children:[e.jsxs(p,{sx:{mb:3},children:[e.jsx(R,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),e.jsxs(p,{children:[e.jsx(p,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:P?e.jsx(p,{children:e.jsx("img",{src:P,alt:"client-logo",style:{width:"100%",height:"100%"}})}):e.jsx(p,{onClick:()=>{var l;(l=h.current)==null||l.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:e.jsx(ue,{sx:{fontSize:40,color:"common.white"}})})}),e.jsx(z,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{var l;(l=h.current)==null||l.open()},children:s(P?"common.change":"common.upload")})]}),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx(b.Suspense,{fallback:e.jsx(Oe,{}),children:e.jsx($e,{ref:h,locale:g,popup:!0,onUploadFinish:l=>{E("logoUri",l.data.filename),_(q()).then(()=>{u()}).catch(t=>{H.error(t.message||s("oauth.client.updateFailed"))}).finally(()=>{var t;(t=h.current)==null||t.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:O,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(R,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),e.jsx(w,{label:"Client Id",fullWidth:!0,value:r.clientId,disabled:!0}),e.jsx(p,{children:e.jsx(S,{name:"clientName",control:a,rules:{required:s("oauth.client.validate.clientName"),minLength:{value:3,message:s("oauth.client.validate.clientNameMinLength")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!x.clientName,helperText:(t=x.clientName)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.clientName")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"clientUri",control:a,rules:{required:s("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.clientUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!x.clientUri,helperText:(t=x.clientUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.clientUri")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"redirectUris",control:a,rules:{required:s("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.redirectUrisInvalid")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!x.redirectUris,helperText:(t=x.redirectUris)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.redirectUris")})]})}})}),e.jsx(S,{name:"clientSecretExpiresAt",control:a,render:({field:l})=>e.jsx(qe,{placeholder:s("oauth.client.input.expireTime"),value:l.value*1e3,onChange:t=>{l.onChange(t)}})}),e.jsxs(p,{sx:{display:"none"},children:[e.jsx(R,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),e.jsx(p,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(oe,{children:Object.entries(W.OAUTH_SCOPES).map(([l,t])=>e.jsx(se,{control:e.jsx(ae,{checked:c.includes(l),onChange:()=>A(l),disabled:l==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(R,{variant:"body2",sx:{fontWeight:500},children:t})})},l))})})]}),e.jsx(Y,{}),e.jsx(R,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),e.jsx(p,{children:e.jsx(S,{name:"contacts",control:a,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:s("oauth.client.validate.contacts")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!x.contacts,helperText:(t=x.contacts)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.contacts")})]})}})}),e.jsxs(L,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:a,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.tosUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{...l,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!x.tosUri,helperText:(t=x.tosUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:a,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.policyUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{...l,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!x.policyUri,helperText:(t=x.policyUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.policyUri")})]})}})]}),x.error&&e.jsx(ce,{severity:"error",children:x.error.message})]})}),e.jsxs(de,{children:[e.jsx(z,{onClick:i,children:s("common.cancel")}),e.jsx(z,{onClick:I(D),disabled:m,variant:"contained",color:"primary",children:m?e.jsx(Z,{size:16}):s("common.update")})]})]})}xe.propTypes={client:o.shape({clientId:o.string.isRequired,clientName:o.string.isRequired,clientUri:o.string,redirectUris:o.arrayOf(o.string),scope:o.string,contacts:o.arrayOf(o.string),tosUri:o.string,policyUri:o.string,logoUri:o.string,clientSecretExpiresAt:o.number}).isRequired,onUpdate:o.func.isRequired,onClose:o.func.isRequired};function je({client:r,onUpdate:u,onClose:i}){return e.jsx(xe,{client:r,onUpdate:m=>u(m),onClose:i})}je.propTypes={client:o.shape({clientId:o.string.isRequired,clientName:o.string.isRequired,clientUri:o.string,redirectUris:o.arrayOf(o.string),scope:o.string,contacts:o.arrayOf(o.string),tosUri:o.string,policyUri:o.string,logoUri:o.string,clientSecretExpiresAt:o.number}).isRequired,onUpdate:o.func.isRequired,onClose:o.func.isRequired};function te(r){const{t:u}=F(),{api:i}=$(),{teamDid:m}=B(),{clientId:n,clientName:s,onDelete:g=()=>{},onClose:h=()=>{}}=r,f=()=>{h()},k=async()=>{try{await i.deleteOAuthClient({input:{teamDid:m,clientId:n}}),g()}catch(I){H.error(I==null?void 0:I.message)}finally{f()}},a={keyName:s,title:u("oauth.client.delete.title"),description:u("oauth.client.delete.description",{name:`<b>${s}</b>`}),confirmPlaceholder:u("oauth.client.delete.description",{name:s}),confirm:u("common.delConfirm"),cancel:u("common.cancel"),onConfirm:k,onCancel:f};return e.jsx(Le,{keyName:a.keyName,title:a.title,description:a.description,confirmPlaceholder:a.confirmPlaceholder,confirm:a.confirm,cancel:a.cancel,params:a.params,onConfirm:a.onConfirm,onCancel:a.onCancel})}te.propTypes={clientId:o.string.isRequired,clientName:o.string.isRequired,onDelete:o.func,onClose:o.func};te.defaultProps={onDelete:()=>{},onClose:()=>{}};function ge({title:r,items:u}){return e.jsxs(p,{mb:3,children:[e.jsx(R,{variant:"h6",sx:{mb:1.5},children:r}),e.jsx(L,{spacing:1.5,children:u.map(({label:i,value:m})=>e.jsxs(p,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(R,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),e.jsx(R,{sx:{wordBreak:"break-all"},children:m||"-"})]},i))})]})}ge.propTypes={title:o.string.isRequired,items:o.arrayOf(o.shape({label:o.string.isRequired,value:o.any})).isRequired};function fe({client:r,onClose:u}){const{t:i,locale:m}=F(),{teamDid:n}=B(),{clientName:s,clientId:g,clientSecret:h,redirectUris:f,scope:k,clientUri:a,logoUri:I,contacts:x,tosUri:T,policyUri:E,jwksUri:q,jwks:c,softwareId:d,softwareVersion:P,clientIdIssuedAt:O,clientSecretExpiresAt:A,updatedAt:_,createUser:D}=r,{clientLogoUrl:l}=ee(I),t=j=>{try{const N=new URL(window.blocklet.appUrl);return N.pathname=j,N.toString()}catch{return"-"}},C=pe.fromAppDid(g,n),U=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:s},{label:i("oauth.client.logoUri"),value:e.jsx(ne,{variant:"rounded",shape:"square",src:l,did:C.address,size:64})},{label:i("oauth.client.clientUri"),value:a?e.jsx(y,{children:a}):"-"},{label:i("oauth.client.clientId"),value:e.jsx(y,{children:g})},{label:i("oauth.client.clientSecret"),value:e.jsx(y,{children:h})},{label:i("oauth.client.redirectUris"),value:e.jsx(y,{children:(f||[]).join(", ")})},{label:i("oauth.client.scope"),value:e.jsx(M,{scope:k})},{label:i("oauth.client.createUser"),value:D?_e(D,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:e.jsx(y,{children:t("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/logout`)})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:x.length?e.jsx(y,{children:(x||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:T?e.jsx(y,{children:T}):"-"},{label:i("oauth.client.policyUri"),value:E?e.jsx(y,{children:E}):"-"},{label:i("oauth.client.jwksUri"),value:q},{label:i("oauth.client.jwks"),value:c},{label:i("oauth.client.softwareId"),value:d},{label:i("oauth.client.softwareVersion"),value:P}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:O?e.jsx(V,{value:O*1e3,type:"all",locale:m}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:A?e.jsx(V,{value:A*1e3,type:"all",locale:m}):"-"},{label:i("common.updatedAt"),value:_?e.jsx(V,{value:_,type:"all",locale:m}):"-"}]}].filter(Boolean);return e.jsxs(X,{open:!0,onClose:u,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(G,{children:[i("oauth.client.oauthAppDetails"),e.jsx(Q,{onClick:u,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsx(p,{mt:1,children:U.map((j,N)=>e.jsxs(p,{children:[e.jsx(ge,{title:j.title,items:j.items}),N!==U.length-1&&e.jsx(Y,{sx:{my:2}})]},j.title))})})]})}fe.propTypes={client:o.object.isRequired,onClose:o.func.isRequired};function Be(r){return e.jsx(V,{value:r*1e3})}function ie({selected:r,onClose:u}){return r?e.jsx(fe,{client:r,onClose:u}):null}ie.propTypes={selected:o.object,onClose:o.func.isRequired};ie.defaultProps={selected:null};function be({open:r,onCreated:u,onClose:i}){return r?e.jsx(me,{onCreated:u,onClose:i}):null}be.propTypes={open:o.bool.isRequired,onCreated:o.func.isRequired,onClose:o.func.isRequired};function It(){var l;const[r,u]=b.useState({searchText:"",pageSize:10,page:1}),[i,m]=b.useState(null),[n,s]=b.useState(!1),g=b.useRef(null),{t:h,locale:f}=F(),{api:k}=$(),{teamDid:a}=B(),[I,x]=b.useState(null),[T,E]=b.useState(null),q=ze(),{getClientLogoUrl:c}=ee(),d=ke(async()=>await k.getOAuthClients({input:{teamDid:a,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:P}=d,O=b.useMemo(()=>{var t;return((t=d.value)==null?void 0:t.list)||[]},[(l=d.value)==null?void 0:l.list]),A=b.useMemo(()=>r.searchText?O.filter(t=>t.clientName.toLowerCase().includes(r.searchText.toLowerCase())||t.clientId.toLowerCase().includes(r.searchText.toLowerCase())||t.scope.toLowerCase().includes(r.searchText.toLowerCase())):O,[r.searchText,O]),_=b.useMemo(()=>[{label:h("oauth.client.name"),name:"clientName",options:{customBodyRender:(t,{rowIndex:C})=>{const U=A[C],j=c(U.logoUri),N=pe.fromAppDid(U.clientId,a);return e.jsx(p,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(p,{display:"flex",alignItems:"center",gap:2,sx:{cursor:"pointer"},children:[e.jsx(ne,{variant:"rounded",shape:"square",did:N.address,src:j,size:48}),e.jsxs(L,{gap:.5,children:[e.jsx(p,{sx:{color:"text.primary"},children:U.clientName}),e.jsx(p,{sx:{color:"text.secondary"},children:U.clientUri})]})]})})}}},{label:h("oauth.client.clientId"),name:"clientId"},{label:h("oauth.client.scope"),name:"scope",options:{customBodyRender:t=>e.jsx(M,{scope:t})}},{label:h("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:Be}},{label:h("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:t=>t?e.jsx(ve,{showDid:!0,did:t,cardType:Ce.Detailed,infoType:Te.Minimal,sx:{border:0,padding:0}}):h("oauth.client.openRegistration")}},{label:h("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(t,{rowIndex:C})=>{const U=A[C];return e.jsx(De,{actions:[{icon:e.jsx(Ae,{}),text:h("common.edit"),onClick:j=>{j.stopPropagation(),x(U)}},{icon:e.jsx(we,{}),text:h("common.delete"),onClick:j=>{j.stopPropagation(),E(U)}}]})}}}],[A,h,c,a,x,E]),D=({page:t,rowsPerPage:C,searchText:U})=>{r.pageSize!==C?u(j=>({...j,searchText:"",pageSize:C,page:1})):r.page!==t+1?u(j=>({...j,searchText:"",page:t+1})):r.searchText!==U&&u(j=>({...j,searchText:U,page:1}))};return e.jsxs(p,{ref:g,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[q?e.jsx(le,{title:h("oauth.client.listTitle"),tooltipTitle:h("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${f}/oauth-service`}):null,e.jsx(Se,{data:A,columns:_,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:A.length,searchDebounceTime:400,onRowClick(t,{dataIndex:C},U){var j;if((j=g.current)!=null&&j.contains(U.target)){const N=A[C];m(N)}}},onChange:D,title:q?null:e.jsx(le,{title:h("oauth.client.listTitle"),tooltipTitle:h("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${f}/oauth-service`}),customButtons:[e.jsxs(z,{variant:"contained",size:"small",onClick:()=>s(!0),children:[P?e.jsx(Z,{size:16}):e.jsx(ue,{style:{fontSize:16}}),h("common.create")]},"add")],loading:!1,emptyNode:e.jsx(Ie,{children:h("oauth.client.empty")})}),e.jsx(ie,{selected:i,onClose:()=>m(null)}),e.jsx(be,{open:n,onCreated:()=>{s(!1),d.retry()},onClose:()=>s(!1)}),I&&e.jsx(je,{client:I,onUpdate:d.retry,onClose:()=>x(null)}),T&&e.jsx(te,{...T,onDelete:d.retry,onClose:()=>E(null)})]})}export{It as default};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Inc_KF9k.js","assets/vendor-ux-did-connect-DVX9lQ8a.js","assets/vendor-react-DEoibe3W.js","assets/vendor-utils-BotmZdBm.js","assets/vendor-mui-core-Bq8gXTan.js","assets/vendor-hooks-BFlOfe0M.js","assets/lottie-web-jYmAQWuC.js","assets/vendor-ux-did-connect-DpSGLE7B.css","assets/vendor-arcblock-DiSm3oUX.js","assets/index-BCtTVvHw.js","assets/index-CMYalRl2.js","assets/index-DOq-_YXu.css","assets/index-DVQCgvFb.js","assets/index-AgKpYdvC.css"])))=>i.map(i=>d[i]);
2
+ import{r as b,b as Ue}from"./vendor-react-DEoibe3W.js";import{a as F,d as K,k as W,a3 as H,_ as ye,a2 as ne,$ as V,br as ve,bs as Ce,bt as Te,bd as we,ac as Se,a5 as Ie}from"./vendor-ux-did-connect-DVX9lQ8a.js";import{H as o,j as e,D as X,aj as G,I as Q,t as J,al as L,T as R,aa as p,O as w,bq as v,bK as Re,bQ as oe,bs as se,bR as ae,X as Y,ak as ce,z as de,y as z,ab as Z,ad as Ee}from"./vendor-mui-core-Bq8gXTan.js";import{v as ue}from"./vendor-arcblock-DiSm3oUX.js";import{d as Ae}from"./Edit-rPlryssW.js";import{_ as ke}from"./dot-iw3hN9HL.js";import{l as pe}from"./index-Mzv6hCex.js";import{D as $,aC as he,aD as S,G as Pe}from"./index-CMYalRl2.js";import{u as B}from"./dashboard-B2X6c8E8.js";import{o as Ne,c as We,A as re}from"./vendor-utils-BotmZdBm.js";import{T as qe}from"./index-Dgsq6V-N.js";import{E as Oe}from"./empty-spinner-BHwHZpq-.js";import{C as y}from"./click-to-copy-BMX2P5UB.js";import{D as Le}from"./delete-confirm-BsEqJQRY.js";import{b as _e}from"./passport-item-Du8-xENr.js";import{A as De}from"./actions-DYQW2ChM.js";import{T as le}from"./table-tips-BW6G2sKO.js";import{u as ze}from"./use-mobile-DwzRjjku.js";import"./vendor-hooks-BFlOfe0M.js";import"./lottie-web-jYmAQWuC.js";import"./useAsync-DVHp96Uu.js";import"./useLocalStorage-DyVGBDlt.js";import"./index-8eXqqyHQ.js";import"./confirm-DApmnpvm.js";import"./PlayArrow-RVSfCmrB.js";import"./get-safe-url-B8xlSMyD.js";import"./session-Bkvl2PSP.js";import"./use-blocklet-logo-CTCMbFiC.js";import"./InfoOutlined-C8ZBPUhD.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CtTQsfXN.js";import"./vendor-mui-x-1nqAyytV.js";import"./AdapterDayjs-BzjU9O7t.js";import"./did-address-L54dTMrT.js";import"./util-M3UFXQFT.js";import"./base32-DEjena1X.js";import"./MoreHoriz-Ba9rYlyz.js";const Fe={clientName:"",clientUri:"",redirectUris:"",scope:["profile:read"],contacts:"",tosUri:"",policyUri:""};function me({onCreated:r,onClose:u}){const[i,m]=b.useState(!1),{t:n,locale:s}=F(),{api:g}=$(),{teamDid:h}=B(),{control:f,handleSubmit:k,formState:{errors:a},watch:I,setValue:x}=he({defaultValues:Fe,mode:"onChange"}),T=I("scope"),E=c=>{c!=="profile:read"&&x("scope",T.includes(c)?T.filter(d=>d!==c):[...T,c])},q=async c=>{m(!0);try{const d={...c,redirectUris:c.redirectUris,contacts:c.contacts?c.contacts.split(",").map(P=>P.trim()):[],scope:c.scope.join(" ")};await g.createOAuthClient({input:{teamDid:h,input:Ne(d,We)}}),r(d)}catch(d){H.error(d.message||"Failed to create OAuth App")}finally{m(!1)}};return e.jsxs(X,{open:!0,onClose:u,maxWidth:"md",fullWidth:!0,children:[e.jsxs(G,{children:[n("oauth.client.register")," ",e.jsx(Q,{onClick:u,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsxs(L,{spacing:4,sx:{mt:2},children:[e.jsx(R,{variant:"h6",gutterBottom:!0,children:n("oauth.client.requiredInformation")}),e.jsx(p,{children:e.jsx(S,{name:"clientName",control:f,rules:{required:n("oauth.client.validate.clientName"),minLength:{value:3,message:n("oauth.client.validate.clientNameMinLength")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.name"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.clientNamePlaceholder"),error:!!a.clientName,helperText:(d=a.clientName)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.clientName")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"clientUri",control:f,rules:{required:n("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:n("oauth.client.validate.clientUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.clientUri"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.clientUriPlaceholder"),error:!!a.clientUri,helperText:(d=a.clientUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.clientUri")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"redirectUris",control:f,rules:{required:n("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:n("oauth.client.validate.redirectUrisInvalid")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,placeholder:n("oauth.client.input.redirectUrisPlaceholder"),error:!!a.redirectUris,helperText:(d=a.redirectUris)==null?void 0:d.message}),e.jsxs(p,{sx:{display:"flex",gap:"2px"},children:[e.jsx(v,{children:n("oauth.client.helperText.redirectUris")}),e.jsx(v,{children:n("oauth.client.helperText.read")}),e.jsx(v,{sx:{color:"info.main"},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${s}/oauth-service`,target:"_blank",rel:"noopener noreferrer",children:n("oauth.client.helperText.document")}),e.jsx(v,{children:n("oauth.client.helperText.more")})]})]})}})}),e.jsxs(Re,{variant:"outlined",sx:{p:2,display:"none"},children:[e.jsx(R,{variant:"subtitle2",gutterBottom:!0,children:n("oauth.client.input.permissions")}),e.jsx(p,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(oe,{children:Object.entries(W.OAUTH_SCOPES).map(([c,d])=>e.jsx(se,{control:e.jsx(ae,{checked:T.includes(c),onChange:()=>E(c),disabled:c==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(R,{variant:"body2",sx:{fontWeight:500},children:d})})},c))})})]}),e.jsx(Y,{}),e.jsx(R,{variant:"h6",gutterBottom:!0,children:n("oauth.client.optionalInformation")}),e.jsx(L,{children:e.jsx(S,{name:"contacts",control:f,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:n("oauth.client.validate.contacts")}},render:({field:c})=>{var d;return e.jsxs(e.Fragment,{children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.contacts"),fullWidth:!0,placeholder:n("oauth.client.input.contactsPlaceholder"),error:!!a.contacts,helperText:(d=a.contacts)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.contacts")})]})}})}),e.jsxs(L,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:n("oauth.client.validate.tosUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.tosUri"),fullWidth:!0,placeholder:n("oauth.client.input.tosUriPlaceholder"),error:!!a.tosUri,helperText:(d=a.tosUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:f,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:n("oauth.client.validate.policyUriInvalid")}},render:({field:c})=>{var d;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{size:"small",...c,label:n("oauth.client.input.policyUri"),fullWidth:!0,placeholder:n("oauth.client.input.policyUriPlaceholder"),error:!!a.policyUri,helperText:(d=a.policyUri)==null?void 0:d.message}),e.jsx(v,{children:n("oauth.client.helperText.policyUri")})]})}})]}),a.error&&e.jsx(ce,{severity:"error",children:a.error.message})]})}),e.jsxs(de,{children:[e.jsx(z,{onClick:u,children:n("common.cancel")}),e.jsxs(z,{onClick:k(q),disabled:i,variant:"contained",color:"primary",children:[i?e.jsx(Z,{size:20,sx:{mr:1}}):null,n("oauth.client.registerButton")]})]})]})}me.propTypes={onCreated:o.func.isRequired,onClose:o.func.isRequired};function M({scope:r,...u}){if(!r)return null;const i=r.split(" ").filter(Boolean);return e.jsx(L,{direction:"row",flexWrap:"wrap",gap:1,...u,children:i.map(m=>e.jsx(Ue.Fragment,{children:e.jsx(Ee,{title:W.OAUTH_SCOPES[m],children:e.jsx(y,{children:m})})},m))})}M.propTypes={scope:o.string};M.defaultProps={scope:""};const ee=r=>{const{prefix:u}=$(),{blocklet:i}=Pe(),m=re(u,"/api/media/upload",i.appPid),n=b.useCallback(g=>g?g.startsWith("http")?g:`${re(u,"/api/media/upload",i.appPid)}/${g}`:"",[u,i.appPid]);return{clientLogoUrl:b.useMemo(()=>n(r),[r,n]),apiPath:m,getClientLogoUrl:n}},$e=b.lazy(()=>ye(()=>import("./index-Inc_KF9k.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13])).then(r=>({default:r.Uploader})));function xe({client:r,onUpdate:u,onClose:i}){const[m,n]=b.useState(!1),{t:s,locale:g}=F(),h=b.useRef(null),{api:f}=$(),{teamDid:k}=B(),{control:a,handleSubmit:I,formState:{errors:x},watch:T,setValue:E,getValues:q}=he({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"}),c=T("scope"),d=T("logoUri"),{clientLogoUrl:P,apiPath:O}=ee(d),A=l=>{l!=="profile:read"&&E("scope",c.includes(l)?c.filter(t=>t!==l):[...c,l])},_=async l=>{const t={clientId:r.clientId,clientName:l.clientName.trim(),clientUri:l.clientUri,redirectUris:l.redirectUris.split(",").map(C=>C.trim()).filter(Boolean),contacts:l.contacts?l.contacts.split(",").map(C=>C.trim()):[],scope:l.scope.join(" "),tosUri:l.tosUri,policyUri:l.policyUri,logoUri:l.logoUri,clientSecretExpiresAt:l.clientSecretExpiresAt?parseInt(l.clientSecretExpiresAt/1e3,10):null};await f.updateOAuthClient({input:{teamDid:k,input:t}})},D=async l=>{n(!0);try{await _(l),u(),i()}catch(t){H.error(t.message||s("oauth.client.updateFailed"))}finally{n(!1)}};return e.jsxs(X,{open:!0,onClose:i,maxWidth:"md",fullWidth:!0,children:[e.jsxs(G,{children:[s("oauth.client.update")," ",e.jsx(Q,{onClick:i,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsxs(L,{spacing:3,sx:{mt:2},children:[e.jsxs(p,{sx:{mb:3},children:[e.jsx(R,{variant:"subtitle1",sx:{fontWeight:500,mb:1},children:s("oauth.client.logo")}),e.jsxs(p,{children:[e.jsx(p,{sx:{width:120,height:120,position:"relative",borderRadius:"4px",overflow:"hidden"},children:P?e.jsx(p,{children:e.jsx("img",{src:P,alt:"client-logo",style:{width:"100%",height:"100%"}})}):e.jsx(p,{onClick:()=>{var l;(l=h.current)==null||l.open()},sx:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",bgcolor:"grey.200"},children:e.jsx(ue,{sx:{fontSize:40,color:"common.white"}})})}),e.jsx(z,{sx:{mt:2},variant:"outlined",size:"small",onClick:()=>{var l;(l=h.current)==null||l.open()},children:s(P?"common.change":"common.upload")})]}),e.jsx(p,{sx:{display:"flex",alignItems:"center"},children:e.jsx(b.Suspense,{fallback:e.jsx(Oe,{}),children:e.jsx($e,{ref:h,locale:g,popup:!0,onUploadFinish:l=>{E("logoUri",l.data.filename),_(q()).then(()=>{u()}).catch(t=>{H.error(t.message||s("oauth.client.updateFailed"))}).finally(()=>{var t;(t=h.current)==null||t.close()})},plugins:["ImageEditor"],installerProps:{disabled:!0},apiPathProps:{uploader:O,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(R,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.requiredInformation")}),e.jsx(w,{label:"Client Id",fullWidth:!0,value:r.clientId,disabled:!0}),e.jsx(p,{children:e.jsx(S,{name:"clientName",control:a,rules:{required:s("oauth.client.validate.clientName"),minLength:{value:3,message:s("oauth.client.validate.clientNameMinLength")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.name"),required:!0,fullWidth:!0,error:!!x.clientName,helperText:(t=x.clientName)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.clientName")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"clientUri",control:a,rules:{required:s("oauth.client.validate.clientUri"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.clientUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.clientUri"),required:!0,fullWidth:!0,error:!!x.clientUri,helperText:(t=x.clientUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.clientUri")})]})}})}),e.jsx(p,{children:e.jsx(S,{name:"redirectUris",control:a,rules:{required:s("oauth.client.validate.redirectUris"),pattern:{value:/^https?:\/\/.+/,message:s("oauth.client.validate.redirectUrisInvalid")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.redirectUris"),required:!0,fullWidth:!0,multiline:!0,rows:2,error:!!x.redirectUris,helperText:(t=x.redirectUris)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.redirectUris")})]})}})}),e.jsx(S,{name:"clientSecretExpiresAt",control:a,render:({field:l})=>e.jsx(qe,{placeholder:s("oauth.client.input.expireTime"),value:l.value*1e3,onChange:t=>{l.onChange(t)}})}),e.jsxs(p,{sx:{display:"none"},children:[e.jsx(R,{variant:"subtitle2",sx:{mb:1},children:s("oauth.client.input.permissions")}),e.jsx(p,{sx:{border:"1px solid",borderColor:"divider",borderRadius:1,p:2},children:e.jsx(oe,{children:Object.entries(W.OAUTH_SCOPES).map(([l,t])=>e.jsx(se,{control:e.jsx(ae,{checked:c.includes(l),onChange:()=>A(l),disabled:l==="profile:read",color:"primary"}),label:e.jsx(p,{children:e.jsx(R,{variant:"body2",sx:{fontWeight:500},children:t})})},l))})})]}),e.jsx(Y,{}),e.jsx(R,{variant:"subtitle1",sx:{fontWeight:500},children:s("oauth.client.optionalInformation")}),e.jsx(p,{children:e.jsx(S,{name:"contacts",control:a,rules:{pattern:{value:/^$|^[^@\s]+@[^@\s]+\.[^@\s]+(\s*,\s*[^@\s]+@[^@\s]+\.[^@\s]+)*$/,message:s("oauth.client.validate.contacts")}},render:({field:l})=>{var t;return e.jsxs(e.Fragment,{children:[e.jsx(w,{...l,label:s("oauth.client.input.contacts"),fullWidth:!0,error:!!x.contacts,helperText:(t=x.contacts)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.contacts")})]})}})}),e.jsxs(L,{direction:{xs:"column",sm:"row"},spacing:2,children:[e.jsx(S,{name:"tosUri",control:a,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.tosUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{...l,label:s("oauth.client.input.tosUri"),fullWidth:!0,error:!!x.tosUri,helperText:(t=x.tosUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.tosUri")})]})}}),e.jsx(S,{name:"policyUri",control:a,rules:{pattern:{value:/^$|^https?:\/\/.+/,message:s("oauth.client.validate.policyUriInvalid")}},render:({field:l})=>{var t;return e.jsxs(p,{sx:{width:"50%"},children:[e.jsx(w,{...l,label:s("oauth.client.input.policyUri"),fullWidth:!0,error:!!x.policyUri,helperText:(t=x.policyUri)==null?void 0:t.message}),e.jsx(v,{children:s("oauth.client.helperText.policyUri")})]})}})]}),x.error&&e.jsx(ce,{severity:"error",children:x.error.message})]})}),e.jsxs(de,{children:[e.jsx(z,{onClick:i,children:s("common.cancel")}),e.jsx(z,{onClick:I(D),disabled:m,variant:"contained",color:"primary",children:m?e.jsx(Z,{size:16}):s("common.update")})]})]})}xe.propTypes={client:o.shape({clientId:o.string.isRequired,clientName:o.string.isRequired,clientUri:o.string,redirectUris:o.arrayOf(o.string),scope:o.string,contacts:o.arrayOf(o.string),tosUri:o.string,policyUri:o.string,logoUri:o.string,clientSecretExpiresAt:o.number}).isRequired,onUpdate:o.func.isRequired,onClose:o.func.isRequired};function je({client:r,onUpdate:u,onClose:i}){return e.jsx(xe,{client:r,onUpdate:m=>u(m),onClose:i})}je.propTypes={client:o.shape({clientId:o.string.isRequired,clientName:o.string.isRequired,clientUri:o.string,redirectUris:o.arrayOf(o.string),scope:o.string,contacts:o.arrayOf(o.string),tosUri:o.string,policyUri:o.string,logoUri:o.string,clientSecretExpiresAt:o.number}).isRequired,onUpdate:o.func.isRequired,onClose:o.func.isRequired};function te(r){const{t:u}=F(),{api:i}=$(),{teamDid:m}=B(),{clientId:n,clientName:s,onDelete:g=()=>{},onClose:h=()=>{}}=r,f=()=>{h()},k=async()=>{try{await i.deleteOAuthClient({input:{teamDid:m,clientId:n}}),g()}catch(I){H.error(I==null?void 0:I.message)}finally{f()}},a={keyName:s,title:u("oauth.client.delete.title"),description:u("oauth.client.delete.description",{name:`<b>${s}</b>`}),confirmPlaceholder:u("oauth.client.delete.description",{name:s}),confirm:u("common.delConfirm"),cancel:u("common.cancel"),onConfirm:k,onCancel:f};return e.jsx(Le,{keyName:a.keyName,title:a.title,description:a.description,confirmPlaceholder:a.confirmPlaceholder,confirm:a.confirm,cancel:a.cancel,params:a.params,onConfirm:a.onConfirm,onCancel:a.onCancel})}te.propTypes={clientId:o.string.isRequired,clientName:o.string.isRequired,onDelete:o.func,onClose:o.func};te.defaultProps={onDelete:()=>{},onClose:()=>{}};function ge({title:r,items:u}){return e.jsxs(p,{mb:3,children:[e.jsx(R,{variant:"h6",sx:{mb:1.5},children:r}),e.jsx(L,{spacing:1.5,children:u.map(({label:i,value:m})=>e.jsxs(p,{display:"flex",alignItems:"center",gap:2,children:[e.jsx(R,{variant:"subtitle2",color:"textSecondary",sx:{minWidth:200},children:i}),e.jsx(R,{sx:{wordBreak:"break-all"},children:m||"-"})]},i))})]})}ge.propTypes={title:o.string.isRequired,items:o.arrayOf(o.shape({label:o.string.isRequired,value:o.any})).isRequired};function fe({client:r,onClose:u}){const{t:i,locale:m}=F(),{teamDid:n}=B(),{clientName:s,clientId:g,clientSecret:h,redirectUris:f,scope:k,clientUri:a,logoUri:I,contacts:x,tosUri:T,policyUri:E,jwksUri:q,jwks:c,softwareId:d,softwareVersion:P,clientIdIssuedAt:O,clientSecretExpiresAt:A,updatedAt:_,createUser:D}=r,{clientLogoUrl:l}=ee(I),t=j=>{try{const N=new URL(window.blocklet.appUrl);return N.pathname=j,N.toString()}catch{return"-"}},C=pe.fromAppDid(g,n),U=[{title:i("common.baseInfo"),items:[{label:i("oauth.client.name"),value:s},{label:i("oauth.client.logoUri"),value:e.jsx(ne,{variant:"rounded",shape:"square",src:l,did:C.address,size:64})},{label:i("oauth.client.clientUri"),value:a?e.jsx(y,{children:a}):"-"},{label:i("oauth.client.clientId"),value:e.jsx(y,{children:g})},{label:i("oauth.client.clientSecret"),value:e.jsx(y,{children:h})},{label:i("oauth.client.redirectUris"),value:e.jsx(y,{children:(f||[]).join(", ")})},{label:i("oauth.client.scope"),value:e.jsx(M,{scope:k})},{label:i("oauth.client.createUser"),value:D?_e(D,!0):i("oauth.client.openRegistration")}]},{title:i("oauth.client.oauthEndpoints"),items:[{label:i("oauth.client.openidConfiguration"),value:e.jsx(y,{children:t("/.well-known/openid-configuration")})},{label:i("oauth.client.authorizationEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/authorize`)})},{label:i("oauth.client.tokenEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/token`)})},{label:i("oauth.client.userinfoEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/userinfo`)})},{label:i("oauth.client.jwksUri"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/jwks`)})},{label:i("oauth.client.registrationEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/register`)})},{label:i("oauth.client.endSessionEndpoint"),value:e.jsx(y,{children:t(`${W.WELLKNOWN_SERVICE_PATH_PREFIX}/oauth/logout`)})}]},{title:i("oauth.client.metaContact"),items:[{label:i("oauth.client.contacts"),value:x.length?e.jsx(y,{children:(x||[]).join(", ")}):"-"},{label:i("oauth.client.tosUri"),value:T?e.jsx(y,{children:T}):"-"},{label:i("oauth.client.policyUri"),value:E?e.jsx(y,{children:E}):"-"},{label:i("oauth.client.jwksUri"),value:q},{label:i("oauth.client.jwks"),value:c},{label:i("oauth.client.softwareId"),value:d},{label:i("oauth.client.softwareVersion"),value:P}]},{title:i("common.timeInfo"),items:[{label:i("oauth.client.clientIdIssuedAt"),value:O?e.jsx(V,{value:O*1e3,type:"all",locale:m}):"-"},{label:i("oauth.client.clientSecretExpiresAt"),value:A?e.jsx(V,{value:A*1e3,type:"all",locale:m}):"-"},{label:i("common.updatedAt"),value:_?e.jsx(V,{value:_,type:"all",locale:m}):"-"}]}].filter(Boolean);return e.jsxs(X,{open:!0,onClose:u,maxWidth:"lg",fullWidth:!0,children:[e.jsxs(G,{children:[i("oauth.client.oauthAppDetails"),e.jsx(Q,{onClick:u,sx:{position:"absolute",right:8,top:8},children:e.jsx(K,{})})]}),e.jsx(J,{children:e.jsx(p,{mt:1,children:U.map((j,N)=>e.jsxs(p,{children:[e.jsx(ge,{title:j.title,items:j.items}),N!==U.length-1&&e.jsx(Y,{sx:{my:2}})]},j.title))})})]})}fe.propTypes={client:o.object.isRequired,onClose:o.func.isRequired};function Be(r){return e.jsx(V,{value:r*1e3})}function ie({selected:r,onClose:u}){return r?e.jsx(fe,{client:r,onClose:u}):null}ie.propTypes={selected:o.object,onClose:o.func.isRequired};ie.defaultProps={selected:null};function be({open:r,onCreated:u,onClose:i}){return r?e.jsx(me,{onCreated:u,onClose:i}):null}be.propTypes={open:o.bool.isRequired,onCreated:o.func.isRequired,onClose:o.func.isRequired};function It(){var l;const[r,u]=b.useState({searchText:"",pageSize:10,page:1}),[i,m]=b.useState(null),[n,s]=b.useState(!1),g=b.useRef(null),{t:h,locale:f}=F(),{api:k}=$(),{teamDid:a}=B(),[I,x]=b.useState(null),[T,E]=b.useState(null),q=ze(),{getClientLogoUrl:c}=ee(),d=ke(async()=>await k.getOAuthClients({input:{teamDid:a,paging:{page:r.page,pageSize:r.pageSize}}}),[r.page,r.pageSize]),{loading:P}=d,O=b.useMemo(()=>{var t;return((t=d.value)==null?void 0:t.list)||[]},[(l=d.value)==null?void 0:l.list]),A=b.useMemo(()=>r.searchText?O.filter(t=>t.clientName.toLowerCase().includes(r.searchText.toLowerCase())||t.clientId.toLowerCase().includes(r.searchText.toLowerCase())||t.scope.toLowerCase().includes(r.searchText.toLowerCase())):O,[r.searchText,O]),_=b.useMemo(()=>[{label:h("oauth.client.name"),name:"clientName",options:{customBodyRender:(t,{rowIndex:C})=>{const U=A[C],j=c(U.logoUri),N=pe.fromAppDid(U.clientId,a);return e.jsx(p,{sx:{display:"flex",alignItems:"center",gap:2},children:e.jsxs(p,{display:"flex",alignItems:"center",gap:2,sx:{cursor:"pointer"},children:[e.jsx(ne,{variant:"rounded",shape:"square",did:N.address,src:j,size:48}),e.jsxs(L,{gap:.5,children:[e.jsx(p,{sx:{color:"text.primary"},children:U.clientName}),e.jsx(p,{sx:{color:"text.secondary"},children:U.clientUri})]})]})})}}},{label:h("oauth.client.clientId"),name:"clientId"},{label:h("oauth.client.scope"),name:"scope",options:{customBodyRender:t=>e.jsx(M,{scope:t})}},{label:h("common.createdAt"),name:"clientIdIssuedAt",options:{customBodyRender:Be}},{label:h("common.createdBy"),name:"createdBy",width:100,options:{customBodyRender:t=>t?e.jsx(ve,{showDid:!0,did:t,cardType:Ce.Detailed,infoType:Te.Minimal,sx:{border:0,padding:0}}):h("oauth.client.openRegistration")}},{label:h("common.actions"),name:"actions",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRender:(t,{rowIndex:C})=>{const U=A[C];return e.jsx(De,{actions:[{icon:e.jsx(Ae,{}),text:h("common.edit"),onClick:j=>{j.stopPropagation(),x(U)}},{icon:e.jsx(we,{}),text:h("common.delete"),onClick:j=>{j.stopPropagation(),E(U)}}]})}}}],[A,h,c,a,x,E]),D=({page:t,rowsPerPage:C,searchText:U})=>{r.pageSize!==C?u(j=>({...j,searchText:"",pageSize:C,page:1})):r.page!==t+1?u(j=>({...j,searchText:"",page:t+1})):r.searchText!==U&&u(j=>({...j,searchText:U,page:1}))};return e.jsxs(p,{ref:g,sx:{".custom-toobar-btns":{gap:"8px"},".custom-toobar-title .custom-toobar-title-inner>span":{display:"flex",alignItems:"center","white-space":"inherit",height:"100%"}},children:[q?e.jsx(le,{title:h("oauth.client.listTitle"),tooltipTitle:h("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${f}/oauth-service`}):null,e.jsx(Se,{data:A,columns:_,options:{sort:!1,download:!1,filter:!1,print:!1,viewColumns:!1,page:r.page-1,rowsPerPage:r.pageSize,count:A.length,searchDebounceTime:400,onRowClick(t,{dataIndex:C},U){var j;if((j=g.current)!=null&&j.contains(U.target)){const N=A[C];m(N)}}},onChange:D,title:q?null:e.jsx(le,{title:h("oauth.client.listTitle"),tooltipTitle:h("oauth.client.tooltipTitle"),link:`https://www.arcblock.io/docs/blocklet-developer/${f}/oauth-service`}),customButtons:[e.jsxs(z,{variant:"contained",size:"small",onClick:()=>s(!0),children:[P?e.jsx(Z,{size:16}):e.jsx(ue,{style:{fontSize:16}}),h("common.create")]},"add")],loading:!1,emptyNode:e.jsx(Ie,{children:h("oauth.client.empty")})}),e.jsx(ie,{selected:i,onClose:()=>m(null)}),e.jsx(be,{open:n,onCreated:()=>{s(!1),d.retry()},onClose:()=>s(!1)}),I&&e.jsx(je,{client:I,onUpdate:d.retry,onClose:()=>x(null)}),T&&e.jsx(te,{...T,onDelete:d.retry,onClose:()=>E(null)})]})}export{It as default};
@@ -1,4 +1,4 @@
1
- import{r as p}from"./vendor-react-DEoibe3W.js";import{H as o,j as r,aq as ee,e as $,ap as ae,aa as h,ah as L,T as S,v as W,X as le,bK as Me,ad as tt,bL as rt,au as nt,ai as st,a9 as Pe,m as it,bX as ot,y as at,s as lt,I as ct}from"./vendor-mui-core-Bq8gXTan.js";import{b as z,u as se,m as dt}from"./vendor-hooks-BCm626KH.js";import{a as ce,$ as ut,i as pt,aR as ht,k as de,D as U,a1 as ue,bb as pe,bf as ft,r as Ne,I as Ae,br as mt,bs as gt,bt as xt,bu as yt}from"./vendor-ux-did-connect-dVrbSJfQ.js";import{S as vt}from"./index-DEZojGsm.js";import{B as bt}from"./bundle-avatar-LAkmelll.js";import{a as jt,g as he,b as fe,c as B,s as X,H as wt,u as ze,M as Le,d as Q,e as kt,m as Rt,i as Tt}from"./use-blocklet-logo-D73B-sw0.js";import{A as O,ah as It,z as De,b as D,a1 as Ct}from"./vendor-utils-B3iZkn2R.js";import{u as Y,p as St,h as J,f as Ee,l as $t}from"./vendor-arcblock-qCd0o3Hz.js";import{d as Mt}from"./InfoOutlined-CEh25_NY.js";import{d as Pt}from"./CheckCircle-DKLAiayP.js";import{p as Nt}from"./util-B5wObXV8.js";import{D as At}from"./index-6_wWEItq.js";function me({blocklet:e,style:t,size:s,...n}){const a=jt({blocklet:e,square:!0}),{variant:c}=n;return r.jsx(ee,{variant:c||"square",style:Object.assign({backgroundColor:"transparent",width:s,height:s,borderRadius:10},t),...n,children:r.jsx("img",{src:a,alt:"",style:{width:s}})})}me.propTypes={blocklet:o.object.isRequired,style:o.object,size:o.oneOfType([o.number,o.string])};me.defaultProps={style:{},size:40};function zt(e){return e.includes(" ")?new Date(e.replace(" ","T").replace(" ","")).getTime():new Date(e).getTime()}function te({value:e,shouldUpdate:t=!1,...s}){const{locale:n}=ce(),[a,c]=p.useState(0);if(p.useEffect(()=>{let l;if(t){const u=new Date(e).getTime(),y=Date.now(),m=Math.abs(Math.floor((u-y)/1e3)),b=()=>{c(j=>{const k=Math.random()*1e3;return parseFloat((j+k).toFixed(4))})};m<60?l=setInterval(b,1e3):m<60*60?l=setInterval(b,6e4):l=setInterval(b,36e5)}return()=>{clearInterval(l)}},[e,a,t]),!e)return"-";const i=zt(e);return r.jsx(ut,{value:i,locale:n,...s})}te.propTypes={value:o.any,shouldUpdate:o.bool};te.defaultProps={value:"",shouldUpdate:!1};const Lt=e=>{let t="rgba(0, 0, 0, 0.12)";return e==="warning"?t="#DE9E37":e==="error"?t="#F16E6E":t="rgba(0, 0, 0, 0.12)",t},Dt=e=>e.every(t=>t.type==="text"),Et=e=>e.every(t=>t.type==="image"),_t=e=>It(e,2).map(t=>({type:"combined",items:t})).filter(t=>(t.items||[]).every(s=>{var n,a,c;return(c=(a=(n=s==null?void 0:s.data)==null?void 0:n.text)==null?void 0:a.trim)==null?void 0:c.call(a)})),Ht=e=>{if(!e.length||e.length<=1)return!1;const t=e[0].type;return e.every(s=>s.type===t)},qt=(e,t)=>{try{const s=pt.toTypeInfo(e);if(!(s.role!==void 0&&s.role!==ht.types.RoleType.ACCOUNT))return;const a=O(de.WELLKNOWN_SERVICE_PATH_PREFIX,"user");return De(a,{did:e,locale:t})}catch(s){console.error(s);return}},Wt=(e,t)=>{var n;const s=(n=t==null?void 0:t.componentMountPoints)==null?void 0:n.find(a=>a.did===e);return s==null?void 0:s.mountPoint},Bt=(e,t)=>{var a,c,i;if(!e)return null;if(((a=e.actions)==null?void 0:a.length)===1)return e.actions[0].link||null;const s=he(e.activity),n=(s==null?void 0:s.metaLink)||(s==null?void 0:s.targetLink);if(n)return fe(n)?n:O(t,n);if(((c=e.attachments)==null?void 0:c.length)===1){const l=e.attachments[0];if(l.type==="link")return((i=l.data)==null?void 0:i.url)||null}return null},ie=e=>{const{receivers:t=[]}=e;return t.length?t.every(s=>s.read):!0};function Ut(e){const t=e.getBoundingClientRect(),s=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,a=t.height,c=t.width;let i=0;t.top>=0&&t.bottom<=n?i=a:t.top<0&&t.bottom>0&&t.bottom<=n?i=t.bottom:t.top>=0&&t.top<n&&t.bottom>n?i=n-t.top:t.top<0&&t.bottom>n&&(i=n);let l=0;return t.left>=0&&t.right<=s?l=c:t.left<0&&t.right>0&&t.right<=s?l=t.right:t.left>=0&&t.left<s&&t.right>s?l=s-t.left:t.left<0&&t.right>s&&(l=s),i*l/(a*c)>=.5}const Ot=e=>{if(!e)return[];const t=[],s=5,n=Array.from(e.querySelectorAll(".notification-row")),a=n.length;for(let c=0;c<a;c+=s){const i=n.slice(c,c+s);let l=!0;for(const u of i){const y=u.id;if(Ut(u))t.push(y);else{l=!1;break}}if(!l)break}return t},_e=e=>{var s;const t=[];return e&&((s=e.items)!=null&&s.length?e.items.forEach(n=>{ie(n)||t.push(n)}):ie(e)||t.push(e)),t},Ft=(e,t)=>{let s=[];return t.length&&t.forEach(n=>{const a=e.get(n);a&&(s=s.concat(_e(a)))}),s},E=(e,t)=>({...e,...t?{filter:"invert(1)"}:{}}),F=e=>{if(!e)return null;try{return new URL(e).protocol!=="https:"?(console.warn("Image URL must use HTTPS protocol:",e),null):`${de.WELLKNOWN_SERVICE_PATH_PREFIX}/proxy?url=${e}`}catch(t){return console.warn("Invalid image URL format:",e,t),null}};function He({attachment:e}){const{data:t}=e,s=$();let n="";try{n=new URL(t.url).host}catch{n=t.url}return r.jsxs(ae,{target:"_blank",rel:"noopener noreferrer",href:t.url,className:"link",style:{wordBreak:"break-all"},onClick:a=>{a.customPreventRedirect=!0},children:[!!n&&r.jsx("span",{className:"url",children:n}),!!t.title&&r.jsx(h,{className:"title",style:{whiteSpace:"unset"},children:t.title}),!!t.description&&r.jsx(h,{className:"description",style:{whiteSpace:"unset",color:s.palette.text.secondary},children:t.description}),!!t.image&&r.jsx(U,{src:Y.getImagePath(t.image),alt:t.title||"",height:128,style:{borderRadius:"8px",maxWidth:"256px",objectFit:"cover"},fallback:F(Y.getImagePath(t.image))})]})}He.propTypes={attachment:o.object.isRequired};function qe({attachment:e}){const{data:t}=e;return r.jsx(U,{src:Y.getImagePath(t.url),alt:t.title||"",height:128,style:{borderRadius:"8px",maxWidth:"256px",objectFit:"cover"},fallback:F(Y.getImagePath(t.url))})}qe.propTypes={attachment:o.object.isRequired};function We({attachment:e,...t}){var l;const{data:s}=e,n=((l=s.color)==null?void 0:l.toLowerCase())||t.color,a=s.size||t.size,c=s.fontWeight||t.fontWeight||400;let i="14px";return a==="small"?i="12px":a==="normal"?i="14px":a==="big"?i="16px":a==="large"&&(i="18px"),r.jsx(Vt,{className:"title",style:{fontSize:i,color:n,whiteSpace:"unset",fontWeight:c},children:s.text})}We.propTypes={attachment:o.object.isRequired};const Vt=L.span`
1
+ import{r as p}from"./vendor-react-DEoibe3W.js";import{H as o,j as r,aq as ee,e as $,ap as ae,aa as h,ah as L,T as S,v as W,X as le,bK as Me,ad as tt,bL as rt,au as nt,ai as st,a9 as Pe,m as it,bX as ot,y as at,s as lt,I as ct}from"./vendor-mui-core-Bq8gXTan.js";import{b as z,u as se,m as dt}from"./vendor-hooks-BFlOfe0M.js";import{a as ce,$ as ut,i as pt,aR as ht,k as de,D as U,a1 as ue,bb as pe,bf as ft,r as Ne,I as Ae,br as mt,bs as gt,bt as xt,bu as yt}from"./vendor-ux-did-connect-DVX9lQ8a.js";import{S as vt}from"./index-DEZojGsm.js";import{B as bt}from"./bundle-avatar-B5-ypzmO.js";import{a as jt,g as he,b as fe,c as B,s as X,H as wt,u as ze,M as Le,d as Q,e as kt,m as Rt,i as Tt}from"./use-blocklet-logo-CTCMbFiC.js";import{A as O,ah as It,z as De,b as D,a1 as Ct}from"./vendor-utils-BotmZdBm.js";import{u as Y,p as St,h as J,f as Ee,l as $t}from"./vendor-arcblock-DiSm3oUX.js";import{d as Mt}from"./InfoOutlined-C8ZBPUhD.js";import{d as Pt}from"./CheckCircle-BcPSvH2E.js";import{p as Nt}from"./util-M3UFXQFT.js";import{D as At}from"./index-CMYalRl2.js";function me({blocklet:e,style:t,size:s,...n}){const a=jt({blocklet:e,square:!0}),{variant:c}=n;return r.jsx(ee,{variant:c||"square",style:Object.assign({backgroundColor:"transparent",width:s,height:s,borderRadius:10},t),...n,children:r.jsx("img",{src:a,alt:"",style:{width:s}})})}me.propTypes={blocklet:o.object.isRequired,style:o.object,size:o.oneOfType([o.number,o.string])};me.defaultProps={style:{},size:40};function zt(e){return e.includes(" ")?new Date(e.replace(" ","T").replace(" ","")).getTime():new Date(e).getTime()}function te({value:e,shouldUpdate:t=!1,...s}){const{locale:n}=ce(),[a,c]=p.useState(0);if(p.useEffect(()=>{let l;if(t){const u=new Date(e).getTime(),y=Date.now(),m=Math.abs(Math.floor((u-y)/1e3)),b=()=>{c(j=>{const k=Math.random()*1e3;return parseFloat((j+k).toFixed(4))})};m<60?l=setInterval(b,1e3):m<60*60?l=setInterval(b,6e4):l=setInterval(b,36e5)}return()=>{clearInterval(l)}},[e,a,t]),!e)return"-";const i=zt(e);return r.jsx(ut,{value:i,locale:n,...s})}te.propTypes={value:o.any,shouldUpdate:o.bool};te.defaultProps={value:"",shouldUpdate:!1};const Lt=e=>{let t="rgba(0, 0, 0, 0.12)";return e==="warning"?t="#DE9E37":e==="error"?t="#F16E6E":t="rgba(0, 0, 0, 0.12)",t},Dt=e=>e.every(t=>t.type==="text"),Et=e=>e.every(t=>t.type==="image"),_t=e=>It(e,2).map(t=>({type:"combined",items:t})).filter(t=>(t.items||[]).every(s=>{var n,a,c;return(c=(a=(n=s==null?void 0:s.data)==null?void 0:n.text)==null?void 0:a.trim)==null?void 0:c.call(a)})),Ht=e=>{if(!e.length||e.length<=1)return!1;const t=e[0].type;return e.every(s=>s.type===t)},qt=(e,t)=>{try{const s=pt.toTypeInfo(e);if(!(s.role!==void 0&&s.role!==ht.types.RoleType.ACCOUNT))return;const a=O(de.WELLKNOWN_SERVICE_PATH_PREFIX,"user");return De(a,{did:e,locale:t})}catch(s){console.error(s);return}},Wt=(e,t)=>{var n;const s=(n=t==null?void 0:t.componentMountPoints)==null?void 0:n.find(a=>a.did===e);return s==null?void 0:s.mountPoint},Bt=(e,t)=>{var a,c,i;if(!e)return null;if(((a=e.actions)==null?void 0:a.length)===1)return e.actions[0].link||null;const s=he(e.activity),n=(s==null?void 0:s.metaLink)||(s==null?void 0:s.targetLink);if(n)return fe(n)?n:O(t,n);if(((c=e.attachments)==null?void 0:c.length)===1){const l=e.attachments[0];if(l.type==="link")return((i=l.data)==null?void 0:i.url)||null}return null},ie=e=>{const{receivers:t=[]}=e;return t.length?t.every(s=>s.read):!0};function Ut(e){const t=e.getBoundingClientRect(),s=window.innerWidth||document.documentElement.clientWidth,n=window.innerHeight||document.documentElement.clientHeight,a=t.height,c=t.width;let i=0;t.top>=0&&t.bottom<=n?i=a:t.top<0&&t.bottom>0&&t.bottom<=n?i=t.bottom:t.top>=0&&t.top<n&&t.bottom>n?i=n-t.top:t.top<0&&t.bottom>n&&(i=n);let l=0;return t.left>=0&&t.right<=s?l=c:t.left<0&&t.right>0&&t.right<=s?l=t.right:t.left>=0&&t.left<s&&t.right>s?l=s-t.left:t.left<0&&t.right>s&&(l=s),i*l/(a*c)>=.5}const Ot=e=>{if(!e)return[];const t=[],s=5,n=Array.from(e.querySelectorAll(".notification-row")),a=n.length;for(let c=0;c<a;c+=s){const i=n.slice(c,c+s);let l=!0;for(const u of i){const y=u.id;if(Ut(u))t.push(y);else{l=!1;break}}if(!l)break}return t},_e=e=>{var s;const t=[];return e&&((s=e.items)!=null&&s.length?e.items.forEach(n=>{ie(n)||t.push(n)}):ie(e)||t.push(e)),t},Ft=(e,t)=>{let s=[];return t.length&&t.forEach(n=>{const a=e.get(n);a&&(s=s.concat(_e(a)))}),s},E=(e,t)=>({...e,...t?{filter:"invert(1)"}:{}}),F=e=>{if(!e)return null;try{return new URL(e).protocol!=="https:"?(console.warn("Image URL must use HTTPS protocol:",e),null):`${de.WELLKNOWN_SERVICE_PATH_PREFIX}/proxy?url=${e}`}catch(t){return console.warn("Invalid image URL format:",e,t),null}};function He({attachment:e}){const{data:t}=e,s=$();let n="";try{n=new URL(t.url).host}catch{n=t.url}return r.jsxs(ae,{target:"_blank",rel:"noopener noreferrer",href:t.url,className:"link",style:{wordBreak:"break-all"},onClick:a=>{a.customPreventRedirect=!0},children:[!!n&&r.jsx("span",{className:"url",children:n}),!!t.title&&r.jsx(h,{className:"title",style:{whiteSpace:"unset"},children:t.title}),!!t.description&&r.jsx(h,{className:"description",style:{whiteSpace:"unset",color:s.palette.text.secondary},children:t.description}),!!t.image&&r.jsx(U,{src:Y.getImagePath(t.image),alt:t.title||"",height:128,style:{borderRadius:"8px",maxWidth:"256px",objectFit:"cover"},fallback:F(Y.getImagePath(t.image))})]})}He.propTypes={attachment:o.object.isRequired};function qe({attachment:e}){const{data:t}=e;return r.jsx(U,{src:Y.getImagePath(t.url),alt:t.title||"",height:128,style:{borderRadius:"8px",maxWidth:"256px",objectFit:"cover"},fallback:F(Y.getImagePath(t.url))})}qe.propTypes={attachment:o.object.isRequired};function We({attachment:e,...t}){var l;const{data:s}=e,n=((l=s.color)==null?void 0:l.toLowerCase())||t.color,a=s.size||t.size,c=s.fontWeight||t.fontWeight||400;let i="14px";return a==="small"?i="12px":a==="normal"?i="14px":a==="big"?i="16px":a==="large"&&(i="18px"),r.jsx(Vt,{className:"title",style:{fontSize:i,color:n,whiteSpace:"unset",fontWeight:c},children:s.text})}We.propTypes={attachment:o.object.isRequired};const Vt=L.span`
2
2
  width: 100%;
3
3
  display: -webkit-box;
4
4
  -webkit-box-orient: vertical;
@@ -0,0 +1 @@
1
+ import{j as o}from"./vendor-mui-core-Bq8gXTan.js";import"./vendor-react-DEoibe3W.js";import{S as t}from"./studio-Db5oA_Tx.js";import"./vendor-ux-did-connect-DVX9lQ8a.js";import"./vendor-utils-BotmZdBm.js";import"./vendor-hooks-BFlOfe0M.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-DiSm3oUX.js";import"./TuneOutlined-CwV20zYf.js";function d(){return o.jsx(t,{children:"Coming soon..."})}export{d as default};