@kyro-cms/core 0.13.3 → 0.13.6
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/dist/{WebhookService-BOJMgjBm.d.cts → WebhookService-BJTCP3cU.d.cts} +1 -1
- package/dist/{WebhookService-BLi5Rz2m.d.ts → WebhookService-Bqr_66lK.d.ts} +1 -1
- package/dist/api-handler-graphql.cjs +1 -1
- package/dist/api-handler-graphql.js +2 -2
- package/dist/api-handler-trpc.cjs +1 -1
- package/dist/api-handler-trpc.js +2 -2
- package/dist/api-handler.cjs +1 -1
- package/dist/api-handler.js +1 -1
- package/dist/auth-session-4WJUKESW.js +1 -0
- package/dist/auth-session-VHUHDBCL.cjs +1 -0
- package/dist/{base-A9AJPCG5.d.ts → base-C2DOe8wD.d.ts} +2 -2
- package/dist/{base-C6wyX2nC.d.cts → base-DIpT2Vuz.d.cts} +2 -2
- package/dist/bootstrap-JYAUQ52D.cjs +1 -0
- package/dist/bootstrap-TTMLNQM3.js +1 -0
- package/dist/chunk-23RSKVJP.cjs +1 -0
- package/dist/chunk-24W5I6SJ.cjs +2 -0
- package/dist/{chunk-CH4TZZI5.js → chunk-2I2AXTKY.cjs} +38 -39
- package/dist/chunk-34LCWI5X.cjs +1 -0
- package/dist/chunk-3A5UO6OQ.cjs +114 -0
- package/dist/chunk-3N34WXBS.js +2 -0
- package/dist/chunk-5BUAWCU6.js +91 -0
- package/dist/{chunk-7NKNSRCB.cjs → chunk-5I3BM5TV.js} +33 -32
- package/dist/chunk-5RBGM5N5.js +3 -0
- package/dist/chunk-7EY3GXRA.js +2 -0
- package/dist/chunk-7KTPBTH5.cjs +1 -0
- package/dist/chunk-A4XM33WO.js +109 -0
- package/dist/chunk-A7763NCF.cjs +19 -0
- package/dist/chunk-AQWTJGML.cjs +1 -0
- package/dist/chunk-CIWLQXB2.js +2 -0
- package/dist/chunk-DCFOVCJX.cjs +1 -0
- package/dist/chunk-DCKJT247.cjs +1 -0
- package/dist/chunk-EG4SRTYS.cjs +2 -0
- package/dist/chunk-FAG2645P.js +2 -0
- package/dist/chunk-FIVTKI25.cjs +3 -0
- package/dist/chunk-FU76HURF.cjs +1 -0
- package/dist/chunk-GDLMPZKD.cjs +2 -0
- package/dist/chunk-GS4CMYKS.cjs +1 -0
- package/dist/chunk-GTAKGVUY.js +2 -0
- package/dist/chunk-GWUHIIPO.cjs +132 -0
- package/dist/chunk-H2IJDTA2.cjs +1 -0
- package/dist/chunk-HACW42ZZ.cjs +108 -0
- package/dist/chunk-HCM2G674.cjs +20 -0
- package/dist/chunk-I22MSXGL.js +2 -0
- package/dist/chunk-IIPSXKNV.js +115 -0
- package/dist/{chunk-WNU76M2C.js → chunk-IIVBEZC2.js} +6 -6
- package/dist/chunk-JHFD3IAU.cjs +1 -0
- package/dist/chunk-JJY2F6NL.cjs +3 -0
- package/dist/chunk-JQ4V2MGJ.cjs +2 -0
- package/dist/chunk-JXJTFBHG.js +3 -0
- package/dist/chunk-KOSR7235.cjs +1 -0
- package/dist/chunk-KUY4QDAL.js +2 -0
- package/dist/chunk-LGUHXOEW.js +3 -0
- package/dist/chunk-LXTVMP5F.cjs +6 -0
- package/dist/chunk-N25DOGLQ.js +5 -0
- package/dist/chunk-N2BMGZIX.cjs +90 -0
- package/dist/chunk-N7CDHWQH.cjs +2 -0
- package/dist/chunk-NBBAMC2X.cjs +1 -0
- package/dist/chunk-NGNXOXI5.js +2 -0
- package/dist/chunk-O4PPZOVI.cjs +1 -0
- package/dist/chunk-O4RKZQYQ.js +2 -0
- package/dist/chunk-OJBL4CXK.cjs +2 -0
- package/dist/chunk-OPKZYQV7.js +3 -0
- package/dist/chunk-OXEJCIOA.cjs +1 -0
- package/dist/chunk-OXH6CANN.js +2 -0
- package/dist/{chunk-EQN3HDES.cjs → chunk-PW6Y5MQL.cjs} +5 -5
- package/dist/chunk-RLW6AQF2.js +2 -0
- package/dist/chunk-SBFVITY2.js +7 -0
- package/dist/chunk-SEJ7LMYY.js +4 -0
- package/dist/chunk-SZY25KAE.js +21 -0
- package/dist/chunk-TG5YQ4PB.cjs +4 -0
- package/dist/chunk-TJ6N5ZPZ.js +133 -0
- package/dist/chunk-V2RMDMWN.js +2 -0
- package/dist/chunk-V4SR7DU5.js +3 -0
- package/dist/chunk-VLFM66BZ.js +4 -0
- package/dist/chunk-VPBGZW4P.cjs +1 -0
- package/dist/chunk-VQWOCGJ2.cjs +1 -0
- package/dist/chunk-VWXHW74B.js +3 -0
- package/dist/chunk-W5GDZG64.js +2 -0
- package/dist/chunk-WLSVS3NC.js +2 -0
- package/dist/chunk-YLP3EKTQ.js +2 -0
- package/dist/chunk-YNSKDTFG.js +2 -0
- package/dist/chunk-YOJOVQIH.cjs +1 -0
- package/dist/chunk-ZE2X3FBU.js +20 -0
- package/dist/chunk-ZMH35QYG.js +2 -0
- package/dist/cli/index.cjs +53 -182
- package/dist/cli/index.js +54 -183
- package/dist/drizzle/index.cjs +1 -1
- package/dist/drizzle/index.d.cts +3 -3
- package/dist/drizzle/index.d.ts +3 -3
- package/dist/drizzle/index.js +1 -1
- package/dist/fields/index.cjs +1 -1
- package/dist/fields/index.d.cts +2 -2
- package/dist/fields/index.d.ts +2 -2
- package/dist/fields/index.js +1 -1
- package/dist/graphql/index.cjs +1 -1
- package/dist/graphql/index.d.cts +3 -3
- package/dist/graphql/index.d.ts +3 -3
- package/dist/graphql/index.js +1 -1
- package/dist/{index-BttsFZDa.d.ts → index-C9uBoJtm.d.ts} +2 -2
- package/dist/{index-BMcYFpTv.d.cts → index-Ci7aUrmN.d.cts} +2 -2
- package/dist/index.cjs +30 -30
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +31 -31
- package/dist/integration.cjs +1 -1
- package/dist/integration.js +1 -1
- package/dist/local-DKP43BWQ.cjs +1 -0
- package/dist/local-TF5ZMHWW.js +1 -0
- package/dist/media-M3EIZ4QS.cjs +1 -0
- package/dist/media-WYEILC6K.js +1 -0
- package/dist/mongo-auth-adapter-33M5ENM7.cjs +1 -0
- package/dist/mongo-auth-adapter-4ITULS2P.js +1 -0
- package/dist/mongodb/index.cjs +1 -1
- package/dist/mongodb/index.d.cts +3 -3
- package/dist/mongodb/index.d.ts +3 -3
- package/dist/mongodb/index.js +1 -1
- package/dist/nodemailer-transport-7F3VLLBW.js +1 -0
- package/dist/nodemailer-transport-WAPZD3SJ.cjs +1 -0
- package/dist/postgres-auth-adapter-7BCPXNBO.js +1 -0
- package/dist/postgres-auth-adapter-HMXFUM5W.cjs +1 -0
- package/dist/redis-adapter-2E5AWMMA.cjs +1 -0
- package/dist/redis-adapter-GFH74CF4.js +1 -0
- package/dist/rest/index.cjs +1 -1
- package/dist/rest/index.d.cts +4 -4
- package/dist/rest/index.d.ts +4 -4
- package/dist/rest/index.js +1 -1
- package/dist/schema-FNIDQKIJ.cjs +1 -0
- package/dist/schema-KD736QFN.js +1 -0
- package/dist/sqlite-adapter-HL53RLSN.cjs +1 -0
- package/dist/sqlite-adapter-TT6ZASDG.js +1 -0
- package/dist/templates/index.cjs +1 -1
- package/dist/templates/index.d.cts +2 -2
- package/dist/templates/index.d.ts +2 -2
- package/dist/templates/index.js +1 -1
- package/dist/trpc/index.cjs +1 -1
- package/dist/trpc/index.d.cts +3 -3
- package/dist/trpc/index.d.ts +3 -3
- package/dist/trpc/index.js +1 -1
- package/dist/{types-DxaK39ix.d.cts → types-C3QFX0l6.d.cts} +4 -0
- package/dist/{types-DxaK39ix.d.ts → types-C3QFX0l6.d.ts} +4 -0
- package/dist/{types-6ShQp2EM.d.cts → types-CKWnrUAh.d.ts} +23 -2
- package/dist/{types-BCOhfwHC.d.ts → types-CdwfDpyW.d.cts} +23 -2
- package/dist/ws/index.cjs +1 -1
- package/dist/ws/index.js +1 -1
- package/package.json +3 -11
- package/dist/WebhookService-BcuD8tnn.d.cts +0 -143
- package/dist/WebhookService-CFe6Zd0_.d.cts +0 -143
- package/dist/WebhookService-CGxHtw7E.d.cts +0 -143
- package/dist/WebhookService-CNC1lYz7.d.ts +0 -143
- package/dist/WebhookService-CVXmjbtQ.d.cts +0 -143
- package/dist/WebhookService-D5PSI5t6.d.cts +0 -143
- package/dist/WebhookService-DPCCn_12.d.ts +0 -143
- package/dist/WebhookService-Dk1lzSrG.d.cts +0 -143
- package/dist/WebhookService-Dncnbgm9.d.cts +0 -143
- package/dist/WebhookService-I6hdue2Y.d.ts +0 -143
- package/dist/WebhookService-KnQ2UDlW.d.ts +0 -143
- package/dist/WebhookService-UY5p89Bj.d.ts +0 -143
- package/dist/WebhookService-YZXBCRXA.d.ts +0 -143
- package/dist/WebhookService-fk0FGRlk.d.ts +0 -143
- package/dist/WebhookService-vsFnWrOh.d.ts +0 -143
- package/dist/WebhookService-zrDmAx7L.d.cts +0 -143
- package/dist/auth-session-DHVGXHOH.cjs +0 -1
- package/dist/auth-session-O7IIH7EP.js +0 -1
- package/dist/base-B--L0lCn.d.cts +0 -218
- package/dist/base-B-i-tjm1.d.ts +0 -218
- package/dist/base-B-siit_y.d.cts +0 -218
- package/dist/base-B8SyZI4D.d.ts +0 -218
- package/dist/base-BCgFt3Yx.d.ts +0 -218
- package/dist/base-BHRGJ40F.d.cts +0 -218
- package/dist/base-BVoDPNjJ.d.cts +0 -218
- package/dist/base-BaOJ5uWd.d.cts +0 -218
- package/dist/base-BfPaVEAE.d.cts +0 -218
- package/dist/base-BxrX5EPU.d.cts +0 -218
- package/dist/base-CAb9EYQs.d.ts +0 -218
- package/dist/base-CcZIEll-.d.ts +0 -218
- package/dist/base-CyG7aF1e.d.cts +0 -218
- package/dist/base-DOImeJ-F.d.ts +0 -218
- package/dist/base-DbnwE42-.d.cts +0 -218
- package/dist/base-NyiSsD-n.d.ts +0 -218
- package/dist/base-OYfoYPYP.d.ts +0 -218
- package/dist/base-xflndGDO.d.ts +0 -218
- package/dist/bcryptjs-WIQSWJGK.cjs +0 -1
- package/dist/bcryptjs-ZEEHSMAG.js +0 -2
- package/dist/better-sqlite3-5IISPX34.cjs +0 -1
- package/dist/better-sqlite3-B34RIU4C.js +0 -2
- package/dist/bootstrap-E24SGUJP.cjs +0 -1
- package/dist/bootstrap-PG2LGDLB.js +0 -1
- package/dist/bootstrap-QQ6D3OYG.js +0 -1
- package/dist/bootstrap-QVKSKXJF.cjs +0 -1
- package/dist/bootstrap-RILR44UM.cjs +0 -1
- package/dist/bootstrap-YD3GLTWX.cjs +0 -1
- package/dist/bootstrap-YFVE7MRG.js +0 -1
- package/dist/bootstrap-ZRRUPRUR.js +0 -1
- package/dist/bowser-SB3ZUPO4.js +0 -11
- package/dist/bowser-VX6B6ZSE.cjs +0 -10
- package/dist/chokidar-5RVQZVHP.cjs +0 -5
- package/dist/chokidar-BOYGRT4Q.js +0 -6
- package/dist/chunk-22RXJ442.js +0 -57
- package/dist/chunk-262YP5XA.cjs +0 -1
- package/dist/chunk-2FSOHXOU.cjs +0 -56
- package/dist/chunk-2HA6EKXX.js +0 -24
- package/dist/chunk-2OS5Y4LE.cjs +0 -1
- package/dist/chunk-2PXXQKN3.cjs +0 -3
- package/dist/chunk-2SPWRQ5O.js +0 -122
- package/dist/chunk-32QY56XF.js +0 -122
- package/dist/chunk-355R4LS5.cjs +0 -56
- package/dist/chunk-35IVNLMA.js +0 -122
- package/dist/chunk-35PGCW3S.cjs +0 -1
- package/dist/chunk-3GXLOYM3.js +0 -2
- package/dist/chunk-3KZXF4US.js +0 -2
- package/dist/chunk-3LAWUINR.cjs +0 -1
- package/dist/chunk-3NSZZCOJ.js +0 -2
- package/dist/chunk-3O3AVMWM.cjs +0 -1
- package/dist/chunk-3TAUNYEM.js +0 -8
- package/dist/chunk-3U6MKWET.cjs +0 -120
- package/dist/chunk-3VXEK5ZW.cjs +0 -1
- package/dist/chunk-47CXBWMA.js +0 -2
- package/dist/chunk-4BMWWGJN.js +0 -384
- package/dist/chunk-4NTIK6DF.cjs +0 -2
- package/dist/chunk-4YCI3HBD.js +0 -3
- package/dist/chunk-4ZWLNGLS.js +0 -2
- package/dist/chunk-5A7E7N4B.cjs +0 -431
- package/dist/chunk-5ZEYOFAK.js +0 -2
- package/dist/chunk-6DD4J7LI.js +0 -2
- package/dist/chunk-6E44MQQ5.js +0 -115
- package/dist/chunk-6GGPY7U2.js +0 -4
- package/dist/chunk-6LWF5MPL.js +0 -20
- package/dist/chunk-6MNLRAKM.cjs +0 -121
- package/dist/chunk-6NBZDW53.js +0 -133
- package/dist/chunk-6TPICJ2L.js +0 -7
- package/dist/chunk-73D2PNHD.cjs +0 -7
- package/dist/chunk-73Y63IPP.js +0 -57
- package/dist/chunk-7ACHOBWY.cjs +0 -13
- package/dist/chunk-7DUKWHRN.cjs +0 -1
- package/dist/chunk-7GGZA5YU.cjs +0 -2
- package/dist/chunk-7JWQ2PZP.cjs +0 -1
- package/dist/chunk-7K6ZUNJM.js +0 -4
- package/dist/chunk-7KLEANTO.cjs +0 -1
- package/dist/chunk-7LLCXY5O.cjs +0 -19
- package/dist/chunk-7MNDQU6K.js +0 -8
- package/dist/chunk-7NH7H3WA.js +0 -10
- package/dist/chunk-7WMMKGEO.cjs +0 -1
- package/dist/chunk-A35ZP72D.cjs +0 -132
- package/dist/chunk-A3IOQOV6.js +0 -2
- package/dist/chunk-A3XVL6ED.cjs +0 -3
- package/dist/chunk-A7LZ6T42.cjs +0 -1
- package/dist/chunk-APDQ6ZTG.cjs +0 -120
- package/dist/chunk-ATI2UZ7U.js +0 -2
- package/dist/chunk-AWQGDMOE.js +0 -3
- package/dist/chunk-B3BSVEFC.cjs +0 -3
- package/dist/chunk-B4AC23SG.js +0 -122
- package/dist/chunk-BAVN7VDR.cjs +0 -1
- package/dist/chunk-BCEE4NBZ.cjs +0 -2
- package/dist/chunk-BD6XHMMM.cjs +0 -2
- package/dist/chunk-BUNLC3II.cjs +0 -1
- package/dist/chunk-C7QCZX7X.js +0 -2
- package/dist/chunk-CHYVUWZ3.js +0 -2
- package/dist/chunk-CIVA6SKW.js +0 -2
- package/dist/chunk-CNHUCCQJ.js +0 -121
- package/dist/chunk-CRP6PSCE.js +0 -2
- package/dist/chunk-D6SDGHY6.js +0 -2
- package/dist/chunk-DI6TCZSE.js +0 -122
- package/dist/chunk-DORUYZQV.cjs +0 -1
- package/dist/chunk-DSHKQL3R.cjs +0 -121
- package/dist/chunk-DVWYO3KK.cjs +0 -1
- package/dist/chunk-E4H3ZZ7U.js +0 -4
- package/dist/chunk-EFKEVWAD.js +0 -4
- package/dist/chunk-EHWUALGH.cjs +0 -1
- package/dist/chunk-EI7FRSNY.js +0 -57
- package/dist/chunk-ELFQKQLL.js +0 -2
- package/dist/chunk-EML5FDUU.js +0 -2
- package/dist/chunk-EN65ZEK2.cjs +0 -2
- package/dist/chunk-EON4XLKQ.cjs +0 -1
- package/dist/chunk-EUQAOYEO.cjs +0 -121
- package/dist/chunk-EVAUBT7H.js +0 -57
- package/dist/chunk-EW424IBO.cjs +0 -1
- package/dist/chunk-EYHD7HZE.cjs +0 -1
- package/dist/chunk-EYYIPA5N.js +0 -432
- package/dist/chunk-EZIDQBXI.cjs +0 -1
- package/dist/chunk-F2O4QO5N.cjs +0 -383
- package/dist/chunk-F4ITQ6XQ.cjs +0 -3
- package/dist/chunk-FBWLSWZ4.js +0 -122
- package/dist/chunk-FDKU7HJX.js +0 -2
- package/dist/chunk-FG3IFGJP.cjs +0 -1
- package/dist/chunk-FGN6IMPY.cjs +0 -3
- package/dist/chunk-FK2BG4HU.js +0 -3
- package/dist/chunk-FLMUMPDE.js +0 -2
- package/dist/chunk-FLS2FJM6.cjs +0 -431
- package/dist/chunk-FP5UK272.cjs +0 -1
- package/dist/chunk-FSL3NLRT.cjs +0 -2
- package/dist/chunk-FUFS65Q5.js +0 -133
- package/dist/chunk-GIS6X43A.cjs +0 -3
- package/dist/chunk-GNEVCEJU.cjs +0 -3
- package/dist/chunk-GNOSG3PK.cjs +0 -1
- package/dist/chunk-GQGFNTDZ.js +0 -2
- package/dist/chunk-GTR7JAKP.cjs +0 -3
- package/dist/chunk-GV2IB4WQ.cjs +0 -56
- package/dist/chunk-GWIZT2P5.js +0 -57
- package/dist/chunk-H3FJ54KB.cjs +0 -121
- package/dist/chunk-HPIJI7TM.js +0 -3
- package/dist/chunk-HPYH7GTS.cjs +0 -1
- package/dist/chunk-HRAY65XH.js +0 -3
- package/dist/chunk-HTYVI2HK.cjs +0 -9
- package/dist/chunk-HY3EAWB2.js +0 -4
- package/dist/chunk-I6UJVO2P.js +0 -57
- package/dist/chunk-IKGVPXMK.js +0 -3
- package/dist/chunk-IQSF6XRV.js +0 -57
- package/dist/chunk-IXGDTAES.js +0 -4
- package/dist/chunk-J6V573PE.cjs +0 -1
- package/dist/chunk-JA44K75G.js +0 -2
- package/dist/chunk-JB4WG2YJ.cjs +0 -121
- package/dist/chunk-JCEJ4VTN.js +0 -20
- package/dist/chunk-JRUQ5ABB.js +0 -4
- package/dist/chunk-JV4HJBXW.js +0 -14
- package/dist/chunk-JZ7Z6WC2.cjs +0 -3
- package/dist/chunk-K5XGP57D.cjs +0 -19
- package/dist/chunk-K73HOMQY.cjs +0 -56
- package/dist/chunk-KEITOXIP.js +0 -2
- package/dist/chunk-KMFLHGD5.cjs +0 -1
- package/dist/chunk-KZHXYXSH.cjs +0 -10
- package/dist/chunk-L3Q64RUX.js +0 -3
- package/dist/chunk-LBLFU6KI.js +0 -57
- package/dist/chunk-LEBM6ZSZ.cjs +0 -10
- package/dist/chunk-LP3HRZGK.js +0 -57
- package/dist/chunk-LPFRMQFQ.js +0 -121
- package/dist/chunk-LQ3YZTPU.cjs +0 -15
- package/dist/chunk-LVBHOZZF.js +0 -4
- package/dist/chunk-LWM4WABU.js +0 -3
- package/dist/chunk-LY7N3UHH.cjs +0 -23
- package/dist/chunk-LYU44UNN.cjs +0 -56
- package/dist/chunk-M75VGFCI.js +0 -3
- package/dist/chunk-MCIZG4A3.cjs +0 -1
- package/dist/chunk-MDLJTZLV.cjs +0 -1
- package/dist/chunk-MFNN5DYG.cjs +0 -1
- package/dist/chunk-MJAODEFC.cjs +0 -121
- package/dist/chunk-MLCBSEBU.js +0 -2
- package/dist/chunk-MSC4G2HF.cjs +0 -2
- package/dist/chunk-MYHNTJLR.cjs +0 -56
- package/dist/chunk-N2YHO2WI.cjs +0 -3
- package/dist/chunk-N4FXLQE3.cjs +0 -132
- package/dist/chunk-N5POANYV.js +0 -2
- package/dist/chunk-N6MNQIQU.js +0 -123
- package/dist/chunk-NGNJSUGL.cjs +0 -1
- package/dist/chunk-NPBXLPOP.js +0 -3
- package/dist/chunk-NRE6VKL6.cjs +0 -121
- package/dist/chunk-O4YE57OS.cjs +0 -6
- package/dist/chunk-O7CBGP4N.cjs +0 -1
- package/dist/chunk-OBYAIJVU.js +0 -11
- package/dist/chunk-OJ3H4AQ2.cjs +0 -56
- package/dist/chunk-OLRCZ6E3.js +0 -2
- package/dist/chunk-ON5XJEPO.cjs +0 -3
- package/dist/chunk-OOVNTOZC.cjs +0 -56
- package/dist/chunk-OPTVCCQQ.cjs +0 -122
- package/dist/chunk-OT2Z4XBD.cjs +0 -1
- package/dist/chunk-P6JITOFF.js +0 -4
- package/dist/chunk-PFKVHUOT.js +0 -432
- package/dist/chunk-PFTBTWSC.cjs +0 -1
- package/dist/chunk-PITMDQYN.cjs +0 -18
- package/dist/chunk-PTPVFLET.js +0 -20
- package/dist/chunk-PYUWSKKP.js +0 -57
- package/dist/chunk-PZDLPRJF.js +0 -4
- package/dist/chunk-Q5TFO66G.cjs +0 -1
- package/dist/chunk-QC4YXUBT.cjs +0 -383
- package/dist/chunk-QO5ZWQA3.cjs +0 -74
- package/dist/chunk-QUTYCUST.js +0 -4
- package/dist/chunk-QYN6C3FZ.cjs +0 -114
- package/dist/chunk-REKKBAQX.cjs +0 -56
- package/dist/chunk-REQ622YC.js +0 -3
- package/dist/chunk-RPRGGGIW.js +0 -11
- package/dist/chunk-RTNQP6BV.js +0 -2
- package/dist/chunk-RUJW47ZJ.js +0 -2
- package/dist/chunk-RVBSJ4UQ.cjs +0 -7
- package/dist/chunk-RXYCFZJC.cjs +0 -121
- package/dist/chunk-RYHOWZLK.js +0 -2
- package/dist/chunk-RYXLEFS5.js +0 -2
- package/dist/chunk-S2MZNEBQ.cjs +0 -1
- package/dist/chunk-S5HTTLN7.cjs +0 -2
- package/dist/chunk-S73YERS2.js +0 -57
- package/dist/chunk-SBNMXQNO.cjs +0 -2
- package/dist/chunk-SLMIYECU.js +0 -2
- package/dist/chunk-SMQ6736Y.js +0 -57
- package/dist/chunk-SRIXRJHL.js +0 -4
- package/dist/chunk-T3DJ3UTP.cjs +0 -121
- package/dist/chunk-TBHNE4VV.js +0 -2
- package/dist/chunk-TCFL3UWT.cjs +0 -2
- package/dist/chunk-TEY5LZ26.cjs +0 -56
- package/dist/chunk-TJZO7ZSX.cjs +0 -3
- package/dist/chunk-TKUNRCRH.js +0 -4
- package/dist/chunk-TQLCOMKC.js +0 -4
- package/dist/chunk-TRXYDWGE.cjs +0 -1
- package/dist/chunk-TS55CUNJ.js +0 -57
- package/dist/chunk-TYQYKKWJ.js +0 -16
- package/dist/chunk-U6KFONKM.js +0 -2
- package/dist/chunk-UFBJ3WOZ.js +0 -2
- package/dist/chunk-UNYXWPLZ.cjs +0 -2
- package/dist/chunk-UQRVQUVR.js +0 -2
- package/dist/chunk-UW5W35NP.js +0 -122
- package/dist/chunk-UWHWSWDE.js +0 -2
- package/dist/chunk-UWVBFRCW.js +0 -2
- package/dist/chunk-UZWYFEUN.js +0 -122
- package/dist/chunk-V4FAL7AG.js +0 -2
- package/dist/chunk-VI7WCO2J.cjs +0 -3
- package/dist/chunk-VOYPKTID.cjs +0 -1
- package/dist/chunk-VQ53TFYA.cjs +0 -1
- package/dist/chunk-VRZC4TTF.cjs +0 -1
- package/dist/chunk-VTOL3URF.js +0 -4
- package/dist/chunk-VVVCCB6R.js +0 -2
- package/dist/chunk-W2GPP6RB.js +0 -122
- package/dist/chunk-W45TLOOT.js +0 -2
- package/dist/chunk-WAVGRSE6.js +0 -2
- package/dist/chunk-WHOA7YJU.cjs +0 -1
- package/dist/chunk-WNRUPL26.js +0 -2
- package/dist/chunk-WPM6LFCY.js +0 -2
- package/dist/chunk-WXT2XW7T.js +0 -13
- package/dist/chunk-X473JI7Z.js +0 -75
- package/dist/chunk-X6HUA6EF.cjs +0 -20
- package/dist/chunk-XBQ6HV3T.cjs +0 -114
- package/dist/chunk-XDPLVJRO.js +0 -21
- package/dist/chunk-XDQVYCIR.cjs +0 -1
- package/dist/chunk-XFYSADHV.cjs +0 -2
- package/dist/chunk-XIAJQLGS.js +0 -2
- package/dist/chunk-XK6UB77Q.js +0 -4
- package/dist/chunk-XOR64WUQ.cjs +0 -19
- package/dist/chunk-XP7BXFXT.cjs +0 -121
- package/dist/chunk-Y2VHO66Q.cjs +0 -3
- package/dist/chunk-Y2YAKDEQ.js +0 -2
- package/dist/chunk-Y5O2OD7J.cjs +0 -3
- package/dist/chunk-YARB43JG.cjs +0 -56
- package/dist/chunk-YENNL5HG.js +0 -2
- package/dist/chunk-YGI5W4RS.js +0 -2
- package/dist/chunk-YLCEMVYY.cjs +0 -56
- package/dist/chunk-YSOM57GK.cjs +0 -3
- package/dist/chunk-YUUXFD73.js +0 -19
- package/dist/chunk-Z2SN2MYP.js +0 -122
- package/dist/chunk-Z3UVDGYS.cjs +0 -56
- package/dist/chunk-ZAKYTBEN.js +0 -3
- package/dist/chunk-ZHA446FA.cjs +0 -1
- package/dist/chunk-ZO3YB5DK.cjs +0 -1
- package/dist/chunk-ZOVH6QT5.cjs +0 -1
- package/dist/chunk-ZRIBWDYJ.js +0 -384
- package/dist/chunk-ZTLGK6R4.cjs +0 -12
- package/dist/chunk-ZUBJ6RLQ.cjs +0 -1
- package/dist/chunk-ZWDBPEXL.js +0 -115
- package/dist/client.d.cts +0 -1266
- package/dist/client.d.ts +0 -1266
- package/dist/d1-5ZQJOFDX.cjs +0 -1
- package/dist/d1-HPB6B253.js +0 -2
- package/dist/dist-es-3SSNUZST.cjs +0 -1
- package/dist/dist-es-64F22JL2.js +0 -2
- package/dist/dist-es-A5OF2STN.cjs +0 -2
- package/dist/dist-es-BOW5V247.cjs +0 -6
- package/dist/dist-es-CRIMATLL.cjs +0 -2
- package/dist/dist-es-DL3VLVP6.cjs +0 -1
- package/dist/dist-es-F2ZR55UK.js +0 -4
- package/dist/dist-es-IPSSZNFP.js +0 -1
- package/dist/dist-es-M2F7M27Y.js +0 -2
- package/dist/dist-es-M66JKZF5.js +0 -7
- package/dist/dist-es-OKLLRYI3.js +0 -2
- package/dist/dist-es-P25IKLBI.cjs +0 -1
- package/dist/dist-es-SRPWSAF4.cjs +0 -1
- package/dist/dist-es-SVHZDVUF.js +0 -3
- package/dist/dist-es-T2H2W5BX.cjs +0 -3
- package/dist/dist-es-WFI55HKT.js +0 -3
- package/dist/drizzle-orm-47ELDEM6.cjs +0 -1
- package/dist/drizzle-orm-XRTSOQJS.js +0 -1
- package/dist/event-streams-7NAWZW2I.js +0 -1
- package/dist/event-streams-JBMWCI2O.cjs +0 -1
- package/dist/fs-KWBRQ6T6.js +0 -1
- package/dist/fs-ZQYOJOIO.cjs +0 -1
- package/dist/index-8Ino7vKq.d.ts +0 -105
- package/dist/index-B9BFNOHd.d.cts +0 -105
- package/dist/index-ByOM1Y5x.d.ts +0 -105
- package/dist/index-C6xmtRio.d.cts +0 -105
- package/dist/index-CTI3K_uq.d.cts +0 -105
- package/dist/index-CTL4zv_u.d.ts +0 -105
- package/dist/index-CaDbioSg.d.ts +0 -105
- package/dist/index-CxA9uOv0.d.ts +0 -105
- package/dist/index-D6AXbuPI.d.ts +0 -105
- package/dist/index-DF0KDBaM.d.cts +0 -105
- package/dist/index-DG4Xu7gA.d.cts +0 -105
- package/dist/index-DS3DpJli.d.cts +0 -105
- package/dist/index-NGnJpSgf.d.ts +0 -105
- package/dist/index-Zrg3sZ6R.d.cts +0 -105
- package/dist/index-eHex8Iwj.d.ts +0 -105
- package/dist/index-rm7uyOK1.d.cts +0 -105
- package/dist/jsonwebtoken-DFB6ZBZA.cjs +0 -8
- package/dist/jsonwebtoken-OD67R5JS.js +0 -9
- package/dist/lib-5QYYN6ML.cjs +0 -12
- package/dist/lib-A2D63VXD.cjs +0 -1
- package/dist/lib-JQD2JAOO.js +0 -2
- package/dist/lib-XXYYUPMW.js +0 -13
- package/dist/loadSso-JY4WDQPS.cjs +0 -2
- package/dist/loadSso-UQR6545M.js +0 -3
- package/dist/local-6UUGBZ4M.js +0 -1
- package/dist/local-DPLKZQA3.js +0 -1
- package/dist/local-KR3AIGVA.cjs +0 -1
- package/dist/local-S5VA7IXE.cjs +0 -1
- package/dist/local-T7GISZBL.js +0 -1
- package/dist/local-ZYHV3J2K.cjs +0 -1
- package/dist/media-3Z6YW5J4.cjs +0 -1
- package/dist/media-E762GEHL.js +0 -1
- package/dist/mongo-auth-adapter-2H2AXDRH.cjs +0 -1
- package/dist/mongo-auth-adapter-EUHAYWJ6.cjs +0 -1
- package/dist/mongo-auth-adapter-FW7ATYQ6.js +0 -1
- package/dist/mongo-auth-adapter-GR2CFFEA.js +0 -1
- package/dist/mongo-auth-adapter-UOO2LZUJ.cjs +0 -1
- package/dist/mongo-auth-adapter-YWMEOC42.js +0 -1
- package/dist/nodemailer-IDML4L6W.cjs +0 -53
- package/dist/nodemailer-NITB45SS.js +0 -54
- package/dist/nodemailer-transport-3VWVUBM5.cjs +0 -1
- package/dist/nodemailer-transport-7RHATUKL.js +0 -1
- package/dist/nodemailer-transport-CHO2WKIY.js +0 -1
- package/dist/nodemailer-transport-ED2IXNGW.cjs +0 -1
- package/dist/postgres-auth-adapter-QKBNXVPT.js +0 -1
- package/dist/postgres-auth-adapter-SK3N3OSS.js +0 -1
- package/dist/postgres-auth-adapter-WMLM4UUC.cjs +0 -1
- package/dist/postgres-auth-adapter-ZO6HK5AK.cjs +0 -1
- package/dist/postgres-js-7YBZKGXG.cjs +0 -1
- package/dist/postgres-js-JLFIWOBH.js +0 -1
- package/dist/redis-adapter-EGMUN65D.cjs +0 -1
- package/dist/redis-adapter-EVK2SMKH.cjs +0 -1
- package/dist/redis-adapter-LY2NBSAG.js +0 -1
- package/dist/redis-adapter-QPCTMF55.js +0 -1
- package/dist/schema-RT6WSUYC.cjs +0 -1
- package/dist/schema-YFMSJK2P.js +0 -2
- package/dist/signin-N3T2KF5Q.js +0 -3
- package/dist/signin-VFBLX7EL.cjs +0 -2
- package/dist/sqlite-adapter-52PL52VU.js +0 -1
- package/dist/sqlite-adapter-KPSISY6E.cjs +0 -1
- package/dist/sqlite-adapter-MNNZZXGX.cjs +0 -1
- package/dist/sqlite-adapter-PI6SIY7O.js +0 -1
- package/dist/src-6LAUXXDM.cjs +0 -1
- package/dist/src-QBADSZV4.js +0 -1
- package/dist/sso-oidc-54BIRYR6.cjs +0 -2
- package/dist/sso-oidc-UB7G4END.js +0 -3
- package/dist/sts-WAA6I22C.js +0 -3
- package/dist/sts-YLXXIB3X.cjs +0 -2
- package/dist/types-B5Qz1svz.d.cts +0 -822
- package/dist/types-B9oXBEKI.d.cts +0 -330
- package/dist/types-B9oXBEKI.d.ts +0 -330
- package/dist/types-BRDBNacn.d.ts +0 -839
- package/dist/types-Bii0bhUV.d.cts +0 -329
- package/dist/types-Bii0bhUV.d.ts +0 -329
- package/dist/types-Bt2_ycUO.d.ts +0 -811
- package/dist/types-C4wXHImf.d.ts +0 -822
- package/dist/types-C8yIAV6K.d.cts +0 -839
- package/dist/types-CORUQhY-.d.ts +0 -839
- package/dist/types-Cdssrcbz.d.cts +0 -839
- package/dist/types-CjGqxBd3.d.cts +0 -330
- package/dist/types-CjGqxBd3.d.ts +0 -330
- package/dist/types-DBGR-eQl.d.cts +0 -839
- package/dist/types-DCWgPFmi.d.cts +0 -822
- package/dist/types-DROqAsr0.d.cts +0 -330
- package/dist/types-DROqAsr0.d.ts +0 -330
- package/dist/types-DlGSbh7I.d.cts +0 -297
- package/dist/types-DlGSbh7I.d.ts +0 -297
- package/dist/types-DsF64Wrc.d.cts +0 -811
- package/dist/types-IeKFn7Ky.d.ts +0 -839
- package/dist/types-QglJ7PwT.d.cts +0 -839
- package/dist/types-ZrjEVWfi.d.ts +0 -811
- package/dist/types-dEy5JxvN.d.ts +0 -822
- package/dist/types-tVJc9YbX.d.cts +0 -811
- package/dist/types-zt5qIvje.d.ts +0 -839
package/dist/chunk-6NBZDW53.js
DELETED
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import {c,a as a$2,b as b$1,e,h}from'./chunk-JV4HJBXW.js';import {a as a$4}from'./chunk-3TAUNYEM.js';import {n,M,p,q,o,w,G,E,s,t,u,v}from'./chunk-HRAY65XH.js';import {ia,oa,fa,ma,$,ha,ca,pa,ra,J}from'./chunk-3NSZZCOJ.js';import {a,c as c$1,b as b$2,d}from'./chunk-SLMIYECU.js';import {a as a$1}from'./chunk-P6JITOFF.js';import {a as a$3}from'./chunk-JA44K75G.js';import {g}from'./chunk-Y2YAKDEQ.js';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
|
-
g();g();g();function b(f,t="postgres"){switch(f.type){case "text":case "email":case "password":case "color":case "icon":return t==="sqlite"?"text":"varchar";case "textarea":case "code":case "markdown":case "secret":return "text";case "number":return f.integer?"integer":"decimal";case "checkbox":return "boolean";case "date":return "timestamp";case "select":case "radio":return t==="sqlite"?"text":"varchar";case "richtext":case "json":case "array":case "group":case "blocks":case "row":case "collapsible":case "tabs":return "jsonb";case "relationship":return t==="sqlite"?"text":"varchar";case "upload":return "jsonb";default:return "jsonb"}}function ue(f,t="postgres"){let i=f.slug.replace(/-/g,"_"),e=[];e.push(`export const ${i} = pgTable('${i}', {`),e.push(" id: uuid('id').primaryKey().defaultRandom(),");for(let s of f.fields){if(s.name==="id"||s.type==="password")continue;let n=b(s,t),o=s.required,a=` ${s.name}: pg.${n}('${s.name}')`;s.unique&&(a+=".unique()"),o||(a+=".nullable()"),s.defaultValue!==void 0&&(typeof s.defaultValue=="string"?a+=`.default('${s.defaultValue}')`:typeof s.defaultValue=="boolean"?a+=`.default(${s.defaultValue})`:a+=`.default(sql\`${JSON.stringify(s.defaultValue)}\`)`),a+=",",e.push(a);}return f.timestamps&&(e.push(" createdAt: pg.timestamp('created_at').defaultNow(),"),e.push(" updatedAt: pg.timestamp('updated_at').defaultNow(),")),e.push(` status: ${t==="sqlite"?"sqlite":"pg"}.varchar('status').default('draft'),`),e.push(` hasDraft: ${t==="sqlite"?"sqlite":"pg"}.boolean('hasDraft').default(false),`),e.push("});"),e.join(`
|
|
3
|
-
`)}function j(f,t){return Array.isArray(f)?f.map(i=>{if(!i||typeof i!="object")return i;let e=i.data?{...i.data}:void 0;if(!e)return i;let s=t.find(n=>n.slug===i.type||n.slug===i.slug);if(!s||!Array.isArray(s.fields))return i;for(let n of s.fields){if(n.name&&(n.type==="upload"||n.type==="image")&&e[n.name]){let o=e[n.name];Array.isArray(o)?e[n.name]=o.map(a=>typeof a=="string"?{id:a}:a):typeof o=="string"&&(e[n.name]={id:o});}if(n.type==="blocks"&&n.name&&e[n.name]){let o=n.blocks||[];e[n.name]=j(e[n.name],o);}}return {...i,data:e}}):f}function C(f){if(typeof f!="string")return f;let t=f.replace(/-/g,"").toLowerCase();return t.length===32?`${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`:f}var O=class extends a{client;schema;_schemaEnsured=false;dialect;connectionString;versionsTableReady=false;rawClient;constructor(t){if(super(),this.schema=t.schema||{},t.connectionString){this.connectionString=t.connectionString;let i=t.connectionString.toLowerCase();i.startsWith("postgres://")||i.startsWith("postgresql://")?this.dialect="postgres":i.includes(".db")||i.includes("sqlite")||i.includes("file:")?this.dialect="sqlite":this.dialect=t.type||"postgres";}else this.rawClient=t.client,this.client=t.client,this.dialect=t.type||"sqlite";}prepareData(t,i){let e=super.prepareData(t,i);e.createdAt&&typeof e.createdAt=="string"&&(e.createdAt=new Date(e.createdAt)),e.updatedAt&&typeof e.updatedAt=="string"&&(e.updatedAt=new Date(e.updatedAt));for(let s of i.fields)if(s.type==="date"&&s.name){let n=e[s.name];n&&typeof n=="string"&&(e[s.name]=new Date(n));}for(let s of i.fields){let o=b(s,this.dialect)==="jsonb";if(s.type==="tabs"&&"tabs"in s&&s.name){let a=t[s.name];if(a&&typeof a=="object"){let r={};for(let[l,c]of Object.entries(a)){let u=s.tabs.flatMap(g=>g.fields).find(g=>g.name===l);(u?.type==="upload"||u?.type==="image"||u?.type==="list"||u?.type==="relationship-block")&&c?r[l]=Array.isArray(c)||typeof c=="object"?JSON.stringify(c):c:r[l]=c;}e[s.name]=this.dialect==="sqlite"||!o?JSON.stringify(r):r;}}else if(o&&s.name&&t[s.name]!==void 0&&t[s.name]!==null)e[s.name]=this.dialect==="sqlite"?JSON.stringify(t[s.name]):t[s.name];else if((s.type==="upload"||s.type==="image"||s.type==="list"||s.type==="relationship-block")&&s.name){let a=t[s.name];a!=null&&(e[s.name]=this.dialect==="sqlite"||!o?typeof a=="string"?a:JSON.stringify(a):a);}}for(let s of i.fields)if(s.name&&e[s.name]===""){let n=b(s,this.dialect);(n==="timestamp"||n==="jsonb"||n==="decimal"||n==="integer"||n==="numeric"||n==="boolean")&&(e[s.name]=null);}return e}async connect(){if(this.connectionString&&!this.client){if(this.dialect==="postgres"){let t,i;try{t=(await import('./src-QBADSZV4.js')).default,i=(await import('./postgres-js-JLFIWOBH.js')).drizzle;}catch{a$1(["postgres","drizzle-orm"]),t=(await import('./src-QBADSZV4.js')).default,i=(await import('./postgres-js-JLFIWOBH.js')).drizzle;}let e=t(this.connectionString,{onnotice:()=>{}});this.client=i(e,{schema:this.schema});}else if(this.dialect==="sqlite"){let t,i;try{t=(await import('better-sqlite3')).default,i=(await import('./better-sqlite3-B34RIU4C.js')).drizzle;}catch{a$1(["better-sqlite3","drizzle-orm"]),t=(await import('better-sqlite3')).default,i=(await import('./better-sqlite3-B34RIU4C.js')).drizzle;}let e=new t(this.connectionString.replace("file:",""));this.client=i(e,{schema:this.schema});}}if(this.rawClient&&typeof this.rawClient.prepare=="function"&&typeof this.client?.select!="function"){let{drizzle:t}=await import('./d1-HPB6B253.js');this.client=t(this.rawClient,{schema:this.schema});}this.connected=true;}async init(t,i=[]){if(await super.init(t,i),(this.connectionString&&!this.client||this.rawClient&&typeof this.client?.select!="function")&&await this.connect(),this.client&&!this._schemaEnsured){for(let s of t){let n=this.getTableName(s.slug);this.schema[n]||(this.schema[n]=this.createTableFromConfig(s));}await this.ensureCollectionTables(t);let e=i.map(s=>({slug:`_globals_${s.slug}`,fields:s.fields,label:s.label}));for(let s of e){let n=this.getTableName(s.slug);this.schema[n]||(this.schema[n]=this.createTableFromConfig(s,true)),this.collections.has(s.slug)||this.collections.set(s.slug,s);}await this.ensureCollectionTables(e),this._schemaEnsured=true;}}createTableFromConfig(t,i=false){let e$1=this.getTableName(t.slug),s={id:i?ia("id").primaryKey():oa("id").primaryKey().defaultRandom()};for(let n of t.fields){if(!n.name||n.name==="id"||n.type==="password")continue;let o=b(n,this.dialect),a=n.name.replace(/-/g,"_"),r=a.replace(/([A-Z])/g,"_$1").toLowerCase(),l;if(this.dialect==="sqlite")switch(o){case "varchar":case "text":l=c(r);break;case "integer":l=a$2(r);break;case "decimal":case "numeric":l=b$1(r);break;case "boolean":l=a$2(r,{mode:"boolean"});break;case "timestamp":l=c(r);break;case "jsonb":l=c(r);break;default:l=c(r);}else switch(o){case "varchar":l=pa(r,{length:255});break;case "integer":l=ca(r);break;case "decimal":l=ha(r);break;case "boolean":l=$(r);break;case "timestamp":l=ma(r);break;case "jsonb":l=fa(r);break;default:l=ia(r);}n.required||(l=l.default(null)),s[a]=l;}return s.createdAt||(s.createdAt=this.dialect==="sqlite"?c("created_at").default(new Date().toISOString()):ma("created_at").defaultNow()),s.updatedAt||(s.updatedAt=this.dialect==="sqlite"?c("updated_at").default(new Date().toISOString()):ma("updated_at").defaultNow()),e$1!=="users"&&e$1!=="audit_logs"&&(s.status||(s.status=this.dialect==="sqlite"?c("status").default("draft"):pa("status",{length:20}).default("draft")),s.hasDraft||(s.hasDraft=this.dialect==="sqlite"?a$2("hasDraft",{mode:"boolean"}).default(false):$("hasDraft").default(false))),this.dialect==="sqlite"?e(e$1,s):ra(e$1,s)}async ensureCollectionTables(t){let i=[];for(let e of t){let s=e.slug.startsWith("_globals_"),n=this.getTableName(e.slug),o=this.generateCreateColumns(e),a=e.fields.some(u=>u.name==="createdAt"),r=e.fields.some(u=>u.name==="updatedAt"),l=e.fields.some(u=>u.name==="status"),c=e.fields.some(u=>u.name==="hasDraft");if(this.dialect==="postgres"){let u=s?'"id" TEXT PRIMARY KEY':'"id" UUID PRIMARY KEY DEFAULT gen_random_uuid()';i.push(`
|
|
4
|
-
CREATE TABLE IF NOT EXISTS "${n}" (
|
|
5
|
-
${u},
|
|
6
|
-
${o}
|
|
7
|
-
${a?"":'"created_at" TIMESTAMP NOT NULL DEFAULT NOW(),'}
|
|
8
|
-
${r?"":'"updated_at" TIMESTAMP NOT NULL DEFAULT NOW(),'}
|
|
9
|
-
${l?"":`"status" VARCHAR(20) DEFAULT 'draft',`}
|
|
10
|
-
${c?"":'"hasDraft" BOOLEAN DEFAULT false'}
|
|
11
|
-
)
|
|
12
|
-
`);}else i.push(`
|
|
13
|
-
CREATE TABLE IF NOT EXISTS "${n}" (
|
|
14
|
-
"id" TEXT PRIMARY KEY,
|
|
15
|
-
${o}
|
|
16
|
-
${a?"":`"created_at" TEXT NOT NULL DEFAULT (datetime('now')),`}
|
|
17
|
-
${r?"":`"updated_at" TEXT NOT NULL DEFAULT (datetime('now')),`}
|
|
18
|
-
${l?"":`"status" TEXT DEFAULT 'draft',`}
|
|
19
|
-
${c?"":'"hasDraft" INTEGER DEFAULT 0'}
|
|
20
|
-
)
|
|
21
|
-
`);}if(i.length>0)if(this.dialect==="postgres")await this.executeRaw(J.raw(i.join(`;
|
|
22
|
-
`)));else for(let e of i)await this.executeRaw(J.raw(e));for(let e of t){let s=this.getTableName(e.slug);s==="users"||s==="audit_logs"||await this.syncTableColumns(e,s);}}getColumnSqlDefinition(t,i){let e=b(t,i),s=t.name.replace(/-/g,"_").replace(/([A-Z])/g,"_$1").toLowerCase(),n=this.columnSqlType(e,i);return `"${s}" ${n} DEFAULT NULL`}columnSqlType(t,i){if(i==="sqlite")switch(t){case "varchar":return "TEXT";case "text":return "TEXT";case "integer":return "INTEGER";case "decimal":case "numeric":return "NUMERIC";case "boolean":return "INTEGER";case "timestamp":return "TEXT";case "jsonb":return "TEXT";default:return "TEXT"}switch(t){case "varchar":return "VARCHAR(255)";case "text":return "TEXT";case "integer":return "INTEGER";case "decimal":case "numeric":return "DECIMAL";case "boolean":return "BOOLEAN";case "timestamp":return "TIMESTAMP";case "jsonb":return "JSONB";default:return "TEXT"}}getExpectedColumnDefs(t,i){let e={},s=t.slug.startsWith("_globals_"),n=t.fields.some(l=>l.name==="createdAt"),o=t.fields.some(l=>l.name==="updatedAt"),a=t.fields.some(l=>l.name==="status"),r=t.fields.some(l=>l.name==="hasDraft");this.dialect==="postgres"?(e.id=s?'"id" TEXT PRIMARY KEY':'"id" UUID PRIMARY KEY DEFAULT gen_random_uuid()',n||(e.created_at='"created_at" TIMESTAMP DEFAULT NULL'),o||(e.updated_at='"updated_at" TIMESTAMP DEFAULT NULL'),a||(e.status='"status" VARCHAR(20) DEFAULT NULL'),r||(e.hasDraft='"hasDraft" BOOLEAN DEFAULT NULL')):(e.id='"id" TEXT PRIMARY KEY',n||(e.created_at='"created_at" TEXT DEFAULT NULL'),o||(e.updated_at='"updated_at" TEXT DEFAULT NULL'),a||(e.status='"status" TEXT DEFAULT NULL'),r||(e.hasDraft='"hasDraft" INTEGER DEFAULT NULL'));for(let l of t.fields){if(!l.name||l.name==="id")continue;let c=this.getColumnSqlDefinition(l,this.dialect),u=l.name.replace(/-/g,"_").replace(/([A-Z])/g,"_$1").toLowerCase();e[u]=c;}return e}async syncTableColumns(t,i){let e;try{if(this.dialect==="postgres"){let o=await this.executeRaw(J`SELECT column_name, data_type, character_maximum_length FROM information_schema.columns WHERE table_name = ${i}`);e=new Map(o.map(a=>[a.column_name,{type:a.data_type,maxLen:a.character_maximum_length}]));}else {let o=await this.executeRaw(J`PRAGMA table_info("${J.raw(i)}")`);e=new Map(o.map(a=>[a.name,{type:a.type,maxLen:null}]));}}catch{return}let s=this.getExpectedColumnDefs(t,i),n=Object.keys(s).filter(o=>!e.has(o));if(n.length>0){let o=n.map(a=>`ALTER TABLE "${i}" ADD COLUMN ${s[a]}`);await this.executeRaw(J.raw(o.join(`;
|
|
23
|
-
`)));}if(this.dialect==="postgres")for(let o of t.fields){if(!o.name||o.name==="id")continue;let a=b(o,this.dialect),r=o.name.replace(/-/g,"_").replace(/([A-Z])/g,"_$1").toLowerCase(),l=e.get(r);!l||l.type!=="character varying"||(a==="text"?await this.executeRaw(J.raw(`ALTER TABLE "${i}" ALTER COLUMN "${r}" TYPE TEXT`)):a==="jsonb"&&(await this.executeRaw(J.raw(`ALTER TABLE "${i}" ALTER COLUMN "${r}" DROP DEFAULT`)),await this.executeRaw(J.raw(`ALTER TABLE "${i}" ALTER COLUMN "${r}" TYPE JSONB USING (CASE WHEN "${r}" IS NULL THEN NULL WHEN "${r}"::text ~ '^\\s*\\{' THEN "${r}"::jsonb ELSE jsonb_build_object('id', "${r}"::text) END)`))));}}generateCreateColumns(t){let i=[];for(let e of t.fields){if(!e.name||e.name==="id")continue;let s=b(e,this.dialect),n=e.name.replace(/-/g,"_").replace(/([A-Z])/g,"_$1").toLowerCase(),o=e.required?"NOT NULL":"DEFAULT NULL",a;if(this.dialect==="sqlite")switch(s){case "varchar":case "text":a=`TEXT ${o}`;break;case "integer":a=`INTEGER ${o}`;break;case "decimal":case "numeric":a=`NUMERIC ${o}`;break;case "boolean":a=`INTEGER ${o}`;break;case "timestamp":a=`TEXT ${o}`;break;case "jsonb":a=`TEXT ${o}`;break;default:a=`TEXT ${o}`;}else switch(s){case "varchar":a=`VARCHAR(255) ${o}`;break;case "integer":a=`INTEGER ${o}`;break;case "decimal":a=`DECIMAL ${o}`;break;case "boolean":a=`BOOLEAN ${o}`;break;case "timestamp":a=`TIMESTAMP ${o}`;break;case "jsonb":a=`JSONB ${o}`;break;default:a=`TEXT ${o}`;}i.push(`"${n}" ${a}`);}return i.join(`,
|
|
24
|
-
`)+(i.length>0?",":"")}async disconnect(){this.connected=false;}async find(t){let{collection:i,where:e={},sort:s,limit:n$1=10,page:o=1,tenantId:a,select:r,draft:l}=t,c=this.getCollection(i),u=this.getTable(i),m={...e};this.tenantContext&&c.tenantScoped&&(m=c$1({where:m},i,this.tenantContext,b$2).where||{});let g=this.buildWhereClause(m,c,u,a),y=c.fields.find(h=>h.name==="status"),p$1=y?.type==="select"&&Array.isArray(y.options)&&y.options.some(h=>h.value==="published");!l&&u.status&&p$1&&g.push(n(u.status,"published"));let E=this.parseSort(s),A=!l&&u.status&&p$1?{...m,status:"published"}:m,fe=await this.count({collection:i,where:A,tenantId:a}),pe=(o-1)*n$1,z=[];try{let h=u[E.field]||u.createdAt||u.id,$=E.direction==="asc"?h:M(h),D=this.client.select().from(u);g.length>0&&(D=D.where(p(...g))),z=await D.orderBy($).limit(n$1).offset(pe);}catch(h){console.error("[DrizzleAdapter] Query error:",h);}let R=z.map(h=>this.processResult(h,c));return this.tenantContext&&!this.tenantContext.isSuperAdmin&&(R=R.filter(h=>d(h,i,this.tenantContext,b$2))),l&&(R=await Promise.all(R.map(async h=>{let $=await this.executeRaw(J`
|
|
25
|
-
SELECT * FROM kyro_versions
|
|
26
|
-
WHERE collection_slug = ${i}
|
|
27
|
-
AND document_id = ${h.id}
|
|
28
|
-
ORDER BY created_at DESC
|
|
29
|
-
LIMIT 1
|
|
30
|
-
`);if($.length>0){let D=$[0],w=D.data;for(;typeof w=="string";)try{w=JSON.parse(w);}catch{break}return (!w||typeof w!="object"||Array.isArray(w))&&(w={}),{...h,...w,status:h.status,_hasUnpublishedChanges:D.status==="draft"}}return h}))),{docs:R,...this.calculatePagination(o,n$1,fe)}}async findByID(t){let{collection:i,id:e,tenantId:s,draft:n$1}=t,o=this.getCollection(i),a=this.getTable(i),r=this.dialect==="postgres"&&typeof e=="string"?C(e):e;if(this.tenantContext&&o.tenantScoped){let p={id:r,tenantId:this.tenantContext.tenantId};if(!d(p,i,this.tenantContext,b$2))return null}let l=[n(a.id,r)];s&&a.tenantId&&l.push(n(a.tenantId,s));let c=o.fields.find(p=>p.name==="status"),u=c?.type==="select"&&Array.isArray(c.options)&&c.options.some(p=>p.value==="published");!n$1&&a.status&&u&&l.push(n(a.status,"published"));let m=l.length>1?p(...l):l[0],g=await this.client.select().from(a).where(m);if(g.length===0)return null;let y=this.processResult(g[0],o);if(n$1){let p=await this.executeRaw(J`
|
|
31
|
-
SELECT * FROM kyro_versions
|
|
32
|
-
WHERE collection_slug = ${i}
|
|
33
|
-
AND document_id = ${y.id}
|
|
34
|
-
ORDER BY created_at DESC
|
|
35
|
-
LIMIT 1
|
|
36
|
-
`);if(p.length>0){let E=p[0],A=E.data;for(;typeof A=="string";)try{A=JSON.parse(A);}catch{break}(!A||typeof A!="object"||Array.isArray(A))&&(A={}),y={...y,...A,status:y.status,_hasUnpublishedChanges:E.status==="draft"};}}return y}async create(t){let{collection:i,data:e,tenantId:s}=t,n=this.getCollection(i),o=this.getTable(i),a=this.prepareData(e,n);s&&n.tenantScoped&&(a.tenantId=s);let r=await this.client.insert(o).values(a).returning();return this.processResult(r[0],n)}async update(t){let{collection:i,id:e,data:s,tenantId:n$1}=t,o=this.getCollection(i),a=this.getTable(i),r=this.prepareData(s,o),l=this.dialect==="postgres"&&typeof e=="string"?C(e):e,c=[n(a.id,l)];n$1&&a.tenantId&&c.push(n(a.tenantId,n$1));let u=await this.client.update(a).set(r).where(p(...c)).returning();if(u.length===0)throw new Error(`Document not found: ${i}/${e}`);return this.processResult(u[0],o)}async delete(t){let{collection:i,id:e,tenantId:s}=t,n$1=this.getCollection(i),o=this.getTable(i),a=this.dialect==="postgres"&&typeof e=="string"?C(e):e,r=[n(o.id,a)];s&&o.tenantId&&r.push(n(o.tenantId,s));let l=await this.client.delete(o).where(p(...r)).returning();if(l.length===0)throw new Error(`Document not found: ${i}/${e}`);return this.processResult(l[0],n$1)}async count(t){let{collection:i,where:e={},tenantId:s}=t,n=this.getCollection(i),o=this.getTable(i),a=this.buildWhereClause(e,n,o,s);try{let r=this.client.select({count:J`count(*)`}).from(o);a.length>0&&(r=r.where(p(...a)));let l=await r;return Number(l[0]?.count||0)}catch{return 0}}async findOne(t){let{collection:i,where:e={},tenantId:s,draft:n$1}=t;if(i.startsWith("_globals_")){let a=i.replace("_globals_",""),r=this.globals.get(a);if(!r)throw new Error(`Global "${a}" not found`);let l=this.getTable(i),c=this.client.select().from(l),u=r.fields.find(p=>p.name==="status"),m=u?.type==="select"&&Array.isArray(u.options)&&u.options.some(p=>p.value==="published");!n$1&&l.status&&m&&(c=c.where(n(l.status,"published")));let g=await c.limit(1);if(g.length===0)return null;let y=this.processResult(g[0],r);if(n$1){let p=await this.executeRaw(J`
|
|
37
|
-
SELECT * FROM kyro_versions
|
|
38
|
-
WHERE collection_slug = ${i}
|
|
39
|
-
AND document_id = ${a}
|
|
40
|
-
ORDER BY created_at DESC
|
|
41
|
-
LIMIT 1
|
|
42
|
-
`);if(p.length>0){let E=p[0],A=typeof E.data=="string"?JSON.parse(E.data):E.data;y={...y,...A,status:y.status,_hasUnpublishedChanges:E.status==="draft"};}}return y}return (await this.find({...t,limit:1})).docs[0]||null}async findVersions(t){await this.ensureVersionsTable();let{collection:i,documentId:e,limit:s=10,page:n=1,tenantId:o}=t,a=(n-1)*s,r=this.getCollection(i),l=await this.executeRaw(J`
|
|
43
|
-
SELECT count(*) as count
|
|
44
|
-
FROM kyro_versions
|
|
45
|
-
WHERE collection_slug = ${i}
|
|
46
|
-
AND document_id = ${e}
|
|
47
|
-
AND autosave = 0
|
|
48
|
-
${o&&r.tenantScoped?J`AND tenant_id = ${o}`:J``}
|
|
49
|
-
`),c=parseInt(l[0]?.count||"0");return {docs:(await this.executeRaw(J`
|
|
50
|
-
SELECT *
|
|
51
|
-
FROM kyro_versions
|
|
52
|
-
WHERE collection_slug = ${i}
|
|
53
|
-
AND document_id = ${e}
|
|
54
|
-
AND autosave = 0
|
|
55
|
-
${o&&r.tenantScoped?J`AND tenant_id = ${o}`:J``}
|
|
56
|
-
ORDER BY created_at DESC
|
|
57
|
-
LIMIT ${s}
|
|
58
|
-
OFFSET ${a}
|
|
59
|
-
`)).map(m=>({...m,data:typeof m.data=="string"?JSON.parse(m.data):m.data})),...this.calculatePagination(n,s,c)}}async findVersionByID(t){await this.ensureVersionsTable();let i=this.getCollection(t.collection),e=await this.executeRaw(J`
|
|
60
|
-
SELECT * FROM kyro_versions
|
|
61
|
-
WHERE id = ${t.versionId}
|
|
62
|
-
AND collection_slug = ${t.collection}
|
|
63
|
-
${t.tenantId&&i.tenantScoped?J`AND tenant_id = ${t.tenantId}`:J``}
|
|
64
|
-
LIMIT 1
|
|
65
|
-
`);if(e.length===0)return null;let s=e[0];return {...s,data:typeof s.data=="string"?JSON.parse(s.data):s.data}}async createVersion(t){await this.ensureVersionsTable();let i=this.getCollection(t.collection),e=new Date().toISOString();if(t.autosave){let o=await this.executeRaw(J`
|
|
66
|
-
SELECT * FROM kyro_versions
|
|
67
|
-
WHERE collection_slug = ${t.collection}
|
|
68
|
-
AND document_id = ${t.documentId}
|
|
69
|
-
AND autosave = 1
|
|
70
|
-
${t.tenantId&&i.tenantScoped?J`AND tenant_id = ${t.tenantId}`:J``}
|
|
71
|
-
LIMIT 1
|
|
72
|
-
`);if(o.length>0)return await this.executeRaw(J`
|
|
73
|
-
UPDATE kyro_versions
|
|
74
|
-
SET data = ${JSON.stringify(t.data)},
|
|
75
|
-
status = ${t.status},
|
|
76
|
-
updated_at = ${e}
|
|
77
|
-
WHERE id = ${o[0].id}
|
|
78
|
-
`),this.findVersionByID({collection:t.collection,versionId:o[0].id,tenantId:t.tenantId})}let s=Math.random().toString(36).substring(2,15),n=typeof t.data=="string"?t.data:JSON.stringify(t.data);if(await this.executeRaw(J`
|
|
79
|
-
INSERT INTO kyro_versions (
|
|
80
|
-
id, collection_slug, document_id, tenant_id, data, status, autosave, created_by, change_description, created_at, updated_at
|
|
81
|
-
) VALUES (
|
|
82
|
-
${s}, ${t.collection}, ${t.documentId}, ${t.tenantId&&i.tenantScoped?t.tenantId:null},
|
|
83
|
-
${n}, ${t.status}, ${t.autosave?1:0}, ${t.createdBy||null},
|
|
84
|
-
${t.changeDescription||null}, ${e}, ${e}
|
|
85
|
-
)
|
|
86
|
-
`),!t.autosave){let o=this.getCollection(t.collection);o.versions?.maxPerDoc&&await this.deleteVersions({collection:t.collection,documentId:t.documentId,keepLatest:o.versions.maxPerDoc,tenantId:t.tenantId});}return this.findVersionByID({collection:t.collection,versionId:s,tenantId:t.tenantId})}async updateLatestVersion(t){return this.createVersion({...t,autosave:true})}async deleteVersions(t){await this.ensureVersionsTable();let i=this.getCollection(t.collection);if(t.keepLatest){let s=(await this.executeRaw(J`
|
|
87
|
-
SELECT id FROM kyro_versions
|
|
88
|
-
WHERE collection_slug = ${t.collection}
|
|
89
|
-
AND document_id = ${t.documentId}
|
|
90
|
-
AND autosave = 0
|
|
91
|
-
${t.tenantId&&i.tenantScoped?J`AND tenant_id = ${t.tenantId}`:J``}
|
|
92
|
-
ORDER BY created_at DESC
|
|
93
|
-
LIMIT ${t.keepLatest}
|
|
94
|
-
`)).map(n=>n.id);s.length>0&&await this.executeRaw(J`
|
|
95
|
-
DELETE FROM kyro_versions
|
|
96
|
-
WHERE collection_slug = ${t.collection}
|
|
97
|
-
AND document_id = ${t.documentId}
|
|
98
|
-
AND autosave = 0
|
|
99
|
-
AND id NOT IN (${J.join(s.map(n=>J`${n}`),J`, `)})
|
|
100
|
-
`);}else await this.executeRaw(J`
|
|
101
|
-
DELETE FROM kyro_versions
|
|
102
|
-
WHERE collection_slug = ${t.collection}
|
|
103
|
-
AND document_id = ${t.documentId}
|
|
104
|
-
${t.tenantId&&i.tenantScoped?J`AND tenant_id = ${t.tenantId}`:J``}
|
|
105
|
-
`);}getTable(t){let i=this.getTableName(t),e=this.schema[i];if(!e)throw new Error(`Table "${i}" not found in schema`);return e}buildWhereClause(t$1,i,e,s$1){let n$1=[];s$1&&i.tenantScoped&&e.tenantId&&n$1.push(n(e.tenantId,s$1));for(let[o$1,a]of Object.entries(t$1)){let r=o$1,l=r.toUpperCase();if(r==="id"&&this.dialect==="postgres"&&(typeof a=="string"?a=C(a):a&&typeof a=="object"&&(a.equals!==void 0&&typeof a.equals=="string"&&(a={...a,equals:C(a.equals)}),a.in&&Array.isArray(a.in)&&(a={...a,in:a.in.map(c=>typeof c=="string"?C(c):c)}))),l==="AND"&&Array.isArray(a)){let c=a.map(u=>this.buildWhereClause(u,i,e)).flat().filter(Boolean);c.length>0&&n$1.push(p(...c));}else if(l==="OR"&&Array.isArray(a)){let c=a.map(u=>this.buildWhereClause(u,i,e)).flat().filter(Boolean);c.length>0&&n$1.push(q(...c));}else if(typeof a=="object"&&a!==null&&!Array.isArray(a)){let c=e[r]||e[r.replace(/-/g,"_")]||e[r.replace(/([A-Z])/g,"_$1").toLowerCase()]||(r==="created_at"?e.createdAt:void 0)||(r==="createdAt"?e.created_at:void 0)||(r==="updated_at"?e.updatedAt:void 0)||(r==="updatedAt"?e.updated_at:void 0);if(!c)continue;a.equals!==void 0&&n$1.push(n(c,a.equals)),a.not_equals!==void 0&&n$1.push(o(c,a.not_equals)),a.in&&Array.isArray(a.in)&&(a.in.length===0?n$1.push(J`1 = 0`):n$1.push(w(c,a.in))),a.like!==void 0&&(this.dialect==="postgres"?n$1.push(G(c,a.like)):n$1.push(E(c,a.like))),a.contains!==void 0&&(this.dialect==="postgres"?n$1.push(G(c,`%${a.contains}%`)):n$1.push(E(c,`%${a.contains}%`))),a.greater_than!==void 0&&n$1.push(s(c,a.greater_than)),a.greater_than_equal!==void 0&&n$1.push(t(c,a.greater_than_equal)),a.less_than!==void 0&&n$1.push(u(c,a.less_than)),a.less_than_equal!==void 0&&n$1.push(v(c,a.less_than_equal));}else {let c=e[r]||e[r.replace(/-/g,"_")]||e[r.replace(/([A-Z])/g,"_$1").toLowerCase()];c&&n$1.push(n(c,a));}}return n$1}processResult(t,i){if(!t)return null;let e={...t};for(let s of Object.keys(e))/^\d+$/.test(s)&&delete e[s];t.id&&(e.id=String(t.id));for(let s of i.fields){if(!s.name)continue;let n=s.name.replace(/-/g,"_").replace(/([A-Z])/g,"_$1").toLowerCase();n!==s.name&&e[n]!==void 0&&e[s.name]===void 0&&(e[s.name]=e[n],delete e[n]);}for(let s of i.fields){if(["json","richtext","array","group","blocks","upload","image","list","relationship-block"].includes(s.type)){let n=s;if(e[n.name]&&typeof e[n.name]=="string")try{let o=JSON.parse(e[n.name]);e[n.name]=o;}catch{}if(s.type==="blocks"&&e[n.name]&&Array.isArray(e[n.name])){let o=n.blocks||[];e[n.name]=j(e[n.name],o);}}if(s.type==="tabs"&&"tabs"in s&&s.name){if(typeof e[s.name]=="object"&&e[s.name]!==null&&!Array.isArray(e[s.name])){for(let o of s.tabs)for(let a of o.fields)if((a.type==="upload"||a.type==="image")&&a.name){let r=e[s.name][a.name];if(typeof r=="string")try{let l=JSON.parse(r);e[s.name][a.name]=Array.isArray(l)?l.map(c=>c&&typeof c=="object"&&typeof c.id=="string"?c.id:String(c||"")):typeof l.id=="string"?l.id:String(l.id||"");}catch{}else r&&typeof r=="object"&&(e[s.name][a.name]=Array.isArray(r)?r.map(l=>l&&typeof l=="object"&&typeof l.id=="string"?l.id:String(l||"")):typeof r.id=="string"?r.id:String(r.id||""));}continue}if(typeof e[s.name]=="string")try{let o=JSON.parse(e[s.name]);if(typeof o=="object"&&o!==null){e[s.name]=o;continue}}catch{}let n={};for(let o of s.tabs)for(let a of o.fields)if(a.name&&e[a.name]!==void 0){let r=e[a.name];if(["json","richtext","array","group","blocks","upload","image","list","relationship-block"].includes(a.type)){if(r&&typeof r=="string")try{r=JSON.parse(r);}catch{}(a.type==="upload"||a.type==="image")&&r&&typeof r=="object"&&(r=Array.isArray(r)?r.map(l=>l&&typeof l=="object"&&typeof l.id=="string"?l.id:String(l||"")):typeof r.id=="string"?r.id:String(r.id||""));}n[a.name]=r,delete e[a.name];}e[s.name]=n;}}return e.createdAt&&(e.createdAt=new Date(e.createdAt).toISOString()),e.updatedAt&&(e.updatedAt=new Date(e.updatedAt).toISOString()),a$3(e)}async ensureVersionsTable(){if(this.versionsTableReady)return;let t;this.dialect==="sqlite"?t=`
|
|
106
|
-
CREATE TABLE IF NOT EXISTS kyro_versions (
|
|
107
|
-
id text PRIMARY KEY,
|
|
108
|
-
collection_slug text NOT NULL,
|
|
109
|
-
document_id text NOT NULL,
|
|
110
|
-
tenant_id text,
|
|
111
|
-
data text NOT NULL,
|
|
112
|
-
status text NOT NULL DEFAULT 'draft',
|
|
113
|
-
autosave integer NOT NULL DEFAULT 0,
|
|
114
|
-
created_by text,
|
|
115
|
-
change_description text,
|
|
116
|
-
created_at text DEFAULT (datetime('now')),
|
|
117
|
-
updated_at text DEFAULT (datetime('now'))
|
|
118
|
-
)
|
|
119
|
-
`:t=`
|
|
120
|
-
CREATE TABLE IF NOT EXISTS kyro_versions (
|
|
121
|
-
id text PRIMARY KEY,
|
|
122
|
-
collection_slug text NOT NULL,
|
|
123
|
-
document_id text NOT NULL,
|
|
124
|
-
tenant_id text,
|
|
125
|
-
data text NOT NULL,
|
|
126
|
-
status text NOT NULL,
|
|
127
|
-
autosave integer NOT NULL DEFAULT 0,
|
|
128
|
-
created_by text,
|
|
129
|
-
change_description text,
|
|
130
|
-
created_at text NOT NULL,
|
|
131
|
-
updated_at text NOT NULL
|
|
132
|
-
)
|
|
133
|
-
`,await this.executeRaw(J.raw(t));try{this.dialect==="postgres"?await this.executeRaw(J.raw("ALTER TABLE kyro_versions ADD COLUMN IF NOT EXISTS autosave integer NOT NULL DEFAULT 0")):await this.executeRaw(J.raw("ALTER TABLE kyro_versions ADD COLUMN autosave integer NOT NULL DEFAULT 0"));}catch{}this.versionsTableReady=true;}async execute(t){return this.executeRaw(t)}async executeRaw(t){let i="",e=[];if(typeof t=="string")i=t;else if(t&&(t.queryChunks||t.decoder))if(this.dialect==="postgres"){let n=new a$4().sqlToQuery(t);i=n.sql,e=n.params;}else {let n=new h().sqlToQuery(t);i=n.sql,e=n.params;}else if(t&&typeof t.toSQL=="function"){let n=t.toSQL();i=n.sql,e=n.params||[];}else i=String(t);let s=this.rawClient||this.client;if(s?.prepare&&typeof s.prepare=="function"){let n=s.prepare(i);return (e.length>0?await n.bind(...e).all():await n.all()).results||[]}if(typeof this.client?.execute=="function"){let n=await this.client.execute(t);return Array.isArray(n)?n:Array.isArray(n?.rows)?n.rows:Array.isArray(n?.[0])?n[0]:[]}return []}};function he(f){return new O(f)}export{b as a,ue as b,O as c,he as d};
|
package/dist/chunk-6TPICJ2L.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import {g}from'./chunk-Y2YAKDEQ.js';import Z from'crypto';if (typeof window === "undefined") { const { createRequire } = await import(/* @vite-ignore */ 'module'); createRequire(import.meta.url); }
|
|
2
|
-
g();g();var k=null,I=null;function Ee(e){k=e;}async function Pe(){if(k)try{let e=await k.findOne({collection:"_globals_system",where:{}});if(e){I={appSecret:e.appSecret||null,encryptionKey:e.encryptionKey||null,sessionConfig:e.sessionMaxAge||e.maxSessionsPerUser?{maxAge:(e.sessionMaxAge||7)*24*60*60*1e3,maxSessionsPerUser:e.maxSessionsPerUser||3}:null};return}}catch{}I={appSecret:process.env.APP_SECRET||"development-secret-key",encryptionKey:null,sessionConfig:null};}function ee(){return I?.appSecret?I.appSecret:process.env.APP_SECRET||"development-secret-key"}function Ae(){if(I?.encryptionKey)return I.encryptionKey;let e=ee();return Z.createHash("sha256").update(e).digest("hex")}function F(){return I?.sessionConfig?I.sessionConfig:{maxAge:10080*60*1e3,maxSessionsPerUser:3}}g();g();var te=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,re=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,se=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function ne(e,t){if(e==="__proto__"||e==="constructor"&&t&&typeof t=="object"&&"prototype"in t){ie(e);return}return t}function ie(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`);}function M(e,t={}){if(typeof e!="string")return e;if(e[0]==='"'&&e[e.length-1]==='"'&&e.indexOf("\\")===-1)return e.slice(1,-1);let n=e.trim();if(n.length<=9)switch(n.toLowerCase()){case "true":return true;case "false":return false;case "undefined":return;case "null":return null;case "nan":return Number.NaN;case "infinity":return Number.POSITIVE_INFINITY;case "-infinity":return Number.NEGATIVE_INFINITY}if(!se.test(e)){if(t.strict)throw new SyntaxError("[destr] Invalid JSON");return e}try{if(te.test(e)||re.test(e)){if(t.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(e,ne)}return JSON.parse(e)}catch(o){if(t.strict)throw o;return e}}g();function oe(e){return !e||typeof e.then!="function"?Promise.resolve(e):e}function p(e,...t){try{return oe(e(...t))}catch(n){return Promise.reject(n)}}function ae(e){let t=typeof e;return e===null||t!=="object"&&t!=="function"}function ue(e){let t=Object.getPrototypeOf(e);return !t||t.isPrototypeOf(Object)}function _(e){if(ae(e))return String(e);if(ue(e)||Array.isArray(e))return JSON.stringify(e);if(typeof e.toJSON=="function")return _(e.toJSON());throw new Error("[unstorage] Cannot stringify value!")}var B="base64:";function L(e){return typeof e=="string"?e:B+le(e)}function U(e){return typeof e!="string"||!e.startsWith(B)?e:ce(e.slice(B.length))}function ce(e){return globalThis.Buffer?Buffer.from(e,"base64"):Uint8Array.from(globalThis.atob(e),t=>t.codePointAt(0))}function le(e){return globalThis.Buffer?Buffer.from(e).toString("base64"):globalThis.btoa(String.fromCodePoint(...e))}function v(e){return e&&e.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function j(...e){return v(e.join(":"))}function D(e){return e=v(e),e?e+":":""}function W(e,t){if(t===void 0)return true;let n=0,o=e.indexOf(":");for(;o>-1;)n++,o=e.indexOf(":",o+1);return n<=t}function H(e,t){return t?e.startsWith(t)&&e[e.length-1]!=="$":e[e.length-1]!=="$"}var fe="memory",de=()=>{let e=new Map;return {name:fe,getInstance:()=>e,hasItem(t){return e.has(t)},getItem(t){return e.get(t)??null},getItemRaw(t){return e.get(t)??null},setItem(t,n){e.set(t,n);},setItemRaw(t,n){e.set(t,n);},removeItem(t){e.delete(t);},getKeys(){return [...e.keys()]},clear(){e.clear();},dispose(){e.clear();}}};function O(e={}){let t={mounts:{"":e.driver||de()},mountpoints:[""],watching:false,watchListeners:[],unwatch:{}},n=r=>{for(let s of t.mountpoints)if(r.startsWith(s))return {base:s,relativeKey:r.slice(s.length),driver:t.mounts[s]};return {base:"",relativeKey:r,driver:t.mounts[""]}},o=(r,s)=>t.mountpoints.filter(i=>i.startsWith(r)||s&&r.startsWith(i)).map(i=>({relativeBase:r.length>i.length?r.slice(i.length):void 0,mountpoint:i,driver:t.mounts[i]})),c=(r,s)=>{if(t.watching){s=v(s);for(let i of t.watchListeners)i(r,s);}},u=async()=>{if(!t.watching){t.watching=true;for(let r in t.mounts)t.unwatch[r]=await V(t.mounts[r],c,r);}},d=async()=>{if(t.watching){for(let r in t.unwatch)await t.unwatch[r]();t.unwatch={},t.watching=false;}},g=(r,s,i)=>{let a=new Map,l=f=>{let y=a.get(f.base);return y||(y={driver:f.driver,base:f.base,items:[]},a.set(f.base,y)),y};for(let f of r){let y=typeof f=="string",w=v(y?f:f.key),N=y?void 0:f.value,A=y||!f.options?s:{...s,...f.options},b=n(w);l(b).items.push({key:w,value:N,relativeKey:b.relativeKey,options:A});}return Promise.all([...a.values()].map(f=>i(f))).then(f=>f.flat())},m={hasItem(r,s={}){r=v(r);let{relativeKey:i,driver:a}=n(r);return p(a.hasItem,i,s)},getItem(r,s={}){r=v(r);let{relativeKey:i,driver:a}=n(r);return p(a.getItem,i,s).then(l=>M(l))},getItems(r,s={}){return g(r,s,i=>i.driver.getItems?p(i.driver.getItems,i.items.map(a=>({key:a.relativeKey,options:a.options})),s).then(a=>a.map(l=>({key:j(i.base,l.key),value:M(l.value)}))):Promise.all(i.items.map(a=>p(i.driver.getItem,a.relativeKey,a.options).then(l=>({key:a.key,value:M(l)})))))},getItemRaw(r,s={}){r=v(r);let{relativeKey:i,driver:a}=n(r);return a.getItemRaw?p(a.getItemRaw,i,s):p(a.getItem,i,s).then(l=>U(l))},async setItem(r,s,i={}){if(s===void 0)return m.removeItem(r);r=v(r);let{relativeKey:a,driver:l}=n(r);l.setItem&&(await p(l.setItem,a,_(s),i),l.watch||c("update",r));},async setItems(r,s){await g(r,s,async i=>{if(i.driver.setItems)return p(i.driver.setItems,i.items.map(a=>({key:a.relativeKey,value:_(a.value),options:a.options})),s);i.driver.setItem&&await Promise.all(i.items.map(a=>p(i.driver.setItem,a.relativeKey,_(a.value),a.options)));});},async setItemRaw(r,s,i={}){if(s===void 0)return m.removeItem(r,i);r=v(r);let{relativeKey:a,driver:l}=n(r);if(l.setItemRaw)await p(l.setItemRaw,a,s,i);else if(l.setItem)await p(l.setItem,a,L(s),i);else return;l.watch||c("update",r);},async removeItem(r,s={}){typeof s=="boolean"&&(s={removeMeta:s}),r=v(r);let{relativeKey:i,driver:a}=n(r);a.removeItem&&(await p(a.removeItem,i,s),(s.removeMeta||s.removeMata)&&await p(a.removeItem,i+"$",s),a.watch||c("remove",r));},async getMeta(r,s={}){typeof s=="boolean"&&(s={nativeOnly:s}),r=v(r);let{relativeKey:i,driver:a}=n(r),l=Object.create(null);if(a.getMeta&&Object.assign(l,await p(a.getMeta,i,s)),!s.nativeOnly){let f=await p(a.getItem,i+"$",s).then(y=>M(y));f&&typeof f=="object"&&(typeof f.atime=="string"&&(f.atime=new Date(f.atime)),typeof f.mtime=="string"&&(f.mtime=new Date(f.mtime)),Object.assign(l,f));}return l},setMeta(r,s,i={}){return this.setItem(r+"$",s,i)},removeMeta(r,s={}){return this.removeItem(r+"$",s)},async getKeys(r,s={}){r=D(r);let i=o(r,true),a=[],l=[],f=true;for(let w of i){w.driver.flags?.maxDepth||(f=false);let N=await p(w.driver.getKeys,w.relativeBase,s);for(let A of N){let b=w.mountpoint+v(A);a.some(Q=>b.startsWith(Q))||l.push(b);}a=[w.mountpoint,...a.filter(A=>!A.startsWith(w.mountpoint))];}let y=s.maxDepth!==void 0&&!f;return l.filter(w=>(!y||W(w,s.maxDepth))&&H(w,r))},async clear(r,s={}){r=D(r),await Promise.all(o(r,false).map(async i=>{if(i.driver.clear)return p(i.driver.clear,i.relativeBase,s);if(i.driver.removeItem){let a=await i.driver.getKeys(i.relativeBase||"",s);return Promise.all(a.map(l=>i.driver.removeItem(l,s)))}}));},async dispose(){await Promise.all(Object.values(t.mounts).map(r=>J(r)));},async watch(r){return await u(),t.watchListeners.push(r),async()=>{t.watchListeners=t.watchListeners.filter(s=>s!==r),t.watchListeners.length===0&&await d();}},async unwatch(){t.watchListeners=[],await d();},mount(r,s){if(r=D(r),r&&t.mounts[r])throw new Error(`already mounted at ${r}`);return r&&(t.mountpoints.push(r),t.mountpoints.sort((i,a)=>a.length-i.length)),t.mounts[r]=s,t.watching&&Promise.resolve(V(s,c,r)).then(i=>{t.unwatch[r]=i;}).catch(console.error),m},async unmount(r,s=true){r=D(r),!(!r||!t.mounts[r])&&(t.watching&&r in t.unwatch&&(t.unwatch[r]?.(),delete t.unwatch[r]),s&&await J(t.mounts[r]),t.mountpoints=t.mountpoints.filter(i=>i!==r),delete t.mounts[r]);},getMount(r=""){r=v(r)+":";let s=n(r);return {driver:s.driver,base:s.base}},getMounts(r="",s={}){return r=v(r),o(r,s.parents).map(a=>({driver:a.driver,base:a.mountpoint}))},keys:(r,s={})=>m.getKeys(r,s),get:(r,s={})=>m.getItem(r,s),set:(r,s,i={})=>m.setItem(r,s,i),has:(r,s={})=>m.hasItem(r,s),del:(r,s={})=>m.removeItem(r,s),remove:(r,s={})=>m.removeItem(r,s)};return m}function V(e,t,n){return e.watch?e.watch((o,c)=>t(o,n+c)):()=>{}}async function J(e){typeof e.dispose=="function"&&await p(e.dispose);}g();var ge="memory",G=()=>{let e=new Map;return {name:ge,getInstance:()=>e,hasItem(t){return e.has(t)},getItem(t){return e.get(t)??null},getItemRaw(t){return e.get(t)??null},setItem(t,n){e.set(t,n);},setItemRaw(t,n){e.set(t,n);},removeItem(t){e.delete(t);},getKeys(){return [...e.keys()]},clear(){e.clear();},dispose(){e.clear();}}};var X=F(),x={absoluteMaxAge:X.maxAge,maxSessionsPerUser:X.maxSessionsPerUser,refreshThreshold:300*1e3,activityDebounce:30*1e3,pollInterval:30*1e3},$="kyro-session",S=null;function C(){return globalThis.DB}function pe(){let e=null,t=()=>(e||(e=(async()=>{let u=C();u?.prepare&&await u.prepare(`CREATE TABLE IF NOT EXISTS kyro_session_store (
|
|
3
|
-
key TEXT PRIMARY KEY,
|
|
4
|
-
value TEXT,
|
|
5
|
-
expires_at INTEGER
|
|
6
|
-
)`).run();})()),e),n=()=>Date.now(),o=async(u,d=[])=>{let g=C();if(!g?.prepare)return null;let m=g.prepare(u);return d.length>0?m.bind(...d):m},c=async(u,d=[])=>{await t();let g=await o(u,d);g&&await g.run();};return {name:"kyro-d1",options:{},getInstance:()=>null,async hasItem(u){await t();let d=await o("SELECT expires_at FROM kyro_session_store WHERE key = ?",[u]);if(!d)return false;let g=await d.first();return g?!(g.expires_at&&g.expires_at<n()):false},async getItem(u){await t();let d=await o("SELECT value, expires_at FROM kyro_session_store WHERE key = ?",[u]);if(!d)return null;let g=await d.first();return g?g.expires_at&&g.expires_at<n()?(await o("DELETE FROM kyro_session_store WHERE key = ?",[u]),null):g.value:null},async setItem(u,d,g={}){let m=g?.ttl?Number(g.ttl):null,r=m?n()+m*1e3:null,s=typeof d=="string"?d:JSON.stringify(d);await c(`INSERT INTO kyro_session_store (key, value, expires_at) VALUES (?, ?, ?)
|
|
7
|
-
ON CONFLICT(key) DO UPDATE SET value = excluded.value, expires_at = excluded.expires_at`,[u,s,r]);},async removeItem(u){await c("DELETE FROM kyro_session_store WHERE key = ?",[u]);},async getKeys(u=""){await t();let d=await o("SELECT key FROM kyro_session_store WHERE key LIKE ?",[u+"%"]);return d?((await d.all()).results||[]).map(m=>m.key):[]},async clear(){await c("DELETE FROM kyro_session_store");},async dispose(){},async getMeta(){return {}},async setMeta(){},async removeMeta(){}}}async function E(){if(S)return S;if(!(typeof window>"u"&&(typeof process<"u"&&(process.env?.CLOUDFLARE||process.env?.CF_PAGES)||C())))try{let{default:t}=await import('./fs-KWBRQ6T6.js');return S=O({driver:t({base:".astro/sessions"})}),S}catch{}return C()?.prepare?(S=O({driver:pe()}),S):(S=O({driver:G()}),S)}function ve(){return Z.randomUUID()}function Y(e){let t="Unknown",n="Unknown",o="Unknown";return e.includes("Firefox")?t="Firefox":e.includes("Edg/")?t="Edge":e.includes("Chrome")?t="Chrome":e.includes("Safari")&&!e.includes("Chrome")&&(t="Safari"),e.includes("iPhone")?(n="iPhone",o="iOS"):e.includes("iPad")?(n="iPad",o="iOS"):e.includes("Mac")?(n="MacBook",o="macOS"):e.includes("Windows")?(n="Windows PC",o="Windows"):e.includes("Linux")?(n="Linux PC",o="Linux"):e.includes("Android")&&(n="Android Phone",o="Android"),{browser:t,device:n,platform:o}}function ye(e){if(!e?.userAgent)return "Session";let{browser:t,device:n}=Y(e.userAgent);return `${n} - ${t}`}function we(e){let t=e.headers.get("Cookie");return t&&Object.fromEntries(t.split("; ").map(o=>o.split("=")))[$]||null}function q(e){let t=e.headers.get("x-forwarded-for");return t?t.split(",")[0].trim():e.headers.get("x-real-ip")||"unknown"}function Ue(e,t){let o=process.env.NODE_ENV==="production"?"Secure; ":"",c=new Headers(e.headers);return c.append("Set-Cookie",`${$}=${t}; HttpOnly; Path=/; Max-Age=${x.absoluteMaxAge/1e3}; SameSite=Strict; ${o}`),new Response(e.body,{status:e.status,statusText:e.statusText,headers:c})}function je(e){let n=process.env.NODE_ENV==="production"?"Secure; ":"",o=new Headers(e.headers);return o.append("Set-Cookie",`${$}=; HttpOnly; Path=/; Max-Age=0; Expires=Thu, 01 Jan 1970 00:00:00 GMT; SameSite=Strict; ${n}`),new Response(e.body,{status:e.status,statusText:e.statusText,headers:o})}async function T(e){return await(await E()).getItem(`user:${e}`)||[]}async function z(e,t){let n=await E();t.length>0?await n.setItem(`user:${e}`,t):await n.removeItem(`user:${e}`);}async function We(e,t){let n=await E(),o=await T(e.id);for(;o.length>=x.maxSessionsPerUser;){let s=o.shift();s&&await n.removeItem(`session:${s}`);}let c=ve(),u=Date.now(),d=t?.headers.get("user-agent"),g=t?q(t):"unknown",m=d?{userAgent:d,ip:g,...Y(d)}:{ip:g},r={id:c,userId:e.id,email:e.email,role:e.role,tenantId:e.tenantId,permissions:e.permissions,createdAt:u,expiresAt:u+x.absoluteMaxAge,lastActivityAt:u,deviceInfo:m,sessionName:ye(m)};return await n.setItem(`session:${c}`,r,{ttl:Math.floor(x.absoluteMaxAge/1e3)}),o.push(c),await z(e.id,o),c}async function P(e){return await(await E()).getItem(`session:${e}`)||null}async function he(e){let t=await P(e);return t?t.expiresAt<Date.now()?(await Se(e),{valid:false,reason:"Session expired"}):{valid:true}:{valid:false,reason:"Session not found"}}async function Ie(e,t){let n=await E(),o=await P(e);if(!o)return null;let c=Date.now(),u=o.expiresAt-c,d=o.deviceInfo;if(t){let r=q(t);r!==o.deviceInfo?.ip&&(d={...o.deviceInfo,ip:r});}let g={...o,lastActivityAt:c,expiresAt:u<x.refreshThreshold?c+x.absoluteMaxAge:o.expiresAt,deviceInfo:d},m=u<x.refreshThreshold?x.absoluteMaxAge:void 0;return await n.setItem(`session:${e}`,g,m?{ttl:Math.floor(m/1e3)}:void 0),g}async function Se(e){let t=await E(),n=await P(e);if(n){let c=(await T(n.userId)).filter(u=>u!==e);await z(n.userId,c);}await t.removeItem(`session:${e}`),await t.removeItem(`activity:${e}`);}async function He(e){let t=await T(e),n=await E();for(let o of t)await n.removeItem(`session:${o}`),await n.removeItem(`activity:${o}`);await z(e,[]);}async function Ve(e,t){let n=await T(e),o=[];for(let c of n){let u=await P(c);u&&o.push({id:u.id,sessionName:u.sessionName||"Session",deviceInfo:u.deviceInfo,createdAt:u.createdAt,lastActivityAt:u.lastActivityAt,currentSession:u.id===t});}return o.sort((c,u)=>u.lastActivityAt-c.lastActivityAt),o}async function Je(e,t){let n=await P(e);return n?(await(await E()).setItem(`session:${e}`,{...n,sessionName:t}),true):false}async function Ge(e){let t=we(e);if(!t||!(await he(t)).valid)return null;let o=await P(t);return o?(await Ie(t,e),o):null}export{Ee as a,Pe as b,ee as c,Ae as d,F as e,O as f,x as g,we as h,q as i,Ue as j,je as k,We as l,P as m,he as n,Ie as o,Se as p,He as q,Ve as r,Je as s,Ge as t};
|
package/dist/chunk-73D2PNHD.cjs
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
'use strict';var chunkBUNLC3II_cjs=require('./chunk-BUNLC3II.cjs');var C=chunkBUNLC3II_cjs.c((br,He)=>{chunkBUNLC3II_cjs.h();var Ve=["nodebuffer","arraybuffer","fragments"],ze=typeof Blob<"u";ze&&Ve.push("blob");He.exports={BINARY_TYPES:Ve,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:ze,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}};});var Q=chunkBUNLC3II_cjs.c((Or,ne)=>{chunkBUNLC3II_cjs.h();var{EMPTY_BUFFER:Xt}=C(),Ee=Buffer[Symbol.species];function Zt(t,e){if(t.length===0)return Xt;if(t.length===1)return t[0];let s=Buffer.allocUnsafe(e),r=0;for(let i=0;i<t.length;i++){let n=t[i];s.set(n,r),r+=n.length;}return r<e?new Ee(s.buffer,s.byteOffset,r):s}function Ye(t,e,s,r,i){for(let n=0;n<i;n++)s[r+n]=t[n]^e[n&3];}function Ke(t,e){for(let s=0;s<t.length;s++)t[s]^=e[s&3];}function Qt(t){return t.length===t.buffer.byteLength?t.buffer:t.buffer.slice(t.byteOffset,t.byteOffset+t.length)}function ve(t){if(ve.readOnly=true,Buffer.isBuffer(t))return t;let e;return t instanceof ArrayBuffer?e=new Ee(t):ArrayBuffer.isView(t)?e=new Ee(t.buffer,t.byteOffset,t.byteLength):(e=Buffer.from(t),ve.readOnly=false),e}ne.exports={concat:Zt,mask:Ye,toArrayBuffer:Qt,toBuffer:ve,unmask:Ke};if(!process.env.WS_NO_BUFFER_UTIL)try{let t=chunkBUNLC3II_cjs.a("bufferutil");ne.exports.mask=function(e,s,r,i,n){n<48?Ye(e,s,r,i,n):t.mask(e,s,r,i,n);},ne.exports.unmask=function(e,s){e.length<32?Ke(e,s):t.unmask(e,s);};}catch{}});var Qe=chunkBUNLC3II_cjs.c((kr,Ze)=>{chunkBUNLC3II_cjs.h();var Xe=Symbol("kDone"),be=Symbol("kRun"),we=class{constructor(e){this[Xe]=()=>{this.pending--,this[be]();},this.concurrency=e||1/0,this.jobs=[],this.pending=0;}add(e){this.jobs.push(e),this[be]();}[be](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Xe]);}}};Ze.exports=we;});var j=chunkBUNLC3II_cjs.c((Lr,st)=>{chunkBUNLC3II_cjs.h();var J=chunkBUNLC3II_cjs.a("zlib"),Je=Q(),Jt=Qe(),{kStatusCode:et}=C(),es=Buffer[Symbol.species],ts=Buffer.from([0,0,255,255]),ae=Symbol("permessage-deflate"),L=Symbol("total-length"),G=Symbol("callback"),R=Symbol("buffers"),$=Symbol("error"),oe,Oe=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!oe){let s=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;oe=new Jt(s);}}static get extensionName(){return "permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=true),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=true),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=true),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[G];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"));}}acceptAsServer(e){let s=this._options,r=e.find(i=>!(s.serverNoContextTakeover===false&&i.server_no_context_takeover||i.server_max_window_bits&&(s.serverMaxWindowBits===false||typeof s.serverMaxWindowBits=="number"&&s.serverMaxWindowBits>i.server_max_window_bits)||typeof s.clientMaxWindowBits=="number"&&!i.client_max_window_bits));if(!r)throw new Error("None of the extension offers can be accepted");return s.serverNoContextTakeover&&(r.server_no_context_takeover=true),s.clientNoContextTakeover&&(r.client_no_context_takeover=true),typeof s.serverMaxWindowBits=="number"&&(r.server_max_window_bits=s.serverMaxWindowBits),typeof s.clientMaxWindowBits=="number"?r.client_max_window_bits=s.clientMaxWindowBits:(r.client_max_window_bits===true||s.clientMaxWindowBits===false)&&delete r.client_max_window_bits,r}acceptAsClient(e){let s=e[0];if(this._options.clientNoContextTakeover===false&&s.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!s.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(s.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===false||typeof this._options.clientMaxWindowBits=="number"&&s.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return s}normalizeParams(e){return e.forEach(s=>{Object.keys(s).forEach(r=>{let i=s[r];if(i.length>1)throw new Error(`Parameter "${r}" must have only a single value`);if(i=i[0],r==="client_max_window_bits"){if(i!==true){let n=+i;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${i}`);i=n;}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${r}": ${i}`)}else if(r==="server_max_window_bits"){let n=+i;if(!Number.isInteger(n)||n<8||n>15)throw new TypeError(`Invalid value for parameter "${r}": ${i}`);i=n;}else if(r==="client_no_context_takeover"||r==="server_no_context_takeover"){if(i!==true)throw new TypeError(`Invalid value for parameter "${r}": ${i}`)}else throw new Error(`Unknown parameter "${r}"`);s[r]=i;});}),e}decompress(e,s,r){oe.add(i=>{this._decompress(e,s,(n,o)=>{i(),r(n,o);});});}compress(e,s,r){oe.add(i=>{this._compress(e,s,(n,o)=>{i(),r(n,o);});});}_decompress(e,s,r){let i=this._isServer?"client":"server";if(!this._inflate){let n=`${i}_max_window_bits`,o=typeof this.params[n]!="number"?J.Z_DEFAULT_WINDOWBITS:this.params[n];this._inflate=J.createInflateRaw({...this._options.zlibInflateOptions,windowBits:o}),this._inflate[ae]=this,this._inflate[L]=0,this._inflate[R]=[],this._inflate.on("error",rs),this._inflate.on("data",tt);}this._inflate[G]=r,this._inflate.write(e),s&&this._inflate.write(ts),this._inflate.flush(()=>{let n=this._inflate[$];if(n){this._inflate.close(),this._inflate=null,r(n);return}let o=Je.concat(this._inflate[R],this._inflate[L]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[L]=0,this._inflate[R]=[],s&&this.params[`${i}_no_context_takeover`]&&this._inflate.reset()),r(null,o);});}_compress(e,s,r){let i=this._isServer?"server":"client";if(!this._deflate){let n=`${i}_max_window_bits`,o=typeof this.params[n]!="number"?J.Z_DEFAULT_WINDOWBITS:this.params[n];this._deflate=J.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:o}),this._deflate[L]=0,this._deflate[R]=[],this._deflate.on("data",ss);}this._deflate[G]=r,this._deflate.write(e),this._deflate.flush(J.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let n=Je.concat(this._deflate[R],this._deflate[L]);s&&(n=new es(n.buffer,n.byteOffset,n.length-4)),this._deflate[G]=null,this._deflate[L]=0,this._deflate[R]=[],s&&this.params[`${i}_no_context_takeover`]&&this._deflate.reset(),r(null,n);});}};st.exports=Oe;function ss(t){this[R].push(t),this[L]+=t.length;}function tt(t){if(this[L]+=t.length,this[ae]._maxPayload<1||this[L]<=this[ae]._maxPayload){this[R].push(t);return}this[$]=new RangeError("Max payload size exceeded"),this[$].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[$][et]=1009,this.removeListener("data",tt),this.reset();}function rs(t){if(this[ae]._inflate=null,this[$]){this[G](this[$]);return}t[et]=1007,this[G](t);}});var V=chunkBUNLC3II_cjs.c((Pr,fe)=>{chunkBUNLC3II_cjs.h();var{isUtf8:rt}=chunkBUNLC3II_cjs.a("buffer"),{hasBlob:is}=C(),ns=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function os(t){return t>=1e3&&t<=1014&&t!==1004&&t!==1005&&t!==1006||t>=3e3&&t<=4999}function Te(t){let e=t.length,s=0;for(;s<e;)if((t[s]&128)===0)s++;else if((t[s]&224)===192){if(s+1===e||(t[s+1]&192)!==128||(t[s]&254)===192)return false;s+=2;}else if((t[s]&240)===224){if(s+2>=e||(t[s+1]&192)!==128||(t[s+2]&192)!==128||t[s]===224&&(t[s+1]&224)===128||t[s]===237&&(t[s+1]&224)===160)return false;s+=3;}else if((t[s]&248)===240){if(s+3>=e||(t[s+1]&192)!==128||(t[s+2]&192)!==128||(t[s+3]&192)!==128||t[s]===240&&(t[s+1]&240)===128||t[s]===244&&t[s+1]>143||t[s]>244)return false;s+=4;}else return false;return true}function as(t){return is&&typeof t=="object"&&typeof t.arrayBuffer=="function"&&typeof t.type=="string"&&typeof t.stream=="function"&&(t[Symbol.toStringTag]==="Blob"||t[Symbol.toStringTag]==="File")}fe.exports={isBlob:as,isValidStatusCode:os,isValidUTF8:Te,tokenChars:ns};if(rt)fe.exports.isValidUTF8=function(t){return t.length<24?Te(t):rt(t)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let t=chunkBUNLC3II_cjs.a("utf-8-validate");fe.exports.isValidUTF8=function(e){return e.length<32?Te(e):t(e)};}catch{}});var Pe=chunkBUNLC3II_cjs.c((Rr,ht)=>{chunkBUNLC3II_cjs.h();var{Writable:fs}=chunkBUNLC3II_cjs.a("stream"),it=j(),{BINARY_TYPES:ls,EMPTY_BUFFER:nt,kStatusCode:hs,kWebSocket:cs}=C(),{concat:ke,toArrayBuffer:us,unmask:ds}=Q(),{isValidStatusCode:_s,isValidUTF8:ot}=V(),le=Buffer[Symbol.species],w=0,at=1,ft=2,lt=3,Ce=4,Le=5,he=6,Ne=class extends fs{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:true,this._binaryType=e.binaryType||ls[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=e.maxBufferedChunks|0,this._maxFragments=e.maxFragments|0,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[cs]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=false,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=false,this._fin=false,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=false,this._loop=false,this._state=w;}_write(e,s,r){if(this._opcode===8&&this._state==w)return r();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){r(this.createError(RangeError,"Too many buffered chunks",false,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(r);}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let r=this._buffers[0];return this._buffers[0]=new le(r.buffer,r.byteOffset+e,r.length-e),new le(r.buffer,r.byteOffset,e)}let s=Buffer.allocUnsafe(e);do{let r=this._buffers[0],i=s.length-e;e>=r.length?s.set(this._buffers.shift(),i):(s.set(new Uint8Array(r.buffer,r.byteOffset,e),i),this._buffers[0]=new le(r.buffer,r.byteOffset+e,r.length-e)),e-=r.length;}while(e>0);return s}startLoop(e){this._loop=true;do switch(this._state){case w:this.getInfo(e);break;case at:this.getPayloadLength16(e);break;case ft:this.getPayloadLength64(e);break;case lt:this.getMask();break;case Ce:this.getData(e);break;case Le:case he:this._loop=false;return}while(this._loop);this._errored||e();}getInfo(e){if(this._bufferedBytes<2){this._loop=false;return}let s=this.consume(2);if((s[0]&48)!==0){let i=this.createError(RangeError,"RSV2 and RSV3 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(i);return}let r=(s[0]&64)===64;if(r&&!this._extensions[it.extensionName]){let i=this.createError(RangeError,"RSV1 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(this._fin=(s[0]&128)===128,this._opcode=s[0]&15,this._payloadLength=s[1]&127,this._opcode===0){if(r){let i=this.createError(RangeError,"RSV1 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(!this._fragmented){let i=this.createError(RangeError,"invalid opcode 0",true,1002,"WS_ERR_INVALID_OPCODE");e(i);return}this._opcode=this._fragmented;}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,true,1002,"WS_ERR_INVALID_OPCODE");e(i);return}this._compressed=r;}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let i=this.createError(RangeError,"FIN must be set",true,1002,"WS_ERR_EXPECTED_FIN");e(i);return}if(r){let i=this.createError(RangeError,"RSV1 must be clear",true,1002,"WS_ERR_UNEXPECTED_RSV_1");e(i);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let i=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,true,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(i);return}}else {let i=this.createError(RangeError,`invalid opcode ${this._opcode}`,true,1002,"WS_ERR_INVALID_OPCODE");e(i);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(s[1]&128)===128,this._isServer){if(!this._masked){let i=this.createError(RangeError,"MASK must be set",true,1002,"WS_ERR_EXPECTED_MASK");e(i);return}}else if(this._masked){let i=this.createError(RangeError,"MASK must be clear",true,1002,"WS_ERR_UNEXPECTED_MASK");e(i);return}this._payloadLength===126?this._state=at:this._payloadLength===127?this._state=ft:this.haveLength(e);}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=false;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e);}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=false;return}let s=this.consume(8),r=s.readUInt32BE(0);if(r>Math.pow(2,21)-1){let i=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",false,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(i);return}this._payloadLength=r*Math.pow(2,32)+s.readUInt32BE(4),this.haveLength(e);}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let s=this.createError(RangeError,"Max payload size exceeded",false,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(s);return}this._masked?this._state=lt:this._state=Ce;}getMask(){if(this._bufferedBytes<4){this._loop=false;return}this._mask=this.consume(4),this._state=Ce;}getData(e){let s=nt;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=false;return}s=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&ds(s,this._mask);}if(this._opcode>7){this.controlMessage(s,e);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let r=this.createError(RangeError,"Too many message fragments",false,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");e(r);return}if(this._compressed){this._state=Le,this.decompress(s,e);return}s.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(s)),this.dataMessage(e);}decompress(e,s){this._extensions[it.extensionName].decompress(e,this._fin,(i,n)=>{if(i)return s(i);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let o=this.createError(RangeError,"Max payload size exceeded",false,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");s(o);return}this._fragments.push(n);}this.dataMessage(s),this._state===w&&this.startLoop(s);});}dataMessage(e){if(!this._fin){this._state=w;return}let s=this._messageLength,r=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],this._opcode===2){let i;this._binaryType==="nodebuffer"?i=ke(r,s):this._binaryType==="arraybuffer"?i=us(ke(r,s)):this._binaryType==="blob"?i=new Blob(r):i=r,this._allowSynchronousEvents?(this.emit("message",i,true),this._state=w):(this._state=he,setImmediate(()=>{this.emit("message",i,true),this._state=w,this.startLoop(e);}));}else {let i=ke(r,s);if(!this._skipUTF8Validation&&!ot(i)){let n=this.createError(Error,"invalid UTF-8 sequence",true,1007,"WS_ERR_INVALID_UTF8");e(n);return}this._state===Le||this._allowSynchronousEvents?(this.emit("message",i,false),this._state=w):(this._state=he,setImmediate(()=>{this.emit("message",i,false),this._state=w,this.startLoop(e);}));}}controlMessage(e,s){if(this._opcode===8){if(e.length===0)this._loop=false,this.emit("conclude",1005,nt),this.end();else {let r=e.readUInt16BE(0);if(!_s(r)){let n=this.createError(RangeError,`invalid status code ${r}`,true,1002,"WS_ERR_INVALID_CLOSE_CODE");s(n);return}let i=new le(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!ot(i)){let n=this.createError(Error,"invalid UTF-8 sequence",true,1007,"WS_ERR_INVALID_UTF8");s(n);return}this._loop=false,this.emit("conclude",r,i),this.end();}this._state=w;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=w):(this._state=he,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=w,this.startLoop(s);}));}createError(e,s,r,i,n){this._loop=false,this._errored=true;let o=new e(r?`Invalid WebSocket frame: ${s}`:s);return Error.captureStackTrace(o,this.createError),o.code=n,o[hs]=i,o}};ht.exports=Ne;});var Ue=chunkBUNLC3II_cjs.c((Dr,dt)=>{chunkBUNLC3II_cjs.h();var{Duplex:Ir}=chunkBUNLC3II_cjs.a("stream"),{randomFillSync:ms}=chunkBUNLC3II_cjs.a("crypto"),{types:{isUint8Array:ps}}=chunkBUNLC3II_cjs.a("util"),ct=j(),{EMPTY_BUFFER:gs,kWebSocket:ys,NOOP:xs}=C(),{isBlob:z,isValidStatusCode:Ss}=V(),{mask:ut,toBuffer:I}=Q(),O=Symbol("kByteLength"),Es=Buffer.alloc(4),ce=8*1024,D,H=ce,T=0,vs=1,bs=2,Be=class t{constructor(e,s,r){this._extensions=s||{},r&&(this._generateMask=r,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=true,this._compress=false,this._bufferedBytes=0,this._queue=[],this._state=T,this.onerror=xs,this[ys]=void 0;}static frame(e,s){let r,i=false,n=2,o=false;s.mask&&(r=s.maskBuffer||Es,s.generateMask?s.generateMask(r):(H===ce&&(D===void 0&&(D=Buffer.alloc(ce)),ms(D,0,ce),H=0),r[0]=D[H++],r[1]=D[H++],r[2]=D[H++],r[3]=D[H++]),o=(r[0]|r[1]|r[2]|r[3])===0,n=6);let f;typeof e=="string"?(!s.mask||o)&&s[O]!==void 0?f=s[O]:(e=Buffer.from(e),f=e.length):(f=e.length,i=s.mask&&s.readOnly&&!o);let l=f;f>=65536?(n+=8,l=127):f>125&&(n+=2,l=126);let a=Buffer.allocUnsafe(i?f+n:n);return a[0]=s.fin?s.opcode|128:s.opcode,s.rsv1&&(a[0]|=64),a[1]=l,l===126?a.writeUInt16BE(f,2):l===127&&(a[2]=a[3]=0,a.writeUIntBE(f,4,6)),s.mask?(a[1]|=128,a[n-4]=r[0],a[n-3]=r[1],a[n-2]=r[2],a[n-1]=r[3],o?[a,e]:i?(ut(e,r,a,n,f),[a]):(ut(e,r,e,0,f),[a,e])):[a,e]}close(e,s,r,i){let n;if(e===void 0)n=gs;else {if(typeof e!="number"||!Ss(e))throw new TypeError("First argument must be a valid error code number");if(s===void 0||!s.length)n=Buffer.allocUnsafe(2),n.writeUInt16BE(e,0);else {let f=Buffer.byteLength(s);if(f>123)throw new RangeError("The message must not be greater than 123 bytes");if(n=Buffer.allocUnsafe(2+f),n.writeUInt16BE(e,0),typeof s=="string")n.write(s,2);else if(ps(s))n.set(s,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let o={[O]:n.length,fin:true,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:false,rsv1:false};this._state!==T?this.enqueue([this.dispatch,n,false,o,i]):this.sendFrame(t.frame(n,o),i);}ping(e,s,r){let i,n;if(typeof e=="string"?(i=Buffer.byteLength(e),n=false):z(e)?(i=e.size,n=false):(e=I(e),i=e.length,n=I.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[O]:i,fin:true,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:9,readOnly:n,rsv1:false};z(e)?this._state!==T?this.enqueue([this.getBlobData,e,false,o,r]):this.getBlobData(e,false,o,r):this._state!==T?this.enqueue([this.dispatch,e,false,o,r]):this.sendFrame(t.frame(e,o),r);}pong(e,s,r){let i,n;if(typeof e=="string"?(i=Buffer.byteLength(e),n=false):z(e)?(i=e.size,n=false):(e=I(e),i=e.length,n=I.readOnly),i>125)throw new RangeError("The data size must not be greater than 125 bytes");let o={[O]:i,fin:true,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:10,readOnly:n,rsv1:false};z(e)?this._state!==T?this.enqueue([this.getBlobData,e,false,o,r]):this.getBlobData(e,false,o,r):this._state!==T?this.enqueue([this.dispatch,e,false,o,r]):this.sendFrame(t.frame(e,o),r);}send(e,s,r){let i=this._extensions[ct.extensionName],n=s.binary?2:1,o=s.compress,f,l;typeof e=="string"?(f=Buffer.byteLength(e),l=false):z(e)?(f=e.size,l=false):(e=I(e),f=e.length,l=I.readOnly),this._firstFragment?(this._firstFragment=false,o&&i&&i.params[i._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(o=f>=i._threshold),this._compress=o):(o=false,n=0),s.fin&&(this._firstFragment=true);let a={[O]:f,fin:s.fin,generateMask:this._generateMask,mask:s.mask,maskBuffer:this._maskBuffer,opcode:n,readOnly:l,rsv1:o};z(e)?this._state!==T?this.enqueue([this.getBlobData,e,this._compress,a,r]):this.getBlobData(e,this._compress,a,r):this._state!==T?this.enqueue([this.dispatch,e,this._compress,a,r]):this.dispatch(e,this._compress,a,r);}getBlobData(e,s,r,i){this._bufferedBytes+=r[O],this._state=bs,e.arrayBuffer().then(n=>{if(this._socket.destroyed){let f=new Error("The socket was closed while the blob was being read");process.nextTick(Re,this,f,i);return}this._bufferedBytes-=r[O];let o=I(n);s?this.dispatch(o,s,r,i):(this._state=T,this.sendFrame(t.frame(o,r),i),this.dequeue());}).catch(n=>{process.nextTick(ws,this,n,i);});}dispatch(e,s,r,i){if(!s){this.sendFrame(t.frame(e,r),i);return}let n=this._extensions[ct.extensionName];this._bufferedBytes+=r[O],this._state=vs,n.compress(e,r.fin,(o,f)=>{if(this._socket.destroyed){let l=new Error("The socket was closed while data was being compressed");Re(this,l,i);return}this._bufferedBytes-=r[O],this._state=T,r.readOnly=false,this.sendFrame(t.frame(f,r),i),this.dequeue();});}dequeue(){for(;this._state===T&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][O],Reflect.apply(e[0],this,e.slice(1));}}enqueue(e){this._bufferedBytes+=e[3][O],this._queue.push(e);}sendFrame(e,s){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],s),this._socket.uncork()):this._socket.write(e[0],s);}};dt.exports=Be;function Re(t,e,s){typeof s=="function"&&s(e);for(let r=0;r<t._queue.length;r++){let i=t._queue[r],n=i[i.length-1];typeof n=="function"&&n(e);}}function ws(t,e,s){Re(t,e,s),t.onerror(e);}});var vt=chunkBUNLC3II_cjs.c((Fr,Et)=>{chunkBUNLC3II_cjs.h();var{kForOnEventAttribute:ee,kListener:Ie}=C(),_t=Symbol("kCode"),mt=Symbol("kData"),pt=Symbol("kError"),gt=Symbol("kMessage"),yt=Symbol("kReason"),Y=Symbol("kTarget"),xt=Symbol("kType"),St=Symbol("kWasClean"),N=class{constructor(e){this[Y]=null,this[xt]=e;}get target(){return this[Y]}get type(){return this[xt]}};Object.defineProperty(N.prototype,"target",{enumerable:true});Object.defineProperty(N.prototype,"type",{enumerable:true});var M=class extends N{constructor(e,s={}){super(e),this[_t]=s.code===void 0?0:s.code,this[yt]=s.reason===void 0?"":s.reason,this[St]=s.wasClean===void 0?false:s.wasClean;}get code(){return this[_t]}get reason(){return this[yt]}get wasClean(){return this[St]}};Object.defineProperty(M.prototype,"code",{enumerable:true});Object.defineProperty(M.prototype,"reason",{enumerable:true});Object.defineProperty(M.prototype,"wasClean",{enumerable:true});var K=class extends N{constructor(e,s={}){super(e),this[pt]=s.error===void 0?null:s.error,this[gt]=s.message===void 0?"":s.message;}get error(){return this[pt]}get message(){return this[gt]}};Object.defineProperty(K.prototype,"error",{enumerable:true});Object.defineProperty(K.prototype,"message",{enumerable:true});var te=class extends N{constructor(e,s={}){super(e),this[mt]=s.data===void 0?null:s.data;}get data(){return this[mt]}};Object.defineProperty(te.prototype,"data",{enumerable:true});var Os={addEventListener(t,e,s={}){for(let i of this.listeners(t))if(!s[ee]&&i[Ie]===e&&!i[ee])return;let r;if(t==="message")r=function(n,o){let f=new te("message",{data:o?n:n.toString()});f[Y]=this,ue(e,this,f);};else if(t==="close")r=function(n,o){let f=new M("close",{code:n,reason:o.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});f[Y]=this,ue(e,this,f);};else if(t==="error")r=function(n){let o=new K("error",{error:n,message:n.message});o[Y]=this,ue(e,this,o);};else if(t==="open")r=function(){let n=new N("open");n[Y]=this,ue(e,this,n);};else return;r[ee]=!!s[ee],r[Ie]=e,s.once?this.once(t,r):this.on(t,r);},removeEventListener(t,e){for(let s of this.listeners(t))if(s[Ie]===e&&!s[ee]){this.removeListener(t,s);break}}};Et.exports={CloseEvent:M,ErrorEvent:K,Event:N,EventTarget:Os,MessageEvent:te};function ue(t,e,s){typeof t=="object"&&t.handleEvent?t.handleEvent.call(t,s):t.call(e,s);}});var de=chunkBUNLC3II_cjs.c((Wr,bt)=>{chunkBUNLC3II_cjs.h();var{tokenChars:se}=V();function k(t,e,s){t[e]===void 0?t[e]=[s]:t[e].push(s);}function Ts(t){let e=Object.create(null),s=Object.create(null),r=false,i=false,n=false,o,f,l=-1,a=-1,h=-1,c=0;for(;c<t.length;c++)if(a=t.charCodeAt(c),o===void 0)if(h===-1&&se[a]===1)l===-1&&(l=c);else if(c!==0&&(a===32||a===9))h===-1&&l!==-1&&(h=c);else if(a===59||a===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${c}`);h===-1&&(h=c);let y=t.slice(l,h);a===44?(k(e,y,s),s=Object.create(null)):o=y,l=h=-1;}else throw new SyntaxError(`Unexpected character at index ${c}`);else if(f===void 0)if(h===-1&&se[a]===1)l===-1&&(l=c);else if(a===32||a===9)h===-1&&l!==-1&&(h=c);else if(a===59||a===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${c}`);h===-1&&(h=c),k(s,t.slice(l,h),true),a===44&&(k(e,o,s),s=Object.create(null),o=void 0),l=h=-1;}else if(a===61&&l!==-1&&h===-1)f=t.slice(l,c),l=h=-1;else throw new SyntaxError(`Unexpected character at index ${c}`);else if(i){if(se[a]!==1)throw new SyntaxError(`Unexpected character at index ${c}`);l===-1?l=c:r||(r=true),i=false;}else if(n)if(se[a]===1)l===-1&&(l=c);else if(a===34&&l!==-1)n=false,h=c;else if(a===92)i=true;else throw new SyntaxError(`Unexpected character at index ${c}`);else if(a===34&&t.charCodeAt(c-1)===61)n=true;else if(h===-1&&se[a]===1)l===-1&&(l=c);else if(l!==-1&&(a===32||a===9))h===-1&&(h=c);else if(a===59||a===44){if(l===-1)throw new SyntaxError(`Unexpected character at index ${c}`);h===-1&&(h=c);let y=t.slice(l,h);r&&(y=y.replace(/\\/g,""),r=false),k(s,f,y),a===44&&(k(e,o,s),s=Object.create(null),o=void 0),f=void 0,l=h=-1;}else throw new SyntaxError(`Unexpected character at index ${c}`);if(l===-1||n||a===32||a===9)throw new SyntaxError("Unexpected end of input");h===-1&&(h=c);let m=t.slice(l,h);return o===void 0?k(e,m,s):(f===void 0?k(s,m,true):r?k(s,f,m.replace(/\\/g,"")):k(s,f,m),k(e,o,s)),e}function ks(t){return Object.keys(t).map(e=>{let s=t[e];return Array.isArray(s)||(s=[s]),s.map(r=>[e].concat(Object.keys(r).map(i=>{let n=r[i];return Array.isArray(n)||(n=[n]),n.map(o=>o===true?i:`${i}=${o}`).join("; ")})).join("; ")).join(", ")}).join(", ")}bt.exports={format:ks,parse:Ts};});var ge=chunkBUNLC3II_cjs.c((jr,It)=>{chunkBUNLC3II_cjs.h();var Cs=chunkBUNLC3II_cjs.a("events"),Ls=chunkBUNLC3II_cjs.a("https"),Ns=chunkBUNLC3II_cjs.a("http"),Tt=chunkBUNLC3II_cjs.a("net"),Ps=chunkBUNLC3II_cjs.a("tls"),{randomBytes:Bs,createHash:Rs}=chunkBUNLC3II_cjs.a("crypto"),{Duplex:Gr,Readable:$r}=chunkBUNLC3II_cjs.a("stream"),{URL:De}=chunkBUNLC3II_cjs.a("url"),U=j(),Us=Pe(),Is=Ue(),{isBlob:Ds}=V(),{BINARY_TYPES:wt,CLOSE_TIMEOUT:Ms,EMPTY_BUFFER:_e,GUID:Fs,kForOnEventAttribute:Me,kListener:As,kStatusCode:Ws,kWebSocket:x,NOOP:kt}=C(),{EventTarget:{addEventListener:qs,removeEventListener:Gs}}=vt(),{format:$s,parse:js}=de(),{toBuffer:Vs}=Q(),Ct=Symbol("kAborted"),Fe=[8,13],P=["CONNECTING","OPEN","CLOSING","CLOSED"],zs=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,_=class t extends Cs{constructor(e,s,r){super(),this._binaryType=wt[0],this._closeCode=1006,this._closeFrameReceived=false,this._closeFrameSent=false,this._closeMessage=_e,this._closeTimer=null,this._errorEmitted=false,this._extensions={},this._paused=false,this._protocol="",this._readyState=t.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=false,this._redirects=0,s===void 0?s=[]:Array.isArray(s)||(typeof s=="object"&&s!==null?(r=s,s=[]):s=[s]),Lt(this,e,s,r)):(this._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=true);}get binaryType(){return this._binaryType}set binaryType(e){wt.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e));}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,s,r){let i=new Us({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),n=new Is(e,this._extensions,r.generateMask);this._receiver=i,this._sender=n,this._socket=e,i[x]=this,n[x]=this,e[x]=this,i.on("conclude",Ks),i.on("drain",Xs),i.on("error",Zs),i.on("message",Qs),i.on("ping",Js),i.on("pong",er),n.onerror=tr,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),s.length>0&&e.unshift(s),e.on("close",Bt),e.on("data",pe),e.on("end",Rt),e.on("error",Ut),this._readyState=t.OPEN,this.emit("open");}emitClose(){if(!this._socket){this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[U.extensionName]&&this._extensions[U.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=t.CLOSED,this.emit("close",this._closeCode,this._closeMessage);}close(e,s){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){b(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===t.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=t.CLOSING,this._sender.close(e,s,!this._isServer,r=>{r||(this._closeFrameSent=true,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end());}),Pt(this);}}pause(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=true,this._socket.pause());}ping(e,s,r){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=s=void 0):typeof s=="function"&&(r=s,s=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Ae(this,e,r);return}s===void 0&&(s=!this._isServer),this._sender.ping(e||_e,s,r);}pong(e,s,r){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(r=e,e=s=void 0):typeof s=="function"&&(r=s,s=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Ae(this,e,r);return}s===void 0&&(s=!this._isServer),this._sender.pong(e||_e,s,r);}resume(){this.readyState===t.CONNECTING||this.readyState===t.CLOSED||(this._paused=false,this._receiver._writableState.needDrain||this._socket.resume());}send(e,s,r){if(this.readyState===t.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof s=="function"&&(r=s,s={}),typeof e=="number"&&(e=e.toString()),this.readyState!==t.OPEN){Ae(this,e,r);return}let i={binary:typeof e!="string",mask:!this._isServer,compress:true,fin:true,...s};this._extensions[U.extensionName]||(i.compress=false),this._sender.send(e||_e,i,r);}terminate(){if(this.readyState!==t.CLOSED){if(this.readyState===t.CONNECTING){b(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=t.CLOSING,this._socket.destroy());}}};Object.defineProperty(_,"CONNECTING",{enumerable:true,value:P.indexOf("CONNECTING")});Object.defineProperty(_.prototype,"CONNECTING",{enumerable:true,value:P.indexOf("CONNECTING")});Object.defineProperty(_,"OPEN",{enumerable:true,value:P.indexOf("OPEN")});Object.defineProperty(_.prototype,"OPEN",{enumerable:true,value:P.indexOf("OPEN")});Object.defineProperty(_,"CLOSING",{enumerable:true,value:P.indexOf("CLOSING")});Object.defineProperty(_.prototype,"CLOSING",{enumerable:true,value:P.indexOf("CLOSING")});Object.defineProperty(_,"CLOSED",{enumerable:true,value:P.indexOf("CLOSED")});Object.defineProperty(_.prototype,"CLOSED",{enumerable:true,value:P.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(t=>{Object.defineProperty(_.prototype,t,{enumerable:true});});["open","error","close","message"].forEach(t=>{Object.defineProperty(_.prototype,`on${t}`,{enumerable:true,get(){for(let e of this.listeners(t))if(e[Me])return e[As];return null},set(e){for(let s of this.listeners(t))if(s[Me]){this.removeListener(t,s);break}typeof e=="function"&&this.addEventListener(t,e,{[Me]:true});}});});_.prototype.addEventListener=qs;_.prototype.removeEventListener=Gs;It.exports=_;function Lt(t,e,s,r){let i={allowSynchronousEvents:true,autoPong:true,closeTimeout:Ms,protocolVersion:Fe[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:false,perMessageDeflate:true,followRedirects:false,maxRedirects:10,...r,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(t._autoPong=i.autoPong,t._closeTimeout=i.closeTimeout,!Fe.includes(i.protocolVersion))throw new RangeError(`Unsupported protocol version: ${i.protocolVersion} (supported versions: ${Fe.join(", ")})`);let n;if(e instanceof De)n=e;else try{n=new De(e);}catch{throw new SyntaxError(`Invalid URL: ${e}`)}n.protocol==="http:"?n.protocol="ws:":n.protocol==="https:"&&(n.protocol="wss:"),t._url=n.href;let o=n.protocol==="wss:",f=n.protocol==="ws+unix:",l;if(n.protocol!=="ws:"&&!o&&!f?l=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:f&&!n.pathname?l="The URL's pathname is empty":n.hash&&(l="The URL contains a fragment identifier"),l){let u=new SyntaxError(l);if(t._redirects===0)throw u;me(t,u);return}let a=o?443:80,h=Bs(16).toString("base64"),c=o?Ls.request:Ns.request,m=new Set,y;if(i.createConnection=i.createConnection||(o?Ys:Hs),i.defaultPort=i.defaultPort||a,i.port=n.port||a,i.host=n.hostname.startsWith("[")?n.hostname.slice(1,-1):n.hostname,i.headers={...i.headers,"Sec-WebSocket-Version":i.protocolVersion,"Sec-WebSocket-Key":h,Connection:"Upgrade",Upgrade:"websocket"},i.path=n.pathname+n.search,i.timeout=i.handshakeTimeout,i.perMessageDeflate&&(y=new U({...i.perMessageDeflate,isServer:false,maxPayload:i.maxPayload}),i.headers["Sec-WebSocket-Extensions"]=$s({[U.extensionName]:y.offer()})),s.length){for(let u of s){if(typeof u!="string"||!zs.test(u)||m.has(u))throw new SyntaxError("An invalid or duplicated subprotocol was specified");m.add(u);}i.headers["Sec-WebSocket-Protocol"]=s.join(",");}if(i.origin&&(i.protocolVersion<13?i.headers["Sec-WebSocket-Origin"]=i.origin:i.headers.Origin=i.origin),(n.username||n.password)&&(i.auth=`${n.username}:${n.password}`),f){let u=i.path.split(":");i.socketPath=u[0],i.path=u[1];}let p;if(i.followRedirects){if(t._redirects===0){t._originalIpc=f,t._originalSecure=o,t._originalHostOrSocketPath=f?i.socketPath:n.host;let u=r&&r.headers;if(r={...r,headers:{}},u)for(let[S,W]of Object.entries(u))r.headers[S.toLowerCase()]=W;}else if(t.listenerCount("redirect")===0){let u=f?t._originalIpc?i.socketPath===t._originalHostOrSocketPath:false:t._originalIpc?false:n.host===t._originalHostOrSocketPath;(!u||t._originalSecure&&!o)&&(delete i.headers.authorization,delete i.headers.cookie,u||delete i.headers.host,i.auth=void 0);}i.auth&&!r.headers.authorization&&(r.headers.authorization="Basic "+Buffer.from(i.auth).toString("base64")),p=t._req=c(i),t._redirects&&t.emit("redirect",t.url,p);}else p=t._req=c(i);i.timeout&&p.on("timeout",()=>{b(t,p,"Opening handshake has timed out");}),p.on("error",u=>{p===null||p[Ct]||(p=t._req=null,me(t,u));}),p.on("response",u=>{let S=u.headers.location,W=u.statusCode;if(S&&i.followRedirects&&W>=300&&W<400){if(++t._redirects>i.maxRedirects){b(t,p,"Maximum redirects exceeded");return}p.abort();let X;try{X=new De(S,e);}catch{let q=new SyntaxError(`Invalid URL: ${S}`);me(t,q);return}Lt(t,X,s,r);}else t.emit("unexpected-response",p,u)||b(t,p,`Unexpected server response: ${u.statusCode}`);}),p.on("upgrade",(u,S,W)=>{if(t.emit("upgrade",u),t.readyState!==_.CONNECTING)return;p=t._req=null;let X=u.headers.upgrade;if(X===void 0||X.toLowerCase()!=="websocket"){b(t,S,"Invalid Upgrade header");return}let Ge=Rs("sha1").update(h+Fs).digest("base64");if(u.headers["sec-websocket-accept"]!==Ge){b(t,S,"Invalid Sec-WebSocket-Accept header");return}let q=u.headers["sec-websocket-protocol"],Z;if(q!==void 0?m.size?m.has(q)||(Z="Server sent an invalid subprotocol"):Z="Server sent a subprotocol but none was requested":m.size&&(Z="Server sent no subprotocol"),Z){b(t,S,Z);return}q&&(t._protocol=q);let $e=u.headers["sec-websocket-extensions"];if($e!==void 0){if(!y){b(t,S,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let xe;try{xe=js($e);}catch{b(t,S,"Invalid Sec-WebSocket-Extensions header");return}let je=Object.keys(xe);if(je.length!==1||je[0]!==U.extensionName){b(t,S,"Server indicated an extension that was not requested");return}try{y.accept(xe[U.extensionName]);}catch{b(t,S,"Invalid Sec-WebSocket-Extensions header");return}t._extensions[U.extensionName]=y;}t.setSocket(S,W,{allowSynchronousEvents:i.allowSynchronousEvents,generateMask:i.generateMask,maxBufferedChunks:i.maxBufferedChunks,maxFragments:i.maxFragments,maxPayload:i.maxPayload,skipUTF8Validation:i.skipUTF8Validation});}),i.finishRequest?i.finishRequest(p,t):p.end();}function me(t,e){t._readyState=_.CLOSING,t._errorEmitted=true,t.emit("error",e),t.emitClose();}function Hs(t){return t.path=t.socketPath,Tt.connect(t)}function Ys(t){return t.path=void 0,!t.servername&&t.servername!==""&&(t.servername=Tt.isIP(t.host)?"":t.host),Ps.connect(t)}function b(t,e,s){t._readyState=_.CLOSING;let r=new Error(s);Error.captureStackTrace(r,b),e.setHeader?(e[Ct]=true,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(me,t,r)):(e.destroy(r),e.once("error",t.emit.bind(t,"error")),e.once("close",t.emitClose.bind(t)));}function Ae(t,e,s){if(e){let r=Ds(e)?e.size:Vs(e).length;t._socket?t._sender._bufferedBytes+=r:t._bufferedAmount+=r;}if(s){let r=new Error(`WebSocket is not open: readyState ${t.readyState} (${P[t.readyState]})`);process.nextTick(s,r);}}function Ks(t,e){let s=this[x];s._closeFrameReceived=true,s._closeMessage=e,s._closeCode=t,s._socket[x]!==void 0&&(s._socket.removeListener("data",pe),process.nextTick(Nt,s._socket),t===1005?s.close():s.close(t,e));}function Xs(){let t=this[x];t.isPaused||t._socket.resume();}function Zs(t){let e=this[x];e._socket[x]!==void 0&&(e._socket.removeListener("data",pe),process.nextTick(Nt,e._socket),e.close(t[Ws])),e._errorEmitted||(e._errorEmitted=true,e.emit("error",t));}function Ot(){this[x].emitClose();}function Qs(t,e){this[x].emit("message",t,e);}function Js(t){let e=this[x];e._autoPong&&e.pong(t,!this._isServer,kt),e.emit("ping",t);}function er(t){this[x].emit("pong",t);}function Nt(t){t.resume();}function tr(t){let e=this[x];e.readyState!==_.CLOSED&&(e.readyState===_.OPEN&&(e._readyState=_.CLOSING,Pt(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=true,e.emit("error",t)));}function Pt(t){t._closeTimer=setTimeout(t._socket.destroy.bind(t._socket),t._closeTimeout);}function Bt(){let t=this[x];if(this.removeListener("close",Bt),this.removeListener("data",pe),this.removeListener("end",Rt),t._readyState=_.CLOSING,!this._readableState.endEmitted&&!t._closeFrameReceived&&!t._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);t._receiver.write(e);}t._receiver.end(),this[x]=void 0,clearTimeout(t._closeTimer),t._receiver._writableState.finished||t._receiver._writableState.errorEmitted?t.emitClose():(t._receiver.on("error",Ot),t._receiver.on("finish",Ot));}function pe(t){this[x]._receiver.write(t)||this.pause();}function Rt(){let t=this[x];t._readyState=_.CLOSING,t._receiver.end(),this.end();}function Ut(){let t=this[x];this.removeListener("error",Ut),this.on("error",kt),t&&(t._readyState=_.CLOSING,this.destroy());}});var At=chunkBUNLC3II_cjs.c((Hr,Ft)=>{chunkBUNLC3II_cjs.h();ge();var {Duplex:sr}=chunkBUNLC3II_cjs.a("stream");function Dt(t){t.emit("close");}function rr(){!this.destroyed&&this._writableState.finished&&this.destroy();}function Mt(t){this.removeListener("error",Mt),this.destroy(),this.listenerCount("error")===0&&this.emit("error",t);}function ir(t,e){let s=true,r=new sr({...e,autoDestroy:false,emitClose:false,objectMode:false,writableObjectMode:false});return t.on("message",function(n,o){let f=!o&&r._readableState.objectMode?n.toString():n;r.push(f)||t.pause();}),t.once("error",function(n){r.destroyed||(s=false,r.destroy(n));}),t.once("close",function(){r.destroyed||r.push(null);}),r._destroy=function(i,n){if(t.readyState===t.CLOSED){n(i),process.nextTick(Dt,r);return}let o=false;t.once("error",function(l){o=true,n(l);}),t.once("close",function(){o||n(i),process.nextTick(Dt,r);}),s&&t.terminate();},r._final=function(i){if(t.readyState===t.CONNECTING){t.once("open",function(){r._final(i);});return}t._socket!==null&&(t._socket._writableState.finished?(i(),r._readableState.endEmitted&&r.destroy()):(t._socket.once("finish",function(){i();}),t.close()));},r._read=function(){t.isPaused&&t.resume();},r._write=function(i,n,o){if(t.readyState===t.CONNECTING){t.once("open",function(){r._write(i,n,o);});return}t.send(i,o);},r.on("end",rr),r.on("error",Mt),r}Ft.exports=ir;});var We=chunkBUNLC3II_cjs.c((Kr,Wt)=>{chunkBUNLC3II_cjs.h();var{tokenChars:nr}=V();function or(t){let e=new Set,s=-1,r=-1,i=0;for(i;i<t.length;i++){let o=t.charCodeAt(i);if(r===-1&&nr[o]===1)s===-1&&(s=i);else if(i!==0&&(o===32||o===9))r===-1&&s!==-1&&(r=i);else if(o===44){if(s===-1)throw new SyntaxError(`Unexpected character at index ${i}`);r===-1&&(r=i);let f=t.slice(s,r);if(e.has(f))throw new SyntaxError(`The "${f}" subprotocol is duplicated`);e.add(f),s=r=-1;}else throw new SyntaxError(`Unexpected character at index ${i}`)}if(s===-1||r!==-1)throw new SyntaxError("Unexpected end of input");let n=t.slice(s,i);if(e.has(n))throw new SyntaxError(`The "${n}" subprotocol is duplicated`);return e.add(n),e}Wt.exports={parse:or};});var Ht=chunkBUNLC3II_cjs.c((Qr,zt)=>{chunkBUNLC3II_cjs.h();var ar=chunkBUNLC3II_cjs.a("events"),ye=chunkBUNLC3II_cjs.a("http"),{Duplex:Zr}=chunkBUNLC3II_cjs.a("stream"),{createHash:fr}=chunkBUNLC3II_cjs.a("crypto"),qt=de(),F=j(),lr=We(),hr=ge(),{CLOSE_TIMEOUT:cr,GUID:ur,kWebSocket:dr}=C(),_r=/^[+/0-9A-Za-z]{22}==$/,Gt=0,$t=1,Vt=2,qe=class extends ar{constructor(e,s){if(super(),e={allowSynchronousEvents:true,autoPong:true,maxBufferedChunks:256*1024,maxFragments:16*1024,maxPayload:100*1024*1024,skipUTF8Validation:false,perMessageDeflate:false,handleProtocols:null,clientTracking:true,closeTimeout:cr,verifyClient:null,noServer:false,backlog:null,server:null,host:null,path:null,port:null,WebSocket:hr,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=ye.createServer((r,i)=>{let n=ye.STATUS_CODES[426];i.writeHead(426,{"Content-Length":n.length,"Content-Type":"text/plain"}),i.end(n);}),this._server.listen(e.port,e.host,e.backlog,s)):e.server&&(this._server=e.server),this._server){let r=this.emit.bind(this,"connection");this._removeListeners=mr(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(i,n,o)=>{this.handleUpgrade(i,n,o,r);}});}e.perMessageDeflate===true&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=false),this.options=e,this._state=Gt;}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===Vt){e&&this.once("close",()=>{e(new Error("The server is not running"));}),process.nextTick(re,this);return}if(e&&this.once("close",e),this._state!==$t)if(this._state=$t,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=true:process.nextTick(re,this):process.nextTick(re,this);else {let s=this._server;this._removeListeners(),this._removeListeners=this._server=null,s.close(()=>{re(this);});}}shouldHandle(e){if(this.options.path){let s=e.url.indexOf("?");if((s!==-1?e.url.slice(0,s):e.url)!==this.options.path)return false}return true}handleUpgrade(e,s,r,i){s.on("error",jt);let n=e.headers["sec-websocket-key"],o=e.headers.upgrade,f=+e.headers["sec-websocket-version"];if(e.method!=="GET"){A(this,e,s,405,"Invalid HTTP method");return}if(o===void 0||o.toLowerCase()!=="websocket"){A(this,e,s,400,"Invalid Upgrade header");return}if(n===void 0||!_r.test(n)){A(this,e,s,400,"Missing or invalid Sec-WebSocket-Key header");return}if(f!==13&&f!==8){A(this,e,s,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){ie(s,400);return}let l=e.headers["sec-websocket-protocol"],a=new Set;if(l!==void 0)try{a=lr.parse(l);}catch{A(this,e,s,400,"Invalid Sec-WebSocket-Protocol header");return}let h=e.headers["sec-websocket-extensions"],c={};if(this.options.perMessageDeflate&&h!==void 0){let m=new F({...this.options.perMessageDeflate,isServer:true,maxPayload:this.options.maxPayload});try{let y=qt.parse(h);y[F.extensionName]&&(m.accept(y[F.extensionName]),c[F.extensionName]=m);}catch{A(this,e,s,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let m={origin:e.headers[`${f===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(m,(y,p,u,S)=>{if(!y)return ie(s,p||401,u,S);this.completeUpgrade(c,n,a,e,s,r,i);});return}if(!this.options.verifyClient(m))return ie(s,401)}this.completeUpgrade(c,n,a,e,s,r,i);}completeUpgrade(e,s,r,i,n,o,f){if(!n.readable||!n.writable)return n.destroy();if(n[dr])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Gt)return ie(n,503);let a=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${fr("sha1").update(s+ur).digest("base64")}`],h=new this.options.WebSocket(null,void 0,this.options);if(r.size){let c=this.options.handleProtocols?this.options.handleProtocols(r,i):r.values().next().value;c&&(a.push(`Sec-WebSocket-Protocol: ${c}`),h._protocol=c);}if(e[F.extensionName]){let c=e[F.extensionName].params,m=qt.format({[F.extensionName]:[c]});a.push(`Sec-WebSocket-Extensions: ${m}`),h._extensions=e;}this.emit("headers",a,i),n.write(a.concat(`\r
|
|
2
|
-
`).join(`\r
|
|
3
|
-
`)),n.removeListener("error",jt),h.setSocket(n,o,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(h),h.on("close",()=>{this.clients.delete(h),this._shouldEmitClose&&!this.clients.size&&process.nextTick(re,this);})),f(h,i);}};zt.exports=qe;function mr(t,e){for(let s of Object.keys(e))t.on(s,e[s]);return function(){for(let r of Object.keys(e))t.removeListener(r,e[r]);}}function re(t){t._state=Vt,t.emit("close");}function jt(){this.destroy();}function ie(t,e,s,r){s=s||ye.STATUS_CODES[e],r={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...r},t.once("finish",t.destroy),t.end(`HTTP/1.1 ${e} ${ye.STATUS_CODES[e]}\r
|
|
4
|
-
`+Object.keys(r).map(i=>`${i}: ${r[i]}`).join(`\r
|
|
5
|
-
`)+`\r
|
|
6
|
-
\r
|
|
7
|
-
`+s);}function A(t,e,s,r,i,n){if(t.listenerCount("wsClientError")){let o=new Error(i);Error.captureStackTrace(o,A),t.emit("wsClientError",o,s,e);}else ie(s,r,i,n);}});chunkBUNLC3II_cjs.h();chunkBUNLC3II_cjs.e(At(),1);chunkBUNLC3II_cjs.e(de(),1);chunkBUNLC3II_cjs.e(j(),1);chunkBUNLC3II_cjs.e(Pe(),1);chunkBUNLC3II_cjs.e(Ue(),1);chunkBUNLC3II_cjs.e(We(),1);var Yt=chunkBUNLC3II_cjs.e(ge(),1),vr=chunkBUNLC3II_cjs.e(Ht(),1);var ei=Yt.default;exports.a=Yt;exports.b=vr;exports.c=ei;
|