@abtnode/webapp 1.16.47 → 1.16.48-beta-20250808-223254-2bfaa0e0

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 (185) hide show
  1. package/blocklet.js +1 -1
  2. package/blocklet.yml +1 -1
  3. package/dist/assets/{AdapterDayjs-DxldUmxe.js → AdapterDayjs-CMmkTpH7.js} +1 -1
  4. package/dist/assets/{Add-BN88qEGx.js → Add-S-3I84b8.js} +1 -1
  5. package/dist/assets/ArrowDropDown-IcntJnxN.js +1 -0
  6. package/dist/assets/{Autocomplete-3llPzwt1.js → Autocomplete-BaEPlYLx.js} +1 -1
  7. package/dist/assets/{Breadcrumbs-DvNnpRQ0.js → Breadcrumbs-BiRfhuZp.js} +1 -1
  8. package/dist/assets/{ButtonGroup-B-9GSfHZ.js → ButtonGroup-Bb6jDsD1.js} +1 -1
  9. package/dist/assets/{CSSTransition-6L6IgdSY.js → CSSTransition-wxeeFOKf.js} +1 -1
  10. package/dist/assets/{CallMerge-vNTkdXiw.js → CallMerge-D7rsNNxc.js} +1 -1
  11. package/dist/assets/{CardContent-BPg_sEF2.js → CardContent-F-Sbai2s.js} +1 -1
  12. package/dist/assets/{ChevronLeft-CtquRnl8.js → ChevronLeft-DADCIS34.js} +1 -1
  13. package/dist/assets/{ChevronRight-CAszk4lp.js → ChevronRight-B_f9hb86.js} +1 -1
  14. package/dist/assets/{Clear-BCMMWwCD.js → Clear-v5WhrN0k.js} +1 -1
  15. package/dist/assets/{DeleteOutline-BKc7Kldo.js → DeleteOutline-DkhKATuN.js} +1 -1
  16. package/dist/assets/{Done-YvMjYKuk.js → Done-BrXgYrm-.js} +1 -1
  17. package/dist/assets/{Edit-COEQaq3a.js → Edit-b0bQueoc.js} +1 -1
  18. package/dist/assets/{ErrorOutline-OXo_CAtp.js → ErrorOutline-cbP6hbrl.js} +1 -1
  19. package/dist/assets/{FilterList-ZxgoMe-m.js → FilterList-CETwaOot.js} +1 -1
  20. package/dist/assets/{Google-DPJzLE0p.js → Google-G2hBKskK.js} +1 -1
  21. package/dist/assets/{HelpOutline-CzlcjtgK.js → HelpOutline-DaPSpbPH.js} +1 -1
  22. package/dist/assets/{Launch-D5z_vGpP.js → Launch-CxDOgvl0.js} +1 -1
  23. package/dist/assets/{Link-Dr3mLcwZ.js → Link-CCQ4Xrxg.js} +1 -1
  24. package/dist/assets/{ListItemButton-rknI-Gaw.js → ListItemButton-f6NCT9iY.js} +1 -1
  25. package/dist/assets/{ListSubheader-BgKcqOo-.js → ListSubheader-YCstldBv.js} +1 -1
  26. package/dist/assets/{LoadingButton-Bh0ogaQd.js → LoadingButton-DY_lGC3z.js} +1 -1
  27. package/dist/assets/{MoreVert-Nin8ZqO7.js → MoreVert-C716pe1M.js} +1 -1
  28. package/dist/assets/{OpenInNew-BetMIusn.js → OpenInNew-8_57FieH.js} +1 -1
  29. package/dist/assets/{Refresh-CDUQoVtN.js → Refresh-lnreJErX.js} +1 -1
  30. package/dist/assets/{Search-D7jj6_W7.js → Search-hhDB6YL9.js} +1 -1
  31. package/dist/assets/{Slider-Czj7jdSV.js → Slider-DMeR2md5.js} +1 -1
  32. package/dist/assets/{Stepper-BAuop15X.js → Stepper-CKg6__EK.js} +1 -1
  33. package/dist/assets/{Switch-dRW18BhE.js → Switch-CEsPeHy7.js} +1 -1
  34. package/dist/assets/{TableSearch-94MsMfky.js → TableSearch-Lg4M-8KA.js} +1 -1
  35. package/dist/assets/{ToggleButtonGroup-DpgDQW9s.js → ToggleButtonGroup-prN9b22p.js} +1 -1
  36. package/dist/assets/{Verified-Bdehddj8.js → Verified-YDT1ukv5.js} +1 -1
  37. package/dist/assets/{VerifiedUser-CU0d_ZSY.js → VerifiedUser-DjH4G4q1.js} +1 -1
  38. package/dist/assets/{ViewList-BumM5a7M.js → ViewList-Bwe4mYRB.js} +1 -1
  39. package/dist/assets/{_createAggregator-Bg_NDeg-.js → _createAggregator-ctoSszuV.js} +1 -1
  40. package/dist/assets/{actions-DjQup7cY.js → actions-BIszN-OK.js} +1 -1
  41. package/dist/assets/{actions-16uUMkwj.js → actions-D4Kz7IAL.js} +1 -1
  42. package/dist/assets/{agreement-Dzv6VnT4.js → agreement-B39z5WNn.js} +1 -1
  43. package/dist/assets/api-BPsZ_jNB.js +1 -0
  44. package/dist/assets/{appearance-yYeCxYXB.js → appearance-BRueUKRZ.js} +1 -1
  45. package/dist/assets/{audit-logs-DifMs8a1.js → audit-logs-ZvNCA3Zx.js} +1 -1
  46. package/dist/assets/{base-chart-BNJ6N5xc.js → base-chart-DZ65G0Up.js} +1 -1
  47. package/dist/assets/{blocklet-NsEfDg6l.js → blocklet-vLRH388n.js} +1 -1
  48. package/dist/assets/{chain-DkgxMmoB.js → chain-DS4Hjfmr.js} +1 -1
  49. package/dist/assets/{click-to-copy-lOPobaPV.js → click-to-copy-D5YohLRv.js} +1 -1
  50. package/dist/assets/client-bjR3BWE3.js +1 -0
  51. package/dist/assets/cloneDeep-CNxnXGqe.js +1 -0
  52. package/dist/assets/{collapse-ICZWDlS4.js → collapse-D_6eVE_q.js} +1 -1
  53. package/dist/assets/{config-navigation-BqxXssjI.js → config-navigation-DXRA92Ph.js} +3 -3
  54. package/dist/assets/{connect-to-xoL-ebGz.js → connect-to-lgGqqqWV.js} +1 -1
  55. package/dist/assets/{cssMode-CDMfiTxl.js → cssMode-IX2WeX_E.js} +1 -1
  56. package/dist/assets/{delete-confirm-Dli6LanI.js → delete-confirm-CKWr12s3.js} +1 -1
  57. package/dist/assets/{depsEqual-BqZSotpa.js → depsEqual-CfdoQRpO.js} +1 -1
  58. package/dist/assets/{detail-tdqW_KRG.js → detail-BnDNU4xS.js} +3 -3
  59. package/dist/assets/{domains-Bq2hWN95.js → domains-DbIh7fxa.js} +1 -1
  60. package/dist/assets/{download-wrCdMePG.js → download-CX5ROtbY.js} +1 -1
  61. package/dist/assets/{edit.svg-D3nj0Coq.js → edit.svg-1dKJigcF.js} +1 -1
  62. package/dist/assets/emotion-cache.browser.esm-BkCEErJn.js +1 -0
  63. package/dist/assets/engine-O4HpK5Dx.js +1 -0
  64. package/dist/assets/{freemarker2-CxEfgQOn.js → freemarker2-Ci6NhYtQ.js} +1 -1
  65. package/dist/assets/{get-safe-url-R3PVxGdM.js → get-safe-url-CVrrblG0.js} +1 -1
  66. package/dist/assets/getValidReactChildren-DJQKILMh.js +1 -0
  67. package/dist/assets/{graphqlMode-B3nojvdv.js → graphqlMode-CUUxEJv4.js} +2 -2
  68. package/dist/assets/{handlebars-02SbR3jU.js → handlebars-SXl07VWN.js} +1 -1
  69. package/dist/assets/{html-ImYFEZL0.js → html-f82gCVQF.js} +1 -1
  70. package/dist/assets/{html-title-22l2Q1um.js → html-title-s4xKUvYC.js} +1 -1
  71. package/dist/assets/{htmlMode-B11jxoOP.js → htmlMode-BQkLubkF.js} +1 -1
  72. package/dist/assets/{iframe-BUEP2Jl5.js → iframe-D0ox4iMz.js} +1 -1
  73. package/dist/assets/{index-CTR7ZstQ.js → index-0y0GUu_H.js} +1 -1
  74. package/dist/assets/{index-Cq2A6apl.js → index-1LmYeNoL.js} +1 -1
  75. package/dist/assets/{index-CK3GxImb.js → index-BHmKNTQs.js} +1 -1
  76. package/dist/assets/{index-ywCf0mQ1.js → index-BK-A1qdT.js} +1 -1
  77. package/dist/assets/{index-DjuYIY1a.js → index-BLKRAGfo.js} +1 -1
  78. package/dist/assets/{index-CiXQ3T-x.js → index-BRHUKEe0.js} +1 -1
  79. package/dist/assets/{index-BieMaKxr.js → index-B_AzVDZL.js} +3 -3
  80. package/dist/assets/{index-5AHYrJMU.js → index-BhRNr1Mm.js} +3 -3
  81. package/dist/assets/{index-DDpaEMT7.js → index-BiGMKi60.js} +1 -1
  82. package/dist/assets/{index-7vdcOAKK.js → index-BwEL7b_y.js} +1 -1
  83. package/dist/assets/{index-CqNSZb83.js → index-ByZBUOEV.js} +1 -1
  84. package/dist/assets/{index-D394bB3O.js → index-C5EipBB6.js} +1 -1
  85. package/dist/assets/{index-CO63Eak1.js → index-C7WxFtB9.js} +1 -1
  86. package/dist/assets/{index-v0MyWksG.js → index-CDjkuvXP.js} +1 -1
  87. package/dist/assets/{index-BbOqBxtx.js → index-CL-6WnAm.js} +1 -1
  88. package/dist/assets/{index-CaOGSW01.js → index-CLdrrNyQ.js} +1 -1
  89. package/dist/assets/{index-DNF01gaj.js → index-CN0dYmBa.js} +1 -1
  90. package/dist/assets/{index-BDYDarMr.js → index-CP6Hc8EC.js} +3 -3
  91. package/dist/assets/{index-C5wqzrOv.js → index-CPEKV9ZW.js} +2 -2
  92. package/dist/assets/{index-DlbZBx0g.js → index-CU3QIJsR.js} +1 -1
  93. package/dist/assets/{index-DldpjrXY.js → index-CqjImXJn.js} +1 -1
  94. package/dist/assets/{index-B_op8GoN.js → index-Cv8VUnaq.js} +1 -1
  95. package/dist/assets/{index-CEbEfc0D.js → index-D3La8IYq.js} +1 -1
  96. package/dist/assets/{index-CqJ1yiie.js → index-DOh613-F.js} +2 -2
  97. package/dist/assets/{index-CftvQ5qe.js → index-DQAon04N.js} +31 -31
  98. package/dist/assets/{index-C66QQpuI.js → index-DRNAAkse.js} +9 -9
  99. package/dist/assets/{index-sY8rviHb.js → index-DSTJqWf2.js} +1 -1
  100. package/dist/assets/{index-CxVls5Qj.js → index-DaeBi0tJ.js} +1 -1
  101. package/dist/assets/{index-B1oVxdWu.js → index-DdGrP93n.js} +1 -1
  102. package/dist/assets/{index-DksgtyQD.js → index-Dh2uOJnr.js} +1 -1
  103. package/dist/assets/{index-Cn0-GpFp.js → index-DjP4YyEm.js} +1 -1
  104. package/dist/assets/{index-Dyf8X9D7.js → index-Dm9VJXIH.js} +1 -1
  105. package/dist/assets/{index-CFQDJIpf.js → index-DmfWG7ck.js} +1 -1
  106. package/dist/assets/{index-WM3minJ4.js → index-DmyIzBGi.js} +1 -1
  107. package/dist/assets/{index-Crnw34ik.js → index-DuC1UwU8.js} +1 -1
  108. package/dist/assets/{index-97HmHQZf.js → index-DxaoKSdL.js} +1 -1
  109. package/dist/assets/{index-C2gdJ6_z.js → index-Dz-lyfj_.js} +1 -1
  110. package/dist/assets/index-Mwj3mzuq.js +1 -0
  111. package/dist/assets/{index-DZDcdM4E.js → index-RUTgtMpc.js} +1 -1
  112. package/dist/assets/{index-SnFCTQbW.js → index-danRXFlY.js} +3 -3
  113. package/dist/assets/{index-Ddtu3cFM.js → index-itvjoWYA.js} +1 -1
  114. package/dist/assets/{index-UrLlZ_8t.js → index-jNX_J6BB.js} +1 -1
  115. package/dist/assets/{index-Bj_daaTL.js → index-oIdyH1SE.js} +1 -1
  116. package/dist/assets/{index-Cf7wg1Hc.js → index-rTbI0lkb.js} +1 -1
  117. package/dist/assets/{index-DLOeWjal.js → index-vwlVGFIa.js} +1 -1
  118. package/dist/assets/{index.esm-D1wUGno-.js → index.esm-BIUDl4l6.js} +1 -1
  119. package/dist/assets/{install-from-url-Bw1FQ94E.js → install-from-url-DeNQZMpF.js} +1 -1
  120. package/dist/assets/{invitation-BtYanixJ.js → invitation-COCb5On_.js} +1 -1
  121. package/dist/assets/{is-path-prefix-equal-DRBWkMqg.js → is-path-prefix-equal-N7tEpQVO.js} +1 -1
  122. package/dist/assets/{item-C5ndY-m9.js → item-BeOwNcih.js} +1 -1
  123. package/dist/assets/{javascript-DdKw7NlO.js → javascript-Db-35yxg.js} +1 -1
  124. package/dist/assets/{jsonMode-BMWo1WHJ.js → jsonMode-CrQKwuqp.js} +1 -1
  125. package/dist/assets/{liquid-C5qQVVKb.js → liquid-DJMO6cZA.js} +1 -1
  126. package/dist/assets/{list-header-DIS2vxCA.js → list-header-CYEe-lQ7.js} +1 -1
  127. package/dist/assets/{log-Dc1ze15O.js → log-DWlTkDeY.js} +1 -1
  128. package/dist/assets/{lottie-react.esm-DFfP2oGm.js → lottie-react.esm-BcFfDY7I.js} +1 -1
  129. package/dist/assets/{mdx-BiZwv0lf.js → mdx-D6XejU-T.js} +1 -1
  130. package/dist/assets/{memory-Ce7WAecK.js → memory-Di9F3qs2.js} +1 -1
  131. package/dist/assets/{metric-D0GQSO1T.js → metric-Rsw_68TX.js} +1 -1
  132. package/dist/assets/omit-DAMRcdLY.js +1 -0
  133. package/dist/assets/{overview-BdK_T6TW.js → overview-D38nD9i7.js} +1 -1
  134. package/dist/assets/{permission-CqGSt2jN.js → permission-BIUOpX2u.js} +1 -1
  135. package/dist/assets/{preference-Bey_tcgS.js → preference-DSmHq1w5.js} +3 -3
  136. package/dist/assets/{python-CAlbtSUO.js → python-Dqyd2Hsi.js} +1 -1
  137. package/dist/assets/{raf-schd.esm-Bv1mIDyh.js → raf-schd.esm-BGXncqYB.js} +1 -1
  138. package/dist/assets/{razor-ChMHuUEo.js → razor-CdzgmOZv.js} +1 -1
  139. package/dist/assets/{rotate-session-key-CaqCmHAv.js → rotate-session-key-95XBCkHR.js} +1 -1
  140. package/dist/assets/{runtime-8QjCkWY0.js → runtime-D7lqaXvd.js} +1 -1
  141. package/dist/assets/schema-CJDApxAh.js +1 -0
  142. package/dist/assets/sdk-DXw8dY2Q.js +1 -0
  143. package/dist/assets/{service-DLZcJdl-.js → service-DBfnpgzT.js} +1 -1
  144. package/dist/assets/{shorten-label-CF9b7cqN.js → shorten-label-BwqBgwTL.js} +1 -1
  145. package/dist/assets/{simple-select-CYoiP9Va.js → simple-select-DQnMwaJg.js} +1 -1
  146. package/dist/assets/{spaces-C8C4UTPO.js → spaces-DpCJGUwf.js} +1 -1
  147. package/dist/assets/{status-DuIP2KON.js → status-C0x1F2hB.js} +1 -1
  148. package/dist/assets/{status-D6mbjR3i.js → status-DGosxj_C.js} +1 -1
  149. package/dist/assets/{switch-control-B4hBQkSS.js → switch-control-DJmzxMX-.js} +1 -1
  150. package/dist/assets/{table-icons-BHtPC0RS.js → table-icons-CjbBCbkG.js} +1 -1
  151. package/dist/assets/{team-FAUimnG6.js → team-CapU231S.js} +1 -1
  152. package/dist/assets/{toLower-DFanEMPM.js → toLower-YESHqG1W.js} +1 -1
  153. package/dist/assets/toUpper-DxP9R-Bl.js +1 -0
  154. package/dist/assets/{traffic-CCYP9hV1.js → traffic-DS6Iezpg.js} +1 -1
  155. package/dist/assets/{tsMode-7nZAkEW_.js → tsMode-QBKsv_MH.js} +1 -1
  156. package/dist/assets/{typescript-DI0DIeX5.js → typescript-2FQtO0Jn.js} +1 -1
  157. package/dist/assets/{url-evaluation-CcymgN4m.js → url-evaluation-LJajQhtP.js} +1 -1
  158. package/dist/assets/{url-join-D-fka5uL.js → url-join-D0FvPMVn.js} +1 -1
  159. package/dist/assets/{use-mobile-DtSZ7sd2.js → use-mobile-B5hY0d0u.js} +1 -1
  160. package/dist/assets/{use-mobile-yxlmXKxe.js → use-mobile-BuUEnGf6.js} +1 -1
  161. package/dist/assets/{useAsync-CE-i2VIw.js → useAsync-BRnzfjB4.js} +1 -1
  162. package/dist/assets/{useAsyncRetry-DygIhwJ4.js → useAsyncRetry-B5zkihuo.js} +1 -1
  163. package/dist/assets/{useLocalStorage-o6l4se6z.js → useLocalStorage-DAbLYpB1.js} +1 -1
  164. package/dist/assets/{useThemeProps-B3f-9EpI.js → useThemeProps-iUKmymVW.js} +1 -1
  165. package/dist/assets/{util-CfBbtTAg.js → util-BSKUyUc4.js} +1 -1
  166. package/dist/assets/{wait-container-BtYNFhdJ.js → wait-container-DAVQIB8x.js} +1 -1
  167. package/dist/assets/{without-wallet-BnYbQ8sR.js → without-wallet-BlI613tw.js} +1 -1
  168. package/dist/assets/{wrap-locale-C2di08EA.js → wrap-locale-DcxOTLb-.js} +1 -1
  169. package/dist/assets/{xml-BfnRnK1o.js → xml--DZQiP49.js} +1 -1
  170. package/dist/assets/{yaml-BEcVQ_Qt.js → yaml-DF8yZtH2.js} +1 -1
  171. package/dist/index.html +1 -1
  172. package/dist/service-worker.js +1 -1
  173. package/package.json +1 -1
  174. package/dist/assets/ArrowDropDown-CqnGNlRB.js +0 -1
  175. package/dist/assets/api-B2kaOziS.js +0 -1
  176. package/dist/assets/client-Blv2IYSC.js +0 -1
  177. package/dist/assets/cloneDeep-10gB2yZE.js +0 -1
  178. package/dist/assets/emotion-cache.browser.esm-BhQzPcJc.js +0 -1
  179. package/dist/assets/engine-CLnPcrkm.js +0 -1
  180. package/dist/assets/getValidReactChildren-ME0VtRVG.js +0 -1
  181. package/dist/assets/index-C6_ndFqK.js +0 -1
  182. package/dist/assets/omit-CAsslcsZ.js +0 -1
  183. package/dist/assets/schema-DNZr5lUg.js +0 -1
  184. package/dist/assets/sdk-XPuzwshs.js +0 -1
  185. package/dist/assets/toUpper-C1gPJNYq.js +0 -1
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-CxVls5Qj.js","./index-CftvQ5qe.js","./index-DGkT7afN.css"])))=>i.map(i=>d[i]);
2
- import{r as d,cs as z,c0 as U,ct as F,cu as X,aG as H,j as t,s as _,o as j,F as V,aP as B,g as G,cv as O,w as D,N as p,cw as J,W as Q,v as L,b7 as q,T as I,cx as M,L as K,cy as Y,bE as Z,cz as ee,cA as te,u as se,x as ae,bw as oe,ar as ne,af as re}from"./index-CftvQ5qe.js";import{V as ie}from"./ViewList-BumM5a7M.js";import{D as ce}from"./Done-YvMjYKuk.js";import{N as le}from"./index-B1oVxdWu.js";import{w as pe}from"./wrap-locale-C2di08EA.js";import{g as de}from"./get-safe-url-R3PVxGdM.js";import{S as ue,a as me,b as he}from"./Stepper-BAuop15X.js";import"./emotion-cache.browser.esm-BhQzPcJc.js";var P=function(e){if(!e)return 0;var r=X(e).valueOf()-Date.now();return r<0?0:r},fe=function(e){return{days:Math.floor(e/864e5),hours:Math.floor(e/36e5)%24,minutes:Math.floor(e/6e4)%60,seconds:Math.floor(e/1e3)%60,milliseconds:Math.floor(e)%1e3}},xe=function(e){e===void 0&&(e={});var r=e||{},l=r.leftTime,i=r.targetDate,u=r.interval,b=u===void 0?1e3:u,x=r.onEnd,g=d.useMemo(function(){return z(l)&&l>0?Date.now()+l:void 0},[l]),a="leftTime"in e?g:i,h=U(d.useState(function(){return P(a)}),2),f=h[0],m=h[1],o=F(x);d.useEffect(function(){if(!a){m(0);return}m(P(a));var v=setInterval(function(){var n,c=P(a);m(c),c===0&&(clearInterval(v),(n=o.current)===null||n===void 0||n.call(o))},b);return function(){return clearInterval(v)}},[a,b]);var w=d.useMemo(function(){return fe(f)},[f]);return[f,w]};const ge=H(t.jsx("path",{d:"M19 9h-4V3H9v6H5l7 7zM5 18v2h14v-2z"}));function E({list:e=[],width:r=300,height:l=400,cardSpace:i=40,onSelect:u=()=>{},defaultIndex:b=0}){const[x,g]=d.useState(0),[a,h]=d.useState(0),f=d.useRef(null),m=n=>{if(n<0||n>e.length-1)return;g(n);const c=f.current.clientWidth;h(n*(r+i)-(c-r)/2+i*.5),u(n)};d.useEffect(()=>{m(b);const n=c=>c.preventDefault();f.current.addEventListener("touchmove",n,{passive:!1})},[]);let o;const w=n=>{o=n.touches[0].clientX},v=n=>{const c=n.changedTouches[0],k=o-c.clientX;Math.abs(k)>60&&(k>0?m(x+1):m(x-1))};return t.jsx(ve,{ref:f,onTouchStart:w,onTouchEnd:v,children:t.jsx("div",{className:"card-container",style:{transform:`translate(${-a}px, 0)`},children:e.map((n,c)=>t.jsx("div",{className:`card-item ${c===x?"selected":""}`,style:{width:r,height:l,margin:i/2},onClick:()=>m(c),children:n.display?t.jsx("div",{className:"card-content",children:t.jsx(le,{data:n.display,style:{width:"100%",height:"100%"}})}):t.jsx("div",{className:"card-content",dangerouslySetInnerHTML:{__html:n.src}})},n.id))})})}const ve=_.div`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-DaeBi0tJ.js","./index-DQAon04N.js","./index-DGkT7afN.css"])))=>i.map(i=>d[i]);
2
+ import{r as d,cs as z,c0 as U,ct as F,cu as X,aG as H,j as t,s as _,o as j,F as V,aP as B,g as G,cv as O,w as D,N as p,cw as J,W as Q,v as L,b7 as q,T as I,cx as M,L as K,cy as Y,bE as Z,cz as ee,cA as te,u as se,x as ae,bw as oe,ar as ne,af as re}from"./index-DQAon04N.js";import{V as ie}from"./ViewList-Bwe4mYRB.js";import{D as ce}from"./Done-BrXgYrm-.js";import{N as le}from"./index-DdGrP93n.js";import{w as pe}from"./wrap-locale-DcxOTLb-.js";import{g as de}from"./get-safe-url-CVrrblG0.js";import{S as ue,a as me,b as he}from"./Stepper-CKg6__EK.js";import"./emotion-cache.browser.esm-BkCEErJn.js";var P=function(e){if(!e)return 0;var r=X(e).valueOf()-Date.now();return r<0?0:r},fe=function(e){return{days:Math.floor(e/864e5),hours:Math.floor(e/36e5)%24,minutes:Math.floor(e/6e4)%60,seconds:Math.floor(e/1e3)%60,milliseconds:Math.floor(e)%1e3}},xe=function(e){e===void 0&&(e={});var r=e||{},l=r.leftTime,i=r.targetDate,u=r.interval,b=u===void 0?1e3:u,x=r.onEnd,g=d.useMemo(function(){return z(l)&&l>0?Date.now()+l:void 0},[l]),a="leftTime"in e?g:i,h=U(d.useState(function(){return P(a)}),2),f=h[0],m=h[1],o=F(x);d.useEffect(function(){if(!a){m(0);return}m(P(a));var v=setInterval(function(){var n,c=P(a);m(c),c===0&&(clearInterval(v),(n=o.current)===null||n===void 0||n.call(o))},b);return function(){return clearInterval(v)}},[a,b]);var w=d.useMemo(function(){return fe(f)},[f]);return[f,w]};const ge=H(t.jsx("path",{d:"M19 9h-4V3H9v6H5l7 7zM5 18v2h14v-2z"}));function E({list:e=[],width:r=300,height:l=400,cardSpace:i=40,onSelect:u=()=>{},defaultIndex:b=0}){const[x,g]=d.useState(0),[a,h]=d.useState(0),f=d.useRef(null),m=n=>{if(n<0||n>e.length-1)return;g(n);const c=f.current.clientWidth;h(n*(r+i)-(c-r)/2+i*.5),u(n)};d.useEffect(()=>{m(b);const n=c=>c.preventDefault();f.current.addEventListener("touchmove",n,{passive:!1})},[]);let o;const w=n=>{o=n.touches[0].clientX},v=n=>{const c=n.changedTouches[0],k=o-c.clientX;Math.abs(k)>60&&(k>0?m(x+1):m(x-1))};return t.jsx(ve,{ref:f,onTouchStart:w,onTouchEnd:v,children:t.jsx("div",{className:"card-container",style:{transform:`translate(${-a}px, 0)`},children:e.map((n,c)=>t.jsx("div",{className:`card-item ${c===x?"selected":""}`,style:{width:r,height:l,margin:i/2},onClick:()=>m(c),children:n.display?t.jsx("div",{className:"card-content",children:t.jsx(le,{data:n.display,style:{width:"100%",height:"100%"}})}):t.jsx("div",{className:"card-content",dangerouslySetInnerHTML:{__html:n.src}})},n.id))})})}const ve=_.div`
3
3
  overflow: hidden;
