@abtnode/blocklet-services 1.16.44-beta-20250528-003415-7a5e5d90 → 1.16.44-beta-20250529-223630-10e16ac8
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.
- package/api/middlewares/proxy-to-daemon.js +2 -1
- package/api/routes/env.js +5 -0
- package/dist/assets/{AdapterDayjs-gCvKcGfu.js → AdapterDayjs-CDDcwz3P.js} +1 -1
- package/dist/assets/{ArrowDropDown-D32FY-Mt.js → ArrowDropDown-DPqiF9Rw.js} +1 -1
- package/dist/assets/{CheckCircle-BBSSDlcc.js → CheckCircle-Caqp5gKY.js} +1 -1
- package/dist/assets/{ChevronLeft-CF24ouxR.js → ChevronLeft-DONyUbIg.js} +1 -1
- package/dist/assets/{ChevronRight-DA9t_C-l.js → ChevronRight-DgAwWLdY.js} +1 -1
- package/dist/assets/{DeleteOutline-CzIOFoFP.js → DeleteOutline-DpNyWtNL.js} +1 -1
- package/dist/assets/{Done-MQdb8YLa.js → Done-BTd13H2U.js} +1 -1
- package/dist/assets/{Download-IxxF4Ujs.js → Download-Bm8sKXA2.js} +1 -1
- package/dist/assets/{Edit-DSht16TX.js → Edit-CUl1Rt8i.js} +1 -1
- package/dist/assets/{Error-CkoCqY66.js → Error-DEKvwVoF.js} +1 -1
- package/dist/assets/{ExpandLess-CudE_1oQ.js → ExpandLess-t1cH-Bc4.js} +1 -1
- package/dist/assets/{Google-AZBuQJFI.js → Google-Bn3zPWiu.js} +1 -1
- package/dist/assets/{Home-BaA3V3I7.js → Home-C3ax1tQ7.js} +1 -1
- package/dist/assets/{InfoOutlined-Cd28U1Oc.js → InfoOutlined-D3XnF0Vg.js} +1 -1
- package/dist/assets/{Launch-Ddo_WSQI.js → Launch-Dz9mQnYC.js} +1 -1
- package/dist/assets/{LaunchOutlined-CO4dugwH.js → LaunchOutlined-E7HcQu_6.js} +1 -1
- package/dist/assets/{MoreHoriz-D-L8sA4c.js → MoreHoriz-DpKn_fkc.js} +1 -1
- package/dist/assets/{PlayArrow-CLKgdv6H.js → PlayArrow-CDOOUxMp.js} +1 -1
- package/dist/assets/{TuneOutlined-BWqIZK2m.js → TuneOutlined-D0gGDoIJ.js} +1 -1
- package/dist/assets/{ViewList-DWudZTBg.js → ViewList-C8G9e3ft.js} +1 -1
- package/dist/assets/{access-control-DlT-JQML.js → access-control-BhxOcGdx.js} +1 -1
- package/dist/assets/{actions-azdiYocL.js → actions-DP7pj6xB.js} +1 -1
- package/dist/assets/{add-component-core-Cm8Y0zkt.js → add-component-core-XUReAzat.js} +1 -1
- package/dist/assets/{add-resource-CVCoahx_.js → add-resource-C3kDcfBw.js} +1 -1
- package/dist/assets/{addon-3ZMGwARO.js → addon-CRj4Enw7.js} +1 -1
- package/dist/assets/{advanced-Nvg1CqJg.js → advanced-hz-KSWn2.js} +3 -3
- package/dist/assets/appearance-ChvtVBNv.js +1 -0
- package/dist/assets/{ar-T0OvMFDJ.js → ar-CSZJf27k.js} +1 -1
- package/dist/assets/{audit-logs-BPjUleS-.js → audit-logs-DXoc97BV.js} +1 -1
- package/dist/assets/authorize-_fbQ19S4.js +1 -0
- package/dist/assets/{base32-CLrnUJal.js → base32-WurN0cIW.js} +1 -1
- package/dist/assets/{branding-B8r8EJ2R.js → branding-DpkSF6dd.js} +2 -2
- package/dist/assets/{branding-Cr4GBUXi.js → branding-DuPWVNlC.js} +1 -1
- package/dist/assets/{bundle-avatar-Br48PGS5.js → bundle-avatar-D4fwror8.js} +1 -1
- package/dist/assets/{button-8G90WP8a.js → button-_1HExv7r.js} +1 -1
- package/dist/assets/{click-to-copy-ByEMWZD_.js → click-to-copy-R7MF4AwY.js} +1 -1
- package/dist/assets/{collapse-Cliwxlbv.js → collapse-l9wHY9gJ.js} +1 -1
- package/dist/assets/{complete-CzlLydJT.js → complete-C5D4D-fJ.js} +1 -1
- package/dist/assets/{component-5_wmVxpp.js → component-CURpjZJ2.js} +1 -1
- package/dist/assets/{config-BnObxTpi.js → config-Cd14MJHa.js} +1 -1
- package/dist/assets/{config-emhMgKqq.js → config-e36Xplpo.js} +1 -1
- package/dist/assets/config-navigation-BvjYZI_j.js +26 -0
- package/dist/assets/{config-space-TsP5osn9.js → config-space-EoSm62Er.js} +1 -1
- package/dist/assets/{confirm-DI8TUyRK.js → confirm-Vzr2I9eM.js} +1 -1
- package/dist/assets/{connect-D55qWQWC.js → connect-B5Xr7MId.js} +1 -1
- package/dist/assets/{connect-B_BnGQjp.js → connect-DXOsnqkO.js} +1 -1
- package/dist/assets/{connect-to-DzPwhREN.js → connect-to-Bz9wYM04.js} +1 -1
- package/dist/assets/{dashboard-AdC8-kkA.js → dashboard-xUr1SbPS.js} +3 -3
- package/dist/assets/{de-WYW4JJdA.js → de-C-F2uwju.js} +1 -1
- package/dist/assets/de-CA1MfHz7.js +1 -0
- package/dist/assets/{delete-confirm-Bn1HZjaL.js → delete-confirm-DNn4Os6R.js} +1 -1
- package/dist/assets/{did-address-BlAXR08O.js → did-address-Dq-4__HB.js} +1 -1
- package/dist/assets/{domain-Cod_zL8_.js → domain-XXgOrJDa.js} +1 -1
- package/dist/assets/{domain-action-card-C4FpSn67.js → domain-action-card-Cf1AoKOi.js} +1 -1
- package/dist/assets/domains-DeFj6Ipl.js +1 -0
- package/dist/assets/{email-CqVIYJc4.js → email-BIVfXnpk.js} +1 -1
- package/dist/assets/{es-DaHPJdAX.js → es-B2TJqtV4.js} +1 -1
- package/dist/assets/{es-B6GuFK3b.js → es-CXgvF2gS.js} +1 -1
- package/dist/assets/{exchange-passport-C-hTCqg0.js → exchange-passport-C9Pvr9Da.js} +1 -1
- package/dist/assets/fr-CzO5Th4h.js +1 -0
- package/dist/assets/{fr-Sdn9hi8k.js → fr-DN38boH3.js} +1 -1
- package/dist/assets/{fuel-M5L6Wmxz.js → fuel-Cs--pEYt.js} +1 -1
- package/dist/assets/{gen-access-key-D6jr4e_G.js → gen-access-key-CIzULsBE.js} +1 -1
- package/dist/assets/{get-safe-url-CRv5HbAK.js → get-safe-url-Q70tRxL7.js} +1 -1
- package/dist/assets/{get-safe-url-DrR-6D-i.js → get-safe-url-c4iAcpvA.js} +1 -1
- package/dist/assets/{hi-dJuR0lt2.js → hi-5tixPGqk.js} +1 -1
- package/dist/assets/hi-lZ18vyMl.js +1 -0
- package/dist/assets/{home-C7e6Ftxj.js → home-BZ8WpcWZ.js} +1 -1
- package/dist/assets/{id-DuYS34H0.js → id-CIDM1ypY.js} +1 -1
- package/dist/assets/id-QM66qYoI.js +1 -0
- package/dist/assets/{iframe-DSG-Hd99.js → iframe-Dl8NEFc5.js} +1 -1
- package/dist/assets/{index-AetYfL_f.js → index-B7IOoVDF.js} +1 -1
- package/dist/assets/{index-yvg4DpNi.js → index-BCJADuMw.js} +5 -5
- package/dist/assets/{index-BJHSgjnI.js → index-BKKwhjBs.js} +1 -1
- package/dist/assets/{index-iQsPOXlb.js → index-BU2FTGFr.js} +1 -1
- package/dist/assets/{index-DSoHmrHd.js → index-BUHyq-oP.js} +1 -1
- package/dist/assets/{index-BM1ZGOPs.js → index-BoTgqYtV.js} +2 -2
- package/dist/assets/{index-C4vmLohg.js → index-C64IgZKt.js} +1 -1
- package/dist/assets/{index-bIHubQ8z.js → index-CsXmgylH.js} +3 -3
- package/dist/assets/index-D-Lxloq5.js +284 -0
- package/dist/assets/{index-Bj2-CpPI.js → index-D1kTR2xk.js} +1 -1
- package/dist/assets/{index-CEeLwMYO.js → index-DBqLPDUh.js} +1 -1
- package/dist/assets/index-DDXNOodN.js +99 -0
- package/dist/assets/{index-YbYWmpAT.js → index-DDoVX3je.js} +22 -22
- package/dist/assets/{index-B5_fBwtl.js → index-Drd9jydY.js} +1 -1
- package/dist/assets/{index-BUrgmCmL.js → index-Dsd9SXVN.js} +1 -1
- package/dist/assets/index-DvBh35bh.js +1 -0
- package/dist/assets/{index-BFWnCQrF.js → index-I6_gMaPh.js} +1 -1
- package/dist/assets/{index-C2F-GVrD.js → index-U3mAyHwS.js} +1 -1
- package/dist/assets/{index-BLbU4gf9.js → index-W_fQ-nuf.js} +2 -2
- package/dist/assets/{index-rn2nf2kX.js → index-wLX5GW2c.js} +1 -1
- package/dist/assets/{invitation-StUiuLYU.js → invitation-Dsnc8lab.js} +1 -1
- package/dist/assets/{invite-E96eT2DF.js → invite-CvAru4rZ.js} +1 -1
- package/dist/assets/{issue-passport-DrGPTNsG.js → issue-passport-CDE6vHUE.js} +1 -1
- package/dist/assets/{item-Dgu9vLko.js → item-rXnALS3b.js} +1 -1
- package/dist/assets/{ja-ACgKScTi.js → ja-C8AmHPMo.js} +1 -1
- package/dist/assets/{ja-Dh60q0r5.js → ja-pJLB4V2E.js} +1 -1
- package/dist/assets/{ko-CoqvBZUf.js → ko-D2NP5Ixe.js} +1 -1
- package/dist/assets/ko-xDWtmcv7.js +1 -0
- package/dist/assets/{landing-page-BOy_W1aP.js → landing-page-DrVLCVAm.js} +1 -1
- package/dist/assets/{layout-CYJJYqb_.js → layout-DYG0Wl7R.js} +1 -1
- package/dist/assets/{list-uPz9xAWJ.js → list-DLMy1vVs.js} +1 -1
- package/dist/assets/list-b96sX5Y6.js +2 -0
- package/dist/assets/localization-Bb0kc8SQ.js +1 -0
- package/dist/assets/{log-CzRRb9lq.js → log-Bwqh69bM.js} +1 -1
- package/dist/assets/{logger-B4ZKcD6x.js → logger-BAVOmOw2.js} +1 -1
- package/dist/assets/{login-D3GnBJn4.js → login-Ygmj8_J7.js} +1 -1
- package/dist/assets/{login-oauth-callback-CVS9TwNM.js → login-oauth-callback-BrnNJIOK.js} +1 -1
- package/dist/assets/{logo-uploader-CbM-N8qP.js → logo-uploader-CLwbDhA_.js} +3 -3
- package/dist/assets/{lost-passport-5P2EFbv0.js → lost-passport-CqzPSoLw.js} +1 -1
- package/dist/assets/{open-window-c9TGr49M.js → open-window-Bl24RBAD.js} +1 -1
- package/dist/assets/{overview-BZRXhA-K.js → overview-DqabCKYi.js} +1 -1
- package/dist/assets/{page-header-D_m0ANZl.js → page-header-BWqvvXOk.js} +1 -1
- package/dist/assets/{passport-item-DE-9Q-Cx.js → passport-item-C5-ZuTPM.js} +1 -1
- package/dist/assets/{permission-fpFyADH8.js → permission-DSHe73ba.js} +1 -1
- package/dist/assets/{preferences-0RYr2e_y.js → preferences-BzGNV3pM.js} +1 -1
- package/dist/assets/{profile-embed-BwbGy3El.js → profile-embed-iA-d50c3.js} +1 -1
- package/dist/assets/{pt-DCcbs0d0.js → pt-D1apbJwE.js} +1 -1
- package/dist/assets/pt-DSj10b9i.js +1 -0
- package/dist/assets/{publish-resource-CWz86TY0.js → publish-resource-ebKgw7OW.js} +1 -1
- package/dist/assets/{react-beautiful-dnd.esm-G9cRB9Uf.js → react-beautiful-dnd.esm-Ck4xzwyU.js} +1 -1
- package/dist/assets/ru-BNuzbw_f.js +1 -0
- package/dist/assets/{ru-WYTV5VzH.js → ru-D2AG9Iea.js} +1 -1
- package/dist/assets/{runtime-63aIXcah.js → runtime-B454s6Gb.js} +1 -1
- package/dist/assets/sdk-DeS3iq37.js +1 -0
- package/dist/assets/{section-BB6hVmdO.js → section-Ccxg0x_Y.js} +1 -1
- package/dist/assets/{security-YPRPQuQL.js → security-DCArL_za.js} +1 -1
- package/dist/assets/{session-Djj2U6sa.js → session-C_8V_o-O.js} +1 -1
- package/dist/assets/{setup-C9DGbmM7.js → setup-CX2pUl2y.js} +3 -3
- package/dist/assets/{spaces-fGcGlx-U.js → spaces-DApg1wzn.js} +1 -1
- package/dist/assets/{start-Cz_j6UYt.js → start-Dhbx5j_D.js} +1 -1
- package/dist/assets/{starting-progress-DHv9oucO.js → starting-progress-BHUTOY2b.js} +1 -1
- package/dist/assets/{status-B5ff49WY.js → status-D4K-kiXO.js} +1 -1
- package/dist/assets/{step-actions-CPiUgWLW.js → step-actions-CISMVGx2.js} +1 -1
- package/dist/assets/{studio-DnKLD9XD.js → studio-1mTu0Fgs.js} +1 -1
- package/dist/assets/{switch-control-DWjnOuBy.js → switch-control-CpCSorUo.js} +1 -1
- package/dist/assets/{table-tips-DEGQUNJa.js → table-tips-BfSSGl9N.js} +1 -1
- package/dist/assets/{th-Da4lMKTX.js → th-CRGgyPc5.js} +1 -1
- package/dist/assets/th-CsJSfFsn.js +1 -0
- package/dist/assets/{traffic-C262RTgV.js → traffic-BqHyn9L9.js} +1 -1
- package/dist/assets/{transfer-CXfjw5Xg.js → transfer-Bqv1gMqL.js} +1 -1
- package/dist/assets/{unsubscribe-CdFXzPwR.js → unsubscribe-B3OLQIVA.js} +1 -1
- package/dist/assets/{use-blocklet-logo-C_pDvfYN.js → use-blocklet-logo-Bhkp-Zm7.js} +1 -1
- package/dist/assets/use-server-logo-CxuMvwKh.js +1 -1
- package/dist/assets/{useLocalStorage-DO6t2PeQ.js → useLocalStorage-D6gvgmEW.js} +1 -1
- package/dist/assets/{user-center-DR1kV4iN.js → user-center-vIx28YXm.js} +3 -3
- package/dist/assets/{util-VM27PwRk.js → util-DMfPwzVN.js} +1 -1
- package/dist/assets/{util-Cs-QbPU0.js → util-Dnkhck-D.js} +1 -1
- package/dist/assets/{vendor-arcblock-DuPySS9V.js → vendor-arcblock-BlrkGjK9.js} +1 -1
- package/dist/assets/{vendor-ux-did-connect-DIlRfE_S.js → vendor-ux-did-connect-2jRoUb28.js} +3 -3
- package/dist/assets/vi-Ce8JEW56.js +1 -0
- package/dist/assets/{vi-BxzaqoH9.js → vi-IIi6v-et.js} +1 -1
- package/dist/assets/wrap-locale-C_UOH97U.js +1 -0
- package/dist/assets/{zh-Do6onry4.js → zh-DQX0RFjY.js} +1 -1
- package/dist/assets/zh-S-Nv5zr-.js +1 -0
- package/dist/assets/{zh-tw-BNgoHsYW.js → zh-tw-6n1CYpHc.js} +1 -1
- package/dist/assets/zh-tw-C-FYOTmO.js +1 -0
- package/dist/index.html +3 -3
- package/dist/service-worker.js +1 -1
- package/package.json +30 -30
- package/api/middlewares/check-admin-permission.js +0 -15
- package/dist/assets/appearance-CAsFMLaC.js +0 -1
- package/dist/assets/authorize-CdTK5Air.js +0 -1
- package/dist/assets/config-navigation-DbyhYIMw.js +0 -26
- package/dist/assets/de-BWtUXhCw.js +0 -1
- package/dist/assets/domains-BhqtMbC1.js +0 -1
- package/dist/assets/fr-DjhyyiEi.js +0 -1
- package/dist/assets/hi-CtKbt1J4.js +0 -1
- package/dist/assets/id-CCuL3FP-.js +0 -1
- package/dist/assets/index-BJbAX71g.js +0 -284
- package/dist/assets/index-CtLialsm.js +0 -99
- package/dist/assets/index-DthGrDK3.js +0 -1
- package/dist/assets/ko-gvJH4zFR.js +0 -1
- package/dist/assets/list-C8X2Voou.js +0 -2
- package/dist/assets/localization-CI5Q0B2F.js +0 -1
- package/dist/assets/pt-DzswFIpl.js +0 -1
- package/dist/assets/ru-EZJWVu3M.js +0 -1
- package/dist/assets/sdk-D4BoQHdn.js +0 -1
- package/dist/assets/th-Bn3Ch7SK.js +0 -1
- package/dist/assets/vi-CgnGroV4.js +0 -1
- package/dist/assets/wrap-locale-BWx2hEb7.js +0 -1
- package/dist/assets/zh-BWgwGxeZ.js +0 -1
- package/dist/assets/zh-tw-Ciod1pFs.js +0 -1
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import{r as Ee,e as ze}from"./vendor-react-DEoibe3W.js";import{a9 as bt,j as q,ab as
|
|
1
|
+
import{r as Ee,e as ze}from"./vendor-react-DEoibe3W.js";import{a9 as bt,j as q,ab as Ze,H as Oe,aa as U,y as hr,T as Be,ah as _t,bs as dr,bR as mr,bx as pr,ak as gr,E as yr,al as wt,O as vr,N as br,bt as We,X as Le,ad as _r}from"./vendor-mui-core-BV2FUxWJ.js";import{D as Je,G as wr,f as xr,aL as Mr,n as $r,aD as kr,z as Qt,W as tr,V as rr}from"./index-DDoVX3je.js";import{P as jr,w as He}from"./permission-DSHe73ba.js";import{r as xt,a as Ve,B as qe,a0 as Te,aq as sr,e as Sr,ao as nr,bY as Rr,aL as Ar,h as Ce,j as Or,Z as Xt,b4 as Er}from"./vendor-ux-did-connect-2jRoUb28.js";import{x as ir}from"./vendor-hooks-BgUTpb6X.js";import{c as Ne}from"./vendor-arcblock-BlrkGjK9.js";import{d as Dr}from"./InfoOutlined-D3XnF0Vg.js";import{C as Mt}from"./confirm-Vzr2I9eM.js";import{f as Ue}from"./index-8eXqqyHQ.js";import{_ as Cr}from"./useSetState-CWq0AVWn.js";import{u as ar}from"./session-C_8V_o-O.js";import{S as Ie}from"./section-Ccxg0x_Y.js";import{C as Ir}from"./click-to-copy-R7MF4AwY.js";import{u as or}from"./dashboard-xUr1SbPS.js";import{r as Tr,aL as Lr}from"./vendor-utils-rHXShPKm.js";import{I as qr}from"./index-BUHyq-oP.js";import{W as Nr}from"./did-address-Dq-4__HB.js";import{V as Pr}from"./status-D4K-kiXO.js";import"./lottie-web-jYmAQWuC.js";import"./useLocalStorage-D6gvgmEW.js";import"./PlayArrow-CDOOUxMp.js";import"./get-safe-url-c4iAcpvA.js";import"./use-blocklet-logo-Bhkp-Zm7.js";import"./dot-itVN8XTt.js";import"./useAsync-510ntT1B.js";import"./use-mobile-C21X4TYN.js";import"./omit-D2k92RIF.js";var $t={},zr=bt;Object.defineProperty($t,"__esModule",{value:!0});var lr=$t.default=void 0,Fr=zr(xt()),Br=q;lr=$t.default=(0,Fr.default)((0,Br.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 kt={},Jr=bt;Object.defineProperty(kt,"__esModule",{value:!0});var jt=kt.default=void 0,Ur=Jr(xt()),er=q;jt=kt.default=(0,Ur.default)([(0,er.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,er.jsx)("circle",{cx:"16",cy:"12",r:"1.5"},"1")],"AccountBalanceWalletOutlined");const Vr=localStorage.getItem("enableDebug")==="true";function Wr({teamDid:I,size:P="small",...B}){const{t:T}=Ve(),{api:L}=Je(),[p,_]=Ee.useState(!1),[l,x]=Ee.useState(null),b=()=>{_(!1),x(null)},m=async()=>{var a;try{_(!0);const i=await L.clearCache({input:{teamDid:I}});Te.success(T("blocklet.config.clearCache.success",{count:((a=i.removed)==null?void 0:a.length)||0}))}catch(i){Te.error(Ue(i))}finally{_(!1),x(null)}},e={title:T("blocklet.config.clearCache.title"),description:T("blocklet.config.clearCache.description"),confirm:T("common.confirm"),cancel:T("common.cancel"),onConfirm:m,onCancel:b};return q.jsxs("div",{...B,children:[q.jsxs(qe,{onClick:()=>x(e),color:"error",variant:"outlined",size:P,children:[p?q.jsx(Ze,{size:16,style:{marginRight:5}}):null,T("blocklet.config.clearCache.action")]}),l&&q.jsx(Mt,{title:l.title,description:l.description,confirm:l.confirm,cancel:l.cancel,onConfirm:l.onConfirm,onCancel:l.onCancel})]})}var St={},Kr=bt;Object.defineProperty(St,"__esModule",{value:!0});var cr=St.default=void 0,Zr=Kr(xt()),Hr=q;cr=St.default=(0,Zr.default)((0,Hr.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 Rt({onChange:I,disabled:P,loading:B,inService:T}){const{t:L}=Ve(),{api:p,session:_}=ar(),{blocklet:l}=wr(),[x,b]=Cr({newAppSk:"",isConnectOpen:!1,confirmDialogOpen:!1}),m=()=>b({isConnectOpen:!1}),e=()=>{if(xr.isInProgress(l.status)){Te.error(L("blocklet.error.isInProgress"));return}b({confirmDialogOpen:!0})};return q.jsxs(q.Fragment,{children:[q.jsx(Ie,{title:L("blocklet.config.migrate.button"),desc:L("blocklet.config.migrate.description"),children:q.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:q.jsxs(hr,{style:{flexShrink:0},variant:"contained",color:"primary",size:"small","data-cy":"config-did",disabled:P||B,onClick:e,children:[q.jsx(cr,{style:{fontSize:"1.3em",marginRight:4}}),L("blocklet.config.migrate.button")]})})}),q.jsxs(q.Fragment,{children:[x.isConnectOpen&&q.jsx(sr,{popup:!0,open:x.isConnectOpen,forceConnected:!1,saveConnect:!1,action:"rotate-key-pair",checkFn:p.get,checkTimeout:5*60*1e3,onSuccess:()=>{I(),T&&_.logout(),m()},extraParams:{appDid:l.appDid},messages:{title:L("setup.keyPair.title"),scan:L("setup.keyPair.scan"),confirm:L("setup.keyPair.confirm"),success:L("setup.keyPair.success")},onClose:m}),x.confirmDialogOpen&&q.jsx(Mt,{title:q.jsx(Be,{sx:{fontSize:"20px",fontWeight:"500"},children:L("blocklet.config.migrate.title")}),description:q.jsx(Be,{sx:{fontSize:"14px",color:"#9397A1"},children:L("blocklet.config.migrate.confirm")}),confirm:L("common.confirm"),cancel:L("common.cancel"),onConfirm:()=>b({confirmDialogOpen:!1,isConnectOpen:!0}),onCancel:()=>b({confirmDialogOpen:!1})})]})]})}Rt.propTypes={onChange:Oe.func,disabled:Oe.bool,loading:Oe.bool,inService:Oe.bool};Rt.defaultProps={onChange:()=>{},disabled:!1,loading:!1,inService:!1};function At({onCancel:I,onSuccess:P,onError:B}){const{api:T}=Ee.useContext(Sr),[L,p]=Ee.useState(!1),{t:_,locale:l}=Ve(),[x,b]=Ee.useState(""),[m,e]=Ee.useState(!1),[a,i]=Ee.useState(0),[r,t]=Ee.useState(""),{endpoint:c}=or(),[s,o]=Ee.useState(!1),h=f=>{b(null),p(!0);try{t(f.result),i(R.length-1)}catch(y){const M=Ue(y);b(M),B(y)}finally{p(!1)}},g=()=>{e(!0),i(1)},w=()=>{e(!1),i(0)},R=[{body:q.jsxs(U,{children:[q.jsx(Be,{children:_("team.transferApp.transferDialog.tips.progress")}),q.jsx(Be,{mt:3,mb:2,children:_("team.transferApp.transferDialog.tips.newOwnerPermissions")})]}),cancel:_("common.cancel"),confirm:_("team.transferApp.transferDialog.createTransferLink"),onCancel:I,onConfirm:g},{cancel:_("common.cancel"),confirm:_("team.transferApp.transferDialog.createTransferLink"),body:()=>q.jsx(sr,{action:"transfer-app-owner",open:m,locale:l,checkFn:T.get,onClose:w,onSuccess:h,checkTimeout:5*60*1e3,extraParams:{},messages:{title:_("team.transferApp.connectDialog.title"),scan:_("team.transferApp.connectDialog.scan"),confirm:_("team.transferApp.connectDialog.confirm"),success:_("team.transferApp.connectDialog.success")},popup:!0})},{body:()=>{const f=Mr({transferId:r.transferId,endpoint:c});return q.jsxs(q.Fragment,{children:[q.jsx(U,{component:Fe,dangerouslySetInnerHTML:{__html:_("team.transferApp.transferDialog.createSuccessTip1")}}),q.jsx(U,{component:Fe,mt:2,children:q.jsx(Fe,{children:_("team.transferApp.transferDialog.createSuccessTip3")})}),q.jsxs(U,{children:[q.jsx(U,{component:Fe,mt:2,children:q.jsx(Fe,{children:_("team.transferApp.transferDialog.createSuccessTip2",{expireDate:$r(r.expireDate,l)})})}),q.jsx(U,{my:1,children:q.jsx(Ir,{children:f})})]}),q.jsx("div",{children:q.jsx(dr,{value:"end",control:q.jsx(mr,{checked:s,onChange:y=>o(y.target.checked)}),label:_("team.transferApp.transferDialog.iKnow"),labelPlacement:"end"})})]})},confirm:_("common.confirm"),onConfirm:P}],j=R[a];return q.jsxs(nr,{title:q.jsx(Fe,{className:"title",children:_("team.transferApp.transferDialog.title")}),fullWidth:!0,open:!0,showCloseButton:!1,actions:q.jsxs(q.Fragment,{children:[j.cancel&&q.jsx(qe,{onClick:j.onCancel,color:"inherit",children:j.cancel}),q.jsxs(qe,{onClick:j.onConfirm,color:"error",disabled:L||a===R.length-1&&!s,variant:"contained",autoFocus:!0,children:[L&&q.jsx(Ze,{size:16}),j.confirm]})]}),children:[q.jsx(pr,{component:"div",children:typeof j.body=="function"?j.body():j.body}),!!x&&q.jsx(gr,{severity:"error",variant:"icon",children:x})]})}At.propTypes={onCancel:Oe.func.isRequired,onSuccess:Oe.func.isRequired,onError:Oe.func};At.defaultProps={onError:()=>{}};const Fe=_t.div`
|
|
2
2
|
font-size: 16px;
|
|
3
3
|
font-weight: bold;
|
|
4
4
|
&.title {
|
|
5
5
|
font-size: 20px;
|
|
6
6
|
}
|
|
7
|
-
`;var ur={},fr={exports:{}};(function(I,P){(function(B,T){I.exports=T()})(self,()=>{return B={7629:(L,p,w)=>{const l=w(375),$=w(8571),y=w(9474),m=w(1687),e=w(8652),a=w(8160),i=w(3292),r=w(6354),t=w(8901),c=w(9708),s=w(6914),o=w(2294),h=w(6133),g=w(1152),b=w(8863),j=w(2036),k={Base:class{constructor(f){this.type=f,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new o.Ids,this._preferences=null,this._refs=new h.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 l(typeof c.describe=="function","Manifest functionality disabled"),c.describe(this)}allow(...f){return a.verifyFlat(f,"allow"),this._values(f,"_valids")}alter(f){l(f&&typeof f=="object"&&!Array.isArray(f),"Invalid targets argument"),l(!this._inRuleset(),"Cannot set alterations inside a ruleset");const v=this.clone();v.$_terms.alterations=v.$_terms.alterations||[];for(const x in f){const E=f[x];l(typeof E=="function","Alteration adjuster for",x,"must be a function"),v.$_terms.alterations.push({target:x,adjuster:E})}return v.$_temp.ruleset=!1,v}artifact(f){return l(f!==void 0,"Artifact cannot be undefined"),l(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",f)}cast(f){return l(f===!1||typeof f=="string","Invalid to value"),l(f===!1||this._definition.cast[f],"Type",this.type,"does not support casting to",f),this.$_setFlag("cast",f===!1?void 0:f)}default(f,v){return this._default("default",f,v)}description(f){return l(f&&typeof f=="string","Description must be a non-empty string"),this.$_setFlag("description",f)}empty(f){const v=this.clone();return f!==void 0&&(f=v.$_compile(f,{override:!1})),v.$_setFlag("empty",f,{clone:!1})}error(f){return l(f,"Missing error"),l(f instanceof Error||typeof f=="function","Must provide a valid Error object or a function"),this.$_setFlag("error",f)}example(f,v={}){return l(f!==void 0,"Missing example"),a.assertOptions(v,["override"]),this._inner("examples",f,{single:!0,override:v.override})}external(f,v){return typeof f=="object"&&(l(!v,"Cannot combine options with description"),v=f.description,f=f.method),l(typeof f=="function","Method must be a function"),l(v===void 0||v&&typeof v=="string","Description must be a non-empty string"),this._inner("externals",{method:f,description:v},{single:!0})}failover(f,v){return this._default("failover",f,v)}forbidden(){return this.presence("forbidden")}id(f){return f?(l(typeof f=="string","id must be a non-empty string"),l(/^[^\.]+$/.test(f),"id cannot contain period character"),this.$_setFlag("id",f)):this.$_setFlag("id",void 0)}invalid(...f){return this._values(f,"_invalids")}label(f){return l(f&&typeof f=="string","Label name must be a non-empty string"),this.$_setFlag("label",f)}meta(f){return l(f!==void 0,"Meta cannot be undefined"),this._inner("metas",f,{single:!0})}note(...f){l(f.length,"Missing notes");for(const v of f)l(v&&typeof v=="string","Notes must be non-empty strings");return this._inner("notes",f)}only(f=!0){return l(typeof f=="boolean","Invalid mode:",f),this.$_setFlag("only",f)}optional(){return this.presence("optional")}prefs(f){l(f,"Missing preferences"),l(f.context===void 0,"Cannot override context"),l(f.externals===void 0,"Cannot override externals"),l(f.warnings===void 0,"Cannot override warnings"),l(f.debug===void 0,"Cannot override debug"),a.checkPreferences(f);const v=this.clone();return v._preferences=a.preferences(v._preferences,f),v}presence(f){return l(["optional","required","forbidden"].includes(f),"Unknown presence mode",f),this.$_setFlag("presence",f)}raw(f=!0){return this.$_setFlag("result",f?"raw":void 0)}result(f){return l(["raw","strip"].includes(f),"Unknown result mode",f),this.$_setFlag("result",f)}required(){return this.presence("required")}strict(f){const v=this.clone(),x=f!==void 0&&!f;return v._preferences=a.preferences(v._preferences,{convert:x}),v}strip(f=!0){return this.$_setFlag("result",f?"strip":void 0)}tag(...f){l(f.length,"Missing tags");for(const v of f)l(v&&typeof v=="string","Tags must be non-empty strings");return this._inner("tags",f)}unit(f){return l(f&&typeof f=="string","Unit name must be a non-empty string"),this.$_setFlag("unit",f)}valid(...f){a.verifyFlat(f,"valid");const v=this.allow(...f);return v.$_setFlag("only",!!v._valids,{clone:!1}),v}when(f,v){const x=this.clone();x.$_terms.whens||(x.$_terms.whens=[]);const E=i.when(x,f,v);if(!["any","link"].includes(x.type)){const N=E.is?[E]:E.switch;for(const M of N)l(!M.then||M.then.type==="any"||M.then.type===x.type,"Cannot combine",x.type,"with",M.then&&M.then.type),l(!M.otherwise||M.otherwise.type==="any"||M.otherwise.type===x.type,"Cannot combine",x.type,"with",M.otherwise&&M.otherwise.type)}return x.$_terms.whens.push(E),x.$_mutateRebuild()}cache(f){l(!this._inRuleset(),"Cannot set caching inside a ruleset"),l(!this._cache,"Cannot override schema cache"),l(this._flags.artifact===void 0,"Cannot cache a rule with an artifact");const v=this.clone();return v._cache=f||e.provider.provision(),v.$_temp.ruleset=!1,v}clone(){const f=Object.create(Object.getPrototypeOf(this));return this._assign(f)}concat(f){l(a.isSchema(f),"Invalid schema object"),l(this.type==="any"||f.type==="any"||f.type===this.type,"Cannot merge type",this.type,"with another type:",f.type),l(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),l(!f._inRuleset(),"Cannot concatenate a schema with open ruleset");let v=this.clone();if(this.type==="any"&&f.type!=="any"){const x=f.clone();for(const E of Object.keys(v))E!=="type"&&(x[E]=v[E]);v=x}v._ids.concat(f._ids),v._refs.register(f,h.toSibling),v._preferences=v._preferences?a.preferences(v._preferences,f._preferences):f._preferences,v._valids=j.merge(v._valids,f._valids,f._invalids),v._invalids=j.merge(v._invalids,f._invalids,f._valids);for(const x of f._singleRules.keys())v._singleRules.has(x)&&(v._rules=v._rules.filter(E=>E.keep||E.name!==x),v._singleRules.delete(x));for(const x of f._rules)f._definition.rules[x.method].multi||v._singleRules.set(x.name,x),v._rules.push(x);if(v._flags.empty&&f._flags.empty){v._flags.empty=v._flags.empty.concat(f._flags.empty);const x=Object.assign({},f._flags);delete x.empty,m(v._flags,x)}else if(f._flags.empty){v._flags.empty=f._flags.empty;const x=Object.assign({},f._flags);delete x.empty,m(v._flags,x)}else m(v._flags,f._flags);for(const x in f.$_terms){const E=f.$_terms[x];E?v.$_terms[x]?v.$_terms[x]=v.$_terms[x].concat(E):v.$_terms[x]=E.slice():v.$_terms[x]||(v.$_terms[x]=E)}return this.$_root._tracer&&this.$_root._tracer._combine(v,[this,f]),v.$_mutateRebuild()}extend(f){return l(!f.base,"Cannot extend type with another base"),t.type(this,f)}extract(f){return f=Array.isArray(f)?f:f.split("."),this._ids.reach(f)}fork(f,v){l(!this._inRuleset(),"Cannot fork inside a ruleset");let x=this;for(let E of[].concat(f))E=Array.isArray(E)?E:E.split("."),x=x._ids.fork(E,v,x);return x.$_temp.ruleset=!1,x}rule(f){const v=this._definition;a.assertOptions(f,Object.keys(v.modifiers)),l(this.$_temp.ruleset!==!1,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const x=this.$_temp.ruleset===null?this._rules.length-1:this.$_temp.ruleset;l(x>=0&&x<this._rules.length,"Cannot apply rules to empty ruleset");const E=this.clone();for(let N=x;N<E._rules.length;++N){const M=E._rules[N],n=$(M);for(const d in f)v.modifiers[d](n,f[d]),l(n.name===M.name,"Cannot change rule name");E._rules[N]=n,E._singleRules.get(n.name)===M&&E._singleRules.set(n.name,n)}return E.$_temp.ruleset=!1,E.$_mutateRebuild()}get ruleset(){l(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const f=this.clone();return f.$_temp.ruleset=f._rules.length,f}get $(){return this.ruleset}tailor(f){f=[].concat(f),l(!this._inRuleset(),"Cannot tailor inside a ruleset");let v=this;if(this.$_terms.alterations)for(const{target:x,adjuster:E}of this.$_terms.alterations)f.includes(x)&&(v=E(v),l(a.isSchema(v),"Alteration adjuster for",x,"failed to return a schema object"));return v=v.$_modify({each:x=>x.tailor(f),ref:!1}),v.$_temp.ruleset=!1,v.$_mutateRebuild()}tracer(){return g.location?g.location(this):this}validate(f,v){return b.entry(f,this,v)}validateAsync(f,v){return b.entryAsync(f,this,v)}$_addRule(f){typeof f=="string"&&(f={name:f}),l(f&&typeof f=="object","Invalid options"),l(f.name&&typeof f.name=="string","Invalid rule name");for(const M in f)l(M[0]!=="_","Cannot set private rule properties");const v=Object.assign({},f);v._resolve=[],v.method=v.method||v.name;const x=this._definition.rules[v.method],E=v.args;l(x,"Unknown rule",v.method);const N=this.clone();if(E){l(Object.keys(E).length===1||Object.keys(E).length===this._definition.rules[v.name].args.length,"Invalid rule definition for",this.type,v.name);for(const M in E){let n=E[M];if(x.argsByName){const d=x.argsByName.get(M);if(d.ref&&a.isResolvable(n))v._resolve.push(M),N.$_mutateRegister(n);else if(d.normalize&&(n=d.normalize(n),E[M]=n),d.assert){const _=a.validateArg(n,M,d);l(!_,_,"or reference")}}n!==void 0?E[M]=n:delete E[M]}}return x.multi||(N._ruleRemove(v.name,{clone:!1}),N._singleRules.set(v.name,v)),N.$_temp.ruleset===!1&&(N.$_temp.ruleset=null),x.priority?N._rules.unshift(v):N._rules.push(v),N}$_compile(f,v){return i.schema(this.$_root,f,v)}$_createError(f,v,x,E,N,M={}){const n=M.flags!==!1?this._flags:{},d=M.messages?s.merge(this._definition.messages,M.messages):this._definition.messages;return new r.Report(f,v,x,n,d,E,N)}$_getFlag(f){return this._flags[f]}$_getRule(f){return this._singleRules.get(f)}$_mapLabels(f){return f=Array.isArray(f)?f:f.split("."),this._ids.labels(f)}$_match(f,v,x,E){(x=Object.assign({},x)).abortEarly=!0,x._externals=!1,v.snapshot();const N=!b.validate(f,this,v,x,E).errors;return v.restore(),N}$_modify(f){return a.assertOptions(f,["each","once","ref","schema"]),o.schema(this,f)||this}$_mutateRebuild(){return l(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(f,{source:v,name:x,path:E,key:N})=>{const M=this._definition[v][x]&&this._definition[v][x].register;M!==!1&&this.$_mutateRegister(f,{family:M,key:N})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(f,{family:v,key:x}={}){this._refs.register(f,v),this._ids.register(f,{key:x})}$_property(f){return this._definition.properties[f]}$_reach(f){return this._ids.reach(f)}$_rootReferences(){return this._refs.roots()}$_setFlag(f,v,x={}){l(f[0]==="_"||!this._inRuleset(),"Cannot set flag inside a ruleset");const E=this._definition.flags[f]||{};if(y(v,E.default)&&(v=void 0),y(v,this._flags[f]))return this;const N=x.clone!==!1?this.clone():this;return v!==void 0?(N._flags[f]=v,N.$_mutateRegister(v)):delete N._flags[f],f[0]!=="_"&&(N.$_temp.ruleset=!1),N}$_parent(f,...v){return this[f][a.symbols.parent].call(this,...v)}$_validate(f,v,x){return b.validate(f,this,v,x)}_assign(f){f.type=this.type,f.$_root=this.$_root,f.$_temp=Object.assign({},this.$_temp),f.$_temp.whens={},f._ids=this._ids.clone(),f._preferences=this._preferences,f._valids=this._valids&&this._valids.clone(),f._invalids=this._invalids&&this._invalids.clone(),f._rules=this._rules.slice(),f._singleRules=$(this._singleRules,{shallow:!0}),f._refs=this._refs.clone(),f._flags=Object.assign({},this._flags),f._cache=null,f.$_terms={};for(const v in this.$_terms)f.$_terms[v]=this.$_terms[v]?this.$_terms[v].slice():null;f.$_super={};for(const v in this.$_super)f.$_super[v]=this._super[v].bind(f);return f}_bare(){const f=this.clone();f._reset();const v=f._definition.terms;for(const x in v){const E=v[x];f.$_terms[x]=E.init}return f.$_mutateRebuild()}_default(f,v,x={}){return a.assertOptions(x,"literal"),l(v!==void 0,"Missing",f,"value"),l(typeof v=="function"||!x.literal,"Only function value supports literal option"),typeof v=="function"&&x.literal&&(v={[a.symbols.literal]:!0,literal:v}),this.$_setFlag(f,v)}_generate(f,v,x){if(!this.$_terms.whens)return{schema:this};const E=[],N=[];for(let d=0;d<this.$_terms.whens.length;++d){const _=this.$_terms.whens[d];if(_.concat){E.push(_.concat),N.push(`${d}.concat`);continue}const R=_.ref?_.ref.resolve(f,v,x):f,O=_.is?[_]:_.switch,C=N.length;for(let D=0;D<O.length;++D){const{is:S,then:u,otherwise:A}=O[D],z=`${d}${_.switch?"."+D:""}`;if(S.$_match(R,v.nest(S,`${z}.is`),x)){if(u){const F=v.localize([...v.path,`${z}.then`],v.ancestors,v.schemas),{schema:J,id:W}=u._generate(f,F,x);E.push(J),N.push(`${z}.then${W?`(${W})`:""}`);break}}else if(A){const F=v.localize([...v.path,`${z}.otherwise`],v.ancestors,v.schemas),{schema:J,id:W}=A._generate(f,F,x);E.push(J),N.push(`${z}.otherwise${W?`(${W})`:""}`);break}}if(_.break&&N.length>C)break}const M=N.join(", ");if(v.mainstay.tracer.debug(v,"rule","when",M),!M)return{schema:this};if(!v.mainstay.tracer.active&&this.$_temp.whens[M])return{schema:this.$_temp.whens[M],id:M};let n=this;this._definition.generate&&(n=this._definition.generate(this,f,v,x));for(const d of E)n=n.concat(d);return this.$_root._tracer&&this.$_root._tracer._combine(n,[this,...E]),this.$_temp.whens[M]=n,{schema:n,id:M}}_inner(f,v,x={}){l(!this._inRuleset(),`Cannot set ${f} inside a ruleset`);const E=this.clone();return E.$_terms[f]&&!x.override||(E.$_terms[f]=[]),x.single?E.$_terms[f].push(v):E.$_terms[f].push(...v),E.$_temp.ruleset=!1,E}_inRuleset(){return this.$_temp.ruleset!==null&&this.$_temp.ruleset!==!1}_ruleRemove(f,v={}){if(!this._singleRules.has(f))return this;const x=v.clone!==!1?this.clone():this;x._singleRules.delete(f);const E=[];for(let N=0;N<x._rules.length;++N){const M=x._rules[N];M.name!==f||M.keep?E.push(M):x._inRuleset()&&N<x.$_temp.ruleset&&--x.$_temp.ruleset}return x._rules=E,x}_values(f,v){a.verifyFlat(f,v.slice(1,-1));const x=this.clone(),E=f[0]===a.symbols.override;if(E&&(f=f.slice(1)),!x[v]&&f.length?x[v]=new j:E&&(x[v]=f.length?new j:null,x.$_mutateRebuild()),!x[v])return x;E&&x[v].override();for(const N of f){l(N!==void 0,"Cannot call allow/valid/invalid with undefined"),l(N!==a.symbols.override,"Override must be the first value");const M=v==="_invalids"?"_valids":"_invalids";x[M]&&(x[M].remove(N),x[M].length||(l(v==="_valids"||!x._flags.only,"Setting invalid value",N,"leaves schema rejecting all values due to previous valid rule"),x[M]=null)),x[v].add(N,x._refs)}return x}}};k.Base.prototype[a.symbols.any]={version:a.version,compile:i.compile,root:"$_root"},k.Base.prototype.isImmutable=!0,k.Base.prototype.deny=k.Base.prototype.invalid,k.Base.prototype.disallow=k.Base.prototype.invalid,k.Base.prototype.equal=k.Base.prototype.valid,k.Base.prototype.exist=k.Base.prototype.required,k.Base.prototype.not=k.Base.prototype.invalid,k.Base.prototype.options=k.Base.prototype.prefs,k.Base.prototype.preferences=k.Base.prototype.prefs,L.exports=new k.Base},8652:(L,p,w)=>{const l=w(375),$=w(8571),y=w(8160),m={max:1e3,supported:new Set(["undefined","boolean","number","string"])};p.provider={provision:e=>new m.Cache(e)},m.Cache=class{constructor(e={}){y.assertOptions(e,["max"]),l(e.max===void 0||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||m.max,this._map=new Map,this._list=new m.List}get length(){return this._map.size}set(e,a){if(e!==null&&!m.supported.has(typeof e))return;let i=this._map.get(e);if(i)return i.value=a,void this._list.first(i);i=this._list.unshift({key:e,value:a}),this._map.set(e,i),this._compact()}get(e){const a=this._map.get(e);if(a)return this._list.first(a),$(a.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},m.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:i}=e;return a.prev=i,i&&(i.next=a),e===this.tail&&(this.tail=a),e.prev=null,e.next=null,e}}},8160:(L,p,w)=>{const l=w(375),$=w(7916),y=w(5934);let m,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)?)?)?)?$/};p.version=y.version,p.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},p.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")},p.assertOptions=function(i,r,t="Options"){l(i&&typeof i=="object"&&!Array.isArray(i),"Options must be of type object");const c=Object.keys(i).filter(s=>!r.includes(s));l(c.length===0,`${t} contain unknown keys: ${c}`)},p.checkPreferences=function(i){e=e||w(3378);const r=e.preferences.validate(i);if(r.error)throw new $([r.error.details[0].message])},p.compare=function(i,r,t){switch(t){case"=":return i===r;case">":return i>r;case"<":return i<r;case">=":return i>=r;case"<=":return i<=r}},p.default=function(i,r){return i===void 0?r:i},p.isIsoDate=function(i){return a.isoDate.test(i)},p.isNumber=function(i){return typeof i=="number"&&!isNaN(i)},p.isResolvable=function(i){return!!i&&(i[p.symbols.ref]||i[p.symbols.template])},p.isSchema=function(i,r={}){const t=i&&i[p.symbols.any];return!!t&&(l(r.legacy||t.version===p.version,"Cannot mix different versions of joi schemas"),!0)},p.isValues=function(i){return i[p.symbols.values]},p.limit=function(i){return Number.isSafeInteger(i)&&i>=0},p.preferences=function(i,r){m=m||w(6914),i=i||{},r=r||{};const t=Object.assign({},i,r);return r.errors&&i.errors&&(t.errors=Object.assign({},i.errors,r.errors),t.errors.wrap=Object.assign({},i.errors.wrap,r.errors.wrap)),r.messages&&(t.messages=m.compile(r.messages,i.messages)),delete t[p.symbols.prefs],t},p.tryWithPath=function(i,r,t={}){try{return i()}catch(c){throw c.path!==void 0?c.path=r+"."+c.path:c.path=r,t.append&&(c.message=`${c.message} (${c.path})`),c}},p.validateArg=function(i,r,{assert:t,message:c}){if(p.isSchema(t)){const s=t.validate(i);return s.error?s.error.message:void 0}if(!t(i))return r?`${r} ${c}`:c},p.verifyFlat=function(i,r){for(const t of i)l(!Array.isArray(t),"Method no longer accepts array arguments:",r)}},3292:(L,p,w)=>{const l=w(375),$=w(8160),y=w(6133),m={};p.schema=function(e,a,i={}){$.assertOptions(i,["appendPath","override"]);try{return m.schema(e,a,i)}catch(r){throw i.appendPath&&r.path!==void 0&&(r.message=`${r.message} (${r.path})`),r}},m.schema=function(e,a,i){l(a!==void 0,"Invalid undefined schema"),Array.isArray(a)&&(l(a.length,"Invalid empty array schema"),a.length===1&&(a=a[0]));const r=(t,...c)=>i.override!==!1?t.valid(e.override,...c):t.valid(...c);if(m.simple(a))return r(e,a);if(typeof a=="function")return e.custom(a);if(l(typeof a=="object","Invalid schema content:",typeof a),$.isResolvable(a))return r(e,a);if($.isSchema(a))return a;if(Array.isArray(a)){for(const t of a)if(!m.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):(l(Object.getPrototypeOf(a)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(a))},p.ref=function(e,a){return y.isRef(e)?e:y.create(e,a)},p.compile=function(e,a,i={}){$.assertOptions(i,["legacy"]);const r=a&&a[$.symbols.any];if(r)return l(i.legacy||r.version===$.version,"Cannot mix different versions of joi schemas:",r.version,$.version),a;if(typeof a!="object"||!i.legacy)return p.schema(e,a,{appendPath:!0});const t=m.walk(a);return t?t.compile(t.root,a):p.schema(e,a,{appendPath:!0})},m.walk=function(e){if(typeof e!="object")return null;if(Array.isArray(e)){for(const i of e){const r=m.walk(i);if(r)return r}return null}const a=e[$.symbols.any];if(a)return{root:e[a.root],compile:a.compile};l(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const i in e){const r=m.walk(e[i]);if(r)return r}return null},m.simple=function(e){return e===null||["boolean","string","number"].includes(typeof e)},p.when=function(e,a,i){if(i===void 0&&(l(a&&typeof a=="object","Missing options"),i=a,a=y.create(".")),Array.isArray(i)&&(i={switch:i}),$.assertOptions(i,["is","not","then","otherwise","switch","break"]),$.isSchema(a))return l(i.is===void 0,'"is" can not be used with a schema condition'),l(i.not===void 0,'"not" can not be used with a schema condition'),l(i.switch===void 0,'"switch" can not be used with a schema condition'),m.condition(e,{is:a,then:i.then,otherwise:i.otherwise,break:i.break});if(l(y.isRef(a)||typeof a=="string","Invalid condition:",a),l(i.not===void 0||i.is===void 0,'Cannot combine "is" with "not"'),i.switch===void 0){let t=i;i.not!==void 0&&(t={is:i.not,then:i.otherwise,otherwise:i.then,break:i.break});let c=t.is!==void 0?e.$_compile(t.is):e.$_root.invalid(null,!1,0,"").required();return l(t.then!==void 0||t.otherwise!==void 0,'options must have at least one of "then", "otherwise", or "switch"'),l(t.break===void 0||t.then===void 0||t.otherwise===void 0,"Cannot specify then, otherwise, and break all together"),i.is===void 0||y.isRef(i.is)||$.isSchema(i.is)||(c=c.required()),m.condition(e,{ref:p.ref(a),is:c,then:t.then,otherwise:t.otherwise,break:t.break})}l(Array.isArray(i.switch),'"switch" must be an array'),l(i.is===void 0,'Cannot combine "switch" with "is"'),l(i.not===void 0,'Cannot combine "switch" with "not"'),l(i.then===void 0,'Cannot combine "switch" with "then"');const r={ref:p.ref(a),switch:[],break:i.break};for(let t=0;t<i.switch.length;++t){const c=i.switch[t],s=t===i.switch.length-1;$.assertOptions(c,s?["is","then","otherwise"]:["is","then"]),l(c.is!==void 0,'Switch statement missing "is"'),l(c.then!==void 0,'Switch statement missing "then"');const o={is:e.$_compile(c.is),then:e.$_compile(c.then)};if(y.isRef(c.is)||$.isSchema(c.is)||(o.is=o.is.required()),s){l(i.otherwise===void 0||c.otherwise===void 0,'Cannot specify "otherwise" inside and outside a "switch"');const h=i.otherwise!==void 0?i.otherwise:c.otherwise;h!==void 0&&(l(r.break===void 0,"Cannot specify both otherwise and break"),o.otherwise=e.$_compile(h))}r.switch.push(o)}return r},m.condition=function(e,a){for(const i of["then","otherwise"])a[i]===void 0?delete a[i]:a[i]=e.$_compile(a[i]);return a}},6354:(L,p,w)=>{const l=w(5688),$=w(8160),y=w(3328);p.Report=class{constructor(m,e,a,i,r,t,c){if(this.code=m,this.flags=i,this.messages=r,this.path=t.path,this.prefs=c,this.state=t,this.value=e,this.message=null,this.template=null,this.local=a||{},this.local.label=p.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(m){if(this.template=m,!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 m=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 "${m}" 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(m,e){return p.template(this.value,m,e||this.code,this.state,this.prefs)}},p.path=function(m){let e="";for(const a of m)typeof a!="object"&&(typeof a=="string"?(e&&(e+="."),e+=a):e+=`[${a}]`);return e},p.template=function(m,e,a,i,r){if(!e)return;if(y.isTemplate(e))return a!=="root"?e:null;let t=r.errors.language;if($.isResolvable(t)&&(t=t.resolve(m,i,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["*"]},p.label=function(m,e,a,i){if(!a.errors.label)return"";if(m.label)return m.label;let r=e.path;return a.errors.label==="key"&&e.path.length>1&&(r=e.path.slice(-1)),p.path(r)||p.template(null,a.messages,"root",e,a)||i&&p.template(null,i,"root",e,a)||"value"},p.process=function(m,e,a){if(!m)return null;const{override:i,message:r,details:t}=p.details(m);if(i)return i;if(a.errors.stack)return new p.ValidationError(r,t,e);const c=Error.stackTraceLimit;Error.stackTraceLimit=0;const s=new p.ValidationError(r,t,e);return Error.stackTraceLimit=c,s},p.details=function(m,e={}){let a=[];const i=[];for(const r of m){if(r instanceof Error){if(e.override!==!1)return{override:r};const c=r.toString();a.push(c),i.push({message:c,type:"override",context:{error:r}});continue}const t=r.toString();a.push(t),i.push({message:t,path:r.path.filter(c=>typeof c!="object"),type:r.code,context:r.local})}return a.length>1&&(a=[...new Set(a)]),{message:a.join(". "),details:i}},p.ValidationError=class extends Error{constructor(m,e,a){super(m),this._original=a,this.details=e}static isError(m){return m instanceof p.ValidationError}},p.ValidationError.prototype.isJoi=!0,p.ValidationError.prototype.name="ValidationError",p.ValidationError.prototype.annotate=l.error},8901:(L,p,w)=>{const l=w(375),$=w(8571),y=w(8160),m=w(6914),e={};p.type=function(a,i){const r=Object.getPrototypeOf(a),t=$(r),c=a._assign(Object.create(t)),s=Object.assign({},i);delete s.base,t._definition=s;const o=r._definition||{};s.messages=m.merge(o.messages,s.messages),s.properties=Object.assign({},o.properties,s.properties),c.type=s.type,s.flags=Object.assign({},o.flags,s.flags);const h=Object.assign({},o.terms);if(s.terms)for(const k in s.terms){const f=s.terms[k];l(c.$_terms[k]===void 0,"Invalid term override for",s.type,k),c.$_terms[k]=f.init,h[k]=f}s.terms=h,s.args||(s.args=o.args),s.prepare=e.prepare(s.prepare,o.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,o.coerce),s.validate=e.validate(s.validate,o.validate);const g=Object.assign({},o.rules);if(s.rules)for(const k in s.rules){const f=s.rules[k];l(typeof f=="object","Invalid rule definition for",s.type,k);let v=f.method;if(v===void 0&&(v=function(){return this.$_addRule(k)}),v&&(l(!t[k],"Rule conflict in",s.type,k),t[k]=v),l(!g[k],"Rule conflict in",s.type,k),g[k]=f,f.alias){const x=[].concat(f.alias);for(const E of x)t[E]=f.method}f.args&&(f.argsByName=new Map,f.args=f.args.map(x=>(typeof x=="string"&&(x={name:x}),l(!f.argsByName.has(x.name),"Duplicated argument name",x.name),y.isSchema(x.assert)&&(x.assert=x.assert.strict().label(x.name)),f.argsByName.set(x.name,x),x)))}s.rules=g;const b=Object.assign({},o.modifiers);if(s.modifiers)for(const k in s.modifiers){l(!t[k],"Rule conflict in",s.type,k);const f=s.modifiers[k];l(typeof f=="function","Invalid modifier definition for",s.type,k);const v=function(x){return this.rule({[k]:x})};t[k]=v,b[k]=f}if(s.modifiers=b,s.overrides){t._super=r,c.$_super={};for(const k in s.overrides)l(r[k],"Cannot override missing",k),s.overrides[k][y.symbols.parent]=r[k],c.$_super[k]=r[k].bind(c);Object.assign(t,s.overrides)}s.cast=Object.assign({},o.cast,s.cast);const j=Object.assign({},o.manifest,s.manifest);return j.build=e.build(s.manifest&&s.manifest.build,o.manifest&&o.manifest.build),s.manifest=j,s.rebuild=e.rebuild(s.rebuild,o.rebuild),c},e.build=function(a,i){return a&&i?function(r,t){return i(a(r,t),t)}:a||i},e.coerce=function(a,i){return a&&i?{from:a.from&&i.from?[...new Set([...a.from,...i.from])]:null,method(r,t){let c;if((!i.from||i.from.includes(typeof r))&&(c=i.method(r,t),c)){if(c.errors||c.value===void 0)return c;r=c.value}if(!a.from||a.from.includes(typeof r)){const s=a.method(r,t);if(s)return s}return c}}:a||i},e.prepare=function(a,i){return a&&i?function(r,t){const c=a(r,t);if(c){if(c.errors||c.value===void 0)return c;r=c.value}return i(r,t)||c}:a||i},e.rebuild=function(a,i){return a&&i?function(r){i(r),a(r)}:a||i},e.validate=function(a,i){return a&&i?function(r,t){const c=i(r,t);if(c){if(c.errors&&(!Array.isArray(c.errors)||c.errors.length))return c;r=c.value}return a(r,t)||c}:a||i}},5107:(L,p,w)=>{const l=w(375),$=w(8571),y=w(8652),m=w(8160),e=w(3292),a=w(6354),i=w(8901),r=w(9708),t=w(6133),c=w(3328),s=w(1152);let o;const h={types:{alternatives:w(4946),any:w(8068),array:w(546),boolean:w(4937),date:w(7500),function:w(390),link:w(8785),number:w(3832),object:w(8966),string:w(7417),symbol:w(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const g={_types:new Set(Object.keys(h.types))};for(const b of g._types)g[b]=function(...j){return l(!j.length||["alternatives","link","object"].includes(b),"The",b,"type does not allow arguments"),h.generate(this,h.types[b],j)};for(const b of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])g[b]=function(...j){return this.any()[b](...j)};Object.assign(g,h.methods);for(const b in h.aliases){const j=h.aliases[b];g[b]=g[j]}return g.x=g.expression,s.setup&&s.setup(g),g}};h.methods={ValidationError:a.ValidationError,version:m.version,cache:y.provider,assert(g,b,...j){h.assert(g,b,!0,j)},attempt:(g,b,...j)=>h.assert(g,b,!1,j),build(g){return l(typeof r.build=="function","Manifest functionality disabled"),r.build(this,g)},checkPreferences(g){m.checkPreferences(g)},compile(g,b){return e.compile(this,g,b)},defaults(g){l(typeof g=="function","modifier must be a function");const b=Object.assign({},this);for(const j of b._types){const k=g(b[j]());l(m.isSchema(k),"modifier must return a valid schema object"),b[j]=function(...f){return h.generate(this,k,f)}}return b},expression:(...g)=>new c(...g),extend(...g){m.verifyFlat(g,"extend"),o=o||w(3378),l(g.length,"You need to provide at least one extension"),this.assert(g,o.extensions);const b=Object.assign({},this);b._types=new Set(b._types);for(let j of g){typeof j=="function"&&(j=j(b)),this.assert(j,o.extension);const k=h.expandExtension(j,b);for(const f of k){l(b[f.type]===void 0||b._types.has(f.type),"Cannot override name",f.type);const v=f.base||this.any(),x=i.type(v,f);b._types.add(f.type),b[f.type]=function(...E){return h.generate(this,x,E)}}}return b},isError:a.ValidationError.isError,isExpression:c.isTemplate,isRef:t.isRef,isSchema:m.isSchema,in:(...g)=>t.in(...g),override:m.symbols.override,ref:(...g)=>t.create(...g),types(){const g={};for(const b of this._types)g[b]=this[b]();for(const b in h.aliases)g[b]=this[b]();return g}},h.assert=function(g,b,j,k){const f=k[0]instanceof Error||typeof k[0]=="string"?k[0]:null,v=f!==null?k[1]:k[0],x=b.validate(g,m.preferences({errors:{stack:!0}},v||{}));let E=x.error;if(!E)return x.value;if(f instanceof Error)throw f;const N=j&&typeof E.annotate=="function"?E.annotate():E.message;throw E instanceof a.ValidationError==0&&(E=$(E)),E.message=f?`${f} ${N}`:N,E},h.generate=function(g,b,j){return l(g,"Must be invoked on a Joi instance."),b.$_root=g,b._definition.args&&j.length?b._definition.args(b,...j):b},h.expandExtension=function(g,b){if(typeof g.type=="string")return[g];const j=[];for(const k of b._types)if(g.type.test(k)){const f=Object.assign({},g);f.type=k,f.base=b[k](),j.push(f)}return j},L.exports=h.root()},6914:(L,p,w)=>{const l=w(375),$=w(8571),y=w(3328);p.compile=function(m,e){if(typeof m=="string")return l(!e,"Cannot set single message string"),new y(m);if(y.isTemplate(m))return l(!e,"Cannot set single message template"),m;l(typeof m=="object"&&!Array.isArray(m),"Invalid message options"),e=e?$(e):{};for(let a in m){const i=m[a];if(a==="root"||y.isTemplate(i)){e[a]=i;continue}if(typeof i=="string"){e[a]=new y(i);continue}l(typeof i=="object"&&!Array.isArray(i),"Invalid message for",a);const r=a;for(a in e[r]=e[r]||{},i){const t=i[a];a==="root"||y.isTemplate(t)?e[r][a]=t:(l(typeof t=="string","Invalid message for",a,"in",r),e[r][a]=new y(t))}}return e},p.decompile=function(m){const e={};for(let a in m){const i=m[a];if(a==="root"){e.root=i;continue}if(y.isTemplate(i)){e[a]=i.describe({compact:!0});continue}const r=a;for(a in e[r]={},i){const t=i[a];a!=="root"?e[r][a]=t.describe({compact:!0}):e[r].root=t}}return e},p.merge=function(m,e){if(!m)return p.compile(e);if(!e)return m;if(typeof e=="string")return new y(e);if(y.isTemplate(e))return e;const a=$(m);for(let i in e){const r=e[i];if(i==="root"||y.isTemplate(r)){a[i]=r;continue}if(typeof r=="string"){a[i]=new y(r);continue}l(typeof r=="object"&&!Array.isArray(r),"Invalid message for",i);const t=i;for(i in a[t]=a[t]||{},r){const c=r[i];i==="root"||y.isTemplate(c)?a[t][i]=c:(l(typeof c=="string","Invalid message for",i,"in",t),a[t][i]=new y(c))}}return a}},2294:(L,p,w)=>{const l=w(375),$=w(8160),y=w(6133),m={};p.Ids=m.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new m.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,i]of e._byId.entries())l(!this._byKey.has(a),"Schema id conflicts with existing key:",a),this._byId.set(a,i);for(const[a,i]of e._byKey.entries())l(!this._byId.has(a),"Schema key conflicts with existing id:",a),this._byKey.set(a,i)}fork(e,a,i){const r=this._collect(e);r.push({schema:i});const t=r.shift();let c={id:t.id,schema:a(t.schema)};l($.isSchema(c.schema),"adjuster function failed to return a joi schema type");for(const s of r)c={id:s.id,schema:m.fork(s.schema,c.id,c.schema)};return c.schema}labels(e,a=[]){const i=e[0],r=this._get(i);if(!r)return[...a,...e].join(".");const t=e.slice(1);return a=[...a,r.schema._flags.label||i],t.length?r.schema._ids.labels(t,a):a.join(".")}reach(e,a=[]){const i=e[0],r=this._get(i);l(r,"Schema does not contain path",[...a,...e].join("."));const t=e.slice(1);return t.length?r.schema._ids.reach(t,[...a,i]):r.schema}register(e,{key:a}={}){if(!e||!$.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const i=e._flags.id;if(i){const r=this._byId.get(i);l(!r||r.schema===e,"Cannot add different schemas with the same id:",i),l(!this._byKey.has(i),"Schema id conflicts with existing key:",i),this._byId.set(i,{schema:e,id:i})}a&&(l(!this._byKey.has(a),"Schema already contains key:",a),l(!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=[],i=[]){const r=e[0],t=this._get(r);l(t,"Schema does not contain path",[...a,...e].join(".")),i=[t,...i];const c=e.slice(1);return c.length?t.schema._ids._collect(c,[...a,r],i):i}_get(e){return this._byId.get(e)||this._byKey.get(e)}},m.fork=function(e,a,i){const r=p.schema(e,{each:(t,{key:c})=>{if(a===(t._flags.id||c))return i},ref:!1});return r?r.$_mutateRebuild():e},p.schema=function(e,a){let i;for(const r in e._flags){if(r[0]==="_")continue;const t=m.scan(e._flags[r],{source:"flags",name:r},a);t!==void 0&&(i=i||e.clone(),i._flags[r]=t)}for(let r=0;r<e._rules.length;++r){const t=e._rules[r],c=m.scan(t.args,{source:"rules",name:t.name},a);if(c!==void 0){i=i||e.clone();const s=Object.assign({},t);s.args=c,i._rules[r]=s,i._singleRules.get(t.name)===t&&i._singleRules.set(t.name,s)}}for(const r in e.$_terms){if(r[0]==="_")continue;const t=m.scan(e.$_terms[r],{source:"terms",name:r},a);t!==void 0&&(i=i||e.clone(),i.$_terms[r]=t)}return i},m.scan=function(e,a,i,r,t){const c=r||[];if(e===null||typeof e!="object")return;let s;if(Array.isArray(e)){for(let o=0;o<e.length;++o){const h=a.source==="terms"&&a.name==="keys"&&e[o].key,g=m.scan(e[o],a,i,[o,...c],h);g!==void 0&&(s=s||e.slice(),s[o]=g)}return s}if(i.schema!==!1&&$.isSchema(e)||i.ref!==!1&&y.isRef(e)){const o=i.each(e,{...a,path:c,key:t});return o===e?void 0:o}for(const o in e){if(o[0]==="_")continue;const h=m.scan(e[o],a,i,[o,...c],t);h!==void 0&&(s=s||Object.assign({},e),s[o]=h)}return s}},6133:(L,p,w)=>{const l=w(375),$=w(8571),y=w(9621),m=w(8160);let e;const a={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};p.create=function(i,r={}){l(typeof i=="string","Invalid reference key:",i),m.assertOptions(r,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),l(!r.prefix||typeof r.prefix=="object","options.prefix must be of type object");const t=Object.assign({},a.defaults,r);delete t.prefix;const c=t.separator,s=a.context(i,c,r.prefix);if(t.type=s.type,i=s.key,t.type==="value")if(s.root&&(l(!c||i[0]!==c,"Cannot specify relative path with root prefix"),t.ancestor="root",i||(i=null)),c&&c===i)i=null,t.ancestor=0;else if(t.ancestor!==void 0)l(!c||!i||i[0]!==c,"Cannot combine prefix with ancestor option");else{const[o,h]=a.ancestor(i,c);h&&(i=i.slice(h))===""&&(i=null),t.ancestor=o}return t.path=c?i===null?[]:i.split(c):[i],new a.Ref(t)},p.in=function(i,r={}){return p.create(i,{...r,in:!0})},p.isRef=function(i){return!!i&&!!i[m.symbols.ref]},a.Ref=class{constructor(i){l(typeof i=="object","Invalid reference construction"),m.assertOptions(i,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),l([!1,void 0].includes(i.separator)||typeof i.separator=="string"&&i.separator.length===1,"Invalid separator"),l(!i.adjust||typeof i.adjust=="function","options.adjust must be a function"),l(!i.map||Array.isArray(i.map),"options.map must be an array"),l(!i.map||!i.adjust,"Cannot set both map and adjust options"),Object.assign(this,a.defaults,i),l(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(i,r,t,c,s={}){return l(!this.in||s.in,"Invalid in() reference usage"),this.type==="global"?this._resolve(t.context,r,s):this.type==="local"?this._resolve(c,r,s):this.ancestor?this.ancestor==="root"?this._resolve(r.ancestors[r.ancestors.length-1],r,s):(l(this.ancestor<=r.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(r.ancestors[this.ancestor-1],r,s)):this._resolve(i,r,s)}_resolve(i,r,t){let c;if(this.type==="value"&&r.mainstay.shadow&&t.shadow!==!1&&(c=r.mainstay.shadow.get(this.absolute(r))),c===void 0&&(c=y(i,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(c=this.adjust(c)),this.map){const s=this.map.get(c);s!==void 0&&(c=s)}return r.mainstay&&r.mainstay.tracer.resolve(r,this,c),c}toString(){return this.display}absolute(i){return[...i.path.slice(0,-this.ancestor),...this.path]}clone(){return new a.Ref(this)}describe(){const i={path:this.path};this.type!=="value"&&(i.type=this.type),this.separator!=="."&&(i.separator=this.separator),this.type==="value"&&this.ancestor!==1&&(i.ancestor=this.ancestor),this.map&&(i.map=[...this.map]);for(const r of["adjust","iterables","render"])this[r]!==null&&this[r]!==void 0&&(i[r]=this[r]);return this.in!==!1&&(i.in=!0),{ref:i}}updateDisplay(){const i=this.key!==null?this.key:"";if(this.type!=="value")return void(this.display=`ref:${this.type}:${i}`);if(!this.separator)return void(this.display=`ref:${i}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${i}`);if(this.ancestor==="root")return void(this.display=`ref:root:${i}`);if(this.ancestor===1)return void(this.display=`ref:${i||".."}`);const r=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${r}${i||""}`}},a.Ref.prototype[m.symbols.ref]=!0,p.build=function(i){return(i=Object.assign({},a.defaults,i)).type==="value"&&i.ancestor===void 0&&(i.ancestor=1),new a.Ref(i)},a.context=function(i,r,t={}){if(i=i.trim(),t){const c=t.global===void 0?"$":t.global;if(c!==r&&i.startsWith(c))return{key:i.slice(c.length),type:"global"};const s=t.local===void 0?"#":t.local;if(s!==r&&i.startsWith(s))return{key:i.slice(s.length),type:"local"};const o=t.root===void 0?"/":t.root;if(o!==r&&i.startsWith(o))return{key:i.slice(o.length),type:"value",root:!0}}return{key:i,type:"value"}},a.ancestor=function(i,r){if(!r)return[1,0];if(i[0]!==r)return[1,0];if(i[1]!==r)return[0,1];let t=2;for(;i[t]===r;)++t;return[t-1,t]},p.toSibling=0,p.toParent=1,p.Manager=class{constructor(){this.refs=[]}register(i,r){if(i)if(r=r===void 0?p.toParent:r,Array.isArray(i))for(const t of i)this.register(t,r);else if(m.isSchema(i))for(const t of i._refs.refs)t.ancestor-r>=0&&this.refs.push({ancestor:t.ancestor-r,root:t.root});else p.isRef(i)&&i.type==="value"&&i.ancestor-r>=0&&this.refs.push({ancestor:i.ancestor-r,root:i.root}),e=e||w(3328),e.isTemplate(i)&&this.register(i.refs(),r)}get length(){return this.refs.length}clone(){const i=new p.Manager;return i.refs=$(this.refs),i}reset(){this.refs=[]}roots(){return this.refs.filter(i=>!i.ancestor).map(i=>i.root)}}},3378:(L,p,w)=>{const l=w(5107),$={};$.wrap=l.string().min(1).max(2).allow(!1),p.preferences=l.object({allowUnknown:l.boolean(),abortEarly:l.boolean(),artifacts:l.boolean(),cache:l.boolean(),context:l.object(),convert:l.boolean(),dateFormat:l.valid("date","iso","string","time","utc"),debug:l.boolean(),errors:{escapeHtml:l.boolean(),label:l.valid("path","key",!1),language:[l.string(),l.object().ref()],render:l.boolean(),stack:l.boolean(),wrap:{label:$.wrap,array:$.wrap,string:$.wrap}},externals:l.boolean(),messages:l.object(),noDefaults:l.boolean(),nonEnumerables:l.boolean(),presence:l.valid("required","optional","forbidden"),skipFunctions:l.boolean(),stripUnknown:l.object({arrays:l.boolean(),objects:l.boolean()}).or("arrays","objects").allow(!0,!1),warnings:l.boolean()}).strict(),$.nameRx=/^[a-zA-Z0-9]\w*$/,$.rule=l.object({alias:l.array().items(l.string().pattern($.nameRx)).single(),args:l.array().items(l.string(),l.object({name:l.string().pattern($.nameRx).required(),ref:l.boolean(),assert:l.alternatives([l.function(),l.object().schema()]).conditional("ref",{is:!0,then:l.required()}),normalize:l.function(),message:l.string().when("assert",{is:l.function(),then:l.required()})})),convert:l.boolean(),manifest:l.boolean(),method:l.function().allow(!1),multi:l.boolean(),validate:l.function()}),p.extension=l.object({type:l.alternatives([l.string(),l.object().regex()]).required(),args:l.function(),cast:l.object().pattern($.nameRx,l.object({from:l.function().maxArity(1).required(),to:l.function().minArity(1).maxArity(2).required()})),base:l.object().schema().when("type",{is:l.object().regex(),then:l.forbidden()}),coerce:[l.function().maxArity(3),l.object({method:l.function().maxArity(3).required(),from:l.array().items(l.string()).single()})],flags:l.object().pattern($.nameRx,l.object({setter:l.string(),default:l.any()})),manifest:{build:l.function().arity(2)},messages:[l.object(),l.string()],modifiers:l.object().pattern($.nameRx,l.function().minArity(1).maxArity(2)),overrides:l.object().pattern($.nameRx,l.function()),prepare:l.function().maxArity(3),rebuild:l.function().arity(1),rules:l.object().pattern($.nameRx,$.rule),terms:l.object().pattern($.nameRx,l.object({init:l.array().allow(null).required(),manifest:l.object().pattern(/.+/,[l.valid("schema","single"),l.object({mapped:l.object({from:l.string().required(),to:l.string().required()}).required()})])})),validate:l.function().maxArity(3)}).strict(),p.extensions=l.array().items(l.object(),l.function().arity(1)).strict(),$.desc={buffer:l.object({buffer:l.string()}),func:l.object({function:l.function().required(),options:{literal:!0}}),override:l.object({override:!0}),ref:l.object({ref:l.object({type:l.valid("value","global","local"),path:l.array().required(),separator:l.string().length(1).allow(!1),ancestor:l.number().min(0).integer().allow("root"),map:l.array().items(l.array().length(2)).min(1),adjust:l.function(),iterables:l.boolean(),in:l.boolean(),render:l.boolean()}).required()}),regex:l.object({regex:l.string().min(3)}),special:l.object({special:l.valid("deep").required()}),template:l.object({template:l.string().required(),options:l.object()}),value:l.object({value:l.alternatives([l.object(),l.array()]).required()})},$.desc.entity=l.alternatives([l.array().items(l.link("...")),l.boolean(),l.function(),l.number(),l.string(),$.desc.buffer,$.desc.func,$.desc.ref,$.desc.regex,$.desc.special,$.desc.template,$.desc.value,l.link("/")]),$.desc.values=l.array().items(null,l.boolean(),l.function(),l.number().allow(1/0,-1/0),l.string().allow(""),l.symbol(),$.desc.buffer,$.desc.func,$.desc.override,$.desc.ref,$.desc.regex,$.desc.template,$.desc.value),$.desc.messages=l.object().pattern(/.+/,[l.string(),$.desc.template,l.object().pattern(/.+/,[l.string(),$.desc.template])]),p.description=l.object({type:l.string().required(),flags:l.object({cast:l.string(),default:l.any(),description:l.string(),empty:l.link("/"),failover:$.desc.entity,id:l.string(),label:l.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:l.boolean(),unit:l.string()}).unknown(),preferences:{allowUnknown:l.boolean(),abortEarly:l.boolean(),artifacts:l.boolean(),cache:l.boolean(),convert:l.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:l.boolean(),label:["path","key"],language:[l.string(),$.desc.ref],wrap:{label:$.wrap,array:$.wrap}},externals:l.boolean(),messages:$.desc.messages,noDefaults:l.boolean(),nonEnumerables:l.boolean(),presence:["required","optional","forbidden"],skipFunctions:l.boolean(),stripUnknown:l.object({arrays:l.boolean(),objects:l.boolean()}).or("arrays","objects").allow(!0,!1),warnings:l.boolean()},allow:$.desc.values,invalid:$.desc.values,rules:l.array().min(1).items({name:l.string().required(),args:l.object().min(1),keep:l.boolean(),message:[l.string(),$.desc.messages],warn:l.boolean()}),keys:l.object().pattern(/.*/,l.link("/")),link:$.desc.ref}).pattern(/^[a-z]\w*$/,l.any())},493:(L,p,w)=>{const l=w(8571),$=w(9621),y=w(8160),m={value:Symbol("value")};L.exports=m.State=class{constructor(e,a,i){this.path=e,this.ancestors=a,this.mainstay=i.mainstay,this.schemas=i.schemas,this.debug=null}localize(e,a=null,i=null){const r=new m.State(e,a,this);return i&&r.schemas&&(r.schemas=[m.schemas(i),...r.schemas]),r}nest(e,a){const i=new m.State(this.path,this.ancestors,this);return i.schemas=i.schemas&&[m.schemas(e),...i.schemas],i.debug=a,i}shadow(e,a){this.mainstay.shadow=this.mainstay.shadow||new m.Shadow,this.mainstay.shadow.set(this.path,e,a)}snapshot(){this.mainstay.shadow&&(this._snapshot=l(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()}},m.schemas=function(e){return y.isSchema(e)?{schema:e}:e},m.Shadow=class{constructor(){this._values=null}set(e,a,i){if(!e.length||i==="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 c=e[t];let s=r.get(c);s||(s=new Map,r.set(c,s)),r=s}r[m.value]=a}get(e){const a=this.node(e);if(a)return a[m.value]}node(e){if(this._values)return $(this._values,e,{iterables:!0})}override(e,a){if(!this._values)return;const i=e.slice(0,-1),r=e[e.length-1],t=$(this._values,i,{iterables:!0});a?t.set(r,a):t&&t.delete(r)}}},3328:(L,p,w)=>{const l=w(375),$=w(8571),y=w(5277),m=w(1447),e=w(8160),a=w(6354),i=w(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}};L.exports=r.Template=class{constructor(t,c){if(l(typeof t=="string","Template source must be a string"),l(!t.includes("\0")&&!t.includes(""),"Template source cannot contain reserved control characters"),this.source=t,this.rendered=t,this._template=null,c){const{functions:s,...o}=c;this._settings=Object.keys(o).length?$(o):void 0,this._functions=s,this._functions&&(l(Object.keys(this._functions).every(h=>typeof h=="string"),"Functions keys must be strings"),l(Object.values(this._functions).every(h=>typeof h=="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),c=r.split(t);let s=!1;const o=[],h=c.shift();h&&o.push(h);for(const g of c){const b=g[0]!=="{",j=b?"}":"}}",k=g.indexOf(j);if(k===-1||g[1]==="{"){o.push(`{${r.decode(g)}`);continue}let f=g.slice(b?0:1,k);const v=f[0]===":";v&&(f=f.slice(1));const x=this._ref(r.decode(f),{raw:b,wrapped:v});o.push(x),typeof x!="string"&&(s=!0);const E=g.slice(k+j.length);E&&o.push(r.decode(E))}s?this._template=o:this.rendered=o.join("")}static date(t,c){return r.dateFormat[c.dateFormat].call(t)}describe(t={}){if(!this._settings&&t.compact)return this.source;const c={template:this.source};return this._settings&&(c.options=this._settings),this._functions&&(c.functions=this._functions),c}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 c of this._template)typeof c!="string"&&t.push(...c.refs);return t}resolve(t,c,s,o){return this._template&&this._template.length===1?this._part(this._template[0],t,c,s,o,{}):this.render(t,c,s,o)}_part(t,...c){return t.ref?t.ref.resolve(...c):t.formula.evaluate(c)}render(t,c,s,o,h={}){if(!this.isDynamic())return this.rendered;const g=[];for(const b of this._template)if(typeof b=="string")g.push(b);else{const j=this._part(b,t,c,s,o,h),k=r.stringify(j,t,c,s,o,h);if(k!==void 0){const f=b.raw||(h.errors&&h.errors.escapeHtml)===!1?k:y(k);g.push(r.wrap(f,b.wrapped&&s.errors.wrap.label))}}return g.join("")}_ref(t,{raw:c,wrapped:s}){const o=[],h=b=>{const j=i.create(b,this._settings);return o.push(j),k=>{const f=j.resolve(...k);return f!==void 0?f:null}};try{const b=this._functions?{...r.functions,...this._functions}:r.functions;var g=new m.Parser(t,{reference:h,functions:b,constants:r.constants})}catch(b){throw b.message=`Invalid template variable "${t}" fails due to: ${b.message}`,b}if(g.single){if(g.single.type==="reference"){const b=o[0];return{ref:b,raw:c,refs:o,wrapped:s||b.type==="local"&&b.key==="label"}}return r.stringify(g.single.value)}return{formula:g,raw:c,refs:o}}toString(){return this.source}},r.Template.prototype[e.symbols.template]=!0,r.Template.prototype.isImmutable=!0,r.encode=function(t){return t.replace(/\\(\{+)/g,(c,s)=>r.opens.slice(0,s.length)).replace(/\\(\}+)/g,(c,s)=>r.closes.slice(0,s.length))},r.decode=function(t){return t.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},r.split=function(t){const c=[];let s="";for(let o=0;o<t.length;++o){const h=t[o];if(h==="{"){let g="";for(;o+1<t.length&&t[o+1]==="{";)g+="{",++o;c.push(s),s=g}else s+=h}return c.push(s),c},r.wrap=function(t,c){return c?c.length===1?`${c}${t}${c}`:`${c[0]}${t}${c[1]}`:t},r.stringify=function(t,c,s,o,h,g={}){const b=typeof t,j=o&&o.errors&&o.errors.wrap||{};let k=!1;if(i.isRef(t)&&t.render&&(k=t.in,t=t.resolve(c,s,o,h,{in:t.in,...g})),t===null)return"null";if(b==="string")return r.wrap(t,g.arrayItems&&j.string);if(b==="number"||b==="function"||b==="symbol")return t.toString();if(b!=="object")return JSON.stringify(t);if(t instanceof Date)return r.Template.date(t,o);if(t instanceof Map){const v=[];for(const[x,E]of t.entries())v.push(`${x.toString()} -> ${E.toString()}`);t=v}if(!Array.isArray(t))return t.toString();const f=[];for(const v of t)f.push(r.stringify(v,c,s,o,h,{arrayItems:!0,...g}));return r.wrap(f.join(", "),!k&&j.array)},r.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},r.functions={if:(t,c,s)=>t?c: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[c,s,o,h,g]=this,b=g.messages;if(!b)return"";const j=a.template(c,b[0],t,s,o)||a.template(c,b[1],t,s,o);return j?j.render(c,s,o,h,g):""},number:t=>typeof t=="number"?t:typeof t=="string"?parseFloat(t):typeof t=="boolean"?t?1:0:t instanceof Date?t.getTime():null}},4946:(L,p,w)=>{const l=w(375),$=w(1687),y=w(8068),m=w(8160),e=w(3292),a=w(6354),i=w(6133),r={};L.exports=y.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:i.toSibling}},args:(t,...c)=>c.length===1&&Array.isArray(c[0])?t.try(...c[0]):t.try(...c),validate(t,c){const{schema:s,error:o,state:h,prefs:g}=c;if(s._flags.match){const j=[],k=[];for(let v=0;v<s.$_terms.matches.length;++v){const x=s.$_terms.matches[v],E=h.nest(x.schema,`match.${v}`);E.snapshot();const N=x.schema.$_validate(t,E,g);N.errors?(k.push(N.errors),E.restore()):(j.push(N.value),E.commit())}if(j.length===0)return{errors:o("alternatives.any",{details:k.map(v=>a.details(v,{override:!1}))})};if(s._flags.match==="one")return j.length===1?{value:j[0]}:{errors:o("alternatives.one")};if(j.length!==s.$_terms.matches.length)return{errors:o("alternatives.all",{details:k.map(v=>a.details(v,{override:!1}))})};const f=v=>v.$_terms.matches.some(x=>x.schema.type==="object"||x.schema.type==="alternatives"&&f(x.schema));return f(s)?{value:j.reduce((v,x)=>$(v,x,{mergeArrays:!1}))}:{value:j[j.length-1]}}const b=[];for(let j=0;j<s.$_terms.matches.length;++j){const k=s.$_terms.matches[j];if(k.schema){const x=h.nest(k.schema,`match.${j}`);x.snapshot();const E=k.schema.$_validate(t,x,g);if(!E.errors)return x.commit(),E;x.restore(),b.push({schema:k.schema,reports:E.errors});continue}const f=k.ref?k.ref.resolve(t,h,g):t,v=k.is?[k]:k.switch;for(let x=0;x<v.length;++x){const E=v[x],{is:N,then:M,otherwise:n}=E,d=`match.${j}${k.switch?"."+x:""}`;if(N.$_match(f,h.nest(N,`${d}.is`),g)){if(M)return M.$_validate(t,h.nest(M,`${d}.then`),g)}else if(n)return n.$_validate(t,h.nest(n,`${d}.otherwise`),g)}}return r.errors(b,c)},rules:{conditional:{method(t,c){l(!this._flags._endedSwitch,"Unreachable condition"),l(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),l(c.break===void 0,"Cannot use break option with alternatives conditional");const s=this.clone(),o=e.when(s,t,c),h=o.is?[o]:o.switch;for(const g of h)if(g.then&&g.otherwise){s.$_setFlag("_endedSwitch",!0,{clone:!1});break}return s.$_terms.matches.push(o),s.$_mutateRebuild()}},match:{method(t){if(l(["any","one","all"].includes(t),"Invalid alternatives match mode",t),t!=="any")for(const c of this.$_terms.matches)l(c.schema,"Cannot combine match mode",t,"with conditional rules");return this.$_setFlag("match",t)}},try:{method(...t){l(t.length,"Missing alternative schemas"),m.verifyFlat(t,"try"),l(!this._flags._endedSwitch,"Unreachable condition");const c=this.clone();for(const s of t)c.$_terms.matches.push({schema:c.$_compile(s)});return c.$_mutateRebuild()}}},overrides:{label(t){return this.$_parent("label",t).$_modify({each:(c,s)=>s.path[0]!=="is"&&typeof c._flags.label!="string"?c.label(t):void 0,ref:!1})}},rebuild(t){t.$_modify({each:c=>{m.isSchema(c)&&c.type==="array"&&t.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(t,c){if(c.matches)for(const s of c.matches){const{schema:o,ref:h,is:g,not:b,then:j,otherwise:k}=s;t=o?t.try(o):h?t.conditional(h,{is:g,then:j,not:b,otherwise:k,switch:s.switch}):t.conditional(g,{then:j,otherwise:k})}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:c,state:s}){if(!t.length)return{errors:c("alternatives.any")};if(t.length===1)return{errors:t[0].reports};const o=new Set,h=[];for(const{reports:g,schema:b}of t){if(g.length>1)return r.unmatched(t,c);const j=g[0];if(j instanceof a.Report==0)return r.unmatched(t,c);if(j.state.path.length!==s.path.length){h.push({type:b.type,report:j});continue}if(j.code==="any.only"){for(const v of j.local.valids)o.add(v);continue}const[k,f]=j.code.split(".");f!=="base"?h.push({type:b.type,report:j}):j.code==="object.base"?o.add(j.local.type):o.add(k)}return h.length?h.length===1?{errors:h[0].report}:r.unmatched(t,c):{errors:c("alternatives.types",{types:[...o]})}},r.unmatched=function(t,c){const s=[];for(const o of t)s.push(...o.reports);return{errors:c("alternatives.match",a.details(s,{override:!1}))}}},8068:(L,p,w)=>{const l=w(375),$=w(7629),y=w(8160),m=w(6914);L.exports=$.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 l(typeof e=="function","Method must be a function"),l(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:i}){try{return i(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){l(y.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 l(e&&typeof e=="string","Invalid warning code"),this.$_addRule({name:"warning",args:{code:e,local:a},warn:!0})},validate:(e,a,{code:i,local:r})=>a.error(i,r),args:["code","local"],multi:!0}},modifiers:{keep(e,a=!0){e.keep=a},message(e,a){e.message=m.compile(a)},warn(e,a=!0){e.warn=a}},manifest:{build(e,a){for(const i in a){const r=a[i];if(["examples","externals","metas","notes","tags"].includes(i))for(const t of r)e=e[i.slice(0,-1)](t);else if(i!=="alterations")if(i!=="whens"){if(i==="shared")for(const t of r)e=e.shared(t)}else for(const t of r){const{ref:c,is:s,not:o,then:h,otherwise:g,concat:b}=t;e=b?e.concat(b):c?e.when(c,{is:s,not:o,then:h,otherwise:g,switch:t.switch,break:t.break}):e.when(s,{then:h,otherwise:g,break:t.break})}else{const t={};for(const{target:c,adjuster:s}of r)t[c]=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:(L,p,w)=>{const l=w(375),$=w(9474),y=w(9621),m=w(8068),e=w(8160),a=w(3292),i={};L.exports=m.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:c,prefs:s}){if(!Array.isArray(r))return;const o=t.$_getRule("sort");return o?i.sort(t,r,o.args.options,c,s):void 0}},validate(r,{schema:t,error:c}){if(!Array.isArray(r)){if(t._flags.single){const s=[r];return s[e.symbols.arraySingle]=!0,{value:s}}return{errors:c("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:c,error:s},{schema:o}){const h=[r,...t.ancestors];for(let b=0;b<r.length;++b){const j=t.localize([...t.path,b],h,o);if(o.$_match(r[b],j,c))return r}const g=o._flags.label;return g?s("array.hasKnown",{patternLabel:g}):s("array.hasUnknown",null)},multi:!0},items:{method(...r){e.verifyFlat(r,"items");const t=this.$_addRule("items");for(let c=0;c<r.length;++c){const s=e.tryWithPath(()=>this.$_compile(r[c]),c,{append:!0});t.$_terms.items.push(s)}return t.$_mutateRebuild()},validate(r,{schema:t,error:c,state:s,prefs:o,errorsArray:h}){const g=t.$_terms._requireds.slice(),b=t.$_terms.ordered.slice(),j=[...t.$_terms._inclusions,...g],k=!r[e.symbols.arraySingle];delete r[e.symbols.arraySingle];const f=h();let v=r.length;for(let x=0;x<v;++x){const E=r[x];let N=!1,M=!1;const n=k?x:new Number(x),d=[...s.path,n];if(!t._flags.sparse&&E===void 0){if(f.push(c("array.sparse",{key:n,path:d,pos:x,value:void 0},s.localize(d))),o.abortEarly)return f;b.shift();continue}const _=[r,...s.ancestors];for(const D of t.$_terms._exclusions)if(D.$_match(E,s.localize(d,_,D),o,{presence:"ignore"})){if(f.push(c("array.excludes",{pos:x,value:E},s.localize(d))),o.abortEarly)return f;N=!0,b.shift();break}if(N)continue;if(t.$_terms.ordered.length){if(b.length){const D=b.shift(),S=D.$_validate(E,s.localize(d,_,D),o);if(S.errors){if(f.push(...S.errors),o.abortEarly)return f}else if(D._flags.result==="strip")i.fastSplice(r,x),--x,--v;else{if(!t._flags.sparse&&S.value===void 0){if(f.push(c("array.sparse",{key:n,path:d,pos:x,value:void 0},s.localize(d))),o.abortEarly)return f;continue}r[x]=S.value}continue}if(!t.$_terms.items.length){if(f.push(c("array.orderedLength",{pos:x,limit:t.$_terms.ordered.length})),o.abortEarly)return f;break}}const R=[];let O=g.length;for(let D=0;D<O;++D){const S=s.localize(d,_,g[D]);S.snapshot();const u=g[D].$_validate(E,S,o);if(R[D]=u,!u.errors){if(S.commit(),r[x]=u.value,M=!0,i.fastSplice(g,D),--D,--O,!t._flags.sparse&&u.value===void 0&&(f.push(c("array.sparse",{key:n,path:d,pos:x,value:void 0},s.localize(d))),o.abortEarly))return f;break}S.restore()}if(M)continue;const C=o.stripUnknown&&!!o.stripUnknown.arrays||!1;O=j.length;for(const D of j){let S;const u=g.indexOf(D);if(u!==-1)S=R[u];else{const A=s.localize(d,_,D);if(A.snapshot(),S=D.$_validate(E,A,o),!S.errors){A.commit(),D._flags.result==="strip"?(i.fastSplice(r,x),--x,--v):t._flags.sparse||S.value!==void 0?r[x]=S.value:(f.push(c("array.sparse",{key:n,path:d,pos:x,value:void 0},s.localize(d))),N=!0),M=!0;break}A.restore()}if(O===1){if(C){i.fastSplice(r,x),--x,--v,M=!0;break}if(f.push(...S.errors),o.abortEarly)return f;N=!0;break}}if(!N&&(t.$_terms._inclusions.length||t.$_terms._requireds.length)&&!M){if(C){i.fastSplice(r,x),--x,--v;continue}if(f.push(c("array.includes",{pos:x,value:E},s.localize(d))),o.abortEarly)return f}}return g.length&&i.fillMissedErrors(t,f,g,r,s,o),b.length&&(i.fillOrderedErrors(t,f,b,r,s,o),f.length||i.fillDefault(b,r,s,o)),f.length?f:r},priority:!0,manifest:!1},length:{method(r){return this.$_addRule({name:"length",args:{limit:r},operator:"="})},validate:(r,t,{limit:c},{name:s,operator:o,args:h})=>e.compare(r.length,c,o)?r:t.error("array."+s,{limit:h.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 c=0;c<r.length;++c){const s=e.tryWithPath(()=>this.$_compile(r[c]),c,{append:!0});i.validateSingle(s,t),t.$_mutateRegister(s),t.$_terms.ordered.push(s)}return t.$_mutateRebuild()}},single:{method(r){const t=r===void 0||!!r;return l(!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}),l(!t.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:t}})},validate(r,{error:t,state:c,prefs:s,schema:o},{options:h}){const{value:g,errors:b}=i.sort(o,r,h,c,s);if(b)return b;for(let j=0;j<r.length;++j)if(r[j]!==g[j])return t("array.sort",{order:h.order,by:h.by?h.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={}){l(!r||typeof r=="function"||typeof r=="string","comparator must be a function or a string"),e.assertOptions(t,["ignoreUndefined","separator"]);const c={name:"unique",args:{options:t,comparator:r}};if(r)if(typeof r=="string"){const s=e.default(t.separator,".");c.path=s?r.split(s):[r]}else c.comparator=r;return this.$_addRule(c)},validate(r,{state:t,error:c,schema:s},{comparator:o,options:h},{comparator:g,path:b}){const j={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},k=g||$,f=h.ignoreUndefined;for(let v=0;v<r.length;++v){const x=b?y(r[v],b):r[v],E=g?j.custom:j[typeof x];if(l(E,"Failed to find unique map container for type",typeof x),E instanceof Map){const N=E.entries();let M;for(;!(M=N.next()).done;)if(k(M.value[0],x)){const n=t.localize([...t.path,v],[r,...t.ancestors]),d={pos:v,value:r[v],dupePos:M.value[1],dupeValue:r[M.value[1]]};return b&&(d.path=o),c("array.unique",d,n)}E.set(x,v)}else{if((!f||x!==void 0)&&E[x]!==void 0){const N={pos:v,value:r[v],dupePos:E[x],dupeValue:r[E[x]]};return b&&(N.path=o),c("array.unique",N,t.localize([...t.path,v],[r,...t.ancestors]))}E[x]=v}}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)i.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)i.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"}}),i.fillMissedErrors=function(r,t,c,s,o,h){const g=[];let b=0;for(const j of c){const k=j._flags.label;k?g.push(k):++b}g.length?b?t.push(r.$_createError("array.includesRequiredBoth",s,{knownMisses:g,unknownMisses:b},o,h)):t.push(r.$_createError("array.includesRequiredKnowns",s,{knownMisses:g},o,h)):t.push(r.$_createError("array.includesRequiredUnknowns",s,{unknownMisses:b},o,h))},i.fillOrderedErrors=function(r,t,c,s,o,h){const g=[];for(const b of c)b._flags.presence==="required"&&g.push(b);g.length&&i.fillMissedErrors(r,t,g,s,o,h)},i.fillDefault=function(r,t,c,s){const o=[];let h=!0;for(let g=r.length-1;g>=0;--g){const b=r[g],j=[t,...c.ancestors],k=b.$_validate(void 0,c.localize(c.path,j,b),s).value;if(h){if(k===void 0)continue;h=!1}o.unshift(k)}o.length&&t.push(...o)},i.fastSplice=function(r,t){let c=t;for(;c<r.length;)r[c++]=r[c];--r.length},i.validateSingle=function(r,t){(r.type==="array"||r._flags._arrayItems)&&(l(!t._flags.single,"Cannot specify array item with single rule enabled"),t.$_setFlag("_arrayItems",!0,{clone:!1}))},i.sort=function(r,t,c,s,o){const h=c.order==="ascending"?1:-1,g=-1*h,b=h,j=(k,f)=>{let v=i.compare(k,f,g,b);if(v!==null||(c.by&&(k=c.by.resolve(k,s,o),f=c.by.resolve(f,s,o)),v=i.compare(k,f,g,b),v!==null))return v;const x=typeof k;if(x!==typeof f)throw r.$_createError("array.sort.mismatching",t,null,s,o);if(x!=="number"&&x!=="string")throw r.$_createError("array.sort.unsupported",t,{type:x},s,o);return x==="number"?(k-f)*h:k<f?g:b};try{return{value:t.slice().sort(j)}}catch(k){return{errors:k}}},i.compare=function(r,t,c,s){return r===t?0:r===void 0?1:t===void 0?-1:r===null?s:t===null?c:null}},4937:(L,p,w)=>{const l=w(375),$=w(8068),y=w(8160),m=w(2036),e={isBool:function(a){return typeof a=="boolean"}};L.exports=$.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(a,{schema:i}){if(typeof a!="boolean"){if(typeof a=="string"){const r=i._flags.sensitive?a:a.toLowerCase();a=r==="true"||r!=="false"&&a}return typeof a!="boolean"&&(a=i.$_terms.truthy&&i.$_terms.truthy.has(a,null,null,!i._flags.sensitive)||(!i.$_terms.falsy||!i.$_terms.falsy.has(a,null,null,!i._flags.sensitive))&&a),{value:a}}},validate(a,{error:i}){if(typeof a!="boolean")return{value:a,errors:i("boolean.base")}},rules:{truthy:{method(...a){y.verifyFlat(a,"truthy");const i=this.clone();i.$_terms.truthy=i.$_terms.truthy||new m;for(let r=0;r<a.length;++r){const t=a[r];l(t!==void 0,"Cannot call truthy with undefined"),i.$_terms.truthy.add(t)}return i}},falsy:{method(...a){y.verifyFlat(a,"falsy");const i=this.clone();i.$_terms.falsy=i.$_terms.falsy||new m;for(let r=0;r<a.length;++r){const t=a[r];l(t!==void 0,"Cannot call falsy with undefined"),i.$_terms.falsy.add(t)}return i}},sensitive:{method(a=!0){return this.$_setFlag("sensitive",a)}}},cast:{number:{from:e.isBool,to:(a,i)=>a?1:0},string:{from:e.isBool,to:(a,i)=>a?"true":"false"}},manifest:{build:(a,i)=>(i.truthy&&(a=a.truthy(...i.truthy)),i.falsy&&(a=a.falsy(...i.falsy)),a)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},7500:(L,p,w)=>{const l=w(375),$=w(8068),y=w(8160),m=w(3328),e={isDate:function(a){return a instanceof Date}};L.exports=$.extend({type:"date",coerce:{from:["number","string"],method:(a,{schema:i})=>({value:e.parse(a,i._flags.format)||a})},validate(a,{schema:i,error:r,prefs:t}){if(a instanceof Date&&!isNaN(a.getTime()))return;const c=i._flags.format;return t.convert&&c&&typeof a=="string"?{value:a,errors:r("date.format",{format:c})}:{value:a,errors:r("date.base")}},rules:{compare:{method:!1,validate(a,i,{date:r},{name:t,operator:c,args:s}){const o=r==="now"?Date.now():r.getTime();return y.compare(a.getTime(),o,c)?a:i.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 l(["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 l(["javascript","unix"].includes(a),'"type" must be one of "javascript, unix"'),this.format(a)}}},cast:{number:{from:e.isDate,to:(a,i)=>a.getTime()},string:{from:e.isDate,to:(a,{prefs:i})=>m.date(a,i)}},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,i){if(a instanceof Date)return a;if(typeof a!="string"&&(isNaN(a)||!isFinite(a))||/^\s*$/.test(a))return null;if(i==="iso")return y.isIsoDate(a)?e.date(a.toString()):null;const r=a;if(typeof a=="string"&&/^[+-]?\d+(\.\d+)?$/.test(a)&&(a=parseFloat(a)),i){if(i==="javascript")return e.date(1*a);if(i==="unix")return e.date(1e3*a);if(typeof r=="string")return null}return e.date(a)},e.date=function(a){const i=new Date(a);return isNaN(i.getTime())?null:i}},390:(L,p,w)=>{const l=w(375),$=w(7824);L.exports=$.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(y){return l(Number.isSafeInteger(y)&&y>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:y}})},validate:(y,m,{n:e})=>y.length===e?y:m.error("function.arity",{n:e})},class:{method(){return this.$_addRule("class")},validate:(y,m)=>/^\s*class\s/.test(y.toString())?y:m.error("function.class",{value:y})},minArity:{method(y){return l(Number.isSafeInteger(y)&&y>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:y}})},validate:(y,m,{n:e})=>y.length>=e?y:m.error("function.minArity",{n:e})},maxArity:{method(y){return l(Number.isSafeInteger(y)&&y>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:y}})},validate:(y,m,{n:e})=>y.length<=e?y:m.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:(L,p,w)=>{const l=w(978),$=w(375),y=w(8571),m=w(3652),e=w(8068),a=w(8160),i=w(3292),r=w(6354),t=w(6133),c=w(3328),s={renameDefaults:{alias:!1,multiple:!1,override:!1}};L.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:(o,h)=>o.keys(h),validate(o,{schema:h,error:g,state:b,prefs:j}){if(!o||typeof o!==h.$_property("typeof")||Array.isArray(o))return{value:o,errors:g("object.base",{type:h.$_property("typeof")})};if(!(h.$_terms.renames||h.$_terms.dependencies||h.$_terms.keys||h.$_terms.patterns||h.$_terms.externals))return;o=s.clone(o,j);const k=[];if(h.$_terms.renames&&!s.rename(h,o,b,j,k))return{value:o,errors:k};if(!h.$_terms.keys&&!h.$_terms.patterns&&!h.$_terms.dependencies)return{value:o,errors:k};const f=new Set(Object.keys(o));if(h.$_terms.keys){const v=[o,...b.ancestors];for(const x of h.$_terms.keys){const E=x.key,N=o[E];f.delete(E);const M=b.localize([...b.path,E],v,x),n=x.schema.$_validate(N,M,j);if(n.errors){if(j.abortEarly)return{value:o,errors:n.errors};n.value!==void 0&&(o[E]=n.value),k.push(...n.errors)}else x.schema._flags.result==="strip"||n.value===void 0&&N!==void 0?delete o[E]:n.value!==void 0&&(o[E]=n.value)}}if(f.size||h._flags._hasPatternMatch){const v=s.unknown(h,o,f,k,b,j);if(v)return v}if(h.$_terms.dependencies)for(const v of h.$_terms.dependencies){if(v.key!==null&&s.isPresent(v.options)(v.key.resolve(o,b,j,null,{shadow:!1}))===!1)continue;const x=s.dependencies[v.rel](h,v,o,b,j);if(x){const E=h.$_createError(x.code,o,x.context,b,j);if(j.abortEarly)return{value:o,errors:E};k.push(E)}}return{value:o,errors:k}},rules:{and:{method(...o){return a.verifyFlat(o,"and"),s.dependency(this,"and",null,o)}},append:{method(o){return o==null||Object.keys(o).length===0?this:this.keys(o)}},assert:{method(o,h,g){c.isTemplate(o)||(o=i.ref(o)),$(g===void 0||typeof g=="string","Message must be a string"),h=this.$_compile(h,{appendPath:!0});const b=this.$_addRule({name:"assert",args:{subject:o,schema:h,message:g}});return b.$_mutateRegister(o),b.$_mutateRegister(h),b},validate(o,{error:h,prefs:g,state:b},{subject:j,schema:k,message:f}){const v=j.resolve(o,b,g),x=t.isRef(j)?j.absolute(b):[];return k.$_match(v,b.localize(x,[o,...b.ancestors],k),g)?o:h("object.assert",{subject:j,message:f})},args:["subject","schema","message"],multi:!0},instance:{method(o,h){return $(typeof o=="function","constructor must be a function"),h=h||o.name,this.$_addRule({name:"instance",args:{constructor:o,name:h}})},validate:(o,h,{constructor:g,name:b})=>o instanceof g?o:h.error("object.instance",{type:b,value:o}),args:["constructor","name"]},keys:{method(o){$(o===void 0||typeof o=="object","Object schema must be a valid object"),$(!a.isSchema(o),"Object schema cannot be a joi schema");const h=this.clone();if(o)if(Object.keys(o).length){h.$_terms.keys=h.$_terms.keys?h.$_terms.keys.filter(g=>!o.hasOwnProperty(g.key)):new s.Keys;for(const g in o)a.tryWithPath(()=>h.$_terms.keys.push({key:g,schema:this.$_compile(o[g])}),g)}else h.$_terms.keys=new s.Keys;else h.$_terms.keys=null;return h.$_mutateRebuild()}},length:{method(o){return this.$_addRule({name:"length",args:{limit:o},operator:"="})},validate:(o,h,{limit:g},{name:b,operator:j,args:k})=>a.compare(Object.keys(o).length,g,j)?o:h.error("object."+b,{limit:k.limit,value:o}),args:[{name:"limit",ref:!0,assert:a.limit,message:"must be a positive integer"}]},max:{method(o){return this.$_addRule({name:"max",method:"length",args:{limit:o},operator:"<="})}},min:{method(o){return this.$_addRule({name:"min",method:"length",args:{limit:o},operator:">="})}},nand:{method(...o){return a.verifyFlat(o,"nand"),s.dependency(this,"nand",null,o)}},or:{method(...o){return a.verifyFlat(o,"or"),s.dependency(this,"or",null,o)}},oxor:{method(...o){return s.dependency(this,"oxor",null,o)}},pattern:{method(o,h,g={}){const b=o instanceof RegExp;b||(o=this.$_compile(o,{appendPath:!0})),$(h!==void 0,"Invalid rule"),a.assertOptions(g,["fallthrough","matches"]),b&&$(!o.flags.includes("g")&&!o.flags.includes("y"),"pattern should not use global or sticky mode"),h=this.$_compile(h,{appendPath:!0});const j=this.clone();j.$_terms.patterns=j.$_terms.patterns||[];const k={[b?"regex":"schema"]:o,rule:h};return g.matches&&(k.matches=this.$_compile(g.matches),k.matches.type!=="array"&&(k.matches=k.matches.$_root.array().items(k.matches)),j.$_mutateRegister(k.matches),j.$_setFlag("_hasPatternMatch",!0,{clone:!1})),g.fallthrough&&(k.fallthrough=!0),j.$_terms.patterns.push(k),j.$_mutateRegister(h),j}},ref:{method(){return this.$_addRule("ref")},validate:(o,h)=>t.isRef(o)?o:h.error("object.refType",{value:o})},regex:{method(){return this.$_addRule("regex")},validate:(o,h)=>o instanceof RegExp?o:h.error("object.regex",{value:o})},rename:{method(o,h,g={}){$(typeof o=="string"||o instanceof RegExp,"Rename missing the from argument"),$(typeof h=="string"||h instanceof c,"Invalid rename to argument"),$(h!==o,"Cannot rename key to same name:",o),a.assertOptions(g,["alias","ignoreUndefined","override","multiple"]);const b=this.clone();b.$_terms.renames=b.$_terms.renames||[];for(const j of b.$_terms.renames)$(j.from!==o,"Cannot rename the same key multiple times");return h instanceof c&&b.$_mutateRegister(h),b.$_terms.renames.push({from:o,to:h,options:l(s.renameDefaults,g)}),b}},schema:{method(o="any"){return this.$_addRule({name:"schema",args:{type:o}})},validate:(o,h,{type:g})=>!a.isSchema(o)||g!=="any"&&o.type!==g?h.error("object.schema",{type:g}):o},unknown:{method(o){return this.$_setFlag("unknown",o!==!1)}},with:{method(o,h,g={}){return s.dependency(this,"with",o,h,g)}},without:{method(o,h,g={}){return s.dependency(this,"without",o,h,g)}},xor:{method(...o){return a.verifyFlat(o,"xor"),s.dependency(this,"xor",null,o)}}},overrides:{default(o,h){return o===void 0&&(o=a.symbols.deepDefault),this.$_parent("default",o,h)}},rebuild(o){if(o.$_terms.keys){const h=new m.Sorter;for(const g of o.$_terms.keys)a.tryWithPath(()=>h.add(g,{after:g.schema.$_rootReferences(),group:g.key}),g.key);o.$_terms.keys=new s.Keys(...h.nodes)}},manifest:{build(o,h){if(h.keys&&(o=o.keys(h.keys)),h.dependencies)for(const{rel:g,key:b=null,peers:j,options:k}of h.dependencies)o=s.dependency(o,g,b,j,k);if(h.patterns)for(const{regex:g,schema:b,rule:j,fallthrough:k,matches:f}of h.patterns)o=o.pattern(g||b,j,{fallthrough:k,matches:f});if(h.renames)for(const{from:g,to:b,options:j}of h.renames)o=o.rename(g,b,j);return o}},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(o,h){if(typeof o=="object"){if(h.nonEnumerables)return y(o,{shallow:!0});const b=Object.create(Object.getPrototypeOf(o));return Object.assign(b,o),b}const g=function(...b){return o.apply(this,b)};return g.prototype=y(o.prototype),Object.defineProperty(g,"name",{value:o.name,writable:!1}),Object.defineProperty(g,"length",{value:o.length,writable:!1}),Object.assign(g,o),g},s.dependency=function(o,h,g,b,j){$(g===null||typeof g=="string",h,"key must be a strings"),j||(j=b.length>1&&typeof b[b.length-1]=="object"?b.pop():{}),a.assertOptions(j,["separator","isPresent"]),b=[].concat(b);const k=a.default(j.separator,"."),f=[];for(const x of b)$(typeof x=="string",h,"peers must be strings"),f.push(i.ref(x,{separator:k,ancestor:0,prefix:!1}));g!==null&&(g=i.ref(g,{separator:k,ancestor:0,prefix:!1}));const v=o.clone();return v.$_terms.dependencies=v.$_terms.dependencies||[],v.$_terms.dependencies.push(new s.Dependency(h,g,f,b,j)),v},s.dependencies={and(o,h,g,b,j){const k=[],f=[],v=h.peers.length,x=s.isPresent(h.options);for(const E of h.peers)x(E.resolve(g,b,j,null,{shadow:!1}))===!1?k.push(E.key):f.push(E.key);if(k.length!==v&&f.length!==v)return{code:"object.and",context:{present:f,presentWithLabels:s.keysToLabels(o,f),missing:k,missingWithLabels:s.keysToLabels(o,k)}}},nand(o,h,g,b,j){const k=[],f=s.isPresent(h.options);for(const E of h.peers)f(E.resolve(g,b,j,null,{shadow:!1}))&&k.push(E.key);if(k.length!==h.peers.length)return;const v=h.paths[0],x=h.paths.slice(1);return{code:"object.nand",context:{main:v,mainWithLabel:s.keysToLabels(o,v),peers:x,peersWithLabels:s.keysToLabels(o,x)}}},or(o,h,g,b,j){const k=s.isPresent(h.options);for(const f of h.peers)if(k(f.resolve(g,b,j,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:h.paths,peersWithLabels:s.keysToLabels(o,h.paths)}}},oxor(o,h,g,b,j){const k=[],f=s.isPresent(h.options);for(const x of h.peers)f(x.resolve(g,b,j,null,{shadow:!1}))&&k.push(x.key);if(!k.length||k.length===1)return;const v={peers:h.paths,peersWithLabels:s.keysToLabels(o,h.paths)};return v.present=k,v.presentWithLabels=s.keysToLabels(o,k),{code:"object.oxor",context:v}},with(o,h,g,b,j){const k=s.isPresent(h.options);for(const f of h.peers)if(k(f.resolve(g,b,j,null,{shadow:!1}))===!1)return{code:"object.with",context:{main:h.key.key,mainWithLabel:s.keysToLabels(o,h.key.key),peer:f.key,peerWithLabel:s.keysToLabels(o,f.key)}}},without(o,h,g,b,j){const k=s.isPresent(h.options);for(const f of h.peers)if(k(f.resolve(g,b,j,null,{shadow:!1})))return{code:"object.without",context:{main:h.key.key,mainWithLabel:s.keysToLabels(o,h.key.key),peer:f.key,peerWithLabel:s.keysToLabels(o,f.key)}}},xor(o,h,g,b,j){const k=[],f=s.isPresent(h.options);for(const x of h.peers)f(x.resolve(g,b,j,null,{shadow:!1}))&&k.push(x.key);if(k.length===1)return;const v={peers:h.paths,peersWithLabels:s.keysToLabels(o,h.paths)};return k.length===0?{code:"object.missing",context:v}:(v.present=k,v.presentWithLabels=s.keysToLabels(o,k),{code:"object.xor",context:v})}},s.keysToLabels=function(o,h){return Array.isArray(h)?h.map(g=>o.$_mapLabels(g)):o.$_mapLabels(h)},s.isPresent=function(o){return typeof o.isPresent=="function"?o.isPresent:h=>h!==void 0},s.rename=function(o,h,g,b,j){const k={};for(const f of o.$_terms.renames){const v=[],x=typeof f.from!="string";if(x)for(const E in h){if(h[E]===void 0&&f.options.ignoreUndefined||E===f.to)continue;const N=f.from.exec(E);N&&v.push({from:E,to:f.to,match:N})}else!Object.prototype.hasOwnProperty.call(h,f.from)||h[f.from]===void 0&&f.options.ignoreUndefined||v.push(f);for(const E of v){const N=E.from;let M=E.to;if(M instanceof c&&(M=M.render(h,g,b,E.match)),N!==M){if(!f.options.multiple&&k[M]&&(j.push(o.$_createError("object.rename.multiple",h,{from:N,to:M,pattern:x},g,b)),b.abortEarly)||Object.prototype.hasOwnProperty.call(h,M)&&!f.options.override&&!k[M]&&(j.push(o.$_createError("object.rename.override",h,{from:N,to:M,pattern:x},g,b)),b.abortEarly))return!1;h[N]===void 0?delete h[M]:h[M]=h[N],k[M]=!0,f.options.alias||delete h[N]}}}return!0},s.unknown=function(o,h,g,b,j,k){if(o.$_terms.patterns){let f=!1;const v=o.$_terms.patterns.map(E=>{if(E.matches)return f=!0,[]}),x=[h,...j.ancestors];for(const E of g){const N=h[E],M=[...j.path,E];for(let n=0;n<o.$_terms.patterns.length;++n){const d=o.$_terms.patterns[n];if(d.regex){const O=d.regex.test(E);if(j.mainstay.tracer.debug(j,"rule",`pattern.${n}`,O?"pass":"error"),!O)continue}else if(!d.schema.$_match(E,j.nest(d.schema,`pattern.${n}`),k))continue;g.delete(E);const _=j.localize(M,x,{schema:d.rule,key:E}),R=d.rule.$_validate(N,_,k);if(R.errors){if(k.abortEarly)return{value:h,errors:R.errors};b.push(...R.errors)}if(d.matches&&v[n].push(E),h[E]=R.value,!d.fallthrough)break}}if(f)for(let E=0;E<v.length;++E){const N=v[E];if(!N)continue;const M=o.$_terms.patterns[E].matches,n=j.localize(j.path,x,M),d=M.$_validate(N,n,k);if(d.errors){const _=r.details(d.errors,{override:!1});_.matches=N;const R=o.$_createError("object.pattern.match",h,_,j,k);if(k.abortEarly)return{value:h,errors:R};b.push(R)}}}if(g.size&&(o.$_terms.keys||o.$_terms.patterns)){if(k.stripUnknown&&o._flags.unknown===void 0||k.skipFunctions){const f=!(!k.stripUnknown||k.stripUnknown!==!0&&!k.stripUnknown.objects);for(const v of g)f?(delete h[v],g.delete(v)):typeof h[v]=="function"&&g.delete(v)}if(!a.default(o._flags.unknown,k.allowUnknown))for(const f of g){const v=j.localize([...j.path,f],[]),x=o.$_createError("object.unknown",h[f],{child:f},v,k,{flags:!1});if(k.abortEarly)return{value:h,errors:x};b.push(x)}}},s.Dependency=class{constructor(o,h,g,b,j){this.rel=o,this.key=h,this.peers=g,this.paths=b,this.options=j}describe(){const o={rel:this.rel,peers:this.paths};return this.key!==null&&(o.key=this.key.key),this.peers[0].separator!=="."&&(o.options={...o.options,separator:this.peers[0].separator}),this.options.isPresent&&(o.options={...o.options,isPresent:this.options.isPresent}),o}},s.Keys=class extends Array{concat(o){const h=this.slice(),g=new Map;for(let b=0;b<h.length;++b)g.set(h[b].key,b);for(const b of o){const j=b.key,k=g.get(j);k!==void 0?h[k]={key:j,schema:h[k].schema.concat(b.schema)}:h.push(b)}return h}}},8785:(L,p,w)=>{const l=w(375),$=w(8068),y=w(8160),m=w(3292),e=w(6354),a={};L.exports=$.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(i,r)=>i.ref(r),validate(i,{schema:r,state:t,prefs:c}){l(r.$_terms.link,"Uninitialized link schema");const s=a.generate(r,i,t,c),o=r.$_terms.link[0].ref;return s.$_validate(i,t.nest(s,`link:${o.display}:${s.type}`),c)},generate:(i,r,t,c)=>a.generate(i,r,t,c),rules:{ref:{method(i){l(!this.$_terms.link,"Cannot reinitialize schema"),i=m.ref(i),l(i.type==="value"||i.type==="local","Invalid reference type:",i.type),l(i.type==="local"||i.ancestor==="root"||i.ancestor>0,"Link cannot reference itself");const r=this.clone();return r.$_terms.link=[{ref:i}],r}},relative:{method(i=!0){return this.$_setFlag("relative",i)}}},overrides:{concat(i){l(this.$_terms.link,"Uninitialized link schema"),l(y.isSchema(i),"Invalid schema object"),l(i.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:i}),r.$_mutateRebuild()}},manifest:{build:(i,r)=>(l(r.link,"Invalid link description missing link"),i.ref(r.link))}}),a.generate=function(i,r,t,c){let s=t.mainstay.links.get(i);if(s)return s._generate(r,t,c).schema;const o=i.$_terms.link[0].ref,{perspective:h,path:g}=a.perspective(o,t);a.assert(h,"which is outside of schema boundaries",o,i,t,c);try{s=g.length?h.$_reach(g):h}catch{a.assert(!1,"to non-existing schema",o,i,t,c)}return a.assert(s.type!=="link","which is another link",o,i,t,c),i._flags.relative||t.mainstay.links.set(i,s),s._generate(r,t,c).schema},a.perspective=function(i,r){if(i.type==="local"){for(const{schema:t,key:c}of r.schemas){if((t._flags.id||c)===i.path[0])return{perspective:t,path:i.path.slice(1)};if(t.$_terms.shared){for(const s of t.$_terms.shared)if(s._flags.id===i.path[0])return{perspective:s,path:i.path.slice(1)}}}return{perspective:null,path:null}}return i.ancestor==="root"?{perspective:r.schemas[r.schemas.length-1].schema,path:i.path}:{perspective:r.schemas[i.ancestor]&&r.schemas[i.ancestor].schema,path:i.path}},a.assert=function(i,r,t,c,s,o){i||l(!1,`"${e.label(c._flags,s,o)}" contains link reference "${t.display}" ${r}`)}},3832:(L,p,w)=>{const l=w(375),$=w(8068),y=w(8160),m={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(),i=a.indexOf("."),r=a.indexOf("e");return(i<0?0:(r<0?a.length:r)-i-1)+(r<0?0:Math.max(0,-parseInt(a.slice(r+1))))}};L.exports=$.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:a,error:i}){if(!e.match(m.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(m.extractSignificantDigits(e)!==m.extractSignificantDigits(String(r.value)))return r.errors=i("number.unsafe"),r}else{const t=r.value.toString();if(t.match(/e/i))return r;if(t!==m.normalizeDecimal(e))return r.errors=i("number.unsafe"),r}return r}},validate(e,{schema:a,error:i,prefs:r}){if(e===1/0||e===-1/0)return{value:e,errors:i("number.infinity")};if(!y.isNumber(e))return{value:e,errors:i("number.base")};const t={value:e};if(r.convert){const c=a.$_getRule("precision");if(c){const s=Math.pow(10,c.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=i("number.unsafe")),t},rules:{compare:{method:!1,validate:(e,a,{limit:i},{name:r,operator:t,args:c})=>y.compare(e,i,t)?e:a.error("number."+r,{limit:c.limit,value:e}),args:[{name:"limit",ref:!0,assert:y.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"?m.decimalPlaces(e):null,i=Math.pow(10,a);return this.$_addRule({name:"multiple",args:{base:e,baseDecimalPlace:a,pfactor:i}})},validate:(e,a,{base:i,baseDecimalPlace:r,pfactor:t},c)=>m.decimalPlaces(e)>r?a.error("number.multiple",{multiple:c.args.base,value:e}):Math.round(t*e)%Math.round(t*i)==0?e:a.error("number.multiple",{multiple:c.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 l(Number.isSafeInteger(e),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:e}})},validate(e,a,{limit:i}){const r=e.toString().match(m.precisionRx);return Math.max((r[1]?r[1].length:0)-(r[2]?parseInt(r[2],10):0),0)<=i?e:a.error("number.precision",{limit:i,value:e})},convert:!0},sign:{method(e){return l(["negative","positive"].includes(e),"Invalid sign",e),this.$_addRule({name:"sign",args:{sign:e}})},validate:(e,a,{sign:i})=>i==="negative"&&e<0||i==="positive"&&e>0?e:a.error(`number.${i}`)},unsafe:{method(e=!0){return l(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"}}),m.extractSignificantDigits=function(e){return e.replace(m.exponentialPartRegex,"").replace(m.dotRegex,"").replace(m.trailingZerosRegex,"").replace(m.leadingSignAndZerosRegex,"")},m.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:(L,p,w)=>{const l=w(7824);L.exports=l.extend({type:"object",cast:{map:{from:$=>$&&typeof $=="object",to:($,y)=>new Map(Object.entries($))}}})},7417:(L,p,w)=>{const l=w(375),$=w(5380),y=w(1745),m=w(9959),e=w(6064),a=w(9926),i=w(5752),r=w(8068),t=w(8160),c={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:m.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"]};L.exports=r.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(s,{schema:o,state:h,prefs:g}){const b=o.$_getRule("normalize");b&&(s=s.normalize(b.args.form));const j=o.$_getRule("case");j&&(s=j.args.direction==="upper"?s.toLocaleUpperCase():s.toLocaleLowerCase());const k=o.$_getRule("trim");if(k&&k.args.enabled&&(s=s.trim()),o.$_terms.replacements)for(const v of o.$_terms.replacements)s=s.replace(v.pattern,v.replacement);const f=o.$_getRule("hex");if(f&&f.args.options.byteAligned&&s.length%2!=0&&(s=`0${s}`),o.$_getRule("isoDate")){const v=c.isoDate(s);v&&(s=v)}if(o._flags.truncate){const v=o.$_getRule("max");if(v){let x=v.args.limit;if(t.isResolvable(x)&&(x=x.resolve(s,h,g),!t.limit(x)))return{value:s,errors:o.$_createError("any.ref",x,{ref:v.args.limit,arg:"limit",reason:"must be a positive integer"},h,g)};s=s.slice(0,x)}}return{value:s}}},validate(s,{schema:o,error:h}){if(typeof s!="string")return{value:s,errors:h("string.base")};if(s===""){const g=o.$_getRule("min");return g&&g.args.limit===0?void 0:{value:s,errors:h("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(s,o)=>/^[a-zA-Z0-9]+$/.test(s)?s:o.error("string.alphanum")},base64:{method(s={}){return t.assertOptions(s,["paddingRequired","urlSafe"]),s={urlSafe:!1,paddingRequired:!0,...s},l(typeof s.paddingRequired=="boolean","paddingRequired must be boolean"),l(typeof s.urlSafe=="boolean","urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:s}})},validate:(s,o,{options:h})=>c.base64Regex[h.paddingRequired][h.urlSafe].test(s)?s:o.error("string.base64")},case:{method(s){return l(["lower","upper"].includes(s),"Invalid case:",s),this.$_addRule({name:"case",args:{direction:s}})},validate:(s,o,{direction:h})=>h==="lower"&&s===s.toLocaleLowerCase()||h==="upper"&&s===s.toLocaleUpperCase()?s:o.error(`string.${h}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(s,o){let h=s.length,g=0,b=1;for(;h--;){const j=s.charAt(h)*b;g+=j-9*(j>9),b^=3}return g>0&&g%10==0?s:o.error("string.creditCard")}},dataUri:{method(s={}){return t.assertOptions(s,["paddingRequired"]),s={paddingRequired:!0,...s},l(typeof s.paddingRequired=="boolean","paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:s}})},validate(s,o,{options:h}){const g=s.match(c.dataUriRegex);return g&&(!g[2]||g[2]!=="base64"||c.base64Regex[h.paddingRequired].false.test(g[3]))?s:o.error("string.dataUri")}},domain:{method(s){s&&t.assertOptions(s,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const o=c.addressOptions(s);return this.$_addRule({name:"domain",args:{options:s},address:o})},validate:(s,o,h,{address:g})=>$.isValid(s,g)?s:o.error("string.domain")},email:{method(s={}){t.assertOptions(s,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),l(s.multiple===void 0||typeof s.multiple=="boolean","multiple option must be an boolean");const o=c.addressOptions(s),h=new RegExp(`\\s*[${s.separator?e(s.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:s},regex:h,address:o})},validate(s,o,{options:h},{regex:g,address:b}){const j=h.multiple?s.split(g):[s],k=[];for(const f of j)y.isValid(f,b)||k.push(f);return k.length?o.error("string.email",{value:s,invalids:k}):s}},guid:{alias:"uuid",method(s={}){t.assertOptions(s,["version","separator"]);let o="";if(s.version){const b=[].concat(s.version);l(b.length>=1,"version must have at least 1 valid version specified");const j=new Set;for(let k=0;k<b.length;++k){const f=b[k];l(typeof f=="string","version at position "+k+" must be a string");const v=c.guidVersions[f.toLowerCase()];l(v,"version at position "+k+" must be one of "+Object.keys(c.guidVersions).join(", ")),l(!j.has(v),"version at position "+k+" must not be a duplicate"),o+=v,j.add(v)}}l(c.guidSeparators.has(s.separator),'separator must be one of true, false, "-", or ":"');const h=s.separator===void 0?"[:-]?":s.separator===!0?"[:-]":s.separator===!1?"[]?":`\\${s.separator}`,g=new RegExp(`^([\\[{\\(]?)[0-9A-F]{8}(${h})[0-9A-F]{4}\\2?[${o||"0-9A-F"}][0-9A-F]{3}\\2?[${o?"89AB":"0-9A-F"}][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$`,"i");return this.$_addRule({name:"guid",args:{options:s},regex:g})},validate(s,o,h,{regex:g}){const b=g.exec(s);return b?c.guidBrackets[b[1]]!==b[b.length-1]?o.error("string.guid"):s:o.error("string.guid")}},hex:{method(s={}){return t.assertOptions(s,["byteAligned","prefix"]),s={byteAligned:!1,prefix:!1,...s},l(typeof s.byteAligned=="boolean","byteAligned must be boolean"),l(typeof s.prefix=="boolean"||s.prefix==="optional",'prefix must be boolean or "optional"'),this.$_addRule({name:"hex",args:{options:s}})},validate:(s,o,{options:h})=>(h.prefix==="optional"?c.hexRegex.withOptionalPrefix:h.prefix===!0?c.hexRegex.withPrefix:c.hexRegex.withoutPrefix).test(s)?h.byteAligned&&s.length%2!=0?o.error("string.hexAlign"):s:o.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(s,o)=>$.isValid(s,{minDomainSegments:1})||c.ipRegex.test(s)?s:o.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(s={}){t.assertOptions(s,["cidr","version"]);const{cidr:o,versions:h,regex:g}=m.regex(s),b=s.version?h:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:o,version:b}},regex:g})},validate:(s,o,{options:h},{regex:g})=>g.test(s)?s:h.version?o.error("string.ipVersion",{value:s,cidr:h.cidr,version:h.version}):o.error("string.ip",{value:s,cidr:h.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(s,{error:o})=>c.isoDate(s)?s:o("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(s,o)=>c.isoDurationRegex.test(s)?s:o.error("string.isoDuration")},length:{method(s,o){return c.length(this,"length",s,"=",o)},validate(s,o,{limit:h,encoding:g},{name:b,operator:j,args:k}){const f=!g&&s.length;return t.compare(f,h,j)?s:o.error("string."+b,{limit:k.limit,value:s,encoding:g})},args:[{name:"limit",ref:!0,assert:t.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(s,o){return c.length(this,"max",s,"<=",o)},args:["limit","encoding"]},min:{method(s,o){return c.length(this,"min",s,">=",o)},args:["limit","encoding"]},normalize:{method(s="NFC"){return l(c.normalizationForms.includes(s),"normalization form must be one of "+c.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:s}})},validate:(s,{error:o},{form:h})=>s===s.normalize(h)?s:o("string.normalize",{value:s,form:h}),convert:!0},pattern:{alias:"regex",method(s,o={}){l(s instanceof RegExp,"regex must be a RegExp"),l(!s.flags.includes("g")&&!s.flags.includes("y"),"regex should not use global or sticky mode"),typeof o=="string"&&(o={name:o}),t.assertOptions(o,["invert","name"]);const h=["string.pattern",o.invert?".invert":"",o.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:s,options:o},errorCode:h})},validate:(s,o,{regex:h,options:g},{errorCode:b})=>h.test(s)^g.invert?s:o.error(b,{name:g.name,regex:h,value:s}),args:["regex","options"],multi:!0},replace:{method(s,o){typeof s=="string"&&(s=new RegExp(e(s),"g")),l(s instanceof RegExp,"pattern must be a RegExp"),l(typeof o=="string","replacement must be a String");const h=this.clone();return h.$_terms.replacements||(h.$_terms.replacements=[]),h.$_terms.replacements.push({pattern:s,replacement:o}),h}},token:{method(){return this.$_addRule("token")},validate:(s,o)=>/^\w+$/.test(s)?s:o.error("string.token")},trim:{method(s=!0){return l(typeof s=="boolean","enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:s}})},validate:(s,o,{enabled:h})=>h&&s!==s.trim()?o.error("string.trim"):s,convert:!0},truncate:{method(s=!0){return l(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:o,scheme:h}=i.regex(s),g=s.domain?c.addressOptions(s.domain):null;return this.$_addRule({name:"uri",args:{options:s},regex:o,domain:g,scheme:h})},validate(s,o,{options:h},{regex:g,domain:b,scheme:j}){if(["http:/","https:/"].includes(s))return o.error("string.uri");let k=g.exec(s);if(!k&&o.prefs.convert&&h.encodeUri){const f=encodeURI(s);k=g.exec(f),k&&(s=f)}if(k){const f=k[1]||k[2];return!b||h.allowRelative&&!f||$.isValid(f,b)?s:o.error("string.domain",{value:f})}return h.relativeOnly?o.error("string.uriRelativeOnly"):h.scheme?o.error("string.uriCustomScheme",{scheme:j,value:s}):o.error("string.uri")}}},manifest:{build(s,o){if(o.replacements)for(const{pattern:h,replacement:g}of o.replacements)s=s.replace(h,g);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"}}),c.addressOptions=function(s){if(!s)return c.tlds||s;if(l(s.minDomainSegments===void 0||Number.isSafeInteger(s.minDomainSegments)&&s.minDomainSegments>0,"minDomainSegments must be a positive integer"),l(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 l(c.tlds,"Built-in TLD list disabled"),Object.assign({},s,c.tlds);l(typeof s.tlds=="object","tlds must be true, false, or an object");const o=s.tlds.deny;if(o)return Array.isArray(o)&&(s=Object.assign({},s,{tlds:{deny:new Set(o)}})),l(s.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),l(!s.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),c.validateTlds(s.tlds.deny,"tlds.deny"),s;const h=s.tlds.allow;return h?h===!0?(l(c.tlds,"Built-in TLD list disabled"),Object.assign({},s,c.tlds)):(Array.isArray(h)&&(s=Object.assign({},s,{tlds:{allow:new Set(h)}})),l(s.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),c.validateTlds(s.tlds.allow,"tlds.allow"),s):s},c.validateTlds=function(s,o){for(const h of s)l($.isValid(h,{minDomainSegments:1,maxDomainSegments:1}),`${o} must contain valid top level domain names`)},c.isoDate=function(s){if(!t.isIsoDate(s))return null;/.*T.*[+-]\d\d$/.test(s)&&(s+="00");const o=new Date(s);return isNaN(o.getTime())?null:o.toISOString()},c.length=function(s,o,h,g,b){return l(!b||!1,"Invalid encoding:",b),s.$_addRule({name:o,method:"length",args:{limit:h,encoding:b},operator:g})}},8826:(L,p,w)=>{const l=w(375),$=w(8068),y={};y.Map=class extends Map{slice(){return new y.Map(this)}},L.exports=$.extend({type:"symbol",terms:{map:{init:new y.Map}},coerce:{method(m,{schema:e,error:a}){const i=e.$_terms.map.get(m);return i&&(m=i),e._flags.only&&typeof m!="symbol"?{value:m,errors:a("symbol.map",{map:e.$_terms.map})}:{value:m}}},validate(m,{error:e}){if(typeof m!="symbol")return{value:m,errors:e("symbol.base")}},rules:{map:{method(m){m&&!m[Symbol.iterator]&&typeof m=="object"&&(m=Object.entries(m)),l(m&&m[Symbol.iterator],"Iterable must be an iterable or object");const e=this.clone(),a=[];for(const i of m){l(i&&i[Symbol.iterator],"Entry must be an iterable");const[r,t]=i;l(typeof r!="object"&&typeof r!="function"&&typeof r!="symbol","Key must not be of type object, function, or Symbol"),l(typeof t=="symbol","Value must be a Symbol"),e.$_terms.map.set(r,t),a.push(t)}return e.valid(...a)}}},manifest:{build:(m,e)=>(e.map&&(m=m.map(e.map)),m)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(L,p,w)=>{const l=w(375),$=w(8571),y=w(738),m=w(9621),e=w(8160),a=w(6354),i=w(493),r={result:Symbol("result")};p.entry=function(t,c,s){let o=e.defaults;s&&(l(s.warnings===void 0,"Cannot override warnings preference in synchronous validation"),l(s.artifacts===void 0,"Cannot override artifacts preference in synchronous validation"),o=e.preferences(e.defaults,s));const h=r.entry(t,c,o);l(!h.mainstay.externals.length,"Schema with external rules must use validateAsync()");const g={value:h.value};return h.error&&(g.error=h.error),h.mainstay.warnings.length&&(g.warning=a.details(h.mainstay.warnings)),h.mainstay.debug&&(g.debug=h.mainstay.debug),h.mainstay.artifacts&&(g.artifacts=h.mainstay.artifacts),g},p.entryAsync=async function(t,c,s){let o=e.defaults;s&&(o=e.preferences(e.defaults,s));const h=r.entry(t,c,o),g=h.mainstay;if(h.error)throw g.debug&&(h.error.debug=g.debug),h.error;if(g.externals.length){let j=h.value;const k=[];for(const f of g.externals){const v=f.state.path,x=f.schema.type==="link"?g.links.get(f.schema):null;let E,N,M=j;const n=v.length?[j]:[],d=v.length?m(t,v):t;if(v.length){E=v[v.length-1];let _=j;for(const R of v.slice(0,-1))_=_[R],n.unshift(_);N=n[0],M=N[E]}try{const _=(O,C)=>(x||f.schema).$_createError(O,M,C,f.state,o),R=await f.method(M,{schema:f.schema,linked:x,state:f.state,prefs:s,original:d,error:_,errorsArray:r.errorsArray,warn:(O,C)=>g.warnings.push((x||f.schema).$_createError(O,M,C,f.state,o)),message:(O,C)=>(x||f.schema).$_createError("external",M,C,f.state,o,{messages:O})});if(R===void 0||R===M)continue;if(R instanceof a.Report){if(g.tracer.log(f.schema,f.state,"rule","external","error"),k.push(R),o.abortEarly)break;continue}if(Array.isArray(R)&&R[e.symbols.errors]){if(g.tracer.log(f.schema,f.state,"rule","external","error"),k.push(...R),o.abortEarly)break;continue}N?(g.tracer.value(f.state,"rule",M,R,"external"),N[E]=R):(g.tracer.value(f.state,"rule",j,R,"external"),j=R)}catch(_){throw o.errors.label&&(_.message+=` (${f.label})`),_}}if(h.value=j,k.length)throw h.error=a.process(k,t,o),g.debug&&(h.error.debug=g.debug),h.error}if(!o.warnings&&!o.debug&&!o.artifacts)return h.value;const b={value:h.value};return g.warnings.length&&(b.warning=a.details(g.warnings)),g.debug&&(b.debug=g.debug),g.artifacts&&(b.artifacts=g.artifacts),b},r.Mainstay=class{constructor(t,c,s){this.externals=[],this.warnings=[],this.tracer=t,this.debug=c,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,c,s){const{tracer:o,cleanup:h}=r.tracer(c,s),g=s.debug?[]:null,b=c._ids._schemaChain?new Map:null,j=new r.Mainstay(o,g,b),k=c._ids._schemaChain?[{schema:c}]:null,f=new i([],[],{mainstay:j,schemas:k}),v=p.validate(t,c,f,s);h&&c.$_root.untrace();const x=a.process(v.errors,t,s);return{value:v.value,error:x,mainstay:j}},r.tracer=function(t,c){return t.$_root._tracer?{tracer:t.$_root._tracer._register(t)}:c.debug?(l(t.$_root.trace,"Debug mode not supported"),{tracer:t.$_root.trace()._register(t),cleanup:!0}):{tracer:r.ignore}},p.validate=function(t,c,s,o,h={}){if(c.$_terms.whens&&(c=c._generate(t,s,o).schema),c._preferences&&(o=r.prefs(c,o)),c._cache&&o.cache){const x=c._cache.get(t);if(s.mainstay.tracer.debug(s,"validate","cached",!!x),x)return x}const g=(x,E,N)=>c.$_createError(x,t,E,N||s,o),b={original:t,prefs:o,schema:c,state:s,error:g,errorsArray:r.errorsArray,warn:(x,E,N)=>s.mainstay.warnings.push(g(x,E,N)),message:(x,E)=>c.$_createError("custom",t,E,s,o,{messages:x})};s.mainstay.tracer.entry(c,s);const j=c._definition;if(j.prepare&&t!==void 0&&o.convert){const x=j.prepare(t,b);if(x){if(s.mainstay.tracer.value(s,"prepare",t,x.value),x.errors)return r.finalize(x.value,[].concat(x.errors),b);t=x.value}}if(j.coerce&&t!==void 0&&o.convert&&(!j.coerce.from||j.coerce.from.includes(typeof t))){const x=j.coerce.method(t,b);if(x){if(s.mainstay.tracer.value(s,"coerced",t,x.value),x.errors)return r.finalize(x.value,[].concat(x.errors),b);t=x.value}}const k=c._flags.empty;k&&k.$_match(r.trim(t,c),s.nest(k),e.defaults)&&(s.mainstay.tracer.value(s,"empty",t,void 0),t=void 0);const f=h.presence||c._flags.presence||(c._flags._endedSwitch?null:o.presence);if(t===void 0){if(f==="forbidden")return r.finalize(t,null,b);if(f==="required")return r.finalize(t,[c.$_createError("any.required",t,null,s,o)],b);if(f==="optional"){if(c._flags.default!==e.symbols.deepDefault)return r.finalize(t,null,b);s.mainstay.tracer.value(s,"default",t,{}),t={}}}else if(f==="forbidden")return r.finalize(t,[c.$_createError("any.unknown",t,null,s,o)],b);const v=[];if(c._valids){const x=c._valids.get(t,s,o,c._flags.insensitive);if(x)return o.convert&&(s.mainstay.tracer.value(s,"valids",t,x.value),t=x.value),s.mainstay.tracer.filter(c,s,"valid",x),r.finalize(t,null,b);if(c._flags.only){const E=c.$_createError("any.only",t,{valids:c._valids.values({display:!0})},s,o);if(o.abortEarly)return r.finalize(t,[E],b);v.push(E)}}if(c._invalids){const x=c._invalids.get(t,s,o,c._flags.insensitive);if(x){s.mainstay.tracer.filter(c,s,"invalid",x);const E=c.$_createError("any.invalid",t,{invalids:c._invalids.values({display:!0})},s,o);if(o.abortEarly)return r.finalize(t,[E],b);v.push(E)}}if(j.validate){const x=j.validate(t,b);if(x&&(s.mainstay.tracer.value(s,"base",t,x.value),t=x.value,x.errors)){if(!Array.isArray(x.errors))return v.push(x.errors),r.finalize(t,v,b);if(x.errors.length)return v.push(...x.errors),r.finalize(t,v,b)}}return c._rules.length?r.rules(t,v,b):r.finalize(t,v,b)},r.rules=function(t,c,s){const{schema:o,state:h,prefs:g}=s;for(const b of o._rules){const j=o._definition.rules[b.method];if(j.convert&&g.convert){h.mainstay.tracer.log(o,h,"rule",b.name,"full");continue}let k,f=b.args;if(b._resolve.length){f=Object.assign({},f);for(const x of b._resolve){const E=j.argsByName.get(x),N=f[x].resolve(t,h,g),M=E.normalize?E.normalize(N):N,n=e.validateArg(M,null,E);if(n){k=o.$_createError("any.ref",N,{arg:x,ref:f[x],reason:n},h,g);break}f[x]=M}}k=k||j.validate(t,s,f,b);const v=r.rule(k,b);if(v.errors){if(h.mainstay.tracer.log(o,h,"rule",b.name,"error"),b.warn){h.mainstay.warnings.push(...v.errors);continue}if(g.abortEarly)return r.finalize(t,v.errors,s);c.push(...v.errors)}else h.mainstay.tracer.log(o,h,"rule",b.name,"pass"),h.mainstay.tracer.value(h,"rule",t,v.value,b.name),t=v.value}return r.finalize(t,c,s)},r.rule=function(t,c){return t instanceof a.Report?(r.error(t,c),{errors:[t],value:null}):Array.isArray(t)&&t[e.symbols.errors]?(t.forEach(s=>r.error(s,c)),{errors:t,value:null}):{errors:null,value:t}},r.error=function(t,c){return c.message&&t._setTemplate(c.message),t},r.finalize=function(t,c,s){c=c||[];const{schema:o,state:h,prefs:g}=s;if(c.length){const j=r.default("failover",void 0,c,s);j!==void 0&&(h.mainstay.tracer.value(h,"failover",t,j),t=j,c=[])}if(c.length&&o._flags.error)if(typeof o._flags.error=="function"){c=o._flags.error(c),Array.isArray(c)||(c=[c]);for(const j of c)l(j instanceof Error||j instanceof a.Report,"error() must return an Error object")}else c=[o._flags.error];if(t===void 0){const j=r.default("default",t,c,s);h.mainstay.tracer.value(h,"default",t,j),t=j}if(o._flags.cast&&t!==void 0){const j=o._definition.cast[o._flags.cast];if(j.from(t)){const k=j.to(t,s);h.mainstay.tracer.value(h,"cast",t,k,o._flags.cast),t=k}}if(o.$_terms.externals&&g.externals&&g._externals!==!1)for(const{method:j}of o.$_terms.externals)h.mainstay.externals.push({method:j,schema:o,state:h,label:a.label(o._flags,h,g)});const b={value:t,errors:c.length?c:null};return o._flags.result&&(b.value=o._flags.result==="strip"?void 0:s.original,h.mainstay.tracer.value(h,o._flags.result,t,b.value),h.shadow(t,o._flags.result)),o._cache&&g.cache!==!1&&!o._refs.length&&o._cache.set(s.original,b),t===void 0||b.errors||o._flags.artifact===void 0||(h.mainstay.artifacts=h.mainstay.artifacts||new Map,h.mainstay.artifacts.has(o._flags.artifact)||h.mainstay.artifacts.set(o._flags.artifact,[]),h.mainstay.artifacts.get(o._flags.artifact).push(h.path)),b},r.prefs=function(t,c){const s=c===e.defaults;return s&&t._preferences[e.symbols.prefs]?t._preferences[e.symbols.prefs]:(c=e.preferences(c,t._preferences),s&&(t._preferences[e.symbols.prefs]=c),c)},r.default=function(t,c,s,o){const{schema:h,state:g,prefs:b}=o,j=h._flags[t];if(b.noDefaults||j===void 0)return c;if(g.mainstay.tracer.log(h,g,"rule",t,"full"),!j)return j;if(typeof j=="function"){const k=j.length?[$(g.ancestors[0]),o]:[];try{return j(...k)}catch(f){return void s.push(h.$_createError(`any.${t}`,null,{error:f},g,b))}}return typeof j!="object"?j:j[e.symbols.literal]?j.literal:e.isResolvable(j)?j.resolve(c,g,b):$(j)},r.trim=function(t,c){if(typeof t!="string")return t;const s=c.$_getRule("trim");return s&&s.args.enabled?t.trim():t},r.ignore={active:!1,debug:y,entry:y,filter:y,log:y,resolve:y,value:y},r.errorsArray=function(){const t=[];return t[e.symbols.errors]=!0,t}},2036:(L,p,w)=>{const l=w(375),$=w(9474),y=w(8160),m={};L.exports=m.Values=class{constructor(e,a){this._values=new Set(e),this._refs=new Set(a),this._lowercase=m.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,a){y.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,i){if(e=e||new m.Values,a){if(a._override)return a.clone();for(const r of[...a._values,...a._refs])e.add(r)}if(i)for(const r of[...i._values,...i._refs])e.remove(r);return e.length?e:null}remove(e){y.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),typeof e=="string"&&this._lowercase.delete(e.toLowerCase()))}has(e,a,i,r){return!!this.get(e,a,i,r)}get(e,a,i,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($(t,e))return{value:t}}if(a)for(const t of this._refs){const c=t.resolve(e,a,i,null,{in:!0});if(c===void 0)continue;const s=t.in&&typeof c=="object"?Array.isArray(c)?c:Object.keys(c):[c];for(const o of s)if(typeof o==typeof e){if(r&&e&&typeof e=="string"){if(o.toLowerCase()===e.toLowerCase())return{value:o,ref:t}}else if($(o,e))return{value:o,ref:t}}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const a=[];for(const i of[...this._values,...this._refs])i!==void 0&&a.push(i);return a}return Array.from([...this._values,...this._refs])}clone(){const e=new m.Values(this._values,this._refs);return e._override=this._override,e}concat(e){l(!e._override,"Cannot concat override set of values");const a=new m.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}},m.Values.prototype[y.symbols.values]=!0,m.Values.prototype.slice=m.Values.prototype.clone,m.lowercases=function(e){const a=new Map;if(e)for(const i of e)typeof i=="string"&&a.set(i.toLowerCase(),i);return a}},978:(L,p,w)=>{const l=w(375),$=w(8571),y=w(1687),m=w(9621),e={};L.exports=function(a,i,r={}){if(l(a&&typeof a=="object","Invalid defaults value: must be an object"),l(!i||i===!0||typeof i=="object","Invalid source value: must be true, falsy or an object"),l(typeof r=="object","Invalid options: must be an object"),!i)return null;if(r.shallow)return e.applyToDefaultsWithShallow(a,i,r);const t=$(a);if(i===!0)return t;const c=r.nullOverride!==void 0&&r.nullOverride;return y(t,i,{nullOverride:c,mergeArrays:!1})},e.applyToDefaultsWithShallow=function(a,i,r){const t=r.shallow;l(Array.isArray(t),"Invalid keys");const c=new Map,s=i===!0?null:new Set;for(let g of t){g=Array.isArray(g)?g:g.split(".");const b=m(a,g);b&&typeof b=="object"?c.set(b,s&&m(i,g)||b):s&&s.add(g)}const o=$(a,{},c);if(!s)return o;for(const g of s)e.reachCopy(o,i,g);const h=r.nullOverride!==void 0&&r.nullOverride;return y(o,i,{nullOverride:h,mergeArrays:!1})},e.reachCopy=function(a,i,r){for(const s of r){if(!(s in i))return;const o=i[s];if(typeof o!="object"||o===null)return;i=o}const t=i;let c=a;for(let s=0;s<r.length-1;++s){const o=r[s];typeof c[o]!="object"&&(c[o]={}),c=c[o]}c[r[r.length-1]]=t}},375:(L,p,w)=>{const l=w(7916);L.exports=function($,...y){if(!$)throw y.length===1&&y[0]instanceof Error?y[0]:new l(y)}},8571:(L,p,w)=>{const l=w(9621),$=w(4277),y=w(7043),m={needsProtoHack:new Set([$.set,$.map,$.weakSet,$.weakMap])};L.exports=m.clone=function(e,a={},i=null){if(typeof e!="object"||e===null)return e;let r=m.clone,t=i;if(a.shallow){if(a.shallow!==!0)return m.cloneWithShallow(e,a);r=h=>h}else if(t){const h=t.get(e);if(h)return h}else t=new Map;const c=$.getInternalProto(e);if(c===$.buffer)return!1;if(c===$.date)return new Date(e.getTime());if(c===$.regex)return new RegExp(e);const s=m.base(e,c,a);if(s===e)return e;if(t&&t.set(e,s),c===$.set)for(const h of e)s.add(r(h,a,t));else if(c===$.map)for(const[h,g]of e)s.set(h,r(g,a,t));const o=y.keys(e,a);for(const h of o){if(h==="__proto__")continue;if(c===$.array&&h==="length"){s.length=e.length;continue}const g=Object.getOwnPropertyDescriptor(e,h);g?g.get||g.set?Object.defineProperty(s,h,g):g.enumerable?s[h]=r(e[h],a,t):Object.defineProperty(s,h,{enumerable:!1,writable:!0,configurable:!0,value:r(e[h],a,t)}):Object.defineProperty(s,h,{enumerable:!0,writable:!0,configurable:!0,value:r(e[h],a,t)})}return s},m.cloneWithShallow=function(e,a){const i=a.shallow;(a=Object.assign({},a)).shallow=!1;const r=new Map;for(const t of i){const c=l(e,t);typeof c!="object"&&typeof c!="function"||r.set(c,c)}return m.clone(e,a,r)},m.base=function(e,a,i){if(i.prototype===!1)return m.needsProtoHack.has(a)?new a.constructor:a===$.array?[]:{};const r=Object.getPrototypeOf(e);if(r&&r.isImmutable)return e;if(a===$.array){const t=[];return r!==a&&Object.setPrototypeOf(t,r),t}if(m.needsProtoHack.has(a)){const t=new r.constructor;return r!==a&&Object.setPrototypeOf(t,r),t}return Object.create(r)}},9474:(L,p,w)=>{const l=w(4277),$={mismatched:null};L.exports=function(y,m,e){return e=Object.assign({prototype:!0},e),!!$.isDeepEqual(y,m,e,[])},$.isDeepEqual=function(y,m,e,a){if(y===m)return y!==0||1/y==1/m;const i=typeof y;if(i!==typeof m||y===null||m===null)return!1;if(i==="function"){if(!e.deepFunction||y.toString()!==m.toString())return!1}else if(i!=="object")return y!=y&&m!=m;const r=$.getSharedType(y,m,!!e.prototype);switch(r){case l.buffer:return!1;case l.promise:return y===m;case l.regex:return y.toString()===m.toString();case $.mismatched:return!1}for(let t=a.length-1;t>=0;--t)if(a[t].isSame(y,m))return!0;a.push(new $.SeenEntry(y,m));try{return!!$.isDeepEqualObj(r,y,m,e,a)}finally{a.pop()}},$.getSharedType=function(y,m,e){if(e)return Object.getPrototypeOf(y)!==Object.getPrototypeOf(m)?$.mismatched:l.getInternalProto(y);const a=l.getInternalProto(y);return a!==l.getInternalProto(m)?$.mismatched:a},$.valueOf=function(y){const m=y.valueOf;if(m===void 0)return y;try{return m.call(y)}catch(e){return e}},$.hasOwnEnumerableProperty=function(y,m){return Object.prototype.propertyIsEnumerable.call(y,m)},$.isSetSimpleEqual=function(y,m){for(const e of Set.prototype.values.call(y))if(!Set.prototype.has.call(m,e))return!1;return!0},$.isDeepEqualObj=function(y,m,e,a,i){const{isDeepEqual:r,valueOf:t,hasOwnEnumerableProperty:c}=$,{keys:s,getOwnPropertySymbols:o}=Object;if(y===l.array){if(!a.part){if(m.length!==e.length)return!1;for(let k=0;k<m.length;++k)if(!r(m[k],e[k],a,i))return!1;return!0}for(const k of m)for(const f of e)if(r(k,f,a,i))return!0}else if(y===l.set){if(m.size!==e.size)return!1;if(!$.isSetSimpleEqual(m,e)){const k=new Set(Set.prototype.values.call(e));for(const f of Set.prototype.values.call(m)){if(k.delete(f))continue;let v=!1;for(const x of k)if(r(f,x,a,i)){k.delete(x),v=!0;break}if(!v)return!1}}}else if(y===l.map){if(m.size!==e.size)return!1;for(const[k,f]of Map.prototype.entries.call(m))if(f===void 0&&!Map.prototype.has.call(e,k)||!r(f,Map.prototype.get.call(e,k),a,i))return!1}else if(y===l.error&&(m.name!==e.name||m.message!==e.message))return!1;const h=t(m),g=t(e);if((m!==h||e!==g)&&!r(h,g,a,i))return!1;const b=s(m);if(!a.part&&b.length!==s(e).length&&!a.skip)return!1;let j=0;for(const k of b)if(a.skip&&a.skip.includes(k))e[k]===void 0&&++j;else if(!c(e,k)||!r(m[k],e[k],a,i))return!1;if(!a.part&&b.length-j!==s(e).length)return!1;if(a.symbols!==!1){const k=o(m),f=new Set(o(e));for(const v of k){if(!a.skip||!a.skip.includes(v)){if(c(m,v)){if(!c(e,v)||!r(m[v],e[v],a,i))return!1}else if(c(e,v))return!1}f.delete(v)}for(const v of f)if(c(e,v))return!1}return!0},$.SeenEntry=class{constructor(y,m){this.obj=y,this.ref=m}isSame(y,m){return this.obj===y&&this.ref===m}}},7916:(L,p,w)=>{const l=w(8761);L.exports=class extends Error{constructor($){super($.filter(y=>y!=="").map(y=>typeof y=="string"?y:y instanceof Error?y.message:l(y)).join(" ")||"Unknown error"),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,p.assert)}}},5277:L=>{const p={};L.exports=function(w){if(!w)return"";let l="";for(let $=0;$<w.length;++$){const y=w.charCodeAt($);p.isSafe(y)?l+=w[$]:l+=p.escapeHtmlChar(y)}return l},p.escapeHtmlChar=function(w){return p.namedHtml.get(w)||(w>=256?"&#"+w+";":`&#x${w.toString(16).padStart(2,"0")};`)},p.isSafe=function(w){return p.safeCharCodes.has(w)},p.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]),p.safeCharCodes=function(){const w=new Set;for(let l=32;l<123;++l)(l>=97||l>=65&&l<=90||l>=48&&l<=57||l===32||l===46||l===44||l===45||l===58||l===95)&&w.add(l);return w}()},6064:L=>{L.exports=function(p){return p.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},738:L=>{L.exports=function(){}},1687:(L,p,w)=>{const l=w(375),$=w(8571),y=w(7043),m={};L.exports=m.merge=function(e,a,i){if(l(e&&typeof e=="object","Invalid target value: must be an object"),l(a==null||typeof a=="object","Invalid source value: must be null, undefined, or an object"),!a)return e;if(i=Object.assign({nullOverride:!0,mergeArrays:!0},i),Array.isArray(a)){l(Array.isArray(e),"Cannot merge array onto an object"),i.mergeArrays||(e.length=0);for(let t=0;t<a.length;++t)e.push($(a[t],{symbols:i.symbols}));return e}const r=y.keys(a,i);for(let t=0;t<r.length;++t){const c=r[t];if(c==="__proto__"||!Object.prototype.propertyIsEnumerable.call(a,c))continue;const s=a[c];if(s&&typeof s=="object"){if(e[c]===s)continue;!e[c]||typeof e[c]!="object"||Array.isArray(e[c])!==Array.isArray(s)||s instanceof Date||s instanceof RegExp?e[c]=$(s,{symbols:i.symbols}):m.merge(e[c],s,i)}else(s!=null||i.nullOverride)&&(e[c]=s)}return e}},9621:(L,p,w)=>{const l=w(375),$={};L.exports=function(y,m,e){if(m===!1||m==null)return y;typeof(e=e||{})=="string"&&(e={separator:e});const a=Array.isArray(m);l(!a||!e.separator,"Separator option is not valid for array-based chain");const i=a?m:m.split(e.separator||".");let r=y;for(let t=0;t<i.length;++t){let c=i[t];const s=e.iterables&&$.iterables(r);if(Array.isArray(r)||s==="set"){const o=Number(c);Number.isInteger(o)&&(c=o<0?r.length+o:o)}if(!r||typeof r=="function"&&e.functions===!1||!s&&r[c]===void 0){l(!e.strict||t+1===i.length,"Missing segment",c,"in reach path ",m),l(typeof r=="object"||e.functions===!0||typeof r!="function","Invalid segment",c,"in reach path ",m),r=e.default;break}r=s?s==="set"?[...r][c]:r.get(c):r[c]}return r},$.iterables=function(y){return y instanceof Set?"set":y instanceof Map?"map":void 0}},8761:L=>{L.exports=function(...p){try{return JSON.stringify(...p)}catch(w){return"[Cannot display object: "+w.message+"]"}}},4277:(L,p)=>{const w={};p=L.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},w.typeMap=new Map([["[object Error]",p.error],["[object Map]",p.map],["[object Promise]",p.promise],["[object Set]",p.set],["[object WeakMap]",p.weakMap],["[object WeakSet]",p.weakSet]]),p.getInternalProto=function(l){if(Array.isArray(l))return p.array;if(l instanceof Date)return p.date;if(l instanceof RegExp)return p.regex;if(l instanceof Error)return p.error;const $=Object.prototype.toString.call(l);return w.typeMap.get($)||p.generic}},7043:(L,p)=>{p.keys=function(w,l={}){return l.symbols!==!1?Reflect.ownKeys(w):Object.getOwnPropertyNames(w)}},3652:(L,p,w)=>{const l=w(375),$={};p.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(y,m){const e=[].concat((m=m||{}).before||[]),a=[].concat(m.after||[]),i=m.group||"?",r=m.sort||0;l(!e.includes(i),`Item cannot come before itself: ${i}`),l(!e.includes("?"),"Item cannot come before unassociated items"),l(!a.includes(i),`Item cannot come after itself: ${i}`),l(!a.includes("?"),"Item cannot come after unassociated items"),Array.isArray(y)||(y=[y]);for(const t of y){const c={seq:this._items.length,sort:r,before:e,after:a,group:i,node:t};this._items.push(c)}if(!m.manual){const t=this._sort();l(t,"item",i!=="?"?`added into group ${i}`:"","created a dependencies error")}return this.nodes}merge(y){Array.isArray(y)||(y=[y]);for(const e of y)if(e)for(const a of e._items)this._items.push(Object.assign({},a));this._items.sort($.mergeSort);for(let e=0;e<this._items.length;++e)this._items[e].seq=e;const m=this._sort();return l(m,"merge created a dependencies error"),this.nodes}sort(){const y=this._sort();return l(y,"sort created a dependencies error"),this.nodes}_sort(){const y={},m=Object.create(null),e=Object.create(null);for(const c of this._items){const s=c.seq,o=c.group;e[o]=e[o]||[],e[o].push(s),y[s]=c.before;for(const h of c.after)m[h]=m[h]||[],m[h].push(s)}for(const c in y){const s=[];for(const o in y[c]){const h=y[c][o];e[h]=e[h]||[],s.push(...e[h])}y[c]=s}for(const c in m)if(e[c])for(const s of e[c])y[s].push(...m[c]);const a={};for(const c in y){const s=y[c];for(const o of s)a[o]=a[o]||[],a[o].push(c)}const i={},r=[];for(let c=0;c<this._items.length;++c){let s=c;if(a[c]){s=null;for(let o=0;o<this._items.length;++o){if(i[o]===!0)continue;a[o]||(a[o]=[]);const h=a[o].length;let g=0;for(let b=0;b<h;++b)i[a[o][b]]&&++g;if(g===h){s=o;break}}}s!==null&&(i[s]=!0,r.push(s))}if(r.length!==this._items.length)return!1;const t={};for(const c of this._items)t[c.seq]=c;this._items=[],this.nodes=[];for(const c of r){const s=t[c];this.nodes.push(s.node),this._items.push(s)}return!0}},$.mergeSort=(y,m)=>y.sort===m.sort?0:y.sort<m.sort?-1:1},5380:(L,p,w)=>{const l=w(443),$=w(2178),y={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:l.URL||URL};p.analyze=function(m,e={}){if(!m)return $.code("DOMAIN_NON_EMPTY_STRING");if(typeof m!="string")throw new Error("Invalid input: domain must be a string");if(m.length>256)return $.code("DOMAIN_TOO_LONG");if(y.nonAsciiRx.test(m)){if(e.allowUnicode===!1)return $.code("DOMAIN_INVALID_UNICODE_CHARS");m=m.normalize("NFC")}if(y.domainControlRx.test(m))return $.code("DOMAIN_INVALID_CHARS");m=y.punycode(m),e.allowFullyQualified&&m[m.length-1]==="."&&(m=m.slice(0,-1));const a=e.minDomainSegments||y.minDomainSegments,i=m.split(".");if(i.length<a)return $.code("DOMAIN_SEGMENTS_COUNT");if(e.maxDomainSegments&&i.length>e.maxDomainSegments)return $.code("DOMAIN_SEGMENTS_COUNT_MAX");const r=e.tlds;if(r){const t=i[i.length-1].toLowerCase();if(r.deny&&r.deny.has(t)||r.allow&&!r.allow.has(t))return $.code("DOMAIN_FORBIDDEN_TLDS")}for(let t=0;t<i.length;++t){const c=i[t];if(!c.length)return $.code("DOMAIN_EMPTY_SEGMENT");if(c.length>63)return $.code("DOMAIN_LONG_SEGMENT");if(t<i.length-1){if(!y.domainSegmentRx.test(c))return $.code("DOMAIN_INVALID_CHARS")}else if(!y.tldSegmentRx.test(c))return $.code("DOMAIN_INVALID_TLDS_CHARS")}return null},p.isValid=function(m,e){return!p.analyze(m,e)},y.punycode=function(m){m.includes("%")&&(m=m.replace(/%/g,"%25"));try{return new y.URL(`http://${m}`).host}catch{return m}}},1745:(L,p,w)=>{const l=w(9848),$=w(5380),y=w(2178),m={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(l.TextEncoder||TextEncoder)};p.analyze=function(e,a){return m.email(e,a)},p.isValid=function(e,a){return!m.email(e,a)},m.email=function(e,a={}){if(typeof e!="string")throw new Error("Invalid input: email must be a string");if(!e)return y.code("EMPTY_STRING");const i=!m.nonAsciiRx.test(e);if(!i){if(a.allowUnicode===!1)return y.code("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const r=e.split("@");if(r.length!==2)return r.length>2?y.code("MULTIPLE_AT_CHAR"):y.code("MISSING_AT_CHAR");const[t,c]=r;if(!t)return y.code("EMPTY_LOCAL");if(!a.ignoreLength){if(e.length>254)return y.code("ADDRESS_TOO_LONG");if(m.encoder.encode(t).length>64)return y.code("LOCAL_TOO_LONG")}return m.local(t,i)||$.analyze(c,a)},m.local=function(e,a){const i=e.split(".");for(const r of i){if(!r.length)return y.code("EMPTY_LOCAL_SEGMENT");if(a){if(!m.atextRx.test(r))return y.code("INVALID_LOCAL_CHARS")}else for(const t of r){if(m.atextRx.test(t))continue;const c=m.binary(t);if(!m.atomRx.test(c))return y.code("INVALID_LOCAL_CHARS")}}},m.binary=function(e){return Array.from(m.encoder.encode(e)).map(a=>String.fromCharCode(a)).join("")},m.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,m.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:(L,p)=>{p.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"},p.code=function(w){return{code:w,error:p.codes[w]}}},9959:(L,p,w)=>{const l=w(375),$=w(5752);p.regex=function(y={}){l(y.cidr===void 0||typeof y.cidr=="string","options.cidr must be a string");const m=y.cidr?y.cidr.toLowerCase():"optional";l(["required","optional","forbidden"].includes(m),"options.cidr must be one of required, optional, forbidden"),l(y.version===void 0||typeof y.version=="string"||Array.isArray(y.version),"options.version must be a string or an array of string");let e=y.version||["ipv4","ipv6","ipvfuture"];Array.isArray(e)||(e=[e]),l(e.length>=1,"options.version must have at least 1 version specified");for(let r=0;r<e.length;++r)l(typeof e[r]=="string","options.version must only contain strings"),e[r]=e[r].toLowerCase(),l(["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(m==="forbidden")return $.ip[r];const t=`\\/${r==="ipv4"?$.ip.v4Cidr:$.ip.v6Cidr}`;return m==="required"?`${$.ip[r]}${t}`:`${$.ip[r]}(?:${t})?`}).join("|")})`,i=new RegExp(`^${a}$`);return{cidr:m,versions:e,regex:i,raw:a}}},5752:(L,p,w)=>{const l=w(375),$=w(6064),y={generate:function(){const m={},e="\\dA-Fa-f",a="["+e+"]",i="\\w-\\.~",r="!\\$&'\\(\\)\\*\\+,;=",t="%"+e,c=i+t+r+":@",s="["+c+"]",o="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";m.ipv4address="(?:"+o+"\\.){3}"+o;const h=a+"{1,4}",g="(?:"+h+":"+h+"|"+m.ipv4address+")",b="(?:"+h+":){6}"+g,j="::(?:"+h+":){5}"+g,k="(?:"+h+")?::(?:"+h+":){4}"+g,f="(?:(?:"+h+":){0,1}"+h+")?::(?:"+h+":){3}"+g,v="(?:(?:"+h+":){0,2}"+h+")?::(?:"+h+":){2}"+g,x="(?:(?:"+h+":){0,3}"+h+")?::"+h+":"+g,E="(?:(?:"+h+":){0,4}"+h+")?::"+g,N="(?:(?:"+h+":){0,5}"+h+")?::"+h,M="(?:(?:"+h+":){0,6}"+h+")?::";m.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",m.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",m.ipv6address="(?:"+b+"|"+j+"|"+k+"|"+f+"|"+v+"|"+x+"|"+E+"|"+N+"|"+M+")",m.ipvFuture="v"+a+"+\\.["+i+r+":]+",m.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",m.schemeRegex=new RegExp(m.scheme);const n="["+i+t+r+":]*",d="["+i+t+r+"]{1,255}",_="(?:\\[(?:"+m.ipv6address+"|"+m.ipvFuture+")\\]|"+m.ipv4address+"|"+d+")",R="(?:"+n+"@)?"+_+"(?::\\d*)?",O="(?:"+n+"@)?("+_+")(?::\\d*)?",C=s+"*",D=s+"+",S="(?:\\/"+C+")*",u="\\/(?:"+D+S+")?",A=D+S,z="["+i+t+r+"@]+"+S,F="(?:\\/\\/\\/"+C+S+")";return m.hierPart="(?:(?:\\/\\/"+R+S+")|"+u+"|"+A+"|"+F+")",m.hierPartCapture="(?:(?:\\/\\/"+O+S+")|"+u+"|"+A+")",m.relativeRef="(?:(?:\\/\\/"+R+S+")|"+u+"|"+z+"|)",m.relativeRefCapture="(?:(?:\\/\\/"+O+S+")|"+u+"|"+z+"|)",m.query="["+c+"\\/\\?]*(?=#|$)",m.queryWithSquareBrackets="["+c+"\\[\\]\\/\\?]*(?=#|$)",m.fragment="["+c+"\\/\\?]*",m}};y.rfc3986=y.generate(),p.ip={v4Cidr:y.rfc3986.ipv4Cidr,v6Cidr:y.rfc3986.ipv6Cidr,ipv4:y.rfc3986.ipv4address,ipv6:y.rfc3986.ipv6address,ipvfuture:y.rfc3986.ipvFuture},y.createRegex=function(m){const e=y.rfc3986,a="(?:\\?"+(m.allowQuerySquareBrackets?e.queryWithSquareBrackets:e.query)+")?(?:#"+e.fragment+")?",i=m.domain?e.relativeRefCapture:e.relativeRef;if(m.relativeOnly)return y.wrap(i+a);let r="";if(m.scheme){l(m.scheme instanceof RegExp||typeof m.scheme=="string"||Array.isArray(m.scheme),"scheme must be a RegExp, String, or Array");const s=[].concat(m.scheme);l(s.length>=1,"scheme must have at least 1 scheme specified");const o=[];for(let h=0;h<s.length;++h){const g=s[h];l(g instanceof RegExp||typeof g=="string","scheme at position "+h+" must be a RegExp or String"),g instanceof RegExp?o.push(g.source.toString()):(l(e.schemeRegex.test(g),"scheme at position "+h+" must be a valid scheme"),o.push($(g)))}r=o.join("|")}const t="(?:"+(r?"(?:"+r+")":e.scheme)+":"+(m.domain?e.hierPartCapture:e.hierPart)+")",c=m.allowRelative?"(?:"+t+"|"+i+")":t;return y.wrap(c+a,r)},y.wrap=function(m,e){return{raw:m=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${m}`,regex:new RegExp(`^${m}$`),scheme:e}},y.uriRegex=y.createRegex({}),p.regex=function(m={}){return m.scheme||m.allowRelative||m.relativeOnly||m.allowQuerySquareBrackets||m.domain?y.createRegex(m):y.uriRegex}},1447:(L,p)=>{const w={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};p.Parser=class{constructor(l,$={}){if(!$[w.settings]&&$.constants)for(const y in $.constants){const m=$.constants[y];if(m!==null&&!["boolean","number","string"].includes(typeof m))throw new Error(`Formula constant ${y} contains invalid ${typeof m} value type`)}this.settings=$[w.settings]?$:Object.assign({[w.settings]:!0,constants:{},functions:{}},$),this.single=null,this._parts=null,this._parse(l)}_parse(l){let $=[],y="",m=0,e=!1;const a=r=>{if(m)throw new Error("Formula missing closing parenthesis");const t=$.length?$[$.length-1]:null;if(e||y||r){if(t&&t.type==="reference"&&r===")")return t.type="function",t.value=this._subFormula(y,t.value),void(y="");if(r===")"){const c=new p.Parser(y,this.settings);$.push({type:"segment",value:c})}else if(e){if(e==="]")return $.push({type:"reference",value:y}),void(y="");$.push({type:"literal",value:y})}else if(w.operatorCharacters.includes(y))t&&t.type==="operator"&&w.operators.includes(t.value+y)?t.value+=y:$.push({type:"operator",value:y});else if(y.match(w.numberRx))$.push({type:"constant",value:parseFloat(y)});else if(this.settings.constants[y]!==void 0)$.push({type:"constant",value:this.settings.constants[y]});else{if(!y.match(w.tokenRx))throw new Error(`Formula contains invalid token: ${y}`);$.push({type:"reference",value:y})}y=""}};for(const r of l)e?r===e?(a(),e=!1):y+=r:m?r==="("?(y+=r,++m):r===")"?(--m,m?y+=r:a(r)):y+=r:r in w.literals?e=w.literals[r]:r==="("?(a(),++m):w.operatorCharacters.includes(r)?(a(),y=r,a()):r!==" "?y+=r:a();a(),$=$.map((r,t)=>r.type!=="operator"||r.value!=="-"||t&&$[t-1].type!=="operator"?r:{type:"operator",value:"n"});let i=!1;for(const r of $){if(r.type==="operator"){if(w.operatorsPrefix.includes(r.value))continue;if(!i)throw new Error("Formula contains an operator in invalid position");if(!w.operators.includes(r.value))throw new Error(`Formula contains an unknown operator ${r.value}`)}else if(i)throw new Error("Formula missing expected operator");i=!i}if(!i)throw new Error("Formula contains invalid trailing operator");$.length===1&&["reference","literal","constant"].includes($[0].type)&&(this.single={type:$[0].type==="reference"?"reference":"value",value:$[0].value}),this._parts=$.map(r=>{if(r.type==="operator")return w.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):w.reference(r.value)})}_subFormula(l,$){const y=this.settings.functions[$];if(typeof y!="function")throw new Error(`Formula contains unknown function ${$}`);let m=[];if(l){let e="",a=0,i=!1;const r=()=>{if(!e)throw new Error(`Formula contains function ${$} with invalid arguments ${l}`);m.push(e),e=""};for(let t=0;t<l.length;++t){const c=l[t];i?(e+=c,c===i&&(i=!1)):c in w.literals&&!a?(e+=c,i=w.literals[c]):c!==","||a?(e+=c,c==="("?++a:c===")"&&--a):r()}r()}return m=m.map(e=>new p.Parser(e,this.settings)),function(e){const a=[];for(const i of m)a.push(i.evaluate(e));return y.call(e,...a)}}evaluate(l){const $=this._parts.slice();for(let y=$.length-2;y>=0;--y){const m=$[y];if(m&&m.type==="operator"){const e=$[y+1];$.splice(y+1,1);const a=w.evaluate(e,l);$[y]=w.single(m.value,a)}}return w.operatorsOrder.forEach(y=>{for(let m=1;m<$.length-1;)if(y.includes($[m])){const e=$[m],a=w.evaluate($[m-1],l),i=w.evaluate($[m+1],l);$.splice(m,2);const r=w.calculate(e,a,i);$[m-1]=r===0?0:r}else m+=2}),w.evaluate($[0],l)}},p.Parser.prototype[w.symbol]=!0,w.reference=function(l){return function($){return $&&$[l]!==void 0?$[l]:null}},w.evaluate=function(l,$){return l===null?null:typeof l=="function"?l($):l[w.symbol]?l.evaluate($):l},w.single=function(l,$){if(l==="!")return!$;const y=-$;return y===0?0:y},w.calculate=function(l,$,y){if(l==="??")return w.exists($)?$:y;if(typeof $=="string"||typeof y=="string"){if(l==="+")return($=w.exists($)?$:"")+(w.exists(y)?y:"")}else switch(l){case"^":return Math.pow($,y);case"*":return $*y;case"/":return $/y;case"%":return $%y;case"+":return $+y;case"-":return $-y}switch(l){case"<":return $<y;case"<=":return $<=y;case">":return $>y;case">=":return $>=y;case"==":return $===y;case"!=":return $!==y;case"&&":return $&&y;case"||":return $||y}return null},w.exists=function(l){return l!=null}},9926:()=>{},5688:()=>{},9708:()=>{},1152:()=>{},443:()=>{},9848:()=>{},5934:L=>{L.exports=JSON.parse('{"version":"17.13.3"}')}},T={},function L(p){var w=T[p];if(w!==void 0)return w.exports;var l=T[p]={exports:{}};return B[p](l,l.exports,L),l.exports}(5107);var B,T})})(fr);var Zr=fr.exports,At={},Ot={exports:{}};Ot.exports;(function(I){(function(P,B){function T(M,n){if(!M)throw new Error(n||"Assertion failed")}function L(M,n){M.super_=n;var d=function(){};d.prototype=n.prototype,M.prototype=new d,M.prototype.constructor=M}function p(M,n,d){if(p.isBN(M))return M;this.negative=0,this.words=null,this.length=0,this.red=null,M!==null&&((n==="le"||n==="be")&&(d=n,n=10),this._init(M||0,n||10,d||"be"))}typeof P=="object"?P.exports=p:B.BN=p,p.BN=p,p.wordSize=26;var w;try{typeof window<"u"&&typeof window.Buffer<"u"?w=window.Buffer:w=Dr.Buffer}catch{}p.isBN=function(n){return n instanceof p?!0:n!==null&&typeof n=="object"&&n.constructor.wordSize===p.wordSize&&Array.isArray(n.words)},p.max=function(n,d){return n.cmp(d)>0?n:d},p.min=function(n,d){return n.cmp(d)<0?n:d},p.prototype._init=function(n,d,_){if(typeof n=="number")return this._initNumber(n,d,_);if(typeof n=="object")return this._initArray(n,d,_);d==="hex"&&(d=16),T(d===(d|0)&&d>=2&&d<=36),n=n.toString().replace(/\s+/g,"");var R=0;n[0]==="-"&&(R++,this.negative=1),R<n.length&&(d===16?this._parseHex(n,R,_):(this._parseBase(n,d,R),_==="le"&&this._initArray(this.toArray(),d,_)))},p.prototype._initNumber=function(n,d,_){n<0&&(this.negative=1,n=-n),n<67108864?(this.words=[n&67108863],this.length=1):n<4503599627370496?(this.words=[n&67108863,n/67108864&67108863],this.length=2):(T(n<9007199254740992),this.words=[n&67108863,n/67108864&67108863,1],this.length=3),_==="le"&&this._initArray(this.toArray(),d,_)},p.prototype._initArray=function(n,d,_){if(T(typeof n.length=="number"),n.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(n.length/3),this.words=new Array(this.length);for(var R=0;R<this.length;R++)this.words[R]=0;var O,C,D=0;if(_==="be")for(R=n.length-1,O=0;R>=0;R-=3)C=n[R]|n[R-1]<<8|n[R-2]<<16,this.words[O]|=C<<D&67108863,this.words[O+1]=C>>>26-D&67108863,D+=24,D>=26&&(D-=26,O++);else if(_==="le")for(R=0,O=0;R<n.length;R+=3)C=n[R]|n[R+1]<<8|n[R+2]<<16,this.words[O]|=C<<D&67108863,this.words[O+1]=C>>>26-D&67108863,D+=24,D>=26&&(D-=26,O++);return this._strip()};function l(M,n){var d=M.charCodeAt(n);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;T(!1,"Invalid character in "+M)}function $(M,n,d){var _=l(M,d);return d-1>=n&&(_|=l(M,d-1)<<4),_}p.prototype._parseHex=function(n,d,_){this.length=Math.ceil((n.length-d)/6),this.words=new Array(this.length);for(var R=0;R<this.length;R++)this.words[R]=0;var O=0,C=0,D;if(_==="be")for(R=n.length-1;R>=d;R-=2)D=$(n,d,R)<<O,this.words[C]|=D&67108863,O>=18?(O-=18,C+=1,this.words[C]|=D>>>26):O+=8;else{var S=n.length-d;for(R=S%2===0?d+1:d;R<n.length;R+=2)D=$(n,d,R)<<O,this.words[C]|=D&67108863,O>=18?(O-=18,C+=1,this.words[C]|=D>>>26):O+=8}this._strip()};function y(M,n,d,_){for(var R=0,O=0,C=Math.min(M.length,d),D=n;D<C;D++){var S=M.charCodeAt(D)-48;R*=_,S>=49?O=S-49+10:S>=17?O=S-17+10:O=S,T(S>=0&&O<_,"Invalid character"),R+=O}return R}p.prototype._parseBase=function(n,d,_){this.words=[0],this.length=1;for(var R=0,O=1;O<=67108863;O*=d)R++;R--,O=O/d|0;for(var C=n.length-_,D=C%R,S=Math.min(C,C-D)+_,u=0,A=_;A<S;A+=R)u=y(n,A,A+R,d),this.imuln(O),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(D!==0){var z=1;for(u=y(n,A,n.length,d),A=0;A<D;A++)z*=d;this.imuln(z),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},p.prototype.copy=function(n){n.words=new Array(this.length);for(var d=0;d<this.length;d++)n.words[d]=this.words[d];n.length=this.length,n.negative=this.negative,n.red=this.red};function m(M,n){M.words=n.words,M.length=n.length,M.negative=n.negative,M.red=n.red}if(p.prototype._move=function(n){m(n,this)},p.prototype.clone=function(){var n=new p(null);return this.copy(n),n},p.prototype._expand=function(n){for(;this.length<n;)this.words[this.length++]=0;return this},p.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},p.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{p.prototype[Symbol.for("nodejs.util.inspect.custom")]=e}catch{p.prototype.inspect=e}else p.prototype.inspect=e;function e(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],i=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],r=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];p.prototype.toString=function(n,d){n=n||10,d=d|0||1;var _;if(n===16||n==="hex"){_="";for(var R=0,O=0,C=0;C<this.length;C++){var D=this.words[C],S=((D<<R|O)&16777215).toString(16);O=D>>>24-R&16777215,R+=2,R>=26&&(R-=26,C--),O!==0||C!==this.length-1?_=a[6-S.length]+S+_:_=S+_}for(O!==0&&(_=O.toString(16)+_);_.length%d!==0;)_="0"+_;return this.negative!==0&&(_="-"+_),_}if(n===(n|0)&&n>=2&&n<=36){var u=i[n],A=r[n];_="";var z=this.clone();for(z.negative=0;!z.isZero();){var F=z.modrn(A).toString(n);z=z.idivn(A),z.isZero()?_=F+_:_=a[u-F.length]+F+_}for(this.isZero()&&(_="0"+_);_.length%d!==0;)_="0"+_;return this.negative!==0&&(_="-"+_),_}T(!1,"Base should be between 2 and 36")},p.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&T(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},p.prototype.toJSON=function(){return this.toString(16,2)},w&&(p.prototype.toBuffer=function(n,d){return this.toArrayLike(w,n,d)}),p.prototype.toArray=function(n,d){return this.toArrayLike(Array,n,d)};var t=function(n,d){return n.allocUnsafe?n.allocUnsafe(d):new n(d)};p.prototype.toArrayLike=function(n,d,_){this._strip();var R=this.byteLength(),O=_||Math.max(1,R);T(R<=O,"byte array longer than desired length"),T(O>0,"Requested array length <= 0");var C=t(n,O),D=d==="le"?"LE":"BE";return this["_toArrayLike"+D](C,R),C},p.prototype._toArrayLikeLE=function(n,d){for(var _=0,R=0,O=0,C=0;O<this.length;O++){var D=this.words[O]<<C|R;n[_++]=D&255,_<n.length&&(n[_++]=D>>8&255),_<n.length&&(n[_++]=D>>16&255),C===6?(_<n.length&&(n[_++]=D>>24&255),R=0,C=0):(R=D>>>24,C+=2)}if(_<n.length)for(n[_++]=R;_<n.length;)n[_++]=0},p.prototype._toArrayLikeBE=function(n,d){for(var _=n.length-1,R=0,O=0,C=0;O<this.length;O++){var D=this.words[O]<<C|R;n[_--]=D&255,_>=0&&(n[_--]=D>>8&255),_>=0&&(n[_--]=D>>16&255),C===6?(_>=0&&(n[_--]=D>>24&255),R=0,C=0):(R=D>>>24,C+=2)}if(_>=0)for(n[_--]=R;_>=0;)n[_--]=0},Math.clz32?p.prototype._countBits=function(n){return 32-Math.clz32(n)}:p.prototype._countBits=function(n){var d=n,_=0;return d>=4096&&(_+=13,d>>>=13),d>=64&&(_+=7,d>>>=7),d>=8&&(_+=4,d>>>=4),d>=2&&(_+=2,d>>>=2),_+d},p.prototype._zeroBits=function(n){if(n===0)return 26;var d=n,_=0;return d&8191||(_+=13,d>>>=13),d&127||(_+=7,d>>>=7),d&15||(_+=4,d>>>=4),d&3||(_+=2,d>>>=2),d&1||_++,_},p.prototype.bitLength=function(){var n=this.words[this.length-1],d=this._countBits(n);return(this.length-1)*26+d};function c(M){for(var n=new Array(M.bitLength()),d=0;d<n.length;d++){var _=d/26|0,R=d%26;n[d]=M.words[_]>>>R&1}return n}p.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,d=0;d<this.length;d++){var _=this._zeroBits(this.words[d]);if(n+=_,_!==26)break}return n},p.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},p.prototype.toTwos=function(n){return this.negative!==0?this.abs().inotn(n).iaddn(1):this.clone()},p.prototype.fromTwos=function(n){return this.testn(n-1)?this.notn(n).iaddn(1).ineg():this.clone()},p.prototype.isNeg=function(){return this.negative!==0},p.prototype.neg=function(){return this.clone().ineg()},p.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},p.prototype.iuor=function(n){for(;this.length<n.length;)this.words[this.length++]=0;for(var d=0;d<n.length;d++)this.words[d]=this.words[d]|n.words[d];return this._strip()},p.prototype.ior=function(n){return T((this.negative|n.negative)===0),this.iuor(n)},p.prototype.or=function(n){return this.length>n.length?this.clone().ior(n):n.clone().ior(this)},p.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},p.prototype.iuand=function(n){var d;this.length>n.length?d=n:d=this;for(var _=0;_<d.length;_++)this.words[_]=this.words[_]&n.words[_];return this.length=d.length,this._strip()},p.prototype.iand=function(n){return T((this.negative|n.negative)===0),this.iuand(n)},p.prototype.and=function(n){return this.length>n.length?this.clone().iand(n):n.clone().iand(this)},p.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},p.prototype.iuxor=function(n){var d,_;this.length>n.length?(d=this,_=n):(d=n,_=this);for(var R=0;R<_.length;R++)this.words[R]=d.words[R]^_.words[R];if(this!==d)for(;R<d.length;R++)this.words[R]=d.words[R];return this.length=d.length,this._strip()},p.prototype.ixor=function(n){return T((this.negative|n.negative)===0),this.iuxor(n)},p.prototype.xor=function(n){return this.length>n.length?this.clone().ixor(n):n.clone().ixor(this)},p.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},p.prototype.inotn=function(n){T(typeof n=="number"&&n>=0);var d=Math.ceil(n/26)|0,_=n%26;this._expand(d),_>0&&d--;for(var R=0;R<d;R++)this.words[R]=~this.words[R]&67108863;return _>0&&(this.words[R]=~this.words[R]&67108863>>26-_),this._strip()},p.prototype.notn=function(n){return this.clone().inotn(n)},p.prototype.setn=function(n,d){T(typeof n=="number"&&n>=0);var _=n/26|0,R=n%26;return this._expand(_+1),d?this.words[_]=this.words[_]|1<<R:this.words[_]=this.words[_]&~(1<<R),this._strip()},p.prototype.iadd=function(n){var d;if(this.negative!==0&&n.negative===0)return this.negative=0,d=this.isub(n),this.negative^=1,this._normSign();if(this.negative===0&&n.negative!==0)return n.negative=0,d=this.isub(n),n.negative=1,d._normSign();var _,R;this.length>n.length?(_=this,R=n):(_=n,R=this);for(var O=0,C=0;C<R.length;C++)d=(_.words[C]|0)+(R.words[C]|0)+O,this.words[C]=d&67108863,O=d>>>26;for(;O!==0&&C<_.length;C++)d=(_.words[C]|0)+O,this.words[C]=d&67108863,O=d>>>26;if(this.length=_.length,O!==0)this.words[this.length]=O,this.length++;else if(_!==this)for(;C<_.length;C++)this.words[C]=_.words[C];return this},p.prototype.add=function(n){var d;return n.negative!==0&&this.negative===0?(n.negative=0,d=this.sub(n),n.negative^=1,d):n.negative===0&&this.negative!==0?(this.negative=0,d=n.sub(this),this.negative=1,d):this.length>n.length?this.clone().iadd(n):n.clone().iadd(this)},p.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var d=this.iadd(n);return n.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var _=this.cmp(n);if(_===0)return this.negative=0,this.length=1,this.words[0]=0,this;var R,O;_>0?(R=this,O=n):(R=n,O=this);for(var C=0,D=0;D<O.length;D++)d=(R.words[D]|0)-(O.words[D]|0)+C,C=d>>26,this.words[D]=d&67108863;for(;C!==0&&D<R.length;D++)d=(R.words[D]|0)+C,C=d>>26,this.words[D]=d&67108863;if(C===0&&D<R.length&&R!==this)for(;D<R.length;D++)this.words[D]=R.words[D];return this.length=Math.max(this.length,D),R!==this&&(this.negative=1),this._strip()},p.prototype.sub=function(n){return this.clone().isub(n)};function s(M,n,d){d.negative=n.negative^M.negative;var _=M.length+n.length|0;d.length=_,_=_-1|0;var R=M.words[0]|0,O=n.words[0]|0,C=R*O,D=C&67108863,S=C/67108864|0;d.words[0]=D;for(var u=1;u<_;u++){for(var A=S>>>26,z=S&67108863,F=Math.min(u,n.length-1),J=Math.max(0,u-M.length+1);J<=F;J++){var W=u-J|0;R=M.words[W]|0,O=n.words[J]|0,C=R*O+z,A+=C/67108864|0,z=C&67108863}d.words[u]=z|0,S=A|0}return S!==0?d.words[u]=S|0:d.length--,d._strip()}var o=function(n,d,_){var R=n.words,O=d.words,C=_.words,D=0,S,u,A,z=R[0]|0,F=z&8191,J=z>>>13,W=R[1]|0,V=W&8191,K=W>>>13,Dt=R[2]|0,Z=Dt&8191,H=Dt>>>13,It=R[3]|0,G=It&8191,Y=It>>>13,Tt=R[4]|0,Q=Tt&8191,X=Tt>>>13,Lt=R[5]|0,ee=Lt&8191,te=Lt>>>13,qt=R[6]|0,re=qt&8191,se=qt>>>13,Nt=R[7]|0,ne=Nt&8191,ie=Nt>>>13,Pt=R[8]|0,ae=Pt&8191,oe=Pt>>>13,zt=R[9]|0,le=zt&8191,ce=zt>>>13,Ft=O[0]|0,ue=Ft&8191,fe=Ft>>>13,Bt=O[1]|0,he=Bt&8191,de=Bt>>>13,Jt=O[2]|0,me=Jt&8191,pe=Jt>>>13,Ut=O[3]|0,ge=Ut&8191,ve=Ut>>>13,Vt=O[4]|0,ye=Vt&8191,be=Vt>>>13,Kt=O[5]|0,_e=Kt&8191,we=Kt>>>13,Wt=O[6]|0,xe=Wt&8191,Me=Wt>>>13,Zt=O[7]|0,$e=Zt&8191,ke=Zt>>>13,Ht=O[8]|0,je=Ht&8191,Se=Ht>>>13,Gt=O[9]|0,Re=Gt&8191,Ae=Gt>>>13;_.negative=n.negative^d.negative,_.length=19,S=Math.imul(F,ue),u=Math.imul(F,fe),u=u+Math.imul(J,ue)|0,A=Math.imul(J,fe);var Ye=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,S=Math.imul(V,ue),u=Math.imul(V,fe),u=u+Math.imul(K,ue)|0,A=Math.imul(K,fe),S=S+Math.imul(F,he)|0,u=u+Math.imul(F,de)|0,u=u+Math.imul(J,he)|0,A=A+Math.imul(J,de)|0;var Qe=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(Qe>>>26)|0,Qe&=67108863,S=Math.imul(Z,ue),u=Math.imul(Z,fe),u=u+Math.imul(H,ue)|0,A=Math.imul(H,fe),S=S+Math.imul(V,he)|0,u=u+Math.imul(V,de)|0,u=u+Math.imul(K,he)|0,A=A+Math.imul(K,de)|0,S=S+Math.imul(F,me)|0,u=u+Math.imul(F,pe)|0,u=u+Math.imul(J,me)|0,A=A+Math.imul(J,pe)|0;var Xe=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,S=Math.imul(G,ue),u=Math.imul(G,fe),u=u+Math.imul(Y,ue)|0,A=Math.imul(Y,fe),S=S+Math.imul(Z,he)|0,u=u+Math.imul(Z,de)|0,u=u+Math.imul(H,he)|0,A=A+Math.imul(H,de)|0,S=S+Math.imul(V,me)|0,u=u+Math.imul(V,pe)|0,u=u+Math.imul(K,me)|0,A=A+Math.imul(K,pe)|0,S=S+Math.imul(F,ge)|0,u=u+Math.imul(F,ve)|0,u=u+Math.imul(J,ge)|0,A=A+Math.imul(J,ve)|0;var et=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(et>>>26)|0,et&=67108863,S=Math.imul(Q,ue),u=Math.imul(Q,fe),u=u+Math.imul(X,ue)|0,A=Math.imul(X,fe),S=S+Math.imul(G,he)|0,u=u+Math.imul(G,de)|0,u=u+Math.imul(Y,he)|0,A=A+Math.imul(Y,de)|0,S=S+Math.imul(Z,me)|0,u=u+Math.imul(Z,pe)|0,u=u+Math.imul(H,me)|0,A=A+Math.imul(H,pe)|0,S=S+Math.imul(V,ge)|0,u=u+Math.imul(V,ve)|0,u=u+Math.imul(K,ge)|0,A=A+Math.imul(K,ve)|0,S=S+Math.imul(F,ye)|0,u=u+Math.imul(F,be)|0,u=u+Math.imul(J,ye)|0,A=A+Math.imul(J,be)|0;var tt=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(tt>>>26)|0,tt&=67108863,S=Math.imul(ee,ue),u=Math.imul(ee,fe),u=u+Math.imul(te,ue)|0,A=Math.imul(te,fe),S=S+Math.imul(Q,he)|0,u=u+Math.imul(Q,de)|0,u=u+Math.imul(X,he)|0,A=A+Math.imul(X,de)|0,S=S+Math.imul(G,me)|0,u=u+Math.imul(G,pe)|0,u=u+Math.imul(Y,me)|0,A=A+Math.imul(Y,pe)|0,S=S+Math.imul(Z,ge)|0,u=u+Math.imul(Z,ve)|0,u=u+Math.imul(H,ge)|0,A=A+Math.imul(H,ve)|0,S=S+Math.imul(V,ye)|0,u=u+Math.imul(V,be)|0,u=u+Math.imul(K,ye)|0,A=A+Math.imul(K,be)|0,S=S+Math.imul(F,_e)|0,u=u+Math.imul(F,we)|0,u=u+Math.imul(J,_e)|0,A=A+Math.imul(J,we)|0;var rt=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(rt>>>26)|0,rt&=67108863,S=Math.imul(re,ue),u=Math.imul(re,fe),u=u+Math.imul(se,ue)|0,A=Math.imul(se,fe),S=S+Math.imul(ee,he)|0,u=u+Math.imul(ee,de)|0,u=u+Math.imul(te,he)|0,A=A+Math.imul(te,de)|0,S=S+Math.imul(Q,me)|0,u=u+Math.imul(Q,pe)|0,u=u+Math.imul(X,me)|0,A=A+Math.imul(X,pe)|0,S=S+Math.imul(G,ge)|0,u=u+Math.imul(G,ve)|0,u=u+Math.imul(Y,ge)|0,A=A+Math.imul(Y,ve)|0,S=S+Math.imul(Z,ye)|0,u=u+Math.imul(Z,be)|0,u=u+Math.imul(H,ye)|0,A=A+Math.imul(H,be)|0,S=S+Math.imul(V,_e)|0,u=u+Math.imul(V,we)|0,u=u+Math.imul(K,_e)|0,A=A+Math.imul(K,we)|0,S=S+Math.imul(F,xe)|0,u=u+Math.imul(F,Me)|0,u=u+Math.imul(J,xe)|0,A=A+Math.imul(J,Me)|0;var st=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(st>>>26)|0,st&=67108863,S=Math.imul(ne,ue),u=Math.imul(ne,fe),u=u+Math.imul(ie,ue)|0,A=Math.imul(ie,fe),S=S+Math.imul(re,he)|0,u=u+Math.imul(re,de)|0,u=u+Math.imul(se,he)|0,A=A+Math.imul(se,de)|0,S=S+Math.imul(ee,me)|0,u=u+Math.imul(ee,pe)|0,u=u+Math.imul(te,me)|0,A=A+Math.imul(te,pe)|0,S=S+Math.imul(Q,ge)|0,u=u+Math.imul(Q,ve)|0,u=u+Math.imul(X,ge)|0,A=A+Math.imul(X,ve)|0,S=S+Math.imul(G,ye)|0,u=u+Math.imul(G,be)|0,u=u+Math.imul(Y,ye)|0,A=A+Math.imul(Y,be)|0,S=S+Math.imul(Z,_e)|0,u=u+Math.imul(Z,we)|0,u=u+Math.imul(H,_e)|0,A=A+Math.imul(H,we)|0,S=S+Math.imul(V,xe)|0,u=u+Math.imul(V,Me)|0,u=u+Math.imul(K,xe)|0,A=A+Math.imul(K,Me)|0,S=S+Math.imul(F,$e)|0,u=u+Math.imul(F,ke)|0,u=u+Math.imul(J,$e)|0,A=A+Math.imul(J,ke)|0;var nt=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(nt>>>26)|0,nt&=67108863,S=Math.imul(ae,ue),u=Math.imul(ae,fe),u=u+Math.imul(oe,ue)|0,A=Math.imul(oe,fe),S=S+Math.imul(ne,he)|0,u=u+Math.imul(ne,de)|0,u=u+Math.imul(ie,he)|0,A=A+Math.imul(ie,de)|0,S=S+Math.imul(re,me)|0,u=u+Math.imul(re,pe)|0,u=u+Math.imul(se,me)|0,A=A+Math.imul(se,pe)|0,S=S+Math.imul(ee,ge)|0,u=u+Math.imul(ee,ve)|0,u=u+Math.imul(te,ge)|0,A=A+Math.imul(te,ve)|0,S=S+Math.imul(Q,ye)|0,u=u+Math.imul(Q,be)|0,u=u+Math.imul(X,ye)|0,A=A+Math.imul(X,be)|0,S=S+Math.imul(G,_e)|0,u=u+Math.imul(G,we)|0,u=u+Math.imul(Y,_e)|0,A=A+Math.imul(Y,we)|0,S=S+Math.imul(Z,xe)|0,u=u+Math.imul(Z,Me)|0,u=u+Math.imul(H,xe)|0,A=A+Math.imul(H,Me)|0,S=S+Math.imul(V,$e)|0,u=u+Math.imul(V,ke)|0,u=u+Math.imul(K,$e)|0,A=A+Math.imul(K,ke)|0,S=S+Math.imul(F,je)|0,u=u+Math.imul(F,Se)|0,u=u+Math.imul(J,je)|0,A=A+Math.imul(J,Se)|0;var it=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(it>>>26)|0,it&=67108863,S=Math.imul(le,ue),u=Math.imul(le,fe),u=u+Math.imul(ce,ue)|0,A=Math.imul(ce,fe),S=S+Math.imul(ae,he)|0,u=u+Math.imul(ae,de)|0,u=u+Math.imul(oe,he)|0,A=A+Math.imul(oe,de)|0,S=S+Math.imul(ne,me)|0,u=u+Math.imul(ne,pe)|0,u=u+Math.imul(ie,me)|0,A=A+Math.imul(ie,pe)|0,S=S+Math.imul(re,ge)|0,u=u+Math.imul(re,ve)|0,u=u+Math.imul(se,ge)|0,A=A+Math.imul(se,ve)|0,S=S+Math.imul(ee,ye)|0,u=u+Math.imul(ee,be)|0,u=u+Math.imul(te,ye)|0,A=A+Math.imul(te,be)|0,S=S+Math.imul(Q,_e)|0,u=u+Math.imul(Q,we)|0,u=u+Math.imul(X,_e)|0,A=A+Math.imul(X,we)|0,S=S+Math.imul(G,xe)|0,u=u+Math.imul(G,Me)|0,u=u+Math.imul(Y,xe)|0,A=A+Math.imul(Y,Me)|0,S=S+Math.imul(Z,$e)|0,u=u+Math.imul(Z,ke)|0,u=u+Math.imul(H,$e)|0,A=A+Math.imul(H,ke)|0,S=S+Math.imul(V,je)|0,u=u+Math.imul(V,Se)|0,u=u+Math.imul(K,je)|0,A=A+Math.imul(K,Se)|0,S=S+Math.imul(F,Re)|0,u=u+Math.imul(F,Ae)|0,u=u+Math.imul(J,Re)|0,A=A+Math.imul(J,Ae)|0;var at=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(at>>>26)|0,at&=67108863,S=Math.imul(le,he),u=Math.imul(le,de),u=u+Math.imul(ce,he)|0,A=Math.imul(ce,de),S=S+Math.imul(ae,me)|0,u=u+Math.imul(ae,pe)|0,u=u+Math.imul(oe,me)|0,A=A+Math.imul(oe,pe)|0,S=S+Math.imul(ne,ge)|0,u=u+Math.imul(ne,ve)|0,u=u+Math.imul(ie,ge)|0,A=A+Math.imul(ie,ve)|0,S=S+Math.imul(re,ye)|0,u=u+Math.imul(re,be)|0,u=u+Math.imul(se,ye)|0,A=A+Math.imul(se,be)|0,S=S+Math.imul(ee,_e)|0,u=u+Math.imul(ee,we)|0,u=u+Math.imul(te,_e)|0,A=A+Math.imul(te,we)|0,S=S+Math.imul(Q,xe)|0,u=u+Math.imul(Q,Me)|0,u=u+Math.imul(X,xe)|0,A=A+Math.imul(X,Me)|0,S=S+Math.imul(G,$e)|0,u=u+Math.imul(G,ke)|0,u=u+Math.imul(Y,$e)|0,A=A+Math.imul(Y,ke)|0,S=S+Math.imul(Z,je)|0,u=u+Math.imul(Z,Se)|0,u=u+Math.imul(H,je)|0,A=A+Math.imul(H,Se)|0,S=S+Math.imul(V,Re)|0,u=u+Math.imul(V,Ae)|0,u=u+Math.imul(K,Re)|0,A=A+Math.imul(K,Ae)|0;var ot=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(ot>>>26)|0,ot&=67108863,S=Math.imul(le,me),u=Math.imul(le,pe),u=u+Math.imul(ce,me)|0,A=Math.imul(ce,pe),S=S+Math.imul(ae,ge)|0,u=u+Math.imul(ae,ve)|0,u=u+Math.imul(oe,ge)|0,A=A+Math.imul(oe,ve)|0,S=S+Math.imul(ne,ye)|0,u=u+Math.imul(ne,be)|0,u=u+Math.imul(ie,ye)|0,A=A+Math.imul(ie,be)|0,S=S+Math.imul(re,_e)|0,u=u+Math.imul(re,we)|0,u=u+Math.imul(se,_e)|0,A=A+Math.imul(se,we)|0,S=S+Math.imul(ee,xe)|0,u=u+Math.imul(ee,Me)|0,u=u+Math.imul(te,xe)|0,A=A+Math.imul(te,Me)|0,S=S+Math.imul(Q,$e)|0,u=u+Math.imul(Q,ke)|0,u=u+Math.imul(X,$e)|0,A=A+Math.imul(X,ke)|0,S=S+Math.imul(G,je)|0,u=u+Math.imul(G,Se)|0,u=u+Math.imul(Y,je)|0,A=A+Math.imul(Y,Se)|0,S=S+Math.imul(Z,Re)|0,u=u+Math.imul(Z,Ae)|0,u=u+Math.imul(H,Re)|0,A=A+Math.imul(H,Ae)|0;var lt=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(le,ge),u=Math.imul(le,ve),u=u+Math.imul(ce,ge)|0,A=Math.imul(ce,ve),S=S+Math.imul(ae,ye)|0,u=u+Math.imul(ae,be)|0,u=u+Math.imul(oe,ye)|0,A=A+Math.imul(oe,be)|0,S=S+Math.imul(ne,_e)|0,u=u+Math.imul(ne,we)|0,u=u+Math.imul(ie,_e)|0,A=A+Math.imul(ie,we)|0,S=S+Math.imul(re,xe)|0,u=u+Math.imul(re,Me)|0,u=u+Math.imul(se,xe)|0,A=A+Math.imul(se,Me)|0,S=S+Math.imul(ee,$e)|0,u=u+Math.imul(ee,ke)|0,u=u+Math.imul(te,$e)|0,A=A+Math.imul(te,ke)|0,S=S+Math.imul(Q,je)|0,u=u+Math.imul(Q,Se)|0,u=u+Math.imul(X,je)|0,A=A+Math.imul(X,Se)|0,S=S+Math.imul(G,Re)|0,u=u+Math.imul(G,Ae)|0,u=u+Math.imul(Y,Re)|0,A=A+Math.imul(Y,Ae)|0;var ct=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(ct>>>26)|0,ct&=67108863,S=Math.imul(le,ye),u=Math.imul(le,be),u=u+Math.imul(ce,ye)|0,A=Math.imul(ce,be),S=S+Math.imul(ae,_e)|0,u=u+Math.imul(ae,we)|0,u=u+Math.imul(oe,_e)|0,A=A+Math.imul(oe,we)|0,S=S+Math.imul(ne,xe)|0,u=u+Math.imul(ne,Me)|0,u=u+Math.imul(ie,xe)|0,A=A+Math.imul(ie,Me)|0,S=S+Math.imul(re,$e)|0,u=u+Math.imul(re,ke)|0,u=u+Math.imul(se,$e)|0,A=A+Math.imul(se,ke)|0,S=S+Math.imul(ee,je)|0,u=u+Math.imul(ee,Se)|0,u=u+Math.imul(te,je)|0,A=A+Math.imul(te,Se)|0,S=S+Math.imul(Q,Re)|0,u=u+Math.imul(Q,Ae)|0,u=u+Math.imul(X,Re)|0,A=A+Math.imul(X,Ae)|0;var ut=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(ut>>>26)|0,ut&=67108863,S=Math.imul(le,_e),u=Math.imul(le,we),u=u+Math.imul(ce,_e)|0,A=Math.imul(ce,we),S=S+Math.imul(ae,xe)|0,u=u+Math.imul(ae,Me)|0,u=u+Math.imul(oe,xe)|0,A=A+Math.imul(oe,Me)|0,S=S+Math.imul(ne,$e)|0,u=u+Math.imul(ne,ke)|0,u=u+Math.imul(ie,$e)|0,A=A+Math.imul(ie,ke)|0,S=S+Math.imul(re,je)|0,u=u+Math.imul(re,Se)|0,u=u+Math.imul(se,je)|0,A=A+Math.imul(se,Se)|0,S=S+Math.imul(ee,Re)|0,u=u+Math.imul(ee,Ae)|0,u=u+Math.imul(te,Re)|0,A=A+Math.imul(te,Ae)|0;var ft=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(ft>>>26)|0,ft&=67108863,S=Math.imul(le,xe),u=Math.imul(le,Me),u=u+Math.imul(ce,xe)|0,A=Math.imul(ce,Me),S=S+Math.imul(ae,$e)|0,u=u+Math.imul(ae,ke)|0,u=u+Math.imul(oe,$e)|0,A=A+Math.imul(oe,ke)|0,S=S+Math.imul(ne,je)|0,u=u+Math.imul(ne,Se)|0,u=u+Math.imul(ie,je)|0,A=A+Math.imul(ie,Se)|0,S=S+Math.imul(re,Re)|0,u=u+Math.imul(re,Ae)|0,u=u+Math.imul(se,Re)|0,A=A+Math.imul(se,Ae)|0;var ht=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(ht>>>26)|0,ht&=67108863,S=Math.imul(le,$e),u=Math.imul(le,ke),u=u+Math.imul(ce,$e)|0,A=Math.imul(ce,ke),S=S+Math.imul(ae,je)|0,u=u+Math.imul(ae,Se)|0,u=u+Math.imul(oe,je)|0,A=A+Math.imul(oe,Se)|0,S=S+Math.imul(ne,Re)|0,u=u+Math.imul(ne,Ae)|0,u=u+Math.imul(ie,Re)|0,A=A+Math.imul(ie,Ae)|0;var dt=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(dt>>>26)|0,dt&=67108863,S=Math.imul(le,je),u=Math.imul(le,Se),u=u+Math.imul(ce,je)|0,A=Math.imul(ce,Se),S=S+Math.imul(ae,Re)|0,u=u+Math.imul(ae,Ae)|0,u=u+Math.imul(oe,Re)|0,A=A+Math.imul(oe,Ae)|0;var mt=(D+S|0)+((u&8191)<<13)|0;D=(A+(u>>>13)|0)+(mt>>>26)|0,mt&=67108863,S=Math.imul(le,Re),u=Math.imul(le,Ae),u=u+Math.imul(ce,Re)|0,A=Math.imul(ce,Ae);var pt=(D+S|0)+((u&8191)<<13)|0;return D=(A+(u>>>13)|0)+(pt>>>26)|0,pt&=67108863,C[0]=Ye,C[1]=Qe,C[2]=Xe,C[3]=et,C[4]=tt,C[5]=rt,C[6]=st,C[7]=nt,C[8]=it,C[9]=at,C[10]=ot,C[11]=lt,C[12]=ct,C[13]=ut,C[14]=ft,C[15]=ht,C[16]=dt,C[17]=mt,C[18]=pt,D!==0&&(C[19]=D,_.length++),_};Math.imul||(o=s);function h(M,n,d){d.negative=n.negative^M.negative,d.length=M.length+n.length;for(var _=0,R=0,O=0;O<d.length-1;O++){var C=R;R=0;for(var D=_&67108863,S=Math.min(O,n.length-1),u=Math.max(0,O-M.length+1);u<=S;u++){var A=O-u,z=M.words[A]|0,F=n.words[u]|0,J=z*F,W=J&67108863;C=C+(J/67108864|0)|0,W=W+D|0,D=W&67108863,C=C+(W>>>26)|0,R+=C>>>26,C&=67108863}d.words[O]=D,_=C,C=R}return _!==0?d.words[O]=_:d.length--,d._strip()}function g(M,n,d){return h(M,n,d)}p.prototype.mulTo=function(n,d){var _,R=this.length+n.length;return this.length===10&&n.length===10?_=o(this,n,d):R<63?_=s(this,n,d):R<1024?_=h(this,n,d):_=g(this,n,d),_},p.prototype.mul=function(n){var d=new p(null);return d.words=new Array(this.length+n.length),this.mulTo(n,d)},p.prototype.mulf=function(n){var d=new p(null);return d.words=new Array(this.length+n.length),g(this,n,d)},p.prototype.imul=function(n){return this.clone().mulTo(n,this)},p.prototype.imuln=function(n){var d=n<0;d&&(n=-n),T(typeof n=="number"),T(n<67108864);for(var _=0,R=0;R<this.length;R++){var O=(this.words[R]|0)*n,C=(O&67108863)+(_&67108863);_>>=26,_+=O/67108864|0,_+=C>>>26,this.words[R]=C&67108863}return _!==0&&(this.words[R]=_,this.length++),d?this.ineg():this},p.prototype.muln=function(n){return this.clone().imuln(n)},p.prototype.sqr=function(){return this.mul(this)},p.prototype.isqr=function(){return this.imul(this.clone())},p.prototype.pow=function(n){var d=c(n);if(d.length===0)return new p(1);for(var _=this,R=0;R<d.length&&d[R]===0;R++,_=_.sqr());if(++R<d.length)for(var O=_.sqr();R<d.length;R++,O=O.sqr())d[R]!==0&&(_=_.mul(O));return _},p.prototype.iushln=function(n){T(typeof n=="number"&&n>=0);var d=n%26,_=(n-d)/26,R=67108863>>>26-d<<26-d,O;if(d!==0){var C=0;for(O=0;O<this.length;O++){var D=this.words[O]&R,S=(this.words[O]|0)-D<<d;this.words[O]=S|C,C=D>>>26-d}C&&(this.words[O]=C,this.length++)}if(_!==0){for(O=this.length-1;O>=0;O--)this.words[O+_]=this.words[O];for(O=0;O<_;O++)this.words[O]=0;this.length+=_}return this._strip()},p.prototype.ishln=function(n){return T(this.negative===0),this.iushln(n)},p.prototype.iushrn=function(n,d,_){T(typeof n=="number"&&n>=0);var R;d?R=(d-d%26)/26:R=0;var O=n%26,C=Math.min((n-O)/26,this.length),D=67108863^67108863>>>O<<O,S=_;if(R-=C,R=Math.max(0,R),S){for(var u=0;u<C;u++)S.words[u]=this.words[u];S.length=C}if(C!==0)if(this.length>C)for(this.length-=C,u=0;u<this.length;u++)this.words[u]=this.words[u+C];else this.words[0]=0,this.length=1;var A=0;for(u=this.length-1;u>=0&&(A!==0||u>=R);u--){var z=this.words[u]|0;this.words[u]=A<<26-O|z>>>O,A=z&D}return S&&A!==0&&(S.words[S.length++]=A),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},p.prototype.ishrn=function(n,d,_){return T(this.negative===0),this.iushrn(n,d,_)},p.prototype.shln=function(n){return this.clone().ishln(n)},p.prototype.ushln=function(n){return this.clone().iushln(n)},p.prototype.shrn=function(n){return this.clone().ishrn(n)},p.prototype.ushrn=function(n){return this.clone().iushrn(n)},p.prototype.testn=function(n){T(typeof n=="number"&&n>=0);var d=n%26,_=(n-d)/26,R=1<<d;if(this.length<=_)return!1;var O=this.words[_];return!!(O&R)},p.prototype.imaskn=function(n){T(typeof n=="number"&&n>=0);var d=n%26,_=(n-d)/26;if(T(this.negative===0,"imaskn works only with positive numbers"),this.length<=_)return this;if(d!==0&&_++,this.length=Math.min(_,this.length),d!==0){var R=67108863^67108863>>>d<<d;this.words[this.length-1]&=R}return this._strip()},p.prototype.maskn=function(n){return this.clone().imaskn(n)},p.prototype.iaddn=function(n){return T(typeof n=="number"),T(n<67108864),n<0?this.isubn(-n):this.negative!==0?this.length===1&&(this.words[0]|0)<=n?(this.words[0]=n-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(n),this.negative=1,this):this._iaddn(n)},p.prototype._iaddn=function(n){this.words[0]+=n;for(var d=0;d<this.length&&this.words[d]>=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},p.prototype.isubn=function(n){if(T(typeof n=="number"),T(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d<this.length&&this.words[d]<0;d++)this.words[d]+=67108864,this.words[d+1]-=1;return this._strip()},p.prototype.addn=function(n){return this.clone().iaddn(n)},p.prototype.subn=function(n){return this.clone().isubn(n)},p.prototype.iabs=function(){return this.negative=0,this},p.prototype.abs=function(){return this.clone().iabs()},p.prototype._ishlnsubmul=function(n,d,_){var R=n.length+_,O;this._expand(R);var C,D=0;for(O=0;O<n.length;O++){C=(this.words[O+_]|0)+D;var S=(n.words[O]|0)*d;C-=S&67108863,D=(C>>26)-(S/67108864|0),this.words[O+_]=C&67108863}for(;O<this.length-_;O++)C=(this.words[O+_]|0)+D,D=C>>26,this.words[O+_]=C&67108863;if(D===0)return this._strip();for(T(D===-1),D=0,O=0;O<this.length;O++)C=-(this.words[O]|0)+D,D=C>>26,this.words[O]=C&67108863;return this.negative=1,this._strip()},p.prototype._wordDiv=function(n,d){var _=this.length-n.length,R=this.clone(),O=n,C=O.words[O.length-1]|0,D=this._countBits(C);_=26-D,_!==0&&(O=O.ushln(_),R.iushln(_),C=O.words[O.length-1]|0);var S=R.length-O.length,u;if(d!=="mod"){u=new p(null),u.length=S+1,u.words=new Array(u.length);for(var A=0;A<u.length;A++)u.words[A]=0}var z=R.clone()._ishlnsubmul(O,1,S);z.negative===0&&(R=z,u&&(u.words[S]=1));for(var F=S-1;F>=0;F--){var J=(R.words[O.length+F]|0)*67108864+(R.words[O.length+F-1]|0);for(J=Math.min(J/C|0,67108863),R._ishlnsubmul(O,J,F);R.negative!==0;)J--,R.negative=0,R._ishlnsubmul(O,1,F),R.isZero()||(R.negative^=1);u&&(u.words[F]=J)}return u&&u._strip(),R._strip(),d!=="div"&&_!==0&&R.iushrn(_),{div:u||null,mod:R}},p.prototype.divmod=function(n,d,_){if(T(!n.isZero()),this.isZero())return{div:new p(0),mod:new p(0)};var R,O,C;return this.negative!==0&&n.negative===0?(C=this.neg().divmod(n,d),d!=="mod"&&(R=C.div.neg()),d!=="div"&&(O=C.mod.neg(),_&&O.negative!==0&&O.iadd(n)),{div:R,mod:O}):this.negative===0&&n.negative!==0?(C=this.divmod(n.neg(),d),d!=="mod"&&(R=C.div.neg()),{div:R,mod:C.mod}):this.negative&n.negative?(C=this.neg().divmod(n.neg(),d),d!=="div"&&(O=C.mod.neg(),_&&O.negative!==0&&O.isub(n)),{div:C.div,mod:O}):n.length>this.length||this.cmp(n)<0?{div:new p(0),mod:this}:n.length===1?d==="div"?{div:this.divn(n.words[0]),mod:null}:d==="mod"?{div:null,mod:new p(this.modrn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new p(this.modrn(n.words[0]))}:this._wordDiv(n,d)},p.prototype.div=function(n){return this.divmod(n,"div",!1).div},p.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},p.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},p.prototype.divRound=function(n){var d=this.divmod(n);if(d.mod.isZero())return d.div;var _=d.div.negative!==0?d.mod.isub(n):d.mod,R=n.ushrn(1),O=n.andln(1),C=_.cmp(R);return C<0||O===1&&C===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},p.prototype.modrn=function(n){var d=n<0;d&&(n=-n),T(n<=67108863);for(var _=(1<<26)%n,R=0,O=this.length-1;O>=0;O--)R=(_*R+(this.words[O]|0))%n;return d?-R:R},p.prototype.modn=function(n){return this.modrn(n)},p.prototype.idivn=function(n){var d=n<0;d&&(n=-n),T(n<=67108863);for(var _=0,R=this.length-1;R>=0;R--){var O=(this.words[R]|0)+_*67108864;this.words[R]=O/n|0,_=O%n}return this._strip(),d?this.ineg():this},p.prototype.divn=function(n){return this.clone().idivn(n)},p.prototype.egcd=function(n){T(n.negative===0),T(!n.isZero());var d=this,_=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var R=new p(1),O=new p(0),C=new p(0),D=new p(1),S=0;d.isEven()&&_.isEven();)d.iushrn(1),_.iushrn(1),++S;for(var u=_.clone(),A=d.clone();!d.isZero();){for(var z=0,F=1;!(d.words[0]&F)&&z<26;++z,F<<=1);if(z>0)for(d.iushrn(z);z-- >0;)(R.isOdd()||O.isOdd())&&(R.iadd(u),O.isub(A)),R.iushrn(1),O.iushrn(1);for(var J=0,W=1;!(_.words[0]&W)&&J<26;++J,W<<=1);if(J>0)for(_.iushrn(J);J-- >0;)(C.isOdd()||D.isOdd())&&(C.iadd(u),D.isub(A)),C.iushrn(1),D.iushrn(1);d.cmp(_)>=0?(d.isub(_),R.isub(C),O.isub(D)):(_.isub(d),C.isub(R),D.isub(O))}return{a:C,b:D,gcd:_.iushln(S)}},p.prototype._invmp=function(n){T(n.negative===0),T(!n.isZero());var d=this,_=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var R=new p(1),O=new p(0),C=_.clone();d.cmpn(1)>0&&_.cmpn(1)>0;){for(var D=0,S=1;!(d.words[0]&S)&&D<26;++D,S<<=1);if(D>0)for(d.iushrn(D);D-- >0;)R.isOdd()&&R.iadd(C),R.iushrn(1);for(var u=0,A=1;!(_.words[0]&A)&&u<26;++u,A<<=1);if(u>0)for(_.iushrn(u);u-- >0;)O.isOdd()&&O.iadd(C),O.iushrn(1);d.cmp(_)>=0?(d.isub(_),R.isub(O)):(_.isub(d),O.isub(R))}var z;return d.cmpn(1)===0?z=R:z=O,z.cmpn(0)<0&&z.iadd(n),z},p.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var d=this.clone(),_=n.clone();d.negative=0,_.negative=0;for(var R=0;d.isEven()&&_.isEven();R++)d.iushrn(1),_.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;_.isEven();)_.iushrn(1);var O=d.cmp(_);if(O<0){var C=d;d=_,_=C}else if(O===0||_.cmpn(1)===0)break;d.isub(_)}while(!0);return _.iushln(R)},p.prototype.invm=function(n){return this.egcd(n).a.umod(n)},p.prototype.isEven=function(){return(this.words[0]&1)===0},p.prototype.isOdd=function(){return(this.words[0]&1)===1},p.prototype.andln=function(n){return this.words[0]&n},p.prototype.bincn=function(n){T(typeof n=="number");var d=n%26,_=(n-d)/26,R=1<<d;if(this.length<=_)return this._expand(_+1),this.words[_]|=R,this;for(var O=R,C=_;O!==0&&C<this.length;C++){var D=this.words[C]|0;D+=O,O=D>>>26,D&=67108863,this.words[C]=D}return O!==0&&(this.words[C]=O,this.length++),this},p.prototype.isZero=function(){return this.length===1&&this.words[0]===0},p.prototype.cmpn=function(n){var d=n<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var _;if(this.length>1)_=1;else{d&&(n=-n),T(n<=67108863,"Number is too big");var R=this.words[0]|0;_=R===n?0:R<n?-1:1}return this.negative!==0?-_|0:_},p.prototype.cmp=function(n){if(this.negative!==0&&n.negative===0)return-1;if(this.negative===0&&n.negative!==0)return 1;var d=this.ucmp(n);return this.negative!==0?-d|0:d},p.prototype.ucmp=function(n){if(this.length>n.length)return 1;if(this.length<n.length)return-1;for(var d=0,_=this.length-1;_>=0;_--){var R=this.words[_]|0,O=n.words[_]|0;if(R!==O){R<O?d=-1:R>O&&(d=1);break}}return d},p.prototype.gtn=function(n){return this.cmpn(n)===1},p.prototype.gt=function(n){return this.cmp(n)===1},p.prototype.gten=function(n){return this.cmpn(n)>=0},p.prototype.gte=function(n){return this.cmp(n)>=0},p.prototype.ltn=function(n){return this.cmpn(n)===-1},p.prototype.lt=function(n){return this.cmp(n)===-1},p.prototype.lten=function(n){return this.cmpn(n)<=0},p.prototype.lte=function(n){return this.cmp(n)<=0},p.prototype.eqn=function(n){return this.cmpn(n)===0},p.prototype.eq=function(n){return this.cmp(n)===0},p.red=function(n){return new E(n)},p.prototype.toRed=function(n){return T(!this.red,"Already a number in reduction context"),T(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},p.prototype.fromRed=function(){return T(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},p.prototype._forceRed=function(n){return this.red=n,this},p.prototype.forceRed=function(n){return T(!this.red,"Already a number in reduction context"),this._forceRed(n)},p.prototype.redAdd=function(n){return T(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},p.prototype.redIAdd=function(n){return T(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},p.prototype.redSub=function(n){return T(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},p.prototype.redISub=function(n){return T(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},p.prototype.redShl=function(n){return T(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},p.prototype.redMul=function(n){return T(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},p.prototype.redIMul=function(n){return T(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},p.prototype.redSqr=function(){return T(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},p.prototype.redISqr=function(){return T(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},p.prototype.redSqrt=function(){return T(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},p.prototype.redInvm=function(){return T(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},p.prototype.redNeg=function(){return T(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},p.prototype.redPow=function(n){return T(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var b={k256:null,p224:null,p192:null,p25519:null};function j(M,n){this.name=M,this.p=new p(n,16),this.n=this.p.bitLength(),this.k=new p(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}j.prototype._tmp=function(){var n=new p(null);return n.words=new Array(Math.ceil(this.n/13)),n},j.prototype.ireduce=function(n){var d=n,_;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),_=d.bitLength();while(_>this.n);var R=_<this.n?-1:d.ucmp(this.p);return R===0?(d.words[0]=0,d.length=1):R>0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},j.prototype.split=function(n,d){n.iushrn(this.n,0,d)},j.prototype.imulK=function(n){return n.imul(this.k)};function k(){j.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}L(k,j),k.prototype.split=function(n,d){for(var _=4194303,R=Math.min(n.length,9),O=0;O<R;O++)d.words[O]=n.words[O];if(d.length=R,n.length<=9){n.words[0]=0,n.length=1;return}var C=n.words[9];for(d.words[d.length++]=C&_,O=10;O<n.length;O++){var D=n.words[O]|0;n.words[O-10]=(D&_)<<4|C>>>22,C=D}C>>>=22,n.words[O-10]=C,C===0&&n.length>10?n.length-=10:n.length-=9},k.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var d=0,_=0;_<n.length;_++){var R=n.words[_]|0;d+=R*977,n.words[_]=d&67108863,d=R*64+(d/67108864|0)}return n.words[n.length-1]===0&&(n.length--,n.words[n.length-1]===0&&n.length--),n};function f(){j.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}L(f,j);function v(){j.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}L(v,j);function x(){j.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}L(x,j),x.prototype.imulK=function(n){for(var d=0,_=0;_<n.length;_++){var R=(n.words[_]|0)*19+d,O=R&67108863;R>>>=26,n.words[_]=O,d=R}return d!==0&&(n.words[n.length++]=d),n},p._prime=function(n){if(b[n])return b[n];var d;if(n==="k256")d=new k;else if(n==="p224")d=new f;else if(n==="p192")d=new v;else if(n==="p25519")d=new x;else throw new Error("Unknown prime "+n);return b[n]=d,d};function E(M){if(typeof M=="string"){var n=p._prime(M);this.m=n.p,this.prime=n}else T(M.gtn(1),"modulus must be greater than 1"),this.m=M,this.prime=null}E.prototype._verify1=function(n){T(n.negative===0,"red works only with positives"),T(n.red,"red works only with red numbers")},E.prototype._verify2=function(n,d){T((n.negative|d.negative)===0,"red works only with positives"),T(n.red&&n.red===d.red,"red works only with red numbers")},E.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):(m(n,n.umod(this.m)._forceRed(this)),n)},E.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},E.prototype.add=function(n,d){this._verify2(n,d);var _=n.add(d);return _.cmp(this.m)>=0&&_.isub(this.m),_._forceRed(this)},E.prototype.iadd=function(n,d){this._verify2(n,d);var _=n.iadd(d);return _.cmp(this.m)>=0&&_.isub(this.m),_},E.prototype.sub=function(n,d){this._verify2(n,d);var _=n.sub(d);return _.cmpn(0)<0&&_.iadd(this.m),_._forceRed(this)},E.prototype.isub=function(n,d){this._verify2(n,d);var _=n.isub(d);return _.cmpn(0)<0&&_.iadd(this.m),_},E.prototype.shl=function(n,d){return this._verify1(n),this.imod(n.ushln(d))},E.prototype.imul=function(n,d){return this._verify2(n,d),this.imod(n.imul(d))},E.prototype.mul=function(n,d){return this._verify2(n,d),this.imod(n.mul(d))},E.prototype.isqr=function(n){return this.imul(n,n.clone())},E.prototype.sqr=function(n){return this.mul(n,n)},E.prototype.sqrt=function(n){if(n.isZero())return n.clone();var d=this.m.andln(3);if(T(d%2===1),d===3){var _=this.m.add(new p(1)).iushrn(2);return this.pow(n,_)}for(var R=this.m.subn(1),O=0;!R.isZero()&&R.andln(1)===0;)O++,R.iushrn(1);T(!R.isZero());var C=new p(1).toRed(this),D=C.redNeg(),S=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new p(2*u*u).toRed(this);this.pow(u,S).cmp(D)!==0;)u.redIAdd(D);for(var A=this.pow(u,R),z=this.pow(n,R.addn(1).iushrn(1)),F=this.pow(n,R),J=O;F.cmp(C)!==0;){for(var W=F,V=0;W.cmp(C)!==0;V++)W=W.redSqr();T(V<J);var K=this.pow(A,new p(1).iushln(J-V-1));z=z.redMul(K),A=K.redSqr(),F=F.redMul(A),J=V}return z},E.prototype.invm=function(n){var d=n._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},E.prototype.pow=function(n,d){if(d.isZero())return new p(1).toRed(this);if(d.cmpn(1)===0)return n.clone();var _=4,R=new Array(1<<_);R[0]=new p(1).toRed(this),R[1]=n;for(var O=2;O<R.length;O++)R[O]=this.mul(R[O-1],n);var C=R[0],D=0,S=0,u=d.bitLength()%26;for(u===0&&(u=26),O=d.length-1;O>=0;O--){for(var A=d.words[O],z=u-1;z>=0;z--){var F=A>>z&1;if(C!==R[0]&&(C=this.sqr(C)),F===0&&D===0){S=0;continue}D<<=1,D|=F,S++,!(S!==_&&(O!==0||z!==0))&&(C=this.mul(C,R[D]),S=0,D=0)}u=26}return C},E.prototype.convertTo=function(n){var d=n.umod(this.m);return d===n?d.clone():d},E.prototype.convertFrom=function(n){var d=n.clone();return d.red=null,d},p.mont=function(n){return new N(n)};function N(M){E.call(this,M),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new p(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}L(N,E),N.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},N.prototype.convertFrom=function(n){var d=this.imod(n.mul(this.rinv));return d.red=null,d},N.prototype.imul=function(n,d){if(n.isZero()||d.isZero())return n.words[0]=0,n.length=1,n;var _=n.imul(d),R=_.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=_.isub(R).iushrn(this.shift),C=O;return O.cmp(this.m)>=0?C=O.isub(this.m):O.cmpn(0)<0&&(C=O.iadd(this.m)),C._forceRed(this)},N.prototype.mul=function(n,d){if(n.isZero()||d.isZero())return new p(0)._forceRed(this);var _=n.mul(d),R=_.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),O=_.isub(R).iushrn(this.shift),C=O;return O.cmp(this.m)>=0?C=O.isub(this.m):O.cmpn(0)<0&&(C=O.iadd(this.m)),C._forceRed(this)},N.prototype.invm=function(n){var d=this.imod(n._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(I,ze)})(Ot);var Hr=Ot.exports,Gr=ze&&ze.__importDefault||function(I){return I&&I.__esModule?I:{default:I}};Object.defineProperty(At,"__esModule",{value:!0});At.BNExtension=Yr;const Pe=Gr(Hr);function Yr(I){return{type:"BN",base:I.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(P,B){try{return{value:new Pe.default(P)}}catch{return{errors:B.error("bn.nan")}}},coerce(P){return{value:P.toString(10)}},validate(P){return{value:P}},rules:{gt:{args:[{name:"threshold",ref:!0,assert:P=>Pe.default.isBN(P),message:"must be a big number",normalize:P=>new Pe.default(P)},{name:"equal",assert:P=>typeof P=="boolean",message:"must be a boolean"}],validate(P,B,T){const L=new Pe.default(P);return T.equal&&L.lt(T.threshold)?B.error("bn.min",T):!T.equal&&L.lte(T.threshold)?B.error("bn.greater",T):P}},lt:{args:[{name:"threshold",ref:!0,assert:P=>Pe.default.isBN(P),message:"must be a big number",normalize:P=>new Pe.default(P)},{name:"equal",assert:P=>typeof P=="boolean",message:"must be a boolean"}],validate(P,B,T){const L=new Pe.default(P);return T.equal&&L.gt(T.threshold)?B.error("bn.max",T):!T.equal&&L.gte(T.threshold)?B.error("bn.less",T):P}},min:{alias:"gte",method(P){return this.$_addRule({name:"gt",args:{threshold:P,equal:!0}})}},max:{alias:"lte",method(P){return this.$_addRule({name:"lt",args:{threshold:P,equal:!0}})}},greater:{alias:"gt",method(P){return this.$_addRule({name:"gt",args:{threshold:P,equal:!1}})}},less:{alias:"lt",method(P){return this.$_addRule({name:"lt",args:{threshold:P,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 Et={},Qr=ze&&ze.__importDefault||function(I){return I&&I.__esModule?I:{default:I}};Object.defineProperty(Et,"__esModule",{value:!0});Et.DIDExtension=Xr;const vt=Qr(Sr),yt=Rr,Ce=De,Ke={pk:Object.keys(yt.types.KeyType),hash:Object.keys(yt.types.HashType),role:Object.keys(yt.types.RoleType)};function Xr(I){return{type:"DID",base:I.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(P,B){return!P||typeof P!="string"?{errors:B.error("did.empty",{value:P})}:(0,Ce.isValid)(P)===!1?{errors:B.error("did.invalid",{value:P})}:{value:P}},rules:{type:{args:[{name:"key",ref:!0,assert:P=>Object.keys(Ke).includes(P),message:`must be one of ${Object.keys(Ke).join(", ")}`},{name:"expected",assert:P=>Object.keys(Ke).some(B=>Ke[B].includes(P)),message:"must be valid type"}],validate(P,B,T){const L=(0,Ce.toTypeInfoStr)(P);return T.key==="pk"&&L.pk!==T.expected?B.error("did.pk",{...T,actual:L.pk}):T.key==="hash"&&L.hash!==T.expected?B.error("did.hash",{...T,actual:L.hash}):T.key==="role"&&L.role!==T.expected?B.error("did.role",{...T,actual:L.role}):P}},pk:{method(P){return this.$_addRule({name:"type",args:{key:"pk",expected:P}})}},hash:{method(P){return this.$_addRule({name:"type",args:{key:"hash",expected:P}})}},role:{method(P){return this.$_addRule({name:"type",args:{key:"role",expected:P}})}},wallet:{method(P){return this.$_addRule({name:"wallet",args:{type:P}})},args:[{name:"type",ref:!0,assert:P=>["arcblock","ethereum","default","eth","passkey"].includes(P),message:"must be a string",normalize:P=>P.trim()}],validate(P,B,T={}){const L=(0,Ce.toTypeInfo)(P),p=(0,Ce.toTypeInfoStr)(P);return["ethereum","eth"].includes(T.type)&&(0,vt.default)(L,Ce.DID_TYPE_ETHEREUM)===!1?B.error("did.wallet",{expected:T.type,actual:JSON.stringify(p)}):["arcblock","default"].includes(T.type)&&(0,vt.default)(L,Ce.DID_TYPE_ARCBLOCK)===!1?B.error("did.wallet",{expected:T.type,actual:JSON.stringify(p)}):["passkey"].includes(T.type)&&(0,vt.default)(L,Ce.DID_TYPE_PASSKEY)===!1?B.error("did.wallet",{expected:T.type,actual:JSON.stringify(p)}):P}},prefix:{method(P=""){return this.$_addRule({name:"prefix",args:{str:P}})},args:[{name:"str",ref:!0,assert:P=>["",Ce.DID_PREFIX].includes(P),message:"must be a string",normalize:P=>P.trim()}],validate(P,B,T={}){return T.str&&P.startsWith(T.str)===!1?B.error("did.prefix",{expected:T.str}):!T.str&&(0,Ce.toAddress)(P)!==P?B.error("did.prefix",{expected:T.str}):P}}}}}(function(I){var P=ze&&ze.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(I,"__esModule",{value:!0}),I.patterns=I.schemas=I.Joi=void 0;const B=P(Zr),T=At,L=Et;I.Joi=B.default.extend(L.DIDExtension).extend(T.BNExtension);const p=/^(0x)?([A-Fa-f0-9]{64})$/,w=I.Joi.object({genesisTime:I.Joi.date().iso().required().raw(),genesisTx:I.Joi.string().regex(p).required().allow(""),renaissanceTime:I.Joi.date().iso().required().raw(),renaissanceTx:I.Joi.string().regex(p).required().allow("")}),l=I.Joi.object({address:I.Joi.DID().prefix().role("ROLE_TOKEN").required(),value:I.Joi.BN().positive().required()}),$=I.Joi.object({name:I.Joi.string().min(1).max(256).required(),value:I.Joi.string().min(1).max(1024).required(),description:I.Joi.string().min(1).max(256).optional().allow(""),required:I.Joi.boolean().optional().default(!1)}),y=I.Joi.alternatives().try(I.Joi.DID().prefix().role("ROLE_ACCOUNT"),I.Joi.DID().prefix().role("ROLE_APPLICATION"),I.Joi.DID().prefix().role("ROLE_BLOCKLET"),I.Joi.DID().prefix().wallet("ethereum"),I.Joi.DID().prefix().wallet("passkey")),m=I.Joi.array().items(I.Joi.object({owner:y.required(),tokensList:I.Joi.array().items(l).default([]),assetsList:I.Joi.array().items(I.Joi.DID().prefix().role("ROLE_ASSET")).default([])})),e=I.Joi.array().items({signer:I.Joi.DID().prefix().required(),pk:I.Joi.any().required(),signature:I.Joi.any().required(),delegator:I.Joi.DID().prefix().valid("").optional(),data:I.Joi.any().optional()}),a=I.Joi.object({type:I.Joi.string().min(1).max(32).required(),contractAddress:I.Joi.DID().prefix().wallet("ethereum").required(),chainType:I.Joi.string().min(1).max(32).required(),chainName:I.Joi.string().min(1).max(32).required(),chainId:I.Joi.number().positive().required()}),i=I.Joi.object({type:I.Joi.string().valid("svg","url","uri").required(),content:I.Joi.string().when("type",{is:"uri",then:I.Joi.string().max(20480).dataUri().required()}).when("type",{is:"url",then:I.Joi.string().max(2048).uri({scheme:["http","https"]}).required()})}),r=I.Joi.object({id:I.Joi.string().max(2048).uri({scheme:["http","https"]}).required(),scope:I.Joi.string().valid("public","private").default("public")}),t=I.Joi.object({id:I.Joi.DID().prefix().required(),pk:I.Joi.string().required(),name:I.Joi.string().min(1).max(256).required()}),c={address:I.Joi.DID().prefix().role("ROLE_ASSET").required(),moniker:I.Joi.string().min(2).max(255).required(),data:I.Joi.any().required(),readonly:I.Joi.boolean().default(!1),transferrable:I.Joi.boolean().default(!1),ttl:I.Joi.number().min(0).default(0),parent:I.Joi.DID().prefix().optional().allow(""),issuer:I.Joi.DID().prefix().optional().allow(""),endpoint:r.optional().allow(null).default(null),display:i.optional().allow(null).default(null),tags:I.Joi.array().items(I.Joi.string().min(1).max(64)).max(4).optional()},s={address:I.Joi.DID().prefix().role("ROLE_FACTORY").required(),name:I.Joi.string().min(2).max(255).required(),description:I.Joi.string().min(2).max(255).required(),settlement:I.Joi.string().valid("instant","periodic").default("instant"),limit:I.Joi.number().integer().min(0).default(0),trustedIssuers:I.Joi.array().items(I.Joi.DID().prefix()).max(8).optional(),data:I.Joi.any().optional().allow(null).default(null),display:i.optional().allow(null).default(null),input:I.Joi.object({value:I.Joi.BN().positive().min("0").default("0"),tokens:I.Joi.array().items(l).max(8).optional(),assets:I.Joi.array().items(I.Joi.alternatives().try(I.Joi.DID().prefix().role("ROLE_ASSET"),I.Joi.DID().prefix().role("ROLE_FACTORY"))).max(8).optional(),variables:I.Joi.array().items(I.Joi.object({name:I.Joi.string().min(1).max(255).required(),description:I.Joi.string().max(255).optional().allow(""),required:I.Joi.boolean().required()})).optional()}),output:I.Joi.object({moniker:I.Joi.string().min(2).max(255).required(),data:I.Joi.any().required(),readonly:I.Joi.boolean().default(!1),transferrable:I.Joi.boolean().default(!1),ttl:I.Joi.number().min(0).default(0),parent:I.Joi.string().max(255).required(),issuer:I.Joi.string().max(255).required(),endpoint:r.optional(),display:i.optional(),tags:I.Joi.array().items(I.Joi.string().min(1).max(64)).max(4).optional()}),hooks:I.Joi.array().items(I.Joi.object({name:I.Joi.string().valid("mint","postMint","preMint").required(),type:I.Joi.string().valid("url","contract").required(),hook:I.Joi.string().min(1).max(4096).required(),compiled:I.Joi.array().items(I.Joi.object()).optional()})).optional()};I.schemas={context:w,tokenInput:l,multiInput:m,multiSig:e,foreignToken:a,variableInput:$,nftDisplay:i,nftEndpoint:r,nftIssuer:t,tokenHolder:y,assetProps:c,assetSchema:I.Joi.object(c).options({stripUnknown:!0,noDefaults:!1}),factoryProps:s,factorySchema:I.Joi.object(s).options({stripUnknown:!0,noDefaults:!1})},I.patterns={txHash:p}})(ur);function Ct({onCancel:I,onSuccess:P,blocklet:B}){var c,s;const{vaults:T=[],appPid:L}=B,{t:p,locale:w}=Ve(),{connectApi:l}=ar(),{api:$}=Je(),{teamDid:y}=or(),[m,e]=ir({loading:!1,fetching:!1,error:"",address:"",fetched:[],errored:[]});Ee.useEffect(()=>{if(!De.isValid(m.address))return;const o=De.toAddress(m.address),h=m.fetched.find(b=>b.address===o),g=m.errored.find(b=>b.address===o);!m.fetching&&!h&&!g&&(e({fetching:!0}),$r(Ar.MAIN_CHAIN_ENDPOINT).getAccountState({address:o}).then(j=>{j.state?e({fetching:!1,fetched:[...m.fetched.filter(k=>k.address!==o),j.state]}):e({fetching:!1,errored:[...m.errored.filter(k=>k.address!==o),{address:o}]})}).catch(j=>{console.error(j),e({fetching:!1,error:Ue(j)})}))},[m.address,m.fetching]),Ee.useEffect(()=>{if(m.address){const o=De.toAddress(m.address);if(!De.isValid(o)){e({error:p("blocklet.config.vault.error.invalid")});return}if(ur.schemas.tokenHolder.validate(o).error){e({error:p("blocklet.config.vault.error.holder")});return}if(T.find(g=>g.did===o)){e({error:p("blocklet.config.vault.error.duplicate")});return}if(Ir([B.appDid,B.appPid,...B.migratedFrom.map(g=>g.appDid)].filter(Boolean)).includes(o)){e({error:p("blocklet.config.vault.error.appDid")});return}}e({error:""})},[m.address]);const a=async()=>{e({loading:!0});try{const o=await $.configVault({input:{teamDid:y,vaultDid:De.toAddress(m.address)}});l.open({locale:w,action:"approve-vault",forceConnected:!1,saveConnect:!1,autoConnect:!1,className:"connect",checkTimeout:10*60*1e3,passkeyBehavior:"none",extraParams:{sessionId:o.sessionId},messages:{title:p("blocklet.config.vault.approve.title"),scan:p(`blocklet.config.vault.approve.${T.length>0?"byLast":"byOwner"}`),confirm:p("blocklet.config.vault.approve.confirm"),success:p("blocklet.config.vault.approve.success")},onSuccess:()=>{l.open({locale:w,action:"config-vault",forceConnected:!1,saveConnect:!1,autoConnect:!1,className:"connect",checkTimeout:10*60*1e3,passkeyBehavior:"none",extraParams:{sessionId:o.sessionId},messages:{title:p("blocklet.config.vault.commit.title"),scan:p("blocklet.config.vault.commit.scan"),confirm:p("blocklet.config.vault.commit.confirm"),success:p("blocklet.config.vault.commit.success")},onSuccess:()=>{e({loading:!1}),P()},onClose:()=>{e({loading:!1}),l.close()}})},onClose:()=>{e({loading:!1}),l.close()}})}catch(o){e({loading:!1,error:Ue(o)})}},i=De.toAddress(m.address),r=[];De.isValid(i)&&r.push({key:p("blocklet.config.vault.role"),value:q.jsx(vr,{color:"primary",variant:"outlined",size:"small",label:De.toTypeInfoStr(i).role||"-"})});const t=m.fetched.find(o=>o.address===i);return t&&r.push({key:p("blocklet.config.vault.firstSeen"),value:Yt((c=t.context)==null?void 0:c.genesisTime,"-")},{key:p("blocklet.config.vault.lastSeen"),value:Yt((s=t.context)==null?void 0:s.renaissanceTime,"-")},{key:p("blocklet.config.vault.migratedFrom"),value:t.migratedFrom.length?t.migratedFrom.map(o=>q.jsx(Qt,{did:o,showQrcode:!0,compact:!0,size:14,locale:w},o)):"-"},{key:p("blocklet.config.vault.migratedTo"),value:t.migratedTo.length?t.migratedTo.map(o=>q.jsx(Qt,{did:o,showQrcode:!0,compact:!0,size:14,locale:w},o)):"-"}),q.jsx(nr,{open:!0,fullWidth:!0,showCloseButton:!1,onClose:I,title:q.jsxs(U,{sx:{display:"flex",alignItems:"center",gap:1},children:[q.jsx(kt,{}),p("blocklet.config.vault.title")]}),actions:q.jsxs(q.Fragment,{children:[q.jsx(Le,{onClick:I,children:p("common.cancel")}),q.jsx(Le,{onClick:a,variant:"contained",disabled:!!m.error||m.loading,children:p("common.confirm")})]}),children:q.jsxs(er,{direction:"column",spacing:3,children:[q.jsxs(Be,{variant:"body1",color:"text.secondary",gutterBottom:!0,children:[p("blocklet.config.vault.desc")," ",p("blocklet.config.vault.tip")]}),T.length>0&&q.jsxs(U,{children:[q.jsxs(Be,{variant:"body1",color:"text.secondary",gutterBottom:!0,children:[p("blocklet.config.vault.current"),":"]}),q.jsxs(U,{sx:{display:"flex",alignItems:"center",gap:.5},children:[q.jsx(Lr,{did:T[T.length-1].did,showQrcode:!0,style:{width:"auto"}}),q.jsx(qr,{vaults:T,appPid:L})]})]}),q.jsx(yr,{fullWidth:!0,"data-cy":"input-factory-address",label:p("blocklet.config.vault.address"),error:!!m.error,helperText:m.error,value:m.address,InputProps:{endAdornment:m.fetching?q.jsx(br,{position:"end",children:q.jsx(We,{size:16})}):null},onChange:o=>{e({address:o.target.value,error:""})}}),q.jsx(U,{sx:{"& .info-row__name":{fontSize:"14px"},"& .info-row__value":{fontSize:"14px"}},children:r.map(o=>q.jsx(Tr,{valueComponent:"div",nameWidth:120,name:o.key,children:o.value},o.key))})]})})}Ct.propTypes={onCancel:Oe.func.isRequired,onSuccess:Oe.func.isRequired,blocklet:Oe.object.isRequired};Ct.defaultProps={};function es({teamDid:I,size:P="small",...B}){const{t:T}=Ve(),{api:L}=Je(),[p,w]=Ee.useState(!1),[l,$]=Ee.useState(null),y=()=>{w(!1),$(null)},m=async()=>{var a;try{w(!0);const i=await L.rotateSessionKey({input:{teamDid:I}});Te.success(T("blocklet.config.rotateSessionKey.success",{count:((a=i.removed)==null?void 0:a.length)||0})),setTimeout(()=>{window.location.reload()},1e3)}catch(i){Te.error(Ue(i))}finally{w(!1),$(null)}},e={title:T("blocklet.config.rotateSessionKey.title"),description:T("blocklet.config.rotateSessionKey.description"),confirm:T("common.confirm"),cancel:T("common.cancel"),onConfirm:m,onCancel:y};return q.jsxs("div",{...B,children:[q.jsxs(Le,{onClick:()=>$(e),color:"error",variant:"outlined",size:P,children:[p?q.jsx(We,{size:16,style:{marginRight:5}}):null,T("blocklet.config.rotateSessionKey.action")]}),l&&q.jsx(xt,{title:l.title,description:l.description,confirm:l.confirm,cancel:l.cancel,onConfirm:l.onConfirm,onCancel:l.onCancel})]})}function He({blocklet:I,onUpdate:P,hasPermission:B}){var g,b;const{api:T,inService:L}=Je(),{t:p}=Ee.useContext(Or),[w,l]=ir({loading:!1,showTransferOwner:!1,showConfigVault:!1}),$=!!((b=(g=I==null?void 0:I.settings)==null?void 0:g.invite)!=null&&b.enabled),y=w.loading||!B,{did:m}=I.meta;if(tr(I.status))return null;const e=I.environments.find(j=>j.key===Ne.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE),a=!e||e.value==="yes",i=I.environments.find(j=>j.key===Ne.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_TENANT_MODE),r=(i==null?void 0:i.value)||Ne.BLOCKLET_TENANT_MODES.SINGLE,t=(j,k)=>async f=>{if(!w.loading){l({loading:!0});try{const{checked:v}=f.target,{blocklet:x}=await T.configBlocklet({input:{did:I.meta.did,configs:[{key:Ne.BLOCKLET_CONFIGURABLE_KEY[j],value:k(v)}]}});P(x)}catch(v){Te.error(v.message)}finally{l({loading:!1})}}},c=t("BLOCKLET_DELETABLE",j=>j?"no":"yes"),s=t("BLOCKLET_APP_TENANT_MODE",j=>j?Ne.BLOCKLET_TENANT_MODES.MULTIPLE:Ne.BLOCKLET_TENANT_MODES.SINGLE),o=async j=>{if(!w.loading){l({loading:!0});try{await T.updateInviteSettings({input:{did:I.meta.did,invite:{enabled:j.target.checked}}})}catch(k){Te.error(k.message)}finally{l({loading:!1})}}},h=async()=>{if(!w.loading){l({loading:!0});try{const{blocklet:j}=await T.getBlocklet({input:{did:I.meta.did}});P(j)}catch(j){Te.error(j.message)}finally{l({loading:!1})}}};return q.jsxs(ns,{p:3,sx:{border:"1px solid red",borderRadius:2},className:"advanced-config",children:[!L&&q.jsxs(q.Fragment,{children:[q.jsx(Ie,{title:p("blocklet.config.deletable.name"),desc:p(a?"blocklet.config.deletable.disable":"blocklet.config.deletable.enable"),children:q.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:q.jsx(gt,{disabled:y,checked:!a,defaultChecked:!0,onChange:c})})}),q.jsx(U,{className:"config-form",component:qe,my:3})]}),q.jsx(St,{inService:L,disabled:y,loading:w.loading,onChange:h}),q.jsx(U,{className:"config-form",component:qe,my:3}),L&&q.jsx(kr,{role:"owner",children:j=>(j||Jr)&&q.jsxs(q.Fragment,{children:[q.jsx(Ie,{title:p("blocklet.config.vault.title"),desc:p("blocklet.config.vault.desc"),children:q.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:q.jsxs(Le,{variant:"contained",color:"primary",size:"small","data-cy":"config-vault",onClick:()=>l({showConfigVault:!0}),children:[q.jsx(kt,{style:{fontSize:"1.3em",marginRight:4}}),p("blocklet.config.vault.title")]})})}),q.jsx(U,{className:"config-form",component:qe,my:3}),w.showConfigVault&&q.jsx(Ct,{blocklet:I,onCancel:()=>l({showConfigVault:!1}),onSuccess:()=>l({showConfigVault:!1})}),q.jsx(Ie,{title:p("team.transferApp.name"),desc:p("team.transferApp.description"),children:q.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:q.jsxs(Le,{variant:"contained",edge:"end",color:"primary",size:"small","data-cy":"transfer-app",onClick:()=>l({showTransferOwner:!0}),children:[q.jsx(lr,{style:{fontSize:"1.3em",marginRight:4}}),p("team.transferApp.name")]})})}),q.jsx(U,{className:"config-form",component:qe,my:3}),w.showTransferOwner&&q.jsx(Rt,{onCancel:()=>l({showTransferOwner:!1}),onSuccess:()=>l({showTransferOwner:!1})})]})}),q.jsx(Ie,{title:p("blocklet.config.clearCache.name"),desc:p("blocklet.config.clearCache.purpose"),children:q.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:q.jsx(Ur,{teamDid:m})})}),q.jsx(U,{className:"config-form",component:qe,my:3}),q.jsx(Ie,{title:p("blocklet.config.rotateSessionKey.name"),desc:p("blocklet.config.rotateSessionKey.purpose"),children:q.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:q.jsx(es,{style:{whiteSpace:"nowrap"},teamDid:m})})}),q.jsx(U,{className:"config-form",component:qe,my:3}),q.jsx(Ie,{title:p("blocklet.config.tenantMode.name"),desc:p(`blocklet.config.tenantMode.${r}`),children:q.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:q.jsx(gt,{disabled:y,checked:r===Ne.BLOCKLET_TENANT_MODES.MULTIPLE,onChange:s})})}),q.jsx(U,{className:"config-form",component:qe,my:3}),q.jsx(Ie,{title:p("team.invite.setting"),desc:p(`team.invite.${$?"enabled":"disabled"}`),children:q.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:q.jsx(gt,{disabled:y,checked:$,onChange:o})})})]})}const ts=Ze(He,"mutate_blocklets"),rs=Ze(He,"",rr);function ss(I){const{inService:P}=Je();return P?q.jsx(rs,{...I}):q.jsx(ts,{...I})}He.propTypes={blocklet:Oe.object.isRequired,onUpdate:Oe.func,hasPermission:Oe.bool};He.defaultProps={onUpdate:()=>{},hasPermission:!1};const ns=_t(er)``;function Ge({blocklet:I,onUpdate:P,hasPermission:B}){return tr(I.status)?null:q.jsx(os,{children:q.jsx(ss,{blocklet:I,onUpdate:P,hasPermission:B})})}const is=Ze(Ge,"mutate_blocklets"),as=Ze(Ge,"",rr);function Ls(I){const{inService:P}=Je();return P?q.jsx(as,{...I}):q.jsx(is,{...I})}Ge.propTypes={blocklet:Oe.object.isRequired,onUpdate:Oe.func,hasPermission:Oe.bool};Ge.defaultProps={onUpdate:()=>{},hasPermission:!1};const os=_t(U)`
|
|
7
|
+
`;var ur={},fr={exports:{}};(function(I,P){(function(B,T){I.exports=T()})(self,()=>{return B={7629:(L,p,_)=>{const l=_(375),x=_(8571),b=_(9474),m=_(1687),e=_(8652),a=_(8160),i=_(3292),r=_(6354),t=_(8901),c=_(9708),s=_(6914),o=_(2294),h=_(6133),g=_(1152),w=_(8863),R=_(2036),j={Base:class{constructor(f){this.type=f,this.$_root=null,this._definition={},this._reset()}_reset(){this._ids=new o.Ids,this._preferences=null,this._refs=new h.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 l(typeof c.describe=="function","Manifest functionality disabled"),c.describe(this)}allow(...f){return a.verifyFlat(f,"allow"),this._values(f,"_valids")}alter(f){l(f&&typeof f=="object"&&!Array.isArray(f),"Invalid targets argument"),l(!this._inRuleset(),"Cannot set alterations inside a ruleset");const y=this.clone();y.$_terms.alterations=y.$_terms.alterations||[];for(const M in f){const E=f[M];l(typeof E=="function","Alteration adjuster for",M,"must be a function"),y.$_terms.alterations.push({target:M,adjuster:E})}return y.$_temp.ruleset=!1,y}artifact(f){return l(f!==void 0,"Artifact cannot be undefined"),l(!this._cache,"Cannot set an artifact with a rule cache"),this.$_setFlag("artifact",f)}cast(f){return l(f===!1||typeof f=="string","Invalid to value"),l(f===!1||this._definition.cast[f],"Type",this.type,"does not support casting to",f),this.$_setFlag("cast",f===!1?void 0:f)}default(f,y){return this._default("default",f,y)}description(f){return l(f&&typeof f=="string","Description must be a non-empty string"),this.$_setFlag("description",f)}empty(f){const y=this.clone();return f!==void 0&&(f=y.$_compile(f,{override:!1})),y.$_setFlag("empty",f,{clone:!1})}error(f){return l(f,"Missing error"),l(f instanceof Error||typeof f=="function","Must provide a valid Error object or a function"),this.$_setFlag("error",f)}example(f,y={}){return l(f!==void 0,"Missing example"),a.assertOptions(y,["override"]),this._inner("examples",f,{single:!0,override:y.override})}external(f,y){return typeof f=="object"&&(l(!y,"Cannot combine options with description"),y=f.description,f=f.method),l(typeof f=="function","Method must be a function"),l(y===void 0||y&&typeof y=="string","Description must be a non-empty string"),this._inner("externals",{method:f,description:y},{single:!0})}failover(f,y){return this._default("failover",f,y)}forbidden(){return this.presence("forbidden")}id(f){return f?(l(typeof f=="string","id must be a non-empty string"),l(/^[^\.]+$/.test(f),"id cannot contain period character"),this.$_setFlag("id",f)):this.$_setFlag("id",void 0)}invalid(...f){return this._values(f,"_invalids")}label(f){return l(f&&typeof f=="string","Label name must be a non-empty string"),this.$_setFlag("label",f)}meta(f){return l(f!==void 0,"Meta cannot be undefined"),this._inner("metas",f,{single:!0})}note(...f){l(f.length,"Missing notes");for(const y of f)l(y&&typeof y=="string","Notes must be non-empty strings");return this._inner("notes",f)}only(f=!0){return l(typeof f=="boolean","Invalid mode:",f),this.$_setFlag("only",f)}optional(){return this.presence("optional")}prefs(f){l(f,"Missing preferences"),l(f.context===void 0,"Cannot override context"),l(f.externals===void 0,"Cannot override externals"),l(f.warnings===void 0,"Cannot override warnings"),l(f.debug===void 0,"Cannot override debug"),a.checkPreferences(f);const y=this.clone();return y._preferences=a.preferences(y._preferences,f),y}presence(f){return l(["optional","required","forbidden"].includes(f),"Unknown presence mode",f),this.$_setFlag("presence",f)}raw(f=!0){return this.$_setFlag("result",f?"raw":void 0)}result(f){return l(["raw","strip"].includes(f),"Unknown result mode",f),this.$_setFlag("result",f)}required(){return this.presence("required")}strict(f){const y=this.clone(),M=f!==void 0&&!f;return y._preferences=a.preferences(y._preferences,{convert:M}),y}strip(f=!0){return this.$_setFlag("result",f?"strip":void 0)}tag(...f){l(f.length,"Missing tags");for(const y of f)l(y&&typeof y=="string","Tags must be non-empty strings");return this._inner("tags",f)}unit(f){return l(f&&typeof f=="string","Unit name must be a non-empty string"),this.$_setFlag("unit",f)}valid(...f){a.verifyFlat(f,"valid");const y=this.allow(...f);return y.$_setFlag("only",!!y._valids,{clone:!1}),y}when(f,y){const M=this.clone();M.$_terms.whens||(M.$_terms.whens=[]);const E=i.when(M,f,y);if(!["any","link"].includes(M.type)){const N=E.is?[E]:E.switch;for(const $ of N)l(!$.then||$.then.type==="any"||$.then.type===M.type,"Cannot combine",M.type,"with",$.then&&$.then.type),l(!$.otherwise||$.otherwise.type==="any"||$.otherwise.type===M.type,"Cannot combine",M.type,"with",$.otherwise&&$.otherwise.type)}return M.$_terms.whens.push(E),M.$_mutateRebuild()}cache(f){l(!this._inRuleset(),"Cannot set caching inside a ruleset"),l(!this._cache,"Cannot override schema cache"),l(this._flags.artifact===void 0,"Cannot cache a rule with an artifact");const y=this.clone();return y._cache=f||e.provider.provision(),y.$_temp.ruleset=!1,y}clone(){const f=Object.create(Object.getPrototypeOf(this));return this._assign(f)}concat(f){l(a.isSchema(f),"Invalid schema object"),l(this.type==="any"||f.type==="any"||f.type===this.type,"Cannot merge type",this.type,"with another type:",f.type),l(!this._inRuleset(),"Cannot concatenate onto a schema with open ruleset"),l(!f._inRuleset(),"Cannot concatenate a schema with open ruleset");let y=this.clone();if(this.type==="any"&&f.type!=="any"){const M=f.clone();for(const E of Object.keys(y))E!=="type"&&(M[E]=y[E]);y=M}y._ids.concat(f._ids),y._refs.register(f,h.toSibling),y._preferences=y._preferences?a.preferences(y._preferences,f._preferences):f._preferences,y._valids=R.merge(y._valids,f._valids,f._invalids),y._invalids=R.merge(y._invalids,f._invalids,f._valids);for(const M of f._singleRules.keys())y._singleRules.has(M)&&(y._rules=y._rules.filter(E=>E.keep||E.name!==M),y._singleRules.delete(M));for(const M of f._rules)f._definition.rules[M.method].multi||y._singleRules.set(M.name,M),y._rules.push(M);if(y._flags.empty&&f._flags.empty){y._flags.empty=y._flags.empty.concat(f._flags.empty);const M=Object.assign({},f._flags);delete M.empty,m(y._flags,M)}else if(f._flags.empty){y._flags.empty=f._flags.empty;const M=Object.assign({},f._flags);delete M.empty,m(y._flags,M)}else m(y._flags,f._flags);for(const M in f.$_terms){const E=f.$_terms[M];E?y.$_terms[M]?y.$_terms[M]=y.$_terms[M].concat(E):y.$_terms[M]=E.slice():y.$_terms[M]||(y.$_terms[M]=E)}return this.$_root._tracer&&this.$_root._tracer._combine(y,[this,f]),y.$_mutateRebuild()}extend(f){return l(!f.base,"Cannot extend type with another base"),t.type(this,f)}extract(f){return f=Array.isArray(f)?f:f.split("."),this._ids.reach(f)}fork(f,y){l(!this._inRuleset(),"Cannot fork inside a ruleset");let M=this;for(let E of[].concat(f))E=Array.isArray(E)?E:E.split("."),M=M._ids.fork(E,y,M);return M.$_temp.ruleset=!1,M}rule(f){const y=this._definition;a.assertOptions(f,Object.keys(y.modifiers)),l(this.$_temp.ruleset!==!1,"Cannot apply rules to empty ruleset or the last rule added does not support rule properties");const M=this.$_temp.ruleset===null?this._rules.length-1:this.$_temp.ruleset;l(M>=0&&M<this._rules.length,"Cannot apply rules to empty ruleset");const E=this.clone();for(let N=M;N<E._rules.length;++N){const $=E._rules[N],n=x($);for(const d in f)y.modifiers[d](n,f[d]),l(n.name===$.name,"Cannot change rule name");E._rules[N]=n,E._singleRules.get(n.name)===$&&E._singleRules.set(n.name,n)}return E.$_temp.ruleset=!1,E.$_mutateRebuild()}get ruleset(){l(!this._inRuleset(),"Cannot start a new ruleset without closing the previous one");const f=this.clone();return f.$_temp.ruleset=f._rules.length,f}get $(){return this.ruleset}tailor(f){f=[].concat(f),l(!this._inRuleset(),"Cannot tailor inside a ruleset");let y=this;if(this.$_terms.alterations)for(const{target:M,adjuster:E}of this.$_terms.alterations)f.includes(M)&&(y=E(y),l(a.isSchema(y),"Alteration adjuster for",M,"failed to return a schema object"));return y=y.$_modify({each:M=>M.tailor(f),ref:!1}),y.$_temp.ruleset=!1,y.$_mutateRebuild()}tracer(){return g.location?g.location(this):this}validate(f,y){return w.entry(f,this,y)}validateAsync(f,y){return w.entryAsync(f,this,y)}$_addRule(f){typeof f=="string"&&(f={name:f}),l(f&&typeof f=="object","Invalid options"),l(f.name&&typeof f.name=="string","Invalid rule name");for(const $ in f)l($[0]!=="_","Cannot set private rule properties");const y=Object.assign({},f);y._resolve=[],y.method=y.method||y.name;const M=this._definition.rules[y.method],E=y.args;l(M,"Unknown rule",y.method);const N=this.clone();if(E){l(Object.keys(E).length===1||Object.keys(E).length===this._definition.rules[y.name].args.length,"Invalid rule definition for",this.type,y.name);for(const $ in E){let n=E[$];if(M.argsByName){const d=M.argsByName.get($);if(d.ref&&a.isResolvable(n))y._resolve.push($),N.$_mutateRegister(n);else if(d.normalize&&(n=d.normalize(n),E[$]=n),d.assert){const v=a.validateArg(n,$,d);l(!v,v,"or reference")}}n!==void 0?E[$]=n:delete E[$]}}return M.multi||(N._ruleRemove(y.name,{clone:!1}),N._singleRules.set(y.name,y)),N.$_temp.ruleset===!1&&(N.$_temp.ruleset=null),M.priority?N._rules.unshift(y):N._rules.push(y),N}$_compile(f,y){return i.schema(this.$_root,f,y)}$_createError(f,y,M,E,N,$={}){const n=$.flags!==!1?this._flags:{},d=$.messages?s.merge(this._definition.messages,$.messages):this._definition.messages;return new r.Report(f,y,M,n,d,E,N)}$_getFlag(f){return this._flags[f]}$_getRule(f){return this._singleRules.get(f)}$_mapLabels(f){return f=Array.isArray(f)?f:f.split("."),this._ids.labels(f)}$_match(f,y,M,E){(M=Object.assign({},M)).abortEarly=!0,M._externals=!1,y.snapshot();const N=!w.validate(f,this,y,M,E).errors;return y.restore(),N}$_modify(f){return a.assertOptions(f,["each","once","ref","schema"]),o.schema(this,f)||this}$_mutateRebuild(){return l(!this._inRuleset(),"Cannot add this rule inside a ruleset"),this._refs.reset(),this._ids.reset(),this.$_modify({each:(f,{source:y,name:M,path:E,key:N})=>{const $=this._definition[y][M]&&this._definition[y][M].register;$!==!1&&this.$_mutateRegister(f,{family:$,key:N})}}),this._definition.rebuild&&this._definition.rebuild(this),this.$_temp.ruleset=!1,this}$_mutateRegister(f,{family:y,key:M}={}){this._refs.register(f,y),this._ids.register(f,{key:M})}$_property(f){return this._definition.properties[f]}$_reach(f){return this._ids.reach(f)}$_rootReferences(){return this._refs.roots()}$_setFlag(f,y,M={}){l(f[0]==="_"||!this._inRuleset(),"Cannot set flag inside a ruleset");const E=this._definition.flags[f]||{};if(b(y,E.default)&&(y=void 0),b(y,this._flags[f]))return this;const N=M.clone!==!1?this.clone():this;return y!==void 0?(N._flags[f]=y,N.$_mutateRegister(y)):delete N._flags[f],f[0]!=="_"&&(N.$_temp.ruleset=!1),N}$_parent(f,...y){return this[f][a.symbols.parent].call(this,...y)}$_validate(f,y,M){return w.validate(f,this,y,M)}_assign(f){f.type=this.type,f.$_root=this.$_root,f.$_temp=Object.assign({},this.$_temp),f.$_temp.whens={},f._ids=this._ids.clone(),f._preferences=this._preferences,f._valids=this._valids&&this._valids.clone(),f._invalids=this._invalids&&this._invalids.clone(),f._rules=this._rules.slice(),f._singleRules=x(this._singleRules,{shallow:!0}),f._refs=this._refs.clone(),f._flags=Object.assign({},this._flags),f._cache=null,f.$_terms={};for(const y in this.$_terms)f.$_terms[y]=this.$_terms[y]?this.$_terms[y].slice():null;f.$_super={};for(const y in this.$_super)f.$_super[y]=this._super[y].bind(f);return f}_bare(){const f=this.clone();f._reset();const y=f._definition.terms;for(const M in y){const E=y[M];f.$_terms[M]=E.init}return f.$_mutateRebuild()}_default(f,y,M={}){return a.assertOptions(M,"literal"),l(y!==void 0,"Missing",f,"value"),l(typeof y=="function"||!M.literal,"Only function value supports literal option"),typeof y=="function"&&M.literal&&(y={[a.symbols.literal]:!0,literal:y}),this.$_setFlag(f,y)}_generate(f,y,M){if(!this.$_terms.whens)return{schema:this};const E=[],N=[];for(let d=0;d<this.$_terms.whens.length;++d){const v=this.$_terms.whens[d];if(v.concat){E.push(v.concat),N.push(`${d}.concat`);continue}const k=v.ref?v.ref.resolve(f,y,M):f,A=v.is?[v]:v.switch,D=N.length;for(let C=0;C<A.length;++C){const{is:S,then:u,otherwise:O}=A[C],z=`${d}${v.switch?"."+C:""}`;if(S.$_match(k,y.nest(S,`${z}.is`),M)){if(u){const F=y.localize([...y.path,`${z}.then`],y.ancestors,y.schemas),{schema:J,id:K}=u._generate(f,F,M);E.push(J),N.push(`${z}.then${K?`(${K})`:""}`);break}}else if(O){const F=y.localize([...y.path,`${z}.otherwise`],y.ancestors,y.schemas),{schema:J,id:K}=O._generate(f,F,M);E.push(J),N.push(`${z}.otherwise${K?`(${K})`:""}`);break}}if(v.break&&N.length>D)break}const $=N.join(", ");if(y.mainstay.tracer.debug(y,"rule","when",$),!$)return{schema:this};if(!y.mainstay.tracer.active&&this.$_temp.whens[$])return{schema:this.$_temp.whens[$],id:$};let n=this;this._definition.generate&&(n=this._definition.generate(this,f,y,M));for(const d of E)n=n.concat(d);return this.$_root._tracer&&this.$_root._tracer._combine(n,[this,...E]),this.$_temp.whens[$]=n,{schema:n,id:$}}_inner(f,y,M={}){l(!this._inRuleset(),`Cannot set ${f} inside a ruleset`);const E=this.clone();return E.$_terms[f]&&!M.override||(E.$_terms[f]=[]),M.single?E.$_terms[f].push(y):E.$_terms[f].push(...y),E.$_temp.ruleset=!1,E}_inRuleset(){return this.$_temp.ruleset!==null&&this.$_temp.ruleset!==!1}_ruleRemove(f,y={}){if(!this._singleRules.has(f))return this;const M=y.clone!==!1?this.clone():this;M._singleRules.delete(f);const E=[];for(let N=0;N<M._rules.length;++N){const $=M._rules[N];$.name!==f||$.keep?E.push($):M._inRuleset()&&N<M.$_temp.ruleset&&--M.$_temp.ruleset}return M._rules=E,M}_values(f,y){a.verifyFlat(f,y.slice(1,-1));const M=this.clone(),E=f[0]===a.symbols.override;if(E&&(f=f.slice(1)),!M[y]&&f.length?M[y]=new R:E&&(M[y]=f.length?new R:null,M.$_mutateRebuild()),!M[y])return M;E&&M[y].override();for(const N of f){l(N!==void 0,"Cannot call allow/valid/invalid with undefined"),l(N!==a.symbols.override,"Override must be the first value");const $=y==="_invalids"?"_valids":"_invalids";M[$]&&(M[$].remove(N),M[$].length||(l(y==="_valids"||!M._flags.only,"Setting invalid value",N,"leaves schema rejecting all values due to previous valid rule"),M[$]=null)),M[y].add(N,M._refs)}return M}}};j.Base.prototype[a.symbols.any]={version:a.version,compile:i.compile,root:"$_root"},j.Base.prototype.isImmutable=!0,j.Base.prototype.deny=j.Base.prototype.invalid,j.Base.prototype.disallow=j.Base.prototype.invalid,j.Base.prototype.equal=j.Base.prototype.valid,j.Base.prototype.exist=j.Base.prototype.required,j.Base.prototype.not=j.Base.prototype.invalid,j.Base.prototype.options=j.Base.prototype.prefs,j.Base.prototype.preferences=j.Base.prototype.prefs,L.exports=new j.Base},8652:(L,p,_)=>{const l=_(375),x=_(8571),b=_(8160),m={max:1e3,supported:new Set(["undefined","boolean","number","string"])};p.provider={provision:e=>new m.Cache(e)},m.Cache=class{constructor(e={}){b.assertOptions(e,["max"]),l(e.max===void 0||e.max&&e.max>0&&isFinite(e.max),"Invalid max cache size"),this._max=e.max||m.max,this._map=new Map,this._list=new m.List}get length(){return this._map.size}set(e,a){if(e!==null&&!m.supported.has(typeof e))return;let i=this._map.get(e);if(i)return i.value=a,void this._list.first(i);i=this._list.unshift({key:e,value:a}),this._map.set(e,i),this._compact()}get(e){const a=this._map.get(e);if(a)return this._list.first(a),x(a.value)}_compact(){if(this._map.size>this._max){const e=this._list.pop();this._map.delete(e.key)}}},m.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:i}=e;return a.prev=i,i&&(i.next=a),e===this.tail&&(this.tail=a),e.prev=null,e.next=null,e}}},8160:(L,p,_)=>{const l=_(375),x=_(7916),b=_(5934);let m,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)?)?)?)?$/};p.version=b.version,p.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},p.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")},p.assertOptions=function(i,r,t="Options"){l(i&&typeof i=="object"&&!Array.isArray(i),"Options must be of type object");const c=Object.keys(i).filter(s=>!r.includes(s));l(c.length===0,`${t} contain unknown keys: ${c}`)},p.checkPreferences=function(i){e=e||_(3378);const r=e.preferences.validate(i);if(r.error)throw new x([r.error.details[0].message])},p.compare=function(i,r,t){switch(t){case"=":return i===r;case">":return i>r;case"<":return i<r;case">=":return i>=r;case"<=":return i<=r}},p.default=function(i,r){return i===void 0?r:i},p.isIsoDate=function(i){return a.isoDate.test(i)},p.isNumber=function(i){return typeof i=="number"&&!isNaN(i)},p.isResolvable=function(i){return!!i&&(i[p.symbols.ref]||i[p.symbols.template])},p.isSchema=function(i,r={}){const t=i&&i[p.symbols.any];return!!t&&(l(r.legacy||t.version===p.version,"Cannot mix different versions of joi schemas"),!0)},p.isValues=function(i){return i[p.symbols.values]},p.limit=function(i){return Number.isSafeInteger(i)&&i>=0},p.preferences=function(i,r){m=m||_(6914),i=i||{},r=r||{};const t=Object.assign({},i,r);return r.errors&&i.errors&&(t.errors=Object.assign({},i.errors,r.errors),t.errors.wrap=Object.assign({},i.errors.wrap,r.errors.wrap)),r.messages&&(t.messages=m.compile(r.messages,i.messages)),delete t[p.symbols.prefs],t},p.tryWithPath=function(i,r,t={}){try{return i()}catch(c){throw c.path!==void 0?c.path=r+"."+c.path:c.path=r,t.append&&(c.message=`${c.message} (${c.path})`),c}},p.validateArg=function(i,r,{assert:t,message:c}){if(p.isSchema(t)){const s=t.validate(i);return s.error?s.error.message:void 0}if(!t(i))return r?`${r} ${c}`:c},p.verifyFlat=function(i,r){for(const t of i)l(!Array.isArray(t),"Method no longer accepts array arguments:",r)}},3292:(L,p,_)=>{const l=_(375),x=_(8160),b=_(6133),m={};p.schema=function(e,a,i={}){x.assertOptions(i,["appendPath","override"]);try{return m.schema(e,a,i)}catch(r){throw i.appendPath&&r.path!==void 0&&(r.message=`${r.message} (${r.path})`),r}},m.schema=function(e,a,i){l(a!==void 0,"Invalid undefined schema"),Array.isArray(a)&&(l(a.length,"Invalid empty array schema"),a.length===1&&(a=a[0]));const r=(t,...c)=>i.override!==!1?t.valid(e.override,...c):t.valid(...c);if(m.simple(a))return r(e,a);if(typeof a=="function")return e.custom(a);if(l(typeof a=="object","Invalid schema content:",typeof a),x.isResolvable(a))return r(e,a);if(x.isSchema(a))return a;if(Array.isArray(a)){for(const t of a)if(!m.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):(l(Object.getPrototypeOf(a)===Object.getPrototypeOf({}),"Schema can only contain plain objects"),e.object().keys(a))},p.ref=function(e,a){return b.isRef(e)?e:b.create(e,a)},p.compile=function(e,a,i={}){x.assertOptions(i,["legacy"]);const r=a&&a[x.symbols.any];if(r)return l(i.legacy||r.version===x.version,"Cannot mix different versions of joi schemas:",r.version,x.version),a;if(typeof a!="object"||!i.legacy)return p.schema(e,a,{appendPath:!0});const t=m.walk(a);return t?t.compile(t.root,a):p.schema(e,a,{appendPath:!0})},m.walk=function(e){if(typeof e!="object")return null;if(Array.isArray(e)){for(const i of e){const r=m.walk(i);if(r)return r}return null}const a=e[x.symbols.any];if(a)return{root:e[a.root],compile:a.compile};l(Object.getPrototypeOf(e)===Object.getPrototypeOf({}),"Schema can only contain plain objects");for(const i in e){const r=m.walk(e[i]);if(r)return r}return null},m.simple=function(e){return e===null||["boolean","string","number"].includes(typeof e)},p.when=function(e,a,i){if(i===void 0&&(l(a&&typeof a=="object","Missing options"),i=a,a=b.create(".")),Array.isArray(i)&&(i={switch:i}),x.assertOptions(i,["is","not","then","otherwise","switch","break"]),x.isSchema(a))return l(i.is===void 0,'"is" can not be used with a schema condition'),l(i.not===void 0,'"not" can not be used with a schema condition'),l(i.switch===void 0,'"switch" can not be used with a schema condition'),m.condition(e,{is:a,then:i.then,otherwise:i.otherwise,break:i.break});if(l(b.isRef(a)||typeof a=="string","Invalid condition:",a),l(i.not===void 0||i.is===void 0,'Cannot combine "is" with "not"'),i.switch===void 0){let t=i;i.not!==void 0&&(t={is:i.not,then:i.otherwise,otherwise:i.then,break:i.break});let c=t.is!==void 0?e.$_compile(t.is):e.$_root.invalid(null,!1,0,"").required();return l(t.then!==void 0||t.otherwise!==void 0,'options must have at least one of "then", "otherwise", or "switch"'),l(t.break===void 0||t.then===void 0||t.otherwise===void 0,"Cannot specify then, otherwise, and break all together"),i.is===void 0||b.isRef(i.is)||x.isSchema(i.is)||(c=c.required()),m.condition(e,{ref:p.ref(a),is:c,then:t.then,otherwise:t.otherwise,break:t.break})}l(Array.isArray(i.switch),'"switch" must be an array'),l(i.is===void 0,'Cannot combine "switch" with "is"'),l(i.not===void 0,'Cannot combine "switch" with "not"'),l(i.then===void 0,'Cannot combine "switch" with "then"');const r={ref:p.ref(a),switch:[],break:i.break};for(let t=0;t<i.switch.length;++t){const c=i.switch[t],s=t===i.switch.length-1;x.assertOptions(c,s?["is","then","otherwise"]:["is","then"]),l(c.is!==void 0,'Switch statement missing "is"'),l(c.then!==void 0,'Switch statement missing "then"');const o={is:e.$_compile(c.is),then:e.$_compile(c.then)};if(b.isRef(c.is)||x.isSchema(c.is)||(o.is=o.is.required()),s){l(i.otherwise===void 0||c.otherwise===void 0,'Cannot specify "otherwise" inside and outside a "switch"');const h=i.otherwise!==void 0?i.otherwise:c.otherwise;h!==void 0&&(l(r.break===void 0,"Cannot specify both otherwise and break"),o.otherwise=e.$_compile(h))}r.switch.push(o)}return r},m.condition=function(e,a){for(const i of["then","otherwise"])a[i]===void 0?delete a[i]:a[i]=e.$_compile(a[i]);return a}},6354:(L,p,_)=>{const l=_(5688),x=_(8160),b=_(3328);p.Report=class{constructor(m,e,a,i,r,t,c){if(this.code=m,this.flags=i,this.messages=r,this.path=t.path,this.prefs=c,this.state=t,this.value=e,this.message=null,this.template=null,this.local=a||{},this.local.label=p.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(m){if(this.template=m,!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 m=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 "${m}" 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(m,e){return p.template(this.value,m,e||this.code,this.state,this.prefs)}},p.path=function(m){let e="";for(const a of m)typeof a!="object"&&(typeof a=="string"?(e&&(e+="."),e+=a):e+=`[${a}]`);return e},p.template=function(m,e,a,i,r){if(!e)return;if(b.isTemplate(e))return a!=="root"?e:null;let t=r.errors.language;if(x.isResolvable(t)&&(t=t.resolve(m,i,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["*"]},p.label=function(m,e,a,i){if(!a.errors.label)return"";if(m.label)return m.label;let r=e.path;return a.errors.label==="key"&&e.path.length>1&&(r=e.path.slice(-1)),p.path(r)||p.template(null,a.messages,"root",e,a)||i&&p.template(null,i,"root",e,a)||"value"},p.process=function(m,e,a){if(!m)return null;const{override:i,message:r,details:t}=p.details(m);if(i)return i;if(a.errors.stack)return new p.ValidationError(r,t,e);const c=Error.stackTraceLimit;Error.stackTraceLimit=0;const s=new p.ValidationError(r,t,e);return Error.stackTraceLimit=c,s},p.details=function(m,e={}){let a=[];const i=[];for(const r of m){if(r instanceof Error){if(e.override!==!1)return{override:r};const c=r.toString();a.push(c),i.push({message:c,type:"override",context:{error:r}});continue}const t=r.toString();a.push(t),i.push({message:t,path:r.path.filter(c=>typeof c!="object"),type:r.code,context:r.local})}return a.length>1&&(a=[...new Set(a)]),{message:a.join(". "),details:i}},p.ValidationError=class extends Error{constructor(m,e,a){super(m),this._original=a,this.details=e}static isError(m){return m instanceof p.ValidationError}},p.ValidationError.prototype.isJoi=!0,p.ValidationError.prototype.name="ValidationError",p.ValidationError.prototype.annotate=l.error},8901:(L,p,_)=>{const l=_(375),x=_(8571),b=_(8160),m=_(6914),e={};p.type=function(a,i){const r=Object.getPrototypeOf(a),t=x(r),c=a._assign(Object.create(t)),s=Object.assign({},i);delete s.base,t._definition=s;const o=r._definition||{};s.messages=m.merge(o.messages,s.messages),s.properties=Object.assign({},o.properties,s.properties),c.type=s.type,s.flags=Object.assign({},o.flags,s.flags);const h=Object.assign({},o.terms);if(s.terms)for(const j in s.terms){const f=s.terms[j];l(c.$_terms[j]===void 0,"Invalid term override for",s.type,j),c.$_terms[j]=f.init,h[j]=f}s.terms=h,s.args||(s.args=o.args),s.prepare=e.prepare(s.prepare,o.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,o.coerce),s.validate=e.validate(s.validate,o.validate);const g=Object.assign({},o.rules);if(s.rules)for(const j in s.rules){const f=s.rules[j];l(typeof f=="object","Invalid rule definition for",s.type,j);let y=f.method;if(y===void 0&&(y=function(){return this.$_addRule(j)}),y&&(l(!t[j],"Rule conflict in",s.type,j),t[j]=y),l(!g[j],"Rule conflict in",s.type,j),g[j]=f,f.alias){const M=[].concat(f.alias);for(const E of M)t[E]=f.method}f.args&&(f.argsByName=new Map,f.args=f.args.map(M=>(typeof M=="string"&&(M={name:M}),l(!f.argsByName.has(M.name),"Duplicated argument name",M.name),b.isSchema(M.assert)&&(M.assert=M.assert.strict().label(M.name)),f.argsByName.set(M.name,M),M)))}s.rules=g;const w=Object.assign({},o.modifiers);if(s.modifiers)for(const j in s.modifiers){l(!t[j],"Rule conflict in",s.type,j);const f=s.modifiers[j];l(typeof f=="function","Invalid modifier definition for",s.type,j);const y=function(M){return this.rule({[j]:M})};t[j]=y,w[j]=f}if(s.modifiers=w,s.overrides){t._super=r,c.$_super={};for(const j in s.overrides)l(r[j],"Cannot override missing",j),s.overrides[j][b.symbols.parent]=r[j],c.$_super[j]=r[j].bind(c);Object.assign(t,s.overrides)}s.cast=Object.assign({},o.cast,s.cast);const R=Object.assign({},o.manifest,s.manifest);return R.build=e.build(s.manifest&&s.manifest.build,o.manifest&&o.manifest.build),s.manifest=R,s.rebuild=e.rebuild(s.rebuild,o.rebuild),c},e.build=function(a,i){return a&&i?function(r,t){return i(a(r,t),t)}:a||i},e.coerce=function(a,i){return a&&i?{from:a.from&&i.from?[...new Set([...a.from,...i.from])]:null,method(r,t){let c;if((!i.from||i.from.includes(typeof r))&&(c=i.method(r,t),c)){if(c.errors||c.value===void 0)return c;r=c.value}if(!a.from||a.from.includes(typeof r)){const s=a.method(r,t);if(s)return s}return c}}:a||i},e.prepare=function(a,i){return a&&i?function(r,t){const c=a(r,t);if(c){if(c.errors||c.value===void 0)return c;r=c.value}return i(r,t)||c}:a||i},e.rebuild=function(a,i){return a&&i?function(r){i(r),a(r)}:a||i},e.validate=function(a,i){return a&&i?function(r,t){const c=i(r,t);if(c){if(c.errors&&(!Array.isArray(c.errors)||c.errors.length))return c;r=c.value}return a(r,t)||c}:a||i}},5107:(L,p,_)=>{const l=_(375),x=_(8571),b=_(8652),m=_(8160),e=_(3292),a=_(6354),i=_(8901),r=_(9708),t=_(6133),c=_(3328),s=_(1152);let o;const h={types:{alternatives:_(4946),any:_(8068),array:_(546),boolean:_(4937),date:_(7500),function:_(390),link:_(8785),number:_(3832),object:_(8966),string:_(7417),symbol:_(8826)},aliases:{alt:"alternatives",bool:"boolean",func:"function"},root:function(){const g={_types:new Set(Object.keys(h.types))};for(const w of g._types)g[w]=function(...R){return l(!R.length||["alternatives","link","object"].includes(w),"The",w,"type does not allow arguments"),h.generate(this,h.types[w],R)};for(const w of["allow","custom","disallow","equal","exist","forbidden","invalid","not","only","optional","options","prefs","preferences","required","strip","valid","when"])g[w]=function(...R){return this.any()[w](...R)};Object.assign(g,h.methods);for(const w in h.aliases){const R=h.aliases[w];g[w]=g[R]}return g.x=g.expression,s.setup&&s.setup(g),g}};h.methods={ValidationError:a.ValidationError,version:m.version,cache:b.provider,assert(g,w,...R){h.assert(g,w,!0,R)},attempt:(g,w,...R)=>h.assert(g,w,!1,R),build(g){return l(typeof r.build=="function","Manifest functionality disabled"),r.build(this,g)},checkPreferences(g){m.checkPreferences(g)},compile(g,w){return e.compile(this,g,w)},defaults(g){l(typeof g=="function","modifier must be a function");const w=Object.assign({},this);for(const R of w._types){const j=g(w[R]());l(m.isSchema(j),"modifier must return a valid schema object"),w[R]=function(...f){return h.generate(this,j,f)}}return w},expression:(...g)=>new c(...g),extend(...g){m.verifyFlat(g,"extend"),o=o||_(3378),l(g.length,"You need to provide at least one extension"),this.assert(g,o.extensions);const w=Object.assign({},this);w._types=new Set(w._types);for(let R of g){typeof R=="function"&&(R=R(w)),this.assert(R,o.extension);const j=h.expandExtension(R,w);for(const f of j){l(w[f.type]===void 0||w._types.has(f.type),"Cannot override name",f.type);const y=f.base||this.any(),M=i.type(y,f);w._types.add(f.type),w[f.type]=function(...E){return h.generate(this,M,E)}}}return w},isError:a.ValidationError.isError,isExpression:c.isTemplate,isRef:t.isRef,isSchema:m.isSchema,in:(...g)=>t.in(...g),override:m.symbols.override,ref:(...g)=>t.create(...g),types(){const g={};for(const w of this._types)g[w]=this[w]();for(const w in h.aliases)g[w]=this[w]();return g}},h.assert=function(g,w,R,j){const f=j[0]instanceof Error||typeof j[0]=="string"?j[0]:null,y=f!==null?j[1]:j[0],M=w.validate(g,m.preferences({errors:{stack:!0}},y||{}));let E=M.error;if(!E)return M.value;if(f instanceof Error)throw f;const N=R&&typeof E.annotate=="function"?E.annotate():E.message;throw E instanceof a.ValidationError==0&&(E=x(E)),E.message=f?`${f} ${N}`:N,E},h.generate=function(g,w,R){return l(g,"Must be invoked on a Joi instance."),w.$_root=g,w._definition.args&&R.length?w._definition.args(w,...R):w},h.expandExtension=function(g,w){if(typeof g.type=="string")return[g];const R=[];for(const j of w._types)if(g.type.test(j)){const f=Object.assign({},g);f.type=j,f.base=w[j](),R.push(f)}return R},L.exports=h.root()},6914:(L,p,_)=>{const l=_(375),x=_(8571),b=_(3328);p.compile=function(m,e){if(typeof m=="string")return l(!e,"Cannot set single message string"),new b(m);if(b.isTemplate(m))return l(!e,"Cannot set single message template"),m;l(typeof m=="object"&&!Array.isArray(m),"Invalid message options"),e=e?x(e):{};for(let a in m){const i=m[a];if(a==="root"||b.isTemplate(i)){e[a]=i;continue}if(typeof i=="string"){e[a]=new b(i);continue}l(typeof i=="object"&&!Array.isArray(i),"Invalid message for",a);const r=a;for(a in e[r]=e[r]||{},i){const t=i[a];a==="root"||b.isTemplate(t)?e[r][a]=t:(l(typeof t=="string","Invalid message for",a,"in",r),e[r][a]=new b(t))}}return e},p.decompile=function(m){const e={};for(let a in m){const i=m[a];if(a==="root"){e.root=i;continue}if(b.isTemplate(i)){e[a]=i.describe({compact:!0});continue}const r=a;for(a in e[r]={},i){const t=i[a];a!=="root"?e[r][a]=t.describe({compact:!0}):e[r].root=t}}return e},p.merge=function(m,e){if(!m)return p.compile(e);if(!e)return m;if(typeof e=="string")return new b(e);if(b.isTemplate(e))return e;const a=x(m);for(let i in e){const r=e[i];if(i==="root"||b.isTemplate(r)){a[i]=r;continue}if(typeof r=="string"){a[i]=new b(r);continue}l(typeof r=="object"&&!Array.isArray(r),"Invalid message for",i);const t=i;for(i in a[t]=a[t]||{},r){const c=r[i];i==="root"||b.isTemplate(c)?a[t][i]=c:(l(typeof c=="string","Invalid message for",i,"in",t),a[t][i]=new b(c))}}return a}},2294:(L,p,_)=>{const l=_(375),x=_(8160),b=_(6133),m={};p.Ids=m.Ids=class{constructor(){this._byId=new Map,this._byKey=new Map,this._schemaChain=!1}clone(){const e=new m.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,i]of e._byId.entries())l(!this._byKey.has(a),"Schema id conflicts with existing key:",a),this._byId.set(a,i);for(const[a,i]of e._byKey.entries())l(!this._byId.has(a),"Schema key conflicts with existing id:",a),this._byKey.set(a,i)}fork(e,a,i){const r=this._collect(e);r.push({schema:i});const t=r.shift();let c={id:t.id,schema:a(t.schema)};l(x.isSchema(c.schema),"adjuster function failed to return a joi schema type");for(const s of r)c={id:s.id,schema:m.fork(s.schema,c.id,c.schema)};return c.schema}labels(e,a=[]){const i=e[0],r=this._get(i);if(!r)return[...a,...e].join(".");const t=e.slice(1);return a=[...a,r.schema._flags.label||i],t.length?r.schema._ids.labels(t,a):a.join(".")}reach(e,a=[]){const i=e[0],r=this._get(i);l(r,"Schema does not contain path",[...a,...e].join("."));const t=e.slice(1);return t.length?r.schema._ids.reach(t,[...a,i]):r.schema}register(e,{key:a}={}){if(!e||!x.isSchema(e))return;(e.$_property("schemaChain")||e._ids._schemaChain)&&(this._schemaChain=!0);const i=e._flags.id;if(i){const r=this._byId.get(i);l(!r||r.schema===e,"Cannot add different schemas with the same id:",i),l(!this._byKey.has(i),"Schema id conflicts with existing key:",i),this._byId.set(i,{schema:e,id:i})}a&&(l(!this._byKey.has(a),"Schema already contains key:",a),l(!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=[],i=[]){const r=e[0],t=this._get(r);l(t,"Schema does not contain path",[...a,...e].join(".")),i=[t,...i];const c=e.slice(1);return c.length?t.schema._ids._collect(c,[...a,r],i):i}_get(e){return this._byId.get(e)||this._byKey.get(e)}},m.fork=function(e,a,i){const r=p.schema(e,{each:(t,{key:c})=>{if(a===(t._flags.id||c))return i},ref:!1});return r?r.$_mutateRebuild():e},p.schema=function(e,a){let i;for(const r in e._flags){if(r[0]==="_")continue;const t=m.scan(e._flags[r],{source:"flags",name:r},a);t!==void 0&&(i=i||e.clone(),i._flags[r]=t)}for(let r=0;r<e._rules.length;++r){const t=e._rules[r],c=m.scan(t.args,{source:"rules",name:t.name},a);if(c!==void 0){i=i||e.clone();const s=Object.assign({},t);s.args=c,i._rules[r]=s,i._singleRules.get(t.name)===t&&i._singleRules.set(t.name,s)}}for(const r in e.$_terms){if(r[0]==="_")continue;const t=m.scan(e.$_terms[r],{source:"terms",name:r},a);t!==void 0&&(i=i||e.clone(),i.$_terms[r]=t)}return i},m.scan=function(e,a,i,r,t){const c=r||[];if(e===null||typeof e!="object")return;let s;if(Array.isArray(e)){for(let o=0;o<e.length;++o){const h=a.source==="terms"&&a.name==="keys"&&e[o].key,g=m.scan(e[o],a,i,[o,...c],h);g!==void 0&&(s=s||e.slice(),s[o]=g)}return s}if(i.schema!==!1&&x.isSchema(e)||i.ref!==!1&&b.isRef(e)){const o=i.each(e,{...a,path:c,key:t});return o===e?void 0:o}for(const o in e){if(o[0]==="_")continue;const h=m.scan(e[o],a,i,[o,...c],t);h!==void 0&&(s=s||Object.assign({},e),s[o]=h)}return s}},6133:(L,p,_)=>{const l=_(375),x=_(8571),b=_(9621),m=_(8160);let e;const a={symbol:Symbol("ref"),defaults:{adjust:null,in:!1,iterables:null,map:null,separator:".",type:"value"}};p.create=function(i,r={}){l(typeof i=="string","Invalid reference key:",i),m.assertOptions(r,["adjust","ancestor","in","iterables","map","prefix","render","separator"]),l(!r.prefix||typeof r.prefix=="object","options.prefix must be of type object");const t=Object.assign({},a.defaults,r);delete t.prefix;const c=t.separator,s=a.context(i,c,r.prefix);if(t.type=s.type,i=s.key,t.type==="value")if(s.root&&(l(!c||i[0]!==c,"Cannot specify relative path with root prefix"),t.ancestor="root",i||(i=null)),c&&c===i)i=null,t.ancestor=0;else if(t.ancestor!==void 0)l(!c||!i||i[0]!==c,"Cannot combine prefix with ancestor option");else{const[o,h]=a.ancestor(i,c);h&&(i=i.slice(h))===""&&(i=null),t.ancestor=o}return t.path=c?i===null?[]:i.split(c):[i],new a.Ref(t)},p.in=function(i,r={}){return p.create(i,{...r,in:!0})},p.isRef=function(i){return!!i&&!!i[m.symbols.ref]},a.Ref=class{constructor(i){l(typeof i=="object","Invalid reference construction"),m.assertOptions(i,["adjust","ancestor","in","iterables","map","path","render","separator","type","depth","key","root","display"]),l([!1,void 0].includes(i.separator)||typeof i.separator=="string"&&i.separator.length===1,"Invalid separator"),l(!i.adjust||typeof i.adjust=="function","options.adjust must be a function"),l(!i.map||Array.isArray(i.map),"options.map must be an array"),l(!i.map||!i.adjust,"Cannot set both map and adjust options"),Object.assign(this,a.defaults,i),l(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(i,r,t,c,s={}){return l(!this.in||s.in,"Invalid in() reference usage"),this.type==="global"?this._resolve(t.context,r,s):this.type==="local"?this._resolve(c,r,s):this.ancestor?this.ancestor==="root"?this._resolve(r.ancestors[r.ancestors.length-1],r,s):(l(this.ancestor<=r.ancestors.length,"Invalid reference exceeds the schema root:",this.display),this._resolve(r.ancestors[this.ancestor-1],r,s)):this._resolve(i,r,s)}_resolve(i,r,t){let c;if(this.type==="value"&&r.mainstay.shadow&&t.shadow!==!1&&(c=r.mainstay.shadow.get(this.absolute(r))),c===void 0&&(c=b(i,this.path,{iterables:this.iterables,functions:!0})),this.adjust&&(c=this.adjust(c)),this.map){const s=this.map.get(c);s!==void 0&&(c=s)}return r.mainstay&&r.mainstay.tracer.resolve(r,this,c),c}toString(){return this.display}absolute(i){return[...i.path.slice(0,-this.ancestor),...this.path]}clone(){return new a.Ref(this)}describe(){const i={path:this.path};this.type!=="value"&&(i.type=this.type),this.separator!=="."&&(i.separator=this.separator),this.type==="value"&&this.ancestor!==1&&(i.ancestor=this.ancestor),this.map&&(i.map=[...this.map]);for(const r of["adjust","iterables","render"])this[r]!==null&&this[r]!==void 0&&(i[r]=this[r]);return this.in!==!1&&(i.in=!0),{ref:i}}updateDisplay(){const i=this.key!==null?this.key:"";if(this.type!=="value")return void(this.display=`ref:${this.type}:${i}`);if(!this.separator)return void(this.display=`ref:${i}`);if(!this.ancestor)return void(this.display=`ref:${this.separator}${i}`);if(this.ancestor==="root")return void(this.display=`ref:root:${i}`);if(this.ancestor===1)return void(this.display=`ref:${i||".."}`);const r=new Array(this.ancestor+1).fill(this.separator).join("");this.display=`ref:${r}${i||""}`}},a.Ref.prototype[m.symbols.ref]=!0,p.build=function(i){return(i=Object.assign({},a.defaults,i)).type==="value"&&i.ancestor===void 0&&(i.ancestor=1),new a.Ref(i)},a.context=function(i,r,t={}){if(i=i.trim(),t){const c=t.global===void 0?"$":t.global;if(c!==r&&i.startsWith(c))return{key:i.slice(c.length),type:"global"};const s=t.local===void 0?"#":t.local;if(s!==r&&i.startsWith(s))return{key:i.slice(s.length),type:"local"};const o=t.root===void 0?"/":t.root;if(o!==r&&i.startsWith(o))return{key:i.slice(o.length),type:"value",root:!0}}return{key:i,type:"value"}},a.ancestor=function(i,r){if(!r)return[1,0];if(i[0]!==r)return[1,0];if(i[1]!==r)return[0,1];let t=2;for(;i[t]===r;)++t;return[t-1,t]},p.toSibling=0,p.toParent=1,p.Manager=class{constructor(){this.refs=[]}register(i,r){if(i)if(r=r===void 0?p.toParent:r,Array.isArray(i))for(const t of i)this.register(t,r);else if(m.isSchema(i))for(const t of i._refs.refs)t.ancestor-r>=0&&this.refs.push({ancestor:t.ancestor-r,root:t.root});else p.isRef(i)&&i.type==="value"&&i.ancestor-r>=0&&this.refs.push({ancestor:i.ancestor-r,root:i.root}),e=e||_(3328),e.isTemplate(i)&&this.register(i.refs(),r)}get length(){return this.refs.length}clone(){const i=new p.Manager;return i.refs=x(this.refs),i}reset(){this.refs=[]}roots(){return this.refs.filter(i=>!i.ancestor).map(i=>i.root)}}},3378:(L,p,_)=>{const l=_(5107),x={};x.wrap=l.string().min(1).max(2).allow(!1),p.preferences=l.object({allowUnknown:l.boolean(),abortEarly:l.boolean(),artifacts:l.boolean(),cache:l.boolean(),context:l.object(),convert:l.boolean(),dateFormat:l.valid("date","iso","string","time","utc"),debug:l.boolean(),errors:{escapeHtml:l.boolean(),label:l.valid("path","key",!1),language:[l.string(),l.object().ref()],render:l.boolean(),stack:l.boolean(),wrap:{label:x.wrap,array:x.wrap,string:x.wrap}},externals:l.boolean(),messages:l.object(),noDefaults:l.boolean(),nonEnumerables:l.boolean(),presence:l.valid("required","optional","forbidden"),skipFunctions:l.boolean(),stripUnknown:l.object({arrays:l.boolean(),objects:l.boolean()}).or("arrays","objects").allow(!0,!1),warnings:l.boolean()}).strict(),x.nameRx=/^[a-zA-Z0-9]\w*$/,x.rule=l.object({alias:l.array().items(l.string().pattern(x.nameRx)).single(),args:l.array().items(l.string(),l.object({name:l.string().pattern(x.nameRx).required(),ref:l.boolean(),assert:l.alternatives([l.function(),l.object().schema()]).conditional("ref",{is:!0,then:l.required()}),normalize:l.function(),message:l.string().when("assert",{is:l.function(),then:l.required()})})),convert:l.boolean(),manifest:l.boolean(),method:l.function().allow(!1),multi:l.boolean(),validate:l.function()}),p.extension=l.object({type:l.alternatives([l.string(),l.object().regex()]).required(),args:l.function(),cast:l.object().pattern(x.nameRx,l.object({from:l.function().maxArity(1).required(),to:l.function().minArity(1).maxArity(2).required()})),base:l.object().schema().when("type",{is:l.object().regex(),then:l.forbidden()}),coerce:[l.function().maxArity(3),l.object({method:l.function().maxArity(3).required(),from:l.array().items(l.string()).single()})],flags:l.object().pattern(x.nameRx,l.object({setter:l.string(),default:l.any()})),manifest:{build:l.function().arity(2)},messages:[l.object(),l.string()],modifiers:l.object().pattern(x.nameRx,l.function().minArity(1).maxArity(2)),overrides:l.object().pattern(x.nameRx,l.function()),prepare:l.function().maxArity(3),rebuild:l.function().arity(1),rules:l.object().pattern(x.nameRx,x.rule),terms:l.object().pattern(x.nameRx,l.object({init:l.array().allow(null).required(),manifest:l.object().pattern(/.+/,[l.valid("schema","single"),l.object({mapped:l.object({from:l.string().required(),to:l.string().required()}).required()})])})),validate:l.function().maxArity(3)}).strict(),p.extensions=l.array().items(l.object(),l.function().arity(1)).strict(),x.desc={buffer:l.object({buffer:l.string()}),func:l.object({function:l.function().required(),options:{literal:!0}}),override:l.object({override:!0}),ref:l.object({ref:l.object({type:l.valid("value","global","local"),path:l.array().required(),separator:l.string().length(1).allow(!1),ancestor:l.number().min(0).integer().allow("root"),map:l.array().items(l.array().length(2)).min(1),adjust:l.function(),iterables:l.boolean(),in:l.boolean(),render:l.boolean()}).required()}),regex:l.object({regex:l.string().min(3)}),special:l.object({special:l.valid("deep").required()}),template:l.object({template:l.string().required(),options:l.object()}),value:l.object({value:l.alternatives([l.object(),l.array()]).required()})},x.desc.entity=l.alternatives([l.array().items(l.link("...")),l.boolean(),l.function(),l.number(),l.string(),x.desc.buffer,x.desc.func,x.desc.ref,x.desc.regex,x.desc.special,x.desc.template,x.desc.value,l.link("/")]),x.desc.values=l.array().items(null,l.boolean(),l.function(),l.number().allow(1/0,-1/0),l.string().allow(""),l.symbol(),x.desc.buffer,x.desc.func,x.desc.override,x.desc.ref,x.desc.regex,x.desc.template,x.desc.value),x.desc.messages=l.object().pattern(/.+/,[l.string(),x.desc.template,l.object().pattern(/.+/,[l.string(),x.desc.template])]),p.description=l.object({type:l.string().required(),flags:l.object({cast:l.string(),default:l.any(),description:l.string(),empty:l.link("/"),failover:x.desc.entity,id:l.string(),label:l.string(),only:!0,presence:["optional","required","forbidden"],result:["raw","strip"],strip:l.boolean(),unit:l.string()}).unknown(),preferences:{allowUnknown:l.boolean(),abortEarly:l.boolean(),artifacts:l.boolean(),cache:l.boolean(),convert:l.boolean(),dateFormat:["date","iso","string","time","utc"],errors:{escapeHtml:l.boolean(),label:["path","key"],language:[l.string(),x.desc.ref],wrap:{label:x.wrap,array:x.wrap}},externals:l.boolean(),messages:x.desc.messages,noDefaults:l.boolean(),nonEnumerables:l.boolean(),presence:["required","optional","forbidden"],skipFunctions:l.boolean(),stripUnknown:l.object({arrays:l.boolean(),objects:l.boolean()}).or("arrays","objects").allow(!0,!1),warnings:l.boolean()},allow:x.desc.values,invalid:x.desc.values,rules:l.array().min(1).items({name:l.string().required(),args:l.object().min(1),keep:l.boolean(),message:[l.string(),x.desc.messages],warn:l.boolean()}),keys:l.object().pattern(/.*/,l.link("/")),link:x.desc.ref}).pattern(/^[a-z]\w*$/,l.any())},493:(L,p,_)=>{const l=_(8571),x=_(9621),b=_(8160),m={value:Symbol("value")};L.exports=m.State=class{constructor(e,a,i){this.path=e,this.ancestors=a,this.mainstay=i.mainstay,this.schemas=i.schemas,this.debug=null}localize(e,a=null,i=null){const r=new m.State(e,a,this);return i&&r.schemas&&(r.schemas=[m.schemas(i),...r.schemas]),r}nest(e,a){const i=new m.State(this.path,this.ancestors,this);return i.schemas=i.schemas&&[m.schemas(e),...i.schemas],i.debug=a,i}shadow(e,a){this.mainstay.shadow=this.mainstay.shadow||new m.Shadow,this.mainstay.shadow.set(this.path,e,a)}snapshot(){this.mainstay.shadow&&(this._snapshot=l(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()}},m.schemas=function(e){return b.isSchema(e)?{schema:e}:e},m.Shadow=class{constructor(){this._values=null}set(e,a,i){if(!e.length||i==="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 c=e[t];let s=r.get(c);s||(s=new Map,r.set(c,s)),r=s}r[m.value]=a}get(e){const a=this.node(e);if(a)return a[m.value]}node(e){if(this._values)return x(this._values,e,{iterables:!0})}override(e,a){if(!this._values)return;const i=e.slice(0,-1),r=e[e.length-1],t=x(this._values,i,{iterables:!0});a?t.set(r,a):t&&t.delete(r)}}},3328:(L,p,_)=>{const l=_(375),x=_(8571),b=_(5277),m=_(1447),e=_(8160),a=_(6354),i=_(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}};L.exports=r.Template=class{constructor(t,c){if(l(typeof t=="string","Template source must be a string"),l(!t.includes("\0")&&!t.includes(""),"Template source cannot contain reserved control characters"),this.source=t,this.rendered=t,this._template=null,c){const{functions:s,...o}=c;this._settings=Object.keys(o).length?x(o):void 0,this._functions=s,this._functions&&(l(Object.keys(this._functions).every(h=>typeof h=="string"),"Functions keys must be strings"),l(Object.values(this._functions).every(h=>typeof h=="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),c=r.split(t);let s=!1;const o=[],h=c.shift();h&&o.push(h);for(const g of c){const w=g[0]!=="{",R=w?"}":"}}",j=g.indexOf(R);if(j===-1||g[1]==="{"){o.push(`{${r.decode(g)}`);continue}let f=g.slice(w?0:1,j);const y=f[0]===":";y&&(f=f.slice(1));const M=this._ref(r.decode(f),{raw:w,wrapped:y});o.push(M),typeof M!="string"&&(s=!0);const E=g.slice(j+R.length);E&&o.push(r.decode(E))}s?this._template=o:this.rendered=o.join("")}static date(t,c){return r.dateFormat[c.dateFormat].call(t)}describe(t={}){if(!this._settings&&t.compact)return this.source;const c={template:this.source};return this._settings&&(c.options=this._settings),this._functions&&(c.functions=this._functions),c}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 c of this._template)typeof c!="string"&&t.push(...c.refs);return t}resolve(t,c,s,o){return this._template&&this._template.length===1?this._part(this._template[0],t,c,s,o,{}):this.render(t,c,s,o)}_part(t,...c){return t.ref?t.ref.resolve(...c):t.formula.evaluate(c)}render(t,c,s,o,h={}){if(!this.isDynamic())return this.rendered;const g=[];for(const w of this._template)if(typeof w=="string")g.push(w);else{const R=this._part(w,t,c,s,o,h),j=r.stringify(R,t,c,s,o,h);if(j!==void 0){const f=w.raw||(h.errors&&h.errors.escapeHtml)===!1?j:b(j);g.push(r.wrap(f,w.wrapped&&s.errors.wrap.label))}}return g.join("")}_ref(t,{raw:c,wrapped:s}){const o=[],h=w=>{const R=i.create(w,this._settings);return o.push(R),j=>{const f=R.resolve(...j);return f!==void 0?f:null}};try{const w=this._functions?{...r.functions,...this._functions}:r.functions;var g=new m.Parser(t,{reference:h,functions:w,constants:r.constants})}catch(w){throw w.message=`Invalid template variable "${t}" fails due to: ${w.message}`,w}if(g.single){if(g.single.type==="reference"){const w=o[0];return{ref:w,raw:c,refs:o,wrapped:s||w.type==="local"&&w.key==="label"}}return r.stringify(g.single.value)}return{formula:g,raw:c,refs:o}}toString(){return this.source}},r.Template.prototype[e.symbols.template]=!0,r.Template.prototype.isImmutable=!0,r.encode=function(t){return t.replace(/\\(\{+)/g,(c,s)=>r.opens.slice(0,s.length)).replace(/\\(\}+)/g,(c,s)=>r.closes.slice(0,s.length))},r.decode=function(t){return t.replace(/\u0000/g,"{").replace(/\u0001/g,"}")},r.split=function(t){const c=[];let s="";for(let o=0;o<t.length;++o){const h=t[o];if(h==="{"){let g="";for(;o+1<t.length&&t[o+1]==="{";)g+="{",++o;c.push(s),s=g}else s+=h}return c.push(s),c},r.wrap=function(t,c){return c?c.length===1?`${c}${t}${c}`:`${c[0]}${t}${c[1]}`:t},r.stringify=function(t,c,s,o,h,g={}){const w=typeof t,R=o&&o.errors&&o.errors.wrap||{};let j=!1;if(i.isRef(t)&&t.render&&(j=t.in,t=t.resolve(c,s,o,h,{in:t.in,...g})),t===null)return"null";if(w==="string")return r.wrap(t,g.arrayItems&&R.string);if(w==="number"||w==="function"||w==="symbol")return t.toString();if(w!=="object")return JSON.stringify(t);if(t instanceof Date)return r.Template.date(t,o);if(t instanceof Map){const y=[];for(const[M,E]of t.entries())y.push(`${M.toString()} -> ${E.toString()}`);t=y}if(!Array.isArray(t))return t.toString();const f=[];for(const y of t)f.push(r.stringify(y,c,s,o,h,{arrayItems:!0,...g}));return r.wrap(f.join(", "),!j&&R.array)},r.constants={true:!0,false:!1,null:null,second:1e3,minute:6e4,hour:36e5,day:864e5},r.functions={if:(t,c,s)=>t?c: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[c,s,o,h,g]=this,w=g.messages;if(!w)return"";const R=a.template(c,w[0],t,s,o)||a.template(c,w[1],t,s,o);return R?R.render(c,s,o,h,g):""},number:t=>typeof t=="number"?t:typeof t=="string"?parseFloat(t):typeof t=="boolean"?t?1:0:t instanceof Date?t.getTime():null}},4946:(L,p,_)=>{const l=_(375),x=_(1687),b=_(8068),m=_(8160),e=_(3292),a=_(6354),i=_(6133),r={};L.exports=b.extend({type:"alternatives",flags:{match:{default:"any"}},terms:{matches:{init:[],register:i.toSibling}},args:(t,...c)=>c.length===1&&Array.isArray(c[0])?t.try(...c[0]):t.try(...c),validate(t,c){const{schema:s,error:o,state:h,prefs:g}=c;if(s._flags.match){const R=[],j=[];for(let y=0;y<s.$_terms.matches.length;++y){const M=s.$_terms.matches[y],E=h.nest(M.schema,`match.${y}`);E.snapshot();const N=M.schema.$_validate(t,E,g);N.errors?(j.push(N.errors),E.restore()):(R.push(N.value),E.commit())}if(R.length===0)return{errors:o("alternatives.any",{details:j.map(y=>a.details(y,{override:!1}))})};if(s._flags.match==="one")return R.length===1?{value:R[0]}:{errors:o("alternatives.one")};if(R.length!==s.$_terms.matches.length)return{errors:o("alternatives.all",{details:j.map(y=>a.details(y,{override:!1}))})};const f=y=>y.$_terms.matches.some(M=>M.schema.type==="object"||M.schema.type==="alternatives"&&f(M.schema));return f(s)?{value:R.reduce((y,M)=>x(y,M,{mergeArrays:!1}))}:{value:R[R.length-1]}}const w=[];for(let R=0;R<s.$_terms.matches.length;++R){const j=s.$_terms.matches[R];if(j.schema){const M=h.nest(j.schema,`match.${R}`);M.snapshot();const E=j.schema.$_validate(t,M,g);if(!E.errors)return M.commit(),E;M.restore(),w.push({schema:j.schema,reports:E.errors});continue}const f=j.ref?j.ref.resolve(t,h,g):t,y=j.is?[j]:j.switch;for(let M=0;M<y.length;++M){const E=y[M],{is:N,then:$,otherwise:n}=E,d=`match.${R}${j.switch?"."+M:""}`;if(N.$_match(f,h.nest(N,`${d}.is`),g)){if($)return $.$_validate(t,h.nest($,`${d}.then`),g)}else if(n)return n.$_validate(t,h.nest(n,`${d}.otherwise`),g)}}return r.errors(w,c)},rules:{conditional:{method(t,c){l(!this._flags._endedSwitch,"Unreachable condition"),l(!this._flags.match,"Cannot combine match mode",this._flags.match,"with conditional rule"),l(c.break===void 0,"Cannot use break option with alternatives conditional");const s=this.clone(),o=e.when(s,t,c),h=o.is?[o]:o.switch;for(const g of h)if(g.then&&g.otherwise){s.$_setFlag("_endedSwitch",!0,{clone:!1});break}return s.$_terms.matches.push(o),s.$_mutateRebuild()}},match:{method(t){if(l(["any","one","all"].includes(t),"Invalid alternatives match mode",t),t!=="any")for(const c of this.$_terms.matches)l(c.schema,"Cannot combine match mode",t,"with conditional rules");return this.$_setFlag("match",t)}},try:{method(...t){l(t.length,"Missing alternative schemas"),m.verifyFlat(t,"try"),l(!this._flags._endedSwitch,"Unreachable condition");const c=this.clone();for(const s of t)c.$_terms.matches.push({schema:c.$_compile(s)});return c.$_mutateRebuild()}}},overrides:{label(t){return this.$_parent("label",t).$_modify({each:(c,s)=>s.path[0]!=="is"&&typeof c._flags.label!="string"?c.label(t):void 0,ref:!1})}},rebuild(t){t.$_modify({each:c=>{m.isSchema(c)&&c.type==="array"&&t.$_setFlag("_arrayItems",!0,{clone:!1})}})},manifest:{build(t,c){if(c.matches)for(const s of c.matches){const{schema:o,ref:h,is:g,not:w,then:R,otherwise:j}=s;t=o?t.try(o):h?t.conditional(h,{is:g,then:R,not:w,otherwise:j,switch:s.switch}):t.conditional(g,{then:R,otherwise:j})}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:c,state:s}){if(!t.length)return{errors:c("alternatives.any")};if(t.length===1)return{errors:t[0].reports};const o=new Set,h=[];for(const{reports:g,schema:w}of t){if(g.length>1)return r.unmatched(t,c);const R=g[0];if(R instanceof a.Report==0)return r.unmatched(t,c);if(R.state.path.length!==s.path.length){h.push({type:w.type,report:R});continue}if(R.code==="any.only"){for(const y of R.local.valids)o.add(y);continue}const[j,f]=R.code.split(".");f!=="base"?h.push({type:w.type,report:R}):R.code==="object.base"?o.add(R.local.type):o.add(j)}return h.length?h.length===1?{errors:h[0].report}:r.unmatched(t,c):{errors:c("alternatives.types",{types:[...o]})}},r.unmatched=function(t,c){const s=[];for(const o of t)s.push(...o.reports);return{errors:c("alternatives.match",a.details(s,{override:!1}))}}},8068:(L,p,_)=>{const l=_(375),x=_(7629),b=_(8160),m=_(6914);L.exports=x.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 l(typeof e=="function","Method must be a function"),l(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:i}){try{return i(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){l(b.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 l(e&&typeof e=="string","Invalid warning code"),this.$_addRule({name:"warning",args:{code:e,local:a},warn:!0})},validate:(e,a,{code:i,local:r})=>a.error(i,r),args:["code","local"],multi:!0}},modifiers:{keep(e,a=!0){e.keep=a},message(e,a){e.message=m.compile(a)},warn(e,a=!0){e.warn=a}},manifest:{build(e,a){for(const i in a){const r=a[i];if(["examples","externals","metas","notes","tags"].includes(i))for(const t of r)e=e[i.slice(0,-1)](t);else if(i!=="alterations")if(i!=="whens"){if(i==="shared")for(const t of r)e=e.shared(t)}else for(const t of r){const{ref:c,is:s,not:o,then:h,otherwise:g,concat:w}=t;e=w?e.concat(w):c?e.when(c,{is:s,not:o,then:h,otherwise:g,switch:t.switch,break:t.break}):e.when(s,{then:h,otherwise:g,break:t.break})}else{const t={};for(const{target:c,adjuster:s}of r)t[c]=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:(L,p,_)=>{const l=_(375),x=_(9474),b=_(9621),m=_(8068),e=_(8160),a=_(3292),i={};L.exports=m.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:c,prefs:s}){if(!Array.isArray(r))return;const o=t.$_getRule("sort");return o?i.sort(t,r,o.args.options,c,s):void 0}},validate(r,{schema:t,error:c}){if(!Array.isArray(r)){if(t._flags.single){const s=[r];return s[e.symbols.arraySingle]=!0,{value:s}}return{errors:c("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:c,error:s},{schema:o}){const h=[r,...t.ancestors];for(let w=0;w<r.length;++w){const R=t.localize([...t.path,w],h,o);if(o.$_match(r[w],R,c))return r}const g=o._flags.label;return g?s("array.hasKnown",{patternLabel:g}):s("array.hasUnknown",null)},multi:!0},items:{method(...r){e.verifyFlat(r,"items");const t=this.$_addRule("items");for(let c=0;c<r.length;++c){const s=e.tryWithPath(()=>this.$_compile(r[c]),c,{append:!0});t.$_terms.items.push(s)}return t.$_mutateRebuild()},validate(r,{schema:t,error:c,state:s,prefs:o,errorsArray:h}){const g=t.$_terms._requireds.slice(),w=t.$_terms.ordered.slice(),R=[...t.$_terms._inclusions,...g],j=!r[e.symbols.arraySingle];delete r[e.symbols.arraySingle];const f=h();let y=r.length;for(let M=0;M<y;++M){const E=r[M];let N=!1,$=!1;const n=j?M:new Number(M),d=[...s.path,n];if(!t._flags.sparse&&E===void 0){if(f.push(c("array.sparse",{key:n,path:d,pos:M,value:void 0},s.localize(d))),o.abortEarly)return f;w.shift();continue}const v=[r,...s.ancestors];for(const C of t.$_terms._exclusions)if(C.$_match(E,s.localize(d,v,C),o,{presence:"ignore"})){if(f.push(c("array.excludes",{pos:M,value:E},s.localize(d))),o.abortEarly)return f;N=!0,w.shift();break}if(N)continue;if(t.$_terms.ordered.length){if(w.length){const C=w.shift(),S=C.$_validate(E,s.localize(d,v,C),o);if(S.errors){if(f.push(...S.errors),o.abortEarly)return f}else if(C._flags.result==="strip")i.fastSplice(r,M),--M,--y;else{if(!t._flags.sparse&&S.value===void 0){if(f.push(c("array.sparse",{key:n,path:d,pos:M,value:void 0},s.localize(d))),o.abortEarly)return f;continue}r[M]=S.value}continue}if(!t.$_terms.items.length){if(f.push(c("array.orderedLength",{pos:M,limit:t.$_terms.ordered.length})),o.abortEarly)return f;break}}const k=[];let A=g.length;for(let C=0;C<A;++C){const S=s.localize(d,v,g[C]);S.snapshot();const u=g[C].$_validate(E,S,o);if(k[C]=u,!u.errors){if(S.commit(),r[M]=u.value,$=!0,i.fastSplice(g,C),--C,--A,!t._flags.sparse&&u.value===void 0&&(f.push(c("array.sparse",{key:n,path:d,pos:M,value:void 0},s.localize(d))),o.abortEarly))return f;break}S.restore()}if($)continue;const D=o.stripUnknown&&!!o.stripUnknown.arrays||!1;A=R.length;for(const C of R){let S;const u=g.indexOf(C);if(u!==-1)S=k[u];else{const O=s.localize(d,v,C);if(O.snapshot(),S=C.$_validate(E,O,o),!S.errors){O.commit(),C._flags.result==="strip"?(i.fastSplice(r,M),--M,--y):t._flags.sparse||S.value!==void 0?r[M]=S.value:(f.push(c("array.sparse",{key:n,path:d,pos:M,value:void 0},s.localize(d))),N=!0),$=!0;break}O.restore()}if(A===1){if(D){i.fastSplice(r,M),--M,--y,$=!0;break}if(f.push(...S.errors),o.abortEarly)return f;N=!0;break}}if(!N&&(t.$_terms._inclusions.length||t.$_terms._requireds.length)&&!$){if(D){i.fastSplice(r,M),--M,--y;continue}if(f.push(c("array.includes",{pos:M,value:E},s.localize(d))),o.abortEarly)return f}}return g.length&&i.fillMissedErrors(t,f,g,r,s,o),w.length&&(i.fillOrderedErrors(t,f,w,r,s,o),f.length||i.fillDefault(w,r,s,o)),f.length?f:r},priority:!0,manifest:!1},length:{method(r){return this.$_addRule({name:"length",args:{limit:r},operator:"="})},validate:(r,t,{limit:c},{name:s,operator:o,args:h})=>e.compare(r.length,c,o)?r:t.error("array."+s,{limit:h.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 c=0;c<r.length;++c){const s=e.tryWithPath(()=>this.$_compile(r[c]),c,{append:!0});i.validateSingle(s,t),t.$_mutateRegister(s),t.$_terms.ordered.push(s)}return t.$_mutateRebuild()}},single:{method(r){const t=r===void 0||!!r;return l(!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}),l(!t.by.ancestor,"Cannot sort by ancestor")),this.$_addRule({name:"sort",args:{options:t}})},validate(r,{error:t,state:c,prefs:s,schema:o},{options:h}){const{value:g,errors:w}=i.sort(o,r,h,c,s);if(w)return w;for(let R=0;R<r.length;++R)if(r[R]!==g[R])return t("array.sort",{order:h.order,by:h.by?h.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={}){l(!r||typeof r=="function"||typeof r=="string","comparator must be a function or a string"),e.assertOptions(t,["ignoreUndefined","separator"]);const c={name:"unique",args:{options:t,comparator:r}};if(r)if(typeof r=="string"){const s=e.default(t.separator,".");c.path=s?r.split(s):[r]}else c.comparator=r;return this.$_addRule(c)},validate(r,{state:t,error:c,schema:s},{comparator:o,options:h},{comparator:g,path:w}){const R={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},j=g||x,f=h.ignoreUndefined;for(let y=0;y<r.length;++y){const M=w?b(r[y],w):r[y],E=g?R.custom:R[typeof M];if(l(E,"Failed to find unique map container for type",typeof M),E instanceof Map){const N=E.entries();let $;for(;!($=N.next()).done;)if(j($.value[0],M)){const n=t.localize([...t.path,y],[r,...t.ancestors]),d={pos:y,value:r[y],dupePos:$.value[1],dupeValue:r[$.value[1]]};return w&&(d.path=o),c("array.unique",d,n)}E.set(M,y)}else{if((!f||M!==void 0)&&E[M]!==void 0){const N={pos:y,value:r[y],dupePos:E[M],dupeValue:r[E[M]]};return w&&(N.path=o),c("array.unique",N,t.localize([...t.path,y],[r,...t.ancestors]))}E[M]=y}}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)i.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)i.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"}}),i.fillMissedErrors=function(r,t,c,s,o,h){const g=[];let w=0;for(const R of c){const j=R._flags.label;j?g.push(j):++w}g.length?w?t.push(r.$_createError("array.includesRequiredBoth",s,{knownMisses:g,unknownMisses:w},o,h)):t.push(r.$_createError("array.includesRequiredKnowns",s,{knownMisses:g},o,h)):t.push(r.$_createError("array.includesRequiredUnknowns",s,{unknownMisses:w},o,h))},i.fillOrderedErrors=function(r,t,c,s,o,h){const g=[];for(const w of c)w._flags.presence==="required"&&g.push(w);g.length&&i.fillMissedErrors(r,t,g,s,o,h)},i.fillDefault=function(r,t,c,s){const o=[];let h=!0;for(let g=r.length-1;g>=0;--g){const w=r[g],R=[t,...c.ancestors],j=w.$_validate(void 0,c.localize(c.path,R,w),s).value;if(h){if(j===void 0)continue;h=!1}o.unshift(j)}o.length&&t.push(...o)},i.fastSplice=function(r,t){let c=t;for(;c<r.length;)r[c++]=r[c];--r.length},i.validateSingle=function(r,t){(r.type==="array"||r._flags._arrayItems)&&(l(!t._flags.single,"Cannot specify array item with single rule enabled"),t.$_setFlag("_arrayItems",!0,{clone:!1}))},i.sort=function(r,t,c,s,o){const h=c.order==="ascending"?1:-1,g=-1*h,w=h,R=(j,f)=>{let y=i.compare(j,f,g,w);if(y!==null||(c.by&&(j=c.by.resolve(j,s,o),f=c.by.resolve(f,s,o)),y=i.compare(j,f,g,w),y!==null))return y;const M=typeof j;if(M!==typeof f)throw r.$_createError("array.sort.mismatching",t,null,s,o);if(M!=="number"&&M!=="string")throw r.$_createError("array.sort.unsupported",t,{type:M},s,o);return M==="number"?(j-f)*h:j<f?g:w};try{return{value:t.slice().sort(R)}}catch(j){return{errors:j}}},i.compare=function(r,t,c,s){return r===t?0:r===void 0?1:t===void 0?-1:r===null?s:t===null?c:null}},4937:(L,p,_)=>{const l=_(375),x=_(8068),b=_(8160),m=_(2036),e={isBool:function(a){return typeof a=="boolean"}};L.exports=x.extend({type:"boolean",flags:{sensitive:{default:!1}},terms:{falsy:{init:null,manifest:"values"},truthy:{init:null,manifest:"values"}},coerce(a,{schema:i}){if(typeof a!="boolean"){if(typeof a=="string"){const r=i._flags.sensitive?a:a.toLowerCase();a=r==="true"||r!=="false"&&a}return typeof a!="boolean"&&(a=i.$_terms.truthy&&i.$_terms.truthy.has(a,null,null,!i._flags.sensitive)||(!i.$_terms.falsy||!i.$_terms.falsy.has(a,null,null,!i._flags.sensitive))&&a),{value:a}}},validate(a,{error:i}){if(typeof a!="boolean")return{value:a,errors:i("boolean.base")}},rules:{truthy:{method(...a){b.verifyFlat(a,"truthy");const i=this.clone();i.$_terms.truthy=i.$_terms.truthy||new m;for(let r=0;r<a.length;++r){const t=a[r];l(t!==void 0,"Cannot call truthy with undefined"),i.$_terms.truthy.add(t)}return i}},falsy:{method(...a){b.verifyFlat(a,"falsy");const i=this.clone();i.$_terms.falsy=i.$_terms.falsy||new m;for(let r=0;r<a.length;++r){const t=a[r];l(t!==void 0,"Cannot call falsy with undefined"),i.$_terms.falsy.add(t)}return i}},sensitive:{method(a=!0){return this.$_setFlag("sensitive",a)}}},cast:{number:{from:e.isBool,to:(a,i)=>a?1:0},string:{from:e.isBool,to:(a,i)=>a?"true":"false"}},manifest:{build:(a,i)=>(i.truthy&&(a=a.truthy(...i.truthy)),i.falsy&&(a=a.falsy(...i.falsy)),a)},messages:{"boolean.base":"{{#label}} must be a boolean"}})},7500:(L,p,_)=>{const l=_(375),x=_(8068),b=_(8160),m=_(3328),e={isDate:function(a){return a instanceof Date}};L.exports=x.extend({type:"date",coerce:{from:["number","string"],method:(a,{schema:i})=>({value:e.parse(a,i._flags.format)||a})},validate(a,{schema:i,error:r,prefs:t}){if(a instanceof Date&&!isNaN(a.getTime()))return;const c=i._flags.format;return t.convert&&c&&typeof a=="string"?{value:a,errors:r("date.format",{format:c})}:{value:a,errors:r("date.base")}},rules:{compare:{method:!1,validate(a,i,{date:r},{name:t,operator:c,args:s}){const o=r==="now"?Date.now():r.getTime();return b.compare(a.getTime(),o,c)?a:i.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 l(["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 l(["javascript","unix"].includes(a),'"type" must be one of "javascript, unix"'),this.format(a)}}},cast:{number:{from:e.isDate,to:(a,i)=>a.getTime()},string:{from:e.isDate,to:(a,{prefs:i})=>m.date(a,i)}},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,i){if(a instanceof Date)return a;if(typeof a!="string"&&(isNaN(a)||!isFinite(a))||/^\s*$/.test(a))return null;if(i==="iso")return b.isIsoDate(a)?e.date(a.toString()):null;const r=a;if(typeof a=="string"&&/^[+-]?\d+(\.\d+)?$/.test(a)&&(a=parseFloat(a)),i){if(i==="javascript")return e.date(1*a);if(i==="unix")return e.date(1e3*a);if(typeof r=="string")return null}return e.date(a)},e.date=function(a){const i=new Date(a);return isNaN(i.getTime())?null:i}},390:(L,p,_)=>{const l=_(375),x=_(7824);L.exports=x.extend({type:"function",properties:{typeof:"function"},rules:{arity:{method(b){return l(Number.isSafeInteger(b)&&b>=0,"n must be a positive integer"),this.$_addRule({name:"arity",args:{n:b}})},validate:(b,m,{n:e})=>b.length===e?b:m.error("function.arity",{n:e})},class:{method(){return this.$_addRule("class")},validate:(b,m)=>/^\s*class\s/.test(b.toString())?b:m.error("function.class",{value:b})},minArity:{method(b){return l(Number.isSafeInteger(b)&&b>0,"n must be a strict positive integer"),this.$_addRule({name:"minArity",args:{n:b}})},validate:(b,m,{n:e})=>b.length>=e?b:m.error("function.minArity",{n:e})},maxArity:{method(b){return l(Number.isSafeInteger(b)&&b>=0,"n must be a positive integer"),this.$_addRule({name:"maxArity",args:{n:b}})},validate:(b,m,{n:e})=>b.length<=e?b:m.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:(L,p,_)=>{const l=_(978),x=_(375),b=_(8571),m=_(3652),e=_(8068),a=_(8160),i=_(3292),r=_(6354),t=_(6133),c=_(3328),s={renameDefaults:{alias:!1,multiple:!1,override:!1}};L.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:(o,h)=>o.keys(h),validate(o,{schema:h,error:g,state:w,prefs:R}){if(!o||typeof o!==h.$_property("typeof")||Array.isArray(o))return{value:o,errors:g("object.base",{type:h.$_property("typeof")})};if(!(h.$_terms.renames||h.$_terms.dependencies||h.$_terms.keys||h.$_terms.patterns||h.$_terms.externals))return;o=s.clone(o,R);const j=[];if(h.$_terms.renames&&!s.rename(h,o,w,R,j))return{value:o,errors:j};if(!h.$_terms.keys&&!h.$_terms.patterns&&!h.$_terms.dependencies)return{value:o,errors:j};const f=new Set(Object.keys(o));if(h.$_terms.keys){const y=[o,...w.ancestors];for(const M of h.$_terms.keys){const E=M.key,N=o[E];f.delete(E);const $=w.localize([...w.path,E],y,M),n=M.schema.$_validate(N,$,R);if(n.errors){if(R.abortEarly)return{value:o,errors:n.errors};n.value!==void 0&&(o[E]=n.value),j.push(...n.errors)}else M.schema._flags.result==="strip"||n.value===void 0&&N!==void 0?delete o[E]:n.value!==void 0&&(o[E]=n.value)}}if(f.size||h._flags._hasPatternMatch){const y=s.unknown(h,o,f,j,w,R);if(y)return y}if(h.$_terms.dependencies)for(const y of h.$_terms.dependencies){if(y.key!==null&&s.isPresent(y.options)(y.key.resolve(o,w,R,null,{shadow:!1}))===!1)continue;const M=s.dependencies[y.rel](h,y,o,w,R);if(M){const E=h.$_createError(M.code,o,M.context,w,R);if(R.abortEarly)return{value:o,errors:E};j.push(E)}}return{value:o,errors:j}},rules:{and:{method(...o){return a.verifyFlat(o,"and"),s.dependency(this,"and",null,o)}},append:{method(o){return o==null||Object.keys(o).length===0?this:this.keys(o)}},assert:{method(o,h,g){c.isTemplate(o)||(o=i.ref(o)),x(g===void 0||typeof g=="string","Message must be a string"),h=this.$_compile(h,{appendPath:!0});const w=this.$_addRule({name:"assert",args:{subject:o,schema:h,message:g}});return w.$_mutateRegister(o),w.$_mutateRegister(h),w},validate(o,{error:h,prefs:g,state:w},{subject:R,schema:j,message:f}){const y=R.resolve(o,w,g),M=t.isRef(R)?R.absolute(w):[];return j.$_match(y,w.localize(M,[o,...w.ancestors],j),g)?o:h("object.assert",{subject:R,message:f})},args:["subject","schema","message"],multi:!0},instance:{method(o,h){return x(typeof o=="function","constructor must be a function"),h=h||o.name,this.$_addRule({name:"instance",args:{constructor:o,name:h}})},validate:(o,h,{constructor:g,name:w})=>o instanceof g?o:h.error("object.instance",{type:w,value:o}),args:["constructor","name"]},keys:{method(o){x(o===void 0||typeof o=="object","Object schema must be a valid object"),x(!a.isSchema(o),"Object schema cannot be a joi schema");const h=this.clone();if(o)if(Object.keys(o).length){h.$_terms.keys=h.$_terms.keys?h.$_terms.keys.filter(g=>!o.hasOwnProperty(g.key)):new s.Keys;for(const g in o)a.tryWithPath(()=>h.$_terms.keys.push({key:g,schema:this.$_compile(o[g])}),g)}else h.$_terms.keys=new s.Keys;else h.$_terms.keys=null;return h.$_mutateRebuild()}},length:{method(o){return this.$_addRule({name:"length",args:{limit:o},operator:"="})},validate:(o,h,{limit:g},{name:w,operator:R,args:j})=>a.compare(Object.keys(o).length,g,R)?o:h.error("object."+w,{limit:j.limit,value:o}),args:[{name:"limit",ref:!0,assert:a.limit,message:"must be a positive integer"}]},max:{method(o){return this.$_addRule({name:"max",method:"length",args:{limit:o},operator:"<="})}},min:{method(o){return this.$_addRule({name:"min",method:"length",args:{limit:o},operator:">="})}},nand:{method(...o){return a.verifyFlat(o,"nand"),s.dependency(this,"nand",null,o)}},or:{method(...o){return a.verifyFlat(o,"or"),s.dependency(this,"or",null,o)}},oxor:{method(...o){return s.dependency(this,"oxor",null,o)}},pattern:{method(o,h,g={}){const w=o instanceof RegExp;w||(o=this.$_compile(o,{appendPath:!0})),x(h!==void 0,"Invalid rule"),a.assertOptions(g,["fallthrough","matches"]),w&&x(!o.flags.includes("g")&&!o.flags.includes("y"),"pattern should not use global or sticky mode"),h=this.$_compile(h,{appendPath:!0});const R=this.clone();R.$_terms.patterns=R.$_terms.patterns||[];const j={[w?"regex":"schema"]:o,rule:h};return g.matches&&(j.matches=this.$_compile(g.matches),j.matches.type!=="array"&&(j.matches=j.matches.$_root.array().items(j.matches)),R.$_mutateRegister(j.matches),R.$_setFlag("_hasPatternMatch",!0,{clone:!1})),g.fallthrough&&(j.fallthrough=!0),R.$_terms.patterns.push(j),R.$_mutateRegister(h),R}},ref:{method(){return this.$_addRule("ref")},validate:(o,h)=>t.isRef(o)?o:h.error("object.refType",{value:o})},regex:{method(){return this.$_addRule("regex")},validate:(o,h)=>o instanceof RegExp?o:h.error("object.regex",{value:o})},rename:{method(o,h,g={}){x(typeof o=="string"||o instanceof RegExp,"Rename missing the from argument"),x(typeof h=="string"||h instanceof c,"Invalid rename to argument"),x(h!==o,"Cannot rename key to same name:",o),a.assertOptions(g,["alias","ignoreUndefined","override","multiple"]);const w=this.clone();w.$_terms.renames=w.$_terms.renames||[];for(const R of w.$_terms.renames)x(R.from!==o,"Cannot rename the same key multiple times");return h instanceof c&&w.$_mutateRegister(h),w.$_terms.renames.push({from:o,to:h,options:l(s.renameDefaults,g)}),w}},schema:{method(o="any"){return this.$_addRule({name:"schema",args:{type:o}})},validate:(o,h,{type:g})=>!a.isSchema(o)||g!=="any"&&o.type!==g?h.error("object.schema",{type:g}):o},unknown:{method(o){return this.$_setFlag("unknown",o!==!1)}},with:{method(o,h,g={}){return s.dependency(this,"with",o,h,g)}},without:{method(o,h,g={}){return s.dependency(this,"without",o,h,g)}},xor:{method(...o){return a.verifyFlat(o,"xor"),s.dependency(this,"xor",null,o)}}},overrides:{default(o,h){return o===void 0&&(o=a.symbols.deepDefault),this.$_parent("default",o,h)}},rebuild(o){if(o.$_terms.keys){const h=new m.Sorter;for(const g of o.$_terms.keys)a.tryWithPath(()=>h.add(g,{after:g.schema.$_rootReferences(),group:g.key}),g.key);o.$_terms.keys=new s.Keys(...h.nodes)}},manifest:{build(o,h){if(h.keys&&(o=o.keys(h.keys)),h.dependencies)for(const{rel:g,key:w=null,peers:R,options:j}of h.dependencies)o=s.dependency(o,g,w,R,j);if(h.patterns)for(const{regex:g,schema:w,rule:R,fallthrough:j,matches:f}of h.patterns)o=o.pattern(g||w,R,{fallthrough:j,matches:f});if(h.renames)for(const{from:g,to:w,options:R}of h.renames)o=o.rename(g,w,R);return o}},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(o,h){if(typeof o=="object"){if(h.nonEnumerables)return b(o,{shallow:!0});const w=Object.create(Object.getPrototypeOf(o));return Object.assign(w,o),w}const g=function(...w){return o.apply(this,w)};return g.prototype=b(o.prototype),Object.defineProperty(g,"name",{value:o.name,writable:!1}),Object.defineProperty(g,"length",{value:o.length,writable:!1}),Object.assign(g,o),g},s.dependency=function(o,h,g,w,R){x(g===null||typeof g=="string",h,"key must be a strings"),R||(R=w.length>1&&typeof w[w.length-1]=="object"?w.pop():{}),a.assertOptions(R,["separator","isPresent"]),w=[].concat(w);const j=a.default(R.separator,"."),f=[];for(const M of w)x(typeof M=="string",h,"peers must be strings"),f.push(i.ref(M,{separator:j,ancestor:0,prefix:!1}));g!==null&&(g=i.ref(g,{separator:j,ancestor:0,prefix:!1}));const y=o.clone();return y.$_terms.dependencies=y.$_terms.dependencies||[],y.$_terms.dependencies.push(new s.Dependency(h,g,f,w,R)),y},s.dependencies={and(o,h,g,w,R){const j=[],f=[],y=h.peers.length,M=s.isPresent(h.options);for(const E of h.peers)M(E.resolve(g,w,R,null,{shadow:!1}))===!1?j.push(E.key):f.push(E.key);if(j.length!==y&&f.length!==y)return{code:"object.and",context:{present:f,presentWithLabels:s.keysToLabels(o,f),missing:j,missingWithLabels:s.keysToLabels(o,j)}}},nand(o,h,g,w,R){const j=[],f=s.isPresent(h.options);for(const E of h.peers)f(E.resolve(g,w,R,null,{shadow:!1}))&&j.push(E.key);if(j.length!==h.peers.length)return;const y=h.paths[0],M=h.paths.slice(1);return{code:"object.nand",context:{main:y,mainWithLabel:s.keysToLabels(o,y),peers:M,peersWithLabels:s.keysToLabels(o,M)}}},or(o,h,g,w,R){const j=s.isPresent(h.options);for(const f of h.peers)if(j(f.resolve(g,w,R,null,{shadow:!1})))return;return{code:"object.missing",context:{peers:h.paths,peersWithLabels:s.keysToLabels(o,h.paths)}}},oxor(o,h,g,w,R){const j=[],f=s.isPresent(h.options);for(const M of h.peers)f(M.resolve(g,w,R,null,{shadow:!1}))&&j.push(M.key);if(!j.length||j.length===1)return;const y={peers:h.paths,peersWithLabels:s.keysToLabels(o,h.paths)};return y.present=j,y.presentWithLabels=s.keysToLabels(o,j),{code:"object.oxor",context:y}},with(o,h,g,w,R){const j=s.isPresent(h.options);for(const f of h.peers)if(j(f.resolve(g,w,R,null,{shadow:!1}))===!1)return{code:"object.with",context:{main:h.key.key,mainWithLabel:s.keysToLabels(o,h.key.key),peer:f.key,peerWithLabel:s.keysToLabels(o,f.key)}}},without(o,h,g,w,R){const j=s.isPresent(h.options);for(const f of h.peers)if(j(f.resolve(g,w,R,null,{shadow:!1})))return{code:"object.without",context:{main:h.key.key,mainWithLabel:s.keysToLabels(o,h.key.key),peer:f.key,peerWithLabel:s.keysToLabels(o,f.key)}}},xor(o,h,g,w,R){const j=[],f=s.isPresent(h.options);for(const M of h.peers)f(M.resolve(g,w,R,null,{shadow:!1}))&&j.push(M.key);if(j.length===1)return;const y={peers:h.paths,peersWithLabels:s.keysToLabels(o,h.paths)};return j.length===0?{code:"object.missing",context:y}:(y.present=j,y.presentWithLabels=s.keysToLabels(o,j),{code:"object.xor",context:y})}},s.keysToLabels=function(o,h){return Array.isArray(h)?h.map(g=>o.$_mapLabels(g)):o.$_mapLabels(h)},s.isPresent=function(o){return typeof o.isPresent=="function"?o.isPresent:h=>h!==void 0},s.rename=function(o,h,g,w,R){const j={};for(const f of o.$_terms.renames){const y=[],M=typeof f.from!="string";if(M)for(const E in h){if(h[E]===void 0&&f.options.ignoreUndefined||E===f.to)continue;const N=f.from.exec(E);N&&y.push({from:E,to:f.to,match:N})}else!Object.prototype.hasOwnProperty.call(h,f.from)||h[f.from]===void 0&&f.options.ignoreUndefined||y.push(f);for(const E of y){const N=E.from;let $=E.to;if($ instanceof c&&($=$.render(h,g,w,E.match)),N!==$){if(!f.options.multiple&&j[$]&&(R.push(o.$_createError("object.rename.multiple",h,{from:N,to:$,pattern:M},g,w)),w.abortEarly)||Object.prototype.hasOwnProperty.call(h,$)&&!f.options.override&&!j[$]&&(R.push(o.$_createError("object.rename.override",h,{from:N,to:$,pattern:M},g,w)),w.abortEarly))return!1;h[N]===void 0?delete h[$]:h[$]=h[N],j[$]=!0,f.options.alias||delete h[N]}}}return!0},s.unknown=function(o,h,g,w,R,j){if(o.$_terms.patterns){let f=!1;const y=o.$_terms.patterns.map(E=>{if(E.matches)return f=!0,[]}),M=[h,...R.ancestors];for(const E of g){const N=h[E],$=[...R.path,E];for(let n=0;n<o.$_terms.patterns.length;++n){const d=o.$_terms.patterns[n];if(d.regex){const A=d.regex.test(E);if(R.mainstay.tracer.debug(R,"rule",`pattern.${n}`,A?"pass":"error"),!A)continue}else if(!d.schema.$_match(E,R.nest(d.schema,`pattern.${n}`),j))continue;g.delete(E);const v=R.localize($,M,{schema:d.rule,key:E}),k=d.rule.$_validate(N,v,j);if(k.errors){if(j.abortEarly)return{value:h,errors:k.errors};w.push(...k.errors)}if(d.matches&&y[n].push(E),h[E]=k.value,!d.fallthrough)break}}if(f)for(let E=0;E<y.length;++E){const N=y[E];if(!N)continue;const $=o.$_terms.patterns[E].matches,n=R.localize(R.path,M,$),d=$.$_validate(N,n,j);if(d.errors){const v=r.details(d.errors,{override:!1});v.matches=N;const k=o.$_createError("object.pattern.match",h,v,R,j);if(j.abortEarly)return{value:h,errors:k};w.push(k)}}}if(g.size&&(o.$_terms.keys||o.$_terms.patterns)){if(j.stripUnknown&&o._flags.unknown===void 0||j.skipFunctions){const f=!(!j.stripUnknown||j.stripUnknown!==!0&&!j.stripUnknown.objects);for(const y of g)f?(delete h[y],g.delete(y)):typeof h[y]=="function"&&g.delete(y)}if(!a.default(o._flags.unknown,j.allowUnknown))for(const f of g){const y=R.localize([...R.path,f],[]),M=o.$_createError("object.unknown",h[f],{child:f},y,j,{flags:!1});if(j.abortEarly)return{value:h,errors:M};w.push(M)}}},s.Dependency=class{constructor(o,h,g,w,R){this.rel=o,this.key=h,this.peers=g,this.paths=w,this.options=R}describe(){const o={rel:this.rel,peers:this.paths};return this.key!==null&&(o.key=this.key.key),this.peers[0].separator!=="."&&(o.options={...o.options,separator:this.peers[0].separator}),this.options.isPresent&&(o.options={...o.options,isPresent:this.options.isPresent}),o}},s.Keys=class extends Array{concat(o){const h=this.slice(),g=new Map;for(let w=0;w<h.length;++w)g.set(h[w].key,w);for(const w of o){const R=w.key,j=g.get(R);j!==void 0?h[j]={key:R,schema:h[j].schema.concat(w.schema)}:h.push(w)}return h}}},8785:(L,p,_)=>{const l=_(375),x=_(8068),b=_(8160),m=_(3292),e=_(6354),a={};L.exports=x.extend({type:"link",properties:{schemaChain:!0},terms:{link:{init:null,manifest:"single",register:!1}},args:(i,r)=>i.ref(r),validate(i,{schema:r,state:t,prefs:c}){l(r.$_terms.link,"Uninitialized link schema");const s=a.generate(r,i,t,c),o=r.$_terms.link[0].ref;return s.$_validate(i,t.nest(s,`link:${o.display}:${s.type}`),c)},generate:(i,r,t,c)=>a.generate(i,r,t,c),rules:{ref:{method(i){l(!this.$_terms.link,"Cannot reinitialize schema"),i=m.ref(i),l(i.type==="value"||i.type==="local","Invalid reference type:",i.type),l(i.type==="local"||i.ancestor==="root"||i.ancestor>0,"Link cannot reference itself");const r=this.clone();return r.$_terms.link=[{ref:i}],r}},relative:{method(i=!0){return this.$_setFlag("relative",i)}}},overrides:{concat(i){l(this.$_terms.link,"Uninitialized link schema"),l(b.isSchema(i),"Invalid schema object"),l(i.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:i}),r.$_mutateRebuild()}},manifest:{build:(i,r)=>(l(r.link,"Invalid link description missing link"),i.ref(r.link))}}),a.generate=function(i,r,t,c){let s=t.mainstay.links.get(i);if(s)return s._generate(r,t,c).schema;const o=i.$_terms.link[0].ref,{perspective:h,path:g}=a.perspective(o,t);a.assert(h,"which is outside of schema boundaries",o,i,t,c);try{s=g.length?h.$_reach(g):h}catch{a.assert(!1,"to non-existing schema",o,i,t,c)}return a.assert(s.type!=="link","which is another link",o,i,t,c),i._flags.relative||t.mainstay.links.set(i,s),s._generate(r,t,c).schema},a.perspective=function(i,r){if(i.type==="local"){for(const{schema:t,key:c}of r.schemas){if((t._flags.id||c)===i.path[0])return{perspective:t,path:i.path.slice(1)};if(t.$_terms.shared){for(const s of t.$_terms.shared)if(s._flags.id===i.path[0])return{perspective:s,path:i.path.slice(1)}}}return{perspective:null,path:null}}return i.ancestor==="root"?{perspective:r.schemas[r.schemas.length-1].schema,path:i.path}:{perspective:r.schemas[i.ancestor]&&r.schemas[i.ancestor].schema,path:i.path}},a.assert=function(i,r,t,c,s,o){i||l(!1,`"${e.label(c._flags,s,o)}" contains link reference "${t.display}" ${r}`)}},3832:(L,p,_)=>{const l=_(375),x=_(8068),b=_(8160),m={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(),i=a.indexOf("."),r=a.indexOf("e");return(i<0?0:(r<0?a.length:r)-i-1)+(r<0?0:Math.max(0,-parseInt(a.slice(r+1))))}};L.exports=x.extend({type:"number",flags:{unsafe:{default:!1}},coerce:{from:"string",method(e,{schema:a,error:i}){if(!e.match(m.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(m.extractSignificantDigits(e)!==m.extractSignificantDigits(String(r.value)))return r.errors=i("number.unsafe"),r}else{const t=r.value.toString();if(t.match(/e/i))return r;if(t!==m.normalizeDecimal(e))return r.errors=i("number.unsafe"),r}return r}},validate(e,{schema:a,error:i,prefs:r}){if(e===1/0||e===-1/0)return{value:e,errors:i("number.infinity")};if(!b.isNumber(e))return{value:e,errors:i("number.base")};const t={value:e};if(r.convert){const c=a.$_getRule("precision");if(c){const s=Math.pow(10,c.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=i("number.unsafe")),t},rules:{compare:{method:!1,validate:(e,a,{limit:i},{name:r,operator:t,args:c})=>b.compare(e,i,t)?e:a.error("number."+r,{limit:c.limit,value:e}),args:[{name:"limit",ref:!0,assert:b.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"?m.decimalPlaces(e):null,i=Math.pow(10,a);return this.$_addRule({name:"multiple",args:{base:e,baseDecimalPlace:a,pfactor:i}})},validate:(e,a,{base:i,baseDecimalPlace:r,pfactor:t},c)=>m.decimalPlaces(e)>r?a.error("number.multiple",{multiple:c.args.base,value:e}):Math.round(t*e)%Math.round(t*i)==0?e:a.error("number.multiple",{multiple:c.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 l(Number.isSafeInteger(e),"limit must be an integer"),this.$_addRule({name:"precision",args:{limit:e}})},validate(e,a,{limit:i}){const r=e.toString().match(m.precisionRx);return Math.max((r[1]?r[1].length:0)-(r[2]?parseInt(r[2],10):0),0)<=i?e:a.error("number.precision",{limit:i,value:e})},convert:!0},sign:{method(e){return l(["negative","positive"].includes(e),"Invalid sign",e),this.$_addRule({name:"sign",args:{sign:e}})},validate:(e,a,{sign:i})=>i==="negative"&&e<0||i==="positive"&&e>0?e:a.error(`number.${i}`)},unsafe:{method(e=!0){return l(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"}}),m.extractSignificantDigits=function(e){return e.replace(m.exponentialPartRegex,"").replace(m.dotRegex,"").replace(m.trailingZerosRegex,"").replace(m.leadingSignAndZerosRegex,"")},m.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:(L,p,_)=>{const l=_(7824);L.exports=l.extend({type:"object",cast:{map:{from:x=>x&&typeof x=="object",to:(x,b)=>new Map(Object.entries(x))}}})},7417:(L,p,_)=>{const l=_(375),x=_(5380),b=_(1745),m=_(9959),e=_(6064),a=_(9926),i=_(5752),r=_(8068),t=_(8160),c={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:m.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"]};L.exports=r.extend({type:"string",flags:{insensitive:{default:!1},truncate:{default:!1}},terms:{replacements:{init:null}},coerce:{from:"string",method(s,{schema:o,state:h,prefs:g}){const w=o.$_getRule("normalize");w&&(s=s.normalize(w.args.form));const R=o.$_getRule("case");R&&(s=R.args.direction==="upper"?s.toLocaleUpperCase():s.toLocaleLowerCase());const j=o.$_getRule("trim");if(j&&j.args.enabled&&(s=s.trim()),o.$_terms.replacements)for(const y of o.$_terms.replacements)s=s.replace(y.pattern,y.replacement);const f=o.$_getRule("hex");if(f&&f.args.options.byteAligned&&s.length%2!=0&&(s=`0${s}`),o.$_getRule("isoDate")){const y=c.isoDate(s);y&&(s=y)}if(o._flags.truncate){const y=o.$_getRule("max");if(y){let M=y.args.limit;if(t.isResolvable(M)&&(M=M.resolve(s,h,g),!t.limit(M)))return{value:s,errors:o.$_createError("any.ref",M,{ref:y.args.limit,arg:"limit",reason:"must be a positive integer"},h,g)};s=s.slice(0,M)}}return{value:s}}},validate(s,{schema:o,error:h}){if(typeof s!="string")return{value:s,errors:h("string.base")};if(s===""){const g=o.$_getRule("min");return g&&g.args.limit===0?void 0:{value:s,errors:h("string.empty")}}},rules:{alphanum:{method(){return this.$_addRule("alphanum")},validate:(s,o)=>/^[a-zA-Z0-9]+$/.test(s)?s:o.error("string.alphanum")},base64:{method(s={}){return t.assertOptions(s,["paddingRequired","urlSafe"]),s={urlSafe:!1,paddingRequired:!0,...s},l(typeof s.paddingRequired=="boolean","paddingRequired must be boolean"),l(typeof s.urlSafe=="boolean","urlSafe must be boolean"),this.$_addRule({name:"base64",args:{options:s}})},validate:(s,o,{options:h})=>c.base64Regex[h.paddingRequired][h.urlSafe].test(s)?s:o.error("string.base64")},case:{method(s){return l(["lower","upper"].includes(s),"Invalid case:",s),this.$_addRule({name:"case",args:{direction:s}})},validate:(s,o,{direction:h})=>h==="lower"&&s===s.toLocaleLowerCase()||h==="upper"&&s===s.toLocaleUpperCase()?s:o.error(`string.${h}case`),convert:!0},creditCard:{method(){return this.$_addRule("creditCard")},validate(s,o){let h=s.length,g=0,w=1;for(;h--;){const R=s.charAt(h)*w;g+=R-9*(R>9),w^=3}return g>0&&g%10==0?s:o.error("string.creditCard")}},dataUri:{method(s={}){return t.assertOptions(s,["paddingRequired"]),s={paddingRequired:!0,...s},l(typeof s.paddingRequired=="boolean","paddingRequired must be boolean"),this.$_addRule({name:"dataUri",args:{options:s}})},validate(s,o,{options:h}){const g=s.match(c.dataUriRegex);return g&&(!g[2]||g[2]!=="base64"||c.base64Regex[h.paddingRequired].false.test(g[3]))?s:o.error("string.dataUri")}},domain:{method(s){s&&t.assertOptions(s,["allowFullyQualified","allowUnicode","maxDomainSegments","minDomainSegments","tlds"]);const o=c.addressOptions(s);return this.$_addRule({name:"domain",args:{options:s},address:o})},validate:(s,o,h,{address:g})=>x.isValid(s,g)?s:o.error("string.domain")},email:{method(s={}){t.assertOptions(s,["allowFullyQualified","allowUnicode","ignoreLength","maxDomainSegments","minDomainSegments","multiple","separator","tlds"]),l(s.multiple===void 0||typeof s.multiple=="boolean","multiple option must be an boolean");const o=c.addressOptions(s),h=new RegExp(`\\s*[${s.separator?e(s.separator):","}]\\s*`);return this.$_addRule({name:"email",args:{options:s},regex:h,address:o})},validate(s,o,{options:h},{regex:g,address:w}){const R=h.multiple?s.split(g):[s],j=[];for(const f of R)b.isValid(f,w)||j.push(f);return j.length?o.error("string.email",{value:s,invalids:j}):s}},guid:{alias:"uuid",method(s={}){t.assertOptions(s,["version","separator"]);let o="";if(s.version){const w=[].concat(s.version);l(w.length>=1,"version must have at least 1 valid version specified");const R=new Set;for(let j=0;j<w.length;++j){const f=w[j];l(typeof f=="string","version at position "+j+" must be a string");const y=c.guidVersions[f.toLowerCase()];l(y,"version at position "+j+" must be one of "+Object.keys(c.guidVersions).join(", ")),l(!R.has(y),"version at position "+j+" must not be a duplicate"),o+=y,R.add(y)}}l(c.guidSeparators.has(s.separator),'separator must be one of true, false, "-", or ":"');const h=s.separator===void 0?"[:-]?":s.separator===!0?"[:-]":s.separator===!1?"[]?":`\\${s.separator}`,g=new RegExp(`^([\\[{\\(]?)[0-9A-F]{8}(${h})[0-9A-F]{4}\\2?[${o||"0-9A-F"}][0-9A-F]{3}\\2?[${o?"89AB":"0-9A-F"}][0-9A-F]{3}\\2?[0-9A-F]{12}([\\]}\\)]?)$`,"i");return this.$_addRule({name:"guid",args:{options:s},regex:g})},validate(s,o,h,{regex:g}){const w=g.exec(s);return w?c.guidBrackets[w[1]]!==w[w.length-1]?o.error("string.guid"):s:o.error("string.guid")}},hex:{method(s={}){return t.assertOptions(s,["byteAligned","prefix"]),s={byteAligned:!1,prefix:!1,...s},l(typeof s.byteAligned=="boolean","byteAligned must be boolean"),l(typeof s.prefix=="boolean"||s.prefix==="optional",'prefix must be boolean or "optional"'),this.$_addRule({name:"hex",args:{options:s}})},validate:(s,o,{options:h})=>(h.prefix==="optional"?c.hexRegex.withOptionalPrefix:h.prefix===!0?c.hexRegex.withPrefix:c.hexRegex.withoutPrefix).test(s)?h.byteAligned&&s.length%2!=0?o.error("string.hexAlign"):s:o.error("string.hex")},hostname:{method(){return this.$_addRule("hostname")},validate:(s,o)=>x.isValid(s,{minDomainSegments:1})||c.ipRegex.test(s)?s:o.error("string.hostname")},insensitive:{method(){return this.$_setFlag("insensitive",!0)}},ip:{method(s={}){t.assertOptions(s,["cidr","version"]);const{cidr:o,versions:h,regex:g}=m.regex(s),w=s.version?h:void 0;return this.$_addRule({name:"ip",args:{options:{cidr:o,version:w}},regex:g})},validate:(s,o,{options:h},{regex:g})=>g.test(s)?s:h.version?o.error("string.ipVersion",{value:s,cidr:h.cidr,version:h.version}):o.error("string.ip",{value:s,cidr:h.cidr})},isoDate:{method(){return this.$_addRule("isoDate")},validate:(s,{error:o})=>c.isoDate(s)?s:o("string.isoDate")},isoDuration:{method(){return this.$_addRule("isoDuration")},validate:(s,o)=>c.isoDurationRegex.test(s)?s:o.error("string.isoDuration")},length:{method(s,o){return c.length(this,"length",s,"=",o)},validate(s,o,{limit:h,encoding:g},{name:w,operator:R,args:j}){const f=!g&&s.length;return t.compare(f,h,R)?s:o.error("string."+w,{limit:j.limit,value:s,encoding:g})},args:[{name:"limit",ref:!0,assert:t.limit,message:"must be a positive integer"},"encoding"]},lowercase:{method(){return this.case("lower")}},max:{method(s,o){return c.length(this,"max",s,"<=",o)},args:["limit","encoding"]},min:{method(s,o){return c.length(this,"min",s,">=",o)},args:["limit","encoding"]},normalize:{method(s="NFC"){return l(c.normalizationForms.includes(s),"normalization form must be one of "+c.normalizationForms.join(", ")),this.$_addRule({name:"normalize",args:{form:s}})},validate:(s,{error:o},{form:h})=>s===s.normalize(h)?s:o("string.normalize",{value:s,form:h}),convert:!0},pattern:{alias:"regex",method(s,o={}){l(s instanceof RegExp,"regex must be a RegExp"),l(!s.flags.includes("g")&&!s.flags.includes("y"),"regex should not use global or sticky mode"),typeof o=="string"&&(o={name:o}),t.assertOptions(o,["invert","name"]);const h=["string.pattern",o.invert?".invert":"",o.name?".name":".base"].join("");return this.$_addRule({name:"pattern",args:{regex:s,options:o},errorCode:h})},validate:(s,o,{regex:h,options:g},{errorCode:w})=>h.test(s)^g.invert?s:o.error(w,{name:g.name,regex:h,value:s}),args:["regex","options"],multi:!0},replace:{method(s,o){typeof s=="string"&&(s=new RegExp(e(s),"g")),l(s instanceof RegExp,"pattern must be a RegExp"),l(typeof o=="string","replacement must be a String");const h=this.clone();return h.$_terms.replacements||(h.$_terms.replacements=[]),h.$_terms.replacements.push({pattern:s,replacement:o}),h}},token:{method(){return this.$_addRule("token")},validate:(s,o)=>/^\w+$/.test(s)?s:o.error("string.token")},trim:{method(s=!0){return l(typeof s=="boolean","enabled must be a boolean"),this.$_addRule({name:"trim",args:{enabled:s}})},validate:(s,o,{enabled:h})=>h&&s!==s.trim()?o.error("string.trim"):s,convert:!0},truncate:{method(s=!0){return l(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:o,scheme:h}=i.regex(s),g=s.domain?c.addressOptions(s.domain):null;return this.$_addRule({name:"uri",args:{options:s},regex:o,domain:g,scheme:h})},validate(s,o,{options:h},{regex:g,domain:w,scheme:R}){if(["http:/","https:/"].includes(s))return o.error("string.uri");let j=g.exec(s);if(!j&&o.prefs.convert&&h.encodeUri){const f=encodeURI(s);j=g.exec(f),j&&(s=f)}if(j){const f=j[1]||j[2];return!w||h.allowRelative&&!f||x.isValid(f,w)?s:o.error("string.domain",{value:f})}return h.relativeOnly?o.error("string.uriRelativeOnly"):h.scheme?o.error("string.uriCustomScheme",{scheme:R,value:s}):o.error("string.uri")}}},manifest:{build(s,o){if(o.replacements)for(const{pattern:h,replacement:g}of o.replacements)s=s.replace(h,g);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"}}),c.addressOptions=function(s){if(!s)return c.tlds||s;if(l(s.minDomainSegments===void 0||Number.isSafeInteger(s.minDomainSegments)&&s.minDomainSegments>0,"minDomainSegments must be a positive integer"),l(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 l(c.tlds,"Built-in TLD list disabled"),Object.assign({},s,c.tlds);l(typeof s.tlds=="object","tlds must be true, false, or an object");const o=s.tlds.deny;if(o)return Array.isArray(o)&&(s=Object.assign({},s,{tlds:{deny:new Set(o)}})),l(s.tlds.deny instanceof Set,"tlds.deny must be an array, Set, or boolean"),l(!s.tlds.allow,"Cannot specify both tlds.allow and tlds.deny lists"),c.validateTlds(s.tlds.deny,"tlds.deny"),s;const h=s.tlds.allow;return h?h===!0?(l(c.tlds,"Built-in TLD list disabled"),Object.assign({},s,c.tlds)):(Array.isArray(h)&&(s=Object.assign({},s,{tlds:{allow:new Set(h)}})),l(s.tlds.allow instanceof Set,"tlds.allow must be an array, Set, or boolean"),c.validateTlds(s.tlds.allow,"tlds.allow"),s):s},c.validateTlds=function(s,o){for(const h of s)l(x.isValid(h,{minDomainSegments:1,maxDomainSegments:1}),`${o} must contain valid top level domain names`)},c.isoDate=function(s){if(!t.isIsoDate(s))return null;/.*T.*[+-]\d\d$/.test(s)&&(s+="00");const o=new Date(s);return isNaN(o.getTime())?null:o.toISOString()},c.length=function(s,o,h,g,w){return l(!w||!1,"Invalid encoding:",w),s.$_addRule({name:o,method:"length",args:{limit:h,encoding:w},operator:g})}},8826:(L,p,_)=>{const l=_(375),x=_(8068),b={};b.Map=class extends Map{slice(){return new b.Map(this)}},L.exports=x.extend({type:"symbol",terms:{map:{init:new b.Map}},coerce:{method(m,{schema:e,error:a}){const i=e.$_terms.map.get(m);return i&&(m=i),e._flags.only&&typeof m!="symbol"?{value:m,errors:a("symbol.map",{map:e.$_terms.map})}:{value:m}}},validate(m,{error:e}){if(typeof m!="symbol")return{value:m,errors:e("symbol.base")}},rules:{map:{method(m){m&&!m[Symbol.iterator]&&typeof m=="object"&&(m=Object.entries(m)),l(m&&m[Symbol.iterator],"Iterable must be an iterable or object");const e=this.clone(),a=[];for(const i of m){l(i&&i[Symbol.iterator],"Entry must be an iterable");const[r,t]=i;l(typeof r!="object"&&typeof r!="function"&&typeof r!="symbol","Key must not be of type object, function, or Symbol"),l(typeof t=="symbol","Value must be a Symbol"),e.$_terms.map.set(r,t),a.push(t)}return e.valid(...a)}}},manifest:{build:(m,e)=>(e.map&&(m=m.map(e.map)),m)},messages:{"symbol.base":"{{#label}} must be a symbol","symbol.map":"{{#label}} must be one of {{#map}}"}})},8863:(L,p,_)=>{const l=_(375),x=_(8571),b=_(738),m=_(9621),e=_(8160),a=_(6354),i=_(493),r={result:Symbol("result")};p.entry=function(t,c,s){let o=e.defaults;s&&(l(s.warnings===void 0,"Cannot override warnings preference in synchronous validation"),l(s.artifacts===void 0,"Cannot override artifacts preference in synchronous validation"),o=e.preferences(e.defaults,s));const h=r.entry(t,c,o);l(!h.mainstay.externals.length,"Schema with external rules must use validateAsync()");const g={value:h.value};return h.error&&(g.error=h.error),h.mainstay.warnings.length&&(g.warning=a.details(h.mainstay.warnings)),h.mainstay.debug&&(g.debug=h.mainstay.debug),h.mainstay.artifacts&&(g.artifacts=h.mainstay.artifacts),g},p.entryAsync=async function(t,c,s){let o=e.defaults;s&&(o=e.preferences(e.defaults,s));const h=r.entry(t,c,o),g=h.mainstay;if(h.error)throw g.debug&&(h.error.debug=g.debug),h.error;if(g.externals.length){let R=h.value;const j=[];for(const f of g.externals){const y=f.state.path,M=f.schema.type==="link"?g.links.get(f.schema):null;let E,N,$=R;const n=y.length?[R]:[],d=y.length?m(t,y):t;if(y.length){E=y[y.length-1];let v=R;for(const k of y.slice(0,-1))v=v[k],n.unshift(v);N=n[0],$=N[E]}try{const v=(A,D)=>(M||f.schema).$_createError(A,$,D,f.state,o),k=await f.method($,{schema:f.schema,linked:M,state:f.state,prefs:s,original:d,error:v,errorsArray:r.errorsArray,warn:(A,D)=>g.warnings.push((M||f.schema).$_createError(A,$,D,f.state,o)),message:(A,D)=>(M||f.schema).$_createError("external",$,D,f.state,o,{messages:A})});if(k===void 0||k===$)continue;if(k instanceof a.Report){if(g.tracer.log(f.schema,f.state,"rule","external","error"),j.push(k),o.abortEarly)break;continue}if(Array.isArray(k)&&k[e.symbols.errors]){if(g.tracer.log(f.schema,f.state,"rule","external","error"),j.push(...k),o.abortEarly)break;continue}N?(g.tracer.value(f.state,"rule",$,k,"external"),N[E]=k):(g.tracer.value(f.state,"rule",R,k,"external"),R=k)}catch(v){throw o.errors.label&&(v.message+=` (${f.label})`),v}}if(h.value=R,j.length)throw h.error=a.process(j,t,o),g.debug&&(h.error.debug=g.debug),h.error}if(!o.warnings&&!o.debug&&!o.artifacts)return h.value;const w={value:h.value};return g.warnings.length&&(w.warning=a.details(g.warnings)),g.debug&&(w.debug=g.debug),g.artifacts&&(w.artifacts=g.artifacts),w},r.Mainstay=class{constructor(t,c,s){this.externals=[],this.warnings=[],this.tracer=t,this.debug=c,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,c,s){const{tracer:o,cleanup:h}=r.tracer(c,s),g=s.debug?[]:null,w=c._ids._schemaChain?new Map:null,R=new r.Mainstay(o,g,w),j=c._ids._schemaChain?[{schema:c}]:null,f=new i([],[],{mainstay:R,schemas:j}),y=p.validate(t,c,f,s);h&&c.$_root.untrace();const M=a.process(y.errors,t,s);return{value:y.value,error:M,mainstay:R}},r.tracer=function(t,c){return t.$_root._tracer?{tracer:t.$_root._tracer._register(t)}:c.debug?(l(t.$_root.trace,"Debug mode not supported"),{tracer:t.$_root.trace()._register(t),cleanup:!0}):{tracer:r.ignore}},p.validate=function(t,c,s,o,h={}){if(c.$_terms.whens&&(c=c._generate(t,s,o).schema),c._preferences&&(o=r.prefs(c,o)),c._cache&&o.cache){const M=c._cache.get(t);if(s.mainstay.tracer.debug(s,"validate","cached",!!M),M)return M}const g=(M,E,N)=>c.$_createError(M,t,E,N||s,o),w={original:t,prefs:o,schema:c,state:s,error:g,errorsArray:r.errorsArray,warn:(M,E,N)=>s.mainstay.warnings.push(g(M,E,N)),message:(M,E)=>c.$_createError("custom",t,E,s,o,{messages:M})};s.mainstay.tracer.entry(c,s);const R=c._definition;if(R.prepare&&t!==void 0&&o.convert){const M=R.prepare(t,w);if(M){if(s.mainstay.tracer.value(s,"prepare",t,M.value),M.errors)return r.finalize(M.value,[].concat(M.errors),w);t=M.value}}if(R.coerce&&t!==void 0&&o.convert&&(!R.coerce.from||R.coerce.from.includes(typeof t))){const M=R.coerce.method(t,w);if(M){if(s.mainstay.tracer.value(s,"coerced",t,M.value),M.errors)return r.finalize(M.value,[].concat(M.errors),w);t=M.value}}const j=c._flags.empty;j&&j.$_match(r.trim(t,c),s.nest(j),e.defaults)&&(s.mainstay.tracer.value(s,"empty",t,void 0),t=void 0);const f=h.presence||c._flags.presence||(c._flags._endedSwitch?null:o.presence);if(t===void 0){if(f==="forbidden")return r.finalize(t,null,w);if(f==="required")return r.finalize(t,[c.$_createError("any.required",t,null,s,o)],w);if(f==="optional"){if(c._flags.default!==e.symbols.deepDefault)return r.finalize(t,null,w);s.mainstay.tracer.value(s,"default",t,{}),t={}}}else if(f==="forbidden")return r.finalize(t,[c.$_createError("any.unknown",t,null,s,o)],w);const y=[];if(c._valids){const M=c._valids.get(t,s,o,c._flags.insensitive);if(M)return o.convert&&(s.mainstay.tracer.value(s,"valids",t,M.value),t=M.value),s.mainstay.tracer.filter(c,s,"valid",M),r.finalize(t,null,w);if(c._flags.only){const E=c.$_createError("any.only",t,{valids:c._valids.values({display:!0})},s,o);if(o.abortEarly)return r.finalize(t,[E],w);y.push(E)}}if(c._invalids){const M=c._invalids.get(t,s,o,c._flags.insensitive);if(M){s.mainstay.tracer.filter(c,s,"invalid",M);const E=c.$_createError("any.invalid",t,{invalids:c._invalids.values({display:!0})},s,o);if(o.abortEarly)return r.finalize(t,[E],w);y.push(E)}}if(R.validate){const M=R.validate(t,w);if(M&&(s.mainstay.tracer.value(s,"base",t,M.value),t=M.value,M.errors)){if(!Array.isArray(M.errors))return y.push(M.errors),r.finalize(t,y,w);if(M.errors.length)return y.push(...M.errors),r.finalize(t,y,w)}}return c._rules.length?r.rules(t,y,w):r.finalize(t,y,w)},r.rules=function(t,c,s){const{schema:o,state:h,prefs:g}=s;for(const w of o._rules){const R=o._definition.rules[w.method];if(R.convert&&g.convert){h.mainstay.tracer.log(o,h,"rule",w.name,"full");continue}let j,f=w.args;if(w._resolve.length){f=Object.assign({},f);for(const M of w._resolve){const E=R.argsByName.get(M),N=f[M].resolve(t,h,g),$=E.normalize?E.normalize(N):N,n=e.validateArg($,null,E);if(n){j=o.$_createError("any.ref",N,{arg:M,ref:f[M],reason:n},h,g);break}f[M]=$}}j=j||R.validate(t,s,f,w);const y=r.rule(j,w);if(y.errors){if(h.mainstay.tracer.log(o,h,"rule",w.name,"error"),w.warn){h.mainstay.warnings.push(...y.errors);continue}if(g.abortEarly)return r.finalize(t,y.errors,s);c.push(...y.errors)}else h.mainstay.tracer.log(o,h,"rule",w.name,"pass"),h.mainstay.tracer.value(h,"rule",t,y.value,w.name),t=y.value}return r.finalize(t,c,s)},r.rule=function(t,c){return t instanceof a.Report?(r.error(t,c),{errors:[t],value:null}):Array.isArray(t)&&t[e.symbols.errors]?(t.forEach(s=>r.error(s,c)),{errors:t,value:null}):{errors:null,value:t}},r.error=function(t,c){return c.message&&t._setTemplate(c.message),t},r.finalize=function(t,c,s){c=c||[];const{schema:o,state:h,prefs:g}=s;if(c.length){const R=r.default("failover",void 0,c,s);R!==void 0&&(h.mainstay.tracer.value(h,"failover",t,R),t=R,c=[])}if(c.length&&o._flags.error)if(typeof o._flags.error=="function"){c=o._flags.error(c),Array.isArray(c)||(c=[c]);for(const R of c)l(R instanceof Error||R instanceof a.Report,"error() must return an Error object")}else c=[o._flags.error];if(t===void 0){const R=r.default("default",t,c,s);h.mainstay.tracer.value(h,"default",t,R),t=R}if(o._flags.cast&&t!==void 0){const R=o._definition.cast[o._flags.cast];if(R.from(t)){const j=R.to(t,s);h.mainstay.tracer.value(h,"cast",t,j,o._flags.cast),t=j}}if(o.$_terms.externals&&g.externals&&g._externals!==!1)for(const{method:R}of o.$_terms.externals)h.mainstay.externals.push({method:R,schema:o,state:h,label:a.label(o._flags,h,g)});const w={value:t,errors:c.length?c:null};return o._flags.result&&(w.value=o._flags.result==="strip"?void 0:s.original,h.mainstay.tracer.value(h,o._flags.result,t,w.value),h.shadow(t,o._flags.result)),o._cache&&g.cache!==!1&&!o._refs.length&&o._cache.set(s.original,w),t===void 0||w.errors||o._flags.artifact===void 0||(h.mainstay.artifacts=h.mainstay.artifacts||new Map,h.mainstay.artifacts.has(o._flags.artifact)||h.mainstay.artifacts.set(o._flags.artifact,[]),h.mainstay.artifacts.get(o._flags.artifact).push(h.path)),w},r.prefs=function(t,c){const s=c===e.defaults;return s&&t._preferences[e.symbols.prefs]?t._preferences[e.symbols.prefs]:(c=e.preferences(c,t._preferences),s&&(t._preferences[e.symbols.prefs]=c),c)},r.default=function(t,c,s,o){const{schema:h,state:g,prefs:w}=o,R=h._flags[t];if(w.noDefaults||R===void 0)return c;if(g.mainstay.tracer.log(h,g,"rule",t,"full"),!R)return R;if(typeof R=="function"){const j=R.length?[x(g.ancestors[0]),o]:[];try{return R(...j)}catch(f){return void s.push(h.$_createError(`any.${t}`,null,{error:f},g,w))}}return typeof R!="object"?R:R[e.symbols.literal]?R.literal:e.isResolvable(R)?R.resolve(c,g,w):x(R)},r.trim=function(t,c){if(typeof t!="string")return t;const s=c.$_getRule("trim");return s&&s.args.enabled?t.trim():t},r.ignore={active:!1,debug:b,entry:b,filter:b,log:b,resolve:b,value:b},r.errorsArray=function(){const t=[];return t[e.symbols.errors]=!0,t}},2036:(L,p,_)=>{const l=_(375),x=_(9474),b=_(8160),m={};L.exports=m.Values=class{constructor(e,a){this._values=new Set(e),this._refs=new Set(a),this._lowercase=m.lowercases(e),this._override=!1}get length(){return this._values.size+this._refs.size}add(e,a){b.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,i){if(e=e||new m.Values,a){if(a._override)return a.clone();for(const r of[...a._values,...a._refs])e.add(r)}if(i)for(const r of[...i._values,...i._refs])e.remove(r);return e.length?e:null}remove(e){b.isResolvable(e)?this._refs.delete(e):(this._values.delete(e),typeof e=="string"&&this._lowercase.delete(e.toLowerCase()))}has(e,a,i,r){return!!this.get(e,a,i,r)}get(e,a,i,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(x(t,e))return{value:t}}if(a)for(const t of this._refs){const c=t.resolve(e,a,i,null,{in:!0});if(c===void 0)continue;const s=t.in&&typeof c=="object"?Array.isArray(c)?c:Object.keys(c):[c];for(const o of s)if(typeof o==typeof e){if(r&&e&&typeof e=="string"){if(o.toLowerCase()===e.toLowerCase())return{value:o,ref:t}}else if(x(o,e))return{value:o,ref:t}}}return!1}override(){this._override=!0}values(e){if(e&&e.display){const a=[];for(const i of[...this._values,...this._refs])i!==void 0&&a.push(i);return a}return Array.from([...this._values,...this._refs])}clone(){const e=new m.Values(this._values,this._refs);return e._override=this._override,e}concat(e){l(!e._override,"Cannot concat override set of values");const a=new m.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}},m.Values.prototype[b.symbols.values]=!0,m.Values.prototype.slice=m.Values.prototype.clone,m.lowercases=function(e){const a=new Map;if(e)for(const i of e)typeof i=="string"&&a.set(i.toLowerCase(),i);return a}},978:(L,p,_)=>{const l=_(375),x=_(8571),b=_(1687),m=_(9621),e={};L.exports=function(a,i,r={}){if(l(a&&typeof a=="object","Invalid defaults value: must be an object"),l(!i||i===!0||typeof i=="object","Invalid source value: must be true, falsy or an object"),l(typeof r=="object","Invalid options: must be an object"),!i)return null;if(r.shallow)return e.applyToDefaultsWithShallow(a,i,r);const t=x(a);if(i===!0)return t;const c=r.nullOverride!==void 0&&r.nullOverride;return b(t,i,{nullOverride:c,mergeArrays:!1})},e.applyToDefaultsWithShallow=function(a,i,r){const t=r.shallow;l(Array.isArray(t),"Invalid keys");const c=new Map,s=i===!0?null:new Set;for(let g of t){g=Array.isArray(g)?g:g.split(".");const w=m(a,g);w&&typeof w=="object"?c.set(w,s&&m(i,g)||w):s&&s.add(g)}const o=x(a,{},c);if(!s)return o;for(const g of s)e.reachCopy(o,i,g);const h=r.nullOverride!==void 0&&r.nullOverride;return b(o,i,{nullOverride:h,mergeArrays:!1})},e.reachCopy=function(a,i,r){for(const s of r){if(!(s in i))return;const o=i[s];if(typeof o!="object"||o===null)return;i=o}const t=i;let c=a;for(let s=0;s<r.length-1;++s){const o=r[s];typeof c[o]!="object"&&(c[o]={}),c=c[o]}c[r[r.length-1]]=t}},375:(L,p,_)=>{const l=_(7916);L.exports=function(x,...b){if(!x)throw b.length===1&&b[0]instanceof Error?b[0]:new l(b)}},8571:(L,p,_)=>{const l=_(9621),x=_(4277),b=_(7043),m={needsProtoHack:new Set([x.set,x.map,x.weakSet,x.weakMap])};L.exports=m.clone=function(e,a={},i=null){if(typeof e!="object"||e===null)return e;let r=m.clone,t=i;if(a.shallow){if(a.shallow!==!0)return m.cloneWithShallow(e,a);r=h=>h}else if(t){const h=t.get(e);if(h)return h}else t=new Map;const c=x.getInternalProto(e);if(c===x.buffer)return!1;if(c===x.date)return new Date(e.getTime());if(c===x.regex)return new RegExp(e);const s=m.base(e,c,a);if(s===e)return e;if(t&&t.set(e,s),c===x.set)for(const h of e)s.add(r(h,a,t));else if(c===x.map)for(const[h,g]of e)s.set(h,r(g,a,t));const o=b.keys(e,a);for(const h of o){if(h==="__proto__")continue;if(c===x.array&&h==="length"){s.length=e.length;continue}const g=Object.getOwnPropertyDescriptor(e,h);g?g.get||g.set?Object.defineProperty(s,h,g):g.enumerable?s[h]=r(e[h],a,t):Object.defineProperty(s,h,{enumerable:!1,writable:!0,configurable:!0,value:r(e[h],a,t)}):Object.defineProperty(s,h,{enumerable:!0,writable:!0,configurable:!0,value:r(e[h],a,t)})}return s},m.cloneWithShallow=function(e,a){const i=a.shallow;(a=Object.assign({},a)).shallow=!1;const r=new Map;for(const t of i){const c=l(e,t);typeof c!="object"&&typeof c!="function"||r.set(c,c)}return m.clone(e,a,r)},m.base=function(e,a,i){if(i.prototype===!1)return m.needsProtoHack.has(a)?new a.constructor:a===x.array?[]:{};const r=Object.getPrototypeOf(e);if(r&&r.isImmutable)return e;if(a===x.array){const t=[];return r!==a&&Object.setPrototypeOf(t,r),t}if(m.needsProtoHack.has(a)){const t=new r.constructor;return r!==a&&Object.setPrototypeOf(t,r),t}return Object.create(r)}},9474:(L,p,_)=>{const l=_(4277),x={mismatched:null};L.exports=function(b,m,e){return e=Object.assign({prototype:!0},e),!!x.isDeepEqual(b,m,e,[])},x.isDeepEqual=function(b,m,e,a){if(b===m)return b!==0||1/b==1/m;const i=typeof b;if(i!==typeof m||b===null||m===null)return!1;if(i==="function"){if(!e.deepFunction||b.toString()!==m.toString())return!1}else if(i!=="object")return b!=b&&m!=m;const r=x.getSharedType(b,m,!!e.prototype);switch(r){case l.buffer:return!1;case l.promise:return b===m;case l.regex:return b.toString()===m.toString();case x.mismatched:return!1}for(let t=a.length-1;t>=0;--t)if(a[t].isSame(b,m))return!0;a.push(new x.SeenEntry(b,m));try{return!!x.isDeepEqualObj(r,b,m,e,a)}finally{a.pop()}},x.getSharedType=function(b,m,e){if(e)return Object.getPrototypeOf(b)!==Object.getPrototypeOf(m)?x.mismatched:l.getInternalProto(b);const a=l.getInternalProto(b);return a!==l.getInternalProto(m)?x.mismatched:a},x.valueOf=function(b){const m=b.valueOf;if(m===void 0)return b;try{return m.call(b)}catch(e){return e}},x.hasOwnEnumerableProperty=function(b,m){return Object.prototype.propertyIsEnumerable.call(b,m)},x.isSetSimpleEqual=function(b,m){for(const e of Set.prototype.values.call(b))if(!Set.prototype.has.call(m,e))return!1;return!0},x.isDeepEqualObj=function(b,m,e,a,i){const{isDeepEqual:r,valueOf:t,hasOwnEnumerableProperty:c}=x,{keys:s,getOwnPropertySymbols:o}=Object;if(b===l.array){if(!a.part){if(m.length!==e.length)return!1;for(let j=0;j<m.length;++j)if(!r(m[j],e[j],a,i))return!1;return!0}for(const j of m)for(const f of e)if(r(j,f,a,i))return!0}else if(b===l.set){if(m.size!==e.size)return!1;if(!x.isSetSimpleEqual(m,e)){const j=new Set(Set.prototype.values.call(e));for(const f of Set.prototype.values.call(m)){if(j.delete(f))continue;let y=!1;for(const M of j)if(r(f,M,a,i)){j.delete(M),y=!0;break}if(!y)return!1}}}else if(b===l.map){if(m.size!==e.size)return!1;for(const[j,f]of Map.prototype.entries.call(m))if(f===void 0&&!Map.prototype.has.call(e,j)||!r(f,Map.prototype.get.call(e,j),a,i))return!1}else if(b===l.error&&(m.name!==e.name||m.message!==e.message))return!1;const h=t(m),g=t(e);if((m!==h||e!==g)&&!r(h,g,a,i))return!1;const w=s(m);if(!a.part&&w.length!==s(e).length&&!a.skip)return!1;let R=0;for(const j of w)if(a.skip&&a.skip.includes(j))e[j]===void 0&&++R;else if(!c(e,j)||!r(m[j],e[j],a,i))return!1;if(!a.part&&w.length-R!==s(e).length)return!1;if(a.symbols!==!1){const j=o(m),f=new Set(o(e));for(const y of j){if(!a.skip||!a.skip.includes(y)){if(c(m,y)){if(!c(e,y)||!r(m[y],e[y],a,i))return!1}else if(c(e,y))return!1}f.delete(y)}for(const y of f)if(c(e,y))return!1}return!0},x.SeenEntry=class{constructor(b,m){this.obj=b,this.ref=m}isSame(b,m){return this.obj===b&&this.ref===m}}},7916:(L,p,_)=>{const l=_(8761);L.exports=class extends Error{constructor(x){super(x.filter(b=>b!=="").map(b=>typeof b=="string"?b:b instanceof Error?b.message:l(b)).join(" ")||"Unknown error"),typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,p.assert)}}},5277:L=>{const p={};L.exports=function(_){if(!_)return"";let l="";for(let x=0;x<_.length;++x){const b=_.charCodeAt(x);p.isSafe(b)?l+=_[x]:l+=p.escapeHtmlChar(b)}return l},p.escapeHtmlChar=function(_){return p.namedHtml.get(_)||(_>=256?"&#"+_+";":`&#x${_.toString(16).padStart(2,"0")};`)},p.isSafe=function(_){return p.safeCharCodes.has(_)},p.namedHtml=new Map([[38,"&"],[60,"<"],[62,">"],[34,"""],[160," "],[162,"¢"],[163,"£"],[164,"¤"],[169,"©"],[174,"®"]]),p.safeCharCodes=function(){const _=new Set;for(let l=32;l<123;++l)(l>=97||l>=65&&l<=90||l>=48&&l<=57||l===32||l===46||l===44||l===45||l===58||l===95)&&_.add(l);return _}()},6064:L=>{L.exports=function(p){return p.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}},738:L=>{L.exports=function(){}},1687:(L,p,_)=>{const l=_(375),x=_(8571),b=_(7043),m={};L.exports=m.merge=function(e,a,i){if(l(e&&typeof e=="object","Invalid target value: must be an object"),l(a==null||typeof a=="object","Invalid source value: must be null, undefined, or an object"),!a)return e;if(i=Object.assign({nullOverride:!0,mergeArrays:!0},i),Array.isArray(a)){l(Array.isArray(e),"Cannot merge array onto an object"),i.mergeArrays||(e.length=0);for(let t=0;t<a.length;++t)e.push(x(a[t],{symbols:i.symbols}));return e}const r=b.keys(a,i);for(let t=0;t<r.length;++t){const c=r[t];if(c==="__proto__"||!Object.prototype.propertyIsEnumerable.call(a,c))continue;const s=a[c];if(s&&typeof s=="object"){if(e[c]===s)continue;!e[c]||typeof e[c]!="object"||Array.isArray(e[c])!==Array.isArray(s)||s instanceof Date||s instanceof RegExp?e[c]=x(s,{symbols:i.symbols}):m.merge(e[c],s,i)}else(s!=null||i.nullOverride)&&(e[c]=s)}return e}},9621:(L,p,_)=>{const l=_(375),x={};L.exports=function(b,m,e){if(m===!1||m==null)return b;typeof(e=e||{})=="string"&&(e={separator:e});const a=Array.isArray(m);l(!a||!e.separator,"Separator option is not valid for array-based chain");const i=a?m:m.split(e.separator||".");let r=b;for(let t=0;t<i.length;++t){let c=i[t];const s=e.iterables&&x.iterables(r);if(Array.isArray(r)||s==="set"){const o=Number(c);Number.isInteger(o)&&(c=o<0?r.length+o:o)}if(!r||typeof r=="function"&&e.functions===!1||!s&&r[c]===void 0){l(!e.strict||t+1===i.length,"Missing segment",c,"in reach path ",m),l(typeof r=="object"||e.functions===!0||typeof r!="function","Invalid segment",c,"in reach path ",m),r=e.default;break}r=s?s==="set"?[...r][c]:r.get(c):r[c]}return r},x.iterables=function(b){return b instanceof Set?"set":b instanceof Map?"map":void 0}},8761:L=>{L.exports=function(...p){try{return JSON.stringify(...p)}catch(_){return"[Cannot display object: "+_.message+"]"}}},4277:(L,p)=>{const _={};p=L.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},_.typeMap=new Map([["[object Error]",p.error],["[object Map]",p.map],["[object Promise]",p.promise],["[object Set]",p.set],["[object WeakMap]",p.weakMap],["[object WeakSet]",p.weakSet]]),p.getInternalProto=function(l){if(Array.isArray(l))return p.array;if(l instanceof Date)return p.date;if(l instanceof RegExp)return p.regex;if(l instanceof Error)return p.error;const x=Object.prototype.toString.call(l);return _.typeMap.get(x)||p.generic}},7043:(L,p)=>{p.keys=function(_,l={}){return l.symbols!==!1?Reflect.ownKeys(_):Object.getOwnPropertyNames(_)}},3652:(L,p,_)=>{const l=_(375),x={};p.Sorter=class{constructor(){this._items=[],this.nodes=[]}add(b,m){const e=[].concat((m=m||{}).before||[]),a=[].concat(m.after||[]),i=m.group||"?",r=m.sort||0;l(!e.includes(i),`Item cannot come before itself: ${i}`),l(!e.includes("?"),"Item cannot come before unassociated items"),l(!a.includes(i),`Item cannot come after itself: ${i}`),l(!a.includes("?"),"Item cannot come after unassociated items"),Array.isArray(b)||(b=[b]);for(const t of b){const c={seq:this._items.length,sort:r,before:e,after:a,group:i,node:t};this._items.push(c)}if(!m.manual){const t=this._sort();l(t,"item",i!=="?"?`added into group ${i}`:"","created a dependencies error")}return this.nodes}merge(b){Array.isArray(b)||(b=[b]);for(const e of b)if(e)for(const a of e._items)this._items.push(Object.assign({},a));this._items.sort(x.mergeSort);for(let e=0;e<this._items.length;++e)this._items[e].seq=e;const m=this._sort();return l(m,"merge created a dependencies error"),this.nodes}sort(){const b=this._sort();return l(b,"sort created a dependencies error"),this.nodes}_sort(){const b={},m=Object.create(null),e=Object.create(null);for(const c of this._items){const s=c.seq,o=c.group;e[o]=e[o]||[],e[o].push(s),b[s]=c.before;for(const h of c.after)m[h]=m[h]||[],m[h].push(s)}for(const c in b){const s=[];for(const o in b[c]){const h=b[c][o];e[h]=e[h]||[],s.push(...e[h])}b[c]=s}for(const c in m)if(e[c])for(const s of e[c])b[s].push(...m[c]);const a={};for(const c in b){const s=b[c];for(const o of s)a[o]=a[o]||[],a[o].push(c)}const i={},r=[];for(let c=0;c<this._items.length;++c){let s=c;if(a[c]){s=null;for(let o=0;o<this._items.length;++o){if(i[o]===!0)continue;a[o]||(a[o]=[]);const h=a[o].length;let g=0;for(let w=0;w<h;++w)i[a[o][w]]&&++g;if(g===h){s=o;break}}}s!==null&&(i[s]=!0,r.push(s))}if(r.length!==this._items.length)return!1;const t={};for(const c of this._items)t[c.seq]=c;this._items=[],this.nodes=[];for(const c of r){const s=t[c];this.nodes.push(s.node),this._items.push(s)}return!0}},x.mergeSort=(b,m)=>b.sort===m.sort?0:b.sort<m.sort?-1:1},5380:(L,p,_)=>{const l=_(443),x=_(2178),b={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:l.URL||URL};p.analyze=function(m,e={}){if(!m)return x.code("DOMAIN_NON_EMPTY_STRING");if(typeof m!="string")throw new Error("Invalid input: domain must be a string");if(m.length>256)return x.code("DOMAIN_TOO_LONG");if(b.nonAsciiRx.test(m)){if(e.allowUnicode===!1)return x.code("DOMAIN_INVALID_UNICODE_CHARS");m=m.normalize("NFC")}if(b.domainControlRx.test(m))return x.code("DOMAIN_INVALID_CHARS");m=b.punycode(m),e.allowFullyQualified&&m[m.length-1]==="."&&(m=m.slice(0,-1));const a=e.minDomainSegments||b.minDomainSegments,i=m.split(".");if(i.length<a)return x.code("DOMAIN_SEGMENTS_COUNT");if(e.maxDomainSegments&&i.length>e.maxDomainSegments)return x.code("DOMAIN_SEGMENTS_COUNT_MAX");const r=e.tlds;if(r){const t=i[i.length-1].toLowerCase();if(r.deny&&r.deny.has(t)||r.allow&&!r.allow.has(t))return x.code("DOMAIN_FORBIDDEN_TLDS")}for(let t=0;t<i.length;++t){const c=i[t];if(!c.length)return x.code("DOMAIN_EMPTY_SEGMENT");if(c.length>63)return x.code("DOMAIN_LONG_SEGMENT");if(t<i.length-1){if(!b.domainSegmentRx.test(c))return x.code("DOMAIN_INVALID_CHARS")}else if(!b.tldSegmentRx.test(c))return x.code("DOMAIN_INVALID_TLDS_CHARS")}return null},p.isValid=function(m,e){return!p.analyze(m,e)},b.punycode=function(m){m.includes("%")&&(m=m.replace(/%/g,"%25"));try{return new b.URL(`http://${m}`).host}catch{return m}}},1745:(L,p,_)=>{const l=_(9848),x=_(5380),b=_(2178),m={nonAsciiRx:/[^\x00-\x7f]/,encoder:new(l.TextEncoder||TextEncoder)};p.analyze=function(e,a){return m.email(e,a)},p.isValid=function(e,a){return!m.email(e,a)},m.email=function(e,a={}){if(typeof e!="string")throw new Error("Invalid input: email must be a string");if(!e)return b.code("EMPTY_STRING");const i=!m.nonAsciiRx.test(e);if(!i){if(a.allowUnicode===!1)return b.code("FORBIDDEN_UNICODE");e=e.normalize("NFC")}const r=e.split("@");if(r.length!==2)return r.length>2?b.code("MULTIPLE_AT_CHAR"):b.code("MISSING_AT_CHAR");const[t,c]=r;if(!t)return b.code("EMPTY_LOCAL");if(!a.ignoreLength){if(e.length>254)return b.code("ADDRESS_TOO_LONG");if(m.encoder.encode(t).length>64)return b.code("LOCAL_TOO_LONG")}return m.local(t,i)||x.analyze(c,a)},m.local=function(e,a){const i=e.split(".");for(const r of i){if(!r.length)return b.code("EMPTY_LOCAL_SEGMENT");if(a){if(!m.atextRx.test(r))return b.code("INVALID_LOCAL_CHARS")}else for(const t of r){if(m.atextRx.test(t))continue;const c=m.binary(t);if(!m.atomRx.test(c))return b.code("INVALID_LOCAL_CHARS")}}},m.binary=function(e){return Array.from(m.encoder.encode(e)).map(a=>String.fromCharCode(a)).join("")},m.atextRx=/^[\w!#\$%&'\*\+\-/=\?\^`\{\|\}~]+$/,m.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:(L,p)=>{p.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"},p.code=function(_){return{code:_,error:p.codes[_]}}},9959:(L,p,_)=>{const l=_(375),x=_(5752);p.regex=function(b={}){l(b.cidr===void 0||typeof b.cidr=="string","options.cidr must be a string");const m=b.cidr?b.cidr.toLowerCase():"optional";l(["required","optional","forbidden"].includes(m),"options.cidr must be one of required, optional, forbidden"),l(b.version===void 0||typeof b.version=="string"||Array.isArray(b.version),"options.version must be a string or an array of string");let e=b.version||["ipv4","ipv6","ipvfuture"];Array.isArray(e)||(e=[e]),l(e.length>=1,"options.version must have at least 1 version specified");for(let r=0;r<e.length;++r)l(typeof e[r]=="string","options.version must only contain strings"),e[r]=e[r].toLowerCase(),l(["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(m==="forbidden")return x.ip[r];const t=`\\/${r==="ipv4"?x.ip.v4Cidr:x.ip.v6Cidr}`;return m==="required"?`${x.ip[r]}${t}`:`${x.ip[r]}(?:${t})?`}).join("|")})`,i=new RegExp(`^${a}$`);return{cidr:m,versions:e,regex:i,raw:a}}},5752:(L,p,_)=>{const l=_(375),x=_(6064),b={generate:function(){const m={},e="\\dA-Fa-f",a="["+e+"]",i="\\w-\\.~",r="!\\$&'\\(\\)\\*\\+,;=",t="%"+e,c=i+t+r+":@",s="["+c+"]",o="(?:0{0,2}\\d|0?[1-9]\\d|1\\d\\d|2[0-4]\\d|25[0-5])";m.ipv4address="(?:"+o+"\\.){3}"+o;const h=a+"{1,4}",g="(?:"+h+":"+h+"|"+m.ipv4address+")",w="(?:"+h+":){6}"+g,R="::(?:"+h+":){5}"+g,j="(?:"+h+")?::(?:"+h+":){4}"+g,f="(?:(?:"+h+":){0,1}"+h+")?::(?:"+h+":){3}"+g,y="(?:(?:"+h+":){0,2}"+h+")?::(?:"+h+":){2}"+g,M="(?:(?:"+h+":){0,3}"+h+")?::"+h+":"+g,E="(?:(?:"+h+":){0,4}"+h+")?::"+g,N="(?:(?:"+h+":){0,5}"+h+")?::"+h,$="(?:(?:"+h+":){0,6}"+h+")?::";m.ipv4Cidr="(?:\\d|[1-2]\\d|3[0-2])",m.ipv6Cidr="(?:0{0,2}\\d|0?[1-9]\\d|1[01]\\d|12[0-8])",m.ipv6address="(?:"+w+"|"+R+"|"+j+"|"+f+"|"+y+"|"+M+"|"+E+"|"+N+"|"+$+")",m.ipvFuture="v"+a+"+\\.["+i+r+":]+",m.scheme="[a-zA-Z][a-zA-Z\\d+-\\.]*",m.schemeRegex=new RegExp(m.scheme);const n="["+i+t+r+":]*",d="["+i+t+r+"]{1,255}",v="(?:\\[(?:"+m.ipv6address+"|"+m.ipvFuture+")\\]|"+m.ipv4address+"|"+d+")",k="(?:"+n+"@)?"+v+"(?::\\d*)?",A="(?:"+n+"@)?("+v+")(?::\\d*)?",D=s+"*",C=s+"+",S="(?:\\/"+D+")*",u="\\/(?:"+C+S+")?",O=C+S,z="["+i+t+r+"@]+"+S,F="(?:\\/\\/\\/"+D+S+")";return m.hierPart="(?:(?:\\/\\/"+k+S+")|"+u+"|"+O+"|"+F+")",m.hierPartCapture="(?:(?:\\/\\/"+A+S+")|"+u+"|"+O+")",m.relativeRef="(?:(?:\\/\\/"+k+S+")|"+u+"|"+z+"|)",m.relativeRefCapture="(?:(?:\\/\\/"+A+S+")|"+u+"|"+z+"|)",m.query="["+c+"\\/\\?]*(?=#|$)",m.queryWithSquareBrackets="["+c+"\\[\\]\\/\\?]*(?=#|$)",m.fragment="["+c+"\\/\\?]*",m}};b.rfc3986=b.generate(),p.ip={v4Cidr:b.rfc3986.ipv4Cidr,v6Cidr:b.rfc3986.ipv6Cidr,ipv4:b.rfc3986.ipv4address,ipv6:b.rfc3986.ipv6address,ipvfuture:b.rfc3986.ipvFuture},b.createRegex=function(m){const e=b.rfc3986,a="(?:\\?"+(m.allowQuerySquareBrackets?e.queryWithSquareBrackets:e.query)+")?(?:#"+e.fragment+")?",i=m.domain?e.relativeRefCapture:e.relativeRef;if(m.relativeOnly)return b.wrap(i+a);let r="";if(m.scheme){l(m.scheme instanceof RegExp||typeof m.scheme=="string"||Array.isArray(m.scheme),"scheme must be a RegExp, String, or Array");const s=[].concat(m.scheme);l(s.length>=1,"scheme must have at least 1 scheme specified");const o=[];for(let h=0;h<s.length;++h){const g=s[h];l(g instanceof RegExp||typeof g=="string","scheme at position "+h+" must be a RegExp or String"),g instanceof RegExp?o.push(g.source.toString()):(l(e.schemeRegex.test(g),"scheme at position "+h+" must be a valid scheme"),o.push(x(g)))}r=o.join("|")}const t="(?:"+(r?"(?:"+r+")":e.scheme)+":"+(m.domain?e.hierPartCapture:e.hierPart)+")",c=m.allowRelative?"(?:"+t+"|"+i+")":t;return b.wrap(c+a,r)},b.wrap=function(m,e){return{raw:m=`(?=.)(?!https?:/(?:$|[^/]))(?!https?:///)(?!https?:[^/])${m}`,regex:new RegExp(`^${m}$`),scheme:e}},b.uriRegex=b.createRegex({}),p.regex=function(m={}){return m.scheme||m.allowRelative||m.relativeOnly||m.allowQuerySquareBrackets||m.domain?b.createRegex(m):b.uriRegex}},1447:(L,p)=>{const _={operators:["!","^","*","/","%","+","-","<","<=",">",">=","==","!=","&&","||","??"],operatorCharacters:["!","^","*","/","%","+","-","<","=",">","&","|","?"],operatorsOrder:[["^"],["*","/","%"],["+","-"],["<","<=",">",">="],["==","!="],["&&"],["||","??"]],operatorsPrefix:["!","n"],literals:{'"':'"',"`":"`","'":"'","[":"]"},numberRx:/^(?:[0-9]*(\.[0-9]*)?){1}$/,tokenRx:/^[\w\$\#\.\@\:\{\}]+$/,symbol:Symbol("formula"),settings:Symbol("settings")};p.Parser=class{constructor(l,x={}){if(!x[_.settings]&&x.constants)for(const b in x.constants){const m=x.constants[b];if(m!==null&&!["boolean","number","string"].includes(typeof m))throw new Error(`Formula constant ${b} contains invalid ${typeof m} value type`)}this.settings=x[_.settings]?x:Object.assign({[_.settings]:!0,constants:{},functions:{}},x),this.single=null,this._parts=null,this._parse(l)}_parse(l){let x=[],b="",m=0,e=!1;const a=r=>{if(m)throw new Error("Formula missing closing parenthesis");const t=x.length?x[x.length-1]:null;if(e||b||r){if(t&&t.type==="reference"&&r===")")return t.type="function",t.value=this._subFormula(b,t.value),void(b="");if(r===")"){const c=new p.Parser(b,this.settings);x.push({type:"segment",value:c})}else if(e){if(e==="]")return x.push({type:"reference",value:b}),void(b="");x.push({type:"literal",value:b})}else if(_.operatorCharacters.includes(b))t&&t.type==="operator"&&_.operators.includes(t.value+b)?t.value+=b:x.push({type:"operator",value:b});else if(b.match(_.numberRx))x.push({type:"constant",value:parseFloat(b)});else if(this.settings.constants[b]!==void 0)x.push({type:"constant",value:this.settings.constants[b]});else{if(!b.match(_.tokenRx))throw new Error(`Formula contains invalid token: ${b}`);x.push({type:"reference",value:b})}b=""}};for(const r of l)e?r===e?(a(),e=!1):b+=r:m?r==="("?(b+=r,++m):r===")"?(--m,m?b+=r:a(r)):b+=r:r in _.literals?e=_.literals[r]:r==="("?(a(),++m):_.operatorCharacters.includes(r)?(a(),b=r,a()):r!==" "?b+=r:a();a(),x=x.map((r,t)=>r.type!=="operator"||r.value!=="-"||t&&x[t-1].type!=="operator"?r:{type:"operator",value:"n"});let i=!1;for(const r of x){if(r.type==="operator"){if(_.operatorsPrefix.includes(r.value))continue;if(!i)throw new Error("Formula contains an operator in invalid position");if(!_.operators.includes(r.value))throw new Error(`Formula contains an unknown operator ${r.value}`)}else if(i)throw new Error("Formula missing expected operator");i=!i}if(!i)throw new Error("Formula contains invalid trailing operator");x.length===1&&["reference","literal","constant"].includes(x[0].type)&&(this.single={type:x[0].type==="reference"?"reference":"value",value:x[0].value}),this._parts=x.map(r=>{if(r.type==="operator")return _.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):_.reference(r.value)})}_subFormula(l,x){const b=this.settings.functions[x];if(typeof b!="function")throw new Error(`Formula contains unknown function ${x}`);let m=[];if(l){let e="",a=0,i=!1;const r=()=>{if(!e)throw new Error(`Formula contains function ${x} with invalid arguments ${l}`);m.push(e),e=""};for(let t=0;t<l.length;++t){const c=l[t];i?(e+=c,c===i&&(i=!1)):c in _.literals&&!a?(e+=c,i=_.literals[c]):c!==","||a?(e+=c,c==="("?++a:c===")"&&--a):r()}r()}return m=m.map(e=>new p.Parser(e,this.settings)),function(e){const a=[];for(const i of m)a.push(i.evaluate(e));return b.call(e,...a)}}evaluate(l){const x=this._parts.slice();for(let b=x.length-2;b>=0;--b){const m=x[b];if(m&&m.type==="operator"){const e=x[b+1];x.splice(b+1,1);const a=_.evaluate(e,l);x[b]=_.single(m.value,a)}}return _.operatorsOrder.forEach(b=>{for(let m=1;m<x.length-1;)if(b.includes(x[m])){const e=x[m],a=_.evaluate(x[m-1],l),i=_.evaluate(x[m+1],l);x.splice(m,2);const r=_.calculate(e,a,i);x[m-1]=r===0?0:r}else m+=2}),_.evaluate(x[0],l)}},p.Parser.prototype[_.symbol]=!0,_.reference=function(l){return function(x){return x&&x[l]!==void 0?x[l]:null}},_.evaluate=function(l,x){return l===null?null:typeof l=="function"?l(x):l[_.symbol]?l.evaluate(x):l},_.single=function(l,x){if(l==="!")return!x;const b=-x;return b===0?0:b},_.calculate=function(l,x,b){if(l==="??")return _.exists(x)?x:b;if(typeof x=="string"||typeof b=="string"){if(l==="+")return(x=_.exists(x)?x:"")+(_.exists(b)?b:"")}else switch(l){case"^":return Math.pow(x,b);case"*":return x*b;case"/":return x/b;case"%":return x%b;case"+":return x+b;case"-":return x-b}switch(l){case"<":return x<b;case"<=":return x<=b;case">":return x>b;case">=":return x>=b;case"==":return x===b;case"!=":return x!==b;case"&&":return x&&b;case"||":return x||b}return null},_.exists=function(l){return l!=null}},9926:()=>{},5688:()=>{},9708:()=>{},1152:()=>{},443:()=>{},9848:()=>{},5934:L=>{L.exports=JSON.parse('{"version":"17.13.3"}')}},T={},function L(p){var _=T[p];if(_!==void 0)return _.exports;var l=T[p]={exports:{}};return B[p](l,l.exports,L),l.exports}(5107);var B,T})})(fr);var Gr=fr.exports,Ot={},Et={exports:{}};Et.exports;(function(I){(function(P,B){function T($,n){if(!$)throw new Error(n||"Assertion failed")}function L($,n){$.super_=n;var d=function(){};d.prototype=n.prototype,$.prototype=new d,$.prototype.constructor=$}function p($,n,d){if(p.isBN($))return $;this.negative=0,this.words=null,this.length=0,this.red=null,$!==null&&((n==="le"||n==="be")&&(d=n,n=10),this._init($||0,n||10,d||"be"))}typeof P=="object"?P.exports=p:B.BN=p,p.BN=p,p.wordSize=26;var _;try{typeof window<"u"&&typeof window.Buffer<"u"?_=window.Buffer:_=Tr.Buffer}catch{}p.isBN=function(n){return n instanceof p?!0:n!==null&&typeof n=="object"&&n.constructor.wordSize===p.wordSize&&Array.isArray(n.words)},p.max=function(n,d){return n.cmp(d)>0?n:d},p.min=function(n,d){return n.cmp(d)<0?n:d},p.prototype._init=function(n,d,v){if(typeof n=="number")return this._initNumber(n,d,v);if(typeof n=="object")return this._initArray(n,d,v);d==="hex"&&(d=16),T(d===(d|0)&&d>=2&&d<=36),n=n.toString().replace(/\s+/g,"");var k=0;n[0]==="-"&&(k++,this.negative=1),k<n.length&&(d===16?this._parseHex(n,k,v):(this._parseBase(n,d,k),v==="le"&&this._initArray(this.toArray(),d,v)))},p.prototype._initNumber=function(n,d,v){n<0&&(this.negative=1,n=-n),n<67108864?(this.words=[n&67108863],this.length=1):n<4503599627370496?(this.words=[n&67108863,n/67108864&67108863],this.length=2):(T(n<9007199254740992),this.words=[n&67108863,n/67108864&67108863,1],this.length=3),v==="le"&&this._initArray(this.toArray(),d,v)},p.prototype._initArray=function(n,d,v){if(T(typeof n.length=="number"),n.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(n.length/3),this.words=new Array(this.length);for(var k=0;k<this.length;k++)this.words[k]=0;var A,D,C=0;if(v==="be")for(k=n.length-1,A=0;k>=0;k-=3)D=n[k]|n[k-1]<<8|n[k-2]<<16,this.words[A]|=D<<C&67108863,this.words[A+1]=D>>>26-C&67108863,C+=24,C>=26&&(C-=26,A++);else if(v==="le")for(k=0,A=0;k<n.length;k+=3)D=n[k]|n[k+1]<<8|n[k+2]<<16,this.words[A]|=D<<C&67108863,this.words[A+1]=D>>>26-C&67108863,C+=24,C>=26&&(C-=26,A++);return this._strip()};function l($,n){var d=$.charCodeAt(n);if(d>=48&&d<=57)return d-48;if(d>=65&&d<=70)return d-55;if(d>=97&&d<=102)return d-87;T(!1,"Invalid character in "+$)}function x($,n,d){var v=l($,d);return d-1>=n&&(v|=l($,d-1)<<4),v}p.prototype._parseHex=function(n,d,v){this.length=Math.ceil((n.length-d)/6),this.words=new Array(this.length);for(var k=0;k<this.length;k++)this.words[k]=0;var A=0,D=0,C;if(v==="be")for(k=n.length-1;k>=d;k-=2)C=x(n,d,k)<<A,this.words[D]|=C&67108863,A>=18?(A-=18,D+=1,this.words[D]|=C>>>26):A+=8;else{var S=n.length-d;for(k=S%2===0?d+1:d;k<n.length;k+=2)C=x(n,d,k)<<A,this.words[D]|=C&67108863,A>=18?(A-=18,D+=1,this.words[D]|=C>>>26):A+=8}this._strip()};function b($,n,d,v){for(var k=0,A=0,D=Math.min($.length,d),C=n;C<D;C++){var S=$.charCodeAt(C)-48;k*=v,S>=49?A=S-49+10:S>=17?A=S-17+10:A=S,T(S>=0&&A<v,"Invalid character"),k+=A}return k}p.prototype._parseBase=function(n,d,v){this.words=[0],this.length=1;for(var k=0,A=1;A<=67108863;A*=d)k++;k--,A=A/d|0;for(var D=n.length-v,C=D%k,S=Math.min(D,D-C)+v,u=0,O=v;O<S;O+=k)u=b(n,O,O+k,d),this.imuln(A),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u);if(C!==0){var z=1;for(u=b(n,O,n.length,d),O=0;O<C;O++)z*=d;this.imuln(z),this.words[0]+u<67108864?this.words[0]+=u:this._iaddn(u)}this._strip()},p.prototype.copy=function(n){n.words=new Array(this.length);for(var d=0;d<this.length;d++)n.words[d]=this.words[d];n.length=this.length,n.negative=this.negative,n.red=this.red};function m($,n){$.words=n.words,$.length=n.length,$.negative=n.negative,$.red=n.red}if(p.prototype._move=function(n){m(n,this)},p.prototype.clone=function(){var n=new p(null);return this.copy(n),n},p.prototype._expand=function(n){for(;this.length<n;)this.words[this.length++]=0;return this},p.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},p.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{p.prototype[Symbol.for("nodejs.util.inspect.custom")]=e}catch{p.prototype.inspect=e}else p.prototype.inspect=e;function e(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var a=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],i=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],r=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];p.prototype.toString=function(n,d){n=n||10,d=d|0||1;var v;if(n===16||n==="hex"){v="";for(var k=0,A=0,D=0;D<this.length;D++){var C=this.words[D],S=((C<<k|A)&16777215).toString(16);A=C>>>24-k&16777215,k+=2,k>=26&&(k-=26,D--),A!==0||D!==this.length-1?v=a[6-S.length]+S+v:v=S+v}for(A!==0&&(v=A.toString(16)+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}if(n===(n|0)&&n>=2&&n<=36){var u=i[n],O=r[n];v="";var z=this.clone();for(z.negative=0;!z.isZero();){var F=z.modrn(O).toString(n);z=z.idivn(O),z.isZero()?v=F+v:v=a[u-F.length]+F+v}for(this.isZero()&&(v="0"+v);v.length%d!==0;)v="0"+v;return this.negative!==0&&(v="-"+v),v}T(!1,"Base should be between 2 and 36")},p.prototype.toNumber=function(){var n=this.words[0];return this.length===2?n+=this.words[1]*67108864:this.length===3&&this.words[2]===1?n+=4503599627370496+this.words[1]*67108864:this.length>2&&T(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-n:n},p.prototype.toJSON=function(){return this.toString(16,2)},_&&(p.prototype.toBuffer=function(n,d){return this.toArrayLike(_,n,d)}),p.prototype.toArray=function(n,d){return this.toArrayLike(Array,n,d)};var t=function(n,d){return n.allocUnsafe?n.allocUnsafe(d):new n(d)};p.prototype.toArrayLike=function(n,d,v){this._strip();var k=this.byteLength(),A=v||Math.max(1,k);T(k<=A,"byte array longer than desired length"),T(A>0,"Requested array length <= 0");var D=t(n,A),C=d==="le"?"LE":"BE";return this["_toArrayLike"+C](D,k),D},p.prototype._toArrayLikeLE=function(n,d){for(var v=0,k=0,A=0,D=0;A<this.length;A++){var C=this.words[A]<<D|k;n[v++]=C&255,v<n.length&&(n[v++]=C>>8&255),v<n.length&&(n[v++]=C>>16&255),D===6?(v<n.length&&(n[v++]=C>>24&255),k=0,D=0):(k=C>>>24,D+=2)}if(v<n.length)for(n[v++]=k;v<n.length;)n[v++]=0},p.prototype._toArrayLikeBE=function(n,d){for(var v=n.length-1,k=0,A=0,D=0;A<this.length;A++){var C=this.words[A]<<D|k;n[v--]=C&255,v>=0&&(n[v--]=C>>8&255),v>=0&&(n[v--]=C>>16&255),D===6?(v>=0&&(n[v--]=C>>24&255),k=0,D=0):(k=C>>>24,D+=2)}if(v>=0)for(n[v--]=k;v>=0;)n[v--]=0},Math.clz32?p.prototype._countBits=function(n){return 32-Math.clz32(n)}:p.prototype._countBits=function(n){var d=n,v=0;return d>=4096&&(v+=13,d>>>=13),d>=64&&(v+=7,d>>>=7),d>=8&&(v+=4,d>>>=4),d>=2&&(v+=2,d>>>=2),v+d},p.prototype._zeroBits=function(n){if(n===0)return 26;var d=n,v=0;return d&8191||(v+=13,d>>>=13),d&127||(v+=7,d>>>=7),d&15||(v+=4,d>>>=4),d&3||(v+=2,d>>>=2),d&1||v++,v},p.prototype.bitLength=function(){var n=this.words[this.length-1],d=this._countBits(n);return(this.length-1)*26+d};function c($){for(var n=new Array($.bitLength()),d=0;d<n.length;d++){var v=d/26|0,k=d%26;n[d]=$.words[v]>>>k&1}return n}p.prototype.zeroBits=function(){if(this.isZero())return 0;for(var n=0,d=0;d<this.length;d++){var v=this._zeroBits(this.words[d]);if(n+=v,v!==26)break}return n},p.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},p.prototype.toTwos=function(n){return this.negative!==0?this.abs().inotn(n).iaddn(1):this.clone()},p.prototype.fromTwos=function(n){return this.testn(n-1)?this.notn(n).iaddn(1).ineg():this.clone()},p.prototype.isNeg=function(){return this.negative!==0},p.prototype.neg=function(){return this.clone().ineg()},p.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},p.prototype.iuor=function(n){for(;this.length<n.length;)this.words[this.length++]=0;for(var d=0;d<n.length;d++)this.words[d]=this.words[d]|n.words[d];return this._strip()},p.prototype.ior=function(n){return T((this.negative|n.negative)===0),this.iuor(n)},p.prototype.or=function(n){return this.length>n.length?this.clone().ior(n):n.clone().ior(this)},p.prototype.uor=function(n){return this.length>n.length?this.clone().iuor(n):n.clone().iuor(this)},p.prototype.iuand=function(n){var d;this.length>n.length?d=n:d=this;for(var v=0;v<d.length;v++)this.words[v]=this.words[v]&n.words[v];return this.length=d.length,this._strip()},p.prototype.iand=function(n){return T((this.negative|n.negative)===0),this.iuand(n)},p.prototype.and=function(n){return this.length>n.length?this.clone().iand(n):n.clone().iand(this)},p.prototype.uand=function(n){return this.length>n.length?this.clone().iuand(n):n.clone().iuand(this)},p.prototype.iuxor=function(n){var d,v;this.length>n.length?(d=this,v=n):(d=n,v=this);for(var k=0;k<v.length;k++)this.words[k]=d.words[k]^v.words[k];if(this!==d)for(;k<d.length;k++)this.words[k]=d.words[k];return this.length=d.length,this._strip()},p.prototype.ixor=function(n){return T((this.negative|n.negative)===0),this.iuxor(n)},p.prototype.xor=function(n){return this.length>n.length?this.clone().ixor(n):n.clone().ixor(this)},p.prototype.uxor=function(n){return this.length>n.length?this.clone().iuxor(n):n.clone().iuxor(this)},p.prototype.inotn=function(n){T(typeof n=="number"&&n>=0);var d=Math.ceil(n/26)|0,v=n%26;this._expand(d),v>0&&d--;for(var k=0;k<d;k++)this.words[k]=~this.words[k]&67108863;return v>0&&(this.words[k]=~this.words[k]&67108863>>26-v),this._strip()},p.prototype.notn=function(n){return this.clone().inotn(n)},p.prototype.setn=function(n,d){T(typeof n=="number"&&n>=0);var v=n/26|0,k=n%26;return this._expand(v+1),d?this.words[v]=this.words[v]|1<<k:this.words[v]=this.words[v]&~(1<<k),this._strip()},p.prototype.iadd=function(n){var d;if(this.negative!==0&&n.negative===0)return this.negative=0,d=this.isub(n),this.negative^=1,this._normSign();if(this.negative===0&&n.negative!==0)return n.negative=0,d=this.isub(n),n.negative=1,d._normSign();var v,k;this.length>n.length?(v=this,k=n):(v=n,k=this);for(var A=0,D=0;D<k.length;D++)d=(v.words[D]|0)+(k.words[D]|0)+A,this.words[D]=d&67108863,A=d>>>26;for(;A!==0&&D<v.length;D++)d=(v.words[D]|0)+A,this.words[D]=d&67108863,A=d>>>26;if(this.length=v.length,A!==0)this.words[this.length]=A,this.length++;else if(v!==this)for(;D<v.length;D++)this.words[D]=v.words[D];return this},p.prototype.add=function(n){var d;return n.negative!==0&&this.negative===0?(n.negative=0,d=this.sub(n),n.negative^=1,d):n.negative===0&&this.negative!==0?(this.negative=0,d=n.sub(this),this.negative=1,d):this.length>n.length?this.clone().iadd(n):n.clone().iadd(this)},p.prototype.isub=function(n){if(n.negative!==0){n.negative=0;var d=this.iadd(n);return n.negative=1,d._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(n),this.negative=1,this._normSign();var v=this.cmp(n);if(v===0)return this.negative=0,this.length=1,this.words[0]=0,this;var k,A;v>0?(k=this,A=n):(k=n,A=this);for(var D=0,C=0;C<A.length;C++)d=(k.words[C]|0)-(A.words[C]|0)+D,D=d>>26,this.words[C]=d&67108863;for(;D!==0&&C<k.length;C++)d=(k.words[C]|0)+D,D=d>>26,this.words[C]=d&67108863;if(D===0&&C<k.length&&k!==this)for(;C<k.length;C++)this.words[C]=k.words[C];return this.length=Math.max(this.length,C),k!==this&&(this.negative=1),this._strip()},p.prototype.sub=function(n){return this.clone().isub(n)};function s($,n,d){d.negative=n.negative^$.negative;var v=$.length+n.length|0;d.length=v,v=v-1|0;var k=$.words[0]|0,A=n.words[0]|0,D=k*A,C=D&67108863,S=D/67108864|0;d.words[0]=C;for(var u=1;u<v;u++){for(var O=S>>>26,z=S&67108863,F=Math.min(u,n.length-1),J=Math.max(0,u-$.length+1);J<=F;J++){var K=u-J|0;k=$.words[K]|0,A=n.words[J]|0,D=k*A+z,O+=D/67108864|0,z=D&67108863}d.words[u]=z|0,S=O|0}return S!==0?d.words[u]=S|0:d.length--,d._strip()}var o=function(n,d,v){var k=n.words,A=d.words,D=v.words,C=0,S,u,O,z=k[0]|0,F=z&8191,J=z>>>13,K=k[1]|0,V=K&8191,W=K>>>13,It=k[2]|0,Z=It&8191,H=It>>>13,Tt=k[3]|0,G=Tt&8191,Y=Tt>>>13,Lt=k[4]|0,Q=Lt&8191,X=Lt>>>13,qt=k[5]|0,ee=qt&8191,te=qt>>>13,Nt=k[6]|0,re=Nt&8191,se=Nt>>>13,Pt=k[7]|0,ne=Pt&8191,ie=Pt>>>13,zt=k[8]|0,ae=zt&8191,oe=zt>>>13,Ft=k[9]|0,le=Ft&8191,ce=Ft>>>13,Bt=A[0]|0,ue=Bt&8191,fe=Bt>>>13,Jt=A[1]|0,he=Jt&8191,de=Jt>>>13,Ut=A[2]|0,me=Ut&8191,pe=Ut>>>13,Vt=A[3]|0,ge=Vt&8191,ye=Vt>>>13,Wt=A[4]|0,ve=Wt&8191,be=Wt>>>13,Kt=A[5]|0,_e=Kt&8191,we=Kt>>>13,Zt=A[6]|0,xe=Zt&8191,Me=Zt>>>13,Ht=A[7]|0,$e=Ht&8191,ke=Ht>>>13,Gt=A[8]|0,je=Gt&8191,Se=Gt>>>13,Yt=A[9]|0,Re=Yt&8191,Ae=Yt>>>13;v.negative=n.negative^d.negative,v.length=19,S=Math.imul(F,ue),u=Math.imul(F,fe),u=u+Math.imul(J,ue)|0,O=Math.imul(J,fe);var Qe=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(Qe>>>26)|0,Qe&=67108863,S=Math.imul(V,ue),u=Math.imul(V,fe),u=u+Math.imul(W,ue)|0,O=Math.imul(W,fe),S=S+Math.imul(F,he)|0,u=u+Math.imul(F,de)|0,u=u+Math.imul(J,he)|0,O=O+Math.imul(J,de)|0;var Xe=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,S=Math.imul(Z,ue),u=Math.imul(Z,fe),u=u+Math.imul(H,ue)|0,O=Math.imul(H,fe),S=S+Math.imul(V,he)|0,u=u+Math.imul(V,de)|0,u=u+Math.imul(W,he)|0,O=O+Math.imul(W,de)|0,S=S+Math.imul(F,me)|0,u=u+Math.imul(F,pe)|0,u=u+Math.imul(J,me)|0,O=O+Math.imul(J,pe)|0;var et=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(et>>>26)|0,et&=67108863,S=Math.imul(G,ue),u=Math.imul(G,fe),u=u+Math.imul(Y,ue)|0,O=Math.imul(Y,fe),S=S+Math.imul(Z,he)|0,u=u+Math.imul(Z,de)|0,u=u+Math.imul(H,he)|0,O=O+Math.imul(H,de)|0,S=S+Math.imul(V,me)|0,u=u+Math.imul(V,pe)|0,u=u+Math.imul(W,me)|0,O=O+Math.imul(W,pe)|0,S=S+Math.imul(F,ge)|0,u=u+Math.imul(F,ye)|0,u=u+Math.imul(J,ge)|0,O=O+Math.imul(J,ye)|0;var tt=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(tt>>>26)|0,tt&=67108863,S=Math.imul(Q,ue),u=Math.imul(Q,fe),u=u+Math.imul(X,ue)|0,O=Math.imul(X,fe),S=S+Math.imul(G,he)|0,u=u+Math.imul(G,de)|0,u=u+Math.imul(Y,he)|0,O=O+Math.imul(Y,de)|0,S=S+Math.imul(Z,me)|0,u=u+Math.imul(Z,pe)|0,u=u+Math.imul(H,me)|0,O=O+Math.imul(H,pe)|0,S=S+Math.imul(V,ge)|0,u=u+Math.imul(V,ye)|0,u=u+Math.imul(W,ge)|0,O=O+Math.imul(W,ye)|0,S=S+Math.imul(F,ve)|0,u=u+Math.imul(F,be)|0,u=u+Math.imul(J,ve)|0,O=O+Math.imul(J,be)|0;var rt=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(rt>>>26)|0,rt&=67108863,S=Math.imul(ee,ue),u=Math.imul(ee,fe),u=u+Math.imul(te,ue)|0,O=Math.imul(te,fe),S=S+Math.imul(Q,he)|0,u=u+Math.imul(Q,de)|0,u=u+Math.imul(X,he)|0,O=O+Math.imul(X,de)|0,S=S+Math.imul(G,me)|0,u=u+Math.imul(G,pe)|0,u=u+Math.imul(Y,me)|0,O=O+Math.imul(Y,pe)|0,S=S+Math.imul(Z,ge)|0,u=u+Math.imul(Z,ye)|0,u=u+Math.imul(H,ge)|0,O=O+Math.imul(H,ye)|0,S=S+Math.imul(V,ve)|0,u=u+Math.imul(V,be)|0,u=u+Math.imul(W,ve)|0,O=O+Math.imul(W,be)|0,S=S+Math.imul(F,_e)|0,u=u+Math.imul(F,we)|0,u=u+Math.imul(J,_e)|0,O=O+Math.imul(J,we)|0;var st=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(st>>>26)|0,st&=67108863,S=Math.imul(re,ue),u=Math.imul(re,fe),u=u+Math.imul(se,ue)|0,O=Math.imul(se,fe),S=S+Math.imul(ee,he)|0,u=u+Math.imul(ee,de)|0,u=u+Math.imul(te,he)|0,O=O+Math.imul(te,de)|0,S=S+Math.imul(Q,me)|0,u=u+Math.imul(Q,pe)|0,u=u+Math.imul(X,me)|0,O=O+Math.imul(X,pe)|0,S=S+Math.imul(G,ge)|0,u=u+Math.imul(G,ye)|0,u=u+Math.imul(Y,ge)|0,O=O+Math.imul(Y,ye)|0,S=S+Math.imul(Z,ve)|0,u=u+Math.imul(Z,be)|0,u=u+Math.imul(H,ve)|0,O=O+Math.imul(H,be)|0,S=S+Math.imul(V,_e)|0,u=u+Math.imul(V,we)|0,u=u+Math.imul(W,_e)|0,O=O+Math.imul(W,we)|0,S=S+Math.imul(F,xe)|0,u=u+Math.imul(F,Me)|0,u=u+Math.imul(J,xe)|0,O=O+Math.imul(J,Me)|0;var nt=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(nt>>>26)|0,nt&=67108863,S=Math.imul(ne,ue),u=Math.imul(ne,fe),u=u+Math.imul(ie,ue)|0,O=Math.imul(ie,fe),S=S+Math.imul(re,he)|0,u=u+Math.imul(re,de)|0,u=u+Math.imul(se,he)|0,O=O+Math.imul(se,de)|0,S=S+Math.imul(ee,me)|0,u=u+Math.imul(ee,pe)|0,u=u+Math.imul(te,me)|0,O=O+Math.imul(te,pe)|0,S=S+Math.imul(Q,ge)|0,u=u+Math.imul(Q,ye)|0,u=u+Math.imul(X,ge)|0,O=O+Math.imul(X,ye)|0,S=S+Math.imul(G,ve)|0,u=u+Math.imul(G,be)|0,u=u+Math.imul(Y,ve)|0,O=O+Math.imul(Y,be)|0,S=S+Math.imul(Z,_e)|0,u=u+Math.imul(Z,we)|0,u=u+Math.imul(H,_e)|0,O=O+Math.imul(H,we)|0,S=S+Math.imul(V,xe)|0,u=u+Math.imul(V,Me)|0,u=u+Math.imul(W,xe)|0,O=O+Math.imul(W,Me)|0,S=S+Math.imul(F,$e)|0,u=u+Math.imul(F,ke)|0,u=u+Math.imul(J,$e)|0,O=O+Math.imul(J,ke)|0;var it=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(it>>>26)|0,it&=67108863,S=Math.imul(ae,ue),u=Math.imul(ae,fe),u=u+Math.imul(oe,ue)|0,O=Math.imul(oe,fe),S=S+Math.imul(ne,he)|0,u=u+Math.imul(ne,de)|0,u=u+Math.imul(ie,he)|0,O=O+Math.imul(ie,de)|0,S=S+Math.imul(re,me)|0,u=u+Math.imul(re,pe)|0,u=u+Math.imul(se,me)|0,O=O+Math.imul(se,pe)|0,S=S+Math.imul(ee,ge)|0,u=u+Math.imul(ee,ye)|0,u=u+Math.imul(te,ge)|0,O=O+Math.imul(te,ye)|0,S=S+Math.imul(Q,ve)|0,u=u+Math.imul(Q,be)|0,u=u+Math.imul(X,ve)|0,O=O+Math.imul(X,be)|0,S=S+Math.imul(G,_e)|0,u=u+Math.imul(G,we)|0,u=u+Math.imul(Y,_e)|0,O=O+Math.imul(Y,we)|0,S=S+Math.imul(Z,xe)|0,u=u+Math.imul(Z,Me)|0,u=u+Math.imul(H,xe)|0,O=O+Math.imul(H,Me)|0,S=S+Math.imul(V,$e)|0,u=u+Math.imul(V,ke)|0,u=u+Math.imul(W,$e)|0,O=O+Math.imul(W,ke)|0,S=S+Math.imul(F,je)|0,u=u+Math.imul(F,Se)|0,u=u+Math.imul(J,je)|0,O=O+Math.imul(J,Se)|0;var at=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(at>>>26)|0,at&=67108863,S=Math.imul(le,ue),u=Math.imul(le,fe),u=u+Math.imul(ce,ue)|0,O=Math.imul(ce,fe),S=S+Math.imul(ae,he)|0,u=u+Math.imul(ae,de)|0,u=u+Math.imul(oe,he)|0,O=O+Math.imul(oe,de)|0,S=S+Math.imul(ne,me)|0,u=u+Math.imul(ne,pe)|0,u=u+Math.imul(ie,me)|0,O=O+Math.imul(ie,pe)|0,S=S+Math.imul(re,ge)|0,u=u+Math.imul(re,ye)|0,u=u+Math.imul(se,ge)|0,O=O+Math.imul(se,ye)|0,S=S+Math.imul(ee,ve)|0,u=u+Math.imul(ee,be)|0,u=u+Math.imul(te,ve)|0,O=O+Math.imul(te,be)|0,S=S+Math.imul(Q,_e)|0,u=u+Math.imul(Q,we)|0,u=u+Math.imul(X,_e)|0,O=O+Math.imul(X,we)|0,S=S+Math.imul(G,xe)|0,u=u+Math.imul(G,Me)|0,u=u+Math.imul(Y,xe)|0,O=O+Math.imul(Y,Me)|0,S=S+Math.imul(Z,$e)|0,u=u+Math.imul(Z,ke)|0,u=u+Math.imul(H,$e)|0,O=O+Math.imul(H,ke)|0,S=S+Math.imul(V,je)|0,u=u+Math.imul(V,Se)|0,u=u+Math.imul(W,je)|0,O=O+Math.imul(W,Se)|0,S=S+Math.imul(F,Re)|0,u=u+Math.imul(F,Ae)|0,u=u+Math.imul(J,Re)|0,O=O+Math.imul(J,Ae)|0;var ot=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(ot>>>26)|0,ot&=67108863,S=Math.imul(le,he),u=Math.imul(le,de),u=u+Math.imul(ce,he)|0,O=Math.imul(ce,de),S=S+Math.imul(ae,me)|0,u=u+Math.imul(ae,pe)|0,u=u+Math.imul(oe,me)|0,O=O+Math.imul(oe,pe)|0,S=S+Math.imul(ne,ge)|0,u=u+Math.imul(ne,ye)|0,u=u+Math.imul(ie,ge)|0,O=O+Math.imul(ie,ye)|0,S=S+Math.imul(re,ve)|0,u=u+Math.imul(re,be)|0,u=u+Math.imul(se,ve)|0,O=O+Math.imul(se,be)|0,S=S+Math.imul(ee,_e)|0,u=u+Math.imul(ee,we)|0,u=u+Math.imul(te,_e)|0,O=O+Math.imul(te,we)|0,S=S+Math.imul(Q,xe)|0,u=u+Math.imul(Q,Me)|0,u=u+Math.imul(X,xe)|0,O=O+Math.imul(X,Me)|0,S=S+Math.imul(G,$e)|0,u=u+Math.imul(G,ke)|0,u=u+Math.imul(Y,$e)|0,O=O+Math.imul(Y,ke)|0,S=S+Math.imul(Z,je)|0,u=u+Math.imul(Z,Se)|0,u=u+Math.imul(H,je)|0,O=O+Math.imul(H,Se)|0,S=S+Math.imul(V,Re)|0,u=u+Math.imul(V,Ae)|0,u=u+Math.imul(W,Re)|0,O=O+Math.imul(W,Ae)|0;var lt=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(lt>>>26)|0,lt&=67108863,S=Math.imul(le,me),u=Math.imul(le,pe),u=u+Math.imul(ce,me)|0,O=Math.imul(ce,pe),S=S+Math.imul(ae,ge)|0,u=u+Math.imul(ae,ye)|0,u=u+Math.imul(oe,ge)|0,O=O+Math.imul(oe,ye)|0,S=S+Math.imul(ne,ve)|0,u=u+Math.imul(ne,be)|0,u=u+Math.imul(ie,ve)|0,O=O+Math.imul(ie,be)|0,S=S+Math.imul(re,_e)|0,u=u+Math.imul(re,we)|0,u=u+Math.imul(se,_e)|0,O=O+Math.imul(se,we)|0,S=S+Math.imul(ee,xe)|0,u=u+Math.imul(ee,Me)|0,u=u+Math.imul(te,xe)|0,O=O+Math.imul(te,Me)|0,S=S+Math.imul(Q,$e)|0,u=u+Math.imul(Q,ke)|0,u=u+Math.imul(X,$e)|0,O=O+Math.imul(X,ke)|0,S=S+Math.imul(G,je)|0,u=u+Math.imul(G,Se)|0,u=u+Math.imul(Y,je)|0,O=O+Math.imul(Y,Se)|0,S=S+Math.imul(Z,Re)|0,u=u+Math.imul(Z,Ae)|0,u=u+Math.imul(H,Re)|0,O=O+Math.imul(H,Ae)|0;var ct=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(ct>>>26)|0,ct&=67108863,S=Math.imul(le,ge),u=Math.imul(le,ye),u=u+Math.imul(ce,ge)|0,O=Math.imul(ce,ye),S=S+Math.imul(ae,ve)|0,u=u+Math.imul(ae,be)|0,u=u+Math.imul(oe,ve)|0,O=O+Math.imul(oe,be)|0,S=S+Math.imul(ne,_e)|0,u=u+Math.imul(ne,we)|0,u=u+Math.imul(ie,_e)|0,O=O+Math.imul(ie,we)|0,S=S+Math.imul(re,xe)|0,u=u+Math.imul(re,Me)|0,u=u+Math.imul(se,xe)|0,O=O+Math.imul(se,Me)|0,S=S+Math.imul(ee,$e)|0,u=u+Math.imul(ee,ke)|0,u=u+Math.imul(te,$e)|0,O=O+Math.imul(te,ke)|0,S=S+Math.imul(Q,je)|0,u=u+Math.imul(Q,Se)|0,u=u+Math.imul(X,je)|0,O=O+Math.imul(X,Se)|0,S=S+Math.imul(G,Re)|0,u=u+Math.imul(G,Ae)|0,u=u+Math.imul(Y,Re)|0,O=O+Math.imul(Y,Ae)|0;var ut=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(ut>>>26)|0,ut&=67108863,S=Math.imul(le,ve),u=Math.imul(le,be),u=u+Math.imul(ce,ve)|0,O=Math.imul(ce,be),S=S+Math.imul(ae,_e)|0,u=u+Math.imul(ae,we)|0,u=u+Math.imul(oe,_e)|0,O=O+Math.imul(oe,we)|0,S=S+Math.imul(ne,xe)|0,u=u+Math.imul(ne,Me)|0,u=u+Math.imul(ie,xe)|0,O=O+Math.imul(ie,Me)|0,S=S+Math.imul(re,$e)|0,u=u+Math.imul(re,ke)|0,u=u+Math.imul(se,$e)|0,O=O+Math.imul(se,ke)|0,S=S+Math.imul(ee,je)|0,u=u+Math.imul(ee,Se)|0,u=u+Math.imul(te,je)|0,O=O+Math.imul(te,Se)|0,S=S+Math.imul(Q,Re)|0,u=u+Math.imul(Q,Ae)|0,u=u+Math.imul(X,Re)|0,O=O+Math.imul(X,Ae)|0;var ft=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(ft>>>26)|0,ft&=67108863,S=Math.imul(le,_e),u=Math.imul(le,we),u=u+Math.imul(ce,_e)|0,O=Math.imul(ce,we),S=S+Math.imul(ae,xe)|0,u=u+Math.imul(ae,Me)|0,u=u+Math.imul(oe,xe)|0,O=O+Math.imul(oe,Me)|0,S=S+Math.imul(ne,$e)|0,u=u+Math.imul(ne,ke)|0,u=u+Math.imul(ie,$e)|0,O=O+Math.imul(ie,ke)|0,S=S+Math.imul(re,je)|0,u=u+Math.imul(re,Se)|0,u=u+Math.imul(se,je)|0,O=O+Math.imul(se,Se)|0,S=S+Math.imul(ee,Re)|0,u=u+Math.imul(ee,Ae)|0,u=u+Math.imul(te,Re)|0,O=O+Math.imul(te,Ae)|0;var ht=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(ht>>>26)|0,ht&=67108863,S=Math.imul(le,xe),u=Math.imul(le,Me),u=u+Math.imul(ce,xe)|0,O=Math.imul(ce,Me),S=S+Math.imul(ae,$e)|0,u=u+Math.imul(ae,ke)|0,u=u+Math.imul(oe,$e)|0,O=O+Math.imul(oe,ke)|0,S=S+Math.imul(ne,je)|0,u=u+Math.imul(ne,Se)|0,u=u+Math.imul(ie,je)|0,O=O+Math.imul(ie,Se)|0,S=S+Math.imul(re,Re)|0,u=u+Math.imul(re,Ae)|0,u=u+Math.imul(se,Re)|0,O=O+Math.imul(se,Ae)|0;var dt=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(dt>>>26)|0,dt&=67108863,S=Math.imul(le,$e),u=Math.imul(le,ke),u=u+Math.imul(ce,$e)|0,O=Math.imul(ce,ke),S=S+Math.imul(ae,je)|0,u=u+Math.imul(ae,Se)|0,u=u+Math.imul(oe,je)|0,O=O+Math.imul(oe,Se)|0,S=S+Math.imul(ne,Re)|0,u=u+Math.imul(ne,Ae)|0,u=u+Math.imul(ie,Re)|0,O=O+Math.imul(ie,Ae)|0;var mt=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(mt>>>26)|0,mt&=67108863,S=Math.imul(le,je),u=Math.imul(le,Se),u=u+Math.imul(ce,je)|0,O=Math.imul(ce,Se),S=S+Math.imul(ae,Re)|0,u=u+Math.imul(ae,Ae)|0,u=u+Math.imul(oe,Re)|0,O=O+Math.imul(oe,Ae)|0;var pt=(C+S|0)+((u&8191)<<13)|0;C=(O+(u>>>13)|0)+(pt>>>26)|0,pt&=67108863,S=Math.imul(le,Re),u=Math.imul(le,Ae),u=u+Math.imul(ce,Re)|0,O=Math.imul(ce,Ae);var gt=(C+S|0)+((u&8191)<<13)|0;return C=(O+(u>>>13)|0)+(gt>>>26)|0,gt&=67108863,D[0]=Qe,D[1]=Xe,D[2]=et,D[3]=tt,D[4]=rt,D[5]=st,D[6]=nt,D[7]=it,D[8]=at,D[9]=ot,D[10]=lt,D[11]=ct,D[12]=ut,D[13]=ft,D[14]=ht,D[15]=dt,D[16]=mt,D[17]=pt,D[18]=gt,C!==0&&(D[19]=C,v.length++),v};Math.imul||(o=s);function h($,n,d){d.negative=n.negative^$.negative,d.length=$.length+n.length;for(var v=0,k=0,A=0;A<d.length-1;A++){var D=k;k=0;for(var C=v&67108863,S=Math.min(A,n.length-1),u=Math.max(0,A-$.length+1);u<=S;u++){var O=A-u,z=$.words[O]|0,F=n.words[u]|0,J=z*F,K=J&67108863;D=D+(J/67108864|0)|0,K=K+C|0,C=K&67108863,D=D+(K>>>26)|0,k+=D>>>26,D&=67108863}d.words[A]=C,v=D,D=k}return v!==0?d.words[A]=v:d.length--,d._strip()}function g($,n,d){return h($,n,d)}p.prototype.mulTo=function(n,d){var v,k=this.length+n.length;return this.length===10&&n.length===10?v=o(this,n,d):k<63?v=s(this,n,d):k<1024?v=h(this,n,d):v=g(this,n,d),v},p.prototype.mul=function(n){var d=new p(null);return d.words=new Array(this.length+n.length),this.mulTo(n,d)},p.prototype.mulf=function(n){var d=new p(null);return d.words=new Array(this.length+n.length),g(this,n,d)},p.prototype.imul=function(n){return this.clone().mulTo(n,this)},p.prototype.imuln=function(n){var d=n<0;d&&(n=-n),T(typeof n=="number"),T(n<67108864);for(var v=0,k=0;k<this.length;k++){var A=(this.words[k]|0)*n,D=(A&67108863)+(v&67108863);v>>=26,v+=A/67108864|0,v+=D>>>26,this.words[k]=D&67108863}return v!==0&&(this.words[k]=v,this.length++),d?this.ineg():this},p.prototype.muln=function(n){return this.clone().imuln(n)},p.prototype.sqr=function(){return this.mul(this)},p.prototype.isqr=function(){return this.imul(this.clone())},p.prototype.pow=function(n){var d=c(n);if(d.length===0)return new p(1);for(var v=this,k=0;k<d.length&&d[k]===0;k++,v=v.sqr());if(++k<d.length)for(var A=v.sqr();k<d.length;k++,A=A.sqr())d[k]!==0&&(v=v.mul(A));return v},p.prototype.iushln=function(n){T(typeof n=="number"&&n>=0);var d=n%26,v=(n-d)/26,k=67108863>>>26-d<<26-d,A;if(d!==0){var D=0;for(A=0;A<this.length;A++){var C=this.words[A]&k,S=(this.words[A]|0)-C<<d;this.words[A]=S|D,D=C>>>26-d}D&&(this.words[A]=D,this.length++)}if(v!==0){for(A=this.length-1;A>=0;A--)this.words[A+v]=this.words[A];for(A=0;A<v;A++)this.words[A]=0;this.length+=v}return this._strip()},p.prototype.ishln=function(n){return T(this.negative===0),this.iushln(n)},p.prototype.iushrn=function(n,d,v){T(typeof n=="number"&&n>=0);var k;d?k=(d-d%26)/26:k=0;var A=n%26,D=Math.min((n-A)/26,this.length),C=67108863^67108863>>>A<<A,S=v;if(k-=D,k=Math.max(0,k),S){for(var u=0;u<D;u++)S.words[u]=this.words[u];S.length=D}if(D!==0)if(this.length>D)for(this.length-=D,u=0;u<this.length;u++)this.words[u]=this.words[u+D];else this.words[0]=0,this.length=1;var O=0;for(u=this.length-1;u>=0&&(O!==0||u>=k);u--){var z=this.words[u]|0;this.words[u]=O<<26-A|z>>>A,O=z&C}return S&&O!==0&&(S.words[S.length++]=O),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},p.prototype.ishrn=function(n,d,v){return T(this.negative===0),this.iushrn(n,d,v)},p.prototype.shln=function(n){return this.clone().ishln(n)},p.prototype.ushln=function(n){return this.clone().iushln(n)},p.prototype.shrn=function(n){return this.clone().ishrn(n)},p.prototype.ushrn=function(n){return this.clone().iushrn(n)},p.prototype.testn=function(n){T(typeof n=="number"&&n>=0);var d=n%26,v=(n-d)/26,k=1<<d;if(this.length<=v)return!1;var A=this.words[v];return!!(A&k)},p.prototype.imaskn=function(n){T(typeof n=="number"&&n>=0);var d=n%26,v=(n-d)/26;if(T(this.negative===0,"imaskn works only with positive numbers"),this.length<=v)return this;if(d!==0&&v++,this.length=Math.min(v,this.length),d!==0){var k=67108863^67108863>>>d<<d;this.words[this.length-1]&=k}return this._strip()},p.prototype.maskn=function(n){return this.clone().imaskn(n)},p.prototype.iaddn=function(n){return T(typeof n=="number"),T(n<67108864),n<0?this.isubn(-n):this.negative!==0?this.length===1&&(this.words[0]|0)<=n?(this.words[0]=n-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(n),this.negative=1,this):this._iaddn(n)},p.prototype._iaddn=function(n){this.words[0]+=n;for(var d=0;d<this.length&&this.words[d]>=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},p.prototype.isubn=function(n){if(T(typeof n=="number"),T(n<67108864),n<0)return this.iaddn(-n);if(this.negative!==0)return this.negative=0,this.iaddn(n),this.negative=1,this;if(this.words[0]-=n,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d<this.length&&this.words[d]<0;d++)this.words[d]+=67108864,this.words[d+1]-=1;return this._strip()},p.prototype.addn=function(n){return this.clone().iaddn(n)},p.prototype.subn=function(n){return this.clone().isubn(n)},p.prototype.iabs=function(){return this.negative=0,this},p.prototype.abs=function(){return this.clone().iabs()},p.prototype._ishlnsubmul=function(n,d,v){var k=n.length+v,A;this._expand(k);var D,C=0;for(A=0;A<n.length;A++){D=(this.words[A+v]|0)+C;var S=(n.words[A]|0)*d;D-=S&67108863,C=(D>>26)-(S/67108864|0),this.words[A+v]=D&67108863}for(;A<this.length-v;A++)D=(this.words[A+v]|0)+C,C=D>>26,this.words[A+v]=D&67108863;if(C===0)return this._strip();for(T(C===-1),C=0,A=0;A<this.length;A++)D=-(this.words[A]|0)+C,C=D>>26,this.words[A]=D&67108863;return this.negative=1,this._strip()},p.prototype._wordDiv=function(n,d){var v=this.length-n.length,k=this.clone(),A=n,D=A.words[A.length-1]|0,C=this._countBits(D);v=26-C,v!==0&&(A=A.ushln(v),k.iushln(v),D=A.words[A.length-1]|0);var S=k.length-A.length,u;if(d!=="mod"){u=new p(null),u.length=S+1,u.words=new Array(u.length);for(var O=0;O<u.length;O++)u.words[O]=0}var z=k.clone()._ishlnsubmul(A,1,S);z.negative===0&&(k=z,u&&(u.words[S]=1));for(var F=S-1;F>=0;F--){var J=(k.words[A.length+F]|0)*67108864+(k.words[A.length+F-1]|0);for(J=Math.min(J/D|0,67108863),k._ishlnsubmul(A,J,F);k.negative!==0;)J--,k.negative=0,k._ishlnsubmul(A,1,F),k.isZero()||(k.negative^=1);u&&(u.words[F]=J)}return u&&u._strip(),k._strip(),d!=="div"&&v!==0&&k.iushrn(v),{div:u||null,mod:k}},p.prototype.divmod=function(n,d,v){if(T(!n.isZero()),this.isZero())return{div:new p(0),mod:new p(0)};var k,A,D;return this.negative!==0&&n.negative===0?(D=this.neg().divmod(n,d),d!=="mod"&&(k=D.div.neg()),d!=="div"&&(A=D.mod.neg(),v&&A.negative!==0&&A.iadd(n)),{div:k,mod:A}):this.negative===0&&n.negative!==0?(D=this.divmod(n.neg(),d),d!=="mod"&&(k=D.div.neg()),{div:k,mod:D.mod}):this.negative&n.negative?(D=this.neg().divmod(n.neg(),d),d!=="div"&&(A=D.mod.neg(),v&&A.negative!==0&&A.isub(n)),{div:D.div,mod:A}):n.length>this.length||this.cmp(n)<0?{div:new p(0),mod:this}:n.length===1?d==="div"?{div:this.divn(n.words[0]),mod:null}:d==="mod"?{div:null,mod:new p(this.modrn(n.words[0]))}:{div:this.divn(n.words[0]),mod:new p(this.modrn(n.words[0]))}:this._wordDiv(n,d)},p.prototype.div=function(n){return this.divmod(n,"div",!1).div},p.prototype.mod=function(n){return this.divmod(n,"mod",!1).mod},p.prototype.umod=function(n){return this.divmod(n,"mod",!0).mod},p.prototype.divRound=function(n){var d=this.divmod(n);if(d.mod.isZero())return d.div;var v=d.div.negative!==0?d.mod.isub(n):d.mod,k=n.ushrn(1),A=n.andln(1),D=v.cmp(k);return D<0||A===1&&D===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},p.prototype.modrn=function(n){var d=n<0;d&&(n=-n),T(n<=67108863);for(var v=(1<<26)%n,k=0,A=this.length-1;A>=0;A--)k=(v*k+(this.words[A]|0))%n;return d?-k:k},p.prototype.modn=function(n){return this.modrn(n)},p.prototype.idivn=function(n){var d=n<0;d&&(n=-n),T(n<=67108863);for(var v=0,k=this.length-1;k>=0;k--){var A=(this.words[k]|0)+v*67108864;this.words[k]=A/n|0,v=A%n}return this._strip(),d?this.ineg():this},p.prototype.divn=function(n){return this.clone().idivn(n)},p.prototype.egcd=function(n){T(n.negative===0),T(!n.isZero());var d=this,v=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var k=new p(1),A=new p(0),D=new p(0),C=new p(1),S=0;d.isEven()&&v.isEven();)d.iushrn(1),v.iushrn(1),++S;for(var u=v.clone(),O=d.clone();!d.isZero();){for(var z=0,F=1;!(d.words[0]&F)&&z<26;++z,F<<=1);if(z>0)for(d.iushrn(z);z-- >0;)(k.isOdd()||A.isOdd())&&(k.iadd(u),A.isub(O)),k.iushrn(1),A.iushrn(1);for(var J=0,K=1;!(v.words[0]&K)&&J<26;++J,K<<=1);if(J>0)for(v.iushrn(J);J-- >0;)(D.isOdd()||C.isOdd())&&(D.iadd(u),C.isub(O)),D.iushrn(1),C.iushrn(1);d.cmp(v)>=0?(d.isub(v),k.isub(D),A.isub(C)):(v.isub(d),D.isub(k),C.isub(A))}return{a:D,b:C,gcd:v.iushln(S)}},p.prototype._invmp=function(n){T(n.negative===0),T(!n.isZero());var d=this,v=n.clone();d.negative!==0?d=d.umod(n):d=d.clone();for(var k=new p(1),A=new p(0),D=v.clone();d.cmpn(1)>0&&v.cmpn(1)>0;){for(var C=0,S=1;!(d.words[0]&S)&&C<26;++C,S<<=1);if(C>0)for(d.iushrn(C);C-- >0;)k.isOdd()&&k.iadd(D),k.iushrn(1);for(var u=0,O=1;!(v.words[0]&O)&&u<26;++u,O<<=1);if(u>0)for(v.iushrn(u);u-- >0;)A.isOdd()&&A.iadd(D),A.iushrn(1);d.cmp(v)>=0?(d.isub(v),k.isub(A)):(v.isub(d),A.isub(k))}var z;return d.cmpn(1)===0?z=k:z=A,z.cmpn(0)<0&&z.iadd(n),z},p.prototype.gcd=function(n){if(this.isZero())return n.abs();if(n.isZero())return this.abs();var d=this.clone(),v=n.clone();d.negative=0,v.negative=0;for(var k=0;d.isEven()&&v.isEven();k++)d.iushrn(1),v.iushrn(1);do{for(;d.isEven();)d.iushrn(1);for(;v.isEven();)v.iushrn(1);var A=d.cmp(v);if(A<0){var D=d;d=v,v=D}else if(A===0||v.cmpn(1)===0)break;d.isub(v)}while(!0);return v.iushln(k)},p.prototype.invm=function(n){return this.egcd(n).a.umod(n)},p.prototype.isEven=function(){return(this.words[0]&1)===0},p.prototype.isOdd=function(){return(this.words[0]&1)===1},p.prototype.andln=function(n){return this.words[0]&n},p.prototype.bincn=function(n){T(typeof n=="number");var d=n%26,v=(n-d)/26,k=1<<d;if(this.length<=v)return this._expand(v+1),this.words[v]|=k,this;for(var A=k,D=v;A!==0&&D<this.length;D++){var C=this.words[D]|0;C+=A,A=C>>>26,C&=67108863,this.words[D]=C}return A!==0&&(this.words[D]=A,this.length++),this},p.prototype.isZero=function(){return this.length===1&&this.words[0]===0},p.prototype.cmpn=function(n){var d=n<0;if(this.negative!==0&&!d)return-1;if(this.negative===0&&d)return 1;this._strip();var v;if(this.length>1)v=1;else{d&&(n=-n),T(n<=67108863,"Number is too big");var k=this.words[0]|0;v=k===n?0:k<n?-1:1}return this.negative!==0?-v|0:v},p.prototype.cmp=function(n){if(this.negative!==0&&n.negative===0)return-1;if(this.negative===0&&n.negative!==0)return 1;var d=this.ucmp(n);return this.negative!==0?-d|0:d},p.prototype.ucmp=function(n){if(this.length>n.length)return 1;if(this.length<n.length)return-1;for(var d=0,v=this.length-1;v>=0;v--){var k=this.words[v]|0,A=n.words[v]|0;if(k!==A){k<A?d=-1:k>A&&(d=1);break}}return d},p.prototype.gtn=function(n){return this.cmpn(n)===1},p.prototype.gt=function(n){return this.cmp(n)===1},p.prototype.gten=function(n){return this.cmpn(n)>=0},p.prototype.gte=function(n){return this.cmp(n)>=0},p.prototype.ltn=function(n){return this.cmpn(n)===-1},p.prototype.lt=function(n){return this.cmp(n)===-1},p.prototype.lten=function(n){return this.cmpn(n)<=0},p.prototype.lte=function(n){return this.cmp(n)<=0},p.prototype.eqn=function(n){return this.cmpn(n)===0},p.prototype.eq=function(n){return this.cmp(n)===0},p.red=function(n){return new E(n)},p.prototype.toRed=function(n){return T(!this.red,"Already a number in reduction context"),T(this.negative===0,"red works only with positives"),n.convertTo(this)._forceRed(n)},p.prototype.fromRed=function(){return T(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},p.prototype._forceRed=function(n){return this.red=n,this},p.prototype.forceRed=function(n){return T(!this.red,"Already a number in reduction context"),this._forceRed(n)},p.prototype.redAdd=function(n){return T(this.red,"redAdd works only with red numbers"),this.red.add(this,n)},p.prototype.redIAdd=function(n){return T(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,n)},p.prototype.redSub=function(n){return T(this.red,"redSub works only with red numbers"),this.red.sub(this,n)},p.prototype.redISub=function(n){return T(this.red,"redISub works only with red numbers"),this.red.isub(this,n)},p.prototype.redShl=function(n){return T(this.red,"redShl works only with red numbers"),this.red.shl(this,n)},p.prototype.redMul=function(n){return T(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.mul(this,n)},p.prototype.redIMul=function(n){return T(this.red,"redMul works only with red numbers"),this.red._verify2(this,n),this.red.imul(this,n)},p.prototype.redSqr=function(){return T(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},p.prototype.redISqr=function(){return T(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},p.prototype.redSqrt=function(){return T(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},p.prototype.redInvm=function(){return T(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},p.prototype.redNeg=function(){return T(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},p.prototype.redPow=function(n){return T(this.red&&!n.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,n)};var w={k256:null,p224:null,p192:null,p25519:null};function R($,n){this.name=$,this.p=new p(n,16),this.n=this.p.bitLength(),this.k=new p(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}R.prototype._tmp=function(){var n=new p(null);return n.words=new Array(Math.ceil(this.n/13)),n},R.prototype.ireduce=function(n){var d=n,v;do this.split(d,this.tmp),d=this.imulK(d),d=d.iadd(this.tmp),v=d.bitLength();while(v>this.n);var k=v<this.n?-1:d.ucmp(this.p);return k===0?(d.words[0]=0,d.length=1):k>0?d.isub(this.p):d.strip!==void 0?d.strip():d._strip(),d},R.prototype.split=function(n,d){n.iushrn(this.n,0,d)},R.prototype.imulK=function(n){return n.imul(this.k)};function j(){R.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}L(j,R),j.prototype.split=function(n,d){for(var v=4194303,k=Math.min(n.length,9),A=0;A<k;A++)d.words[A]=n.words[A];if(d.length=k,n.length<=9){n.words[0]=0,n.length=1;return}var D=n.words[9];for(d.words[d.length++]=D&v,A=10;A<n.length;A++){var C=n.words[A]|0;n.words[A-10]=(C&v)<<4|D>>>22,D=C}D>>>=22,n.words[A-10]=D,D===0&&n.length>10?n.length-=10:n.length-=9},j.prototype.imulK=function(n){n.words[n.length]=0,n.words[n.length+1]=0,n.length+=2;for(var d=0,v=0;v<n.length;v++){var k=n.words[v]|0;d+=k*977,n.words[v]=d&67108863,d=k*64+(d/67108864|0)}return n.words[n.length-1]===0&&(n.length--,n.words[n.length-1]===0&&n.length--),n};function f(){R.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}L(f,R);function y(){R.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}L(y,R);function M(){R.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}L(M,R),M.prototype.imulK=function(n){for(var d=0,v=0;v<n.length;v++){var k=(n.words[v]|0)*19+d,A=k&67108863;k>>>=26,n.words[v]=A,d=k}return d!==0&&(n.words[n.length++]=d),n},p._prime=function(n){if(w[n])return w[n];var d;if(n==="k256")d=new j;else if(n==="p224")d=new f;else if(n==="p192")d=new y;else if(n==="p25519")d=new M;else throw new Error("Unknown prime "+n);return w[n]=d,d};function E($){if(typeof $=="string"){var n=p._prime($);this.m=n.p,this.prime=n}else T($.gtn(1),"modulus must be greater than 1"),this.m=$,this.prime=null}E.prototype._verify1=function(n){T(n.negative===0,"red works only with positives"),T(n.red,"red works only with red numbers")},E.prototype._verify2=function(n,d){T((n.negative|d.negative)===0,"red works only with positives"),T(n.red&&n.red===d.red,"red works only with red numbers")},E.prototype.imod=function(n){return this.prime?this.prime.ireduce(n)._forceRed(this):(m(n,n.umod(this.m)._forceRed(this)),n)},E.prototype.neg=function(n){return n.isZero()?n.clone():this.m.sub(n)._forceRed(this)},E.prototype.add=function(n,d){this._verify2(n,d);var v=n.add(d);return v.cmp(this.m)>=0&&v.isub(this.m),v._forceRed(this)},E.prototype.iadd=function(n,d){this._verify2(n,d);var v=n.iadd(d);return v.cmp(this.m)>=0&&v.isub(this.m),v},E.prototype.sub=function(n,d){this._verify2(n,d);var v=n.sub(d);return v.cmpn(0)<0&&v.iadd(this.m),v._forceRed(this)},E.prototype.isub=function(n,d){this._verify2(n,d);var v=n.isub(d);return v.cmpn(0)<0&&v.iadd(this.m),v},E.prototype.shl=function(n,d){return this._verify1(n),this.imod(n.ushln(d))},E.prototype.imul=function(n,d){return this._verify2(n,d),this.imod(n.imul(d))},E.prototype.mul=function(n,d){return this._verify2(n,d),this.imod(n.mul(d))},E.prototype.isqr=function(n){return this.imul(n,n.clone())},E.prototype.sqr=function(n){return this.mul(n,n)},E.prototype.sqrt=function(n){if(n.isZero())return n.clone();var d=this.m.andln(3);if(T(d%2===1),d===3){var v=this.m.add(new p(1)).iushrn(2);return this.pow(n,v)}for(var k=this.m.subn(1),A=0;!k.isZero()&&k.andln(1)===0;)A++,k.iushrn(1);T(!k.isZero());var D=new p(1).toRed(this),C=D.redNeg(),S=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new p(2*u*u).toRed(this);this.pow(u,S).cmp(C)!==0;)u.redIAdd(C);for(var O=this.pow(u,k),z=this.pow(n,k.addn(1).iushrn(1)),F=this.pow(n,k),J=A;F.cmp(D)!==0;){for(var K=F,V=0;K.cmp(D)!==0;V++)K=K.redSqr();T(V<J);var W=this.pow(O,new p(1).iushln(J-V-1));z=z.redMul(W),O=W.redSqr(),F=F.redMul(O),J=V}return z},E.prototype.invm=function(n){var d=n._invmp(this.m);return d.negative!==0?(d.negative=0,this.imod(d).redNeg()):this.imod(d)},E.prototype.pow=function(n,d){if(d.isZero())return new p(1).toRed(this);if(d.cmpn(1)===0)return n.clone();var v=4,k=new Array(1<<v);k[0]=new p(1).toRed(this),k[1]=n;for(var A=2;A<k.length;A++)k[A]=this.mul(k[A-1],n);var D=k[0],C=0,S=0,u=d.bitLength()%26;for(u===0&&(u=26),A=d.length-1;A>=0;A--){for(var O=d.words[A],z=u-1;z>=0;z--){var F=O>>z&1;if(D!==k[0]&&(D=this.sqr(D)),F===0&&C===0){S=0;continue}C<<=1,C|=F,S++,!(S!==v&&(A!==0||z!==0))&&(D=this.mul(D,k[C]),S=0,C=0)}u=26}return D},E.prototype.convertTo=function(n){var d=n.umod(this.m);return d===n?d.clone():d},E.prototype.convertFrom=function(n){var d=n.clone();return d.red=null,d},p.mont=function(n){return new N(n)};function N($){E.call(this,$),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new p(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}L(N,E),N.prototype.convertTo=function(n){return this.imod(n.ushln(this.shift))},N.prototype.convertFrom=function(n){var d=this.imod(n.mul(this.rinv));return d.red=null,d},N.prototype.imul=function(n,d){if(n.isZero()||d.isZero())return n.words[0]=0,n.length=1,n;var v=n.imul(d),k=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),A=v.isub(k).iushrn(this.shift),D=A;return A.cmp(this.m)>=0?D=A.isub(this.m):A.cmpn(0)<0&&(D=A.iadd(this.m)),D._forceRed(this)},N.prototype.mul=function(n,d){if(n.isZero()||d.isZero())return new p(0)._forceRed(this);var v=n.mul(d),k=v.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),A=v.isub(k).iushrn(this.shift),D=A;return A.cmp(this.m)>=0?D=A.isub(this.m):A.cmpn(0)<0&&(D=A.iadd(this.m)),D._forceRed(this)},N.prototype.invm=function(n){var d=this.imod(n._invmp(this.m).mul(this.r2));return d._forceRed(this)}})(I,ze)})(Et);var Yr=Et.exports,Qr=ze&&ze.__importDefault||function(I){return I&&I.__esModule?I:{default:I}};Object.defineProperty(Ot,"__esModule",{value:!0});Ot.BNExtension=Xr;const Pe=Qr(Yr);function Xr(I){return{type:"BN",base:I.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(P,B){try{return{value:new Pe.default(P)}}catch{return{errors:B.error("bn.nan")}}},coerce(P){return{value:P.toString(10)}},validate(P){return{value:P}},rules:{gt:{args:[{name:"threshold",ref:!0,assert:P=>Pe.default.isBN(P),message:"must be a big number",normalize:P=>new Pe.default(P)},{name:"equal",assert:P=>typeof P=="boolean",message:"must be a boolean"}],validate(P,B,T){const L=new Pe.default(P);return T.equal&&L.lt(T.threshold)?B.error("bn.min",T):!T.equal&&L.lte(T.threshold)?B.error("bn.greater",T):P}},lt:{args:[{name:"threshold",ref:!0,assert:P=>Pe.default.isBN(P),message:"must be a big number",normalize:P=>new Pe.default(P)},{name:"equal",assert:P=>typeof P=="boolean",message:"must be a boolean"}],validate(P,B,T){const L=new Pe.default(P);return T.equal&&L.gt(T.threshold)?B.error("bn.max",T):!T.equal&&L.gte(T.threshold)?B.error("bn.less",T):P}},min:{alias:"gte",method(P){return this.$_addRule({name:"gt",args:{threshold:P,equal:!0}})}},max:{alias:"lte",method(P){return this.$_addRule({name:"lt",args:{threshold:P,equal:!0}})}},greater:{alias:"gt",method(P){return this.$_addRule({name:"gt",args:{threshold:P,equal:!1}})}},less:{alias:"lt",method(P){return this.$_addRule({name:"lt",args:{threshold:P,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 Dt={},es=ze&&ze.__importDefault||function(I){return I&&I.__esModule?I:{default:I}};Object.defineProperty(Dt,"__esModule",{value:!0});Dt.DIDExtension=ts;const yt=es(Rr),vt=Ar,De=Ce,Ke={pk:Object.keys(vt.types.KeyType),hash:Object.keys(vt.types.HashType),role:Object.keys(vt.types.RoleType)};function ts(I){return{type:"DID",base:I.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(P,B){return!P||typeof P!="string"?{errors:B.error("did.empty",{value:P})}:(0,De.isValid)(P)===!1?{errors:B.error("did.invalid",{value:P})}:{value:P}},rules:{type:{args:[{name:"key",ref:!0,assert:P=>Object.keys(Ke).includes(P),message:`must be one of ${Object.keys(Ke).join(", ")}`},{name:"expected",assert:P=>Object.keys(Ke).some(B=>Ke[B].includes(P)),message:"must be valid type"}],validate(P,B,T){const L=(0,De.toTypeInfoStr)(P);return T.key==="pk"&&L.pk!==T.expected?B.error("did.pk",{...T,actual:L.pk}):T.key==="hash"&&L.hash!==T.expected?B.error("did.hash",{...T,actual:L.hash}):T.key==="role"&&L.role!==T.expected?B.error("did.role",{...T,actual:L.role}):P}},pk:{method(P){return this.$_addRule({name:"type",args:{key:"pk",expected:P}})}},hash:{method(P){return this.$_addRule({name:"type",args:{key:"hash",expected:P}})}},role:{method(P){return this.$_addRule({name:"type",args:{key:"role",expected:P}})}},wallet:{method(P){return this.$_addRule({name:"wallet",args:{type:P}})},args:[{name:"type",ref:!0,assert:P=>["arcblock","ethereum","default","eth","passkey"].includes(P),message:"must be a string",normalize:P=>P.trim()}],validate(P,B,T={}){const L=(0,De.toTypeInfo)(P),p=(0,De.toTypeInfoStr)(P);return["ethereum","eth"].includes(T.type)&&(0,yt.default)(L,De.DID_TYPE_ETHEREUM)===!1?B.error("did.wallet",{expected:T.type,actual:JSON.stringify(p)}):["arcblock","default"].includes(T.type)&&(0,yt.default)(L,De.DID_TYPE_ARCBLOCK)===!1?B.error("did.wallet",{expected:T.type,actual:JSON.stringify(p)}):["passkey"].includes(T.type)&&(0,yt.default)(L,De.DID_TYPE_PASSKEY)===!1?B.error("did.wallet",{expected:T.type,actual:JSON.stringify(p)}):P}},prefix:{method(P=""){return this.$_addRule({name:"prefix",args:{str:P}})},args:[{name:"str",ref:!0,assert:P=>["",De.DID_PREFIX].includes(P),message:"must be a string",normalize:P=>P.trim()}],validate(P,B,T={}){return T.str&&P.startsWith(T.str)===!1?B.error("did.prefix",{expected:T.str}):!T.str&&(0,De.toAddress)(P)!==P?B.error("did.prefix",{expected:T.str}):P}}}}}(function(I){var P=ze&&ze.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(I,"__esModule",{value:!0}),I.patterns=I.schemas=I.Joi=void 0;const B=P(Gr),T=Ot,L=Dt;I.Joi=B.default.extend(L.DIDExtension).extend(T.BNExtension);const p=/^(0x)?([A-Fa-f0-9]{64})$/,_=I.Joi.object({genesisTime:I.Joi.date().iso().required().raw(),genesisTx:I.Joi.string().regex(p).required().allow(""),renaissanceTime:I.Joi.date().iso().required().raw(),renaissanceTx:I.Joi.string().regex(p).required().allow("")}),l=I.Joi.object({address:I.Joi.DID().prefix().role("ROLE_TOKEN").required(),value:I.Joi.BN().positive().required()}),x=I.Joi.object({name:I.Joi.string().min(1).max(256).required(),value:I.Joi.string().min(1).max(1024).required(),description:I.Joi.string().min(1).max(256).optional().allow(""),required:I.Joi.boolean().optional().default(!1)}),b=I.Joi.alternatives().try(I.Joi.DID().prefix().role("ROLE_ACCOUNT"),I.Joi.DID().prefix().role("ROLE_APPLICATION"),I.Joi.DID().prefix().role("ROLE_BLOCKLET"),I.Joi.DID().prefix().wallet("ethereum"),I.Joi.DID().prefix().wallet("passkey")),m=I.Joi.array().items(I.Joi.object({owner:b.required(),tokensList:I.Joi.array().items(l).default([]),assetsList:I.Joi.array().items(I.Joi.DID().prefix().role("ROLE_ASSET")).default([])})),e=I.Joi.array().items({signer:I.Joi.DID().prefix().required(),pk:I.Joi.any().required(),signature:I.Joi.any().required(),delegator:I.Joi.DID().prefix().valid("").optional(),data:I.Joi.any().optional()}),a=I.Joi.object({type:I.Joi.string().min(1).max(32).required(),contractAddress:I.Joi.DID().prefix().wallet("ethereum").required(),chainType:I.Joi.string().min(1).max(32).required(),chainName:I.Joi.string().min(1).max(32).required(),chainId:I.Joi.number().positive().required()}),i=I.Joi.object({type:I.Joi.string().valid("svg","url","uri").required(),content:I.Joi.string().when("type",{is:"uri",then:I.Joi.string().max(20480).dataUri().required()}).when("type",{is:"url",then:I.Joi.string().max(2048).uri({scheme:["http","https"]}).required()})}),r=I.Joi.object({id:I.Joi.string().max(2048).uri({scheme:["http","https"]}).required(),scope:I.Joi.string().valid("public","private").default("public")}),t=I.Joi.object({id:I.Joi.DID().prefix().required(),pk:I.Joi.string().required(),name:I.Joi.string().min(1).max(256).required()}),c={address:I.Joi.DID().prefix().role("ROLE_ASSET").required(),moniker:I.Joi.string().min(2).max(255).required(),data:I.Joi.any().required(),readonly:I.Joi.boolean().default(!1),transferrable:I.Joi.boolean().default(!1),ttl:I.Joi.number().min(0).default(0),parent:I.Joi.DID().prefix().optional().allow(""),issuer:I.Joi.DID().prefix().optional().allow(""),endpoint:r.optional().allow(null).default(null),display:i.optional().allow(null).default(null),tags:I.Joi.array().items(I.Joi.string().min(1).max(64)).max(4).optional()},s={address:I.Joi.DID().prefix().role("ROLE_FACTORY").required(),name:I.Joi.string().min(2).max(255).required(),description:I.Joi.string().min(2).max(255).required(),settlement:I.Joi.string().valid("instant","periodic").default("instant"),limit:I.Joi.number().integer().min(0).default(0),trustedIssuers:I.Joi.array().items(I.Joi.DID().prefix()).max(8).optional(),data:I.Joi.any().optional().allow(null).default(null),display:i.optional().allow(null).default(null),input:I.Joi.object({value:I.Joi.BN().positive().min("0").default("0"),tokens:I.Joi.array().items(l).max(8).optional(),assets:I.Joi.array().items(I.Joi.alternatives().try(I.Joi.DID().prefix().role("ROLE_ASSET"),I.Joi.DID().prefix().role("ROLE_FACTORY"))).max(8).optional(),variables:I.Joi.array().items(I.Joi.object({name:I.Joi.string().min(1).max(255).required(),description:I.Joi.string().max(255).optional().allow(""),required:I.Joi.boolean().required()})).optional()}),output:I.Joi.object({moniker:I.Joi.string().min(2).max(255).required(),data:I.Joi.any().required(),readonly:I.Joi.boolean().default(!1),transferrable:I.Joi.boolean().default(!1),ttl:I.Joi.number().min(0).default(0),parent:I.Joi.string().max(255).required(),issuer:I.Joi.string().max(255).required(),endpoint:r.optional(),display:i.optional(),tags:I.Joi.array().items(I.Joi.string().min(1).max(64)).max(4).optional()}),hooks:I.Joi.array().items(I.Joi.object({name:I.Joi.string().valid("mint","postMint","preMint").required(),type:I.Joi.string().valid("url","contract").required(),hook:I.Joi.string().min(1).max(4096).required(),compiled:I.Joi.array().items(I.Joi.object()).optional()})).optional()};I.schemas={context:_,tokenInput:l,multiInput:m,multiSig:e,foreignToken:a,variableInput:x,nftDisplay:i,nftEndpoint:r,nftIssuer:t,tokenHolder:b,assetProps:c,assetSchema:I.Joi.object(c).options({stripUnknown:!0,noDefaults:!1}),factoryProps:s,factorySchema:I.Joi.object(s).options({stripUnknown:!0,noDefaults:!1})},I.patterns={txHash:p}})(ur);function Ct({onCancel:I,onSuccess:P,blocklet:B}){var c,s;const{vaults:T=[],appPid:L}=B,{t:p,locale:_}=Ve(),{connectApi:l}=ar(),{api:x}=Je(),{teamDid:b}=or(),[m,e]=ir({loading:!1,fetching:!1,error:"",address:"",fetched:[],errored:[]});Ee.useEffect(()=>{if(!Ce.isValid(m.address))return;const o=Ce.toAddress(m.address),h=m.fetched.find(w=>w.address===o),g=m.errored.find(w=>w.address===o);!m.fetching&&!h&&!g&&(e({fetching:!0}),kr(Or.MAIN_CHAIN_ENDPOINT).getAccountState({address:o}).then(R=>{R.state?e({fetching:!1,fetched:[...m.fetched.filter(j=>j.address!==o),R.state]}):e({fetching:!1,errored:[...m.errored.filter(j=>j.address!==o),{address:o}]})}).catch(R=>{console.error(R),e({fetching:!1,error:Ue(R)})}))},[m.address,m.fetching]),Ee.useEffect(()=>{if(m.address){const o=Ce.toAddress(m.address);if(!Ce.isValid(o)){e({error:p("blocklet.config.vault.error.invalid")});return}if(ur.schemas.tokenHolder.validate(o).error){e({error:p("blocklet.config.vault.error.holder")});return}if(T.find(g=>g.did===o)){e({error:p("blocklet.config.vault.error.duplicate")});return}if(Lr([B.appDid,B.appPid,...B.migratedFrom.map(g=>g.appDid)].filter(Boolean)).includes(o)){e({error:p("blocklet.config.vault.error.appDid")});return}}e({error:""})},[m.address]);const a=async()=>{e({loading:!0});try{const o=await x.configVault({input:{teamDid:b,vaultDid:Ce.toAddress(m.address)}});l.open({locale:_,action:"approve-vault",forceConnected:!1,saveConnect:!1,autoConnect:!1,className:"connect",checkTimeout:10*60*1e3,passkeyBehavior:"none",extraParams:{sessionId:o.sessionId},messages:{title:p("blocklet.config.vault.approve.title"),scan:p(`blocklet.config.vault.approve.${T.length>0?"byLast":"byOwner"}`),confirm:p("blocklet.config.vault.approve.confirm"),success:p("blocklet.config.vault.approve.success")},onSuccess:()=>{l.open({locale:_,action:"config-vault",forceConnected:!1,saveConnect:!1,autoConnect:!1,className:"connect",checkTimeout:10*60*1e3,passkeyBehavior:"none",extraParams:{sessionId:o.sessionId},messages:{title:p("blocklet.config.vault.commit.title"),scan:p("blocklet.config.vault.commit.scan"),confirm:p("blocklet.config.vault.commit.confirm"),success:p("blocklet.config.vault.commit.success")},onSuccess:()=>{e({loading:!1}),P()},onClose:()=>{e({loading:!1}),l.close()}})},onClose:()=>{e({loading:!1}),l.close()}})}catch(o){e({loading:!1,error:Ue(o)})}},i=Ce.toAddress(m.address),r=[];Ce.isValid(i)&&r.push({key:p("blocklet.config.vault.role"),value:q.jsx(yr,{color:"primary",variant:"outlined",size:"small",label:Ce.toTypeInfoStr(i).role||"-"})});const t=m.fetched.find(o=>o.address===i);return t&&r.push({key:p("blocklet.config.vault.firstSeen"),value:Qt((c=t.context)==null?void 0:c.genesisTime,"-")},{key:p("blocklet.config.vault.lastSeen"),value:Qt((s=t.context)==null?void 0:s.renaissanceTime,"-")},{key:p("blocklet.config.vault.migratedFrom"),value:t.migratedFrom.length?t.migratedFrom.map(o=>q.jsx(Xt,{did:o,showQrcode:!0,compact:!0,size:14,locale:_},o)):"-"},{key:p("blocklet.config.vault.migratedTo"),value:t.migratedTo.length?t.migratedTo.map(o=>q.jsx(Xt,{did:o,showQrcode:!0,compact:!0,size:14,locale:_},o)):"-"}),q.jsx(nr,{open:!0,fullWidth:!0,showCloseButton:!1,onClose:I,title:q.jsxs(U,{sx:{display:"flex",alignItems:"center",gap:1},children:[q.jsx(jt,{}),p("blocklet.config.vault.title")]}),actions:q.jsxs(q.Fragment,{children:[q.jsx(qe,{onClick:I,children:p("common.cancel")}),q.jsx(qe,{onClick:a,variant:"contained",disabled:!!m.error||m.loading,children:p("common.confirm")})]}),children:q.jsxs(wt,{direction:"column",spacing:3,children:[q.jsxs(Be,{variant:"body1",color:"text.secondary",gutterBottom:!0,children:[p("blocklet.config.vault.desc")," ",p("blocklet.config.vault.tip")]}),T.length>0&&q.jsxs(U,{children:[q.jsxs(Be,{variant:"body1",color:"text.secondary",gutterBottom:!0,children:[p("blocklet.config.vault.current"),":"]}),q.jsxs(U,{sx:{display:"flex",alignItems:"center",gap:.5},children:[q.jsx(Nr,{did:T[T.length-1].did,showQrcode:!0,style:{width:"auto"}}),q.jsx(Pr,{vaults:T,appPid:L})]})]}),q.jsx(vr,{fullWidth:!0,"data-cy":"input-factory-address",label:p("blocklet.config.vault.address"),error:!!m.error,helperText:m.error,value:m.address,InputProps:{endAdornment:m.fetching?q.jsx(br,{position:"end",children:q.jsx(Ze,{size:16})}):null},onChange:o=>{e({address:o.target.value,error:""})}}),q.jsx(U,{sx:{"& .info-row__name":{fontSize:"14px"},"& .info-row__value":{fontSize:"14px"}},children:r.map(o=>q.jsx(qr,{valueComponent:"div",nameWidth:120,name:o.key,children:o.value},o.key))})]})})}Ct.propTypes={onCancel:Oe.func.isRequired,onSuccess:Oe.func.isRequired,blocklet:Oe.object.isRequired};Ct.defaultProps={};function rs({teamDid:I,size:P="small",...B}){const{t:T}=Ve(),{api:L}=Je(),[p,_]=Ee.useState(!1),[l,x]=Ee.useState(null),b=()=>{_(!1),x(null)},m=async()=>{var a;try{_(!0);const i=await L.rotateSessionKey({input:{teamDid:I}});Te.success(T("blocklet.config.rotateSessionKey.success",{count:((a=i.removed)==null?void 0:a.length)||0})),setTimeout(()=>{window.location.reload()},1e3)}catch(i){Te.error(Ue(i))}finally{_(!1),x(null)}},e={title:T("blocklet.config.rotateSessionKey.title"),description:T("blocklet.config.rotateSessionKey.description"),confirm:T("common.confirm"),cancel:T("common.cancel"),onConfirm:m,onCancel:b};return q.jsxs("div",{...B,children:[q.jsxs(qe,{onClick:()=>x(e),color:"error",variant:"outlined",size:P,children:[p?q.jsx(Ze,{size:16,style:{marginRight:5}}):null,T("blocklet.config.rotateSessionKey.action")]}),l&&q.jsx(Mt,{title:l.title,description:l.description,confirm:l.confirm,cancel:l.cancel,onConfirm:l.onConfirm,onCancel:l.onCancel})]})}function Ge({blocklet:I,onUpdate:P,hasPermission:B}){var M,E,N,$,n,d;const{info:T,api:L,inService:p}=Je(),{t:_,locale:l}=Ee.useContext(Er),[x,b]=ir({loading:!1,showTransferOwner:!1,showConfigVault:!1}),[m,e]=Ee.useState(()=>{var v,k,A;return((A=(k=(v=I==null?void 0:I.settings)==null?void 0:v.gateway)==null?void 0:k.wafPolicy)==null?void 0:A.enabled)??!0}),a=!!((E=(M=I==null?void 0:I.settings)==null?void 0:M.invite)!=null&&E.enabled),i=x.loading||!B,{did:r}=I.meta,t=p?(n=($=(N=window.env)==null?void 0:N.gateway)==null?void 0:$.wafPolicy)==null?void 0:n.enabled:(d=T==null?void 0:T.routing.wafPolicy)==null?void 0:d.enabled;if(tr(I.status))return null;const c=I.environments.find(v=>v.key===Ne.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_DELETABLE),s=!c||c.value==="yes",o=I.environments.find(v=>v.key===Ne.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_TENANT_MODE),h=(o==null?void 0:o.value)||Ne.BLOCKLET_TENANT_MODES.SINGLE,g=(v,k)=>async A=>{if(!x.loading){b({loading:!0});try{const{checked:D}=A.target,{blocklet:C}=await L.configBlocklet({input:{did:I.meta.did,configs:[{key:Ne.BLOCKLET_CONFIGURABLE_KEY[v],value:k(D)}]}});P(C)}catch(D){Te.error(D.message)}finally{b({loading:!1})}}},w=g("BLOCKLET_DELETABLE",v=>v?"no":"yes"),R=g("BLOCKLET_APP_TENANT_MODE",v=>v?Ne.BLOCKLET_TENANT_MODES.MULTIPLE:Ne.BLOCKLET_TENANT_MODES.SINGLE),j=async v=>{if(!x.loading){b({loading:!0});try{await L.updateInviteSettings({input:{did:I.meta.did,invite:{enabled:v.target.checked}}})}catch(k){Te.error(k.message)}finally{b({loading:!1})}}},f=async v=>{if(!x.loading){b({loading:!0});try{const k=v.target.checked;await L.updateBlockletGateway({input:{teamDid:I.meta.did,wafPolicy:{enabled:k}}}),e(k)}catch(k){Te.error(k.message)}finally{b({loading:!1})}}},y=async()=>{if(!x.loading){b({loading:!0});try{const{blocklet:v}=await L.getBlocklet({input:{did:I.meta.did}});P(v)}catch(v){Te.error(v.message)}finally{b({loading:!1})}}};return q.jsxs(as,{p:3,sx:{border:"1px solid red",borderRadius:2},className:"advanced-config",children:[!p&&q.jsxs(q.Fragment,{children:[q.jsx(Ie,{title:_("blocklet.config.deletable.name"),desc:_(s?"blocklet.config.deletable.disable":"blocklet.config.deletable.enable"),children:q.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:q.jsx(We,{disabled:i,checked:!s,defaultChecked:!0,onChange:w})})}),q.jsx(U,{className:"config-form",component:Le,my:3})]}),q.jsx(Rt,{inService:p,disabled:i,loading:x.loading,onChange:y}),q.jsx(U,{className:"config-form",component:Le,my:3}),p&&q.jsx(jr,{role:"owner",children:v=>(v||Vr)&&q.jsxs(q.Fragment,{children:[q.jsx(Ie,{title:_("blocklet.config.vault.title"),desc:_("blocklet.config.vault.desc"),children:q.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:q.jsxs(qe,{variant:"contained",color:"primary",size:"small","data-cy":"config-vault",onClick:()=>b({showConfigVault:!0}),children:[q.jsx(jt,{style:{fontSize:"1.3em",marginRight:4}}),_("blocklet.config.vault.title")]})})}),q.jsx(U,{className:"config-form",component:Le,my:3}),x.showConfigVault&&q.jsx(Ct,{blocklet:I,onCancel:()=>b({showConfigVault:!1}),onSuccess:()=>b({showConfigVault:!1})}),q.jsx(Ie,{title:_("team.transferApp.name"),desc:_("team.transferApp.description"),children:q.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:q.jsxs(qe,{variant:"contained",edge:"end",color:"primary",size:"small","data-cy":"transfer-app",onClick:()=>b({showTransferOwner:!0}),children:[q.jsx(lr,{style:{fontSize:"1.3em",marginRight:4}}),_("team.transferApp.name")]})})}),q.jsx(U,{className:"config-form",component:Le,my:3}),x.showTransferOwner&&q.jsx(At,{onCancel:()=>b({showTransferOwner:!1}),onSuccess:()=>b({showTransferOwner:!1})})]})}),q.jsx(Ie,{title:_("blocklet.config.clearCache.name"),desc:_("blocklet.config.clearCache.purpose"),children:q.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:q.jsx(Wr,{teamDid:r})})}),q.jsx(U,{className:"config-form",component:Le,my:3}),q.jsx(Ie,{title:_("blocklet.config.rotateSessionKey.name"),desc:_("blocklet.config.rotateSessionKey.purpose"),children:q.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:q.jsx(rs,{style:{whiteSpace:"nowrap"},teamDid:r})})}),q.jsx(U,{className:"config-form",component:Le,my:3}),q.jsx(Ie,{title:_("blocklet.config.tenantMode.name"),desc:_(`blocklet.config.tenantMode.${h}`),children:q.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:q.jsx(We,{disabled:i,checked:h===Ne.BLOCKLET_TENANT_MODES.MULTIPLE,onChange:R})})}),q.jsx(U,{className:"config-form",component:Le,my:3}),q.jsx(Ie,{title:_("team.invite.setting"),desc:_(`team.invite.${a?"enabled":"disabled"}`),children:q.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:q.jsx(We,{disabled:i,checked:a,onChange:j})})}),t&&q.jsxs(q.Fragment,{children:[q.jsx(U,{className:"config-form",component:Le,my:3}),q.jsx(Ie,{title:q.jsxs(wt,{direction:"row",alignItems:"center",gap:1,children:[_("router.gateway.wafPolicy.title"),q.jsx(_r,{title:q.jsx(U,{sx:{fontSize:"14px",lineHeight:1.5},children:q.jsx(U,{sx:{color:"common.white",ml:.5},component:"a",href:`https://www.arcblock.io/docs/blocklet-developer/${l}/enable-web-application-firewall`,target:"_blank",rel:"noopener noreferrer",children:_("dashboard.document")})}),children:q.jsx(Dr,{fontSize:"small",color:"action",sx:{fontSize:16,cursor:"pointer"}})})]}),desc:_("router.gateway.wafPolicy.switchLabel"),children:q.jsx(U,{sx:{alignSelf:{xs:"flex-start",md:"flex-end"}},children:q.jsx(We,{disabled:i,checked:m,onChange:f})})})]})]})}const ss=He(Ge,"mutate_blocklets"),ns=He(Ge,"",rr);function is(I){const{inService:P}=Je();return P?q.jsx(ns,{...I}):q.jsx(ss,{...I})}Ge.propTypes={blocklet:Oe.object.isRequired,onUpdate:Oe.func,hasPermission:Oe.bool};Ge.defaultProps={onUpdate:()=>{},hasPermission:!1};const as=_t(wt)``;function Ye({blocklet:I,onUpdate:P,hasPermission:B}){return tr(I.status)?null:q.jsx(cs,{children:q.jsx(is,{blocklet:I,onUpdate:P,hasPermission:B})})}const os=He(Ye,"mutate_blocklets"),ls=He(Ye,"",rr);function Ns(I){const{inService:P}=Je();return P?q.jsx(ls,{...I}):q.jsx(os,{...I})}Ye.propTypes={blocklet:Oe.object.isRequired,onUpdate:Oe.func,hasPermission:Oe.bool};Ye.defaultProps={onUpdate:()=>{},hasPermission:!1};const cs=_t(U)`
|
|
8
8
|
max-width: 1536px;
|
|
9
9
|
|
|
10
10
|
.advanced-config {
|
|
11
11
|
border: 0;
|
|
12
12
|
padding: 0;
|
|
13
13
|
}
|
|
14
|
-
`;export{
|
|
14
|
+
`;export{Ns as default};
|