@abtnode/blocklet-services 1.16.45-beta-20250702-091552-478bb5e9 → 1.16.46-beta-20250703-024219-4029ee97

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 (150) hide show
  1. package/api/routes/user-session.js +2 -1
  2. package/dist/assets/{AdapterDayjs-BRnJ9bMs.js → AdapterDayjs-BIQsjtiT.js} +1 -1
  3. package/dist/assets/{ArrowDropDown-DBJPIOl4.js → ArrowDropDown-C8mwBtnq.js} +1 -1
  4. package/dist/assets/{CheckCircle-DUJmWceY.js → CheckCircle-BMMes-V7.js} +1 -1
  5. package/dist/assets/{ChevronLeft-BBJJJhVi.js → ChevronLeft-B8rsCJhy.js} +1 -1
  6. package/dist/assets/{ChevronRight-BU9I7WD4.js → ChevronRight-CXhRlHKa.js} +1 -1
  7. package/dist/assets/{DeleteOutline-BKSMNwfT.js → DeleteOutline-DtbgduIM.js} +1 -1
  8. package/dist/assets/{Done-ASNftAOL.js → Done-CfxTFgBR.js} +1 -1
  9. package/dist/assets/{Download-D4X39_9V.js → Download-Cz4FAob1.js} +1 -1
  10. package/dist/assets/{Edit-CiTb-w5P.js → Edit-Dh2oBqBB.js} +1 -1
  11. package/dist/assets/{Error-BAEKW7-e.js → Error-BsnYcwiq.js} +1 -1
  12. package/dist/assets/{ExpandLess-CcLTbsdW.js → ExpandLess-B7eaaZaz.js} +1 -1
  13. package/dist/assets/{Google-C28yeMZW.js → Google-BAVYemz7.js} +1 -1
  14. package/dist/assets/{Home-Dujcj083.js → Home-SYcuMunC.js} +1 -1
  15. package/dist/assets/{InfoOutlined-BVWbftGI.js → InfoOutlined-GEKFkezP.js} +1 -1
  16. package/dist/assets/{Launch-DFS3fgjy.js → Launch-BB2NS6gw.js} +1 -1
  17. package/dist/assets/{LaunchOutlined-C1x4Og4u.js → LaunchOutlined-BEsYq9kI.js} +1 -1
  18. package/dist/assets/{MoreHoriz-ChJ3K52h.js → MoreHoriz-BDLlOCqj.js} +1 -1
  19. package/dist/assets/{PlayArrow-BqVYRyLK.js → PlayArrow-hnXK75qN.js} +1 -1
  20. package/dist/assets/{TuneOutlined-CKzi_VZZ.js → TuneOutlined-CjVMXY_7.js} +1 -1
  21. package/dist/assets/{ViewList-BOGcbymi.js → ViewList-CYMKafss.js} +1 -1
  22. package/dist/assets/{access-control-5WGT2JfR.js → access-control-C1HMwNqK.js} +1 -1
  23. package/dist/assets/{actions-DnTVXQ_Z.js → actions-D_aAU5uf.js} +1 -1
  24. package/dist/assets/{add-component-core-DehB4lvu.js → add-component-core-BEFFiTrn.js} +1 -1
  25. package/dist/assets/{add-resource-DfqBSLDk.js → add-resource-BwdFwCui.js} +1 -1
  26. package/dist/assets/{addon-DdjBFoHI.js → addon-CuKQNO-0.js} +1 -1
  27. package/dist/assets/advanced-BUnq5m4o.js +14 -0
  28. package/dist/assets/api-ZzsS0diA.js +1 -0
  29. package/dist/assets/{appearance-DsoglxbB.js → appearance-4MhpGgxL.js} +1 -1
  30. package/dist/assets/{audit-logs-DKiQkfse.js → audit-logs-Crahcw3z.js} +1 -1
  31. package/dist/assets/{authorize-IzqEi1HK.js → authorize-BdvY1Z98.js} +1 -1
  32. package/dist/assets/{base-chart-CoApVzod.js → base-chart-B81_ogPb.js} +1 -1
  33. package/dist/assets/{base32-DUSifB4M.js → base32-BTgHqgXA.js} +1 -1
  34. package/dist/assets/{branding-CwYIeBi1.js → branding-A9uxpYm2.js} +1 -1
  35. package/dist/assets/{branding-B1o_K1XB.js → branding-DPMhTm_T.js} +2 -2
  36. package/dist/assets/{bundle-avatar-UIbxwQif.js → bundle-avatar-DKZRbFJ2.js} +1 -1
  37. package/dist/assets/{button-D_ZVjN82.js → button-BxXFhZV_.js} +1 -1
  38. package/dist/assets/{click-to-copy-By4fgGR7.js → click-to-copy-nMjIOe47.js} +1 -1
  39. package/dist/assets/{cloneDeep-CDl5kZTY.js → cloneDeep-Cm_V5yFW.js} +1 -1
  40. package/dist/assets/{collapse-DAaiuAEY.js → collapse-2Uzc-qtU.js} +1 -1
  41. package/dist/assets/{complete-Bi_BaBBl.js → complete-C0GvGwhR.js} +1 -1
  42. package/dist/assets/{component-CiFJ1vhL.js → component-CI10LcFr.js} +3 -3
  43. package/dist/assets/{config-BZuiK8BP.js → config-COcQW2xB.js} +1 -1
  44. package/dist/assets/{config-JUGJKWP_.js → config-DwZ4p-2p.js} +1 -1
  45. package/dist/assets/{config-navigation-DZ54_nVv.js → config-navigation-OsN6Bi3R.js} +3 -3
  46. package/dist/assets/{config-space-D6ScnWdA.js → config-space-DD1BpqT2.js} +1 -1
  47. package/dist/assets/{confirm-RvA9mFot.js → confirm-DchYh746.js} +1 -1
  48. package/dist/assets/{connect-DGMfp8-Y.js → connect-BC_FEDb_.js} +1 -1
  49. package/dist/assets/{connect-DhuiCF4g.js → connect-DxHNQKee.js} +1 -1
  50. package/dist/assets/{connect-to-CxoBjkcK.js → connect-to-ZkYEK0m1.js} +1 -1
  51. package/dist/assets/{dashboard-t9EszOna.js → dashboard-BTYQTsrm.js} +3 -3
  52. package/dist/assets/{delete-confirm-wTMDQFnr.js → delete-confirm-bNsLJZC8.js} +1 -1
  53. package/dist/assets/{did-address-NnOD1W_A.js → did-address-BYc4cym-.js} +1 -1
  54. package/dist/assets/{domain-BaMcm6r6.js → domain-Clgo_OSc.js} +1 -1
  55. package/dist/assets/{domain-action-card-BlPWBOAu.js → domain-action-card-DLv7qvqf.js} +1 -1
  56. package/dist/assets/domains-DG0-1EGf.js +1 -0
  57. package/dist/assets/{dot-4jhL56kz.js → dot-BYJ1q_JZ.js} +1 -1
  58. package/dist/assets/{email-0b_MYxBQ.js → email-vrlxa6_L.js} +1 -1
  59. package/dist/assets/{exchange-passport-BnmyuwIs.js → exchange-passport-twE4l8Ym.js} +1 -1
  60. package/dist/assets/{fuel-DEqW116b.js → fuel-CRlIvND2.js} +1 -1
  61. package/dist/assets/{gen-access-key-CVpZSjIw.js → gen-access-key-7DQV-fiV.js} +1 -1
  62. package/dist/assets/{get-safe-url-B0-S5PGZ.js → get-safe-url-D3ggKpT1.js} +1 -1
  63. package/dist/assets/{get-safe-url-D5KSEAKZ.js → get-safe-url-DAFhlwkH.js} +1 -1
  64. package/dist/assets/{home-DfSu-4-a.js → home-A-VRaS1G.js} +1 -1
  65. package/dist/assets/{iframe-DFg8oeD0.js → iframe-GZPTHXNz.js} +1 -1
  66. package/dist/assets/{index-6I6juqjg.js → index-B9TY-Odb.js} +1 -1
  67. package/dist/assets/{index-aAlnaECr.js → index-B_LRxSf2.js} +1 -1
  68. package/dist/assets/{index-B4fH-l5R.js → index-Bm0yY2oo.js} +1 -1
  69. package/dist/assets/{index-B874LN5A.js → index-Bv2l4NRE.js} +1 -1
  70. package/dist/assets/{index-DrTNV3tX.js → index-C-YrYRw8.js} +1 -1
  71. package/dist/assets/{index-C0btiQfG.js → index-C4HCwPkf.js} +1 -1
  72. package/dist/assets/{index-ZcD1N43m.js → index-C4UNdprC.js} +1 -1
  73. package/dist/assets/{index-CkwXRCmN.js → index-C86CKPcd.js} +4 -4
  74. package/dist/assets/{index-I1i2Mc1k.js → index-CIPzQU7w.js} +1 -1
  75. package/dist/assets/{index-BxJZWVOT.js → index-CRPd6bu_.js} +1 -1
  76. package/dist/assets/{index-CD07vq9d.js → index-CneQHlZz.js} +1 -1
  77. package/dist/assets/{index-Dq1Rmjwf.js → index-CwogVjPF.js} +1 -1
  78. package/dist/assets/{index-BLfUtUpB.js → index-D1V1OV_1.js} +1 -1
  79. package/dist/assets/{index-DPIWnhb5.js → index-D3Qm_7QJ.js} +1 -1
  80. package/dist/assets/{index-CwUT0vPy.js → index-DBdN7QPA.js} +4 -4
  81. package/dist/assets/{index-IeoAQOW8.js → index-DJghIcZg.js} +1 -1
  82. package/dist/assets/{index-B70kYOfj.js → index-DYS82O-e.js} +1 -1
  83. package/dist/assets/{index-2mYUqHxe.js → index-DYlNzDk4.js} +3 -3
  84. package/dist/assets/{index-YaLWfp9D.js → index-JN3t0gnY.js} +1 -1
  85. package/dist/assets/{index-Cwq0Io0K.js → index-czMSCB_F.js} +1 -1
  86. package/dist/assets/{index-w4f-mlFt.js → index-opVatFs5.js} +1 -1
  87. package/dist/assets/{invitation-B3B-J4fG.js → invitation-DpzHBehx.js} +1 -1
  88. package/dist/assets/{invite-jaOwIvW9.js → invite-CLIKbeIQ.js} +1 -1
  89. package/dist/assets/{issue-passport-DpSBB2L8.js → issue-passport-8zXA1BKY.js} +1 -1
  90. package/dist/assets/{item-D-39k2FC.js → item-CDthQ-2V.js} +1 -1
  91. package/dist/assets/{layout-DEiEwPzB.js → layout-B9UmfNkJ.js} +1 -1
  92. package/dist/assets/{list-ZFC0mCy0.js → list-B1hvgiX4.js} +2 -2
  93. package/dist/assets/{list-DDNORnll.js → list-CeHTzwCI.js} +1 -1
  94. package/dist/assets/localization-BmadHeXm.js +1 -0
  95. package/dist/assets/{log-BBUgs8Rd.js → log-BwyobBHM.js} +1 -1
  96. package/dist/assets/{logger-Dqm1UQym.js → logger-9nL4ASn6.js} +1 -1
  97. package/dist/assets/{login-DbSs2lO2.js → login-Cgts-E2y.js} +1 -1
  98. package/dist/assets/{login-oauth-callback-Cpai1yC1.js → login-oauth-callback-D3WJu6Qx.js} +1 -1
  99. package/dist/assets/{logo-uploader-BPSmPaZd.js → logo-uploader-C2Aw-_0m.js} +3 -3
  100. package/dist/assets/{lost-passport-Ce_WXcnR.js → lost-passport-Jvpfzzix.js} +1 -1
  101. package/dist/assets/{omit-Cao4GLS7.js → omit-rJ-mc6U5.js} +1 -1
  102. package/dist/assets/{open-window-hpzKFxn5.js → open-window-CTBzFUUv.js} +1 -1
  103. package/dist/assets/{overview-C3aIT8Ro.js → overview-D2wj1UNY.js} +1 -1
  104. package/dist/assets/{page-header-DNvUdNpI.js → page-header-DqtuZOzT.js} +1 -1
  105. package/dist/assets/{passport-item-B3XIp0U4.js → passport-item-vgQO4aPM.js} +1 -1
  106. package/dist/assets/{permission-DQvXGutX.js → permission-BEqDHKfL.js} +1 -1
  107. package/dist/assets/{preferences-C3zaKjfI.js → preferences-D1eIimRF.js} +1 -1
  108. package/dist/assets/{profile-embed-BFjGm3Vt.js → profile-embed-DdACJ_zu.js} +1 -1
  109. package/dist/assets/publish-resource-BFNO0Bju.js +1 -0
  110. package/dist/assets/{react-beautiful-dnd.esm-02tdagHZ.js → react-beautiful-dnd.esm-CNuzAjru.js} +1 -1
  111. package/dist/assets/{runtime-Drmh1-cb.js → runtime-CJxB8Qqy.js} +1 -1
  112. package/dist/assets/{sanitize-e0A8A-yt.js → sanitize-BKnEhEg8.js} +1 -1
  113. package/dist/assets/sdk-Btq1iUPd.js +1 -0
  114. package/dist/assets/{security-BPd4v9z4.js → security-D5upbFtT.js} +1 -1
  115. package/dist/assets/{session-BGdAM8zS.js → session-kQ1tvY5U.js} +1 -1
  116. package/dist/assets/{setup-Bo10IVJ4.js → setup-DDRNZUzD.js} +3 -3
  117. package/dist/assets/{spaces-DUkzPTBd.js → spaces-BTlTdKAI.js} +1 -1
  118. package/dist/assets/{start-C9Hvgbcz.js → start-DcujueM1.js} +1 -1
  119. package/dist/assets/{starting-progress-CYgfPTsE.js → starting-progress-CAkASj-X.js} +1 -1
  120. package/dist/assets/{status-f3Y-NXRP.js → status-oJ1As_M0.js} +1 -1
  121. package/dist/assets/{step-actions-BNbc1l8F.js → step-actions-DrPbY3ZQ.js} +1 -1
  122. package/dist/assets/{studio-I9lo0Itp.js → studio-BWs_EnV3.js} +1 -1
  123. package/dist/assets/{switch-control-Brwb8ptk.js → switch-control-eCwDP-ME.js} +1 -1
  124. package/dist/assets/{table-tips-BzPqsKYQ.js → table-tips-CCj0tXz1.js} +1 -1
  125. package/dist/assets/{traffic-FNLLya21.js → traffic-BAsnAfLz.js} +1 -1
  126. package/dist/assets/{transfer-m6229uxg.js → transfer-C2qtHrKp.js} +1 -1
  127. package/dist/assets/{unsubscribe-BXKQU2c1.js → unsubscribe-B4aHISnG.js} +1 -1
  128. package/dist/assets/{use-blocklet-logo-4UB-MFD3.js → use-blocklet-logo-BWK1UHK5.js} +1 -1
  129. package/dist/assets/use-server-logo-UTr-CyJD.js +1 -1
  130. package/dist/assets/{useAsync-C62uE2pS.js → useAsync-BzjEtgtr.js} +1 -1
  131. package/dist/assets/{useLocalStorage-CaPDqrQ7.js → useLocalStorage-BoYGn-bQ.js} +1 -1
  132. package/dist/assets/{user-center-CNdVbQx6.js → user-center-BgJo4uqg.js} +3 -3
  133. package/dist/assets/{util-BRPRFc9p.js → util-KGB__QYA.js} +1 -1
  134. package/dist/assets/{util-BQAJqeb4.js → util-TW4lcckB.js} +1 -1
  135. package/dist/assets/{vendor-arcblock-CwufDgLV.js → vendor-arcblock-DzylOsX3.js} +3 -3
  136. package/dist/assets/{vendor-hooks-DqdmWCmo.js → vendor-hooks-B2N8eE_a.js} +1 -1
  137. package/dist/assets/vendor-utils-uPLZO5mM.js +208 -0
  138. package/dist/assets/vendor-ux-did-connect-CQtodyZB.js +2304 -0
  139. package/dist/assets/{wrap-locale-ClbCNOs0.js → wrap-locale-9hBUwROZ.js} +1 -1
  140. package/dist/index.html +5 -5
  141. package/dist/service-worker.js +1 -1
  142. package/package.json +23 -23
  143. package/dist/assets/advanced-CJz1c7Eh.js +0 -14
  144. package/dist/assets/api-C1S8LUld.js +0 -1
  145. package/dist/assets/domains-CxJF-JF_.js +0 -1
  146. package/dist/assets/localization-tyC-vHO5.js +0 -1
  147. package/dist/assets/publish-resource-CAZrBTdz.js +0 -1
  148. package/dist/assets/sdk-BmeKtHic.js +0 -1
  149. package/dist/assets/vendor-utils-BfZ4tlod.js +0 -208
  150. package/dist/assets/vendor-ux-did-connect-pzpsrvqx.js +0 -2304