4
4
  mask-image: linear-gradient(to left, transparent, black 3%, black 97%, transparent);
5
5
  overflow: hidden;
@@ -33,7 +33,7 @@ import{r as d,cs as z,c0 as U,ct as F,cu as X,aG as H,j as t,s as _,o as j,F as
33
33
  }
34
34
  }
35
35
  }
36
- `;E.propTypes={list:j.array,width:j.number,height:j.number,cardSpace:j.number,onSelect:j.func,defaultIndex:j.number};function be({icon:e,active:r,completed:l}){const i={1:t.jsx(ie,{className:"step-icon"}),2:t.jsx(ge,{className:"step-icon"}),3:t.jsx(ce,{className:"step-icon"})},u=["step-icon-w"];return r&&u.push("step-icon-w--active"),l&&u.push("step-icon-w--completed"),t.jsx("div",{className:u.join(" "),children:i[String(e)]})}function we({SessionContext:e,webWalletUrl:r,createPassportSvg:l,passportColor:i,onLogin:u,teamDid:b}){const{api:x}=d.useContext(e),g=V(s=>s.breakpoints.down("sm")),a=B({user:null,passport:null,success:!1,activeStep:0}),h=d.useRef({sessionToken:"",refreshToken:""}),{setPassportId:f,clearPassportId:m}=Y(),{t:o,locale:w}=d.useContext(G),{wallet:v}=O(),[n,c]=d.useState(0),{searchParams:k}=new URL(window.location.href),S=()=>{a.activeStep++},$=s=>{a.user=s.user},W=()=>{S()},A=(s,y)=>{s?.passportId&&f(s.passportId),s?.sessionToken&&(h.current.sessionToken=y(s.sessionToken)),s?.refreshToken&&(h.current.refreshToken=y(s.refreshToken)),a.success=!0,S()},T=async()=>{if(v&&M()){Z(()=>import("./index-CxVls5Qj.js").then(y=>y.i),__vite__mapDeps([0,1,2]),import.meta.url).then(y=>{y.call("arcClosePage")});return}ee(u)&&u({sessionToken:h.current.sessionToken,refreshToken:h.current.refreshToken});const s=k.get("redirect");if(s){window.location.replace(de(s));return}m(),window.location.replace("/")},R=s=>{a.passport=s.target.value},[C]=xe({leftTime:n,onEnd:()=>{T()}}),N=[{label:o("lostPassport.recoverPassport"),content:()=>{if(!a.user){const s=k.get("scope")||"passport";return t.jsx(D,{popup:!0,open:!0,hideCloseButton:!0,className:"connect",action:"lost-passport-list",forceConnected:!1,autoConnect:!1,checkFn:x.get,checkTimeout:10*60*1e3,webWalletUrl:r,onSuccess:$,locale:w,messages:{title:o("lostPassport.recoverDialog.title"),scan:o("lostPassport.recoverDialog.scan"),confirm:o("lostPassport.recoverDialog.confirm"),success:o("lostPassport.recoverDialog.success")},extraParams:{scope:s}})}return t.jsxs(p,{className:"select-passport",children:[t.jsxs(p,{className:"user-info",sx:{my:1,display:"flex",alignItems:"center"},children:[t.jsx(J,{src:a.user.avatar,style:{width:48,height:48,backgroundColor:"transparent",marginRight:16}}),t.jsxs(p,{children:[t.jsx(p,{className:"name",children:a.user.fullName}),t.jsx(p,{className:"did",sx:{mt:1},children:t.jsx(Q,{responsive:!g,compact:g,did:a.user.did})})]})]}),t.jsx(p,{children:t.jsx(E,{width:g?180:230,height:g?240:306,cardSpace:24,list:a.user.passportTypes.map(s=>({src:l({scope:s.scope,role:s.role,title:s.scope==="kyc"?s.name:s.title,issuer:s.issuer.name,issuerDid:s.issuer.id,ownerDid:a.user.did,ownerName:a.user.fullName,ownerAvatarUrl:a.user.avatar,preferredColor:i||"auto",extra:s.scope==="kyc"?{key:"Email",value:s.name}:void 0}),name:s.title,id:s.id,display:s.display})),onSelect:s=>R({target:{value:a.user.passportTypes[s].id}}),defaultIndex:0})}),t.jsx(p,{sx:{textAlign:"center"},children:t.jsx(L,{variant:"contained",color:"primary",onClick:()=>W(),disabled:!a.passport,children:o("common.next")})})]})}},{label:o("lostPassport.receivePassport"),content:()=>{const s={receiverDid:a.user.did,passportId:a.passport,teamDid:b||window?.blocklet?.did};return t.jsx(D,{popup:!0,open:!0,hideCloseButton:!0,className:"connect",action:"lost-passport-issue",checkFn:x.get,checkTimeout:10*60*1e3,webWalletUrl:r,onSuccess:A,forceConnected:!1,locale:w,messages:{title:`${o("lostPassport.receiveDialog.title")}`,scan:o("lostPassport.receiveDialog.scan"),confirm:o("lostPassport.receiveDialog.confirm"),success:o("lostPassport.receiveDialog.success")},extraParams:s})}},{label:o("common.complete"),content:()=>(n===0&&c(3e3),t.jsxs(p,{sx:{textAlign:"center"},children:[t.jsx(p,{sx:{mb:3,color:"success.main"},children:t.jsx(q,{style:{fontSize:60}})}),t.jsx(I,{component:"p",variant:"body1",className:"subheader",children:o("issuePassport.dialog.success")}),t.jsx(I,{component:"p",variant:"body2",color:"gray",children:v&&M()?o("issuePassport.dialog.autoClose",{seconds:Math.round(C/1e3)}):o("issuePassport.dialog.autoJump",{seconds:Math.round(C/1e3)})}),t.jsx(L,{style:{marginTop:40},variant:"contained",color:"primary",onClick:T,children:o("issuePassport.dialog.loginWithPassport")})]}))}];return t.jsx(ye,{children:t.jsxs(p,{className:"stepper",children:[t.jsx(ue,{className:"stepper-progress",alternativeLabel:!0,activeStep:a.activeStep,children:N.map(({label:s})=>t.jsx(me,{children:t.jsx(he,{slots:{stepIcon:be},children:s})},s))}),t.jsx(p,{className:"stepper-content",children:N[a.activeStep].content()}),!a.success&&t.jsx(p,{sx:{textAlign:"center",fontSize:12},children:t.jsx(K,{href:"/",sx:{color:"#4598FA",textDecoration:"none"},children:o("lostPassport.return")})})]})})}const ye=_(te)`
36
+ `;E.propTypes={list:j.array,width:j.number,height:j.number,cardSpace:j.number,onSelect:j.func,defaultIndex:j.number};function be({icon:e,active:r,completed:l}){const i={1:t.jsx(ie,{className:"step-icon"}),2:t.jsx(ge,{className:"step-icon"}),3:t.jsx(ce,{className:"step-icon"})},u=["step-icon-w"];return r&&u.push("step-icon-w--active"),l&&u.push("step-icon-w--completed"),t.jsx("div",{className:u.join(" "),children:i[String(e)]})}function we({SessionContext:e,webWalletUrl:r,createPassportSvg:l,passportColor:i,onLogin:u,teamDid:b}){const{api:x}=d.useContext(e),g=V(s=>s.breakpoints.down("sm")),a=B({user:null,passport:null,success:!1,activeStep:0}),h=d.useRef({sessionToken:"",refreshToken:""}),{setPassportId:f,clearPassportId:m}=Y(),{t:o,locale:w}=d.useContext(G),{wallet:v}=O(),[n,c]=d.useState(0),{searchParams:k}=new URL(window.location.href),S=()=>{a.activeStep++},$=s=>{a.user=s.user},W=()=>{S()},A=(s,y)=>{s?.passportId&&f(s.passportId),s?.sessionToken&&(h.current.sessionToken=y(s.sessionToken)),s?.refreshToken&&(h.current.refreshToken=y(s.refreshToken)),a.success=!0,S()},T=async()=>{if(v&&M()){Z(()=>import("./index-DaeBi0tJ.js").then(y=>y.i),__vite__mapDeps([0,1,2]),import.meta.url).then(y=>{y.call("arcClosePage")});return}ee(u)&&u({sessionToken:h.current.sessionToken,refreshToken:h.current.refreshToken});const s=k.get("redirect");if(s){window.location.replace(de(s));return}m(),window.location.replace("/")},R=s=>{a.passport=s.target.value},[C]=xe({leftTime:n,onEnd:()=>{T()}}),N=[{label:o("lostPassport.recoverPassport"),content:()=>{if(!a.user){const s=k.get("scope")||"passport";return t.jsx(D,{popup:!0,open:!0,hideCloseButton:!0,className:"connect",action:"lost-passport-list",forceConnected:!1,autoConnect:!1,checkFn:x.get,checkTimeout:10*60*1e3,webWalletUrl:r,onSuccess:$,locale:w,messages:{title:o("lostPassport.recoverDialog.title"),scan:o("lostPassport.recoverDialog.scan"),confirm:o("lostPassport.recoverDialog.confirm"),success:o("lostPassport.recoverDialog.success")},extraParams:{scope:s}})}return t.jsxs(p,{className:"select-passport",children:[t.jsxs(p,{className:"user-info",sx:{my:1,display:"flex",alignItems:"center"},children:[t.jsx(J,{src:a.user.avatar,style:{width:48,height:48,backgroundColor:"transparent",marginRight:16}}),t.jsxs(p,{children:[t.jsx(p,{className:"name",children:a.user.fullName}),t.jsx(p,{className:"did",sx:{mt:1},children:t.jsx(Q,{responsive:!g,compact:g,did:a.user.did})})]})]}),t.jsx(p,{children:t.jsx(E,{width:g?180:230,height:g?240:306,cardSpace:24,list:a.user.passportTypes.map(s=>({src:l({scope:s.scope,role:s.role,title:s.scope==="kyc"?s.name:s.title,issuer:s.issuer.name,issuerDid:s.issuer.id,ownerDid:a.user.did,ownerName:a.user.fullName,ownerAvatarUrl:a.user.avatar,preferredColor:i||"auto",extra:s.scope==="kyc"?{key:"Email",value:s.name}:void 0}),name:s.title,id:s.id,display:s.display})),onSelect:s=>R({target:{value:a.user.passportTypes[s].id}}),defaultIndex:0})}),t.jsx(p,{sx:{textAlign:"center"},children:t.jsx(L,{variant:"contained",color:"primary",onClick:()=>W(),disabled:!a.passport,children:o("common.next")})})]})}},{label:o("lostPassport.receivePassport"),content:()=>{const s={receiverDid:a.user.did,passportId:a.passport,teamDid:b||window?.blocklet?.did};return t.jsx(D,{popup:!0,open:!0,hideCloseButton:!0,className:"connect",action:"lost-passport-issue",checkFn:x.get,checkTimeout:10*60*1e3,webWalletUrl:r,onSuccess:A,forceConnected:!1,locale:w,messages:{title:`${o("lostPassport.receiveDialog.title")}`,scan:o("lostPassport.receiveDialog.scan"),confirm:o("lostPassport.receiveDialog.confirm"),success:o("lostPassport.receiveDialog.success")},extraParams:s})}},{label:o("common.complete"),content:()=>(n===0&&c(3e3),t.jsxs(p,{sx:{textAlign:"center"},children:[t.jsx(p,{sx:{mb:3,color:"success.main"},children:t.jsx(q,{style:{fontSize:60}})}),t.jsx(I,{component:"p",variant:"body1",className:"subheader",children:o("issuePassport.dialog.success")}),t.jsx(I,{component:"p",variant:"body2",color:"gray",children:v&&M()?o("issuePassport.dialog.autoClose",{seconds:Math.round(C/1e3)}):o("issuePassport.dialog.autoJump",{seconds:Math.round(C/1e3)})}),t.jsx(L,{style:{marginTop:40},variant:"contained",color:"primary",onClick:T,children:o("issuePassport.dialog.loginWithPassport")})]}))}];return t.jsx(ye,{children:t.jsxs(p,{className:"stepper",children:[t.jsx(ue,{className:"stepper-progress",alternativeLabel:!0,activeStep:a.activeStep,children:N.map(({label:s})=>t.jsx(me,{children:t.jsx(he,{slots:{stepIcon:be},children:s})},s))}),t.jsx(p,{className:"stepper-content",children:N[a.activeStep].content()}),!a.success&&t.jsx(p,{sx:{textAlign:"center",fontSize:12},children:t.jsx(K,{href:"/",sx:{color:"#4598FA",textDecoration:"none"},children:o("lostPassport.return")})})]})})}const ye=_(te)`
37
37
  padding-top: 46px;
38
38
  padding-bottom: 46px;
39
39
  height: 100%;
