@abtnode/blocklet-services 1.16.52-beta-20251003-083412-fdfc4e36 → 1.16.52-beta-20251005-235515-42ad5caf

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 (254) hide show
  1. package/api/libs/connect/session.js +16 -1
  2. package/api/middlewares/check-running.js +9 -8
  3. package/api/middlewares/ensure-org-enabled.js +17 -0
  4. package/api/routes/blocklet.js +3 -3
  5. package/api/routes/user.js +175 -1
  6. package/api/services/auth/connect/switch-passport.js +2 -1
  7. package/api/services/auth/session.js +30 -0
  8. package/dist/assets/{AdapterDayjs-CAaLcejt.js → AdapterDayjs-wck-CfDF.js} +1 -1
  9. package/dist/assets/{Google-BMeng9mn.js → Google-BFauCF2k.js} +1 -1
  10. package/dist/assets/{access-control-BbcaXOFy.js → access-control-0wy7XAQb.js} +1 -1
  11. package/dist/assets/{actions-DbBJOD0d.js → actions-B4VXcSRp.js} +1 -1
  12. package/dist/assets/{add-component-core--Z5nF5rL.js → add-component-core-BM7p_09p.js} +23 -23
  13. package/dist/assets/add-resource-DbQFT7Gg.js +1 -0
  14. package/dist/assets/{addon-CnJnEleb.js → addon-CUvC0k6Y.js} +1 -1
  15. package/dist/assets/{advanced-DlEH3ib_.js → advanced-BhCewgzQ.js} +3 -3
  16. package/dist/assets/{aigne-CnGxZFk3.js → aigne-BQckonxP.js} +1 -1
  17. package/dist/assets/api-rC33aBSs.js +1 -0
  18. package/dist/assets/{appearance-DKR3ZZ-t.js → appearance-CjrhZWhd.js} +1 -1
  19. package/dist/assets/ar-CHd3xUx5.js +7 -0
  20. package/dist/assets/{arrow-down.svg-B_TkYBj9.js → arrow-down.svg-f3YCmAji.js} +1 -1
  21. package/dist/assets/{audit-logs-CY22RcFd.js → audit-logs-CASGp36e.js} +2 -2
  22. package/dist/assets/{authorize-DoJw-6hl.js → authorize-CkVYs-vE.js} +1 -1
  23. package/dist/assets/{base-chart-BbbiwJIa.js → base-chart-UFWO9a3P.js} +1 -1
  24. package/dist/assets/{base32-CgLd9kUN.js → base32-Cyneng4p.js} +1 -1
  25. package/dist/assets/{bind-account-CKozG7iQ.js → bind-account-D6KenxOW.js} +1 -1
  26. package/dist/assets/{branding-T8GaJvdM.js → branding-BVr5wVa5.js} +5 -5
  27. package/dist/assets/{branding-DqgDW-Pg.js → branding-CHhPscOd.js} +2 -2
  28. package/dist/assets/branding-DLDF3ZZP.js +1 -0
  29. package/dist/assets/{bundle-avatar-BALJ_pZQ.js → bundle-avatar-BpummNxa.js} +1 -1
  30. package/dist/assets/button-DGHIlhos.js +1 -0
  31. package/dist/assets/{click-to-copy-CVHuu877.js → click-to-copy-B379bwP3.js} +1 -1
  32. package/dist/assets/{cloneDeep-E2Pxqpbv.js → cloneDeep-LRq4Ya2k.js} +1 -1
  33. package/dist/assets/{collapse-DhGi244c.js → collapse-DJGzUM1Q.js} +1 -1
  34. package/dist/assets/complete-CQkeXJPL.js +39 -0
  35. package/dist/assets/{component-tJC1J22-.js → component-DWN2cI-c.js} +34 -34
  36. package/dist/assets/{config-CuaqTz1E.js → config-BgdQYz7Z.js} +2 -2
  37. package/dist/assets/{config-DkBKIb7u.js → config-CPB45HHq.js} +4 -4
  38. package/dist/assets/{config-CiixR7JW.js → config-CRxOjKmb.js} +1 -1
  39. package/dist/assets/config-navigation-D1TBA90f.js +40 -0
  40. package/dist/assets/config-space-DpOC6rFp.js +1 -0
  41. package/dist/assets/{confirm-BUTyrkJR.js → confirm-BfJfcPyj.js} +1 -1
  42. package/dist/assets/{connect-C2T5mJpT.js → connect-BbLXTlyu.js} +1 -1
  43. package/dist/assets/{connect-CwCzBgdq.js → connect-ZcwxKVuN.js} +1 -1
  44. package/dist/assets/{connect-to-C62UBG81.js → connect-to-Skv-ek56.js} +1 -1
  45. package/dist/assets/{content-layout-CaGd-JXO.js → content-layout-B9tc9LCL.js} +1 -1
  46. package/dist/assets/create-passport-svg-DosyhcHP.js +1 -0
  47. package/dist/assets/{createClass-BuhPvJV8.js → createClass-HFwzUuOB.js} +1 -1
  48. package/dist/assets/dashboard-DJ6Tc_2L.js +106 -0
  49. package/dist/assets/de-CD44Obtw.js +7 -0
  50. package/dist/assets/{delete-confirm-zH2oZyqM.js → delete-confirm-DNg1Z1xV.js} +1 -1
  51. package/dist/assets/{did-address-CeTjTMC4.js → did-address-Dbg_LiWL.js} +1 -1
  52. package/dist/assets/{domain-BmzmdNfA.js → domain-3JvbKqlt.js} +1 -1
  53. package/dist/assets/{domain-action-card-BM27YVmt.js → domain-action-card-BixPviaZ.js} +2 -2
  54. package/dist/assets/domains-D8QMeppe.js +1 -0
  55. package/dist/assets/{email-vdkECdsC.js → email-C6m1mnbN.js} +1 -1
  56. package/dist/assets/{empty-spinner-CkCqfxFX.js → empty-spinner-LXNYl6_1.js} +1 -1
  57. package/dist/assets/engine-DkWTqqhM.js +1 -0
  58. package/dist/assets/es-DNFAt0y7.js +9 -0
  59. package/dist/assets/{exchange-passport-DdKgNabQ.js → exchange-passport-BraV0EOe.js} +1 -1
  60. package/dist/assets/{form-DD1zzF-R.js → form-BIoto8u8.js} +1 -1
  61. package/dist/assets/form-text-input-BgpOkOYh.js +11 -0
  62. package/dist/assets/{form-wrapper-DNqXvSru.js → form-wrapper-Dt1iJZge.js} +1 -1
  63. package/dist/assets/fr-C9xE9tD4.js +7 -0
  64. package/dist/assets/{fuel-h75SX900.js → fuel-Dwo_gklT.js} +1 -1
  65. package/dist/assets/gen-access-key-DuRApUI5.js +1 -0
  66. package/dist/assets/{gen-simple-access-key-Bq7DCyW7.js → gen-simple-access-key-xXyYChfi.js} +1 -1
  67. package/dist/assets/get-safe-url-HFT553nb.js +1 -0
  68. package/dist/assets/hi-D_0DFJcS.js +5 -0
  69. package/dist/assets/{home-B3HQdfZf.js → home-D0rR9_38.js} +1 -1
  70. package/dist/assets/id-BgJjfH2L.js +7 -0
  71. package/dist/assets/iframe-COascK-f.js +1 -0
  72. package/dist/assets/{index-Dr9NaKfR.js → index-3ePiAFIp.js} +1 -1
  73. package/dist/assets/{index-BjcHj49D.js → index-A5fXAFXl.js} +1 -1
  74. package/dist/assets/{index-BtHqqZ50.js → index-AMzbVwE1.js} +1 -1
  75. package/dist/assets/{index-C_YGTMJ4.js → index-B3o5bPY9.js} +1 -1
  76. package/dist/assets/{index-Chi1YHs4.js → index-BAMrdOx5.js} +1 -1
  77. package/dist/assets/{index-BVRSxJRS.js → index-BO080WnZ.js} +1 -1
  78. package/dist/assets/index-BU5Qj_Uf.js +93 -0
  79. package/dist/assets/index-BiMTr9N1.js +6 -0
  80. package/dist/assets/index-BkMwz7Ha.js +281 -0
  81. package/dist/assets/{index-CZkVe8t1.js → index-BoF74OVD.js} +12 -12
  82. package/dist/assets/{index-6IwthDxj.js → index-BrrIKxMS.js} +1 -1
  83. package/dist/assets/{index-3xeMR-Qg.js → index-Bx-RW9vi.js} +1 -1
  84. package/dist/assets/{index-CKsy2_Ph.js → index-CARCeLG0.js} +2 -2
  85. package/dist/assets/index-CX8XMi66.js +1 -0
  86. package/dist/assets/{index-BzFZ1zhO.js → index-CjUelepA.js} +1 -1
  87. package/dist/assets/{index-BNDipwdR.js → index-Cv0WQg6r.js} +3 -3
  88. package/dist/assets/{index-BiLQGAIi.js → index-DKQpQSIL.js} +2 -2
  89. package/dist/assets/index-DKp1VidC.js +7 -0
  90. package/dist/assets/index-DOTZtBXk.js +113 -0
  91. package/dist/assets/{index-ImKSuLO2.js → index-DXDOA6wf.js} +2 -2
  92. package/dist/assets/{index-CmjYsAgT.js → index-DcGTEgwU.js} +4 -4
  93. package/dist/assets/index-DnsQF6x_.js +1 -0
  94. package/dist/assets/{index-BYry2QZ3.js → index-Ds4S1_JK.js} +3 -3
  95. package/dist/assets/index-DsZw1jDU.js +1039 -0
  96. package/dist/assets/{index-DbXxI_D0.js → index-IYdn8PnM.js} +1 -1
  97. package/dist/assets/index-Z8qCN0P1.js +200 -0
  98. package/dist/assets/{index-CzlhyS8_.js → index-cc7PDHui.js} +1 -1
  99. package/dist/assets/{index-BluBXQJ4.js → index-d3X4O8S1.js} +4 -4
  100. package/dist/assets/{index-KJrnzKIu.js → index-g1J2WU69.js} +1 -1
  101. package/dist/assets/index-o5365tSi.js +124 -0
  102. package/dist/assets/{index-CD_JYNBB.js → index-pMD5HObM.js} +10 -10
  103. package/dist/assets/{index-C2DPoZpQ.js → index-un8ZaNww.js} +5 -5
  104. package/dist/assets/{index-CGXZRmKt.js → index-yINGgTD8.js} +6 -6
  105. package/dist/assets/{invitation-CMi0GWFt.js → invitation-HIuSHONR.js} +7 -7
  106. package/dist/assets/invitations-Bol3LHDV.js +3 -0
  107. package/dist/assets/invite--kfNCB-y.js +1 -0
  108. package/dist/assets/{isURL-CSKc4kTl.js → isURL-NLB1KXWU.js} +1 -1
  109. package/dist/assets/issue-passport-DEKfDU5Q.js +1 -0
  110. package/dist/assets/{item-DsH8hlQV.js → item-8d2bomfb.js} +1 -1
  111. package/dist/assets/ja-SFs9TI5a.js +9 -0
  112. package/dist/assets/ko-CHdBh-EI.js +9 -0
  113. package/dist/assets/{landing-page-CAdZF71_.js → landing-page-BKWBeaB2.js} +1 -1
  114. package/dist/assets/{launch-result-message-B0--4ubW.js → launch-result-message-DW948RfZ.js} +1 -1
  115. package/dist/assets/{layout-CN4YohUY.js → layout-BCGFP2fM.js} +1 -1
  116. package/dist/assets/{list-Bf1rfvw3.js → list-CLnYaffq.js} +2 -2
  117. package/dist/assets/{list-2lBZBVJD.js → list-CjwYZK4C.js} +2 -2
  118. package/dist/assets/{list-header-DlrmpNef.js → list-header-DMpz8A8v.js} +1 -1
  119. package/dist/assets/localization-D4M90esB.js +1 -0
  120. package/dist/assets/{log-CKMWqM_9.js → log-CwhRn7dG.js} +1 -1
  121. package/dist/assets/logger-GZGSMwyW.js +1 -0
  122. package/dist/assets/login-D6vdg4tV.js +1 -0
  123. package/dist/assets/{login-oauth-callback-B4wL5LK5.js → login-oauth-callback-DNSbhkTX.js} +1 -1
  124. package/dist/assets/{logo-uploader-CgW-ljTo.js → logo-uploader-CehwiZZl.js} +2 -2
  125. package/dist/assets/{lost-passport-BiaJ8Qil.js → lost-passport-JcRjjJMu.js} +3 -3
  126. package/dist/assets/{observability-3BjnzXRV.js → observability-pdEZhjSl.js} +1 -1
  127. package/dist/assets/{omit-r-0RLWOV.js → omit-BQZKecPT.js} +1 -1
  128. package/dist/assets/{open-window-BAToG1Zw.js → open-window-5tX5UogI.js} +1 -1
  129. package/dist/assets/{over-due-invoice-payment-D4EbV_XU.js → over-due-invoice-payment-BQTpVcW4.js} +1 -1
  130. package/dist/assets/overview-8cijjh6D.js +85 -0
  131. package/dist/assets/{page-header-DP0csqkR.js → page-header-DvSb4Cmz.js} +1 -1
  132. package/dist/assets/passport-dBKTMShn.js +1 -0
  133. package/dist/assets/{passport-item-DTKCI96Q.js → passport-item-DybXmjDL.js} +1 -1
  134. package/dist/assets/{permission-DWlLl3B8.js → permission-DPZmpN88.js} +1 -1
  135. package/dist/assets/{playground-BEhnKrD-.js → playground-C0bWoIDS.js} +1 -1
  136. package/dist/assets/preferences-CSIWwAIC.js +1 -0
  137. package/dist/assets/profile-embed-Dxmu0kHv.js +1 -0
  138. package/dist/assets/pt-BJowi6tZ.js +5 -0
  139. package/dist/assets/publish-resource-BEWgZsl5.js +1 -0
  140. package/dist/assets/{react-beautiful-dnd.esm-9QLg1KOC.js → react-beautiful-dnd.esm-BbVphn6n.js} +1 -1
  141. package/dist/assets/{react-stripe.esm-DWiCVD55.js → react-stripe.esm-C51Uah32.js} +1 -1
  142. package/dist/assets/{required-BUAaYcMZ.js → required-BT8zXV8U.js} +1 -1
  143. package/dist/assets/ru-DTjDV3Pw.js +5 -0
  144. package/dist/assets/runtime-Dw23IX1l.js +1 -0
  145. package/dist/assets/{sanitize-mRppk1lK.js → sanitize-C5jEFDvG.js} +1 -1
  146. package/dist/assets/sdk-BIWRdmX9.js +1 -0
  147. package/dist/assets/{section-CCfmWVdK.js → section-ZPKr6_ii.js} +1 -1
  148. package/dist/assets/{security-D--MQBTg.js → security-D_vkAC2F.js} +1 -1
  149. package/dist/assets/session-tOfkTx-G.js +1 -0
  150. package/dist/assets/{setup-BS5cDalg.js → setup-eJiK00ap.js} +1 -1
  151. package/dist/assets/{shorten-label-DAXPWCI6.js → shorten-label-DVy6K5I7.js} +1 -1
  152. package/dist/assets/simple-select-BeAlThKq.js +1 -0
  153. package/dist/assets/{spaces-6iUrdnzs.js → spaces-f3sezu1Y.js} +1 -1
  154. package/dist/assets/start-tshF2U2D.js +187 -0
  155. package/dist/assets/starting-progress-CNhbI5kz.js +40 -0
  156. package/dist/assets/status-aauXt2lH.js +1 -0
  157. package/dist/assets/{step-actions-3Nz2nPoP.js → step-actions-B_qluS-3.js} +1 -1
  158. package/dist/assets/{studio-C6g9y1mS.js → studio-ahebVj52.js} +1 -1
  159. package/dist/assets/{switch-control-Bs2D4JNi.js → switch-control-B8BKalcv.js} +1 -1
  160. package/dist/assets/{table-tips-B1dFVdej.js → table-tips-CIe4hASP.js} +1 -1
  161. package/dist/assets/team-DJZO6TyJ.js +146 -0
  162. package/dist/assets/th-A3GLGlJ1.js +5 -0
  163. package/dist/assets/traffic-Dh4U8pnc.js +1 -0
  164. package/dist/assets/{transfer-B90XYpQX.js → transfer-CuvzwKCQ.js} +1 -1
  165. package/dist/assets/{unsubscribe-DBJXxz9h.js → unsubscribe-B1yTQQGf.js} +1 -1
  166. package/dist/assets/{use-app-logo-Cs4SrcDi.js → use-app-logo-CqD9SoXr.js} +1 -1
  167. package/dist/assets/{use-mobile-BW9mTiYC.js → use-mobile-BQQpAf3i.js} +1 -1
  168. package/dist/assets/{use-mobile-B_fpUHD7.js → use-mobile-D6YQgajG.js} +1 -1
  169. package/dist/assets/{use-server-logo-R848M-JH.js → use-server-logo-ClR4qaF0.js} +1 -1
  170. package/dist/assets/{use-window-close-Dk0lXOqo.js → use-window-close-CLNOz9Uq.js} +1 -1
  171. package/dist/assets/{useAsync-DkQHu4t4.js → useAsync-DVtDVEv6.js} +1 -1
  172. package/dist/assets/{useAsync-DoI7Qt9M.js → useAsync-fWwm3Jbj.js} +1 -1
  173. package/dist/assets/{useAsyncRetry-DNTidBXG.js → useAsyncRetry-EEjDgDMR.js} +1 -1
  174. package/dist/assets/{useLocalStorage-BzRs3x-K.js → useLocalStorage-BPSCf_zz.js} +1 -1
  175. package/dist/assets/user-center-DDfna1uE.js +126 -0
  176. package/dist/assets/user-follower-Cc-51q-9.js +32 -0
  177. package/dist/assets/{user-sessions-DqMaEduy.js → user-sessions-DkchVQBO.js} +1 -1
  178. package/dist/assets/{util-C8ahPkmT.js → util-B8Xud4vY.js} +1 -1
  179. package/dist/assets/{util-CRzq0bMY.js → util-D8KMfML_.js} +1 -1
  180. package/dist/assets/{vendor-arcblock-BhtOu00C.js → vendor-arcblock-CSGgL93G.js} +1 -1
  181. package/dist/assets/{vendor-hooks-BtDnIwBH.js → vendor-hooks-BlA8TRnZ.js} +2 -2
  182. package/dist/assets/vendor-mui-core-DRxbhqaK.js +250 -0
  183. package/dist/assets/{vendor-mui-x-DWX99wt-.js → vendor-mui-x-Qp6zkx78.js} +1 -1
  184. package/dist/assets/{vendor-utils-CVwaKsP9.js → vendor-utils-CUDP56Ff.js} +1 -1
  185. package/dist/assets/{vendor-ux-Cfhaj-oj.js → vendor-ux-CDOuCaX1.js} +3 -3
  186. package/dist/assets/vi-DGXwnYQW.js +5 -0
  187. package/dist/assets/{wait-connect-E47qTAaT.js → wait-connect-CGOeOXHL.js} +1 -1
  188. package/dist/assets/{wizard-2kfr1LiF.js → wizard-B7NraPoW.js} +1 -1
  189. package/dist/assets/{wizard-components-De0Ol72d.js → wizard-components-Bl0PwqPC.js} +7 -7
  190. package/dist/assets/wrap-locale-BQiQiZG-.js +1 -0
  191. package/dist/assets/zh-CJ0qBy8e.js +10 -0
  192. package/dist/assets/{zh-Du23hKEW.js → zh-DQ2rCoQ5.js} +1 -1
  193. package/dist/assets/zh-tw-Cs-zRk58.js +9 -0
  194. package/dist/index.html +6 -6
  195. package/dist/service-worker.js +1 -1
  196. package/package.json +32 -32
  197. package/dist/assets/add-resource-DRGO7kDY.js +0 -1
  198. package/dist/assets/api-BUbloWod.js +0 -1
  199. package/dist/assets/ar-DDKSNNIB.js +0 -7
  200. package/dist/assets/branding-Dc9wDqPm.js +0 -1
  201. package/dist/assets/button-BG8yGG9e.js +0 -1
  202. package/dist/assets/complete-Td6_SOPf.js +0 -39
  203. package/dist/assets/config-navigation-BFl1_q-j.js +0 -40
  204. package/dist/assets/config-space-B8dCR8jO.js +0 -1
  205. package/dist/assets/dashboard-B0Fy6SmC.js +0 -106
  206. package/dist/assets/de-C5jW-Aco.js +0 -7
  207. package/dist/assets/domains-CEkJn9DL.js +0 -1
  208. package/dist/assets/engine-CCa9THLZ.js +0 -1
  209. package/dist/assets/es-DnE5Se03.js +0 -9
  210. package/dist/assets/form-text-input-CqoNK3mi.js +0 -11
  211. package/dist/assets/fr-BpXortYf.js +0 -7
  212. package/dist/assets/gen-access-key-BZebBcUZ.js +0 -1
  213. package/dist/assets/get-safe-url-CeMtySPx.js +0 -1
  214. package/dist/assets/hi-CeUu25BW.js +0 -5
  215. package/dist/assets/id-BugYMmLN.js +0 -7
  216. package/dist/assets/iframe-ASQIizLx.js +0 -1
  217. package/dist/assets/index-6B51asLP.js +0 -292
  218. package/dist/assets/index-BIIL1VhU.js +0 -1039
  219. package/dist/assets/index-BlTmYBsg.js +0 -124
  220. package/dist/assets/index-CmsJ8Fn7.js +0 -1
  221. package/dist/assets/index-DBJZdu-W.js +0 -113
  222. package/dist/assets/index-Dn4pwRtk.js +0 -1
  223. package/dist/assets/index-DwQNuuxR.js +0 -283
  224. package/dist/assets/index-ajyKTkxP.js +0 -7
  225. package/dist/assets/invite-DpA2tJ_s.js +0 -1
  226. package/dist/assets/issue-passport-B0QyEUjC.js +0 -1
  227. package/dist/assets/ja-DaREJWmX.js +0 -9
  228. package/dist/assets/ko-DGXdpX64.js +0 -9
  229. package/dist/assets/localization-D12SXxDi.js +0 -1
  230. package/dist/assets/logger-CsgnUk8i.js +0 -1
  231. package/dist/assets/login-y-09uRl4.js +0 -1
  232. package/dist/assets/overview-C734Rasc.js +0 -85
  233. package/dist/assets/preferences-DTgCHjY9.js +0 -1
  234. package/dist/assets/profile-embed-4R2fOO01.js +0 -1
  235. package/dist/assets/pt-CIqefLTL.js +0 -5
  236. package/dist/assets/publish-resource-CHMkx0I2.js +0 -1
  237. package/dist/assets/ru-B4h3WudR.js +0 -5
  238. package/dist/assets/runtime-CUzpUEb5.js +0 -1
  239. package/dist/assets/sdk-CxjuM-ya.js +0 -1
  240. package/dist/assets/session-B_RHNjCZ.js +0 -1
  241. package/dist/assets/simple-select-BHPmFba3.js +0 -1
  242. package/dist/assets/start-ByPfhiAj.js +0 -187
  243. package/dist/assets/starting-progress-CxdsmebW.js +0 -40
  244. package/dist/assets/status-DA0S9WgZ.js +0 -1
  245. package/dist/assets/team-CcIOrTIk.js +0 -146
  246. package/dist/assets/th-BjttL5p9.js +0 -5
  247. package/dist/assets/traffic-KIPRLJPY.js +0 -1
  248. package/dist/assets/user-center-bNIwz7Mp.js +0 -126
  249. package/dist/assets/user-follower-UoHvZnoE.js +0 -32
  250. package/dist/assets/vendor-mui-core-BIZOanxj.js +0 -250
  251. package/dist/assets/vi-C-IhikR1.js +0 -5
  252. package/dist/assets/wrap-locale-Ck3zJtU5.js +0 -1
  253. package/dist/assets/zh-CWvcoHsp.js +0 -10
  254. package/dist/assets/zh-tw-D_73qm-O.js +0 -9