@@ -0,0 +1,14 @@
1
+ import{r as z,e as ee}from"./vendor-react-DEoibe3W.js";import{a9 as ye,j,ab as ue,H as J,aa as P,y as We,T as te,ah as be,bs as Ke,bR as He,bx as Ge,ak as Ze,E as Ye,al as ce,O as Qe,N as Xe,bt as ae,X as V,ad as Ce}from"./vendor-mui-core-Bq8gXTan.js";import{D as re,G as et,f as tt,aM as rt,n as st,aE as nt,z as De,W as Le,V as qe}from"./index-DBdN7QPA.js";import{P as at,w as de}from"./permission-BEqDHKfL.js";import{r as ve,a as oe,B as Z,a3 as G,at as Me,f as it,ar as Pe,c3 as ot,aR as lt,i as K,k as ct,a1 as Ee,bb as ut}from"./vendor-ux-did-connect-CQtodyZB.js";import{x as Ne}from"./vendor-hooks-B2N8eE_a.js";import{c as Y}from"./vendor-arcblock-DzylOsX3.js";import{d as Ie}from"./InfoOutlined-GEKFkezP.js";import{C as _e}from"./confirm-DchYh746.js";import{f as ie}from"./index-8eXqqyHQ.js";import{_ as dt}from"./useSetState-CWq0AVWn.js";import{u as Fe}from"./session-kQ1tvY5U.js";import{S as U}from"./section-BDMQAX_r.js";import{C as ft}from"./click-to-copy-nMjIOe47.js";import{u as ze}from"./dashboard-BTYQTsrm.js";import{r as mt,aL as ht}from"./vendor-utils-uPLZO5mM.js";import{I as pt}from"./index-D3Qm_7QJ.js";import{W as gt}from"./did-address-BYc4cym-.js";import{V as yt}from"./status-oJ1As_M0.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-BoYGn-bQ.js";import"./PlayArrow-hnXK75qN.js";import"./get-safe-url-D3ggKpT1.js";import"./use-blocklet-logo-BWK1UHK5.js";import"./dot-BYJ1q_JZ.js";import"./useAsync-BzjEtgtr.js";import"./use-mobile-CtTQsfXN.js";import"./omit-rJ-mc6U5.js";var we={},bt=ye;Object.defineProperty(we,"__esModule",{value:!0});var Je=we.default=void 0,vt=bt(ve()),_t=j;Je=we.default=(0,vt.default)((0,_t.jsx)("path",{d:"M16 13c3.09-2.81 6-5.44 6-7.7C22 3.45 20.55 2 18.7 2c-1.04 0-2.05.49-2.7 1.25C15.34 2.49 14.34 2 13.3 2 11.45 2 10 3.45 10 5.3c0 2.26 2.91 4.89 6 7.7m-2.7-9c.44 0 .89.21 1.18.55L16 6.34l1.52-1.79c.29-.34.74-.55 1.18-.55.74 0 1.3.56 1.3 1.3 0 1.12-2.04 3.17-4 4.99-1.96-1.82-4-3.88-4-4.99 0-.74.56-1.3 1.3-1.3M19 16h-2c0-1.2-.75-2.28-1.87-2.7L8.97 11H1v11h6v-1.44l7 1.94 8-2.5v-1c0-1.66-1.34-3-3-3M3 20v-7h2v7zm10.97.41L7 18.48V13h1.61l5.82 2.17c.34.13.57.46.57.83 0 0-1.99-.05-2.3-.15l-2.38-.79-.63 1.9 2.38.79c.51.17 1.04.26 1.58.26H19c.39 0 .74.23.9.56z"}),"VolunteerActivismOutlined");var xe={},wt=ye;Object.defineProperty(xe,"__esModule",{value:!0});var $e=xe.default=void 0,xt=wt(ve()),Te=j;$e=xe.default=(0,xt.default)([(0,Te.jsx)("path",{d:"M21 7.28V5c0-1.1-.9-2-2-2H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-2.28c.59-.35 1-.98 1-1.72V9c0-.74-.41-1.37-1-1.72M20 9v6h-7V9zM5 19V5h14v2h-6c-1.1 0-2 .9-2 2v6c0 1.1.9 2 2 2h6v2z"},"0"),(0,Te.jsx)("circle",{cx:"16",cy:"12",r:"1.5"},"1")],"AccountBalanceWalletOutlined");const $t=localStorage.getItem("enableDebug")==="true";function jt({teamDid:$,size:O="small",...E}){const{t:A}=oe(),{api:k}=re(),[w,p]=z.useState(!1),[o,b]=z.useState(null),h=()=>{p(!1),b(null)},d=async()=>{var a;try{p(!0);const n=await k.clearCache({input:{teamDid:$}});G.success(A("blocklet.config.clearCache.success",{count:((a=n.removed)==null?void 0:a.length)||0}))}catch(n){G.error(ie(n))}finally{p(!1),b(null)}},e={title:A("blocklet.config.clearCache.title"),description:A("blocklet.config.clearCache.description"),confirm:A("common.confirm"),cancel:A("common.cancel"),onConfirm:d,onCancel:h};return j.jsxs("div",{...E,children:[j.jsxs(Z,{onClick:()=>b(e),color:"error",variant:"outlined",size:O,children:[w?j.jsx(ue,{size:16,style:{marginRight:5}}):null,A("blocklet.config.clearCache.action")]}),o&&j.jsx(_e,{title:o.title,description:o.description,confirm:o.confirm,cancel:o.cancel,onConfirm:o.onConfirm,onCancel:o.onCancel})]})}var je={},kt=ye;Object.defineProperty(je,"__esModule",{value:!0});var Be=je.default=void 0,St=kt(ve()),Rt=j;Be=je.default=(0,St.default)((0,Rt.jsx)("path",{d:"M21 10h-8.35C11.83 7.67 9.61 6 7 6c-3.31 0-6 2.69-6 6s2.69 6 6 6c2.61 0 4.83-1.67 5.65-4H13l2 2 2-2 2 2 4-4.04zM7 15c-1.65 0-3-1.35-3-3s1.35-3 3-3 3 1.35 3 3-1.35 3-3 3"}),"KeyOutlined");function ke({onChange:$,disabled:O,loading:E,inService:A}){const{t:k}=oe(),{api:w,session:p}=Fe(),{blocklet:o}=et(),[b,h]=dt({newAppSk:"",isConnectOpen:!1,confirmDialogOpen:!1}),d=()=>h({isConnectOpen:!1}),e=()=>{if(tt.isInProgress(o.status)){G.error(k("blocklet.error.isInProgress"));return}h({confirmDialogOpen:!0})};return j.jsxs(j.Fragment,{children:[j.jsx(U,{title:k("blocklet.config.migrate.button"),desc:k("blocklet.config.migrate.description"),children:j.jsx(P,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:j.jsxs(We,{style:{flexShrink:0},variant:"contained",color:"primary",size:"small","data-cy":"config-did",disabled:O||E,onClick:e,children:[j.jsx(Be,{style:{fontSize:"1.3em",marginRight:4}}),k("blocklet.config.migrate.button")]})})}),j.jsxs(j.Fragment,{children:[b.isConnectOpen&&j.jsx(Me,{popup:!0,open:b.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:w.get,checkTimeout:5*60*1e3,onSuccess:()=>{$(),A&&p.logout(),d()},extraParams:{appDid:o.appDid},messages:{title:k("setup.keyPair.title"),scan:k("setup.keyPair.scan"),confirm:k("setup.keyPair.confirm"),success:k("setup.keyPair.success")},onClose:d}),b.confirmDialogOpen&&j.jsx(_e,{title:j.jsx(te,{sx:{fontSize:"20px",fontWeight:"500"},children:k("blocklet.config.migrate.title")}),description:j.jsx(te,{sx:{fontSize:"14px",color:"#9397A1"},children:k("blocklet.config.migrate.confirm")}),confirm:k("common.confirm"),cancel:k("common.cancel"),onConfirm:()=>h({confirmDialogOpen:!1,isConnectOpen:!0}),onCancel:()=>h({confirmDialogOpen:!1})})]})]})}ke.propTypes={onChange:J.func,disabled:J.bool,loading:J.bool,inService:J.bool};ke.defaultProps={onChange:()=>{},disabled:!1,loading:!1,inService:!1};function Se({onCancel:$,onSuccess:O,onError:E}){const{api:A}=z.useContext(it),[k,w]=z.useState(!1),{t:p,locale:o}=oe(),[b,h]=z.useState(""),[d,e]=z.useState(!1),[a,n]=z.useState(0),[r,t]=z.useState(""),{endpoint:l}=ze(),[s,i]=z.useState(!1),u=c=>{h(null),w(!0);try{t(c.result),n(_.length-1)}catch(m){const y=ie(m);h(y),E(m)}finally{w(!1)}},f=()=>{e(!0),n(1)},g=()=>{e(!1),n(0)},_=[{body:j.jsxs(P,{children:[j.jsx(te,{children:p("team.transferApp.transferDialog.tips.progress")}),j.jsx(te,{mt:3,mb:2,children:p("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:p("common.cancel"),confirm:p("team.transferApp.transferDialog.createTransferLink"),onCancel:$,onConfirm:f},{cancel:p("common.cancel"),confirm:p("team.transferApp.transferDialog.createTransferLink"),body:()=>j.jsx(Me,{action:"transfer-app-owner",open:d,locale:o,checkFn:A.get,onClose:g,onSuccess:u,checkTimeout:5*60*1e3,extraParams:{},messages:{title:p("team.transferApp.connectDialog.title"),scan:p("team.transferApp.connectDialog.scan"),confirm:p("team.transferApp.connectDialog.confirm"),success:p("team.transferApp.connectDialog.success")},popup:!0})},{body:()=>{const c=rt({transferId:r.transferId,endpoint:l});return j.jsxs(j.Fragment,{children:[j.jsx(P,{component:X,dangerouslySetInnerHTML:{__html:p("team.transferApp.transferDialog.createSuccessTip1")}}),j.jsx(P,{component:X,mt:2,children:j.jsx(X,{children:p("team.transferApp.transferDialog.createSuccessTip3")})}),j.jsxs(P,{children:[j.jsx(P,{component:X,mt:2,children:j.jsx(X,{children:p("team.transferApp.transferDialog.createSuccessTip2",{expireDate:st(r.expireDate,o)})})}),j.jsx(P,{my:1,children:j.jsx(ft,{children:c})})]}),j.jsx("div",{children:j.jsx(Ke,{value:"end",control:j.jsx(He,{checked:s,onChange:m=>i(m.target.checked)}),label:p("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:p("common.confirm"),onConfirm:O}],v=_[a];return j.jsxs(Pe,{title:j.jsx(X,{className:"title",children:p("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:j.jsxs(j.Fragment,{children:[v.cancel&&j.jsx(Z,{onClick:v.onCancel,color:"inherit",children:v.cancel}),j.jsxs(Z,{onClick:v.onConfirm,color:"error",disabled:k||a===_.length-1&&!s,variant:"contained",autoFocus:!0,children:[k&&j.jsx(ue,{size:16}),v.confirm]})]}),children:[j.jsx(Ge,{component:"div",children:typeof v.body=="function"?v.body():v.body}),!!b&&j.jsx(Ze,{severity:"error",variant:"icon",children:b})]})}Se.propTypes={onCancel:J.func.isRequired,onSuccess:J.func.isRequired,onError:J.func};Se.defaultProps={onError:()=>{}};const X=be.div`
2
+ font-size: 16px;
3
+ font-weight: bold;
4
+ &.title {
5
+ font-size: 20px;
6
+ }
7
+ `;var Ue={},Ve={exports:{}};(function($,O){(function(E,A){$.exports=A()})(self,()=>{return E={7629:(k,w,p)=>{const o=p(375),b=p(8571),h=p(9474),d=p(1687),e=p(8652),a=p(8160),n=p(3292),r=p(6354),t=p(8901),l=p(9708),s=p(6914),i=p(2294),u=p(6133),f=p(1152),g=p(8863),_=p(2036),v={Base:class{constructor(c){this.type=c,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new i.Ids,this._preferences=null,this._refs=new u.Manager,this._cache=null,this._valids=null,this._invalids=null,this._flags={},this._rules=[],this._singleRules=new Map,this.$_terms={},this.$_temp={ruleset:null,whens:{}}}describe(){return o(typeof l.describe=="function","Manifest functionality disabled"),l.describe(this)}allow(...c){return a.verifyFlat(c,"allow"),this._values(c,"_valids")}alter(c){o(c&&typeof c=="object"&&!Array.isArray(c),"Invalid targets argument"),o(!this._inRuleset(),"Cannot set alterations inside a ruleset");const m=this.clone();m.$_terms.alterations=m.$_terms.alterations||[];for(const y in c){const x=c[y];o(typeof x=="function","Alteration adjuster for",y,"must be a function"),m.$_terms.alterations.push({target:y,adjuster:x})}return m.$_temp.ruleset=!1,m}artifact(c){return o(c!==void 0,"Artifact cannot be undefined"),o(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",c)}cast(c){return o(c===!1||typeof c=="string","Invalid to value"),o(c===!1||this._definition.cast[c],"Type",this.type,"does not support casting to",c),this.$_setFlag("cast",c===!1?void 0:c)}default(c,m){return this._default("default",c,m)}description(c){return o(c&&typeof c=="string","Description must be a non-empty string"),this.$_setFlag("description",c)}empty(c){const m=this.clone();return c!==void 0&&(c=m.$_compile(c,{override:!1})),m.$_setFlag("empty",c,{clone:!1})}error(c){return o(c,"Missing error"),o(c instanceof Error||typeof c=="function","Must provide a valid Error object or a function"),this.$_setFlag("error",c)}example(c,m={}){return o(c!==void 0,"Missing example"),a.assertOptions(m,["override"]),this._inner("examples",c,{single:!0,override:m.override})}external(c,m){return typeof c=="object"&&(o(!m,"Cannot combine options with description"),m=c.description,c=c.method),o(typeof c=="function","Method must be a function"),o(m===void 0||m&&typeof m=="string","Description must be a non-empty string"),this._inner("externals",{method:c,description:m},{single:!0})}failover(c,m){return this._default("failover",c,m)}forbidden(){return this.presence("forbidden")}id(c){return c?(o(typeof c=="string","id must be a non-empty string"),o(/^[^\.]+$/.test(c),"id cannot contain period character"),this.$_setFlag("id",c)):this.$_setFlag("id",void 0)}invalid(...c){return this._values(c,"_invalids")}label(c){return o(c&&typeof c=="string","Label name must be a non-empty string"),this.$_setFlag("label",c)}meta(c){return o(c!==void 0,"Meta cannot be undefined"),this._inner("metas",c,{single:!0})}note(...c){o(c.length,"Missing notes");for(const m of c)o(m&&typeof m=="string","Notes must be non-empty strings");return this._inner("notes",c)}only(c=!0){return o(typeof c=="boolean","Invalid mode:",c),this.$_setFlag("only",c)}optional(){return this.presence("optional")}prefs(c){o(c,"Missing preferences"),o(c.context===void 0,"Cannot override context"),o(c.externals===void 0,"Cannot override externals"),o(c.warnings===void 0,"Cannot override warnings"),o(c.debug===void 0,"Cannot override debug"),a.checkPreferences(c);const m=this.clone();return m._preferences=a.preferences(m._preferences,c),m}presence(c){return o(["optional","required","forbidden"].includes(c),"Unknown presence mode",c),this.$_setFlag("presence",c)}raw(c=!0){return this.$_setFlag("result",c?"raw":void 0)}result(c){return o(["raw","strip"].includes(c),"Unknown result mode",c),this.$_setFlag("result",c)}required(){return this.presence("required")}strict(c){const m=this.clone(),y=c!==void 0&&!c;return m._preferences=a.preferences(m._preferences,{convert:y}),m}strip(c=!0){return this.$_setFlag("result",c?"strip":void 0)}tag(...c){o(c.length,"Missing tags");for(const m of c)o(m&&typeof m=="string","Tags must be non-empty strings");return this._inner("tags",c)}unit(c){return o(c&&typeof c=="string","Unit name must be a non-empty string"),this.$_setFlag("unit",c)}valid(...c){a.verifyFlat(c,"valid");const m=this.allow(...c);return m.$_setFlag("only",!!m._valids,{clone:!1}),m}when(c,m){const y=this.clone();y.$_terms.whens||(y.$_terms.whens=[]);const x=n.when(y,c,m);if(!["any","link"].includes(y.type)){const S=x.is?[x]:x.switch;for(const R of S)o(!R.then||R.then.type==="any"||R.then.type===y.type,"Cannot combine",y.type,"with",R.then&&R.then.type),o(!R.otherwise||R.otherwise.type==="any"||R.otherwise.type===y.type,"Cannot combine",y.type,"with",R.otherwise&&R.otherwise.type)}return y.$_terms.whens.push(x),y.$_mutateRebuild()}cache(c){o(!this._inRuleset(),"Cannot set caching inside a ruleset"),o(!this._cache,"Cannot override schema cache"),o(this._flags.artifact===void 0,"Cannot cache a rule with an artifact");const m=this.clone();return m._cache=c||e.provider.provision(),m.$_temp.ruleset=!1,m}clone(){const c=Object.create(Object.getPrototypeOf(this));return this._assign(c)}concat(c){o(a.isSchema(c),"Invalid schema object"),o(this.type==="any"||c.type==="any"||c.type===this.type,"Cannot merge type",this.type,"with another type:",c.type),o(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),o(!c._inRuleset(),"Cannot concatenate a schema with open ruleset");let m=this.clone();if(this.type==="any"&&c.type!=="any"){const y=c.clone();for(const x of Object.keys(m))x!=="type"&&(y[x]=m[x]);m=y}m._ids.concat(c._ids),m._refs.register(c,u.toSibling),m._preferences=m._preferences?a.preferences(m._preferences,c._preferences):c._preferences,m._valids=_.merge(m._valids,c._valids,c._invalids),m._invalids=_.merge(m._invalids,c._invalids,c._valids);for(const y of c._singleRules.keys())m._singleRules.has(y)&&(m._rules=m._rules.filter(x=>x.keep||x.name!==y),m._singleRules.delete(y));for(const y of c._rules)c._definition.rules[y.method].multi||m._singleRules.set(y.name,y),m._rules.push(y);if(m._flags.empty&&c._flags.empty){m._flags.empty=m._flags.empty.concat(c._flags.empty);const y=Object.assign({},c._flags);delete y.empty,d(m._flags,y)}else if(c._flags.empty){m._flags.empty=c._flags.empty;const y=Object.assign({},c._flags);delete y.empty,d(m._flags,y)}else d(m._flags,c._flags);for(const y in c.$_terms){const x=c.$_terms[y];x?m.$_terms[y]?m.$_terms[y]=m.$_terms[y].concat(x):m.$_terms[y]=x.slice():m.$_terms[y]||(m.$_terms[y]=x)}return this.$_root._tracer&&this.$_root._tracer._combine(m,[this,c]),m.$_mutateRebuild()}extend(c){return o(!c.base,"Cannot extend type with another base"),t.type(this,c)}extract(c){return c=Array.isArray(c)?c:c.split("."),this._ids.reach(c)}fork(c,m){o(!this._inRuleset(),"Cannot fork inside a ruleset");let y=this;for(let x of[].concat(c))x=Array.isArray(x)?x:x.split("."),y=y._ids.fork(x,m,y);return y.$_temp.ruleset=!1,y}rule(c){const m=this._definition;a.assertOptions(c,Object.keys(m.modifiers)),o(this.$_temp.ruleset!==!1,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const y=this.$_temp.ruleset===null?this._rules.length-1:this.$_temp.ruleset;o(y>=0&&y<this._rules.length,"Cannot apply rules to empty ruleset");const x=this.clone();for(let S=y;S<x._rules.length;++S){const R=x._rules[S],C=b(R);for(const D in c)m.modifiers[D](C,c[D]),o(C.name===R.name,"Cannot change rule name");x._rules[S]=C,x._singleRules.get(C.name)===R&&x._singleRules.set(C.name,C)}return x.$_temp.ruleset=!1,x.$_mutateRebuild()}get ruleset(){o(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const c=this.clone();return c.$_temp.ruleset=c._rules.length,c}get $(){return this.ruleset}tailor(c){c=[].concat(c),o(!this._inRuleset(),"Cannot tailor inside a ruleset");let m=this;if(this.$_terms.alterations)for(const{target:y,adjuster:x}of this.$_terms.alterations)c.includes(y)&&(m=x(m),o(a.isSchema(m),"Alteration adjuster for",y,"failed to return a schema object"));return m=m.$_modify({each:y=>y.tailor(c),ref:!1}),m.$_temp.ruleset=!1,m.$_mutateRebuild()}tracer(){return f.location?f.location(this):this}validate(c,m){return g.entry(c,this,m)}validateAsync(c,m){return g.entryAsync(c,this,m)}$_addRule(c){typeof c=="string"&&(c={name:c}),o(c&&typeof c=="object","Invalid options"),o(c.name&&typeof c.name=="string","Invalid rule name");for(const R in c)o(R[0]!=="_","Cannot set private rule properties");const m=Object.assign({},c);m._resolve=[],m.method=m.method||m.name;const y=this._definition.rules[m.method],x=m.args;o(y,"Unknown rule",m.method);const S=this.clone();if(x){o(Object.keys(x).length===1||Object.keys(x).length===this._definition.rules[m.name].args.length,"Invalid rule definition for",this.type,m.name);for(const R in x){let C=x[R];if(y.argsByName){const D=y.argsByName.get(R);if(D.ref&&a.isResolvable(C))m._resolve.push(R),S.$_mutateRegister(C);else if(D.normalize&&(C=D.normalize(C),x[R]=C),D.assert){const L=a.validateArg(C,R,D);o(!L,L,"or reference")}}C!==void 0?x[R]=C:delete x[R]}}return y.multi||(S._ruleRemove(m.name,{clone:!1}),S._singleRules.set(m.name,m)),S.$_temp.ruleset===!1&&(S.$_temp.ruleset=null),y.priority?S._rules.unshift(m):S._rules.push(m),S}$_compile(c,m){return n.schema(this.$_root,c,m)}$_createError(c,m,y,x,S,R={}){const C=R.flags!==!1?this._flags:{},D=R.messages?s.merge(this._definition.messages,R.messages):this._definition.messages;return new r.Report(c,m,y,C,D,x,S)}$_getFlag(c){return this._flags[c]}$_getRule(c){return this._singleRules.get(c)}$_mapLabels(c){return c=Array.isArray(c)?c:c.split("."),this._ids.labels(c)}$_match(c,m,y,x){(y=Object.assign({},y)).abortEarly=!0,y._externals=!1,m.snapshot();const S=!g.validate(c,this,m,y,x).errors;return m.restore(),S}$_modify(c){return a.assertOptions(c,["each","once","ref","schema"]),i.schema(this,c)||this}$_mutateRebuild(){return o(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(c,{source:m,name:y,path:x,key:S})=>{const R=this._definition[m][y]&&this._definition[m][y].register;R!==!1&&this.$_mutateRegister(c,{family:R,key:S})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(c,{family:m,key:y}={}){this._refs.register(c,m),this._ids.register(c,{key:y})}$_property(c){return this._definition.properties[c]}$_reach(c){return this._ids.reach(c)}$_rootReferences(){return this._refs.roots()}$_setFlag(c,m,y={}){o(c[0]==="_"||!this._inRuleset(),"Cannot set flag inside a ruleset");const x=this._definition.flags[c]||{};if(h(m,x.default)&&(m=void 0),h(m,this._flags[c]))return this;const S=y.clone!==!1?this.clone():this;return m!==void 0?(S._flags[c]=m,S.$_mutateRegister(m)):delete S._flags[c],c[0]!=="_"&&(S.$_temp.ruleset=!1),S}$_parent(c,...m){return this[c][a.symbols.parent].call(this,...m)}$_validate(c,m,y){return g.validate(c,this,m,y)}_assign(c){c.type=this.type,c.$_root=this.$_root,c.$_temp=Object.assign({},this.$_temp),c.$_temp.whens={},c._ids=this._ids.clone(),c._preferences=this._preferences,c._valids=this._valids&&this._valids.clone(),c._invalids=this._invalids&&this._invalids.clone(),c._rules=this._rules.slice(),c._singleRules=b(this._singleRules,{shallow:!0}),c._refs=this._refs.clone(),c._flags=Object.assign({},this._flags),c._cache=null,c.$_terms={};for(const m in this.$_terms)c.$_terms[m]=this.$_terms[m]?this.$_terms[m].slice():null;c.$_super={};for(const m in this.$_super)c.$_super[m]=this._super[m].bind(c);return c}_bare(){const c=this.clone();c._reset();const m=c._definition.terms;for(const y in m){const x=m[y];c.$_terms[y]=x.init}return c.$_mutateRebuild()}_default(c,m,y={}){return a.assertOptions(y,"literal"),o(m!==void 0,"Missing",c,"value"),o(typeof m=="function"||!y.literal,"Only function value supports literal option"),typeof m=="function"&&y.literal&&(m={[a.symbols.literal]:!0,literal:m}),this.$_setFlag(c,m)}_generate(c,m,y){if(!this.$_terms.whens)return{schema:this};const x=[],S=[];for(let D=0;D<this.$_terms.whens.length;++D){const L=this.$_terms.whens[D];if(L.concat){x.push(L.concat),S.push(`${D}.concat`);continue}const M=L.ref?L.ref.resolve(c,m,y):c,F=L.is?[L]:L.switch,I=S.length;for(let T=0;T<F.length;++T){const{is:q,then:N,otherwise:B}=F[T],H=`${D}${L.switch?"."+T:""}`;if(q.$_match(M,m.nest(q,`${H}.is`),y)){if(N){const se=m.localize([...m.path,`${H}.then`],m.ancestors,m.schemas),{schema:he,id:ne}=N._generate(c,se,y);x.push(he),S.push(`${H}.then${ne?`(${ne})`:""}`);break}}else if(B){const se=m.localize([...m.path,`${H}.otherwise`],m.ancestors,m.schemas),{schema:he,id:ne}=B._generate(c,se,y);x.push(he),S.push(`${H}.otherwise${ne?`(${ne})`:""}`);break}}if(L.break&&S.length>I)break}const R=S.join(", ");if(m.mainstay.tracer.debug(m,"rule","when",R),!R)return{schema:this};if(!m.mainstay.tracer.active&&this.$_temp.whens[R])return{schema:this.$_temp.whens[R],id:R};let C=this;this._definition.generate&&(C=this._definition.generate(this,c,m,y));for(const D of x)C=C.concat(D);return this.$_root._tracer&&this.$_root._tracer._combine(C,[this,...x]),this.$_temp.whens[R]=C,{schema:C,id:R}}_inner(c,m,y={}){o(!this._inRuleset(),`Cannot set ${c} inside a ruleset`);const x=this.clone();return x.$_terms[c]&&!y.override||(x.$_terms[c]=[]),y.single?x.$_terms[c].push(m):x.$_terms[c].push(...m),x.$_temp.ruleset=!1,x}_inRuleset(){return this.$_temp.ruleset!==null&&this.$_temp.ruleset!==!1}_ruleRemove(c,m={}){if(!this._singleRules.has(c))return this;const y=m.clone!==!1?this.clone():this;y._singleRules.delete(c);const x=[];for(let S=0;S<y._rules.length;++S){const R=y._rules[S];R.name!==c||R.keep?x.push(R):y._inRuleset()&&S<y.$_temp.ruleset&&--y.$_temp.ruleset}return y._rules=x,y}_values(c,m){a.verifyFlat(c,m.slice(1,-1));const y=this.clone(),x=c[0]===a.symbols.override;if(x&&(c=c.slice(1)),!y[m]&&c.length?y[m]=new _:x&&(y[m]=c.length?new _:null,y.$_mutateRebuild()),!y[m])return y;x&&y[m].override();for(const S of c){o(S!==void 0,"Cannot call allow/valid/invalid with undefined"),o(S!==a.symbols.override,"Override must be the first value");const R=m==="_invalids"?"_valids":"_invalids";y[R]&&(y[R].remove(S),y[R].length||(o(m==="_valids"||!y._flags.only,"Setting invalid value",S,"leaves schema rejecting all values due to previous valid rule"),y[R]=null)),y[m].add(S,y._refs)}return y}}};v.Base.prototype[a.symbols.any]={version:a.version,compile:n.compile,root:"$_root"},v.Base.prototype.isImmutable=!0,v.Base.prototype.deny=v.Base.prototype.invalid,v.Base.prototype.disallow=v.Base.prototype.invalid,v.Base.prototype.equal=v.Base.prototype.valid,v.Base.prototype.exist=v.Base.prototype.required,v.Base.prototype.not=v.Base.prototype.invalid,v.Base.prototype.options=v.Base.prototype.prefs,v.Base.prototype.preferences=v.Base.prototype.prefs,k.exports=new v.Base},8652:(k,w,p)=>{const o=p(375),b=p(8571),h=p(8160),d={max:1e3,supported:new Set(["undefined","boolean","number","string"])};w.provider={provision:e=>new d.Cache(e)},d.Cache=class{constructor(e={}){h.assertOptions(e,["max"]),o(e.max===void 0||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||d.max,this._map=new Map,this._list=new d.List}get length(){return this._map.size}set(e,a){if(e!==null&&!d.supported.has(typeof e))return;let n=this._map.get(e);if(n)return n.value=a,void this._list.first(n);n=this._list.unshift({key:e,value:a}),this._map.set(e,n),this._compact()}get(e){const a=this._map.get(e);if(a)return this._list.first(a),b(a.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},d.List=class{constructor(){this.tail=null,this.head=null}unshift(e){return e.next=null,e.prev=this.head,this.head&&(this.head.next=e),this.head=e,this.tail||(this.tail=e),e}first(e){e!==this.head&&(this._remove(e),this.unshift(e))}pop(){return this._remove(this.tail)}_remove(e){const{next:a,prev:n}=e;return a.prev=n,n&&(n.next=a),e===this.tail&&(this.tail=a),e.prev=null,e.next=null,e}}},8160:(k,w,p)=>{const o=p(375),b=p(7916),h=p(5934);let d,e;const a={isoDate:/^(?:[-+]\d{2})?(?:\d{4}(?!\d{2}\b))(?:(-?)(?:(?:0[1-9]|1[0-2])(?:\1(?:[12]\d|0[1-9]|3[01]))?|W(?:[0-4]\d|5[0-2])(?:-?[1-7])?|(?:00[1-9]|0[1-9]\d|[12]\d{2}|3(?:[0-5]\d|6[1-6])))(?![T]$|[T][\d]+Z$)(?:[T\s](?:(?:(?:[01]\d|2[0-3])(?:(:?)[0-5]\d)?|24\:?00)(?:[.,]\d+(?!:))?)(?:\2[0-5]\d(?:[.,]\d+)?)?(?:[Z]|(?:[+-])(?:[01]\d|2[0-3])(?::?[0-5]\d)?)?)?)?$/};w.version=h.version,w.defaults={abortEarly:!0,allowUnknown:!1,artifacts:!1,cache:!0,context:null,convert:!0,dateFormat:"iso",errors:{escapeHtml:!1,label:"path",language:null,render:!0,stack:!1,wrap:{label:'"',array:"[]"}},externals:!0,messages:{},nonEnumerables:!1,noDefaults:!1,presence:"optional",skipFunctions:!1,stripUnknown:!1,warnings:!1},w.symbols={any:Symbol.for("@hapi/joi/schema"),arraySingle:Symbol("arraySingle"),deepDefault:Symbol("deepDefault"),errors:Symbol("errors"),literal:Symbol("literal"),override:Symbol("override"),parent:Symbol("parent"),prefs:Symbol("prefs"),ref:Symbol("ref"),template:Symbol("template"),values:Symbol("values")},w.assertOptions=function(n,r,t="Options"){o(n&&typeof n=="object"&&!Array.isArray(n),"Options must be of type object");const l=Object.keys(n).filter(s=>!r.includes(s));o(l.length===0,`${t} contain unknown keys: ${l}`)},w.checkPreferences=function(n){e=e||p(3378);const r=e.preferences.validate(n);if(r.error)throw new b([r.error.details[0].message])},w.compare=function(n,r,t){switch(t){case"=":return n===r;case">":return n>r;case"<":return n<r;case">=":return n>=r;case"<=":return n<=r}},w.default=function(n,r){return n===void 0?r:n},w.isIsoDate=function(n){return a.isoDate.test(n)},w.isNumber=function(n){return typeof n=="number"&&!isNaN(n)},w.isResolvable=function(n){return!!n&&(n[w.symbols.ref]||n[w.symbols.template])},w.isSchema=function(n,r={}){const t=n&&n[w.symbols.any];return!!t&&(o(r.legacy||t.version===w.version,"Cannot mix different versions of joi schemas"),!0)},w.isValues=function(n){return n[w.symbols.values]},w.limit=function(n){return Number.isSafeInteger(n)&&n>=0},w.preferences=function(n,r){d=d||p(6914),n=n||{},r=r||{};const t=Object.assign({},n,r);return r.errors&&n.errors&&(t.errors=Object.assign({},n.errors,r.errors),t.errors.wrap=Object.assign({},n.errors.wrap,r.errors.wrap)),r.messages&&(t.messages=d.compile(r.messages,n.messages)),delete t[w.symbols.prefs],t},w.tryWithPath=function(n,r,t={}){try{return n()}catch(l){throw l.path!==void 0?l.path=r+"."+l.path:l.path=r,t.append&&(l.message=`${l.message} (${l.path})`),l}},w.validateArg=function(n,r,{assert:t,message:l}){if(w.isSchema(t)){const s=t.validate(n);return s.error?s.error.message:void 0}if(!t(n))return r?`${r} ${l}`:l},w.verifyFlat=function(n,r){for(const t of n)o(!Array.isArray(t),"Method no longer accepts array arguments:",r)}},3292:(k,w,p)=>{const o=p(375),b=p(8160),h=p(6133),d={};w.schema=function(e,a,n={}){b.assertOptions(n,["appendPath","override"]);try{return d.schema(e,a,n)}catch(r){throw n.appendPath&&r.path!==void 0&&(r.message=`${r.message} (${r.path})`),r}},d.schema=function(e,a,n){o(a!==void 0,"Invalid undefined schema"),Array.isArray(a)&&(o(a.length,"Invalid empty array schema"),a.length===1&&(a=a[0]));const r=(t,...l)=>n.override!==!1?t.valid(e.override,...l):t.valid(...l);if(d.simple(a))return r(e,a);if(typeof a=="function")return e.custom(a);if(o(typeof a=="object","Invalid schema content:",typeof a),b.isResolvable(a))return r(e,a);if(b.isSchema(a))return a;if(Array.isArray(a)){for(const t of a)if(!d.simple(t))return e.alternatives().try(...a);return r(e,...a)}return a instanceof RegExp?e.string().regex(a):a instanceof Date?r(e.date(),a):(o(Object.getPrototypeOf(a)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(a))},w.ref=function(e,a){return h.isRef(e)?e:h.create(e,a)},w.compile=function(e,a,n={}){b.assertOptions(n,["legacy"]);const r=a&&a[b.symbols.any];if(r)return o(n.legacy||r.version===b.version,"Cannot mix different versions of joi schemas:",r.version,b.version),a;if(typeof a!="object"||!n.legacy)return w.schema(e,a,{appendPath:!0});const t=d.walk(a);return t?t.compile(t.root,a):w.schema(e,a,{appendPath:!0})},d.walk=function(e){if(typeof e!="object")return null;if(Array.isArray(e)){for(const n of e){const r=d.walk(n);if(r)return r}return null}const a=e[b.symbols.any];if(a)return{root:e[a.root],compile:a.compile};o(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const n in e){const r=d.walk(e[n]);if(r)return r}return null},d.simple=function(e){return e===null||["boolean","string","number"].includes(typeof e)},w.when=function(e,a,n){if(n===void 0&&(o(a&&typeof a=="object","Missing options"),n=a,a=h.create(".")),Array.isArray(n)&&(n={switch:n}),b.assertOptions(n,["is","not","then","otherwise","switch","break"]),b.isSchema(a))return o(n.is===void 0,'"is" can not be used with a schema condition'),o(n.not===void 0,'"not" can not be used with a schema condition'),o(n.switch===void 0,'"switch" can not be used with a schema condition'),d.condition(e,{is:a,then:n.then,otherwise:n.otherwise,break:n.break});if(o(h.isRef(a)||typeof a=="string","Invalid condition:",a),o(n.not===void 0||n.is===void 0,'Cannot combine "is" with "not"'),n.switch===void 0){let t=n;n.not!==void 0&&(t={is:n.not,then:n.otherwise,otherwise:n.then,break:n.break});let l=t.is!==void 0?e.$_compile(t.is):e.$_root.invalid(null,!1,0,"").required();return o(t.then!==void 0||t.otherwise!==void 0,'options must have at least one of "then", "otherwise", or "switch"'),o(t.break===void 0||t.then===void 0||t.otherwise===void 0,"Cannot specify then, otherwise, and break all together"),n.is===void 0||h.isRef(n.is)||b.isSchema(n.is)||(l=l.required()),d.condition(e,{ref:w.ref(a),is:l,then:t.then,otherwise:t.otherwise,break:t.break})}o(Array.isArray(n.switch),'"switch" must be an array'),o(n.is===void 0,'Cannot combine "switch" with "is"'),o(n.not===void 0,'Cannot combine "switch" with "not"'),o(n.then===void 0,'Cannot combine "switch" with "then"');const r={ref:w.ref(a),switch:[],break:n.break};for(let t=0;t<n.switch.length;++t){const l=n.switch[t],s=t===n.switch.length-1;b.assertOptions(l,s?["is","then","otherwise"]:["is","then"]),o(l.is!==void 0,'Switch statement missing "is"'),o(l.then!==void 0,'Switch statement missing "then"');const i={is:e.$_compile(l.is),then:e.$_compile(l.then)};if(h.isRef(l.is)||b.isSchema(l.is)||(i.is=i.is.required()),s){o(n.otherwise===void 0||l.otherwise===void 0,'Cannot specify "otherwise" inside and outside a "switch"');const u=n.otherwise!==void 0?n.otherwise:l.otherwise;u!==void 0&&(o(r.break===void 0,"Cannot specify both otherwise and break"),i.otherwise=e.$_compile(u))}r.switch.push(i)}return r},d.condition=function(e,a){for(const n of["then","otherwise"])a[n]===void 0?delete a[n]:a[n]=e.$_compile(a[n]);return a}},6354:(k,w,p)=>{const o=p(5688),b=p(8160),h=p(3328);w.Report=class{constructor(d,e,a,n,r,t,l){if(this.code=d,this.flags=n,this.messages=r,this.path=t.path,this.prefs=l,this.state=t,this.value=e,this.message=null,this.template=null,this.local=a||{},this.local.label=w.label(this.flags,this.state,this.prefs,this.messages),this.value===void 0||this.local.hasOwnProperty("value")||(this.local.value=this.value),this.path.length){const s=this.path[this.path.length-1];typeof s!="object"&&(this.local.key=s)}}_setTemplate(d){if(this.template=d,!this.flags.label&&this.path.length===0){const e=this._template(this.template,"root");e&&(this.local.label=e)}}toString(){if(this.message)return this.message;const d=this.code;if(!this.prefs.errors.render)return this.code;const e=this._template(this.template)||this._template(this.prefs.messages)||this._template(this.messages);return e===void 0?`Error code "${d}" is not defined, your custom type is missing the correct messages definition`:(this.message=e.render(this.value,this.state,this.prefs,this.local,{errors:this.prefs.errors,messages:[this.prefs.messages,this.messages]}),this.prefs.errors.label||(this.message=this.message.replace(/^"" /,"").trim()),this.message)}_template(d,e){return w.template(this.value,d,e||this.code,this.state,this.prefs)}},w.path=function(d){let e="";for(const a of d)typeof a!="object"&&(typeof a=="string"?(e&&(e+="."),e+=a):e+=`[${a}]`);return e},w.template=function(d,e,a,n,r){if(!e)return;if(h.isTemplate(e))return a!=="root"?e:null;let t=r.errors.language;if(b.isResolvable(t)&&(t=t.resolve(d,n,r)),t&&e[t]){if(e[t][a]!==void 0)return e[t][a];if(e[t]["*"]!==void 0)return e[t]["*"]}return e[a]?e[a]:e["*"]},w.label=function(d,e,a,n){if(!a.errors.label)return"";if(d.label)return d.label;let r=e.path;return a.errors.label==="key"&&e.path.length>1&&(r=e.path.slice(-1)),w.path(r)||w.template(null,a.messages,"root",e,a)||n&&w.template(null,n,"root",e,a)||"value"},w.process=function(d,e,a){if(!d)return null;const{override:n,message:r,details:t}=w.details(d);if(n)return n;if(a.errors.stack)return new w.ValidationError(r,t,e);const l=Error.stackTraceLimit;Error.stackTraceLimit=0;const s=new w.ValidationError(r,t,e);return Error.stackTraceLimit=l,s},w.details=function(d,e={}){let a=[];const n=[];for(const r of d){if(r instanceof Error){if(e.override!==!1)return{override:r};const l=r.toString();a.push(l),n.push({message:l,type:"override",context:{error:r}});continue}const t=r.toString();a.push(t),n.push({message:t,path:r.path.filter(l=>typeof l!="object"),type:r.code,context:r.local})}return a.length>1&&(a=[...new Set(a)]),{message:a.join(". "),details:n}},w.ValidationError=class extends Error{constructor(d,e,a){super(d),this._original=a,this.details=e}static isError(d){return d instanceof w.ValidationError}},w.ValidationError.prototype.isJoi=!0,w.ValidationError.prototype.name="ValidationError",w.ValidationError.prototype.annotate=o.error},8901:(k,w,p)=>{const o=p(375),b=p(8571),h=p(8160),d=p(6914),e={};w.type=function(a,n){const r=Object.getPrototypeOf(a),t=b(r),l=a._assign(Object.create(t)),s=Object.assign({},n);delete s.base,t._definition=s;const i=r._definition||{};s.messages=d.merge(i.messages,s.messages),s.properties=Object.assign({},i.properties,s.properties),l.type=s.type,s.flags=Object.assign({},i.flags,s.flags);const u=Object.assign({},i.terms);if(s.terms)for(const v in s.terms){const c=s.terms[v];o(l.$_terms[v]===void 0,"Invalid term override for",s.type,v),l.$_terms[v]=c.init,u[v]=c}s.terms=u,s.args||(s.args=i.args),s.prepare=e.prepare(s.prepare,i.prepare),s.coerce&&(typeof s.coerce=="function"&&(s.coerce={method:s.coerce}),s.coerce.from&&!Array.isArray(s.coerce.from)&&(s.coerce={method:s.coerce.method,from:[].concat(s.coerce.from)})),s.coerce=e.coerce(s.coerce,i.coerce),s.validate=e.validate(s.validate,i.validate);const f=Object.assign({},i.rules);if(s.rules)for(const v in s.rules){const c=s.rules[v];o(typeof c=="object","Invalid rule definition for",s.type,v);let m=c.method;if(m===void 0&&(m=function(){return this.$_addRule(v)}),m&&(o(!t[v],"Rule conflict in",s.type,v),t[v]=m),o(!f[v],"Rule conflict in",s.type,v),f[v]=c,c.alias){const y=[].concat(c.alias);for(const x of y)t[x]=c.method}c.args&&(c.argsByName=new Map,c.args=c.args.map(y=>(typeof y=="string"&&(y={name:y}),o(!c.argsByName.has(y.name),"Duplicated argument name",y.name),h.isSchema(y.assert)&&(y.assert=y.assert.strict().label(y.name)),c.argsByName.set(y.name,y),y)))}s.rules=f;const g=Object.assign({},i.modifiers);if(s.modifiers)for(const v in s.modifiers){o(!t[v],"Rule conflict in",s.type,v);const c=s.modifiers[v];o(typeof c=="function","Invalid modifier definition for",s.type,v);const m=function(y){return this.rule({[v]:y})};t[v]=m,g[v]=c}if(s.modifiers=g,s.overrides){t._super=r,l.$_super={};for(const v in s.overrides)o(r[v],"Cannot override missing",v),s.overrides[v][h.symbols.parent]=r[v],l.$_super[v]=r[v].bind(l);Object.assign(t,s.overrides)}s.cast=Object.assign({},i.cast,s.cast);const _=Object.assign({},i.manifest,s.manifest);return _.build=e.build(s.manifest&&s.manifest.build,i.manifest&&i.manifest.build),s.manifest=_,s.rebuild=e.rebuild(s.rebuild,i.rebuild),l},e.build=function(a,n){return a&&n?function(r,t){return n(a(r,t),t)}:a||n},e.coerce=function(a,n){return a&&n?{from:a.from&&n.from?[...new Set([...a.from,...n.from])]:null,method(r,t){let l;if((!n.from||n.from.includes(typeof r))&&(l=n.method(r,t),l)){if(l.errors||l.value===void 0)return l;r=l.value}if(!a.from||a.from.includes(typeof r)){const s=a.method(r,t);if(s)return s}return l}}:a||n},e.prepare=function(a,n){return a&&n?function(r,t){const l=a(r,t);if(l){if(l.errors||l.value===void 0)return l;r=l.value}return n(r,t)||l}:a||n},e.rebuild=function(a,n){return a&&n?function(r){n(r),a(r)}:a||n},e.validate=function(a,n){return a&&n?function(r,t){const l=n(r,t);if(l){if(l.errors&&(!Array.isArray(l.errors)||l.errors.length))return l;r=l.value}return a(r,t)||l}:a||n}},5107:(k,w,p)=>{const o=p(375),b=p(8571),h=p(8652),d=p(8160),e=p(3292),a=p(6354),n=p(8901),r=p(9708),t=p(6133),l=p(3328),s=p(1152);let i;const u={types:{alternatives:p(4946),any:p(8068),array:p(546),boolean:p(4937),date:p(7500),function:p(390),link:p(8785),number:p(3832),object:p(8966),string:p(7417),symbol:p(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const f={_types:new Set(Object.keys(u.types))};for(const g of f._types)f[g]=function(..._){return o(!_.length||["alternatives","link","object"].includes(g),"The",g,"type does not allow arguments"),u.generate(this,u.types[g],_)};for(const g of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])f[g]=function(..._){return this.any()[g](..._)};Object.assign(f,u.methods);for(const g in u.aliases){const _=u.aliases[g];f[g]=f[_]}return f.x=f.expression,s.setup&&s.setup(f),f}};u.methods={ValidationError:a.ValidationError,version:d.version,cache:h.provider,assert(f,g,..._){u.assert(f,g,!0,_)},attempt:(f,g,..._)=>u.assert(f,g,!1,_),build(f){return o(typeof r.build=="function","Manifest functionality disabled"),r.build(this,f)},checkPreferences(f){d.checkPreferences(f)},compile(f,g){return e.compile(this,f,g)},defaults(f){o(typeof f=="function","modifier must be a function");const g=Object.assign({},this);for(const _ of g._types){const v=f(g[_]());o(d.isSchema(v),"modifier must return a valid schema object"),g[_]=function(...c){return u.generate(this,v,c)}}return g},expression:(...f)=>new l(...f),extend(...f){d.verifyFlat(f,"extend"),i=i||p(3378),o(f.length,"You need to provide at least one extension"),this.assert(f,i.extensions);const g=Object.assign({},this);g._types=new Set(g._types);for(let _ of f){typeof _=="function"&&(_=_(g)),this.assert(_,i.extension);const v=u.expandExtension(_,g);for(const c of v){o(g[c.type]===void 0||g._types.has(c.type),"Cannot override name",c.type);const m=c.base||this.any(),y=n.type(m,c);g._types.add(c.type),g[c.type]=function(...x){return u.generate(this,y,x)}}}return g},isError:a.ValidationError.isError,isExpression:l.isTemplate,isRef:t.isRef,isSchema:d.isSchema,in:(...f)=>t.in(...f),override:d.symbols.override,ref:(...f)=>t.create(...f),types(){const f={};for(const g of this._types)f[g]=this[g]();for(const g in u.aliases)f[g]=this[g]();return f}},u.assert=function(f,g,_,v){const c=v[0]instanceof Error||typeof v[0]=="string"?v[0]:null,m=c!==null?v[1]:v[0],y=g.validate(f,d.preferences({errors:{stack:!0}},m||{}));let x=y.error;if(!x)return y.value;if(c instanceof Error)throw c;const S=_&&typeof x.annotate=="function"?x.annotate():x.message;throw x instanceof a.ValidationError==0&&(x=b(x)),x.message=c?`${c} ${S}`:S,x},u.generate=function(f,g,_){return o(f,"Must be invoked on a Joi instance."),g.$_root=f,g._definition.args&&_.length?g._definition.args(g,..._):g},u.expandExtension=function(f,g){if(typeof f.type=="string")return[f];const _=[];for(const v of g._types)if(f.type.test(v)){const c=Object.assign({},f);c.type=v,c.base=g[v](),_.push(c)}return _},k.exports=u.root()},6914:(k,w,p)=>{const o=p(375),b=p(8571),h=p(3328);w.compile=function(d,e){if(typeof d=="string")return o(!e,"Cannot set single message string"),new h(d);if(h.isTemplate(d))return o(!e,"Cannot set single message template"),d;o(typeof d=="object"&&!Array.isArray(d),"Invalid message options"),e=e?b(e):{};for(let a in d){const n=d[a];if(a==="root"||h.isTemplate(n)){e[a]=n;continue}if(typeof n=="string"){e[a]=new h(n);continue}o(typeof n=="object"&&!Array.isArray(n),"Invalid message for",a);const r=a;for(a in e[r]=e[r]||{},n){const t=n[a];a==="root"||h.isTemplate(t)?e[r][a]=t:(o(typeof t=="string","Invalid message for",a,"in",r),e[r][a]=new h(t))}}return e},w.decompile=function(d){const e={};for(let a in d){const n=d[a];if(a==="root"){e.root=n;continue}if(h.isTemplate(n)){e[a]=n.describe({compact:!0});continue}const r=a;for(a in e[r]={},n){const t=n[a];a!=="root"?e[r][a]=t.describe({compact:!0}):e[r].root=t}}return e},w.merge=function(d,e){if(!d)return w.compile(e);if(!e)return d;if(typeof e=="string")return new h(e);if(h.isTemplate(e))return e;const a=b(d);for(let n in e){const r=e[n];if(n==="root"||h.isTemplate(r)){a[n]=r;continue}if(typeof r=="string"){a[n]=new h(r);continue}o(typeof r=="object"&&!Array.isArray(r),"Invalid message for",n);const t=n;for(n in a[t]=a[t]||{},r){const l=r[n];n==="root"||h.isTemplate(l)?a[t][n]=l:(o(typeof l=="string","Invalid message for",n,"in",t),a[t][n]=new h(l))}}return a}},2294:(k,w,p)=>{const o=p(375),b=p(8160),h=p(6133),d={};w.Ids=d.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new d.Ids;return e._byId=new Map(this._byId),e._byKey=new Map(this._byKey),e._schemaChain=this._schemaChain,e}concat(e){e._schemaChain&&(this._schemaChain=!0);for(const[a,n]of e._byId.entries())o(!this._byKey.has(a),"Schema id conflicts with existing key:",a),this._byId.set(a,n);for(const[a,n]of e._byKey.entries())o(!this._byId.has(a),"Schema key conflicts with existing id:",a),this._byKey.set(a,n)}fork(e,a,n){const r=this._collect(e);r.push({schema:n});const t=r.shift();let l={id:t.id,schema:a(t.schema)};o(b.isSchema(l.schema),"adjuster function failed to return a joi schema type");for(const s of r)l={id:s.id,schema:d.fork(s.schema,l.id,l.schema)};return l.schema}labels(e,a=[]){const n=e[0],r=this._get(n);if(!r)return[...a,...e].join(".");const t=e.slice(1);return a=[...a,r.schema._flags.label||n],t.length?r.schema._ids.labels(t,a):a.join(".")}reach(e,a=[]){const n=e[0],r=this._get(n);o(r,"Schema does not contain path",[...a,...e].join("."));const t=e.slice(1);return t.length?r.schema._ids.reach(t,[...a,n]):r.schema}register(e,{key:a}={}){if(!e||!b.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const n=e._flags.id;if(n){const r=this._byId.get(n);o(!r||r.schema===e,"Cannot add different schemas with the same id:",n),o(!this._byKey.has(n),"Schema id conflicts with existing key:",n),this._byId.set(n,{schema:e,id:n})}a&&(o(!this._byKey.has(a),"Schema already contains key:",a),o(!this._byId.has(a),"Schema key conflicts with existing id:",a),this._byKey.set(a,{schema:e,id:a}))}reset(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}_collect(e,a=[],n=[]){const r=e[0],t=this._get(r);o(t,"Schema does not contain path",[...a,...e].join(".")),n=[t,...n];const l=e.slice(1);return l.length?t.schema._ids._collect(l,[...a,r],n):n}_get(e){return this._byId.get(e)||this._byKey.get(e)}},d.fork=function(e,a,n){const r=w.schema(e,{each:(t,{key:l})=>{if(a===(t._flags.id||l))return n},ref:!1});return r?r.$_mutateRebuild():e},w.schema=function(e,a){let n;for(const r in e._flags){if(r[0]==="_")continue;const t=d.scan(e._flags[r],{source:"flags",name:r},a);t!==void 0&&(n=n||e.clone(),n._flags[r]=t)}for(let r=0;r<e._rules.length;++r){const t=e._rules[r],l=d.scan(t.args,{source:"rules",name:t.name},a);if(l!==void 0){n=n||e.clone();const s=Object.assign({},t);s.args=l,n._rules[r]=s,n._singleRules.get(t.name)===t&&n._singleRules.set(t.name,s)}}for(const r in e.$_terms){if(r[0]==="_")continue;const t=d.scan(e.$_terms[r],{source:"terms",name:r},a);t!==void 0&&(n=n||e.clone(),n.$_terms[r]=t)}return n},d.scan=function(e,a,n,r,t){const l=r||[];if(e===null||typeof e!="object")return;let s;if(Array.isArray(e)){for(let i=0;i<e.length;++i){const u=a.source==="terms"&&a.name==="keys"&&e[i].key,f=d.scan(e[i],a,n,[i,...l],u);f!==void 0&&(s=s||e.slice(),s[i]=f)}return s}if(n.schema!==!1&&b.isSchema(e)||n.ref!==!1&&h.isRef(e)){const i=n.each(e,{...a,path:l,key:t});return i===e?void 0:i}for(const i in e){if(i[0]==="_")continue;const u=d.scan(e[i],a,n,[i,...l],t);u!==void 0&&(s=s||Object.assign({},e),s[i]=u)}return s}},6133:(k,w,p)=>{const o=p(375),b=p(8571),h=p(9621),d=p(8160);let e;const a={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};w.create=function(n,r={}){o(typeof n=="string","Invalid reference key:",n),d.assertOptions(r,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),o(!r.prefix||typeof r.prefix=="object","options.prefix must be of type object");const t=Object.assign({},a.defaults,r);delete t.prefix;const l=t.separator,s=a.context(n,l,r.prefix);if(t.type=s.type,n=s.key,t.type==="value")if(s.root&&(o(!l||n[0]!==l,"Cannot specify relative path with root prefix"),t.ancestor="root",n||(n=null)),l&&l===n)n=null,t.ancestor=0;else if(t.ancestor!==void 0)o(!l||!n||n[0]!==l,"Cannot combine prefix with ancestor option");else{const[i,u]=a.ancestor(n,l);u&&(n=n.slice(u))===""&&(n=null),t.ancestor=i}return t.path=l?n===null?[]:n.split(l):[n],new a.Ref(t)},w.in=function(n,r={}){return w.create(n,{...r,in:!0})},w.isRef=function(n){return!!n&&!!n[d.symbols.ref]},a.Ref=class{constructor(n){o(typeof n=="object","Invalid reference construction"),d.assertOptions(n,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),o([!1,void 0].includes(n.separator)||typeof n.separator=="string"&&n.separator.length===1,"Invalid separator"),o(!n.adjust||typeof n.adjust=="function","options.adjust must be a function"),o(!n.map||Array.isArray(n.map),"options.map must be an array"),o(!n.map||!n.adjust,"Cannot set both map and adjust options"),Object.assign(this,a.defaults,n),o(this.type==="value"||this.ancestor===void 0,"Non-value references cannot reference ancestors"),Array.isArray(this.map)&&(this.map=new Map(this.map)),this.depth=this.path.length,this.key=this.path.length?this.path.join(this.separator):null,this.root=this.path[0],this.updateDisplay()}resolve(n,r,t,l,s={}){return o(!this.in||s.in,"Invalid in() reference usage"),this.type==="global"?this._resolve(t.context,r,s):this.type==="local"?this._resolve(l,r,s):this.ancestor?this.ancestor==="root"?this._resolve(r.ancestors[r.ancestors.length-1],r,s):(o(this.ancestor<=r.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(r.ancestors[this.ancestor-1],r,s)):this._resolve(n,r,s)}_resolve(n,r,t){let l;if(this.type==="value"&&r.mainstay.shadow&&t.shadow!==!1&&(l=r.mainstay.shadow.get(this.absolute(r))),l===void 0&&(l=h(n,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(l=this.adjust(l)),this.map){const s=this.map.get(l);s!==void 0&&(l=s)}return r.mainstay&&r.mainstay.tracer.resolve(r,this,l),l}toString(){return this.display}absolute(n){return[...n.path.slice(0,-this.ancestor),...this.path]}clone(){return new a.Ref(this)}describe(){const n={path:this.path};this.type!=="value"&&(n.type=this.type),this.separator!=="."&&(n.separator=this.separator),this.type==="value"&&this.ancestor!==1&&(n.ancestor=this.ancestor),this.map&&(n.map=[...this.map]);for(const r of["adjust","iterables","render"])this[r]!==null&&this[r]!==void 0&&(n[r]=this[r]);return this.in!==!1&&(n.in=!0),{ref:n}}updateDisplay(){const n=this.key!==null?this.key:"";if(this.type!=="value")return void(this.display=`ref:${this.type}:${n}`);if(!this.separator)return void(this.display=`ref:${n}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${n}`);if(this.ancestor==="root")return void(this.display=`ref:root:${n}`);if(this.ancestor===1)return void(this.display=`ref:${n||".."}`);const r=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${r}${n||""}`}},a.Ref.prototype[d.symbols.ref]=!0,w.build=function(n){return(n=Object.assign({},a.defaults,n)).type==="value"&&n.ancestor===void 0&&(n.ancestor=1),new a.Ref(n)},a.context=function(n,r,t={}){if(n=n.trim(),t){const l=t.global===void 0?"$":t.global;if(l!==r&&n.startsWith(l))return{key:n.slice(l.length),type:"global"};const s=t.local===void 0?"#":t.local;if(s!==r&&n.startsWith(s))return{key:n.slice(s.length),type:"local"};const i=t.root===void 0?"/":t.root;if(i!==r&&n.startsWith(i))return{key:n.slice(i.length),type:"value",root:!0}}return{key:n,type:"value"}},a.ancestor=function(n,r){if(!r)return[1,0];if(n[0]!==r)return[1,0];if(n[1]!==r)return[0,1];let t=2;for(;n[t]===r;)++t;return[t-1,t]},w.toSibling=0,w.toParent=1,w.Manager=class{constructor(){this.refs=[]}register(n,r){if(n)if(r=r===void 0?w.toParent:r,Array.isArray(n))for(const t of n)this.register(t,r);else if(d.isSchema(n))for(const t of n._refs.refs)t.ancestor-r>=0&&this.refs.push({ancestor:t.ancestor-r,root:t.root});else w.isRef(n)&&n.type==="value"&&n.ancestor-r>=0&&this.refs.push({ancestor:n.ancestor-r,root:n.root}),e=e||p(3328),e.isTemplate(n)&&this.register(n.refs(),r)}get length(){return this.refs.length}clone(){const n=new w.Manager;return n.refs=b(this.refs),n}reset(){this.refs=[]}roots(){return this.refs.filter(n=>!n.ancestor).map(n=>n.root)}}},3378:(k,w,p)=>{const o=p(5107),b={};b.wrap=o.string().min(1).max(2).allow(!1),w.preferences=o.object({allowUnknown:o.boolean(),abortEarly:o.boolean(),artifacts:o.boolean(),cache:o.boolean(),context:o.object(),convert:o.boolean(),dateFormat:o.valid("date","iso","string","time","utc"),debug:o.boolean(),errors:{escapeHtml:o.boolean(),label:o.valid("path","key",!1),language:[o.string(),o.object().ref()],render:o.boolean(),stack:o.boolean(),wrap:{label:b.wrap,array:b.wrap,string:b.wrap}},externals:o.boolean(),messages:o.object(),noDefaults:o.boolean(),nonEnumerables:o.boolean(),presence:o.valid("required","optional","forbidden"),skipFunctions:o.boolean(),stripUnknown:o.object({arrays:o.boolean(),objects:o.boolean()}).or("arrays","objects").allow(!0,!1),warnings:o.boolean()}).strict(),b.nameRx=/^[a-zA-Z0-9]\w*$/,b.rule=o.object({alias:o.array().items(o.string().pattern(b.nameRx)).single(),args:o.array().items(o.string(),o.object({name:o.string().pattern(b.nameRx).required(),ref:o.boolean(),assert:o.alternatives([o.function(),o.object().schema()]).conditional("ref",{is:!0,then:o.required()}),normalize:o.function(),message:o.string().when("assert",{is:o.function(),then:o.required()})})),convert:o.boolean(),manifest:o.boolean(),method:o.function().allow(!1),multi:o.boolean(),validate:o.function()}),w.extension=o.object({type:o.alternatives([o.string(),o.object().regex()]).required(),args:o.function(),cast:o.object().pattern(b.nameRx,o.object({from:o.function().maxArity(1).required(),to:o.function().minArity(1).maxArity(2).required()})),base:o.object().schema().when("type",{is:o.object().regex(),then:o.forbidden()}),coerce:[o.function().maxArity(3),o.object({method:o.function().maxArity(3).required(),from:o.array().items(o.string()).single()})],flags:o.object().pattern(b.nameRx,o.object({setter:o.string(),default:o.any()})),manifest:{build:o.function().arity(2)},messages:[o.object(),o.string()],modifiers:o.object().pattern(b.nameRx,o.function().minArity(1).maxArity(2)),overrides:o.object().pattern(b.nameRx,o.function()),prepare:o.function().maxArity(3),rebuild:o.function().arity(1),rules:o.object().pattern(b.nameRx,b.rule),terms:o.object().pattern(b.nameRx,o.object({init:o.array().allow(null).required(),manifest:o.object().pattern(/.+/,[o.valid("schema","single"),o.object({mapped:o.object({from:o.string().required(),to:o.string().required()}).required()})])})),validate:o.function().maxArity(3)}).strict(),w.extensions=o.array().items(o.object(),o.function().arity(1)).strict(),b.desc={buffer:o.object({buffer:o.string()}),func:o.object({function:o.function().required(),options:{literal:!0}}),override:o.object({override:!0}),ref:o.object({ref:o.object({type:o.valid("value","global","local"),path:o.array().required(),separator:o.string().length(1).allow(!1),ancestor:o.number().min(0).integer().allow("root"),map:o.array().items(o.array().length(2)).min(1),adjust:o.function(),iterables:o.boolean(),in:o.boolean(),render:o.boolean()}).required()}),regex:o.object({regex:o.string().min(3)}),special:o.object({special:o.valid("deep").required()}),template:o.object({template:o.string().required(),options:o.object()}),value:o.object({value:o.alternatives([o.object(),o.array()]).required()})},b.desc.entity=o.alternatives([o.array().items(o.link("...")),o.boolean(),o.function(),o.number(),o.string(),b.desc.buffer,b.desc.func,b.desc.ref,b.desc.regex,b.desc.special,b.desc.template,b.desc.value,o.link("/")]),b.desc.values=o.array().items(null,o.boolean(),o.function(),o.number().allow(1/0,-1/0),o.string().allow(""),o.symbol(),b.desc.buffer,b.desc.func,b.desc.override,b.desc.ref,b.desc.regex,b.desc.template,b.desc.value),b.desc.messages=o.object().pattern(/.+/,[o.string(),b.desc.template,o.object().pattern(/.+/,[o.string(),b.desc.template])]),w.description=o.object({type:o.string().required(),flags:o.object({cast:o.string(),default:o.any(),description:o.string(),empty:o.link("/"),failover:b.desc.entity,id:o.string(),label:o.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:o.boolean(),unit:o.string()}).unknown(),preferences:{allowUnknown:o.boolean(),abortEarly:o.boolean(),artifacts:o.boolean(),cache:o.boolean(),convert:o.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:o.boolean(),label:["path","key"],language:[o.string(),b.desc.ref],wrap:{label:b.wrap,array:b.wrap}},externals:o.boolean(),messages:b.desc.messages,noDefaults:o.boolean(),nonEnumerables:o.boolean(),presence:["required","optional","forbidden"],skipFunctions:o.boolean(),stripUnknown:o.object({arrays:o.boolean(),objects:o.boolean()}).or("arrays","objects").allow(!0,!1),warnings:o.boolean()},allow:b.desc.values,invalid:b.desc.values,rules:o.array().min(1).items({name:o.string().required(),args:o.object().min(1),keep:o.boolean(),message:[o.string(),b.desc.messages],warn:o.boolean()}),keys:o.object().pattern(/.*/,o.link("/")),link:b.desc.ref}).pattern(/^[a-z]\w*$/,o.any())},493:(k,w,p)=>{const o=p(8571),b=p(9621),h=p(8160),d={value:Symbol("value")};k.exports=d.State=class{constructor(e,a,n){this.path=e,this.ancestors=a,this.mainstay=n.mainstay,this.schemas=n.schemas,this.debug=null}localize(e,a=null,n=null){const r=new d.State(e,a,this);return n&&r.schemas&&(r.schemas=[d.schemas(n),...r.schemas]),r}nest(e,a){const n=new d.State(this.path,this.ancestors,this);return n.schemas=n.schemas&&[d.schemas(e),...n.schemas],n.debug=a,n}shadow(e,a){this.mainstay.shadow=this.mainstay.shadow||new d.Shadow,this.mainstay.shadow.set(this.path,e,a)}snapshot(){this.mainstay.shadow&&(this._snapshot=o(this.mainstay.shadow.node(this.path))),this.mainstay.snapshot()}restore(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.restore()}commit(){this.mainstay.shadow&&(this.mainstay.shadow.override(this.path,this._snapshot),this._snapshot=void 0),this.mainstay.commit()}},d.schemas=function(e){return h.isSchema(e)?{schema:e}:e},d.Shadow=class{constructor(){this._values=null}set(e,a,n){if(!e.length||n==="strip"&&typeof e[e.length-1]=="number")return;this._values=this._values||new Map;let r=this._values;for(let t=0;t<e.length;++t){const l=e[t];let s=r.get(l);s||(s=new Map,r.set(l,s)),r=s}r[d.value]=a}get(e){const a=this.node(e);if(a)return a[d.value]}node(e){if(this._values)return b(this._values,e,{iterables:!0})}override(e,a){if(!this._values)return;const n=e.slice(0,-1),r=e[e.length-1],t=b(this._values,n,{iterables:!0});a?t.set(r,a):t&&t.delete(r)}}},3328:(k,w,p)=>{const o=p(375),b=p(8571),h=p(5277),d=p(1447),e=p(8160),a=p(6354),n=p(6133),r={symbol:Symbol("template"),opens:new Array(1e3).join("\0"),closes:new Array(1e3).join(""),dateFormat:{date:Date.prototype.toDateString,iso:Date.prototype.toISOString,string:Date.prototype.toString,time:Date.prototype.toTimeString,utc:Date.prototype.toUTCString}};k.exports=r.Template=class{constructor(t,l){if(o(typeof t=="string","Template source must be a string"),o(!t.includes("\0")&&!t.includes(""),"Template source cannot contain reserved control characters"),this.source=t,this.rendered=t,this._template=null,l){const{functions:s,...i}=l;this._settings=Object.keys(i).length?b(i):void 0,this._functions=s,this._functions&&(o(Object.keys(this._functions).every(u=>typeof u=="string"),"Functions keys must be strings"),o(Object.values(this._functions).every(u=>typeof u=="function"),"Functions values must be functions"))}else this._settings=void 0,this._functions=void 0;this._parse()}_parse(){if(!this.source.includes("{"))return;const t=r.encode(this.source),l=r.split(t);let s=!1;const i=[],u=l.shift();u&&i.push(u);for(const f of l){const g=f[0]!=="{",_=g?"}":"}}",v=f.indexOf(_);if(v===-1||f[1]==="{"){i.push(`{${r.decode(f)}`);continue}let c=f.slice(g?0:1,v);const m=c[0]===":";m&&(c=c.slice(1));const y=this._ref(r.decode(c),{raw:g,wrapped:m});i.push(y),typeof y!="string"&&(s=!0);const x=f.slice(v+_.length);x&&i.push(r.decode(x))}s?this._template=i:this.rendered=i.join("")}static date(t,l){return r.dateFormat[l.dateFormat].call(t)}describe(t={}){if(!this._settings&&t.compact)return this.source;const l={template:this.source};return this._settings&&(l.options=this._settings),this._functions&&(l.functions=this._functions),l}static build(t){return new r.Template(t.template,t.options||t.functions?{...t.options,functions:t.functions}:void 0)}isDynamic(){return!!this._template}static isTemplate(t){return!!t&&!!t[e.symbols.template]}refs(){if(!this._template)return;const t=[];for(const l of this._template)typeof l!="string"&&t.push(...l.refs);return t}resolve(t,l,s,i){return this._template&&this._template.length===1?this._part(this._template[0],t,l,s,i,{}):this.render(t,l,s,i)}_part(t,...l){return t.ref?t.ref.resolve(...l):t.formula.evaluate(l)}render(t,l,s,i,u={}){if(!this.isDynamic())return this.rendered;const f=[];for(const g of this._template)if(typeof g=="string")f.push(g);else{const _=this._part(g,t,l,s,i,u),v=r.stringify(_,t,l,s,i,u);if(v!==void 0){const c=g.raw||(u.errors&&u.errors.escapeHtml)===!1?v:h(v);f.push(r.wrap(c,g.wrapped&&s.errors.wrap.label))}}return f.join("")}_ref(t,{raw:l,wrapped:s}){const i=[],u=g=>{const _=n.create(g,this._settings);return i.push(_),v=>{const c=_.resolve(...v);return c!==void 0?c:null}};try{const g=this._functions?{...r.functions,...this._functions}:r.functions;var f=new d.Parser(t,{reference:u,functions:g,constants:r.constants})}catch(g){throw g.message=`Invalid template variable "${t}" fails due to: ${g.message}`,g}if(f.single){if(f.single.type==="reference"){const g=i[0];return{ref:g,raw:l,refs:i,wrapped:s||g.type==="local"&&g.key==="label"}}return r.stringify(f.single.value)}return{formula:f,raw:l,refs:i}}toString(){return this.source}},r.Template.prototype[e.symbols.template]=!0,r.Template.prototype.isImmutable=!0,r.encode=function(t){return t.replace(/\\(\{+)/g,(l,s)=>r.opens.slice(0,s.length)).replace(/\\(\}+)/g,(l,s)=>r.closes.slice(0,s.length))},r.decode=function(t){return t.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},r.split=function(t){const l=[];let s="";for(let i=0;i<t.length;++i){const u=t[i];if(u==="{"){let f="";for(;i+1<t.length&&t[i+1]==="{";)f+="{",++i;l.push(s),s=f}else s+=u}return l.push(s),l},r.wrap=function(t,l){return l?l.length===1?`${l}${t}${l}`:`${l[0]}${t}${l[1]}`:t},r.stringify=function(t,l,s,i,u,f={}){const g=typeof t,_=i&&i.errors&&i.errors.wrap||{};let v=!1;if(n.isRef(t)&&t.render&&(v=t.in,t=t.resolve(l,s,i,u,{in:t.in,...f})),t===null)return"null";if(g==="string")return r.wrap(t,f.arrayItems&&_.string);if(g==="number"||g==="function"||g==="symbol")return t.toString();if(g!=="object")return JSON.stringify(t);if(t instanceof Date)return r.Template.date(t,i);if(t instanceof Map){const m=[];for(const[y,x]of t.entries())m.push(`${y.toString()} -> ${x.toString()}`);t=m}if(!Array.isArray(t))return t.toString();const c=[];for(const m of t)c.push(r.stringify(m,l,s,i,u,{arrayItems:!0,...f}));return r.wrap(c.join(", "),!v&&_.array)},r.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},r.functions={if:(t,l,s)=>t?l:s,length:t=>typeof t=="string"?t.length:t&&typeof t=="object"?Array.isArray(t)?t.length:Object.keys(t).length:null,msg(t){const[l,s,i,u,f]=this,g=f.messages;if(!g)return"";const _=a.template(l,g[0],t,s,i)||a.template(l,g[1],t,s,i);return _?_.render(l,s,i,u,f):""},number:t=>typeof t=="number"?t:typeof t=="string"?parseFloat(t):typeof t=="boolean"?t?1:0:t instanceof Date?t.getTime():null}},4946:(k,w,p)=>{const o=p(375),b=p(1687),h=p(8068),d=p(8160),e=p(3292),a=p(6354),n=p(6133),r={};k.exports=h.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:n.toSibling}},args:(t,...l)=>l.length===1&&Array.isArray(l[0])?t.try(...l[0]):t.try(...l),validate(t,l){const{schema:s,error:i,state:u,prefs:f}=l;if(s._flags.match){const _=[],v=[];for(let m=0;m<s.$_terms.matches.length;++m){const y=s.$_terms.matches[m],x=u.nest(y.schema,`match.${m}`);x.snapshot();const S=y.schema.$_validate(t,x,f);S.errors?(v.push(S.errors),x.restore()):(_.push(S.value),x.commit())}if(_.length===0)return{errors:i("alternatives.any",{details:v.map(m=>a.details(m,{override:!1}))})};if(s._flags.match==="one")return _.length===1?{value:_[0]}:{errors:i("alternatives.one")};if(_.length!==s.$_terms.matches.length)return{errors:i("alternatives.all",{details:v.map(m=>a.details(m,{override:!1}))})};const c=m=>m.$_terms.matches.some(y=>y.schema.type==="object"||y.schema.type==="alternatives"&&c(y.schema));return c(s)?{value:_.reduce((m,y)=>b(m,y,{mergeArrays:!1}))}:{value:_[_.length-1]}}const g=[];for(let _=0;_<s.$_terms.matches.length;++_){const v=s.$_terms.matches[_];if(v.schema){const y=u.nest(v.schema,`match.${_}`);y.snapshot();const x=v.schema.$_validate(t,y,f);if(!x.errors)return y.commit(),x;y.restore(),g.push({schema:v.schema,reports:x.errors});continue}const c=v.ref?v.ref.resolve(t,u,f):t,m=v.is?[v]:v.switch;for(let y=0;y<m.length;++y){const x=m[y],{is:S,then:R,otherwise:C}=x,D=`match.${_}${v.switch?"."+y:""}`;if(S.$_match(c,u.nest(S,`${D}.is`),f)){if(R)return R.$_validate(t,u.nest(R,`${D}.then`),f)}else if(C)return C.$_validate(t,u.nest(C,`${D}.otherwise`),f)}}return r.errors(g,l)},rules:{conditional:{method(t,l){o(!this._flags._endedSwitch,"Unreachable condition"),o(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),o(l.break===void 0,"Cannot use break option with alternatives conditional");const s=this.clone(),i=e.when(s,t,l),u=i.is?[i]:i.switch;for(const f of u)if(f.then&&f.otherwise){s.$_setFlag("_endedSwitch",!0,{clone:!1});break}return s.$_terms.matches.push(i),s.$_mutateRebuild()}},match:{method(t){if(o(["any","one","all"].includes(t),"Invalid alternatives match mode",t),t!=="any")for(const l of this.$_terms.matches)o(l.schema,"Cannot combine match mode",t,"with conditional rules");return this.$_setFlag("match",t)}},try:{method(...t){o(t.length,"Missing alternative schemas"),d.verifyFlat(t,"try"),o(!this._flags._endedSwitch,"Unreachable condition");const l=this.clone();for(const s of t)l.$_terms.matches.push({schema:l.$_compile(s)});return l.$_mutateRebuild()}}},overrides:{label(t){return this.$_parent("label",t).$_modify({each:(l,s)=>s.path[0]!=="is"&&typeof l._flags.label!="string"?l.label(t):void 0,ref:!1})}},rebuild(t){t.$_modify({each:l=>{d.isSchema(l)&&l.type==="array"&&t.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(t,l){if(l.matches)for(const s of l.matches){const{schema:i,ref:u,is:f,not:g,then:_,otherwise:v}=s;t=i?t.try(i):u?t.conditional(u,{is:f,then:_,not:g,otherwise:v,switch:s.switch}):t.conditional(f,{then:_,otherwise:v})}return t}},messages:{"alternatives.all":"{{#label}} does not match all of the required types","alternatives.any":"{{#label}} does not match any of the allowed types","alternatives.match":"{{#label}} does not match any of the allowed types","alternatives.one":"{{#label}} matches more than one allowed type","alternatives.types":"{{#label}} must be one of {{#types}}"}}),r.errors=function(t,{error:l,state:s}){if(!t.length)return{errors:l("alternatives.any")};if(t.length===1)return{errors:t[0].reports};const i=new Set,u=[];for(const{reports:f,schema:g}of t){if(f.length>1)return r.unmatched(t,l);const _=f[0];if(_ instanceof a.Report==0)return r.unmatched(t,l);if(_.state.path.length!==s.path.length){u.push({type:g.type,report:_});continue}if(_.code==="any.only"){for(const m of _.local.valids)i.add(m);continue}const[v,c]=_.code.split(".");c!=="base"?u.push({type:g.type,report:_}):_.code==="object.base"?i.add(_.local.type):i.add(v)}return u.length?u.length===1?{errors:u[0].report}:r.unmatched(t,l):{errors:l("alternatives.types",{types:[...i]})}},r.unmatched=function(t,l){const s=[];for(const i of t)s.push(...i.reports);return{errors:l("alternatives.match",a.details(s,{override:!1}))}}},8068:(k,w,p)=>{const o=p(375),b=p(7629),h=p(8160),d=p(6914);k.exports=b.extend({type:"any",flags:{only:{default:!1}},terms:{alterations:{init:null},examples:{init:null},externals:{init:null},metas:{init:[]},notes:{init:[]},shared:{init:null},tags:{init:[]},whens:{init:null}},rules:{custom:{method(e,a){return o(typeof e=="function","Method must be a function"),o(a===void 0||a&&typeof a=="string","Description must be a non-empty string"),this.$_addRule({name:"custom",args:{method:e,description:a}})},validate(e,a,{method:n}){try{return n(e,a)}catch(r){return a.error("any.custom",{error:r})}},args:["method","description"],multi:!0},messages:{method(e){return this.prefs({messages:e})}},shared:{method(e){o(h.isSchema(e)&&e._flags.id,"Schema must be a schema with an id");const a=this.clone();return a.$_terms.shared=a.$_terms.shared||[],a.$_terms.shared.push(e),a.$_mutateRegister(e),a}},warning:{method(e,a){return o(e&&typeof e=="string","Invalid warning code"),this.$_addRule({name:"warning",args:{code:e,local:a},warn:!0})},validate:(e,a,{code:n,local:r})=>a.error(n,r),args:["code","local"],multi:!0}},modifiers:{keep(e,a=!0){e.keep=a},message(e,a){e.message=d.compile(a)},warn(e,a=!0){e.warn=a}},manifest:{build(e,a){for(const n in a){const r=a[n];if(["examples","externals","metas","notes","tags"].includes(n))for(const t of r)e=e[n.slice(0,-1)](t);else if(n!=="alterations")if(n!=="whens"){if(n==="shared")for(const t of r)e=e.shared(t)}else for(const t of r){const{ref:l,is:s,not:i,then:u,otherwise:f,concat:g}=t;e=g?e.concat(g):l?e.when(l,{is:s,not:i,then:u,otherwise:f,switch:t.switch,break:t.break}):e.when(s,{then:u,otherwise:f,break:t.break})}else{const t={};for(const{target:l,adjuster:s}of r)t[l]=s;e=e.alter(t)}}return e}},messages:{"any.custom":"{{#label}} failed custom validation because {{#error.message}}","any.default":"{{#label}} threw an error when running default method","any.failover":"{{#label}} threw an error when running failover method","any.invalid":"{{#label}} contains an invalid value","any.only":'{{#label}} must be {if(#valids.length == 1, "", "one of ")}{{#valids}}',"any.ref":"{{#label}} {{#arg}} references {{:#ref}} which {{#reason}}","any.required":"{{#label}} is required","any.unknown":"{{#label}} is not allowed"}})},546:(k,w,p)=>{const o=p(375),b=p(9474),h=p(9621),d=p(8068),e=p(8160),a=p(3292),n={};k.exports=d.extend({type:"array",flags:{single:{default:!1},sparse:{default:!1}},terms:{items:{init:[],manifest:"schema"},ordered:{init:[],manifest:"schema"},_exclusions:{init:[]},_inclusions:{init:[]},_requireds:{init:[]}},coerce:{from:"object",method(r,{schema:t,state:l,prefs:s}){if(!Array.isArray(r))return;const i=t.$_getRule("sort");return i?n.sort(t,r,i.args.options,l,s):void 0}},validate(r,{schema:t,error:l}){if(!Array.isArray(r)){if(t._flags.single){const s=[r];return s[e.symbols.arraySingle]=!0,{value:s}}return{errors:l("array.base")}}if(t.$_getRule("items")||t.$_terms.externals)return{value:r.slice()}},rules:{has:{method(r){r=this.$_compile(r,{appendPath:!0});const t=this.$_addRule({name:"has",args:{schema:r}});return t.$_mutateRegister(r),t},validate(r,{state:t,prefs:l,error:s},{schema:i}){const u=[r,...t.ancestors];for(let g=0;g<r.length;++g){const _=t.localize([...t.path,g],u,i);if(i.$_match(r[g],_,l))return r}const f=i._flags.label;return f?s("array.hasKnown",{patternLabel:f}):s("array.hasUnknown",null)},multi:!0},items:{method(...r){e.verifyFlat(r,"items");const t=this.$_addRule("items");for(let l=0;l<r.length;++l){const s=e.tryWithPath(()=>this.$_compile(r[l]),l,{append:!0});t.$_terms.items.push(s)}return t.$_mutateRebuild()},validate(r,{schema:t,error:l,state:s,prefs:i,errorsArray:u}){const f=t.$_terms._requireds.slice(),g=t.$_terms.ordered.slice(),_=[...t.$_terms._inclusions,...f],v=!r[e.symbols.arraySingle];delete r[e.symbols.arraySingle];const c=u();let m=r.length;for(let y=0;y<m;++y){const x=r[y];let S=!1,R=!1;const C=v?y:new Number(y),D=[...s.path,C];if(!t._flags.sparse&&x===void 0){if(c.push(l("array.sparse",{key:C,path:D,pos:y,value:void 0},s.localize(D))),i.abortEarly)return c;g.shift();continue}const L=[r,...s.ancestors];for(const T of t.$_terms._exclusions)if(T.$_match(x,s.localize(D,L,T),i,{presence:"ignore"})){if(c.push(l("array.excludes",{pos:y,value:x},s.localize(D))),i.abortEarly)return c;S=!0,g.shift();break}if(S)continue;if(t.$_terms.ordered.length){if(g.length){const T=g.shift(),q=T.$_validate(x,s.localize(D,L,T),i);if(q.errors){if(c.push(...q.errors),i.abortEarly)return c}else if(T._flags.result==="strip")n.fastSplice(r,y),--y,--m;else{if(!t._flags.sparse&&q.value===void 0){if(c.push(l("array.sparse",{key:C,path:D,pos:y,value:void 0},s.localize(D))),i.abortEarly)return c;continue}r[y]=q.value}continue}if(!t.$_terms.items.length){if(c.push(l("array.orderedLength",{pos:y,limit:t.$_terms.ordered.length})),i.abortEarly)return c;break}}const M=[];let F=f.length;for(let T=0;T<F;++T){const q=s.localize(D,L,f[T]);q.snapshot();const N=f[T].$_validate(x,q,i);if(M[T]=N,!N.errors){if(q.commit(),r[y]=N.value,R=!0,n.fastSplice(f,T),--T,--F,!t._flags.sparse&&N.value===void 0&&(c.push(l("array.sparse",{key:C,path:D,pos:y,value:void 0},s.localize(D))),i.abortEarly))return c;break}q.restore()}if(R)continue;const I=i.stripUnknown&&!!i.stripUnknown.arrays||!1;F=_.length;for(const T of _){let q;const N=f.indexOf(T);if(N!==-1)q=M[N];else{const B=s.localize(D,L,T);if(B.snapshot(),q=T.$_validate(x,B,i),!q.errors){B.commit(),T._flags.result==="strip"?(n.fastSplice(r,y),--y,--m):t._flags.sparse||q.value!==void 0?r[y]=q.value:(c.push(l("array.sparse",{key:C,path:D,pos:y,value:void 0},s.localize(D))),S=!0),R=!0;break}B.restore()}if(F===1){if(I){n.fastSplice(r,y),--y,--m,R=!0;break}if(c.push(...q.errors),i.abortEarly)return c;S=!0;break}}if(!S&&(t.$_terms._inclusions.length||t.$_terms._requireds.length)&&!R){if(I){n.fastSplice(r,y),--y,--m;continue}if(c.push(l("array.includes",{pos:y,value:x},s.localize(D))),i.abortEarly)return c}}return f.length&&n.fillMissedErrors(t,c,f,r,s,i),g.length&&(n.fillOrderedErrors(t,c,g,r,s,i),c.length||n.fillDefault(g,r,s,i)),c.length?c:r},priority:!0,manifest:!1},length:{method(r){return this.$_addRule({name:"length",args:{limit:r},operator:"="})},validate:(r,t,{limit:l},{name:s,operator:i,args:u})=>e.compare(r.length,l,i)?r:t.error("array."+s,{limit:u.limit,value:r}),args:[{name:"limit",ref:!0,assert:e.limit,message:"must be a positive integer"}]},max:{method(r){return this.$_addRule({name:"max",method:"length",args:{limit:r},operator:"<="})}},min:{method(r){return this.$_addRule({name:"min",method:"length",args:{limit:r},operator:">="})}},ordered:{method(...r){e.verifyFlat(r,"ordered");const t=this.$_addRule("items");for(let l=0;l<r.length;++l){const s=e.tryWithPath(()=>this.$_compile(r[l]),l,{append:!0});n.validateSingle(s,t),t.$_mutateRegister(s),t.$_terms.ordered.push(s)}return t.$_mutateRebuild()}},single:{method(r){const t=r===void 0||!!r;return o(!t||!this._flags._arrayItems,"Cannot specify single rule when array has array items"),this.$_setFlag("single",t)}},sort:{method(r={}){e.assertOptions(r,["by","order"]);const t={order:r.order||"ascending"};return r.by&&(t.by=a.ref(r.by,{ancestor:0}),o(!t.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:t}})},validate(r,{error:t,state:l,prefs:s,schema:i},{options:u}){const{value:f,errors:g}=n.sort(i,r,u,l,s);if(g)return g;for(let _=0;_<r.length;++_)if(r[_]!==f[_])return t("array.sort",{order:u.order,by:u.by?u.by.key:"value"});return r},convert:!0},sparse:{method(r){const t=r===void 0||!!r;return this._flags.sparse===t?this:(t?this.clone():this.$_addRule("items")).$_setFlag("sparse",t,{clone:!1})}},unique:{method(r,t={}){o(!r||typeof r=="function"||typeof r=="string","comparator must be a function or a string"),e.assertOptions(t,["ignoreUndefined","separator"]);const l={name:"unique",args:{options:t,comparator:r}};if(r)if(typeof r=="string"){const s=e.default(t.separator,".");l.path=s?r.split(s):[r]}else l.comparator=r;return this.$_addRule(l)},validate(r,{state:t,error:l,schema:s},{comparator:i,options:u},{comparator:f,path:g}){const _={string:Object.create(null),number:Object.create(null),undefined:Object.create(null),boolean:Object.create(null),bigint:Object.create(null),object:new Map,function:new Map,custom:new Map},v=f||b,c=u.ignoreUndefined;for(let m=0;m<r.length;++m){const y=g?h(r[m],g):r[m],x=f?_.custom:_[typeof y];if(o(x,"Failed to find unique map container for type",typeof y),x instanceof Map){const S=x.entries();let R;for(;!(R=S.next()).done;)if(v(R.value[0],y)){const C=t.localize([...t.path,m],[r,...t.ancestors]),D={pos:m,value:r[m],dupePos:R.value[1],dupeValue:r[R.value[1]]};return g&&(D.path=i),l("array.unique",D,C)}x.set(y,m)}else{if((!c||y!==void 0)&&x[y]!==void 0){const S={pos:m,value:r[m],dupePos:x[y],dupeValue:r[x[y]]};return g&&(S.path=i),l("array.unique",S,t.localize([...t.path,m],[r,...t.ancestors]))}x[y]=m}}return r},args:["comparator","options"],multi:!0}},cast:{set:{from:Array.isArray,to:(r,t)=>new Set(r)}},rebuild(r){r.$_terms._inclusions=[],r.$_terms._exclusions=[],r.$_terms._requireds=[];for(const t of r.$_terms.items)n.validateSingle(t,r),t._flags.presence==="required"?r.$_terms._requireds.push(t):t._flags.presence==="forbidden"?r.$_terms._exclusions.push(t):r.$_terms._inclusions.push(t);for(const t of r.$_terms.ordered)n.validateSingle(t,r)},manifest:{build:(r,t)=>(t.items&&(r=r.items(...t.items)),t.ordered&&(r=r.ordered(...t.ordered)),r)},messages:{"array.base":"{{#label}} must be an array","array.excludes":"{{#label}} contains an excluded value","array.hasKnown":"{{#label}} does not contain at least one required match for type {:#patternLabel}","array.hasUnknown":"{{#label}} does not contain at least one required match","array.includes":"{{#label}} does not match any of the allowed types","array.includesRequiredBoth":"{{#label}} does not contain {{#knownMisses}} and {{#unknownMisses}} other required value(s)","array.includesRequiredKnowns":"{{#label}} does not contain {{#knownMisses}}","array.includesRequiredUnknowns":"{{#label}} does not contain {{#unknownMisses}} required value(s)","array.length":"{{#label}} must contain {{#limit}} items","array.max":"{{#label}} must contain less than or equal to {{#limit}} items","array.min":"{{#label}} must contain at least {{#limit}} items","array.orderedLength":"{{#label}} must contain at most {{#limit}} items","array.sort":"{{#label}} must be sorted in {#order} order by {{#by}}","array.sort.mismatching":"{{#label}} cannot be sorted due to mismatching types","array.sort.unsupported":"{{#label}} cannot be sorted due to unsupported type {#type}","array.sparse":"{{#label}} must not be a sparse array item","array.unique":"{{#label}} contains a duplicate value"}}),n.fillMissedErrors=function(r,t,l,s,i,u){const f=[];let g=0;for(const _ of l){const v=_._flags.label;v?f.push(v):++g}f.length?g?t.push(r.$_createError("array.includesRequiredBoth",s,{knownMisses:f,unknownMisses:g},i,u)):t.push(r.$_createError("array.includesRequiredKnowns",s,{knownMisses:f},i,u)):t.push(r.$_createError("array.includesRequiredUnknowns",s,{unknownMisses:g},i,u))},n.fillOrderedErrors=function(r,t,l,s,i,u){const f=[];for(const g of l)g._flags.presence==="required"&&f.push(g);f.length&&n.fillMissedErrors(r,t,f,s,i,u)},n.fillDefault=function(r,t,l,s){const i=[];let u=!0;for(let f=r.length-1;f>=0;--f){const g=r[f],_=[t,...l.ancestors],v=g.$_validate(void 0,l.localize(l.path,_,g),s).value;if(u){if(v===void 0)continue;u=!1}i.unshift(v)}i.length&&t.push(...i)},n.fastSplice=function(r,t){let l=t;for(;l<r.length;)r[l++]=r[l];--r.length},n.validateSingle=function(r,t){(r.type==="array"||r._flags._arrayItems)&&(o(!t._flags.single,"Cannot specify array item with single rule enabled"),t.$_setFlag("_arrayItems",!0,{clone:!1}))},n.sort=function(r,t,l,s,i){const u=l.order==="ascending"?1:-1,f=-1*u,g=u,_=(v,c)=>{let m=n.compare(v,c,f,g);if(m!==null||(l.by&&(v=l.by.resolve(v,s,i),c=l.by.resolve(c,s,i)),m=n.compare(v,c,f,g),m!==null))return m;const y=typeof v;if(y!==typeof c)throw r.$_createError("array.sort.mismatching",t,null,s,i);if(y!=="number"&&y!=="string")throw r.$_createError("array.sort.unsupported",t,{type:y},s,i);return y==="number"?(v-c)*u:v<c?f:g};try{return{value:t.slice().sort(_)}}catch(v){return{errors:v}}},n.compare=function(r,t,l,s){return r===t?0:r===void 0?1:t===void 0?-1:r===null?s:t===null?l:null}},4937:(k,w,p)=>{const o=p(375),b=p(8068),h=p(8160),d=p(2036),e={isBool:function(a){return typeof a=="boolean"}};k.exports=b.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(a,{schema:n}){if(typeof a!="boolean"){if(typeof a=="string"){const r=n._flags.sensitive?a:a.toLowerCase();a=r==="true"||r!=="false"&&a}return typeof a!="boolean"&&(a=n.$_terms.truthy&&n.$_terms.truthy.has(a,null,null,!n._flags.sensitive)||(!n.$_terms.falsy||!n.$_terms.falsy.has(a,null,null,!n._flags.sensitive))&&a),{value:a}}},validate(a,{error:n}){if(typeof a!="boolean")return{value:a,errors:n("boolean.base")}},rules:{truthy:{method(...a){h.verifyFlat(a,"truthy");const n=this.clone();n.$_terms.truthy=n.$_terms.truthy||new d;for(let r=0;r<a.length;++r){const t=a[r];o(t!==void 0,"Cannot call truthy with undefined"),n.$_terms.truthy.add(t)}return n}},falsy:{method(...a){h.verifyFlat(a,"falsy");const n=this.clone();n.$_terms.falsy=n.$_terms.falsy||new d;for(let r=0;r<a.length;++r){const t=a[r];o(t!==void 0,"Cannot call falsy with undefined"),n.$_terms.falsy.add(t)}return n}},sensitive:{method(a=!0){return this.$_setFlag("sensitive",a)}}},cast:{number:{from:e.isBool,to:(a,n)=>a?1:0},string:{from:e.isBool,to:(a,n)=>a?"true":"false"}},manifest:{build:(a,n)=>(n.truthy&&(a=a.truthy(...n.truthy)),n.falsy&&(a=a.falsy(...n.falsy)),a)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},7500:(k,w,p)=>{const o=p(375),b=p(8068),h=p(8160),d=p(3328),e={isDate:function(a){return a instanceof Date}};k.exports=b.extend({type:"date",coerce:{from:["number","string"],method:(a,{schema:n})=>({value:e.parse(a,n._flags.format)||a})},validate(a,{schema:n,error:r,prefs:t}){if(a instanceof Date&&!isNaN(a.getTime()))return;const l=n._flags.format;return t.convert&&l&&typeof a=="string"?{value:a,errors:r("date.format",{format:l})}:{value:a,errors:r("date.base")}},rules:{compare:{method:!1,validate(a,n,{date:r},{name:t,operator:l,args:s}){const i=r==="now"?Date.now():r.getTime();return h.compare(a.getTime(),i,l)?a:n.error("date."+t,{limit:s.date,value:a})},args:[{name:"date",ref:!0,normalize:a=>a==="now"?a:e.parse(a),assert:a=>a!==null,message:"must have a valid date format"}]},format:{method(a){return o(["iso","javascript","unix"].includes(a),"Unknown date format",a),this.$_setFlag("format",a)}},greater:{method(a){return this.$_addRule({name:"greater",method:"compare",args:{date:a},operator:">"})}},iso:{method(){return this.format("iso")}},less:{method(a){return this.$_addRule({name:"less",method:"compare",args:{date:a},operator:"<"})}},max:{method(a){return this.$_addRule({name:"max",method:"compare",args:{date:a},operator:"<="})}},min:{method(a){return this.$_addRule({name:"min",method:"compare",args:{date:a},operator:">="})}},timestamp:{method(a="javascript"){return o(["javascript","unix"].includes(a),'"type" must be one of "javascript, unix"'),this.format(a)}}},cast:{number:{from:e.isDate,to:(a,n)=>a.getTime()},string:{from:e.isDate,to:(a,{prefs:n})=>d.date(a,n)}},messages:{"date.base":"{{#label}} must be a valid date","date.format":'{{#label}} must be in {msg("date.format." + #format) || #format} format',"date.greater":"{{#label}} must be greater than {{:#limit}}","date.less":"{{#label}} must be less than {{:#limit}}","date.max":"{{#label}} must be less than or equal to {{:#limit}}","date.min":"{{#label}} must be greater than or equal to {{:#limit}}","date.format.iso":"ISO 8601 date","date.format.javascript":"timestamp or number of milliseconds","date.format.unix":"timestamp or number of seconds"}}),e.parse=function(a,n){if(a instanceof Date)return a;if(typeof a!="string"&&(isNaN(a)||!isFinite(a))||/^\s*$/.test(a))return null;if(n==="iso")return h.isIsoDate(a)?e.date(a.toString()):null;const r=a;if(typeof a=="string"&&/^[+-]?\d+(\.\d+)?$/.test(a)&&(a=parseFloat(a)),n){if(n==="javascript")return e.date(1*a);if(n==="unix")return e.date(1e3*a);if(typeof r=="string")return null}return e.date(a)},e.date=function(a){const n=new Date(a);return isNaN(n.getTime())?null:n}},390:(k,w,p)=>{const o=p(375),b=p(7824);k.exports=b.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(h){return o(Number.isSafeInteger(h)&&h>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:h}})},validate:(h,d,{n:e})=>h.length===e?h:d.error("function.arity",{n:e})},class:{method(){return this.$_addRule("class")},validate:(h,d)=>/^\s*class\s/.test(h.toString())?h:d.error("function.class",{value:h})},minArity:{method(h){return o(Number.isSafeInteger(h)&&h>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:h}})},validate:(h,d,{n:e})=>h.length>=e?h:d.error("function.minArity",{n:e})},maxArity:{method(h){return o(Number.isSafeInteger(h)&&h>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:h}})},validate:(h,d,{n:e})=>h.length<=e?h:d.error("function.maxArity",{n:e})}},messages:{"function.arity":"{{#label}} must have an arity of {{#n}}","function.class":"{{#label}} must be a class","function.maxArity":"{{#label}} must have an arity lesser or equal to {{#n}}","function.minArity":"{{#label}} must have an arity greater or equal to {{#n}}"}})},7824:(k,w,p)=>{const o=p(978),b=p(375),h=p(8571),d=p(3652),e=p(8068),a=p(8160),n=p(3292),r=p(6354),t=p(6133),l=p(3328),s={renameDefaults:{alias:!1,multiple:!1,override:!1}};k.exports=e.extend({type:"_keys",properties:{typeof:"object"},flags:{unknown:{default:void 0}},terms:{dependencies:{init:null},keys:{init:null,manifest:{mapped:{from:"schema",to:"key"}}},patterns:{init:null},renames:{init:null}},args:(i,u)=>i.keys(u),validate(i,{schema:u,error:f,state:g,prefs:_}){if(!i||typeof i!==u.$_property("typeof")||Array.isArray(i))return{value:i,errors:f("object.base",{type:u.$_property("typeof")})};if(!(u.$_terms.renames||u.$_terms.dependencies||u.$_terms.keys||u.$_terms.patterns||u.$_terms.externals))return;i=s.clone(i,_);const v=[];if(u.$_terms.renames&&!s.rename(u,i,g,_,v))return{value:i,errors:v};if(!u.$_terms.keys&&!u.$_terms.patterns&&!u.$_terms.dependencies)return{value:i,errors:v};const c=new Set(Object.keys(i));if(u.$_terms.keys){const m=[i,...g.ancestors];for(const y of u.$_terms.keys){const x=y.key,S=i[x];c.delete(x);const R=g.localize([...g.path,x],m,y),C=y.schema.$_validate(S,R,_);if(C.errors){if(_.abortEarly)return{value:i,errors:C.errors};C.value!==void 0&&(i[x]=C.value),v.push(...C.errors)}else y.schema._flags.result==="strip"||C.value===void 0&&S!==void 0?delete i[x]:C.value!==void 0&&(i[x]=C.value)}}if(c.size||u._flags._hasPatternMatch){const m=s.unknown(u,i,c,v,g,_);if(m)return m}if(u.$_terms.dependencies)for(const m of u.$_terms.dependencies){if(m.key!==null&&s.isPresent(m.options)(m.key.resolve(i,g,_,null,{shadow:!1}))===!1)continue;const y=s.dependencies[m.rel](u,m,i,g,_);if(y){const x=u.$_createError(y.code,i,y.context,g,_);if(_.abortEarly)return{value:i,errors:x};v.push(x)}}return{value:i,errors:v}},rules:{and:{method(...i){return a.verifyFlat(i,"and"),s.dependency(this,"and",null,i)}},append:{method(i){return i==null||Object.keys(i).length===0?this:this.keys(i)}},assert:{method(i,u,f){l.isTemplate(i)||(i=n.ref(i)),b(f===void 0||typeof f=="string","Message must be a string"),u=this.$_compile(u,{appendPath:!0});const g=this.$_addRule({name:"assert",args:{subject:i,schema:u,message:f}});return g.$_mutateRegister(i),g.$_mutateRegister(u),g},validate(i,{error:u,prefs:f,state:g},{subject:_,schema:v,message:c}){const m=_.resolve(i,g,f),y=t.isRef(_)?_.absolute(g):[];return v.$_match(m,g.localize(y,[i,...g.ancestors],v),f)?i:u("object.assert",{subject:_,message:c})},args:["subject","schema","message"],multi:!0},instance:{method(i,u){return b(typeof i=="function","constructor must be a function"),u=u||i.name,this.$_addRule({name:"instance",args:{constructor:i,name:u}})},validate:(i,u,{constructor:f,name:g})=>i instanceof f?i:u.error("object.instance",{type:g,value:i}),args:["constructor","name"]},keys:{method(i){b(i===void 0||typeof i=="object","Object schema must be a valid object"),b(!a.isSchema(i),"Object schema cannot be a joi schema");const u=this.clone();if(i)if(Object.keys(i).length){u.$_terms.keys=u.$_terms.keys?u.$_terms.keys.filter(f=>!i.hasOwnProperty(f.key)):new s.Keys;for(const f in i)a.tryWithPath(()=>u.$_terms.keys.push({key:f,schema:this.$_compile(i[f])}),f)}else u.$_terms.keys=new s.Keys;else u.$_terms.keys=null;return u.$_mutateRebuild()}},length:{method(i){return this.$_addRule({name:"length",args:{limit:i},operator:"="})},validate:(i,u,{limit:f},{name:g,operator:_,args:v})=>a.compare(Object.keys(i).length,f,_)?i:u.error("object."+g,{limit:v.limit,value:i}),args:[{name:"limit",ref:!0,assert:a.limit,message:"must be a positive integer"}]},max:{method(i){return this.$_addRule({name:"max",method:"length",args:{limit:i},operator:"<="})}},min:{method(i){return this.$_addRule({name:"min",method:"length",args:{limit:i},operator:">="})}},nand:{method(...i){return a.verifyFlat(i,"nand"),s.dependency(this,"nand",null,i)}},or:{method(...i){return a.verifyFlat(i,"or"),s.dependency(this,"or",null,i)}},oxor:{method(...i){return s.dependency(this,"oxor",null,i)}},pattern:{method(i,u,f={}){const g=i instanceof RegExp;g||(i=this.$_compile(i,{appendPath:!0})),b(u!==void 0,"Invalid rule"),a.assertOptions(f,["fallthrough","matches"]),g&&b(!i.flags.includes("g")&&!i.flags.includes("y"),"pattern should not use global or sticky mode"),u=this.$_compile(u,{appendPath:!0});const _=this.clone();_.$_terms.patterns=_.$_terms.patterns||[];const v={[g?"regex":"schema"]:i,rule:u};return f.matches&&(v.matches=this.$_compile(f.matches),v.matches.type!=="array"&&(v.matches=v.matches.$_root.array().items(v.matches)),_.$_mutateRegister(v.matches),_.$_setFlag("_hasPatternMatch",!0,{clone:!1})),f.fallthrough&&(v.fallthrough=!0),_.$_terms.patterns.push(v),_.$_mutateRegister(u),_}},ref:{method(){return this.$_addRule("ref")},validate:(i,u)=>t.isRef(i)?i:u.error("object.refType",{value:i})},regex:{method(){return this.$_addRule("regex")},validate:(i,u)=>i instanceof RegExp?i:u.error("object.regex",{value:i})},rename:{method(i,u,f={}){b(typeof i=="string"||i instanceof RegExp,"Rename missing the from argument"),b(typeof u=="string"||u instanceof l,"Invalid rename to argument"),b(u!==i,"Cannot rename key to same name:",i),a.assertOptions(f,["alias","ignoreUndefined","override","multiple"]);const g=this.clone();g.$_terms.renames=g.$_terms.renames||[];for(const _ of g.$_terms.renames)b(_.from!==i,"Cannot rename the same key multiple times");return u instanceof l&&g.$_mutateRegister(u),g.$_terms.renames.push({from:i,to:u,options:o(s.renameDefaults,f)}),g}},schema:{method(i="any"){return this.$_addRule({name:"schema",args:{type:i}})},validate:(i,u,{type:f})=>!a.isSchema(i)||f!=="any"&&i.type!==f?u.error("object.schema",{type:f}):i},unknown:{method(i){return this.$_setFlag("unknown",i!==!1)}},with:{method(i,u,f={}){return s.dependency(this,"with",i,u,f)}},without:{method(i,u,f={}){return s.dependency(this,"without",i,u,f)}},xor:{method(...i){return a.verifyFlat(i,"xor"),s.dependency(this,"xor",null,i)}}},overrides:{default(i,u){return i===void 0&&(i=a.symbols.deepDefault),this.$_parent("default",i,u)}},rebuild(i){if(i.$_terms.keys){const u=new d.Sorter;for(const f of i.$_terms.keys)a.tryWithPath(()=>u.add(f,{after:f.schema.$_rootReferences(),group:f.key}),f.key);i.$_terms.keys=new s.Keys(...u.nodes)}},manifest:{build(i,u){if(u.keys&&(i=i.keys(u.keys)),u.dependencies)for(const{rel:f,key:g=null,peers:_,options:v}of u.dependencies)i=s.dependency(i,f,g,_,v);if(u.patterns)for(const{regex:f,schema:g,rule:_,fallthrough:v,matches:c}of u.patterns)i=i.pattern(f||g,_,{fallthrough:v,matches:c});if(u.renames)for(const{from:f,to:g,options:_}of u.renames)i=i.rename(f,g,_);return i}},messages:{"object.and":"{{#label}} contains {{#presentWithLabels}} without its required peers {{#missingWithLabels}}","object.assert":'{{#label}} is invalid because {if(#subject.key, `"` + #subject.key + `" failed to ` + (#message || "pass the assertion test"), #message || "the assertion failed")}',"object.base":"{{#label}} must be of type {{#type}}","object.instance":"{{#label}} must be an instance of {{:#type}}","object.length":'{{#label}} must have {{#limit}} key{if(#limit == 1, "", "s")}',"object.max":'{{#label}} must have less than or equal to {{#limit}} key{if(#limit == 1, "", "s")}',"object.min":'{{#label}} must have at least {{#limit}} key{if(#limit == 1, "", "s")}',"object.missing":"{{#label}} must contain at least one of {{#peersWithLabels}}","object.nand":"{{:#mainWithLabel}} must not exist simultaneously with {{#peersWithLabels}}","object.oxor":"{{#label}} contains a conflict between optional exclusive peers {{#peersWithLabels}}","object.pattern.match":"{{#label}} keys failed to match pattern requirements","object.refType":"{{#label}} must be a Joi reference","object.regex":"{{#label}} must be a RegExp object","object.rename.multiple":"{{#label}} cannot rename {{:#from}} because multiple renames are disabled and another key was already renamed to {{:#to}}","object.rename.override":"{{#label}} cannot rename {{:#from}} because override is disabled and target {{:#to}} exists","object.schema":"{{#label}} must be a Joi schema of {{#type}} type","object.unknown":"{{#label}} is not allowed","object.with":"{{:#mainWithLabel}} missing required peer {{:#peerWithLabel}}","object.without":"{{:#mainWithLabel}} conflict with forbidden peer {{:#peerWithLabel}}","object.xor":"{{#label}} contains a conflict between exclusive peers {{#peersWithLabels}}"}}),s.clone=function(i,u){if(typeof i=="object"){if(u.nonEnumerables)return h(i,{shallow:!0});const g=Object.create(Object.getPrototypeOf(i));return Object.assign(g,i),g}const f=function(...g){return i.apply(this,g)};return f.prototype=h(i.prototype),Object.defineProperty(f,"name",{value:i.name,writable:!1}),Object.defineProperty(f,"length",{value:i.length,writable:!1}),Object.assign(f,i),f},s.dependency=function(i,u,f,g,_){b(f===null||typeof f=="string",u,"key must be a strings"),_||(_=g.length>1&&typeof g[g.length-1]=="object"?g.pop():{}),a.assertOptions(_,["separator","isPresent"]),g=[].concat(g);const v=a.default(_.separator,"."),c=[];for(const y of g)b(typeof y=="string",u,"peers must be strings"),c.push(n.ref(y,{separator:v,ancestor:0,prefix:!1}));f!==null&&(f=n.ref(f,{separator:v,ancestor:0,prefix:!1}));const m=i.clone();return m.$_terms.dependencies=m.$_terms.dependencies||[],m.$_terms.dependencies.push(new s.Dependency(u,f,c,g,_)),m},s.dependencies={and(i,u,f,g,_){const v=[],c=[],m=u.peers.length,y=s.isPresent(u.options);for(const x of u.peers)y(x.resolve(f,g,_,null,{shadow:!1}))===!1?v.push(x.key):c.push(x.key);if(v.length!==m&&c.length!==m)return{code:"object.and",context:{present:c,presentWithLabels:s.keysToLabels(i,c),missing:v,missingWithLabels:s.keysToLabels(i,v)}}},nand(i,u,f,g,_){const v=[],c=s.isPresent(u.options);for(const x of u.peers)c(x.resolve(f,g,_,null,{shadow:!1}))&&v.push(x.key);if(v.length!==u.peers.length)return;const m=u.paths[0],y=u.paths.slice(1);return{code:"object.nand",context:{main:m,mainWithLabel:s.keysToLabels(i,m),peers:y,peersWithLabels:s.keysToLabels(i,y)}}},or(i,u,f,g,_){const v=s.isPresent(u.options);for(const c of u.peers)if(v(c.resolve(f,g,_,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:u.paths,peersWithLabels:s.keysToLabels(i,u.paths)}}},oxor(i,u,f,g,_){const v=[],c=s.isPresent(u.options);for(const y of u.peers)c(y.resolve(f,g,_,null,{shadow:!1}))&&v.push(y.key);if(!v.length||v.length===1)return;const m={peers:u.paths,peersWithLabels:s.keysToLabels(i,u.paths)};return m.present=v,m.presentWithLabels=s.keysToLabels(i,v),{code:"object.oxor",context:m}},with(i,u,f,g,_){const v=s.isPresent(u.options);for(const c of u.peers)if(v(c.resolve(f,g,_,null,{shadow:!1}))===!1)return{code:"object.with",context:{main:u.key.key,mainWithLabel:s.keysToLabels(i,u.key.key),peer:c.key,peerWithLabel:s.keysToLabels(i,c.key)}}},without(i,u,f,g,_){const v=s.isPresent(u.options);for(const c of u.peers)if(v(c.resolve(f,g,_,null,{shadow:!1})))return{code:"object.without",context:{main:u.key.key,mainWithLabel:s.keysToLabels(i,u.key.key),peer:c.key,peerWithLabel:s.keysToLabels(i,c.key)}}},xor(i,u,f,g,_){const v=[],c=s.isPresent(u.options);for(const y of u.peers)c(y.resolve(f,g,_,null,{shadow:!1}))&&v.push(y.key);if(v.length===1)return;const m={peers:u.paths,peersWithLabels:s.keysToLabels(i,u.paths)};return v.length===0?{code:"object.missing",context:m}:(m.present=v,m.presentWithLabels=s.keysToLabels(i,v),{code:"object.xor",context:m})}},s.keysToLabels=function(i,u){return Array.isArray(u)?u.map(f=>i.$_mapLabels(f)):i.$_mapLabels(u)},s.isPresent=function(i){return typeof i.isPresent=="function"?i.isPresent:u=>u!==void 0},s.rename=function(i,u,f,g,_){const v={};for(const c of i.$_terms.renames){const m=[],y=typeof c.from!="string";if(y)for(const x in u){if(u[x]===void 0&&c.options.ignoreUndefined||x===c.to)continue;const S=c.from.exec(x);S&&m.push({from:x,to:c.to,match:S})}else!Object.prototype.hasOwnProperty.call(u,c.from)||u[c.from]===void 0&&c.options.ignoreUndefined||m.push(c);for(const x of m){const S=x.from;let R=x.to;if(R instanceof l&&(R=R.render(u,f,g,x.match)),S!==R){if(!c.options.multiple&&v[R]&&(_.push(i.$_createError("object.rename.multiple",u,{from:S,to:R,pattern:y},f,g)),g.abortEarly)||Object.prototype.hasOwnProperty.call(u,R)&&!c.options.override&&!v[R]&&(_.push(i.$_createError("object.rename.override",u,{from:S,to:R,pattern:y},f,g)),g.abortEarly))return!1;u[S]===void 0?delete u[R]:u[R]=u[S],v[R]=!0,c.options.alias||delete u[S]}}}return!0},s.unknown=function(i,u,f,g,_,v){if(i.$_terms.patterns){let c=!1;const m=i.$_terms.patterns.map(x=>{if(x.matches)return c=!0,[]}),y=[u,..._.ancestors];for(const x of f){const S=u[x],R=[..._.path,x];for(let C=0;C<i.$_terms.patterns.length;++C){const D=i.$_terms.patterns[C];if(D.regex){const F=D.regex.test(x);if(_.mainstay.tracer.debug(_,"rule",`pattern.${C}`,F?"pass":"error"),!F)continue}else if(!D.schema.$_match(x,_.nest(D.schema,`pattern.${C}`),v))continue;f.delete(x);const L=_.localize(R,y,{schema:D.rule,key:x}),M=D.rule.$_validate(S,L,v);if(M.errors){if(v.abortEarly)return{value:u,errors:M.errors};g.push(...M.errors)}if(D.matches&&m[C].push(x),u[x]=M.value,!D.fallthrough)break}}if(c)for(let x=0;x<m.length;++x){const S=m[x];if(!S)continue;const R=i.$_terms.patterns[x].matches,C=_.localize(_.path,y,R),D=R.$_validate(S,C,v);if(D.errors){const L=r.details(D.errors,{override:!1});L.matches=S;const M=i.$_createError("object.pattern.match",u,L,_,v);if(v.abortEarly)return{value:u,errors:M};g.push(M)}}}if(f.size&&(i.$_terms.keys||i.$_terms.patterns)){if(v.stripUnknown&&i._flags.unknown===void 0||v.skipFunctions){const c=!(!v.stripUnknown||v.stripUnknown!==!0&&!v.stripUnknown.objects);for(const m of f)c?(delete u[m],f.delete(m)):typeof u[m]=="function"&&f.delete(m)}if(!a.default(i._flags.unknown,v.allowUnknown))for(const c of f){const m=_.localize([..._.path,c],[]),y=i.$_createError("object.unknown",u[c],{child:c},m,v,{flags:!1});if(v.abortEarly)return{value:u,errors:y};g.push(y)}}},s.Dependency=class{constructor(i,u,f,g,_){this.rel=i,this.key=u,this.peers=f,this.paths=g,this.options=_}describe(){const i={rel:this.rel,peers:this.paths};return this.key!==null&&(i.key=this.key.key),this.peers[0].separator!=="."&&(i.options={...i.options,separator:this.peers[0].separator}),this.options.isPresent&&(i.options={...i.options,isPresent:this.options.isPresent}),i}},s.Keys=class extends Array{concat(i){const u=this.slice(),f=new Map;for(let g=0;g<u.length;++g)f.set(u[g].key,g);for(const g of i){const _=g.key,v=f.get(_);v!==void 0?u[v]={key:_,schema:u[v].schema.concat(g.schema)}:u.push(g)}return u}}},8785:(k,w,p)=>{const o=p(375),b=p(8068),h=p(8160),d=p(3292),e=p(6354),a={};k.exports=b.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(n,r)=>n.ref(r),validate(n,{schema:r,state:t,prefs:l}){o(r.$_terms.link,"Uninitialized link schema");const s=a.generate(r,n,t,l),i=r.$_terms.link[0].ref;return s.$_validate(n,t.nest(s,`link:${i.display}:${s.type}`),l)},generate:(n,r,t,l)=>a.generate(n,r,t,l),rules:{ref:{method(n){o(!this.$_terms.link,"Cannot reinitialize schema"),n=d.ref(n),o(n.type==="value"||n.type==="local","Invalid reference type:",n.type),o(n.type==="local"||n.ancestor==="root"||n.ancestor>0,"Link cannot reference itself");const r=this.clone();return r.$_terms.link=[{ref:n}],r}},relative:{method(n=!0){return this.$_setFlag("relative",n)}}},overrides:{concat(n){o(this.$_terms.link,"Uninitialized link schema"),o(h.isSchema(n),"Invalid schema object"),o(n.type!=="link","Cannot merge type link with another link");const r=this.clone();return r.$_terms.whens||(r.$_terms.whens=[]),r.$_terms.whens.push({concat:n}),r.$_mutateRebuild()}},manifest:{build:(n,r)=>(o(r.link,"Invalid link description missing link"),n.ref(r.link))}}),a.generate=function(n,r,t,l){let s=t.mainstay.links.get(n);if(s)return s._generate(r,t,l).schema;const i=n.$_terms.link[0].ref,{perspective:u,path:f}=a.perspective(i,t);a.assert(u,"which is outside of schema boundaries",i,n,t,l);try{s=f.length?u.$_reach(f):u}catch{a.assert(!1,"to non-existing schema",i,n,t,l)}return a.assert(s.type!=="link","which is another link",i,n,t,l),n._flags.relative||t.mainstay.links.set(n,s),s._generate(r,t,l).schema},a.perspective=function(n,r){if(n.type==="local"){for(const{schema:t,key:l}of r.schemas){if((t._flags.id||l)===n.path[0])return{perspective:t,path:n.path.slice(1)};if(t.$_terms.shared){for(const s of t.$_terms.shared)if(s._flags.id===n.path[0])return{perspective:s,path:n.path.slice(1)}}}return{perspective:null,path:null}}return n.ancestor==="root"?{perspective:r.schemas[r.schemas.length-1].schema,path:n.path}:{perspective:r.schemas[n.ancestor]&&r.schemas[n.ancestor].schema,path:n.path}},a.assert=function(n,r,t,l,s,i){n||o(!1,`"${e.label(l._flags,s,i)}" contains link reference "${t.display}" ${r}`)}},3832:(k,w,p)=>{const o=p(375),b=p(8068),h=p(8160),d={numberRx:/^\s*[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:e([+-]?\d+))?\s*$/i,precisionRx:/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/,exponentialPartRegex:/[eE][+-]?\d+$/,leadingSignAndZerosRegex:/^[+-]?(0*)?/,dotRegex:/\./,trailingZerosRegex:/0+$/,decimalPlaces(e){const a=e.toString(),n=a.indexOf("."),r=a.indexOf("e");return(n<0?0:(r<0?a.length:r)-n-1)+(r<0?0:Math.max(0,-parseInt(a.slice(r+1))))}};k.exports=b.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:a,error:n}){if(!e.match(d.numberRx))return;e=e.trim();const r={value:parseFloat(e)};if(r.value===0&&(r.value=0),!a._flags.unsafe)if(e.match(/e/i)){if(d.extractSignificantDigits(e)!==d.extractSignificantDigits(String(r.value)))return r.errors=n("number.unsafe"),r}else{const t=r.value.toString();if(t.match(/e/i))return r;if(t!==d.normalizeDecimal(e))return r.errors=n("number.unsafe"),r}return r}},validate(e,{schema:a,error:n,prefs:r}){if(e===1/0||e===-1/0)return{value:e,errors:n("number.infinity")};if(!h.isNumber(e))return{value:e,errors:n("number.base")};const t={value:e};if(r.convert){const l=a.$_getRule("precision");if(l){const s=Math.pow(10,l.args.limit);t.value=Math.round(t.value*s)/s}}return t.value===0&&(t.value=0),!a._flags.unsafe&&(e>Number.MAX_SAFE_INTEGER||e<Number.MIN_SAFE_INTEGER)&&(t.errors=n("number.unsafe")),t},rules:{compare:{method:!1,validate:(e,a,{limit:n},{name:r,operator:t,args:l})=>h.compare(e,n,t)?e:a.error("number."+r,{limit:l.limit,value:e}),args:[{name:"limit",ref:!0,assert:h.isNumber,message:"must be a number"}]},greater:{method(e){return this.$_addRule({name:"greater",method:"compare",args:{limit:e},operator:">"})}},integer:{method(){return this.$_addRule("integer")},validate:(e,a)=>Math.trunc(e)-e==0?e:a.error("number.integer")},less:{method(e){return this.$_addRule({name:"less",method:"compare",args:{limit:e},operator:"<"})}},max:{method(e){return this.$_addRule({name:"max",method:"compare",args:{limit:e},operator:"<="})}},min:{method(e){return this.$_addRule({name:"min",method:"compare",args:{limit:e},operator:">="})}},multiple:{method(e){const a=typeof e=="number"?d.decimalPlaces(e):null,n=Math.pow(10,a);return this.$_addRule({name:"multiple",args:{base:e,baseDecimalPlace:a,pfactor:n}})},validate:(e,a,{base:n,baseDecimalPlace:r,pfactor:t},l)=>d.decimalPlaces(e)>r?a.error("number.multiple",{multiple:l.args.base,value:e}):Math.round(t*e)%Math.round(t*n)==0?e:a.error("number.multiple",{multiple:l.args.base,value:e}),args:[{name:"base",ref:!0,assert:e=>typeof e=="number"&&isFinite(e)&&e>0,message:"must be a positive number"},"baseDecimalPlace","pfactor"],multi:!0},negative:{method(){return this.sign("negative")}},port:{method(){return this.$_addRule("port")},validate:(e,a)=>Number.isSafeInteger(e)&&e>=0&&e<=65535?e:a.error("number.port")},positive:{method(){return this.sign("positive")}},precision:{method(e){return o(Number.isSafeInteger(e),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:e}})},validate(e,a,{limit:n}){const r=e.toString().match(d.precisionRx);return Math.max((r[1]?r[1].length:0)-(r[2]?parseInt(r[2],10):0),0)<=n?e:a.error("number.precision",{limit:n,value:e})},convert:!0},sign:{method(e){return o(["negative","positive"].includes(e),"Invalid sign",e),this.$_addRule({name:"sign",args:{sign:e}})},validate:(e,a,{sign:n})=>n==="negative"&&e<0||n==="positive"&&e>0?e:a.error(`number.${n}`)},unsafe:{method(e=!0){return o(typeof e=="boolean","enabled must be a boolean"),this.$_setFlag("unsafe",e)}}},cast:{string:{from:e=>typeof e=="number",to:(e,a)=>e.toString()}},messages:{"number.base":"{{#label}} must be a number","number.greater":"{{#label}} must be greater than {{#limit}}","number.infinity":"{{#label}} cannot be infinity","number.integer":"{{#label}} must be an integer","number.less":"{{#label}} must be less than {{#limit}}","number.max":"{{#label}} must be less than or equal to {{#limit}}","number.min":"{{#label}} must be greater than or equal to {{#limit}}","number.multiple":"{{#label}} must be a multiple of {{#multiple}}","number.negative":"{{#label}} must be a negative number","number.port":"{{#label}} must be a valid port","number.positive":"{{#label}} must be a positive number","number.precision":"{{#label}} must have no more than {{#limit}} decimal places","number.unsafe":"{{#label}} must be a safe number"}}),d.extractSignificantDigits=function(e){return e.replace(d.exponentialPartRegex,"").replace(d.dotRegex,"").replace(d.trailingZerosRegex,"").replace(d.leadingSignAndZerosRegex,"")},d.normalizeDecimal=function(e){return(e=e.replace(/^\+/,"").replace(/\.0*$/,"").replace(/^(-?)\.([^\.]*)$/,"$10.$2").replace(/^(-?)0+([0-9])/,"$1$2")).includes(".")&&e.endsWith("0")&&(e=e.replace(/0+$/,"")),e==="-0"?"0":e}},8966:(k,w,p)=>{const o=p(7824);k.exports=o.extend({type:"object",cast:{map:{from:b=>b&&typeof b=="object",to:(b,h)=>new Map(Object.entries(b))}}})},7417:(k,w,p)=>{const o=p(375),b=p(5380),h=p(1745),d=p(9959),e=p(6064),a=p(9926),n=p(5752),r=p(8068),t=p(8160),l={tlds:a instanceof Set&&{tlds:{allow:a,deny:null}},base64Regex:{true:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}==|[\w\-]{3}=)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/},false:{true:/^(?:[\w\-]{2}[\w\-]{2})*(?:[\w\-]{2}(==)?|[\w\-]{3}=?)?$/,false:/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}(==)?|[A-Za-z0-9+\/]{3}=?)?$/}},dataUriRegex:/^data:[\w+.-]+\/[\w+.-]+;((charset=[\w-]+|base64),)?(.*)$/,hexRegex:{withPrefix:/^0x[0-9a-f]+$/i,withOptionalPrefix:/^(?:0x)?[0-9a-f]+$/i,withoutPrefix:/^[0-9a-f]+$/i},ipRegex:d.regex({cidr:"forbidden"}).regex,isoDurationRegex:/^P(?!$)(\d+Y)?(\d+M)?(\d+W)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+S)?)?$/,guidBrackets:{"{":"}","[":"]","(":")","":""},guidVersions:{uuidv1:"1",uuidv2:"2",uuidv3:"3",uuidv4:"4",uuidv5:"5",uuidv6:"6",uuidv7:"7",uuidv8:"8"},guidSeparators:new Set([void 0,!0,!1,"-",":"]),normalizationForms:["NFC","NFD","NFKC","NFKD"]};k.exports=r.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(s,{schema:i,state:u,prefs:f}){const g=i.$_getRule("normalize");g&&(s=s.normalize(g.args.form));const _=i.$_getRule("case");_&&(s=_.args.direction==="upper"?s.toLocaleUpperCase():s.toLocaleLowerCase());const v=i.$_getRule("trim");if(v&&v.args.enabled&&(s=s.trim()),i.$_terms.replacements)for(const m of i.$_terms.replacements)s=s.replace(m.pattern,m.replacement);const c=i.$_getRule("hex");if(c&&c.args.options.byteAligned&&s.length%2!=0&&(s=`0${s}`),i.$_getRule("isoDate")){const m=l.isoDate(s);m&&(s=m)}if(i._flags.truncate){const m=i.$_getRule("max");if(m){let y=m.args.limit;if(t.isResolvable(y)&&(y=y.resolve(s,u,f),!t.limit(y)))return{value:s,errors:i.$_createError("any.ref",y,{ref:m.args.limit,arg:"limit",reason:"must be a positive integer"},u,f)};s=s.slice(0,y)}}return{value:s}}},validate(s,{schema:i,error:u}){if(typeof s!="string")return{value:s,errors:u("string.base")};if(s===""){const f=i.$_getRule("min");return f&&f.args.limit===0?void 0:{value:s,errors:u("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(s,i)=>/^[a-zA-Z0-9]+$/.test(s)?s:i.error("string.alphanum")},base64:{method(s={}){return t.assertOptions(s,["paddingRequired","urlSafe"]),s={urlSafe:!1,paddingRequired:!0,...s},o(typeof s.paddingRequired=="boolean","paddingRequired must be boolean"),o(typeof s.urlSafe=="boolean","urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:s}})},validate:(s,i,{options:u})=>l.base64Regex[u.paddingRequired][u.urlSafe].test(s)?s:i.error("string.base64")},case:{method(s){return o(["lower","upper"].includes(s),"Invalid case:",s),this.$_addRule({name:"case",args:{direction:s}})},validate:(s,i,{direction:u})=>u==="lower"&&s===s.toLocaleLowerCase()||u==="upper"&&s===s.toLocaleUpperCase()?s:i.error(`string.${u}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(s,i){let u=s.length,f=0,g=1;for(;u--;){const _=s.charAt(u)*g;f+=_-9*(_>9),g^=3}return f>0&&f%10==0?s:i.error("string.creditCard")}},dataUri:{method(s={}){return t.assertOptions(s,["paddingRequired"]),s={paddingRequired:!0,...s},o(typeof s.paddingRequired=="boolean","paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:s}})},validate(s,i,{options:u}){const f=s.match(l.dataUriRegex);return f&&(!f[2]||f[2]!=="base64"||l.base64Regex[u.paddingRequired].false.test(f[3]))?s:i.error("string.dataUri")}},domain:{method(s){s&&t.assertOptions(s,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const i=l.addressOptions(s);return this.$_addRule({name:"domain",args:{options:s},address:i})},validate:(s,i,u,{address:f})=>b.isValid(s,f)?s:i.error("string.domain")},email:{method(s={}){t.assertOptions(s,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),o(s.multiple===void 0||typeof s.multiple=="boolean","multiple option must be an boolean");const i=l.addressOptions(s),u=new RegExp(`\\s*[${s.separator?e(s.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:s},regex:u,address:i})},validate(s,i,{options:u},{regex:f,address:g}){const _=u.multiple?s.split(f):[s],v=[];for(const c of _)h.isValid(c,g)||v.push(c);return v.length?i.error("string.email",{value:s,invalids:v}):s}},guid:{alias:"uuid",method(s={}){t.assertOptions(s,["version","separator"]);let i="";if(s.version){const g=[].concat(s.version);o(g.length>=1,"version must have at least 1 valid version specified");const _=new Set;for(let v=0;v<g.length;++v){const c=g[v];o(typeof c=="string","version at position "+v+" must be a string");const m=l.guidVersions[c.toLowerCase()];o(m,"version at position "+v+" must be one of "+Object.keys(l.guidVersions).join(", ")),o(!_.has(m),"version at position "+v+" must not be a duplicate"),i+=m,_.add(m)}}o(l.guidSeparators.has(s.separator),'separator must be one of true, false, "-", or ":"');const u=s.separator===void 0?"[:-]?":s.separator===!0?"[:-]":s.separator===!1?"[]?":`\\${s.separator}`,f=new RegExp(`^([\\[{\\(]?)[0-9A-F]{8}(${u})[0-9A-F]{4}\\2?[${i||"0-9A-F"}][0-9A-F]{3}\\2?[${i?"89AB":"0-9A-F"}][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$`,"i");return this.$_addRule({name:"guid",args:{options:s},regex:f})},validate(s,i,u,{regex:f}){const g=f.exec(s);return g?l.guidBrackets[g[1]]!==g[g.length-1]?i.error("string.guid"):s:i.error("string.guid")}},hex:{method(s={}){return t.assertOptions(s,["byteAligned","prefix"]),s={byteAligned:!1,prefix:!1,...s},o(typeof s.byteAligned=="boolean","byteAligned must be boolean"),o(typeof s.prefix=="boolean"||s.prefix==="optional",'prefix must be boolean or "optional"'),this.$_addRule({name:"hex",args:{options:s}})},validate:(s,i,{options:u})=>(u.prefix==="optional"?l.hexRegex.withOptionalPrefix:u.prefix===!0?l.hexRegex.withPrefix:l.hexRegex.withoutPrefix).test(s)?u.byteAligned&&s.length%2!=0?i.error("string.hexAlign"):s:i.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(s,i)=>b.isValid(s,{minDomainSegments:1})||l.ipRegex.test(s)?s:i.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(s={}){t.assertOptions(s,["cidr","version"]);const{cidr:i,versions:u,regex:f}=d.regex(s),g=s.version?u:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:i,version:g}},regex:f})},validate:(s,i,{options:u},{regex:f})=>f.test(s)?s:u.version?i.error("string.ipVersion",{value:s,cidr:u.cidr,version:u.version}):i.error("string.ip",{value:s,cidr:u.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(s,{error:i})=>l.isoDate(s)?s:i("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(s,i)=>l.isoDurationRegex.test(s)?s:i.error("string.isoDuration")},length:{method(s,i){return l.length(this,"length",s,"=",i)},validate(s,i,{limit:u,encoding:f},{name:g,operator:_,args:v}){const c=!f&&s.length;return t.compare(c,u,_)?s:i.error("string."+g,{limit:v.limit,value:s,encoding:f})},args:[{name:"limit",ref:!0,assert:t.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(s,i){return l.length(this,"max",s,"<=",i)},args:["limit","encoding"]},min:{method(s,i){return l.length(this,"min",s,">=",i)},args:["limit","encoding"]},normalize:{method(s="NFC"){return o(l.normalizationForms.includes(s),"normalization form must be one of "+l.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:s}})},validate:(s,{error:i},{form:u})=>s===s.normalize(u)?s:i("string.normalize",{value:s,form:u}),convert:!0},pattern:{alias:"regex",method(s,i={}){o(s instanceof RegExp,"regex must be a RegExp"),o(!s.flags.includes("g")&&!s.flags.includes("y"),"regex should not use global or sticky mode"),typeof i=="string"&&(i={name:i}),t.assertOptions(i,["invert","name"]);const u=["string.pattern",i.invert?".invert":"",i.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:s,options:i},errorCode:u})},validate:(s,i,{regex:u,options:f},{errorCode:g})=>u.test(s)^f.invert?s:i.error(g,{name:f.name,regex:u,value:s}),args:["regex","options"],multi:!0},replace:{method(s,i){typeof s=="string"&&(s=new RegExp(e(s),"g")),o(s instanceof RegExp,"pattern must be a RegExp"),o(typeof i=="string","replacement must be a String");const u=this.clone();return u.$_terms.replacements||(u.$_terms.replacements=[]),u.$_terms.replacements.push({pattern:s,replacement:i}),u}},token:{method(){return this.$_addRule("token")},validate:(s,i)=>/^\w+$/.test(s)?s:i.error("string.token")},trim:{method(s=!0){return o(typeof s=="boolean","enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:s}})},validate:(s,i,{enabled:u})=>u&&s!==s.trim()?i.error("string.trim"):s,convert:!0},truncate:{method(s=!0){return o(typeof s=="boolean","enabled must be a boolean"),this.$_setFlag("truncate",s)}},uppercase:{method(){return this.case("upper")}},uri:{method(s={}){t.assertOptions(s,["allowRelative","allowQuerySquareBrackets","domain","relativeOnly","scheme","encodeUri"]),s.domain&&t.assertOptions(s.domain,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const{regex:i,scheme:u}=n.regex(s),f=s.domain?l.addressOptions(s.domain):null;return this.$_addRule({name:"uri",args:{options:s},regex:i,domain:f,scheme:u})},validate(s,i,{options:u},{regex:f,domain:g,scheme:_}){if(["http:/","https:/"].includes(s))return i.error("string.uri");let v=f.exec(s);if(!v&&i.prefs.convert&&u.encodeUri){const c=encodeURI(s);v=f.exec(c),v&&(s=c)}if(v){const c=v[1]||v[2];return!g||u.allowRelative&&!c||b.isValid(c,g)?s:i.error("string.domain",{value:c})}return u.relativeOnly?i.error("string.uriRelativeOnly"):u.scheme?i.error("string.uriCustomScheme",{scheme:_,value:s}):i.error("string.uri")}}},manifest:{build(s,i){if(i.replacements)for(const{pattern:u,replacement:f}of i.replacements)s=s.replace(u,f);return s}},messages:{"string.alphanum":"{{#label}} must only contain alpha-numeric characters","string.base":"{{#label}} must be a string","string.base64":"{{#label}} must be a valid base64 string","string.creditCard":"{{#label}} must be a credit card","string.dataUri":"{{#label}} must be a valid dataUri string","string.domain":"{{#label}} must contain a valid domain name","string.email":"{{#label}} must be a valid email","string.empty":"{{#label}} is not allowed to be empty","string.guid":"{{#label}} must be a valid GUID","string.hex":"{{#label}} must only contain hexadecimal characters","string.hexAlign":"{{#label}} hex decoded representation must be byte aligned","string.hostname":"{{#label}} must be a valid hostname","string.ip":"{{#label}} must be a valid ip address with a {{#cidr}} CIDR","string.ipVersion":"{{#label}} must be a valid ip address of one of the following versions {{#version}} with a {{#cidr}} CIDR","string.isoDate":"{{#label}} must be in iso format","string.isoDuration":"{{#label}} must be a valid ISO 8601 duration","string.length":"{{#label}} length must be {{#limit}} characters long","string.lowercase":"{{#label}} must only contain lowercase characters","string.max":"{{#label}} length must be less than or equal to {{#limit}} characters long","string.min":"{{#label}} length must be at least {{#limit}} characters long","string.normalize":"{{#label}} must be unicode normalized in the {{#form}} form","string.token":"{{#label}} must only contain alpha-numeric and underscore characters","string.pattern.base":"{{#label}} with value {:[.]} fails to match the required pattern: {{#regex}}","string.pattern.name":"{{#label}} with value {:[.]} fails to match the {{#name}} pattern","string.pattern.invert.base":"{{#label}} with value {:[.]} matches the inverted pattern: {{#regex}}","string.pattern.invert.name":"{{#label}} with value {:[.]} matches the inverted {{#name}} pattern","string.trim":"{{#label}} must not have leading or trailing whitespace","string.uri":"{{#label}} must be a valid uri","string.uriCustomScheme":"{{#label}} must be a valid uri with a scheme matching the {{#scheme}} pattern","string.uriRelativeOnly":"{{#label}} must be a valid relative uri","string.uppercase":"{{#label}} must only contain uppercase characters"}}),l.addressOptions=function(s){if(!s)return l.tlds||s;if(o(s.minDomainSegments===void 0||Number.isSafeInteger(s.minDomainSegments)&&s.minDomainSegments>0,"minDomainSegments must be a positive integer"),o(s.maxDomainSegments===void 0||Number.isSafeInteger(s.maxDomainSegments)&&s.maxDomainSegments>0,"maxDomainSegments must be a positive integer"),s.tlds===!1)return s;if(s.tlds===!0||s.tlds===void 0)return o(l.tlds,"Built-in TLD list disabled"),Object.assign({},s,l.tlds);o(typeof s.tlds=="object","tlds must be true, false, or an object");const i=s.tlds.deny;if(i)return Array.isArray(i)&&(s=Object.assign({},s,{tlds:{deny:new Set(i)}})),o(s.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),o(!s.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),l.validateTlds(s.tlds.deny,"tlds.deny"),s;const u=s.tlds.allow;return u?u===!0?(o(l.tlds,"Built-in TLD list disabled"),Object.assign({},s,l.tlds)):(Array.isArray(u)&&(s=Object.assign({},s,{tlds:{allow:new Set(u)}})),o(s.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),l.validateTlds(s.tlds.allow,"tlds.allow"),s):s},l.validateTlds=function(s,i){for(const u of s)o(b.isValid(u,{minDomainSegments:1,maxDomainSegments:1}),`${i} must contain valid top level domain names`)},l.isoDate=function(s){if(!t.isIsoDate(s))return null;/.*T.*[+-]\d\d$/.test(s)&&(s+="00");const i=new Date(s);return isNaN(i.getTime())?null:i.toISOString()},l.length=function(s,i,u,f,g){return o(!g||!1,"Invalid encoding:",g),s.$_addRule({name:i,method:"length",args:{limit:u,encoding:g},operator:f})}},8826:(k,w,p)=>{const o=p(375),b=p(8068),h={};h.Map=class extends Map{slice(){return new h.Map(this)}},k.exports=b.extend({type:"symbol",terms:{map:{init:new h.Map}},coerce:{method(d,{schema:e,error:a}){const n=e.$_terms.map.get(d);return n&&(d=n),e._flags.only&&typeof d!="symbol"?{value:d,errors:a("symbol.map",{map:e.$_terms.map})}:{value:d}}},validate(d,{error:e}){if(typeof d!="symbol")return{value:d,errors:e("symbol.base")}},rules:{map:{method(d){d&&!d[Symbol.iterator]&&typeof d=="object"&&(d=Object.entries(d)),o(d&&d[Symbol.iterator],"Iterable must be an iterable or object");const e=this.clone(),a=[];for(const n of d){o(n&&n[Symbol.iterator],"Entry must be an iterable");const[r,t]=n;o(typeof r!="object"&&typeof r!="function"&&typeof r!="symbol","Key must not be of type object, function, or Symbol"),o(typeof t=="symbol","Value must be a Symbol"),e.$_terms.map.set(r,t),a.push(t)}return e.valid(...a)}}},manifest:{build:(d,e)=>(e.map&&(d=d.map(e.map)),d)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(k,w,p)=>{const o=p(375),b=p(8571),h=p(738),d=p(9621),e=p(8160),a=p(6354),n=p(493),r={result:Symbol("result")};w.entry=function(t,l,s){let i=e.defaults;s&&(o(s.warnings===void 0,"Cannot override warnings preference in synchronous validation"),o(s.artifacts===void 0,"Cannot override artifacts preference in synchronous validation"),i=e.preferences(e.defaults,s));const u=r.entry(t,l,i);o(!u.mainstay.externals.length,"Schema with external rules must use validateAsync()");const f={value:u.value};return u.error&&(f.error=u.error),u.mainstay.warnings.length&&(f.warning=a.details(u.mainstay.warnings)),u.mainstay.debug&&(f.debug=u.mainstay.debug),u.mainstay.artifacts&&(f.artifacts=u.mainstay.artifacts),f},w.entryAsync=async function(t,l,s){let i=e.defaults;s&&(i=e.preferences(e.defaults,s));const u=r.entry(t,l,i),f=u.mainstay;if(u.error)throw f.debug&&(u.error.debug=f.debug),u.error;if(f.externals.length){let _=u.value;const v=[];for(const c of f.externals){const m=c.state.path,y=c.schema.type==="link"?f.links.get(c.schema):null;let x,S,R=_;const C=m.length?[_]:[],D=m.length?d(t,m):t;if(m.length){x=m[m.length-1];let L=_;for(const M of m.slice(0,-1))L=L[M],C.unshift(L);S=C[0],R=S[x]}try{const L=(F,I)=>(y||c.schema).$_createError(F,R,I,c.state,i),M=await c.method(R,{schema:c.schema,linked:y,state:c.state,prefs:s,original:D,error:L,errorsArray:r.errorsArray,warn:(F,I)=>f.warnings.push((y||c.schema).$_createError(F,R,I,c.state,i)),message:(F,I)=>(y||c.schema).$_createError("external",R,I,c.state,i,{messages:F})});if(M===void 0||M===R)continue;if(M instanceof a.Report){if(f.tracer.log(c.schema,c.state,"rule","external","error"),v.push(M),i.abortEarly)break;continue}if(Array.isArray(M)&&M[e.symbols.errors]){if(f.tracer.log(c.schema,c.state,"rule","external","error"),v.push(...M),i.abortEarly)break;continue}S?(f.tracer.value(c.state,"rule",R,M,"external"),S[x]=M):(f.tracer.value(c.state,"rule",_,M,"external"),_=M)}catch(L){throw i.errors.label&&(L.message+=` (${c.label})`),L}}if(u.value=_,v.length)throw u.error=a.process(v,t,i),f.debug&&(u.error.debug=f.debug),u.error}if(!i.warnings&&!i.debug&&!i.artifacts)return u.value;const g={value:u.value};return f.warnings.length&&(g.warning=a.details(f.warnings)),f.debug&&(g.debug=f.debug),f.artifacts&&(g.artifacts=f.artifacts),g},r.Mainstay=class{constructor(t,l,s){this.externals=[],this.warnings=[],this.tracer=t,this.debug=l,this.links=s,this.shadow=null,this.artifacts=null,this._snapshots=[]}snapshot(){this._snapshots.push({externals:this.externals.slice(),warnings:this.warnings.slice()})}restore(){const t=this._snapshots.pop();this.externals=t.externals,this.warnings=t.warnings}commit(){this._snapshots.pop()}},r.entry=function(t,l,s){const{tracer:i,cleanup:u}=r.tracer(l,s),f=s.debug?[]:null,g=l._ids._schemaChain?new Map:null,_=new r.Mainstay(i,f,g),v=l._ids._schemaChain?[{schema:l}]:null,c=new n([],[],{mainstay:_,schemas:v}),m=w.validate(t,l,c,s);u&&l.$_root.untrace();const y=a.process(m.errors,t,s);return{value:m.value,error:y,mainstay:_}},r.tracer=function(t,l){return t.$_root._tracer?{tracer:t.$_root._tracer._register(t)}:l.debug?(o(t.$_root.trace,"Debug mode not supported"),{tracer:t.$_root.trace()._register(t),cleanup:!0}):{tracer:r.ignore}},w.validate=function(t,l,s,i,u={}){if(l.$_terms.whens&&(l=l._generate(t,s,i).schema),l._preferences&&(i=r.prefs(l,i)),l._cache&&i.cache){const y=l._cache.get(t);if(s.mainstay.tracer.debug(s,"validate","cached",!!y),y)return y}const f=(y,x,S)=>l.$_createError(y,t,x,S||s,i),g={original:t,prefs:i,schema:l,state:s,error:f,errorsArray:r.errorsArray,warn:(y,x,S)=>s.mainstay.warnings.push(f(y,x,S)),message:(y,x)=>l.$_createError("custom",t,x,s,i,{messages:y})};s.mainstay.tracer.entry(l,s);const _=l._definition;if(_.prepare&&t!==void 0&&i.convert){const y=_.prepare(t,g);if(y){if(s.mainstay.tracer.value(s,"prepare",t,y.value),y.errors)return r.finalize(y.value,[].concat(y.errors),g);t=y.value}}if(_.coerce&&t!==void 0&&i.convert&&(!_.coerce.from||_.coerce.from.includes(typeof t))){const y=_.coerce.method(t,g);if(y){if(s.mainstay.tracer.value(s,"coerced",t,y.value),y.errors)return r.finalize(y.value,[].concat(y.errors),g);t=y.value}}const v=l._flags.empty;v&&v.$_match(r.trim(t,l),s.nest(v),e.defaults)&&(s.mainstay.tracer.value(s,"empty",t,void 0),t=void 0);const c=u.presence||l._flags.presence||(l._flags._endedSwitch?null:i.presence);if(t===void 0){if(c==="forbidden")return r.finalize(t,null,g);if(c==="required")return r.finalize(t,[l.$_createError("any.required",t,null,s,i)],g);if(c==="optional"){if(l._flags.default!==e.symbols.deepDefault)return r.finalize(t,null,g);s.mainstay.tracer.value(s,"default",t,{}),t={}}}else if(c==="forbidden")return r.finalize(t,[l.$_createError("any.unknown",t,null,s,i)],g);const m=[];if(l._valids){const y=l._valids.get(t,s,i,l._flags.insensitive);if(y)return i.convert&&(s.mainstay.tracer.value(s,"valids",t,y.value),t=y.value),s.mainstay.tracer.filter(l,s,"valid",y),r.finalize(t,null,g);if(l._flags.only){const x=l.$_createError("any.only",t,{valids:l._valids.values({display:!0})},s,i);if(i.abortEarly)return r.finalize(t,[x],g);m.push(x)}}if(l._invalids){const y=l._invalids.get(t,s,i,l._flags.insensitive);if(y){s.mainstay.tracer.filter(l,s,"invalid",y);const x=l.$_createError("any.invalid",t,{invalids:l._invalids.values({display:!0})},s,i);if(i.abortEarly)return r.finalize(t,[x],g);m.push(x)}}if(_.validate){const y=_.validate(t,g);if(y&&(s.mainstay.tracer.value(s,"base",t,y.value),t=y.value,y.errors)){if(!Array.isArray(y.errors))return m.push(y.errors),r.finalize(t,m,g);if(y.errors.length)return m.push(...y.errors),r.finalize(t,m,g)}}return l._rules.length?r.rules(t,m,g):r.finalize(t,m,g)},r.rules=function(t,l,s){const{schema:i,state:u,prefs:f}=s;for(const g of i._rules){const _=i._definition.rules[g.method];if(_.convert&&f.convert){u.mainstay.tracer.log(i,u,"rule",g.name,"full");continue}let v,c=g.args;if(g._resolve.length){c=Object.assign({},c);for(const y of g._resolve){const x=_.argsByName.get(y),S=c[y].resolve(t,u,f),R=x.normalize?x.normalize(S):S,C=e.validateArg(R,null,x);if(C){v=i.$_createError("any.ref",S,{arg:y,ref:c[y],reason:C},u,f);break}c[y]=R}}v=v||_.validate(t,s,c,g);const m=r.rule(v,g);if(m.errors){if(u.mainstay.tracer.log(i,u,"rule",g.name,"error"),g.warn){u.mainstay.warnings.push(...m.errors);continue}if(f.abortEarly)return r.finalize(t,m.errors,s);l.push(...m.errors)}else u.mainstay.tracer.log(i,u,"rule",g.name,"pass"),u.mainstay.tracer.value(u,"rule",t,m.value,g.name),t=m.value}return r.finalize(t,l,s)},r.rule=function(t,l){return t instanceof a.Report?(r.error(t,l),{errors:[t],value:null}):Array.isArray(t)&&t[e.symbols.errors]?(t.forEach(s=>r.error(s,l)),{errors:t,value:null}):{errors:null,value:t}},r.error=function(t,l){return l.message&&t._setTemplate(l.message),t},r.finalize=function(t,l,s){l=l||[];const{schema:i,state:u,prefs:f}=s;if(l.length){const _=r.default("failover",void 0,l,s);_!==void 0&&(u.mainstay.tracer.value(u,"failover",t,_),t=_,l=[])}if(l.length&&i._flags.error)if(typeof i._flags.error=="function"){l=i._flags.error(l),Array.isArray(l)||(l=[l]);for(const _ of l)o(_ instanceof Error||_ instanceof a.Report,"error() must return an Error object")}else l=[i._flags.error];if(t===void 0){const _=r.default("default",t,l,s);u.mainstay.tracer.value(u,"default",t,_),t=_}if(i._flags.cast&&t!==void 0){const _=i._definition.cast[i._flags.cast];if(_.from(t)){const v=_.to(t,s);u.mainstay.tracer.value(u,"cast",t,v,i._flags.cast),t=v}}if(i.$_terms.externals&&f.externals&&f._externals!==!1)for(const{method:_}of i.$_terms.externals)u.mainstay.externals.push({method:_,schema:i,state:u,label:a.label(i._flags,u,f)});const g={value:t,errors:l.length?l:null};return i._flags.result&&(g.value=i._flags.result==="strip"?void 0:s.original,u.mainstay.tracer.value(u,i._flags.result,t,g.value),u.shadow(t,i._flags.result)),i._cache&&f.cache!==!1&&!i._refs.length&&i._cache.set(s.original,g),t===void 0||g.errors||i._flags.artifact===void 0||(u.mainstay.artifacts=u.mainstay.artifacts||new Map,u.mainstay.artifacts.has(i._flags.artifact)||u.mainstay.artifacts.set(i._flags.artifact,[]),u.mainstay.artifacts.get(i._flags.artifact).push(u.path)),g},r.prefs=function(t,l){const s=l===e.defaults;return s&&t._preferences[e.symbols.prefs]?t._preferences[e.symbols.prefs]:(l=e.preferences(l,t._preferences),s&&(t._preferences[e.symbols.prefs]=l),l)},r.default=function(t,l,s,i){const{schema:u,state:f,prefs:g}=i,_=u._flags[t];if(g.noDefaults||_===void 0)return l;if(f.mainstay.tracer.log(u,f,"rule",t,"full"),!_)return _;if(typeof _=="function"){const v=_.length?[b(f.ancestors[0]),i]:[];try{return _(...v)}catch(c){return void s.push(u.$_createError(`any.${t}`,null,{error:c},f,g))}}return typeof _!="object"?_:_[e.symbols.literal]?_.literal:e.isResolvable(_)?_.resolve(l,f,g):b(_)},r.trim=function(t,l){if(typeof t!="string")return t;const s=l.$_getRule("trim");return s&&s.args.enabled?t.trim():t},r.ignore={active:!1,debug:h,entry:h,filter:h,log:h,resolve:h,value:h},r.errorsArray=function(){const t=[];return t[e.symbols.errors]=!0,t}},2036:(k,w,p)=>{const o=p(375),b=p(9474),h=p(8160),d={};k.exports=d.Values=class{constructor(e,a){this._values=new Set(e),this._refs=new Set(a),this._lowercase=d.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,a){h.isResolvable(e)?this._refs.has(e)||(this._refs.add(e),a&&a.register(e)):this.has(e,null,null,!1)||(this._values.add(e),typeof e=="string"&&this._lowercase.set(e.toLowerCase(),e))}static merge(e,a,n){if(e=e||new d.Values,a){if(a._override)return a.clone();for(const r of[...a._values,...a._refs])e.add(r)}if(n)for(const r of[...n._values,...n._refs])e.remove(r);return e.length?e:null}remove(e){h.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),typeof e=="string"&&this._lowercase.delete(e.toLowerCase()))}has(e,a,n,r){return!!this.get(e,a,n,r)}get(e,a,n,r){if(!this.length)return!1;if(this._values.has(e))return{value:e};if(typeof e=="string"&&e&&r){const t=this._lowercase.get(e.toLowerCase());if(t)return{value:t}}if(!this._refs.size&&typeof e!="object")return!1;if(typeof e=="object"){for(const t of this._values)if(b(t,e))return{value:t}}if(a)for(const t of this._refs){const l=t.resolve(e,a,n,null,{in:!0});if(l===void 0)continue;const s=t.in&&typeof l=="object"?Array.isArray(l)?l:Object.keys(l):[l];for(const i of s)if(typeof i==typeof e){if(r&&e&&typeof e=="string"){if(i.toLowerCase()===e.toLowerCase())return{value:i,ref:t}}else if(b(i,e))return{value:i,ref:t}}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const a=[];for(const n of[...this._values,...this._refs])n!==void 0&&a.push(n);return a}return Array.from([...this._values,...this._refs])}clone(){const e=new d.Values(this._values,this._refs);return e._override=this._override,e}concat(e){o(!e._override,"Cannot concat override set of values");const a=new d.Values([...this._values,...e._values],[...this._refs,...e._refs]);return a._override=this._override,a}describe(){const e=[];this._override&&e.push({override:!0});for(const a of this._values.values())e.push(a&&typeof a=="object"?{value:a}:a);for(const a of this._refs.values())e.push(a.describe());return e}},d.Values.prototype[h.symbols.values]=!0,d.Values.prototype.slice=d.Values.prototype.clone,d.lowercases=function(e){const a=new Map;if(e)for(const n of e)typeof n=="string"&&a.set(n.toLowerCase(),n);return a}},978:(k,w,p)=>{const o=p(375),b=p(8571),h=p(1687),d=p(9621),e={};k.exports=function(a,n,r={}){if(o(a&&typeof a=="object","Invalid defaults value: must be an object"),o(!n||n===!0||typeof n=="object","Invalid source value: must be true, falsy or an object"),o(typeof r=="object","Invalid options: must be an object"),!n)return null;if(r.shallow)return e.applyToDefaultsWithShallow(a,n,r);const t=b(a);if(n===!0)return t;const l=r.nullOverride!==void 0&&r.nullOverride;return h(t,n,{nullOverride:l,mergeArrays:!1})},e.applyToDefaultsWithShallow=function(a,n,r){const t=r.shallow;o(Array.isArray(t),"Invalid keys");const l=new Map,s=n===!0?null:new Set;for(let f of t){f=Array.isArray(f)?f:f.split(".");const g=d(a,f);g&&typeof g=="object"?l.set(g,s&&d(n,f)||g):s&&s.add(f)}const i=b(a,{},l);if(!s)return i;for(const f of s)e.reachCopy(i,n,f);const u=r.nullOverride!==void 0&&r.nullOverride;return h(i,n,{nullOverride:u,mergeArrays:!1})},e.reachCopy=function(a,n,r){for(const s of r){if(!(s in n))return;const i=n[s];if(typeof i!="object"||i===null)return;n=i}const t=n;let l=a;for(let s=0;s<r.length-1;++s){const i=r[s];typeof l[i]!="object"&&(l[i]={}),l=l[i]}l[r[r.length-1]]=t}},375:(k,w,p)=>{const o=p(7916);k.exports=function(b,...h){if(!b)throw h.length===1&&h[0]instanceof Error?h[0]:new o(h)}},8571:(k,w,p)=>{const o=p(9621),b=p(4277),h=p(7043),d={needsProtoHack:new Set([b.set,b.map,b.weakSet,b.weakMap])};k.exports=d.clone=function(e,a={},n=null){if(typeof e!="object"||e===null)return e;let r=d.clone,t=n;if(a.shallow){if(a.shallow!==!0)return d.cloneWithShallow(e,a);r=u=>u}else if(t){const u=t.get(e);if(u)return u}else t=new Map;const l=b.getInternalProto(e);if(l===b.buffer)return!1;if(l===b.date)return new Date(e.getTime());if(l===b.regex)return new RegExp(e);const s=d.base(e,l,a);if(s===e)return e;if(t&&t.set(e,s),l===b.set)for(const u of e)s.add(r(u,a,t));else if(l===b.map)for(const[u,f]of e)s.set(u,r(f,a,t));const i=h.keys(e,a);for(const u of i){if(u==="__proto__")continue;if(l===b.array&&u==="length"){s.length=e.length;continue}const f=Object.getOwnPropertyDescriptor(e,u);f?f.get||f.set?Object.defineProperty(s,u,f):f.enumerable?s[u]=r(e[u],a,t):Object.defineProperty(s,u,{enumerable:!1,writable:!0,configurable:!0,value:r(e[u],a,t)}):Object.defineProperty(s,u,{enumerable:!0,writable:!0,configurable:!0,value:r(e[u],a,t)})}return s},d.cloneWithShallow=function(e,a){const n=a.shallow;(a=Object.assign({},a)).shallow=!1;const r=new Map;for(const t of n){const l=o(e,t);typeof l!="object"&&typeof l!="function"||r.set(l,l)}return d.clone(e,a,r)},d.base=function(e,a,n){if(n.prototype===!1)return d.needsProtoHack.has(a)?new a.constructor:a===b.array?[]:{};const r=Object.getPrototypeOf(e);if(r&&r.isImmutable)return e;if(a===b.array){const t=[];return r!==a&&Object.setPrototypeOf(t,r),t}if(d.needsProtoHack.has(a)){const t=new r.constructor;return r!==a&&Object.setPrototypeOf(t,r),t}return Object.create(r)}},9474:(k,w,p)=>{const o=p(4277),b={mismatched:null};k.exports=function(h,d,e){return e=Object.assign({prototype:!0},e),!!b.isDeepEqual(h,d,e,[])},b.isDeepEqual=function(h,d,e,a){if(h===d)return h!==0||1/h==1/d;const n=typeof h;if(n!==typeof d||h===null||d===null)return!1;if(n==="function"){if(!e.deepFunction||h.toString()!==d.toString())return!1}else if(n!=="object")return h!=h&&d!=d;const r=b.getSharedType(h,d,!!e.prototype);switch(r){case o.buffer:return!1;case o.promise:return h===d;case o.regex:return h.toString()===d.toString();case b.mismatched:return!1}for(let t=a.length-1;t>=0;--t)if(a[t].isSame(h,d))return!0;a.push(new b.SeenEntry(h,d));try{return!!b.isDeepEqualObj(r,h,d,e,a)}finally{a.pop()}},b.getSharedType=function(h,d,e){if(e)return Object.getPrototypeOf(h)!==Object.getPrototypeOf(d)?b.mismatched:o.getInternalProto(h);const a=o.getInternalProto(h);return a!==o.getInternalProto(d)?b.mismatched:a},b.valueOf=function(h){const d=h.valueOf;if(d===void 0)return h;try{return d.call(h)}catch(e){return e}},b.hasOwnEnumerableProperty=function(h,d){return Object.prototype.propertyIsEnumerable.call(h,d)},b.isSetSimpleEqual=function(h,d){for(const e of Set.prototype.values.call(h))if(!Set.prototype.has.call(d,e))return!1;return!0},b.isDeepEqualObj=function(h,d,e,a,n){const{isDeepEqual:r,valueOf:t,hasOwnEnumerableProperty:l}=b,{keys:s,getOwnPropertySymbols:i}=Object;if(h===o.array){if(!a.part){if(d.length!==e.length)return!1;for(let v=0;v<d.length;++v)if(!r(d[v],e[v],a,n))return!1;return!0}for(const v of d)for(const c of e)if(r(v,c,a,n))return!0}else if(h===o.set){if(d.size!==e.size)return!1;if(!b.isSetSimpleEqual(d,e)){const v=new Set(Set.prototype.values.call(e));for(const c of Set.prototype.values.call(d)){if(v.delete(c))continue;let m=!1;for(const y of v)if(r(c,y,a,n)){v.delete(y),m=!0;break}if(!m)return!1}}}else if(h===o.map){if(d.size!==e.size)return!1;for(const[v,c]of Map.prototype.entries.call(d))if(c===void 0&&!Map.prototype.has.call(e,v)||!r(c,Map.prototype.get.call(e,v),a,n))return!1}else if(h===o.error&&(d.name!==e.name||d.message!==e.message))return!1;const u=t(d),f=t(e);if((d!==u||e!==f)&&!r(u,f,a,n))return!1;const g=s(d);if(!a.part&&g.length!==s(e).length&&!a.skip)return!1;let _=0;for(const v of g)if(a.skip&&a.skip.includes(v))e[v]===void 0&&++_;else if(!l(e,v)||!r(d[v],e[v],a,n))return!1;if(!a.part&&g.length-_!==s(e).length)return!1;if(a.symbols!==!1){const v=i(d),c=new Set(i(e));for(const m of v){if(!a.skip||!a.skip.includes(m)){if(l(d,m)){if(!l(e,m)||!r(d[m],e[m],a,n))return!1}else if(l(e,m))return!1}c.delete(m)}for(const m of c)if(l(e,m))return!1}return!0},b.SeenEntry=class{constructor(h,d){this.obj=h,this.ref=d}isSame(h,d){return this.obj===h&&this.ref===d}}},7916:(k,w,p)=>{const o=p(8761);k.exports=class extends Error{constructor(b){super(b.filter(h=>h!=="").map(h=>typeof h=="string"?h:h instanceof Error?h.message:o(h)).join(" ")||"Unknown error"),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,w.assert)}}},5277:k=>{const w={};k.exports=function(p){if(!p)return"";let o="";for(let b=0;b<p.length;++b){const h=p.charCodeAt(b);w.isSafe(h)?o+=p[b]:o+=w.escapeHtmlChar(h)}return o},w.escapeHtmlChar=function(p){return w.namedHtml.get(p)||(p>=256?"&#"+p+";":`&#x${p.toString(16).padStart(2,"0")};`)},w.isSafe=function(p){return w.safeCharCodes.has(p)},w.namedHtml=new Map([[38,"&amp;"],[60,"&lt;"],[62,"&gt;"],[34,"&quot;"],[160,"&nbsp;"],[162,"&cent;"],[163,"&pound;"],[164,"&curren;"],[169,"&copy;"],[174,"&reg;"]]),w.safeCharCodes=function(){const p=new Set;for(let o=32;o<123;++o)(o>=97||o>=65&&o<=90||o>=48&&o<=57||o===32||o===46||o===44||o===45||o===58||o===95)&&p.add(o);return p}()},6064:k=>{k.exports=function(w){return w.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},738:k=>{k.exports=function(){}},1687:(k,w,p)=>{const o=p(375),b=p(8571),h=p(7043),d={};k.exports=d.merge=function(e,a,n){if(o(e&&typeof e=="object","Invalid target value: must be an object"),o(a==null||typeof a=="object","Invalid source value: must be null, undefined, or an object"),!a)return e;if(n=Object.assign({nullOverride:!0,mergeArrays:!0},n),Array.isArray(a)){o(Array.isArray(e),"Cannot merge array onto an object"),n.mergeArrays||(e.length=0);for(let t=0;t<a.length;++t)e.push(b(a[t],{symbols:n.symbols}));return e}const r=h.keys(a,n);for(let t=0;t<r.length;++t){const l=r[t];if(l==="__proto__"||!Object.prototype.propertyIsEnumerable.call(a,l))continue;const s=a[l];if(s&&typeof s=="object"){if(e[l]===s)continue;!e[l]||typeof e[l]!="object"||Array.isArray(e[l])!==Array.isArray(s)||s instanceof Date||s instanceof RegExp?e[l]=b(s,{symbols:n.symbols}):d.merge(e[l],s,n)}else(s!=null||n.nullOverride)&&(e[l]=s)}return e}},9621:(k,w,p)=>{const o=p(375),b={};k.exports=function(h,d,e){if(d===!1||d==null)return h;typeof(e=e||{})=="string"&&(e={separator:e});const a=Array.isArray(d);o(!a||!e.separator,"Separator option is not valid for array-based chain");const n=a?d:d.split(e.separator||".");let r=h;for(let t=0;t<n.length;++t){let l=n[t];const s=e.iterables&&b.iterables(r);if(Array.isArray(r)||s==="set"){const i=Number(l);Number.isInteger(i)&&(l=i<0?r.length+i:i)}if(!r||typeof r=="function"&&e.functions===!1||!s&&r[l]===void 0){o(!e.strict||t+1===n.length,"Missing segment",l,"in reach path ",d),o(typeof r=="object"||e.functions===!0||typeof r!="function","Invalid segment",l,"in reach path ",d),r=e.default;break}r=s?s==="set"?[...r][l]:r.get(l):r[l]}return r},b.iterables=function(h){return h instanceof Set?"set":h instanceof Map?"map":void 0}},8761:k=>{k.exports=function(...w){try{return JSON.stringify(...w)}catch(p){return"[Cannot display object: "+p.message+"]"}}},4277:(k,w)=>{const p={};w=k.exports={array:Array.prototype,buffer:!1,date:Date.prototype,error:Error.prototype,generic:Object.prototype,map:Map.prototype,promise:Promise.prototype,regex:RegExp.prototype,set:Set.prototype,weakMap:WeakMap.prototype,weakSet:WeakSet.prototype},p.typeMap=new Map([["[object Error]",w.error],["[object Map]",w.map],["[object Promise]",w.promise],["[object Set]",w.set],["[object WeakMap]",w.weakMap],["[object WeakSet]",w.weakSet]]),w.getInternalProto=function(o){if(Array.isArray(o))return w.array;if(o instanceof Date)return w.date;if(o instanceof RegExp)return w.regex;if(o instanceof Error)return w.error;const b=Object.prototype.toString.call(o);return p.typeMap.get(b)||w.generic}},7043:(k,w)=>{w.keys=function(p,o={}){return o.symbols!==!1?Reflect.ownKeys(p):Object.getOwnPropertyNames(p)}},3652:(k,w,p)=>{const o=p(375),b={};w.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(h,d){const e=[].concat((d=d||{}).before||[]),a=[].concat(d.after||[]),n=d.group||"?",r=d.sort||0;o(!e.includes(n),`Item cannot come before itself: ${n}`),o(!e.includes("?"),"Item cannot come before unassociated items"),o(!a.includes(n),`Item cannot come after itself: ${n}`),o(!a.includes("?"),"Item cannot come after unassociated items"),Array.isArray(h)||(h=[h]);for(const t of h){const l={seq:this._items.length,sort:r,before:e,after:a,group:n,node:t};this._items.push(l)}if(!d.manual){const t=this._sort();o(t,"item",n!=="?"?`added into group ${n}`:"","created a dependencies error")}return this.nodes}merge(h){Array.isArray(h)||(h=[h]);for(const e of h)if(e)for(const a of e._items)this._items.push(Object.assign({},a));this._items.sort(b.mergeSort);for(let e=0;e<this._items.length;++e)this._items[e].seq=e;const d=this._sort();return o(d,"merge created a dependencies error"),this.nodes}sort(){const h=this._sort();return o(h,"sort created a dependencies error"),this.nodes}_sort(){const h={},d=Object.create(null),e=Object.create(null);for(const l of this._items){const s=l.seq,i=l.group;e[i]=e[i]||[],e[i].push(s),h[s]=l.before;for(const u of l.after)d[u]=d[u]||[],d[u].push(s)}for(const l in h){const s=[];for(const i in h[l]){const u=h[l][i];e[u]=e[u]||[],s.push(...e[u])}h[l]=s}for(const l in d)if(e[l])for(const s of e[l])h[s].push(...d[l]);const a={};for(const l in h){const s=h[l];for(const i of s)a[i]=a[i]||[],a[i].push(l)}const n={},r=[];for(let l=0;l<this._items.length;++l){let s=l;if(a[l]){s=null;for(let i=0;i<this._items.length;++i){if(n[i]===!0)continue;a[i]||(a[i]=[]);const u=a[i].length;let f=0;for(let g=0;g<u;++g)n[a[i][g]]&&++f;if(f===u){s=i;break}}}s!==null&&(n[s]=!0,r.push(s))}if(r.length!==this._items.length)return!1;const t={};for(const l of this._items)t[l.seq]=l;this._items=[],this.nodes=[];for(const l of r){const s=t[l];this.nodes.push(s.node),this._items.push(s)}return!0}},b.mergeSort=(h,d)=>h.sort===d.sort?0:h.sort<d.sort?-1:1},5380:(k,w,p)=>{const o=p(443),b=p(2178),h={minDomainSegments:2,nonAsciiRx:/[^\x00-\x7f]/,domainControlRx:/[\x00-\x20@\:\/\\#!\$&\'\(\)\*\+,;=\?]/,tldSegmentRx:/^[a-zA-Z](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,domainSegmentRx:/^[a-zA-Z0-9](?:[a-zA-Z0-9\-]*[a-zA-Z0-9])?$/,URL:o.URL||URL};w.analyze=function(d,e={}){if(!d)return b.code("DOMAIN_NON_EMPTY_STRING");if(typeof d!="string")throw new Error("Invalid input: domain must be a string");if(d.length>256)return b.code("DOMAIN_TOO_LONG");if(h.nonAsciiRx.test(d)){if(e.allowUnicode===!1)return b.code("DOMAIN_INVALID_UNICODE_CHARS");d=d.normalize("NFC")}if(h.domainControlRx.test(d))return b.code("DOMAIN_INVALID_CHARS");d=h.punycode(d),e.allowFullyQualified&&d[d.length-1]==="."&&(d=d.slice(0,-1));const a=e.minDomainSegments||h.minDomainSegments,n=d.split(".");if(n.length<a)return b.code("DOMAIN_SEGMENTS_COUNT");if(e.maxDomainSegments&&n.length>e.maxDomainSegments)return b.code("DOMAIN_SEGMENTS_COUNT_MAX");const r=e.tlds;if(r){const t=n[n.length-1].toLowerCase();if(r.deny&&r.deny.has(t)||r.allow&&!r.allow.has(t))return b.code("DOMAIN_FORBIDDEN_TLDS")}for(let t=0;t<n.length;++t){const l=n[t];if(!l.length)return b.code("DOMAIN_EMPTY_SEGMENT");if(l.length>63)return b.code("DOMAIN_LONG_SEGMENT");if(t<n.length-1){if(!h.domainSegmentRx.test(l))return b.code("DOMAIN_INVALID_CHARS")}else if(!h.tldSegmentRx.test(l))return b.code("DOMAIN_INVALID_TLDS_CHARS")}return null},w.isValid=function(d,e){return!w.analyze(d,e)},h.punycode=function(d){d.includes("%")&&(d=d.replace(/%/g,"%25"));try{return new h.URL(`http://${d}`).host}catch{return d}}},1745:(k,w,p)=>{const o=p(9848),b=p(5380),h=p(2178),d={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(o.TextEncoder||TextEncoder)};w.analyze=function(e,a){return d.email(e,a)},w.isValid=function(e,a){return!d.email(e,a)},d.email=function(e,a={}){if(typeof e!="string")throw new Error("Invalid input: email must be a string");if(!e)return h.code("EMPTY_STRING");const n=!d.nonAsciiRx.test(e);if(!n){if(a.allowUnicode===!1)return h.code("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const r=e.split("@");if(r.length!==2)return r.length>2?h.code("MULTIPLE_AT_CHAR"):h.code("MISSING_AT_CHAR");const[t,l]=r;if(!t)return h.code("EMPTY_LOCAL");if(!a.ignoreLength){if(e.length>254)return h.code("ADDRESS_TOO_LONG");if(d.encoder.encode(t).length>64)return h.code("LOCAL_TOO_LONG")}return d.local(t,n)||b.analyze(l,a)},d.local=function(e,a){const n=e.split(".");for(const r of n){if(!r.length)return h.code("EMPTY_LOCAL_SEGMENT");if(a){if(!d.atextRx.test(r))return h.code("INVALID_LOCAL_CHARS")}else for(const t of r){if(d.atextRx.test(t))continue;const l=d.binary(t);if(!d.atomRx.test(l))return h.code("INVALID_LOCAL_CHARS")}}},d.binary=function(e){return Array.from(d.encoder.encode(e)).map(a=>String.fromCharCode(a)).join("")},d.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,d.atomRx=new RegExp(["(?:[\\xc2-\\xdf][\\x80-\\xbf])","(?:\\xe0[\\xa0-\\xbf][\\x80-\\xbf])|(?:[\\xe1-\\xec][\\x80-\\xbf]{2})|(?:\\xed[\\x80-\\x9f][\\x80-\\xbf])|(?:[\\xee-\\xef][\\x80-\\xbf]{2})","(?:\\xf0[\\x90-\\xbf][\\x80-\\xbf]{2})|(?:[\\xf1-\\xf3][\\x80-\\xbf]{3})|(?:\\xf4[\\x80-\\x8f][\\x80-\\xbf]{2})"].join("|"))},2178:(k,w)=>{w.codes={EMPTY_STRING:"Address must be a non-empty string",FORBIDDEN_UNICODE:"Address contains forbidden Unicode characters",MULTIPLE_AT_CHAR:"Address cannot contain more than one @ character",MISSING_AT_CHAR:"Address must contain one @ character",EMPTY_LOCAL:"Address local part cannot be empty",ADDRESS_TOO_LONG:"Address too long",LOCAL_TOO_LONG:"Address local part too long",EMPTY_LOCAL_SEGMENT:"Address local part contains empty dot-separated segment",INVALID_LOCAL_CHARS:"Address local part contains invalid character",DOMAIN_NON_EMPTY_STRING:"Domain must be a non-empty string",DOMAIN_TOO_LONG:"Domain too long",DOMAIN_INVALID_UNICODE_CHARS:"Domain contains forbidden Unicode characters",DOMAIN_INVALID_CHARS:"Domain contains invalid character",DOMAIN_INVALID_TLDS_CHARS:"Domain contains invalid tld character",DOMAIN_SEGMENTS_COUNT:"Domain lacks the minimum required number of segments",DOMAIN_SEGMENTS_COUNT_MAX:"Domain contains too many segments",DOMAIN_FORBIDDEN_TLDS:"Domain uses forbidden TLD",DOMAIN_EMPTY_SEGMENT:"Domain contains empty dot-separated segment",DOMAIN_LONG_SEGMENT:"Domain contains dot-separated segment that is too long"},w.code=function(p){return{code:p,error:w.codes[p]}}},9959:(k,w,p)=>{const o=p(375),b=p(5752);w.regex=function(h={}){o(h.cidr===void 0||typeof h.cidr=="string","options.cidr must be a string");const d=h.cidr?h.cidr.toLowerCase():"optional";o(["required","optional","forbidden"].includes(d),"options.cidr must be one of required, optional, forbidden"),o(h.version===void 0||typeof h.version=="string"||Array.isArray(h.version),"options.version must be a string or an array of string");let e=h.version||["ipv4","ipv6","ipvfuture"];Array.isArray(e)||(e=[e]),o(e.length>=1,"options.version must have at least 1 version specified");for(let r=0;r<e.length;++r)o(typeof e[r]=="string","options.version must only contain strings"),e[r]=e[r].toLowerCase(),o(["ipv4","ipv6","ipvfuture"].includes(e[r]),"options.version contains unknown version "+e[r]+" - must be one of ipv4, ipv6, ipvfuture");e=Array.from(new Set(e));const a=`(?:${e.map(r=>{if(d==="forbidden")return b.ip[r];const t=`\\/${r==="ipv4"?b.ip.v4Cidr:b.ip.v6Cidr}`;return d==="required"?`${b.ip[r]}${t}`:`${b.ip[r]}(?:${t})?`}).join("|")})`,n=new RegExp(`^${a}$`);return{cidr:d,versions:e,regex:n,raw:a}}},5752:(k,w,p)=>{const o=p(375),b=p(6064),h={generate:function(){const d={},e="\\dA-Fa-f",a="["+e+"]",n="\\w-\\.~",r="!\\$&'\\(\\)\\*\\+,;=",t="%"+e,l=n+t+r+":@",s="["+l+"]",i="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";d.ipv4address="(?:"+i+"\\.){3}"+i;const u=a+"{1,4}",f="(?:"+u+":"+u+"|"+d.ipv4address+")",g="(?:"+u+":){6}"+f,_="::(?:"+u+":){5}"+f,v="(?:"+u+")?::(?:"+u+":){4}"+f,c="(?:(?:"+u+":){0,1}"+u+")?::(?:"+u+":){3}"+f,m="(?:(?:"+u+":){0,2}"+u+")?::(?:"+u+":){2}"+f,y="(?:(?:"+u+":){0,3}"+u+")?::"+u+":"+f,x="(?:(?:"+u+":){0,4}"+u+")?::"+f,S="(?:(?:"+u+":){0,5}"+u+")?::"+u,R="(?:(?:"+u+":){0,6}"+u+")?::";d.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",d.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",d.ipv6address="(?:"+g+"|"+_+"|"+v+"|"+c+"|"+m+"|"+y+"|"+x+"|"+S+"|"+R+")",d.ipvFuture="v"+a+"+\\.["+n+r+":]+",d.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",d.schemeRegex=new RegExp(d.scheme);const C="["+n+t+r+":]*",D="["+n+t+r+"]{1,255}",L="(?:\\[(?:"+d.ipv6address+"|"+d.ipvFuture+")\\]|"+d.ipv4address+"|"+D+")",M="(?:"+C+"@)?"+L+"(?::\\d*)?",F="(?:"+C+"@)?("+L+")(?::\\d*)?",I=s+"*",T=s+"+",q="(?:\\/"+I+")*",N="\\/(?:"+T+q+")?",B=T+q,H="["+n+t+r+"@]+"+q,se="(?:\\/\\/\\/"+I+q+")";return d.hierPart="(?:(?:\\/\\/"+M+q+")|"+N+"|"+B+"|"+se+")",d.hierPartCapture="(?:(?:\\/\\/"+F+q+")|"+N+"|"+B+")",d.relativeRef="(?:(?:\\/\\/"+M+q+")|"+N+"|"+H+"|)",d.relativeRefCapture="(?:(?:\\/\\/"+F+q+")|"+N+"|"+H+"|)",d.query="["+l+"\\/\\?]*(?=#|$)",d.queryWithSquareBrackets="["+l+"\\[\\]\\/\\?]*(?=#|$)",d.fragment="["+l+"\\/\\?]*",d}};h.rfc3986=h.generate(),w.ip={v4Cidr:h.rfc3986.ipv4Cidr,v6Cidr:h.rfc3986.ipv6Cidr,ipv4:h.rfc3986.ipv4address,ipv6:h.rfc3986.ipv6address,ipvfuture:h.rfc3986.ipvFuture},h.createRegex=function(d){const e=h.rfc3986,a="(?:\\?"+(d.allowQuerySquareBrackets?e.queryWithSquareBrackets:e.query)+")?(?:#"+e.fragment+")?",n=d.domain?e.relativeRefCapture:e.relativeRef;if(d.relativeOnly)return h.wrap(n+a);let r="";if(d.scheme){o(d.scheme instanceof RegExp||typeof d.scheme=="string"||Array.isArray(d.scheme),"scheme must be a RegExp, String, or Array");const s=[].concat(d.scheme);o(s.length>=1,"scheme must have at least 1 scheme specified");const i=[];for(let u=0;u<s.length;++u){const f=s[u];o(f instanceof RegExp||typeof f=="string","scheme at position "+u+" must be a RegExp or String"),f instanceof RegExp?i.push(f.source.toString()):(o(e.schemeRegex.test(f),"scheme at position "+u+" must be a valid scheme"),i.push(b(f)))}r=i.join("|")}const t="(?:"+(r?"(?:"+r+")":e.scheme)+":"+(d.domain?e.hierPartCapture:e.hierPart)+")",l=d.allowRelative?"(?:"+t+"|"+n+")":t;return h.wrap(l+a,r)},h.wrap=function(d,e){return{raw:d=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${d}`,regex:new RegExp(`^${d}$`),scheme:e}},h.uriRegex=h.createRegex({}),w.regex=function(d={}){return d.scheme||d.allowRelative||d.relativeOnly||d.allowQuerySquareBrackets||d.domain?h.createRegex(d):h.uriRegex}},1447:(k,w)=>{const p={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};w.Parser=class{constructor(o,b={}){if(!b[p.settings]&&b.constants)for(const h in b.constants){const d=b.constants[h];if(d!==null&&!["boolean","number","string"].includes(typeof d))throw new Error(`Formula constant ${h} contains invalid ${typeof d} value type`)}this.settings=b[p.settings]?b:Object.assign({[p.settings]:!0,constants:{},functions:{}},b),this.single=null,this._parts=null,this._parse(o)}_parse(o){let b=[],h="",d=0,e=!1;const a=r=>{if(d)throw new Error("Formula missing closing parenthesis");const t=b.length?b[b.length-1]:null;if(e||h||r){if(t&&t.type==="reference"&&r===")")return t.type="function",t.value=this._subFormula(h,t.value),void(h="");if(r===")"){const l=new w.Parser(h,this.settings);b.push({type:"segment",value:l})}else if(e){if(e==="]")return b.push({type:"reference",value:h}),void(h="");b.push({type:"literal",value:h})}else if(p.operatorCharacters.includes(h))t&&t.type==="operator"&&p.operators.includes(t.value+h)?t.value+=h:b.push({type:"operator",value:h});else if(h.match(p.numberRx))b.push({type:"constant",value:parseFloat(h)});else if(this.settings.constants[h]!==void 0)b.push({type:"constant",value:this.settings.constants[h]});else{if(!h.match(p.tokenRx))throw new Error(`Formula contains invalid token: ${h}`);b.push({type:"reference",value:h})}h=""}};for(const r of o)e?r===e?(a(),e=!1):h+=r:d?r==="("?(h+=r,++d):r===")"?(--d,d?h+=r:a(r)):h+=r:r in p.literals?e=p.literals[r]:r==="("?(a(),++d):p.operatorCharacters.includes(r)?(a(),h=r,a()):r!==" "?h+=r:a();a(),b=b.map((r,t)=>r.type!=="operator"||r.value!=="-"||t&&b[t-1].type!=="operator"?r:{type:"operator",value:"n"});let n=!1;for(const r of b){if(r.type==="operator"){if(p.operatorsPrefix.includes(r.value))continue;if(!n)throw new Error("Formula contains an operator in invalid position");if(!p.operators.includes(r.value))throw new Error(`Formula contains an unknown operator ${r.value}`)}else if(n)throw new Error("Formula missing expected operator");n=!n}if(!n)throw new Error("Formula contains invalid trailing operator");b.length===1&&["reference","literal","constant"].includes(b[0].type)&&(this.single={type:b[0].type==="reference"?"reference":"value",value:b[0].value}),this._parts=b.map(r=>{if(r.type==="operator")return p.operatorsPrefix.includes(r.value)?r:r.value;if(r.type!=="reference")return r.value;if(this.settings.tokenRx&&!this.settings.tokenRx.test(r.value))throw new Error(`Formula contains invalid reference ${r.value}`);return this.settings.reference?this.settings.reference(r.value):p.reference(r.value)})}_subFormula(o,b){const h=this.settings.functions[b];if(typeof h!="function")throw new Error(`Formula contains unknown function ${b}`);let d=[];if(o){let e="",a=0,n=!1;const r=()=>{if(!e)throw new Error(`Formula contains function ${b} with invalid arguments ${o}`);d.push(e),e=""};for(let t=0;t<o.length;++t){const l=o[t];n?(e+=l,l===n&&(n=!1)):l in p.literals&&!a?(e+=l,n=p.literals[l]):l!==","||a?(e+=l,l==="("?++a:l===")"&&--a):r()}r()}return d=d.map(e=>new w.Parser(e,this.settings)),function(e){const a=[];for(const n of d)a.push(n.evaluate(e));return h.call(e,...a)}}evaluate(o){const b=this._parts.slice();for(let h=b.length-2;h>=0;--h){const d=b[h];if(d&&d.type==="operator"){const e=b[h+1];b.splice(h+1,1);const a=p.evaluate(e,o);b[h]=p.single(d.value,a)}}return p.operatorsOrder.forEach(h=>{for(let d=1;d<b.length-1;)if(h.includes(b[d])){const e=b[d],a=p.evaluate(b[d-1],o),n=p.evaluate(b[d+1],o);b.splice(d,2);const r=p.calculate(e,a,n);b[d-1]=r===0?0:r}else d+=2}),p.evaluate(b[0],o)}},w.Parser.prototype[p.symbol]=!0,p.reference=function(o){return function(b){return b&&b[o]!==void 0?b[o]:null}},p.evaluate=function(o,b){return o===null?null:typeof o=="function"?o(b):o[p.symbol]?o.evaluate(b):o},p.single=function(o,b){if(o==="!")return!b;const h=-b;return h===0?0:h},p.calculate=function(o,b,h){if(o==="??")return p.exists(b)?b:h;if(typeof b=="string"||typeof h=="string"){if(o==="+")return(b=p.exists(b)?b:"")+(p.exists(h)?h:"")}else switch(o){case"^":return Math.pow(b,h);case"*":return b*h;case"/":return b/h;case"%":return b%h;case"+":return b+h;case"-":return b-h}switch(o){case"<":return b<h;case"<=":return b<=h;case">":return b>h;case">=":return b>=h;case"==":return b===h;case"!=":return b!==h;case"&&":return b&&h;case"||":return b||h}return null},p.exists=function(o){return o!=null}},9926:()=>{},5688:()=>{},9708:()=>{},1152:()=>{},443:()=>{},9848:()=>{},5934:k=>{k.exports=JSON.parse('{"version":"17.13.3"}')}},A={},function k(w){var p=A[w];if(p!==void 0)return p.exports;var o=A[w]={exports:{}};return E[w](o,o.exports,k),o.exports}(5107);var E,A})})(Ve);var Ot=Ve.exports,Re={},At=ee&&ee.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(Re,"__esModule",{value:!0});Re.BNExtension=Ct;const Q=At(mt);function Ct($){return{type:"BN",base:$.any(),messages:{"bn.nan":"{{#label}} is not a big number","bn.max":'{{#label}} needs to be less than or equal to "{{#threshold}}"',"bn.min":'{{#label}} needs to be greater than or equal to "{{#threshold}}"',"bn.less":'{{#label}} needs to be less than "{{#threshold}}"',"bn.greater":'{{#label}} needs to be greater than "{{#threshold}}"',"bn.positive":"{{#label}} needs to be positive","bn.negative":"{{#label}} needs to be negative"},prepare(O,E){try{return{value:new Q.default(O)}}catch{return{errors:E.error("bn.nan")}}},coerce(O){return{value:O.toString(10)}},validate(O){return{value:O}},rules:{gt:{args:[{name:"threshold",ref:!0,assert:O=>Q.default.isBN(O),message:"must be a big number",normalize:O=>new Q.default(O)},{name:"equal",assert:O=>typeof O=="boolean",message:"must be a boolean"}],validate(O,E,A){const k=new Q.default(O);return A.equal&&k.lt(A.threshold)?E.error("bn.min",A):!A.equal&&k.lte(A.threshold)?E.error("bn.greater",A):O}},lt:{args:[{name:"threshold",ref:!0,assert:O=>Q.default.isBN(O),message:"must be a big number",normalize:O=>new Q.default(O)},{name:"equal",assert:O=>typeof O=="boolean",message:"must be a boolean"}],validate(O,E,A){const k=new Q.default(O);return A.equal&&k.gt(A.threshold)?E.error("bn.max",A):!A.equal&&k.gte(A.threshold)?E.error("bn.less",A):O}},min:{alias:"gte",method(O){return this.$_addRule({name:"gt",args:{threshold:O,equal:!0}})}},max:{alias:"lte",method(O){return this.$_addRule({name:"lt",args:{threshold:O,equal:!0}})}},greater:{alias:"gt",method(O){return this.$_addRule({name:"gt",args:{threshold:O,equal:!1}})}},less:{alias:"lt",method(O){return this.$_addRule({name:"lt",args:{threshold:O,equal:!1}})}},positive:{method(){return this.$_addRule({name:"gt",args:{threshold:0,equal:!1}})}},negative:{method(){return this.$_addRule({name:"lt",args:{threshold:0,equal:!1}})}}}}}var Oe={},Dt=ee&&ee.__importDefault||function($){return $&&$.__esModule?$:{default:$}};Object.defineProperty(Oe,"__esModule",{value:!0});Oe.DIDExtension=Et;const pe=Dt(ot),ge=lt,W=K,le={pk:Object.keys(ge.types.KeyType),hash:Object.keys(ge.types.HashType),role:Object.keys(ge.types.RoleType)};function Et($){return{type:"DID",base:$.string().trim(),messages:{"did.empty":'Expect {{#label}} to be non-empty string, got "{{#value}}"',"did.invalid":'Expect {{#label}} to be valid did, got "{{#value}}"',"did.wallet":'Expect wallet type of {{#label}} to be "{{#expected}}" wallet, got "{{#actual}}"',"did.pk":'Expect pk type of {{#label}} to be "{{#expected}}", got "{{#actual}}"',"did.hash":'Expect hash type of {{#label}} to be "{{#expected}}", got "{{#actual}}"',"did.role":'Expect role type of {{#label}} to be "{{#expected}}", got "{{#actual}}"',"did.prefix":'Expect prefix of {{#label}} to be "{{#expected}}"'},validate(O,E){return!O||typeof O!="string"?{errors:E.error("did.empty",{value:O})}:(0,W.isValid)(O)===!1?{errors:E.error("did.invalid",{value:O})}:{value:O}},rules:{type:{args:[{name:"key",ref:!0,assert:O=>Object.keys(le).includes(O),message:`must be one of ${Object.keys(le).join(", ")}`},{name:"expected",assert:O=>Object.keys(le).some(E=>le[E].includes(O)),message:"must be valid type"}],validate(O,E,A){const k=(0,W.toTypeInfoStr)(O);return A.key==="pk"&&k.pk!==A.expected?E.error("did.pk",{...A,actual:k.pk}):A.key==="hash"&&k.hash!==A.expected?E.error("did.hash",{...A,actual:k.hash}):A.key==="role"&&k.role!==A.expected?E.error("did.role",{...A,actual:k.role}):O}},pk:{method(O){return this.$_addRule({name:"type",args:{key:"pk",expected:O}})}},hash:{method(O){return this.$_addRule({name:"type",args:{key:"hash",expected:O}})}},role:{method(O){return this.$_addRule({name:"type",args:{key:"role",expected:O}})}},wallet:{method(O){return this.$_addRule({name:"wallet",args:{type:O}})},args:[{name:"type",ref:!0,assert:O=>["arcblock","ethereum","default","eth","passkey"].includes(O),message:"must be a string",normalize:O=>O.trim()}],validate(O,E,A={}){const k=(0,W.toTypeInfo)(O),w=(0,W.toTypeInfoStr)(O);return["ethereum","eth"].includes(A.type)&&(0,pe.default)(k,W.DID_TYPE_ETHEREUM)===!1?E.error("did.wallet",{expected:A.type,actual:JSON.stringify(w)}):["arcblock","default"].includes(A.type)&&(0,pe.default)(k,W.DID_TYPE_ARCBLOCK)===!1?E.error("did.wallet",{expected:A.type,actual:JSON.stringify(w)}):["passkey"].includes(A.type)&&(0,pe.default)(k,W.DID_TYPE_PASSKEY)===!1?E.error("did.wallet",{expected:A.type,actual:JSON.stringify(w)}):O}},prefix:{method(O=""){return this.$_addRule({name:"prefix",args:{str:O}})},args:[{name:"str",ref:!0,assert:O=>["",W.DID_PREFIX].includes(O),message:"must be a string",normalize:O=>O.trim()}],validate(O,E,A={}){return A.str&&O.startsWith(A.str)===!1?E.error("did.prefix",{expected:A.str}):!A.str&&(0,W.toAddress)(O)!==O?E.error("did.prefix",{expected:A.str}):O}}}}}(function($){var O=ee&&ee.__importDefault||function(i){return i&&i.__esModule?i:{default:i}};Object.defineProperty($,"__esModule",{value:!0}),$.patterns=$.schemas=$.Joi=void 0;const E=O(Ot),A=Re,k=Oe;$.Joi=E.default.extend(k.DIDExtension).extend(A.BNExtension);const w=/^(0x)?([A-Fa-f0-9]{64})$/,p=$.Joi.object({genesisTime:$.Joi.date().iso().required().raw(),genesisTx:$.Joi.string().regex(w).required().allow(""),renaissanceTime:$.Joi.date().iso().required().raw(),renaissanceTx:$.Joi.string().regex(w).required().allow("")}),o=$.Joi.object({address:$.Joi.DID().prefix().role("ROLE_TOKEN").required(),value:$.Joi.BN().positive().required()}),b=$.Joi.object({name:$.Joi.string().min(1).max(256).required(),value:$.Joi.string().min(1).max(1024).required(),description:$.Joi.string().min(1).max(256).optional().allow(""),required:$.Joi.boolean().optional().default(!1)}),h=$.Joi.alternatives().try($.Joi.DID().prefix().role("ROLE_ACCOUNT"),$.Joi.DID().prefix().role("ROLE_APPLICATION"),$.Joi.DID().prefix().role("ROLE_BLOCKLET"),$.Joi.DID().prefix().wallet("ethereum"),$.Joi.DID().prefix().wallet("passkey")),d=$.Joi.array().items($.Joi.object({owner:h.required(),tokensList:$.Joi.array().items(o).default([]),assetsList:$.Joi.array().items($.Joi.DID().prefix().role("ROLE_ASSET")).default([])})),e=$.Joi.array().items({signer:$.Joi.DID().prefix().required(),pk:$.Joi.any().required(),signature:$.Joi.any().required(),delegator:$.Joi.DID().prefix().valid("").optional(),data:$.Joi.any().optional()}),a=$.Joi.object({type:$.Joi.string().min(1).max(32).required(),contractAddress:$.Joi.DID().prefix().wallet("ethereum").required(),chainType:$.Joi.string().min(1).max(32).required(),chainName:$.Joi.string().min(1).max(32).required(),chainId:$.Joi.number().positive().required()}),n=$.Joi.object({type:$.Joi.string().valid("svg","url","uri").required(),content:$.Joi.string().when("type",{is:"uri",then:$.Joi.string().max(20480).dataUri().required()}).when("type",{is:"url",then:$.Joi.string().max(2048).uri({scheme:["http","https"]}).required()})}),r=$.Joi.object({id:$.Joi.string().max(2048).uri({scheme:["http","https"]}).required(),scope:$.Joi.string().valid("public","private").default("public")}),t=$.Joi.object({id:$.Joi.DID().prefix().required(),pk:$.Joi.string().required(),name:$.Joi.string().min(1).max(256).required()}),l={address:$.Joi.DID().prefix().role("ROLE_ASSET").required(),moniker:$.Joi.string().min(2).max(255).required(),data:$.Joi.any().required(),readonly:$.Joi.boolean().default(!1),transferrable:$.Joi.boolean().default(!1),ttl:$.Joi.number().min(0).default(0),parent:$.Joi.DID().prefix().optional().allow(""),issuer:$.Joi.DID().prefix().optional().allow(""),endpoint:r.optional().allow(null).default(null),display:n.optional().allow(null).default(null),tags:$.Joi.array().items($.Joi.string().min(1).max(64)).max(4).optional()},s={address:$.Joi.DID().prefix().role("ROLE_FACTORY").required(),name:$.Joi.string().min(2).max(255).required(),description:$.Joi.string().min(2).max(255).required(),settlement:$.Joi.string().valid("instant","periodic").default("instant"),limit:$.Joi.number().integer().min(0).default(0),trustedIssuers:$.Joi.array().items($.Joi.DID().prefix()).max(8).optional(),data:$.Joi.any().optional().allow(null).default(null),display:n.optional().allow(null).default(null),input:$.Joi.object({value:$.Joi.BN().positive().min("0").default("0"),tokens:$.Joi.array().items(o).max(8).optional(),assets:$.Joi.array().items($.Joi.alternatives().try($.Joi.DID().prefix().role("ROLE_ASSET"),$.Joi.DID().prefix().role("ROLE_FACTORY"))).max(8).optional(),variables:$.Joi.array().items($.Joi.object({name:$.Joi.string().min(1).max(255).required(),description:$.Joi.string().max(255).optional().allow(""),required:$.Joi.boolean().required()})).optional()}),output:$.Joi.object({moniker:$.Joi.string().min(2).max(255).required(),data:$.Joi.any().required(),readonly:$.Joi.boolean().default(!1),transferrable:$.Joi.boolean().default(!1),ttl:$.Joi.number().min(0).default(0),parent:$.Joi.string().max(255).required(),issuer:$.Joi.string().max(255).required(),endpoint:r.optional(),display:n.optional(),tags:$.Joi.array().items($.Joi.string().min(1).max(64)).max(4).optional()}),hooks:$.Joi.array().items($.Joi.object({name:$.Joi.string().valid("mint","postMint","preMint").required(),type:$.Joi.string().valid("url","contract").required(),hook:$.Joi.string().min(1).max(4096).required(),compiled:$.Joi.array().items($.Joi.object()).optional()})).optional()};$.schemas={context:p,tokenInput:o,multiInput:d,multiSig:e,foreignToken:a,variableInput:b,nftDisplay:n,nftEndpoint:r,nftIssuer:t,tokenHolder:h,assetProps:l,assetSchema:$.Joi.object(l).options({stripUnknown:!0,noDefaults:!1}),factoryProps:s,factorySchema:$.Joi.object(s).options({stripUnknown:!0,noDefaults:!1})},$.patterns={txHash:w}})(Ue);function Ae({onCancel:$,onSuccess:O,blocklet:E}){var l,s;const{vaults:A=[],appPid:k}=E,{t:w,locale:p}=oe(),{connectApi:o}=Fe(),{api:b}=re(),{teamDid:h}=ze(),[d,e]=Ne({loading:!1,fetching:!1,error:"",address:"",fetched:[],errored:[]});z.useEffect(()=>{if(!K.isValid(d.address))return;const i=K.toAddress(d.address),u=d.fetched.find(g=>g.address===i),f=d.errored.find(g=>g.address===i);!d.fetching&&!u&&!f&&(e({fetching:!0}),nt(ct.MAIN_CHAIN_ENDPOINT).getAccountState({address:i}).then(_=>{_.state?e({fetching:!1,fetched:[...d.fetched.filter(v=>v.address!==i),_.state]}):e({fetching:!1,errored:[...d.errored.filter(v=>v.address!==i),{address:i}]})}).catch(_=>{console.error(_),e({fetching:!1,error:ie(_)})}))},[d.address,d.fetching]),z.useEffect(()=>{if(d.address){const i=K.toAddress(d.address);if(!K.isValid(i)){e({error:w("blocklet.config.vault.error.invalid")});return}if(Ue.schemas.tokenHolder.validate(i).error){e({error:w("blocklet.config.vault.error.holder")});return}if(A.find(f=>f.did===i)){e({error:w("blocklet.config.vault.error.duplicate")});return}if(ht([E.appDid,E.appPid,...E.migratedFrom.map(f=>f.appDid)].filter(Boolean)).includes(i)){e({error:w("blocklet.config.vault.error.appDid")});return}}e({error:""})},[d.address]);const a=async()=>{e({loading:!0});try{const i=await b.configVault({input:{teamDid:h,vaultDid:K.toAddress(d.address)}});o.open({locale:p,action:"approve-vault",forceConnected:!1,saveConnect:!1,autoConnect:!1,className:"connect",checkTimeout:10*60*1e3,passkeyBehavior:"none",extraParams:{sessionId:i.sessionId},messages:{title:w("blocklet.config.vault.approve.title"),scan:w(`blocklet.config.vault.approve.${A.length>0?"byLast":"byOwner"}`),confirm:w("blocklet.config.vault.approve.confirm"),success:w("blocklet.config.vault.approve.success")},onSuccess:()=>{o.open({locale:p,action:"config-vault",forceConnected:!1,saveConnect:!1,autoConnect:!1,className:"connect",checkTimeout:10*60*1e3,passkeyBehavior:"none",extraParams:{sessionId:i.sessionId},messages:{title:w("blocklet.config.vault.commit.title"),scan:w("blocklet.config.vault.commit.scan"),confirm:w("blocklet.config.vault.commit.confirm"),success:w("blocklet.config.vault.commit.success")},onSuccess:()=>{e({loading:!1}),O()},onClose:()=>{e({loading:!1}),o.close()}})},onClose:()=>{e({loading:!1}),o.close()}})}catch(i){e({loading:!1,error:ie(i)})}},n=K.toAddress(d.address),r=[];K.isValid(n)&&r.push({key:w("blocklet.config.vault.role"),value:j.jsx(Ye,{color:"primary",variant:"outlined",size:"small",label:K.toTypeInfoStr(n).role||"-"})});const t=d.fetched.find(i=>i.address===n);return t&&r.push({key:w("blocklet.config.vault.firstSeen"),value:De((l=t.context)==null?void 0:l.genesisTime,"-")},{key:w("blocklet.config.vault.lastSeen"),value:De((s=t.context)==null?void 0:s.renaissanceTime,"-")},{key:w("blocklet.config.vault.migratedFrom"),value:t.migratedFrom.length?t.migratedFrom.map(i=>j.jsx(Ee,{did:i,showQrcode:!0,compact:!0,size:14,locale:p},i)):"-"},{key:w("blocklet.config.vault.migratedTo"),value:t.migratedTo.length?t.migratedTo.map(i=>j.jsx(Ee,{did:i,showQrcode:!0,compact:!0,size:14,locale:p},i)):"-"}),j.jsx(Pe,{open:!0,fullWidth:!0,showCloseButton:!1,onClose:$,title:j.jsxs(P,{sx:{display:"flex",alignItems:"center",gap:1},children:[j.jsx($e,{}),w("blocklet.config.vault.title")]}),actions:j.jsxs(j.Fragment,{children:[j.jsx(Z,{onClick:$,children:w("common.cancel")}),j.jsx(Z,{onClick:a,variant:"contained",disabled:!!d.error||d.loading,children:w("common.confirm")})]}),children:j.jsxs(ce,{direction:"column",spacing:3,children:[j.jsxs(te,{variant:"body1",color:"text.secondary",gutterBottom:!0,children:[w("blocklet.config.vault.desc")," ",w("blocklet.config.vault.tip")]}),A.length>0&&j.jsxs(P,{children:[j.jsxs(te,{variant:"body1",color:"text.secondary",gutterBottom:!0,children:[w("blocklet.config.vault.current"),":"]}),j.jsxs(P,{sx:{display:"flex",alignItems:"center",gap:.5},children:[j.jsx(gt,{did:A[A.length-1].did,showQrcode:!0,style:{width:"auto"}}),j.jsx(yt,{vaults:A,appPid:k})]})]}),j.jsx(Qe,{fullWidth:!0,"data-cy":"input-factory-address",label:w("blocklet.config.vault.address"),error:!!d.error,helperText:d.error,value:d.address,InputProps:{endAdornment:d.fetching?j.jsx(Xe,{position:"end",children:j.jsx(ue,{size:16})}):null},onChange:i=>{e({address:i.target.value,error:""})}}),j.jsx(P,{sx:{"& .info-row__name":{fontSize:"14px"},"& .info-row__value":{fontSize:"14px"}},children:r.map(i=>j.jsx(pt,{valueComponent:"div",nameWidth:120,name:i.key,children:i.value},i.key))})]})})}Ae.propTypes={onCancel:J.func.isRequired,onSuccess:J.func.isRequired,blocklet:J.object.isRequired};Ae.defaultProps={};function It({teamDid:$,size:O="small",...E}){const{t:A}=oe(),{api:k}=re(),[w,p]=z.useState(!1),[o,b]=z.useState(null),h=()=>{p(!1),b(null)},d=async()=>{var a;try{p(!0);const n=await k.rotateSessionKey({input:{teamDid:$}});G.success(A("blocklet.config.rotateSessionKey.success",{count:((a=n.removed)==null?void 0:a.length)||0})),setTimeout(()=>{window.location.reload()},1e3)}catch(n){G.error(ie(n))}finally{p(!1),b(null)}},e={title:A("blocklet.config.rotateSessionKey.title"),description:A("blocklet.config.rotateSessionKey.description"),confirm:A("common.confirm"),cancel:A("common.cancel"),onConfirm:d,onCancel:h};return j.jsxs("div",{...E,children:[j.jsxs(Z,{onClick:()=>b(e),color:"error",variant:"outlined",size:O,children:[w?j.jsx(ue,{size:16,style:{marginRight:5}}):null,A("blocklet.config.rotateSessionKey.action")]}),o&&j.jsx(_e,{title:o.title,description:o.description,confirm:o.confirm,cancel:o.cancel,onConfirm:o.onConfirm,onCancel:o.onCancel})]})}function fe({blocklet:$,onUpdate:O,hasPermission:E}){var D,L,M,F;const{info:A,api:k,inService:w}=re(),{t:p,locale:o}=z.useContext(ut),[b,h]=Ne({loading:!1,showTransferOwner:!1,showConfigVault:!1}),[d,e]=z.useState(()=>{var I,T,q;return((q=(T=(I=$==null?void 0:$.settings)==null?void 0:I.gateway)==null?void 0:T.wafPolicy)==null?void 0:q.enabled)??!0}),[a,n]=z.useState(()=>{var I;return!!((I=$==null?void 0:$.settings)!=null&&I.enableSessionHardening)}),[r,t]=z.useState(()=>{var I,T;return!!((T=(I=$==null?void 0:$.settings)==null?void 0:I.invite)!=null&&T.enabled)}),l=b.loading||!E,{did:s}=$.meta,i=w?(M=(L=(D=window.env)==null?void 0:D.gateway)==null?void 0:L.wafPolicy)==null?void 0:M.enabled:(F=A==null?void 0:A.routing.wafPolicy)==null?void 0:F.enabled;if(Le($.status))return null;const u=$.environments.find(I=>I.key===Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE),f=!u||u.value==="yes",g=$.environments.find(I=>I.key===Y.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_TENANT_MODE),_=(g==null?void 0:g.value)||Y.BLOCKLET_TENANT_MODES.SINGLE,v=(I,T)=>async q=>{if(!b.loading){h({loading:!0});try{const{checked:N}=q.target,{blocklet:B}=await k.configBlocklet({input:{did:$.meta.did,configs:[{key:Y.BLOCKLET_CONFIGURABLE_KEY[I],value:T(N)}]}});O(B)}catch(N){G.error(N.message)}finally{h({loading:!1})}}},c=v("BLOCKLET_DELETABLE",I=>I?"no":"yes"),m=v("BLOCKLET_APP_TENANT_MODE",I=>I?Y.BLOCKLET_TENANT_MODES.MULTIPLE:Y.BLOCKLET_TENANT_MODES.SINGLE),y=(I,T)=>async q=>{if(!b.loading){h({loading:!0});try{const N=q.target.checked;await k.updateBlockletSettings({input:I(N)}),T&&T(N)}catch(N){G.error(N.message)}finally{h({loading:!1})}}},x=y(I=>({did:$.meta.did,invite:{enabled:I}}),t),S=y(I=>({did:$.meta.did,gateway:{wafPolicy:{enabled:I}}}),e),R=y(I=>({did:$.meta.did,enableSessionHardening:I}),n),C=async()=>{if(!b.loading){h({loading:!0});try{const{blocklet:I}=await k.getBlocklet({input:{did:$.meta.did}});O(I)}catch(I){G.error(I.message)}finally{h({loading:!1})}}};return j.jsxs(Mt,{p:3,sx:{border:"1px solid red",borderRadius:2},className:"advanced-config",children:[!w&&j.jsxs(j.Fragment,{children:[j.jsx(U,{title:p("blocklet.config.deletable.name"),desc:p(f?"blocklet.config.deletable.disable":"blocklet.config.deletable.enable"),children:j.jsx(P,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:j.jsx(ae,{disabled:l,checked:!f,defaultChecked:!0,onChange:c})})}),j.jsx(P,{className:"config-form",component:V,my:3})]}),j.jsx(ke,{inService:w,disabled:l,loading:b.loading,onChange:C}),j.jsx(P,{className:"config-form",component:V,my:3}),w&&j.jsx(at,{role:"owner",children:I=>(I||$t)&&j.jsxs(j.Fragment,{children:[j.jsx(U,{title:p("blocklet.config.vault.title"),desc:p("blocklet.config.vault.desc"),children:j.jsx(P,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:j.jsxs(Z,{variant:"contained",color:"primary",size:"small","data-cy":"config-vault",onClick:()=>h({showConfigVault:!0}),children:[j.jsx($e,{style:{fontSize:"1.3em",marginRight:4}}),p("blocklet.config.vault.title")]})})}),j.jsx(P,{className:"config-form",component:V,my:3}),b.showConfigVault&&j.jsx(Ae,{blocklet:$,onCancel:()=>h({showConfigVault:!1}),onSuccess:()=>h({showConfigVault:!1})}),j.jsx(U,{title:p("team.transferApp.name"),desc:p("team.transferApp.description"),children:j.jsx(P,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:j.jsxs(Z,{variant:"contained",edge:"end",color:"primary",size:"small","data-cy":"transfer-app",onClick:()=>h({showTransferOwner:!0}),children:[j.jsx(Je,{style:{fontSize:"1.3em",marginRight:4}}),p("team.transferApp.name")]})})}),j.jsx(P,{className:"config-form",component:V,my:3}),b.showTransferOwner&&j.jsx(Se,{onCancel:()=>h({showTransferOwner:!1}),onSuccess:()=>h({showTransferOwner:!1})})]})}),j.jsx(U,{title:p("blocklet.config.clearCache.name"),desc:p("blocklet.config.clearCache.purpose"),children:j.jsx(P,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:j.jsx(jt,{teamDid:s})})}),j.jsx(P,{className:"config-form",component:V,my:3}),j.jsx(U,{title:p("blocklet.config.rotateSessionKey.name"),desc:p("blocklet.config.rotateSessionKey.purpose"),children:j.jsx(P,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:j.jsx(It,{style:{whiteSpace:"nowrap"},teamDid:s})})}),j.jsx(P,{className:"config-form",component:V,my:3}),j.jsx(U,{title:p("blocklet.config.tenantMode.name"),desc:p(`blocklet.config.tenantMode.${_}`),children:j.jsx(P,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:j.jsx(ae,{disabled:l,checked:_===Y.BLOCKLET_TENANT_MODES.MULTIPLE,onChange:m})})}),j.jsx(P,{className:"config-form",component:V,my:3}),j.jsx(U,{title:p("team.invite.setting"),desc:p(`team.invite.${r?"enabled":"disabled"}`),children:j.jsx(P,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:j.jsx(ae,{disabled:l,checked:r,onChange:x})})}),j.jsx(P,{className:"config-form",component:V,my:3}),j.jsx(U,{title:j.jsxs(ce,{direction:"row",alignItems:"center",gap:1,children:[p("setting.form.enableSessionHardening.switchLabel"),j.jsx(Ce,{title:p("setting.form.enableSessionHardening.switchTips"),children:j.jsx(Ie,{sx:{ml:.5,fontSize:"20px"},color:"primary"})})]}),children:j.jsx(P,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:j.jsx(ae,{disabled:l,checked:a,onChange:R})})}),i&&j.jsxs(j.Fragment,{children:[j.jsx(P,{className:"config-form",component:V,my:3}),j.jsx(U,{title:j.jsxs(ce,{direction:"row",alignItems:"center",gap:1,children:[p("router.gateway.wafPolicy.title"),j.jsx(Ce,{title:j.jsx(P,{sx:{fontSize:"14px",lineHeight:1.5},children:j.jsx(P,{sx:{color:"common.white",ml:.5},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${o}/enable-web-application-firewall`,target:"_blank",rel:"noopener noreferrer",children:p("dashboard.document")})}),children:j.jsx(Ie,{fontSize:"small",color:"action",sx:{fontSize:16,cursor:"pointer"}})})]}),desc:p("router.gateway.wafPolicy.switchLabel"),children:j.jsx(P,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:j.jsx(ae,{disabled:l,checked:d,onChange:S})})})]})]})}const Tt=de(fe,"mutate_blocklets"),Lt=de(fe,"",qe);function qt($){const{inService:O}=re();return O?j.jsx(Lt,{...$}):j.jsx(Tt,{...$})}fe.propTypes={blocklet:J.object.isRequired,onUpdate:J.func,hasPermission:J.bool};fe.defaultProps={onUpdate:()=>{},hasPermission:!1};const Mt=be(ce)``;function me({blocklet:$,onUpdate:O,hasPermission:E}){return Le($.status)?null:j.jsx(Ft,{children:j.jsx(qt,{blocklet:$,onUpdate:O,hasPermission:E})})}const Pt=de(me,"mutate_blocklets"),Nt=de(me,"",qe);function pr($){const{inService:O}=re();return O?j.jsx(Nt,{...$}):j.jsx(Pt,{...$})}me.propTypes={blocklet:J.object.isRequired,onUpdate:J.func,hasPermission:J.bool};me.defaultProps={onUpdate:()=>{},hasPermission:!1};const Ft=be(P)`
8
+ max-width: 1536px;
9
+
10
+ .advanced-config {
11
+ border: 0;
12
+ padding: 0;
13
+ }
14
+ `;export{pr as default};
@@ -0,0 +1 @@
1
+ import{E as a}from"./vendor-utils-uPLZO5mM.js";a.defaults.timeout=10*1e3;const o=a.create();export{o as a};
@@ -1 +1 @@
1
- import{A as E,J as k}from"./vendor-utils-BfZ4tlod.js";import{a as T,k as j}from"./vendor-ux-did-connect-pzpsrvqx.js";import{r as e}from"./vendor-react-DEoibe3W.js";import{D as M,G as B}from"./index-CwUT0vPy.js";import{u as D}from"./use-mobile-CtTQsfXN.js";import{e as H,j as o,aa as w,ab as I}from"./vendor-mui-core-Bq8gXTan.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-CwufDgLV.js";function J(){const{info:x,inService:g}=M(),{blocklet:y}=B(),{locale:d}=T(),u=e.useRef(null),r=H(),[L,R]=e.useState(0),f=D(),[t,S]=e.useState(!0),s=e.useRef(null);let a="";g?a=j.WELLKNOWN_SERVICE_PATH_PREFIX:a=x.routing.adminPath;const m=new URLSearchParams;g||m.set("authKey","__sst"),m.set("schemaKey",E(window.location.origin,a,`/api/theme?id=${encodeURIComponent(y.meta.did)}`));const c=e.useCallback(()=>{if(s.current){const n=k(JSON.parse(JSON.stringify(r)),["palette","typography","shape","direction","breakpoints","mixins","shadows","transitions","zIndex"]);s.current.contentWindow.postMessage({type:"SEND_THEME",payload:n},window.location.origin)}},[r]),l=e.useCallback(()=>{s.current&&s.current.contentWindow.postMessage({type:"SEND_LOCALE",payload:d},window.location.origin)},[d]);return e.useEffect(()=>{const n=i=>{i.origin===window.location.origin&&(i.data.type==="REQUEST_THEME"&&c(),i.data.type==="THEME_BUILDER_LOADED"&&(l(),S(!1)))};return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}},[c,l]),e.useEffect(()=>{t===!1&&c()},[r,t,c]),e.useEffect(()=>{t===!1&&l()},[d,t,l]),e.useEffect(()=>{const n=document.querySelector("#arc__dashboard-main"),i=document.querySelector(".dashboard-content"),p=()=>{if(u.current){const{height:b}=n.getBoundingClientRect(),{top:C}=i.getBoundingClientRect(),{top:_}=u.current.getBoundingClientRect();let h=b-_+C-(f?108:164);f&&(h=Math.min(h,600)),R(h)}};return p(),window.addEventListener("resize",p),()=>{window.removeEventListener("resize",p)}},[f,r]),o.jsxs(o.Fragment,{children:[o.jsx(w,{ref:u}),t&&o.jsx(w,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px"},children:o.jsx(I,{})}),o.jsx("iframe",{title:"Theme Builder",ref:s,src:`${E(window.location.origin,a,"/hosted/theme-builder/")}?${m.toString()}`,style:{border:0,width:"100%",height:`${L}px`,display:t?"none":"block"}})]})}export{J as default};
1
+ import{A as E,J as k}from"./vendor-utils-uPLZO5mM.js";import{a as T,k as j}from"./vendor-ux-did-connect-CQtodyZB.js";import{r as e}from"./vendor-react-DEoibe3W.js";import{D as M,G as B}from"./index-DBdN7QPA.js";import{u as D}from"./use-mobile-DwzRjjku.js";import{e as H,j as o,aa as w,ab as I}from"./vendor-mui-core-Bq8gXTan.js";import"./vendor-hooks-B2N8eE_a.js";import"./lottie-web-jYmAQWuC.js";import"./vendor-arcblock-DzylOsX3.js";function J(){const{info:x,inService:g}=M(),{blocklet:y}=B(),{locale:d}=T(),u=e.useRef(null),r=H(),[L,R]=e.useState(0),f=D(),[t,S]=e.useState(!0),s=e.useRef(null);let a="";g?a=j.WELLKNOWN_SERVICE_PATH_PREFIX:a=x.routing.adminPath;const m=new URLSearchParams;g||m.set("authKey","__sst"),m.set("schemaKey",E(window.location.origin,a,`/api/theme?id=${encodeURIComponent(y.meta.did)}`));const c=e.useCallback(()=>{if(s.current){const n=k(JSON.parse(JSON.stringify(r)),["palette","typography","shape","direction","breakpoints","mixins","shadows","transitions","zIndex"]);s.current.contentWindow.postMessage({type:"SEND_THEME",payload:n},window.location.origin)}},[r]),l=e.useCallback(()=>{s.current&&s.current.contentWindow.postMessage({type:"SEND_LOCALE",payload:d},window.location.origin)},[d]);return e.useEffect(()=>{const n=i=>{i.origin===window.location.origin&&(i.data.type==="REQUEST_THEME"&&c(),i.data.type==="THEME_BUILDER_LOADED"&&(l(),S(!1)))};return window.addEventListener("message",n),()=>{window.removeEventListener("message",n)}},[c,l]),e.useEffect(()=>{t===!1&&c()},[r,t,c]),e.useEffect(()=>{t===!1&&l()},[d,t,l]),e.useEffect(()=>{const n=document.querySelector("#arc__dashboard-main"),i=document.querySelector(".dashboard-content"),p=()=>{if(u.current){const{height:b}=n.getBoundingClientRect(),{top:C}=i.getBoundingClientRect(),{top:_}=u.current.getBoundingClientRect();let h=b-_+C-(f?108:164);f&&(h=Math.min(h,600)),R(h)}};return p(),window.addEventListener("resize",p),()=>{window.removeEventListener("resize",p)}},[f,r]),o.jsxs(o.Fragment,{children:[o.jsx(w,{ref:u}),t&&o.jsx(w,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"500px"},children:o.jsx(I,{})}),o.jsx("iframe",{title:"Theme Builder",ref:s,src:`${E(window.location.origin,a,"/hosted/theme-builder/")}?${m.toString()}`,style:{border:0,width:"100%",height:`${L}px`,display:t?"none":"block"}})]})}export{J as default};
@@ -1,4 +1,4 @@
1
- import{a3 as U,r as H,a as $,k as V,$ as F,bu as Z,bJ as q,a5 as G}from"./vendor-ux-did-connect-pzpsrvqx.js";import{j as e,a9 as K,e as B,aa as u,aq as J,T as j,ad as X,I as M,ab as Q,bo as Y,br as ee,bn as te,q as re,bP as ae,ah as oe}from"./vendor-mui-core-Bq8gXTan.js";import{p as se}from"./util-BQAJqeb4.js";import{r as s,L as ne}from"./vendor-react-DEoibe3W.js";import{_ as ie}from"./useLocalStorage-CaPDqrQ7.js";import{D}from"./index-CwUT0vPy.js";import{M as I}from"./index-CTlzm-Mc.js";import{O as le}from"./vendor-arcblock-CwufDgLV.js";import{d as ce}from"./InfoOutlined-BVWbftGI.js";import{d as de,e as _}from"./vendor-utils-BfZ4tlod.js";import{S as T}from"./shorten-label-BQvbtscf.js";import{r as O}from"./index-Bv7OAPJU.js";import{u as ue}from"./dashboard-t9EszOna.js";import"./vendor-hooks-DqdmWCmo.js";import"./lottie-web-jYmAQWuC.js";import"./base32-DUSifB4M.js";import"./index-8eXqqyHQ.js";import"./confirm-RvA9mFot.js";import"./PlayArrow-BqVYRyLK.js";import"./get-safe-url-D5KSEAKZ.js";import"./session-BGdAM8zS.js";import"./use-blocklet-logo-4UB-MFD3.js";import"./dot-4jhL56kz.js";import"./useAsync-C62uE2pS.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-DwzRjjku.js";const R=s.createContext({}),{Provider:pe,Consumer:Xe}=R;function me(){return localStorage.getItem("audit-log-page-size")&&Number(localStorage.getItem("audit-log-page-size"))||10}function fe({children:t,scope:l="",categories:r=[],showScope:n,scopeFormatter:p}){const{api:m,info:v}=D(),[L,C]=s.useState([]),[c,h]=s.useState({total:0,pageSize:me(),pageCount:0,page:1}),[f,d]=s.useState(!1),[x,a]=s.useState(""),[i,S]=ie(`audit-log-category-${l}`,"all"),z=[{value:"all",label:"All",description:""},{value:"blocklet",label:"Blocklet Management",description:""},{value:"server",label:"Server Management",description:""},{value:"team",label:"Team Management",description:""},{value:"security",label:"Security",description:""},{value:"certificates",label:"Certificate Management",description:""},{value:"integrations",label:"Integration Management",description:""},{value:"gateway",label:"Gateway",description:""}].filter(b=>r.length?b.value==="all"||r.includes(b.value):!0),w=async({page:b=1,pageSize:o=20,silent:y=!0}={})=>{if(!f){y||d(!0);try{const g=await m.getAuditLogs({input:{paging:{page:b,pageSize:o},category:i==="all"?"":i,scope:l,actionOrContent:x}});n&&(g.list||[]).forEach(P=>{P.scope!==v.did&&(P.link=`/blocklets/${P.scope}/components`)}),C(g.list),h(g.paging),d(!1)}catch(g){U.error(g.message),d(!1)}}};s.useEffect(()=>{localStorage.setItem("audit-log-page-size",c.pageSize)},[c.pageSize]),s.useEffect(()=>{w({page:1,pageSize:c.pageSize,silent:!1})},[]),s.useEffect(()=>{w({page:1,pageSize:c.pageSize,silent:!1})},[i,x]);const k={loading:f,fetch:w,filter:{category:i,scope:l},categories:z,setCategory:S,data:L,paging:c,setPaging:h,showScope:n,scopeFormatter:p,actionOrContent:x,setActionOrContent:a};return e.jsx(pe,{value:{auditLogs:k},children:t})}function W(){const{auditLogs:t}=s.useContext(R);return t}var A={},ge=K;Object.defineProperty(A,"__esModule",{value:!0});var N=A.default=void 0,xe=ge(H()),Le=e;N=A.default=(0,xe.default)((0,Le.jsx)("path",{d:"M12 5.83 15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15z"}),"UnfoldMore");function he(t){if(!t)return[];const l=/\[([^\]]+)\]\(([^)]+)\)/g,r=[];let n;for(;(n=l.exec(t))!==null;)r.push({text:n[1],url:n[2]});return r}const ve=`
1
+ import{a3 as U,r as H,a as $,k as V,$ as F,bu as Z,bJ as q,a5 as G}from"./vendor-ux-did-connect-CQtodyZB.js";import{j as e,a9 as K,e as B,aa as u,aq as J,T as j,ad as X,I as M,ab as Q,bo as Y,br as ee,bn as te,q as re,bP as ae,ah as oe}from"./vendor-mui-core-Bq8gXTan.js";import{p as se}from"./util-TW4lcckB.js";import{r as s,L as ne}from"./vendor-react-DEoibe3W.js";import{_ as ie}from"./useLocalStorage-BoYGn-bQ.js";import{D}from"./index-DBdN7QPA.js";import{M as I}from"./index-CTlzm-Mc.js";import{O as le}from"./vendor-arcblock-DzylOsX3.js";import{d as ce}from"./InfoOutlined-GEKFkezP.js";import{d as de,e as _}from"./vendor-utils-uPLZO5mM.js";import{S as T}from"./shorten-label-BQvbtscf.js";import{r as O}from"./index-Bv7OAPJU.js";import{u as ue}from"./dashboard-BTYQTsrm.js";import"./vendor-hooks-B2N8eE_a.js";import"./lottie-web-jYmAQWuC.js";import"./base32-BTgHqgXA.js";import"./index-8eXqqyHQ.js";import"./confirm-DchYh746.js";import"./PlayArrow-hnXK75qN.js";import"./get-safe-url-D3ggKpT1.js";import"./session-kQ1tvY5U.js";import"./use-blocklet-logo-BWK1UHK5.js";import"./dot-BYJ1q_JZ.js";import"./useAsync-BzjEtgtr.js";import"./useSetState-CWq0AVWn.js";import"./use-mobile-CtTQsfXN.js";const R=s.createContext({}),{Provider:pe,Consumer:Xe}=R;function me(){return localStorage.getItem("audit-log-page-size")&&Number(localStorage.getItem("audit-log-page-size"))||10}function fe({children:t,scope:l="",categories:r=[],showScope:n,scopeFormatter:p}){const{api:m,info:v}=D(),[L,C]=s.useState([]),[c,h]=s.useState({total:0,pageSize:me(),pageCount:0,page:1}),[f,d]=s.useState(!1),[x,a]=s.useState(""),[i,S]=ie(`audit-log-category-${l}`,"all"),z=[{value:"all",label:"All",description:""},{value:"blocklet",label:"Blocklet Management",description:""},{value:"server",label:"Server Management",description:""},{value:"team",label:"Team Management",description:""},{value:"security",label:"Security",description:""},{value:"certificates",label:"Certificate Management",description:""},{value:"integrations",label:"Integration Management",description:""},{value:"gateway",label:"Gateway",description:""}].filter(b=>r.length?b.value==="all"||r.includes(b.value):!0),w=async({page:b=1,pageSize:o=20,silent:y=!0}={})=>{if(!f){y||d(!0);try{const g=await m.getAuditLogs({input:{paging:{page:b,pageSize:o},category:i==="all"?"":i,scope:l,actionOrContent:x}});n&&(g.list||[]).forEach(P=>{P.scope!==v.did&&(P.link=`/blocklets/${P.scope}/components`)}),C(g.list),h(g.paging),d(!1)}catch(g){U.error(g.message),d(!1)}}};s.useEffect(()=>{localStorage.setItem("audit-log-page-size",c.pageSize)},[c.pageSize]),s.useEffect(()=>{w({page:1,pageSize:c.pageSize,silent:!1})},[]),s.useEffect(()=>{w({page:1,pageSize:c.pageSize,silent:!1})},[i,x]);const k={loading:f,fetch:w,filter:{category:i,scope:l},categories:z,setCategory:S,data:L,paging:c,setPaging:h,showScope:n,scopeFormatter:p,actionOrContent:x,setActionOrContent:a};return e.jsx(pe,{value:{auditLogs:k},children:t})}function W(){const{auditLogs:t}=s.useContext(R);return t}var A={},ge=K;Object.defineProperty(A,"__esModule",{value:!0});var N=A.default=void 0,xe=ge(H()),Le=e;N=A.default=(0,xe.default)((0,Le.jsx)("path",{d:"M12 5.83 15.17 9l1.41-1.41L12 3 7.41 7.59 8.83 9zm0 12.34L8.83 15l-1.41 1.41L12 21l4.59-4.59L15.17 15z"}),"UnfoldMore");function he(t){if(!t)return[];const l=/\[([^\]]+)\]\(([^)]+)\)/g,r=[];let n;for(;(n=l.exec(t))!==null;)r.push({text:n[1],url:n[2]});return r}const ve=`
2
2
  <svg style="width:38px;height:38px;" viewBox="0 0 64 64" fill="none" xmlns="http://www.w3.org/2000/svg">
3
3
  <path fill-rule="evenodd" clip-rule="evenodd" d="M50.152 10.6417L31.72 0L13.288 10.6417V24.7942L1 31.8887V53.1722L19.432 63.8139L31.6902 56.7366L31.72 56.7538L31.7498 56.7366L44.008 63.8139L62.44 53.1722V31.8887L50.152 24.7942V10.6417ZM60.52 32.9972L48.232 25.9027V11.7502L31.72 2.21703L15.208 11.7502V25.9028L2.92 32.9972V52.0636L19.432 61.5968L31.6902 54.5196L31.72 54.5368L31.7498 54.5196L44.008 61.5968L60.52 52.0636V32.9972Z" fill="url(#paint0_linear_606_96)"/>
4
4
  <path fill-rule="evenodd" clip-rule="evenodd" d="M50.1521 24.8307L31.7201 14.189L13.2881 24.8307V46.1141L31.7201 56.7558L50.1521 46.1141V24.8307ZM15.2081 25.9392L31.7201 16.406L48.2321 25.9392V45.0056L31.7201 54.5388L15.2081 45.0056V25.9392ZM28.5464 23.0464C28.6641 22.6342 29.0408 22.3501 29.4695 22.3501H33.9707C34.3993 22.3501 34.776 22.6342 34.8938 23.0464L35.7504 26.0447L37.8696 27.2681L40.8945 26.5109C41.3103 26.4068 41.7447 26.591 41.959 26.9622L44.2096 30.8604C44.424 31.2316 44.3662 31.6998 44.0682 32.0079L41.8999 34.2489V36.6959L44.0682 38.9369C44.3662 39.245 44.424 39.7133 44.2096 40.0845L41.959 43.9827C41.7447 44.3539 41.3103 44.538 40.8945 44.4339L37.8696 43.6767L35.7504 44.9002L34.8938 47.8984C34.776 48.3106 34.3993 48.5947 33.9707 48.5947H29.4695C29.0408 48.5947 28.6641 48.3106 28.5464 47.8984L27.6897 44.9002L25.5706 43.6767L22.5457 44.4339C22.1299 44.538 21.6955 44.3539 21.4812 43.9827L19.2305 40.0845C19.0162 39.7133 19.0739 39.245 19.372 38.9369L21.5402 36.6959V34.2489L19.372 32.0079C19.0739 31.6998 19.0162 31.2316 19.2305 30.8604L21.4812 26.9622C21.6955 26.591 22.1299 26.4068 22.5457 26.5109L25.5706 27.2681L27.6897 26.0447L28.5464 23.0464ZM28.9861 27.5132C29.2018 27.3887 29.3607 27.1851 29.4292 26.9456L30.1936 24.2701H33.2466L34.011 26.9456C34.0794 27.1851 34.2383 27.3887 34.4541 27.5132L37.2459 29.1251C37.4617 29.2497 37.7174 29.2855 37.9591 29.225L40.6583 28.5493L42.1848 31.1932L40.25 33.193C40.0768 33.372 39.9799 33.6114 39.9799 33.8605V37.0843C39.9799 37.3334 40.0768 37.5728 40.25 37.7518L42.1848 39.7516L40.6583 42.3955L37.9591 41.7198C37.7174 41.6593 37.4617 41.6951 37.2459 41.8197L34.4541 43.4316C34.2383 43.5561 34.0794 43.7597 34.011 43.9992L33.2466 46.6747H30.1936L29.4292 43.9992C29.3607 43.7597 29.2018 43.5561 28.9861 43.4316L26.1942 41.8197C25.9785 41.6951 25.7228 41.6593 25.4811 41.7198L22.7819 42.3955L21.2554 39.7516L23.1902 37.7518C23.3634 37.5728 23.4602 37.3334 23.4602 37.0843V33.8605C23.4602 33.6114 23.3634 33.372 23.1902 33.193L21.2554 31.1932L22.7819 28.5493L25.4811 29.225C25.7228 29.2855 25.9785 29.2497 26.1942 29.1251L28.9861 27.5132ZM31.7201 41.6407C28.3134 41.6407 25.5517 38.8791 25.5517 35.4724C25.5517 32.0657 28.3134 29.3041 31.7201 29.3041C35.1268 29.3041 37.8884 32.0657 37.8884 35.4724C37.8884 38.8791 35.1268 41.6407 31.7201 41.6407ZM35.9684 35.4724C35.9684 37.8187 34.0664 39.7207 31.7201 39.7207C29.3738 39.7207 27.4717 37.8187 27.4717 35.4724C27.4717 33.1261 29.3738 31.2241 31.7201 31.2241C34.0664 31.2241 35.9684 33.1261 35.9684 35.4724Z" fill="url(#paint1_linear_606_96)"/>
@@ -1 +1 @@
1
- import{v as I,j as e,aa as t,ab as z,y as d,T as a,aq as L,ad as D,bQ as O,bs as T,bR as F,X as B,ap as w,al as U}from"./vendor-mui-core-Bq8gXTan.js";import{r as x}from"./vendor-react-DEoibe3W.js";import{x as H}from"./vendor-hooks-DqdmWCmo.js";import{A as v}from"./vendor-utils-BfZ4tlod.js";import{a as M,k as u,b6 as p,bp as Q,D as C}from"./vendor-ux-did-connect-pzpsrvqx.js";import{R as X,H as K}from"./vendor-arcblock-CwufDgLV.js";import{W as V}from"./did-address-NnOD1W_A.js";import{d as $}from"./Home-Dujcj083.js";import{u as q,d as G}from"./index-CwUT0vPy.js";import"./lottie-web-jYmAQWuC.js";function oe(){var f,b,y,_;const{searchParams:r}=new URL(window.location.href),{session:o}=q(),{t:c}=M(),m=r.get("client_id"),k=r.get("scope")||"profile:read",[g,S]=x.useState(k.split(" ").filter(Boolean)),P=I("(max-width: 600px)"),A=v(window.location.origin,u.WELLKNOWN_SERVICE_PATH_PREFIX,"/oauth/authorize"),N=x.useCallback(i=>i?i.startsWith("http")?i:`${v(u.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/media/upload",window.blocklet.appPid)}/${i}`:"",[]),[h,j]=H({client:null,loading:!0});x.useEffect(()=>{(async()=>{const{data:n}=await G.get("/oauth/client",{params:{clientId:m}});j({client:n,loading:!1})})()},[m,j]);const R=i=>{i!=="profile:read"&&S(n=>n.includes(i)?n.filter(E=>E!==i):[...n,i])};if(h.loading||!(o!=null&&o.user))return e.jsx(p,{did:(f=window.blocklet)==null?void 0:f.appPid,standalone:!0,children:e.jsx(t,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsx(z,{})})});if(!h.client)return e.jsx(p,{did:(b=window.blocklet)==null?void 0:b.appPid,standalone:!0,children:e.jsx(t,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsx(X,{style:{backgroundColor:"transparent"},status:"error",title:c("notFoundOauthClient"),extra:e.jsx(d,{variant:"outlined",color:"primary",size:"small",startIcon:e.jsx($,{}),href:"/",style:{borderRadius:4},children:c("connectCli.home")})})})});const{client:s}=h,{user:l}=o,W=(s.scope||"").split(" ");return e.jsxs(p,{did:(y=window.blocklet)==null?void 0:y.appPid,standalone:!0,children:[e.jsx(K,{children:e.jsx("title",{children:c("oauth.authorize")})}),e.jsx(Q,{hideCloseButton:!0,children:e.jsxs(t,{sx:{display:"flex",flexDirection:"column",p:{xs:2,lg:3,xl:4},pt:{xs:3,xl:4},bgcolor:"background.paper"},className:"page-authorize",children:[e.jsxs(t,{sx:{textAlign:"center",mb:2},children:[e.jsxs(t,{sx:{display:"flex",alignItems:"center",justifyContent:"center",mb:2},children:[e.jsx(C,{src:(_=window.blocklet)==null?void 0:_.appLogo,alt:"Server",width:48,height:48}),e.jsxs(t,{sx:{mx:2,display:"flex",alignItems:"center","& .dot":{width:8,height:8,borderRadius:"50%",bgcolor:"divider",mx:.5}},children:[e.jsx(t,{className:"dot"}),e.jsx(t,{className:"dot"}),e.jsx(t,{className:"dot"})]}),e.jsx(C,{src:N(s.logo_uri),alt:s.client_name,width:48,height:48})]}),e.jsxs(a,{sx:{mb:1,fontSize:"1.2rem","& .app-name":{color:"primary.main"}},children:["Authorize ",e.jsx("span",{className:"app-name",children:s.client_name})]})]}),e.jsxs(t,{sx:{display:"flex",alignItems:"center",width:"100%",overflow:"hidden",mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},className:"info",children:[e.jsx(L,{src:l.avatar,style:{width:48,height:48,backgroundColor:"transparent",marginRight:16}}),e.jsxs(t,{sx:{flex:1,overflow:"hidden"},children:[e.jsx(D,{title:l.fullName,children:e.jsx(t,{className:"name",sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:l.fullName})}),e.jsx(t,{className:"did",children:e.jsx(V,{compact:!0,responsive:!1,did:l.did,showQrcode:!P})})]})]}),e.jsxs(a,{variant:"subtitle1",sx:{mb:2,fontWeight:500},children:["Allow ",s.client_name," to do the following on your behalf:"]}),e.jsxs(t,{sx:{border:"1px solid",borderColor:"divider",borderRadius:2,overflow:"hidden"},children:[e.jsx(t,{sx:{p:2},children:e.jsx(O,{children:Object.entries(u.OAUTH_SCOPES).filter(([i])=>W.includes(i)).map(([i,n])=>e.jsx(T,{control:e.jsx(F,{checked:g.includes(i),onChange:()=>R(i),disabled:i==="profile:read"||["blocklet:read","blocklet:write"].includes(i)&&!["owner","admin","member"].includes(l.role),color:"primary",sx:{"&.Mui-checked":{color:"success.main"}}}),label:e.jsx(t,{children:e.jsx(a,{variant:"body1",sx:{fontWeight:500},children:n})}),sx:{mb:0}},i))})}),(s.tos_uri||s.policy_uri)&&e.jsxs(e.Fragment,{children:[e.jsx(B,{}),e.jsx(t,{sx:{height:1,bgcolor:"divider"}}),e.jsx(t,{sx:{p:2,color:"text.secondary"},children:e.jsxs(a,{variant:"body2",children:["By authorize the access, you also agree with the"," ",!!s.tos_uri&&e.jsx(w,{href:s.tos_uri,target:"_blank",children:"Terms of Use"}),!!s.tos_uri&&!!s.policy_uri&&" and ",!!s.policy_uri&&e.jsx(w,{href:s.policy_uri,target:"_blank",children:"Privacy Policy"})]})})]})]}),e.jsxs("form",{method:"POST",action:A,children:[r.get("client_id")&&e.jsx("input",{type:"hidden",name:"client_id",value:r.get("client_id")}),r.get("response_type")&&e.jsx("input",{type:"hidden",name:"response_type",value:r.get("response_type")}),r.get("redirect_uri")&&e.jsx("input",{type:"hidden",name:"redirect_uri",value:r.get("redirect_uri")}),r.get("code_challenge")&&e.jsx("input",{type:"hidden",name:"code_challenge",value:r.get("code_challenge")}),r.get("code_challenge_method")&&e.jsx("input",{type:"hidden",name:"code_challenge_method",value:r.get("code_challenge_method")}),r.get("state")&&e.jsx("input",{type:"hidden",name:"state",value:r.get("state")}),e.jsx("input",{type:"hidden",name:"scope",value:g.join(" ")}),e.jsx(t,{sx:{mt:"auto",pt:3},children:e.jsxs(U,{direction:"row",spacing:2,children:[e.jsx(d,{variant:"outlined",size:"large",fullWidth:!0,type:"submit",name:"action",value:"deny",children:"Cancel"}),e.jsx(d,{variant:"contained",size:"large",fullWidth:!0,type:"submit",name:"action",value:"allow",children:"Authorize"})]})}),r.get("redirect_uri")&&e.jsxs(t,{sx:{mt:3,textAlign:"center"},children:[e.jsx(a,{variant:"body2",color:"text.secondary",children:"You will be redirected to"}),e.jsx(a,{variant:"body2",color:"text.secondary",sx:{wordBreak:"break-all"},children:r.get("redirect_uri")})]}),e.jsx(t,{sx:{mt:2,textAlign:"center"},children:e.jsxs(a,{variant:"body2",children:["Not you?"," ",e.jsx(d,{variant:"text",color:"primary",onClick:()=>o.switchDid(),sx:{p:0,minWidth:"auto",textTransform:"none",verticalAlign:"baseline",fontWeight:"inherit",fontSize:"inherit","&:hover":{background:"none",textDecoration:"underline"}},children:"Use another account"})]})})]})]})})]})}export{oe as default};
1
+ import{v as I,j as e,aa as t,ab as z,y as d,T as a,aq as L,ad as D,bQ as O,bs as T,bR as F,X as B,ap as w,al as U}from"./vendor-mui-core-Bq8gXTan.js";import{r as x}from"./vendor-react-DEoibe3W.js";import{x as H}from"./vendor-hooks-B2N8eE_a.js";import{A as v}from"./vendor-utils-uPLZO5mM.js";import{a as M,k as u,b6 as p,bp as Q,D as C}from"./vendor-ux-did-connect-CQtodyZB.js";import{R as X,H as K}from"./vendor-arcblock-DzylOsX3.js";import{W as V}from"./did-address-BYc4cym-.js";import{d as $}from"./Home-SYcuMunC.js";import{u as q,d as G}from"./index-DBdN7QPA.js";import"./lottie-web-jYmAQWuC.js";function oe(){var f,b,y,_;const{searchParams:r}=new URL(window.location.href),{session:o}=q(),{t:c}=M(),m=r.get("client_id"),k=r.get("scope")||"profile:read",[g,S]=x.useState(k.split(" ").filter(Boolean)),P=I("(max-width: 600px)"),A=v(window.location.origin,u.WELLKNOWN_SERVICE_PATH_PREFIX,"/oauth/authorize"),N=x.useCallback(i=>i?i.startsWith("http")?i:`${v(u.WELLKNOWN_SERVICE_PATH_PREFIX,"/api/media/upload",window.blocklet.appPid)}/${i}`:"",[]),[h,j]=H({client:null,loading:!0});x.useEffect(()=>{(async()=>{const{data:n}=await G.get("/oauth/client",{params:{clientId:m}});j({client:n,loading:!1})})()},[m,j]);const R=i=>{i!=="profile:read"&&S(n=>n.includes(i)?n.filter(E=>E!==i):[...n,i])};if(h.loading||!(o!=null&&o.user))return e.jsx(p,{did:(f=window.blocklet)==null?void 0:f.appPid,standalone:!0,children:e.jsx(t,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsx(z,{})})});if(!h.client)return e.jsx(p,{did:(b=window.blocklet)==null?void 0:b.appPid,standalone:!0,children:e.jsx(t,{sx:{display:"flex",justifyContent:"center",alignItems:"center",height:"100%"},children:e.jsx(X,{style:{backgroundColor:"transparent"},status:"error",title:c("notFoundOauthClient"),extra:e.jsx(d,{variant:"outlined",color:"primary",size:"small",startIcon:e.jsx($,{}),href:"/",style:{borderRadius:4},children:c("connectCli.home")})})})});const{client:s}=h,{user:l}=o,W=(s.scope||"").split(" ");return e.jsxs(p,{did:(y=window.blocklet)==null?void 0:y.appPid,standalone:!0,children:[e.jsx(K,{children:e.jsx("title",{children:c("oauth.authorize")})}),e.jsx(Q,{hideCloseButton:!0,children:e.jsxs(t,{sx:{display:"flex",flexDirection:"column",p:{xs:2,lg:3,xl:4},pt:{xs:3,xl:4},bgcolor:"background.paper"},className:"page-authorize",children:[e.jsxs(t,{sx:{textAlign:"center",mb:2},children:[e.jsxs(t,{sx:{display:"flex",alignItems:"center",justifyContent:"center",mb:2},children:[e.jsx(C,{src:(_=window.blocklet)==null?void 0:_.appLogo,alt:"Server",width:48,height:48}),e.jsxs(t,{sx:{mx:2,display:"flex",alignItems:"center","& .dot":{width:8,height:8,borderRadius:"50%",bgcolor:"divider",mx:.5}},children:[e.jsx(t,{className:"dot"}),e.jsx(t,{className:"dot"}),e.jsx(t,{className:"dot"})]}),e.jsx(C,{src:N(s.logo_uri),alt:s.client_name,width:48,height:48})]}),e.jsxs(a,{sx:{mb:1,fontSize:"1.2rem","& .app-name":{color:"primary.main"}},children:["Authorize ",e.jsx("span",{className:"app-name",children:s.client_name})]})]}),e.jsxs(t,{sx:{display:"flex",alignItems:"center",width:"100%",overflow:"hidden",mb:3,p:2,border:"1px solid",borderColor:"divider",borderRadius:1},className:"info",children:[e.jsx(L,{src:l.avatar,style:{width:48,height:48,backgroundColor:"transparent",marginRight:16}}),e.jsxs(t,{sx:{flex:1,overflow:"hidden"},children:[e.jsx(D,{title:l.fullName,children:e.jsx(t,{className:"name",sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis"},children:l.fullName})}),e.jsx(t,{className:"did",children:e.jsx(V,{compact:!0,responsive:!1,did:l.did,showQrcode:!P})})]})]}),e.jsxs(a,{variant:"subtitle1",sx:{mb:2,fontWeight:500},children:["Allow ",s.client_name," to do the following on your behalf:"]}),e.jsxs(t,{sx:{border:"1px solid",borderColor:"divider",borderRadius:2,overflow:"hidden"},children:[e.jsx(t,{sx:{p:2},children:e.jsx(O,{children:Object.entries(u.OAUTH_SCOPES).filter(([i])=>W.includes(i)).map(([i,n])=>e.jsx(T,{control:e.jsx(F,{checked:g.includes(i),onChange:()=>R(i),disabled:i==="profile:read"||["blocklet:read","blocklet:write"].includes(i)&&!["owner","admin","member"].includes(l.role),color:"primary",sx:{"&.Mui-checked":{color:"success.main"}}}),label:e.jsx(t,{children:e.jsx(a,{variant:"body1",sx:{fontWeight:500},children:n})}),sx:{mb:0}},i))})}),(s.tos_uri||s.policy_uri)&&e.jsxs(e.Fragment,{children:[e.jsx(B,{}),e.jsx(t,{sx:{height:1,bgcolor:"divider"}}),e.jsx(t,{sx:{p:2,color:"text.secondary"},children:e.jsxs(a,{variant:"body2",children:["By authorize the access, you also agree with the"," ",!!s.tos_uri&&e.jsx(w,{href:s.tos_uri,target:"_blank",children:"Terms of Use"}),!!s.tos_uri&&!!s.policy_uri&&" and ",!!s.policy_uri&&e.jsx(w,{href:s.policy_uri,target:"_blank",children:"Privacy Policy"})]})})]})]}),e.jsxs("form",{method:"POST",action:A,children:[r.get("client_id")&&e.jsx("input",{type:"hidden",name:"client_id",value:r.get("client_id")}),r.get("response_type")&&e.jsx("input",{type:"hidden",name:"response_type",value:r.get("response_type")}),r.get("redirect_uri")&&e.jsx("input",{type:"hidden",name:"redirect_uri",value:r.get("redirect_uri")}),r.get("code_challenge")&&e.jsx("input",{type:"hidden",name:"code_challenge",value:r.get("code_challenge")}),r.get("code_challenge_method")&&e.jsx("input",{type:"hidden",name:"code_challenge_method",value:r.get("code_challenge_method")}),r.get("state")&&e.jsx("input",{type:"hidden",name:"state",value:r.get("state")}),e.jsx("input",{type:"hidden",name:"scope",value:g.join(" ")}),e.jsx(t,{sx:{mt:"auto",pt:3},children:e.jsxs(U,{direction:"row",spacing:2,children:[e.jsx(d,{variant:"outlined",size:"large",fullWidth:!0,type:"submit",name:"action",value:"deny",children:"Cancel"}),e.jsx(d,{variant:"contained",size:"large",fullWidth:!0,type:"submit",name:"action",value:"allow",children:"Authorize"})]})}),r.get("redirect_uri")&&e.jsxs(t,{sx:{mt:3,textAlign:"center"},children:[e.jsx(a,{variant:"body2",color:"text.secondary",children:"You will be redirected to"}),e.jsx(a,{variant:"body2",color:"text.secondary",sx:{wordBreak:"break-all"},children:r.get("redirect_uri")})]}),e.jsx(t,{sx:{mt:2,textAlign:"center"},children:e.jsxs(a,{variant:"body2",children:["Not you?"," ",e.jsx(d,{variant:"text",color:"primary",onClick:()=>o.switchDid(),sx:{p:0,minWidth:"auto",textTransform:"none",verticalAlign:"baseline",fontWeight:"inherit",fontSize:"inherit","&:hover":{background:"none",textDecoration:"underline"}},children:"Use another account"})]})})]})]})})]})}export{oe as default};