@@ -1,5 +1,5 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-C66QQpuI.js","./index-CftvQ5qe.js","./index-DGkT7afN.css","./decode-DPztD6kB.js","./index-CX3PrUL2.css"])))=>i.map(i=>d[i]);
2
- import{r as t,g as n,j as r,bE as i,d1 as a}from"./index-CftvQ5qe.js";const s=t.lazy(()=>i(()=>import("./index-C66QQpuI.js").then(o=>o.i),__vite__mapDeps([0,1,2,3,4]),import.meta.url)),d=`{
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index-DRNAAkse.js","./index-DQAon04N.js","./index-DGkT7afN.css","./decode-DPztD6kB.js","./index-CX3PrUL2.css"])))=>i.map(i=>d[i]);
2
+ import{r as t,g as n,j as r,bE as i,d1 as a}from"./index-DQAon04N.js";const s=t.lazy(()=>i(()=>import("./index-DRNAAkse.js").then(o=>o.i),__vite__mapDeps([0,1,2,3,4]),import.meta.url)),d=`{
3
3
  getNodeInfo {
4
4
  code
5
5
  info {
@@ -1,4 +1,4 @@
1
- import{bX as We,bW as Ge,r as h,bY as Ke,j as e,b8 as ee,b_ as Fe,cb as Z,b$ as $e,bU as Ye,cd as He,aG as he,O as q,bn as N,cq as qe,H as B,Y as V,bf as D,fB as Ce,aQ as we,b as M,iI as Ve,m as E,gw as Qe,o as m,x as Xe,ax as Be,y as fe,al as Je,g as Ze,C as A,T as j,i as et,s as tt,f as st,iJ as X,hT as J,iK as ot,N as S,aV as G,E as T,L as nt,p as H,dk as at,az as Se,U as F,aF as $,a9 as Y,a5 as rt,dH as it,gm as ct,a$ as lt,v as pe,w as dt,G as be,Z as De,by as xe,B as pt}from"./index-CftvQ5qe.js";import{T as ut}from"./html-title-22l2Q1um.js";import{u as U}from"./blocklet-NsEfDg6l.js";import{u as mt}from"./use-mobile-yxlmXKxe.js";import{c as Ee,d as ft,e as xt,f as gt,g as ue,h as ht,b as St,u as yt,C as bt,D as kt,a as jt}from"./connect-to-xoL-ebGz.js";import"./index-Ddtu3cFM.js";import"./index-BojVbZw0.js";import"./api-B2kaOziS.js";import{d as Ct,a as wt,g as Bt,i as Dt,e as ge,f as Et,h as It,j as Tt}from"./spaces-C8C4UTPO.js";import{v as Rt}from"./index-v0MyWksG.js";import{E as zt}from"./index-CaOGSW01.js";import{H as vt}from"./HelpOutline-CzlcjtgK.js";import{H as Pt}from"./index-Cq2A6apl.js";import{x as At}from"./index-DRYJ0xIl.js";import{c as Ut}from"./actions-16uUMkwj.js";import{D as Lt}from"./DeleteOutline-BKc7Kldo.js";import{g as ke}from"./get-safe-url-R3PVxGdM.js";import{S as Ot}from"./switch-control-B4hBQkSS.js";import{L as je}from"./list-header-DIS2vxCA.js";import"./OpenInNew-BetMIusn.js";import"./ButtonGroup-B-9GSfHZ.js";import"./getValidReactChildren-ME0VtRVG.js";import"./FilterList-ZxgoMe-m.js";import"./CSSTransition-6L6IgdSY.js";import"./emotion-cache.browser.esm-BhQzPcJc.js";import"./index-DNF01gaj.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-BqZSotpa.js";import"./index-CFQDJIpf.js";import"./TableSearch-94MsMfky.js";import"./Search-D7jj6_W7.js";import"./Clear-BCMMWwCD.js";import"./MoreVert-Nin8ZqO7.js";import"./useLocalStorage-o6l4se6z.js";import"./url-evaluation-CcymgN4m.js";import"./permission-CqGSt2jN.js";import"./Switch-dRW18BhE.js";function Mt(t){return We("MuiIcon",t)}Ge("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:s,fontSize:n,classes:o}=t,r={root:["root",s!=="inherit"&&`color${Z(s)}`,`fontSize${Z(n)}`]};return $e(r,Mt,o)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[s.root,n.color!=="inherit"&&s[`color${Z(n.color)}`],s[`fontSize${Z(n.fontSize)}`]]}})(Ye(({theme:t})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,variants:[{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:t.typography.pxToRem(20)}},{props:{fontSize:"medium"},style:{fontSize:t.typography.pxToRem(24)}},{props:{fontSize:"large"},style:{fontSize:t.typography.pxToRem(36)}},{props:{color:"action"},style:{color:(t.vars||t).palette.action.active}},{props:{color:"disabled"},style:{color:(t.vars||t).palette.action.disabled}},{props:{color:"inherit"},style:{color:void 0}},...Object.entries(t.palette).filter(He()).map(([s])=>({props:{color:s},style:{color:(t.vars||t).palette[s].main}}))]}))),ye=h.forwardRef(function(s,n){const o=Ke({props:s,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:i="inherit",component:c="span",fontSize:d="medium",...l}=o,p={...o,baseClassName:r,color:i,component:c,fontSize:d},f=Nt(p);return e.jsx(_t,{as:c,className:Fe(r,"notranslate",f.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Gt=he(e.jsx("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"})),Kt=he(e.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}));async function Ft({blockletDid:t,nodeApi:s,spaceGateways:n}){let o=!1;const r=await Promise.all(n.map(async a=>{let{name:i}=a;const c=await Ct(a.endpoint);return!q(c)&&c!==i&&(i=c,o=!0),{...a,name:i}}));return o&&await Promise.all(r.filter(a=>a.did).map(a=>s.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function $t({refresh:t}={}){const{blocklet:s}=U(),n=s?.meta?.did,{api:o}=N();return qe(async()=>{if(!n)return[];const{spaceGateways:r}=await o.getBlockletSpaceGateways({input:{did:n}});return await Ft({blockletDid:n,nodeApi:o,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Ie({deps:t,setLoading:s,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:o}=U(),[r,a]=h.useState([]),{api:i}=N(),[c,d]=h.useMemo(()=>n?[D(n).startOf("day").toISOString(),D(n).endOf("day").toISOString()]:[D().startOf("year").toISOString(),D().endOf("day").toISOString()],[n]),l=Ce(async()=>{try{if(s(!0),!o){a([]);return}const{backups:p}=await i.getBlockletBackups({input:{did:o.meta.did,startTime:c,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{s(!1)}},1e3);return we(async()=>{l()},[o?.meta?.did].concat(t)),{backups:r}}function Yt({appDid:t}){const{backups:s}=Ie(),[n,o]=h.useState({message:"",progress:0,completed:!1}),r=N(),{ws:{useSubscription:a}}=r;return a(M.BlockletEvents.backupProgress,i=>{t===i?.appDid&&o(()=>({...i}))},[t]),h.useEffect(()=>{if(s?.length&&Ve(s[0]?.status)){const[i]=s;o(()=>({message:i.message,progress:i.progress,completed:i.progress>=100}))}},[s]),n}function Ht({deps:t=[],setLoading:s=()=>{}}={}){const{blocklet:n}=U(),[o,r]=h.useState([]),{api:a}=N(),i=h.useCallback(Ce(async()=>{if(!a||!n?.meta?.did){r([]);return}try{s(!0);const c=D(),d=c.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.meta.did,startTime:d.toISOString(),endTime:c.toISOString()}});r(Array.isArray(l)?l:[])}catch(c){console.error("Failed to fetch backup summary:",c),B.error(V(c)),r([])}finally{s(!1)}},1e3),[]);return we(async()=>(await i(),()=>{i.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:o}}const Te=h.createContext({}),{Provider:qt,Consumer:$s}=Te;function Re({children:t}){const{t:s}=E(),{api:n}=N(),{blocklet:o}=U(),[r,a]=h.useState(null),[i,c]=h.useState(!1),{data:d,loading:l,mutate:p}=$t({refresh:i}),f=Qe(d),x=Yt({appDid:o?.appDid}),u=h.useMemo(()=>wt(o?.environments),[o?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(!1),{backups:te}=Ie({deps:[y,r],setLoading:w,backupDate:r}),[se,oe]=h.useState(!1),{backupSummary:ne}=Ht({deps:[se]}),[_,O]=h.useState(d?.find(g=>g.endpoint===u)),I=o?.settings?.autoBackup,z=()=>{c(g=>!g)},ae=()=>{oe(g=>!g)},re=()=>{b(g=>!g)},K=async g=>{await n.updateAutoBackup({input:{did:o.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:o.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:g}}),u!==P&&await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),O(g),z(),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===u&&(await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await K({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:g?.did}}),p(P=>{const R=[...P];return R.splice(R.indexOf(g),1),R}),O(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:o.meta.did,where:{did:g.did},spaceGateway:g}}),u!==g.endpoint&&n.configBlocklet({input:{did:[o.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===u;return e.jsx(qt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:f,spaceGatewayIsSelected:C,updateAutoBackup:K,abortBlockletBackup:Q,backupEndpoint:u,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}Re.propTypes={children:m.any.isRequired};function L(){return h.useContext(Te)}function ze({...t}){const{blocklet:s}=U(),{info:n}=N(),{t:o}=E(),r=Ee({blocklet:s}),a=Xe(n),{spaceGateways:i,addSpaceGateway:c}=L(),d={checkFn:Be.create({baseURL:fe(window.location.origin,Je())}).get,webWalletUrl:a,extraParams:{appPid:s.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:f,name:x,did:u})=>{const k=await Bt(f);if(!await Dt(k)){B.error(o("storage.spaces.gateway.add.invalidUrl"));return}if(i.some(b=>b.endpoint===f)){B.error(o("storage.spaces.gateway.add.duplicate",{name:x}));return}await c({name:x,did:u,url:k,endpoint:f},f)},p=async({spaceGateway:f})=>{try{await l(f)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function ve({...t}){const{t:s}=h.useContext(Ze),{blocklet:n,loadingDiskInfo:o,actions:r}=U();if(h.useEffect(()=>{r?.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),n.diskInfo){const a=(d,l,p)=>e.jsxs(j,{children:[d," ",e.jsx("strong",{children:l?et(l):"empty"})]}),i=n.environments.reduce((d,l)=>(d[l.key]=l.value,d),{}),c=[{key:"appDir",name:s("blocklet.diskInfo.appDir"),value:a(i.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:s("blocklet.diskInfo.dataDir"),value:a(i.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:s("blocklet.diskInfo.logDir"),value:a(i.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:s("blocklet.diskInfo.cacheDir"),value:a(i.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Vt,{component:"div",...t,children:c.map(d=>e.jsx(Rt,{valueComponent:"div",nameWidth:120,name:d.name,children:d.value},d.key))})}return o?e.jsx(A,{}):e.jsx(j,{children:s("blocklet.diskInfo.empty")})}const Vt=tt(j)``;function Pe(){const{t}=E(),{setBackupDate:s,backupSummary:n}=L(),o=xt({key:"lg"}),r=h.useRef(null),a=st(),i=h.useCallback(l=>{s(l)},[s]),c=h.useMemo(()=>{const l=D().add(1,"day"),p=D().subtract(11,"month").startOf("month"),f=new Map(n.map(u=>[u.date,{date:u.date,successCount:u.successCount,errorCount:u.errorCount}])),x=[];for(let u=p.clone();D(u).isBefore(l);u=u.add(1,"day")){const k=u.format("YYYY-MM-DD");x.push(f.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=c[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</div>`].join(`
1
+ import{bX as We,bW as Ge,r as h,bY as Ke,j as e,b8 as ee,b_ as Fe,cb as Z,b$ as $e,bU as Ye,cd as He,aG as he,O as q,bn as N,cq as qe,H as B,Y as V,bf as D,fB as Ce,aQ as we,b as M,iI as Ve,m as E,gw as Qe,o as m,x as Xe,ax as Be,y as fe,al as Je,g as Ze,C as A,T as j,i as et,s as tt,f as st,iJ as X,hT as J,iK as ot,N as S,aV as G,E as T,L as nt,p as H,dk as at,az as Se,U as F,aF as $,a9 as Y,a5 as rt,dH as it,gm as ct,a$ as lt,v as pe,w as dt,G as be,Z as De,by as xe,B as pt}from"./index-DQAon04N.js";import{T as ut}from"./html-title-s4xKUvYC.js";import{u as U}from"./blocklet-vLRH388n.js";import{u as mt}from"./use-mobile-BuUEnGf6.js";import{c as Ee,d as ft,e as xt,f as gt,g as ue,h as ht,b as St,u as yt,C as bt,D as kt,a as jt}from"./connect-to-lgGqqqWV.js";import"./index-itvjoWYA.js";import"./index-BojVbZw0.js";import"./api-BPsZ_jNB.js";import{d as Ct,a as wt,g as Bt,i as Dt,e as ge,f as Et,h as It,j as Tt}from"./spaces-DpCJGUwf.js";import{v as Rt}from"./index-CDjkuvXP.js";import{E as zt}from"./index-CLdrrNyQ.js";import{H as vt}from"./HelpOutline-DaPSpbPH.js";import{H as Pt}from"./index-1LmYeNoL.js";import{x as At}from"./index-DRYJ0xIl.js";import{c as Ut}from"./actions-D4Kz7IAL.js";import{D as Lt}from"./DeleteOutline-DkhKATuN.js";import{g as ke}from"./get-safe-url-CVrrblG0.js";import{S as Ot}from"./switch-control-DJmzxMX-.js";import{L as je}from"./list-header-CYEe-lQ7.js";import"./OpenInNew-8_57FieH.js";import"./ButtonGroup-Bb6jDsD1.js";import"./getValidReactChildren-DJQKILMh.js";import"./FilterList-CETwaOot.js";import"./CSSTransition-wxeeFOKf.js";import"./emotion-cache.browser.esm-BkCEErJn.js";import"./index-CN0dYmBa.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./depsEqual-CfdoQRpO.js";import"./index-DmfWG7ck.js";import"./TableSearch-Lg4M-8KA.js";import"./Search-hhDB6YL9.js";import"./Clear-v5WhrN0k.js";import"./MoreVert-C716pe1M.js";import"./useLocalStorage-DAbLYpB1.js";import"./url-evaluation-LJajQhtP.js";import"./permission-BIUOpX2u.js";import"./Switch-CEsPeHy7.js";function Mt(t){return We("MuiIcon",t)}Ge("MuiIcon",["root","colorPrimary","colorSecondary","colorAction","colorError","colorDisabled","fontSizeInherit","fontSizeSmall","fontSizeMedium","fontSizeLarge"]);const Nt=t=>{const{color:s,fontSize:n,classes:o}=t,r={root:["root",s!=="inherit"&&`color${Z(s)}`,`fontSize${Z(n)}`]};return $e(r,Mt,o)},_t=ee("span",{name:"MuiIcon",slot:"Root",overridesResolver:(t,s)=>{const{ownerState:n}=t;return[s.root,n.color!=="inherit"&&s[`color${Z(n.color)}`],s[`fontSize${Z(n.fontSize)}`]]}})(Ye(({theme:t})=>({userSelect:"none",width:"1em",height:"1em",overflow:"hidden",display:"inline-block",textAlign:"center",flexShrink:0,variants:[{props:{fontSize:"inherit"},style:{fontSize:"inherit"}},{props:{fontSize:"small"},style:{fontSize:t.typography.pxToRem(20)}},{props:{fontSize:"medium"},style:{fontSize:t.typography.pxToRem(24)}},{props:{fontSize:"large"},style:{fontSize:t.typography.pxToRem(36)}},{props:{color:"action"},style:{color:(t.vars||t).palette.action.active}},{props:{color:"disabled"},style:{color:(t.vars||t).palette.action.disabled}},{props:{color:"inherit"},style:{color:void 0}},...Object.entries(t.palette).filter(He()).map(([s])=>({props:{color:s},style:{color:(t.vars||t).palette[s].main}}))]}))),ye=h.forwardRef(function(s,n){const o=Ke({props:s,name:"MuiIcon"}),{baseClassName:r="material-icons",className:a,color:i="inherit",component:c="span",fontSize:d="medium",...l}=o,p={...o,baseClassName:r,color:i,component:c,fontSize:d},f=Nt(p);return e.jsx(_t,{as:c,className:Fe(r,"notranslate",f.root,a),ownerState:p,"aria-hidden":!0,ref:n,...l})});ye.muiName="Icon";const Wt=he(e.jsx("path",{d:"M6 6v2h8.59L5 17.59 6.41 19 16 9.41V18h2V6z"})),Gt=he(e.jsx("path",{d:"M14.69 2.21 4.33 11.49c-.64.58-.28 1.65.58 1.73L13 14l-4.85 6.76c-.22.31-.19.74.08 1.01.3.3.77.31 1.08.02l10.36-9.28c.64-.58.28-1.65-.58-1.73L11 10l4.85-6.76c.22-.31.19-.74-.08-1.01-.3-.3-.77-.31-1.08-.02"})),Kt=he(e.jsx("path",{d:"m9.17 6 2 2H20v10H4V6zM10 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8z"}));async function Ft({blockletDid:t,nodeApi:s,spaceGateways:n}){let o=!1;const r=await Promise.all(n.map(async a=>{let{name:i}=a;const c=await Ct(a.endpoint);return!q(c)&&c!==i&&(i=c,o=!0),{...a,name:i}}));return o&&await Promise.all(r.filter(a=>a.did).map(a=>s.updateBlockletSpaceGateway({input:{did:t,where:{did:a.did},spaceGateway:{...a}}}))),r}function $t({refresh:t}={}){const{blocklet:s}=U(),n=s?.meta?.did,{api:o}=N();return qe(async()=>{if(!n)return[];const{spaceGateways:r}=await o.getBlockletSpaceGateways({input:{did:n}});return await Ft({blockletDid:n,nodeApi:o,spaceGateways:r})??[]},{refreshDeps:[n,t],onError(r){r?.message?.includes("not logged")?console.warn(r):(console.error(r),B.error(V(r)))}})}function Ie({deps:t,setLoading:s,backupDate:n}={deps:[],setLoading:()=>{},backupDate:new Date}){const{blocklet:o}=U(),[r,a]=h.useState([]),{api:i}=N(),[c,d]=h.useMemo(()=>n?[D(n).startOf("day").toISOString(),D(n).endOf("day").toISOString()]:[D().startOf("year").toISOString(),D().endOf("day").toISOString()],[n]),l=Ce(async()=>{try{if(s(!0),!o){a([]);return}const{backups:p}=await i.getBlockletBackups({input:{did:o.meta.did,startTime:c,endTime:d}});a(p??[])}catch(p){console.error(p),B.error(V(p))}finally{s(!1)}},1e3);return we(async()=>{l()},[o?.meta?.did].concat(t)),{backups:r}}function Yt({appDid:t}){const{backups:s}=Ie(),[n,o]=h.useState({message:"",progress:0,completed:!1}),r=N(),{ws:{useSubscription:a}}=r;return a(M.BlockletEvents.backupProgress,i=>{t===i?.appDid&&o(()=>({...i}))},[t]),h.useEffect(()=>{if(s?.length&&Ve(s[0]?.status)){const[i]=s;o(()=>({message:i.message,progress:i.progress,completed:i.progress>=100}))}},[s]),n}function Ht({deps:t=[],setLoading:s=()=>{}}={}){const{blocklet:n}=U(),[o,r]=h.useState([]),{api:a}=N(),i=h.useCallback(Ce(async()=>{if(!a||!n?.meta?.did){r([]);return}try{s(!0);const c=D(),d=c.subtract(1,"year"),{summary:l}=await a.getBlockletBackupSummary({input:{did:n.meta.did,startTime:d.toISOString(),endTime:c.toISOString()}});r(Array.isArray(l)?l:[])}catch(c){console.error("Failed to fetch backup summary:",c),B.error(V(c)),r([])}finally{s(!1)}},1e3),[]);return we(async()=>(await i(),()=>{i.cancel()}),[n?.meta?.did].concat(t)),{backupSummary:o}}const Te=h.createContext({}),{Provider:qt,Consumer:$s}=Te;function Re({children:t}){const{t:s}=E(),{api:n}=N(),{blocklet:o}=U(),[r,a]=h.useState(null),[i,c]=h.useState(!1),{data:d,loading:l,mutate:p}=$t({refresh:i}),f=Qe(d),x=Yt({appDid:o?.appDid}),u=h.useMemo(()=>wt(o?.environments),[o?.environments]),[k,w]=h.useState(!1),[y,b]=h.useState(!1),{backups:te}=Ie({deps:[y,r],setLoading:w,backupDate:r}),[se,oe]=h.useState(!1),{backupSummary:ne}=Ht({deps:[se]}),[_,O]=h.useState(d?.find(g=>g.endpoint===u)),I=o?.settings?.autoBackup,z=()=>{c(g=>!g)},ae=()=>{oe(g=>!g)},re=()=>{b(g=>!g)},K=async g=>{await n.updateAutoBackup({input:{did:o.meta.did,autoBackup:g}})},Q=async()=>{await n.abortBlockletBackup({input:{appPid:o.meta.did}})},ie=async(g,P)=>{try{p(R=>{const v=[...R];return v.push({...g,loading:!0}),v}),await n.addBlockletSpaceGateway({input:{did:o.meta.did,spaceGateway:g}}),u!==P&&await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:P}]}}),O(g),z(),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"}))}catch(R){throw console.error(R),p(v=>[...v].filter(W=>W.did!==g.did)),R}},ce=async g=>{g&&(g.endpoint===u&&(await n.configBlocklet({input:{did:[o.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:""}]}}),I?.enabled&&await K({enabled:!1})),await n.deleteBlockletSpaceGateway({input:{did:o.meta.did,spaceGatewayDid:g?.did}}),p(P=>{const R=[...P];return R.splice(R.indexOf(g),1),R}),O(g),z())},le=async g=>{await Promise.all([n.updateBlockletSpaceGateway({input:{did:o.meta.did,where:{did:g.did},spaceGateway:g}}),u!==g.endpoint&&n.configBlocklet({input:{did:[o.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:g.endpoint}]}})]),B.success(s("storage.spaces.connectedWithName",{name:g?.name??"DID Spaces"})),z()},C=g=>g?.endpoint===u;return e.jsx(qt,{value:{spaceGateways:d||[],selectedSpaceGateway:_,addSpaceGateway:ie,deleteSpaceGateway:ce,updateSpaceGateway:le,refreshSpaceGateways:z,spaceGatewaysLoading:l,spaceGatewaysFirstLoading:f,spaceGatewayIsSelected:C,updateAutoBackup:K,abortBlockletBackup:Q,backupEndpoint:u,backupProgress:x,backups:te,backupSummary:ne,refreshBackupSummary:ae,refreshBackups:re,setBackupDate:a,backupsLoading:k,autoBackup:I},children:t})}Re.propTypes={children:m.any.isRequired};function L(){return h.useContext(Te)}function ze({...t}){const{blocklet:s}=U(),{info:n}=N(),{t:o}=E(),r=Ee({blocklet:s}),a=Xe(n),{spaceGateways:i,addSpaceGateway:c}=L(),d={checkFn:Be.create({baseURL:fe(window.location.origin,Je())}).get,webWalletUrl:a,extraParams:{appPid:s.appPid,appDid:r.appDid,appName:r.appName,appDescription:r.appDescription,appUrl:r.appUrl,referrer:r.referrer,scopes:r.scopes,nodeDid:n.did}},l=async({endpoint:f,name:x,did:u})=>{const k=await Bt(f);if(!await Dt(k)){B.error(o("storage.spaces.gateway.add.invalidUrl"));return}if(i.some(b=>b.endpoint===f)){B.error(o("storage.spaces.gateway.add.duplicate",{name:x}));return}await c({name:x,did:u,url:k,endpoint:f},f)},p=async({spaceGateway:f})=>{try{await l(f)}catch(x){console.error(x),B.error(V(x))}};return e.jsx(ft,{...t,connectScope:"app",options:d,onSuccess:p})}function ve({...t}){const{t:s}=h.useContext(Ze),{blocklet:n,loadingDiskInfo:o,actions:r}=U();if(h.useEffect(()=>{r?.refreshBlocklet({showError:!1,attachDiskInfo:!0})},[]),n.diskInfo){const a=(d,l,p)=>e.jsxs(j,{children:[d," ",e.jsx("strong",{children:l?et(l):"empty"})]}),i=n.environments.reduce((d,l)=>(d[l.key]=l.value,d),{}),c=[{key:"appDir",name:s("blocklet.diskInfo.appDir"),value:a(i.BLOCKLET_APP_DIR,n.diskInfo.app)},{key:"dataDir",name:s("blocklet.diskInfo.dataDir"),value:a(i.BLOCKLET_DATA_DIR,n.diskInfo.data)},{key:"logDir",name:s("blocklet.diskInfo.logDir"),value:a(i.BLOCKLET_LOG_DIR,n.diskInfo.log)},{key:"cacheDir",name:s("blocklet.diskInfo.cacheDir"),value:a(i.BLOCKLET_CACHE_DIR,n.diskInfo.cache)}];return e.jsx(Vt,{component:"div",...t,children:c.map(d=>e.jsx(Rt,{valueComponent:"div",nameWidth:120,name:d.name,children:d.value},d.key))})}return o?e.jsx(A,{}):e.jsx(j,{children:s("blocklet.diskInfo.empty")})}const Vt=tt(j)``;function Pe(){const{t}=E(),{setBackupDate:s,backupSummary:n}=L(),o=xt({key:"lg"}),r=h.useRef(null),a=st(),i=h.useCallback(l=>{s(l)},[s]),c=h.useMemo(()=>{const l=D().add(1,"day"),p=D().subtract(11,"month").startOf("month"),f=new Map(n.map(u=>[u.date,{date:u.date,successCount:u.successCount,errorCount:u.errorCount}])),x=[];for(let u=p.clone();D(u).isBefore(l);u=u.add(1,"day")){const k=u.format("YYYY-MM-DD");x.push(f.get(k)||{date:k,successCount:0,errorCount:0})}return x},[n]),d=h.useMemo(()=>({grid:{containLabel:!0,right:10,top:30,bottom:12},tooltip:{formatter:k=>{const{date:w,successCount:y,errorCount:b}=c[k.dataIndex]||{date:k.data[0],successCount:0,errorCount:0};return[`<div>${t("common.time")}: ${w}</div>`,`<div>${t("common.succeeded")}: ${y}</div>`,`<div>${t("common.failed")}: ${b}</div>`].join(`
2
2
  `)},backgroundColor:a.palette.background.paper,borderColor:a.palette.divider,textStyle:{color:a.palette.text.primary,fontSize:14},extraCssText:`box-shadow: ${a.shadows[2]}; border-radius: 4px;`,padding:[8,10]},visualMap:{show:!1,min:-12,max:12,pieces:[{min:Number.MIN_SAFE_INTEGER,max:-9,color:X[600]},{min:-9,max:-6,color:X[500]},{min:-6,max:-3,color:X[400]},{min:-3,max:-1,color:X[300]},{min:0,max:0,color:a.palette.grey[200]},{min:1,max:3,color:J[300]},{min:3,max:6,color:J[400]},{min:6,max:9,color:J[500]},{min:9,max:Number.MAX_SAFE_INTEGER,color:J[600]}],orient:"horizontal",left:"center",bottom:12,itemWidth:12,itemHeight:12,textStyle:{color:a.palette.text.secondary,fontSize:12}},calendar:{top:30,left:50,right:10,bottom:4,cellSize:[8,8],splitLine:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,color:a.palette.background.default},dayLabel:{show:!0,firstDay:0,nameMap:["","Mon","","Wed","","Fri",""],position:"start",margin:4,fontSize:10,color:a.palette.text.primary,fontWeight:"400",width:20},monthLabel:{show:!0,nameMap:"cn",align:"left",color:a.palette.text.primary,fontWeight:"400",fontSize:12,position:"start",margin:4,width:30,padding:[0,2]},yearLabel:{show:!1},range:[D().subtract(11,"month").startOf("month").format("YYYY-MM-DD"),D().endOf("month").format("YYYY-MM-DD")],orient:"horizontal"},series:{type:"heatmap",coordinateSystem:"calendar",data:c.map(k=>[k.date,k.errorCount?-k.errorCount:k.successCount]),label:{show:!1},itemStyle:{borderWidth:2,borderColor:a.palette.background.default,borderRadius:4},emphasis:{itemStyle:{borderWidth:2,borderColor:ot[200],color:"inherit"}}}}),[c,t,a]);return e.jsxs(e.Fragment,{children:[e.jsx(S,{ref:r,sx:{maxWidth:"1280px",border:"1px solid",borderColor:"divider",padding:"8px",overflowX:"auto"},children:e.jsx(S,{sx:{width:"1200px",height:"180px",position:"relative"},children:e.jsx(zt,{option:d,style:{height:"100%",width:"100%"},notMerge:!0,lazyUpdate:!1,opts:{renderer:"canvas"},onEvents:{click:l=>{l.componentType==="series"&&l.data&&i(l.data[0])}}})})}),e.jsx(S,{sx:{display:"flex",justifyContent:"flex-end",mt:1,mr:o?2:5,mb:2},children:e.jsxs(G,{direction:o?"column":"row",spacing:o?2:1,sx:{width:"100%",justifyContent:"flex-start",alignItems:o?"flex-start":"center"},children:[e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #8B5000 0%, #A36200 33%, #C17700 66%, #E29000 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.failed")})]}),e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,bgcolor:"grey.200",border:"1px solid",borderColor:"grey.200"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.without")})]}),e.jsxs(G,{direction:"row",spacing:1,sx:{alignItems:"center"},children:[e.jsx(S,{sx:{width:32,height:12,borderRadius:.5,background:"linear-gradient(90deg, #9be9a8 0%, #40c463 33%, #30a14e 66%, #216e39 100%)"}}),e.jsx(j,{variant:"body2",sx:{color:"text.secondary"},children:t("storage.spaces.backup.succeeded")})]})]})})]})}const Qt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Ae({status:t,message:s="",createdAt:n}){const{t:o}=E(),r=t===T.BACKUPS.STATUS.PROGRESS&&D().diff(n,"hours")>=T.BACKUPS.TIMEOUT_HOURS,a=r&&o("common.timeoutError"),i=t===T.BACKUPS.STATUS.PROGRESS&&!r,c=t===T.BACKUPS.STATUS.SUCCEEDED&&!r;return i?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(A,{sx:{marginRight:"4px"},size:"12px"}),o("common.progress")]}):c?e.jsx(H,{type:"success",children:o("common.succeeded")}):e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"error",children:o("common.failed")}),e.jsx(Se,{style:{display:"flex",alignItems:"center",flexShrink:0},title:s||a,children:e.jsx(ye,{children:e.jsx(vt,{style:{width:"24px",height:"24px"},color:"error"})})})]})}Ae.propTypes={status:m.string.isRequired,message:m.string,createdAt:m.string.isRequired};function Ue({metadata:t={}}){const{t:s}=E();if(q(t))return e.jsx(H,{type:"success",children:s("common.succeeded")});const n=t.count||0,o=t.size||0,r=At(o,{iec:!0}),a=e.jsxs(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:[e.jsxs(j,{variant:"body2",children:[s("common.fileCount"),": ",n]}),e.jsxs(j,{variant:"body2",children:[s("common.fileSize"),": ",r]})]});return e.jsxs(S,{sx:{display:"inline-flex",alignItems:"center"},children:[e.jsx(H,{type:"success",children:s("common.succeeded")}),e.jsx(Qt,{title:a,style:{display:"flex",alignItems:"center",flexShrink:0},placement:"left",children:e.jsx(ye,{children:e.jsx(at,{style:{width:"24px",height:"24px"},color:"primary"})})})]})}Ue.propTypes={metadata:m.object};function Le(){const{t,locale:s}=E(),{spaceGateways:n,backups:o,backupsLoading:r}=L(),a=h.useMemo(()=>[{label:"DID Space",name:"target",options:{customBodyRenderLite:c=>{const{targetUrl:d,targetName:l,status:p,createdAt:f}=o[c],x=p===T.BACKUPS.STATUS.PROGRESS&&D().diff(f,"hours")>=T.BACKUPS.TIMEOUT_HOURS,u=p===T.BACKUPS.STATUS.SUCCEEDED&&!x,k=l||n.find(w=>d?.includes(ge(w?.endpoint)))?.name||"Unknown DID Space";return u?e.jsx(nt,{href:d,target:"_blank",sx:{fontSize:"16px"},children:k}):e.jsx(j,{variant:"body1",sx:{fontSize:"16px"},children:k})}}},{label:t("common.strategy"),name:"strategy",options:{customBodyRender:c=>{const d=t(c===0?"common.auto":"common.manual");return e.jsx(H,{children:d})}}},{label:t("common.startTime"),name:"createdAt",options:{customBodyRender:c=>D(c).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.endTime"),name:"updatedAt",options:{customBodyRender:c=>q(c)?"":D(c).format("YYYY-MM-DD HH:mm:ss")}},{label:t("common.status"),name:"status",options:{customBodyRenderLite:c=>{const d=o?.[c]??{},{status:l,message:p,createdAt:f,metadata:x}=d,u=l===T.BACKUPS.STATUS.PROGRESS&&D().diff(f,"hours")>=T.BACKUPS.TIMEOUT_HOURS,k=l===T.BACKUPS.STATUS.PROGRESS&&!u,w=l===T.BACKUPS.STATUS.SUCCEEDED&&!u;return k?e.jsxs(j,{sx:{display:"inline-flex",alignItems:"center",fontSize:"14px"},children:[e.jsx(A,{sx:{marginRight:"4px"},size:"12px"}),t("common.progress")]}):w?e.jsx(Ue,{metadata:x}):e.jsx(Ae,{status:l,message:p,createdAt:f})}}}],[o,n,t]),i=h.useMemo(()=>!o?.length,[o]);return e.jsx(e.Fragment,{children:i?e.jsx(S,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100px",color:"#9397A1",marginTop:"16px",marginBottom:"24px"},children:t("storage.spaces.record.emptyData")}):e.jsx(Pt,{title:"",loading:r,data:o,columns:a,emptyNode:t("storage.spaces.record.emptyData",s),options:{download:!1,filter:!1,print:!1,search:!1,viewColumns:!1}})})}function Xt(){const{t}=E();return e.jsxs(S,{children:[e.jsxs(S,{sx:{display:"flex",gap:3,flexDirection:{xs:"column",md:"row"}},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:"column",justifyContent:"center",alignItems:"center",alignContent:"center",minWidth:240},children:[e.jsx(gt,{style:{cursor:"pointer",width:"150px",height:"100%",maxHeight:160}}),e.jsx(j,{sx:{my:2,textAlign:"center",color:"text.secondary"},children:t("storage.spaces.connect.provider")}),e.jsx(ze,{})]}),e.jsxs(S,{sx:{flexGrow:1,minWidth:0},children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.spaces.backup.records")})}),e.jsx(Pe,{})]})]}),e.jsx(Le,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2,mt:2},children:t("common.dataStorage")}),e.jsx(ve,{})]})}function Oe({spaceGateway:t,onConfirm:s=()=>{},onCancel:n=()=>{}}){const{t:o}=E(),[r,a]=h.useState(!1),[i,c]=h.useState(!1),d=(f,x)=>{f?.preventDefault(),f?.stopPropagation(),a(x)},l=async f=>{try{f?.stopPropagation(),c(!0),await s?.(t),a(!1)}catch(x){console.error(x),B.error(`${o("storage.space.gateway.delete.failed")}: ${V(x)}`)}finally{a(!1),c(!1)}},p=f=>{d(f,!1),n?.(f)};return e.jsxs(e.Fragment,{children:[e.jsxs(F,{color:"red",onClick:f=>d(f,!0),children:[e.jsx($,{style:{minWidth:24,color:"red"},children:e.jsx(Lt,{fontSize:"small"})}),e.jsx(Y,{style:{color:"red"},children:o("common.disconnect")})]}),e.jsx(rt,{title:o("storage.spaces.gateway.delete.title"),open:r,confirmButton:{text:o("common.confirm"),props:{size:"small",variant:"contained",color:"error",loading:i}},cancelButton:{text:o("common.cancel"),props:{size:"small",variant:"outlined",disabled:i}},onConfirm:l,onCancel:p,children:e.jsx(j,{sx:{wordWrap:"break-word"},children:o("storage.spaces.gateway.delete.descForBackup",{name:`${t?.name}`})})})]})}Oe.propTypes={spaceGateway:m.shape({name:m.string.isRequired,url:m.string.isRequired,protected:m.bool}).isRequired,onConfirm:m.func,onCancel:m.func};function Me({spaceGateway:t,selected:s,onDelete:n=()=>{},onConnect:o=()=>{},enableSwitchToSpace:r=!0,backupInProgress:a=!1,...i}){const{abortBlockletBackup:c}=L(),[d,l]=h.useState(null),{t:p}=E(),[f,x]=h.useState(!1),u=(y,b)=>{y.stopPropagation(),y.preventDefault(),l(b&&y.currentTarget)},k=async y=>{try{x(!0),u(y,!1),await o(t)}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}},w=async y=>{try{x(!0),u(y,!1),await c()}catch(b){console.error(b),B.error(b.message)}finally{x(!1)}};return e.jsxs(e.Fragment,{children:[f||t?.loading?e.jsx(A,{sx:{ml:1},size:"24px"}):e.jsx(it,{"aria-label":"more","aria-controls":"actions-menu","aria-haspopup":"true","data-cy":"trigger-blocklet-actions",variant:"outlined",size:"small",onClick:y=>u(y,!0),...i,children:e.jsx(ct,{})}),e.jsxs(lt,{id:"simple-menu",anchorEl:d,keepMounted:!0,open:!!d,onClose:y=>u(y,!1),children:[e.jsxs(F,{onClick:y=>{u(y,!1),window.open(ke(t.endpoint?Et(t.endpoint):t.url,{allowDomains:null}))},children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Wt,{fontSize:"small"})}),e.jsx(Y,{children:p("common.open")})]}),e.jsxs(F,{onClick:y=>{u(y,!1),window.open(ke(It(t.endpoint),{allowDomains:null}))},children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Kt,{fontSize:"small"})}),e.jsx(Y,{children:p("storage.spaces.strategy.viewBackupFiles")})]}),!s&&r&&e.jsxs(F,{onClick:k,children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Gt,{fontSize:"small"})}),e.jsx(Y,{children:p("storage.spaces.connect.switchToSpace")})]}),a&&e.jsxs(F,{onClick:w,children:[e.jsx($,{style:{minWidth:24},children:e.jsx(Ut,{fontSize:"small"})}),e.jsx(Y,{children:p("storage.spaces.connect.abortBlockletBackup")})]}),!a&&e.jsx(Oe,{spaceGateway:t,onConfirm:async()=>{l(null),await n?.(t)},onCancel:()=>l(null)})]})]})}Me.propTypes={spaceGateway:m.shape({name:m.string.isRequired,url:m.string.isRequired,protected:m.bool,endpoint:m.string.isRequired,loading:m.bool}).isRequired,selected:m.bool.isRequired,enableSwitchToSpace:m.bool,onDelete:m.func,onConnect:m.func,backupInProgress:m.bool};const Jt=ee(({className:t,...s})=>e.jsx(Se,{...s,classes:{popper:t}}))(()=>({".MuiTooltip-tooltip":{backgroundColor:"transparent",padding:0,margin:0,boxShadow:"none",maxWidth:"none"},".MuiTooltip-arrow":{color:"rgba(230, 235, 245, 1)"}}));function Ne({spaceGateway:t,spaceStatus:s,selected:n,onConnected:o=()=>{},onDeleted:r=()=>{},onBackedUp:a=()=>{}}){const{t:i,locale:c}=E(),{blocklet:d}=U(),{api:l,info:{did:p}}=N(),{appDid:f,appName:x,appDescription:u,scopes:k,appUrl:w,referrer:y}=Ee({blocklet:d}),{backupProgress:b,updateSpaceGateway:te,deleteSpaceGateway:se,refreshBackupSummary:oe,refreshBackups:ne}=L(),[_,O]=h.useState(!1),[I,z]=h.useState({open:!1,action:"one-click-authorization",checkTimeout:1e3*300,messages:{title:i("storage.spaces.authorize.title",{appName:x},c),scan:i("storage.spaces.authorize.scan",{appName:x},c),confirm:"",success:e.jsx(j,{gutterBottom:!0,children:i("storage.spaces.authorize.success")})},onClose:()=>{z(C=>({...C,open:!1}))}}),ae=n&&!_&&s===ue.DISCONNECTED,re=n&&!_&&!t.loading&&s===ue.CONNECTED,K=n&&_&&s===ue.CONNECTED&&b?.progress>=0,Q=async()=>{try{if(await Tt(t?.endpoint)){await l.configBlocklet({input:{did:[d.meta.did],configs:[{key:M.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_BACKUP_ENDPOINT,value:t.endpoint}]}}),B.success(i("storage.spaces.connect.switchToSpaceSucceeded",{name:t.name?`(${t.name})`:""})),o?.(null,t);return}}catch(C){console.error(C),o?.(C,t);return}z(C=>({...C,open:!0,prefix:fe(t.url,"space/api/did"),baseUrl:new URL(t.url).origin,checkFn:Be.create({baseURL:fe(t.url,"space")}).get,extraParams:{appDid:f,appName:x,appDescription:u,scopes:k,appUrl:w,referrer:y,nodeDid:p,spaceDid:t.did}}))},ie=async(C,g)=>{const P=g(C.endpoint),R=ge(P),v=C.space?g(C.space):{};if(t.did&&R!==t.did){z(_e=>({..._e,open:!1}));const W=i("storage.spaces.gateway.switch.failedForMismatchSpace",{name:v?.name?v.name:""});B.error(W),o?.(new Error(W),t);return}const de={...t,name:v.name??"DID Space",did:v.did??ge(P),endpoint:P};await te(de),z(W=>({...W,open:!1})),o?.(null,de)},ce=async()=>{try{if(_)return;O(!0),await l.backupBlocklet({input:{appDid:d.appDid,to:"spaces"}})}catch(C){console.error(C),B.error(C.message),a?.(C,t)}finally{O(!0)}},le=async()=>{try{await se(t),B.success(i("storage.spaces.gateway.delete.succeeded",{name:t.name?`(${t.name})`:""})),r?.(null,t)}catch(C){console.error(C),r?.(C,t)}};return h.useEffect(()=>{b?.completed?(n&&(b?.progress===100?(B.success(i("storage.spaces.backupSuccessfully")),a?.(null,t)):b.message&&a?.(new Error(b?.message),t),b.progress=0,b.message=""),O(!1),setTimeout(()=>{oe(),ne()},1e3)):b.progress&&O(!0)},[b]),e.jsxs(e.Fragment,{children:[e.jsxs(S,{sx:{display:"flex",alignItems:"center",".action-btn":{borderRadius:1,marginLeft:1}},children:[re&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:ce,children:i("storage.spaces.strategy.backupNow")}),ae&&e.jsx(pe,{className:"action-btn",variant:"outlined",size:"small",onClick:Q,children:i("storage.spaces.disconnected.reconnectNow")}),K&&e.jsx(Jt,{title:b?.message&&e.jsx(S,{sx:{p:1,borderRadius:1,boxShadow:2,color:"black",backgroundColor:"white"},children:e.jsx(j,{variant:"body2",children:b.message})}),children:e.jsxs(pe,{className:"action-btn",variant:"outlined",size:"small",sx:{minWidth:70},children:[e.jsx(A,{variant:"determinate",value:b?.progress,size:14,sx:{mr:1}}),b?.progress,"%"]})}),e.jsx(dt,{forceConnected:!1,saveConnect:!1,prefix:I.prefix,open:I.open,popup:!0,action:I.action,baseUrl:I.baseUrl,checkFn:I.checkFn,onSuccess:ie,onClose:I.onClose,checkTimeout:I.checkTimeout,extraParams:I.extraParams,messages:I.messages,locale:c},"get-endpoint")]}),e.jsx(Me,{sx:{minWidth:32,padding:"2px 4px",ml:1},spaceGateway:t,selected:n,onDelete:le,onConnect:Q,enableSwitchToSpace:b?.completed||q(b?.message),backupInProgress:K})]})}Ne.propTypes={spaceGateway:m.shape({did:m.string.isRequired,name:m.string.isRequired,url:m.string.isRequired,endpoint:m.string.isRequired,protected:m.bool,loading:m.bool}).isRequired,spaceStatus:m.string.isRequired,selected:m.bool.isRequired,onConnected:m.func,onDeleted:m.func,onBackedUp:m.func};function Zt({...t}){const{t:s}=E();return e.jsxs(S,{...t,children:[e.jsx(S,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",mb:3},children:e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:s("storage.spaces.backup.records")})}),e.jsx(Pe,{}),e.jsx(Le,{})]})}function es({...t}){const{t:s}=E(),{autoBackup:n,updateAutoBackup:o}=L(),r=async()=>{try{const a=!n?.enabled;await o({enabled:a}),B.success(s(a?"storage.spaces.autoBackup.enabled":"storage.spaces.autoBackup.disabled"))}catch(a){B.error(a.message)}};return e.jsx(Ot,{checked:!!n?.enabled,onChange:r,name:"enableWelcomePage",labelProps:{label:e.jsx(j,{sx:{marginRight:"8px"},children:e.jsx("span",{children:s("storage.spaces.autoBackup.title")})})},style:{...t.style}})}function ts(){const{t}=E(),{spaceGateways:s,spaceGatewaysLoading:n,spaceGatewayIsSelected:o}=L(),r=n&&!s?.length,a=({spaceGateway:i,spaceStatus:c,selected:d,refresh:l})=>e.jsx(Ne,{spaceGateway:i,spaceStatus:c,selected:d,onConnected:()=>l(),onBackedUp:p=>p&&l()});return e.jsxs(S,{sx:{display:"flex",flexDirection:"column"},children:[e.jsxs(S,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},gap:{xs:1,md:2},justifyContent:{xs:"center",md:"flex-start"},alignItems:{xs:"flex-start",md:"center"}},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",flexGrow:1},children:t("storage.spaces.connected.title")}),e.jsx(es,{}),e.jsx(ze,{})]}),e.jsx(S,{sx:{mt:2},children:r?e.jsx(S,{sx:{display:"flex",justifyContent:"center"},children:e.jsx(A,{})}):e.jsx(be,{container:!0,spacing:2,children:e.jsx(e.Fragment,{children:s.map(i=>e.jsx(be,{size:{xs:12,md:6},children:e.jsx(ht,{endpoint:i.endpoint,selected:o(i),action:a},i.endpoint)},i.endpoint))})})}),e.jsx(Zt,{sx:{marginTop:"24px"}}),e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold",mb:2},children:t("common.dataStorage")}),e.jsx(ve,{})]})}function ss(){const{spaceGatewaysFirstLoading:t,spaceGateways:s}=L();return t?e.jsx(De,{relative:"parent",children:e.jsx(A,{})}):q(s)?e.jsx(Xt,{}):e.jsx(ts,{})}function os(){return e.jsx(Re,{children:e.jsx(ss,{})})}function ns(){const{spaceGateway:t,settingStorageEndpoint:s,updateSpaceGateway:n,hasStorageEndpoint:o,loading:r,storageEndpoint:a}=yt(),i=xe(()=>({display:"flex",alignItems:"center",justifyContent:"center",paddingTop:"16px"}));return r?e.jsx(De,{relative:"parent",children:e.jsx(A,{})}):e.jsxs(S,{sx:{maxWidth:"md",position:"relative"},children:[o?e.jsx(bt,{spaceGateway:t,settingStorageEndpoint:s}):e.jsx(kt,{}),e.jsx(S,{sx:i,children:e.jsx(jt,{onConnect:n,storageEndpoint:a})})]})}function as(){const{t}=E();return e.jsxs(St,{children:[e.jsxs(G,{spacing:1,sx:{marginBottom:2},children:[e.jsx(j,{sx:{fontSize:"1.2rem",fontWeight:"bold"},children:t("storage.appLevel.title")}),e.jsx(j,{sx:{color:"text.secondary"},children:t("storage.appLevel.description")})]}),e.jsx(ns,{})]})}function rs({navOrientation:t="vertical",...s}){const{t:n,locale:o}=E(),{blocklet:r}=U(),a=mt({key:"md"}),[i,c]=pt(),d=i.get("tab")||"backup",l=a?"horizontal":t,p=xe(()=>{const w=[{label:n("common.backup"),value:"backup"}],y=r?.capabilities?.didSpace;return(y===M.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED||y===M.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP)&&w.push({label:n("common.storage"),value:"storage"}),w},[o,l]),x=xe(()=>({backup:e.jsx(os,{}),storage:e.jsx(as,{})}))[d],u=w=>{c(y=>(w==="backup"?y.delete("tab"):y.set("tab",w),y))};if(p.length<=1)return e.jsx(me,{children:x});const k=e.jsx(ut,{tabs:p,current:d,orientation:l,onChange:u,sx:[{borderRight:1,height:"100%",borderColor:"divider"},l==="horizontal"&&{borderRight:0}]});if(l==="vertical")return e.jsx(S,{...s,children:e.jsxs(G,{direction:{md:"column",lg:"row"},sx:{gap:2},children:[e.jsx(S,{sx:{flexShrink:0},children:e.jsx(je,{left:k})}),e.jsx(S,{sx:{flexGrow:1,minWidth:0},children:e.jsx(me,{sx:{mt:1},children:x})})]})});if(l==="horizontal")return e.jsxs(S,{...s,children:[e.jsx(je,{left:k}),e.jsx(me,{sx:{mt:2},children:x})]})}rs.propTypes={navOrientation:m.oneOf(["vertical","horizontal"])};const me=ee(S)`
3
3
  position: relative;
4
4
  min-height: 66vh;
@@ -1 +1 @@
1
- import{r as P,m as E,A as C,j as e,Z as W,C as j,cB as I,N as T,w as k,H as u,E as N,u as S,x as U,ar as v,af as R}from"./index-CftvQ5qe.js";import{w as b}from"./wrap-locale-C2di08EA.js";import{g as L}from"./get-safe-url-R3PVxGdM.js";function B({SessionContext:n,webWalletUrl:a,onSuccess:r}){const{api:o,session:t}=P.useContext(n),{t:s,locale:g}=E(),h=C(),{searchParams:l}=new URL(window.location.href),p=l.get("redirect"),f=async(c,w)=>{r(c,w),await t.refresh(),u.success(s("exchangePassport.success")),setTimeout(()=>{if(p){const i=decodeURIComponent(p);i.startsWith(N.WELLKNOWN_SERVICE_PATH_PREFIX)?h(i,{replace:!0}):window.location.href=L(i)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},m=c=>{u.error(c.message)},d={},x=l.get("componentId");return x&&(d.componentId=x),t.loading?e.jsx(W,{children:e.jsx(j,{})}):e.jsx(I,{did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(T,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(k,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:o.get,checkTimeout:10*60*1e3,webWalletUrl:a,onSuccess:f,onError:m,locale:g,messages:{title:s("exchangePassport.dialog.title"),scan:s("exchangePassport.dialog.scan"),confirm:s("exchangePassport.dialog.confirm"),success:s("exchangePassport.dialog.success")},extraParams:d,extraContent:null,hideCloseButton:!0})})})}const _=b(B);function K(){const{info:n}=S(),a=U(n),r=(o,t)=>{o.sessionToken&&R(t(o.sessionToken))};return e.jsx(_,{SessionContext:v,webWalletUrl:a,onSuccess:r})}export{K as default};
1
+ import{r as P,m as E,A as C,j as e,Z as W,C as j,cB as I,N as T,w as k,H as u,E as N,u as S,x as U,ar as v,af as R}from"./index-DQAon04N.js";import{w as b}from"./wrap-locale-DcxOTLb-.js";import{g as L}from"./get-safe-url-CVrrblG0.js";function B({SessionContext:n,webWalletUrl:a,onSuccess:r}){const{api:o,session:t}=P.useContext(n),{t:s,locale:g}=E(),h=C(),{searchParams:l}=new URL(window.location.href),p=l.get("redirect"),f=async(c,w)=>{r(c,w),await t.refresh(),u.success(s("exchangePassport.success")),setTimeout(()=>{if(p){const i=decodeURIComponent(p);i.startsWith(N.WELLKNOWN_SERVICE_PATH_PREFIX)?h(i,{replace:!0}):window.location.href=L(i)}else window.location.href=window.env.pathPrefix||window.env.apiPrefix||"/"},3e3)},m=c=>{u.error(c.message)},d={},x=l.get("componentId");return x&&(d.componentId=x),t.loading?e.jsx(W,{children:e.jsx(j,{})}):e.jsx(I,{did:window?.blocklet?.appPid||window?.env?.appPid,children:e.jsx(T,{sx:{maxWidth:"100%",height:"100%"},children:e.jsx(k,{popup:!0,open:!0,className:"connect",action:"exchange-passport",checkFn:o.get,checkTimeout:10*60*1e3,webWalletUrl:a,onSuccess:f,onError:m,locale:g,messages:{title:s("exchangePassport.dialog.title"),scan:s("exchangePassport.dialog.scan"),confirm:s("exchangePassport.dialog.confirm"),success:s("exchangePassport.dialog.success")},extraParams:d,extraContent:null,hideCloseButton:!0})})})}const _=b(B);function K(){const{info:n}=S(),a=U(n),r=(o,t)=>{o.sessionToken&&R(t(o.sessionToken))};return e.jsx(_,{SessionContext:v,webWalletUrl:a,onSuccess:r})}export{K as default};
@@ -1,4 +1,4 @@
1
- import{u as k,j as o,C as y,ay as W,cT as b,A as U,m as E,cI as _,r,aW as D,h as d,y as x,al as P,af as R,w as O,E as A,x as $,ax as K,bw as z,s as H}from"./index-CftvQ5qe.js";import{I as M}from"./invitation-BtYanixJ.js";import"./index-CqNSZb83.js";import"./index-B1oVxdWu.js";import"./emotion-cache.browser.esm-BhQzPcJc.js";import"./sdk-XPuzwshs.js";import"./wrap-locale-C2di08EA.js";function V(p){const{api:i,session:f}=W(),{info:n}=k(),c=b(),v=U(),{t:l,locale:m}=E(),{encryptKey:N,decrypt:C}=_(),[I,g]=r.useState(!1),h=r.useMemo(()=>new URLSearchParams(c.search).get("inviteId"),[c]),t=D(async()=>{if(!h)return null;let e;const{data:s}=await i.get("/api/invitation",{params:{inviteId:h}}),a=!!d(n,"ownerNft.did")&&s.role.name==="owner";if(a){const u=new URL(window.location.href);u.pathname=x(P(),"/api/did/invite/token"),u.searchParams.set("_ek_",N),u.searchParams.set("inviteId",h);const{data:F}=await i.get(u.href);e=F}return{invitation:s,nextWorkflow:e,needReceiveNFT:a}}),T=r.useCallback(()=>{g(!0)},[]),L=r.useCallback(()=>{if(t.error)throw t.error;return t.value.invitation},[t]),w=r.useCallback(async e=>{e&&(Object.prototype.hasOwnProperty.call(e,"encrypted")&&!e.encrypted?R(e.sessionToken):R(C(e.sessionToken)));const s=new URLSearchParams(c.search);s.delete("inviteId");const a=s.toString();await f.refresh(),v(`/${a&&`?${a}`}`,{replace:!0})},[c,v,f]);if(t.loading)return o.jsx(y,{});const S=()=>{const e=new URL(window.location.href);e.pathname=x(P(),"/api/did/invite/status"),e.searchParams.set("_t_",t.value.nextWorkflow.token),e.searchParams.set("locale",m);const s=setInterval(async()=>{const{data:a}=await i.get(e.href);a.status==="succeed"&&(clearInterval(s),f.updateConnectedInfo(a),w(a))},2e3)},j=()=>{g(!1)};return o.jsxs(X,{className:"page-invite",children:[d(t,"value.needReceiveNFT")&&o.jsx(O,{action:"login",popup:!0,className:"connect",open:I,locale:m,baseUrl:n.launcher.url,checkFn:K.create({baseURL:n.launcher.url}).get,onSuccess:S,onClose:j,checkTimeout:5*60*1e3,webWalletUrl:$(n),extraParams:{nw:d(t,"value.nextWorkflow.url")},messages:{title:l("invite.transferNFTDialog.title",{name:n.name}),scan:l("invite.transferNFTDialog.scan"),confirm:l("invite.transferNFTDialog.confirm"),success:l("invite.transferNFTDialog.success")},prefix:`${A.WELLKNOWN_SERVICE_PATH_PREFIX}/api/did`}),o.jsx(M,{...p,getDataFn:L,createPassportSvg:e=>z(e,n),checkFn:i.get,onLoginSuccess:w,passportColor:"default",onReceive:d(t,"value.needReceiveNFT")?T:null})]})}const X=H.div`
1
+ import{u as k,j as o,C as y,ay as W,cT as b,A as U,m as E,cI as _,r,aW as D,h as d,y as x,al as P,af as R,w as O,E as A,x as $,ax as K,bw as z,s as H}from"./index-DQAon04N.js";import{I as M}from"./invitation-COCb5On_.js";import"./index-ByZBUOEV.js";import"./index-DdGrP93n.js";import"./emotion-cache.browser.esm-BkCEErJn.js";import"./sdk-DXw8dY2Q.js";import"./wrap-locale-DcxOTLb-.js";function V(p){const{api:i,session:f}=W(),{info:n}=k(),c=b(),v=U(),{t:l,locale:m}=E(),{encryptKey:N,decrypt:C}=_(),[I,g]=r.useState(!1),h=r.useMemo(()=>new URLSearchParams(c.search).get("inviteId"),[c]),t=D(async()=>{if(!h)return null;let e;const{data:s}=await i.get("/api/invitation",{params:{inviteId:h}}),a=!!d(n,"ownerNft.did")&&s.role.name==="owner";if(a){const u=new URL(window.location.href);u.pathname=x(P(),"/api/did/invite/token"),u.searchParams.set("_ek_",N),u.searchParams.set("inviteId",h);const{data:F}=await i.get(u.href);e=F}return{invitation:s,nextWorkflow:e,needReceiveNFT:a}}),T=r.useCallback(()=>{g(!0)},[]),L=r.useCallback(()=>{if(t.error)throw t.error;return t.value.invitation},[t]),w=r.useCallback(async e=>{e&&(Object.prototype.hasOwnProperty.call(e,"encrypted")&&!e.encrypted?R(e.sessionToken):R(C(e.sessionToken)));const s=new URLSearchParams(c.search);s.delete("inviteId");const a=s.toString();await f.refresh(),v(`/${a&&`?${a}`}`,{replace:!0})},[c,v,f]);if(t.loading)return o.jsx(y,{});const S=()=>{const e=new URL(window.location.href);e.pathname=x(P(),"/api/did/invite/status"),e.searchParams.set("_t_",t.value.nextWorkflow.token),e.searchParams.set("locale",m);const s=setInterval(async()=>{const{data:a}=await i.get(e.href);a.status==="succeed"&&(clearInterval(s),f.updateConnectedInfo(a),w(a))},2e3)},j=()=>{g(!1)};return o.jsxs(X,{className:"page-invite",children:[d(t,"value.needReceiveNFT")&&o.jsx(O,{action:"login",popup:!0,className:"connect",open:I,locale:m,baseUrl:n.launcher.url,checkFn:K.create({baseURL:n.launcher.url}).get,onSuccess:S,onClose:j,checkTimeout:5*60*1e3,webWalletUrl:$(n),extraParams:{nw:d(t,"value.nextWorkflow.url")},messages:{title:l("invite.transferNFTDialog.title",{name:n.name}),scan:l("invite.transferNFTDialog.scan"),confirm:l("invite.transferNFTDialog.confirm"),success:l("invite.transferNFTDialog.success")},prefix:`${A.WELLKNOWN_SERVICE_PATH_PREFIX}/api/did`}),o.jsx(M,{...p,getDataFn:L,createPassportSvg:e=>z(e,n),checkFn:i.get,onLoginSuccess:w,passportColor:"default",onReceive:d(t,"value.needReceiveNFT")?T:null})]})}const X=H.div`
2
2
  width: 100vw;
3
3
  height: 100%;
4
4
  min-height: 100vh;
@@ -1,4 +1,4 @@
1
- import{bd as c}from"./index-CftvQ5qe.js";var n={exports:{}};/*!
1
+ import{bd as c}from"./index-DQAon04N.js";var n={exports:{}};/*!
2
2
  Copyright (c) 2018 Jed Watson.
3
3
  Licensed under the MIT License (MIT), see
4
4
  http://jedwatson.github.io/classnames
@@ -1,4 +1,4 @@
1
- import{aG as de,j as e,hd as Ps,he as Ts,bL as Is,r as L,s as ve,N as A,f4 as wt,t as U,eN as ht,a4 as ne,C as Ie,bi as zt,dK as Es,o as T,hf as Ds,b2 as Ht,cw as Ls,cP as qs,dn as Ms,T as J,dF as at,bn as re,bz as ft,g as ue,hg as zs,bA as mt,b as se,bg as ee,dH as Y,H as Z,aV as ie,m as ae,n as Bt,q as Hs,w as Ft,ad as Bs,J as Nt,g7 as Fs,hh as Ns,au as Zs,aU as K,V as Te,$ as ke,D as Vs,X as Us,v as te,Y as it,hi as Ws,hj as Js,ez as Ks,eB as Gs,I as je,E as W,hk as Ys,cX as kt,W as Xs,fp as Zt,az as X,aR as St,hl as Qs,fc as Re,cr as E,by as ge,aE as Q,Q as G,aP as ye,hm as qe,a2 as er,hn as Je,c2 as Ce,eC as tr,ho as sr,dG as ce,f as $e,y as Vt,bv as ot,O as rr,cD as Ut,g6 as nr,fL as Ze,hp as ar,b9 as ir,L as or,cq as ze,aK as Be,hq as lr,U as cr,ag as Ct,a3 as Wt,bj as Fe,hr as Jt,b6 as dr,gw as we,fd as Kt,cV as Gt,B as ur,b5 as Rt,fe as hr,fj as fr,G as Ke,M as mr,bt as pr}from"./index-CftvQ5qe.js";import{F as gr,a as yr,s as vr,L as _e,S as xr,B as br}from"./preference-Bey_tcgS.js";import{N as $t}from"./ChevronRight-CAszk4lp.js";import{T as Ne}from"./html-title-22l2Q1um.js";import{w as Ee,P as jr}from"./permission-CqGSt2jN.js";import{u as pt}from"./index-C6_ndFqK.js";import{D as _r}from"./Done-YvMjYKuk.js";import{R as wr,S as M}from"./collapse-ICZWDlS4.js";import{A as kr,a as At}from"./Autocomplete-3llPzwt1.js";import{C as Sr,R as Cr,P as Rr}from"./rotate-session-key-CaqCmHAv.js";import{u as oe}from"./blocklet-NsEfDg6l.js";import{C as $r}from"./click-to-copy-lOPobaPV.js";import{u as Ve}from"./team-FAUimnG6.js";import{v as Yt}from"./index-v0MyWksG.js";import{g as Ar}from"./chain-DkgxMmoB.js";import{V as Or,d as Pr}from"./status-D6mbjR3i.js";import{S as pe}from"./Switch-dRW18BhE.js";import{B as Tr}from"./index-CTR7ZstQ.js";import{y as Ir}from"./index-CFQDJIpf.js";import{I as Er,J as Dr,K as Lr,L as qr}from"./index-DNF01gaj.js";import{u as xe,C as H,b as Ot}from"./index.esm-D1wUGno-.js";import{S as He,u as Mr}from"./switch-control-B4hBQkSS.js";import{D as Pt,R as Xt,a as Qt}from"./url-evaluation-CcymgN4m.js";import{A as Tt}from"./Add-BN88qEGx.js";import{S as zr}from"./Slider-Czj7jdSV.js";import{H as Ue}from"./index-Cq2A6apl.js";import{l as Hr}from"./index-BbOqBxtx.js";import{u as es}from"./use-mobile-yxlmXKxe.js";import{S as Ge}from"./simple-select-CYoiP9Va.js";import{G as Br}from"./actions-16uUMkwj.js";import{C as Fr}from"./CardContent-BPg_sEF2.js";import"./omit-CAsslcsZ.js";import"./index-CO63Eak1.js";import"./edit.svg-D3nj0Coq.js";import"./ArrowDropDown-CqnGNlRB.js";import"./ButtonGroup-B-9GSfHZ.js";import"./getValidReactChildren-ME0VtRVG.js";import"./index-CEbEfc0D.js";import"./iframe-BUEP2Jl5.js";import"./ListSubheader-BgKcqOo-.js";import"./ErrorOutline-OXo_CAtp.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./visuallyHidden-Dan1xhjv.js";import"./FilterList-ZxgoMe-m.js";import"./CSSTransition-6L6IgdSY.js";import"./emotion-cache.browser.esm-BhQzPcJc.js";import"./depsEqual-BqZSotpa.js";import"./TableSearch-94MsMfky.js";import"./Search-D7jj6_W7.js";import"./Clear-BCMMWwCD.js";import"./MoreVert-Nin8ZqO7.js";import"./useLocalStorage-o6l4se6z.js";import"./get-safe-url-R3PVxGdM.js";const ts=de([e.jsx("path",{d:"M21 7.28V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-2.28c.59-.35 1-.98 1-1.72V9c0-.74-.41-1.37-1-1.72M20 9v6h-7V9zM5 19V5h14v2h-6c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h6v2z"},"0"),e.jsx("circle",{cx:"16",cy:"12",r:"1.5"},"1")]),Nr=de([e.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),e.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")]),Zr=de(e.jsx("path",{d:"M21 8V7l-3 2-3-2v1l3 2zm1-5H2C.9 3 0 3.9 0 5v14c0 1.1.9 2 2 2h20c1.1 0 1.99-.9 1.99-2L24 5c0-1.1-.9-2-2-2M8 6c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3m6 12H2v-1c0-2 4-3.1 6-3.1s6 1.1 6 3.1zm8-6h-8V6h8z"})),Vr=de(e.jsx("path",{d:"M24 9v2h-6V9zM8 4C5.79 4 4 5.79 4 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4m0 9c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4m4.51-8.95C13.43 5.11 14 6.49 14 8s-.57 2.89-1.49 3.95C14.47 11.7 16 10.04 16 8s-1.53-3.7-3.49-3.95m4.02 9.78C17.42 14.66 18 15.7 18 17v3h2v-3c0-1.45-1.59-2.51-3.47-3.17"})),Ur=de(e.jsx("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3"})),Wr=de(e.jsx("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3"})),lt=de(e.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1z"})),Jr=de([e.jsx("path",{d:"M18 11c.7 0 1.37.1 2 .29V10c0-1.1-.9-2-2-2h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h6.26c-.79-1.13-1.26-2.51-1.26-4 0-3.87 3.13-7 7-7M8.9 6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1v2H8.9z"},"0"),e.jsx("path",{d:"M18 13c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5m0 2c.83 0 1.5.67 1.5 1.5S18.83 18 18 18s-1.5-.67-1.5-1.5.67-1.5 1.5-1.5m0 6c-1.03 0-1.94-.52-2.48-1.32.73-.42 1.57-.68 2.48-.68s1.75.26 2.48.68c-.54.8-1.45 1.32-2.48 1.32"},"1")]),Kr=de(e.jsx("path",{d:"M11 7 9.6 8.4l2.6 2.6H2v2h10.2l-2.6 2.6L11 17l5-5zm9 12h-8v2h8c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-8v2h8z"})),Gr=de(e.jsx("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2m6-6v-5c0-3.07-1.63-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.64 5.36 6 7.92 6 11v5l-2 2v1h16v-1zm-2 1H8v-6c0-2.48 1.51-4.5 4-4.5s4 2.02 4 4.5z"})),ss=de(e.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23z"})),Yr=de(e.jsx("path",{d:"M3 18c0 .55.45 1 1 1h5v-2H4c-.55 0-1 .45-1 1M3 6c0 .55.45 1 1 1h9V5H4c-.55 0-1 .45-1 1m10 14v-1h7c.55 0 1-.45 1-1s-.45-1-1-1h-7v-1c0-.55-.45-1-1-1s-1 .45-1 1v4c0 .55.45 1 1 1s1-.45 1-1M7 10v1H4c-.55 0-1 .45-1 1s.45 1 1 1h3v1c0 .55.45 1 1 1s1-.45 1-1v-4c0-.55-.45-1-1-1s-1 .45-1 1m14 2c0-.55-.45-1-1-1h-9v2h9c.55 0 1-.45 1-1m-5-3c.55 0 1-.45 1-1V7h3c.55 0 1-.45 1-1s-.45-1-1-1h-3V4c0-.55-.45-1-1-1s-1 .45-1 1v4c0 .55.45 1 1 1"})),Xr=de(e.jsx("path",{d:"M16 13c3.09-2.81 6-5.44 6-7.7C22 3.45 20.55 2 18.7 2c-1.04 0-2.05.49-2.7 1.25C15.34 2.49 14.34 2 13.3 2 11.45 2 10 3.45 10 5.3c0 2.26 2.91 4.89 6 7.7m-2.7-9c.44 0 .89.21 1.18.55L16 6.34l1.52-1.79c.29-.34.74-.55 1.18-.55.74 0 1.3.56 1.3 1.3 0 1.12-2.04 3.17-4 4.99-1.96-1.82-4-3.88-4-4.99 0-.74.56-1.3 1.3-1.3M19 16h-2c0-1.2-.75-2.28-1.87-2.7L8.97 11H1v11h6v-1.44l7 1.94 8-2.5v-1c0-1.66-1.34-3-3-3M3 20v-7h2v7zm10.97.41L7 18.48V13h1.61l5.82 2.17c.34.13.57.46.57.83 0 0-1.99-.05-2.3-.15l-2.38-.79-.63 1.9 2.38.79c.51.17 1.04.26 1.58.26H19c.39 0 .74.23.9.56z"}));var Qr=Array.prototype,It=Qr.splice;function en(x,C,$,R){var _=Ts,b=-1,m=C.length,r=x;for(x===C&&(C=Ps(C));++b<m;)for(var p=0,f=C[b],h=f;(p=_(r,h,p))>-1;)r!==x&&It.call(r,p,1),It.call(x,p,1);return x}function tn(x,C){return x&&x.length&&C&&C.length?en(x,C):x}var sn=Is(tn);const rn={width:24,height:24,body:'<path fill="currentColor" d="M4.975 15q-.425 0-.7-.288T4 14q0-.425.288-.713T5 13h14.025q.425 0 .7.288T20 14q0 .425-.288.713T19 15H4.975Zm0 4q-.425 0-.7-.288T4 18q0-.425.288-.713T5 17h14.025q.425 0 .7.288T20 18q0 .425-.288.713T19 19H4.975Zm0-8q-.425 0-.7-.288T4 10q0-.425.288-.713T5 9h14.025q.425 0 .7.288T20 10q0 .425-.288.713T19 11H4.975Zm0-4q-.425 0-.7-.288T4 6q0-.425.288-.713T5 5h14.025q.425 0 .7.288T20 6q0 .425-.288.713T19 7H4.975Z"/>'};function rs({label:x="",disabled:C=!1,required:$=!1,initialValue:R="",onChange:_=()=>{},style:b={},onSubmit:m=()=>{},triggers:r=[],options:p=[],formatterBeforeSubmit:f=a=>a.join(","),helperText:h="",placeholder:t="",renderImage:l=()=>null,renderLabel:o=()=>"",filterKeys:n=["name"],noEmpty:s=!1,...c}){const[a,i]=L.useState(!1),[u,g]=L.useState(!1),[y,k]=L.useState(""),w=L.useRef(null),[d,v]=L.useState(R),[j,S]=L.useState(d),O=L.useMemo(()=>{if(!p)return{};const q={};return p.forEach(z=>{q[z.code]=z}),q},[p]),P=()=>{if(!p)return[];if(!y)return p.map(z=>z.code);const q=new RegExp(y.toLowerCase());return p.filter(z=>{for(let F=0;F<n.length;F++){const V=n[F];if(q.test(z[V]?.toLowerCase()))return!0}return!1}).map(z=>z.code)},D=async()=>{g(!0);try{await m(typeof f=="function"?f(j):j)===!1?S(d):s&&!j.length?(S(R),v(R)):(S(j),v(j))}catch{S(d)}finally{g(!1),i(!1)}},I=(q,z)=>{if(!Array.isArray(z)){S([]),_([]);return}const F=z.filter(V=>O[V]);if(!F.length){S([]),_([]);return}S(F),_(F)},B=q=>{q.stopPropagation(),i(!0),setTimeout(()=>{if(w.current){const z=w.current.querySelector("input");z&&z.focus()}},500)},N=a?e.jsx(kr,{ref:w,options:p,value:j,onChange:I,inputValue:y,onInputChange:(q,z)=>{k(z)},fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",filterOptions:P,getOptionLabel:q=>O[q]?.name,renderInput:q=>e.jsx(U,{...q,label:"",placeholder:t}),renderOption:(q,z)=>{const F=j.indexOf(z)!==-1;return L.createElement(nn,{component:"li",...q,key:z},l(O[z]||{}),e.jsx(A,{sx:{"& > img":{mr:2,flexShrink:0}},style:{flex:1,fontWeight:F?"700":"normal"},children:o(z,O[z])||O[z]?.name}),e.jsx(A,{component:wt,sx:{opacity:.5,width:18,height:18},style:{visibility:F?"visible":"hidden"}}))},...c,slots:{popper:an}}):e.jsx(A,{className:"form-item-input slot",onClick:B,style:{whiteSpace:"pre-wrap",cursor:"text"},sx:{px:1},children:j.filter(q=>p.some(z=>z.code===q)).map(q=>e.jsx(ht,{label:p.find(z=>z.code===q).name,style:{marginRight:8},size:"small"},q))});return e.jsx(gr,{className:"form",style:b,children:e.jsxs(A,{className:"form-item",children:[e.jsxs(A,{className:"form-item-label",children:[x,$&&e.jsx(wr,{})]}),e.jsxs(A,{className:"form-item-body",children:[e.jsx(A,{className:"form-item-input",children:N}),a?e.jsx(A,{className:"form-item-action",children:e.jsxs(e.Fragment,{children:[e.jsx(ne,{"data-cy":"schema-form-item-confirm",onClick:D,disabled:C||u,size:"large",children:u?e.jsx(Ie,{size:24}):e.jsx(_r,{})}),e.jsx(ne,{"data-cy":"schema-form-item-cancel",onClick:()=>{S(d),i(!1)},disabled:C||u,size:"large",children:e.jsx(wt,{})})]})}):null]}),a&&h&&e.jsx(zt,{children:h})]})})}rs.propTypes={style:T.object,onSubmit:T.func,onChange:T.func,label:T.string,initialValue:T.string,required:T.bool,disabled:T.bool,triggers:T.array,options:T.array,helperText:T.string,formatterBeforeSubmit:T.func,placeholder:T.string,renderImage:T.func,filterKeys:T.arrayOf(T.string),noEmpty:T.bool,renderLabel:T.func};const nn=ve.div`
1
+ import{aG as de,j as e,hd as Ps,he as Ts,bL as Is,r as L,s as ve,N as A,f4 as wt,t as U,eN as ht,a4 as ne,C as Ie,bi as zt,dK as Es,o as T,hf as Ds,b2 as Ht,cw as Ls,cP as qs,dn as Ms,T as J,dF as at,bn as re,bz as ft,g as ue,hg as zs,bA as mt,b as se,bg as ee,dH as Y,H as Z,aV as ie,m as ae,n as Bt,q as Hs,w as Ft,ad as Bs,J as Nt,g7 as Fs,hh as Ns,au as Zs,aU as K,V as Te,$ as ke,D as Vs,X as Us,v as te,Y as it,hi as Ws,hj as Js,ez as Ks,eB as Gs,I as je,E as W,hk as Ys,cX as kt,W as Xs,fp as Zt,az as X,aR as St,hl as Qs,fc as Re,cr as E,by as ge,aE as Q,Q as G,aP as ye,hm as qe,a2 as er,hn as Je,c2 as Ce,eC as tr,ho as sr,dG as ce,f as $e,y as Vt,bv as ot,O as rr,cD as Ut,g6 as nr,fL as Ze,hp as ar,b9 as ir,L as or,cq as ze,aK as Be,hq as lr,U as cr,ag as Ct,a3 as Wt,bj as Fe,hr as Jt,b6 as dr,gw as we,fd as Kt,cV as Gt,B as ur,b5 as Rt,fe as hr,fj as fr,G as Ke,M as mr,bt as pr}from"./index-DQAon04N.js";import{F as gr,a as yr,s as vr,L as _e,S as xr,B as br}from"./preference-DSmHq1w5.js";import{N as $t}from"./ChevronRight-B_f9hb86.js";import{T as Ne}from"./html-title-s4xKUvYC.js";import{w as Ee,P as jr}from"./permission-BIUOpX2u.js";import{u as pt}from"./index-Mwj3mzuq.js";import{D as _r}from"./Done-BrXgYrm-.js";import{R as wr,S as M}from"./collapse-D_6eVE_q.js";import{A as kr,a as At}from"./Autocomplete-BaEPlYLx.js";import{C as Sr,R as Cr,P as Rr}from"./rotate-session-key-95XBCkHR.js";import{u as oe}from"./blocklet-vLRH388n.js";import{C as $r}from"./click-to-copy-D5YohLRv.js";import{u as Ve}from"./team-CapU231S.js";import{v as Yt}from"./index-CDjkuvXP.js";import{g as Ar}from"./chain-DS4Hjfmr.js";import{V as Or,d as Pr}from"./status-DGosxj_C.js";import{S as pe}from"./Switch-CEsPeHy7.js";import{B as Tr}from"./index-0y0GUu_H.js";import{y as Ir}from"./index-DmfWG7ck.js";import{I as Er,J as Dr,K as Lr,L as qr}from"./index-CN0dYmBa.js";import{u as xe,C as H,b as Ot}from"./index.esm-BIUDl4l6.js";import{S as He,u as Mr}from"./switch-control-DJmzxMX-.js";import{D as Pt,R as Xt,a as Qt}from"./url-evaluation-LJajQhtP.js";import{A as Tt}from"./Add-S-3I84b8.js";import{S as zr}from"./Slider-DMeR2md5.js";import{H as Ue}from"./index-1LmYeNoL.js";import{l as Hr}from"./index-CL-6WnAm.js";import{u as es}from"./use-mobile-BuUEnGf6.js";import{S as Ge}from"./simple-select-DQnMwaJg.js";import{G as Br}from"./actions-D4Kz7IAL.js";import{C as Fr}from"./CardContent-F-Sbai2s.js";import"./omit-DAMRcdLY.js";import"./index-C7WxFtB9.js";import"./edit.svg-1dKJigcF.js";import"./ArrowDropDown-IcntJnxN.js";import"./ButtonGroup-Bb6jDsD1.js";import"./getValidReactChildren-DJQKILMh.js";import"./index-D3La8IYq.js";import"./iframe-D0ox4iMz.js";import"./ListSubheader-YCstldBv.js";import"./ErrorOutline-cbP6hbrl.js";import"./redux-DfszZyTl.js";import"./typeof-QjJsDpFa.js";import"./visuallyHidden-Dan1xhjv.js";import"./FilterList-CETwaOot.js";import"./CSSTransition-wxeeFOKf.js";import"./emotion-cache.browser.esm-BkCEErJn.js";import"./depsEqual-CfdoQRpO.js";import"./TableSearch-Lg4M-8KA.js";import"./Search-hhDB6YL9.js";import"./Clear-v5WhrN0k.js";import"./MoreVert-C716pe1M.js";import"./useLocalStorage-DAbLYpB1.js";import"./get-safe-url-CVrrblG0.js";const ts=de([e.jsx("path",{d:"M21 7.28V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-2.28c.59-.35 1-.98 1-1.72V9c0-.74-.41-1.37-1-1.72M20 9v6h-7V9zM5 19V5h14v2h-6c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h6v2z"},"0"),e.jsx("circle",{cx:"16",cy:"12",r:"1.5"},"1")]),Nr=de([e.jsx("path",{d:"M19 5v14H5V5zm0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2"},"0"),e.jsx("path",{d:"M14 17H7v-2h7zm3-4H7v-2h10zm0-4H7V7h10z"},"1")]),Zr=de(e.jsx("path",{d:"M21 8V7l-3 2-3-2v1l3 2zm1-5H2C.9 3 0 3.9 0 5v14c0 1.1.9 2 2 2h20c1.1 0 1.99-.9 1.99-2L24 5c0-1.1-.9-2-2-2M8 6c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3m6 12H2v-1c0-2 4-3.1 6-3.1s6 1.1 6 3.1zm8-6h-8V6h8z"})),Vr=de(e.jsx("path",{d:"M24 9v2h-6V9zM8 4C5.79 4 4 5.79 4 8s1.79 4 4 4 4-1.79 4-4-1.79-4-4-4m0 9c-2.67 0-8 1.34-8 4v3h16v-3c0-2.66-5.33-4-8-4m4.51-8.95C13.43 5.11 14 6.49 14 8s-.57 2.89-1.49 3.95C14.47 11.7 16 10.04 16 8s-1.53-3.7-3.49-3.95m4.02 9.78C17.42 14.66 18 15.7 18 17v3h2v-3c0-1.45-1.59-2.51-3.47-3.17"})),Ur=de(e.jsx("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3"})),Wr=de(e.jsx("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3"})),lt=de(e.jsx("path",{d:"M18 8h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V10c0-1.1-.9-2-2-2m-6 9c-1.1 0-2-.9-2-2s.9-2 2-2 2 .9 2 2-.9 2-2 2m3.1-9H8.9V6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1z"})),Jr=de([e.jsx("path",{d:"M18 11c.7 0 1.37.1 2 .29V10c0-1.1-.9-2-2-2h-1V6c0-2.76-2.24-5-5-5S7 3.24 7 6v2H6c-1.1 0-2 .9-2 2v10c0 1.1.9 2 2 2h6.26c-.79-1.13-1.26-2.51-1.26-4 0-3.87 3.13-7 7-7M8.9 6c0-1.71 1.39-3.1 3.1-3.1s3.1 1.39 3.1 3.1v2H8.9z"},"0"),e.jsx("path",{d:"M18 13c-2.76 0-5 2.24-5 5s2.24 5 5 5 5-2.24 5-5-2.24-5-5-5m0 2c.83 0 1.5.67 1.5 1.5S18.83 18 18 18s-1.5-.67-1.5-1.5.67-1.5 1.5-1.5m0 6c-1.03 0-1.94-.52-2.48-1.32.73-.42 1.57-.68 2.48-.68s1.75.26 2.48.68c-.54.8-1.45 1.32-2.48 1.32"},"1")]),Kr=de(e.jsx("path",{d:"M11 7 9.6 8.4l2.6 2.6H2v2h10.2l-2.6 2.6L11 17l5-5zm9 12h-8v2h8c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2h-8v2h8z"})),Gr=de(e.jsx("path",{d:"M12 22c1.1 0 2-.9 2-2h-4c0 1.1.9 2 2 2m6-6v-5c0-3.07-1.63-5.64-4.5-6.32V4c0-.83-.67-1.5-1.5-1.5s-1.5.67-1.5 1.5v.68C7.64 5.36 6 7.92 6 11v5l-2 2v1h16v-1zm-2 1H8v-6c0-2.48 1.51-4.5 4-4.5s4 2.02 4 4.5z"})),ss=de(e.jsx("path",{d:"M11.99 2C6.47 2 2 6.48 2 12s4.47 10 9.99 10C17.52 22 22 17.52 22 12S17.52 2 11.99 2m4.24 16L12 15.45 7.77 18l1.12-4.81-3.73-3.23 4.92-.42L12 5l1.92 4.53 4.92.42-3.73 3.23z"})),Yr=de(e.jsx("path",{d:"M3 18c0 .55.45 1 1 1h5v-2H4c-.55 0-1 .45-1 1M3 6c0 .55.45 1 1 1h9V5H4c-.55 0-1 .45-1 1m10 14v-1h7c.55 0 1-.45 1-1s-.45-1-1-1h-7v-1c0-.55-.45-1-1-1s-1 .45-1 1v4c0 .55.45 1 1 1s1-.45 1-1M7 10v1H4c-.55 0-1 .45-1 1s.45 1 1 1h3v1c0 .55.45 1 1 1s1-.45 1-1v-4c0-.55-.45-1-1-1s-1 .45-1 1m14 2c0-.55-.45-1-1-1h-9v2h9c.55 0 1-.45 1-1m-5-3c.55 0 1-.45 1-1V7h3c.55 0 1-.45 1-1s-.45-1-1-1h-3V4c0-.55-.45-1-1-1s-1 .45-1 1v4c0 .55.45 1 1 1"})),Xr=de(e.jsx("path",{d:"M16 13c3.09-2.81 6-5.44 6-7.7C22 3.45 20.55 2 18.7 2c-1.04 0-2.05.49-2.7 1.25C15.34 2.49 14.34 2 13.3 2 11.45 2 10 3.45 10 5.3c0 2.26 2.91 4.89 6 7.7m-2.7-9c.44 0 .89.21 1.18.55L16 6.34l1.52-1.79c.29-.34.74-.55 1.18-.55.74 0 1.3.56 1.3 1.3 0 1.12-2.04 3.17-4 4.99-1.96-1.82-4-3.88-4-4.99 0-.74.56-1.3 1.3-1.3M19 16h-2c0-1.2-.75-2.28-1.87-2.7L8.97 11H1v11h6v-1.44l7 1.94 8-2.5v-1c0-1.66-1.34-3-3-3M3 20v-7h2v7zm10.97.41L7 18.48V13h1.61l5.82 2.17c.34.13.57.46.57.83 0 0-1.99-.05-2.3-.15l-2.38-.79-.63 1.9 2.38.79c.51.17 1.04.26 1.58.26H19c.39 0 .74.23.9.56z"}));var Qr=Array.prototype,It=Qr.splice;function en(x,C,$,R){var _=Ts,b=-1,m=C.length,r=x;for(x===C&&(C=Ps(C));++b<m;)for(var p=0,f=C[b],h=f;(p=_(r,h,p))>-1;)r!==x&&It.call(r,p,1),It.call(x,p,1);return x}function tn(x,C){return x&&x.length&&C&&C.length?en(x,C):x}var sn=Is(tn);const rn={width:24,height:24,body:'<path fill="currentColor" d="M4.975 15q-.425 0-.7-.288T4 14q0-.425.288-.713T5 13h14.025q.425 0 .7.288T20 14q0 .425-.288.713T19 15H4.975Zm0 4q-.425 0-.7-.288T4 18q0-.425.288-.713T5 17h14.025q.425 0 .7.288T20 18q0 .425-.288.713T19 19H4.975Zm0-8q-.425 0-.7-.288T4 10q0-.425.288-.713T5 9h14.025q.425 0 .7.288T20 10q0 .425-.288.713T19 11H4.975Zm0-4q-.425 0-.7-.288T4 6q0-.425.288-.713T5 5h14.025q.425 0 .7.288T20 6q0 .425-.288.713T19 7H4.975Z"/>'};function rs({label:x="",disabled:C=!1,required:$=!1,initialValue:R="",onChange:_=()=>{},style:b={},onSubmit:m=()=>{},triggers:r=[],options:p=[],formatterBeforeSubmit:f=a=>a.join(","),helperText:h="",placeholder:t="",renderImage:l=()=>null,renderLabel:o=()=>"",filterKeys:n=["name"],noEmpty:s=!1,...c}){const[a,i]=L.useState(!1),[u,g]=L.useState(!1),[y,k]=L.useState(""),w=L.useRef(null),[d,v]=L.useState(R),[j,S]=L.useState(d),O=L.useMemo(()=>{if(!p)return{};const q={};return p.forEach(z=>{q[z.code]=z}),q},[p]),P=()=>{if(!p)return[];if(!y)return p.map(z=>z.code);const q=new RegExp(y.toLowerCase());return p.filter(z=>{for(let F=0;F<n.length;F++){const V=n[F];if(q.test(z[V]?.toLowerCase()))return!0}return!1}).map(z=>z.code)},D=async()=>{g(!0);try{await m(typeof f=="function"?f(j):j)===!1?S(d):s&&!j.length?(S(R),v(R)):(S(j),v(j))}catch{S(d)}finally{g(!1),i(!1)}},I=(q,z)=>{if(!Array.isArray(z)){S([]),_([]);return}const F=z.filter(V=>O[V]);if(!F.length){S([]),_([]);return}S(F),_(F)},B=q=>{q.stopPropagation(),i(!0),setTimeout(()=>{if(w.current){const z=w.current.querySelector("input");z&&z.focus()}},500)},N=a?e.jsx(kr,{ref:w,options:p,value:j,onChange:I,inputValue:y,onInputChange:(q,z)=>{k(z)},fullWidth:!0,multiple:!0,variant:"outlined",margin:"dense",filterOptions:P,getOptionLabel:q=>O[q]?.name,renderInput:q=>e.jsx(U,{...q,label:"",placeholder:t}),renderOption:(q,z)=>{const F=j.indexOf(z)!==-1;return L.createElement(nn,{component:"li",...q,key:z},l(O[z]||{}),e.jsx(A,{sx:{"& > img":{mr:2,flexShrink:0}},style:{flex:1,fontWeight:F?"700":"normal"},children:o(z,O[z])||O[z]?.name}),e.jsx(A,{component:wt,sx:{opacity:.5,width:18,height:18},style:{visibility:F?"visible":"hidden"}}))},...c,slots:{popper:an}}):e.jsx(A,{className:"form-item-input slot",onClick:B,style:{whiteSpace:"pre-wrap",cursor:"text"},sx:{px:1},children:j.filter(q=>p.some(z=>z.code===q)).map(q=>e.jsx(ht,{label:p.find(z=>z.code===q).name,style:{marginRight:8},size:"small"},q))});return e.jsx(gr,{className:"form",style:b,children:e.jsxs(A,{className:"form-item",children:[e.jsxs(A,{className:"form-item-label",children:[x,$&&e.jsx(wr,{})]}),e.jsxs(A,{className:"form-item-body",children:[e.jsx(A,{className:"form-item-input",children:N}),a?e.jsx(A,{className:"form-item-action",children:e.jsxs(e.Fragment,{children:[e.jsx(ne,{"data-cy":"schema-form-item-confirm",onClick:D,disabled:C||u,size:"large",children:u?e.jsx(Ie,{size:24}):e.jsx(_r,{})}),e.jsx(ne,{"data-cy":"schema-form-item-cancel",onClick:()=>{S(d),i(!1)},disabled:C||u,size:"large",children:e.jsx(wt,{})})]})}):null]}),a&&h&&e.jsx(zt,{children:h})]})})}rs.propTypes={style:T.object,onSubmit:T.func,onChange:T.func,label:T.string,initialValue:T.string,required:T.bool,disabled:T.bool,triggers:T.array,options:T.array,helperText:T.string,formatterBeforeSubmit:T.func,placeholder:T.string,renderImage:T.func,filterKeys:T.arrayOf(T.string),noEmpty:T.bool,renderLabel:T.func};const nn=ve.div`
2
2
  display: flex;
3
3
  justify-content: space-between;
4
4
  align-items: center;
@@ -79,7 +79,7 @@ ${r("blocklet.config.logoDesc",{width:512,height:512,maxSize:5})}`,children:e.js
79
79
  .form-item {
80
80
  margin-top: 0;
81
81
  }
82
- `,xt={width:24,height:24,body:'<path fill="currentColor" d="M5 4v16V4v5v-5Zm3 10h2.675q.275-.575.638-1.075t.812-.925H8q-.425 0-.713.288T7 13q0 .425.288.713T8 14Zm0 4h2.075Q10 17.5 10 17t.075-1H8q-.425 0-.713.288T7 17q0 .425.288.713T8 18Zm-3 4q-.825 0-1.413-.588T3 20V4q0-.825.588-1.413T5 2h7.175q.4 0 .763.15t.637.425l4.85 4.85q.275.275.425.638t.15.762V10.3q-.475-.15-.975-.225T17 10V9h-4q-.425 0-.713-.288T12 8V4H5v16h5.675q.275.575.638 1.075t.812.925H5Zm12-10q2.075 0 3.538 1.463T22 17q0 2.075-1.463 3.538T17 22q-2.075 0-3.538-1.463T12 17q0-2.075 1.463-3.538T17 12Zm0 8q.275 0 .463-.188t.187-.462q0-.275-.187-.463T17 18.7q-.275 0-.463.188t-.187.462q0 .275.188.463T17 20Zm0-6q-.475 0-.875.238t-.65.637q-.1.15-.025.313t.25.237q.15.075.3 0t.275-.2q.125-.175.313-.275t.412-.1q.325 0 .563.213t.237.537q0 .275-.15.463t-.35.387q-.15.15-.313.3t-.287.35q-.075.15-.113.313t-.037.337q0 .225.125.413t.325.187q.2 0 .325-.15t.125-.35q0-.275.15-.488t.35-.412q.3-.275.525-.613t.225-.737q0-.675-.5-1.138T17 14Z"/>'},Xe={enabled:!1,domain:"",clientId:"",clientSecret:""};function Rn(){const{api:x}=re(),{blocklet:C}=oe(),{t:$,locale:R}=ae(),_=C?.meta?.did,b=Object.assign({...Xe},C?.settings?.oauth?.auth0||{}),{handleSubmit:m,control:r,formState:p,watch:f,reset:h}=xe({defaultValues:Re(b,Object.keys(Xe))}),t=f("enabled"),l=E(async i=>{try{const{blocklet:u}=await x.configOAuth({input:{did:_,oauth:JSON.stringify({auth0:i})}}),g=Object.assign({...Xe},u?.settings?.oauth?.auth0||{});h(g),Z.success($("oauth.saveSuccess"))}catch(u){Z.error(u.message||$("oauth.saveFailed"))}}),o=E(i=>i?.trim()?!0:$("oauth.auth0.domainDescription")),n=E(i=>i?.trim()?!0:$("oauth.auth0.clientIdDescription")),s=E(i=>i?.trim()?!0:$("oauth.auth0.clientSecretDescription")),c=E(()=>!0),a=ge(()=>R==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-auth0":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-auth0",[R]);return e.jsx(A,{children:e.jsxs("form",{onSubmit:m(l),disabled:!0,children:[e.jsx(M,{title:e.jsxs(A,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:$("oauth.auth0.enable")}),e.jsx(X,{title:$("oauth.viewDocument"),children:e.jsx(A,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:a,target:"_blank",rel:"noreferrer",children:e.jsx(Q,{icon:xt,fontSize:20})})})]}),mb:2.5,children:e.jsx(H,{name:"enabled",control:r,render:({field:i})=>e.jsx(K,{control:e.jsx(He,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(M,{title:$("oauth.auth0.domain"),children:e.jsx(H,{name:"domain",control:r,rules:{validate:t?o:c},render:({field:i})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...i,size:"small",label:$("oauth.auth0.domain"),error:!!p.errors[i.name],helperText:p.errors[i.name]?.message||" ",disabled:!t})})})}),e.jsx(M,{title:$("oauth.auth0.clientId"),children:e.jsx(H,{name:"clientId",control:r,rules:{validate:t?n:c},render:({field:i})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...i,size:"small",label:$("oauth.auth0.clientId"),error:!!p.errors[i.name],helperText:p.errors[i.name]?.message||" ",disabled:!t})})})}),e.jsx(M,{title:$("oauth.auth0.clientSecret"),children:e.jsx(H,{name:"clientSecret",control:r,rules:{validate:t?s:c},render:({field:i})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...i,size:"small",type:"password",label:$("oauth.auth0.clientSecret"),error:!!p.errors[i.name],helperText:p.errors[i.name]?.message||" ",disabled:!t})})})}),e.jsx(Y,{type:"submit",variant:"contained",onSubmit:m(l),disabled:!p.isDirty,children:$("oauth.save")})]})})}const Qe={enabled:!1,clientId:"",clientSecret:""};function $n(){const{api:x}=re(),{blocklet:C}=oe(),{t:$,locale:R}=ae(),_=C?.meta?.did,b=Object.assign({...Qe},C?.settings?.oauth?.github||{}),{handleSubmit:m,control:r,formState:p,watch:f,reset:h}=xe({defaultValues:Re(b,Object.keys(Qe))}),t=f("enabled"),l=E(async a=>{try{const{blocklet:i}=await x.configOAuth({input:{did:_,oauth:JSON.stringify({github:a})}}),u=Object.assign({...Qe},i?.settings?.oauth?.github||{});h(u),Z.success($("oauth.saveSuccess"))}catch(i){Z.error(i.message||$("oauth.saveFailed"))}}),o=E(a=>a?.trim()?!0:$("oauth.github.clientIdDescription")),n=E(a=>a?.trim()?!0:$("oauth.github.clientSecretDescription")),s=E(()=>!0),c=ge(()=>R==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-github":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-github",[R]);return e.jsx(A,{children:e.jsxs("form",{onSubmit:m(l),disabled:!0,children:[e.jsx(M,{title:e.jsxs(A,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:$("oauth.github.enable")}),e.jsx(X,{title:$("oauth.viewDocument"),children:e.jsx(A,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:c,target:"_blank",rel:"noreferrer",children:e.jsx(Q,{icon:xt,fontSize:20})})})]}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(H,{name:"enabled",control:r,sx:{alignItems:"center"},render:({field:a})=>e.jsx(K,{control:e.jsx(He,{sx:{ml:1},size:"small",checked:a.value,...a})})})}),e.jsx(M,{title:$("oauth.github.clientId"),children:e.jsx(H,{name:"clientId",control:r,rules:{validate:t?o:s},render:({field:a})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...a,size:"small",label:$("oauth.github.clientId"),error:!!p.errors[a.name],helperText:p.errors[a.name]?.message||" ",disabled:!t})})})}),e.jsx(M,{title:$("oauth.github.clientSecret"),children:e.jsx(H,{name:"clientSecret",control:r,rules:{validate:t?n:s},render:({field:a})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...a,size:"small",type:"password",label:$("oauth.github.clientSecret"),error:!!p.errors[a.name],helperText:p.errors[a.name]?.message||" ",disabled:!t})})})}),e.jsx(Y,{type:"submit",variant:"contained",onSubmit:m(l),disabled:!p.isDirty,children:$("oauth.save")})]})})}const et={enabled:!1,clientId:"",clientSecret:""};function An(){const{api:x}=re(),{blocklet:C}=oe(),{t:$,locale:R}=ae(),_=C?.meta?.did,b=Object.assign({...et},C?.settings?.oauth?.google||{}),{handleSubmit:m,control:r,formState:p,watch:f,reset:h}=xe({defaultValues:Re(b,Object.keys(et))}),t=f("enabled"),l=E(async a=>{try{const{blocklet:i}=await x.configOAuth({input:{did:_,oauth:JSON.stringify({google:a})}}),u=Object.assign({...et},i?.settings?.oauth?.google||{});h(u),Z.success($("oauth.saveSuccess"))}catch(i){Z.error(i.message||$("oauth.saveFailed"))}}),o=E(a=>a?.trim()?!0:$("oauth.google.clientIdDescription")),n=E(a=>a?.trim()?!0:$("oauth.google.clientSecretDescription")),s=E(()=>!0),c=ge(()=>R==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-google":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-google",[R]);return e.jsx(A,{children:e.jsxs("form",{onSubmit:m(l),disabled:!0,children:[e.jsx(M,{title:e.jsxs(A,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:$("oauth.google.enable")}),e.jsx(X,{title:$("oauth.viewDocument"),children:e.jsx(A,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:c,target:"_blank",rel:"noreferrer",children:e.jsx(Q,{icon:xt,fontSize:20})})})]}),mb:2.5,children:e.jsx(H,{name:"enabled",control:r,render:({field:a})=>e.jsx(K,{control:e.jsx(He,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(M,{title:$("oauth.google.clientId"),children:e.jsx(H,{name:"clientId",control:r,rules:{validate:t?o:s},render:({field:a})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...a,size:"small",label:$("oauth.google.clientId"),error:!!p.errors[a.name],helperText:p.errors[a.name]?.message||" ",disabled:!t})})})}),e.jsx(M,{title:$("oauth.google.clientSecret"),children:e.jsx(H,{name:"clientSecret",control:r,rules:{validate:t?n:s},render:({field:a})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...a,size:"small",type:"password",label:$("oauth.google.clientSecret"),error:!!p.errors[a.name],helperText:p.errors[a.name]?.message||" ",disabled:!t})})})}),e.jsx(Y,{type:"submit",variant:"contained",onSubmit:m(l),disabled:!p.isDirty,children:$("oauth.save")})]})})}const tt={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function On(){const{api:x}=re(),{blocklet:C}=oe(),{t:$}=ae(),R=C?.meta?.did,_=Object.assign({...tt},C?.settings?.oauth?.apple||{}),{handleSubmit:b,control:m,formState:r,watch:p,reset:f}=xe({defaultValues:Re(_,Object.keys(tt))}),h=p("enabled"),t=E(async i=>{try{const{blocklet:u}=await x.configOAuth({input:{did:R,oauth:JSON.stringify({apple:i})}}),g=Object.assign({...tt},u?.settings?.oauth?.apple||{});f(g),Z.success($("oauth.saveSuccess"))}catch(u){Z.error(u.message||$("oauth.saveFailed"))}}),l=E(i=>i?.trim()?!0:$("oauth.apple.teamIdDescription")),o=E(i=>i?.trim()?!0:$("oauth.apple.serviceIdDescription")),n=E(i=>i?.trim()?!0:$("oauth.apple.keyIdDescription")),s=E(i=>i?.trim()?!0:$("oauth.apple.authKeyDescription")),c=E(i=>i?.trim()?!0:$("oauth.apple.bundleIdDescription")),a=E(()=>!0);return e.jsx(A,{children:e.jsxs("form",{onSubmit:b(t),disabled:!0,children:[e.jsx(M,{title:$("oauth.apple.enable"),mb:2.5,children:e.jsx(H,{name:"enabled",control:m,render:({field:i})=>e.jsx(K,{control:e.jsx(He,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(M,{title:$("oauth.apple.teamId"),children:e.jsx(H,{name:"teamId",control:m,rules:{validate:h?l:a},render:({field:i})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...i,size:"small",label:$("oauth.apple.teamId"),error:!!r.errors[i.name],helperText:r.errors[i.name]?.message||" ",disabled:!h})})})}),e.jsx(M,{title:$("oauth.apple.bundleId"),children:e.jsx(H,{name:"bundleId",control:m,rules:{validate:h?c:a},render:({field:i})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...i,size:"small",label:$("oauth.apple.bundleId"),error:!!r.errors[i.name],helperText:r.errors[i.name]?.message||" ",disabled:!h})})})}),e.jsx(M,{title:$("oauth.apple.serviceId"),children:e.jsx(H,{name:"serviceId",control:m,rules:{validate:h?o:a},render:({field:i})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...i,size:"small",label:$("oauth.apple.serviceId"),error:!!r.errors[i.name],helperText:r.errors[i.name]?.message||" ",disabled:!h})})})}),e.jsx(M,{title:$("oauth.apple.keyId"),children:e.jsx(H,{name:"keyId",control:m,rules:{validate:h?n:a},render:({field:i})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...i,size:"small",label:$("oauth.apple.keyId"),error:!!r.errors[i.name],helperText:r.errors[i.name]?.message||" ",disabled:!h})})})}),e.jsx(M,{title:$("oauth.apple.authKey"),children:e.jsx(H,{name:"authKey",control:m,rules:{validate:h?s:a},render:({field:i})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...i,size:"small",type:"password",label:$("oauth.apple.authKey"),multiline:!0,rows:4,error:!!r.errors[i.name],helperText:r.errors[i.name]?.message||" ",disabled:!h})})})}),e.jsx(Y,{type:"submit",variant:"contained",onSubmit:b(t),disabled:!r.isDirty,children:$("oauth.save")})]})})}const st={enabled:!1,clientId:"",clientSecret:""};function Pn(){const{api:x}=re(),{blocklet:C}=oe(),{t:$}=ae(),R=C?.meta?.did,_=Object.assign({...st},C?.settings?.oauth?.twitter||{}),{handleSubmit:b,control:m,formState:r,watch:p,reset:f}=xe({defaultValues:Re(_,Object.keys(st))}),h=p("enabled"),t=E(async s=>{try{const{blocklet:c}=await x.configOAuth({input:{did:R,oauth:JSON.stringify({twitter:s})}}),a=Object.assign({...st},c?.settings?.oauth?.twitter||{});f(a),Z.success($("oauth.saveSuccess"))}catch(c){Z.error(c.message||$("oauth.saveFailed"))}}),l=E(s=>s?.trim()?!0:$("oauth.twitter.clientIdDescription")),o=E(s=>s?.trim()?!0:$("oauth.twitter.clientSecretDescription")),n=E(()=>!0);return e.jsx(A,{children:e.jsxs("form",{onSubmit:b(t),disabled:!0,children:[e.jsx(M,{title:e.jsx(A,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:$("oauth.twitter.enable")})}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(H,{name:"enabled",control:m,sx:{alignItems:"center"},render:({field:s})=>e.jsx(K,{control:e.jsx(He,{sx:{ml:1},size:"small",checked:s.value,...s})})})}),e.jsx(M,{title:$("oauth.twitter.clientId"),children:e.jsx(H,{name:"clientId",control:m,rules:{validate:h?l:n},render:({field:s})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...s,size:"small",label:$("oauth.twitter.clientId"),error:!!r.errors[s.name],helperText:r.errors[s.name]?.message||" ",disabled:!h})})})}),e.jsx(M,{title:$("oauth.twitter.clientSecret"),children:e.jsx(H,{name:"clientSecret",control:m,rules:{validate:h?o:n},render:({field:s})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...s,size:"small",type:"password",label:$("oauth.twitter.clientSecret"),error:!!r.errors[s.name],helperText:r.errors[s.name]?.message||" ",disabled:!h})})})}),e.jsx(Y,{type:"submit",variant:"contained",onSubmit:b(t),disabled:!r.isDirty,children:$("oauth.save")})]})})}const Tn={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function hs({id:x,title:C,children:$,index:R,onMove:_,defaultExpand:b=!1,onEnd:m,icon:r=null}){const[p,f]=L.useState(b),h=L.useRef(null),t=L.useRef(null),[{handlerId:l},o]=Er({accept:"dragItem",collect(i){return{handlerId:i.getHandlerId()}},hover(i,u){if(!h.current)return;const g=i.index,y=R;if(g===y)return;const k=h.current?.getBoundingClientRect(),w=t.current?.getBoundingClientRect(),d=(w.bottom-w.top)/2,j=u.getClientOffset().y-k.top;g<y&&j<d||g>y&&j>d||(_(g,y),i.index=y)}}),[{isDragging:n},s]=Dr({item:{index:R,type:"dragItem"},collect:i=>({isDragging:i.isDragging()}),end:m});s(t),o(h);const c=n?.5:1,a=E(i=>{i.preventDefault(),i.stopPropagation(),f(!p)});return e.jsxs(A,{ref:h,children:[e.jsxs(A,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:t,"data-handler-id":l,children:[e.jsxs(A,{sx:{py:2,px:1,opacity:c,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:a,children:[e.jsx(A,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(Q,{fontSize:20,icon:Tn})}),e.jsx(A,{sx:{display:"flex",alignItems:"center",flexShrink:0,mr:.5,transform:"translateY(-1px)"},children:r}),e.jsx(J,{sx:{flex:1},children:C}),e.jsx(ne,{size:"small",sx:{pointerEvents:"auto",transform:p?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(Q,{icon:Pr,style:{transform:"scale(1.5)"}})})]}),e.jsx(ee,{})]}),e.jsx(A,{sx:{pl:4,py:2.5,display:p?"block":"none"},children:$})]})}hs.propTypes={title:T.string.isRequired,id:T.string.isRequired,children:T.node.isRequired,index:T.number.isRequired,onMove:T.func.isRequired,onEnd:T.func.isRequired,defaultExpand:T.bool,icon:T.any};const In=[{name:"github",title:"GitHub",icon:e.jsx(qe,{provider:"github",sx:{width:20,height:20}}),component:e.jsx($n,{})},{name:"google",title:"Google",icon:e.jsx(qe,{provider:"google",sx:{width:20,height:20}}),component:e.jsx(An,{})},{name:"apple",title:"Apple",icon:e.jsx(qe,{provider:"apple",sx:{width:20,height:20}}),component:e.jsx(On,{})},{name:"twitter",title:"Twitter",icon:e.jsx(qe,{provider:"twitter",sx:{width:20,height:20}}),component:e.jsx(Pn,{})},{name:"auth0",title:"Auth0",icon:e.jsx(qe,{provider:"auth0",sx:{width:20,height:20}}),component:e.jsx(Rn,{})}],En=["github","google","apple","twitter","auth0"];function Dn(){const{api:x}=re(),{blocklet:C}=oe(),$=C?.meta?.did,R=C?.settings?.oauth||{},_=Object.keys(R).sort((t,l)=>R[t]?.order!==void 0&&R[l]?.order!==void 0?R[t].order-R[l].order:R[t]?.order!==void 0?-1:1);for(const t of En)_.includes(t)||_.push(t);const b=ye(_.reduce((t,l,o)=>Object.assign(t,{[l]:o}),{})),m=ge(()=>{const t=[...In];return t.sort((l,o)=>b[l.name]-b[o.name]),t.map(l=>({...l,enabled:R[l.name]?.enabled??!1}))},[b.auth0,b.github,b.google]),r={};typeof window<"u"&&(r.context=window);const p=E(async t=>{const l={};Object.keys(t).forEach(o=>{l[o]={order:t[o]}}),await x.configOAuth({input:{did:$,oauth:JSON.stringify(l)}})}),f=E((t,l)=>{const o=m[t],n=m[l];b[o.name]=l,b[n.name]=t}),h=E(async()=>{await p(b)});return e.jsx(A,{sx:{".section-left":{width:"180px"}},children:e.jsx(Lr,{backend:qr,...r,children:m.map((t,l)=>e.jsx(hs,{index:l,id:t.name,title:t.title,icon:t.icon,onMove:f,onEnd:h,defaultExpand:t.enabled,children:t.component},t.name))})})}const Se={ttl:W.SESSION_TTL,cacheTtl:W.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]},enableBlacklist:!1};function he(x){return e.jsx(Mr,{...x,sx:{transform:"scale(0.75)"}})}function rt(x,C=!1){const $=C?x.ttl*86400:x.ttl/86400;return{...x,ttl:$}}function Ln(){const{api:x}=re(),{blocklet:C}=oe(),$=C?.meta?.did,R=er({},Se,C?.settings?.session||{});Je(R.ttl)&&(R.ttl=Se.ttl),Je(R.cacheTtl)&&(R.cacheTtl=Se.cacheTtl),R.phone||(R.phone=Se.phone),R.email||(R.email=Se.email),Je(R.enableBlacklist)&&(R.enableBlacklist=Se.enableBlacklist);const{handleSubmit:_,control:b,formState:m,reset:r,watch:p}=xe({defaultValues:Re(rt(R),["ttl","cacheTtl","email","phone","enableBlacklist"])}),{t:f}=ae(),h=p("email.enabled"),t=p("phone.enabled"),l=p("email.enableDomainBlackList"),o=p("email.enableDomainWhiteList"),{fields:n,append:s,remove:c}=Ot({control:b,name:"email.domainBlackList"}),{fields:a,append:i,remove:u}=Ot({control:b,name:"email.domainWhiteList"}),g=E(async y=>{try{const{blocklet:k}=await x.updateAppSessionConfig({input:{did:$,config:Ce(rt(y,!0),["phone"])}}),w=Object.assign({},Se,Re(k?.settings?.session||{},["ttl","cacheTtl","email","phone","enableBlacklist"]));r(rt(w)),Z.success(f("common.configSuccess"))}catch(k){Z.error(k.message)}});return e.jsx(qn,{onSubmit:_(g),children:e.jsxs(ie,{direction:"column",sx:{gap:6},children:[e.jsxs(A,{children:[e.jsxs(A,{children:[e.jsx(J,{variant:"h6",sx:{fontWeight:600},children:f("blocklet.config.session.profile")}),e.jsx(A,{component:ee,sx:{my:3}})]}),e.jsxs(ie,{sx:{gap:2},children:[e.jsx(M,{title:f("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(he,{disabled:!0,checked:!0})})}),e.jsx(M,{title:f("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(he,{disabled:!0,checked:!0})})}),e.jsx(M,{title:f("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"email.enabled",control:b,render:({field:y})=>e.jsx(he,{...y,checked:y.value})})})}),h&&e.jsxs(ie,{direction:"column",sx:{ml:2},children:[e.jsx(M,{title:f("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"email.requireVerified",control:b,render:({field:y})=>e.jsx(K,{sx:{mt:1},control:e.jsx(he,{...y,checked:y.value})})})})}),e.jsx(M,{title:f("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"email.requireUnique",control:b,render:({field:y})=>e.jsx(K,{sx:{mt:1},control:e.jsx(he,{...y,checked:y.value})})})})}),e.jsx(M,{title:f("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"email.trustOauthProviders",control:b,render:({field:y})=>e.jsx(K,{sx:{mt:1},control:e.jsx(he,{...y,checked:y.value})})})})}),e.jsx(M,{title:f("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"email.enableDomainBlackList",control:b,render:({field:y})=>e.jsx(K,{sx:{mt:1},control:e.jsx(he,{...y,checked:y.value})})})})}),l&&e.jsxs(A,{children:[n.map((y,k)=>e.jsxs(ie,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(H,{name:`email.domainBlackList.${k}`,control:b,render:w=>e.jsx(U,{...w.field,size:"small",fullWidth:!0})}),e.jsx(ne,{onClick:()=>c(k),children:e.jsx(Pt,{})})]},y.id)),e.jsx(Y,{startIcon:e.jsx(Tt,{}),onClick:()=>s(""),children:f("blocklet.config.session.addDomain")})]}),e.jsx(M,{title:f("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"email.enableDomainWhiteList",control:b,render:({field:y})=>e.jsx(K,{sx:{mt:1},control:e.jsx(he,{...y,checked:y.value})})})})}),o&&e.jsxs(A,{children:[a.map((y,k)=>e.jsxs(ie,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(H,{name:`email.domainWhiteList.${k}`,control:b,render:w=>e.jsx(U,{...w.field,size:"small",fullWidth:!0})}),e.jsx(ne,{onClick:()=>u(k),children:e.jsx(Pt,{})})]},y.id)),e.jsx(Y,{startIcon:e.jsx(Tt,{}),onClick:()=>i(""),children:f("blocklet.config.session.addDomain")})]})]}),e.jsxs(A,{sx:{display:"none"},children:[e.jsx(M,{title:f("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"phone.enabled",control:b,disabled:!0,render:({field:y})=>e.jsx(K,{sx:{mt:1},control:e.jsx(he,{...y,checked:y.value})})})})}),t&&e.jsxs(ie,{direction:"column",sx:{ml:2,mt:1},children:[e.jsx(M,{title:f("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"phone.requireVerified",control:b,render:({field:y})=>e.jsx(K,{control:e.jsx(he,{...y,checked:y.value})})})})}),e.jsx(M,{title:f("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"phone.requireUnique",control:b,render:({field:y})=>e.jsx(K,{control:e.jsx(he,{...y,checked:y.value})})})})})]})]})]})]}),e.jsxs(A,{children:[e.jsx(J,{variant:"h6",sx:{fontWeight:600},children:f("blocklet.config.session.period")}),e.jsx(A,{component:ee,sx:{my:3}}),e.jsx(ie,{direction:"column",spacing:2,children:e.jsx(H,{name:"ttl",control:b,rules:{min:1,max:30},render:({field:y})=>e.jsx(G,{fullWidth:!0,sx:{mb:2},children:e.jsx(M,{title:f("blocklet.config.session.ttl",{day:y.value}),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{width:"100%",maxWidth:500,px:1.5},children:e.jsx(zr,{...y,defaultValue:7,step:1,marks:[{value:1,label:f("blocklet.config.session.day",{day:1})},{value:7,label:f("blocklet.config.session.days",{day:7})},{value:14,label:f("blocklet.config.session.days",{day:14})},{value:21,label:f("blocklet.config.session.days",{day:21})},{value:30,label:f("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsxs(A,{children:[e.jsx(J,{variant:"h6",sx:{fontWeight:600},children:f("blocklet.config.session.experimentalSettings")}),e.jsx(A,{component:ee,sx:{my:3}}),e.jsx(ie,{direction:"column",spacing:2,children:e.jsx(M,{title:f("blocklet.config.session.enableBlacklist"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"enableBlacklist",control:b,render:({field:y})=>e.jsx(K,{sx:{mt:1},control:e.jsx(he,{...y,checked:y.value})})})})})})]}),e.jsx(A,{children:e.jsx(Y,{type:"submit",variant:"contained",disabled:!m.isDirty,children:f("oauth.save")})})]})})}const qn=ve.form`
82
+ `,xt={width:24,height:24,body:'<path fill="currentColor" d="M5 4v16V4v5v-5Zm3 10h2.675q.275-.575.638-1.075t.812-.925H8q-.425 0-.713.288T7 13q0 .425.288.713T8 14Zm0 4h2.075Q10 17.5 10 17t.075-1H8q-.425 0-.713.288T7 17q0 .425.288.713T8 18Zm-3 4q-.825 0-1.413-.588T3 20V4q0-.825.588-1.413T5 2h7.175q.4 0 .763.15t.637.425l4.85 4.85q.275.275.425.638t.15.762V10.3q-.475-.15-.975-.225T17 10V9h-4q-.425 0-.713-.288T12 8V4H5v16h5.675q.275.575.638 1.075t.812.925H5Zm12-10q2.075 0 3.538 1.463T22 17q0 2.075-1.463 3.538T17 22q-2.075 0-3.538-1.463T12 17q0-2.075 1.463-3.538T17 12Zm0 8q.275 0 .463-.188t.187-.462q0-.275-.187-.463T17 18.7q-.275 0-.463.188t-.187.462q0 .275.188.463T17 20Zm0-6q-.475 0-.875.238t-.65.637q-.1.15-.025.313t.25.237q.15.075.3 0t.275-.2q.125-.175.313-.275t.412-.1q.325 0 .563.213t.237.537q0 .275-.15.463t-.35.387q-.15.15-.313.3t-.287.35q-.075.15-.113.313t-.037.337q0 .225.125.413t.325.187q.2 0 .325-.15t.125-.35q0-.275.15-.488t.35-.412q.3-.275.525-.613t.225-.737q0-.675-.5-1.138T17 14Z"/>'},Xe={enabled:!1,domain:"",clientId:"",clientSecret:""};function Rn(){const{api:x}=re(),{blocklet:C}=oe(),{t:$,locale:R}=ae(),_=C?.meta?.did,b=Object.assign({...Xe},C?.settings?.oauth?.auth0||{}),{handleSubmit:m,control:r,formState:p,watch:f,reset:h}=xe({defaultValues:Re(b,Object.keys(Xe))}),t=f("enabled"),l=E(async i=>{try{const{blocklet:u}=await x.configOAuth({input:{did:_,oauth:JSON.stringify({auth0:i})}}),g=Object.assign({...Xe},u?.settings?.oauth?.auth0||{});h(g),Z.success($("oauth.saveSuccess"))}catch(u){Z.error(u.message||$("oauth.saveFailed"))}}),o=E(i=>i?.trim()?!0:$("oauth.auth0.domainDescription")),n=E(i=>i?.trim()?!0:$("oauth.auth0.clientIdDescription")),s=E(i=>i?.trim()?!0:$("oauth.auth0.clientSecretDescription")),c=E(()=>!0),a=ge(()=>R==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-auth0":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-auth0",[R]);return e.jsx(A,{children:e.jsxs("form",{onSubmit:m(l),disabled:!0,children:[e.jsx(M,{title:e.jsxs(A,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:$("oauth.auth0.enable")}),e.jsx(X,{title:$("oauth.viewDocument"),children:e.jsx(A,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:a,target:"_blank",rel:"noreferrer",children:e.jsx(Q,{icon:xt,fontSize:20})})})]}),mb:2.5,children:e.jsx(H,{name:"enabled",control:r,render:({field:i})=>e.jsx(K,{control:e.jsx(He,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(M,{title:$("oauth.auth0.domain"),children:e.jsx(H,{name:"domain",control:r,rules:{validate:t?o:c},render:({field:i})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...i,size:"small",label:$("oauth.auth0.domain"),error:!!p.errors[i.name],helperText:p.errors[i.name]?.message||" ",disabled:!t})})})}),e.jsx(M,{title:$("oauth.auth0.clientId"),children:e.jsx(H,{name:"clientId",control:r,rules:{validate:t?n:c},render:({field:i})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...i,size:"small",label:$("oauth.auth0.clientId"),error:!!p.errors[i.name],helperText:p.errors[i.name]?.message||" ",disabled:!t})})})}),e.jsx(M,{title:$("oauth.auth0.clientSecret"),children:e.jsx(H,{name:"clientSecret",control:r,rules:{validate:t?s:c},render:({field:i})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...i,size:"small",type:"password",label:$("oauth.auth0.clientSecret"),error:!!p.errors[i.name],helperText:p.errors[i.name]?.message||" ",disabled:!t})})})}),e.jsx(Y,{type:"submit",variant:"contained",onSubmit:m(l),disabled:!p.isDirty,children:$("oauth.save")})]})})}const Qe={enabled:!1,clientId:"",clientSecret:""};function $n(){const{api:x}=re(),{blocklet:C}=oe(),{t:$,locale:R}=ae(),_=C?.meta?.did,b=Object.assign({...Qe},C?.settings?.oauth?.github||{}),{handleSubmit:m,control:r,formState:p,watch:f,reset:h}=xe({defaultValues:Re(b,Object.keys(Qe))}),t=f("enabled"),l=E(async a=>{try{const{blocklet:i}=await x.configOAuth({input:{did:_,oauth:JSON.stringify({github:a})}}),u=Object.assign({...Qe},i?.settings?.oauth?.github||{});h(u),Z.success($("oauth.saveSuccess"))}catch(i){Z.error(i.message||$("oauth.saveFailed"))}}),o=E(a=>a?.trim()?!0:$("oauth.github.clientIdDescription")),n=E(a=>a?.trim()?!0:$("oauth.github.clientSecretDescription")),s=E(()=>!0),c=ge(()=>R==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-github":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-github",[R]);return e.jsx(A,{children:e.jsxs("form",{onSubmit:m(l),disabled:!0,children:[e.jsx(M,{title:e.jsxs(A,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:$("oauth.github.enable")}),e.jsx(X,{title:$("oauth.viewDocument"),children:e.jsx(A,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:c,target:"_blank",rel:"noreferrer",children:e.jsx(Q,{icon:xt,fontSize:20})})})]}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(H,{name:"enabled",control:r,sx:{alignItems:"center"},render:({field:a})=>e.jsx(K,{control:e.jsx(He,{sx:{ml:1},size:"small",checked:a.value,...a})})})}),e.jsx(M,{title:$("oauth.github.clientId"),children:e.jsx(H,{name:"clientId",control:r,rules:{validate:t?o:s},render:({field:a})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...a,size:"small",label:$("oauth.github.clientId"),error:!!p.errors[a.name],helperText:p.errors[a.name]?.message||" ",disabled:!t})})})}),e.jsx(M,{title:$("oauth.github.clientSecret"),children:e.jsx(H,{name:"clientSecret",control:r,rules:{validate:t?n:s},render:({field:a})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...a,size:"small",type:"password",label:$("oauth.github.clientSecret"),error:!!p.errors[a.name],helperText:p.errors[a.name]?.message||" ",disabled:!t})})})}),e.jsx(Y,{type:"submit",variant:"contained",onSubmit:m(l),disabled:!p.isDirty,children:$("oauth.save")})]})})}const et={enabled:!1,clientId:"",clientSecret:""};function An(){const{api:x}=re(),{blocklet:C}=oe(),{t:$,locale:R}=ae(),_=C?.meta?.did,b=Object.assign({...et},C?.settings?.oauth?.google||{}),{handleSubmit:m,control:r,formState:p,watch:f,reset:h}=xe({defaultValues:Re(b,Object.keys(et))}),t=f("enabled"),l=E(async a=>{try{const{blocklet:i}=await x.configOAuth({input:{did:_,oauth:JSON.stringify({google:a})}}),u=Object.assign({...et},i?.settings?.oauth?.google||{});h(u),Z.success($("oauth.saveSuccess"))}catch(i){Z.error(i.message||$("oauth.saveFailed"))}}),o=E(a=>a?.trim()?!0:$("oauth.google.clientIdDescription")),n=E(a=>a?.trim()?!0:$("oauth.google.clientSecretDescription")),s=E(()=>!0),c=ge(()=>R==="zh"?"https://www.arcblock.io/blog/docs/did-connect/zh/oauth-config-google":"https://www.arcblock.io/blog/docs/did-connect/en/oauth-config-google",[R]);return e.jsx(A,{children:e.jsxs("form",{onSubmit:m(l),disabled:!0,children:[e.jsx(M,{title:e.jsxs(A,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.jsx("span",{children:$("oauth.google.enable")}),e.jsx(X,{title:$("oauth.viewDocument"),children:e.jsx(A,{component:"a",sx:{display:"inline-block",color:"inherit",fontSize:0,lineHeight:1},href:c,target:"_blank",rel:"noreferrer",children:e.jsx(Q,{icon:xt,fontSize:20})})})]}),mb:2.5,children:e.jsx(H,{name:"enabled",control:r,render:({field:a})=>e.jsx(K,{control:e.jsx(He,{sx:{ml:1},checked:a.value,...a})})})}),e.jsx(M,{title:$("oauth.google.clientId"),children:e.jsx(H,{name:"clientId",control:r,rules:{validate:t?o:s},render:({field:a})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...a,size:"small",label:$("oauth.google.clientId"),error:!!p.errors[a.name],helperText:p.errors[a.name]?.message||" ",disabled:!t})})})}),e.jsx(M,{title:$("oauth.google.clientSecret"),children:e.jsx(H,{name:"clientSecret",control:r,rules:{validate:t?n:s},render:({field:a})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...a,size:"small",type:"password",label:$("oauth.google.clientSecret"),error:!!p.errors[a.name],helperText:p.errors[a.name]?.message||" ",disabled:!t})})})}),e.jsx(Y,{type:"submit",variant:"contained",onSubmit:m(l),disabled:!p.isDirty,children:$("oauth.save")})]})})}const tt={enabled:!1,teamId:"",serviceId:"",keyId:"",authKey:"",bundleId:""};function On(){const{api:x}=re(),{blocklet:C}=oe(),{t:$}=ae(),R=C?.meta?.did,_=Object.assign({...tt},C?.settings?.oauth?.apple||{}),{handleSubmit:b,control:m,formState:r,watch:p,reset:f}=xe({defaultValues:Re(_,Object.keys(tt))}),h=p("enabled"),t=E(async i=>{try{const{blocklet:u}=await x.configOAuth({input:{did:R,oauth:JSON.stringify({apple:i})}}),g=Object.assign({...tt},u?.settings?.oauth?.apple||{});f(g),Z.success($("oauth.saveSuccess"))}catch(u){Z.error(u.message||$("oauth.saveFailed"))}}),l=E(i=>i?.trim()?!0:$("oauth.apple.teamIdDescription")),o=E(i=>i?.trim()?!0:$("oauth.apple.serviceIdDescription")),n=E(i=>i?.trim()?!0:$("oauth.apple.keyIdDescription")),s=E(i=>i?.trim()?!0:$("oauth.apple.authKeyDescription")),c=E(i=>i?.trim()?!0:$("oauth.apple.bundleIdDescription")),a=E(()=>!0);return e.jsx(A,{children:e.jsxs("form",{onSubmit:b(t),disabled:!0,children:[e.jsx(M,{title:$("oauth.apple.enable"),mb:2.5,children:e.jsx(H,{name:"enabled",control:m,render:({field:i})=>e.jsx(K,{control:e.jsx(He,{sx:{ml:1},checked:i.value,...i})})})}),e.jsx(M,{title:$("oauth.apple.teamId"),children:e.jsx(H,{name:"teamId",control:m,rules:{validate:h?l:a},render:({field:i})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...i,size:"small",label:$("oauth.apple.teamId"),error:!!r.errors[i.name],helperText:r.errors[i.name]?.message||" ",disabled:!h})})})}),e.jsx(M,{title:$("oauth.apple.bundleId"),children:e.jsx(H,{name:"bundleId",control:m,rules:{validate:h?c:a},render:({field:i})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...i,size:"small",label:$("oauth.apple.bundleId"),error:!!r.errors[i.name],helperText:r.errors[i.name]?.message||" ",disabled:!h})})})}),e.jsx(M,{title:$("oauth.apple.serviceId"),children:e.jsx(H,{name:"serviceId",control:m,rules:{validate:h?o:a},render:({field:i})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...i,size:"small",label:$("oauth.apple.serviceId"),error:!!r.errors[i.name],helperText:r.errors[i.name]?.message||" ",disabled:!h})})})}),e.jsx(M,{title:$("oauth.apple.keyId"),children:e.jsx(H,{name:"keyId",control:m,rules:{validate:h?n:a},render:({field:i})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...i,size:"small",label:$("oauth.apple.keyId"),error:!!r.errors[i.name],helperText:r.errors[i.name]?.message||" ",disabled:!h})})})}),e.jsx(M,{title:$("oauth.apple.authKey"),children:e.jsx(H,{name:"authKey",control:m,rules:{validate:h?s:a},render:({field:i})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...i,size:"small",type:"password",label:$("oauth.apple.authKey"),multiline:!0,rows:4,error:!!r.errors[i.name],helperText:r.errors[i.name]?.message||" ",disabled:!h})})})}),e.jsx(Y,{type:"submit",variant:"contained",onSubmit:b(t),disabled:!r.isDirty,children:$("oauth.save")})]})})}const st={enabled:!1,clientId:"",clientSecret:""};function Pn(){const{api:x}=re(),{blocklet:C}=oe(),{t:$}=ae(),R=C?.meta?.did,_=Object.assign({...st},C?.settings?.oauth?.twitter||{}),{handleSubmit:b,control:m,formState:r,watch:p,reset:f}=xe({defaultValues:Re(_,Object.keys(st))}),h=p("enabled"),t=E(async s=>{try{const{blocklet:c}=await x.configOAuth({input:{did:R,oauth:JSON.stringify({twitter:s})}}),a=Object.assign({...st},c?.settings?.oauth?.twitter||{});f(a),Z.success($("oauth.saveSuccess"))}catch(c){Z.error(c.message||$("oauth.saveFailed"))}}),l=E(s=>s?.trim()?!0:$("oauth.twitter.clientIdDescription")),o=E(s=>s?.trim()?!0:$("oauth.twitter.clientSecretDescription")),n=E(()=>!0);return e.jsx(A,{children:e.jsxs("form",{onSubmit:b(t),disabled:!0,children:[e.jsx(M,{title:e.jsx(A,{sx:{display:"flex",alignItems:"center",gap:1},children:e.jsx("span",{children:$("oauth.twitter.enable")})}),mb:2.5,sx:{"& .section-content":{alignItems:"center"}},children:e.jsx(H,{name:"enabled",control:m,sx:{alignItems:"center"},render:({field:s})=>e.jsx(K,{control:e.jsx(He,{sx:{ml:1},size:"small",checked:s.value,...s})})})}),e.jsx(M,{title:$("oauth.twitter.clientId"),children:e.jsx(H,{name:"clientId",control:m,rules:{validate:h?l:n},render:({field:s})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...s,size:"small",label:$("oauth.twitter.clientId"),error:!!r.errors[s.name],helperText:r.errors[s.name]?.message||" ",disabled:!h})})})}),e.jsx(M,{title:$("oauth.twitter.clientSecret"),children:e.jsx(H,{name:"clientSecret",control:m,rules:{validate:h?o:n},render:({field:s})=>e.jsx(G,{fullWidth:!0,children:e.jsx(U,{...s,size:"small",type:"password",label:$("oauth.twitter.clientSecret"),error:!!r.errors[s.name],helperText:r.errors[s.name]?.message||" ",disabled:!h})})})}),e.jsx(Y,{type:"submit",variant:"contained",onSubmit:b(t),disabled:!r.isDirty,children:$("oauth.save")})]})})}const Tn={width:24,height:24,body:'<path fill="currentColor" d="M9 20q-.825 0-1.413-.588T7 18q0-.825.588-1.413T9 16q.825 0 1.413.588T11 18q0 .825-.588 1.413T9 20Zm6 0q-.825 0-1.413-.588T13 18q0-.825.588-1.413T15 16q.825 0 1.413.588T17 18q0 .825-.588 1.413T15 20Zm-6-6q-.825 0-1.413-.588T7 12q0-.825.588-1.413T9 10q.825 0 1.413.588T11 12q0 .825-.588 1.413T9 14Zm6 0q-.825 0-1.413-.588T13 12q0-.825.588-1.413T15 10q.825 0 1.413.588T17 12q0 .825-.588 1.413T15 14ZM9 8q-.825 0-1.413-.588T7 6q0-.825.588-1.413T9 4q.825 0 1.413.588T11 6q0 .825-.588 1.413T9 8Zm6 0q-.825 0-1.413-.588T13 6q0-.825.588-1.413T15 4q.825 0 1.413.588T17 6q0 .825-.588 1.413T15 8Z"/>'};function hs({id:x,title:C,children:$,index:R,onMove:_,defaultExpand:b=!1,onEnd:m,icon:r=null}){const[p,f]=L.useState(b),h=L.useRef(null),t=L.useRef(null),[{handlerId:l},o]=Er({accept:"dragItem",collect(i){return{handlerId:i.getHandlerId()}},hover(i,u){if(!h.current)return;const g=i.index,y=R;if(g===y)return;const k=h.current?.getBoundingClientRect(),w=t.current?.getBoundingClientRect(),d=(w.bottom-w.top)/2,j=u.getClientOffset().y-k.top;g<y&&j<d||g>y&&j>d||(_(g,y),i.index=y)}}),[{isDragging:n},s]=Dr({item:{index:R,type:"dragItem"},collect:i=>({isDragging:i.isDragging()}),end:m});s(t),o(h);const c=n?.5:1,a=E(i=>{i.preventDefault(),i.stopPropagation(),f(!p)});return e.jsxs(A,{ref:h,children:[e.jsxs(A,{sx:{cursor:"pointer","&:hover":{backgroundColor:"grey.100"}},ref:t,"data-handler-id":l,children:[e.jsxs(A,{sx:{py:2,px:1,opacity:c,display:"flex",alignItems:"center",gap:.5},draggable:!1,onClick:a,children:[e.jsx(A,{sx:{pointerEvents:"auto",cursor:"grab","&:active":{cursor:"grabbing"},fontSize:0,color:"text.hint","&:hover":{color:"text.secondary"}},children:e.jsx(Q,{fontSize:20,icon:Tn})}),e.jsx(A,{sx:{display:"flex",alignItems:"center",flexShrink:0,mr:.5,transform:"translateY(-1px)"},children:r}),e.jsx(J,{sx:{flex:1},children:C}),e.jsx(ne,{size:"small",sx:{pointerEvents:"auto",transform:p?"":"rotate(180deg)",transition:"transform 0.3s ease"},children:e.jsx(Q,{icon:Pr,style:{transform:"scale(1.5)"}})})]}),e.jsx(ee,{})]}),e.jsx(A,{sx:{pl:4,py:2.5,display:p?"block":"none"},children:$})]})}hs.propTypes={title:T.string.isRequired,id:T.string.isRequired,children:T.node.isRequired,index:T.number.isRequired,onMove:T.func.isRequired,onEnd:T.func.isRequired,defaultExpand:T.bool,icon:T.any};const In=[{name:"github",title:"GitHub",icon:e.jsx(qe,{provider:"github",sx:{width:20,height:20}}),component:e.jsx($n,{})},{name:"google",title:"Google",icon:e.jsx(qe,{provider:"google",sx:{width:20,height:20}}),component:e.jsx(An,{})},{name:"apple",title:"Apple",icon:e.jsx(qe,{provider:"apple",sx:{width:20,height:20}}),component:e.jsx(On,{})},{name:"twitter",title:"Twitter",icon:e.jsx(qe,{provider:"twitter",sx:{width:20,height:20}}),component:e.jsx(Pn,{})},{name:"auth0",title:"Auth0",icon:e.jsx(qe,{provider:"auth0",sx:{width:20,height:20}}),component:e.jsx(Rn,{})}],En=["github","google","apple","twitter","auth0"];function Dn(){const{api:x}=re(),{blocklet:C}=oe(),$=C?.meta?.did,R=C?.settings?.oauth||{},_=Object.keys(R).sort((t,l)=>R[t]?.order!==void 0&&R[l]?.order!==void 0?R[t].order-R[l].order:R[t]?.order!==void 0?-1:1);for(const t of En)_.includes(t)||_.push(t);const b=ye(_.reduce((t,l,o)=>Object.assign(t,{[l]:o}),{})),m=ge(()=>{const t=[...In];return t.sort((l,o)=>b[l.name]-b[o.name]),t.map(l=>({...l,enabled:R[l.name]?.enabled??!1}))},[b.auth0,b.github,b.google]),r={};typeof window<"u"&&(r.context=window);const p=E(async t=>{const l={};Object.keys(t).forEach(o=>{l[o]={order:t[o]}}),await x.configOAuth({input:{did:$,oauth:JSON.stringify(l)}})}),f=E((t,l)=>{const o=m[t],n=m[l];b[o.name]=l,b[n.name]=t}),h=E(async()=>{await p(b)});return e.jsx(A,{sx:{".section-left":{width:"180px"}},children:e.jsx(Lr,{backend:qr,...r,children:m.map((t,l)=>e.jsx(hs,{index:l,id:t.name,title:t.title,icon:t.icon,onMove:f,onEnd:h,defaultExpand:t.enabled,children:t.component},t.name))})})}const Se={ttl:W.SESSION_TTL,cacheTtl:W.SESSION_CACHE_TTL,email:{enabled:!1,requireVerified:!1,requireUnique:!1,trustOauthProviders:!1,trustedIssuers:[],enableDomainBlackList:!1,domainBlackList:[],enableDomainWhiteList:!1,domainWhiteList:[]},phone:{enabled:!1,requireVerified:!1,requireUnique:!1,regionBlackList:[],trustedIssuers:[]},enableBlacklist:!1};function he(x){return e.jsx(Mr,{...x,sx:{transform:"scale(0.75)"}})}function rt(x,C=!1){const $=C?x.ttl*86400:x.ttl/86400;return{...x,ttl:$}}function Ln(){const{api:x}=re(),{blocklet:C}=oe(),$=C?.meta?.did,R=er({},Se,C?.settings?.session||{});Je(R.ttl)&&(R.ttl=Se.ttl),Je(R.cacheTtl)&&(R.cacheTtl=Se.cacheTtl),R.phone||(R.phone=Se.phone),R.email||(R.email=Se.email),Je(R.enableBlacklist)&&(R.enableBlacklist=Se.enableBlacklist);const{handleSubmit:_,control:b,formState:m,reset:r,watch:p}=xe({defaultValues:Re(rt(R),["ttl","cacheTtl","email","phone","enableBlacklist"])}),{t:f}=ae(),h=p("email.enabled"),t=p("phone.enabled"),l=p("email.enableDomainBlackList"),o=p("email.enableDomainWhiteList"),{fields:n,append:s,remove:c}=Ot({control:b,name:"email.domainBlackList"}),{fields:a,append:i,remove:u}=Ot({control:b,name:"email.domainWhiteList"}),g=E(async y=>{try{const{blocklet:k}=await x.updateAppSessionConfig({input:{did:$,config:Ce(rt(y,!0),["phone"])}}),w=Object.assign({},Se,Re(k?.settings?.session||{},["ttl","cacheTtl","email","phone","enableBlacklist"]));r(rt(w)),Z.success(f("common.configSuccess"))}catch(k){Z.error(k.message)}});return e.jsx(qn,{onSubmit:_(g),children:e.jsxs(ie,{direction:"column",sx:{gap:6},children:[e.jsxs(A,{children:[e.jsxs(A,{children:[e.jsx(J,{variant:"h6",sx:{fontWeight:600},children:f("blocklet.config.session.profile")}),e.jsx(A,{component:ee,sx:{my:3}})]}),e.jsxs(ie,{sx:{gap:2},children:[e.jsx(M,{title:f("blocklet.config.session.fullNameEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(he,{disabled:!0,checked:!0})})}),e.jsx(M,{title:f("blocklet.config.session.avatarEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(he,{disabled:!0,checked:!0})})}),e.jsx(M,{title:f("blocklet.config.session.emailEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"email.enabled",control:b,render:({field:y})=>e.jsx(he,{...y,checked:y.value})})})}),h&&e.jsxs(ie,{direction:"column",sx:{ml:2,gap:.5},children:[e.jsx(M,{title:f("blocklet.config.session.emailRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"email.requireVerified",control:b,render:({field:y})=>e.jsx(K,{sx:{ml:0},control:e.jsx(he,{...y,checked:y.value})})})})}),e.jsx(M,{title:f("blocklet.config.session.emailRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"email.requireUnique",control:b,render:({field:y})=>e.jsx(K,{sx:{ml:0},control:e.jsx(he,{...y,checked:y.value})})})})}),e.jsx(M,{title:f("blocklet.config.session.emailTrustOauthProviders"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"email.trustOauthProviders",control:b,render:({field:y})=>e.jsx(K,{sx:{ml:0},control:e.jsx(he,{...y,checked:y.value})})})})}),e.jsx(M,{title:f("blocklet.config.session.enableDomainBlackList"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"email.enableDomainBlackList",control:b,render:({field:y})=>e.jsx(K,{sx:{ml:0},control:e.jsx(he,{...y,checked:y.value})})})})}),l&&e.jsxs(A,{children:[n.map((y,k)=>e.jsxs(ie,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(H,{name:`email.domainBlackList.${k}`,control:b,render:w=>e.jsx(U,{...w.field,size:"small",fullWidth:!0})}),e.jsx(ne,{onClick:()=>c(k),children:e.jsx(Pt,{})})]},y.id)),e.jsx(Y,{startIcon:e.jsx(Tt,{}),onClick:()=>s(""),children:f("blocklet.config.session.addDomain")})]}),e.jsx(M,{title:f("blocklet.config.session.enableDomainWhiteList"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"email.enableDomainWhiteList",control:b,render:({field:y})=>e.jsx(K,{sx:{ml:0},control:e.jsx(he,{...y,checked:y.value})})})})}),o&&e.jsxs(A,{children:[a.map((y,k)=>e.jsxs(ie,{direction:"row",sx:{alignItems:"center",my:1,maxWidth:"720px"},children:[e.jsx(H,{name:`email.domainWhiteList.${k}`,control:b,render:w=>e.jsx(U,{...w.field,size:"small",fullWidth:!0})}),e.jsx(ne,{onClick:()=>u(k),children:e.jsx(Pt,{})})]},y.id)),e.jsx(Y,{startIcon:e.jsx(Tt,{}),onClick:()=>i(""),children:f("blocklet.config.session.addDomain")})]})]}),e.jsxs(A,{sx:{display:"none"},children:[e.jsx(M,{title:f("blocklet.config.session.phoneEnabled"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"phone.enabled",control:b,disabled:!0,render:({field:y})=>e.jsx(K,{sx:{ml:0},control:e.jsx(he,{...y,checked:y.value})})})})}),t&&e.jsxs(ie,{direction:"column",sx:{ml:2,mt:1},children:[e.jsx(M,{title:f("blocklet.config.session.phoneRequireVerified"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"phone.requireVerified",control:b,render:({field:y})=>e.jsx(K,{sx:{ml:0},control:e.jsx(he,{...y,checked:y.value})})})})}),e.jsx(M,{title:f("blocklet.config.session.phoneRequireUnique"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"phone.requireUnique",control:b,render:({field:y})=>e.jsx(K,{sx:{ml:0},control:e.jsx(he,{...y,checked:y.value})})})})})]})]})]})]}),e.jsxs(A,{children:[e.jsx(J,{variant:"h6",sx:{fontWeight:600},children:f("blocklet.config.session.period")}),e.jsx(A,{component:ee,sx:{my:3}}),e.jsx(ie,{direction:"column",spacing:2,children:e.jsx(H,{name:"ttl",control:b,rules:{min:1,max:30},render:({field:y})=>e.jsx(G,{fullWidth:!0,sx:{mb:2},children:e.jsx(M,{title:f("blocklet.config.session.ttl",{day:y.value}),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{width:"100%",maxWidth:500,px:2},children:e.jsx(zr,{...y,defaultValue:7,step:1,marks:[{value:1,label:f("blocklet.config.session.day",{day:1})},{value:7,label:f("blocklet.config.session.days",{day:7})},{value:14,label:f("blocklet.config.session.days",{day:14})},{value:21,label:f("blocklet.config.session.days",{day:21})},{value:30,label:f("blocklet.config.session.days",{day:30})}],min:1,max:30,valueLabelDisplay:"auto"})})})})})})]}),e.jsxs(A,{children:[e.jsx(J,{variant:"h6",sx:{fontWeight:600},children:f("blocklet.config.session.experimentalSettings")}),e.jsx(A,{component:ee,sx:{my:3}}),e.jsx(ie,{direction:"column",spacing:2,children:e.jsx(M,{title:f("blocklet.config.session.enableBlacklist"),sectionLeftSx:{width:"600px"},children:e.jsx(A,{sx:{alignSelf:"flex-start"},children:e.jsx(H,{name:"enableBlacklist",control:b,render:({field:y})=>e.jsx(K,{sx:{ml:0},control:e.jsx(he,{...y,checked:y.value})})})})})})]}),e.jsx(A,{children:e.jsx(Y,{type:"submit",variant:"contained",disabled:!m.isDirty,children:f("oauth.save")})})]})})}const qn=ve.form`
83
83
  max-width: 1536px;
84
84
 
85
85
  .advanced-config {