@@ -0,0 +1,281 @@
1
+ import{r as k,t as ao,g as io,e as lo}from"./vendor-react-Dvs43sk9.js";import{j as o,W as C,D as gn,U as co,aj as Sr,ak as A,B as uo,dT as Pt,O as fo,ai as po,bV as mo,n as Lr,dU as Ir,bW as mt,bc as Ct,c0 as ho,z as Fe,aN as bo,Q as Pe,b6 as xn,J as go,Y as xo,bC as yo,$ as vo,R as Co,bD as At,T as ye,aI as Pr,cb as ze,a3 as jo,I as rt,dV as wo,dW as ko,aX as Ee,y as an,x as ln,M as jt,a6 as Ue,at as me,bq as So,br as Lo,am as wt,b_ as qn,P as Io,bX as Po,dH as Ao,aO as To,aP as Eo,dX as Ro,dt as _o,bM as Oo,dY as Mo,a5 as No}from"./vendor-mui-core-DRxbhqaK.js";import{B as Hn,U as Do,au as $o,e as cn,K as Bo,av as Fo,n as Kn,C as zo,a as Uo}from"./vendor-utils-CUDP56Ff.js";import{a6 as Ar,N as Wo,T as J,H as oe,o as Tr,b as ke,k as Er,$ as qo,f as Ho,n as ae,c as Tt,P as Ko,p as Yo,I as dn,a0 as Vo,j as Go}from"./vendor-ux-CDOuCaX1.js";import{az as Zo,c8 as Xo,cm as Qo,X as de,ch as Jo,a0 as un,o as st,_ as Yn,U as ea,t as ta,aJ as na,B as ot,cn as ra,c4 as sa,a9 as Rr,c as Re,b8 as oa,a6 as aa,V as _e,aW as _r,co as ia}from"./index-DsZw1jDU.js";import{B as Or,o as la,l as Mr}from"./index-AMzbVwE1.js";import{B as ca,b as yn,g as it,t as Nr,e as Dr,l as da,D as ua,c as fa,h as pa,a as ma}from"./vendor-hooks-BlA8TRnZ.js";import{C as $r,P as ha}from"./user-sessions-DkchVQBO.js";import{r as ba}from"./index-cc7PDHui.js";import{v as Vn}from"./index-BrrIKxMS.js";import{u as he}from"./team-DJZO6TyJ.js";import{f as le}from"./index-DBs9Ljax.js";import{W as vn}from"./did-address-Dbg_LiWL.js";import{u as Me}from"./session-tOfkTx-G.js";import{S as ga}from"./Google-BFauCF2k.js";import{P as We}from"./permission-DPZmpN88.js";import{C as Cn}from"./click-to-copy-B379bwP3.js";import{T as Br}from"./index-CX8XMi66.js";import{u as xa}from"./useAsync-fWwm3Jbj.js";import{v as ue}from"./index-IYdn8PnM.js";import{C as Et}from"./confirm-BfJfcPyj.js";import{N as ya}from"./index-un8ZaNww.js";import{i as Fr,a as kt,p as zr}from"./util-D8KMfML_.js";import{b as va}from"./sdk-BIWRdmX9.js";import{U as Ca}from"./user-follower-Cc-51q-9.js";import{I as ja}from"./invitations-Bol3LHDV.js";import{A as wa}from"./actions-B4VXcSRp.js";import{S as ka}from"./shorten-label-DVy6K5I7.js";import"./lottie-web-4koyQiv_.js";import"./vendor-arcblock-CSGgL93G.js";import"./isURL-NLB1KXWU.js";import"./use-app-logo-CqD9SoXr.js";import"./cloneDeep-LRq4Ya2k.js";import"./arrow-down.svg-f3YCmAji.js";import"./vendor-mui-x-Qp6zkx78.js";import"./AdapterDayjs-wck-CfDF.js";import"./useAsync-DVtDVEv6.js";import"./base32-Cyneng4p.js";import"./use-mobile-BQQpAf3i.js";const Ur=e=>k.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.88619 1.875C5.0541 1.875 4.24071 2.12174 3.54885 2.58402C2.857 3.0463 2.31777 3.70336 1.99934 4.47211C1.68092 5.24085 1.5976 6.08676 1.75994 6.90285C1.92227 7.71895 2.32295 8.46858 2.91133 9.05695C3.4997 9.64532 4.24933 10.046 5.06543 10.2083C5.88152 10.3707 6.72743 10.2874 7.49617 9.96893C8.26492 9.65051 8.92198 9.11128 9.38426 8.41942C9.84654 7.72757 10.0933 6.91417 10.0933 6.08209C10.0933 4.9663 9.65003 3.89621 8.86105 3.10723C8.07207 2.31825 7.00198 1.875 5.88619 1.875ZM4.11182 4.30773C4.58242 3.83714 5.22067 3.57276 5.88619 3.57276C6.38249 3.57276 6.86764 3.71993 7.2803 3.99566C7.69295 4.27139 8.01458 4.66329 8.20451 5.12181C8.39443 5.58033 8.44413 6.08487 8.3473 6.57164C8.25048 7.0584 8.01149 7.50552 7.66055 7.85645C7.30962 8.20739 6.8625 8.44638 6.37574 8.5432C5.88897 8.64003 5.38443 8.59033 4.92591 8.40041C4.46739 8.21048 4.07549 7.88885 3.79976 7.4762C3.52403 7.06354 3.37686 6.57839 3.37686 6.08209C3.37686 5.41657 3.64123 4.77832 4.11182 4.30773ZM4.20709 10.8302C3.0913 10.8302 2.02121 11.2735 1.23223 12.0624C0.443246 12.8514 0 13.9215 0 15.0373V17.8358C0 17.9955 0.12947 18.125 0.289179 18.125H1.40858C1.56829 18.125 1.69776 17.9955 1.69776 17.8358V15.0373C1.69776 14.3718 1.96214 13.7335 2.43273 13.2629C2.90332 12.7924 3.54157 12.528 4.20709 12.528H7.5653C7.89483 12.528 8.22113 12.5929 8.52558 12.719C8.83002 12.8451 9.10665 13.0299 9.33966 13.2629C9.57267 13.496 9.75751 13.7726 9.88361 14.077C10.0097 14.3815 10.0746 14.7078 10.0746 15.0373V17.8358C10.0746 17.9955 10.2041 18.125 10.3638 18.125H11.4832C11.6429 18.125 11.7724 17.9955 11.7724 17.8358V15.0373C11.7724 13.9215 11.3291 12.8514 10.5402 12.0624C9.75118 11.2735 8.68109 10.8302 7.5653 10.8302H4.20709Z"}),k.createElement("rect",{x:12.5,y:9.375,width:7.5,height:1.875,rx:.9375}),k.createElement("rect",{x:15.3125,y:14.0625,width:7.5,height:1.875,rx:.9375,transform:"rotate(-90 15.3125 14.0625)"})),Wr=e=>k.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("path",{d:"M1.25 2.7087C1.25 2.24826 1.62326 1.875 2.0837 1.875H14.339C14.7995 1.875 15.1727 2.24826 15.1727 2.7087V9.31574C15.1727 9.77618 14.7995 10.1494 14.339 10.1494C13.8786 10.1494 13.5053 9.77618 13.5053 9.31574V3.54239H2.91739V16.7565H6.53772H8.34788H9.32435C9.78479 16.7565 10.158 17.1297 10.158 17.5902C10.158 18.0506 9.78479 18.4239 9.32435 18.4239H8.34788H2.0837C1.62326 18.4239 1.25 18.0506 1.25 17.5902V2.7087Z"}),k.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.21129 7.91935C7.70481 7.91935 7.29422 8.32993 7.29422 8.83641C7.29422 9.34289 7.70481 9.75348 8.21129 9.75348C8.71777 9.75348 9.12836 9.34289 9.12836 8.83641C9.12836 8.32993 8.71777 7.91935 8.21129 7.91935ZM5.62683 8.83641C5.62683 7.40905 6.78393 6.25195 8.21129 6.25195C9.63865 6.25195 10.7957 7.40905 10.7957 8.83641C10.7957 10.2638 9.63865 11.4209 8.21129 11.4209C6.78393 11.4209 5.62683 10.2638 5.62683 8.83641Z"}),k.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.62683 13.2133C5.62683 12.7529 6.00009 12.3796 6.46053 12.3796H9.96205C10.4225 12.3796 10.7957 12.7529 10.7957 13.2133C10.7957 13.6737 10.4225 14.047 9.96205 14.047H6.46053C6.00009 14.047 5.62683 13.6737 5.62683 13.2133Z"}),k.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.6406 11.3125C15.8547 11.3125 16.0503 11.434 16.145 11.626L17.1779 13.7184L19.4876 14.056C19.6994 14.087 19.8753 14.2355 19.9413 14.4391C20.0074 14.6427 19.9521 14.8662 19.7987 15.0156L18.1279 16.643L18.5222 18.9421C18.5584 19.1532 18.4716 19.3665 18.2984 19.4923C18.1252 19.6182 17.8955 19.6347 17.706 19.5351L15.6406 18.4489L13.5753 19.5351C13.3858 19.6347 13.1561 19.6182 12.9829 19.4923C12.8096 19.3665 12.7229 19.1532 12.7591 18.9421L13.1534 16.643L11.4825 15.0156C11.3292 14.8662 11.2739 14.6427 11.3399 14.4391C11.406 14.2355 11.5818 14.087 11.7937 14.056L14.1034 13.7184L15.1362 11.626C15.231 11.434 15.4265 11.3125 15.6406 11.3125ZM15.6406 13.1458L14.9815 14.4813C14.8996 14.6471 14.7414 14.7621 14.5584 14.7889L13.0835 15.0044L14.1503 16.0435C14.283 16.1727 14.3435 16.359 14.3122 16.5416L14.0606 18.0088L15.3788 17.3155C15.5427 17.2293 15.7386 17.2293 15.9025 17.3155L17.2207 18.0088L16.969 16.5416C16.9377 16.359 16.9983 16.1727 17.131 16.0435L18.1978 15.0044L16.7229 14.7889C16.5399 14.7621 16.3817 14.6471 16.2998 14.4813L15.6406 13.1458Z"})),qr=e=>k.createElement("svg",{width:20,height:20,viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.88619 1.875C5.0541 1.875 4.24071 2.12174 3.54885 2.58402C2.857 3.0463 2.31777 3.70336 1.99934 4.47211C1.68092 5.24085 1.5976 6.08676 1.75994 6.90285C1.92227 7.71895 2.32295 8.46858 2.91133 9.05695C3.4997 9.64532 4.24933 10.046 5.06543 10.2083C5.88152 10.3707 6.72743 10.2874 7.49617 9.96893C8.26492 9.65051 8.92198 9.11128 9.38426 8.41942C9.84654 7.72757 10.0933 6.91417 10.0933 6.08209C10.0933 4.9663 9.65003 3.89621 8.86105 3.10723C8.07207 2.31825 7.00198 1.875 5.88619 1.875ZM4.11182 4.30773C4.58242 3.83714 5.22067 3.57276 5.88619 3.57276C6.38249 3.57276 6.86764 3.71993 7.2803 3.99566C7.69295 4.27139 8.01458 4.66329 8.20451 5.12181C8.39443 5.58033 8.44413 6.08487 8.3473 6.57164C8.25048 7.0584 8.01149 7.50552 7.66055 7.85645C7.30962 8.20739 6.8625 8.44638 6.37574 8.5432C5.88897 8.64003 5.38443 8.59033 4.92591 8.40041C4.46739 8.21048 4.07549 7.88885 3.79976 7.4762C3.52403 7.06354 3.37686 6.57839 3.37686 6.08209C3.37686 5.41657 3.64123 4.77832 4.11182 4.30773ZM4.20709 10.8302C3.0913 10.8302 2.02121 11.2735 1.23223 12.0624C0.443246 12.8514 0 13.9215 0 15.0373V17.8358C0 17.9955 0.12947 18.125 0.289179 18.125H1.40858C1.56829 18.125 1.69776 17.9955 1.69776 17.8358V15.0373C1.69776 14.3718 1.96214 13.7335 2.43273 13.2629C2.90332 12.7924 3.54157 12.528 4.20709 12.528H7.5653C7.89483 12.528 8.22113 12.5929 8.52558 12.719C8.83002 12.8451 9.10665 13.0299 9.33966 13.2629C9.57267 13.496 9.75751 13.7726 9.88361 14.077C10.0097 14.3815 10.0746 14.7078 10.0746 15.0373V17.8358C10.0746 17.9955 10.2041 18.125 10.3638 18.125H11.4832C11.6429 18.125 11.7724 17.9955 11.7724 17.8358V15.0373C11.7724 13.9215 11.3291 12.8514 10.5402 12.0624C9.75118 11.2735 8.68109 10.8302 7.5653 10.8302H4.20709Z"}),k.createElement("rect",{x:12.5,y:9.375,width:7.5,height:1.875,rx:.9375})),Sa=e=>k.createElement("svg",{width:18,height:19,viewBox:"0 0 18 19",xmlns:"http://www.w3.org/2000/svg",...e},k.createElement("g",{clipPath:"url(#clip0)"},k.createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M8.99997 1.59778C8.19071 1.59778 7.39961 1.83775 6.72673 2.28736C6.05385 2.73697 5.5294 3.37601 5.21971 4.12367C4.91001 4.87134 4.82898 5.69405 4.98686 6.48777C5.14474 7.28149 5.53444 8.01056 6.10668 8.5828C6.67892 9.15504 7.408 9.54474 8.20172 9.70262C8.99544 9.8605 9.81815 9.77947 10.5658 9.46978C11.3135 9.16009 11.9525 8.63564 12.4021 7.96276C12.8517 7.28987 13.0917 6.49878 13.0917 5.68951C13.0917 4.60432 12.6606 3.56357 11.8933 2.79622C11.1259 2.02887 10.0852 1.59778 8.99997 1.59778ZM7.27426 3.9638C7.73195 3.50611 8.35271 3.24899 8.99997 3.24899C9.48266 3.24899 9.95452 3.39212 10.3559 3.66029C10.7572 3.92846 11.07 4.30962 11.2547 4.75556C11.4394 5.20151 11.4878 5.69222 11.3936 6.16563C11.2994 6.63905 11.067 7.07391 10.7257 7.41522C10.3844 7.75654 9.94951 7.98897 9.4761 8.08314C9.00268 8.17731 8.51197 8.12898 8.06603 7.94426C7.62008 7.75954 7.23892 7.44674 6.97075 7.04539C6.70258 6.64405 6.55945 6.1722 6.55945 5.68951C6.55945 5.04224 6.81658 4.42149 7.27426 3.9638ZM7.36691 10.3075C6.28172 10.3075 5.24097 10.7385 4.47362 11.5059C3.70627 12.2732 3.27518 13.314 3.27518 14.3992V17.121C3.27518 17.2763 3.4011 17.4022 3.55643 17.4022H4.64514C4.80047 17.4022 4.92639 17.2763 4.92639 17.121V14.3992C4.92639 13.7519 5.18351 13.1312 5.6412 12.6735C6.09889 12.2158 6.71964 11.9587 7.36691 11.9587H10.633C10.9535 11.9587 11.2709 12.0218 11.567 12.1444C11.8631 12.2671 12.1321 12.4469 12.3588 12.6735C12.5854 12.9001 12.7651 13.1691 12.8878 13.4652C13.0104 13.7613 13.0736 14.0787 13.0736 14.3992V17.121C13.0736 17.2763 13.1995 17.4022 13.3548 17.4022H14.4435C14.5989 17.4022 14.7248 17.2763 14.7248 17.121V14.3992C14.7248 13.314 14.2937 12.2732 13.5263 11.5059C12.759 10.7385 11.7182 10.3075 10.633 10.3075H7.36691Z"})),k.createElement("defs",null,k.createElement("clipPath",{id:"clip0"},k.createElement("rect",{width:18,height:18,transform:"translate(0 0.5)"}))));var zt={},Ut,Gn;function La(){return Gn||(Gn=1,Ut=e=>encodeURIComponent(e).replace(/[!'()*]/g,t=>`%${t.charCodeAt(0).toString(16).toUpperCase()}`)),Ut}var Wt,Zn;function Ia(){if(Zn)return Wt;Zn=1;var e="%[a-f0-9]{2}",t=new RegExp("("+e+")|([^%]+?)","gi"),n=new RegExp("("+e+")+","gi");function r(a,i){try{return[decodeURIComponent(a.join(""))]}catch{}if(a.length===1)return a;i=i||1;var c=a.slice(0,i),f=a.slice(i);return Array.prototype.concat.call([],r(c),r(f))}function s(a){try{return decodeURIComponent(a)}catch{for(var i=a.match(t)||[],c=1;c<i.length;c++)a=r(i,c).join(""),i=a.match(t)||[];return a}}function l(a){for(var i={"%FE%FF":"��","%FF%FE":"��"},c=n.exec(a);c;){try{i[c[0]]=decodeURIComponent(c[0])}catch{var f=s(c[0]);f!==c[0]&&(i[c[0]]=f)}c=n.exec(a)}i["%C2"]="�";for(var u=Object.keys(i),h=0;h<u.length;h++){var x=u[h];a=a.replace(new RegExp(x,"g"),i[x])}return a}return Wt=function(a){if(typeof a!="string")throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof a+"`");try{return a=a.replace(/\+/g," "),decodeURIComponent(a)}catch{return l(a)}},Wt}var qt,Xn;function Pa(){return Xn||(Xn=1,qt=(e,t)=>{if(!(typeof e=="string"&&typeof t=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(t==="")return[e];const n=e.indexOf(t);return n===-1?[e]:[e.slice(0,n),e.slice(n+t.length)]}),qt}var Ht,Qn;function Aa(){return Qn||(Qn=1,Ht=function(e,t){for(var n={},r=Object.keys(e),s=Array.isArray(t),l=0;l<r.length;l++){var a=r[l],i=e[a];(s?t.indexOf(a)!==-1:t(a,i,e))&&(n[a]=i)}return n}),Ht}var Jn;function Ta(){return Jn||(Jn=1,function(e){const t=La(),n=Ia(),r=Pa(),s=Aa(),l=d=>d==null;function a(d){switch(d.arrayFormat){case"index":return m=>(y,g)=>{const w=y.length;return g===void 0||d.skipNull&&g===null||d.skipEmptyString&&g===""?y:g===null?[...y,[f(m,d),"[",w,"]"].join("")]:[...y,[f(m,d),"[",f(w,d),"]=",f(g,d)].join("")]};case"bracket":return m=>(y,g)=>g===void 0||d.skipNull&&g===null||d.skipEmptyString&&g===""?y:g===null?[...y,[f(m,d),"[]"].join("")]:[...y,[f(m,d),"[]=",f(g,d)].join("")];case"comma":case"separator":return m=>(y,g)=>g==null||g.length===0?y:y.length===0?[[f(m,d),"=",f(g,d)].join("")]:[[y,f(g,d)].join(d.arrayFormatSeparator)];default:return m=>(y,g)=>g===void 0||d.skipNull&&g===null||d.skipEmptyString&&g===""?y:g===null?[...y,f(m,d)]:[...y,[f(m,d),"=",f(g,d)].join("")]}}function i(d){let m;switch(d.arrayFormat){case"index":return(y,g,w)=>{if(m=/\[(\d*)\]$/.exec(y),y=y.replace(/\[\d*\]$/,""),!m){w[y]=g;return}w[y]===void 0&&(w[y]={}),w[y][m[1]]=g};case"bracket":return(y,g,w)=>{if(m=/(\[\])$/.exec(y),y=y.replace(/\[\]$/,""),!m){w[y]=g;return}if(w[y]===void 0){w[y]=[g];return}w[y]=[].concat(w[y],g)};case"comma":case"separator":return(y,g,w)=>{const P=typeof g=="string"&&g.includes(d.arrayFormatSeparator),b=typeof g=="string"&&!P&&u(g,d).includes(d.arrayFormatSeparator);g=b?u(g,d):g;const L=P||b?g.split(d.arrayFormatSeparator).map(T=>u(T,d)):g===null?g:u(g,d);w[y]=L};default:return(y,g,w)=>{if(w[y]===void 0){w[y]=g;return}w[y]=[].concat(w[y],g)}}}function c(d){if(typeof d!="string"||d.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function f(d,m){return m.encode?m.strict?t(d):encodeURIComponent(d):d}function u(d,m){return m.decode?n(d):d}function h(d){return Array.isArray(d)?d.sort():typeof d=="object"?h(Object.keys(d)).sort((m,y)=>Number(m)-Number(y)).map(m=>d[m]):d}function x(d){const m=d.indexOf("#");return m!==-1&&(d=d.slice(0,m)),d}function j(d){let m="";const y=d.indexOf("#");return y!==-1&&(m=d.slice(y)),m}function v(d){d=x(d);const m=d.indexOf("?");return m===-1?"":d.slice(m+1)}function S(d,m){return m.parseNumbers&&!Number.isNaN(Number(d))&&typeof d=="string"&&d.trim()!==""?d=Number(d):m.parseBooleans&&d!==null&&(d.toLowerCase()==="true"||d.toLowerCase()==="false")&&(d=d.toLowerCase()==="true"),d}function p(d,m){m=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},m),c(m.arrayFormatSeparator);const y=i(m),g=Object.create(null);if(typeof d!="string"||(d=d.trim().replace(/^[?#&]/,""),!d))return g;for(const w of d.split("&")){if(w==="")continue;let[P,b]=r(m.decode?w.replace(/\+/g," "):w,"=");b=b===void 0?null:["comma","separator"].includes(m.arrayFormat)?b:u(b,m),y(u(P,m),b,g)}for(const w of Object.keys(g)){const P=g[w];if(typeof P=="object"&&P!==null)for(const b of Object.keys(P))P[b]=S(P[b],m);else g[w]=S(P,m)}return m.sort===!1?g:(m.sort===!0?Object.keys(g).sort():Object.keys(g).sort(m.sort)).reduce((w,P)=>{const b=g[P];return b&&typeof b=="object"&&!Array.isArray(b)?w[P]=h(b):w[P]=b,w},Object.create(null))}e.extract=v,e.parse=p,e.stringify=(d,m)=>{if(!d)return"";m=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},m),c(m.arrayFormatSeparator);const y=b=>m.skipNull&&l(d[b])||m.skipEmptyString&&d[b]==="",g=a(m),w={};for(const b of Object.keys(d))y(b)||(w[b]=d[b]);const P=Object.keys(w);return m.sort!==!1&&P.sort(m.sort),P.map(b=>{const L=d[b];return L===void 0?"":L===null?f(b,m):Array.isArray(L)?L.reduce(g(b),[]).join("&"):f(b,m)+"="+f(L,m)}).filter(b=>b.length>0).join("&")},e.parseUrl=(d,m)=>{m=Object.assign({decode:!0},m);const[y,g]=r(d,"#");return Object.assign({url:y.split("?")[0]||"",query:p(v(d),m)},m&&m.parseFragmentIdentifier&&g?{fragmentIdentifier:u(g,m)}:{})},e.stringifyUrl=(d,m)=>{m=Object.assign({encode:!0,strict:!0},m);const y=x(d.url).split("?")[0]||"",g=e.extract(d.url),w=e.parse(g,{sort:!1}),P=Object.assign(w,d.query);let b=e.stringify(P,m);b&&(b=`?${b}`);let L=j(d.url);return d.fragmentIdentifier&&(L=`#${f(d.fragmentIdentifier,m)}`),`${y}${b}${L}`},e.pick=(d,m,y)=>{y=Object.assign({parseFragmentIdentifier:!0},y);const{url:g,query:w,fragmentIdentifier:P}=e.parseUrl(d,y);return e.stringifyUrl({url:g,query:s(w,m),fragmentIdentifier:P},y)},e.exclude=(d,m,y)=>{const g=Array.isArray(m)?w=>!m.includes(w):(w,P)=>!m(w,P);return e.pick(d,g,y)}}(zt)),zt}var Kt=Ta();const Je=ao,Ea={parseNumbers:!1,parseBooleans:!1},Ra={skipNull:!1,skipEmptyString:!1},_a=(e,t)=>{var n,r;const{navigateMode:s="push",parseOptions:l,stringifyOptions:a}={},i=Object.assign(Object.assign({},Ea),l),c=Object.assign(Object.assign({},Ra),a),f=Je.useLocation(),u=(n=Je.useHistory)===null||n===void 0?void 0:n.call(Je),h=(r=Je.useNavigate)===null||r===void 0?void 0:r.call(Je),x=ca(),j=k.useRef(typeof e=="function"?e():e||{}),v=k.useMemo(()=>Kt.parse(f.search,i),[f.search]),S=k.useMemo(()=>Object.assign(Object.assign({},j.current),v),[v]);return[S,yn(d=>{const m=typeof d=="function"?d(S):d;x(),u&&u[s]({hash:f.hash,search:Kt.stringify(Object.assign(Object.assign({},v),m),c)||"?"},f.state),h&&h({hash:f.hash,search:Kt.stringify(Object.assign(Object.assign({},v),m),c)||"?"},{replace:s==="replace",state:f.state})})]};var Yt,er;function Oa(){if(er)return Yt;er=1;const e=Ar(),t=Zo(),n=Wo(),r=ba(),s={role:e.types.RoleType.ROLE_APPLICATION};return Yt=(a,i,c,f)=>{let u=c||s;const h=(0,n.isEthereumType)((0,n.DidType)(c));if(h?u=(0,t.WalletType)(c):u=(0,t.WalletType)(s),!(0,n.isValid)(a)){let x="";try{return h?x=a.slice(0,66):x=a,(0,t.fromSecretKey)(x,u)}catch(j){throw new Error(`Cannot get blocklet wallet with invalid blocklet did or custom sk: ${j.message}`)}}if(!i)throw new Error("Cannot get blocklet wallet with empty node sk");return(0,r.fromAppDid)(a,i,u,f||0)},Yt}var et,tr;function Ma(){if(tr)return et;tr=1;var e=et&&et.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};const t=e(Xo),n=Ar(),r=e(Oa()),s=Qo();return et=(a,i,{returnWallet:c=!0}={})=>{if(!a||typeof a!="object"||!Array.isArray(a.environments)||!(0,t.default)(a,"meta.did"))throw new Error("Blocklet state must be an object");const{environments:f,configs:u=[]}=a,h=[...u,...f],x=h.find(H=>H.key==="BLOCKLET_APP_DESCRIPTION"),j=h.find(H=>H.key==="BLOCKLET_PASSPORT_COLOR"),v=h.find(H=>H.key==="BLOCKLET_APP_URL"),S=h.find(H=>H.key==="BLOCKLET_APP_TENANT_MODE"),{did:p,version:d}=a.meta,m=(0,s.getDisplayName)(a),y=(0,t.default)(x,"value",a.meta.description),g=(0,t.default)(j,"value","auto"),w=(0,t.default)(v,"value",""),P=(0,t.default)(S,"value","");if(!c)return{did:p,version:d,name:m,description:y,passportColor:g,appUrl:w,secret:"",wallet:null,permanentWallet:null,tenantMode:P};const b=h.find(H=>H.key==="BLOCKLET_APP_SK"),L=h.find(H=>H.key==="BLOCKLET_APP_CHAIN_TYPE")||h.find(H=>H.key==="BLOCKLET_WALLET_TYPE"),T=h.find(H=>H.key==="BLOCKLET_APP_PSK");let _;L&&(L.value==="ethereum"||L.value==="eth")&&(_=L.value);let O=null,M=null;if(b&&b.value)O=(0,r.default)(b.value,void 0,_),T&&T.value&&T.value!==b.value&&(M=(0,r.default)(T.value,void 0,_));else{if(!i||typeof i!="string")throw new Error("Node secret key must be a string");L?O=(0,r.default)(a.meta.did,i,_):O=(0,r.default)(a.meta.did,i)}const B=a.settings?.session?.salt||"",V=n.Hasher.SHA3.hash256(Hn.concat([O.secretKey,O.address,B].filter(Boolean).map(H=>Hn.from(H))));return{did:p,version:d,name:m,description:y,passportColor:g,appUrl:w,secret:V,wallet:O,permanentWallet:M||O,tenantMode:P}},et}var Na=Ma();const Da=io(Na),{min:$a,max:Ba}=Math,Oe=(e,t=0,n=1)=>$a(Ba(t,e),n),jn=e=>{e._clipped=!1,e._unclipped=e.slice(0);for(let t=0;t<=3;t++)t<3?((e[t]<0||e[t]>255)&&(e._clipped=!0),e[t]=Oe(e[t],0,255)):t===3&&(e[t]=Oe(e[t],0,1));return e},Hr={};for(let e of["Boolean","Number","String","Function","Array","Date","RegExp","Undefined","Null"])Hr[`[object ${e}]`]=e.toLowerCase();function W(e){return Hr[Object.prototype.toString.call(e)]||"object"}const z=(e,t=null)=>e.length>=3?Array.prototype.slice.call(e):W(e[0])=="object"&&t?t.split("").filter(n=>e[0][n]!==void 0).map(n=>e[0][n]):e[0].slice(0),Ke=e=>{if(e.length<2)return null;const t=e.length-1;return W(e[t])=="string"?e[t].toLowerCase():null},{PI:Rt,min:Kr,max:Yr}=Math,ie=e=>Math.round(e*100)/100,fn=e=>Math.round(e*100)/100,je=Rt*2,Vt=Rt/3,Fa=Rt/180,za=180/Rt;function Vr(e){return[...e.slice(0,3).reverse(),...e.slice(3)]}const F={format:{},autodetect:[]};class I{constructor(...t){const n=this;if(W(t[0])==="object"&&t[0].constructor&&t[0].constructor===this.constructor)return t[0];let r=Ke(t),s=!1;if(!r){s=!0,F.sorted||(F.autodetect=F.autodetect.sort((l,a)=>a.p-l.p),F.sorted=!0);for(let l of F.autodetect)if(r=l.test(...t),r)break}if(F.format[r]){const l=F.format[r].apply(null,s?t:t.slice(0,-1));n._rgb=jn(l)}else throw new Error("unknown format: "+t);n._rgb.length===3&&n._rgb.push(1)}toString(){return W(this.hex)=="function"?this.hex():`[${this._rgb.join(",")}]`}}const Ua="3.1.2",U=(...e)=>new I(...e);U.version=Ua;const qe={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",laserlemon:"#ffff54",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrod:"#fafad2",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",maroon2:"#7f0000",maroon3:"#b03060",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",purple2:"#7f007f",purple3:"#a020f0",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"},Wa=/^#?([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/,qa=/^#?([A-Fa-f0-9]{8}|[A-Fa-f0-9]{4})$/,Gr=e=>{if(e.match(Wa)){(e.length===4||e.length===7)&&(e=e.substr(1)),e.length===3&&(e=e.split(""),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]);const t=parseInt(e,16),n=t>>16,r=t>>8&255,s=t&255;return[n,r,s,1]}if(e.match(qa)){(e.length===5||e.length===9)&&(e=e.substr(1)),e.length===4&&(e=e.split(""),e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]);const t=parseInt(e,16),n=t>>24&255,r=t>>16&255,s=t>>8&255,l=Math.round((t&255)/255*100)/100;return[n,r,s,l]}throw new Error(`unknown hex color: ${e}`)},{round:ht}=Math,Zr=(...e)=>{let[t,n,r,s]=z(e,"rgba"),l=Ke(e)||"auto";s===void 0&&(s=1),l==="auto"&&(l=s<1?"rgba":"rgb"),t=ht(t),n=ht(n),r=ht(r);let i="000000"+(t<<16|n<<8|r).toString(16);i=i.substr(i.length-6);let c="0"+ht(s*255).toString(16);switch(c=c.substr(c.length-2),l.toLowerCase()){case"rgba":return`#${i}${c}`;case"argb":return`#${c}${i}`;default:return`#${i}`}};I.prototype.name=function(){const e=Zr(this._rgb,"rgb");for(let t of Object.keys(qe))if(qe[t]===e)return t.toLowerCase();return e};F.format.named=e=>{if(e=e.toLowerCase(),qe[e])return Gr(qe[e]);throw new Error("unknown color name: "+e)};F.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&W(e)==="string"&&qe[e.toLowerCase()])return"named"}});I.prototype.alpha=function(e,t=!1){return e!==void 0&&W(e)==="number"?t?(this._rgb[3]=e,this):new I([this._rgb[0],this._rgb[1],this._rgb[2],e],"rgb"):this._rgb[3]};I.prototype.clipped=function(){return this._rgb._clipped||!1};const ve={Kn:18,labWhitePoint:"d65",Xn:.95047,Yn:1,Zn:1.08883,kE:216/24389,kKE:8,kK:24389/27,RefWhiteRGB:{X:.95047,Y:1,Z:1.08883},MtxRGB2XYZ:{m00:.4124564390896922,m01:.21267285140562253,m02:.0193338955823293,m10:.357576077643909,m11:.715152155287818,m12:.11919202588130297,m20:.18043748326639894,m21:.07217499330655958,m22:.9503040785363679},MtxXYZ2RGB:{m00:3.2404541621141045,m01:-.9692660305051868,m02:.055643430959114726,m10:-1.5371385127977166,m11:1.8760108454466942,m12:-.2040259135167538,m20:-.498531409556016,m21:.041556017530349834,m22:1.0572251882231791},As:.9414285350000001,Bs:1.040417467,Cs:1.089532651,MtxAdaptMa:{m00:.8951,m01:-.7502,m02:.0389,m10:.2664,m11:1.7135,m12:-.0685,m20:-.1614,m21:.0367,m22:1.0296},MtxAdaptMaI:{m00:.9869929054667123,m01:.43230526972339456,m02:-.008528664575177328,m10:-.14705425642099013,m11:.5183602715367776,m12:.04004282165408487,m20:.15996265166373125,m21:.0492912282128556,m22:.9684866957875502}},Ha=new Map([["a",[1.0985,.35585]],["b",[1.0985,.35585]],["c",[.98074,1.18232]],["d50",[.96422,.82521]],["d55",[.95682,.92149]],["d65",[.95047,1.08883]],["e",[1,1,1]],["f2",[.99186,.67393]],["f7",[.95041,1.08747]],["f11",[1.00962,.6435]],["icc",[.96422,.82521]]]);function we(e){const t=Ha.get(String(e).toLowerCase());if(!t)throw new Error("unknown Lab illuminant "+e);ve.labWhitePoint=e,ve.Xn=t[0],ve.Zn=t[1]}function at(){return ve.labWhitePoint}const wn=(...e)=>{e=z(e,"lab");const[t,n,r]=e,[s,l,a]=Ka(t,n,r),[i,c,f]=Xr(s,l,a);return[i,c,f,e.length>3?e[3]:1]},Ka=(e,t,n)=>{const{kE:r,kK:s,kKE:l,Xn:a,Yn:i,Zn:c}=ve,f=(e+16)/116,u=.002*t+f,h=f-.005*n,x=u*u*u,j=h*h*h,v=x>r?x:(116*u-16)/s,S=e>l?Math.pow((e+16)/116,3):e/s,p=j>r?j:(116*h-16)/s,d=v*a,m=S*i,y=p*c;return[d,m,y]},Gt=e=>{const t=Math.sign(e);return e=Math.abs(e),(e<=.0031308?e*12.92:1.055*Math.pow(e,1/2.4)-.055)*t},Xr=(e,t,n)=>{const{MtxAdaptMa:r,MtxAdaptMaI:s,MtxXYZ2RGB:l,RefWhiteRGB:a,Xn:i,Yn:c,Zn:f}=ve,u=i*r.m00+c*r.m10+f*r.m20,h=i*r.m01+c*r.m11+f*r.m21,x=i*r.m02+c*r.m12+f*r.m22,j=a.X*r.m00+a.Y*r.m10+a.Z*r.m20,v=a.X*r.m01+a.Y*r.m11+a.Z*r.m21,S=a.X*r.m02+a.Y*r.m12+a.Z*r.m22,p=(e*r.m00+t*r.m10+n*r.m20)*(j/u),d=(e*r.m01+t*r.m11+n*r.m21)*(v/h),m=(e*r.m02+t*r.m12+n*r.m22)*(S/x),y=p*s.m00+d*s.m10+m*s.m20,g=p*s.m01+d*s.m11+m*s.m21,w=p*s.m02+d*s.m12+m*s.m22,P=Gt(y*l.m00+g*l.m10+w*l.m20),b=Gt(y*l.m01+g*l.m11+w*l.m21),L=Gt(y*l.m02+g*l.m12+w*l.m22);return[P*255,b*255,L*255]},kn=(...e)=>{const[t,n,r,...s]=z(e,"rgb"),[l,a,i]=Qr(t,n,r),[c,f,u]=Ya(l,a,i);return[c,f,u,...s.length>0&&s[0]<1?[s[0]]:[]]};function Ya(e,t,n){const{Xn:r,Yn:s,Zn:l,kE:a,kK:i}=ve,c=e/r,f=t/s,u=n/l,h=c>a?Math.pow(c,1/3):(i*c+16)/116,x=f>a?Math.pow(f,1/3):(i*f+16)/116,j=u>a?Math.pow(u,1/3):(i*u+16)/116;return[116*x-16,500*(h-x),200*(x-j)]}function Zt(e){const t=Math.sign(e);return e=Math.abs(e),(e<=.04045?e/12.92:Math.pow((e+.055)/1.055,2.4))*t}const Qr=(e,t,n)=>{e=Zt(e/255),t=Zt(t/255),n=Zt(n/255);const{MtxRGB2XYZ:r,MtxAdaptMa:s,MtxAdaptMaI:l,Xn:a,Yn:i,Zn:c,As:f,Bs:u,Cs:h}=ve;let x=e*r.m00+t*r.m10+n*r.m20,j=e*r.m01+t*r.m11+n*r.m21,v=e*r.m02+t*r.m12+n*r.m22;const S=a*s.m00+i*s.m10+c*s.m20,p=a*s.m01+i*s.m11+c*s.m21,d=a*s.m02+i*s.m12+c*s.m22;let m=x*s.m00+j*s.m10+v*s.m20,y=x*s.m01+j*s.m11+v*s.m21,g=x*s.m02+j*s.m12+v*s.m22;return m*=S/f,y*=p/u,g*=d/h,x=m*l.m00+y*l.m10+g*l.m20,j=m*l.m01+y*l.m11+g*l.m21,v=m*l.m02+y*l.m12+g*l.m22,[x,j,v]};I.prototype.lab=function(){return kn(this._rgb)};const Va=(...e)=>new I(...e,"lab");Object.assign(U,{lab:Va,getLabWhitePoint:at,setLabWhitePoint:we});F.format.lab=wn;F.autodetect.push({p:2,test:(...e)=>{if(e=z(e,"lab"),W(e)==="array"&&e.length===3)return"lab"}});I.prototype.darken=function(e=1){const t=this,n=t.lab();return n[0]-=ve.Kn*e,new I(n,"lab").alpha(t.alpha(),!0)};I.prototype.brighten=function(e=1){return this.darken(-e)};I.prototype.darker=I.prototype.darken;I.prototype.brighter=I.prototype.brighten;I.prototype.get=function(e){const[t,n]=e.split("."),r=this[t]();if(n){const s=t.indexOf(n)-(t.substr(0,2)==="ok"?2:0);if(s>-1)return r[s];throw new Error(`unknown channel ${n} in mode ${t}`)}else return r};const{pow:Ga}=Math,Za=1e-7,Xa=20;I.prototype.luminance=function(e,t="rgb"){if(e!==void 0&&W(e)==="number"){if(e===0)return new I([0,0,0,this._rgb[3]],"rgb");if(e===1)return new I([255,255,255,this._rgb[3]],"rgb");let n=this.luminance(),r=Xa;const s=(a,i)=>{const c=a.interpolate(i,.5,t),f=c.luminance();return Math.abs(e-f)<Za||!r--?c:f>e?s(a,c):s(c,i)},l=(n>e?s(new I([0,0,0]),this):s(this,new I([255,255,255]))).rgb();return new I([...l,this._rgb[3]])}return Qa(...this._rgb.slice(0,3))};const Qa=(e,t,n)=>(e=Xt(e),t=Xt(t),n=Xt(n),.2126*e+.7152*t+.0722*n),Xt=e=>(e/=255,e<=.03928?e/12.92:Ga((e+.055)/1.055,2.4)),te={},He=(e,t,n=.5,...r)=>{let s=r[0]||"lrgb";if(!te[s]&&!r.length&&(s=Object.keys(te)[0]),!te[s])throw new Error(`interpolation mode ${s} is not defined`);return W(e)!=="object"&&(e=new I(e)),W(t)!=="object"&&(t=new I(t)),te[s](e,t,n).alpha(e.alpha()+n*(t.alpha()-e.alpha()))};I.prototype.mix=I.prototype.interpolate=function(e,t=.5,...n){return He(this,e,t,...n)};I.prototype.premultiply=function(e=!1){const t=this._rgb,n=t[3];return e?(this._rgb=[t[0]*n,t[1]*n,t[2]*n,n],this):new I([t[0]*n,t[1]*n,t[2]*n,n],"rgb")};const{sin:Ja,cos:ei}=Math,Jr=(...e)=>{let[t,n,r]=z(e,"lch");return isNaN(r)&&(r=0),r=r*Fa,[t,ei(r)*n,Ja(r)*n]},Sn=(...e)=>{e=z(e,"lch");const[t,n,r]=e,[s,l,a]=Jr(t,n,r),[i,c,f]=wn(s,l,a);return[i,c,f,e.length>3?e[3]:1]},ti=(...e)=>{const t=Vr(z(e,"hcl"));return Sn(...t)},{sqrt:ni,atan2:ri,round:si}=Math,es=(...e)=>{const[t,n,r]=z(e,"lab"),s=ni(n*n+r*r);let l=(ri(r,n)*za+360)%360;return si(s*1e4)===0&&(l=Number.NaN),[t,s,l]},Ln=(...e)=>{const[t,n,r,...s]=z(e,"rgb"),[l,a,i]=kn(t,n,r),[c,f,u]=es(l,a,i);return[c,f,u,...s.length>0&&s[0]<1?[s[0]]:[]]};I.prototype.lch=function(){return Ln(this._rgb)};I.prototype.hcl=function(){return Vr(Ln(this._rgb))};const oi=(...e)=>new I(...e,"lch"),ai=(...e)=>new I(...e,"hcl");Object.assign(U,{lch:oi,hcl:ai});F.format.lch=Sn;F.format.hcl=ti;["lch","hcl"].forEach(e=>F.autodetect.push({p:2,test:(...t)=>{if(t=z(t,e),W(t)==="array"&&t.length===3)return e}}));I.prototype.saturate=function(e=1){const t=this,n=t.lch();return n[1]+=ve.Kn*e,n[1]<0&&(n[1]=0),new I(n,"lch").alpha(t.alpha(),!0)};I.prototype.desaturate=function(e=1){return this.saturate(-e)};I.prototype.set=function(e,t,n=!1){const[r,s]=e.split("."),l=this[r]();if(s){const a=r.indexOf(s)-(r.substr(0,2)==="ok"?2:0);if(a>-1){if(W(t)=="string")switch(t.charAt(0)){case"+":l[a]+=+t;break;case"-":l[a]+=+t;break;case"*":l[a]*=+t.substr(1);break;case"/":l[a]/=+t.substr(1);break;default:l[a]=+t}else if(W(t)==="number")l[a]=t;else throw new Error("unsupported value for Color.set");const i=new I(l,r);return n?(this._rgb=i._rgb,this):i}throw new Error(`unknown channel ${s} in mode ${r}`)}else return l};I.prototype.tint=function(e=.5,...t){return He(this,"white",e,...t)};I.prototype.shade=function(e=.5,...t){return He(this,"black",e,...t)};const ii=(e,t,n)=>{const r=e._rgb,s=t._rgb;return new I(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"rgb")};te.rgb=ii;const{sqrt:Qt,pow:De}=Math,li=(e,t,n)=>{const[r,s,l]=e._rgb,[a,i,c]=t._rgb;return new I(Qt(De(r,2)*(1-n)+De(a,2)*n),Qt(De(s,2)*(1-n)+De(i,2)*n),Qt(De(l,2)*(1-n)+De(c,2)*n),"rgb")};te.lrgb=li;const ci=(e,t,n)=>{const r=e.lab(),s=t.lab();return new I(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"lab")};te.lab=ci;const Ye=(e,t,n,r)=>{let s,l;r==="hsl"?(s=e.hsl(),l=t.hsl()):r==="hsv"?(s=e.hsv(),l=t.hsv()):r==="hcg"?(s=e.hcg(),l=t.hcg()):r==="hsi"?(s=e.hsi(),l=t.hsi()):r==="lch"||r==="hcl"?(r="hcl",s=e.hcl(),l=t.hcl()):r==="oklch"&&(s=e.oklch().reverse(),l=t.oklch().reverse());let a,i,c,f,u,h;(r.substr(0,1)==="h"||r==="oklch")&&([a,c,u]=s,[i,f,h]=l);let x,j,v,S;return!isNaN(a)&&!isNaN(i)?(i>a&&i-a>180?S=i-(a+360):i<a&&a-i>180?S=i+360-a:S=i-a,j=a+n*S):isNaN(a)?isNaN(i)?j=Number.NaN:(j=i,(u==1||u==0)&&r!="hsv"&&(x=f)):(j=a,(h==1||h==0)&&r!="hsv"&&(x=c)),x===void 0&&(x=c+n*(f-c)),v=u+n*(h-u),r==="oklch"?new I([v,x,j],r):new I([j,x,v],r)},ts=(e,t,n)=>Ye(e,t,n,"lch");te.lch=ts;te.hcl=ts;const di=e=>{if(W(e)=="number"&&e>=0&&e<=16777215){const t=e>>16,n=e>>8&255,r=e&255;return[t,n,r,1]}throw new Error("unknown num color: "+e)},ui=(...e)=>{const[t,n,r]=z(e,"rgb");return(t<<16)+(n<<8)+r};I.prototype.num=function(){return ui(this._rgb)};const fi=(...e)=>new I(...e,"num");Object.assign(U,{num:fi});F.format.num=di;F.autodetect.push({p:5,test:(...e)=>{if(e.length===1&&W(e[0])==="number"&&e[0]>=0&&e[0]<=16777215)return"num"}});const pi=(e,t,n)=>{const r=e.num(),s=t.num();return new I(r+n*(s-r),"num")};te.num=pi;const{floor:mi}=Math,hi=(...e)=>{e=z(e,"hcg");let[t,n,r]=e,s,l,a;r=r*255;const i=n*255;if(n===0)s=l=a=r;else{t===360&&(t=0),t>360&&(t-=360),t<0&&(t+=360),t/=60;const c=mi(t),f=t-c,u=r*(1-n),h=u+i*(1-f),x=u+i*f,j=u+i;switch(c){case 0:[s,l,a]=[j,x,u];break;case 1:[s,l,a]=[h,j,u];break;case 2:[s,l,a]=[u,j,x];break;case 3:[s,l,a]=[u,h,j];break;case 4:[s,l,a]=[x,u,j];break;case 5:[s,l,a]=[j,u,h];break}}return[s,l,a,e.length>3?e[3]:1]},bi=(...e)=>{const[t,n,r]=z(e,"rgb"),s=Kr(t,n,r),l=Yr(t,n,r),a=l-s,i=a*100/255,c=s/(255-a)*100;let f;return a===0?f=Number.NaN:(t===l&&(f=(n-r)/a),n===l&&(f=2+(r-t)/a),r===l&&(f=4+(t-n)/a),f*=60,f<0&&(f+=360)),[f,i,c]};I.prototype.hcg=function(){return bi(this._rgb)};const gi=(...e)=>new I(...e,"hcg");U.hcg=gi;F.format.hcg=hi;F.autodetect.push({p:1,test:(...e)=>{if(e=z(e,"hcg"),W(e)==="array"&&e.length===3)return"hcg"}});const xi=(e,t,n)=>Ye(e,t,n,"hcg");te.hcg=xi;const{cos:$e}=Math,yi=(...e)=>{e=z(e,"hsi");let[t,n,r]=e,s,l,a;return isNaN(t)&&(t=0),isNaN(n)&&(n=0),t>360&&(t-=360),t<0&&(t+=360),t/=360,t<1/3?(a=(1-n)/3,s=(1+n*$e(je*t)/$e(Vt-je*t))/3,l=1-(a+s)):t<2/3?(t-=1/3,s=(1-n)/3,l=(1+n*$e(je*t)/$e(Vt-je*t))/3,a=1-(s+l)):(t-=2/3,l=(1-n)/3,a=(1+n*$e(je*t)/$e(Vt-je*t))/3,s=1-(l+a)),s=Oe(r*s*3),l=Oe(r*l*3),a=Oe(r*a*3),[s*255,l*255,a*255,e.length>3?e[3]:1]},{min:vi,sqrt:Ci,acos:ji}=Math,wi=(...e)=>{let[t,n,r]=z(e,"rgb");t/=255,n/=255,r/=255;let s;const l=vi(t,n,r),a=(t+n+r)/3,i=a>0?1-l/a:0;return i===0?s=NaN:(s=(t-n+(t-r))/2,s/=Ci((t-n)*(t-n)+(t-r)*(n-r)),s=ji(s),r>n&&(s=je-s),s/=je),[s*360,i,a]};I.prototype.hsi=function(){return wi(this._rgb)};const ki=(...e)=>new I(...e,"hsi");U.hsi=ki;F.format.hsi=yi;F.autodetect.push({p:2,test:(...e)=>{if(e=z(e,"hsi"),W(e)==="array"&&e.length===3)return"hsi"}});const Si=(e,t,n)=>Ye(e,t,n,"hsi");te.hsi=Si;const pn=(...e)=>{e=z(e,"hsl");const[t,n,r]=e;let s,l,a;if(n===0)s=l=a=r*255;else{const i=[0,0,0],c=[0,0,0],f=r<.5?r*(1+n):r+n-r*n,u=2*r-f,h=t/360;i[0]=h+1/3,i[1]=h,i[2]=h-1/3;for(let x=0;x<3;x++)i[x]<0&&(i[x]+=1),i[x]>1&&(i[x]-=1),6*i[x]<1?c[x]=u+(f-u)*6*i[x]:2*i[x]<1?c[x]=f:3*i[x]<2?c[x]=u+(f-u)*(2/3-i[x])*6:c[x]=u;[s,l,a]=[c[0]*255,c[1]*255,c[2]*255]}return e.length>3?[s,l,a,e[3]]:[s,l,a,1]},ns=(...e)=>{e=z(e,"rgba");let[t,n,r]=e;t/=255,n/=255,r/=255;const s=Kr(t,n,r),l=Yr(t,n,r),a=(l+s)/2;let i,c;return l===s?(i=0,c=Number.NaN):i=a<.5?(l-s)/(l+s):(l-s)/(2-l-s),t==l?c=(n-r)/(l-s):n==l?c=2+(r-t)/(l-s):r==l&&(c=4+(t-n)/(l-s)),c*=60,c<0&&(c+=360),e.length>3&&e[3]!==void 0?[c,i,a,e[3]]:[c,i,a]};I.prototype.hsl=function(){return ns(this._rgb)};const Li=(...e)=>new I(...e,"hsl");U.hsl=Li;F.format.hsl=pn;F.autodetect.push({p:2,test:(...e)=>{if(e=z(e,"hsl"),W(e)==="array"&&e.length===3)return"hsl"}});const Ii=(e,t,n)=>Ye(e,t,n,"hsl");te.hsl=Ii;const{floor:Pi}=Math,Ai=(...e)=>{e=z(e,"hsv");let[t,n,r]=e,s,l,a;if(r*=255,n===0)s=l=a=r;else{t===360&&(t=0),t>360&&(t-=360),t<0&&(t+=360),t/=60;const i=Pi(t),c=t-i,f=r*(1-n),u=r*(1-n*c),h=r*(1-n*(1-c));switch(i){case 0:[s,l,a]=[r,h,f];break;case 1:[s,l,a]=[u,r,f];break;case 2:[s,l,a]=[f,r,h];break;case 3:[s,l,a]=[f,u,r];break;case 4:[s,l,a]=[h,f,r];break;case 5:[s,l,a]=[r,f,u];break}}return[s,l,a,e.length>3?e[3]:1]},{min:Ti,max:Ei}=Math,Ri=(...e)=>{e=z(e,"rgb");let[t,n,r]=e;const s=Ti(t,n,r),l=Ei(t,n,r),a=l-s;let i,c,f;return f=l/255,l===0?(i=Number.NaN,c=0):(c=a/l,t===l&&(i=(n-r)/a),n===l&&(i=2+(r-t)/a),r===l&&(i=4+(t-n)/a),i*=60,i<0&&(i+=360)),[i,c,f]};I.prototype.hsv=function(){return Ri(this._rgb)};const _i=(...e)=>new I(...e,"hsv");U.hsv=_i;F.format.hsv=Ai;F.autodetect.push({p:2,test:(...e)=>{if(e=z(e,"hsv"),W(e)==="array"&&e.length===3)return"hsv"}});const Oi=(e,t,n)=>Ye(e,t,n,"hsv");te.hsv=Oi;function St(e,t){let n=e.length;Array.isArray(e[0])||(e=[e]),Array.isArray(t[0])||(t=t.map(a=>[a]));let r=t[0].length,s=t[0].map((a,i)=>t.map(c=>c[i])),l=e.map(a=>s.map(i=>Array.isArray(a)?a.reduce((c,f,u)=>c+f*(i[u]||0),0):i.reduce((c,f)=>c+f*a,0)));return n===1&&(l=l[0]),r===1?l.map(a=>a[0]):l}const In=(...e)=>{e=z(e,"lab");const[t,n,r,...s]=e,[l,a,i]=Mi([t,n,r]),[c,f,u]=Xr(l,a,i);return[c,f,u,...s.length>0&&s[0]<1?[s[0]]:[]]};function Mi(e){var t=[[1.2268798758459243,-.5578149944602171,.2813910456659647],[-.0405757452148008,1.112286803280317,-.0717110580655164],[-.0763729366746601,-.4214933324022432,1.5869240198367816]],n=[[1,.3963377773761749,.2158037573099136],[1,-.1055613458156586,-.0638541728258133],[1,-.0894841775298119,-1.2914855480194092]],r=St(n,e);return St(t,r.map(s=>s**3))}const Pn=(...e)=>{const[t,n,r,...s]=z(e,"rgb"),l=Qr(t,n,r);return[...Ni(l),...s.length>0&&s[0]<1?[s[0]]:[]]};function Ni(e){const t=[[.819022437996703,.3619062600528904,-.1288737815209879],[.0329836539323885,.9292868615863434,.0361446663506424],[.0481771893596242,.2642395317527308,.6335478284694309]],n=[[.210454268309314,.7936177747023054,-.0040720430116193],[1.9779985324311684,-2.42859224204858,.450593709617411],[.0259040424655478,.7827717124575296,-.8086757549230774]],r=St(t,e);return St(n,r.map(s=>Math.cbrt(s)))}I.prototype.oklab=function(){return Pn(this._rgb)};const Di=(...e)=>new I(...e,"oklab");Object.assign(U,{oklab:Di});F.format.oklab=In;F.autodetect.push({p:2,test:(...e)=>{if(e=z(e,"oklab"),W(e)==="array"&&e.length===3)return"oklab"}});const $i=(e,t,n)=>{const r=e.oklab(),s=t.oklab();return new I(r[0]+n*(s[0]-r[0]),r[1]+n*(s[1]-r[1]),r[2]+n*(s[2]-r[2]),"oklab")};te.oklab=$i;const Bi=(e,t,n)=>Ye(e,t,n,"oklch");te.oklch=Bi;const{pow:Jt,sqrt:en,PI:tn,cos:nr,sin:rr,atan2:Fi}=Math,zi=(e,t="lrgb",n=null)=>{const r=e.length;n||(n=Array.from(new Array(r)).map(()=>1));const s=r/n.reduce(function(h,x){return h+x});if(n.forEach((h,x)=>{n[x]*=s}),e=e.map(h=>new I(h)),t==="lrgb")return Ui(e,n);const l=e.shift(),a=l.get(t),i=[];let c=0,f=0;for(let h=0;h<a.length;h++)if(a[h]=(a[h]||0)*n[0],i.push(isNaN(a[h])?0:n[0]),t.charAt(h)==="h"&&!isNaN(a[h])){const x=a[h]/180*tn;c+=nr(x)*n[0],f+=rr(x)*n[0]}let u=l.alpha()*n[0];e.forEach((h,x)=>{const j=h.get(t);u+=h.alpha()*n[x+1];for(let v=0;v<a.length;v++)if(!isNaN(j[v]))if(i[v]+=n[x+1],t.charAt(v)==="h"){const S=j[v]/180*tn;c+=nr(S)*n[x+1],f+=rr(S)*n[x+1]}else a[v]+=j[v]*n[x+1]});for(let h=0;h<a.length;h++)if(t.charAt(h)==="h"){let x=Fi(f/i[h],c/i[h])/tn*180;for(;x<0;)x+=360;for(;x>=360;)x-=360;a[h]=x}else a[h]=a[h]/i[h];return u/=r,new I(a,t).alpha(u>.99999?1:u,!0)},Ui=(e,t)=>{const n=e.length,r=[0,0,0,0];for(let s=0;s<e.length;s++){const l=e[s],a=t[s]/n,i=l._rgb;r[0]+=Jt(i[0],2)*a,r[1]+=Jt(i[1],2)*a,r[2]+=Jt(i[2],2)*a,r[3]+=i[3]*a}return r[0]=en(r[0]),r[1]=en(r[1]),r[2]=en(r[2]),r[3]>.9999999&&(r[3]=1),new I(jn(r))},{pow:Wi}=Math;function Lt(e){let t="rgb",n=U("#ccc"),r=0,s=[0,1],l=[],a=[0,0],i=!1,c=[],f=!1,u=0,h=1,x=!1,j={},v=!0,S=1;const p=function(b){if(b=b||["#fff","#000"],b&&W(b)==="string"&&U.brewer&&U.brewer[b.toLowerCase()]&&(b=U.brewer[b.toLowerCase()]),W(b)==="array"){b.length===1&&(b=[b[0],b[0]]),b=b.slice(0);for(let L=0;L<b.length;L++)b[L]=U(b[L]);l.length=0;for(let L=0;L<b.length;L++)l.push(L/(b.length-1))}return w(),c=b},d=function(b){if(i!=null){const L=i.length-1;let T=0;for(;T<L&&b>=i[T];)T++;return T-1}return 0};let m=b=>b,y=b=>b;const g=function(b,L){let T,_;if(L==null&&(L=!1),isNaN(b)||b===null)return n;L?_=b:i&&i.length>2?_=d(b)/(i.length-2):h!==u?_=(b-u)/(h-u):_=1,_=y(_),L||(_=m(_)),S!==1&&(_=Wi(_,S)),_=a[0]+_*(1-a[0]-a[1]),_=Oe(_,0,1);const O=Math.floor(_*1e4);if(v&&j[O])T=j[O];else{if(W(c)==="array")for(let M=0;M<l.length;M++){const B=l[M];if(_<=B){T=c[M];break}if(_>=B&&M===l.length-1){T=c[M];break}if(_>B&&_<l[M+1]){_=(_-B)/(l[M+1]-B),T=U.interpolate(c[M],c[M+1],_,t);break}}else W(c)==="function"&&(T=c(_));v&&(j[O]=T)}return T};var w=()=>j={};p(e);const P=function(b){const L=U(g(b));return f&&L[f]?L[f]():L};return P.classes=function(b){if(b!=null){if(W(b)==="array")i=b,s=[b[0],b[b.length-1]];else{const L=U.analyze(s);b===0?i=[L.min,L.max]:i=U.limits(L,"e",b)}return P}return i},P.domain=function(b){if(!arguments.length)return s;u=b[0],h=b[b.length-1],l=[];const L=c.length;if(b.length===L&&u!==h)for(let T of Array.from(b))l.push((T-u)/(h-u));else{for(let T=0;T<L;T++)l.push(T/(L-1));if(b.length>2){const T=b.map((O,M)=>M/(b.length-1)),_=b.map(O=>(O-u)/(h-u));_.every((O,M)=>T[M]===O)||(y=O=>{if(O<=0||O>=1)return O;let M=0;for(;O>=_[M+1];)M++;const B=(O-_[M])/(_[M+1]-_[M]);return T[M]+B*(T[M+1]-T[M])})}}return s=[u,h],P},P.mode=function(b){return arguments.length?(t=b,w(),P):t},P.range=function(b,L){return p(b),P},P.out=function(b){return f=b,P},P.spread=function(b){return arguments.length?(r=b,P):r},P.correctLightness=function(b){return b==null&&(b=!0),x=b,w(),x?m=function(L){const T=g(0,!0).lab()[0],_=g(1,!0).lab()[0],O=T>_;let M=g(L,!0).lab()[0];const B=T+(_-T)*L;let V=M-B,H=0,ne=1,ee=20;for(;Math.abs(V)>.01&&ee-- >0;)(function(){return O&&(V*=-1),V<0?(H=L,L+=(ne-L)*.5):(ne=L,L+=(H-L)*.5),M=g(L,!0).lab()[0],V=M-B})();return L}:m=L=>L,P},P.padding=function(b){return b!=null?(W(b)==="number"&&(b=[b,b]),a=b,P):a},P.colors=function(b,L){arguments.length<2&&(L="hex");let T=[];if(arguments.length===0)T=c.slice(0);else if(b===1)T=[P(.5)];else if(b>1){const _=s[0],O=s[1]-_;T=qi(0,b).map(M=>P(_+M/(b-1)*O))}else{e=[];let _=[];if(i&&i.length>2)for(let O=1,M=i.length,B=1<=M;B?O<M:O>M;B?O++:O--)_.push((i[O-1]+i[O])*.5);else _=s;T=_.map(O=>P(O))}return U[L]&&(T=T.map(_=>_[L]())),T},P.cache=function(b){return b!=null?(v=b,P):v},P.gamma=function(b){return b!=null?(S=b,P):S},P.nodata=function(b){return b!=null?(n=U(b),P):n},P}function qi(e,t,n){let r=[],s=e<t,l=t;for(let a=e;s?a<l:a>l;s?a++:a--)r.push(a);return r}const Hi=function(e){let t=[1,1];for(let n=1;n<e;n++){let r=[1];for(let s=1;s<=t.length;s++)r[s]=(t[s]||0)+t[s-1];t=r}return t},Ki=function(e){let t,n,r,s;if(e=e.map(l=>new I(l)),e.length===2)[n,r]=e.map(l=>l.lab()),t=function(l){const a=[0,1,2].map(i=>n[i]+l*(r[i]-n[i]));return new I(a,"lab")};else if(e.length===3)[n,r,s]=e.map(l=>l.lab()),t=function(l){const a=[0,1,2].map(i=>(1-l)*(1-l)*n[i]+2*(1-l)*l*r[i]+l*l*s[i]);return new I(a,"lab")};else if(e.length===4){let l;[n,r,s,l]=e.map(a=>a.lab()),t=function(a){const i=[0,1,2].map(c=>(1-a)*(1-a)*(1-a)*n[c]+3*(1-a)*(1-a)*a*r[c]+3*(1-a)*a*a*s[c]+a*a*a*l[c]);return new I(i,"lab")}}else if(e.length>=5){let l,a,i;l=e.map(c=>c.lab()),i=e.length-1,a=Hi(i),t=function(c){const f=1-c,u=[0,1,2].map(h=>l.reduce((x,j,v)=>x+a[v]*f**(i-v)*c**v*j[h],0));return new I(u,"lab")}}else throw new RangeError("No point in running bezier with only one color.");return t},Yi=e=>{const t=Ki(e);return t.scale=()=>Lt(t),t},{round:rs}=Math;I.prototype.rgb=function(e=!0){return e===!1?this._rgb.slice(0,3):this._rgb.slice(0,3).map(rs)};I.prototype.rgba=function(e=!0){return this._rgb.slice(0,4).map((t,n)=>n<3?e===!1?t:rs(t):t)};const Vi=(...e)=>new I(...e,"rgb");Object.assign(U,{rgb:Vi});F.format.rgb=(...e)=>{const t=z(e,"rgba");return t[3]===void 0&&(t[3]=1),t};F.autodetect.push({p:3,test:(...e)=>{if(e=z(e,"rgba"),W(e)==="array"&&(e.length===3||e.length===4&&W(e[3])=="number"&&e[3]>=0&&e[3]<=1))return"rgb"}});const pe=(e,t,n)=>{if(!pe[n])throw new Error("unknown blend mode "+n);return pe[n](e,t)},Ae=e=>(t,n)=>{const r=U(n).rgb(),s=U(t).rgb();return U.rgb(e(r,s))},Te=e=>(t,n)=>{const r=[];return r[0]=e(t[0],n[0]),r[1]=e(t[1],n[1]),r[2]=e(t[2],n[2]),r},Gi=e=>e,Zi=(e,t)=>e*t/255,Xi=(e,t)=>e>t?t:e,Qi=(e,t)=>e>t?e:t,Ji=(e,t)=>255*(1-(1-e/255)*(1-t/255)),el=(e,t)=>t<128?2*e*t/255:255*(1-2*(1-e/255)*(1-t/255)),tl=(e,t)=>255*(1-(1-t/255)/(e/255)),nl=(e,t)=>e===255?255:(e=255*(t/255)/(1-e/255),e>255?255:e);pe.normal=Ae(Te(Gi));pe.multiply=Ae(Te(Zi));pe.screen=Ae(Te(Ji));pe.overlay=Ae(Te(el));pe.darken=Ae(Te(Xi));pe.lighten=Ae(Te(Qi));pe.dodge=Ae(Te(nl));pe.burn=Ae(Te(tl));const{pow:rl,sin:sl,cos:ol}=Math;function al(e=300,t=-1.5,n=1,r=1,s=[0,1]){let l=0,a;W(s)==="array"?a=s[1]-s[0]:(a=0,s=[s,s]);const i=function(c){const f=je*((e+120)/360+t*c),u=rl(s[0]+a*c,r),x=(l!==0?n[0]+c*l:n)*u*(1-u)/2,j=ol(f),v=sl(f),S=u+x*(-.14861*j+1.78277*v),p=u+x*(-.29227*j-.90649*v),d=u+x*(1.97294*j);return U(jn([S*255,p*255,d*255,1]))};return i.start=function(c){return c==null?e:(e=c,i)},i.rotations=function(c){return c==null?t:(t=c,i)},i.gamma=function(c){return c==null?r:(r=c,i)},i.hue=function(c){return c==null?n:(n=c,W(n)==="array"?(l=n[1]-n[0],l===0&&(n=n[1])):l=0,i)},i.lightness=function(c){return c==null?s:(W(c)==="array"?(s=c,a=c[1]-c[0]):(s=[c,c],a=0),i)},i.scale=()=>U.scale(i),i.hue(n),i}const il="0123456789abcdef",{floor:ll,random:cl}=Math,dl=()=>{let e="#";for(let t=0;t<6;t++)e+=il.charAt(ll(cl()*16));return new I(e,"hex")},{log:sr,pow:ul,floor:fl,abs:pl}=Math;function ss(e,t=null){const n={min:Number.MAX_VALUE,max:Number.MAX_VALUE*-1,sum:0,values:[],count:0};return W(e)==="object"&&(e=Object.values(e)),e.forEach(r=>{t&&W(r)==="object"&&(r=r[t]),r!=null&&!isNaN(r)&&(n.values.push(r),n.sum+=r,r<n.min&&(n.min=r),r>n.max&&(n.max=r),n.count+=1)}),n.domain=[n.min,n.max],n.limits=(r,s)=>os(n,r,s),n}function os(e,t="equal",n=7){W(e)=="array"&&(e=ss(e));const{min:r,max:s}=e,l=e.values.sort((i,c)=>i-c);if(n===1)return[r,s];const a=[];if(t.substr(0,1)==="c"&&(a.push(r),a.push(s)),t.substr(0,1)==="e"){a.push(r);for(let i=1;i<n;i++)a.push(r+i/n*(s-r));a.push(s)}else if(t.substr(0,1)==="l"){if(r<=0)throw new Error("Logarithmic scales are only possible for values > 0");const i=Math.LOG10E*sr(r),c=Math.LOG10E*sr(s);a.push(r);for(let f=1;f<n;f++)a.push(ul(10,i+f/n*(c-i)));a.push(s)}else if(t.substr(0,1)==="q"){a.push(r);for(let i=1;i<n;i++){const c=(l.length-1)*i/n,f=fl(c);if(f===c)a.push(l[f]);else{const u=c-f;a.push(l[f]*(1-u)+l[f+1]*u)}}a.push(s)}else if(t.substr(0,1)==="k"){let i;const c=l.length,f=new Array(c),u=new Array(n);let h=!0,x=0,j=null;j=[],j.push(r);for(let p=1;p<n;p++)j.push(r+p/n*(s-r));for(j.push(s);h;){for(let d=0;d<n;d++)u[d]=0;for(let d=0;d<c;d++){const m=l[d];let y=Number.MAX_VALUE,g;for(let w=0;w<n;w++){const P=pl(j[w]-m);P<y&&(y=P,g=w),u[g]++,f[d]=g}}const p=new Array(n);for(let d=0;d<n;d++)p[d]=null;for(let d=0;d<c;d++)i=f[d],p[i]===null?p[i]=l[d]:p[i]+=l[d];for(let d=0;d<n;d++)p[d]*=1/u[d];h=!1;for(let d=0;d<n;d++)if(p[d]!==j[d]){h=!0;break}j=p,x++,x>200&&(h=!1)}const v={};for(let p=0;p<n;p++)v[p]=[];for(let p=0;p<c;p++)i=f[p],v[i].push(l[p]);let S=[];for(let p=0;p<n;p++)S.push(v[p][0]),S.push(v[p][v[p].length-1]);S=S.sort((p,d)=>p-d),a.push(S[0]);for(let p=1;p<S.length;p+=2){const d=S[p];!isNaN(d)&&a.indexOf(d)===-1&&a.push(d)}}return a}const ml=(e,t)=>{e=new I(e),t=new I(t);const n=e.luminance(),r=t.luminance();return n>r?(n+.05)/(r+.05):(r+.05)/(n+.05)};/**
2
+ * @license
3
+ *
4
+ * The APCA contrast prediction algorithm is based of the formulas published
5
+ * in the APCA-1.0.98G specification by Myndex. The specification is available at:
6
+ * https://raw.githubusercontent.com/Myndex/apca-w3/master/images/APCAw3_0.1.17_APCA0.0.98G.svg
7
+ *
8
+ * Note that the APCA implementation is still beta, so please update to
9
+ * future versions of chroma.js when they become available.
10
+ *
11
+ * You can read more about the APCA Readability Criterion at
12
+ * https://readtech.org/ARC/
13
+ */const or=.027,hl=5e-4,bl=.1,ar=1.14,bt=.022,ir=1.414,gl=(e,t)=>{e=new I(e),t=new I(t),e.alpha()<1&&(e=He(t,e,e.alpha(),"rgb"));const n=lr(...e.rgb()),r=lr(...t.rgb()),s=n>=bt?n:n+Math.pow(bt-n,ir),l=r>=bt?r:r+Math.pow(bt-r,ir),a=Math.pow(l,.56)-Math.pow(s,.57),i=Math.pow(l,.65)-Math.pow(s,.62),c=Math.abs(l-s)<hl?0:s<l?a*ar:i*ar;return(Math.abs(c)<bl?0:c>0?c-or:c+or)*100};function lr(e,t,n){return .2126729*Math.pow(e/255,2.4)+.7151522*Math.pow(t/255,2.4)+.072175*Math.pow(n/255,2.4)}const{sqrt:Ce,pow:X,min:xl,max:yl,atan2:cr,abs:dr,cos:gt,sin:ur,exp:vl,PI:fr}=Math;function Cl(e,t,n=1,r=1,s=1){var l=function(Ie){return 360*Ie/(2*fr)},a=function(Ie){return 2*fr*Ie/360};e=new I(e),t=new I(t);const[i,c,f]=Array.from(e.lab()),[u,h,x]=Array.from(t.lab()),j=(i+u)/2,v=Ce(X(c,2)+X(f,2)),S=Ce(X(h,2)+X(x,2)),p=(v+S)/2,d=.5*(1-Ce(X(p,7)/(X(p,7)+X(25,7)))),m=c*(1+d),y=h*(1+d),g=Ce(X(m,2)+X(f,2)),w=Ce(X(y,2)+X(x,2)),P=(g+w)/2,b=l(cr(f,m)),L=l(cr(x,y)),T=b>=0?b:b+360,_=L>=0?L:L+360,O=dr(T-_)>180?(T+_+360)/2:(T+_)/2,M=1-.17*gt(a(O-30))+.24*gt(a(2*O))+.32*gt(a(3*O+6))-.2*gt(a(4*O-63));let B=_-T;B=dr(B)<=180?B:_<=T?B+360:B-360,B=2*Ce(g*w)*ur(a(B)/2);const V=u-i,H=w-g,ne=1+.015*X(j-50,2)/Ce(20+X(j-50,2)),ee=1+.045*P,R=1+.015*P*M,$=30*vl(-X((O-275)/25,2)),be=-(2*Ce(X(P,7)/(X(P,7)+X(25,7))))*ur(2*a($)),Xe=Ce(X(V/(n*ne),2)+X(H/(r*ee),2)+X(B/(s*R),2)+be*(H/(r*ee))*(B/(s*R)));return yl(0,xl(100,Xe))}function jl(e,t,n="lab"){e=new I(e),t=new I(t);const r=e.get(n),s=t.get(n);let l=0;for(let a in r){const i=(r[a]||0)-(s[a]||0);l+=i*i}return Math.sqrt(l)}const wl=(...e)=>{try{return new I(...e),!0}catch{return!1}},kl={cool(){return Lt([U.hsl(180,1,.9),U.hsl(250,.7,.4)])},hot(){return Lt(["#000","#f00","#ff0","#fff"]).mode("rgb")}},mn={OrRd:["#fff7ec","#fee8c8","#fdd49e","#fdbb84","#fc8d59","#ef6548","#d7301f","#b30000","#7f0000"],PuBu:["#fff7fb","#ece7f2","#d0d1e6","#a6bddb","#74a9cf","#3690c0","#0570b0","#045a8d","#023858"],BuPu:["#f7fcfd","#e0ecf4","#bfd3e6","#9ebcda","#8c96c6","#8c6bb1","#88419d","#810f7c","#4d004b"],Oranges:["#fff5eb","#fee6ce","#fdd0a2","#fdae6b","#fd8d3c","#f16913","#d94801","#a63603","#7f2704"],BuGn:["#f7fcfd","#e5f5f9","#ccece6","#99d8c9","#66c2a4","#41ae76","#238b45","#006d2c","#00441b"],YlOrBr:["#ffffe5","#fff7bc","#fee391","#fec44f","#fe9929","#ec7014","#cc4c02","#993404","#662506"],YlGn:["#ffffe5","#f7fcb9","#d9f0a3","#addd8e","#78c679","#41ab5d","#238443","#006837","#004529"],Reds:["#fff5f0","#fee0d2","#fcbba1","#fc9272","#fb6a4a","#ef3b2c","#cb181d","#a50f15","#67000d"],RdPu:["#fff7f3","#fde0dd","#fcc5c0","#fa9fb5","#f768a1","#dd3497","#ae017e","#7a0177","#49006a"],Greens:["#f7fcf5","#e5f5e0","#c7e9c0","#a1d99b","#74c476","#41ab5d","#238b45","#006d2c","#00441b"],YlGnBu:["#ffffd9","#edf8b1","#c7e9b4","#7fcdbb","#41b6c4","#1d91c0","#225ea8","#253494","#081d58"],Purples:["#fcfbfd","#efedf5","#dadaeb","#bcbddc","#9e9ac8","#807dba","#6a51a3","#54278f","#3f007d"],GnBu:["#f7fcf0","#e0f3db","#ccebc5","#a8ddb5","#7bccc4","#4eb3d3","#2b8cbe","#0868ac","#084081"],Greys:["#ffffff","#f0f0f0","#d9d9d9","#bdbdbd","#969696","#737373","#525252","#252525","#000000"],YlOrRd:["#ffffcc","#ffeda0","#fed976","#feb24c","#fd8d3c","#fc4e2a","#e31a1c","#bd0026","#800026"],PuRd:["#f7f4f9","#e7e1ef","#d4b9da","#c994c7","#df65b0","#e7298a","#ce1256","#980043","#67001f"],Blues:["#f7fbff","#deebf7","#c6dbef","#9ecae1","#6baed6","#4292c6","#2171b5","#08519c","#08306b"],PuBuGn:["#fff7fb","#ece2f0","#d0d1e6","#a6bddb","#67a9cf","#3690c0","#02818a","#016c59","#014636"],Viridis:["#440154","#482777","#3f4a8a","#31678e","#26838f","#1f9d8a","#6cce5a","#b6de2b","#fee825"],Spectral:["#9e0142","#d53e4f","#f46d43","#fdae61","#fee08b","#ffffbf","#e6f598","#abdda4","#66c2a5","#3288bd","#5e4fa2"],RdYlGn:["#a50026","#d73027","#f46d43","#fdae61","#fee08b","#ffffbf","#d9ef8b","#a6d96a","#66bd63","#1a9850","#006837"],RdBu:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#f7f7f7","#d1e5f0","#92c5de","#4393c3","#2166ac","#053061"],PiYG:["#8e0152","#c51b7d","#de77ae","#f1b6da","#fde0ef","#f7f7f7","#e6f5d0","#b8e186","#7fbc41","#4d9221","#276419"],PRGn:["#40004b","#762a83","#9970ab","#c2a5cf","#e7d4e8","#f7f7f7","#d9f0d3","#a6dba0","#5aae61","#1b7837","#00441b"],RdYlBu:["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],BrBG:["#543005","#8c510a","#bf812d","#dfc27d","#f6e8c3","#f5f5f5","#c7eae5","#80cdc1","#35978f","#01665e","#003c30"],RdGy:["#67001f","#b2182b","#d6604d","#f4a582","#fddbc7","#ffffff","#e0e0e0","#bababa","#878787","#4d4d4d","#1a1a1a"],PuOr:["#7f3b08","#b35806","#e08214","#fdb863","#fee0b6","#f7f7f7","#d8daeb","#b2abd2","#8073ac","#542788","#2d004b"],Set2:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","#e5c494","#b3b3b3"],Accent:["#7fc97f","#beaed4","#fdc086","#ffff99","#386cb0","#f0027f","#bf5b17","#666666"],Set1:["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00","#ffff33","#a65628","#f781bf","#999999"],Set3:["#8dd3c7","#ffffb3","#bebada","#fb8072","#80b1d3","#fdb462","#b3de69","#fccde5","#d9d9d9","#bc80bd","#ccebc5","#ffed6f"],Dark2:["#1b9e77","#d95f02","#7570b3","#e7298a","#66a61e","#e6ab02","#a6761d","#666666"],Paired:["#a6cee3","#1f78b4","#b2df8a","#33a02c","#fb9a99","#e31a1c","#fdbf6f","#ff7f00","#cab2d6","#6a3d9a","#ffff99","#b15928"],Pastel2:["#b3e2cd","#fdcdac","#cbd5e8","#f4cae4","#e6f5c9","#fff2ae","#f1e2cc","#cccccc"],Pastel1:["#fbb4ae","#b3cde3","#ccebc5","#decbe4","#fed9a6","#ffffcc","#e5d8bd","#fddaec","#f2f2f2"]},as=Object.keys(mn),pr=new Map(as.map(e=>[e.toLowerCase(),e])),Sl=typeof Proxy=="function"?new Proxy(mn,{get(e,t){const n=t.toLowerCase();if(pr.has(n))return e[pr.get(n)]},getOwnPropertyNames(){return Object.getOwnPropertyNames(as)}}):mn,Ll=(...e)=>{e=z(e,"cmyk");const[t,n,r,s]=e,l=e.length>4?e[4]:1;return s===1?[0,0,0,l]:[t>=1?0:255*(1-t)*(1-s),n>=1?0:255*(1-n)*(1-s),r>=1?0:255*(1-r)*(1-s),l]},{max:mr}=Math,Il=(...e)=>{let[t,n,r]=z(e,"rgb");t=t/255,n=n/255,r=r/255;const s=1-mr(t,mr(n,r)),l=s<1?1/(1-s):0,a=(1-t-s)*l,i=(1-n-s)*l,c=(1-r-s)*l;return[a,i,c,s]};I.prototype.cmyk=function(){return Il(this._rgb)};const Pl=(...e)=>new I(...e,"cmyk");Object.assign(U,{cmyk:Pl});F.format.cmyk=Ll;F.autodetect.push({p:2,test:(...e)=>{if(e=z(e,"cmyk"),W(e)==="array"&&e.length===4)return"cmyk"}});const Al=(...e)=>{const t=z(e,"hsla");let n=Ke(e)||"lsa";return t[0]=ie(t[0]||0)+"deg",t[1]=ie(t[1]*100)+"%",t[2]=ie(t[2]*100)+"%",n==="hsla"||t.length>3&&t[3]<1?(t[3]="/ "+(t.length>3?t[3]:1),n="hsla"):t.length=3,`${n.substr(0,3)}(${t.join(" ")})`},Tl=(...e)=>{const t=z(e,"lab");let n=Ke(e)||"lab";return t[0]=ie(t[0])+"%",t[1]=ie(t[1]),t[2]=ie(t[2]),n==="laba"||t.length>3&&t[3]<1?t[3]="/ "+(t.length>3?t[3]:1):t.length=3,`lab(${t.join(" ")})`},El=(...e)=>{const t=z(e,"lch");let n=Ke(e)||"lab";return t[0]=ie(t[0])+"%",t[1]=ie(t[1]),t[2]=isNaN(t[2])?"none":ie(t[2])+"deg",n==="lcha"||t.length>3&&t[3]<1?t[3]="/ "+(t.length>3?t[3]:1):t.length=3,`lch(${t.join(" ")})`},Rl=(...e)=>{const t=z(e,"lab");return t[0]=ie(t[0]*100)+"%",t[1]=fn(t[1]),t[2]=fn(t[2]),t.length>3&&t[3]<1?t[3]="/ "+(t.length>3?t[3]:1):t.length=3,`oklab(${t.join(" ")})`},is=(...e)=>{const[t,n,r,...s]=z(e,"rgb"),[l,a,i]=Pn(t,n,r),[c,f,u]=es(l,a,i);return[c,f,u,...s.length>0&&s[0]<1?[s[0]]:[]]},_l=(...e)=>{const t=z(e,"lch");return t[0]=ie(t[0]*100)+"%",t[1]=fn(t[1]),t[2]=isNaN(t[2])?"none":ie(t[2])+"deg",t.length>3&&t[3]<1?t[3]="/ "+(t.length>3?t[3]:1):t.length=3,`oklch(${t.join(" ")})`},{round:nn}=Math,Ol=(...e)=>{const t=z(e,"rgba");let n=Ke(e)||"rgb";if(n.substr(0,3)==="hsl")return Al(ns(t),n);if(n.substr(0,3)==="lab"){const r=at();we("d50");const s=Tl(kn(t),n);return we(r),s}if(n.substr(0,3)==="lch"){const r=at();we("d50");const s=El(Ln(t),n);return we(r),s}return n.substr(0,5)==="oklab"?Rl(Pn(t)):n.substr(0,5)==="oklch"?_l(is(t)):(t[0]=nn(t[0]),t[1]=nn(t[1]),t[2]=nn(t[2]),(n==="rgba"||t.length>3&&t[3]<1)&&(t[3]="/ "+(t.length>3?t[3]:1),n="rgba"),`${n.substr(0,3)}(${t.slice(0,n==="rgb"?3:4).join(" ")})`)},ls=(...e)=>{e=z(e,"lch");const[t,n,r,...s]=e,[l,a,i]=Jr(t,n,r),[c,f,u]=In(l,a,i);return[c,f,u,...s.length>0&&s[0]<1?[s[0]]:[]]},Se=/((?:-?\d+)|(?:-?\d+(?:\.\d+)?)%|none)/.source,fe=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%?)|none)/.source,It=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)%)|none)/.source,ce=/\s*/.source,Ve=/\s+/.source,An=/\s*,\s*/.source,_t=/((?:-?(?:\d+(?:\.\d*)?|\.\d+)(?:deg)?)|none)/.source,Ge=/\s*(?:\/\s*((?:[01]|[01]?\.\d+)|\d+(?:\.\d+)?%))?/.source,cs=new RegExp("^rgba?\\("+ce+[Se,Se,Se].join(Ve)+Ge+"\\)$"),ds=new RegExp("^rgb\\("+ce+[Se,Se,Se].join(An)+ce+"\\)$"),us=new RegExp("^rgba\\("+ce+[Se,Se,Se,fe].join(An)+ce+"\\)$"),fs=new RegExp("^hsla?\\("+ce+[_t,It,It].join(Ve)+Ge+"\\)$"),ps=new RegExp("^hsl?\\("+ce+[_t,It,It].join(An)+ce+"\\)$"),ms=/^hsla\(\s*(-?\d+(?:\.\d+)?),\s*(-?\d+(?:\.\d+)?)%\s*,\s*(-?\d+(?:\.\d+)?)%\s*,\s*([01]|[01]?\.\d+)\)$/,hs=new RegExp("^lab\\("+ce+[fe,fe,fe].join(Ve)+Ge+"\\)$"),bs=new RegExp("^lch\\("+ce+[fe,fe,_t].join(Ve)+Ge+"\\)$"),gs=new RegExp("^oklab\\("+ce+[fe,fe,fe].join(Ve)+Ge+"\\)$"),xs=new RegExp("^oklch\\("+ce+[fe,fe,_t].join(Ve)+Ge+"\\)$"),{round:ys}=Math,Be=e=>e.map((t,n)=>n<=2?Oe(ys(t),0,255):t),Q=(e,t=0,n=100,r=!1)=>(typeof e=="string"&&e.endsWith("%")&&(e=parseFloat(e.substring(0,e.length-1))/100,r?e=t+(e+1)*.5*(n-t):e=t+e*(n-t)),+e),se=(e,t)=>e==="none"?t:e,Tn=e=>{if(e=e.toLowerCase().trim(),e==="transparent")return[0,0,0,0];let t;if(F.format.named)try{return F.format.named(e)}catch{}if((t=e.match(cs))||(t=e.match(ds))){let n=t.slice(1,4);for(let s=0;s<3;s++)n[s]=+Q(se(n[s],0),0,255);n=Be(n);const r=t[4]!==void 0?+Q(t[4],0,1):1;return n[3]=r,n}if(t=e.match(us)){const n=t.slice(1,5);for(let r=0;r<4;r++)n[r]=+Q(n[r],0,255);return n}if((t=e.match(fs))||(t=e.match(ps))){const n=t.slice(1,4);n[0]=+se(n[0].replace("deg",""),0),n[1]=+Q(se(n[1],0),0,100)*.01,n[2]=+Q(se(n[2],0),0,100)*.01;const r=Be(pn(n)),s=t[4]!==void 0?+Q(t[4],0,1):1;return r[3]=s,r}if(t=e.match(ms)){const n=t.slice(1,4);n[1]*=.01,n[2]*=.01;const r=pn(n);for(let s=0;s<3;s++)r[s]=ys(r[s]);return r[3]=+t[4],r}if(t=e.match(hs)){const n=t.slice(1,4);n[0]=Q(se(n[0],0),0,100),n[1]=Q(se(n[1],0),-125,125,!0),n[2]=Q(se(n[2],0),-125,125,!0);const r=at();we("d50");const s=Be(wn(n));we(r);const l=t[4]!==void 0?+Q(t[4],0,1):1;return s[3]=l,s}if(t=e.match(bs)){const n=t.slice(1,4);n[0]=Q(n[0],0,100),n[1]=Q(se(n[1],0),0,150,!1),n[2]=+se(n[2].replace("deg",""),0);const r=at();we("d50");const s=Be(Sn(n));we(r);const l=t[4]!==void 0?+Q(t[4],0,1):1;return s[3]=l,s}if(t=e.match(gs)){const n=t.slice(1,4);n[0]=Q(se(n[0],0),0,1),n[1]=Q(se(n[1],0),-.4,.4,!0),n[2]=Q(se(n[2],0),-.4,.4,!0);const r=Be(In(n)),s=t[4]!==void 0?+Q(t[4],0,1):1;return r[3]=s,r}if(t=e.match(xs)){const n=t.slice(1,4);n[0]=Q(se(n[0],0),0,1),n[1]=Q(se(n[1],0),0,.4,!1),n[2]=+se(n[2].replace("deg",""),0);const r=Be(ls(n)),s=t[4]!==void 0?+Q(t[4],0,1):1;return r[3]=s,r}};Tn.test=e=>cs.test(e)||fs.test(e)||hs.test(e)||bs.test(e)||gs.test(e)||xs.test(e)||ds.test(e)||us.test(e)||ps.test(e)||ms.test(e)||e==="transparent";I.prototype.css=function(e){return Ol(this._rgb,e)};const Ml=(...e)=>new I(...e,"css");U.css=Ml;F.format.css=Tn;F.autodetect.push({p:5,test:(e,...t)=>{if(!t.length&&W(e)==="string"&&Tn.test(e))return"css"}});F.format.gl=(...e)=>{const t=z(e,"rgba");return t[0]*=255,t[1]*=255,t[2]*=255,t};const Nl=(...e)=>new I(...e,"gl");U.gl=Nl;I.prototype.gl=function(){const e=this._rgb;return[e[0]/255,e[1]/255,e[2]/255,e[3]]};I.prototype.hex=function(e){return Zr(this._rgb,e)};const Dl=(...e)=>new I(...e,"hex");U.hex=Dl;F.format.hex=Gr;F.autodetect.push({p:4,test:(e,...t)=>{if(!t.length&&W(e)==="string"&&[3,4,5,6,7,8,9].indexOf(e.length)>=0)return"hex"}});const{log:xt}=Math,vs=e=>{const t=e/100;let n,r,s;return t<66?(n=255,r=t<6?0:-155.25485562709179-.44596950469579133*(r=t-2)+104.49216199393888*xt(r),s=t<20?0:-254.76935184120902+.8274096064007395*(s=t-10)+115.67994401066147*xt(s)):(n=351.97690566805693+.114206453784165*(n=t-55)-40.25366309332127*xt(n),r=325.4494125711974+.07943456536662342*(r=t-50)-28.0852963507957*xt(r),s=255),[n,r,s,1]},{round:$l}=Math,Bl=(...e)=>{const t=z(e,"rgb"),n=t[0],r=t[2];let s=1e3,l=4e4;const a=.4;let i;for(;l-s>a;){i=(l+s)*.5;const c=vs(i);c[2]/c[0]>=r/n?l=i:s=i}return $l(i)};I.prototype.temp=I.prototype.kelvin=I.prototype.temperature=function(){return Bl(this._rgb)};const rn=(...e)=>new I(...e,"temp");Object.assign(U,{temp:rn,kelvin:rn,temperature:rn});F.format.temp=F.format.kelvin=F.format.temperature=vs;I.prototype.oklch=function(){return is(this._rgb)};const Fl=(...e)=>new I(...e,"oklch");Object.assign(U,{oklch:Fl});F.format.oklch=ls;F.autodetect.push({p:2,test:(...e)=>{if(e=z(e,"oklch"),W(e)==="array"&&e.length===3)return"oklch"}});Object.assign(U,{analyze:ss,average:zi,bezier:Yi,blend:pe,brewer:Sl,Color:I,colors:qe,contrast:ml,contrastAPCA:gl,cubehelix:al,deltaE:Cl,distance:jl,input:F,interpolate:He,limits:os,mix:He,random:dl,scale:Lt,scales:kl,valid:wl});const zl=(e,t)=>{const n=U(e);return t==="dark"?n.brighten(4).hex():n.hex()},Ul=(e,t)=>{const n=U(e);return t==="dark"?n.brighten(2).alpha(.4).hex():n.luminance()>.5?n.darken(3).hex():n.brighten(.5).alpha(.25).hex()},Wl=(e,t)=>{const n=U(e);return t==="dark"?n.luminance()>.5?n.darken(2).alpha(.5).hex():n.brighten(1.5).alpha(.35).hex():n.luminance()>.5?n.darken(2.5).hex():n.brighten(2.5).alpha(.25).hex()},ql=(e,t)=>t==="dark"?"brightness(1.3) contrast(1.2)":"brightness(0.85) contrast(1.2)";var tt={},hr;function Hl(){return hr||(hr=1,function(e){var t=tt&&tt.__assign||function(){return(t=Object.assign||function(a){for(var i,c=1,f=arguments.length;c<f;c++)for(var u in i=arguments[c])Object.prototype.hasOwnProperty.call(i,u)&&(a[u]=i[u]);return a}).apply(this,arguments)},n=(Object.defineProperty(e,"__esModule",{value:!0}),{id:"id",parentId:"parentId",dataField:"data",childrenField:"children",throwIfOrphans:!1,rootParentIds:{"":!(e.countNodes=e.arrayToTree=void 0)},nestedIds:!0,assign:!1});function r(a,i){i===void 0&&(i={});for(var c,f=t(t({},n),i),u=[],h={},x=f.throwIfOrphans?new Set:null,j=0,v=a;j<v.length;j++){var S=v[j],p=f.nestedIds?l(S,f.id):S[f.id],d=f.nestedIds?l(S,f.parentId):S[f.parentId];if(f.rootParentIds[p])throw new Error("The item array contains a node whose parentId both exists in another node and is in "+'`rootParentIds` (`itemId`: "'.concat(p,'", `rootParentIds`: ').concat(Object.keys(f.rootParentIds).map(function(m){return'"'.concat(m,'"')}).join(", "),")."));Object.prototype.hasOwnProperty.call(h,p)||(h[p]=((c={})[f.childrenField]=[],c)),x&&x.delete(p),f.dataField?h[p][f.dataField]=S:f.assign?h[p]=Object.assign(S,((c={})[f.childrenField]=h[p][f.childrenField],c)):h[p]=t(t({},S),((S={})[f.childrenField]=h[p][f.childrenField],S)),S=h[p],d==null||f.rootParentIds[d]?u.push(S):(Object.prototype.hasOwnProperty.call(h,d)||(h[d]=((p={})[f.childrenField]=[],p),x&&x.add(d)),h[d][f.childrenField].push(S))}if(x!=null&&x.size)throw new Error("The items array contains orphans that point to the following parentIds: "+"[".concat(Array.from(x),"]. These parentIds do not exist in the items array. Hint: prevent orphans to result ")+"in an error by passing the following option: { throwIfOrphans: false }");if(f.throwIfOrphans&&s(u,f.childrenField)<Object.keys(h).length)throw new Error("The items array contains nodes with a circular parent/child relationship.");return u}function s(a,i){return a.reduce(function(c,f){return c+1+(f[i]&&s(f[i],i))},0)}function l(a,i){return i.split(".").reduce(function(c,f){return c&&c[f]},a)}e.arrayToTree=r,e.countNodes=s}(tt)),tt}var Kl=Hl();class En{constructor({data:t,parent:n,children:r}){this.data=t,this.parent=n,this.children=r||[]}setParent(t){this.parent=t}add(...t){this.children.push(...t),t.forEach(n=>n.setParent(this))}removeChild(t){this.children=this.children.filter(n=>n!==t),t.setParent(void 0)}isLeaf(t){return!t.children?.length}getAllParents(t=!0){const n=[];t&&n.unshift(this);let{parent:r}=this;for(;r;)n.unshift(r),r=r.parent;return n}getAllSiblings(){return this.parent?.children.filter(n=>n!==this)||[]}flatten(t){const n=[],r=s=>{n.push(s),s.children.forEach(r)};return r(this),t||n.shift(),n}clone(){const t=new En({data:this.data});return t.add(...this.children),t}}class Cs{constructor(t){this.id=t.id,this.title=t.title,this.description=t.description,this.icon=t.icon,this.type=t.type,this.color=t.color||"#4B5563",this.data=t}getName(t){return t?this?.title:this.title}}class Ot extends En{getName(t){return this.data?.getName?.(t)??""}isSystemLabel(){return this.data?.type==="system"}getFullName(t){return this.getAllParents().slice(1).map(r=>t?r.getName(t):r.data?.title??"").join(" / ")}}const js=(e,t)=>e.map(n=>{const r=new Ot({data:new Cs(n.data||{}),parent:t}),s=js(n.children||[],r);return r.add(...s),r}),Yl=e=>{const t=Kl.arrayToTree(e||[]),n=new Ot({data:{}});return n.add(...js(t)),n},Vl=()=>new Ot({data:{}});function Gl(e,t,n){return e[t]?.data.getName(n)}function Zl(e,t,n){return e[t]?.getFullName(n)??t}function Xl(e,t){return!!e[t]}function Ql(e,t){return t.map(n=>e[n]).filter(Boolean)}function Jl(e,t,n){return!t||!n(t)?e:Do([t,...e]).slice(0,10)}const ws=k.createContext(null),ec=100;function Mt({children:e}){const{locale:t}=J(),{api:n}=de(),{teamDid:r}=he(),s=it({loading:!0,tree:Vl(),stats:[],labels:[]}),l=async()=>{try{const m=((await n.getTags({input:{teamDid:r,paging:{page:1,pageSize:ec}}})).tags||[]).map(g=>(g.createdAt&&(g.createdAt=new Date(g.createdAt).getTime()),g.updatedAt&&(g.updatedAt=new Date(g.updatedAt).getTime()),g)),y=Yl(m||[]);s.labels=m,s.loading=!1,s.tree=y}catch(d){console.error(d),s.loading=!1,oe.error(le(d))}};k.useEffect(()=>{l()},[n,r,s]);const a=k.useMemo(()=>s.tree.flatten(),[s.tree]),i=k.useMemo(()=>a.reduce((d,m)=>(d[m.data.id]=m,d),{}),[a]),c=k.useCallback(d=>Gl(i,d,t),[i,t]),f=k.useCallback(d=>Zl(i,d,t),[i,t]),u=k.useCallback(d=>Xl(i,d),[i]),h=k.useCallback(d=>Ql(i,d),[i]),[x=[],j]=Nr("recent-label-ids",{defaultValue:[]}),v=k.useCallback(d=>j(Jl(x,d,u)),[x,u,j]),p={...s,flattenedLabels:a,getLabelsByIds:h,getLabelName:c,createLabel:async d=>{try{const m=await n.createTag({input:{teamDid:r,tag:{title:d,color:"#4B5563",slug:d}}}),y=new Ot({data:new Cs(m.tag)});return s.tree.add(y),s.tree=s.tree.clone(),y.data}catch(m){return oe.error(le(m)),null}},getFullLabelName:f,recentLabels:x,addRecentLabel:v,labels:Array.from(s.labels),loading:s.loading,refetch:l};return o.jsx(ws.Provider,{value:p,children:e})}Mt.propTypes={children:C.node.isRequired};function Ze(){return k.useContext(ws)}function Le({label:e,onDelete:t=void 0,onClick:n=void 0,sx:r=void 0,disabled:s=!1,fullName:l=!0}){const a=gn(),{mode:i}=a.palette,{getFullLabelName:c,getLabelName:f}=Ze(),u=zl(e.color,i),h=Wl(e.color,i),x=Ul(e.color,i),j=ql(e.color,i),v=[{height:20,borderRadius:.5,fontSize:12,fontWeight:500,color:`${u} !important`,bgcolor:`${h} !important`,borderColor:`${x} !important`,transition:"filter 0.2s",WebkitTextFillColor:`${u} !important`,".MuiChip-deleteIcon":{color:`${u} !important`,cursor:"pointer",transition:"transform 0.3s","&:hover":{transform:"rotate(90deg)"}},".MuiChip-label":{px:.5,maxHeight:20},...n&&!s&&{cursor:"pointer","&:hover":{filter:j}}},...Array.isArray(r)?r:[r]],S=!s&&typeof t=="function",p=!s&&typeof n=="function",d=(y,g)=>{y.stopPropagation(),y.preventDefault(),g?.(e)},m=l?c(e.id):f(e.id);return o.jsx(co,{label:m||e.title,variant:"outlined",size:"small",...!s&&S&&t&&{onDelete:y=>d(y,t),deleteIcon:o.jsx(Sr,{})},...!s&&p&&{onClick:y=>d(y,n)},sx:v},e.id)}Le.propTypes={label:C.shape({id:C.string.isRequired,color:C.string.isRequired,title:C.string,slug:C.string}).isRequired,onDelete:C.func,onClick:C.func,sx:C.oneOfType([C.object,C.array]),disabled:C.bool,fullName:C.bool};function ks({...e}){return o.jsx(A,{...e,sx:t=>({[`& .${mt.paper}`]:{width:360,boxShadow:"none",margin:0,color:"inherit",fontSize:13},[`& .${mt.listbox}`]:{bgcolor:t.palette.background.paper,padding:1,[`& .${mt.option}`]:{minHeight:"auto"}},[`&.${mt.popperDisablePortal}`]:{position:"relative"}})})}ks.propTypes={};function lt({value:e=[],onChange:t=void 0,noLabelsText:n=void 0,buttonSx:r=void 0,actions:s=void 0,trigger:l=void 0,multiple:a=!0,updateImmediately:i=!0,excludes:c=[],disabled:f=!1,enableAccessControl:u=!0,disablePortal:h=!1,disableCreate:x=!1}){const{t:j,locale:v}=J(),{session:S}=Me(),p=["owner","admin"].includes(S?.user?.role),{flattenedLabels:d,getLabelsByIds:m,loading:y,createLabel:g,recentLabels:w,addRecentLabel:P}=Ze(),[b,L]=k.useState(null),[T,_]=k.useState(""),O=e,M=k.useMemo(()=>m(O),[m,O]),B=k.useMemo(()=>d.some(N=>N.data.getName(v)?.toLowerCase()===T.toLowerCase()),[T,d,v]),V=k.useMemo(()=>{const N=new Set(c);return d.filter(K=>!N.has(K.data.id))},[d,c]),H=k.useMemo(()=>{const N=new Set(c);return w.filter(K=>!N.has(K))},[w,c]),ne=!!b,ee=ne?"label-picker":void 0,R=N=>N?{bgcolor:K=>`${K.palette.primary.main} !important`,color:K=>`${K.palette.primary.contrastText} !important`,WebkitTextFillColor:K=>`${K.palette.primary.contrastText} !important`}:void 0,$=()=>!u||p,Y=N=>{f||(N.preventDefault(),L(N.currentTarget))},be=()=>{i||t?.(O),_(""),b?.focus(),L(null)},Xe=async()=>{const{id:N}=await g(T);a?i&&t([...O,N]):t?.([N])},Ie=N=>{a?i&&t(N):(t?.(N.length?[N[N.length-1]]:[]),L(null))};if(y)return null;const Ne=()=>{const N=m(H).filter($);return N?.length?o.jsxs(A,{component:"li",children:[o.jsx(A,{sx:{mb:.5,fontSize:12,fontWeight:"medium"},children:j("label.recently")}),o.jsx(A,{sx:{display:"flex",flexWrap:"wrap",gap:.75,mb:2},children:N.map(K=>{const re=K.data.id,ge=e?.includes(re);return o.jsx(Le,{label:K.data,onClick:()=>Ie(ge?O.filter(Dt=>Dt!==re):[...O,re]),sx:{height:24,lineHeight:"24px",".MuiChip-label":{maxHeight:24},...R(ge)}},re)})})]}):null},Nt=N=>o.jsxs(A,{component:"li",children:[o.jsx(A,{sx:{mb:.5,fontSize:12,fontWeight:"medium"},children:j("label.title")}),o.jsx(A,{component:"ul",sx:{display:"flex",flexWrap:"wrap",gap:.75,p:0},children:N.children})]}),ct=()=>o.jsx(mo,{open:!0,multiple:!0,inputValue:T,onInputChange:(N,K,re)=>{re==="reset"||re==="blur"||_(K)},onClose:(N,K)=>K==="escape"&&be(),value:M,onChange:(N,K,re)=>{N.preventDefault(),!(N.type==="keydown"&&N.key==="Backspace"&&re==="removeOption")&&(re==="selectOption"&&P(K[K.length-1].data.id),Ie(K.map(ge=>ge.data.id)))},disableCloseOnSelect:!0,renderTags:()=>null,noOptionsText:n||j("label.noLabels"),groupBy:()=>"x",renderOption:(N,K,{selected:re})=>{if(!$())return null;const ge=K.data;return k.createElement(A,{component:"li",...N,key:ge.id,sx:{"&.MuiAutocomplete-option":{p:"0 !important"}}},o.jsx(Le,{label:ge,sx:{height:24,lineHeight:"24px",".MuiChip-label":{maxHeight:24},...R(re)}}))},renderGroup:N=>o.jsxs(k.Fragment,{children:[Ne(),Nt(N)]},N.key),options:V,getOptionLabel:N=>N.data.getName(v),renderInput:N=>o.jsx(A,{component:Ir,ref:N.InputProps.ref,inputProps:N.inputProps,autoFocus:!0,placeholder:j("label.filter"),sx:K=>({padding:1,width:"100%",bgcolor:"background.paper","& input":{borderRadius:1,backgroundColor:"background.paper",padding:1,transition:K.transitions.create(["border-color","box-shadow"]),border:`1px solid ${K.palette.divider}`,fontSize:14,"&:focus":{boxShadow:`0px 0px 0px 3px ${Lr(K.palette.primary.light,.4)}`,borderColor:K.palette.primary.light}}})}),slots:{popper:ks}}),dt=()=>o.jsxs(A,{onClick:N=>N.stopPropagation(),children:[p&&T&&!B&&o.jsx(A,{sx:{display:"flex",alignItems:"center",gap:1,width:"100%",height:36,px:2,borderTop:"1px solid",borderColor:"divider",fontSize:14,color:"grey.600",cursor:"pointer"},onClick:Xe,children:j("label.createNewLabel",{name:T})}),s]});return o.jsxs(o.Fragment,{children:[o.jsx(A,{onClick:Y,sx:{display:"flex",alignItems:"center"},children:l||o.jsx(uo,{disableRipple:!0,"aria-describedby":ee,className:"label-picker-trigger",sx:[N=>({width:"100%",fontSize:13,color:N.palette.mode==="light"?"#586069":"#8b949e",fontWeight:600,"&:hover":{color:N.palette.mode==="light"?"primary.main":"#58a6ff"},"& svg":{width:22,height:22}}),...Array.isArray(r)?r:[r]],children:o.jsx(Pt,{style:{fontSize:14}})})}),o.jsx(fo,{id:ee,open:ne,anchorEl:b,placement:"bottom-start",disablePortal:h,sx:N=>({border:`1px solid ${N.palette.divider}`,boxShadow:`0 8px 24px ${N.palette.mode==="light"?"rgba(149, 157, 165, 0.2)":"rgb(1, 4, 9)"}`,borderRadius:1,width:360,overflow:"hidden",zIndex:N.zIndex.modal,fontSize:13,color:"text.secondary",backgroundColor:"background.paper"}),children:o.jsx(po,{onClickAway:be,children:o.jsxs(A,{onClick:N=>N.preventDefault(),children:[ct(),!x&&dt()]})})})]})}lt.propTypes={value:C.array,onChange:C.func,noLabelsText:C.string,buttonSx:C.array,actions:C.array,trigger:C.element,multiple:C.bool,updateImmediately:C.bool,excludes:C.array,disabled:C.bool,enableAccessControl:C.bool,disablePortal:C.bool,labels:C.array,disableCreate:C.bool};const tc={".MuiSvgIcon-root":{fontSize:"1.25rem"}};function Ss({sx:e={},...t}){return o.jsx(Ct,{variant:"outlined",IconComponent:ho,sx:Tr(tc,e),...t})}Ss.propTypes={sx:C.object};function Rn({value:e=[],onChange:t=()=>{},LabelPickerProps:n={},disabled:r=!1,sx:s=[],compact:l=!0,multiple:a=!0,...i}){const{getLabelsByIds:c,loading:f}=Ze(),u=k.useMemo(()=>c(e),[c,e]),h=e?.length>0,x=[{},...Array.isArray(s)?s:[s]],{t:j}=J(),v=e?.length?"":i.placeholder||j("label.selectLabels"),S=k.useRef(null),p=Dr(S),[d,m]=k.useState(99999);return k.useLayoutEffect(()=>{if(l){if(S.current){const{right:y}=S.current.getBoundingClientRect(),g=S.current.querySelectorAll(".MuiChip-root");g&&(Array.from(g).some((P,b)=>P.getBoundingClientRect().right>y?(m(b),!0):!1)||m(99999))}}else m(99999)},[u,p,l]),f?null:o.jsx(lt,{disabled:r,value:e,onChange:t,multiple:a,trigger:o.jsx(Ss,{multiple:a,disabled:r,open:!1,value:h?e:["none"],size:"small",renderValue:()=>h?o.jsx(A,{sx:{...l&&{height:20},mt:-.1,pr:3},children:o.jsx(A,{ref:S,sx:{display:"flex",gap:.5,...!l&&{flexWrap:"wrap"}},children:u.map((y,g)=>{const w=g<d;return o.jsxs(A,{sx:{position:"relative"},children:[g===d&&o.jsx(A,{sx:{display:"inline-flex",...l&&{height:20,lineHeight:"20px"},color:"text.secondary",fontWeight:"bold",fontSize:14},children:`+${e.length-d}`}),o.jsx(Le,{label:y.data,sx:{visibility:w?"visible":"hidden",pointerEvents:w?"auto":"none"},onDelete:()=>t(e.filter(P=>P!==y.data.id)),disabled:r})]},y.data.id)})})}):o.jsx(A,{sx:{color:"text.secondary",fontSize:14},children:v}),sx:x}),...n})}Rn.propTypes={value:C.array,onChange:C.func,LabelPickerProps:C.object,disabled:C.bool,sx:C.array,compact:C.bool,multiple:C.bool};function vt({labelPlacement:e="top",sx:t={},...n}){const s=Tr({alignItems:"stretch",m:0,".MuiFormControlLabel-label":{fontSize:14,fontWeight:"medium"}},t);return e==="start"&&s.push({justifyContent:"space-between",alignItems:"center"}),o.jsx(xn,{labelPlacement:e,...n,sx:s})}vt.propTypes={labelPlacement:C.oneOf(["top","start"]),sx:C.any};const br=["#4B5563","#1D4ED8","#6D28D9","#BE123C","#B45309","#047857"],gr=e=>{const t=new Option;return t.style.color=e,!!t.style.color};function Ls({open:e=!1,initialValue:t={},onSubmit:n=()=>{},onClose:r=()=>{},...s}){const{t:l}=J(),a=!t?.id,[i,c]=k.useState(null),[f,u]=da({id:t?.id||"",slug:t?.slug||"",title:t?.title||"",description:t?.description||"",color:t?.color||br[0],parentId:t?.parentId}),h=k.useMemo(()=>f.title&&f.slug&&f.color&&gr(f.color),[f]),x=()=>{n({...t,...f})},j=p=>u({color:p.hex}),v={id:f.id,title:f.title,color:f.color},S=!!i;return o.jsx(ke,{open:e,showCloseButton:!0,maxWidth:"lg",title:l(a?"label.create":"label.edit"),actions:o.jsxs(A,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",gap:1,width:"100%"},children:[o.jsx(A,{children:gr(v.color)&&v.title&&o.jsx(Le,{label:v})}),o.jsxs(A,{sx:{display:"flex",justifyContent:"flex-end",gap:1},children:[o.jsx(Pe,{color:"inherit",variant:"outlined",size:"small",onClick:r,children:l("common.cancel")}),o.jsx(Pe,{type:"submit",color:"primary",variant:"contained",size:"small",onClick:x,disabled:!h,children:l(a?"common.create":"common.saveChanges")})]})]}),onClose:r,...s,children:o.jsxs(A,{sx:{width:{xs:1,md:600},display:"flex",flexDirection:"column",gap:1.5},children:[[{label:l("label.name"),value:f.title,key:"title",disabled:!1},{label:l("label.slug"),value:f.slug,key:"slug",disabled:!a},{label:l("label.description"),value:f.description,key:"description",disabled:!1}].map(({label:p,value:d,key:m,disabled:y})=>o.jsx(vt,{label:p,sx:{width:"100%"},control:o.jsx(Fe,{value:d,size:"small",fullWidth:!0,onChange:g=>{u({[m]:g.target.value}),m==="title"&&u({slug:Jo(g.target.value)})},disabled:y})},m)),o.jsx(vt,{label:l("label.parentLabel"),sx:{width:"100%"},control:o.jsx(Rn,{value:f.parentId?[f.parentId]:[],onChange:p=>u({parentId:p[0]}),sx:{width:1},multiple:!1,LabelPickerProps:{excludes:t?.id?[t.id]:[]}})}),o.jsx(vt,{label:l("label.color"),sx:{width:"100%"},control:o.jsxs(A,{sx:{position:"relative"},children:[o.jsx(A,{sx:{display:"flex",alignItems:"center",gap:1},children:o.jsx(A,{sx:{width:32,height:32,bgcolor:f.color,borderRadius:1,border:1,borderColor:"grey.400"},onClick:p=>c(p.currentTarget)})}),o.jsx(bo,{id:S?"label-color-picker":void 0,anchorEl:i,open:S,onClose:()=>c(null),anchorOrigin:{vertical:"top",horizontal:"center"},transformOrigin:{vertical:"bottom",horizontal:"center"},children:o.jsx(ga,{presetColors:br,color:f.color,onChange:j})})]})})]})})}Ls.propTypes={open:C.bool,initialValue:C.object,onSubmit:C.func,onClose:C.func};const xr=new WeakMap;let nc=0;function rc(e){if(!e||typeof e!="object")return"weak-key-default";let t=xr.get(e);return t||(t=`weak-key-${nc++}`,xr.set(e,t)),t}function Is({open:e=!1,title:t=void 0,description:n=void 0,handleOk:r=void 0,handleCancel:s=void 0,okText:l=void 0,okButtonProps:a=void 0,cancelText:i=void 0,cancelButtonProps:c=void 0,actions:f=void 0,...u}){const h=gn(),x=go(h.breakpoints.down("md")),{t:j}=J(),v=()=>k.isValidElement(n)?n:o.jsx(At,{children:n}),S=k.useMemo(()=>{const p=[o.jsx(Pe,{color:"inherit",variant:"text",onClick:s,...c,children:i||j("common.cancel")||"Cancel"},"cancel"),o.jsx(Pe,{color:"primary",variant:"contained",onClick:r,...a,children:l||j("common.confirm")||"Yes"},"ok")];return f?f(p,s):p},[j,l,i,a,c,f,s,r]);return e?o.jsxs(xo,{fullScreen:x,onClose:s,maxWidth:"md",...u,open:e,children:[t&&o.jsx(yo,{variant:"h4",children:t}),o.jsx(vo,{sx:{minWidth:{xs:"initial",md:400}},children:v()}),o.jsx(Co,{children:S})]}):null}Is.propTypes={open:C.bool,title:C.string,description:C.string,handleOk:C.func,handleCancel:C.func,okText:C.string,okButtonProps:C.object,cancelText:C.string,cancelButtonProps:C.object,actions:C.func};const Ps=k.createContext({}),sc=()=>k.useContext(Ps);function As({children:e=null}){const[t,n]=k.useState(!1),[r,s]=k.useState({}),l=k.useRef(void 0),a=()=>{l.current?.(!0),n(!1)},i=()=>{l.current?.(!1),n(!1)},c=u=>(s(u),n(!0),new Promise(h=>{l.current=h})),f=k.useMemo(()=>({open:t,confirm:c}),[t]);return o.jsxs(Ps.Provider,{value:f,children:[e,o.jsx(Is,{...r.dialogProps||{},open:t,onClose:i,title:r.title,description:r.description,okText:r.okText,okButtonProps:r.okButtonProps,cancelText:r.cancelText,cancelButtonProps:r.cancelButtonProps,handleOk:a,handleCancel:i,actions:r.actions})]})}As.propTypes={children:C.node};function Ts({compact:e=!0,labels:t=[],sx:n=[],renderLabel:r=void 0,renderWhenEmpty:s=void 0,prepend:l=void 0,displaySystemLabels:a=!0,onItemClick:i=void 0}){const{getLabelsByIds:c,loading:f}=Ze(),u=k.useRef(null),h=Dr(u),[x,j]=k.useState(99999);let v=c(t||[]);if(a||(v=v.filter(p=>p.data.type!=="system")),ua(()=>{if(!e||!u.current){j(99999);return}const{right:p}=u.current.getBoundingClientRect(),d=u.current.querySelectorAll(".MuiChip-root");Array.from(d).some((m,y)=>m.getBoundingClientRect().right>p-36?(j(y),!0):!1)},[h,e]),f)return null;const S=[{display:"flex",gap:1,width:"100%",alignItems:"center",overflow:"hidden",flexWrap:e?"no-wrap":"wrap"},...Array.isArray(n)?n:[n]];return o.jsxs(A,{sx:S,ref:u,children:[l,v.length===0&&s,v.map((p,d)=>{if(!p)return null;const m=d<x,y=d===x,g=o.jsx(Le,{label:p.data,onClick:i,sx:{visibility:m?"visible":"hidden",pointerEvents:m?"auto":"none"}},p.data.id),w=r?r(p,g):g;return y?[o.jsx(A,{sx:{display:"inline-flex",...e&&{height:20,lineHeight:"20px"},color:"text.secondary",fontWeight:"bold",fontSize:14},children:`+${v.length-x}`},"overflow-label"),w]:w})]})}Ts.propTypes={compact:C.bool,labels:C.array,sx:C.oneOfType([C.object,C.array]),renderLabel:C.func,renderWhenEmpty:C.func,prepend:C.node,displaySystemLabels:C.bool,onItemClick:C.func};function Es({exclude:e=void 0,onChange:t=void 0}){const[n,r]=k.useState([]),{t:s}=J();return o.jsxs(A,{sx:{minHeight:200},children:[o.jsx(Ee,{severity:"info",sx:{mb:2},children:s("label.reassignTip")}),o.jsx(A,{sx:{display:"flex",alignItems:"center",gap:1},children:o.jsx(lt,{value:[n],onChange:l=>{r(l),t?.(l[0])},trigger:o.jsxs(Pe,{color:"inherit",variant:"outlined",startIcon:o.jsx(Pt,{style:{fontSize:14}}),children:[o.jsx(A,{component:"span",sx:{mr:1,whiteSpace:"nowrap"},children:s("label.reassignTo")}),!!n.length&&o.jsx(Ts,{compact:!1,labels:n})]}),multiple:!1,excludes:[e]})})]})}Es.propTypes={exclude:C.string,onChange:C.func};function _n({onReload:e=()=>{},...t}){const{t:n}=J(),{api:r}=de(),{teamDid:s}=he(),{confirm:l}=sc(),{labels:a,refetch:i}=Ze(),c=a||[],[f,u]=k.useState(null),[h,x]=k.useState(""),j=c.filter(m=>`${m.id}-${m.title}`.toLowerCase().includes(h.toLowerCase())),v=m=>{f||u({title:"New label",slug:"new-label",parentId:m})},S=m=>{f||u(m)},p=async m=>{const y=$o(m,g=>g);if(f)try{f.id?await r.updateTag({input:{teamDid:s,tag:y}}):await r.createTag({input:{teamDid:s,tag:y}}),oe.success(n("label.saveSuccess")),u(null),i(),e()}catch(g){oe.error(le(g))}},d=async m=>{let y;if(await l({title:n("label.deleteTip",{name:m.title}),description:o.jsxs(A,{sx:{width:540,maxWidth:"100%"},children:[o.jsx(ye,{variant:"body1",children:n("label.deleteDesc",{name:m.title})}),o.jsx(A,{sx:{py:2,color:"grey.800"},children:o.jsx(Mt,{children:o.jsx(Es,{exclude:m.id,onChange:w=>{y=w}})})})]})})){const w={teamDid:s,tag:m};y&&(w.moveTo=y),await r.deleteTag({input:w}).then(()=>{i(),oe.success(n("label.deleteSuccess")),e()}).catch(P=>{oe.error(le(P))})}};return o.jsxs(o.Fragment,{children:[o.jsxs(A,{sx:{display:"flex",flexDirection:"column",gap:2.5},...t,children:[o.jsxs(A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[o.jsx(ye,{variant:"h3"}),o.jsxs(A,{sx:{display:"flex",alignItems:"center",gap:1},children:[o.jsx(A,{component:Ir,value:h,onChange:m=>x(m.target.value),placeholder:n("label.search"),startAdornment:o.jsx(Pr,{}),sx:m=>({width:300,"& input":{p:1,px:4.5,borderRadius:1,backgroundColor:m.palette.mode==="light"?"#fff":"#0d1117",transition:m.transitions.create(["border-color","box-shadow"]),border:`1px solid ${m.palette.mode==="light"?"#eaecef":"#30363d"}`,fontSize:14,"&:focus":{boxShadow:`0px 0px 0px 3px ${m.palette.mode==="light"?Lr(m.palette.primary.light,.4):"rgb(12, 45, 107)"}`,borderColor:m.palette.mode==="light"?m.palette.primary.light:"#388bfd"}},"& .MuiSvgIcon-root":{position:"absolute",left:8,fontSize:20,color:"grey.700"}})}),o.jsx(Pe,{color:"primary",variant:"contained",startIcon:o.jsx(ze,{}),sx:{textTransform:"none"},onClick:()=>v(),children:n("label.create")})]})]}),o.jsx(jo,{}),o.jsxs(A,{sx:{display:"flex",flexDirection:"column",gap:1},children:[j.map(m=>o.jsxs(A,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",py:1,px:2,border:1,borderColor:"grey.300",gap:1,borderRadius:1.5},children:[o.jsx(A,{children:o.jsx(A,{sx:{display:"flex",flexWrap:"wrap",alignItems:"center",gap:1},children:o.jsx(A,{sx:{display:"inline-flex",alignItems:"center",gap:1,py:.5,fontSize:14,color:"grey.700",fontWeight:"bold",borderRadius:"4px"},children:o.jsx(Le,{label:m})})})}),o.jsx(A,{sx:{display:"flex",gap:.5,flex:"0 0 auto"},children:o.jsxs(A,{sx:{display:"flex",gap:.5},children:[o.jsx(rt,{color:"inherit",size:"small",sx:{color:"grey.500"},onClick:()=>v(m.id),children:o.jsx(ze,{sx:{fontSize:20}})}),o.jsx(rt,{color:"inherit",size:"small",sx:{color:"grey.500"},onClick:()=>S(m),children:o.jsx(wo,{sx:{fontSize:18}})}),o.jsx(rt,{disabled:m.type==="system",size:"small",sx:{color:"error.main"},onClick:()=>d(m),children:o.jsx(ko,{sx:{fontSize:20}})})]})})]},m.id)),j?.length===0&&o.jsx(A,{height:300,children:o.jsx(Er,{children:n("label.noLabels")})})]})]}),o.jsx(Ls,{open:!!f,onClose:()=>u(null),initialValue:f,onSubmit:p},rc(f))]})}_n.propTypes={onReload:C.func};function Rs({...e}){return o.jsx(As,{children:o.jsx(Mt,{children:o.jsx(_n,{...e})})})}Rs.propTypes={..._n.propTypes};var oc={};function _s({teamDid:e,roles:t=[],apps:n=[],onCancel:r,onSuccess:s,onError:l=()=>{},endpoint:a=""}){const{api:i}=de(),{t:c,locale:f}=J(),u=it({loading:!1,error:null,activeStep:0,inviteInfo:null,role:"",remark:"",sourceAppPid:n.length>0?n[0].appPid:null,display:null,passportExpireTime:null,showPicker:!1}),h=async()=>{if(!u.role){u.error=c("team.member.error.passportEmpty");return}if(u.passportExpireTime&&Yn(u.passportExpireTime).isBefore(Yn())){u.error=c("team.passport.customExpireTimeIsInvalid");return}const p=u.remark.trim();u.error=null,u.loading=!0;try{let d=u.sourceAppPid??null;d===e&&(d=null);const m={teamDid:e,role:u.role,remark:p,sourceAppPid:d,passportExpireTime:u.passportExpireTime?u.passportExpireTime.toISOString():""};u.display&&(m.display={type:"url",content:u.display});const{inviteInfo:y}=await i.createMemberInvitation({input:m});u.inviteInfo=y,u.activeStep=1}catch(d){const m=le(d);u.error=m,l(d)}finally{u.loading=!1}},x=t.find(p=>p.name===u.role),j=t.filter(p=>p.name!=="owner"),S=[{body:o.jsxs(A,{sx:{display:"flex",flexDirection:"column",gap:3},children:[n.length>1?o.jsxs(an,{fullWidth:!0,children:[o.jsx(ln,{children:c("common.sourceApp")}),o.jsx(Ct,{value:u.sourceAppPid,onChange:p=>{u.error=null,u.sourceAppPid=p.target.value},fullWidth:!0,label:c("common.passport"),disabled:u.loading,children:n.map(p=>o.jsx(jt,{value:p.appPid,children:o.jsxs(A,{sx:{display:"flex",justifyContent:"space-between",gap:2,width:"100%"},children:[o.jsxs(A,{sx:{display:"flex",alignItems:"center",gap:1},children:[o.jsx(qo,{did:p.appPid,size:28}),p.appName]}),o.jsx(Ho,{did:p.appPid,compact:!0,responsive:!1})]})},p.appPid))})]}):null,o.jsxs(an,{fullWidth:!0,variant:"outlined",children:[o.jsx(ln,{children:c("common.passport")}),o.jsx(Ct,{"data-cy":"invite-member-select-role",value:u.role,onChange:p=>{u.error=null,u.role=p.target.value},fullWidth:!0,label:c("common.passport"),disabled:u.loading,onKeyPress:p=>{p.key==="Enter"&&(p.preventDefault(),h())},children:j.map(p=>o.jsx(jt,{value:p.name,"data-cy":`invite-member-select-option-${p.name}`,children:o.jsxs(A,{sx:{display:"flex",flexDirection:"column"},children:[o.jsx(ye,{variant:"subtitle1",children:p.title||p.name}),o.jsx(ye,{variant:"caption",sx:{opacity:.7},children:p.description})]})},p.name))})]}),x?.extra?.display==="custom"&&o.jsx(Fe,{label:c("common.display"),type:"url",value:u.display,onChange:p=>{u.error=null,u.display=p.target.value},fullWidth:!0,variant:"outlined",margin:"normal"}),o.jsx(Fe,{label:c("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,value:u.remark,onChange:p=>{u.error=null,u.remark=p.target.value},disabled:u.loading,"data-cy":"invite-member-input-remark"}),o.jsx(Br,{value:u.passportExpireTime,onChange:p=>{u.error=null,u.passportExpireTime=p},showError:!1})]}),cancel:c("common.cancel"),confirm:c("team.member.inviteDialog.createInviteLink"),onCancel:r,onConfirm:h},{body:()=>{const p=un({inviteId:u.inviteInfo?.inviteId,endpoint:a});return o.jsxs("div",{children:[o.jsx(A,{sx:{fontSize:16,fontWeight:"bold"},children:c("team.member.inviteDialog.createSuccessTip",{expireDate:st(u.inviteInfo?.expireDate,f)})}),o.jsx("div",{style:{marginTop:"40px"}}),o.jsx(Cn,{children:p})]})},confirm:c("common.copy"),onConfirm:()=>{const p=un({inviteId:u.inviteInfo?.inviteId,endpoint:a});if(["1","true"].includes(oc.IS_E2E)){s();return}fa(p),oe.success(c("common.copied")),s()},cancel:c("common.cancel"),onCancel:r}][u.activeStep];return o.jsxs(ke,{title:c("common.invite"),fullWidth:!0,open:!0,showCloseButton:!1,actions:o.jsxs(o.Fragment,{children:[S.cancel&&o.jsx(ae,{onClick:S.onCancel,color:"inherit",children:S.cancel}),o.jsxs(ae,{onClick:S.onConfirm,color:"primary",disabled:u.loading||!u.role,variant:"contained",autoFocus:!0,children:[u.loading&&o.jsx(Ue,{size:16}),S.confirm]})]}),children:[o.jsx(At,{component:"div",children:typeof S.body=="function"?S.body():S.body}),!!u.error&&o.jsx(Ee,{severity:"error",sx:{mt:2},children:u.error})]})}_s.propTypes={teamDid:C.string.isRequired,onCancel:C.func.isRequired,onSuccess:C.func.isRequired,onError:C.func,roles:C.array,apps:C.array,endpoint:C.string};function Os({teamDid:e,onCancel:t,onSuccess:n,onError:r=()=>{},endpoint:s=""}){const{api:l,info:a}=de(),{api:i}=k.useContext(ea),[c,f]=k.useState(!1),{t:u,locale:h}=J(),[x,j]=k.useState(""),[v,S]=k.useState(!1),[p,d]=k.useState(0),[m,y]=k.useState(""),[g,w]=k.useState(""),P=!!cn(a,"ownerNft.did"),b=xa(async()=>{if(P){const{state:B}=await l.getDelegationState();return B}return{delegated:!0}});if(b.loading)return o.jsx(ke,{title:u("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:t,children:o.jsx("div",{style:{display:"flex",justifyContent:"center"},children:o.jsx(Ue,{})})});if(b.error)return o.jsx(ke,{title:u("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,onClose:t,children:o.jsx(Ee,{severity:"error",children:le(b.error)})});const L=async()=>{j(null),f(!0);try{const{inviteInfo:B}=await l.createTransferInvitation({input:{teamDid:e,role:"owner",remark:g.trim()}});y(B),d(O.length-1)}catch(B){const V=le(B);j(V),r(B)}finally{f(!1)}},T=()=>{S(!0),d(1)},_=()=>{S(!1),d(0)},O=[{body:o.jsxs(ye,{component:"div",children:[o.jsxs(Ee,{severity:"warning",children:[o.jsx(ye,{children:u("team.transferNode.inviteDialog.tips.progress")}),o.jsx(ye,{children:u("team.transferNode.inviteDialog.tips.newOwnerPermissions")})]}),o.jsx(Ee,{severity:"warning",children:o.jsx(ye,{children:u("team.transferNode.inviteDialog.tips.revoke")})}),o.jsx("div",{style:{marginTop:20,marginBottom:10}}),o.jsx(Fe,{label:u("common.remark"),autoComplete:"off",variant:"outlined",fullWidth:!0,style:{marginBottom:8},value:g,onChange:B=>{j(null),w(B.target.value)},disabled:c,"data-cy":"transfer-node-input-remark"}),o.jsx("div",{style:{marginTop:20,marginBottom:10}})]}),cancel:u("common.cancel"),confirm:u("team.transferNode.inviteDialog.createInviteLink"),onCancel:t,onConfirm:P&&!cn(b,"value.delegated")?T:L},{body:()=>o.jsx(ta,{action:"delegate-transfer-nft",open:v,locale:h,checkFn:i.get,onClose:_,onSuccess:L,checkTimeout:5*60*1e3,webWalletUrl:na(a),extraParams:{targetDID:a.did},messages:{title:u("team.transferNode.delegateDialog.title"),scan:u("team.transferNode.delegateDialog.scan"),confirm:u("team.transferNode.delegateDialog.confirm"),success:u("team.transferNode.delegateDialog.success")},popup:!0})},{body:()=>{const B=un({inviteId:m.inviteId,endpoint:s});return o.jsxs("div",{children:[o.jsx(ac,{children:u("team.transferNode.inviteDialog.createSuccessTip",{expireDate:st(m.expireDate,h)})}),o.jsx("div",{style:{marginTop:"40px"}}),o.jsx(Cn,{children:B})]})},confirm:u("common.confirm"),onConfirm:n}],M=O[p];return o.jsxs(ke,{title:u("team.transferNode.inviteDialog.title"),fullWidth:!0,open:!0,showCloseButton:!1,actions:o.jsxs(o.Fragment,{children:[M.cancel&&o.jsx(ae,{onClick:M.onCancel,color:"inherit",children:M.cancel}),o.jsxs(ae,{onClick:M.onConfirm,color:"primary",disabled:c,variant:"contained",autoFocus:!0,children:[c&&o.jsx(Ue,{size:16}),M.confirm]})]}),children:[o.jsx(At,{component:"div",children:typeof M.body=="function"?M.body():M.body}),!!x&&o.jsx(Ee,{severity:"error",children:x})]})}Os.propTypes={teamDid:C.string.isRequired,onCancel:C.func.isRequired,onSuccess:C.func.isRequired,onError:C.func,endpoint:C.string};const ac=me.div`
14
+ font-size: 16px;
15
+ font-weight: bold;
16
+ `;function hn({passport:e,onDelete:t=null,...n}){return o.jsxs(ic,{...n,children:[e.title||e.name," ",!!t&&o.jsx(Sr,{"data-cy":"delete-issuance",className:"delete",onClick:t})]})}hn.propTypes={passport:C.object.isRequired,onDelete:C.func};const ic=me.span`
17
+ display: inline-flex;
18
+ padding: 2px 8px;
19
+ background: ${e=>e.theme.palette.primary.main};
20
+ border-radius: 100vw;
21
+ font-weight: 400;
22
+ font-size: 12px;
23
+ line-height: 22px;
24
+ color: #fff;
25
+ align-items: center;
26
+ .delete {
27
+ font-size: 1em;
28
+ margin-left: 6px;
29
+ cursor: pointer;
30
+ }
31
+ `;function Ms({issuances:e=[],teamDid:t,onRefresh:n=()=>{}}){const{api:r,inService:s}=de(),{t:l,locale:a}=k.useContext(Tt),[i,c]=k.useState(null),[f,u]=k.useState(!1),{endpoint:h}=he(),x=async({id:p})=>{if(!f){u(!0);try{await r.deletePassportIssuance({input:{teamDid:t,sessionId:p}}),n()}catch(d){oe.error(d.message)}finally{u(!1),c(null)}}},j=()=>{u(!1),c(null)},v=p=>h?ra({id:p.id,endpoint:h}):"";function S({data:p}){return o.jsxs("div",{className:"issuance",children:[o.jsxs(A,{sx:{display:"flex",justifyContent:"space-between"},children:[o.jsx(We,{permission:s?"":"mutate_team",role:s?ot:[],children:d=>d?o.jsx(hn,{passport:{title:p.title,name:p.name},onDelete:()=>c({title:l("team.passport.issuance.delete.title"),description:l("team.passport.issuance.delete.description",{link:v(p)}),confirm:l("common.delConfirm"),cancel:l("common.cancel"),onConfirm:()=>{x(p)},onCancel:j})}):o.jsx(hn,{passport:{title:p.title,name:p.name}})}),o.jsxs("div",{style:{color:"#999"},children:[l("common.expires"),": ",st(p.expireDate,a)]})]}),o.jsx(A,{sx:{mt:2},children:o.jsx(Cn,{children:v(p)})})]})}return o.jsxs(lc,{children:[e.map(p=>o.jsx(S,{data:p})),i&&o.jsx(Et,{title:i.title,description:i.description,confirm:i.confirm,cancel:i.cancel,params:i.params,onConfirm:i.onConfirm,onCancel:i.onCancel})]})}const lc=me.div`
32
+ .MuiTableHead-root {
33
+ display: none;
34
+ }
35
+ .issuance {
36
+ padding: 16px 0;
37
+ border-bottom: 1px solid #f0f0f0;
38
+ .MuiTypography-root {
39
+ display: inline-block;
40
+ width: 100%;
41
+ background: #f3f3f3;
42
+ border-radius: 4px;
43
+ padding-top: 6px;
44
+ padding-bottom: 6px;
45
+ }
46
+ }
47
+ `;Ms.propTypes={teamDid:C.string.isRequired,issuances:C.array,onRefresh:C.func};var xe={},yr;function cc(){if(yr)return xe;yr=1,Object.defineProperty(xe,"__esModule",{value:!0}),xe.getPermanentDid=t,xe.getConnectedAccounts=n,xe.getConnectedDids=r,xe.getWallet=s,xe.getWalletDid=l,xe.getSourceProvider=a,xe.getSourceProviders=i;const e=sa();function t(c){return c?.did}function n(c){return c?.connectedAccounts||[]}function r(c){return n(c).map(h=>h.did)}function s(c){return n(c).find(h=>h.provider===e.LOGIN_PROVIDER.WALLET)}function l(c){return s(c)?.did}function a(c){return c?.sourceProvider||e.LOGIN_PROVIDER.WALLET}function i(c){return n(c).map(u=>u.provider)}return xe}var Ns=cc();const dc=me(({children:e,...t})=>o.jsx(Fe,{...t,id:"outlined-basic",variant:"outlined",size:"small",slotProps:{input:{startAdornment:o.jsx(Pr,{})}},children:e}))`
48
+ .MuiOutlinedInput-root {
49
+ color: #999;
50
+ &.MuiInputBase-adornedStart .MuiSvgIcon-root {
51
+ color: #bfbfbf;
52
+ }
53
+ border-radius: 100vw;
54
+ }
55
+
56
+ .MuiOutlinedInput-notchedOutline,
57
+ .MuiOutlinedInput-root:hover .MuiOutlinedInput-notchedOutline,
58
+ .Mui-focused .MuiOutlinedInput-notchedOutline {
59
+ border-color: #eee;
60
+ border-width: 1px;
61
+ }
62
+ `,uc=me.div`
63
+ display: flex;
64
+ justify-content: space-between;
65
+ align-items: center;
66
+ font-size: 14px;
67
+
68
+ .right {
69
+ display: flex;
70
+ align-items: center;
71
+ }
72
+
73
+ .tabs {
74
+ .MuiButton-root {
75
+ border: none;
76
+ color: #999;
77
+ &.active {
78
+ color: #222;
79
+ }
80
+ }
81
+ }
82
+
83
+ @media (max-width: 600px) {
84
+ display: block;
85
+ .right {
86
+ margin-top: 12px;
87
+ }
88
+ }
89
+ `;function On({teamDid:e,ownerDid:t,needReceive:n=!0,roles:r=[],onCancel:s,onSuccess:l,onError:a=()=>{},showOwnerPassport:i=!1}){const{api:c}=de(),[f,u]=k.useState(!1),[h,x]=k.useState(""),{t:j}=J(),[v,S]=k.useState(""),[p,d]=k.useState(""),m=it({passportExpireTime:null});k.useEffect(()=>{r.length>0&&S(r[0].name)},[]);const y=async()=>{if(!v){x(j("team.member.error.passportEmpty"));return}x(null),u(!0);try{const w={teamDid:e,name:v,ownerDid:t,passportExpireTime:m.passportExpireTime?m.passportExpireTime.toISOString():""};p&&(w.display={type:"url",content:p}),await c.createPassportIssuance({input:w}),l()}catch(w){const P=le(w);x(P),a(w)}finally{u(!1)}},g=r.find(w=>w.name===v);return o.jsxs(ke,{title:j("team.passport.issue"),fullWidth:!0,open:!0,onClick:w=>w.stopPropagation(),onClose:s,disableEscapeKeyDown:!0,PaperProps:{style:{minHeight:"auto"}},actions:o.jsxs(o.Fragment,{children:[o.jsx(ae,{onClick:s,color:"inherit",size:"small",children:j("common.cancel")}),o.jsxs(ae,{onClick:y,color:"primary",size:"small",disabled:f||!v,variant:"contained",autoFocus:!0,"data-cy":"issue-passport-create-btn",children:[f&&o.jsx(Ue,{size:16}),j(n?"team.passport.issuance.create.title":"oauth.issued")]})]}),children:[o.jsx(At,{component:"div",children:o.jsxs(A,{sx:{display:"flex",flexDirection:"column",gap:3},children:[o.jsxs(an,{style:{width:"100%"},variant:"outlined",children:[o.jsx(ln,{children:j("common.passport")}),o.jsx(Ct,{"data-cy":"issue-passport-select-passport",value:v,onChange:w=>{x(null),S(w.target.value)},fullWidth:!0,label:j("common.passport"),disabled:f,onKeyPress:w=>{w.key==="Enter"&&(w.preventDefault(),y())},children:r.filter(w=>i||w.name!=="owner").map(w=>o.jsx(jt,{value:w.name,"data-cy":`issue-passport-select-option-${w.name}`,children:o.jsxs(A,{sx:{display:"flex",flexDirection:"column"},children:[o.jsx(ye,{variant:"subtitle1",children:w.title||w.name}),o.jsx(ye,{variant:"caption",sx:{opacity:.7},children:w.description})]})},w.name))})]}),g?.extra?.display==="custom"&&o.jsx(Fe,{label:j("common.display"),type:"url",value:p,onChange:w=>d(w.target.value),fullWidth:!0,variant:"outlined",margin:"normal"}),o.jsx(Br,{value:m.passportExpireTime,onChange:w=>{m.passportExpireTime=w}})]})}),!!h&&o.jsx(Ee,{severity:"error",variant:"icon",children:h})]})}On.propTypes={teamDid:C.string.isRequired,ownerDid:C.string.isRequired,needReceive:C.bool,onCancel:C.func.isRequired,onSuccess:C.func.isRequired,onError:C.func,roles:C.array,showOwnerPassport:C.bool};function Ds({passport:e,user:t,color:n,width:r=150,icon:s=null,children:l=null,createPassportSvg:a,...i}){const{t:c,locale:f}=J();return o.jsxs(fc,{display:"flex",alignItems:"center",...i,children:[!!e.display&&o.jsx("div",{className:"passport-item__display",style:{width:r},children:o.jsx(ya,{address:e.id,data:e.display,style:{width:"100%"},imageFilter:typeof r=="number"?{imageFilter:"resize",w:r}:null})}),!e.display&&o.jsx("div",{dangerouslySetInnerHTML:{__html:a({scope:e.scope,role:e.role,title:e.scope==="kyc"?e.name:e.title,issuer:e.issuer&&e.issuer.name,issuerDid:e.issuer&&e.issuer.id,ownerName:t.fullName,ownerDid:t.did,ownerAvatarUrl:t.avatar,revoked:e.revoked,preferredColor:n,width:r,extra:e.scope==="kyc"?{key:"Email",value:e.name}:void 0})}}),o.jsxs("div",{className:"body",children:[o.jsxs(A,{className:"title",sx:{display:"flex",alignItems:"center"},children:[Bo(e.title),o.jsxs("div",{className:"status-icons",children:[s,e.revoked&&o.jsx($r,{})]})]}),e.issuanceDate&&o.jsx(A,{className:"title",sx:{display:"flex",alignItems:"center"},children:c("team.passport.issuanceDate",{date:st(e.issuanceDate,f)})}),e.expirationDate&&o.jsx(A,{className:"title",sx:{display:"flex",alignItems:"center"},children:c("team.passport.validUntil",{date:st(e.expirationDate,f)})}),l]})]})}Ds.propTypes={passport:C.any.isRequired,user:C.any.isRequired,color:C.string.isRequired,createPassportSvg:C.func.isRequired,icon:C.any,children:C.any,width:C.number};const fc=me(A)`
90
+ .body {
91
+ padding: 0;
92
+ margin-left: 24px;
93
+ margin-top: 0;
94
+ }
95
+ .title {
96
+ font-weight: 400;
97
+ font-size: 16px;
98
+ line-height: 19px;
99
+ color: ${({theme:e})=>e.palette.text.primary};
100
+ margin-bottom: 8px;
101
+ }
102
+ .tip {
103
+ display: flex;
104
+ align-items: center;
105
+ font-size: 14px;
106
+ margin-top: 6px;
107
+ color: ${({theme:e})=>e.palette.text.secondary};
108
+ }
109
+ .status-icons {
110
+ svg {
111
+ fill: ${({theme:e})=>e.palette.text.secondary};
112
+ height: 1.2em;
113
+ margin-left: 0.4em;
114
+ }
115
+ }
116
+ `;function bn({action:e,passport:t}){const{t:n}=J(),{roles:r}=he(),s=r.find(l=>l.name===t.role);return o.jsxs("div",{children:[o.jsx("div",{children:n(e==="enable"?"team.member.enablePassportDescription":"team.member.revokePassportDescription")}),s&&o.jsx(A,{sx:{mt:3,fontWeight:"bold"},children:n("team.member.passportPermissionTitle")}),s&&o.jsx(A,{sx:{mt:1},children:s.description})]})}bn.propTypes={action:C.string.isRequired,passport:C.object.isRequired};function $s({user:e,onCreate:t=()=>{},createPassportSvg:n}){const r=it({scope:"passport"}),s=gn(),{t:l}=J(),{session:a}=Me(),{roles:i,teamDid:c,teamIssuerDid:f,refresh:u,enablePassportIssuance:h,trustedPassports:x,passportColor:j,blocklet:v}=he(),{appIdList:S}=Rr(),{api:p,inService:d}=de(),[m,y]=k.useState(!1),[g,w]=k.useState(null),[P,b]=k.useState(!1),[L,T]=k.useState(""),_=[f,...S||[]].filter(Boolean),O=(cn(e,"passports")||[]).map(R=>({...R,revoked:R.status===Re.PASSPORT_STATUS.REVOKED})),M=async R=>{if(!m){y(!0);try{const $=R.status===Re.PASSPORT_STATUS.REVOKED?"enableUserPassport":"revokeUserPassport";await p[$]({input:{teamDid:c,userDid:e.did,passportId:R.id}}),u()}catch($){oe.error(le($))}finally{y(!1),w(null)}}},B=R=>R.status===Re.PASSPORT_STATUS.REVOKED?w({title:l("team.member.enablePassport"),description:o.jsx(bn,{action:"enable",passport:R}),confirm:l("common.enable"),cancel:l("common.cancel"),onConfirm:()=>{M(R)},onCancel:()=>{y(!1),w(null)},color:"primary"}):w({title:l("team.member.revokePassport"),description:o.jsx(bn,{action:"revoke",passport:R}),confirm:l("common.revoke"),cancel:l("common.cancel"),onConfirm:()=>{M(R)},onCancel:()=>{y(!1),w(null)}}),V=(R,$)=>e.did===a.user.did&&a.user.passportId&&a.user.passportId===$.id?{revokable:!1,message:l("team.passport.shouldNotDeleteCurrent")}:R?c===$.issuer.id&&$.name==="owner"?{revokable:!1,message:l("team.passport.noPermission")}:{revokable:!0}:{revokable:!1,message:l("team.passport.noPermission")},H=O.filter(R=>r.scope?R.scope===r.scope:!0).filter(R=>!L||R.title.includes(L)||R.name.includes(L)),ne=(R,$)=>$.status===Re.PASSPORT_STATUS.EXPIRED?o.jsx(ae,{variant:"outlined",disabled:!0,children:l("common.expired")}):V(R,$).revokable?o.jsxs(ae,{variant:"outlined",color:$.revoked?"primary":"secondary",onClick:()=>B($),children:[$.revoked?o.jsx(ze,{style:{fontSize:16,marginRight:4}}):o.jsx($r,{style:{height:16,marginRight:4}}),$.revoked?l("common.enable"):l("common.revoke")]}):o.jsx(wt,{title:V(R,$).message,children:o.jsx(qn,{style:{color:s.palette.grey[600]}})}),ee=[{label:"All",value:""},{label:"passport",value:"passport"},{label:"kyc",value:"kyc"}];return o.jsxs(pc,{children:[o.jsxs(uc,{children:[o.jsx("div",{className:"left",children:o.jsx(dc,{placeholder:l("team.passport.search"),value:L,onChange:R=>T(R.target.value)})}),o.jsx("div",{className:"right",children:h&&!!e.approved&&o.jsx(We,{permission:d?"":"mutate_team",role:d?ot:[],children:o.jsxs(ae,{size:"small",variant:"contained",color:"primary","data-cy":"issue-passport",onClick:()=>b(!0),children:[o.jsx(ze,{style:{fontSize:16,marginRight:4}}),l("team.passport.issue")]})})})]}),o.jsxs(A,{sx:{mt:3},children:[o.jsx(So,{row:!0,children:ee.map(R=>o.jsx(xn,{value:R.value,control:o.jsx(Lo,{onChange:()=>{r.scope=R.value},checked:r.scope===R.value,size:"small"}),label:R.label}))}),H.map(R=>o.jsx(We,{permission:d?"":"mutate_team",role:d?ot:[],children:$=>o.jsxs(A,{className:"passport-item",sx:{display:"flex",justifyContent:"space-between",alignItems:"center"},children:[o.jsx(Ds,{passport:R,user:e,color:j,createPassportSvg:n,icon:_.length&&!_.includes(R.issuer.id)?o.jsx(Wr,{}):null,children:!!_.length&&!_.includes(R.issuer.id)&&o.jsxs("div",{className:"tip",children:[R.issuer.id!==f&&!x.some(Y=>Y.issuerDid===R.issuer.id)&&o.jsx(wt,{title:l("team.passport.notTrustedIssuerTip"),children:o.jsx(A,{component:qn,style:{fontSize:"1.3em"},sx:{color:"error.main",mr:.5}})}),o.jsx("span",{children:l("team.passport.issueBy",{name:R.issuer.name})})]})}),o.jsx(A,{children:ne($,R)})]})},R.id)),!H.length&&o.jsx(Er,{children:l("common.empty")})]}),P&&o.jsx(On,{teamDid:c,ownerDid:e.did,needReceive:Ns.getWalletDid(e)===e.did,roles:i,onCancel:()=>b(!1),onSuccess:()=>{t(),b(!1)},showOwnerPassport:v&&!v.settings?.owner}),g&&o.jsx(Et,{title:g.title,description:g.description,confirm:g.confirm,cancel:g.cancel,params:g.params,onConfirm:g.onConfirm,onCancel:g.onCancel,color:g.color})]})}$s.propTypes={user:C.object.isRequired,createPassportSvg:C.func.isRequired,onCreate:C.func};const pc=me.div`
117
+ .passport-item {
118
+ .MuiButton-outlinedSecondary {
119
+ color: #f16e6e;
120
+ fill: #f16e6e;
121
+ background: #fcf3f3;
122
+ border: 0;
123
+ &:hover {
124
+ border: 0;
125
+ }
126
+ }
127
+ }
128
+ `,mc=lo(Fo);var sn,vr;function hc(){if(vr)return sn;vr=1;const e=mc,{ROLES:t,PASSPORT_STATUS:n}=oa();return sn={hasActiveOwnerPassport:l=>(l?.passports||[]).some(a=>a.role===t.OWNER&&a.status===n.VALID),getActivePassports:(l,a=[])=>{const i=c=>c.status!==n.VALID||!a.includes(c.issuer.id)?!1:!(c.expirationDate&&Date.now()>new Date(c.expirationDate).getTime());return e((l.passports||[]).filter(c=>!c.display).filter(i),"name").concat(e((l.passports||[]).filter(c=>c.display).filter(i),"display.content"))}},sn}var Bs=hc();function Mn({user:e={},onCancel:t=()=>{},onSuccess:n=()=>{},onError:r=()=>{},children:s=null}){const{api:l,info:a,inService:i}=de(),{session:c}=Me(),{teamDid:f,refresh:u}=he(),{t:h}=J(),[x,j]=k.useState(!1),[v,S]=k.useState(!1),p=()=>S(!0),d=async g=>{const{did:w,approved:P}=g;if(!x){j(!0);try{await l.updateUserApproval({input:{teamDid:f,user:{did:w,approved:!P}}}),S(!1),n(),u()}catch(b){oe.error(le(b)),r()}finally{j(!1)}}},m={title:e.approved?h("team.member.blockAccess"):h("team.member.allowAccess"),description:e.approved?h("team.member.blockAccessDescription"):h("team.member.allowAccessDescription"),confirm:h("common.confirm"),cancel:h("common.cancel"),onConfirm:()=>{d(e)},onCancel:()=>{j(!1),S(!1),t()},color:e.approved?"error":"primary"};let y;return Bs.hasActiveOwnerPassport(e)?y=!1:i?y=!kt(c.user,e.did):y=a.nodeOwner&&!Fr(a,e.did)&&!kt(c.user,e.did),y?o.jsxs(o.Fragment,{children:[typeof s=="function"?s({can:y,open:p}):s,v?o.jsx(Et,{title:m.title,description:m.description,confirm:m.confirm,cancel:m.cancel,params:m.params,onConfirm:m.onConfirm,onCancel:m.onCancel,color:m.color}):null]}):null}Mn.propTypes={user:C.object,onSuccess:C.func,onCancel:C.func,onError:C.func,children:C.oneOfType([C.object,C.func])};function Fs({user:e={},onCancel:t=()=>{},onSuccess:n=()=>{},onError:r=()=>{},children:s=null}){const{api:l,info:a,inService:i}=de(),{session:c}=Me(),{teamDid:f}=he(),{t:u}=J(),[h,x]=k.useState(!1),[j,v]=k.useState(!1),S=()=>v(!0),p=async y=>{const{did:g}=y;if(!h){x(!0);try{await l.removeUser({input:{teamDid:f,user:{did:g}}}),v(!1),n(),oe.success(u("team.member.removeUserSuccess")),setTimeout(()=>{window.location.reload()},1e3)}catch(w){oe.error(le(w)),r()}finally{x(!1)}}},d={title:u("team.member.removeUser"),description:u("team.member.removeUserDescription",{did:e.did}),confirm:u("common.confirm"),cancel:u("common.cancel"),onConfirm:()=>{p(e)},onCancel:()=>{x(!1),v(!1),t()},color:"error"};let m;return Bs.hasActiveOwnerPassport(e)?m=!1:i?m=!kt(c.user,e.did):m=a.nodeOwner&&!Fr(a,e.did)&&!kt(c.user,e.did),m?o.jsxs(o.Fragment,{children:[typeof s=="function"?s({can:m,open:S}):s,j?o.jsx(Et,{title:d.title,description:d.description,confirm:d.confirm,cancel:d.cancel,params:d.params,onConfirm:d.onConfirm,onCancel:d.onCancel,color:d.color}):null]}):null}Fs.propTypes={user:C.object,onSuccess:C.func,onCancel:C.func,onError:C.func,children:C.oneOfType([C.object,C.func])};function zs({hasPasskey:e=!1}){const{isNodeTeam:t}=he();return t?o.jsx(aa,{behavior:"only-new",action:"connect",createMode:"connect",createButtonText:e?"Add New Passkey":"Add Passkey",onSuccess:Kn,onError:Kn,dense:!0}):null}zs.propTypes={hasPasskey:C.bool};function Us({user:e,onChangeUser:t=()=>{}}){const n=e.connectedAccounts||[],{t:r}=J(),{session:s}=Me(),{disconnectPasskey:l}=s.usePasskey(),a=n.some(i=>i.provider===_e.LOGIN_PROVIDER.PASSKEY&&i.did);return o.jsxs("div",{children:[n.map(i=>o.jsxs("div",{children:[o.jsx(ue,{style:{alignItems:"flex-start",cursor:"pointer"},valueComponent:"div",nameWidth:120,name:i.provider,onClick:()=>{const c=document.getElementById(`account-details-${i.did}`);c&&(c.style.display=c.style.display==="none"?"block":"none")},children:o.jsx(vn,{did:i.did,showQrcode:!0})},i.did),o.jsxs(Io,{id:`account-details-${i.did}`,sx:{display:"none",mt:-1,mb:1,pt:1,pl:1,pr:1,boxShadow:"none",border:"1px solid #e0e0e0"},children:[i.did&&o.jsx(ue,{nameWidth:120,name:"DID",children:i.did}),i.pk&&o.jsx(ue,{nameWidth:120,name:"PublicKey",children:i.pk}),i.id&&o.jsx(ue,{nameWidth:120,name:"ID",children:i.id}),i.sub&&o.jsx(ue,{nameWidth:120,name:"Sub",children:i.sub}),i.lastLoginAt&&o.jsx(ue,{nameWidth:120,name:"Last Login",children:i.lastLoginAt}),i.counter&&o.jsx(ue,{nameWidth:120,name:"Counter",children:i.counter}),i.userInfo&&o.jsx(ue,{nameWidth:120,name:"User Info",children:o.jsx("pre",{style:{margin:0,fontSize:12},children:JSON.stringify(i.userInfo,null,2)})}),i.extra&&o.jsx(ue,{nameWidth:120,name:"Extra",children:o.jsx("pre",{style:{margin:0,fontSize:12},children:JSON.stringify(i.extra,null,2)})}),i.provider===_e.LOGIN_PROVIDER.PASSKEY&&o.jsx(Pe,{size:"small",variant:"contained",color:"error",sx:{mb:1},onClick:async()=>{await l({session:s,connectedAccount:i}),await t(e)},children:r("common.disconnect")})]})]},i.did)),o.jsx(zs,{hasPasskey:a})]})}Us.propTypes={user:C.object.isRequired,onChangeUser:C.func};const Ws=k.createContext(null);function qs({children:e}){const{t}=J(),[n,r]=k.useState(!1),s=k.useMemo(()=>o.jsxs(A,{onClick:()=>r(!0),sx:{display:"flex",alignItems:"center",gap:1,width:"100%",height:36,px:2,borderTop:"1px solid",borderColor:"divider",fontSize:14,color:"grey.600",cursor:"pointer",textDecoration:"none"},children:[o.jsx(Pt,{style:{fontSize:14}}),t("label.manage")]}),[t]),l=k.useMemo(()=>({showManageLabels:n,setShowManageLabels:r,labelManageActions:s}),[n,r,s]);return o.jsx(Ws.Provider,{value:l,children:e})}qs.propTypes={children:C.node.isRequired};function Hs(){return k.useContext(Ws)}function Cr({info:e,verified:t}){return o.jsxs(A,{sx:{display:"flex",alignItems:"center"},children:[e,t&&o.jsx(Ao,{color:"success",style:{fontSize:16,marginLeft:4}})]})}C.string.isRequired;const nt="info";function Ks({userDid:e,onCancel:t,initTab:n=nt,createPassportSvg:r,handleChangeLabels:s=()=>{}}){const{api:l,ws:{useSubscription:a},inService:i,info:c}=de(),{session:f}=Me(),{roles:u,teamDid:h,isNodeTeam:x,enablePassportIssuance:j}=he(),{t:v,locale:S}=J(),p=it({user:null,issuances:null,tab:n||nt}),[d,m]=k.useState(""),[y,g]=k.useState([]),[w,P]=k.useState(!1),{labelManageActions:b}=Hs(),L=k.useMemo(()=>h===c.did,[h,c.did]),T=async(R,$)=>{try{const Y=await l.doBatchQuery({getUser:{input:{teamDid:R,user:{did:$},options:{includeTags:!0}}},getPassportIssuances:{input:{teamDid:R,ownerDid:$}}});Y.getUser.user&&(Y.getUser.user.avatar=zr(Y.getUser.user.avatar,R,i),Y.getUser.user.passports=(Y.getUser.user.passports||[]).filter(be=>be.issuer)),p.user=Y.getUser.user||{},g((p.user?.tags||[]).map(be=>be.id)),p.issuances=Y.getPassportIssuances.list||[]}catch(Y){oe.error(le(Y))}};k.useEffect(()=>{h&&T(h,e)},[e,h]);const _=R=>{R.teamDid===h&&R.user&&R.user.did===e&&T(h,e)};a(_e.TeamEvents.userUpdated,_,[e,h]),k.useEffect(()=>{p.issuances&&!p.issuances.length&&p.tab==="issuances"&&(p.tab=nt)},[p.issuances]),k.useEffect(()=>{va.user.getProfileUrl({did:p.user?.did,locale:S}).then(m)},[p.user?.did,S]);const O=async R=>{await T(h,R.did),p.tab=p.tab||nt},M=k.useMemo(()=>p.tab==="userFollowers"?{marginTop:0}:{},[p.tab]),B=()=>(p.user?[{name:v("team.member.name"),value:p.user.fullName},{name:v("common.email"),value:p.user.email?o.jsx(Cr,{info:p.user.email,verified:p.user.emailVerified}):"-"},{name:v("common.phone"),value:p.user.phone?o.jsx(Cr,{info:p.user.phone,verified:p.user.phoneVerified}):"-"},{name:v("team.member.source"),value:o.jsx(A,{sx:{display:"flex",alignItems:"center"},children:_e.PROVIDER_NAME[p.user?.sourceProvider||Re.USER_TYPE.WALLET]||p.user?.sourceProvider})},{name:v("team.member.allowAccess"),value:p.user.approved?v("common.yes"):v("common.no")},{name:v("common.createdAt"),value:p.user.createdAt?o.jsx(dn,{value:p.user.createdAt,type:"all",locale:S}):"-"},{name:v("team.member.lastLogin"),value:p.user.lastLoginAt?o.jsx(dn,{value:p.user.lastLoginAt,type:"all",locale:S}):"-"},{name:v("team.member.lastLoginIp"),value:p.user.lastLoginIp||""},{name:v("common.remark"),value:p.user.remark||"-"},{name:v("team.invite.inviter"),value:p.user.inviter?o.jsx(vn,{compact:!0,responsive:!0,did:p.user.inviter,showQrcode:!0}):"-"},{name:v("label.title"),value:o.jsxs(A,{sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:.5},children:[o.jsx(o.Fragment,{children:p.user.tags.map($=>o.jsx(Le,{label:$,onDelete:()=>{l.deleteTagging({input:{teamDid:h,tagging:{tagId:$.id,taggableIds:[p.user.did],taggableType:"user"}}}).then(()=>{T(h,e),s()})}},$.id))}),w&&o.jsx(Ue,{size:14}),o.jsx(lt,{value:[y],onChange:$=>{g($),P(!0),l.createTagging({input:{teamDid:h,tagging:{tagId:$[0],taggableIds:[p.user.did],taggableType:"user"}}}).then(()=>{setTimeout(()=>{T(h,e),s(),P(!1)},1e3)})},trigger:o.jsx(rt,{color:"inherit",variant:"outlined",children:o.jsx(Pt,{style:{fontSize:14}})}),multiple:!1,excludes:y,actions:b})]})}].filter(Boolean):[]).map($=>$.name===v("common.did")?o.jsx(ue,{valueComponent:"div",nameWidth:120,name:$.name,nameFormatter:()=>v("common.did"),children:$.value},$.name):o.jsx(ue,{style:{alignItems:"flex-start"},valueComponent:"div",nameWidth:120,name:$.name,children:$.value},$.name)),V={info:{label:v("common.basicInfo"),value:nt,component:B},oauth:{label:v("team.member.connectedAccounts"),value:"oauth",component:()=>o.jsx(Us,{user:p.user,onChangeUser:O})},passports:{label:v("common.passport"),value:"passports",component:()=>o.jsx($s,{user:p.user,teamDid:h,roles:u,createPassportSvg:r,onCreate:()=>{T(h,e).then(()=>{j&&p.issuances&&p.issuances.length&&(p.tab="issuances")})},onRefresh:()=>{T(h,e)}})},issuances:{label:v("team.passport.issuance.pending"),value:"issuances",component:()=>o.jsx(Ms,{issuances:p.issuances||[],teamDid:h,onRefresh:()=>T(h,e)})},userFollowers:{label:v("team.userFollowers.title"),value:"userFollowers",component:()=>o.jsx(A,{className:"user-followers-container",sx:{p:1},children:o.jsx(Ca,{column:1,user:p.user,teamDid:h,showSocialActions:!1})})}};L&&Object.prototype.hasOwnProperty.call(V,"userFollowers")&&delete V.userFollowers;const H=Object.values(V).map(({label:R,value:$})=>({label:R,value:$})).filter(R=>R.value==="issuances"?j&&p.issuances&&!!p.issuances.length:R.value==="oauth"?x&&f.user?.did===e?!0:(p.user?.connectedAccounts||[]).find(Y=>Y.did!==p.user?.did):!0),ne=V[p.tab]||V.info,ee=R=>{p.tab=R};return o.jsx(ke,{title:v("common.member"),onClose:t,open:!0,PaperProps:{style:{maxWidth:632,minHeight:"80vh"}},fullWidth:!0,actions:p.user&&o.jsxs(We,{permission:i?"":"mutate_team",role:i?ot:[],children:[o.jsx(Mn,{user:p.user,children:({open:R})=>o.jsxs(jr,{onClick:R,children:[p.user.approved?o.jsx(qr,{style:{fontSize:"1.2em",marginRight:"0.4em"}}):o.jsx(Ur,{style:{fontSize:"1.2em",marginRight:"0.4em"}}),p.user.approved?v("team.member.blockAccess"):v("team.member.allowAccess")]})}),o.jsx(Fs,{user:p.user,onSuccess:t,children:({open:R})=>o.jsxs(jr,{onClick:R,children:[o.jsx(Po,{style:{fontSize:"1.2em",marginRight:"0.4em"}}),v("team.member.removeUser")]})})]}),children:o.jsxs(bc,{children:[!p.user&&o.jsx(gc,{children:o.jsx(Ue,{})}),p.user&&o.jsxs(A,{children:[o.jsxs(A,{sx:{display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",overflow:"hidden"},children:[o.jsx(A,{sx:{display:"flex",alignItems:"center",width:"100%",overflow:"hidden"},className:"info",children:o.jsx(Or,{user:p.user,cardType:Mr.Detailed,infoType:la.Minimal,avatarSize:48,sx:{padding:0,border:"none"},showDid:!0,didProps:{compact:!0,responsive:!1,showQrcode:!0}})}),!!i&&o.jsx(A,{href:d,target:"_blank",rel:"noreferrer",component:"a",sx:{flexShrink:0},children:o.jsxs(Pe,{variant:"contained",color:"primary","data-cy":"issue-passport",children:[o.jsx(Ko,{icon:"majesticons:open-line",style:{fontSize:16,marginRight:4}}),v("team.member.openProfile")]})})]}),o.jsx(A,{className:"tabs",sx:{mx:3},children:o.jsx(Yo,{tabs:H,current:p.tab,onChange:ee,scrollButtons:"auto"})}),o.jsx(A,{className:"body",style:M,children:o.jsx(ne.component,{})})]})]})})}Ks.propTypes={userDid:C.string.isRequired,onCancel:C.func.isRequired,createPassportSvg:C.func.isRequired,initTab:C.string,handleChangeLabels:C.func};const bc=me.div`
129
+ .info {
130
+ .name {
131
+ font-weight: 400;
132
+ font-size: 18px;
133
+ line-height: 25px;
134
+ color: ${({theme:e})=>e.palette.text.primary};
135
+ }
136
+ }
137
+
138
+ .tabs {
139
+ margin-top: 24px;
140
+ margin-left: 0;
141
+ margin-right: 0;
142
+ }
143
+
144
+ .body {
145
+ margin-top: 24px;
146
+ }
147
+ `,gc=me.div`
148
+ flex: 1;
149
+ display: flex;
150
+ justify-content: center;
151
+ align-items: center;
152
+ height: 200px;
153
+ `,jr=me.div`
154
+ flex-shrink: 0;
155
+ width: 50%;
156
+ height: 64px;
157
+ display: flex;
158
+ justify-content: center;
159
+ align-items: center;
160
+ cursor: pointer;
161
+ font-size: 16px;
162
+ position: sticky;
163
+ bottom: 0;
164
+ z-index: 10;
165
+ color: #999;
166
+ fill: #999;
167
+ `;function Ys({type:e,user:t,onIssuePassport:n=()=>{},onRefresh:r=()=>{}}){const{teamDid:s,roles:l}=he(),{confirmHolder:a,confirmApi:i}=_r(),{t:c}=k.useContext(Tt),[f,u]=k.useState(!1),{api:h}=de(),x=yn(async(j=!1)=>{const v={teamDid:s,userDid:t.did,remove:j};j||(v.appPid=s),await h.logoutUser({input:v})});return o.jsxs(o.Fragment,{children:[a,o.jsx(wa,{"data-cy":"member-actions",actions:[{icon:o.jsx(ze,{fontSize:"small"}),text:c("team.passport.issue"),"data-cy":"action-issue-passport",onClick:j=>{j.stopPropagation(),u(!0)}},({close:j})=>o.jsx(Mn,{user:t,children:({open:v})=>o.jsxs(jt,{dense:!0,onClick:S=>{S.stopPropagation(),j(),v(S)},"data-cy":"action-toggle-block",children:[o.jsx(To,{style:{minWidth:24,marginRight:8},children:t.approved?o.jsx(qr,{}):o.jsx(Ur,{})}),o.jsx(Eo,{primary:t.approved?c("team.member.blockAccess"):c("team.member.allowAccess")})]})},"toggle-approval"),e==="blocklet"&&{icon:o.jsx(Ro,{fontSize:"small"}),text:c("team.member.forceLogout"),onClick:j=>{j.stopPropagation(),i.open({title:c("team.member.forceLogout"),content:j.altKey?c("team.member.forceLogoutRemoveDescription"):c("team.member.forceLogoutDescription"),confirmButtonText:c("common.confirm"),cancelButtonText:c("common.cancel"),onClick:v=>v.stopPropagation(),onConfirm:async()=>{await x(j.altKey),await i.close(),r()}})}}].filter(Boolean)}),f&&o.jsx(On,{teamDid:s,ownerDid:t.did,needReceive:Ns.getWalletDid(t)===t.did,roles:l,onCancel:()=>u(!1),onSuccess:()=>{n(),u(!1)}})]})}Ys.propTypes={type:C.oneOf(["server","blocklet"]).isRequired,user:C.object.isRequired,onIssuePassport:C.func,onRefresh:C.func};const on="$all",wr="$none",kr="$blocked",yt=(e,t)=>e.find(r=>r.key===t)?.value||0,xc=(e,t)=>{const n=e.passports||[];return n.length?!n.some(r=>t.includes(r.issuer?.id)):!1};function Vs({user:e}){const{t}=k.useContext(Tt),n=ma(()=>({...e,avatar:`${e.avatar}?imageFilter=resize&w=48&h=48`}),[e]),r=o.jsxs("div",{className:"member-block",children:[o.jsxs("div",{className:"member-avatar",children:[o.jsx(Or,{user:n,avatarSize:32,cardType:Mr.AvatarOnly,showHoverCard:!1}),!e.approved&&o.jsx("did",{className:"badge-block"}),e.isFromExternal&&o.jsx(wt,{title:t("team.passport.externalPassport"),children:o.jsx(A,{className:"icon",sx:{ml:1},children:o.jsx(Wr,{})})})]}),o.jsxs("div",{className:"member-meta",children:[o.jsx("div",{className:"member-text",children:o.jsx(ka,{children:e.fullName})}),Array.isArray(e.tags)&&e.tags.length>0&&o.jsx(A,{className:"member-tags",sx:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:.5},children:e.tags.map(s=>o.jsx(Le,{label:s},s.id))})]})]});return e.approved?r:o.jsx(A,{sx:{display:"flex",alignItems:"center"},children:o.jsx(wt,{title:t("team.member.blockAccessDescription"),children:r})})}Vs.propTypes={user:C.object.isRequired};function Nn({type:e,createPassportSvg:t}){const{session:n}=Me(),{confirmApi:r,confirmHolder:s}=_r({sx:{".MuiDialog-paper":{borderRadius:2,maxWidth:1e3},".ux-dialog_title":{fontWeight:600},".ux-dialog_closeButton":{p:1},".MuiDialogActions-root":{display:{xs:"none",md:"flex"}}}}),{appIdList:l=[],blocklet:a}=Rr(),{refetch:i}=Ze(),{teamDid:c,invitations:f,teamIssuerDid:u,roles:h,refresh:x,enablePassportIssuance:j,endpoint:v,api:S}=he(),{showManageLabels:p,setShowManageLabels:d,labelManageActions:m}=Hs(),{api:y,inService:g,ws:{useSubscription:w},info:P}=de(),b=[];if(a){const E=(a.settings?.federated?.sites||[]).find(q=>q.isMaster!==!1),D=(a.settings?.federated?.sites||[]).find(q=>q.appId===a.appDid);if(D?.status==="approved"&&b.push({appId:E?.appId,appName:E?.appName,appDescription:E?.appDescription,appLogo:E?.appLogo,appPid:E?.appPid,appUrl:E?.appUrl,version:E?.version,sourceAppPid:E?.appPid,provider:"wallet"}),D)b.push({appId:D?.appId||a.appDid,appName:D?.appName,appDescription:D?.appDescription,appLogo:D?.appLogo,appPid:D?.appPid,appUrl:D?.appUrl,version:D?.version,sourceAppPid:null,provider:"wallet"});else{const q=Da(a,void 0,{returnWallet:!1});b.push({appId:q.did,appName:q.name,appDescription:q.description,appLogo:zo(q.appUrl,Re.WELLKNOWN_SERVICE_PATH_PREFIX,"/blocklet/logo"),appPid:a?.appPid,appUrl:q.appUrl,version:q.version,sourceAppPid:null,provider:"wallet"})}}const{t:L,locale:T}=k.useContext(Tt),[_,O]=k.useState(!1),[M,B]=k.useState(!1),[V,H]=k.useState(!1),[ne,ee]=k.useState(!1),[R,$]=k.useState(!1),[Y,be]=k.useState([]),[Xe,Ie]=k.useState(),[Ne,Nt]=k.useState([]),[ct]=_a({did:void 0}),[dt,N]=k.useState(""),[K,re]=k.useState([]),[ge,Dt]=k.useState([]),[$t,Gs]=Nr("members-filter-labels",[]),Dn=`members-${c}`,$n=Vo(Dn),[G,Qe]=k.useState({role:on,searchText:$n.searchText||"",hideBlocked:!1,pageSize:$n.rowsPerPage||10,page:1}),Zs=k.useMemo(()=>{if(!g)return!1;if(!n?.user)return!0;const E=n?.user?.role,q=(n?.user?.passports||[]).filter(Z=>Z.role===E);return q.length===0?!0:q.every(Z=>Z.expirationDate)},[n?.user,g]),Bn=k.useCallback(async()=>{if(c===P.did){N("");return}const E=await ia(a);N(E)},[a,c,P.did]);pa(async()=>{if(ct.did){const{user:E}=await S.getUser({did:ct.did});E&&ee(E)}}),k.useEffect(()=>{Bn()},[Bn]);const ut=(h||[]).map(E=>({name:E.name,title:E.title,num:yt(Ne,E.name)}));ut.unshift({name:on,title:"All Members",num:yt(Ne,on)}),ut.push({name:wr,title:"Other",num:yt(Ne,wr)}),ut.push({name:kr,title:"Blocked",num:yt(Ne,kr)});const ft=()=>{const E={includeTags:!0,includeUserSessions:e==="blocklet"};G.hideBlocked&&(E.approved=!0),E.role=G.role,G.searchText&&(E.search=G.searchText),E.tags=$t||[],S.getUsers({query:E,paging:{page:G.page,pageSize:G.pageSize}}).then(D=>{$(!1),(D.users||[]).forEach(q=>{q.isFromExternal=xc(q,Uo(l)?[u]:l),q.avatar=zr(q.avatar,c,g),q.passports=(q.passports||[]).filter(Z=>Z.issuer)}),be(D.users||[]),Ie(D.paging.total)}).catch(D=>{$(!1),oe.error(D.message)})},Fn=()=>{$(!0),ft()},zn=()=>{S.getUsersCountPerRole().then(E=>{Nt(E.counts||[])}).catch(E=>{oe.error(E.message)})},Bt=E=>{E.teamDid===c&&(Fn(),zn())};k.useEffect(()=>{Fn()},[`${G.hideBlocked}-${G.role}-${G.page}-${G.pageSize}-${G.searchText}-${($t||[]).join(",")}`]),k.useEffect(()=>{zn()},[]),w(_e.TeamEvents.userUpdated,Bt,[G]),w(_e.TeamEvents.userAdded,Bt,[G]);const Xs=j,Qs=yn((E,D=!1)=>{const q=async({page:Z=1,pageSize:Ft=10,status:oo}={})=>{const Wn={userDid:E.did,status:oo};return D||(Wn.appPid=c),await y.getUserSessions({input:{teamDid:c,query:Wn,paging:{pageSize:Ft,page:Z}}})};r.open({title:o.jsxs("div",{children:["User Sessions",D?" (Show All)":""]}),content:o.jsx(ha,{showAppPid:D,user:E,showAction:!1,showUser:!1,showOffline:!0,getUserSessions:q}),onConfirm(){r.close()},confirmButtonText:L("common.close"),showCancelButton:!1})}),Js=[{label:L("common.name"),name:"fullName",options:{customBodyRenderLite:E=>{const D=Y[E];return o.jsx("div",{"data-cy":`member-name-${D.fullName}`,children:o.jsx(Vs,{user:D})},D.did)}}},{label:L("common.address"),name:"did",options:{customBodyRender:E=>o.jsx(vn,{size:14,responsive:!1,compact:!0,copyable:!1,did:E})}},{label:L("team.member.lastLogin"),name:"lastLoginAt",options:{customBodyRender:E=>o.jsx(A,{sx:{minWidth:"100px"},children:o.jsx(dn,{value:E,locale:T})})}},{label:L("team.member.lastLoginIp"),name:"lastLoginIp",options:{customBodyRender:E=>E||"-"}},{label:L("team.member.source"),name:"sourceProvider",options:{customBodyRenderLite:E=>{const D=Y[E],q=D.sourceProvider||Re.USER_TYPE.WALLET,Z=_e.PROVIDER_NAME[q]||q;return D.sourceAppPid?`${Z} (${L("team.member.federated")})`:Z}}},e==="blocklet"&&{label:L("team.member.activeUserSessions"),name:"userSessions",options:{customBodyRenderLite:E=>{const D=Y[E];return o.jsx(rt,{onClick:q=>{q.stopPropagation(),Qs(D,q.altKey)},children:o.jsx(_o,{badgeContent:D?.userSessionsCount,color:D?.userSessionsCount>0?"primary":"default",sx:D?.userSessionsCount>0?{}:{".MuiBadge-badge":{backgroundColor:"grey",color:"white"}},showZero:!0,children:o.jsx(Oo,{})})})}}},{label:L("common.actions"),name:"",width:100,align:"center",verticalKeyAlign:"center",options:{customBodyRenderLite:E=>{const D=Y[E];return o.jsx(We,{permission:g?"":"mutate_team",role:g?ot:[],children:o.jsx(Ys,{type:e,user:D,onIssuePassport:()=>ee({...D,initTab:"issuances"}),onRefresh:()=>Bt({teamDid:c})})})}}}].filter(Boolean),pt=[];pt.push(o.jsx(Rn,{value:$t||[],onChange:Gs,sx:{maxWidth:300,height:36},LabelPickerProps:{enableAccessControl:!1,actions:m}})),Xs&&(Zs||pt.push(o.jsx(Vn,{variant:"contained",menuButtonProps:{"data-cy":"invite-member-more"},menu:o.jsx(Vn.Item,{variant:"outlined",style:{flexShrink:0},color:"primary",size:"small",onClick:()=>{H(!0)},children:o.jsxs(A,{sx:{display:"flex",alignItems:"center"},children:[o.jsx(Sa,{style:{height:"1em",marginRight:4}}),L("common.inviting"),f.length?` (${f.length})`:""]})}),children:()=>o.jsxs(ae,{style:{flexShrink:0,marginLeft:16},edge:"end",color:"primary",size:"small","data-cy":"invite-member",onClick:()=>O(!0),children:[o.jsx(ze,{style:{fontSize:"1.3em",marginRight:4}}),L("team.invite.action")]})})),e==="server"&&pt.push(o.jsx(We,{role:"owner",children:o.jsxs(ae,{style:{flexShrink:0,marginLeft:16},variant:"contained",edge:"end",color:"error","data-cy":"invite-member",onClick:()=>B(!0),children:[o.jsx(Mo,{style:{fontSize:"1.3em",marginRight:4}}),L("team.transferNode.name")]})})));const eo=E=>{R||Qe(D=>({...D,role:E,hideBlocked:!1,searchText:"",page:1}))},to=E=>{Qe(D=>({...D,hideBlocked:E,page:1}))},no=({page:E,rowsPerPage:D,searchText:q})=>{G.pageSize!==D?Qe(Z=>({...Z,pageSize:D,page:1})):G.page!==E+1?Qe(Z=>({...Z,page:E+1})):G.searchText!==q&&Qe(Z=>({...Z,searchText:q,page:1}))},Un=k.useRef(null),ro=E=>E.data.length?o.jsx(A,{sx:{display:"flex",alignItems:"center"},children:o.jsx(lt,{value:[ge],onChange:D=>{Dt([...ge,D[0]]),y.createTagging({input:{teamDid:c,tagging:{tagId:D[0],taggableIds:K,taggableType:"user"}}}).then(()=>{ft(),re([])})},trigger:o.jsx(ae,{className:"resend-btn",color:"primary",variant:"contained",sx:{my:"2px",".MuiButton-startIcon":{mr:"2px"}},onClick:()=>{},children:L("label.actionLabel")}),multiple:!1,actions:m})}):null,so={sort:!1,download:!1,filter:!1,print:!1,expandableRowsOnClick:!0,onRowClick(E,{dataIndex:D},q){if(Un.current?.contains(q.target)){const Z=Y[D];ee(Z)}},page:G.page-1,rowsPerPage:G.pageSize,count:Xe,searchDebounceTime:600,selectableRows:"multiple",filterType:"checkbox",onRowSelectionChange:(E,D,q)=>{const Z=q.map(Ft=>Y[Ft].did);re(Z)},rowsSelected:Y.map((E,D)=>K.includes(E.did)?D:null).filter(E=>E!==null),customToolbarSelect:ro};return o.jsxs(yc,{children:[s,o.jsxs(A,{className:"main",sx:{display:"flex",gap:3},children:[o.jsx(A,{className:"left",children:o.jsx(A,{className:"tabs",children:ut.map(E=>o.jsxs(A,{className:`tab ${G.role===E.name?"active":""}`,onClick:()=>eo(E.name),children:[o.jsx("span",{className:"text",children:E.title}),o.jsx(A,{sx:{color:"text.secondary"},children:E.num})]},E.name))})}),o.jsx(A,{ref:Un,className:"right",sx:{".MuiPaper-root":{flex:0}},children:o.jsx(Go,{className:"main-table",verticalKeyWidth:100,locale:T,durable:Dn,durableKeys:["page","rowsPerPage"],title:o.jsx(A,{className:"table-toolbar-left",sx:{pl:"12px !important"},children:o.jsx(xn,{control:o.jsx(No,{sx:{display:"flex !important"},disabled:R,color:"primary",checked:G.hideBlocked,onChange:E=>to(E.target.checked)}),label:L("team.member.onlyApprovedMember")})}),data:Y,columns:Js,customButtons:pt,options:so,loading:R,onChange:no})})]}),o.jsx(ke,{title:L("common.inviting"),onClose:()=>H(!1),open:V,maxWidth:"lg",fullWidth:!0,children:o.jsx(ja,{})}),ne&&o.jsx(Ks,{onCancel:()=>ee(null),userDid:ne.did,createPassportSvg:t,initTab:ne.initTab,handleChangeLabels:()=>ft()}),_&&o.jsx(_s,{teamDid:c,endpoint:dt||v,roles:h,apps:b,onCancel:()=>O(!1),onSuccess:()=>{x(),O(!1)}}),M&&o.jsx(Os,{teamDid:c,endpoint:dt||v,roles:h,onCancel:()=>B(!1),onSuccess:()=>{x(),B(!1)}}),p&&o.jsx(ke,{title:L("label.manage"),onClose:()=>d(!1),open:p,maxWidth:"lg",fullWidth:!0,PaperProps:{style:{height:"80vh"}},children:o.jsx(Rs,{onReload:()=>{ft(),i()}})})]})}const yc=me.div`
168
+ .main {
169
+ .left {
170
+ width: 256px;
171
+ flex-shrink: 0;
172
+
173
+ .tabs {
174
+ padding-top: 16px;
175
+ .tab {
176
+ display: flex;
177
+ justify-content: space-between;
178
+ align-items: center;
179
+ padding: 8px 16px;
180
+ transition: background 0.4s;
181
+
182
+ width: 256px;
183
+ height: 36px;
184
+ border-radius: 8px;
185
+
186
+ cursor: pointer;
187
+ user-select: none;
188
+
189
+ &:nth-of-type(n + 2) {
190
+ margin-top: 24px;
191
+ }
192
+
193
+ &.active {
194
+ background-color: ${({theme:e})=>e.palette.grey[100]};
195
+ }
196
+
197
+ &:hover {
198
+ background-color: ${({theme:e})=>e.palette.grey[100]};
199
+ }
200
+
201
+ .text {
202
+ font-weight: 400;
203
+ font-size: 16px;
204
+ line-height: 19px;
205
+ color: ${({theme:e})=>e.palette.text.primary};
206
+ }
207
+
208
+ .badge {
209
+ display: flex;
210
+ flex-shrink: 0;
211
+ justify-content: center;
212
+ align-items: center;
213
+ width: 20px;
214
+ height: 20px;
215
+ border-radius: 100%;
216
+ color: #fff;
217
+ background: #666666;
218
+ font-size: 10px;
219
+ font-weight: 400;
220
+ &.is-rect {
221
+ width: auto;
222
+ border-radius: 8px;
223
+ padding: 0 4px;
224
+ }
225
+ }
226
+ }
227
+ }
228
+ @media (max-width: ${e=>e.theme.breakpoints.values.md}px) {
229
+ display: none;
230
+ }
231
+ }
232
+ .right {
233
+ flex: 1;
234
+ overflow: auto;
235
+ }
236
+ }
237
+
238
+ .member-block {
239
+ display: flex;
240
+ justify-content: flex-start;
241
+ align-items: center;
242
+ .member-avatar {
243
+ position: relative;
244
+ display: flex;
245
+ justify-content: center;
246
+ align-items: center;
247
+ }
248
+ .member-meta {
249
+ margin-left: 10px;
250
+ display: flex;
251
+ flex-direction: column;
252
+ justify-content: center;
253
+ align-items: flex-start;
254
+ }
255
+ .badge-block {
256
+ width: 14px;
257
+ height: 14px;
258
+ position: absolute;
259
+ right: -4px;
260
+ top: -4px;
261
+ background: #ff5757;
262
+ border-radius: 100%;
263
+ display: flex;
264
+ align-items: center;
265
+ justify-content: center;
266
+ &::after {
267
+ content: '';
268
+ width: 6px;
269
+ height: 2px;
270
+ background: #fefefe;
271
+ }
272
+ }
273
+ }
274
+
275
+ .table-toolbar-left {
276
+ display: flex;
277
+ justify-content: center;
278
+ align-items: center;
279
+ padding: 7px 0;
280
+ }
281
+ `;Nn.propTypes={type:C.oneOf(["server","blocklet"]).isRequired,createPassportSvg:C.func.isRequired};function vc({type:e,createPassportSvg:t}){return o.jsx(Mt,{children:o.jsx(qs,{children:o.jsx(Nn,{type:e,createPassportSvg:t})})})}vc.propTypes={...Nn.propTypes};export{vc as default};